@m4l/components 0.1.76 → 0.1.78
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 +22 -3
- package/components/AccountPopover/{index.47cf6c43.js → index.7e76dbb7.js} +8 -7
- package/components/AppBar/{index.f04f5e45.js → index.06858422.js} +8 -7
- package/components/CommonActions/components/ActionCancel/{index.453c2d24.js → index.d536ccfa.js} +2 -2
- package/components/CommonActions/components/ActionFormCancel/{index.c2a2fd55.js → index.a915b105.js} +19 -19
- package/components/CommonActions/components/ActionFormIntro/{index.25d33912.js → index.14e65d6c.js} +2 -2
- package/components/CommonActions/components/ActionIntro/{index.c653a266.js → index.aa1648eb.js} +2 -2
- package/components/CommonActions/components/Actions/{index.e376a68e.js → index.52125041.js} +17 -18
- package/components/DataGrid/{index.ffaf000e.js → index.9fb3e6a1.js} +40 -31
- package/components/DataGrid/types.d.ts +5 -1
- package/components/DraggableWindow/{index.b08af1dc.js → index.c702d3f2.js} +1 -1
- package/components/DynamicFilter/constants.d.ts +1 -0
- package/components/DynamicFilter/contexts/DynamicFilterContext/store.d.ts +6 -1
- package/components/DynamicFilter/{index.d7c03a61.js → index.d1a2e2d1.js} +54 -47
- package/components/DynamicFilter/tests/contants.d.ts +2 -3
- package/components/DynamicFilter/types.d.ts +4 -0
- package/components/GridLayout/GridLayout.d.ts +6 -0
- package/components/GridLayout/Responsive/index.0905a698.js +353 -0
- package/components/GridLayout/WidthProvider/index.9a26dfe4.js +65 -0
- package/components/GridLayout/calculateUtils.d.ts +42 -0
- package/components/GridLayout/index.d.ts +6 -0
- package/components/GridLayout/index.da6fd387.js +1410 -0
- package/components/GridLayout/subcomponents/GridItem/index.d.ts +26 -0
- package/components/GridLayout/subcomponents/GridItem/types.d.ts +78 -0
- package/components/GridLayout/subcomponents/Responsive/index.d.ts +3 -0
- package/components/GridLayout/subcomponents/Responsive/responsiveUtils.d.ts +64 -0
- package/components/GridLayout/subcomponents/Responsive/types.d.ts +69 -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.a019742c.js} +8 -7
- package/components/Icon/{index.9dae8337.js → index.9fcd1476.js} +1 -1
- package/components/LanguagePopover/{index.938c6675.js → index.98b63dcb.js} +8 -7
- package/components/LinearProgressIndeterminate/{index.d34d398f.js → index.60dabc06.js} +1 -1
- package/components/ModalDialog/{index.d9c5d400.js → index.d9937d46.js} +8 -56
- package/components/NavLink/{index.21c8fd90.js → index.a5dea6d3.js} +8 -7
- package/components/ObjectLogs/{index.a2709fc2.js → index.d9d20b9d.js} +27 -21
- package/components/ObjectLogs/types.d.ts +1 -0
- package/components/PaperForm/{index.5e1bc99f.js → index.ba38a0bd.js} +1 -1
- package/components/Period/{index.526791a3.js → index.7b94c418.js} +22 -23
- package/components/PropertyValue/constants.d.ts +3 -0
- package/components/PropertyValue/{index.8a1adf3e.js → index.45c73161.js} +17 -11
- package/components/PropertyValue/types.d.ts +2 -1
- package/components/Resizeable/{index.f6e48e56.js → index.9a9c79a4.js} +1 -1
- package/components/SideBar/{index.9e1a5b96.js → index.2f497e6c.js} +5 -5
- package/components/areas/components/AreasAdmin/classes/index.d.ts +1 -1
- package/components/areas/components/AreasAdmin/classes/types.d.ts +5 -0
- package/components/areas/components/AreasAdmin/{index.946eebb9.js → index.43ecd998.js} +167 -81
- 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 +3 -0
- package/components/areas/components/AreasViewer/{index.bf4191ea.js → index.14e62059.js} +326 -345
- 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.a87653a9.js +29 -0
- package/components/areas/contexts/AreasContext/helper.d.ts +8 -16
- package/components/areas/contexts/AreasContext/{index.f0397b7c.js → index.02c4e7be.js} +262 -336
- package/components/areas/contexts/AreasContext/types.d.ts +22 -20
- package/components/areas/contexts/{index.1809650a.js → index.1ff9b360.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.85e4b2e2.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.d1dcccf5.js} +12 -11
- package/components/areas/types.d.ts +29 -22
- package/components/formatters/BooleanFormatter/{index.431dc923.js → index.e8de8e4c.js} +1 -1
- package/components/formatters/{index.e1af75e6.js → index.67aeb049.js} +2 -2
- package/components/hook-form/RHFAutocomplete/{index.a063dc44.js → index.6aa51705.js} +25 -13
- package/components/hook-form/RHFAutocompleteAsync/{index.ddfd9cc9.js → index.1a3dfe5f.js} +1 -1
- package/components/hook-form/RHFCheckbox/{index.7e7f220b.js → index.a08a65b3.js} +1 -1
- package/components/hook-form/RHFDateTime/{index.d330709b.js → index.4d671108.js} +10 -9
- package/components/hook-form/RHFPeriod/{index.e2b1293b.js → index.39b4be49.js} +2 -2
- package/components/hook-form/RHFTextField/{index.e5336d09.js → index.9004e898.js} +5 -5
- package/components/hook-form/RHFUpload/{index.17e7f9eb.js → index.bed8573e.js} +9 -11
- package/components/index.d.ts +1 -0
- package/components/modal/{WindowBase.7acb9f1d.js → WindowBase.a0c0b322.js} +10 -9
- package/components/modal/{WindowConfirm.9b829837.js → WindowConfirm.6c063f2d.js} +19 -19
- 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.00efea85.js} +19 -17
- package/components/mui_extended/Accordion/constants.d.ts +1 -0
- package/components/mui_extended/Accordion/{index.3faafd8b.js → index.9877f7bf.js} +8 -9
- package/components/mui_extended/Accordion/types.d.ts +1 -0
- 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.12f1a3c3.js} +4 -1
- package/components/mui_extended/MenuActions/{index.ba1da3b3.js → index.43a2e1ae.js} +41 -13
- package/components/mui_extended/MenuActions/index.d.ts +3 -2
- package/components/mui_extended/MenuActions/types.d.ts +9 -0
- package/components/mui_extended/Pager/{index.67bda2c5.js → index.2f6d6d7d.js} +1 -1
- package/components/mui_extended/Tab/constant.d.ts +1 -0
- package/components/mui_extended/Tab/{index.9e2f6e34.js → index.7c82e43d.js} +5 -6
- package/components/mui_extended/Tab/types.d.ts +1 -0
- package/components/mui_extended/{index.73e536de.js → index.0e2ff642.js} +8 -7
- package/components/mui_extended/index.d.ts +1 -0
- package/contexts/ModalContext/{index.699f95fa.js → index.e9a7ba4a.js} +1 -1
- package/hooks/useModal/{index.7b7d26ba.js → index.8e85f7ae.js} +1 -1
- package/index.js +228 -214
- 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/test/getNameDataTestId.d.ts +1 -0
- package/utils/{index.008b4c2a.js → index.c43a95f4.js} +0 -15
- package/vendor.e353394b.js +124 -0
- package/components/DynamicFilter/tests/types.d.ts +0 -2
- package/components/DynamicFilter/tests/utils.d.ts +0 -2
- package/components/PropertyValue/tests/constants.d.ts +0 -1
- package/components/PropertyValue/tests/utils.d.ts +0 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/WindowPopUp/index.d.ts +0 -4
- package/components/areas/components/index.2bb534cb.js +0 -28
- package/components/modal/ModalDialog/types.d.ts +0 -7
- package/components/mui_extended/Accordion/tests/constants.d.ts +0 -1
- package/components/mui_extended/Accordion/tests/utils.d.ts +0 -2
- package/components/mui_extended/Tab/tests/constants.d.ts +0 -1
- package/components/mui_extended/Tab/tests/utils.d.ts +0 -2
- /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.14e62059.js";
|
|
9
|
+
import { u as useAreasAdminUtilityClasses } from "../../components/AreasAdmin/index.43ecd998.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.da6fd387.js";
|
|
14
|
+
import { a as addLayoutItemToBreakPointIfNoExists, b as addLayoutItemToBreakPoints, c as isEqualLayouts } from "../../../GridLayout/Responsive/index.0905a698.js";
|
|
13
15
|
import { jsx } from "react/jsx-runtime";
|
|
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,8 @@ const DEFAULT_WINDOW = {
|
|
|
33
34
|
const DEFAULT_AREA = {
|
|
34
35
|
status: "init",
|
|
35
36
|
zPopUpIndex: 0,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
windowsLayouts: [],
|
|
39
|
-
windowsPopUps: [],
|
|
40
|
-
hashWindowsPopups: {},
|
|
41
|
-
hashWindowsLayouts: {},
|
|
37
|
+
layouts: {},
|
|
38
|
+
layoutItemsIds: [],
|
|
42
39
|
currentLayoutId: "",
|
|
43
40
|
currentPopUpId: "",
|
|
44
41
|
breakpoints: BREAKPOINT_SIZES,
|
|
@@ -46,15 +43,14 @@ const DEFAULT_AREA = {
|
|
|
46
43
|
};
|
|
47
44
|
const addArea = (state) => {
|
|
48
45
|
const areaId = `area_${new Date().getTime()}_${(Math.random() * 1e3).toFixed(0)}`;
|
|
49
|
-
const labelNewArea = state.getLabel(getAreasDictionary(
|
|
46
|
+
const labelNewArea = state.getLabel(getAreasDictionary(DICCTIONARY.label_new_area));
|
|
50
47
|
let isFree;
|
|
51
48
|
let name = `${labelNewArea} 1`;
|
|
52
49
|
for (let indexNames = 1; indexNames <= state.areas.length + 1; indexNames++) {
|
|
53
50
|
name = `${labelNewArea} ${indexNames + state.areas.length}`;
|
|
54
51
|
isFree = true;
|
|
55
52
|
for (let index = 0; index < state.areas.length; index++) {
|
|
56
|
-
|
|
57
|
-
if (area.name === name) {
|
|
53
|
+
if (state.hashAreas[state.areas[index]].name === name) {
|
|
58
54
|
isFree = false;
|
|
59
55
|
break;
|
|
60
56
|
}
|
|
@@ -67,10 +63,9 @@ const addArea = (state) => {
|
|
|
67
63
|
id: areaId,
|
|
68
64
|
name,
|
|
69
65
|
loadWindows: false,
|
|
70
|
-
viewMode: state.ownerState.isMobile ? "single" : "multiple",
|
|
71
66
|
...DEFAULT_AREA
|
|
72
67
|
};
|
|
73
|
-
state.areas.push(
|
|
68
|
+
state.areas.push(areaId);
|
|
74
69
|
state.hashAreas[areaId] = newArea;
|
|
75
70
|
if (state.loadAreasFromNetwork) {
|
|
76
71
|
state.networkOperation({
|
|
@@ -100,23 +95,24 @@ const getParmsFromValue = (key, data) => {
|
|
|
100
95
|
}
|
|
101
96
|
return void 0;
|
|
102
97
|
};
|
|
103
|
-
function
|
|
104
|
-
const layoutsBreakPoints = state.
|
|
105
|
-
const beforeMaximizebreakpointsLayouts = state.beforeMaximizebreakpointsLayouts;
|
|
98
|
+
function setColapsedLayoutBreakPoints(state, layoutId, colapsed) {
|
|
99
|
+
const layoutsBreakPoints = state.layouts;
|
|
106
100
|
for (const key in layoutsBreakPoints) {
|
|
107
101
|
const layoutBreakpoint = layoutsBreakPoints[key];
|
|
108
|
-
layoutBreakpoint.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
102
|
+
const index = layoutBreakpoint.findIndex((lb) => lb.i === layoutId);
|
|
103
|
+
if (index > -1) {
|
|
104
|
+
if (key !== "xxs") {
|
|
105
|
+
layoutBreakpoint[index].colapsed = colapsed;
|
|
106
|
+
} else {
|
|
107
|
+
if (!layoutBreakpoint[index].freeMove) {
|
|
108
|
+
layoutBreakpoint[index].colapsed = colapsed;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
114
111
|
}
|
|
115
112
|
}
|
|
116
|
-
return layoutsBreakPoints;
|
|
117
113
|
}
|
|
118
114
|
function deleteLayoutFromBreakPoints(state, layoutId) {
|
|
119
|
-
const layoutsBreakPoints = state.
|
|
115
|
+
const layoutsBreakPoints = state.layouts;
|
|
120
116
|
for (const key in layoutsBreakPoints) {
|
|
121
117
|
const layoutBreakpoint = layoutsBreakPoints[key];
|
|
122
118
|
for (let index = 0; index < layoutBreakpoint.length; index++) {
|
|
@@ -128,61 +124,50 @@ function deleteLayoutFromBreakPoints(state, layoutId) {
|
|
|
128
124
|
}
|
|
129
125
|
}
|
|
130
126
|
}
|
|
131
|
-
function
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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;
|
|
127
|
+
function purgeToastsWindow(state, windowId) {
|
|
128
|
+
const toasties = state?.hashWindows[windowId]?.toasties;
|
|
129
|
+
if (toasties) {
|
|
130
|
+
for (let index = 0; index < toasties.length; index++) {
|
|
131
|
+
const toast = toasties[index];
|
|
132
|
+
if (toast.timer) {
|
|
133
|
+
clearInterval(toast.timer);
|
|
134
|
+
toast.timer = void 0;
|
|
168
135
|
}
|
|
169
136
|
}
|
|
170
137
|
}
|
|
171
|
-
|
|
138
|
+
}
|
|
139
|
+
function purgeToastsArea(state, areaId) {
|
|
140
|
+
const area = state.hashAreas[areaId];
|
|
141
|
+
for (let index = 0; index < area.layoutItemsIds.length; index++) {
|
|
142
|
+
purgeToastsWindow(state, area.layoutItemsIds[index]);
|
|
143
|
+
}
|
|
172
144
|
}
|
|
173
145
|
function getDataFromResponse(data, state, areaId) {
|
|
174
|
-
|
|
146
|
+
let newBreakPointsLayouts = getParmsFromValue(COOKIE_BREAKPOINT_LAYOUTS, data);
|
|
175
147
|
const windows = getParmsFromValue(COOKIE_WINDOWS, data);
|
|
176
|
-
const
|
|
177
|
-
const
|
|
148
|
+
const newWindowsLayoutsIds = [];
|
|
149
|
+
const newHashLayoutItems = [];
|
|
150
|
+
if (!newBreakPointsLayouts) {
|
|
151
|
+
newBreakPointsLayouts = {};
|
|
152
|
+
}
|
|
153
|
+
console.log(
|
|
154
|
+
"getDataFromResponse before start",
|
|
155
|
+
windows,
|
|
156
|
+
newBreakPointsLayouts,
|
|
157
|
+
BREAKPOINT_SIZES
|
|
158
|
+
);
|
|
159
|
+
for (const breakPoint in BREAKPOINT_SIZES) {
|
|
160
|
+
if (!newBreakPointsLayouts[breakPoint]) {
|
|
161
|
+
newBreakPointsLayouts[breakPoint] = [];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
178
164
|
if (windows) {
|
|
179
165
|
for (const key in windows) {
|
|
180
166
|
const element = windows[key];
|
|
181
|
-
if (element && element["
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
newHashWindowLayouts[key] = {
|
|
167
|
+
if (element && element["mfProps"] && element["emergeType"] === "layout" && element["winType"] === "microfrontend") {
|
|
168
|
+
newWindowsLayoutsIds.push(key);
|
|
169
|
+
const onClose = state.areaActions.closeLayout;
|
|
170
|
+
state.hashWindows[key] = {
|
|
186
171
|
...DEFAULT_WINDOW,
|
|
187
172
|
...element,
|
|
188
173
|
windowId: key,
|
|
@@ -194,14 +179,33 @@ function getDataFromResponse(data, state, areaId) {
|
|
|
194
179
|
}),
|
|
195
180
|
onClose: () => onClose(areaId, key)
|
|
196
181
|
};
|
|
197
|
-
|
|
182
|
+
newHashLayoutItems.push(key);
|
|
183
|
+
for (const breakPoint in BREAKPOINT_SIZES) {
|
|
184
|
+
addLayoutItemToBreakPointIfNoExists(
|
|
185
|
+
newBreakPointsLayouts,
|
|
186
|
+
breakPoint,
|
|
187
|
+
{ i: element.windowId, x: 0, y: 0, w: 5, h: 5 },
|
|
188
|
+
NORMALIZED_COLS,
|
|
189
|
+
[MARGIN_GRIDLAYOUT, MARGIN_GRIDLAYOUT],
|
|
190
|
+
[PADDING_GRIDLAYOUT, PADDING_GRIDLAYOUT],
|
|
191
|
+
ROW_HEIGTH_GRIDLAYOUT
|
|
192
|
+
);
|
|
193
|
+
}
|
|
198
194
|
}
|
|
199
195
|
}
|
|
196
|
+
for (const breakPoint in BREAKPOINT_SIZES) {
|
|
197
|
+
newBreakPointsLayouts[breakPoint] = newBreakPointsLayouts[breakPoint].filter((li) => {
|
|
198
|
+
return newWindowsLayoutsIds.indexOf(li.i) > -1;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
for (const breakPoint in BREAKPOINT_SIZES) {
|
|
203
|
+
newBreakPointsLayouts[breakPoint] = [];
|
|
204
|
+
}
|
|
200
205
|
}
|
|
201
206
|
return {
|
|
202
207
|
newBreakPointsLayouts,
|
|
203
|
-
|
|
204
|
-
newHashWindowLayouts
|
|
208
|
+
newHashLayoutItems
|
|
205
209
|
};
|
|
206
210
|
}
|
|
207
211
|
function getCookiesContainer(data, containerId) {
|
|
@@ -222,12 +226,14 @@ const verifyRemoveToasty = (state, toastyId, forceRemove) => {
|
|
|
222
226
|
const tfy = state.hashToasties[toastyId];
|
|
223
227
|
if (tfy) {
|
|
224
228
|
tfy.percentExecuted = (1 - (tfy.timeStart + tfy.timeoutMs - new Date().getTime()) / tfy.timeoutMs) * 100;
|
|
225
|
-
console.log("verifyRemoveToasty", tfy.percentExecuted);
|
|
226
229
|
if (tfy.percentExecuted >= 100 || forceRemove) {
|
|
227
230
|
const tosties = state.toasties;
|
|
228
231
|
for (let i = 0; i < tosties.length; i++) {
|
|
229
232
|
const findToasty = tosties[i];
|
|
230
233
|
if (findToasty.id === toastyId) {
|
|
234
|
+
if (findToasty.timer) {
|
|
235
|
+
clearInterval(findToasty.timer);
|
|
236
|
+
}
|
|
231
237
|
state.toasties.splice(i, 1);
|
|
232
238
|
delete state.hashToasties[toastyId];
|
|
233
239
|
return;
|
|
@@ -278,11 +284,10 @@ const createAreasStore = (initProps) => {
|
|
|
278
284
|
const newArea = {
|
|
279
285
|
...DEFAULT_AREA,
|
|
280
286
|
...response.data[i],
|
|
281
|
-
loadWindows: true
|
|
282
|
-
viewMode: otherState.ownerState.isMobile ? "single" : "multiple"
|
|
287
|
+
loadWindows: true
|
|
283
288
|
};
|
|
284
|
-
otherState.areas.push(newArea);
|
|
285
289
|
otherState.hashAreas[newArea.id] = newArea;
|
|
290
|
+
otherState.areas.push(newArea.id);
|
|
286
291
|
}
|
|
287
292
|
} else {
|
|
288
293
|
addArea(otherState);
|
|
@@ -294,21 +299,21 @@ const createAreasStore = (initProps) => {
|
|
|
294
299
|
updateOwnerStateClasses(state2);
|
|
295
300
|
});
|
|
296
301
|
if (get().areas.length > 0) {
|
|
297
|
-
get().areasActions.selectArea(get().areas[0]
|
|
302
|
+
get().areasActions.selectArea(get().areas[0]);
|
|
298
303
|
}
|
|
299
304
|
});
|
|
300
305
|
});
|
|
301
306
|
}
|
|
302
307
|
}
|
|
303
308
|
},
|
|
304
|
-
editArea: (
|
|
309
|
+
editArea: (areaId, newName) => {
|
|
305
310
|
set((state) => {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
state.
|
|
311
|
+
if (state.hashAreas[areaId]) {
|
|
312
|
+
purgeToastsArea(state, areaId);
|
|
313
|
+
state.hashAreas[areaId].name = newName;
|
|
309
314
|
state.networkOperation({
|
|
310
315
|
method: "PATCH",
|
|
311
|
-
endPoint: `areas/${
|
|
316
|
+
endPoint: `areas/${areaId}`,
|
|
312
317
|
data: { name: newName },
|
|
313
318
|
toastSuccess: false,
|
|
314
319
|
toastError: false
|
|
@@ -327,7 +332,7 @@ const createAreasStore = (initProps) => {
|
|
|
327
332
|
deleteArea: (areaId) => {
|
|
328
333
|
let selectNewAreaId = "";
|
|
329
334
|
set((state) => {
|
|
330
|
-
const removeIndex = state.areas.
|
|
335
|
+
const removeIndex = state.areas.indexOf(areaId);
|
|
331
336
|
if (removeIndex > -1) {
|
|
332
337
|
for (const key in state.hashWindows) {
|
|
333
338
|
if (state.hashWindows[key].areaId === areaId) {
|
|
@@ -339,7 +344,7 @@ const createAreasStore = (initProps) => {
|
|
|
339
344
|
}
|
|
340
345
|
if (state.currentAreaId === areaId) {
|
|
341
346
|
if (state.areas.length > 0) {
|
|
342
|
-
selectNewAreaId = state.areas[0]
|
|
347
|
+
selectNewAreaId = state.areas[0];
|
|
343
348
|
} else {
|
|
344
349
|
state.currentAreaId = "";
|
|
345
350
|
}
|
|
@@ -376,9 +381,8 @@ const createAreasStore = (initProps) => {
|
|
|
376
381
|
});
|
|
377
382
|
}
|
|
378
383
|
}
|
|
379
|
-
if (get().hashAreas[areaId].
|
|
380
|
-
|
|
381
|
-
}
|
|
384
|
+
if (get().hashAreas[areaId].maximizedId !== void 0)
|
|
385
|
+
;
|
|
382
386
|
},
|
|
383
387
|
setHandlerGetLabel: (newHandler) => {
|
|
384
388
|
set((state) => {
|
|
@@ -395,14 +399,8 @@ const createAreasStore = (initProps) => {
|
|
|
395
399
|
areaActions: {
|
|
396
400
|
addWindow: (newWindowProps) => {
|
|
397
401
|
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(
|
|
402
|
+
if (newWindowProps.emergeType === "layout" || newWindowProps.emergeType === "popup") {
|
|
403
|
+
get().areaActions.addLayout(
|
|
406
404
|
get().currentAreaId,
|
|
407
405
|
windowId,
|
|
408
406
|
newWindowProps
|
|
@@ -415,71 +413,99 @@ const createAreasStore = (initProps) => {
|
|
|
415
413
|
);
|
|
416
414
|
}
|
|
417
415
|
},
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
416
|
+
addLayout: (areaId, windowId, newWindowProps) => {
|
|
417
|
+
let previousId = windowId;
|
|
418
|
+
const freeMove = newWindowProps.emergeType === "popup" ? true : false;
|
|
419
|
+
const newLayoutItem = {
|
|
420
|
+
...newWindowProps.layoutProps,
|
|
421
|
+
i: windowId,
|
|
422
|
+
isDraggable: true,
|
|
423
|
+
isResizable: true,
|
|
424
|
+
freeMove
|
|
425
|
+
};
|
|
425
426
|
set((state) => {
|
|
426
427
|
const area = state.hashAreas[areaId];
|
|
427
428
|
if (!area) {
|
|
428
429
|
return;
|
|
429
430
|
}
|
|
430
|
-
|
|
431
|
-
(
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
431
|
+
if (newWindowProps.replaceMeId) {
|
|
432
|
+
for (let index = 0; index < area.layoutItemsIds.length; index++) {
|
|
433
|
+
const key = area.layoutItemsIds[index];
|
|
434
|
+
const WindoPopUp = state.hashWindows[key];
|
|
435
|
+
if (WindoPopUp.replaceMeId === newWindowProps.replaceMeId) {
|
|
436
|
+
previousId = key;
|
|
437
|
+
WindoPopUp.dynamicMFStore.getState().actions.changeData(newWindowProps.dynamicParams);
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (previousId === windowId) {
|
|
443
|
+
const dynamicMFStore = createDynamicMFStore({
|
|
444
|
+
dynamicMFParameters: newWindowProps.dynamicParams,
|
|
445
|
+
windowId
|
|
446
|
+
});
|
|
447
|
+
state.hashWindows[windowId] = {
|
|
448
|
+
...newWindowProps,
|
|
449
|
+
areaId,
|
|
450
|
+
windowId,
|
|
451
|
+
onClose: (removeLayoutId) => {
|
|
452
|
+
get().areaActions.closeLayout(areaId, removeLayoutId);
|
|
453
|
+
},
|
|
454
|
+
...DEFAULT_WINDOW,
|
|
455
|
+
dynamicMFStore
|
|
456
|
+
};
|
|
457
|
+
area.layoutItemsIds.push(windowId);
|
|
458
|
+
if (newWindowProps.emergeType === "layout") {
|
|
459
|
+
area.currentLayoutId = windowId;
|
|
460
|
+
if (area.maximizedId) {
|
|
461
|
+
area.maximizedId = windowId;
|
|
462
|
+
}
|
|
463
|
+
} else {
|
|
464
|
+
area.currentPopUpId = windowId;
|
|
465
|
+
}
|
|
466
|
+
area.layouts = addLayoutItemToBreakPoints(
|
|
467
|
+
area.layouts,
|
|
468
|
+
newLayoutItem,
|
|
469
|
+
NORMALIZED_COLS,
|
|
470
|
+
[MARGIN_GRIDLAYOUT, MARGIN_GRIDLAYOUT],
|
|
471
|
+
[PADDING_GRIDLAYOUT, PADDING_GRIDLAYOUT],
|
|
472
|
+
ROW_HEIGTH_GRIDLAYOUT,
|
|
473
|
+
area.containerHeight,
|
|
474
|
+
area.currentBreakpoint
|
|
475
|
+
);
|
|
476
|
+
if (area.currentBreakpoint === "xxs") {
|
|
477
|
+
area.maximizedId = windowId;
|
|
478
|
+
}
|
|
435
479
|
}
|
|
436
|
-
deleteLayoutFromBreakPoints(area, removeLayoutId);
|
|
437
|
-
delete state.hashWindows[removeLayoutId];
|
|
438
|
-
delete area.hashWindowsLayouts[removeLayoutId];
|
|
439
480
|
});
|
|
440
481
|
get().areaActions.saveLayouts(areaId);
|
|
441
|
-
|
|
442
|
-
get().areaActions.maximizeLayout(areaId);
|
|
443
|
-
}
|
|
482
|
+
get().areaActions.bouncedSaveBreakpointsLayouts(areaId);
|
|
444
483
|
},
|
|
445
|
-
|
|
446
|
-
const newLayout = {
|
|
447
|
-
...newWindow.layoutProps,
|
|
448
|
-
i: windowId,
|
|
449
|
-
isDraggable: true,
|
|
450
|
-
isResizable: true,
|
|
451
|
-
winType: newWindow.winType
|
|
452
|
-
};
|
|
484
|
+
closeLayout: (areaId, removeLayoutId) => {
|
|
453
485
|
set((state) => {
|
|
454
486
|
const area = state.hashAreas[areaId];
|
|
455
487
|
if (!area) {
|
|
456
488
|
return;
|
|
457
489
|
}
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
area
|
|
463
|
-
|
|
464
|
-
|
|
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);
|
|
490
|
+
const removeIndex = area.layoutItemsIds.indexOf(removeLayoutId);
|
|
491
|
+
if (removeIndex > -1) {
|
|
492
|
+
area.layoutItemsIds.splice(removeIndex, 1);
|
|
493
|
+
}
|
|
494
|
+
deleteLayoutFromBreakPoints(area, removeLayoutId);
|
|
495
|
+
purgeToastsWindow(state, removeLayoutId);
|
|
496
|
+
delete state.hashWindows[removeLayoutId];
|
|
476
497
|
});
|
|
477
|
-
get().areaActions.selectWindowLayout(areaId, windowId);
|
|
478
|
-
if (get().hashAreas[areaId].viewMode === "single" || newWindow?.openType === "maximized") {
|
|
479
|
-
get().areaActions.maximizeLayout(areaId, windowId);
|
|
480
|
-
}
|
|
481
498
|
get().areaActions.saveLayouts(areaId);
|
|
482
|
-
get().
|
|
499
|
+
if (get().hashAreas[areaId].maximizedId === removeLayoutId) {
|
|
500
|
+
get().areaActions.maximizeLayout(areaId);
|
|
501
|
+
}
|
|
502
|
+
for (let index = 0; index < get().hashAreas[areaId].layoutItemsIds.length; index++) {
|
|
503
|
+
const layoutItemId = get().hashAreas[areaId].layoutItemsIds[index];
|
|
504
|
+
const layoutItem = get().hashWindows[layoutItemId];
|
|
505
|
+
if (layoutItem.parentLayoutId === removeLayoutId) {
|
|
506
|
+
get().areaActions.closeLayout(areaId, layoutItem.windowId);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
483
509
|
},
|
|
484
510
|
saveLayouts: (areaId) => {
|
|
485
511
|
let nrKeys = 0;
|
|
@@ -488,16 +514,16 @@ const createAreasStore = (initProps) => {
|
|
|
488
514
|
return;
|
|
489
515
|
}
|
|
490
516
|
const saveObjetc = {};
|
|
491
|
-
for (
|
|
492
|
-
const
|
|
493
|
-
if (
|
|
517
|
+
for (let index = 0; index < area.layoutItemsIds.length; index++) {
|
|
518
|
+
const key = area.layoutItemsIds[index];
|
|
519
|
+
if (get().hashWindows[key] && get().hashWindows[key].winType === "microfrontend") {
|
|
520
|
+
const element = get().hashWindows[key];
|
|
494
521
|
const hasPropsToSave = {
|
|
495
522
|
winType: true,
|
|
496
523
|
emergeType: true,
|
|
497
524
|
title: true,
|
|
498
525
|
url_icon: true,
|
|
499
526
|
windowOptions: true,
|
|
500
|
-
layoutProps: true,
|
|
501
527
|
moduleId: true,
|
|
502
528
|
windowId: true,
|
|
503
529
|
mfProps: true
|
|
@@ -538,6 +564,7 @@ const createAreasStore = (initProps) => {
|
|
|
538
564
|
if (removeIndex > -1) {
|
|
539
565
|
state.windowsModals.splice(removeIndex, 1);
|
|
540
566
|
}
|
|
567
|
+
purgeToastsWindow(state, removeModalId);
|
|
541
568
|
delete state.hashWindows[removeModalId];
|
|
542
569
|
delete state.hashWindowsModals[removeModalId];
|
|
543
570
|
});
|
|
@@ -560,93 +587,10 @@ const createAreasStore = (initProps) => {
|
|
|
560
587
|
state.hashWindows[windowId] = state.hashWindowsModals[windowId];
|
|
561
588
|
});
|
|
562
589
|
},
|
|
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
590
|
bouncedSaveBreakpointsLayouts: debounce(
|
|
647
591
|
(areaId) => {
|
|
648
592
|
const purgedLayouts = {
|
|
649
|
-
...get().hashAreas[areaId].
|
|
593
|
+
...get().hashAreas[areaId].layouts
|
|
650
594
|
};
|
|
651
595
|
const finalLayouts = {};
|
|
652
596
|
for (const key in purgedLayouts) {
|
|
@@ -655,7 +599,7 @@ const createAreasStore = (initProps) => {
|
|
|
655
599
|
if (l.i === "none") {
|
|
656
600
|
return false;
|
|
657
601
|
}
|
|
658
|
-
if (get().hashAreas[areaId].
|
|
602
|
+
if (get().hashAreas[areaId].layoutItemsIds.indexOf(l.i) > -1) {
|
|
659
603
|
return true;
|
|
660
604
|
}
|
|
661
605
|
return false;
|
|
@@ -676,101 +620,100 @@ const createAreasStore = (initProps) => {
|
|
|
676
620
|
});
|
|
677
621
|
}
|
|
678
622
|
},
|
|
679
|
-
DEBOUCED_SAVE_TIME
|
|
623
|
+
DEBOUCED_SAVE_TIME,
|
|
624
|
+
{
|
|
625
|
+
leading: true,
|
|
626
|
+
trailing: true
|
|
627
|
+
}
|
|
680
628
|
),
|
|
681
|
-
onBreakpointsLayoutsChange: (areaId,
|
|
629
|
+
onBreakpointsLayoutsChange: (areaId, _currentLayout, newAllLayouts) => {
|
|
630
|
+
if (!isEqualLayouts(get().hashAreas[areaId].layouts, newAllLayouts)) {
|
|
631
|
+
set((state) => {
|
|
632
|
+
state.hashAreas[areaId].layouts = cloneDeep(newAllLayouts);
|
|
633
|
+
});
|
|
634
|
+
if (!get().hashAreas[areaId].maximizedId) {
|
|
635
|
+
get().areaActions.bouncedSaveBreakpointsLayouts(areaId);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
onContainerChange: (areaId, e) => {
|
|
682
640
|
set((state) => {
|
|
683
|
-
state.hashAreas[areaId].
|
|
641
|
+
state.hashAreas[areaId].containerHeight = e.containerHeight;
|
|
642
|
+
state.hashAreas[areaId].currentBreakpoint = e.breakpoint;
|
|
684
643
|
});
|
|
685
|
-
if (!get().hashAreas[areaId].singleId) {
|
|
686
|
-
get().areaActions.bouncedSaveBreakpointsLayouts(areaId);
|
|
687
|
-
}
|
|
688
644
|
},
|
|
689
|
-
|
|
645
|
+
selectLayout: (areaId, layoutId) => {
|
|
690
646
|
set((state) => {
|
|
691
647
|
const area = state.hashAreas[areaId];
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
648
|
+
if (state.hashWindows[layoutId].emergeType === "layout") {
|
|
649
|
+
area.currentLayoutId = layoutId;
|
|
650
|
+
state.currentModuleId = state.hashWindows[layoutId].moduleId;
|
|
651
|
+
if (area.currentPopUpId !== "" && state.hashWindows[area.currentPopUpId]) {
|
|
652
|
+
if (state.hashWindows[area.currentPopUpId].parentLayoutId !== layoutId) {
|
|
653
|
+
area.currentPopUpId = "";
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
} else {
|
|
657
|
+
state.hashAreas[areaId].currentPopUpId = layoutId;
|
|
658
|
+
const parentLayoutId = state.hashWindows[layoutId]?.parentLayoutId;
|
|
659
|
+
if (parentLayoutId && state.hashWindows[parentLayoutId]) {
|
|
660
|
+
area.currentLayoutId = parentLayoutId;
|
|
661
|
+
state.currentModuleId = state.hashWindows[parentLayoutId].moduleId;
|
|
662
|
+
} else {
|
|
663
|
+
area.currentLayoutId = "";
|
|
664
|
+
state.currentModuleId = "";
|
|
698
665
|
}
|
|
699
666
|
}
|
|
700
667
|
});
|
|
701
668
|
},
|
|
702
|
-
|
|
703
|
-
let finalLayoutId = layoutId;
|
|
669
|
+
unColapseLayoutItem: (areaId, layoutId) => {
|
|
704
670
|
set((state) => {
|
|
705
|
-
|
|
706
|
-
if (!area)
|
|
707
|
-
return;
|
|
708
|
-
if (area.viewMode === "multiple") {
|
|
709
|
-
area.beforeMaximizebreakpointsLayouts = cloneDeep(
|
|
710
|
-
area.breakPointsLayouts
|
|
711
|
-
);
|
|
712
|
-
}
|
|
713
|
-
if (!finalLayoutId) {
|
|
714
|
-
if (area.windowsLayouts.length > 0) {
|
|
715
|
-
finalLayoutId = area.windowsLayouts[0].i;
|
|
716
|
-
}
|
|
717
|
-
}
|
|
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);
|
|
671
|
+
setColapsedLayoutBreakPoints(state.hashAreas[areaId], layoutId, false);
|
|
728
672
|
});
|
|
729
|
-
|
|
730
|
-
|
|
673
|
+
},
|
|
674
|
+
colapseLayoutItem: (areaId, layoutId) => {
|
|
675
|
+
if (!get().hashAreas[areaId].maximizedId && get().hashWindows[layoutId]) {
|
|
676
|
+
set((state) => {
|
|
677
|
+
setColapsedLayoutBreakPoints(
|
|
678
|
+
state.hashAreas[areaId],
|
|
679
|
+
layoutId,
|
|
680
|
+
true
|
|
681
|
+
);
|
|
682
|
+
});
|
|
731
683
|
}
|
|
732
684
|
},
|
|
733
|
-
|
|
685
|
+
maximizeLayout: (areaId, layoutId) => {
|
|
734
686
|
set((state) => {
|
|
735
687
|
const area = state.hashAreas[areaId];
|
|
736
688
|
if (!area)
|
|
737
689
|
return;
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
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
|
-
}
|
|
690
|
+
area.maximizedId = layoutId;
|
|
691
|
+
const index = area.layouts["xxs"]?.findIndex(
|
|
692
|
+
(li) => li.i === area.maximizedId
|
|
693
|
+
);
|
|
694
|
+
if (index !== void 0 && index > -1 && layoutId && state.hashWindows[layoutId].emergeType === "popup") {
|
|
695
|
+
area.layouts["xxs"][index].visible = true;
|
|
696
|
+
area.layouts["xxs"][index].colapsed = false;
|
|
762
697
|
}
|
|
763
698
|
});
|
|
699
|
+
if (layoutId) {
|
|
700
|
+
get().areaActions.selectLayout(areaId, layoutId);
|
|
701
|
+
}
|
|
764
702
|
},
|
|
765
703
|
normalizeLayouts: (areaId) => {
|
|
766
704
|
set((state) => {
|
|
767
|
-
|
|
705
|
+
const area = state.hashAreas[areaId];
|
|
706
|
+
if (!area)
|
|
768
707
|
return;
|
|
769
|
-
if (
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
708
|
+
if (area.maximizedId) {
|
|
709
|
+
const index = area.layouts["xxs"]?.findIndex(
|
|
710
|
+
(li) => li.i === area.maximizedId
|
|
711
|
+
);
|
|
712
|
+
if (index !== void 0 && index > -1 && state.hashWindows[area.maximizedId].emergeType === "popup") {
|
|
713
|
+
area.layouts["xxs"][index].visible = false;
|
|
714
|
+
}
|
|
773
715
|
}
|
|
716
|
+
area.maximizedId = void 0;
|
|
774
717
|
});
|
|
775
718
|
},
|
|
776
719
|
loadWindowsFromApi: (areaId) => {
|
|
@@ -803,29 +746,11 @@ const createAreasStore = (initProps) => {
|
|
|
803
746
|
}
|
|
804
747
|
set((state) => {
|
|
805
748
|
const area3 = state.hashAreas[areaId];
|
|
806
|
-
const {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
newHashWindowLayouts
|
|
810
|
-
} = getDataFromResponse(response.data, state, areaId);
|
|
811
|
-
area3.breakPointsLayouts = newBreakPointsLayouts;
|
|
812
|
-
if (area.viewMode === "single") {
|
|
813
|
-
area3.beforeMaximizebreakpointsLayouts = newBreakPointsLayouts;
|
|
814
|
-
}
|
|
815
|
-
area3.windowsLayouts = newWindowsLayouts;
|
|
816
|
-
area3.hashWindowsLayouts = newHashWindowLayouts;
|
|
749
|
+
const { newBreakPointsLayouts, newHashLayoutItems } = getDataFromResponse(response.data, state, areaId);
|
|
750
|
+
area3.layouts = newBreakPointsLayouts;
|
|
751
|
+
area3.layoutItemsIds = newHashLayoutItems;
|
|
817
752
|
area3.status = "loaded";
|
|
818
753
|
});
|
|
819
|
-
if (get().hashAreas[areaId].windowsLayouts.length > 0) {
|
|
820
|
-
get().areaActions.selectWindowLayout(
|
|
821
|
-
areaId,
|
|
822
|
-
get().hashAreas[areaId].windowsLayouts[0].i
|
|
823
|
-
);
|
|
824
|
-
}
|
|
825
|
-
console.log("loadWindowsFromApi", area2.viewMode);
|
|
826
|
-
if (area2.viewMode === "single") {
|
|
827
|
-
get().areaActions.maximizeLayout(area2.id);
|
|
828
|
-
}
|
|
829
754
|
}).catch((_response) => {
|
|
830
755
|
set((state) => {
|
|
831
756
|
state.hashAreas[areaId].status = "loaded";
|
|
@@ -998,6 +923,7 @@ const createAreasStore = (initProps) => {
|
|
|
998
923
|
hw2.timeStart = new Date().getTime();
|
|
999
924
|
hw2.percentExecuted = 0;
|
|
1000
925
|
hw2.timer = setInterval(() => {
|
|
926
|
+
console.log("toast timer edit tick");
|
|
1001
927
|
set((state3) => {
|
|
1002
928
|
verifyRemoveToasty(
|
|
1003
929
|
state3.hashWindows[windowId],
|
|
@@ -1021,6 +947,7 @@ const createAreasStore = (initProps) => {
|
|
|
1021
947
|
timeStart: new Date().getTime(),
|
|
1022
948
|
percentExecuted: 0,
|
|
1023
949
|
timer: setInterval(() => {
|
|
950
|
+
console.log("toast timer new tick");
|
|
1024
951
|
set((stateRemoveToasty) => {
|
|
1025
952
|
verifyRemoveToasty(
|
|
1026
953
|
stateRemoveToasty.hashWindows[windowId],
|
|
@@ -1112,9 +1039,9 @@ function AreasProvider(props) {
|
|
|
1112
1039
|
setExternalState
|
|
1113
1040
|
} = useStore(areasStoreRef.current, (state) => state.areasActions, shallow);
|
|
1114
1041
|
const addWindow = useCallback((newWindow) => {
|
|
1115
|
-
const
|
|
1042
|
+
const currentAreaId = areasStoreRef.current?.getState().currentAreaId;
|
|
1116
1043
|
const areas = areasStoreRef.current?.getState().areas;
|
|
1117
|
-
if (
|
|
1044
|
+
if (currentAreaId && areas) {
|
|
1118
1045
|
areasStoreRef.current?.getState().areaActions.addWindow(newWindow);
|
|
1119
1046
|
}
|
|
1120
1047
|
}, []);
|
|
@@ -1158,9 +1085,8 @@ function AreasProvider(props) {
|
|
|
1158
1085
|
}
|
|
1159
1086
|
export {
|
|
1160
1087
|
AreasContext as A,
|
|
1161
|
-
CONTAINER_PADDING_GRIDLAYOUT as C,
|
|
1162
1088
|
MARGIN_GRIDLAYOUT as M,
|
|
1089
|
+
PADDING_GRIDLAYOUT as P,
|
|
1163
1090
|
ROW_HEIGTH_GRIDLAYOUT as R,
|
|
1164
|
-
THROTTLE_RESIZE_TIME as T,
|
|
1165
1091
|
AreasProvider as a
|
|
1166
1092
|
};
|