@m4l/components 9.3.41-JT04122025.beta.2 → 9.3.41-JT04122025.beta.3
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/components/DataGrid/helpers/saveViewConfig/saveViewConfig.js +1 -1
- package/hooks/useDataGridPersistence/constants.d.ts +1 -0
- package/hooks/useDataGridPersistence/constants.js +4 -2
- package/hooks/useDataGridPersistence/helpers.d.ts +5 -1
- package/hooks/useDataGridPersistence/helpers.js +8 -1
- package/hooks/useDataGridPersistence/useDataGridPersistence.js +5 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const saveViewConfig = (id, viewSuffix, config, onChangeConfig) => {
|
|
2
2
|
if (onChangeConfig) {
|
|
3
|
-
const reason = viewSuffix === "" ? "columnsConfig" : `columnsConfig${viewSuffix.replace("_", "")}`;
|
|
3
|
+
const reason = viewSuffix === "" ? "columnsConfig" : `columnsConfig${viewSuffix.replace("_", "").charAt(0).toUpperCase()}${viewSuffix.replace("_", "").slice(1)}`;
|
|
4
4
|
onChangeConfig({
|
|
5
5
|
reason,
|
|
6
6
|
userConfig: config
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const M4LDYNAMIC_KEY_FILTER_AND_SORT = "M4LDynamicFilterAndSort";
|
|
2
2
|
export declare const COOKIE_COLUMNS_WIDTHS = "columns_widths";
|
|
3
3
|
export declare const COOKIE_COLUMNS_CONFIG = "columns_config";
|
|
4
|
+
export declare const COOKIE_COLUMNS_CONFIG_CARDS = "columns_config_cards";
|
|
4
5
|
export declare const COOKIE_VIEW_MODE = "view_mode";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
const COOKIE_COLUMNS_WIDTHS = "columns_widths";
|
|
2
2
|
const COOKIE_COLUMNS_CONFIG = "columns_config";
|
|
3
|
+
const COOKIE_COLUMNS_CONFIG_CARDS = "columns_config_cards";
|
|
3
4
|
const COOKIE_VIEW_MODE = "view_mode";
|
|
4
5
|
export {
|
|
5
6
|
COOKIE_VIEW_MODE as C,
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
COOKIE_COLUMNS_CONFIG_CARDS as a,
|
|
8
|
+
COOKIE_COLUMNS_CONFIG as b,
|
|
9
|
+
COOKIE_COLUMNS_WIDTHS as c
|
|
8
10
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { IGridConfigExtended } from '../../components/DataGrid';
|
|
2
2
|
/**
|
|
3
|
-
* Obtiene
|
|
3
|
+
* Obtiene la configuración de columnas de tabla desde la cookie
|
|
4
4
|
*/
|
|
5
5
|
export declare const getColumnsConfigCookie: (cookie: Record<string, any> | undefined | Array<any>) => IGridConfigExtended["columnsConfig"];
|
|
6
|
+
/**
|
|
7
|
+
* Obtiene la configuración de columnas de cards desde la cookie
|
|
8
|
+
*/
|
|
9
|
+
export declare const getColumnsConfigCardsCookie: (cookie: Record<string, any> | undefined | Array<any>) => IGridConfigExtended["columnsConfigCards"];
|
|
@@ -4,6 +4,13 @@ const getColumnsConfigCookie = (cookie) => {
|
|
|
4
4
|
}
|
|
5
5
|
return [];
|
|
6
6
|
};
|
|
7
|
+
const getColumnsConfigCardsCookie = (cookie) => {
|
|
8
|
+
if (Array.isArray(cookie)) {
|
|
9
|
+
return cookie;
|
|
10
|
+
}
|
|
11
|
+
return [];
|
|
12
|
+
};
|
|
7
13
|
export {
|
|
8
|
-
getColumnsConfigCookie as
|
|
14
|
+
getColumnsConfigCookie as a,
|
|
15
|
+
getColumnsConfigCardsCookie as g
|
|
9
16
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useCallback } from "react";
|
|
2
|
-
import { g as getColumnsConfigCookie } from "./helpers.js";
|
|
3
|
-
import { C as COOKIE_VIEW_MODE, a as
|
|
2
|
+
import { g as getColumnsConfigCardsCookie, a as getColumnsConfigCookie } from "./helpers.js";
|
|
3
|
+
import { C as COOKIE_VIEW_MODE, a as COOKIE_COLUMNS_CONFIG_CARDS, b as COOKIE_COLUMNS_CONFIG, c as COOKIE_COLUMNS_WIDTHS } from "./constants.js";
|
|
4
4
|
import { u as useWindowToolsMF } from "../../components/WindowBase/hooks/useWindowToolsMF/index.js";
|
|
5
5
|
const useDataGridPersistence = (props) => {
|
|
6
6
|
const { prefixCookie } = props;
|
|
@@ -9,6 +9,7 @@ const useDataGridPersistence = (props) => {
|
|
|
9
9
|
return {
|
|
10
10
|
columnsWidths: getCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_WIDTHS}` : COOKIE_COLUMNS_WIDTHS) || {},
|
|
11
11
|
columnsConfig: getColumnsConfigCookie(getCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_CONFIG}` : COOKIE_COLUMNS_CONFIG)) || [],
|
|
12
|
+
columnsConfigCards: getColumnsConfigCardsCookie(getCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_CONFIG_CARDS}` : COOKIE_COLUMNS_CONFIG_CARDS)) || [],
|
|
12
13
|
viewMode: getCookie(prefixCookie ? `${prefixCookie}_${COOKIE_VIEW_MODE}` : COOKIE_VIEW_MODE) || "table"
|
|
13
14
|
};
|
|
14
15
|
});
|
|
@@ -19,6 +20,8 @@ const useDataGridPersistence = (props) => {
|
|
|
19
20
|
}
|
|
20
21
|
if (reason === "columnsConfig") {
|
|
21
22
|
setCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_CONFIG}` : COOKIE_COLUMNS_CONFIG, "window", userConfig);
|
|
23
|
+
} else if (reason === "columnsConfigCards") {
|
|
24
|
+
setCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_CONFIG_CARDS}` : COOKIE_COLUMNS_CONFIG_CARDS, "window", userConfig);
|
|
22
25
|
} else if (reason === "columnsWidths") {
|
|
23
26
|
setCookie(prefixCookie ? `${prefixCookie}_${COOKIE_COLUMNS_WIDTHS}` : COOKIE_COLUMNS_WIDTHS, "window", userConfig);
|
|
24
27
|
} else if (reason === "viewMode") {
|