@tanstack/table-core 9.0.0-beta.47 → 9.0.0-beta.49
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/row-models/coreRowModelsFeature.types.d.cts +1 -1
- package/dist/core/row-models/coreRowModelsFeature.types.d.ts +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.js +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
- package/dist/features/aggregation/aggregationFeature.cjs +38 -0
- package/dist/features/aggregation/aggregationFeature.cjs.map +1 -0
- package/dist/features/aggregation/aggregationFeature.d.cts +10 -0
- package/dist/features/aggregation/aggregationFeature.d.ts +10 -0
- package/dist/features/aggregation/aggregationFeature.js +38 -0
- package/dist/features/aggregation/aggregationFeature.js.map +1 -0
- package/dist/features/aggregation/aggregationFeature.types.cjs +13 -0
- package/dist/features/aggregation/aggregationFeature.types.cjs.map +1 -0
- package/dist/features/aggregation/aggregationFeature.types.d.cts +172 -0
- package/dist/features/aggregation/aggregationFeature.types.d.ts +172 -0
- package/dist/features/aggregation/aggregationFeature.types.js +12 -0
- package/dist/features/aggregation/aggregationFeature.types.js.map +1 -0
- package/dist/features/aggregation/aggregationFeature.utils.cjs +198 -0
- package/dist/features/aggregation/aggregationFeature.utils.cjs.map +1 -0
- package/dist/features/aggregation/aggregationFeature.utils.d.cts +33 -0
- package/dist/features/aggregation/aggregationFeature.utils.d.ts +33 -0
- package/dist/features/aggregation/aggregationFeature.utils.js +192 -0
- package/dist/features/aggregation/aggregationFeature.utils.js.map +1 -0
- package/dist/features/aggregation/aggregationFns.cjs +240 -0
- package/dist/features/aggregation/aggregationFns.cjs.map +1 -0
- package/dist/features/aggregation/aggregationFns.d.cts +67 -0
- package/dist/features/aggregation/aggregationFns.d.ts +67 -0
- package/dist/features/aggregation/aggregationFns.js +229 -0
- package/dist/features/aggregation/aggregationFns.js.map +1 -0
- package/dist/features/column-faceting/createFacetedMinMaxValues.cjs +7 -4
- package/dist/features/column-faceting/createFacetedMinMaxValues.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedMinMaxValues.js +8 -5
- package/dist/features/column-faceting/createFacetedMinMaxValues.js.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.cjs +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.js +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.cjs +8 -4
- package/dist/features/column-faceting/createFacetedUniqueValues.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.js +9 -5
- package/dist/features/column-faceting/createFacetedUniqueValues.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +1 -1
- package/dist/{fns → features/column-filtering}/filterFns.cjs +1 -1
- package/dist/features/column-filtering/filterFns.cjs.map +1 -0
- package/dist/{fns → features/column-filtering}/filterFns.d.cts +4 -4
- package/dist/{fns → features/column-filtering}/filterFns.d.ts +4 -4
- package/dist/{fns → features/column-filtering}/filterFns.js +1 -1
- package/dist/features/column-filtering/filterFns.js.map +1 -0
- package/dist/features/column-grouping/columnGroupingFeature.cjs +3 -12
- package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.d.cts +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.d.ts +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.js +4 -13
- package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +6 -87
- package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +6 -87
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +0 -64
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +2 -44
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +2 -44
- package/dist/features/column-grouping/columnGroupingFeature.utils.js +2 -63
- package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.cjs +23 -16
- package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.d.cts +2 -6
- package/dist/features/column-grouping/createGroupedRowModel.d.ts +2 -6
- package/dist/features/column-grouping/createGroupedRowModel.js +25 -18
- package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.js +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.types.d.cts +1 -1
- package/dist/features/row-sorting/rowSortingFeature.types.d.ts +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.js +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
- package/dist/{fns → features/row-sorting}/sortFns.cjs +1 -1
- package/dist/{fns/sortFns.js.map → features/row-sorting/sortFns.cjs.map} +1 -1
- package/dist/{fns → features/row-sorting}/sortFns.d.cts +4 -4
- package/dist/{fns → features/row-sorting}/sortFns.d.ts +4 -4
- package/dist/{fns → features/row-sorting}/sortFns.js +1 -1
- package/dist/features/row-sorting/sortFns.js.map +1 -0
- package/dist/features/stockFeatures.cjs +2 -0
- package/dist/features/stockFeatures.cjs.map +1 -1
- package/dist/features/stockFeatures.d.cts +2 -0
- package/dist/features/stockFeatures.d.ts +2 -0
- package/dist/features/stockFeatures.js +2 -0
- package/dist/features/stockFeatures.js.map +1 -1
- package/dist/index.cjs +7 -4
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +6 -4
- package/dist/static-functions.cjs +8 -3
- package/dist/static-functions.d.cts +3 -2
- package/dist/static-functions.d.ts +3 -2
- package/dist/static-functions.js +3 -2
- package/dist/types/Cell.d.cts +3 -1
- package/dist/types/Cell.d.ts +3 -1
- package/dist/types/Column.d.cts +4 -2
- package/dist/types/Column.d.ts +4 -2
- package/dist/types/ColumnDef.d.cts +5 -3
- package/dist/types/ColumnDef.d.ts +5 -3
- package/dist/types/Row.d.cts +3 -1
- package/dist/types/Row.d.ts +3 -1
- package/dist/types/RowModel.d.cts +1 -1
- package/dist/types/RowModel.d.ts +1 -1
- package/dist/types/RowModelFns.d.cts +3 -3
- package/dist/types/RowModelFns.d.ts +3 -3
- package/dist/types/Table.d.cts +1 -1
- package/dist/types/Table.d.ts +1 -1
- package/dist/types/TableFeatures.d.cts +4 -4
- package/dist/types/TableFeatures.d.ts +4 -4
- package/dist/types/TableOptions.d.cts +5 -3
- package/dist/types/TableOptions.d.ts +5 -3
- package/dist/types/TableState.d.cts +1 -1
- package/dist/types/TableState.d.ts +1 -1
- package/dist/worker/initTableWorker.cjs.map +1 -1
- package/dist/worker/initTableWorker.js.map +1 -1
- package/package.json +1 -1
- package/skills/aggregation/SKILL.md +131 -0
- 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 +12 -18
- package/skills/migrate-v8-to-v9/SKILL.md +15 -2
- 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 +5 -2
- package/skills/typescript/SKILL.md +1 -1
- package/src/core/row-models/coreRowModelsFeature.utils.ts +1 -1
- package/src/features/aggregation/aggregationFeature.ts +59 -0
- package/src/features/aggregation/aggregationFeature.types.ts +312 -0
- package/src/features/aggregation/aggregationFeature.utils.ts +401 -0
- package/src/features/aggregation/aggregationFns.ts +336 -0
- package/src/features/column-faceting/createFacetedMinMaxValues.ts +33 -7
- package/src/features/column-faceting/createFacetedRowModel.ts +4 -1
- package/src/features/column-faceting/createFacetedUniqueValues.ts +45 -11
- package/src/features/column-filtering/columnFilteringFeature.types.ts +1 -1
- package/src/{fns → features/column-filtering}/filterFns.ts +4 -4
- package/src/features/column-grouping/columnGroupingFeature.ts +1 -20
- package/src/features/column-grouping/columnGroupingFeature.types.ts +4 -141
- package/src/features/column-grouping/columnGroupingFeature.utils.ts +1 -122
- package/src/features/column-grouping/createGroupedRowModel.ts +32 -41
- package/src/features/global-filtering/globalFilteringFeature.utils.ts +1 -1
- package/src/features/row-sorting/rowSortingFeature.types.ts +1 -1
- package/src/features/row-sorting/rowSortingFeature.utils.ts +1 -1
- package/src/{fns → features/row-sorting}/sortFns.ts +4 -7
- package/src/features/stockFeatures.ts +3 -0
- package/src/index.ts +7 -8
- package/src/static-functions.ts +1 -0
- package/src/types/Cell.ts +2 -0
- package/src/types/Column.ts +3 -1
- package/src/types/ColumnDef.ts +6 -3
- package/src/types/Row.ts +2 -0
- package/src/types/RowModelFns.ts +3 -3
- package/src/types/TableFeatures.ts +4 -4
- package/src/types/TableOptions.ts +5 -1
- package/src/worker/initTableWorker.ts +1 -1
- package/dist/fns/aggregationFns.cjs +0 -234
- package/dist/fns/aggregationFns.cjs.map +0 -1
- package/dist/fns/aggregationFns.d.cts +0 -139
- package/dist/fns/aggregationFns.d.ts +0 -139
- package/dist/fns/aggregationFns.js +0 -221
- package/dist/fns/aggregationFns.js.map +0 -1
- package/dist/fns/filterFns.cjs.map +0 -1
- package/dist/fns/filterFns.js.map +0 -1
- package/dist/fns/sortFns.cjs.map +0 -1
- package/src/fns/aggregationFns.ts +0 -303
package/dist/types/Column.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { RowData } from "./type-utils.cjs";
|
|
2
|
+
import { Column_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
2
3
|
import { Column_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
|
|
3
4
|
import { Column_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.cjs";
|
|
4
5
|
import { Column_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.cjs";
|
|
5
6
|
import { Column_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.cjs";
|
|
6
7
|
import { Column_RowSorting } from "../features/row-sorting/rowSortingFeature.types.cjs";
|
|
7
8
|
import { ColumnDefBase_All } from "./ColumnDef.cjs";
|
|
8
|
-
import {
|
|
9
|
+
import { Column_Aggregation } from "../features/aggregation/aggregationFeature.types.cjs";
|
|
9
10
|
import { Column_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.cjs";
|
|
10
11
|
import { Column_ColumnFiltering } from "../features/column-filtering/columnFilteringFeature.types.cjs";
|
|
11
12
|
import { Column_ColumnFaceting } from "../features/column-faceting/columnFacetingFeature.types.cjs";
|
|
@@ -17,9 +18,10 @@ import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.cjs";
|
|
|
17
18
|
//#region src/types/Column.d.ts
|
|
18
19
|
interface Column_Core<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue = unknown> extends Column_Column<TFeatures, TData, TValue> {}
|
|
19
20
|
interface Column_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
21
|
+
aggregationFeature: Column_Aggregation<TFeatures, TData>;
|
|
20
22
|
columnFacetingFeature: Column_ColumnFaceting<TFeatures, TData>;
|
|
21
23
|
columnFilteringFeature: Column_ColumnFiltering<TFeatures, TData>;
|
|
22
|
-
columnGroupingFeature: Column_ColumnGrouping
|
|
24
|
+
columnGroupingFeature: Column_ColumnGrouping;
|
|
23
25
|
columnOrderingFeature: Column_ColumnOrdering;
|
|
24
26
|
columnPinningFeature: Column_ColumnPinning;
|
|
25
27
|
columnResizingFeature: Column_ColumnResizing;
|
package/dist/types/Column.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { RowData } from "./type-utils.js";
|
|
2
|
+
import { Column_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
2
3
|
import { Column_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
|
|
3
4
|
import { Column_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.js";
|
|
4
5
|
import { Column_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.js";
|
|
5
6
|
import { Column_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.js";
|
|
6
7
|
import { Column_RowSorting } from "../features/row-sorting/rowSortingFeature.types.js";
|
|
7
8
|
import { ColumnDefBase_All } from "./ColumnDef.js";
|
|
8
|
-
import {
|
|
9
|
+
import { Column_Aggregation } from "../features/aggregation/aggregationFeature.types.js";
|
|
9
10
|
import { Column_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
|
|
10
11
|
import { Column_ColumnFiltering } from "../features/column-filtering/columnFilteringFeature.types.js";
|
|
11
12
|
import { Column_ColumnFaceting } from "../features/column-faceting/columnFacetingFeature.types.js";
|
|
@@ -17,9 +18,10 @@ import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.js";
|
|
|
17
18
|
//#region src/types/Column.d.ts
|
|
18
19
|
interface Column_Core<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue = unknown> extends Column_Column<TFeatures, TData, TValue> {}
|
|
19
20
|
interface Column_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
21
|
+
aggregationFeature: Column_Aggregation<TFeatures, TData>;
|
|
20
22
|
columnFacetingFeature: Column_ColumnFaceting<TFeatures, TData>;
|
|
21
23
|
columnFilteringFeature: Column_ColumnFiltering<TFeatures, TData>;
|
|
22
|
-
columnGroupingFeature: Column_ColumnGrouping
|
|
24
|
+
columnGroupingFeature: Column_ColumnGrouping;
|
|
23
25
|
columnOrderingFeature: Column_ColumnOrdering;
|
|
24
26
|
columnPinningFeature: Column_ColumnPinning;
|
|
25
27
|
columnResizingFeature: Column_ColumnResizing;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CellData, RowData, UnionToIntersection } from "./type-utils.cjs";
|
|
2
|
+
import { ColumnDef_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
2
3
|
import { CellContext } from "../core/cells/coreCellsFeature.types.cjs";
|
|
3
4
|
import { ColumnDef_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
|
|
4
5
|
import { ColumnDef_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.cjs";
|
|
@@ -6,7 +7,7 @@ import { ColumnDef_ColumnResizing } from "../features/column-resizing/columnResi
|
|
|
6
7
|
import { HeaderContext } from "../core/headers/coreHeadersFeature.types.cjs";
|
|
7
8
|
import { ColumnDef_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.cjs";
|
|
8
9
|
import { ColumnDef_RowSorting } from "../features/row-sorting/rowSortingFeature.types.cjs";
|
|
9
|
-
import {
|
|
10
|
+
import { ColumnDef_Aggregation } from "../features/aggregation/aggregationFeature.types.cjs";
|
|
10
11
|
import { ColumnDef_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.cjs";
|
|
11
12
|
import { ColumnDef_ColumnFiltering } from "../features/column-filtering/columnFilteringFeature.types.cjs";
|
|
12
13
|
import { ExtractFeatureMapTypes, IsAny, TableFeatures } from "./TableFeatures.cjs";
|
|
@@ -84,17 +85,18 @@ interface ColumnDefBase_Core<TFeatures extends TableFeatures, TData extends RowD
|
|
|
84
85
|
meta?: ExtractColumnMeta<TFeatures, TData, TValue>;
|
|
85
86
|
}
|
|
86
87
|
interface ColumnDef_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData> {
|
|
88
|
+
aggregationFeature: ColumnDef_Aggregation<TFeatures, TData, TValue>;
|
|
87
89
|
columnVisibilityFeature: ColumnDef_ColumnVisibility;
|
|
88
90
|
columnPinningFeature: ColumnDef_ColumnPinning;
|
|
89
91
|
columnFilteringFeature: ColumnDef_ColumnFiltering<TFeatures, TData>;
|
|
90
92
|
globalFilteringFeature: ColumnDef_GlobalFiltering;
|
|
91
93
|
rowSortingFeature: ColumnDef_RowSorting<TFeatures, TData>;
|
|
92
|
-
columnGroupingFeature: ColumnDef_ColumnGrouping<TFeatures, TData
|
|
94
|
+
columnGroupingFeature: ColumnDef_ColumnGrouping<TFeatures, TData>;
|
|
93
95
|
columnSizingFeature: ColumnDef_ColumnSizing;
|
|
94
96
|
columnResizingFeature: ColumnDef_ColumnResizing;
|
|
95
97
|
}
|
|
96
98
|
type ColumnDefBase<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase_Core<TFeatures, TData, TValue> & ExtractFeatureMapTypes<TFeatures, ColumnDef_FeatureMap<TFeatures, TData, TValue>>;
|
|
97
|
-
type ColumnDefBase_All<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase_Core<TFeatures, TData, TValue> & Partial<ColumnDef_ColumnVisibility & ColumnDef_ColumnPinning & ColumnDef_ColumnFiltering<TFeatures, TData> & ColumnDef_GlobalFiltering & ColumnDef_RowSorting<TFeatures, TData> & ColumnDef_ColumnGrouping<TFeatures, TData
|
|
99
|
+
type ColumnDefBase_All<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase_Core<TFeatures, TData, TValue> & Partial<ColumnDef_Aggregation<TFeatures, TData, TValue> & ColumnDef_ColumnVisibility & ColumnDef_ColumnPinning & ColumnDef_ColumnFiltering<TFeatures, TData> & ColumnDef_GlobalFiltering & ColumnDef_RowSorting<TFeatures, TData> & ColumnDef_ColumnGrouping<TFeatures, TData> & ColumnDef_ColumnSizing & ColumnDef_ColumnResizing>;
|
|
98
100
|
type IdentifiedColumnDef<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase<TFeatures, TData, TValue> & {
|
|
99
101
|
id?: string;
|
|
100
102
|
header?: StringOrTemplateHeader<TFeatures, TData, TValue>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CellData, RowData, UnionToIntersection } from "./type-utils.js";
|
|
2
|
+
import { ColumnDef_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
2
3
|
import { CellContext } from "../core/cells/coreCellsFeature.types.js";
|
|
3
4
|
import { ColumnDef_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
|
|
4
5
|
import { ColumnDef_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.js";
|
|
@@ -6,7 +7,7 @@ import { ColumnDef_ColumnResizing } from "../features/column-resizing/columnResi
|
|
|
6
7
|
import { HeaderContext } from "../core/headers/coreHeadersFeature.types.js";
|
|
7
8
|
import { ColumnDef_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.js";
|
|
8
9
|
import { ColumnDef_RowSorting } from "../features/row-sorting/rowSortingFeature.types.js";
|
|
9
|
-
import {
|
|
10
|
+
import { ColumnDef_Aggregation } from "../features/aggregation/aggregationFeature.types.js";
|
|
10
11
|
import { ColumnDef_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
|
|
11
12
|
import { ColumnDef_ColumnFiltering } from "../features/column-filtering/columnFilteringFeature.types.js";
|
|
12
13
|
import { ExtractFeatureMapTypes, IsAny, TableFeatures } from "./TableFeatures.js";
|
|
@@ -84,17 +85,18 @@ interface ColumnDefBase_Core<TFeatures extends TableFeatures, TData extends RowD
|
|
|
84
85
|
meta?: ExtractColumnMeta<TFeatures, TData, TValue>;
|
|
85
86
|
}
|
|
86
87
|
interface ColumnDef_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData> {
|
|
88
|
+
aggregationFeature: ColumnDef_Aggregation<TFeatures, TData, TValue>;
|
|
87
89
|
columnVisibilityFeature: ColumnDef_ColumnVisibility;
|
|
88
90
|
columnPinningFeature: ColumnDef_ColumnPinning;
|
|
89
91
|
columnFilteringFeature: ColumnDef_ColumnFiltering<TFeatures, TData>;
|
|
90
92
|
globalFilteringFeature: ColumnDef_GlobalFiltering;
|
|
91
93
|
rowSortingFeature: ColumnDef_RowSorting<TFeatures, TData>;
|
|
92
|
-
columnGroupingFeature: ColumnDef_ColumnGrouping<TFeatures, TData
|
|
94
|
+
columnGroupingFeature: ColumnDef_ColumnGrouping<TFeatures, TData>;
|
|
93
95
|
columnSizingFeature: ColumnDef_ColumnSizing;
|
|
94
96
|
columnResizingFeature: ColumnDef_ColumnResizing;
|
|
95
97
|
}
|
|
96
98
|
type ColumnDefBase<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase_Core<TFeatures, TData, TValue> & ExtractFeatureMapTypes<TFeatures, ColumnDef_FeatureMap<TFeatures, TData, TValue>>;
|
|
97
|
-
type ColumnDefBase_All<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase_Core<TFeatures, TData, TValue> & Partial<ColumnDef_ColumnVisibility & ColumnDef_ColumnPinning & ColumnDef_ColumnFiltering<TFeatures, TData> & ColumnDef_GlobalFiltering & ColumnDef_RowSorting<TFeatures, TData> & ColumnDef_ColumnGrouping<TFeatures, TData
|
|
99
|
+
type ColumnDefBase_All<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase_Core<TFeatures, TData, TValue> & Partial<ColumnDef_Aggregation<TFeatures, TData, TValue> & ColumnDef_ColumnVisibility & ColumnDef_ColumnPinning & ColumnDef_ColumnFiltering<TFeatures, TData> & ColumnDef_GlobalFiltering & ColumnDef_RowSorting<TFeatures, TData> & ColumnDef_ColumnGrouping<TFeatures, TData> & ColumnDef_ColumnSizing & ColumnDef_ColumnResizing>;
|
|
98
100
|
type IdentifiedColumnDef<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = ColumnDefBase<TFeatures, TData, TValue> & {
|
|
99
101
|
id?: string;
|
|
100
102
|
header?: StringOrTemplateHeader<TFeatures, TData, TValue>;
|
package/dist/types/Row.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RowData } from "./type-utils.cjs";
|
|
2
|
-
import { Row_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
|
|
3
2
|
import { Row_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
3
|
+
import { Row_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
|
|
4
|
+
import { Row_Aggregation } from "../features/aggregation/aggregationFeature.types.cjs";
|
|
4
5
|
import { Row_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.cjs";
|
|
5
6
|
import { Row_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.cjs";
|
|
6
7
|
import { Row_RowPinning } from "../features/row-pinning/rowPinningFeature.types.cjs";
|
|
@@ -12,6 +13,7 @@ import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.cjs";
|
|
|
12
13
|
//#region src/types/Row.d.ts
|
|
13
14
|
interface Row_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Row_Row<TFeatures, TData> {}
|
|
14
15
|
interface Row_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
16
|
+
aggregationFeature: Row_Aggregation;
|
|
15
17
|
columnFilteringFeature: Row_ColumnFiltering<TFeatures, TData>;
|
|
16
18
|
columnGroupingFeature: Row_ColumnGrouping;
|
|
17
19
|
columnPinningFeature: Row_ColumnPinning<TFeatures, TData>;
|
package/dist/types/Row.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RowData } from "./type-utils.js";
|
|
2
|
-
import { Row_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
|
|
3
2
|
import { Row_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
3
|
+
import { Row_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
|
|
4
|
+
import { Row_Aggregation } from "../features/aggregation/aggregationFeature.types.js";
|
|
4
5
|
import { Row_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
|
|
5
6
|
import { Row_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.js";
|
|
6
7
|
import { Row_RowPinning } from "../features/row-pinning/rowPinningFeature.types.js";
|
|
@@ -12,6 +13,7 @@ import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.js";
|
|
|
12
13
|
//#region src/types/Row.d.ts
|
|
13
14
|
interface Row_Core<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Row_Row<TFeatures, TData> {}
|
|
14
15
|
interface Row_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
16
|
+
aggregationFeature: Row_Aggregation;
|
|
15
17
|
columnFilteringFeature: Row_ColumnFiltering<TFeatures, TData>;
|
|
16
18
|
columnGroupingFeature: Row_ColumnGrouping;
|
|
17
19
|
columnPinningFeature: Row_ColumnPinning<TFeatures, TData>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "./type-utils.cjs";
|
|
2
|
-
import { CachedRowModel_Sorted } from "../features/row-sorting/rowSortingFeature.types.cjs";
|
|
3
2
|
import { CachedRowModel_Grouped } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
3
|
+
import { CachedRowModel_Sorted } from "../features/row-sorting/rowSortingFeature.types.cjs";
|
|
4
4
|
import { CachedRowModel_Expanded } from "../features/row-expanding/rowExpandingFeature.types.cjs";
|
|
5
5
|
import { CachedRowModel_Filtered } from "../features/column-filtering/columnFilteringFeature.types.cjs";
|
|
6
6
|
import { CachedRowModel_Paginated } from "../features/row-pagination/rowPaginationFeature.types.cjs";
|
package/dist/types/RowModel.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "./type-utils.js";
|
|
2
|
-
import { CachedRowModel_Sorted } from "../features/row-sorting/rowSortingFeature.types.js";
|
|
3
2
|
import { CachedRowModel_Grouped } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
3
|
+
import { CachedRowModel_Sorted } from "../features/row-sorting/rowSortingFeature.types.js";
|
|
4
4
|
import { CachedRowModel_Expanded } from "../features/row-expanding/rowExpandingFeature.types.js";
|
|
5
5
|
import { CachedRowModel_Filtered } from "../features/column-filtering/columnFilteringFeature.types.js";
|
|
6
6
|
import { CachedRowModel_Paginated } from "../features/row-pagination/rowPaginationFeature.types.js";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { RowData } from "./type-utils.cjs";
|
|
2
2
|
import { RowModelFns_RowSorting } from "../features/row-sorting/rowSortingFeature.types.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { RowModelFns_Aggregation } from "../features/aggregation/aggregationFeature.types.cjs";
|
|
4
4
|
import { RowModelFns_ColumnFiltering } from "../features/column-filtering/columnFilteringFeature.types.cjs";
|
|
5
5
|
import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/types/RowModelFns.d.ts
|
|
8
8
|
interface RowModelFns_Core {}
|
|
9
9
|
interface RowModelFns_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
10
|
+
aggregationFeature: RowModelFns_Aggregation<TFeatures, TData>;
|
|
10
11
|
columnFilteringFeature: RowModelFns_ColumnFiltering<TFeatures, TData>;
|
|
11
|
-
columnGroupingFeature: RowModelFns_ColumnGrouping<TFeatures, TData>;
|
|
12
12
|
rowSortingFeature: RowModelFns_RowSorting<TFeatures, TData>;
|
|
13
13
|
}
|
|
14
14
|
type RowModelFns<TFeatures extends TableFeatures, TData extends RowData> = Partial<ExtractFeatureMapTypes<TFeatures, RowModelFns_FeatureMap<TFeatures, TData>>>;
|
|
15
|
-
interface RowModelFns_All<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Partial<RowModelFns_ColumnFiltering<TFeatures, TData> &
|
|
15
|
+
interface RowModelFns_All<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Partial<RowModelFns_ColumnFiltering<TFeatures, TData> & RowModelFns_Aggregation<TFeatures, TData> & RowModelFns_RowSorting<TFeatures, TData>> {}
|
|
16
16
|
//#endregion
|
|
17
17
|
export { RowModelFns, RowModelFns_All, RowModelFns_Core, RowModelFns_FeatureMap };
|
|
18
18
|
//# sourceMappingURL=RowModelFns.d.cts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { RowData } from "./type-utils.js";
|
|
2
2
|
import { RowModelFns_RowSorting } from "../features/row-sorting/rowSortingFeature.types.js";
|
|
3
|
-
import {
|
|
3
|
+
import { RowModelFns_Aggregation } from "../features/aggregation/aggregationFeature.types.js";
|
|
4
4
|
import { RowModelFns_ColumnFiltering } from "../features/column-filtering/columnFilteringFeature.types.js";
|
|
5
5
|
import { ExtractFeatureMapTypes, TableFeatures } from "./TableFeatures.js";
|
|
6
6
|
|
|
7
7
|
//#region src/types/RowModelFns.d.ts
|
|
8
8
|
interface RowModelFns_Core {}
|
|
9
9
|
interface RowModelFns_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
10
|
+
aggregationFeature: RowModelFns_Aggregation<TFeatures, TData>;
|
|
10
11
|
columnFilteringFeature: RowModelFns_ColumnFiltering<TFeatures, TData>;
|
|
11
|
-
columnGroupingFeature: RowModelFns_ColumnGrouping<TFeatures, TData>;
|
|
12
12
|
rowSortingFeature: RowModelFns_RowSorting<TFeatures, TData>;
|
|
13
13
|
}
|
|
14
14
|
type RowModelFns<TFeatures extends TableFeatures, TData extends RowData> = Partial<ExtractFeatureMapTypes<TFeatures, RowModelFns_FeatureMap<TFeatures, TData>>>;
|
|
15
|
-
interface RowModelFns_All<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Partial<RowModelFns_ColumnFiltering<TFeatures, TData> &
|
|
15
|
+
interface RowModelFns_All<in out TFeatures extends TableFeatures, in out TData extends RowData> extends Partial<RowModelFns_ColumnFiltering<TFeatures, TData> & RowModelFns_Aggregation<TFeatures, TData> & RowModelFns_RowSorting<TFeatures, TData>> {}
|
|
16
16
|
//#endregion
|
|
17
17
|
export { RowModelFns, RowModelFns_All, RowModelFns_Core, RowModelFns_FeatureMap };
|
|
18
18
|
//# sourceMappingURL=RowModelFns.d.ts.map
|
package/dist/types/Table.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RowData } from "./type-utils.cjs";
|
|
2
|
+
import { Table_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
2
3
|
import { Table_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
|
|
3
4
|
import { Table_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.cjs";
|
|
4
5
|
import { Table_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.cjs";
|
|
5
6
|
import { Table_Headers } from "../core/headers/coreHeadersFeature.types.cjs";
|
|
6
7
|
import { Table_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.cjs";
|
|
7
8
|
import { Table_RowSorting } from "../features/row-sorting/rowSortingFeature.types.cjs";
|
|
8
|
-
import { Table_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
9
9
|
import { Table_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.cjs";
|
|
10
10
|
import { Table_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.cjs";
|
|
11
11
|
import { Table_RowPinning } from "../features/row-pinning/rowPinningFeature.types.cjs";
|
package/dist/types/Table.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RowData } from "./type-utils.js";
|
|
2
|
+
import { Table_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
2
3
|
import { Table_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
|
|
3
4
|
import { Table_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.js";
|
|
4
5
|
import { Table_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.js";
|
|
5
6
|
import { Table_Headers } from "../core/headers/coreHeadersFeature.types.js";
|
|
6
7
|
import { Table_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.js";
|
|
7
8
|
import { Table_RowSorting } from "../features/row-sorting/rowSortingFeature.types.js";
|
|
8
|
-
import { Table_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
9
9
|
import { Table_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
|
|
10
10
|
import { Table_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.js";
|
|
11
11
|
import { Table_RowPinning } from "../features/row-pinning/rowPinningFeature.types.js";
|
|
@@ -2,7 +2,7 @@ import { CellData, RowData, UnionToIntersection } from "./type-utils.cjs";
|
|
|
2
2
|
import { CoreFeatures } from "../core/coreFeatures.cjs";
|
|
3
3
|
import { SortFn } from "../features/row-sorting/rowSortingFeature.types.cjs";
|
|
4
4
|
import { ColumnDefBase_All } from "./ColumnDef.cjs";
|
|
5
|
-
import {
|
|
5
|
+
import { AggregationFnDef } from "../features/aggregation/aggregationFeature.types.cjs";
|
|
6
6
|
import { Row } from "./Row.cjs";
|
|
7
7
|
import { FilterFn } from "../features/column-filtering/columnFilteringFeature.types.cjs";
|
|
8
8
|
import { RowModel } from "../core/row-models/coreRowModelsFeature.types.cjs";
|
|
@@ -61,9 +61,9 @@ type NonFeatureKeys = 'aggregationFns' | 'columnMeta' | 'coreRowModel' | 'expand
|
|
|
61
61
|
*/
|
|
62
62
|
interface FeatureSlotPrereqs {
|
|
63
63
|
/**
|
|
64
|
-
* Named aggregation functions
|
|
64
|
+
* Named aggregation functions require the independent aggregation feature.
|
|
65
65
|
*/
|
|
66
|
-
aggregationFns: '
|
|
66
|
+
aggregationFns: 'aggregationFeature';
|
|
67
67
|
/**
|
|
68
68
|
* Column resizing builds on the column sizing state and APIs.
|
|
69
69
|
*/
|
|
@@ -146,7 +146,7 @@ interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, P
|
|
|
146
146
|
* Spreading the exported `aggregationFns` registry also works, but puts
|
|
147
147
|
* every built-in aggregation function in your bundle.
|
|
148
148
|
*/
|
|
149
|
-
aggregationFns?: Record<string,
|
|
149
|
+
aggregationFns?: Record<string, AggregationFnDef<any, any, any, any>>;
|
|
150
150
|
/**
|
|
151
151
|
* Type-only slot for declaring the type of `columnDef.meta` for all columns
|
|
152
152
|
* of this table.
|
|
@@ -2,7 +2,7 @@ import { CellData, RowData, UnionToIntersection } from "./type-utils.js";
|
|
|
2
2
|
import { CoreFeatures } from "../core/coreFeatures.js";
|
|
3
3
|
import { SortFn } from "../features/row-sorting/rowSortingFeature.types.js";
|
|
4
4
|
import { ColumnDefBase_All } from "./ColumnDef.js";
|
|
5
|
-
import {
|
|
5
|
+
import { AggregationFnDef } from "../features/aggregation/aggregationFeature.types.js";
|
|
6
6
|
import { Row } from "./Row.js";
|
|
7
7
|
import { FilterFn } from "../features/column-filtering/columnFilteringFeature.types.js";
|
|
8
8
|
import { RowModel } from "../core/row-models/coreRowModelsFeature.types.js";
|
|
@@ -61,9 +61,9 @@ type NonFeatureKeys = 'aggregationFns' | 'columnMeta' | 'coreRowModel' | 'expand
|
|
|
61
61
|
*/
|
|
62
62
|
interface FeatureSlotPrereqs {
|
|
63
63
|
/**
|
|
64
|
-
* Named aggregation functions
|
|
64
|
+
* Named aggregation functions require the independent aggregation feature.
|
|
65
65
|
*/
|
|
66
|
-
aggregationFns: '
|
|
66
|
+
aggregationFns: 'aggregationFeature';
|
|
67
67
|
/**
|
|
68
68
|
* Column resizing builds on the column sizing state and APIs.
|
|
69
69
|
*/
|
|
@@ -146,7 +146,7 @@ interface TableFeatures extends Partial<CoreFeatures>, Partial<StockFeatures>, P
|
|
|
146
146
|
* Spreading the exported `aggregationFns` registry also works, but puts
|
|
147
147
|
* every built-in aggregation function in your bundle.
|
|
148
148
|
*/
|
|
149
|
-
aggregationFns?: Record<string,
|
|
149
|
+
aggregationFns?: Record<string, AggregationFnDef<any, any, any, any>>;
|
|
150
150
|
/**
|
|
151
151
|
* Type-only slot for declaring the type of `columnDef.meta` for all columns
|
|
152
152
|
* of this table.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { RowData, UnionToIntersection } from "./type-utils.cjs";
|
|
2
2
|
import { CoreFeatures } from "../core/coreFeatures.cjs";
|
|
3
|
+
import { TableOptions_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
3
4
|
import { TableOptions_Cell } from "../core/cells/coreCellsFeature.types.cjs";
|
|
4
5
|
import { TableOptions_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
|
|
5
6
|
import { TableOptions_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.cjs";
|
|
6
7
|
import { TableOptions_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.cjs";
|
|
7
8
|
import { TableOptions_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.cjs";
|
|
8
9
|
import { TableOptions_RowSorting } from "../features/row-sorting/rowSortingFeature.types.cjs";
|
|
9
|
-
import {
|
|
10
|
+
import { TableOptions_Aggregation } from "../features/aggregation/aggregationFeature.types.cjs";
|
|
10
11
|
import { TableOptions_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.cjs";
|
|
11
12
|
import { TableOptions_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.cjs";
|
|
12
13
|
import { TableOptions_RowPinning } from "../features/row-pinning/rowPinningFeature.types.cjs";
|
|
@@ -36,6 +37,7 @@ type DebugOptions<TFeatures extends TableFeatures> = {
|
|
|
36
37
|
debugTable?: boolean;
|
|
37
38
|
} & DebugKeysFor<CoreFeatures & TFeatures>;
|
|
38
39
|
interface TableOptions_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
40
|
+
aggregationFeature: TableOptions_Aggregation;
|
|
39
41
|
columnFilteringFeature: TableOptions_ColumnFiltering<TFeatures, TData>;
|
|
40
42
|
columnGroupingFeature: TableOptions_ColumnGrouping;
|
|
41
43
|
columnOrderingFeature: TableOptions_ColumnOrdering;
|
|
@@ -50,7 +52,7 @@ interface TableOptions_FeatureMap<in out TFeatures extends TableFeatures, in out
|
|
|
50
52
|
rowSelectionFeature: TableOptions_RowSelection<TFeatures, TData>;
|
|
51
53
|
rowSortingFeature: TableOptions_RowSorting;
|
|
52
54
|
}
|
|
53
|
-
type TableOptions_StockFeatureKeys = 'columnFilteringFeature' | 'columnGroupingFeature' | 'columnOrderingFeature' | 'columnPinningFeature' | 'columnResizingFeature' | 'columnSizingFeature' | 'columnVisibilityFeature' | 'globalFilteringFeature' | 'rowExpandingFeature' | 'rowPaginationFeature' | 'rowPinningFeature' | 'rowSelectionFeature' | 'rowSortingFeature';
|
|
55
|
+
type TableOptions_StockFeatureKeys = 'aggregationFeature' | 'columnFilteringFeature' | 'columnGroupingFeature' | 'columnOrderingFeature' | 'columnPinningFeature' | 'columnResizingFeature' | 'columnSizingFeature' | 'columnVisibilityFeature' | 'globalFilteringFeature' | 'rowExpandingFeature' | 'rowPaginationFeature' | 'rowPinningFeature' | 'rowSelectionFeature' | 'rowSortingFeature';
|
|
54
56
|
/**
|
|
55
57
|
* Plugin entries declaration-merged into `TableOptions_FeatureMap`, i.e. keys
|
|
56
58
|
* beyond the stock set. Resolves to `unknown` (an intersection no-op) when no
|
|
@@ -69,7 +71,7 @@ type TableOptions<TFeatures extends TableFeatures, TData extends RowData> = Tabl
|
|
|
69
71
|
* Internal broad option shape used where feature code may need to read options
|
|
70
72
|
* from features that are not present in the current generic feature set.
|
|
71
73
|
*/
|
|
72
|
-
type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<TableOptions_ColumnFiltering<TFeatures, TData> & TableOptions_ColumnGrouping & TableOptions_ColumnOrdering & TableOptions_ColumnPinning & TableOptions_ColumnResizing & TableOptions_ColumnSizing & TableOptions_ColumnVisibility & TableOptions_GlobalFiltering<TFeatures, TData> & TableOptions_RowExpanding<TFeatures, TData> & TableOptions_RowPagination & TableOptions_RowPinning<TFeatures, TData> & TableOptions_RowSelection<TFeatures, TData> & TableOptions_RowSorting & TableOptions_PluginFeatureMapTypes<TFeatures, TData>>;
|
|
74
|
+
type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<TableOptions_Aggregation & TableOptions_ColumnFiltering<TFeatures, TData> & TableOptions_ColumnGrouping & TableOptions_ColumnOrdering & TableOptions_ColumnPinning & TableOptions_ColumnResizing & TableOptions_ColumnSizing & TableOptions_ColumnVisibility & TableOptions_GlobalFiltering<TFeatures, TData> & TableOptions_RowExpanding<TFeatures, TData> & TableOptions_RowPagination & TableOptions_RowPinning<TFeatures, TData> & TableOptions_RowSelection<TFeatures, TData> & TableOptions_RowSorting & TableOptions_PluginFeatureMapTypes<TFeatures, TData>>;
|
|
73
75
|
//#endregion
|
|
74
76
|
export { DebugOptions, TableOptions, TableOptions_All, TableOptions_Core, TableOptions_FeatureMap };
|
|
75
77
|
//# sourceMappingURL=TableOptions.d.cts.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { RowData, UnionToIntersection } from "./type-utils.js";
|
|
2
2
|
import { CoreFeatures } from "../core/coreFeatures.js";
|
|
3
|
+
import { TableOptions_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
3
4
|
import { TableOptions_Cell } from "../core/cells/coreCellsFeature.types.js";
|
|
4
5
|
import { TableOptions_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
|
|
5
6
|
import { TableOptions_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.js";
|
|
6
7
|
import { TableOptions_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.js";
|
|
7
8
|
import { TableOptions_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.js";
|
|
8
9
|
import { TableOptions_RowSorting } from "../features/row-sorting/rowSortingFeature.types.js";
|
|
9
|
-
import {
|
|
10
|
+
import { TableOptions_Aggregation } from "../features/aggregation/aggregationFeature.types.js";
|
|
10
11
|
import { TableOptions_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
|
|
11
12
|
import { TableOptions_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.js";
|
|
12
13
|
import { TableOptions_RowPinning } from "../features/row-pinning/rowPinningFeature.types.js";
|
|
@@ -36,6 +37,7 @@ type DebugOptions<TFeatures extends TableFeatures> = {
|
|
|
36
37
|
debugTable?: boolean;
|
|
37
38
|
} & DebugKeysFor<CoreFeatures & TFeatures>;
|
|
38
39
|
interface TableOptions_FeatureMap<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
40
|
+
aggregationFeature: TableOptions_Aggregation;
|
|
39
41
|
columnFilteringFeature: TableOptions_ColumnFiltering<TFeatures, TData>;
|
|
40
42
|
columnGroupingFeature: TableOptions_ColumnGrouping;
|
|
41
43
|
columnOrderingFeature: TableOptions_ColumnOrdering;
|
|
@@ -50,7 +52,7 @@ interface TableOptions_FeatureMap<in out TFeatures extends TableFeatures, in out
|
|
|
50
52
|
rowSelectionFeature: TableOptions_RowSelection<TFeatures, TData>;
|
|
51
53
|
rowSortingFeature: TableOptions_RowSorting;
|
|
52
54
|
}
|
|
53
|
-
type TableOptions_StockFeatureKeys = 'columnFilteringFeature' | 'columnGroupingFeature' | 'columnOrderingFeature' | 'columnPinningFeature' | 'columnResizingFeature' | 'columnSizingFeature' | 'columnVisibilityFeature' | 'globalFilteringFeature' | 'rowExpandingFeature' | 'rowPaginationFeature' | 'rowPinningFeature' | 'rowSelectionFeature' | 'rowSortingFeature';
|
|
55
|
+
type TableOptions_StockFeatureKeys = 'aggregationFeature' | 'columnFilteringFeature' | 'columnGroupingFeature' | 'columnOrderingFeature' | 'columnPinningFeature' | 'columnResizingFeature' | 'columnSizingFeature' | 'columnVisibilityFeature' | 'globalFilteringFeature' | 'rowExpandingFeature' | 'rowPaginationFeature' | 'rowPinningFeature' | 'rowSelectionFeature' | 'rowSortingFeature';
|
|
54
56
|
/**
|
|
55
57
|
* Plugin entries declaration-merged into `TableOptions_FeatureMap`, i.e. keys
|
|
56
58
|
* beyond the stock set. Resolves to `unknown` (an intersection no-op) when no
|
|
@@ -69,7 +71,7 @@ type TableOptions<TFeatures extends TableFeatures, TData extends RowData> = Tabl
|
|
|
69
71
|
* Internal broad option shape used where feature code may need to read options
|
|
70
72
|
* from features that are not present in the current generic feature set.
|
|
71
73
|
*/
|
|
72
|
-
type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<TableOptions_ColumnFiltering<TFeatures, TData> & TableOptions_ColumnGrouping & TableOptions_ColumnOrdering & TableOptions_ColumnPinning & TableOptions_ColumnResizing & TableOptions_ColumnSizing & TableOptions_ColumnVisibility & TableOptions_GlobalFiltering<TFeatures, TData> & TableOptions_RowExpanding<TFeatures, TData> & TableOptions_RowPagination & TableOptions_RowPinning<TFeatures, TData> & TableOptions_RowSelection<TFeatures, TData> & TableOptions_RowSorting & TableOptions_PluginFeatureMapTypes<TFeatures, TData>>;
|
|
74
|
+
type TableOptions_All<TFeatures extends TableFeatures, TData extends RowData> = TableOptions_Core<TFeatures, TData> & Partial<TableOptions_Aggregation & TableOptions_ColumnFiltering<TFeatures, TData> & TableOptions_ColumnGrouping & TableOptions_ColumnOrdering & TableOptions_ColumnPinning & TableOptions_ColumnResizing & TableOptions_ColumnSizing & TableOptions_ColumnVisibility & TableOptions_GlobalFiltering<TFeatures, TData> & TableOptions_RowExpanding<TFeatures, TData> & TableOptions_RowPagination & TableOptions_RowPinning<TFeatures, TData> & TableOptions_RowSelection<TFeatures, TData> & TableOptions_RowSorting & TableOptions_PluginFeatureMapTypes<TFeatures, TData>>;
|
|
73
75
|
//#endregion
|
|
74
76
|
export { DebugOptions, TableOptions, TableOptions_All, TableOptions_Core, TableOptions_FeatureMap };
|
|
75
77
|
//# sourceMappingURL=TableOptions.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { TableState_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
1
2
|
import { TableState_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.cjs";
|
|
2
3
|
import { TableState_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.cjs";
|
|
3
4
|
import { TableState_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.cjs";
|
|
4
5
|
import { TableState_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.cjs";
|
|
5
6
|
import { TableState_RowSorting } from "../features/row-sorting/rowSortingFeature.types.cjs";
|
|
6
|
-
import { TableState_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.cjs";
|
|
7
7
|
import { TableState_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.cjs";
|
|
8
8
|
import { TableState_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.cjs";
|
|
9
9
|
import { TableState_RowPinning } from "../features/row-pinning/rowPinningFeature.types.cjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { TableState_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
1
2
|
import { TableState_ColumnPinning } from "../features/column-pinning/columnPinningFeature.types.js";
|
|
2
3
|
import { TableState_ColumnSizing } from "../features/column-sizing/columnSizingFeature.types.js";
|
|
3
4
|
import { TableState_ColumnResizing } from "../features/column-resizing/columnResizingFeature.types.js";
|
|
4
5
|
import { TableState_GlobalFiltering } from "../features/global-filtering/globalFilteringFeature.types.js";
|
|
5
6
|
import { TableState_RowSorting } from "../features/row-sorting/rowSortingFeature.types.js";
|
|
6
|
-
import { TableState_ColumnGrouping } from "../features/column-grouping/columnGroupingFeature.types.js";
|
|
7
7
|
import { TableState_ColumnVisibility } from "../features/column-visibility/columnVisibilityFeature.types.js";
|
|
8
8
|
import { TableState_RowExpanding } from "../features/row-expanding/rowExpandingFeature.types.js";
|
|
9
9
|
import { TableState_RowPinning } from "../features/row-pinning/rowPinningFeature.types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initTableWorker.cjs","names":["makeObjectMap","constructTable","storeReactivityBindings","serializeRowModel"],"sources":["../../src/worker/initTableWorker.ts"],"sourcesContent":["import { constructTable } from '../core/table/constructTable'\nimport { storeReactivityBindings } from '../store-reactivity-bindings'\nimport { makeObjectMap } from '../utils'\nimport { serializeRowModel } from './serializeRowModel'\nimport type { RowData } from '../types/type-utils'\nimport type { TableFeatures } from '../types/TableFeatures'\nimport type { TableOptions } from '../types/TableOptions'\nimport type { Table_Internal } from '../types/Table'\nimport type {\n TableWorkerRequest,\n TableWorkerResult,\n TableWorkerStage,\n TableWorkerStagePayload,\n} from './tableWorkerProtocol'\n\nexport type TableWorkerConfig<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> = Omit<TableOptions<TFeatures, TData>, 'data'>\n\nfunction capitalize(stage: string) {\n return stage.charAt(0).toUpperCase() + stage.slice(1)\n}\n\n/** Flatten column-group defs to leaf defs (mirrors core's id resolution). */\nfunction flattenColumnDefs(defs: Array<any>): Array<any> {\n return defs.flatMap((def) =>\n def.columns ? flattenColumnDefs(def.columns) : [def],\n )\n}\n\n/**\n * Runs a headless \"shadow table\" inside a dedicated Web Worker.\n *\n * Call this from a user-authored worker entry file, passing the same columns\n * and processing features used on the main thread. The shadow table runs the\n * real table-core row model pipeline (real fns, real Row objects) off the\n * main thread and posts back one payload per stage the main thread requested:\n * a transferable index permutation for flat results, a serialized row tree\n * (with eagerly computed aggregates) when grouping produces synthetic rows.\n *\n * Everything passed here must be thread-portable: `accessorKey` columns or\n * accessors defined in a shared module, and fns from registries or shared\n * modules (no closures over app state).\n *\n * @example\n * ```ts\n * // table.worker.ts\n * import { initTableWorker } from '@tanstack/table-core/experimental-worker-plugin'\n * import { columns, sharedFeatures } from './tableConfig'\n *\n * initTableWorker({ features: sharedFeatures, columns })\n * ```\n */\nexport function initTableWorker<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(config: TableWorkerConfig<TFeatures, TData>): void {\n let table: Table_Internal<TFeatures, TData> | undefined\n let dataVersion = 0\n let coreIndexById: Record<string, number> = makeObjectMap()\n let aggregateColumnIds: Array<string> = []\n // Last-sent model identity per stage: the memoized getters return stable\n // objects when their inputs did not change, so identity equality is exactly\n // \"this stage's result is unchanged\".\n let lastSentModels: { [K in TableWorkerStage]?: unknown } = {}\n\n self.onmessage = (event: MessageEvent<TableWorkerRequest<TData>>) => {\n const message = event.data\n\n if (message.type === 'data') {\n dataVersion = message.dataVersion\n lastSentModels = {}\n if (!table) {\n table = constructTable<TFeatures, TData>({\n ...(config as TableOptions<TFeatures, TData>),\n features: {\n coreReactivityFeature: storeReactivityBindings(),\n ...config.features,\n },\n data: message.data,\n })\n // Only columns with an explicit aggregation get eagerly aggregated\n // per group. Sync tables aggregate lazily (visible cells only), so\n // auto-aggregating every column would explode on high-cardinality\n // grouping for values nothing renders. Read the RAW column defs:\n //
|
|
1
|
+
{"version":3,"file":"initTableWorker.cjs","names":["makeObjectMap","constructTable","storeReactivityBindings","serializeRowModel"],"sources":["../../src/worker/initTableWorker.ts"],"sourcesContent":["import { constructTable } from '../core/table/constructTable'\nimport { storeReactivityBindings } from '../store-reactivity-bindings'\nimport { makeObjectMap } from '../utils'\nimport { serializeRowModel } from './serializeRowModel'\nimport type { RowData } from '../types/type-utils'\nimport type { TableFeatures } from '../types/TableFeatures'\nimport type { TableOptions } from '../types/TableOptions'\nimport type { Table_Internal } from '../types/Table'\nimport type {\n TableWorkerRequest,\n TableWorkerResult,\n TableWorkerStage,\n TableWorkerStagePayload,\n} from './tableWorkerProtocol'\n\nexport type TableWorkerConfig<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> = Omit<TableOptions<TFeatures, TData>, 'data'>\n\nfunction capitalize(stage: string) {\n return stage.charAt(0).toUpperCase() + stage.slice(1)\n}\n\n/** Flatten column-group defs to leaf defs (mirrors core's id resolution). */\nfunction flattenColumnDefs(defs: Array<any>): Array<any> {\n return defs.flatMap((def) =>\n def.columns ? flattenColumnDefs(def.columns) : [def],\n )\n}\n\n/**\n * Runs a headless \"shadow table\" inside a dedicated Web Worker.\n *\n * Call this from a user-authored worker entry file, passing the same columns\n * and processing features used on the main thread. The shadow table runs the\n * real table-core row model pipeline (real fns, real Row objects) off the\n * main thread and posts back one payload per stage the main thread requested:\n * a transferable index permutation for flat results, a serialized row tree\n * (with eagerly computed aggregates) when grouping produces synthetic rows.\n *\n * Everything passed here must be thread-portable: `accessorKey` columns or\n * accessors defined in a shared module, and fns from registries or shared\n * modules (no closures over app state).\n *\n * @example\n * ```ts\n * // table.worker.ts\n * import { initTableWorker } from '@tanstack/table-core/experimental-worker-plugin'\n * import { columns, sharedFeatures } from './tableConfig'\n *\n * initTableWorker({ features: sharedFeatures, columns })\n * ```\n */\nexport function initTableWorker<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(config: TableWorkerConfig<TFeatures, TData>): void {\n let table: Table_Internal<TFeatures, TData> | undefined\n let dataVersion = 0\n let coreIndexById: Record<string, number> = makeObjectMap()\n let aggregateColumnIds: Array<string> = []\n // Last-sent model identity per stage: the memoized getters return stable\n // objects when their inputs did not change, so identity equality is exactly\n // \"this stage's result is unchanged\".\n let lastSentModels: { [K in TableWorkerStage]?: unknown } = {}\n\n self.onmessage = (event: MessageEvent<TableWorkerRequest<TData>>) => {\n const message = event.data\n\n if (message.type === 'data') {\n dataVersion = message.dataVersion\n lastSentModels = {}\n if (!table) {\n table = constructTable<TFeatures, TData>({\n ...(config as TableOptions<TFeatures, TData>),\n features: {\n coreReactivityFeature: storeReactivityBindings(),\n ...config.features,\n },\n data: message.data,\n })\n // Only columns with an explicit aggregation get eagerly aggregated\n // per group. Sync tables aggregate lazily (visible cells only), so\n // auto-aggregating every column would explode on high-cardinality\n // grouping for values nothing renders. Read the RAW column defs:\n // aggregationFeature injects default aggregatedCell/aggregationFn\n // into every resolved columnDef, so the resolved defs can't tell\n // explicit from default.\n aggregateColumnIds = flattenColumnDefs(config.columns as Array<any>)\n .filter(\n (def) => def.aggregationFn != null || def.aggregatedCell != null,\n )\n .map(\n (def) =>\n def.id ??\n (typeof def.accessorKey === 'string'\n ? def.accessorKey.replaceAll('.', '_')\n : undefined),\n )\n .filter((id): id is string => id != null)\n } else {\n table.setOptions((prev) => ({ ...prev, data: message.data }))\n }\n // Map row ids to data positions once per dataset; serialization uses it\n // to express every stage result in terms of core row positions.\n const coreFlatRows = table.getCoreRowModel().flatRows\n coreIndexById = makeObjectMap()\n for (let i = 0; i < coreFlatRows.length; i++) {\n coreIndexById[coreFlatRows[i]!.id] = i\n }\n return\n }\n\n if (!table) return\n\n const start = performance.now()\n\n // Apply the serializable state slices to the shadow table's base atoms.\n table._reactivity.batch(() => {\n for (const [key, value] of Object.entries(message.state)) {\n const baseAtom = (table!.baseAtoms as Record<string, any>)[key]\n if (baseAtom && value !== undefined) {\n baseAtom.set(value)\n }\n }\n })\n\n // Compute exactly the stages the main thread requested, skipping any this\n // shadow table has no row model factory for (the main thread warns).\n const stages: { [K in TableWorkerStage]?: TableWorkerStagePayload } = {}\n const transfer: Array<Transferable> = []\n\n for (const stage of message.stages) {\n if (!(config.features as Record<string, unknown>)[`${stage}RowModel`]) {\n continue\n }\n const model = (table as any)[`get${capitalize(stage)}RowModel`]()\n // Memoized getters return the same object when inputs are unchanged;\n // skip re-serializing (and the main thread skips rebuilding). Safe under\n // single-flight: results are never dropped within a dataVersion.\n if (lastSentModels[stage] === model) {\n stages[stage] = { kind: 'unchanged' }\n continue\n }\n lastSentModels[stage] = model\n stages[stage] = serializeRowModel(\n model,\n coreIndexById,\n aggregateColumnIds,\n transfer,\n )\n }\n\n const response: TableWorkerResult = {\n type: 'result',\n requestId: message.requestId,\n dataVersion,\n stages,\n computeMs: performance.now() - start,\n }\n postMessage(response, { transfer })\n }\n}\n"],"mappings":";;;;;;AAoBA,SAAS,WAAW,OAAe;CACjC,OAAO,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC;AACtD;;AAGA,SAAS,kBAAkB,MAA8B;CACvD,OAAO,KAAK,SAAS,QACnB,IAAI,UAAU,kBAAkB,IAAI,OAAO,IAAI,CAAC,GAAG,CACrD;AACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,gBAGd,QAAmD;CACnD,IAAI;CACJ,IAAI,cAAc;CAClB,IAAI,gBAAwCA,4BAAc;CAC1D,IAAI,qBAAoC,CAAC;CAIzC,IAAI,iBAAwD,CAAC;CAE7D,KAAK,aAAa,UAAmD;EACnE,MAAM,UAAU,MAAM;EAEtB,IAAI,QAAQ,SAAS,QAAQ;GAC3B,cAAc,QAAQ;GACtB,iBAAiB,CAAC;GAClB,IAAI,CAAC,OAAO;IACV,QAAQC,sCAAiC;KACvC,GAAI;KACJ,UAAU;MACR,uBAAuBC,0DAAwB;MAC/C,GAAG,OAAO;KACZ;KACA,MAAM,QAAQ;IAChB,CAAC;IAQD,qBAAqB,kBAAkB,OAAO,OAAqB,CAAC,CACjE,QACE,QAAQ,IAAI,iBAAiB,QAAQ,IAAI,kBAAkB,IAC9D,CAAC,CACA,KACE,QACC,IAAI,OACH,OAAO,IAAI,gBAAgB,WACxB,IAAI,YAAY,WAAW,KAAK,GAAG,IACnC,OACR,CAAC,CACA,QAAQ,OAAqB,MAAM,IAAI;GAC5C,OACE,MAAM,YAAY,UAAU;IAAE,GAAG;IAAM,MAAM,QAAQ;GAAK,EAAE;GAI9D,MAAM,eAAe,MAAM,gBAAgB,CAAC,CAAC;GAC7C,gBAAgBF,4BAAc;GAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KACvC,cAAc,aAAa,EAAE,CAAE,MAAM;GAEvC;EACF;EAEA,IAAI,CAAC,OAAO;EAEZ,MAAM,QAAQ,YAAY,IAAI;EAG9B,MAAM,YAAY,YAAY;GAC5B,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,KAAK,GAAG;IACxD,MAAM,WAAY,MAAO,UAAkC;IAC3D,IAAI,YAAY,UAAU,QACxB,SAAS,IAAI,KAAK;GAEtB;EACF,CAAC;EAID,MAAM,SAAgE,CAAC;EACvE,MAAM,WAAgC,CAAC;EAEvC,KAAK,MAAM,SAAS,QAAQ,QAAQ;GAClC,IAAI,CAAE,OAAO,SAAqC,GAAG,MAAM,YACzD;GAEF,MAAM,QAAS,MAAc,MAAM,WAAW,KAAK,EAAE,UAAU,CAAC;GAIhE,IAAI,eAAe,WAAW,OAAO;IACnC,OAAO,SAAS,EAAE,MAAM,YAAY;IACpC;GACF;GACA,eAAe,SAAS;GACxB,OAAO,SAASG,4CACd,OACA,eACA,oBACA,QACF;EACF;EAEA,MAAM,WAA8B;GAClC,MAAM;GACN,WAAW,QAAQ;GACnB;GACA;GACA,WAAW,YAAY,IAAI,IAAI;EACjC;EACA,YAAY,UAAU,EAAE,SAAS,CAAC;CACpC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initTableWorker.js","names":[],"sources":["../../src/worker/initTableWorker.ts"],"sourcesContent":["import { constructTable } from '../core/table/constructTable'\nimport { storeReactivityBindings } from '../store-reactivity-bindings'\nimport { makeObjectMap } from '../utils'\nimport { serializeRowModel } from './serializeRowModel'\nimport type { RowData } from '../types/type-utils'\nimport type { TableFeatures } from '../types/TableFeatures'\nimport type { TableOptions } from '../types/TableOptions'\nimport type { Table_Internal } from '../types/Table'\nimport type {\n TableWorkerRequest,\n TableWorkerResult,\n TableWorkerStage,\n TableWorkerStagePayload,\n} from './tableWorkerProtocol'\n\nexport type TableWorkerConfig<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> = Omit<TableOptions<TFeatures, TData>, 'data'>\n\nfunction capitalize(stage: string) {\n return stage.charAt(0).toUpperCase() + stage.slice(1)\n}\n\n/** Flatten column-group defs to leaf defs (mirrors core's id resolution). */\nfunction flattenColumnDefs(defs: Array<any>): Array<any> {\n return defs.flatMap((def) =>\n def.columns ? flattenColumnDefs(def.columns) : [def],\n )\n}\n\n/**\n * Runs a headless \"shadow table\" inside a dedicated Web Worker.\n *\n * Call this from a user-authored worker entry file, passing the same columns\n * and processing features used on the main thread. The shadow table runs the\n * real table-core row model pipeline (real fns, real Row objects) off the\n * main thread and posts back one payload per stage the main thread requested:\n * a transferable index permutation for flat results, a serialized row tree\n * (with eagerly computed aggregates) when grouping produces synthetic rows.\n *\n * Everything passed here must be thread-portable: `accessorKey` columns or\n * accessors defined in a shared module, and fns from registries or shared\n * modules (no closures over app state).\n *\n * @example\n * ```ts\n * // table.worker.ts\n * import { initTableWorker } from '@tanstack/table-core/experimental-worker-plugin'\n * import { columns, sharedFeatures } from './tableConfig'\n *\n * initTableWorker({ features: sharedFeatures, columns })\n * ```\n */\nexport function initTableWorker<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(config: TableWorkerConfig<TFeatures, TData>): void {\n let table: Table_Internal<TFeatures, TData> | undefined\n let dataVersion = 0\n let coreIndexById: Record<string, number> = makeObjectMap()\n let aggregateColumnIds: Array<string> = []\n // Last-sent model identity per stage: the memoized getters return stable\n // objects when their inputs did not change, so identity equality is exactly\n // \"this stage's result is unchanged\".\n let lastSentModels: { [K in TableWorkerStage]?: unknown } = {}\n\n self.onmessage = (event: MessageEvent<TableWorkerRequest<TData>>) => {\n const message = event.data\n\n if (message.type === 'data') {\n dataVersion = message.dataVersion\n lastSentModels = {}\n if (!table) {\n table = constructTable<TFeatures, TData>({\n ...(config as TableOptions<TFeatures, TData>),\n features: {\n coreReactivityFeature: storeReactivityBindings(),\n ...config.features,\n },\n data: message.data,\n })\n // Only columns with an explicit aggregation get eagerly aggregated\n // per group. Sync tables aggregate lazily (visible cells only), so\n // auto-aggregating every column would explode on high-cardinality\n // grouping for values nothing renders. Read the RAW column defs:\n //
|
|
1
|
+
{"version":3,"file":"initTableWorker.js","names":[],"sources":["../../src/worker/initTableWorker.ts"],"sourcesContent":["import { constructTable } from '../core/table/constructTable'\nimport { storeReactivityBindings } from '../store-reactivity-bindings'\nimport { makeObjectMap } from '../utils'\nimport { serializeRowModel } from './serializeRowModel'\nimport type { RowData } from '../types/type-utils'\nimport type { TableFeatures } from '../types/TableFeatures'\nimport type { TableOptions } from '../types/TableOptions'\nimport type { Table_Internal } from '../types/Table'\nimport type {\n TableWorkerRequest,\n TableWorkerResult,\n TableWorkerStage,\n TableWorkerStagePayload,\n} from './tableWorkerProtocol'\n\nexport type TableWorkerConfig<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> = Omit<TableOptions<TFeatures, TData>, 'data'>\n\nfunction capitalize(stage: string) {\n return stage.charAt(0).toUpperCase() + stage.slice(1)\n}\n\n/** Flatten column-group defs to leaf defs (mirrors core's id resolution). */\nfunction flattenColumnDefs(defs: Array<any>): Array<any> {\n return defs.flatMap((def) =>\n def.columns ? flattenColumnDefs(def.columns) : [def],\n )\n}\n\n/**\n * Runs a headless \"shadow table\" inside a dedicated Web Worker.\n *\n * Call this from a user-authored worker entry file, passing the same columns\n * and processing features used on the main thread. The shadow table runs the\n * real table-core row model pipeline (real fns, real Row objects) off the\n * main thread and posts back one payload per stage the main thread requested:\n * a transferable index permutation for flat results, a serialized row tree\n * (with eagerly computed aggregates) when grouping produces synthetic rows.\n *\n * Everything passed here must be thread-portable: `accessorKey` columns or\n * accessors defined in a shared module, and fns from registries or shared\n * modules (no closures over app state).\n *\n * @example\n * ```ts\n * // table.worker.ts\n * import { initTableWorker } from '@tanstack/table-core/experimental-worker-plugin'\n * import { columns, sharedFeatures } from './tableConfig'\n *\n * initTableWorker({ features: sharedFeatures, columns })\n * ```\n */\nexport function initTableWorker<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(config: TableWorkerConfig<TFeatures, TData>): void {\n let table: Table_Internal<TFeatures, TData> | undefined\n let dataVersion = 0\n let coreIndexById: Record<string, number> = makeObjectMap()\n let aggregateColumnIds: Array<string> = []\n // Last-sent model identity per stage: the memoized getters return stable\n // objects when their inputs did not change, so identity equality is exactly\n // \"this stage's result is unchanged\".\n let lastSentModels: { [K in TableWorkerStage]?: unknown } = {}\n\n self.onmessage = (event: MessageEvent<TableWorkerRequest<TData>>) => {\n const message = event.data\n\n if (message.type === 'data') {\n dataVersion = message.dataVersion\n lastSentModels = {}\n if (!table) {\n table = constructTable<TFeatures, TData>({\n ...(config as TableOptions<TFeatures, TData>),\n features: {\n coreReactivityFeature: storeReactivityBindings(),\n ...config.features,\n },\n data: message.data,\n })\n // Only columns with an explicit aggregation get eagerly aggregated\n // per group. Sync tables aggregate lazily (visible cells only), so\n // auto-aggregating every column would explode on high-cardinality\n // grouping for values nothing renders. Read the RAW column defs:\n // aggregationFeature injects default aggregatedCell/aggregationFn\n // into every resolved columnDef, so the resolved defs can't tell\n // explicit from default.\n aggregateColumnIds = flattenColumnDefs(config.columns as Array<any>)\n .filter(\n (def) => def.aggregationFn != null || def.aggregatedCell != null,\n )\n .map(\n (def) =>\n def.id ??\n (typeof def.accessorKey === 'string'\n ? def.accessorKey.replaceAll('.', '_')\n : undefined),\n )\n .filter((id): id is string => id != null)\n } else {\n table.setOptions((prev) => ({ ...prev, data: message.data }))\n }\n // Map row ids to data positions once per dataset; serialization uses it\n // to express every stage result in terms of core row positions.\n const coreFlatRows = table.getCoreRowModel().flatRows\n coreIndexById = makeObjectMap()\n for (let i = 0; i < coreFlatRows.length; i++) {\n coreIndexById[coreFlatRows[i]!.id] = i\n }\n return\n }\n\n if (!table) return\n\n const start = performance.now()\n\n // Apply the serializable state slices to the shadow table's base atoms.\n table._reactivity.batch(() => {\n for (const [key, value] of Object.entries(message.state)) {\n const baseAtom = (table!.baseAtoms as Record<string, any>)[key]\n if (baseAtom && value !== undefined) {\n baseAtom.set(value)\n }\n }\n })\n\n // Compute exactly the stages the main thread requested, skipping any this\n // shadow table has no row model factory for (the main thread warns).\n const stages: { [K in TableWorkerStage]?: TableWorkerStagePayload } = {}\n const transfer: Array<Transferable> = []\n\n for (const stage of message.stages) {\n if (!(config.features as Record<string, unknown>)[`${stage}RowModel`]) {\n continue\n }\n const model = (table as any)[`get${capitalize(stage)}RowModel`]()\n // Memoized getters return the same object when inputs are unchanged;\n // skip re-serializing (and the main thread skips rebuilding). Safe under\n // single-flight: results are never dropped within a dataVersion.\n if (lastSentModels[stage] === model) {\n stages[stage] = { kind: 'unchanged' }\n continue\n }\n lastSentModels[stage] = model\n stages[stage] = serializeRowModel(\n model,\n coreIndexById,\n aggregateColumnIds,\n transfer,\n )\n }\n\n const response: TableWorkerResult = {\n type: 'result',\n requestId: message.requestId,\n dataVersion,\n stages,\n computeMs: performance.now() - start,\n }\n postMessage(response, { transfer })\n }\n}\n"],"mappings":";;;;;;AAoBA,SAAS,WAAW,OAAe;CACjC,OAAO,MAAM,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC;AACtD;;AAGA,SAAS,kBAAkB,MAA8B;CACvD,OAAO,KAAK,SAAS,QACnB,IAAI,UAAU,kBAAkB,IAAI,OAAO,IAAI,CAAC,GAAG,CACrD;AACF;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,gBAGd,QAAmD;CACnD,IAAI;CACJ,IAAI,cAAc;CAClB,IAAI,gBAAwC,cAAc;CAC1D,IAAI,qBAAoC,CAAC;CAIzC,IAAI,iBAAwD,CAAC;CAE7D,KAAK,aAAa,UAAmD;EACnE,MAAM,UAAU,MAAM;EAEtB,IAAI,QAAQ,SAAS,QAAQ;GAC3B,cAAc,QAAQ;GACtB,iBAAiB,CAAC;GAClB,IAAI,CAAC,OAAO;IACV,QAAQ,eAAiC;KACvC,GAAI;KACJ,UAAU;MACR,uBAAuB,wBAAwB;MAC/C,GAAG,OAAO;KACZ;KACA,MAAM,QAAQ;IAChB,CAAC;IAQD,qBAAqB,kBAAkB,OAAO,OAAqB,CAAC,CACjE,QACE,QAAQ,IAAI,iBAAiB,QAAQ,IAAI,kBAAkB,IAC9D,CAAC,CACA,KACE,QACC,IAAI,OACH,OAAO,IAAI,gBAAgB,WACxB,IAAI,YAAY,WAAW,KAAK,GAAG,IACnC,OACR,CAAC,CACA,QAAQ,OAAqB,MAAM,IAAI;GAC5C,OACE,MAAM,YAAY,UAAU;IAAE,GAAG;IAAM,MAAM,QAAQ;GAAK,EAAE;GAI9D,MAAM,eAAe,MAAM,gBAAgB,CAAC,CAAC;GAC7C,gBAAgB,cAAc;GAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KACvC,cAAc,aAAa,EAAE,CAAE,MAAM;GAEvC;EACF;EAEA,IAAI,CAAC,OAAO;EAEZ,MAAM,QAAQ,YAAY,IAAI;EAG9B,MAAM,YAAY,YAAY;GAC5B,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,KAAK,GAAG;IACxD,MAAM,WAAY,MAAO,UAAkC;IAC3D,IAAI,YAAY,UAAU,QACxB,SAAS,IAAI,KAAK;GAEtB;EACF,CAAC;EAID,MAAM,SAAgE,CAAC;EACvE,MAAM,WAAgC,CAAC;EAEvC,KAAK,MAAM,SAAS,QAAQ,QAAQ;GAClC,IAAI,CAAE,OAAO,SAAqC,GAAG,MAAM,YACzD;GAEF,MAAM,QAAS,MAAc,MAAM,WAAW,KAAK,EAAE,UAAU,CAAC;GAIhE,IAAI,eAAe,WAAW,OAAO;IACnC,OAAO,SAAS,EAAE,MAAM,YAAY;IACpC;GACF;GACA,eAAe,SAAS;GACxB,OAAO,SAAS,kBACd,OACA,eACA,oBACA,QACF;EACF;EAEA,MAAM,WAA8B;GAClC,MAAM;GACN,WAAW,QAAQ;GACnB;GACA;GACA,WAAW,YAAY,IAAI,IAAI;EACjC;EACA,YAAY,UAAU,EAAE,SAAS,CAAC;CACpC;AACF"}
|