@tanstack/table-core 9.0.0-beta.54 → 9.0.0-beta.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/columns/constructColumn.js +3 -2
- package/dist/features/column-faceting/createFacetedRowModel.js +3 -2
- package/dist/features/column-filtering/createFilteredRowModel.js +3 -2
- package/dist/features/column-resizing/columnResizingFeature.utils.js +1 -1
- package/dist/types/ColumnDef.d.ts +1 -1
- package/dist/types/type-utils.d.ts +1 -1
- package/dist/worker/initTableWorker.js +1 -1
- package/package.json +1 -1
- package/skills/aggregation/SKILL.md +1 -1
- package/skills/api-not-found/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
|
@@ -22,10 +22,11 @@ function constructColumn(table, columnDef, depth, parent) {
|
|
|
22
22
|
...columnDef
|
|
23
23
|
};
|
|
24
24
|
const accessorKey = resolvedColumnDef.accessorKey;
|
|
25
|
-
const
|
|
25
|
+
const accessorKeyString = accessorKey === void 0 ? void 0 : String(accessorKey);
|
|
26
|
+
const id = resolvedColumnDef.id ?? accessorKeyString?.replaceAll(".", "_") ?? (typeof resolvedColumnDef.header === "string" ? resolvedColumnDef.header : void 0);
|
|
26
27
|
let accessorFn;
|
|
27
28
|
if (resolvedColumnDef.accessorFn) accessorFn = resolvedColumnDef.accessorFn;
|
|
28
|
-
else if (accessorKey) if (accessorKey.includes(".")) {
|
|
29
|
+
else if (accessorKey !== void 0) if (typeof accessorKey === "string" && accessorKey.includes(".")) {
|
|
29
30
|
const keys = accessorKey.split(".");
|
|
30
31
|
accessorFn = (originalRow) => {
|
|
31
32
|
let result = originalRow;
|
|
@@ -25,13 +25,14 @@ function createFacetedRowModel() {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
function _createFacetedRowModel(table, columnId, preRowModel, columnFilters, globalFilter) {
|
|
28
|
-
|
|
28
|
+
const hasGlobalFilter = globalFilter !== void 0 && globalFilter !== null && globalFilter !== "";
|
|
29
|
+
if (!preRowModel.rows.length || !columnFilters?.length && !hasGlobalFilter) return preRowModel;
|
|
29
30
|
const filterableIds = [];
|
|
30
31
|
if (columnFilters) for (let i = 0; i < columnFilters.length; i++) {
|
|
31
32
|
const id = columnFilters[i].id;
|
|
32
33
|
if (id !== columnId) filterableIds.push(id);
|
|
33
34
|
}
|
|
34
|
-
if (
|
|
35
|
+
if (hasGlobalFilter && columnId !== "__global__") filterableIds.push("__global__");
|
|
35
36
|
if (!filterableIds.length) return preRowModel;
|
|
36
37
|
const filterRowsImpl = (row) => {
|
|
37
38
|
for (let i = 0; i < filterableIds.length; i++) if (row.columnFilters?.[filterableIds[i]] === false) return false;
|
|
@@ -39,7 +39,8 @@ function _createFilteredRowModel(table) {
|
|
|
39
39
|
const rowModel = table.getPreFilteredRowModel();
|
|
40
40
|
const columnFilters = table.atoms.columnFilters?.get();
|
|
41
41
|
const globalFilter = table.atoms.globalFilter?.get();
|
|
42
|
-
|
|
42
|
+
const hasGlobalFilter = globalFilter !== void 0 && globalFilter !== null && globalFilter !== "";
|
|
43
|
+
if (!rowModel.rows.length || !columnFilters?.length && !hasGlobalFilter) {
|
|
43
44
|
const flatRows = rowModel.flatRows;
|
|
44
45
|
for (let i = 0; i < flatRows.length; i++) {
|
|
45
46
|
const row = flatRows[i];
|
|
@@ -64,7 +65,7 @@ function _createFilteredRowModel(table) {
|
|
|
64
65
|
const filterableIds = columnFilters?.map((d) => d.id) ?? [];
|
|
65
66
|
const globalFilterFn = table_getGlobalFilterFn(table);
|
|
66
67
|
const globallyFilterableColumns = table.getAllLeafColumns().filter((column) => column_getCanGlobalFilter(column));
|
|
67
|
-
if (
|
|
68
|
+
if (hasGlobalFilter && globalFilterFn && globallyFilterableColumns.length) {
|
|
68
69
|
filterableIds.push("__global__");
|
|
69
70
|
globallyFilterableColumns.forEach((column) => {
|
|
70
71
|
resolvedGlobalFilters.push({
|
|
@@ -144,7 +144,7 @@ function header_getResizeHandler(header, _contextDocument) {
|
|
|
144
144
|
}));
|
|
145
145
|
});
|
|
146
146
|
};
|
|
147
|
-
const contextDocument = _contextDocument || typeof document !== "undefined" ? document : null;
|
|
147
|
+
const contextDocument = _contextDocument || (typeof document !== "undefined" ? document : null);
|
|
148
148
|
const mouseEvents = {
|
|
149
149
|
moveHandler: (e) => onMove(e.clientX),
|
|
150
150
|
upHandler: (e) => {
|
|
@@ -118,7 +118,7 @@ type AccessorKeyColumnDef<TFeatures extends TableFeatures, TData extends RowData
|
|
|
118
118
|
type AccessorColumnDef<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = AccessorKeyColumnDef<TFeatures, TData, TValue> | AccessorFnColumnDef<TFeatures, TData, TValue>;
|
|
119
119
|
type ColumnDef<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = DisplayColumnDef<TFeatures, TData, TValue> | GroupColumnDef<TFeatures, TData, TValue> | AccessorColumnDef<TFeatures, TData, TValue>;
|
|
120
120
|
type ColumnDefResolved<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData> = Partial<UnionToIntersection<ColumnDef<TFeatures, TData, TValue>>> & {
|
|
121
|
-
accessorKey?: string;
|
|
121
|
+
accessorKey?: (string & {}) | keyof TData;
|
|
122
122
|
};
|
|
123
123
|
//#endregion
|
|
124
124
|
export { AccessorColumnDef, AccessorFn, AccessorFnColumnDef, AccessorFnColumnDefBase, AccessorKeyColumnDef, AccessorKeyColumnDefBase, ColumnDef, ColumnDefBase, ColumnDefBase_All, ColumnDefResolved, ColumnDefTemplate, ColumnDef_FeatureMap, ColumnMeta, DisplayColumnDef, ExtractColumnMeta, GroupColumnDef, IdIdentifier, IdentifiedColumnDef, StringHeaderIdentifier, StringOrTemplateHeader };
|
|
@@ -21,7 +21,7 @@ type IsTuple<T> = T extends ReadonlyArray<any> & {
|
|
|
21
21
|
type AllowedIndexes<Tuple extends ReadonlyArray<any>, Keys extends number = never> = Tuple extends readonly [] ? Keys : Tuple extends readonly [infer _, ...infer Tail] ? AllowedIndexes<Tail, Keys | Tail['length']> : Keys;
|
|
22
22
|
type DeepKeys<T, TDepth extends Array<any> = []> = TDepth['length'] extends 5 ? never : unknown extends T ? string : T extends ReadonlyArray<any> & IsTuple<T> ? AllowedIndexes<T> | DeepKeysPrefix<T, AllowedIndexes<T>, TDepth> : T extends Array<any> ? DeepKeys<T[number], [...TDepth, any]> : T extends Date ? never : T extends object ? (keyof T & string) | DeepKeysPrefix<T, keyof T, TDepth> : never;
|
|
23
23
|
type DeepKeysPrefix<T, TPrefix, TDepth extends Array<any>> = TPrefix extends keyof T & (number | string) ? `${TPrefix}.${DeepKeys<T[TPrefix], [...TDepth, any]> & string}` : never;
|
|
24
|
-
type DeepValue<T, TProp> = T extends Record<string | number, any> ? TProp extends `${infer TBranch}.${infer TDeepProp}` ? DeepValue<T[TBranch], TDeepProp> : T[TProp &
|
|
24
|
+
type DeepValue<T, TProp> = T extends Record<string | number, any> ? TProp extends `${infer TBranch}.${infer TDeepProp}` ? DeepValue<T[TBranch], TDeepProp> : T[TProp & keyof T] : never;
|
|
25
25
|
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
26
26
|
type Getter<TValue> = <TTValue = TValue>() => NoInfer<TTValue>;
|
|
27
27
|
type Prettify<T> = { [K in keyof T]: T[K] } & unknown;
|
|
@@ -54,7 +54,7 @@ function initTableWorker(config) {
|
|
|
54
54
|
},
|
|
55
55
|
data: message.data
|
|
56
56
|
});
|
|
57
|
-
aggregateColumnIds = flattenColumnDefs(config.columns).filter((def) => def.aggregationFn != null || def.aggregatedCell != null).map((def) => def.id ?? (
|
|
57
|
+
aggregateColumnIds = flattenColumnDefs(config.columns).filter((def) => def.aggregationFn != null || def.aggregatedCell != null).map((def) => def.id ?? (def.accessorKey === void 0 ? void 0 : String(def.accessorKey).replaceAll(".", "_"))).filter((id) => id != null);
|
|
58
58
|
} else table.setOptions((prev) => ({
|
|
59
59
|
...prev,
|
|
60
60
|
data: message.data
|
package/package.json
CHANGED
package/skills/core/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: >
|
|
|
5
5
|
metadata:
|
|
6
6
|
type: sub-skill
|
|
7
7
|
library: '@tanstack/table-core'
|
|
8
|
-
library_version: '9.0.0-beta.
|
|
8
|
+
library_version: '9.0.0-beta.55'
|
|
9
9
|
requires: ['core', 'table-features', 'typescript']
|
|
10
10
|
sources:
|
|
11
11
|
- 'TanStack/table:docs/framework/react/guide/custom-features.md'
|
package/skills/grouping/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: >
|
|
|
5
5
|
metadata:
|
|
6
6
|
type: lifecycle
|
|
7
7
|
library: '@tanstack/table-core'
|
|
8
|
-
library_version: '9.0.0-beta.
|
|
8
|
+
library_version: '9.0.0-beta.55'
|
|
9
9
|
requires: ['core', 'table-features', 'typescript']
|
|
10
10
|
sources:
|
|
11
11
|
- 'TanStack/table:docs/framework/react/guide/migrating.md'
|
package/skills/sorting/SKILL.md
CHANGED