@jielga/tmdatagrid 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -160,7 +160,7 @@ const { resetSettings } = useTMDataGrid({ data, columns });
160
160
  | Name | Kind | Type | Default | What it does |
161
161
  | --- | --- | --- | --- | --- |
162
162
  | `enableHiding` | Table option | `boolean` | `true` | Also a column option. `false` removes hiding entirely. |
163
- | `enableColumnPinning` | Table option | `boolean` | `true` | `false` removes the pin menu items. |
163
+ | `enableColumnPinning` | Table option | `boolean` | `true` | `false` removes the pin menu items. The generated lanes stay pinned. |
164
164
  | `enablePinning` | Column option | `boolean` | `true` | `false` for one column. |
165
165
  | `enableColumnOrdering` | Option | `boolean` | `true` | Header dragging and the move menu items. Grid-defined. |
166
166
  | `meta.enableOrdering` | Column meta | `boolean` | `true` | `false` keeps one column where it is. |
@@ -36,7 +36,7 @@ rather than forwarded to TanStack.
36
36
  | `enableSorting` | `boolean` | `true` | Enables sorting for the table. |
37
37
  | `enableColumnFilters` | `boolean` | `true` | Enables filtering for the table. |
38
38
  | `enableHiding` | `boolean` | `true` | Enables column visibility for the table. |
39
- | `enableColumnPinning` | `boolean` | `true` | Enables pinning for the table. |
39
+ | `enableColumnPinning` | `boolean` | `true` | Enables pinning for the table. `false` removes the pin menu items; the generated lanes stay pinned. |
40
40
  | `enableColumnResizing` | `boolean` | `true` | Enables resizing for the table. |
41
41
  | `enableColumnOrdering` | `boolean` | `true` | Enables header dragging and the move menu items. Defined by the grid, see [Column layout](/docs/column-layout#ordering). |
42
42
  | `enablePagination` | `boolean` | `false` | Enables client-side paging and the `Footer` pager. Implied by `manualPagination`. Defined by the grid, see [Pagination](/docs/pagination). |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jielga/tmdatagrid",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "A React data grid built on TanStack Table v9 and Mantine - always virtualized, with resizable, reorderable, sortable, filterable, hideable and pinnable columns.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -76,31 +76,31 @@
76
76
  },
77
77
  "devDependencies": {
78
78
  "@babel/core": "^7.29.7",
79
- "@mantine/core": "^9.4.0",
80
- "@rolldown/plugin-babel": "^0.2.3",
79
+ "@mantine/core": "^9.4.2",
80
+ "@rolldown/plugin-babel": "^0.2.4",
81
81
  "@tabler/icons-react": "^3.46.0",
82
82
  "@tanstack/intent": "0.3.6",
83
- "@tanstack/react-form": "^1.33.2",
84
- "@tanstack/react-store": "^0.11.1",
83
+ "@tanstack/react-form": "^1.33.5",
84
+ "@tanstack/react-store": "^0.11.2",
85
85
  "@tanstack/react-table": "^9.2.4",
86
- "@tanstack/react-virtual": "^3.14.4",
87
- "@tanstack/store": "^0.11.1",
86
+ "@tanstack/react-virtual": "^3.14.14",
87
+ "@tanstack/store": "^0.11.2",
88
88
  "@tanstack/table-core": "^9.2.4",
89
89
  "@testing-library/jest-dom": "^7.0.0",
90
90
  "@testing-library/react": "^16.3.2",
91
- "@testing-library/user-event": "^14.6.1",
91
+ "@testing-library/user-event": "^14.6.7",
92
92
  "@types/babel__core": "^7.20.5",
93
- "@types/react": "^19.2.17",
94
- "@types/react-dom": "^19.2.3",
95
- "@vitejs/plugin-react": "^6.0.4",
93
+ "@types/react": "^19.2.18",
94
+ "@types/react-dom": "^19.2.7",
95
+ "@vitejs/plugin-react": "^6.0.5",
96
96
  "babel-plugin-react-compiler": "^1.0.0",
97
97
  "jsdom": "^29.1.1",
98
- "react": "^19.2.7",
99
- "react-dom": "^19.2.7",
98
+ "react": "^19.2.8",
99
+ "react-dom": "^19.2.8",
100
100
  "rolldown": "~1.1.5",
101
101
  "rolldown-plugin-dts": "^0.27.14",
102
102
  "typescript": "~7.0.2",
103
- "vite": "^8.1.5",
103
+ "vite": "^8.1.6",
104
104
  "vitest": "^4.1.10",
105
105
  "zod": "^4.4.3"
106
106
  }
@@ -18,7 +18,7 @@ description: >
18
18
  metadata:
19
19
  type: core
20
20
  library: '@jielga/tmdatagrid'
21
- library_version: '2.1.0'
21
+ library_version: '2.1.1'
22
22
  sources:
23
23
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/styling.md'
24
24
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/toolbar.md'
@@ -14,7 +14,7 @@ description: >
14
14
  metadata:
15
15
  type: core
16
16
  library: '@jielga/tmdatagrid'
17
- library_version: '2.1.0'
17
+ library_version: '2.1.1'
18
18
  sources:
19
19
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/cell-selection.md'
20
20
  - 'Jielga/TMDataGrid:packages/tmdatagrid/src/core/cellNavigation.ts'
@@ -16,7 +16,7 @@ description: >
16
16
  metadata:
17
17
  type: core
18
18
  library: '@jielga/tmdatagrid'
19
- library_version: '2.1.0'
19
+ library_version: '2.1.1'
20
20
  sources:
21
21
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/columns.md'
22
22
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/column-layout.md'
@@ -18,7 +18,7 @@ description: >
18
18
  metadata:
19
19
  type: core
20
20
  library: '@jielga/tmdatagrid'
21
- library_version: '2.1.0'
21
+ library_version: '2.1.1'
22
22
  sources:
23
23
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/pagination.md'
24
24
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/scrolling.md'
@@ -18,7 +18,7 @@ description: >
18
18
  metadata:
19
19
  type: core
20
20
  library: '@jielga/tmdatagrid'
21
- library_version: '2.1.0'
21
+ library_version: '2.1.1'
22
22
  sources:
23
23
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/editing.md'
24
24
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/draft-store.md'
@@ -18,7 +18,7 @@ description: >
18
18
  metadata:
19
19
  type: core
20
20
  library: '@jielga/tmdatagrid'
21
- library_version: '2.1.0'
21
+ library_version: '2.1.1'
22
22
  sources:
23
23
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/filtering.md'
24
24
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/quick-search.md'
@@ -13,7 +13,7 @@ description: >
13
13
  metadata:
14
14
  type: core
15
15
  library: '@jielga/tmdatagrid'
16
- library_version: '2.1.0'
16
+ library_version: '2.1.1'
17
17
  sources:
18
18
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/getting-started.md'
19
19
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/anatomy.md'
@@ -14,7 +14,7 @@ description: >
14
14
  metadata:
15
15
  type: core
16
16
  library: '@jielga/tmdatagrid'
17
- library_version: '2.1.0'
17
+ library_version: '2.1.1'
18
18
  sources:
19
19
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/grouping.md'
20
20
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/summary-row.md'
@@ -15,7 +15,7 @@ description: >
15
15
  metadata:
16
16
  type: lifecycle
17
17
  library: '@jielga/tmdatagrid'
18
- library_version: '2.1.0'
18
+ library_version: '2.1.1'
19
19
  sources:
20
20
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/migrating-to-2.md'
21
21
  - 'Jielga/TMDataGrid:packages/tmdatagrid/src/index.ts'
@@ -14,7 +14,7 @@ description: >
14
14
  metadata:
15
15
  type: core
16
16
  library: '@jielga/tmdatagrid'
17
- library_version: '2.1.0'
17
+ library_version: '2.1.1'
18
18
  sources:
19
19
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/use-tm-data-grid.md'
20
20
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/persistence.md'
@@ -57,7 +57,7 @@ rather than forwarded to TanStack.
57
57
  | `enableSorting` | `boolean` | `true` | Enables sorting for the table. |
58
58
  | `enableColumnFilters` | `boolean` | `true` | Enables filtering for the table. |
59
59
  | `enableHiding` | `boolean` | `true` | Enables column visibility for the table. |
60
- | `enableColumnPinning` | `boolean` | `true` | Enables pinning for the table. |
60
+ | `enableColumnPinning` | `boolean` | `true` | Enables pinning for the table. `false` removes the pin menu items; the generated lanes stay pinned. |
61
61
  | `enableColumnResizing` | `boolean` | `true` | Enables resizing for the table. |
62
62
  | `enableColumnOrdering` | `boolean` | `true` | Enables header dragging and the move menu items. Defined by the grid. |
63
63
  | `enablePagination` | `boolean` | `false` | Enables client-side paging and the `Footer` pager. Implied by `manualPagination`. Defined by the grid. |
@@ -17,7 +17,7 @@ description: >
17
17
  metadata:
18
18
  type: core
19
19
  library: '@jielga/tmdatagrid'
20
- library_version: '2.1.0'
20
+ library_version: '2.1.1'
21
21
  sources:
22
22
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/row-selection.md'
23
23
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/row-interaction.md'
@@ -15,7 +15,7 @@ description: >
15
15
  metadata:
16
16
  type: core
17
17
  library: '@jielga/tmdatagrid'
18
- library_version: '2.1.0'
18
+ library_version: '2.1.1'
19
19
  sources:
20
20
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/server-side.md'
21
21
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/server-query.md'
@@ -13,7 +13,7 @@ description: >
13
13
  metadata:
14
14
  type: core
15
15
  library: '@jielga/tmdatagrid'
16
- library_version: '2.1.0'
16
+ library_version: '2.1.1'
17
17
  sources:
18
18
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/testing.md'
19
19
  - 'Jielga/TMDataGrid:playwright/support/DataGrid.ts'
@@ -12,7 +12,7 @@ description: >
12
12
  metadata:
13
13
  type: core
14
14
  library: '@jielga/tmdatagrid'
15
- library_version: '2.1.0'
15
+ library_version: '2.1.1'
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.1.0'
15
+ library_version: '2.1.1'
16
16
  sources:
17
17
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/testing.md'
18
18
  - 'Jielga/TMDataGrid:packages/tmdatagrid/docs/editing.md'
@@ -159,9 +159,9 @@ function keepColumnInView({
159
159
  * | ---- | ------- |
160
160
  * | On a data row | the column's `cell`, as always |
161
161
  * | Placeholder - a grouped column other than this row's own | nothing |
162
- * | Aggregated, column declares `aggregatedCell` | that |
163
- * | Aggregated, column declares an `aggregationFn` | the column's `cell`, over the aggregate |
164
- * | Aggregated, column declares neither | nothing |
162
+ * | Group summary, column declares `aggregatedCell` | that |
163
+ * | Group summary, column declares an `aggregationFn` | the column's `cell`, over the aggregate |
164
+ * | Group summary, column declares neither | nothing |
165
165
  *
166
166
  * That last row is the one worth spelling out. Without an aggregation function
167
167
  * `getValue()` is `undefined` on a group row, so the column's own renderer
@@ -174,17 +174,31 @@ function renderCellContent(
174
174
  cell: Cell<TMDataGridFeatures, TMDataGridRowData, unknown>,
175
175
  ) {
176
176
  if (cell.getIsPlaceholder()) return null;
177
- if (!cell.getIsAggregated()) {
177
+ if (!isGroupSummaryCell(cell)) {
178
178
  return flexRender(cell.column.columnDef.cell, cell.getContext());
179
179
  }
180
- const { aggregatedCell, aggregationFn } = cell.column.columnDef;
180
+ const { aggregatedCell } = cell.column.columnDef;
181
181
  if (aggregatedCell !== undefined) {
182
182
  return flexRender(aggregatedCell, cell.getContext());
183
183
  }
184
- if (aggregationFn === undefined) return null;
184
+ if (!cell.getIsAggregated()) return null;
185
185
  return flexRender(cell.column.columnDef.cell, cell.getContext());
186
186
  }
187
187
 
188
+ /**
189
+ * A cell on a group row in any column but the one the row groups by - the
190
+ * cells that summarise the group rather than show a record.
191
+ *
192
+ * Not `cell.getIsAggregated()`: since TanStack Table 9.2 that is true only
193
+ * when the column has an aggregation function, so it cannot tell a group
194
+ * row's blank cell from a data row's cell.
195
+ */
196
+ function isGroupSummaryCell(
197
+ cell: Cell<TMDataGridFeatures, TMDataGridRowData, unknown>,
198
+ ): boolean {
199
+ return cell.row.getIsGrouped() && !cell.getIsGrouped();
200
+ }
201
+
188
202
  /**
189
203
  * What a cell needs to take part in cell selection, or `undefined` while the
190
204
  * feature is off - which is what keeps a plain grid's cells exactly as they
@@ -401,7 +415,7 @@ function TMDataGridBodyCell({
401
415
  draftValues !== undefined &&
402
416
  contentOverride === undefined &&
403
417
  !cell.getIsPlaceholder() &&
404
- !cell.getIsAggregated()
418
+ !isGroupSummaryCell(cell)
405
419
  ? draftCellContext(cell, draftValues)
406
420
  : undefined;
407
421
  // Highlighting reproduces the *default* renderer, value then
@@ -412,7 +426,7 @@ function TMDataGridBodyCell({
412
426
  highlightNeedles !== undefined &&
413
427
  contentOverride === undefined &&
414
428
  !cell.getIsPlaceholder() &&
415
- !cell.getIsAggregated() &&
429
+ !isGroupSummaryCell(cell) &&
416
430
  cell.column.columnDef.cell === table.getDefaultColumnDef().cell
417
431
  ) {
418
432
  const value =
@@ -48,8 +48,8 @@ export function createSelectColumn<TData extends RowData>(
48
48
  enablePinning: false,
49
49
  header: ({ table }) => <SelectAllHeader table={table} />,
50
50
  cell: ({ row }) => <SelectRowCheckbox row={row} />,
51
- // Every cell on a group row that is not the grouped column counts as
52
- // aggregated, this lane included, and an aggregated cell with nothing
51
+ // Every cell on a group row that is not the grouped column is a group
52
+ // summary cell, this lane included, and a summary cell with nothing
53
53
  // declared renders blank. Without this the checkbox would disappear from
54
54
  // exactly the rows that select a whole group. See renderCellContent.
55
55
  aggregatedCell: ({ row }) => <SelectRowCheckbox row={row} />,
@@ -90,10 +90,10 @@ export function createGroupColumn<TData extends RowData>(
90
90
  // Structurally pinned to the left; users shouldn't be able to move it.
91
91
  enablePinning: false,
92
92
  cell: ({ row }) => <GroupCell row={row} />,
93
- // A group row has subRows, so every cell on it that is not the grouped
94
- // column reports `getIsAggregated()` - this lane included. Without an
95
- // `aggregatedCell` the body would take that as "nothing to summarise" and
96
- // render the tree lane blank on exactly the rows it exists for.
93
+ // Every cell on a group row that is not the grouped column is a group
94
+ // summary cell - this lane included. Without an `aggregatedCell` the body
95
+ // would take that as "nothing to summarise" and render the tree lane
96
+ // blank on exactly the rows it exists for. See renderCellContent.
97
97
  aggregatedCell: ({ row }) => <GroupCell row={row} />,
98
98
  header: ({ table }) => <GroupHeader table={table} />,
99
99
  };
@@ -142,7 +142,7 @@ export function createDetailsColumn<TData extends RowData>(
142
142
  header: ({ table }) => <DetailsHeader table={table} />,
143
143
  cell: ({ row }) => <DetailsCell row={row} />,
144
144
  // Deliberately no `aggregatedCell`: on a group row every cell outside the
145
- // grouped column counts as aggregated, and blank is the right answer here -
145
+ // grouped column is a summary cell, and blank is the right answer here -
146
146
  // groups expand into their rows, not into a panel.
147
147
  };
148
148
  }
@@ -182,7 +182,7 @@ export function createEditColumn<TData extends RowData>(
182
182
  header: () => null,
183
183
  cell: ({ row }) => <EditLaneCell row={row} />,
184
184
  // Group rows: same reasoning as the checkbox lane - without this the
185
- // cell renders blank on aggregated rows, but here blank is also correct,
185
+ // cell renders blank on group rows, but here blank is also correct,
186
186
  // so the aggregated cell renders the same (null for groups).
187
187
  aggregatedCell: ({ row }) => <EditLaneCell row={row} />,
188
188
  };
@@ -1238,7 +1238,6 @@ export function useTMDataGrid<TData extends RowData>({
1238
1238
  ],
1239
1239
  );
1240
1240
 
1241
- const pinningEnabled = options.enableColumnPinning !== false;
1242
1241
  const selectColumnEnabled = features.selectColumn;
1243
1242
  const groupColumnEnabled = features.grouping;
1244
1243
  // The lane that opens the panels. Nothing to switch on: a grid with no
@@ -1270,13 +1269,15 @@ export function useTMDataGrid<TData extends RowData>({
1270
1269
  // and re-applied on top of anything restored: a snapshot cannot unpin one,
1271
1270
  // and a snapshot taken before `detailsColumnPosition` changed cannot pin the
1272
1271
  // details lane to the edge it has since left.
1272
+ //
1273
+ // Not gated on `enableColumnPinning`: that switch takes pinning away from the
1274
+ // user, not from the grid's own lanes, which hold the edges either way.
1273
1275
  const structuralPinning = (
1274
1276
  restored: Partial<ColumnPinningState> | undefined,
1275
1277
  ): ColumnPinningState => {
1276
1278
  const own = (ids: string[] | undefined) =>
1277
1279
  (ids ?? []).filter((id) => !isGeneratedColumn(id));
1278
- const lane = (enabled: boolean, id: string) =>
1279
- enabled && pinningEnabled ? [id] : [];
1280
+ const lane = (enabled: boolean, id: string) => (enabled ? [id] : []);
1280
1281
  const detailsOn = (edge: "left" | "right") =>
1281
1282
  detailsColumnEnabled && detailsColumnPosition === edge;
1282
1283
  return {