@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.
Files changed (40) hide show
  1. package/components/datagrids/helpers/index.d.ts +0 -1
  2. package/components/datagrids/helpers/index.d.ts.map +1 -1
  3. package/components/datagrids/helpers/persistence/getColumnsWidth/getColumnsWidth.d.ts +3 -5
  4. package/components/datagrids/helpers/persistence/getColumnsWidth/getColumnsWidth.d.ts.map +1 -1
  5. package/components/datagrids/helpers/persistence/getColumnsWidth/getColumnsWidth.js +9 -20
  6. package/components/datagrids/helpers/persistence/getViewMode/getViewMode.d.ts +20 -25
  7. package/components/datagrids/helpers/persistence/getViewMode/getViewMode.d.ts.map +1 -1
  8. package/components/datagrids/helpers/persistence/getViewMode/getViewMode.js +4 -10
  9. package/components/datagrids/helpers/persistence/saveColumnsWidth/saveColumnsWidth.d.ts +4 -9
  10. package/components/datagrids/helpers/persistence/saveColumnsWidth/saveColumnsWidth.d.ts.map +1 -1
  11. package/components/datagrids/helpers/persistence/saveColumnsWidth/saveColumnsWidth.js +8 -13
  12. package/components/datagrids/helpers/persistence/saveViewConfig/saveViewConfig.d.ts +13 -18
  13. package/components/datagrids/helpers/persistence/saveViewConfig/saveViewConfig.d.ts.map +1 -1
  14. package/components/datagrids/helpers/persistence/saveViewConfig/saveViewConfig.js +8 -11
  15. package/components/datagrids/helpers/persistence/saveViewMode/saveViewMode.d.ts +14 -17
  16. package/components/datagrids/helpers/persistence/saveViewMode/saveViewMode.d.ts.map +1 -1
  17. package/components/datagrids/helpers/persistence/saveViewMode/saveViewMode.js +6 -10
  18. package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.d.ts +18 -19
  19. package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.d.ts.map +1 -1
  20. package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.js +11 -16
  21. package/components/datagrids/helpers/shared/getViewSuffix/getViewSuffix.d.ts +11 -11
  22. package/components/datagrids/hooks/useChangeColumnsConfig/useChangeColumnsConfig.d.ts +5 -4
  23. package/components/datagrids/hooks/useChangeColumnsConfig/useChangeColumnsConfig.d.ts.map +1 -1
  24. package/components/datagrids/hooks/useViewMode/useViewMode.d.ts +13 -13
  25. package/components/datagrids/hooks/useViewMode/useViewMode.d.ts.map +1 -1
  26. package/components/datagrids/types.d.ts +2 -2
  27. package/hooks/useDataGridPersistence/constants.d.ts +1 -0
  28. package/hooks/useDataGridPersistence/constants.d.ts.map +1 -1
  29. package/hooks/useDataGridPersistence/constants.js +5 -4
  30. package/hooks/useDataGridPersistence/helpers.d.ts +4 -0
  31. package/hooks/useDataGridPersistence/helpers.d.ts.map +1 -1
  32. package/hooks/useDataGridPersistence/helpers.js +3 -2
  33. package/hooks/useDataGridPersistence/useDataGridPersistence.d.ts.map +1 -1
  34. package/hooks/useDataGridPersistence/useDataGridPersistence.js +33 -27
  35. package/package.json +4 -4
  36. package/components/datagrids/helpers/persistence/loadViewConfig/index.d.ts +0 -2
  37. package/components/datagrids/helpers/persistence/loadViewConfig/index.d.ts.map +0 -1
  38. package/components/datagrids/helpers/persistence/loadViewConfig/loadViewConfig.d.ts +0 -24
  39. package/components/datagrids/helpers/persistence/loadViewConfig/loadViewConfig.d.ts.map +0 -1
  40. 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,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,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"}
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
- * 2. **localStorage** - Fallback local
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
- * // Sin configuración de cookies de red (usa localStorage como fallback)
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
- * // Con configuración de cookies de red (caso típico en producción)
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;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,CAsCrC"}
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 s(h, i, r) {
2
- const a = /* @__PURE__ */ new Map();
3
- let n;
4
- try {
5
- const t = window.localStorage.getItem(`${h}_columns_width`);
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
- e = r.columnsWidths[i[t].key];
7
+ i = n.columnsWidths[e[t].key];
15
8
  } catch {
16
9
  }
17
- if (e === void 0) {
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 a;
12
+ return h;
24
13
  }
25
14
  export {
26
- s as getColumnsWidth
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
- * Obtiene el modo de visualización del DataGrid.
5
+ * Gets the DataGrid view mode (table/cards).
6
6
  *
7
- * ## Flujo de persistencia
7
+ * ## Persistence flow
8
8
  *
9
- * Esta función obtiene el viewMode siguiendo una jerarquía de precedencia:
9
+ * This function obtains viewMode following a precedence order:
10
10
  *
11
- * 1. **defaultConfig.viewMode** (Cookies de red) - Prioridad máxima
12
- * Configuración que viene de las cookies de red cuando el componente se monta.
13
- * En producción, esta es la fuente principal de datos persistidos.
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
- * 2. **localStorage** - Fallback local
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
- * 3. **defaultViewMode** - Valor por defecto del desarrollador
20
- * Se usa si no hay configuración guardada en ningún lado.
17
+ * 2. **defaultViewMode** - Developer default value
18
+ * Used when there is no configuration saved in network cookies.
21
19
  *
22
- * ## Relación con saveViewMode
20
+ * ## Relation with saveViewMode
23
21
  *
24
- * - Cuando el usuario cambia de vista, `saveViewMode` envía los cambios
25
- * mediante el callback `onChangeConfig`
26
- * - En la siguiente carga, esos datos vuelven como `defaultConfig.viewMode`
27
- * - localStorage es solo un fallback cuando no hay callback configurado
28
- * @param id - Identificador único del DataGrid. Se usa como prefijo para la key en localStorage (fallback)
29
- * @param defaultConfig - Configuración del usuario obtenida de cookies de red.
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
- * // Sin configuración de cookies de red (usa localStorage como fallback)
29
+ * // No network cookie config (uses defaultViewMode if provided)
35
30
  * const viewMode = getViewMode('my-grid', null, 'table');
36
31
  * @example
37
- * // Con configuración de cookies de red (caso típico en producción)
32
+ * // With network cookie config (typical production case)
38
33
  * const viewMode = getViewMode('my-grid', { viewMode: 'cards' }, 'table');
39
- * @see saveViewMode - Función complementaria para persistir la configuración
34
+ * @see saveViewMode - Complementary function to persist view mode
40
35
  */
41
- export declare function getViewMode(id: RowKey, defaultConfig: Maybe<IGridConfigExtended>, defaultViewMode?: ViewMode): ViewMode | undefined;
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,EACV,aAAa,EAAE,KAAK,CAAC,mBAAmB,CAAC,EACzC,eAAe,CAAC,EAAE,QAAQ,GACzB,QAAQ,GAAG,SAAS,CA0BtB"}
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 o(i, t, r) {
2
- if (t?.viewMode)
3
- return t.viewMode;
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
- o as getViewMode
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
- * 2. **localStorage** - Fallback local
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. Se usa como prefijo en localStorage (fallback)
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
- * @example
47
- * // Desarrollo: Guardar en localStorage (sin cookies de red)
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;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,CAkBN"}
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 e(s, t, o) {
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
- localStorage.setItem(
12
- `${s}_columns_width`,
13
- JSON.stringify([...t])
14
- );
5
+ const s = i(t);
6
+ o({
7
+ reason: "columnsWidths",
8
+ userConfig: s
9
+ });
15
10
  }
16
11
  export {
17
- e as saveColumnsWidth
12
+ n as saveColumnsWidth
18
13
  };
@@ -1,32 +1,27 @@
1
1
  import { RowKey } from '../../../types';
2
2
  /**
3
- * Guarda configuraciones de vista en localStorage o notifica via callback.
3
+ * Saves view configuration or notifies via callback.
4
4
  *
5
- * ## Propósito
5
+ * ## Purpose
6
6
  *
7
- * Persiste la configuración de columnas para una vista específica.
8
- * Soporta dos modos: localStorage directo o callback externo (cookies de red).
7
+ * Persists column configuration for a specific view.
8
+ * Only external callback (network cookies) is supported. localStorage is not used.
9
9
  *
10
- * ## Prioridad de persistencia
10
+ * ## Persistence priority
11
11
  *
12
- * 1. Si hay `onChangeConfig`, notifica al callback (para guardar en cookies de red)
13
- * 2. Si no hay callback, guarda directamente en localStorage
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
- * ## Formato de key en localStorage
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 id - Identificador único del DataGrid
22
- * @param viewSuffix - Sufijo para identificar la vista ('' para table, '_cards' para cards)
23
- * @param config - Array de configuración a guardar
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
- * // Guardar en localStorage
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;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,IAmBF,CAAC"}
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 t = (s, o, c, e) => {
2
- if (e) {
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
- const n = o === "" ? `${s}_columns_config` : `${s}_columns_config${o}`;
11
- localStorage.setItem(n, JSON.stringify(c));
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
- t as saveViewConfig
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
- * Guarda el modo de visualización (table o cards).
4
+ * Saves the view mode (table or cards).
5
5
  *
6
- * ## Propósito
6
+ * ## Purpose
7
7
  *
8
- * Persiste la preferencia del usuario sobre el modo de vista seleccionado.
9
- * Permite que al recargar la página se mantenga la última vista utilizada.
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
- * ## Prioridad de guardado
11
+ * ## Save priority
12
12
  *
13
- * 1. Si existe `onChangeConfig` → Guarda en cookies de red
14
- * 2. Si no existeFallback a localStorage
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
- * ## Formato de key en localStorage (fallback)
16
+ * ## Key format (reference; persistence is only via callback)
17
17
  *
18
- * ```
19
18
  * `${id}_view_mode` -> 'table' | 'cards'
20
- * ```
21
- * @param id - Identificador único del DataGrid
22
- * @param viewMode - Modo de visualización ('table' | 'cards')
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
- * // Con cookies de red
23
+ * // With network cookies
26
24
  * saveViewMode('my-grid', 'cards', onChangeConfig);
27
- * // Llama: onChangeConfig({ reason: 'viewMode', userConfig: 'cards' })
25
+ * // Calls: onChangeConfig({ reason: 'viewMode', userConfig: 'cards' })
28
26
  *
29
- * // Sin cookies de red (fallback)
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,YAAY,GACvB,IAAI,MAAM,EACV,UAAU,QAAQ,EAClB,iBAAiB,cAAc,KAC9B,IAUF,CAAC"}
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 t = (r, e, o) => {
2
- if (o) {
3
- o({
4
- reason: "viewMode",
5
- userConfig: e
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
- t as saveViewMode
8
+ o as saveViewMode
13
9
  };
@@ -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
- * Obtiene la configuración inicial de columnas para cualquier vista.
6
+ * Gets the initial column configuration for any view.
7
7
  *
8
- * ## Propósito
8
+ * ## Purpose
9
9
  *
10
- * Genera la configuración inicial de columnas combinando:
11
- * 1. Configuración inicial (defaultConfig) si existe
12
- * 2. Configuración guardada en localStorage si no hay defaultConfig
13
- * 3. Valores por defecto de las columnas
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
- * ## Prioridad de configuración
15
+ * ## Configuration priority
16
16
  *
17
- * 1. defaultConfig (configuración inicial de columnas)
18
- * 2. localStorage (preferencia guardada del usuario)
19
- * 3. Valores por defecto de las columnas
20
- * @param id - Identificador único del DataGrid
21
- * @param columns - Columnas del DataGrid
22
- * @param viewMode - Modo de visualización actual ('table' | 'cards')
23
- * @param defaultConfig - Configuración inicial de columnas (opcional) para la vista de "table" es la que viene en cada columna su configuración (visible, frozen, etc.) y para la vista "cards" es la que viene en la configuración de cardsViewConfig.columnsConfig
24
- * @param viewSpecificDefaults - Valores por defecto específicos de la vista
25
- * @param originalViewSpecificDefaults - Valores originales específicos de la vista
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
- * // Para vista table
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
- * // Para vista cards
37
+ * // For cards view
39
38
  * getInitialColumnsConfig(
40
39
  * 'my-grid',
41
40
  * columns,
@@ -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;AAIhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;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,EAmErD,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"}
@@ -1,34 +1,29 @@
1
- import { loadViewConfig as C } from "../../persistence/loadViewConfig/loadViewConfig.js";
2
- import { getViewSuffix as u } from "../getViewSuffix/getViewSuffix.js";
3
- const y = (a, t, d, o, f, l) => {
4
- let g;
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 : o !== void 0 && o.length > 0 ? !1 : e.visible === void 0 ? !0 : e.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
- }, b = d === "table" ? {
12
+ }, f = p === "table" ? {
18
13
  grouped: r?.grouped ?? e.grouped ?? !1,
19
- groupOrder: r?.groupOrder ?? (e.grouped ? p : i),
14
+ groupOrder: r?.groupOrder ?? (e.grouped ? t : i),
20
15
  originalGrouped: e.grouped ?? !1,
21
- originalGroupOrder: e.grouped ? p : i
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
- y as getInitialColumnsConfig
28
+ C as getInitialColumnsConfig
34
29
  };
@@ -1,22 +1,22 @@
1
1
  import { ViewMode } from '../../../contexts/DataGridContext/types';
2
2
  /**
3
- * Genera el sufijo de localStorage basado en el viewMode.
3
+ * Generates the suffix for config keys based on viewMode.
4
4
  *
5
- * ## Propósito
5
+ * ## Purpose
6
6
  *
7
- * Mantiene retrocompatibilidad con las keys de localStorage existentes:
8
- * - Vista `table`: sin sufijo (retrocompatibilidad)
9
- * - Vista `cards`: con sufijo `_cards`
10
- * - Futuras vistas: con sufijo `_${viewMode}`
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
- * ## Uso en localStorage
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
- * @param viewMode - Modo de vista ('table' | 'cards' | 'list')
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 para manejar el cambio de configuración de columnas.
3
+ * Hook to handle column configuration changes.
4
4
  *
5
- * Guarda la configuración en localStorage y actualiza el estado.
6
- * @param params - Parámetros del hook
7
- * @returns Función para cambiar la configuración de columnas
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;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GAAI,8CAIpC,4BAA4B,KAAG,4BAoBjC,CAAC"}
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 para manejar el estado del modo de visualización (table/cards).
3
+ * Hook to manage view mode state (table/cards).
4
4
  *
5
- * ## Inicialización del viewMode
5
+ * ## ViewMode initialization
6
6
  *
7
- * El viewMode se inicializa siguiendo esta jerarquía de precedencia:
8
- * 1. viewMode prop (modo controlado)
9
- * 2. localStorage (configuración guardada localmente)
10
- * 3. defaultViewMode (valor por defecto del desarrollador)
11
- * 4. Fallback según dispositivo (mobile: 'cards', desktop: 'table')
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
- * ## Persistencia del viewMode
13
+ * ## ViewMode persistence
14
14
  *
15
- * - Si `onChangeConfig` está definidoGuarda en cookies de red
16
- * - Si no está definido Fallback a localStorage
15
+ * - If `onChangeConfig` is definedSaves to network cookies
16
+ * - If not definedNothing is saved (localStorage is not used)
17
17
  *
18
- * ## Modo controlado vs no controlado
18
+ * ## Controlled vs uncontrolled mode
19
19
  *
20
- * - **Controlado**: Cuando se pasa `viewMode` prop, el padre controla el estado
21
- * - **No controlado**: El hook maneja internamente el estado y persiste
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,iBA8CtB,CAAC"}
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
- * Configuración inicial del DataGrid (anchos, orden, visibilidad, viewMode).
225
- * Tiene prioridad sobre localStorage.
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 O = "columns_widths", _ = "columns_config", o = "columns_config_cards", c = "view_mode";
1
+ const _ = "columns_widths", O = "columns_config", o = "columns_config_cards", c = "columns_config_list", C = "view_mode";
2
2
  export {
3
- _ as COOKIE_COLUMNS_CONFIG,
3
+ O as COOKIE_COLUMNS_CONFIG,
4
4
  o as COOKIE_COLUMNS_CONFIG_CARDS,
5
- O as COOKIE_COLUMNS_WIDTHS,
6
- c as COOKIE_VIEW_MODE
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;AAmBrG;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,2BAA2B;;+BAsC1D,YAAY;;oCAAZ,YAAY;CA2B1B,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 g } from "react";
2
- import { useWindowToolsMF as d } from "../../components/WindowBase/hooks/useWindowToolsMF/index.js";
3
- import { getColumnsConfigCardsCookie as $, getColumnsConfigCookie as I } from "./helpers.js";
4
- import { COOKIE_VIEW_MODE as e, COOKIE_COLUMNS_CONFIG_CARDS as s, COOKIE_COLUMNS_CONFIG as C, COOKIE_COLUMNS_WIDTHS as i } from "./constants.js";
5
- const k = {
6
- columnsConfig: C,
7
- columnsConfigCards: s,
8
- columnsWidths: i,
9
- viewMode: e
10
- }, p = (O) => {
11
- const { prefixCookie: o } = O, { setCookie: t, getCookie: n } = d(), [r] = a(() => ({
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}_${i}` : i
14
+ o ? `${o}_${t}` : t
14
15
  ) || {},
15
- columnsConfig: I(
16
+ columnsConfig: k(
16
17
  n(
17
- o ? `${o}_${C}` : C
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}_${e}` : e
32
+ o ? `${o}_${C}` : C
27
33
  )
28
- })), u = g(
34
+ })), m = d(
29
35
  (l) => {
30
- const { reason: m, userConfig: c } = l;
31
- if (c === void 0)
36
+ const { reason: O, userConfig: f } = l;
37
+ if (f === void 0)
32
38
  return;
33
- const f = k[m] ?? m, _ = o ? `${o}_${f}` : f;
34
- t(_, "window", c);
39
+ const _ = E[O] ?? O, g = o ? `${o}_${_}` : _;
40
+ r(g, "window", f);
35
41
  },
36
- [t, o]
42
+ [r, o]
37
43
  );
38
44
  return {
39
45
  // Nuevos nombres
40
- defaultConfig: r,
41
- onChangeConfig: u,
46
+ defaultConfig: u,
47
+ onChangeConfig: m,
42
48
  // Deprecated aliases para backward compatibility
43
- defaultUserColumns: r,
44
- onChangeUserColumns: u
49
+ defaultUserColumns: u,
50
+ onChangeUserColumns: m
45
51
  };
46
52
  };
47
53
  export {
48
- p as useDataGridPersistence
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.50",
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,2 +0,0 @@
1
- export { loadViewConfig } from './loadViewConfig';
2
- //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -1,11 +0,0 @@
1
- const c = (o, t) => {
2
- try {
3
- const n = t === "" ? `${o}_columns_config` : `${o}_columns_config${t}`, e = localStorage.getItem(n);
4
- return e ? JSON.parse(e) : null;
5
- } catch {
6
- return null;
7
- }
8
- };
9
- export {
10
- c as loadViewConfig
11
- };