@m4l/components 0.1.76 → 0.1.77
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/@types/export.d.ts +19 -0
- package/components/AccountPopover/{index.47cf6c43.js → index.3a79c395.js} +7 -6
- package/components/AppBar/{index.f04f5e45.js → index.71b38ee9.js} +7 -6
- package/components/CommonActions/components/ActionCancel/{index.453c2d24.js → index.b748a38e.js} +2 -2
- package/components/CommonActions/components/ActionFormCancel/{index.c2a2fd55.js → index.27ad09e1.js} +18 -18
- package/components/CommonActions/components/ActionFormIntro/{index.25d33912.js → index.2556f054.js} +2 -2
- package/components/CommonActions/components/ActionIntro/{index.c653a266.js → index.a7d92e66.js} +2 -2
- package/components/CommonActions/components/Actions/{index.e376a68e.js → index.3eba9d91.js} +16 -17
- package/components/DataGrid/{index.ffaf000e.js → index.545b492f.js} +42 -30
- package/components/DataGrid/types.d.ts +5 -1
- package/components/DraggableWindow/{index.b08af1dc.js → index.c702d3f2.js} +1 -1
- package/components/DynamicFilter/{index.d7c03a61.js → index.d7be0f37.js} +40 -33
- package/components/DynamicFilter/subcomponents/InnerForHooks/index.d.ts +2 -1
- package/components/DynamicFilter/subcomponents/InnerForHooks/types.d.ts +2 -0
- package/components/DynamicFilter/tests/contants.d.ts +1 -1
- package/components/DynamicFilter/types.d.ts +4 -0
- package/components/GridLayout/GridLayout.d.ts +6 -0
- package/components/GridLayout/Responsive/index.a12a8cec.js +335 -0
- package/components/GridLayout/WidthProvider/index.8ff65909.js +67 -0
- package/components/GridLayout/calculateUtils.d.ts +42 -0
- package/components/GridLayout/index.4ba3767a.js +1400 -0
- package/components/GridLayout/index.d.ts +6 -0
- package/components/GridLayout/subcomponents/GridItem/index.d.ts +25 -0
- package/components/GridLayout/subcomponents/GridItem/types.d.ts +76 -0
- package/components/GridLayout/subcomponents/Responsive/index.d.ts +3 -0
- package/components/GridLayout/subcomponents/Responsive/responsiveUtils.d.ts +61 -0
- package/components/GridLayout/subcomponents/Responsive/types.d.ts +71 -0
- package/components/GridLayout/subcomponents/WidthProvider/index.d.ts +16 -0
- package/components/GridLayout/types.d.ts +355 -0
- package/components/GridLayout/utils.d.ts +123 -0
- package/components/HelperText/{index.9864f773.js → index.ef31df1f.js} +7 -6
- package/components/Icon/{index.9dae8337.js → index.ecb63e65.js} +1 -1
- package/components/LanguagePopover/{index.938c6675.js → index.0023d069.js} +7 -6
- package/components/LinearProgressIndeterminate/{index.d34d398f.js → index.60dabc06.js} +1 -1
- package/components/ModalDialog/{index.d9c5d400.js → index.d880e685.js} +8 -56
- package/components/NavLink/{index.21c8fd90.js → index.cd92eceb.js} +7 -6
- package/components/ObjectLogs/{index.a2709fc2.js → index.f174c542.js} +19 -19
- package/components/PaperForm/{index.5e1bc99f.js → index.1bd86ee5.js} +1 -1
- package/components/Period/{index.526791a3.js → index.711db043.js} +21 -22
- package/components/Resizeable/{index.f6e48e56.js → index.9a9c79a4.js} +1 -1
- package/components/SideBar/{index.9e1a5b96.js → index.c5ce0bad.js} +5 -5
- package/components/areas/components/AreasAdmin/classes/index.d.ts +1 -1
- package/components/areas/components/AreasAdmin/classes/types.d.ts +2 -0
- package/components/areas/components/AreasAdmin/{index.946eebb9.js → index.cc4cbf56.js} +120 -46
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/types.d.ts +0 -1
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/PanelWindowPopUp/index.d.ts +3 -0
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/PanelWindowPopUp/types.d.ts +3 -0
- package/components/areas/components/AreasViewer/classes/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/classes/types.d.ts +2 -0
- package/components/areas/components/AreasViewer/{index.bf4191ea.js → index.9c2aaaeb.js} +258 -259
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/{GridLayout → AreaGridLayout}/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/index.d.ts +2 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/index.d.ts +1 -7
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/WindowPopUpsList/index.d.ts +3 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/WindowPopUpsList/types.d.ts +2 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/types.d.ts +6 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/types.d.ts +1 -1
- package/components/areas/components/{index.2bb534cb.js → index.0f7ac464.js} +11 -10
- package/components/areas/contexts/AreasContext/helper.d.ts +6 -16
- package/components/areas/contexts/AreasContext/{index.f0397b7c.js → index.c8147e8e.js} +244 -339
- package/components/areas/contexts/AreasContext/types.d.ts +23 -20
- package/components/areas/contexts/{index.1809650a.js → index.02336412.js} +1 -1
- package/components/areas/{dictionary.3fabae50.js → dictionary.afb7e3d9.js} +5 -2
- package/components/areas/dictionary.d.ts +4 -1
- package/components/areas/hooks/useAreas/{index.40917e99.js → index.3406a6cb.js} +1 -1
- package/components/areas/{icons.19cde4b4.js → icons.8266ccc8.js} +5 -1
- package/components/areas/icons.d.ts +4 -0
- package/components/areas/{index.9bd48013.js → index.6f2e5dab.js} +11 -10
- package/components/areas/types.d.ts +30 -22
- package/components/formatters/BooleanFormatter/{index.431dc923.js → index.5268b024.js} +1 -1
- package/components/formatters/{index.e1af75e6.js → index.137169d8.js} +2 -2
- package/components/hook-form/RHFAutocomplete/{index.a063dc44.js → index.ac2b1fae.js} +8 -7
- package/components/hook-form/RHFAutocompleteAsync/{index.ddfd9cc9.js → index.8b4ccc8d.js} +1 -1
- package/components/hook-form/RHFCheckbox/{index.7e7f220b.js → index.acef119c.js} +1 -1
- package/components/hook-form/RHFDateTime/{index.d330709b.js → index.5b080342.js} +9 -8
- package/components/hook-form/RHFPeriod/{index.e2b1293b.js → index.5304e3bd.js} +2 -2
- package/components/hook-form/RHFTextField/{index.e5336d09.js → index.e751dca7.js} +5 -5
- package/components/hook-form/RHFUpload/{index.17e7f9eb.js → index.25db0511.js} +8 -7
- package/components/index.d.ts +1 -0
- package/components/modal/{WindowBase.7acb9f1d.js → WindowBase.850ea31a.js} +9 -8
- package/components/modal/{WindowConfirm.9b829837.js → WindowConfirm.cb37bc58.js} +18 -18
- package/components/modal/classes/index.d.ts +1 -0
- package/components/modal/classes/types.d.ts +1 -0
- package/components/modal/{index.1b25b61d.js → index.a0978193.js} +18 -16
- package/components/mui_extended/Accordion/{index.3faafd8b.js → index.12b1339a.js} +2 -2
- package/components/mui_extended/Badge/Badge.d.ts +3 -0
- package/components/mui_extended/Badge/classes/constants.d.ts +1 -0
- package/components/mui_extended/Badge/classes/index.d.ts +6 -0
- package/components/mui_extended/Badge/classes/types.d.ts +6 -0
- package/components/mui_extended/Badge/index.8c2b8b66.js +36 -0
- package/components/mui_extended/Badge/index.d.ts +2 -0
- package/components/mui_extended/Badge/tests/constants.d.ts +1 -0
- package/components/mui_extended/Badge/tests/utils.d.ts +2 -0
- package/components/mui_extended/Badge/types.d.ts +4 -0
- package/components/mui_extended/Button/{index.fdb5dcbd.js → index.4288f9fc.js} +8 -3
- package/components/mui_extended/IconButton/{index.1a9d4fa5.js → index.fc5b7c2d.js} +1 -1
- package/components/mui_extended/MenuActions/{index.ba1da3b3.js → index.f5b1c022.js} +28 -9
- package/components/mui_extended/MenuActions/types.d.ts +8 -0
- package/components/mui_extended/Pager/{index.67bda2c5.js → index.435af0df.js} +1 -1
- package/components/mui_extended/{index.73e536de.js → index.83979b6a.js} +7 -6
- package/components/mui_extended/index.d.ts +1 -0
- package/contexts/ModalContext/{index.699f95fa.js → index.dee85a61.js} +1 -1
- package/hooks/useModal/{index.7b7d26ba.js → index.de522a10.js} +1 -1
- package/index.js +94 -83
- package/node_modules.d73a220d.js +363 -0
- package/package.json +4 -3
- package/{react-draggable.6d7949a3.js → react-draggable.7abb5d0a.js} +3 -2
- package/{react-resizable.b6f8e04a.js → react-resizable.ba08699a.js} +13 -12
- package/utils/{index.008b4c2a.js → index.c43a95f4.js} +0 -15
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/WindowPopUp/index.d.ts +0 -4
- package/components/modal/ModalDialog/types.d.ts +0 -7
- /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/{GridLayout → AreaGridLayout}/types.d.ts +0 -0
|
@@ -5,22 +5,23 @@ import { useResponsiveDesktop, useFirstRender } from "@m4l/graphics";
|
|
|
5
5
|
import { useHostTools, useModuleDictionary, useNetwork, useModuleSkeleton, EmitEvents } from "@m4l/core";
|
|
6
6
|
import { devtools } from "zustand/middleware";
|
|
7
7
|
import { immer } from "zustand/middleware/immer";
|
|
8
|
-
import { u as useAreasViewerUtilityClasses
|
|
9
|
-
import { u as useAreasAdminUtilityClasses } from "../../components/AreasAdmin/index.
|
|
8
|
+
import { u as useAreasViewerUtilityClasses } from "../../components/AreasViewer/index.9c2aaaeb.js";
|
|
9
|
+
import { u as useAreasAdminUtilityClasses } from "../../components/AreasAdmin/index.cc4cbf56.js";
|
|
10
10
|
import { c as createDynamicMFStore } from "../DynamicMFParmsContext/index.1607c78e.js";
|
|
11
|
-
import { g as getAreasDictionary } from "../../dictionary.
|
|
12
|
-
import
|
|
11
|
+
import { g as getAreasDictionary, D as DICCTIONARY } from "../../dictionary.afb7e3d9.js";
|
|
12
|
+
import "clsx";
|
|
13
|
+
import "../../../GridLayout/index.4ba3767a.js";
|
|
13
14
|
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
import { a as addLayoutItemToBreakPointIfNoExists, b as addLayoutItemToBreakPoints } from "../../../GridLayout/Responsive/index.a12a8cec.js";
|
|
16
|
+
import { debounce, cloneDeep } from "lodash";
|
|
14
17
|
const ROW_HEIGTH_GRIDLAYOUT = 20;
|
|
15
|
-
const
|
|
18
|
+
const PADDING_GRIDLAYOUT = 3;
|
|
16
19
|
const MARGIN_GRIDLAYOUT = 5;
|
|
17
20
|
const DEBOUCED_SAVE_TIME = 500;
|
|
18
|
-
const THROTTLE_RESIZE_TIME = 300;
|
|
19
21
|
const COOKIE_BREAKPOINT_LAYOUTS = "layoutPros";
|
|
20
22
|
const COOKIE_WINDOWS = "windows";
|
|
21
|
-
const BREAKPOINT_SIZES = { lg: 1200, md: 996, sm: 768, xs: 480, xxs:
|
|
22
|
-
const NORMALIZED_COLS = { lg:
|
|
23
|
-
const MAXIMIZED_COLS = { lg: 24, md: 20, sm: 12, xs: 8, xxs: 1 };
|
|
23
|
+
const BREAKPOINT_SIZES = { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 1 };
|
|
24
|
+
const NORMALIZED_COLS = { lg: 64, md: 48, sm: 32, xs: 24, xxs: 1 };
|
|
24
25
|
const DEFAULT_WINDOW = {
|
|
25
26
|
status: "init",
|
|
26
27
|
moduleActions: [],
|
|
@@ -33,12 +34,9 @@ const DEFAULT_WINDOW = {
|
|
|
33
34
|
const DEFAULT_AREA = {
|
|
34
35
|
status: "init",
|
|
35
36
|
zPopUpIndex: 0,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
windowsPopUps: [],
|
|
40
|
-
hashWindowsPopups: {},
|
|
41
|
-
hashWindowsLayouts: {},
|
|
37
|
+
layouts: {},
|
|
38
|
+
colapsedItems: {},
|
|
39
|
+
hashLayoutItems: [],
|
|
42
40
|
currentLayoutId: "",
|
|
43
41
|
currentPopUpId: "",
|
|
44
42
|
breakpoints: BREAKPOINT_SIZES,
|
|
@@ -46,15 +44,14 @@ const DEFAULT_AREA = {
|
|
|
46
44
|
};
|
|
47
45
|
const addArea = (state) => {
|
|
48
46
|
const areaId = `area_${new Date().getTime()}_${(Math.random() * 1e3).toFixed(0)}`;
|
|
49
|
-
const labelNewArea = state.getLabel(getAreasDictionary(
|
|
47
|
+
const labelNewArea = state.getLabel(getAreasDictionary(DICCTIONARY.label_new_area));
|
|
50
48
|
let isFree;
|
|
51
49
|
let name = `${labelNewArea} 1`;
|
|
52
50
|
for (let indexNames = 1; indexNames <= state.areas.length + 1; indexNames++) {
|
|
53
51
|
name = `${labelNewArea} ${indexNames + state.areas.length}`;
|
|
54
52
|
isFree = true;
|
|
55
53
|
for (let index = 0; index < state.areas.length; index++) {
|
|
56
|
-
|
|
57
|
-
if (area.name === name) {
|
|
54
|
+
if (state.hashAreas[state.areas[index]].name === name) {
|
|
58
55
|
isFree = false;
|
|
59
56
|
break;
|
|
60
57
|
}
|
|
@@ -67,10 +64,9 @@ const addArea = (state) => {
|
|
|
67
64
|
id: areaId,
|
|
68
65
|
name,
|
|
69
66
|
loadWindows: false,
|
|
70
|
-
viewMode: state.ownerState.isMobile ? "single" : "multiple",
|
|
71
67
|
...DEFAULT_AREA
|
|
72
68
|
};
|
|
73
|
-
state.areas.push(
|
|
69
|
+
state.areas.push(areaId);
|
|
74
70
|
state.hashAreas[areaId] = newArea;
|
|
75
71
|
if (state.loadAreasFromNetwork) {
|
|
76
72
|
state.networkOperation({
|
|
@@ -100,23 +96,8 @@ const getParmsFromValue = (key, data) => {
|
|
|
100
96
|
}
|
|
101
97
|
return void 0;
|
|
102
98
|
};
|
|
103
|
-
function setAddBreakPoints(state, newLayout) {
|
|
104
|
-
const layoutsBreakPoints = state.breakPointsLayouts;
|
|
105
|
-
const beforeMaximizebreakpointsLayouts = state.beforeMaximizebreakpointsLayouts;
|
|
106
|
-
for (const key in layoutsBreakPoints) {
|
|
107
|
-
const layoutBreakpoint = layoutsBreakPoints[key];
|
|
108
|
-
layoutBreakpoint.unshift(newLayout);
|
|
109
|
-
}
|
|
110
|
-
if (state.viewMode === "single") {
|
|
111
|
-
for (const key in beforeMaximizebreakpointsLayouts) {
|
|
112
|
-
const beforeLayoutBreakpoint = beforeMaximizebreakpointsLayouts[key];
|
|
113
|
-
beforeLayoutBreakpoint.push(newLayout);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return layoutsBreakPoints;
|
|
117
|
-
}
|
|
118
99
|
function deleteLayoutFromBreakPoints(state, layoutId) {
|
|
119
|
-
const layoutsBreakPoints = state.
|
|
100
|
+
const layoutsBreakPoints = state.layouts;
|
|
120
101
|
for (const key in layoutsBreakPoints) {
|
|
121
102
|
const layoutBreakpoint = layoutsBreakPoints[key];
|
|
122
103
|
for (let index = 0; index < layoutBreakpoint.length; index++) {
|
|
@@ -128,61 +109,32 @@ function deleteLayoutFromBreakPoints(state, layoutId) {
|
|
|
128
109
|
}
|
|
129
110
|
}
|
|
130
111
|
}
|
|
131
|
-
function setBreakPointsMaximized(state, layoutId) {
|
|
132
|
-
const layoutsBreakPoints = state.breakPointsLayouts;
|
|
133
|
-
const container = document.getElementsByClassName(
|
|
134
|
-
`${areasViewerClasses.areaGridLayout}-${state.id}`
|
|
135
|
-
)[0];
|
|
136
|
-
console.log("setBreakPointsMaximized", container);
|
|
137
|
-
if (container) {
|
|
138
|
-
const clientHeight = container.clientHeight;
|
|
139
|
-
for (const key in layoutsBreakPoints) {
|
|
140
|
-
const layoutBreakpoint = layoutsBreakPoints[key];
|
|
141
|
-
const cols = key in MAXIMIZED_COLS ? MAXIMIZED_COLS[key] : 1;
|
|
142
|
-
const heigthUnits = (clientHeight + MARGIN_GRIDLAYOUT - 2 * CONTAINER_PADDING_GRIDLAYOUT) / (ROW_HEIGTH_GRIDLAYOUT + MARGIN_GRIDLAYOUT);
|
|
143
|
-
for (let index = 0; index < layoutBreakpoint.length; index++) {
|
|
144
|
-
const l = layoutBreakpoint[index];
|
|
145
|
-
if (l.i === layoutId) {
|
|
146
|
-
l.x = 0;
|
|
147
|
-
l.y = 0;
|
|
148
|
-
l.h = heigthUnits;
|
|
149
|
-
l.w = cols;
|
|
150
|
-
l.minW = 0;
|
|
151
|
-
l.maxW = cols;
|
|
152
|
-
l.minH = 0;
|
|
153
|
-
l.maxH = heigthUnits;
|
|
154
|
-
l.isResizable = false;
|
|
155
|
-
l.isDraggable = false;
|
|
156
|
-
} else {
|
|
157
|
-
l.x = 0;
|
|
158
|
-
l.y = 1;
|
|
159
|
-
l.h = 0;
|
|
160
|
-
l.w = 0;
|
|
161
|
-
l.minW = 0;
|
|
162
|
-
l.maxW = 0;
|
|
163
|
-
l.minH = 0;
|
|
164
|
-
l.maxH = 0;
|
|
165
|
-
}
|
|
166
|
-
l.isResizable = false;
|
|
167
|
-
l.isDraggable = false;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return layoutsBreakPoints;
|
|
172
|
-
}
|
|
173
112
|
function getDataFromResponse(data, state, areaId) {
|
|
174
|
-
|
|
113
|
+
let newBreakPointsLayouts = getParmsFromValue(COOKIE_BREAKPOINT_LAYOUTS, data);
|
|
175
114
|
const windows = getParmsFromValue(COOKIE_WINDOWS, data);
|
|
176
|
-
const
|
|
177
|
-
const
|
|
115
|
+
const newWindowsLayoutsIds = [];
|
|
116
|
+
const newHashLayoutItems = [];
|
|
117
|
+
if (!newBreakPointsLayouts) {
|
|
118
|
+
newBreakPointsLayouts = {};
|
|
119
|
+
}
|
|
120
|
+
console.log(
|
|
121
|
+
"getDataFromResponse before start",
|
|
122
|
+
windows,
|
|
123
|
+
newBreakPointsLayouts,
|
|
124
|
+
BREAKPOINT_SIZES
|
|
125
|
+
);
|
|
126
|
+
for (const breakPoint in BREAKPOINT_SIZES) {
|
|
127
|
+
if (!newBreakPointsLayouts[breakPoint]) {
|
|
128
|
+
newBreakPointsLayouts[breakPoint] = [];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
178
131
|
if (windows) {
|
|
179
132
|
for (const key in windows) {
|
|
180
133
|
const element = windows[key];
|
|
181
|
-
if (element && element["
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
newHashWindowLayouts[key] = {
|
|
134
|
+
if (element && element["mfProps"] && element["emergeType"] === "layout" && element["winType"] === "microfrontend") {
|
|
135
|
+
newWindowsLayoutsIds.push(key);
|
|
136
|
+
const onClose = state.areaActions.closeLayout;
|
|
137
|
+
state.hashWindows[key] = {
|
|
186
138
|
...DEFAULT_WINDOW,
|
|
187
139
|
...element,
|
|
188
140
|
windowId: key,
|
|
@@ -194,14 +146,42 @@ function getDataFromResponse(data, state, areaId) {
|
|
|
194
146
|
}),
|
|
195
147
|
onClose: () => onClose(areaId, key)
|
|
196
148
|
};
|
|
197
|
-
|
|
149
|
+
newHashLayoutItems.push(key);
|
|
150
|
+
for (const breakPoint in BREAKPOINT_SIZES) {
|
|
151
|
+
addLayoutItemToBreakPointIfNoExists(
|
|
152
|
+
newBreakPointsLayouts,
|
|
153
|
+
breakPoint,
|
|
154
|
+
{ i: element.windowId, x: 0, y: 0, w: 5, h: 5 },
|
|
155
|
+
NORMALIZED_COLS,
|
|
156
|
+
[MARGIN_GRIDLAYOUT, MARGIN_GRIDLAYOUT],
|
|
157
|
+
[PADDING_GRIDLAYOUT, PADDING_GRIDLAYOUT],
|
|
158
|
+
ROW_HEIGTH_GRIDLAYOUT
|
|
159
|
+
);
|
|
160
|
+
console.log(
|
|
161
|
+
"addLayoutItemToBreakPointIfNoExists",
|
|
162
|
+
element,
|
|
163
|
+
breakPoint,
|
|
164
|
+
key,
|
|
165
|
+
newBreakPointsLayouts[breakPoint]
|
|
166
|
+
);
|
|
167
|
+
}
|
|
198
168
|
}
|
|
199
169
|
}
|
|
170
|
+
for (const breakPoint in BREAKPOINT_SIZES) {
|
|
171
|
+
newBreakPointsLayouts[breakPoint] = newBreakPointsLayouts[breakPoint].filter((li) => {
|
|
172
|
+
return newWindowsLayoutsIds.indexOf(li.i) > -1;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
for (const breakPoint in BREAKPOINT_SIZES) {
|
|
177
|
+
newBreakPointsLayouts[breakPoint] = [];
|
|
178
|
+
}
|
|
200
179
|
}
|
|
180
|
+
console.log("newBreakPointsLayouts", newBreakPointsLayouts, windows);
|
|
201
181
|
return {
|
|
202
182
|
newBreakPointsLayouts,
|
|
203
|
-
|
|
204
|
-
|
|
183
|
+
newWindowsLayoutsIds,
|
|
184
|
+
newHashLayoutItems
|
|
205
185
|
};
|
|
206
186
|
}
|
|
207
187
|
function getCookiesContainer(data, containerId) {
|
|
@@ -278,11 +258,10 @@ const createAreasStore = (initProps) => {
|
|
|
278
258
|
const newArea = {
|
|
279
259
|
...DEFAULT_AREA,
|
|
280
260
|
...response.data[i],
|
|
281
|
-
loadWindows: true
|
|
282
|
-
viewMode: otherState.ownerState.isMobile ? "single" : "multiple"
|
|
261
|
+
loadWindows: true
|
|
283
262
|
};
|
|
284
|
-
otherState.areas.push(newArea);
|
|
285
263
|
otherState.hashAreas[newArea.id] = newArea;
|
|
264
|
+
otherState.areas.push(newArea.id);
|
|
286
265
|
}
|
|
287
266
|
} else {
|
|
288
267
|
addArea(otherState);
|
|
@@ -294,7 +273,7 @@ const createAreasStore = (initProps) => {
|
|
|
294
273
|
updateOwnerStateClasses(state2);
|
|
295
274
|
});
|
|
296
275
|
if (get().areas.length > 0) {
|
|
297
|
-
get().areasActions.selectArea(get().areas[0]
|
|
276
|
+
get().areasActions.selectArea(get().areas[0]);
|
|
298
277
|
}
|
|
299
278
|
});
|
|
300
279
|
});
|
|
@@ -303,9 +282,8 @@ const createAreasStore = (initProps) => {
|
|
|
303
282
|
},
|
|
304
283
|
editArea: (idArea, newName) => {
|
|
305
284
|
set((state) => {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
state.areas[index].name = newName;
|
|
285
|
+
if (state.hashAreas[idArea]) {
|
|
286
|
+
state.hashAreas[idArea].name = newName;
|
|
309
287
|
state.networkOperation({
|
|
310
288
|
method: "PATCH",
|
|
311
289
|
endPoint: `areas/${idArea}`,
|
|
@@ -327,7 +305,7 @@ const createAreasStore = (initProps) => {
|
|
|
327
305
|
deleteArea: (areaId) => {
|
|
328
306
|
let selectNewAreaId = "";
|
|
329
307
|
set((state) => {
|
|
330
|
-
const removeIndex = state.areas.
|
|
308
|
+
const removeIndex = state.areas.indexOf(areaId);
|
|
331
309
|
if (removeIndex > -1) {
|
|
332
310
|
for (const key in state.hashWindows) {
|
|
333
311
|
if (state.hashWindows[key].areaId === areaId) {
|
|
@@ -339,7 +317,7 @@ const createAreasStore = (initProps) => {
|
|
|
339
317
|
}
|
|
340
318
|
if (state.currentAreaId === areaId) {
|
|
341
319
|
if (state.areas.length > 0) {
|
|
342
|
-
selectNewAreaId = state.areas[0]
|
|
320
|
+
selectNewAreaId = state.areas[0];
|
|
343
321
|
} else {
|
|
344
322
|
state.currentAreaId = "";
|
|
345
323
|
}
|
|
@@ -376,9 +354,8 @@ const createAreasStore = (initProps) => {
|
|
|
376
354
|
});
|
|
377
355
|
}
|
|
378
356
|
}
|
|
379
|
-
if (get().hashAreas[areaId].
|
|
380
|
-
|
|
381
|
-
}
|
|
357
|
+
if (get().hashAreas[areaId].maximizedId !== void 0)
|
|
358
|
+
;
|
|
382
359
|
},
|
|
383
360
|
setHandlerGetLabel: (newHandler) => {
|
|
384
361
|
set((state) => {
|
|
@@ -395,14 +372,8 @@ const createAreasStore = (initProps) => {
|
|
|
395
372
|
areaActions: {
|
|
396
373
|
addWindow: (newWindowProps) => {
|
|
397
374
|
const windowId = `${get().currentAreaId}_window_${new Date().getTime()}_${(Math.random() * 1e3).toFixed(0)}`;
|
|
398
|
-
if (newWindowProps.emergeType === "layout") {
|
|
399
|
-
get().areaActions.
|
|
400
|
-
get().currentAreaId,
|
|
401
|
-
windowId,
|
|
402
|
-
newWindowProps
|
|
403
|
-
);
|
|
404
|
-
} else if (newWindowProps.emergeType === "popup") {
|
|
405
|
-
get().areaActions.addWindowPopUp(
|
|
375
|
+
if (newWindowProps.emergeType === "layout" || newWindowProps.emergeType === "popup") {
|
|
376
|
+
get().areaActions.addLayout(
|
|
406
377
|
get().currentAreaId,
|
|
407
378
|
windowId,
|
|
408
379
|
newWindowProps
|
|
@@ -415,71 +386,93 @@ const createAreasStore = (initProps) => {
|
|
|
415
386
|
);
|
|
416
387
|
}
|
|
417
388
|
},
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
389
|
+
addLayout: (areaId, windowId, newWindowProps) => {
|
|
390
|
+
let previousId = windowId;
|
|
391
|
+
const freeMove = newWindowProps.emergeType === "popup" ? true : false;
|
|
392
|
+
const newLayoutItem = {
|
|
393
|
+
...newWindowProps.layoutProps,
|
|
394
|
+
i: windowId,
|
|
395
|
+
isDraggable: true,
|
|
396
|
+
isResizable: true,
|
|
397
|
+
freeMove
|
|
398
|
+
};
|
|
425
399
|
set((state) => {
|
|
426
400
|
const area = state.hashAreas[areaId];
|
|
427
401
|
if (!area) {
|
|
428
402
|
return;
|
|
429
403
|
}
|
|
430
|
-
|
|
431
|
-
(
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
404
|
+
if (newWindowProps.replaceMeId) {
|
|
405
|
+
for (let index = 0; index < area.hashLayoutItems.length; index++) {
|
|
406
|
+
const key = area.hashLayoutItems[index];
|
|
407
|
+
const WindoPopUp = state.hashWindows[key];
|
|
408
|
+
if (WindoPopUp.replaceMeId === newWindowProps.replaceMeId) {
|
|
409
|
+
previousId = key;
|
|
410
|
+
WindoPopUp.dynamicMFStore.getState().actions.changeData(newWindowProps.dynamicParams);
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
if (previousId === windowId) {
|
|
416
|
+
const dynamicMFStore = createDynamicMFStore({
|
|
417
|
+
dynamicMFParameters: newWindowProps.dynamicParams,
|
|
418
|
+
windowId
|
|
419
|
+
});
|
|
420
|
+
state.hashWindows[windowId] = {
|
|
421
|
+
...newWindowProps,
|
|
422
|
+
areaId,
|
|
423
|
+
windowId,
|
|
424
|
+
onClose: (removeLayoutId) => {
|
|
425
|
+
get().areaActions.closeLayout(areaId, removeLayoutId);
|
|
426
|
+
},
|
|
427
|
+
...DEFAULT_WINDOW,
|
|
428
|
+
dynamicMFStore
|
|
429
|
+
};
|
|
430
|
+
area.hashLayoutItems.push(windowId);
|
|
431
|
+
if (newWindowProps.emergeType === "layout") {
|
|
432
|
+
area.currentLayoutId = windowId;
|
|
433
|
+
if (area.maximizedId) {
|
|
434
|
+
area.maximizedId = windowId;
|
|
435
|
+
}
|
|
436
|
+
} else {
|
|
437
|
+
area.currentPopUpId = windowId;
|
|
438
|
+
}
|
|
439
|
+
area.layouts = addLayoutItemToBreakPoints(
|
|
440
|
+
area.layouts,
|
|
441
|
+
newLayoutItem,
|
|
442
|
+
NORMALIZED_COLS,
|
|
443
|
+
[MARGIN_GRIDLAYOUT, MARGIN_GRIDLAYOUT],
|
|
444
|
+
[PADDING_GRIDLAYOUT, PADDING_GRIDLAYOUT],
|
|
445
|
+
ROW_HEIGTH_GRIDLAYOUT,
|
|
446
|
+
area.containerHeight
|
|
447
|
+
);
|
|
435
448
|
}
|
|
436
|
-
deleteLayoutFromBreakPoints(area, removeLayoutId);
|
|
437
|
-
delete state.hashWindows[removeLayoutId];
|
|
438
|
-
delete area.hashWindowsLayouts[removeLayoutId];
|
|
439
449
|
});
|
|
440
450
|
get().areaActions.saveLayouts(areaId);
|
|
441
|
-
if (get().hashAreas[areaId].singleId === removeLayoutId) {
|
|
442
|
-
get().areaActions.maximizeLayout(areaId);
|
|
443
|
-
}
|
|
444
451
|
},
|
|
445
|
-
|
|
446
|
-
const newLayout = {
|
|
447
|
-
...newWindow.layoutProps,
|
|
448
|
-
i: windowId,
|
|
449
|
-
isDraggable: true,
|
|
450
|
-
isResizable: true,
|
|
451
|
-
winType: newWindow.winType
|
|
452
|
-
};
|
|
452
|
+
closeLayout: (areaId, removeLayoutId) => {
|
|
453
453
|
set((state) => {
|
|
454
454
|
const area = state.hashAreas[areaId];
|
|
455
455
|
if (!area) {
|
|
456
456
|
return;
|
|
457
457
|
}
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
area
|
|
463
|
-
|
|
464
|
-
...newWindow,
|
|
465
|
-
areaId,
|
|
466
|
-
windowId,
|
|
467
|
-
emergeType: "layout",
|
|
468
|
-
onClose: (removeLayoutId) => {
|
|
469
|
-
get().areaActions.closeWindowLayout(areaId, removeLayoutId);
|
|
470
|
-
},
|
|
471
|
-
...DEFAULT_WINDOW,
|
|
472
|
-
dynamicMFStore
|
|
473
|
-
};
|
|
474
|
-
state.hashWindows[windowId] = area.hashWindowsLayouts[windowId];
|
|
475
|
-
setAddBreakPoints(area, newLayout);
|
|
458
|
+
const removeIndex = area.hashLayoutItems.indexOf(removeLayoutId);
|
|
459
|
+
if (removeIndex > -1) {
|
|
460
|
+
area.hashLayoutItems.splice(removeIndex, 1);
|
|
461
|
+
}
|
|
462
|
+
deleteLayoutFromBreakPoints(area, removeLayoutId);
|
|
463
|
+
delete state.hashWindows[removeLayoutId];
|
|
476
464
|
});
|
|
477
|
-
get().areaActions.selectWindowLayout(areaId, windowId);
|
|
478
|
-
if (get().hashAreas[areaId].viewMode === "single" || newWindow?.openType === "maximized") {
|
|
479
|
-
get().areaActions.maximizeLayout(areaId, windowId);
|
|
480
|
-
}
|
|
481
465
|
get().areaActions.saveLayouts(areaId);
|
|
482
|
-
get().
|
|
466
|
+
if (get().hashAreas[areaId].maximizedId === removeLayoutId) {
|
|
467
|
+
get().areaActions.maximizeLayout(areaId);
|
|
468
|
+
}
|
|
469
|
+
for (let index = 0; index < get().hashAreas[areaId].hashLayoutItems.length; index++) {
|
|
470
|
+
const layoutItemId = get().hashAreas[areaId].hashLayoutItems[index];
|
|
471
|
+
const layoutItem = get().hashWindows[layoutItemId];
|
|
472
|
+
if (layoutItem.parentLayoutId === removeLayoutId) {
|
|
473
|
+
get().areaActions.closeLayout(areaId, layoutItem.windowId);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
483
476
|
},
|
|
484
477
|
saveLayouts: (areaId) => {
|
|
485
478
|
let nrKeys = 0;
|
|
@@ -487,17 +480,19 @@ const createAreasStore = (initProps) => {
|
|
|
487
480
|
if (!area) {
|
|
488
481
|
return;
|
|
489
482
|
}
|
|
483
|
+
console.log("saveLayouts before", areaId, area.hashLayoutItems);
|
|
490
484
|
const saveObjetc = {};
|
|
491
|
-
for (
|
|
492
|
-
const
|
|
493
|
-
|
|
485
|
+
for (let index = 0; index < area.hashLayoutItems.length; index++) {
|
|
486
|
+
const key = area.hashLayoutItems[index];
|
|
487
|
+
console.log("saveLayouts", areaId, key, get().hashWindows[key]);
|
|
488
|
+
if (get().hashWindows[key] && get().hashWindows[key].winType === "microfrontend") {
|
|
489
|
+
const element = get().hashWindows[key];
|
|
494
490
|
const hasPropsToSave = {
|
|
495
491
|
winType: true,
|
|
496
492
|
emergeType: true,
|
|
497
493
|
title: true,
|
|
498
494
|
url_icon: true,
|
|
499
495
|
windowOptions: true,
|
|
500
|
-
layoutProps: true,
|
|
501
496
|
moduleId: true,
|
|
502
497
|
windowId: true,
|
|
503
498
|
mfProps: true
|
|
@@ -511,6 +506,7 @@ const createAreasStore = (initProps) => {
|
|
|
511
506
|
}
|
|
512
507
|
}
|
|
513
508
|
if (nrKeys > 0) {
|
|
509
|
+
console.log("SaveLayouyts", saveObjetc);
|
|
514
510
|
get().networkOperation({
|
|
515
511
|
method: "PUT",
|
|
516
512
|
endPoint: `cookies/${area.id}/${COOKIE_WINDOWS}`,
|
|
@@ -560,93 +556,10 @@ const createAreasStore = (initProps) => {
|
|
|
560
556
|
state.hashWindows[windowId] = state.hashWindowsModals[windowId];
|
|
561
557
|
});
|
|
562
558
|
},
|
|
563
|
-
closeWindowPopUp: (areaId, removePopUpId) => {
|
|
564
|
-
set((state) => {
|
|
565
|
-
const area = state.hashAreas[areaId];
|
|
566
|
-
if (!area) {
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
const removeIndex = area.windowsPopUps.findIndex(
|
|
570
|
-
(wpId) => wpId === removePopUpId
|
|
571
|
-
);
|
|
572
|
-
if (removeIndex > -1) {
|
|
573
|
-
area.windowsPopUps.splice(removeIndex, 1);
|
|
574
|
-
}
|
|
575
|
-
delete area.hashWindowsPopups[removePopUpId];
|
|
576
|
-
delete state.hashWindows[removePopUpId];
|
|
577
|
-
});
|
|
578
|
-
},
|
|
579
|
-
selectWindowPopUp: (areaId, popUpId) => {
|
|
580
|
-
set((state) => {
|
|
581
|
-
state.hashAreas[areaId].zPopUpIndex++;
|
|
582
|
-
state.hashAreas[areaId].currentPopUpId = popUpId;
|
|
583
|
-
state.hashAreas[areaId].zPopUpIndex++;
|
|
584
|
-
state.hashAreas[areaId].currentPopUpId = popUpId;
|
|
585
|
-
state.hashAreas[areaId].hashWindowsPopups[popUpId].zIndex = state.hashAreas[areaId].zPopUpIndex;
|
|
586
|
-
if (state.hashAreas[areaId].hashWindowsPopups[popUpId].parentLayoutId && state.hashAreas[areaId].hashWindowsPopups[popUpId].parentLayoutId !== "") {
|
|
587
|
-
state.hashAreas[areaId].currentLayoutId = state.hashAreas[areaId].hashWindowsPopups[popUpId].parentLayoutId;
|
|
588
|
-
} else {
|
|
589
|
-
state.hashAreas[areaId].currentLayoutId = "";
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
setTimeout(() => {
|
|
593
|
-
const container = document.getElementsByClassName(
|
|
594
|
-
`${areasViewerClasses.areaGridLayoutPanelContainer}-${areaId}`
|
|
595
|
-
)[0];
|
|
596
|
-
const element = document.getElementsByClassName(
|
|
597
|
-
`${areasViewerClasses.windowPopupRoot}-${popUpId}`
|
|
598
|
-
)[0];
|
|
599
|
-
if (element && container) {
|
|
600
|
-
const { top, left } = element.getBoundingClientRect();
|
|
601
|
-
const { top: containerTop, left: containerLeft } = container.getBoundingClientRect();
|
|
602
|
-
container.scrollTop = container.scrollTop + top - containerTop;
|
|
603
|
-
container.scrollLeft = container.scrollLeft + left - containerLeft;
|
|
604
|
-
}
|
|
605
|
-
}, 100);
|
|
606
|
-
},
|
|
607
|
-
addWindowPopUp: (areaId, windowId, newWindowPopupProps) => {
|
|
608
|
-
let popUpId = windowId;
|
|
609
|
-
set((state) => {
|
|
610
|
-
const area = state.hashAreas[areaId];
|
|
611
|
-
if (!area) {
|
|
612
|
-
return;
|
|
613
|
-
}
|
|
614
|
-
if (newWindowPopupProps.replaceMeId) {
|
|
615
|
-
for (const key in area.hashWindowsPopups) {
|
|
616
|
-
const WindoPopUp = area.hashWindowsPopups[key];
|
|
617
|
-
if (WindoPopUp.replaceMeId === newWindowPopupProps.replaceMeId) {
|
|
618
|
-
popUpId = key;
|
|
619
|
-
area.hashWindowsPopups[key].dynamicMFStore.getState().actions.changeData(newWindowPopupProps.dynamicParams);
|
|
620
|
-
break;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
if (popUpId === windowId) {
|
|
625
|
-
const dynamicMFStore = createDynamicMFStore({
|
|
626
|
-
dynamicMFParameters: newWindowPopupProps.dynamicParams,
|
|
627
|
-
windowId
|
|
628
|
-
});
|
|
629
|
-
area.windowsPopUps.push(windowId);
|
|
630
|
-
area.hashWindowsPopups[windowId] = {
|
|
631
|
-
...newWindowPopupProps,
|
|
632
|
-
emergeType: "popup",
|
|
633
|
-
windowId,
|
|
634
|
-
areaId,
|
|
635
|
-
onClose: (removePopUpId) => get().areaActions.closeWindowPopUp(areaId, removePopUpId),
|
|
636
|
-
zIndex: area.zPopUpIndex,
|
|
637
|
-
...DEFAULT_WINDOW,
|
|
638
|
-
dynamicMFStore
|
|
639
|
-
};
|
|
640
|
-
state.hashWindows[windowId] = area.hashWindowsPopups[windowId];
|
|
641
|
-
area.currentPopUpId = windowId;
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
get().areaActions.selectWindowPopUp(areaId, popUpId);
|
|
645
|
-
},
|
|
646
559
|
bouncedSaveBreakpointsLayouts: debounce(
|
|
647
560
|
(areaId) => {
|
|
648
561
|
const purgedLayouts = {
|
|
649
|
-
...get().hashAreas[areaId].
|
|
562
|
+
...get().hashAreas[areaId].layouts
|
|
650
563
|
};
|
|
651
564
|
const finalLayouts = {};
|
|
652
565
|
for (const key in purgedLayouts) {
|
|
@@ -655,7 +568,7 @@ const createAreasStore = (initProps) => {
|
|
|
655
568
|
if (l.i === "none") {
|
|
656
569
|
return false;
|
|
657
570
|
}
|
|
658
|
-
if (get().hashAreas[areaId].
|
|
571
|
+
if (get().hashAreas[areaId].hashLayoutItems.indexOf(l.i) > -1) {
|
|
659
572
|
return true;
|
|
660
573
|
}
|
|
661
574
|
return false;
|
|
@@ -676,101 +589,91 @@ const createAreasStore = (initProps) => {
|
|
|
676
589
|
});
|
|
677
590
|
}
|
|
678
591
|
},
|
|
679
|
-
DEBOUCED_SAVE_TIME
|
|
592
|
+
DEBOUCED_SAVE_TIME,
|
|
593
|
+
{
|
|
594
|
+
leading: true,
|
|
595
|
+
trailing: true
|
|
596
|
+
}
|
|
680
597
|
),
|
|
681
|
-
onBreakpointsLayoutsChange: (areaId,
|
|
598
|
+
onBreakpointsLayoutsChange: (areaId, _currentLayout, newAllLayouts) => {
|
|
599
|
+
console.log("onBreakpointsLayoutsChange", areaId, newAllLayouts);
|
|
682
600
|
set((state) => {
|
|
683
|
-
state.hashAreas[areaId].
|
|
601
|
+
state.hashAreas[areaId].layouts = cloneDeep(newAllLayouts);
|
|
684
602
|
});
|
|
685
|
-
if (!get().hashAreas[areaId].
|
|
603
|
+
if (!get().hashAreas[areaId].maximizedId) {
|
|
686
604
|
get().areaActions.bouncedSaveBreakpointsLayouts(areaId);
|
|
687
605
|
}
|
|
688
606
|
},
|
|
689
|
-
|
|
607
|
+
onContainerChange: (areaId, e) => {
|
|
608
|
+
console.log("onContainerChange Store", areaId, e.containerHeight);
|
|
690
609
|
set((state) => {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
state.currentModuleId = state.hashWindows[layoutId].moduleId;
|
|
694
|
-
if (area.currentPopUpId !== "" && area.hashWindowsPopups[area.currentPopUpId]) {
|
|
695
|
-
const windowPopup = area.hashWindowsPopups[area.currentPopUpId];
|
|
696
|
-
if (windowPopup.parentLayoutId !== layoutId) {
|
|
697
|
-
area.currentPopUpId = "";
|
|
698
|
-
}
|
|
699
|
-
}
|
|
610
|
+
state.hashAreas[areaId].containerHeight = e.containerHeight;
|
|
611
|
+
state.hashAreas[areaId].currentBreakpoint = e.breakpoint;
|
|
700
612
|
});
|
|
701
613
|
},
|
|
702
|
-
|
|
703
|
-
let finalLayoutId = layoutId;
|
|
614
|
+
selectLayout: (areaId, layoutId) => {
|
|
704
615
|
set((state) => {
|
|
705
616
|
const area = state.hashAreas[areaId];
|
|
706
|
-
if (
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
area.
|
|
710
|
-
area.
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
617
|
+
if (state.hashWindows[layoutId].emergeType === "layout") {
|
|
618
|
+
area.currentLayoutId = layoutId;
|
|
619
|
+
state.currentModuleId = state.hashWindows[layoutId].moduleId;
|
|
620
|
+
if (area.currentPopUpId !== "" && state.hashWindows[area.currentPopUpId]) {
|
|
621
|
+
if (state.hashWindows[area.currentPopUpId].parentLayoutId !== layoutId) {
|
|
622
|
+
area.currentPopUpId = "";
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
} else {
|
|
626
|
+
state.hashAreas[areaId].currentPopUpId = layoutId;
|
|
627
|
+
const parentLayoutId = state.hashWindows[layoutId]?.parentLayoutId;
|
|
628
|
+
if (parentLayoutId && state.hashWindows[parentLayoutId]) {
|
|
629
|
+
area.currentLayoutId = parentLayoutId;
|
|
630
|
+
state.currentModuleId = state.hashWindows[parentLayoutId].moduleId;
|
|
631
|
+
} else {
|
|
632
|
+
area.currentLayoutId = "";
|
|
633
|
+
state.currentModuleId = "";
|
|
716
634
|
}
|
|
717
635
|
}
|
|
718
|
-
area.viewMode = "single";
|
|
719
|
-
area.singleId = finalLayoutId;
|
|
720
|
-
setTimeout(() => {
|
|
721
|
-
set((state2) => {
|
|
722
|
-
setBreakPointsMaximized(
|
|
723
|
-
state2.hashAreas[areaId],
|
|
724
|
-
finalLayoutId
|
|
725
|
-
);
|
|
726
|
-
});
|
|
727
|
-
}, 100);
|
|
728
636
|
});
|
|
729
|
-
|
|
730
|
-
|
|
637
|
+
},
|
|
638
|
+
unColapseLayoutItem: (areaId, layoutId) => {
|
|
639
|
+
if (get().hashWindows[layoutId] && get().hashAreas[areaId].colapsedItems[layoutId]) {
|
|
640
|
+
set((state) => {
|
|
641
|
+
state.hashAreas[areaId].colapsedItems = {
|
|
642
|
+
...state.hashAreas[areaId].colapsedItems
|
|
643
|
+
};
|
|
644
|
+
delete state.hashAreas[areaId].colapsedItems[layoutId];
|
|
645
|
+
state.hashWindows[layoutId].colapsed = false;
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
colapseLayoutItem: (areaId, layoutId) => {
|
|
650
|
+
if (!get().hashAreas[areaId].maximizedId && get().hashWindows[layoutId]) {
|
|
651
|
+
set((state) => {
|
|
652
|
+
state.hashAreas[areaId].colapsedItems = {
|
|
653
|
+
...state.hashAreas[areaId].colapsedItems
|
|
654
|
+
};
|
|
655
|
+
state.hashAreas[areaId].colapsedItems[layoutId] = true;
|
|
656
|
+
state.hashWindows[layoutId].colapsed = true;
|
|
657
|
+
});
|
|
731
658
|
}
|
|
732
659
|
},
|
|
733
|
-
|
|
660
|
+
maximizeLayout: (areaId, layoutId) => {
|
|
734
661
|
set((state) => {
|
|
735
662
|
const area = state.hashAreas[areaId];
|
|
736
663
|
if (!area)
|
|
737
664
|
return;
|
|
738
|
-
|
|
739
|
-
return;
|
|
740
|
-
}
|
|
741
|
-
if (area.viewMode === "single" && area.currentLayoutId !== "") {
|
|
742
|
-
console.log("Rezigning", areaId);
|
|
743
|
-
const layoutsBreakPoints = area.breakPointsLayouts;
|
|
744
|
-
const container = document.getElementsByClassName(
|
|
745
|
-
`${areasViewerClasses.areaGridLayout}-${area.id}`
|
|
746
|
-
)[0];
|
|
747
|
-
window.dispatchEvent(new Event("resize"));
|
|
748
|
-
for (const key in layoutsBreakPoints) {
|
|
749
|
-
const layoutBreakpoint = layoutsBreakPoints[key];
|
|
750
|
-
if (layoutBreakpoint) {
|
|
751
|
-
const clientHeight = container.clientHeight;
|
|
752
|
-
const heigthUnits = (clientHeight + MARGIN_GRIDLAYOUT - 2 * CONTAINER_PADDING_GRIDLAYOUT) / (ROW_HEIGTH_GRIDLAYOUT + MARGIN_GRIDLAYOUT);
|
|
753
|
-
for (let index = 0; index < layoutBreakpoint.length; index++) {
|
|
754
|
-
const l = layoutBreakpoint[index];
|
|
755
|
-
if (l.i === area.currentLayoutId) {
|
|
756
|
-
l.h = heigthUnits;
|
|
757
|
-
l.maxH = heigthUnits;
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}
|
|
665
|
+
area.maximizedId = layoutId;
|
|
763
666
|
});
|
|
667
|
+
if (layoutId) {
|
|
668
|
+
get().areaActions.selectLayout(areaId, layoutId);
|
|
669
|
+
}
|
|
764
670
|
},
|
|
765
671
|
normalizeLayouts: (areaId) => {
|
|
766
672
|
set((state) => {
|
|
767
|
-
|
|
673
|
+
const area = state.hashAreas[areaId];
|
|
674
|
+
if (!area)
|
|
768
675
|
return;
|
|
769
|
-
|
|
770
|
-
state.hashAreas[areaId].viewMode = "multiple";
|
|
771
|
-
state.hashAreas[areaId].singleId = void 0;
|
|
772
|
-
state.hashAreas[areaId].breakPointsLayouts = state.hashAreas[areaId].beforeMaximizebreakpointsLayouts;
|
|
773
|
-
}
|
|
676
|
+
area.maximizedId = void 0;
|
|
774
677
|
});
|
|
775
678
|
},
|
|
776
679
|
loadWindowsFromApi: (areaId) => {
|
|
@@ -805,27 +708,19 @@ const createAreasStore = (initProps) => {
|
|
|
805
708
|
const area3 = state.hashAreas[areaId];
|
|
806
709
|
const {
|
|
807
710
|
newBreakPointsLayouts,
|
|
808
|
-
|
|
809
|
-
|
|
711
|
+
newWindowsLayoutsIds,
|
|
712
|
+
newHashLayoutItems
|
|
810
713
|
} = getDataFromResponse(response.data, state, areaId);
|
|
811
|
-
area3.
|
|
812
|
-
|
|
813
|
-
area3.beforeMaximizebreakpointsLayouts = newBreakPointsLayouts;
|
|
814
|
-
}
|
|
815
|
-
area3.windowsLayouts = newWindowsLayouts;
|
|
816
|
-
area3.hashWindowsLayouts = newHashWindowLayouts;
|
|
714
|
+
area3.layouts = newBreakPointsLayouts;
|
|
715
|
+
area3.hashLayoutItems = newHashLayoutItems;
|
|
817
716
|
area3.status = "loaded";
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
717
|
+
console.log(
|
|
718
|
+
"loadWindowsFromApi",
|
|
719
|
+
newBreakPointsLayouts,
|
|
720
|
+
newHashLayoutItems,
|
|
721
|
+
newWindowsLayoutsIds
|
|
823
722
|
);
|
|
824
|
-
}
|
|
825
|
-
console.log("loadWindowsFromApi", area2.viewMode);
|
|
826
|
-
if (area2.viewMode === "single") {
|
|
827
|
-
get().areaActions.maximizeLayout(area2.id);
|
|
828
|
-
}
|
|
723
|
+
});
|
|
829
724
|
}).catch((_response) => {
|
|
830
725
|
set((state) => {
|
|
831
726
|
state.hashAreas[areaId].status = "loaded";
|
|
@@ -843,6 +738,11 @@ const createAreasStore = (initProps) => {
|
|
|
843
738
|
});
|
|
844
739
|
},
|
|
845
740
|
getCookie: (windowId, id) => {
|
|
741
|
+
console.log(
|
|
742
|
+
"getCookie",
|
|
743
|
+
get().hashWindows[windowId].cookies.windowCookies[id],
|
|
744
|
+
get().hashWindows[windowId].cookies.moduleCookies[id]
|
|
745
|
+
);
|
|
846
746
|
if (get().hashWindows[windowId]) {
|
|
847
747
|
return get().hashWindows[windowId].cookies.windowCookies[id] || get().hashWindows[windowId].cookies.moduleCookies[id];
|
|
848
748
|
}
|
|
@@ -932,6 +832,11 @@ const createAreasStore = (initProps) => {
|
|
|
932
832
|
response.data,
|
|
933
833
|
windowId
|
|
934
834
|
);
|
|
835
|
+
console.log(
|
|
836
|
+
"cookies",
|
|
837
|
+
hWs.cookies.windowCookies,
|
|
838
|
+
hWs.cookies.moduleCookies
|
|
839
|
+
);
|
|
935
840
|
hWs.status = "loaded";
|
|
936
841
|
}
|
|
937
842
|
});
|
|
@@ -985,6 +890,7 @@ const createAreasStore = (initProps) => {
|
|
|
985
890
|
toast: (windowId, options) => {
|
|
986
891
|
const hW = get().hashWindows[windowId];
|
|
987
892
|
if (hW) {
|
|
893
|
+
console.log("replaceMeId", options.replaceMeId);
|
|
988
894
|
if (options.replaceMeId) {
|
|
989
895
|
for (const key in hW.hashToasties) {
|
|
990
896
|
const t = hW.hashToasties[key];
|
|
@@ -1112,9 +1018,9 @@ function AreasProvider(props) {
|
|
|
1112
1018
|
setExternalState
|
|
1113
1019
|
} = useStore(areasStoreRef.current, (state) => state.areasActions, shallow);
|
|
1114
1020
|
const addWindow = useCallback((newWindow) => {
|
|
1115
|
-
const
|
|
1021
|
+
const currentAreaId = areasStoreRef.current?.getState().currentAreaId;
|
|
1116
1022
|
const areas = areasStoreRef.current?.getState().areas;
|
|
1117
|
-
if (
|
|
1023
|
+
if (currentAreaId && areas) {
|
|
1118
1024
|
areasStoreRef.current?.getState().areaActions.addWindow(newWindow);
|
|
1119
1025
|
}
|
|
1120
1026
|
}, []);
|
|
@@ -1158,9 +1064,8 @@ function AreasProvider(props) {
|
|
|
1158
1064
|
}
|
|
1159
1065
|
export {
|
|
1160
1066
|
AreasContext as A,
|
|
1161
|
-
CONTAINER_PADDING_GRIDLAYOUT as C,
|
|
1162
1067
|
MARGIN_GRIDLAYOUT as M,
|
|
1068
|
+
PADDING_GRIDLAYOUT as P,
|
|
1163
1069
|
ROW_HEIGTH_GRIDLAYOUT as R,
|
|
1164
|
-
THROTTLE_RESIZE_TIME as T,
|
|
1165
1070
|
AreasProvider as a
|
|
1166
1071
|
};
|