@fluentui/react-table 9.0.0-alpha.12 → 9.0.0-alpha.13
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 +114 -1
- package/CHANGELOG.md +26 -2
- package/dist/index.d.ts +101 -51
- package/lib/components/DataGrid/DataGrid.types.js.map +1 -1
- package/lib/components/DataGrid/useDataGrid.js +27 -5
- package/lib/components/DataGrid/useDataGrid.js.map +1 -1
- package/lib/components/DataGrid/useDataGridContextValues.js +4 -1
- package/lib/components/DataGrid/useDataGridContextValues.js.map +1 -1
- package/lib/components/DataGridBody/useDataGridBody.js +12 -2
- package/lib/components/DataGridBody/useDataGridBody.js.map +1 -1
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js +24 -2
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -1
- package/lib/components/DataGridRow/DataGridRow.types.js.map +1 -1
- package/lib/components/DataGridRow/renderDataGridRow.js +9 -2
- package/lib/components/DataGridRow/renderDataGridRow.js.map +1 -1
- package/lib/components/DataGridRow/useDataGridRow.js +57 -4
- package/lib/components/DataGridRow/useDataGridRow.js.map +1 -1
- package/lib/components/DataGridRow/useDataGridRowStyles.js +7 -1
- package/lib/components/DataGridRow/useDataGridRowStyles.js.map +1 -1
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js +36 -1
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
- package/lib/components/Table/Table.types.js.map +1 -1
- package/lib/components/TableCell/TableCell.types.js.map +1 -1
- package/lib/components/TableCell/useTableCell.js +4 -2
- package/lib/components/TableCell/useTableCell.js.map +1 -1
- package/lib/components/TableCell/useTableCellStyles.js +31 -5
- package/lib/components/TableCell/useTableCellStyles.js.map +1 -1
- package/lib/components/TableCellActions/useTableCellActions.js +2 -3
- package/lib/components/TableCellActions/useTableCellActions.js.map +1 -1
- package/lib/components/TableCellActions/useTableCellActionsStyles.js +2 -8
- package/lib/components/TableCellActions/useTableCellActionsStyles.js.map +1 -1
- package/lib/components/TableCellLayout/TableCellLayout.types.js.map +1 -1
- package/lib/components/TableCellLayout/useTableCellLayout.js +3 -2
- package/lib/components/TableCellLayout/useTableCellLayout.js.map +1 -1
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js +20 -6
- package/lib/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
- package/lib/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -1
- package/lib/components/TableHeaderCell/useTableHeaderCell.js +6 -2
- package/lib/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js +6 -5
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
- package/lib/components/TableRow/TableRow.types.js.map +1 -1
- package/lib/components/TableRow/useTableRow.js +3 -2
- package/lib/components/TableRow/useTableRow.js.map +1 -1
- package/lib/components/TableRow/useTableRowStyles.js +18 -29
- package/lib/components/TableRow/useTableRowStyles.js.map +1 -1
- package/lib/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -1
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js +3 -5
- package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
- package/lib/contexts/columnIdContext.js +10 -0
- package/lib/contexts/columnIdContext.js.map +1 -0
- package/lib/contexts/dataGridContext.js +3 -0
- package/lib/contexts/dataGridContext.js.map +1 -1
- package/lib/contexts/rowIdContext.js +10 -0
- package/lib/contexts/rowIdContext.js.map +1 -0
- package/lib/hooks/index.js +3 -3
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/types.js.map +1 -1
- package/lib/hooks/{useTable.js → useTableFeatures.js} +4 -4
- package/lib/hooks/useTableFeatures.js.map +1 -0
- package/lib/hooks/{useSelection.js → useTableSelection.js} +10 -6
- package/lib/hooks/useTableSelection.js.map +1 -0
- package/lib/hooks/{useSort.js → useTableSort.js} +4 -4
- package/lib/hooks/useTableSort.js.map +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/DataGrid/useDataGrid.js +27 -5
- package/lib-commonjs/components/DataGrid/useDataGrid.js.map +1 -1
- package/lib-commonjs/components/DataGrid/useDataGridContextValues.js +4 -1
- package/lib-commonjs/components/DataGrid/useDataGridContextValues.js.map +1 -1
- package/lib-commonjs/components/DataGridBody/useDataGridBody.js +15 -2
- package/lib-commonjs/components/DataGridBody/useDataGridBody.js.map +1 -1
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js +28 -2
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -1
- package/lib-commonjs/components/DataGridRow/renderDataGridRow.js +10 -2
- package/lib-commonjs/components/DataGridRow/renderDataGridRow.js.map +1 -1
- package/lib-commonjs/components/DataGridRow/useDataGridRow.js +64 -4
- package/lib-commonjs/components/DataGridRow/useDataGridRow.js.map +1 -1
- package/lib-commonjs/components/DataGridRow/useDataGridRowStyles.js +7 -1
- package/lib-commonjs/components/DataGridRow/useDataGridRowStyles.js.map +1 -1
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js +40 -1
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
- package/lib-commonjs/components/TableCell/useTableCell.js +4 -2
- package/lib-commonjs/components/TableCell/useTableCell.js.map +1 -1
- package/lib-commonjs/components/TableCell/useTableCellStyles.js +32 -5
- package/lib-commonjs/components/TableCell/useTableCellStyles.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/useTableCellActions.js +1 -3
- package/lib-commonjs/components/TableCellActions/useTableCellActions.js.map +1 -1
- package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js +2 -9
- package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js +3 -2
- package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js.map +1 -1
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js +21 -6
- package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js +6 -2
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js +6 -5
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
- package/lib-commonjs/components/TableRow/useTableRow.js +2 -1
- package/lib-commonjs/components/TableRow/useTableRow.js.map +1 -1
- package/lib-commonjs/components/TableRow/useTableRowStyles.js +18 -29
- package/lib-commonjs/components/TableRow/useTableRowStyles.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js +3 -5
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
- package/lib-commonjs/contexts/columnIdContext.js +21 -0
- package/lib-commonjs/contexts/columnIdContext.js.map +1 -0
- package/lib-commonjs/contexts/dataGridContext.js +3 -0
- package/lib-commonjs/contexts/dataGridContext.js.map +1 -1
- package/lib-commonjs/contexts/rowIdContext.js +21 -0
- package/lib-commonjs/contexts/rowIdContext.js.map +1 -0
- package/lib-commonjs/hooks/index.js +3 -3
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/{useTable.js → useTableFeatures.js} +10 -10
- package/lib-commonjs/hooks/useTableFeatures.js.map +1 -0
- package/lib-commonjs/hooks/{useSelection.js → useTableSelection.js} +13 -9
- package/lib-commonjs/hooks/useTableSelection.js.map +1 -0
- package/lib-commonjs/hooks/{useSort.js → useTableSort.js} +7 -7
- package/lib-commonjs/hooks/useTableSort.js.map +1 -0
- package/lib-commonjs/index.js +7 -7
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +6 -6
- package/lib/hooks/useSelection.js.map +0 -1
- package/lib/hooks/useSort.js.map +0 -1
- package/lib/hooks/useTable.js.map +0 -1
- package/lib-commonjs/hooks/useSelection.js.map +0 -1
- package/lib-commonjs/hooks/useSort.js.map +0 -1
- package/lib-commonjs/hooks/useTable.js.map +0 -1
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/index.ts"],"names":[],"mappings":"AAAA,SAAS,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/index.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,EAA2B,iBAA3B,EAA8C,YAA9C,EAA4D,YAA5D,QAAgF,SAAhF;AAcA,SACE,SADF,EAEE,mBAFF,EAGE,kBAHF,EAIE,2BAJF,EAKE,qBALF,EAME,wBANF,QAOO,aAPP;AAUA,SACE,QADF,EAEE,kBAFF,EAGE,iBAHF,EAIE,0BAJF,EAKE,oBALF,EAME,uBANF,QAOO,YAPP;AAUA,SACE,SADF,EAEE,kBAFF,EAGE,mBAHF,EAIE,2BAJF,EAKE,qBALF,EAME,wBANF,QAOO,aAPP;AAUA,SACE,KADF,EAEE,cAFF,EAGE,eAHF,EAIE,uBAJF,EAKE,iBALF,EAME,oBANF,QAOO,SAPP;AAUA,SACE,WADF,EAEE,qBAFF,EAGE,oBAHF,EAIE,6BAJF,EAKE,uBALF,EAME,0BANF,QAOO,eAPP;AAUA,SACE,eADF,EAEE,wBAFF,EAGE,yBAHF,EAIE,iCAJF,EAKE,2BALF,EAME,8BANF,QAOO,mBAPP;AAUA,SAAS,oBAAT,EAA+B,eAA/B,QAAsD,yBAAtD;AACA,SACE,kBADF,EAEE,oCAFF,EAGE,8BAHF,EAIE,iCAJF,EAKE,4BALF,QAMO,sBANP;AASA,SACE,gBADF,EAEE,0BAFF,EAGE,kCAHF,EAIE,4BAJF,EAKE,+BALF,QAMO,oBANP;AASA,SACE,eADF,EAEE,yBAFF,EAGE,iCAHF,EAIE,2BAJF,EAKE,8BALF,QAMO,mBANP;AASA,SACE,YADF,EAEE,sBAFF,EAGE,8BAHF,EAIE,wBAJF,EAKE,2BALF,QAMO,gBANP;AASA,SACE,WADF,EAEE,qBAFF,EAGE,6BAHF,EAIE,uBAJF,EAKE,0BALF,QAMO,eANP;AASA,SACE,YADF,EAEE,sBAFF,EAGE,8BAHF,EAIE,wBAJF,EAKE,2BALF,QAMO,gBANP;AASA,SACE,QADF,EAEE,kBAFF,EAGE,0BAHF,EAIE,oBAJF,EAKE,uBALF,QAMO,YANP;AAgBA,SACE,cADF,EAEE,wBAFF,EAGE,gCAHF,EAIE,0BAJF,EAKE,6BALF,QAMO,kBANP;AASA,SACE,kBADF,EAEE,4BAFF,EAGE,oCAHF,EAIE,8BAJF,EAKE,iCALF,QAMO,sBANP;AASA,SACE,qBADF,EAEE,uCAFF,EAGE,iCAHF,EAIE,oCAJF,EAKE,+BALF,QAMO,yBANP","sourcesContent":["export { useTableFeatures, useTableSelection, useTableSort, createColumn } from './hooks';\nexport type {\n UseTableOptions,\n TableState as HeadlessTableState,\n TableSelectionState,\n TableSortState,\n TableStatePlugin,\n RowState,\n RowId,\n ColumnDefinition,\n ColumnId,\n CreateColumnOptions,\n} from './hooks';\n\nexport {\n TableCell,\n tableCellClassNames,\n tableCellClassName,\n useTableCellStyles_unstable,\n useTableCell_unstable,\n renderTableCell_unstable,\n} from './TableCell';\nexport type { TableCellProps, TableCellState, TableCellSlots } from './TableCell';\n\nexport {\n TableRow,\n tableRowClassNames,\n tableRowClassName,\n useTableRowStyles_unstable,\n useTableRow_unstable,\n renderTableRow_unstable,\n} from './TableRow';\nexport type { TableRowProps, TableRowState, TableRowSlots } from './TableRow';\n\nexport {\n TableBody,\n tableBodyClassName,\n tableBodyClassNames,\n useTableBodyStyles_unstable,\n useTableBody_unstable,\n renderTableBody_unstable,\n} from './TableBody';\nexport type { TableBodyProps, TableBodyState, TableBodySlots } from './TableBody';\n\nexport {\n Table,\n tableClassName,\n tableClassNames,\n useTableStyles_unstable,\n useTable_unstable,\n renderTable_unstable,\n} from './Table';\nexport type { TableProps, TableSlots, TableState, TableContextValue, TableContextValues, SortDirection } from './Table';\n\nexport {\n TableHeader,\n tableHeaderClassNames,\n tableHeaderClassName,\n useTableHeaderStyles_unstable,\n useTableHeader_unstable,\n renderTableHeader_unstable,\n} from './TableHeader';\nexport type { TableHeaderProps, TableHeaderSlots, TableHeaderState } from './TableHeader';\n\nexport {\n TableHeaderCell,\n tableHeaderCellClassName,\n tableHeaderCellClassNames,\n useTableHeaderCellStyles_unstable,\n useTableHeaderCell_unstable,\n renderTableHeaderCell_unstable,\n} from './TableHeaderCell';\nexport type { TableHeaderCellProps, TableHeaderCellSlots, TableHeaderCellState } from './TableHeaderCell';\n\nexport { TableContextProvider, useTableContext } from './contexts/tableContext';\nexport {\n TableSelectionCell,\n useTableSelectionCellStyles_unstable,\n useTableSelectionCell_unstable,\n renderTableSelectionCell_unstable,\n tableSelectionCellClassNames,\n} from './TableSelectionCell';\n\nexport type { TableSelectionCellProps, TableSelectionCellState, TableSelectionCellSlots } from './TableSelectionCell';\nexport {\n TableCellActions,\n tableCellActionsClassNames,\n useTableCellActionsStyles_unstable,\n useTableCellActions_unstable,\n renderTableCellActions_unstable,\n} from './TableCellActions';\n\nexport type { TableCellActionsProps, TableCellActionsSlots, TableCellActionsState } from './TableCellActions';\nexport {\n TableCellLayout,\n tableCellLayoutClassNames,\n useTableCellLayoutStyles_unstable,\n useTableCellLayout_unstable,\n renderTableCellLayout_unstable,\n} from './TableCellLayout';\nexport type { TableCellLayoutProps, TableCellLayoutSlots, TableCellLayoutState } from './TableCellLayout';\n\nexport {\n DataGridCell,\n dataGridCellClassNames,\n useDataGridCellStyles_unstable,\n useDataGridCell_unstable,\n renderDataGridCell_unstable,\n} from './DataGridCell';\nexport type { DataGridCellProps, DataGridCellState, DataGridCellSlots } from './DataGridCell';\n\nexport {\n DataGridRow,\n dataGridRowClassNames,\n useDataGridRowStyles_unstable,\n useDataGridRow_unstable,\n renderDataGridRow_unstable,\n} from './DataGridRow';\nexport type { DataGridRowProps, DataGridRowState, DataGridRowSlots, CellRenderFunction } from './DataGridRow';\n\nexport {\n DataGridBody,\n dataGridBodyClassNames,\n useDataGridBodyStyles_unstable,\n useDataGridBody_unstable,\n renderDataGridBody_unstable,\n} from './DataGridBody';\nexport type { DataGridBodyProps, DataGridBodyState, DataGridBodySlots, RowRenderFunction } from './DataGridBody';\n\nexport {\n DataGrid,\n dataGridClassNames,\n useDataGridStyles_unstable,\n useDataGrid_unstable,\n renderDataGrid_unstable,\n} from './DataGrid';\nexport type {\n DataGridProps,\n DataGridSlots,\n DataGridState,\n DataGridContextValues,\n DataGridContextValue,\n FocusMode,\n} from './DataGrid';\n\nexport {\n DataGridHeader,\n dataGridHeaderClassNames,\n useDataGridHeaderStyles_unstable,\n useDataGridHeader_unstable,\n renderDataGridHeader_unstable,\n} from './DataGridHeader';\nexport type { DataGridHeaderProps, DataGridHeaderSlots, DataGridHeaderState } from './DataGridHeader';\n\nexport {\n DataGridHeaderCell,\n dataGridHeaderCellClassNames,\n useDataGridHeaderCellStyles_unstable,\n useDataGridHeaderCell_unstable,\n renderDataGridHeaderCell_unstable,\n} from './DataGridHeaderCell';\nexport type { DataGridHeaderCellProps, DataGridHeaderCellSlots, DataGridHeaderCellState } from './DataGridHeaderCell';\n\nexport {\n DataGridSelectionCell,\n useDataGridSelectionCellStyles_unstable,\n useDataGridSelectionCell_unstable,\n renderDataGridSelectionCell_unstable,\n dataGridSelectionCellClassNames,\n} from './DataGridSelectionCell';\n\nexport type {\n DataGridSelectionCellProps,\n DataGridSelectionCellState,\n DataGridSelectionCellSlots,\n} from './DataGridSelectionCell';\n"],"sourceRoot":"../src/"}
|
|
@@ -9,7 +9,7 @@ const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
|
9
9
|
|
|
10
10
|
const useTable_1 = /*#__PURE__*/require("../Table/useTable");
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const hooks_1 = /*#__PURE__*/require("../../hooks");
|
|
13
13
|
/**
|
|
14
14
|
* Create the state required to render DataGrid.
|
|
15
15
|
*
|
|
@@ -25,25 +25,47 @@ const useDataGrid_unstable = (props, ref) => {
|
|
|
25
25
|
const {
|
|
26
26
|
items,
|
|
27
27
|
columns,
|
|
28
|
-
focusMode = 'none'
|
|
28
|
+
focusMode = 'none',
|
|
29
|
+
selectionMode,
|
|
30
|
+
onSortChange,
|
|
31
|
+
onSelectionChange,
|
|
32
|
+
defaultSortState,
|
|
33
|
+
sortState,
|
|
34
|
+
selectedItems,
|
|
35
|
+
defaultSelectedItems,
|
|
36
|
+
subtleSelection = false,
|
|
37
|
+
selectionAppearance = 'brand'
|
|
29
38
|
} = props;
|
|
30
39
|
const navigable = focusMode !== 'none';
|
|
31
40
|
const keyboardNavAttr = react_tabster_1.useArrowNavigationGroup({
|
|
32
41
|
axis: 'grid'
|
|
33
42
|
});
|
|
34
|
-
const tableState =
|
|
43
|
+
const tableState = hooks_1.useTableFeatures({
|
|
35
44
|
items,
|
|
36
45
|
columns
|
|
37
|
-
}, [
|
|
46
|
+
}, [hooks_1.useTableSort({
|
|
47
|
+
defaultSortState,
|
|
48
|
+
sortState,
|
|
49
|
+
onSortChange
|
|
50
|
+
}), hooks_1.useTableSelection({
|
|
51
|
+
defaultSelectedItems,
|
|
52
|
+
selectedItems,
|
|
53
|
+
onSelectionChange,
|
|
54
|
+
selectionMode: selectionMode !== null && selectionMode !== void 0 ? selectionMode : 'multiselect'
|
|
55
|
+
})]);
|
|
38
56
|
const baseTableState = useTable_1.useTable_unstable({
|
|
39
57
|
role: 'grid',
|
|
40
58
|
as: 'div',
|
|
59
|
+
noNativeElements: true,
|
|
41
60
|
...(navigable && keyboardNavAttr),
|
|
42
61
|
...props
|
|
43
62
|
}, ref);
|
|
44
63
|
return { ...baseTableState,
|
|
45
64
|
focusMode,
|
|
46
|
-
tableState
|
|
65
|
+
tableState,
|
|
66
|
+
selectableRows: !!selectionMode,
|
|
67
|
+
subtleSelection,
|
|
68
|
+
selectionAppearance
|
|
47
69
|
};
|
|
48
70
|
};
|
|
49
71
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGrid.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AAEA,MAAA,UAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;;AACA,MAAA,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGrid.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AAEA,MAAA,UAAA,gBAAA,OAAA,CAAA,mBAAA,CAAA;;AACA,MAAA,OAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,oBAAoB,GAAG,CAAC,KAAD,EAAuB,GAAvB,KAAqE;EACvG,MAAM;IACJ,KADI;IAEJ,OAFI;IAGJ,SAAS,GAAG,MAHR;IAIJ,aAJI;IAKJ,YALI;IAMJ,iBANI;IAOJ,gBAPI;IAQJ,SARI;IASJ,aATI;IAUJ,oBAVI;IAWJ,eAAe,GAAG,KAXd;IAYJ,mBAAmB,GAAG;EAZlB,IAaF,KAbJ;EAeA,MAAM,SAAS,GAAG,SAAS,KAAK,MAAhC;EACA,MAAM,eAAe,GAAG,eAAA,CAAA,uBAAA,CAAwB;IAAE,IAAI,EAAE;EAAR,CAAxB,CAAxB;EAEA,MAAM,UAAU,GAAG,OAAA,CAAA,gBAAA,CAAiB;IAAE,KAAF;IAAS;EAAT,CAAjB,EAAqC,CACtD,OAAA,CAAA,YAAA,CAAa;IACX,gBADW;IAEX,SAFW;IAGX;EAHW,CAAb,CADsD,EAMtD,OAAA,CAAA,iBAAA,CAAkB;IAChB,oBADgB;IAEhB,aAFgB;IAGhB,iBAHgB;IAIhB,aAAa,EAAE,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAA,aAAA,GAAiB;EAJhB,CAAlB,CANsD,CAArC,CAAnB;EAcA,MAAM,cAAc,GAAG,UAAA,CAAA,iBAAA,CACrB;IAAE,IAAI,EAAE,MAAR;IAAgB,EAAE,EAAE,KAApB;IAA2B,gBAAgB,EAAE,IAA7C;IAAmD,IAAI,SAAS,IAAI,eAAjB,CAAnD;IAAsF,GAAG;EAAzF,CADqB,EAErB,GAFqB,CAAvB;EAKA,OAAO,EACL,GAAG,cADE;IAEL,SAFK;IAGL,UAHK;IAIL,cAAc,EAAE,CAAC,CAAC,aAJb;IAKL,eALK;IAML;EANK,CAAP;AAQD,CA9CM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","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 } from '../../hooks';\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 = 'none',\n selectionMode,\n onSortChange,\n onSelectionChange,\n defaultSortState,\n sortState,\n selectedItems,\n defaultSelectedItems,\n subtleSelection = false,\n selectionAppearance = 'brand',\n } = props;\n\n const navigable = focusMode !== 'none';\n const keyboardNavAttr = useArrowNavigationGroup({ axis: 'grid' });\n\n const tableState = useTableFeatures({ items, columns }, [\n useTableSort({\n defaultSortState,\n sortState,\n onSortChange,\n }),\n useTableSelection({\n defaultSelectedItems,\n selectedItems,\n onSelectionChange,\n selectionMode: selectionMode ?? 'multiselect',\n }),\n ]);\n\n const baseTableState = useTable_unstable(\n { role: 'grid', as: 'div', noNativeElements: true, ...(navigable && keyboardNavAttr), ...props },\n ref,\n );\n\n return {\n ...baseTableState,\n focusMode,\n tableState,\n selectableRows: !!selectionMode,\n subtleSelection,\n selectionAppearance,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -11,7 +11,10 @@ function useDataGridContextValues_unstable(state) {
|
|
|
11
11
|
const tableContextValues = useTableContextValues_1.useTableContextValues_unstable(state);
|
|
12
12
|
return { ...tableContextValues,
|
|
13
13
|
dataGrid: { ...state.tableState,
|
|
14
|
-
focusMode: state.focusMode
|
|
14
|
+
focusMode: state.focusMode,
|
|
15
|
+
selectableRows: state.selectableRows,
|
|
16
|
+
subtleSelection: state.subtleSelection,
|
|
17
|
+
selectionAppearance: state.selectionAppearance
|
|
15
18
|
}
|
|
16
19
|
};
|
|
17
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGridContextValues.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,uBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AAGA,SAAgB,iCAAhB,CAAkD,KAAlD,EAAsE;EACpE,MAAM,kBAAkB,GAAG,uBAAA,CAAA,8BAAA,CAA+B,KAA/B,CAA3B;EACA,OAAO,EACL,GAAG,kBADE;IAEL,QAAQ,EAAE,EACR,GAAG,KAAK,CAAC,UADD;MAER,SAAS,EAAE,KAAK,CAAC;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGrid/useDataGridContextValues.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,uBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AAGA,SAAgB,iCAAhB,CAAkD,KAAlD,EAAsE;EACpE,MAAM,kBAAkB,GAAG,uBAAA,CAAA,8BAAA,CAA+B,KAA/B,CAA3B;EACA,OAAO,EACL,GAAG,kBADE;IAEL,QAAQ,EAAE,EACR,GAAG,KAAK,CAAC,UADD;MAER,SAAS,EAAE,KAAK,CAAC,SAFT;MAGR,cAAc,EAAE,KAAK,CAAC,cAHd;MAIR,eAAe,EAAE,KAAK,CAAC,eAJf;MAKR,mBAAmB,EAAE,KAAK,CAAC;IALnB;EAFL,CAAP;AAUD;;AAZD,OAAA,CAAA,iCAAA,GAAA,iCAAA","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 },\n };\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -5,9 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useDataGridBody_unstable = void 0;
|
|
7
7
|
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
|
+
|
|
8
10
|
const useTableBody_1 = /*#__PURE__*/require("../TableBody/useTableBody");
|
|
9
11
|
|
|
10
12
|
const dataGridContext_1 = /*#__PURE__*/require("../../contexts/dataGridContext");
|
|
13
|
+
|
|
14
|
+
const tableContext_1 = /*#__PURE__*/require("../../contexts/tableContext");
|
|
15
|
+
|
|
16
|
+
const rowIdContext_1 = /*#__PURE__*/require("../../contexts/rowIdContext");
|
|
11
17
|
/**
|
|
12
18
|
* Create the state required to render DataGridBody.
|
|
13
19
|
*
|
|
@@ -20,12 +26,19 @@ const dataGridContext_1 = /*#__PURE__*/require("../../contexts/dataGridContext")
|
|
|
20
26
|
|
|
21
27
|
|
|
22
28
|
const useDataGridBody_unstable = (props, ref) => {
|
|
29
|
+
const {
|
|
30
|
+
sortable
|
|
31
|
+
} = tableContext_1.useTableContext();
|
|
23
32
|
const getRows = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.getRows);
|
|
24
|
-
const
|
|
33
|
+
const sort = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.sort.sort);
|
|
34
|
+
const rows = sortable ? sort(getRows()) : getRows();
|
|
25
35
|
const {
|
|
26
36
|
children: renderRow
|
|
27
37
|
} = props;
|
|
28
|
-
const children = rows.map(row =>
|
|
38
|
+
const children = rows.map(row => React.createElement(rowIdContext_1.RowIdContextProvider, {
|
|
39
|
+
key: row.rowId,
|
|
40
|
+
value: row.rowId
|
|
41
|
+
}, renderRow(row)));
|
|
29
42
|
return useTableBody_1.useTableBody_unstable({ ...props,
|
|
30
43
|
children,
|
|
31
44
|
as: 'div'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridBody/useDataGridBody.
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridBody/useDataGridBody.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,wBAAwB,GAAG,CAAC,KAAD,EAA2B,GAA3B,KAA6E;EACnH,MAAM;IAAE;EAAF,IAAe,cAAA,CAAA,eAAA,EAArB;EACA,MAAM,OAAO,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAI,GAAG,CAAC,OAAvC,CAAhB;EACA,MAAM,IAAI,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAI,GAAG,CAAC,IAAJ,CAAS,IAA5C,CAAb;EACA,MAAM,IAAI,GAAG,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAR,CAAP,GAAqB,OAAO,EAAjD;EAEA,MAAM;IAAE,QAAQ,EAAE;EAAZ,IAA0B,KAAhC;EACA,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAL,CAAS,GAAG,IAC3B,KAAA,CAAA,aAAA,CAAC,cAAA,CAAA,oBAAD,EAAqB;IAAC,GAAG,EAAE,GAAG,CAAC,KAAV;IAAiB,KAAK,EAAE,GAAG,CAAC;EAA5B,CAArB,EACG,SAAS,CAAC,GAAD,CADZ,CADe,CAAjB;EAKA,OAAO,cAAA,CAAA,qBAAA,CAAsB,EAAE,GAAG,KAAL;IAAY,QAAZ;IAAsB,EAAE,EAAE;EAA1B,CAAtB,EAAyD,GAAzD,CAAP;AACD,CAbM;;AAAM,OAAA,CAAA,wBAAA,GAAwB,wBAAxB","sourcesContent":["import * as React from 'react';\nimport type { DataGridBodyProps, DataGridBodyState } from './DataGridBody.types';\nimport { useTableBody_unstable } from '../TableBody/useTableBody';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useTableContext } from '../../contexts/tableContext';\nimport { RowIdContextProvider } from '../../contexts/rowIdContext';\n\n/**\n * Create the state required to render DataGridBody.\n *\n * The returned state can be modified with hooks such as useDataGridBodyStyles_unstable,\n * before being passed to renderDataGridBody_unstable.\n *\n * @param props - props from this instance of DataGridBody\n * @param ref - reference to root HTMLElement of DataGridBody\n */\nexport const useDataGridBody_unstable = (props: DataGridBodyProps, ref: React.Ref<HTMLElement>): DataGridBodyState => {\n const { sortable } = useTableContext();\n const getRows = useDataGridContext_unstable(ctx => ctx.getRows);\n const sort = useDataGridContext_unstable(ctx => ctx.sort.sort);\n const rows = sortable ? sort(getRows()) : getRows();\n\n const { children: renderRow } = props;\n const children = rows.map(row => (\n <RowIdContextProvider key={row.rowId} value={row.rowId}>\n {renderRow(row)}\n </RowIdContextProvider>\n ));\n return useTableBody_unstable({ ...props, children, as: 'div' }, ref);\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -5,7 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useDataGridHeaderCell_unstable = void 0;
|
|
7
7
|
|
|
8
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
9
|
+
|
|
8
10
|
const useTableHeaderCell_1 = /*#__PURE__*/require("../TableHeaderCell/useTableHeaderCell");
|
|
11
|
+
|
|
12
|
+
const dataGridContext_1 = /*#__PURE__*/require("../../contexts/dataGridContext");
|
|
13
|
+
|
|
14
|
+
const columnIdContext_1 = /*#__PURE__*/require("../../contexts/columnIdContext");
|
|
15
|
+
|
|
16
|
+
const tableContext_1 = /*#__PURE__*/require("../../contexts/tableContext");
|
|
9
17
|
/**
|
|
10
18
|
* Create the state required to render DataGridHeaderCell.
|
|
11
19
|
*
|
|
@@ -18,8 +26,26 @@ const useTableHeaderCell_1 = /*#__PURE__*/require("../TableHeaderCell/useTableHe
|
|
|
18
26
|
|
|
19
27
|
|
|
20
28
|
const useDataGridHeaderCell_unstable = (props, ref) => {
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
const columnId = columnIdContext_1.useColumnIdContext();
|
|
30
|
+
const {
|
|
31
|
+
sortable
|
|
32
|
+
} = tableContext_1.useTableContext();
|
|
33
|
+
const toggleColumnSort = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.sort.toggleColumnSort);
|
|
34
|
+
const sortDirection = dataGridContext_1.useDataGridContext_unstable(ctx => sortable ? ctx.sort.getSortDirection(columnId) : undefined);
|
|
35
|
+
const onClick = react_utilities_1.useEventCallback(e => {
|
|
36
|
+
var _a;
|
|
37
|
+
|
|
38
|
+
if (sortable) {
|
|
39
|
+
toggleColumnSort(e, columnId);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
43
|
+
});
|
|
44
|
+
return useTableHeaderCell_1.useTableHeaderCell_unstable({
|
|
45
|
+
sortDirection,
|
|
46
|
+
as: 'div',
|
|
47
|
+
...props,
|
|
48
|
+
onClick
|
|
23
49
|
}, ref);
|
|
24
50
|
};
|
|
25
51
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridHeaderCell/useDataGridHeaderCell.ts"],"names":[],"mappings":";;;;;;;AAEA,MAAA,oBAAA,gBAAA,OAAA,CAAA,uCAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,8BAA8B,GAAG,CAC5C,KAD4C,EAE5C,GAF4C,KAGjB;EAC3B,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridHeaderCell/useDataGridHeaderCell.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,oBAAA,gBAAA,OAAA,CAAA,uCAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,8BAA8B,GAAG,CAC5C,KAD4C,EAE5C,GAF4C,KAGjB;EAC3B,MAAM,QAAQ,GAAG,iBAAA,CAAA,kBAAA,EAAjB;EACA,MAAM;IAAE;EAAF,IAAe,cAAA,CAAA,eAAA,EAArB;EACA,MAAM,gBAAgB,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAI,GAAG,CAAC,IAAJ,CAAS,gBAA5C,CAAzB;EACA,MAAM,aAAa,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IACnD,QAAQ,GAAG,GAAG,CAAC,IAAJ,CAAS,gBAAT,CAA0B,QAA1B,CAAH,GAAyC,SAD7B,CAAtB;EAGA,MAAM,OAAO,GAAG,iBAAA,CAAA,gBAAA,CAAkB,CAAD,IAAoD;;;IACnF,IAAI,QAAJ,EAAc;MACZ,gBAAgB,CAAC,CAAD,EAAI,QAAJ,CAAhB;IACD;;IACD,CAAA,EAAA,GAAA,KAAK,CAAC,OAAN,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAa,EAAA,CAAA,IAAA,CAAb,KAAa,EAAG,CAAH,CAAb;EACD,CALe,CAAhB;EAOA,OAAO,oBAAA,CAAA,2BAAA,CAA4B;IAAE,aAAF;IAAiB,EAAE,EAAE,KAArB;IAA4B,GAAG,KAA/B;IAAsC;EAAtC,CAA5B,EAA6E,GAA7E,CAAP;AACD,CAlBM;;AAAM,OAAA,CAAA,8BAAA,GAA8B,8BAA9B","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 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({ sortDirection, as: 'div', ...props, onClick }, ref);\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -5,14 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.renderDataGridRow_unstable = void 0;
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
|
+
|
|
10
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
9
11
|
/**
|
|
10
12
|
* Render the final JSX of DataGridRow
|
|
11
13
|
*/
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
const renderDataGridRow_unstable = state => {
|
|
15
|
-
|
|
17
|
+
const {
|
|
18
|
+
slots,
|
|
19
|
+
slotProps
|
|
20
|
+
} = react_utilities_1.getSlots(state);
|
|
21
|
+
return React.createElement(slots.root, { ...slotProps.root
|
|
22
|
+
}, slots.selectionCell && React.createElement(slots.selectionCell, { ...slotProps.selectionCell
|
|
23
|
+
}), slotProps.root.children);
|
|
16
24
|
};
|
|
17
25
|
|
|
18
26
|
exports.renderDataGridRow_unstable = renderDataGridRow_unstable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/renderDataGridRow.tsx"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/renderDataGridRow.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,0BAA0B,GAAI,KAAD,IAA4B;EACpE,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAA2B,KAA3B,CAA7B;EAEA,OACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,KAAK,CAAC,aAAN,IAAuB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,aAAP,EAAoB,EAAA,GAAK,SAAS,CAAC;EAAf,CAApB,CAD1B,EAEG,SAAS,CAAC,IAAV,CAAe,QAFlB,CADF;AAMD,CATM;;AAAM,OAAA,CAAA,0BAAA,GAA0B,0BAA1B","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { DataGridRowState, DataGridRowSlots } from './DataGridRow.types';\n\n/**\n * Render the final JSX of DataGridRow\n */\nexport const renderDataGridRow_unstable = (state: DataGridRowState) => {\n const { slots, slotProps } = getSlots<DataGridRowSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.selectionCell && <slots.selectionCell {...slotProps.selectionCell} />}\n {slotProps.root.children}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -5,9 +5,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useDataGridRow_unstable = void 0;
|
|
7
7
|
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
|
+
|
|
8
10
|
const useTableRow_1 = /*#__PURE__*/require("../TableRow/useTableRow");
|
|
9
11
|
|
|
10
12
|
const dataGridContext_1 = /*#__PURE__*/require("../../contexts/dataGridContext");
|
|
13
|
+
|
|
14
|
+
const columnIdContext_1 = /*#__PURE__*/require("../../contexts/columnIdContext");
|
|
15
|
+
|
|
16
|
+
const DataGridSelectionCell_1 = /*#__PURE__*/require("../DataGridSelectionCell/DataGridSelectionCell");
|
|
17
|
+
|
|
18
|
+
const rowIdContext_1 = /*#__PURE__*/require("../../contexts/rowIdContext");
|
|
19
|
+
|
|
20
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
21
|
+
|
|
22
|
+
const tableHeaderContext_1 = /*#__PURE__*/require("../../contexts/tableHeaderContext");
|
|
23
|
+
|
|
24
|
+
const react_utilities_2 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
11
25
|
/**
|
|
12
26
|
* Create the state required to render DataGridRow.
|
|
13
27
|
*
|
|
@@ -20,15 +34,61 @@ const dataGridContext_1 = /*#__PURE__*/require("../../contexts/dataGridContext")
|
|
|
20
34
|
|
|
21
35
|
|
|
22
36
|
const useDataGridRow_unstable = (props, ref) => {
|
|
37
|
+
const rowId = rowIdContext_1.useRowIdContext();
|
|
38
|
+
const isHeader = tableHeaderContext_1.useIsInTableHeader();
|
|
23
39
|
const columnDefs = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.columns);
|
|
40
|
+
const selectable = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selectableRows);
|
|
41
|
+
const selected = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selection.isRowSelected(rowId));
|
|
42
|
+
const appearance = dataGridContext_1.useDataGridContext_unstable(ctx => {
|
|
43
|
+
if (!isHeader && selectable && ctx.selection.isRowSelected(rowId)) {
|
|
44
|
+
return ctx.selectionAppearance;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return 'none';
|
|
48
|
+
});
|
|
49
|
+
const toggleRow = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selection.toggleRow);
|
|
24
50
|
const cellRenderFunction = props.children;
|
|
25
|
-
const
|
|
26
|
-
return
|
|
51
|
+
const cells = columnDefs.map(columnDef => {
|
|
52
|
+
return React.createElement(columnIdContext_1.ColumnIdContextProvider, {
|
|
53
|
+
value: columnDef.columnId,
|
|
54
|
+
key: columnDef.columnId
|
|
55
|
+
}, cellRenderFunction(columnDef));
|
|
56
|
+
});
|
|
57
|
+
const onClick = react_utilities_1.useEventCallback(e => {
|
|
58
|
+
var _a;
|
|
59
|
+
|
|
60
|
+
if (selectable && !isHeader) {
|
|
61
|
+
toggleRow(e, rowId);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
65
|
+
});
|
|
66
|
+
const onKeyDown = react_utilities_1.useEventCallback(e => {
|
|
67
|
+
var _a;
|
|
68
|
+
|
|
69
|
+
if (selectable && !isHeader && e.key === ' ') {
|
|
70
|
+
toggleRow(e, rowId);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
(_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
27
74
|
});
|
|
28
|
-
|
|
29
|
-
|
|
75
|
+
const baseState = useTableRow_1.useTableRow_unstable({
|
|
76
|
+
appearance,
|
|
77
|
+
'aria-selected': selectable ? selected : undefined,
|
|
78
|
+
...props,
|
|
79
|
+
onClick,
|
|
80
|
+
onKeyDown,
|
|
81
|
+
children: cells,
|
|
30
82
|
as: 'div'
|
|
31
83
|
}, ref);
|
|
84
|
+
return { ...baseState,
|
|
85
|
+
components: { ...baseState.components,
|
|
86
|
+
selectionCell: DataGridSelectionCell_1.DataGridSelectionCell
|
|
87
|
+
},
|
|
88
|
+
selectionCell: react_utilities_2.resolveShorthand(props.selectionCell, {
|
|
89
|
+
required: selectable
|
|
90
|
+
})
|
|
91
|
+
};
|
|
32
92
|
};
|
|
33
93
|
|
|
34
94
|
exports.useDataGridRow_unstable = useDataGridRow_unstable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRow.
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRow.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAEA,MAAA,aAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,gDAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,oBAAA,gBAAA,OAAA,CAAA,mCAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,uBAAuB,GAAG,CAAC,KAAD,EAA0B,GAA1B,KAA2E;EAChH,MAAM,KAAK,GAAG,cAAA,CAAA,eAAA,EAAd;EACA,MAAM,QAAQ,GAAG,oBAAA,CAAA,kBAAA,EAAjB;EACA,MAAM,UAAU,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAI,GAAG,CAAC,OAAvC,CAAnB;EACA,MAAM,UAAU,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAI,GAAG,CAAC,cAAvC,CAAnB;EACA,MAAM,QAAQ,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAI,GAAG,CAAC,SAAJ,CAAc,aAAd,CAA4B,KAA5B,CAAnC,CAAjB;EACA,MAAM,UAAU,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAG;IACnD,IAAI,CAAC,QAAD,IAAa,UAAb,IAA2B,GAAG,CAAC,SAAJ,CAAc,aAAd,CAA4B,KAA5B,CAA/B,EAAmE;MACjE,OAAO,GAAG,CAAC,mBAAX;IACD;;IAED,OAAO,MAAP;EACD,CANkB,CAAnB;EAOA,MAAM,SAAS,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAI,GAAG,CAAC,SAAJ,CAAc,SAAjD,CAAlB;EAEA,MAAM,kBAAkB,GAAG,KAAK,CAAC,QAAjC;EACA,MAAM,KAAK,GAAG,UAAU,CAAC,GAAX,CAAe,SAAS,IAAG;IACvC,OACE,KAAA,CAAA,aAAA,CAAC,iBAAA,CAAA,uBAAD,EAAwB;MAAC,KAAK,EAAE,SAAS,CAAC,QAAlB;MAA4B,GAAG,EAAE,SAAS,CAAC;IAA3C,CAAxB,EACG,kBAAkB,CAAC,SAAD,CADrB,CADF;EAKD,CANa,CAAd;EAQA,MAAM,OAAO,GAAG,iBAAA,CAAA,gBAAA,CAAkB,CAAD,IAA6C;;;IAC5E,IAAI,UAAU,IAAI,CAAC,QAAnB,EAA6B;MAC3B,SAAS,CAAC,CAAD,EAAI,KAAJ,CAAT;IACD;;IAED,CAAA,EAAA,GAAA,KAAK,CAAC,OAAN,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAa,EAAA,CAAA,IAAA,CAAb,KAAa,EAAG,CAAH,CAAb;EACD,CANe,CAAhB;EAQA,MAAM,SAAS,GAAG,iBAAA,CAAA,gBAAA,CAAkB,CAAD,IAAgD;;;IACjF,IAAI,UAAU,IAAI,CAAC,QAAf,IAA2B,CAAC,CAAC,GAAF,KAAU,GAAzC,EAA8C;MAC5C,SAAS,CAAC,CAAD,EAAI,KAAJ,CAAT;IACD;;IAED,CAAA,EAAA,GAAA,KAAK,CAAC,SAAN,MAAe,IAAf,IAAe,EAAA,KAAA,KAAA,CAAf,GAAe,KAAA,CAAf,GAAe,EAAA,CAAA,IAAA,CAAf,KAAe,EAAG,CAAH,CAAf;EACD,CANiB,CAAlB;EAQA,MAAM,SAAS,GAAG,aAAA,CAAA,oBAAA,CAChB;IACE,UADF;IAEE,iBAAiB,UAAU,GAAG,QAAH,GAAc,SAF3C;IAGE,GAAG,KAHL;IAIE,OAJF;IAKE,SALF;IAME,QAAQ,EAAE,KANZ;IAOE,EAAE,EAAE;EAPN,CADgB,EAUhB,GAVgB,CAAlB;EAaA,OAAO,EACL,GAAG,SADE;IAEL,UAAU,EAAE,EACV,GAAG,SAAS,CAAC,UADH;MAEV,aAAa,EAAE,uBAAA,CAAA;IAFL,CAFP;IAML,aAAa,EAAE,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,aAAvB,EAAsC;MAAE,QAAQ,EAAE;IAAZ,CAAtC;EANV,CAAP;AAQD,CA7DM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import * as React from 'react';\nimport type { DataGridRowProps, DataGridRowState } from './DataGridRow.types';\nimport { useTableRow_unstable } from '../TableRow/useTableRow';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { ColumnIdContextProvider } from '../../contexts/columnIdContext';\nimport { DataGridSelectionCell } from '../DataGridSelectionCell/DataGridSelectionCell';\nimport { useRowIdContext } from '../../contexts/rowIdContext';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\nimport { resolveShorthand } from '@fluentui/react-utilities';\n\n/**\n * Create the state required to render DataGridRow.\n *\n * The returned state can be modified with hooks such as useDataGridRowStyles_unstable,\n * before being passed to renderDataGridRow_unstable.\n *\n * @param props - props from this instance of DataGridRow\n * @param ref - reference to root HTMLElement of DataGridRow\n */\nexport const useDataGridRow_unstable = (props: DataGridRowProps, ref: React.Ref<HTMLElement>): DataGridRowState => {\n const rowId = useRowIdContext();\n const isHeader = useIsInTableHeader();\n const columnDefs = useDataGridContext_unstable(ctx => ctx.columns);\n const selectable = useDataGridContext_unstable(ctx => ctx.selectableRows);\n const selected = useDataGridContext_unstable(ctx => ctx.selection.isRowSelected(rowId));\n const appearance = useDataGridContext_unstable(ctx => {\n if (!isHeader && selectable && ctx.selection.isRowSelected(rowId)) {\n return ctx.selectionAppearance;\n }\n\n return 'none';\n });\n const toggleRow = useDataGridContext_unstable(ctx => ctx.selection.toggleRow);\n\n const cellRenderFunction = props.children;\n const cells = columnDefs.map(columnDef => {\n return (\n <ColumnIdContextProvider value={columnDef.columnId} key={columnDef.columnId}>\n {cellRenderFunction(columnDef)}\n </ColumnIdContextProvider>\n );\n });\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader) {\n toggleRow(e, rowId);\n }\n\n props.onClick?.(e);\n });\n\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader && e.key === ' ') {\n toggleRow(e, rowId);\n }\n\n props.onKeyDown?.(e);\n });\n\n const baseState = useTableRow_unstable(\n {\n appearance,\n 'aria-selected': selectable ? selected : undefined,\n ...props,\n onClick,\n onKeyDown,\n children: cells,\n as: 'div',\n },\n ref,\n );\n\n return {\n ...baseState,\n components: {\n ...baseState.components,\n selectionCell: DataGridSelectionCell,\n },\n selectionCell: resolveShorthand(props.selectionCell, { required: selectable }),\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -10,7 +10,8 @@ const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
|
10
10
|
const useTableRowStyles_1 = /*#__PURE__*/require("../TableRow/useTableRowStyles");
|
|
11
11
|
|
|
12
12
|
exports.dataGridRowClassNames = {
|
|
13
|
-
root: 'fui-DataGridRow'
|
|
13
|
+
root: 'fui-DataGridRow',
|
|
14
|
+
selectionCell: 'fui-DataGridRow__selectionCell'
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
16
17
|
* Apply styling to the DataGridRow slots based on the state
|
|
@@ -19,6 +20,11 @@ exports.dataGridRowClassNames = {
|
|
|
19
20
|
const useDataGridRowStyles_unstable = state => {
|
|
20
21
|
useTableRowStyles_1.useTableRowStyles_unstable(state);
|
|
21
22
|
state.root.className = react_1.mergeClasses(exports.dataGridRowClassNames.root, state.root.className);
|
|
23
|
+
|
|
24
|
+
if (state.selectionCell) {
|
|
25
|
+
state.selectionCell.className = react_1.mergeClasses(exports.dataGridRowClassNames.selectionCell, state.selectionCell.className);
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
return state;
|
|
23
29
|
};
|
|
24
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRowStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAGA,MAAA,mBAAA,gBAAA,OAAA,CAAA,+BAAA,CAAA;;AAEa,OAAA,CAAA,qBAAA,GAA0D;EACrE,IAAI,EAAE
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRowStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAGA,MAAA,mBAAA,gBAAA,OAAA,CAAA,+BAAA,CAAA;;AAEa,OAAA,CAAA,qBAAA,GAA0D;EACrE,IAAI,EAAE,iBAD+D;EAErE,aAAa,EAAE;AAFsD,CAA1D;AAKb;;AAEG;;AACI,MAAM,6BAA6B,GAAI,KAAD,IAA8C;EACzF,mBAAA,CAAA,0BAAA,CAA2B,KAA3B;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,qBAAA,CAAsB,IAAnC,EAAyC,KAAK,CAAC,IAAN,CAAW,SAApD,CAAvB;;EACA,IAAI,KAAK,CAAC,aAAV,EAAyB;IACvB,KAAK,CAAC,aAAN,CAAoB,SAApB,GAAgC,OAAA,CAAA,YAAA,CAAa,OAAA,CAAA,qBAAA,CAAsB,aAAnC,EAAkD,KAAK,CAAC,aAAN,CAAoB,SAAtE,CAAhC;EACD;;EAED,OAAO,KAAP;AACD,CARM;;AAAM,OAAA,CAAA,6BAAA,GAA6B,6BAA7B","sourcesContent":["import { mergeClasses } from '@griffel/react';\nimport type { DataGridRowSlots, DataGridRowState } from './DataGridRow.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { useTableRowStyles_unstable } from '../TableRow/useTableRowStyles';\n\nexport const dataGridRowClassNames: SlotClassNames<DataGridRowSlots> = {\n root: 'fui-DataGridRow',\n selectionCell: 'fui-DataGridRow__selectionCell',\n};\n\n/**\n * Apply styling to the DataGridRow slots based on the state\n */\nexport const useDataGridRowStyles_unstable = (state: DataGridRowState): DataGridRowState => {\n useTableRowStyles_unstable(state);\n state.root.className = mergeClasses(dataGridRowClassNames.root, state.root.className);\n if (state.selectionCell) {\n state.selectionCell.className = mergeClasses(dataGridRowClassNames.selectionCell, state.selectionCell.className);\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -5,6 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useDataGridSelectionCell_unstable = void 0;
|
|
7
7
|
|
|
8
|
+
const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
|
9
|
+
|
|
10
|
+
const dataGridContext_1 = /*#__PURE__*/require("../../contexts/dataGridContext");
|
|
11
|
+
|
|
12
|
+
const rowIdContext_1 = /*#__PURE__*/require("../../contexts/rowIdContext");
|
|
13
|
+
|
|
14
|
+
const tableHeaderContext_1 = /*#__PURE__*/require("../../contexts/tableHeaderContext");
|
|
15
|
+
|
|
8
16
|
const useTableSelectionCell_1 = /*#__PURE__*/require("../TableSelectionCell/useTableSelectionCell");
|
|
9
17
|
/**
|
|
10
18
|
* Create the state required to render DataGridSelectionCell.
|
|
@@ -18,10 +26,41 @@ const useTableSelectionCell_1 = /*#__PURE__*/require("../TableSelectionCell/useT
|
|
|
18
26
|
|
|
19
27
|
|
|
20
28
|
const useDataGridSelectionCell_unstable = (props, ref) => {
|
|
29
|
+
const isHeader = tableHeaderContext_1.useIsInTableHeader();
|
|
30
|
+
const rowId = rowIdContext_1.useRowIdContext();
|
|
31
|
+
const multiselect = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selection.selectionMode === 'multiselect');
|
|
32
|
+
const subtle = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.subtleSelection);
|
|
33
|
+
const checked = dataGridContext_1.useDataGridContext_unstable(ctx => {
|
|
34
|
+
if (isHeader && multiselect) {
|
|
35
|
+
return ctx.selection.allRowsSelected ? true : ctx.selection.someRowsSelected ? 'mixed' : false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return ctx.selection.isRowSelected(rowId);
|
|
39
|
+
});
|
|
40
|
+
const toggleAllRows = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selection.toggleAllRows);
|
|
41
|
+
const type = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio');
|
|
42
|
+
const onClick = react_utilities_1.useEventCallback(e => {
|
|
43
|
+
var _a;
|
|
44
|
+
|
|
45
|
+
if (isHeader) {
|
|
46
|
+
toggleAllRows(e);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
50
|
+
});
|
|
21
51
|
return useTableSelectionCell_1.useTableSelectionCell_unstable({
|
|
22
52
|
as: 'div',
|
|
23
53
|
role: 'gridcell',
|
|
24
|
-
|
|
54
|
+
checked,
|
|
55
|
+
type,
|
|
56
|
+
tabIndex: 0,
|
|
57
|
+
hidden: isHeader && !multiselect,
|
|
58
|
+
subtle,
|
|
59
|
+
checkboxIndicator: {
|
|
60
|
+
tabIndex: -1
|
|
61
|
+
},
|
|
62
|
+
...props,
|
|
63
|
+
onClick
|
|
25
64
|
}, ref);
|
|
26
65
|
};
|
|
27
66
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridSelectionCell/useDataGridSelectionCell.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,6CAAA,CAAA;AAGA;;;;;;;;AAQG;;;AACI,MAAM,iCAAiC,GAAG,CAC/C,KAD+C,EAE/C,GAF+C,KAGjB;EAC9B,OAAO,uBAAA,CAAA,8BAAA,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/DataGridSelectionCell/useDataGridSelectionCell.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,gCAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,oBAAA,gBAAA,OAAA,CAAA,mCAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,6CAAA,CAAA;AAGA;;;;;;;;AAQG;;;AACI,MAAM,iCAAiC,GAAG,CAC/C,KAD+C,EAE/C,GAF+C,KAGjB;EAC9B,MAAM,QAAQ,GAAG,oBAAA,CAAA,kBAAA,EAAjB;EACA,MAAM,KAAK,GAAG,cAAA,CAAA,eAAA,EAAd;EACA,MAAM,WAAW,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAI,GAAG,CAAC,SAAJ,CAAc,aAAd,KAAgC,aAAnE,CAApB;EACA,MAAM,MAAM,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAI,GAAG,CAAC,eAAvC,CAAf;EACA,MAAM,OAAO,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAG;IAChD,IAAI,QAAQ,IAAI,WAAhB,EAA6B;MAC3B,OAAO,GAAG,CAAC,SAAJ,CAAc,eAAd,GAAgC,IAAhC,GAAuC,GAAG,CAAC,SAAJ,CAAc,gBAAd,GAAiC,OAAjC,GAA2C,KAAzF;IACD;;IAED,OAAO,GAAG,CAAC,SAAJ,CAAc,aAAd,CAA4B,KAA5B,CAAP;EACD,CANe,CAAhB;EAQA,MAAM,aAAa,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAAI,GAAG,CAAC,SAAJ,CAAc,aAAjD,CAAtB;EACA,MAAM,IAAI,GAAG,iBAAA,CAAA,2BAAA,CAA4B,GAAG,IAC1C,GAAG,CAAC,SAAJ,CAAc,aAAd,KAAgC,aAAhC,GAAgD,UAAhD,GAA6D,OADlD,CAAb;EAIA,MAAM,OAAO,GAAG,iBAAA,CAAA,gBAAA,CAAkB,CAAD,IAA8C;;;IAC7E,IAAI,QAAJ,EAAc;MACZ,aAAa,CAAC,CAAD,CAAb;IACD;;IAED,CAAA,EAAA,GAAA,KAAK,CAAC,OAAN,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAa,EAAA,CAAA,IAAA,CAAb,KAAa,EAAG,CAAH,CAAb;EACD,CANe,CAAhB;EAQA,OAAO,uBAAA,CAAA,8BAAA,CACL;IACE,EAAE,EAAE,KADN;IAEE,IAAI,EAAE,UAFR;IAGE,OAHF;IAIE,IAJF;IAKE,QAAQ,EAAE,CALZ;IAME,MAAM,EAAE,QAAQ,IAAI,CAAC,WANvB;IAOE,MAPF;IAQE,iBAAiB,EAAE;MAAE,QAAQ,EAAE,CAAC;IAAb,CARrB;IASE,GAAG,KATL;IAUE;EAVF,CADK,EAaL,GAbK,CAAP;AAeD,CA5CM;;AAAM,OAAA,CAAA,iCAAA,GAAiC,iCAAjC","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\nimport { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSelectionCell';\nimport type { DataGridSelectionCellProps, DataGridSelectionCellState } from './DataGridSelectionCell.types';\n\n/**\n * Create the state required to render DataGridSelectionCell.\n *\n * The returned state can be modified with hooks such as useDataGridSelectionCellStyles_unstable,\n * before being passed to renderDataGridSelectionCell_unstable.\n *\n * @param props - props from this instance of DataGridSelectionCell\n * @param ref - reference to root HTMLElement of DataGridSelectionCell\n */\nexport const useDataGridSelectionCell_unstable = (\n props: DataGridSelectionCellProps,\n ref: React.Ref<HTMLElement>,\n): DataGridSelectionCellState => {\n const isHeader = useIsInTableHeader();\n const rowId = useRowIdContext();\n const multiselect = useDataGridContext_unstable(ctx => ctx.selection.selectionMode === 'multiselect');\n const subtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);\n const checked = useDataGridContext_unstable(ctx => {\n if (isHeader && multiselect) {\n return ctx.selection.allRowsSelected ? true : ctx.selection.someRowsSelected ? 'mixed' : false;\n }\n\n return ctx.selection.isRowSelected(rowId);\n });\n\n const toggleAllRows = useDataGridContext_unstable(ctx => ctx.selection.toggleAllRows);\n const type = useDataGridContext_unstable(ctx =>\n ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio',\n );\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableCellElement>) => {\n if (isHeader) {\n toggleAllRows(e);\n }\n\n props.onClick?.(e);\n });\n\n return useTableSelectionCell_unstable(\n {\n as: 'div',\n role: 'gridcell',\n checked,\n type,\n tabIndex: 0,\n hidden: isHeader && !multiselect,\n subtle,\n checkboxIndicator: { tabIndex: -1 },\n ...props,\n onClick,\n },\n ref,\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -23,7 +23,8 @@ const useTableCell_unstable = (props, ref) => {
|
|
|
23
23
|
var _a;
|
|
24
24
|
|
|
25
25
|
const {
|
|
26
|
-
noNativeElements
|
|
26
|
+
noNativeElements,
|
|
27
|
+
size
|
|
27
28
|
} = tableContext_1.useTableContext();
|
|
28
29
|
const rootComponent = ((_a = props.as) !== null && _a !== void 0 ? _a : noNativeElements) ? 'div' : 'td';
|
|
29
30
|
return {
|
|
@@ -35,7 +36,8 @@ const useTableCell_unstable = (props, ref) => {
|
|
|
35
36
|
role: rootComponent === 'div' ? 'cell' : undefined,
|
|
36
37
|
...props
|
|
37
38
|
}),
|
|
38
|
-
noNativeElements
|
|
39
|
+
noNativeElements,
|
|
40
|
+
size
|
|
39
41
|
};
|
|
40
42
|
};
|
|
41
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCell/useTableCell.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,qBAAqB,GAAG,CAAC,KAAD,EAAwB,GAAxB,KAAuE;;;EAC1G,MAAM;IAAE;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableCell/useTableCell.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,qBAAqB,GAAG,CAAC,KAAD,EAAwB,GAAxB,KAAuE;;;EAC1G,MAAM;IAAE,gBAAF;IAAoB;EAApB,IAA6B,cAAA,CAAA,eAAA,EAAnC;EAEA,MAAM,aAAa,GAAG,CAAA,CAAA,EAAA,GAAA,KAAK,CAAC,EAAN,MAAQ,IAAR,IAAQ,EAAA,KAAA,KAAA,CAAR,GAAQ,EAAR,GAAY,gBAAZ,IAA+B,KAA/B,GAAuC,IAA7D;EAEA,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,aAAtB,EAAqC;MACzC,GADyC;MAEzC,IAAI,EAAE,aAAa,KAAK,KAAlB,GAA0B,MAA1B,GAAmC,SAFA;MAGzC,GAAG;IAHsC,CAArC,CAJD;IASL,gBATK;IAUL;EAVK,CAAP;AAYD,CAjBM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { TableCellProps, TableCellState } from './TableCell.types';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render TableCell.\n *\n * The returned state can be modified with hooks such as useTableCellStyles_unstable,\n * before being passed to renderTableCell_unstable.\n *\n * @param props - props from this instance of TableCell\n * @param ref - reference to root HTMLElement of TableCell\n */\nexport const useTableCell_unstable = (props: TableCellProps, ref: React.Ref<HTMLElement>): TableCellState => {\n const { noNativeElements, size } = useTableContext();\n\n const rootComponent = props.as ?? noNativeElements ? 'div' : 'td';\n\n return {\n components: {\n root: rootComponent,\n },\n root: getNativeElementProps(rootComponent, {\n ref,\n role: rootComponent === 'div' ? 'cell' : undefined,\n ...props,\n }),\n noNativeElements,\n size,\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -9,6 +9,8 @@ const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
|
9
9
|
|
|
10
10
|
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
|
11
11
|
|
|
12
|
+
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
13
|
+
|
|
12
14
|
exports.tableCellClassName = 'fui-TableCell';
|
|
13
15
|
exports.tableCellClassNames = {
|
|
14
16
|
root: exports.tableCellClassName
|
|
@@ -18,9 +20,18 @@ const useTableLayoutStyles = /*#__PURE__*/react_1.__styles({
|
|
|
18
20
|
"root": {
|
|
19
21
|
"mc9l5x": "f15pt5es",
|
|
20
22
|
"ha4doy": "fmrv4ls"
|
|
23
|
+
},
|
|
24
|
+
"medium": {
|
|
25
|
+
"Bqenvij": "f1ft4266"
|
|
26
|
+
},
|
|
27
|
+
"small": {
|
|
28
|
+
"Bqenvij": "fbsu25e"
|
|
29
|
+
},
|
|
30
|
+
"extra-small": {
|
|
31
|
+
"Bqenvij": "frvgh55"
|
|
21
32
|
}
|
|
22
33
|
}, {
|
|
23
|
-
"d": [".f15pt5es{display:table-cell;}", ".fmrv4ls{vertical-align:middle;}"]
|
|
34
|
+
"d": [".f15pt5es{display:table-cell;}", ".fmrv4ls{vertical-align:middle;}", ".f1ft4266{height:44px;}", ".fbsu25e{height:34px;}", ".frvgh55{height:24px;}"]
|
|
24
35
|
});
|
|
25
36
|
|
|
26
37
|
const useFlexLayoutStyles = /*#__PURE__*/react_1.__styles({
|
|
@@ -31,9 +42,18 @@ const useFlexLayoutStyles = /*#__PURE__*/react_1.__styles({
|
|
|
31
42
|
"Bh6795r": "fqerorx",
|
|
32
43
|
"Bnnss6s": "f1neuvcm",
|
|
33
44
|
"xawz": "fkjuxzh"
|
|
45
|
+
},
|
|
46
|
+
"medium": {
|
|
47
|
+
"sshi5w": "f5pgtk9"
|
|
48
|
+
},
|
|
49
|
+
"small": {
|
|
50
|
+
"sshi5w": "fcep9tg"
|
|
51
|
+
},
|
|
52
|
+
"extra-small": {
|
|
53
|
+
"sshi5w": "f1pha7fy"
|
|
34
54
|
}
|
|
35
55
|
}, {
|
|
36
|
-
"d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f10tiqix{min-width:0px;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".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;}"]
|
|
56
|
+
"d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f10tiqix{min-width:0px;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".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;}", ".f5pgtk9{min-height:44px;}", ".fcep9tg{min-height:34px;}", ".f1pha7fy{min-height:24px;}"]
|
|
37
57
|
});
|
|
38
58
|
/**
|
|
39
59
|
* Styles for the root slot
|
|
@@ -46,10 +66,17 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
46
66
|
"z8tnut": "f1nbblvp",
|
|
47
67
|
"z189sj": ["f1vdfbxk", "f1f5gg8d"],
|
|
48
68
|
"Byoj8tv": "f1ov4xf1",
|
|
49
|
-
"uwmqm3": ["f1f5gg8d", "f1vdfbxk"]
|
|
69
|
+
"uwmqm3": ["f1f5gg8d", "f1vdfbxk"],
|
|
70
|
+
"Bn4voq9": "fz36nt7",
|
|
71
|
+
"g9k6zt": "f9znhxp",
|
|
72
|
+
"Bfpq7zp": "fqrak0z",
|
|
73
|
+
"kdpuga": ["f1o2ludy", "f1kjnpwc"],
|
|
74
|
+
"Bw81rd7": ["f1kjnpwc", "f1o2ludy"],
|
|
75
|
+
"B6xbmo0": ["fxmnebo", "f1witrsb"],
|
|
76
|
+
"dm238s": ["f1witrsb", "fxmnebo"]
|
|
50
77
|
}
|
|
51
78
|
}, {
|
|
52
|
-
"d": [".f10pi13n{position:relative;}", ".f1nbblvp{padding-top:0px;}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1ov4xf1{padding-bottom:0px;}"]
|
|
79
|
+
"d": [".f10pi13n{position:relative;}", ".f1nbblvp{padding-top:0px;}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1ov4xf1{padding-bottom:0px;}", ".fz36nt7[data-fui-focus-visible]{outline-width:2px;}", ".f9znhxp[data-fui-focus-visible]{outline-style:solid;}", ".fqrak0z[data-fui-focus-visible]{outline-color:var(--colorStrokeFocus2);}", ".f1o2ludy[data-fui-focus-visible]{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f1kjnpwc[data-fui-focus-visible]{border-bottom-left-radius:var(--borderRadiusMedium);}", ".fxmnebo[data-fui-focus-visible]{border-top-right-radius:var(--borderRadiusMedium);}", ".f1witrsb[data-fui-focus-visible]{border-top-left-radius:var(--borderRadiusMedium);}"]
|
|
53
80
|
});
|
|
54
81
|
/**
|
|
55
82
|
* Apply styling to the TableCell slots based on the state
|
|
@@ -62,7 +89,7 @@ const useTableCellStyles_unstable = state => {
|
|
|
62
89
|
table: useTableLayoutStyles(),
|
|
63
90
|
flex: useFlexLayoutStyles()
|
|
64
91
|
};
|
|
65
|
-
state.root.className = react_1.mergeClasses(exports.tableCellClassNames.root, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.root.className);
|
|
92
|
+
state.root.className = react_1.mergeClasses(exports.tableCellClassNames.root, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.noNativeElements ? layoutStyles.flex[state.size] : layoutStyles.table[state.size], state.root.className);
|
|
66
93
|
return state;
|
|
67
94
|
};
|
|
68
95
|
|