@tanstack/table-core 9.0.0-beta.1 → 9.0.0-beta.2

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.
Files changed (39) hide show
  1. package/dist/core/table/constructTable.cjs.map +1 -1
  2. package/dist/core/table/constructTable.js.map +1 -1
  3. package/dist/index.d.cts +12 -12
  4. package/dist/index.d.ts +12 -12
  5. package/dist/types/Cell.d.cts +7 -4
  6. package/dist/types/Cell.d.ts +7 -4
  7. package/dist/types/Column.d.cts +16 -4
  8. package/dist/types/Column.d.ts +16 -4
  9. package/dist/types/ColumnDef.d.cts +13 -3
  10. package/dist/types/ColumnDef.d.ts +13 -3
  11. package/dist/types/Header.d.cts +8 -4
  12. package/dist/types/Header.d.ts +8 -4
  13. package/dist/types/Row.d.cts +13 -4
  14. package/dist/types/Row.d.ts +13 -4
  15. package/dist/types/RowModel.d.cts +21 -5
  16. package/dist/types/RowModel.d.ts +21 -5
  17. package/dist/types/RowModelFns.d.cts +9 -4
  18. package/dist/types/RowModelFns.d.ts +9 -4
  19. package/dist/types/Table.d.cts +20 -4
  20. package/dist/types/Table.d.ts +20 -4
  21. package/dist/types/TableFeatures.d.cts +3 -1
  22. package/dist/types/TableFeatures.d.ts +3 -1
  23. package/dist/types/TableOptions.d.cts +20 -4
  24. package/dist/types/TableOptions.d.ts +20 -4
  25. package/dist/types/TableState.d.cts +18 -4
  26. package/dist/types/TableState.d.ts +18 -4
  27. package/package.json +1 -1
  28. package/src/core/table/constructTable.ts +1 -1
  29. package/src/types/Cell.ts +11 -15
  30. package/src/types/Column.ts +23 -42
  31. package/src/types/ColumnDef.ts +23 -34
  32. package/src/types/Header.ts +12 -18
  33. package/src/types/Row.ts +20 -26
  34. package/src/types/RowModel.ts +36 -53
  35. package/src/types/RowModelFns.ts +16 -20
  36. package/src/types/Table.ts +27 -53
  37. package/src/types/TableFeatures.ts +12 -0
  38. package/src/types/TableOptions.ts +36 -64
  39. package/src/types/TableState.ts +25 -52
@@ -17,7 +17,11 @@ import type { TableOptions_RowPinning } from '../features/row-pinning/rowPinning
17
17
  import type { TableOptions_RowSelection } from '../features/row-selection/rowSelectionFeature.types'
18
18
  import type { TableOptions_RowSorting } from '../features/row-sorting/rowSortingFeature.types'
19
19
  import type { RowData, UnionToIntersection } from './type-utils'
20
- import type { ExtractFeatureTypes, TableFeatures } from './TableFeatures'
20
+ import type {
21
+ ExtractFeatureMapTypes,
22
+ ExtractFeatureTypes,
23
+ TableFeatures,
24
+ } from './TableFeatures'
21
25
 
22
26
  export interface TableOptions_Plugins<
23
27
  TFeatures extends TableFeatures,
@@ -52,6 +56,35 @@ export type DebugOptions<TFeatures extends TableFeatures> = {
52
56
  debugTable?: boolean
53
57
  } & DebugKeysFor<CoreFeatures & TFeatures>
54
58
 
59
+ export interface TableOptions_FeatureMap<
60
+ TFeatures extends TableFeatures,
61
+ TData extends RowData,
62
+ > {
63
+ columnFilteringFeature: TableOptions_ColumnFiltering<TFeatures, TData>
64
+ columnGroupingFeature: TableOptions_ColumnGrouping
65
+ columnOrderingFeature: TableOptions_ColumnOrdering
66
+ columnPinningFeature: TableOptions_ColumnPinning
67
+ columnResizingFeature: TableOptions_ColumnResizing
68
+ columnSizingFeature: TableOptions_ColumnSizing
69
+ columnVisibilityFeature: TableOptions_ColumnVisibility
70
+ globalFilteringFeature: TableOptions_GlobalFiltering<TFeatures, TData>
71
+ rowExpandingFeature: TableOptions_RowExpanding<TFeatures, TData>
72
+ rowPaginationFeature: TableOptions_RowPagination
73
+ rowPinningFeature: TableOptions_RowPinning<TFeatures, TData>
74
+ rowSelectionFeature: TableOptions_RowSelection<TFeatures, TData>
75
+ rowSortingFeature: TableOptions_RowSorting
76
+ }
77
+
78
+ export type TableOptions_FeatureMap_All<
79
+ TFeatures extends TableFeatures,
80
+ TData extends RowData,
81
+ > = UnionToIntersection<
82
+ TableOptions_FeatureMap<TFeatures, TData>[keyof TableOptions_FeatureMap<
83
+ TFeatures,
84
+ TData
85
+ >]
86
+ >
87
+
55
88
  /**
56
89
  * Complete table options for a specific feature set.
57
90
  *
@@ -63,58 +96,11 @@ export type TableOptions<
63
96
  TFeatures extends TableFeatures,
64
97
  TData extends RowData,
65
98
  > = TableOptions_Core<TFeatures, TData> &
66
- UnionToIntersection<
67
- | ('columnFilteringFeature' extends keyof TFeatures
68
- ? TableOptions_ColumnFiltering<TFeatures, TData>
69
- : never)
70
- | ('columnGroupingFeature' extends keyof TFeatures
71
- ? TableOptions_ColumnGrouping
72
- : never)
73
- | ('columnOrderingFeature' extends keyof TFeatures
74
- ? TableOptions_ColumnOrdering
75
- : never)
76
- | ('columnPinningFeature' extends keyof TFeatures
77
- ? TableOptions_ColumnPinning
78
- : never)
79
- | ('columnResizingFeature' extends keyof TFeatures
80
- ? TableOptions_ColumnResizing
81
- : never)
82
- | ('columnSizingFeature' extends keyof TFeatures
83
- ? TableOptions_ColumnSizing
84
- : never)
85
- | ('columnVisibilityFeature' extends keyof TFeatures
86
- ? TableOptions_ColumnVisibility
87
- : never)
88
- | ('globalFilteringFeature' extends keyof TFeatures
89
- ? TableOptions_GlobalFiltering<TFeatures, TData>
90
- : never)
91
- | ('rowExpandingFeature' extends keyof TFeatures
92
- ? TableOptions_RowExpanding<TFeatures, TData>
93
- : never)
94
- | ('rowPaginationFeature' extends keyof TFeatures
95
- ? TableOptions_RowPagination
96
- : never)
97
- | ('rowPinningFeature' extends keyof TFeatures
98
- ? TableOptions_RowPinning<TFeatures, TData>
99
- : never)
100
- | ('rowSelectionFeature' extends keyof TFeatures
101
- ? TableOptions_RowSelection<TFeatures, TData>
102
- : never)
103
- | ('rowSortingFeature' extends keyof TFeatures
104
- ? TableOptions_RowSorting
105
- : never)
106
- > &
99
+ ExtractFeatureMapTypes<TFeatures, TableOptions_FeatureMap<TFeatures, TData>> &
107
100
  ExtractFeatureTypes<'TableOptions', TFeatures> &
108
101
  TableOptions_Plugins<TFeatures, TData> &
109
102
  DebugOptions<TFeatures>
110
103
 
111
- // export type TableOptions<
112
- // TFeatures extends TableFeatures,
113
- // TData extends RowData,
114
- // > = TableOptions_Core<TFeatures, TData> &
115
- // ExtractFeatureTypes<'TableOptions', TFeatures> &
116
- // TableOptions_Plugins<TFeatures, TData>
117
-
118
104
  /**
119
105
  * Internal broad option shape used where feature code may need to read options
120
106
  * from features that are not present in the current generic feature set.
@@ -123,18 +109,4 @@ export type TableOptions_All<
123
109
  TFeatures extends TableFeatures,
124
110
  TData extends RowData,
125
111
  > = TableOptions_Core<TFeatures, TData> &
126
- Partial<
127
- TableOptions_ColumnFiltering<TFeatures, TData> &
128
- TableOptions_ColumnGrouping &
129
- TableOptions_ColumnOrdering &
130
- TableOptions_ColumnPinning &
131
- TableOptions_ColumnResizing &
132
- TableOptions_ColumnSizing &
133
- TableOptions_ColumnVisibility &
134
- TableOptions_GlobalFiltering<TFeatures, TData> &
135
- TableOptions_RowExpanding<TFeatures, TData> &
136
- TableOptions_RowPagination &
137
- TableOptions_RowPinning<TFeatures, TData> &
138
- TableOptions_RowSelection<TFeatures, TData> &
139
- TableOptions_RowSorting
140
- >
112
+ Partial<TableOptions_FeatureMap_All<TFeatures, TData>>
@@ -1,4 +1,3 @@
1
- import type { UnionToIntersection } from './type-utils'
2
1
  import type { TableState_ColumnFiltering } from '../features/column-filtering/columnFilteringFeature.types'
3
2
  import type { TableState_ColumnGrouping } from '../features/column-grouping/columnGroupingFeature.types'
4
3
  import type { TableState_ColumnOrdering } from '../features/column-ordering/columnOrderingFeature.types'
@@ -12,7 +11,11 @@ import type { TableState_RowPagination } from '../features/row-pagination/rowPag
12
11
  import type { TableState_RowPinning } from '../features/row-pinning/rowPinningFeature.types'
13
12
  import type { TableState_RowSelection } from '../features/row-selection/rowSelectionFeature.types'
14
13
  import type { TableState_RowSorting } from '../features/row-sorting/rowSortingFeature.types'
15
- import type { ExtractFeatureTypes, TableFeatures } from './TableFeatures'
14
+ import type {
15
+ ExtractFeatureMapTypes,
16
+ ExtractFeatureTypes,
17
+ TableFeatures,
18
+ } from './TableFeatures'
16
19
 
17
20
  /**
18
21
  * Use this interface as a target for declaration merging to add your own state properties.
@@ -20,62 +23,32 @@ import type { ExtractFeatureTypes, TableFeatures } from './TableFeatures'
20
23
  */
21
24
  export interface TableState_Plugins<TFeatures extends TableFeatures> {}
22
25
 
26
+ export interface TableState_FeatureMap {
27
+ columnFilteringFeature: TableState_ColumnFiltering
28
+ columnGroupingFeature: TableState_ColumnGrouping
29
+ columnOrderingFeature: TableState_ColumnOrdering
30
+ columnPinningFeature: TableState_ColumnPinning
31
+ columnResizingFeature: TableState_ColumnResizing
32
+ columnSizingFeature: TableState_ColumnSizing
33
+ columnVisibilityFeature: TableState_ColumnVisibility
34
+ globalFilteringFeature: TableState_GlobalFiltering
35
+ rowExpandingFeature: TableState_RowExpanding
36
+ rowPaginationFeature: TableState_RowPagination
37
+ rowPinningFeature: TableState_RowPinning
38
+ rowSelectionFeature: TableState_RowSelection
39
+ rowSortingFeature: TableState_RowSorting
40
+ }
41
+
23
42
  /**
24
43
  * Complete table state for a specific feature set.
25
44
  *
26
45
  * State slices are included only when their feature is present in `TFeatures`,
27
46
  * then custom feature/plugin state is mixed in.
28
47
  */
29
- export type TableState<TFeatures extends TableFeatures> = UnionToIntersection<
30
- | ('columnFilteringFeature' extends keyof TFeatures
31
- ? TableState_ColumnFiltering
32
- : never)
33
- | ('columnGroupingFeature' extends keyof TFeatures
34
- ? TableState_ColumnGrouping
35
- : never)
36
- | ('columnOrderingFeature' extends keyof TFeatures
37
- ? TableState_ColumnOrdering
38
- : never)
39
- | ('columnPinningFeature' extends keyof TFeatures
40
- ? TableState_ColumnPinning
41
- : never)
42
- | ('columnResizingFeature' extends keyof TFeatures
43
- ? TableState_ColumnResizing
44
- : never)
45
- | ('columnSizingFeature' extends keyof TFeatures
46
- ? TableState_ColumnSizing
47
- : never)
48
- | ('columnVisibilityFeature' extends keyof TFeatures
49
- ? TableState_ColumnVisibility
50
- : never)
51
- | ('globalFilteringFeature' extends keyof TFeatures
52
- ? TableState_GlobalFiltering
53
- : never)
54
- | ('rowExpandingFeature' extends keyof TFeatures
55
- ? TableState_RowExpanding
56
- : never)
57
- | ('rowPaginationFeature' extends keyof TFeatures
58
- ? TableState_RowPagination
59
- : never)
60
- | ('rowPinningFeature' extends keyof TFeatures
61
- ? TableState_RowPinning
62
- : never)
63
- | ('rowSelectionFeature' extends keyof TFeatures
64
- ? TableState_RowSelection
65
- : never)
66
- | ('rowSortingFeature' extends keyof TFeatures
67
- ? TableState_RowSorting
68
- : never)
69
- > &
70
- ExtractFeatureTypes<'TableState', TFeatures> &
71
- TableState_Plugins<TFeatures>
72
-
73
- // export type TableState<TFeatures extends TableFeatures> = ExtractFeatureTypes<
74
- // export type TableState<TFeatures extends TableFeatures> = ExtractFeatureTypes<
75
- // 'TableState',
76
- // TFeatures
77
- // > &
78
- // TableState_Plugins<TFeatures>
48
+ export type TableState<TFeatures extends TableFeatures> =
49
+ ExtractFeatureMapTypes<TFeatures, TableState_FeatureMap> &
50
+ ExtractFeatureTypes<'TableState', TFeatures> &
51
+ TableState_Plugins<TFeatures>
79
52
 
80
53
  /**
81
54
  * Internal broad state shape containing every stock feature state slice.