@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
|
@@ -1,17 +1,65 @@
|
|
|
1
|
-
import type { ReadonlyStore, Store } from '@tanstack/store'
|
|
1
|
+
import type { Atom, ReadonlyAtom, ReadonlyStore, Store } from '@tanstack/store'
|
|
2
2
|
import type { CoreFeatures } from '../coreFeatures'
|
|
3
3
|
import type { RowModelFns } from '../../types/RowModelFns'
|
|
4
4
|
import type { RowData, Updater } from '../../types/type-utils'
|
|
5
5
|
import type { TableFeatures } from '../../types/TableFeatures'
|
|
6
6
|
import type { CachedRowModels, CreateRowModels_All } from '../../types/RowModel'
|
|
7
7
|
import type { TableOptions } from '../../types/TableOptions'
|
|
8
|
-
import type { TableState } from '../../types/TableState'
|
|
8
|
+
import type { TableState, TableState_All } from '../../types/TableState'
|
|
9
9
|
|
|
10
10
|
export interface TableMeta<
|
|
11
11
|
TFeatures extends TableFeatures,
|
|
12
12
|
TData extends RowData,
|
|
13
13
|
> {}
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* A map of writable atoms, one per `TableState` slice. These are the internal
|
|
17
|
+
* writable atoms that the library always writes to via `makeStateUpdater`.
|
|
18
|
+
*/
|
|
19
|
+
export type BaseAtoms<TFeatures extends TableFeatures> = {
|
|
20
|
+
[K in keyof TableState<TFeatures>]-?: Atom<TableState<TFeatures>[K]>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A map of readonly derived atoms, one per `TableState` slice. Each derives
|
|
25
|
+
* from its corresponding `baseAtom` plus, optionally, a per-slice external
|
|
26
|
+
* atom or external state value.
|
|
27
|
+
*
|
|
28
|
+
* Precedence: `options.atoms[key]` > `options.state[key]` > `baseAtoms[key]`.
|
|
29
|
+
*/
|
|
30
|
+
export type Atoms<TFeatures extends TableFeatures> = {
|
|
31
|
+
[K in keyof TableState<TFeatures>]-?: ReadonlyAtom<TableState<TFeatures>[K]>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A map of optional external atoms, one per `TableState` slice. Consumers can
|
|
36
|
+
* provide their own writable atom for any state slice to take over ownership
|
|
37
|
+
* of that slice.
|
|
38
|
+
*/
|
|
39
|
+
export type ExternalAtoms<TFeatures extends TableFeatures> = Partial<{
|
|
40
|
+
[K in keyof TableState<TFeatures>]: Atom<TableState<TFeatures>[K]>
|
|
41
|
+
}>
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Internal "all features" flat variants of the atom types. `Table_Internal`
|
|
45
|
+
* uses these so feature code (written generically over `TFeatures`) can access
|
|
46
|
+
* any slice atom (e.g. `table.atoms.columnPinning`) without TypeScript
|
|
47
|
+
* narrowing away slices that aren't in the current `TFeatures` union.
|
|
48
|
+
*
|
|
49
|
+
* Keys are optional: feature code can read atoms from slices it doesn't own,
|
|
50
|
+
* but those slices may not be registered on the current table. Consumers must
|
|
51
|
+
* use optional chaining (`table.atoms.columnPinning?.get() ?? default`).
|
|
52
|
+
*/
|
|
53
|
+
export type BaseAtoms_All = {
|
|
54
|
+
[K in keyof TableState_All]?: Atom<TableState_All[K]>
|
|
55
|
+
}
|
|
56
|
+
export type Atoms_All = {
|
|
57
|
+
[K in keyof TableState_All]?: ReadonlyAtom<TableState_All[K]>
|
|
58
|
+
}
|
|
59
|
+
export type ExternalAtoms_All = Partial<{
|
|
60
|
+
[K in keyof TableState_All]: Atom<TableState_All[K]>
|
|
61
|
+
}>
|
|
62
|
+
|
|
15
63
|
export interface TableOptions_Table<
|
|
16
64
|
TFeatures extends TableFeatures,
|
|
17
65
|
TData extends RowData,
|
|
@@ -24,6 +72,14 @@ export interface TableOptions_Table<
|
|
|
24
72
|
* The row model options that you want to enable for the table.
|
|
25
73
|
*/
|
|
26
74
|
_rowModels?: CreateRowModels_All<TFeatures, TData>
|
|
75
|
+
/**
|
|
76
|
+
* Optionally, provide your own external writable atoms for individual state slices.
|
|
77
|
+
* When an atom is provided for a given slice, it takes precedence over `options.state[key]`
|
|
78
|
+
* and the internal base atom for that slice. Writes originating from the library are
|
|
79
|
+
* still routed through the internal base atom; consumers are responsible for
|
|
80
|
+
* mirroring changes back to their external atom via the corresponding `onXChange` callback.
|
|
81
|
+
*/
|
|
82
|
+
atoms?: ExternalAtoms<TFeatures>
|
|
27
83
|
/**
|
|
28
84
|
* Set this option to override any of the `autoReset...` feature options.
|
|
29
85
|
*/
|
|
@@ -52,10 +108,6 @@ export interface TableOptions_Table<
|
|
|
52
108
|
* Pass in individual self-managed state to the table.
|
|
53
109
|
*/
|
|
54
110
|
state?: Partial<TableState<TFeatures>>
|
|
55
|
-
/**
|
|
56
|
-
* Optionally, provide your own external TanStack Store instance if you want to manage the table state externally.
|
|
57
|
-
*/
|
|
58
|
-
store?: Store<TableState<TFeatures>>
|
|
59
111
|
}
|
|
60
112
|
|
|
61
113
|
export interface Table_CoreProperties<
|
|
@@ -91,9 +143,16 @@ export interface Table_CoreProperties<
|
|
|
91
143
|
*/
|
|
92
144
|
_rowPrototype?: object
|
|
93
145
|
/**
|
|
94
|
-
* The
|
|
146
|
+
* The internal writable atoms for each `TableState` slice. This is the library's
|
|
147
|
+
* single write surface — all state mutations from features land here.
|
|
148
|
+
*/
|
|
149
|
+
baseAtoms: BaseAtoms<TFeatures>
|
|
150
|
+
/**
|
|
151
|
+
* The readonly derived atoms for each `TableState` slice. Each derives from
|
|
152
|
+
* its corresponding `baseAtom` plus, optionally, a per-slice external atom or
|
|
153
|
+
* external state value (precedence: external atom > external state > base atom).
|
|
95
154
|
*/
|
|
96
|
-
|
|
155
|
+
atoms: Atoms<TFeatures>
|
|
97
156
|
/**
|
|
98
157
|
* The base store for the table options.
|
|
99
158
|
*/
|
|
@@ -107,7 +166,8 @@ export interface Table_CoreProperties<
|
|
|
107
166
|
*/
|
|
108
167
|
readonly options: TableOptions<TFeatures, TData>
|
|
109
168
|
/**
|
|
110
|
-
*
|
|
169
|
+
* The readonly flat store for the table state. Derives from `table.atoms`
|
|
170
|
+
* only; never reads external state directly.
|
|
111
171
|
*/
|
|
112
172
|
store: ReadonlyStore<TableState<TFeatures>>
|
|
113
173
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { batch } from '@tanstack/store'
|
|
2
|
+
import { cloneState, functionalUpdate } from '../../utils'
|
|
2
3
|
import type { RowData, Updater } from '../../types/type-utils'
|
|
3
4
|
import type { TableFeatures } from '../../types/TableFeatures'
|
|
4
5
|
import type { Table_Internal } from '../../types/Table'
|
|
@@ -8,7 +9,12 @@ export function table_reset<
|
|
|
8
9
|
TFeatures extends TableFeatures,
|
|
9
10
|
TData extends RowData,
|
|
10
11
|
>(table: Table_Internal<TFeatures, TData>): void {
|
|
11
|
-
|
|
12
|
+
const snap = cloneState(table.initialState)
|
|
13
|
+
batch(() => {
|
|
14
|
+
for (const key of Object.keys(snap) as Array<keyof typeof snap>) {
|
|
15
|
+
;(table.baseAtoms as any)[key].set(snap[key] as any)
|
|
16
|
+
}
|
|
17
|
+
})
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
export function table_mergeOptions<
|
|
@@ -39,8 +39,8 @@ export function constructColumnFacetingFeature<
|
|
|
39
39
|
column_getFacetedRowModel: {
|
|
40
40
|
memoDeps: () => [
|
|
41
41
|
table.getPreFilteredRowModel().rows,
|
|
42
|
-
table.
|
|
43
|
-
table.
|
|
42
|
+
table.atoms.columnFilters?.get(),
|
|
43
|
+
table.atoms.globalFilter?.get(),
|
|
44
44
|
table.getFilteredRowModel().rows,
|
|
45
45
|
],
|
|
46
46
|
fn: (column) => column_getFacetedRowModel(column, column.table),
|
|
@@ -75,8 +75,8 @@ export function constructColumnFacetingFeature<
|
|
|
75
75
|
table_getGlobalFacetedRowModel: {
|
|
76
76
|
memoDeps: () => [
|
|
77
77
|
table.getPreFilteredRowModel().rows,
|
|
78
|
-
table.
|
|
79
|
-
table.
|
|
78
|
+
table.atoms.columnFilters?.get(),
|
|
79
|
+
table.atoms.globalFilter?.get(),
|
|
80
80
|
table.getFilteredRowModel().rows,
|
|
81
81
|
],
|
|
82
82
|
fn: () => table_getGlobalFacetedRowModel(table),
|
|
@@ -25,8 +25,8 @@ export function createFacetedRowModel<
|
|
|
25
25
|
fnName: 'createFacetedRowModel',
|
|
26
26
|
memoDeps: () => [
|
|
27
27
|
table.getPreFilteredRowModel(),
|
|
28
|
-
table.
|
|
29
|
-
table.
|
|
28
|
+
table.atoms.columnFilters?.get(),
|
|
29
|
+
table.atoms.globalFilter?.get(),
|
|
30
30
|
table.getFilteredRowModel(),
|
|
31
31
|
],
|
|
32
32
|
fn: (preRowModel, columnFilters, globalFilter) =>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { functionalUpdate, isFunction } from '../../utils'
|
|
1
|
+
import { cloneState, functionalUpdate, isFunction } from '../../utils'
|
|
2
2
|
import type { CellData, RowData, Updater } from '../../types/type-utils'
|
|
3
3
|
import type { TableFeatures } from '../../types/TableFeatures'
|
|
4
4
|
import type { Table_Internal } from '../../types/Table'
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
} from './columnFilteringFeature.types'
|
|
10
10
|
|
|
11
11
|
export function getDefaultColumnFiltersState(): ColumnFiltersState {
|
|
12
|
-
return
|
|
12
|
+
return []
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function column_getAutoFilterFn<
|
|
@@ -100,8 +100,9 @@ export function column_getFilterValue<
|
|
|
100
100
|
TData extends RowData,
|
|
101
101
|
TValue extends CellData = CellData,
|
|
102
102
|
>(column: Column_Internal<TFeatures, TData, TValue>) {
|
|
103
|
-
return column.table.
|
|
104
|
-
?.
|
|
103
|
+
return column.table.atoms.columnFilters
|
|
104
|
+
?.get()
|
|
105
|
+
?.find((d) => d.id === column.id)?.value
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
export function column_getFilterIndex<
|
|
@@ -110,9 +111,9 @@ export function column_getFilterIndex<
|
|
|
110
111
|
TValue extends CellData = CellData,
|
|
111
112
|
>(column: Column_Internal<TFeatures, TData, TValue>): number {
|
|
112
113
|
return (
|
|
113
|
-
column.table.
|
|
114
|
-
(
|
|
115
|
-
|
|
114
|
+
column.table.atoms.columnFilters
|
|
115
|
+
?.get()
|
|
116
|
+
?.findIndex((d) => d.id === column.id) ?? -1
|
|
116
117
|
)
|
|
117
118
|
}
|
|
118
119
|
|
|
@@ -187,7 +188,7 @@ export function table_resetColumnFilters<
|
|
|
187
188
|
>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {
|
|
188
189
|
table_setColumnFilters(
|
|
189
190
|
table,
|
|
190
|
-
defaultState ? [] : (table.initialState.columnFilters ?? []),
|
|
191
|
+
defaultState ? [] : cloneState(table.initialState.columnFilters ?? []),
|
|
191
192
|
)
|
|
192
193
|
}
|
|
193
194
|
|
|
@@ -34,8 +34,8 @@ export function createFilteredRowModel<
|
|
|
34
34
|
fnName: 'table.getFilteredRowModel',
|
|
35
35
|
memoDeps: () => [
|
|
36
36
|
table.getPreFilteredRowModel(),
|
|
37
|
-
table.
|
|
38
|
-
table.
|
|
37
|
+
table.atoms.columnFilters?.get(),
|
|
38
|
+
table.atoms.globalFilter?.get(),
|
|
39
39
|
],
|
|
40
40
|
fn: () => _createFilteredRowModel(table),
|
|
41
41
|
onAfterUpdate: () => table_autoResetPageIndex(table),
|
|
@@ -48,7 +48,8 @@ function _createFilteredRowModel<
|
|
|
48
48
|
TData extends RowData = any,
|
|
49
49
|
>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {
|
|
50
50
|
const rowModel = table.getPreFilteredRowModel()
|
|
51
|
-
const
|
|
51
|
+
const columnFilters = table.atoms.columnFilters?.get()
|
|
52
|
+
const globalFilter = table.atoms.globalFilter?.get()
|
|
52
53
|
|
|
53
54
|
if (!rowModel.rows.length || (!columnFilters?.length && !globalFilter)) {
|
|
54
55
|
for (const row of rowModel.flatRows as Array<
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isFunction } from '../../utils'
|
|
1
|
+
import { cloneState, isFunction } from '../../utils'
|
|
2
2
|
import { table_getColumn } from '../../core/columns/coreColumnsFeature.utils'
|
|
3
3
|
import type { Column_Internal } from '../../types/Column'
|
|
4
4
|
import type { CellData, RowData, Updater } from '../../types/type-utils'
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
} from './columnGroupingFeature.types'
|
|
14
14
|
|
|
15
15
|
export function getDefaultGroupingState(): GroupingState {
|
|
16
|
-
return
|
|
16
|
+
return []
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function column_toggleGrouping<
|
|
@@ -48,7 +48,7 @@ export function column_getIsGrouped<
|
|
|
48
48
|
TData extends RowData,
|
|
49
49
|
TValue extends CellData = CellData,
|
|
50
50
|
>(column: Column_Internal<TFeatures, TData, TValue>): boolean {
|
|
51
|
-
return !!column.table.
|
|
51
|
+
return !!column.table.atoms.grouping?.get()?.includes(column.id)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export function column_getGroupedIndex<
|
|
@@ -56,7 +56,7 @@ export function column_getGroupedIndex<
|
|
|
56
56
|
TData extends RowData,
|
|
57
57
|
TValue extends CellData = CellData,
|
|
58
58
|
>(column: Column_Internal<TFeatures, TData, TValue>): number {
|
|
59
|
-
return column.table.
|
|
59
|
+
return column.table.atoms.grouping?.get()?.indexOf(column.id) ?? -1
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export function column_getToggleGroupingHandler<
|
|
@@ -123,7 +123,7 @@ export function table_resetGrouping<
|
|
|
123
123
|
>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {
|
|
124
124
|
table_setGrouping(
|
|
125
125
|
table,
|
|
126
|
-
defaultState ? [] : (table.initialState.grouping ?? []),
|
|
126
|
+
defaultState ? [] : cloneState(table.initialState.grouping ?? []),
|
|
127
127
|
)
|
|
128
128
|
}
|
|
129
129
|
|
|
@@ -34,7 +34,7 @@ export function createGroupedRowModel<
|
|
|
34
34
|
table,
|
|
35
35
|
fnName: 'table.getGroupedRowModel',
|
|
36
36
|
memoDeps: () => [
|
|
37
|
-
table.
|
|
37
|
+
table.atoms.grouping?.get(),
|
|
38
38
|
table.getPreGroupedRowModel(),
|
|
39
39
|
],
|
|
40
40
|
fn: () => _createGroupedRowModel(table),
|
|
@@ -51,7 +51,7 @@ function _createGroupedRowModel<
|
|
|
51
51
|
TData extends RowData = any,
|
|
52
52
|
>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {
|
|
53
53
|
const rowModel = table.getPreGroupedRowModel()
|
|
54
|
-
const grouping = table.
|
|
54
|
+
const grouping = table.atoms.grouping?.get()
|
|
55
55
|
|
|
56
56
|
if (!rowModel.rows.length || !grouping?.length) {
|
|
57
57
|
rowModel.rows.forEach((row) => {
|
|
@@ -55,9 +55,9 @@ export function constructColumnOrderingFeature<
|
|
|
55
55
|
fn: (column, position) => column_getIndex(column, position),
|
|
56
56
|
memoDeps: (column, position) => [
|
|
57
57
|
position,
|
|
58
|
-
column.table.
|
|
59
|
-
column.table.
|
|
60
|
-
column.table.
|
|
58
|
+
column.table.atoms.columnOrder?.get(),
|
|
59
|
+
column.table.atoms.columnPinning?.get(),
|
|
60
|
+
column.table.atoms.grouping?.get(),
|
|
61
61
|
],
|
|
62
62
|
},
|
|
63
63
|
column_getIsFirstColumn: {
|
|
@@ -80,8 +80,8 @@ export function constructColumnOrderingFeature<
|
|
|
80
80
|
table_getOrderColumnsFn: {
|
|
81
81
|
fn: () => table_getOrderColumnsFn(table),
|
|
82
82
|
memoDeps: () => [
|
|
83
|
-
table.
|
|
84
|
-
table.
|
|
83
|
+
table.atoms.columnOrder?.get(),
|
|
84
|
+
table.atoms.grouping?.get(),
|
|
85
85
|
table.options.groupedColumnMode,
|
|
86
86
|
],
|
|
87
87
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { table_getPinnedVisibleLeafColumns } from '../column-pinning/columnPinningFeature.utils'
|
|
2
|
+
import { cloneState } from '../../utils'
|
|
2
3
|
import type { GroupingState } from '../column-grouping/columnGroupingFeature.types'
|
|
3
4
|
import type { CellData, RowData, Updater } from '../../types/type-utils'
|
|
4
5
|
import type { TableFeatures } from '../../types/TableFeatures'
|
|
@@ -8,7 +9,7 @@ import type { ColumnPinningPosition } from '../column-pinning/columnPinningFeatu
|
|
|
8
9
|
import type { ColumnOrderState } from './columnOrderingFeature.types'
|
|
9
10
|
|
|
10
11
|
export function getDefaultColumnOrderState(): ColumnOrderState {
|
|
11
|
-
return
|
|
12
|
+
return []
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export function column_getIndex<
|
|
@@ -60,7 +61,7 @@ export function table_resetColumnOrder<
|
|
|
60
61
|
>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {
|
|
61
62
|
table_setColumnOrder(
|
|
62
63
|
table,
|
|
63
|
-
defaultState ? [] : (table.initialState.columnOrder ?? []),
|
|
64
|
+
defaultState ? [] : cloneState(table.initialState.columnOrder ?? []),
|
|
64
65
|
)
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -68,7 +69,7 @@ export function table_getOrderColumnsFn<
|
|
|
68
69
|
TFeatures extends TableFeatures,
|
|
69
70
|
TData extends RowData,
|
|
70
71
|
>(table: Table_Internal<TFeatures, TData>) {
|
|
71
|
-
const
|
|
72
|
+
const columnOrder = table.atoms.columnOrder?.get()
|
|
72
73
|
|
|
73
74
|
return (columns: Array<Column_Internal<TFeatures, TData, unknown>>) => {
|
|
74
75
|
// Sort grouped columns to the start of the column list
|
|
@@ -76,7 +77,7 @@ export function table_getOrderColumnsFn<
|
|
|
76
77
|
let orderedColumns: Array<Column_Internal<TFeatures, TData, unknown>> = []
|
|
77
78
|
|
|
78
79
|
// If there is no order, return the normal columns
|
|
79
|
-
if (!columnOrder
|
|
80
|
+
if (!columnOrder?.length) {
|
|
80
81
|
orderedColumns = columns
|
|
81
82
|
} else {
|
|
82
83
|
const columnOrderCopy = [...columnOrder]
|
|
@@ -110,7 +111,7 @@ export function orderColumns<
|
|
|
110
111
|
table: Table_Internal<TFeatures, TData>,
|
|
111
112
|
leafColumns: Array<Column_Internal<TFeatures, TData, unknown>>,
|
|
112
113
|
) {
|
|
113
|
-
const grouping = table.
|
|
114
|
+
const grouping = table.atoms.grouping?.get() ?? ([] as GroupingState)
|
|
114
115
|
const { groupedColumnMode } = table.options
|
|
115
116
|
|
|
116
117
|
if (!grouping.length || !groupedColumnMode) {
|
|
@@ -70,6 +70,7 @@ export function constructColumnPinningFeature<
|
|
|
70
70
|
...getDefaultColumnPinningState(),
|
|
71
71
|
...initialState.columnPinning,
|
|
72
72
|
},
|
|
73
|
+
...initialState,
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
|
|
@@ -102,24 +103,24 @@ export function constructColumnPinningFeature<
|
|
|
102
103
|
fn: (row) => row_getCenterVisibleCells(row),
|
|
103
104
|
memoDeps: (row) => [
|
|
104
105
|
row.getAllCells(),
|
|
105
|
-
row.table.
|
|
106
|
-
row.table.
|
|
106
|
+
row.table.atoms.columnPinning?.get(),
|
|
107
|
+
row.table.atoms.columnVisibility?.get(),
|
|
107
108
|
],
|
|
108
109
|
},
|
|
109
110
|
row_getLeftVisibleCells: {
|
|
110
111
|
fn: (row) => row_getLeftVisibleCells(row),
|
|
111
112
|
memoDeps: (row) => [
|
|
112
113
|
row.getAllCells(),
|
|
113
|
-
row.table.
|
|
114
|
-
row.table.
|
|
114
|
+
row.table.atoms.columnPinning?.get()?.left,
|
|
115
|
+
row.table.atoms.columnVisibility?.get(),
|
|
115
116
|
],
|
|
116
117
|
},
|
|
117
118
|
row_getRightVisibleCells: {
|
|
118
119
|
fn: (row) => row_getRightVisibleCells(row),
|
|
119
120
|
memoDeps: (row) => [
|
|
120
121
|
row.getAllCells(),
|
|
121
|
-
row.table.
|
|
122
|
-
row.table.
|
|
122
|
+
row.table.atoms.columnPinning?.get()?.right,
|
|
123
|
+
row.table.atoms.columnVisibility?.get(),
|
|
123
124
|
],
|
|
124
125
|
},
|
|
125
126
|
})
|
|
@@ -146,8 +147,8 @@ export function constructColumnPinningFeature<
|
|
|
146
147
|
'getVisibleLeafColumns',
|
|
147
148
|
table_getVisibleLeafColumns,
|
|
148
149
|
),
|
|
149
|
-
table.
|
|
150
|
-
table.
|
|
150
|
+
table.atoms.columnPinning?.get()?.left,
|
|
151
|
+
table.atoms.columnOrder?.get(),
|
|
151
152
|
],
|
|
152
153
|
},
|
|
153
154
|
table_getCenterHeaderGroups: {
|
|
@@ -159,8 +160,8 @@ export function constructColumnPinningFeature<
|
|
|
159
160
|
'getVisibleLeafColumns',
|
|
160
161
|
table_getVisibleLeafColumns,
|
|
161
162
|
),
|
|
162
|
-
table.
|
|
163
|
-
table.
|
|
163
|
+
table.atoms.columnPinning?.get(),
|
|
164
|
+
table.atoms.columnOrder?.get(),
|
|
164
165
|
],
|
|
165
166
|
},
|
|
166
167
|
table_getRightHeaderGroups: {
|
|
@@ -172,8 +173,8 @@ export function constructColumnPinningFeature<
|
|
|
172
173
|
'getVisibleLeafColumns',
|
|
173
174
|
table_getVisibleLeafColumns,
|
|
174
175
|
),
|
|
175
|
-
table.
|
|
176
|
-
table.
|
|
176
|
+
table.atoms.columnPinning?.get()?.right,
|
|
177
|
+
table.atoms.columnOrder?.get(),
|
|
177
178
|
],
|
|
178
179
|
},
|
|
179
180
|
// footer groups
|
|
@@ -274,21 +275,21 @@ export function constructColumnPinningFeature<
|
|
|
274
275
|
fn: () => table_getLeftLeafColumns(table),
|
|
275
276
|
memoDeps: () => [
|
|
276
277
|
table.options.columns,
|
|
277
|
-
table.
|
|
278
|
+
table.atoms.columnPinning?.get(),
|
|
278
279
|
],
|
|
279
280
|
},
|
|
280
281
|
table_getRightLeafColumns: {
|
|
281
282
|
fn: () => table_getRightLeafColumns(table),
|
|
282
283
|
memoDeps: () => [
|
|
283
284
|
table.options.columns,
|
|
284
|
-
table.
|
|
285
|
+
table.atoms.columnPinning?.get(),
|
|
285
286
|
],
|
|
286
287
|
},
|
|
287
288
|
table_getCenterLeafColumns: {
|
|
288
289
|
fn: () => table_getCenterLeafColumns(table),
|
|
289
290
|
memoDeps: () => [
|
|
290
291
|
table.options.columns,
|
|
291
|
-
table.
|
|
292
|
+
table.atoms.columnPinning?.get(),
|
|
292
293
|
],
|
|
293
294
|
},
|
|
294
295
|
// visible leaf columns
|
|
@@ -296,24 +297,24 @@ export function constructColumnPinningFeature<
|
|
|
296
297
|
fn: () => table_getLeftVisibleLeafColumns(table),
|
|
297
298
|
memoDeps: () => [
|
|
298
299
|
table.options.columns,
|
|
299
|
-
table.
|
|
300
|
-
table.
|
|
300
|
+
table.atoms.columnPinning?.get(),
|
|
301
|
+
table.atoms.columnVisibility?.get(),
|
|
301
302
|
],
|
|
302
303
|
},
|
|
303
304
|
table_getCenterVisibleLeafColumns: {
|
|
304
305
|
fn: () => table_getCenterVisibleLeafColumns(table),
|
|
305
306
|
memoDeps: () => [
|
|
306
307
|
table.options.columns,
|
|
307
|
-
table.
|
|
308
|
-
table.
|
|
308
|
+
table.atoms.columnPinning?.get(),
|
|
309
|
+
table.atoms.columnVisibility?.get(),
|
|
309
310
|
],
|
|
310
311
|
},
|
|
311
312
|
table_getRightVisibleLeafColumns: {
|
|
312
313
|
fn: () => table_getRightVisibleLeafColumns(table),
|
|
313
314
|
memoDeps: () => [
|
|
314
315
|
table.options.columns,
|
|
315
|
-
table.
|
|
316
|
-
table.
|
|
316
|
+
table.atoms.columnPinning?.get(),
|
|
317
|
+
table.atoms.columnVisibility?.get(),
|
|
317
318
|
],
|
|
318
319
|
},
|
|
319
320
|
})
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
table_getVisibleLeafColumns,
|
|
5
5
|
} from '../column-visibility/columnVisibilityFeature.utils'
|
|
6
6
|
import { buildHeaderGroups } from '../../core/headers/buildHeaderGroups'
|
|
7
|
-
import { callMemoOrStaticFn } from '../../utils'
|
|
7
|
+
import { callMemoOrStaticFn, cloneState } from '../../utils'
|
|
8
8
|
import type { HeaderGroup } from '../../types/HeaderGroup'
|
|
9
9
|
import type { Cell } from '../../types/Cell'
|
|
10
10
|
import type { Row } from '../../types/Row'
|
|
@@ -20,10 +20,10 @@ import type {
|
|
|
20
20
|
// State
|
|
21
21
|
|
|
22
22
|
export function getDefaultColumnPinningState(): ColumnPinningState {
|
|
23
|
-
return
|
|
23
|
+
return {
|
|
24
24
|
left: [],
|
|
25
25
|
right: [],
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// Column APIs
|
|
@@ -92,7 +92,7 @@ export function column_getIsPinned<
|
|
|
92
92
|
const leafColumnIds = column.getLeafColumns().map((d) => d.id)
|
|
93
93
|
|
|
94
94
|
const { left, right } =
|
|
95
|
-
column.table.
|
|
95
|
+
column.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
96
96
|
|
|
97
97
|
const isLeft = leafColumnIds.some((d) => left.includes(d))
|
|
98
98
|
const isRight = leafColumnIds.some((d) => right.includes(d))
|
|
@@ -108,7 +108,7 @@ export function column_getPinnedIndex<
|
|
|
108
108
|
const position = column_getIsPinned(column)
|
|
109
109
|
|
|
110
110
|
return position
|
|
111
|
-
? (column.table.
|
|
111
|
+
? (column.table.atoms.columnPinning?.get()?.[position].indexOf(column.id) ??
|
|
112
112
|
-1)
|
|
113
113
|
: 0
|
|
114
114
|
}
|
|
@@ -125,7 +125,7 @@ export function row_getCenterVisibleCells<
|
|
|
125
125
|
row_getAllVisibleCells,
|
|
126
126
|
)
|
|
127
127
|
const { left, right } =
|
|
128
|
-
row.table.
|
|
128
|
+
row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
129
129
|
const leftAndRight: Array<string> = [...left, ...right]
|
|
130
130
|
return allCells.filter((d) => !leftAndRight.includes(d.column.id))
|
|
131
131
|
}
|
|
@@ -140,7 +140,7 @@ export function row_getLeftVisibleCells<
|
|
|
140
140
|
row_getAllVisibleCells,
|
|
141
141
|
)
|
|
142
142
|
const { left } =
|
|
143
|
-
row.table.
|
|
143
|
+
row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
144
144
|
const cells = left
|
|
145
145
|
.map((columnId) => allCells.find((cell) => cell.column.id === columnId)!)
|
|
146
146
|
.filter(Boolean)
|
|
@@ -161,7 +161,7 @@ export function row_getRightVisibleCells<
|
|
|
161
161
|
row_getAllVisibleCells,
|
|
162
162
|
)
|
|
163
163
|
const { right } =
|
|
164
|
-
row.table.
|
|
164
|
+
row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
165
165
|
const cells = right
|
|
166
166
|
.map((columnId) => allCells.find((cell) => cell.column.id === columnId)!)
|
|
167
167
|
.filter(Boolean)
|
|
@@ -192,7 +192,9 @@ export function table_resetColumnPinning<
|
|
|
192
192
|
table,
|
|
193
193
|
defaultState
|
|
194
194
|
? getDefaultColumnPinningState()
|
|
195
|
-
: (
|
|
195
|
+
: cloneState(
|
|
196
|
+
table.initialState.columnPinning ?? getDefaultColumnPinningState(),
|
|
197
|
+
),
|
|
196
198
|
)
|
|
197
199
|
}
|
|
198
200
|
|
|
@@ -200,7 +202,7 @@ export function table_getIsSomeColumnsPinned<
|
|
|
200
202
|
TFeatures extends TableFeatures,
|
|
201
203
|
TData extends RowData,
|
|
202
204
|
>(table: Table_Internal<TFeatures, TData>, position?: ColumnPinningPosition) {
|
|
203
|
-
const pinningState = table.
|
|
205
|
+
const pinningState = table.atoms.columnPinning?.get()
|
|
204
206
|
|
|
205
207
|
if (!position) {
|
|
206
208
|
return Boolean(pinningState?.left.length || pinningState?.right.length)
|
|
@@ -221,7 +223,7 @@ export function table_getLeftHeaderGroups<
|
|
|
221
223
|
table_getVisibleLeafColumns,
|
|
222
224
|
) as Array<Column_Internal<TFeatures, TData, unknown>>
|
|
223
225
|
const { left } =
|
|
224
|
-
table.
|
|
226
|
+
table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
225
227
|
|
|
226
228
|
const orderedLeafColumns = left
|
|
227
229
|
.map((columnId) => leafColumns.find((d) => d.id === columnId)!)
|
|
@@ -241,7 +243,7 @@ export function table_getRightHeaderGroups<
|
|
|
241
243
|
table_getVisibleLeafColumns,
|
|
242
244
|
) as unknown as Array<Column_Internal<TFeatures, TData, unknown>>
|
|
243
245
|
const { right } =
|
|
244
|
-
table.
|
|
246
|
+
table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
245
247
|
|
|
246
248
|
const orderedLeafColumns = right
|
|
247
249
|
.map((columnId) => leafColumns.find((d) => d.id === columnId)!)
|
|
@@ -263,7 +265,7 @@ export function table_getCenterHeaderGroups<
|
|
|
263
265
|
table_getVisibleLeafColumns,
|
|
264
266
|
) as unknown as Array<Column_Internal<TFeatures, TData, unknown>>
|
|
265
267
|
const { left, right } =
|
|
266
|
-
table.
|
|
268
|
+
table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
267
269
|
const leftAndRight: Array<string> = [...left, ...right]
|
|
268
270
|
|
|
269
271
|
leafColumns = leafColumns.filter(
|
|
@@ -402,7 +404,7 @@ export function table_getLeftLeafColumns<
|
|
|
402
404
|
TData extends RowData,
|
|
403
405
|
>(table: Table_Internal<TFeatures, TData>) {
|
|
404
406
|
const { left } =
|
|
405
|
-
table.
|
|
407
|
+
table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
406
408
|
return left
|
|
407
409
|
.map(
|
|
408
410
|
(columnId) =>
|
|
@@ -416,7 +418,7 @@ export function table_getRightLeafColumns<
|
|
|
416
418
|
TData extends RowData,
|
|
417
419
|
>(table: Table_Internal<TFeatures, TData>) {
|
|
418
420
|
const { right } =
|
|
419
|
-
table.
|
|
421
|
+
table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
420
422
|
return right
|
|
421
423
|
.map(
|
|
422
424
|
(columnId) =>
|
|
@@ -430,7 +432,7 @@ export function table_getCenterLeafColumns<
|
|
|
430
432
|
TData extends RowData,
|
|
431
433
|
>(table: Table_Internal<TFeatures, TData>) {
|
|
432
434
|
const { left, right } =
|
|
433
|
-
table.
|
|
435
|
+
table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
434
436
|
const leftAndRight: Array<string> = [...left, ...right]
|
|
435
437
|
return table.getAllLeafColumns().filter((d) => !leftAndRight.includes(d.id))
|
|
436
438
|
}
|