@tanstack/table-core 8.0.0-alpha.82 → 8.0.0-alpha.83
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/core.js.map +1 -1
- package/build/cjs/createTable.js +3 -2
- package/build/cjs/createTable.js.map +1 -1
- package/build/cjs/features/Cells.js +1 -1
- package/build/cjs/features/Cells.js.map +1 -1
- package/build/cjs/features/ColumnSizing.js +5 -5
- package/build/cjs/features/ColumnSizing.js.map +1 -1
- package/build/cjs/features/Columns.js +8 -6
- package/build/cjs/features/Columns.js.map +1 -1
- package/build/cjs/features/Filters.js +9 -5
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/Grouping.js +5 -5
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/Headers.js +2 -2
- package/build/cjs/features/Headers.js.map +1 -1
- package/build/cjs/features/Pinning.js +14 -8
- package/build/cjs/features/Pinning.js.map +1 -1
- package/build/cjs/features/Sorting.js +8 -8
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/features/Visibility.js +3 -3
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/utils/getGroupedRowModel.js +2 -2
- package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
- package/build/cjs/utils/getSortedRowModel.js +2 -2
- package/build/cjs/utils/getSortedRowModel.js.map +1 -1
- package/build/esm/index.js +62 -49
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +324 -324
- package/build/types/core.d.ts +4 -4
- package/build/types/createTable.d.ts +4 -4
- package/build/types/features/Columns.d.ts +2 -2
- package/build/types/features/Pinning.d.ts +1 -1
- package/build/types/types.d.ts +5 -3
- package/build/umd/index.development.js +62 -49
- 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/core.ts +6 -6
- package/src/createTable.ts +7 -4
- package/src/features/Cells.ts +2 -2
- package/src/features/ColumnSizing.ts +5 -5
- package/src/features/Columns.ts +12 -8
- package/src/features/Filters.ts +7 -3
- package/src/features/Grouping.ts +4 -3
- package/src/features/Headers.ts +4 -4
- package/src/features/Pinning.ts +10 -5
- package/src/features/Sorting.ts +9 -9
- package/src/features/Visibility.ts +2 -2
- package/src/types.ts +9 -5
- package/src/utils/getGroupedRowModel.ts +3 -2
- package/src/utils/getSortedRowModel.ts +2 -2
package/build/types/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequiredKeys } from './utils';
|
|
2
|
-
import { Updater,
|
|
2
|
+
import { Updater, TableOptionsResolved, TableState, TableInstance, Renderable, TableFeature, TableGenerics, InitialTableState } from './types';
|
|
3
3
|
export declare type CoreTableState = {};
|
|
4
4
|
export declare type CoreOptions<TGenerics extends TableGenerics> = {
|
|
5
5
|
data: TGenerics['Row'][];
|
|
@@ -19,12 +19,12 @@ export declare type CoreOptions<TGenerics extends TableGenerics> = {
|
|
|
19
19
|
export declare type CoreInstance<TGenerics extends TableGenerics> = {
|
|
20
20
|
initialState: TableState;
|
|
21
21
|
reset: () => void;
|
|
22
|
-
options: RequiredKeys<
|
|
23
|
-
setOptions: (newOptions: Updater<
|
|
22
|
+
options: RequiredKeys<TableOptionsResolved<TGenerics>, 'state'>;
|
|
23
|
+
setOptions: (newOptions: Updater<TableOptionsResolved<TGenerics>>) => void;
|
|
24
24
|
getState: () => TableState;
|
|
25
25
|
setState: (updater: Updater<TableState>) => void;
|
|
26
26
|
_queue: (cb: () => void) => void;
|
|
27
27
|
_render: <TProps>(template: Renderable<TGenerics, TProps>, props: TProps) => string | null | TGenerics['Rendered'];
|
|
28
28
|
_features: readonly TableFeature[];
|
|
29
29
|
};
|
|
30
|
-
export declare function createTableInstance<TGenerics extends TableGenerics>(options:
|
|
30
|
+
export declare function createTableInstance<TGenerics extends TableGenerics>(options: TableOptionsResolved<TGenerics>): TableInstance<TGenerics>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CustomFilterFns, FilterFn } from './features/Filters';
|
|
2
2
|
import { AggregationFn, CustomAggregationFns } from './features/Grouping';
|
|
3
3
|
import { CustomSortingFns, SortingFn } from './features/Sorting';
|
|
4
|
-
import { ColumnDef, AccessorFn, AnyRender, TableGenerics, TableOptions } from './types';
|
|
4
|
+
import { ColumnDef, AccessorFn, AnyRender, TableGenerics, TableOptionsResolved, TableOptions } from './types';
|
|
5
5
|
import { IfDefined, Overwrite } from './utils';
|
|
6
6
|
export declare type TableFactory<TGenerics extends TableGenerics> = () => Table<TGenerics>;
|
|
7
7
|
export declare type CreateTableOptions<TRender extends AnyRender, TFilterFns extends CustomFilterFns<any>, TSortingFns extends CustomSortingFns<any>, TAggregationFns extends CustomAggregationFns<any>, TGenerics extends TableGenerics> = Partial<{
|
|
@@ -9,11 +9,10 @@ export declare type CreateTableOptions<TRender extends AnyRender, TFilterFns ext
|
|
|
9
9
|
filterFns?: TFilterFns;
|
|
10
10
|
sortingFns?: TSortingFns;
|
|
11
11
|
aggregationFns?: TAggregationFns;
|
|
12
|
-
} & Omit<
|
|
12
|
+
} & Omit<TableOptionsResolved<TGenerics>, 'filterFns' | 'sortingFns' | 'aggregationFns'>>;
|
|
13
13
|
export declare type Table<TGenerics extends TableGenerics> = {
|
|
14
14
|
generics: TGenerics;
|
|
15
|
-
options: Partial<
|
|
16
|
-
setGenerics: <T extends TableGenerics>() => Table<T>;
|
|
15
|
+
options: Partial<TableOptionsResolved<TGenerics>>;
|
|
17
16
|
setRowType: <TRow>() => Table<Overwrite<TGenerics, {
|
|
18
17
|
Row: TRow;
|
|
19
18
|
}>>;
|
|
@@ -54,6 +53,7 @@ export declare type Table<TGenerics extends TableGenerics> = {
|
|
|
54
53
|
accessorKey?: never;
|
|
55
54
|
columns?: ColumnDef<any>[];
|
|
56
55
|
}>) => ColumnDef<TGenerics>;
|
|
56
|
+
createOptions: (options: TableOptions<TGenerics>) => TableOptions<TGenerics>;
|
|
57
57
|
};
|
|
58
58
|
export declare function createTableFactory<TRenderer extends AnyRender>(opts: {
|
|
59
59
|
render: TRenderer;
|
|
@@ -37,10 +37,10 @@ export declare type CoreColumn<TGenerics extends TableGenerics> = {
|
|
|
37
37
|
};
|
|
38
38
|
export declare type ColumnsOptions<TGenerics extends TableGenerics> = {
|
|
39
39
|
columns: ColumnDef<TGenerics>[];
|
|
40
|
-
|
|
40
|
+
defaultColumnDef?: Partial<ColumnDef<TGenerics>>;
|
|
41
41
|
};
|
|
42
42
|
export declare type ColumnsInstance<TGenerics extends TableGenerics> = {
|
|
43
|
-
|
|
43
|
+
getDefaultColumnDef: () => Partial<ColumnDef<TGenerics>>;
|
|
44
44
|
getColumnDefs: () => ColumnDef<TGenerics>[];
|
|
45
45
|
createColumn: (columnDef: ColumnDef<TGenerics>, depth: number, parent?: Column<TGenerics>) => Column<TGenerics>;
|
|
46
46
|
getAllColumns: () => Column<TGenerics>[];
|
|
@@ -31,7 +31,7 @@ export declare type ColumnPinningRow<TGenerics extends TableGenerics> = {
|
|
|
31
31
|
export declare type ColumnPinningInstance<TGenerics extends TableGenerics> = {
|
|
32
32
|
setColumnPinning: (updater: Updater<ColumnPinningState>) => void;
|
|
33
33
|
resetColumnPinning: (defaultState?: boolean) => void;
|
|
34
|
-
getIsSomeColumnsPinned: () => boolean;
|
|
34
|
+
getIsSomeColumnsPinned: (position?: ColumnPinningPosition) => boolean;
|
|
35
35
|
getLeftLeafColumns: () => Column<TGenerics>[];
|
|
36
36
|
getRightLeafColumns: () => Column<TGenerics>[];
|
|
37
37
|
getCenterLeafColumns: () => Column<TGenerics>[];
|
package/build/types/types.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { FiltersColumn, FiltersColumnDef, FiltersInstance, FiltersOptions, Filte
|
|
|
8
8
|
import { SortingColumn, SortingColumnDef, SortingInstance, SortingOptions, SortingTableState } from './features/Sorting';
|
|
9
9
|
import { GroupingCell, GroupingColumn, GroupingColumnDef, GroupingInstance, GroupingOptions, GroupingRow, GroupingTableState } from './features/Grouping';
|
|
10
10
|
import { ExpandedInstance, ExpandedOptions, ExpandedTableState, ExpandedRow } from './features/Expanding';
|
|
11
|
+
import { PartialKeys } from './utils';
|
|
11
12
|
import { ColumnSizingColumn, ColumnSizingColumnDef, ColumnSizingHeader, ColumnSizingInstance, ColumnSizingOptions, ColumnSizingTableState } from './features/ColumnSizing';
|
|
12
13
|
import { PaginationInitialTableState, PaginationInstance, PaginationOptions, PaginationTableState } from './features/Pagination';
|
|
13
14
|
import { RowSelectionInstance, RowSelectionOptions, RowSelectionRow, RowSelectionTableState } from './features/RowSelection';
|
|
@@ -33,14 +34,15 @@ export declare type TableFeature = {
|
|
|
33
34
|
getDefaultOptions?: (instance: any) => any;
|
|
34
35
|
getInitialState?: (initialState?: InitialTableState) => any;
|
|
35
36
|
createInstance?: (instance: any) => any;
|
|
36
|
-
|
|
37
|
+
getDefaultColumnDef?: () => any;
|
|
37
38
|
createColumn?: (column: any, instance: any) => any;
|
|
38
39
|
createHeader?: (column: any, instance: any) => any;
|
|
39
40
|
createCell?: (cell: any, column: any, row: any, instance: any) => any;
|
|
40
41
|
createRow?: (row: any, instance: any) => any;
|
|
41
42
|
};
|
|
42
43
|
export declare type TableInstance<TGenerics extends TableGenerics> = CoreInstance<TGenerics> & ColumnsInstance<TGenerics> & RowsInstance<TGenerics> & CellsInstance<TGenerics> & VisibilityInstance<TGenerics> & ColumnOrderInstance<TGenerics> & ColumnPinningInstance<TGenerics> & HeadersInstance<TGenerics> & FiltersInstance<TGenerics> & SortingInstance<TGenerics> & GroupingInstance<TGenerics> & ColumnSizingInstance<TGenerics> & ExpandedInstance<TGenerics> & PaginationInstance<TGenerics> & RowSelectionInstance<TGenerics>;
|
|
43
|
-
export declare type
|
|
44
|
+
export declare type TableOptionsResolved<TGenerics extends TableGenerics> = CoreOptions<TGenerics> & ColumnsOptions<TGenerics> & RowsOptions<TGenerics> & VisibilityOptions & ColumnOrderOptions & ColumnPinningOptions & FiltersOptions<TGenerics> & SortingOptions<TGenerics> & GroupingOptions<TGenerics> & ExpandedOptions<TGenerics> & ColumnSizingOptions & PaginationOptions<TGenerics> & RowSelectionOptions<TGenerics>;
|
|
45
|
+
export declare type TableOptions<TGenerics extends TableGenerics> = Omit<PartialKeys<TableOptionsResolved<TGenerics>, 'state' | 'onStateChange'>, 'render'>;
|
|
44
46
|
export declare type TableState = CoreTableState & VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationTableState & RowSelectionTableState;
|
|
45
47
|
export declare type InitialTableState = Partial<CoreTableState & VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationInitialTableState & RowSelectionTableState>;
|
|
46
48
|
export declare type Row<TGenerics extends TableGenerics> = CoreRow<TGenerics> & CellsRow<TGenerics> & VisibilityRow<TGenerics> & ColumnPinningRow<TGenerics> & FiltersRow<TGenerics> & GroupingRow & RowSelectionRow & ExpandedRow;
|
|
@@ -55,7 +57,7 @@ export declare type RowModel<TGenerics extends TableGenerics> = {
|
|
|
55
57
|
export declare type AccessorFn<TData> = (originalRow: TData, index: number) => any;
|
|
56
58
|
export declare type Renderable<TGenerics extends TableGenerics, TProps> = string | ((props: TProps) => TGenerics['Rendered']);
|
|
57
59
|
export declare type ColumnDef<TGenerics extends TableGenerics> = CoreColumnDef<TGenerics> & VisibilityColumnDef & ColumnPinningColumnDef & FiltersColumnDef<TGenerics> & SortingColumnDef<TGenerics> & GroupingColumnDef<TGenerics> & ColumnSizingColumnDef;
|
|
58
|
-
export declare type Column<TGenerics extends TableGenerics> =
|
|
60
|
+
export declare type Column<TGenerics extends TableGenerics> = CoreColumn<TGenerics> & ColumnVisibilityColumn & ColumnPinningColumn & FiltersColumn<TGenerics> & SortingColumn<TGenerics> & GroupingColumn<TGenerics> & ColumnSizingColumn<TGenerics>;
|
|
59
61
|
export declare type Cell<TGenerics extends TableGenerics> = CoreCell<TGenerics> & GroupingCell<TGenerics>;
|
|
60
62
|
export declare type CoreCell<TGenerics extends TableGenerics> = {
|
|
61
63
|
id: string;
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
const Columns = {
|
|
96
96
|
createInstance: instance => {
|
|
97
97
|
return {
|
|
98
|
-
|
|
98
|
+
getDefaultColumnDef: memo(() => [instance.options.defaultColumnDef], defaultColumn => {
|
|
99
99
|
var _defaultColumn;
|
|
100
100
|
|
|
101
101
|
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
return (_props$getValue$toStr = (_props$getValue$toStr2 = (_props$getValue = props.getValue()).toString) == null ? void 0 : _props$getValue$toStr2.call(_props$getValue)) != null ? _props$getValue$toStr : null;
|
|
109
109
|
},
|
|
110
110
|
...instance._features.reduce((obj, feature) => {
|
|
111
|
-
return Object.assign(obj, feature.
|
|
111
|
+
return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
|
|
112
112
|
}, {}),
|
|
113
113
|
...defaultColumn
|
|
114
114
|
};
|
|
@@ -118,13 +118,16 @@
|
|
|
118
118
|
|
|
119
119
|
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugColumns;
|
|
120
120
|
},
|
|
121
|
-
key: '
|
|
121
|
+
key: 'getDefaultColumnDef'
|
|
122
122
|
}),
|
|
123
123
|
getColumnDefs: () => instance.options.columns,
|
|
124
124
|
createColumn: (columnDef, depth, parent) => {
|
|
125
125
|
var _ref, _columnDef$id;
|
|
126
126
|
|
|
127
|
-
const
|
|
127
|
+
const defaultColumnDef = instance.getDefaultColumnDef();
|
|
128
|
+
columnDef = { ...defaultColumnDef,
|
|
129
|
+
...columnDef
|
|
130
|
+
};
|
|
128
131
|
let id = (_ref = (_columnDef$id = columnDef.id) != null ? _columnDef$id : columnDef.accessorKey) != null ? _ref : typeof columnDef.header === 'string' ? columnDef.header : undefined;
|
|
129
132
|
let accessorFn;
|
|
130
133
|
|
|
@@ -140,8 +143,7 @@
|
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
145
|
|
|
143
|
-
let column = { ...
|
|
144
|
-
...columnDef,
|
|
146
|
+
let column = { ...columnDef,
|
|
145
147
|
id: "" + id,
|
|
146
148
|
accessorFn,
|
|
147
149
|
parent: parent,
|
|
@@ -375,7 +377,7 @@
|
|
|
375
377
|
row,
|
|
376
378
|
column,
|
|
377
379
|
getValue: () => row.getValue(columnId),
|
|
378
|
-
renderCell: () => column.cell ? instance._render(column.cell, {
|
|
380
|
+
renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
|
|
379
381
|
instance,
|
|
380
382
|
column,
|
|
381
383
|
row,
|
|
@@ -430,7 +432,7 @@
|
|
|
430
432
|
});
|
|
431
433
|
|
|
432
434
|
const ColumnSizing = {
|
|
433
|
-
|
|
435
|
+
getDefaultColumnDef: () => {
|
|
434
436
|
return defaultColumnSizing;
|
|
435
437
|
},
|
|
436
438
|
getInitialState: state => {
|
|
@@ -450,10 +452,10 @@
|
|
|
450
452
|
createColumn: (column, instance) => {
|
|
451
453
|
return {
|
|
452
454
|
getSize: () => {
|
|
453
|
-
var _column$
|
|
455
|
+
var _column$columnDef$min, _ref, _column$columnDef$max;
|
|
454
456
|
|
|
455
457
|
const columnSize = instance.getState().columnSizing[column.id];
|
|
456
|
-
return Math.min(Math.max((_column$
|
|
458
|
+
return Math.min(Math.max((_column$columnDef$min = column.columnDef.minSize) != null ? _column$columnDef$min : defaultColumnSizing.minSize, (_ref = columnSize != null ? columnSize : column.columnDef.size) != null ? _ref : defaultColumnSizing.size), (_column$columnDef$max = column.columnDef.maxSize) != null ? _column$columnDef$max : defaultColumnSizing.maxSize);
|
|
457
459
|
},
|
|
458
460
|
getStart: position => {
|
|
459
461
|
const columns = !position ? instance.getVisibleLeafColumns() : position === 'left' ? instance.getLeftVisibleLeafColumns() : instance.getRightVisibleLeafColumns();
|
|
@@ -476,9 +478,9 @@
|
|
|
476
478
|
});
|
|
477
479
|
},
|
|
478
480
|
getCanResize: () => {
|
|
479
|
-
var _column$
|
|
481
|
+
var _column$columnDef$ena, _instance$options$ena;
|
|
480
482
|
|
|
481
|
-
return ((_column$
|
|
483
|
+
return ((_column$columnDef$ena = column.columnDef.enableResizing) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnResizing) != null ? _instance$options$ena : true);
|
|
482
484
|
},
|
|
483
485
|
getIsResizing: () => {
|
|
484
486
|
return instance.getState().columnSizingInfo.isResizingColumn === column.id;
|
|
@@ -935,7 +937,7 @@
|
|
|
935
937
|
|
|
936
938
|
//
|
|
937
939
|
const Filters = {
|
|
938
|
-
|
|
940
|
+
getDefaultColumnDef: () => {
|
|
939
941
|
return {
|
|
940
942
|
filterFn: 'auto'
|
|
941
943
|
};
|
|
@@ -978,6 +980,10 @@
|
|
|
978
980
|
return filterFns.inNumberRange;
|
|
979
981
|
}
|
|
980
982
|
|
|
983
|
+
if (typeof value === 'boolean') {
|
|
984
|
+
return filterFns.equals;
|
|
985
|
+
}
|
|
986
|
+
|
|
981
987
|
if (value !== null && typeof value === 'object') {
|
|
982
988
|
return filterFns.equals;
|
|
983
989
|
}
|
|
@@ -995,14 +1001,14 @@
|
|
|
995
1001
|
return isFunction(column.filterFn) ? column.filterFn : column.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.filterFn]) != null ? _ref : filterFns[column.filterFn];
|
|
996
1002
|
},
|
|
997
1003
|
getCanFilter: () => {
|
|
998
|
-
var _column$
|
|
1004
|
+
var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
|
|
999
1005
|
|
|
1000
|
-
return ((_column$
|
|
1006
|
+
return ((_column$columnDef$ena = column.columnDef.enableColumnFilter) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableColumnFilters) != null ? _instance$options$ena : true) && ((_instance$options$ena2 = instance.options.enableFilters) != null ? _instance$options$ena2 : true) && !!column.accessorFn;
|
|
1001
1007
|
},
|
|
1002
1008
|
getCanGlobalFilter: () => {
|
|
1003
|
-
var _column$
|
|
1009
|
+
var _column$columnDef$ena2, _instance$options$ena3, _instance$options$ena4, _instance$options$get;
|
|
1004
1010
|
|
|
1005
|
-
return ((_column$
|
|
1011
|
+
return ((_column$columnDef$ena2 = column.columnDef.enableGlobalFilter) != null ? _column$columnDef$ena2 : true) && ((_instance$options$ena3 = instance.options.enableGlobalFilter) != null ? _instance$options$ena3 : true) && ((_instance$options$ena4 = instance.options.enableFilters) != null ? _instance$options$ena4 : true) && ((_instance$options$get = instance.options.getColumnCanGlobalFilter == null ? void 0 : instance.options.getColumnCanGlobalFilter(column)) != null ? _instance$options$get : true) && !!column.accessorFn;
|
|
1006
1012
|
},
|
|
1007
1013
|
getIsFiltered: () => column.getFilterIndex() > -1,
|
|
1008
1014
|
getFilterValue: () => {
|
|
@@ -1280,7 +1286,7 @@
|
|
|
1280
1286
|
|
|
1281
1287
|
//
|
|
1282
1288
|
const Grouping = {
|
|
1283
|
-
|
|
1289
|
+
getDefaultColumnDef: () => {
|
|
1284
1290
|
return {
|
|
1285
1291
|
aggregationFn: 'auto'
|
|
1286
1292
|
};
|
|
@@ -1310,9 +1316,9 @@
|
|
|
1310
1316
|
});
|
|
1311
1317
|
},
|
|
1312
1318
|
getCanGroup: () => {
|
|
1313
|
-
var _ref, _ref2, _ref3, _column$
|
|
1319
|
+
var _ref, _ref2, _ref3, _column$columnDef$ena;
|
|
1314
1320
|
|
|
1315
|
-
return (_ref = (_ref2 = (_ref3 = (_column$
|
|
1321
|
+
return (_ref = (_ref2 = (_ref3 = (_column$columnDef$ena = column.columnDef.enableGrouping) != null ? _column$columnDef$ena : true) != null ? _ref3 : instance.options.enableGrouping) != null ? _ref2 : true) != null ? _ref : !!column.accessorFn;
|
|
1316
1322
|
},
|
|
1317
1323
|
getIsGrouped: () => {
|
|
1318
1324
|
var _instance$getState$gr;
|
|
@@ -1396,9 +1402,9 @@
|
|
|
1396
1402
|
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
|
|
1397
1403
|
},
|
|
1398
1404
|
renderAggregatedCell: () => {
|
|
1399
|
-
var _column$
|
|
1405
|
+
var _column$columnDef$agg;
|
|
1400
1406
|
|
|
1401
|
-
const template = (_column$
|
|
1407
|
+
const template = (_column$columnDef$agg = column.columnDef.aggregatedCell) != null ? _column$columnDef$agg : column.columnDef.cell;
|
|
1402
1408
|
return template ? instance._render(template, {
|
|
1403
1409
|
instance,
|
|
1404
1410
|
column,
|
|
@@ -1705,9 +1711,9 @@
|
|
|
1705
1711
|
getCanPin: () => {
|
|
1706
1712
|
const leafColumns = column.getLeafColumns();
|
|
1707
1713
|
return leafColumns.some(d => {
|
|
1708
|
-
var _d$
|
|
1714
|
+
var _d$columnDef$enablePi, _instance$options$ena;
|
|
1709
1715
|
|
|
1710
|
-
return ((_d$
|
|
1716
|
+
return ((_d$columnDef$enablePi = d.columnDef.enablePinning) != null ? _d$columnDef$enablePi : true) && ((_instance$options$ena = instance.options.enablePinning) != null ? _instance$options$ena : true);
|
|
1711
1717
|
});
|
|
1712
1718
|
},
|
|
1713
1719
|
getIsPinned: () => {
|
|
@@ -1777,12 +1783,18 @@
|
|
|
1777
1783
|
|
|
1778
1784
|
return instance.setColumnPinning(defaultState ? getDefaultPinningState() : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnPinning) != null ? _instance$initialStat : getDefaultPinningState());
|
|
1779
1785
|
},
|
|
1780
|
-
getIsSomeColumnsPinned:
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
+
getIsSomeColumnsPinned: position => {
|
|
1787
|
+
var _pinningState$positio;
|
|
1788
|
+
|
|
1789
|
+
const pinningState = instance.getState().columnPinning;
|
|
1790
|
+
|
|
1791
|
+
if (!position) {
|
|
1792
|
+
var _pinningState$left, _pinningState$right;
|
|
1793
|
+
|
|
1794
|
+
return Boolean(((_pinningState$left = pinningState.left) == null ? void 0 : _pinningState$left.length) || ((_pinningState$right = pinningState.right) == null ? void 0 : _pinningState$right.length));
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
1786
1798
|
},
|
|
1787
1799
|
getLeftLeafColumns: memo(() => [instance.getAllLeafColumns(), instance.getState().columnPinning.left], (allColumns, left) => {
|
|
1788
1800
|
return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
|
|
@@ -2308,7 +2320,7 @@
|
|
|
2308
2320
|
...state
|
|
2309
2321
|
};
|
|
2310
2322
|
},
|
|
2311
|
-
|
|
2323
|
+
getDefaultColumnDef: () => {
|
|
2312
2324
|
return {
|
|
2313
2325
|
sortingFn: 'auto'
|
|
2314
2326
|
};
|
|
@@ -2368,7 +2380,7 @@
|
|
|
2368
2380
|
throw new Error();
|
|
2369
2381
|
}
|
|
2370
2382
|
|
|
2371
|
-
return isFunction(column.sortingFn) ? column.sortingFn : column.sortingFn === 'auto' ? column.getAutoSortingFn() : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.sortingFn]) != null ? _ref : sortingFns[column.sortingFn];
|
|
2383
|
+
return isFunction(column.columnDef.sortingFn) ? column.columnDef.sortingFn : column.columnDef.sortingFn === 'auto' ? column.getAutoSortingFn() : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.columnDef.sortingFn]) != null ? _ref : sortingFns[column.columnDef.sortingFn];
|
|
2372
2384
|
},
|
|
2373
2385
|
toggleSorting: (desc, multi) => {
|
|
2374
2386
|
// if (column.columns.length) {
|
|
@@ -2380,7 +2392,7 @@
|
|
|
2380
2392
|
// return
|
|
2381
2393
|
// }
|
|
2382
2394
|
instance.setSorting(old => {
|
|
2383
|
-
var _ref2, _column$
|
|
2395
|
+
var _ref2, _column$columnDef$sor, _instance$options$ena, _instance$options$ena2;
|
|
2384
2396
|
|
|
2385
2397
|
// Find any existing sorting for this column
|
|
2386
2398
|
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
@@ -2407,7 +2419,7 @@
|
|
|
2407
2419
|
}
|
|
2408
2420
|
}
|
|
2409
2421
|
|
|
2410
|
-
const sortDescFirst = (_ref2 = (_column$
|
|
2422
|
+
const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc'; // Handle toggle states that will remove the sorting
|
|
2411
2423
|
|
|
2412
2424
|
if (sortAction === 'toggle' && ( // Must be toggling
|
|
2413
2425
|
(_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
|
|
@@ -2451,14 +2463,14 @@
|
|
|
2451
2463
|
});
|
|
2452
2464
|
},
|
|
2453
2465
|
getCanSort: () => {
|
|
2454
|
-
var _column$
|
|
2466
|
+
var _column$columnDef$ena, _instance$options$ena3;
|
|
2455
2467
|
|
|
2456
|
-
return ((_column$
|
|
2468
|
+
return ((_column$columnDef$ena = column.columnDef.enableSorting) != null ? _column$columnDef$ena : true) && ((_instance$options$ena3 = instance.options.enableSorting) != null ? _instance$options$ena3 : true) && !!column.accessorFn;
|
|
2457
2469
|
},
|
|
2458
2470
|
getCanMultiSort: () => {
|
|
2459
|
-
var _ref3, _column$
|
|
2471
|
+
var _ref3, _column$columnDef$ena2;
|
|
2460
2472
|
|
|
2461
|
-
return (_ref3 = (_column$
|
|
2473
|
+
return (_ref3 = (_column$columnDef$ena2 = column.columnDef.enableMultiSort) != null ? _column$columnDef$ena2 : instance.options.enableMultiSort) != null ? _ref3 : !!column.accessorFn;
|
|
2462
2474
|
},
|
|
2463
2475
|
getIsSorted: () => {
|
|
2464
2476
|
var _instance$getState$so;
|
|
@@ -2522,7 +2534,7 @@
|
|
|
2522
2534
|
onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
|
|
2523
2535
|
};
|
|
2524
2536
|
},
|
|
2525
|
-
|
|
2537
|
+
getDefaultColumnDef: () => {
|
|
2526
2538
|
return {
|
|
2527
2539
|
defaultIsVisible: true
|
|
2528
2540
|
};
|
|
@@ -2542,9 +2554,9 @@
|
|
|
2542
2554
|
return (_instance$getState$co = (_instance$getState$co2 = instance.getState().columnVisibility) == null ? void 0 : _instance$getState$co2[column.id]) != null ? _instance$getState$co : true;
|
|
2543
2555
|
},
|
|
2544
2556
|
getCanHide: () => {
|
|
2545
|
-
var _column$
|
|
2557
|
+
var _column$columnDef$ena, _instance$options$ena;
|
|
2546
2558
|
|
|
2547
|
-
return ((_column$
|
|
2559
|
+
return ((_column$columnDef$ena = column.columnDef.enableHiding) != null ? _column$columnDef$ena : true) && ((_instance$options$ena = instance.options.enableHiding) != null ? _instance$options$ena : true);
|
|
2548
2560
|
},
|
|
2549
2561
|
getToggleVisibilityHandler: () => {
|
|
2550
2562
|
return e => {
|
|
@@ -2655,12 +2667,12 @@
|
|
|
2655
2667
|
recurseHeader(header);
|
|
2656
2668
|
return leafHeaders;
|
|
2657
2669
|
},
|
|
2658
|
-
renderHeader: () => column.header ? instance._render(column.header, {
|
|
2670
|
+
renderHeader: () => column.columnDef.header ? instance._render(column.columnDef.header, {
|
|
2659
2671
|
instance,
|
|
2660
2672
|
header: header,
|
|
2661
2673
|
column
|
|
2662
2674
|
}) : null,
|
|
2663
|
-
renderFooter: () => column.footer ? instance._render(column.footer, {
|
|
2675
|
+
renderFooter: () => column.columnDef.footer ? instance._render(column.columnDef.footer, {
|
|
2664
2676
|
instance,
|
|
2665
2677
|
header: header,
|
|
2666
2678
|
column
|
|
@@ -3168,7 +3180,7 @@
|
|
|
3168
3180
|
throw new Error('');
|
|
3169
3181
|
})()
|
|
3170
3182
|
},
|
|
3171
|
-
setGenerics: () => table,
|
|
3183
|
+
// setGenerics: () => table as any,
|
|
3172
3184
|
setRowType: () => table,
|
|
3173
3185
|
setTableMetaType: () => table,
|
|
3174
3186
|
setColumnMetaType: () => table,
|
|
@@ -3204,7 +3216,8 @@
|
|
|
3204
3216
|
}
|
|
3205
3217
|
|
|
3206
3218
|
throw new Error('Invalid accessor');
|
|
3207
|
-
}
|
|
3219
|
+
},
|
|
3220
|
+
createOptions: options => options
|
|
3208
3221
|
};
|
|
3209
3222
|
return table;
|
|
3210
3223
|
}
|
|
@@ -3601,8 +3614,8 @@
|
|
|
3601
3614
|
availableSorting.forEach(sortEntry => {
|
|
3602
3615
|
const column = instance.getColumn(sortEntry.id);
|
|
3603
3616
|
columnInfoById[sortEntry.id] = {
|
|
3604
|
-
sortUndefined: column.sortUndefined,
|
|
3605
|
-
invertSorting: column.invertSorting,
|
|
3617
|
+
sortUndefined: column.columnDef.sortUndefined,
|
|
3618
|
+
invertSorting: column.columnDef.invertSorting,
|
|
3606
3619
|
sortingFn: column.getSortingFn()
|
|
3607
3620
|
};
|
|
3608
3621
|
});
|
|
@@ -3750,8 +3763,8 @@
|
|
|
3750
3763
|
row.groupingValuesCache[columnId] = aggregateFn(() => leafRows.map(row => {
|
|
3751
3764
|
let columnValue = row.getValue(columnId);
|
|
3752
3765
|
|
|
3753
|
-
if (!depth && column.aggregateValue) {
|
|
3754
|
-
columnValue = column.aggregateValue(columnValue);
|
|
3766
|
+
if (!depth && column.columnDef.aggregateValue) {
|
|
3767
|
+
columnValue = column.columnDef.aggregateValue(columnValue);
|
|
3755
3768
|
}
|
|
3756
3769
|
|
|
3757
3770
|
return columnValue;
|