@tanstack/table-core 9.0.0-alpha.33 → 9.0.0-alpha.36
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/columns/coreColumnsFeature.cjs +18 -12
- package/dist/core/columns/coreColumnsFeature.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.js +18 -12
- package/dist/core/columns/coreColumnsFeature.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.cjs +11 -8
- package/dist/core/headers/coreHeadersFeature.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.js +11 -8
- package/dist/core/headers/coreHeadersFeature.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.cjs +2 -1
- package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.js +2 -1
- package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
- package/dist/core/table/constructTable.cjs +21 -11
- package/dist/core/table/constructTable.cjs.map +1 -1
- package/dist/core/table/constructTable.d.cts +1 -3
- package/dist/core/table/constructTable.d.ts +1 -3
- package/dist/core/table/constructTable.js +23 -12
- package/dist/core/table/constructTable.js.map +1 -1
- package/dist/core/table/coreTablesFeature.types.d.cts +54 -10
- package/dist/core/table/coreTablesFeature.types.d.ts +54 -10
- package/dist/core/table/coreTablesFeature.utils.cjs +5 -1
- package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.js +6 -2
- package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.cjs +18 -12
- package/dist/features/column-faceting/columnFacetingFeature.cjs.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.js +18 -12
- package/dist/features/column-faceting/columnFacetingFeature.js.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.cjs +9 -6
- package/dist/features/column-faceting/createFacetedRowModel.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.js +9 -6
- package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +6 -6
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.js +7 -7
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.cjs +11 -6
- package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.js +11 -6
- package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +6 -6
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.js +7 -7
- package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.cjs +6 -2
- package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.js +6 -2
- package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.cjs +17 -11
- package/dist/features/column-ordering/columnOrderingFeature.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.js +17 -11
- package/dist/features/column-ordering/columnOrderingFeature.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs +8 -5
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.js +8 -5
- package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.cjs +72 -45
- package/dist/features/column-pinning/columnPinningFeature.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.js +72 -45
- package/dist/features/column-pinning/columnPinningFeature.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs +27 -16
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.js +28 -17
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs +6 -5
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.js +6 -5
- package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.cjs +16 -10
- package/dist/features/column-sizing/columnSizingFeature.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.js +16 -10
- package/dist/features/column-sizing/columnSizingFeature.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs +6 -6
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.js +7 -7
- package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.cjs +28 -16
- package/dist/features/column-visibility/columnVisibilityFeature.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.js +28 -16
- package/dist/features/column-visibility/columnVisibilityFeature.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +4 -4
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js +5 -5
- package/dist/features/column-visibility/columnVisibilityFeature.utils.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 +2 -2
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.cjs +10 -6
- package/dist/features/row-expanding/createExpandedRowModel.cjs.map +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.js +10 -6
- package/dist/features/row-expanding/createExpandedRowModel.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs +11 -7
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.js +12 -7
- package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
- package/dist/features/row-pagination/createPaginatedRowModel.cjs +10 -6
- package/dist/features/row-pagination/createPaginatedRowModel.cjs.map +1 -1
- package/dist/features/row-pagination/createPaginatedRowModel.js +10 -6
- package/dist/features/row-pagination/createPaginatedRowModel.js.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs +19 -13
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.js +20 -14
- package/dist/features/row-pagination/rowPaginationFeature.utils.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.cjs +12 -6
- package/dist/features/row-pinning/rowPinningFeature.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.js +12 -6
- package/dist/features/row-pinning/rowPinningFeature.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs +11 -8
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.js +12 -9
- package/dist/features/row-pinning/rowPinningFeature.utils.js.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.cjs +12 -3
- package/dist/features/row-selection/rowSelectionFeature.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.js +12 -3
- package/dist/features/row-selection/rowSelectionFeature.js.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.types.d.cts +1 -1
- package/dist/features/row-selection/rowSelectionFeature.types.d.ts +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs +17 -9
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.js +18 -9
- package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.cjs +6 -2
- package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.js +6 -2
- package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs +6 -6
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.js +7 -7
- package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
- package/dist/features/table-reactivity/tableReactivityFeature.cjs +23 -1
- package/dist/features/table-reactivity/tableReactivityFeature.cjs.map +1 -1
- package/dist/features/table-reactivity/tableReactivityFeature.js +23 -1
- package/dist/features/table-reactivity/tableReactivityFeature.js.map +1 -1
- package/dist/flex-render.cjs +19 -0
- package/dist/flex-render.cjs.map +1 -0
- package/dist/flex-render.d.cts +24 -0
- package/dist/flex-render.d.ts +24 -0
- package/dist/flex-render.js +16 -0
- package/dist/flex-render.js.map +1 -0
- package/dist/index.cjs +2 -263
- package/dist/index.d.cts +4 -25
- package/dist/index.d.ts +4 -25
- package/dist/index.js +3 -24
- package/dist/static-functions.cjs +261 -0
- package/dist/static-functions.d.cts +21 -0
- package/dist/static-functions.d.ts +21 -0
- package/dist/static-functions.js +22 -0
- package/dist/types/Table.d.cts +5 -3
- package/dist/types/Table.d.ts +5 -3
- package/dist/utils.cjs +14 -6
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +14 -7
- package/dist/utils.js.map +1 -1
- package/package.json +9 -1
- package/src/core/columns/coreColumnsFeature.ts +4 -4
- package/src/core/headers/coreHeadersFeature.ts +4 -4
- package/src/core/headers/coreHeadersFeature.utils.ts +1 -1
- package/src/core/table/constructTable.ts +33 -16
- package/src/core/table/coreTablesFeature.types.ts +69 -9
- package/src/core/table/coreTablesFeature.utils.ts +8 -2
- package/src/features/column-faceting/columnFacetingFeature.ts +4 -4
- package/src/features/column-faceting/createFacetedRowModel.ts +2 -2
- package/src/features/column-filtering/columnFilteringFeature.utils.ts +9 -8
- package/src/features/column-filtering/createFilteredRowModel.ts +4 -3
- package/src/features/column-grouping/columnGroupingFeature.utils.ts +5 -5
- package/src/features/column-grouping/createGroupedRowModel.ts +2 -2
- package/src/features/column-ordering/columnOrderingFeature.ts +5 -5
- package/src/features/column-ordering/columnOrderingFeature.utils.ts +6 -5
- package/src/features/column-pinning/columnPinningFeature.ts +22 -21
- package/src/features/column-pinning/columnPinningFeature.utils.ts +18 -16
- package/src/features/column-resizing/columnResizingFeature.utils.ts +9 -4
- package/src/features/column-sizing/columnSizingFeature.ts +2 -2
- package/src/features/column-sizing/columnSizingFeature.utils.ts +6 -6
- package/src/features/column-visibility/columnVisibilityFeature.ts +6 -6
- package/src/features/column-visibility/columnVisibilityFeature.utils.ts +4 -4
- package/src/features/global-filtering/globalFilteringFeature.utils.ts +2 -2
- package/src/features/row-expanding/createExpandedRowModel.ts +2 -2
- package/src/features/row-expanding/rowExpandingFeature.utils.ts +8 -7
- package/src/features/row-pagination/createPaginatedRowModel.ts +3 -3
- package/src/features/row-pagination/rowPaginationFeature.utils.ts +23 -19
- package/src/features/row-pinning/rowPinningFeature.ts +4 -4
- package/src/features/row-pinning/rowPinningFeature.utils.ts +10 -8
- package/src/features/row-selection/rowSelectionFeature.ts +3 -3
- package/src/features/row-selection/rowSelectionFeature.types.ts +1 -1
- package/src/features/row-selection/rowSelectionFeature.utils.ts +13 -10
- package/src/features/row-sorting/createSortedRowModel.ts +5 -2
- package/src/features/row-sorting/rowSortingFeature.utils.ts +8 -7
- package/src/features/table-reactivity/tableReactivityFeature.ts +46 -1
- package/src/flex-render.ts +60 -0
- package/src/index.ts +0 -21
- package/src/static-functions.ts +31 -0
- package/src/types/Table.ts +10 -3
- package/src/utils.ts +27 -8
- package/dist/helpers/tableHelper.cjs +0 -21
- package/dist/helpers/tableHelper.cjs.map +0 -1
- package/dist/helpers/tableHelper.d.cts +0 -30
- package/dist/helpers/tableHelper.d.ts +0 -30
- package/dist/helpers/tableHelper.js +0 -21
- package/dist/helpers/tableHelper.js.map +0 -1
- package/src/helpers/tableHelper.ts +0 -61
|
@@ -2,13 +2,45 @@ import { RowData, Updater } from "../../types/type-utils.cjs";
|
|
|
2
2
|
import { CoreFeatures } from "../coreFeatures.cjs";
|
|
3
3
|
import { RowModelFns } from "../../types/RowModelFns.cjs";
|
|
4
4
|
import { CachedRowModels, CreateRowModels_All } from "../../types/RowModel.cjs";
|
|
5
|
-
import { TableState } from "../../types/TableState.cjs";
|
|
5
|
+
import { TableState, TableState_All } from "../../types/TableState.cjs";
|
|
6
6
|
import { TableOptions } from "../../types/TableOptions.cjs";
|
|
7
7
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
8
|
-
import { ReadonlyStore, Store } from "@tanstack/store";
|
|
8
|
+
import { Atom, ReadonlyAtom, ReadonlyStore, Store } from "@tanstack/store";
|
|
9
9
|
|
|
10
10
|
//#region src/core/table/coreTablesFeature.types.d.ts
|
|
11
11
|
interface TableMeta<TFeatures extends TableFeatures, TData extends RowData> {}
|
|
12
|
+
/**
|
|
13
|
+
* A map of writable atoms, one per `TableState` slice. These are the internal
|
|
14
|
+
* writable atoms that the library always writes to via `makeStateUpdater`.
|
|
15
|
+
*/
|
|
16
|
+
type BaseAtoms<TFeatures extends TableFeatures> = { [K in keyof TableState<TFeatures>]-?: Atom<TableState<TFeatures>[K]> };
|
|
17
|
+
/**
|
|
18
|
+
* A map of readonly derived atoms, one per `TableState` slice. Each derives
|
|
19
|
+
* from its corresponding `baseAtom` plus, optionally, a per-slice external
|
|
20
|
+
* atom or external state value.
|
|
21
|
+
*
|
|
22
|
+
* Precedence: `options.atoms[key]` > `options.state[key]` > `baseAtoms[key]`.
|
|
23
|
+
*/
|
|
24
|
+
type Atoms<TFeatures extends TableFeatures> = { [K in keyof TableState<TFeatures>]-?: ReadonlyAtom<TableState<TFeatures>[K]> };
|
|
25
|
+
/**
|
|
26
|
+
* A map of optional external atoms, one per `TableState` slice. Consumers can
|
|
27
|
+
* provide their own writable atom for any state slice to take over ownership
|
|
28
|
+
* of that slice.
|
|
29
|
+
*/
|
|
30
|
+
type ExternalAtoms<TFeatures extends TableFeatures> = Partial<{ [K in keyof TableState<TFeatures>]: Atom<TableState<TFeatures>[K]> }>;
|
|
31
|
+
/**
|
|
32
|
+
* Internal "all features" flat variants of the atom types. `Table_Internal`
|
|
33
|
+
* uses these so feature code (written generically over `TFeatures`) can access
|
|
34
|
+
* any slice atom (e.g. `table.atoms.columnPinning`) without TypeScript
|
|
35
|
+
* narrowing away slices that aren't in the current `TFeatures` union.
|
|
36
|
+
*
|
|
37
|
+
* Keys are optional: feature code can read atoms from slices it doesn't own,
|
|
38
|
+
* but those slices may not be registered on the current table. Consumers must
|
|
39
|
+
* use optional chaining (`table.atoms.columnPinning?.get() ?? default`).
|
|
40
|
+
*/
|
|
41
|
+
type BaseAtoms_All = { [K in keyof TableState_All]?: Atom<TableState_All[K]> };
|
|
42
|
+
type Atoms_All = { [K in keyof TableState_All]?: ReadonlyAtom<TableState_All[K]> };
|
|
43
|
+
type ExternalAtoms_All = Partial<{ [K in keyof TableState_All]: Atom<TableState_All[K]> }>;
|
|
12
44
|
interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowData> {
|
|
13
45
|
/**
|
|
14
46
|
* The features that you want to enable for the table.
|
|
@@ -18,6 +50,14 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
18
50
|
* The row model options that you want to enable for the table.
|
|
19
51
|
*/
|
|
20
52
|
_rowModels?: CreateRowModels_All<TFeatures, TData>;
|
|
53
|
+
/**
|
|
54
|
+
* Optionally, provide your own external writable atoms for individual state slices.
|
|
55
|
+
* When an atom is provided for a given slice, it takes precedence over `options.state[key]`
|
|
56
|
+
* and the internal base atom for that slice. Writes originating from the library are
|
|
57
|
+
* still routed through the internal base atom; consumers are responsible for
|
|
58
|
+
* mirroring changes back to their external atom via the corresponding `onXChange` callback.
|
|
59
|
+
*/
|
|
60
|
+
atoms?: ExternalAtoms<TFeatures>;
|
|
21
61
|
/**
|
|
22
62
|
* Set this option to override any of the `autoReset...` feature options.
|
|
23
63
|
*/
|
|
@@ -43,10 +83,6 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
43
83
|
* Pass in individual self-managed state to the table.
|
|
44
84
|
*/
|
|
45
85
|
state?: Partial<TableState<TFeatures>>;
|
|
46
|
-
/**
|
|
47
|
-
* Optionally, provide your own external TanStack Store instance if you want to manage the table state externally.
|
|
48
|
-
*/
|
|
49
|
-
store?: Store<TableState<TFeatures>>;
|
|
50
86
|
}
|
|
51
87
|
interface Table_CoreProperties<TFeatures extends TableFeatures, TData extends RowData> {
|
|
52
88
|
/**
|
|
@@ -78,9 +114,16 @@ interface Table_CoreProperties<TFeatures extends TableFeatures, TData extends Ro
|
|
|
78
114
|
*/
|
|
79
115
|
_rowPrototype?: object;
|
|
80
116
|
/**
|
|
81
|
-
* The
|
|
117
|
+
* The internal writable atoms for each `TableState` slice. This is the library's
|
|
118
|
+
* single write surface — all state mutations from features land here.
|
|
119
|
+
*/
|
|
120
|
+
baseAtoms: BaseAtoms<TFeatures>;
|
|
121
|
+
/**
|
|
122
|
+
* The readonly derived atoms for each `TableState` slice. Each derives from
|
|
123
|
+
* its corresponding `baseAtom` plus, optionally, a per-slice external atom or
|
|
124
|
+
* external state value (precedence: external atom > external state > base atom).
|
|
82
125
|
*/
|
|
83
|
-
|
|
126
|
+
atoms: Atoms<TFeatures>;
|
|
84
127
|
/**
|
|
85
128
|
* The base store for the table options.
|
|
86
129
|
*/
|
|
@@ -94,7 +137,8 @@ interface Table_CoreProperties<TFeatures extends TableFeatures, TData extends Ro
|
|
|
94
137
|
*/
|
|
95
138
|
readonly options: TableOptions<TFeatures, TData>;
|
|
96
139
|
/**
|
|
97
|
-
*
|
|
140
|
+
* The readonly flat store for the table state. Derives from `table.atoms`
|
|
141
|
+
* only; never reads external state directly.
|
|
98
142
|
*/
|
|
99
143
|
store: ReadonlyStore<TableState<TFeatures>>;
|
|
100
144
|
}
|
|
@@ -109,5 +153,5 @@ interface Table_Table<TFeatures extends TableFeatures, TData extends RowData> ex
|
|
|
109
153
|
setOptions: (newOptions: Updater<TableOptions<TFeatures, TData>>) => void;
|
|
110
154
|
}
|
|
111
155
|
//#endregion
|
|
112
|
-
export { TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table };
|
|
156
|
+
export { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms, ExternalAtoms_All, TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table };
|
|
113
157
|
//# sourceMappingURL=coreTablesFeature.types.d.cts.map
|
|
@@ -2,13 +2,45 @@ import { RowData, Updater } from "../../types/type-utils.js";
|
|
|
2
2
|
import { CoreFeatures } from "../coreFeatures.js";
|
|
3
3
|
import { RowModelFns } from "../../types/RowModelFns.js";
|
|
4
4
|
import { CachedRowModels, CreateRowModels_All } from "../../types/RowModel.js";
|
|
5
|
-
import { TableState } from "../../types/TableState.js";
|
|
5
|
+
import { TableState, TableState_All } from "../../types/TableState.js";
|
|
6
6
|
import { TableOptions } from "../../types/TableOptions.js";
|
|
7
7
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
8
|
-
import { ReadonlyStore, Store } from "@tanstack/store";
|
|
8
|
+
import { Atom, ReadonlyAtom, ReadonlyStore, Store } from "@tanstack/store";
|
|
9
9
|
|
|
10
10
|
//#region src/core/table/coreTablesFeature.types.d.ts
|
|
11
11
|
interface TableMeta<TFeatures extends TableFeatures, TData extends RowData> {}
|
|
12
|
+
/**
|
|
13
|
+
* A map of writable atoms, one per `TableState` slice. These are the internal
|
|
14
|
+
* writable atoms that the library always writes to via `makeStateUpdater`.
|
|
15
|
+
*/
|
|
16
|
+
type BaseAtoms<TFeatures extends TableFeatures> = { [K in keyof TableState<TFeatures>]-?: Atom<TableState<TFeatures>[K]> };
|
|
17
|
+
/**
|
|
18
|
+
* A map of readonly derived atoms, one per `TableState` slice. Each derives
|
|
19
|
+
* from its corresponding `baseAtom` plus, optionally, a per-slice external
|
|
20
|
+
* atom or external state value.
|
|
21
|
+
*
|
|
22
|
+
* Precedence: `options.atoms[key]` > `options.state[key]` > `baseAtoms[key]`.
|
|
23
|
+
*/
|
|
24
|
+
type Atoms<TFeatures extends TableFeatures> = { [K in keyof TableState<TFeatures>]-?: ReadonlyAtom<TableState<TFeatures>[K]> };
|
|
25
|
+
/**
|
|
26
|
+
* A map of optional external atoms, one per `TableState` slice. Consumers can
|
|
27
|
+
* provide their own writable atom for any state slice to take over ownership
|
|
28
|
+
* of that slice.
|
|
29
|
+
*/
|
|
30
|
+
type ExternalAtoms<TFeatures extends TableFeatures> = Partial<{ [K in keyof TableState<TFeatures>]: Atom<TableState<TFeatures>[K]> }>;
|
|
31
|
+
/**
|
|
32
|
+
* Internal "all features" flat variants of the atom types. `Table_Internal`
|
|
33
|
+
* uses these so feature code (written generically over `TFeatures`) can access
|
|
34
|
+
* any slice atom (e.g. `table.atoms.columnPinning`) without TypeScript
|
|
35
|
+
* narrowing away slices that aren't in the current `TFeatures` union.
|
|
36
|
+
*
|
|
37
|
+
* Keys are optional: feature code can read atoms from slices it doesn't own,
|
|
38
|
+
* but those slices may not be registered on the current table. Consumers must
|
|
39
|
+
* use optional chaining (`table.atoms.columnPinning?.get() ?? default`).
|
|
40
|
+
*/
|
|
41
|
+
type BaseAtoms_All = { [K in keyof TableState_All]?: Atom<TableState_All[K]> };
|
|
42
|
+
type Atoms_All = { [K in keyof TableState_All]?: ReadonlyAtom<TableState_All[K]> };
|
|
43
|
+
type ExternalAtoms_All = Partial<{ [K in keyof TableState_All]: Atom<TableState_All[K]> }>;
|
|
12
44
|
interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowData> {
|
|
13
45
|
/**
|
|
14
46
|
* The features that you want to enable for the table.
|
|
@@ -18,6 +50,14 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
18
50
|
* The row model options that you want to enable for the table.
|
|
19
51
|
*/
|
|
20
52
|
_rowModels?: CreateRowModels_All<TFeatures, TData>;
|
|
53
|
+
/**
|
|
54
|
+
* Optionally, provide your own external writable atoms for individual state slices.
|
|
55
|
+
* When an atom is provided for a given slice, it takes precedence over `options.state[key]`
|
|
56
|
+
* and the internal base atom for that slice. Writes originating from the library are
|
|
57
|
+
* still routed through the internal base atom; consumers are responsible for
|
|
58
|
+
* mirroring changes back to their external atom via the corresponding `onXChange` callback.
|
|
59
|
+
*/
|
|
60
|
+
atoms?: ExternalAtoms<TFeatures>;
|
|
21
61
|
/**
|
|
22
62
|
* Set this option to override any of the `autoReset...` feature options.
|
|
23
63
|
*/
|
|
@@ -43,10 +83,6 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
43
83
|
* Pass in individual self-managed state to the table.
|
|
44
84
|
*/
|
|
45
85
|
state?: Partial<TableState<TFeatures>>;
|
|
46
|
-
/**
|
|
47
|
-
* Optionally, provide your own external TanStack Store instance if you want to manage the table state externally.
|
|
48
|
-
*/
|
|
49
|
-
store?: Store<TableState<TFeatures>>;
|
|
50
86
|
}
|
|
51
87
|
interface Table_CoreProperties<TFeatures extends TableFeatures, TData extends RowData> {
|
|
52
88
|
/**
|
|
@@ -78,9 +114,16 @@ interface Table_CoreProperties<TFeatures extends TableFeatures, TData extends Ro
|
|
|
78
114
|
*/
|
|
79
115
|
_rowPrototype?: object;
|
|
80
116
|
/**
|
|
81
|
-
* The
|
|
117
|
+
* The internal writable atoms for each `TableState` slice. This is the library's
|
|
118
|
+
* single write surface — all state mutations from features land here.
|
|
119
|
+
*/
|
|
120
|
+
baseAtoms: BaseAtoms<TFeatures>;
|
|
121
|
+
/**
|
|
122
|
+
* The readonly derived atoms for each `TableState` slice. Each derives from
|
|
123
|
+
* its corresponding `baseAtom` plus, optionally, a per-slice external atom or
|
|
124
|
+
* external state value (precedence: external atom > external state > base atom).
|
|
82
125
|
*/
|
|
83
|
-
|
|
126
|
+
atoms: Atoms<TFeatures>;
|
|
84
127
|
/**
|
|
85
128
|
* The base store for the table options.
|
|
86
129
|
*/
|
|
@@ -94,7 +137,8 @@ interface Table_CoreProperties<TFeatures extends TableFeatures, TData extends Ro
|
|
|
94
137
|
*/
|
|
95
138
|
readonly options: TableOptions<TFeatures, TData>;
|
|
96
139
|
/**
|
|
97
|
-
*
|
|
140
|
+
* The readonly flat store for the table state. Derives from `table.atoms`
|
|
141
|
+
* only; never reads external state directly.
|
|
98
142
|
*/
|
|
99
143
|
store: ReadonlyStore<TableState<TFeatures>>;
|
|
100
144
|
}
|
|
@@ -109,5 +153,5 @@ interface Table_Table<TFeatures extends TableFeatures, TData extends RowData> ex
|
|
|
109
153
|
setOptions: (newOptions: Updater<TableOptions<TFeatures, TData>>) => void;
|
|
110
154
|
}
|
|
111
155
|
//#endregion
|
|
112
|
-
export { TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table };
|
|
156
|
+
export { Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, ExternalAtoms, ExternalAtoms_All, TableMeta, TableOptions_Table, Table_CoreProperties, Table_Table };
|
|
113
157
|
//# sourceMappingURL=coreTablesFeature.types.d.ts.map
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
const require_utils = require('../../utils.cjs');
|
|
2
|
+
let _tanstack_store = require("@tanstack/store");
|
|
2
3
|
|
|
3
4
|
//#region src/core/table/coreTablesFeature.utils.ts
|
|
4
5
|
function table_reset(table) {
|
|
5
|
-
|
|
6
|
+
const snap = require_utils.cloneState(table.initialState);
|
|
7
|
+
(0, _tanstack_store.batch)(() => {
|
|
8
|
+
for (const key of Object.keys(snap)) table.baseAtoms[key].set(snap[key]);
|
|
9
|
+
});
|
|
6
10
|
}
|
|
7
11
|
function table_mergeOptions(table, newOptions) {
|
|
8
12
|
if (table.options.mergeOptions) return table.options.mergeOptions(table.options, newOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreTablesFeature.utils.cjs","names":["functionalUpdate"],"sources":["../../../src/core/table/coreTablesFeature.utils.ts"],"sourcesContent":["import { functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\n\nexport function table_reset<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n table.
|
|
1
|
+
{"version":3,"file":"coreTablesFeature.utils.cjs","names":["cloneState","functionalUpdate"],"sources":["../../../src/core/table/coreTablesFeature.utils.ts"],"sourcesContent":["import { batch } from '@tanstack/store'\nimport { cloneState, functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\n\nexport function table_reset<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const snap = cloneState(table.initialState)\n batch(() => {\n for (const key of Object.keys(snap) as Array<keyof typeof snap>) {\n ;(table.baseAtoms as any)[key].set(snap[key] as any)\n }\n })\n}\n\nexport function table_mergeOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n newOptions: TableOptions<TFeatures, TData>,\n) {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(table.options, newOptions)\n }\n\n return {\n ...table.options,\n ...newOptions,\n }\n}\n\nexport function table_setOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<TableOptions<TFeatures, TData>>,\n): void {\n const newOptions = functionalUpdate(updater, table.options)\n const mergedOptions = table_mergeOptions(table, newOptions)\n table.optionsStore.setState(() => mergedOptions)\n}\n"],"mappings":";;;;AAOA,SAAgB,YAGd,OAA+C;CAC/C,MAAM,OAAOA,yBAAW,MAAM,aAAa;AAC3C,kCAAY;AACV,OAAK,MAAM,OAAO,OAAO,KAAK,KAAK,CAChC,CAAC,MAAM,UAAkB,KAAK,IAAI,KAAK,KAAY;GAEtD;;AAGJ,SAAgB,mBAId,OACA,YACA;AACA,KAAI,MAAM,QAAQ,aAChB,QAAO,MAAM,QAAQ,aAAa,MAAM,SAAS,WAAW;AAG9D,QAAO;EACL,GAAG,MAAM;EACT,GAAG;EACJ;;AAGH,SAAgB,iBAId,OACA,SACM;CAEN,MAAM,gBAAgB,mBAAmB,OADtBC,+BAAiB,SAAS,MAAM,QAAQ,CACA;AAC3D,OAAM,aAAa,eAAe,cAAc"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { functionalUpdate } from "../../utils.js";
|
|
1
|
+
import { cloneState, functionalUpdate } from "../../utils.js";
|
|
2
|
+
import { batch } from "@tanstack/store";
|
|
2
3
|
|
|
3
4
|
//#region src/core/table/coreTablesFeature.utils.ts
|
|
4
5
|
function table_reset(table) {
|
|
5
|
-
|
|
6
|
+
const snap = cloneState(table.initialState);
|
|
7
|
+
batch(() => {
|
|
8
|
+
for (const key of Object.keys(snap)) table.baseAtoms[key].set(snap[key]);
|
|
9
|
+
});
|
|
6
10
|
}
|
|
7
11
|
function table_mergeOptions(table, newOptions) {
|
|
8
12
|
if (table.options.mergeOptions) return table.options.mergeOptions(table.options, newOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreTablesFeature.utils.js","names":[],"sources":["../../../src/core/table/coreTablesFeature.utils.ts"],"sourcesContent":["import { functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\n\nexport function table_reset<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n table.
|
|
1
|
+
{"version":3,"file":"coreTablesFeature.utils.js","names":[],"sources":["../../../src/core/table/coreTablesFeature.utils.ts"],"sourcesContent":["import { batch } from '@tanstack/store'\nimport { cloneState, functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\n\nexport function table_reset<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const snap = cloneState(table.initialState)\n batch(() => {\n for (const key of Object.keys(snap) as Array<keyof typeof snap>) {\n ;(table.baseAtoms as any)[key].set(snap[key] as any)\n }\n })\n}\n\nexport function table_mergeOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n newOptions: TableOptions<TFeatures, TData>,\n) {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(table.options, newOptions)\n }\n\n return {\n ...table.options,\n ...newOptions,\n }\n}\n\nexport function table_setOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<TableOptions<TFeatures, TData>>,\n): void {\n const newOptions = functionalUpdate(updater, table.options)\n const mergedOptions = table_mergeOptions(table, newOptions)\n table.optionsStore.setState(() => mergedOptions)\n}\n"],"mappings":";;;;AAOA,SAAgB,YAGd,OAA+C;CAC/C,MAAM,OAAO,WAAW,MAAM,aAAa;AAC3C,aAAY;AACV,OAAK,MAAM,OAAO,OAAO,KAAK,KAAK,CAChC,CAAC,MAAM,UAAkB,KAAK,IAAI,KAAK,KAAY;GAEtD;;AAGJ,SAAgB,mBAId,OACA,YACA;AACA,KAAI,MAAM,QAAQ,aAChB,QAAO,MAAM,QAAQ,aAAa,MAAM,SAAS,WAAW;AAG9D,QAAO;EACL,GAAG,MAAM;EACT,GAAG;EACJ;;AAGH,SAAgB,iBAId,OACA,SACM;CAEN,MAAM,gBAAgB,mBAAmB,OADtB,iBAAiB,SAAS,MAAM,QAAQ,CACA;AAC3D,OAAM,aAAa,eAAe,cAAc"}
|
|
@@ -7,12 +7,15 @@ function constructColumnFacetingFeature() {
|
|
|
7
7
|
assignColumnPrototype: (prototype, table) => {
|
|
8
8
|
require_utils.assignPrototypeAPIs("columnFacetingFeature", prototype, table, {
|
|
9
9
|
column_getFacetedRowModel: {
|
|
10
|
-
memoDeps: () =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
memoDeps: () => {
|
|
11
|
+
var _table$atoms$columnFi, _table$atoms$globalFi;
|
|
12
|
+
return [
|
|
13
|
+
table.getPreFilteredRowModel().rows,
|
|
14
|
+
(_table$atoms$columnFi = table.atoms.columnFilters) === null || _table$atoms$columnFi === void 0 ? void 0 : _table$atoms$columnFi.get(),
|
|
15
|
+
(_table$atoms$globalFi = table.atoms.globalFilter) === null || _table$atoms$globalFi === void 0 ? void 0 : _table$atoms$globalFi.get(),
|
|
16
|
+
table.getFilteredRowModel().rows
|
|
17
|
+
];
|
|
18
|
+
},
|
|
16
19
|
fn: (column) => require_columnFacetingFeature_utils.column_getFacetedRowModel(column, column.table)
|
|
17
20
|
},
|
|
18
21
|
column_getFacetedMinMaxValues: {
|
|
@@ -28,12 +31,15 @@ function constructColumnFacetingFeature() {
|
|
|
28
31
|
constructTableAPIs: (table) => {
|
|
29
32
|
require_utils.assignTableAPIs("columnFacetingFeature", table, {
|
|
30
33
|
table_getGlobalFacetedRowModel: {
|
|
31
|
-
memoDeps: () =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
memoDeps: () => {
|
|
35
|
+
var _table$atoms$columnFi2, _table$atoms$globalFi2;
|
|
36
|
+
return [
|
|
37
|
+
table.getPreFilteredRowModel().rows,
|
|
38
|
+
(_table$atoms$columnFi2 = table.atoms.columnFilters) === null || _table$atoms$columnFi2 === void 0 ? void 0 : _table$atoms$columnFi2.get(),
|
|
39
|
+
(_table$atoms$globalFi2 = table.atoms.globalFilter) === null || _table$atoms$globalFi2 === void 0 ? void 0 : _table$atoms$globalFi2.get(),
|
|
40
|
+
table.getFilteredRowModel().rows
|
|
41
|
+
];
|
|
42
|
+
},
|
|
37
43
|
fn: () => require_columnFacetingFeature_utils.table_getGlobalFacetedRowModel(table)
|
|
38
44
|
},
|
|
39
45
|
table_getGlobalFacetedMinMaxValues: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnFacetingFeature.cjs","names":["column_getFacetedRowModel","callMemoOrStaticFn","column_getFacetedMinMaxValues","column_getFacetedUniqueValues","table_getGlobalFacetedRowModel","table_getGlobalFacetedMinMaxValues","table_getGlobalFacetedUniqueValues"],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Column_Internal } from '../../types/Column'\n// import type {\n// CachedRowModel_Faceted,\n// Column_ColumnFaceting,\n// CreateRowModel_Faceted,\n// } from './columnFacetingFeature.types'\n\ninterface ColumnFacetingFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // CachedRowModel: CachedRowModel_Faceted<TFeatures, TData>\n // Column: Column_ColumnFaceting<TFeatures, TData>\n // CreateRowModels: CreateRowModel_Faceted<TFeatures, TData>\n}\n\nexport function constructColumnFacetingFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<ColumnFacetingFeatureConstructors<TFeatures, TData>> {\n return {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.
|
|
1
|
+
{"version":3,"file":"columnFacetingFeature.cjs","names":["column_getFacetedRowModel","callMemoOrStaticFn","column_getFacetedMinMaxValues","column_getFacetedUniqueValues","table_getGlobalFacetedRowModel","table_getGlobalFacetedMinMaxValues","table_getGlobalFacetedUniqueValues"],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Column_Internal } from '../../types/Column'\n// import type {\n// CachedRowModel_Faceted,\n// Column_ColumnFaceting,\n// CreateRowModel_Faceted,\n// } from './columnFacetingFeature.types'\n\ninterface ColumnFacetingFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // CachedRowModel: CachedRowModel_Faceted<TFeatures, TData>\n // Column: Column_ColumnFaceting<TFeatures, TData>\n // CreateRowModels: CreateRowModel_Faceted<TFeatures, TData>\n}\n\nexport function constructColumnFacetingFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<ColumnFacetingFeatureConstructors<TFeatures, TData>> {\n return {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: (column) => column_getFacetedRowModel(column, column.table),\n },\n column_getFacetedMinMaxValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedMinMaxValues(column, column.table),\n },\n column_getFacetedUniqueValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedUniqueValues(column, column.table),\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('columnFacetingFeature', table, {\n table_getGlobalFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: () => table_getGlobalFacetedRowModel(table),\n },\n table_getGlobalFacetedMinMaxValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedMinMaxValues(table),\n },\n table_getGlobalFacetedUniqueValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedUniqueValues(table),\n },\n })\n },\n }\n}\n\n/**\n * The Column Faceting feature adds column faceting APIs to the column objects.\n */\nexport const columnFacetingFeature = constructColumnFacetingFeature()\n"],"mappings":";;;;AA+BA,SAAgB,iCAGuD;AACrE,QAAO;EACL,wBAAwB,WAAW,UAAU;AAC3C,qCAAoB,yBAAyB,WAAW,OAAO;IAC7D,2BAA2B;KACzB,gBAAgB;;;OACd,MAAM,wBAAwB,CAAC;gCAC/B,MAAM,MAAM,6FAAe,KAAK;gCAChC,MAAM,MAAM,4FAAc,KAAK;OAC/B,MAAM,qBAAqB,CAAC;OAC7B;;KACD,KAAK,WAAWA,8DAA0B,QAAQ,OAAO,MAAM;KAChE;IACD,+BAA+B;KAC7B,WAAW,WAA8C,CACvDC,iCACE,QACA,sBACAD,+DACA,OAAO,MACR,CAAC,SACH;KACD,KAAK,WAAWE,kEAA8B,QAAQ,OAAO,MAAM;KACpE;IACD,+BAA+B;KAC7B,WAAW,WAA8C,CACvDD,iCACE,QACA,sBACAD,+DACA,OAAO,MACR,CAAC,SACH;KACD,KAAK,WAAWG,kEAA8B,QAAQ,OAAO,MAAM;KACpE;IACF,CAAC;;EAGJ,qBAAqB,UAAU;AAC7B,iCAAgB,yBAAyB,OAAO;IAC9C,gCAAgC;KAC9B,gBAAgB;;;OACd,MAAM,wBAAwB,CAAC;iCAC/B,MAAM,MAAM,+FAAe,KAAK;iCAChC,MAAM,MAAM,8FAAc,KAAK;OAC/B,MAAM,qBAAqB,CAAC;OAC7B;;KACD,UAAUC,mEAA+B,MAAM;KAChD;IACD,oCAAoC;KAClC,gBAAgB,CACdH,iCACE,OACA,4BACAG,mEACD,CAAC,SACH;KACD,UAAUC,uEAAmC,MAAM;KACpD;IACD,oCAAoC;KAClC,gBAAgB,CACdJ,iCACE,OACA,4BACAG,mEACD,CAAC,SACH;KACD,UAAUE,uEAAmC,MAAM;KACpD;IACF,CAAC;;EAEL;;;;;AAMH,MAAa,wBAAwB,gCAAgC"}
|
|
@@ -7,12 +7,15 @@ function constructColumnFacetingFeature() {
|
|
|
7
7
|
assignColumnPrototype: (prototype, table) => {
|
|
8
8
|
assignPrototypeAPIs("columnFacetingFeature", prototype, table, {
|
|
9
9
|
column_getFacetedRowModel: {
|
|
10
|
-
memoDeps: () =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
memoDeps: () => {
|
|
11
|
+
var _table$atoms$columnFi, _table$atoms$globalFi;
|
|
12
|
+
return [
|
|
13
|
+
table.getPreFilteredRowModel().rows,
|
|
14
|
+
(_table$atoms$columnFi = table.atoms.columnFilters) === null || _table$atoms$columnFi === void 0 ? void 0 : _table$atoms$columnFi.get(),
|
|
15
|
+
(_table$atoms$globalFi = table.atoms.globalFilter) === null || _table$atoms$globalFi === void 0 ? void 0 : _table$atoms$globalFi.get(),
|
|
16
|
+
table.getFilteredRowModel().rows
|
|
17
|
+
];
|
|
18
|
+
},
|
|
16
19
|
fn: (column) => column_getFacetedRowModel(column, column.table)
|
|
17
20
|
},
|
|
18
21
|
column_getFacetedMinMaxValues: {
|
|
@@ -28,12 +31,15 @@ function constructColumnFacetingFeature() {
|
|
|
28
31
|
constructTableAPIs: (table) => {
|
|
29
32
|
assignTableAPIs("columnFacetingFeature", table, {
|
|
30
33
|
table_getGlobalFacetedRowModel: {
|
|
31
|
-
memoDeps: () =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
memoDeps: () => {
|
|
35
|
+
var _table$atoms$columnFi2, _table$atoms$globalFi2;
|
|
36
|
+
return [
|
|
37
|
+
table.getPreFilteredRowModel().rows,
|
|
38
|
+
(_table$atoms$columnFi2 = table.atoms.columnFilters) === null || _table$atoms$columnFi2 === void 0 ? void 0 : _table$atoms$columnFi2.get(),
|
|
39
|
+
(_table$atoms$globalFi2 = table.atoms.globalFilter) === null || _table$atoms$globalFi2 === void 0 ? void 0 : _table$atoms$globalFi2.get(),
|
|
40
|
+
table.getFilteredRowModel().rows
|
|
41
|
+
];
|
|
42
|
+
},
|
|
37
43
|
fn: () => table_getGlobalFacetedRowModel(table)
|
|
38
44
|
},
|
|
39
45
|
table_getGlobalFacetedMinMaxValues: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnFacetingFeature.js","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Column_Internal } from '../../types/Column'\n// import type {\n// CachedRowModel_Faceted,\n// Column_ColumnFaceting,\n// CreateRowModel_Faceted,\n// } from './columnFacetingFeature.types'\n\ninterface ColumnFacetingFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // CachedRowModel: CachedRowModel_Faceted<TFeatures, TData>\n // Column: Column_ColumnFaceting<TFeatures, TData>\n // CreateRowModels: CreateRowModel_Faceted<TFeatures, TData>\n}\n\nexport function constructColumnFacetingFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<ColumnFacetingFeatureConstructors<TFeatures, TData>> {\n return {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.
|
|
1
|
+
{"version":3,"file":"columnFacetingFeature.js","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Column_Internal } from '../../types/Column'\n// import type {\n// CachedRowModel_Faceted,\n// Column_ColumnFaceting,\n// CreateRowModel_Faceted,\n// } from './columnFacetingFeature.types'\n\ninterface ColumnFacetingFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // CachedRowModel: CachedRowModel_Faceted<TFeatures, TData>\n // Column: Column_ColumnFaceting<TFeatures, TData>\n // CreateRowModels: CreateRowModel_Faceted<TFeatures, TData>\n}\n\nexport function constructColumnFacetingFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<ColumnFacetingFeatureConstructors<TFeatures, TData>> {\n return {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: (column) => column_getFacetedRowModel(column, column.table),\n },\n column_getFacetedMinMaxValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedMinMaxValues(column, column.table),\n },\n column_getFacetedUniqueValues: {\n memoDeps: (column: Column_Internal<TFeatures, TData>) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedUniqueValues(column, column.table),\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('columnFacetingFeature', table, {\n table_getGlobalFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: () => table_getGlobalFacetedRowModel(table),\n },\n table_getGlobalFacetedMinMaxValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedMinMaxValues(table),\n },\n table_getGlobalFacetedUniqueValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedUniqueValues(table),\n },\n })\n },\n }\n}\n\n/**\n * The Column Faceting feature adds column faceting APIs to the column objects.\n */\nexport const columnFacetingFeature = constructColumnFacetingFeature()\n"],"mappings":";;;;AA+BA,SAAgB,iCAGuD;AACrE,QAAO;EACL,wBAAwB,WAAW,UAAU;AAC3C,uBAAoB,yBAAyB,WAAW,OAAO;IAC7D,2BAA2B;KACzB,gBAAgB;;;OACd,MAAM,wBAAwB,CAAC;gCAC/B,MAAM,MAAM,6FAAe,KAAK;gCAChC,MAAM,MAAM,4FAAc,KAAK;OAC/B,MAAM,qBAAqB,CAAC;OAC7B;;KACD,KAAK,WAAW,0BAA0B,QAAQ,OAAO,MAAM;KAChE;IACD,+BAA+B;KAC7B,WAAW,WAA8C,CACvD,mBACE,QACA,sBACA,2BACA,OAAO,MACR,CAAC,SACH;KACD,KAAK,WAAW,8BAA8B,QAAQ,OAAO,MAAM;KACpE;IACD,+BAA+B;KAC7B,WAAW,WAA8C,CACvD,mBACE,QACA,sBACA,2BACA,OAAO,MACR,CAAC,SACH;KACD,KAAK,WAAW,8BAA8B,QAAQ,OAAO,MAAM;KACpE;IACF,CAAC;;EAGJ,qBAAqB,UAAU;AAC7B,mBAAgB,yBAAyB,OAAO;IAC9C,gCAAgC;KAC9B,gBAAgB;;;OACd,MAAM,wBAAwB,CAAC;iCAC/B,MAAM,MAAM,+FAAe,KAAK;iCAChC,MAAM,MAAM,8FAAc,KAAK;OAC/B,MAAM,qBAAqB,CAAC;OAC7B;;KACD,UAAU,+BAA+B,MAAM;KAChD;IACD,oCAAoC;KAClC,gBAAgB,CACd,mBACE,OACA,4BACA,+BACD,CAAC,SACH;KACD,UAAU,mCAAmC,MAAM;KACpD;IACD,oCAAoC;KAClC,gBAAgB,CACd,mBACE,OACA,4BACA,+BACD,CAAC,SACH;KACD,UAAU,mCAAmC,MAAM;KACpD;IACF,CAAC;;EAEL;;;;;AAMH,MAAa,wBAAwB,gCAAgC"}
|
|
@@ -9,12 +9,15 @@ function createFacetedRowModel() {
|
|
|
9
9
|
feature: "columnFacetingFeature",
|
|
10
10
|
table,
|
|
11
11
|
fnName: "createFacetedRowModel",
|
|
12
|
-
memoDeps: () =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
memoDeps: () => {
|
|
13
|
+
var _table$atoms$columnFi, _table$atoms$globalFi;
|
|
14
|
+
return [
|
|
15
|
+
table.getPreFilteredRowModel(),
|
|
16
|
+
(_table$atoms$columnFi = table.atoms.columnFilters) === null || _table$atoms$columnFi === void 0 ? void 0 : _table$atoms$columnFi.get(),
|
|
17
|
+
(_table$atoms$globalFi = table.atoms.globalFilter) === null || _table$atoms$globalFi === void 0 ? void 0 : _table$atoms$globalFi.get(),
|
|
18
|
+
table.getFilteredRowModel()
|
|
19
|
+
];
|
|
20
|
+
},
|
|
18
21
|
fn: (preRowModel, columnFilters, globalFilter) => _createFacetedRowModel(table, columnId, preRowModel, columnFilters, globalFilter)
|
|
19
22
|
});
|
|
20
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFacetedRowModel.cjs","names":["tableMemo","filterRows"],"sources":["../../../src/features/column-faceting/createFacetedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { filterRows } from '../column-filtering/filterRowsUtils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type {\n ColumnFiltersState,\n Row_ColumnFiltering,\n} from '../column-filtering/columnFilteringFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\nexport function createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => RowModel<TFeatures, TData> {\n return (_table, columnId) => {\n const table = _table as Table_Internal<TFeatures, TData>\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'createFacetedRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.
|
|
1
|
+
{"version":3,"file":"createFacetedRowModel.cjs","names":["tableMemo","filterRows"],"sources":["../../../src/features/column-faceting/createFacetedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { filterRows } from '../column-filtering/filterRowsUtils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type {\n ColumnFiltersState,\n Row_ColumnFiltering,\n} from '../column-filtering/columnFilteringFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\nexport function createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => RowModel<TFeatures, TData> {\n return (_table, columnId) => {\n const table = _table as Table_Internal<TFeatures, TData>\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'createFacetedRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel(),\n ],\n fn: (preRowModel, columnFilters, globalFilter) =>\n _createFacetedRowModel(\n table,\n columnId,\n preRowModel,\n columnFilters,\n globalFilter,\n ),\n })\n }\n}\n\nfunction _createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n preRowModel: RowModel<TFeatures, TData>,\n columnFilters?: ColumnFiltersState,\n globalFilter?: string,\n) {\n if (!preRowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n return preRowModel\n }\n\n const filterableIds = [\n ...(columnFilters?.map((d) => d.id).filter((d) => d !== columnId) ?? []),\n globalFilter ? '__global__' : undefined,\n ].filter(Boolean) as Array<string>\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>,\n ) => {\n // Horizontally filter rows through each column\n for (const colId of filterableIds) {\n if (row.columnFilters?.[colId] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n}\n"],"mappings":";;;;AAYA,SAAgB,wBAMsB;AACpC,SAAQ,QAAQ,aAAa;EAC3B,MAAM,QAAQ;AACd,SAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;;KACd,MAAM,wBAAwB;8BAC9B,MAAM,MAAM,6FAAe,KAAK;8BAChC,MAAM,MAAM,4FAAc,KAAK;KAC/B,MAAM,qBAAqB;KAC5B;;GACD,KAAK,aAAa,eAAe,iBAC/B,uBACE,OACA,UACA,aACA,eACA,aACD;GACJ,CAAC;;;AAIN,SAAS,uBAIP,OACA,UACA,aACA,eACA,cACA;AACA,KAAI,CAAC,YAAY,KAAK,UAAW,gEAAC,cAAe,WAAU,CAAC,aAC1D,QAAO;CAGT,MAAM,gBAAgB,CACpB,kEAAI,cAAe,KAAK,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,MAAM,SAAS,KAAI,EAAE,EACvE,eAAe,eAAe,OAC/B,CAAC,OAAO,QAAQ;CAEjB,MAAM,kBACJ,QACG;AAEH,OAAK,MAAM,SAAS,eAAe;;AACjC,8BAAI,IAAI,uFAAgB,YAAW,MACjC,QAAO;;AAGX,SAAO;;AAGT,QAAOC,mCAAW,YAAY,MAAM,gBAAgB,MAAM"}
|
|
@@ -9,12 +9,15 @@ function createFacetedRowModel() {
|
|
|
9
9
|
feature: "columnFacetingFeature",
|
|
10
10
|
table,
|
|
11
11
|
fnName: "createFacetedRowModel",
|
|
12
|
-
memoDeps: () =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
memoDeps: () => {
|
|
13
|
+
var _table$atoms$columnFi, _table$atoms$globalFi;
|
|
14
|
+
return [
|
|
15
|
+
table.getPreFilteredRowModel(),
|
|
16
|
+
(_table$atoms$columnFi = table.atoms.columnFilters) === null || _table$atoms$columnFi === void 0 ? void 0 : _table$atoms$columnFi.get(),
|
|
17
|
+
(_table$atoms$globalFi = table.atoms.globalFilter) === null || _table$atoms$globalFi === void 0 ? void 0 : _table$atoms$globalFi.get(),
|
|
18
|
+
table.getFilteredRowModel()
|
|
19
|
+
];
|
|
20
|
+
},
|
|
18
21
|
fn: (preRowModel, columnFilters, globalFilter) => _createFacetedRowModel(table, columnId, preRowModel, columnFilters, globalFilter)
|
|
19
22
|
});
|
|
20
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFacetedRowModel.js","names":[],"sources":["../../../src/features/column-faceting/createFacetedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { filterRows } from '../column-filtering/filterRowsUtils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type {\n ColumnFiltersState,\n Row_ColumnFiltering,\n} from '../column-filtering/columnFilteringFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\nexport function createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => RowModel<TFeatures, TData> {\n return (_table, columnId) => {\n const table = _table as Table_Internal<TFeatures, TData>\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'createFacetedRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.
|
|
1
|
+
{"version":3,"file":"createFacetedRowModel.js","names":[],"sources":["../../../src/features/column-faceting/createFacetedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { filterRows } from '../column-filtering/filterRowsUtils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type {\n ColumnFiltersState,\n Row_ColumnFiltering,\n} from '../column-filtering/columnFilteringFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\nexport function createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => RowModel<TFeatures, TData> {\n return (_table, columnId) => {\n const table = _table as Table_Internal<TFeatures, TData>\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'createFacetedRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel(),\n ],\n fn: (preRowModel, columnFilters, globalFilter) =>\n _createFacetedRowModel(\n table,\n columnId,\n preRowModel,\n columnFilters,\n globalFilter,\n ),\n })\n }\n}\n\nfunction _createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n preRowModel: RowModel<TFeatures, TData>,\n columnFilters?: ColumnFiltersState,\n globalFilter?: string,\n) {\n if (!preRowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n return preRowModel\n }\n\n const filterableIds = [\n ...(columnFilters?.map((d) => d.id).filter((d) => d !== columnId) ?? []),\n globalFilter ? '__global__' : undefined,\n ].filter(Boolean) as Array<string>\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>,\n ) => {\n // Horizontally filter rows through each column\n for (const colId of filterableIds) {\n if (row.columnFilters?.[colId] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n}\n"],"mappings":";;;;AAYA,SAAgB,wBAMsB;AACpC,SAAQ,QAAQ,aAAa;EAC3B,MAAM,QAAQ;AACd,SAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;;KACd,MAAM,wBAAwB;8BAC9B,MAAM,MAAM,6FAAe,KAAK;8BAChC,MAAM,MAAM,4FAAc,KAAK;KAC/B,MAAM,qBAAqB;KAC5B;;GACD,KAAK,aAAa,eAAe,iBAC/B,uBACE,OACA,UACA,aACA,eACA,aACD;GACJ,CAAC;;;AAIN,SAAS,uBAIP,OACA,UACA,aACA,eACA,cACA;AACA,KAAI,CAAC,YAAY,KAAK,UAAW,gEAAC,cAAe,WAAU,CAAC,aAC1D,QAAO;CAGT,MAAM,gBAAgB,CACpB,kEAAI,cAAe,KAAK,MAAM,EAAE,GAAG,CAAC,QAAQ,MAAM,MAAM,SAAS,KAAI,EAAE,EACvE,eAAe,eAAe,OAC/B,CAAC,OAAO,QAAQ;CAEjB,MAAM,kBACJ,QACG;AAEH,OAAK,MAAM,SAAS,eAAe;;AACjC,8BAAI,IAAI,uFAAgB,YAAW,MACjC,QAAO;;AAGX,SAAO;;AAGT,QAAO,WAAW,YAAY,MAAM,gBAAgB,MAAM"}
|
|
@@ -2,7 +2,7 @@ const require_utils = require('../../utils.cjs');
|
|
|
2
2
|
|
|
3
3
|
//#region src/features/column-filtering/columnFilteringFeature.utils.ts
|
|
4
4
|
function getDefaultColumnFiltersState() {
|
|
5
|
-
return
|
|
5
|
+
return [];
|
|
6
6
|
}
|
|
7
7
|
function column_getAutoFilterFn(column) {
|
|
8
8
|
const filterFns = column.table._rowModelFns.filterFns;
|
|
@@ -29,12 +29,12 @@ function column_getIsFiltered(column) {
|
|
|
29
29
|
return column_getFilterIndex(column) > -1;
|
|
30
30
|
}
|
|
31
31
|
function column_getFilterValue(column) {
|
|
32
|
-
var _column$table$
|
|
33
|
-
return (_column$table$
|
|
32
|
+
var _column$table$atoms$c;
|
|
33
|
+
return (_column$table$atoms$c = column.table.atoms.columnFilters) === null || _column$table$atoms$c === void 0 || (_column$table$atoms$c = _column$table$atoms$c.get()) === null || _column$table$atoms$c === void 0 || (_column$table$atoms$c = _column$table$atoms$c.find((d) => d.id === column.id)) === null || _column$table$atoms$c === void 0 ? void 0 : _column$table$atoms$c.value;
|
|
34
34
|
}
|
|
35
35
|
function column_getFilterIndex(column) {
|
|
36
|
-
var _column$table$
|
|
37
|
-
return ((_column$table$
|
|
36
|
+
var _column$table$atoms$c2;
|
|
37
|
+
return ((_column$table$atoms$c2 = column.table.atoms.columnFilters) === null || _column$table$atoms$c2 === void 0 || (_column$table$atoms$c2 = _column$table$atoms$c2.get()) === null || _column$table$atoms$c2 === void 0 ? void 0 : _column$table$atoms$c2.findIndex((d) => d.id === column.id)) ?? -1;
|
|
38
38
|
}
|
|
39
39
|
function column_setFilterValue(column, value) {
|
|
40
40
|
table_setColumnFilters(column.table, (old) => {
|
|
@@ -69,7 +69,7 @@ function table_setColumnFilters(table, updater) {
|
|
|
69
69
|
(_table$options$onColu = (_table$options = table.options).onColumnFiltersChange) === null || _table$options$onColu === void 0 || _table$options$onColu.call(_table$options, updateFn);
|
|
70
70
|
}
|
|
71
71
|
function table_resetColumnFilters(table, defaultState) {
|
|
72
|
-
table_setColumnFilters(table, defaultState ? [] : table.initialState.columnFilters ?? []);
|
|
72
|
+
table_setColumnFilters(table, defaultState ? [] : require_utils.cloneState(table.initialState.columnFilters ?? []));
|
|
73
73
|
}
|
|
74
74
|
function shouldAutoRemoveFilter(filterFn, value, column) {
|
|
75
75
|
return (filterFn && filterFn.autoRemove ? filterFn.autoRemove(value, column) : false) || typeof value === "undefined" || typeof value === "string" && !value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnFilteringFeature.utils.cjs","names":["isFunction","functionalUpdate"],"sources":["../../../src/features/column-filtering/columnFilteringFeature.utils.ts"],"sourcesContent":["import { functionalUpdate, isFunction } from '../../utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\nimport type {\n ColumnFiltersState,\n FilterFn,\n} from './columnFilteringFeature.types'\n\nexport function getDefaultColumnFiltersState(): ColumnFiltersState {\n return
|
|
1
|
+
{"version":3,"file":"columnFilteringFeature.utils.cjs","names":["isFunction","functionalUpdate","cloneState"],"sources":["../../../src/features/column-filtering/columnFilteringFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate, isFunction } from '../../utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\nimport type {\n ColumnFiltersState,\n FilterFn,\n} from './columnFilteringFeature.types'\n\nexport function getDefaultColumnFiltersState(): ColumnFiltersState {\n return []\n}\n\nexport function column_getAutoFilterFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const filterFns = column.table._rowModelFns.filterFns as\n | Record<string, FilterFn<TFeatures, TData>>\n | undefined\n\n const firstRow = column.table.getCoreRowModel().flatRows[0]\n\n const value = firstRow ? firstRow.getValue(column.id) : undefined\n\n if (typeof value === 'string') {\n return filterFns?.includesString\n }\n\n if (typeof value === 'number') {\n return filterFns?.inNumberRange\n }\n\n if (typeof value === 'boolean') {\n return filterFns?.equals\n }\n\n if (value !== null && typeof value === 'object') {\n return filterFns?.equals\n }\n\n if (Array.isArray(value)) {\n return filterFns?.arrIncludes\n }\n\n return filterFns?.weakEquals\n}\n\nexport function column_getFilterFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n): FilterFn<TFeatures, TData> | undefined {\n let filterFn = null\n const filterFns = column.table._rowModelFns.filterFns as\n | Record<string, FilterFn<TFeatures, TData>>\n | undefined\n filterFn = isFunction(column.columnDef.filterFn)\n ? column.columnDef.filterFn\n : column.columnDef.filterFn === 'auto'\n ? column_getAutoFilterFn(column)\n : filterFns?.[column.columnDef.filterFn as string]\n\n if (process.env.NODE_ENV === 'development' && !filterFn) {\n console.warn(\n `Could not find a valid 'column.filterFn' for column with the ID: ${column.id}.`,\n )\n }\n\n return filterFn\n}\n\nexport function column_getCanFilter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (\n (column.columnDef.enableColumnFilter ?? true) &&\n (column.table.options.enableColumnFilters ?? true) &&\n (column.table.options.enableFilters ?? true) &&\n !!column.accessorFn\n )\n}\n\nexport function column_getIsFiltered<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return column_getFilterIndex(column) > -1\n}\n\nexport function column_getFilterValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return column.table.atoms.columnFilters\n ?.get()\n ?.find((d) => d.id === column.id)?.value\n}\n\nexport function column_getFilterIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): number {\n return (\n column.table.atoms.columnFilters\n ?.get()\n ?.findIndex((d) => d.id === column.id) ?? -1\n )\n}\n\nexport function column_setFilterValue<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>, value: any) {\n table_setColumnFilters(column.table, (old) => {\n const filterFn = column_getFilterFn(column)\n const previousFilter = old.find((d) => d.id === column.id)\n\n const newFilter = functionalUpdate(\n value,\n previousFilter ? previousFilter.value : undefined,\n )\n\n if (shouldAutoRemoveFilter(filterFn, newFilter, column)) {\n return old.filter((d) => d.id !== column.id)\n }\n\n const newFilterObj = { id: column.id, value: newFilter }\n\n if (previousFilter) {\n return old.map((d) => {\n if (d.id === column.id) {\n return newFilterObj\n }\n return d\n })\n }\n\n if (old.length) {\n return [...old, newFilterObj]\n }\n\n return [newFilterObj]\n })\n}\n\nexport function table_setColumnFilters<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<ColumnFiltersState>,\n) {\n const leafColumns = table.getAllLeafColumns()\n\n const updateFn = (old: ColumnFiltersState) => {\n return functionalUpdate(updater, old).filter((filter) => {\n const column = leafColumns.find((d) => d.id === filter.id)\n\n if (column) {\n const filterFn = column_getFilterFn(column)\n\n if (shouldAutoRemoveFilter(filterFn, filter.value, column)) {\n return false\n }\n }\n\n return true\n })\n }\n\n table.options.onColumnFiltersChange?.(updateFn)\n}\n\nexport function table_resetColumnFilters<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setColumnFilters(\n table,\n defaultState ? [] : cloneState(table.initialState.columnFilters ?? []),\n )\n}\n\nexport function shouldAutoRemoveFilter<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n filterFn?: FilterFn<TFeatures, TData>,\n value?: any,\n column?: Column_Internal<TFeatures, TData, TValue>,\n) {\n return (\n (filterFn && filterFn.autoRemove\n ? filterFn.autoRemove(\n value,\n column as Column_Internal<TFeatures, TData, unknown>,\n )\n : false) ||\n typeof value === 'undefined' ||\n (typeof value === 'string' && !value)\n )\n}\n"],"mappings":";;;AAUA,SAAgB,+BAAmD;AACjE,QAAO,EAAE;;AAGX,SAAgB,uBAId,QAAmD;CACnD,MAAM,YAAY,OAAO,MAAM,aAAa;CAI5C,MAAM,WAAW,OAAO,MAAM,iBAAiB,CAAC,SAAS;CAEzD,MAAM,QAAQ,WAAW,SAAS,SAAS,OAAO,GAAG,GAAG;AAExD,KAAI,OAAO,UAAU,SACnB,8DAAO,UAAW;AAGpB,KAAI,OAAO,UAAU,SACnB,8DAAO,UAAW;AAGpB,KAAI,OAAO,UAAU,UACnB,8DAAO,UAAW;AAGpB,KAAI,UAAU,QAAQ,OAAO,UAAU,SACrC,8DAAO,UAAW;AAGpB,KAAI,MAAM,QAAQ,MAAM,CACtB,8DAAO,UAAW;AAGpB,8DAAO,UAAW;;AAGpB,SAAgB,mBAKd,QACwC;CACxC,IAAI,WAAW;CACf,MAAM,YAAY,OAAO,MAAM,aAAa;AAG5C,YAAWA,yBAAW,OAAO,UAAU,SAAS,GAC5C,OAAO,UAAU,WACjB,OAAO,UAAU,aAAa,SAC5B,uBAAuB,OAAO,yDAC9B,UAAY,OAAO,UAAU;AAEnC,KAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,SAC7C,SAAQ,KACN,oEAAoE,OAAO,GAAG,GAC/E;AAGH,QAAO;;AAGT,SAAgB,oBAId,QAAmD;AACnD,SACG,OAAO,UAAU,sBAAsB,UACvC,OAAO,MAAM,QAAQ,uBAAuB,UAC5C,OAAO,MAAM,QAAQ,iBAAiB,SACvC,CAAC,CAAC,OAAO;;AAIb,SAAgB,qBAId,QAAmD;AACnD,QAAO,sBAAsB,OAAO,GAAG;;AAGzC,SAAgB,sBAId,QAAmD;;AACnD,iCAAO,OAAO,MAAM,MAAM,8GACtB,KAAK,iGACL,MAAM,MAAM,EAAE,OAAO,OAAO,GAAG,gFAAE;;AAGvC,SAAgB,sBAId,QAA2D;;AAC3D,mCACE,OAAO,MAAM,MAAM,iHACf,KAAK,kFACL,WAAW,MAAM,EAAE,OAAO,OAAO,GAAG,KAAI;;AAIhD,SAAgB,sBAId,QAAmD,OAAY;AAC/D,wBAAuB,OAAO,QAAQ,QAAQ;EAC5C,MAAM,WAAW,mBAAmB,OAAO;EAC3C,MAAM,iBAAiB,IAAI,MAAM,MAAM,EAAE,OAAO,OAAO,GAAG;EAE1D,MAAM,YAAYC,+BAChB,OACA,iBAAiB,eAAe,QAAQ,OACzC;AAED,MAAI,uBAAuB,UAAU,WAAW,OAAO,CACrD,QAAO,IAAI,QAAQ,MAAM,EAAE,OAAO,OAAO,GAAG;EAG9C,MAAM,eAAe;GAAE,IAAI,OAAO;GAAI,OAAO;GAAW;AAExD,MAAI,eACF,QAAO,IAAI,KAAK,MAAM;AACpB,OAAI,EAAE,OAAO,OAAO,GAClB,QAAO;AAET,UAAO;IACP;AAGJ,MAAI,IAAI,OACN,QAAO,CAAC,GAAG,KAAK,aAAa;AAG/B,SAAO,CAAC,aAAa;GACrB;;AAGJ,SAAgB,uBAId,OACA,SACA;;CACA,MAAM,cAAc,MAAM,mBAAmB;CAE7C,MAAM,YAAY,QAA4B;AAC5C,SAAOA,+BAAiB,SAAS,IAAI,CAAC,QAAQ,WAAW;GACvD,MAAM,SAAS,YAAY,MAAM,MAAM,EAAE,OAAO,OAAO,GAAG;AAE1D,OAAI,QAGF;QAAI,uBAFa,mBAAmB,OAAO,EAEN,OAAO,OAAO,OAAO,CACxD,QAAO;;AAIX,UAAO;IACP;;AAGJ,kDAAM,SAAQ,kHAAwB,SAAS;;AAGjD,SAAgB,yBAGd,OAAyC,cAAwB;AACjE,wBACE,OACA,eAAe,EAAE,GAAGC,yBAAW,MAAM,aAAa,iBAAiB,EAAE,CAAC,CACvE;;AAGH,SAAgB,uBAKd,UACA,OACA,QACA;AACA,SACG,YAAY,SAAS,aAClB,SAAS,WACP,OACA,OACD,GACD,UACJ,OAAO,UAAU,eAChB,OAAO,UAAU,YAAY,CAAC"}
|