@tanstack/table-core 8.2.5 → 8.3.1
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/build/cjs/columnHelper.js +62 -0
- package/build/cjs/columnHelper.js.map +1 -0
- package/build/cjs/core/cell.js.map +1 -1
- package/build/cjs/core/column.js +17 -3
- package/build/cjs/core/column.js.map +1 -1
- package/build/cjs/core/headers.js.map +1 -1
- package/build/cjs/core/table.js.map +1 -1
- package/build/cjs/features/Filters.js +1 -1
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/RowSelection.js +3 -2
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/index.js +2 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/utils.js +3 -0
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +71 -7
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1451 -106
- package/build/stats-react.json +333 -308
- package/build/types/index.d.ts +52 -32
- package/build/umd/index.development.js +71 -6
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/columnHelper.ts +74 -0
- package/src/core/cell.ts +17 -10
- package/src/core/column.ts +43 -34
- package/src/core/headers.ts +8 -6
- package/src/core/table.ts +9 -7
- package/src/features/Filters.ts +1 -1
- package/src/features/RowSelection.ts +5 -7
- package/src/index.ts +1 -0
- package/src/utils.ts +51 -1
package/build/types/index.d.ts
CHANGED
|
@@ -8,20 +8,23 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
+
declare type NoInfer$1<T> = [T][T extends any ? 0 : never];
|
|
12
|
+
declare type Getter<TValue> = <TTValue = TValue>() => NoInfer$1<TTValue>;
|
|
13
|
+
declare type CellContext<TData extends RowData, TValue> = {
|
|
14
|
+
table: Table<TData>;
|
|
15
|
+
column: Column<TData, TValue>;
|
|
16
|
+
row: Row<TData>;
|
|
17
|
+
cell: Cell<TData, TValue>;
|
|
18
|
+
getValue: Getter<TValue>;
|
|
19
|
+
renderValue: Getter<TValue | null>;
|
|
20
|
+
};
|
|
11
21
|
declare type CoreCell<TData extends RowData, TValue> = {
|
|
12
22
|
id: string;
|
|
13
|
-
getValue: <
|
|
14
|
-
renderValue: <
|
|
23
|
+
getValue: CellContext<TData, TValue>['getValue'];
|
|
24
|
+
renderValue: CellContext<TData, TValue>['renderValue'];
|
|
15
25
|
row: Row<TData>;
|
|
16
26
|
column: Column<TData, TValue>;
|
|
17
|
-
getContext: () =>
|
|
18
|
-
table: Table<TData>;
|
|
19
|
-
column: Column<TData, TValue>;
|
|
20
|
-
row: Row<TData>;
|
|
21
|
-
cell: Cell<TData, TValue>;
|
|
22
|
-
getValue: <TTValue = TValue>() => TTValue;
|
|
23
|
-
renderValue: <TTValue = TValue>() => TTValue | null;
|
|
24
|
-
};
|
|
27
|
+
getContext: () => CellContext<TData, TValue>;
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
declare type CoreHeaderGroup<TData extends RowData> = {
|
|
@@ -29,6 +32,11 @@ declare type CoreHeaderGroup<TData extends RowData> = {
|
|
|
29
32
|
depth: number;
|
|
30
33
|
headers: Header<TData, unknown>[];
|
|
31
34
|
};
|
|
35
|
+
declare type HeaderContext<TData, TValue> = {
|
|
36
|
+
table: Table<TData>;
|
|
37
|
+
header: Header<TData, TValue>;
|
|
38
|
+
column: Column<TData, TValue>;
|
|
39
|
+
};
|
|
32
40
|
declare type CoreHeader<TData extends RowData, TValue> = {
|
|
33
41
|
id: string;
|
|
34
42
|
index: number;
|
|
@@ -41,11 +49,7 @@ declare type CoreHeader<TData extends RowData, TValue> = {
|
|
|
41
49
|
getLeafHeaders: () => Header<TData, unknown>[];
|
|
42
50
|
isPlaceholder: boolean;
|
|
43
51
|
placeholderId?: string;
|
|
44
|
-
getContext: () =>
|
|
45
|
-
table: Table<TData>;
|
|
46
|
-
header: Header<TData, TValue>;
|
|
47
|
-
column: Column<TData, TValue>;
|
|
48
|
-
};
|
|
52
|
+
getContext: () => HeaderContext<TData, TValue>;
|
|
49
53
|
};
|
|
50
54
|
declare type HeadersInstance<TData extends RowData> = {
|
|
51
55
|
getHeaderGroups: () => HeaderGroup<TData>[];
|
|
@@ -68,12 +72,11 @@ declare type HeadersInstance<TData extends RowData> = {
|
|
|
68
72
|
declare const Headers: TableFeature;
|
|
69
73
|
declare function buildHeaderGroups<TData extends RowData>(allColumns: Column<TData, unknown>[], columnsToGroup: Column<TData, unknown>[], table: Table<TData>, headerFamily?: 'center' | 'left' | 'right'): HeaderGroup<TData>[];
|
|
70
74
|
|
|
71
|
-
declare type CoreColumnDefType = 'data' | 'display' | 'group';
|
|
72
75
|
declare type CoreColumnDefBase<TData extends RowData, TValue> = {
|
|
73
|
-
columns?: ColumnDef<TData>[];
|
|
74
|
-
header?: ColumnDefTemplate<
|
|
75
|
-
footer?: ColumnDefTemplate<
|
|
76
|
-
cell?: ColumnDefTemplate<
|
|
76
|
+
columns?: ColumnDef<TData, unknown>[];
|
|
77
|
+
header?: ColumnDefTemplate<HeaderContext<TData, TValue>>;
|
|
78
|
+
footer?: ColumnDefTemplate<HeaderContext<TData, TValue>>;
|
|
79
|
+
cell?: ColumnDefTemplate<CellContext<TData, TValue>>;
|
|
77
80
|
meta?: ColumnMeta;
|
|
78
81
|
};
|
|
79
82
|
declare type CoreColumnDefDisplay<TData extends RowData, TValue> = CoreColumnDefBase<TData, TValue> & {
|
|
@@ -83,27 +86,29 @@ declare type CoreColumnDefDisplayWithStringHeader<TData extends RowData, TValue>
|
|
|
83
86
|
header: string;
|
|
84
87
|
id?: string;
|
|
85
88
|
};
|
|
86
|
-
declare type CoreColumnDefAccessorFn<TData extends RowData, TValue
|
|
89
|
+
declare type CoreColumnDefAccessorFn<TData extends RowData, TValue> = CoreColumnDefBase<TData, TValue> & {
|
|
87
90
|
accessorFn: AccessorFn<TData, TValue>;
|
|
88
91
|
id: string;
|
|
89
92
|
};
|
|
90
93
|
declare type CoreColumnDefAccessorKey<TData extends RowData, TValue> = CoreColumnDefBase<TData, TValue> & {
|
|
91
|
-
accessorKey:
|
|
94
|
+
accessorKey: DeepKeys<TData>;
|
|
92
95
|
id?: string;
|
|
93
96
|
};
|
|
94
|
-
declare type CoreColumnDef<TData extends RowData, TValue> = CoreColumnDefDisplay<TData, TValue> | CoreColumnDefDisplayWithStringHeader<TData, TValue> | CoreColumnDefAccessorFn<TData> | CoreColumnDefAccessorKey<TData, TValue>;
|
|
95
|
-
declare type CoreColumnDefResolved<TData extends RowData, TValue = unknown> = Partial<UnionToIntersection<CoreColumnDef<TData, TValue
|
|
97
|
+
declare type CoreColumnDef<TData extends RowData, TValue> = CoreColumnDefDisplay<TData, TValue> | CoreColumnDefDisplayWithStringHeader<TData, TValue> | CoreColumnDefAccessorFn<TData, TValue> | CoreColumnDefAccessorKey<TData, TValue>;
|
|
98
|
+
declare type CoreColumnDefResolved<TData extends RowData, TValue = unknown> = Partial<UnionToIntersection<CoreColumnDef<TData, TValue>>> & {
|
|
99
|
+
accessorKey?: string;
|
|
100
|
+
};
|
|
96
101
|
declare type CoreColumn<TData extends RowData, TValue> = {
|
|
97
102
|
id: string;
|
|
98
103
|
depth: number;
|
|
99
104
|
accessorFn?: AccessorFn<TData, TValue>;
|
|
100
|
-
columnDef: ColumnDef<TData>;
|
|
105
|
+
columnDef: ColumnDef<TData, TValue>;
|
|
101
106
|
columns: Column<TData, TValue>[];
|
|
102
107
|
parent?: Column<TData, TValue>;
|
|
103
108
|
getFlatColumns: () => Column<TData, TValue>[];
|
|
104
109
|
getLeafColumns: () => Column<TData, TValue>[];
|
|
105
110
|
};
|
|
106
|
-
declare function createColumn<TData extends RowData, TValue>(table: Table<TData>, columnDef: ColumnDef<TData>, depth: number, parent?: Column<TData, TValue>): Column<TData, TValue>;
|
|
111
|
+
declare function createColumn<TData extends RowData, TValue>(table: Table<TData>, columnDef: ColumnDef<TData, TValue>, depth: number, parent?: Column<TData, TValue>): Column<TData, TValue>;
|
|
107
112
|
|
|
108
113
|
declare type VisibilityState = Record<string, boolean>;
|
|
109
114
|
declare type VisibilityTableState = {
|
|
@@ -669,7 +674,17 @@ declare type Overwrite<T, U extends {
|
|
|
669
674
|
[TKey in keyof T]?: any;
|
|
670
675
|
}> = Omit<T, keyof U> & U;
|
|
671
676
|
declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
|
|
672
|
-
declare type
|
|
677
|
+
declare type IsAny<T, Y, N> = 1 extends 0 & T ? Y : N;
|
|
678
|
+
declare type IsKnown<T, Y, N> = unknown extends T ? N : Y;
|
|
679
|
+
declare type ComputeRange<N extends number, Result extends Array<unknown> = []> = Result['length'] extends N ? Result : ComputeRange<N, [...Result, Result['length']]>;
|
|
680
|
+
declare type Index100 = ComputeRange<100>[number];
|
|
681
|
+
declare type IsTuple<T> = T extends readonly any[] & {
|
|
682
|
+
length: infer Length;
|
|
683
|
+
} ? Length extends Index100 ? T : never : never;
|
|
684
|
+
declare 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;
|
|
685
|
+
declare type DeepKeys<T> = unknown extends T ? keyof T : object extends T ? string : T extends readonly any[] & IsTuple<T> ? AllowedIndexes<T> | DeepKeysPrefix<T, AllowedIndexes<T>> : T extends any[] ? never & 'Dynamic length array indexing is not supported' : T extends object ? (keyof T & string) | DeepKeysPrefix<T, keyof T> : never;
|
|
686
|
+
declare type DeepKeysPrefix<T, TPrefix> = TPrefix extends keyof T & (number | string) ? `${TPrefix}.${DeepKeys<T[TPrefix]> & string}` : never;
|
|
687
|
+
declare type DeepValue<T, TProp> = T extends Record<string | number, any> ? TProp extends `${infer TBranch}.${infer TDeepProp}` ? DeepValue<T[TBranch], TDeepProp> : T[TProp & string] : never;
|
|
673
688
|
declare function functionalUpdate<T>(updater: Updater<T>, input: T): T;
|
|
674
689
|
declare function noop(): void;
|
|
675
690
|
declare function makeStateUpdater<K extends keyof TableState>(key: K, instance: unknown): (updater: Updater<TableState[K]>) => void;
|
|
@@ -709,8 +724,8 @@ declare type CoreOptions<TData extends RowData> = {
|
|
|
709
724
|
getCoreRowModel: (table: Table<any>) => () => RowModel<any>;
|
|
710
725
|
getSubRows?: (originalRow: TData, index: number) => undefined | TData[];
|
|
711
726
|
getRowId?: (originalRow: TData, index: number, parent?: Row<TData>) => string;
|
|
712
|
-
columns: ColumnDef<TData>[];
|
|
713
|
-
defaultColumn?: Partial<ColumnDef<TData>>;
|
|
727
|
+
columns: ColumnDef<TData, any>[];
|
|
728
|
+
defaultColumn?: Partial<ColumnDef<TData, unknown>>;
|
|
714
729
|
renderFallbackValue: any;
|
|
715
730
|
};
|
|
716
731
|
declare type CoreInstance<TData extends RowData> = {
|
|
@@ -727,8 +742,8 @@ declare type CoreInstance<TData extends RowData> = {
|
|
|
727
742
|
_getCoreRowModel?: () => RowModel<TData>;
|
|
728
743
|
getRowModel: () => RowModel<TData>;
|
|
729
744
|
getRow: (id: string) => Row<TData>;
|
|
730
|
-
_getDefaultColumnDef: () => Partial<ColumnDef<TData>>;
|
|
731
|
-
_getColumnDefs: () => ColumnDef<TData>[];
|
|
745
|
+
_getDefaultColumnDef: () => Partial<ColumnDef<TData, unknown>>;
|
|
746
|
+
_getColumnDefs: () => ColumnDef<TData, unknown>[];
|
|
732
747
|
_getAllFlatColumnsById: () => Record<string, Column<TData, unknown>>;
|
|
733
748
|
getAllColumns: () => Column<TData, unknown>[];
|
|
734
749
|
getAllFlatColumns: () => Column<TData, unknown>[];
|
|
@@ -737,6 +752,11 @@ declare type CoreInstance<TData extends RowData> = {
|
|
|
737
752
|
};
|
|
738
753
|
declare function createTable<TData extends RowData>(options: TableOptionsResolved<TData>): Table<TData>;
|
|
739
754
|
|
|
755
|
+
declare type ColumnHelper<TData extends RowData> = {
|
|
756
|
+
accessor: <TAccessor extends AccessorFn<TData> | DeepKeys<TData>, TValue extends TAccessor extends AccessorFn<TData, infer TReturn> ? TReturn : TAccessor extends DeepKeys<TData> ? DeepValue<TData, TAccessor> : never>(accessor: TAccessor, column: Omit<ColumnDef<TData, TValue>, 'accessorKey'>) => ColumnDef<TData, TValue>;
|
|
757
|
+
};
|
|
758
|
+
declare function createColumnHelper<TData extends RowData>(): ColumnHelper<TData>;
|
|
759
|
+
|
|
740
760
|
declare function getCoreRowModel<TData extends RowData>(): (table: Table<TData>) => () => RowModel<TData>;
|
|
741
761
|
|
|
742
762
|
declare function getFilteredRowModel<TData extends RowData>(): (table: Table<TData>) => () => RowModel<TData>;
|
|
@@ -762,4 +782,4 @@ declare function getPaginationRowModel<TData extends RowData>(opts?: {
|
|
|
762
782
|
initialSync: boolean;
|
|
763
783
|
}): (table: Table<TData>) => () => RowModel<TData>;
|
|
764
784
|
|
|
765
|
-
export { AccessorFn, AggregationFn, AggregationFnOption, AnyRender, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortingFn, Cell, Column, ColumnDef, ColumnDefTemplate, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnMeta, ColumnOrderDefaultOptions, ColumnOrderInstance, ColumnOrderOptions, ColumnOrderState, ColumnOrderTableState, ColumnPinningColumn, ColumnPinningColumnDef, ColumnPinningDefaultOptions, ColumnPinningInstance, ColumnPinningOptions, ColumnPinningPosition, ColumnPinningRow, ColumnPinningState, ColumnPinningTableState, ColumnResizeMode, ColumnSizing, ColumnSizingColumn, ColumnSizingColumnDef, ColumnSizingDefaultOptions, ColumnSizingHeader, ColumnSizingInfoState, ColumnSizingInstance, ColumnSizingOptions, ColumnSizingState, ColumnSizingTableState, ColumnSort, CoreColumn, CoreColumnDef,
|
|
785
|
+
export { AccessorFn, AggregationFn, AggregationFnOption, AnyRender, BuiltInAggregationFn, BuiltInFilterFn, BuiltInSortingFn, Cell, Column, ColumnDef, ColumnDefTemplate, ColumnDefaultOptions, ColumnFilter, ColumnFilterAutoRemoveTestFn, ColumnFiltersState, ColumnHelper, ColumnMeta, ColumnOrderDefaultOptions, ColumnOrderInstance, ColumnOrderOptions, ColumnOrderState, ColumnOrderTableState, ColumnPinningColumn, ColumnPinningColumnDef, ColumnPinningDefaultOptions, ColumnPinningInstance, ColumnPinningOptions, ColumnPinningPosition, ColumnPinningRow, ColumnPinningState, ColumnPinningTableState, ColumnResizeMode, ColumnSizing, ColumnSizingColumn, ColumnSizingColumnDef, ColumnSizingDefaultOptions, ColumnSizingHeader, ColumnSizingInfoState, ColumnSizingInstance, ColumnSizingOptions, ColumnSizingState, ColumnSizingTableState, ColumnSort, CoreColumn, CoreColumnDef, CoreColumnDefAccessorFn, CoreColumnDefAccessorKey, CoreColumnDefBase, CoreColumnDefDisplay, CoreColumnDefDisplayWithStringHeader, CoreColumnDefResolved, CoreHeader, CoreHeaderGroup, CoreInstance, CoreOptions, CoreRow, CoreTableState, CustomAggregationFns, CustomFilterFns, CustomSortingFns, DeepKeys, DeepValue, ExpandedInstance, ExpandedOptions, ExpandedRow, ExpandedState, ExpandedStateList, ExpandedTableState, Expanding, FilterFn, FilterFnOption, FilterMeta, Filters, FiltersColumn, FiltersColumnDef, FiltersInstance, FiltersOptions, FiltersRow, FiltersTableState, Grouping, GroupingCell, GroupingColumn, GroupingColumnDef, GroupingColumnMode, GroupingInstance, GroupingOptions, GroupingRow, GroupingState, GroupingTableState, Header, HeaderContext, HeaderGroup, Headers, HeadersInstance, InitialTableState, IsAny, IsKnown, NoInfer, OnChangeFn, Ordering, Overwrite, Pagination, PaginationDefaultOptions, PaginationInitialTableState, PaginationInstance, PaginationOptions, PaginationState, PaginationTableState, PartialKeys, Pinning, RequiredKeys, ResolvedColumnFilter, Row, RowData, RowModel, RowSelection, RowSelectionInstance, RowSelectionOptions, RowSelectionRow, RowSelectionState, RowSelectionTableState, SortDirection, Sorting, SortingColumn, SortingColumnDef, SortingFn, SortingFnOption, SortingInstance, SortingOptions, SortingState, SortingTableState, Table, TableFeature, TableGenerics, TableMeta, TableOptions, TableOptionsResolved, TableState, TransformFilterValueFn, UnionToIntersection, Updater, Visibility, VisibilityColumn, VisibilityColumnDef, VisibilityDefaultOptions, VisibilityInstance, VisibilityOptions, VisibilityRow, VisibilityState, VisibilityTableState, aggregationFns, buildHeaderGroups, createColumn, createColumnHelper, createRow, createTable, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, isFunction, isRowSelected, isSubRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, selectRowsFn, shouldAutoRemoveFilter, sortingFns };
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TableCore = {}));
|
|
15
15
|
})(this, (function (exports) { 'use strict';
|
|
16
16
|
|
|
17
|
+
// Is this type a tuple?
|
|
18
|
+
// If this type is a tuple, what indices are allowed?
|
|
19
|
+
///
|
|
17
20
|
function functionalUpdate(updater, input) {
|
|
18
21
|
return typeof updater === 'function' ? updater(input) : updater;
|
|
19
22
|
}
|
|
@@ -99,13 +102,27 @@
|
|
|
99
102
|
const resolvedColumnDef = { ...defaultColumn,
|
|
100
103
|
...columnDef
|
|
101
104
|
};
|
|
102
|
-
|
|
105
|
+
const accessorKey = resolvedColumnDef.accessorKey;
|
|
106
|
+
let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? accessorKey.replace('.', '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
|
|
103
107
|
let accessorFn;
|
|
104
108
|
|
|
105
109
|
if (resolvedColumnDef.accessorFn) {
|
|
106
110
|
accessorFn = resolvedColumnDef.accessorFn;
|
|
107
|
-
} else if (
|
|
108
|
-
|
|
111
|
+
} else if (accessorKey) {
|
|
112
|
+
// Support deep accessor keys
|
|
113
|
+
if (accessorKey.includes('.')) {
|
|
114
|
+
accessorFn = originalRow => {
|
|
115
|
+
let result = originalRow;
|
|
116
|
+
|
|
117
|
+
for (const key of accessorKey.split('.')) {
|
|
118
|
+
result = result[key];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return result;
|
|
122
|
+
};
|
|
123
|
+
} else {
|
|
124
|
+
accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];
|
|
125
|
+
}
|
|
109
126
|
}
|
|
110
127
|
|
|
111
128
|
if (!id) {
|
|
@@ -1099,7 +1116,7 @@
|
|
|
1099
1116
|
var _table$getCoreRowMode, _table$getCoreRowMode2;
|
|
1100
1117
|
|
|
1101
1118
|
const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue();
|
|
1102
|
-
return typeof value === 'string';
|
|
1119
|
+
return typeof value === 'string' || typeof value === 'number';
|
|
1103
1120
|
}
|
|
1104
1121
|
};
|
|
1105
1122
|
},
|
|
@@ -2131,7 +2148,7 @@
|
|
|
2131
2148
|
let isAllRowsSelected = Boolean(preFilteredFlatRows.length && Object.keys(rowSelection).length);
|
|
2132
2149
|
|
|
2133
2150
|
if (isAllRowsSelected) {
|
|
2134
|
-
if (preFilteredFlatRows.some(row => !rowSelection[row.id])) {
|
|
2151
|
+
if (preFilteredFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
|
|
2135
2152
|
isAllRowsSelected = false;
|
|
2136
2153
|
}
|
|
2137
2154
|
}
|
|
@@ -2154,7 +2171,8 @@
|
|
|
2154
2171
|
getIsSomeRowsSelected: () => {
|
|
2155
2172
|
var _table$getState$rowSe;
|
|
2156
2173
|
|
|
2157
|
-
|
|
2174
|
+
const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
|
|
2175
|
+
return totalSelected < table.getCoreRowModel().flatRows.length;
|
|
2158
2176
|
},
|
|
2159
2177
|
getIsSomePageRowsSelected: () => {
|
|
2160
2178
|
const paginationFlatRows = table.getPaginationRowModel().flatRows;
|
|
@@ -3091,6 +3109,52 @@
|
|
|
3091
3109
|
return row;
|
|
3092
3110
|
};
|
|
3093
3111
|
|
|
3112
|
+
// type Person = {
|
|
3113
|
+
// firstName: string
|
|
3114
|
+
// lastName: string
|
|
3115
|
+
// age: number
|
|
3116
|
+
// visits: number
|
|
3117
|
+
// status: string
|
|
3118
|
+
// progress: number
|
|
3119
|
+
// nested: {
|
|
3120
|
+
// foo: [
|
|
3121
|
+
// {
|
|
3122
|
+
// bar: 'bar'
|
|
3123
|
+
// }
|
|
3124
|
+
// ]
|
|
3125
|
+
// bar: { subBar: boolean }[]
|
|
3126
|
+
// baz: {
|
|
3127
|
+
// foo: 'foo'
|
|
3128
|
+
// bar: {
|
|
3129
|
+
// baz: 'baz'
|
|
3130
|
+
// }
|
|
3131
|
+
// }
|
|
3132
|
+
// }
|
|
3133
|
+
// }
|
|
3134
|
+
// const test: DeepKeys<Person> = 'nested.foo.0.bar'
|
|
3135
|
+
// const test2: DeepKeys<Person> = 'nested.bar'
|
|
3136
|
+
// const helper = createColumnHelper<Person>()
|
|
3137
|
+
// helper.accessor('nested.foo', {
|
|
3138
|
+
// cell: info => info.getValue(),
|
|
3139
|
+
// })
|
|
3140
|
+
// helper.accessor('nested.foo.0.bar', {
|
|
3141
|
+
// cell: info => info.getValue(),
|
|
3142
|
+
// })
|
|
3143
|
+
// helper.accessor('nested.bar', {
|
|
3144
|
+
// cell: info => info.getValue(),
|
|
3145
|
+
// })
|
|
3146
|
+
function createColumnHelper() {
|
|
3147
|
+
return {
|
|
3148
|
+
accessor: (accessor, column) => {
|
|
3149
|
+
return typeof accessor === 'function' ? { ...column,
|
|
3150
|
+
accessorFn: accessor
|
|
3151
|
+
} : { ...column,
|
|
3152
|
+
accessorKey: accessor
|
|
3153
|
+
};
|
|
3154
|
+
}
|
|
3155
|
+
};
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3094
3158
|
function getCoreRowModel() {
|
|
3095
3159
|
return table => memo(() => [table.options.data], data => {
|
|
3096
3160
|
const rowModel = {
|
|
@@ -3800,6 +3864,7 @@
|
|
|
3800
3864
|
exports.aggregationFns = aggregationFns;
|
|
3801
3865
|
exports.buildHeaderGroups = buildHeaderGroups;
|
|
3802
3866
|
exports.createColumn = createColumn;
|
|
3867
|
+
exports.createColumnHelper = createColumnHelper;
|
|
3803
3868
|
exports.createRow = createRow;
|
|
3804
3869
|
exports.createTable = createTable;
|
|
3805
3870
|
exports.defaultColumnSizing = defaultColumnSizing;
|