@tanstack/table-core 8.0.0-alpha.11 → 8.0.0-alpha.12
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/features/Sorting.js +14 -3
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/esm/index.js +14 -3
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +259 -259
- package/build/types/features/Sorting.d.ts +2 -1
- package/build/umd/index.development.js +14 -3
- 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/features/Sorting.ts +11 -3
|
@@ -36,6 +36,7 @@ export declare type SortingColumn<TGenerics extends PartialGenerics> = {
|
|
|
36
36
|
getCanMultiSort: () => boolean;
|
|
37
37
|
getSortIndex: () => number;
|
|
38
38
|
getIsSorted: () => false | SortDirection;
|
|
39
|
+
resetSorting: () => void;
|
|
39
40
|
toggleSorting: (desc?: boolean, isMulti?: boolean) => void;
|
|
40
41
|
getToggleSortingProps: <TGetter extends Getter<ToggleSortingProps>>(userProps?: TGetter) => undefined | PropGetterValue<ToggleSortingProps, TGetter>;
|
|
41
42
|
};
|
|
@@ -63,7 +64,7 @@ export declare type SortingInstance<TGenerics extends PartialGenerics> = {
|
|
|
63
64
|
getColumnSortingFn: (columnId: string) => SortingFn<TGenerics> | undefined;
|
|
64
65
|
setSorting: (updater: Updater<SortingState>) => void;
|
|
65
66
|
toggleColumnSorting: (columnId: string, desc?: boolean, multi?: boolean) => void;
|
|
66
|
-
resetSorting: () => void;
|
|
67
|
+
resetSorting: (columnId?: string) => void;
|
|
67
68
|
getColumnCanSort: (columnId: string) => boolean;
|
|
68
69
|
getColumnCanMultiSort: (columnId: string) => boolean;
|
|
69
70
|
getColumnIsSorted: (columnId: string) => false | 'asc' | 'desc';
|
|
@@ -2515,6 +2515,9 @@
|
|
|
2515
2515
|
getIsSorted: function getIsSorted() {
|
|
2516
2516
|
return instance.getColumnIsSorted(column.id);
|
|
2517
2517
|
},
|
|
2518
|
+
resetSorting: function resetSorting() {
|
|
2519
|
+
return instance.resetSorting(column.id);
|
|
2520
|
+
},
|
|
2518
2521
|
toggleSorting: function toggleSorting(desc, isMulti) {
|
|
2519
2522
|
return instance.toggleColumnSorting(column.id, desc, isMulti);
|
|
2520
2523
|
},
|
|
@@ -2724,10 +2727,18 @@
|
|
|
2724
2727
|
return d.id === columnId;
|
|
2725
2728
|
})) != null ? _instance$getState$so2 : -1;
|
|
2726
2729
|
},
|
|
2727
|
-
resetSorting: function resetSorting() {
|
|
2728
|
-
|
|
2730
|
+
resetSorting: function resetSorting(columnId) {
|
|
2731
|
+
if (columnId) {
|
|
2732
|
+
instance.setSorting(function (old) {
|
|
2733
|
+
return old != null && old.length ? old.filter(function (d) {
|
|
2734
|
+
return d.id !== columnId;
|
|
2735
|
+
}) : [];
|
|
2736
|
+
});
|
|
2737
|
+
} else {
|
|
2738
|
+
var _instance$initialStat, _instance$initialStat2;
|
|
2729
2739
|
|
|
2730
|
-
|
|
2740
|
+
instance.setSorting((_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
|
|
2741
|
+
}
|
|
2731
2742
|
},
|
|
2732
2743
|
getToggleSortingProps: function getToggleSortingProps(columnId, userProps) {
|
|
2733
2744
|
var column = instance.getColumn(columnId);
|