@tanstack/table-core 9.0.0-beta.54 → 9.0.0-beta.56
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/core/cells/constructCell.d.ts +2 -2
- package/dist/core/cells/constructCell.js +2 -0
- package/dist/core/cells/coreCellsFeature.types.d.ts +2 -2
- package/dist/core/cells/coreCellsFeature.utils.d.ts +2 -2
- package/dist/core/columns/constructColumn.js +5 -4
- package/dist/core/headers/buildHeaderGroups.js +2 -0
- package/dist/core/headers/constructHeader.js +2 -0
- package/dist/core/row-models/coreRowModelsFeature.types.d.ts +4 -4
- package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +1 -1
- package/dist/core/row-models/createCoreRowModel.d.ts +1 -1
- package/dist/core/rows/constructRow.d.ts +1 -1
- package/dist/core/rows/constructRow.js +2 -2
- package/dist/core/rows/coreRowsFeature.types.d.ts +2 -2
- package/dist/core/rows/coreRowsFeature.utils.d.ts +4 -4
- package/dist/core/rows/coreRowsFeature.utils.js +4 -3
- package/dist/core/table/constructTable.js +19 -1
- package/dist/core/table/coreTablesFeature.types.d.ts +21 -1
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.d.ts +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.js +3 -2
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.js +9 -2
- package/dist/features/column-filtering/createFilteredRowModel.d.ts +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.js +3 -2
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +3 -3
- package/dist/features/column-grouping/createGroupedRowModel.d.ts +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.ts +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +3 -3
- package/dist/features/column-resizing/columnResizingFeature.utils.js +1 -2
- package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +3 -3
- package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +1 -1
- package/dist/features/row-aggregation/rowAggregationFeature.types.d.ts +2 -2
- package/dist/features/row-aggregation/rowAggregationFeature.utils.d.ts +2 -2
- package/dist/features/row-expanding/createExpandedRowModel.d.ts +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.js +3 -2
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +2 -5
- package/dist/features/row-expanding/rowExpandingFeature.utils.js +1 -5
- package/dist/features/row-pagination/createPaginatedRowModel.d.ts +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +2 -3
- package/dist/features/row-selection/rowSelectionFeature.utils.js +1 -3
- package/dist/features/row-sorting/createSortedRowModel.d.ts +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +2 -3
- package/dist/features/row-sorting/rowSortingFeature.utils.js +2 -4
- package/dist/index.d.ts +20 -20
- package/dist/types/Cell.d.ts +1 -1
- package/dist/types/Column.d.ts +7 -7
- package/dist/types/ColumnDef.d.ts +5 -5
- package/dist/types/Header.d.ts +1 -1
- package/dist/types/Row.d.ts +4 -4
- package/dist/types/RowModel.d.ts +4 -4
- package/dist/types/Table.d.ts +12 -12
- package/dist/types/TableFeatures.d.ts +40 -5
- package/dist/types/TableOptions.d.ts +12 -12
- package/dist/types/TableState.d.ts +8 -8
- package/dist/types/type-utils.d.ts +1 -1
- package/dist/worker/createWorkerRowModel.d.ts +1 -1
- package/dist/worker/initTableWorker.js +1 -1
- package/package.json +1 -1
- package/skills/aggregation/SKILL.md +1 -1
- package/skills/api-not-found/SKILL.md +1 -1
- package/skills/client-vs-server/SKILL.md +1 -1
- package/skills/column-faceting/SKILL.md +1 -1
- package/skills/column-filtering/SKILL.md +1 -1
- package/skills/column-ordering/SKILL.md +1 -1
- package/skills/column-pinning/SKILL.md +1 -1
- package/skills/column-resizing/SKILL.md +1 -1
- package/skills/column-sizing/SKILL.md +1 -1
- package/skills/column-visibility/SKILL.md +1 -1
- package/skills/core/SKILL.md +1 -1
- package/skills/custom-features/SKILL.md +1 -1
- package/skills/expanding/SKILL.md +1 -1
- package/skills/global-filtering/SKILL.md +1 -1
- package/skills/grouping/SKILL.md +1 -1
- package/skills/migrate-v8-to-v9/SKILL.md +1 -1
- package/skills/pagination/SKILL.md +1 -1
- package/skills/row-pinning/SKILL.md +1 -1
- package/skills/row-selection/SKILL.md +1 -1
- package/skills/sorting/SKILL.md +1 -1
- package/skills/table-features/SKILL.md +1 -1
- package/skills/typescript/SKILL.md +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CellData, RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { Cell } from "../../types/Cell.js";
|
|
3
|
-
import { Row } from "../../types/Row.js";
|
|
4
2
|
import { Table } from "../../types/Table.js";
|
|
5
3
|
import { Column } from "../../types/Column.js";
|
|
4
|
+
import { Row } from "../../types/Row.js";
|
|
5
|
+
import { Cell } from "../../types/Cell.js";
|
|
6
6
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
7
7
|
|
|
8
8
|
//#region src/core/cells/constructCell.d.ts
|
|
@@ -22,6 +22,8 @@ function constructCell(column, row, table) {
|
|
|
22
22
|
cell.column = column;
|
|
23
23
|
cell.id = `${row.id}_${column.id}`;
|
|
24
24
|
cell.row = row;
|
|
25
|
+
const initFns = table._cellInstanceInitFns;
|
|
26
|
+
for (let i = 0; i < initFns.length; i++) initFns[i](cell);
|
|
25
27
|
return cell;
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CellData, Getter, RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { Cell } from "../../types/Cell.js";
|
|
3
|
-
import { Row } from "../../types/Row.js";
|
|
4
2
|
import { Table } from "../../types/Table.js";
|
|
5
3
|
import { Column } from "../../types/Column.js";
|
|
4
|
+
import { Row } from "../../types/Row.js";
|
|
5
|
+
import { Cell } from "../../types/Cell.js";
|
|
6
6
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
7
7
|
|
|
8
8
|
//#region src/core/cells/coreCellsFeature.types.d.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CellData, NoInfer, RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { Cell } from "../../types/Cell.js";
|
|
3
|
-
import { Row } from "../../types/Row.js";
|
|
4
2
|
import { Table } from "../../types/Table.js";
|
|
5
3
|
import { Column } from "../../types/Column.js";
|
|
4
|
+
import { Row } from "../../types/Row.js";
|
|
5
|
+
import { Cell } from "../../types/Cell.js";
|
|
6
6
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
7
7
|
//#region src/core/cells/coreCellsFeature.utils.d.ts
|
|
8
8
|
/**
|
|
@@ -22,10 +22,11 @@ function constructColumn(table, columnDef, depth, parent) {
|
|
|
22
22
|
...columnDef
|
|
23
23
|
};
|
|
24
24
|
const accessorKey = resolvedColumnDef.accessorKey;
|
|
25
|
-
const
|
|
25
|
+
const accessorKeyString = accessorKey === void 0 ? void 0 : String(accessorKey);
|
|
26
|
+
const id = resolvedColumnDef.id ?? accessorKeyString?.replaceAll(".", "_") ?? (typeof resolvedColumnDef.header === "string" ? resolvedColumnDef.header : void 0);
|
|
26
27
|
let accessorFn;
|
|
27
28
|
if (resolvedColumnDef.accessorFn) accessorFn = resolvedColumnDef.accessorFn;
|
|
28
|
-
else if (accessorKey) if (accessorKey.includes(".")) {
|
|
29
|
+
else if (accessorKey !== void 0) if (typeof accessorKey === "string" && accessorKey.includes(".")) {
|
|
29
30
|
const keys = accessorKey.split(".");
|
|
30
31
|
accessorFn = (originalRow) => {
|
|
31
32
|
let result = originalRow;
|
|
@@ -49,8 +50,8 @@ function constructColumn(table, columnDef, depth, parent) {
|
|
|
49
50
|
column.depth = depth;
|
|
50
51
|
column.id = `${String(id)}`;
|
|
51
52
|
column.parent = parent;
|
|
52
|
-
const
|
|
53
|
-
for (let i = 0; i <
|
|
53
|
+
const initFns = table._columnInstanceInitFns;
|
|
54
|
+
for (let i = 0; i < initFns.length; i++) initFns[i](column);
|
|
54
55
|
return column;
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -21,6 +21,7 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
|
|
|
21
21
|
};
|
|
22
22
|
findMaxDepth(allColumns);
|
|
23
23
|
const headerGroups = [];
|
|
24
|
+
const headerGroupInitFns = table._headerGroupInstanceInitFns;
|
|
24
25
|
const constructHeaderGroup = (headersToGroup, depth) => {
|
|
25
26
|
const headerGroup = {
|
|
26
27
|
depth,
|
|
@@ -58,6 +59,7 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
|
|
|
58
59
|
headerGroup.headers.push(headerToGroup);
|
|
59
60
|
headerToGroup.headerGroup = headerGroup;
|
|
60
61
|
});
|
|
62
|
+
for (let i = 0; i < headerGroupInitFns.length; i++) headerGroupInitFns[i](headerGroup);
|
|
61
63
|
headerGroups.push(headerGroup);
|
|
62
64
|
if (depth > 0) constructHeaderGroup(pendingParentHeaders, depth - 1);
|
|
63
65
|
};
|
|
@@ -29,6 +29,8 @@ function constructHeader(table, column, options) {
|
|
|
29
29
|
header.placeholderId = options.placeholderId;
|
|
30
30
|
header.rowSpan = 0;
|
|
31
31
|
header.subHeaders = [];
|
|
32
|
+
const initFns = table._headerInstanceInitFns;
|
|
33
|
+
for (let i = 0; i < initFns.length; i++) initFns[i](header);
|
|
32
34
|
return header;
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import {
|
|
3
|
-
import { Table_RowModels_Sorted } from "../../features/row-sorting/rowSortingFeature.types.js";
|
|
2
|
+
import { Table_RowModels_Faceted } from "../../features/column-faceting/columnFacetingFeature.types.js";
|
|
4
3
|
import { Table_RowModels_Expanded } from "../../features/row-expanding/rowExpandingFeature.types.js";
|
|
4
|
+
import { Table_RowModels_Paginated } from "../../features/row-pagination/rowPaginationFeature.types.js";
|
|
5
|
+
import { Table_RowModels_Sorted } from "../../features/row-sorting/rowSortingFeature.types.js";
|
|
5
6
|
import { Row } from "../../types/Row.js";
|
|
6
7
|
import { Table_RowModels_Filtered } from "../../features/column-filtering/columnFilteringFeature.types.js";
|
|
7
|
-
import {
|
|
8
|
-
import { Table_RowModels_Faceted } from "../../features/column-faceting/columnFacetingFeature.types.js";
|
|
8
|
+
import { Table_RowModels_Grouped } from "../../features/column-grouping/columnGroupingFeature.types.js";
|
|
9
9
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
10
10
|
|
|
11
11
|
//#region src/core/row-models/coreRowModelsFeature.types.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { RowModel } from "./coreRowModelsFeature.types.js";
|
|
3
2
|
import { Table } from "../../types/Table.js";
|
|
3
|
+
import { RowModel } from "./coreRowModelsFeature.types.js";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
5
|
|
|
6
6
|
//#region src/core/row-models/coreRowModelsFeature.utils.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { RowModel } from "./coreRowModelsFeature.types.js";
|
|
3
2
|
import { Table } from "../../types/Table.js";
|
|
3
|
+
import { RowModel } from "./coreRowModelsFeature.types.js";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
5
|
|
|
6
6
|
//#region src/core/row-models/createCoreRowModel.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { Row } from "../../types/Row.js";
|
|
3
2
|
import { Table } from "../../types/Table.js";
|
|
3
|
+
import { Row } from "../../types/Row.js";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
5
|
|
|
6
6
|
//#region src/core/rows/constructRow.d.ts
|
|
@@ -30,8 +30,8 @@ const constructRow = (table, id, original, rowIndex, depth, subRows, parentId) =
|
|
|
30
30
|
row.original = original;
|
|
31
31
|
row.parentId = parentId;
|
|
32
32
|
row.subRows = subRows ?? [];
|
|
33
|
-
const
|
|
34
|
-
for (let i = 0; i <
|
|
33
|
+
const initFns = table._rowInstanceInitFns;
|
|
34
|
+
for (let i = 0; i < initFns.length; i++) initFns[i](row);
|
|
35
35
|
return row;
|
|
36
36
|
};
|
|
37
37
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { Cell } from "../../types/Cell.js";
|
|
3
|
-
import { Row } from "../../types/Row.js";
|
|
4
2
|
import { Table } from "../../types/Table.js";
|
|
5
3
|
import { Column } from "../../types/Column.js";
|
|
4
|
+
import { Row } from "../../types/Row.js";
|
|
5
|
+
import { Cell } from "../../types/Cell.js";
|
|
6
6
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
7
7
|
|
|
8
8
|
//#region src/core/rows/coreRowsFeature.types.d.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { Cell } from "../../types/Cell.js";
|
|
3
|
-
import { Row } from "../../types/Row.js";
|
|
4
2
|
import { Table } from "../../types/Table.js";
|
|
3
|
+
import { Row } from "../../types/Row.js";
|
|
4
|
+
import { Cell } from "../../types/Cell.js";
|
|
5
5
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
6
6
|
|
|
7
7
|
//#region src/core/rows/coreRowsFeature.utils.d.ts
|
|
@@ -74,8 +74,8 @@ declare function table_getMaxSubRowDepth<TFeatures extends TableFeatures, TData
|
|
|
74
74
|
/**
|
|
75
75
|
* Looks up this row's direct parent, if it has one.
|
|
76
76
|
*
|
|
77
|
-
* Parent lookup
|
|
78
|
-
*
|
|
77
|
+
* Parent lookup prefers the core row model for structural parents, then falls
|
|
78
|
+
* back to the pre-pagination row model for generated parent rows.
|
|
79
79
|
*
|
|
80
80
|
* @example
|
|
81
81
|
* ```ts
|
|
@@ -114,8 +114,8 @@ function table_getMaxSubRowDepth(table) {
|
|
|
114
114
|
/**
|
|
115
115
|
* Looks up this row's direct parent, if it has one.
|
|
116
116
|
*
|
|
117
|
-
* Parent lookup
|
|
118
|
-
*
|
|
117
|
+
* Parent lookup prefers the core row model for structural parents, then falls
|
|
118
|
+
* back to the pre-pagination row model for generated parent rows.
|
|
119
119
|
*
|
|
120
120
|
* @example
|
|
121
121
|
* ```ts
|
|
@@ -123,7 +123,8 @@ function table_getMaxSubRowDepth(table) {
|
|
|
123
123
|
* ```
|
|
124
124
|
*/
|
|
125
125
|
function row_getParentRow(row) {
|
|
126
|
-
|
|
126
|
+
if (!row.parentId) return;
|
|
127
|
+
return row.table.getCoreRowModel().rowsById[row.parentId] ?? row.table.getRow(row.parentId, true);
|
|
127
128
|
}
|
|
128
129
|
/**
|
|
129
130
|
* Collects this row's ancestor chain from root to direct parent.
|
|
@@ -95,7 +95,25 @@ function constructTable(tableOptions) {
|
|
|
95
95
|
}
|
|
96
96
|
return snapshot;
|
|
97
97
|
}, { debugName: "table/store" }));
|
|
98
|
-
|
|
98
|
+
const cellInstanceInitFns = [];
|
|
99
|
+
const columnInstanceInitFns = [];
|
|
100
|
+
const headerGroupInstanceInitFns = [];
|
|
101
|
+
const headerInstanceInitFns = [];
|
|
102
|
+
const rowInstanceInitFns = [];
|
|
103
|
+
for (let i = 0; i < featuresList.length; i++) {
|
|
104
|
+
const feature = featuresList[i];
|
|
105
|
+
if (feature.initCellInstanceData) cellInstanceInitFns.push(feature.initCellInstanceData.bind(feature));
|
|
106
|
+
if (feature.initColumnInstanceData) columnInstanceInitFns.push(feature.initColumnInstanceData.bind(feature));
|
|
107
|
+
if (feature.initHeaderGroupInstanceData) headerGroupInstanceInitFns.push(feature.initHeaderGroupInstanceData.bind(feature));
|
|
108
|
+
if (feature.initHeaderInstanceData) headerInstanceInitFns.push(feature.initHeaderInstanceData.bind(feature));
|
|
109
|
+
if (feature.initRowInstanceData) rowInstanceInitFns.push(feature.initRowInstanceData.bind(feature));
|
|
110
|
+
feature.initTableInstanceData?.(table);
|
|
111
|
+
}
|
|
112
|
+
table._cellInstanceInitFns = cellInstanceInitFns;
|
|
113
|
+
table._columnInstanceInitFns = columnInstanceInitFns;
|
|
114
|
+
table._headerGroupInstanceInitFns = headerGroupInstanceInitFns;
|
|
115
|
+
table._headerInstanceInitFns = headerInstanceInitFns;
|
|
116
|
+
table._rowInstanceInitFns = rowInstanceInitFns;
|
|
99
117
|
if (process.env.NODE_ENV === "development" && (tableOptions.debugAll || tableOptions.debugTable)) {
|
|
100
118
|
const features = Object.keys(table._features);
|
|
101
119
|
const rowModels = Object.entries({
|
|
@@ -5,7 +5,7 @@ import { CachedRowModels } from "../../types/RowModel.js";
|
|
|
5
5
|
import { RowModelFns } from "../../types/RowModelFns.js";
|
|
6
6
|
import { TableState, TableState_All } from "../../types/TableState.js";
|
|
7
7
|
import { TableOptions } from "../../types/TableOptions.js";
|
|
8
|
-
import { IsAny, TableFeatures, ValidateFeatureSlots } from "../../types/TableFeatures.js";
|
|
8
|
+
import { IsAny, TableFeature, TableFeatures, ValidateFeatureSlots } from "../../types/TableFeatures.js";
|
|
9
9
|
import { Atom, ReadonlyAtom, ReadonlyStore } from "@tanstack/store";
|
|
10
10
|
|
|
11
11
|
//#region src/core/table/coreTablesFeature.types.d.ts
|
|
@@ -119,10 +119,18 @@ interface Table_CoreProperties<in out TFeatures extends TableFeatures, in out TD
|
|
|
119
119
|
* Table reactivity bindings for interacting with TanStack Store.
|
|
120
120
|
*/
|
|
121
121
|
readonly _reactivity: TableReactivityBindings;
|
|
122
|
+
/**
|
|
123
|
+
* Cache of the `initCellInstanceData` functions for features that define one.
|
|
124
|
+
*/
|
|
125
|
+
_cellInstanceInitFns?: Array<NonNullable<TableFeature['initCellInstanceData']>>;
|
|
122
126
|
/**
|
|
123
127
|
* Prototype cache for Cell objects - shared by all cells in this table
|
|
124
128
|
*/
|
|
125
129
|
_cellPrototype?: object;
|
|
130
|
+
/**
|
|
131
|
+
* Cache of the `initColumnInstanceData` functions for features that define one.
|
|
132
|
+
*/
|
|
133
|
+
_columnInstanceInitFns?: Array<NonNullable<TableFeature['initColumnInstanceData']>>;
|
|
126
134
|
/**
|
|
127
135
|
* Prototype cache for Column objects - shared by all columns in this table
|
|
128
136
|
*/
|
|
@@ -131,6 +139,14 @@ interface Table_CoreProperties<in out TFeatures extends TableFeatures, in out TD
|
|
|
131
139
|
* The features that are enabled for the table.
|
|
132
140
|
*/
|
|
133
141
|
readonly _features: Partial<CoreFeatures> & TFeatures;
|
|
142
|
+
/**
|
|
143
|
+
* Cache of the `initHeaderGroupInstanceData` functions for features that define one.
|
|
144
|
+
*/
|
|
145
|
+
_headerGroupInstanceInitFns?: Array<NonNullable<TableFeature['initHeaderGroupInstanceData']>>;
|
|
146
|
+
/**
|
|
147
|
+
* Cache of the `initHeaderInstanceData` functions for features that define one.
|
|
148
|
+
*/
|
|
149
|
+
_headerInstanceInitFns?: Array<NonNullable<TableFeature['initHeaderInstanceData']>>;
|
|
134
150
|
/**
|
|
135
151
|
* Prototype cache for Header objects - shared by all headers in this table
|
|
136
152
|
*/
|
|
@@ -147,6 +163,10 @@ interface Table_CoreProperties<in out TFeatures extends TableFeatures, in out TD
|
|
|
147
163
|
* Prototype cache for Row objects - shared by all rows in this table
|
|
148
164
|
*/
|
|
149
165
|
_rowPrototype?: object;
|
|
166
|
+
/**
|
|
167
|
+
* Cache of the `initRowInstanceData` functions for features that define one.
|
|
168
|
+
*/
|
|
169
|
+
_rowInstanceInitFns?: Array<NonNullable<TableFeature['initRowInstanceData']>>;
|
|
150
170
|
/**
|
|
151
171
|
* The readonly derived atoms for each `TableState` slice. Each derives from
|
|
152
172
|
* its corresponding `baseAtom` plus, optionally, a per-slice external atom or
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CellData, RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
3
2
|
import { Table } from "../../types/Table.js";
|
|
4
3
|
import { Column } from "../../types/Column.js";
|
|
4
|
+
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
5
5
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
6
6
|
|
|
7
7
|
//#region src/features/column-faceting/columnFacetingFeature.utils.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
3
2
|
import { Table } from "../../types/Table.js";
|
|
3
|
+
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
5
|
|
|
6
6
|
//#region src/features/column-faceting/createFacetedRowModel.d.ts
|
|
@@ -25,13 +25,14 @@ function createFacetedRowModel() {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
function _createFacetedRowModel(table, columnId, preRowModel, columnFilters, globalFilter) {
|
|
28
|
-
|
|
28
|
+
const hasGlobalFilter = globalFilter !== void 0 && globalFilter !== null && globalFilter !== "";
|
|
29
|
+
if (!preRowModel.rows.length || !columnFilters?.length && !hasGlobalFilter) return preRowModel;
|
|
29
30
|
const filterableIds = [];
|
|
30
31
|
if (columnFilters) for (let i = 0; i < columnFilters.length; i++) {
|
|
31
32
|
const id = columnFilters[i].id;
|
|
32
33
|
if (id !== columnId) filterableIds.push(id);
|
|
33
34
|
}
|
|
34
|
-
if (
|
|
35
|
+
if (hasGlobalFilter && columnId !== "__global__") filterableIds.push("__global__");
|
|
35
36
|
if (!filterableIds.length) return preRowModel;
|
|
36
37
|
const filterRowsImpl = (row) => {
|
|
37
38
|
for (let i = 0; i < filterableIds.length; i++) if (row.columnFilters?.[filterableIds[i]] === false) return false;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CellData, OnChangeFn, RowData, TransformDataValueFn, Updater } from "../../types/type-utils.js";
|
|
2
2
|
import { BuiltInFilterFn } from "./filterFns.js";
|
|
3
|
+
import { Column } from "../../types/Column.js";
|
|
3
4
|
import { Row } from "../../types/Row.js";
|
|
4
5
|
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
5
|
-
import { Column } from "../../types/Column.js";
|
|
6
6
|
import { IsAny, TableFeatures } from "../../types/TableFeatures.js";
|
|
7
7
|
|
|
8
8
|
//#region src/features/column-filtering/columnFilteringFeature.types.d.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CellData, RowData, Updater } from "../../types/type-utils.js";
|
|
2
|
-
import { ColumnFiltersState, FilterFn } from "./columnFilteringFeature.types.js";
|
|
3
2
|
import { Table } from "../../types/Table.js";
|
|
4
3
|
import { Column } from "../../types/Column.js";
|
|
4
|
+
import { ColumnFiltersState, FilterFn } from "./columnFilteringFeature.types.js";
|
|
5
5
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
6
6
|
|
|
7
7
|
//#region src/features/column-filtering/columnFilteringFeature.utils.d.ts
|
|
@@ -33,8 +33,15 @@ function getDefaultColumnFiltersState() {
|
|
|
33
33
|
*/
|
|
34
34
|
function column_getAutoFilterFn(column) {
|
|
35
35
|
const filterFns = column.table._rowModelFns.filterFns;
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const rows = column.table.getCoreRowModel().flatRows;
|
|
37
|
+
let value;
|
|
38
|
+
for (let i = 0; i < rows.length; i++) {
|
|
39
|
+
const rowValue = rows[i].getValue(column.id);
|
|
40
|
+
if (rowValue !== null && rowValue !== void 0) {
|
|
41
|
+
value = rowValue;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
38
45
|
let filterFnName;
|
|
39
46
|
if (typeof value === "string") filterFnName = "includesString";
|
|
40
47
|
else if (typeof value === "number") filterFnName = "inNumberRange";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
3
2
|
import { Table } from "../../types/Table.js";
|
|
3
|
+
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
5
|
|
|
6
6
|
//#region src/features/column-filtering/createFilteredRowModel.d.ts
|
|
@@ -39,7 +39,8 @@ function _createFilteredRowModel(table) {
|
|
|
39
39
|
const rowModel = table.getPreFilteredRowModel();
|
|
40
40
|
const columnFilters = table.atoms.columnFilters?.get();
|
|
41
41
|
const globalFilter = table.atoms.globalFilter?.get();
|
|
42
|
-
|
|
42
|
+
const hasGlobalFilter = globalFilter !== void 0 && globalFilter !== null && globalFilter !== "";
|
|
43
|
+
if (!rowModel.rows.length || !columnFilters?.length && !hasGlobalFilter) {
|
|
43
44
|
const flatRows = rowModel.flatRows;
|
|
44
45
|
for (let i = 0; i < flatRows.length; i++) {
|
|
45
46
|
const row = flatRows[i];
|
|
@@ -64,7 +65,7 @@ function _createFilteredRowModel(table) {
|
|
|
64
65
|
const filterableIds = columnFilters?.map((d) => d.id) ?? [];
|
|
65
66
|
const globalFilterFn = table_getGlobalFilterFn(table);
|
|
66
67
|
const globallyFilterableColumns = table.getAllLeafColumns().filter((column) => column_getCanGlobalFilter(column));
|
|
67
|
-
if (
|
|
68
|
+
if (hasGlobalFilter && globalFilterFn && globallyFilterableColumns.length) {
|
|
68
69
|
filterableIds.push("__global__");
|
|
69
70
|
globallyFilterableColumns.forEach((column) => {
|
|
70
71
|
resolvedGlobalFilters.push({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CellData, RowData, Updater } from "../../types/type-utils.js";
|
|
2
|
-
import { GroupingState, Row_ColumnGrouping } from "./columnGroupingFeature.types.js";
|
|
3
|
-
import { Cell } from "../../types/Cell.js";
|
|
4
|
-
import { Row } from "../../types/Row.js";
|
|
5
2
|
import { Table } from "../../types/Table.js";
|
|
6
3
|
import { Column } from "../../types/Column.js";
|
|
4
|
+
import { Row } from "../../types/Row.js";
|
|
5
|
+
import { GroupingState, Row_ColumnGrouping } from "./columnGroupingFeature.types.js";
|
|
6
|
+
import { Cell } from "../../types/Cell.js";
|
|
7
7
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
8
8
|
|
|
9
9
|
//#region src/features/column-grouping/columnGroupingFeature.utils.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
3
2
|
import { Table } from "../../types/Table.js";
|
|
3
|
+
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
5
|
|
|
6
6
|
//#region src/features/column-grouping/createGroupedRowModel.d.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { OnChangeFn, RowData, Updater } from "../../types/type-utils.js";
|
|
2
2
|
import { HeaderGroup } from "../../types/HeaderGroup.js";
|
|
3
3
|
import { Header } from "../../types/Header.js";
|
|
4
|
-
import { Cell } from "../../types/Cell.js";
|
|
5
4
|
import { Column } from "../../types/Column.js";
|
|
5
|
+
import { Cell } from "../../types/Cell.js";
|
|
6
6
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
7
7
|
|
|
8
8
|
//#region src/features/column-pinning/columnPinningFeature.types.d.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CellData, RowData, Updater } from "../../types/type-utils.js";
|
|
2
2
|
import { HeaderGroup } from "../../types/HeaderGroup.js";
|
|
3
|
-
import { ColumnPinningPosition, ColumnPinningState } from "./columnPinningFeature.types.js";
|
|
4
3
|
import { Header } from "../../types/Header.js";
|
|
5
|
-
import {
|
|
6
|
-
import { Row } from "../../types/Row.js";
|
|
4
|
+
import { ColumnPinningPosition, ColumnPinningState } from "./columnPinningFeature.types.js";
|
|
7
5
|
import { Table } from "../../types/Table.js";
|
|
8
6
|
import { Column } from "../../types/Column.js";
|
|
7
|
+
import { Row } from "../../types/Row.js";
|
|
8
|
+
import { Cell } from "../../types/Cell.js";
|
|
9
9
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
10
10
|
|
|
11
11
|
//#region src/features/column-pinning/columnPinningFeature.utils.d.ts
|
|
@@ -67,7 +67,6 @@ function header_getResizeHandler(header, _contextDocument) {
|
|
|
67
67
|
const canResize = column_getCanResize(column);
|
|
68
68
|
return (event) => {
|
|
69
69
|
if (!canResize) return;
|
|
70
|
-
event.persist?.();
|
|
71
70
|
if (isTouchStartEvent(event)) {
|
|
72
71
|
if (event.touches.length > 1) return;
|
|
73
72
|
}
|
|
@@ -144,7 +143,7 @@ function header_getResizeHandler(header, _contextDocument) {
|
|
|
144
143
|
}));
|
|
145
144
|
});
|
|
146
145
|
};
|
|
147
|
-
const contextDocument = _contextDocument || typeof document !== "undefined" ? document : null;
|
|
146
|
+
const contextDocument = _contextDocument || (typeof document !== "undefined" ? document : null);
|
|
148
147
|
const mouseEvents = {
|
|
149
148
|
moveHandler: (e) => onMove(e.clientX),
|
|
150
149
|
upHandler: (e) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CellData, RowData, Updater } from "../../types/type-utils.js";
|
|
2
|
-
import { ColumnPinningPosition } from "../column-pinning/columnPinningFeature.types.js";
|
|
3
2
|
import { ColumnOffsetsByPosition, ColumnSizingState } from "./columnSizingFeature.types.js";
|
|
4
3
|
import { Header } from "../../types/Header.js";
|
|
4
|
+
import { ColumnPinningPosition } from "../column-pinning/columnPinningFeature.types.js";
|
|
5
5
|
import { Table } from "../../types/Table.js";
|
|
6
6
|
import { Column } from "../../types/Column.js";
|
|
7
7
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OnChangeFn, RowData, Updater } from "../../types/type-utils.js";
|
|
2
|
-
import { Cell } from "../../types/Cell.js";
|
|
3
2
|
import { Column } from "../../types/Column.js";
|
|
3
|
+
import { Cell } from "../../types/Cell.js";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
5
|
|
|
6
6
|
//#region src/features/column-visibility/columnVisibilityFeature.types.d.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CellData, RowData, Updater } from "../../types/type-utils.js";
|
|
2
|
-
import { Cell } from "../../types/Cell.js";
|
|
3
|
-
import { ColumnVisibilityState } from "./columnVisibilityFeature.types.js";
|
|
4
|
-
import { Row } from "../../types/Row.js";
|
|
5
2
|
import { Table } from "../../types/Table.js";
|
|
6
3
|
import { Column } from "../../types/Column.js";
|
|
4
|
+
import { ColumnVisibilityState } from "./columnVisibilityFeature.types.js";
|
|
5
|
+
import { Row } from "../../types/Row.js";
|
|
6
|
+
import { Cell } from "../../types/Cell.js";
|
|
7
7
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
8
8
|
//#region src/features/column-visibility/columnVisibilityFeature.utils.d.ts
|
|
9
9
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CellData, OnChangeFn, RowData, Updater } from "../../types/type-utils.js";
|
|
2
|
-
import { FilterFn, FilterFnOption } from "../column-filtering/columnFilteringFeature.types.js";
|
|
3
2
|
import { Column } from "../../types/Column.js";
|
|
3
|
+
import { FilterFn, FilterFnOption } from "../column-filtering/columnFilteringFeature.types.js";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
5
|
|
|
6
6
|
//#region src/features/global-filtering/globalFilteringFeature.types.d.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CellData, RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { CreatedFilterFn, FilterFn } from "../column-filtering/columnFilteringFeature.types.js";
|
|
3
2
|
import { Table } from "../../types/Table.js";
|
|
4
3
|
import { Column } from "../../types/Column.js";
|
|
4
|
+
import { CreatedFilterFn, FilterFn } from "../column-filtering/columnFilteringFeature.types.js";
|
|
5
5
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
6
6
|
//#region src/features/global-filtering/globalFilteringFeature.utils.d.ts
|
|
7
7
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CellData, RowData } from "../../types/type-utils.js";
|
|
2
2
|
import { BuiltInAggregationFn } from "./aggregationFns.js";
|
|
3
3
|
import { ColumnDefTemplate } from "../../types/ColumnDef.js";
|
|
4
|
-
import { Cell } from "../../types/Cell.js";
|
|
5
|
-
import { Row } from "../../types/Row.js";
|
|
6
4
|
import { Table } from "../../types/Table.js";
|
|
7
5
|
import { Column } from "../../types/Column.js";
|
|
6
|
+
import { Row } from "../../types/Row.js";
|
|
7
|
+
import { Cell } from "../../types/Cell.js";
|
|
8
8
|
import { IsAny, TableFeatures } from "../../types/TableFeatures.js";
|
|
9
9
|
|
|
10
10
|
//#region src/features/row-aggregation/rowAggregationFeature.types.d.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CellData, RowData } from "../../types/type-utils.js";
|
|
2
2
|
import { AggregationFnDef, AggregationValueOptions, ColumnAggregationValue, ResolvedAggregationFn } from "./rowAggregationFeature.types.js";
|
|
3
|
-
import { Cell } from "../../types/Cell.js";
|
|
4
|
-
import { Row } from "../../types/Row.js";
|
|
5
3
|
import { Column } from "../../types/Column.js";
|
|
4
|
+
import { Row } from "../../types/Row.js";
|
|
5
|
+
import { Cell } from "../../types/Cell.js";
|
|
6
6
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
7
7
|
|
|
8
8
|
//#region src/features/row-aggregation/rowAggregationFeature.utils.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
3
2
|
import { Table } from "../../types/Table.js";
|
|
3
|
+
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
4
4
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
5
|
|
|
6
6
|
//#region src/features/row-expanding/createExpandedRowModel.d.ts
|
|
@@ -17,7 +17,8 @@ function createExpandedRowModel() {
|
|
|
17
17
|
memoDeps: () => [
|
|
18
18
|
table.atoms.expanded?.get(),
|
|
19
19
|
table.getPreExpandedRowModel(),
|
|
20
|
-
table.options.paginateExpandedRows
|
|
20
|
+
table.options.paginateExpandedRows,
|
|
21
|
+
table.options.manualPagination
|
|
21
22
|
],
|
|
22
23
|
fn: () => _createExpandedRowModel(table)
|
|
23
24
|
});
|
|
@@ -27,7 +28,7 @@ function _createExpandedRowModel(table) {
|
|
|
27
28
|
const rowModel = table.getPreExpandedRowModel();
|
|
28
29
|
const expanded = table.atoms.expanded?.get();
|
|
29
30
|
if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded ?? {}).length) return rowModel;
|
|
30
|
-
if (!table.options.paginateExpandedRows) return rowModel;
|
|
31
|
+
if (!table.options.paginateExpandedRows && !table.options.manualPagination) return rowModel;
|
|
31
32
|
return expandRows(rowModel);
|
|
32
33
|
}
|
|
33
34
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RowData, Updater } from "../../types/type-utils.js";
|
|
2
2
|
import { ExpandedState } from "./rowExpandingFeature.types.js";
|
|
3
|
-
import { Row } from "../../types/Row.js";
|
|
4
3
|
import { Table } from "../../types/Table.js";
|
|
4
|
+
import { Row } from "../../types/Row.js";
|
|
5
5
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
6
6
|
|
|
7
7
|
//#region src/features/row-expanding/rowExpandingFeature.utils.d.ts
|
|
@@ -83,15 +83,12 @@ declare function table_getCanSomeRowsExpand<TFeatures extends TableFeatures, TDa
|
|
|
83
83
|
/**
|
|
84
84
|
* Creates an event handler that toggles all rows expanded.
|
|
85
85
|
*
|
|
86
|
-
* React-style synthetic events are persisted when present before the table state
|
|
87
|
-
* is toggled.
|
|
88
|
-
*
|
|
89
86
|
* @example
|
|
90
87
|
* ```ts
|
|
91
88
|
* const onClick = table_getToggleAllRowsExpandedHandler(table)
|
|
92
89
|
* ```
|
|
93
90
|
*/
|
|
94
|
-
declare function table_getToggleAllRowsExpandedHandler<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): (
|
|
91
|
+
declare function table_getToggleAllRowsExpandedHandler<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): (_e: unknown) => void;
|
|
95
92
|
/**
|
|
96
93
|
* Checks whether any row is expanded.
|
|
97
94
|
*
|
|
@@ -93,17 +93,13 @@ function table_getCanSomeRowsExpand(table) {
|
|
|
93
93
|
/**
|
|
94
94
|
* Creates an event handler that toggles all rows expanded.
|
|
95
95
|
*
|
|
96
|
-
* React-style synthetic events are persisted when present before the table state
|
|
97
|
-
* is toggled.
|
|
98
|
-
*
|
|
99
96
|
* @example
|
|
100
97
|
* ```ts
|
|
101
98
|
* const onClick = table_getToggleAllRowsExpandedHandler(table)
|
|
102
99
|
* ```
|
|
103
100
|
*/
|
|
104
101
|
function table_getToggleAllRowsExpandedHandler(table) {
|
|
105
|
-
return (
|
|
106
|
-
e.persist?.();
|
|
102
|
+
return (_e) => {
|
|
107
103
|
table_toggleAllRowsExpanded(table);
|
|
108
104
|
};
|
|
109
105
|
}
|