@fluentui/react-table 9.8.8 → 9.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/CHANGELOG.json +177 -1
  2. package/CHANGELOG.md +47 -2
  3. package/dist/index.d.ts +7 -2
  4. package/lib/components/DataGrid/useDataGrid.js +2 -2
  5. package/lib/components/DataGrid/useDataGrid.js.map +1 -1
  6. package/lib/components/DataGridHeaderCell/DataGridHeaderCell.types.js.map +1 -1
  7. package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js +13 -3
  8. package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -1
  9. package/lib/components/DataGridRow/useDataGridRow.js +4 -4
  10. package/lib/components/DataGridRow/useDataGridRow.js.map +1 -1
  11. package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js +2 -2
  12. package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
  13. package/lib/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -1
  14. package/lib/components/TableHeaderCell/useTableHeaderCell.js +2 -1
  15. package/lib/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
  16. package/lib/components/TableResizeHandle/useTableResizeHandle.js +2 -2
  17. package/lib/components/TableResizeHandle/useTableResizeHandle.js.map +1 -1
  18. package/lib/contexts/columnIdContext.js +4 -2
  19. package/lib/contexts/columnIdContext.js.map +1 -1
  20. package/lib/contexts/rowIdContext.js +4 -2
  21. package/lib/contexts/rowIdContext.js.map +1 -1
  22. package/lib/contexts/tableContext.js +4 -2
  23. package/lib/contexts/tableContext.js.map +1 -1
  24. package/lib/hooks/types.js.map +1 -1
  25. package/lib/hooks/useKeyboardResizing.js +4 -4
  26. package/lib/hooks/useKeyboardResizing.js.map +1 -1
  27. package/lib/hooks/useMeasureElement.js +1 -4
  28. package/lib/hooks/useMeasureElement.js.map +1 -1
  29. package/lib/hooks/useTableColumnResizeMouseHandler.js +11 -17
  30. package/lib/hooks/useTableColumnResizeMouseHandler.js.map +1 -1
  31. package/lib/hooks/useTableColumnSizing.js +3 -4
  32. package/lib/hooks/useTableColumnSizing.js.map +1 -1
  33. package/lib/hooks/useTableFeatures.js +2 -3
  34. package/lib/hooks/useTableFeatures.js.map +1 -1
  35. package/lib/hooks/useTableSelection.js +3 -5
  36. package/lib/hooks/useTableSelection.js.map +1 -1
  37. package/lib/hooks/useTableSort.js +3 -6
  38. package/lib/hooks/useTableSort.js.map +1 -1
  39. package/lib/utils/columnResizeUtils.js +2 -4
  40. package/lib/utils/columnResizeUtils.js.map +1 -1
  41. package/lib/utils/isColumnSortable.js +3 -0
  42. package/lib/utils/isColumnSortable.js.map +1 -0
  43. package/lib-commonjs/components/DataGrid/useDataGrid.js +2 -2
  44. package/lib-commonjs/components/DataGrid/useDataGrid.js.map +1 -1
  45. package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js +13 -3
  46. package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -1
  47. package/lib-commonjs/components/DataGridRow/useDataGridRow.js +4 -4
  48. package/lib-commonjs/components/DataGridRow/useDataGridRow.js.map +1 -1
  49. package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js +2 -2
  50. package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
  51. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js +2 -1
  52. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
  53. package/lib-commonjs/components/TableResizeHandle/useTableResizeHandle.js +2 -2
  54. package/lib-commonjs/components/TableResizeHandle/useTableResizeHandle.js.map +1 -1
  55. package/lib-commonjs/contexts/columnIdContext.js +4 -2
  56. package/lib-commonjs/contexts/columnIdContext.js.map +1 -1
  57. package/lib-commonjs/contexts/rowIdContext.js +4 -2
  58. package/lib-commonjs/contexts/rowIdContext.js.map +1 -1
  59. package/lib-commonjs/contexts/tableContext.js +4 -2
  60. package/lib-commonjs/contexts/tableContext.js.map +1 -1
  61. package/lib-commonjs/hooks/useKeyboardResizing.js +4 -4
  62. package/lib-commonjs/hooks/useKeyboardResizing.js.map +1 -1
  63. package/lib-commonjs/hooks/useMeasureElement.js +1 -4
  64. package/lib-commonjs/hooks/useMeasureElement.js.map +1 -1
  65. package/lib-commonjs/hooks/useTableColumnResizeMouseHandler.js +11 -17
  66. package/lib-commonjs/hooks/useTableColumnResizeMouseHandler.js.map +1 -1
  67. package/lib-commonjs/hooks/useTableColumnSizing.js +3 -4
  68. package/lib-commonjs/hooks/useTableColumnSizing.js.map +1 -1
  69. package/lib-commonjs/hooks/useTableFeatures.js +2 -3
  70. package/lib-commonjs/hooks/useTableFeatures.js.map +1 -1
  71. package/lib-commonjs/hooks/useTableSelection.js +3 -5
  72. package/lib-commonjs/hooks/useTableSelection.js.map +1 -1
  73. package/lib-commonjs/hooks/useTableSort.js +3 -6
  74. package/lib-commonjs/hooks/useTableSort.js.map +1 -1
  75. package/lib-commonjs/utils/columnResizeUtils.js +2 -4
  76. package/lib-commonjs/utils/columnResizeUtils.js.map +1 -1
  77. package/lib-commonjs/utils/isColumnSortable.js +13 -0
  78. package/lib-commonjs/utils/isColumnSortable.js.map +1 -0
  79. package/package.json +13 -13
package/CHANGELOG.json CHANGED
@@ -2,7 +2,183 @@
2
2
  "name": "@fluentui/react-table",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 20 Sep 2023 17:40:50 GMT",
5
+ "date": "Tue, 26 Sep 2023 17:44:17 GMT",
6
+ "tag": "@fluentui/react-table_v9.9.1",
7
+ "version": "9.9.1",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "yuanboxue@microsoft.com",
12
+ "package": "@fluentui/react-table",
13
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d",
14
+ "comment": "chore: trigger manual version bump after broken release"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-table",
19
+ "comment": "Bump @fluentui/keyboard-keys to v9.0.6",
20
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-table",
25
+ "comment": "Bump @fluentui/react-aria to v9.3.38",
26
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-table",
31
+ "comment": "Bump @fluentui/react-avatar to v9.5.34",
32
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-table",
37
+ "comment": "Bump @fluentui/react-checkbox to v9.1.44",
38
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-table",
43
+ "comment": "Bump @fluentui/react-context-selector to v9.1.36",
44
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-table",
49
+ "comment": "Bump @fluentui/react-radio to v9.1.44",
50
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@fluentui/react-table",
55
+ "comment": "Bump @fluentui/react-shared-contexts to v9.9.1",
56
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
57
+ },
58
+ {
59
+ "author": "beachball",
60
+ "package": "@fluentui/react-table",
61
+ "comment": "Bump @fluentui/react-tabster to v9.13.1",
62
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
63
+ },
64
+ {
65
+ "author": "beachball",
66
+ "package": "@fluentui/react-table",
67
+ "comment": "Bump @fluentui/react-theme to v9.1.14",
68
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
69
+ },
70
+ {
71
+ "author": "beachball",
72
+ "package": "@fluentui/react-table",
73
+ "comment": "Bump @fluentui/react-utilities to v9.13.5",
74
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
75
+ },
76
+ {
77
+ "author": "beachball",
78
+ "package": "@fluentui/react-table",
79
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.12",
80
+ "commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
81
+ }
82
+ ]
83
+ }
84
+ },
85
+ {
86
+ "date": "Tue, 26 Sep 2023 15:31:48 GMT",
87
+ "tag": "@fluentui/react-table_v9.9.0",
88
+ "version": "9.9.0",
89
+ "comments": {
90
+ "patch": [
91
+ {
92
+ "author": "martinhochel@microsoft.com",
93
+ "package": "@fluentui/react-table",
94
+ "commit": "e61473fa10195f6ebf2308205c1e72e91b711831",
95
+ "comment": "fix: bump swc core to mitigate transpilation memory leaks"
96
+ },
97
+ {
98
+ "author": "ololubek@microsoft.com",
99
+ "package": "@fluentui/react-table",
100
+ "commit": "a31e7394d9f169bc5aa55430a22cdc65425a1b49",
101
+ "comment": "chore: Update react-icons version to pick up IconDirectionContextProvider updated export"
102
+ }
103
+ ],
104
+ "minor": [
105
+ {
106
+ "author": "kakrookaran@gmail.com",
107
+ "package": "@fluentui/react-table",
108
+ "commit": "f6a23fb313d375903616b436065d255a5f6367a0",
109
+ "comment": "feat: add sorting on individual columns"
110
+ },
111
+ {
112
+ "author": "beachball",
113
+ "package": "@fluentui/react-table",
114
+ "comment": "Bump @fluentui/keyboard-keys to v9.0.5",
115
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
116
+ },
117
+ {
118
+ "author": "beachball",
119
+ "package": "@fluentui/react-table",
120
+ "comment": "Bump @fluentui/react-aria to v9.3.37",
121
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
122
+ },
123
+ {
124
+ "author": "beachball",
125
+ "package": "@fluentui/react-table",
126
+ "comment": "Bump @fluentui/react-avatar to v9.5.33",
127
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
128
+ },
129
+ {
130
+ "author": "beachball",
131
+ "package": "@fluentui/react-table",
132
+ "comment": "Bump @fluentui/react-checkbox to v9.1.43",
133
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
134
+ },
135
+ {
136
+ "author": "beachball",
137
+ "package": "@fluentui/react-table",
138
+ "comment": "Bump @fluentui/react-context-selector to v9.1.35",
139
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
140
+ },
141
+ {
142
+ "author": "beachball",
143
+ "package": "@fluentui/react-table",
144
+ "comment": "Bump @fluentui/react-radio to v9.1.43",
145
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
146
+ },
147
+ {
148
+ "author": "beachball",
149
+ "package": "@fluentui/react-table",
150
+ "comment": "Bump @fluentui/react-shared-contexts to v9.9.0",
151
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
152
+ },
153
+ {
154
+ "author": "beachball",
155
+ "package": "@fluentui/react-table",
156
+ "comment": "Bump @fluentui/react-tabster to v9.13.0",
157
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
158
+ },
159
+ {
160
+ "author": "beachball",
161
+ "package": "@fluentui/react-table",
162
+ "comment": "Bump @fluentui/react-theme to v9.1.13",
163
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
164
+ },
165
+ {
166
+ "author": "beachball",
167
+ "package": "@fluentui/react-table",
168
+ "comment": "Bump @fluentui/react-utilities to v9.13.4",
169
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
170
+ },
171
+ {
172
+ "author": "beachball",
173
+ "package": "@fluentui/react-table",
174
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.11",
175
+ "commit": "e16520437e10cd824ac254dd797e32762b5de72d"
176
+ }
177
+ ]
178
+ }
179
+ },
180
+ {
181
+ "date": "Wed, 20 Sep 2023 17:47:43 GMT",
6
182
  "tag": "@fluentui/react-table_v9.8.8",
7
183
  "version": "9.8.8",
8
184
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,57 @@
1
1
  # Change Log - @fluentui/react-table
2
2
 
3
- This log was last generated on Wed, 20 Sep 2023 17:40:50 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 26 Sep 2023 17:44:17 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.9.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.9.1)
8
+
9
+ Tue, 26 Sep 2023 17:44:17 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.9.0..@fluentui/react-table_v9.9.1)
11
+
12
+ ### Patches
13
+
14
+ - chore: trigger manual version bump after broken release ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by yuanboxue@microsoft.com)
15
+ - Bump @fluentui/keyboard-keys to v9.0.6 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
16
+ - Bump @fluentui/react-aria to v9.3.38 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
17
+ - Bump @fluentui/react-avatar to v9.5.34 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
18
+ - Bump @fluentui/react-checkbox to v9.1.44 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
19
+ - Bump @fluentui/react-context-selector to v9.1.36 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
20
+ - Bump @fluentui/react-radio to v9.1.44 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
21
+ - Bump @fluentui/react-shared-contexts to v9.9.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
22
+ - Bump @fluentui/react-tabster to v9.13.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
23
+ - Bump @fluentui/react-theme to v9.1.14 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
24
+ - Bump @fluentui/react-utilities to v9.13.5 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
25
+ - Bump @fluentui/react-jsx-runtime to v9.0.12 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
26
+
27
+ ## [9.9.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.9.0)
28
+
29
+ Tue, 26 Sep 2023 15:31:48 GMT
30
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.8.8..@fluentui/react-table_v9.9.0)
31
+
32
+ ### Minor changes
33
+
34
+ - feat: add sorting on individual columns ([PR #29196](https://github.com/microsoft/fluentui/pull/29196) by kakrookaran@gmail.com)
35
+ - Bump @fluentui/keyboard-keys to v9.0.5 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
36
+ - Bump @fluentui/react-aria to v9.3.37 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
37
+ - Bump @fluentui/react-avatar to v9.5.33 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
38
+ - Bump @fluentui/react-checkbox to v9.1.43 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
39
+ - Bump @fluentui/react-context-selector to v9.1.35 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
40
+ - Bump @fluentui/react-radio to v9.1.43 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
41
+ - Bump @fluentui/react-shared-contexts to v9.9.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
42
+ - Bump @fluentui/react-tabster to v9.13.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
43
+ - Bump @fluentui/react-theme to v9.1.13 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
44
+ - Bump @fluentui/react-utilities to v9.13.4 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
45
+ - Bump @fluentui/react-jsx-runtime to v9.0.11 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
46
+
47
+ ### Patches
48
+
49
+ - fix: bump swc core to mitigate transpilation memory leaks ([PR #29253](https://github.com/microsoft/fluentui/pull/29253) by martinhochel@microsoft.com)
50
+ - chore: Update react-icons version to pick up IconDirectionContextProvider updated export ([PR #29151](https://github.com/microsoft/fluentui/pull/29151) by ololubek@microsoft.com)
51
+
7
52
  ## [9.8.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.8.8)
8
53
 
9
- Wed, 20 Sep 2023 17:40:50 GMT
54
+ Wed, 20 Sep 2023 17:47:43 GMT
10
55
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.8.7..@fluentui/react-table_v9.8.8)
11
56
 
12
57
  ### Patches
package/dist/index.d.ts CHANGED
@@ -175,7 +175,7 @@ export declare const dataGridHeaderCellClassNames: SlotClassNames<DataGridHeader
175
175
  /**
176
176
  * DataGridHeaderCell Props
177
177
  */
178
- export declare type DataGridHeaderCellProps = TableHeaderCellProps;
178
+ export declare type DataGridHeaderCellProps = Omit<TableHeaderCellProps, 'sortable'>;
179
179
 
180
180
  export declare type DataGridHeaderCellSlots = TableHeaderCellSlots;
181
181
 
@@ -625,6 +625,11 @@ export declare const tableHeaderCellClassNames: SlotClassNames<TableHeaderCellSl
625
625
  * TableHeaderCell Props
626
626
  */
627
627
  export declare type TableHeaderCellProps = ComponentProps<Partial<TableHeaderCellSlots>> & {
628
+ /**
629
+ * Whether the column is sortable
630
+ * @default false
631
+ */
632
+ sortable?: boolean;
628
633
  /**
629
634
  * @default undefined
630
635
  */
@@ -647,7 +652,7 @@ export declare type TableHeaderCellSlots = {
647
652
  /**
648
653
  * State used in rendering TableHeaderCell
649
654
  */
650
- export declare type TableHeaderCellState = ComponentState<TableHeaderCellSlots> & Pick<TableContextValue, 'noNativeElements' | 'sortable'>;
655
+ export declare type TableHeaderCellState = ComponentState<TableHeaderCellSlots> & Pick<TableContextValue, 'noNativeElements'> & Pick<TableHeaderCellProps, 'sortable'>;
651
656
 
652
657
  export declare const tableHeaderClassName = "fui-TableHeader";
653
658
 
@@ -47,8 +47,8 @@ import { CELL_WIDTH } from '../TableSelectionCell';
47
47
  const innerRef = React.useRef(null);
48
48
  const { findFirstFocusable, findLastFocusable } = useFocusFinders();
49
49
  const onKeyDown = useEventCallback((e)=>{
50
- var _props_onKeyDown, _props;
51
- (_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, e);
50
+ var _props_onKeyDown;
51
+ (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);
52
52
  focusMode === 'composite' && onCompositeKeyDown(e);
53
53
  // handle ctrl+home and ctrl+end
54
54
  if (!innerRef.current || !e.ctrlKey || e.defaultPrevented) {
@@ -1 +1 @@
1
- {"version":3,"sources":["useDataGrid.ts"],"sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport type { DataGridProps, DataGridState } from './DataGrid.types';\nimport { useTable_unstable } from '../Table/useTable';\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { End, Home } from '@fluentui/keyboard-keys';\nimport {\n useTableFeatures,\n useTableSort,\n useTableSelection,\n useTableColumnSizing_unstable,\n useTableCompositeNavigation,\n} from '../../hooks';\nimport { CELL_WIDTH } from '../TableSelectionCell';\n\n/**\n * Create the state required to render DataGrid.\n *\n * The returned state can be modified with hooks such as useDataGridStyles_unstable,\n * before being passed to renderDataGrid_unstable.\n *\n * @param props - props from this instance of DataGrid\n * @param ref - reference to root HTMLElement of DataGrid\n */\nexport const useDataGrid_unstable = (props: DataGridProps, ref: React.Ref<HTMLElement>): DataGridState => {\n const {\n items,\n columns,\n focusMode = 'cell',\n selectionMode,\n onSortChange,\n onSelectionChange,\n defaultSortState,\n sortState,\n selectedItems,\n defaultSelectedItems,\n subtleSelection = false,\n selectionAppearance = 'brand',\n getRowId,\n resizableColumns,\n columnSizingOptions,\n onColumnResize,\n containerWidthOffset,\n } = props;\n\n const widthOffset = containerWidthOffset ?? (selectionMode ? -CELL_WIDTH : 0);\n\n const gridTabsterAttribute = useArrowNavigationGroup({\n axis: 'grid',\n });\n\n const {\n onTableKeyDown: onCompositeKeyDown,\n tableTabsterAttribute: compositeTabsterAttribute,\n tableRowTabsterAttribute: compositeRowTabsterAttribute,\n } = useTableCompositeNavigation();\n\n const tableState = useTableFeatures({ items, columns, getRowId }, [\n useTableSort({\n defaultSortState,\n sortState,\n onSortChange,\n }),\n useTableSelection({\n defaultSelectedItems,\n selectedItems,\n onSelectionChange,\n selectionMode: selectionMode ?? 'multiselect',\n }),\n useTableColumnSizing_unstable({\n onColumnResize,\n columnSizingOptions,\n // The selection cell is not part of the columns, therefore its width needs to be subtracted\n // from the container to make sure the columns don't overflow the table.\n containerWidthOffset: widthOffset,\n }),\n ]);\n\n const innerRef = React.useRef<HTMLDivElement>(null);\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLTableElement>) => {\n props.onKeyDown?.(e);\n focusMode === 'composite' && onCompositeKeyDown(e);\n\n // handle ctrl+home and ctrl+end\n if (!innerRef.current || !e.ctrlKey || e.defaultPrevented) {\n return;\n }\n\n if (e.key === Home) {\n const firstRow = innerRef.current.querySelector('[role=\"row\"]') as HTMLElement | null;\n if (firstRow) {\n findFirstFocusable(firstRow)?.focus();\n }\n }\n\n if (e.key === End) {\n const rows = innerRef.current.querySelectorAll('[role=\"row\"]');\n if (rows.length) {\n const lastRow = rows.item(rows.length - 1);\n findLastFocusable(lastRow as HTMLElement)?.focus();\n }\n }\n });\n\n const baseTableState = useTable_unstable(\n {\n role: 'grid',\n as: 'div',\n noNativeElements: true,\n ...(focusMode === 'cell' && gridTabsterAttribute),\n ...(focusMode === 'composite' && compositeTabsterAttribute),\n ...props,\n onKeyDown,\n ...(resizableColumns ? tableState.columnSizing_unstable.getTableProps(props) : {}),\n },\n useMergedRefs(ref, tableState.tableRef, innerRef),\n );\n\n return {\n ...baseTableState,\n focusMode,\n tableState,\n selectableRows: !!selectionMode,\n subtleSelection,\n selectionAppearance,\n resizableColumns,\n compositeRowTabsterAttribute,\n };\n};\n"],"names":["React","useArrowNavigationGroup","useFocusFinders","useTable_unstable","useEventCallback","useMergedRefs","End","Home","useTableFeatures","useTableSort","useTableSelection","useTableColumnSizing_unstable","useTableCompositeNavigation","CELL_WIDTH","useDataGrid_unstable","props","ref","items","columns","focusMode","selectionMode","onSortChange","onSelectionChange","defaultSortState","sortState","selectedItems","defaultSelectedItems","subtleSelection","selectionAppearance","getRowId","resizableColumns","columnSizingOptions","onColumnResize","containerWidthOffset","widthOffset","gridTabsterAttribute","axis","onTableKeyDown","onCompositeKeyDown","tableTabsterAttribute","compositeTabsterAttribute","tableRowTabsterAttribute","compositeRowTabsterAttribute","tableState","innerRef","useRef","findFirstFocusable","findLastFocusable","onKeyDown","e","current","ctrlKey","defaultPrevented","key","firstRow","querySelector","focus","rows","querySelectorAll","length","lastRow","item","baseTableState","role","as","noNativeElements","columnSizing_unstable","getTableProps","tableRef","selectableRows"],"mappings":"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"}
1
+ {"version":3,"sources":["useDataGrid.ts"],"sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport type { DataGridProps, DataGridState } from './DataGrid.types';\nimport { useTable_unstable } from '../Table/useTable';\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { End, Home } from '@fluentui/keyboard-keys';\nimport {\n useTableFeatures,\n useTableSort,\n useTableSelection,\n useTableColumnSizing_unstable,\n useTableCompositeNavigation,\n} from '../../hooks';\nimport { CELL_WIDTH } from '../TableSelectionCell';\n\n/**\n * Create the state required to render DataGrid.\n *\n * The returned state can be modified with hooks such as useDataGridStyles_unstable,\n * before being passed to renderDataGrid_unstable.\n *\n * @param props - props from this instance of DataGrid\n * @param ref - reference to root HTMLElement of DataGrid\n */\nexport const useDataGrid_unstable = (props: DataGridProps, ref: React.Ref<HTMLElement>): DataGridState => {\n const {\n items,\n columns,\n focusMode = 'cell',\n selectionMode,\n onSortChange,\n onSelectionChange,\n defaultSortState,\n sortState,\n selectedItems,\n defaultSelectedItems,\n subtleSelection = false,\n selectionAppearance = 'brand',\n getRowId,\n resizableColumns,\n columnSizingOptions,\n onColumnResize,\n containerWidthOffset,\n } = props;\n\n const widthOffset = containerWidthOffset ?? (selectionMode ? -CELL_WIDTH : 0);\n\n const gridTabsterAttribute = useArrowNavigationGroup({\n axis: 'grid',\n });\n\n const {\n onTableKeyDown: onCompositeKeyDown,\n tableTabsterAttribute: compositeTabsterAttribute,\n tableRowTabsterAttribute: compositeRowTabsterAttribute,\n } = useTableCompositeNavigation();\n\n const tableState = useTableFeatures({ items, columns, getRowId }, [\n useTableSort({\n defaultSortState,\n sortState,\n onSortChange,\n }),\n useTableSelection({\n defaultSelectedItems,\n selectedItems,\n onSelectionChange,\n selectionMode: selectionMode ?? 'multiselect',\n }),\n useTableColumnSizing_unstable({\n onColumnResize,\n columnSizingOptions,\n // The selection cell is not part of the columns, therefore its width needs to be subtracted\n // from the container to make sure the columns don't overflow the table.\n containerWidthOffset: widthOffset,\n }),\n ]);\n\n const innerRef = React.useRef<HTMLDivElement>(null);\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLTableElement>) => {\n props.onKeyDown?.(e);\n focusMode === 'composite' && onCompositeKeyDown(e);\n\n // handle ctrl+home and ctrl+end\n if (!innerRef.current || !e.ctrlKey || e.defaultPrevented) {\n return;\n }\n\n if (e.key === Home) {\n const firstRow = innerRef.current.querySelector('[role=\"row\"]') as HTMLElement | null;\n if (firstRow) {\n findFirstFocusable(firstRow)?.focus();\n }\n }\n\n if (e.key === End) {\n const rows = innerRef.current.querySelectorAll('[role=\"row\"]');\n if (rows.length) {\n const lastRow = rows.item(rows.length - 1);\n findLastFocusable(lastRow as HTMLElement)?.focus();\n }\n }\n });\n\n const baseTableState = useTable_unstable(\n {\n role: 'grid',\n as: 'div',\n noNativeElements: true,\n ...(focusMode === 'cell' && gridTabsterAttribute),\n ...(focusMode === 'composite' && compositeTabsterAttribute),\n ...props,\n onKeyDown,\n ...(resizableColumns ? tableState.columnSizing_unstable.getTableProps(props) : {}),\n },\n useMergedRefs(ref, tableState.tableRef, innerRef),\n );\n\n return {\n ...baseTableState,\n focusMode,\n tableState,\n selectableRows: !!selectionMode,\n subtleSelection,\n selectionAppearance,\n resizableColumns,\n compositeRowTabsterAttribute,\n };\n};\n"],"names":["React","useArrowNavigationGroup","useFocusFinders","useTable_unstable","useEventCallback","useMergedRefs","End","Home","useTableFeatures","useTableSort","useTableSelection","useTableColumnSizing_unstable","useTableCompositeNavigation","CELL_WIDTH","useDataGrid_unstable","props","ref","items","columns","focusMode","selectionMode","onSortChange","onSelectionChange","defaultSortState","sortState","selectedItems","defaultSelectedItems","subtleSelection","selectionAppearance","getRowId","resizableColumns","columnSizingOptions","onColumnResize","containerWidthOffset","widthOffset","gridTabsterAttribute","axis","onTableKeyDown","onCompositeKeyDown","tableTabsterAttribute","compositeTabsterAttribute","tableRowTabsterAttribute","compositeRowTabsterAttribute","tableState","innerRef","useRef","findFirstFocusable","findLastFocusable","onKeyDown","e","current","ctrlKey","defaultPrevented","key","firstRow","querySelector","focus","rows","querySelectorAll","length","lastRow","item","baseTableState","role","as","noNativeElements","columnSizing_unstable","getTableProps","tableRef","selectableRows"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"sources":["DataGridHeaderCell.types.ts"],"sourcesContent":["import {\n TableHeaderCellProps,\n TableHeaderCellSlots,\n TableHeaderCellState,\n} from '../TableHeaderCell/TableHeaderCell.types';\n\nexport type DataGridHeaderCellSlots = TableHeaderCellSlots;\n\n/**\n * DataGridHeaderCell Props\n */\nexport type DataGridHeaderCellProps = TableHeaderCellProps;\n\n/**\n * State used in rendering DataGridHeaderCell\n */\nexport type DataGridHeaderCellState = TableHeaderCellState;\n"],"names":[],"mappings":"AAAA,WAgB2D"}
1
+ {"version":3,"sources":["DataGridHeaderCell.types.ts"],"sourcesContent":["import {\n TableHeaderCellProps,\n TableHeaderCellSlots,\n TableHeaderCellState,\n} from '../TableHeaderCell/TableHeaderCell.types';\n\nexport type DataGridHeaderCellSlots = TableHeaderCellSlots;\n\n/**\n * DataGridHeaderCell Props\n */\nexport type DataGridHeaderCellProps = Omit<TableHeaderCellProps, 'sortable'>;\n\n/**\n * State used in rendering DataGridHeaderCell\n */\nexport type DataGridHeaderCellState = TableHeaderCellState;\n"],"names":[],"mappings":"AAAA,WAgB2D"}
@@ -4,6 +4,7 @@ import { useTableHeaderCell_unstable } from '../TableHeaderCell/useTableHeaderCe
4
4
  import { useDataGridContext_unstable } from '../../contexts/dataGridContext';
5
5
  import { useColumnIdContext } from '../../contexts/columnIdContext';
6
6
  import { useTableContext } from '../../contexts/tableContext';
7
+ import { isColumnSortable } from '../../utils/isColumnSortable';
7
8
  /**
8
9
  * Create the state required to render DataGridHeaderCell.
9
10
  *
@@ -14,20 +15,29 @@ import { useTableContext } from '../../contexts/tableContext';
14
15
  * @param ref - reference to root HTMLElement of DataGridHeaderCell
15
16
  */ export const useDataGridHeaderCell_unstable = (props, ref)=>{
16
17
  const columnId = useColumnIdContext();
17
- const { sortable } = useTableContext();
18
+ const { sortable: gridSortable } = useTableContext();
18
19
  const toggleColumnSort = useDataGridContext_unstable((ctx)=>ctx.sort.toggleColumnSort);
20
+ const sortable = useDataGridContext_unstable((ctx)=>{
21
+ const columnSortable = !!ctx.columns.find((c)=>c.columnId === columnId && isColumnSortable(c));
22
+ if (!gridSortable) {
23
+ // if the grid is not sortable - disable sorting on all columns
24
+ return false;
25
+ }
26
+ return columnSortable;
27
+ });
19
28
  const sortDirection = useDataGridContext_unstable((ctx)=>sortable ? ctx.sort.getSortDirection(columnId) : undefined);
20
29
  const resizableColumns = useDataGridContext_unstable((ctx)=>ctx.resizableColumns);
21
30
  const columnSizing = useDataGridContext_unstable((ctx)=>ctx.columnSizing_unstable);
22
31
  // eslint-disable-next-line deprecation/deprecation -- prefer HTMLTableCellElement
23
32
  const onClick = useEventCallback((e)=>{
24
- var _props_onClick, _props;
33
+ var _props_onClick;
25
34
  if (sortable) {
26
35
  toggleColumnSort(e, columnId);
27
36
  }
28
- (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, e);
37
+ (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);
29
38
  });
30
39
  return useTableHeaderCell_unstable({
40
+ sortable,
31
41
  sortDirection,
32
42
  as: 'div',
33
43
  tabIndex: sortable ? undefined : 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["useDataGridHeaderCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport type { DataGridHeaderCellProps, DataGridHeaderCellState } from './DataGridHeaderCell.types';\nimport { useTableHeaderCell_unstable } from '../TableHeaderCell/useTableHeaderCell';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useColumnIdContext } from '../../contexts/columnIdContext';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render DataGridHeaderCell.\n *\n * The returned state can be modified with hooks such as useDataGridHeaderCellStyles_unstable,\n * before being passed to renderDataGridHeaderCell_unstable.\n *\n * @param props - props from this instance of DataGridHeaderCell\n * @param ref - reference to root HTMLElement of DataGridHeaderCell\n */\nexport const useDataGridHeaderCell_unstable = (\n props: DataGridHeaderCellProps,\n ref: React.Ref<HTMLElement>,\n): DataGridHeaderCellState => {\n const columnId = useColumnIdContext();\n const { sortable } = useTableContext();\n const toggleColumnSort = useDataGridContext_unstable(ctx => ctx.sort.toggleColumnSort);\n const sortDirection = useDataGridContext_unstable(ctx =>\n sortable ? ctx.sort.getSortDirection(columnId) : undefined,\n );\n\n const resizableColumns = useDataGridContext_unstable(ctx => ctx.resizableColumns);\n const columnSizing = useDataGridContext_unstable(ctx => ctx.columnSizing_unstable);\n\n // eslint-disable-next-line deprecation/deprecation -- prefer HTMLTableCellElement\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableHeaderCellElement>) => {\n if (sortable) {\n toggleColumnSort(e, columnId);\n }\n props.onClick?.(e);\n });\n\n return useTableHeaderCell_unstable(\n {\n sortDirection,\n as: 'div',\n tabIndex: sortable ? undefined : 0,\n ...(resizableColumns ? columnSizing.getTableHeaderCellProps(columnId) : {}),\n ...props,\n onClick,\n },\n ref,\n );\n};\n"],"names":["React","useEventCallback","useTableHeaderCell_unstable","useDataGridContext_unstable","useColumnIdContext","useTableContext","useDataGridHeaderCell_unstable","props","ref","columnId","sortable","toggleColumnSort","ctx","sort","sortDirection","getSortDirection","undefined","resizableColumns","columnSizing","columnSizing_unstable","onClick","e","as","tabIndex","getTableHeaderCellProps"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ,4BAA4B;AAE7D,SAASC,2BAA2B,QAAQ,wCAAwC;AACpF,SAASC,2BAA2B,QAAQ,iCAAiC;AAC7E,SAASC,kBAAkB,QAAQ,iCAAiC;AACpE,SAASC,eAAe,QAAQ,8BAA8B;AAE9D;;;;;;;;CAQC,GACD,OAAO,MAAMC,iCAAiC,CAC5CC,OACAC;IAEA,MAAMC,WAAWL;IACjB,MAAM,EAAEM,QAAQ,EAAE,GAAGL;IACrB,MAAMM,mBAAmBR,4BAA4BS,CAAAA,MAAOA,IAAIC,IAAI,CAACF,gBAAgB;IACrF,MAAMG,gBAAgBX,4BAA4BS,CAAAA,MAChDF,WAAWE,IAAIC,IAAI,CAACE,gBAAgB,CAACN,YAAYO;IAGnD,MAAMC,mBAAmBd,4BAA4BS,CAAAA,MAAOA,IAAIK,gBAAgB;IAChF,MAAMC,eAAef,4BAA4BS,CAAAA,MAAOA,IAAIO,qBAAqB;IAEjF,kFAAkF;IAClF,MAAMC,UAAUnB,iBAAiB,CAACoB;YAIhCd,gBAAAA;QAHA,IAAIG,UAAU;YACZC,iBAAiBU,GAAGZ;QACtB;SACAF,iBAAAA,CAAAA,SAAAA,OAAMa,OAAO,cAAbb,qCAAAA,oBAAAA,QAAgBc;IAClB;IAEA,OAAOnB,4BACL;QACEY;QACAQ,IAAI;QACJC,UAAUb,WAAWM,YAAY;QACjC,GAAIC,mBAAmBC,aAAaM,uBAAuB,CAACf,YAAY,CAAC,CAAC;QAC1E,GAAGF,KAAK;QACRa;IACF,GACAZ;AAEJ,EAAE"}
1
+ {"version":3,"sources":["useDataGridHeaderCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport type { DataGridHeaderCellProps, DataGridHeaderCellState } from './DataGridHeaderCell.types';\nimport { useTableHeaderCell_unstable } from '../TableHeaderCell/useTableHeaderCell';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useColumnIdContext } from '../../contexts/columnIdContext';\nimport { useTableContext } from '../../contexts/tableContext';\nimport { isColumnSortable } from '../../utils/isColumnSortable';\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: gridSortable } = useTableContext();\n const toggleColumnSort = useDataGridContext_unstable(ctx => ctx.sort.toggleColumnSort);\n\n const sortable = useDataGridContext_unstable(ctx => {\n const columnSortable = !!ctx.columns.find(c => c.columnId === columnId && isColumnSortable(c));\n if (!gridSortable) {\n // if the grid is not sortable - disable sorting on all columns\n return false;\n }\n\n return columnSortable;\n });\n\n const sortDirection = useDataGridContext_unstable(ctx =>\n sortable ? ctx.sort.getSortDirection(columnId) : undefined,\n );\n const resizableColumns = useDataGridContext_unstable(ctx => ctx.resizableColumns);\n const columnSizing = useDataGridContext_unstable(ctx => ctx.columnSizing_unstable);\n\n // eslint-disable-next-line deprecation/deprecation -- prefer HTMLTableCellElement\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableHeaderCellElement>) => {\n if (sortable) {\n toggleColumnSort(e, columnId);\n }\n props.onClick?.(e);\n });\n\n return useTableHeaderCell_unstable(\n {\n sortable,\n sortDirection,\n as: 'div',\n tabIndex: sortable ? undefined : 0,\n ...(resizableColumns ? columnSizing.getTableHeaderCellProps(columnId) : {}),\n ...props,\n onClick,\n },\n ref,\n );\n};\n"],"names":["React","useEventCallback","useTableHeaderCell_unstable","useDataGridContext_unstable","useColumnIdContext","useTableContext","isColumnSortable","useDataGridHeaderCell_unstable","props","ref","columnId","sortable","gridSortable","toggleColumnSort","ctx","sort","columnSortable","columns","find","c","sortDirection","getSortDirection","undefined","resizableColumns","columnSizing","columnSizing_unstable","onClick","e","as","tabIndex","getTableHeaderCellProps"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ,4BAA4B;AAE7D,SAASC,2BAA2B,QAAQ,wCAAwC;AACpF,SAASC,2BAA2B,QAAQ,iCAAiC;AAC7E,SAASC,kBAAkB,QAAQ,iCAAiC;AACpE,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,gBAAgB,QAAQ,+BAA+B;AAEhE;;;;;;;;CAQC,GACD,OAAO,MAAMC,iCAAiC,CAC5CC,OACAC;IAEA,MAAMC,WAAWN;IACjB,MAAM,EAAEO,UAAUC,YAAY,EAAE,GAAGP;IACnC,MAAMQ,mBAAmBV,4BAA4BW,CAAAA,MAAOA,IAAIC,IAAI,CAACF,gBAAgB;IAErF,MAAMF,WAAWR,4BAA4BW,CAAAA;QAC3C,MAAME,iBAAiB,CAAC,CAACF,IAAIG,OAAO,CAACC,IAAI,CAACC,CAAAA,IAAKA,EAAET,QAAQ,KAAKA,YAAYJ,iBAAiBa;QAC3F,IAAI,CAACP,cAAc;YACjB,+DAA+D;YAC/D,OAAO;QACT;QAEA,OAAOI;IACT;IAEA,MAAMI,gBAAgBjB,4BAA4BW,CAAAA,MAChDH,WAAWG,IAAIC,IAAI,CAACM,gBAAgB,CAACX,YAAYY;IAEnD,MAAMC,mBAAmBpB,4BAA4BW,CAAAA,MAAOA,IAAIS,gBAAgB;IAChF,MAAMC,eAAerB,4BAA4BW,CAAAA,MAAOA,IAAIW,qBAAqB;IAEjF,kFAAkF;IAClF,MAAMC,UAAUzB,iBAAiB,CAAC0B;YAIhCnB;QAHA,IAAIG,UAAU;YACZE,iBAAiBc,GAAGjB;QACtB;SACAF,iBAAAA,MAAMkB,OAAO,cAAblB,qCAAAA,oBAAAA,OAAgBmB;IAClB;IAEA,OAAOzB,4BACL;QACES;QACAS;QACAQ,IAAI;QACJC,UAAUlB,WAAWW,YAAY;QACjC,GAAIC,mBAAmBC,aAAaM,uBAAuB,CAACpB,YAAY,CAAC,CAAC;QAC1E,GAAGF,KAAK;QACRkB;IACF,GACAjB;AAEJ,EAAE"}
@@ -32,20 +32,20 @@ import { useIsInTableHeader } from '../../contexts/tableHeaderContext';
32
32
  const toggleRow = useDataGridContext_unstable((ctx)=>ctx.selection.toggleRow);
33
33
  const dataGridContextValue = useDataGridContext_unstable((ctx)=>ctx);
34
34
  const onClick = useEventCallback((e)=>{
35
- var _props_onClick, _props;
35
+ var _props_onClick;
36
36
  if (selectable && !isHeader) {
37
37
  toggleRow(e, rowId);
38
38
  }
39
- (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, e);
39
+ (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);
40
40
  });
41
41
  const onKeyDown = useEventCallback((e)=>{
42
- var _props_onKeyDown, _props;
42
+ var _props_onKeyDown;
43
43
  if (selectable && !isHeader && e.key === Space && !isInteractiveHTMLElement(e.target)) {
44
44
  // stop scrolling
45
45
  e.preventDefault();
46
46
  toggleRow(e, rowId);
47
47
  }
48
- (_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, e);
48
+ (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);
49
49
  });
50
50
  const baseState = useTableRow_unstable({
51
51
  appearance,
@@ -1 +1 @@
1
- {"version":3,"sources":["useDataGridRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { isInteractiveHTMLElement, useEventCallback, slot } from '@fluentui/react-utilities';\nimport { Space } from '@fluentui/keyboard-keys';\nimport type { DataGridRowProps, DataGridRowState } from './DataGridRow.types';\nimport { useTableRow_unstable } from '../TableRow/useTableRow';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { DataGridSelectionCell } from '../DataGridSelectionCell/DataGridSelectionCell';\nimport { useTableRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\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 = useTableRowIdContext();\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 focusMode = useDataGridContext_unstable(ctx => ctx.focusMode);\n const compositeRowTabsterAttribute = useDataGridContext_unstable(ctx => ctx.compositeRowTabsterAttribute);\n const tabbable = focusMode === 'row_unstable' || focusMode === 'composite';\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 const dataGridContextValue = useDataGridContext_unstable(ctx => ctx);\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 === Space && !isInteractiveHTMLElement(e.target as HTMLElement)) {\n // stop scrolling\n e.preventDefault();\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 tabIndex: tabbable && !isHeader ? 0 : undefined,\n ...(focusMode === 'composite' && !isHeader && compositeRowTabsterAttribute),\n ...props,\n onClick,\n onKeyDown,\n children: null,\n as: 'div',\n },\n ref,\n );\n\n return {\n ...baseState,\n components: {\n ...baseState.components,\n selectionCell: DataGridSelectionCell,\n },\n selectionCell: slot.optional(props.selectionCell, {\n renderByDefault: selectable,\n elementType: DataGridSelectionCell,\n }),\n renderCell: props.children,\n columnDefs,\n dataGridContextValue,\n };\n};\n"],"names":["React","isInteractiveHTMLElement","useEventCallback","slot","Space","useTableRow_unstable","useDataGridContext_unstable","DataGridSelectionCell","useTableRowIdContext","useIsInTableHeader","useDataGridRow_unstable","props","ref","rowId","isHeader","columnDefs","ctx","columns","selectable","selectableRows","selected","selection","isRowSelected","focusMode","compositeRowTabsterAttribute","tabbable","appearance","selectionAppearance","toggleRow","dataGridContextValue","onClick","e","onKeyDown","key","target","preventDefault","baseState","undefined","tabIndex","children","as","components","selectionCell","optional","renderByDefault","elementType","renderCell"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,4BAA4B;AAC7F,SAASC,KAAK,QAAQ,0BAA0B;AAEhD,SAASC,oBAAoB,QAAQ,0BAA0B;AAC/D,SAASC,2BAA2B,QAAQ,iCAAiC;AAC7E,SAASC,qBAAqB,QAAQ,iDAAiD;AACvF,SAASC,oBAAoB,QAAQ,8BAA8B;AACnE,SAASC,kBAAkB,QAAQ,oCAAoC;AAEvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,MAAMC,QAAQL;IACd,MAAMM,WAAWL;IACjB,MAAMM,aAAaT,4BAA4BU,CAAAA,MAAOA,IAAIC,OAAO;IACjE,MAAMC,aAAaZ,4BAA4BU,CAAAA,MAAOA,IAAIG,cAAc;IACxE,MAAMC,WAAWd,4BAA4BU,CAAAA,MAAOA,IAAIK,SAAS,CAACC,aAAa,CAACT;IAChF,MAAMU,YAAYjB,4BAA4BU,CAAAA,MAAOA,IAAIO,SAAS;IAClE,MAAMC,+BAA+BlB,4BAA4BU,CAAAA,MAAOA,IAAIQ,4BAA4B;IACxG,MAAMC,WAAWF,cAAc,kBAAkBA,cAAc;IAC/D,MAAMG,aAAapB,4BAA4BU,CAAAA;QAC7C,IAAI,CAACF,YAAYI,cAAcF,IAAIK,SAAS,CAACC,aAAa,CAACT,QAAQ;YACjE,OAAOG,IAAIW,mBAAmB;QAChC;QAEA,OAAO;IACT;IACA,MAAMC,YAAYtB,4BAA4BU,CAAAA,MAAOA,IAAIK,SAAS,CAACO,SAAS;IAC5E,MAAMC,uBAAuBvB,4BAA4BU,CAAAA,MAAOA;IAEhE,MAAMc,UAAU5B,iBAAiB,CAAC6B;YAKhCpB,gBAAAA;QAJA,IAAIO,cAAc,CAACJ,UAAU;YAC3Bc,UAAUG,GAAGlB;QACf;SAEAF,iBAAAA,CAAAA,SAAAA,OAAMmB,OAAO,cAAbnB,qCAAAA,oBAAAA,QAAgBoB;IAClB;IAEA,MAAMC,YAAY9B,iBAAiB,CAAC6B;YAOlCpB,kBAAAA;QANA,IAAIO,cAAc,CAACJ,YAAYiB,EAAEE,GAAG,KAAK7B,SAAS,CAACH,yBAAyB8B,EAAEG,MAAM,GAAkB;YACpG,iBAAiB;YACjBH,EAAEI,cAAc;YAChBP,UAAUG,GAAGlB;QACf;SAEAF,mBAAAA,CAAAA,SAAAA,OAAMqB,SAAS,cAAfrB,uCAAAA,sBAAAA,QAAkBoB;IACpB;IAEA,MAAMK,YAAY/B,qBAChB;QACEqB;QACA,iBAAiBR,aAAaE,WAAWiB;QACzCC,UAAUb,YAAY,CAACX,WAAW,IAAIuB;QACtC,GAAId,cAAc,eAAe,CAACT,YAAYU,4BAA4B;QAC1E,GAAGb,KAAK;QACRmB;QACAE;QACAO,UAAU;QACVC,IAAI;IACN,GACA5B;IAGF,OAAO;QACL,GAAGwB,SAAS;QACZK,YAAY;YACV,GAAGL,UAAUK,UAAU;YACvBC,eAAenC;QACjB;QACAmC,eAAevC,KAAKwC,QAAQ,CAAChC,MAAM+B,aAAa,EAAE;YAChDE,iBAAiB1B;YACjB2B,aAAatC;QACf;QACAuC,YAAYnC,MAAM4B,QAAQ;QAC1BxB;QACAc;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["useDataGridRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { isInteractiveHTMLElement, useEventCallback, slot } from '@fluentui/react-utilities';\nimport { Space } from '@fluentui/keyboard-keys';\nimport type { DataGridRowProps, DataGridRowState } from './DataGridRow.types';\nimport { useTableRow_unstable } from '../TableRow/useTableRow';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { DataGridSelectionCell } from '../DataGridSelectionCell/DataGridSelectionCell';\nimport { useTableRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\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 = useTableRowIdContext();\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 focusMode = useDataGridContext_unstable(ctx => ctx.focusMode);\n const compositeRowTabsterAttribute = useDataGridContext_unstable(ctx => ctx.compositeRowTabsterAttribute);\n const tabbable = focusMode === 'row_unstable' || focusMode === 'composite';\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 const dataGridContextValue = useDataGridContext_unstable(ctx => ctx);\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 === Space && !isInteractiveHTMLElement(e.target as HTMLElement)) {\n // stop scrolling\n e.preventDefault();\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 tabIndex: tabbable && !isHeader ? 0 : undefined,\n ...(focusMode === 'composite' && !isHeader && compositeRowTabsterAttribute),\n ...props,\n onClick,\n onKeyDown,\n children: null,\n as: 'div',\n },\n ref,\n );\n\n return {\n ...baseState,\n components: {\n ...baseState.components,\n selectionCell: DataGridSelectionCell,\n },\n selectionCell: slot.optional(props.selectionCell, {\n renderByDefault: selectable,\n elementType: DataGridSelectionCell,\n }),\n renderCell: props.children,\n columnDefs,\n dataGridContextValue,\n };\n};\n"],"names":["React","isInteractiveHTMLElement","useEventCallback","slot","Space","useTableRow_unstable","useDataGridContext_unstable","DataGridSelectionCell","useTableRowIdContext","useIsInTableHeader","useDataGridRow_unstable","props","ref","rowId","isHeader","columnDefs","ctx","columns","selectable","selectableRows","selected","selection","isRowSelected","focusMode","compositeRowTabsterAttribute","tabbable","appearance","selectionAppearance","toggleRow","dataGridContextValue","onClick","e","onKeyDown","key","target","preventDefault","baseState","undefined","tabIndex","children","as","components","selectionCell","optional","renderByDefault","elementType","renderCell"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,4BAA4B;AAC7F,SAASC,KAAK,QAAQ,0BAA0B;AAEhD,SAASC,oBAAoB,QAAQ,0BAA0B;AAC/D,SAASC,2BAA2B,QAAQ,iCAAiC;AAC7E,SAASC,qBAAqB,QAAQ,iDAAiD;AACvF,SAASC,oBAAoB,QAAQ,8BAA8B;AACnE,SAASC,kBAAkB,QAAQ,oCAAoC;AAEvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,MAAMC,QAAQL;IACd,MAAMM,WAAWL;IACjB,MAAMM,aAAaT,4BAA4BU,CAAAA,MAAOA,IAAIC,OAAO;IACjE,MAAMC,aAAaZ,4BAA4BU,CAAAA,MAAOA,IAAIG,cAAc;IACxE,MAAMC,WAAWd,4BAA4BU,CAAAA,MAAOA,IAAIK,SAAS,CAACC,aAAa,CAACT;IAChF,MAAMU,YAAYjB,4BAA4BU,CAAAA,MAAOA,IAAIO,SAAS;IAClE,MAAMC,+BAA+BlB,4BAA4BU,CAAAA,MAAOA,IAAIQ,4BAA4B;IACxG,MAAMC,WAAWF,cAAc,kBAAkBA,cAAc;IAC/D,MAAMG,aAAapB,4BAA4BU,CAAAA;QAC7C,IAAI,CAACF,YAAYI,cAAcF,IAAIK,SAAS,CAACC,aAAa,CAACT,QAAQ;YACjE,OAAOG,IAAIW,mBAAmB;QAChC;QAEA,OAAO;IACT;IACA,MAAMC,YAAYtB,4BAA4BU,CAAAA,MAAOA,IAAIK,SAAS,CAACO,SAAS;IAC5E,MAAMC,uBAAuBvB,4BAA4BU,CAAAA,MAAOA;IAEhE,MAAMc,UAAU5B,iBAAiB,CAAC6B;YAKhCpB;QAJA,IAAIO,cAAc,CAACJ,UAAU;YAC3Bc,UAAUG,GAAGlB;QACf;SAEAF,iBAAAA,MAAMmB,OAAO,cAAbnB,qCAAAA,oBAAAA,OAAgBoB;IAClB;IAEA,MAAMC,YAAY9B,iBAAiB,CAAC6B;YAOlCpB;QANA,IAAIO,cAAc,CAACJ,YAAYiB,EAAEE,GAAG,KAAK7B,SAAS,CAACH,yBAAyB8B,EAAEG,MAAM,GAAkB;YACpG,iBAAiB;YACjBH,EAAEI,cAAc;YAChBP,UAAUG,GAAGlB;QACf;SAEAF,mBAAAA,MAAMqB,SAAS,cAAfrB,uCAAAA,sBAAAA,OAAkBoB;IACpB;IAEA,MAAMK,YAAY/B,qBAChB;QACEqB;QACA,iBAAiBR,aAAaE,WAAWiB;QACzCC,UAAUb,YAAY,CAACX,WAAW,IAAIuB;QACtC,GAAId,cAAc,eAAe,CAACT,YAAYU,4BAA4B;QAC1E,GAAGb,KAAK;QACRmB;QACAE;QACAO,UAAU;QACVC,IAAI;IACN,GACA5B;IAGF,OAAO;QACL,GAAGwB,SAAS;QACZK,YAAY;YACV,GAAGL,UAAUK,UAAU;YACvBC,eAAenC;QACjB;QACAmC,eAAevC,KAAKwC,QAAQ,CAAChC,MAAM+B,aAAa,EAAE;YAChDE,iBAAiB1B;YACjB2B,aAAatC;QACf;QACAuC,YAAYnC,MAAM4B,QAAQ;QAC1BxB;QACAc;IACF;AACF,EAAE"}
@@ -25,11 +25,11 @@ import { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSe
25
25
  const toggleAllRows = useDataGridContext_unstable((ctx)=>ctx.selection.toggleAllRows);
26
26
  const type = useDataGridContext_unstable((ctx)=>ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio');
27
27
  const onClick = useEventCallback((e)=>{
28
- var _props_onClick, _props;
28
+ var _props_onClick;
29
29
  if (isHeader) {
30
30
  toggleAllRows(e);
31
31
  }
32
- (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, e);
32
+ (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);
33
33
  });
34
34
  return useTableSelectionCell_unstable({
35
35
  as: 'div',
@@ -1 +1 @@
1
- {"version":3,"sources":["useDataGridSelectionCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useTableRowIdContext } 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 = useTableRowIdContext();\n const subtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);\n const checked = useDataGridContext_unstable(ctx => {\n if (isHeader && ctx.selection.selectionMode === '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 hidden: isHeader && type === 'radio',\n 'aria-checked': isHeader ? checked : undefined,\n 'aria-selected': isHeader || checked === 'mixed' ? undefined : checked,\n subtle,\n ...props,\n onClick,\n },\n ref,\n );\n};\n"],"names":["React","useEventCallback","useDataGridContext_unstable","useTableRowIdContext","useIsInTableHeader","useTableSelectionCell_unstable","useDataGridSelectionCell_unstable","props","ref","isHeader","rowId","subtle","ctx","subtleSelection","checked","selection","selectionMode","allRowsSelected","someRowsSelected","isRowSelected","toggleAllRows","type","onClick","e","as","role","hidden","undefined"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,2BAA2B,QAAQ,iCAAiC;AAC7E,SAASC,oBAAoB,QAAQ,8BAA8B;AACnE,SAASC,kBAAkB,QAAQ,oCAAoC;AACvE,SAASC,8BAA8B,QAAQ,8CAA8C;AAG7F;;;;;;;;CAQC,GACD,OAAO,MAAMC,oCAAoC,CAC/CC,OACAC;IAEA,MAAMC,WAAWL;IACjB,MAAMM,QAAQP;IACd,MAAMQ,SAAST,4BAA4BU,CAAAA,MAAOA,IAAIC,eAAe;IACrE,MAAMC,UAAUZ,4BAA4BU,CAAAA;QAC1C,IAAIH,YAAYG,IAAIG,SAAS,CAACC,aAAa,KAAK,eAAe;YAC7D,OAAOJ,IAAIG,SAAS,CAACE,eAAe,GAAG,OAAOL,IAAIG,SAAS,CAACG,gBAAgB,GAAG,UAAU;QAC3F;QAEA,OAAON,IAAIG,SAAS,CAACI,aAAa,CAACT;IACrC;IAEA,MAAMU,gBAAgBlB,4BAA4BU,CAAAA,MAAOA,IAAIG,SAAS,CAACK,aAAa;IACpF,MAAMC,OAAOnB,4BAA4BU,CAAAA,MACvCA,IAAIG,SAAS,CAACC,aAAa,KAAK,gBAAgB,aAAa;IAG/D,MAAMM,UAAUrB,iBAAiB,CAACsB;YAKhChB,gBAAAA;QAJA,IAAIE,UAAU;YACZW,cAAcG;QAChB;SAEAhB,iBAAAA,CAAAA,SAAAA,OAAMe,OAAO,cAAbf,qCAAAA,oBAAAA,QAAgBgB;IAClB;IAEA,OAAOlB,+BACL;QACEmB,IAAI;QACJC,MAAM;QACNX;QACAO;QACAK,QAAQjB,YAAYY,SAAS;QAC7B,gBAAgBZ,WAAWK,UAAUa;QACrC,iBAAiBlB,YAAYK,YAAY,UAAUa,YAAYb;QAC/DH;QACA,GAAGJ,KAAK;QACRe;IACF,GACAd;AAEJ,EAAE"}
1
+ {"version":3,"sources":["useDataGridSelectionCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useTableRowIdContext } 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 = useTableRowIdContext();\n const subtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);\n const checked = useDataGridContext_unstable(ctx => {\n if (isHeader && ctx.selection.selectionMode === '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 hidden: isHeader && type === 'radio',\n 'aria-checked': isHeader ? checked : undefined,\n 'aria-selected': isHeader || checked === 'mixed' ? undefined : checked,\n subtle,\n ...props,\n onClick,\n },\n ref,\n );\n};\n"],"names":["React","useEventCallback","useDataGridContext_unstable","useTableRowIdContext","useIsInTableHeader","useTableSelectionCell_unstable","useDataGridSelectionCell_unstable","props","ref","isHeader","rowId","subtle","ctx","subtleSelection","checked","selection","selectionMode","allRowsSelected","someRowsSelected","isRowSelected","toggleAllRows","type","onClick","e","as","role","hidden","undefined"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,2BAA2B,QAAQ,iCAAiC;AAC7E,SAASC,oBAAoB,QAAQ,8BAA8B;AACnE,SAASC,kBAAkB,QAAQ,oCAAoC;AACvE,SAASC,8BAA8B,QAAQ,8CAA8C;AAG7F;;;;;;;;CAQC,GACD,OAAO,MAAMC,oCAAoC,CAC/CC,OACAC;IAEA,MAAMC,WAAWL;IACjB,MAAMM,QAAQP;IACd,MAAMQ,SAAST,4BAA4BU,CAAAA,MAAOA,IAAIC,eAAe;IACrE,MAAMC,UAAUZ,4BAA4BU,CAAAA;QAC1C,IAAIH,YAAYG,IAAIG,SAAS,CAACC,aAAa,KAAK,eAAe;YAC7D,OAAOJ,IAAIG,SAAS,CAACE,eAAe,GAAG,OAAOL,IAAIG,SAAS,CAACG,gBAAgB,GAAG,UAAU;QAC3F;QAEA,OAAON,IAAIG,SAAS,CAACI,aAAa,CAACT;IACrC;IAEA,MAAMU,gBAAgBlB,4BAA4BU,CAAAA,MAAOA,IAAIG,SAAS,CAACK,aAAa;IACpF,MAAMC,OAAOnB,4BAA4BU,CAAAA,MACvCA,IAAIG,SAAS,CAACC,aAAa,KAAK,gBAAgB,aAAa;IAG/D,MAAMM,UAAUrB,iBAAiB,CAACsB;YAKhChB;QAJA,IAAIE,UAAU;YACZW,cAAcG;QAChB;SAEAhB,iBAAAA,MAAMe,OAAO,cAAbf,qCAAAA,oBAAAA,OAAgBgB;IAClB;IAEA,OAAOlB,+BACL;QACEmB,IAAI;QACJC,MAAM;QACNX;QACAO;QACAK,QAAQjB,YAAYY,SAAS;QAC7B,gBAAgBZ,WAAWK,UAAUa;QACrC,iBAAiBlB,YAAYK,YAAY,UAAUa,YAAYb;QAC/DH;QACA,GAAGJ,KAAK;QACRe;IACF,GACAd;AAEJ,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["TableHeaderCell.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport { SortDirection, TableContextValue } from '../Table/Table.types';\n\nexport type TableHeaderCellSlots = {\n root: Slot<'th', 'div'>;\n\n sortIcon: Slot<'span'>;\n\n /**\n * Button handles correct narration and interactions for sorting;\n */\n button: NonNullable<Slot<ARIAButtonSlotProps>>;\n /**\n * aside content for anything that should be after main content of the table header cell\n */\n aside: Slot<'span'>;\n};\n\n/**\n * TableHeaderCell Props\n */\nexport type TableHeaderCellProps = ComponentProps<Partial<TableHeaderCellSlots>> & {\n /**\n * @default undefined\n */\n sortDirection?: SortDirection;\n};\n\n/**\n * State used in rendering TableHeaderCell\n */\nexport type TableHeaderCellState = ComponentState<TableHeaderCellSlots> &\n Pick<TableContextValue, 'noNativeElements' | 'sortable'>;\n"],"names":[],"mappings":"AAAA,WAiC2D"}
1
+ {"version":3,"sources":["TableHeaderCell.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport { SortDirection, TableContextValue } from '../Table/Table.types';\n\nexport type TableHeaderCellSlots = {\n root: Slot<'th', 'div'>;\n\n sortIcon: Slot<'span'>;\n\n /**\n * Button handles correct narration and interactions for sorting;\n */\n button: NonNullable<Slot<ARIAButtonSlotProps>>;\n /**\n * aside content for anything that should be after main content of the table header cell\n */\n aside: Slot<'span'>;\n};\n\n/**\n * TableHeaderCell Props\n */\nexport type TableHeaderCellProps = ComponentProps<Partial<TableHeaderCellSlots>> & {\n /**\n * Whether the column is sortable\n * @default false\n */\n sortable?: boolean;\n /**\n * @default undefined\n */\n sortDirection?: SortDirection;\n};\n\n/**\n * State used in rendering TableHeaderCell\n */\nexport type TableHeaderCellState = ComponentState<TableHeaderCellSlots> &\n Pick<TableContextValue, 'noNativeElements'> &\n Pick<TableHeaderCellProps, 'sortable'>;\n"],"names":[],"mappings":"AAAA,WAuCyC"}
@@ -21,7 +21,8 @@ const sortIcons = {
21
21
  * @param props - props from this instance of TableHeaderCell
22
22
  * @param ref - reference to root HTMLElement of TableHeaderCell
23
23
  */ export const useTableHeaderCell_unstable = (props, ref)=>{
24
- const { noNativeElements, sortable } = useTableContext();
24
+ const { noNativeElements, sortable: contextSortable } = useTableContext();
25
+ const { sortable = contextSortable } = props;
25
26
  var _props_as;
26
27
  const rootComponent = ((_props_as = props.as) !== null && _props_as !== void 0 ? _props_as : noNativeElements) ? 'div' : 'th';
27
28
  var _props_sortDirection;
@@ -1 +1 @@
1
- {"version":3,"sources":["useTableHeaderCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport { ArrowUpRegular, ArrowDownRegular } from '@fluentui/react-icons';\nimport { useARIAButtonShorthand } from '@fluentui/react-aria';\nimport type { TableHeaderCellProps, TableHeaderCellState } from './TableHeaderCell.types';\nimport { useTableContext } from '../../contexts/tableContext';\n\nconst sortIcons = {\n ascending: <ArrowUpRegular fontSize={12} />,\n descending: <ArrowDownRegular fontSize={12} />,\n};\n\n/**\n * Create the state required to render TableHeaderCell.\n *\n * The returned state can be modified with hooks such as useTableHeaderCellStyles_unstable,\n * before being passed to renderTableHeaderCell_unstable.\n *\n * @param props - props from this instance of TableHeaderCell\n * @param ref - reference to root HTMLElement of TableHeaderCell\n */\nexport const useTableHeaderCell_unstable = (\n props: TableHeaderCellProps,\n ref: React.Ref<HTMLElement>,\n): TableHeaderCellState => {\n const { noNativeElements, sortable } = useTableContext();\n\n const rootComponent = props.as ?? noNativeElements ? 'div' : 'th';\n\n return {\n components: {\n root: rootComponent,\n button: 'div',\n sortIcon: 'span',\n aside: 'span',\n },\n root: slot.always(\n getNativeElementProps(rootComponent, {\n ref: useMergedRefs(ref, useFocusWithin()),\n role: rootComponent === 'div' ? 'columnheader' : undefined,\n 'aria-sort': sortable ? props.sortDirection ?? 'none' : undefined,\n ...props,\n }),\n { elementType: rootComponent },\n ),\n aside: slot.optional(props.aside, { elementType: 'span' }),\n sortIcon: slot.optional(props.sortIcon, {\n renderByDefault: !!props.sortDirection,\n defaultProps: { children: props.sortDirection ? sortIcons[props.sortDirection] : undefined },\n elementType: 'span',\n }),\n button: slot.always(\n useARIAButtonShorthand(props.button, {\n required: true,\n defaultProps: {\n as: 'div',\n ...(!sortable && {\n role: 'presentation',\n tabIndex: undefined,\n }),\n },\n }),\n { elementType: 'div' },\n ),\n sortable,\n noNativeElements,\n };\n};\n"],"names":["React","getNativeElementProps","useMergedRefs","slot","useFocusWithin","ArrowUpRegular","ArrowDownRegular","useARIAButtonShorthand","useTableContext","sortIcons","ascending","fontSize","descending","useTableHeaderCell_unstable","props","ref","noNativeElements","sortable","rootComponent","as","components","root","button","sortIcon","aside","always","role","undefined","sortDirection","elementType","optional","renderByDefault","defaultProps","children","required","tabIndex"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,IAAI,QAAQ,4BAA4B;AACvF,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,wBAAwB;AACzE,SAASC,sBAAsB,QAAQ,uBAAuB;AAE9D,SAASC,eAAe,QAAQ,8BAA8B;AAE9D,MAAMC,YAAY;IAChBC,yBAAW,oBAACL;QAAeM,UAAU;;IACrCC,0BAAY,oBAACN;QAAiBK,UAAU;;AAC1C;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAME,8BAA8B,CACzCC,OACAC;IAEA,MAAM,EAAEC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGT;QAEjBM;IAAtB,MAAMI,gBAAgBJ,CAAAA,CAAAA,YAAAA,MAAMK,EAAE,cAARL,uBAAAA,YAAYE,gBAAe,IAAI,QAAQ;QAa/BF;IAX9B,OAAO;QACLM,YAAY;YACVC,MAAMH;YACNI,QAAQ;YACRC,UAAU;YACVC,OAAO;QACT;QACAH,MAAMlB,KAAKsB,MAAM,CACfxB,sBAAsBiB,eAAe;YACnCH,KAAKb,cAAca,KAAKX;YACxBsB,MAAMR,kBAAkB,QAAQ,iBAAiBS;YACjD,aAAaV,WAAWH,CAAAA,uBAAAA,MAAMc,aAAa,cAAnBd,kCAAAA,uBAAuB,SAASa;YACxD,GAAGb,KAAK;QACV,IACA;YAAEe,aAAaX;QAAc;QAE/BM,OAAOrB,KAAK2B,QAAQ,CAAChB,MAAMU,KAAK,EAAE;YAAEK,aAAa;QAAO;QACxDN,UAAUpB,KAAK2B,QAAQ,CAAChB,MAAMS,QAAQ,EAAE;YACtCQ,iBAAiB,CAAC,CAACjB,MAAMc,aAAa;YACtCI,cAAc;gBAAEC,UAAUnB,MAAMc,aAAa,GAAGnB,SAAS,CAACK,MAAMc,aAAa,CAAC,GAAGD;YAAU;YAC3FE,aAAa;QACf;QACAP,QAAQnB,KAAKsB,MAAM,CACjBlB,uBAAuBO,MAAMQ,MAAM,EAAE;YACnCY,UAAU;YACVF,cAAc;gBACZb,IAAI;gBACJ,GAAI,CAACF,YAAY;oBACfS,MAAM;oBACNS,UAAUR;gBACZ,CAAC;YACH;QACF,IACA;YAAEE,aAAa;QAAM;QAEvBZ;QACAD;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["useTableHeaderCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useMergedRefs, slot } from '@fluentui/react-utilities';\nimport { useFocusWithin } from '@fluentui/react-tabster';\nimport { ArrowUpRegular, ArrowDownRegular } from '@fluentui/react-icons';\nimport { useARIAButtonShorthand } from '@fluentui/react-aria';\nimport type { TableHeaderCellProps, TableHeaderCellState } from './TableHeaderCell.types';\nimport { useTableContext } from '../../contexts/tableContext';\n\nconst sortIcons = {\n ascending: <ArrowUpRegular fontSize={12} />,\n descending: <ArrowDownRegular fontSize={12} />,\n};\n\n/**\n * Create the state required to render TableHeaderCell.\n *\n * The returned state can be modified with hooks such as useTableHeaderCellStyles_unstable,\n * before being passed to renderTableHeaderCell_unstable.\n *\n * @param props - props from this instance of TableHeaderCell\n * @param ref - reference to root HTMLElement of TableHeaderCell\n */\nexport const useTableHeaderCell_unstable = (\n props: TableHeaderCellProps,\n ref: React.Ref<HTMLElement>,\n): TableHeaderCellState => {\n const { noNativeElements, sortable: contextSortable } = useTableContext();\n const { sortable = contextSortable } = props;\n\n const rootComponent = props.as ?? noNativeElements ? 'div' : 'th';\n\n return {\n components: {\n root: rootComponent,\n button: 'div',\n sortIcon: 'span',\n aside: 'span',\n },\n root: slot.always(\n getNativeElementProps(rootComponent, {\n ref: useMergedRefs(ref, useFocusWithin()),\n role: rootComponent === 'div' ? 'columnheader' : undefined,\n 'aria-sort': sortable ? props.sortDirection ?? 'none' : undefined,\n ...props,\n }),\n { elementType: rootComponent },\n ),\n aside: slot.optional(props.aside, { elementType: 'span' }),\n sortIcon: slot.optional(props.sortIcon, {\n renderByDefault: !!props.sortDirection,\n defaultProps: { children: props.sortDirection ? sortIcons[props.sortDirection] : undefined },\n elementType: 'span',\n }),\n button: slot.always(\n useARIAButtonShorthand(props.button, {\n required: true,\n defaultProps: {\n as: 'div',\n ...(!sortable && {\n role: 'presentation',\n tabIndex: undefined,\n }),\n },\n }),\n { elementType: 'div' },\n ),\n sortable,\n noNativeElements,\n };\n};\n"],"names":["React","getNativeElementProps","useMergedRefs","slot","useFocusWithin","ArrowUpRegular","ArrowDownRegular","useARIAButtonShorthand","useTableContext","sortIcons","ascending","fontSize","descending","useTableHeaderCell_unstable","props","ref","noNativeElements","sortable","contextSortable","rootComponent","as","components","root","button","sortIcon","aside","always","role","undefined","sortDirection","elementType","optional","renderByDefault","defaultProps","children","required","tabIndex"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,IAAI,QAAQ,4BAA4B;AACvF,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,wBAAwB;AACzE,SAASC,sBAAsB,QAAQ,uBAAuB;AAE9D,SAASC,eAAe,QAAQ,8BAA8B;AAE9D,MAAMC,YAAY;IAChBC,yBAAW,oBAACL;QAAeM,UAAU;;IACrCC,0BAAY,oBAACN;QAAiBK,UAAU;;AAC1C;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAME,8BAA8B,CACzCC,OACAC;IAEA,MAAM,EAAEC,gBAAgB,EAAEC,UAAUC,eAAe,EAAE,GAAGV;IACxD,MAAM,EAAES,WAAWC,eAAe,EAAE,GAAGJ;QAEjBA;IAAtB,MAAMK,gBAAgBL,CAAAA,CAAAA,YAAAA,MAAMM,EAAE,cAARN,uBAAAA,YAAYE,gBAAe,IAAI,QAAQ;QAa/BF;IAX9B,OAAO;QACLO,YAAY;YACVC,MAAMH;YACNI,QAAQ;YACRC,UAAU;YACVC,OAAO;QACT;QACAH,MAAMnB,KAAKuB,MAAM,CACfzB,sBAAsBkB,eAAe;YACnCJ,KAAKb,cAAca,KAAKX;YACxBuB,MAAMR,kBAAkB,QAAQ,iBAAiBS;YACjD,aAAaX,WAAWH,CAAAA,uBAAAA,MAAMe,aAAa,cAAnBf,kCAAAA,uBAAuB,SAASc;YACxD,GAAGd,KAAK;QACV,IACA;YAAEgB,aAAaX;QAAc;QAE/BM,OAAOtB,KAAK4B,QAAQ,CAACjB,MAAMW,KAAK,EAAE;YAAEK,aAAa;QAAO;QACxDN,UAAUrB,KAAK4B,QAAQ,CAACjB,MAAMU,QAAQ,EAAE;YACtCQ,iBAAiB,CAAC,CAAClB,MAAMe,aAAa;YACtCI,cAAc;gBAAEC,UAAUpB,MAAMe,aAAa,GAAGpB,SAAS,CAACK,MAAMe,aAAa,CAAC,GAAGD;YAAU;YAC3FE,aAAa;QACf;QACAP,QAAQpB,KAAKuB,MAAM,CACjBnB,uBAAuBO,MAAMS,MAAM,EAAE;YACnCY,UAAU;YACVF,cAAc;gBACZb,IAAI;gBACJ,GAAI,CAACH,YAAY;oBACfU,MAAM;oBACNS,UAAUR;gBACZ,CAAC;YACH;QACF,IACA;YAAEE,aAAa;QAAM;QAEvBb;QACAD;IACF;AACF,EAAE"}
@@ -10,8 +10,8 @@ import { getNativeElementProps, useEventCallback, slot } from '@fluentui/react-u
10
10
  * @param ref - reference to root HTMLElement of TableResizeHandle
11
11
  */ export const useTableResizeHandle_unstable = (props, ref)=>{
12
12
  const onClick = useEventCallback((event)=>{
13
- var _props_onClick, _props;
14
- (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, event);
13
+ var _props_onClick;
14
+ (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, event);
15
15
  event.stopPropagation();
16
16
  });
17
17
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["useTableResizeHandle.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useEventCallback, slot } from '@fluentui/react-utilities';\nimport type { TableResizeHandleProps, TableResizeHandleState } from './TableResizeHandle.types';\n\n/**\n * Create the state required to render TableResizeHandle.\n *\n * The returned state can be modified with hooks such as useTableResizeHandleStyles_unstable,\n * before being passed to renderTableResizeHandle_unstable.\n *\n * @param props - props from this instance of TableResizeHandle\n * @param ref - reference to root HTMLElement of TableResizeHandle\n */\nexport const useTableResizeHandle_unstable = (\n props: TableResizeHandleProps,\n ref: React.Ref<HTMLElement>,\n): TableResizeHandleState => {\n const onClick = useEventCallback((event: React.MouseEvent<HTMLDivElement>) => {\n props.onClick?.(event);\n event.stopPropagation();\n });\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getNativeElementProps('div', {\n ref,\n ...props,\n onClick,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","getNativeElementProps","useEventCallback","slot","useTableResizeHandle_unstable","props","ref","onClick","event","stopPropagation","components","root","always","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,4BAA4B;AAG1F;;;;;;;;CAQC,GACD,OAAO,MAAMC,gCAAgC,CAC3CC,OACAC;IAEA,MAAMC,UAAUL,iBAAiB,CAACM;YAChCH,gBAAAA;SAAAA,iBAAAA,CAAAA,SAAAA,OAAME,OAAO,cAAbF,qCAAAA,oBAAAA,QAAgBG;QAChBA,MAAMC,eAAe;IACvB;IACA,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAMR,KAAKS,MAAM,CACfX,sBAAsB,OAAO;YAC3BK;YACA,GAAGD,KAAK;YACRE;QACF,IACA;YAAEM,aAAa;QAAM;IAEzB;AACF,EAAE"}
1
+ {"version":3,"sources":["useTableResizeHandle.ts"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useEventCallback, slot } from '@fluentui/react-utilities';\nimport type { TableResizeHandleProps, TableResizeHandleState } from './TableResizeHandle.types';\n\n/**\n * Create the state required to render TableResizeHandle.\n *\n * The returned state can be modified with hooks such as useTableResizeHandleStyles_unstable,\n * before being passed to renderTableResizeHandle_unstable.\n *\n * @param props - props from this instance of TableResizeHandle\n * @param ref - reference to root HTMLElement of TableResizeHandle\n */\nexport const useTableResizeHandle_unstable = (\n props: TableResizeHandleProps,\n ref: React.Ref<HTMLElement>,\n): TableResizeHandleState => {\n const onClick = useEventCallback((event: React.MouseEvent<HTMLDivElement>) => {\n props.onClick?.(event);\n event.stopPropagation();\n });\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getNativeElementProps('div', {\n ref,\n ...props,\n onClick,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","getNativeElementProps","useEventCallback","slot","useTableResizeHandle_unstable","props","ref","onClick","event","stopPropagation","components","root","always","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,4BAA4B;AAG1F;;;;;;;;CAQC,GACD,OAAO,MAAMC,gCAAgC,CAC3CC,OACAC;IAEA,MAAMC,UAAUL,iBAAiB,CAACM;YAChCH;SAAAA,iBAAAA,MAAME,OAAO,cAAbF,qCAAAA,oBAAAA,OAAgBG;QAChBA,MAAMC,eAAe;IACvB;IACA,OAAO;QACLC,YAAY;YACVC,MAAM;QACR;QACAA,MAAMR,KAAKS,MAAM,CACfX,sBAAsB,OAAO;YAC3BK;YACA,GAAGD,KAAK;YACRE;QACF,IACA;YAAEM,aAAa;QAAM;IAEzB;AACF,EAAE"}
@@ -1,6 +1,8 @@
1
1
  import * as React from 'react';
2
2
  const columnIdContext = React.createContext(undefined);
3
3
  export const columnIdContextDefaultValue = '';
4
- var _React_useContext;
5
- export const useColumnIdContext = ()=>(_React_useContext = React.useContext(columnIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : columnIdContextDefaultValue;
4
+ export const useColumnIdContext = ()=>{
5
+ var _React_useContext;
6
+ return (_React_useContext = React.useContext(columnIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : columnIdContextDefaultValue;
7
+ };
6
8
  export const ColumnIdContextProvider = columnIdContext.Provider;
@@ -1 +1 @@
1
- {"version":3,"sources":["columnIdContext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TableColumnId } from '../hooks/';\n\nconst columnIdContext = React.createContext<TableColumnId | undefined>(undefined);\n\nexport const columnIdContextDefaultValue = '';\n\nexport const useColumnIdContext = () => React.useContext(columnIdContext) ?? columnIdContextDefaultValue;\n\nexport const ColumnIdContextProvider = columnIdContext.Provider;\n"],"names":["React","columnIdContext","createContext","undefined","columnIdContextDefaultValue","useColumnIdContext","useContext","ColumnIdContextProvider","Provider"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,MAAMC,kBAAkBD,MAAME,aAAa,CAA4BC;AAEvE,OAAO,MAAMC,8BAA8B,GAAG;IAENJ;AAAxC,OAAO,MAAMK,qBAAqB,IAAML,CAAAA,oBAAAA,MAAMM,UAAU,CAACL,8BAAjBD,+BAAAA,oBAAqCI,4BAA4B;AAEzG,OAAO,MAAMG,0BAA0BN,gBAAgBO,QAAQ,CAAC"}
1
+ {"version":3,"sources":["columnIdContext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TableColumnId } from '../hooks/';\n\nconst columnIdContext = React.createContext<TableColumnId | undefined>(undefined);\n\nexport const columnIdContextDefaultValue = '';\n\nexport const useColumnIdContext = () => React.useContext(columnIdContext) ?? columnIdContextDefaultValue;\n\nexport const ColumnIdContextProvider = columnIdContext.Provider;\n"],"names":["React","columnIdContext","createContext","undefined","columnIdContextDefaultValue","useColumnIdContext","useContext","ColumnIdContextProvider","Provider"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,MAAMC,kBAAkBD,MAAME,aAAa,CAA4BC;AAEvE,OAAO,MAAMC,8BAA8B,GAAG;AAE9C,OAAO,MAAMC,qBAAqB;QAAML;WAAAA,CAAAA,oBAAAA,MAAMM,UAAU,CAACL,8BAAjBD,+BAAAA,oBAAqCI;AAA0B,EAAE;AAEzG,OAAO,MAAMG,0BAA0BN,gBAAgBO,QAAQ,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import * as React from 'react';
2
2
  const rowIdContext = React.createContext(undefined);
3
3
  export const tableRowIdContextDefaultValue = '';
4
- var _React_useContext;
5
- export const useTableRowIdContext = ()=>(_React_useContext = React.useContext(rowIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : tableRowIdContextDefaultValue;
4
+ export const useTableRowIdContext = ()=>{
5
+ var _React_useContext;
6
+ return (_React_useContext = React.useContext(rowIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : tableRowIdContextDefaultValue;
7
+ };
6
8
  export const TableRowIdContextProvider = rowIdContext.Provider;
@@ -1 +1 @@
1
- {"version":3,"sources":["rowIdContext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TableRowId } from '../hooks/';\n\nconst rowIdContext = React.createContext<TableRowId | undefined>(undefined);\n\nexport const tableRowIdContextDefaultValue = '';\n\nexport const useTableRowIdContext = () => React.useContext(rowIdContext) ?? tableRowIdContextDefaultValue;\n\nexport const TableRowIdContextProvider = rowIdContext.Provider;\n"],"names":["React","rowIdContext","createContext","undefined","tableRowIdContextDefaultValue","useTableRowIdContext","useContext","TableRowIdContextProvider","Provider"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,MAAMC,eAAeD,MAAME,aAAa,CAAyBC;AAEjE,OAAO,MAAMC,gCAAgC,GAAG;IAENJ;AAA1C,OAAO,MAAMK,uBAAuB,IAAML,CAAAA,oBAAAA,MAAMM,UAAU,CAACL,2BAAjBD,+BAAAA,oBAAkCI,8BAA8B;AAE1G,OAAO,MAAMG,4BAA4BN,aAAaO,QAAQ,CAAC"}
1
+ {"version":3,"sources":["rowIdContext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TableRowId } from '../hooks/';\n\nconst rowIdContext = React.createContext<TableRowId | undefined>(undefined);\n\nexport const tableRowIdContextDefaultValue = '';\n\nexport const useTableRowIdContext = () => React.useContext(rowIdContext) ?? tableRowIdContextDefaultValue;\n\nexport const TableRowIdContextProvider = rowIdContext.Provider;\n"],"names":["React","rowIdContext","createContext","undefined","tableRowIdContextDefaultValue","useTableRowIdContext","useContext","TableRowIdContextProvider","Provider"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,MAAMC,eAAeD,MAAME,aAAa,CAAyBC;AAEjE,OAAO,MAAMC,gCAAgC,GAAG;AAEhD,OAAO,MAAMC,uBAAuB;QAAML;WAAAA,CAAAA,oBAAAA,MAAMM,UAAU,CAACL,2BAAjBD,+BAAAA,oBAAkCI;AAA4B,EAAE;AAE1G,OAAO,MAAMG,4BAA4BN,aAAaO,QAAQ,CAAC"}