@tanstack/table-core 9.0.0-beta.10 → 9.0.0-beta.12
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/columns/coreColumnsFeature.utils.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
- package/dist/core/headers/buildHeaderGroups.js.map +1 -1
- 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-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- 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-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +3 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +3 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.types.d.cts +1 -4
- package/dist/features/column-resizing/columnResizingFeature.types.d.ts +1 -4
- 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/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- 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/helpers/columnHelper.cjs.map +1 -1
- package/dist/helpers/columnHelper.d.cts +2 -2
- package/dist/helpers/columnHelper.d.ts +2 -2
- package/dist/helpers/columnHelper.js.map +1 -1
- 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 +4 -4
- package/dist/types/Column.d.ts +4 -4
- 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 +2 -2
- package/dist/types/HeaderGroup.d.ts +2 -2
- package/dist/types/Row.d.cts +2 -2
- package/dist/types/Row.d.ts +2 -2
- package/dist/types/RowModel.d.cts +2 -2
- package/dist/types/RowModel.d.ts +2 -2
- package/dist/types/RowModelFns.d.cts +2 -2
- package/dist/types/RowModelFns.d.ts +2 -2
- package/dist/types/Table.d.cts +21 -12
- package/dist/types/Table.d.ts +21 -12
- package/dist/types/TableOptions.d.cts +11 -5
- package/dist/types/TableOptions.d.ts +11 -5
- package/dist/types/TableState.d.cts +1 -1
- package/dist/types/TableState.d.ts +1 -1
- 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/columns/coreColumnsFeature.utils.ts +1 -1
- package/src/core/headers/buildHeaderGroups.ts +3 -1
- 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-filtering/columnFilteringFeature.utils.ts +1 -1
- 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-pinning/columnPinningFeature.utils.ts +6 -14
- package/src/features/column-resizing/columnResizingFeature.types.ts +1 -4
- package/src/features/column-visibility/columnVisibilityFeature.types.ts +4 -4
- package/src/features/global-filtering/globalFilteringFeature.types.ts +4 -4
- package/src/features/global-filtering/globalFilteringFeature.utils.ts +1 -1
- 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/helpers/columnHelper.ts +4 -4
- package/src/types/Cell.ts +2 -2
- package/src/types/Column.ts +8 -8
- package/src/types/ColumnDef.ts +6 -6
- package/src/types/Header.ts +2 -2
- package/src/types/HeaderGroup.ts +6 -6
- package/src/types/Row.ts +4 -4
- package/src/types/RowModel.ts +7 -7
- package/src/types/RowModelFns.ts +7 -7
- package/src/types/Table.ts +51 -25
- package/src/types/TableOptions.ts +54 -12
- package/src/types/TableState.ts +15 -1
- package/src/utils.ts +11 -2
package/src/types/Table.ts
CHANGED
|
@@ -16,36 +16,40 @@ 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.
|
|
35
37
|
* No features are included.
|
|
36
38
|
*/
|
|
37
|
-
export
|
|
38
|
-
TFeatures extends TableFeatures,
|
|
39
|
-
TData extends RowData,
|
|
40
|
-
>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
export interface Table_Core<
|
|
40
|
+
in out TFeatures extends TableFeatures,
|
|
41
|
+
in out TData extends RowData,
|
|
42
|
+
>
|
|
43
|
+
extends
|
|
44
|
+
Table_Table<TFeatures, TData>,
|
|
45
|
+
Table_Columns<TFeatures, TData>,
|
|
46
|
+
Table_Rows<TFeatures, TData>,
|
|
47
|
+
Table_RowModels<TFeatures, TData>,
|
|
48
|
+
Table_Headers<TFeatures, TData> {}
|
|
45
49
|
|
|
46
50
|
export interface Table_FeatureMap<
|
|
47
|
-
TFeatures extends TableFeatures,
|
|
48
|
-
TData extends RowData,
|
|
51
|
+
in out TFeatures extends TableFeatures,
|
|
52
|
+
in out TData extends RowData,
|
|
49
53
|
> {
|
|
50
54
|
columnFilteringFeature: Table_ColumnFiltering
|
|
51
55
|
columnGroupingFeature: Table_ColumnGrouping<TFeatures, TData>
|
|
@@ -72,19 +76,41 @@ export type Table<
|
|
|
72
76
|
> = Table_Core<TFeatures, TData> &
|
|
73
77
|
ExtractFeatureMapTypes<TFeatures, Table_FeatureMap<TFeatures, TData>>
|
|
74
78
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
/**
|
|
80
|
+
* `Table_Table` members that `Table_Internal` re-declares with broadened
|
|
81
|
+
* (all-features) types so internal code can read any feature's slots and
|
|
82
|
+
* construction code can assign them.
|
|
83
|
+
*/
|
|
84
|
+
type Table_InternalBroadenedKeys =
|
|
85
|
+
| '_rowModels'
|
|
86
|
+
| '_rowModelFns'
|
|
87
|
+
| 'options'
|
|
88
|
+
| 'initialState'
|
|
89
|
+
| 'store'
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Internal broad table shape used by feature implementations.
|
|
93
|
+
*/
|
|
94
|
+
export interface Table_Internal<
|
|
95
|
+
in out TFeatures extends TableFeatures,
|
|
96
|
+
in out TData extends RowData = any,
|
|
97
|
+
>
|
|
98
|
+
extends
|
|
99
|
+
Omit<Table_Table<TFeatures, TData>, Table_InternalBroadenedKeys>,
|
|
100
|
+
Table_Columns<TFeatures, TData>,
|
|
101
|
+
Table_Rows<TFeatures, TData>,
|
|
102
|
+
Table_RowModels<TFeatures, TData>,
|
|
103
|
+
Table_Headers<TFeatures, TData> {
|
|
79
104
|
_rowModels: CachedRowModel_All<TFeatures, TData>
|
|
80
105
|
_rowModelFns: RowModelFns_All<TFeatures, TData>
|
|
81
|
-
options:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
106
|
+
options: DebugOptions<TableFeatures> &
|
|
107
|
+
TableOptions_All<TFeatures, TData> & {
|
|
108
|
+
state?: TableState_All
|
|
109
|
+
initialState?: TableState_All
|
|
110
|
+
atoms?: ExternalAtoms_All
|
|
111
|
+
}
|
|
112
|
+
initialState: TableState<TFeatures> & TableState_All
|
|
113
|
+
baseAtoms: BaseAtoms<TFeatures> & BaseAtoms_All
|
|
114
|
+
atoms: Atoms<TFeatures> & Atoms_All
|
|
115
|
+
store: ReadonlyStore<TableState<TFeatures>> & ReadonlyStore<TableState_All>
|
|
90
116
|
}
|
|
@@ -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/types/TableState.ts
CHANGED
|
@@ -44,4 +44,18 @@ export type TableState<TFeatures extends TableFeatures> =
|
|
|
44
44
|
* Feature internals use this when they may need to inspect optional slices owned
|
|
45
45
|
* by other features.
|
|
46
46
|
*/
|
|
47
|
-
export
|
|
47
|
+
export interface TableState_All extends Partial<
|
|
48
|
+
TableState_ColumnFiltering &
|
|
49
|
+
TableState_ColumnGrouping &
|
|
50
|
+
TableState_ColumnOrdering &
|
|
51
|
+
TableState_ColumnPinning &
|
|
52
|
+
TableState_ColumnResizing &
|
|
53
|
+
TableState_ColumnSizing &
|
|
54
|
+
TableState_ColumnVisibility &
|
|
55
|
+
TableState_GlobalFiltering &
|
|
56
|
+
TableState_RowExpanding &
|
|
57
|
+
TableState_RowPagination &
|
|
58
|
+
TableState_RowPinning &
|
|
59
|
+
TableState_RowSelection &
|
|
60
|
+
TableState_RowSorting
|
|
61
|
+
> {}
|
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]
|