@fluentui/react-table 9.0.0-rc.5 → 9.0.1
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 +87 -1
- package/CHANGELOG.md +32 -2
- package/dist/index.d.ts +27 -4
- package/lib/components/DataGrid/DataGrid.types.js.map +1 -1
- package/lib/components/DataGrid/useDataGrid.js +16 -4
- package/lib/components/DataGrid/useDataGrid.js.map +1 -1
- package/lib/components/DataGrid/useDataGridContextValues.js +2 -1
- package/lib/components/DataGrid/useDataGridContextValues.js.map +1 -1
- package/lib/components/DataGridCell/useDataGridCell.js +5 -0
- package/lib/components/DataGridCell/useDataGridCell.js.map +1 -1
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js +3 -0
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -1
- package/lib/components/TableCellLayout/TableCellLayout.types.js.map +1 -1
- package/lib/components/TableCellLayout/useTableCellLayout.js +1 -0
- package/lib/components/TableCellLayout/useTableCellLayout.js.map +1 -1
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js +18 -4
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js +1 -0
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
- package/lib/hooks/types.js.map +1 -1
- package/lib/hooks/useTableColumnResizeMouseHandler.js +4 -1
- package/lib/hooks/useTableColumnResizeMouseHandler.js.map +1 -1
- package/lib/hooks/useTableColumnResizeState.js +11 -2
- package/lib/hooks/useTableColumnResizeState.js.map +1 -1
- package/lib/hooks/useTableColumnSizing.js +5 -2
- package/lib/hooks/useTableColumnSizing.js.map +1 -1
- package/lib/utils/columnResizeUtils.js +6 -6
- package/lib/utils/columnResizeUtils.js.map +1 -1
- package/lib-amd/DataGrid.js +6 -0
- package/lib-amd/DataGrid.js.map +1 -0
- package/lib-amd/DataGridBody.js +6 -0
- package/lib-amd/DataGridBody.js.map +1 -0
- package/lib-amd/DataGridCell.js +6 -0
- package/lib-amd/DataGridCell.js.map +1 -0
- package/lib-amd/DataGridHeader.js +6 -0
- package/lib-amd/DataGridHeader.js.map +1 -0
- package/lib-amd/DataGridHeaderCell.js +6 -0
- package/lib-amd/DataGridHeaderCell.js.map +1 -0
- package/lib-amd/DataGridRow.js +6 -0
- package/lib-amd/DataGridRow.js.map +1 -0
- package/lib-amd/DataGridSelectionCell.js +6 -0
- package/lib-amd/DataGridSelectionCell.js.map +1 -0
- package/lib-amd/Table.js +6 -0
- package/lib-amd/Table.js.map +1 -0
- package/lib-amd/TableBody.js +6 -0
- package/lib-amd/TableBody.js.map +1 -0
- package/lib-amd/TableCell.js +6 -0
- package/lib-amd/TableCell.js.map +1 -0
- package/lib-amd/TableCellActions.js +6 -0
- package/lib-amd/TableCellActions.js.map +1 -0
- package/lib-amd/TableCellLayout.js +6 -0
- package/lib-amd/TableCellLayout.js.map +1 -0
- package/lib-amd/TableHeader.js +6 -0
- package/lib-amd/TableHeader.js.map +1 -0
- package/lib-amd/TableHeaderCell.js +6 -0
- package/lib-amd/TableHeaderCell.js.map +1 -0
- package/lib-amd/TableResizeHandle.js +6 -0
- package/lib-amd/TableResizeHandle.js.map +1 -0
- package/lib-amd/TableRow.js +6 -0
- package/lib-amd/TableRow.js.map +1 -0
- package/lib-amd/TableSelectionCell.js +6 -0
- package/lib-amd/TableSelectionCell.js.map +1 -0
- package/lib-amd/components/DataGrid/DataGrid.js +15 -0
- package/lib-amd/components/DataGrid/DataGrid.js.map +1 -0
- package/lib-amd/components/DataGrid/DataGrid.types.js +5 -0
- package/lib-amd/components/DataGrid/DataGrid.types.js.map +1 -0
- package/lib-amd/components/DataGrid/index.js +11 -0
- package/lib-amd/components/DataGrid/index.js.map +1 -0
- package/lib-amd/components/DataGrid/renderDataGrid.js +13 -0
- package/lib-amd/components/DataGrid/renderDataGrid.js.map +1 -0
- package/lib-amd/components/DataGrid/useDataGrid.js +43 -0
- package/lib-amd/components/DataGrid/useDataGrid.js.map +1 -0
- package/lib-amd/components/DataGrid/useDataGridContextValues.js +11 -0
- package/lib-amd/components/DataGrid/useDataGridContextValues.js.map +1 -0
- package/lib-amd/components/DataGrid/useDataGridStyles.js +18 -0
- package/lib-amd/components/DataGrid/useDataGridStyles.js.map +1 -0
- package/lib-amd/components/DataGridBody/DataGridBody.js +15 -0
- package/lib-amd/components/DataGridBody/DataGridBody.js.map +1 -0
- package/lib-amd/components/DataGridBody/DataGridBody.types.js +5 -0
- package/lib-amd/components/DataGridBody/DataGridBody.types.js.map +1 -0
- package/lib-amd/components/DataGridBody/index.js +10 -0
- package/lib-amd/components/DataGridBody/index.js.map +1 -0
- package/lib-amd/components/DataGridBody/renderDataGridBody.js +14 -0
- package/lib-amd/components/DataGridBody/renderDataGridBody.js.map +1 -0
- package/lib-amd/components/DataGridBody/useDataGridBody.js +24 -0
- package/lib-amd/components/DataGridBody/useDataGridBody.js.map +1 -0
- package/lib-amd/components/DataGridBody/useDataGridBodyStyles.js +18 -0
- package/lib-amd/components/DataGridBody/useDataGridBodyStyles.js.map +1 -0
- package/lib-amd/components/DataGridCell/DataGridCell.js +15 -0
- package/lib-amd/components/DataGridCell/DataGridCell.js.map +1 -0
- package/lib-amd/components/DataGridCell/DataGridCell.types.js +5 -0
- package/lib-amd/components/DataGridCell/DataGridCell.types.js.map +1 -0
- package/lib-amd/components/DataGridCell/index.js +10 -0
- package/lib-amd/components/DataGridCell/index.js.map +1 -0
- package/lib-amd/components/DataGridCell/renderDataGridCell.js +13 -0
- package/lib-amd/components/DataGridCell/renderDataGridCell.js.map +1 -0
- package/lib-amd/components/DataGridCell/useDataGridCell.js +23 -0
- package/lib-amd/components/DataGridCell/useDataGridCell.js.map +1 -0
- package/lib-amd/components/DataGridCell/useDataGridCellStyles.js +18 -0
- package/lib-amd/components/DataGridCell/useDataGridCellStyles.js.map +1 -0
- package/lib-amd/components/DataGridHeader/DataGridHeader.js +15 -0
- package/lib-amd/components/DataGridHeader/DataGridHeader.js.map +1 -0
- package/lib-amd/components/DataGridHeader/DataGridHeader.types.js +5 -0
- package/lib-amd/components/DataGridHeader/DataGridHeader.types.js.map +1 -0
- package/lib-amd/components/DataGridHeader/index.js +10 -0
- package/lib-amd/components/DataGridHeader/index.js.map +1 -0
- package/lib-amd/components/DataGridHeader/renderDataGridHeader.js +13 -0
- package/lib-amd/components/DataGridHeader/renderDataGridHeader.js.map +1 -0
- package/lib-amd/components/DataGridHeader/useDataGridHeader.js +19 -0
- package/lib-amd/components/DataGridHeader/useDataGridHeader.js.map +1 -0
- package/lib-amd/components/DataGridHeader/useDataGridHeaderStyles.js +18 -0
- package/lib-amd/components/DataGridHeader/useDataGridHeaderStyles.js.map +1 -0
- package/lib-amd/components/DataGridHeaderCell/DataGridHeaderCell.js +15 -0
- package/lib-amd/components/DataGridHeaderCell/DataGridHeaderCell.js.map +1 -0
- package/lib-amd/components/DataGridHeaderCell/DataGridHeaderCell.types.js +5 -0
- package/lib-amd/components/DataGridHeaderCell/DataGridHeaderCell.types.js.map +1 -0
- package/lib-amd/components/DataGridHeaderCell/index.js +10 -0
- package/lib-amd/components/DataGridHeaderCell/index.js.map +1 -0
- package/lib-amd/components/DataGridHeaderCell/renderDataGridHeaderCell.js +13 -0
- package/lib-amd/components/DataGridHeaderCell/renderDataGridHeaderCell.js.map +1 -0
- package/lib-amd/components/DataGridHeaderCell/useDataGridHeaderCell.js +34 -0
- package/lib-amd/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -0
- package/lib-amd/components/DataGridHeaderCell/useDataGridHeaderCellStyles.js +30 -0
- package/lib-amd/components/DataGridHeaderCell/useDataGridHeaderCellStyles.js.map +1 -0
- package/lib-amd/components/DataGridRow/DataGridRow.js +15 -0
- package/lib-amd/components/DataGridRow/DataGridRow.js.map +1 -0
- package/lib-amd/components/DataGridRow/DataGridRow.types.js +5 -0
- package/lib-amd/components/DataGridRow/DataGridRow.types.js.map +1 -0
- package/lib-amd/components/DataGridRow/index.js +10 -0
- package/lib-amd/components/DataGridRow/index.js.map +1 -0
- package/lib-amd/components/DataGridRow/renderDataGridRow.js +16 -0
- package/lib-amd/components/DataGridRow/renderDataGridRow.js.map +1 -0
- package/lib-amd/components/DataGridRow/useDataGridRow.js +49 -0
- package/lib-amd/components/DataGridRow/useDataGridRow.js.map +1 -0
- package/lib-amd/components/DataGridRow/useDataGridRowStyles.js +22 -0
- package/lib-amd/components/DataGridRow/useDataGridRowStyles.js.map +1 -0
- package/lib-amd/components/DataGridSelectionCell/DataGridSelectionCell.js +15 -0
- package/lib-amd/components/DataGridSelectionCell/DataGridSelectionCell.js.map +1 -0
- package/lib-amd/components/DataGridSelectionCell/DataGridSelectionCell.types.js +5 -0
- package/lib-amd/components/DataGridSelectionCell/DataGridSelectionCell.types.js.map +1 -0
- package/lib-amd/components/DataGridSelectionCell/index.js +10 -0
- package/lib-amd/components/DataGridSelectionCell/index.js.map +1 -0
- package/lib-amd/components/DataGridSelectionCell/renderDataGridSelectionCell.js +13 -0
- package/lib-amd/components/DataGridSelectionCell/renderDataGridSelectionCell.js.map +1 -0
- package/lib-amd/components/DataGridSelectionCell/useDataGridSelectionCell.js +39 -0
- package/lib-amd/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -0
- package/lib-amd/components/DataGridSelectionCell/useDataGridSelectionCellStyles.js +26 -0
- package/lib-amd/components/DataGridSelectionCell/useDataGridSelectionCellStyles.js.map +1 -0
- package/lib-amd/components/Table/Table.js +15 -0
- package/lib-amd/components/Table/Table.js.map +1 -0
- package/lib-amd/components/Table/Table.types.js +5 -0
- package/lib-amd/components/Table/Table.types.js.map +1 -0
- package/lib-amd/components/Table/index.js +10 -0
- package/lib-amd/components/Table/index.js.map +1 -0
- package/lib-amd/components/Table/renderTable.js +15 -0
- package/lib-amd/components/Table/renderTable.js.map +1 -0
- package/lib-amd/components/Table/useTable.js +29 -0
- package/lib-amd/components/Table/useTable.js.map +1 -0
- package/lib-amd/components/Table/useTableContextValues.js +18 -0
- package/lib-amd/components/Table/useTableContextValues.js.map +1 -0
- package/lib-amd/components/Table/useTableStyles.js +45 -0
- package/lib-amd/components/Table/useTableStyles.js.map +1 -0
- package/lib-amd/components/TableBody/TableBody.js +15 -0
- package/lib-amd/components/TableBody/TableBody.js.map +1 -0
- package/lib-amd/components/TableBody/TableBody.types.js +5 -0
- package/lib-amd/components/TableBody/TableBody.types.js.map +1 -0
- package/lib-amd/components/TableBody/index.js +10 -0
- package/lib-amd/components/TableBody/index.js.map +1 -0
- package/lib-amd/components/TableBody/renderTableBody.js +14 -0
- package/lib-amd/components/TableBody/renderTableBody.js.map +1 -0
- package/lib-amd/components/TableBody/useTableBody.js +28 -0
- package/lib-amd/components/TableBody/useTableBody.js.map +1 -0
- package/lib-amd/components/TableBody/useTableBodyStyles.js +32 -0
- package/lib-amd/components/TableBody/useTableBodyStyles.js.map +1 -0
- package/lib-amd/components/TableCell/TableCell.js +15 -0
- package/lib-amd/components/TableCell/TableCell.js.map +1 -0
- package/lib-amd/components/TableCell/TableCell.types.js +5 -0
- package/lib-amd/components/TableCell/TableCell.types.js.map +1 -0
- package/lib-amd/components/TableCell/index.js +10 -0
- package/lib-amd/components/TableCell/index.js.map +1 -0
- package/lib-amd/components/TableCell/renderTableCell.js +14 -0
- package/lib-amd/components/TableCell/renderTableCell.js.map +1 -0
- package/lib-amd/components/TableCell/useTableCell.js +29 -0
- package/lib-amd/components/TableCell/useTableCell.js.map +1 -0
- package/lib-amd/components/TableCell/useTableCellStyles.js +56 -0
- package/lib-amd/components/TableCell/useTableCellStyles.js.map +1 -0
- package/lib-amd/components/TableCellActions/TableCellActions.js +15 -0
- package/lib-amd/components/TableCellActions/TableCellActions.js.map +1 -0
- package/lib-amd/components/TableCellActions/TableCellActions.types.js +5 -0
- package/lib-amd/components/TableCellActions/TableCellActions.types.js.map +1 -0
- package/lib-amd/components/TableCellActions/index.js +10 -0
- package/lib-amd/components/TableCellActions/index.js.map +1 -0
- package/lib-amd/components/TableCellActions/renderTableCellActions.js +14 -0
- package/lib-amd/components/TableCellActions/renderTableCellActions.js.map +1 -0
- package/lib-amd/components/TableCellActions/useTableCellActions.js +26 -0
- package/lib-amd/components/TableCellActions/useTableCellActions.js.map +1 -0
- package/lib-amd/components/TableCellActions/useTableCellActionsStyles.js +35 -0
- package/lib-amd/components/TableCellActions/useTableCellActionsStyles.js.map +1 -0
- package/lib-amd/components/TableCellLayout/TableCellLayout.js +15 -0
- package/lib-amd/components/TableCellLayout/TableCellLayout.js.map +1 -0
- package/lib-amd/components/TableCellLayout/TableCellLayout.types.js +5 -0
- package/lib-amd/components/TableCellLayout/TableCellLayout.types.js.map +1 -0
- package/lib-amd/components/TableCellLayout/index.js +10 -0
- package/lib-amd/components/TableCellLayout/index.js.map +1 -0
- package/lib-amd/components/TableCellLayout/renderTableCellLayout.js +19 -0
- package/lib-amd/components/TableCellLayout/renderTableCellLayout.js.map +1 -0
- package/lib-amd/components/TableCellLayout/useTableCellLayout.js +42 -0
- package/lib-amd/components/TableCellLayout/useTableCellLayout.js.map +1 -0
- package/lib-amd/components/TableCellLayout/useTableCellLayoutContextValues.js +16 -0
- package/lib-amd/components/TableCellLayout/useTableCellLayoutContextValues.js.map +1 -0
- package/lib-amd/components/TableCellLayout/useTableCellLayoutStyles.js +79 -0
- package/lib-amd/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -0
- package/lib-amd/components/TableHeader/TableHeader.js +15 -0
- package/lib-amd/components/TableHeader/TableHeader.js.map +1 -0
- package/lib-amd/components/TableHeader/TableHeader.types.js +5 -0
- package/lib-amd/components/TableHeader/TableHeader.types.js.map +1 -0
- package/lib-amd/components/TableHeader/index.js +10 -0
- package/lib-amd/components/TableHeader/index.js.map +1 -0
- package/lib-amd/components/TableHeader/renderTableHeader.js +15 -0
- package/lib-amd/components/TableHeader/renderTableHeader.js.map +1 -0
- package/lib-amd/components/TableHeader/useTableHeader.js +28 -0
- package/lib-amd/components/TableHeader/useTableHeader.js.map +1 -0
- package/lib-amd/components/TableHeader/useTableHeaderStyles.js +32 -0
- package/lib-amd/components/TableHeader/useTableHeaderStyles.js.map +1 -0
- package/lib-amd/components/TableHeaderCell/TableHeaderCell.js +15 -0
- package/lib-amd/components/TableHeaderCell/TableHeaderCell.js.map +1 -0
- package/lib-amd/components/TableHeaderCell/TableHeaderCell.types.js +5 -0
- package/lib-amd/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -0
- package/lib-amd/components/TableHeaderCell/index.js +10 -0
- package/lib-amd/components/TableHeaderCell/index.js.map +1 -0
- package/lib-amd/components/TableHeaderCell/renderTableHeaderCell.js +18 -0
- package/lib-amd/components/TableHeaderCell/renderTableHeaderCell.js.map +1 -0
- package/lib-amd/components/TableHeaderCell/useTableHeaderCell.js +48 -0
- package/lib-amd/components/TableHeaderCell/useTableHeaderCell.js.map +1 -0
- package/lib-amd/components/TableHeaderCell/useTableHeaderCellStyles.js +67 -0
- package/lib-amd/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -0
- package/lib-amd/components/TableResizeHandle/TableResizeHandle.js +15 -0
- package/lib-amd/components/TableResizeHandle/TableResizeHandle.js.map +1 -0
- package/lib-amd/components/TableResizeHandle/TableResizeHandle.types.js +5 -0
- package/lib-amd/components/TableResizeHandle/TableResizeHandle.types.js.map +1 -0
- package/lib-amd/components/TableResizeHandle/index.js +10 -0
- package/lib-amd/components/TableResizeHandle/index.js.map +1 -0
- package/lib-amd/components/TableResizeHandle/renderTableResizeHandle.js +14 -0
- package/lib-amd/components/TableResizeHandle/renderTableResizeHandle.js.map +1 -0
- package/lib-amd/components/TableResizeHandle/useTableResizeHandle.js +29 -0
- package/lib-amd/components/TableResizeHandle/useTableResizeHandle.js.map +1 -0
- package/lib-amd/components/TableResizeHandle/useTableResizeHandleStyles.js +37 -0
- package/lib-amd/components/TableResizeHandle/useTableResizeHandleStyles.js.map +1 -0
- package/lib-amd/components/TableRow/TableRow.js +15 -0
- package/lib-amd/components/TableRow/TableRow.js.map +1 -0
- package/lib-amd/components/TableRow/TableRow.types.js +5 -0
- package/lib-amd/components/TableRow/TableRow.types.js.map +1 -0
- package/lib-amd/components/TableRow/index.js +10 -0
- package/lib-amd/components/TableRow/index.js.map +1 -0
- package/lib-amd/components/TableRow/renderTableRow.js +14 -0
- package/lib-amd/components/TableRow/renderTableRow.js.map +1 -0
- package/lib-amd/components/TableRow/useTableRow.js +34 -0
- package/lib-amd/components/TableRow/useTableRow.js.map +1 -0
- package/lib-amd/components/TableRow/useTableRowStyles.js +98 -0
- package/lib-amd/components/TableRow/useTableRowStyles.js.map +1 -0
- package/lib-amd/components/TableSelectionCell/TableSelectionCell.js +15 -0
- package/lib-amd/components/TableSelectionCell/TableSelectionCell.js.map +1 -0
- package/lib-amd/components/TableSelectionCell/TableSelectionCell.types.js +5 -0
- package/lib-amd/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -0
- package/lib-amd/components/TableSelectionCell/index.js +10 -0
- package/lib-amd/components/TableSelectionCell/index.js.map +1 -0
- package/lib-amd/components/TableSelectionCell/renderTableSelectionCell.js +16 -0
- package/lib-amd/components/TableSelectionCell/renderTableSelectionCell.js.map +1 -0
- package/lib-amd/components/TableSelectionCell/useTableSelectionCell.js +28 -0
- package/lib-amd/components/TableSelectionCell/useTableSelectionCell.js.map +1 -0
- package/lib-amd/components/TableSelectionCell/useTableSelectionCellStyles.js +58 -0
- package/lib-amd/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -0
- package/lib-amd/contexts/columnIdContext.js +11 -0
- package/lib-amd/contexts/columnIdContext.js.map +1 -0
- package/lib-amd/contexts/dataGridContext.js +16 -0
- package/lib-amd/contexts/dataGridContext.js.map +1 -0
- package/lib-amd/contexts/rowIdContext.js +11 -0
- package/lib-amd/contexts/rowIdContext.js.map +1 -0
- package/lib-amd/contexts/tableContext.js +15 -0
- package/lib-amd/contexts/tableContext.js.map +1 -0
- package/lib-amd/contexts/tableHeaderContext.js +11 -0
- package/lib-amd/contexts/tableHeaderContext.js.map +1 -0
- package/lib-amd/hooks/createColumn.js +36 -0
- package/lib-amd/hooks/createColumn.js.map +1 -0
- package/lib-amd/hooks/index.js +11 -0
- package/lib-amd/hooks/index.js.map +1 -0
- package/lib-amd/hooks/selectionManager.js +82 -0
- package/lib-amd/hooks/selectionManager.js.map +1 -0
- package/lib-amd/hooks/types.js +5 -0
- package/lib-amd/hooks/types.js.map +1 -0
- package/lib-amd/hooks/useMeasureElement.js +46 -0
- package/lib-amd/hooks/useMeasureElement.js.map +1 -0
- package/lib-amd/hooks/useTableColumnResizeMouseHandler.js +50 -0
- package/lib-amd/hooks/useTableColumnResizeMouseHandler.js.map +1 -0
- package/lib-amd/hooks/useTableColumnResizeState.js +73 -0
- package/lib-amd/hooks/useTableColumnResizeState.js.map +1 -0
- package/lib-amd/hooks/useTableColumnSizing.js +56 -0
- package/lib-amd/hooks/useTableColumnSizing.js.map +1 -0
- package/lib-amd/hooks/useTableFeatures.js +39 -0
- package/lib-amd/hooks/useTableFeatures.js.map +1 -0
- package/lib-amd/hooks/useTableSelection.js +70 -0
- package/lib-amd/hooks/useTableSelection.js.map +1 -0
- package/lib-amd/hooks/useTableSort.js +74 -0
- package/lib-amd/hooks/useTableSort.js.map +1 -0
- package/lib-amd/index.js +107 -0
- package/lib-amd/index.js.map +1 -0
- package/lib-amd/utils/columnResizeUtils.js +158 -0
- package/lib-amd/utils/columnResizeUtils.js.map +1 -0
- package/lib-commonjs/components/DataGrid/useDataGrid.js +15 -3
- package/lib-commonjs/components/DataGrid/useDataGrid.js.map +1 -1
- package/lib-commonjs/components/DataGrid/useDataGridContextValues.js +2 -1
- package/lib-commonjs/components/DataGrid/useDataGridContextValues.js.map +1 -1
- package/lib-commonjs/components/DataGridCell/useDataGridCell.js +5 -0
- package/lib-commonjs/components/DataGridCell/useDataGridCell.js.map +1 -1
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js +3 -0
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js +1 -0
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js +18 -4
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js +2 -1
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
- package/lib-commonjs/hooks/useTableColumnResizeMouseHandler.js +4 -1
- package/lib-commonjs/hooks/useTableColumnResizeMouseHandler.js.map +1 -1
- package/lib-commonjs/hooks/useTableColumnResizeState.js +11 -2
- package/lib-commonjs/hooks/useTableColumnResizeState.js.map +1 -1
- package/lib-commonjs/hooks/useTableColumnSizing.js +5 -2
- package/lib-commonjs/hooks/useTableColumnSizing.js.map +1 -1
- package/lib-commonjs/utils/columnResizeUtils.js +6 -6
- package/lib-commonjs/utils/columnResizeUtils.js.map +1 -1
- package/package.json +9 -11
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,93 @@
|
|
|
2
2
|
"name": "@fluentui/react-table",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Mon, 13 Feb 2023 09:34:36 GMT",
|
|
6
|
+
"tag": "@fluentui/react-table_v9.0.1",
|
|
7
|
+
"version": "9.0.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@fluentui/react-table",
|
|
13
|
+
"comment": "Bump @fluentui/react-avatar to v9.3.4",
|
|
14
|
+
"commit": "b24aed22677cb12a74f185feee89edefd1601b9a"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Fri, 10 Feb 2023 08:50:01 GMT",
|
|
21
|
+
"tag": "@fluentui/react-table_v9.0.0",
|
|
22
|
+
"version": "9.0.0",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "lingfangao@hotmail.com",
|
|
27
|
+
"package": "@fluentui/react-table",
|
|
28
|
+
"commit": "6a925547d8051b7d9a1855d6f20b7920d946fcdf",
|
|
29
|
+
"comment": "feat: Release 9.0.0"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"author": "beachball",
|
|
33
|
+
"package": "@fluentui/react-table",
|
|
34
|
+
"comment": "Bump @fluentui/react-aria to v9.3.8",
|
|
35
|
+
"commit": "cc62f050f8231e8f21a2cf7dddf33003e0ba3931"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"author": "beachball",
|
|
39
|
+
"package": "@fluentui/react-table",
|
|
40
|
+
"comment": "Bump @fluentui/react-avatar to v9.3.3",
|
|
41
|
+
"commit": "cc62f050f8231e8f21a2cf7dddf33003e0ba3931"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"author": "beachball",
|
|
45
|
+
"package": "@fluentui/react-table",
|
|
46
|
+
"comment": "Bump @fluentui/react-checkbox to v9.0.26",
|
|
47
|
+
"commit": "cc62f050f8231e8f21a2cf7dddf33003e0ba3931"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"author": "beachball",
|
|
51
|
+
"package": "@fluentui/react-table",
|
|
52
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.8",
|
|
53
|
+
"commit": "cc62f050f8231e8f21a2cf7dddf33003e0ba3931"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"author": "beachball",
|
|
57
|
+
"package": "@fluentui/react-table",
|
|
58
|
+
"comment": "Bump @fluentui/react-radio to v9.0.24",
|
|
59
|
+
"commit": "cc62f050f8231e8f21a2cf7dddf33003e0ba3931"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"author": "beachball",
|
|
63
|
+
"package": "@fluentui/react-table",
|
|
64
|
+
"comment": "Bump @fluentui/react-tabster to v9.5.1",
|
|
65
|
+
"commit": "cc62f050f8231e8f21a2cf7dddf33003e0ba3931"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"author": "beachball",
|
|
69
|
+
"package": "@fluentui/react-table",
|
|
70
|
+
"comment": "Bump @fluentui/react-utilities to v9.5.2",
|
|
71
|
+
"commit": "cc62f050f8231e8f21a2cf7dddf33003e0ba3931"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"prerelease": [
|
|
75
|
+
{
|
|
76
|
+
"author": "jirivyhnalek@microsoft.com",
|
|
77
|
+
"package": "@fluentui/react-table",
|
|
78
|
+
"commit": "fbe4207b3b40b147e936ecaf1e8fad9a8b357db9",
|
|
79
|
+
"comment": "feat: TableCellLayout component now supports truncate prop"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"author": "jirivyhnalek@microsoft.com",
|
|
83
|
+
"package": "@fluentui/react-table",
|
|
84
|
+
"commit": "c5149e270e02a09eae9b7dfbba4da3aa4ac77a52",
|
|
85
|
+
"comment": "feat: DataGrid - add support for resizable columns"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"date": "Tue, 07 Feb 2023 14:13:07 GMT",
|
|
6
92
|
"tag": "@fluentui/react-table_v9.0.0-rc.5",
|
|
7
93
|
"version": "9.0.0-rc.5",
|
|
8
94
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-table
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 13 Feb 2023 09:34:36 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.0.1)
|
|
8
|
+
|
|
9
|
+
Mon, 13 Feb 2023 09:34:36 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.0.0..@fluentui/react-table_v9.0.1)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-avatar to v9.3.4 ([PR #26800](https://github.com/microsoft/fluentui/pull/26800) by beachball)
|
|
15
|
+
|
|
16
|
+
## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.0.0)
|
|
17
|
+
|
|
18
|
+
Fri, 10 Feb 2023 08:50:01 GMT
|
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.0.0-rc.5..@fluentui/react-table_v9.0.0)
|
|
20
|
+
|
|
21
|
+
### Patches
|
|
22
|
+
|
|
23
|
+
- feat: Release 9.0.0 ([PR #26736](https://github.com/microsoft/fluentui/pull/26736) by lingfangao@hotmail.com)
|
|
24
|
+
- Bump @fluentui/react-aria to v9.3.8 ([commit](https://github.com/microsoft/fluentui/commit/cc62f050f8231e8f21a2cf7dddf33003e0ba3931) by beachball)
|
|
25
|
+
- Bump @fluentui/react-avatar to v9.3.3 ([commit](https://github.com/microsoft/fluentui/commit/cc62f050f8231e8f21a2cf7dddf33003e0ba3931) by beachball)
|
|
26
|
+
- Bump @fluentui/react-checkbox to v9.0.26 ([commit](https://github.com/microsoft/fluentui/commit/cc62f050f8231e8f21a2cf7dddf33003e0ba3931) by beachball)
|
|
27
|
+
- Bump @fluentui/react-context-selector to v9.1.8 ([commit](https://github.com/microsoft/fluentui/commit/cc62f050f8231e8f21a2cf7dddf33003e0ba3931) by beachball)
|
|
28
|
+
- Bump @fluentui/react-radio to v9.0.24 ([commit](https://github.com/microsoft/fluentui/commit/cc62f050f8231e8f21a2cf7dddf33003e0ba3931) by beachball)
|
|
29
|
+
- Bump @fluentui/react-tabster to v9.5.1 ([commit](https://github.com/microsoft/fluentui/commit/cc62f050f8231e8f21a2cf7dddf33003e0ba3931) by beachball)
|
|
30
|
+
- Bump @fluentui/react-utilities to v9.5.2 ([commit](https://github.com/microsoft/fluentui/commit/cc62f050f8231e8f21a2cf7dddf33003e0ba3931) by beachball)
|
|
31
|
+
|
|
32
|
+
### Changes
|
|
33
|
+
|
|
34
|
+
- feat: TableCellLayout component now supports truncate prop ([PR #26738](https://github.com/microsoft/fluentui/pull/26738) by jirivyhnalek@microsoft.com)
|
|
35
|
+
- feat: DataGrid - add support for resizable columns ([PR #26690](https://github.com/microsoft/fluentui/pull/26690) by jirivyhnalek@microsoft.com)
|
|
36
|
+
|
|
7
37
|
## [9.0.0-rc.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.0.0-rc.5)
|
|
8
38
|
|
|
9
|
-
Tue, 07 Feb 2023 14:
|
|
39
|
+
Tue, 07 Feb 2023 14:13:07 GMT
|
|
10
40
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.0.0-rc.4..@fluentui/react-table_v9.0.0-rc.5)
|
|
11
41
|
|
|
12
42
|
### Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -117,6 +117,10 @@ export declare type DataGridContextValue = TableFeaturesState<any> & {
|
|
|
117
117
|
* @default brand
|
|
118
118
|
*/
|
|
119
119
|
selectionAppearance: TableRowProps['appearance'];
|
|
120
|
+
/**
|
|
121
|
+
* Enables column resizing
|
|
122
|
+
*/
|
|
123
|
+
resizableColumns?: boolean;
|
|
120
124
|
};
|
|
121
125
|
|
|
122
126
|
export declare type DataGridContextValues = TableContextValues & {
|
|
@@ -166,7 +170,7 @@ export declare type DataGridHeaderState = TableHeaderState;
|
|
|
166
170
|
/**
|
|
167
171
|
* DataGrid Props
|
|
168
172
|
*/
|
|
169
|
-
export declare type DataGridProps = TableProps & Pick<DataGridContextValue, 'items' | 'columns' | 'getRowId'> & Pick<Partial<DataGridContextValue>, 'focusMode' | 'subtleSelection' | 'selectionAppearance'> & Pick<UseTableSortOptions, 'sortState' | 'defaultSortState'> & Pick<UseTableSelectionOptions, 'defaultSelectedItems' | 'selectedItems'> & {
|
|
173
|
+
export declare type DataGridProps = TableProps & Pick<DataGridContextValue, 'items' | 'columns' | 'getRowId'> & Pick<Partial<DataGridContextValue>, 'focusMode' | 'subtleSelection' | 'selectionAppearance' | 'resizableColumns'> & Pick<UseTableSortOptions, 'sortState' | 'defaultSortState'> & Pick<UseTableSelectionOptions, 'defaultSelectedItems' | 'selectedItems'> & {
|
|
170
174
|
onSortChange?: (e: React_2.MouseEvent, sortState: SortState) => void;
|
|
171
175
|
onSelectionChange?: (e: React_2.MouseEvent | React_2.KeyboardEvent, data: OnSelectionChangeData) => void;
|
|
172
176
|
/**
|
|
@@ -174,6 +178,17 @@ export declare type DataGridProps = TableProps & Pick<DataGridContextValue, 'ite
|
|
|
174
178
|
* @default false
|
|
175
179
|
*/
|
|
176
180
|
selectionMode?: SelectionMode_2;
|
|
181
|
+
/**
|
|
182
|
+
* Options for column resizing
|
|
183
|
+
*/
|
|
184
|
+
columnSizingOptions?: TableColumnSizingOptions;
|
|
185
|
+
/**
|
|
186
|
+
* A callback triggered when a column is resized.
|
|
187
|
+
*/
|
|
188
|
+
onColumnResize?: (event: MouseEvent | undefined, data: {
|
|
189
|
+
columnId: TableColumnId;
|
|
190
|
+
width: number;
|
|
191
|
+
}) => void;
|
|
177
192
|
};
|
|
178
193
|
|
|
179
194
|
/**
|
|
@@ -232,7 +247,7 @@ export declare type DataGridSlots = TableSlots;
|
|
|
232
247
|
*/
|
|
233
248
|
export declare type DataGridState = TableState & {
|
|
234
249
|
tableState: TableFeaturesState<unknown>;
|
|
235
|
-
} & Pick<DataGridContextValue, 'focusMode' | 'selectableRows' | 'subtleSelection' | 'selectionAppearance' | 'getRowId'>;
|
|
250
|
+
} & Pick<DataGridContextValue, 'focusMode' | 'selectableRows' | 'subtleSelection' | 'selectionAppearance' | 'getRowId' | 'resizableColumns'>;
|
|
236
251
|
|
|
237
252
|
declare interface OnSelectionChangeData {
|
|
238
253
|
selectedItems: Set<TableRowId>;
|
|
@@ -422,6 +437,10 @@ export declare type TableCellLayoutProps = ComponentProps<Partial<TableCellLayou
|
|
|
422
437
|
* @default undefined
|
|
423
438
|
*/
|
|
424
439
|
appearance?: 'primary';
|
|
440
|
+
/**
|
|
441
|
+
* Renders content with overflow: hidden and text-overflow: ellipsis
|
|
442
|
+
*/
|
|
443
|
+
truncate?: boolean;
|
|
425
444
|
};
|
|
426
445
|
|
|
427
446
|
export declare type TableCellLayoutSlots = {
|
|
@@ -447,7 +466,7 @@ export declare type TableCellLayoutSlots = {
|
|
|
447
466
|
/**
|
|
448
467
|
* State used in rendering TableCellLayout
|
|
449
468
|
*/
|
|
450
|
-
export declare type TableCellLayoutState = ComponentState<TableCellLayoutSlots> & Pick<TableCellLayoutProps, 'appearance'> & {
|
|
469
|
+
export declare type TableCellLayoutState = ComponentState<TableCellLayoutSlots> & Pick<TableCellLayoutProps, 'appearance' | 'truncate'> & {
|
|
451
470
|
avatarSize: AvatarSize | undefined;
|
|
452
471
|
} & Pick<TableContextValue, 'size'>;
|
|
453
472
|
|
|
@@ -997,7 +1016,11 @@ export declare function useTableColumnSizing_unstable<TItem>(params?: UseTableCo
|
|
|
997
1016
|
|
|
998
1017
|
declare type UseTableColumnSizingParams = {
|
|
999
1018
|
columnSizingOptions?: TableColumnSizingOptions;
|
|
1000
|
-
onColumnResize?: (
|
|
1019
|
+
onColumnResize?: (e: MouseEvent | undefined, data: {
|
|
1020
|
+
columnId: TableColumnId;
|
|
1021
|
+
width: number;
|
|
1022
|
+
}) => void;
|
|
1023
|
+
containerWidthOffset?: number;
|
|
1001
1024
|
};
|
|
1002
1025
|
|
|
1003
1026
|
export declare const useTableContext: () => TableContextValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGrid.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGrid/DataGrid.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { TableContextValues, TableProps, TableSlots, TableState } from '../Table/Table.types';\nimport type {\n SortState,\n TableFeaturesState,\n UseTableSortOptions,\n SelectionMode,\n UseTableSelectionOptions,\n OnSelectionChangeData,\n} from '../../hooks';\nimport { TableRowProps } from '../TableRow/TableRow.types';\n\nexport type DataGridSlots = TableSlots;\n\nexport type DataGridFocusMode = 'none' | 'cell' | 'row_unstable';\n\nexport type DataGridContextValues = TableContextValues & {\n dataGrid: DataGridContextValue;\n};\n\n// Use any here since we can't know the user types\n// The user is responsible for narrowing the type downstream\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DataGridContextValue = TableFeaturesState<any> & {\n /**\n * How focus navigation will work in the datagrid\n * @default cell\n */\n focusMode: DataGridFocusMode;\n\n /**\n * Lets child components know if rows selection is enabled\n * @see selectionMode prop enables row selection on the component\n */\n selectableRows: boolean;\n\n /**\n * Enables subtle selection style\n * @default false\n */\n subtleSelection: boolean;\n\n /**\n * Row appearance when selected\n * @default brand\n */\n selectionAppearance: TableRowProps['appearance'];\n};\n\n/**\n * DataGrid Props\n */\nexport type DataGridProps = TableProps &\n Pick<DataGridContextValue, 'items' | 'columns' | 'getRowId'> &\n Pick<Partial<DataGridContextValue>, 'focusMode' | 'subtleSelection' | 'selectionAppearance'> &\n Pick<UseTableSortOptions, 'sortState' | 'defaultSortState'> &\n Pick<UseTableSelectionOptions, 'defaultSelectedItems' | 'selectedItems'> & {\n onSortChange?: (e: React.MouseEvent, sortState: SortState) => void;\n onSelectionChange?: (e: React.MouseEvent | React.KeyboardEvent, data: OnSelectionChangeData) => void;\n /**\n * Enables row selection and sets the selection mode\n * @default false\n */\n selectionMode?: SelectionMode;\n };\n\n/**\n * State used in rendering DataGrid\n */\nexport type DataGridState = TableState & { tableState: TableFeaturesState<unknown> } & Pick<\n DataGridContextValue,\n 'focusMode' | 'selectableRows' | 'subtleSelection' | 'selectionAppearance' | 'getRowId'\n >;\n"]}
|
|
1
|
+
{"version":3,"file":"DataGrid.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGrid/DataGrid.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { TableContextValues, TableProps, TableSlots, TableState } from '../Table/Table.types';\nimport type {\n SortState,\n TableFeaturesState,\n UseTableSortOptions,\n SelectionMode,\n UseTableSelectionOptions,\n OnSelectionChangeData,\n TableColumnSizingOptions,\n TableColumnId,\n} from '../../hooks';\nimport { TableRowProps } from '../TableRow/TableRow.types';\n\nexport type DataGridSlots = TableSlots;\n\nexport type DataGridFocusMode = 'none' | 'cell' | 'row_unstable';\n\nexport type DataGridContextValues = TableContextValues & {\n dataGrid: DataGridContextValue;\n};\n\n// Use any here since we can't know the user types\n// The user is responsible for narrowing the type downstream\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DataGridContextValue = TableFeaturesState<any> & {\n /**\n * How focus navigation will work in the datagrid\n * @default cell\n */\n focusMode: DataGridFocusMode;\n\n /**\n * Lets child components know if rows selection is enabled\n * @see selectionMode prop enables row selection on the component\n */\n selectableRows: boolean;\n\n /**\n * Enables subtle selection style\n * @default false\n */\n subtleSelection: boolean;\n\n /**\n * Row appearance when selected\n * @default brand\n */\n selectionAppearance: TableRowProps['appearance'];\n\n /**\n * Enables column resizing\n */\n resizableColumns?: boolean;\n};\n\n/**\n * DataGrid Props\n */\nexport type DataGridProps = TableProps &\n Pick<DataGridContextValue, 'items' | 'columns' | 'getRowId'> &\n Pick<Partial<DataGridContextValue>, 'focusMode' | 'subtleSelection' | 'selectionAppearance' | 'resizableColumns'> &\n Pick<UseTableSortOptions, 'sortState' | 'defaultSortState'> &\n Pick<UseTableSelectionOptions, 'defaultSelectedItems' | 'selectedItems'> & {\n onSortChange?: (e: React.MouseEvent, sortState: SortState) => void;\n onSelectionChange?: (e: React.MouseEvent | React.KeyboardEvent, data: OnSelectionChangeData) => void;\n /**\n * Enables row selection and sets the selection mode\n * @default false\n */\n selectionMode?: SelectionMode;\n /**\n * Options for column resizing\n */\n columnSizingOptions?: TableColumnSizingOptions;\n /**\n * A callback triggered when a column is resized.\n */\n onColumnResize?: (event: MouseEvent | undefined, data: { columnId: TableColumnId; width: number }) => void;\n };\n\n/**\n * State used in rendering DataGrid\n */\nexport type DataGridState = TableState & { tableState: TableFeaturesState<unknown> } & Pick<\n DataGridContextValue,\n 'focusMode' | 'selectableRows' | 'subtleSelection' | 'selectionAppearance' | 'getRowId' | 'resizableColumns'\n >;\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
2
2
|
import { useTable_unstable } from '../Table/useTable';
|
|
3
|
-
import { useTableFeatures, useTableSort, useTableSelection } from '../../hooks';
|
|
3
|
+
import { useTableFeatures, useTableSort, useTableSelection, useTableColumnSizing_unstable } from '../../hooks';
|
|
4
|
+
import { CELL_WIDTH } from '../TableSelectionCell';
|
|
5
|
+
import { useMergedRefs } from '@fluentui/react-utilities';
|
|
4
6
|
/**
|
|
5
7
|
* Create the state required to render DataGrid.
|
|
6
8
|
*
|
|
@@ -24,7 +26,10 @@ export const useDataGrid_unstable = (props, ref) => {
|
|
|
24
26
|
defaultSelectedItems,
|
|
25
27
|
subtleSelection = false,
|
|
26
28
|
selectionAppearance = 'brand',
|
|
27
|
-
getRowId
|
|
29
|
+
getRowId,
|
|
30
|
+
resizableColumns,
|
|
31
|
+
columnSizingOptions,
|
|
32
|
+
onColumnResize
|
|
28
33
|
} = props;
|
|
29
34
|
const navigable = focusMode !== 'none';
|
|
30
35
|
const keyboardNavAttr = useArrowNavigationGroup({
|
|
@@ -43,6 +48,12 @@ export const useDataGrid_unstable = (props, ref) => {
|
|
|
43
48
|
selectedItems,
|
|
44
49
|
onSelectionChange,
|
|
45
50
|
selectionMode: selectionMode !== null && selectionMode !== void 0 ? selectionMode : 'multiselect'
|
|
51
|
+
}), useTableColumnSizing_unstable({
|
|
52
|
+
onColumnResize,
|
|
53
|
+
columnSizingOptions,
|
|
54
|
+
// The selection cell is not part of the columns, therefore its width needs to be subtracted
|
|
55
|
+
// from the container to make sure the columns don't overflow the table.
|
|
56
|
+
containerWidthOffset: selectionMode ? -CELL_WIDTH : 0
|
|
46
57
|
})]);
|
|
47
58
|
const baseTableState = useTable_unstable({
|
|
48
59
|
role: 'grid',
|
|
@@ -50,14 +61,15 @@ export const useDataGrid_unstable = (props, ref) => {
|
|
|
50
61
|
noNativeElements: true,
|
|
51
62
|
...(navigable && keyboardNavAttr),
|
|
52
63
|
...props
|
|
53
|
-
}, ref);
|
|
64
|
+
}, useMergedRefs(ref, tableState.tableRef));
|
|
54
65
|
return {
|
|
55
66
|
...baseTableState,
|
|
56
67
|
focusMode,
|
|
57
68
|
tableState,
|
|
58
69
|
selectableRows: !!selectionMode,
|
|
59
70
|
subtleSelection,
|
|
60
|
-
selectionAppearance
|
|
71
|
+
selectionAppearance,
|
|
72
|
+
resizableColumns
|
|
61
73
|
};
|
|
62
74
|
};
|
|
63
75
|
//# sourceMappingURL=useDataGrid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AACA,SAASA,uBAAuB,QAAQ,yBAAyB;AAEjE,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,gBAAgB,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ,aAAa;
|
|
1
|
+
{"version":3,"mappings":"AACA,SAASA,uBAAuB,QAAQ,yBAAyB;AAEjE,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,gBAAgB,EAAEC,YAAY,EAAEC,iBAAiB,EAAEC,6BAA6B,QAAQ,aAAa;AAC9G,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,aAAa,QAAQ,2BAA2B;AAEzD;;;;;;;;;AASA,OAAO,MAAMC,oBAAoB,GAAG,CAACC,KAAoB,EAAEC,GAA2B,KAAmB;EACvG,MAAM;IACJC,KAAK;IACLC,OAAO;IACPC,SAAS,GAAG,MAAM;IAClBC,aAAa;IACbC,YAAY;IACZC,iBAAiB;IACjBC,gBAAgB;IAChBC,SAAS;IACTC,aAAa;IACbC,oBAAoB;IACpBC,eAAe,GAAG,KAAK;IACvBC,mBAAmB,GAAG,OAAO;IAC7BC,QAAQ;IACRC,gBAAgB;IAChBC,mBAAmB;IACnBC;EAAc,CACf,GAAGjB,KAAK;EAET,MAAMkB,SAAS,GAAGd,SAAS,KAAK,MAAM;EACtC,MAAMe,eAAe,GAAG5B,uBAAuB,CAAC;IAAE6B,IAAI,EAAE;EAAM,CAAE,CAAC;EAEjE,MAAMC,UAAU,GAAG5B,gBAAgB,CAAC;IAAES,KAAK;IAAEC,OAAO;IAAEW;EAAQ,CAAE,EAAE,CAChEpB,YAAY,CAAC;IACXc,gBAAgB;IAChBC,SAAS;IACTH;GACD,CAAC,EACFX,iBAAiB,CAAC;IAChBgB,oBAAoB;IACpBD,aAAa;IACbH,iBAAiB;IACjBF,aAAa,EAAEA,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAI;GACjC,CAAC,EACFT,6BAA6B,CAAC;IAC5BqB,cAAc;IACdD,mBAAmB;IACnB;IACA;IACAM,oBAAoB,EAAEjB,aAAa,GAAG,CAACR,UAAU,GAAG;GACrD,CAAC,CACH,CAAC;EAEF,MAAM0B,cAAc,GAAG/B,iBAAiB,CACtC;IACEgC,IAAI,EAAE,MAAM;IACZC,EAAE,EAAE,KAAK;IACTC,gBAAgB,EAAE,IAAI;IACtB,IAAIR,SAAS,IAAIC,eAAe,CAAC;IACjC,GAAGnB;GACJ,EACDF,aAAa,CAACG,GAAG,EAAEoB,UAAU,CAACM,QAAQ,CAAC,CACxC;EAED,OAAO;IACL,GAAGJ,cAAc;IACjBnB,SAAS;IACTiB,UAAU;IACVO,cAAc,EAAE,CAAC,CAACvB,aAAa;IAC/BO,eAAe;IACfC,mBAAmB;IACnBE;GACD;AACH,CAAC","names":["useArrowNavigationGroup","useTable_unstable","useTableFeatures","useTableSort","useTableSelection","useTableColumnSizing_unstable","CELL_WIDTH","useMergedRefs","useDataGrid_unstable","props","ref","items","columns","focusMode","selectionMode","onSortChange","onSelectionChange","defaultSortState","sortState","selectedItems","defaultSelectedItems","subtleSelection","selectionAppearance","getRowId","resizableColumns","columnSizingOptions","onColumnResize","navigable","keyboardNavAttr","axis","tableState","containerWidthOffset","baseTableState","role","as","noNativeElements","tableRef","selectableRows"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGrid/useDataGrid.ts"],"sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport type { DataGridProps, DataGridState } from './DataGrid.types';\nimport { useTable_unstable } from '../Table/useTable';\nimport { useTableFeatures, useTableSort, useTableSelection, useTableColumnSizing_unstable } from '../../hooks';\nimport { CELL_WIDTH } from '../TableSelectionCell';\nimport { useMergedRefs } from '@fluentui/react-utilities';\n\n/**\n * Create the state required to render DataGrid.\n *\n * The returned state can be modified with hooks such as useDataGridStyles_unstable,\n * before being passed to renderDataGrid_unstable.\n *\n * @param props - props from this instance of DataGrid\n * @param ref - reference to root HTMLElement of DataGrid\n */\nexport const useDataGrid_unstable = (props: DataGridProps, ref: React.Ref<HTMLElement>): DataGridState => {\n const {\n items,\n columns,\n focusMode = 'cell',\n selectionMode,\n onSortChange,\n onSelectionChange,\n defaultSortState,\n sortState,\n selectedItems,\n defaultSelectedItems,\n subtleSelection = false,\n selectionAppearance = 'brand',\n getRowId,\n resizableColumns,\n columnSizingOptions,\n onColumnResize,\n } = props;\n\n const navigable = focusMode !== 'none';\n const keyboardNavAttr = useArrowNavigationGroup({ axis: 'grid' });\n\n const tableState = useTableFeatures({ items, columns, getRowId }, [\n useTableSort({\n defaultSortState,\n sortState,\n onSortChange,\n }),\n useTableSelection({\n defaultSelectedItems,\n selectedItems,\n onSelectionChange,\n selectionMode: selectionMode ?? 'multiselect',\n }),\n useTableColumnSizing_unstable({\n onColumnResize,\n columnSizingOptions,\n // The selection cell is not part of the columns, therefore its width needs to be subtracted\n // from the container to make sure the columns don't overflow the table.\n containerWidthOffset: selectionMode ? -CELL_WIDTH : 0,\n }),\n ]);\n\n const baseTableState = useTable_unstable(\n {\n role: 'grid',\n as: 'div',\n noNativeElements: true,\n ...(navigable && keyboardNavAttr),\n ...props,\n },\n useMergedRefs(ref, tableState.tableRef),\n );\n\n return {\n ...baseTableState,\n focusMode,\n tableState,\n selectableRows: !!selectionMode,\n subtleSelection,\n selectionAppearance,\n resizableColumns,\n };\n};\n"]}
|
|
@@ -8,7 +8,8 @@ export function useDataGridContextValues_unstable(state) {
|
|
|
8
8
|
focusMode: state.focusMode,
|
|
9
9
|
selectableRows: state.selectableRows,
|
|
10
10
|
subtleSelection: state.subtleSelection,
|
|
11
|
-
selectionAppearance: state.selectionAppearance
|
|
11
|
+
selectionAppearance: state.selectionAppearance,
|
|
12
|
+
resizableColumns: state.resizableColumns
|
|
12
13
|
}
|
|
13
14
|
};
|
|
14
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,SAASA,8BAA8B,QAAQ,gCAAgC;AAG/E,OAAM,SAAUC,iCAAiC,CAACC,KAAoB;EACpE,MAAMC,kBAAkB,GAAGH,8BAA8B,CAACE,KAAK,CAAC;EAChE,OAAO;IACL,GAAGC,kBAAkB;IACrBC,QAAQ,EAAE;MACR,GAAGF,KAAK,CAACG,UAAU;MACnBC,SAAS,EAAEJ,KAAK,CAACI,SAAS;MAC1BC,cAAc,EAAEL,KAAK,CAACK,cAAc;MACpCC,eAAe,EAAEN,KAAK,CAACM,eAAe;MACtCC,mBAAmB,EAAEP,KAAK,CAACO;;
|
|
1
|
+
{"version":3,"mappings":"AAAA,SAASA,8BAA8B,QAAQ,gCAAgC;AAG/E,OAAM,SAAUC,iCAAiC,CAACC,KAAoB;EACpE,MAAMC,kBAAkB,GAAGH,8BAA8B,CAACE,KAAK,CAAC;EAChE,OAAO;IACL,GAAGC,kBAAkB;IACrBC,QAAQ,EAAE;MACR,GAAGF,KAAK,CAACG,UAAU;MACnBC,SAAS,EAAEJ,KAAK,CAACI,SAAS;MAC1BC,cAAc,EAAEL,KAAK,CAACK,cAAc;MACpCC,eAAe,EAAEN,KAAK,CAACM,eAAe;MACtCC,mBAAmB,EAAEP,KAAK,CAACO,mBAAmB;MAC9CC,gBAAgB,EAAER,KAAK,CAACQ;;GAE3B;AACH","names":["useTableContextValues_unstable","useDataGridContextValues_unstable","state","tableContextValues","dataGrid","tableState","focusMode","selectableRows","subtleSelection","selectionAppearance","resizableColumns"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGrid/useDataGridContextValues.ts"],"sourcesContent":["import { useTableContextValues_unstable } from '../Table/useTableContextValues';\nimport { DataGridContextValues, DataGridState } from './DataGrid.types';\n\nexport function useDataGridContextValues_unstable(state: DataGridState): DataGridContextValues {\n const tableContextValues = useTableContextValues_unstable(state);\n return {\n ...tableContextValues,\n dataGrid: {\n ...state.tableState,\n focusMode: state.focusMode,\n selectableRows: state.selectableRows,\n subtleSelection: state.subtleSelection,\n selectionAppearance: state.selectionAppearance,\n resizableColumns: state.resizableColumns,\n },\n };\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useTableCell_unstable } from '../TableCell/useTableCell';
|
|
2
2
|
import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
|
|
3
|
+
import { useColumnIdContext } from '../../contexts/columnIdContext';
|
|
3
4
|
/**
|
|
4
5
|
* Create the state required to render DataGridCell.
|
|
5
6
|
*
|
|
@@ -10,11 +11,15 @@ import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
|
|
|
10
11
|
* @param ref - reference to root HTMLElement of DataGridCell
|
|
11
12
|
*/
|
|
12
13
|
export const useDataGridCell_unstable = (props, ref) => {
|
|
14
|
+
const columnId = useColumnIdContext();
|
|
13
15
|
const tabbable = useDataGridContext_unstable(ctx => ctx.focusMode === 'cell');
|
|
16
|
+
const resizableColumns = useDataGridContext_unstable(ctx => ctx.resizableColumns);
|
|
17
|
+
const columnSizing = useDataGridContext_unstable(ctx => ctx.columnSizing_unstable);
|
|
14
18
|
return useTableCell_unstable({
|
|
15
19
|
as: 'div',
|
|
16
20
|
role: 'gridcell',
|
|
17
21
|
tabIndex: tabbable ? 0 : undefined,
|
|
22
|
+
...(resizableColumns ? columnSizing.getTableCellProps(columnId) : {}),
|
|
18
23
|
...props
|
|
19
24
|
}, ref);
|
|
20
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAEA,SAASA,qBAAqB,QAAQ,2BAA2B;AACjE,SAASC,2BAA2B,QAAQ,gCAAgC;
|
|
1
|
+
{"version":3,"mappings":"AAEA,SAASA,qBAAqB,QAAQ,2BAA2B;AACjE,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,kBAAkB,QAAQ,gCAAgC;AAEnE;;;;;;;;;AASA,OAAO,MAAMC,wBAAwB,GAAG,CAACC,KAAwB,EAAEC,GAA2B,KAAuB;EACnH,MAAMC,QAAQ,GAAGJ,kBAAkB,EAAE;EACrC,MAAMK,QAAQ,GAAGN,2BAA2B,CAACO,GAAG,IAAIA,GAAG,CAACC,SAAS,KAAK,MAAM,CAAC;EAC7E,MAAMC,gBAAgB,GAAGT,2BAA2B,CAACO,GAAG,IAAIA,GAAG,CAACE,gBAAgB,CAAC;EACjF,MAAMC,YAAY,GAAGV,2BAA2B,CAACO,GAAG,IAAIA,GAAG,CAACI,qBAAqB,CAAC;EAClF,OAAOZ,qBAAqB,CAC1B;IACEa,EAAE,EAAE,KAAK;IACTC,IAAI,EAAE,UAAU;IAChBC,QAAQ,EAAER,QAAQ,GAAG,CAAC,GAAGS,SAAS;IAClC,IAAIN,gBAAgB,GAAGC,YAAY,CAACM,iBAAiB,CAACX,QAAQ,CAAC,GAAG,EAAE,CAAC;IACrE,GAAGF;GACJ,EACDC,GAAG,CACJ;AACH,CAAC","names":["useTableCell_unstable","useDataGridContext_unstable","useColumnIdContext","useDataGridCell_unstable","props","ref","columnId","tabbable","ctx","focusMode","resizableColumns","columnSizing","columnSizing_unstable","as","role","tabIndex","undefined","getTableCellProps"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridCell/useDataGridCell.ts"],"sourcesContent":["import * as React from 'react';\nimport type { DataGridCellProps, DataGridCellState } from './DataGridCell.types';\nimport { useTableCell_unstable } from '../TableCell/useTableCell';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useColumnIdContext } from '../../contexts/columnIdContext';\n\n/**\n * Create the state required to render DataGridCell.\n *\n * The returned state can be modified with hooks such as useDataGridCellStyles_unstable,\n * before being passed to renderDataGridCell_unstable.\n *\n * @param props - props from this instance of DataGridCell\n * @param ref - reference to root HTMLElement of DataGridCell\n */\nexport const useDataGridCell_unstable = (props: DataGridCellProps, ref: React.Ref<HTMLElement>): DataGridCellState => {\n const columnId = useColumnIdContext();\n const tabbable = useDataGridContext_unstable(ctx => ctx.focusMode === 'cell');\n const resizableColumns = useDataGridContext_unstable(ctx => ctx.resizableColumns);\n const columnSizing = useDataGridContext_unstable(ctx => ctx.columnSizing_unstable);\n return useTableCell_unstable(\n {\n as: 'div',\n role: 'gridcell',\n tabIndex: tabbable ? 0 : undefined,\n ...(resizableColumns ? columnSizing.getTableCellProps(columnId) : {}),\n ...props,\n },\n ref,\n );\n};\n"]}
|
|
@@ -19,6 +19,8 @@ export const useDataGridHeaderCell_unstable = (props, ref) => {
|
|
|
19
19
|
} = useTableContext();
|
|
20
20
|
const toggleColumnSort = useDataGridContext_unstable(ctx => ctx.sort.toggleColumnSort);
|
|
21
21
|
const sortDirection = useDataGridContext_unstable(ctx => sortable ? ctx.sort.getSortDirection(columnId) : undefined);
|
|
22
|
+
const resizableColumns = useDataGridContext_unstable(ctx => ctx.resizableColumns);
|
|
23
|
+
const columnSizing = useDataGridContext_unstable(ctx => ctx.columnSizing_unstable);
|
|
22
24
|
const onClick = useEventCallback(e => {
|
|
23
25
|
var _a;
|
|
24
26
|
if (sortable) {
|
|
@@ -30,6 +32,7 @@ export const useDataGridHeaderCell_unstable = (props, ref) => {
|
|
|
30
32
|
sortDirection,
|
|
31
33
|
as: 'div',
|
|
32
34
|
tabIndex: sortable ? undefined : 0,
|
|
35
|
+
...(resizableColumns ? columnSizing.getTableHeaderCellProps(columnId) : {}),
|
|
33
36
|
...props,
|
|
34
37
|
onClick
|
|
35
38
|
}, ref);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AACA,SAASA,gBAAgB,QAAQ,2BAA2B;AAE5D,SAASC,2BAA2B,QAAQ,uCAAuC;AACnF,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,eAAe,QAAQ,6BAA6B;AAE7D;;;;;;;;;AASA,OAAO,MAAMC,8BAA8B,GAAG,CAC5CC,KAA8B,EAC9BC,GAA2B,KACA;EAC3B,MAAMC,QAAQ,GAAGL,kBAAkB,EAAE;EACrC,MAAM;IAAEM;EAAQ,CAAE,GAAGL,eAAe,EAAE;EACtC,MAAMM,gBAAgB,GAAGR,2BAA2B,CAACS,GAAG,IAAIA,GAAG,CAACC,IAAI,CAACF,gBAAgB,CAAC;EACtF,MAAMG,aAAa,GAAGX,2BAA2B,CAACS,GAAG,IACnDF,QAAQ,GAAGE,GAAG,CAACC,IAAI,CAACE,gBAAgB,CAACN,QAAQ,CAAC,GAAGO,SAAS,CAC3D;
|
|
1
|
+
{"version":3,"mappings":"AACA,SAASA,gBAAgB,QAAQ,2BAA2B;AAE5D,SAASC,2BAA2B,QAAQ,uCAAuC;AACnF,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,eAAe,QAAQ,6BAA6B;AAE7D;;;;;;;;;AASA,OAAO,MAAMC,8BAA8B,GAAG,CAC5CC,KAA8B,EAC9BC,GAA2B,KACA;EAC3B,MAAMC,QAAQ,GAAGL,kBAAkB,EAAE;EACrC,MAAM;IAAEM;EAAQ,CAAE,GAAGL,eAAe,EAAE;EACtC,MAAMM,gBAAgB,GAAGR,2BAA2B,CAACS,GAAG,IAAIA,GAAG,CAACC,IAAI,CAACF,gBAAgB,CAAC;EACtF,MAAMG,aAAa,GAAGX,2BAA2B,CAACS,GAAG,IACnDF,QAAQ,GAAGE,GAAG,CAACC,IAAI,CAACE,gBAAgB,CAACN,QAAQ,CAAC,GAAGO,SAAS,CAC3D;EAED,MAAMC,gBAAgB,GAAGd,2BAA2B,CAACS,GAAG,IAAIA,GAAG,CAACK,gBAAgB,CAAC;EACjF,MAAMC,YAAY,GAAGf,2BAA2B,CAACS,GAAG,IAAIA,GAAG,CAACO,qBAAqB,CAAC;EAElF,MAAMC,OAAO,GAAGnB,gBAAgB,CAAEoB,CAA+C,IAAI;;IACnF,IAAIX,QAAQ,EAAE;MACZC,gBAAgB,CAACU,CAAC,EAAEZ,QAAQ,CAAC;;IAE/B,WAAK,CAACW,OAAO,+CAAbb,KAAK,EAAWc,CAAC,CAAC;EACpB,CAAC,CAAC;EAEF,OAAOnB,2BAA2B,CAChC;IACEY,aAAa;IACbQ,EAAE,EAAE,KAAK;IACTC,QAAQ,EAAEb,QAAQ,GAAGM,SAAS,GAAG,CAAC;IAClC,IAAIC,gBAAgB,GAAGC,YAAY,CAACM,uBAAuB,CAACf,QAAQ,CAAC,GAAG,EAAE,CAAC;IAC3E,GAAGF,KAAK;IACRa;GACD,EACDZ,GAAG,CACJ;AACH,CAAC","names":["useEventCallback","useTableHeaderCell_unstable","useDataGridContext_unstable","useColumnIdContext","useTableContext","useDataGridHeaderCell_unstable","props","ref","columnId","sortable","toggleColumnSort","ctx","sort","sortDirection","getSortDirection","undefined","resizableColumns","columnSizing","columnSizing_unstable","onClick","e","as","tabIndex","getTableHeaderCellProps"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridHeaderCell/useDataGridHeaderCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport type { DataGridHeaderCellProps, DataGridHeaderCellState } from './DataGridHeaderCell.types';\nimport { useTableHeaderCell_unstable } from '../TableHeaderCell/useTableHeaderCell';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useColumnIdContext } from '../../contexts/columnIdContext';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render DataGridHeaderCell.\n *\n * The returned state can be modified with hooks such as useDataGridHeaderCellStyles_unstable,\n * before being passed to renderDataGridHeaderCell_unstable.\n *\n * @param props - props from this instance of DataGridHeaderCell\n * @param ref - reference to root HTMLElement of DataGridHeaderCell\n */\nexport const useDataGridHeaderCell_unstable = (\n props: DataGridHeaderCellProps,\n ref: React.Ref<HTMLElement>,\n): DataGridHeaderCellState => {\n const columnId = useColumnIdContext();\n const { sortable } = useTableContext();\n const toggleColumnSort = useDataGridContext_unstable(ctx => ctx.sort.toggleColumnSort);\n const sortDirection = useDataGridContext_unstable(ctx =>\n sortable ? ctx.sort.getSortDirection(columnId) : undefined,\n );\n\n const resizableColumns = useDataGridContext_unstable(ctx => ctx.resizableColumns);\n const columnSizing = useDataGridContext_unstable(ctx => ctx.columnSizing_unstable);\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableHeaderCellElement>) => {\n if (sortable) {\n toggleColumnSort(e, columnId);\n }\n props.onClick?.(e);\n });\n\n return useTableHeaderCell_unstable(\n {\n sortDirection,\n as: 'div',\n tabIndex: sortable ? undefined : 0,\n ...(resizableColumns ? columnSizing.getTableHeaderCellProps(columnId) : {}),\n ...props,\n onClick,\n },\n ref,\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCellLayout.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/TableCellLayout/TableCellLayout.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { AvatarSize } from '@fluentui/react-avatar';\nimport { TableContextValue } from '../Table/Table.types';\n\nexport type TableCellLayoutContextValues = {\n avatar: {\n size?: AvatarSize;\n };\n};\n\nexport type TableCellLayoutSlots = {\n root: Slot<'div'>;\n\n /**\n * Slot for an icon or other visual element\n */\n media: Slot<'span'>;\n\n /**\n * Main text for the table cell. Children of the root slot are automatically rendered here\n */\n main: Slot<'span'>;\n\n /**\n * Secondary text that describes or complements the main text\n */\n description: Slot<'span'>;\n\n /**\n * A layout wrapper for the main and description slots\n */\n content: Slot<'div'>;\n};\n\n/**\n * TableCellLayout Props\n */\nexport type TableCellLayoutProps = ComponentProps<Partial<TableCellLayoutSlots>> & {\n /**\n * Renders design variants of the table cell\n * @default undefined\n */\n appearance?: 'primary';\n};\n\n/**\n * State used in rendering TableCellLayout\n */\nexport type TableCellLayoutState = ComponentState<TableCellLayoutSlots> &\n Pick<TableCellLayoutProps, 'appearance'> & { avatarSize: AvatarSize | undefined } & Pick
|
|
1
|
+
{"version":3,"file":"TableCellLayout.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/TableCellLayout/TableCellLayout.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { AvatarSize } from '@fluentui/react-avatar';\nimport { TableContextValue } from '../Table/Table.types';\n\nexport type TableCellLayoutContextValues = {\n avatar: {\n size?: AvatarSize;\n };\n};\n\nexport type TableCellLayoutSlots = {\n root: Slot<'div'>;\n\n /**\n * Slot for an icon or other visual element\n */\n media: Slot<'span'>;\n\n /**\n * Main text for the table cell. Children of the root slot are automatically rendered here\n */\n main: Slot<'span'>;\n\n /**\n * Secondary text that describes or complements the main text\n */\n description: Slot<'span'>;\n\n /**\n * A layout wrapper for the main and description slots\n */\n content: Slot<'div'>;\n};\n\n/**\n * TableCellLayout Props\n */\nexport type TableCellLayoutProps = ComponentProps<Partial<TableCellLayoutSlots>> & {\n /**\n * Renders design variants of the table cell\n * @default undefined\n */\n appearance?: 'primary';\n\n /**\n * Renders content with overflow: hidden and text-overflow: ellipsis\n */\n truncate?: boolean;\n};\n\n/**\n * State used in rendering TableCellLayout\n */\nexport type TableCellLayoutState = ComponentState<TableCellLayoutSlots> &\n Pick<TableCellLayoutProps, 'appearance' | 'truncate'> & { avatarSize: AvatarSize | undefined } & Pick<\n TableContextValue,\n 'size'\n >;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AACA,SAASA,qBAAqB,EAAEC,gBAAgB,QAAQ,2BAA2B;AAEnF,SAASC,eAAe,QAAQ,6BAA6B;AAE7D,MAAMC,kBAAkB,GAAG;EACzBC,MAAM,EAAE,EAAE;EACVC,KAAK,EAAE,EAAE;EACT,aAAa,EAAE;CACP;AAEV;;;;;;;;;AASA,OAAO,MAAMC,2BAA2B,GAAG,CACzCC,KAA2B,EAC3BC,GAA2B,KACH;EACxB,MAAM;IAAEC;EAAI,CAAE,GAAGP,eAAe,EAAE;EAElC,OAAO;IACLQ,UAAU,EAAE;MACVC,IAAI,EAAE,KAAK;MACXC,IAAI,EAAE,MAAM;MACZC,WAAW,EAAE,MAAM;MACnBC,OAAO,EAAE,KAAK;MACdC,KAAK,EAAE;KACR;IACDJ,IAAI,EAAEX,qBAAqB,CAAC,KAAK,EAAE;MAAEQ,GAAG;MAAE,GAAGD;IAAK,CAAE,CAAC;IACrDS,UAAU,EAAET,KAAK,CAACS,UAAU;
|
|
1
|
+
{"version":3,"mappings":"AACA,SAASA,qBAAqB,EAAEC,gBAAgB,QAAQ,2BAA2B;AAEnF,SAASC,eAAe,QAAQ,6BAA6B;AAE7D,MAAMC,kBAAkB,GAAG;EACzBC,MAAM,EAAE,EAAE;EACVC,KAAK,EAAE,EAAE;EACT,aAAa,EAAE;CACP;AAEV;;;;;;;;;AASA,OAAO,MAAMC,2BAA2B,GAAG,CACzCC,KAA2B,EAC3BC,GAA2B,KACH;EACxB,MAAM;IAAEC;EAAI,CAAE,GAAGP,eAAe,EAAE;EAElC,OAAO;IACLQ,UAAU,EAAE;MACVC,IAAI,EAAE,KAAK;MACXC,IAAI,EAAE,MAAM;MACZC,WAAW,EAAE,MAAM;MACnBC,OAAO,EAAE,KAAK;MACdC,KAAK,EAAE;KACR;IACDJ,IAAI,EAAEX,qBAAqB,CAAC,KAAK,EAAE;MAAEQ,GAAG;MAAE,GAAGD;IAAK,CAAE,CAAC;IACrDS,UAAU,EAAET,KAAK,CAACS,UAAU;IAC5BC,QAAQ,EAAEV,KAAK,CAACU,QAAQ;IACxBL,IAAI,EAAEX,gBAAgB,CAACM,KAAK,CAACK,IAAI,EAAE;MAAEM,QAAQ,EAAE;IAAI,CAAE,CAAC;IACtDH,KAAK,EAAEd,gBAAgB,CAACM,KAAK,CAACQ,KAAK,CAAC;IACpCF,WAAW,EAAEZ,gBAAgB,CAACM,KAAK,CAACM,WAAW,CAAC;IAChDC,OAAO,EAAEb,gBAAgB,CAACM,KAAK,CAACO,OAAO,EAAE;MAAEI,QAAQ,EAAE,CAAC,CAACX,KAAK,CAACM,WAAW,IAAI,CAAC,CAACN,KAAK,CAACY;IAAQ,CAAE,CAAC;IAC/FC,UAAU,EAAEjB,kBAAkB,CAACM,IAAI,CAAC;IACpCA;GACD;AACH,CAAC","names":["getNativeElementProps","resolveShorthand","useTableContext","tableAvatarSizeMap","medium","small","useTableCellLayout_unstable","props","ref","size","components","root","main","description","content","media","appearance","truncate","required","children","avatarSize"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/TableCellLayout/useTableCellLayout.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';\nimport type { TableCellLayoutProps, TableCellLayoutState } from './TableCellLayout.types';\nimport { useTableContext } from '../../contexts/tableContext';\n\nconst tableAvatarSizeMap = {\n medium: 32,\n small: 24,\n 'extra-small': 20,\n} as const;\n\n/**\n * Create the state required to render TableCellLayout.\n *\n * The returned state can be modified with hooks such as useTableCellLayoutStyles_unstable,\n * before being passed to renderTableCellLayout_unstable.\n *\n * @param props - props from this instance of TableCellLayout\n * @param ref - reference to root HTMLElement of TableCellLayout\n */\nexport const useTableCellLayout_unstable = (\n props: TableCellLayoutProps,\n ref: React.Ref<HTMLElement>,\n): TableCellLayoutState => {\n const { size } = useTableContext();\n\n return {\n components: {\n root: 'div',\n main: 'span',\n description: 'span',\n content: 'div',\n media: 'span',\n },\n root: getNativeElementProps('div', { ref, ...props }),\n appearance: props.appearance,\n truncate: props.truncate,\n main: resolveShorthand(props.main, { required: true }),\n media: resolveShorthand(props.media),\n description: resolveShorthand(props.description),\n content: resolveShorthand(props.content, { required: !!props.description || !!props.children }),\n avatarSize: tableAvatarSizeMap[size],\n size,\n };\n};\n"]}
|
|
@@ -21,10 +21,16 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
21
21
|
Bnnss6s: "f1neuvcm",
|
|
22
22
|
xawz: "fkjuxzh"
|
|
23
23
|
},
|
|
24
|
+
rootTruncate: {
|
|
25
|
+
B68tc82: "f1p9o1ba"
|
|
26
|
+
},
|
|
24
27
|
content: {
|
|
25
28
|
mc9l5x: "f22iagw",
|
|
26
29
|
Beiy3e4: "f1vx9l62"
|
|
27
30
|
},
|
|
31
|
+
contentTruncate: {
|
|
32
|
+
B68tc82: "f1p9o1ba"
|
|
33
|
+
},
|
|
28
34
|
media: {
|
|
29
35
|
mc9l5x: "f22iagw",
|
|
30
36
|
Bt984gj: "f122n59"
|
|
@@ -41,6 +47,11 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
41
47
|
mainPrimary: {
|
|
42
48
|
Bhrd7zp: "fl43uef"
|
|
43
49
|
},
|
|
50
|
+
mainTruncate: {
|
|
51
|
+
B68tc82: "f1p9o1ba",
|
|
52
|
+
Huce71: "fz5stix",
|
|
53
|
+
ygn44y: "f1cmbuwj"
|
|
54
|
+
},
|
|
44
55
|
description: {
|
|
45
56
|
sj55zd: "fkfq4zb",
|
|
46
57
|
Bahqtrf: "fk6fouc",
|
|
@@ -49,14 +60,17 @@ const useStyles = /*#__PURE__*/__styles({
|
|
|
49
60
|
Bg96gwp: "fwrc4pm"
|
|
50
61
|
}
|
|
51
62
|
}, {
|
|
52
|
-
d: [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".fsnqrgy{-webkit-column-gap:var(--spacingHorizontalS);column-gap:var(--spacingHorizontalS);}", ".fylz90v{row-gap:var(--spacingHorizontalS);}", ".fqerorx{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".f1neuvcm{-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;}", ".fkjuxzh{-webkit-flex-basis:0px;-ms-flex-preferred-size:0px;flex-basis:0px;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f4ybsrx{font-size:16px;}", ".fe5j1ua{font-size:20px;}", ".f1rt2boy{font-size:24px;}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}"]
|
|
63
|
+
d: [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".fsnqrgy{-webkit-column-gap:var(--spacingHorizontalS);column-gap:var(--spacingHorizontalS);}", ".fylz90v{row-gap:var(--spacingHorizontalS);}", ".fqerorx{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".f1neuvcm{-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;}", ".fkjuxzh{-webkit-flex-basis:0px;-ms-flex-preferred-size:0px;flex-basis:0px;}", ".f1p9o1ba{overflow-x:hidden;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f4ybsrx{font-size:16px;}", ".fe5j1ua{font-size:20px;}", ".f1rt2boy{font-size:24px;}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".fz5stix{white-space:nowrap;}", ".f1cmbuwj{text-overflow:ellipsis;}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}"]
|
|
53
64
|
});
|
|
54
65
|
/**
|
|
55
66
|
* Apply styling to the TableCellLayout slots based on the state
|
|
56
67
|
*/
|
|
57
68
|
export const useTableCellLayoutStyles_unstable = state => {
|
|
58
69
|
const styles = useStyles();
|
|
59
|
-
|
|
70
|
+
const {
|
|
71
|
+
truncate
|
|
72
|
+
} = state;
|
|
73
|
+
state.root.className = mergeClasses(tableCellLayoutClassNames.root, styles.root, truncate && styles.rootTruncate, state.root.className);
|
|
60
74
|
const primary = state.appearance === 'primary';
|
|
61
75
|
if (state.media) {
|
|
62
76
|
const mediaSizedStyles = {
|
|
@@ -67,13 +81,13 @@ export const useTableCellLayoutStyles_unstable = state => {
|
|
|
67
81
|
state.media.className = mergeClasses(tableCellLayoutClassNames.media, styles.media, mediaSizedStyles[state.size], primary && styles.mediaPrimary, state.media.className);
|
|
68
82
|
}
|
|
69
83
|
if (state.main) {
|
|
70
|
-
state.main.className = mergeClasses(tableCellLayoutClassNames.main, primary && styles.mainPrimary, state.main.className);
|
|
84
|
+
state.main.className = mergeClasses(tableCellLayoutClassNames.main, truncate && styles.mainTruncate, primary && styles.mainPrimary, state.main.className);
|
|
71
85
|
}
|
|
72
86
|
if (state.description) {
|
|
73
87
|
state.description.className = mergeClasses(tableCellLayoutClassNames.description, styles.description, state.description.className);
|
|
74
88
|
}
|
|
75
89
|
if (state.content) {
|
|
76
|
-
state.content.className = mergeClasses(tableCellLayoutClassNames.content, styles.content, state.content.className);
|
|
90
|
+
state.content.className = mergeClasses(tableCellLayoutClassNames.content, styles.content, truncate && styles.contentTruncate, state.content.className);
|
|
77
91
|
}
|
|
78
92
|
return state;
|
|
79
93
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,mBAAqBA,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,SAASC,MAAM,QAAQ,uBAAuB;AAG9C,SAASC,gBAAgB,QAAQ,uBAAuB;AAExD,OAAO,MAAMC,yBAAyB,GAAyC;EAC7EC,IAAI,EAAE,qBAAqB;EAC3BC,KAAK,EAAE,4BAA4B;EACnCC,IAAI,EAAE,2BAA2B;EACjCC,WAAW,EAAE,kCAAkC;EAC/CC,OAAO,EAAE;CACV;AAED;;;AAGA,MAAMC,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,
|
|
1
|
+
{"version":3,"mappings":"AAAA,mBAAqBA,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,SAASC,MAAM,QAAQ,uBAAuB;AAG9C,SAASC,gBAAgB,QAAQ,uBAAuB;AAExD,OAAO,MAAMC,yBAAyB,GAAyC;EAC7EC,IAAI,EAAE,qBAAqB;EAC3BC,KAAK,EAAE,4BAA4B;EACnCC,IAAI,EAAE,2BAA2B;EACjCC,WAAW,EAAE,kCAAkC;EAC/CC,OAAO,EAAE;CACV;AAED;;;AAGA,MAAMC,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAoDhB;AAEF;;;AAGA,OAAO,MAAMC,iCAAiC,GAAIC,KAA2B,IAA0B;EACrG,MAAMC,MAAM,GAAGH,SAAS,EAAE;EAC1B,MAAM;IAAEI;EAAQ,CAAE,GAAGF,KAAK;EAE1BA,KAAK,CAACP,IAAI,CAACU,SAAS,GAAGf,YAAY,CACjCI,yBAAyB,CAACC,IAAI,EAC9BQ,MAAM,CAACR,IAAI,EACXS,QAAQ,IAAID,MAAM,CAACG,YAAY,EAC/BJ,KAAK,CAACP,IAAI,CAACU,SAAS,CACrB;EACD,MAAME,OAAO,GAAGL,KAAK,CAACM,UAAU,KAAK,SAAS;EAE9C,IAAIN,KAAK,CAACN,KAAK,EAAE;IACf,MAAMa,gBAAgB,GAAG;MACvBC,KAAK,EAAEP,MAAM,CAACQ,mBAAmB;MACjCC,MAAM,EAAET,MAAM,CAACQ,mBAAmB;MAClC,aAAa,EAAER,MAAM,CAACU;KACvB;IAEDX,KAAK,CAACN,KAAK,CAACS,SAAS,GAAGf,YAAY,CAClCI,yBAAyB,CAACE,KAAK,EAC/BO,MAAM,CAACP,KAAK,EACZa,gBAAgB,CAACP,KAAK,CAACY,IAAI,CAAC,EAC5BP,OAAO,IAAIJ,MAAM,CAACY,YAAY,EAC9Bb,KAAK,CAACN,KAAK,CAACS,SAAS,CACtB;;EAGH,IAAIH,KAAK,CAACL,IAAI,EAAE;IACdK,KAAK,CAACL,IAAI,CAACQ,SAAS,GAAGf,YAAY,CACjCI,yBAAyB,CAACG,IAAI,EAC9BO,QAAQ,IAAID,MAAM,CAACa,YAAY,EAC/BT,OAAO,IAAIJ,MAAM,CAACc,WAAW,EAC7Bf,KAAK,CAACL,IAAI,CAACQ,SAAS,CACrB;;EAGH,IAAIH,KAAK,CAACJ,WAAW,EAAE;IACrBI,KAAK,CAACJ,WAAW,CAACO,SAAS,GAAGf,YAAY,CACxCI,yBAAyB,CAACI,WAAW,EACrCK,MAAM,CAACL,WAAW,EAClBI,KAAK,CAACJ,WAAW,CAACO,SAAS,CAC5B;;EAGH,IAAIH,KAAK,CAACH,OAAO,EAAE;IACjBG,KAAK,CAACH,OAAO,CAACM,SAAS,GAAGf,YAAY,CACpCI,yBAAyB,CAACK,OAAO,EACjCI,MAAM,CAACJ,OAAO,EACdK,QAAQ,IAAID,MAAM,CAACe,eAAe,EAClChB,KAAK,CAACH,OAAO,CAACM,SAAS,CACxB;;EAGH,OAAOH,KAAK;AACd,CAAC","names":["mergeClasses","shorthands","tokens","typographyStyles","tableCellLayoutClassNames","root","media","main","description","content","useStyles","useTableCellLayoutStyles_unstable","state","styles","truncate","className","rootTruncate","primary","appearance","mediaSizedStyles","small","mediaSmallAndMedium","medium","mediaExtraSmall","size","mediaPrimary","mainTruncate","mainPrimary","contentTruncate"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/TableCellLayout/useTableCellLayoutStyles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { TableCellLayoutSlots, TableCellLayoutState } from './TableCellLayout.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { typographyStyles } from '@fluentui/react-theme';\n\nexport const tableCellLayoutClassNames: SlotClassNames<TableCellLayoutSlots> = {\n root: 'fui-TableCellLayout',\n media: 'fui-TableCellLayout__media',\n main: 'fui-TableCellLayout__main',\n description: 'fui-TableCellLayout__description',\n content: 'fui-TableCellLayout__content',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n ...shorthands.gap(tokens.spacingHorizontalS),\n ...shorthands.flex(1, 1, '0px'),\n },\n\n rootTruncate: {\n overflowX: 'hidden',\n },\n\n content: {\n display: 'flex',\n flexDirection: 'column',\n },\n\n contentTruncate: {\n overflowX: 'hidden',\n },\n\n media: {\n display: 'flex',\n alignItems: 'center',\n },\n\n mediaExtraSmall: {\n fontSize: '16px',\n },\n\n mediaSmallAndMedium: {\n fontSize: '20px',\n },\n\n mediaPrimary: {\n fontSize: '24px',\n },\n\n mainPrimary: {\n fontWeight: tokens.fontWeightSemibold,\n },\n\n mainTruncate: {\n overflowX: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n },\n\n description: {\n color: tokens.colorNeutralForeground2,\n ...typographyStyles.caption1,\n },\n});\n\n/**\n * Apply styling to the TableCellLayout slots based on the state\n */\nexport const useTableCellLayoutStyles_unstable = (state: TableCellLayoutState): TableCellLayoutState => {\n const styles = useStyles();\n const { truncate } = state;\n\n state.root.className = mergeClasses(\n tableCellLayoutClassNames.root,\n styles.root,\n truncate && styles.rootTruncate,\n state.root.className,\n );\n const primary = state.appearance === 'primary';\n\n if (state.media) {\n const mediaSizedStyles = {\n small: styles.mediaSmallAndMedium,\n medium: styles.mediaSmallAndMedium,\n 'extra-small': styles.mediaExtraSmall,\n };\n\n state.media.className = mergeClasses(\n tableCellLayoutClassNames.media,\n styles.media,\n mediaSizedStyles[state.size],\n primary && styles.mediaPrimary,\n state.media.className,\n );\n }\n\n if (state.main) {\n state.main.className = mergeClasses(\n tableCellLayoutClassNames.main,\n truncate && styles.mainTruncate,\n primary && styles.mainPrimary,\n state.main.className,\n );\n }\n\n if (state.description) {\n state.description.className = mergeClasses(\n tableCellLayoutClassNames.description,\n styles.description,\n state.description.className,\n );\n }\n\n if (state.content) {\n state.content.className = mergeClasses(\n tableCellLayoutClassNames.content,\n styles.content,\n truncate && styles.contentTruncate,\n state.content.className,\n );\n }\n\n return state;\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __styles, mergeClasses, shorthands } from '@griffel/react';
|
|
2
2
|
import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
|
|
3
3
|
import { tokens } from '@fluentui/react-theme';
|
|
4
|
+
export const CELL_WIDTH = 44;
|
|
4
5
|
export const tableSelectionCellClassNames = {
|
|
5
6
|
root: 'fui-TableSelectionCell',
|
|
6
7
|
checkboxIndicator: 'fui-TableSelectionCell__checkboxIndicator',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,mBAAqBA,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AAGrE,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,MAAM,QAAQ,uBAAuB;AAE9C,OAAO,MAAMC,4BAA4B,GAA4C;EACnFC,IAAI,EAAE,wBAAwB;EAC9BC,iBAAiB,EAAE,2CAA2C;EAC9DC,cAAc,EAAE;CACjB;AAED,MAAMC,oBAAoB,gBAAG;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAK3B;AAEF,MAAMC,mBAAmB,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAQ1B;AAEF;;;AAGA,MAAMC,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;EAAA;EAAA;AAAA,EAkChB;AAEF;;;AAGA,OAAO,MAAMC,oCAAoC,GAAIC,KAA8B,IAA6B;EAC9G,MAAMC,MAAM,GAAGH,SAAS,EAAE;EAC1B,MAAMI,YAAY,GAAG;IACnBC,KAAK,EAAEP,oBAAoB,EAAE;IAC7BQ,IAAI,EAAEP,mBAAmB;GAC1B;EACDG,KAAK,CAACP,IAAI,CAACY,SAAS,
|
|
1
|
+
{"version":3,"mappings":"AAAA,mBAAqBA,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AAGrE,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,MAAM,QAAQ,uBAAuB;AAE9C,OAAO,MAAMC,UAAU,GAAG,EAAE;AAE5B,OAAO,MAAMC,4BAA4B,GAA4C;EACnFC,IAAI,EAAE,wBAAwB;EAC9BC,iBAAiB,EAAE,2CAA2C;EAC9DC,cAAc,EAAE;CACjB;AAED,MAAMC,oBAAoB,gBAAG;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAK3B;AAEF,MAAMC,mBAAmB,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAQ1B;AAEF;;;AAGA,MAAMC,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;EAAA;EAAA;AAAA,EAkChB;AAEF;;;AAGA,OAAO,MAAMC,oCAAoC,GAAIC,KAA8B,IAA6B;EAC9G,MAAMC,MAAM,GAAGH,SAAS,EAAE;EAC1B,MAAMI,YAAY,GAAG;IACnBC,KAAK,EAAEP,oBAAoB,EAAE;IAC7BQ,IAAI,EAAEP,mBAAmB;GAC1B;EACDG,KAAK,CAACP,IAAI,CAACY,SAAS,GAAGlB,YAAY,CACjCK,4BAA4B,CAACC,IAAI,EACjCQ,MAAM,CAACR,IAAI,EACXO,KAAK,CAACM,gBAAgB,GAAGJ,YAAY,CAACE,IAAI,CAACX,IAAI,GAAGS,YAAY,CAACC,KAAK,CAACV,IAAI,EACzEO,KAAK,CAACO,MAAM,IAAIP,KAAK,CAACQ,OAAO,KAAK,KAAK,IAAIP,MAAM,CAACM,MAAM,EACxDP,KAAK,CAACS,MAAM,IAAIR,MAAM,CAACQ,MAAM,EAC7BT,KAAK,CAACP,IAAI,CAACY,SAAS,CACrB;EACD,IAAIL,KAAK,CAACN,iBAAiB,EAAE;IAC3BM,KAAK,CAACN,iBAAiB,CAACW,SAAS,GAAGlB,YAAY,CAC9CK,4BAA4B,CAACE,iBAAiB,EAC9CM,KAAK,CAACN,iBAAiB,CAACW,SAAS,CAClC;;EAGH,IAAIL,KAAK,CAACL,cAAc,EAAE;IACxBK,KAAK,CAACL,cAAc,CAACU,SAAS,GAAGlB,YAAY,CAC3CK,4BAA4B,CAACG,cAAc,EAC3CM,MAAM,CAACN,cAAc,EACrBK,KAAK,CAACL,cAAc,CAACU,SAAS,CAC/B;;EAGH,OAAOL,KAAK;AACd,CAAC","names":["mergeClasses","shorthands","createCustomFocusIndicatorStyle","tokens","CELL_WIDTH","tableSelectionCellClassNames","root","checkboxIndicator","radioIndicator","useTableLayoutStyles","useFlexLayoutStyles","useStyles","useTableSelectionCellStyles_unstable","state","styles","layoutStyles","table","flex","className","noNativeElements","subtle","checked","hidden"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/TableSelectionCell/useTableSelectionCellStyles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { TableSelectionCellSlots, TableSelectionCellState } from './TableSelectionCell.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\n\nexport const CELL_WIDTH = 44;\n\nexport const tableSelectionCellClassNames: SlotClassNames<TableSelectionCellSlots> = {\n root: 'fui-TableSelectionCell',\n checkboxIndicator: 'fui-TableSelectionCell__checkboxIndicator',\n radioIndicator: 'fui-TableSelectionCell__radioIndicator',\n};\n\nconst useTableLayoutStyles = makeStyles({\n root: {\n display: 'table-cell',\n width: `${CELL_WIDTH}px`,\n },\n});\n\nconst useFlexLayoutStyles = makeStyles({\n root: {\n display: 'flex',\n ...shorthands.flex(1, 1, '0px'),\n minWidth: `${CELL_WIDTH}px`,\n maxWidth: `${CELL_WIDTH}px`,\n justifyContent: 'center',\n },\n});\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n textAlign: 'center',\n whiteSpace: 'nowrap',\n ...shorthands.padding(0),\n ...createCustomFocusIndicatorStyle(\n {\n ...shorthands.outline('2px', 'solid', tokens.colorStrokeFocus2),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n },\n { selector: 'focus', enableOutline: true },\n ),\n },\n\n radioIndicator: {\n display: 'flex',\n flexGrow: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n\n subtle: {\n opacity: 0,\n ...createCustomFocusIndicatorStyle(\n {\n opacity: 1,\n },\n { selector: 'focus-within' },\n ),\n },\n\n hidden: {\n visibility: 'hidden',\n },\n});\n\n/**\n * Apply styling to the TableSelectionCell slots based on the state\n */\nexport const useTableSelectionCellStyles_unstable = (state: TableSelectionCellState): TableSelectionCellState => {\n const styles = useStyles();\n const layoutStyles = {\n table: useTableLayoutStyles(),\n flex: useFlexLayoutStyles(),\n };\n state.root.className = mergeClasses(\n tableSelectionCellClassNames.root,\n styles.root,\n state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root,\n state.subtle && state.checked === false && styles.subtle,\n state.hidden && styles.hidden,\n state.root.className,\n );\n if (state.checkboxIndicator) {\n state.checkboxIndicator.className = mergeClasses(\n tableSelectionCellClassNames.checkboxIndicator,\n state.checkboxIndicator.className,\n );\n }\n\n if (state.radioIndicator) {\n state.radioIndicator.className = mergeClasses(\n tableSelectionCellClassNames.radioIndicator,\n styles.radioIndicator,\n state.radioIndicator.className,\n );\n }\n\n return state;\n};\n"]}
|