@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
|
@@ -7,20 +7,22 @@ import { Table_Internal } from "../../types/Table.js";
|
|
|
7
7
|
import { Cell } from "../../types/Cell.js";
|
|
8
8
|
//#region src/features/column-visibility/columnVisibilityFeature.utils.d.ts
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Creates the default column visibility state.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* The feature default is an empty object, where missing column ids are treated
|
|
13
|
+
* as visible. Reset APIs use this value when `defaultState` is `true`.
|
|
13
14
|
*
|
|
14
15
|
* @example
|
|
15
16
|
* ```ts
|
|
16
|
-
* const
|
|
17
|
+
* const visibility = getDefaultColumnVisibilityState()
|
|
17
18
|
* ```
|
|
18
19
|
*/
|
|
19
20
|
declare function getDefaultColumnVisibilityState(): ColumnVisibilityState;
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
+
* Updates this column's visibility when hiding is allowed.
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
+
* Passing `visible` stores that value. Omitting it flips the column's current
|
|
25
|
+
* visibility state. Columns that cannot hide are left unchanged.
|
|
24
26
|
*
|
|
25
27
|
* @example
|
|
26
28
|
* ```ts
|
|
@@ -29,97 +31,105 @@ declare function getDefaultColumnVisibilityState(): ColumnVisibilityState;
|
|
|
29
31
|
*/
|
|
30
32
|
declare function column_toggleVisibility<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>, visible?: boolean): void;
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
34
|
+
* Checks whether this column is visible.
|
|
33
35
|
*
|
|
34
|
-
*
|
|
36
|
+
* Leaf columns read `state.columnVisibility[column.id]`, where missing entries
|
|
37
|
+
* default to visible. Parent columns are visible when at least one child column
|
|
38
|
+
* is visible.
|
|
35
39
|
*
|
|
36
40
|
* @example
|
|
37
41
|
* ```ts
|
|
38
|
-
* const
|
|
42
|
+
* const visible = column_getIsVisible(column)
|
|
39
43
|
* ```
|
|
40
44
|
*/
|
|
41
45
|
declare function column_getIsVisible<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): boolean;
|
|
42
46
|
/**
|
|
43
|
-
*
|
|
47
|
+
* Checks whether this column is allowed to be hidden.
|
|
44
48
|
*
|
|
45
|
-
*
|
|
49
|
+
* Both `columnDef.enableHiding` and table `enableHiding` default to `true`.
|
|
46
50
|
*
|
|
47
51
|
* @example
|
|
48
52
|
* ```ts
|
|
49
|
-
* const
|
|
53
|
+
* const canHide = column_getCanHide(column)
|
|
50
54
|
* ```
|
|
51
55
|
*/
|
|
52
56
|
declare function column_getCanHide<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): boolean;
|
|
53
57
|
/**
|
|
54
|
-
*
|
|
58
|
+
* Creates a checkbox-style handler that writes this column's visibility.
|
|
55
59
|
*
|
|
56
|
-
* The handler
|
|
60
|
+
* The handler reads `event.target.checked`, so it is intended for visibility
|
|
61
|
+
* controls whose checked state means "visible".
|
|
57
62
|
*
|
|
58
63
|
* @example
|
|
59
64
|
* ```ts
|
|
60
|
-
* const
|
|
65
|
+
* const onChange = column_getToggleVisibilityHandler(column)
|
|
61
66
|
* ```
|
|
62
67
|
*/
|
|
63
68
|
declare function column_getToggleVisibilityHandler<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): (e: unknown) => void;
|
|
64
69
|
/**
|
|
65
|
-
*
|
|
70
|
+
* Collects the cells from this row whose columns are visible.
|
|
66
71
|
*
|
|
67
|
-
*
|
|
72
|
+
* When column pinning is active, the result is ordered as left-pinned cells,
|
|
73
|
+
* center cells, then right-pinned cells.
|
|
68
74
|
*
|
|
69
75
|
* @example
|
|
70
76
|
* ```ts
|
|
71
|
-
* const
|
|
77
|
+
* const visibleCells = row_getVisibleCells(row)
|
|
72
78
|
* ```
|
|
73
79
|
*/
|
|
74
80
|
declare function row_getVisibleCells<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>>;
|
|
75
81
|
/**
|
|
76
|
-
*
|
|
82
|
+
* Builds a lookup map of this row's visible cells keyed by column id.
|
|
77
83
|
*
|
|
78
|
-
*
|
|
84
|
+
* Hidden columns are omitted from the map.
|
|
79
85
|
*
|
|
80
86
|
* @example
|
|
81
87
|
* ```ts
|
|
82
|
-
* const
|
|
88
|
+
* const visibleCellsById = row_getVisibleCellsByColumnId(row)
|
|
83
89
|
* ```
|
|
84
90
|
*/
|
|
85
91
|
declare function row_getVisibleCellsByColumnId<TFeatures extends TableFeatures, TData extends RowData>(row: Row<TFeatures, TData>): Record<string, Cell<TFeatures, TData, unknown>>;
|
|
86
92
|
/**
|
|
87
|
-
*
|
|
93
|
+
* Filters the flat column list down to visible columns.
|
|
88
94
|
*
|
|
89
|
-
*
|
|
95
|
+
* Parent/group columns are included when `column_getIsVisible` considers them
|
|
96
|
+
* visible.
|
|
90
97
|
*
|
|
91
98
|
* @example
|
|
92
99
|
* ```ts
|
|
93
|
-
* const
|
|
100
|
+
* const columns = table_getVisibleFlatColumns(table)
|
|
94
101
|
* ```
|
|
95
102
|
*/
|
|
96
103
|
declare function table_getVisibleFlatColumns<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Column<TFeatures, TData, unknown>[];
|
|
97
104
|
/**
|
|
98
|
-
*
|
|
105
|
+
* Filters leaf columns down to those currently visible.
|
|
99
106
|
*
|
|
100
|
-
* This
|
|
107
|
+
* This is the column list most row rendering code uses before pinning-specific
|
|
108
|
+
* partitioning.
|
|
101
109
|
*
|
|
102
110
|
* @example
|
|
103
111
|
* ```ts
|
|
104
|
-
* const
|
|
112
|
+
* const columns = table_getVisibleLeafColumns(table)
|
|
105
113
|
* ```
|
|
106
114
|
*/
|
|
107
115
|
declare function table_getVisibleLeafColumns<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Column<TFeatures, TData, unknown>[];
|
|
108
116
|
/**
|
|
109
|
-
*
|
|
117
|
+
* Routes a column visibility updater through the table's visibility change handler.
|
|
110
118
|
*
|
|
111
|
-
* The updater
|
|
119
|
+
* The updater may be a next visibility map or a function of the previous map,
|
|
120
|
+
* matching the instance `table.setColumnVisibility` behavior.
|
|
112
121
|
*
|
|
113
122
|
* @example
|
|
114
123
|
* ```ts
|
|
115
|
-
* table_setColumnVisibility(table, (old) => old)
|
|
124
|
+
* table_setColumnVisibility(table, (old) => ({ ...old, age: false }))
|
|
116
125
|
* ```
|
|
117
126
|
*/
|
|
118
127
|
declare function table_setColumnVisibility<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<ColumnVisibilityState>): void;
|
|
119
128
|
/**
|
|
120
|
-
* Resets the
|
|
129
|
+
* Resets `columnVisibility` to the configured initial state or feature default.
|
|
121
130
|
*
|
|
122
|
-
*
|
|
131
|
+
* With no argument, the reset clones `table.initialState.columnVisibility` when
|
|
132
|
+
* it exists. Passing `true` ignores initial state and resets to `{}`.
|
|
123
133
|
*
|
|
124
134
|
* @example
|
|
125
135
|
* ```ts
|
|
@@ -129,9 +139,9 @@ declare function table_setColumnVisibility<TFeatures extends TableFeatures, TDat
|
|
|
129
139
|
*/
|
|
130
140
|
declare function table_resetColumnVisibility<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
|
|
131
141
|
/**
|
|
132
|
-
*
|
|
142
|
+
* Shows or hides every hideable leaf column.
|
|
133
143
|
*
|
|
134
|
-
*
|
|
144
|
+
* Columns that cannot hide stay visible when toggling all columns off.
|
|
135
145
|
*
|
|
136
146
|
* @example
|
|
137
147
|
* ```ts
|
|
@@ -140,35 +150,37 @@ declare function table_resetColumnVisibility<TFeatures extends TableFeatures, TD
|
|
|
140
150
|
*/
|
|
141
151
|
declare function table_toggleAllColumnsVisible<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, value?: boolean): void;
|
|
142
152
|
/**
|
|
143
|
-
*
|
|
153
|
+
* Checks whether every leaf column is currently visible.
|
|
144
154
|
*
|
|
145
|
-
*
|
|
155
|
+
* Non-hideable columns are naturally visible because missing visibility entries
|
|
156
|
+
* default to `true`.
|
|
146
157
|
*
|
|
147
158
|
* @example
|
|
148
159
|
* ```ts
|
|
149
|
-
* const
|
|
160
|
+
* const allVisible = table_getIsAllColumnsVisible(table)
|
|
150
161
|
* ```
|
|
151
162
|
*/
|
|
152
163
|
declare function table_getIsAllColumnsVisible<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): boolean;
|
|
153
164
|
/**
|
|
154
|
-
*
|
|
165
|
+
* Checks whether at least one leaf column is currently visible.
|
|
155
166
|
*
|
|
156
|
-
* This
|
|
167
|
+
* This is useful for tri-state "show all columns" controls.
|
|
157
168
|
*
|
|
158
169
|
* @example
|
|
159
170
|
* ```ts
|
|
160
|
-
* const
|
|
171
|
+
* const someVisible = table_getIsSomeColumnsVisible(table)
|
|
161
172
|
* ```
|
|
162
173
|
*/
|
|
163
174
|
declare function table_getIsSomeColumnsVisible<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): boolean;
|
|
164
175
|
/**
|
|
165
|
-
*
|
|
176
|
+
* Creates a checkbox-style handler that shows or hides all columns.
|
|
166
177
|
*
|
|
167
|
-
* The handler
|
|
178
|
+
* The handler reads `event.target.checked`, so it is intended for controls whose
|
|
179
|
+
* checked state means "all columns visible".
|
|
168
180
|
*
|
|
169
181
|
* @example
|
|
170
182
|
* ```ts
|
|
171
|
-
* const
|
|
183
|
+
* const onChange = table_getToggleAllColumnsVisibilityHandler(table)
|
|
172
184
|
* ```
|
|
173
185
|
*/
|
|
174
186
|
declare function table_getToggleAllColumnsVisibilityHandler<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): (e: unknown) => void;
|
|
@@ -3,22 +3,24 @@ import { getDefaultColumnPinningState } from "../column-pinning/columnPinningFea
|
|
|
3
3
|
|
|
4
4
|
//#region src/features/column-visibility/columnVisibilityFeature.utils.ts
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Creates the default column visibility state.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* The feature default is an empty object, where missing column ids are treated
|
|
9
|
+
* as visible. Reset APIs use this value when `defaultState` is `true`.
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* ```ts
|
|
12
|
-
* const
|
|
13
|
+
* const visibility = getDefaultColumnVisibilityState()
|
|
13
14
|
* ```
|
|
14
15
|
*/
|
|
15
16
|
function getDefaultColumnVisibilityState() {
|
|
16
17
|
return {};
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
+
* Updates this column's visibility when hiding is allowed.
|
|
20
21
|
*
|
|
21
|
-
*
|
|
22
|
+
* Passing `visible` stores that value. Omitting it flips the column's current
|
|
23
|
+
* visibility state. Columns that cannot hide are left unchanged.
|
|
22
24
|
*
|
|
23
25
|
* @example
|
|
24
26
|
* ```ts
|
|
@@ -32,13 +34,15 @@ function column_toggleVisibility(column, visible) {
|
|
|
32
34
|
}));
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
37
|
+
* Checks whether this column is visible.
|
|
36
38
|
*
|
|
37
|
-
*
|
|
39
|
+
* Leaf columns read `state.columnVisibility[column.id]`, where missing entries
|
|
40
|
+
* default to visible. Parent columns are visible when at least one child column
|
|
41
|
+
* is visible.
|
|
38
42
|
*
|
|
39
43
|
* @example
|
|
40
44
|
* ```ts
|
|
41
|
-
* const
|
|
45
|
+
* const visible = column_getIsVisible(column)
|
|
42
46
|
* ```
|
|
43
47
|
*/
|
|
44
48
|
function column_getIsVisible(column) {
|
|
@@ -47,26 +51,27 @@ function column_getIsVisible(column) {
|
|
|
47
51
|
return (childColumns.length ? childColumns.some((childColumn) => callMemoOrStaticFn(childColumn, "getIsVisible", column_getIsVisible)) : (_column$table$atoms$c = column.table.atoms.columnVisibility) === null || _column$table$atoms$c === void 0 || (_column$table$atoms$c = _column$table$atoms$c.get()) === null || _column$table$atoms$c === void 0 ? void 0 : _column$table$atoms$c[column.id]) ?? true;
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
|
-
*
|
|
54
|
+
* Checks whether this column is allowed to be hidden.
|
|
51
55
|
*
|
|
52
|
-
*
|
|
56
|
+
* Both `columnDef.enableHiding` and table `enableHiding` default to `true`.
|
|
53
57
|
*
|
|
54
58
|
* @example
|
|
55
59
|
* ```ts
|
|
56
|
-
* const
|
|
60
|
+
* const canHide = column_getCanHide(column)
|
|
57
61
|
* ```
|
|
58
62
|
*/
|
|
59
63
|
function column_getCanHide(column) {
|
|
60
64
|
return (column.columnDef.enableHiding ?? true) && (column.table.options.enableHiding ?? true);
|
|
61
65
|
}
|
|
62
66
|
/**
|
|
63
|
-
*
|
|
67
|
+
* Creates a checkbox-style handler that writes this column's visibility.
|
|
64
68
|
*
|
|
65
|
-
* The handler
|
|
69
|
+
* The handler reads `event.target.checked`, so it is intended for visibility
|
|
70
|
+
* controls whose checked state means "visible".
|
|
66
71
|
*
|
|
67
72
|
* @example
|
|
68
73
|
* ```ts
|
|
69
|
-
* const
|
|
74
|
+
* const onChange = column_getToggleVisibilityHandler(column)
|
|
70
75
|
* ```
|
|
71
76
|
*/
|
|
72
77
|
function column_getToggleVisibilityHandler(column) {
|
|
@@ -75,13 +80,14 @@ function column_getToggleVisibilityHandler(column) {
|
|
|
75
80
|
};
|
|
76
81
|
}
|
|
77
82
|
/**
|
|
78
|
-
*
|
|
83
|
+
* Collects the cells from this row whose columns are visible.
|
|
79
84
|
*
|
|
80
|
-
*
|
|
85
|
+
* When column pinning is active, the result is ordered as left-pinned cells,
|
|
86
|
+
* center cells, then right-pinned cells.
|
|
81
87
|
*
|
|
82
88
|
* @example
|
|
83
89
|
* ```ts
|
|
84
|
-
* const
|
|
90
|
+
* const visibleCells = row_getVisibleCells(row)
|
|
85
91
|
* ```
|
|
86
92
|
*/
|
|
87
93
|
function row_getVisibleCells(row) {
|
|
@@ -118,13 +124,13 @@ function row_getVisibleCells(row) {
|
|
|
118
124
|
];
|
|
119
125
|
}
|
|
120
126
|
/**
|
|
121
|
-
*
|
|
127
|
+
* Builds a lookup map of this row's visible cells keyed by column id.
|
|
122
128
|
*
|
|
123
|
-
*
|
|
129
|
+
* Hidden columns are omitted from the map.
|
|
124
130
|
*
|
|
125
131
|
* @example
|
|
126
132
|
* ```ts
|
|
127
|
-
* const
|
|
133
|
+
* const visibleCellsById = row_getVisibleCellsByColumnId(row)
|
|
128
134
|
* ```
|
|
129
135
|
*/
|
|
130
136
|
function row_getVisibleCellsByColumnId(row) {
|
|
@@ -137,39 +143,42 @@ function row_getVisibleCellsByColumnId(row) {
|
|
|
137
143
|
return result;
|
|
138
144
|
}
|
|
139
145
|
/**
|
|
140
|
-
*
|
|
146
|
+
* Filters the flat column list down to visible columns.
|
|
141
147
|
*
|
|
142
|
-
*
|
|
148
|
+
* Parent/group columns are included when `column_getIsVisible` considers them
|
|
149
|
+
* visible.
|
|
143
150
|
*
|
|
144
151
|
* @example
|
|
145
152
|
* ```ts
|
|
146
|
-
* const
|
|
153
|
+
* const columns = table_getVisibleFlatColumns(table)
|
|
147
154
|
* ```
|
|
148
155
|
*/
|
|
149
156
|
function table_getVisibleFlatColumns(table) {
|
|
150
157
|
return table.getAllFlatColumns().filter((column) => callMemoOrStaticFn(column, "getIsVisible", column_getIsVisible));
|
|
151
158
|
}
|
|
152
159
|
/**
|
|
153
|
-
*
|
|
160
|
+
* Filters leaf columns down to those currently visible.
|
|
154
161
|
*
|
|
155
|
-
* This
|
|
162
|
+
* This is the column list most row rendering code uses before pinning-specific
|
|
163
|
+
* partitioning.
|
|
156
164
|
*
|
|
157
165
|
* @example
|
|
158
166
|
* ```ts
|
|
159
|
-
* const
|
|
167
|
+
* const columns = table_getVisibleLeafColumns(table)
|
|
160
168
|
* ```
|
|
161
169
|
*/
|
|
162
170
|
function table_getVisibleLeafColumns(table) {
|
|
163
171
|
return table.getAllLeafColumns().filter((column) => callMemoOrStaticFn(column, "getIsVisible", column_getIsVisible));
|
|
164
172
|
}
|
|
165
173
|
/**
|
|
166
|
-
*
|
|
174
|
+
* Routes a column visibility updater through the table's visibility change handler.
|
|
167
175
|
*
|
|
168
|
-
* The updater
|
|
176
|
+
* The updater may be a next visibility map or a function of the previous map,
|
|
177
|
+
* matching the instance `table.setColumnVisibility` behavior.
|
|
169
178
|
*
|
|
170
179
|
* @example
|
|
171
180
|
* ```ts
|
|
172
|
-
* table_setColumnVisibility(table, (old) => old)
|
|
181
|
+
* table_setColumnVisibility(table, (old) => ({ ...old, age: false }))
|
|
173
182
|
* ```
|
|
174
183
|
*/
|
|
175
184
|
function table_setColumnVisibility(table, updater) {
|
|
@@ -177,9 +186,10 @@ function table_setColumnVisibility(table, updater) {
|
|
|
177
186
|
(_table$options$onColu = (_table$options = table.options).onColumnVisibilityChange) === null || _table$options$onColu === void 0 || _table$options$onColu.call(_table$options, updater);
|
|
178
187
|
}
|
|
179
188
|
/**
|
|
180
|
-
* Resets the
|
|
189
|
+
* Resets `columnVisibility` to the configured initial state or feature default.
|
|
181
190
|
*
|
|
182
|
-
*
|
|
191
|
+
* With no argument, the reset clones `table.initialState.columnVisibility` when
|
|
192
|
+
* it exists. Passing `true` ignores initial state and resets to `{}`.
|
|
183
193
|
*
|
|
184
194
|
* @example
|
|
185
195
|
* ```ts
|
|
@@ -191,9 +201,9 @@ function table_resetColumnVisibility(table, defaultState) {
|
|
|
191
201
|
table_setColumnVisibility(table, defaultState ? {} : cloneState(table.initialState.columnVisibility ?? {}));
|
|
192
202
|
}
|
|
193
203
|
/**
|
|
194
|
-
*
|
|
204
|
+
* Shows or hides every hideable leaf column.
|
|
195
205
|
*
|
|
196
|
-
*
|
|
206
|
+
* Columns that cannot hide stay visible when toggling all columns off.
|
|
197
207
|
*
|
|
198
208
|
* @example
|
|
199
209
|
* ```ts
|
|
@@ -211,39 +221,41 @@ function table_toggleAllColumnsVisible(table, value) {
|
|
|
211
221
|
table_setColumnVisibility(table, visibility);
|
|
212
222
|
}
|
|
213
223
|
/**
|
|
214
|
-
*
|
|
224
|
+
* Checks whether every leaf column is currently visible.
|
|
215
225
|
*
|
|
216
|
-
*
|
|
226
|
+
* Non-hideable columns are naturally visible because missing visibility entries
|
|
227
|
+
* default to `true`.
|
|
217
228
|
*
|
|
218
229
|
* @example
|
|
219
230
|
* ```ts
|
|
220
|
-
* const
|
|
231
|
+
* const allVisible = table_getIsAllColumnsVisible(table)
|
|
221
232
|
* ```
|
|
222
233
|
*/
|
|
223
234
|
function table_getIsAllColumnsVisible(table) {
|
|
224
235
|
return !table.getAllLeafColumns().some((column) => !callMemoOrStaticFn(column, "getIsVisible", column_getIsVisible));
|
|
225
236
|
}
|
|
226
237
|
/**
|
|
227
|
-
*
|
|
238
|
+
* Checks whether at least one leaf column is currently visible.
|
|
228
239
|
*
|
|
229
|
-
* This
|
|
240
|
+
* This is useful for tri-state "show all columns" controls.
|
|
230
241
|
*
|
|
231
242
|
* @example
|
|
232
243
|
* ```ts
|
|
233
|
-
* const
|
|
244
|
+
* const someVisible = table_getIsSomeColumnsVisible(table)
|
|
234
245
|
* ```
|
|
235
246
|
*/
|
|
236
247
|
function table_getIsSomeColumnsVisible(table) {
|
|
237
248
|
return table.getAllLeafColumns().some((column) => callMemoOrStaticFn(column, "getIsVisible", column_getIsVisible));
|
|
238
249
|
}
|
|
239
250
|
/**
|
|
240
|
-
*
|
|
251
|
+
* Creates a checkbox-style handler that shows or hides all columns.
|
|
241
252
|
*
|
|
242
|
-
* The handler
|
|
253
|
+
* The handler reads `event.target.checked`, so it is intended for controls whose
|
|
254
|
+
* checked state means "all columns visible".
|
|
243
255
|
*
|
|
244
256
|
* @example
|
|
245
257
|
* ```ts
|
|
246
|
-
* const
|
|
258
|
+
* const onChange = table_getToggleAllColumnsVisibilityHandler(table)
|
|
247
259
|
* ```
|
|
248
260
|
*/
|
|
249
261
|
function table_getToggleAllColumnsVisibilityHandler(table) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnVisibilityFeature.utils.js","names":[],"sources":["../../../src/features/column-visibility/columnVisibilityFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn, cloneState } from '../../utils'\nimport { getDefaultColumnPinningState } from '../column-pinning/columnPinningFeature.utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Cell } from '../../types/Cell'\nimport type { Column_Internal } from '../../types/Column'\nimport type { ColumnVisibilityState } from './columnVisibilityFeature.types'\nimport type { Row } from '../../types/Row'\n\n/**\n * Returns the default column visibility state.\n *\n * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.\n *\n * @example\n * ```ts\n * const initialValue = getDefaultColumnVisibilityState()\n * ```\n */\nexport function getDefaultColumnVisibilityState(): ColumnVisibilityState {\n return {}\n}\n\n/**\n * Toggles visibility for a column.\n *\n * The update is applied through the owning table state slice and respects the feature options for that column.\n *\n * @example\n * ```ts\n * column_toggleVisibility(column)\n * ```\n */\nexport function column_toggleVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>, visible?: boolean): void {\n if (column_getCanHide(column)) {\n table_setColumnVisibility(column.table, (old) => ({\n ...old,\n [column.id]:\n visible ??\n !callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n }))\n }\n}\n\n/**\n * Returns is visible for a column.\n *\n * This derives the value from the column definition, table options, and the feature state atoms registered on the table.\n *\n * @example\n * ```ts\n * const value = column_getIsVisible(column)\n * ```\n */\nexport function column_getIsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): boolean {\n const childColumns = column.columns\n return (\n (childColumns.length\n ? childColumns.some((childColumn) =>\n callMemoOrStaticFn(childColumn, 'getIsVisible', column_getIsVisible),\n )\n : column.table.atoms.columnVisibility?.get()?.[column.id]) ?? true\n )\n}\n\n/**\n * Returns whether a column can use hide.\n *\n * This combines column options, table options, and any required accessor or feature state for the capability.\n *\n * @example\n * ```ts\n * const value = column_getCanHide(column)\n * ```\n */\nexport function column_getCanHide<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (\n (column.columnDef.enableHiding ?? true) &&\n (column.table.options.enableHiding ?? true)\n )\n}\n\n/**\n * Returns an event handler for toggling visibility handler.\n *\n * The handler is intended for direct use in column header controls such as buttons or checkboxes.\n *\n * @example\n * ```ts\n * const value = column_getToggleVisibilityHandler(column)\n * ```\n */\nexport function column_getToggleVisibilityHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (e: unknown) => {\n column_toggleVisibility(\n column,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Returns visible cells for a row.\n *\n * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.\n *\n * @example\n * ```ts\n * const value = row_getVisibleCells(row)\n * ```\n */\nexport function row_getVisibleCells<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>> {\n const allCells = row.getAllCells()\n const visibleCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < allCells.length; i++) {\n const cell = allCells[i]!\n if (callMemoOrStaticFn(cell.column, 'getIsVisible', column_getIsVisible)) {\n visibleCells.push(cell)\n }\n }\n\n const { left, right } =\n row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()\n if (!left.length && !right.length) return visibleCells // no pinning, return early\n\n const visibleCellsByColumnId = callMemoOrStaticFn(\n row,\n 'getVisibleCellsByColumnId',\n row_getVisibleCellsByColumnId,\n )\n\n const leftCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < left.length; i++) {\n const cell = visibleCellsByColumnId[left[i]!]\n if (cell) leftCells.push(cell)\n }\n\n const rightCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < right.length; i++) {\n const cell = visibleCellsByColumnId[right[i]!]\n if (cell) rightCells.push(cell)\n }\n\n // Center cells: visible cells in natural column order, minus pinned ones.\n const centerCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < visibleCells.length; i++) {\n const cell = visibleCells[i]!\n const id = cell.column.id\n if (!left.includes(id) && !right.includes(id)) centerCells.push(cell)\n }\n\n return [...leftCells, ...centerCells, ...rightCells]\n}\n\n/**\n * Returns visible cells by column id for a row.\n *\n * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.\n *\n * @example\n * ```ts\n * const value = row_getVisibleCellsByColumnId(row)\n * ```\n */\nexport function row_getVisibleCellsByColumnId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Record<string, Cell<TFeatures, TData, unknown>> {\n const result: Record<string, Cell<TFeatures, TData, unknown>> = {}\n const allCells = row.getAllCells()\n for (let i = 0; i < allCells.length; i++) {\n const cell = allCells[i]!\n if (callMemoOrStaticFn(cell.column, 'getIsVisible', column_getIsVisible)) {\n result[cell.column.id] = cell\n }\n }\n return result\n}\n\n/**\n * Returns visible flat columns for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getVisibleFlatColumns(table)\n * ```\n */\nexport function table_getVisibleFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllFlatColumns()\n .filter((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Returns visible leaf columns for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getVisibleLeafColumns(table)\n * ```\n */\nexport function table_getVisibleLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllLeafColumns()\n .filter((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Updates the table's column visibility state slice.\n *\n * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.\n *\n * @example\n * ```ts\n * table_setColumnVisibility(table, (old) => old)\n * ```\n */\nexport function table_setColumnVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<ColumnVisibilityState>,\n) {\n table.options.onColumnVisibilityChange?.(updater)\n}\n\n/**\n * Resets the table's column visibility state slice.\n *\n * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.\n *\n * @example\n * ```ts\n * table_resetColumnVisibility(table)\n * table_resetColumnVisibility(table, true)\n * ```\n */\nexport function table_resetColumnVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setColumnVisibility(\n table,\n defaultState ? {} : cloneState(table.initialState.columnVisibility ?? {}),\n )\n}\n\n/**\n * Toggles all columns visible for the table.\n *\n * This is the table-level convenience API used by UI controls that affect many columns or rows at once.\n *\n * @example\n * ```ts\n * table_toggleAllColumnsVisible(table)\n * ```\n */\nexport function table_toggleAllColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n value = value ?? !table_getIsAllColumnsVisible(table)\n\n const visibility: Record<string, boolean> = {}\n const leafColumns = table.getAllLeafColumns()\n for (let i = 0; i < leafColumns.length; i++) {\n const column = leafColumns[i]!\n visibility[column.id] = !value ? !column_getCanHide(column) : value\n }\n\n table_setColumnVisibility(table, visibility)\n}\n\n/**\n * Returns is all columns visible for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getIsAllColumnsVisible(table)\n * ```\n */\nexport function table_getIsAllColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return !table\n .getAllLeafColumns()\n .some(\n (column) =>\n !callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Returns is some columns visible for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getIsSomeColumnsVisible(table)\n * ```\n */\nexport function table_getIsSomeColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllLeafColumns()\n .some((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Returns an event handler for all columns visibility handler.\n *\n * The handler calls the matching table toggle API and can be attached directly to checkbox or button UI.\n *\n * @example\n * ```ts\n * const value = table_getToggleAllColumnsVisibilityHandler(table)\n * ```\n */\nexport function table_getToggleAllColumnsVisibilityHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllColumnsVisible(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,SAAgB,kCAAyD;CACvE,OAAO,EAAE;;;;;;;;;;;;AAaX,SAAgB,wBAId,QAAmD,SAAyB;CAC5E,IAAI,kBAAkB,OAAO,EAC3B,0BAA0B,OAAO,QAAQ,SAAS;EAChD,GAAG;GACF,OAAO,KACN,WACA,CAAC,mBAAmB,QAAQ,gBAAgB,oBAAoB;EACnE,EAAE;;;;;;;;;;;;AAcP,SAAgB,oBAId,QAA4D;;CAC5D,MAAM,eAAe,OAAO;CAC5B,QACG,aAAa,SACV,aAAa,MAAM,gBACjB,mBAAmB,aAAa,gBAAgB,oBAAoB,CACrE,4BACD,OAAO,MAAM,MAAM,iHAAkB,KAAK,gFAAG,OAAO,QAAQ;;;;;;;;;;;;AAcpE,SAAgB,kBAId,QAAmD;CACnD,QACG,OAAO,UAAU,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AoB,CAChE;;;;;;;;;;;;AAaL,SAAgB,2CAGd,OAAyC;CACzC,QAAQ,MAAe;EACrB,8BACE,OACE,EAAiB,OAA4B,QAChD"}
|
|
1
|
+
{"version":3,"file":"columnVisibilityFeature.utils.js","names":[],"sources":["../../../src/features/column-visibility/columnVisibilityFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn, cloneState } from '../../utils'\nimport { getDefaultColumnPinningState } from '../column-pinning/columnPinningFeature.utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Cell } from '../../types/Cell'\nimport type { Column_Internal } from '../../types/Column'\nimport type { ColumnVisibilityState } from './columnVisibilityFeature.types'\nimport type { Row } from '../../types/Row'\n\n/**\n * Creates the default column visibility state.\n *\n * The feature default is an empty object, where missing column ids are treated\n * as visible. Reset APIs use this value when `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const visibility = getDefaultColumnVisibilityState()\n * ```\n */\nexport function getDefaultColumnVisibilityState(): ColumnVisibilityState {\n return {}\n}\n\n/**\n * Updates this column's visibility when hiding is allowed.\n *\n * Passing `visible` stores that value. Omitting it flips the column's current\n * visibility state. Columns that cannot hide are left unchanged.\n *\n * @example\n * ```ts\n * column_toggleVisibility(column)\n * ```\n */\nexport function column_toggleVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>, visible?: boolean): void {\n if (column_getCanHide(column)) {\n table_setColumnVisibility(column.table, (old) => ({\n ...old,\n [column.id]:\n visible ??\n !callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n }))\n }\n}\n\n/**\n * Checks whether this column is visible.\n *\n * Leaf columns read `state.columnVisibility[column.id]`, where missing entries\n * default to visible. Parent columns are visible when at least one child column\n * is visible.\n *\n * @example\n * ```ts\n * const visible = column_getIsVisible(column)\n * ```\n */\nexport function column_getIsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): boolean {\n const childColumns = column.columns\n return (\n (childColumns.length\n ? childColumns.some((childColumn) =>\n callMemoOrStaticFn(childColumn, 'getIsVisible', column_getIsVisible),\n )\n : column.table.atoms.columnVisibility?.get()?.[column.id]) ?? true\n )\n}\n\n/**\n * Checks whether this column is allowed to be hidden.\n *\n * Both `columnDef.enableHiding` and table `enableHiding` default to `true`.\n *\n * @example\n * ```ts\n * const canHide = column_getCanHide(column)\n * ```\n */\nexport function column_getCanHide<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (\n (column.columnDef.enableHiding ?? true) &&\n (column.table.options.enableHiding ?? true)\n )\n}\n\n/**\n * Creates a checkbox-style handler that writes this column's visibility.\n *\n * The handler reads `event.target.checked`, so it is intended for visibility\n * controls whose checked state means \"visible\".\n *\n * @example\n * ```ts\n * const onChange = column_getToggleVisibilityHandler(column)\n * ```\n */\nexport function column_getToggleVisibilityHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (e: unknown) => {\n column_toggleVisibility(\n column,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n\n/**\n * Collects the cells from this row whose columns are visible.\n *\n * When column pinning is active, the result is ordered as left-pinned cells,\n * center cells, then right-pinned cells.\n *\n * @example\n * ```ts\n * const visibleCells = row_getVisibleCells(row)\n * ```\n */\nexport function row_getVisibleCells<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Array<Cell<TFeatures, TData, unknown>> {\n const allCells = row.getAllCells()\n const visibleCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < allCells.length; i++) {\n const cell = allCells[i]!\n if (callMemoOrStaticFn(cell.column, 'getIsVisible', column_getIsVisible)) {\n visibleCells.push(cell)\n }\n }\n\n const { left, right } =\n row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()\n if (!left.length && !right.length) return visibleCells // no pinning, return early\n\n const visibleCellsByColumnId = callMemoOrStaticFn(\n row,\n 'getVisibleCellsByColumnId',\n row_getVisibleCellsByColumnId,\n )\n\n const leftCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < left.length; i++) {\n const cell = visibleCellsByColumnId[left[i]!]\n if (cell) leftCells.push(cell)\n }\n\n const rightCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < right.length; i++) {\n const cell = visibleCellsByColumnId[right[i]!]\n if (cell) rightCells.push(cell)\n }\n\n // Center cells: visible cells in natural column order, minus pinned ones.\n const centerCells: Array<Cell<TFeatures, TData, unknown>> = []\n for (let i = 0; i < visibleCells.length; i++) {\n const cell = visibleCells[i]!\n const id = cell.column.id\n if (!left.includes(id) && !right.includes(id)) centerCells.push(cell)\n }\n\n return [...leftCells, ...centerCells, ...rightCells]\n}\n\n/**\n * Builds a lookup map of this row's visible cells keyed by column id.\n *\n * Hidden columns are omitted from the map.\n *\n * @example\n * ```ts\n * const visibleCellsById = row_getVisibleCellsByColumnId(row)\n * ```\n */\nexport function row_getVisibleCellsByColumnId<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): Record<string, Cell<TFeatures, TData, unknown>> {\n const result: Record<string, Cell<TFeatures, TData, unknown>> = {}\n const allCells = row.getAllCells()\n for (let i = 0; i < allCells.length; i++) {\n const cell = allCells[i]!\n if (callMemoOrStaticFn(cell.column, 'getIsVisible', column_getIsVisible)) {\n result[cell.column.id] = cell\n }\n }\n return result\n}\n\n/**\n * Filters the flat column list down to visible columns.\n *\n * Parent/group columns are included when `column_getIsVisible` considers them\n * visible.\n *\n * @example\n * ```ts\n * const columns = table_getVisibleFlatColumns(table)\n * ```\n */\nexport function table_getVisibleFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllFlatColumns()\n .filter((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Filters leaf columns down to those currently visible.\n *\n * This is the column list most row rendering code uses before pinning-specific\n * partitioning.\n *\n * @example\n * ```ts\n * const columns = table_getVisibleLeafColumns(table)\n * ```\n */\nexport function table_getVisibleLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllLeafColumns()\n .filter((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Routes a column visibility updater through the table's visibility change handler.\n *\n * The updater may be a next visibility map or a function of the previous map,\n * matching the instance `table.setColumnVisibility` behavior.\n *\n * @example\n * ```ts\n * table_setColumnVisibility(table, (old) => ({ ...old, age: false }))\n * ```\n */\nexport function table_setColumnVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<ColumnVisibilityState>,\n) {\n table.options.onColumnVisibilityChange?.(updater)\n}\n\n/**\n * Resets `columnVisibility` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.columnVisibility` when\n * it exists. Passing `true` ignores initial state and resets to `{}`.\n *\n * @example\n * ```ts\n * table_resetColumnVisibility(table)\n * table_resetColumnVisibility(table, true)\n * ```\n */\nexport function table_resetColumnVisibility<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setColumnVisibility(\n table,\n defaultState ? {} : cloneState(table.initialState.columnVisibility ?? {}),\n )\n}\n\n/**\n * Shows or hides every hideable leaf column.\n *\n * Columns that cannot hide stay visible when toggling all columns off.\n *\n * @example\n * ```ts\n * table_toggleAllColumnsVisible(table)\n * ```\n */\nexport function table_toggleAllColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, value?: boolean) {\n value = value ?? !table_getIsAllColumnsVisible(table)\n\n const visibility: Record<string, boolean> = {}\n const leafColumns = table.getAllLeafColumns()\n for (let i = 0; i < leafColumns.length; i++) {\n const column = leafColumns[i]!\n visibility[column.id] = !value ? !column_getCanHide(column) : value\n }\n\n table_setColumnVisibility(table, visibility)\n}\n\n/**\n * Checks whether every leaf column is currently visible.\n *\n * Non-hideable columns are naturally visible because missing visibility entries\n * default to `true`.\n *\n * @example\n * ```ts\n * const allVisible = table_getIsAllColumnsVisible(table)\n * ```\n */\nexport function table_getIsAllColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return !table\n .getAllLeafColumns()\n .some(\n (column) =>\n !callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Checks whether at least one leaf column is currently visible.\n *\n * This is useful for tri-state \"show all columns\" controls.\n *\n * @example\n * ```ts\n * const someVisible = table_getIsSomeColumnsVisible(table)\n * ```\n */\nexport function table_getIsSomeColumnsVisible<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return table\n .getAllLeafColumns()\n .some((column) =>\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible),\n )\n}\n\n/**\n * Creates a checkbox-style handler that shows or hides all columns.\n *\n * The handler reads `event.target.checked`, so it is intended for controls whose\n * checked state means \"all columns visible\".\n *\n * @example\n * ```ts\n * const onChange = table_getToggleAllColumnsVisibilityHandler(table)\n * ```\n */\nexport function table_getToggleAllColumnsVisibilityHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n return (e: unknown) => {\n table_toggleAllColumnsVisible(\n table,\n ((e as MouseEvent).target as HTMLInputElement).checked,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,SAAgB,kCAAyD;CACvE,OAAO,EAAE;;;;;;;;;;;;;AAc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AC9C,MAAM,cAAc,MAAM,mBAAmB;CAC7C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;EAC3C,MAAM,SAAS,YAAY;EAC3B,WAAW,OAAO,MAAM,CAAC,QAAQ,CAAC,kBAAkB,OAAO,GAAG;;CAGhE,0BAA0B,OAAO,WAAW;;;;;;;;;;;;;AAc9C,SAAgB,6BAGd,OAAyC;CACzC,OAAO,CAAC,MACL,mBAAmB,CACnB,MACE,WACC,CAAC,mBAAmB,QAAQ,gBAAgB,oBAAoB,CACnE;;;;;;;;;;;;AAaL,SAAgB,8BAGd,OAAyC;CACzC,OAAO,MACJ,mBAAmB,CACnB,MAAM,WACL,mBAAmB,QAAQ,gBAAgB,oBAAoB,CAChE;;;;;;;;;;;;;AAcL,SAAgB,2CAGd,OAAyC;CACzC,QAAQ,MAAe;EACrB,8BACE,OACE,EAAiB,OAA4B,QAChD"}
|
|
@@ -9,19 +9,22 @@ interface TableState_GlobalFiltering {
|
|
|
9
9
|
}
|
|
10
10
|
interface ColumnDef_GlobalFiltering {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Allows this column to be scanned by global filtering.
|
|
13
|
+
*
|
|
14
|
+
* Defaults to `true`; table-level global filtering and `enableFilters` must
|
|
15
|
+
* also allow filtering.
|
|
13
16
|
*/
|
|
14
17
|
enableGlobalFilter?: boolean;
|
|
15
18
|
}
|
|
16
19
|
interface Column_GlobalFiltering {
|
|
17
20
|
/**
|
|
18
|
-
*
|
|
21
|
+
* Checks whether this accessor column participates in global filtering.
|
|
19
22
|
*/
|
|
20
23
|
getCanGlobalFilter: () => boolean;
|
|
21
24
|
}
|
|
22
25
|
interface TableOptions_GlobalFiltering<TFeatures extends TableFeatures, TData extends RowData> {
|
|
23
26
|
/**
|
|
24
|
-
* Enables
|
|
27
|
+
* Enables global filtering across columns that allow it.
|
|
25
28
|
*/
|
|
26
29
|
enableGlobalFilter?: boolean;
|
|
27
30
|
/**
|
|
@@ -53,11 +56,13 @@ interface Table_GlobalFiltering<TFeatures extends TableFeatures, TData extends R
|
|
|
53
56
|
*/
|
|
54
57
|
getGlobalFilterFn: () => FilterFn<TFeatures, TData> | undefined;
|
|
55
58
|
/**
|
|
56
|
-
* Resets
|
|
59
|
+
* Resets `globalFilter` to `initialState.globalFilter`.
|
|
60
|
+
*
|
|
61
|
+
* Pass `true` to ignore initial state and reset to `undefined`.
|
|
57
62
|
*/
|
|
58
63
|
resetGlobalFilter: (defaultState?: boolean) => void;
|
|
59
64
|
/**
|
|
60
|
-
*
|
|
65
|
+
* Updates global filter state with a next value or updater function.
|
|
61
66
|
*/
|
|
62
67
|
setGlobalFilter: (updater: Updater<any>) => void;
|
|
63
68
|
}
|
|
@@ -9,19 +9,22 @@ interface TableState_GlobalFiltering {
|
|
|
9
9
|
}
|
|
10
10
|
interface ColumnDef_GlobalFiltering {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Allows this column to be scanned by global filtering.
|
|
13
|
+
*
|
|
14
|
+
* Defaults to `true`; table-level global filtering and `enableFilters` must
|
|
15
|
+
* also allow filtering.
|
|
13
16
|
*/
|
|
14
17
|
enableGlobalFilter?: boolean;
|
|
15
18
|
}
|
|
16
19
|
interface Column_GlobalFiltering {
|
|
17
20
|
/**
|
|
18
|
-
*
|
|
21
|
+
* Checks whether this accessor column participates in global filtering.
|
|
19
22
|
*/
|
|
20
23
|
getCanGlobalFilter: () => boolean;
|
|
21
24
|
}
|
|
22
25
|
interface TableOptions_GlobalFiltering<TFeatures extends TableFeatures, TData extends RowData> {
|
|
23
26
|
/**
|
|
24
|
-
* Enables
|
|
27
|
+
* Enables global filtering across columns that allow it.
|
|
25
28
|
*/
|
|
26
29
|
enableGlobalFilter?: boolean;
|
|
27
30
|
/**
|
|
@@ -53,11 +56,13 @@ interface Table_GlobalFiltering<TFeatures extends TableFeatures, TData extends R
|
|
|
53
56
|
*/
|
|
54
57
|
getGlobalFilterFn: () => FilterFn<TFeatures, TData> | undefined;
|
|
55
58
|
/**
|
|
56
|
-
* Resets
|
|
59
|
+
* Resets `globalFilter` to `initialState.globalFilter`.
|
|
60
|
+
*
|
|
61
|
+
* Pass `true` to ignore initial state and reset to `undefined`.
|
|
57
62
|
*/
|
|
58
63
|
resetGlobalFilter: (defaultState?: boolean) => void;
|
|
59
64
|
/**
|
|
60
|
-
*
|
|
65
|
+
* Updates global filter state with a next value or updater function.
|
|
61
66
|
*/
|
|
62
67
|
setGlobalFilter: (updater: Updater<any>) => void;
|
|
63
68
|
}
|