@ackplus/react-tanstack-data-table 1.0.24 → 1.0.25
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/package.json
CHANGED
|
@@ -634,7 +634,6 @@ exports.DataTable = (0, react_1.forwardRef)(function DataTable({ initialState, c
|
|
|
634
634
|
});
|
|
635
635
|
},
|
|
636
636
|
resetFilters: () => {
|
|
637
|
-
table.resetGlobalFilter();
|
|
638
637
|
handleColumnFilterStateChange({
|
|
639
638
|
filters: [],
|
|
640
639
|
logic: 'AND',
|
|
@@ -668,7 +667,7 @@ exports.DataTable = (0, react_1.forwardRef)(function DataTable({ initialState, c
|
|
|
668
667
|
table.resetSorting();
|
|
669
668
|
},
|
|
670
669
|
resetSorting: () => {
|
|
671
|
-
table.
|
|
670
|
+
table.setSorting(initialStateConfig.sorting || []);
|
|
672
671
|
},
|
|
673
672
|
},
|
|
674
673
|
pagination: {
|
|
@@ -711,6 +710,9 @@ exports.DataTable = (0, react_1.forwardRef)(function DataTable({ initialState, c
|
|
|
711
710
|
}
|
|
712
711
|
}
|
|
713
712
|
},
|
|
713
|
+
resetPagination: () => {
|
|
714
|
+
table.setPagination(initialStateConfig.pagination || { pageIndex: 0, pageSize: 10 });
|
|
715
|
+
},
|
|
714
716
|
},
|
|
715
717
|
selection: {
|
|
716
718
|
selectRow: (rowId) => { var _a; return (_a = table.selectRow) === null || _a === void 0 ? void 0 : _a.call(table, rowId); },
|
|
@@ -7,32 +7,34 @@ const material_1 = require("@mui/material");
|
|
|
7
7
|
const data_table_context_1 = require("../../contexts/data-table-context");
|
|
8
8
|
const slot_helpers_1 = require("../../utils/slot-helpers");
|
|
9
9
|
function ColumnResetControl(props = {}) {
|
|
10
|
-
const { table, slots, slotProps } = (0, data_table_context_1.useDataTableContext)();
|
|
10
|
+
const { apiRef, table, slots, slotProps } = (0, data_table_context_1.useDataTableContext)();
|
|
11
11
|
const resetIconSlotProps = (0, slot_helpers_1.extractSlotProps)(slotProps, 'resetIcon');
|
|
12
12
|
const ResetIconSlot = (0, slot_helpers_1.getSlotComponent)(slots, 'resetIcon', icons_material_1.Autorenew);
|
|
13
13
|
const handleResetLayout = () => {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
14
15
|
const actions = props.resetActions || ['columnOrder', 'columnPinning', 'columnSizing'];
|
|
16
|
+
if (!(apiRef === null || apiRef === void 0 ? void 0 : apiRef.current))
|
|
17
|
+
return;
|
|
15
18
|
if (actions.includes('columnOrder')) {
|
|
16
|
-
|
|
19
|
+
(_b = (_a = apiRef === null || apiRef === void 0 ? void 0 : apiRef.current) === null || _a === void 0 ? void 0 : _a.columnOrdering) === null || _b === void 0 ? void 0 : _b.resetColumnOrder();
|
|
17
20
|
}
|
|
18
21
|
if (actions.includes('columnPinning')) {
|
|
19
|
-
|
|
22
|
+
(_d = (_c = apiRef === null || apiRef === void 0 ? void 0 : apiRef.current) === null || _c === void 0 ? void 0 : _c.columnPinning) === null || _d === void 0 ? void 0 : _d.resetColumnPinning();
|
|
20
23
|
}
|
|
21
24
|
if (actions.includes('columnSizing')) {
|
|
22
|
-
|
|
25
|
+
(_f = (_e = apiRef === null || apiRef === void 0 ? void 0 : apiRef.current) === null || _e === void 0 ? void 0 : _e.columnResizing) === null || _f === void 0 ? void 0 : _f.resetColumnSizing();
|
|
23
26
|
}
|
|
24
27
|
if (actions.includes('columnVisibility')) {
|
|
25
|
-
|
|
28
|
+
(_h = (_g = apiRef === null || apiRef === void 0 ? void 0 : apiRef.current) === null || _g === void 0 ? void 0 : _g.columnVisibility) === null || _h === void 0 ? void 0 : _h.resetColumnVisibility();
|
|
26
29
|
}
|
|
27
30
|
if (actions.includes('filters')) {
|
|
28
|
-
|
|
29
|
-
table.resetGlobalFilter();
|
|
31
|
+
(_k = (_j = apiRef === null || apiRef === void 0 ? void 0 : apiRef.current) === null || _j === void 0 ? void 0 : _j.filtering) === null || _k === void 0 ? void 0 : _k.clearAllFilters();
|
|
30
32
|
}
|
|
31
33
|
if (actions.includes('sorting')) {
|
|
32
|
-
|
|
34
|
+
(_m = (_l = apiRef === null || apiRef === void 0 ? void 0 : apiRef.current) === null || _l === void 0 ? void 0 : _l.sorting) === null || _m === void 0 ? void 0 : _m.resetSorting();
|
|
33
35
|
}
|
|
34
36
|
if (actions.includes('pagination')) {
|
|
35
|
-
|
|
37
|
+
(_p = (_o = apiRef === null || apiRef === void 0 ? void 0 : apiRef.current) === null || _o === void 0 ? void 0 : _o.pagination) === null || _p === void 0 ? void 0 : _p.resetPagination();
|
|
36
38
|
}
|
|
37
39
|
};
|
|
38
40
|
const mergedIconButtonProps = (0, slot_helpers_1.mergeSlotProps)({
|