@m4l/components 0.1.90 → 0.1.93

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 (174) hide show
  1. package/@types/export.d.ts +12 -15
  2. package/components/AccountPopover/AccountPopover.d.ts +2 -1
  3. package/components/AccountPopover/{index.724828f0.js → index.2ef0bf6d.js} +20 -31
  4. package/components/AccountPopover/index.d.ts +0 -1
  5. package/components/AccountPopover/subcomponents/PopOver/types.d.ts +4 -3
  6. package/components/AccountPopover/types.d.ts +50 -26
  7. package/components/AppBar/{index.0328abec.js → index.16fe42a1.js} +3 -22
  8. package/components/CommonActions/components/ActionCancel/{index.441118b5.js → index.c3e23ad4.js} +2 -2
  9. package/components/CommonActions/components/ActionFormCancel/{index.435fcb53.js → index.6da52418.js} +4 -34
  10. package/components/CommonActions/components/ActionFormIntro/{index.edb131c4.js → index.c3af6d1d.js} +2 -2
  11. package/components/CommonActions/components/ActionIntro/{index.24367ed3.js → index.49631fcb.js} +2 -2
  12. package/components/CommonActions/components/Actions/{index.8dcaba29.js → index.ccf731c1.js} +2 -38
  13. package/components/DataGrid/classes/index.d.ts +1 -0
  14. package/components/DataGrid/classes/types.d.ts +1 -0
  15. package/components/DataGrid/formatters/columnConcatenatedValueFormatter/index.d.ts +2 -2
  16. package/components/DataGrid/{index.c296f69c.js → index.abedf2c0.js} +44 -14
  17. package/components/DataGrid/subcomponents/Actions/{index.fadd92f2.js → index.c8408b73.js} +9 -38
  18. package/components/DraggableWindow/{index.c702d3f2.js → index.8f423ed7.js} +1 -1
  19. package/components/DynamicFilter/{index.6a22346e.js → index.cb1402aa.js} +23 -56
  20. package/components/DynamicFilter/index.d.ts +1 -1
  21. package/components/GridLayout/classes/index.d.ts +1 -1
  22. package/components/GridLayout/{index.8ae34c50.js → index.1421f0d4.js} +21 -18
  23. package/components/GridLayout/subcomponents/Griditem/{index.c7a33781.js → index.b2342897.js} +5 -4
  24. package/components/GridLayout/subcomponents/Responsive/helper.d.ts +1 -0
  25. package/components/GridLayout/subcomponents/Responsive/{index.96cdb1b4.js → index.f459804c.js} +33 -12
  26. package/components/GridLayout/subcomponents/Responsive/responsiveUtils.d.ts +2 -2
  27. package/components/GridLayout/subcomponents/Responsive/types.d.ts +22 -1
  28. package/components/GridLayout/types.d.ts +11 -0
  29. package/components/HelperText/{index.31f2a824.js → index.7d2afdb3.js} +2 -23
  30. package/components/Icon/{index.a70c4729.js → index.3211023d.js} +8 -6
  31. package/components/Image/{index.c18ebf5a.js → index.611cd930.js} +43 -14
  32. package/components/LanguagePopover/{index.c9876e63.js → index.b6dc03d0.js} +4 -20
  33. package/components/LinearProgressIndeterminate/{index.60dabc06.js → index.c46da124.js} +1 -1
  34. package/components/LoadingError/LoadingError.d.ts +3 -0
  35. package/components/LoadingError/classes/constants.d.ts +1 -0
  36. package/components/LoadingError/classes/index.d.ts +14 -0
  37. package/components/LoadingError/classes/types.d.ts +14 -0
  38. package/components/LoadingError/dictionary.d.ts +1 -0
  39. package/components/LoadingError/index.96bdc803.js +106 -0
  40. package/components/LoadingError/index.d.ts +2 -0
  41. package/components/LoadingError/types.d.ts +10 -0
  42. package/components/MFLoader/classes/constants.d.ts +1 -0
  43. package/components/MFLoader/classes/index.d.ts +7 -0
  44. package/components/MFLoader/classes/types.d.ts +7 -0
  45. package/components/MFLoader/dictionary.d.ts +1 -0
  46. package/components/MFLoader/index.caee87dd.js +296 -0
  47. package/components/MFLoader/index.d.ts +2 -0
  48. package/components/MFLoader/types.d.ts +7 -0
  49. package/components/ModalDialog/{index.7d0d3ea1.js → index.ec55087e.js} +5 -5
  50. package/components/NavLink/{index.4f927064.js → index.b75c91e1.js} +2 -22
  51. package/components/NoItemSelected/{index.1eaf72d8.js → index.3e29c208.js} +1 -1
  52. package/components/ObjectLogs/{index.87438c47.js → index.38fd657f.js} +12 -38
  53. package/components/Page/index.c4642a29.js +127 -0
  54. package/components/PaperForm/{index.e02c772c.js → index.cce9ed39.js} +1 -1
  55. package/components/Period/{index.d1182d4a.js → index.c35c6a6c.js} +5 -37
  56. package/components/PrintingSystem/PrintingSystem.d.ts +3 -0
  57. package/components/PrintingSystem/classes/constants.d.ts +1 -0
  58. package/components/PrintingSystem/classes/index.d.ts +32 -0
  59. package/components/PrintingSystem/classes/types.d.ts +33 -0
  60. package/components/PrintingSystem/index.d.ts +2 -0
  61. package/components/PrintingSystem/index.e18a2fa8.js +634 -0
  62. package/components/PrintingSystem/subcomponents/BodyNode/index.d.ts +3 -0
  63. package/components/PrintingSystem/subcomponents/BodyNode/types.d.ts +5 -0
  64. package/components/PrintingSystem/subcomponents/ChartNode/index.d.ts +3 -0
  65. package/components/PrintingSystem/subcomponents/ChartNode/types.d.ts +3 -0
  66. package/components/PrintingSystem/subcomponents/DividerNode/index.d.ts +3 -0
  67. package/components/PrintingSystem/subcomponents/DividerNode/types.d.ts +3 -0
  68. package/components/PrintingSystem/subcomponents/FooterNode/index.d.ts +3 -0
  69. package/components/PrintingSystem/subcomponents/FooterNode/types.d.ts +5 -0
  70. package/components/PrintingSystem/subcomponents/GridNode/index.d.ts +3 -0
  71. package/components/PrintingSystem/subcomponents/GridNode/types.d.ts +5 -0
  72. package/components/PrintingSystem/subcomponents/HeaderNode/index.d.ts +3 -0
  73. package/components/PrintingSystem/subcomponents/HeaderNode/types.d.ts +5 -0
  74. package/components/PrintingSystem/subcomponents/ImageNode/index.d.ts +3 -0
  75. package/components/PrintingSystem/subcomponents/ImageNode/types.d.ts +3 -0
  76. package/components/PrintingSystem/subcomponents/PageNode/index.d.ts +3 -0
  77. package/components/PrintingSystem/subcomponents/PageNode/types.d.ts +5 -0
  78. package/components/PrintingSystem/subcomponents/Pager/index.d.ts +3 -0
  79. package/components/PrintingSystem/subcomponents/Pager/types.d.ts +5 -0
  80. package/components/PrintingSystem/subcomponents/PaperNode/index.d.ts +3 -0
  81. package/components/PrintingSystem/subcomponents/PaperNode/types.d.ts +5 -0
  82. package/components/PrintingSystem/subcomponents/PropertyValueNode/index.d.ts +3 -0
  83. package/components/PrintingSystem/subcomponents/PropertyValueNode/types.d.ts +5 -0
  84. package/components/PrintingSystem/subcomponents/SectionNode/index.d.ts +3 -0
  85. package/components/PrintingSystem/subcomponents/SectionNode/types.d.ts +5 -0
  86. package/components/PrintingSystem/subcomponents/TextBoxNode/index.d.ts +3 -0
  87. package/components/PrintingSystem/subcomponents/TextBoxNode/types.d.ts +3 -0
  88. package/components/PrintingSystem/types.d.ts +214 -0
  89. package/components/PrintingSystem/utils/FactoryRender/index.d.ts +3 -0
  90. package/components/PrintingSystem/utils/FactoryRender/types.d.ts +4 -0
  91. package/components/PrintingSystem/utils/PageRender/index.d.ts +3 -0
  92. package/components/PrintingSystem/utils/PageRender/types.d.ts +13 -0
  93. package/components/PrintingSystem/utils/getEvalValue/index.d.ts +1 -0
  94. package/components/PrintingSystem/utils/getSize/index.d.ts +1 -0
  95. package/components/PropertyValue/classes/index.d.ts +3 -2
  96. package/components/PropertyValue/classes/types.d.ts +2 -0
  97. package/components/PropertyValue/{index.3ee94e0f.js → index.3ee95452.js} +25 -9
  98. package/components/PropertyValue/types.d.ts +4 -0
  99. package/components/Resizeable/{index.676c96fe.js → index.8c53c1fa.js} +1 -1
  100. package/components/SideBar/{index.2dfc5445.js → index.5fd648d2.js} +44 -39
  101. package/components/animate/{index.4e9774a6.js → index.5d4575bc.js} +2 -6
  102. package/components/areas/components/AreasAdmin/{index.98a54515.js → index.ddb384a1.js} +29 -62
  103. package/components/areas/components/AreasViewer/classes/index.d.ts +1 -1
  104. package/components/areas/components/AreasViewer/classes/types.d.ts +2 -8
  105. package/components/areas/components/AreasViewer/{index.ee7170bc.js → index.625bf23b.js} +70 -438
  106. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/index.d.ts +2 -2
  107. package/components/areas/components/index.558684b3.js +1 -0
  108. package/components/areas/components/index.d.ts +0 -1
  109. package/components/areas/contexts/AreasContext/helper.d.ts +14 -1
  110. package/components/areas/contexts/AreasContext/{index.1950eef9.js → index.646f3c8f.js} +16 -12
  111. package/components/areas/contexts/index.24025b97.js +1 -0
  112. package/components/areas/contexts/index.d.ts +1 -0
  113. package/components/areas/hooks/index.d9dc1e21.js +1 -0
  114. package/components/areas/hooks/useAreas/{index.ce75bfb5.js → index.ee66240b.js} +1 -1
  115. package/components/areas/index.4cc6a221.js +22 -0
  116. package/components/areas/index.d.ts +1 -1
  117. package/components/formatters/BooleanFormatter/{index.a013b080.js → index.3c2df7a8.js} +10 -4
  118. package/components/formatters/FormatterRoot/index.d.ts +3 -0
  119. package/components/formatters/FormatterRoot/types.d.ts +4 -0
  120. package/components/formatters/classes/index.d.ts +4 -0
  121. package/components/formatters/classes/types.d.ts +6 -0
  122. package/components/formatters/constants.d.ts +1 -0
  123. package/components/formatters/{index.576922c9.js → index.dc77adb7.js} +25 -8
  124. package/components/hook-form/RHFAutocomplete/{index.8e4ff8d7.js → index.52387f0f.js} +7 -22
  125. package/components/hook-form/RHFAutocompleteAsync/{index.78f8e4c4.js → index.638bd2ae.js} +3 -2
  126. package/components/hook-form/RHFCheckbox/{index.bdad2059.js → index.a38715e3.js} +2 -22
  127. package/components/hook-form/RHFDateTime/{index.73f8a11e.js → index.66e334b0.js} +23 -23
  128. package/components/hook-form/RHFPeriod/{index.71df31df.js → index.23099265.js} +2 -2
  129. package/components/hook-form/RHFTextField/{index.6d21060a.js → index.25b3627e.js} +6 -8
  130. package/components/hook-form/RHFUpload/{index.f04d24ee.js → index.65588e08.js} +5 -22
  131. package/components/index.d.ts +3 -0
  132. package/components/modal/{WindowBase.b9dd76a4.js → WindowBase.161ec78a.js} +5 -37
  133. package/components/modal/{WindowConfirm.d407f47a.js → WindowConfirm.7eed7c35.js} +8 -40
  134. package/components/modal/{index.764e2723.js → index.61389369.js} +0 -37
  135. package/components/mui_extended/Accordion/{index.a706b12f.js → index.92aae1a4.js} +4 -4
  136. package/components/mui_extended/Button/{index.f79eb74e.js → index.94fec33c.js} +3 -3
  137. package/components/mui_extended/{CheckBox.38abccd8.js → CheckBox.e662d20c.js} +1 -1
  138. package/components/mui_extended/IconButton/{index.76624519.js → index.53cd6388.js} +2 -2
  139. package/components/mui_extended/MenuActions/{index.570fbae0.js → index.dd9f65a2.js} +5 -19
  140. package/components/mui_extended/Pager/{index.ac2a21f0.js → index.de0bd62c.js} +2 -2
  141. package/components/mui_extended/Tab/{index.d0302c81.js → index.1fcabba2.js} +2 -2
  142. package/components/mui_extended/index.b606cd9d.js +1 -0
  143. package/contexts/ModalContext/{index.41fbf6bc.js → index.436c2938.js} +1 -1
  144. package/contexts/RHFormContext/classes/index.d.ts +1 -1
  145. package/hooks/useFormAddEdit/{index.0c6b6b68.js → index.3584a29f.js} +2 -26
  146. package/hooks/useModal/{index.71987a49.js → index.05d1821e.js} +1 -1
  147. package/index.js +199 -190
  148. package/node_modules.b55d04d9.js +15267 -0
  149. package/package.json +5 -1
  150. package/react-data-grid.d46d625e.js +2 -2
  151. package/react-draggable.e4725f3a.js +630 -0
  152. package/{react-resizable.ba08699a.js → react-resizable.c07d63fb.js} +2 -2
  153. package/utils/{index.c43a95f4.js → index.6469f148.js} +75 -107
  154. package/vendor.71883626.js +104 -0
  155. package/components/Page/index.4237c241.js +0 -27
  156. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/subcomponents/MFLoader/types.d.ts +0 -8
  157. package/components/areas/components/AreasViewer/subcomponents/AreasLoadingError/index.d.ts +0 -3
  158. package/components/areas/components/AreasViewer/subcomponents/AreasLoadingError/types.d.ts +0 -5
  159. package/components/areas/components/index.431c5397.js +0 -31
  160. package/components/areas/contexts/index.b846bbcb.js +0 -2
  161. package/components/areas/hooks/index.0184c6f7.js +0 -4
  162. package/components/areas/index.5abba006.js +0 -54
  163. package/components/mui_extended/index.a8d347a9.js +0 -24
  164. package/node_modules.d73a220d.js +0 -363
  165. package/react-draggable.7abb5d0a.js +0 -962
  166. package/vendor.4dedf99e.js +0 -128
  167. package/components/{areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/subcomponents/MFLoader/index.d.ts → MFLoader/MFLoader.d.ts} +0 -0
  168. package/components/{areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/subcomponents/MFLoader → MFLoader}/helper.d.ts +0 -0
  169. package/components/{areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/subcomponents/MFLoader → MFLoader}/subcomponents/ProggessLoadingMF/index.d.ts +0 -0
  170. package/components/{areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/subcomponents/MFLoader → MFLoader}/subcomponents/ProggessLoadingMF/types.d.ts +0 -0
  171. package/components/mui_extended/Badge/{index.b09524fe.js → index.09f5aee5.js} +1 -1
  172. package/components/mui_extended/Popover/{index.9f35d0eb.js → index.b3eca6b1.js} +2 -2
  173. package/components/mui_extended/Tooltip/{index.5a795dcd.js → index.24a2bc3f.js} +1 -1
  174. package/components/mui_extended/Typography/{index.443590d6.js → index.379dd374.js} +1 -1
@@ -1,10 +1,11 @@
1
- import { useBase, useModuleSkeleton, BaseProvider } from "@m4l/core";
1
+ import { useBase, useModuleSkeleton, BaseProvider, useEnvironment } from "@m4l/core";
2
2
  import { forwardRef, useState, useRef, useImperativeHandle, useEffect, useMemo } from "react";
3
3
  import { T as TEST_PROP_ID } from "../../test/constants_no_mock.86c553a9.js";
4
4
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
5
5
  import { styled, Skeleton as Skeleton$1, generateUtilityClasses, generateUtilityClass } from "@mui/material";
6
- import clsx from "clsx";
7
6
  import { unstable_composeClasses } from "@mui/base";
7
+ import clsx from "clsx";
8
+ import { g as getEvalValue, c as classes, a as getSize } from "../PrintingSystem/index.e18a2fa8.js";
8
9
  function isIntersectionObserverAvailable() {
9
10
  return typeof window !== "undefined" && "IntersectionObserver" in window && "IntersectionObserverEntry" in window;
10
11
  }
@@ -34,7 +35,7 @@ const BasicIntersectComponent = forwardRef((props, ref) => {
34
35
  threshold
35
36
  } = props;
36
37
  const {
37
- classes
38
+ classes: classes2
38
39
  } = useBase();
39
40
  const [observer] = useState(getObserver(threshold));
40
41
  const intersectComponentRef = useRef(null);
@@ -61,7 +62,7 @@ const BasicIntersectComponent = forwardRef((props, ref) => {
61
62
  styleProp.minHeight = height;
62
63
  }
63
64
  return /* @__PURE__ */ jsx("span", {
64
- className: classes.span,
65
+ className: classes2.span,
65
66
  ref: intersectComponentRef,
66
67
  style: styleProp,
67
68
  ...process.env.NODE_ENV !== "production" ? {
@@ -80,10 +81,10 @@ function LazyLoadComponent(props) {
80
81
  } = props;
81
82
  const [isVisible, setIsVisible] = useState(testingProps?.isVisible || !(useIntersectionObserver && isIntersectionObserverAvailable()));
82
83
  const {
83
- classes
84
+ classes: classes2
84
85
  } = useBase();
85
86
  return /* @__PURE__ */ jsx(WrapperLazyLoadComponent, {
86
- className: classes.lazyLoad,
87
+ className: classes2.lazyLoad,
87
88
  ...process.env.NODE_ENV !== "production" ? {
88
89
  [TEST_PROP_ID]: getNameDataTestId("lazyLoad")
89
90
  } : {},
@@ -117,10 +118,10 @@ const Skeleton = (props) => {
117
118
  height
118
119
  } = props;
119
120
  const {
120
- classes
121
+ classes: classes2
121
122
  } = useBase();
122
123
  return skeletonVariant === "image" ? /* @__PURE__ */ jsx(WrapperSkeletonImage, {
123
- className: classes.skeletonImage,
124
+ className: classes2.skeletonImage,
124
125
  ...process.env.NODE_ENV !== "production" ? {
125
126
  [TEST_PROP_ID]: getNameDataTestId("skeletonImage")
126
127
  } : {},
@@ -137,7 +138,7 @@ const Skeleton = (props) => {
137
138
  variant: "circular",
138
139
  width: "100%",
139
140
  height: "100%",
140
- className: classes.skeletonCircle,
141
+ className: classes2.skeletonCircle,
141
142
  ...process.env.NODE_ENV !== "production" ? {
142
143
  [TEST_PROP_ID]: getNameDataTestId("skeletonCircle")
143
144
  } : {}
@@ -267,10 +268,10 @@ function Image(props) {
267
268
  const ownerState = {
268
269
  isImageLoaded
269
270
  };
270
- const classes = useUtilityClasses(ownerState);
271
+ const classes2 = useUtilityClasses(ownerState);
271
272
  const lazyLoadComponent = useMemo(() => {
272
273
  return /* @__PURE__ */ jsx(ImageRoot, {
273
- className: clsx(classes.root, className),
274
+ className: clsx(classes2.root, className),
274
275
  ...process.env.NODE_ENV !== "production" ? {
275
276
  [TEST_PROP_ID]: getNameDataTestId("root")
276
277
  } : {},
@@ -299,7 +300,7 @@ function Image(props) {
299
300
  alt,
300
301
  src,
301
302
  onLoad,
302
- className: classes.img,
303
+ className: classes2.img,
303
304
  width: !width ? "100%" : ratioImage.width,
304
305
  height: !height ? "100%" : ratioImage.height,
305
306
  ...process.env.NODE_ENV !== "production" ? {
@@ -311,11 +312,39 @@ function Image(props) {
311
312
  }, [statusLoad, isSKeleton, src]);
312
313
  return /* @__PURE__ */ jsx(BaseProvider, {
313
314
  value: {
314
- classes
315
+ classes: classes2
315
316
  },
316
317
  children: lazyLoadComponent
317
318
  });
318
319
  }
320
+ const ImageNode = (props) => {
321
+ const {
322
+ className,
323
+ style,
324
+ src,
325
+ width = "100%",
326
+ height = "100%"
327
+ } = props;
328
+ const {
329
+ unitSize,
330
+ sourceData
331
+ } = useBase();
332
+ const {
333
+ host_static_assets,
334
+ environment_assets
335
+ } = useEnvironment();
336
+ const resourceImg = getEvalValue(sourceData, src);
337
+ return /* @__PURE__ */ jsx("img", {
338
+ src: `${host_static_assets}/${environment_assets}/${resourceImg}`,
339
+ className: clsx(classes.imageNodeRoot, className),
340
+ style: {
341
+ width: getSize(width, unitSize),
342
+ height: getSize(height, unitSize),
343
+ ...style
344
+ }
345
+ });
346
+ };
319
347
  export {
320
- Image as I
348
+ Image as I,
349
+ ImageNode as a
321
350
  };
@@ -1,30 +1,14 @@
1
1
  import { useState, useEffect } from "react";
2
2
  import { styled, generateUtilityClasses, generateUtilityClass, Stack, MenuItem } from "@mui/material";
3
- import { I as Image } from "../Image/index.c18ebf5a.js";
3
+ import { I as Image } from "../Image/index.611cd930.js";
4
4
  import { useLocales } from "@m4l/graphics";
5
+ import { I as ImageButton } from "../mui_extended/Button/index.94fec33c.js";
5
6
  import { useEnvironment, useNetwork } from "@m4l/core";
6
- import "../Icon/index.a70c4729.js";
7
+ import { unstable_composeClasses } from "@mui/base";
7
8
  import { T as TEST_PROP_ID } from "../../test/constants_no_mock.86c553a9.js";
8
- import "clsx";
9
9
  import { jsxs, jsx } from "react/jsx-runtime";
10
- import "../mui_extended/IconButton/index.76624519.js";
11
- import "../mui_extended/Accordion/index.a706b12f.js";
12
- import "../mui_extended/Typography/index.443590d6.js";
13
- import "../mui_extended/Avatar/index.75e6ed57.js";
14
- import "react-router-dom";
15
- import "@mui/material/Button";
16
- import { I as ImageButton } from "../mui_extended/Button/index.f79eb74e.js";
17
- import "../mui_extended/CheckBox.38abccd8.js";
18
10
  import { C as CircularProgress } from "../mui_extended/CircularProgress/index.ad569afd.js";
19
- import "../mui_extended/Badge/index.b09524fe.js";
20
- import "@mui/lab";
21
- import "../mui_extended/MenuActions/index.570fbae0.js";
22
- import { P as Popover } from "../mui_extended/Popover/index.9f35d0eb.js";
23
- import "../mui_extended/Stack/index.0e53197c.js";
24
- import "../mui_extended/Tab/index.d0302c81.js";
25
- import "../mui_extended/Pager/index.ac2a21f0.js";
26
- import "../mui_extended/Tooltip/index.5a795dcd.js";
27
- import { unstable_composeClasses } from "@mui/base";
11
+ import { P as Popover } from "../mui_extended/Popover/index.b3eca6b1.js";
28
12
  const LanguagePopoverRoot = styled("div")(({
29
13
  theme
30
14
  }) => ({
@@ -1,7 +1,7 @@
1
1
  import clsx from "clsx";
2
2
  import { generateUtilityClasses, styled } from "@mui/material";
3
3
  import { unstable_composeClasses } from "@mui/base";
4
- import { g as getComponentUtilityClass } from "../../utils/index.c43a95f4.js";
4
+ import { g as getComponentUtilityClass } from "../../utils/index.6469f148.js";
5
5
  import { T as TEST_PROP_ID } from "../../test/constants_no_mock.86c553a9.js";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  const LINEAR_PROGRESS_INDETERMINATE_CLASS_NAME = "M4LinearProgressIndeterminate";
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { AreasLoadingErrorProps } from './types';
3
+ export declare const LoadingError: (props: AreasLoadingErrorProps) => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const componentName = "M4LoadingError";
@@ -0,0 +1,14 @@
1
+ import { LoadingErrorClassesType } from './types';
2
+ export declare const loadingErrorClasses: LoadingErrorClassesType;
3
+ export declare function getLoadingErrorUtilityClass(slot: string): string;
4
+ export declare const loadingErrorUtilityClasses: () => {
5
+ root: string;
6
+ loadingErrorLoading: string;
7
+ loadingError: string;
8
+ loadingErrorIcon: string;
9
+ loadingErrorTitle: string;
10
+ loadingErrorDescription: string;
11
+ loadingErrorDivider: string;
12
+ loadingErrorTextAction: string;
13
+ titleDescription: string;
14
+ };
@@ -0,0 +1,14 @@
1
+ import { loadingErrorUtilityClasses } from ".";
2
+ export interface LoadingErrorClassesType {
3
+ root: string;
4
+ loadingErrorLoading: string;
5
+ loadingError: string;
6
+ loadingErrorIcon: string;
7
+ loadingErrorTitle: string;
8
+ loadingErrorDescription: string;
9
+ loadingErrorDivider: string;
10
+ loadingErrorTextAction: string;
11
+ titleDescription: string;
12
+ }
13
+ export declare type MFLoaderClassesKey = keyof LoadingErrorClassesType;
14
+ export declare type Classes = ReturnType<typeof loadingErrorUtilityClasses>;
@@ -0,0 +1 @@
1
+ export declare const getLoadingErrorComponentsDictionary: () => string[];
@@ -0,0 +1,106 @@
1
+ import { useEnvironment, useModuleDictionary } from "@m4l/core";
2
+ import { I as ICONS } from "../areas/icons.8266ccc8.js";
3
+ import { generateUtilityClasses, generateUtilityClass, styled } from "@mui/material";
4
+ import { unstable_composeClasses } from "@mui/base";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { L as LinearProgressIndeterminate } from "../LinearProgressIndeterminate/index.c46da124.js";
7
+ import { I as Icon } from "../Icon/index.3211023d.js";
8
+ import { T as Typography } from "../mui_extended/Typography/index.379dd374.js";
9
+ import { B as Button } from "../mui_extended/Button/index.94fec33c.js";
10
+ const componentName = "M4LoadingError";
11
+ generateUtilityClasses(componentName, [
12
+ "root",
13
+ "loadingErrorLoading",
14
+ "loadingError",
15
+ "loadingErrorIcon",
16
+ "loadingErrorTitle",
17
+ "loadingErrorDescription",
18
+ "loadingErrorDivider",
19
+ "loadingErrorTextAction",
20
+ "titleDescription"
21
+ ]);
22
+ function getLoadingErrorUtilityClass(slot) {
23
+ return generateUtilityClass(componentName, slot);
24
+ }
25
+ const loadingErrorUtilityClasses = () => {
26
+ const slots = {
27
+ root: ["root"],
28
+ loadingErrorLoading: ["loadingErrorLoading"],
29
+ loadingError: ["loadingError"],
30
+ loadingErrorIcon: ["loadingErrorIcon"],
31
+ loadingErrorTitle: ["loadingErrorTitle"],
32
+ loadingErrorDescription: ["loadingErrorDescription"],
33
+ loadingErrorDivider: ["loadingErrorDivider"],
34
+ loadingErrorTextAction: ["loadingErrorTextAction"],
35
+ titleDescription: ["titleDescription"]
36
+ };
37
+ const composedClasses = unstable_composeClasses(slots, getLoadingErrorUtilityClass, {});
38
+ return {
39
+ ...composedClasses
40
+ };
41
+ };
42
+ const LoadingErrorRoot = styled("div")(({ theme }) => ({
43
+ ...theme?.components?.M4LoadingError?.styleOverrides
44
+ }));
45
+ const LoadingError = (props) => {
46
+ const {
47
+ status,
48
+ action,
49
+ title,
50
+ description,
51
+ recommendation,
52
+ introMessage,
53
+ errorIcon
54
+ } = props;
55
+ const {
56
+ host_static_assets,
57
+ environment_assets
58
+ } = useEnvironment();
59
+ const {
60
+ getLabel
61
+ } = useModuleDictionary();
62
+ const classes = loadingErrorUtilityClasses();
63
+ return /* @__PURE__ */ jsx(LoadingErrorRoot, {
64
+ className: classes.root,
65
+ children: status !== "error" ? /* @__PURE__ */ jsx("div", {
66
+ className: classes.loadingErrorLoading,
67
+ children: /* @__PURE__ */ jsx(LinearProgressIndeterminate, {})
68
+ }) : /* @__PURE__ */ jsxs("div", {
69
+ className: classes.loadingError,
70
+ children: [/* @__PURE__ */ jsx(Icon, {
71
+ className: classes.loadingErrorIcon,
72
+ src: errorIcon ? errorIcon : `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.NAVIGATE_ERROR}`
73
+ }), /* @__PURE__ */ jsxs("div", {
74
+ className: classes.titleDescription,
75
+ children: [/* @__PURE__ */ jsx(Typography, {
76
+ variant: "h3",
77
+ skeletonWidth: "100px",
78
+ className: classes.loadingErrorTitle,
79
+ children: title ? title : getLabel("loading_error.label_error_title")
80
+ }), /* @__PURE__ */ jsx(Typography, {
81
+ variant: "subtitle",
82
+ skeletonWidth: "100px",
83
+ className: classes.loadingErrorDescription,
84
+ children: description ? description : getLabel("loading_error.label_error_description")
85
+ })]
86
+ }), /* @__PURE__ */ jsx("div", {
87
+ className: classes.loadingErrorDivider
88
+ }), /* @__PURE__ */ jsx(Typography, {
89
+ variant: "paragraph",
90
+ skeletonWidth: "100px",
91
+ className: classes.loadingErrorTextAction,
92
+ children: recommendation ? recommendation : getLabel("loading_error.label_error_recommendation")
93
+ }), /* @__PURE__ */ jsx(Button, {
94
+ onClick: action,
95
+ children: introMessage ? introMessage : getLabel("loading_error.label_error_intro")
96
+ })]
97
+ })
98
+ });
99
+ };
100
+ const getLoadingErrorComponentsDictionary = () => {
101
+ return ["loading_error"];
102
+ };
103
+ export {
104
+ LoadingError as L,
105
+ getLoadingErrorComponentsDictionary as g
106
+ };
@@ -0,0 +1,2 @@
1
+ export { LoadingError } from './LoadingError';
2
+ export { getLoadingErrorComponentsDictionary } from './dictionary';
@@ -0,0 +1,10 @@
1
+ import { AreaStatus, AreasStatus } from "../areas/contexts/AreasContext/types";
2
+ export interface AreasLoadingErrorProps {
3
+ status: AreasStatus | AreaStatus;
4
+ action: () => void;
5
+ title?: string;
6
+ description?: string;
7
+ recommendation?: string;
8
+ introMessage?: string;
9
+ errorIcon?: string;
10
+ }
@@ -0,0 +1 @@
1
+ export declare const componentName = "M4LMFLoader";
@@ -0,0 +1,7 @@
1
+ import { MFLoaderClassesType } from './types';
2
+ export declare const mfLoaderClasses: MFLoaderClassesType;
3
+ export declare function getMFLoaderUtilityClass(slot: string): string;
4
+ export declare const mfLoaderUtilityClasses: () => {
5
+ root: string;
6
+ containerLinearProgress: string;
7
+ };
@@ -0,0 +1,7 @@
1
+ import { mfLoaderUtilityClasses } from ".";
2
+ export interface MFLoaderClassesType {
3
+ root: string;
4
+ containerLinearProgress: string;
5
+ }
6
+ export declare type MFLoaderClassesKey = keyof MFLoaderClassesType;
7
+ export declare type Classes = ReturnType<typeof mfLoaderUtilityClasses>;
@@ -0,0 +1 @@
1
+ export declare function getMFLoaderComponentsDictionary(): string[];
@@ -0,0 +1,296 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { useState, useCallback, useEffect } from "react";
8
+ import { useNetwork, useEnvironment, useHostTools, axiosOperation } from "@m4l/core";
9
+ import { useHostTheme, useFormatter, useLocales, useFirstRender } from "@m4l/graphics";
10
+ import debounce from "lodash/debounce";
11
+ import { generateUtilityClasses, generateUtilityClass, styled } from "@mui/material";
12
+ import { unstable_composeClasses } from "@mui/base";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ import { L as LinearProgress } from "../mui_extended/LinearProgress/index.c92b9ba9.js";
15
+ import { L as LoadingError } from "../LoadingError/index.96bdc803.js";
16
+ const componentName = "M4LMFLoader";
17
+ const mfLoaderClasses = generateUtilityClasses(componentName, [
18
+ "root",
19
+ "containerLinearProgress"
20
+ ]);
21
+ function getMFLoaderUtilityClass(slot) {
22
+ return generateUtilityClass(componentName, slot);
23
+ }
24
+ const mfLoaderUtilityClasses = () => {
25
+ const slots = {
26
+ root: ["root"],
27
+ containerLinearProgress: ["containerLinearProgress"]
28
+ };
29
+ const composedClasses = unstable_composeClasses(slots, getMFLoaderUtilityClass, {});
30
+ return {
31
+ ...composedClasses
32
+ };
33
+ };
34
+ const ProggessLoadingMF = (props) => {
35
+ try {
36
+ const {
37
+ loadingProgress
38
+ } = props;
39
+ if (loadingProgress >= 0 && loadingProgress <= 100) {
40
+ return /* @__PURE__ */ jsx("div", {
41
+ className: mfLoaderClasses.containerLinearProgress,
42
+ children: /* @__PURE__ */ jsx(LinearProgress, {
43
+ variant: "determinate",
44
+ value: loadingProgress
45
+ })
46
+ });
47
+ }
48
+ } catch (error) {
49
+ }
50
+ return null;
51
+ };
52
+ class ObservableLoaderMF {
53
+ constructor(host, scriptId, networkOperation, isRemote) {
54
+ __publicField(this, "host");
55
+ __publicField(this, "isRemote");
56
+ __publicField(this, "eventStatus");
57
+ __publicField(this, "scriptId");
58
+ __publicField(this, "networkOperation");
59
+ __publicField(this, "subscribers");
60
+ this.host = host;
61
+ this.subscribers = [];
62
+ this.scriptId = scriptId;
63
+ this.networkOperation = networkOperation;
64
+ this.isRemote = isRemote;
65
+ this.eventStatus = "progress";
66
+ this.start = this.start.bind(this);
67
+ this.subscribe = this.subscribe.bind(this);
68
+ this.unsubscribe = this.unsubscribe.bind(this);
69
+ this.notify = this.notify.bind(this);
70
+ this.tryAgain = this.tryAgain.bind(this);
71
+ setTimeout(this.start, 100);
72
+ }
73
+ tryAgain() {
74
+ if (this.eventStatus === "error") {
75
+ setTimeout(this.start, 100);
76
+ new Promise((resolve) => {
77
+ resolve("ok");
78
+ }).then(() => {
79
+ this.start();
80
+ });
81
+ }
82
+ }
83
+ async start() {
84
+ let percentCompleted = 0;
85
+ this.notify("progress", percentCompleted);
86
+ const manifest = await fetch(`${this.host}/manifest.json?rnd=${Math.random()}`).then((res) => res.json()).catch(() => {
87
+ setTimeout(() => this.notify("error", 0), 300);
88
+ return void 0;
89
+ });
90
+ if (!manifest) {
91
+ return;
92
+ }
93
+ percentCompleted = 10;
94
+ this.notify("progress", percentCompleted);
95
+ const urlFile = `${this.host}/${manifest["src/index.tsx"]["file"]}?rnd=${Math.random()}`;
96
+ const controller = new AbortController();
97
+ const ret = await this.networkOperation({
98
+ method: "GET",
99
+ endPoint: urlFile,
100
+ isRemote: this.isRemote,
101
+ headers: { "Content-Type": "application/json" },
102
+ onDownloadProgress: (progressEvent) => {
103
+ try {
104
+ if (progressEvent.lengthComputable) {
105
+ percentCompleted = 10 + Math.round(progressEvent.loaded * 90 / progressEvent.total);
106
+ } else {
107
+ percentCompleted = 10 + progressEvent.loaded / 15e5 * 90;
108
+ if (percentCompleted > 95)
109
+ percentCompleted = 95;
110
+ }
111
+ } catch (error) {
112
+ }
113
+ this.notify("progress", percentCompleted);
114
+ },
115
+ isExternalUrl: true,
116
+ responseType: "text",
117
+ signal: controller.signal
118
+ }).then(() => {
119
+ return "ok";
120
+ }).catch(() => {
121
+ this.notify("error", 0);
122
+ return "error";
123
+ });
124
+ if (ret == "ok") {
125
+ const script = document.createElement("script");
126
+ const startTime = new Date().getTime();
127
+ script.id = this.scriptId;
128
+ script.crossOrigin = "";
129
+ script.type = "module";
130
+ script.src = urlFile || "";
131
+ script.onload = () => {
132
+ this.notify("complete", 100);
133
+ };
134
+ document.head.appendChild(script);
135
+ console.debug("Script appened", startTime);
136
+ }
137
+ }
138
+ subscribe(subscriber) {
139
+ this.subscribers.push(subscriber);
140
+ this.tryAgain();
141
+ }
142
+ unsubscribe(subscriber) {
143
+ console.log("unsubscribe", subscriber);
144
+ const index = this.subscribers.indexOf(subscriber);
145
+ if (index !== -1) {
146
+ this.subscribers.splice(index, 1);
147
+ }
148
+ }
149
+ notify(newEvent, progress) {
150
+ this.eventStatus = newEvent;
151
+ this.subscribers.forEach((subscriber) => {
152
+ setTimeout(() => subscriber(newEvent, progress), 1);
153
+ });
154
+ }
155
+ }
156
+ const MFLoaderRoot = styled("div")(({ theme }) => ({
157
+ ...theme.components?.M4LMFLoader?.styleOverrides
158
+ }));
159
+ function getDivScritId(prefix, moduleId) {
160
+ const rotational_id = `${Math.round(new Date().getTime() / 1e3)}_rnd_${Math.round(Math.random() * 1e3)}`;
161
+ return {
162
+ divContainerId: `container_${prefix}_${moduleId}_${rotational_id}`,
163
+ scriptId: `script_${moduleId}_${rotational_id}`,
164
+ moduleId
165
+ };
166
+ }
167
+ function MFLoader(props) {
168
+ const {
169
+ prefix,
170
+ moduleId,
171
+ cache = true,
172
+ debug_port,
173
+ dynamicMFStore,
174
+ windowTools
175
+ } = props;
176
+ const {
177
+ hostThemeOptions,
178
+ fnComponentsOverrides
179
+ } = useHostTheme();
180
+ const {
181
+ networkOperation
182
+ } = useNetwork();
183
+ const environment = useEnvironment();
184
+ const hostTools = useHostTools();
185
+ const formatter = useFormatter();
186
+ const [statusLoader, setStatusLoader] = useState("progress");
187
+ const [loadingProgress, setLoadingProgress] = useState(-1);
188
+ const [divScript, setDivScript] = useState(getDivScritId(prefix, moduleId));
189
+ const {
190
+ currentLocale
191
+ } = useLocales();
192
+ console.log("divScript", divScript);
193
+ const classes = mfLoaderUtilityClasses();
194
+ const isFirstRender = useFirstRender([moduleId]);
195
+ const final_host = environment.isLocalhost ? `https://localhost:${debug_port}` : `https://${window.location.host}/mf/${moduleId}`;
196
+ function cleanUp(dScript) {
197
+ try {
198
+ if (window[`unmount_${prefix}_${dScript.moduleId}`]) {
199
+ window[`unmount_${prefix}_${dScript.moduleId}`](dScript.divContainerId);
200
+ }
201
+ } catch (error) {
202
+ }
203
+ if (!cache) {
204
+ const script = document.getElementById(dScript.scriptId);
205
+ if (script) {
206
+ try {
207
+ document.head.removeChild(script);
208
+ delete window[`render_${prefix}_${dScript.moduleId}`];
209
+ delete window[`unmount_${prefix}_${dScript.moduleId}`];
210
+ } catch (error) {
211
+ }
212
+ }
213
+ }
214
+ }
215
+ const renderMicroFrontend = useCallback((newDScript) => {
216
+ console.log("`render_${prefix}_${newDScript.moduleId}`", `render_${prefix}_${newDScript.moduleId}`);
217
+ try {
218
+ window[`render_${prefix}_${newDScript.moduleId}`](newDScript.divContainerId, environment, hostTools, currentLocale, {
219
+ hostThemeOptions,
220
+ fnComponentsOverrides
221
+ }, axiosOperation, formatter, dynamicMFStore, windowTools);
222
+ } catch (error) {
223
+ }
224
+ }, [hostThemeOptions, currentLocale, formatter]);
225
+ const debouncedSetDivScript = useCallback(debounce((newName) => {
226
+ const newDivScript = getDivScritId(prefix, newName);
227
+ if (newName !== divScript.moduleId) {
228
+ setDivScript({
229
+ ...newDivScript
230
+ });
231
+ }
232
+ }, 200), [divScript]);
233
+ useEffect(() => {
234
+ if (!isFirstRender) {
235
+ debouncedSetDivScript(moduleId + "");
236
+ if (moduleId !== divScript.moduleId)
237
+ ;
238
+ }
239
+ return () => {
240
+ };
241
+ }, [moduleId]);
242
+ const tryAgainOnError = useCallback(() => {
243
+ window[`observable_${prefix}_${moduleId}`]?.tryAgain();
244
+ }, []);
245
+ useEffect(() => {
246
+ const dsNowScript = {
247
+ ...divScript
248
+ };
249
+ const observableDownload = (event, progress) => {
250
+ setLoadingProgress(progress);
251
+ setStatusLoader(event);
252
+ };
253
+ if (!window[`render_${prefix}_${moduleId}`]) {
254
+ let observableLoaderMF;
255
+ if (!window[`observable_${prefix}_${moduleId}`]) {
256
+ observableLoaderMF = new ObservableLoaderMF(final_host, dsNowScript.scriptId, networkOperation, !environment.isLocalhost);
257
+ window[`observable_${prefix}_${moduleId}`] = observableLoaderMF;
258
+ } else {
259
+ observableLoaderMF = window[`observable_${prefix}_${moduleId}`];
260
+ }
261
+ observableLoaderMF.subscribe(observableDownload);
262
+ } else {
263
+ setStatusLoader("complete");
264
+ }
265
+ return () => {
266
+ window[`observable_${prefix}_${moduleId}`].unsubscribe(observableDownload);
267
+ cleanUp(dsNowScript);
268
+ };
269
+ }, [divScript]);
270
+ useEffect(() => {
271
+ if (statusLoader === "complete") {
272
+ renderMicroFrontend(divScript);
273
+ }
274
+ }, [statusLoader]);
275
+ return /* @__PURE__ */ jsxs(MFLoaderRoot, {
276
+ id: divScript.divContainerId,
277
+ className: classes.root,
278
+ children: [statusLoader === "progress" ? /* @__PURE__ */ jsx(ProggessLoadingMF, {
279
+ loadingProgress
280
+ }) : null, statusLoader === "error" ? /* @__PURE__ */ jsx(LoadingError, {
281
+ status: statusLoader,
282
+ action: tryAgainOnError
283
+ }) : null]
284
+ });
285
+ }
286
+ MFLoader.defaultProps = {
287
+ document,
288
+ window
289
+ };
290
+ function getMFLoaderComponentsDictionary() {
291
+ return ["mf_loader"];
292
+ }
293
+ export {
294
+ MFLoader as M,
295
+ getMFLoaderComponentsDictionary as g
296
+ };
@@ -0,0 +1,2 @@
1
+ export { MFLoader } from './MFLoader';
2
+ export { getMFLoaderComponentsDictionary } from './dictionary';
@@ -0,0 +1,7 @@
1
+ import { DynamicMFStore, WindowToolsMF } from "../areas";
2
+ import { MFBaseProps } from "../areas/types";
3
+ export interface MFLoaderProps extends MFBaseProps {
4
+ moduleId: string;
5
+ dynamicMFStore?: DynamicMFStore;
6
+ windowTools: WindowToolsMF;
7
+ }