@tanstack/table-core 9.0.0-beta.10 → 9.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/cells/coreCellsFeature.types.d.cts +3 -3
- package/dist/core/cells/coreCellsFeature.types.d.ts +3 -3
- package/dist/core/columns/coreColumnsFeature.types.d.cts +4 -4
- package/dist/core/columns/coreColumnsFeature.types.d.ts +4 -4
- package/dist/core/headers/coreHeadersFeature.types.d.cts +5 -5
- package/dist/core/headers/coreHeadersFeature.types.d.ts +5 -5
- package/dist/core/row-models/coreRowModelsFeature.types.d.cts +3 -3
- package/dist/core/row-models/coreRowModelsFeature.types.d.ts +3 -3
- package/dist/core/row-models/createCoreRowModel.cjs +1 -2
- package/dist/core/row-models/createCoreRowModel.cjs.map +1 -1
- package/dist/core/row-models/createCoreRowModel.d.cts +2 -2
- package/dist/core/row-models/createCoreRowModel.d.ts +2 -2
- package/dist/core/row-models/createCoreRowModel.js +1 -2
- package/dist/core/row-models/createCoreRowModel.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.types.d.cts +4 -4
- package/dist/core/rows/coreRowsFeature.types.d.ts +4 -4
- package/dist/core/table/constructTable.cjs.map +1 -1
- package/dist/core/table/constructTable.js.map +1 -1
- package/dist/core/table/coreTablesFeature.types.d.cts +4 -4
- package/dist/core/table/coreTablesFeature.types.d.ts +4 -4
- package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +4 -4
- package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +4 -4
- package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +9 -9
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +9 -9
- package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +6 -6
- package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +6 -6
- package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.cts +2 -2
- package/dist/features/column-pinning/columnPinningFeature.types.d.ts +2 -2
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +2 -2
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +2 -2
- package/dist/features/global-filtering/globalFilteringFeature.types.d.cts +2 -2
- package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +2 -2
- package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +4 -4
- package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +4 -4
- package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +3 -3
- package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +3 -3
- package/dist/features/row-pinning/rowPinningFeature.types.d.cts +2 -2
- package/dist/features/row-pinning/rowPinningFeature.types.d.ts +2 -2
- package/dist/features/row-selection/rowSelectionFeature.types.d.cts +2 -2
- package/dist/features/row-selection/rowSelectionFeature.types.d.ts +2 -2
- package/dist/features/row-sorting/rowSortingFeature.types.d.cts +7 -7
- package/dist/features/row-sorting/rowSortingFeature.types.d.ts +7 -7
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/types/Cell.d.cts +1 -1
- package/dist/types/Cell.d.ts +1 -1
- package/dist/types/Column.d.cts +2 -2
- package/dist/types/Column.d.ts +2 -2
- package/dist/types/ColumnDef.d.cts +3 -3
- package/dist/types/ColumnDef.d.ts +3 -3
- package/dist/types/Header.d.cts +1 -1
- package/dist/types/Header.d.ts +1 -1
- package/dist/types/HeaderGroup.d.cts +1 -1
- package/dist/types/HeaderGroup.d.ts +1 -1
- package/dist/types/Row.d.cts +2 -2
- package/dist/types/Row.d.ts +2 -2
- package/dist/types/RowModel.d.cts +1 -1
- package/dist/types/RowModel.d.ts +1 -1
- package/dist/types/RowModelFns.d.cts +1 -1
- package/dist/types/RowModelFns.d.ts +1 -1
- package/dist/types/Table.d.cts +29 -11
- package/dist/types/Table.d.ts +29 -11
- package/dist/types/TableOptions.d.cts +11 -5
- package/dist/types/TableOptions.d.ts +11 -5
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +7 -2
- package/dist/utils.d.ts +7 -2
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/core/cells/coreCellsFeature.types.ts +6 -6
- package/src/core/columns/coreColumnsFeature.types.ts +8 -8
- package/src/core/headers/coreHeadersFeature.types.ts +10 -10
- package/src/core/row-models/coreRowModelsFeature.types.ts +6 -6
- package/src/core/row-models/createCoreRowModel.ts +5 -4
- package/src/core/rows/coreRowsFeature.types.ts +8 -8
- package/src/core/table/constructTable.ts +1 -1
- package/src/core/table/coreTablesFeature.types.ts +8 -8
- package/src/core/table/coreTablesFeature.utils.ts +8 -2
- package/src/features/column-faceting/columnFacetingFeature.types.ts +8 -8
- package/src/features/column-filtering/columnFilteringFeature.types.ts +18 -18
- package/src/features/column-grouping/columnGroupingFeature.types.ts +12 -12
- package/src/features/column-ordering/columnOrderingFeature.types.ts +2 -2
- package/src/features/column-pinning/columnPinningFeature.types.ts +4 -4
- package/src/features/column-visibility/columnVisibilityFeature.types.ts +4 -4
- package/src/features/global-filtering/globalFilteringFeature.types.ts +4 -4
- package/src/features/row-expanding/rowExpandingFeature.types.ts +8 -8
- package/src/features/row-pagination/rowPaginationFeature.types.ts +6 -6
- package/src/features/row-pinning/rowPinningFeature.types.ts +4 -4
- package/src/features/row-selection/rowSelectionFeature.types.ts +4 -4
- package/src/features/row-sorting/rowSortingFeature.types.ts +14 -14
- package/src/types/Cell.ts +2 -2
- package/src/types/Column.ts +4 -4
- package/src/types/ColumnDef.ts +6 -6
- package/src/types/Header.ts +2 -2
- package/src/types/HeaderGroup.ts +2 -2
- package/src/types/Row.ts +4 -4
- package/src/types/RowModel.ts +2 -2
- package/src/types/RowModelFns.ts +2 -2
- package/src/types/Table.ts +64 -17
- package/src/types/TableOptions.ts +54 -12
- package/src/utils.ts +11 -2
package/src/types/RowModelFns.ts
CHANGED
|
@@ -7,8 +7,8 @@ import type { ExtractFeatureMapTypes, TableFeatures } from './TableFeatures'
|
|
|
7
7
|
export interface RowModelFns_Core {}
|
|
8
8
|
|
|
9
9
|
export interface RowModelFns_FeatureMap<
|
|
10
|
-
TFeatures extends TableFeatures,
|
|
11
|
-
TData extends RowData,
|
|
10
|
+
in out TFeatures extends TableFeatures,
|
|
11
|
+
in out TData extends RowData,
|
|
12
12
|
> {
|
|
13
13
|
columnFilteringFeature: RowModelFns_ColumnFiltering<TFeatures, TData>
|
|
14
14
|
columnGroupingFeature: RowModelFns_ColumnGrouping<TFeatures, TData>
|
package/src/types/Table.ts
CHANGED
|
@@ -16,19 +16,21 @@ import type { Table_RowSorting } from '../features/row-sorting/rowSortingFeature
|
|
|
16
16
|
import type { Table_RowModels } from '../core/row-models/coreRowModelsFeature.types'
|
|
17
17
|
import type { CachedRowModel_All } from './RowModel'
|
|
18
18
|
import type { RowModelFns_All } from './RowModelFns'
|
|
19
|
-
import type { TableState_All } from './TableState'
|
|
19
|
+
import type { TableState, TableState_All } from './TableState'
|
|
20
20
|
import type { RowData } from './type-utils'
|
|
21
21
|
import type { ExtractFeatureMapTypes, TableFeatures } from './TableFeatures'
|
|
22
22
|
import type { Table_Columns } from '../core/columns/coreColumnsFeature.types'
|
|
23
23
|
import type { Table_Headers } from '../core/headers/coreHeadersFeature.types'
|
|
24
24
|
import type { Table_Rows } from '../core/rows/coreRowsFeature.types'
|
|
25
25
|
import type {
|
|
26
|
+
Atoms,
|
|
26
27
|
Atoms_All,
|
|
28
|
+
BaseAtoms,
|
|
27
29
|
BaseAtoms_All,
|
|
28
30
|
ExternalAtoms_All,
|
|
29
31
|
Table_Table,
|
|
30
32
|
} from '../core/table/coreTablesFeature.types'
|
|
31
|
-
import type { TableOptions_All } from './TableOptions'
|
|
33
|
+
import type { DebugOptions, TableOptions_All } from './TableOptions'
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
* The core table object that only includes the core table functionality such as column, header, row, and table APIS.
|
|
@@ -44,8 +46,8 @@ export type Table_Core<
|
|
|
44
46
|
Table_Headers<TFeatures, TData>
|
|
45
47
|
|
|
46
48
|
export interface Table_FeatureMap<
|
|
47
|
-
TFeatures extends TableFeatures,
|
|
48
|
-
TData extends RowData,
|
|
49
|
+
in out TFeatures extends TableFeatures,
|
|
50
|
+
in out TData extends RowData,
|
|
49
51
|
> {
|
|
50
52
|
columnFilteringFeature: Table_ColumnFiltering
|
|
51
53
|
columnGroupingFeature: Table_ColumnGrouping<TFeatures, TData>
|
|
@@ -72,19 +74,64 @@ export type Table<
|
|
|
72
74
|
> = Table_Core<TFeatures, TData> &
|
|
73
75
|
ExtractFeatureMapTypes<TFeatures, Table_FeatureMap<TFeatures, TData>>
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
/**
|
|
78
|
+
* `Table_Table` members that `Table_Internal` re-declares with broadened
|
|
79
|
+
* (all-features) types so internal code can read any feature's slots and
|
|
80
|
+
* construction code can assign them.
|
|
81
|
+
*/
|
|
82
|
+
type Table_InternalBroadenedKeys =
|
|
83
|
+
| '_rowModels'
|
|
84
|
+
| '_rowModelFns'
|
|
85
|
+
| 'options'
|
|
86
|
+
| 'initialState'
|
|
87
|
+
| 'store'
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Internal broad table shape used by feature implementations.
|
|
91
|
+
*
|
|
92
|
+
* Declared as an interface extending every stock feature's table API (rather
|
|
93
|
+
* than the feature-conditional `Table` intersection) so that the compiler can
|
|
94
|
+
* relate `Table_Internal` instantiations nominally instead of structurally
|
|
95
|
+
* re-expanding the feature-map conditional for every internal call site.
|
|
96
|
+
* Mirrors the `*_All` convention used for options, state, and row models.
|
|
97
|
+
* Type parameters are annotated `in out` (invariant) so the checker can relate
|
|
98
|
+
* instantiations by their type arguments without measuring variance or falling
|
|
99
|
+
* back to member-by-member structural comparison.
|
|
100
|
+
*/
|
|
101
|
+
export interface Table_Internal<
|
|
102
|
+
in out TFeatures extends TableFeatures,
|
|
103
|
+
in out TData extends RowData = any,
|
|
104
|
+
>
|
|
105
|
+
extends
|
|
106
|
+
Omit<Table_Table<TFeatures, TData>, Table_InternalBroadenedKeys>,
|
|
107
|
+
Table_Columns<TFeatures, TData>,
|
|
108
|
+
Table_Rows<TFeatures, TData>,
|
|
109
|
+
Table_RowModels<TFeatures, TData>,
|
|
110
|
+
Table_Headers<TFeatures, TData>,
|
|
111
|
+
Table_ColumnFiltering,
|
|
112
|
+
Table_ColumnGrouping<TFeatures, TData>,
|
|
113
|
+
Table_ColumnOrdering<TFeatures, TData>,
|
|
114
|
+
Table_ColumnPinning<TFeatures, TData>,
|
|
115
|
+
Table_ColumnResizing,
|
|
116
|
+
Table_ColumnSizing,
|
|
117
|
+
Table_ColumnVisibility<TFeatures, TData>,
|
|
118
|
+
Table_ColumnFaceting<TFeatures, TData>,
|
|
119
|
+
Table_GlobalFiltering<TFeatures, TData>,
|
|
120
|
+
Table_RowExpanding<TFeatures, TData>,
|
|
121
|
+
Table_RowPagination<TFeatures, TData>,
|
|
122
|
+
Table_RowPinning<TFeatures, TData>,
|
|
123
|
+
Table_RowSelection<TFeatures, TData>,
|
|
124
|
+
Table_RowSorting<TFeatures, TData> {
|
|
79
125
|
_rowModels: CachedRowModel_All<TFeatures, TData>
|
|
80
126
|
_rowModelFns: RowModelFns_All<TFeatures, TData>
|
|
81
|
-
options:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
127
|
+
options: DebugOptions<TableFeatures> &
|
|
128
|
+
TableOptions_All<TFeatures, TData> & {
|
|
129
|
+
state?: TableState_All
|
|
130
|
+
initialState?: TableState_All
|
|
131
|
+
atoms?: ExternalAtoms_All
|
|
132
|
+
}
|
|
133
|
+
initialState: TableState<TFeatures> & TableState_All
|
|
134
|
+
baseAtoms: BaseAtoms<TFeatures> & BaseAtoms_All
|
|
135
|
+
atoms: Atoms<TFeatures> & Atoms_All
|
|
136
|
+
store: ReadonlyStore<TableState<TFeatures>> & ReadonlyStore<TableState_All>
|
|
90
137
|
}
|
|
@@ -28,8 +28,8 @@ import type {
|
|
|
28
28
|
* options are mixed in.
|
|
29
29
|
*/
|
|
30
30
|
export interface TableOptions_Core<
|
|
31
|
-
TFeatures extends TableFeatures,
|
|
32
|
-
TData extends RowData,
|
|
31
|
+
in out TFeatures extends TableFeatures,
|
|
32
|
+
in out TData extends RowData,
|
|
33
33
|
>
|
|
34
34
|
extends
|
|
35
35
|
TableOptions_Table<TFeatures, TData>,
|
|
@@ -55,8 +55,8 @@ export type DebugOptions<TFeatures extends TableFeatures> = {
|
|
|
55
55
|
} & DebugKeysFor<CoreFeatures & TFeatures>
|
|
56
56
|
|
|
57
57
|
export interface TableOptions_FeatureMap<
|
|
58
|
-
TFeatures extends TableFeatures,
|
|
59
|
-
TData extends RowData,
|
|
58
|
+
in out TFeatures extends TableFeatures,
|
|
59
|
+
in out TData extends RowData,
|
|
60
60
|
> {
|
|
61
61
|
columnFilteringFeature: TableOptions_ColumnFiltering<TFeatures, TData>
|
|
62
62
|
columnGroupingFeature: TableOptions_ColumnGrouping
|
|
@@ -73,15 +73,42 @@ export interface TableOptions_FeatureMap<
|
|
|
73
73
|
rowSortingFeature: TableOptions_RowSorting
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
type TableOptions_StockFeatureKeys =
|
|
77
|
+
| 'columnFilteringFeature'
|
|
78
|
+
| 'columnGroupingFeature'
|
|
79
|
+
| 'columnOrderingFeature'
|
|
80
|
+
| 'columnPinningFeature'
|
|
81
|
+
| 'columnResizingFeature'
|
|
82
|
+
| 'columnSizingFeature'
|
|
83
|
+
| 'columnVisibilityFeature'
|
|
84
|
+
| 'globalFilteringFeature'
|
|
85
|
+
| 'rowExpandingFeature'
|
|
86
|
+
| 'rowPaginationFeature'
|
|
87
|
+
| 'rowPinningFeature'
|
|
88
|
+
| 'rowSelectionFeature'
|
|
89
|
+
| 'rowSortingFeature'
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Plugin entries declaration-merged into `TableOptions_FeatureMap`, i.e. keys
|
|
93
|
+
* beyond the stock set. Resolves to `unknown` (an intersection no-op) when no
|
|
94
|
+
* plugins are merged so the common case skips the union-to-intersection work.
|
|
95
|
+
*/
|
|
96
|
+
type TableOptions_PluginFeatureMapTypes<
|
|
77
97
|
TFeatures extends TableFeatures,
|
|
78
98
|
TData extends RowData,
|
|
79
|
-
> =
|
|
80
|
-
|
|
81
|
-
TFeatures,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
99
|
+
> = [
|
|
100
|
+
Exclude<
|
|
101
|
+
keyof TableOptions_FeatureMap<TFeatures, TData>,
|
|
102
|
+
TableOptions_StockFeatureKeys
|
|
103
|
+
>,
|
|
104
|
+
] extends [never]
|
|
105
|
+
? unknown
|
|
106
|
+
: UnionToIntersection<
|
|
107
|
+
TableOptions_FeatureMap<TFeatures, TData>[Exclude<
|
|
108
|
+
keyof TableOptions_FeatureMap<TFeatures, TData>,
|
|
109
|
+
TableOptions_StockFeatureKeys
|
|
110
|
+
>]
|
|
111
|
+
>
|
|
85
112
|
|
|
86
113
|
/**
|
|
87
114
|
* Complete table options for a specific feature set.
|
|
@@ -105,4 +132,19 @@ export type TableOptions_All<
|
|
|
105
132
|
TFeatures extends TableFeatures,
|
|
106
133
|
TData extends RowData,
|
|
107
134
|
> = TableOptions_Core<TFeatures, TData> &
|
|
108
|
-
Partial<
|
|
135
|
+
Partial<
|
|
136
|
+
TableOptions_ColumnFiltering<TFeatures, TData> &
|
|
137
|
+
TableOptions_ColumnGrouping &
|
|
138
|
+
TableOptions_ColumnOrdering &
|
|
139
|
+
TableOptions_ColumnPinning &
|
|
140
|
+
TableOptions_ColumnResizing &
|
|
141
|
+
TableOptions_ColumnSizing &
|
|
142
|
+
TableOptions_ColumnVisibility &
|
|
143
|
+
TableOptions_GlobalFiltering<TFeatures, TData> &
|
|
144
|
+
TableOptions_RowExpanding<TFeatures, TData> &
|
|
145
|
+
TableOptions_RowPagination &
|
|
146
|
+
TableOptions_RowPinning<TFeatures, TData> &
|
|
147
|
+
TableOptions_RowSelection<TFeatures, TData> &
|
|
148
|
+
TableOptions_RowSorting &
|
|
149
|
+
TableOptions_PluginFeatureMapTypes<TFeatures, TData>
|
|
150
|
+
>
|
package/src/utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table_Internal } from './types/Table'
|
|
2
2
|
import type { NoInfer, RowData, Updater } from './types/type-utils'
|
|
3
3
|
import type { TableFeatures } from './types/TableFeatures'
|
|
4
4
|
import type { TableState, TableState_All } from './types/TableState'
|
|
@@ -53,7 +53,16 @@ export function cloneState<T>(value: T): T {
|
|
|
53
53
|
export function makeStateUpdater<
|
|
54
54
|
TFeatures extends TableFeatures,
|
|
55
55
|
K extends (string & {}) | keyof TableState_All | keyof TableState<TFeatures>,
|
|
56
|
-
>(
|
|
56
|
+
>(
|
|
57
|
+
key: K,
|
|
58
|
+
// Minimal structural shape so any table view (public `Table`,
|
|
59
|
+
// `Table_Internal`, or a custom plugin table) can be passed without forcing
|
|
60
|
+
// the compiler to relate the full table types.
|
|
61
|
+
instance: {
|
|
62
|
+
readonly options: { readonly atoms?: object | undefined }
|
|
63
|
+
readonly baseAtoms: object
|
|
64
|
+
},
|
|
65
|
+
) {
|
|
57
66
|
return (updater: Updater<TableState<any>[K & keyof TableState<any>]>) => {
|
|
58
67
|
const externalAtom = (instance.options as any).atoms?.[key]
|
|
59
68
|
const targetAtom = externalAtom ?? (instance.baseAtoms as any)[key]
|