@fluentui/react-table 9.8.6 → 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 +273 -1
  2. package/CHANGELOG.md +76 -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
@@ -30,7 +30,6 @@ export function useTableSortState(tableState, options) {
30
30
  const { sortColumn, sortDirection } = sorted;
31
31
  const toggleColumnSort = (e, columnId)=>{
32
32
  setSorted((s)=>{
33
- var _onSortChange;
34
33
  const newState = {
35
34
  ...s,
36
35
  sortColumn: columnId
@@ -40,24 +39,22 @@ export function useTableSortState(tableState, options) {
40
39
  } else {
41
40
  newState.sortDirection = 'ascending';
42
41
  }
43
- (_onSortChange = onSortChange) === null || _onSortChange === void 0 ? void 0 : _onSortChange(e, newState);
42
+ onSortChange === null || onSortChange === void 0 ? void 0 : onSortChange(e, newState);
44
43
  return newState;
45
44
  });
46
45
  };
47
46
  const setColumnSort = (e, nextSortColumn, nextSortDirection)=>{
48
- var _onSortChange;
49
47
  const newState = {
50
48
  sortColumn: nextSortColumn,
51
49
  sortDirection: nextSortDirection
52
50
  };
53
- (_onSortChange = onSortChange) === null || _onSortChange === void 0 ? void 0 : _onSortChange(e, newState);
51
+ onSortChange === null || onSortChange === void 0 ? void 0 : onSortChange(e, newState);
54
52
  setSorted(newState);
55
53
  };
56
54
  const sort = (rows)=>{
57
55
  return rows.slice().sort((a, b)=>{
58
- var _sortColumnDef;
59
56
  const sortColumnDef = columns.find((column)=>column.columnId === sortColumn);
60
- if (!((_sortColumnDef = sortColumnDef) === null || _sortColumnDef === void 0 ? void 0 : _sortColumnDef.compare)) {
57
+ if (!(sortColumnDef === null || sortColumnDef === void 0 ? void 0 : sortColumnDef.compare)) {
61
58
  return 0;
62
59
  }
63
60
  const mod = sortDirection === 'ascending' ? 1 : -1;
@@ -1 +1 @@
1
- {"version":3,"sources":["useTableSort.ts"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState } from '@fluentui/react-utilities';\nimport type {\n TableColumnId,\n TableRowData,\n SortState,\n TableSortState,\n TableFeaturesState,\n UseTableSortOptions,\n} from './types';\n\nconst noop = () => undefined;\n\nexport const defaultTableSortState: TableSortState<unknown> = {\n getSortDirection: () => 'ascending',\n setColumnSort: noop,\n sort: <TRowState extends TableRowData<unknown>>(rows: TRowState[]) => [...rows],\n sortColumn: undefined,\n sortDirection: 'ascending',\n toggleColumnSort: noop,\n};\n\nexport function useTableSort<TItem>(options: UseTableSortOptions) {\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: TableFeaturesState<TItem>) => useTableSortState(tableState, options);\n}\n\nexport function useTableSortState<TItem>(\n tableState: TableFeaturesState<TItem>,\n options: UseTableSortOptions,\n): TableFeaturesState<TItem> {\n const { columns } = tableState;\n const { sortState, defaultSortState, onSortChange } = options;\n\n const [sorted, setSorted] = useControllableState<SortState>({\n initialState: {\n sortDirection: 'ascending' as const,\n sortColumn: undefined,\n },\n defaultState: defaultSortState,\n state: sortState,\n });\n\n const { sortColumn, sortDirection } = sorted;\n\n const toggleColumnSort = (e: React.SyntheticEvent, columnId: TableColumnId | undefined) => {\n setSorted(s => {\n const newState = { ...s, sortColumn: columnId };\n if (s.sortColumn === columnId) {\n newState.sortDirection = s.sortDirection === 'ascending' ? 'descending' : 'ascending';\n } else {\n newState.sortDirection = 'ascending';\n }\n\n onSortChange?.(e, newState);\n return newState;\n });\n };\n\n const setColumnSort: TableSortState<TItem>['setColumnSort'] = (e, nextSortColumn, nextSortDirection) => {\n const newState = { sortColumn: nextSortColumn, sortDirection: nextSortDirection };\n onSortChange?.(e, newState);\n setSorted(newState);\n };\n\n const sort = <TRowState extends TableRowData<TItem>>(rows: TRowState[]) => {\n return rows.slice().sort((a, b) => {\n const sortColumnDef = columns.find(column => column.columnId === sortColumn);\n if (!sortColumnDef?.compare) {\n return 0;\n }\n\n const mod = sortDirection === 'ascending' ? 1 : -1;\n return sortColumnDef.compare(a.item, b.item) * mod;\n });\n };\n\n const getSortDirection: TableSortState<TItem>['getSortDirection'] = (columnId: TableColumnId) => {\n return sortColumn === columnId ? sortDirection : undefined;\n };\n\n return {\n ...tableState,\n sort: {\n sort,\n sortColumn,\n sortDirection,\n setColumnSort,\n toggleColumnSort,\n getSortDirection,\n },\n };\n}\n"],"names":["React","useControllableState","noop","undefined","defaultTableSortState","getSortDirection","setColumnSort","sort","rows","sortColumn","sortDirection","toggleColumnSort","useTableSort","options","tableState","useTableSortState","columns","sortState","defaultSortState","onSortChange","sorted","setSorted","initialState","defaultState","state","e","columnId","s","newState","nextSortColumn","nextSortDirection","slice","a","b","sortColumnDef","find","column","compare","mod","item"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,oBAAoB,QAAQ,4BAA4B;AAUjE,MAAMC,OAAO,IAAMC;AAEnB,OAAO,MAAMC,wBAAiD;IAC5DC,kBAAkB,IAAM;IACxBC,eAAeJ;IACfK,MAAM,CAA0CC,OAAsB;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B;YACjE,IAAI,GAACyB,iBAAAA,2BAAAA,qCAAAA,eAAeG,OAAO,GAAE;gBAC3B,OAAO;YACT;YAEA,MAAMC,MAAM5B,kBAAkB,cAAc,IAAI,CAAC;YACjD,OAAOwB,cAAcG,OAAO,CAACL,EAAEO,IAAI,EAAEN,EAAEM,IAAI,IAAID;QACjD;IACF;IAEA,MAAMjC,mBAA8D,CAACqB;QACnE,OAAOjB,eAAeiB,WAAWhB,gBAAgBP;IACnD;IAEA,OAAO;QACL,GAAGW,UAAU;QACbP,MAAM;YACJA;YACAE;YACAC;YACAJ;YACAK;YACAN;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["useTableSort.ts"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState } from '@fluentui/react-utilities';\nimport type {\n TableColumnId,\n TableRowData,\n SortState,\n TableSortState,\n TableFeaturesState,\n UseTableSortOptions,\n} from './types';\n\nconst noop = () => undefined;\n\nexport const defaultTableSortState: TableSortState<unknown> = {\n getSortDirection: () => 'ascending',\n setColumnSort: noop,\n sort: <TRowState extends TableRowData<unknown>>(rows: TRowState[]) => [...rows],\n sortColumn: undefined,\n sortDirection: 'ascending',\n toggleColumnSort: noop,\n};\n\nexport function useTableSort<TItem>(options: UseTableSortOptions) {\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: TableFeaturesState<TItem>) => useTableSortState(tableState, options);\n}\n\nexport function useTableSortState<TItem>(\n tableState: TableFeaturesState<TItem>,\n options: UseTableSortOptions,\n): TableFeaturesState<TItem> {\n const { columns } = tableState;\n const { sortState, defaultSortState, onSortChange } = options;\n\n const [sorted, setSorted] = useControllableState<SortState>({\n initialState: {\n sortDirection: 'ascending' as const,\n sortColumn: undefined,\n },\n defaultState: defaultSortState,\n state: sortState,\n });\n\n const { sortColumn, sortDirection } = sorted;\n\n const toggleColumnSort = (e: React.SyntheticEvent, columnId: TableColumnId | undefined) => {\n setSorted(s => {\n const newState = { ...s, sortColumn: columnId };\n if (s.sortColumn === columnId) {\n newState.sortDirection = s.sortDirection === 'ascending' ? 'descending' : 'ascending';\n } else {\n newState.sortDirection = 'ascending';\n }\n\n onSortChange?.(e, newState);\n return newState;\n });\n };\n\n const setColumnSort: TableSortState<TItem>['setColumnSort'] = (e, nextSortColumn, nextSortDirection) => {\n const newState = { sortColumn: nextSortColumn, sortDirection: nextSortDirection };\n onSortChange?.(e, newState);\n setSorted(newState);\n };\n\n const sort = <TRowState extends TableRowData<TItem>>(rows: TRowState[]) => {\n return rows.slice().sort((a, b) => {\n const sortColumnDef = columns.find(column => column.columnId === sortColumn);\n if (!sortColumnDef?.compare) {\n return 0;\n }\n\n const mod = sortDirection === 'ascending' ? 1 : -1;\n return sortColumnDef.compare(a.item, b.item) * mod;\n });\n };\n\n const getSortDirection: TableSortState<TItem>['getSortDirection'] = (columnId: TableColumnId) => {\n return sortColumn === columnId ? sortDirection : undefined;\n };\n\n return {\n ...tableState,\n sort: {\n sort,\n sortColumn,\n sortDirection,\n setColumnSort,\n toggleColumnSort,\n getSortDirection,\n },\n };\n}\n"],"names":["React","useControllableState","noop","undefined","defaultTableSortState","getSortDirection","setColumnSort","sort","rows","sortColumn","sortDirection","toggleColumnSort","useTableSort","options","tableState","useTableSortState","columns","sortState","defaultSortState","onSortChange","sorted","setSorted","initialState","defaultState","state","e","columnId","s","newState","nextSortColumn","nextSortDirection","slice","a","b","sortColumnDef","find","column","compare","mod","item"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,oBAAoB,QAAQ,4BAA4B;AAUjE,MAAMC,OAAO,IAAMC;AAEnB,OAAO,MAAMC,wBAAiD;IAC5DC,kBAAkB,IAAM;IACxBC,eAAeJ;IACfK,MAAM,CAA0CC,OAAsB;eAAIA;SAAK;IAC/EC,YAAYN;IACZO,eAAe;IACfC,kBAAkBT;AACpB,EAAE;AAEF,OAAO,SAASU,aAAoBC,OAA4B;IAC9D,4EAA4E;IAC5E,sDAAsD;IACtD,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AAEM,IAAI,IAAID;QACjD;IACF;IAEA,MAAMjC,mBAA8D,CAACqB;QACnE,OAAOjB,eAAeiB,WAAWhB,gBAAgBP;IACnD;IAEA,OAAO;QACL,GAAGW,UAAU;QACbP,MAAM;YACJA;YACAE;YACAC;YACAJ;YACAK;YACAN;QACF;IACF;AACF"}
@@ -69,10 +69,9 @@ export function getLength(state) {
69
69
  return state.length;
70
70
  }
71
71
  export function getColumnWidth(state, columnId) {
72
- var _column;
73
72
  const column = getColumnById(state, columnId);
74
73
  var _column_width;
75
- return (_column_width = (_column = column) === null || _column === void 0 ? void 0 : _column.width) !== null && _column_width !== void 0 ? _column_width : 0;
74
+ return (_column_width = column === null || column === void 0 ? void 0 : column.width) !== null && _column_width !== void 0 ? _column_width : 0;
76
75
  }
77
76
  /**
78
77
  * This function takes the current state and returns an updated state, so that it can be set.
@@ -86,9 +85,8 @@ export function getColumnWidth(state, columnId) {
86
85
  * @param value
87
86
  * @returns
88
87
  */ export function setColumnProperty(localState, columnId, property, value) {
89
- var _currentColumn;
90
88
  const currentColumn = getColumnById(localState, columnId);
91
- if (!currentColumn || ((_currentColumn = currentColumn) === null || _currentColumn === void 0 ? void 0 : _currentColumn[property]) === value) {
89
+ if (!currentColumn || (currentColumn === null || currentColumn === void 0 ? void 0 : currentColumn[property]) === value) {
92
90
  return localState;
93
91
  }
94
92
  const updatedColumn = {
@@ -1 +1 @@
1
- {"version":3,"sources":["columnResizeUtils.ts"],"sourcesContent":["import { TableColumnDefinition, ColumnWidthState, TableColumnId, TableColumnSizingOptions } from '../hooks';\n\nconst DEFAULT_WIDTH = 150;\nconst DEFAULT_MIN_WIDTH = 100;\n\n/**\n * This function takes the column definitions and the curent ColumnWidthState and returns new state.\n * - It uses existing state for existing columns.\n * - It removes any state for columns no longer present.\n * - It checks if any column has been replaced and returns updated state if so\n * - It returns old state if no changes in the state have been made (so that react doesn't call effects)\n * @param columns\n * @param state\n * @returns\n */\n\nexport function columnDefinitionsToState<T>(\n columns: TableColumnDefinition<T>[],\n state: ColumnWidthState[] = [],\n columnSizingOptions: TableColumnSizingOptions = {},\n): ColumnWidthState[] {\n let updated = false;\n const stateMap = new Map(state.map(s => [s.columnId, s]));\n\n const updatedState = columns.map(column => {\n const existingColumnState = stateMap.get(column.columnId);\n\n if (existingColumnState) {\n const {\n idealWidth = existingColumnState.idealWidth,\n minWidth = existingColumnState.minWidth,\n padding = existingColumnState.padding,\n } = columnSizingOptions[column.columnId] ?? {};\n\n if (\n idealWidth !== existingColumnState.idealWidth ||\n minWidth !== existingColumnState.minWidth ||\n padding !== existingColumnState.padding\n ) {\n updated = true;\n return {\n ...existingColumnState,\n idealWidth,\n width: idealWidth,\n minWidth,\n padding,\n };\n }\n return existingColumnState;\n }\n\n const {\n defaultWidth,\n idealWidth = DEFAULT_WIDTH,\n minWidth = DEFAULT_MIN_WIDTH,\n padding,\n } = columnSizingOptions[column.columnId] ?? {};\n\n updated = true;\n return {\n columnId: column.columnId,\n width: Math.max(defaultWidth ?? idealWidth, minWidth),\n minWidth,\n idealWidth: Math.max(defaultWidth ?? idealWidth, minWidth),\n padding: padding ?? 16,\n };\n });\n\n // If the length of the new state changed (column was added or removed) or any of\n // the individual states has a new reference (column was replaced),\n // we have to reset the column widths to their ideal width (because the column which was last may not be last now).\n // Then the adjustColumnWidthsToFitContainer can do its job and properly stretch the last column.\n if (updatedState.length !== state.length || updated) {\n const column = updatedState.find(col => col.width > col.idealWidth);\n if (column) {\n column.width = column.idealWidth;\n }\n\n updated = true;\n }\n\n return updated ? updatedState : state;\n}\n\nexport function getColumnById(state: ColumnWidthState[], columnId: TableColumnId) {\n return state.find(c => c.columnId === columnId);\n}\n\nexport function getColumnByIndex(state: ColumnWidthState[], index: number) {\n return state[index];\n}\n\nexport function getTotalWidth(state: ColumnWidthState[]): number {\n return state.reduce((sum, column) => sum + column.width + column.padding, 0);\n}\n\nexport function getLength(state: ColumnWidthState[]) {\n return state.length;\n}\n\nexport function getColumnWidth(state: ColumnWidthState[], columnId: TableColumnId): number {\n const column = getColumnById(state, columnId);\n return column?.width ?? 0;\n}\n\n/**\n * This function takes the current state and returns an updated state, so that it can be set.\n * The reason for this is that we can update the state multiple times before commiting to render.\n * This is an optimization and also prevents flickering.\n * It also returns new copy of the state only if the value is different than the one currently in\n * the state, further preventing unnecessary updates.\n * @param localState\n * @param columnId\n * @param property\n * @param value\n * @returns\n */\nexport function setColumnProperty(\n localState: ColumnWidthState[],\n columnId: TableColumnId,\n property: keyof ColumnWidthState,\n value: number,\n) {\n const currentColumn = getColumnById(localState, columnId);\n\n if (!currentColumn || currentColumn?.[property] === value) {\n return localState;\n }\n\n const updatedColumn = { ...currentColumn, [property]: value };\n\n const newState = localState.reduce((acc, current) => {\n if (current.columnId === updatedColumn.columnId) {\n return [...acc, updatedColumn];\n }\n return [...acc, current];\n }, [] as ColumnWidthState[]);\n\n return newState;\n}\n\n/**\n * This function takes the state and container width and makes sure the each column in the state\n * is its optimal width, and that the columns\n * a) fit to the container\n * b) always fill the whole container\n * @param state\n * @param containerWidth\n * @returns\n */\nexport function adjustColumnWidthsToFitContainer(state: ColumnWidthState[], containerWidth: number) {\n let newState = state;\n const totalWidth = getTotalWidth(newState);\n\n // The total width is smaller, we are expanding columns\n if (totalWidth < containerWidth) {\n let difference = containerWidth - totalWidth;\n let i = 0;\n // We start at the beginning and assign the columns their ideal width\n while (i < newState.length && difference > 0) {\n const currentCol = getColumnByIndex(newState, i);\n const colAdjustment = Math.min(currentCol.idealWidth - currentCol.width, difference);\n newState = setColumnProperty(newState, currentCol.columnId, 'width', currentCol.width + colAdjustment);\n difference -= colAdjustment;\n\n // if there is still empty space, after all columns are their ideal sizes, assign it to the last column\n if (i === newState.length - 1 && difference !== 0) {\n const lastCol = getColumnByIndex(newState, i);\n newState = setColumnProperty(newState, lastCol.columnId, 'width', lastCol.width + difference);\n }\n\n i++;\n }\n }\n\n // The total width is larger than container, we need to squash the columns\n else if (totalWidth >= containerWidth) {\n let difference = totalWidth - containerWidth;\n // We start with the last column\n let j = newState.length - 1;\n while (j >= 0 && difference > 0) {\n const currentCol = getColumnByIndex(newState, j);\n if (currentCol.width > currentCol.minWidth) {\n const colAdjustment = Math.min(currentCol.width - currentCol.minWidth, difference);\n difference -= colAdjustment;\n newState = setColumnProperty(newState, currentCol.columnId, 'width', currentCol.width - colAdjustment);\n }\n j--;\n }\n }\n\n return newState;\n}\n"],"names":["DEFAULT_WIDTH","DEFAULT_MIN_WIDTH","columnDefinitionsToState","columns","state","columnSizingOptions","updated","stateMap","Map","map","s","columnId","updatedState","column","existingColumnState","get","idealWidth","minWidth","padding","width","defaultWidth","Math","max","length","find","col","getColumnById","c","getColumnByIndex","index","getTotalWidth","reduce","sum","getLength","getColumnWidth","setColumnProperty","localState","property","value","currentColumn","updatedColumn","newState","acc","current","adjustColumnWidthsToFitContainer","containerWidth","totalWidth","difference","i","currentCol","colAdjustment","min","lastCol","j"],"mappings":"AAEA,MAAMA,gBAAgB;AACtB,MAAMC,oBAAoB;AAE1B;;;;;;;;;CASC,GAED,OAAO,SAASC,yBACdC,OAAmC,EACnCC,QAA4B,EAAE,EAC9BC,sBAAgD,CAAC,CAAC;IAElD,IAAIC,UAAU;IACd,MAAMC,WAAW,IAAIC,IAAIJ,MAAMK,GAAG,CAACC,CAAAA,IAAK;YAACA,EAAEC,QAAQ;YAAED;SAAE;IAEvD,MAAME,eAAeT,QAAQM,GAAG,CAACI,CAAAA;QAC/B,MAAMC,sBAAsBP,SAASQ,GAAG,CAACF,OAAOF,QAAQ;QAExD,IAAIG,qBAAqB;gBAKnBT;YAJJ,MAAM,EACJW,aAAaF,oBAAoBE,UAAU,EAC3CC,WAAWH,oBAAoBG,QAAQ,EACvCC,UAAUJ,oBAAoBI,OAAO,EACtC,GAAGb,CAAAA,uCAAAA,mBAAmB,CAACQ,OAAOF,QAAQ,CAAC,cAApCN,kDAAAA,uCAAwC,CAAC;YAE7C,IACEW,eAAeF,oBAAoBE,UAAU,IAC7CC,aAAaH,oBAAoBG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F,WAAWjC,UAAU,GAAGiC,WAAW9B,KAAK,EAAE4B;YACzEN,WAAWN,kBAAkBM,UAAUQ,WAAWtC,QAAQ,EAAE,SAASsC,WAAW9B,KAAK,GAAG+B;YACxFH,cAAcG;YAEd,uGAAuG;YACvG,IAAIF,MAAMP,SAASlB,MAAM,GAAG,KAAKwB,eAAe,GAAG;gBACjD,MAAMK,UAAUxB,iBAAiBa,UAAUO;gBAC3CP,WAAWN,kBAAkBM,UAAUW,QAAQzC,QAAQ,EAAE,SAASyC,QAAQjC,KAAK,GAAG4B;YACpF;YAEAC;QACF;IACF,OAGK,IAAIF,cAAcD,gBAAgB;QACrC,IAAIE,aAAaD,aAAaD;QAC9B,gCAAgC;QAChC,IAAIQ,IAAIZ,SAASlB,MAAM,GAAG;QAC1B,MAAO8B,KAAK,KAAKN,aAAa,EAAG;YAC/B,MAAME,aAAarB,iBAAiBa,UAAUY;YAC9C,IAAIJ,WAAW9B,KAAK,GAAG8B,WAAWhC,QAAQ,EAAE;gBAC1C,MAAMiC,gBAAgB7B,KAAK8B,GAAG,CAACF,WAAW9B,KAAK,GAAG8B,WAAWhC,QAAQ,EAAE8B;gBACvEA,cAAcG;gBACdT,WAAWN,kBAAkBM,UAAUQ,WAAWtC,QAAQ,EAAE,SAASsC,WAAW9B,KAAK,GAAG+B;YAC1F;YACAG;QACF;IACF;IAEA,OAAOZ;AACT"}
1
+ {"version":3,"sources":["columnResizeUtils.ts"],"sourcesContent":["import { TableColumnDefinition, ColumnWidthState, TableColumnId, TableColumnSizingOptions } from '../hooks';\n\nconst DEFAULT_WIDTH = 150;\nconst DEFAULT_MIN_WIDTH = 100;\n\n/**\n * This function takes the column definitions and the curent ColumnWidthState and returns new state.\n * - It uses existing state for existing columns.\n * - It removes any state for columns no longer present.\n * - It checks if any column has been replaced and returns updated state if so\n * - It returns old state if no changes in the state have been made (so that react doesn't call effects)\n * @param columns\n * @param state\n * @returns\n */\n\nexport function columnDefinitionsToState<T>(\n columns: TableColumnDefinition<T>[],\n state: ColumnWidthState[] = [],\n columnSizingOptions: TableColumnSizingOptions = {},\n): ColumnWidthState[] {\n let updated = false;\n const stateMap = new Map(state.map(s => [s.columnId, s]));\n\n const updatedState = columns.map(column => {\n const existingColumnState = stateMap.get(column.columnId);\n\n if (existingColumnState) {\n const {\n idealWidth = existingColumnState.idealWidth,\n minWidth = existingColumnState.minWidth,\n padding = existingColumnState.padding,\n } = columnSizingOptions[column.columnId] ?? {};\n\n if (\n idealWidth !== existingColumnState.idealWidth ||\n minWidth !== existingColumnState.minWidth ||\n padding !== existingColumnState.padding\n ) {\n updated = true;\n return {\n ...existingColumnState,\n idealWidth,\n width: idealWidth,\n minWidth,\n padding,\n };\n }\n return existingColumnState;\n }\n\n const {\n defaultWidth,\n idealWidth = DEFAULT_WIDTH,\n minWidth = DEFAULT_MIN_WIDTH,\n padding,\n } = columnSizingOptions[column.columnId] ?? {};\n\n updated = true;\n return {\n columnId: column.columnId,\n width: Math.max(defaultWidth ?? idealWidth, minWidth),\n minWidth,\n idealWidth: Math.max(defaultWidth ?? idealWidth, minWidth),\n padding: padding ?? 16,\n };\n });\n\n // If the length of the new state changed (column was added or removed) or any of\n // the individual states has a new reference (column was replaced),\n // we have to reset the column widths to their ideal width (because the column which was last may not be last now).\n // Then the adjustColumnWidthsToFitContainer can do its job and properly stretch the last column.\n if (updatedState.length !== state.length || updated) {\n const column = updatedState.find(col => col.width > col.idealWidth);\n if (column) {\n column.width = column.idealWidth;\n }\n\n updated = true;\n }\n\n return updated ? updatedState : state;\n}\n\nexport function getColumnById(state: ColumnWidthState[], columnId: TableColumnId) {\n return state.find(c => c.columnId === columnId);\n}\n\nexport function getColumnByIndex(state: ColumnWidthState[], index: number) {\n return state[index];\n}\n\nexport function getTotalWidth(state: ColumnWidthState[]): number {\n return state.reduce((sum, column) => sum + column.width + column.padding, 0);\n}\n\nexport function getLength(state: ColumnWidthState[]) {\n return state.length;\n}\n\nexport function getColumnWidth(state: ColumnWidthState[], columnId: TableColumnId): number {\n const column = getColumnById(state, columnId);\n return column?.width ?? 0;\n}\n\n/**\n * This function takes the current state and returns an updated state, so that it can be set.\n * The reason for this is that we can update the state multiple times before commiting to render.\n * This is an optimization and also prevents flickering.\n * It also returns new copy of the state only if the value is different than the one currently in\n * the state, further preventing unnecessary updates.\n * @param localState\n * @param columnId\n * @param property\n * @param value\n * @returns\n */\nexport function setColumnProperty(\n localState: ColumnWidthState[],\n columnId: TableColumnId,\n property: keyof ColumnWidthState,\n value: number,\n) {\n const currentColumn = getColumnById(localState, columnId);\n\n if (!currentColumn || currentColumn?.[property] === value) {\n return localState;\n }\n\n const updatedColumn = { ...currentColumn, [property]: value };\n\n const newState = localState.reduce((acc, current) => {\n if (current.columnId === updatedColumn.columnId) {\n return [...acc, updatedColumn];\n }\n return [...acc, current];\n }, [] as ColumnWidthState[]);\n\n return newState;\n}\n\n/**\n * This function takes the state and container width and makes sure the each column in the state\n * is its optimal width, and that the columns\n * a) fit to the container\n * b) always fill the whole container\n * @param state\n * @param containerWidth\n * @returns\n */\nexport function adjustColumnWidthsToFitContainer(state: ColumnWidthState[], containerWidth: number) {\n let newState = state;\n const totalWidth = getTotalWidth(newState);\n\n // The total width is smaller, we are expanding columns\n if (totalWidth < containerWidth) {\n let difference = containerWidth - totalWidth;\n let i = 0;\n // We start at the beginning and assign the columns their ideal width\n while (i < newState.length && difference > 0) {\n const currentCol = getColumnByIndex(newState, i);\n const colAdjustment = Math.min(currentCol.idealWidth - currentCol.width, difference);\n newState = setColumnProperty(newState, currentCol.columnId, 'width', currentCol.width + colAdjustment);\n difference -= colAdjustment;\n\n // if there is still empty space, after all columns are their ideal sizes, assign it to the last column\n if (i === newState.length - 1 && difference !== 0) {\n const lastCol = getColumnByIndex(newState, i);\n newState = setColumnProperty(newState, lastCol.columnId, 'width', lastCol.width + difference);\n }\n\n i++;\n }\n }\n\n // The total width is larger than container, we need to squash the columns\n else if (totalWidth >= containerWidth) {\n let difference = totalWidth - containerWidth;\n // We start with the last column\n let j = newState.length - 1;\n while (j >= 0 && difference > 0) {\n const currentCol = getColumnByIndex(newState, j);\n if (currentCol.width > currentCol.minWidth) {\n const colAdjustment = Math.min(currentCol.width - currentCol.minWidth, difference);\n difference -= colAdjustment;\n newState = setColumnProperty(newState, currentCol.columnId, 'width', currentCol.width - colAdjustment);\n }\n j--;\n }\n }\n\n return newState;\n}\n"],"names":["DEFAULT_WIDTH","DEFAULT_MIN_WIDTH","columnDefinitionsToState","columns","state","columnSizingOptions","updated","stateMap","Map","map","s","columnId","updatedState","column","existingColumnState","get","idealWidth","minWidth","padding","width","defaultWidth","Math","max","length","find","col","getColumnById","c","getColumnByIndex","index","getTotalWidth","reduce","sum","getLength","getColumnWidth","setColumnProperty","localState","property","value","currentColumn","updatedColumn","newState","acc","current","adjustColumnWidthsToFitContainer","containerWidth","totalWidth","difference","i","currentCol","colAdjustment","min","lastCol","j"],"mappings":"AAEA,MAAMA,gBAAgB;AACtB,MAAMC,oBAAoB;AAE1B;;;;;;;;;CASC,GAED,OAAO,SAASC,yBACdC,OAAmC,EACnCC,QAA4B,EAAE,EAC9BC,sBAAgD,CAAC,CAAC;IAElD,IAAIC,UAAU;IACd,MAAMC,WAAW,IAAIC,IAAIJ,MAAMK,GAAG,CAACC,CAAAA,IAAK;YAACA,EAAEC,QAAQ;YAAED;SAAE;IAEvD,MAAME,eAAeT,QAAQM,GAAG,CAACI,CAAAA;QAC/B,MAAMC,sBAAsBP,SAASQ,GAAG,CAACF,OAAOF,QAAQ;QAExD,IAAIG,qBAAqB;gBAKnBT;YAJJ,MAAM,EACJW,aAAaF,oBAAoBE,UAAU,EAC3CC,WAAWH,oBAAoBG,QAAQ,EACvCC,UAAUJ,oBAAoBI,OAAO,EACtC,GAAGb,CAAAA,uCAAAA,mBAAmB,CAACQ,OAAOF,QAAQ,CAAC,cAApCN,kDAAAA,uCAAwC,CAAC;YAE7C,IACEW,eAAeF,oBAAoBE,UAAU,IAC7CC,aAAaH,oBAAoBG,QAAQ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AAK,EAAE4B;YACzEN,WAAWN,kBAAkBM,UAAUQ,WAAWtC,QAAQ,EAAE,SAASsC,WAAW9B,KAAK,GAAG+B;YACxFH,cAAcG;YAEd,uGAAuG;YACvG,IAAIF,MAAMP,SAASlB,MAAM,GAAG,KAAKwB,eAAe,GAAG;gBACjD,MAAMK,UAAUxB,iBAAiBa,UAAUO;gBAC3CP,WAAWN,kBAAkBM,UAAUW,QAAQzC,QAAQ,EAAE,SAASyC,QAAQjC,KAAK,GAAG4B;YACpF;YAEAC;QACF;IACF,OAGK,IAAIF,cAAcD,gBAAgB;QACrC,IAAIE,aAAaD,aAAaD;QAC9B,gCAAgC;QAChC,IAAIQ,IAAIZ,SAASlB,MAAM,GAAG;QAC1B,MAAO8B,KAAK,KAAKN,aAAa,EAAG;YAC/B,MAAME,aAAarB,iBAAiBa,UAAUY;YAC9C,IAAIJ,WAAW9B,KAAK,GAAG8B,WAAWhC,QAAQ,EAAE;gBAC1C,MAAMiC,gBAAgB7B,KAAK8B,GAAG,CAACF,WAAW9B,KAAK,GAAG8B,WAAWhC,QAAQ,EAAE8B;gBACvEA,cAAcG;gBACdT,WAAWN,kBAAkBM,UAAUQ,WAAWtC,QAAQ,EAAE,SAASsC,WAAW9B,KAAK,GAAG+B;YAC1F;YACAG;QACF;IACF;IAEA,OAAOZ;AACT"}
@@ -0,0 +1,3 @@
1
+ export function isColumnSortable(column) {
2
+ return column.compare.length > 0;
3
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["isColumnSortable.ts"],"sourcesContent":["import { TableColumnDefinition } from '../hooks/types';\n\nexport function isColumnSortable(column: TableColumnDefinition<unknown>) {\n return column.compare.length > 0;\n}\n"],"names":["isColumnSortable","column","compare","length"],"mappings":"AAEA,OAAO,SAASA,iBAAiBC,MAAsC;IACrE,OAAOA,OAAOC,OAAO,CAACC,MAAM,GAAG;AACjC"}
@@ -50,8 +50,8 @@ const useDataGrid_unstable = (props, ref)=>{
50
50
  const innerRef = _react.useRef(null);
51
51
  const { findFirstFocusable, findLastFocusable } = (0, _reacttabster.useFocusFinders)();
52
52
  const onKeyDown = (0, _reactutilities.useEventCallback)((e)=>{
53
- var _props_onKeyDown, _props;
54
- (_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, e);
53
+ var _props_onKeyDown;
54
+ (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);
55
55
  focusMode === 'composite' && onCompositeKeyDown(e);
56
56
  // handle ctrl+home and ctrl+end
57
57
  if (!innerRef.current || !e.ctrlKey || e.defaultPrevented) {
@@ -1 +1 @@
1
- {"version":3,"sources":["useDataGrid.js"],"sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useTable_unstable } from '../Table/useTable';\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { End, Home } from '@fluentui/keyboard-keys';\nimport { useTableFeatures, useTableSort, useTableSelection, useTableColumnSizing_unstable, useTableCompositeNavigation } from '../../hooks';\nimport { CELL_WIDTH } from '../TableSelectionCell';\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 */ export const useDataGrid_unstable = (props, ref)=>{\n const { items, columns, focusMode = 'cell', selectionMode, onSortChange, onSelectionChange, defaultSortState, sortState, selectedItems, defaultSelectedItems, subtleSelection = false, selectionAppearance = 'brand', getRowId, resizableColumns, columnSizingOptions, onColumnResize, containerWidthOffset } = props;\n const widthOffset = containerWidthOffset !== null && containerWidthOffset !== void 0 ? containerWidthOffset : selectionMode ? -CELL_WIDTH : 0;\n const gridTabsterAttribute = useArrowNavigationGroup({\n axis: 'grid'\n });\n const { onTableKeyDown: onCompositeKeyDown, tableTabsterAttribute: compositeTabsterAttribute, tableRowTabsterAttribute: compositeRowTabsterAttribute } = useTableCompositeNavigation();\n const tableState = useTableFeatures({\n items,\n columns,\n getRowId\n }, [\n useTableSort({\n defaultSortState,\n sortState,\n onSortChange\n }),\n useTableSelection({\n defaultSelectedItems,\n selectedItems,\n onSelectionChange,\n selectionMode: selectionMode !== null && selectionMode !== void 0 ? 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 const innerRef = React.useRef(null);\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e)=>{\n var _props_onKeyDown, _props;\n (_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, e);\n focusMode === 'composite' && onCompositeKeyDown(e);\n // handle ctrl+home and ctrl+end\n if (!innerRef.current || !e.ctrlKey || e.defaultPrevented) {\n return;\n }\n if (e.key === Home) {\n const firstRow = innerRef.current.querySelector('[role=\"row\"]');\n if (firstRow) {\n var _findFirstFocusable;\n (_findFirstFocusable = findFirstFocusable(firstRow)) === null || _findFirstFocusable === void 0 ? void 0 : _findFirstFocusable.focus();\n }\n }\n if (e.key === End) {\n const rows = innerRef.current.querySelectorAll('[role=\"row\"]');\n if (rows.length) {\n var _findLastFocusable;\n const lastRow = rows.item(rows.length - 1);\n (_findLastFocusable = findLastFocusable(lastRow)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();\n }\n }\n });\n const baseTableState = useTable_unstable({\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 }, useMergedRefs(ref, tableState.tableRef, innerRef));\n return {\n ...baseTableState,\n focusMode,\n tableState,\n selectableRows: !!selectionMode,\n subtleSelection,\n selectionAppearance,\n resizableColumns,\n compositeRowTabsterAttribute\n };\n};\n"],"names":["useDataGrid_unstable","props","ref","items","columns","focusMode","selectionMode","onSortChange","onSelectionChange","defaultSortState","sortState","selectedItems","defaultSelectedItems","subtleSelection","selectionAppearance","getRowId","resizableColumns","columnSizingOptions","onColumnResize","containerWidthOffset","widthOffset","CELL_WIDTH","gridTabsterAttribute","useArrowNavigationGroup","axis","onTableKeyDown","onCompositeKeyDown","tableTabsterAttribute","compositeTabsterAttribute","tableRowTabsterAttribute","compositeRowTabsterAttribute","useTableCompositeNavigation","tableState","useTableFeatures","useTableSort","useTableSelection","useTableColumnSizing_unstable","innerRef","React","useRef","findFirstFocusable","findLastFocusable","useFocusFinders","onKeyDown","useEventCallback","e","_props_onKeyDown","_props","call","current","ctrlKey","defaultPrevented","key","Home","firstRow","querySelector","_findFirstFocusable","focus","End","rows","querySelectorAll","length","_findLastFocusable","lastRow","item","baseTableState","useTable_unstable","role","as","noNativeElements","columnSizing_unstable","getTableProps","useMergedRefs","tableRef","selectableRows"],"mappings":";;;;+BAeiBA;;;eAAAA;;;;iEAfM;8BACkC;0BACvB;gCACc;8BACtB;uBACoG;oCACnG;AAShB,MAAMA,uBAAuB,CAACC,OAAOC;IAC5C,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAEC,YAAY,MAAM,EAAEC,aAAa,EAAEC,YAAY,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAEC,SAAS,EAAEC,aAAa,EAAEC,oBAAoB,EAAEC,kBAAkB,KAAK,EAAEC,sBAAsB,OAAO,EAAEC,QAAQ,EAAEC,gBAAgB,EAAEC,mBAAmB,EAAEC,cAAc,EAAEC,oBAAoB,EAAE,GAAGlB;IAChT,MAAMmB,cAAcD,yBAAyB,QAAQA,yBAAyB,KAAK,IAAIA,uBAAuBb,gBAAgB,CAACe,8BAAU,GAAG;IAC5I,MAAMC,uBAAuBC,IA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AEO,GAAG,KAAKM,iBAAG,EAAE;YACf,MAAMC,OAAOtB,SAASY,OAAO,CAACW,gBAAgB,CAAC;YAC/C,IAAID,KAAKE,MAAM,EAAE;gBACb,IAAIC;gBACJ,MAAMC,UAAUJ,KAAKK,IAAI,CAACL,KAAKE,MAAM,GAAG;gBACvCC,CAAAA,qBAAqBrB,kBAAkBsB,QAAO,MAAO,QAAQD,uBAAuB,KAAK,IAAI,KAAK,IAAIA,mBAAmBL,KAAK;YACnI;QACJ;IACJ;IACA,MAAMQ,iBAAiBC,IAAAA,2BAAiB,EAAC;QACrCC,MAAM;QACNC,IAAI;QACJC,kBAAkB;QAClB,GAAGhE,cAAc,UAAUiB,oBAAoB;QAC/C,GAAGjB,cAAc,eAAeuB,yBAAyB;QACzD,GAAG3B,KAAK;QACR0C;QACA,GAAG3B,mBAAmBgB,WAAWsC,qBAAqB,CAACC,aAAa,CAACtE,SAAS,CAAC,CAAC;IACpF,GAAGuE,IAAAA,6BAAa,EAACtE,KAAK8B,WAAWyC,QAAQ,EAAEpC;IAC3C,OAAO;QACH,GAAG4B,cAAc;QACjB5D;QACA2B;QACA0C,gBAAgB,CAAC,CAACpE;QAClBO;QACAC;QACAE;QACAc;IACJ;AACJ"}
1
+ {"version":3,"sources":["useDataGrid.js"],"sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useTable_unstable } from '../Table/useTable';\nimport { useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { End, Home } from '@fluentui/keyboard-keys';\nimport { useTableFeatures, useTableSort, useTableSelection, useTableColumnSizing_unstable, useTableCompositeNavigation } from '../../hooks';\nimport { CELL_WIDTH } from '../TableSelectionCell';\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 */ export const useDataGrid_unstable = (props, ref)=>{\n const { items, columns, focusMode = 'cell', selectionMode, onSortChange, onSelectionChange, defaultSortState, sortState, selectedItems, defaultSelectedItems, subtleSelection = false, selectionAppearance = 'brand', getRowId, resizableColumns, columnSizingOptions, onColumnResize, containerWidthOffset } = props;\n const widthOffset = containerWidthOffset !== null && containerWidthOffset !== void 0 ? containerWidthOffset : selectionMode ? -CELL_WIDTH : 0;\n const gridTabsterAttribute = useArrowNavigationGroup({\n axis: 'grid'\n });\n const { onTableKeyDown: onCompositeKeyDown, tableTabsterAttribute: compositeTabsterAttribute, tableRowTabsterAttribute: compositeRowTabsterAttribute } = useTableCompositeNavigation();\n const tableState = useTableFeatures({\n items,\n columns,\n getRowId\n }, [\n useTableSort({\n defaultSortState,\n sortState,\n onSortChange\n }),\n useTableSelection({\n defaultSelectedItems,\n selectedItems,\n onSelectionChange,\n selectionMode: selectionMode !== null && selectionMode !== void 0 ? 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 const innerRef = React.useRef(null);\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e)=>{\n var _props_onKeyDown;\n (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);\n focusMode === 'composite' && onCompositeKeyDown(e);\n // handle ctrl+home and ctrl+end\n if (!innerRef.current || !e.ctrlKey || e.defaultPrevented) {\n return;\n }\n if (e.key === Home) {\n const firstRow = innerRef.current.querySelector('[role=\"row\"]');\n if (firstRow) {\n var _findFirstFocusable;\n (_findFirstFocusable = findFirstFocusable(firstRow)) === null || _findFirstFocusable === void 0 ? void 0 : _findFirstFocusable.focus();\n }\n }\n if (e.key === End) {\n const rows = innerRef.current.querySelectorAll('[role=\"row\"]');\n if (rows.length) {\n var _findLastFocusable;\n const lastRow = rows.item(rows.length - 1);\n (_findLastFocusable = findLastFocusable(lastRow)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();\n }\n }\n });\n const baseTableState = useTable_unstable({\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 }, useMergedRefs(ref, tableState.tableRef, innerRef));\n return {\n ...baseTableState,\n focusMode,\n tableState,\n selectableRows: !!selectionMode,\n subtleSelection,\n selectionAppearance,\n resizableColumns,\n compositeRowTabsterAttribute\n };\n};\n"],"names":["useDataGrid_unstable","props","ref","items","columns","focusMode","selectionMode","onSortChange","onSelectionChange","defaultSortState","sortState","selectedItems","defaultSelectedItems","subtleSelection","selectionAppearance","getRowId","resizableColumns","columnSizingOptions","onColumnResize","containerWidthOffset","widthOffset","CELL_WIDTH","gridTabsterAttribute","useArrowNavigationGroup","axis","onTableKeyDown","onCompositeKeyDown","tableTabsterAttribute","compositeTabsterAttribute","tableRowTabsterAttribute","compositeRowTabsterAttribute","useTableCompositeNavigation","tableState","useTableFeatures","useTableSort","useTableSelection","useTableColumnSizing_unstable","innerRef","React","useRef","findFirstFocusable","findLastFocusable","useFocusFinders","onKeyDown","useEventCallback","e","_props_onKeyDown","call","current","ctrlKey","defaultPrevented","key","Home","firstRow","querySelector","_findFirstFocusable","focus","End","rows","querySelectorAll","length","_findLastFocusable","lastRow","item","baseTableState","useTable_unstable","role","as","noNativeElements","columnSizing_unstable","getTableProps","useMergedRefs","tableRef","selectableRows"],"mappings":";;;;+BAeiBA;;;eAAAA;;;;iEAfM;8BACkC;0BACvB;gCACc;8BACtB;uBACoG;oCACnG;AAShB,MAAMA,uBAAuB,CAACC,OAAOC;IAC5C,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAEC,YAAY,MAAM,EAAEC,aAAa,EAAEC,YAA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J,EAAEK,gBAAgB,EAAE;YACvD;QACJ;QACA,IAAIL,EAAEM,GAAG,KAAKC,kBAAI,EAAE;YAChB,MAAMC,WAAWhB,SAASW,OAAO,CAACM,aAAa,CAAC;YAChD,IAAID,UAAU;gBACV,IAAIE;gBACHA,CAAAA,sBAAsBf,mBAAmBa,SAAQ,MAAO,QAAQE,wBAAwB,KAAK,IAAI,KAAK,IAAIA,oBAAoBC,KAAK;YACxI;QACJ;QACA,IAAIX,EAAEM,GAAG,KAAKM,iBAAG,EAAE;YACf,MAAMC,OAAOrB,SAASW,OAAO,CAACW,gBAAgB,CAAC;YAC/C,IAAID,KAAKE,MAAM,EAAE;gBACb,IAAIC;gBACJ,MAAMC,UAAUJ,KAAKK,IAAI,CAACL,KAAKE,MAAM,GAAG;gBACvCC,CAAAA,qBAAqBpB,kBAAkBqB,QAAO,MAAO,QAAQD,uBAAuB,KAAK,IAAI,KAAK,IAAIA,mBAAmBL,KAAK;YACnI;QACJ;IACJ;IACA,MAAMQ,iBAAiBC,IAAAA,2BAAiB,EAAC;QACrCC,MAAM;QACNC,IAAI;QACJC,kBAAkB;QAClB,GAAG/D,cAAc,UAAUiB,oBAAoB;QAC/C,GAAGjB,cAAc,eAAeuB,yBAAyB;QACzD,GAAG3B,KAAK;QACR0C;QACA,GAAG3B,mBAAmBgB,WAAWqC,qBAAqB,CAACC,aAAa,CAACrE,SAAS,CAAC,CAAC;IACpF,GAAGsE,IAAAA,6BAAa,EAACrE,KAAK8B,WAAWwC,QAAQ,EAAEnC;IAC3C,OAAO;QACH,GAAG2B,cAAc;QACjB3D;QACA2B;QACAyC,gBAAgB,CAAC,CAACnE;QAClBO;QACAC;QACAE;QACAc;IACJ;AACJ"}
@@ -15,22 +15,32 @@ const _useTableHeaderCell = require("../TableHeaderCell/useTableHeaderCell");
15
15
  const _dataGridContext = require("../../contexts/dataGridContext");
16
16
  const _columnIdContext = require("../../contexts/columnIdContext");
17
17
  const _tableContext = require("../../contexts/tableContext");
18
+ const _isColumnSortable = require("../../utils/isColumnSortable");
18
19
  const useDataGridHeaderCell_unstable = (props, ref)=>{
19
20
  const columnId = (0, _columnIdContext.useColumnIdContext)();
20
- const { sortable } = (0, _tableContext.useTableContext)();
21
+ const { sortable: gridSortable } = (0, _tableContext.useTableContext)();
21
22
  const toggleColumnSort = (0, _dataGridContext.useDataGridContext_unstable)((ctx)=>ctx.sort.toggleColumnSort);
23
+ const sortable = (0, _dataGridContext.useDataGridContext_unstable)((ctx)=>{
24
+ const columnSortable = !!ctx.columns.find((c)=>c.columnId === columnId && (0, _isColumnSortable.isColumnSortable)(c));
25
+ if (!gridSortable) {
26
+ // if the grid is not sortable - disable sorting on all columns
27
+ return false;
28
+ }
29
+ return columnSortable;
30
+ });
22
31
  const sortDirection = (0, _dataGridContext.useDataGridContext_unstable)((ctx)=>sortable ? ctx.sort.getSortDirection(columnId) : undefined);
23
32
  const resizableColumns = (0, _dataGridContext.useDataGridContext_unstable)((ctx)=>ctx.resizableColumns);
24
33
  const columnSizing = (0, _dataGridContext.useDataGridContext_unstable)((ctx)=>ctx.columnSizing_unstable);
25
34
  // eslint-disable-next-line deprecation/deprecation -- prefer HTMLTableCellElement
26
35
  const onClick = (0, _reactutilities.useEventCallback)((e)=>{
27
- var _props_onClick, _props;
36
+ var _props_onClick;
28
37
  if (sortable) {
29
38
  toggleColumnSort(e, columnId);
30
39
  }
31
- (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, e);
40
+ (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);
32
41
  });
33
42
  return (0, _useTableHeaderCell.useTableHeaderCell_unstable)({
43
+ sortable,
34
44
  sortDirection,
35
45
  as: 'div',
36
46
  tabIndex: sortable ? undefined : 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["useDataGridHeaderCell.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useTableHeaderCell_unstable } from '../TableHeaderCell/useTableHeaderCell';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useColumnIdContext } from '../../contexts/columnIdContext';\nimport { useTableContext } from '../../contexts/tableContext';\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 */ export const useDataGridHeaderCell_unstable = (props, ref)=>{\n const columnId = useColumnIdContext();\n const { sortable } = useTableContext();\n const toggleColumnSort = useDataGridContext_unstable((ctx)=>ctx.sort.toggleColumnSort);\n const sortDirection = useDataGridContext_unstable((ctx)=>sortable ? ctx.sort.getSortDirection(columnId) : undefined);\n const resizableColumns = useDataGridContext_unstable((ctx)=>ctx.resizableColumns);\n const columnSizing = useDataGridContext_unstable((ctx)=>ctx.columnSizing_unstable);\n // eslint-disable-next-line deprecation/deprecation -- prefer HTMLTableCellElement\n const onClick = useEventCallback((e)=>{\n var _props_onClick, _props;\n if (sortable) {\n toggleColumnSort(e, columnId);\n }\n (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, e);\n });\n return useTableHeaderCell_unstable({\n sortDirection,\n as: 'div',\n tabIndex: sortable ? undefined : 0,\n ...resizableColumns ? columnSizing.getTableHeaderCellProps(columnId) : {},\n ...props,\n onClick\n }, ref);\n};\n"],"names":["useDataGridHeaderCell_unstable","props","ref","columnId","useColumnIdContext","sortable","useTableContext","toggleColumnSort","useDataGridContext_unstable","ctx","sort","sortDirection","getSortDirection","undefined","resizableColumns","columnSizing","columnSizing_unstable","onClick","useEventCallback","e","_props_onClick","_props","call","useTableHeaderCell_unstable","as","tabIndex","getTableHeaderCellProps"],"mappings":";;;;+BAciBA;;;eAAAA;;;;iEAdM;gCACU;oCACW;iCACA;iCACT;8BACH;AASrB,MAAMA,iCAAiC,CAACC,OAAOC;IACtD,MAAMC,WAAWC,IAAAA,mCAAkB;IACnC,MAAM,EAAEC,QAAQ,EAAE,GAAGC,IAAAA,6BAAe;IACpC,MAAMC,mBAAmBC,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIC,IAAI,CAACH,gBAAgB;IACrF,MAAMI,gBAAgBH,IAAAA,4CAA2B,EAAC,CAACC,MAAMJ,WAAWI,IAAIC,IAAI,CAACE,gBAAgB,CAACT,YAAYU;IAC1G,MAAMC,mBAAmBN,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIK,gBAAgB;IAChF,MAAMC,eAAeP,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIO,qBAAqB;IACjF,kFAAkF;IAClF,MAAMC,UAAUC,IAAAA,gCAAgB,EAAC,CAACC;QAC9B,IAAIC,gBAAgBC;QACpB,IAAIhB,UAAU;YACVE,iBAAiBY,GAAGhB;QACxB;QACCiB,CAAAA,iBAAiB,AAACC,CAAAA,SAASpB,KAAI,EAAGgB,OAAO,AAAD,MAAO,QAAQG,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeE,IAAI,CAACD,QAAQF;IAC7H;IACA,OAAOI,IAAAA,+CAA2B,EAAC;QAC/BZ;QACAa,IAAI;QACJC,UAAUpB,WAAWQ,YAAY;QACjC,GAAGC,mBAAmBC,aAAaW,uBAAuB,CAACvB,YAAY,CAAC,CAAC;QACzE,GAAGF,KAAK;QACRgB;IACJ,GAAGf;AACP"}
1
+ {"version":3,"sources":["useDataGridHeaderCell.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\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 * 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 */ export const useDataGridHeaderCell_unstable = (props, ref)=>{\n const columnId = useColumnIdContext();\n const { sortable: gridSortable } = useTableContext();\n const toggleColumnSort = useDataGridContext_unstable((ctx)=>ctx.sort.toggleColumnSort);\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 return columnSortable;\n });\n const sortDirection = useDataGridContext_unstable((ctx)=>sortable ? ctx.sort.getSortDirection(columnId) : undefined);\n const resizableColumns = useDataGridContext_unstable((ctx)=>ctx.resizableColumns);\n const columnSizing = useDataGridContext_unstable((ctx)=>ctx.columnSizing_unstable);\n // eslint-disable-next-line deprecation/deprecation -- prefer HTMLTableCellElement\n const onClick = useEventCallback((e)=>{\n var _props_onClick;\n if (sortable) {\n toggleColumnSort(e, columnId);\n }\n (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);\n });\n return useTableHeaderCell_unstable({\n sortable,\n sortDirection,\n as: 'div',\n tabIndex: sortable ? undefined : 0,\n ...resizableColumns ? columnSizing.getTableHeaderCellProps(columnId) : {},\n ...props,\n onClick\n }, ref);\n};\n"],"names":["useDataGridHeaderCell_unstable","props","ref","columnId","useColumnIdContext","sortable","gridSortable","useTableContext","toggleColumnSort","useDataGridContext_unstable","ctx","sort","columnSortable","columns","find","c","isColumnSortable","sortDirection","getSortDirection","undefined","resizableColumns","columnSizing","columnSizing_unstable","onClick","useEventCallback","e","_props_onClick","call","useTableHeaderCell_unstable","as","tabIndex","getTableHeaderCellProps"],"mappings":";;;;+BAeiBA;;;eAAAA;;;;iEAfM;gCACU;oCACW;iCACA;iCACT;8BACH;kCACC;AAStB,M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= (0, _dataGridContext.useDataGridContext_unstable)((ctx)=>ctx.selection.toggleRow);
36
36
  const dataGridContextValue = (0, _dataGridContext.useDataGridContext_unstable)((ctx)=>ctx);
37
37
  const onClick = (0, _reactutilities.useEventCallback)((e)=>{
38
- var _props_onClick, _props;
38
+ var _props_onClick;
39
39
  if (selectable && !isHeader) {
40
40
  toggleRow(e, rowId);
41
41
  }
42
- (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, e);
42
+ (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);
43
43
  });
44
44
  const onKeyDown = (0, _reactutilities.useEventCallback)((e)=>{
45
- var _props_onKeyDown, _props;
45
+ var _props_onKeyDown;
46
46
  if (selectable && !isHeader && e.key === _keyboardkeys.Space && !(0, _reactutilities.isInteractiveHTMLElement)(e.target)) {
47
47
  // stop scrolling
48
48
  e.preventDefault();
49
49
  toggleRow(e, rowId);
50
50
  }
51
- (_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, e);
51
+ (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);
52
52
  });
53
53
  const baseState = (0, _useTableRow.useTableRow_unstable)({
54
54
  appearance,
@@ -1 +1 @@
1
- {"version":3,"sources":["useDataGridRow.js"],"sourcesContent":["import * as React from 'react';\nimport { isInteractiveHTMLElement, useEventCallback, slot } from '@fluentui/react-utilities';\nimport { Space } from '@fluentui/keyboard-keys';\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 * 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 */ export const useDataGridRow_unstable = (props, ref)=>{\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 return 'none';\n });\n const toggleRow = useDataGridContext_unstable((ctx)=>ctx.selection.toggleRow);\n const dataGridContextValue = useDataGridContext_unstable((ctx)=>ctx);\n const onClick = useEventCallback((e)=>{\n var _props_onClick, _props;\n if (selectable && !isHeader) {\n toggleRow(e, rowId);\n }\n (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, e);\n });\n const onKeyDown = useEventCallback((e)=>{\n var _props_onKeyDown, _props;\n if (selectable && !isHeader && e.key === Space && !isInteractiveHTMLElement(e.target)) {\n // stop scrolling\n e.preventDefault();\n toggleRow(e, rowId);\n }\n (_props_onKeyDown = (_props = props).onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(_props, e);\n });\n const baseState = useTableRow_unstable({\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 }, ref);\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":["useDataGridRow_unstable","props","ref","rowId","useTableRowIdContext","isHeader","useIsInTableHeader","columnDefs","useDataGridContext_unstable","ctx","columns","selectable","selectableRows","selected","selection","isRowSelected","focusMode","compositeRowTabsterAttribute","tabbable","appearance","selectionAppearance","toggleRow","dataGridContextValue","onClick","useEventCallback","e","_props_onClick","_props","call","onKeyDown","_props_onKeyDown","key","Space","isInteractiveHTMLElement","target","preventDefault","baseState","useTableRow_unstable","undefined","tabIndex","children","as","components","selectionCell","DataGridSelectionCell","slot","optional","renderByDefault","elementType","renderCell"],"mappings":";;;;+BAgBiBA;;;eAAAA;;;;iEAhBM;gCAC0C;8BAC3C;6BACe;iCACO;uCACN;8BACD;oCACF;AASxB,MAAMA,0BAA0B,CAACC,OAAOC;IAC/C,MAAMC,QAAQC,IAAAA,kCAAoB;IAClC,MAAMC,WAAWC,IAAAA,sCAAkB;IACnC,MAAMC,aAAaC,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIC,OAAO;IACjE,MAAMC,aAAaH,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIG,cAAc;IACxE,MAAMC,WAAWL,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIK,SAAS,CAACC,aAAa,CAACZ;IAChF,MAAMa,YAAYR,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIO,SAAS;IAClE,MAAMC,+BAA+BT,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIQ,4BAA4B;IACxG,MAAMC,WAAWF,cAAc,kBAAkBA,cAAc;IAC/D,MAAMG,aAAaX,IAAAA,4CAA2B,EAAC,CAACC;QAC5C,IAAI,CAACJ,YAAYM,cAAcF,IAAIK,SAAS,CAACC,aAAa,CAACZ,QAAQ;YAC/D,OAAOM,IAAIW,mBAAm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0C,aAAa,EAAE;YAC9CI,iBAAiBpC;YACjBqC,aAAaJ,4CAAqB;QACtC;QACAK,YAAYhD,MAAMuC,QAAQ;QAC1BjC;QACAe;IACJ;AACJ"}
1
+ {"version":3,"sources":["useDataGridRow.js"],"sourcesContent":["import * as React from 'react';\nimport { isInteractiveHTMLElement, useEventCallback, slot } from '@fluentui/react-utilities';\nimport { Space } from '@fluentui/keyboard-keys';\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 * 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 */ export const useDataGridRow_unstable = (props, ref)=>{\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 return 'none';\n });\n const toggleRow = useDataGridContext_unstable((ctx)=>ctx.selection.toggleRow);\n const dataGridContextValue = useDataGridContext_unstable((ctx)=>ctx);\n const onClick = useEventCallback((e)=>{\n var _props_onClick;\n if (selectable && !isHeader) {\n toggleRow(e, rowId);\n }\n (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);\n });\n const onKeyDown = useEventCallback((e)=>{\n var _props_onKeyDown;\n if (selectable && !isHeader && e.key === Space && !isInteractiveHTMLElement(e.target)) {\n // stop scrolling\n e.preventDefault();\n toggleRow(e, rowId);\n }\n (_props_onKeyDown = props.onKeyDown) === null || _props_onKeyDown === void 0 ? void 0 : _props_onKeyDown.call(props, e);\n });\n const baseState = useTableRow_unstable({\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 }, ref);\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":["useDataGridRow_unstable","props","ref","rowId","useTableRowIdContext","isHeader","useIsInTableHeader","columnDefs","useDataGridContext_unstable","ctx","columns","selectable","selectableRows","selected","selection","isRowSelected","focusMode","compositeRowTabsterAttribute","tabbable","appearance","selectionAppearance","toggleRow","dataGridContextValue","onClick","useEventCallback","e","_props_onClick","call","onKeyDown","_props_onKeyDown","key","Space","isInteractiveHTMLElement","target","preventDefault","baseState","useTableRow_unstable","undefined","tabIndex","children","as","components","selectionCell","DataGridSelectionCell","slot","optional","renderByDefault","elementType","renderCell"],"mappings":";;;;+BAgBiBA;;;eAAAA;;;;iEAhBM;gCAC0C;8BAC3C;6BACe;iCACO;uCACN;8BACD;oCACF;AASxB,MAAMA,0BAA0B,CAACC,OAAOC;IAC/C,MAAMC,QAAQC,IAAAA,kCAAoB;IAClC,MAAMC,WAAWC,IAAAA,sCAAkB;IACnC,MAAMC,aAAaC,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIC,OAAO;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,IAAIA,iBAAiBF,IAAI,CAAC1B,OAAOwB;IACzH;IACA,MAAMU,YAAYC,IAAAA,iCAAoB,EAAC;QACnCjB;QACA,iBAAiBR,aAAaE,WAAWwB;QACzCC,UAAUpB,YAAY,CAACb,WAAW,IAAIgC;QACtC,GAAGrB,cAAc,eAAe,CAACX,YAAYY,4BAA4B;QACzE,GAAGhB,KAAK;QACRsB;QACAK;QACAW,UAAU;QACVC,IAAI;IACR,GAAGtC;IACH,OAAO;QACH,GAAGiC,SAAS;QACZM,YAAY;YACR,GAAGN,UAAUM,UAAU;YACvBC,eAAeC,4CAAqB;QACxC;QACAD,eAAeE,oBAAI,CAACC,QAAQ,CAAC5C,MAAMyC,aAAa,EAAE;YAC9CI,iBAAiBnC;YACjBoC,aAAaJ,4CAAqB;QACtC;QACAK,YAAY/C,MAAMsC,QAAQ;QAC1BhC;QACAe;IACJ;AACJ"}
@@ -28,11 +28,11 @@ const useDataGridSelectionCell_unstable = (props, ref)=>{
28
28
  const toggleAllRows = (0, _dataGridContext.useDataGridContext_unstable)((ctx)=>ctx.selection.toggleAllRows);
29
29
  const type = (0, _dataGridContext.useDataGridContext_unstable)((ctx)=>ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio');
30
30
  const onClick = (0, _reactutilities.useEventCallback)((e)=>{
31
- var _props_onClick, _props;
31
+ var _props_onClick;
32
32
  if (isHeader) {
33
33
  toggleAllRows(e);
34
34
  }
35
- (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, e);
35
+ (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);
36
36
  });
37
37
  return (0, _useTableSelectionCell.useTableSelectionCell_unstable)({
38
38
  as: 'div',
@@ -1 +1 @@
1
- {"version":3,"sources":["useDataGridSelectionCell.js"],"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';\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 */ export const useDataGridSelectionCell_unstable = (props, ref)=>{\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 return ctx.selection.isRowSelected(rowId);\n });\n const toggleAllRows = useDataGridContext_unstable((ctx)=>ctx.selection.toggleAllRows);\n const type = useDataGridContext_unstable((ctx)=>ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio');\n const onClick = useEventCallback((e)=>{\n var _props_onClick, _props;\n if (isHeader) {\n toggleAllRows(e);\n }\n (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, e);\n });\n return useTableSelectionCell_unstable({\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 }, ref);\n};\n"],"names":["useDataGridSelectionCell_unstable","props","ref","isHeader","useIsInTableHeader","rowId","useTableRowIdContext","subtle","useDataGridContext_unstable","ctx","subtleSelection","checked","selection","selectionMode","allRowsSelected","someRowsSelected","isRowSelected","toggleAllRows","type","onClick","useEventCallback","e","_props_onClick","_props","call","useTableSelectionCell_unstable","as","role","hidden","undefined"],"mappings":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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';\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 */ export const useDataGridSelectionCell_unstable = (props, ref)=>{\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 return ctx.selection.isRowSelected(rowId);\n });\n const toggleAllRows = useDataGridContext_unstable((ctx)=>ctx.selection.toggleAllRows);\n const type = useDataGridContext_unstable((ctx)=>ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio');\n const onClick = useEventCallback((e)=>{\n var _props_onClick;\n if (isHeader) {\n toggleAllRows(e);\n }\n (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, e);\n });\n return useTableSelectionCell_unstable({\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 }, ref);\n};\n"],"names":["useDataGridSelectionCell_unstable","props","ref","isHeader","useIsInTableHeader","rowId","useTableRowIdContext","subtle","useDataGridContext_unstable","ctx","subtleSelection","checked","selection","selectionMode","allRowsSelected","someRowsSelected","isRowSelected","toggleAllRows","type","onClick","useEventCallback","e","_props_onClick","call","useTableSelectionCell_unstable","as","role","hidden","undefined"],"mappings":";;;;+BAciBA;;;eAAAA;;;;iEAdM;gCACU;iCACW;8BACP;oCACF;uCACY;AASpC,MAAMA,oCAAoC,CAACC,OAAOC;IACzD,MAAMC,WAAWC,IAAAA,sCAAkB;IACnC,MAAMC,QAAQC,IAAAA,kCAAoB;IAClC,MAAMC,SAASC,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIC,eAAe;IACrE,MAAMC,UAAUH,IAAAA,4CAA2B,EAAC,CAACC;QACzC,IAAIN,YAAYM,IAAIG,SAAS,CAACC,aAAa,KAAK,eAAe;YAC3D,OAAOJ,IAAIG,SAAS,CAACE,eAAe,GAAG,OAAOL,IAAIG,SAAS,CAACG,gBAAgB,GAAG,UAAU;QAC7F;QACA,OAAON,IAAIG,SAAS,CAACI,aAAa,CAACX;IACvC;IACA,MAAMY,gBAAgBT,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIG,SAAS,CAACK,aAAa;IACpF,MAAMC,OAAOV,IAAAA,4CAA2B,EAAC,CAACC,MAAMA,IAAIG,SAAS,CAACC,aAAa,KAAK,gBAAgB,aAAa;IAC7G,MAAMM,UAAUC,IAAAA,gCAAgB,EAAC,CAACC;QAC9B,IAAIC;QACJ,IAAInB,UAAU;YACVc,cAAcI;QAClB;QACCC,CAAAA,iBAAiBrB,MAAMkB,OAAO,AAAD,MAAO,QAAQG,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeC,IAAI,CAACtB,OAAOoB;IACjH;IACA,OAAOG,IAAAA,qDAA8B,EAAC;QAClCC,IAAI;QACJC,MAAM;QACNf;QACAO;QACAS,QAAQxB,YAAYe,SAAS;QAC7B,gBAAgBf,WAAWQ,UAAUiB;QACrC,iBAAiBzB,YAAYQ,YAAY,UAAUiB,YAAYjB;QAC/DJ;QACA,GAAGN,KAAK;QACRkB;IACJ,GAAGjB;AACP"}
@@ -24,7 +24,8 @@ const sortIcons = {
24
24
  })
25
25
  };
26
26
  const useTableHeaderCell_unstable = (props, ref)=>{
27
- const { noNativeElements, sortable } = (0, _tableContext.useTableContext)();
27
+ const { noNativeElements, sortable: contextSortable } = (0, _tableContext.useTableContext)();
28
+ const { sortable = contextSortable } = props;
28
29
  var _props_as;
29
30
  const rootComponent = ((_props_as = props.as) !== null && _props_as !== void 0 ? _props_as : noNativeElements) ? 'div' : 'th';
30
31
  var _props_sortDirection;
@@ -1 +1 @@
1
- {"version":3,"sources":["useTableHeaderCell.js"],"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 { useTableContext } from '../../contexts/tableContext';\nconst sortIcons = {\n ascending: /*#__PURE__*/ React.createElement(ArrowUpRegular, {\n fontSize: 12\n }),\n descending: /*#__PURE__*/ React.createElement(ArrowDownRegular, {\n 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 */ export const useTableHeaderCell_unstable = (props, ref)=>{\n const { noNativeElements, sortable } = useTableContext();\n var _props_as;\n const rootComponent = ((_props_as = props.as) !== null && _props_as !== void 0 ? _props_as : noNativeElements) ? 'div' : 'th';\n var _props_sortDirection;\n return {\n components: {\n root: rootComponent,\n button: 'div',\n sortIcon: 'span',\n aside: 'span'\n },\n root: slot.always(getNativeElementProps(rootComponent, {\n ref: useMergedRefs(ref, useFocusWithin()),\n role: rootComponent === 'div' ? 'columnheader' : undefined,\n 'aria-sort': sortable ? (_props_sortDirection = props.sortDirection) !== null && _props_sortDirection !== void 0 ? _props_sortDirection : 'none' : undefined,\n ...props\n }), {\n elementType: rootComponent\n }),\n aside: slot.optional(props.aside, {\n elementType: 'span'\n }),\n sortIcon: slot.optional(props.sortIcon, {\n renderByDefault: !!props.sortDirection,\n defaultProps: {\n children: props.sortDirection ? sortIcons[props.sortDirection] : undefined\n },\n elementType: 'span'\n }),\n button: slot.always(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":["useTableHeaderCell_unstable","sortIcons","ascending","React","createElement","ArrowUpRegular","fontSize","descending","ArrowDownRegular","props","ref","noNativeElements","sortable","useTableContext","_props_as","rootComponent","as","_props_sortDirection","components","root","button","sortIcon","aside","slot","always","getNativeElementProps","useMergedRefs","useFocusWithin","role","undefined","sortDirection","elementType","optional","renderByDefault","defaultProps","children","useARIAButtonShorthand","required","tabIndex"],"mappings":";;;;+BAsBiBA;;;eAAAA;;;;iEAtBM;gCACoC;8BAC5B;4BACkB;2BACV;8BACP;AAChC,MAAMC,YAAY;IACdC,WAAW,WAAW,GAAGC,OAAMC,aAAa,CAACC,0BAAc,EAAE;QACzDC,UAAU;IACd;IACAC,YAAY,WAAW,GAAGJ,OAAMC,aAAa,CAACI,4BAAgB,EAAE;QAC5DF,UAAU;IACd;AACJ;AASW,MAAMN,8BAA8B,CAACS,OAAOC;IACnD,MAAM,EAAEC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGC,IAAAA,6BAAe;IACtD,IAAIC;IACJ,MAAMC,gBAAgB,AAAC,CAAA,AAACD,CAAAA,YAAYL,MAAMO,EAAE,AAAD,MAAO,QAAQF,cAAc,KAAK,IAAIA,YAAYH,gBAAe,IAAK,QAAQ;IACzH,IAAIM;IACJ,OAAO;QACHC,YAAY;YACRC,MAAMJ;YACNK,QAAQ;YACRC,UAAU;YACVC,OAAO;QACX;QACAH,MAAMI,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAACV,eAAe;YACnDL,KAAKgB,IAAAA,6BAAa,EAAChB,KAAKiB,IAAAA,4BAAc;YACtCC,MAAMb,kBAAkB,QAAQ,iBAAiBc;YACjD,aAAajB,WAAW,AAACK,CAAAA,uBAAuBR,MAAMqB,aAAa,AAAD,MAAO,QAAQb,yBAAyB,KAAK,IAAIA,uBAAuB,SAASY;YACnJ,GAAGpB,KAAK;QACZ,IAAI;YACAsB,aAAahB;QACjB;QACAO,OAAOC,oBAAI,CAACS,QAAQ,CAACvB,MAAMa,KAAK,EAAE;YAC9BS,aAAa;QACjB;QACAV,UAAUE,oBAAI,CAACS,QAAQ,CAACvB,MAAMY,QAAQ,EAAE;YACpCY,iBAAiB,CAAC,CAACxB,MAAMqB,aAAa;YACtCI,cAAc;gBACVC,UAAU1B,MAAMqB,aAAa,GAAG7B,SAAS,CAACQ,MAAMqB,aAAa,CAAC,GAAGD;YACrE;YACAE,aAAa;QACjB;QACAX,QAAQG,oBAAI,CAACC,MAAM,CAACY,IAAAA,iCAAsB,EAAC3B,MAAMW,MAAM,EAAE;YACrDiB,UAAU;YACVH,cAAc;gBACVlB,IAAI;gBACJ,GAAG,CAACJ,YAAY;oBACZgB,MAAM;oBACNU,UAAUT;gBACd,CAAC;YACL;QACJ,IAAI;YACAE,aAAa;QACjB;QACAnB;QACAD;IACJ;AACJ"}
1
+ {"version":3,"sources":["useTableHeaderCell.js"],"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 { useTableContext } from '../../contexts/tableContext';\nconst sortIcons = {\n ascending: /*#__PURE__*/ React.createElement(ArrowUpRegular, {\n fontSize: 12\n }),\n descending: /*#__PURE__*/ React.createElement(ArrowDownRegular, {\n 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 */ export const useTableHeaderCell_unstable = (props, ref)=>{\n const { noNativeElements, sortable: contextSortable } = useTableContext();\n const { sortable = contextSortable } = props;\n var _props_as;\n const rootComponent = ((_props_as = props.as) !== null && _props_as !== void 0 ? _props_as : noNativeElements) ? 'div' : 'th';\n var _props_sortDirection;\n return {\n components: {\n root: rootComponent,\n button: 'div',\n sortIcon: 'span',\n aside: 'span'\n },\n root: slot.always(getNativeElementProps(rootComponent, {\n ref: useMergedRefs(ref, useFocusWithin()),\n role: rootComponent === 'div' ? 'columnheader' : undefined,\n 'aria-sort': sortable ? (_props_sortDirection = props.sortDirection) !== null && _props_sortDirection !== void 0 ? _props_sortDirection : 'none' : undefined,\n ...props\n }), {\n elementType: rootComponent\n }),\n aside: slot.optional(props.aside, {\n elementType: 'span'\n }),\n sortIcon: slot.optional(props.sortIcon, {\n renderByDefault: !!props.sortDirection,\n defaultProps: {\n children: props.sortDirection ? sortIcons[props.sortDirection] : undefined\n },\n elementType: 'span'\n }),\n button: slot.always(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":["useTableHeaderCell_unstable","sortIcons","ascending","React","createElement","ArrowUpRegular","fontSize","descending","ArrowDownRegular","props","ref","noNativeElements","sortable","contextSortable","useTableContext","_props_as","rootComponent","as","_props_sortDirection","components","root","button","sortIcon","aside","slot","always","getNativeElementProps","useMergedRefs","useFocusWithin","role","undefined","sortDirection","elementType","optional","renderByDefault","defaultProps","children","useARIAButtonShorthand","required","tabIndex"],"mappings":";;;;+BAsBiBA;;;eAAAA;;;;iEAtBM;gCACoC;8BAC5B;4BACkB;2BAC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QG,oBAAI,CAACC,MAAM,CAACY,IAAAA,iCAAsB,EAAC5B,MAAMY,MAAM,EAAE;YACrDiB,UAAU;YACVH,cAAc;gBACVlB,IAAI;gBACJ,GAAG,CAACL,YAAY;oBACZiB,MAAM;oBACNU,UAAUT;gBACd,CAAC;YACL;QACJ,IAAI;YACAE,aAAa;QACjB;QACApB;QACAD;IACJ;AACJ"}
@@ -13,8 +13,8 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
13
  const _reactutilities = require("@fluentui/react-utilities");
14
14
  const useTableResizeHandle_unstable = (props, ref)=>{
15
15
  const onClick = (0, _reactutilities.useEventCallback)((event)=>{
16
- var _props_onClick, _props;
17
- (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, event);
16
+ var _props_onClick;
17
+ (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, event);
18
18
  event.stopPropagation();
19
19
  });
20
20
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["useTableResizeHandle.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useEventCallback, slot } from '@fluentui/react-utilities';\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 */ export const useTableResizeHandle_unstable = (props, ref)=>{\n const onClick = useEventCallback((event)=>{\n var _props_onClick, _props;\n (_props_onClick = (_props = props).onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(_props, event);\n event.stopPropagation();\n });\n return {\n components: {\n root: 'div'\n },\n root: slot.always(getNativeElementProps('div', {\n ref,\n ...props,\n onClick\n }), {\n elementType: 'div'\n })\n };\n};\n"],"names":["useTableResizeHandle_unstable","props","ref","onClick","useEventCallback","event","_props_onClick","_props","call","stopPropagation","components","root","slot","always","getNativeElementProps","elementType"],"mappings":";;;;+BAUiBA;;;eAAAA;;;;iEAVM;gCACuC;AASnD,MAAMA,gCAAgC,CAACC,OAAOC;IACrD,MAAMC,UAAUC,IAAAA,gCAAgB,EAAC,CAACC;QAC9B,IAAIC,gBAAgBC;QACnBD,CAAAA,iBAAiB,AAACC,CAAAA,SAASN,KAAI,EAAGE,OAAO,AAAD,MAAO,QAAQG,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeE,IAAI,CAACD,QAAQF;QACzHA,MAAMI,eAAe;IACzB;IACA,OAAO;QACHC,YAAY;YACRC,MAAM;QACV;QACAA,MAAMC,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;YAC3CZ;YACA,GAAGD,KAAK;YACRE;QACJ,IAAI;YACAY,aAAa;QACjB;IACJ;AACJ"}
1
+ {"version":3,"sources":["useTableResizeHandle.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useEventCallback, slot } from '@fluentui/react-utilities';\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 */ export const useTableResizeHandle_unstable = (props, ref)=>{\n const onClick = useEventCallback((event)=>{\n var _props_onClick;\n (_props_onClick = props.onClick) === null || _props_onClick === void 0 ? void 0 : _props_onClick.call(props, event);\n event.stopPropagation();\n });\n return {\n components: {\n root: 'div'\n },\n root: slot.always(getNativeElementProps('div', {\n ref,\n ...props,\n onClick\n }), {\n elementType: 'div'\n })\n };\n};\n"],"names":["useTableResizeHandle_unstable","props","ref","onClick","useEventCallback","event","_props_onClick","call","stopPropagation","components","root","slot","always","getNativeElementProps","elementType"],"mappings":";;;;+BAUiBA;;;eAAAA;;;;iEAVM;gCACuC;AASnD,MAAMA,gCAAgC,CAACC,OAAOC;IACrD,MAAMC,UAAUC,IAAAA,gCAAgB,EAAC,CAACC;QAC9B,IAAIC;QACHA,CAAAA,iBAAiBL,MAAME,OAAO,AAAD,MAAO,QAAQG,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeC,IAAI,CAACN,OAAOI;QAC7GA,MAAMG,eAAe;IACzB;IACA,OAAO;QACHC,YAAY;YACRC,MAAM;QACV;QACAA,MAAMC,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;YAC3CX;YACA,GAAGD,KAAK;YACRE;QACJ,IAAI;YACAW,aAAa;QACjB;IACJ;AACJ"}
@@ -23,6 +23,8 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
23
23
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
24
24
  const columnIdContext = /*#__PURE__*/ _react.createContext(undefined);
25
25
  const columnIdContextDefaultValue = '';
26
- var _React_useContext;
27
- const useColumnIdContext = ()=>(_React_useContext = _react.useContext(columnIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : columnIdContextDefaultValue;
26
+ const useColumnIdContext = ()=>{
27
+ var _React_useContext;
28
+ return (_React_useContext = _react.useContext(columnIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : columnIdContextDefaultValue;
29
+ };
28
30
  const ColumnIdContextProvider = columnIdContext.Provider;
@@ -1 +1 @@
1
- {"version":3,"sources":["columnIdContext.js"],"sourcesContent":["import * as React from 'react';\nconst columnIdContext = React.createContext(undefined);\nexport const columnIdContextDefaultValue = '';\nvar _React_useContext;\nexport const useColumnIdContext = ()=>(_React_useContext = React.useContext(columnIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : columnIdContextDefaultValue;\nexport const ColumnIdContextProvider = columnIdContext.Provider;\n"],"names":["columnIdContextDefaultValue","useColumnIdContext","ColumnIdContextProvider","columnIdContext","React","createContext","undefined","_React_useContext","useContext","Provider"],"mappings":";;;;;;;;;;;IAEaA,2BAA2B;eAA3BA;;IAEAC,kBAAkB;eAAlBA;;IACAC,uBAAuB;eAAvBA;;;;iEALU;AACvB,MAAMC,gCAAkBC,OAAMC,aAAa,CAACC;AACrC,MAAMN,8BAA8B;AAC3C,IAAIO;AACG,MAAMN,qBAAqB,IAAI,AAACM,CAAAA,oBAAoBH,OAAMI,UAAU,CAACL,gBAAe,MAAO,QAAQI,sBAAsB,KAAK,IAAIA,oBAAoBP;AACtJ,MAAME,0BAA0BC,gBAAgBM,QAAQ"}
1
+ {"version":3,"sources":["columnIdContext.js"],"sourcesContent":["import * as React from 'react';\nconst columnIdContext = React.createContext(undefined);\nexport const columnIdContextDefaultValue = '';\nexport const useColumnIdContext = ()=>{\n var _React_useContext;\n return (_React_useContext = React.useContext(columnIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : columnIdContextDefaultValue;\n};\nexport const ColumnIdContextProvider = columnIdContext.Provider;\n"],"names":["columnIdContextDefaultValue","useColumnIdContext","ColumnIdContextProvider","columnIdContext","React","createContext","undefined","_React_useContext","useContext","Provider"],"mappings":";;;;;;;;;;;IAEaA,2BAA2B;eAA3BA;;IACAC,kBAAkB;eAAlBA;;IAIAC,uBAAuB;eAAvBA;;;;iEAPU;AACvB,MAAMC,gCAAkBC,OAAMC,aAAa,CAACC;AACrC,MAAMN,8BAA8B;AACpC,MAAMC,qBAAqB;IAC9B,IAAIM;IACJ,OAAO,AAACA,CAAAA,oBAAoBH,OAAMI,UAAU,CAACL,gBAAe,MAAO,QAAQI,sBAAsB,KAAK,IAAIA,oBAAoBP;AAClI;AACO,MAAME,0BAA0BC,gBAAgBM,QAAQ"}
@@ -23,6 +23,8 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
23
23
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
24
24
  const rowIdContext = /*#__PURE__*/ _react.createContext(undefined);
25
25
  const tableRowIdContextDefaultValue = '';
26
- var _React_useContext;
27
- const useTableRowIdContext = ()=>(_React_useContext = _react.useContext(rowIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : tableRowIdContextDefaultValue;
26
+ const useTableRowIdContext = ()=>{
27
+ var _React_useContext;
28
+ return (_React_useContext = _react.useContext(rowIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : tableRowIdContextDefaultValue;
29
+ };
28
30
  const TableRowIdContextProvider = rowIdContext.Provider;
@@ -1 +1 @@
1
- {"version":3,"sources":["rowIdContext.js"],"sourcesContent":["import * as React from 'react';\nconst rowIdContext = React.createContext(undefined);\nexport const tableRowIdContextDefaultValue = '';\nvar _React_useContext;\nexport const useTableRowIdContext = ()=>(_React_useContext = React.useContext(rowIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : tableRowIdContextDefaultValue;\nexport const TableRowIdContextProvider = rowIdContext.Provider;\n"],"names":["tableRowIdContextDefaultValue","useTableRowIdContext","TableRowIdContextProvider","rowIdContext","React","createContext","undefined","_React_useContext","useContext","Provider"],"mappings":";;;;;;;;;;;IAEaA,6BAA6B;eAA7BA;;IAEAC,oBAAoB;eAApBA;;IACAC,yBAAyB;eAAzBA;;;;iEALU;AACvB,MAAMC,6BAAeC,OAAMC,aAAa,CAACC;AAClC,MAAMN,gCAAgC;AAC7C,IAAIO;AACG,MAAMN,uBAAuB,IAAI,AAACM,CAAAA,oBAAoBH,OAAMI,UAAU,CAACL,aAAY,MAAO,QAAQI,sBAAsB,KAAK,IAAIA,oBAAoBP;AACrJ,MAAME,4BAA4BC,aAAaM,QAAQ"}
1
+ {"version":3,"sources":["rowIdContext.js"],"sourcesContent":["import * as React from 'react';\nconst rowIdContext = React.createContext(undefined);\nexport const tableRowIdContextDefaultValue = '';\nexport const useTableRowIdContext = ()=>{\n var _React_useContext;\n return (_React_useContext = React.useContext(rowIdContext)) !== null && _React_useContext !== void 0 ? _React_useContext : tableRowIdContextDefaultValue;\n};\nexport const TableRowIdContextProvider = rowIdContext.Provider;\n"],"names":["tableRowIdContextDefaultValue","useTableRowIdContext","TableRowIdContextProvider","rowIdContext","React","createContext","undefined","_React_useContext","useContext","Provider"],"mappings":";;;;;;;;;;;IAEaA,6BAA6B;eAA7BA;;IACAC,oBAAoB;eAApBA;;IAIAC,yBAAyB;eAAzBA;;;;iEAPU;AACvB,MAAMC,6BAAeC,OAAMC,aAAa,CAACC;AAClC,MAAMN,gCAAgC;AACtC,MAAMC,uBAAuB;IAChC,IAAIM;IACJ,OAAO,AAACA,CAAAA,oBAAoBH,OAAMI,UAAU,CAACL,aAAY,MAAO,QAAQI,sBAAsB,KAAK,IAAIA,oBAAoBP;AAC/H;AACO,MAAME,4BAA4BC,aAAaM,QAAQ"}
@@ -28,5 +28,7 @@ const tableContextDefaultValue = {
28
28
  sortable: false
29
29
  };
30
30
  const TableContextProvider = tableContext.Provider;
31
- var _React_useContext;
32
- const useTableContext = ()=>(_React_useContext = _react.useContext(tableContext)) !== null && _React_useContext !== void 0 ? _React_useContext : tableContextDefaultValue;
31
+ const useTableContext = ()=>{
32
+ var _React_useContext;
33
+ return (_React_useContext = _react.useContext(tableContext)) !== null && _React_useContext !== void 0 ? _React_useContext : tableContextDefaultValue;
34
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["tableContext.js"],"sourcesContent":["import * as React from 'react';\nconst tableContext = React.createContext(undefined);\nexport const tableContextDefaultValue = {\n size: 'medium',\n noNativeElements: false,\n sortable: false\n};\nexport const TableContextProvider = tableContext.Provider;\nvar _React_useContext;\nexport const useTableContext = ()=>(_React_useContext = React.useContext(tableContext)) !== null && _React_useContext !== void 0 ? _React_useContext : tableContextDefaultValue;\n"],"names":["tableContextDefaultValue","TableContextProvider","useTableContext","tableContext","React","createContext","undefined","size","noNativeElements","sortable","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAEaA,wBAAwB;eAAxBA;;IAKAC,oBAAoB;eAApBA;;IAEAC,eAAe;eAAfA;;;;iEATU;AACvB,MAAMC,6BAAeC,OAAMC,aAAa,CAACC;AAClC,MAAMN,2BAA2B;IACpCO,MAAM;IACNC,kBAAkB;IAClBC,UAAU;AACd;AACO,MAAMR,uBAAuBE,aAAaO,QAAQ;AACzD,IAAIC;AACG,MAAMT,kBAAkB,IAAI,AAACS,CAAAA,oBAAoBP,OAAMQ,UAAU,CAACT,aAAY,MAAO,QAAQQ,sBAAsB,KAAK,IAAIA,oBAAoBX"}
1
+ {"version":3,"sources":["tableContext.js"],"sourcesContent":["import * as React from 'react';\nconst tableContext = React.createContext(undefined);\nexport const tableContextDefaultValue = {\n size: 'medium',\n noNativeElements: false,\n sortable: false\n};\nexport const TableContextProvider = tableContext.Provider;\nexport const useTableContext = ()=>{\n var _React_useContext;\n return (_React_useContext = React.useContext(tableContext)) !== null && _React_useContext !== void 0 ? _React_useContext : tableContextDefaultValue;\n};\n"],"names":["tableContextDefaultValue","TableContextProvider","useTableContext","tableContext","React","createContext","undefined","size","noNativeElements","sortable","Provider","_React_useContext","useContext"],"mappings":";;;;;;;;;;;IAEaA,wBAAwB;eAAxBA;;IAKAC,oBAAoB;eAApBA;;IACAC,eAAe;eAAfA;;;;iEARU;AACvB,MAAMC,6BAAeC,OAAMC,aAAa,CAACC;AAClC,MAAMN,2BAA2B;IACpCO,MAAM;IACNC,kBAAkB;IAClBC,UAAU;AACd;AACO,MAAMR,uBAAuBE,aAAaO,QAAQ;AAClD,MAAMR,kBAAkB;IAC3B,IAAIS;IACJ,OAAO,AAACA,CAAAA,oBAAoBP,OAAMQ,UAAU,CAACT,aAAY,MAAO,QAAQQ,sBAAsB,KAAK,IAAIA,oBAAoBX;AAC/H"}
@@ -62,9 +62,9 @@ function useKeyboardResizing(columnResizeState) {
62
62
  }
63
63
  });
64
64
  const enableInteractiveMode = _react.useCallback((colId)=>{
65
- var _onChangeRef_current, _onChangeRef, _resizeHandleRefs_get;
65
+ var _onChangeRef_current, _resizeHandleRefs_get;
66
66
  setColumnId(colId);
67
- (_onChangeRef_current = (_onChangeRef = onChangeRef).current) === null || _onChangeRef_current === void 0 ? void 0 : _onChangeRef_current.call(_onChangeRef, colId, true);
67
+ (_onChangeRef_current = onChangeRef.current) === null || _onChangeRef_current === void 0 ? void 0 : _onChangeRef_current.call(onChangeRef, colId, true);
68
68
  const handle = (_resizeHandleRefs_get = resizeHandleRefs.get(colId)) === null || _resizeHandleRefs_get === void 0 ? void 0 : _resizeHandleRefs_get.current;
69
69
  if (handle) {
70
70
  handle.setAttribute('tabindex', '-1');
@@ -75,11 +75,11 @@ function useKeyboardResizing(columnResizeState) {
75
75
  resizeHandleRefs
76
76
  ]);
77
77
  const disableInteractiveMode = _react.useCallback(()=>{
78
- var _onChangeRef_current, _onChangeRef, _resizeHandleRefs_get;
78
+ var _onChangeRef_current, _resizeHandleRefs_get;
79
79
  if (!columnId) {
80
80
  return;
81
81
  }
82
- (_onChangeRef_current = (_onChangeRef = onChangeRef).current) === null || _onChangeRef_current === void 0 ? void 0 : _onChangeRef_current.call(_onChangeRef, columnId, false);
82
+ (_onChangeRef_current = onChangeRef.current) === null || _onChangeRef_current === void 0 ? void 0 : _onChangeRef_current.call(onChangeRef, columnId, false);
83
83
  // Find the previous focusable element (table header button) and focus it.
84
84
  const el = (_resizeHandleRefs_get = resizeHandleRefs.get(columnId)) === null || _resizeHandleRefs_get === void 0 ? void 0 : _resizeHandleRefs_get.current;
85
85
  if (el) {
@@ -1 +1 @@
1
- {"version":3,"sources":["useKeyboardResizing.js"],"sourcesContent":["import * as React from 'react';\nimport { ArrowLeft, ArrowRight, Enter, Escape, Shift, Space } from '@fluentui/keyboard-keys';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useFocusFinders, useTabsterAttributes } from '@fluentui/react-tabster';\nconst STEP = 20;\nconst PRECISION_MODIFIER = Shift;\nconst PRECISION_FACTOR = 1 / 4;\nexport function useKeyboardResizing(columnResizeState) {\n const [columnId, setColumnId] = React.useState();\n const onChangeRef = React.useRef();\n const { findPrevFocusable } = useFocusFinders();\n const columnResizeStateRef = React.useRef(columnResizeState);\n React.useEffect(()=>{\n columnResizeStateRef.current = columnResizeState;\n }, [\n columnResizeState\n ]);\n const [resizeHandleRefs] = React.useState(()=>new Map());\n const keyboardHandler = useEventCallback((event)=>{\n if (!columnId) {\n return;\n }\n const width = columnResizeStateRef.current.getColumnWidth(columnId);\n const precisionModifier = event.getModifierState(PRECISION_MODIFIER);\n const stopEvent = ()=>{\n event.preventDefault();\n event.stopPropagation();\n };\n switch(event.key){\n case ArrowLeft:\n stopEvent();\n columnResizeStateRef.current.setColumnWidth(event.nativeEvent, {\n columnId,\n width: width - (precisionModifier ? STEP * PRECISION_FACTOR : STEP)\n });\n return;\n case ArrowRight:\n stopEvent();\n columnResizeStateRef.current.setColumnWidth(event.nativeEvent, {\n columnId,\n width: width + (precisionModifier ? STEP * PRECISION_FACTOR : STEP)\n });\n return;\n case Space:\n case Enter:\n case Escape:\n var // Just blur here, the onBlur handler will take care of the rest (disableInteractiveMode).\n _resizeHandleRefs_get_current, _resizeHandleRefs_get;\n stopEvent();\n (_resizeHandleRefs_get = resizeHandleRefs.get(columnId)) === null || _resizeHandleRefs_get === void 0 ? void 0 : (_resizeHandleRefs_get_current = _resizeHandleRefs_get.current) === null || _resizeHandleRefs_get_current === void 0 ? void 0 : _resizeHandleRefs_get_current.blur();\n break;\n }\n });\n const enableInteractiveMode = React.useCallback((colId)=>{\n var _onChangeRef_current, _onChangeRef, _resizeHandleRefs_get;\n setColumnId(colId);\n (_onChangeRef_current = (_onChangeRef = onChangeRef).current) === null || _onChangeRef_current === void 0 ? void 0 : _onChangeRef_current.call(_onChangeRef, colId, true);\n const handle = (_resizeHandleRefs_get = resizeHandleRefs.get(colId)) === null || _resizeHandleRefs_get === void 0 ? void 0 : _resizeHandleRefs_get.current;\n if (handle) {\n handle.setAttribute('tabindex', '-1');\n handle.tabIndex = -1;\n handle.focus();\n }\n }, [\n resizeHandleRefs\n ]);\n const disableInteractiveMode = React.useCallback(()=>{\n var // Notify the onChange listener that we are disabling interactive mode.\n _onChangeRef_current, _onChangeRef, _resizeHandleRefs_get;\n if (!columnId) {\n return;\n }\n (_onChangeRef_current = (_onChangeRef = onChangeRef).current) === null || _onChangeRef_current === void 0 ? void 0 : _onChangeRef_current.call(_onChangeRef, columnId, false);\n // Find the previous focusable element (table header button) and focus it.\n const el = (_resizeHandleRefs_get = resizeHandleRefs.get(columnId)) === null || _resizeHandleRefs_get === void 0 ? void 0 : _resizeHandleRefs_get.current;\n if (el) {\n var _findPrevFocusable;\n (_findPrevFocusable = findPrevFocusable(el)) === null || _findPrevFocusable === void 0 ? void 0 : _findPrevFocusable.focus(); // Focus the previous focusable element (header button).\n el.removeAttribute('tabindex');\n }\n setColumnId(undefined);\n }, [\n columnId,\n findPrevFocusable,\n resizeHandleRefs\n ]);\n const toggleInteractiveMode = (colId, onChange)=>{\n onChangeRef.current = onChange;\n if (!columnId) {\n enableInteractiveMode(colId);\n } else if (colId && columnId !== colId) {\n enableInteractiveMode(colId);\n setColumnId(colId);\n } else {\n disableInteractiveMode();\n }\n };\n const getKeyboardResizingRef = React.useCallback((colId)=>{\n const ref = resizeHandleRefs.get(colId) || React.createRef();\n resizeHandleRefs.set(colId, ref);\n return ref;\n }, [\n resizeHandleRefs\n ]);\n // This makes sure the left and right arrow keys are ignored in tabster,\n // so that they can be used for resizing.\n const tabsterAttrs = useTabsterAttributes({\n focusable: {\n ignoreKeydown: {\n ArrowLeft: true,\n ArrowRight: true\n }\n }\n });\n return {\n toggleInteractiveMode,\n columnId,\n getKeyboardResizingProps: (colId, currentWidth)=>({\n onKeyDown: keyboardHandler,\n onBlur: disableInteractiveMode,\n ref: getKeyboardResizingRef(colId),\n role: 'separator',\n 'aria-label': 'Resize column',\n 'aria-valuetext': `${currentWidth} pixels`,\n 'aria-hidden': colId === columnId ? false : true,\n tabIndex: colId === columnId ? 0 : undefined,\n ...tabsterAttrs\n })\n };\n}\n"],"names":["useKeyboardResizing","STEP","PRECISION_MODIFIER","Shift","PRECISION_FACTOR","columnResizeState","columnId","setColumnId","React","useState","onChangeRef","useRef","findPrevFocusable","useFocusFinders","columnResizeStateRef","useEffect","current","resizeHandleRefs","Map","keyboardHandler","useEventCallback","event","width","getColumnWidth","precisionModifier","getModifierState","stopEvent","preventDefault","stopPropagation","key","ArrowLeft","setColumnWidth","nativeEvent","ArrowRight","Space","Enter","Escape","_resizeHandleRefs_get_current","_resizeHandleRefs_get","get","blur","enableInteractiveMode","useCallback","colId","_onChangeRef_current","_onChangeRef","call","handle","setAttribute","tabIndex","focus","disableInteractiveMode","el","_findPrevFocusable","removeAttribute","undefined","toggleInteractiveMode","onChange","getKeyboardResizingRef","ref","createRef","set","tabsterAttrs","useTabsterAttributes","focusable","ignoreKeydown","getKeyboardResizingProps","currentWidth","onKeyDown","onBlur","role"],"mappings":";;;;+BAOgBA;;;eAAAA;;;;iEAPO;8BAC4C;gCAClC;8BACqB;AACtD,MAAMC,OAAO;AACb,MAAMC,qBAAqBC,mBAAK;AAChC,MAAMC,mBAAmB,IAAI;AACtB,SAASJ,oBAAoBK,iBAAiB;IACjD,MAAM,CAACC,UAAUC,YAAY,GAAGC,OAAMC,QAAQ;IAC9C,MAAMC,cAAcF,OAAMG,MAAM;IAChC,MAAM,EAAEC,iBAAiB,EAAE,GAAGC,IAAAA,6BAAe;IAC7C,MAAMC,uBAAuBN,OAAMG,MAAM,CAACN;IAC1CG,OAAMO,SAAS,CAAC;QACZD,qBAAqBE,OAAO,GAAGX;IACnC,GAAG;QACCA;KACH;IACD,MAAM,CAACY,iBAAiB,GAAGT,OAAMC,QAAQ,CAAC,IAAI,IAAIS;IAClD,MAAMC,kBAAkBC,IAAAA,gCAAgB,EAAC,CAACC;QACtC,IAAI,CAACf,UAAU;YACX;QACJ;QACA,MAAMgB,QAAQR,qBAAqBE,OAAO,CAACO,cAAc,CAACjB;QAC1D,MAAMkB,oBAAoBH,MAAMI,gBAAgB,CAACvB;QACjD,MAAMwB,YAAY;YACdL,MAAMM,cAAc;YACpBN,MAAMO,eAAe;QACzB;QACA,OAAOP,MAAMQ,GAAG;YACZ,KAAKC,uBAAS;gBACVJ;gBACAZ,qBAAqBE,OAAO,CAACe,cAAc,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AAKD,uBAAuBf;gBAC5B2B,MAAM;gBACN,cAAc;gBACd,kBAAkB,CAAC,EAAEH,aAAa,OAAO,CAAC;gBAC1C,eAAexB,UAAUrC,WAAW,QAAQ;gBAC5C2C,UAAUN,UAAUrC,WAAW,IAAIiD;gBACnC,GAAGO,YAAY;YACnB,CAAA;IACR;AACJ"}
1
+ {"version":3,"sources":["useKeyboardResizing.js"],"sourcesContent":["import * as React from 'react';\nimport { ArrowLeft, ArrowRight, Enter, Escape, Shift, Space } from '@fluentui/keyboard-keys';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useFocusFinders, useTabsterAttributes } from '@fluentui/react-tabster';\nconst STEP = 20;\nconst PRECISION_MODIFIER = Shift;\nconst PRECISION_FACTOR = 1 / 4;\nexport function useKeyboardResizing(columnResizeState) {\n const [columnId, setColumnId] = React.useState();\n const onChangeRef = React.useRef();\n const { findPrevFocusable } = useFocusFinders();\n const columnResizeStateRef = React.useRef(columnResizeState);\n React.useEffect(()=>{\n columnResizeStateRef.current = columnResizeState;\n }, [\n columnResizeState\n ]);\n const [resizeHandleRefs] = React.useState(()=>new Map());\n const keyboardHandler = useEventCallback((event)=>{\n if (!columnId) {\n return;\n }\n const width = columnResizeStateRef.current.getColumnWidth(columnId);\n const precisionModifier = event.getModifierState(PRECISION_MODIFIER);\n const stopEvent = ()=>{\n event.preventDefault();\n event.stopPropagation();\n };\n switch(event.key){\n case ArrowLeft:\n stopEvent();\n columnResizeStateRef.current.setColumnWidth(event.nativeEvent, {\n columnId,\n width: width - (precisionModifier ? STEP * PRECISION_FACTOR : STEP)\n });\n return;\n case ArrowRight:\n stopEvent();\n columnResizeStateRef.current.setColumnWidth(event.nativeEvent, {\n columnId,\n width: width + (precisionModifier ? STEP * PRECISION_FACTOR : STEP)\n });\n return;\n case Space:\n case Enter:\n case Escape:\n var // Just blur here, the onBlur handler will take care of the rest (disableInteractiveMode).\n _resizeHandleRefs_get_current, _resizeHandleRefs_get;\n stopEvent();\n (_resizeHandleRefs_get = resizeHandleRefs.get(columnId)) === null || _resizeHandleRefs_get === void 0 ? void 0 : (_resizeHandleRefs_get_current = _resizeHandleRefs_get.current) === null || _resizeHandleRefs_get_current === void 0 ? void 0 : _resizeHandleRefs_get_current.blur();\n break;\n }\n });\n const enableInteractiveMode = React.useCallback((colId)=>{\n var _onChangeRef_current, _resizeHandleRefs_get;\n setColumnId(colId);\n (_onChangeRef_current = onChangeRef.current) === null || _onChangeRef_current === void 0 ? void 0 : _onChangeRef_current.call(onChangeRef, colId, true);\n const handle = (_resizeHandleRefs_get = resizeHandleRefs.get(colId)) === null || _resizeHandleRefs_get === void 0 ? void 0 : _resizeHandleRefs_get.current;\n if (handle) {\n handle.setAttribute('tabindex', '-1');\n handle.tabIndex = -1;\n handle.focus();\n }\n }, [\n resizeHandleRefs\n ]);\n const disableInteractiveMode = React.useCallback(()=>{\n var // Notify the onChange listener that we are disabling interactive mode.\n _onChangeRef_current, _resizeHandleRefs_get;\n if (!columnId) {\n return;\n }\n (_onChangeRef_current = onChangeRef.current) === null || _onChangeRef_current === void 0 ? void 0 : _onChangeRef_current.call(onChangeRef, columnId, false);\n // Find the previous focusable element (table header button) and focus it.\n const el = (_resizeHandleRefs_get = resizeHandleRefs.get(columnId)) === null || _resizeHandleRefs_get === void 0 ? void 0 : _resizeHandleRefs_get.current;\n if (el) {\n var _findPrevFocusable;\n (_findPrevFocusable = findPrevFocusable(el)) === null || _findPrevFocusable === void 0 ? void 0 : _findPrevFocusable.focus(); // Focus the previous focusable element (header button).\n el.removeAttribute('tabindex');\n }\n setColumnId(undefined);\n }, [\n columnId,\n findPrevFocusable,\n resizeHandleRefs\n ]);\n const toggleInteractiveMode = (colId, onChange)=>{\n onChangeRef.current = onChange;\n if (!columnId) {\n enableInteractiveMode(colId);\n } else if (colId && columnId !== colId) {\n enableInteractiveMode(colId);\n setColumnId(colId);\n } else {\n disableInteractiveMode();\n }\n };\n const getKeyboardResizingRef = React.useCallback((colId)=>{\n const ref = resizeHandleRefs.get(colId) || React.createRef();\n resizeHandleRefs.set(colId, ref);\n return ref;\n }, [\n resizeHandleRefs\n ]);\n // This makes sure the left and right arrow keys are ignored in tabster,\n // so that they can be used for resizing.\n const tabsterAttrs = useTabsterAttributes({\n focusable: {\n ignoreKeydown: {\n ArrowLeft: true,\n ArrowRight: true\n }\n }\n });\n return {\n toggleInteractiveMode,\n columnId,\n getKeyboardResizingProps: (colId, currentWidth)=>({\n onKeyDown: keyboardHandler,\n onBlur: disableInteractiveMode,\n ref: getKeyboardResizingRef(colId),\n role: 'separator',\n 'aria-label': 'Resize column',\n 'aria-valuetext': `${currentWidth} pixels`,\n 'aria-hidden': colId === columnId ? false : true,\n tabIndex: colId === columnId ? 0 : undefined,\n ...tabsterAttrs\n })\n };\n}\n"],"names":["useKeyboardResizing","STEP","PRECISION_MODIFIER","Shift","PRECISION_FACTOR","columnResizeState","columnId","setColumnId","React","useState","onChangeRef","useRef","findPrevFocusable","useFocusFinders","columnResizeStateRef","useEffect","current","resizeHandleRefs","Map","keyboardHandler","useEventCallback","event","width","getColumnWidth","precisionModifier","getModifierState","stopEvent","preventDefault","stopPropagation","key","ArrowLeft","setColumnWidth","nativeEvent","ArrowRight","Space","Enter","Escape","_resizeHandleRefs_get_current","_resizeHandleRefs_get","get","blur","enableInteractiveMode","useCallback","colId","_onChangeRef_current","call","handle","setAttribute","tabIndex","focus","disableInteractiveMode","el","_findPrevFocusable","removeAttribute","undefined","toggleInteractiveMode","onChange","getKeyboardResizingRef","ref","createRef","set","tabsterAttrs","useTabsterAttributes","focusable","ignoreKeydown","getKeyboardResizingProps","currentWidth","onKeyDown","onBlur","role"],"mappings":";;;;+BAOgBA;;;eAAAA;;;;iEAPO;8BAC4C;gCAClC;8BACqB;AACtD,MAAMC,OAAO;AACb,MAAMC,qBAAqBC,mBAAK;AAChC,MAAMC,mBAAmB,IAAI;AACtB,SAASJ,oBAAoBK,iBAAiB;IACjD,MAAM,CAACC,UAAUC,YAAY,GAAGC,OAA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