@fluentui/react-table 9.0.0-alpha.12 → 9.0.0-alpha.14
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 +227 -1
- package/CHANGELOG.md +50 -2
- package/dist/index.d.ts +103 -53
- package/lib/components/DataGrid/DataGrid.types.js.map +1 -1
- package/lib/components/DataGrid/useDataGrid.js +30 -6
- 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/DataGridCell/useDataGridCell.js +1 -1
- package/lib/components/DataGridCell/useDataGridCell.js.map +1 -1
- package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js +25 -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 +62 -5
- 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 +37 -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 +11 -6
- package/lib/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js +17 -7
- 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 +14 -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 +12 -6
- 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 +30 -6
- 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/DataGridCell/useDataGridCell.js +1 -1
- package/lib-commonjs/components/DataGridCell/useDataGridCell.js.map +1 -1
- package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js +29 -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 +69 -5
- 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 +41 -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 +11 -5
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
- package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js +18 -7
- 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 +14 -29
- package/lib-commonjs/components/TableRow/useTableRowStyles.js.map +1 -1
- package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js +13 -6
- 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 +10 -9
- 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
|
@@ -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.tableHeaderCellClassName = 'fui-TableHeaderCell';
|
|
13
15
|
exports.tableHeaderCellClassNames = {
|
|
14
16
|
root: 'fui-TableHeaderCell',
|
|
@@ -46,7 +48,14 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
46
48
|
"z8tnut": "f1nbblvp",
|
|
47
49
|
"z189sj": ["f1vdfbxk", "f1f5gg8d"],
|
|
48
50
|
"Byoj8tv": "f1ov4xf1",
|
|
49
|
-
"uwmqm3": ["f1f5gg8d", "f1vdfbxk"]
|
|
51
|
+
"uwmqm3": ["f1f5gg8d", "f1vdfbxk"],
|
|
52
|
+
"B3nxjsc": "fhix6mv",
|
|
53
|
+
"Bmvh20x": "fha7anx",
|
|
54
|
+
"robkg1": "f1fmzww4",
|
|
55
|
+
"pehzd3": ["fs9qmxf", "f187m4uq"],
|
|
56
|
+
"B8osjzx": ["f187m4uq", "fs9qmxf"],
|
|
57
|
+
"u7xebq": ["f145mzao", "f1uha7eq"],
|
|
58
|
+
"Blsv9te": ["f1uha7eq", "f145mzao"]
|
|
50
59
|
},
|
|
51
60
|
"rootInteractive": {
|
|
52
61
|
"Jwef8y": "f1t94bn6",
|
|
@@ -80,21 +89,23 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
80
89
|
"Bh6795r": "fqerorx",
|
|
81
90
|
"Bqenvij": "f1l02sjl",
|
|
82
91
|
"Bt984gj": "f122n59",
|
|
83
|
-
"i8kkvl": "
|
|
84
|
-
"Belr9w4": "
|
|
85
|
-
"sshi5w": "
|
|
92
|
+
"i8kkvl": "f1ufnopg",
|
|
93
|
+
"Belr9w4": "f14sijuj",
|
|
94
|
+
"sshi5w": "f1nxs5xn",
|
|
86
95
|
"Bnnss6s": "f1neuvcm",
|
|
87
|
-
"xawz": "fkjuxzh"
|
|
96
|
+
"xawz": "fkjuxzh",
|
|
97
|
+
"oeaueh": "f1s6fcnf"
|
|
88
98
|
},
|
|
89
99
|
"sortable": {
|
|
90
100
|
"Bceei9c": "f1k6fduh"
|
|
91
101
|
},
|
|
92
102
|
"sortIcon": {
|
|
93
103
|
"mc9l5x": "f22iagw",
|
|
94
|
-
"Bt984gj": "f122n59"
|
|
104
|
+
"Bt984gj": "f122n59",
|
|
105
|
+
"z8tnut": "fclwglc"
|
|
95
106
|
}
|
|
96
107
|
}, {
|
|
97
|
-
"d": [".f1nbblvp{padding-top:0px;}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1ov4xf1{padding-bottom:0px;}", ".fq6nmtn{resize:horizontal;}", ".f1e4lqlz{box-sizing:content-box;}", ".f1u2r49w{background-color:inherit;}", ".f1ym3bx4{color:inherit;}", ".f1mo0ibp{font-family:inherit;}", ".fjoy568{font-size:inherit;}", ".fytdu2e{line-height:normal;}", ".f1mtd64y{overflow-x:visible;}", ".f1y7q3j9{overflow-y:visible;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".f1ern45e{border-top-style:none;}", ".f1n71otn{border-right-style:none;}", ".f1deefiw{border-left-style:none;}", ".f1h8hb77{border-bottom-style:none;}", ".f37px4s{-webkit-appearance:button;}", ".fgusgyc{text-align:unset;}", ".f10pi13n{position:relative;}", ".fly5x3f{width:100%;}", ".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".fqerorx{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".f1l02sjl{height:100%;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".
|
|
108
|
+
"d": [".f1nbblvp{padding-top:0px;}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f1ov4xf1{padding-bottom:0px;}", ".fhix6mv[data-fui-focus-within]:focus-within{outline-width:2px;}", ".fha7anx[data-fui-focus-within]:focus-within{outline-style:solid;}", ".f1fmzww4[data-fui-focus-within]:focus-within{outline-color:var(--colorStrokeFocus2);}", ".fs9qmxf[data-fui-focus-within]:focus-within{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f187m4uq[data-fui-focus-within]:focus-within{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f145mzao[data-fui-focus-within]:focus-within{border-top-right-radius:var(--borderRadiusMedium);}", ".f1uha7eq[data-fui-focus-within]:focus-within{border-top-left-radius:var(--borderRadiusMedium);}", ".fq6nmtn{resize:horizontal;}", ".f1e4lqlz{box-sizing:content-box;}", ".f1u2r49w{background-color:inherit;}", ".f1ym3bx4{color:inherit;}", ".f1mo0ibp{font-family:inherit;}", ".fjoy568{font-size:inherit;}", ".fytdu2e{line-height:normal;}", ".f1mtd64y{overflow-x:visible;}", ".f1y7q3j9{overflow-y:visible;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".f1ern45e{border-top-style:none;}", ".f1n71otn{border-right-style:none;}", ".f1deefiw{border-left-style:none;}", ".f1h8hb77{border-bottom-style:none;}", ".f37px4s{-webkit-appearance:button;}", ".fgusgyc{text-align:unset;}", ".f10pi13n{position:relative;}", ".fly5x3f{width:100%;}", ".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".fqerorx{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".f1l02sjl{height:100%;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".f1ufnopg{-webkit-column-gap:var(--spacingHorizontalXS);column-gap:var(--spacingHorizontalXS);}", ".f14sijuj{row-gap:var(--spacingHorizontalXS);}", ".f1nxs5xn{min-height:32px;}", ".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;}", ".f1s6fcnf{outline-style:none;}", ".f1k6fduh{cursor:pointer;}", ".fclwglc{padding-top:var(--spacingVerticalXXS);}"],
|
|
98
109
|
"h": [".f1t94bn6:hover{background-color:var(--colorSubtleBackgroundHover);}"],
|
|
99
110
|
"a": [".f1wfn5kd:active{background-color:var(--colorSubtleBackgroundPressed);}"]
|
|
100
111
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableHeaderCell/useTableHeaderCellStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableHeaderCell/useTableHeaderCellStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAEA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AAGa,OAAA,CAAA,wBAAA,GAA2B,qBAA3B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JhD,EAKrB,KAAK,CAAC,IAAN,CAAW,SALU,CAAvB;EAOA,KAAK,CAAC,MAAN,CAAa,SAAb,GAAyB,OAAA,CAAA,YAAA,CACvB,OAAA,CAAA,yBAAA,CAA0B,MADH,EAEvB,MAAM,CAAC,WAFgB,EAGvB,MAAM,CAAC,MAHgB,EAIvB,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,QAJF,EAKvB,KAAK,CAAC,MAAN,CAAa,SALU,CAAzB;;EAQA,IAAI,KAAK,CAAC,QAAV,EAAoB;IAClB,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,OAAA,CAAA,YAAA,CACzB,OAAA,CAAA,yBAAA,CAA0B,QADD,EAEzB,MAAM,CAAC,QAFkB,EAGzB,KAAK,CAAC,QAAN,CAAe,SAHU,CAA3B;EAKD;;EAED,OAAO,KAAP;AACD,CA9BM;;AAAM,OAAA,CAAA,iCAAA,GAAiC,iCAAjC","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport type { TableHeaderCellSlots, TableHeaderCellState } from './TableHeaderCell.types';\n\nexport const tableHeaderCellClassName = 'fui-TableHeaderCell';\nexport const tableHeaderCellClassNames: SlotClassNames<TableHeaderCellSlots> = {\n root: 'fui-TableHeaderCell',\n button: 'fui-TableHeaderCell__button',\n sortIcon: 'fui-TableHeaderCell__sortIcon',\n};\n\nconst useTableLayoutStyles = makeStyles({\n root: {\n display: 'table-cell',\n verticalAlign: 'middle',\n },\n});\n\nconst useFlexLayoutStyles = makeStyles({\n root: {\n display: 'flex',\n ...shorthands.flex(1, 1, '0px'),\n minWidth: '0px',\n },\n});\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n ...shorthands.padding('0px', tokens.spacingHorizontalS),\n ...createCustomFocusIndicatorStyle(\n {\n ...shorthands.outline('2px', 'solid', tokens.colorStrokeFocus2),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n },\n { selector: 'focus-within', enableOutline: true },\n ),\n },\n\n rootInteractive: {\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n },\n },\n\n resetButton: {\n resize: 'horizontal',\n boxSizing: 'content-box',\n backgroundColor: 'inherit',\n color: 'inherit',\n fontFamily: 'inherit',\n fontSize: 'inherit',\n lineHeight: 'normal',\n ...shorthands.overflow('visible'),\n ...shorthands.padding(0),\n ...shorthands.borderStyle('none'),\n WebkitAppearance: 'button',\n textAlign: 'unset',\n },\n button: {\n position: 'relative',\n width: '100%',\n display: 'flex',\n flexGrow: 1,\n height: '100%',\n alignItems: 'center',\n ...shorthands.gap(tokens.spacingHorizontalXS),\n minHeight: '32px',\n ...shorthands.flex(1, 1, '0px'),\n outlineStyle: 'none',\n },\n sortable: {\n cursor: 'pointer',\n },\n\n sortIcon: {\n display: 'flex',\n alignItems: 'center',\n paddingTop: tokens.spacingVerticalXXS,\n },\n});\n\n/**\n * Apply styling to the TableHeaderCell slots based on the state\n */\nexport const useTableHeaderCellStyles_unstable = (state: TableHeaderCellState): TableHeaderCellState => {\n const styles = useStyles();\n const layoutStyles = {\n table: useTableLayoutStyles(),\n flex: useFlexLayoutStyles(),\n };\n state.root.className = mergeClasses(\n tableHeaderCellClassNames.root,\n styles.root,\n state.sortable && styles.rootInteractive,\n state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root,\n state.root.className,\n );\n state.button.className = mergeClasses(\n tableHeaderCellClassNames.button,\n styles.resetButton,\n styles.button,\n state.sortable && styles.sortable,\n state.button.className,\n );\n\n if (state.sortIcon) {\n state.sortIcon.className = mergeClasses(\n tableHeaderCellClassNames.sortIcon,\n styles.sortIcon,\n state.sortIcon.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -30,12 +30,13 @@ const useTableRow_unstable = (props, ref) => {
|
|
|
30
30
|
} = tableContext_1.useTableContext();
|
|
31
31
|
const rootComponent = ((_a = props.as) !== null && _a !== void 0 ? _a : noNativeElements) ? 'div' : 'tr';
|
|
32
32
|
const focusVisibleRef = react_tabster_1.useFocusVisible();
|
|
33
|
+
const focusWithinRef = react_tabster_1.useFocusWithin();
|
|
33
34
|
return {
|
|
34
35
|
components: {
|
|
35
36
|
root: rootComponent
|
|
36
37
|
},
|
|
37
38
|
root: react_utilities_1.getNativeElementProps(rootComponent, {
|
|
38
|
-
ref: react_utilities_1.useMergedRefs(ref, focusVisibleRef),
|
|
39
|
+
ref: react_utilities_1.useMergedRefs(ref, focusVisibleRef, focusWithinRef),
|
|
39
40
|
role: rootComponent === 'div' ? 'row' : undefined,
|
|
40
41
|
...props
|
|
41
42
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableRow/useTableRow.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,oBAAoB,GAAG,CAAC,KAAD,EAAuB,GAAvB,KAAqE;;;EACvG,MAAM;IAAE,gBAAF;IAAoB;EAApB,IAA6B,cAAA,CAAA,eAAA,EAAnC;EACA,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;EACA,MAAM,eAAe,GAAG,eAAA,CAAA,eAAA,EAAxB;EAEA,OAAO;IACL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CADP;IAIL,IAAI,EAAE,iBAAA,CAAA,q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aAAa,KAAK,KAAlB,GAA0B,KAA1B,GAAkC,SAFC;MAGzC,GAAG;IAHsC,CAArC,CAJD;IASL,IATK;IAUL,gBAVK;IAWL,UAAU,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,UAAN,MAAgB,IAAhB,IAAgB,EAAA,KAAA,KAAA,CAAhB,GAAgB,EAAhB,GAAoB;EAX3B,CAAP;AAaD,CAnBM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs } from '@fluentui/react-utilities';\nimport type { TableRowProps, TableRowState } from './TableRow.types';\nimport { useTableContext } from '../../contexts/tableContext';\nimport { useFocusVisible, useFocusWithin } from '@fluentui/react-tabster';\n\n/**\n * Create the state required to render TableRow.\n *\n * The returned state can be modified with hooks such as useTableRowStyles_unstable,\n * before being passed to renderTableRow_unstable.\n *\n * @param props - props from this instance of TableRow\n * @param ref - reference to root HTMLElement of TableRow\n */\nexport const useTableRow_unstable = (props: TableRowProps, ref: React.Ref<HTMLElement>): TableRowState => {\n const { noNativeElements, size } = useTableContext();\n const rootComponent = props.as ?? noNativeElements ? 'div' : 'tr';\n const focusVisibleRef = useFocusVisible();\n const focusWithinRef = useFocusWithin();\n\n return {\n components: {\n root: rootComponent,\n },\n root: getNativeElementProps(rootComponent, {\n ref: useMergedRefs(ref, focusVisibleRef, focusWithinRef),\n role: rootComponent === 'div' ? 'row' : undefined,\n ...props,\n }),\n size,\n noNativeElements,\n appearance: props.appearance ?? 'none',\n };\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -25,36 +25,18 @@ exports.tableRowClassNames = {
|
|
|
25
25
|
const useTableLayoutStyles = /*#__PURE__*/react_1.__styles({
|
|
26
26
|
"root": {
|
|
27
27
|
"mc9l5x": "f1u0rzck"
|
|
28
|
-
},
|
|
29
|
-
"medium": {
|
|
30
|
-
"Bqenvij": "f1ft4266"
|
|
31
|
-
},
|
|
32
|
-
"small": {
|
|
33
|
-
"Bqenvij": "fbsu25e"
|
|
34
|
-
},
|
|
35
|
-
"smaller": {
|
|
36
|
-
"Bqenvij": "frvgh55"
|
|
37
28
|
}
|
|
38
29
|
}, {
|
|
39
|
-
"d": [".f1u0rzck{display:table-row;}"
|
|
30
|
+
"d": [".f1u0rzck{display:table-row;}"]
|
|
40
31
|
});
|
|
41
32
|
|
|
42
33
|
const useFlexLayoutStyles = /*#__PURE__*/react_1.__styles({
|
|
43
34
|
"root": {
|
|
44
35
|
"mc9l5x": "f22iagw",
|
|
45
36
|
"Bt984gj": "f122n59"
|
|
46
|
-
},
|
|
47
|
-
"medium": {
|
|
48
|
-
"sshi5w": "f5pgtk9"
|
|
49
|
-
},
|
|
50
|
-
"small": {
|
|
51
|
-
"sshi5w": "fcep9tg"
|
|
52
|
-
},
|
|
53
|
-
"smaller": {
|
|
54
|
-
"sshi5w": "f1pha7fy"
|
|
55
37
|
}
|
|
56
38
|
}, {
|
|
57
|
-
"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;}"
|
|
39
|
+
"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;}"]
|
|
58
40
|
});
|
|
59
41
|
/**
|
|
60
42
|
* Styles for the root slot
|
|
@@ -65,26 +47,30 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
65
47
|
"root": {
|
|
66
48
|
"sj55zd": "f19n0e5",
|
|
67
49
|
"B7ck84d": "f1ewtqcl",
|
|
68
|
-
"
|
|
50
|
+
"Bconypa": "f1jazu75",
|
|
51
|
+
"B6guboy": "f1xeqee6",
|
|
69
52
|
"Bn4voq9": "fz36nt7",
|
|
70
53
|
"g9k6zt": "f9znhxp",
|
|
54
|
+
"Bfpq7zp": "fqrak0z",
|
|
71
55
|
"kdpuga": ["f1o2ludy", "f1kjnpwc"],
|
|
72
56
|
"Bw81rd7": ["f1kjnpwc", "f1o2ludy"],
|
|
73
57
|
"B6xbmo0": ["fxmnebo", "f1witrsb"],
|
|
74
58
|
"dm238s": ["f1witrsb", "fxmnebo"]
|
|
75
59
|
},
|
|
60
|
+
"noAppearanceFocusWithin": {
|
|
61
|
+
"B5tto1x": "fgfzuaq",
|
|
62
|
+
"Bm5rygw": "f13cic75"
|
|
63
|
+
},
|
|
76
64
|
"rootInteractive": {
|
|
77
65
|
"ecr2s2": "f1wfn5kd",
|
|
78
66
|
"lj723h": "f1g4hkjv",
|
|
79
67
|
"Bw1l9kw": "flaujjr",
|
|
80
68
|
"B43xm9u": "f15ngxrw",
|
|
81
|
-
"Bs8fhbl": "f18sq9la",
|
|
82
69
|
"i921ia": "fjbbrdp",
|
|
83
70
|
"Jwef8y": "f1t94bn6",
|
|
84
71
|
"Bi91k9c": "feu1g3u",
|
|
85
72
|
"Bi7d7a3": "f14h8iit",
|
|
86
73
|
"Bpt6rm4": "f1uorfem",
|
|
87
|
-
"Bt8cqyk": "f1fcpt6",
|
|
88
74
|
"ff6mpl": "fw60kww"
|
|
89
75
|
},
|
|
90
76
|
"medium": {
|
|
@@ -97,7 +83,7 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
97
83
|
"oivjwe": "fg706s2",
|
|
98
84
|
"B9xav0g": "frpde29"
|
|
99
85
|
},
|
|
100
|
-
"
|
|
86
|
+
"extra-small": {
|
|
101
87
|
"Be2twd7": "fy9rknc"
|
|
102
88
|
},
|
|
103
89
|
"brand": {
|
|
@@ -149,7 +135,6 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
149
135
|
"yadkgm": "f1e0wld5",
|
|
150
136
|
"De3pzq": "fq5gl1p",
|
|
151
137
|
"sj55zd": "f1cgsbmv",
|
|
152
|
-
"Jwef8y": "f1uqaxdt",
|
|
153
138
|
"ecr2s2": "fa9o754",
|
|
154
139
|
"g2u3we": "frmsihh",
|
|
155
140
|
"h3c5rm": ["frttxa5", "f11o2r7f"],
|
|
@@ -158,9 +143,9 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
158
143
|
},
|
|
159
144
|
"none": {}
|
|
160
145
|
}, {
|
|
161
|
-
"d": [".f19n0e5{color:var(--colorNeutralForeground1);}", ".f1ewtqcl{box-sizing:border-box;}", ".
|
|
162
|
-
"a": [".f1wfn5kd:active{background-color:var(--colorSubtleBackgroundPressed);}", ".f1g4hkjv:active{color:var(--colorNeutralForeground1Pressed);}", ".flaujjr:active .fui-TableCellActions{background-color:var(--colorSubtleBackgroundPressed);}", ".f15ngxrw:active .fui-TableCellActions{opacity:1;}", ".
|
|
163
|
-
"h": [".f1t94bn6:hover{background-color:var(--colorSubtleBackgroundHover);}", ".feu1g3u:hover{color:var(--colorNeutralForeground1Hover);}", ".f14h8iit:hover .fui-TableCellActions{background-color:var(--colorSubtleBackgroundHover);}", ".f1uorfem:hover .fui-TableCellActions{opacity:1;}", ".
|
|
146
|
+
"d": [".f19n0e5{color:var(--colorNeutralForeground1);}", ".f1ewtqcl{box-sizing:border-box;}", ".f1jazu75[data-fui-focus-within]:focus-within .fui-TableSelectionCell{opacity:1;}", ".f1xeqee6[data-fui-focus-within]:focus-within .fui-TableCellActions{opacity:1;}", ".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);}", ".fgfzuaq[data-fui-focus-within]:focus-within .fui-TableCellActions{background-color:var(--colorSubtleBackgroundHover);}", ".f13cic75[data-fui-focus-within]:focus-within{background-color:var(--colorSubtleBackgroundHover);}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".fg706s2{border-bottom-style:solid;}", ".frpde29{border-bottom-color:var(--colorNeutralStroke2);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".f16xkysk{background-color:var(--colorBrandBackground2);}", ".f1cgsbmv{color:var(--colorNeutralForeground1Hover);}", ".frmsihh{border-top-color:var(--colorNeutralStrokeOnBrand);}", ".frttxa5{border-right-color:var(--colorNeutralStrokeOnBrand);}", ".f11o2r7f{border-left-color:var(--colorNeutralStrokeOnBrand);}", ".fem5et0{border-bottom-color:var(--colorNeutralStrokeOnBrand);}", ".fq5gl1p{background-color:var(--colorSubtleBackgroundSelected);}"],
|
|
147
|
+
"a": [".f1wfn5kd:active{background-color:var(--colorSubtleBackgroundPressed);}", ".f1g4hkjv:active{color:var(--colorNeutralForeground1Pressed);}", ".flaujjr:active .fui-TableCellActions{background-color:var(--colorSubtleBackgroundPressed);}", ".f15ngxrw:active .fui-TableCellActions{opacity:1;}", ".fjbbrdp:active .fui-TableSelectionCell{opacity:1;}", ".ftepret:active{background-color:var(--colorBrandBackgroundInvertedSelected);}", ".fa9o754:active{background-color:var(--colorSubtleBackgroundSelected);}"],
|
|
148
|
+
"h": [".f1t94bn6:hover{background-color:var(--colorSubtleBackgroundHover);}", ".feu1g3u:hover{color:var(--colorNeutralForeground1Hover);}", ".f14h8iit:hover .fui-TableCellActions{background-color:var(--colorSubtleBackgroundHover);}", ".f1uorfem:hover .fui-TableCellActions{opacity:1;}", ".fw60kww:hover .fui-TableSelectionCell{opacity:1;}", ".f121v1wq:hover{background-color:var(--colorBrandBackground2);}"],
|
|
164
149
|
"m": [["@media (forced-colors: active){.fqlf3fd{border-top-width:2px;}}", {
|
|
165
150
|
"m": "(forced-colors: active)"
|
|
166
151
|
}], ["@media (forced-colors: active){.f9dpb3h{border-right-width:2px;}.fw2muls{border-left-width:2px;}}", {
|
|
@@ -247,7 +232,7 @@ const useTableRowStyles_unstable = state => {
|
|
|
247
232
|
table: useTableLayoutStyles(),
|
|
248
233
|
flex: useFlexLayoutStyles()
|
|
249
234
|
};
|
|
250
|
-
state.root.className = react_1.mergeClasses(exports.tableRowClassNames.root, styles.root, !isHeaderRow && styles.rootInteractive, styles[state.size], state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root,
|
|
235
|
+
state.root.className = react_1.mergeClasses(exports.tableRowClassNames.root, styles.root, !isHeaderRow && styles.rootInteractive, styles[state.size], state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, styles[state.appearance], state.appearance === 'none' && !isHeaderRow && styles.noAppearanceFocusWithin, state.root.className);
|
|
251
236
|
return state;
|
|
252
237
|
};
|
|
253
238
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableRow/useTableRowStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAGA,MAAA,2BAAA,gBAAA,OAAA,CAAA,+CAAA,CAAA;;AACA,MAAA,6BAAA,gBAAA,OAAA,CAAA,mDAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,oBAAA,gBAAA,OAAA,CAAA,mCAAA,CAAA;;AAEa,OAAA,CAAA,iBAAA,GAAoB,cAApB;AACA,OAAA,CAAA,kBAAA,GAAoD;EAC/D,IAAI,EAAE,OAAA,CAAA;AADyD,CAApD;;AAIb,MAAM,oBAAoB,gBAAG,OAAA,SAAA;EAAA;IAAA;EAAA;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/components/TableRow/useTableRowStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OA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} from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { TableRowSlots, TableRowState } from './TableRow.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tableCellActionsClassNames } from '../TableCellActions/useTableCellActionsStyles';\nimport { tableSelectionCellClassNames } from '../TableSelectionCell/useTableSelectionCellStyles';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\n\nexport const tableRowClassName = 'fui-TableRow';\nexport const tableRowClassNames: SlotClassNames<TableRowSlots> = {\n root: tableRowClassName,\n};\n\nconst useTableLayoutStyles = makeStyles({\n root: {\n display: 'table-row',\n },\n});\n\nconst useFlexLayoutStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n },\n});\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n color: tokens.colorNeutralForeground1,\n boxSizing: 'border-box',\n ...createCustomFocusIndicatorStyle(\n {\n [`& .${tableSelectionCellClassNames.root}`]: {\n opacity: 1,\n },\n [`& .${tableCellActionsClassNames.root}`]: {\n opacity: 1,\n },\n },\n { selector: 'focus-within', enableOutline: true },\n ),\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 // When focus is within the row the background colour\n // should be the same as hover, except when there is a brand\n // or neutral appearance applied on the row\n noAppearanceFocusWithin: {\n ...createCustomFocusIndicatorStyle(\n {\n [`& .${tableCellActionsClassNames.root}`]: {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n\n backgroundColor: tokens.colorSubtleBackgroundHover,\n },\n { selector: 'focus-within', enableOutline: true },\n ),\n },\n\n rootInteractive: {\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n color: tokens.colorNeutralForeground1Pressed,\n [`& .${tableCellActionsClassNames.root}`]: {\n backgroundColor: tokens.colorSubtleBackgroundPressed,\n opacity: 1,\n },\n [`& .${tableSelectionCellClassNames.root}`]: {\n opacity: 1,\n },\n },\n ':hover': {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n color: tokens.colorNeutralForeground1Hover,\n [`& .${tableCellActionsClassNames.root}`]: {\n backgroundColor: tokens.colorSubtleBackgroundHover,\n opacity: 1,\n },\n [`& .${tableSelectionCellClassNames.root}`]: {\n opacity: 1,\n },\n },\n },\n\n medium: {\n ...shorthands.borderBottom(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke2),\n },\n\n small: {\n ...shorthands.borderBottom(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke2),\n },\n\n 'extra-small': {\n fontSize: tokens.fontSizeBase200,\n },\n\n brand: {\n backgroundColor: tokens.colorBrandBackground2,\n color: tokens.colorNeutralForeground1Hover,\n ...shorthands.borderColor(tokens.colorNeutralStrokeOnBrand),\n ':hover': {\n backgroundColor: tokens.colorBrandBackground2,\n },\n ':active': {\n backgroundColor: tokens.colorBrandBackgroundInvertedSelected,\n },\n\n '@media(forced-colors: active)': {\n ...shorthands.border('2px', 'solid', 'transparent'),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n boxSizing: 'border-box',\n ':focus-visible': {\n outlineOffset: '-4px',\n },\n },\n },\n\n neutral: {\n '@media(forced-colors: active)': {\n ...shorthands.border('2px', 'solid', 'transparent'),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n boxSizing: 'border-box',\n ':focus-visible': {\n outlineOffset: '-4px',\n },\n },\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n color: tokens.colorNeutralForeground1Hover,\n\n ':active': {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n },\n ...shorthands.borderColor(tokens.colorNeutralStrokeOnBrand),\n },\n\n none: {},\n});\n\n/**\n * Apply styling to the TableRow slots based on the state\n */\nexport const useTableRowStyles_unstable = (state: TableRowState): TableRowState => {\n const isHeaderRow = useIsInTableHeader();\n const styles = useStyles();\n const layoutStyles = {\n table: useTableLayoutStyles(),\n flex: useFlexLayoutStyles(),\n };\n state.root.className = mergeClasses(\n tableRowClassNames.root,\n styles.root,\n !isHeaderRow && styles.rootInteractive,\n styles[state.size],\n state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root,\n styles[state.appearance],\n state.appearance === 'none' && !isHeaderRow && styles.noAppearanceFocusWithin,\n state.root.className,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -9,6 +9,8 @@ const react_1 = /*#__PURE__*/require("@griffel/react");
|
|
|
9
9
|
|
|
10
10
|
const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
|
|
11
11
|
|
|
12
|
+
const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
|
|
13
|
+
|
|
12
14
|
exports.tableSelectionCellClassNames = {
|
|
13
15
|
root: 'fui-TableSelectionCell',
|
|
14
16
|
checkboxIndicator: 'fui-TableSelectionCell__checkboxIndicator',
|
|
@@ -49,27 +51,32 @@ const useStyles = /*#__PURE__*/react_1.__styles({
|
|
|
49
51
|
"z8tnut": "f1g0x7ka",
|
|
50
52
|
"z189sj": ["fhxju0i", "f1cnd47f"],
|
|
51
53
|
"Byoj8tv": "f1qch9an",
|
|
52
|
-
"uwmqm3": ["f1cnd47f", "fhxju0i"]
|
|
54
|
+
"uwmqm3": ["f1cnd47f", "fhxju0i"],
|
|
55
|
+
"Bn4voq9": "fz36nt7",
|
|
56
|
+
"g9k6zt": "f9znhxp",
|
|
57
|
+
"Bfpq7zp": "fqrak0z",
|
|
58
|
+
"kdpuga": ["f1o2ludy", "f1kjnpwc"],
|
|
59
|
+
"Bw81rd7": ["f1kjnpwc", "f1o2ludy"],
|
|
60
|
+
"B6xbmo0": ["fxmnebo", "f1witrsb"],
|
|
61
|
+
"dm238s": ["f1witrsb", "fxmnebo"]
|
|
53
62
|
},
|
|
54
63
|
"radioIndicator": {
|
|
55
64
|
"mc9l5x": "f22iagw",
|
|
56
65
|
"Bh6795r": "fqerorx",
|
|
57
66
|
"Bt984gj": "f122n59",
|
|
58
|
-
"Brf1p80": "f4d9j23"
|
|
59
|
-
"B5pe6w7": "f1cqkysu",
|
|
60
|
-
"p4uzdd": "f1sgf1mg"
|
|
67
|
+
"Brf1p80": "f4d9j23"
|
|
61
68
|
},
|
|
62
69
|
"subtle": {
|
|
63
70
|
"abs64n": "fk73vx1",
|
|
64
71
|
"Brovlpu": "ftqa4ok",
|
|
65
72
|
"B486eqv": "f2hkw1w",
|
|
66
|
-
"
|
|
73
|
+
"B8a84jv": "f1y7ij6c"
|
|
67
74
|
},
|
|
68
75
|
"hidden": {
|
|
69
76
|
"Bcdw1i0": "fd7fpy0"
|
|
70
77
|
}
|
|
71
78
|
}, {
|
|
72
|
-
"d": [".f17mccla{text-align:center;}", ".fz5stix{white-space:nowrap;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".fqerorx{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}", ".
|
|
79
|
+
"d": [".f17mccla{text-align:center;}", ".fz5stix{white-space:nowrap;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".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);}", ".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".fqerorx{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}", ".fk73vx1{opacity:0;}", ".f1y7ij6c[data-fui-focus-within]:focus-within{opacity:1;}", ".fd7fpy0{visibility:hidden;}"],
|
|
73
80
|
"f": [".ftqa4ok:focus{outline-style:none;}"],
|
|
74
81
|
"i": [".f2hkw1w:focus-visible{outline-style:none;}"]
|
|
75
82
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/components/TableSelectionCell/useTableSelectionCellStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAGA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AAEa,OAAA,CAAA,4BAAA,GAAwE;EACnF,IAAI,EAAE,wBAD6E;EAEnF,iBAAiB,EAAE,2CAFgE;EAGnF,cAAc,EAAE;AAHmE,CAAxE;;AAMb,MAAM,oBAAoB,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAA7B;;AAOA,MAAM,mBAAmB,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAA5B;AAUA;;AAEG;;;AACH,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;
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kD,YAAY,CAAC,KAAb,CAAmB,IAHhD,EAIrB,KAAK,CAAC,MAAN,IAAgB,KAAK,CAAC,OAAN,KAAkB,KAAlC,IAA2C,MAAM,CAAC,MAJ7B,EAKrB,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,MALF,EAMrB,KAAK,CAAC,IAAN,CAAW,SANU,CAAvB;;EAQA,IAAI,KAAK,CAAC,iBAAV,EAA6B;IAC3B,KAAK,CAAC,iBAAN,CAAwB,SAAxB,GAAoC,OAAA,CAAA,YAAA,CAClC,OAAA,CAAA,4BAAA,CAA6B,iBADK,EAElC,KAAK,CAAC,iBAAN,CAAwB,SAFU,CAApC;EAID;;EAED,IAAI,KAAK,CAAC,cAAV,EAA0B;IACxB,KAAK,CAAC,cAAN,CAAqB,SAArB,GAAiC,OAAA,CAAA,YAAA,CAC/B,OAAA,CAAA,4BAAA,CAA6B,cADE,EAE/B,MAAM,CAAC,cAFwB,EAG/B,KAAK,CAAC,cAAN,CAAqB,SAHU,CAAjC;EAKD;;EAED,OAAO,KAAP;AACD,CA9BM;;AAAM,OAAA,CAAA,oCAAA,GAAoC,oCAApC","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 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: '44px',\n },\n});\n\nconst useFlexLayoutStyles = makeStyles({\n root: {\n display: 'flex',\n ...shorthands.flex(1, 1, '0px'),\n minWidth: '44px',\n maxWidth: '44px',\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"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColumnIdContextProvider = exports.useColumnIdContext = exports.columnIdContextDefaultValue = void 0;
|
|
7
|
+
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
|
+
|
|
10
|
+
const columnIdContext = /*#__PURE__*/React.createContext(undefined);
|
|
11
|
+
exports.columnIdContextDefaultValue = '';
|
|
12
|
+
|
|
13
|
+
const useColumnIdContext = () => {
|
|
14
|
+
var _a;
|
|
15
|
+
|
|
16
|
+
return (_a = React.useContext(columnIdContext)) !== null && _a !== void 0 ? _a : exports.columnIdContextDefaultValue;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.useColumnIdContext = useColumnIdContext;
|
|
20
|
+
exports.ColumnIdContextProvider = columnIdContext.Provider;
|
|
21
|
+
//# sourceMappingURL=columnIdContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/contexts/columnIdContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAGA,MAAM,eAAe,gBAAG,KAAK,CAAC,aAAN,CAA0C,SAA1C,CAAxB;AAEa,OAAA,CAAA,2BAAA,GAA8B,EAA9B;;AAEN,MAAM,kBAAkB,GAAG,MAAK;EAAA,IAAA,EAAA;;EAAC,OAAA,CAAA,EAAA,GAAA,KAAK,CAAC,UAAN,CAAiB,eAAjB,CAAA,MAAiC,IAAjC,IAAiC,EAAA,KAAA,KAAA,CAAjC,GAAiC,EAAjC,GAAqC,OAAA,CAAA,2BAArC;AAAgE,CAAjG;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB;AAEA,OAAA,CAAA,uBAAA,GAA0B,eAAe,CAAC,QAA1C","sourcesContent":["import * as React from 'react';\nimport type { ColumnId } from '../hooks/';\n\nconst columnIdContext = React.createContext<ColumnId | undefined>(undefined);\n\nexport const columnIdContextDefaultValue = '';\n\nexport const useColumnIdContext = () => React.useContext(columnIdContext) ?? columnIdContextDefaultValue;\n\nexport const ColumnIdContextProvider = columnIdContext.Provider;\n"],"sourceRoot":"../src/"}
|
|
@@ -11,6 +11,9 @@ const hooks_1 = /*#__PURE__*/require("../hooks");
|
|
|
11
11
|
|
|
12
12
|
const dataGridContext = /*#__PURE__*/react_context_selector_1.createContext(undefined);
|
|
13
13
|
const dataGridContextDefaultValue = { ...hooks_1.defaultTableState,
|
|
14
|
+
subtleSelection: false,
|
|
15
|
+
selectableRows: false,
|
|
16
|
+
selectionAppearance: 'brand',
|
|
14
17
|
focusMode: 'none'
|
|
15
18
|
};
|
|
16
19
|
exports.DataGridContextProvider = dataGridContext.Provider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/contexts/dataGridContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AAGA,MAAA,OAAA,gBAAA,OAAA,CAAA,UAAA,CAAA;;AAEA,MAAM,eAAe,gBAAG,wBAAA,CAAA,aAAA,CAAgD,SAAhD,CAAxB;AAEA,MAAM,2BAA2B,GAAyB,EACxD,GAAG,OAAA,CAAA,iBADqD;EAExD,SAAS,EAAE;
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/contexts/dataGridContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AAGA,MAAA,OAAA,gBAAA,OAAA,CAAA,UAAA,CAAA;;AAEA,MAAM,eAAe,gBAAG,wBAAA,CAAA,aAAA,CAAgD,SAAhD,CAAxB;AAEA,MAAM,2BAA2B,GAAyB,EACxD,GAAG,OAAA,CAAA,iBADqD;EAExD,eAAe,EAAE,KAFuC;EAGxD,cAAc,EAAE,KAHwC;EAIxD,mBAAmB,EAAE,OAJmC;EAKxD,SAAS,EAAE;AAL6C,CAA1D;AAQa,OAAA,CAAA,uBAAA,GAA0B,eAAe,CAAC,QAA1C;;AAEN,MAAM,2BAA2B,GAAO,QAAJ,IACzC,wBAAA,CAAA,kBAAA,CAAmB,eAAnB,EAAoC,CAAC,GAAG,GAAG,2BAAP,KAAuC,QAAQ,CAAC,GAAD,CAAnF,CADK;;AAAM,OAAA,CAAA,2BAAA,GAA2B,2BAA3B","sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector } from '@fluentui/react-context-selector';\nimport { DataGridContextValue } from '../components/DataGrid/DataGrid.types';\nimport { defaultTableState } from '../hooks';\n\nconst dataGridContext = createContext<DataGridContextValue | undefined>(undefined);\n\nconst dataGridContextDefaultValue: DataGridContextValue = {\n ...defaultTableState,\n subtleSelection: false,\n selectableRows: false,\n selectionAppearance: 'brand',\n focusMode: 'none',\n};\n\nexport const DataGridContextProvider = dataGridContext.Provider;\n\nexport const useDataGridContext_unstable = <T>(selector: ContextSelector<DataGridContextValue, T>) =>\n useContextSelector(dataGridContext, (ctx = dataGridContextDefaultValue) => selector(ctx));\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RowIdContextProvider = exports.useRowIdContext = exports.rowIdContextDefaultValue = void 0;
|
|
7
|
+
|
|
8
|
+
const React = /*#__PURE__*/require("react");
|
|
9
|
+
|
|
10
|
+
const rowIdContext = /*#__PURE__*/React.createContext(undefined);
|
|
11
|
+
exports.rowIdContextDefaultValue = '';
|
|
12
|
+
|
|
13
|
+
const useRowIdContext = () => {
|
|
14
|
+
var _a;
|
|
15
|
+
|
|
16
|
+
return (_a = React.useContext(rowIdContext)) !== null && _a !== void 0 ? _a : exports.rowIdContextDefaultValue;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.useRowIdContext = useRowIdContext;
|
|
20
|
+
exports.RowIdContextProvider = rowIdContext.Provider;
|
|
21
|
+
//# sourceMappingURL=rowIdContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/contexts/rowIdContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAGA,MAAM,YAAY,gBAAG,KAAK,CAAC,aAAN,CAAuC,SAAvC,CAArB;AAEa,OAAA,CAAA,wBAAA,GAA2B,EAA3B;;AAEN,MAAM,eAAe,GAAG,MAAK;EAAA,IAAA,EAAA;;EAAC,OAAA,CAAA,EAAA,GAAA,KAAK,CAAC,UAAN,CAAiB,YAAjB,CAAA,MAA8B,IAA9B,IAA8B,EAAA,KAAA,KAAA,CAA9B,GAA8B,EAA9B,GAAkC,OAAA,CAAA,wBAAlC;AAA0D,CAAxF;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf;AAEA,OAAA,CAAA,oBAAA,GAAuB,YAAY,CAAC,QAApC","sourcesContent":["import * as React from 'react';\nimport type { RowId } from '../hooks/';\n\nconst rowIdContext = React.createContext<RowId | undefined>(undefined);\n\nexport const rowIdContextDefaultValue = '';\n\nexport const useRowIdContext = () => React.useContext(rowIdContext) ?? rowIdContextDefaultValue;\n\nexport const RowIdContextProvider = rowIdContext.Provider;\n"],"sourceRoot":"../src/"}
|
|
@@ -8,11 +8,11 @@ const tslib_1 = /*#__PURE__*/require("tslib");
|
|
|
8
8
|
|
|
9
9
|
tslib_1.__exportStar(require("./types"), exports);
|
|
10
10
|
|
|
11
|
-
tslib_1.__exportStar(require("./
|
|
11
|
+
tslib_1.__exportStar(require("./useTableFeatures"), exports);
|
|
12
12
|
|
|
13
|
-
tslib_1.__exportStar(require("./
|
|
13
|
+
tslib_1.__exportStar(require("./useTableSort"), exports);
|
|
14
14
|
|
|
15
|
-
tslib_1.__exportStar(require("./
|
|
15
|
+
tslib_1.__exportStar(require("./useTableSelection"), exports);
|
|
16
16
|
|
|
17
17
|
tslib_1.__exportStar(require("./createColumn"), exports);
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["packages/react-components/react-table/src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './types';\nexport * from './useTableFeatures';\nexport * from './useTableSort';\nexport * from './useTableSelection';\nexport * from './createColumn';\n"],"sourceRoot":"../src/"}
|
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.useTableFeatures = exports.defaultTableState = void 0;
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const useTableSelection_1 = /*#__PURE__*/require("./useTableSelection");
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const useTableSort_1 = /*#__PURE__*/require("./useTableSort");
|
|
11
11
|
|
|
12
12
|
const defaultRowEnhancer = row => row;
|
|
13
13
|
|
|
14
14
|
exports.defaultTableState = {
|
|
15
|
-
selection:
|
|
16
|
-
sort:
|
|
15
|
+
selection: useTableSelection_1.defaultTableSelectionState,
|
|
16
|
+
sort: useTableSort_1.defaultTableSortState,
|
|
17
17
|
getRows: () => [],
|
|
18
18
|
getRowId: () => '',
|
|
19
19
|
items: [],
|
|
20
20
|
columns: []
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
function
|
|
23
|
+
function useTableFeatures(options, plugins = []) {
|
|
24
24
|
const {
|
|
25
25
|
items,
|
|
26
26
|
getRowId,
|
|
@@ -41,11 +41,11 @@ function useTable(options, plugins = []) {
|
|
|
41
41
|
items,
|
|
42
42
|
columns,
|
|
43
43
|
getRows,
|
|
44
|
-
selection:
|
|
45
|
-
sort:
|
|
44
|
+
selection: useTableSelection_1.defaultTableSelectionState,
|
|
45
|
+
sort: useTableSort_1.defaultTableSortState
|
|
46
46
|
};
|
|
47
47
|
return plugins.reduce((state, plugin) => plugin(state), initialState);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
exports.
|
|
51
|
-
//# sourceMappingURL=
|
|
50
|
+
exports.useTableFeatures = useTableFeatures;
|
|
51
|
+
//# sourceMappingURL=useTableFeatures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/hooks/useTableFeatures.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAEA,MAAM,kBAAkB,GAA4C,GAAG,IAAI,GAA3E;;AAEa,OAAA,CAAA,iBAAA,GAAyC;EACpD,SAAS,EAAE,mBAAA,CAAA,0BADyC;EAEpD,IAAI,EAAE,cAAA,CAAA,qBAF8C;EAGpD,OAAO,EAAE,MAAM,EAHqC;EAIpD,QAAQ,EAAE,MAAM,EAJoC;EAKpD,KAAK,EAAE,EAL6C;EAMpD,OAAO,EAAE;AAN2C,CAAzC;;AASb,SAAgB,gBAAhB,CACE,OADF,EAEE,OAAA,GAA8B,EAFhC,EAEkC;EAEhC,MAAM;IAAE,KAAF;IAAS,QAAT;IAAmB;EAAnB,IAA+B,OAArC;;EAEA,MAAM,OAAO,GAAG,CACd,WAAA,GAAc,kBADA,KAEX,KAAK,CAAC,GAAN,CAAU,CAAC,IAAD,EAAO,CAAP,KAAY;IAAA,IAAA,EAAA;;IAAC,OAAA,WAAW,CAAC;MAAE,IAAF;MAAQ,KAAK,EAAE,CAAA,EAAA,GAAA,QAAQ,KAAA,IAAR,IAAA,QAAQ,KAAA,KAAA,CAAR,GAAQ,KAAA,CAAR,GAAA,QAAQ,CAAG,IAAH,CAAR,MAAgB,IAAhB,IAAgB,EAAA,KAAA,KAAA,CAAhB,GAAgB,EAAhB,GAAoB;IAAnC,CAAD,CAAX;EAAmD,CAA1E,CAFL;;EAIA,MAAM,YAAY,GAAsB;IACtC,QADsC;IAEtC,KAFsC;IAGtC,OAHsC;IAItC,OAJsC;IAKtC,SAAS,EAAE,mBAAA,CAAA,0BAL2B;IAMtC,IAAI,EAAE,cAAA,CAAA;EANgC,CAAxC;EASA,OAAO,OAAO,CAAC,MAAR,CAAe,CAAC,KAAD,EAAQ,MAAR,KAAmB,MAAM,CAAC,KAAD,CAAxC,EAAiD,YAAjD,CAAP;AACD;;AApBD,OAAA,CAAA,gBAAA,GAAA,gBAAA","sourcesContent":["import type { UseTableOptions, TableState, RowState, RowEnhancer, TableStatePlugin, TableSortState } from './types';\nimport { defaultTableSelectionState } from './useTableSelection';\nimport { defaultTableSortState } from './useTableSort';\n\nconst defaultRowEnhancer: RowEnhancer<unknown, RowState<unknown>> = row => row;\n\nexport const defaultTableState: TableState<unknown> = {\n selection: defaultTableSelectionState,\n sort: defaultTableSortState,\n getRows: () => [],\n getRowId: () => '',\n items: [],\n columns: [],\n};\n\nexport function useTableFeatures<TItem>(\n options: UseTableOptions<TItem>,\n plugins: TableStatePlugin[] = [],\n): TableState<TItem> {\n const { items, getRowId, columns } = options;\n\n const getRows = <TRowState extends RowState<TItem>>(\n rowEnhancer = defaultRowEnhancer as RowEnhancer<TItem, TRowState>,\n ) => items.map((item, i) => rowEnhancer({ item, rowId: getRowId?.(item) ?? i }));\n\n const initialState: TableState<TItem> = {\n getRowId,\n items,\n columns,\n getRows,\n selection: defaultTableSelectionState,\n sort: defaultTableSortState as TableSortState<TItem>,\n };\n\n return plugins.reduce((state, plugin) => plugin(state), initialState);\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.useTableSelectionState = exports.useTableSelection = exports.defaultTableSelectionState = void 0;
|
|
7
7
|
|
|
8
8
|
const React = /*#__PURE__*/require("react");
|
|
9
9
|
|
|
@@ -22,18 +22,19 @@ exports.defaultTableSelectionState = {
|
|
|
22
22
|
selectedRows: /*#__PURE__*/new Set(),
|
|
23
23
|
someRowsSelected: false,
|
|
24
24
|
toggleAllRows: noop,
|
|
25
|
-
toggleRow: noop
|
|
25
|
+
toggleRow: noop,
|
|
26
|
+
selectionMode: 'multiselect'
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
function
|
|
29
|
+
function useTableSelection(options) {
|
|
29
30
|
// False positive, these plugin hooks are intended to be run on every render
|
|
30
31
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
31
|
-
return tableState =>
|
|
32
|
+
return tableState => useTableSelectionState(tableState, options);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
exports.
|
|
35
|
+
exports.useTableSelection = useTableSelection;
|
|
35
36
|
|
|
36
|
-
function
|
|
37
|
+
function useTableSelectionState(tableState, options) {
|
|
37
38
|
const {
|
|
38
39
|
items,
|
|
39
40
|
getRowId
|
|
@@ -52,7 +53,9 @@ function useSelectionState(tableState, options) {
|
|
|
52
53
|
const selectionManager = React.useMemo(() => {
|
|
53
54
|
return selectionManager_1.createSelectionManager(selectionMode, (e, newSelectedItems) => {
|
|
54
55
|
setSelected(() => {
|
|
55
|
-
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(e,
|
|
56
|
+
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(e, {
|
|
57
|
+
selectedItems: newSelectedItems
|
|
58
|
+
});
|
|
56
59
|
return newSelectedItems;
|
|
57
60
|
});
|
|
58
61
|
});
|
|
@@ -72,6 +75,7 @@ function useSelectionState(tableState, options) {
|
|
|
72
75
|
|
|
73
76
|
return { ...tableState,
|
|
74
77
|
selection: {
|
|
78
|
+
selectionMode,
|
|
75
79
|
someRowsSelected: selected.size > 0,
|
|
76
80
|
allRowsSelected: selectionMode === 'single' ? selected.size > 0 : selected.size === items.length,
|
|
77
81
|
selectedRows: selected,
|
|
@@ -85,5 +89,5 @@ function useSelectionState(tableState, options) {
|
|
|
85
89
|
};
|
|
86
90
|
}
|
|
87
91
|
|
|
88
|
-
exports.
|
|
89
|
-
//# sourceMappingURL=
|
|
92
|
+
exports.useTableSelectionState = useTableSelectionState;
|
|
93
|
+
//# sourceMappingURL=useTableSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["packages/react-components/react-table/src/hooks/useTableSelection.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;;AAGA,MAAM,IAAI,GAAG,MAAM,SAAnB;;AAEa,OAAA,CAAA,0BAAA,GAAkD;EAC7D,eAAe,EAAE,KAD4C;EAE7D,SAAS,EAAE,IAFkD;EAG7D,WAAW,EAAE,IAHgD;EAI7D,aAAa,EAAE,MAAM,KAJwC;EAK7D,SAAS,EAAE,IALkD;EAM7D,YAAY,eAAE,IAAI,GAAJ,EAN+C;EAO7D,gBAAgB,EAAE,KAP2C;EAQ7D,aAAa,EAAE,IAR8C;EAS7D,SAAS,EAAE,IATkD;EAU7D,aAAa,EAAE;AAV8C,CAAlD;;AAab,SAAgB,iBAAhB,CAAyC,OAAzC,EAA0E;EACxE;EACA;EACA,OAAQ,UAAD,IAAmC,sBAAsB,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,KAAA,CAAhB,GAAgB,EAAhB,GAAoB,CAApB;IAAqB,CAA5C,CAFF,EAGE,QAHF;EAKD,CAN2D,CAA5D;EAQA,MAAM,SAAS,GAAqC,iBAAA,CAAA,gBAAA,CAAiB,CAAC,CAAD,EAAI,KAAJ,KACnE,gBAAgB,CAAC,UAAjB,CAA4B,CAA5B,EAA+B,KAA/B,EAAsC,QAAtC,CADkD,CAApD;EAIA,MAAM,WAAW,GAAuC,iBAAA,CAAA,gBAAA,CAAiB,CAAC,CAAD,EAAI,KAAJ,KACvE,gBAAgB,CAAC,YAAjB,CAA8B,CAA9B,EAAiC,KAAjC,EAAwC,QAAxC,CADsD,CAAxD;EAIA,MAAM,SAAS,GAAqC,iBAAA,CAAA,gBAAA,CAAiB,CAAC,CAAD,EAAI,KAAJ,KACnE,gBAAgB,CAAC,UAAjB,CAA4B,CAA5B,EAA+B,KAA/B,EAAsC,QAAtC,CADkD,CAApD;;EAIA,MAAM,aAAa,GAA0C,KAAD,IAC1D,gBAAgB,CAAC,UAAjB,CAA4B,KAA5B,EAAmC,QAAnC,CADF;;EAGA,OAAO,EACL,GAAG,UADE;IAEL,SAAS,EAAE;MACT,aADS;MAET,gBAAgB,EAAE,QAAQ,CAAC,IAAT,GAAgB,CAFzB;MAGT,eAAe,EAAE,aAAa,KAAK,QAAlB,GAA6B,QAAQ,CAAC,IAAT,GAAgB,CAA7C,GAAiD,QAAQ,CAAC,IAAT,KAAkB,KAAK,CAAC,MAHjF;MAIT,YAAY,EAAE,QAJL;MAKT,SALS;MAMT,aANS;MAOT,SAAS,EAAE,gBAAgB,CAAC,UAPnB;MAQT,WARS;MAST,SATS;MAUT;IAVS;EAFN,CAAP;AAeD;;AA5DD,OAAA,CAAA,sBAAA,GAAA,sBAAA","sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport { createSelectionManager } from './selectionManager';\nimport type { RowId, TableSelectionState, TableState, UseTableSelectionOptions } from './types';\n\nconst noop = () => undefined;\n\nexport const defaultTableSelectionState: TableSelectionState = {\n allRowsSelected: false,\n clearRows: noop,\n deselectRow: noop,\n isRowSelected: () => false,\n selectRow: noop,\n selectedRows: new Set(),\n someRowsSelected: false,\n toggleAllRows: noop,\n toggleRow: noop,\n selectionMode: 'multiselect',\n};\n\nexport function useTableSelection<TItem>(options: UseTableSelectionOptions) {\n // False positive, these plugin hooks are intended to be run on every render\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return (tableState: TableState<TItem>) => useTableSelectionState(tableState, options);\n}\n\nexport function useTableSelectionState<TItem>(\n tableState: TableState<TItem>,\n options: UseTableSelectionOptions,\n): TableState<TItem> {\n const { items, getRowId } = tableState;\n const { selectionMode, defaultSelectedItems, selectedItems, onSelectionChange } = options;\n\n const [selected, setSelected] = useControllableState({\n initialState: new Set<RowId>(),\n defaultState: defaultSelectedItems,\n state: selectedItems,\n });\n\n const selectionManager = React.useMemo(() => {\n return createSelectionManager(selectionMode, (e, newSelectedItems) => {\n setSelected(() => {\n onSelectionChange?.(e as React.SyntheticEvent, { selectedItems: newSelectedItems });\n return newSelectedItems;\n });\n });\n }, [onSelectionChange, selectionMode, setSelected]);\n\n const toggleAllRows: TableSelectionState['toggleAllRows'] = useEventCallback(e => {\n selectionManager.toggleAllItems(\n e,\n items.map((item, i) => getRowId?.(item) ?? i),\n selected,\n );\n });\n\n const toggleRow: TableSelectionState['toggleRow'] = useEventCallback((e, rowId: RowId) =>\n selectionManager.toggleItem(e, rowId, selected),\n );\n\n const deselectRow: TableSelectionState['deselectRow'] = useEventCallback((e, rowId: RowId) =>\n selectionManager.deselectItem(e, rowId, selected),\n );\n\n const selectRow: TableSelectionState['selectRow'] = useEventCallback((e, rowId: RowId) =>\n selectionManager.selectItem(e, rowId, selected),\n );\n\n const isRowSelected: TableSelectionState['isRowSelected'] = (rowId: RowId) =>\n selectionManager.isSelected(rowId, selected);\n\n return {\n ...tableState,\n selection: {\n selectionMode,\n someRowsSelected: selected.size > 0,\n allRowsSelected: selectionMode === 'single' ? selected.size > 0 : selected.size === items.length,\n selectedRows: selected,\n toggleRow,\n toggleAllRows,\n clearRows: selectionManager.clearItems,\n deselectRow,\n selectRow,\n isRowSelected,\n },\n };\n}\n"],"sourceRoot":"../src/"}
|