@m4l/components 0.1.51 → 0.1.52
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/CommonActions/components/ActionFormCancel/{index.27e301c5.js → index.bd0d16d6.js} +10 -11
- package/components/CommonActions/components/Actions/{index.c06ea173.js → index.f0a3167b.js} +9 -9
- package/components/DataGrid/{index.eb1bdc97.js → index.85390177.js} +10 -10
- package/components/DynamicFilter/{index.17731fda.js → index.cddd7472.js} +13 -13
- package/components/ModalDialog/{index.de10969f.js → index.5a307e29.js} +2 -2
- package/components/ObjectLogs/{index.338656c6.js → index.1315af37.js} +12 -12
- package/components/Period/{index.89daad51.js → index.85fe764a.js} +10 -10
- package/components/areas/components/Area/subcomponents/InnerForHooks/index.d.ts +2 -0
- package/components/areas/components/AreasAdmin/{index.3e586e9b.js → index.dbab59f1.js} +1 -3
- package/components/areas/components/AreasContainer/{index.15e4628d.js → index.f3f921b9.js} +2 -7
- package/components/areas/components/GridLayout/{index.f38f5b74.js → index.9953146d.js} +32 -30
- package/components/areas/components/Window/{index.d1a59be4.js → index.e34225ae.js} +112 -36
- package/components/areas/components/Window/subcomponents/InnerForHooks/index.d.ts +2 -2
- package/components/areas/components/WindowPopUp/{index.90566fca.js → index.90eb0348.js} +18 -19
- package/components/areas/components/WindowsPanel/index.d.ts +2 -0
- package/components/areas/components/{index.29809e82.js → index.6d863764.js} +20 -15
- package/components/areas/contexts/AreaContext/helper.d.ts +27 -0
- package/components/areas/contexts/AreaContext/{index.c787aee6.js → index.f25f7180.js} +151 -23
- package/components/areas/contexts/AreaContext/store.d.ts +17 -1
- package/components/areas/contexts/AreasContext/{index.4f938baa.js → index.7406c20f.js} +1 -5
- package/components/areas/contexts/{index.4cfa6ea9.js → index.e80d8f0f.js} +1 -13
- package/components/areas/hooks/{index.b15baf14.js → index.0fd57f88.js} +1 -1
- package/components/areas/hooks/useArea/{index.575c2abe.js → index.7bdbbb79.js} +2 -2
- package/components/areas/{index.8c6f9e65.js → index.6f09d168.js} +5 -5
- package/components/hook-form/RHFPeriod/{index.47cf646d.js → index.5d2a2071.js} +1 -1
- package/components/hook-form/RHFTextField/{index.57f138f7.js → index.bef7eced.js} +0 -1
- package/components/index.d.ts +0 -1
- package/components/modal/{WindowBase.ed279350.js → WindowBase.b5e29758.js} +1 -1
- package/components/modal/{WindowConfirm.72de5ce8.js → WindowConfirm.cbc7720c.js} +9 -9
- package/components/modal/{index.7197145d.js → index.f6de895f.js} +10 -10
- package/contexts/ModalContext/{index.e94f0e72.js → index.3d92d9f9.js} +1 -1
- package/hooks/useModal/{index.56c03c00.js → index.4454145e.js} +1 -1
- package/index.js +29 -60
- package/package.json +1 -1
- package/components/CmpDisenoTest/index.d.ts +0 -4
- package/components/CmpDisenoTest/types.d.ts +0 -20
|
@@ -5,11 +5,17 @@ import { createStore, useStore } from "zustand";
|
|
|
5
5
|
import { immer } from "zustand/middleware/immer";
|
|
6
6
|
import { devtools } from "zustand/middleware";
|
|
7
7
|
import debounce from "lodash/debounce";
|
|
8
|
-
import
|
|
8
|
+
import cloneDeep from "lodash.clonedeep";
|
|
9
|
+
import { u as useAreasStore } from "../../hooks/useArea/index.7bdbbb79.js";
|
|
10
|
+
import { useResponsiveDesktop, useFirstRender } from "@m4l/graphics";
|
|
9
11
|
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
const ROW_HEIGTH_GRIDLAYOUT = 100;
|
|
13
|
+
const CONTAINER_PADDING_GRIDLAYOUT = 3;
|
|
10
14
|
const DEBOUCED_SAVE_TIME = 500;
|
|
11
15
|
const COOKIE_BREAKPOINT_LAYOUTS = "layoutPros";
|
|
12
16
|
const COOKIE_WINDOWS = "windows";
|
|
17
|
+
const NORMALIZED_BREAKPOINTS = { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 };
|
|
18
|
+
const NORMALIZED_COLS = { lg: 24, md: 20, sm: 12, xs: 8, xxs: 2 };
|
|
13
19
|
const getParmsFromValue = (key, data) => {
|
|
14
20
|
try {
|
|
15
21
|
if (Array.isArray(data)) {
|
|
@@ -23,6 +29,60 @@ const getParmsFromValue = (key, data) => {
|
|
|
23
29
|
}
|
|
24
30
|
return void 0;
|
|
25
31
|
};
|
|
32
|
+
function setAddBreakPoints(state, newLayout) {
|
|
33
|
+
const layoutsBreakPoints = state.breakpointsLayouts;
|
|
34
|
+
const beforeMaximizebreakpointsLayouts = state.beforeMaximizebreakpointsLayouts;
|
|
35
|
+
for (const key in layoutsBreakPoints) {
|
|
36
|
+
const layoutBreakpoint = layoutsBreakPoints[key];
|
|
37
|
+
layoutBreakpoint.push(newLayout);
|
|
38
|
+
}
|
|
39
|
+
if (state.viewMode === "single") {
|
|
40
|
+
for (const key in beforeMaximizebreakpointsLayouts) {
|
|
41
|
+
const beforeLayoutBreakpoint = beforeMaximizebreakpointsLayouts[key];
|
|
42
|
+
beforeLayoutBreakpoint.push(newLayout);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return layoutsBreakPoints;
|
|
46
|
+
}
|
|
47
|
+
function setBreakPointsMaximized(state, layoutId) {
|
|
48
|
+
const layoutsBreakPoints = state.breakpointsLayouts;
|
|
49
|
+
const container = document.getElementsByClassName(`M4L_Area_wrapper_${state.id}`)[0];
|
|
50
|
+
if (container) {
|
|
51
|
+
const clientHeight = container.clientHeight - 40;
|
|
52
|
+
for (const key in layoutsBreakPoints) {
|
|
53
|
+
const layoutBreakpoint = layoutsBreakPoints[key];
|
|
54
|
+
const cols = key in NORMALIZED_COLS ? NORMALIZED_COLS[key] : 1;
|
|
55
|
+
const heigth_by_rowheigth = clientHeight / (ROW_HEIGTH_GRIDLAYOUT + 2 * CONTAINER_PADDING_GRIDLAYOUT);
|
|
56
|
+
for (let index = 0; index < layoutBreakpoint.length; index++) {
|
|
57
|
+
const l = layoutBreakpoint[index];
|
|
58
|
+
if (l.i === layoutId) {
|
|
59
|
+
l.x = 0;
|
|
60
|
+
l.y = 0;
|
|
61
|
+
l.h = heigth_by_rowheigth;
|
|
62
|
+
l.w = key in NORMALIZED_COLS ? NORMALIZED_COLS[key] : 1;
|
|
63
|
+
l.minW = 0;
|
|
64
|
+
l.maxW = cols;
|
|
65
|
+
l.minH = 0;
|
|
66
|
+
l.maxH = heigth_by_rowheigth;
|
|
67
|
+
l.isResizable = false;
|
|
68
|
+
l.isDraggable = false;
|
|
69
|
+
} else {
|
|
70
|
+
l.x = 0;
|
|
71
|
+
l.y = 1;
|
|
72
|
+
l.h = 0;
|
|
73
|
+
l.w = 0;
|
|
74
|
+
l.minW = 0;
|
|
75
|
+
l.maxW = 0;
|
|
76
|
+
l.minH = 0;
|
|
77
|
+
l.maxH = 0;
|
|
78
|
+
}
|
|
79
|
+
l.isResizable = false;
|
|
80
|
+
l.isDraggable = false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return layoutsBreakPoints;
|
|
85
|
+
}
|
|
26
86
|
function getDataFromResponse(data, state) {
|
|
27
87
|
const newBreakPointsLayouts = getParmsFromValue(COOKIE_BREAKPOINT_LAYOUTS, data);
|
|
28
88
|
const windows = getParmsFromValue(COOKIE_WINDOWS, data);
|
|
@@ -42,7 +102,6 @@ function getDataFromResponse(data, state) {
|
|
|
42
102
|
};
|
|
43
103
|
}
|
|
44
104
|
}
|
|
45
|
-
console.log("GET cookies", newBreakPointsLayouts, newHashWindowLayouts);
|
|
46
105
|
}
|
|
47
106
|
return {
|
|
48
107
|
newBreakPointsLayouts,
|
|
@@ -51,11 +110,11 @@ function getDataFromResponse(data, state) {
|
|
|
51
110
|
};
|
|
52
111
|
}
|
|
53
112
|
const createAreaStore = (initProps) => {
|
|
54
|
-
console.debug("Creating Area State");
|
|
55
113
|
const startProps = {
|
|
56
114
|
zPopUpIndex: 999,
|
|
57
115
|
status: "init",
|
|
58
116
|
breakpointsLayouts: {},
|
|
117
|
+
beforeMaximizebreakpointsLayouts: {},
|
|
59
118
|
gridLayouts: [],
|
|
60
119
|
windowModal: null,
|
|
61
120
|
windowsPopUps: [],
|
|
@@ -63,6 +122,9 @@ const createAreaStore = (initProps) => {
|
|
|
63
122
|
hashWindowsLayouts: {},
|
|
64
123
|
currentLayoutId: "",
|
|
65
124
|
currentPopUpId: "",
|
|
125
|
+
viewMode: initProps.isDesktop ? "multiple" : "single",
|
|
126
|
+
breakpoints: NORMALIZED_BREAKPOINTS,
|
|
127
|
+
cols: NORMALIZED_COLS,
|
|
66
128
|
...initProps
|
|
67
129
|
};
|
|
68
130
|
return createStore(
|
|
@@ -105,7 +167,6 @@ const createAreaStore = (initProps) => {
|
|
|
105
167
|
addWindowPopUp: (windowId, newWindowPopupProps) => {
|
|
106
168
|
let popUpId = windowId;
|
|
107
169
|
set((state) => {
|
|
108
|
-
console.log("addWindowPopUp", newWindowPopupProps, state.id);
|
|
109
170
|
if (newWindowPopupProps.replaceMeId) {
|
|
110
171
|
for (const key in state.hashWindowsPopups) {
|
|
111
172
|
const WindoPopUp = state.hashWindowsPopups[key];
|
|
@@ -127,7 +188,6 @@ const createAreaStore = (initProps) => {
|
|
|
127
188
|
};
|
|
128
189
|
state.currentPopUpId = windowId;
|
|
129
190
|
}
|
|
130
|
-
console.log("addWindowPopUp fin");
|
|
131
191
|
});
|
|
132
192
|
get().actions.selectWindowPopUp(popUpId);
|
|
133
193
|
},
|
|
@@ -142,6 +202,9 @@ const createAreaStore = (initProps) => {
|
|
|
142
202
|
delete state.hashWindowsLayouts[removeLayoutId];
|
|
143
203
|
});
|
|
144
204
|
get().actions.saveLayouts();
|
|
205
|
+
if (get().singleId === removeLayoutId) {
|
|
206
|
+
get().actions.maximizeLayout();
|
|
207
|
+
}
|
|
145
208
|
},
|
|
146
209
|
addWindowLayout: (windowId, newWindow) => {
|
|
147
210
|
const newLayout = {
|
|
@@ -159,9 +222,14 @@ const createAreaStore = (initProps) => {
|
|
|
159
222
|
emergeType: "layout",
|
|
160
223
|
onClose: get().actions.closeWindowLayout
|
|
161
224
|
};
|
|
225
|
+
setAddBreakPoints(state, newLayout);
|
|
162
226
|
});
|
|
163
227
|
get().actions.selectWindowLayout(windowId);
|
|
228
|
+
if (get().viewMode === "single") {
|
|
229
|
+
get().actions.maximizeLayout(windowId);
|
|
230
|
+
}
|
|
164
231
|
get().actions.saveLayouts();
|
|
232
|
+
get().actions.bouncedSaveBreakpointsLayouts();
|
|
165
233
|
},
|
|
166
234
|
saveLayouts: () => {
|
|
167
235
|
let nrKeys = 0;
|
|
@@ -176,7 +244,6 @@ const createAreaStore = (initProps) => {
|
|
|
176
244
|
nrKeys++;
|
|
177
245
|
}
|
|
178
246
|
}
|
|
179
|
-
console.log("saveWindows", nrKeys, saveObjetc, JSON.stringify(saveObjetc));
|
|
180
247
|
if (nrKeys > 0) {
|
|
181
248
|
get().networkOperation({
|
|
182
249
|
method: "PUT",
|
|
@@ -199,7 +266,9 @@ const createAreaStore = (initProps) => {
|
|
|
199
266
|
},
|
|
200
267
|
bouncedSaveBreakpointsLayouts: debounce(
|
|
201
268
|
() => {
|
|
202
|
-
const purgedLayouts = {
|
|
269
|
+
const purgedLayouts = {
|
|
270
|
+
...get().viewMode === "multiple" ? get().breakpointsLayouts : get().beforeMaximizebreakpointsLayouts
|
|
271
|
+
};
|
|
203
272
|
const finalLayouts = {};
|
|
204
273
|
for (const key in purgedLayouts) {
|
|
205
274
|
const element = purgedLayouts[key];
|
|
@@ -217,7 +286,6 @@ const createAreaStore = (initProps) => {
|
|
|
217
286
|
}
|
|
218
287
|
}
|
|
219
288
|
if (Object.keys(finalLayouts).length > 0) {
|
|
220
|
-
console.log(finalLayouts);
|
|
221
289
|
get().networkOperation({
|
|
222
290
|
method: "PUT",
|
|
223
291
|
endPoint: `cookies/${get().id}/${COOKIE_BREAKPOINT_LAYOUTS}`,
|
|
@@ -235,7 +303,9 @@ const createAreaStore = (initProps) => {
|
|
|
235
303
|
set((state) => {
|
|
236
304
|
state.breakpointsLayouts = newAllLayouts;
|
|
237
305
|
});
|
|
238
|
-
get().
|
|
306
|
+
if (!get().singleId) {
|
|
307
|
+
get().actions.bouncedSaveBreakpointsLayouts();
|
|
308
|
+
}
|
|
239
309
|
},
|
|
240
310
|
selectWindowLayout: (layoutId) => {
|
|
241
311
|
set((state) => {
|
|
@@ -263,7 +333,7 @@ const createAreaStore = (initProps) => {
|
|
|
263
333
|
});
|
|
264
334
|
setTimeout(() => {
|
|
265
335
|
const container = document.getElementsByClassName(
|
|
266
|
-
`
|
|
336
|
+
`M4L_WrapperGridLayout_${get().id}`
|
|
267
337
|
)[0];
|
|
268
338
|
const element = document.getElementsByClassName(
|
|
269
339
|
`M4L_WindowPopUp_${popUpId}`
|
|
@@ -271,16 +341,42 @@ const createAreaStore = (initProps) => {
|
|
|
271
341
|
if (element && container) {
|
|
272
342
|
const { top, left } = element.getBoundingClientRect();
|
|
273
343
|
const { top: containerTop, left: containerLeft } = container.getBoundingClientRect();
|
|
274
|
-
console.log(
|
|
275
|
-
"scroll top:",
|
|
276
|
-
`M4L_WindowPopUp_${popUpId}`,
|
|
277
|
-
top,
|
|
278
|
-
containerTop
|
|
279
|
-
);
|
|
280
344
|
container.scrollTop = container.scrollTop + top - containerTop;
|
|
281
345
|
container.scrollLeft = container.scrollLeft + left - containerLeft;
|
|
282
346
|
}
|
|
283
347
|
}, 100);
|
|
348
|
+
},
|
|
349
|
+
maximizeLayout: (layoutId) => {
|
|
350
|
+
let finalLayoutId = layoutId;
|
|
351
|
+
set((state) => {
|
|
352
|
+
if (state.viewMode === "multiple") {
|
|
353
|
+
state.beforeMaximizebreakpointsLayouts = cloneDeep(
|
|
354
|
+
state.breakpointsLayouts
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
if (!finalLayoutId) {
|
|
358
|
+
if (state.gridLayouts.length > 0) {
|
|
359
|
+
finalLayoutId = state.gridLayouts[0].i;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
state.viewMode = "single";
|
|
363
|
+
state.singleId = finalLayoutId;
|
|
364
|
+
setBreakPointsMaximized(state, finalLayoutId);
|
|
365
|
+
});
|
|
366
|
+
if (finalLayoutId) {
|
|
367
|
+
get().actions.selectWindowLayout(finalLayoutId);
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
normalizeLayouts: () => {
|
|
371
|
+
set((state) => {
|
|
372
|
+
if (!state.isDesktop)
|
|
373
|
+
return;
|
|
374
|
+
if (state.isDesktop && state.viewMode === "single") {
|
|
375
|
+
state.viewMode = "multiple";
|
|
376
|
+
state.singleId = void 0;
|
|
377
|
+
state.breakpointsLayouts = state.beforeMaximizebreakpointsLayouts;
|
|
378
|
+
}
|
|
379
|
+
});
|
|
284
380
|
}
|
|
285
381
|
},
|
|
286
382
|
internalActions: {
|
|
@@ -307,17 +403,41 @@ const createAreaStore = (initProps) => {
|
|
|
307
403
|
newGridLayouts,
|
|
308
404
|
newHashWindowLayouts
|
|
309
405
|
} = getDataFromResponse(response.data, state);
|
|
310
|
-
state.
|
|
406
|
+
if (state.viewMode === "multiple") {
|
|
407
|
+
state.breakpointsLayouts = newBreakPointsLayouts;
|
|
408
|
+
} else {
|
|
409
|
+
state.breakpointsLayouts = newBreakPointsLayouts;
|
|
410
|
+
state.beforeMaximizebreakpointsLayouts = newBreakPointsLayouts;
|
|
411
|
+
}
|
|
311
412
|
state.gridLayouts = newGridLayouts;
|
|
312
413
|
state.hashWindowsLayouts = newHashWindowLayouts;
|
|
313
|
-
console.log("Area loaded");
|
|
314
414
|
state.status = "loaded";
|
|
315
415
|
});
|
|
416
|
+
if (get().viewMode === "single") {
|
|
417
|
+
get().actions.maximizeLayout();
|
|
418
|
+
}
|
|
316
419
|
}).catch((_response) => {
|
|
317
420
|
set((state) => {
|
|
318
421
|
state.status = "loaded";
|
|
319
422
|
});
|
|
320
423
|
});
|
|
424
|
+
},
|
|
425
|
+
changeDesktopBreakpoint: (isDesktop) => {
|
|
426
|
+
const previousState = get().isDesktop;
|
|
427
|
+
set((state) => {
|
|
428
|
+
state.isDesktop = isDesktop;
|
|
429
|
+
});
|
|
430
|
+
if (previousState != isDesktop) {
|
|
431
|
+
if (isDesktop) {
|
|
432
|
+
get().actions.normalizeLayouts();
|
|
433
|
+
} else {
|
|
434
|
+
if (get().viewMode === "multiple") {
|
|
435
|
+
if (get().gridLayouts.length > 0) {
|
|
436
|
+
get().actions.maximizeLayout(get().gridLayouts[0].i);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
321
441
|
}
|
|
322
442
|
}
|
|
323
443
|
})),
|
|
@@ -337,6 +457,8 @@ const AreaProvider = (props) => {
|
|
|
337
457
|
const {
|
|
338
458
|
setAreaLink
|
|
339
459
|
} = useAreasStore((state) => state.internalActions);
|
|
460
|
+
const isDesktop = useResponsiveDesktop();
|
|
461
|
+
const isFirstRender = useFirstRender([isDesktop]);
|
|
340
462
|
const {
|
|
341
463
|
networkOperation
|
|
342
464
|
} = useNetwork();
|
|
@@ -346,18 +468,23 @@ const AreaProvider = (props) => {
|
|
|
346
468
|
id,
|
|
347
469
|
networkOperation,
|
|
348
470
|
loadAreasFromNetwork,
|
|
349
|
-
loadWindows
|
|
471
|
+
loadWindows,
|
|
472
|
+
isDesktop: !!isDesktop
|
|
350
473
|
});
|
|
351
474
|
}
|
|
352
475
|
const {
|
|
353
|
-
loadFromApi
|
|
476
|
+
loadFromApi,
|
|
477
|
+
changeDesktopBreakpoint
|
|
354
478
|
} = useStore(areaStoreRef.current, (state) => state.internalActions, shallow);
|
|
355
479
|
const status = useStore(areaStoreRef.current, (state) => state.status, shallow);
|
|
356
480
|
useEffect(() => {
|
|
357
|
-
|
|
481
|
+
if (!isFirstRender) {
|
|
482
|
+
changeDesktopBreakpoint(!!isDesktop);
|
|
483
|
+
}
|
|
484
|
+
}, [isDesktop]);
|
|
485
|
+
useEffect(() => {
|
|
358
486
|
setAreaLink(id, areaStoreRef.current);
|
|
359
487
|
return () => {
|
|
360
|
-
console.debug("useEffect cleanUP AreaProvider", props.id);
|
|
361
488
|
};
|
|
362
489
|
}, []);
|
|
363
490
|
useEffect(() => {
|
|
@@ -365,7 +492,6 @@ const AreaProvider = (props) => {
|
|
|
365
492
|
loadFromApi();
|
|
366
493
|
}
|
|
367
494
|
}, [active]);
|
|
368
|
-
console.log("Rendeer AreaProvider status", status, loadAreasFromNetwork);
|
|
369
495
|
return /* @__PURE__ */ jsx(AreaContext.Provider, {
|
|
370
496
|
value: areaStoreRef.current,
|
|
371
497
|
children
|
|
@@ -375,5 +501,7 @@ AreaProvider.displayName = "AreaProvider";
|
|
|
375
501
|
React__default.memo(AreaProvider);
|
|
376
502
|
export {
|
|
377
503
|
AreaProvider as A,
|
|
504
|
+
CONTAINER_PADDING_GRIDLAYOUT as C,
|
|
505
|
+
ROW_HEIGTH_GRIDLAYOUT as R,
|
|
378
506
|
AreaContext as a
|
|
379
507
|
};
|
|
@@ -3,6 +3,13 @@ import { Layout, Layouts } from 'react-grid-layout';
|
|
|
3
3
|
import { DebouncedFunc } from 'lodash';
|
|
4
4
|
import { HashWindowsByLayouts, HashWindowsByPopups, ModalProps, NewLayoutProps, NewModalProps, NewPopUpProps, NewWindowProps } from '../../components/Area/types';
|
|
5
5
|
export declare type AreaStatus = 'init' | 'load' | 'loaded' | 'error';
|
|
6
|
+
export declare type Breakpoints = {
|
|
7
|
+
[P: string]: number;
|
|
8
|
+
};
|
|
9
|
+
export declare type Cols = {
|
|
10
|
+
[P: string]: number;
|
|
11
|
+
};
|
|
12
|
+
export declare type ViewAreaMode = 'multiple' | 'single';
|
|
6
13
|
export interface AreaState {
|
|
7
14
|
zPopUpIndex: number;
|
|
8
15
|
id: string;
|
|
@@ -10,6 +17,7 @@ export interface AreaState {
|
|
|
10
17
|
loadWindows: boolean;
|
|
11
18
|
status: AreaStatus;
|
|
12
19
|
breakpointsLayouts: Layouts;
|
|
20
|
+
beforeMaximizebreakpointsLayouts: Layouts;
|
|
13
21
|
gridLayouts: Layout[];
|
|
14
22
|
windowsPopUps: string[];
|
|
15
23
|
windowModal?: Maybe<ModalProps>;
|
|
@@ -18,6 +26,11 @@ export interface AreaState {
|
|
|
18
26
|
networkOperation: (props: NetworkProps) => Promise<any>;
|
|
19
27
|
currentLayoutId: string;
|
|
20
28
|
currentPopUpId: string;
|
|
29
|
+
breakpoints: Breakpoints;
|
|
30
|
+
cols: Cols;
|
|
31
|
+
viewMode: ViewAreaMode;
|
|
32
|
+
singleId?: string;
|
|
33
|
+
isDesktop: boolean;
|
|
21
34
|
}
|
|
22
35
|
export interface AreaStateWithActions extends AreaState {
|
|
23
36
|
actions: {
|
|
@@ -33,13 +46,16 @@ export interface AreaStateWithActions extends AreaState {
|
|
|
33
46
|
bouncedSaveBreakpointsLayouts: DebouncedFunc<() => void>;
|
|
34
47
|
selectWindowLayout: (layoutId: string) => void;
|
|
35
48
|
selectWindowPopUp: (popUpId: string) => void;
|
|
49
|
+
maximizeLayout: (layoutId?: string) => void;
|
|
50
|
+
normalizeLayouts: () => void;
|
|
36
51
|
};
|
|
37
52
|
internalActions: {
|
|
38
53
|
loadFromApi: () => void;
|
|
54
|
+
changeDesktopBreakpoint: (isDesktop: boolean) => void;
|
|
39
55
|
};
|
|
40
56
|
}
|
|
41
57
|
declare type DefaultStoreProps = Omit<AreaState, 'id'>;
|
|
42
|
-
declare type InitialStoreProps = Pick<AreaState, 'id' | 'networkOperation' | 'loadAreasFromNetwork' | 'loadWindows'> & Partial<DefaultStoreProps>;
|
|
58
|
+
declare type InitialStoreProps = Pick<AreaState, 'id' | 'networkOperation' | 'loadAreasFromNetwork' | 'loadWindows' | 'isDesktop'> & Partial<DefaultStoreProps>;
|
|
43
59
|
export declare const createAreaStore: (initProps: InitialStoreProps) => Omit<Omit<import("zustand").StoreApi<AreaStateWithActions>, "setState"> & {
|
|
44
60
|
setState<A extends string | {
|
|
45
61
|
type: unknown;
|
|
@@ -3,7 +3,7 @@ import { useHostTools, useModuleDictionary, useNetwork, EmitEvents } from "@m4l/
|
|
|
3
3
|
import { createStore, useStore } from "zustand";
|
|
4
4
|
import { devtools } from "zustand/middleware";
|
|
5
5
|
import { immer } from "zustand/middleware/immer";
|
|
6
|
-
import { L as LABEL_NEW_AREA } from "../../index.
|
|
6
|
+
import { L as LABEL_NEW_AREA } from "../../index.6f09d168.js";
|
|
7
7
|
import { shallow } from "zustand/shallow";
|
|
8
8
|
import { useFirstRender } from "@m4l/graphics";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -11,7 +11,6 @@ const addAreaNoBoilerPlate = (state) => {
|
|
|
11
11
|
let newName = "";
|
|
12
12
|
const newId = `area_${new Date().getTime()}_${(Math.random() * 1e3).toFixed(0)}`;
|
|
13
13
|
newName = `${state.getLabel(LABEL_NEW_AREA)} ${state.areas.length + 1}`;
|
|
14
|
-
console.log("addAreaNoBoilerPlate", newName);
|
|
15
14
|
state.areas.push({ id: newId, name: newName, loadWindows: false });
|
|
16
15
|
state.currentArea = newId;
|
|
17
16
|
if (state.loadAreasFromNetwork) {
|
|
@@ -69,7 +68,6 @@ const createAreasStore = (initProps) => {
|
|
|
69
68
|
});
|
|
70
69
|
},
|
|
71
70
|
selectArea: (newAreaId) => {
|
|
72
|
-
console.log("Areas selected, ", newAreaId);
|
|
73
71
|
set((state) => {
|
|
74
72
|
if (state.areas.findIndex((area) => area.id === newAreaId) > -1) {
|
|
75
73
|
state.currentArea = newAreaId;
|
|
@@ -173,7 +171,6 @@ function AreasProvider(props) {
|
|
|
173
171
|
}, []);
|
|
174
172
|
useEffect(() => {
|
|
175
173
|
if (status === "loaded") {
|
|
176
|
-
console.log("useEffect Areas loaded");
|
|
177
174
|
onLoad && onLoad();
|
|
178
175
|
}
|
|
179
176
|
}, [status]);
|
|
@@ -185,7 +182,6 @@ function AreasProvider(props) {
|
|
|
185
182
|
useEffect(() => {
|
|
186
183
|
events_add_listener(EmitEvents.EMMIT_EVENT_HOST_EMERGE_WINDOW, addWindow);
|
|
187
184
|
areasStoreRef.current?.getState().internalActions.loadFromApi();
|
|
188
|
-
console.log("useEffect AreasProvider Emmiter");
|
|
189
185
|
return () => {
|
|
190
186
|
events_remove_listener(EmitEvents.EMMIT_EVENT_HOST_EMERGE_WINDOW, addWindow);
|
|
191
187
|
};
|
|
@@ -6,7 +6,7 @@ import { devtools } from "zustand/middleware";
|
|
|
6
6
|
import { immer } from "zustand/middleware/immer";
|
|
7
7
|
import cloneDeep from "lodash.clonedeep";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
import "./AreasContext/index.
|
|
9
|
+
import "./AreasContext/index.7406c20f.js";
|
|
10
10
|
function getCookiesContainer(data, containerId) {
|
|
11
11
|
const cookies = {};
|
|
12
12
|
try {
|
|
@@ -79,7 +79,6 @@ const createWindowStore = (initProps) => {
|
|
|
79
79
|
},
|
|
80
80
|
internalActions: {
|
|
81
81
|
loadCookiesFromApi: () => {
|
|
82
|
-
console.log("loadCookiesFromApi start");
|
|
83
82
|
if (get().status === "init") {
|
|
84
83
|
get().networkOperation({
|
|
85
84
|
method: "GET",
|
|
@@ -102,10 +101,6 @@ const createWindowStore = (initProps) => {
|
|
|
102
101
|
response.data,
|
|
103
102
|
state.windowId
|
|
104
103
|
);
|
|
105
|
-
console.log(
|
|
106
|
-
"loadCookiesFromApi end",
|
|
107
|
-
state.cookies.moduleCookies
|
|
108
|
-
);
|
|
109
104
|
state.status = "loaded";
|
|
110
105
|
});
|
|
111
106
|
}).catch((_response) => {
|
|
@@ -116,7 +111,6 @@ const createWindowStore = (initProps) => {
|
|
|
116
111
|
}
|
|
117
112
|
},
|
|
118
113
|
saveModuleCookies: () => {
|
|
119
|
-
console.log("saveModuleCookies end", get().cookies.moduleCookies);
|
|
120
114
|
for (const key in get().cookies.windowCookies) {
|
|
121
115
|
const cookie = get().cookies.windowCookies[key];
|
|
122
116
|
get().networkOperation({
|
|
@@ -172,11 +166,9 @@ function WindowMFProvider(props) {
|
|
|
172
166
|
}, []);
|
|
173
167
|
useEffect(() => {
|
|
174
168
|
if (windowStoreRef.current?.getState().status === "loaded") {
|
|
175
|
-
console.log("useEffect Reemplazo de ventan");
|
|
176
169
|
dynamicMFStoreRef.current?.getState().actions.changeData(props.dynamicParams);
|
|
177
170
|
}
|
|
178
171
|
}, [props.dynamicParams]);
|
|
179
|
-
console.log("Render WindowProvider");
|
|
180
172
|
return /* @__PURE__ */ jsx(WindowContext.Provider, {
|
|
181
173
|
value: windowStoreRef.current,
|
|
182
174
|
children
|
|
@@ -189,10 +181,6 @@ function WindowToolsMFProvider(props) {
|
|
|
189
181
|
setActions,
|
|
190
182
|
...other
|
|
191
183
|
} = props;
|
|
192
|
-
useEffect(() => {
|
|
193
|
-
console.log("useEffect {DynamicMFParmsProvider}", other);
|
|
194
|
-
}, []);
|
|
195
|
-
console.log("Render WindowToolsMFProvider", other);
|
|
196
184
|
return /* @__PURE__ */ jsx(WindowToolsMFContext.Provider, {
|
|
197
185
|
value: {
|
|
198
186
|
setActions,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
2
|
import { useStore } from "zustand";
|
|
3
|
-
import { b as WindowContext, c as WindowToolsMFContext } from "../contexts/index.
|
|
3
|
+
import { b as WindowContext, c as WindowToolsMFContext } from "../contexts/index.e80d8f0f.js";
|
|
4
4
|
import "../contexts/DynamicMFParmsContext/index.c19cb8cc.js";
|
|
5
5
|
const useWindow = () => {
|
|
6
6
|
const context = useContext(WindowContext);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
2
|
import { useStore } from "zustand";
|
|
3
|
-
import { A as AreasContext } from "../../contexts/AreasContext/index.
|
|
4
|
-
import { a as AreaContext } from "../../contexts/AreaContext/index.
|
|
3
|
+
import { A as AreasContext } from "../../contexts/AreasContext/index.7406c20f.js";
|
|
4
|
+
import { a as AreaContext } from "../../contexts/AreaContext/index.f25f7180.js";
|
|
5
5
|
function useAreasStore(selector, equalityFn) {
|
|
6
6
|
const context = useContext(AreasContext);
|
|
7
7
|
if (!context)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./components/index.
|
|
2
|
-
import "./components/AreasAdmin/index.
|
|
1
|
+
import "./components/index.6d863764.js";
|
|
2
|
+
import "./components/AreasAdmin/index.dbab59f1.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "@m4l/core";
|
|
5
5
|
import "@mui/material";
|
|
@@ -8,12 +8,12 @@ import "@mui/material/styles";
|
|
|
8
8
|
import "react/jsx-runtime";
|
|
9
9
|
import "../mui_extended/IconButton/index.1318a283.js";
|
|
10
10
|
import "zustand";
|
|
11
|
-
import "./contexts/AreasContext/index.
|
|
11
|
+
import "./contexts/AreasContext/index.7406c20f.js";
|
|
12
12
|
import "zustand/shallow";
|
|
13
|
-
import "./components/AreasContainer/index.
|
|
13
|
+
import "./components/AreasContainer/index.f3f921b9.js";
|
|
14
14
|
import "react-grid-layout/css/styles.css";
|
|
15
15
|
import "../../react-resizable.bb58c8fc.js";
|
|
16
|
-
import "./contexts/index.
|
|
16
|
+
import "./contexts/index.e80d8f0f.js";
|
|
17
17
|
import "./contexts/DynamicMFParmsContext/index.c19cb8cc.js";
|
|
18
18
|
const LABEL_NEW_AREA = "label_new_area";
|
|
19
19
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled } from "@mui/material";
|
|
2
2
|
import { useFormContext, Controller } from "react-hook-form";
|
|
3
3
|
import { E as ErrorLabel } from "../../ErrorLabel/index.78553a1e.js";
|
|
4
|
-
import { P as Period } from "../../Period/index.
|
|
4
|
+
import { P as Period } from "../../Period/index.85fe764a.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
const Wrapper = styled("div")(({
|
|
7
7
|
theme
|
|
@@ -189,7 +189,6 @@ const RHFTextFieldPassword = (props) => {
|
|
|
189
189
|
host_static_assets,
|
|
190
190
|
environment_assets
|
|
191
191
|
} = useEnvironment();
|
|
192
|
-
console.log("enviroment", host_static_assets, environment_assets);
|
|
193
192
|
const classes = useUtilityClasses();
|
|
194
193
|
return /* @__PURE__ */ jsx(RHFTextFieldPasswordRoot, {
|
|
195
194
|
className: classes.root,
|
package/components/index.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export * from './DynamicFilter/dictionary';
|
|
|
17
17
|
export * from './ErrorLabel';
|
|
18
18
|
export type { FilterFieldApply, RawFilterFieldApply, InitialFilterFieldApply, } from './DynamicFilter/types';
|
|
19
19
|
export * from './CommonActions/';
|
|
20
|
-
export * from './CmpDisenoTest';
|
|
21
20
|
export * from './CommonActions/dictionary';
|
|
22
21
|
export * from './DraggableWindow';
|
|
23
22
|
export * from './Icon';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEnvironment } from "@m4l/core";
|
|
2
2
|
import "react";
|
|
3
|
-
import { u as useModal } from "../../hooks/useModal/index.
|
|
3
|
+
import { u as useModal } from "../../hooks/useModal/index.4454145e.js";
|
|
4
4
|
import { styled } from "@mui/material/styles";
|
|
5
5
|
import { a as getThemeVariantColor } from "../../utils/index.e882b264.js";
|
|
6
6
|
import { IconButton } from "@mui/material";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEnvironment } from "@m4l/core";
|
|
2
2
|
import "react";
|
|
3
|
-
import { u as useModal } from "../../hooks/useModal/index.
|
|
4
|
-
import { A as Actions } from "../CommonActions/components/Actions/index.
|
|
3
|
+
import { u as useModal } from "../../hooks/useModal/index.4454145e.js";
|
|
4
|
+
import { A as Actions } from "../CommonActions/components/Actions/index.f0a3167b.js";
|
|
5
5
|
import { A as ActionCancel } from "../CommonActions/components/ActionCancel/index.a81752ef.js";
|
|
6
6
|
import { A as ActionIntro } from "../CommonActions/components/ActionIntro/index.d567aebb.js";
|
|
7
7
|
import "react-hook-form";
|
|
@@ -10,23 +10,23 @@ import "@mui/material/Button";
|
|
|
10
10
|
import "../mui_extended/Button/index.8406ed5b.js";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import "../../react-draggable.0eef011c.js";
|
|
13
|
-
import "../ModalDialog/index.
|
|
13
|
+
import "../ModalDialog/index.5a307e29.js";
|
|
14
14
|
import "../Resizeable/index.8a442a8b.js";
|
|
15
15
|
import "@m4l/graphics";
|
|
16
16
|
import { styled } from "@mui/material/styles";
|
|
17
17
|
import { I as Icon } from "../Icon/index.f6e8d810.js";
|
|
18
18
|
import { b as getVariantColor } from "../../utils/index.e882b264.js";
|
|
19
|
-
import { W as WindowBase } from "./WindowBase.
|
|
20
|
-
import "../areas/components/index.
|
|
21
|
-
import "../areas/components/AreasAdmin/index.
|
|
19
|
+
import { W as WindowBase } from "./WindowBase.b5e29758.js";
|
|
20
|
+
import "../areas/components/index.6d863764.js";
|
|
21
|
+
import "../areas/components/AreasAdmin/index.dbab59f1.js";
|
|
22
22
|
import "../mui_extended/IconButton/index.1318a283.js";
|
|
23
23
|
import "zustand";
|
|
24
|
-
import "../areas/contexts/AreasContext/index.
|
|
24
|
+
import "../areas/contexts/AreasContext/index.7406c20f.js";
|
|
25
25
|
import "zustand/shallow";
|
|
26
|
-
import "../areas/components/AreasContainer/index.
|
|
26
|
+
import "../areas/components/AreasContainer/index.f3f921b9.js";
|
|
27
27
|
import "react-grid-layout/css/styles.css";
|
|
28
28
|
import "../../react-resizable.bb58c8fc.js";
|
|
29
|
-
import "../areas/contexts/index.
|
|
29
|
+
import "../areas/contexts/index.e80d8f0f.js";
|
|
30
30
|
import "../areas/contexts/DynamicMFParmsContext/index.c19cb8cc.js";
|
|
31
31
|
import "@mui/lab";
|
|
32
32
|
const WrapperMessageIlustration = styled("div")(() => ({
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import "@mui/material";
|
|
2
2
|
import "../../react-draggable.0eef011c.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import "../../contexts/ModalContext/index.
|
|
5
|
-
import "../ModalDialog/index.
|
|
4
|
+
import "../../contexts/ModalContext/index.3d92d9f9.js";
|
|
5
|
+
import "../ModalDialog/index.5a307e29.js";
|
|
6
6
|
import "../Resizeable/index.8a442a8b.js";
|
|
7
7
|
import "react/jsx-runtime";
|
|
8
8
|
import "@m4l/graphics";
|
|
9
9
|
import "@m4l/core";
|
|
10
|
-
import "../CommonActions/components/Actions/index.
|
|
10
|
+
import "../CommonActions/components/Actions/index.f0a3167b.js";
|
|
11
11
|
import "@mui/material/Button";
|
|
12
12
|
import "../mui_extended/Button/index.8406ed5b.js";
|
|
13
13
|
import "react-hook-form";
|
|
14
|
-
import "./WindowBase.
|
|
14
|
+
import "./WindowBase.b5e29758.js";
|
|
15
15
|
import "../Icon/index.f6e8d810.js";
|
|
16
16
|
import "@mui/material/styles";
|
|
17
|
-
import "../areas/components/index.
|
|
18
|
-
import "../areas/components/AreasAdmin/index.
|
|
17
|
+
import "../areas/components/index.6d863764.js";
|
|
18
|
+
import "../areas/components/AreasAdmin/index.dbab59f1.js";
|
|
19
19
|
import "../mui_extended/IconButton/index.1318a283.js";
|
|
20
20
|
import "zustand";
|
|
21
|
-
import "../areas/contexts/AreasContext/index.
|
|
21
|
+
import "../areas/contexts/AreasContext/index.7406c20f.js";
|
|
22
22
|
import "zustand/shallow";
|
|
23
|
-
import "../areas/components/AreasContainer/index.
|
|
23
|
+
import "../areas/components/AreasContainer/index.f3f921b9.js";
|
|
24
24
|
import "react-grid-layout/css/styles.css";
|
|
25
25
|
import "../../react-resizable.bb58c8fc.js";
|
|
26
|
-
import "../areas/contexts/index.
|
|
26
|
+
import "../areas/contexts/index.e80d8f0f.js";
|
|
27
27
|
import "../areas/contexts/DynamicMFParmsContext/index.c19cb8cc.js";
|
|
28
28
|
import "@mui/lab";
|
|
29
|
-
import "./WindowConfirm.
|
|
29
|
+
import "./WindowConfirm.cbc7720c.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, useState } from "react";
|
|
2
|
-
import { M as ModalDialog } from "../../components/ModalDialog/index.
|
|
2
|
+
import { M as ModalDialog } from "../../components/ModalDialog/index.5a307e29.js";
|
|
3
3
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
const ModalContext = createContext(null);
|
|
5
5
|
function ModalProvider({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { M as ModalContext } from "../../contexts/ModalContext/index.
|
|
2
|
+
import { M as ModalContext } from "../../contexts/ModalContext/index.3d92d9f9.js";
|
|
3
3
|
function useModal() {
|
|
4
4
|
const context = useContext(ModalContext);
|
|
5
5
|
if (!context)
|