@m4l/components 0.1.64 → 0.1.66
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 +8 -0
- package/components/CommonActions/components/ActionCancel/{index.2eb2c1e1.js → index.4d0333c0.js} +1 -1
- package/components/CommonActions/components/ActionFormCancel/{index.2864d574.js → index.298e0109.js} +11 -18
- package/components/CommonActions/components/ActionFormIntro/{index.e7f83ddd.js → index.b45922ff.js} +1 -1
- package/components/CommonActions/components/ActionIntro/{index.0d138cb3.js → index.138101aa.js} +2 -2
- package/components/CommonActions/components/Actions/{index.433cd345.js → index.77574633.js} +11 -18
- package/components/DataGrid/{index.42521a55.js → index.ef23d0a9.js} +28 -35
- package/components/DynamicFilter/{index.442bda79.js → index.04ed3d58.js} +34 -46
- package/components/DynamicFilter/index.d.ts +1 -1
- package/components/HelperText/{index.3c07ca2a.js → index.c35dcb93.js} +10 -10
- package/components/Icon/{index.0f9b360e.js → index.fbeeacc8.js} +2 -2
- package/components/Icon/tests/utils.d.ts +1 -1
- package/components/Image/{index.1a9c0327.js → index.77396f79.js} +1 -1
- package/components/LanguagePopover/{index.68de7176.js → index.c0fc94c7.js} +11 -11
- package/components/ModalDialog/{index.3efe049b.js → index.e600b43a.js} +5 -5
- package/components/NavLink/{index.ae9f1cc9.js → index.3f4e2417.js} +11 -11
- package/components/NoItemSelected/{index.7cfd7613.js → index.609c3c20.js} +1 -1
- package/components/ObjectLogs/{index.b50726fb.js → index.7f93ba51.js} +14 -21
- package/components/PaperForm/{index.44bf4469.js → index.fb4fa784.js} +1 -1
- package/components/Period/{index.99feb99e.js → index.0c5bf66f.js} +12 -19
- package/components/Resizeable/{index.b5d42efb.js → index.4545dd6a.js} +3 -3
- package/components/SideBar/{index.011880b6.js → index.7d970041.js} +7 -7
- package/components/areas/components/AreasAdmin/classes/index.d.ts +5 -0
- package/components/areas/components/AreasAdmin/classes/types.d.ts +11 -0
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/types.d.ts +1 -1
- package/components/areas/components/AreasViewer/classes/index.d.ts +5 -0
- package/components/areas/components/AreasViewer/classes/types.d.ts +19 -0
- package/components/areas/components/AreasViewer/index.d.ts +7 -0
- package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/contexts}/AreaContext/helper.d.ts +2 -2
- package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/contexts}/AreaContext/index.d.ts +3 -3
- package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/store.d.ts +11 -0
- package/components/areas/{contexts/AreaContext/store.d.ts → components/AreasViewer/subcomponents/Area/contexts/AreaContext/types.d.ts} +29 -16
- package/components/areas/components/AreasViewer/subcomponents/Area/index.d.ts +12 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/GridLayout/index.d.ts +5 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/PanelWindows/index.d.ts +6 -0
- package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/store.d.ts +8 -3
- package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/types.d.ts +1 -1
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/index.d.ts +1 -1
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/index.d.ts +1 -1
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/Component/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/helper.d.ts +3 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/subcomponents/MainActions/index.d.ts +1 -0
- package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types.d.ts +8 -0
- package/components/areas/components/{WindowModal → AreasViewer/subcomponents/Area/subcomponents/WindowModal}/index.d.ts +1 -1
- package/components/areas/components/{WindowPopUp → AreasViewer/subcomponents/Area/subcomponents/WindowPopUp}/index.d.ts +1 -1
- package/components/areas/components/{Area → AreasViewer/subcomponents/Area}/types.d.ts +6 -11
- package/components/areas/components/index.d.ts +3 -4
- package/components/areas/constants.d.ts +3 -0
- package/components/areas/contexts/AreasContext/index.d.ts +10 -4
- package/components/areas/contexts/AreasContext/store.d.ts +8 -29
- package/components/areas/contexts/AreasContext/types.d.ts +119 -0
- package/components/areas/contexts/WindowToolsMFContext/types.d.ts +3 -2
- package/components/areas/dictionary.d.ts +9 -14
- package/components/areas/hooks/useArea/index.d.ts +1 -1
- package/components/areas/hooks/useAreas/index.d.ts +1 -1
- package/components/areas/hooks/useWindow/index.d.ts +1 -1
- package/components/areas/icons.d.ts +8 -0
- package/components/areas/index.d.ts +1 -0
- package/components/areas/index.d7519516.js +2416 -0
- package/components/formatters/BooleanFormatter/{index.cd00c8e1.js → index.0edacc9b.js} +1 -1
- package/components/formatters/{index.deae4701.js → index.879170b2.js} +2 -2
- package/components/hook-form/RHFAutocomplete/{index.083e23c1.js → index.5f27e28c.js} +13 -12
- package/components/hook-form/RHFAutocomplete/test/constants.d.ts +1 -0
- package/components/hook-form/RHFAutocomplete/test/utils.d.ts +1 -1
- package/components/hook-form/RHFAutocompleteAsync/{index.ba751be9.js → index.35e17cd6.js} +2 -2
- package/components/hook-form/RHFCheckbox/{index.c19393b1.js → index.4f134f09.js} +3 -3
- package/components/hook-form/RHFPeriod/{index.c0a80aeb.js → index.dcaa0c87.js} +2 -2
- package/components/hook-form/RHFTextField/{index.97485ff2.js → index.fc90a570.js} +13 -13
- package/components/hook-form/RHFUpload/{index.798eb11d.js → index.654ad316.js} +1 -1
- package/components/index.d.ts +1 -3
- package/components/modal/{WindowBase.59f50553.js → WindowBase.230a498f.js} +3 -3
- package/components/modal/{WindowConfirm.c1339cf8.js → WindowConfirm.575b4d41.js} +14 -21
- package/components/modal/index.237881ea.js +23 -0
- package/components/mui_extended/Accordion/{index.b7487e37.js → index.0b15f939.js} +2 -2
- package/components/mui_extended/Button/{index.d9e0ae2e.js → index.b7b70e5f.js} +3 -3
- package/components/mui_extended/IconButton/{index.be9c2ce5.js → index.a5072cd3.js} +15 -11
- package/components/mui_extended/IconButton/types.d.ts +1 -1
- package/components/mui_extended/MenuActions/icons.d.ts +3 -0
- package/components/mui_extended/MenuActions/{index.ec654122.js → index.3a275abb.js} +21 -20
- package/components/mui_extended/MenuActions/types.d.ts +5 -6
- package/components/mui_extended/Pager/{index.9e123670.js → index.5a69ab10.js} +5 -5
- package/components/mui_extended/Popover/{index.260aae81.js → index.e271e4f0.js} +1 -0
- package/components/mui_extended/Typography/{index.41b60a6b.js → index.eab3d85c.js} +1 -1
- package/components/mui_extended/index.35f74599.js +19 -0
- package/contexts/ModalContext/{index.ae8041f3.js → index.de0a3457.js} +1 -1
- package/hooks/useModal/{index.5c159ed2.js → index.e103db09.js} +1 -1
- package/index.js +118 -132
- package/package.json +2 -3
- package/{react-draggable.1aa81436.js → react-draggable.4d08d714.js} +1 -1
- package/{react-resizable.e86cb01e.js → react-resizable.23b980cb.js} +5 -4
- package/utils/{index.e199226a.js → index.c2e62d8f.js} +32 -32
- package/{vendor.a15d263e.js → vendor.be57c149.js} +43 -52
- package/components/areas/components/Area/index.d.ts +0 -5
- package/components/areas/components/AreasAdmin/index.51e28f63.js +0 -120
- package/components/areas/components/AreasContainer/index.1e5e6e91.js +0 -37
- package/components/areas/components/AreasContainer/index.d.ts +0 -1
- package/components/areas/components/GridLayout/index.5bf8d5e4.js +0 -103
- package/components/areas/components/GridLayout/index.d.ts +0 -1
- package/components/areas/components/Window/icons.d.ts +0 -3
- package/components/areas/components/Window/index.416a874f.js +0 -855
- package/components/areas/components/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types.d.ts +0 -8
- package/components/areas/components/WindowPopUp/index.f053fca7.js +0 -118
- package/components/areas/components/WindowsPanel/index.d.ts +0 -1
- package/components/areas/components/index.eace295a.js +0 -77
- package/components/areas/contexts/AreaContext/index.7890e58d.js +0 -509
- package/components/areas/contexts/AreaContext/types.d.ts +0 -20
- package/components/areas/contexts/AreasContext/index.0792a8d1.js +0 -197
- package/components/areas/contexts/DynamicMFParmsContext/index.c19cb8cc.js +0 -43
- package/components/areas/contexts/index.2a915acf.js +0 -198
- package/components/areas/hooks/index.f4d78492.js +0 -27
- package/components/areas/hooks/useArea/index.d6263051.js +0 -20
- package/components/areas/hooks/useDynamicMFParameters/index.041a666b.js +0 -14
- package/components/areas/index.8fca0f8f.js +0 -20
- package/components/modal/index.7a84f64d.js +0 -30
- package/components/mui_extended/index.459cbd6c.js +0 -19
- /package/components/areas/components/{Area → AreasViewer/subcomponents/Area}/subcomponents/InnerForHooks/index.d.ts +0 -0
- /package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/helper.d.ts +0 -0
- /package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/index.d.ts +0 -0
- /package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/Header/index.d.ts +0 -0
- /package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/Header/skeleton.d.ts +0 -0
- /package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/index.d.ts +0 -0
- /package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/index.d.ts +0 -0
- /package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/subcomponents/NotFound/index.d.ts +0 -0
- /package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/subcomponents/NotFound/types.d.ts +0 -0
- /package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/types.d.ts +0 -0
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { createContext, useRef, useCallback, useEffect } from "react";
|
|
2
|
-
import { useHostTools, useModuleDictionary, useNetwork, EmitEvents } from "@m4l/core";
|
|
3
|
-
import { createStore, useStore } from "zustand";
|
|
4
|
-
import { devtools } from "zustand/middleware";
|
|
5
|
-
import { immer } from "zustand/middleware/immer";
|
|
6
|
-
import { L as LABEL_NEW_AREA } from "../../index.8fca0f8f.js";
|
|
7
|
-
import { shallow } from "zustand/shallow";
|
|
8
|
-
import { useFirstRender } from "@m4l/graphics";
|
|
9
|
-
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
const addAreaNoBoilerPlate = (state) => {
|
|
11
|
-
let newName = "";
|
|
12
|
-
const newId = `area_${new Date().getTime()}_${(Math.random() * 1e3).toFixed(0)}`;
|
|
13
|
-
newName = `${state.getLabel(LABEL_NEW_AREA)} ${state.areas.length + 1}`;
|
|
14
|
-
state.areas.push({ id: newId, name: newName, loadWindows: false });
|
|
15
|
-
state.currentArea = newId;
|
|
16
|
-
if (state.loadAreasFromNetwork) {
|
|
17
|
-
state.networkOperation({
|
|
18
|
-
method: "POST",
|
|
19
|
-
endPoint: `areas`,
|
|
20
|
-
data: { id: newId, name: newName },
|
|
21
|
-
toastSuccess: false,
|
|
22
|
-
toastError: false
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return newId;
|
|
26
|
-
};
|
|
27
|
-
const createAreasStore = (initProps) => {
|
|
28
|
-
const startProps = {
|
|
29
|
-
status: "init",
|
|
30
|
-
currentArea: "",
|
|
31
|
-
areas: [],
|
|
32
|
-
...initProps
|
|
33
|
-
};
|
|
34
|
-
return createStore(
|
|
35
|
-
devtools(
|
|
36
|
-
immer((set, get) => ({
|
|
37
|
-
...startProps,
|
|
38
|
-
actions: {
|
|
39
|
-
addArea: () => {
|
|
40
|
-
let newId = "";
|
|
41
|
-
set((state) => {
|
|
42
|
-
newId = addAreaNoBoilerPlate(state);
|
|
43
|
-
});
|
|
44
|
-
return newId;
|
|
45
|
-
},
|
|
46
|
-
deleteArea: (areaId) => {
|
|
47
|
-
set((state) => {
|
|
48
|
-
const removeIndex = state.areas.findIndex((area) => area.id === areaId);
|
|
49
|
-
if (removeIndex > -1) {
|
|
50
|
-
state.areas.splice(removeIndex, 1);
|
|
51
|
-
}
|
|
52
|
-
if (state.currentArea === areaId) {
|
|
53
|
-
if (state.areas.length > 0) {
|
|
54
|
-
state.currentArea = state.areas[0].id;
|
|
55
|
-
} else {
|
|
56
|
-
state.currentArea = "";
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (state.loadAreasFromNetwork) {
|
|
60
|
-
state.networkOperation({
|
|
61
|
-
method: "DELETE",
|
|
62
|
-
endPoint: `areas/${areaId}`,
|
|
63
|
-
parms: {},
|
|
64
|
-
toastSuccess: false,
|
|
65
|
-
toastError: false
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
selectArea: (newAreaId) => {
|
|
71
|
-
set((state) => {
|
|
72
|
-
if (state.areas.findIndex((area) => area.id === newAreaId) > -1) {
|
|
73
|
-
state.currentArea = newAreaId;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
internalActions: {
|
|
79
|
-
setHandlerGetLabel: (newHandler) => {
|
|
80
|
-
set((state) => {
|
|
81
|
-
state.getLabel = newHandler;
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
loadFromApi: () => {
|
|
85
|
-
if (get().status === "init") {
|
|
86
|
-
if (!get().loadAreasFromNetwork) {
|
|
87
|
-
get().actions.addArea();
|
|
88
|
-
set((state) => {
|
|
89
|
-
state.status = "loaded";
|
|
90
|
-
});
|
|
91
|
-
} else {
|
|
92
|
-
set((state) => {
|
|
93
|
-
state.status = "loading";
|
|
94
|
-
state.networkOperation({
|
|
95
|
-
method: "GET",
|
|
96
|
-
endPoint: `areas`,
|
|
97
|
-
parms: {},
|
|
98
|
-
toastSuccess: false
|
|
99
|
-
}).then((response) => {
|
|
100
|
-
set((otherState) => {
|
|
101
|
-
if (response?.data && Array.isArray(response.data) && response.data.length > 0) {
|
|
102
|
-
otherState.areas = response.data;
|
|
103
|
-
otherState.currentArea = response.data[0].id;
|
|
104
|
-
} else {
|
|
105
|
-
addAreaNoBoilerPlate(otherState);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}).finally(() => {
|
|
109
|
-
set((otherState) => {
|
|
110
|
-
otherState.status = "loaded";
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
setAreaLink: (areaId, store) => {
|
|
118
|
-
set((state) => {
|
|
119
|
-
const areaIndex = state.areas.findIndex((area) => area.id === areaId);
|
|
120
|
-
if (areaIndex > -1) {
|
|
121
|
-
state.areas[areaIndex].store = store;
|
|
122
|
-
state.areas[areaIndex].linked = true;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
})),
|
|
128
|
-
{ name: `Areas store` }
|
|
129
|
-
)
|
|
130
|
-
);
|
|
131
|
-
};
|
|
132
|
-
const AreasContext = createContext(null);
|
|
133
|
-
function AreasProvider(props) {
|
|
134
|
-
const {
|
|
135
|
-
children,
|
|
136
|
-
loadAreasFromNetwork,
|
|
137
|
-
onLoad
|
|
138
|
-
} = props;
|
|
139
|
-
const {
|
|
140
|
-
events_add_listener,
|
|
141
|
-
events_remove_listener
|
|
142
|
-
} = useHostTools();
|
|
143
|
-
const {
|
|
144
|
-
getLabel
|
|
145
|
-
} = useModuleDictionary();
|
|
146
|
-
const {
|
|
147
|
-
networkOperation
|
|
148
|
-
} = useNetwork();
|
|
149
|
-
const isFirstRender = useFirstRender([getLabel]);
|
|
150
|
-
const areasStoreRef = useRef();
|
|
151
|
-
if (!areasStoreRef.current) {
|
|
152
|
-
areasStoreRef.current = createAreasStore({
|
|
153
|
-
getLabel,
|
|
154
|
-
loadAreasFromNetwork,
|
|
155
|
-
networkOperation
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
const status = useStore(areasStoreRef.current, (state) => state.status, shallow);
|
|
159
|
-
const {
|
|
160
|
-
setHandlerGetLabel
|
|
161
|
-
} = useStore(areasStoreRef.current, (state) => state.internalActions, shallow);
|
|
162
|
-
const addWindow = useCallback((newWindow) => {
|
|
163
|
-
const currentArea = areasStoreRef.current?.getState().currentArea;
|
|
164
|
-
const areas = areasStoreRef.current?.getState().areas;
|
|
165
|
-
if (currentArea && areas) {
|
|
166
|
-
const areaIndex = areas.findIndex((area) => area.id == currentArea);
|
|
167
|
-
if (areaIndex > -1 && areas[areaIndex].store) {
|
|
168
|
-
areas[areaIndex].store?.getState().actions.addWindow(newWindow);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}, []);
|
|
172
|
-
useEffect(() => {
|
|
173
|
-
if (status === "loaded") {
|
|
174
|
-
onLoad && onLoad();
|
|
175
|
-
}
|
|
176
|
-
}, [status]);
|
|
177
|
-
useEffect(() => {
|
|
178
|
-
if (!isFirstRender) {
|
|
179
|
-
setHandlerGetLabel(getLabel);
|
|
180
|
-
}
|
|
181
|
-
}, [getLabel]);
|
|
182
|
-
useEffect(() => {
|
|
183
|
-
events_add_listener(EmitEvents.EMMIT_EVENT_HOST_EMERGE_WINDOW, addWindow);
|
|
184
|
-
areasStoreRef.current?.getState().internalActions.loadFromApi();
|
|
185
|
-
return () => {
|
|
186
|
-
events_remove_listener(EmitEvents.EMMIT_EVENT_HOST_EMERGE_WINDOW, addWindow);
|
|
187
|
-
};
|
|
188
|
-
}, []);
|
|
189
|
-
return /* @__PURE__ */ jsx(AreasContext.Provider, {
|
|
190
|
-
value: areasStoreRef.current,
|
|
191
|
-
children
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
export {
|
|
195
|
-
AreasContext as A,
|
|
196
|
-
AreasProvider as a
|
|
197
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { createStore } from "zustand";
|
|
2
|
-
import { devtools } from "zustand/middleware";
|
|
3
|
-
import { immer } from "zustand/middleware/immer";
|
|
4
|
-
import React__default, { createContext } from "react";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
const createDynamicMFStore = (initProps) => {
|
|
7
|
-
const startProps = {
|
|
8
|
-
...initProps
|
|
9
|
-
};
|
|
10
|
-
return createStore(
|
|
11
|
-
devtools(
|
|
12
|
-
immer((set, _get) => ({
|
|
13
|
-
...startProps,
|
|
14
|
-
actions: {
|
|
15
|
-
changeData: (newDynamicMFState) => {
|
|
16
|
-
set((state) => {
|
|
17
|
-
state.dynamicMFParameters = newDynamicMFState;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
})),
|
|
22
|
-
{ name: `dyamic store ${initProps.windowId}` }
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
const DynamicMFParmsContext = createContext(null);
|
|
27
|
-
function DynamicMFParmsProvider(props) {
|
|
28
|
-
const {
|
|
29
|
-
children,
|
|
30
|
-
store
|
|
31
|
-
} = props;
|
|
32
|
-
return /* @__PURE__ */ jsx(DynamicMFParmsContext.Provider, {
|
|
33
|
-
value: store,
|
|
34
|
-
children
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
const MemonizedDynamicMFParmsProvider = React__default.memo(DynamicMFParmsProvider);
|
|
38
|
-
export {
|
|
39
|
-
DynamicMFParmsProvider as D,
|
|
40
|
-
MemonizedDynamicMFParmsProvider as M,
|
|
41
|
-
DynamicMFParmsContext as a,
|
|
42
|
-
createDynamicMFStore as c
|
|
43
|
-
};
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { useNetwork } from "@m4l/core";
|
|
2
|
-
import React__default, { createContext, useRef, useEffect } from "react";
|
|
3
|
-
import { c as createDynamicMFStore } from "./DynamicMFParmsContext/index.c19cb8cc.js";
|
|
4
|
-
import { createStore } from "zustand";
|
|
5
|
-
import { devtools } from "zustand/middleware";
|
|
6
|
-
import { immer } from "zustand/middleware/immer";
|
|
7
|
-
import cloneDeep from "lodash.clonedeep";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
import "./AreasContext/index.0792a8d1.js";
|
|
10
|
-
function getCookiesContainer(data, containerId) {
|
|
11
|
-
const cookies = {};
|
|
12
|
-
try {
|
|
13
|
-
if (Array.isArray(data)) {
|
|
14
|
-
for (let i = 0; i < data.length; i++) {
|
|
15
|
-
if (data[i]?.container_id === containerId && data[i]?.id) {
|
|
16
|
-
cookies[data[i]?.id] = JSON.parse(data[i].value);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
} catch (error) {
|
|
21
|
-
}
|
|
22
|
-
return cookies;
|
|
23
|
-
}
|
|
24
|
-
const createWindowStore = (initProps) => {
|
|
25
|
-
const startProps = {
|
|
26
|
-
status: "init",
|
|
27
|
-
moduleActions: [],
|
|
28
|
-
cookies: initProps.devCookies || { moduleCookies: {}, windowCookies: {} },
|
|
29
|
-
...initProps
|
|
30
|
-
};
|
|
31
|
-
delete startProps.devCookies;
|
|
32
|
-
return createStore(
|
|
33
|
-
devtools(
|
|
34
|
-
immer((set, get, _api) => ({
|
|
35
|
-
...startProps,
|
|
36
|
-
actions: {
|
|
37
|
-
setActions: (newActions) => {
|
|
38
|
-
set((state) => {
|
|
39
|
-
state.moduleActions = cloneDeep(newActions);
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
close: () => {
|
|
43
|
-
const onClose = get().onClose;
|
|
44
|
-
if (onClose) {
|
|
45
|
-
onClose(get().windowId);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
getWindowId: () => {
|
|
49
|
-
return get().windowId;
|
|
50
|
-
},
|
|
51
|
-
getCookie: (id) => {
|
|
52
|
-
return get().cookies.windowCookies[id] || get().cookies.moduleCookies[id];
|
|
53
|
-
},
|
|
54
|
-
getCookies: (type) => {
|
|
55
|
-
if (type === "window") {
|
|
56
|
-
return get().cookies.windowCookies;
|
|
57
|
-
} else {
|
|
58
|
-
return get().cookies.moduleCookies;
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
setCookie: (id, type, cookie) => {
|
|
62
|
-
get().networkOperation({
|
|
63
|
-
method: "PUT",
|
|
64
|
-
endPoint: `cookies/${type === "module" ? get().moduleId : get().windowId}/${id}`,
|
|
65
|
-
data: {
|
|
66
|
-
value: JSON.stringify(cookie)
|
|
67
|
-
},
|
|
68
|
-
toastSuccess: false,
|
|
69
|
-
toastError: false
|
|
70
|
-
});
|
|
71
|
-
set((state) => {
|
|
72
|
-
if (type === "window") {
|
|
73
|
-
state.cookies.windowCookies[id] = cookie;
|
|
74
|
-
} else {
|
|
75
|
-
state.cookies.moduleCookies[id] = cookie;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
internalActions: {
|
|
81
|
-
loadCookiesFromApi: () => {
|
|
82
|
-
if (get().status === "init") {
|
|
83
|
-
get().networkOperation({
|
|
84
|
-
method: "GET",
|
|
85
|
-
endPoint: `cookies`,
|
|
86
|
-
parms: {
|
|
87
|
-
f: [
|
|
88
|
-
{ n: "container_id", o: "e", o1: get().windowId },
|
|
89
|
-
{ n: "container_id", o: "e", o1: get().moduleId }
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
toastSuccess: false,
|
|
93
|
-
toastError: false
|
|
94
|
-
}).then((response) => {
|
|
95
|
-
set((state) => {
|
|
96
|
-
state.cookies.moduleCookies = getCookiesContainer(
|
|
97
|
-
response.data,
|
|
98
|
-
state.moduleId
|
|
99
|
-
);
|
|
100
|
-
state.cookies.windowCookies = getCookiesContainer(
|
|
101
|
-
response.data,
|
|
102
|
-
state.windowId
|
|
103
|
-
);
|
|
104
|
-
state.status = "loaded";
|
|
105
|
-
});
|
|
106
|
-
}).catch((_response) => {
|
|
107
|
-
set((state) => {
|
|
108
|
-
state.status = "loaded";
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
saveModuleCookies: () => {
|
|
114
|
-
for (const key in get().cookies.windowCookies) {
|
|
115
|
-
const cookie = get().cookies.windowCookies[key];
|
|
116
|
-
get().networkOperation({
|
|
117
|
-
method: "PUT",
|
|
118
|
-
endPoint: `cookies/${get().moduleId}/${key}`,
|
|
119
|
-
data: {
|
|
120
|
-
value: JSON.stringify(cookie)
|
|
121
|
-
},
|
|
122
|
-
toastSuccess: false,
|
|
123
|
-
toastError: false
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
})),
|
|
129
|
-
{
|
|
130
|
-
name: `window store ${initProps.windowId}`,
|
|
131
|
-
store: `window dev store ${initProps.windowId}`,
|
|
132
|
-
trace: true
|
|
133
|
-
}
|
|
134
|
-
)
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
const WindowContext = createContext(null);
|
|
138
|
-
function WindowMFProvider(props) {
|
|
139
|
-
const {
|
|
140
|
-
children,
|
|
141
|
-
...other
|
|
142
|
-
} = props;
|
|
143
|
-
const {
|
|
144
|
-
networkOperation
|
|
145
|
-
} = useNetwork();
|
|
146
|
-
const windowStoreRef = useRef();
|
|
147
|
-
const dynamicMFStoreRef = useRef();
|
|
148
|
-
if (!dynamicMFStoreRef.current) {
|
|
149
|
-
dynamicMFStoreRef.current = createDynamicMFStore({
|
|
150
|
-
dynamicMFParameters: props.dynamicParams,
|
|
151
|
-
windowId: props.windowId
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
if (!windowStoreRef.current) {
|
|
155
|
-
windowStoreRef.current = createWindowStore({
|
|
156
|
-
...other,
|
|
157
|
-
dynamicMFStore: dynamicMFStoreRef.current,
|
|
158
|
-
networkOperation
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
useEffect(() => {
|
|
162
|
-
windowStoreRef.current?.getState().internalActions.loadCookiesFromApi();
|
|
163
|
-
return () => {
|
|
164
|
-
console.debug("useEffect cleanUP WindowMFProvider", props.windowId, windowStoreRef.current);
|
|
165
|
-
};
|
|
166
|
-
}, []);
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
if (windowStoreRef.current?.getState().status === "loaded") {
|
|
169
|
-
dynamicMFStoreRef.current?.getState().actions.changeData(props.dynamicParams);
|
|
170
|
-
}
|
|
171
|
-
}, [props.dynamicParams]);
|
|
172
|
-
return /* @__PURE__ */ jsx(WindowContext.Provider, {
|
|
173
|
-
value: windowStoreRef.current,
|
|
174
|
-
children
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
const WindowToolsMFContext = createContext(null);
|
|
178
|
-
function WindowToolsMFProvider(props) {
|
|
179
|
-
const {
|
|
180
|
-
children,
|
|
181
|
-
setActions,
|
|
182
|
-
...other
|
|
183
|
-
} = props;
|
|
184
|
-
return /* @__PURE__ */ jsx(WindowToolsMFContext.Provider, {
|
|
185
|
-
value: {
|
|
186
|
-
setActions,
|
|
187
|
-
...other
|
|
188
|
-
},
|
|
189
|
-
children
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
React__default.memo(WindowToolsMFProvider);
|
|
193
|
-
export {
|
|
194
|
-
WindowToolsMFProvider as W,
|
|
195
|
-
WindowMFProvider as a,
|
|
196
|
-
WindowContext as b,
|
|
197
|
-
WindowToolsMFContext as c
|
|
198
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { useStore } from "zustand";
|
|
3
|
-
import { b as WindowContext, c as WindowToolsMFContext } from "../contexts/index.2a915acf.js";
|
|
4
|
-
import "../contexts/DynamicMFParmsContext/index.c19cb8cc.js";
|
|
5
|
-
const useWindow = () => {
|
|
6
|
-
const context = useContext(WindowContext);
|
|
7
|
-
if (!context)
|
|
8
|
-
throw new Error("useWindow context must be use inside WindowContext");
|
|
9
|
-
return context;
|
|
10
|
-
};
|
|
11
|
-
function useWindowStore(selector, equalityFn) {
|
|
12
|
-
const store = useContext(WindowContext);
|
|
13
|
-
if (!store)
|
|
14
|
-
throw new Error("useWindow context must be use inside WindowContext");
|
|
15
|
-
return useStore(store, selector, equalityFn);
|
|
16
|
-
}
|
|
17
|
-
const useWindowToolsMF = () => {
|
|
18
|
-
const context = useContext(WindowToolsMFContext);
|
|
19
|
-
if (!context)
|
|
20
|
-
throw new Error("useWindowToolsMF context must be use inside WindowToolsMFContext");
|
|
21
|
-
return context;
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
useWindow as a,
|
|
25
|
-
useWindowStore as b,
|
|
26
|
-
useWindowToolsMF as u
|
|
27
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { useStore } from "zustand";
|
|
3
|
-
import { A as AreasContext } from "../../contexts/AreasContext/index.0792a8d1.js";
|
|
4
|
-
import { a as AreaContext } from "../../contexts/AreaContext/index.7890e58d.js";
|
|
5
|
-
function useAreasStore(selector, equalityFn) {
|
|
6
|
-
const context = useContext(AreasContext);
|
|
7
|
-
if (!context)
|
|
8
|
-
throw new Error("useAreasStore context must be use inside AreasContext");
|
|
9
|
-
return useStore(context, selector, equalityFn);
|
|
10
|
-
}
|
|
11
|
-
function useAreaStore(selector, equalityFn) {
|
|
12
|
-
const context = useContext(AreaContext);
|
|
13
|
-
if (!context)
|
|
14
|
-
throw new Error("useAreaStore context must be use inside AreaContext");
|
|
15
|
-
return useStore(context, selector, equalityFn);
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
useAreaStore as a,
|
|
19
|
-
useAreasStore as u
|
|
20
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { useStore } from "zustand";
|
|
3
|
-
import { a as DynamicMFParmsContext } from "../../contexts/DynamicMFParmsContext/index.c19cb8cc.js";
|
|
4
|
-
function useDynamicMFParametersStore(selector, equalityFn) {
|
|
5
|
-
const store = useContext(DynamicMFParmsContext);
|
|
6
|
-
if (!store)
|
|
7
|
-
throw new Error(
|
|
8
|
-
"useDynamicMFParametersStore context must be use inside DynamicMFParmsContext"
|
|
9
|
-
);
|
|
10
|
-
return useStore(store, selector, equalityFn);
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
useDynamicMFParametersStore as u
|
|
14
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import "./components/index.eace295a.js";
|
|
2
|
-
import "./components/AreasAdmin/index.51e28f63.js";
|
|
3
|
-
import "react";
|
|
4
|
-
import "@m4l/core";
|
|
5
|
-
import "@mui/material";
|
|
6
|
-
import "../Icon/index.0f9b360e.js";
|
|
7
|
-
import "react/jsx-runtime";
|
|
8
|
-
import "../mui_extended/IconButton/index.be9c2ce5.js";
|
|
9
|
-
import "zustand";
|
|
10
|
-
import "./contexts/AreasContext/index.0792a8d1.js";
|
|
11
|
-
import "zustand/shallow";
|
|
12
|
-
import "./components/AreasContainer/index.1e5e6e91.js";
|
|
13
|
-
import "react-grid-layout/css/styles.css";
|
|
14
|
-
import "../../react-resizable.e86cb01e.js";
|
|
15
|
-
import "./contexts/index.2a915acf.js";
|
|
16
|
-
import "./contexts/DynamicMFParmsContext/index.c19cb8cc.js";
|
|
17
|
-
const LABEL_NEW_AREA = "label_new_area";
|
|
18
|
-
export {
|
|
19
|
-
LABEL_NEW_AREA as L
|
|
20
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import "@mui/material";
|
|
2
|
-
import "../../react-draggable.1aa81436.js";
|
|
3
|
-
import "react";
|
|
4
|
-
import "../../contexts/ModalContext/index.ae8041f3.js";
|
|
5
|
-
import "../ModalDialog/index.3efe049b.js";
|
|
6
|
-
import "../Resizeable/index.b5d42efb.js";
|
|
7
|
-
import "react/jsx-runtime";
|
|
8
|
-
import "@m4l/graphics";
|
|
9
|
-
import "@m4l/core";
|
|
10
|
-
import "../CommonActions/components/Actions/index.433cd345.js";
|
|
11
|
-
import "@mui/material/Button";
|
|
12
|
-
import "../mui_extended/Button/index.d9e0ae2e.js";
|
|
13
|
-
import "clsx";
|
|
14
|
-
import "react-hook-form";
|
|
15
|
-
import "./WindowBase.59f50553.js";
|
|
16
|
-
import "../Icon/index.0f9b360e.js";
|
|
17
|
-
import "../areas/components/index.eace295a.js";
|
|
18
|
-
import "../areas/components/AreasAdmin/index.51e28f63.js";
|
|
19
|
-
import "../mui_extended/IconButton/index.be9c2ce5.js";
|
|
20
|
-
import "zustand";
|
|
21
|
-
import "../areas/contexts/AreasContext/index.0792a8d1.js";
|
|
22
|
-
import "zustand/shallow";
|
|
23
|
-
import "../areas/components/AreasContainer/index.1e5e6e91.js";
|
|
24
|
-
import "react-grid-layout/css/styles.css";
|
|
25
|
-
import "../../react-resizable.e86cb01e.js";
|
|
26
|
-
import "../areas/contexts/index.2a915acf.js";
|
|
27
|
-
import "../areas/contexts/DynamicMFParmsContext/index.c19cb8cc.js";
|
|
28
|
-
import "@mui/lab";
|
|
29
|
-
import "../mui_extended/Typography/index.41b60a6b.js";
|
|
30
|
-
import "./WindowConfirm.c1339cf8.js";
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import "@mui/material";
|
|
2
|
-
import "react";
|
|
3
|
-
import "@m4l/core";
|
|
4
|
-
import "../Icon/index.0f9b360e.js";
|
|
5
|
-
import "react/jsx-runtime";
|
|
6
|
-
import "./IconButton/index.be9c2ce5.js";
|
|
7
|
-
import "./Accordion/index.b7487e37.js";
|
|
8
|
-
import "./Avatar/index.fe06afd7.js";
|
|
9
|
-
import "react-router-dom";
|
|
10
|
-
import "@mui/material/Button";
|
|
11
|
-
import "./Button/index.d9e0ae2e.js";
|
|
12
|
-
import "clsx";
|
|
13
|
-
import "../Image/index.1a9c0327.js";
|
|
14
|
-
import "@mui/lab";
|
|
15
|
-
import "./Typography/index.41b60a6b.js";
|
|
16
|
-
import "./Popover/index.260aae81.js";
|
|
17
|
-
import "./MenuActions/index.ec654122.js";
|
|
18
|
-
import "./Pager/index.9e123670.js";
|
|
19
|
-
import "./Tab/index.e0653a0a.js";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|