()
| 177 | } |
| 178 | |
| 179 | function TableFixture() { |
| 180 | let [rows, setRows] = useState(items); |
| 181 | let [selected, setSelected] = useState('0'); |
| 182 | return ( |
| 183 | <> |
| 184 | <Button |
| 185 | id="edit-record" |
| 186 | onPress={() => |
| 187 | setRows(rows => rows.map((row, i) => (i === 2 ? {...row, name: 'Updated record'} : row))) |
| 188 | }> |
| 189 | Update third record |
| 190 | </Button> |
| 191 | <output id="selection-count">{selected}</output> |
| 192 | <Virtualizer layout={TableLayout} layoutOptions={{rowHeight: 40, headingHeight: 40}}> |
| 193 | <Table |
| 194 | aria-label="Records" |
| 195 | className="table" |
| 196 | selectionMode="multiple" |
| 197 | onSelectionChange={keys => setSelected(keys === 'all' ? 'all' : String(keys.size))} |
| 198 | data-bench="records-table"> |
| 199 | <TableHeader> |
| 200 | <Column id="name" isRowHeader width={190}> |
| 201 | Name |
| 202 | </Column> |
| 203 | <Column id="owner" width={120}> |
| 204 | Owner |
| 205 | </Column> |
| 206 | <Column id="status" width={110}> |
| 207 | Status |
| 208 | </Column> |
| 209 | <Column id="amount" width={100}> |
| 210 | Amount |
| 211 | </Column> |
| 212 | <Column id="date" width={140}> |
| 213 | Updated |
| 214 | </Column> |
| 215 | <Column id="category" width={140}> |
| 216 | Category |
| 217 | </Column> |
| 218 | </TableHeader> |
| 219 | <TableBody items={rows}> |
| 220 | {row => ( |
| 221 | <Row id={row.id} data-record={row.id}> |
| 222 | <Cell>{row.name}</Cell> |
| 223 | <Cell>{row.owner}</Cell> |
| 224 | <Cell>{row.status}</Cell> |
| 225 | <Cell>{row.amount}</Cell> |
| 226 | <Cell>{row.date}</Cell> |
| 227 | <Cell>{row.category}</Cell> |
| 228 | </Row> |
| 229 | )} |
| 230 | </TableBody> |
| 231 | </Table> |
| 232 | </Virtualizer> |
| 233 | </> |
| 234 | ); |
| 235 | } |
| 236 |
nothing calls this directly
no test coverage detected