@tanstack/table-core 9.0.0-alpha.47 → 9.0.0-alpha.48
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/README.md +10 -0
- package/dist/core/cells/coreCellsFeature.utils.cjs +11 -8
- package/dist/core/cells/coreCellsFeature.utils.cjs.map +1 -1
- package/dist/core/cells/coreCellsFeature.utils.d.cts +11 -8
- package/dist/core/cells/coreCellsFeature.utils.d.ts +11 -8
- package/dist/core/cells/coreCellsFeature.utils.js +11 -8
- package/dist/core/cells/coreCellsFeature.utils.js.map +1 -1
- package/dist/core/columns/coreColumnsFeature.types.d.cts +7 -6
- package/dist/core/columns/coreColumnsFeature.types.d.ts +7 -6
- package/dist/core/columns/coreColumnsFeature.utils.cjs +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.d.cts +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.d.ts +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.js +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.types.d.cts +6 -4
- package/dist/core/headers/coreHeadersFeature.types.d.ts +6 -4
- package/dist/core/headers/coreHeadersFeature.utils.cjs +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.d.cts +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.d.ts +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.js +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.js +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.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/rows/coreRowsFeature.utils.cjs +34 -28
- package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.utils.d.cts +34 -28
- package/dist/core/rows/coreRowsFeature.utils.d.ts +34 -28
- package/dist/core/rows/coreRowsFeature.utils.js +34 -28
- package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
- package/dist/core/table/coreTablesFeature.types.d.cts +6 -2
- package/dist/core/table/coreTablesFeature.types.d.ts +6 -2
- package/dist/core/table/coreTablesFeature.utils.cjs +2 -2
- package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.d.cts +2 -2
- package/dist/core/table/coreTablesFeature.utils.d.ts +2 -2
- package/dist/core/table/coreTablesFeature.utils.js +2 -2
- package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +16 -10
- package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +16 -10
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.cts +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.js +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +21 -11
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +21 -11
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.js +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +18 -14
- package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +18 -14
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.js +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +14 -5
- package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +14 -5
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.js +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.cts +43 -31
- package/dist/features/column-pinning/columnPinningFeature.types.d.ts +43 -31
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.js +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.types.d.cts +9 -9
- package/dist/features/column-resizing/columnResizingFeature.types.d.ts +9 -9
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs +28 -19
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.d.cts +28 -19
- package/dist/features/column-resizing/columnResizingFeature.utils.d.ts +28 -19
- package/dist/features/column-resizing/columnResizingFeature.utils.js +28 -19
- package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.types.d.cts +19 -12
- package/dist/features/column-sizing/columnSizingFeature.types.d.ts +19 -12
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.js +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +16 -13
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +16 -13
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.types.d.cts +10 -5
- package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +10 -5
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.js +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +16 -15
- package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +16 -15
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.cts +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.js +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +19 -12
- package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +19 -12
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.cts +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.js +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.types.d.cts +12 -8
- package/dist/features/row-pinning/rowPinningFeature.types.d.ts +12 -8
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.d.cts +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.js +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.js.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.types.d.cts +30 -24
- package/dist/features/row-selection/rowSelectionFeature.types.d.ts +30 -24
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.d.cts +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.js +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.types.d.cts +10 -8
- package/dist/features/row-sorting/rowSortingFeature.types.d.ts +10 -8
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs +61 -44
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.d.cts +61 -44
- package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +61 -44
- package/dist/features/row-sorting/rowSortingFeature.utils.js +61 -44
- package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
- package/dist/fns/aggregationFns.cjs +33 -9
- package/dist/fns/aggregationFns.cjs.map +1 -1
- package/dist/fns/aggregationFns.d.cts +33 -9
- package/dist/fns/aggregationFns.d.ts +33 -9
- package/dist/fns/aggregationFns.js +33 -9
- package/dist/fns/aggregationFns.js.map +1 -1
- package/dist/fns/filterFns.cjs +48 -17
- package/dist/fns/filterFns.cjs.map +1 -1
- package/dist/fns/filterFns.d.cts +42 -15
- package/dist/fns/filterFns.d.ts +42 -15
- package/dist/fns/filterFns.js +48 -17
- package/dist/fns/filterFns.js.map +1 -1
- package/dist/helpers/columnHelper.cjs +9 -4
- package/dist/helpers/columnHelper.cjs.map +1 -1
- package/dist/helpers/columnHelper.d.cts +9 -4
- package/dist/helpers/columnHelper.d.ts +9 -4
- package/dist/helpers/columnHelper.js +9 -4
- package/dist/helpers/columnHelper.js.map +1 -1
- package/dist/helpers/tableOptions.cjs.map +1 -1
- package/dist/helpers/tableOptions.d.cts +12 -9
- package/dist/helpers/tableOptions.d.ts +12 -9
- package/dist/helpers/tableOptions.js.map +1 -1
- package/dist/types/ColumnDef.d.cts +38 -0
- package/dist/types/ColumnDef.d.ts +38 -0
- package/dist/types/TableOptions.d.cts +15 -0
- package/dist/types/TableOptions.d.ts +15 -0
- package/dist/types/TableState.d.cts +12 -0
- package/dist/types/TableState.d.ts +12 -0
- package/package.json +5 -3
- package/skills/column-definitions/SKILL.md +333 -0
- package/skills/column-layout/SKILL.md +328 -0
- package/skills/column-layout/references/subsystems.md +220 -0
- package/skills/customizing-feature-behavior/SKILL.md +416 -0
- package/skills/filtering/SKILL.md +357 -0
- package/skills/filtering/references/faceting-and-fuzzy.md +191 -0
- package/skills/grouping/SKILL.md +448 -0
- package/skills/migrate-v8-to-v9/SKILL.md +495 -0
- package/skills/pagination/SKILL.md +385 -0
- package/skills/row-expanding/SKILL.md +348 -0
- package/skills/row-pinning/SKILL.md +269 -0
- package/skills/row-selection/SKILL.md +391 -0
- package/skills/setup/SKILL.md +400 -0
- package/skills/sorting/SKILL.md +344 -0
- package/skills/state-management/SKILL.md +388 -0
- package/src/core/cells/coreCellsFeature.utils.ts +11 -8
- package/src/core/columns/coreColumnsFeature.types.ts +7 -6
- package/src/core/columns/coreColumnsFeature.utils.ts +37 -27
- package/src/core/headers/coreHeadersFeature.types.ts +6 -4
- package/src/core/headers/coreHeadersFeature.utils.ts +23 -18
- package/src/core/row-models/coreRowModelsFeature.utils.ts +48 -36
- package/src/core/rows/coreRowsFeature.types.ts +4 -4
- package/src/core/rows/coreRowsFeature.utils.ts +34 -28
- package/src/core/table/coreTablesFeature.types.ts +6 -2
- package/src/core/table/coreTablesFeature.utils.ts +2 -2
- package/src/features/column-faceting/columnFacetingFeature.types.ts +16 -10
- package/src/features/column-faceting/columnFacetingFeature.utils.ts +26 -18
- package/src/features/column-filtering/columnFilteringFeature.types.ts +21 -11
- package/src/features/column-filtering/columnFilteringFeature.utils.ts +39 -28
- package/src/features/column-grouping/columnGroupingFeature.types.ts +18 -14
- package/src/features/column-grouping/columnGroupingFeature.utils.ts +55 -43
- package/src/features/column-ordering/columnOrderingFeature.types.ts +14 -5
- package/src/features/column-ordering/columnOrderingFeature.utils.ts +30 -23
- package/src/features/column-pinning/columnPinningFeature.types.ts +43 -31
- package/src/features/column-pinning/columnPinningFeature.utils.ts +111 -91
- package/src/features/column-resizing/columnResizingFeature.types.ts +9 -9
- package/src/features/column-resizing/columnResizingFeature.utils.ts +28 -19
- package/src/features/column-sizing/columnSizingFeature.types.ts +19 -12
- package/src/features/column-sizing/columnSizingFeature.utils.ts +52 -41
- package/src/features/column-visibility/columnVisibilityFeature.types.ts +16 -13
- package/src/features/column-visibility/columnVisibilityFeature.utils.ts +54 -42
- package/src/features/global-filtering/globalFilteringFeature.types.ts +10 -5
- package/src/features/global-filtering/globalFilteringFeature.utils.ts +20 -14
- package/src/features/row-expanding/rowExpandingFeature.types.ts +16 -15
- package/src/features/row-expanding/rowExpandingFeature.utils.ts +56 -41
- package/src/features/row-pagination/rowPaginationFeature.types.ts +19 -12
- package/src/features/row-pagination/rowPaginationFeature.utils.ts +49 -32
- package/src/features/row-pinning/rowPinningFeature.types.ts +12 -8
- package/src/features/row-pinning/rowPinningFeature.utils.ts +39 -29
- package/src/features/row-selection/rowSelectionFeature.types.ts +30 -24
- package/src/features/row-selection/rowSelectionFeature.utils.ts +89 -69
- package/src/features/row-sorting/rowSortingFeature.types.ts +10 -8
- package/src/features/row-sorting/rowSortingFeature.utils.ts +61 -44
- package/src/fns/aggregationFns.ts +33 -9
- package/src/fns/filterFns.ts +48 -17
- package/src/helpers/columnHelper.ts +9 -4
- package/src/helpers/tableOptions.ts +12 -9
- package/src/types/ColumnDef.ts +38 -0
- package/src/types/TableOptions.ts +15 -0
- package/src/types/TableState.ts +12 -0
|
@@ -9,13 +9,14 @@ import type {
|
|
|
9
9
|
} from './rowExpandingFeature.types'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Creates the default expanded state.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
14
|
+
* The feature default is an empty map, meaning no rows are expanded. Reset APIs
|
|
15
|
+
* use this value when `defaultState` is `true`.
|
|
15
16
|
*
|
|
16
17
|
* @example
|
|
17
18
|
* ```ts
|
|
18
|
-
* const
|
|
19
|
+
* const expanded = getDefaultExpandedState()
|
|
19
20
|
* ```
|
|
20
21
|
*/
|
|
21
22
|
export function getDefaultExpandedState(): ExpandedState {
|
|
@@ -23,9 +24,11 @@ export function getDefaultExpandedState(): ExpandedState {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
|
-
* Schedules an
|
|
27
|
+
* Schedules an expanded-state reset after row-structure changes.
|
|
27
28
|
*
|
|
28
|
-
* The reset
|
|
29
|
+
* The reset runs when `autoResetAll`, `autoResetExpanded`, or the default
|
|
30
|
+
* client-side expanding behavior allows it. Manual expanding opts out unless
|
|
31
|
+
* the reset options explicitly opt back in.
|
|
29
32
|
*
|
|
30
33
|
* @example
|
|
31
34
|
* ```ts
|
|
@@ -46,13 +49,14 @@ export function table_autoResetExpanded<
|
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
/**
|
|
49
|
-
*
|
|
52
|
+
* Routes an expanded-state updater through the table's expanded change handler.
|
|
50
53
|
*
|
|
51
|
-
* The updater
|
|
54
|
+
* The updater may be `true`, a row-id map, or a function of the previous
|
|
55
|
+
* expanded state, matching the instance `table.setExpanded` behavior.
|
|
52
56
|
*
|
|
53
57
|
* @example
|
|
54
58
|
* ```ts
|
|
55
|
-
* table_setExpanded(table, (old) => old)
|
|
59
|
+
* table_setExpanded(table, (old) => ({ ...old, [rowId]: true }))
|
|
56
60
|
* ```
|
|
57
61
|
*/
|
|
58
62
|
export function table_setExpanded<
|
|
@@ -63,9 +67,11 @@ export function table_setExpanded<
|
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
/**
|
|
66
|
-
*
|
|
70
|
+
* Expands or collapses every row.
|
|
67
71
|
*
|
|
68
|
-
*
|
|
72
|
+
* Passing `true` stores the special expanded-all state. Passing `false` stores
|
|
73
|
+
* an empty map. Omitting the value toggles based on whether all rows are
|
|
74
|
+
* currently expanded.
|
|
69
75
|
*
|
|
70
76
|
* @example
|
|
71
77
|
* ```ts
|
|
@@ -84,9 +90,10 @@ export function table_toggleAllRowsExpanded<
|
|
|
84
90
|
}
|
|
85
91
|
|
|
86
92
|
/**
|
|
87
|
-
* Resets the
|
|
93
|
+
* Resets `expanded` to the configured initial state or feature default.
|
|
88
94
|
*
|
|
89
|
-
*
|
|
95
|
+
* With no argument, the reset clones `table.initialState.expanded` when it
|
|
96
|
+
* exists. Passing `true` ignores initial state and resets to `{}`.
|
|
90
97
|
*
|
|
91
98
|
* @example
|
|
92
99
|
* ```ts
|
|
@@ -105,13 +112,14 @@ export function table_resetExpanded<
|
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
/**
|
|
108
|
-
*
|
|
115
|
+
* Checks whether at least one pre-paginated row can expand.
|
|
109
116
|
*
|
|
110
|
-
*
|
|
117
|
+
* Pagination is intentionally ignored so controls can reflect expandable rows
|
|
118
|
+
* that may not be on the current page.
|
|
111
119
|
*
|
|
112
120
|
* @example
|
|
113
121
|
* ```ts
|
|
114
|
-
* const
|
|
122
|
+
* const canExpand = table_getCanSomeRowsExpand(table)
|
|
115
123
|
* ```
|
|
116
124
|
*/
|
|
117
125
|
export function table_getCanSomeRowsExpand<
|
|
@@ -124,13 +132,14 @@ export function table_getCanSomeRowsExpand<
|
|
|
124
132
|
}
|
|
125
133
|
|
|
126
134
|
/**
|
|
127
|
-
*
|
|
135
|
+
* Creates an event handler that toggles all rows expanded.
|
|
128
136
|
*
|
|
129
|
-
*
|
|
137
|
+
* React-style synthetic events are persisted when present before the table state
|
|
138
|
+
* is toggled.
|
|
130
139
|
*
|
|
131
140
|
* @example
|
|
132
141
|
* ```ts
|
|
133
|
-
* const
|
|
142
|
+
* const onClick = table_getToggleAllRowsExpandedHandler(table)
|
|
134
143
|
* ```
|
|
135
144
|
*/
|
|
136
145
|
export function table_getToggleAllRowsExpandedHandler<
|
|
@@ -144,13 +153,13 @@ export function table_getToggleAllRowsExpandedHandler<
|
|
|
144
153
|
}
|
|
145
154
|
|
|
146
155
|
/**
|
|
147
|
-
*
|
|
156
|
+
* Checks whether any row is expanded.
|
|
148
157
|
*
|
|
149
|
-
*
|
|
158
|
+
* The special expanded-all value `true` counts as some rows expanded.
|
|
150
159
|
*
|
|
151
160
|
* @example
|
|
152
161
|
* ```ts
|
|
153
|
-
* const
|
|
162
|
+
* const someExpanded = table_getIsSomeRowsExpanded(table)
|
|
154
163
|
* ```
|
|
155
164
|
*/
|
|
156
165
|
export function table_getIsSomeRowsExpanded<
|
|
@@ -162,13 +171,14 @@ export function table_getIsSomeRowsExpanded<
|
|
|
162
171
|
}
|
|
163
172
|
|
|
164
173
|
/**
|
|
165
|
-
*
|
|
174
|
+
* Checks whether every row in the current row model is expanded.
|
|
166
175
|
*
|
|
167
|
-
*
|
|
176
|
+
* The special expanded-all value `true` returns true immediately. Empty
|
|
177
|
+
* expanded state returns false.
|
|
168
178
|
*
|
|
169
179
|
* @example
|
|
170
180
|
* ```ts
|
|
171
|
-
* const
|
|
181
|
+
* const allExpanded = table_getIsAllRowsExpanded(table)
|
|
172
182
|
* ```
|
|
173
183
|
*/
|
|
174
184
|
export function table_getIsAllRowsExpanded<
|
|
@@ -196,13 +206,14 @@ export function table_getIsAllRowsExpanded<
|
|
|
196
206
|
}
|
|
197
207
|
|
|
198
208
|
/**
|
|
199
|
-
*
|
|
209
|
+
* Computes the deepest expanded row id depth.
|
|
200
210
|
*
|
|
201
|
-
*
|
|
211
|
+
* Row ids are split on `.`; expanded-all state scans the current row model,
|
|
212
|
+
* while explicit expanded state scans its expanded id keys.
|
|
202
213
|
*
|
|
203
214
|
* @example
|
|
204
215
|
* ```ts
|
|
205
|
-
* const
|
|
216
|
+
* const depth = table_getExpandedDepth(table)
|
|
206
217
|
* ```
|
|
207
218
|
*/
|
|
208
219
|
export function table_getExpandedDepth<
|
|
@@ -225,9 +236,11 @@ export function table_getExpandedDepth<
|
|
|
225
236
|
}
|
|
226
237
|
|
|
227
238
|
/**
|
|
228
|
-
*
|
|
239
|
+
* Expands or collapses this row.
|
|
229
240
|
*
|
|
230
|
-
*
|
|
241
|
+
* Omitting `expanded` toggles the row. If the current state is expanded-all,
|
|
242
|
+
* the function first materializes that state into a row-id map before applying
|
|
243
|
+
* the row-specific change.
|
|
231
244
|
*
|
|
232
245
|
* @example
|
|
233
246
|
* ```ts
|
|
@@ -270,13 +283,14 @@ export function row_toggleExpanded<
|
|
|
270
283
|
}
|
|
271
284
|
|
|
272
285
|
/**
|
|
273
|
-
*
|
|
286
|
+
* Checks whether this row is expanded.
|
|
274
287
|
*
|
|
275
|
-
*
|
|
288
|
+
* `options.getIsRowExpanded` can override state-derived behavior. Otherwise
|
|
289
|
+
* the row is expanded when expanded state is `true` or contains this row id.
|
|
276
290
|
*
|
|
277
291
|
* @example
|
|
278
292
|
* ```ts
|
|
279
|
-
* const
|
|
293
|
+
* const expanded = row_getIsExpanded(row)
|
|
280
294
|
* ```
|
|
281
295
|
*/
|
|
282
296
|
export function row_getIsExpanded<
|
|
@@ -292,13 +306,14 @@ export function row_getIsExpanded<
|
|
|
292
306
|
}
|
|
293
307
|
|
|
294
308
|
/**
|
|
295
|
-
*
|
|
309
|
+
* Checks whether this row can be expanded.
|
|
296
310
|
*
|
|
297
|
-
*
|
|
311
|
+
* `options.getRowCanExpand` wins when provided. Otherwise rows can expand when
|
|
312
|
+
* expanding is enabled and the row has subRows.
|
|
298
313
|
*
|
|
299
314
|
* @example
|
|
300
315
|
* ```ts
|
|
301
|
-
* const
|
|
316
|
+
* const canExpand = row_getCanExpand(row)
|
|
302
317
|
* ```
|
|
303
318
|
*/
|
|
304
319
|
export function row_getCanExpand<
|
|
@@ -312,13 +327,13 @@ export function row_getCanExpand<
|
|
|
312
327
|
}
|
|
313
328
|
|
|
314
329
|
/**
|
|
315
|
-
*
|
|
330
|
+
* Checks whether every ancestor of this row is expanded.
|
|
316
331
|
*
|
|
317
|
-
*
|
|
332
|
+
* The current row is not considered; only its parent chain is walked.
|
|
318
333
|
*
|
|
319
334
|
* @example
|
|
320
335
|
* ```ts
|
|
321
|
-
* const
|
|
336
|
+
* const parentsExpanded = row_getIsAllParentsExpanded(row)
|
|
322
337
|
* ```
|
|
323
338
|
*/
|
|
324
339
|
export function row_getIsAllParentsExpanded<
|
|
@@ -337,13 +352,13 @@ export function row_getIsAllParentsExpanded<
|
|
|
337
352
|
}
|
|
338
353
|
|
|
339
354
|
/**
|
|
340
|
-
*
|
|
355
|
+
* Creates a row control handler that toggles this row's expanded state.
|
|
341
356
|
*
|
|
342
|
-
* The handler is
|
|
357
|
+
* The handler is a no-op when the row cannot expand.
|
|
343
358
|
*
|
|
344
359
|
* @example
|
|
345
360
|
* ```ts
|
|
346
|
-
* const
|
|
361
|
+
* const onClick = row_getToggleExpandedHandler(row)
|
|
347
362
|
* ```
|
|
348
363
|
*/
|
|
349
364
|
export function row_getToggleExpandedHandler<
|
|
@@ -47,23 +47,26 @@ export interface Table_RowPagination<
|
|
|
47
47
|
> {
|
|
48
48
|
_autoResetPageIndex: () => void
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Checks whether the current page index can move forward.
|
|
51
51
|
*/
|
|
52
52
|
getCanNextPage: () => boolean
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Checks whether the current page index can move backward.
|
|
55
55
|
*/
|
|
56
56
|
getCanPreviousPage: () => boolean
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Resolves the current page count from `options.pageCount` or row count and
|
|
59
|
+
* page size.
|
|
59
60
|
*/
|
|
60
61
|
getPageCount: () => number
|
|
61
62
|
/**
|
|
62
|
-
*
|
|
63
|
+
* Resolves the row count used for pagination math.
|
|
64
|
+
*
|
|
65
|
+
* `options.rowCount` wins; otherwise the pre-paginated row model is counted.
|
|
63
66
|
*/
|
|
64
67
|
getRowCount: () => number
|
|
65
68
|
/**
|
|
66
|
-
*
|
|
69
|
+
* Builds zero-based page indexes for the current page count.
|
|
67
70
|
*/
|
|
68
71
|
getPageOptions: () => Array<number>
|
|
69
72
|
/**
|
|
@@ -83,16 +86,20 @@ export interface Table_RowPagination<
|
|
|
83
86
|
*/
|
|
84
87
|
lastPage: () => void
|
|
85
88
|
/**
|
|
86
|
-
* Resets
|
|
89
|
+
* Resets `pagination.pageIndex` to initial state, or to `0` when
|
|
90
|
+
* `defaultState` is `true`.
|
|
87
91
|
*/
|
|
88
92
|
resetPageIndex: (defaultState?: boolean) => void
|
|
89
93
|
/**
|
|
90
|
-
* Resets
|
|
94
|
+
* Resets `pagination.pageSize` to initial state, or to `10` when
|
|
95
|
+
* `defaultState` is `true`.
|
|
91
96
|
*/
|
|
92
97
|
resetPageSize: (defaultState?: boolean) => void
|
|
93
98
|
/**
|
|
94
|
-
* Resets pagination
|
|
95
|
-
*
|
|
99
|
+
* Resets `pagination` to `initialState.pagination`.
|
|
100
|
+
*
|
|
101
|
+
* Pass `true` to ignore initial state and reset to
|
|
102
|
+
* `{ pageIndex: 0, pageSize: 10 }`.
|
|
96
103
|
*/
|
|
97
104
|
resetPagination: (defaultState?: boolean) => void
|
|
98
105
|
/**
|
|
@@ -104,7 +111,7 @@ export interface Table_RowPagination<
|
|
|
104
111
|
*/
|
|
105
112
|
setPageSize: (updater: Updater<number>) => void
|
|
106
113
|
/**
|
|
107
|
-
*
|
|
114
|
+
* Updates pagination state with a next state or updater function.
|
|
108
115
|
*/
|
|
109
116
|
setPagination: (updater: Updater<PaginationState>) => void
|
|
110
117
|
}
|
|
@@ -114,11 +121,11 @@ export interface Table_RowModels_Paginated<
|
|
|
114
121
|
TData extends RowData,
|
|
115
122
|
> {
|
|
116
123
|
/**
|
|
117
|
-
*
|
|
124
|
+
* Resolves the row model after pagination has sliced the current page.
|
|
118
125
|
*/
|
|
119
126
|
getPaginatedRowModel: () => RowModel<TFeatures, TData>
|
|
120
127
|
/**
|
|
121
|
-
*
|
|
128
|
+
* Reads the row model immediately before pagination.
|
|
122
129
|
*/
|
|
123
130
|
getPrePaginatedRowModel: () => RowModel<TFeatures, TData>
|
|
124
131
|
}
|
|
@@ -8,13 +8,14 @@ const defaultPageIndex = 0
|
|
|
8
8
|
const defaultPageSize = 10
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Creates the default pagination state used by the pagination feature.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* The feature default starts at the first page with a page size of 10. Reset
|
|
14
|
+
* APIs use this value when `defaultState` is `true`.
|
|
14
15
|
*
|
|
15
16
|
* @example
|
|
16
17
|
* ```ts
|
|
17
|
-
* const
|
|
18
|
+
* const pagination = getDefaultPaginationState()
|
|
18
19
|
* ```
|
|
19
20
|
*/
|
|
20
21
|
export function getDefaultPaginationState(): PaginationState {
|
|
@@ -25,9 +26,11 @@ export function getDefaultPaginationState(): PaginationState {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
+
* Resets the page index when a page-altering change should return to page 0.
|
|
29
30
|
*
|
|
30
|
-
* The reset
|
|
31
|
+
* The reset runs when `autoResetAll`, `autoResetPageIndex`, or the default
|
|
32
|
+
* client-side pagination behavior allows it. Manual pagination opts out unless
|
|
33
|
+
* the reset options explicitly opt back in.
|
|
31
34
|
*
|
|
32
35
|
* @example
|
|
33
36
|
* ```ts
|
|
@@ -48,9 +51,11 @@ export function table_autoResetPageIndex<
|
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
/**
|
|
51
|
-
*
|
|
54
|
+
* Routes a pagination updater through the table's pagination change handler.
|
|
52
55
|
*
|
|
53
|
-
* The updater
|
|
56
|
+
* The updater may be a next state object or a function of the previous
|
|
57
|
+
* `PaginationState`; controlled state and external atoms observe the same
|
|
58
|
+
* updater path as the instance API.
|
|
54
59
|
*
|
|
55
60
|
* @example
|
|
56
61
|
* ```ts
|
|
@@ -71,9 +76,11 @@ export function table_setPagination<
|
|
|
71
76
|
}
|
|
72
77
|
|
|
73
78
|
/**
|
|
74
|
-
* Resets the
|
|
79
|
+
* Resets `pagination` to the configured initial state or feature default.
|
|
75
80
|
*
|
|
76
|
-
*
|
|
81
|
+
* With no argument, the reset clones `table.initialState.pagination` when it
|
|
82
|
+
* exists. Passing `true` ignores initial state and resets to
|
|
83
|
+
* `{ pageIndex: 0, pageSize: 10 }`.
|
|
77
84
|
*
|
|
78
85
|
* @example
|
|
79
86
|
* ```ts
|
|
@@ -96,9 +103,10 @@ export function table_resetPagination<
|
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
/**
|
|
99
|
-
* Updates the
|
|
106
|
+
* Updates `pagination.pageIndex` and clamps it to the known page range.
|
|
100
107
|
*
|
|
101
|
-
*
|
|
108
|
+
* Unknown page counts (`undefined` or `-1`) allow any non-negative page index.
|
|
109
|
+
* Known page counts clamp the index between `0` and `pageCount - 1`.
|
|
102
110
|
*
|
|
103
111
|
* @example
|
|
104
112
|
* ```ts
|
|
@@ -128,9 +136,10 @@ export function table_setPageIndex<
|
|
|
128
136
|
}
|
|
129
137
|
|
|
130
138
|
/**
|
|
131
|
-
* Resets
|
|
139
|
+
* Resets only `pagination.pageIndex`.
|
|
132
140
|
*
|
|
133
|
-
*
|
|
141
|
+
* With no argument, the reset uses `table.initialState.pagination?.pageIndex`
|
|
142
|
+
* or `0`. Passing `true` always resets the page index to `0`.
|
|
134
143
|
*
|
|
135
144
|
* @example
|
|
136
145
|
* ```ts
|
|
@@ -152,9 +161,10 @@ export function table_resetPageIndex<
|
|
|
152
161
|
}
|
|
153
162
|
|
|
154
163
|
/**
|
|
155
|
-
* Resets
|
|
164
|
+
* Resets only `pagination.pageSize`.
|
|
156
165
|
*
|
|
157
|
-
*
|
|
166
|
+
* With no argument, the reset uses `table.initialState.pagination?.pageSize`
|
|
167
|
+
* or `10`. Passing `true` always resets the page size to `10`.
|
|
158
168
|
*
|
|
159
169
|
* @example
|
|
160
170
|
* ```ts
|
|
@@ -176,9 +186,10 @@ export function table_resetPageSize<
|
|
|
176
186
|
}
|
|
177
187
|
|
|
178
188
|
/**
|
|
179
|
-
* Updates
|
|
189
|
+
* Updates `pagination.pageSize` while preserving the current top row.
|
|
180
190
|
*
|
|
181
|
-
* The
|
|
191
|
+
* The new size is clamped to at least `1`, and `pageIndex` is recalculated so
|
|
192
|
+
* the row that was previously at the top of the page remains in view.
|
|
182
193
|
*
|
|
183
194
|
* @example
|
|
184
195
|
* ```ts
|
|
@@ -203,13 +214,14 @@ export function table_setPageSize<
|
|
|
203
214
|
}
|
|
204
215
|
|
|
205
216
|
/**
|
|
206
|
-
*
|
|
217
|
+
* Builds the zero-based page indexes available for the current page count.
|
|
207
218
|
*
|
|
208
|
-
*
|
|
219
|
+
* Unknown or empty page counts return an empty array; otherwise the result is
|
|
220
|
+
* `[0, 1, ...pageCount - 1]`.
|
|
209
221
|
*
|
|
210
222
|
* @example
|
|
211
223
|
* ```ts
|
|
212
|
-
* const
|
|
224
|
+
* const pageIndexes = table_getPageOptions(table)
|
|
213
225
|
* ```
|
|
214
226
|
*/
|
|
215
227
|
export function table_getPageOptions<
|
|
@@ -225,13 +237,14 @@ export function table_getPageOptions<
|
|
|
225
237
|
}
|
|
226
238
|
|
|
227
239
|
/**
|
|
228
|
-
*
|
|
240
|
+
* Checks whether the current page index can move backward.
|
|
229
241
|
*
|
|
230
|
-
*
|
|
242
|
+
* The first page is page index `0`, so only positive page indexes can navigate
|
|
243
|
+
* to a previous page.
|
|
231
244
|
*
|
|
232
245
|
* @example
|
|
233
246
|
* ```ts
|
|
234
|
-
* const
|
|
247
|
+
* const canGoBack = table_getCanPreviousPage(table)
|
|
235
248
|
* ```
|
|
236
249
|
*/
|
|
237
250
|
export function table_getCanPreviousPage<
|
|
@@ -242,13 +255,14 @@ export function table_getCanPreviousPage<
|
|
|
242
255
|
}
|
|
243
256
|
|
|
244
257
|
/**
|
|
245
|
-
*
|
|
258
|
+
* Checks whether the current page index can move forward.
|
|
246
259
|
*
|
|
247
|
-
*
|
|
260
|
+
* A `pageCount` of `-1` means the caller does not know the total page count, so
|
|
261
|
+
* this returns `true`. A page count of `0` returns `false`.
|
|
248
262
|
*
|
|
249
263
|
* @example
|
|
250
264
|
* ```ts
|
|
251
|
-
* const
|
|
265
|
+
* const canGoForward = table_getCanNextPage(table)
|
|
252
266
|
* ```
|
|
253
267
|
*/
|
|
254
268
|
export function table_getCanNextPage<
|
|
@@ -343,13 +357,14 @@ export function table_lastPage<
|
|
|
343
357
|
}
|
|
344
358
|
|
|
345
359
|
/**
|
|
346
|
-
*
|
|
360
|
+
* Resolves the number of pages for the current pagination state.
|
|
347
361
|
*
|
|
348
|
-
*
|
|
362
|
+
* `options.pageCount` wins for manual pagination. Otherwise the value is
|
|
363
|
+
* calculated from `table_getRowCount(table)` and the current `pageSize`.
|
|
349
364
|
*
|
|
350
365
|
* @example
|
|
351
366
|
* ```ts
|
|
352
|
-
* const
|
|
367
|
+
* const pages = table_getPageCount(table)
|
|
353
368
|
* ```
|
|
354
369
|
*/
|
|
355
370
|
export function table_getPageCount<
|
|
@@ -366,13 +381,15 @@ export function table_getPageCount<
|
|
|
366
381
|
}
|
|
367
382
|
|
|
368
383
|
/**
|
|
369
|
-
*
|
|
384
|
+
* Resolves the total row count used for pagination math.
|
|
370
385
|
*
|
|
371
|
-
*
|
|
386
|
+
* `options.rowCount` wins for manual pagination. Otherwise the count comes
|
|
387
|
+
* from the pre-paginated row model so filtering, grouping, sorting, and
|
|
388
|
+
* expansion are reflected before the page slice is applied.
|
|
372
389
|
*
|
|
373
390
|
* @example
|
|
374
391
|
* ```ts
|
|
375
|
-
* const
|
|
392
|
+
* const rows = table_getRowCount(table)
|
|
376
393
|
* ```
|
|
377
394
|
*/
|
|
378
395
|
export function table_getRowCount<
|
|
@@ -18,7 +18,9 @@ export interface TableOptions_RowPinning<
|
|
|
18
18
|
TData extends RowData,
|
|
19
19
|
> {
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Allows rows to be pinned to top or bottom regions.
|
|
22
|
+
*
|
|
23
|
+
* Provide a predicate to decide per row. Defaults to `true`.
|
|
22
24
|
*/
|
|
23
25
|
enableRowPinning?: boolean | ((row: Row<TFeatures, TData>) => boolean)
|
|
24
26
|
/**
|
|
@@ -39,7 +41,7 @@ export interface RowPinningDefaultOptions {
|
|
|
39
41
|
|
|
40
42
|
export interface Row_RowPinning {
|
|
41
43
|
/**
|
|
42
|
-
*
|
|
44
|
+
* Checks whether this row can be pinned.
|
|
43
45
|
*/
|
|
44
46
|
getCanPin: () => boolean
|
|
45
47
|
/**
|
|
@@ -65,27 +67,29 @@ export interface Table_RowPinning<
|
|
|
65
67
|
TData extends RowData,
|
|
66
68
|
> {
|
|
67
69
|
/**
|
|
68
|
-
*
|
|
70
|
+
* Gets rows pinned to the bottom region.
|
|
69
71
|
*/
|
|
70
72
|
getBottomRows: () => Array<Row<TFeatures, TData>>
|
|
71
73
|
/**
|
|
72
|
-
*
|
|
74
|
+
* Gets rows that are not pinned to the top or bottom region.
|
|
73
75
|
*/
|
|
74
76
|
getCenterRows: () => Array<Row<TFeatures, TData>>
|
|
75
77
|
/**
|
|
76
|
-
*
|
|
78
|
+
* Checks whether any rows are pinned, optionally limited to one region.
|
|
77
79
|
*/
|
|
78
80
|
getIsSomeRowsPinned: (position?: RowPinningPosition) => boolean
|
|
79
81
|
/**
|
|
80
|
-
*
|
|
82
|
+
* Gets rows pinned to the top region.
|
|
81
83
|
*/
|
|
82
84
|
getTopRows: () => Array<Row<TFeatures, TData>>
|
|
83
85
|
/**
|
|
84
|
-
* Resets
|
|
86
|
+
* Resets `rowPinning` to `initialState.rowPinning`.
|
|
87
|
+
*
|
|
88
|
+
* Pass `true` to ignore initial state and reset to empty top/bottom arrays.
|
|
85
89
|
*/
|
|
86
90
|
resetRowPinning: (defaultState?: boolean) => void
|
|
87
91
|
/**
|
|
88
|
-
*
|
|
92
|
+
* Updates row pinning state with a next state or updater function.
|
|
89
93
|
*/
|
|
90
94
|
setRowPinning: (updater: Updater<RowPinningState>) => void
|
|
91
95
|
}
|