@tanstack/table-core 8.0.0-alpha.19 → 8.0.0-alpha.20
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 +1 -0
- package/build/cjs/createTable.js.map +1 -1
- package/build/cjs/features/ColumnSizing.js.map +1 -1
- package/build/cjs/features/Expanding.js +3 -9
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/Headers.js.map +1 -1
- package/build/cjs/features/Ordering.js.map +1 -1
- package/build/cjs/features/Pagination.js +1 -1
- package/build/cjs/features/Pagination.js.map +1 -1
- package/build/cjs/features/Pinning.js.map +1 -1
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/filterTypes.js.map +1 -1
- package/build/cjs/index.js +0 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/sortTypes.js.map +1 -1
- package/build/cjs/utils/columnFilterRowsFn.js.map +1 -1
- package/build/cjs/utils/expandRowsFn.js +1 -2
- package/build/cjs/utils/expandRowsFn.js.map +1 -1
- package/build/cjs/utils/globalFilterRowsFn.js.map +1 -1
- package/build/cjs/utils/groupRowsFn.js.map +1 -1
- package/build/cjs/utils/sortRowsFn.js.map +1 -1
- package/build/esm/index.js +7 -16
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +264 -282
- package/build/types/core.d.ts +1 -2
- package/build/types/createTable.d.ts +12 -13
- package/build/types/features/RowSelection.d.ts +2 -2
- package/build/types/types.d.ts +1 -5
- package/build/umd/index.development.js +6 -16
- 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.tsx +1 -2
- package/src/createTable.tsx +19 -43
- package/src/features/ColumnSizing.ts +1 -0
- package/src/features/Expanding.ts +4 -7
- package/src/features/Filters.ts +1 -0
- package/src/features/Grouping.ts +1 -0
- package/src/features/Headers.ts +1 -0
- package/src/features/Ordering.ts +1 -0
- package/src/features/Pagination.ts +4 -2
- package/src/features/Pinning.ts +1 -0
- package/src/features/RowSelection.ts +2 -2
- package/src/features/Sorting.ts +1 -0
- package/src/features/Visibility.ts +1 -0
- package/src/filterTypes.ts +1 -1
- package/src/sortTypes.ts +1 -1
- package/src/types.ts +19 -10
- package/src/utils/columnFilterRowsFn.ts +7 -1
- package/src/utils/expandRowsFn.ts +8 -4
- package/src/utils/globalFilterRowsFn.ts +7 -1
- package/src/utils/groupRowsFn.ts +8 -2
- package/src/utils/sortRowsFn.ts +7 -1
- package/build/cjs/types.js +0 -19
- package/build/cjs/types.js.map +0 -1
package/build/types/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequiredKeys } from './utils';
|
|
2
|
-
import { Updater, PropGetterValue, Options, TableState, ColumnDef, Row, Column, Cell, Header, AccessorFn, TableProps, TableBodyProps, PropGetter, Getter, RowProps, CellProps, TableInstance, RowValues,
|
|
2
|
+
import { Updater, PropGetterValue, Options, TableState, ColumnDef, Row, Column, Cell, Header, AccessorFn, TableProps, TableBodyProps, PropGetter, Getter, RowProps, CellProps, TableInstance, RowValues, PartialGenerics, Renderable, UseRenderer } from './types';
|
|
3
3
|
import { RowModel } from '.';
|
|
4
4
|
export declare type CoreOptions<TGenerics extends PartialGenerics> = {
|
|
5
5
|
data: TGenerics['Row'][];
|
|
@@ -91,7 +91,6 @@ export declare type CoreColumnDef<TGenerics extends PartialGenerics> = {
|
|
|
91
91
|
value: TGenerics['Value'];
|
|
92
92
|
}>;
|
|
93
93
|
meta?: TGenerics['ColumnMeta'];
|
|
94
|
-
[Please_use_the_create_table_column_utilities_to_define_columns]: true;
|
|
95
94
|
};
|
|
96
95
|
export declare type CoreColumn<TGenerics extends PartialGenerics> = {
|
|
97
96
|
id: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CustomFilterTypes } from './features/Filters';
|
|
2
2
|
import { CustomAggregationTypes } from './features/Grouping';
|
|
3
3
|
import { CustomSortingTypes } from './features/Sorting';
|
|
4
|
-
import { ColumnDef, AccessorFn, PartialGenerics,
|
|
4
|
+
import { ColumnDef, AccessorFn, PartialGenerics, AnyRender } from './types';
|
|
5
5
|
import { Overwrite, PartialKeys } from './utils';
|
|
6
6
|
export declare type CreateTableFactory<TGenerics extends PartialGenerics> = <TSubGenerics extends {
|
|
7
7
|
Row: any;
|
|
@@ -17,35 +17,34 @@ export declare type CreateTableFactoryOptions<TRender extends AnyRender, TFilter
|
|
|
17
17
|
aggregationFns?: TAggregationFns;
|
|
18
18
|
};
|
|
19
19
|
export declare type Table<TGenerics extends PartialGenerics> = {
|
|
20
|
+
generics: TGenerics;
|
|
20
21
|
__options: CreateTableFactoryOptions<any, any, any, any>;
|
|
21
|
-
createColumns: (columns:
|
|
22
|
-
createGroup: (column: Overwrite<Overwrite<
|
|
22
|
+
createColumns: <TColumnDef extends ColumnDef<any>>(columns: TColumnDef[]) => TColumnDef[];
|
|
23
|
+
createGroup: (column: Overwrite<Overwrite<ColumnDef<any>, {
|
|
23
24
|
header: string;
|
|
24
25
|
id?: string;
|
|
25
|
-
}> | Overwrite<
|
|
26
|
+
}> | Overwrite<ColumnDef<any>, {
|
|
26
27
|
id: string;
|
|
27
|
-
header?: string |
|
|
28
|
+
header?: string | ((...any: any) => any);
|
|
28
29
|
}>, {
|
|
29
30
|
accessorFn?: never;
|
|
30
31
|
accessorKey?: never;
|
|
31
32
|
columns?: ColumnDef<any>[];
|
|
32
33
|
}>) => ColumnDef<TGenerics>;
|
|
33
|
-
createDisplayColumn: (column:
|
|
34
|
+
createDisplayColumn: (column: Overwrite<PartialKeys<ColumnDef<TGenerics>, 'accessorFn' | 'accessorKey'>, {
|
|
34
35
|
columns?: ColumnDef<any>[];
|
|
35
|
-
}
|
|
36
|
-
createDataColumn: <TAccessor extends AccessorFn<TGenerics['Row']> | keyof TGenerics['Row']>(accessor: TAccessor, column: Overwrite<TAccessor extends (...args: any[]) => any ?
|
|
36
|
+
}>) => ColumnDef<TGenerics>;
|
|
37
|
+
createDataColumn: <TAccessor extends AccessorFn<TGenerics['Row']> | keyof TGenerics['Row']>(accessor: TAccessor, column: Overwrite<TAccessor extends (...args: any[]) => any ? ColumnDef<Overwrite<TGenerics, {
|
|
37
38
|
Value: ReturnType<TAccessor>;
|
|
38
|
-
}
|
|
39
|
+
}>> : TAccessor extends keyof TGenerics['Row'] ? Overwrite<ColumnDef<Overwrite<TGenerics, {
|
|
39
40
|
Value: TGenerics['Row'][TAccessor];
|
|
40
|
-
}
|
|
41
|
+
}>>, {
|
|
41
42
|
id?: string;
|
|
42
43
|
}> : never, {
|
|
43
44
|
accessorFn?: never;
|
|
44
45
|
accessorKey?: never;
|
|
45
46
|
columns?: ColumnDef<any>[];
|
|
46
|
-
}>) => ColumnDef<
|
|
47
|
-
Value: TAccessor extends (...args: any[]) => any ? ReturnType<TAccessor> : TAccessor extends keyof TGenerics['Row'] ? TGenerics['Row'][TAccessor] : never;
|
|
48
|
-
}>>;
|
|
47
|
+
}>) => ColumnDef<TGenerics>;
|
|
49
48
|
};
|
|
50
49
|
declare type InitTable<TRender extends AnyRender> = {
|
|
51
50
|
createTableFactory: <TGenerics extends PartialGenerics>(options?: CreateTableFactoryOptions<TRender, any, any, any>) => CreateTableFactory<Overwrite<TGenerics, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Getter, OnChangeFn, PartialGenerics, PropGetterValue, TableInstance, Row, RowModel, Updater
|
|
1
|
+
import { Getter, OnChangeFn, PartialGenerics, PropGetterValue, TableInstance, Row, RowModel, Updater } from '../types';
|
|
2
2
|
export declare type RowSelectionState = Record<string, boolean>;
|
|
3
3
|
export declare type RowSelectionTableState = {
|
|
4
4
|
rowSelection: RowSelectionState;
|
|
@@ -54,6 +54,6 @@ export declare const RowSelection: {
|
|
|
54
54
|
getInstance: <TGenerics_1 extends Partial<import("../types").DefaultGenerics>>(instance: TableInstance<TGenerics_1>) => RowSelectionInstance<TGenerics_1>;
|
|
55
55
|
createRow: <TGenerics_2 extends Partial<import("../types").DefaultGenerics>>(row: Row<TGenerics_2>, instance: TableInstance<TGenerics_2>) => RowSelectionRow;
|
|
56
56
|
};
|
|
57
|
-
export declare function selectRowsFn<TGenerics extends
|
|
57
|
+
export declare function selectRowsFn<TGenerics extends PartialGenerics>(instance: TableInstance<TGenerics>, rowModel: RowModel<TGenerics>): RowModel<TGenerics>;
|
|
58
58
|
export declare function isRowSelected<TGenerics extends PartialGenerics>(row: Row<TGenerics>, selection: Record<string, boolean>, instance: TableInstance<TGenerics>): boolean | 'some';
|
|
59
59
|
export {};
|
package/build/types/types.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare type AnyRender = (Comp: any, props: any) => any;
|
|
|
24
24
|
export declare type UseRenderer<TGenerics extends PartialGenerics> = TGenerics['Render'] extends (...args: any) => any ? TGenerics['Render'] : any;
|
|
25
25
|
export declare type PartialGenerics = Partial<DefaultGenerics>;
|
|
26
26
|
export declare type AnyGenerics = {
|
|
27
|
-
[TKey in keyof PartialGenerics]
|
|
27
|
+
[TKey in keyof PartialGenerics]?: any;
|
|
28
28
|
};
|
|
29
29
|
export declare type TableInstance<TGenerics extends PartialGenerics> = TableCore<TGenerics> & VisibilityInstance<TGenerics> & ColumnOrderInstance<TGenerics> & ColumnPinningInstance<TGenerics> & HeadersInstance<TGenerics> & FiltersInstance<TGenerics> & SortingInstance<TGenerics> & GroupingInstance<TGenerics> & ColumnSizingInstance<TGenerics> & ExpandedInstance<TGenerics> & PaginationInstance<TGenerics> & RowSelectionInstance<TGenerics>;
|
|
30
30
|
export declare type Options<TGenerics extends PartialGenerics> = CoreOptions<TGenerics> & VisibilityOptions & ColumnOrderOptions & ColumnPinningOptions & FiltersOptions<TGenerics> & SortingOptions<TGenerics> & GroupingOptions<TGenerics> & ExpandedOptions<TGenerics> & ColumnSizingOptions & PaginationOptions<TGenerics> & RowSelectionOptions<TGenerics>;
|
|
@@ -41,10 +41,6 @@ export declare type RowModel<TGenerics extends PartialGenerics> = {
|
|
|
41
41
|
rowsById: Record<string, Row<TGenerics>>;
|
|
42
42
|
};
|
|
43
43
|
export declare type AccessorFn<TData> = (originalRow: TData, index: number) => any;
|
|
44
|
-
export declare const Please_use_the_create_table_column_utilities_to_define_columns: unique symbol;
|
|
45
|
-
export declare type _NonGenerated<T> = Overwrite<T, {
|
|
46
|
-
[Please_use_the_create_table_column_utilities_to_define_columns]?: never;
|
|
47
|
-
}>;
|
|
48
44
|
export declare type Renderable<TGenerics extends PartialGenerics, TProps> = string | ((props: TProps) => ReturnType<UseRenderer<TGenerics>>);
|
|
49
45
|
export declare type ColumnDef<TGenerics extends PartialGenerics> = CoreColumnDef<TGenerics> & VisibilityColumnDef & ColumnPinningColumnDef & FiltersColumnDef<TGenerics> & SortingColumnDef<TGenerics> & GroupingColumnDef<TGenerics> & ColumnSizingColumnDef;
|
|
50
46
|
export declare type Column<TGenerics extends PartialGenerics> = ColumnDef<TGenerics> & CoreColumn<TGenerics> & ColumnVisibilityColumn & ColumnPinningColumn & FiltersColumn<TGenerics> & SortingColumn<TGenerics> & GroupingColumn<TGenerics> & ColumnSizingColumn<TGenerics>;
|
|
@@ -223,9 +223,6 @@
|
|
|
223
223
|
// return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString()
|
|
224
224
|
// }
|
|
225
225
|
|
|
226
|
-
//
|
|
227
|
-
var Please_use_the_create_table_column_utilities_to_define_columns = Symbol();
|
|
228
|
-
|
|
229
226
|
//
|
|
230
227
|
var Visibility = {
|
|
231
228
|
getInitialState: function getInitialState() {
|
|
@@ -2780,9 +2777,6 @@
|
|
|
2780
2777
|
return {
|
|
2781
2778
|
onExpandedChange: makeStateUpdater('expanded', instance),
|
|
2782
2779
|
autoResetExpanded: true,
|
|
2783
|
-
getIsRowExpanded: function getIsRowExpanded(row) {
|
|
2784
|
-
return !!(row == null ? void 0 : row.original).expanded;
|
|
2785
|
-
},
|
|
2786
2780
|
expandSubRows: true,
|
|
2787
2781
|
paginateExpandedRows: true
|
|
2788
2782
|
};
|
|
@@ -2857,7 +2851,7 @@
|
|
|
2857
2851
|
getIsRowExpanded: function getIsRowExpanded(rowId) {
|
|
2858
2852
|
var _instance$options$get;
|
|
2859
2853
|
|
|
2860
|
-
var row = instance.
|
|
2854
|
+
var row = instance.getPreExpandedRowModel().rowsById[rowId];
|
|
2861
2855
|
|
|
2862
2856
|
if (!row) {
|
|
2863
2857
|
{
|
|
@@ -2868,7 +2862,7 @@
|
|
|
2868
2862
|
}
|
|
2869
2863
|
|
|
2870
2864
|
var expanded = instance.getState().expanded;
|
|
2871
|
-
return !!((_instance$options$get = instance.options.getIsRowExpanded == null ? void 0 : instance.options.getIsRowExpanded(row)) != null ? _instance$options$get : expanded || (expanded == null ? void 0 : expanded[rowId]));
|
|
2865
|
+
return !!((_instance$options$get = instance.options.getIsRowExpanded == null ? void 0 : instance.options.getIsRowExpanded(row)) != null ? _instance$options$get : expanded === true || (expanded == null ? void 0 : expanded[rowId]));
|
|
2872
2866
|
},
|
|
2873
2867
|
getRowCanExpand: function getRowCanExpand(rowId) {
|
|
2874
2868
|
var _ref, _ref2, _instance$options$get2, _row$subRows;
|
|
@@ -2942,7 +2936,7 @@
|
|
|
2942
2936
|
return [instance.getState().expanded, instance.getGroupedRowModel(), instance.options.expandRowsFn, instance.options.paginateExpandedRows];
|
|
2943
2937
|
}, function (expanded, rowModel, expandRowsFn, paginateExpandedRows) {
|
|
2944
2938
|
if (!expandRowsFn || // Do not expand if rows are not included in pagination
|
|
2945
|
-
!paginateExpandedRows || !Object.keys(expanded != null ? expanded : {}).length) {
|
|
2939
|
+
!paginateExpandedRows || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
|
|
2946
2940
|
return rowModel;
|
|
2947
2941
|
}
|
|
2948
2942
|
|
|
@@ -2953,9 +2947,6 @@
|
|
|
2953
2947
|
var _instance$options$deb;
|
|
2954
2948
|
|
|
2955
2949
|
return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
|
|
2956
|
-
},
|
|
2957
|
-
onChange: function onChange() {
|
|
2958
|
-
instance._notifyPageIndexReset();
|
|
2959
2950
|
}
|
|
2960
2951
|
}),
|
|
2961
2952
|
getPreExpandedRowModel: function getPreExpandedRowModel() {
|
|
@@ -3107,8 +3098,8 @@
|
|
|
3107
3098
|
getCanNextPage: function getCanNextPage() {
|
|
3108
3099
|
var _instance$getState$pa = instance.getState().pagination,
|
|
3109
3100
|
pageIndex = _instance$getState$pa.pageIndex,
|
|
3110
|
-
pageCount = _instance$getState$pa.pageCount,
|
|
3111
3101
|
pageSize = _instance$getState$pa.pageSize;
|
|
3102
|
+
var pageCount = instance.getPageCount();
|
|
3112
3103
|
|
|
3113
3104
|
if (pageCount === -1) {
|
|
3114
3105
|
return true;
|
|
@@ -4200,6 +4191,7 @@
|
|
|
4200
4191
|
|
|
4201
4192
|
function _createTable(_, __, __options) {
|
|
4202
4193
|
return {
|
|
4194
|
+
generics: undefined,
|
|
4203
4195
|
__options: __options != null ? __options : {
|
|
4204
4196
|
render: function render() {
|
|
4205
4197
|
throw new Error();
|
|
@@ -4656,14 +4648,13 @@
|
|
|
4656
4648
|
|
|
4657
4649
|
function expandRowsFn(instance, sortedRowModel) {
|
|
4658
4650
|
var expandedRows = [];
|
|
4659
|
-
var expandSubRows = instance.options.expandSubRows;
|
|
4660
4651
|
|
|
4661
4652
|
var handleRow = function handleRow(row) {
|
|
4662
4653
|
var _row$subRows;
|
|
4663
4654
|
|
|
4664
4655
|
expandedRows.push(row);
|
|
4665
4656
|
|
|
4666
|
-
if (expandSubRows && (_row$subRows = row.subRows) != null && _row$subRows.length && instance.getIsRowExpanded(row.id)) {
|
|
4657
|
+
if (instance.options.expandSubRows && (_row$subRows = row.subRows) != null && _row$subRows.length && instance.getIsRowExpanded(row.id)) {
|
|
4667
4658
|
row.subRows.forEach(handleRow);
|
|
4668
4659
|
}
|
|
4669
4660
|
};
|
|
@@ -4710,7 +4701,6 @@
|
|
|
4710
4701
|
exports.Ordering = Ordering;
|
|
4711
4702
|
exports.Pagination = Pagination;
|
|
4712
4703
|
exports.Pinning = Pinning;
|
|
4713
|
-
exports.Please_use_the_create_table_column_utilities_to_define_columns = Please_use_the_create_table_column_utilities_to_define_columns;
|
|
4714
4704
|
exports.RowSelection = RowSelection;
|
|
4715
4705
|
exports.Sorting = Sorting;
|
|
4716
4706
|
exports.Visibility = Visibility;
|