@tanstack/react-table 8.0.0-alpha.5 → 8.0.0-alpha.6
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/features/Expanding.js +5 -9
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js +3 -3
- 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/Pagination.js +2 -2
- package/build/cjs/features/Pagination.js.map +1 -1
- package/build/cjs/features/Pinning.js +2 -2
- package/build/cjs/features/Pinning.js.map +1 -1
- package/build/cjs/features/Sorting.js +2 -2
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/utils.js +9 -14
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +25 -34
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +241 -241
- package/build/types/core.d.ts +0 -2
- package/build/types/utils.d.ts +0 -4
- package/build/umd/index.development.js +25 -34
- 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 +0 -90
- package/src/features/Expanding.ts +5 -3
- package/src/features/Filters.ts +4 -4
- package/src/features/Grouping.ts +1 -1
- package/src/features/Pagination.ts +1 -3
- package/src/features/Pinning.ts +1 -3
- package/src/features/Sorting.ts +1 -1
- package/src/utils.tsx +7 -69
package/build/types/core.d.ts
CHANGED
|
@@ -76,8 +76,6 @@ export declare type CoreColumnDef<TData, TValue, TFilterFns, TSortingFns, TAggre
|
|
|
76
76
|
header: Header<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
77
77
|
column: Column<TData, TValue, TFilterFns, TSortingFns, TAggregationFns>;
|
|
78
78
|
}>;
|
|
79
|
-
} & // instance: ReactTable< // | Renderable<{ // | string // header?: // accessorKey?: never // id: string // accessorFn: AccessorFn<TData> // | {
|
|
80
|
-
{
|
|
81
79
|
__generated: true;
|
|
82
80
|
width?: number;
|
|
83
81
|
minWidth?: number;
|
package/build/types/utils.d.ts
CHANGED
|
@@ -9,9 +9,6 @@ export declare type Updater<TInput, TOutput> = TOutput | DataUpdateFunction<TInp
|
|
|
9
9
|
export declare function functionalUpdate<TInput, TOutput = TInput>(updater: Updater<TInput, TOutput>, input: TInput): TOutput;
|
|
10
10
|
export declare function noop(): void;
|
|
11
11
|
export declare function makeStateUpdater(key: keyof TableState, instance: unknown): (updater: Updater<any, any>) => void;
|
|
12
|
-
export declare const safeUseLayoutEffect: typeof React.useLayoutEffect;
|
|
13
|
-
export declare function useMountedLayoutEffect(fn: any, deps: any[]): void;
|
|
14
|
-
export declare function useGetLatest<T>(obj: T): () => T;
|
|
15
12
|
declare type AnyFunction = (...args: any) => any;
|
|
16
13
|
export declare function isFunction<T extends AnyFunction>(d: any): d is T;
|
|
17
14
|
export declare function flattenBy<TNode>(arr: TNode[], getChildren: (item: TNode) => TNode[]): TNode[];
|
|
@@ -22,7 +19,6 @@ export declare function memo<TDeps extends readonly any[], TResult>(getDeps: ()
|
|
|
22
19
|
debug?: boolean;
|
|
23
20
|
onChange?: (result: TResult, previousResult?: TResult) => void;
|
|
24
21
|
}): () => TResult;
|
|
25
|
-
export declare function isPlainObject(o: any): o is Object;
|
|
26
22
|
export declare type Render = typeof flexRender;
|
|
27
23
|
export declare function flexRender<TProps extends {}>(Comp: Renderable<TProps>, props: TProps): React.ReactNode;
|
|
28
24
|
export {};
|
|
@@ -416,9 +416,7 @@
|
|
|
416
416
|
return _extends({}, old, (_extends2 = {}, _extends2[key] = functionalUpdate(updater, old[key]), _extends2));
|
|
417
417
|
});
|
|
418
418
|
};
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
typeof document !== 'undefined' ? React__default["default"].useLayoutEffect : React__default["default"].useEffect;
|
|
419
|
+
}
|
|
422
420
|
function isFunction(d) {
|
|
423
421
|
return d instanceof Function;
|
|
424
422
|
}
|
|
@@ -452,19 +450,17 @@
|
|
|
452
450
|
var result;
|
|
453
451
|
return function () {
|
|
454
452
|
var newDeps = getDeps();
|
|
455
|
-
var
|
|
456
|
-
|
|
457
|
-
var depsChanged = newSerializedDeps.length !== oldSerializedDeps.length || newSerializedDeps.some(function (dep, index) {
|
|
458
|
-
return oldSerializedDeps[index] !== dep;
|
|
453
|
+
var depsChanged = newDeps.length !== deps.length || newDeps.some(function (dep, index) {
|
|
454
|
+
return deps[index] !== dep;
|
|
459
455
|
});
|
|
460
456
|
|
|
461
457
|
if (depsChanged) {
|
|
462
458
|
if (opts != null && opts.debug) {
|
|
463
459
|
console.info(opts == null ? void 0 : opts.key, _extends({
|
|
464
|
-
length:
|
|
465
|
-
},
|
|
466
|
-
if (
|
|
467
|
-
return [index,
|
|
460
|
+
length: deps.length + " -> " + newDeps.length
|
|
461
|
+
}, newDeps.map(function (_, index) {
|
|
462
|
+
if (deps[index] !== newDeps[index]) {
|
|
463
|
+
return [index, deps[index], newDeps[index]];
|
|
468
464
|
}
|
|
469
465
|
|
|
470
466
|
return false;
|
|
@@ -479,15 +475,14 @@
|
|
|
479
475
|
|
|
480
476
|
var oldResult = result;
|
|
481
477
|
result = fn.apply(void 0, newDeps);
|
|
482
|
-
deps =
|
|
478
|
+
deps = newDeps;
|
|
483
479
|
opts == null ? void 0 : opts.onChange == null ? void 0 : opts.onChange(result, oldResult);
|
|
484
480
|
oldResult = undefined;
|
|
485
481
|
}
|
|
486
482
|
|
|
487
483
|
return result;
|
|
488
484
|
};
|
|
489
|
-
}
|
|
490
|
-
|
|
485
|
+
}
|
|
491
486
|
function flexRender(Comp, props) {
|
|
492
487
|
return !Comp ? null : isReactComponent(Comp) ? /*#__PURE__*/React__default["default"].createElement(Comp, props) : Comp;
|
|
493
488
|
}
|
|
@@ -1089,9 +1084,9 @@
|
|
|
1089
1084
|
return (_instance$getState$gr2 = instance.getState().grouping) == null ? void 0 : _instance$getState$gr2.indexOf(columnId);
|
|
1090
1085
|
},
|
|
1091
1086
|
resetGrouping: function resetGrouping() {
|
|
1092
|
-
var _instance$
|
|
1087
|
+
var _instance$initialStat, _instance$initialStat2;
|
|
1093
1088
|
|
|
1094
|
-
instance.setGrouping((_instance$
|
|
1089
|
+
instance.setGrouping((_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.grouping) != null ? _instance$initialStat : []);
|
|
1095
1090
|
},
|
|
1096
1091
|
getToggleGroupingProps: function getToggleGroupingProps(columnId, userProps) {
|
|
1097
1092
|
var column = instance.getColumn(columnId);
|
|
@@ -1314,9 +1309,9 @@
|
|
|
1314
1309
|
return instance.options.onColumnPinningChange == null ? void 0 : instance.options.onColumnPinningChange(updater, functionalUpdate(updater, instance.getState().columnPinning));
|
|
1315
1310
|
},
|
|
1316
1311
|
resetColumnPinning: function resetColumnPinning() {
|
|
1317
|
-
var _instance$
|
|
1312
|
+
var _instance$initialStat, _instance$initialStat2;
|
|
1318
1313
|
|
|
1319
|
-
return instance.setColumnPinning((_instance$
|
|
1314
|
+
return instance.setColumnPinning((_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnPinning) != null ? _instance$initialStat : {});
|
|
1320
1315
|
},
|
|
1321
1316
|
pinColumn: function pinColumn(columnId, position) {
|
|
1322
1317
|
var column = instance.getColumn(columnId);
|
|
@@ -2398,9 +2393,9 @@
|
|
|
2398
2393
|
});
|
|
2399
2394
|
},
|
|
2400
2395
|
resetColumnFilters: function resetColumnFilters() {
|
|
2401
|
-
var _instance$
|
|
2396
|
+
var _instance$initialStat, _instance$initialStat2;
|
|
2402
2397
|
|
|
2403
|
-
instance.setColumnFilters((_instance$
|
|
2398
|
+
instance.setColumnFilters((_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.columnFilters) != null ? _instance$initialStat : []);
|
|
2404
2399
|
},
|
|
2405
2400
|
getColumnFilteredRowModel: memo(function () {
|
|
2406
2401
|
return [instance.getState().columnFilters, instance.getCoreRowModel(), instance.options.columnFilterRowsFn];
|
|
@@ -2500,7 +2495,7 @@
|
|
|
2500
2495
|
key: 'getGlobalFilteredRowModel',
|
|
2501
2496
|
debug: instance.options.debug,
|
|
2502
2497
|
onChange: function onChange() {
|
|
2503
|
-
|
|
2498
|
+
instance._notifySortingReset();
|
|
2504
2499
|
}
|
|
2505
2500
|
}),
|
|
2506
2501
|
getPreGlobalFilteredRows: function getPreGlobalFilteredRows() {
|
|
@@ -2887,9 +2882,9 @@
|
|
|
2887
2882
|
})) != null ? _instance$getState$so2 : -1;
|
|
2888
2883
|
},
|
|
2889
2884
|
resetSorting: function resetSorting() {
|
|
2890
|
-
var _instance$
|
|
2885
|
+
var _instance$initialStat, _instance$initialStat2;
|
|
2891
2886
|
|
|
2892
|
-
instance.setSorting((_instance$
|
|
2887
|
+
instance.setSorting((_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
|
|
2893
2888
|
},
|
|
2894
2889
|
getToggleSortingProps: function getToggleSortingProps(columnId, userProps) {
|
|
2895
2890
|
var column = instance.getColumn(columnId);
|
|
@@ -2994,13 +2989,9 @@
|
|
|
2994
2989
|
toggleRowExpanded: function toggleRowExpanded(rowId, expanded) {
|
|
2995
2990
|
if (!rowId) return;
|
|
2996
2991
|
instance.setExpanded(function (old) {
|
|
2997
|
-
var
|
|
2998
|
-
|
|
2999
|
-
if (old === void 0) {
|
|
3000
|
-
old = {};
|
|
3001
|
-
}
|
|
2992
|
+
var _expanded;
|
|
3002
2993
|
|
|
3003
|
-
var exists = old === true ? true : !!(
|
|
2994
|
+
var exists = old === true ? true : !!(old != null && old[rowId]);
|
|
3004
2995
|
var oldExpanded = {};
|
|
3005
2996
|
|
|
3006
2997
|
if (old === true) {
|
|
@@ -3038,9 +3029,9 @@
|
|
|
3038
3029
|
}
|
|
3039
3030
|
},
|
|
3040
3031
|
resetExpanded: function resetExpanded() {
|
|
3041
|
-
var _instance$
|
|
3032
|
+
var _instance$initialStat, _instance$initialStat2;
|
|
3042
3033
|
|
|
3043
|
-
instance.setExpanded((_instance$
|
|
3034
|
+
instance.setExpanded((_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.expanded) != null ? _instance$initialStat : {});
|
|
3044
3035
|
},
|
|
3045
3036
|
getIsRowExpanded: function getIsRowExpanded(rowId) {
|
|
3046
3037
|
var _instance$options$get;
|
|
@@ -3140,7 +3131,7 @@
|
|
|
3140
3131
|
key: 'getExpandedRowModel',
|
|
3141
3132
|
debug: instance.options.debug,
|
|
3142
3133
|
onChange: function onChange() {
|
|
3143
|
-
|
|
3134
|
+
instance._notifyPageIndexReset();
|
|
3144
3135
|
}
|
|
3145
3136
|
}),
|
|
3146
3137
|
getPreExpandedRows: function getPreExpandedRows() {
|
|
@@ -3568,9 +3559,9 @@
|
|
|
3568
3559
|
instance.setPageIndex(0);
|
|
3569
3560
|
},
|
|
3570
3561
|
resetPageSize: function resetPageSize() {
|
|
3571
|
-
var _instance$
|
|
3562
|
+
var _instance$initialStat2, _instance$initialStat3, _instance$initialStat4;
|
|
3572
3563
|
|
|
3573
|
-
instance.setPageSize((_instance$
|
|
3564
|
+
instance.setPageSize((_instance$initialStat2 = (_instance$initialStat3 = instance.initialState) == null ? void 0 : (_instance$initialStat4 = _instance$initialStat3.pagination) == null ? void 0 : _instance$initialStat4.pageSize) != null ? _instance$initialStat2 : 10);
|
|
3574
3565
|
},
|
|
3575
3566
|
setPageSize: function setPageSize(updater) {
|
|
3576
3567
|
instance.setPagination(function (old) {
|