ab-ui-library 1.34.5 → 1.34.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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Table } from '@tanstack/react-table';
|
|
2
|
-
export declare const useTableColumnSettings: <T>(table: Table<T>, tableName: string, shouldPersistToStorage: boolean) => void;
|
|
2
|
+
export declare const useTableColumnSettings: <T>(table: Table<T>, tableName: string, shouldPersistToStorage: boolean, uniqueName?: string) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRef, useEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
var useTableColumnSettings = function useTableColumnSettings(table, tableName, shouldPersistToStorage) {
|
|
3
|
+
var useTableColumnSettings = function useTableColumnSettings(table, tableName, shouldPersistToStorage, uniqueName) {
|
|
4
4
|
var prevSettings = useRef(null);
|
|
5
5
|
var state = table.getState();
|
|
6
6
|
useEffect(function () {
|
|
@@ -10,7 +10,7 @@ var useTableColumnSettings = function useTableColumnSettings(table, tableName, s
|
|
|
10
10
|
columnSizing: state.columnSizing
|
|
11
11
|
};
|
|
12
12
|
var serialized = JSON.stringify(settings);
|
|
13
|
-
if (prevSettings.current !== serialized && shouldPersistToStorage) {
|
|
13
|
+
if (prevSettings.current !== serialized && shouldPersistToStorage && !!uniqueName) {
|
|
14
14
|
localStorage.setItem(tableName, serialized);
|
|
15
15
|
prevSettings.current = serialized;
|
|
16
16
|
}
|
|
@@ -208,7 +208,7 @@ function useTableControl(_ref) {
|
|
|
208
208
|
enableRowSelection: true,
|
|
209
209
|
enableColumnResizing: true
|
|
210
210
|
});
|
|
211
|
-
useTableColumnSettings(table, tableName, shouldPersistToStorage);
|
|
211
|
+
useTableColumnSettings(table, tableName, shouldPersistToStorage, tableSettings === null || tableSettings === void 0 ? void 0 : tableSettings.tableName);
|
|
212
212
|
var sensors = useSensors(useSensor(MouseSensor, {
|
|
213
213
|
activationConstraint: {
|
|
214
214
|
distance: 8
|
|
@@ -27,7 +27,7 @@ export type TTableProps<TData> = {
|
|
|
27
27
|
defaultHiddenColumns?: string[];
|
|
28
28
|
collapsibleRows?: boolean;
|
|
29
29
|
tableSettings?: {
|
|
30
|
-
tableName
|
|
30
|
+
tableName?: string;
|
|
31
31
|
persistColumnSettings?: TPersistColumnSettings;
|
|
32
32
|
onColumnSettingsChange?: (settings: ColumnSettings) => void;
|
|
33
33
|
};
|