@fluentui/react-table 9.0.0-alpha.2 → 9.0.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +1071 -1
- package/CHANGELOG.md +280 -2
- package/dist/index.d.ts +551 -113
- package/lib/DataGrid.js +2 -0
- package/lib/DataGrid.js.map +1 -0
- package/lib/DataGridBody.js +2 -0
- package/lib/DataGridBody.js.map +1 -0
- package/lib/DataGridCell.js +2 -0
- package/lib/DataGridCell.js.map +1 -0
- package/lib/DataGridHeader.js +2 -0
- package/lib/DataGridHeader.js.map +1 -0
- package/lib/DataGridHeaderCell.js +2 -0
- package/lib/DataGridHeaderCell.js.map +1 -0
- package/lib/DataGridRow.js +2 -0
- package/lib/DataGridRow.js.map +1 -0
- package/lib/DataGridSelectionCell.js +2 -0
- package/lib/DataGridSelectionCell.js.map +1 -0
- package/lib/Table.js.map +1 -1
- package/lib/TableBody.js.map +1 -1
- package/lib/TableCell.js.map +1 -1
- package/lib/TableCellActions.js.map +1 -1
- package/lib/TableCellLayout.js.map +1 -1
- package/lib/TableCellPrimaryLayout.js.map +1 -1
- package/lib/TableHeader.js.map +1 -1
- package/lib/TableHeaderCell.js.map +1 -1
- package/lib/TableRow.js.map +1 -1
- package/lib/TableSelectionCell.js.map +1 -1
- package/lib/components/DataGrid/DataGrid.js +15 -0
- package/lib/components/DataGrid/DataGrid.js.map +1 -0
- package/lib/components/DataGrid/DataGrid.types.js +2 -0
- package/lib/components/DataGrid/DataGrid.types.js.map +1 -0
- package/lib/components/DataGrid/index.js +6 -0
- package/lib/components/DataGrid/index.js.map +1 -0
- package/lib/components/DataGrid/renderDataGrid.js +12 -0
- package/lib/components/DataGrid/renderDataGrid.js.map +1 -0
- package/lib/components/DataGrid/useDataGrid.js +63 -0
- package/lib/components/DataGrid/useDataGrid.js.map +1 -0
- package/lib/components/DataGrid/useDataGridContextValues.js +15 -0
- package/lib/components/DataGrid/useDataGridContextValues.js.map +1 -0
- package/lib/components/DataGrid/useDataGridStyles.js +14 -0
- package/lib/components/DataGrid/useDataGridStyles.js.map +1 -0
- package/lib/components/DataGridBody/DataGridBody.js +14 -0
- package/lib/components/DataGridBody/DataGridBody.js.map +1 -0
- package/lib/components/DataGridBody/DataGridBody.types.js +2 -0
- package/lib/components/DataGridBody/DataGridBody.types.js.map +1 -0
- package/lib/components/DataGridBody/index.js +6 -0
- package/lib/components/DataGridBody/index.js.map +1 -0
- package/lib/components/DataGridBody/renderDataGridBody.js +19 -0
- package/lib/components/DataGridBody/renderDataGridBody.js.map +1 -0
- package/lib/components/DataGridBody/useDataGridBody.js +31 -0
- package/lib/components/DataGridBody/useDataGridBody.js.map +1 -0
- package/lib/components/DataGridBody/useDataGridBodyStyles.js +14 -0
- package/lib/components/DataGridBody/useDataGridBodyStyles.js.map +1 -0
- package/lib/components/DataGridCell/DataGridCell.js +14 -0
- package/lib/components/DataGridCell/DataGridCell.js.map +1 -0
- package/lib/components/DataGridCell/DataGridCell.types.js +2 -0
- package/lib/components/DataGridCell/DataGridCell.types.js.map +1 -0
- package/lib/components/DataGridCell/index.js +6 -0
- package/lib/components/DataGridCell/index.js.map +1 -0
- package/lib/components/DataGridCell/renderDataGridCell.js +8 -0
- package/lib/components/DataGridCell/renderDataGridCell.js.map +1 -0
- package/lib/components/DataGridCell/useDataGridCell.js +21 -0
- package/lib/components/DataGridCell/useDataGridCell.js.map +1 -0
- package/lib/components/DataGridCell/useDataGridCellStyles.js +14 -0
- package/lib/components/DataGridCell/useDataGridCellStyles.js.map +1 -0
- package/lib/components/DataGridHeader/DataGridHeader.js +14 -0
- package/lib/components/DataGridHeader/DataGridHeader.js.map +1 -0
- package/lib/components/DataGridHeader/DataGridHeader.types.js +2 -0
- package/lib/components/DataGridHeader/DataGridHeader.types.js.map +1 -0
- package/lib/components/DataGridHeader/index.js +6 -0
- package/lib/components/DataGridHeader/index.js.map +1 -0
- package/lib/components/DataGridHeader/renderDataGridHeader.js +8 -0
- package/lib/components/DataGridHeader/renderDataGridHeader.js.map +1 -0
- package/lib/components/DataGridHeader/useDataGridHeader.js +17 -0
- package/lib/components/DataGridHeader/useDataGridHeader.js.map +1 -0
- package/lib/components/DataGridHeader/useDataGridHeaderStyles.js +14 -0
- package/lib/components/DataGridHeader/useDataGridHeaderStyles.js.map +1 -0
- package/lib/components/DataGridHeaderCell/DataGridHeaderCell.js +14 -0
- package/lib/components/DataGridHeaderCell/DataGridHeaderCell.js.map +1 -0
- package/lib/components/DataGridHeaderCell/DataGridHeaderCell.types.js +2 -0
- package/lib/components/DataGridHeaderCell/DataGridHeaderCell.types.js.map +1 -0
- package/lib/components/DataGridHeaderCell/index.js +6 -0
- package/lib/components/DataGridHeaderCell/index.js.map +1 -0
- package/lib/components/DataGridHeaderCell/renderDataGridHeaderCell.js +8 -0
- package/lib/components/DataGridHeaderCell/renderDataGridHeaderCell.js.map +1 -0
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js +37 -0
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -0
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCellStyles.js +22 -0
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCellStyles.js.map +1 -0
- package/lib/components/DataGridRow/DataGridRow.js +14 -0
- package/lib/components/DataGridRow/DataGridRow.js.map +1 -0
- package/lib/components/DataGridRow/DataGridRow.types.js +2 -0
- package/lib/components/DataGridRow/DataGridRow.types.js.map +1 -0
- package/lib/components/DataGridRow/index.js +6 -0
- package/lib/components/DataGridRow/index.js.map +1 -0
- package/lib/components/DataGridRow/renderDataGridRow.js +21 -0
- package/lib/components/DataGridRow/renderDataGridRow.js.map +1 -0
- package/lib/components/DataGridRow/useDataGridRow.js +70 -0
- package/lib/components/DataGridRow/useDataGridRow.js.map +1 -0
- package/lib/components/DataGridRow/useDataGridRowStyles.js +18 -0
- package/lib/components/DataGridRow/useDataGridRowStyles.js.map +1 -0
- package/lib/components/DataGridSelectionCell/DataGridSelectionCell.js +14 -0
- package/lib/components/DataGridSelectionCell/DataGridSelectionCell.js.map +1 -0
- package/lib/components/DataGridSelectionCell/DataGridSelectionCell.types.js +2 -0
- package/lib/components/DataGridSelectionCell/DataGridSelectionCell.types.js.map +1 -0
- package/lib/components/DataGridSelectionCell/index.js +6 -0
- package/lib/components/DataGridSelectionCell/index.js.map +1 -0
- package/lib/components/DataGridSelectionCell/renderDataGridSelectionCell.js +8 -0
- package/lib/components/DataGridSelectionCell/renderDataGridSelectionCell.js.map +1 -0
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js +47 -0
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -0
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCellStyles.js +22 -0
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCellStyles.js.map +1 -0
- package/lib/components/Table/Table.js +1 -2
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Table/Table.types.js.map +1 -1
- package/lib/components/Table/index.js.map +1 -1
- package/lib/components/Table/renderTable.js +2 -2
- package/lib/components/Table/renderTable.js.map +1 -1
- package/lib/components/Table/useTable.js +0 -2
- package/lib/components/Table/useTable.js.map +1 -1
- package/lib/components/Table/useTableContextValues.js.map +1 -1
- package/lib/components/Table/useTableStyles.js +26 -11
- package/lib/components/Table/useTableStyles.js.map +1 -1
- package/lib/components/TableBody/TableBody.js +1 -2
- package/lib/components/TableBody/TableBody.js.map +1 -1
- package/lib/components/TableBody/TableBody.types.js.map +1 -1
- package/lib/components/TableBody/index.js.map +1 -1
- package/lib/components/TableBody/renderTableBody.js +3 -4
- package/lib/components/TableBody/renderTableBody.js.map +1 -1
- package/lib/components/TableBody/useTableBody.js +2 -3
- package/lib/components/TableBody/useTableBody.js.map +1 -1
- package/lib/components/TableBody/useTableBodyStyles.js +16 -9
- package/lib/components/TableBody/useTableBodyStyles.js.map +1 -1
- package/lib/components/TableCell/TableCell.js +1 -2
- package/lib/components/TableCell/TableCell.js.map +1 -1
- package/lib/components/TableCell/TableCell.types.js.map +1 -1
- package/lib/components/TableCell/index.js.map +1 -1
- package/lib/components/TableCell/renderTableCell.js +2 -2
- package/lib/components/TableCell/renderTableCell.js.map +1 -1
- package/lib/components/TableCell/useTableCell.js +5 -4
- package/lib/components/TableCell/useTableCell.js.map +1 -1
- package/lib/components/TableCell/useTableCellStyles.js +58 -13
- package/lib/components/TableCell/useTableCellStyles.js.map +1 -1
- package/lib/components/TableCellActions/TableCellActions.js +1 -2
- package/lib/components/TableCellActions/TableCellActions.js.map +1 -1
- package/lib/components/TableCellActions/TableCellActions.types.js.map +1 -1
- package/lib/components/TableCellActions/index.js.map +1 -1
- package/lib/components/TableCellActions/renderTableCellActions.js +3 -4
- package/lib/components/TableCellActions/renderTableCellActions.js.map +1 -1
- package/lib/components/TableCellActions/useTableCellActions.js +5 -5
- package/lib/components/TableCellActions/useTableCellActions.js.map +1 -1
- package/lib/components/TableCellActions/useTableCellActionsStyles.js +12 -20
- package/lib/components/TableCellActions/useTableCellActionsStyles.js.map +1 -1
- package/lib/components/TableCellLayout/TableCellLayout.js +3 -3
- package/lib/components/TableCellLayout/TableCellLayout.js.map +1 -1
- package/lib/components/TableCellLayout/TableCellLayout.types.js.map +1 -1
- package/lib/components/TableCellLayout/index.js.map +1 -1
- package/lib/components/TableCellLayout/renderTableCellLayout.js +14 -7
- package/lib/components/TableCellLayout/renderTableCellLayout.js.map +1 -1
- package/lib/components/TableCellLayout/useTableCellLayout.js +14 -4
- package/lib/components/TableCellLayout/useTableCellLayout.js.map +1 -1
- package/lib/components/TableCellLayout/useTableCellLayoutContextValues.js +13 -0
- package/lib/components/TableCellLayout/useTableCellLayoutContextValues.js.map +1 -0
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js +41 -35
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
- package/lib/components/TableHeader/TableHeader.js +1 -2
- package/lib/components/TableHeader/TableHeader.js.map +1 -1
- package/lib/components/TableHeader/TableHeader.types.js.map +1 -1
- package/lib/components/TableHeader/index.js.map +1 -1
- package/lib/components/TableHeader/renderTableHeader.js +6 -3
- package/lib/components/TableHeader/renderTableHeader.js.map +1 -1
- package/lib/components/TableHeader/useTableHeader.js +3 -11
- package/lib/components/TableHeader/useTableHeader.js.map +1 -1
- package/lib/components/TableHeader/useTableHeaderStyles.js +16 -9
- package/lib/components/TableHeader/useTableHeaderStyles.js.map +1 -1
- package/lib/components/TableHeaderCell/TableHeaderCell.js +1 -2
- package/lib/components/TableHeaderCell/TableHeaderCell.js.map +1 -1
- package/lib/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -1
- package/lib/components/TableHeaderCell/index.js.map +1 -1
- package/lib/components/TableHeaderCell/renderTableHeaderCell.js +6 -4
- package/lib/components/TableHeaderCell/renderTableHeaderCell.js.map +1 -1
- package/lib/components/TableHeaderCell/useTableHeaderCell.js +13 -9
- package/lib/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js +83 -50
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
- package/lib/components/TableRow/TableRow.js +1 -2
- package/lib/components/TableRow/TableRow.js.map +1 -1
- package/lib/components/TableRow/TableRow.types.js.map +1 -1
- package/lib/components/TableRow/index.js.map +1 -1
- package/lib/components/TableRow/renderTableRow.js +3 -4
- package/lib/components/TableRow/renderTableRow.js.map +1 -1
- package/lib/components/TableRow/useTableRow.js +12 -6
- package/lib/components/TableRow/useTableRow.js.map +1 -1
- package/lib/components/TableRow/useTableRowStyles.js +196 -28
- package/lib/components/TableRow/useTableRowStyles.js.map +1 -1
- package/lib/components/TableSelectionCell/TableSelectionCell.js +1 -2
- package/lib/components/TableSelectionCell/TableSelectionCell.js.map +1 -1
- package/lib/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -1
- package/lib/components/TableSelectionCell/index.js.map +1 -1
- package/lib/components/TableSelectionCell/renderTableSelectionCell.js +6 -4
- package/lib/components/TableSelectionCell/renderTableSelectionCell.js.map +1 -1
- package/lib/components/TableSelectionCell/useTableSelectionCell.js +25 -12
- package/lib/components/TableSelectionCell/useTableSelectionCell.js.map +1 -1
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js +59 -27
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
- package/lib/contexts/columnIdContext.js +9 -0
- package/lib/contexts/columnIdContext.js.map +1 -0
- package/lib/contexts/dataGridContext.js +13 -0
- package/lib/contexts/dataGridContext.js.map +1 -0
- package/lib/contexts/rowIdContext.js +9 -0
- package/lib/contexts/rowIdContext.js.map +1 -0
- package/lib/contexts/tableContext.js +0 -1
- package/lib/contexts/tableContext.js.map +1 -1
- package/lib/contexts/tableHeaderContext.js +6 -0
- package/lib/contexts/tableHeaderContext.js.map +1 -0
- package/lib/hooks/createColumn.js +35 -0
- package/lib/hooks/createColumn.js.map +1 -0
- package/lib/hooks/index.js +4 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/selectionManager.js +16 -32
- package/lib/hooks/selectionManager.js.map +1 -1
- package/lib/hooks/types.js.map +1 -1
- package/lib/hooks/useTableFeatures.js +35 -0
- package/lib/hooks/useTableFeatures.js.map +1 -0
- package/lib/hooks/useTableSelection.js +74 -0
- package/lib/hooks/useTableSelection.js.map +1 -0
- package/lib/hooks/useTableSort.js +85 -0
- package/lib/hooks/useTableSort.js.map +1 -0
- package/lib/index.js +9 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/DataGrid.js +8 -0
- package/lib-commonjs/DataGrid.js.map +1 -0
- package/lib-commonjs/DataGridBody.js +8 -0
- package/lib-commonjs/DataGridBody.js.map +1 -0
- package/lib-commonjs/DataGridCell.js +8 -0
- package/lib-commonjs/DataGridCell.js.map +1 -0
- package/lib-commonjs/DataGridHeader.js +8 -0
- package/lib-commonjs/DataGridHeader.js.map +1 -0
- package/lib-commonjs/DataGridHeaderCell.js +8 -0
- package/lib-commonjs/DataGridHeaderCell.js.map +1 -0
- package/lib-commonjs/DataGridRow.js +8 -0
- package/lib-commonjs/DataGridRow.js.map +1 -0
- package/lib-commonjs/DataGridSelectionCell.js +8 -0
- package/lib-commonjs/DataGridSelectionCell.js.map +1 -0
- package/lib-commonjs/Table.js +0 -2
- package/lib-commonjs/Table.js.map +1 -1
- package/lib-commonjs/TableBody.js +0 -2
- package/lib-commonjs/TableBody.js.map +1 -1
- package/lib-commonjs/TableCell.js +0 -2
- package/lib-commonjs/TableCell.js.map +1 -1
- package/lib-commonjs/TableCellActions.js +0 -2
- package/lib-commonjs/TableCellActions.js.map +1 -1
- package/lib-commonjs/TableCellLayout.js +0 -2
- package/lib-commonjs/TableCellLayout.js.map +1 -1
- package/lib-commonjs/TableCellPrimaryLayout.js +0 -2
- package/lib-commonjs/TableCellPrimaryLayout.js.map +1 -1
- package/lib-commonjs/TableHeader.js +0 -2
- package/lib-commonjs/TableHeader.js.map +1 -1
- package/lib-commonjs/TableHeaderCell.js +0 -2
- package/lib-commonjs/TableHeaderCell.js.map +1 -1
- package/lib-commonjs/TableRow.js +0 -2
- package/lib-commonjs/TableRow.js.map +1 -1
- package/lib-commonjs/TableSelectionCell.js +0 -2
- package/lib-commonjs/TableSelectionCell.js.map +1 -1
- package/lib-commonjs/components/DataGrid/DataGrid.js +21 -0
- package/lib-commonjs/components/DataGrid/DataGrid.js.map +1 -0
- package/lib-commonjs/components/DataGrid/DataGrid.types.js +6 -0
- package/lib-commonjs/components/DataGrid/DataGrid.types.js.map +1 -0
- package/lib-commonjs/components/DataGrid/index.js +12 -0
- package/lib-commonjs/components/DataGrid/index.js.map +1 -0
- package/lib-commonjs/components/DataGrid/renderDataGrid.js +19 -0
- package/lib-commonjs/components/DataGrid/renderDataGrid.js.map +1 -0
- package/lib-commonjs/components/DataGrid/useDataGrid.js +70 -0
- package/lib-commonjs/components/DataGrid/useDataGrid.js.map +1 -0
- package/lib-commonjs/components/DataGrid/useDataGridContextValues.js +22 -0
- package/lib-commonjs/components/DataGrid/useDataGridContextValues.js.map +1 -0
- package/lib-commonjs/components/DataGrid/useDataGridStyles.js +21 -0
- package/lib-commonjs/components/DataGrid/useDataGridStyles.js.map +1 -0
- package/lib-commonjs/components/DataGridBody/DataGridBody.js +20 -0
- package/lib-commonjs/components/DataGridBody/DataGridBody.js.map +1 -0
- package/lib-commonjs/components/DataGridBody/DataGridBody.types.js +6 -0
- package/lib-commonjs/components/DataGridBody/DataGridBody.types.js.map +1 -0
- package/lib-commonjs/components/DataGridBody/index.js +12 -0
- package/lib-commonjs/components/DataGridBody/index.js.map +1 -0
- package/lib-commonjs/components/DataGridBody/renderDataGridBody.js +26 -0
- package/lib-commonjs/components/DataGridBody/renderDataGridBody.js.map +1 -0
- package/lib-commonjs/components/DataGridBody/useDataGridBody.js +38 -0
- package/lib-commonjs/components/DataGridBody/useDataGridBody.js.map +1 -0
- package/lib-commonjs/components/DataGridBody/useDataGridBodyStyles.js +21 -0
- package/lib-commonjs/components/DataGridBody/useDataGridBodyStyles.js.map +1 -0
- package/lib-commonjs/components/DataGridCell/DataGridCell.js +20 -0
- package/lib-commonjs/components/DataGridCell/DataGridCell.js.map +1 -0
- package/lib-commonjs/components/DataGridCell/DataGridCell.types.js +6 -0
- package/lib-commonjs/components/DataGridCell/DataGridCell.types.js.map +1 -0
- package/lib-commonjs/components/DataGridCell/index.js +12 -0
- package/lib-commonjs/components/DataGridCell/index.js.map +1 -0
- package/lib-commonjs/components/DataGridCell/renderDataGridCell.js +15 -0
- package/lib-commonjs/components/DataGridCell/renderDataGridCell.js.map +1 -0
- package/lib-commonjs/components/DataGridCell/useDataGridCell.js +28 -0
- package/lib-commonjs/components/DataGridCell/useDataGridCell.js.map +1 -0
- package/lib-commonjs/components/DataGridCell/useDataGridCellStyles.js +21 -0
- package/lib-commonjs/components/DataGridCell/useDataGridCellStyles.js.map +1 -0
- package/lib-commonjs/components/DataGridHeader/DataGridHeader.js +20 -0
- package/lib-commonjs/components/DataGridHeader/DataGridHeader.js.map +1 -0
- package/lib-commonjs/components/DataGridHeader/DataGridHeader.types.js +6 -0
- package/lib-commonjs/components/DataGridHeader/DataGridHeader.types.js.map +1 -0
- package/lib-commonjs/components/DataGridHeader/index.js +12 -0
- package/lib-commonjs/components/DataGridHeader/index.js.map +1 -0
- package/lib-commonjs/components/DataGridHeader/renderDataGridHeader.js +15 -0
- package/lib-commonjs/components/DataGridHeader/renderDataGridHeader.js.map +1 -0
- package/lib-commonjs/components/DataGridHeader/useDataGridHeader.js +24 -0
- package/lib-commonjs/components/DataGridHeader/useDataGridHeader.js.map +1 -0
- package/lib-commonjs/components/DataGridHeader/useDataGridHeaderStyles.js +21 -0
- package/lib-commonjs/components/DataGridHeader/useDataGridHeaderStyles.js.map +1 -0
- package/lib-commonjs/components/DataGridHeaderCell/DataGridHeaderCell.js +20 -0
- package/lib-commonjs/components/DataGridHeaderCell/DataGridHeaderCell.js.map +1 -0
- package/lib-commonjs/components/DataGridHeaderCell/DataGridHeaderCell.types.js +6 -0
- package/lib-commonjs/components/DataGridHeaderCell/DataGridHeaderCell.types.js.map +1 -0
- package/lib-commonjs/components/DataGridHeaderCell/index.js +12 -0
- package/lib-commonjs/components/DataGridHeaderCell/index.js.map +1 -0
- package/lib-commonjs/components/DataGridHeaderCell/renderDataGridHeaderCell.js +15 -0
- package/lib-commonjs/components/DataGridHeaderCell/renderDataGridHeaderCell.js.map +1 -0
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js +44 -0
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -0
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCellStyles.js +29 -0
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCellStyles.js.map +1 -0
- package/lib-commonjs/components/DataGridRow/DataGridRow.js +20 -0
- package/lib-commonjs/components/DataGridRow/DataGridRow.js.map +1 -0
- package/lib-commonjs/components/DataGridRow/DataGridRow.types.js +6 -0
- package/lib-commonjs/components/DataGridRow/DataGridRow.types.js.map +1 -0
- package/lib-commonjs/components/DataGridRow/index.js +12 -0
- package/lib-commonjs/components/DataGridRow/index.js.map +1 -0
- package/lib-commonjs/components/DataGridRow/renderDataGridRow.js +28 -0
- package/lib-commonjs/components/DataGridRow/renderDataGridRow.js.map +1 -0
- package/lib-commonjs/components/DataGridRow/useDataGridRow.js +77 -0
- package/lib-commonjs/components/DataGridRow/useDataGridRow.js.map +1 -0
- package/lib-commonjs/components/DataGridRow/useDataGridRowStyles.js +25 -0
- package/lib-commonjs/components/DataGridRow/useDataGridRowStyles.js.map +1 -0
- package/lib-commonjs/components/DataGridSelectionCell/DataGridSelectionCell.js +20 -0
- package/lib-commonjs/components/DataGridSelectionCell/DataGridSelectionCell.js.map +1 -0
- package/lib-commonjs/components/DataGridSelectionCell/DataGridSelectionCell.types.js +6 -0
- package/lib-commonjs/components/DataGridSelectionCell/DataGridSelectionCell.types.js.map +1 -0
- package/lib-commonjs/components/DataGridSelectionCell/index.js +12 -0
- package/lib-commonjs/components/DataGridSelectionCell/index.js.map +1 -0
- package/lib-commonjs/components/DataGridSelectionCell/renderDataGridSelectionCell.js +15 -0
- package/lib-commonjs/components/DataGridSelectionCell/renderDataGridSelectionCell.js.map +1 -0
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js +54 -0
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -0
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCellStyles.js +29 -0
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCellStyles.js.map +1 -0
- package/lib-commonjs/components/Table/Table.js +1 -8
- package/lib-commonjs/components/Table/Table.js.map +1 -1
- package/lib-commonjs/components/Table/Table.types.js.map +1 -1
- package/lib-commonjs/components/Table/index.js +0 -6
- package/lib-commonjs/components/Table/index.js.map +1 -1
- package/lib-commonjs/components/Table/renderTable.js +2 -7
- package/lib-commonjs/components/Table/renderTable.js.map +1 -1
- package/lib-commonjs/components/Table/useTable.js +0 -5
- package/lib-commonjs/components/Table/useTable.js.map +1 -1
- package/lib-commonjs/components/Table/useTableContextValues.js +0 -3
- package/lib-commonjs/components/Table/useTableContextValues.js.map +1 -1
- package/lib-commonjs/components/Table/useTableStyles.js +26 -15
- package/lib-commonjs/components/Table/useTableStyles.js.map +1 -1
- package/lib-commonjs/components/TableBody/TableBody.js +1 -7
- package/lib-commonjs/components/TableBody/TableBody.js.map +1 -1
- package/lib-commonjs/components/TableBody/TableBody.types.js.map +1 -1
- package/lib-commonjs/components/TableBody/index.js +0 -6
- package/lib-commonjs/components/TableBody/index.js.map +1 -1
- package/lib-commonjs/components/TableBody/renderTableBody.js +3 -8
- package/lib-commonjs/components/TableBody/renderTableBody.js.map +1 -1
- package/lib-commonjs/components/TableBody/useTableBody.js +2 -7
- package/lib-commonjs/components/TableBody/useTableBody.js.map +1 -1
- package/lib-commonjs/components/TableBody/useTableBodyStyles.js +16 -11
- package/lib-commonjs/components/TableBody/useTableBodyStyles.js.map +1 -1
- package/lib-commonjs/components/TableCell/TableCell.js +1 -7
- package/lib-commonjs/components/TableCell/TableCell.js.map +1 -1
- package/lib-commonjs/components/TableCell/TableCell.types.js.map +1 -1
- package/lib-commonjs/components/TableCell/index.js +0 -6
- package/lib-commonjs/components/TableCell/index.js.map +1 -1
- package/lib-commonjs/components/TableCell/renderTableCell.js +2 -6
- package/lib-commonjs/components/TableCell/renderTableCell.js.map +1 -1
- package/lib-commonjs/components/TableCell/useTableCell.js +5 -8
- package/lib-commonjs/components/TableCell/useTableCell.js.map +1 -1
- package/lib-commonjs/components/TableCell/useTableCellStyles.js +58 -17
- package/lib-commonjs/components/TableCell/useTableCellStyles.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/TableCellActions.js +1 -7
- package/lib-commonjs/components/TableCellActions/TableCellActions.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/TableCellActions.types.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/index.js +0 -6
- package/lib-commonjs/components/TableCellActions/index.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/renderTableCellActions.js +3 -8
- package/lib-commonjs/components/TableCellActions/renderTableCellActions.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/useTableCellActions.js +4 -8
- package/lib-commonjs/components/TableCellActions/useTableCellActions.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js +12 -25
- package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/TableCellLayout.js +3 -8
- package/lib-commonjs/components/TableCellLayout/TableCellLayout.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/TableCellLayout.types.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/index.js +0 -6
- package/lib-commonjs/components/TableCellLayout/index.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/renderTableCellLayout.js +14 -11
- package/lib-commonjs/components/TableCellLayout/renderTableCellLayout.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js +14 -7
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutContextValues.js +20 -0
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutContextValues.js.map +1 -0
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js +41 -39
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
- package/lib-commonjs/components/TableHeader/TableHeader.js +1 -7
- package/lib-commonjs/components/TableHeader/TableHeader.js.map +1 -1
- package/lib-commonjs/components/TableHeader/TableHeader.types.js.map +1 -1
- package/lib-commonjs/components/TableHeader/index.js +0 -6
- package/lib-commonjs/components/TableHeader/index.js.map +1 -1
- package/lib-commonjs/components/TableHeader/renderTableHeader.js +6 -7
- package/lib-commonjs/components/TableHeader/renderTableHeader.js.map +1 -1
- package/lib-commonjs/components/TableHeader/useTableHeader.js +3 -16
- package/lib-commonjs/components/TableHeader/useTableHeader.js.map +1 -1
- package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js +16 -12
- package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.js +1 -7
- package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/index.js +0 -6
- package/lib-commonjs/components/TableHeaderCell/index.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/renderTableHeaderCell.js +6 -8
- package/lib-commonjs/components/TableHeaderCell/renderTableHeaderCell.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js +12 -15
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js +83 -54
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
- package/lib-commonjs/components/TableRow/TableRow.js +1 -7
- package/lib-commonjs/components/TableRow/TableRow.js.map +1 -1
- package/lib-commonjs/components/TableRow/TableRow.types.js.map +1 -1
- package/lib-commonjs/components/TableRow/index.js +0 -6
- package/lib-commonjs/components/TableRow/index.js.map +1 -1
- package/lib-commonjs/components/TableRow/renderTableRow.js +3 -8
- package/lib-commonjs/components/TableRow/renderTableRow.js.map +1 -1
- package/lib-commonjs/components/TableRow/useTableRow.js +11 -9
- package/lib-commonjs/components/TableRow/useTableRow.js.map +1 -1
- package/lib-commonjs/components/TableRow/useTableRowStyles.js +196 -33
- package/lib-commonjs/components/TableRow/useTableRowStyles.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.js +1 -7
- package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/index.js +0 -6
- package/lib-commonjs/components/TableSelectionCell/index.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/renderTableSelectionCell.js +6 -8
- package/lib-commonjs/components/TableSelectionCell/renderTableSelectionCell.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js +24 -18
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js +59 -30
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
- package/lib-commonjs/contexts/columnIdContext.js +16 -0
- package/lib-commonjs/contexts/columnIdContext.js.map +1 -0
- package/lib-commonjs/contexts/dataGridContext.js +20 -0
- package/lib-commonjs/contexts/dataGridContext.js.map +1 -0
- package/lib-commonjs/contexts/rowIdContext.js +16 -0
- package/lib-commonjs/contexts/rowIdContext.js.map +1 -0
- package/lib-commonjs/contexts/tableContext.js +0 -5
- package/lib-commonjs/contexts/tableContext.js.map +1 -1
- package/lib-commonjs/contexts/tableHeaderContext.js +13 -0
- package/lib-commonjs/contexts/tableHeaderContext.js.map +1 -0
- package/lib-commonjs/hooks/createColumn.js +42 -0
- package/lib-commonjs/hooks/createColumn.js.map +1 -0
- package/lib-commonjs/hooks/index.js +4 -4
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/selectionManager.js +16 -34
- package/lib-commonjs/hooks/selectionManager.js.map +1 -1
- package/lib-commonjs/hooks/types.js.map +1 -1
- package/lib-commonjs/hooks/useTableFeatures.js +42 -0
- package/lib-commonjs/hooks/useTableFeatures.js.map +1 -0
- package/lib-commonjs/hooks/useTableSelection.js +82 -0
- package/lib-commonjs/hooks/useTableSelection.js.map +1 -0
- package/lib-commonjs/hooks/useTableSort.js +93 -0
- package/lib-commonjs/hooks/useTableSort.js.map +1 -0
- package/lib-commonjs/index.js +252 -26
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +30 -17
- package/lib/hooks/useSelection.js +0 -47
- package/lib/hooks/useSelection.js.map +0 -1
- package/lib/hooks/useSort.js +0 -72
- package/lib/hooks/useSort.js.map +0 -1
- package/lib/hooks/useTable.js +0 -87
- package/lib/hooks/useTable.js.map +0 -1
- package/lib/navigationModes/cell.js +0 -250
- package/lib/navigationModes/cell.js.map +0 -1
- package/lib/navigationModes/composite.js +0 -208
- package/lib/navigationModes/composite.js.map +0 -1
- package/lib/navigationModes/index.js +0 -3
- package/lib/navigationModes/index.js.map +0 -1
- package/lib/navigationModes/useNavigationMode.js +0 -42
- package/lib/navigationModes/useNavigationMode.js.map +0 -1
- package/lib-commonjs/hooks/useSelection.js +0 -59
- package/lib-commonjs/hooks/useSelection.js.map +0 -1
- package/lib-commonjs/hooks/useSort.js +0 -82
- package/lib-commonjs/hooks/useSort.js.map +0 -1
- package/lib-commonjs/hooks/useTable.js +0 -99
- package/lib-commonjs/hooks/useTable.js.map +0 -1
- package/lib-commonjs/navigationModes/cell.js +0 -259
- package/lib-commonjs/navigationModes/cell.js.map +0 -1
- package/lib-commonjs/navigationModes/composite.js +0 -217
- package/lib-commonjs/navigationModes/composite.js.map +0 -1
- package/lib-commonjs/navigationModes/index.js +0 -16
- package/lib-commonjs/navigationModes/index.js.map +0 -1
- package/lib-commonjs/navigationModes/useNavigationMode.js +0 -55
- package/lib-commonjs/navigationModes/useNavigationMode.js.map +0 -1
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
export function applyCompositeNavigation(element) {
|
|
2
|
-
const container = element;
|
|
3
|
-
let mode = 'row';
|
|
4
|
-
let movingOut = false;
|
|
5
|
-
const pre = document.createElement('div');
|
|
6
|
-
const post = document.createElement('div');
|
|
7
|
-
|
|
8
|
-
if (!pre || !post) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
pre.tabIndex = 0;
|
|
13
|
-
post.tabIndex = 0;
|
|
14
|
-
pre.addEventListener('focus', () => {
|
|
15
|
-
if (movingOut) {
|
|
16
|
-
movingOut = false;
|
|
17
|
-
return;
|
|
18
|
-
} else {
|
|
19
|
-
treeWalker.currentNode = container;
|
|
20
|
-
mode = 'row';
|
|
21
|
-
const candidate = treeWalker.nextNode();
|
|
22
|
-
|
|
23
|
-
if (isHTMLElement(candidate)) {
|
|
24
|
-
candidate.focus();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
post.addEventListener('focus', () => {
|
|
29
|
-
if (movingOut) {
|
|
30
|
-
movingOut = false;
|
|
31
|
-
return;
|
|
32
|
-
} else {
|
|
33
|
-
treeWalker.currentNode = post;
|
|
34
|
-
mode = 'row';
|
|
35
|
-
const candidate = treeWalker.previousNode();
|
|
36
|
-
|
|
37
|
-
if (isHTMLElement(candidate)) {
|
|
38
|
-
candidate.focus();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
container.before(pre);
|
|
43
|
-
container.after(post);
|
|
44
|
-
|
|
45
|
-
const acceptNode = node => {
|
|
46
|
-
if (!isHTMLElement(node)) {
|
|
47
|
-
return NodeFilter.FILTER_SKIP;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (!isCell(node) && !isRow(node)) {
|
|
51
|
-
return NodeFilter.FILTER_SKIP;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (mode === 'column' && isRow(node)) {
|
|
55
|
-
return NodeFilter.FILTER_REJECT;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (mode === 'row' && isCell(node)) {
|
|
59
|
-
return NodeFilter.FILTER_REJECT;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (node.tabIndex < 0) {
|
|
63
|
-
return NodeFilter.FILTER_SKIP;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return NodeFilter.FILTER_ACCEPT;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const treeWalker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
70
|
-
acceptNode
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
const up = current => {
|
|
74
|
-
const prevMode = mode;
|
|
75
|
-
mode = 'row';
|
|
76
|
-
treeWalker.currentNode = current;
|
|
77
|
-
|
|
78
|
-
if (prevMode === 'column') {
|
|
79
|
-
treeWalker.previousNode();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const node = treeWalker.previousNode();
|
|
83
|
-
|
|
84
|
-
if (isHTMLElement(node)) {
|
|
85
|
-
return node;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return null;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const down = current => {
|
|
92
|
-
mode = 'row';
|
|
93
|
-
treeWalker.currentNode = current;
|
|
94
|
-
const node = treeWalker.nextNode();
|
|
95
|
-
|
|
96
|
-
if (isHTMLElement(node)) {
|
|
97
|
-
return node;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return null;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const left = current => {
|
|
104
|
-
treeWalker.currentNode = current;
|
|
105
|
-
const prevMode = mode;
|
|
106
|
-
mode = 'column';
|
|
107
|
-
let node = null;
|
|
108
|
-
|
|
109
|
-
if (prevMode === 'row') {
|
|
110
|
-
let tmp = null;
|
|
111
|
-
|
|
112
|
-
while (tmp = treeWalker.nextNode()) {
|
|
113
|
-
node = tmp;
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
node = treeWalker.previousNode();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (isHTMLElement(node)) {
|
|
120
|
-
return node;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return null;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const right = current => {
|
|
127
|
-
mode = 'column';
|
|
128
|
-
treeWalker.currentNode = current;
|
|
129
|
-
const node = treeWalker.nextNode();
|
|
130
|
-
|
|
131
|
-
if (isHTMLElement(node)) {
|
|
132
|
-
return node;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return null;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const onKeyDown = e => {
|
|
139
|
-
const target = e.target;
|
|
140
|
-
|
|
141
|
-
if (!target || !isHTMLElement(target)) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
let next = null;
|
|
146
|
-
|
|
147
|
-
switch (e.key) {
|
|
148
|
-
case 'ArrowDown':
|
|
149
|
-
next = down(target);
|
|
150
|
-
break;
|
|
151
|
-
|
|
152
|
-
case 'ArrowUp':
|
|
153
|
-
next = up(target);
|
|
154
|
-
break;
|
|
155
|
-
|
|
156
|
-
case 'ArrowLeft':
|
|
157
|
-
next = left(target);
|
|
158
|
-
break;
|
|
159
|
-
|
|
160
|
-
case 'ArrowRight':
|
|
161
|
-
next = right(target);
|
|
162
|
-
break;
|
|
163
|
-
|
|
164
|
-
case 'Tab':
|
|
165
|
-
movingOut = true;
|
|
166
|
-
|
|
167
|
-
if (e.shiftKey) {
|
|
168
|
-
pre.focus();
|
|
169
|
-
} else {
|
|
170
|
-
post.focus();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
break;
|
|
174
|
-
|
|
175
|
-
default:
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (next) {
|
|
180
|
-
e.preventDefault();
|
|
181
|
-
next.focus();
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
container.addEventListener('keydown', onKeyDown);
|
|
186
|
-
return () => container.removeEventListener('keydown', onKeyDown);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function isHTMLElement(node) {
|
|
190
|
-
return node instanceof HTMLElement;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function isRow(element) {
|
|
194
|
-
if (element.getAttribute('role') === 'row' || element.tagName === 'TR') {
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function isCell(element) {
|
|
202
|
-
if (element.getAttribute('role') === 'cell' || element.getAttribute('role') === 'gridcell' || element.tagName === 'TD') {
|
|
203
|
-
return true;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
//# sourceMappingURL=composite.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["navigationModes/composite.ts"],"names":[],"mappings":"AAAA,OAAM,SAAU,wBAAV,CAAmC,OAAnC,EAAuD;EAC3D,MAAM,SAAS,GAAG,OAAlB;EACA,IAAI,IAAI,GAAqB,KAA7B;EACA,IAAI,SAAS,GAAG,KAAhB;EAEA,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAT,CAAuB,KAAvB,CAAZ;EACA,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAT,CAAuB,KAAvB,CAAb;;EAEA,IAAI,CAAC,GAAD,IAAQ,CAAC,IAAb,EAAmB;IACjB;EACD;;EAED,GAAG,CAAC,QAAJ,GAAe,CAAf;EACA,IAAI,CAAC,QAAL,GAAgB,CAAhB;EAEA,GAAG,CAAC,gBAAJ,CAAqB,OAArB,EAA8B,MAAK;IACjC,IAAI,SAAJ,EAAe;MACb,SAAS,GAAG,KAAZ;MACA;IACD,CAHD,MAGO;MACL,UAAU,CAAC,WAAX,GAAyB,SAAzB;MACA,IAAI,GAAG,KAAP;MACA,MAAM,SAAS,GAAG,UAAU,CAAC,QAAX,EAAlB;;MACA,IAAI,aAAa,CAAC,SAAD,CAAjB,EAA8B;QAC5B,SAAS,CAAC,KAAV;MACD;IACF;EACF,CAZD;EAcA,IAAI,CAAC,gBAAL,CAAsB,OAAtB,EAA+B,MAAK;IAClC,IAAI,SAAJ,EAAe;MACb,SAAS,GAAG,KAAZ;MACA;IACD,CAHD,MAGO;MACL,UAAU,CAAC,WAAX,GAAyB,IAAzB;MACA,IAAI,GAAG,KAAP;MACA,MAAM,SAAS,GAAG,UAAU,CAAC,YAAX,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AC,MAAD,CAAX;QACA;;MACF,KAAK,SAAL;QACE,IAAI,GAAG,EAAE,CAAC,MAAD,CAAT;QACA;;MACF,KAAK,WAAL;QACE,IAAI,GAAG,IAAI,CAAC,MAAD,CAAX;QACA;;MACF,KAAK,YAAL;QACE,IAAI,GAAG,KAAK,CAAC,MAAD,CAAZ;QACA;;MACF,KAAK,KAAL;QACE,SAAS,GAAG,IAAZ;;QACA,IAAI,CAAC,CAAC,QAAN,EAAgB;UACd,GAAG,CAAC,KAAJ;QACD,CAFD,MAEO;UACL,IAAI,CAAC,KAAL;QACD;;QAED;;MACF;QACE;IAvBJ;;IA0BA,IAAI,IAAJ,EAAU;MACR,CAAC,CAAC,cAAF;MACA,IAAI,CAAC,KAAL;IACD;EACF,CAtCD;;EAwCA,SAAS,CAAC,gBAAV,CAA2B,SAA3B,EAAsC,SAAtC;EACA,OAAO,MAAM,SAAS,CAAC,mBAAV,CAA8B,SAA9B,EAAyC,SAAzC,CAAb;AACD;;AAED,SAAS,aAAT,CAAuB,IAAvB,EAAoC;EAClC,OAAO,IAAI,YAAY,WAAvB;AACD;;AAED,SAAS,KAAT,CAAe,OAAf,EAAmC;EACjC,IAAI,OAAO,CAAC,YAAR,CAAqB,MAArB,MAAiC,KAAjC,IAA0C,OAAO,CAAC,OAAR,KAAoB,IAAlE,EAAwE;IACtE,OAAO,IAAP;EACD;;EAED,OAAO,KAAP;AACD;;AAED,SAAS,MAAT,CAAgB,OAAhB,EAAoC;EAClC,IACE,OAAO,CAAC,YAAR,CAAqB,MAArB,MAAiC,MAAjC,IACA,OAAO,CAAC,YAAR,CAAqB,MAArB,MAAiC,UADjC,IAEA,OAAO,CAAC,OAAR,KAAoB,IAHtB,EAIE;IACA,OAAO,IAAP;EACD;;EAED,OAAO,KAAP;AACD","sourcesContent":["export function applyCompositeNavigation(element: HTMLElement) {\n const container = element;\n let mode: 'row' | 'column' = 'row';\n let movingOut = false;\n\n const pre = document.createElement('div');\n const post = document.createElement('div');\n\n if (!pre || !post) {\n return;\n }\n\n pre.tabIndex = 0;\n post.tabIndex = 0;\n\n pre.addEventListener('focus', () => {\n if (movingOut) {\n movingOut = false;\n return;\n } else {\n treeWalker.currentNode = container;\n mode = 'row';\n const candidate = treeWalker.nextNode();\n if (isHTMLElement(candidate)) {\n candidate.focus();\n }\n }\n });\n\n post.addEventListener('focus', () => {\n if (movingOut) {\n movingOut = false;\n return;\n } else {\n treeWalker.currentNode = post;\n mode = 'row';\n const candidate = treeWalker.previousNode();\n if (isHTMLElement(candidate)) {\n candidate.focus();\n }\n }\n });\n\n container.before(pre);\n container.after(post);\n\n const acceptNode = (node: Node) => {\n if (!isHTMLElement(node)) {\n return NodeFilter.FILTER_SKIP;\n }\n\n if (!isCell(node) && !isRow(node)) {\n return NodeFilter.FILTER_SKIP;\n }\n\n if (mode === 'column' && isRow(node)) {\n return NodeFilter.FILTER_REJECT;\n }\n\n if (mode === 'row' && isCell(node)) {\n return NodeFilter.FILTER_REJECT;\n }\n\n if (node.tabIndex < 0) {\n return NodeFilter.FILTER_SKIP;\n }\n\n return NodeFilter.FILTER_ACCEPT;\n };\n\n const treeWalker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { acceptNode });\n\n const up = (current: HTMLElement) => {\n const prevMode = mode;\n mode = 'row';\n treeWalker.currentNode = current;\n\n if (prevMode === 'column') {\n treeWalker.previousNode();\n }\n\n const node = treeWalker.previousNode();\n if (isHTMLElement(node)) {\n return node;\n }\n return null;\n };\n\n const down = (current: HTMLElement) => {\n mode = 'row';\n treeWalker.currentNode = current;\n const node = treeWalker.nextNode();\n if (isHTMLElement(node)) {\n return node;\n }\n return null;\n };\n\n const left = (current: HTMLElement) => {\n treeWalker.currentNode = current;\n const prevMode = mode;\n mode = 'column';\n let node: Node | null = null;\n\n if (prevMode === 'row') {\n let tmp: Node | null = null;\n while ((tmp = treeWalker.nextNode())) {\n node = tmp;\n }\n } else {\n node = treeWalker.previousNode();\n }\n\n if (isHTMLElement(node)) {\n return node;\n }\n return null;\n };\n\n const right = (current: HTMLElement) => {\n mode = 'column';\n treeWalker.currentNode = current;\n const node = treeWalker.nextNode();\n if (isHTMLElement(node)) {\n return node;\n }\n return null;\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const target = e.target;\n if (!target || !isHTMLElement(target)) {\n return;\n }\n\n let next: HTMLElement | null = null;\n\n switch (e.key) {\n case 'ArrowDown':\n next = down(target);\n break;\n case 'ArrowUp':\n next = up(target);\n break;\n case 'ArrowLeft':\n next = left(target);\n break;\n case 'ArrowRight':\n next = right(target);\n break;\n case 'Tab':\n movingOut = true;\n if (e.shiftKey) {\n pre.focus();\n } else {\n post.focus();\n }\n\n break;\n default:\n break;\n }\n\n if (next) {\n e.preventDefault();\n next.focus();\n }\n };\n\n container.addEventListener('keydown', onKeyDown);\n return () => container.removeEventListener('keydown', onKeyDown);\n}\n\nfunction isHTMLElement(node: unknown): node is HTMLElement {\n return node instanceof HTMLElement;\n}\n\nfunction isRow(element: HTMLElement) {\n if (element.getAttribute('role') === 'row' || element.tagName === 'TR') {\n return true;\n }\n\n return false;\n}\n\nfunction isCell(element: HTMLElement) {\n if (\n element.getAttribute('role') === 'cell' ||\n element.getAttribute('role') === 'gridcell' ||\n element.tagName === 'TD'\n ) {\n return true;\n }\n\n return false;\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["navigationModes/index.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["// eslint-disable-next-line deprecation/deprecation\nexport { useNavigationMode } from './useNavigationMode';\n"]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
3
|
-
import { applyCompositeNavigation } from './composite';
|
|
4
|
-
import { applyCellNavigation } from './cell';
|
|
5
|
-
/**
|
|
6
|
-
* THIS HOOK WILL NOT EXIST IN STABLE RELEASE
|
|
7
|
-
* Just a quick workaround before tabster fully supports these navigation modes with grid mode
|
|
8
|
-
* https://github.com/microsoft/fluentui/issues/24382
|
|
9
|
-
* @internal
|
|
10
|
-
* @deprecated
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export function useNavigationMode(mode) {
|
|
14
|
-
const rowNavigationAttr = useArrowNavigationGroup({
|
|
15
|
-
axis: 'vertical'
|
|
16
|
-
});
|
|
17
|
-
const ref = React.useRef(null);
|
|
18
|
-
React.useEffect(() => {
|
|
19
|
-
if (!ref.current) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
switch (mode) {
|
|
24
|
-
case 'cell':
|
|
25
|
-
applyCellNavigation(ref.current);
|
|
26
|
-
break;
|
|
27
|
-
|
|
28
|
-
case 'composite':
|
|
29
|
-
applyCompositeNavigation(ref.current);
|
|
30
|
-
break;
|
|
31
|
-
|
|
32
|
-
case 'row':
|
|
33
|
-
if (rowNavigationAttr['data-tabster']) {
|
|
34
|
-
ref.current.setAttribute('data-tabster', rowNavigationAttr['data-tabster']);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}, [rowNavigationAttr, mode]);
|
|
40
|
-
return ref;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=useNavigationMode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["navigationModes/useNavigationMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,SAAS,wBAAT,QAAyC,aAAzC;AACA,SAAS,mBAAT,QAAoC,QAApC;AAIA;;;;;;AAMG;;AACH,OAAM,SAAU,iBAAV,CAA0D,IAA1D,EAA8E;EAClF,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;IAAE,IAAI,EAAE;EAAR,CAAD,CAAjD;EACA,MAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAAuB,IAAvB,CAAZ;EAEA,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB,IAAI,CAAC,GAAG,CAAC,OAAT,EAAkB;MAChB;IACD;;IAED,QAAQ,IAAR;MACE,KAAK,MAAL;QACE,mBAAmB,CAAC,GAAG,CAAC,OAAL,CAAnB;QACA;;MACF,KAAK,WAAL;QACE,wBAAwB,CAAC,GAAG,CAAC,OAAL,CAAxB;QACA;;MACF,KAAK,KAAL;QACE,IAAI,iBAAiB,CAAC,cAAD,CAArB,EAAuC;UACrC,GAAG,CAAC,OAAJ,CAAY,YAAZ,CAAyB,cAAzB,EAAyC,iBAAiB,CAAC,cAAD,CAA1D;QACD;;QACD;IAXJ;EAaD,CAlBD,EAkBG,CAAC,iBAAD,EAAoB,IAApB,CAlBH;EAoBA,OAAO,GAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { applyCompositeNavigation } from './composite';\nimport { applyCellNavigation } from './cell';\n\nexport type NavigationMode = 'row' | 'cell' | 'composite';\n\n/**\n * THIS HOOK WILL NOT EXIST IN STABLE RELEASE\n * Just a quick workaround before tabster fully supports these navigation modes with grid mode\n * https://github.com/microsoft/fluentui/issues/24382\n * @internal\n * @deprecated\n */\nexport function useNavigationMode<TElement extends HTMLElement>(mode: NavigationMode) {\n const rowNavigationAttr = useArrowNavigationGroup({ axis: 'vertical' });\n const ref = React.useRef<TElement>(null);\n\n React.useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n switch (mode) {\n case 'cell':\n applyCellNavigation(ref.current);\n break;\n case 'composite':\n applyCompositeNavigation(ref.current);\n break;\n case 'row':\n if (rowNavigationAttr['data-tabster']) {\n ref.current.setAttribute('data-tabster', rowNavigationAttr['data-tabster']);\n }\n break;\n }\n }, [rowNavigationAttr, mode]);\n\n return ref;\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useSelection = void 0;
|
|
7
|
-
|
|
8
|
-
const React = /*#__PURE__*/require("react");
|
|
9
|
-
|
|
10
|
-
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
|
-
|
|
12
|
-
const selectionManager_1 = /*#__PURE__*/require("./selectionManager");
|
|
13
|
-
|
|
14
|
-
function useSelection(options) {
|
|
15
|
-
const {
|
|
16
|
-
selectionMode,
|
|
17
|
-
items,
|
|
18
|
-
getRowId,
|
|
19
|
-
defaultSelectedItems,
|
|
20
|
-
selectedItems,
|
|
21
|
-
onSelectionChange
|
|
22
|
-
} = options;
|
|
23
|
-
const [selected, setSelected] = react_utilities_1.useControllableState({
|
|
24
|
-
initialState: new Set(),
|
|
25
|
-
defaultState: defaultSelectedItems,
|
|
26
|
-
state: selectedItems
|
|
27
|
-
});
|
|
28
|
-
const selectionManager = React.useMemo(() => {
|
|
29
|
-
return selectionManager_1.createSelectionManager(selectionMode, newSelectedItems => {
|
|
30
|
-
setSelected(() => {
|
|
31
|
-
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(newSelectedItems);
|
|
32
|
-
return newSelectedItems;
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
}, [onSelectionChange, selectionMode, setSelected]);
|
|
36
|
-
const toggleAllRows = react_utilities_1.useEventCallback(() => {
|
|
37
|
-
selectionManager.toggleAllItems(items.map((item, i) => getRowId(item, i)), selected);
|
|
38
|
-
});
|
|
39
|
-
const toggleRow = react_utilities_1.useEventCallback(rowId => selectionManager.toggleItem(rowId, selected));
|
|
40
|
-
const deselectRow = react_utilities_1.useEventCallback(rowId => selectionManager.deselectItem(rowId, selected));
|
|
41
|
-
const selectRow = react_utilities_1.useEventCallback(rowId => selectionManager.selectItem(rowId, selected));
|
|
42
|
-
|
|
43
|
-
const isRowSelected = rowId => selectionManager.isSelected(rowId, selected);
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
someRowsSelected: selected.size > 0,
|
|
47
|
-
allRowsSelected: selectionMode === 'single' ? selected.size > 0 : selected.size === items.length,
|
|
48
|
-
selectedRows: selected,
|
|
49
|
-
toggleRow,
|
|
50
|
-
toggleAllRows,
|
|
51
|
-
clearRows: selectionManager.clearItems,
|
|
52
|
-
deselectRow,
|
|
53
|
-
selectRow,
|
|
54
|
-
isRowSelected
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
exports.useSelection = useSelection;
|
|
59
|
-
//# sourceMappingURL=useSelection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["hooks/useSelection.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;;AAkBA,SAAgB,YAAhB,CAAoC,OAApC,EAAuE;EACrE,MAAM;IAAE,aAAF;IAAiB,KAAjB;IAAwB,QAAxB;IAAkC,oBAAlC;IAAwD,aAAxD;IAAuE;EAAvE,IAA6F,OAAnG;EAEA,MAAM,CAAC,QAAD,EAAW,WAAX,IAA0B,iBAAA,CAAA,oBAAA,CAAqB;IACnD,YAAY,EAAE,IAAI,GAAJ,EADqC;IAEnD,YAAY,EAAE,oBAFqC;IAGnD,KAAK,EAAE;EAH4C,CAArB,CAAhC;EAMA,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAN,CAAc,MAAK;IAC1C,OAAO,kBAAA,CAAA,sBAAA,CAAuB,aAAvB,EAAsC,gBAAgB,IAAG;MAC9D,WAAW,CAAC,MAAK;QACf,iBAAiB,KAAA,IAAjB,IAAA,iBAAiB,KAAA,KAAA,CAAj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,YAAA,GAAA,YAAA","sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport { createSelectionManager } from './selectionManager';\nimport type {\n GetRowIdInternal,\n OnSelectionChangeCallback,\n RowId,\n SelectionMode,\n TableSelectionStateInternal,\n} from './types';\n\ninterface UseSelectionOptions<TItem> {\n selectionMode: SelectionMode;\n items: TItem[];\n getRowId: GetRowIdInternal<TItem>;\n defaultSelectedItems?: Set<RowId>;\n selectedItems?: Set<RowId>;\n onSelectionChange?: OnSelectionChangeCallback;\n}\n\nexport function useSelection<TItem>(options: UseSelectionOptions<TItem>): TableSelectionStateInternal {\n const { selectionMode, items, getRowId, defaultSelectedItems, selectedItems, onSelectionChange } = options;\n\n const [selected, setSelected] = useControllableState({\n initialState: new Set<RowId>(),\n defaultState: defaultSelectedItems,\n state: selectedItems,\n });\n\n const selectionManager = React.useMemo(() => {\n return createSelectionManager(selectionMode, newSelectedItems => {\n setSelected(() => {\n onSelectionChange?.(newSelectedItems);\n return newSelectedItems;\n });\n });\n }, [onSelectionChange, selectionMode, setSelected]);\n\n const toggleAllRows: TableSelectionStateInternal['toggleAllRows'] = useEventCallback(() => {\n selectionManager.toggleAllItems(\n items.map((item, i) => getRowId(item, i)),\n selected,\n );\n });\n\n const toggleRow: TableSelectionStateInternal['toggleRow'] = useEventCallback((rowId: RowId) =>\n selectionManager.toggleItem(rowId, selected),\n );\n\n const deselectRow: TableSelectionStateInternal['deselectRow'] = useEventCallback((rowId: RowId) =>\n selectionManager.deselectItem(rowId, selected),\n );\n\n const selectRow: TableSelectionStateInternal['selectRow'] = useEventCallback((rowId: RowId) =>\n selectionManager.selectItem(rowId, selected),\n );\n\n const isRowSelected: TableSelectionStateInternal['isRowSelected'] = (rowId: RowId) =>\n selectionManager.isSelected(rowId, selected);\n\n return {\n someRowsSelected: selected.size > 0,\n allRowsSelected: selectionMode === 'single' ? selected.size > 0 : selected.size === items.length,\n selectedRows: selected,\n toggleRow,\n toggleAllRows,\n clearRows: selectionManager.clearItems,\n deselectRow,\n selectRow,\n isRowSelected,\n };\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useSort = void 0;
|
|
7
|
-
|
|
8
|
-
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
9
|
-
|
|
10
|
-
function useSort(options) {
|
|
11
|
-
const {
|
|
12
|
-
columns,
|
|
13
|
-
sortState,
|
|
14
|
-
defaultSortState,
|
|
15
|
-
onSortChange
|
|
16
|
-
} = options;
|
|
17
|
-
const [sorted, setSorted] = react_utilities_1.useControllableState({
|
|
18
|
-
initialState: {
|
|
19
|
-
sortDirection: 'ascending',
|
|
20
|
-
sortColumn: undefined
|
|
21
|
-
},
|
|
22
|
-
defaultState: defaultSortState,
|
|
23
|
-
state: sortState
|
|
24
|
-
});
|
|
25
|
-
const {
|
|
26
|
-
sortColumn,
|
|
27
|
-
sortDirection
|
|
28
|
-
} = sorted;
|
|
29
|
-
|
|
30
|
-
const toggleColumnSort = columnId => {
|
|
31
|
-
setSorted(s => {
|
|
32
|
-
const newState = { ...s,
|
|
33
|
-
sortColumn: columnId
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
if (s.sortColumn === columnId) {
|
|
37
|
-
newState.sortDirection = s.sortDirection === 'ascending' ? 'descending' : 'ascending';
|
|
38
|
-
} else {
|
|
39
|
-
newState.sortDirection = 'ascending';
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
onSortChange === null || onSortChange === void 0 ? void 0 : onSortChange(newState);
|
|
43
|
-
return newState;
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const setColumnSort = (nextSortColumn, nextSortDirection) => {
|
|
48
|
-
const newState = {
|
|
49
|
-
sortColumn: nextSortColumn,
|
|
50
|
-
sortDirection: nextSortDirection
|
|
51
|
-
};
|
|
52
|
-
onSortChange === null || onSortChange === void 0 ? void 0 : onSortChange(newState);
|
|
53
|
-
setSorted(newState);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const sort = items => items.slice().sort((a, b) => {
|
|
57
|
-
const sortColumnDef = columns.find(column => column.columnId === sortColumn);
|
|
58
|
-
|
|
59
|
-
if (!(sortColumnDef === null || sortColumnDef === void 0 ? void 0 : sortColumnDef.compare)) {
|
|
60
|
-
return 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const mod = sortDirection === 'ascending' ? 1 : -1;
|
|
64
|
-
return sortColumnDef.compare(a, b) * mod;
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
const getSortDirection = columnId => {
|
|
68
|
-
return sortColumn === columnId ? sortDirection : undefined;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
sortColumn,
|
|
73
|
-
sortDirection,
|
|
74
|
-
sort,
|
|
75
|
-
setColumnSort,
|
|
76
|
-
toggleColumnSort,
|
|
77
|
-
getSortDirection
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
exports.useSort = useSort;
|
|
82
|
-
//# sourceMappingURL=useSort.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["hooks/useSort.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAUA,SAAgB,OAAhB,CAA+B,OAA/B,EAA6D;EAC3D,MAAM;IAAE,OAAF;IAAW,SAAX;IAAsB,gBAAtB;IAAwC;EAAxC,IAAyD,OAA/D;EAEA,MAAM,CAAC,MAAD,EAAS,SAAT,IAAsB,iBAAA,CAAA,oBAAA,CAAgC;IAC1D,YAAY,EAAE;MACZ,aAAa,EAAE,WADH;MAEZ,UAAU,EAAE;IAFA,CAD4C;IAK1D,YAAY,EAAE,gBAL4C;IAM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IACD;;IAED,MAAM,GAAG,GAAG,aAAa,KAAK,WAAlB,GAAgC,CAAhC,GAAoC,CAAC,CAAjD;IACA,OAAO,aAAa,CAAC,OAAd,CAAsB,CAAtB,EAAyB,CAAzB,IAA8B,GAArC;EACD,CARD,CADF;;EAWA,MAAM,gBAAgB,GAAuD,QAAD,IAAuB;IACjG,OAAO,UAAU,KAAK,QAAf,GAA0B,aAA1B,GAA0C,SAAjD;EACD,CAFD;;EAIA,OAAO;IACL,UADK;IAEL,aAFK;IAGL,IAHK;IAIL,aAJK;IAKL,gBALK;IAML;EANK,CAAP;AAQD;;AAzDD,OAAA,CAAA,OAAA,GAAA,OAAA","sourcesContent":["import { useControllableState } from '@fluentui/react-utilities';\nimport type { ColumnDefinition, ColumnId, OnSortChangeCallback, SortState, TableSortStateInternal } from './types';\n\ninterface UseSortOptions<TItem> {\n columns: ColumnDefinition<TItem>[];\n sortState?: SortState;\n defaultSortState?: SortState;\n onSortChange?: OnSortChangeCallback;\n}\n\nexport function useSort<TItem>(options: UseSortOptions<TItem>): TableSortStateInternal<TItem> {\n const { columns, sortState, defaultSortState, onSortChange } = options;\n\n const [sorted, setSorted] = useControllableState<SortState>({\n initialState: {\n sortDirection: 'ascending' as const,\n sortColumn: undefined,\n },\n defaultState: defaultSortState,\n state: sortState,\n });\n\n const { sortColumn, sortDirection } = sorted;\n\n const toggleColumnSort = (columnId: ColumnId | undefined) => {\n setSorted(s => {\n const newState = { ...s, sortColumn: columnId };\n if (s.sortColumn === columnId) {\n newState.sortDirection = s.sortDirection === 'ascending' ? 'descending' : 'ascending';\n } else {\n newState.sortDirection = 'ascending';\n }\n\n onSortChange?.(newState);\n return newState;\n });\n };\n\n const setColumnSort: TableSortStateInternal<TItem>['setColumnSort'] = (nextSortColumn, nextSortDirection) => {\n const newState = { sortColumn: nextSortColumn, sortDirection: nextSortDirection };\n onSortChange?.(newState);\n setSorted(newState);\n };\n\n const sort = (items: TItem[]) =>\n items.slice().sort((a, b) => {\n const sortColumnDef = columns.find(column => column.columnId === sortColumn);\n if (!sortColumnDef?.compare) {\n return 0;\n }\n\n const mod = sortDirection === 'ascending' ? 1 : -1;\n return sortColumnDef.compare(a, b) * mod;\n });\n\n const getSortDirection: TableSortStateInternal<TItem>['getSortDirection'] = (columnId: ColumnId) => {\n return sortColumn === columnId ? sortDirection : undefined;\n };\n\n return {\n sortColumn,\n sortDirection,\n sort,\n setColumnSort,\n toggleColumnSort,\n getSortDirection,\n };\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useTable = void 0;
|
|
7
|
-
|
|
8
|
-
const React = /*#__PURE__*/require("react");
|
|
9
|
-
|
|
10
|
-
const useSelection_1 = /*#__PURE__*/require("./useSelection");
|
|
11
|
-
|
|
12
|
-
const useSort_1 = /*#__PURE__*/require("./useSort");
|
|
13
|
-
|
|
14
|
-
function useTable(options) {
|
|
15
|
-
const {
|
|
16
|
-
items: baseItems,
|
|
17
|
-
columns,
|
|
18
|
-
getRowId: getUserRowId = () => undefined,
|
|
19
|
-
selectionMode = 'multiselect',
|
|
20
|
-
rowEnhancer = row => row,
|
|
21
|
-
defaultSelectedRows,
|
|
22
|
-
selectedRows: userSelectedRows,
|
|
23
|
-
onSelectionChange,
|
|
24
|
-
sortState: userSortState,
|
|
25
|
-
defaultSortState,
|
|
26
|
-
onSortChange
|
|
27
|
-
} = options;
|
|
28
|
-
const getRowId = React.useCallback((item, index) => {
|
|
29
|
-
var _a;
|
|
30
|
-
|
|
31
|
-
return (_a = getUserRowId(item)) !== null && _a !== void 0 ? _a : index;
|
|
32
|
-
}, [getUserRowId]);
|
|
33
|
-
const {
|
|
34
|
-
sortColumn,
|
|
35
|
-
sortDirection,
|
|
36
|
-
toggleColumnSort,
|
|
37
|
-
setColumnSort,
|
|
38
|
-
getSortDirection,
|
|
39
|
-
sort
|
|
40
|
-
} = useSort_1.useSort({
|
|
41
|
-
columns,
|
|
42
|
-
sortState: userSortState,
|
|
43
|
-
defaultSortState,
|
|
44
|
-
onSortChange
|
|
45
|
-
});
|
|
46
|
-
const sortState = React.useMemo(() => ({
|
|
47
|
-
sortColumn,
|
|
48
|
-
sortDirection,
|
|
49
|
-
setColumnSort,
|
|
50
|
-
toggleColumnSort,
|
|
51
|
-
getSortDirection
|
|
52
|
-
}), [sortColumn, sortDirection, setColumnSort, toggleColumnSort, getSortDirection]);
|
|
53
|
-
const {
|
|
54
|
-
isRowSelected,
|
|
55
|
-
toggleRow,
|
|
56
|
-
toggleAllRows,
|
|
57
|
-
clearRows,
|
|
58
|
-
selectedRows,
|
|
59
|
-
allRowsSelected,
|
|
60
|
-
someRowsSelected,
|
|
61
|
-
selectRow,
|
|
62
|
-
deselectRow
|
|
63
|
-
} = useSelection_1.useSelection({
|
|
64
|
-
selectionMode,
|
|
65
|
-
items: baseItems,
|
|
66
|
-
getRowId,
|
|
67
|
-
defaultSelectedItems: defaultSelectedRows,
|
|
68
|
-
selectedItems: userSelectedRows,
|
|
69
|
-
onSelectionChange
|
|
70
|
-
});
|
|
71
|
-
const selectionState = React.useMemo(() => ({
|
|
72
|
-
isRowSelected,
|
|
73
|
-
clearRows,
|
|
74
|
-
deselectRow,
|
|
75
|
-
selectRow,
|
|
76
|
-
toggleAllRows,
|
|
77
|
-
toggleRow,
|
|
78
|
-
selectedRows: Array.from(selectedRows),
|
|
79
|
-
allRowsSelected,
|
|
80
|
-
someRowsSelected
|
|
81
|
-
}), [isRowSelected, clearRows, deselectRow, selectRow, toggleAllRows, toggleRow, selectedRows, allRowsSelected, someRowsSelected]);
|
|
82
|
-
const rows = React.useMemo(() => sort(baseItems).map((item, i) => {
|
|
83
|
-
return rowEnhancer({
|
|
84
|
-
item,
|
|
85
|
-
rowId: getRowId(item, i)
|
|
86
|
-
}, {
|
|
87
|
-
selection: selectionState,
|
|
88
|
-
sort: sortState
|
|
89
|
-
});
|
|
90
|
-
}), [baseItems, getRowId, sort, rowEnhancer, selectionState, sortState]);
|
|
91
|
-
return {
|
|
92
|
-
rows,
|
|
93
|
-
selection: selectionState,
|
|
94
|
-
sort: sortState
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
exports.useTable = useTable;
|
|
99
|
-
//# sourceMappingURL=useTable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["hooks/useTable.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AASA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,SAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AAEA,SAAgB,QAAhB,CACE,OADF,EAC4C;EAE1C,MAAM;IACJ,KAAK,EAAE,SADH;IAEJ,OAFI;IAGJ,QAAQ,EAAE,YAAY,GAAG,MAAM,SAH3B;IAIJ,aAAa,GAAG,aAJZ;IAKJ,WAAW,GAAI,GAAD,IAA0B,GALpC;IAMJ,mBANI;IAOJ,YAAY,EAAE,gBAPV;IAQJ,iBARI;IASJ,SAAS,EAAE,aATP;IAUJ,gBAVI;IAWJ;EAXI,IAYF,OAZJ;EAcA,MAAM,QAAQ,GAA4B,KAAK,CAAC,WAAN,CACxC,CAAC,IAAD,EAAc,KAAd,KAA+B;IAAA,IAAA,EAAA;;IAAC,OAAA,CAAA,EAAA,GAAA,YAAY,CAAC,IAAD,CAAZ,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,EAAlB,GAAsB,KAAtB;EAA2B,CADnB,EAExC,CAAC,YAAD,CAFwC,CAA1C;EAIA,MAAM;IAAE,UAAF;IAAc,aAAd;IAA6B,gBAA7B;IAA+C,aAA/C;IAA8D,gBAA9D;IAAgF;EAAhF,IAAyF,SAAA,CAAA,OAAA,CAAQ;IACrG,OADqG;IAEr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AAZ,EAAsB,IAAtB,EAA4B,WAA5B,EAAyC,cAAzC,EAAyD,SAAzD,CAXW,CAAb;EAcA,OAAO;IACL,IADK;IAEL,SAAS,EAAE,cAFN;IAGL,IAAI,EAAE;EAHD,CAAP;AAKD;;AArGD,OAAA,CAAA,QAAA,GAAA,QAAA","sourcesContent":["import * as React from 'react';\nimport type {\n UseTableOptions,\n TableState,\n RowState,\n TableSelectionState,\n TableSortState,\n GetRowIdInternal,\n} from './types';\nimport { useSelection } from './useSelection';\nimport { useSort } from './useSort';\n\nexport function useTable<TItem, TRowState extends RowState<TItem> = RowState<TItem>>(\n options: UseTableOptions<TItem, TRowState>,\n): TableState<TItem, TRowState> {\n const {\n items: baseItems,\n columns,\n getRowId: getUserRowId = () => undefined,\n selectionMode = 'multiselect',\n rowEnhancer = (row: RowState<TItem>) => row as TRowState,\n defaultSelectedRows,\n selectedRows: userSelectedRows,\n onSelectionChange,\n sortState: userSortState,\n defaultSortState,\n onSortChange,\n } = options;\n\n const getRowId: GetRowIdInternal<TItem> = React.useCallback(\n (item: TItem, index: number) => getUserRowId(item) ?? index,\n [getUserRowId],\n );\n const { sortColumn, sortDirection, toggleColumnSort, setColumnSort, getSortDirection, sort } = useSort({\n columns,\n sortState: userSortState,\n defaultSortState,\n onSortChange,\n });\n const sortState: TableSortState = React.useMemo(\n () => ({\n sortColumn,\n sortDirection,\n setColumnSort,\n toggleColumnSort,\n getSortDirection,\n }),\n [sortColumn, sortDirection, setColumnSort, toggleColumnSort, getSortDirection],\n );\n\n const {\n isRowSelected,\n toggleRow,\n toggleAllRows,\n clearRows,\n selectedRows,\n allRowsSelected,\n someRowsSelected,\n selectRow,\n deselectRow,\n } = useSelection({\n selectionMode,\n items: baseItems,\n getRowId,\n defaultSelectedItems: defaultSelectedRows,\n selectedItems: userSelectedRows,\n onSelectionChange,\n });\n\n const selectionState: TableSelectionState = React.useMemo(\n () => ({\n isRowSelected,\n clearRows,\n deselectRow,\n selectRow,\n toggleAllRows,\n toggleRow,\n selectedRows: Array.from(selectedRows),\n allRowsSelected,\n someRowsSelected,\n }),\n [\n isRowSelected,\n clearRows,\n deselectRow,\n selectRow,\n toggleAllRows,\n toggleRow,\n selectedRows,\n allRowsSelected,\n someRowsSelected,\n ],\n );\n\n const rows = React.useMemo(\n () =>\n sort(baseItems).map((item, i) => {\n return rowEnhancer(\n {\n item,\n rowId: getRowId(item, i),\n },\n { selection: selectionState, sort: sortState },\n );\n }),\n [baseItems, getRowId, sort, rowEnhancer, selectionState, sortState],\n );\n\n return {\n rows,\n selection: selectionState,\n sort: sortState,\n };\n}\n"],"sourceRoot":"../src/"}
|