@tanstack/table-core 9.1.1 → 9.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/cell-selection/cellSelectionFeature.utils.js +2 -2
- package/dist/features/column-filtering/columnFilteringFeature.utils.js +2 -2
- package/dist/features/column-grouping/columnGroupingFeature.utils.js +2 -2
- package/dist/features/column-ordering/columnOrderingFeature.utils.js +2 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.js +2 -2
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js +2 -2
- package/dist/features/row-expanding/rowExpandingFeature.utils.js +2 -2
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.js +8 -14
- package/dist/features/row-pinning/rowPinningFeature.utils.js +2 -2
- package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +3 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.js +5 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/utils.d.ts +37 -1
- package/dist/utils.js +81 -1
- package/package.json +1 -1
- package/skills/aggregation/SKILL.md +1 -1
- package/skills/api-not-found/SKILL.md +1 -1
- package/skills/cell-selection/SKILL.md +1 -1
- package/skills/cell-spanning/SKILL.md +1 -1
- package/skills/client-vs-server/SKILL.md +1 -1
- package/skills/column-faceting/SKILL.md +1 -1
- package/skills/column-filtering/SKILL.md +1 -1
- package/skills/column-ordering/SKILL.md +1 -1
- package/skills/column-pinning/SKILL.md +1 -1
- package/skills/column-resizing/SKILL.md +1 -1
- package/skills/column-sizing/SKILL.md +1 -1
- package/skills/column-visibility/SKILL.md +1 -1
- package/skills/core/SKILL.md +1 -1
- package/skills/custom-features/SKILL.md +1 -1
- package/skills/expanding/SKILL.md +1 -1
- package/skills/global-filtering/SKILL.md +1 -1
- package/skills/grouping/SKILL.md +1 -1
- package/skills/migrate-v8-to-v9/SKILL.md +1 -1
- package/skills/pagination/SKILL.md +1 -1
- package/skills/row-pinning/SKILL.md +1 -1
- package/skills/row-selection/SKILL.md +1 -1
- package/skills/sorting/SKILL.md +1 -1
- package/skills/table-features/SKILL.md +1 -1
- package/skills/typescript/SKILL.md +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { callMemoOrStaticFn, cloneState, makeObjectMap } from "../../utils.js";
|
|
1
|
+
import { callMemoOrStaticFn, cloneState, makeObjectMap, setStateSlice } from "../../utils.js";
|
|
2
2
|
import { table_getVisibleLeafColumns } from "../column-visibility/columnVisibilityFeature.utils.js";
|
|
3
3
|
import { applyCellSelectionBoundsOperations, expandCellSelectionBounds } from "./cellSelectionGeometry.js";
|
|
4
4
|
|
|
@@ -40,7 +40,7 @@ function table_setCellSelection(table, updater) {
|
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
42
|
function table_resetCellSelection(table, defaultState) {
|
|
43
|
-
|
|
43
|
+
setStateSlice(table, "cellSelection", defaultState ? getDefaultCellSelectionState() : cloneState(table.initialState.cellSelection) ?? getDefaultCellSelectionState());
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Schedules a cell selection reset after `data` changes.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cloneState, functionalUpdate, isFunction } from "../../utils.js";
|
|
1
|
+
import { cloneState, functionalUpdate, isFunction, setStateSlice } from "../../utils.js";
|
|
2
2
|
|
|
3
3
|
//#region src/features/column-filtering/columnFilteringFeature.utils.ts
|
|
4
4
|
/**
|
|
@@ -179,7 +179,7 @@ function table_setColumnFilters(table, updater) {
|
|
|
179
179
|
return true;
|
|
180
180
|
});
|
|
181
181
|
};
|
|
182
|
-
table
|
|
182
|
+
setStateSlice(table, "columnFilters", updateFn);
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* Resets `columnFilters` to the configured initial state or feature default.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cloneState, hasOwn } from "../../utils.js";
|
|
1
|
+
import { cloneState, hasOwn, setStateSlice } from "../../utils.js";
|
|
2
2
|
|
|
3
3
|
//#region src/features/column-grouping/columnGroupingFeature.utils.ts
|
|
4
4
|
/**
|
|
@@ -102,7 +102,7 @@ function column_getToggleGroupingHandler(column) {
|
|
|
102
102
|
* ```
|
|
103
103
|
*/
|
|
104
104
|
function table_setGrouping(table, updater) {
|
|
105
|
-
table
|
|
105
|
+
setStateSlice(table, "grouping", updater);
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* Resets `grouping` to the configured initial state or feature default.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { callMemoOrStaticFn, cloneState, makeObjectMap } from "../../utils.js";
|
|
1
|
+
import { callMemoOrStaticFn, cloneState, makeObjectMap, setStateSlice } from "../../utils.js";
|
|
2
2
|
import { table_getPinnedVisibleLeafColumns } from "../column-pinning/columnPinningFeature.utils.js";
|
|
3
3
|
|
|
4
4
|
//#region src/features/column-ordering/columnOrderingFeature.utils.ts
|
|
@@ -93,7 +93,7 @@ function column_getIsLastColumn(column, position) {
|
|
|
93
93
|
* ```
|
|
94
94
|
*/
|
|
95
95
|
function table_setColumnOrder(table, updater) {
|
|
96
|
-
table
|
|
96
|
+
setStateSlice(table, "columnOrder", updater);
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Resets `columnOrder` to the configured initial state or feature default.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { callMemoOrStaticFn, cloneState } from "../../utils.js";
|
|
1
|
+
import { callMemoOrStaticFn, cloneState, setStateSlice } from "../../utils.js";
|
|
2
2
|
import { column_getIsVisible, row_getVisibleCells, row_getVisibleCellsByColumnId, table_getVisibleLeafColumns } from "../column-visibility/columnVisibilityFeature.utils.js";
|
|
3
3
|
import { buildHeaderGroups } from "../../core/headers/buildHeaderGroups.js";
|
|
4
4
|
|
|
@@ -188,7 +188,7 @@ function row_getEndVisibleCells(row) {
|
|
|
188
188
|
* ```
|
|
189
189
|
*/
|
|
190
190
|
function table_setColumnPinning(table, updater) {
|
|
191
|
-
table
|
|
191
|
+
setStateSlice(table, "columnPinning", updater);
|
|
192
192
|
}
|
|
193
193
|
/**
|
|
194
194
|
* Resets `columnPinning` to the configured initial state or feature default.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { callMemoOrStaticFn, cloneState, hasOwn, makeObjectMap } from "../../utils.js";
|
|
1
|
+
import { callMemoOrStaticFn, cloneState, hasOwn, makeObjectMap, setStateSlice } from "../../utils.js";
|
|
2
2
|
import { getDefaultColumnPinningState } from "../column-pinning/columnPinningFeature.utils.js";
|
|
3
3
|
|
|
4
4
|
//#region src/features/column-visibility/columnVisibilityFeature.utils.ts
|
|
@@ -191,7 +191,7 @@ function table_getVisibleLeafColumns(table) {
|
|
|
191
191
|
* ```
|
|
192
192
|
*/
|
|
193
193
|
function table_setColumnVisibility(table, updater) {
|
|
194
|
-
table
|
|
194
|
+
setStateSlice(table, "columnVisibility", updater);
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
197
197
|
* Resets `columnVisibility` to the configured initial state or feature default.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cloneState, hasOwn, makeObjectMap } from "../../utils.js";
|
|
1
|
+
import { cloneState, hasOwn, makeObjectMap, setStateSlice } from "../../utils.js";
|
|
2
2
|
|
|
3
3
|
//#region src/features/row-expanding/rowExpandingFeature.utils.ts
|
|
4
4
|
/**
|
|
@@ -85,7 +85,7 @@ function table_toggleAllRowsExpanded(table, expanded) {
|
|
|
85
85
|
*/
|
|
86
86
|
function table_resetExpanded(table, defaultState) {
|
|
87
87
|
const initialExpanded = table.initialState.expanded;
|
|
88
|
-
|
|
88
|
+
setStateSlice(table, "expanded", defaultState ? makeObjectMap() : initialExpanded === true ? true : Object.assign(makeObjectMap(), cloneState(initialExpanded ?? {})));
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Checks whether at least one pre-paginated row can expand.
|
|
@@ -40,7 +40,7 @@ declare function table_autoResetPageIndex<TFeatures extends TableFeatures, TData
|
|
|
40
40
|
* table_setPagination(table, (old) => old)
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
declare function table_setPagination<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, updater: Updater<PaginationState>): void
|
|
43
|
+
declare function table_setPagination<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, updater: Updater<PaginationState>): void;
|
|
44
44
|
/**
|
|
45
45
|
* Resets `pagination` to the configured initial state or feature default.
|
|
46
46
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cloneState, functionalUpdate } from "../../utils.js";
|
|
1
|
+
import { cloneState, functionalUpdate, setStateSlice } from "../../utils.js";
|
|
2
2
|
|
|
3
3
|
//#region src/features/row-pagination/rowPaginationFeature.utils.ts
|
|
4
4
|
const defaultPageIndex = 0;
|
|
@@ -33,7 +33,10 @@ function getDefaultPaginationState() {
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
function table_autoResetPageIndex(table) {
|
|
36
|
-
if (table.options.autoResetAll ?? table.options.autoResetPageIndex ?? !table.options.manualPagination)
|
|
36
|
+
if (table.options.autoResetAll ?? table.options.autoResetPageIndex ?? !table.options.manualPagination) {
|
|
37
|
+
if ((table.atoms.pagination?.get()?.pageIndex ?? defaultPageIndex) === defaultPageIndex) return;
|
|
38
|
+
table_resetPageIndex(table, true);
|
|
39
|
+
}
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
39
42
|
* Routes a pagination updater through the table's pagination change handler.
|
|
@@ -48,10 +51,7 @@ function table_autoResetPageIndex(table) {
|
|
|
48
51
|
* ```
|
|
49
52
|
*/
|
|
50
53
|
function table_setPagination(table, updater) {
|
|
51
|
-
|
|
52
|
-
return functionalUpdate(updater, old);
|
|
53
|
-
};
|
|
54
|
-
return table.options.onPaginationChange?.(safeUpdater);
|
|
54
|
+
setStateSlice(table, "pagination", updater);
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Resets `pagination` to the configured initial state or feature default.
|
|
@@ -104,10 +104,7 @@ function table_setPageIndex(table, updater) {
|
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
106
106
|
function table_resetPageIndex(table, defaultState) {
|
|
107
|
-
|
|
108
|
-
const newPageIndex = defaultState ? defaultPageIndex : table.initialState.pagination?.pageIndex ?? defaultPageIndex;
|
|
109
|
-
if (newPageIndex === currentPageIndex) return;
|
|
110
|
-
table_setPageIndex(table, newPageIndex);
|
|
107
|
+
table_setPageIndex(table, defaultState ? defaultPageIndex : table.initialState.pagination?.pageIndex ?? defaultPageIndex);
|
|
111
108
|
}
|
|
112
109
|
/**
|
|
113
110
|
* Resets only `pagination.pageSize`.
|
|
@@ -122,10 +119,7 @@ function table_resetPageIndex(table, defaultState) {
|
|
|
122
119
|
* ```
|
|
123
120
|
*/
|
|
124
121
|
function table_resetPageSize(table, defaultState) {
|
|
125
|
-
|
|
126
|
-
const newPageSize = defaultState ? defaultPageSize : table.initialState.pagination?.pageSize ?? defaultPageSize;
|
|
127
|
-
if (newPageSize === currentPageSize) return;
|
|
128
|
-
table_setPageSize(table, newPageSize);
|
|
122
|
+
table_setPageSize(table, defaultState ? defaultPageSize : table.initialState.pagination?.pageSize ?? defaultPageSize);
|
|
129
123
|
}
|
|
130
124
|
/**
|
|
131
125
|
* Updates `pagination.pageSize` while preserving the current top row.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { callMemoOrStaticFn, cloneState } from "../../utils.js";
|
|
1
|
+
import { callMemoOrStaticFn, cloneState, setStateSlice } from "../../utils.js";
|
|
2
2
|
import { row_getIsAllParentsExpanded } from "../row-expanding/rowExpandingFeature.utils.js";
|
|
3
3
|
|
|
4
4
|
//#region src/features/row-pinning/rowPinningFeature.utils.ts
|
|
@@ -31,7 +31,7 @@ function getDefaultRowPinningState() {
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
function table_setRowPinning(table, updater) {
|
|
34
|
-
table
|
|
34
|
+
setStateSlice(table, "rowPinning", updater);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Resets `rowPinning` to the configured initial state or feature default.
|
|
@@ -20,7 +20,9 @@ declare function getDefaultSortingState(): SortingState;
|
|
|
20
20
|
* Routes a sorting updater through the table's sorting change handler.
|
|
21
21
|
*
|
|
22
22
|
* The updater may be a next `SortingState` array or a function of the previous
|
|
23
|
-
* sorting state, matching the instance `table.setSorting` behavior.
|
|
23
|
+
* sorting state, matching the instance `table.setSorting` behavior. State
|
|
24
|
+
* owners receive an equality-guarded updater so structurally equal sorting
|
|
25
|
+
* values preserve the owner's existing reference.
|
|
24
26
|
*
|
|
25
27
|
* @example
|
|
26
28
|
* ```ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cloneState, isFunction } from "../../utils.js";
|
|
1
|
+
import { cloneState, isFunction, setStateSlice } from "../../utils.js";
|
|
2
2
|
import { reSplitAlphaNumeric, sortFn_basic } from "./sortFns.js";
|
|
3
3
|
|
|
4
4
|
//#region src/features/row-sorting/rowSortingFeature.utils.ts
|
|
@@ -20,7 +20,9 @@ function getDefaultSortingState() {
|
|
|
20
20
|
* Routes a sorting updater through the table's sorting change handler.
|
|
21
21
|
*
|
|
22
22
|
* The updater may be a next `SortingState` array or a function of the previous
|
|
23
|
-
* sorting state, matching the instance `table.setSorting` behavior.
|
|
23
|
+
* sorting state, matching the instance `table.setSorting` behavior. State
|
|
24
|
+
* owners receive an equality-guarded updater so structurally equal sorting
|
|
25
|
+
* values preserve the owner's existing reference.
|
|
24
26
|
*
|
|
25
27
|
* @example
|
|
26
28
|
* ```ts
|
|
@@ -28,7 +30,7 @@ function getDefaultSortingState() {
|
|
|
28
30
|
* ```
|
|
29
31
|
*/
|
|
30
32
|
function table_setSorting(table, updater) {
|
|
31
|
-
table
|
|
33
|
+
setStateSlice(table, "sorting", updater);
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
36
|
* Resets `sorting` to the configured initial state or feature default.
|
package/dist/index.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ import { ColumnHelper, createColumnHelper } from "./helpers/columnHelper.js";
|
|
|
66
66
|
import { metaHelper } from "./helpers/metaHelper.js";
|
|
67
67
|
import { tableFeatures } from "./helpers/tableFeatures.js";
|
|
68
68
|
import { tableOptions } from "./helpers/tableOptions.js";
|
|
69
|
-
import { API, APIObject, PrototypeAPI, PrototypeAPIObject, assignPrototypeAPIs, assignTableAPIs, callMemoOrStaticFn, cloneState, copyInstancePropertiesWithoutMemos, flattenBy, functionalUpdate, getFunctionNameInfo, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, skipFirstRun, tableMemo } from "./utils.js";
|
|
69
|
+
import { API, APIObject, PrototypeAPI, PrototypeAPIObject, StateSliceEqualityFn, assignPrototypeAPIs, assignTableAPIs, callMemoOrStaticFn, cloneState, copyInstancePropertiesWithoutMemos, flattenBy, functionalUpdate, getFunctionNameInfo, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, setStateSlice, skipFirstRun, stateSlicesEqual, tableMemo } from "./utils.js";
|
|
70
70
|
import { constructCell } from "./core/cells/constructCell.js";
|
|
71
71
|
import { constructColumn } from "./core/columns/constructColumn.js";
|
|
72
72
|
import { buildHeaderGroups } from "./core/headers/buildHeaderGroups.js";
|
|
@@ -82,4 +82,4 @@ import { createGroupedRowModel } from "./features/column-grouping/createGroupedR
|
|
|
82
82
|
import { createExpandedRowModel, expandRows } from "./features/row-expanding/createExpandedRowModel.js";
|
|
83
83
|
import { createPaginatedRowModel } from "./features/row-pagination/createPaginatedRowModel.js";
|
|
84
84
|
import { createSortedRowModel } from "./features/row-sorting/createSortedRowModel.js";
|
|
85
|
-
export { API, APIObject, AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, AggregationContext, AggregationFnDef, AggregationFnDescriptor, AggregationFnListItem, AggregationFnOption, AggregationFnRef, AggregationFns, AggregationMergeContext, AggregationResult, AggregationResultOf, AggregationValueContext, AggregationValueOptions, AggregationValueResult, Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortFn, CachedRowModel_All, CachedRowModel_Core, CachedRowModel_Expanded, CachedRowModel_Faceted, CachedRowModel_Filtered, CachedRowModel_Grouped, CachedRowModel_Paginated, CachedRowModel_Sorted, CachedRowModels, CachedRowModels_FeatureMap, Cell, CellContext, CellData, CellSelectionBounds, CellSelectionDirection, CellSelectionEdges, CellSelectionRange, CellSelectionRangeMode, CellSelectionRangeOperation, CellSelectionState, CellSpanIndex, Cell_Cell, Cell_CellSelection, Cell_CellSpanning, Cell_ColumnGrouping, Cell_Core, Cell_CoreProperties, Cell_FeatureMap, Cell_RowAggregation, ColSpanContext, Column, ColumnAggregationValue, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_CellSelection, ColumnDef_CellSpanning, ColumnDef_ColumnFiltering, ColumnDef_ColumnGrouping, ColumnDef_ColumnPinning, ColumnDef_ColumnResizing, ColumnDef_ColumnSizing, ColumnDef_ColumnVisibility, ColumnDef_FeatureMap, ColumnDef_GlobalFiltering, ColumnDef_RowAggregation, ColumnDef_RowSorting, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnHelper, ColumnIndexes, ColumnMeta, ColumnOffsets, ColumnOffsetsByPosition, ColumnOrderDefaultOptions, ColumnOrderState, ColumnPinningDefaultOptions, ColumnPinningPosition, ColumnPinningState, ColumnResizeDirection, ColumnResizeMode, ColumnResizingDefaultOptions, ColumnSizingDefaultOptions, ColumnSizingState, ColumnSort, ColumnVisibilityState, Column_Column, Column_ColumnFaceting, Column_ColumnFiltering, Column_ColumnGrouping, Column_ColumnOrdering, Column_ColumnPinning, Column_ColumnResizing, Column_ColumnSizing, Column_ColumnVisibility, Column_Core, Column_CoreProperties, Column_FeatureMap, Column_GlobalFiltering, Column_RowAggregation, Column_RowSorting, CoreFeatures, CreatedFilterFn, CreatedSortFn, CustomAggregationFns, CustomFilterFns, CustomSortFns, DebugOptions, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, ExpandedStateList, ExternalAtoms, ExternalAtoms_All, ExtractAggregationFnKeys, ExtractColumnMeta, ExtractFeatureMapTypes, ExtractFilterFnKeys, ExtractFilterMeta, ExtractSortFnKeys, ExtractTableMeta, FeatureSlotPrereqs, FilterFn, FilterFnDef, FilterFnOption, FilterFns, FilterMeta, Getter, GroupColumnDef, GroupingColumnMode, GroupingState, Header, HeaderContext, HeaderGroup, HeaderGroup_Core, HeaderGroup_Header, Header_ColumnResizing, Header_ColumnSizing, Header_Core, Header_CoreProperties, Header_FeatureMap, Header_Header, IdIdentifier, IdentifiedColumnDef, IsAny, NoInfer, NonFeatureKeys, OnChangeFn, PaginationDefaultOptions, PaginationState, PartialKeys, Plugins, Prettify, PrototypeAPI, PrototypeAPIObject, RequiredKeys, ResolvedAggregationFn, ResolvedColumnFilter, Row, RowData, RowModel, RowModelFns, RowModelFns_All, RowModelFns_ColumnFiltering, RowModelFns_Core, RowModelFns_FeatureMap, RowModelFns_RowAggregation, RowModelFns_RowSorting, RowPinningDefaultOptions, RowPinningPosition, RowPinningState, RowSelectionState, RowSpanContext, Row_ColumnFiltering, Row_ColumnGrouping, Row_ColumnPinning, Row_ColumnVisibility, Row_Core, Row_CoreProperties, Row_FeatureMap, Row_Row, Row_RowAggregation, Row_RowExpanding, Row_RowPinning, Row_RowSelection, SelectCellRangeOptions, SortDirection, SortFn, SortFnDef, SortFnOption, SortFns, SortingState, StockFeatures, StringHeaderIdentifier, StringOrTemplateHeader, Table, TableFeature, TableFeatures, TableMeta, TableOptions, TableOptions_All, TableOptions_Cell, TableOptions_CellSelection, TableOptions_CellSpanning, TableOptions_ColumnFiltering, TableOptions_ColumnGrouping, TableOptions_ColumnOrdering, TableOptions_ColumnPinning, TableOptions_ColumnResizing, TableOptions_ColumnSizing, TableOptions_ColumnVisibility, TableOptions_Columns, TableOptions_Core, TableOptions_FeatureMap, TableOptions_GlobalFiltering, TableOptions_RowAggregation, TableOptions_RowExpanding, TableOptions_RowPagination, TableOptions_RowPinning, TableOptions_RowSelection, TableOptions_RowSorting, TableOptions_Rows, TableOptions_Table, TableState, TableState_All, TableState_CellSelection, TableState_ColumnFiltering, TableState_ColumnGrouping, TableState_ColumnOrdering, TableState_ColumnPinning, TableState_ColumnResizing, TableState_ColumnSizing, TableState_ColumnVisibility, TableState_FeatureMap, TableState_GlobalFiltering, TableState_RowExpanding, TableState_RowPagination, TableState_RowPinning, TableState_RowSelection, TableState_RowSorting, Table_CellSelection, Table_CellSpanning, Table_ColumnFaceting, Table_ColumnFiltering, Table_ColumnGrouping, Table_ColumnOrdering, Table_ColumnPinning, Table_ColumnResizing, Table_ColumnSizing, Table_ColumnVisibility, Table_Columns, Table_Core, Table_CoreProperties, Table_FeatureMap, Table_GlobalFiltering, Table_Headers, Table_RowExpanding, Table_RowModels, Table_RowModels_Core, Table_RowModels_Expanded, Table_RowModels_Faceted, Table_RowModels_Filtered, Table_RowModels_Grouped, Table_RowModels_Paginated, Table_RowModels_Sorted, Table_RowPagination, Table_RowPinning, Table_RowSelection, Table_RowSorting, Table_Rows, Table_Table, ToggleSelectedOptions, TransformDataValueFn, TransformFilterValueFn, UnionToIntersection, Updater, ValidateFeatureSlots, VisibilityDefaultOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_first, aggregationFn_last, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cellSelectionFeature, cellSpanningFeature, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnResizingState, columnSizingFeature, columnVisibilityFeature, constructAggregationFn, constructCell, constructColumn, constructFilterFn, constructHeader, constructRow, constructSortFn, constructTable, copyInstancePropertiesWithoutMemos, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_between, filterFn_betweenInclusive, filterFn_empty, filterFn_endsWith, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inDateRange, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_notEmpty, filterFn_startsWith, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, metaHelper, reSplitAlphaNumeric, rowAggregationFeature, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, skipFirstRun, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
|
|
85
|
+
export { API, APIObject, AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, AggregationContext, AggregationFnDef, AggregationFnDescriptor, AggregationFnListItem, AggregationFnOption, AggregationFnRef, AggregationFns, AggregationMergeContext, AggregationResult, AggregationResultOf, AggregationValueContext, AggregationValueOptions, AggregationValueResult, Atoms, Atoms_All, BaseAtoms, BaseAtoms_All, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortFn, CachedRowModel_All, CachedRowModel_Core, CachedRowModel_Expanded, CachedRowModel_Faceted, CachedRowModel_Filtered, CachedRowModel_Grouped, CachedRowModel_Paginated, CachedRowModel_Sorted, CachedRowModels, CachedRowModels_FeatureMap, Cell, CellContext, CellData, CellSelectionBounds, CellSelectionDirection, CellSelectionEdges, CellSelectionRange, CellSelectionRangeMode, CellSelectionRangeOperation, CellSelectionState, CellSpanIndex, Cell_Cell, Cell_CellSelection, Cell_CellSpanning, Cell_ColumnGrouping, Cell_Core, Cell_CoreProperties, Cell_FeatureMap, Cell_RowAggregation, ColSpanContext, Column, ColumnAggregationValue, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_CellSelection, ColumnDef_CellSpanning, ColumnDef_ColumnFiltering, ColumnDef_ColumnGrouping, ColumnDef_ColumnPinning, ColumnDef_ColumnResizing, ColumnDef_ColumnSizing, ColumnDef_ColumnVisibility, ColumnDef_FeatureMap, ColumnDef_GlobalFiltering, ColumnDef_RowAggregation, ColumnDef_RowSorting, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnHelper, ColumnIndexes, ColumnMeta, ColumnOffsets, ColumnOffsetsByPosition, ColumnOrderDefaultOptions, ColumnOrderState, ColumnPinningDefaultOptions, ColumnPinningPosition, ColumnPinningState, ColumnResizeDirection, ColumnResizeMode, ColumnResizingDefaultOptions, ColumnSizingDefaultOptions, ColumnSizingState, ColumnSort, ColumnVisibilityState, Column_Column, Column_ColumnFaceting, Column_ColumnFiltering, Column_ColumnGrouping, Column_ColumnOrdering, Column_ColumnPinning, Column_ColumnResizing, Column_ColumnSizing, Column_ColumnVisibility, Column_Core, Column_CoreProperties, Column_FeatureMap, Column_GlobalFiltering, Column_RowAggregation, Column_RowSorting, CoreFeatures, CreatedFilterFn, CreatedSortFn, CustomAggregationFns, CustomFilterFns, CustomSortFns, DebugOptions, DeepKeys, DeepValue, DisplayColumnDef, ExpandedState, ExpandedStateList, ExternalAtoms, ExternalAtoms_All, ExtractAggregationFnKeys, ExtractColumnMeta, ExtractFeatureMapTypes, ExtractFilterFnKeys, ExtractFilterMeta, ExtractSortFnKeys, ExtractTableMeta, FeatureSlotPrereqs, FilterFn, FilterFnDef, FilterFnOption, FilterFns, FilterMeta, Getter, GroupColumnDef, GroupingColumnMode, GroupingState, Header, HeaderContext, HeaderGroup, HeaderGroup_Core, HeaderGroup_Header, Header_ColumnResizing, Header_ColumnSizing, Header_Core, Header_CoreProperties, Header_FeatureMap, Header_Header, IdIdentifier, IdentifiedColumnDef, IsAny, NoInfer, NonFeatureKeys, OnChangeFn, PaginationDefaultOptions, PaginationState, PartialKeys, Plugins, Prettify, PrototypeAPI, PrototypeAPIObject, RequiredKeys, ResolvedAggregationFn, ResolvedColumnFilter, Row, RowData, RowModel, RowModelFns, RowModelFns_All, RowModelFns_ColumnFiltering, RowModelFns_Core, RowModelFns_FeatureMap, RowModelFns_RowAggregation, RowModelFns_RowSorting, RowPinningDefaultOptions, RowPinningPosition, RowPinningState, RowSelectionState, RowSpanContext, Row_ColumnFiltering, Row_ColumnGrouping, Row_ColumnPinning, Row_ColumnVisibility, Row_Core, Row_CoreProperties, Row_FeatureMap, Row_Row, Row_RowAggregation, Row_RowExpanding, Row_RowPinning, Row_RowSelection, SelectCellRangeOptions, SortDirection, SortFn, SortFnDef, SortFnOption, SortFns, SortingState, StateSliceEqualityFn, StockFeatures, StringHeaderIdentifier, StringOrTemplateHeader, Table, TableFeature, TableFeatures, TableMeta, TableOptions, TableOptions_All, TableOptions_Cell, TableOptions_CellSelection, TableOptions_CellSpanning, TableOptions_ColumnFiltering, TableOptions_ColumnGrouping, TableOptions_ColumnOrdering, TableOptions_ColumnPinning, TableOptions_ColumnResizing, TableOptions_ColumnSizing, TableOptions_ColumnVisibility, TableOptions_Columns, TableOptions_Core, TableOptions_FeatureMap, TableOptions_GlobalFiltering, TableOptions_RowAggregation, TableOptions_RowExpanding, TableOptions_RowPagination, TableOptions_RowPinning, TableOptions_RowSelection, TableOptions_RowSorting, TableOptions_Rows, TableOptions_Table, TableState, TableState_All, TableState_CellSelection, TableState_ColumnFiltering, TableState_ColumnGrouping, TableState_ColumnOrdering, TableState_ColumnPinning, TableState_ColumnResizing, TableState_ColumnSizing, TableState_ColumnVisibility, TableState_FeatureMap, TableState_GlobalFiltering, TableState_RowExpanding, TableState_RowPagination, TableState_RowPinning, TableState_RowSelection, TableState_RowSorting, Table_CellSelection, Table_CellSpanning, Table_ColumnFaceting, Table_ColumnFiltering, Table_ColumnGrouping, Table_ColumnOrdering, Table_ColumnPinning, Table_ColumnResizing, Table_ColumnSizing, Table_ColumnVisibility, Table_Columns, Table_Core, Table_CoreProperties, Table_FeatureMap, Table_GlobalFiltering, Table_Headers, Table_RowExpanding, Table_RowModels, Table_RowModels_Core, Table_RowModels_Expanded, Table_RowModels_Faceted, Table_RowModels_Filtered, Table_RowModels_Grouped, Table_RowModels_Paginated, Table_RowModels_Sorted, Table_RowPagination, Table_RowPinning, Table_RowSelection, Table_RowSorting, Table_Rows, Table_Table, ToggleSelectedOptions, TransformDataValueFn, TransformFilterValueFn, UnionToIntersection, Updater, ValidateFeatureSlots, VisibilityDefaultOptions, aggregationFn_count, aggregationFn_extent, aggregationFn_first, aggregationFn_last, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cellSelectionFeature, cellSpanningFeature, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnResizingState, columnSizingFeature, columnVisibilityFeature, constructAggregationFn, constructCell, constructColumn, constructFilterFn, constructHeader, constructRow, constructSortFn, constructTable, copyInstancePropertiesWithoutMemos, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_between, filterFn_betweenInclusive, filterFn_empty, filterFn_endsWith, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inDateRange, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_notEmpty, filterFn_startsWith, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, metaHelper, reSplitAlphaNumeric, rowAggregationFeature, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, setStateSlice, skipFirstRun, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stateSlicesEqual, stockFeatures, tableFeatures, tableMemo, tableOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assignPrototypeAPIs, assignTableAPIs, callMemoOrStaticFn, cloneState, copyInstancePropertiesWithoutMemos, flattenBy, functionalUpdate, getFunctionNameInfo, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, skipFirstRun, tableMemo } from "./utils.js";
|
|
1
|
+
import { assignPrototypeAPIs, assignTableAPIs, callMemoOrStaticFn, cloneState, copyInstancePropertiesWithoutMemos, flattenBy, functionalUpdate, getFunctionNameInfo, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, setStateSlice, skipFirstRun, stateSlicesEqual, tableMemo } from "./utils.js";
|
|
2
2
|
import { coreCellsFeature } from "./core/cells/coreCellsFeature.js";
|
|
3
3
|
import { constructHeader } from "./core/headers/constructHeader.js";
|
|
4
4
|
import { buildHeaderGroups } from "./core/headers/buildHeaderGroups.js";
|
|
@@ -48,4 +48,4 @@ import { createExpandedRowModel, expandRows } from "./features/row-expanding/cre
|
|
|
48
48
|
import { createPaginatedRowModel } from "./features/row-pagination/createPaginatedRowModel.js";
|
|
49
49
|
import { createSortedRowModel } from "./features/row-sorting/createSortedRowModel.js";
|
|
50
50
|
|
|
51
|
-
export { aggregationFn_count, aggregationFn_extent, aggregationFn_first, aggregationFn_last, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cellSelectionFeature, cellSpanningFeature, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnSizingFeature, columnVisibilityFeature, constructAggregationFn, constructCell, constructColumn, constructFilterFn, constructHeader, constructRow, constructSortFn, constructTable, copyInstancePropertiesWithoutMemos, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_between, filterFn_betweenInclusive, filterFn_empty, filterFn_endsWith, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inDateRange, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_notEmpty, filterFn_startsWith, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, metaHelper, reSplitAlphaNumeric, rowAggregationFeature, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, skipFirstRun, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stockFeatures, tableFeatures, tableMemo, tableOptions };
|
|
51
|
+
export { aggregationFn_count, aggregationFn_extent, aggregationFn_first, aggregationFn_last, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, aggregationFns, assignPrototypeAPIs, assignTableAPIs, buildHeaderGroups, callMemoOrStaticFn, cellSelectionFeature, cellSpanningFeature, cloneState, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnResizingFeature, columnSizingFeature, columnVisibilityFeature, constructAggregationFn, constructCell, constructColumn, constructFilterFn, constructHeader, constructRow, constructSortFn, constructTable, copyInstancePropertiesWithoutMemos, coreCellsFeature, coreColumnsFeature, coreFeatures, coreHeadersFeature, coreRowModelsFeature, coreRowsFeature, coreTablesFeature, createColumnHelper, createCoreRowModel, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, expandRows, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_between, filterFn_betweenInclusive, filterFn_empty, filterFn_endsWith, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inDateRange, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_notEmpty, filterFn_startsWith, filterFn_weakEquals, filterFns, flattenBy, functionalUpdate, getFunctionNameInfo, getInitialTableState, globalFilteringFeature, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, metaHelper, reSplitAlphaNumeric, rowAggregationFeature, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, setStateSlice, skipFirstRun, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, sortFns, stateSlicesEqual, stockFeatures, tableFeatures, tableMemo, tableOptions };
|
package/dist/utils.d.ts
CHANGED
|
@@ -43,6 +43,42 @@ declare function makeStateUpdater<TFeatures extends TableFeatures, K extends (st
|
|
|
43
43
|
};
|
|
44
44
|
readonly baseAtoms: object;
|
|
45
45
|
}): (updater: Updater<TableState<any>[K & keyof TableState<any>]>) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Structurally compares two state slice values as deeply as stock feature
|
|
48
|
+
* state can nest and no deeper.
|
|
49
|
+
*
|
|
50
|
+
* Three container levels cover flat maps and arrays, arrays of state objects,
|
|
51
|
+
* array-valued filter values, and `columnResizing.columnSizingStart` tuples.
|
|
52
|
+
* Deeper containers and non-plain values compare by reference. A `false`
|
|
53
|
+
* result is always safe: the state update simply proceeds.
|
|
54
|
+
*/
|
|
55
|
+
declare function stateSlicesEqual(a: unknown, b: unknown): boolean;
|
|
56
|
+
type StateSliceForKey<K extends string> = K extends keyof TableState<any> ? TableState<any>[K] : unknown;
|
|
57
|
+
type StateSliceEqualityFn<T> = (current: T, next: T) => boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Routes a state slice update through the slice's `on<State>Change` handler,
|
|
60
|
+
* preserving the owner's current reference for structural no-ops.
|
|
61
|
+
*
|
|
62
|
+
* Equality is evaluated inside the updater received by the state owner, never
|
|
63
|
+
* against the table's potentially stale controlled snapshot. This keeps
|
|
64
|
+
* same-tick updates composable in queued host containers such as React state,
|
|
65
|
+
* evaluates the original updater only when the owner applies it, and lets atom
|
|
66
|
+
* owners suppress notifications by returning their existing reference.
|
|
67
|
+
*
|
|
68
|
+
* A user-provided change handler is still invoked for a no-op because only that
|
|
69
|
+
* handler's state container can know its latest queued value. The guarded
|
|
70
|
+
* updater returns that container's previous reference, preventing a state write
|
|
71
|
+
* or render in state containers with identity bailout semantics.
|
|
72
|
+
*
|
|
73
|
+
* Hot-path slices that skip guarding entirely (selection maps that scale with
|
|
74
|
+
* row count, pointer-frequency resize state) call their change handler
|
|
75
|
+
* directly instead of routing through this util. Custom feature slices with a
|
|
76
|
+
* cheaper or semantic-aware comparison can pass `isEqual` to override the
|
|
77
|
+
* structural default.
|
|
78
|
+
*/
|
|
79
|
+
declare function setStateSlice<K extends (string & {}) | keyof TableState_All>(instance: {
|
|
80
|
+
readonly options: object;
|
|
81
|
+
}, key: K, updater: Updater<StateSliceForKey<K>>, isEqual?: StateSliceEqualityFn<StateSliceForKey<K>>): void;
|
|
46
82
|
type AnyFunction = (...args: any) => any;
|
|
47
83
|
/**
|
|
48
84
|
* Returns whether a value is a function.
|
|
@@ -126,4 +162,4 @@ declare function assignPrototypeAPIs<TFeatures extends TableFeatures, TData exte
|
|
|
126
162
|
*/
|
|
127
163
|
declare function callMemoOrStaticFn<TObject extends Record<string, any>, TArgs extends Array<any>, TReturn>(obj: TObject, fnKey: string, staticFn: (obj: TObject, ...args: TArgs) => TReturn, ...args: TArgs): TReturn;
|
|
128
164
|
//#endregion
|
|
129
|
-
export { API, APIObject, PrototypeAPI, PrototypeAPIObject, assignPrototypeAPIs, assignTableAPIs, callMemoOrStaticFn, cloneState, copyInstancePropertiesWithoutMemos, flattenBy, functionalUpdate, getFunctionNameInfo, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, skipFirstRun, tableMemo };
|
|
165
|
+
export { API, APIObject, PrototypeAPI, PrototypeAPIObject, StateSliceEqualityFn, assignPrototypeAPIs, assignTableAPIs, callMemoOrStaticFn, cloneState, copyInstancePropertiesWithoutMemos, flattenBy, functionalUpdate, getFunctionNameInfo, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, setStateSlice, skipFirstRun, stateSlicesEqual, tableMemo };
|
package/dist/utils.js
CHANGED
|
@@ -72,6 +72,86 @@ function makeStateUpdater(key, instance) {
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
+
* Checks whether a value is an array or a plain (or null-prototype) object.
|
|
76
|
+
* Class instances, dates, and other exotic values compare by reference only,
|
|
77
|
+
* mirroring the `cloneState` plain-object policy.
|
|
78
|
+
*/
|
|
79
|
+
function isPlainContainer(value) {
|
|
80
|
+
if (typeof value !== "object" || value === null) return false;
|
|
81
|
+
if (Array.isArray(value)) return true;
|
|
82
|
+
const proto = Object.getPrototypeOf(value);
|
|
83
|
+
return proto === Object.prototype || proto === null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Returns every enumerable own key, including symbols and non-index array
|
|
87
|
+
* properties. Keeping key presence explicit distinguishes sparse array holes
|
|
88
|
+
* from entries whose value is `undefined`.
|
|
89
|
+
*/
|
|
90
|
+
function getEnumerableOwnKeys(value) {
|
|
91
|
+
return Reflect.ownKeys(value).filter((key) => Object.prototype.propertyIsEnumerable.call(value, key));
|
|
92
|
+
}
|
|
93
|
+
const MAX_STATE_COMPARE_DEPTH = 3;
|
|
94
|
+
/**
|
|
95
|
+
* Structurally compares two state slice values as deeply as stock feature
|
|
96
|
+
* state can nest and no deeper.
|
|
97
|
+
*
|
|
98
|
+
* Three container levels cover flat maps and arrays, arrays of state objects,
|
|
99
|
+
* array-valued filter values, and `columnResizing.columnSizingStart` tuples.
|
|
100
|
+
* Deeper containers and non-plain values compare by reference. A `false`
|
|
101
|
+
* result is always safe: the state update simply proceeds.
|
|
102
|
+
*/
|
|
103
|
+
function stateSlicesEqual(a, b) {
|
|
104
|
+
return stateSlicesEqualAtDepth(a, b, MAX_STATE_COMPARE_DEPTH);
|
|
105
|
+
}
|
|
106
|
+
function stateSlicesEqualAtDepth(a, b, depth) {
|
|
107
|
+
if (Object.is(a, b)) return true;
|
|
108
|
+
if (depth <= 0 || !isPlainContainer(a) || !isPlainContainer(b)) return false;
|
|
109
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
110
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
|
|
111
|
+
}
|
|
112
|
+
const keysA = getEnumerableOwnKeys(a);
|
|
113
|
+
const keysB = getEnumerableOwnKeys(b);
|
|
114
|
+
if (keysA.length !== keysB.length) return false;
|
|
115
|
+
const recordA = a;
|
|
116
|
+
const recordB = b;
|
|
117
|
+
for (let i = 0; i < keysA.length; i++) {
|
|
118
|
+
const key = keysA[i];
|
|
119
|
+
if (!Object.prototype.propertyIsEnumerable.call(b, key)) return false;
|
|
120
|
+
if (!stateSlicesEqualAtDepth(recordA[key], recordB[key], depth - 1)) return false;
|
|
121
|
+
}
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Routes a state slice update through the slice's `on<State>Change` handler,
|
|
126
|
+
* preserving the owner's current reference for structural no-ops.
|
|
127
|
+
*
|
|
128
|
+
* Equality is evaluated inside the updater received by the state owner, never
|
|
129
|
+
* against the table's potentially stale controlled snapshot. This keeps
|
|
130
|
+
* same-tick updates composable in queued host containers such as React state,
|
|
131
|
+
* evaluates the original updater only when the owner applies it, and lets atom
|
|
132
|
+
* owners suppress notifications by returning their existing reference.
|
|
133
|
+
*
|
|
134
|
+
* A user-provided change handler is still invoked for a no-op because only that
|
|
135
|
+
* handler's state container can know its latest queued value. The guarded
|
|
136
|
+
* updater returns that container's previous reference, preventing a state write
|
|
137
|
+
* or render in state containers with identity bailout semantics.
|
|
138
|
+
*
|
|
139
|
+
* Hot-path slices that skip guarding entirely (selection maps that scale with
|
|
140
|
+
* row count, pointer-frequency resize state) call their change handler
|
|
141
|
+
* directly instead of routing through this util. Custom feature slices with a
|
|
142
|
+
* cheaper or semantic-aware comparison can pass `isEqual` to override the
|
|
143
|
+
* structural default.
|
|
144
|
+
*/
|
|
145
|
+
function setStateSlice(instance, key, updater, isEqual = stateSlicesEqual) {
|
|
146
|
+
const onChangeKey = `on${key.charAt(0).toUpperCase()}${key.slice(1)}Change`;
|
|
147
|
+
const onChange = instance.options[onChangeKey];
|
|
148
|
+
if (!onChange) return;
|
|
149
|
+
onChange((current) => {
|
|
150
|
+
const next = functionalUpdate(updater, current);
|
|
151
|
+
return isEqual(current, next) ? current : next;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
75
155
|
* Returns whether a value is a function.
|
|
76
156
|
*/
|
|
77
157
|
function isFunction(d) {
|
|
@@ -267,4 +347,4 @@ function callMemoOrStaticFn(obj, fnKey, staticFn, ...args) {
|
|
|
267
347
|
}
|
|
268
348
|
|
|
269
349
|
//#endregion
|
|
270
|
-
export { assignPrototypeAPIs, assignTableAPIs, callMemoOrStaticFn, cloneState, copyInstancePropertiesWithoutMemos, flattenBy, functionalUpdate, getFunctionNameInfo, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, skipFirstRun, tableMemo };
|
|
350
|
+
export { assignPrototypeAPIs, assignTableAPIs, callMemoOrStaticFn, cloneState, copyInstancePropertiesWithoutMemos, flattenBy, functionalUpdate, getFunctionNameInfo, hasOwn, isFunction, makeObjectMap, makeStateUpdater, memo, setStateSlice, skipFirstRun, stateSlicesEqual, tableMemo };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ name: aggregation
|
|
|
3
3
|
description: >
|
|
4
4
|
Aggregate TanStack Table columns independently of grouping, including grand totals, caller-selected row totals, multiple keyed aggregations, custom context-based definitions, grouped merges, manual values, and worker constraints.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/guide/aggregation.md'
|
|
@@ -3,7 +3,7 @@ name: cell-selection
|
|
|
3
3
|
description: >
|
|
4
4
|
Select, add, and subtract rectangular cell ranges with cellSelectionFeature: ordered include/exclude operations keyed by row and column id, modifier dragging, final positive bounds, selection edges, render-order resolution under pinning, and autoResetCellSelection. Load for spreadsheet-style selection, “select all except” behavior, unexpected range changes after sorting or reordering, drag performance, or copy-to-clipboard.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/cell-selection.md'
|
|
@@ -3,7 +3,7 @@ name: cell-spanning
|
|
|
3
3
|
description: >
|
|
4
4
|
Merge adjacent body cells with cellSpanningFeature: value-based rowSpan opt-in per column via spanRows, per-row colSpan via spanColumns, and the covered-cell convention where a span of 0 means skip the cell. Load for merged data grids, spans that disappear after sorting or paginating, ragged table rows, or a cell that unexpectedly merges down the whole tbody.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/cell-spanning.md'
|
|
@@ -3,7 +3,7 @@ name: column-faceting
|
|
|
3
3
|
description: >
|
|
4
4
|
Build faceted filter UIs with columnFacetingFeature, facetedRowModel, facetedUniqueValues, and facetedMinMaxValues. Load for facet counts, numeric ranges, own-filter exclusion, or server-page facet completeness.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features', 'column-filtering']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/column-faceting.md'
|
|
@@ -3,7 +3,7 @@ name: column-filtering
|
|
|
3
3
|
description: >
|
|
4
4
|
Filter columns with columnFilteringFeature, filteredRowModel, filterFns, filterMeta, nested-row direction, and manualFiltering. Load for accessor compatibility, controlled filter updaters, fuzzy metadata, or client/server ownership.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features', 'client-vs-server']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/column-filtering.md'
|
|
@@ -3,7 +3,7 @@ name: column-ordering
|
|
|
3
3
|
description: >
|
|
4
4
|
Control TanStack Table v9 leaf columnOrder with stable IDs while accounting for pinning regions, visibility, and groupedColumnMode precedence. Load for drag-and-drop columns or rendered order that differs from state.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/column-ordering.md'
|
|
@@ -3,7 +3,7 @@ name: column-pinning
|
|
|
3
3
|
description: >
|
|
4
4
|
Pin columns into logical start, center, and end regions with columnPinningFeature and renderer-owned sticky CSS. Load for RTL offsets, z-index, backgrounds, overflow, widths, gaps, or overlaps.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features', 'column-sizing']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/column-pinning.md'
|
|
@@ -3,7 +3,7 @@ name: column-resizing
|
|
|
3
3
|
description: >
|
|
4
4
|
Wire columnResizingFeature, header.getResizeHandler, resize mode and direction, pointer or touch events, and performant CSS-variable updates. Load when resize state changes but widths do not, or large tables resize slowly.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features', 'column-sizing']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/column-resizing.md'
|
|
@@ -3,7 +3,7 @@ name: column-sizing
|
|
|
3
3
|
description: >
|
|
4
4
|
Use columnSizingFeature numeric size, minSize, maxSize, getSize, getStart, getAfter, and total-size APIs in table, grid, or flex CSS. Load for auto or percentage misconceptions and sizing/pinning layout mismatch.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/column-sizing.md'
|
|
@@ -3,7 +3,7 @@ name: column-visibility
|
|
|
3
3
|
description: >
|
|
4
4
|
Hide columns with columnVisibilityFeature while rendering visibility-aware header, column, and cell collections. Load when hidden columns remain in the DOM, false-versus-absent state is confused, or enableHiding is misunderstood.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/column-visibility.md'
|
package/skills/core/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: expanding
|
|
|
3
3
|
description: >
|
|
4
4
|
Expand hierarchical subrows or custom detail panels with rowExpandingFeature, expandedRowModel, getSubRows, getRowCanExpand, manualExpanding, and paginateExpandedRows. Load when expansion state changes but no UI appears.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features', 'client-vs-server']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/expanding.md'
|
|
@@ -3,7 +3,7 @@ name: global-filtering
|
|
|
3
3
|
description: >
|
|
4
4
|
Apply globalFilter across eligible columns with globalFilteringFeature, columnFilteringFeature, filteredRowModel, globalFilterFn, and manual server filtering. Load when columns unexpectedly participate or a global filter changes state without changing rows.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features', 'client-vs-server', 'column-filtering']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/global-filtering.md'
|
package/skills/grouping/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: grouping
|
|
|
3
3
|
description: >
|
|
4
4
|
Group rows with columnGroupingFeature, groupedRowModel, groupedColumnMode, and manualGrouping. Load for grouped or placeholder cells and grouping interactions with expansion or pagination.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features', 'client-vs-server']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/grouping.md'
|
|
@@ -3,7 +3,7 @@ name: pagination
|
|
|
3
3
|
description: >
|
|
4
4
|
Paginate with rowPaginationFeature and paginatedRowModel or manualPagination. Load for pageIndex/pageSize state, rowCount/pageCount, unknown next-page limits, already-paginated server data, or autoResetPageIndex surprises.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features', 'client-vs-server']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/pagination.md'
|
|
@@ -3,7 +3,7 @@ name: row-pinning
|
|
|
3
3
|
description: >
|
|
4
4
|
Pin stable row IDs into top, center, and bottom collections with rowPinningFeature and keepPinnedRows. Load for filtering/pagination visibility, explicit region rendering, or renderer-owned sticky CSS.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/row-pinning.md'
|
|
@@ -3,7 +3,7 @@ name: row-selection
|
|
|
3
3
|
description: >
|
|
4
4
|
Maintain rowSelection ID state with stable getRowId, single, multi, subrow, and Shift-range rules, selected row models, handler anchors, and manual-pagination semantics. Load when implementing getToggleSelectedHandler, enableRowRangeSelection, selectChildren, deselectParents, or selected IDs that outlive loaded Row objects.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/row-selection.md'
|
package/skills/sorting/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: sorting
|
|
|
3
3
|
description: >
|
|
4
4
|
Sort with rowSortingFeature, sortedRowModel, sortFns, multi-sort and removal options, sortUndefined, and manualSorting. Load for comparator direction, incoming server order, or product-specific sorting cycles.
|
|
5
5
|
metadata:
|
|
6
|
-
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.
|
|
6
|
+
{ type: sub-skill, library: '@tanstack/table-core', library_version: '9.1.2' }
|
|
7
7
|
requires: ['core', 'table-features', 'client-vs-server']
|
|
8
8
|
sources:
|
|
9
9
|
- 'TanStack/table:docs/framework/react/guide/sorting.md'
|