@m4l/components 9.4.51-beta-fix-683-datagrids-remove-localstorage.1 → 9.4.51
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/components/DataGridMain/DataGridMain.d.ts.map +1 -1
- package/components/datagrids/components/DataGridMain/DataGridMain.js +9 -7
- package/components/datagrids/components/TreeDataGrid/TreeDataGrid.d.ts.map +1 -1
- package/components/datagrids/components/TreeDataGrid/TreeDataGrid.js +27 -25
- package/components/datagrids/helpers/index.d.ts +1 -0
- package/components/datagrids/helpers/index.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/getColumnsWidth/getColumnsWidth.d.ts +5 -3
- package/components/datagrids/helpers/persistence/getColumnsWidth/getColumnsWidth.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/getColumnsWidth/getColumnsWidth.js +20 -9
- package/components/datagrids/helpers/persistence/getViewMode/getViewMode.d.ts +25 -20
- package/components/datagrids/helpers/persistence/getViewMode/getViewMode.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/getViewMode/getViewMode.js +10 -4
- package/components/datagrids/helpers/persistence/loadViewConfig/index.d.ts +2 -0
- package/components/datagrids/helpers/persistence/loadViewConfig/index.d.ts.map +1 -0
- package/components/datagrids/helpers/persistence/loadViewConfig/loadViewConfig.d.ts +24 -0
- package/components/datagrids/helpers/persistence/loadViewConfig/loadViewConfig.d.ts.map +1 -0
- package/components/datagrids/helpers/persistence/loadViewConfig/loadViewConfig.js +11 -0
- package/components/datagrids/helpers/persistence/saveColumnsWidth/saveColumnsWidth.d.ts +9 -4
- package/components/datagrids/helpers/persistence/saveColumnsWidth/saveColumnsWidth.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/saveColumnsWidth/saveColumnsWidth.js +13 -8
- package/components/datagrids/helpers/persistence/saveViewConfig/saveViewConfig.d.ts +18 -13
- package/components/datagrids/helpers/persistence/saveViewConfig/saveViewConfig.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/saveViewConfig/saveViewConfig.js +11 -8
- package/components/datagrids/helpers/persistence/saveViewMode/saveViewMode.d.ts +17 -14
- package/components/datagrids/helpers/persistence/saveViewMode/saveViewMode.d.ts.map +1 -1
- package/components/datagrids/helpers/persistence/saveViewMode/saveViewMode.js +10 -6
- package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.d.ts +19 -18
- package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.d.ts.map +1 -1
- package/components/datagrids/helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.js +16 -11
- package/components/datagrids/helpers/shared/getViewSuffix/getViewSuffix.d.ts +11 -11
- package/components/datagrids/helpers/shared/scrollToRowElement/scrollToRowElement.d.ts +2 -1
- package/components/datagrids/helpers/shared/scrollToRowElement/scrollToRowElement.d.ts.map +1 -1
- package/components/datagrids/helpers/shared/scrollToRowElement/scrollToRowElement.js +3 -3
- package/components/datagrids/hooks/useChangeColumnsConfig/useChangeColumnsConfig.d.ts +4 -5
- 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 +8 -2
- package/components/datagrids/types.d.ts.map +1 -1
- package/components/datagrids/views/CardsView/CardsView.d.ts.map +1 -1
- package/components/datagrids/views/CardsView/CardsView.js +36 -34
- package/components/datagrids/views/ListView/ListView.d.ts.map +1 -1
- package/components/datagrids/views/ListView/ListView.js +45 -43
- package/components/datagrids/views/TableView/TableView.d.ts.map +1 -1
- package/components/datagrids/views/TableView/TableView.js +115 -109
- package/hooks/useDataGridPersistence/constants.d.ts +0 -1
- package/hooks/useDataGridPersistence/constants.d.ts.map +1 -1
- package/hooks/useDataGridPersistence/constants.js +4 -5
- package/hooks/useDataGridPersistence/helpers.d.ts +0 -4
- package/hooks/useDataGridPersistence/helpers.d.ts.map +1 -1
- package/hooks/useDataGridPersistence/helpers.js +2 -3
- package/hooks/useDataGridPersistence/useDataGridPersistence.d.ts.map +1 -1
- package/hooks/useDataGridPersistence/useDataGridPersistence.js +38 -47
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridMain.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/components/DataGridMain/DataGridMain.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACtE,KAAK,EAAE,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"DataGridMain.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/components/DataGridMain/DataGridMain.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACtE,KAAK,EAAE,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,oDAuC9C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { BaseDataGrid as f } from "../BaseDataGrid/BaseDataGrid.js";
|
|
3
|
-
import { RenderContent as
|
|
4
|
-
function
|
|
3
|
+
import { RenderContent as g } from "../../views/adapters/RenderContent/RenderContent.js";
|
|
4
|
+
function p(o) {
|
|
5
5
|
const {
|
|
6
6
|
id: n,
|
|
7
7
|
withActions: r,
|
|
@@ -13,12 +13,13 @@ function G(e) {
|
|
|
13
13
|
onRowsChange: w,
|
|
14
14
|
cardsViewConfig: a,
|
|
15
15
|
focusOnRowKey: h,
|
|
16
|
+
smoothScroll: l,
|
|
16
17
|
checkedRows: m,
|
|
17
18
|
onCheckedRowsChange: C,
|
|
18
19
|
rowCellsBackground: R
|
|
19
|
-
} =
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
|
|
20
|
+
} = o;
|
|
21
|
+
return /* @__PURE__ */ e(f, { ...o, children: /* @__PURE__ */ e(
|
|
22
|
+
g,
|
|
22
23
|
{
|
|
23
24
|
id: n,
|
|
24
25
|
withActions: r,
|
|
@@ -30,6 +31,7 @@ function G(e) {
|
|
|
30
31
|
onRowsChange: w,
|
|
31
32
|
cardsViewConfig: a,
|
|
32
33
|
focusOnRowKey: h,
|
|
34
|
+
smoothScroll: l,
|
|
33
35
|
checkedRows: m,
|
|
34
36
|
onCheckedRowsChange: C,
|
|
35
37
|
rowCellsBackground: R
|
|
@@ -37,5 +39,5 @@ function G(e) {
|
|
|
37
39
|
) });
|
|
38
40
|
}
|
|
39
41
|
export {
|
|
40
|
-
|
|
42
|
+
p as DataGrid
|
|
41
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeDataGrid.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/components/TreeDataGrid/TreeDataGrid.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAC1E,KAAK,EAAE,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"TreeDataGrid.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/components/TreeDataGrid/TreeDataGrid.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAC1E,KAAK,EAAE,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,oDA+DlD"}
|
|
@@ -1,48 +1,50 @@
|
|
|
1
1
|
import { jsx as r } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { TableView as
|
|
4
|
-
import { BaseDataGrid as
|
|
5
|
-
function
|
|
2
|
+
import { useState as f } from "react";
|
|
3
|
+
import { TableView as E } from "../../views/TableView/TableView.js";
|
|
4
|
+
import { BaseDataGrid as R } from "../BaseDataGrid/BaseDataGrid.js";
|
|
5
|
+
function D(e) {
|
|
6
6
|
const {
|
|
7
7
|
id: s,
|
|
8
8
|
withActions: t,
|
|
9
9
|
columns: a,
|
|
10
10
|
rows: p,
|
|
11
|
-
selectedRows:
|
|
12
|
-
onSelectedRowsChange:
|
|
11
|
+
selectedRows: c,
|
|
12
|
+
onSelectedRowsChange: u,
|
|
13
13
|
rowKeyGetter: i,
|
|
14
14
|
onRowsChange: G,
|
|
15
|
-
focusOnRowKey:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
focusOnRowKey: l,
|
|
16
|
+
smoothScroll: w,
|
|
17
|
+
checkedRows: h,
|
|
18
|
+
onCheckedRowsChange: x,
|
|
19
|
+
rowGrouper: I,
|
|
20
|
+
expandedGroupIds: o,
|
|
20
21
|
onExpandedGroupIdsChange: n,
|
|
21
|
-
rowCellsBackground:
|
|
22
|
-
} =
|
|
23
|
-
return /* @__PURE__ */ r(
|
|
24
|
-
|
|
22
|
+
rowCellsBackground: m
|
|
23
|
+
} = e, [C, g] = f(() => new Set(o ?? [])), d = o !== void 0 && n !== void 0;
|
|
24
|
+
return /* @__PURE__ */ r(R, { ...e, children: /* @__PURE__ */ r(
|
|
25
|
+
E,
|
|
25
26
|
{
|
|
26
27
|
id: s,
|
|
27
28
|
withActions: t,
|
|
28
29
|
columns: a,
|
|
29
30
|
rows: p,
|
|
30
|
-
selectedRows:
|
|
31
|
-
onSelectedRowsChange:
|
|
31
|
+
selectedRows: c,
|
|
32
|
+
onSelectedRowsChange: u,
|
|
32
33
|
rowKeyGetter: i,
|
|
33
34
|
onRowsChange: G,
|
|
34
|
-
focusOnRowKey:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
focusOnRowKey: l,
|
|
36
|
+
smoothScroll: w,
|
|
37
|
+
checkedRows: h,
|
|
38
|
+
onCheckedRowsChange: x,
|
|
39
|
+
rowCellsBackground: m,
|
|
38
40
|
treeProps: {
|
|
39
|
-
rowGrouper:
|
|
40
|
-
expandedGroupIds: d ?
|
|
41
|
-
onExpandedGroupIdsChange: d ? n :
|
|
41
|
+
rowGrouper: I,
|
|
42
|
+
expandedGroupIds: d ? o : C,
|
|
43
|
+
onExpandedGroupIdsChange: d ? n : g
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
) });
|
|
45
47
|
}
|
|
46
48
|
export {
|
|
47
|
-
|
|
49
|
+
D as TreeDataGrid
|
|
48
50
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
4
5
|
export { getColumnsWidth } from './persistence/getColumnsWidth';
|
|
5
6
|
export { getViewMode } from './persistence/getViewMode';
|
|
6
7
|
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,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,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"}
|
|
@@ -13,7 +13,9 @@ 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
|
-
* localStorage
|
|
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.
|
|
17
19
|
*
|
|
18
20
|
* Si no se encuentra configuración en ninguna fuente, la columna no se incluye
|
|
19
21
|
* en el Map resultante y usará el ancho por defecto definido en la columna.
|
|
@@ -33,10 +35,10 @@ import { IGridConfig } from './types';
|
|
|
33
35
|
* @returns Map donde la key es el identificador de la columna (column.key) y el value
|
|
34
36
|
* es el ancho configurado (número en píxeles o string con unidad CSS)
|
|
35
37
|
* @example
|
|
36
|
-
* //
|
|
38
|
+
* // Sin configuración de cookies de red (usa localStorage como fallback)
|
|
37
39
|
* const columnsWidths = getColumnsWidth('my-grid', columns, null);
|
|
38
40
|
* @example
|
|
39
|
-
* //
|
|
41
|
+
* // Con configuración de cookies de red (caso típico en producción)
|
|
40
42
|
* const columnsWidths = getColumnsWidth('my-grid', columns, {
|
|
41
43
|
* columnsWidths: { name: 200, email: 300 }
|
|
42
44
|
* });
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,16 +1,27 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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)
|
|
6
13
|
try {
|
|
7
|
-
|
|
14
|
+
e = r.columnsWidths[i[t].key];
|
|
8
15
|
} catch {
|
|
9
16
|
}
|
|
10
|
-
|
|
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);
|
|
11
22
|
}
|
|
12
|
-
return
|
|
23
|
+
return a;
|
|
13
24
|
}
|
|
14
25
|
export {
|
|
15
|
-
|
|
26
|
+
s as getColumnsWidth
|
|
16
27
|
};
|
|
@@ -2,36 +2,41 @@ import { Maybe } from '@m4l/core';
|
|
|
2
2
|
import { RowKey } from '../../../types';
|
|
3
3
|
import { IGridConfigExtended, ViewMode } from '../../../contexts/DataGridContext/types';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Obtiene el modo de visualización del DataGrid.
|
|
6
6
|
*
|
|
7
|
-
* ##
|
|
7
|
+
* ## Flujo de persistencia
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Esta función obtiene el viewMode siguiendo una jerarquía de precedencia:
|
|
10
10
|
*
|
|
11
|
-
* 1. **defaultConfig.viewMode** (
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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.
|
|
14
14
|
*
|
|
15
|
-
* localStorage
|
|
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.
|
|
16
18
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
+
* 3. **defaultViewMode** - Valor por defecto del desarrollador
|
|
20
|
+
* Se usa si no hay configuración guardada en ningún lado.
|
|
19
21
|
*
|
|
20
|
-
* ##
|
|
22
|
+
* ## Relación con saveViewMode
|
|
21
23
|
*
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @param
|
|
27
|
-
* @
|
|
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
|
|
28
33
|
* @example
|
|
29
|
-
* //
|
|
34
|
+
* // Sin configuración de cookies de red (usa localStorage como fallback)
|
|
30
35
|
* const viewMode = getViewMode('my-grid', null, 'table');
|
|
31
36
|
* @example
|
|
32
|
-
* //
|
|
37
|
+
* // Con configuración de cookies de red (caso típico en producción)
|
|
33
38
|
* const viewMode = getViewMode('my-grid', { viewMode: 'cards' }, 'table');
|
|
34
|
-
* @see saveViewMode -
|
|
39
|
+
* @see saveViewMode - Función complementaria para persistir la configuración
|
|
35
40
|
*/
|
|
36
|
-
export declare function getViewMode(
|
|
41
|
+
export declare function getViewMode(id: RowKey, defaultConfig: Maybe<IGridConfigExtended>, defaultViewMode?: ViewMode): ViewMode | undefined;
|
|
37
42
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,9 +1,15 @@
|
|
|
1
|
-
function
|
|
2
|
-
if (
|
|
3
|
-
return
|
|
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
|
+
}
|
|
4
10
|
if (r)
|
|
5
11
|
return r;
|
|
6
12
|
}
|
|
7
13
|
export {
|
|
8
|
-
|
|
14
|
+
o as getViewMode
|
|
9
15
|
};
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -12,7 +12,9 @@ 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
|
-
* localStorage
|
|
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.
|
|
16
18
|
*
|
|
17
19
|
* ## Ciclo completo de persistencia
|
|
18
20
|
*
|
|
@@ -27,7 +29,7 @@ import { RowKey, OnChangeConfig } from '../../../types';
|
|
|
27
29
|
* ↓
|
|
28
30
|
* getColumnsWidth() lee de defaultConfig
|
|
29
31
|
* ```
|
|
30
|
-
* @param id - Identificador único del DataGrid
|
|
32
|
+
* @param id - Identificador único del DataGrid. Se usa como prefijo en localStorage (fallback)
|
|
31
33
|
* @param storeColumnsWidth - Map con la configuración de anchos donde:
|
|
32
34
|
* - key: identificador de la columna (column.key)
|
|
33
35
|
* - value: ancho en píxeles (number) o string con unidad CSS
|
|
@@ -41,8 +43,11 @@ import { RowKey, OnChangeConfig } from '../../../types';
|
|
|
41
43
|
* // Persistir en cookies de red
|
|
42
44
|
* setCookie(userConfig);
|
|
43
45
|
* });
|
|
44
|
-
* @
|
|
45
|
-
*
|
|
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
|
|
46
51
|
*/
|
|
47
52
|
export declare function saveColumnsWidth(id: RowKey, storeColumnsWidth: Map<string, Maybe<string | number>>, onChangeConfig?: OnChangeConfig): void;
|
|
48
53
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,13 +1,18 @@
|
|
|
1
1
|
import { castMapColumnsWidthToRecord as i } from "../../shared/castMapColumnsWidthToRecord/castMapColumnsWidthToRecord.js";
|
|
2
|
-
function
|
|
3
|
-
if (
|
|
2
|
+
function e(s, t, o) {
|
|
3
|
+
if (o) {
|
|
4
|
+
const c = i(t);
|
|
5
|
+
o({
|
|
6
|
+
reason: "columnsWidths",
|
|
7
|
+
userConfig: c
|
|
8
|
+
});
|
|
4
9
|
return;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
}
|
|
11
|
+
localStorage.setItem(
|
|
12
|
+
`${s}_columns_width`,
|
|
13
|
+
JSON.stringify([...t])
|
|
14
|
+
);
|
|
10
15
|
}
|
|
11
16
|
export {
|
|
12
|
-
|
|
17
|
+
e as saveColumnsWidth
|
|
13
18
|
};
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
import { RowKey } from '../../../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Guarda configuraciones de vista en localStorage o notifica via callback.
|
|
4
4
|
*
|
|
5
|
-
* ##
|
|
5
|
+
* ## Propósito
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Persiste la configuración de columnas para una vista específica.
|
|
8
|
+
* Soporta dos modos: localStorage directo o callback externo (cookies de red).
|
|
9
9
|
*
|
|
10
|
-
* ##
|
|
10
|
+
* ## Prioridad de persistencia
|
|
11
11
|
*
|
|
12
|
-
* 1.
|
|
13
|
-
* 2.
|
|
12
|
+
* 1. Si hay `onChangeConfig`, notifica al callback (para guardar en cookies de red)
|
|
13
|
+
* 2. Si no hay callback, guarda directamente en localStorage
|
|
14
14
|
*
|
|
15
|
-
* ##
|
|
15
|
+
* ## Formato de key en localStorage
|
|
16
16
|
*
|
|
17
|
+
* ```
|
|
17
18
|
* table: `${id}_columns_config`
|
|
18
19
|
* cards: `${id}_columns_config_cards`
|
|
19
|
-
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
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)
|
|
23
25
|
* @example
|
|
24
|
-
* //
|
|
26
|
+
* // Guardar en localStorage
|
|
27
|
+
* saveViewConfig('my-grid', '', config);
|
|
28
|
+
*
|
|
29
|
+
* // Notificar via callback
|
|
25
30
|
* saveViewConfig('my-grid', '_cards', config, onChangeConfig);
|
|
26
31
|
*/
|
|
27
32
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,12 +1,15 @@
|
|
|
1
|
-
const
|
|
2
|
-
if (
|
|
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
|
+
});
|
|
3
8
|
return;
|
|
4
|
-
|
|
5
|
-
o
|
|
6
|
-
|
|
7
|
-
userConfig: r
|
|
8
|
-
});
|
|
9
|
+
}
|
|
10
|
+
const n = o === "" ? `${s}_columns_config` : `${s}_columns_config${o}`;
|
|
11
|
+
localStorage.setItem(n, JSON.stringify(c));
|
|
9
12
|
};
|
|
10
13
|
export {
|
|
11
|
-
|
|
14
|
+
t as saveViewConfig
|
|
12
15
|
};
|
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import { ViewMode } from '../../../contexts/DataGridContext/types';
|
|
2
2
|
import { OnChangeConfig, RowKey } from '../../../types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Guarda el modo de visualización (table o cards).
|
|
5
5
|
*
|
|
6
|
-
* ##
|
|
6
|
+
* ## Propósito
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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.
|
|
10
10
|
*
|
|
11
|
-
* ##
|
|
11
|
+
* ## Prioridad de guardado
|
|
12
12
|
*
|
|
13
|
-
* 1.
|
|
14
|
-
* 2.
|
|
13
|
+
* 1. Si existe `onChangeConfig` → Guarda en cookies de red
|
|
14
|
+
* 2. Si no existe → Fallback a localStorage
|
|
15
15
|
*
|
|
16
|
-
* ##
|
|
16
|
+
* ## Formato de key en localStorage (fallback)
|
|
17
17
|
*
|
|
18
|
+
* ```
|
|
18
19
|
* `${id}_view_mode` -> 'table' | 'cards'
|
|
19
|
-
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
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
|
|
22
24
|
* @example
|
|
23
|
-
* //
|
|
25
|
+
* // Con cookies de red
|
|
24
26
|
* saveViewMode('my-grid', 'cards', onChangeConfig);
|
|
25
|
-
* //
|
|
27
|
+
* // Llama: onChangeConfig({ reason: 'viewMode', userConfig: 'cards' })
|
|
26
28
|
*
|
|
27
|
-
* //
|
|
29
|
+
* // Sin cookies de red (fallback)
|
|
28
30
|
* saveViewMode('my-grid', 'cards');
|
|
31
|
+
* // localStorage: 'my-grid_view_mode' = 'cards'
|
|
29
32
|
*/
|
|
30
33
|
export declare const saveViewMode: (id: RowKey, viewMode: ViewMode, onChangeConfig?: OnChangeConfig) => void;
|
|
31
34
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,YAAY,GACvB,IAAI,MAAM,EACV,UAAU,QAAQ,EAClB,iBAAiB,cAAc,KAC9B,IAUF,CAAC"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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);
|
|
6
10
|
};
|
|
7
11
|
export {
|
|
8
|
-
|
|
12
|
+
t as saveViewMode
|
|
9
13
|
};
|