@m4l/components 9.4.50 → 9.4.51-beta-fix-683-datagrids-remove-localstorage.0
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/datagrids/helpers/index.d.ts +0 -1
- package/components/datagrids/helpers/index.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/getColumnsWidth/getColumnsWidth.d.ts +3 -5
- package/components/datagrids/helpers/persistence/getColumnsWidth/getColumnsWidth.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/getColumnsWidth/getColumnsWidth.js +9 -20
- package/components/datagrids/helpers/persistence/getViewMode/getViewMode.d.ts +20 -25
- package/components/datagrids/helpers/persistence/getViewMode/getViewMode.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/getViewMode/getViewMode.js +4 -10
- package/components/datagrids/helpers/persistence/saveColumnsWidth/saveColumnsWidth.d.ts +4 -9
- package/components/datagrids/helpers/persistence/saveColumnsWidth/saveColumnsWidth.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/saveColumnsWidth/saveColumnsWidth.js +8 -13
- package/components/datagrids/helpers/persistence/saveViewConfig/saveViewConfig.d.ts +13 -18
- package/components/datagrids/helpers/persistence/saveViewConfig/saveViewConfig.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/saveViewConfig/saveViewConfig.js +8 -11
- package/components/datagrids/helpers/persistence/saveViewMode/saveViewMode.d.ts +14 -17
- package/components/datagrids/helpers/persistence/saveViewMode/saveViewMode.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/saveViewMode/saveViewMode.js +6 -10
- package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.d.ts +18 -19
- package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.d.ts.map +1 -1
- package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.js +11 -16
- package/components/datagrids/helpers/shared/getViewSuffix/getViewSuffix.d.ts +11 -11
- package/components/datagrids/hooks/useChangeColumnsConfig/useChangeColumnsConfig.d.ts +5 -4
- package/components/datagrids/hooks/useChangeColumnsConfig/useChangeColumnsConfig.d.ts.map +1 -1
- package/components/datagrids/hooks/useViewMode/useViewMode.d.ts +13 -13
- package/components/datagrids/hooks/useViewMode/useViewMode.d.ts.map +1 -1
- package/components/datagrids/types.d.ts +2 -2
- package/hooks/useDataGridPersistence/constants.d.ts +1 -0
- package/hooks/useDataGridPersistence/constants.d.ts.map +1 -1
- package/hooks/useDataGridPersistence/constants.js +5 -4
- package/hooks/useDataGridPersistence/helpers.d.ts +4 -0
- package/hooks/useDataGridPersistence/helpers.d.ts.map +1 -1
- package/hooks/useDataGridPersistence/helpers.js +3 -2
- package/hooks/useDataGridPersistence/useDataGridPersistence.d.ts.map +1 -1
- package/hooks/useDataGridPersistence/useDataGridPersistence.js +33 -27
- package/package.json +4 -4
- package/components/datagrids/helpers/persistence/loadViewConfig/index.d.ts +0 -2
- package/components/datagrids/helpers/persistence/loadViewConfig/index.d.ts.map +0 -1
- package/components/datagrids/helpers/persistence/loadViewConfig/loadViewConfig.d.ts +0 -24
- package/components/datagrids/helpers/persistence/loadViewConfig/loadViewConfig.d.ts.map +0 -1
- package/components/datagrids/helpers/persistence/loadViewConfig/loadViewConfig.js +0 -11
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { saveColumnsWidth } from './persistence/saveColumnsWidth';
|
|
2
2
|
export { saveViewConfig } from './persistence/saveViewConfig';
|
|
3
3
|
export { saveViewMode } from './persistence/saveViewMode';
|
|
4
|
-
export { loadViewConfig } from './persistence/loadViewConfig';
|
|
5
4
|
export { getColumnsWidth } from './persistence/getColumnsWidth';
|
|
6
5
|
export { getViewMode } from './persistence/getViewMode';
|
|
7
6
|
export { castMapColumnsWidthToRecord } from './shared/castMapColumnsWidthToRecord';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/datagrids/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/datagrids/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -13,9 +13,7 @@ import { IGridConfig } from './types';
|
|
|
13
13
|
* Configuración que viene de las cookies de red cuando el componente se monta.
|
|
14
14
|
* En producción, esta es la fuente principal de datos persistidos.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* Solo se usa cuando NO hay configuración de cookies de red.
|
|
18
|
-
* Útil para desarrollo o cuando no hay integración con cookies de red.
|
|
16
|
+
* localStorage is not used; configuration must be provided via defaultConfig (network cookies).
|
|
19
17
|
*
|
|
20
18
|
* Si no se encuentra configuración en ninguna fuente, la columna no se incluye
|
|
21
19
|
* en el Map resultante y usará el ancho por defecto definido en la columna.
|
|
@@ -35,10 +33,10 @@ import { IGridConfig } from './types';
|
|
|
35
33
|
* @returns Map donde la key es el identificador de la columna (column.key) y el value
|
|
36
34
|
* es el ancho configurado (número en píxeles o string con unidad CSS)
|
|
37
35
|
* @example
|
|
38
|
-
* //
|
|
36
|
+
* // No network cookie config (no fallback; defaultConfig must come from consumer)
|
|
39
37
|
* const columnsWidths = getColumnsWidth('my-grid', columns, null);
|
|
40
38
|
* @example
|
|
41
|
-
* //
|
|
39
|
+
* // With network cookie config (typical production case)
|
|
42
40
|
* const columnsWidths = getColumnsWidth('my-grid', columns, {
|
|
43
41
|
* columnsWidths: { name: 200, email: 300 }
|
|
44
42
|
* });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getColumnsWidth.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/getColumnsWidth/getColumnsWidth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"getColumnsWidth.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/getColumnsWidth/getColumnsWidth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,EAC/C,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,SAAS,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAC7C,aAAa,EAAE,KAAK,CAAC,WAAW,CAAC,GAChC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAuBrC"}
|
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
3
|
-
let
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
n = t !== null ? new Map(JSON.parse(t)) : /* @__PURE__ */ new Map();
|
|
7
|
-
} catch {
|
|
8
|
-
n = /* @__PURE__ */ new Map();
|
|
9
|
-
}
|
|
10
|
-
for (let t = 0; t < i.length; t++) {
|
|
11
|
-
let e;
|
|
12
|
-
if (r)
|
|
1
|
+
function o(r, e, n) {
|
|
2
|
+
const h = /* @__PURE__ */ new Map();
|
|
3
|
+
for (let t = 0; t < e.length; t++) {
|
|
4
|
+
let i;
|
|
5
|
+
if (n)
|
|
13
6
|
try {
|
|
14
|
-
|
|
7
|
+
i = n.columnsWidths[e[t].key];
|
|
15
8
|
} catch {
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
const o = n.get(i[t].key);
|
|
19
|
-
typeof o == "number" && (e = o);
|
|
20
|
-
}
|
|
21
|
-
e !== void 0 && a.set(i[t].key, e);
|
|
10
|
+
i !== void 0 && h.set(e[t].key, i);
|
|
22
11
|
}
|
|
23
|
-
return
|
|
12
|
+
return h;
|
|
24
13
|
}
|
|
25
14
|
export {
|
|
26
|
-
|
|
15
|
+
o as getColumnsWidth
|
|
27
16
|
};
|
|
@@ -2,41 +2,36 @@ import { Maybe } from '@m4l/core';
|
|
|
2
2
|
import { RowKey } from '../../../types';
|
|
3
3
|
import { IGridConfigExtended, ViewMode } from '../../../contexts/DataGridContext/types';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Gets the DataGrid view mode (table/cards).
|
|
6
6
|
*
|
|
7
|
-
* ##
|
|
7
|
+
* ## Persistence flow
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* This function obtains viewMode following a precedence order:
|
|
10
10
|
*
|
|
11
|
-
* 1. **defaultConfig.viewMode** (
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* 1. **defaultConfig.viewMode** (Network cookies) - Highest priority
|
|
12
|
+
* Configuration that comes from network cookies when the component mounts.
|
|
13
|
+
* In production, this is the main source of persisted data.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
* Solo se usa cuando NO hay configuración de cookies de red.
|
|
17
|
-
* Útil para desarrollo o cuando no hay integración con cookies de red.
|
|
15
|
+
* localStorage is not used.
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* 2. **defaultViewMode** - Developer default value
|
|
18
|
+
* Used when there is no configuration saved in network cookies.
|
|
21
19
|
*
|
|
22
|
-
* ##
|
|
20
|
+
* ## Relation with saveViewMode
|
|
23
21
|
*
|
|
24
|
-
* -
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* -
|
|
28
|
-
* @param
|
|
29
|
-
* @
|
|
30
|
-
* Esta es la fuente principal en producción.
|
|
31
|
-
* @param defaultViewMode - Valor por defecto del desarrollador cuando no hay configuración guardada
|
|
32
|
-
* @returns El viewMode a usar, o undefined si no se encontró configuración
|
|
22
|
+
* - When the user changes view, `saveViewMode` sends changes via the `onChangeConfig` callback
|
|
23
|
+
* - On next load, that data comes back as `defaultConfig.viewMode`
|
|
24
|
+
* @param id - Unique DataGrid identifier (API compatibility)
|
|
25
|
+
* @param defaultConfig - User configuration from network cookies. Main source in production.
|
|
26
|
+
* @param defaultViewMode - Developer default when no configuration is saved
|
|
27
|
+
* @returns The viewMode to use, or undefined if none found
|
|
33
28
|
* @example
|
|
34
|
-
* //
|
|
29
|
+
* // No network cookie config (uses defaultViewMode if provided)
|
|
35
30
|
* const viewMode = getViewMode('my-grid', null, 'table');
|
|
36
31
|
* @example
|
|
37
|
-
* //
|
|
32
|
+
* // With network cookie config (typical production case)
|
|
38
33
|
* const viewMode = getViewMode('my-grid', { viewMode: 'cards' }, 'table');
|
|
39
|
-
* @see saveViewMode -
|
|
34
|
+
* @see saveViewMode - Complementary function to persist view mode
|
|
40
35
|
*/
|
|
41
|
-
export declare function getViewMode(
|
|
36
|
+
export declare function getViewMode(_id: RowKey, defaultConfig: Maybe<IGridConfigExtended>, defaultViewMode?: ViewMode): ViewMode | undefined;
|
|
42
37
|
//# sourceMappingURL=getViewMode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getViewMode.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/getViewMode/getViewMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAExF
|
|
1
|
+
{"version":3,"file":"getViewMode.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/getViewMode/getViewMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAExF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,KAAK,CAAC,mBAAmB,CAAC,EACzC,eAAe,CAAC,EAAE,QAAQ,GACzB,QAAQ,GAAG,SAAS,CAUtB"}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
function
|
|
2
|
-
if (
|
|
3
|
-
return
|
|
4
|
-
try {
|
|
5
|
-
const e = window.localStorage.getItem(`${i}_view_mode`);
|
|
6
|
-
if (e === "cards" || e === "table" || e === "list")
|
|
7
|
-
return e;
|
|
8
|
-
} catch {
|
|
9
|
-
}
|
|
1
|
+
function n(i, e, r) {
|
|
2
|
+
if (e?.viewMode)
|
|
3
|
+
return e.viewMode;
|
|
10
4
|
if (r)
|
|
11
5
|
return r;
|
|
12
6
|
}
|
|
13
7
|
export {
|
|
14
|
-
|
|
8
|
+
n as getViewMode
|
|
15
9
|
};
|
|
@@ -12,9 +12,7 @@ import { RowKey, OnChangeConfig } from '../../../types';
|
|
|
12
12
|
* la persista en cookies de red. En la siguiente carga, estos datos volverán
|
|
13
13
|
* como `defaultConfig` en `getColumnsWidth`.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
* Solo se usa cuando NO hay callback configurado.
|
|
17
|
-
* Útil para desarrollo o cuando no hay integración con cookies de red.
|
|
15
|
+
* localStorage is not used; if no callback is configured, nothing is saved.
|
|
18
16
|
*
|
|
19
17
|
* ## Ciclo completo de persistencia
|
|
20
18
|
*
|
|
@@ -29,7 +27,7 @@ import { RowKey, OnChangeConfig } from '../../../types';
|
|
|
29
27
|
* ↓
|
|
30
28
|
* getColumnsWidth() lee de defaultConfig
|
|
31
29
|
* ```
|
|
32
|
-
* @param id - Identificador único del DataGrid
|
|
30
|
+
* @param id - Identificador único del DataGrid
|
|
33
31
|
* @param storeColumnsWidth - Map con la configuración de anchos donde:
|
|
34
32
|
* - key: identificador de la columna (column.key)
|
|
35
33
|
* - value: ancho en píxeles (number) o string con unidad CSS
|
|
@@ -43,11 +41,8 @@ import { RowKey, OnChangeConfig } from '../../../types';
|
|
|
43
41
|
* // Persistir en cookies de red
|
|
44
42
|
* setCookie(userConfig);
|
|
45
43
|
* });
|
|
46
|
-
* @
|
|
47
|
-
*
|
|
48
|
-
* saveColumnsWidth('my-grid', columnsWidthsMap);
|
|
49
|
-
* @see getColumnsWidth - Función complementaria para obtener la configuración
|
|
50
|
-
* @see castMapColumnsWidthToRecord - Helper usado para convertir el Map a Record
|
|
44
|
+
* @see getColumnsWidth - Complementary function to load configuration
|
|
45
|
+
* @see castMapColumnsWidthToRecord - Helper to convert Map to Record
|
|
51
46
|
*/
|
|
52
47
|
export declare function saveColumnsWidth(id: RowKey, storeColumnsWidth: Map<string, Maybe<string | number>>, onChangeConfig?: OnChangeConfig): void;
|
|
53
48
|
//# sourceMappingURL=saveColumnsWidth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveColumnsWidth.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/saveColumnsWidth/saveColumnsWidth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGxD
|
|
1
|
+
{"version":3,"file":"saveColumnsWidth.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/saveColumnsWidth/saveColumnsWidth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,MAAM,EACV,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,EACtD,cAAc,CAAC,EAAE,cAAc,GAC9B,IAAI,CAYN"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { castMapColumnsWidthToRecord as i } from "../../shared/castMapColumnsWidthToRecord/castMapColumnsWidthToRecord.js";
|
|
2
|
-
function
|
|
3
|
-
if (o)
|
|
4
|
-
const c = i(t);
|
|
5
|
-
o({
|
|
6
|
-
reason: "columnsWidths",
|
|
7
|
-
userConfig: c
|
|
8
|
-
});
|
|
2
|
+
function n(r, t, o) {
|
|
3
|
+
if (!o)
|
|
9
4
|
return;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
5
|
+
const s = i(t);
|
|
6
|
+
o({
|
|
7
|
+
reason: "columnsWidths",
|
|
8
|
+
userConfig: s
|
|
9
|
+
});
|
|
15
10
|
}
|
|
16
11
|
export {
|
|
17
|
-
|
|
12
|
+
n as saveColumnsWidth
|
|
18
13
|
};
|
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
import { RowKey } from '../../../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Saves view configuration or notifies via callback.
|
|
4
4
|
*
|
|
5
|
-
* ##
|
|
5
|
+
* ## Purpose
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Persists column configuration for a specific view.
|
|
8
|
+
* Only external callback (network cookies) is supported. localStorage is not used.
|
|
9
9
|
*
|
|
10
|
-
* ##
|
|
10
|
+
* ## Persistence priority
|
|
11
11
|
*
|
|
12
|
-
* 1.
|
|
13
|
-
* 2.
|
|
12
|
+
* 1. If `onChangeConfig` is present, notifies the callback (to save in network cookies)
|
|
13
|
+
* 2. If no callback, nothing is saved
|
|
14
14
|
*
|
|
15
|
-
* ##
|
|
15
|
+
* ## Key format (reference; persistence is only via callback)
|
|
16
16
|
*
|
|
17
|
-
* ```
|
|
18
17
|
* table: `${id}_columns_config`
|
|
19
18
|
* cards: `${id}_columns_config_cards`
|
|
20
|
-
*
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param onChangeConfig - Callback opcional para notificar cambios (prioridad sobre localStorage)
|
|
19
|
+
* @param id - Unique DataGrid identifier
|
|
20
|
+
* @param viewSuffix - Suffix to identify the view ('' for table, '_cards' for cards)
|
|
21
|
+
* @param config - Configuration array to save
|
|
22
|
+
* @param onChangeConfig - Optional callback to notify changes. If not provided, nothing is saved.
|
|
25
23
|
* @example
|
|
26
|
-
* //
|
|
27
|
-
* saveViewConfig('my-grid', '', config);
|
|
28
|
-
*
|
|
29
|
-
* // Notificar via callback
|
|
24
|
+
* // Notify via callback
|
|
30
25
|
* saveViewConfig('my-grid', '_cards', config, onChangeConfig);
|
|
31
26
|
*/
|
|
32
27
|
export declare const saveViewConfig: <T>(id: RowKey, viewSuffix: string, config: T[], onChangeConfig?: (data: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveViewConfig.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/saveViewConfig/saveViewConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"saveViewConfig.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/saveViewConfig/saveViewConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,EAC9B,IAAI,MAAM,EACV,YAAY,MAAM,EAClB,QAAQ,CAAC,EAAE,EACX,iBAAiB,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,CAAC,EAAE,CAAA;CAAE,KAAK,IAAI,KACnE,IAaF,CAAC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
const
|
|
2
|
-
if (
|
|
3
|
-
const r = o === "" ? "columnsConfig" : `columnsConfig${o.replace("_", "").charAt(0).toUpperCase()}${o.replace("_", "").slice(1)}`;
|
|
4
|
-
e({
|
|
5
|
-
reason: r,
|
|
6
|
-
userConfig: c
|
|
7
|
-
});
|
|
1
|
+
const n = (c, e, r, o) => {
|
|
2
|
+
if (!o)
|
|
8
3
|
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
const s = e === "" ? "columnsConfig" : `columnsConfig${e.replace("_", "").charAt(0).toUpperCase()}${e.replace("_", "").slice(1)}`;
|
|
5
|
+
o({
|
|
6
|
+
reason: s,
|
|
7
|
+
userConfig: r
|
|
8
|
+
});
|
|
12
9
|
};
|
|
13
10
|
export {
|
|
14
|
-
|
|
11
|
+
n as saveViewConfig
|
|
15
12
|
};
|
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
import { ViewMode } from '../../../contexts/DataGridContext/types';
|
|
2
2
|
import { OnChangeConfig, RowKey } from '../../../types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Saves the view mode (table or cards).
|
|
5
5
|
*
|
|
6
|
-
* ##
|
|
6
|
+
* ## Purpose
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Persists the user's preference for the selected view mode.
|
|
9
|
+
* Allows the last used view to be kept on reload when the consumer persists in network cookies.
|
|
10
10
|
*
|
|
11
|
-
* ##
|
|
11
|
+
* ## Save priority
|
|
12
12
|
*
|
|
13
|
-
* 1.
|
|
14
|
-
* 2.
|
|
13
|
+
* 1. If `onChangeConfig` exists → Saves to network cookies
|
|
14
|
+
* 2. If it does not exist → Nothing is saved (localStorage is not used)
|
|
15
15
|
*
|
|
16
|
-
* ##
|
|
16
|
+
* ## Key format (reference; persistence is only via callback)
|
|
17
17
|
*
|
|
18
|
-
* ```
|
|
19
18
|
* `${id}_view_mode` -> 'table' | 'cards'
|
|
20
|
-
*
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param onChangeConfig - Callback opcional para guardar en cookies de red
|
|
19
|
+
* @param id - Unique DataGrid identifier
|
|
20
|
+
* @param viewMode - View mode ('table' | 'cards')
|
|
21
|
+
* @param onChangeConfig - Optional callback to save to network cookies. If not provided, nothing is saved.
|
|
24
22
|
* @example
|
|
25
|
-
* //
|
|
23
|
+
* // With network cookies
|
|
26
24
|
* saveViewMode('my-grid', 'cards', onChangeConfig);
|
|
27
|
-
* //
|
|
25
|
+
* // Calls: onChangeConfig({ reason: 'viewMode', userConfig: 'cards' })
|
|
28
26
|
*
|
|
29
|
-
* //
|
|
27
|
+
* // Without callback: nothing is persisted
|
|
30
28
|
* saveViewMode('my-grid', 'cards');
|
|
31
|
-
* // localStorage: 'my-grid_view_mode' = 'cards'
|
|
32
29
|
*/
|
|
33
30
|
export declare const saveViewMode: (id: RowKey, viewMode: ViewMode, onChangeConfig?: OnChangeConfig) => void;
|
|
34
31
|
//# sourceMappingURL=saveViewMode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveViewMode.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/saveViewMode/saveViewMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExD
|
|
1
|
+
{"version":3,"file":"saveViewMode.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/saveViewMode/saveViewMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,YAAY,GACvB,IAAI,MAAM,EACV,UAAU,QAAQ,EAClB,iBAAiB,cAAc,KAC9B,IAQF,CAAC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
localStorage.setItem(`${r}_view_mode`, e);
|
|
1
|
+
const o = (i, r, e) => {
|
|
2
|
+
e && e({
|
|
3
|
+
reason: "viewMode",
|
|
4
|
+
userConfig: r
|
|
5
|
+
});
|
|
10
6
|
};
|
|
11
7
|
export {
|
|
12
|
-
|
|
8
|
+
o as saveViewMode
|
|
13
9
|
};
|
package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.d.ts
CHANGED
|
@@ -3,29 +3,28 @@ import { RowKey } from '../../../types';
|
|
|
3
3
|
import { BaseViewConfig } from './types';
|
|
4
4
|
import { IViewConfig, ViewMode } from '../../../contexts/DataGridContext/types';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Gets the initial column configuration for any view.
|
|
7
7
|
*
|
|
8
|
-
* ##
|
|
8
|
+
* ## Purpose
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* 1.
|
|
12
|
-
* 2.
|
|
13
|
-
* 3.
|
|
10
|
+
* Generates the initial column configuration by combining:
|
|
11
|
+
* 1. Initial configuration (defaultConfig) when present (from network cookies)
|
|
12
|
+
* 2. Empty config when there is no defaultConfig (localStorage is not used; config comes only from network cookies)
|
|
13
|
+
* 3. Column default values
|
|
14
14
|
*
|
|
15
|
-
* ##
|
|
15
|
+
* ## Configuration priority
|
|
16
16
|
*
|
|
17
|
-
* 1. defaultConfig (
|
|
18
|
-
* 2.
|
|
19
|
-
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
* @
|
|
26
|
-
* @returns Array de configuración de columnas ordenado por índice
|
|
17
|
+
* 1. defaultConfig (initial column configuration from network cookies)
|
|
18
|
+
* 2. Column default values when there is no defaultConfig
|
|
19
|
+
* @param id - Unique DataGrid identifier
|
|
20
|
+
* @param columns - DataGrid columns
|
|
21
|
+
* @param viewMode - Current view mode ('table' | 'cards')
|
|
22
|
+
* @param defaultConfig - Initial column configuration (optional). For "table" view it is the config from each column (visible, frozen, etc.); for "cards" view it comes from cardsViewConfig.columnsConfig
|
|
23
|
+
* @param viewSpecificDefaults - View-specific default values
|
|
24
|
+
* @param originalViewSpecificDefaults - Original view-specific values
|
|
25
|
+
* @returns Array of column configuration sorted by index
|
|
27
26
|
* @example
|
|
28
|
-
* //
|
|
27
|
+
* // For table view
|
|
29
28
|
* getInitialColumnsConfig(
|
|
30
29
|
* 'my-grid',
|
|
31
30
|
* columns,
|
|
@@ -35,7 +34,7 @@ import { IViewConfig, ViewMode } from '../../../contexts/DataGridContext/types';
|
|
|
35
34
|
* { originalFrozen: false }
|
|
36
35
|
* );
|
|
37
36
|
*
|
|
38
|
-
* //
|
|
37
|
+
* // For cards view
|
|
39
38
|
* getInitialColumnsConfig(
|
|
40
39
|
* 'my-grid',
|
|
41
40
|
* columns,
|
package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInitialColumnsConfig.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"getInitialColumnsConfig.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,uBAAuB,GAClC,IAAI,EACJ,WAAW,EACX,aAAa,EACb,qBAAqB,EAEnB,IAAI,MAAM,EACV,SAAS,SAAS,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAC7C,UAAU,QAAQ,EAClB,gBAAgB,cAAc,CAAC,aAAa,CAAC,EAAE,EAC/C,uBAAuB,aAAa,EACpC,+BAA+B,qBAAqB,KACnD,WAAW,CAAC,aAAa,EAAE,qBAAqB,CAAC,EA0DrD,CAAC"}
|
package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.js
CHANGED
|
@@ -1,34 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return o ? g = o : g = C(
|
|
6
|
-
a,
|
|
7
|
-
u(d)
|
|
8
|
-
) || [], t.map((e, i) => {
|
|
9
|
-
const r = g.find((s) => s.key === e.key), n = r ? g.indexOf(r) : -1, p = t.slice(0, i).filter((s) => s.grouped === !0).length, v = {
|
|
1
|
+
const C = (l, s, p, g, a, v) => {
|
|
2
|
+
const d = g ?? [];
|
|
3
|
+
return s.map((e, i) => {
|
|
4
|
+
const r = d.find((o) => o.key === e.key), n = r ? d.indexOf(r) : -1, t = s.slice(0, i).filter((o) => o.grouped === !0).length, b = {
|
|
10
5
|
key: e.key,
|
|
11
6
|
name: typeof e.name == "string" ? e.name : String(e.name),
|
|
12
7
|
hidden: e.hidden === void 0 ? !1 : e.hidden,
|
|
13
8
|
index: n > -1 ? n : i,
|
|
14
|
-
visible: r?.visible !== void 0 ? r.visible :
|
|
9
|
+
visible: r?.visible !== void 0 ? r.visible : g !== void 0 && g.length > 0 ? !1 : e.visible === void 0 ? !0 : e.visible,
|
|
15
10
|
originalIndex: i,
|
|
16
11
|
originalVisible: e.visible === void 0 ? !0 : e.visible
|
|
17
|
-
},
|
|
12
|
+
}, f = p === "table" ? {
|
|
18
13
|
grouped: r?.grouped ?? e.grouped ?? !1,
|
|
19
|
-
groupOrder: r?.groupOrder ?? (e.grouped ?
|
|
14
|
+
groupOrder: r?.groupOrder ?? (e.grouped ? t : i),
|
|
20
15
|
originalGrouped: e.grouped ?? !1,
|
|
21
|
-
originalGroupOrder: e.grouped ?
|
|
16
|
+
originalGroupOrder: e.grouped ? t : i
|
|
22
17
|
} : {};
|
|
23
18
|
return {
|
|
19
|
+
...b,
|
|
20
|
+
...a,
|
|
24
21
|
...v,
|
|
25
22
|
...f,
|
|
26
|
-
...l,
|
|
27
|
-
...b,
|
|
28
23
|
...r || {}
|
|
29
24
|
};
|
|
30
25
|
}).sort((e, i) => e.index - i.index);
|
|
31
26
|
};
|
|
32
27
|
export {
|
|
33
|
-
|
|
28
|
+
C as getInitialColumnsConfig
|
|
34
29
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { ViewMode } from '../../../contexts/DataGridContext/types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Generates the suffix for config keys based on viewMode.
|
|
4
4
|
*
|
|
5
|
-
* ##
|
|
5
|
+
* ## Purpose
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
7
|
+
* Keeps backward compatibility with existing config keys:
|
|
8
|
+
* - `table` view: no suffix (backward compatibility)
|
|
9
|
+
* - `cards` view: suffix `_cards`
|
|
10
|
+
* - Future views: suffix `_${viewMode}`
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* Used when persisting via network cookies (localStorage is not used).
|
|
13
|
+
*
|
|
14
|
+
* ## Usage in config keys
|
|
13
15
|
*
|
|
14
|
-
* ```
|
|
15
16
|
* table: `${id}_columns_config`
|
|
16
17
|
* cards: `${id}_columns_config_cards`
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
19
|
-
* @returns Sufijo para la key de localStorage ('' para table, '_cards' para cards, '_list' para list)
|
|
18
|
+
* @param viewMode - View mode ('table' | 'cards')
|
|
19
|
+
* @returns Suffix for the config key ('' for table, '_cards' for cards)
|
|
20
20
|
* @example
|
|
21
21
|
* getViewSuffix('table'); // ''
|
|
22
22
|
* getViewSuffix('cards'); // '_cards'
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { UseChangeColumnsConfigParams, UseChangeColumnsConfigReturn } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Hook
|
|
3
|
+
* Hook to handle column configuration changes.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @
|
|
5
|
+
* Persists configuration only via onChangeConfig (network cookies) and updates state.
|
|
6
|
+
* localStorage is not used.
|
|
7
|
+
* @param params - Hook parameters
|
|
8
|
+
* @returns Function to change column configuration
|
|
8
9
|
*/
|
|
9
10
|
export declare const useChangeColumnsConfig: ({ id, onChangeConfig, updateConfigColumns, }: UseChangeColumnsConfigParams) => UseChangeColumnsConfigReturn;
|
|
10
11
|
//# sourceMappingURL=useChangeColumnsConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChangeColumnsConfig.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/hooks/useChangeColumnsConfig/useChangeColumnsConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AAEjB
|
|
1
|
+
{"version":3,"file":"useChangeColumnsConfig.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/hooks/useChangeColumnsConfig/useChangeColumnsConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AAEjB;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,8CAIpC,4BAA4B,KAAG,4BAoBjC,CAAC"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { UseViewModeParams, UseViewModeReturn } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Hook
|
|
3
|
+
* Hook to manage view mode state (table/cards).
|
|
4
4
|
*
|
|
5
|
-
* ##
|
|
5
|
+
* ## ViewMode initialization
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* 1. viewMode prop (
|
|
9
|
-
* 2.
|
|
10
|
-
* 3. defaultViewMode (
|
|
11
|
-
* 4.
|
|
7
|
+
* ViewMode is initialized following this precedence order:
|
|
8
|
+
* 1. viewMode prop (controlled mode)
|
|
9
|
+
* 2. defaultConfig from network cookies (via getViewMode)
|
|
10
|
+
* 3. defaultViewMode (developer default)
|
|
11
|
+
* 4. Device fallback (mobile: 'cards', desktop: 'table')
|
|
12
12
|
*
|
|
13
|
-
* ##
|
|
13
|
+
* ## ViewMode persistence
|
|
14
14
|
*
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
15
|
+
* - If `onChangeConfig` is defined → Saves to network cookies
|
|
16
|
+
* - If not defined → Nothing is saved (localStorage is not used)
|
|
17
17
|
*
|
|
18
|
-
* ##
|
|
18
|
+
* ## Controlled vs uncontrolled mode
|
|
19
19
|
*
|
|
20
|
-
* - **
|
|
21
|
-
* - **
|
|
20
|
+
* - **Controlled**: When `viewMode` prop is passed, the parent controls state
|
|
21
|
+
* - **Uncontrolled**: The hook manages state internally and persists via onChangeConfig when defined
|
|
22
22
|
*/
|
|
23
23
|
export declare const useViewMode: ({ id, viewMode, defaultViewMode, onViewModeChange, onChangeConfig, }: UseViewModeParams) => UseViewModeReturn;
|
|
24
24
|
//# sourceMappingURL=useViewMode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useViewMode.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/hooks/useViewMode/useViewMode.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW,GAAI,sEAMzB,iBAAiB,KAAG,
|
|
1
|
+
{"version":3,"file":"useViewMode.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/hooks/useViewMode/useViewMode.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW,GAAI,sEAMzB,iBAAiB,KAAG,iBA6CtB,CAAC"}
|
|
@@ -221,8 +221,8 @@ export interface GridProps<TRow, TSummaryRow, TKey extends RowKey = RowKey> exte
|
|
|
221
221
|
checkedRowsMultiple?: boolean;
|
|
222
222
|
onRowsChange?: Maybe<(rows: TRow[], data: RowsChangeData<TRow, TSummaryRow>) => void>;
|
|
223
223
|
/**
|
|
224
|
-
*
|
|
225
|
-
*
|
|
224
|
+
* Initial DataGrid configuration (widths, order, visibility, viewMode).
|
|
225
|
+
* Must be provided from network cookies; localStorage is not used.
|
|
226
226
|
*/
|
|
227
227
|
defaultConfig?: IGridConfigExtended;
|
|
228
228
|
/**
|
|
@@ -2,5 +2,6 @@ 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
4
|
export declare const COOKIE_COLUMNS_CONFIG_CARDS = "columns_config_cards";
|
|
5
|
+
export declare const COOKIE_COLUMNS_CONFIG_LIST = "columns_config_list";
|
|
5
6
|
export declare const COOKIE_VIEW_MODE = "view_mode";
|
|
6
7
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useDataGridPersistence/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,4BAA4B,CAAC;AAGxE,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AACtD,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AACtD,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAClE,eAAO,MAAM,gBAAgB,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useDataGridPersistence/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,4BAA4B,CAAC;AAGxE,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AACtD,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AACtD,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAClE,eAAO,MAAM,0BAA0B,wBAAwB,CAAC;AAChE,eAAO,MAAM,gBAAgB,cAAc,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _ = "columns_widths", O = "columns_config", o = "columns_config_cards", c = "columns_config_list", C = "view_mode";
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
O as COOKIE_COLUMNS_CONFIG,
|
|
4
4
|
o as COOKIE_COLUMNS_CONFIG_CARDS,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
c as COOKIE_COLUMNS_CONFIG_LIST,
|
|
6
|
+
_ as COOKIE_COLUMNS_WIDTHS,
|
|
7
|
+
C as COOKIE_VIEW_MODE
|
|
7
8
|
};
|
|
@@ -7,4 +7,8 @@ export declare const getColumnsConfigCookie: (cookie: Record<string, any> | unde
|
|
|
7
7
|
* Obtiene la configuración de columnas de cards desde la cookie
|
|
8
8
|
*/
|
|
9
9
|
export declare const getColumnsConfigCardsCookie: (cookie: Record<string, any> | undefined | Array<any>) => IGridConfigExtended["columnsConfigCards"];
|
|
10
|
+
/**
|
|
11
|
+
* Obtiene la configuración de columnas de list desde la cookie
|
|
12
|
+
*/
|
|
13
|
+
export declare const getColumnsConfigListCookie: (cookie: Record<string, any> | undefined | Array<any>) => IGridConfigExtended["columnsConfigList"];
|
|
10
14
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useDataGridPersistence/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,KACnD,mBAAmB,CAAC,eAAe,CAKrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,GACtC,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,KACnD,mBAAmB,CAAC,oBAAoB,CAK1C,CAAC"}
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useDataGridPersistence/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,KACnD,mBAAmB,CAAC,eAAe,CAKrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,GACtC,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,KACnD,mBAAmB,CAAC,oBAAoB,CAK1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACrC,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,KACnD,mBAAmB,CAAC,mBAAmB,CAKzC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const n = (r) => Array.isArray(r) ? r : [], t = (r) => Array.isArray(r) ? r : [];
|
|
1
|
+
const n = (r) => Array.isArray(r) ? r : [], t = (r) => Array.isArray(r) ? r : [], s = (r) => Array.isArray(r) ? r : [];
|
|
2
2
|
export {
|
|
3
3
|
t as getColumnsConfigCardsCookie,
|
|
4
|
-
n as getColumnsConfigCookie
|
|
4
|
+
n as getColumnsConfigCookie,
|
|
5
|
+
s as getColumnsConfigListCookie
|
|
5
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataGridPersistence.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useDataGridPersistence/useDataGridPersistence.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;
|
|
1
|
+
{"version":3,"file":"useDataGridPersistence.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/hooks/useDataGridPersistence/useDataGridPersistence.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAqBrG;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,2BAA2B;;+BA8C1D,YAAY;;oCAAZ,YAAY;CA2B1B,CAAC"}
|
|
@@ -1,49 +1,55 @@
|
|
|
1
|
-
import { useState as a, useCallback as
|
|
2
|
-
import { useWindowToolsMF as
|
|
3
|
-
import {
|
|
4
|
-
import { COOKIE_VIEW_MODE as
|
|
5
|
-
const
|
|
6
|
-
columnsConfig:
|
|
7
|
-
columnsConfigCards:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { useState as a, useCallback as d } from "react";
|
|
2
|
+
import { useWindowToolsMF as I } from "../../components/WindowBase/hooks/useWindowToolsMF/index.js";
|
|
3
|
+
import { getColumnsConfigListCookie as $, getColumnsConfigCardsCookie as N, getColumnsConfigCookie as k } from "./helpers.js";
|
|
4
|
+
import { COOKIE_VIEW_MODE as C, COOKIE_COLUMNS_CONFIG_LIST as s, COOKIE_COLUMNS_CONFIG_CARDS as e, COOKIE_COLUMNS_CONFIG as i, COOKIE_COLUMNS_WIDTHS as t } from "./constants.js";
|
|
5
|
+
const E = {
|
|
6
|
+
columnsConfig: i,
|
|
7
|
+
columnsConfigCards: e,
|
|
8
|
+
columnsConfigList: s,
|
|
9
|
+
columnsWidths: t,
|
|
10
|
+
viewMode: C
|
|
11
|
+
}, K = (c) => {
|
|
12
|
+
const { prefixCookie: o } = c, { setCookie: r, getCookie: n } = I(), [u] = a(() => ({
|
|
12
13
|
columnsWidths: n(
|
|
13
|
-
o ? `${o}_${
|
|
14
|
+
o ? `${o}_${t}` : t
|
|
14
15
|
) || {},
|
|
15
|
-
columnsConfig:
|
|
16
|
+
columnsConfig: k(
|
|
16
17
|
n(
|
|
17
|
-
o ? `${o}_${
|
|
18
|
+
o ? `${o}_${i}` : i
|
|
18
19
|
)
|
|
19
20
|
) || [],
|
|
20
|
-
columnsConfigCards:
|
|
21
|
+
columnsConfigCards: N(
|
|
22
|
+
n(
|
|
23
|
+
o ? `${o}_${e}` : e
|
|
24
|
+
)
|
|
25
|
+
) || [],
|
|
26
|
+
columnsConfigList: $(
|
|
21
27
|
n(
|
|
22
28
|
o ? `${o}_${s}` : s
|
|
23
29
|
)
|
|
24
30
|
) || [],
|
|
25
31
|
viewMode: n(
|
|
26
|
-
o ? `${o}_${
|
|
32
|
+
o ? `${o}_${C}` : C
|
|
27
33
|
)
|
|
28
|
-
})),
|
|
34
|
+
})), m = d(
|
|
29
35
|
(l) => {
|
|
30
|
-
const { reason:
|
|
31
|
-
if (
|
|
36
|
+
const { reason: O, userConfig: f } = l;
|
|
37
|
+
if (f === void 0)
|
|
32
38
|
return;
|
|
33
|
-
const
|
|
34
|
-
|
|
39
|
+
const _ = E[O] ?? O, g = o ? `${o}_${_}` : _;
|
|
40
|
+
r(g, "window", f);
|
|
35
41
|
},
|
|
36
|
-
[
|
|
42
|
+
[r, o]
|
|
37
43
|
);
|
|
38
44
|
return {
|
|
39
45
|
// Nuevos nombres
|
|
40
|
-
defaultConfig:
|
|
41
|
-
onChangeConfig:
|
|
46
|
+
defaultConfig: u,
|
|
47
|
+
onChangeConfig: m,
|
|
42
48
|
// Deprecated aliases para backward compatibility
|
|
43
|
-
defaultUserColumns:
|
|
44
|
-
onChangeUserColumns:
|
|
49
|
+
defaultUserColumns: u,
|
|
50
|
+
onChangeUserColumns: m
|
|
45
51
|
};
|
|
46
52
|
};
|
|
47
53
|
export {
|
|
48
|
-
|
|
54
|
+
K as useDataGridPersistence
|
|
49
55
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/components",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.51-beta-fix-683-datagrids-remove-localstorage.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -52,17 +52,17 @@
|
|
|
52
52
|
"nprogress": "^0.2.0",
|
|
53
53
|
"date-fns": "^2.30.0",
|
|
54
54
|
"react-transition-group": "^4.4.5",
|
|
55
|
-
"react-dropzone": "^14.2.2",
|
|
56
55
|
"react-rnd": "^10.5.2",
|
|
57
|
-
"react-spinners": "^0.13.8",
|
|
58
56
|
"react-draggable": "^4.4.5",
|
|
57
|
+
"react-spinners": "^0.13.8",
|
|
58
|
+
"react-dropzone": "^14.2.2",
|
|
59
59
|
"chart.js": "^4.4.0",
|
|
60
60
|
"chartjs-chart-error-bars": "^4.3.3",
|
|
61
61
|
"qrcode.react": "^3.1.0",
|
|
62
|
+
"simplebar-react": "3.2.6",
|
|
62
63
|
"react-color": "^2.19.3",
|
|
63
64
|
"@mui/x-date-pickers": "6.20.2",
|
|
64
65
|
"react-resizable-panels": "^2.1.8",
|
|
65
|
-
"simplebar-react": "3.2.6",
|
|
66
66
|
"react-data-grid": "7.0.0-beta.47",
|
|
67
67
|
"react-dnd": "^16.0.1",
|
|
68
68
|
"react-dnd-html5-backend": "^16.0.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/loadViewConfig/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { RowKey } from '../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Carga configuraciones de vista desde localStorage.
|
|
4
|
-
*
|
|
5
|
-
* ## Propósito
|
|
6
|
-
*
|
|
7
|
-
* Recupera la configuración de columnas guardada previamente para una vista específica.
|
|
8
|
-
* Trabaja en conjunto con `saveViewConfig` y `getViewSuffix` para persistencia.
|
|
9
|
-
*
|
|
10
|
-
* ## Formato de key en localStorage
|
|
11
|
-
*
|
|
12
|
-
* ```
|
|
13
|
-
* table: `${id}_columns_config`
|
|
14
|
-
* cards: `${id}_columns_config_cards`
|
|
15
|
-
* ```
|
|
16
|
-
* @param id - Identificador único del DataGrid
|
|
17
|
-
* @param viewSuffix - Sufijo para identificar la vista ('' para table, '_cards' para cards)
|
|
18
|
-
* @returns Array de configuración o null si no existe/error
|
|
19
|
-
* @example
|
|
20
|
-
* loadViewConfig('my-grid', ''); // Lee 'my-grid_columns_config'
|
|
21
|
-
* loadViewConfig('my-grid', '_cards'); // Lee 'my-grid_columns_config_cards'
|
|
22
|
-
*/
|
|
23
|
-
export declare const loadViewConfig: <T>(id: RowKey, viewSuffix: string) => T[] | null;
|
|
24
|
-
//# sourceMappingURL=loadViewConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadViewConfig.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/datagrids/helpers/persistence/loadViewConfig/loadViewConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,EAC9B,IAAI,MAAM,EACV,YAAY,MAAM,KACjB,CAAC,EAAE,GAAG,IAYR,CAAC"}
|