@fluentui/react-table 9.0.0-alpha.19 → 9.0.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +28 -1
- package/CHANGELOG.md +13 -2
- package/dist/index.d.ts +91 -91
- package/lib/components/DataGrid/DataGrid.types.js.map +1 -1
- package/lib/components/DataGridBody/DataGridBody.js.map +1 -1
- package/lib/components/DataGridBody/DataGridBody.types.js.map +1 -1
- package/lib/components/DataGridBody/renderDataGridBody.js +2 -2
- package/lib/components/DataGridBody/renderDataGridBody.js.map +1 -1
- package/lib/components/DataGridRow/DataGridRow.js.map +1 -1
- package/lib/components/DataGridRow/DataGridRow.types.js.map +1 -1
- package/lib/components/DataGridRow/useDataGridRow.js +2 -2
- package/lib/components/DataGridRow/useDataGridRow.js.map +1 -1
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js +2 -2
- package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
- package/lib/contexts/columnIdContext.js.map +1 -1
- package/lib/contexts/rowIdContext.js +4 -4
- package/lib/contexts/rowIdContext.js.map +1 -1
- package/lib/hooks/createColumn.js +1 -1
- package/lib/hooks/createColumn.js.map +1 -1
- package/lib/hooks/types.js.map +1 -1
- package/lib/hooks/useTableFeatures.js.map +1 -1
- package/lib/hooks/useTableSelection.js.map +1 -1
- package/lib/hooks/useTableSort.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/DataGridBody/DataGridBody.js.map +1 -1
- package/lib-commonjs/components/DataGridBody/renderDataGridBody.js +1 -1
- package/lib-commonjs/components/DataGridBody/renderDataGridBody.js.map +1 -1
- package/lib-commonjs/components/DataGridRow/DataGridRow.js.map +1 -1
- package/lib-commonjs/components/DataGridRow/useDataGridRow.js +1 -1
- package/lib-commonjs/components/DataGridRow/useDataGridRow.js.map +1 -1
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js +1 -1
- package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -1
- package/lib-commonjs/contexts/columnIdContext.js.map +1 -1
- package/lib-commonjs/contexts/rowIdContext.js +6 -6
- package/lib-commonjs/contexts/rowIdContext.js.map +1 -1
- package/lib-commonjs/hooks/createColumn.js +3 -3
- package/lib-commonjs/hooks/createColumn.js.map +1 -1
- package/lib-commonjs/hooks/useTableFeatures.js.map +1 -1
- package/lib-commonjs/hooks/useTableSelection.js.map +1 -1
- package/lib-commonjs/hooks/useTableSort.js.map +1 -1
- package/lib-commonjs/index.js +7 -7
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AACA,SAASA,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,
|
|
1
|
+
{"version":3,"mappings":"AACA,SAASA,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,kBAAkB,QAAQ,mCAAmC;AACtE,SAASC,8BAA8B,QAAQ,6CAA6C;AAG5F;;;;;;;;;AASA,OAAO,MAAMC,iCAAiC,GAAG,CAC/CC,KAAiC,EACjCC,GAA2B,KACG;EAC9B,MAAMC,QAAQ,GAAGL,kBAAkB,EAAE;EACrC,MAAMM,KAAK,GAAGP,oBAAoB,EAAE;EACpC,MAAMQ,MAAM,GAAGT,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACC,eAAe,CAAC;EACtE,MAAMC,OAAO,GAAGZ,2BAA2B,CAACU,GAAG,IAAG;IAChD,IAAIH,QAAQ,IAAIG,GAAG,CAACG,SAAS,CAACC,aAAa,KAAK,aAAa,EAAE;MAC7D,OAAOJ,GAAG,CAACG,SAAS,CAACE,eAAe,GAAG,IAAI,GAAGL,GAAG,CAACG,SAAS,CAACG,gBAAgB,GAAG,OAAO,GAAG,KAAK;;IAGhG,OAAON,GAAG,CAACG,SAAS,CAACI,aAAa,CAACT,KAAK,CAAC;EAC3C,CAAC,CAAC;EAEF,MAAMU,aAAa,GAAGlB,2BAA2B,CAACU,GAAG,IAAIA,GAAG,CAACG,SAAS,CAACK,aAAa,CAAC;EACrF,MAAMC,IAAI,GAAGnB,2BAA2B,CAACU,GAAG,IAC1CA,GAAG,CAACG,SAAS,CAACC,aAAa,KAAK,aAAa,GAAG,UAAU,GAAG,OAAO,CACrE;EAED,MAAMM,OAAO,GAAGrB,gBAAgB,CAAEsB,CAAyC,IAAI;;IAC7E,IAAId,QAAQ,EAAE;MACZW,aAAa,CAACG,CAAC,CAAC;;IAGlB,WAAK,CAACD,OAAO,+CAAbf,KAAK,EAAWgB,CAAC,CAAC;EACpB,CAAC,CAAC;EAEF,OAAOlB,8BAA8B,CACnC;IACEmB,EAAE,EAAE,KAAK;IACTC,IAAI,EAAE,UAAU;IAChBX,OAAO;IACPO,IAAI;IACJK,MAAM,EAAEjB,QAAQ,IAAIY,IAAI,KAAK,OAAO;IACpC,cAAc,EAAEZ,QAAQ,GAAGK,OAAO,GAAGa,SAAS;IAC9C,eAAe,EAAElB,QAAQ,IAAIK,OAAO,KAAK,OAAO,GAAGa,SAAS,GAAGb,OAAO;IACtEH,MAAM;IACN,GAAGJ,KAAK;IACRe;GACD,EACDd,GAAG,CACJ;AACH,CAAC","names":["useEventCallback","useDataGridContext_unstable","useTableRowIdContext","useIsInTableHeader","useTableSelectionCell_unstable","useDataGridSelectionCell_unstable","props","ref","isHeader","rowId","subtle","ctx","subtleSelection","checked","selection","selectionMode","allRowsSelected","someRowsSelected","isRowSelected","toggleAllRows","type","onClick","e","as","role","hidden","undefined"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridSelectionCell/useDataGridSelectionCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useTableRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\nimport { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSelectionCell';\nimport type { DataGridSelectionCellProps, DataGridSelectionCellState } from './DataGridSelectionCell.types';\n\n/**\n * Create the state required to render DataGridSelectionCell.\n *\n * The returned state can be modified with hooks such as useDataGridSelectionCellStyles_unstable,\n * before being passed to renderDataGridSelectionCell_unstable.\n *\n * @param props - props from this instance of DataGridSelectionCell\n * @param ref - reference to root HTMLElement of DataGridSelectionCell\n */\nexport const useDataGridSelectionCell_unstable = (\n props: DataGridSelectionCellProps,\n ref: React.Ref<HTMLElement>,\n): DataGridSelectionCellState => {\n const isHeader = useIsInTableHeader();\n const rowId = useTableRowIdContext();\n const subtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);\n const checked = useDataGridContext_unstable(ctx => {\n if (isHeader && ctx.selection.selectionMode === 'multiselect') {\n return ctx.selection.allRowsSelected ? true : ctx.selection.someRowsSelected ? 'mixed' : false;\n }\n\n return ctx.selection.isRowSelected(rowId);\n });\n\n const toggleAllRows = useDataGridContext_unstable(ctx => ctx.selection.toggleAllRows);\n const type = useDataGridContext_unstable(ctx =>\n ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio',\n );\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableCellElement>) => {\n if (isHeader) {\n toggleAllRows(e);\n }\n\n props.onClick?.(e);\n });\n\n return useTableSelectionCell_unstable(\n {\n as: 'div',\n role: 'gridcell',\n checked,\n type,\n hidden: isHeader && type === 'radio',\n 'aria-checked': isHeader ? checked : undefined,\n 'aria-selected': isHeader || checked === 'mixed' ? undefined : checked,\n subtle,\n ...props,\n onClick,\n },\n ref,\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAG9B,MAAMC,eAAe,gBAAGD,KAAK,CAACE,aAAa,
|
|
1
|
+
{"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAG9B,MAAMC,eAAe,gBAAGD,KAAK,CAACE,aAAa,CAA4BC,SAAS,CAAC;AAEjF,OAAO,MAAMC,2BAA2B,GAAG,EAAE;AAE7C,OAAO,MAAMC,kBAAkB,GAAG,MAAK;EAAA;EAAC,kBAAK,CAACC,UAAU,CAACL,eAAe,CAAC,mCAAIG,2BAA2B;AAAA;AAExG,OAAO,MAAMG,uBAAuB,GAAGN,eAAe,CAACO,QAAQ","names":["React","columnIdContext","createContext","undefined","columnIdContextDefaultValue","useColumnIdContext","useContext","ColumnIdContextProvider","Provider"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/contexts/columnIdContext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TableColumnId } from '../hooks/';\n\nconst columnIdContext = React.createContext<TableColumnId | undefined>(undefined);\n\nexport const columnIdContextDefaultValue = '';\n\nexport const useColumnIdContext = () => React.useContext(columnIdContext) ?? columnIdContextDefaultValue;\n\nexport const ColumnIdContextProvider = columnIdContext.Provider;\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
const rowIdContext = /*#__PURE__*/React.createContext(undefined);
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
3
|
+
export const tableRowIdContextDefaultValue = '';
|
|
4
|
+
export const useTableRowIdContext = () => {
|
|
5
5
|
var _a;
|
|
6
|
-
return (_a = React.useContext(rowIdContext)) !== null && _a !== void 0 ? _a :
|
|
6
|
+
return (_a = React.useContext(rowIdContext)) !== null && _a !== void 0 ? _a : tableRowIdContextDefaultValue;
|
|
7
7
|
};
|
|
8
|
-
export const
|
|
8
|
+
export const TableRowIdContextProvider = rowIdContext.Provider;
|
|
9
9
|
//# sourceMappingURL=rowIdContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAG9B,MAAMC,YAAY,gBAAGD,KAAK,CAACE,aAAa,
|
|
1
|
+
{"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAG9B,MAAMC,YAAY,gBAAGD,KAAK,CAACE,aAAa,CAAyBC,SAAS,CAAC;AAE3E,OAAO,MAAMC,6BAA6B,GAAG,EAAE;AAE/C,OAAO,MAAMC,oBAAoB,GAAG,MAAK;EAAA;EAAC,kBAAK,CAACC,UAAU,CAACL,YAAY,CAAC,mCAAIG,6BAA6B;AAAA;AAEzG,OAAO,MAAMG,yBAAyB,GAAGN,YAAY,CAACO,QAAQ","names":["React","rowIdContext","createContext","undefined","tableRowIdContextDefaultValue","useTableRowIdContext","useContext","TableRowIdContextProvider","Provider"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/contexts/rowIdContext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TableRowId } from '../hooks/';\n\nconst rowIdContext = React.createContext<TableRowId | undefined>(undefined);\n\nexport const tableRowIdContextDefaultValue = '';\n\nexport const useTableRowIdContext = () => React.useContext(rowIdContext) ?? tableRowIdContextDefaultValue;\n\nexport const TableRowIdContextProvider = rowIdContext.Provider;\n"]}
|
|
@@ -18,7 +18,7 @@ const defaultRenderHeaderCell = () => {
|
|
|
18
18
|
* @param options - column definition options
|
|
19
19
|
* @returns - column definition with defaults
|
|
20
20
|
*/
|
|
21
|
-
export function
|
|
21
|
+
export function createTableColumn(options) {
|
|
22
22
|
const {
|
|
23
23
|
columnId,
|
|
24
24
|
renderCell = defaultRenderCell,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAEA,MAAMA,cAAc,GAAG,MAAM,CAAC;AAE9B,MAAMC,iBAAiB,GAAG,MAAK;EAC7B,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACAC,OAAO,CAACC,IAAI,CAAC,+FAA+F,CAAC;;EAG/G,OAAO,IAAI;AACb,CAAC;AAED,MAAMC,uBAAuB,GAAG,MAAK;EACnC,IAAIL,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACAC,OAAO,CAACC,IAAI,CAAC,qGAAqG,CAAC;;EAGrH,OAAO,IAAI;AACb,CAAC;AAED;;;;;AAKA,OAAM,SAAUE,
|
|
1
|
+
{"version":3,"mappings":"AAEA,MAAMA,cAAc,GAAG,MAAM,CAAC;AAE9B,MAAMC,iBAAiB,GAAG,MAAK;EAC7B,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACAC,OAAO,CAACC,IAAI,CAAC,+FAA+F,CAAC;;EAG/G,OAAO,IAAI;AACb,CAAC;AAED,MAAMC,uBAAuB,GAAG,MAAK;EACnC,IAAIL,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACAC,OAAO,CAACC,IAAI,CAAC,qGAAqG,CAAC;;EAGrH,OAAO,IAAI;AACb,CAAC;AAED;;;;;AAKA,OAAM,SAAUE,iBAAiB,CAAQC,OAAwC;EAC/E,MAAM;IACJC,QAAQ;IACRC,UAAU,GAAGV,iBAAiB;IAC9BW,gBAAgB,GAAGL,uBAAuB;IAC1CM,OAAO,GAAGb;EAAc,CACzB,GAAGS,OAAO;EAEX,OAAO;IACLC,QAAQ;IACRC,UAAU;IACVC,gBAAgB;IAChBC;GACD;AACH","names":["defaultCompare","defaultRenderCell","process","env","NODE_ENV","console","warn","defaultRenderHeaderCell","createTableColumn","options","columnId","renderCell","renderHeaderCell","compare"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/hooks/createColumn.ts"],"sourcesContent":["import { CreateTableColumnOptions } from './types';\n\nconst defaultCompare = () => 0;\n\nconst defaultRenderCell = () => {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn('@fluentui/react-table: You are using the default column renderCell function that renders null');\n }\n\n return null;\n};\n\nconst defaultRenderHeaderCell = () => {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn('@fluentui/react-table: You are using the default column renderHeaderCell function that renders null');\n }\n\n return null;\n};\n\n/**\n * Helper function to create column definition with defaults\n * @param options - column definition options\n * @returns - column definition with defaults\n */\nexport function createTableColumn<TItem>(options: CreateTableColumnOptions<TItem>) {\n const {\n columnId,\n renderCell = defaultRenderCell,\n renderHeaderCell = defaultRenderHeaderCell,\n compare = defaultCompare,\n } = options;\n\n return {\n columnId,\n renderCell,\n renderHeaderCell,\n compare,\n };\n}\n"]}
|
package/lib/hooks/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/hooks/types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { SortDirection } from '../components/Table/Table.types';\n\nexport type
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"../src/","sources":["packages/react-components/react-table/src/hooks/types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { SortDirection } from '../components/Table/Table.types';\n\nexport type TableRowId = string | number;\nexport type TableColumnId = string | number;\nexport type SelectionMode = 'single' | 'multiselect';\n\nexport interface SortState {\n sortColumn: TableColumnId | undefined;\n sortDirection: SortDirection;\n}\n\nexport interface OnSelectionChangeData {\n selectedItems: Set<TableRowId>;\n}\n\nexport interface CreateTableColumnOptions<TItem> extends Partial<TableColumnDefinition<TItem>> {\n columnId: TableColumnId;\n}\n\nexport interface TableColumnDefinition<TItem> {\n columnId: TableColumnId;\n compare: (a: TItem, b: TItem) => number;\n renderHeaderCell: () => React.ReactNode;\n renderCell: (item: TItem) => React.ReactNode;\n}\n\nexport type RowEnhancer<TItem, TRowState extends TableRowData<TItem> = TableRowData<TItem>> = (\n row: TableRowData<TItem>,\n) => TRowState;\n\nexport interface TableSortState<TItem> {\n /**\n * Current sort direction\n */\n sortDirection: SortDirection;\n /**\n * Column id of the currently sorted column\n */\n sortColumn: TableColumnId | undefined;\n /**\n * Set the sort direction for the specified column\n */\n setColumnSort: (event: React.SyntheticEvent, columnId: TableColumnId, sortDirection: SortDirection) => void;\n /**\n * Toggles the sort direction for specified column\n */\n toggleColumnSort: (event: React.SyntheticEvent, columnId: TableColumnId) => void;\n /**\n * Returns the sort direction if a column is sorted,\n * returns undefined if the column is not sorted\n */\n getSortDirection: (columnId: TableColumnId) => SortDirection | undefined;\n\n /**\n * Sorts rows and returns a **shallow** copy of original items\n */\n sort: <TRowState extends TableRowData<TItem>>(rows: TRowState[]) => TRowState[];\n}\n\nexport interface TableSelectionState {\n /**\n * Clears all selected rows\n */\n clearRows: (e: React.SyntheticEvent) => void;\n /**\n * Selects single row\n */\n selectRow: (e: React.SyntheticEvent, rowId: TableRowId) => void;\n /**\n * De-selects single row\n */\n deselectRow: (e: React.SyntheticEvent, rowId: TableRowId) => void;\n /**\n * Toggle selection of all rows\n */\n toggleAllRows: (e: React.SyntheticEvent) => void;\n /**\n * Toggle selection of single row\n */\n toggleRow: (e: React.SyntheticEvent, rowId: TableRowId) => void;\n /**\n * Collection of row ids corresponding to selected rows\n */\n selectedRows: Set<TableRowId>;\n /**\n * Whether all rows are selected\n */\n allRowsSelected: boolean;\n /**\n * Whether some rows are selected\n */\n someRowsSelected: boolean;\n\n /**\n * Checks if a given rowId is selected\n */\n isRowSelected: (rowId: TableRowId) => boolean;\n\n selectionMode: SelectionMode;\n}\n\nexport interface TableRowData<TItem> {\n /**\n * User provided data\n */\n item: TItem;\n /**\n * The row id, defaults to index position in the collection\n */\n rowId: TableRowId;\n}\n\nexport interface TableFeaturesState<TItem> extends Pick<UseTableFeaturesOptions<TItem>, 'items' | 'getRowId'> {\n /**\n * The row data for rendering\n * @param rowEnhancer - Enhances the row with extra user data\n */\n getRows: <TRowState extends TableRowData<TItem> = TableRowData<TItem>>(\n rowEnhancer?: RowEnhancer<TItem, TRowState>,\n ) => TRowState[];\n /**\n * State and actions to manage row selection\n */\n selection: TableSelectionState;\n /**\n * State and actions to manage row sorting\n */\n sort: TableSortState<TItem>;\n /**\n * Table columns\n */\n columns: TableColumnDefinition<TItem>[];\n}\n\nexport interface UseTableSortOptions {\n /**\n * Used to control sorting\n */\n sortState?: SortState;\n /**\n * Used in uncontrolled mode to set initial sort column and direction on mount\n */\n defaultSortState?: SortState;\n /**\n * Called when sort changes\n */\n onSortChange?(e: React.SyntheticEvent, state: SortState): void;\n}\n\nexport interface UseTableSelectionOptions {\n /**\n * Can be multi or single select\n */\n selectionMode: SelectionMode;\n /**\n * Used in uncontrolled mode to set initial selected rows on mount\n */\n defaultSelectedItems?: Set<TableRowId>;\n /**\n * Used to control row selection\n */\n selectedItems?: Set<TableRowId>;\n /**\n * Called when selection changes\n */\n onSelectionChange?(e: React.SyntheticEvent, data: OnSelectionChangeData): void;\n}\n\nexport interface UseTableFeaturesOptions<TItem> {\n columns: TableColumnDefinition<TItem>[];\n items: TItem[];\n getRowId?: (item: TItem) => TableRowId;\n}\n\nexport type TableFeaturePlugin = <TItem>(tableState: TableFeaturesState<TItem>) => TableFeaturesState<TItem>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"
|
|
1
|
+
{"version":3,"mappings":"AAQA,SAASA,0BAA0B,QAAQ,qBAAqB;AAChE,SAASC,qBAAqB,QAAQ,gBAAgB;AAEtD,MAAMC,kBAAkB,GAAgDC,GAAG,IAAIA,GAAG;AAElF,OAAO,MAAMC,iBAAiB,GAAgC;EAC5DC,SAAS,EAAEL,0BAA0B;EACrCM,IAAI,EAAEL,qBAAqB;EAC3BM,OAAO,EAAE,MAAM,EAAE;EACjBC,QAAQ,EAAE,MAAM,EAAE;EAClBC,KAAK,EAAE,EAAE;EACTC,OAAO,EAAE;CACV;AAED,OAAM,SAAUC,gBAAgB,CAC9BC,OAAuC,EACvCC,UAAgC,EAAE;EAElC,MAAM;IAAEJ,KAAK;IAAED,QAAQ;IAAEE;EAAO,CAAE,GAAGE,OAAO;EAE5C,MAAML,OAAO,GAAG,CACdO,cAAcZ,kBAAmD,KAC9DO,KAAK,CAACM,GAAG,CAAC,CAACC,IAAI,EAAEC,CAAC,KAAI;IAAA;IAAC,kBAAW,CAAC;MAAED,IAAI;MAAEE,KAAK,EAAE,cAAQ,aAARV,QAAQ,uBAARA,QAAQ,CAAGQ,IAAI,CAAC,mCAAIC;IAAC,CAAE,CAAC;EAAA,EAAC;EAEhF,MAAME,YAAY,GAA8B;IAC9CX,QAAQ;IACRC,KAAK;IACLC,OAAO;IACPH,OAAO;IACPF,SAAS,EAAEL,0BAA0B;IACrCM,IAAI,EAAEL;GACP;EAED,OAAOY,OAAO,CAACO,MAAM,CAAC,CAACC,KAAK,EAAEC,MAAM,KAAKA,MAAM,CAACD,KAAK,CAAC,EAAEF,YAAY,CAAC;AACvE","names":["defaultTableSelectionState","defaultTableSortState","defaultRowEnhancer","row","defaultTableState","selection","sort","getRows","getRowId","items","columns","useTableFeatures","options","plugins","rowEnhancer","map","item","i","rowId","initialState","reduce","state","plugin"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/hooks/useTableFeatures.ts"],"sourcesContent":["import type {\n UseTableFeaturesOptions,\n TableFeaturesState,\n TableRowData,\n RowEnhancer,\n TableFeaturePlugin,\n TableSortState,\n} from './types';\nimport { defaultTableSelectionState } from './useTableSelection';\nimport { defaultTableSortState } from './useTableSort';\n\nconst defaultRowEnhancer: RowEnhancer<unknown, TableRowData<unknown>> = row => row;\n\nexport const defaultTableState: TableFeaturesState<unknown> = {\n selection: defaultTableSelectionState,\n sort: defaultTableSortState,\n getRows: () => [],\n getRowId: () => '',\n items: [],\n columns: [],\n};\n\nexport function useTableFeatures<TItem>(\n options: UseTableFeaturesOptions<TItem>,\n plugins: TableFeaturePlugin[] = [],\n): TableFeaturesState<TItem> {\n const { items, getRowId, columns } = options;\n\n const getRows = <TRowState extends TableRowData<TItem>>(\n rowEnhancer = defaultRowEnhancer as RowEnhancer<TItem, TRowState>,\n ) => items.map((item, i) => rowEnhancer({ item, rowId: getRowId?.(item) ?? i }));\n\n const initialState: TableFeaturesState<TItem> = {\n getRowId,\n items,\n columns,\n getRows,\n selection: defaultTableSelectionState,\n sort: defaultTableSortState as TableSortState<TItem>,\n };\n\n return plugins.reduce((state, plugin) => plugin(state), initialState);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,oBAAoB,EAAEC,gBAAgB,QAAQ,2BAA2B;AAClF,SAASC,sBAAsB,QAAQ,oBAAoB;AAG3D,MAAMC,IAAI,GAAG,MAAMC,SAAS;AAE5B,OAAO,MAAMC,0BAA0B,GAAwB;EAC7DC,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAEJ,IAAI;EACfK,WAAW,EAAEL,IAAI;EACjBM,aAAa,EAAE,MAAM,KAAK;EAC1BC,SAAS,EAAEP,IAAI;EACfQ,YAAY,eAAE,IAAIC,GAAG,EAAE;EACvBC,gBAAgB,EAAE,KAAK;EACvBC,aAAa,EAAEX,IAAI;EACnBY,SAAS,EAAEZ,IAAI;EACfa,aAAa,EAAE;CAChB;AAED,OAAM,SAAUC,iBAAiB,CAAQC,OAAiC;EACxE;EACA;EACA,OAAQC,
|
|
1
|
+
{"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,oBAAoB,EAAEC,gBAAgB,QAAQ,2BAA2B;AAClF,SAASC,sBAAsB,QAAQ,oBAAoB;AAG3D,MAAMC,IAAI,GAAG,MAAMC,SAAS;AAE5B,OAAO,MAAMC,0BAA0B,GAAwB;EAC7DC,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAEJ,IAAI;EACfK,WAAW,EAAEL,IAAI;EACjBM,aAAa,EAAE,MAAM,KAAK;EAC1BC,SAAS,EAAEP,IAAI;EACfQ,YAAY,eAAE,IAAIC,GAAG,EAAE;EACvBC,gBAAgB,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AAC;IAAA,EAAC,EAC7CZ,QAAQ,CACT;EACH,CAAC,CAAC;EAEF,MAAMX,SAAS,GAAqCd,gBAAgB,CAAC,CAACgC,CAAC,EAAEM,KAAiB,KACxFR,gBAAgB,CAACS,UAAU,CAACP,CAAC,EAAEM,KAAK,EAAEb,QAAQ,CAAC,CAChD;EAED,MAAMlB,WAAW,GAAuCP,gBAAgB,CAAC,CAACgC,CAAC,EAAEM,KAAiB,KAC5FR,gBAAgB,CAACU,YAAY,CAACR,CAAC,EAAEM,KAAK,EAAEb,QAAQ,CAAC,CAClD;EAED,MAAMhB,SAAS,GAAqCT,gBAAgB,CAAC,CAACgC,CAAC,EAAEM,KAAiB,KACxFR,gBAAgB,CAACW,UAAU,CAACT,CAAC,EAAEM,KAAK,EAAEb,QAAQ,CAAC,CAChD;EAED,MAAMjB,aAAa,GAA0C8B,KAAiB,IAC5ER,gBAAgB,CAACY,UAAU,CAACJ,KAAK,EAAEb,QAAQ,CAAC;EAE9C,OAAO;IACL,GAAGP,UAAU;IACbyB,SAAS,EAAE;MACT5B,aAAa;MACbH,gBAAgB,EAAEa,QAAQ,CAACmB,IAAI,GAAG,CAAC;MACnCvC,eAAe,EAAEU,aAAa,KAAK,QAAQ,GAAGU,QAAQ,CAACmB,IAAI,GAAG,CAAC,GAAGnB,QAAQ,CAACmB,IAAI,KAAKxB,KAAK,CAACyB,MAAM;MAChGnC,YAAY,EAAEe,QAAQ;MACtBX,SAAS;MACTD,aAAa;MACbP,SAAS,EAAEwB,gBAAgB,CAACgB,UAAU;MACtCvC,WAAW;MACXE,SAAS;MACTD;;GAEH;AACH","names":["React","useControllableState","useEventCallback","createSelectionManager","noop","undefined","defaultTableSelectionState","allRowsSelected","clearRows","deselectRow","isRowSelected","selectRow","selectedRows","Set","someRowsSelected","toggleAllRows","toggleRow","selectionMode","useTableSelection","options","tableState","useTableSelectionState","items","getRowId","defaultSelectedItems","selectedItems","onSelectionChange","selected","setSelected","initialState","defaultState","state","selectionManager","useMemo","e","newSelectedItems","toggleAllItems","map","item","i","rowId","toggleItem","deselectItem","selectItem","isSelected","selection","size","length","clearItems"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/hooks/useTableSelection.ts"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport { createSelectionManager } from './selectionManager';\nimport type { TableRowId, TableSelectionState, TableFeaturesState, UseTableSelectionOptions } from './types';\n\nconst noop = () => undefined;\n\nexport const defaultTableSelectionState: TableSelectionState = {\n allRowsSelected: false,\n clearRows: noop,\n deselectRow: noop,\n isRowSelected: () => false,\n selectRow: noop,\n selectedRows: new Set(),\n someRowsSelected: false,\n toggleAllRows: noop,\n toggleRow: noop,\n selectionMode: 'multiselect',\n};\n\nexport function useTableSelection<TItem>(options: UseTableSelectionOptions) {\n // False positive, these plugin hooks are intended to be run on every render\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return (tableState: TableFeaturesState<TItem>) => useTableSelectionState(tableState, options);\n}\n\nexport function useTableSelectionState<TItem>(\n tableState: TableFeaturesState<TItem>,\n options: UseTableSelectionOptions,\n): TableFeaturesState<TItem> {\n const { items, getRowId } = tableState;\n const { selectionMode, defaultSelectedItems, selectedItems, onSelectionChange } = options;\n\n const [selected, setSelected] = useControllableState({\n initialState: new Set<TableRowId>(),\n defaultState: defaultSelectedItems,\n state: selectedItems,\n });\n\n const selectionManager = React.useMemo(() => {\n return createSelectionManager(selectionMode, (e, newSelectedItems) => {\n setSelected(() => {\n onSelectionChange?.(e as React.SyntheticEvent, { selectedItems: newSelectedItems });\n return newSelectedItems;\n });\n });\n }, [onSelectionChange, selectionMode, setSelected]);\n\n const toggleAllRows: TableSelectionState['toggleAllRows'] = useEventCallback(e => {\n selectionManager.toggleAllItems(\n e,\n items.map((item, i) => getRowId?.(item) ?? i),\n selected,\n );\n });\n\n const toggleRow: TableSelectionState['toggleRow'] = useEventCallback((e, rowId: TableRowId) =>\n selectionManager.toggleItem(e, rowId, selected),\n );\n\n const deselectRow: TableSelectionState['deselectRow'] = useEventCallback((e, rowId: TableRowId) =>\n selectionManager.deselectItem(e, rowId, selected),\n );\n\n const selectRow: TableSelectionState['selectRow'] = useEventCallback((e, rowId: TableRowId) =>\n selectionManager.selectItem(e, rowId, selected),\n );\n\n const isRowSelected: TableSelectionState['isRowSelected'] = (rowId: TableRowId) =>\n selectionManager.isSelected(rowId, selected);\n\n return {\n ...tableState,\n selection: {\n selectionMode,\n someRowsSelected: selected.size > 0,\n allRowsSelected: selectionMode === 'single' ? selected.size > 0 : selected.size === items.length,\n selectedRows: selected,\n toggleRow,\n toggleAllRows,\n clearRows: selectionManager.clearItems,\n deselectRow,\n selectRow,\n isRowSelected,\n },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AACA,SAASA,oBAAoB,QAAQ,2BAA2B;
|
|
1
|
+
{"version":3,"mappings":"AACA,SAASA,oBAAoB,QAAQ,2BAA2B;AAUhE,MAAMC,IAAI,GAAG,MAAMC,SAAS;AAE5B,OAAO,MAAMC,qBAAqB,GAA4B;EAC5DC,gBAAgB,EAAE,MAAM,WAAW;EACnCC,aAAa,EAAEJ,IAAI;EACnBK,IAAI,EAA4CC,IAAiB,IAAK,CAAC,GAAGA,IAAI,CAAC;EAC/EC,UAAU,EAAEN,SAAS;EACrBO,aAAa,EAAE,WAAW;EAC1BC,gBAAgB,EAAET;CACnB;AAED,OAAM,SAAUU,YAAY,CAAQC,OAA4B;EAC9D;EACA;EACA,OAAQC,UAAqC,IAAKC,iBAAiB,CAACD,UAAU,EAAED,OAAO,CAAC;AAC1F;AAEA,OAAM,SAAUE,iBAAiB,CAC/BD,UAAqC,EACrCD,OAA4B;EAE5B,MAAM;IAAEG;EAAO,CAAE,GAAGF,UAAU;EAC9B,MAAM;IAAEG,SAAS;IAAEC,gBAAgB;IAAEC;EAAY,CAAE,GAAGN,OAAO;EAE7D,MAAM,CAACO,MAAM,EAAEC,SAAS,CAAC,GAA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AAC;MAC5E,IAAI,EAACyB,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEG,OAAO,GAAE;QAC3B,OAAO,CAAC;;MAGV,MAAMC,GAAG,GAAG5B,aAAa,KAAK,WAAW,GAAG,CAAC,GAAG,CAAC,CAAC;MAClD,OAAOwB,aAAa,CAACG,OAAO,CAACL,CAAC,CAACO,IAAI,EAAEN,CAAC,CAACM,IAAI,CAAC,GAAGD,GAAG;IACpD,CAAC,CAAC;EACJ,CAAC;EAED,MAAMjC,gBAAgB,GAA+CqB,QAAuB,IAAI;IAC9F,OAAOjB,UAAU,KAAKiB,QAAQ,GAAGhB,aAAa,GAAGP,SAAS;EAC5D,CAAC;EAED,OAAO;IACL,GAAGW,UAAU;IACbP,IAAI,EAAE;MACJA,IAAI;MACJE,UAAU;MACVC,aAAa;MACbJ,aAAa;MACbK,gBAAgB;MAChBN;;GAEH;AACH","names":["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"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/hooks/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"]}
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useTableFeatures, useTableSelection, useTableSort,
|
|
1
|
+
export { useTableFeatures, useTableSelection, useTableSort, createTableColumn } from './hooks';
|
|
2
2
|
export { TableCell, tableCellClassNames, tableCellClassName, useTableCellStyles_unstable, useTableCell_unstable, renderTableCell_unstable } from './TableCell';
|
|
3
3
|
export { TableRow, tableRowClassNames, tableRowClassName, useTableRowStyles_unstable, useTableRow_unstable, renderTableRow_unstable } from './TableRow';
|
|
4
4
|
export { TableBody, tableBodyClassName, tableBodyClassNames, useTableBodyStyles_unstable, useTableBody_unstable, renderTableBody_unstable } from './TableBody';
|
|
@@ -6,7 +6,7 @@ export { Table, tableClassName, tableClassNames, useTableStyles_unstable, useTab
|
|
|
6
6
|
export { TableHeader, tableHeaderClassNames, tableHeaderClassName, useTableHeaderStyles_unstable, useTableHeader_unstable, renderTableHeader_unstable } from './TableHeader';
|
|
7
7
|
export { TableHeaderCell, tableHeaderCellClassName, tableHeaderCellClassNames, useTableHeaderCellStyles_unstable, useTableHeaderCell_unstable, renderTableHeaderCell_unstable } from './TableHeaderCell';
|
|
8
8
|
export { TableContextProvider, useTableContext } from './contexts/tableContext';
|
|
9
|
-
export {
|
|
9
|
+
export { useTableRowIdContext, TableRowIdContextProvider } from './contexts/rowIdContext';
|
|
10
10
|
export { TableSelectionCell, useTableSelectionCellStyles_unstable, useTableSelectionCell_unstable, renderTableSelectionCell_unstable, tableSelectionCellClassNames } from './TableSelectionCell';
|
|
11
11
|
export { TableCellActions, tableCellActionsClassNames, useTableCellActionsStyles_unstable, useTableCellActions_unstable, renderTableCellActions_unstable } from './TableCellActions';
|
|
12
12
|
export { TableCellLayout, tableCellLayoutClassNames, useTableCellLayoutStyles_unstable, useTableCellLayout_unstable, renderTableCellLayout_unstable } from './TableCellLayout';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"AAAA,SAASA,gBAAgB,EAAEC,iBAAiB,EAAEC,YAAY,EAAEC,
|
|
1
|
+
{"version":3,"mappings":"AAAA,SAASA,gBAAgB,EAAEC,iBAAiB,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ,SA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,QACrB,eAAe;AAGtB,SACEC,YAAY,EACZC,sBAAsB,EACtBC,8BAA8B,EAC9BC,wBAAwB,EACxBC,2BAA2B,QACtB,gBAAgB;AAGvB,SACEC,QAAQ,EACRC,kBAAkB,EAClBC,0BAA0B,EAC1BC,oBAAoB,EACpBC,uBAAuB,QAClB,YAAY;AAUnB,SACEC,cAAc,EACdC,wBAAwB,EACxBC,gCAAgC,EAChCC,0BAA0B,EAC1BC,6BAA6B,QACxB,kBAAkB;AAGzB,SACEC,kBAAkB,EAClBC,4BAA4B,EAC5BC,oCAAoC,EACpCC,8BAA8B,EAC9BC,iCAAiC,QAC5B,sBAAsB;AAG7B,SACEC,qBAAqB,EACrBC,uCAAuC,EACvCC,iCAAiC,EACjCC,oCAAoC,EACpCC,+BAA+B,QAC1B,yBAAyB","names":["useTableFeatures","useTableSelection","useTableSort","createTableColumn","TableCell","tableCellClassNames","tableCellClassName","useTableCellStyles_unstable","useTableCell_unstable","renderTableCell_unstable","TableRow","tableRowClassNames","tableRowClassName","useTableRowStyles_unstable","useTableRow_unstable","renderTableRow_unstable","TableBody","tableBodyClassName","tableBodyClassNames","useTableBodyStyles_unstable","useTableBody_unstable","renderTableBody_unstable","Table","tableClassName","tableClassNames","useTableStyles_unstable","useTable_unstable","renderTable_unstable","TableHeader","tableHeaderClassNames","tableHeaderClassName","useTableHeaderStyles_unstable","useTableHeader_unstable","renderTableHeader_unstable","TableHeaderCell","tableHeaderCellClassName","tableHeaderCellClassNames","useTableHeaderCellStyles_unstable","useTableHeaderCell_unstable","renderTableHeaderCell_unstable","TableContextProvider","useTableContext","useTableRowIdContext","TableRowIdContextProvider","TableSelectionCell","useTableSelectionCellStyles_unstable","useTableSelectionCell_unstable","renderTableSelectionCell_unstable","tableSelectionCellClassNames","TableCellActions","tableCellActionsClassNames","useTableCellActionsStyles_unstable","useTableCellActions_unstable","renderTableCellActions_unstable","TableCellLayout","tableCellLayoutClassNames","useTableCellLayoutStyles_unstable","useTableCellLayout_unstable","renderTableCellLayout_unstable","DataGridCell","dataGridCellClassNames","useDataGridCellStyles_unstable","useDataGridCell_unstable","renderDataGridCell_unstable","DataGridRow","dataGridRowClassNames","useDataGridRowStyles_unstable","useDataGridRow_unstable","renderDataGridRow_unstable","DataGridBody","dataGridBodyClassNames","useDataGridBodyStyles_unstable","useDataGridBody_unstable","renderDataGridBody_unstable","DataGrid","dataGridClassNames","useDataGridStyles_unstable","useDataGrid_unstable","renderDataGrid_unstable","DataGridHeader","dataGridHeaderClassNames","useDataGridHeaderStyles_unstable","useDataGridHeader_unstable","renderDataGridHeader_unstable","DataGridHeaderCell","dataGridHeaderCellClassNames","useDataGridHeaderCellStyles_unstable","useDataGridHeaderCell_unstable","renderDataGridHeaderCell_unstable","DataGridSelectionCell","useDataGridSelectionCellStyles_unstable","useDataGridSelectionCell_unstable","renderDataGridSelectionCell_unstable","dataGridSelectionCellClassNames"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/index.ts"],"sourcesContent":["export { useTableFeatures, useTableSelection, useTableSort, createTableColumn } from './hooks';\nexport type {\n CreateTableColumnOptions,\n UseTableFeaturesOptions,\n TableColumnDefinition,\n TableColumnId,\n TableFeaturesState,\n TableRowData,\n TableRowId,\n TableSelectionState,\n TableSortState,\n TableFeaturePlugin,\n} from './hooks';\n\nexport {\n TableCell,\n tableCellClassNames,\n tableCellClassName,\n useTableCellStyles_unstable,\n useTableCell_unstable,\n renderTableCell_unstable,\n} from './TableCell';\nexport type { TableCellProps, TableCellState, TableCellSlots } from './TableCell';\n\nexport {\n TableRow,\n tableRowClassNames,\n tableRowClassName,\n useTableRowStyles_unstable,\n useTableRow_unstable,\n renderTableRow_unstable,\n} from './TableRow';\nexport type { TableRowProps, TableRowState, TableRowSlots } from './TableRow';\n\nexport {\n TableBody,\n tableBodyClassName,\n tableBodyClassNames,\n useTableBodyStyles_unstable,\n useTableBody_unstable,\n renderTableBody_unstable,\n} from './TableBody';\nexport type { TableBodyProps, TableBodyState, TableBodySlots } from './TableBody';\n\nexport {\n Table,\n tableClassName,\n tableClassNames,\n useTableStyles_unstable,\n useTable_unstable,\n renderTable_unstable,\n} from './Table';\nexport type { TableProps, TableSlots, TableState, TableContextValue, TableContextValues, SortDirection } from './Table';\n\nexport {\n TableHeader,\n tableHeaderClassNames,\n tableHeaderClassName,\n useTableHeaderStyles_unstable,\n useTableHeader_unstable,\n renderTableHeader_unstable,\n} from './TableHeader';\nexport type { TableHeaderProps, TableHeaderSlots, TableHeaderState } from './TableHeader';\n\nexport {\n TableHeaderCell,\n tableHeaderCellClassName,\n tableHeaderCellClassNames,\n useTableHeaderCellStyles_unstable,\n useTableHeaderCell_unstable,\n renderTableHeaderCell_unstable,\n} from './TableHeaderCell';\nexport type { TableHeaderCellProps, TableHeaderCellSlots, TableHeaderCellState } from './TableHeaderCell';\n\nexport { TableContextProvider, useTableContext } from './contexts/tableContext';\nexport { useTableRowIdContext, TableRowIdContextProvider } from './contexts/rowIdContext';\nexport {\n TableSelectionCell,\n useTableSelectionCellStyles_unstable,\n useTableSelectionCell_unstable,\n renderTableSelectionCell_unstable,\n tableSelectionCellClassNames,\n} from './TableSelectionCell';\n\nexport type { TableSelectionCellProps, TableSelectionCellState, TableSelectionCellSlots } from './TableSelectionCell';\nexport {\n TableCellActions,\n tableCellActionsClassNames,\n useTableCellActionsStyles_unstable,\n useTableCellActions_unstable,\n renderTableCellActions_unstable,\n} from './TableCellActions';\n\nexport type { TableCellActionsProps, TableCellActionsSlots, TableCellActionsState } from './TableCellActions';\nexport {\n TableCellLayout,\n tableCellLayoutClassNames,\n useTableCellLayoutStyles_unstable,\n useTableCellLayout_unstable,\n renderTableCellLayout_unstable,\n} from './TableCellLayout';\nexport type { TableCellLayoutProps, TableCellLayoutSlots, TableCellLayoutState } from './TableCellLayout';\n\nexport {\n DataGridCell,\n dataGridCellClassNames,\n useDataGridCellStyles_unstable,\n useDataGridCell_unstable,\n renderDataGridCell_unstable,\n} from './DataGridCell';\nexport type { DataGridCellProps, DataGridCellState, DataGridCellSlots } from './DataGridCell';\n\nexport {\n DataGridRow,\n dataGridRowClassNames,\n useDataGridRowStyles_unstable,\n useDataGridRow_unstable,\n renderDataGridRow_unstable,\n} from './DataGridRow';\nexport type { DataGridRowProps, DataGridRowState, DataGridRowSlots, CellRenderFunction } from './DataGridRow';\n\nexport {\n DataGridBody,\n dataGridBodyClassNames,\n useDataGridBodyStyles_unstable,\n useDataGridBody_unstable,\n renderDataGridBody_unstable,\n} from './DataGridBody';\nexport type { DataGridBodyProps, DataGridBodyState, DataGridBodySlots, RowRenderFunction } from './DataGridBody';\n\nexport {\n DataGrid,\n dataGridClassNames,\n useDataGridStyles_unstable,\n useDataGrid_unstable,\n renderDataGrid_unstable,\n} from './DataGrid';\nexport type {\n DataGridProps,\n DataGridSlots,\n DataGridState,\n DataGridContextValues,\n DataGridContextValue,\n DataGridFocusMode,\n} from './DataGrid';\n\nexport {\n DataGridHeader,\n dataGridHeaderClassNames,\n useDataGridHeaderStyles_unstable,\n useDataGridHeader_unstable,\n renderDataGridHeader_unstable,\n} from './DataGridHeader';\nexport type { DataGridHeaderProps, DataGridHeaderSlots, DataGridHeaderState } from './DataGridHeader';\n\nexport {\n DataGridHeaderCell,\n dataGridHeaderCellClassNames,\n useDataGridHeaderCellStyles_unstable,\n useDataGridHeaderCell_unstable,\n renderDataGridHeaderCell_unstable,\n} from './DataGridHeaderCell';\nexport type { DataGridHeaderCellProps, DataGridHeaderCellSlots, DataGridHeaderCellState } from './DataGridHeaderCell';\n\nexport {\n DataGridSelectionCell,\n useDataGridSelectionCellStyles_unstable,\n useDataGridSelectionCell_unstable,\n renderDataGridSelectionCell_unstable,\n dataGridSelectionCellClassNames,\n} from './DataGridSelectionCell';\n\nexport type {\n DataGridSelectionCellProps,\n DataGridSelectionCellState,\n DataGridSelectionCellSlots,\n} from './DataGridSelectionCell';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAIA;;;AAGaA,oBAAY,
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAIA;;;AAGaA,oBAAY,gBACqCC,KAAK,CAACC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAC5F,MAAMC,KAAK,GAAGC,0CAAwB,CAACH,KAAK,EAAEC,GAAG,CAAC;EAElDG,sDAA8B,CAACF,KAAK,CAAC;EACrC,OAAOG,gDAA2B,CAACH,KAAK,CAAC;AAC3C,CAAC,CAAuG;AAExGL,oBAAY,CAACS,WAAW,GAAG,cAAc","names":["exports","React","forwardRef","props","ref","state","useDataGridBody_1","useDataGridBodyStyles_1","renderDataGridBody_1","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridBody/DataGridBody.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDataGridBody_unstable } from './useDataGridBody';\nimport { renderDataGridBody_unstable } from './renderDataGridBody';\nimport { useDataGridBodyStyles_unstable } from './useDataGridBodyStyles';\nimport type { DataGridBodyProps } from './DataGridBody.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * DataGridBody component\n */\nexport const DataGridBody: ForwardRefComponent<DataGridBodyProps> &\n (<TItem>(props: DataGridBodyProps<TItem>) => JSX.Element) = React.forwardRef((props, ref) => {\n const state = useDataGridBody_unstable(props, ref);\n\n useDataGridBodyStyles_unstable(state);\n return renderDataGridBody_unstable(state);\n}) as ForwardRefComponent<DataGridBodyProps> & (<TItem>(props: DataGridBodyProps<TItem>) => JSX.Element);\n\nDataGridBody.displayName = 'DataGridBody';\n"]}
|
|
@@ -17,7 +17,7 @@ const renderDataGridBody_unstable = state => {
|
|
|
17
17
|
} = react_utilities_1.getSlots(state);
|
|
18
18
|
return React.createElement(slots.root, {
|
|
19
19
|
...slotProps.root
|
|
20
|
-
}, state.rows.map(row => React.createElement(rowIdContext_1.
|
|
20
|
+
}, state.rows.map(row => React.createElement(rowIdContext_1.TableRowIdContextProvider, {
|
|
21
21
|
key: row.rowId,
|
|
22
22
|
value: row.rowId
|
|
23
23
|
}, state.renderRow(row))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;AAAA;AACA;AAEA;AAEA;;;AAGO,MAAMA,2BAA2B,GAAIC,KAAwB,IAAI;EACtE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGC,0BAAQ,CAAoBH,KAAK,CAAC;EAE/D,OACEI,oBAACH,KAAK,CAACI,IAAI;IAAA,GAAKH,SAAS,CAACG;EAAI,GAC3BL,KAAK,CAACM,IAAI,CAACC,GAAG,CAACC,GAAG,IACjBJ,oBAACK,
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AACA;AAEA;AAEA;;;AAGO,MAAMA,2BAA2B,GAAIC,KAAwB,IAAI;EACtE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGC,0BAAQ,CAAoBH,KAAK,CAAC;EAE/D,OACEI,oBAACH,KAAK,CAACI,IAAI;IAAA,GAAKH,SAAS,CAACG;EAAI,GAC3BL,KAAK,CAACM,IAAI,CAACC,GAAG,CAACC,GAAG,IACjBJ,oBAACK,wCAAyB;IAACC,GAAG,EAAEF,GAAG,CAACG,KAAK;IAAEC,KAAK,EAAEJ,GAAG,CAACG;EAAK,GACxDX,KAAK,CAACa,SAAS,CAACL,GAAG,CAAC,CAExB,CAAC,CACS;AAEjB,CAAC;AAZYM,mCAA2B","names":["renderDataGridBody_unstable","state","slots","slotProps","react_utilities_1","React","root","rows","map","row","rowIdContext_1","key","rowId","value","renderRow","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridBody/renderDataGridBody.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { DataGridBodyState, DataGridBodySlots } from './DataGridBody.types';\nimport { TableRowIdContextProvider } from '../../contexts/rowIdContext';\n\n/**\n * Render the final JSX of DataGridBody\n */\nexport const renderDataGridBody_unstable = (state: DataGridBodyState) => {\n const { slots, slotProps } = getSlots<DataGridBodySlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {state.rows.map(row => (\n <TableRowIdContextProvider key={row.rowId} value={row.rowId}>\n {state.renderRow(row)}\n </TableRowIdContextProvider>\n ))}\n </slots.root>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAIA;;;AAGaA,mBAAW,
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAIA;;;AAGaA,mBAAW,gBACqCC,KAAK,CAACC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAC3F,MAAMC,KAAK,GAAGC,wCAAuB,CAACH,KAAK,EAAEC,GAAG,CAAC;EAEjDG,oDAA6B,CAACF,KAAK,CAAC;EACpC,OAAOG,8CAA0B,CAACH,KAAK,CAAC;AAC1C,CAAC,CAAqG;AAEtGL,mBAAW,CAACS,WAAW,GAAG,aAAa","names":["exports","React","forwardRef","props","ref","state","useDataGridRow_1","useDataGridRowStyles_1","renderDataGridRow_1","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridRow/DataGridRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useDataGridRow_unstable } from './useDataGridRow';\nimport { renderDataGridRow_unstable } from './renderDataGridRow';\nimport { useDataGridRowStyles_unstable } from './useDataGridRowStyles';\nimport type { DataGridRowProps } from './DataGridRow.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * DataGridRow component\n */\nexport const DataGridRow: ForwardRefComponent<DataGridRowProps> &\n (<TItem>(props: DataGridRowProps<TItem>) => JSX.Element) = React.forwardRef((props, ref) => {\n const state = useDataGridRow_unstable(props, ref);\n\n useDataGridRowStyles_unstable(state);\n return renderDataGridRow_unstable(state);\n}) as ForwardRefComponent<DataGridRowProps> & (<TItem>(props: DataGridRowProps<TItem>) => JSX.Element);\n\nDataGridRow.displayName = 'DataGridRow';\n"]}
|
|
@@ -21,7 +21,7 @@ const tableHeaderContext_1 = /*#__PURE__*/require("../../contexts/tableHeaderCon
|
|
|
21
21
|
* @param ref - reference to root HTMLElement of DataGridRow
|
|
22
22
|
*/
|
|
23
23
|
const useDataGridRow_unstable = (props, ref) => {
|
|
24
|
-
const rowId = rowIdContext_1.
|
|
24
|
+
const rowId = rowIdContext_1.useTableRowIdContext();
|
|
25
25
|
const isHeader = tableHeaderContext_1.useIsInTableHeader();
|
|
26
26
|
const columnDefs = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.columns);
|
|
27
27
|
const selectable = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.selectableRows);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;AASO,MAAMA,uBAAuB,GAAG,CAACC,KAAuB,EAAEC,GAA2B,KAAsB;EAChH,MAAMC,KAAK,GAAGC,
|
|
1
|
+
{"version":3,"mappings":";;;;;;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;AASO,MAAMA,uBAAuB,GAAG,CAACC,KAAuB,EAAEC,GAA2B,KAAsB;EAChH,MAAMC,KAAK,GAAGC,mCAAoB,EAAE;EACpC,MAAMC,QAAQ,GAAGC,uCAAkB,EAAE;EACrC,MAAMC,UAAU,GAAGC,6CAA2B,CAACC,GAAG,IAAIA,GAAG,CAACC,OAAO,CAAC;EAClE,MAAMC,UAAU,GAAGH,6CAA2B,CAACC,GAAG,IAAIA,GAAG,CAACG,cAAc,CAAC;EACzE,MAAMC,QAAQ,GAAGL,6CAA2B,CAACC,GAAG,IAAIA,GAAG,CAACK,SAAS,CAACC,aAAa,CAACZ,KAAK,CAAC,CAAC;EACvF,MAAMa,QAAQ,GAAGR,6CAA2B,CAACC,GAAG,IAAIA,GAAG,CAACQ,SAAS,KAAK,cAAc,CAAC;E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S;IACZM,UAAU,EAAE;MACV,GAAGN,SAAS,CAACM,UAAU;MACvBC,aAAa,EAAEC;KAChB;IACDD,aAAa,EAAEd,kCAAgB,CAACrB,KAAK,CAACmC,aAAa,EAAE;MAAEE,QAAQ,EAAE3B;IAAU,CAAE,CAAC;IAC9E4B,UAAU,EAAEtC,KAAK,CAAC+B,QAAQ;IAC1BzB;GACD;AACH,CAAC;AA1DYiC,+BAAuB","names":["useDataGridRow_unstable","props","ref","rowId","rowIdContext_1","isHeader","tableHeaderContext_1","columnDefs","dataGridContext_1","ctx","columns","selectable","selectableRows","selected","selection","isRowSelected","tabbable","focusMode","appearance","selectionAppearance","toggleRow","onClick","react_utilities_1","e","onKeyDown","key","keyboard_keys_1","target","preventDefault","baseState","useTableRow_1","undefined","children","as","tabIndex","components","selectionCell","DataGridSelectionCell_1","required","renderCell","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridRow/useDataGridRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport { isInteractiveHTMLElement, useEventCallback, resolveShorthand } from '@fluentui/react-utilities';\nimport { Space } from '@fluentui/keyboard-keys';\nimport type { DataGridRowProps, DataGridRowState } from './DataGridRow.types';\nimport { useTableRow_unstable } from '../TableRow/useTableRow';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { DataGridSelectionCell } from '../DataGridSelectionCell/DataGridSelectionCell';\nimport { useTableRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\n\n/**\n * Create the state required to render DataGridRow.\n *\n * The returned state can be modified with hooks such as useDataGridRowStyles_unstable,\n * before being passed to renderDataGridRow_unstable.\n *\n * @param props - props from this instance of DataGridRow\n * @param ref - reference to root HTMLElement of DataGridRow\n */\nexport const useDataGridRow_unstable = (props: DataGridRowProps, ref: React.Ref<HTMLElement>): DataGridRowState => {\n const rowId = useTableRowIdContext();\n const isHeader = useIsInTableHeader();\n const columnDefs = useDataGridContext_unstable(ctx => ctx.columns);\n const selectable = useDataGridContext_unstable(ctx => ctx.selectableRows);\n const selected = useDataGridContext_unstable(ctx => ctx.selection.isRowSelected(rowId));\n const tabbable = useDataGridContext_unstable(ctx => ctx.focusMode === 'row_unstable');\n const appearance = useDataGridContext_unstable(ctx => {\n if (!isHeader && selectable && ctx.selection.isRowSelected(rowId)) {\n return ctx.selectionAppearance;\n }\n\n return 'none';\n });\n const toggleRow = useDataGridContext_unstable(ctx => ctx.selection.toggleRow);\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader) {\n toggleRow(e, rowId);\n }\n\n props.onClick?.(e);\n });\n\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (selectable && !isHeader && e.key === Space && !isInteractiveHTMLElement(e.target as HTMLElement)) {\n // stop scrolling\n e.preventDefault();\n toggleRow(e, rowId);\n }\n\n props.onKeyDown?.(e);\n });\n\n const baseState = useTableRow_unstable(\n {\n appearance,\n 'aria-selected': selectable ? selected : undefined,\n ...props,\n onClick,\n onKeyDown,\n children: null,\n as: 'div',\n tabIndex: tabbable && !isHeader ? 0 : undefined,\n },\n ref,\n );\n\n return {\n ...baseState,\n components: {\n ...baseState.components,\n selectionCell: DataGridSelectionCell,\n },\n selectionCell: resolveShorthand(props.selectionCell, { required: selectable }),\n renderCell: props.children,\n columnDefs,\n };\n};\n"]}
|
|
@@ -20,7 +20,7 @@ const useTableSelectionCell_1 = /*#__PURE__*/require("../TableSelectionCell/useT
|
|
|
20
20
|
*/
|
|
21
21
|
const useDataGridSelectionCell_unstable = (props, ref) => {
|
|
22
22
|
const isHeader = tableHeaderContext_1.useIsInTableHeader();
|
|
23
|
-
const rowId = rowIdContext_1.
|
|
23
|
+
const rowId = rowIdContext_1.useTableRowIdContext();
|
|
24
24
|
const subtle = dataGridContext_1.useDataGridContext_unstable(ctx => ctx.subtleSelection);
|
|
25
25
|
const checked = dataGridContext_1.useDataGridContext_unstable(ctx => {
|
|
26
26
|
if (isHeader && ctx.selection.selectionMode === 'multiselect') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;AACA;AACA;AACA;AACA;AACA;AAGA;;;;;;;;;AASO,MAAMA,iCAAiC,GAAG,CAC/CC,KAAiC,EACjCC,GAA2B,KACG;EAC9B,MAAMC,QAAQ,GAAGC,uCAAkB,EAAE;EACrC,MAAMC,KAAK,GAAGC,
|
|
1
|
+
{"version":3,"mappings":";;;;;;AACA;AACA;AACA;AACA;AACA;AAGA;;;;;;;;;AASO,MAAMA,iCAAiC,GAAG,CAC/CC,KAAiC,EACjCC,GAA2B,KACG;EAC9B,MAAMC,QAAQ,GAAGC,uCAAkB,EAAE;EACrC,MAAMC,KAAK,GAAGC,mCAAoB,EAAE;EACpC,MAAMC,MAAM,GAAGC,6CAA2B,CAACC,GAAG,IAAIA,GAAG,CAACC,eAAe,CAAC;EACtE,MAAMC,OAAO,GAAGH,6CAA2B,CAACC,GAAG,IAAG;IAChD,IAAIN,QAAQ,IAAIM,GAAG,CAACG,SAAS,CAACC,aAAa,KAAK,aAAa,EAAE;MAC7D,OAAOJ,GAAG,CAACG,SAAS,CAACE,eAAe,GAAG,IAAI,GAAGL,GAAG,CAACG,SAAS,CAACG,gBAAgB,GAAG,OAAO,GAAG,KAAK;;IAGhG,OAAON,GAAG,CAACG,SAAS,CAACI,aAAa,CAACX,KAAK,CAAC;EAC3C,CAAC,CAAC;EAEF,MAAMY,aAAa,GAAGT,6CAA2B,CAACC,GAAG,IAAIA,GAAG,CAACG,SAAS,CAACK,aAAa,CAAC;EACrF,MAAMC,IAAI,GAAGV,6CAA2B,CAACC,GAAG,IAC1CA,GAAG,CAACG,SAAS,CAACC,aAAa,KAAK,aAAa,GAAG,UAAU,GAAG,OAAO,CACrE;EAED,MAAMM,OAAO,GAAGC,kCAAgB,CAAEC,CAAyC,IAAI;;IAC7E,IAAIlB,QAAQ,EAAE;MACZc,aAAa,CAACI,CAAC,CAAC;;IAGlB,WAAK,CAACF,OAAO,+CAAblB,KAAK,EAAWoB,CAAC,CAAC;EACpB,CAAC,CAAC;EAEF,OAAOC,sDAA8B,CACnC;IACEC,EAAE,EAAE,KAAK;IACTC,IAAI,EAAE,UAAU;IAChBb,OAAO;IACPO,IAAI;IACJO,MAAM,EAAEtB,QAAQ,IAAIe,IAAI,KAAK,OAAO;IACpC,cAAc,EAAEf,QAAQ,GAAGQ,OAAO,GAAGe,SAAS;IAC9C,eAAe,EAAEvB,QAAQ,IAAIQ,OAAO,KAAK,OAAO,GAAGe,SAAS,GAAGf,OAAO;IACtEJ,MAAM;IACN,GAAGN,KAAK;IACRkB;GACD,EACDjB,GAAG,CACJ;AACH,CAAC;AA3CYyB,yCAAiC","names":["useDataGridSelectionCell_unstable","props","ref","isHeader","tableHeaderContext_1","rowId","rowIdContext_1","subtle","dataGridContext_1","ctx","subtleSelection","checked","selection","selectionMode","allRowsSelected","someRowsSelected","isRowSelected","toggleAllRows","type","onClick","react_utilities_1","e","useTableSelectionCell_1","as","role","hidden","undefined","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/components/DataGridSelectionCell/useDataGridSelectionCell.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useDataGridContext_unstable } from '../../contexts/dataGridContext';\nimport { useTableRowIdContext } from '../../contexts/rowIdContext';\nimport { useIsInTableHeader } from '../../contexts/tableHeaderContext';\nimport { useTableSelectionCell_unstable } from '../TableSelectionCell/useTableSelectionCell';\nimport type { DataGridSelectionCellProps, DataGridSelectionCellState } from './DataGridSelectionCell.types';\n\n/**\n * Create the state required to render DataGridSelectionCell.\n *\n * The returned state can be modified with hooks such as useDataGridSelectionCellStyles_unstable,\n * before being passed to renderDataGridSelectionCell_unstable.\n *\n * @param props - props from this instance of DataGridSelectionCell\n * @param ref - reference to root HTMLElement of DataGridSelectionCell\n */\nexport const useDataGridSelectionCell_unstable = (\n props: DataGridSelectionCellProps,\n ref: React.Ref<HTMLElement>,\n): DataGridSelectionCellState => {\n const isHeader = useIsInTableHeader();\n const rowId = useTableRowIdContext();\n const subtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);\n const checked = useDataGridContext_unstable(ctx => {\n if (isHeader && ctx.selection.selectionMode === 'multiselect') {\n return ctx.selection.allRowsSelected ? true : ctx.selection.someRowsSelected ? 'mixed' : false;\n }\n\n return ctx.selection.isRowSelected(rowId);\n });\n\n const toggleAllRows = useDataGridContext_unstable(ctx => ctx.selection.toggleAllRows);\n const type = useDataGridContext_unstable(ctx =>\n ctx.selection.selectionMode === 'multiselect' ? 'checkbox' : 'radio',\n );\n\n const onClick = useEventCallback((e: React.MouseEvent<HTMLTableCellElement>) => {\n if (isHeader) {\n toggleAllRows(e);\n }\n\n props.onClick?.(e);\n });\n\n return useTableSelectionCell_unstable(\n {\n as: 'div',\n role: 'gridcell',\n checked,\n type,\n hidden: isHeader && type === 'radio',\n 'aria-checked': isHeader ? checked : undefined,\n 'aria-selected': isHeader || checked === 'mixed' ? undefined : checked,\n subtle,\n ...props,\n onClick,\n },\n ref,\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;AAAA;AAGA,MAAMA,eAAe,gBAAGC,KAAK,CAACC,aAAa,
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AAGA,MAAMA,eAAe,gBAAGC,KAAK,CAACC,aAAa,CAA4BC,SAAS,CAAC;AAEpEC,mCAA2B,GAAG,EAAE;AAEtC,MAAMC,kBAAkB,GAAG,MAAK;EAAA;EAAC,kBAAK,CAACC,UAAU,CAACN,eAAe,CAAC,mCAAII,mCAA2B;AAAA;AAA3FA,0BAAkB;AAElBA,+BAAuB,GAAGJ,eAAe,CAACO,QAAQ","names":["columnIdContext","React","createContext","undefined","exports","useColumnIdContext","useContext","Provider"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/contexts/columnIdContext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TableColumnId } from '../hooks/';\n\nconst columnIdContext = React.createContext<TableColumnId | undefined>(undefined);\n\nexport const columnIdContextDefaultValue = '';\n\nexport const useColumnIdContext = () => React.useContext(columnIdContext) ?? columnIdContextDefaultValue;\n\nexport const ColumnIdContextProvider = columnIdContext.Provider;\n"]}
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.TableRowIdContextProvider = exports.useTableRowIdContext = exports.tableRowIdContextDefaultValue = void 0;
|
|
7
7
|
const React = /*#__PURE__*/require("react");
|
|
8
8
|
const rowIdContext = /*#__PURE__*/React.createContext(undefined);
|
|
9
|
-
exports.
|
|
10
|
-
const
|
|
9
|
+
exports.tableRowIdContextDefaultValue = '';
|
|
10
|
+
const useTableRowIdContext = () => {
|
|
11
11
|
var _a;
|
|
12
|
-
return (_a = React.useContext(rowIdContext)) !== null && _a !== void 0 ? _a : exports.
|
|
12
|
+
return (_a = React.useContext(rowIdContext)) !== null && _a !== void 0 ? _a : exports.tableRowIdContextDefaultValue;
|
|
13
13
|
};
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
14
|
+
exports.useTableRowIdContext = useTableRowIdContext;
|
|
15
|
+
exports.TableRowIdContextProvider = rowIdContext.Provider;
|
|
16
16
|
//# sourceMappingURL=rowIdContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;AAAA;AAGA,MAAMA,YAAY,gBAAGC,KAAK,CAACC,aAAa,
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAAA;AAGA,MAAMA,YAAY,gBAAGC,KAAK,CAACC,aAAa,CAAyBC,SAAS,CAAC;AAE9DC,qCAA6B,GAAG,EAAE;AAExC,MAAMC,oBAAoB,GAAG,MAAK;EAAA;EAAC,kBAAK,CAACC,UAAU,CAACN,YAAY,CAAC,mCAAII,qCAA6B;AAAA;AAA5FA,4BAAoB;AAEpBA,iCAAyB,GAAGJ,YAAY,CAACO,QAAQ","names":["rowIdContext","React","createContext","undefined","exports","useTableRowIdContext","useContext","Provider"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/contexts/rowIdContext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { TableRowId } from '../hooks/';\n\nconst rowIdContext = React.createContext<TableRowId | undefined>(undefined);\n\nexport const tableRowIdContextDefaultValue = '';\n\nexport const useTableRowIdContext = () => React.useContext(rowIdContext) ?? tableRowIdContextDefaultValue;\n\nexport const TableRowIdContextProvider = rowIdContext.Provider;\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createTableColumn = void 0;
|
|
7
7
|
const defaultCompare = () => 0;
|
|
8
8
|
const defaultRenderCell = () => {
|
|
9
9
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -24,7 +24,7 @@ const defaultRenderHeaderCell = () => {
|
|
|
24
24
|
* @param options - column definition options
|
|
25
25
|
* @returns - column definition with defaults
|
|
26
26
|
*/
|
|
27
|
-
function
|
|
27
|
+
function createTableColumn(options) {
|
|
28
28
|
const {
|
|
29
29
|
columnId,
|
|
30
30
|
renderCell = defaultRenderCell,
|
|
@@ -38,5 +38,5 @@ function createColumn(options) {
|
|
|
38
38
|
compare
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
exports.
|
|
41
|
+
exports.createTableColumn = createTableColumn;
|
|
42
42
|
//# sourceMappingURL=createColumn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;AAEA,MAAMA,cAAc,GAAG,MAAM,CAAC;AAE9B,MAAMC,iBAAiB,GAAG,MAAK;EAC7B,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACAC,OAAO,CAACC,IAAI,CAAC,+FAA+F,CAAC;;EAG/G,OAAO,IAAI;AACb,CAAC;AAED,MAAMC,uBAAuB,GAAG,MAAK;EACnC,IAAIL,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACAC,OAAO,CAACC,IAAI,CAAC,qGAAqG,CAAC;;EAGrH,OAAO,IAAI;AACb,CAAC;AAED;;;;;AAKA,SAAgBE,
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAEA,MAAMA,cAAc,GAAG,MAAM,CAAC;AAE9B,MAAMC,iBAAiB,GAAG,MAAK;EAC7B,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACAC,OAAO,CAACC,IAAI,CAAC,+FAA+F,CAAC;;EAG/G,OAAO,IAAI;AACb,CAAC;AAED,MAAMC,uBAAuB,GAAG,MAAK;EACnC,IAAIL,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACAC,OAAO,CAACC,IAAI,CAAC,qGAAqG,CAAC;;EAGrH,OAAO,IAAI;AACb,CAAC;AAED;;;;;AAKA,SAAgBE,iBAAiB,CAAQC,OAAwC;EAC/E,MAAM;IACJC,QAAQ;IACRC,UAAU,GAAGV,iBAAiB;IAC9BW,gBAAgB,GAAGL,uBAAuB;IAC1CM,OAAO,GAAGb;EAAc,CACzB,GAAGS,OAAO;EAEX,OAAO;IACLC,QAAQ;IACRC,UAAU;IACVC,gBAAgB;IAChBC;GACD;AACH;AAdAC","names":["defaultCompare","defaultRenderCell","process","env","NODE_ENV","console","warn","defaultRenderHeaderCell","createTableColumn","options","columnId","renderCell","renderHeaderCell","compare","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/hooks/createColumn.ts"],"sourcesContent":["import { CreateTableColumnOptions } from './types';\n\nconst defaultCompare = () => 0;\n\nconst defaultRenderCell = () => {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn('@fluentui/react-table: You are using the default column renderCell function that renders null');\n }\n\n return null;\n};\n\nconst defaultRenderHeaderCell = () => {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.warn('@fluentui/react-table: You are using the default column renderHeaderCell function that renders null');\n }\n\n return null;\n};\n\n/**\n * Helper function to create column definition with defaults\n * @param options - column definition options\n * @returns - column definition with defaults\n */\nexport function createTableColumn<TItem>(options: CreateTableColumnOptions<TItem>) {\n const {\n columnId,\n renderCell = defaultRenderCell,\n renderHeaderCell = defaultRenderHeaderCell,\n compare = defaultCompare,\n } = options;\n\n return {\n columnId,\n renderCell,\n renderHeaderCell,\n compare,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;
|
|
1
|
+
{"version":3,"mappings":";;;;;;AAQA;AACA;AAEA,MAAMA,kBAAkB,GAAgDC,GAAG,IAAIA,GAAG;AAErEC,yBAAiB,GAAgC;EAC5DC,SAAS,EAAEC,8CAA0B;EACrCC,IAAI,EAAEC,oCAAqB;EAC3BC,OAAO,EAAE,MAAM,EAAE;EACjBC,QAAQ,EAAE,MAAM,EAAE;EAClBC,KAAK,EAAE,EAAE;EACTC,OAAO,EAAE;CACV;AAED,SAAgBC,gBAAgB,CAC9BC,OAAuC,EACvCC,UAAgC,EAAE;EAElC,MAAM;IAAEJ,KAAK;IAAED,QAAQ;IAAEE;EAAO,CAAE,GAAGE,OAAO;EAE5C,MAAML,OAAO,GAAG,CACdO,cAAcd,kBAAmD,KAC9DS,KAAK,CAACM,GAAG,CAAC,CAACC,IAAI,EAAEC,CAAC,KAAI;IAAA;IAAC,kBAAW,CAAC;MAAED,IAAI;MAAEE,KAAK,EAAE,cAAQ,aAARV,QAAQ,uBAARA,QAAQ,CAAGQ,IAAI,CAAC,mCAAIC;IAAC,CAAE,CAAC;EAAA,EAAC;EAEhF,MAAME,YAAY,GAA8B;IAC9CX,QAAQ;IACRC,KAAK;IACLC,OAAO;IACPH,OAAO;IACPJ,SAAS,EAAEC,8CAA0B;IACrCC,IAAI,EAAEC;GACP;EAED,OAAOO,OAAO,CAACO,MAAM,CAAC,CAACC,KAAK,EAAEC,MAAM,KAAKA,MAAM,CAACD,KAAK,CAAC,EAAEF,YAAY,CAAC;AACvE;AApBAjB","names":["defaultRowEnhancer","row","exports","selection","useTableSelection_1","sort","useTableSort_1","getRows","getRowId","items","columns","useTableFeatures","options","plugins","rowEnhancer","map","item","i","rowId","initialState","reduce","state","plugin"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/hooks/useTableFeatures.ts"],"sourcesContent":["import type {\n UseTableFeaturesOptions,\n TableFeaturesState,\n TableRowData,\n RowEnhancer,\n TableFeaturePlugin,\n TableSortState,\n} from './types';\nimport { defaultTableSelectionState } from './useTableSelection';\nimport { defaultTableSortState } from './useTableSort';\n\nconst defaultRowEnhancer: RowEnhancer<unknown, TableRowData<unknown>> = row => row;\n\nexport const defaultTableState: TableFeaturesState<unknown> = {\n selection: defaultTableSelectionState,\n sort: defaultTableSortState,\n getRows: () => [],\n getRowId: () => '',\n items: [],\n columns: [],\n};\n\nexport function useTableFeatures<TItem>(\n options: UseTableFeaturesOptions<TItem>,\n plugins: TableFeaturePlugin[] = [],\n): TableFeaturesState<TItem> {\n const { items, getRowId, columns } = options;\n\n const getRows = <TRowState extends TableRowData<TItem>>(\n rowEnhancer = defaultRowEnhancer as RowEnhancer<TItem, TRowState>,\n ) => items.map((item, i) => rowEnhancer({ item, rowId: getRowId?.(item) ?? i }));\n\n const initialState: TableFeaturesState<TItem> = {\n getRowId,\n items,\n columns,\n getRows,\n selection: defaultTableSelectionState,\n sort: defaultTableSortState as TableSortState<TItem>,\n };\n\n return plugins.reduce((state, plugin) => plugin(state), initialState);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AAGA,MAAMA,IAAI,GAAG,MAAMC,SAAS;AAEfC,kCAA0B,GAAwB;EAC7DC,eAAe,EAAE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AC;EAE9C,OAAO;IACL,GAAGP,UAAU;IACb4B,SAAS,EAAE;MACT/B,aAAa;MACbH,gBAAgB,EAAEa,QAAQ,CAACsB,IAAI,GAAG,CAAC;MACnC1C,eAAe,EAAEU,aAAa,KAAK,QAAQ,GAAGU,QAAQ,CAACsB,IAAI,GAAG,CAAC,GAAGtB,QAAQ,CAACsB,IAAI,KAAK3B,KAAK,CAAC4B,MAAM;MAChGtC,YAAY,EAAEe,QAAQ;MACtBX,SAAS;MACTD,aAAa;MACbP,SAAS,EAAEyB,gBAAgB,CAACkB,UAAU;MACtC1C,WAAW;MACXE,SAAS;MACTD;;GAEH;AACH;AA5DAJ","names":["noop","undefined","exports","allRowsSelected","clearRows","deselectRow","isRowSelected","selectRow","selectedRows","Set","someRowsSelected","toggleAllRows","toggleRow","selectionMode","useTableSelection","options","tableState","useTableSelectionState","items","getRowId","defaultSelectedItems","selectedItems","onSelectionChange","selected","setSelected","react_utilities_1","initialState","defaultState","state","selectionManager","React","useMemo","selectionManager_1","e","newSelectedItems","toggleAllItems","map","item","i","rowId","toggleItem","deselectItem","selectItem","isSelected","selection","size","length","clearItems"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/hooks/useTableSelection.ts"],"sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport { createSelectionManager } from './selectionManager';\nimport type { TableRowId, TableSelectionState, TableFeaturesState, UseTableSelectionOptions } from './types';\n\nconst noop = () => undefined;\n\nexport const defaultTableSelectionState: TableSelectionState = {\n allRowsSelected: false,\n clearRows: noop,\n deselectRow: noop,\n isRowSelected: () => false,\n selectRow: noop,\n selectedRows: new Set(),\n someRowsSelected: false,\n toggleAllRows: noop,\n toggleRow: noop,\n selectionMode: 'multiselect',\n};\n\nexport function useTableSelection<TItem>(options: UseTableSelectionOptions) {\n // False positive, these plugin hooks are intended to be run on every render\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return (tableState: TableFeaturesState<TItem>) => useTableSelectionState(tableState, options);\n}\n\nexport function useTableSelectionState<TItem>(\n tableState: TableFeaturesState<TItem>,\n options: UseTableSelectionOptions,\n): TableFeaturesState<TItem> {\n const { items, getRowId } = tableState;\n const { selectionMode, defaultSelectedItems, selectedItems, onSelectionChange } = options;\n\n const [selected, setSelected] = useControllableState({\n initialState: new Set<TableRowId>(),\n defaultState: defaultSelectedItems,\n state: selectedItems,\n });\n\n const selectionManager = React.useMemo(() => {\n return createSelectionManager(selectionMode, (e, newSelectedItems) => {\n setSelected(() => {\n onSelectionChange?.(e as React.SyntheticEvent, { selectedItems: newSelectedItems });\n return newSelectedItems;\n });\n });\n }, [onSelectionChange, selectionMode, setSelected]);\n\n const toggleAllRows: TableSelectionState['toggleAllRows'] = useEventCallback(e => {\n selectionManager.toggleAllItems(\n e,\n items.map((item, i) => getRowId?.(item) ?? i),\n selected,\n );\n });\n\n const toggleRow: TableSelectionState['toggleRow'] = useEventCallback((e, rowId: TableRowId) =>\n selectionManager.toggleItem(e, rowId, selected),\n );\n\n const deselectRow: TableSelectionState['deselectRow'] = useEventCallback((e, rowId: TableRowId) =>\n selectionManager.deselectItem(e, rowId, selected),\n );\n\n const selectRow: TableSelectionState['selectRow'] = useEventCallback((e, rowId: TableRowId) =>\n selectionManager.selectItem(e, rowId, selected),\n );\n\n const isRowSelected: TableSelectionState['isRowSelected'] = (rowId: TableRowId) =>\n selectionManager.isSelected(rowId, selected);\n\n return {\n ...tableState,\n selection: {\n selectionMode,\n someRowsSelected: selected.size > 0,\n allRowsSelected: selectionMode === 'single' ? selected.size > 0 : selected.size === items.length,\n selectedRows: selected,\n toggleRow,\n toggleAllRows,\n clearRows: selectionManager.clearItems,\n deselectRow,\n selectRow,\n isRowSelected,\n },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":";;;;;;AACA;
|
|
1
|
+
{"version":3,"mappings":";;;;;;AACA;AAUA,MAAMA,IAAI,GAAG,MAAMC,SAAS;AAEfC,6BA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OA,QAAQ;IACjB,CAAC,CAAC;EACJ,CAAC;EAED,MAAMvB,aAAa,GAA2C,CAACoB,CAAC,EAAEI,cAAc,EAAEC,iBAAiB,KAAI;IACrG,MAAMF,QAAQ,GAAG;MAAEpB,UAAU,EAAEqB,cAAc;MAAEpB,aAAa,EAAEqB;IAAiB,CAAE;IACjFZ,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAGO,CAAC,EAAEG,QAAQ,CAAC;IAC3BR,SAAS,CAACQ,QAAQ,CAAC;EACrB,CAAC;EAED,MAAMtB,IAAI,GAA2CC,IAAiB,IAAI;IACxE,OAAOA,IAAI,CAACwB,KAAK,EAAE,CAACzB,IAAI,CAAC,CAAC0B,CAAC,EAAEC,CAAC,KAAI;MAChC,MAAMC,aAAa,GAAGnB,OAAO,CAACoB,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACV,QAAQ,KAAKlB,UAAU,CAAC;MAC5E,IAAI,EAAC0B,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEG,OAAO,GAAE;QAC3B,OAAO,CAAC;;MAGV,MAAMC,GAAG,GAAG7B,aAAa,KAAK,WAAW,GAAG,CAAC,GAAG,CAAC,CAAC;MAClD,OAAOyB,aAAa,CAACG,OAAO,CAACL,CAAC,CAACO,IAAI,EAAEN,CAAC,CAACM,IAAI,CAAC,GAAGD,GAAG;IACpD,CAAC,CAAC;EACJ,CAAC;EAED,MAAMlC,gBAAgB,GAA+CsB,QAAuB,IAAI;IAC9F,OAAOlB,UAAU,KAAKkB,QAAQ,GAAGjB,aAAa,GAAGP,SAAS;EAC5D,CAAC;EAED,OAAO;IACL,GAAGW,UAAU;IACbP,IAAI,EAAE;MACJA,IAAI;MACJE,UAAU;MACVC,aAAa;MACbJ,aAAa;MACbK,gBAAgB;MAChBN;;GAEH;AACH;AAjEAD","names":["noop","undefined","exports","getSortDirection","setColumnSort","sort","rows","sortColumn","sortDirection","toggleColumnSort","useTableSort","options","tableState","useTableSortState","columns","sortState","defaultSortState","onSortChange","sorted","setSorted","react_utilities_1","initialState","defaultState","state","e","columnId","s","newState","nextSortColumn","nextSortDirection","slice","a","b","sortColumnDef","find","column","compare","mod","item"],"sourceRoot":"../src/","sources":["packages/react-components/react-table/src/hooks/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"]}
|