@m4l/components 0.1.66 → 0.1.67

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.
Files changed (78) hide show
  1. package/components/CommonActions/components/ActionCancel/{index.4d0333c0.js → index.1254308b.js} +1 -1
  2. package/components/CommonActions/components/ActionFormCancel/{index.298e0109.js → index.ddf330a8.js} +12 -10
  3. package/components/CommonActions/components/ActionFormIntro/{index.b45922ff.js → index.8248f431.js} +1 -1
  4. package/components/CommonActions/components/ActionIntro/{index.138101aa.js → index.dbf2ad66.js} +2 -2
  5. package/components/CommonActions/components/Actions/{index.77574633.js → index.5da399f8.js} +12 -11
  6. package/components/DataGrid/{index.ef23d0a9.js → index.775deb12.js} +19 -18
  7. package/components/DynamicFilter/{index.04ed3d58.js → index.7c7c9d30.js} +29 -28
  8. package/components/HelperText/{index.c35dcb93.js → index.5d8bc10a.js} +8 -8
  9. package/components/Icon/{index.fbeeacc8.js → index.321976e8.js} +2 -2
  10. package/components/Image/{index.77396f79.js → index.c5b14688.js} +1 -1
  11. package/components/LanguagePopover/{index.c0fc94c7.js → index.6f0bca65.js} +9 -9
  12. package/components/ModalDialog/{index.e600b43a.js → index.c07975ed.js} +5 -5
  13. package/components/NavLink/{index.3f4e2417.js → index.da57f87d.js} +9 -9
  14. package/components/NoItemSelected/{index.609c3c20.js → index.09faa02c.js} +1 -1
  15. package/components/ObjectLogs/{index.7f93ba51.js → index.a48a013c.js} +15 -14
  16. package/components/PaperForm/{index.fb4fa784.js → index.15002e62.js} +1 -1
  17. package/components/Period/{index.0c5bf66f.js → index.c5179eae.js} +13 -12
  18. package/components/Resizeable/{index.4545dd6a.js → index.d3469af2.js} +1 -1
  19. package/components/SideBar/{index.7d970041.js → index.9c026180.js} +6 -6
  20. package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/helper.d.ts +1 -1
  21. package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/types.d.ts +2 -2
  22. package/components/areas/components/AreasViewer/subcomponents/Area/index.d.ts +1 -1
  23. package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/DynamicMFParmsContext/store.d.ts +1 -1
  24. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/WindowContext/store.d.ts +2 -2
  25. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/WindowContext/types.d.ts +1 -1
  26. package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowToolsMFContext/types.d.ts +2 -2
  27. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/index.d.ts +1 -1
  28. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/index.d.ts +1 -1
  29. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Component/index.d.ts +1 -1
  30. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/index.d.ts +1 -1
  31. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types.d.ts +3 -3
  32. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/WindowModal/index.d.ts +1 -1
  33. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/WindowPopUp/index.d.ts +1 -1
  34. package/components/areas/{index.d7519516.js → components/index.98d1c90a.js} +71 -360
  35. package/components/areas/components/index.d.ts +1 -1
  36. package/components/areas/contexts/AreasContext/index.7dc6f386.js +230 -0
  37. package/components/areas/contexts/AreasContext/types.d.ts +1 -1
  38. package/components/areas/contexts/index.3e99c2da.js +2 -0
  39. package/components/areas/contexts/index.d.ts +4 -4
  40. package/components/areas/hooks/index.1a0b8ab0.js +26 -0
  41. package/components/areas/hooks/useArea/index.443ac11d.js +34 -0
  42. package/components/areas/hooks/useDynamicMFParameters/index.2a963454.js +14 -0
  43. package/components/areas/hooks/useDynamicMFParameters/index.d.ts +4 -4
  44. package/components/areas/hooks/useWindowToolsMF/index.d.ts +1 -1
  45. package/components/areas/index.6aec2efe.js +43 -0
  46. package/components/areas/{components/AreasViewer/subcomponents/Area/types.d.ts → types.d.ts} +3 -3
  47. package/components/formatters/BooleanFormatter/{index.0edacc9b.js → index.a3c6f613.js} +1 -1
  48. package/components/formatters/{index.879170b2.js → index.a09541d3.js} +2 -2
  49. package/components/hook-form/RHFAutocomplete/{index.5f27e28c.js → index.9f9d4ed7.js} +10 -10
  50. package/components/hook-form/RHFAutocompleteAsync/{index.35e17cd6.js → index.af16b28e.js} +2 -2
  51. package/components/hook-form/RHFCheckbox/{index.4f134f09.js → index.938fb1da.js} +3 -3
  52. package/components/hook-form/RHFPeriod/{index.dcaa0c87.js → index.1b1fafa6.js} +2 -2
  53. package/components/hook-form/RHFTextField/{index.fc90a570.js → index.e42cd9c0.js} +6 -6
  54. package/components/hook-form/RHFUpload/{index.654ad316.js → index.d79721d2.js} +1 -1
  55. package/components/modal/{WindowBase.230a498f.js → WindowBase.39f1310d.js} +3 -3
  56. package/components/modal/{WindowConfirm.575b4d41.js → WindowConfirm.993a8ed9.js} +15 -14
  57. package/components/modal/index.c63957d7.js +24 -0
  58. package/components/mui_extended/Accordion/{index.0b15f939.js → index.466d66d5.js} +2 -2
  59. package/components/mui_extended/Button/{index.b7b70e5f.js → index.680f7d77.js} +3 -3
  60. package/components/mui_extended/IconButton/{index.a5072cd3.js → index.d31f1039.js} +1 -1
  61. package/components/mui_extended/MenuActions/{index.3a275abb.js → index.e1749afa.js} +2 -2
  62. package/components/mui_extended/Pager/{index.5a69ab10.js → index.bc67d954.js} +1 -1
  63. package/components/mui_extended/Typography/{index.eab3d85c.js → index.1d866b8b.js} +1 -1
  64. package/components/mui_extended/index.a6c77aa1.js +19 -0
  65. package/contexts/ModalContext/{index.de0a3457.js → index.53e8904e.js} +1 -1
  66. package/contexts/index.d.ts +1 -1
  67. package/hooks/useModal/{index.e103db09.js → index.2a4b4b65.js} +1 -1
  68. package/index.js +85 -80
  69. package/package.json +1 -1
  70. package/{react-draggable.4d08d714.js → react-draggable.18cf453f.js} +1 -1
  71. package/{react-resizable.23b980cb.js → react-resizable.f3de2742.js} +2 -2
  72. package/utils/{index.c2e62d8f.js → index.3a4700cd.js} +1 -1
  73. package/{vendor.be57c149.js → vendor.31965c93.js} +44 -40
  74. package/components/modal/index.237881ea.js +0 -23
  75. package/components/mui_extended/index.35f74599.js +0 -19
  76. /package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/DynamicMFParmsContext/index.d.ts +0 -0
  77. /package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/DynamicMFParmsContext/types.d.ts +0 -0
  78. /package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowToolsMFContext/index.d.ts +0 -0
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { WindowProps } from '../../../../types';
2
+ import { WindowProps } from '../../../../../../../../types';
3
3
  export declare const InnerForHooks: (props: WindowProps) => JSX.Element | null;
4
4
  export declare const MemonizedInnerForHooks: React.MemoExoticComponent<(props: WindowProps) => JSX.Element | null>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { JSX_REACT_NODE } from '../../../../../../types';
2
+ import { JSX_REACT_NODE } from '../../../../../../../../../../types';
3
3
  export declare const Component: (props: {
4
4
  component: JSX_REACT_NODE;
5
5
  }) => JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { MFBaseProps } from '../../../../../../types';
2
+ import { MFBaseProps } from '../../../../../../../../../../types';
3
3
  export declare const MicroFrontend: (props: MFBaseProps) => JSX.Element;
4
4
  export declare const MemonizedMF: React.MemoExoticComponent<(props: MFBaseProps) => JSX.Element>;
@@ -1,6 +1,6 @@
1
- import { WindowToolsMF } from '../../../../../../../../../../contexts/WindowToolsMFContext/types';
2
- import { MFBaseProps } from '../../../../../../types';
3
- import { DynamicMFStore } from '../../../../../../../../../../contexts/DynamicMFParmsContext/store';
1
+ import { WindowToolsMF } from '../../../../contexts/WindowToolsMFContext/types';
2
+ import { MFBaseProps } from '../../../../../../../../../../types';
3
+ import { DynamicMFStore } from '../../../../contexts/DynamicMFParmsContext/store';
4
4
  export interface MicroFrontendProps extends MFBaseProps {
5
5
  moduleId: string;
6
6
  dynamicMFStore?: DynamicMFStore;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { ModalProps } from '../../types';
2
+ import { ModalProps } from '../../../../../../types';
3
3
  export declare const WindowModal: (props: ModalProps) => JSX.Element;
4
4
  export declare const MemonizedWindowModal: React.MemoExoticComponent<(props: ModalProps) => JSX.Element>;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { PopUpProps } from '../../types';
2
+ import { PopUpProps } from '../../../../../../types';
3
3
  export declare const WindowPopUp: (props: PopUpProps) => JSX.Element;
4
4
  export declare const MemonizedWindowPopUp: React.MemoExoticComponent<(props: PopUpProps) => JSX.Element>;
@@ -1,93 +1,83 @@
1
- import { I as IconButton } from "../mui_extended/IconButton/index.a5072cd3.js";
2
- import { useHostTools, useModuleDictionary, useNetwork, useModuleSkeleton, EmitEvents, useEnvironment, axiosOperation } from "@m4l/core";
1
+ import { I as IconButton } from "../../mui_extended/IconButton/index.d31f1039.js";
2
+ import { u as useAreasStore, a as useArea, b as useAreas, c as useAreaStore } from "../hooks/useArea/index.443ac11d.js";
3
+ import { useEnvironment, useNetwork, useModuleDictionary, useModuleSkeleton, useHostTools, axiosOperation } from "@m4l/core";
3
4
  import { shallow } from "zustand/shallow";
4
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
- import React__default, { createContext, useRef, useCallback, useEffect, useContext, useMemo, useState } from "react";
5
+ import { A as AREAS_VIEWER_CLASS_NAME, a as AREAS_ADMIN_CLASS_NAME, I as ICONS, g as getAreasDictionary } from "../index.6aec2efe.js";
6
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
7
+ import React__default, { createContext, useRef, useEffect, useMemo, useState, useCallback } from "react";
6
8
  import { generateUtilityClasses, Skeleton, styled as styled$1, Typography as Typography$1, Dialog } from "@mui/material";
7
- import { I as Icon } from "../Icon/index.fbeeacc8.js";
9
+ import { I as Icon } from "../../Icon/index.321976e8.js";
8
10
  import clsx from "clsx";
9
11
  import { createStore, useStore } from "zustand";
10
- import { useResponsiveDesktop, useFirstRender, useHostTheme, useFormatter, useLocales } from "@m4l/graphics";
11
- import { devtools } from "zustand/middleware";
12
- import { immer } from "zustand/middleware/immer";
13
- import { unstable_composeClasses } from "@mui/base";
14
- import { g as getComponentUtilityClass } from "../../utils/index.c2e62d8f.js";
15
- import "../mui_extended/Accordion/index.0b15f939.js";
16
- import "../mui_extended/Avatar/index.fe06afd7.js";
12
+ import "../contexts/AreasContext/index.7dc6f386.js";
13
+ import "../../mui_extended/Accordion/index.466d66d5.js";
14
+ import "../../mui_extended/Avatar/index.fe06afd7.js";
17
15
  import "react-router-dom";
18
16
  import "@mui/material/Button";
19
- import { B as Button } from "../mui_extended/Button/index.b7b70e5f.js";
20
- import { I as Image } from "../Image/index.77396f79.js";
17
+ import { B as Button } from "../../mui_extended/Button/index.680f7d77.js";
18
+ import { I as Image } from "../../Image/index.c5b14688.js";
21
19
  import "@mui/lab";
22
- import { T as Typography } from "../mui_extended/Typography/index.eab3d85c.js";
23
- import "../mui_extended/Popover/index.e271e4f0.js";
24
- import { M as MenuActions } from "../mui_extended/MenuActions/index.3a275abb.js";
25
- import "../mui_extended/Pager/index.5a69ab10.js";
26
- import "../mui_extended/Tab/index.e0653a0a.js";
20
+ import { T as Typography } from "../../mui_extended/Typography/index.1d866b8b.js";
21
+ import "../../mui_extended/Popover/index.e271e4f0.js";
22
+ import { M as MenuActions } from "../../mui_extended/MenuActions/index.e1749afa.js";
23
+ import "../../mui_extended/Pager/index.bc67d954.js";
24
+ import "../../mui_extended/Tab/index.e0653a0a.js";
25
+ import { unstable_composeClasses } from "@mui/base";
26
+ import { g as getComponentUtilityClass } from "../../../utils/index.3a4700cd.js";
27
27
  import { styled } from "@mui/material/styles";
28
- import { r as react_resizable_css } from "../../react-resizable.23b980cb.js";
28
+ import { r as react_resizable_css } from "../../../react-resizable.f3de2742.js";
29
+ import { immer } from "zustand/middleware/immer";
30
+ import { devtools } from "zustand/middleware";
29
31
  import debounce from "lodash/debounce";
30
32
  import cloneDeep from "lodash.clonedeep";
33
+ import { useResponsiveDesktop, useFirstRender, useHostTheme, useFormatter, useLocales } from "@m4l/graphics";
31
34
  import { WidthProvider, Responsive } from "react-grid-layout";
32
35
  import { m } from "framer-motion";
33
- import "../animate/LoadingScreen/index.1d0c4307.js";
34
- import "../animate/PropagateLoader/index.be5b02c3.js";
36
+ import "../../animate/LoadingScreen/index.1d0c4307.js";
37
+ import "../../animate/PropagateLoader/index.be5b02c3.js";
35
38
  import "react-hook-form";
36
- import "../hook-form/RHFAutocomplete/index.5f27e28c.js";
37
- import "../HelperText/index.c35dcb93.js";
38
- import "../hook-form/RHFAutocompleteAsync/index.35e17cd6.js";
39
- import "../hook-form/RHFCheckbox/index.4f134f09.js";
39
+ import "../../hook-form/RHFAutocomplete/index.9f9d4ed7.js";
40
+ import "../../HelperText/index.5d8bc10a.js";
41
+ import "../../hook-form/RHFAutocompleteAsync/index.af16b28e.js";
42
+ import "../../hook-form/RHFCheckbox/index.938fb1da.js";
40
43
  import "@mui/x-date-pickers";
41
- import "../hook-form/RHFDateTime/index.6c129ce4.js";
42
- import "../hook-form/RHFTextField/index.fc90a570.js";
43
- import "../hook-form/RHFPeriod/index.dcaa0c87.js";
44
- import "../Period/index.0c5bf66f.js";
45
- import "../CommonActions/components/Actions/index.77574633.js";
46
- import "../../contexts/ModalContext/index.de0a3457.js";
47
- import { c as cjs } from "../../react-draggable.4d08d714.js";
48
- import "../ModalDialog/index.e600b43a.js";
49
- import { R as ResizeableWindow } from "../Resizeable/index.4545dd6a.js";
50
- import "../modal/WindowConfirm.575b4d41.js";
51
- import "../modal/WindowBase.230a498f.js";
44
+ import "../../hook-form/RHFDateTime/index.6c129ce4.js";
45
+ import "../../hook-form/RHFTextField/index.e42cd9c0.js";
46
+ import "../../hook-form/RHFPeriod/index.1b1fafa6.js";
47
+ import "../../Period/index.c5179eae.js";
48
+ import "../../CommonActions/components/Actions/index.5da399f8.js";
49
+ import "../../../contexts/ModalContext/index.53e8904e.js";
50
+ import { c as cjs } from "../../../react-draggable.18cf453f.js";
51
+ import "../../ModalDialog/index.c07975ed.js";
52
+ import { R as ResizeableWindow } from "../../Resizeable/index.d3469af2.js";
53
+ import "../../modal/WindowConfirm.993a8ed9.js";
54
+ import "../../modal/WindowBase.39f1310d.js";
52
55
  import "lodash/isString";
53
56
  import "react-dropzone";
54
- import "../hook-form/RHFUpload/index.654ad316.js";
55
- import "../DataGrid/index.ef23d0a9.js";
57
+ import "../../hook-form/RHFUpload/index.d79721d2.js";
58
+ import "../../DataGrid/index.775deb12.js";
56
59
  import "react-dnd";
57
60
  import "react-dnd-html5-backend";
58
- import "../DynamicFilter/index.04ed3d58.js";
59
- import "../ScrollBar/index.bbe48f4d.js";
61
+ import "../../DynamicFilter/index.7c7c9d30.js";
62
+ import "../../ScrollBar/index.bbe48f4d.js";
60
63
  import "yup";
61
64
  import "@hookform/resolvers/yup";
62
- import "../../contexts/RHFormContext/index.a7511399.js";
63
- import { D as DraggableWindow } from "../../vendor.be57c149.js";
64
- import "../LanguagePopover/index.c0fc94c7.js";
65
- import "../NavLink/index.3f4e2417.js";
66
- import "../NoItemSelected/index.609c3c20.js";
67
- import "../ObjectLogs/index.7f93ba51.js";
68
- import "../../react-json-view.57125fcf.js";
69
- import "../PaperForm/index.fb4fa784.js";
70
- import "../Page/index.4237c241.js";
71
- import "../PropertyValue/index.dfcfe1ba.js";
72
- import "../../react-splitter-layout.8b1655c8.js";
73
- import "../SplitLayout/index.5a8355d8.js";
74
- import "../SideBar/index.7d970041.js";
75
- import { L as LinearProgress } from "../mui_extended/LinearProgress/index.c92b9ba9.js";
76
- import { v as varBounce } from "../animate/variants/bounce.784aaaaa.js";
77
- const AREAS_DICTIONARY_ID = "areas";
78
- function getAreasComponentsDictionary() {
79
- return [AREAS_DICTIONARY_ID];
80
- }
81
- const LABEL_FILTER_BUTTON = "filter_tooltip";
82
- const DICCTIONARY = {
83
- label_new_area: "label_new_area",
84
- label_persist_module_cookies: "label_persist_module_cookies"
85
- };
86
- const getAreasDictionary = (key) => {
87
- return `${AREAS_DICTIONARY_ID}.${key}`;
88
- };
89
- const AREAS_VIEWER_CLASS_NAME = "M4LAreasViewer";
90
- const AREAS_ADMIN_CLASS_NAME = "M4LAreasAdmin";
65
+ import "../../../contexts/RHFormContext/index.a7511399.js";
66
+ import { D as DraggableWindow } from "../../../vendor.31965c93.js";
67
+ import "../../LanguagePopover/index.6f0bca65.js";
68
+ import "../../NavLink/index.da57f87d.js";
69
+ import "../../NoItemSelected/index.09faa02c.js";
70
+ import "../../ObjectLogs/index.a48a013c.js";
71
+ import "../../../react-json-view.57125fcf.js";
72
+ import "../../PaperForm/index.15002e62.js";
73
+ import "../../Page/index.4237c241.js";
74
+ import "../../PropertyValue/index.dfcfe1ba.js";
75
+ import "../../../react-splitter-layout.8b1655c8.js";
76
+ import "../../SplitLayout/index.5a8355d8.js";
77
+ import "../../SideBar/index.9c026180.js";
78
+ import { a as useWindow, b as useWindowStore } from "../hooks/index.1a0b8ab0.js";
79
+ import { L as LinearProgress } from "../../mui_extended/LinearProgress/index.c92b9ba9.js";
80
+ import { v as varBounce } from "../../animate/variants/bounce.784aaaaa.js";
91
81
  const areasViewerClasses = generateUtilityClasses(AREAS_VIEWER_CLASS_NAME, [
92
82
  "root",
93
83
  "areaRoot",
@@ -146,242 +136,6 @@ const useAreasAdminUtilityClasses = (ownerState) => {
146
136
  };
147
137
  return unstable_composeClasses(slots, getComponentUtilityClass(AREAS_ADMIN_CLASS_NAME), {});
148
138
  };
149
- const addArea = (state) => {
150
- let newName = "";
151
- const newId = `area_${new Date().getTime()}_${(Math.random() * 1e3).toFixed(0)}`;
152
- newName = `${state.getLabel(getAreasDictionary("label_new_area"))} ${state.areas.length + 1}`;
153
- state.areas.push({ id: newId, name: newName, loadWindows: false });
154
- state.currentArea = newId;
155
- if (state.loadAreasFromNetwork) {
156
- state.networkOperation({
157
- method: "POST",
158
- endPoint: `areas`,
159
- data: { id: newId, name: newName },
160
- toastSuccess: false,
161
- toastError: false
162
- });
163
- }
164
- return newId;
165
- };
166
- const updateOwnerStateClasses = (state) => {
167
- state.viwerClasses = useAreasViewerUtilityClasses(state.ownerState);
168
- state.adminClasses = useAreasAdminUtilityClasses(state.ownerState);
169
- };
170
- const createAreasStore = (initProps) => {
171
- const startProps = {
172
- viwerClasses: useAreasViewerUtilityClasses(initProps.ownerState),
173
- adminClasses: useAreasAdminUtilityClasses(initProps.ownerState),
174
- currentArea: "",
175
- areas: [],
176
- ...initProps
177
- };
178
- return createStore(
179
- devtools(
180
- immer((set, get) => ({
181
- ...startProps,
182
- actions: {
183
- init: () => {
184
- if (get().ownerState.status === "init") {
185
- if (!get().loadAreasFromNetwork) {
186
- get().actions.addArea();
187
- set((state) => {
188
- state.ownerState.status = "loaded";
189
- updateOwnerStateClasses(state);
190
- });
191
- } else {
192
- set((state) => {
193
- state.ownerState.status = "loading";
194
- updateOwnerStateClasses(state);
195
- state.networkOperation({
196
- method: "GET",
197
- endPoint: `areas`,
198
- parms: {},
199
- toastSuccess: false
200
- }).then((response) => {
201
- set((otherState) => {
202
- if (response?.data && Array.isArray(response.data) && response.data.length > 0) {
203
- otherState.areas = response.data;
204
- otherState.currentArea = response.data[0].id;
205
- } else {
206
- addArea(otherState);
207
- }
208
- });
209
- }).finally(() => {
210
- set((state2) => {
211
- state2.ownerState.status = "loaded";
212
- updateOwnerStateClasses(state2);
213
- });
214
- });
215
- });
216
- }
217
- }
218
- },
219
- addArea: () => {
220
- let newId = "";
221
- set((state) => {
222
- newId = addArea(state);
223
- });
224
- return newId;
225
- },
226
- deleteArea: (areaId) => {
227
- set((state) => {
228
- const removeIndex = state.areas.findIndex((area) => area.id === areaId);
229
- if (removeIndex > -1) {
230
- state.areas.splice(removeIndex, 1);
231
- }
232
- if (state.currentArea === areaId) {
233
- if (state.areas.length > 0) {
234
- state.currentArea = state.areas[0].id;
235
- } else {
236
- state.currentArea = "";
237
- }
238
- }
239
- if (state.loadAreasFromNetwork) {
240
- state.networkOperation({
241
- method: "DELETE",
242
- endPoint: `areas/${areaId}`,
243
- parms: {},
244
- toastSuccess: false,
245
- toastError: false
246
- });
247
- }
248
- });
249
- },
250
- selectArea: (newAreaId) => {
251
- set((state) => {
252
- if (state.areas.findIndex((area) => area.id === newAreaId) > -1) {
253
- state.currentArea = newAreaId;
254
- }
255
- });
256
- }
257
- },
258
- internalActions: {
259
- setHandlerGetLabel: (newHandler) => {
260
- set((state) => {
261
- state.getLabel = newHandler;
262
- });
263
- },
264
- setAreaLink: (areaId, store) => {
265
- set((state) => {
266
- const areaIndex = state.areas.findIndex((area) => area.id === areaId);
267
- if (areaIndex > -1) {
268
- state.areas[areaIndex].store = store;
269
- state.areas[areaIndex].linked = true;
270
- }
271
- });
272
- },
273
- setExternalState: (newExternalState) => {
274
- set((state) => {
275
- state.ownerState = { ...state.ownerState, ...newExternalState };
276
- updateOwnerStateClasses(state);
277
- });
278
- }
279
- }
280
- })),
281
- { name: `Areas store` }
282
- )
283
- );
284
- };
285
- const AreasContext = createContext(null);
286
- function AreasProvider(props) {
287
- const {
288
- children,
289
- loadAreasFromNetwork,
290
- loadCookiesFromNetwork,
291
- onLoad
292
- } = props;
293
- const {
294
- events_add_listener,
295
- events_remove_listener
296
- } = useHostTools();
297
- const {
298
- getLabel
299
- } = useModuleDictionary();
300
- const {
301
- networkOperation
302
- } = useNetwork();
303
- const isDesktop = useResponsiveDesktop();
304
- const isSkeleton = useModuleSkeleton();
305
- const isFirstRender = useFirstRender([getLabel]);
306
- const areasStoreRef = useRef();
307
- if (!areasStoreRef.current) {
308
- areasStoreRef.current = createAreasStore({
309
- getLabel,
310
- loadAreasFromNetwork,
311
- loadCookiesFromNetwork,
312
- networkOperation,
313
- ownerState: {
314
- status: "init",
315
- isMobile: !isDesktop,
316
- isSkeleton
317
- }
318
- });
319
- areasStoreRef.current?.getState().actions.init();
320
- }
321
- const status = useStore(areasStoreRef.current, (state) => state.ownerState.status, shallow);
322
- const {
323
- setHandlerGetLabel
324
- } = useStore(areasStoreRef.current, (state) => state.internalActions, shallow);
325
- const addWindow = useCallback((newWindow) => {
326
- const currentArea = areasStoreRef.current?.getState().currentArea;
327
- const areas = areasStoreRef.current?.getState().areas;
328
- if (currentArea && areas) {
329
- const areaIndex = areas.findIndex((area) => area.id == currentArea);
330
- if (areaIndex > -1 && areas[areaIndex].store) {
331
- areas[areaIndex].store?.getState().actions.addWindow(newWindow);
332
- }
333
- }
334
- }, []);
335
- useEffect(() => {
336
- if (status === "loaded") {
337
- onLoad && onLoad();
338
- }
339
- }, [status]);
340
- useEffect(() => {
341
- if (!isFirstRender) {
342
- setHandlerGetLabel(getLabel);
343
- }
344
- }, [getLabel]);
345
- useEffect(() => {
346
- events_add_listener(EmitEvents.EMMIT_EVENT_HOST_EMERGE_WINDOW, addWindow);
347
- return () => {
348
- events_remove_listener(EmitEvents.EMMIT_EVENT_HOST_EMERGE_WINDOW, addWindow);
349
- };
350
- }, []);
351
- useEffect(() => {
352
- if (isFirstRender) {
353
- return;
354
- }
355
- areasStoreRef.current?.getState().internalActions.setExternalState({
356
- isMobile: !isDesktop,
357
- isSkeleton
358
- });
359
- }, [isDesktop, isSkeleton]);
360
- return /* @__PURE__ */ jsx(AreasContext.Provider, {
361
- value: areasStoreRef.current,
362
- children
363
- });
364
- }
365
- function useAreas() {
366
- const context = useContext(AreasContext);
367
- if (!context)
368
- throw new Error("useAreas context must be use inside AreasContext");
369
- return context;
370
- }
371
- function useAreasStore(selector, equalityFn) {
372
- const context = useContext(AreasContext);
373
- if (!context)
374
- throw new Error("useAreasStore context must be use inside AreasContext");
375
- return useStore(context, selector, equalityFn);
376
- }
377
- const ICONS = {
378
- CLOSE: "close.svg",
379
- MAXIMIZE: "maximize.svg",
380
- NORMALIZE: "normalize.svg",
381
- DELETE_AREA: "delete_area.svg",
382
- ADD_AREA: "add_area.svg",
383
- EDIT_AREA: "edit_area.svg"
384
- };
385
139
  const AreaChip = (props) => {
386
140
  const {
387
141
  areaId,
@@ -443,7 +197,7 @@ function AreasAdmin() {
443
197
  const status = useAreasStore((state) => state.ownerState.status);
444
198
  const classesRoot = useAreasStore((state) => state.adminClasses.root);
445
199
  const {
446
- addArea: addArea2
200
+ addArea
447
201
  } = useAreasStore((state) => state.actions, shallow);
448
202
  const {
449
203
  host_static_assets,
@@ -463,7 +217,7 @@ function AreasAdmin() {
463
217
  className: areasAdminClasses.areasAddButton,
464
218
  src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.ADD_AREA}`,
465
219
  size: "small",
466
- onClick: addArea2
220
+ onClick: addArea
467
221
  })]
468
222
  });
469
223
  }
@@ -1237,18 +991,6 @@ if (process.env.NODE_ENV !== "production") {
1237
991
  AreaProvider.displayName = "AreaProvider";
1238
992
  }
1239
993
  React__default.memo(AreaProvider);
1240
- const useArea = () => {
1241
- const context = useContext(AreaContext);
1242
- if (!context)
1243
- throw new Error("useArea context must be use inside AreaContext");
1244
- return context;
1245
- };
1246
- function useAreaStore(selector, equalityFn) {
1247
- const context = useContext(AreaContext);
1248
- if (!context)
1249
- throw new Error("useAreaStore context must be use inside AreaContext");
1250
- return useStore(context, selector, equalityFn);
1251
- }
1252
994
  const WindowToolsMFContext = createContext(null);
1253
995
  function WindowToolsMFProvider(props) {
1254
996
  const {
@@ -1468,18 +1210,6 @@ function WindowMFProvider(props) {
1468
1210
  children
1469
1211
  });
1470
1212
  }
1471
- const useWindow = () => {
1472
- const context = useContext(WindowContext);
1473
- if (!context)
1474
- throw new Error("useWindow context must be use inside WindowContext");
1475
- return context;
1476
- };
1477
- function useWindowStore(selector, equalityFn) {
1478
- const store = useContext(WindowContext);
1479
- if (!store)
1480
- throw new Error("useWindow context must be use inside WindowContext");
1481
- return useStore(store, selector, equalityFn);
1482
- }
1483
1213
  const Component = (props) => {
1484
1214
  const {
1485
1215
  component
@@ -2382,35 +2112,16 @@ function AreasViewer() {
2382
2112
  })
2383
2113
  });
2384
2114
  }
2385
- function useDynamicMFParametersStore(selector, equalityFn) {
2386
- const store = useContext(DynamicMFParmsContext);
2387
- if (!store)
2388
- throw new Error(
2389
- "useDynamicMFParametersStore context must be use inside DynamicMFParmsContext"
2390
- );
2391
- return useStore(store, selector, equalityFn);
2392
- }
2393
- const useWindowToolsMF = () => {
2394
- const context = useContext(WindowToolsMFContext);
2395
- if (!context)
2396
- throw new Error("useWindowToolsMF context must be use inside WindowToolsMFContext");
2397
- return context;
2398
- };
2399
2115
  export {
2400
- AreasAdmin as A,
2401
- DICCTIONARY as D,
2402
- LABEL_FILTER_BUTTON as L,
2116
+ AreaContext as A,
2117
+ DynamicMFParmsContext as D,
2403
2118
  MemonizedDynamicMFParmsProvider as M,
2404
- WindowToolsMFProvider as W,
2405
- AreasViewer as a,
2119
+ WindowContext as W,
2120
+ useAreasAdminUtilityClasses as a,
2406
2121
  WindowToolsMFContext as b,
2407
- AreasProvider as c,
2408
- AreasContext as d,
2409
- useDynamicMFParametersStore as e,
2410
- AREAS_DICTIONARY_ID as f,
2411
- getAreasComponentsDictionary as g,
2412
- getAreasDictionary as h,
2413
- DynamicMFParmsProvider as i,
2414
- DynamicMFParmsContext as j,
2415
- useWindowToolsMF as u
2122
+ AreasAdmin as c,
2123
+ AreasViewer as d,
2124
+ WindowToolsMFProvider as e,
2125
+ DynamicMFParmsProvider as f,
2126
+ useAreasViewerUtilityClasses as u
2416
2127
  };
@@ -1,4 +1,4 @@
1
1
  export * from './AreasAdmin';
2
2
  export * from './AreasViewer';
3
- export type { NewWindowProps as NewWindow } from './AreasViewer/subcomponents/Area/types';
3
+ export type { NewWindowProps as NewWindow } from '../types';
4
4
  export type { MicroFrontendProps } from './AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types';