@m4l/components 9.4.53-beta-hotfix-706-m4lcom-icons-version-latest.0 → 9.5.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/contexts/DataGridContext/DataGridContext.d.ts.map +1 -1
- package/components/datagrids/contexts/DataGridContext/DataGridContext.js +134 -133
- 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/useColumnsWidth/types.d.ts +2 -0
- package/components/datagrids/hooks/useColumnsWidth/types.d.ts.map +1 -1
- package/components/datagrids/hooks/useColumnsWidth/useColumnsWidth.d.ts +1 -1
- package/components/datagrids/hooks/useColumnsWidth/useColumnsWidth.d.ts.map +1 -1
- package/components/datagrids/hooks/useColumnsWidth/useColumnsWidth.js +12 -11
- 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 +5 -5
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridContext.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/contexts/DataGridContext/DataGridContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EAGtB,MAAM,SAAS,CAAC;AAgCjB,QAAA,MAAM,eAAe,qEAIN,CAAC;AAEhB;;;GAGG;AACH,iBAAS,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACvE,KAAK,EAAE,qBAAqB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"DataGridContext.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/contexts/DataGridContext/DataGridContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EAGtB,MAAM,SAAS,CAAC;AAgCjB,QAAA,MAAM,eAAe,qEAIN,CAAC;AAEhB;;;GAGG;AACH,iBAAS,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EACvE,KAAK,EAAE,qBAAqB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,oDAiiBtD;AAED,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,85 +1,86 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useFirstRender as
|
|
4
|
-
import { getComponentClasses as
|
|
5
|
-
import { DATAGRID_ROW_HEIGHTS as
|
|
6
|
-
import { ControlNavigateSlots as
|
|
7
|
-
import { deepEqual as
|
|
8
|
-
import { useViewMode as
|
|
9
|
-
import { useRowHeight as
|
|
10
|
-
import { useColumnsWidth as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { getViewMode as
|
|
1
|
+
import { jsx as ho } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { createContext as po, useState as b, useEffect as x, useMemo as yo } from "react";
|
|
3
|
+
import { useFirstRender as Vo } from "@m4l/graphics";
|
|
4
|
+
import { getComponentClasses as Ro } from "../../../../utils/getComponentSlotRoot.js";
|
|
5
|
+
import { DATAGRID_ROW_HEIGHTS as So, DATAGRID_ROW_HEADER_HEIGHTS as vo, DATAGRID_PREFIX_NAME as Ho } from "../../constants.js";
|
|
6
|
+
import { ControlNavigateSlots as xo, ColumnsConfigSlots as Do, TextEditorSlots as Eo, TableSlots as To, RowsCountSlots as bo, ActionsSlots as ko, DataGridSlots as Go } from "../../slots/DataGridEnum.js";
|
|
7
|
+
import { deepEqual as Ko } from "fast-equals";
|
|
8
|
+
import { useViewMode as Io } from "../../hooks/useViewMode/useViewMode.js";
|
|
9
|
+
import { useRowHeight as Fo } from "../../hooks/useRowHeight/useRowHeight.js";
|
|
10
|
+
import { useColumnsWidth as $o } from "../../hooks/useColumnsWidth/useColumnsWidth.js";
|
|
11
|
+
import { getColumnsWidth as k } from "../../helpers/persistence/getColumnsWidth/getColumnsWidth.js";
|
|
12
|
+
import { useViewConfig as Ao } from "../../hooks/useViewConfig/useViewConfig.js";
|
|
13
|
+
import { useChangeColumnsConfig as Oo } from "../../hooks/useChangeColumnsConfig/useChangeColumnsConfig.js";
|
|
14
|
+
import { useChangeColumnsOrder as Wo } from "../../hooks/useChangeColumnsOrder/useChangeColumnsOrder.js";
|
|
15
|
+
import { getViewMode as G } from "../../helpers/persistence/getViewMode/getViewMode.js";
|
|
16
16
|
import { getInitialColumnsConfig as y } from "../../helpers/shared/getInitialColumnsConfig/getInitialColumnsConfig.js";
|
|
17
17
|
import { getAllViewModes as V } from "../../helpers/shared/getAllViewModes/getAllViewModes.js";
|
|
18
|
-
import { getViewSpecificConfig as
|
|
19
|
-
const Mo =
|
|
20
|
-
function re(
|
|
18
|
+
import { getViewSpecificConfig as K } from "../../helpers/shared/getViewSpecificConfig/getViewSpecificConfig.js";
|
|
19
|
+
const Mo = po(null);
|
|
20
|
+
function re(I) {
|
|
21
21
|
const {
|
|
22
22
|
id: r,
|
|
23
|
-
children:
|
|
24
|
-
columns:
|
|
25
|
-
defaultConfig:
|
|
26
|
-
onChangeConfig:
|
|
27
|
-
defaultUserColumns:
|
|
23
|
+
children: F,
|
|
24
|
+
columns: n,
|
|
25
|
+
defaultConfig: $,
|
|
26
|
+
onChangeConfig: A,
|
|
27
|
+
defaultUserColumns: O,
|
|
28
28
|
// deprecated
|
|
29
|
-
onChangeUserColumns:
|
|
29
|
+
onChangeUserColumns: W,
|
|
30
30
|
// deprecated
|
|
31
|
-
rows:
|
|
32
|
-
rowsCount:
|
|
33
|
-
rowActionsGetter:
|
|
34
|
-
rowHeights: R =
|
|
35
|
-
rowHeaderHeights:
|
|
36
|
-
initialRowHeightVariant:
|
|
37
|
-
checkedRows:
|
|
38
|
-
onCheckedRowsChange:
|
|
39
|
-
checkedRowsMultiple:
|
|
40
|
-
rowKeyGetter:
|
|
31
|
+
rows: M,
|
|
32
|
+
rowsCount: z,
|
|
33
|
+
rowActionsGetter: _,
|
|
34
|
+
rowHeights: R = So,
|
|
35
|
+
rowHeaderHeights: L = vo,
|
|
36
|
+
initialRowHeightVariant: j = "standard",
|
|
37
|
+
checkedRows: U,
|
|
38
|
+
onCheckedRowsChange: q,
|
|
39
|
+
checkedRowsMultiple: N,
|
|
40
|
+
rowKeyGetter: P,
|
|
41
41
|
externalSortSettings: h,
|
|
42
42
|
externalFilterSettings: p,
|
|
43
|
-
size:
|
|
44
|
-
viewMode:
|
|
45
|
-
onViewModeChange:
|
|
43
|
+
size: X,
|
|
44
|
+
viewMode: B,
|
|
45
|
+
onViewModeChange: J,
|
|
46
46
|
defaultViewMode: m,
|
|
47
47
|
cardsViewConfig: s,
|
|
48
48
|
listViewConfig: c,
|
|
49
|
-
reorderable:
|
|
50
|
-
} =
|
|
49
|
+
reorderable: Q = !0
|
|
50
|
+
} = I, l = $ ?? O, g = A ?? W, D = Vo([n, r]), { viewModeState: Y, setViewModeState: E, handleViewModeChange: Z } = Io(
|
|
51
51
|
{
|
|
52
52
|
id: r,
|
|
53
|
-
viewMode:
|
|
53
|
+
viewMode: B,
|
|
54
54
|
defaultViewMode: m,
|
|
55
|
-
onViewModeChange:
|
|
55
|
+
onViewModeChange: J,
|
|
56
56
|
onChangeConfig: g
|
|
57
57
|
}
|
|
58
|
-
), { currentRowHeightVariant: S, setRowHeightVariant:
|
|
58
|
+
), { currentRowHeightVariant: S, setRowHeightVariant: oo } = Fo({
|
|
59
59
|
rowHeights: R,
|
|
60
|
-
rowHeaderHeights:
|
|
61
|
-
initialRowHeightVariant:
|
|
62
|
-
}), { columnsWidths:
|
|
60
|
+
rowHeaderHeights: L,
|
|
61
|
+
initialRowHeightVariant: j
|
|
62
|
+
}), { columnsWidths: eo, setColumnsWidths: no, onChangeColumnWidth: io } = $o({
|
|
63
63
|
id: r,
|
|
64
|
-
onChangeConfig: g
|
|
65
|
-
|
|
64
|
+
onChangeConfig: g,
|
|
65
|
+
initialWidths: k(r, n, l)
|
|
66
|
+
}), { getConfigColumns: d, updateConfigColumns: C } = Ao(), { onChangeColumnsConfig: T } = Oo({
|
|
66
67
|
id: r,
|
|
67
68
|
onChangeConfig: g,
|
|
68
69
|
updateConfigColumns: C
|
|
69
|
-
}), { onChangeColumnsOrder:
|
|
70
|
+
}), { onChangeColumnsOrder: to } = Wo({
|
|
70
71
|
getConfigColumns: d,
|
|
71
72
|
onChangeColumnsConfig: T
|
|
72
|
-
}),
|
|
73
|
+
}), ro = Ro(Ho, {
|
|
74
|
+
...Go,
|
|
73
75
|
...ko,
|
|
74
76
|
...bo,
|
|
75
77
|
...To,
|
|
76
78
|
...Eo,
|
|
77
79
|
...Do,
|
|
78
|
-
...xo
|
|
79
|
-
|
|
80
|
-
}), [ro, so] = b(M), [lo, ao] = b([]);
|
|
80
|
+
...xo
|
|
81
|
+
}), [so, lo] = b(z), [ao, uo] = b([]);
|
|
81
82
|
x(() => {
|
|
82
|
-
const
|
|
83
|
+
const i = new Set(n.map((o) => o.key));
|
|
83
84
|
if (m === "cards" && s === void 0)
|
|
84
85
|
throw new Error(
|
|
85
86
|
`DataGridProvider: When defaultViewMode="cards", you must provide cardsViewConfig.
|
|
@@ -126,18 +127,18 @@ function re(K) {
|
|
|
126
127
|
if (h?.sortsColumns) {
|
|
127
128
|
for (const o of h.sortsColumns)
|
|
128
129
|
if (typeof o == "string") {
|
|
129
|
-
if (!
|
|
130
|
+
if (!i.has(o))
|
|
130
131
|
throw new Error(
|
|
131
132
|
`DataGridProvider: Sorts incluye "${o}", pero no existe ninguna columna con key="${o}".`
|
|
132
133
|
);
|
|
133
|
-
} else if (!o.skipColumnValidation && !
|
|
134
|
+
} else if (!o.skipColumnValidation && !i.has(o.name))
|
|
134
135
|
throw new Error(
|
|
135
136
|
`DataGridProvider: Sorts incluye "${o.name}", pero no existe ninguna columna con key="${o.name}".`
|
|
136
137
|
);
|
|
137
138
|
}
|
|
138
139
|
if (p?.filterColumns) {
|
|
139
140
|
for (const o of p.filterColumns)
|
|
140
|
-
if (!o.skipColumnValidation && !
|
|
141
|
+
if (!o.skipColumnValidation && !i.has(o.name))
|
|
141
142
|
throw new Error(
|
|
142
143
|
`DataGridProvider: Fields incluye "${o.name}", pero no existe ninguna columna con key="${o.name}".`
|
|
143
144
|
);
|
|
@@ -174,50 +175,50 @@ function re(K) {
|
|
|
174
175
|
`
|
|
175
176
|
);
|
|
176
177
|
if (e && s.columnsConfig) {
|
|
177
|
-
for (const
|
|
178
|
-
if (!
|
|
178
|
+
for (const t of s.columnsConfig)
|
|
179
|
+
if (!i.has(t.columnKey))
|
|
179
180
|
throw new Error(
|
|
180
|
-
`DataGridProvider: cardsViewConfig.columnsConfig incluye columnKey="${
|
|
181
|
+
`DataGridProvider: cardsViewConfig.columnsConfig incluye columnKey="${t.columnKey}", pero no existe ninguna columna con key="${t.columnKey}".`
|
|
181
182
|
);
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
if (c?.columnsConfig) {
|
|
185
186
|
for (const o of c.columnsConfig)
|
|
186
|
-
if (!
|
|
187
|
+
if (!i.has(o.columnKey))
|
|
187
188
|
throw new Error(
|
|
188
189
|
`DataGridProvider: listViewConfig.columnsConfig includes columnKey="${o.columnKey}", but no column with key="${o.columnKey}" exists.`
|
|
189
190
|
);
|
|
190
191
|
}
|
|
191
|
-
}, [
|
|
192
|
-
const
|
|
192
|
+
}, [n, h, p, s, c, m]);
|
|
193
|
+
const fo = yo(() => R, [R]);
|
|
193
194
|
x(() => {
|
|
194
195
|
if (D) {
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
no(k(r, n, l)), E(
|
|
197
|
+
G(r, l, m) ?? "table"
|
|
197
198
|
), E(
|
|
198
|
-
|
|
199
|
+
G(r, l, m) ?? "table"
|
|
199
200
|
), C(
|
|
200
201
|
"table",
|
|
201
202
|
y(
|
|
202
203
|
r,
|
|
203
|
-
|
|
204
|
+
n,
|
|
204
205
|
"table",
|
|
205
|
-
|
|
206
|
+
l?.columnsConfig,
|
|
206
207
|
{ frozen: !1, grouped: !1, groupOrder: 0 },
|
|
207
208
|
{ originalFrozen: !1, originalGrouped: !1, originalGroupOrder: 0 }
|
|
208
209
|
)
|
|
209
210
|
);
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
212
|
-
return
|
|
211
|
+
const i = (() => {
|
|
212
|
+
if (l?.columnsConfigCards && l.columnsConfigCards.length > 0)
|
|
213
|
+
return l.columnsConfigCards;
|
|
213
214
|
if (s?.columnsConfig)
|
|
214
215
|
return s.columnsConfig.map((o, e) => {
|
|
215
|
-
const
|
|
216
|
+
const t = n.find(
|
|
216
217
|
(u) => u.key === o.columnKey
|
|
217
218
|
);
|
|
218
219
|
return {
|
|
219
220
|
key: o.columnKey,
|
|
220
|
-
visible:
|
|
221
|
+
visible: t?.visible === void 0 ? !0 : t?.visible,
|
|
221
222
|
index: e,
|
|
222
223
|
showTitle: o.showTitle
|
|
223
224
|
};
|
|
@@ -227,25 +228,25 @@ function re(K) {
|
|
|
227
228
|
"cards",
|
|
228
229
|
y(
|
|
229
230
|
r,
|
|
230
|
-
t,
|
|
231
|
-
"cards",
|
|
232
231
|
n,
|
|
232
|
+
"cards",
|
|
233
|
+
i,
|
|
233
234
|
{ showTitle: !1 },
|
|
234
235
|
{ originalShowTitle: !1 }
|
|
235
236
|
)
|
|
236
237
|
), c) {
|
|
237
238
|
const o = (() => {
|
|
238
|
-
if (
|
|
239
|
-
return
|
|
239
|
+
if (l?.columnsConfigList && l.columnsConfigList.length > 0)
|
|
240
|
+
return l.columnsConfigList;
|
|
240
241
|
if (c.columnsConfig)
|
|
241
|
-
return c.columnsConfig.map((e,
|
|
242
|
-
const u =
|
|
243
|
-
(
|
|
242
|
+
return c.columnsConfig.map((e, t) => {
|
|
243
|
+
const u = n.find(
|
|
244
|
+
(a) => a.key === e.columnKey
|
|
244
245
|
);
|
|
245
246
|
return {
|
|
246
247
|
key: e.columnKey,
|
|
247
248
|
visible: u?.visible === void 0 ? !0 : u?.visible,
|
|
248
|
-
index:
|
|
249
|
+
index: t,
|
|
249
250
|
showTitle: e.showTitle
|
|
250
251
|
};
|
|
251
252
|
});
|
|
@@ -254,7 +255,7 @@ function re(K) {
|
|
|
254
255
|
"list",
|
|
255
256
|
y(
|
|
256
257
|
r,
|
|
257
|
-
|
|
258
|
+
n,
|
|
258
259
|
"list",
|
|
259
260
|
o,
|
|
260
261
|
{ showTitle: !1 },
|
|
@@ -263,43 +264,43 @@ function re(K) {
|
|
|
263
264
|
);
|
|
264
265
|
}
|
|
265
266
|
}
|
|
266
|
-
}, [
|
|
267
|
+
}, [l]), x(() => {
|
|
267
268
|
if (!D) {
|
|
268
|
-
const
|
|
269
|
+
const i = {
|
|
269
270
|
table: [],
|
|
270
271
|
cards: [],
|
|
271
272
|
list: []
|
|
272
273
|
};
|
|
273
274
|
V().forEach((e) => {
|
|
274
|
-
const
|
|
275
|
-
for (let
|
|
276
|
-
const f =
|
|
277
|
-
(w) => w.key ===
|
|
275
|
+
const t = d(e), u = [];
|
|
276
|
+
for (let a = 0; a < t.length; a++) {
|
|
277
|
+
const f = n.findIndex(
|
|
278
|
+
(w) => w.key === t[a]?.key
|
|
278
279
|
);
|
|
279
280
|
if (f !== -1) {
|
|
280
|
-
const w =
|
|
281
|
+
const w = n[f];
|
|
281
282
|
u.push({
|
|
282
|
-
...
|
|
283
|
+
...t[a],
|
|
283
284
|
originalIndex: f,
|
|
284
285
|
// Propiedades específicas por vista dinámicamente
|
|
285
|
-
...
|
|
286
|
-
|
|
286
|
+
...K(e).dynamicOriginalProperty(
|
|
287
|
+
t[a] || w
|
|
287
288
|
),
|
|
288
289
|
originalVisible: w.visible ?? !0
|
|
289
290
|
});
|
|
290
291
|
}
|
|
291
292
|
}
|
|
292
|
-
|
|
293
|
+
i[e] = u;
|
|
293
294
|
}), V().forEach((e) => {
|
|
294
|
-
const
|
|
295
|
+
const t = i[e], u = new Set(
|
|
295
296
|
d(e).map((f) => f.key)
|
|
296
|
-
),
|
|
297
|
+
), a = n.filter(
|
|
297
298
|
(f) => !u.has(f.key)
|
|
298
299
|
);
|
|
299
|
-
if (
|
|
300
|
-
const f =
|
|
300
|
+
if (a.length > 0) {
|
|
301
|
+
const f = t.length, mo = y(
|
|
301
302
|
r,
|
|
302
|
-
|
|
303
|
+
a,
|
|
303
304
|
e,
|
|
304
305
|
void 0,
|
|
305
306
|
e === "cards" || e === "list" ? { showTitle: !1 } : {
|
|
@@ -314,80 +315,80 @@ function re(K) {
|
|
|
314
315
|
originalGrouped: !1,
|
|
315
316
|
originalGroupOrder: 0
|
|
316
317
|
}
|
|
317
|
-
).map((
|
|
318
|
-
const
|
|
319
|
-
(
|
|
320
|
-
), H =
|
|
318
|
+
).map((go, v) => {
|
|
319
|
+
const Co = n.findIndex(
|
|
320
|
+
(wo) => wo.key === a[v].key
|
|
321
|
+
), H = a[v];
|
|
321
322
|
return {
|
|
322
|
-
...
|
|
323
|
+
...go,
|
|
323
324
|
index: v + f,
|
|
324
325
|
name: H.name,
|
|
325
|
-
originalIndex:
|
|
326
|
+
originalIndex: Co,
|
|
326
327
|
originalVisible: H.visible ?? !0,
|
|
327
328
|
// Propiedades específicas por vista dinámicamente
|
|
328
|
-
...
|
|
329
|
+
...K(e).dynamicOriginalProperty(
|
|
329
330
|
H
|
|
330
331
|
)
|
|
331
332
|
};
|
|
332
333
|
});
|
|
333
|
-
|
|
334
|
+
i[e].push(...mo);
|
|
334
335
|
}
|
|
335
336
|
});
|
|
336
337
|
let o = !1;
|
|
337
338
|
if (V().forEach((e) => {
|
|
338
|
-
|
|
339
|
+
Ko(
|
|
339
340
|
d(e),
|
|
340
|
-
|
|
341
|
+
i[e]
|
|
341
342
|
) || (o = !0);
|
|
342
343
|
}), !o)
|
|
343
344
|
return;
|
|
344
345
|
V().forEach((e) => {
|
|
345
|
-
C(e,
|
|
346
|
+
C(e, i[e]);
|
|
346
347
|
});
|
|
347
348
|
}
|
|
348
|
-
}, [
|
|
349
|
-
const
|
|
350
|
-
|
|
349
|
+
}, [n, r]);
|
|
350
|
+
const co = (i) => {
|
|
351
|
+
lo(i);
|
|
351
352
|
};
|
|
352
|
-
return /* @__PURE__ */
|
|
353
|
+
return /* @__PURE__ */ ho(
|
|
353
354
|
Mo.Provider,
|
|
354
355
|
{
|
|
355
356
|
value: {
|
|
356
357
|
getConfigColumns: d,
|
|
357
358
|
onChangeColumnsConfig: T,
|
|
358
359
|
columnsConfig: d("table"),
|
|
359
|
-
columnsWidths:
|
|
360
|
-
rowsCount:
|
|
360
|
+
columnsWidths: eo,
|
|
361
|
+
rowsCount: so,
|
|
361
362
|
currentRowHeightVariant: S.rowHVariant,
|
|
362
363
|
currentRowHeight: S.rowHeight,
|
|
363
364
|
currentRowHeaderHeight: S.rowHeaderHeight,
|
|
364
|
-
rows:
|
|
365
|
-
rowHeights:
|
|
366
|
-
checkedRows:
|
|
367
|
-
reorderable:
|
|
368
|
-
onChangeColumnsOrder:
|
|
369
|
-
onChangeColumnWidth:
|
|
370
|
-
setRowsCount:
|
|
371
|
-
rowActionsGetter:
|
|
372
|
-
setRowHeightVariant:
|
|
373
|
-
onCheckedRowsChange:
|
|
374
|
-
checkedRowsMultiple:
|
|
375
|
-
rowKeyGetter:
|
|
365
|
+
rows: M,
|
|
366
|
+
rowHeights: fo,
|
|
367
|
+
checkedRows: U,
|
|
368
|
+
reorderable: Q,
|
|
369
|
+
onChangeColumnsOrder: to,
|
|
370
|
+
onChangeColumnWidth: io,
|
|
371
|
+
setRowsCount: co,
|
|
372
|
+
rowActionsGetter: _,
|
|
373
|
+
setRowHeightVariant: oo,
|
|
374
|
+
onCheckedRowsChange: q,
|
|
375
|
+
checkedRowsMultiple: N,
|
|
376
|
+
rowKeyGetter: P,
|
|
376
377
|
onChangeConfig: g,
|
|
377
378
|
onChangeUserColumns: g,
|
|
378
379
|
// deprecated alias
|
|
379
|
-
sortColumns:
|
|
380
|
-
setSortColumns:
|
|
380
|
+
sortColumns: ao,
|
|
381
|
+
setSortColumns: uo,
|
|
381
382
|
externalSortSettings: h,
|
|
382
383
|
externalFilterSettings: p,
|
|
383
|
-
classes:
|
|
384
|
-
size:
|
|
385
|
-
viewMode:
|
|
386
|
-
onViewModeChange:
|
|
384
|
+
classes: ro,
|
|
385
|
+
size: X,
|
|
386
|
+
viewMode: Y,
|
|
387
|
+
onViewModeChange: Z,
|
|
387
388
|
cardsViewConfig: s,
|
|
388
389
|
listViewConfig: c
|
|
389
390
|
},
|
|
390
|
-
children:
|
|
391
|
+
children: F
|
|
391
392
|
}
|
|
392
393
|
);
|
|
393
394
|
}
|
|
@@ -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
|
};
|