@jielga/tmdatagrid 2.0.0 → 2.1.0
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/dist/index.d.ts +11 -1
- package/dist/index.js +673 -670
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/docs/columns.md +2 -1
- package/docs/row-details.md +15 -6
- package/docs/styling.md +2 -1
- package/docs/use-tm-data-grid.md +4 -1
- package/package.json +1 -1
- package/skills/appearance/SKILL.md +3 -1
- package/skills/cell-selection/SKILL.md +5 -3
- package/skills/columns/SKILL.md +43 -43
- package/skills/columns/references/columns-api.md +59 -0
- package/skills/data/SKILL.md +27 -3
- package/skills/editing/SKILL.md +10 -3
- package/skills/editing/references/editing-api.md +5 -3
- package/skills/editing/references/editors-and-validation.md +56 -1
- package/skills/filtering/SKILL.md +11 -5
- package/skills/getting-started/SKILL.md +103 -5
- package/skills/grouping/SKILL.md +1 -1
- package/skills/migrating-to-2/SKILL.md +244 -0
- package/skills/options/SKILL.md +18 -6
- package/skills/rows/SKILL.md +9 -8
- package/skills/rows/references/rows-api.md +14 -8
- package/skills/server-side/SKILL.md +1 -1
- package/skills/testing/SKILL.md +1 -1
- package/skills/testing-components/SKILL.md +1 -1
- package/skills/testing-editing/SKILL.md +1 -1
- package/src/components/TMDataGrid.module.css +5 -0
- package/src/components/TMDataGridHeaderCell.module.css +1 -1
- package/src/components/generatedColumns.tsx +8 -6
- package/src/useTMDataGrid.tsx +64 -58
|
@@ -6,7 +6,7 @@ Reference for the `rows` skill.
|
|
|
6
6
|
|
|
7
7
|
| Name | Kind | Type | Default | What it does |
|
|
8
8
|
| --- | --- | --- | --- | --- |
|
|
9
|
-
| `selectionMode` | Option | `"checkbox" \| "row" \| "checkboxAndHighlight" \| "highlight"` | `"checkbox"` | What selecting looks like and what a row click does. |
|
|
9
|
+
| `selectionMode` | Option | `TMDataGridSelectionMode`: `"checkbox" \| "row" \| "checkboxAndHighlight" \| "highlight"` | `"checkbox"` | What selecting looks like and what a row click does. |
|
|
10
10
|
| `enableRowSelection` | Table option | `boolean \| ((row) => boolean)` | `true` | `false` removes the checkbox column and row-click selection. |
|
|
11
11
|
| `enableMultiRowSelection` | Table option | `boolean` | `true` | `false` limits the selection to one row and drops group checkboxes. |
|
|
12
12
|
| `showSelectedBackground` | Option | `boolean` | Follows the mode | Whether selected rows take a background tint. |
|
|
@@ -14,7 +14,8 @@ Reference for the `rows` skill.
|
|
|
14
14
|
| `onHighlightedRowChange` | Callback | `(rowId: string \| null) => void` | – | Fires when the highlight moves. |
|
|
15
15
|
| `SELECT_COLUMN_ID` | Export | `"__select__"` | – | Id of the generated checkbox column. |
|
|
16
16
|
| `getSelectableRowIds` | Export | `(table) => string[]` | – | Ids the header checkbox would select. |
|
|
17
|
-
| `resolveRowSelectionClick` | Export | `(args) => ResolvedRowSelection` | – | The desktop-list click rules, for a custom surface. |
|
|
17
|
+
| `resolveRowSelectionClick` | Export | `(args: ResolveRowSelectionClickArgs) => ResolvedRowSelection` | – | The desktop-list click rules, for a custom surface. |
|
|
18
|
+
| `ResolveRowSelectionClickArgs` · `TMDataGridRowClickModifiers` | Types | `{ rows, rowId, anchorRowId, modifiers, selection }` · `{ toggle, extend }` | – | What `resolveRowSelectionClick` takes, and its `modifiers`. |
|
|
18
19
|
| `getDisplayedRows` | Export | `(table) => Row[]` | – | The rows currently on screen, paging respected. |
|
|
19
20
|
| `isPagingActive` | Export | `(table) => boolean` | – | Whether a pager is in play. |
|
|
20
21
|
|
|
@@ -31,11 +32,13 @@ All are props of `TMDataGrid.Table`, not hook options.
|
|
|
31
32
|
| `onCellClick` | `(args) => void` | Cell click. `args` is `TMDataGridCellEventArgs`. |
|
|
32
33
|
| `onCellDoubleClick` | `(args) => void` | Cell double-click. |
|
|
33
34
|
| `onCellContextMenu` | `(args) => void` | Cell right-click. |
|
|
34
|
-
| `renderRowContextMenu` | `(
|
|
35
|
-
| `renderColumnMenuItems` | `(
|
|
35
|
+
| `renderRowContextMenu` | `TMDataGridRowContextMenuRenderer`: `(args: TMDataGridRowContextMenuArgs) => ReactNode` | Contents of the row's context menu. `null` for no menu. Reading `internalItems` hands the composition over. |
|
|
36
|
+
| `renderColumnMenuItems` | `TMDataGridColumnMenuItemsRenderer`: `(args: TMDataGridColumnMenuItemsArgs) => ReactNode[]` | Contents of a column's menu. An empty list removes the button. |
|
|
36
37
|
| `rowContextMenuProps` | `MenuProps` | Passed to the Mantine `Menu` unchanged, apart from its open state. |
|
|
37
38
|
|
|
38
|
-
`TMDataGridCellEventArgs` is `{ cell, row, column, event }`.
|
|
39
|
+
`TMDataGridCellEventArgs` is `{ cell, row, column, event }`.
|
|
40
|
+
`TMDataGridRowContextMenuArgs` is `{ table, row, cell, close, internalItems }`,
|
|
41
|
+
and `TMDataGridColumnMenuItemsArgs` is `{ column, table, internalItems }`. The context-menu
|
|
39
42
|
slot's `cell` is `null` only when a custom cell renderer stopped the
|
|
40
43
|
event. One `Menu` serves the whole body rather than one per row: a closed
|
|
41
44
|
Mantine `Popover` still runs its hooks on every render, and the virtualized body
|
|
@@ -76,13 +79,15 @@ Row data attributes:
|
|
|
76
79
|
|
|
77
80
|
| Name | Kind | Type | Default | What it does |
|
|
78
81
|
| --- | --- | --- | --- | --- |
|
|
79
|
-
| `renderDetails` | Option | `(
|
|
82
|
+
| `renderDetails` | Option | `TMDataGridDetailsRenderer`: `(args: TMDataGridDetailsArgs) => ReactNode` | – | Contents of the panel. Setting it adds the lane. `TMDataGridDetailsArgs` is `{ row, table }`. |
|
|
80
83
|
| `renderDetailsEstHeight` | Option | `number` | `160` | Height the virtualizer assumes for an unmeasured panel. |
|
|
84
|
+
| `detailsColumnPosition` | Option | `"left" \| "right"` | `"left"` | Which edge the lane is pinned to. `"right"` places it after every column, inside the edit lane. |
|
|
81
85
|
| `initialState.expanded` | Table option | `ExpandedState` | `{}` | Rows open at mount. A `data` slice, so it persists. |
|
|
82
|
-
| `autoResetExpanded` | Table option | `boolean` | `
|
|
86
|
+
| `autoResetExpanded` | Table option | `boolean` | `false` | `true` closes the panels when the `data` array changes. Off by default, so a draft commit keeps them open. |
|
|
83
87
|
| `DETAILS_COLUMN_ID` | Export | `"__details__"` | – | Id of the generated chevron column. |
|
|
84
88
|
| `resolveExpandAll` | Export | `(args) => ExpandedState` | – | Expand or collapse every group, or every panel, but not both. |
|
|
85
89
|
| `areAllRowsExpanded` | Export | `(args) => boolean` | – | Whether every row of one target is open. |
|
|
90
|
+
| `TMDataGridExpandAllArgs` · `TMDataGridExpandTarget` | Types | `{ rows, expanded, target }` · `"groups" \| "details"` | – | What `areAllRowsExpanded` takes (`resolveExpandAll` also takes `expand`), and its `target`. |
|
|
86
91
|
| `data-dg-part="details"` | Data attribute | – | – | The panel element, carrying the row's `data-row-id`. |
|
|
87
92
|
|
|
88
93
|
One `expanded` state opens two unrelated things - a group row into its children,
|
|
@@ -115,4 +120,5 @@ table.setExpanded(
|
|
|
115
120
|
| `ROW_NUMBER_COLUMN_ID` | Export | `"__rowNumber__"` | – | Id of the generated number gutter. |
|
|
116
121
|
|
|
117
122
|
Lane order, left to right: row number, checkbox, tree, details, your columns,
|
|
118
|
-
edit.
|
|
123
|
+
edit. Under `detailsColumnPosition: "right"`, details sits between your columns
|
|
124
|
+
and edit.
|
|
@@ -15,7 +15,7 @@ description: >
|
|
|
15
15
|
metadata:
|
|
16
16
|
type: core
|
|
17
17
|
library: '@jielga/tmdatagrid'
|
|
18
|
-
library_version: '2.
|
|
18
|
+
library_version: '2.1.0'
|
|
19
19
|
sources:
|
|
20
20
|
- 'Jielga/TMDataGrid:packages/tmdatagrid/docs/server-side.md'
|
|
21
21
|
- 'Jielga/TMDataGrid:packages/tmdatagrid/docs/server-query.md'
|
package/skills/testing/SKILL.md
CHANGED
|
@@ -12,7 +12,7 @@ description: >
|
|
|
12
12
|
metadata:
|
|
13
13
|
type: core
|
|
14
14
|
library: '@jielga/tmdatagrid'
|
|
15
|
-
library_version: '2.
|
|
15
|
+
library_version: '2.1.0'
|
|
16
16
|
sources:
|
|
17
17
|
- 'Jielga/TMDataGrid:packages/tmdatagrid/docs/testing.md'
|
|
18
18
|
- 'Jielga/TMDataGrid:packages/tmdatagrid/test/gallery/main.tsx'
|
|
@@ -12,7 +12,7 @@ description: >
|
|
|
12
12
|
metadata:
|
|
13
13
|
type: core
|
|
14
14
|
library: '@jielga/tmdatagrid'
|
|
15
|
-
library_version: '2.
|
|
15
|
+
library_version: '2.1.0'
|
|
16
16
|
sources:
|
|
17
17
|
- 'Jielga/TMDataGrid:packages/tmdatagrid/docs/testing.md'
|
|
18
18
|
- 'Jielga/TMDataGrid:packages/tmdatagrid/docs/editing.md'
|
|
@@ -51,6 +51,11 @@
|
|
|
51
51
|
--dg-header-height: 44px;
|
|
52
52
|
--dg-font-size: var(--mantine-font-size-sm);
|
|
53
53
|
--dg-padding: 10px;
|
|
54
|
+
/* The header's font size. Resolved on the root, so it follows whatever
|
|
55
|
+
`--dg-font-size` the scale or an override gives the cells, until set on
|
|
56
|
+
its own:
|
|
57
|
+
<TMDataGrid style={{ "--dg-header-font-size": "var(--mantine-font-size-md)" }} /> */
|
|
58
|
+
--dg-header-font-size: var(--dg-font-size);
|
|
54
59
|
/* Background of a selected row, when `showSelectedBackground` is on. Override
|
|
55
60
|
it on the grid:
|
|
56
61
|
<TMDataGrid style={{ "--dg-row-selected-bg": "var(--mantine-color-blue-0)" }} /> */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
min-width: 0;
|
|
8
8
|
min-height: var(--dg-header-height);
|
|
9
9
|
font-weight: 600;
|
|
10
|
-
font-size: var(--dg-font-size);
|
|
10
|
+
font-size: var(--dg-header-font-size);
|
|
11
11
|
background-color: var(--mantine-color-body);
|
|
12
12
|
border-bottom: 1px solid var(--mantine-color-default-border);
|
|
13
13
|
user-select: none;
|
|
@@ -100,13 +100,15 @@ export function createGroupColumn<TData extends RowData>(
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* The generated details lane,
|
|
103
|
+
* The generated details lane, added whenever `renderDetails` is set.
|
|
104
104
|
*
|
|
105
105
|
* Structural, like the checkbox and tree columns: fixed width, pinned to the
|
|
106
|
-
*
|
|
107
|
-
* or hiding the toggle would leave rows with panels that
|
|
106
|
+
* edge `detailsColumnPosition` names, not hideable, not movable and not
|
|
107
|
+
* resizable. Moving or hiding the toggle would leave rows with panels that
|
|
108
|
+
* cannot be opened.
|
|
108
109
|
*
|
|
109
|
-
*
|
|
110
|
+
* Innermost on its edge - last of the left lanes, or first of the right ones,
|
|
111
|
+
* inside the edit lane - because it acts on a single record.
|
|
110
112
|
*
|
|
111
113
|
* A second toggle elsewhere is supported: `row.toggleExpanded()` is the entire
|
|
112
114
|
* interface, and this lane is only the control the grid ships.
|
|
@@ -119,7 +121,7 @@ export function createDetailsColumn<TData extends RowData>(
|
|
|
119
121
|
meta: {
|
|
120
122
|
label,
|
|
121
123
|
align: "center",
|
|
122
|
-
// Structurally the
|
|
124
|
+
// Structurally the innermost of the generated lanes.
|
|
123
125
|
enableOrdering: false,
|
|
124
126
|
},
|
|
125
127
|
// A system lane: as wide as the control it holds and no wider. Fixed at
|
|
@@ -135,7 +137,7 @@ export function createDetailsColumn<TData extends RowData>(
|
|
|
135
137
|
// Its visibility is not the user's to set: hiding it would strand every
|
|
136
138
|
// panel behind a control that is no longer there.
|
|
137
139
|
enableHiding: false,
|
|
138
|
-
// Structurally pinned to
|
|
140
|
+
// Structurally pinned to its edge; users shouldn't be able to move it.
|
|
139
141
|
enablePinning: false,
|
|
140
142
|
header: ({ table }) => <DetailsHeader table={table} />,
|
|
141
143
|
cell: ({ row }) => <DetailsCell row={row} />,
|
package/src/useTMDataGrid.tsx
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
columnGroupingFeature,
|
|
13
13
|
columnOrderingFeature,
|
|
14
14
|
columnPinningFeature,
|
|
15
|
+
type ColumnPinningState,
|
|
15
16
|
columnResizingFeature,
|
|
16
17
|
columnSizingFeature,
|
|
17
18
|
columnVisibilityFeature,
|
|
@@ -77,7 +78,11 @@ import {
|
|
|
77
78
|
type TMDataGridColumnType,
|
|
78
79
|
tmDataGridFilterFn,
|
|
79
80
|
} from "./core/filterOperators";
|
|
80
|
-
import {
|
|
81
|
+
import {
|
|
82
|
+
getColumnDefaultOperator,
|
|
83
|
+
isControlColumn,
|
|
84
|
+
isGeneratedColumn,
|
|
85
|
+
} from "./core/columnUtils";
|
|
81
86
|
import type { TMDataGridColumnFilterOptions } from "./core/filterControls";
|
|
82
87
|
import {
|
|
83
88
|
resolveFilterOptions,
|
|
@@ -1050,6 +1055,16 @@ export type UseTMDataGridOptions<TData extends RowData> = Omit<
|
|
|
1050
1055
|
* state. An approximate value is enough.
|
|
1051
1056
|
*/
|
|
1052
1057
|
renderDetailsEstHeight?: number;
|
|
1058
|
+
/**
|
|
1059
|
+
* Which edge the details lane sits on. Defaults to `"left"`.
|
|
1060
|
+
*
|
|
1061
|
+
* `"left"` pins the chevron after the row number, checkbox and tree lanes,
|
|
1062
|
+
* before every column of yours. `"right"` pins it after every column of
|
|
1063
|
+
* yours, inside the edit lane, so the chevron closes the row the way an
|
|
1064
|
+
* accordion's does. On either edge it stays a structural lane: the user
|
|
1065
|
+
* cannot move, hide or unpin it.
|
|
1066
|
+
*/
|
|
1067
|
+
detailsColumnPosition?: "left" | "right";
|
|
1053
1068
|
/**
|
|
1054
1069
|
* Rows the virtualizer keeps mounted above and below the viewport. Defaults
|
|
1055
1070
|
* to 6.
|
|
@@ -1149,6 +1164,7 @@ export function useTMDataGrid<TData extends RowData>({
|
|
|
1149
1164
|
editing,
|
|
1150
1165
|
renderDetails,
|
|
1151
1166
|
renderDetailsEstHeight = DEFAULT_DETAILS_EST_HEIGHT,
|
|
1167
|
+
detailsColumnPosition = "left",
|
|
1152
1168
|
overscan = DEFAULT_OVERSCAN,
|
|
1153
1169
|
...options
|
|
1154
1170
|
}: UseTMDataGridOptions<TData>): TMDataGridApi<TData> {
|
|
@@ -1250,6 +1266,35 @@ export function useTMDataGrid<TData extends RowData>({
|
|
|
1250
1266
|
// rest hold two - it gets the wider track.
|
|
1251
1267
|
const editWideLane = editDraft;
|
|
1252
1268
|
|
|
1269
|
+
// The generated lanes are structurally pinned, outermost first on each edge,
|
|
1270
|
+
// and re-applied on top of anything restored: a snapshot cannot unpin one,
|
|
1271
|
+
// and a snapshot taken before `detailsColumnPosition` changed cannot pin the
|
|
1272
|
+
// details lane to the edge it has since left.
|
|
1273
|
+
const structuralPinning = (
|
|
1274
|
+
restored: Partial<ColumnPinningState> | undefined,
|
|
1275
|
+
): ColumnPinningState => {
|
|
1276
|
+
const own = (ids: string[] | undefined) =>
|
|
1277
|
+
(ids ?? []).filter((id) => !isGeneratedColumn(id));
|
|
1278
|
+
const lane = (enabled: boolean, id: string) =>
|
|
1279
|
+
enabled && pinningEnabled ? [id] : [];
|
|
1280
|
+
const detailsOn = (edge: "left" | "right") =>
|
|
1281
|
+
detailsColumnEnabled && detailsColumnPosition === edge;
|
|
1282
|
+
return {
|
|
1283
|
+
start: [
|
|
1284
|
+
...lane(rowNumbersEnabled, ROW_NUMBER_COLUMN_ID),
|
|
1285
|
+
...lane(selectColumnEnabled, SELECT_COLUMN_ID),
|
|
1286
|
+
...lane(groupColumnEnabled, GROUP_COLUMN_ID),
|
|
1287
|
+
...lane(detailsOn("left"), DETAILS_COLUMN_ID),
|
|
1288
|
+
...own(restored?.start),
|
|
1289
|
+
],
|
|
1290
|
+
end: [
|
|
1291
|
+
...own(restored?.end),
|
|
1292
|
+
...lane(detailsOn("right"), DETAILS_COLUMN_ID),
|
|
1293
|
+
...lane(editColumnEnabled, EDIT_COLUMN_ID),
|
|
1294
|
+
],
|
|
1295
|
+
};
|
|
1296
|
+
};
|
|
1297
|
+
|
|
1253
1298
|
const columns = useMemo(() => {
|
|
1254
1299
|
const base = withTMDataGridDefaults<TData>(
|
|
1255
1300
|
options.columns as ReadonlyArray<TMDataGridColumnDef<TData>>,
|
|
@@ -1262,8 +1307,12 @@ export function useTMDataGrid<TData extends RowData>({
|
|
|
1262
1307
|
//
|
|
1263
1308
|
// The order is the order they are pinned in, and it follows what each one
|
|
1264
1309
|
// is about: tick a row, find it in the tree the user grouped it into, then
|
|
1265
|
-
// open it. The details chevron sits
|
|
1266
|
-
//
|
|
1310
|
+
// open it. The details chevron sits innermost on whichever edge it was
|
|
1311
|
+
// given - last of the left lanes, or first of the right ones - because it
|
|
1312
|
+
// acts on the record the lanes outside it have narrowed down to.
|
|
1313
|
+
const detailsColumn = detailsColumnEnabled
|
|
1314
|
+
? [createDetailsColumn<TData>(detailsColumnLabel)]
|
|
1315
|
+
: [];
|
|
1267
1316
|
return [
|
|
1268
1317
|
// The gutter sits outside everything, the way a spreadsheet's does.
|
|
1269
1318
|
...(rowNumbersEnabled
|
|
@@ -1273,10 +1322,9 @@ export function useTMDataGrid<TData extends RowData>({
|
|
|
1273
1322
|
? [createSelectColumn<TData>(selectColumnLabel)]
|
|
1274
1323
|
: []),
|
|
1275
1324
|
...(groupColumnEnabled ? [createGroupColumn<TData>(groupColumnLabel)] : []),
|
|
1276
|
-
...(
|
|
1277
|
-
? [createDetailsColumn<TData>(detailsColumnLabel)]
|
|
1278
|
-
: []),
|
|
1325
|
+
...(detailsColumnPosition === "left" ? detailsColumn : []),
|
|
1279
1326
|
...base,
|
|
1327
|
+
...(detailsColumnPosition === "right" ? detailsColumn : []),
|
|
1280
1328
|
// Last and pinned right - the row's Save belongs at the end of the row.
|
|
1281
1329
|
...(editColumnEnabled
|
|
1282
1330
|
? [createEditColumn<TData>(editColumnLabel, editWideLane)]
|
|
@@ -1287,6 +1335,7 @@ export function useTMDataGrid<TData extends RowData>({
|
|
|
1287
1335
|
rowNumbersEnabled,
|
|
1288
1336
|
selectColumnEnabled,
|
|
1289
1337
|
detailsColumnEnabled,
|
|
1338
|
+
detailsColumnPosition,
|
|
1290
1339
|
groupColumnEnabled,
|
|
1291
1340
|
editColumnEnabled,
|
|
1292
1341
|
editWideLane,
|
|
@@ -1619,37 +1668,14 @@ export function useTMDataGrid<TData extends RowData>({
|
|
|
1619
1668
|
? { [GROUP_COLUMN_ID]: initialGrouping.length > 0 }
|
|
1620
1669
|
: {}),
|
|
1621
1670
|
},
|
|
1622
|
-
columnPinning: {
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
...(
|
|
1631
|
-
persistedState.columnPinning?.start ??
|
|
1632
|
-
options.initialState?.columnPinning?.start ??
|
|
1633
|
-
[]
|
|
1634
|
-
).filter(
|
|
1635
|
-
(id) =>
|
|
1636
|
-
id !== ROW_NUMBER_COLUMN_ID &&
|
|
1637
|
-
id !== SELECT_COLUMN_ID &&
|
|
1638
|
-
id !== DETAILS_COLUMN_ID &&
|
|
1639
|
-
id !== GROUP_COLUMN_ID,
|
|
1640
|
-
),
|
|
1641
|
-
],
|
|
1642
|
-
// The edit lane mirrors the generated columns on the left: structurally
|
|
1643
|
-
// pinned, outermost, re-applied over anything restored.
|
|
1644
|
-
end: [
|
|
1645
|
-
...(
|
|
1646
|
-
persistedState.columnPinning?.end ??
|
|
1647
|
-
options.initialState?.columnPinning?.end ??
|
|
1648
|
-
[]
|
|
1649
|
-
).filter((id) => id !== EDIT_COLUMN_ID),
|
|
1650
|
-
...(editColumnEnabled && pinningEnabled ? [EDIT_COLUMN_ID] : []),
|
|
1651
|
-
],
|
|
1652
|
-
},
|
|
1671
|
+
columnPinning: structuralPinning({
|
|
1672
|
+
start:
|
|
1673
|
+
persistedState.columnPinning?.start ??
|
|
1674
|
+
options.initialState?.columnPinning?.start,
|
|
1675
|
+
end:
|
|
1676
|
+
persistedState.columnPinning?.end ??
|
|
1677
|
+
options.initialState?.columnPinning?.end,
|
|
1678
|
+
}),
|
|
1653
1679
|
pagination: {
|
|
1654
1680
|
pageIndex: 0,
|
|
1655
1681
|
pageSize: 25,
|
|
@@ -1964,27 +1990,7 @@ export function useTMDataGrid<TData extends RowData>({
|
|
|
1964
1990
|
});
|
|
1965
1991
|
table.setColumnSizing({ ...initial?.columnSizing });
|
|
1966
1992
|
table.setColumnOrder([...(initial?.columnOrder ?? [])]);
|
|
1967
|
-
table.setColumnPinning(
|
|
1968
|
-
start: [
|
|
1969
|
-
...(rowNumbersEnabled && pinningEnabled ? [ROW_NUMBER_COLUMN_ID] : []),
|
|
1970
|
-
...(selectColumnEnabled && pinningEnabled ? [SELECT_COLUMN_ID] : []),
|
|
1971
|
-
...(groupColumnEnabled && pinningEnabled ? [GROUP_COLUMN_ID] : []),
|
|
1972
|
-
...(detailsColumnEnabled && pinningEnabled ? [DETAILS_COLUMN_ID] : []),
|
|
1973
|
-
...(initial?.columnPinning?.start ?? []).filter(
|
|
1974
|
-
(id) =>
|
|
1975
|
-
id !== ROW_NUMBER_COLUMN_ID &&
|
|
1976
|
-
id !== SELECT_COLUMN_ID &&
|
|
1977
|
-
id !== DETAILS_COLUMN_ID &&
|
|
1978
|
-
id !== GROUP_COLUMN_ID,
|
|
1979
|
-
),
|
|
1980
|
-
],
|
|
1981
|
-
end: [
|
|
1982
|
-
...(initial?.columnPinning?.end ?? []).filter(
|
|
1983
|
-
(id) => id !== EDIT_COLUMN_ID,
|
|
1984
|
-
),
|
|
1985
|
-
...(editColumnEnabled && pinningEnabled ? [EDIT_COLUMN_ID] : []),
|
|
1986
|
-
],
|
|
1987
|
-
});
|
|
1993
|
+
table.setColumnPinning(structuralPinning(initial?.columnPinning));
|
|
1988
1994
|
};
|
|
1989
1995
|
const resetSettings = useCallback(() => resetSettingsRef.current(), []);
|
|
1990
1996
|
|