@tanstack/table-core 8.0.0-alpha.45 → 8.0.0-alpha.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/aggregationFns.js.map +1 -1
- package/build/cjs/createTable.js.map +1 -1
- package/build/cjs/features/ColumnSizing.js.map +1 -1
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js +6 -6
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/Grouping.js +2 -2
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/RowSelection.js +2 -2
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/features/Sorting.js +2 -2
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/filterFns.js.map +1 -1
- package/build/cjs/sortingFns.js.map +1 -1
- package/build/esm/index.js +12 -12
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +296 -296
- package/build/types/aggregationFns.d.ts +1 -1
- package/build/types/createTable.d.ts +7 -7
- package/build/types/features/Expanding.d.ts +1 -1
- package/build/types/features/Filters.d.ts +6 -6
- package/build/types/features/Grouping.d.ts +6 -6
- package/build/types/features/RowSelection.d.ts +1 -1
- package/build/types/features/Sorting.d.ts +7 -7
- package/build/types/filterFns.d.ts +1 -1
- package/build/types/sortingFns.d.ts +1 -1
- package/build/umd/index.development.js +12 -12
- 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/aggregationFns.ts +1 -1
- package/src/createTable.ts +9 -11
- package/src/features/ColumnSizing.ts +4 -4
- package/src/features/Expanding.ts +3 -3
- package/src/features/Filters.ts +18 -18
- package/src/features/Grouping.ts +11 -11
- package/src/features/RowSelection.ts +13 -11
- package/src/features/Sorting.ts +18 -14
- package/src/features/Visibility.ts +4 -2
- package/src/filterFns.ts +1 -1
- package/src/sortingFns.ts +2 -2
|
@@ -9,7 +9,7 @@ export declare const aggregationFns: {
|
|
|
9
9
|
uniqueCount: typeof uniqueCount;
|
|
10
10
|
count: typeof count;
|
|
11
11
|
};
|
|
12
|
-
export declare type
|
|
12
|
+
export declare type BuiltInAggregationFn = keyof typeof aggregationFns;
|
|
13
13
|
declare function sum(_getLeafValues: () => unknown[], getChildValues: () => unknown[]): number;
|
|
14
14
|
declare function min(_getLeafValues: () => unknown[], getChildValues: () => unknown[]): number | undefined;
|
|
15
15
|
declare function max(_getLeafValues: () => unknown[], getChildValues: () => unknown[]): number | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AggregationFn,
|
|
3
|
-
import {
|
|
1
|
+
import { CustomFilterFns, FilterFn } from './features/Filters';
|
|
2
|
+
import { AggregationFn, CustomAggregationFns } from './features/Grouping';
|
|
3
|
+
import { CustomSortingFns, SortingFn } from './features/Sorting';
|
|
4
4
|
import { ColumnDef, AccessorFn, AnyRender, AnyGenerics, Options } from './types';
|
|
5
5
|
import { IfDefined, Overwrite, PartialKeys } from './utils';
|
|
6
6
|
export declare type TableFactory<TGenerics extends AnyGenerics> = () => Table<TGenerics>;
|
|
7
|
-
export declare type CreateTableOptions<TRender extends AnyRender, TFilterFns extends
|
|
7
|
+
export declare type CreateTableOptions<TRender extends AnyRender, TFilterFns extends CustomFilterFns<any>, TSortingFns extends CustomSortingFns<any>, TAggregationFns extends CustomAggregationFns<any>, TGenerics extends AnyGenerics> = Partial<{
|
|
8
8
|
render?: TRender;
|
|
9
9
|
filterFns?: TFilterFns;
|
|
10
10
|
sortingFns?: TSortingFns;
|
|
@@ -13,13 +13,13 @@ export declare type CreateTableOptions<TRender extends AnyRender, TFilterFns ext
|
|
|
13
13
|
export declare type Table<TGenerics extends AnyGenerics> = {
|
|
14
14
|
generics: TGenerics;
|
|
15
15
|
options: Partial<Options<TGenerics>>;
|
|
16
|
-
setRowType: <TRow
|
|
16
|
+
setRowType: <TRow>() => Table<Overwrite<TGenerics, {
|
|
17
17
|
Row: TRow;
|
|
18
18
|
}>>;
|
|
19
|
-
setTableMetaType: <TTableMeta
|
|
19
|
+
setTableMetaType: <TTableMeta>() => Table<Overwrite<TGenerics, {
|
|
20
20
|
TableMeta: TTableMeta;
|
|
21
21
|
}>>;
|
|
22
|
-
setColumnMetaType: <TColumnMeta
|
|
22
|
+
setColumnMetaType: <TColumnMeta>() => Table<Overwrite<TGenerics, {
|
|
23
23
|
ColumnMeta: TColumnMeta;
|
|
24
24
|
}>>;
|
|
25
25
|
setOptions: <TFilterFns extends Record<string, FilterFn<any>>, TSortingFns extends Record<string, SortingFn<any>>, TAggregationFns extends Record<string, AggregationFn<any>>>(options: CreateTableOptions<any, TFilterFns, TSortingFns, TAggregationFns, TGenerics>) => Table<Overwrite<TGenerics, {
|
|
@@ -24,7 +24,7 @@ export declare type ExpandedOptions<TGenerics extends AnyGenerics> = {
|
|
|
24
24
|
};
|
|
25
25
|
export declare type ToggleExpandedProps = {
|
|
26
26
|
title?: string;
|
|
27
|
-
onClick?: (event:
|
|
27
|
+
onClick?: (event: unknown) => void;
|
|
28
28
|
};
|
|
29
29
|
export declare type ExpandedInstance<TGenerics extends AnyGenerics> = {
|
|
30
30
|
_notifyExpandedReset: () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RowModel } from '..';
|
|
2
|
-
import {
|
|
2
|
+
import { BuiltInFilterFn } from '../filterFns';
|
|
3
3
|
import { Column, OnChangeFn, AnyGenerics, TableInstance, Row, Updater } from '../types';
|
|
4
4
|
import { Overwrite } from '../utils';
|
|
5
5
|
export declare type ColumnFilter = {
|
|
@@ -12,16 +12,16 @@ export declare type FilterFn<TGenerics extends AnyGenerics> = {
|
|
|
12
12
|
autoRemove?: ColumnFilterAutoRemoveTestFn<TGenerics>;
|
|
13
13
|
};
|
|
14
14
|
export declare type ColumnFilterAutoRemoveTestFn<TGenerics extends AnyGenerics> = (value: unknown, column?: Column<TGenerics>) => boolean;
|
|
15
|
-
export declare type
|
|
15
|
+
export declare type CustomFilterFns<TGenerics extends AnyGenerics> = Record<string, FilterFn<TGenerics>>;
|
|
16
16
|
export declare type FiltersTableState = {
|
|
17
17
|
columnFilters: ColumnFiltersState;
|
|
18
18
|
globalFilter: any;
|
|
19
19
|
columnFiltersProgress: number;
|
|
20
20
|
globalFilterProgress: number;
|
|
21
21
|
};
|
|
22
|
-
export declare type
|
|
22
|
+
export declare type FilterFnOption<TGenerics extends AnyGenerics> = 'auto' | BuiltInFilterFn | keyof TGenerics['FilterFns'] | FilterFn<TGenerics>;
|
|
23
23
|
export declare type FiltersColumnDef<TGenerics extends AnyGenerics> = {
|
|
24
|
-
filterFn?:
|
|
24
|
+
filterFn?: FilterFnOption<Overwrite<TGenerics, {
|
|
25
25
|
Value: any;
|
|
26
26
|
}>>;
|
|
27
27
|
enableAllFilters?: boolean;
|
|
@@ -32,7 +32,7 @@ export declare type FiltersColumnDef<TGenerics extends AnyGenerics> = {
|
|
|
32
32
|
defaultCanGlobalFilter?: boolean;
|
|
33
33
|
};
|
|
34
34
|
export declare type FiltersColumn<TGenerics extends AnyGenerics> = {
|
|
35
|
-
filterFn:
|
|
35
|
+
filterFn: FilterFnOption<Overwrite<TGenerics, {
|
|
36
36
|
Value: any;
|
|
37
37
|
}>>;
|
|
38
38
|
getCanColumnFilter: () => boolean;
|
|
@@ -53,7 +53,7 @@ export declare type FiltersOptions<TGenerics extends AnyGenerics> = {
|
|
|
53
53
|
autoResetColumnFilters?: boolean;
|
|
54
54
|
enableColumnFilters?: boolean;
|
|
55
55
|
getColumnFilteredRowModel?: (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics>;
|
|
56
|
-
|
|
56
|
+
globalFilterFn?: FilterFnOption<TGenerics>;
|
|
57
57
|
onGlobalFilterChange?: OnChangeFn<any>;
|
|
58
58
|
autoResetGlobalFilter?: boolean;
|
|
59
59
|
enableGlobalFilter?: boolean;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { RowModel } from '..';
|
|
2
|
-
import {
|
|
2
|
+
import { BuiltInAggregationFn } from '../aggregationFns';
|
|
3
3
|
import { Cell, Column, Getter, OnChangeFn, PropGetterValue, TableInstance, Row, Updater, Renderable, UseRenderer, AnyGenerics } from '../types';
|
|
4
4
|
import { Overwrite } from '../utils';
|
|
5
5
|
export declare type GroupingState = string[];
|
|
6
6
|
export declare type AggregationFn<TGenerics extends AnyGenerics> = (getLeafValues: () => TGenerics['Row'][], getChildValues: () => TGenerics['Row'][]) => any;
|
|
7
|
-
export declare type
|
|
8
|
-
export declare type
|
|
7
|
+
export declare type CustomAggregationFns<TGenerics extends AnyGenerics> = Record<string, AggregationFn<TGenerics>>;
|
|
8
|
+
export declare type AggregationFnOption<TGenerics extends AnyGenerics> = 'auto' | BuiltInAggregationFn | keyof TGenerics['AggregationFns'] | AggregationFn<TGenerics>;
|
|
9
9
|
export declare type GroupingTableState = {
|
|
10
10
|
grouping: GroupingState;
|
|
11
11
|
};
|
|
12
12
|
export declare type GroupingColumnDef<TGenerics extends AnyGenerics> = {
|
|
13
|
-
aggregationFn?:
|
|
13
|
+
aggregationFn?: AggregationFnOption<Overwrite<TGenerics, {
|
|
14
14
|
Value: any;
|
|
15
15
|
}>>;
|
|
16
16
|
aggregateValue?: (columnValue: unknown) => any;
|
|
@@ -25,7 +25,7 @@ export declare type GroupingColumnDef<TGenerics extends AnyGenerics> = {
|
|
|
25
25
|
defaultCanGroup?: boolean;
|
|
26
26
|
};
|
|
27
27
|
export declare type GroupingColumn<TGenerics extends AnyGenerics> = {
|
|
28
|
-
aggregationFn?:
|
|
28
|
+
aggregationFn?: AggregationFnOption<Overwrite<TGenerics, {
|
|
29
29
|
Value: any;
|
|
30
30
|
}>>;
|
|
31
31
|
getCanGroup: () => boolean;
|
|
@@ -62,7 +62,7 @@ export declare type GroupingOptions<TGenerics extends AnyGenerics> = {
|
|
|
62
62
|
export declare type GroupingColumnMode = false | 'reorder' | 'remove';
|
|
63
63
|
export declare type ToggleGroupingProps = {
|
|
64
64
|
title?: string;
|
|
65
|
-
onClick?: (event:
|
|
65
|
+
onClick?: (event: unknown) => void;
|
|
66
66
|
};
|
|
67
67
|
export declare type GroupingInstance<TGenerics extends AnyGenerics> = {
|
|
68
68
|
_notifyGroupingReset: () => void;
|
|
@@ -11,7 +11,7 @@ export declare type RowSelectionOptions<TGenerics extends AnyGenerics> = {
|
|
|
11
11
|
enableSubRowSelection?: boolean | ((row: Row<TGenerics>) => boolean);
|
|
12
12
|
};
|
|
13
13
|
declare type ToggleRowSelectedProps = {
|
|
14
|
-
onChange?: (e:
|
|
14
|
+
onChange?: (e: unknown) => void;
|
|
15
15
|
checked?: boolean;
|
|
16
16
|
title?: string;
|
|
17
17
|
indeterminate?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RowModel } from '..';
|
|
2
|
-
import {
|
|
2
|
+
import { BuiltInSortingFn } from '../sortingFns';
|
|
3
3
|
import { Column, Getter, OnChangeFn, AnyGenerics, PropGetterValue, TableInstance, Row, Updater } from '../types';
|
|
4
4
|
import { Overwrite } from '../utils';
|
|
5
5
|
export declare type SortDirection = 'asc' | 'desc';
|
|
@@ -11,13 +11,13 @@ export declare type SortingState = ColumnSort[];
|
|
|
11
11
|
export declare type SortingFn<TGenerics extends AnyGenerics> = {
|
|
12
12
|
(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): number;
|
|
13
13
|
};
|
|
14
|
-
export declare type
|
|
14
|
+
export declare type CustomSortingFns<TGenerics extends AnyGenerics> = Record<string, SortingFn<TGenerics>>;
|
|
15
15
|
export declare type SortingTableState = {
|
|
16
16
|
sorting: SortingState;
|
|
17
17
|
};
|
|
18
|
-
export declare type
|
|
18
|
+
export declare type SortingFnOption<TGenerics extends AnyGenerics> = 'auto' | BuiltInSortingFn | keyof TGenerics['SortingFns'] | SortingFn<TGenerics>;
|
|
19
19
|
export declare type SortingColumnDef<TGenerics extends AnyGenerics> = {
|
|
20
|
-
sortingFn?:
|
|
20
|
+
sortingFn?: SortingFnOption<Overwrite<TGenerics, {
|
|
21
21
|
Value: any;
|
|
22
22
|
}>>;
|
|
23
23
|
sortDescFirst?: boolean;
|
|
@@ -28,7 +28,7 @@ export declare type SortingColumnDef<TGenerics extends AnyGenerics> = {
|
|
|
28
28
|
sortUndefined?: false | -1 | 1;
|
|
29
29
|
};
|
|
30
30
|
export declare type SortingColumn<TGenerics extends AnyGenerics> = {
|
|
31
|
-
sortingFn:
|
|
31
|
+
sortingFn: SortingFnOption<Overwrite<TGenerics, {
|
|
32
32
|
Value: any;
|
|
33
33
|
}>>;
|
|
34
34
|
getCanSort: () => boolean;
|
|
@@ -50,11 +50,11 @@ export declare type SortingOptions<TGenerics extends AnyGenerics> = {
|
|
|
50
50
|
sortDescFirst?: boolean;
|
|
51
51
|
getSortedRowModel?: (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics>;
|
|
52
52
|
maxMultiSortColCount?: number;
|
|
53
|
-
isMultiSortEvent?: (e:
|
|
53
|
+
isMultiSortEvent?: (e: unknown) => boolean;
|
|
54
54
|
};
|
|
55
55
|
export declare type ToggleSortingProps = {
|
|
56
56
|
title?: string;
|
|
57
|
-
onClick?: (event:
|
|
57
|
+
onClick?: (event: unknown) => void;
|
|
58
58
|
};
|
|
59
59
|
export declare type SortingInstance<TGenerics extends AnyGenerics> = {
|
|
60
60
|
_notifySortingReset: () => void;
|
|
@@ -10,7 +10,7 @@ export declare const filterFns: {
|
|
|
10
10
|
weakEquals: typeof weakEquals;
|
|
11
11
|
betweenNumberRange: typeof betweenNumberRange;
|
|
12
12
|
};
|
|
13
|
-
export declare type
|
|
13
|
+
export declare type BuiltInFilterFn = keyof typeof filterFns;
|
|
14
14
|
declare function includesString<TGenerics extends AnyGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
|
|
15
15
|
declare namespace includesString {
|
|
16
16
|
var autoRemove: (val: any) => boolean;
|
|
@@ -8,7 +8,7 @@ export declare const sortingFns: {
|
|
|
8
8
|
datetime: typeof datetime;
|
|
9
9
|
basic: typeof basic;
|
|
10
10
|
};
|
|
11
|
-
export declare type
|
|
11
|
+
export declare type BuiltInSortingFn = keyof typeof sortingFns;
|
|
12
12
|
declare function alphanumeric<TGenerics extends AnyGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): number;
|
|
13
13
|
declare function alphanumericCaseSensitive<TGenerics extends AnyGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): number;
|
|
14
14
|
declare function text<TGenerics extends AnyGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
|
|
@@ -1066,7 +1066,7 @@
|
|
|
1066
1066
|
autoResetColumnFilters: true,
|
|
1067
1067
|
filterFromLeafRows: true,
|
|
1068
1068
|
autoResetGlobalFilter: true,
|
|
1069
|
-
|
|
1069
|
+
globalFilterFn: 'auto',
|
|
1070
1070
|
getColumnCanGlobalFilterFn: function getColumnCanGlobalFilterFn(column) {
|
|
1071
1071
|
var _instance$getCoreRowM, _instance$getCoreRowM2;
|
|
1072
1072
|
|
|
@@ -1203,21 +1203,21 @@
|
|
|
1203
1203
|
var _ref;
|
|
1204
1204
|
|
|
1205
1205
|
var column = instance.getColumn(columnId);
|
|
1206
|
-
var
|
|
1206
|
+
var userFilterFns = instance.options.filterFns;
|
|
1207
1207
|
|
|
1208
1208
|
if (!column) {
|
|
1209
1209
|
throw new Error();
|
|
1210
1210
|
}
|
|
1211
1211
|
|
|
1212
|
-
return isFunction(column.filterFn) ? column.filterFn : column.filterFn === 'auto' ? instance.getColumnAutoFilterFn(columnId) : (_ref =
|
|
1212
|
+
return isFunction(column.filterFn) ? column.filterFn : column.filterFn === 'auto' ? instance.getColumnAutoFilterFn(columnId) : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.filterFn]) != null ? _ref : filterFns[column.filterFn];
|
|
1213
1213
|
},
|
|
1214
1214
|
getGlobalFilterFn: function getGlobalFilterFn() {
|
|
1215
1215
|
var _ref2;
|
|
1216
1216
|
|
|
1217
1217
|
var _instance$options = instance.options,
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
return isFunction(
|
|
1218
|
+
userFilterFns = _instance$options.filterFns,
|
|
1219
|
+
globalFilterFn = _instance$options.globalFilterFn;
|
|
1220
|
+
return isFunction(globalFilterFn) ? globalFilterFn : globalFilterFn === 'auto' ? instance.getGlobalAutoFilterFn() : (_ref2 = userFilterFns == null ? void 0 : userFilterFns[globalFilterFn]) != null ? _ref2 : filterFns[globalFilterFn];
|
|
1221
1221
|
},
|
|
1222
1222
|
setColumnFilters: function setColumnFilters(updater) {
|
|
1223
1223
|
var leafColumns = instance.getAllLeafColumns();
|
|
@@ -1573,13 +1573,13 @@
|
|
|
1573
1573
|
var _ref;
|
|
1574
1574
|
|
|
1575
1575
|
var column = instance.getColumn(columnId);
|
|
1576
|
-
var
|
|
1576
|
+
var userAggregationFns = instance.options.aggregationFns;
|
|
1577
1577
|
|
|
1578
1578
|
if (!column) {
|
|
1579
1579
|
throw new Error();
|
|
1580
1580
|
}
|
|
1581
1581
|
|
|
1582
|
-
return isFunction(column.aggregationFn) ? column.aggregationFn : column.aggregationFn === 'auto' ? instance.getColumnAutoAggregationFn(columnId) : (_ref =
|
|
1582
|
+
return isFunction(column.aggregationFn) ? column.aggregationFn : column.aggregationFn === 'auto' ? instance.getColumnAutoAggregationFn(columnId) : (_ref = userAggregationFns == null ? void 0 : userAggregationFns[column.aggregationFn]) != null ? _ref : aggregationFns[column.aggregationFn];
|
|
1583
1583
|
},
|
|
1584
1584
|
setGrouping: function setGrouping(updater) {
|
|
1585
1585
|
return instance.options.onGroupingChange == null ? void 0 : instance.options.onGroupingChange(updater, functionalUpdate(updater, instance.getState().grouping));
|
|
@@ -2094,8 +2094,8 @@
|
|
|
2094
2094
|
enableRowSelection: true,
|
|
2095
2095
|
enableMultiRowSelection: true,
|
|
2096
2096
|
enableSubRowSelection: true // enableGroupingRowSelection: false,
|
|
2097
|
-
// isAdditiveSelectEvent: (e:
|
|
2098
|
-
// isInclusiveSelectEvent: (e:
|
|
2097
|
+
// isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,
|
|
2098
|
+
// isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,
|
|
2099
2099
|
|
|
2100
2100
|
};
|
|
2101
2101
|
},
|
|
@@ -2802,13 +2802,13 @@
|
|
|
2802
2802
|
var _ref;
|
|
2803
2803
|
|
|
2804
2804
|
var column = instance.getColumn(columnId);
|
|
2805
|
-
var
|
|
2805
|
+
var userSortingFn = instance.options.sortingFns;
|
|
2806
2806
|
|
|
2807
2807
|
if (!column) {
|
|
2808
2808
|
throw new Error();
|
|
2809
2809
|
}
|
|
2810
2810
|
|
|
2811
|
-
return isFunction(column.sortingFn) ? column.sortingFn : column.sortingFn === 'auto' ? instance.getColumnAutoSortingFn(columnId) : (_ref =
|
|
2811
|
+
return isFunction(column.sortingFn) ? column.sortingFn : column.sortingFn === 'auto' ? instance.getColumnAutoSortingFn(columnId) : (_ref = userSortingFn == null ? void 0 : userSortingFn[column.sortingFn]) != null ? _ref : sortingFns[column.sortingFn];
|
|
2812
2812
|
},
|
|
2813
2813
|
setSorting: function setSorting(updater) {
|
|
2814
2814
|
return instance.options.onSortingChange == null ? void 0 : instance.options.onSortingChange(updater, functionalUpdate(updater, instance.getState().sorting));
|