@m4l/components 1.0.11 → 1.0.13

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 (144) hide show
  1. package/components/AccountPopover/{index.62b1290b.js → index.f22ad364.js} +4 -4
  2. package/components/AppBar/{index.b48343d8.js → index.8d90ce87.js} +4 -4
  3. package/components/CommonActions/components/ActionCancel/index.609a78ca.js +12 -0
  4. package/components/CommonActions/components/ActionFormCancel/index.a1318eac.js +56 -0
  5. package/components/CommonActions/components/ActionFormIntro/index.34d569d1.js +33 -0
  6. package/components/CommonActions/components/ActionIntro/index.ebac0bc1.js +25 -0
  7. package/components/CommonActions/components/Actions/index.258bf919.js +71 -0
  8. package/components/DataGrid/constants.e334cd50.js +10 -0
  9. package/components/DataGrid/formatters/ColumnBooleanFormatter/index.7fb1ebaa.js +26 -0
  10. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.0ee10612.js +22 -0
  11. package/components/DataGrid/formatters/ColumnDateFormatter/index.e00d0cf2.js +19 -0
  12. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.dce9ada8.js +23 -0
  13. package/components/DataGrid/formatters/ColumnNestedValueFormatter/index.880e743b.js +14 -0
  14. package/components/DataGrid/formatters/ColumnPointsFormatter/index.226cc583.js +10 -0
  15. package/components/DataGrid/formatters/ColumnPriceFormatter/index.bf9d9e60.js +10 -0
  16. package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.4045b2f2.js +36 -0
  17. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index.a87302d1.js +10 -0
  18. package/components/DataGrid/formatters/index.2c2f0ae4.js +1 -0
  19. package/components/DataGrid/index.68e19254.js +915 -0
  20. package/components/DataGrid/subcomponents/Actions/index.6b044e84.js +596 -0
  21. package/components/DataGrid/subcomponents/editors/TextEditor/index.3f0d9e28.js +76 -0
  22. package/components/DragResizeWindow/{index.8b3e79f7.js → index.a358789f.js} +6 -3
  23. package/components/DynamicFilter/constants.1dddd09c.js +31 -0
  24. package/components/DynamicFilter/dictionary.d28d39ef.js +51 -0
  25. package/components/DynamicFilter/helpers/{index.609b3915.js → index.11ed2896.js} +4 -4
  26. package/components/DynamicFilter/{index.0f04f223.js → index.056a99c7.js} +3 -3
  27. package/components/DynamicFilter/slots/{index.00b68384.js → index.82d7eaf2.js} +31 -31
  28. package/components/DynamicFilter/store/{index.85a2812f.js → index.9b5121d6.js} +2 -2
  29. package/components/DynamicFilter/subcomponents/{index.86c6fda2.js → index.778c93cc.js} +217 -15
  30. package/components/FieldLabel/{index.1577ac9c.js → index.6b6f708e.js} +4 -4
  31. package/components/GridLayout/{index.656840a5.js → index.68d907d4.js} +34 -11
  32. package/components/GridLayout/subcomponents/Griditem/{index.b23625d7.js → index.8955a794.js} +3 -4
  33. package/components/GridLayout/subcomponents/Responsive/{index.97505a31.js → index.45cecca2.js} +1 -2
  34. package/components/GridLayout/subcomponents/SizeProvider/{index.36cb4139.js → index.7050ac4f.js} +1 -1
  35. package/components/HelperText/{index.ebb53dac.js → index.09e80920.js} +1 -1
  36. package/components/Icon/{index.8ecfb193.js → index.83867398.js} +10 -26
  37. package/components/Image/{index.4a822ede.js → index.19aa7ff5.js} +3 -2
  38. package/components/LanguagePopover/index.921efd11.js +188 -0
  39. package/components/{mui_extended/LinearProgress/index.e9455b2e.js → LinearProgressIndeterminate/index.ea9c8518.js} +4 -9
  40. package/components/LoadingError/{index.9e829e8d.js → index.aee18b24.js} +11 -7
  41. package/components/MFLoader/{index.29f445e2.js → index.c975666e.js} +8 -4
  42. package/components/ModalDialog/{index.96c4aba3.js → index.0dd5af28.js} +14 -5
  43. package/components/NavLink/{index.9f5d5670.js → index.ad039baf.js} +3 -2
  44. package/components/NoItemSelected/{index.0ae9f28f.js → index.d10603d7.js} +13 -3
  45. package/components/ObjectLogs/{index.40c5047f.js → index.a3e42b21.js} +26 -8
  46. package/components/PDFViewer/{index.651cc4b6.js → index.35f68e67.js} +2 -2
  47. package/components/Page/{index.1d08818c.js → index.f4755eba.js} +18 -2
  48. package/components/PaperForm/{index.1a8b10d4.js → index.007ef4cf.js} +2 -2
  49. package/components/Period/{index.236971ae.js → index.9647181b.js} +15 -54
  50. package/components/PrintingSystem/{index.9fdae551.js → index.a69a9d85.js} +14 -15
  51. package/components/PrintingSystem/subcomponents/BodyNode/{index.794dbc69.js → index.528fcfbf.js} +1 -1
  52. package/components/PrintingSystem/subcomponents/ChartNode/{index.6bbf7d75.js → index.fbe87257.js} +1 -1
  53. package/components/PrintingSystem/subcomponents/DividerNode/{index.015a2212.js → index.f5adab1d.js} +1 -1
  54. package/components/PrintingSystem/subcomponents/FooterNode/{index.08eeb1d2.js → index.f42ca7dc.js} +1 -1
  55. package/components/PrintingSystem/subcomponents/GridNode/{index.23995699.js → index.041b9cff.js} +1 -1
  56. package/components/PrintingSystem/subcomponents/HeaderNode/{index.3fa36620.js → index.a8140332.js} +1 -1
  57. package/components/PrintingSystem/subcomponents/PaperNode/{index.8b7d43f4.js → index.aabde2bb.js} +1 -1
  58. package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.9856c572.js → index.7f75ca46.js} +1 -1
  59. package/components/PrintingSystem/subcomponents/SectionNode/{index.89b3a4e0.js → index.61babb47.js} +1 -1
  60. package/components/PrintingSystem/subcomponents/TextBoxNode/{index.dc6e9dc2.js → index.4d0e67a3.js} +1 -1
  61. package/components/PropertyValue/{index.646a7e8b.js → index.51faabb5.js} +7 -4
  62. package/components/Resizeable/{index.414ff687.js → index.4f75c0b5.js} +1 -1
  63. package/components/ScrollBar/{index.1e89bb44.js → index.21bc5025.js} +1 -1
  64. package/components/SideBar/{index.d221254d.js → index.4075c562.js} +36 -7
  65. package/components/SplitLayout/{index.7d9edf4e.js → index.15756f0f.js} +3 -1
  66. package/components/ToastContainer/{index.7f246bbd.js → index.2a7d304e.js} +3 -3
  67. package/components/animate/variants/index.7a912140.js +1 -0
  68. package/components/areas/components/AreasAdmin/index.325bac22.js +733 -0
  69. package/components/areas/components/AreasViewer/index.6e30ec72.js +1072 -0
  70. package/components/areas/components/index.558684b3.js +1 -0
  71. package/components/areas/constants.66529246.js +6 -0
  72. package/components/areas/contexts/AreasContext/{index.0815f278.js → index.3311cbf9.js} +6 -5
  73. package/components/areas/contexts/DynamicMFParmsContext/{index.37d1d444.js → index.3d9ad0ad.js} +2 -2
  74. package/components/areas/contexts/WindowToolsMFContext/{index.69d95c15.js → index.992ae7a3.js} +2 -2
  75. package/components/areas/contexts/index.24025b97.js +1 -0
  76. package/components/areas/dictionary.08cfc4c9.js +36 -0
  77. package/components/areas/hooks/index.d9dc1e21.js +1 -0
  78. package/components/areas/hooks/useAreas/{index.4039e30d.js → index.f81493ef.js} +1 -1
  79. package/components/areas/hooks/useDynamicMFParameters/{index.03ce6078.js → index.9e09e1e3.js} +1 -1
  80. package/components/areas/hooks/useWindowToolsMF/{index.09801b66.js → index.2fbae9dc.js} +1 -1
  81. package/components/areas/icons.8266ccc8.js +26 -0
  82. package/components/areas/index.4cc6a221.js +22 -0
  83. package/components/commercial/AppBarCommercial/index.cbd55cf8.js +28 -0
  84. package/components/commercial/SectionCommercial/index.d22ebbd5.js +57 -0
  85. package/components/commercial/TopBar/index.410fffa8.js +234 -0
  86. package/components/{HamburgerMenu/index.6c82741d.js → commercial/index.07638f52.js} +5 -3
  87. package/components/formatters/BooleanFormatter/index.cbf9cd6e.js +44 -0
  88. package/components/formatters/DateFormatter/index.2ef6f261.js +43 -0
  89. package/components/formatters/PointsFormatter/index.d8a4ee54.js +25 -0
  90. package/components/formatters/PriceFormatter/index.97f75b4b.js +35 -0
  91. package/components/formatters/UncertaintyFormatter/index.c3ffdebc.js +29 -0
  92. package/components/formatters/index.63a3e08e.js +117 -0
  93. package/components/hook-form/HelperError/{index.2ed03a3c.js → index.c0109d5b.js} +1 -1
  94. package/components/hook-form/RHFAutocomplete/index.2991d444.js +404 -0
  95. package/components/hook-form/RHFAutocompleteAsync/{index.69f5661d.js → index.d97c727b.js} +2 -3
  96. package/components/hook-form/RHFCheckbox/{index.13de27db.js → index.b57e3131.js} +4 -4
  97. package/components/hook-form/RHFColorPicker/{index.66004599.js → index.310f6ff0.js} +6 -6
  98. package/components/hook-form/RHFDateTime/{index.dfe07e18.js → index.5689a29f.js} +5 -5
  99. package/components/hook-form/RHFPeriod/{index.d852649b.js → index.019e61ae.js} +4 -4
  100. package/components/hook-form/RHFTextField/{index.d207efc1.js → index.10e57945.js} +6 -6
  101. package/components/hook-form/RHFUpload/{index.955a4ba5.js → index.7fd23b2a.js} +5 -5
  102. package/components/{mui_extended/Tab/index.37d588d6.js → maps/components/GpsTools/index.20f83559.js} +331 -645
  103. package/components/maps/{index.a1bf63f2.js → components/Map/index.c37f3304.js} +737 -28
  104. package/components/maps/index.13bb982c.js +7 -0
  105. package/components/modal/{WindowBase.390b0910.js → WindowBase.cfbb0c9e.js} +4 -4
  106. package/components/modal/{WindowConfirm.243e1bef.js → WindowConfirm.300bd34b.js} +10 -6
  107. package/components/modal/{index.5bce430d.js → index.81eb6def.js} +5 -1
  108. package/components/mui_extended/Accordion/{index.f7a17c83.js → index.0843a609.js} +5 -5
  109. package/components/mui_extended/Avatar/{index.12b96914.js → index.fb9ad158.js} +1 -1
  110. package/components/mui_extended/Badge/{index.4737c113.js → index.8beaeefc.js} +1 -1
  111. package/components/mui_extended/Button/{index.52852c42.js → index.d742e9ee.js} +6 -81
  112. package/components/mui_extended/{CheckBox/index.01218423.js → CheckBox.21c25705.js} +1 -1
  113. package/components/mui_extended/IconButton/{index.d5b273e6.js → index.b4532b85.js} +1 -1
  114. package/components/mui_extended/LinearProgress/index.4092bb69.js +9 -0
  115. package/components/mui_extended/MenuActions/index.eae97857.js +176 -0
  116. package/components/mui_extended/Pager/{index.8960227c.js → index.3926c835.js} +22 -40
  117. package/components/mui_extended/Popover/index.2348fc4f.js +143 -0
  118. package/components/mui_extended/Tab/index.e911930f.js +135 -0
  119. package/components/mui_extended/ToggleButton/{index.c441b949.js → index.b834f5f0.js} +1 -1
  120. package/components/mui_extended/ToggleIconButton/{index.8a84f25e.js → index.fcd5205c.js} +1 -1
  121. package/components/mui_extended/Typography/{index.463f613f.js → index.642798f1.js} +1 -1
  122. package/components/mui_extended/index.b606cd9d.js +1 -0
  123. package/components/popups/PopupsProvider/{index.d4caacc3.js → index.d7c9efce.js} +1 -1
  124. package/components/popups/PopupsViewer/{index.42312806.js → index.f3677ab1.js} +10 -6
  125. package/contexts/ModalContext/{index.5f77a463.js → index.ad1fb73b.js} +1 -1
  126. package/contexts/RHFormContext/{index.95ebabc9.js → index.bf3a2812.js} +6 -2
  127. package/hooks/useFormAddEdit/{index.ecb77e67.js → index.6d983cd8.js} +6 -2
  128. package/hooks/useModal/index.2003c854.js +11 -0
  129. package/hooks/useTab/index.8d1a6e63.js +12 -0
  130. package/index.js +328 -273
  131. package/package.json +1 -1
  132. package/{react-draggable.0cc9b257.js → react-draggable.1c1ba224.js} +1 -1
  133. package/{react-resizable.837c446d.js → react-resizable.a59c14f4.js} +2 -2
  134. package/test/constants_no_mock.86c553a9.js +4 -0
  135. package/test/{getNameDataTestId.aee44365.js → getNameDataTestId.0faeade8.js} +2 -2
  136. package/utils/{index.c64c2dd1.js → index.14912462.js} +1 -54
  137. package/components/CommonActions/index.19f39dca.js +0 -170
  138. package/components/areas/constants.0d3ba950.js +0 -289
  139. package/components/areas/dictionary.6168209a.js +0 -266
  140. package/components/areas/icons.504ec098.js +0 -83
  141. package/components/maps/components/GpsTools/index.01acaf3e.js +0 -251
  142. package/components/mui_extended/Popover/index.146ded9e.js +0 -1044
  143. package/hooks/useModal/index.d14c7e46.js +0 -67
  144. package/vendor.5b266106.js +0 -3952
@@ -1,3952 +0,0 @@
1
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import React__default, { useState, useEffect, useMemo, useRef, createElement, createContext, useCallback, useContext, forwardRef, useImperativeHandle } from "react";
3
- import { useEnvironment, useModuleDictionary, useModuleSkeleton, getPropertyByString, evaluateWithContext, voidFunction } from "@m4l/core";
4
- import { S as SelectCellFormatter, D as DataGrid$1 } from "./react-data-grid.c5377916.js";
5
- import { I as IconButton$1 } from "./components/mui_extended/IconButton/index.d5b273e6.js";
6
- import { styled } from "@mui/material/styles";
7
- import { a as Table } from "./components/mui_extended/Tab/index.37d588d6.js";
8
- import { a as Pager } from "./components/mui_extended/Pager/index.8960227c.js";
9
- import { a as useModalSettings } from "./hooks/useModal/index.d14c7e46.js";
10
- import { generateUtilityClasses, IconButton, generateUtilityClass, useTheme, MenuItem, Skeleton, Autocomplete, Popper, TextField, Chip, styled as styled$1, Dialog, Checkbox, Box, Grid } from "@mui/material";
11
- import { P as Popover } from "./components/mui_extended/Popover/index.146ded9e.js";
12
- import { I as Icon, a as ArrowIcon } from "./components/Icon/index.8ecfb193.js";
13
- import { a as ICONS, I as ICONS$1 } from "./components/areas/icons.504ec098.js";
14
- import clsx from "clsx";
15
- import { unstable_composeClasses } from "@mui/base";
16
- import { ai as AREAS_VIEWER_CLASS_NAME, aj as AREAS_ADMIN_CLASS_NAME, ak as componentName$1, T as TEST_PROP_ID, al as RHFTAUTOCOMPLET_ROOT_TEST_ID, am as COMPONENT_CLASS_NAME, an as componentName$2, ao as DATAGRID_PREFIX_NAME, ap as componentName$3, aq as componentName$4, ar as componentName$5 } from "./components/areas/constants.0d3ba950.js";
17
- import { B as Badge } from "./components/mui_extended/Badge/index.4737c113.js";
18
- import { useResponsiveDesktop, useFormatter, useResponsiveContainerStore } from "@m4l/graphics";
19
- import { b as getAreasDictionary, c as DICCTIONARY, L as LABEL_BOOLEAN_YES, h as LABEL_BOOLEAN_NO, i as LABEL_BOOLEAN_TRUE, j as LABEL_BOOLEAN_FALSE, k as dictionary } from "./components/areas/dictionary.6168209a.js";
20
- import { shallow } from "zustand/shallow";
21
- import { a as getNameDataTestId$1 } from "./test/getNameDataTestId.aee44365.js";
22
- import { g as getComponentUtilityClass, a as getNameDataTestId, b as useOnClickOutside, e as isActive } from "./utils/index.c64c2dd1.js";
23
- import "./components/NavLink/index.9f5d5670.js";
24
- import "./components/ScrollToTop/index.e06f98f6.js";
25
- import "./components/animate/index.b8497385.js";
26
- import "./components/animate/MotionContainer/index.3032bd8f.js";
27
- import "./components/animate/MotionLazyContainer/index.d2902a6c.js";
28
- import "./components/animate/LoadingScreen/index.779690a7.js";
29
- import "./components/animate/PropagateLoader/index.a9da8d00.js";
30
- import "./components/animate/variants/fade.b561c0fc.js";
31
- import "./components/animate/variants/bounce.784aaaaa.js";
32
- import "./components/animate/variants/container.11f82b76.js";
33
- import "./components/animate/variants/transition.bd46b9ce.js";
34
- import { u as useAreasStore } from "./components/areas/hooks/useAreas/index.4039e30d.js";
35
- import * as Yup from "yup";
36
- import { R as RHFormProvider } from "./contexts/RHFormContext/index.95ebabc9.js";
37
- import { R as RHFTextField } from "./components/hook-form/RHFTextField/index.d207efc1.js";
38
- import { A as Actions$1, a as ActionCancel, b as ActionIntro } from "./components/CommonActions/index.19f39dca.js";
39
- import { T as Typography } from "./components/mui_extended/Typography/index.463f613f.js";
40
- import { S as ScrollBar } from "./components/ScrollBar/index.1e89bb44.js";
41
- import TouchRipple from "@mui/material/ButtonBase/TouchRipple";
42
- import { B as Button } from "./components/mui_extended/Button/index.52852c42.js";
43
- import { L as LinearProgressIndeterminate, a as LinearProgress } from "./components/mui_extended/LinearProgress/index.e9455b2e.js";
44
- import { M as MFLoader } from "./components/MFLoader/index.29f445e2.js";
45
- import { a as WindowToolsMFProvider } from "./components/areas/contexts/WindowToolsMFContext/index.69d95c15.js";
46
- import { a as DynamicMFParmsProvider } from "./components/areas/contexts/DynamicMFParmsContext/index.37d1d444.js";
47
- import { R as RESPONSIVE_COLAPSED_HEIGHTS, a as RESPONSIVE_ROW_HEIGHTS, M as MARGIN_GRIDLAYOUT, P as PADDING_GRIDLAYOUT } from "./components/areas/contexts/AreasContext/index.0815f278.js";
48
- import { w as withSizeProvider } from "./components/GridLayout/subcomponents/SizeProvider/index.36cb4139.js";
49
- import { R as Responsive } from "./components/GridLayout/subcomponents/Responsive/index.97505a31.js";
50
- import { useLocation } from "react-router-dom";
51
- import { L as LoadingError } from "./components/LoadingError/index.9e829e8d.js";
52
- import { c as cjs } from "./react-draggable.0cc9b257.js";
53
- import { R as ResizeableWindow } from "./components/Resizeable/index.414ff687.js";
54
- import "./components/areas/hooks/useDynamicMFParameters/index.03ce6078.js";
55
- import "./components/areas/hooks/useWindowToolsMF/index.09801b66.js";
56
- import { useFormContext, Controller } from "react-hook-form";
57
- import { I as Image } from "./components/Image/index.4a822ede.js";
58
- import { H as HelperText } from "./components/HelperText/index.ebb53dac.js";
59
- import { F as FieldLabel } from "./components/FieldLabel/index.1577ac9c.js";
60
- import { C as CircularProgress } from "./components/mui_extended/CircularProgress/index.967e70b7.js";
61
- import "./components/hook-form/RHFAutocompleteAsync/index.69f5661d.js";
62
- import "./components/hook-form/RHFDateTime/index.dfe07e18.js";
63
- import "./components/hook-form/RHFMultiCheckbox/index.437e6ba3.js";
64
- import "./components/hook-form/RHFSelect/index.c6c60ecc.js";
65
- import "./components/hook-form/RHFPeriod/index.d852649b.js";
66
- import "./components/hook-form/RHFRadioGroup/index.11c0add8.js";
67
- import "./components/hook-form/RHFColorPicker/index.66004599.js";
68
- import "./components/hook-form/RHFCheckbox/index.13de27db.js";
69
- import "./components/hook-form/RHFUpload/index.955a4ba5.js";
70
- import { A as Accordion } from "./components/mui_extended/Accordion/index.f7a17c83.js";
71
- import "./components/mui_extended/Avatar/index.12b96914.js";
72
- import "./components/mui_extended/BoxIcon/index.d61e7ac5.js";
73
- import "./components/mui_extended/Breadcrumbs/index.4a44883c.js";
74
- import "./components/mui_extended/LinkWithRoute/index.288c51f3.js";
75
- import "./components/mui_extended/CheckBox/index.01218423.js";
76
- import { S as Stack } from "./components/mui_extended/Stack/index.fe363ca5.js";
77
- import "./components/mui_extended/Tooltip/index.49bb5ee1.js";
78
- import "./components/mui_extended/ToggleButton/index.c441b949.js";
79
- import "./components/mui_extended/ToggleIconButton/index.8a84f25e.js";
80
- import { W as WrapperComponent } from "./components/WrapperComponent/index.57964195.js";
81
- import "./components/Period/index.236971ae.js";
82
- import "./components/DynamicFilter/index.0f04f223.js";
83
- import "./components/DragResizeWindow/index.8b3e79f7.js";
84
- import "./components/GridLayout/index.656840a5.js";
85
- import "./components/PrintingSystem/index.9fdae551.js";
86
- import "./components/Loadable/index.e83cdb4e.js";
87
- import "./components/maps/index.a1bf63f2.js";
88
- import "./components/maps/components/GpsTools/index.01acaf3e.js";
89
- import "./components/ModalDialog/index.96c4aba3.js";
90
- import "./components/modal/WindowConfirm.243e1bef.js";
91
- import "./components/modal/WindowBase.390b0910.js";
92
- import "./components/NoItemSelected/index.0ae9f28f.js";
93
- import "./components/ObjectLogs/index.40c5047f.js";
94
- import "./components/PaperForm/index.1a8b10d4.js";
95
- import "./components/PDFViewer/index.651cc4b6.js";
96
- import "./components/Page/index.1d08818c.js";
97
- import "./components/PropertyValue/index.646a7e8b.js";
98
- import "./components/SplitLayout/index.7d9edf4e.js";
99
- import "./components/ToastContainer/index.7f246bbd.js";
100
- import "./components/SideBar/index.d221254d.js";
101
- import "./components/AppBar/index.b48343d8.js";
102
- import "./components/AccountPopover/index.62b1290b.js";
103
- import "./components/popups/PopupsProvider/index.d4caacc3.js";
104
- import "./components/popups/PopupsViewer/index.42312806.js";
105
- import "./components/HamburgerMenu/index.6c82741d.js";
106
- import "./contexts/ModalContext/index.5f77a463.js";
107
- import "./hooks/useFormAddEdit/index.ecb77e67.js";
108
- const areasViewerClasses = generateUtilityClasses(
109
- AREAS_VIEWER_CLASS_NAME,
110
- [
111
- "root",
112
- "areaRoot",
113
- "areaGridLayoutPanelContainer",
114
- "areaGridLayout",
115
- "areaGridLayoutPopupsContainer",
116
- "areasWindowPopUpList",
117
- "windowRoot",
118
- "windowHeader",
119
- "windowHeaderContent",
120
- "windowHeaderTitle",
121
- "windowHeaderMainActions",
122
- "windowHeaderCancelHandle",
123
- "windowContent",
124
- "windowPopupRoot",
125
- "windowModalRoot",
126
- "windowLinearProgressRoot",
127
- "windowLinearProgressBar",
128
- "windowRootContainer",
129
- "windowToastiesContainer",
130
- "windowToastiesContainerTostys",
131
- "windowToastyContainer",
132
- "windowToastyMeesageButtonsContainer",
133
- "windowToastyMessage",
134
- "windowToastyButtonsContainer",
135
- "windowToastyPin",
136
- "windowToastyClose",
137
- "panelWindowsRoot",
138
- "panelWindowsButtonContainer",
139
- "containerLinearProgress",
140
- "resizeHandle",
141
- "loaderContainer",
142
- "containerComponent",
143
- "selected",
144
- "colapsed",
145
- "selectedWindow",
146
- "isMobile",
147
- "loading",
148
- "pinIn",
149
- "success",
150
- "info",
151
- "warning",
152
- "error"
153
- ],
154
- AREAS_VIEWER_CLASS_NAME
155
- );
156
- const useAreasViewerUtilityClasses = (ownerState) => {
157
- const slots = {
158
- root: [
159
- "root",
160
- ownerState.status,
161
- ownerState.isMobile && "isMobile",
162
- ownerState.isSkeleton && "isSkeleton"
163
- ],
164
- areaRoot: ["areaRoot"],
165
- areasLoadingErrorRoot: ["areasLoadingErrorRoot"],
166
- areasLoadingErrorLoading: ["areasLoadingErrorLoading"],
167
- areasLoadingError: ["areasLoadingError"],
168
- areasLoadingErrorIcon: ["areasLoadingErrorIcon"],
169
- areasLoadingErrorTitle: ["areasLoadingErrorTitle"],
170
- areasLoadingErrorDescription: ["areasLoadingErrorDescription"],
171
- areasLoadingErrorDivider: ["areasLoadingErrorDivider"],
172
- areaGridLayoutPanelContainer: ["areaGridLayoutPanelContainer"],
173
- areaGridLayout: ["areaGridLayout"],
174
- areaGridLayoutPopupsContainer: ["areaGridLayoutPopupsContainer"],
175
- areasWindowPopUpList: ["areasWindowPopUpList"],
176
- windowRoot: ["windowRoot"],
177
- windowRootContainer: ["windowRootContainer"],
178
- windowHeader: ["windowHeader"],
179
- windowHeaderTitle: ["windowHeaderTitle"],
180
- windowHeaderMainActions: ["windowHeaderMainActions"],
181
- windowHeaderCancelHandle: ["windowHeaderCancelHandle"],
182
- windowContent: ["windowContent"],
183
- windowLinearProgressRoot: ["windowLinearProgressRoot"],
184
- windowLinearProgressBar: ["windowLinearProgressBar"],
185
- windowPopupRoot: ["windowPopupRoot"],
186
- windowModalRoot: ["windowModalRoot"],
187
- selectedWindow: ["selectedWindow"],
188
- windowToastiesContainer: ["windowToastiesContainer"],
189
- windowToastiesContainerTostys: ["windowToastiesContainerTostys"],
190
- windowToastyContainer: ["windowToastiesContainer"],
191
- windowToastyMeesageButtonsContainer: ["windowToastyMeesageButtonsContainer"],
192
- windowToastyMessage: ["windowToastyMessage"],
193
- windowToastyButtonsContainer: ["windowToastyButtonsContainer"],
194
- windowToastyPin: ["windowToastyPin"],
195
- windowToastyClose: ["windowToastyClose"],
196
- panelWindowsRoot: ["panelWindowsRoot"],
197
- panelWindowsButtonContainer: ["panelWindowsButtonContainer"],
198
- resizeHandle: ["resizeHandle"],
199
- loaderContainer: ["loaderContainer"],
200
- containerComponent: ["containerComponent"]
201
- };
202
- return unstable_composeClasses(slots, getComponentUtilityClass(AREAS_VIEWER_CLASS_NAME), {});
203
- };
204
- const areasAdminClasses = generateUtilityClasses(
205
- AREAS_ADMIN_CLASS_NAME,
206
- [
207
- "root",
208
- "rootContent",
209
- "areaChipRoot",
210
- "areaChipTitle",
211
- "areaChipDeleteButton",
212
- "areasAddButton",
213
- "areaContainerChipEditButton",
214
- "areaContainerChips",
215
- "areaContainerContentChips",
216
- "areaContainerChipsIcon",
217
- "areaEditPopover",
218
- "areaChipMobileRoot",
219
- "areaChipMobileIconContainer",
220
- "areaIconLayer",
221
- "areaIconLayerContent",
222
- "areaChipEditButton",
223
- "areasPopoverMobileOptions",
224
- "areasPopoverListWindows",
225
- "areasPopoverListWindowsIcon",
226
- "areaContentChips",
227
- "selected",
228
- "isMobile",
229
- "disabled",
230
- "isFocus"
231
- ],
232
- AREAS_ADMIN_CLASS_NAME
233
- );
234
- const useAreasAdminUtilityClasses = (ownerState) => {
235
- const slots = {
236
- root: [
237
- "root",
238
- ownerState.status,
239
- ownerState.isMobile && "isMobile",
240
- ownerState.isSkeleton && "isSkeleton",
241
- ownerState.focus && "isFocus"
242
- ],
243
- rootContent: ["rootContent"],
244
- areaChipRoot: ["areaChipRoot"],
245
- areaIconLayer: ["areaIconLayer"],
246
- areaContainerChipsIcon: ["areaContainerChipsIcon"],
247
- areaContainerChips: ["areaContainerChips"],
248
- areaContainerContentChips: ["areaContainerContentChips"],
249
- areaEditPopover: ["areaEditPopover"],
250
- areaChipMobileRoot: ["areaChipMobileRoot"],
251
- areaChipMobileIconContainer: ["areaChipMobileIconContainer"],
252
- areaChipTitle: ["areaChipTitle"],
253
- areaContainerChipEditButton: ["areaContainerChipEditButton"],
254
- areaChipDeleteButton: ["areaChipDeleteButton"],
255
- areaChipEditButton: ["areaChipEditButton"],
256
- areasAddButton: ["areasAddButton"],
257
- areasPopoverMobileOptions: ["areasPopoverMobileOptions"],
258
- areasPopoverListWindows: ["areasPopoverListWindows"],
259
- areasPopoverListWindowsIcon: ["areasPopoverListWindowsIcon"],
260
- areaContentChips: ["areaContentChips"]
261
- };
262
- return unstable_composeClasses(slots, getComponentUtilityClass(AREAS_ADMIN_CLASS_NAME), {});
263
- };
264
- styled(IconButton)(() => ({}));
265
- const LabelMemuItem = styled("div")(({ theme }) => ({
266
- height: "22px",
267
- overflow: "hidden",
268
- wordBreak: "break-all",
269
- marginLeft: theme.spacing(1.5),
270
- display: "flex",
271
- alignItems: "center"
272
- }));
273
- generateUtilityClasses(componentName$1, [
274
- "root",
275
- "itemDelete"
276
- ]);
277
- function getMenuActionsUtilityClass(slot) {
278
- return generateUtilityClass(componentName$1, slot);
279
- }
280
- const useMenuActionsUtilityClasses = () => {
281
- const slots = {
282
- root: ["root"],
283
- itemDelete: ["itemDelete"]
284
- };
285
- const composedClasses = unstable_composeClasses(slots, getMenuActionsUtilityClass, {});
286
- return {
287
- ...composedClasses
288
- };
289
- };
290
- function MenuActions(props) {
291
- const {
292
- menuActions,
293
- endListElement,
294
- menuActionSx,
295
- className,
296
- iconButtonClassName = "",
297
- objItem = {},
298
- urlIcon,
299
- toolTip = "",
300
- marginTop = -1,
301
- marginBottom,
302
- marginLeft,
303
- marginRight,
304
- width = 200,
305
- withBadge = false,
306
- badgeContent,
307
- arrowType = "right-top",
308
- externalOpen = null,
309
- externalClose,
310
- ...other
311
- } = props;
312
- const { host_static_assets, environment_assets } = useEnvironment();
313
- const { getLabel } = useModuleDictionary();
314
- const [open, setOpen] = useState(null);
315
- const handleOpen = (event) => {
316
- setOpen(event.currentTarget);
317
- };
318
- const theme = useTheme();
319
- const classes = useMenuActionsUtilityClasses();
320
- useEffect(() => {
321
- let mounted = true;
322
- if (mounted) {
323
- setOpen(externalOpen);
324
- }
325
- return function cleanUp() {
326
- mounted = false;
327
- };
328
- }, [externalOpen]);
329
- const urlFinalIcon = useMemo(() => {
330
- if (urlIcon)
331
- return urlIcon;
332
- return `${host_static_assets}/${environment_assets}/frontend/components/menu_actions/assets/icons/${ICONS.MENU}`;
333
- }, [urlIcon, host_static_assets, environment_assets]);
334
- const handleClose = (e) => {
335
- e.stopPropagation();
336
- setOpen(null);
337
- externalClose && externalClose(null);
338
- };
339
- const handleClick = (e, menuAction) => {
340
- e.stopPropagation();
341
- setOpen(null);
342
- menuAction.onClick();
343
- };
344
- const finalActions = useMemo(() => {
345
- let ret;
346
- if (typeof menuActions !== "function") {
347
- ret = menuActions;
348
- } else {
349
- ret = menuActions(objItem);
350
- }
351
- return ret;
352
- }, [menuActions, objItem]);
353
- const IconButtonElement = /* @__PURE__ */ jsx(Fragment, { children: withBadge ? /* @__PURE__ */ jsx(Badge, { badgeContent, children: /* @__PURE__ */ jsx(
354
- IconButton$1,
355
- {
356
- src: urlFinalIcon,
357
- onClick: handleOpen,
358
- tooltip: toolTip,
359
- className: iconButtonClassName
360
- }
361
- ) }) : /* @__PURE__ */ jsx(
362
- IconButton$1,
363
- {
364
- src: urlFinalIcon,
365
- onClick: handleOpen,
366
- tooltip: toolTip,
367
- className: iconButtonClassName
368
- }
369
- ) });
370
- return /* @__PURE__ */ jsxs(Fragment, { children: [
371
- IconButtonElement,
372
- /* @__PURE__ */ jsxs(
373
- Popover,
374
- {
375
- id: "Popover",
376
- open: Boolean(open),
377
- anchorEl: open,
378
- onClose: handleClose,
379
- arrowType,
380
- className: clsx(classes.root, className),
381
- sx: {
382
- marginTop,
383
- marginBottom,
384
- marginLeft,
385
- marginRight,
386
- width,
387
- maxWidth: 300,
388
- "& .MuiMenuItem-root": { px: 1, typography: "body2", borderRadius: 0.75 },
389
- ...theme.components?.M4LMenuActions?.styleOverrides,
390
- ...menuActionSx
391
- },
392
- ...other,
393
- children: [
394
- finalActions.map((menuAction, index) => /* @__PURE__ */ jsxs(
395
- MenuItem,
396
- {
397
- dense: true,
398
- onClick: (e) => {
399
- handleClick(e, menuAction);
400
- },
401
- sx: { color: menuAction.color ?? "text.main" },
402
- disabled: menuAction.disabled,
403
- className: clsx(
404
- menuAction?.className,
405
- menuAction.variant === "delete" && classes.itemDelete
406
- ),
407
- children: [
408
- menuAction.urlIcon ? /* @__PURE__ */ jsx(Icon, { src: menuAction.urlIcon }) : null,
409
- /* @__PURE__ */ jsx(LabelMemuItem, { children: menuAction.label || menuAction.dictionaryId && getLabel(menuAction.dictionaryId) })
410
- ]
411
- },
412
- `menu_action_${index}`
413
- )),
414
- endListElement ? endListElement : null
415
- ]
416
- }
417
- )
418
- ] });
419
- }
420
- const MemonizedMenuActions = React__default.memo(MenuActions);
421
- const AutocompleteRoot = styled("div")(({ theme }) => ({
422
- ...theme.components?.M4LRHFAutocomplete?.styleOverrides
423
- }));
424
- const WrapperOption = styled("li")(({ theme }) => ({
425
- "& .m4l_image": {
426
- marginRight: theme.spacing(1.5)
427
- }
428
- }));
429
- function withRenderOption(getUrlImage, classes, imageWidth) {
430
- return function RenderOption(optionProps, option) {
431
- return /* @__PURE__ */ jsxs(
432
- WrapperOption,
433
- {
434
- ...optionProps,
435
- className: classes.withImage,
436
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("withImage") } : {},
437
- children: [
438
- /* @__PURE__ */ jsx(Image, { src: getUrlImage(option), width: imageWidth, height: "100%" }),
439
- /* @__PURE__ */ jsx(Typography, { variant: "body", children: optionProps.key })
440
- ]
441
- }
442
- );
443
- };
444
- }
445
- const SkeletonRHFAutocomplete = (props) => {
446
- const { withImage, classes, hasLabel } = props;
447
- return /* @__PURE__ */ jsxs("div", { className: classes.skeletonRoot, children: [
448
- (hasLabel || hasLabel?.length === 0) && /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "30%", height: "16px" }),
449
- /* @__PURE__ */ jsx(
450
- "div",
451
- {
452
- className: classes.skeleton,
453
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("skeleton") } : {},
454
- children: !withImage ? /* @__PURE__ */ jsxs(Fragment, { children: [
455
- /* @__PURE__ */ jsx("div", { className: classes.skeletonContainerText, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "50%", height: "14px" }) }),
456
- /* @__PURE__ */ jsx(Skeleton, { variant: "circular", width: 16, height: 16, sx: { minWidth: "16px" } })
457
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
458
- /* @__PURE__ */ jsx(Skeleton, { variant: "circular" }),
459
- /* @__PURE__ */ jsx("div", { className: classes.skeletonContainerText, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "50%", height: "14px" }) }),
460
- /* @__PURE__ */ jsx(Skeleton, { variant: "circular", width: 16, height: 16, sx: { minWidth: "16px" } })
461
- ] })
462
- }
463
- )
464
- ] });
465
- };
466
- const componentName = "M4LRHFAutocomplete";
467
- generateUtilityClasses(
468
- componentName,
469
- [
470
- "root",
471
- "withImage",
472
- "skeleton",
473
- "label",
474
- "popper",
475
- "skeletonRoot",
476
- "skeletonContainerText",
477
- "iconDown",
478
- "variantInfo",
479
- "variantImage",
480
- "isDisabled",
481
- "imageWidthDefined",
482
- "variantSuccess",
483
- "variantWarning",
484
- "variantError",
485
- "sizeSmall",
486
- "sizeMedium",
487
- "isFocus",
488
- "isTabSelected",
489
- "chip"
490
- ]
491
- );
492
- function getRHFAutocompleteClassesUtilityClass(slot) {
493
- return generateUtilityClass(componentName, slot);
494
- }
495
- const useUtilityClasses = (ownerState) => {
496
- const slots = {
497
- root: [
498
- "root",
499
- ownerState.size === "small" && "sizeSmall",
500
- ownerState.size === "medium" && "sizeMedium",
501
- ownerState.isFocus && "isFocus",
502
- ownerState.isTabSelected && "isTabSelected",
503
- ownerState.disabled && "isDisabled",
504
- ownerState.semantics === "info" && "variantInfo",
505
- ownerState.semantics === "success" && "variantSuccess",
506
- ownerState.semantics === "warning" && "variantWarning",
507
- ownerState.semantics === "error" && "variantError",
508
- ownerState.imageWidthDefined && "imageWidthDefined",
509
- ownerState.multiple && "multiple"
510
- ],
511
- withImage: ["withImage"],
512
- skeleton: ["skeleton"],
513
- label: ["label"],
514
- popper: [
515
- "popper",
516
- ownerState.size === "small" && "sizeSmall",
517
- ownerState.size === "medium" && "sizeMedium",
518
- ownerState.imageWidthDefined && "imageWidthDefined"
519
- ],
520
- skeletonRoot: ["skeletonRoot"],
521
- skeletonContainerText: ["SkeletonContainerText"],
522
- iconDown: ["iconDown"],
523
- chip: [
524
- "chip",
525
- ownerState.size === "small" && "sizeSmall",
526
- ownerState.size === "medium" && "sizeMedium"
527
- ]
528
- };
529
- const composedClasses = unstable_composeClasses(slots, getRHFAutocompleteClassesUtilityClass, {});
530
- return {
531
- ...composedClasses
532
- };
533
- };
534
- const useFormFocus = () => {
535
- const [isFocus, setIsFocus] = useState(false);
536
- const [isTabSelected, setIsTabSelected] = useState(false);
537
- const handlerFocus = () => {
538
- setIsFocus(true);
539
- };
540
- const handlerOnKeyUp = (event) => {
541
- if (event.key === "Tab") {
542
- setIsTabSelected(true);
543
- }
544
- };
545
- const handlerOnBlur = () => {
546
- setIsFocus(false);
547
- setIsTabSelected(false);
548
- };
549
- return { isFocus, isTabSelected, handlerFocus, handlerOnKeyUp, handlerOnBlur };
550
- };
551
- function RHFAutocomplete(props) {
552
- const {
553
- name: nameRHF,
554
- getOptionLabel,
555
- isOptionEqualToValue,
556
- label,
557
- skeletonWidth = 100,
558
- skeletonHeight = "18px",
559
- options,
560
- disabled,
561
- getOptionUrlImage,
562
- onOpen,
563
- onClose,
564
- loading,
565
- variant,
566
- helperMessage,
567
- size = "small",
568
- onChangeFilterParmsLocal,
569
- imageWidth,
570
- imageHeight,
571
- mandatory,
572
- mandatoryMessage,
573
- multiple,
574
- ...other
575
- } = props;
576
- const { getLabel } = useModuleDictionary();
577
- const isSkeleton = useModuleSkeleton();
578
- const withImage = useMemo(() => getOptionUrlImage !== void 0, [getOptionUrlImage]);
579
- const { host_static_assets, environment_assets } = useEnvironment();
580
- const { isFocus, isTabSelected, handlerFocus, handlerOnKeyUp, handlerOnBlur } = useFormFocus();
581
- const autocompleteRef = useRef(null);
582
- const [open, setOpen] = useState(false);
583
- const isDesktop = useResponsiveDesktop();
584
- const onCloseLocal = (event, reason) => {
585
- setOpen(false);
586
- if (onClose)
587
- onClose(event, reason);
588
- };
589
- const onOpenLocal = (event) => {
590
- setOpen(true);
591
- if (onOpen)
592
- onOpen(event);
593
- };
594
- const getOptionLabelLocal = (option) => {
595
- if (option === void 0 || option === null) {
596
- return "";
597
- }
598
- return getOptionLabel(option);
599
- };
600
- const getOptionUrlImageLocal = (option) => {
601
- if (option === void 0 || option === null || getOptionUrlImage === void 0) {
602
- return "";
603
- }
604
- return getOptionUrlImage(option);
605
- };
606
- const isOptionEqualToValueLocal = (option, value) => {
607
- if (value === void 0 || value === null || option === null) {
608
- return false;
609
- }
610
- return isOptionEqualToValue(option, value);
611
- };
612
- const {
613
- control,
614
- formState: { errors }
615
- } = useFormContext();
616
- const [currentVariant, setCurrentVariant] = useState(
617
- null
618
- );
619
- useEffect(() => {
620
- if (errors[nameRHF]) {
621
- setCurrentVariant("error");
622
- } else if (variant) {
623
- setCurrentVariant(variant);
624
- } else {
625
- setCurrentVariant(null);
626
- }
627
- }, [errors[nameRHF], variant, control]);
628
- const ownerState = {
629
- size: !isDesktop ? "medium" : size,
630
- isFocus: !isSkeleton ? isFocus : false,
631
- isTabSelected: !isSkeleton ? isTabSelected : false,
632
- semantics: currentVariant,
633
- disabled,
634
- imageWidthDefined: Boolean(imageWidth),
635
- multiple: Boolean(multiple)
636
- };
637
- const classes = useUtilityClasses(ownerState);
638
- const theme = useTheme();
639
- return /* @__PURE__ */ jsx(
640
- AutocompleteRoot,
641
- {
642
- className: classes.root,
643
- tabIndex: 0,
644
- onFocus: handlerFocus,
645
- onBlur: handlerOnBlur,
646
- onKeyUp: handlerOnKeyUp,
647
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: `${RHFTAUTOCOMPLET_ROOT_TEST_ID}_${nameRHF}` } : {},
648
- children: !isSkeleton ? /* @__PURE__ */ jsx(
649
- Controller,
650
- {
651
- name: nameRHF,
652
- control,
653
- render: ({ field: { onChange, value }, fieldState: { error } }) => {
654
- const [inputValue, setInputValue] = useState(getOptionLabelLocal(value));
655
- useEffect(() => {
656
- if (!open && value === null && inputValue !== "") {
657
- setInputValue("");
658
- }
659
- if (!open && value !== null && options.length === 0) {
660
- onChangeFilterParmsLocal?.(getOptionLabelLocal(value), "reset");
661
- }
662
- }, [value]);
663
- const checkKeyDown = (e) => {
664
- if (e.code === "Enter")
665
- e.preventDefault();
666
- };
667
- return /* @__PURE__ */ jsxs(Fragment, { children: [
668
- label && /* @__PURE__ */ jsx(
669
- FieldLabel,
670
- {
671
- className: classes.label,
672
- label,
673
- mandatory,
674
- mandatoryMessage,
675
- helperMessage
676
- }
677
- ),
678
- /* @__PURE__ */ jsx(
679
- Autocomplete,
680
- {
681
- autoComplete: true,
682
- disableClearable: true,
683
- multiple,
684
- onKeyDown: checkKeyDown,
685
- size,
686
- ref: autocompleteRef,
687
- autoSelect: false,
688
- options,
689
- getOptionLabel: getOptionLabelLocal,
690
- inputValue,
691
- clearOnBlur: false,
692
- PopperComponent: (popperProps) => {
693
- return /* @__PURE__ */ jsx(
694
- Popper,
695
- {
696
- ...popperProps,
697
- className: classes.popper,
698
- placement: "bottom-start",
699
- sx: {
700
- ...theme.components?.M4LRHFAutocompletePopover?.styleOverrides
701
- }
702
- }
703
- );
704
- },
705
- onInputChange: (_event, newValue, reason) => {
706
- if (reason === "input") {
707
- setInputValue(newValue);
708
- if (onChangeFilterParmsLocal) {
709
- onChangeFilterParmsLocal(newValue, reason);
710
- }
711
- } else {
712
- onChange(null);
713
- }
714
- },
715
- isOptionEqualToValue: isOptionEqualToValueLocal,
716
- value: Array.isArray(value) ? value : multiple ? value ? [value] : [] : value || null,
717
- onOpen: onOpenLocal,
718
- onClose: onCloseLocal,
719
- open,
720
- onChange: (_e, newValue) => {
721
- if (!multiple && !Array.isArray(newValue)) {
722
- setInputValue(getOptionLabelLocal(newValue));
723
- } else {
724
- setInputValue("");
725
- }
726
- onChange(Array.isArray(newValue) ? [...newValue] : newValue);
727
- },
728
- filterOptions: onChangeFilterParmsLocal ? (x) => x : void 0,
729
- loading,
730
- loadingText: /* @__PURE__ */ jsx(Typography, { variant: "body", children: getLabel("rhf_autocomplete.loading_options") }),
731
- disabled,
732
- noOptionsText: getLabel("rhf_autocomplete.no_options"),
733
- renderOption: withImage ? withRenderOption(getOptionUrlImageLocal, classes, imageWidth) : void 0,
734
- renderInput: (params) => {
735
- return /* @__PURE__ */ jsx(
736
- TextField,
737
- {
738
- ...params,
739
- InputLabelProps: {
740
- ...params.InputLabelProps,
741
- shrink: true
742
- },
743
- fullWidth: true,
744
- size,
745
- SelectProps: { native: true },
746
- InputProps: {
747
- ...params.InputProps,
748
- startAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
749
- !multiple && withImage && value ? /* @__PURE__ */ jsx(
750
- Image,
751
- {
752
- src: getOptionUrlImageLocal(value),
753
- width: imageWidth,
754
- height: "100%"
755
- },
756
- "ImageTextField"
757
- ) : null,
758
- params.InputProps.startAdornment
759
- ] }),
760
- endAdornment: loading ? /* @__PURE__ */ jsx(CircularProgress, { color: "inherit", size: 18 }) : /* @__PURE__ */ jsx(
761
- IconButton$1,
762
- {
763
- className: classes.iconDown,
764
- src: `${host_static_assets}/${environment_assets}/frontend/components/RHFAutocompletarAsync/assets/icons/chevronDown.svg`,
765
- onClick: (event) => onOpenLocal(event),
766
- disabled,
767
- size
768
- }
769
- )
770
- },
771
- autoComplete: "off",
772
- error: !!error,
773
- ...other
774
- }
775
- );
776
- },
777
- ...multiple ? {
778
- renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => {
779
- const { key, ...restTagProps } = getTagProps({
780
- index
781
- });
782
- return /* @__PURE__ */ createElement(
783
- Chip,
784
- {
785
- ...restTagProps,
786
- key,
787
- label: getOptionLabelLocal(option),
788
- className: classes.chip,
789
- icon: withImage && option ? /* @__PURE__ */ jsx(
790
- Image,
791
- {
792
- src: getOptionUrlImageLocal(option),
793
- width: imageWidth,
794
- height: imageHeight ?? "100%"
795
- }
796
- ) : void 0,
797
- sx: {
798
- ...theme.components?.M4LRHFAutocompleteChip?.styleOverrides
799
- }
800
- }
801
- );
802
- })
803
- } : {}
804
- }
805
- ),
806
- currentVariant === "error" ? /* @__PURE__ */ jsx(HelperText, { variant: currentVariant, message: error?.message }) : null
807
- ] });
808
- }
809
- }
810
- ) : /* @__PURE__ */ jsx(SkeletonRHFAutocomplete, { withImage, classes, hasLabel: label })
811
- }
812
- );
813
- }
814
- styled("div")(() => ({
815
- display: "flex",
816
- flexDirection: "row",
817
- border: "1px solid gray",
818
- "&.active": {
819
- border: "1px solid red"
820
- }
821
- }));
822
- styled("div")(({ theme }) => ({
823
- height: "100%",
824
- width: theme.spacing(1),
825
- backgroundColor: theme.vars.palette.background.default,
826
- "&.active": {
827
- backgroundColor: theme.vars.palette.primary.main
828
- }
829
- }));
830
- const EditAreaHeader = styled("div")(({ theme }) => ({
831
- display: "flex",
832
- width: "100%",
833
- height: "25px",
834
- borderBottom: "1px solid",
835
- borderColor: theme.vars.palette.state.default,
836
- justifyContent: "space-between",
837
- alignItems: "center"
838
- }));
839
- const ChipActionsMobile = (props) => {
840
- const { handlerOpenPopoverEditArea, areaId } = props;
841
- const { deleteArea } = useAreasStore((state) => state.areasActions);
842
- const { setFocus } = useAreasStore((state) => state.areaAdminActions, shallow);
843
- const listAreas = useAreasStore((state) => state.areasIds, shallow);
844
- const { host_static_assets, environment_assets } = useEnvironment();
845
- const { getLabel } = useModuleDictionary();
846
- const menuActions = [
847
- {
848
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.EDIT_AREA}`,
849
- onClick: handlerOpenPopoverEditArea,
850
- label: getLabel(getAreasDictionary(DICCTIONARY.label_edit_area))
851
- }
852
- ];
853
- if (listAreas.length > 1) {
854
- menuActions.push({
855
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.DELETE_AREA}`,
856
- onClick: () => {
857
- deleteArea(areaId);
858
- setFocus(false);
859
- },
860
- label: getLabel(getAreasDictionary(DICCTIONARY.label_delete_area))
861
- });
862
- }
863
- return /* @__PURE__ */ jsx(
864
- MenuActions,
865
- {
866
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.SHOW_OPTIONS}`,
867
- arrowType: "no-arrow",
868
- marginTop: "12px",
869
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
870
- transformOrigin: { vertical: "top", horizontal: "right" },
871
- menuActions,
872
- externalClose: () => setFocus(false)
873
- }
874
- );
875
- };
876
- const AreaChip = (props) => {
877
- const { areaId, selected, disabled, setAnchorMenuAreas } = props;
878
- const { host_static_assets, environment_assets } = useEnvironment();
879
- const { deleteArea, selectArea, editArea } = useAreasStore((state) => state.areasActions);
880
- const { setFocus } = useAreasStore((state) => state.areaAdminActions);
881
- const areaName = useAreasStore((state) => state.hashAreas[areaId].name, shallow);
882
- const listAreas = useAreasStore((state) => state.areasIds, shallow);
883
- const [open, setOpen] = useState(false);
884
- const { getLabel } = useModuleDictionary();
885
- const isDesktop = useResponsiveDesktop();
886
- const anchorRef = useRef(null);
887
- const theme = useTheme();
888
- const onClickDeleteArea = (e) => {
889
- if (listAreas.length > 1) {
890
- e.stopPropagation();
891
- setFocus(true);
892
- deleteArea(areaId);
893
- }
894
- };
895
- const onSubmit = (data) => {
896
- editArea(areaId, data.inputEditArea);
897
- setOpen(false);
898
- setFocus(false);
899
- };
900
- const handlerOpenPopoverEditArea = (e) => {
901
- e?.stopPropagation();
902
- setFocus(true);
903
- setOpen(true);
904
- };
905
- const initialValues = {
906
- inputEditArea: areaName
907
- };
908
- const validationSchema = useMemo(
909
- () => Yup.object().shape({
910
- inputEditArea: Yup.string().required(
911
- getLabel(getAreasDictionary(DICCTIONARY.validation_edit_area))
912
- )
913
- }),
914
- [getLabel]
915
- );
916
- const handlerOnClick = (e) => {
917
- setAnchorMenuAreas && setAnchorMenuAreas(e.currentTarget);
918
- selectArea(areaId);
919
- };
920
- const rippleRef = useRef(null);
921
- const onRippleStart = (e) => {
922
- if (rippleRef.current) {
923
- rippleRef.current.start(e);
924
- }
925
- };
926
- const onRippleStop = (e) => {
927
- if (rippleRef.current) {
928
- rippleRef.current.stop(e);
929
- }
930
- };
931
- return /* @__PURE__ */ jsxs(Fragment, { children: [
932
- /* @__PURE__ */ jsxs(
933
- "div",
934
- {
935
- role: "presentation",
936
- ref: anchorRef,
937
- onMouseDown: onRippleStart,
938
- onMouseUp: onRippleStop,
939
- className: clsx(
940
- areasAdminClasses.areaChipRoot,
941
- selected ? areasAdminClasses.selected : null,
942
- disabled ? areasAdminClasses.disabled : null
943
- ),
944
- onClick: (e) => {
945
- handlerOnClick(e);
946
- },
947
- children: [
948
- /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaChipTitle, children: areaName }),
949
- isDesktop ? /* @__PURE__ */ jsxs("div", { className: areasAdminClasses.areaContainerChipEditButton, children: [
950
- /* @__PURE__ */ jsx(
951
- IconButton$1,
952
- {
953
- className: areasAdminClasses.areaChipEditButton,
954
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.EDIT_AREA}`,
955
- size: "small",
956
- onClick: (e) => {
957
- handlerOpenPopoverEditArea(e);
958
- },
959
- tooltip: getLabel(getAreasDictionary(DICCTIONARY.label_edit_area))
960
- }
961
- ),
962
- /* @__PURE__ */ jsx(
963
- IconButton$1,
964
- {
965
- className: areasAdminClasses.areaChipDeleteButton,
966
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.DELETE_AREA}`,
967
- size: "small",
968
- onClick: (e) => {
969
- onClickDeleteArea(e);
970
- },
971
- tooltip: getLabel(getAreasDictionary(DICCTIONARY.label_delete_area))
972
- }
973
- )
974
- ] }) : /* @__PURE__ */ jsx(
975
- ChipActionsMobile,
976
- {
977
- areaId,
978
- handlerOpenPopoverEditArea
979
- }
980
- )
981
- ]
982
- }
983
- ),
984
- /* @__PURE__ */ jsx(
985
- "div",
986
- {
987
- role: "presentation",
988
- onClick: (e) => {
989
- e.stopPropagation();
990
- },
991
- children: /* @__PURE__ */ jsx(
992
- Popover,
993
- {
994
- arrowType: "top-center",
995
- open,
996
- className: areasAdminClasses.areaEditPopover,
997
- anchorEl: anchorRef.current,
998
- anchorOrigin: { vertical: "bottom", horizontal: "center" },
999
- transformOrigin: { vertical: "top", horizontal: "center" },
1000
- onClose: () => {
1001
- setFocus(false);
1002
- setOpen(false);
1003
- },
1004
- sx: {
1005
- mt: "10px",
1006
- ...theme.components?.M4LAreasAdminEditPopover?.styleOverrides
1007
- },
1008
- children: /* @__PURE__ */ jsxs(
1009
- RHFormProvider,
1010
- {
1011
- onSubmit,
1012
- values: initialValues,
1013
- validationSchema,
1014
- children: [
1015
- /* @__PURE__ */ jsxs(EditAreaHeader, { children: [
1016
- /* @__PURE__ */ jsx(Typography, { children: getLabel(getAreasDictionary(DICCTIONARY.label_edit_area)) }),
1017
- /* @__PURE__ */ jsx(
1018
- IconButton$1,
1019
- {
1020
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.CLOSE}`,
1021
- size: "small",
1022
- onClick: () => {
1023
- setFocus(false);
1024
- setOpen(false);
1025
- }
1026
- }
1027
- )
1028
- ] }),
1029
- /* @__PURE__ */ jsx(
1030
- RHFTextField,
1031
- {
1032
- name: "inputEditArea",
1033
- skeletonWidth: "70%",
1034
- skeletonHeight: "18px",
1035
- sx: { mt: "20px" }
1036
- }
1037
- ),
1038
- /* @__PURE__ */ jsxs(Actions$1, { children: [
1039
- /* @__PURE__ */ jsx(
1040
- ActionCancel,
1041
- {
1042
- onClick: () => {
1043
- setOpen(false);
1044
- setFocus(false);
1045
- },
1046
- variant: "outlined",
1047
- skeletonWidth: "100%"
1048
- }
1049
- ),
1050
- /* @__PURE__ */ jsx(ActionIntro, { skeletonWidth: "100%" })
1051
- ] })
1052
- ]
1053
- }
1054
- )
1055
- }
1056
- )
1057
- }
1058
- )
1059
- ] });
1060
- };
1061
- AreaChip.displayName = "AreaButtons";
1062
- const AreasAdminRoot = styled$1("div")`
1063
- display: flex;
1064
- position: relative;
1065
- background-color: transparent;
1066
-
1067
- //areaRoot
1068
- & .${areasAdminClasses.areaChipRoot} {
1069
- display: flex;
1070
- }
1071
-
1072
- ${(props) => props.theme.components?.M4LAreasAdmin?.styleOverrides}
1073
- `;
1074
- const ChipMobile = (props) => {
1075
- const { areaId, selected, disabled, setAnchorMenuAreas } = props;
1076
- const { host_static_assets, environment_assets } = useEnvironment();
1077
- const { deleteArea, selectArea, editArea } = useAreasStore((state) => state.areasActions);
1078
- const { setFocus } = useAreasStore((state) => state.areaAdminActions);
1079
- const areaName = useAreasStore((state) => state.hashAreas[areaId].name, shallow);
1080
- const listAreas = useAreasStore((state) => state.areasIds, shallow);
1081
- const [open, setOpen] = useState(false);
1082
- const { getLabel } = useModuleDictionary();
1083
- const isDesktop = useResponsiveDesktop();
1084
- const anchorRef = useRef(null);
1085
- const theme = useTheme();
1086
- const onClickDeleteArea = (e) => {
1087
- if (listAreas.length > 1) {
1088
- e.stopPropagation();
1089
- setFocus(true);
1090
- deleteArea(areaId);
1091
- }
1092
- };
1093
- const onSubmit = (data) => {
1094
- editArea(areaId, data.inputEditArea);
1095
- setOpen(false);
1096
- setFocus(false);
1097
- };
1098
- const handlerOpenPopoverEditArea = (e) => {
1099
- e?.stopPropagation();
1100
- setFocus(true);
1101
- setOpen(true);
1102
- };
1103
- const initialValues = {
1104
- inputEditArea: areaName
1105
- };
1106
- const validationSchema = useMemo(
1107
- () => Yup.object().shape({
1108
- inputEditArea: Yup.string().required(
1109
- getLabel(getAreasDictionary(DICCTIONARY.validation_edit_area))
1110
- )
1111
- }),
1112
- [getLabel]
1113
- );
1114
- const handlerOnClick = (e) => {
1115
- setAnchorMenuAreas && setAnchorMenuAreas(e.currentTarget);
1116
- selectArea(areaId);
1117
- };
1118
- const rippleRef = useRef(null);
1119
- const onRippleStart = (e) => {
1120
- if (rippleRef.current) {
1121
- rippleRef.current.start(e);
1122
- }
1123
- };
1124
- const onRippleStop = (e) => {
1125
- if (rippleRef.current) {
1126
- rippleRef.current.stop(e);
1127
- }
1128
- };
1129
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1130
- /* @__PURE__ */ jsxs(
1131
- "div",
1132
- {
1133
- role: "presentation",
1134
- ref: anchorRef,
1135
- onMouseDown: onRippleStart,
1136
- onMouseUp: onRippleStop,
1137
- className: clsx(
1138
- areasAdminClasses.areaChipRoot,
1139
- selected ? areasAdminClasses.selected : null,
1140
- disabled ? areasAdminClasses.disabled : null
1141
- ),
1142
- onClick: (e) => {
1143
- handlerOnClick(e);
1144
- },
1145
- children: [
1146
- /* @__PURE__ */ jsx(TouchRipple, { ref: rippleRef, center: false, style: { position: "absolute", inset: "0" } }),
1147
- /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaChipTitle, children: areaName })
1148
- ]
1149
- }
1150
- ),
1151
- isDesktop ? /* @__PURE__ */ jsxs("div", { className: areasAdminClasses.areaContainerChipEditButton, children: [
1152
- /* @__PURE__ */ jsx(
1153
- IconButton$1,
1154
- {
1155
- className: areasAdminClasses.areaChipEditButton,
1156
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.EDIT_AREA}`,
1157
- size: "small",
1158
- onClick: (e) => {
1159
- handlerOpenPopoverEditArea(e);
1160
- }
1161
- }
1162
- ),
1163
- /* @__PURE__ */ jsx(
1164
- IconButton$1,
1165
- {
1166
- className: areasAdminClasses.areaChipDeleteButton,
1167
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.DELETE_AREA}`,
1168
- size: "small",
1169
- onClick: (e) => {
1170
- onClickDeleteArea(e);
1171
- }
1172
- }
1173
- )
1174
- ] }) : /* @__PURE__ */ jsx(
1175
- ChipActionsMobile,
1176
- {
1177
- areaId,
1178
- handlerOpenPopoverEditArea
1179
- }
1180
- ),
1181
- /* @__PURE__ */ jsx(
1182
- "div",
1183
- {
1184
- role: "presentation",
1185
- onClick: (e) => {
1186
- e.stopPropagation();
1187
- },
1188
- children: /* @__PURE__ */ jsx(
1189
- Popover,
1190
- {
1191
- arrowType: "top-center",
1192
- open,
1193
- className: areasAdminClasses.areaEditPopover,
1194
- anchorEl: anchorRef.current,
1195
- anchorOrigin: { vertical: "bottom", horizontal: "center" },
1196
- transformOrigin: { vertical: "top", horizontal: "center" },
1197
- onClose: () => {
1198
- setFocus(false);
1199
- setOpen(false);
1200
- },
1201
- sx: {
1202
- mt: "10px",
1203
- ...theme.components?.M4LAreasAdminEditPopover?.styleOverrides
1204
- },
1205
- children: /* @__PURE__ */ jsxs(
1206
- RHFormProvider,
1207
- {
1208
- onSubmit,
1209
- values: initialValues,
1210
- validationSchema,
1211
- children: [
1212
- /* @__PURE__ */ jsxs(EditAreaHeader, { children: [
1213
- /* @__PURE__ */ jsx(Typography, { children: getLabel(getAreasDictionary(DICCTIONARY.label_edit_area)) }),
1214
- /* @__PURE__ */ jsx(
1215
- IconButton$1,
1216
- {
1217
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.CLOSE}`,
1218
- size: "small",
1219
- onClick: () => {
1220
- setFocus(false);
1221
- setOpen(false);
1222
- }
1223
- }
1224
- )
1225
- ] }),
1226
- /* @__PURE__ */ jsx(
1227
- RHFTextField,
1228
- {
1229
- name: "inputEditArea",
1230
- skeletonWidth: "70%",
1231
- skeletonHeight: "18px",
1232
- sx: { mt: "20px" }
1233
- }
1234
- ),
1235
- /* @__PURE__ */ jsxs(Actions$1, { children: [
1236
- /* @__PURE__ */ jsx(
1237
- ActionCancel,
1238
- {
1239
- onClick: () => {
1240
- setOpen(false);
1241
- setFocus(false);
1242
- },
1243
- variant: "outlined",
1244
- skeletonWidth: "100%"
1245
- }
1246
- ),
1247
- /* @__PURE__ */ jsx(ActionIntro, { skeletonWidth: "100%" })
1248
- ] })
1249
- ]
1250
- }
1251
- )
1252
- }
1253
- )
1254
- }
1255
- )
1256
- ] });
1257
- };
1258
- ChipMobile.displayName = "AreaButtons";
1259
- const AreaChipMobile = () => {
1260
- const areas = useAreasStore(
1261
- (state) => state.areasIds.map((a) => ({ id: a, name: state.hashAreas[a].name })),
1262
- shallow
1263
- );
1264
- const { selectArea } = useAreasStore((state) => state.areasActions);
1265
- const currentAreaId = useAreasStore((state) => state.currentAreaId, shallow);
1266
- const { addArea } = useAreasStore((state) => state.areasActions, shallow);
1267
- const { setFocus } = useAreasStore((state) => state.areaAdminActions, shallow);
1268
- const [anchorMenuAreas, setAnchorMenuAreas] = useState(null);
1269
- const { getLabel } = useModuleDictionary();
1270
- const theme = useTheme();
1271
- const currentArea = areas.find((area) => area.id === currentAreaId);
1272
- const { host_static_assets, environment_assets } = useEnvironment();
1273
- const menuActions = useMemo(
1274
- () => areas.filter((area) => area.id !== currentAreaId).map((area) => {
1275
- return {
1276
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.LAYERS}`,
1277
- onClick: () => {
1278
- selectArea(area.id);
1279
- setFocus(false);
1280
- },
1281
- label: area.name
1282
- };
1283
- }),
1284
- [areas, currentAreaId]
1285
- );
1286
- const handlerSetAnchorMenuAreas = (element) => {
1287
- setFocus(false);
1288
- setAnchorMenuAreas(element);
1289
- };
1290
- return /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaChipMobileRoot, children: /* @__PURE__ */ jsxs("div", { className: areasAdminClasses.areaContainerContentChips, children: [
1291
- currentArea ? /* @__PURE__ */ jsx(
1292
- ChipMobile,
1293
- {
1294
- areaId: currentArea.id,
1295
- selected: true,
1296
- disabled: true,
1297
- setAnchorMenuAreas
1298
- },
1299
- currentArea.id
1300
- ) : null,
1301
- menuActions.length >= 0 ? /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaChipMobileIconContainer, children: /* @__PURE__ */ jsx(
1302
- MenuActions,
1303
- {
1304
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.CHEVRON_DOWN}`,
1305
- arrowType: "no-arrow",
1306
- marginTop: "12px!important",
1307
- marginLeft: "14px!important",
1308
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
1309
- transformOrigin: { vertical: "top", horizontal: "right" },
1310
- menuActions,
1311
- externalOpen: anchorMenuAreas,
1312
- externalClose: handlerSetAnchorMenuAreas,
1313
- className: areasAdminClasses.areasPopoverMobileOptions,
1314
- menuActionSx: theme.components?.M4LAreasAdminMobilePopoverOptions?.styleOverrides,
1315
- endListElement: /* @__PURE__ */ jsx(
1316
- Button,
1317
- {
1318
- onClick: () => {
1319
- addArea();
1320
- setAnchorMenuAreas(null);
1321
- },
1322
- variant: "outlined",
1323
- startIcon: /* @__PURE__ */ jsx(
1324
- Icon,
1325
- {
1326
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.ADD_AREA}`
1327
- }
1328
- ),
1329
- children: getLabel(getAreasDictionary(DICCTIONARY.area_add_new))
1330
- }
1331
- )
1332
- }
1333
- ) }) : null
1334
- ] }) });
1335
- };
1336
- const PanelWindowPopUp = (props) => {
1337
- const { currentAreaId } = props;
1338
- const { host_static_assets, environment_assets } = useEnvironment();
1339
- const windowsLayouts = useAreasStore(
1340
- (state) => state.hashAreas[currentAreaId].layoutItemsIds.filter((li) => state.hashWindows[li].emergeType === "layout").map((lim) => {
1341
- const w = state.hashWindows[lim];
1342
- return {
1343
- i: w.windowId,
1344
- url_icon: w.url_icon,
1345
- title: w.title
1346
- };
1347
- }),
1348
- shallow
1349
- );
1350
- const theme = useTheme();
1351
- const { maximizeLayout } = useAreasStore((state) => state.areaActions);
1352
- const onTouched = (layoutId) => {
1353
- maximizeLayout(currentAreaId, layoutId);
1354
- };
1355
- const menuActions = windowsLayouts.map((element) => {
1356
- return {
1357
- onClick: () => onTouched(element.i),
1358
- label: element.title,
1359
- urlIcon: element.url_icon
1360
- };
1361
- });
1362
- return menuActions.length > 0 ? /* @__PURE__ */ jsx(
1363
- MenuActions,
1364
- {
1365
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.LAYERS}`,
1366
- arrowType: "no-arrow",
1367
- marginTop: "12px!important",
1368
- marginLeft: "14px!important",
1369
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
1370
- transformOrigin: { vertical: "top", horizontal: "right" },
1371
- menuActions,
1372
- className: areasAdminClasses.areasPopoverListWindows,
1373
- iconButtonClassName: areasAdminClasses.areasPopoverListWindowsIcon,
1374
- menuActionSx: theme.components?.M4LAreasAdminMobilePopoverOptions?.styleOverrides
1375
- }
1376
- ) : null;
1377
- };
1378
- function AreasAdmin() {
1379
- const areas = useAreasStore((state) => state.areasIds, shallow);
1380
- const currentArea = useAreasStore((state) => state.currentAreaId, shallow);
1381
- const status = useAreasStore((state) => state.ownerState.status);
1382
- const { setFocus } = useAreasStore((state) => state.areaAdminActions, shallow);
1383
- const classesRoot = useAreasStore((state) => state.adminClasses.root);
1384
- const areasLength = useAreasStore((state) => state.areasIds.length);
1385
- const isDesktop = useResponsiveDesktop();
1386
- const { addArea } = useAreasStore((state) => state.areasActions, shallow);
1387
- const maximizedId = useAreasStore(
1388
- (state) => state.hashAreas[currentArea] ? state.hashAreas[currentArea].maximizedId : false,
1389
- shallow
1390
- );
1391
- const { host_static_assets, environment_assets } = useEnvironment();
1392
- const { getLabel } = useModuleDictionary();
1393
- const divRef = useRef(null);
1394
- const divRefOut = useRef(null);
1395
- const handleClickOutsideFn = () => {
1396
- setFocus(false);
1397
- };
1398
- useOnClickOutside(divRef, handleClickOutsideFn, divRefOut);
1399
- const rippleRef = useRef(null);
1400
- const onRippleStart = (e) => {
1401
- if (rippleRef.current) {
1402
- rippleRef.current.start(e);
1403
- }
1404
- };
1405
- const onRippleStop = (e) => {
1406
- if (rippleRef.current) {
1407
- rippleRef.current.stop(e);
1408
- }
1409
- };
1410
- if (status !== "loaded") {
1411
- return null;
1412
- }
1413
- return /* @__PURE__ */ jsx(
1414
- AreasAdminRoot,
1415
- {
1416
- ref: divRefOut,
1417
- onMouseDown: onRippleStart,
1418
- onMouseUp: onRippleStop,
1419
- className: classesRoot,
1420
- children: /* @__PURE__ */ jsxs(
1421
- "div",
1422
- {
1423
- role: "presentation",
1424
- ref: divRef,
1425
- className: areasAdminClasses.rootContent,
1426
- onClick: () => setFocus(true),
1427
- children: [
1428
- /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaContainerChipsIcon, children: /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaContainerChips, children: /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaContainerContentChips, children: isDesktop ? /* @__PURE__ */ jsx(ScrollBar, { children: /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaContentChips, children: areas.map((area) => /* @__PURE__ */ jsx(
1429
- AreaChip,
1430
- {
1431
- areaId: area,
1432
- selected: area === currentArea,
1433
- disabled: areasLength === 1
1434
- },
1435
- area
1436
- )) }) }) : /* @__PURE__ */ jsx(AreaChipMobile, {}) }) }) }),
1437
- isDesktop ? /* @__PURE__ */ jsx(
1438
- IconButton$1,
1439
- {
1440
- className: areasAdminClasses.areasAddButton,
1441
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.ADD_AREA}`,
1442
- size: "small",
1443
- onClick: addArea,
1444
- tooltip: getLabel(getAreasDictionary(DICCTIONARY.area_add_new))
1445
- }
1446
- ) : null,
1447
- !isDesktop && maximizedId ? /* @__PURE__ */ jsx(PanelWindowPopUp, { currentAreaId: currentArea }) : null
1448
- ]
1449
- }
1450
- )
1451
- }
1452
- );
1453
- }
1454
- const react_resizable_css = {};
1455
- const AreasViewerRoot = styled$1("div")`
1456
- /* display: flex; */
1457
- width: 100%;
1458
- height: 100%;
1459
- overflow: hidden;
1460
- /* flex-grow: 1; */
1461
- position: relative;
1462
-
1463
- //areaRoot
1464
- & .${areasViewerClasses.areaRoot} {
1465
- display: none;
1466
- position: absolute;
1467
- /* flex-grow: 1; */
1468
- flex-direction: row;
1469
- inset: 0;
1470
- /* width: 100%; */
1471
- overflow: hidden;
1472
- justify-content: top;
1473
- align-items: flex-start;
1474
-
1475
- visibility: hidden;
1476
- }
1477
-
1478
- & .${areasViewerClasses.areaRoot}.${areasViewerClasses.selected} {
1479
- display: block;
1480
- visibility: visible;
1481
- }
1482
-
1483
- &.${areasViewerClasses.isMobile} .${areasViewerClasses.areaRoot} {
1484
- }
1485
-
1486
- // areaGridLayoutPanelContainer
1487
- & .${areasViewerClasses.areaGridLayoutPanelContainer} {
1488
- display: flex;
1489
- flex-direction: row;
1490
- height: 100%;
1491
- width: 100%;
1492
- overflow: hidden;
1493
- }
1494
- &.${areasViewerClasses.isMobile} .${areasViewerClasses.areaGridLayoutPanelContainer} {
1495
- flex-direction: column-reverse;
1496
- }
1497
- // areaGridLayout
1498
- & .${areasViewerClasses.areaGridLayout} {
1499
- height: 100% !important;
1500
- overflow: auto;
1501
- flex-grow: 1;
1502
- }
1503
- &.${areasViewerClasses.isMobile} .${areasViewerClasses.areaGridLayout} {
1504
- flex-direction: column-reverse;
1505
- height: unset;
1506
- width: 100%;
1507
- }
1508
- // areaGridLayoutPopupsContainer
1509
- & .${areasViewerClasses.areaGridLayoutPopupsContainer} {
1510
- z-index: 1; //Garantizar q el contenedor de los popus este por encima de los layouts
1511
- // // ' .react-draggable': {
1512
- // // position: 'absolute',
1513
- // // },
1514
- }
1515
-
1516
- // PanelWindowsRoot
1517
- & .${areasViewerClasses.panelWindowsRoot} {
1518
- display: flex;
1519
- flex-direction: column;
1520
- position: relative;
1521
- }
1522
- &.${areasViewerClasses.isMobile} .${areasViewerClasses.panelWindowsRoot} {
1523
- flex-direction: row;
1524
- }
1525
-
1526
- // windowRoot
1527
- & .${areasViewerClasses.windowRoot} {
1528
- inset: 0;
1529
- position: absolute;
1530
- display: flex;
1531
- flex-direction: column;
1532
- /* height: 100%; */
1533
- /* width: 100%; */
1534
- overflow: hidden;
1535
- border: 1px solid gray;
1536
-
1537
- background-color: ${(props) => props.theme.vars.palette.background.default};
1538
- padding: ${(props) => props.theme.spacing(0)};
1539
- }
1540
-
1541
- & .${areasViewerClasses.windowRoot}.${areasViewerClasses.selected} {
1542
- border-top: 1px solid green;
1543
- }
1544
- // windowHeaderTitle
1545
- & .${areasViewerClasses.windowHeaderTitle} {
1546
- width: 100%;
1547
- max-width: 100%;
1548
- overflow: hidden;
1549
- white-space: nowrap;
1550
- color: ${(props) => props.theme.vars.palette.text.primary};
1551
- text-overflow: ellipsis;
1552
- }
1553
- // windowHeaderMainActions
1554
- & .${areasViewerClasses.windowHeaderMainActions} {
1555
- display: flex;
1556
-
1557
- gap: 4px;
1558
- }
1559
-
1560
- // windowHeaderMainActions
1561
- & .${areasViewerClasses.windowContent} {
1562
- flex-grow: 1;
1563
- position: relative;
1564
- }
1565
-
1566
- // windowModalRoot
1567
- & .${areasViewerClasses.windowModalRoot} {
1568
- padding: 16px;
1569
- }
1570
-
1571
- ${react_resizable_css}
1572
-
1573
- ${(props) => props.theme.components?.M4LAreasViewer?.styleOverrides}
1574
- `;
1575
- function WindowHeaderSkeleton(props) {
1576
- const { colapsed } = props;
1577
- return /* @__PURE__ */ jsx("div", { className: clsx(areasViewerClasses.windowHeader), children: /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowHeaderContent, children: [
1578
- /* @__PURE__ */ jsx(
1579
- Skeleton,
1580
- {
1581
- variant: "circular",
1582
- sx: { margin: "0 5px", minWidth: "18px", minHeight: "18px" }
1583
- }
1584
- ),
1585
- /* @__PURE__ */ jsx("div", { style: { width: "100%" }, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: 80, height: 16 }) }),
1586
- /* @__PURE__ */ jsx("div", { className: areasViewerClasses.windowHeaderCancelHandle, children: !colapsed && /* @__PURE__ */ jsxs(Fragment, { children: [
1587
- /* @__PURE__ */ jsx(
1588
- Skeleton,
1589
- {
1590
- variant: "circular",
1591
- sx: { margin: "0 5px", minWidth: "16px", minHeight: "16px" }
1592
- }
1593
- ),
1594
- /* @__PURE__ */ jsx(
1595
- Skeleton,
1596
- {
1597
- variant: "circular",
1598
- sx: { margin: "0 5px", minWidth: "16px", minHeight: "16px" }
1599
- }
1600
- ),
1601
- /* @__PURE__ */ jsx(
1602
- Skeleton,
1603
- {
1604
- variant: "circular",
1605
- sx: { margin: "0 5px", minWidth: "16px", minHeight: "16px" }
1606
- }
1607
- )
1608
- ] }) }),
1609
- /* @__PURE__ */ jsx(
1610
- Skeleton,
1611
- {
1612
- variant: "circular",
1613
- sx: { margin: "0 5px", minWidth: "16px", minHeight: "16px" }
1614
- }
1615
- ),
1616
- /* @__PURE__ */ jsx(
1617
- Skeleton,
1618
- {
1619
- variant: "circular",
1620
- sx: { margin: "0 5px", minWidth: "16px", minHeight: "16px" }
1621
- }
1622
- )
1623
- ] }) });
1624
- }
1625
- function getMainActions(isDesktop, moduleActions) {
1626
- let mainActions = [];
1627
- if (isDesktop !== void 0 && isDesktop) {
1628
- mainActions = mainActions.concat(moduleActions.filter((action) => action.visibility === "main"));
1629
- }
1630
- mainActions = mainActions.concat(moduleActions.filter((action) => action.visibility === "allways"));
1631
- return mainActions;
1632
- }
1633
- function getMenuActions(options) {
1634
- const {
1635
- windowId,
1636
- isDesktop,
1637
- moduleActions,
1638
- urlPrefix,
1639
- saveModuleCookies,
1640
- resetModuleCookies,
1641
- version,
1642
- windowOptions = { allowPersistCookies: false },
1643
- getLabel
1644
- } = options;
1645
- let menuActions = [...moduleActions.filter((action) => action.visibility !== "allways")];
1646
- if (isDesktop !== void 0 && isDesktop) {
1647
- menuActions = menuActions.filter((action) => action.visibility === "normal");
1648
- }
1649
- if (windowOptions.allowPersistCookies) {
1650
- const saveCookiesAction = {
1651
- urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS$1.SAVE_COOKIES}`,
1652
- onClick: () => saveModuleCookies(windowId),
1653
- disabled: false,
1654
- visibility: "normal",
1655
- label: getLabel(getAreasDictionary(DICCTIONARY.label_persist_module_cookies)),
1656
- key: "save_cookies"
1657
- };
1658
- menuActions.push(saveCookiesAction);
1659
- const resetCookiesAction = {
1660
- urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS$1.RESET_COOKIES}`,
1661
- onClick: () => resetModuleCookies(windowId),
1662
- disabled: false,
1663
- visibility: "normal",
1664
- label: getLabel(getAreasDictionary(DICCTIONARY.label_reset_module_cookies)),
1665
- key: "reset_cookes"
1666
- };
1667
- menuActions.push(resetCookiesAction);
1668
- }
1669
- if (version) {
1670
- const versionAction = {
1671
- urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS$1.VERSION}`,
1672
- onClick: () => {
1673
- },
1674
- disabled: true,
1675
- visibility: "normal",
1676
- label: version,
1677
- key: "version"
1678
- };
1679
- menuActions.push(versionAction);
1680
- }
1681
- return menuActions;
1682
- }
1683
- function MainActions(props) {
1684
- const { windowId } = props;
1685
- const moduleActions = useAreasStore((state) => {
1686
- const window2 = state.hashWindows[windowId];
1687
- return window2?.moduleActions || [];
1688
- }, shallow);
1689
- const { getLabel } = useModuleDictionary();
1690
- const isDesktop = useResponsiveDesktop();
1691
- const mainActions = useMemo(() => {
1692
- return getMainActions(isDesktop, moduleActions);
1693
- }, [moduleActions, isDesktop]);
1694
- return /* @__PURE__ */ jsx("div", { className: areasViewerClasses.windowHeaderMainActions, children: mainActions.map((mainAction) => {
1695
- const tooltip = mainAction.label !== void 0 ? mainAction.label : getLabel(mainAction.dictionaryId || "");
1696
- const onClick = (e) => {
1697
- mainAction.onClick(e);
1698
- e.stopPropagation();
1699
- };
1700
- return /* @__PURE__ */ jsx(
1701
- IconButton$1,
1702
- {
1703
- src: mainAction.urlIcon || "",
1704
- className: clsx(mainAction.className, "m4l_draggableCancel"),
1705
- onClick,
1706
- "aria-label": mainAction.label,
1707
- disabled: mainAction.disabled,
1708
- tooltip
1709
- },
1710
- mainAction.key
1711
- );
1712
- }) });
1713
- }
1714
- function Header(props) {
1715
- const { areaId, windowId, emergeType } = props;
1716
- const [url_icon, title, moduleActions, onClose, version, windowOptions, fnQueryClose] = useAreasStore((state) => {
1717
- const window2 = state.hashWindows[windowId];
1718
- return [
1719
- window2.url_icon,
1720
- window2.title,
1721
- window2.moduleActions,
1722
- window2.onClose,
1723
- window2.version,
1724
- window2.windowOptions,
1725
- window2.fnQueryClose
1726
- ];
1727
- }, shallow);
1728
- const { saveModuleCookies, resetModuleCookies } = useAreasStore(
1729
- (state) => state.windowActions,
1730
- shallow
1731
- );
1732
- const maximizedId = useAreasStore((state) => state.hashAreas[areaId].maximizedId, shallow);
1733
- const colapsed = useAreasStore((state) => {
1734
- const currentBreakpoint = state.hashAreas[areaId].currentBreakpoint;
1735
- if (currentBreakpoint) {
1736
- return state.hashAreas[areaId].layouts[currentBreakpoint].find((li) => li.i === windowId)?.colapsed;
1737
- }
1738
- return false;
1739
- }, shallow);
1740
- const { maximizeLayout, normalizeLayouts, colapseLayoutItem, unColapseLayoutItem } = useAreasStore((state) => state.areaActions, shallow);
1741
- const { host_static_assets, environment_assets } = useEnvironment();
1742
- const isDesktop = useResponsiveDesktop();
1743
- const isSkeleton = useModuleSkeleton();
1744
- const { getLabel } = useModuleDictionary();
1745
- const urlPrefix = `${host_static_assets}/${environment_assets}`;
1746
- const menuActions = useMemo(() => {
1747
- return getMenuActions({
1748
- windowId,
1749
- isDesktop,
1750
- moduleActions,
1751
- urlPrefix,
1752
- saveModuleCookies,
1753
- resetModuleCookies,
1754
- version,
1755
- windowOptions,
1756
- getLabel
1757
- });
1758
- }, [moduleActions, isDesktop]);
1759
- const onCloseLocal = () => {
1760
- const fnClose = fnQueryClose || onClose;
1761
- fnClose && fnClose(windowId);
1762
- };
1763
- const maxNormalize = (e) => {
1764
- if (maximizedId === windowId) {
1765
- normalizeLayouts(areaId);
1766
- } else {
1767
- maximizeLayout(areaId, windowId);
1768
- }
1769
- e.stopPropagation();
1770
- };
1771
- const colapedToggle = (e) => {
1772
- if (!colapsed) {
1773
- colapseLayoutItem(areaId, windowId);
1774
- } else {
1775
- unColapseLayoutItem(areaId, windowId);
1776
- }
1777
- e.stopPropagation();
1778
- };
1779
- if (isSkeleton) {
1780
- return /* @__PURE__ */ jsx(WindowHeaderSkeleton, {});
1781
- }
1782
- return /* @__PURE__ */ jsxs("div", { className: clsx(areasViewerClasses.windowHeader, "m4l_draggable_handle"), children: [
1783
- /* @__PURE__ */ jsx(LinearProgressIndeterminate, {}),
1784
- /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowHeaderContent, children: [
1785
- /* @__PURE__ */ jsx(Icon, { src: url_icon, size: "medium" }),
1786
- /* @__PURE__ */ jsx(Typography, { className: areasViewerClasses.windowHeaderTitle, variant: "h5", children: `${title}` }),
1787
- /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowHeaderCancelHandle, children: [
1788
- !colapsed && /* @__PURE__ */ jsx(MainActions, { windowId }),
1789
- !colapsed && menuActions.length > 0 && /* @__PURE__ */ jsx(
1790
- MemonizedMenuActions,
1791
- {
1792
- arrowType: "no-arrow",
1793
- marginTop: "12px!important",
1794
- marginLeft: "14px!important",
1795
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
1796
- transformOrigin: { vertical: "top", horizontal: "right" },
1797
- menuActions,
1798
- toolTip: getLabel(getAreasDictionary(DICCTIONARY.label_module_actions))
1799
- }
1800
- ),
1801
- !colapsed && (emergeType === "layout" || emergeType === "popup") && /* @__PURE__ */ jsx(
1802
- IconButton$1,
1803
- {
1804
- className: "m4l_draggableCancel",
1805
- onClick: maxNormalize,
1806
- "aria-label": "click",
1807
- src: maximizedId === windowId ? `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.NORMALIZE}` : `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.MAXIMIZE}`,
1808
- tooltip: getLabel(
1809
- getAreasDictionary(
1810
- maximizedId === windowId ? DICCTIONARY.label_minimize_window : DICCTIONARY.label_maximize_window
1811
- )
1812
- )
1813
- }
1814
- ),
1815
- !maximizedId && (emergeType === "layout" || emergeType === "popup") && /* @__PURE__ */ jsx(
1816
- IconButton$1,
1817
- {
1818
- className: "m4l_draggableCancel",
1819
- onClick: colapedToggle,
1820
- "aria-label": "click",
1821
- src: !colapsed ? `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.COLAPSE}` : `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.UNCOLPASE}`,
1822
- tooltip: getLabel(
1823
- getAreasDictionary(
1824
- !colapsed ? DICCTIONARY.label_collapse_window : DICCTIONARY.label_uncollapse_window
1825
- )
1826
- )
1827
- }
1828
- ),
1829
- onClose && /* @__PURE__ */ jsx(
1830
- IconButton$1,
1831
- {
1832
- className: "m4l_draggableCancel",
1833
- onPointerDown: onCloseLocal,
1834
- "aria-label": "click",
1835
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.CLOSE}`,
1836
- tooltip: getLabel(getAreasDictionary(DICCTIONARY.label_close_window))
1837
- }
1838
- )
1839
- ] })
1840
- ] })
1841
- ] });
1842
- }
1843
- const MicroFrontend = (props) => {
1844
- return /* @__PURE__ */ jsx(MFLoader, { ...props });
1845
- };
1846
- const MemonizedMicroFrontend = React__default.memo(MicroFrontend);
1847
- const Component = (props) => {
1848
- const { component, dynamicMFStore, windowTools } = props;
1849
- return /* @__PURE__ */ jsx(WindowToolsMFProvider, { ...windowTools, children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, { store: dynamicMFStore, children: /* @__PURE__ */ jsx("div", { className: areasViewerClasses.containerComponent, children: typeof component === "function" ? component({ windowTools, dynamicMFStore }) : component }) }) });
1850
- };
1851
- React__default.memo(Component);
1852
- const WindowRoot = styled$1("div")`
1853
- inset: 0;
1854
- position: absolute;
1855
- display: flex;
1856
- flex-direction: column;
1857
- /* height: 100%; */
1858
- /* width: 100%; */
1859
- overflow: hidden;
1860
- border: 1px solid gray;
1861
-
1862
- background-color: ${(props) => props.theme.vars.palette.background.default};
1863
- padding: ${(props) => props.theme.spacing(0)};
1864
- &.${areasViewerClasses.selected} {
1865
- border-top: 1px solid green;
1866
- }
1867
-
1868
- // windowHeader
1869
- /*
1870
- &.${areasViewerClasses.loading} .${areasViewerClasses.windowHeader} {
1871
- border-bottom: 2px solid red !important;
1872
- }
1873
- */
1874
- // windowHeaderTitle
1875
- & .${areasViewerClasses.windowHeaderTitle} {
1876
- width: 100%;
1877
- max-width: 100%;
1878
- overflow: hidden;
1879
- white-space: nowrap;
1880
- color: ${(props) => props.theme.vars.palette.text.primary};
1881
- text-overflow: ellipsis;
1882
- }
1883
-
1884
- & .${areasViewerClasses.windowHeaderCancelHandle} {
1885
- display: flex;
1886
- cursor: default;
1887
- }
1888
-
1889
- // windowHeaderMainActions
1890
- & .${areasViewerClasses.windowHeaderMainActions} {
1891
- display: flex;
1892
-
1893
- gap: 4px;
1894
- }
1895
-
1896
- // windowHeaderMainActions
1897
- & .${areasViewerClasses.windowContent} {
1898
- flex-grow: 1;
1899
- position: relative;
1900
- }
1901
-
1902
- & .${areasViewerClasses.windowContent}.${areasViewerClasses.colapsed} {
1903
- display: none !important;
1904
- }
1905
- // windowModalRoot
1906
- & .${areasViewerClasses.windowModalRoot} {
1907
- padding: 16px;
1908
- }
1909
-
1910
- // windowToastiesContainer
1911
- & .${areasViewerClasses.windowToastiesContainer} {
1912
- padding: 4px;
1913
- }
1914
-
1915
- // windowToastyContainer
1916
- & .${areasViewerClasses.windowToastyContainer} {
1917
- display: flex;
1918
- flex-direction: column;
1919
- }
1920
- // windowToastyContainer
1921
- & .${areasViewerClasses.windowToastyContainer}.${areasViewerClasses.success} {
1922
- background-color: ${(props) => props.theme.vars.palette.success.main};
1923
- }
1924
-
1925
- // windowToastyMeesageButtonsContainer
1926
- & .${areasViewerClasses.windowToastyMeesageButtonsContainer} {
1927
- display: flex;
1928
- }
1929
- & .MuiLinearProgress-root {
1930
- width: 100%;
1931
- }
1932
-
1933
- // windowToastyMessage
1934
- & .${areasViewerClasses.windowToastyMessage} {
1935
- flex-grow: 1;
1936
- }
1937
-
1938
- // windowToastyContainer
1939
- & .${areasViewerClasses.windowToastyPin}.${areasViewerClasses.pinIn} {
1940
- border: 1px solid red;
1941
- }
1942
-
1943
- ${(props) => props.theme.components?.M4LAreasViewerWindow?.styleOverrides}
1944
- `;
1945
- function Toasty(props) {
1946
- const { windowId, toastyId } = props;
1947
- const toasty = useAreasStore(
1948
- (state) => state.hashWindows[windowId].hashToasties[toastyId],
1949
- shallow
1950
- );
1951
- const { pinToast: pinToasty, closeToast: closeToasty } = useAreasStore(
1952
- (state) => state.windowActions,
1953
- shallow
1954
- );
1955
- const { host_static_assets, environment_assets } = useEnvironment();
1956
- return /* @__PURE__ */ jsx(
1957
- "div",
1958
- {
1959
- className: clsx(areasViewerClasses.windowToastyContainer, areasViewerClasses[toasty.type]),
1960
- children: /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowToastyMeesageButtonsContainer, children: [
1961
- /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowToastyMessage, children: [
1962
- toasty.timer ? /* @__PURE__ */ jsx(LinearProgress, { variant: "determinate", value: toasty.percentExecuted }) : null,
1963
- toasty.message
1964
- ] }),
1965
- /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowToastyButtonsContainer, children: [
1966
- /* @__PURE__ */ jsx(
1967
- IconButton$1,
1968
- {
1969
- className: clsx(
1970
- areasViewerClasses.windowToastyPin,
1971
- toasty.timer ? null : areasViewerClasses.pinIn
1972
- ),
1973
- onClick: () => {
1974
- pinToasty(windowId, toastyId);
1975
- },
1976
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.TOASTY_PIN}`
1977
- }
1978
- ),
1979
- /* @__PURE__ */ jsx(
1980
- IconButton$1,
1981
- {
1982
- className: areasViewerClasses.windowToastyClose,
1983
- onClick: () => {
1984
- closeToasty(windowId, toastyId);
1985
- },
1986
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.TOASTY_CLOSE}`
1987
- }
1988
- )
1989
- ] })
1990
- ] })
1991
- }
1992
- );
1993
- }
1994
- function Toasties(props) {
1995
- const { windowId } = props;
1996
- const tosties = useAreasStore((state) => state.hashWindows[windowId].toasties, shallow);
1997
- if (tosties.length === 0) {
1998
- return null;
1999
- }
2000
- return /* @__PURE__ */ jsx("div", { className: areasViewerClasses.windowToastiesContainer, children: /* @__PURE__ */ jsx("div", { className: areasViewerClasses.windowToastiesContainerTostys, children: tosties.map((t) => {
2001
- return /* @__PURE__ */ jsx(Toasty, { windowId, toastyId: t.id }, t.id);
2002
- }) }) });
2003
- }
2004
- const Window = (props) => {
2005
- const { areaId, windowId } = props;
2006
- const [emergeType, moduleId, winType] = useAreasStore((state) => {
2007
- return [
2008
- state.hashWindows[windowId]?.emergeType,
2009
- state.hashWindows[windowId]?.moduleId,
2010
- state.hashWindows[windowId]?.winType
2011
- ];
2012
- }, shallow);
2013
- const selected = useAreasStore((state) => {
2014
- return emergeType === "layout" ? state.hashAreas[areaId]?.currentLayoutId : state.hashAreas[areaId]?.currentPopUpId;
2015
- }) === windowId;
2016
- const mfProps = useAreasStore((state) => state.hashWindows[windowId]?.mfProps, shallow);
2017
- const component = useAreasStore(
2018
- (state) => state.hashWindows[windowId]?.component,
2019
- shallow
2020
- );
2021
- const loading = useAreasStore((state) => state.hashWindows[windowId]?.loading, shallow);
2022
- const status = useAreasStore((state) => state.hashWindows[windowId]?.status, shallow);
2023
- const dynamicMFStore = useAreasStore(
2024
- (state) => state.hashWindows[windowId]?.dynamicMFStore,
2025
- shallow
2026
- );
2027
- const {
2028
- setActions,
2029
- getCookie,
2030
- getCookies,
2031
- setCookie,
2032
- close,
2033
- startProgress,
2034
- stopProgress,
2035
- toast,
2036
- setFnQueryClose
2037
- } = useAreasStore((state) => state.windowActions, shallow);
2038
- const { selectLayout } = useAreasStore((state) => state.areaActions, shallow);
2039
- const { loadCookiesFromApi } = useAreasStore((state) => state.windowActions, shallow);
2040
- const onTouch = () => {
2041
- if (!selected) {
2042
- selectLayout(areaId, props.windowId);
2043
- }
2044
- };
2045
- const windowTools = useMemo(
2046
- () => ({
2047
- getWindowId: () => windowId,
2048
- setActions: (newActions, version) => {
2049
- setActions(windowId, newActions, version);
2050
- },
2051
- getCookie: (id) => getCookie(windowId, id),
2052
- getCookies: (type) => getCookies(windowId, type),
2053
- setCookie: (id, type, cookie) => {
2054
- setCookie(windowId, id, type, cookie);
2055
- },
2056
- close: () => close(windowId),
2057
- startProgress: () => startProgress(windowId),
2058
- stopProgress: () => stopProgress(windowId),
2059
- setFnQueryClose: (fnQueryClose) => {
2060
- setFnQueryClose(windowId, fnQueryClose);
2061
- },
2062
- toast: (toastyOptions) => {
2063
- toast(windowId, toastyOptions);
2064
- }
2065
- }),
2066
- []
2067
- );
2068
- useEffect(() => {
2069
- if (status === "init") {
2070
- loadCookiesFromApi(windowId);
2071
- }
2072
- }, [status]);
2073
- if (status === void 0) {
2074
- return null;
2075
- }
2076
- return /* @__PURE__ */ jsx(
2077
- WindowRoot,
2078
- {
2079
- role: "presentation",
2080
- className: clsx(
2081
- areasViewerClasses.windowRoot,
2082
- selected ? areasViewerClasses.selectedWindow : null,
2083
- loading ? areasViewerClasses.loading : null,
2084
- emergeType === "popup" ? areasViewerClasses.windowPopupRoot : null,
2085
- emergeType === "modal" ? areasViewerClasses.windowModalRoot : null
2086
- ),
2087
- onMouseDown: onTouch,
2088
- ...process.env.NODE_ENV !== "production" ? {
2089
- [TEST_PROP_ID]: getNameDataTestId$1(
2090
- AREAS_VIEWER_CLASS_NAME,
2091
- "windowRoot",
2092
- `${emergeType}`
2093
- )
2094
- } : {},
2095
- children: /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowRootContainer, children: [
2096
- /* @__PURE__ */ jsx(Header, { areaId, windowId, emergeType }),
2097
- /* @__PURE__ */ jsx(Toasties, { windowId }),
2098
- /* @__PURE__ */ jsxs(
2099
- "div",
2100
- {
2101
- className: clsx(
2102
- areasViewerClasses.windowContent
2103
- ),
2104
- children: [
2105
- status === "init" ? /* @__PURE__ */ jsx(Fragment, { children: "Cargando..." }) : null,
2106
- status === "loaded" ? winType === "microfrontend" ? /* @__PURE__ */ jsx(
2107
- MemonizedMicroFrontend,
2108
- {
2109
- moduleId,
2110
- dynamicMFStore,
2111
- windowTools,
2112
- ...mfProps
2113
- }
2114
- ) : /* @__PURE__ */ jsx(
2115
- Component,
2116
- {
2117
- moduleId,
2118
- dynamicMFStore,
2119
- windowTools,
2120
- component
2121
- }
2122
- ) : null
2123
- ]
2124
- }
2125
- )
2126
- ] })
2127
- }
2128
- );
2129
- };
2130
- React__default.memo(Window);
2131
- const ResizeHandle = React__default.forwardRef(
2132
- (props, ref) => {
2133
- const { handleAxis, ...restProps } = props;
2134
- return /* @__PURE__ */ jsx(
2135
- "div",
2136
- {
2137
- ref,
2138
- className: clsx(
2139
- `react-resizable-handle react-resizable-handle-${handleAxis}`,
2140
- areasViewerClasses.resizeHandle
2141
- ),
2142
- ...restProps
2143
- }
2144
- );
2145
- }
2146
- );
2147
- const ResponsiveGridLayout = withSizeProvider(Responsive);
2148
- const AreaGridLayout = (props) => {
2149
- const { areaId } = props;
2150
- const hashLayoutItems = useAreasStore((state) => state.hashAreas[areaId].layoutItemsIds, shallow);
2151
- const layouts = useAreasStore((state) => state.hashAreas[areaId].layouts, shallow);
2152
- const breakpoints = useAreasStore((state) => state.hashAreas[areaId].breakpoints, shallow);
2153
- const maximizedId = useAreasStore((state) => state.hashAreas[areaId].maximizedId, shallow);
2154
- const cols = useAreasStore((state) => state.hashAreas[areaId].cols, shallow);
2155
- const { onBreakpointsLayoutsChange, onContainerChange } = useAreasStore(
2156
- (state) => state.areaActions,
2157
- shallow
2158
- );
2159
- return /* @__PURE__ */ jsx(
2160
- ResponsiveGridLayout,
2161
- {
2162
- autoSize: false,
2163
- compactType: "vertical",
2164
- measureBeforeMount: true,
2165
- resizeHandles: ["nw", "se"],
2166
- className: clsx(
2167
- areasViewerClasses.areaGridLayout,
2168
- `${areasViewerClasses.areaGridLayout}-${areaId}`
2169
- ),
2170
- layouts,
2171
- onLayoutChange: (layout, newLayouts) => onBreakpointsLayoutsChange(areaId, layout, newLayouts),
2172
- draggableHandle: ".m4l_draggable_handle",
2173
- draggableCancel: `.${areasViewerClasses.windowHeaderCancelHandle}`,
2174
- layoutItemRender: (p) => {
2175
- if (hashLayoutItems.indexOf(p.i) === -1) {
2176
- return /* @__PURE__ */ jsx(Fragment, {});
2177
- }
2178
- if (p.type === "placeholder") {
2179
- return /* @__PURE__ */ jsx("div", {});
2180
- }
2181
- return /* @__PURE__ */ jsx(Window, { windowId: p.i, areaId });
2182
- },
2183
- breakpoints,
2184
- colapsedHeight: RESPONSIVE_COLAPSED_HEIGHTS,
2185
- rowHeight: RESPONSIVE_ROW_HEIGHTS,
2186
- cols,
2187
- containerMargin: [MARGIN_GRIDLAYOUT, MARGIN_GRIDLAYOUT],
2188
- containerPadding: [PADDING_GRIDLAYOUT, PADDING_GRIDLAYOUT],
2189
- onContainerChange: (e) => {
2190
- onContainerChange(areaId, e);
2191
- },
2192
- preventCollision: false,
2193
- maximizeId: maximizedId,
2194
- resizeHandle: /* @__PURE__ */ jsx(ResizeHandle, {})
2195
- }
2196
- );
2197
- };
2198
- const PanelWindows = (props) => {
2199
- const { areaId } = props;
2200
- const status = useAreasStore((state) => state.hashAreas[areaId].status);
2201
- const maximizedId = useAreasStore((state) => state.hashAreas[areaId].maximizedId);
2202
- const maximizedIdParent = useAreasStore(
2203
- (state) => state.hashWindows[maximizedId || ""]?.parentLayoutId || void 0
2204
- );
2205
- const hashLayoutItems = useAreasStore(
2206
- (state) => state.hashAreas[areaId].layoutItemsIds.filter((itemId) => state.hashWindows[itemId].emergeType === "layout").map((key) => ({
2207
- i: key,
2208
- url_icon: state.hashWindows[key].url_icon,
2209
- title: state.hashWindows[key].title,
2210
- moduleId: state.hashWindows[key].moduleId,
2211
- emergeType: state.hashWindows[key].emergeType,
2212
- windowId: state.hashWindows[key].windowId
2213
- })),
2214
- shallow
2215
- );
2216
- const { maximizeLayout } = useAreasStore((state) => state.areaActions);
2217
- const onTouched = (layoutId) => {
2218
- maximizeLayout(areaId, layoutId);
2219
- };
2220
- const location = useLocation();
2221
- const searchParams = new URLSearchParams(location.search);
2222
- const currentParam = searchParams.get("module");
2223
- if (status === "loaded") {
2224
- if (!maximizedId || hashLayoutItems.length < 2) {
2225
- return null;
2226
- }
2227
- return /* @__PURE__ */ jsx("div", { className: areasViewerClasses.panelWindowsRoot, children: hashLayoutItems.map((kl) => {
2228
- return /* @__PURE__ */ jsx(
2229
- "div",
2230
- {
2231
- className: clsx(
2232
- areasViewerClasses.panelWindowsButtonContainer,
2233
- maximizedId === kl.i && kl.emergeType !== "popup" || maximizedIdParent === kl.windowId && kl.moduleId === currentParam ? areasViewerClasses.selected : null
2234
- ),
2235
- children: /* @__PURE__ */ jsx(
2236
- IconButton$1,
2237
- {
2238
- src: kl.url_icon,
2239
- size: "small",
2240
- onClick: () => onTouched(kl.i),
2241
- tooltip: maximizedId !== kl.i ? kl.title : void 0
2242
- }
2243
- )
2244
- },
2245
- kl.i
2246
- );
2247
- }) });
2248
- } else {
2249
- return null;
2250
- }
2251
- };
2252
- const InnerForHooks = (props) => {
2253
- const { areaId } = props;
2254
- const isDesktop = useResponsiveDesktop();
2255
- const status = useAreasStore((state) => state.hashAreas[areaId].status);
2256
- return /* @__PURE__ */ jsxs(
2257
- "div",
2258
- {
2259
- className: clsx(
2260
- areasViewerClasses.areaGridLayoutPanelContainer,
2261
- `${areasViewerClasses.areaGridLayoutPanelContainer}-${areaId}`
2262
- ),
2263
- children: [
2264
- status === "loaded" ? /* @__PURE__ */ jsx(AreaGridLayout, { areaId }) : /* @__PURE__ */ jsx(LoadingError, { status, action: () => {
2265
- } }),
2266
- isDesktop ? /* @__PURE__ */ jsx(PanelWindows, { areaId }) : null
2267
- ]
2268
- }
2269
- );
2270
- };
2271
- const Area = (props) => {
2272
- const { selected, areaId } = props;
2273
- const classesAreaRoot = useAreasStore((state) => state.viwerClasses.areaRoot);
2274
- const status = useAreasStore((state) => state.hashAreas[areaId].status);
2275
- if (status === "init") {
2276
- return null;
2277
- }
2278
- return /* @__PURE__ */ jsx(
2279
- "div",
2280
- {
2281
- className: clsx(
2282
- classesAreaRoot,
2283
- selected ? areasViewerClasses.selected : null,
2284
- status === "loading" ? areasViewerClasses.loading : null
2285
- ),
2286
- children: /* @__PURE__ */ jsx(InnerForHooks, { areaId })
2287
- }
2288
- );
2289
- };
2290
- Area.displayName = "Area";
2291
- styled("div")(({ theme }) => ({
2292
- display: "flex",
2293
- flexDirection: "column",
2294
- height: "100%",
2295
- overflow: "hidden",
2296
- padding: theme.spacing(3)
2297
- }));
2298
- const WrapperWindowModal = styled(Dialog)(({ theme }) => ({
2299
- hola: 1,
2300
- backgroundColor: theme.vars.palette.background.paper,
2301
- "& .MuiDialog-container": {},
2302
- "&.m4l_selected": {
2303
- borderTop: "1px solid green"
2304
- },
2305
- ...theme.components?.M4LAreasViewerModal?.styleOverrides
2306
- }));
2307
- const WindowModal = (props) => {
2308
- const { windowId } = props;
2309
- const { onClose } = useAreasStore((state) => state.hashWindowsModals[windowId]);
2310
- const { host_static_assets, environment_assets } = useEnvironment();
2311
- const isDesktop = useResponsiveDesktop();
2312
- const DragabblePaperComponent = (_props) => {
2313
- return /* @__PURE__ */ jsx(
2314
- cjs.exports,
2315
- {
2316
- handle: ".m4l_draggable_handle",
2317
- bounds: "parent",
2318
- children: /* @__PURE__ */ jsx(
2319
- ResizeableWindow,
2320
- {
2321
- width: props.windowProps?.width || 400,
2322
- height: props.windowProps?.height || 300,
2323
- handle: (resizeHandle, ref) => /* @__PURE__ */ jsx("div", { ref, children: /* @__PURE__ */ jsx(
2324
- Icon,
2325
- {
2326
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS$1.RESIZE}`,
2327
- className: `custom-handle custom-handle-${resizeHandle}`
2328
- }
2329
- ) }, resizeHandle),
2330
- children: /* @__PURE__ */ jsx(Window, { ...props })
2331
- }
2332
- )
2333
- }
2334
- );
2335
- };
2336
- function PaperComponent(_props) {
2337
- return /* @__PURE__ */ jsx(Window, { ...props });
2338
- }
2339
- return /* @__PURE__ */ jsx(
2340
- WrapperWindowModal,
2341
- {
2342
- className: areasViewerClasses.windowModalRoot,
2343
- open: true,
2344
- scroll: "paper",
2345
- onKeyDown: (event) => {
2346
- if (event.key === "Escape") {
2347
- onClose && onClose(windowId);
2348
- }
2349
- },
2350
- "aria-labelledby": "child-modal-title",
2351
- "aria-describedby": "child-modal-description",
2352
- PaperComponent: isDesktop ? DragabblePaperComponent : PaperComponent,
2353
- maxWidth: false,
2354
- fullWidth: !isDesktop,
2355
- fullScreen: false,
2356
- disableEnforceFocus: true
2357
- }
2358
- );
2359
- };
2360
- const MemonizedWindowModal = React__default.memo(WindowModal);
2361
- function AreasViewer() {
2362
- const areas = useAreasStore((state) => state.areasIds, shallow);
2363
- const windowsModals = useAreasStore((state) => state.windowsModals);
2364
- const hashWindowsModals = useAreasStore((state) => state.hashWindowsModals);
2365
- const currentArea = useAreasStore((state) => state.currentAreaId);
2366
- const status = useAreasStore((state) => state.ownerState.status);
2367
- const classesRoot = useAreasStore((state) => state.viwerClasses.root);
2368
- const { init } = useAreasStore((state) => state.areasActions);
2369
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2370
- /* @__PURE__ */ jsx(
2371
- AreasViewerRoot,
2372
- {
2373
- className: classesRoot,
2374
- ...process.env.NODE_ENV !== "production" ? {
2375
- [TEST_PROP_ID]: getNameDataTestId$1(
2376
- AREAS_VIEWER_CLASS_NAME,
2377
- "root",
2378
- ""
2379
- )
2380
- } : {},
2381
- children: status === "loaded" ? areas.map((area) => {
2382
- return /* @__PURE__ */ jsx(Area, { areaId: area, selected: currentArea === area }, area);
2383
- }) : /* @__PURE__ */ jsx(LoadingError, { status, action: () => init() })
2384
- }
2385
- ),
2386
- windowsModals.map((wm) => {
2387
- if (hashWindowsModals[wm]) {
2388
- return /* @__PURE__ */ jsx(MemonizedWindowModal, { ...hashWindowsModals[wm] }, wm);
2389
- }
2390
- return null;
2391
- })
2392
- ] });
2393
- }
2394
- const formatterClasses = generateUtilityClasses(COMPONENT_CLASS_NAME, [
2395
- "root",
2396
- "booleanFormatterIcon",
2397
- "booleanFormatterCheck"
2398
- ]);
2399
- const FormatterRootContainer = styled$1("div")(({ theme }) => ({
2400
- ...theme.components?.M4LFormatter?.styleOverrides
2401
- }));
2402
- const FormatterRoot = (props) => {
2403
- const { children } = props;
2404
- return /* @__PURE__ */ jsx(FormatterRootContainer, { className: formatterClasses.root, children });
2405
- };
2406
- function BooleanFormatter(props) {
2407
- const { presentationType, value, Component: Component2 = WrapperComponent } = props;
2408
- const { getLabel } = useModuleDictionary();
2409
- const { host_static_assets, environment_assets } = useEnvironment();
2410
- const final_value = value ?? false;
2411
- const srcCheckTrue = `${host_static_assets}/${environment_assets}/frontend/components/data_grid/components/boolean_formatter/assets/icons/check_true.svg`;
2412
- const srcCheckFalse = `${host_static_assets}/${environment_assets}/frontend/components/data_grid/components/boolean_formatter/assets/icons/check_false.svg`;
2413
- const memoComponent = useMemo(() => {
2414
- if (presentationType === "string_yes_no") {
2415
- return /* @__PURE__ */ jsx(Component2, { children: final_value ? getLabel(LABEL_BOOLEAN_YES) : getLabel(LABEL_BOOLEAN_NO) });
2416
- }
2417
- if (presentationType === "string_true_false") {
2418
- return /* @__PURE__ */ jsx(Component2, { children: final_value ? getLabel(LABEL_BOOLEAN_TRUE) : getLabel(LABEL_BOOLEAN_FALSE) });
2419
- }
2420
- return /* @__PURE__ */ jsx(FormatterRoot, { children: /* @__PURE__ */ jsx(Component2, { children: /* @__PURE__ */ jsx(
2421
- Icon,
2422
- {
2423
- src: final_value ? srcCheckTrue : srcCheckFalse,
2424
- className: clsx(
2425
- formatterClasses.root,
2426
- formatterClasses.booleanFormatterIcon,
2427
- final_value && formatterClasses.booleanFormatterCheck
2428
- )
2429
- }
2430
- ) }) });
2431
- }, [final_value]);
2432
- return memoComponent;
2433
- }
2434
- function getFormatDate(presentationType, value, format) {
2435
- const { dateFormatter } = useFormatter();
2436
- let finalFormat = format || dateFormatter.datetimeFormat;
2437
- let result;
2438
- let resultDate;
2439
- if (value === void 0 || value === null) {
2440
- return "-";
2441
- }
2442
- switch (presentationType) {
2443
- case "datetime":
2444
- finalFormat = format || dateFormatter.datetimeFormat;
2445
- break;
2446
- case "date":
2447
- finalFormat = format || dateFormatter.dateFormat;
2448
- break;
2449
- case "time":
2450
- finalFormat = format || dateFormatter.timeFormat;
2451
- break;
2452
- }
2453
- try {
2454
- if (typeof value === "number" || typeof value === "string") {
2455
- resultDate = new Date(value);
2456
- } else {
2457
- resultDate = value;
2458
- }
2459
- result = dateFormatter.formatDate(resultDate, finalFormat);
2460
- return result;
2461
- } catch (e) {
2462
- result = "-";
2463
- return result;
2464
- }
2465
- }
2466
- function DateFormatter(props) {
2467
- const { presentationType, value, format, Component: Component2 = WrapperComponent } = props;
2468
- return /* @__PURE__ */ jsx(Component2, { children: getFormatDate(presentationType, value, format) });
2469
- }
2470
- function getUncertaintyFormat(obProps, fieldValue, fieldSymbol, fieldUnit) {
2471
- let result = "";
2472
- const ranges = getPropertyByString(obProps, fieldValue);
2473
- const symbol = getPropertyByString(obProps, fieldSymbol);
2474
- const unit = getPropertyByString(obProps, fieldUnit);
2475
- if (ranges === void 0 || ranges === null || !Array.isArray(ranges) || typeof symbol !== "string" || typeof unit !== "string") {
2476
- return "[]";
2477
- }
2478
- ranges.map((obj, idx) => {
2479
- const cmc_min_closed = obj.cmc_min_closed != true ? "<" : "\u2264";
2480
- const cmc_max_closed = obj.cmc_max_closed != true ? "<" : "\u2264";
2481
- result = result.concat(
2482
- `${idx > 0 ? " " : ""}`,
2483
- obj.cmc_min !== obj.cmc_max ? `[${obj.cmc_min}${unit} ${cmc_min_closed} ${symbol} ${cmc_max_closed} ${obj.cmc_max}${unit} \xB1 ${obj.cmc_uncertainty}]` : `[${obj.cmc_min}${unit} \xB1 ${obj.cmc_uncertainty}]`
2484
- );
2485
- });
2486
- return result;
2487
- }
2488
- function UncertaintyFormatter(props) {
2489
- const { obProps, fieldValue, fieldSymbol, fieldUnit, Component: Component2 = WrapperComponent } = props;
2490
- return /* @__PURE__ */ jsx(Component2, { children: getUncertaintyFormat(obProps, fieldValue, fieldSymbol, fieldUnit) });
2491
- }
2492
- function getFormatPoints(obProps, fieldValue, fieldUnit, chainPoint) {
2493
- let result = "";
2494
- const points = evaluateWithContext(obProps, fieldValue);
2495
- const unit = evaluateWithContext(obProps, fieldUnit) || "";
2496
- if (points === void 0 || points === null || !Array.isArray(points)) {
2497
- return "[]";
2498
- }
2499
- points.map((point) => {
2500
- if (point) {
2501
- result = !chainPoint ? result.concat(`[${point}${unit}]`) : result.concat(`[${evaluateWithContext(point, chainPoint)}${unit}]`);
2502
- }
2503
- });
2504
- return result;
2505
- }
2506
- function PointsFormatter(props) {
2507
- const { obProps, fieldValue, fieldUnit, Component: Component2 = WrapperComponent } = props;
2508
- return /* @__PURE__ */ jsx(Component2, { children: getFormatPoints(obProps, fieldValue, fieldUnit) });
2509
- }
2510
- function getFormatConcatenated(values, separator) {
2511
- const returnSymbol = "";
2512
- if (values === null)
2513
- return returnSymbol;
2514
- if (!Array.isArray(values)) {
2515
- return values.toString();
2516
- } else {
2517
- if (values.length == 0)
2518
- return returnSymbol;
2519
- else {
2520
- const result = values.map((value) => {
2521
- if (value === null || value === void 0)
2522
- return returnSymbol;
2523
- else {
2524
- if (typeof value === "string" || typeof value === "number") {
2525
- return value.toString();
2526
- } else {
2527
- return returnSymbol;
2528
- }
2529
- }
2530
- });
2531
- const output = result.join(separator.toString());
2532
- return output.trim();
2533
- }
2534
- }
2535
- }
2536
- function ConcatenatedFormatter(props) {
2537
- const { values = [], separator = " ", Component: Component2 = WrapperComponent } = props;
2538
- return /* @__PURE__ */ jsx(Component2, { children: getFormatConcatenated(values, separator) });
2539
- }
2540
- function getFormatPrice(obProps, fieldValue, currency, decimalDigits) {
2541
- let result = "";
2542
- const value = getPropertyByString(obProps, fieldValue);
2543
- try {
2544
- result = Number(value).toLocaleString(navigator.language, {
2545
- currency,
2546
- style: "currency",
2547
- currencyDisplay: "symbol",
2548
- useGrouping: true,
2549
- maximumFractionDigits: decimalDigits
2550
- }) || "";
2551
- } catch (error) {
2552
- result = Number(value).toLocaleString("en-US", {
2553
- style: "currency",
2554
- currency: "USD",
2555
- currencyDisplay: "symbol",
2556
- useGrouping: true,
2557
- maximumFractionDigits: decimalDigits
2558
- }) || "";
2559
- }
2560
- return result;
2561
- }
2562
- function PriceFormatter(props) {
2563
- const { obProps, fieldValue, Component: Component2 = WrapperComponent } = props;
2564
- const { currencyFormatter } = useFormatter();
2565
- return /* @__PURE__ */ jsx(Component2, { children: getFormatPrice(obProps, fieldValue, currencyFormatter.code, currencyFormatter.decimalDigits) });
2566
- }
2567
- const DataGridRoot = styled("div")(({ theme }) => ({
2568
- display: "flex",
2569
- flexDirection: "column",
2570
- position: "absolute",
2571
- padding: "0px",
2572
- inset: "0px",
2573
- overflow: "hidden",
2574
- ...theme.components?.M4LDataGrid?.styleOverrides
2575
- }));
2576
- const DataGridContext = createContext(null);
2577
- const getColumnConfigByKey = (key, storeColumnsConfig) => {
2578
- let indexFind = -1;
2579
- return [
2580
- storeColumnsConfig.find((column, index) => {
2581
- if (column.key === key) {
2582
- indexFind = index;
2583
- }
2584
- return column.key === key;
2585
- }),
2586
- indexFind
2587
- ];
2588
- };
2589
- function getColumnsConfig(id, columns, remoteConfig = void 0) {
2590
- let columnsConfig;
2591
- if (remoteConfig) {
2592
- columnsConfig = remoteConfig.columnsConfig;
2593
- } else {
2594
- try {
2595
- const item = window.localStorage.getItem(`${id}_columns_config`);
2596
- columnsConfig = item !== null ? JSON.parse(item) : [];
2597
- } catch (e) {
2598
- columnsConfig = [];
2599
- }
2600
- }
2601
- return columns.map((column, index) => {
2602
- const [columnConfig = { ...column }, columnConfigIndex] = getColumnConfigByKey(
2603
- column.key,
2604
- columnsConfig
2605
- );
2606
- return {
2607
- key: column.key,
2608
- name: column.name,
2609
- hidden: column.hidden === void 0 ? false : column.hidden,
2610
- index: columnConfigIndex > -1 ? columnConfigIndex : index,
2611
- visible: columnConfig.visible === void 0 ? true : columnConfig.visible,
2612
- frozen: columnConfig.frozen === void 0 ? false : columnConfig.frozen,
2613
- orginalIndex: index,
2614
- originalVisible: column.visible === void 0 ? true : column.visible,
2615
- originalFrozen: column.frozen === void 0 ? false : column.frozen
2616
- };
2617
- }).sort((a, b) => a.index - b.index);
2618
- }
2619
- function getColumnsWidth(id, columns, remoteConfig) {
2620
- const newMap = /* @__PURE__ */ new Map();
2621
- let storeColumnsWidth;
2622
- try {
2623
- const item = window.localStorage.getItem(`${id}_columns_width`);
2624
- storeColumnsWidth = item !== null ? new Map(JSON.parse(item)) : /* @__PURE__ */ new Map();
2625
- } catch (e) {
2626
- storeColumnsWidth = /* @__PURE__ */ new Map();
2627
- }
2628
- for (let i = 0; i < columns.length; i++) {
2629
- let width;
2630
- if (remoteConfig) {
2631
- try {
2632
- width = remoteConfig.columnsWidths.get(columns[i].key);
2633
- } catch (error) {
2634
- }
2635
- }
2636
- if (width === void 0) {
2637
- const storeWidth = storeColumnsWidth.get(columns[i].key);
2638
- if (typeof storeWidth === "number") {
2639
- width = storeWidth;
2640
- }
2641
- }
2642
- if (width !== void 0) {
2643
- newMap.set(columns[i].key, width);
2644
- }
2645
- }
2646
- return newMap;
2647
- }
2648
- function saveColumnsWidth(id, storeColumnsWidth) {
2649
- localStorage.setItem(`${id}_columns_width`, JSON.stringify([...storeColumnsWidth]));
2650
- }
2651
- function saveColumnsConfig(id, columnsConfig) {
2652
- localStorage.setItem(`${id}_columns_config`, JSON.stringify(columnsConfig));
2653
- }
2654
- function getIndexRowHeightVariant(variant) {
2655
- if (variant === "compact") {
2656
- return 0;
2657
- }
2658
- if (variant === "standard") {
2659
- return 1;
2660
- }
2661
- return 2;
2662
- }
2663
- function DataGridProvider(props) {
2664
- const {
2665
- id,
2666
- children,
2667
- columns,
2668
- remoteConfig,
2669
- rows,
2670
- rowsCount,
2671
- rowActionsGetter,
2672
- rowHeights = [28, 32, 36],
2673
- rowHeaderHeights = [28, 32, 36],
2674
- initialRowHeightVariant = "compact",
2675
- checkedRows,
2676
- onCheckedRowsChange,
2677
- rowKeyGetter,
2678
- classes
2679
- } = props;
2680
- const [columnsWidths, setColumnsWidths] = useState(
2681
- /* @__PURE__ */ new Map()
2682
- );
2683
- const [columnsConfig, setColumnsConfigOptions] = useState(
2684
- () => []
2685
- );
2686
- const [rowsFilterCount, setRowFilterCount] = useState(rowsCount);
2687
- const [currentRowHeightVariant, setCurrentRowHeightVariant] = useState(() => {
2688
- if (typeof rowHeights !== typeof rowHeaderHeights) {
2689
- throw new Error("Must be same type rowheights and rowHeaderTypes");
2690
- }
2691
- if (typeof rowHeights === "number" && typeof rowHeaderHeights === "number") {
2692
- return {
2693
- rowHVariant: "compact",
2694
- rowHeight: rowHeights,
2695
- rowHeaderHeight: rowHeaderHeights
2696
- };
2697
- }
2698
- if (typeof rowHeights !== "number" && rowHeights.length !== 3) {
2699
- throw new Error("Must be 3 heights");
2700
- }
2701
- if (typeof rowHeaderHeights !== "number" && rowHeaderHeights.length !== 3) {
2702
- throw new Error("Must be 3 HeaderHeights");
2703
- }
2704
- return {
2705
- rowHVariant: initialRowHeightVariant,
2706
- rowHeight: typeof rowHeights !== "number" ? rowHeights[getIndexRowHeightVariant(initialRowHeightVariant)] : rowHeights,
2707
- rowHeaderHeight: typeof rowHeaderHeights !== "number" ? rowHeaderHeights[getIndexRowHeightVariant(initialRowHeightVariant)] : rowHeaderHeights
2708
- };
2709
- });
2710
- const finalRowHeights = useMemo(() => rowHeights, [rowHeights]);
2711
- let timerSaveColumns;
2712
- useEffect(() => {
2713
- }, [columnsConfig]);
2714
- useEffect(() => {
2715
- setColumnsWidths(getColumnsWidth(id, columns, remoteConfig));
2716
- setColumnsConfigOptions(getColumnsConfig(id, columns, remoteConfig));
2717
- }, [columns, id, remoteConfig]);
2718
- const onChangeColumnsConfig = useCallback(
2719
- (newColumnsConfig) => {
2720
- saveColumnsConfig(id, newColumnsConfig);
2721
- setColumnsConfigOptions(newColumnsConfig);
2722
- },
2723
- [setColumnsConfigOptions, id]
2724
- );
2725
- const onChangeColumnsOrder = useCallback(
2726
- (sourceKey, targetKey) => {
2727
- if (sourceKey === targetKey)
2728
- return;
2729
- const sourceColumnIndex = columnsConfig.findIndex((c) => c.key === sourceKey);
2730
- const targetColumnIndex = columnsConfig.findIndex((c) => c.key === targetKey);
2731
- const reorderedColumnsConfig = [...columnsConfig];
2732
- reorderedColumnsConfig.splice(
2733
- targetColumnIndex,
2734
- 0,
2735
- reorderedColumnsConfig.splice(sourceColumnIndex, 1)[0]
2736
- );
2737
- onChangeColumnsConfig(reorderedColumnsConfig);
2738
- },
2739
- [columnsConfig, onChangeColumnsConfig]
2740
- );
2741
- const onChangeColumnWidth = (columnKey, width) => {
2742
- columnsWidths.set(columnKey, Math.round(width));
2743
- if (timerSaveColumns) {
2744
- clearTimeout(timerSaveColumns);
2745
- }
2746
- timerSaveColumns = setTimeout(() => {
2747
- saveColumnsWidth(id, columnsWidths);
2748
- }, 500);
2749
- };
2750
- useEffect(() => {
2751
- setColumnsConfigOptions(getColumnsConfig(id, columns));
2752
- }, [columns]);
2753
- const setRowFilterCountInternal = (newRowsCount) => {
2754
- setRowFilterCount(newRowsCount);
2755
- };
2756
- const setCurrentRowHeightInternal = useCallback(
2757
- (newVariant) => {
2758
- if (typeof rowHeights === "number" || typeof rowHeaderHeights === "number") {
2759
- throw new Error("Only use setCurrentRowHeight with vector rowHeights");
2760
- }
2761
- setCurrentRowHeightVariant({
2762
- rowHVariant: newVariant,
2763
- rowHeight: rowHeights[getIndexRowHeightVariant(newVariant)],
2764
- rowHeaderHeight: rowHeaderHeights[getIndexRowHeightVariant(newVariant)]
2765
- });
2766
- },
2767
- [setCurrentRowHeightVariant, rowHeights, rowHeaderHeights]
2768
- );
2769
- return /* @__PURE__ */ jsx(
2770
- DataGridContext.Provider,
2771
- {
2772
- value: {
2773
- columnsConfig,
2774
- columnsWidths,
2775
- rowsCount: rowsFilterCount,
2776
- currentRowHeightVariant: currentRowHeightVariant.rowHVariant,
2777
- currentRowHeight: currentRowHeightVariant.rowHeight,
2778
- currentRowHeaderHeight: currentRowHeightVariant.rowHeaderHeight,
2779
- rows,
2780
- rowHeights: finalRowHeights,
2781
- checkedRows,
2782
- onChangeColumnsConfig,
2783
- onChangeColumnsOrder,
2784
- onChangeColumnWidth,
2785
- setRowsCount: setRowFilterCountInternal,
2786
- rowActionsGetter,
2787
- classes,
2788
- setRowHeightVariant: setCurrentRowHeightInternal,
2789
- onCheckedRowsChange,
2790
- rowKeyGetter
2791
- },
2792
- children
2793
- }
2794
- );
2795
- }
2796
- function useDataGrid() {
2797
- const context = useContext(DataGridContext);
2798
- if (!context)
2799
- throw new Error("useDataGrid context must be use inside DataGridContext");
2800
- return context;
2801
- }
2802
- const initialState = {
2803
- activeFilters: false,
2804
- setActiveFilters: voidFunction
2805
- };
2806
- const FilterContext = createContext(initialState);
2807
- function FilterProvider({ children, initialActiveFilters }) {
2808
- const [filterOptions, setFilterOptions] = useState({
2809
- activeFilters: initialActiveFilters
2810
- });
2811
- const onChangeFilter = (column, value) => {
2812
- const newMap = filterOptions.filters ? new Map(filterOptions.filters) : /* @__PURE__ */ new Map();
2813
- if (value !== "") {
2814
- newMap.set(column.key, { value, customFilter: column.customFilter });
2815
- } else {
2816
- newMap.delete(column.key);
2817
- }
2818
- setFilterOptions({
2819
- ...filterOptions,
2820
- filters: newMap
2821
- });
2822
- };
2823
- const setActiveFilters = (active) => {
2824
- if (active) {
2825
- setFilterOptions({ activeFilters: true, filters: /* @__PURE__ */ new Map() });
2826
- } else {
2827
- setFilterOptions({ activeFilters: false });
2828
- }
2829
- };
2830
- return /* @__PURE__ */ jsx(
2831
- FilterContext.Provider,
2832
- {
2833
- value: {
2834
- ...filterOptions,
2835
- onChangeFilter,
2836
- setActiveFilters
2837
- },
2838
- children
2839
- }
2840
- );
2841
- }
2842
- const useFilters = () => useContext(FilterContext);
2843
- function Filter() {
2844
- const { activeFilters, setActiveFilters } = useFilters();
2845
- const { host_static_assets, environment_assets } = useEnvironment();
2846
- const { classes } = useDataGrid();
2847
- const toggleIcon = () => {
2848
- setActiveFilters(!activeFilters);
2849
- };
2850
- return /* @__PURE__ */ jsx(
2851
- IconButton$1,
2852
- {
2853
- dictionaryTooltipId: activeFilters ? "data_grid.tooltip_filter_hide" : "data_grid.tooltip_filter_show",
2854
- className: classes.actionFilter,
2855
- onClick: toggleIcon,
2856
- "aria-label": "filter",
2857
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/filter.svg`
2858
- }
2859
- );
2860
- }
2861
- const WrapperColumnsConfig = styled("div")(({ theme }) => ({
2862
- color: theme.vars.palette.text.primary,
2863
- position: "relative",
2864
- display: "flex",
2865
- flexDirection: "column",
2866
- height: "100%",
2867
- width: "100%"
2868
- }));
2869
- styled("div")(({ theme }) => ({
2870
- color: theme.vars.palette.text.primary,
2871
- fontSize: theme.typography.h4.fontSize
2872
- }));
2873
- const DivSelColumns = styled("div")(({ theme }) => ({
2874
- ...theme.colorSchemes.finalTheme.typography.bodyDens,
2875
- color: theme.vars.palette.text.primary,
2876
- padding: `16px 8px`
2877
- }));
2878
- const WrapperDataGrid = styled("div")(() => ({
2879
- position: "relative",
2880
- display: "flex",
2881
- flexDirection: "column",
2882
- flexGrow: 1,
2883
- overflow: "auto"
2884
- }));
2885
- styled("div")(() => ({
2886
- display: "flex",
2887
- flexDirection: "row"
2888
- }));
2889
- const ColumnActions = styled("div")(() => ({
2890
- paddingTop: "16px",
2891
- paddingBottom: "8px",
2892
- display: "flex",
2893
- flexDirection: "row"
2894
- }));
2895
- styled("div")(({ theme }) => ({
2896
- paddingTop: theme.spacing(3),
2897
- display: "flex",
2898
- flexDirection: "row",
2899
- justifyContent: "flex-end",
2900
- "& > button": {
2901
- marginLeft: "10px"
2902
- }
2903
- }));
2904
- function ColumnUncertaintyFormatter(props) {
2905
- return (obProps) => {
2906
- return /* @__PURE__ */ jsx(UncertaintyFormatter, { obProps, ...props });
2907
- };
2908
- }
2909
- function ColumnPointsFormatter(props) {
2910
- return (obProps) => {
2911
- return /* @__PURE__ */ jsx(PointsFormatter, { obProps, ...props });
2912
- };
2913
- }
2914
- function ColumnNestedValueFormatter(props) {
2915
- const { fieldValue, Component: Component2 = WrapperComponent } = props;
2916
- return (obProps) => {
2917
- const property = getPropertyByString(obProps, fieldValue);
2918
- const value = typeof property === "object" ? "" : property;
2919
- return /* @__PURE__ */ jsx(Component2, { children: value });
2920
- };
2921
- }
2922
- function ColumnBooleanFormatter(props) {
2923
- const { fieldValue, presentationType, Component: Component2 } = props;
2924
- return (obProps) => {
2925
- const valueMaybeString = getPropertyByString(obProps, fieldValue);
2926
- let fixedValue;
2927
- if (typeof valueMaybeString === "boolean") {
2928
- fixedValue = valueMaybeString;
2929
- } else {
2930
- fixedValue = void 0;
2931
- }
2932
- return /* @__PURE__ */ jsx(
2933
- BooleanFormatter,
2934
- {
2935
- presentationType,
2936
- value: fixedValue,
2937
- Component: Component2
2938
- }
2939
- );
2940
- };
2941
- }
2942
- function ColumnDateFormatter(props) {
2943
- const { fieldValue, presentationType, Component: Component2 } = props;
2944
- return (obProps) => {
2945
- const valueMaybeDateStringNumber = getPropertyByString(obProps, fieldValue);
2946
- let fixedValue;
2947
- if (typeof valueMaybeDateStringNumber === "string" || typeof valueMaybeDateStringNumber === "number" || valueMaybeDateStringNumber instanceof Date) {
2948
- fixedValue = valueMaybeDateStringNumber;
2949
- } else {
2950
- fixedValue = "";
2951
- }
2952
- return /* @__PURE__ */ jsx(DateFormatter, { presentationType, value: fixedValue, Component: Component2 });
2953
- };
2954
- }
2955
- function ColumnConcatenatedValueFormatter(props) {
2956
- const { fieldValue, fieldSeparator, Component: Component2 } = props;
2957
- return (obProps) => {
2958
- const values = fieldValue.map((element) => {
2959
- const valueMaybeString = getPropertyByString(obProps, element);
2960
- let fixedValue;
2961
- if (typeof valueMaybeString === "string" || typeof valueMaybeString === "number") {
2962
- fixedValue = valueMaybeString;
2963
- } else {
2964
- fixedValue = "";
2965
- }
2966
- return fixedValue;
2967
- });
2968
- return /* @__PURE__ */ jsx(ConcatenatedFormatter, { values, separator: fieldSeparator, Component: Component2 });
2969
- };
2970
- }
2971
- function ColumnPriceFormatter(props) {
2972
- return (obProps) => {
2973
- return /* @__PURE__ */ jsx(PriceFormatter, { obProps, ...props });
2974
- };
2975
- }
2976
- const dataGridClasses = generateUtilityClasses(componentName$2, [
2977
- "root",
2978
- "actions",
2979
- "withPager",
2980
- "withNoPager",
2981
- "rowsCount",
2982
- "rowsCountLabel",
2983
- "rowsCountValue",
2984
- "densitySkeleton",
2985
- "actionDensityPopover",
2986
- "actionFilter",
2987
- "actionSettings",
2988
- "tableContaniner",
2989
- "wrapperDataGridCss",
2990
- "columnsConfigContainer",
2991
- "columnsLabelSetColumns",
2992
- "columnsConfigContent",
2993
- "columnsConfigGrid",
2994
- "columnsConfigActions",
2995
- "formatterColumn",
2996
- "skeletonFormatter",
2997
- "actionsFormatter",
2998
- "actionsConfigContainer",
2999
- "booleanFormatter",
3000
- "withActions"
3001
- ]);
3002
- function getDataGridUtilityClass(slot) {
3003
- return generateUtilityClass(componentName$2, slot);
3004
- }
3005
- const dataGridUtilityClasses = (ownerState) => {
3006
- const slots = {
3007
- root: ["root"],
3008
- actions: ["actions", ownerState.actionsProps.withPager ? "withPager" : "withNoPager"],
3009
- rowsCount: ["rowsCount"],
3010
- rowsCountLabel: ["rowsCountLabel"],
3011
- rowsCountValue: ["rowsCountValue"],
3012
- densitySkeleton: ["densitySkeleton"],
3013
- densityRoot: ["densityRoot"],
3014
- densityPopover: ["densityPopover"],
3015
- actionFilter: ["actionFilter"],
3016
- actionSettings: ["actionSettingsRoot"],
3017
- actionDensityPopover: ["actionDensityPopover"],
3018
- tableContaniner: ["tableContaniner", ownerState.withActions && "withActions"],
3019
- wrapperDataGridCss: ["wrapperDataGridCss"],
3020
- columnsConfigContainer: ["columnsConfigContainer"],
3021
- columnsLabelSetColumns: ["columnsLabelSetColumns"],
3022
- columnsConfigContent: ["columnsConfigContent"],
3023
- columnsConfigGrid: ["columnsConfigGrid"],
3024
- columnsConfigActions: ["columnsConfigActions"],
3025
- formatterColumn: ["formatterColumn"],
3026
- skeletonFormatter: ["skeletonFormatter"],
3027
- actionsFormatter: ["actionsFormatter"],
3028
- actionsConfigContainer: ["actionsConfigContainer"],
3029
- booleanFormatter: ["booleanFormatter"]
3030
- };
3031
- const composedClasses = unstable_composeClasses(slots, getDataGridUtilityClass, {});
3032
- return {
3033
- ...composedClasses
3034
- };
3035
- };
3036
- function ColumnInteractiveCheckFormatter(props) {
3037
- const { row, onRowChange, column } = props;
3038
- const handleChange = () => {
3039
- const newRow = { ...row };
3040
- newRow[column.key] = !row[column.key];
3041
- onRowChange(newRow);
3042
- };
3043
- return /* @__PURE__ */ jsx(
3044
- Checkbox,
3045
- {
3046
- size: "small",
3047
- checked: row[column.key] || false,
3048
- onChange: handleChange,
3049
- className: dataGridClasses.formatterColumn
3050
- }
3051
- );
3052
- }
3053
- function ColumnSetCheckFormatter(parameters) {
3054
- const { field, disabledGetter, rowKeyGetter, useHook } = parameters;
3055
- const formatter = (props) => {
3056
- const { row } = props;
3057
- const [checkedRows, setCheckedRows] = useHook(field);
3058
- const onChange = (checked, _isShiftClick) => {
3059
- const newCheckedRows = new Set(checkedRows);
3060
- if (checked) {
3061
- newCheckedRows.add(rowKeyGetter(props.row));
3062
- } else {
3063
- newCheckedRows.delete(rowKeyGetter(props.row));
3064
- }
3065
- setCheckedRows(newCheckedRows);
3066
- };
3067
- let disabled = false;
3068
- if (disabledGetter) {
3069
- disabled = disabledGetter(row);
3070
- }
3071
- return /* @__PURE__ */ jsx(
3072
- SelectCellFormatter,
3073
- {
3074
- value: checkedRows.has(rowKeyGetter(row)) || false,
3075
- disabled,
3076
- isCellSelected: props.isCellSelected,
3077
- onChange,
3078
- "aria-label": "Select"
3079
- }
3080
- );
3081
- };
3082
- return formatter;
3083
- }
3084
- function getRowsFromColumnsConfig(columnsConfig) {
3085
- return columnsConfig.filter((column) => !column.hidden).map(
3086
- (column) => ({
3087
- key: column.key,
3088
- name: column.name,
3089
- visible: column.visible === void 0 ? true : column.visible,
3090
- frozen: column.frozen === void 0 ? false : column.frozen,
3091
- originalIndex: column.orginalIndex,
3092
- originalFrozen: column.originalFrozen,
3093
- originalVisible: column.originalVisible
3094
- })
3095
- );
3096
- }
3097
- const ColumnsConfig = forwardRef((props, ref) => {
3098
- const refdata_grid = useRef(null);
3099
- const { onCloseSettings, columnsConfig, onChangeColumnsConfig, classes } = props;
3100
- const { getLabel } = useModuleDictionary();
3101
- const [isInit, setIsInit] = useState(true);
3102
- const [rows, setRows] = useState(getRowsFromColumnsConfig(columnsConfig));
3103
- const [selRows, setSelRows] = useState(() => /* @__PURE__ */ new Set());
3104
- const divRef = useRef(null);
3105
- const { host_static_assets, environment_assets } = useEnvironment();
3106
- useImperativeHandle(ref, () => ({
3107
- onClickIntro: handleIntro,
3108
- current: divRef.current
3109
- }));
3110
- const columnsdata_grid = useMemo(
3111
- () => [
3112
- {
3113
- key: "name",
3114
- name: getLabel("data_grid.settings_column_name"),
3115
- width: 200,
3116
- resizable: true,
3117
- type: "string"
3118
- },
3119
- {
3120
- key: "originalIndex",
3121
- name: getLabel("data_grid.settings_column_position"),
3122
- width: 50,
3123
- type: "number",
3124
- cellClass: "rdg-cell-align-center"
3125
- },
3126
- {
3127
- key: "visible",
3128
- name: getLabel("data_grid.settings_column_visible"),
3129
- width: 80,
3130
- type: "boolean",
3131
- formatter: ColumnInteractiveCheckFormatter,
3132
- cellClass: "rdg-cell-align-center"
3133
- },
3134
- {
3135
- key: "frozen",
3136
- name: getLabel("data_grid.settings_column_frozen"),
3137
- width: 80,
3138
- type: "boolean",
3139
- formatter: ColumnInteractiveCheckFormatter,
3140
- cellClass: "rdg-cell-align-center"
3141
- }
3142
- ],
3143
- [getLabel]
3144
- );
3145
- const checkAll = () => {
3146
- setRows(rows.map((row) => ({ ...row, visible: true })));
3147
- };
3148
- const unCheckAll = () => {
3149
- setRows(rows.map((row) => ({ ...row, visible: false })));
3150
- };
3151
- const restoreAll = () => {
3152
- setRows(
3153
- rows.map((row) => ({
3154
- ...row,
3155
- visible: row.originalVisible,
3156
- frozen: row.originalFrozen,
3157
- index: row.originalIndex
3158
- })).sort((a, b) => a.index - b.index)
3159
- );
3160
- };
3161
- useEffect(() => {
3162
- if (isInit === false) {
3163
- setRows(getRowsFromColumnsConfig(columnsConfig));
3164
- }
3165
- setIsInit(false);
3166
- }, [columnsConfig]);
3167
- const rowSelectedIndex = useMemo(() => {
3168
- let rowIndex = -1;
3169
- if (selRows.size !== 1)
3170
- return rowIndex;
3171
- const iterator = selRows.entries();
3172
- const entry = iterator.next().value[1];
3173
- rowIndex = rows.findIndex((row) => row.key === entry);
3174
- return rowIndex;
3175
- }, [rows, selRows]);
3176
- const handleMoveFirst = () => {
3177
- if (rowSelectedIndex === -1)
3178
- return -1;
3179
- const newRows = [...rows];
3180
- newRows.splice(rowSelectedIndex, 1);
3181
- newRows.splice(0, 0, rows[rowSelectedIndex]);
3182
- refdata_grid.current?.selectCell({ idx: 0, rowIdx: 0 });
3183
- setRows(newRows);
3184
- };
3185
- const handleMoveLast = () => {
3186
- if (rowSelectedIndex === -1)
3187
- return -1;
3188
- const newRows = [...rows];
3189
- newRows.splice(rowSelectedIndex, 1);
3190
- newRows.splice(newRows.length, 0, rows[rowSelectedIndex]);
3191
- refdata_grid.current?.selectCell({ idx: 0, rowIdx: newRows.length - 1 });
3192
- setRows(newRows);
3193
- };
3194
- const handleMoveUpDownd = (position) => {
3195
- if (rowSelectedIndex === -1)
3196
- return -1;
3197
- const newRows = [...rows];
3198
- const element = newRows[rowSelectedIndex];
3199
- newRows.splice(rowSelectedIndex, 1);
3200
- newRows.splice(rowSelectedIndex + position, 0, element);
3201
- refdata_grid.current?.selectCell({ idx: 0, rowIdx: rowSelectedIndex + position });
3202
- setRows(newRows);
3203
- };
3204
- const getColumnConfigByKey2 = (key) => {
3205
- const rowIndexFinded = rows.findIndex((row) => row.key === key);
3206
- if (rowIndexFinded > -1) {
3207
- return {
3208
- visible: rows[rowIndexFinded].visible,
3209
- frozen: rows[rowIndexFinded].frozen
3210
- };
3211
- }
3212
- return void 0;
3213
- };
3214
- const getRowIndex = (column) => {
3215
- const rowIndexFinded = rows.findIndex((row) => row.key === column.key);
3216
- if (rowIndexFinded > -1) {
3217
- return rowIndexFinded;
3218
- }
3219
- return columnsConfig.findIndex((columnConfig) => columnConfig.key === column.key);
3220
- };
3221
- const handleIntro = () => {
3222
- const newColumnsConfig = columnsConfig.map((columnConfig) => {
3223
- const newColumnConfig = { ...columnConfig };
3224
- if (!columnConfig.hidden) {
3225
- const columnConfigRow = getColumnConfigByKey2(columnConfig.key);
3226
- if (columnConfigRow) {
3227
- newColumnConfig.visible = columnConfigRow.visible;
3228
- newColumnConfig.frozen = columnConfigRow.frozen;
3229
- }
3230
- }
3231
- return newColumnConfig;
3232
- }).sort((a, b) => getRowIndex(a) - getRowIndex(b));
3233
- onChangeColumnsConfig(newColumnsConfig);
3234
- onCloseSettings();
3235
- };
3236
- const onInternalSelectedRowsChange = () => {
3237
- };
3238
- const onInternalRowsChange = (newRows) => {
3239
- setRows(newRows);
3240
- };
3241
- const onRowClick = (row) => {
3242
- if (selRows.has(row.key))
3243
- return;
3244
- const mySet = /* @__PURE__ */ new Set([row.key]);
3245
- setSelRows(mySet);
3246
- };
3247
- return /* @__PURE__ */ jsxs(WrapperColumnsConfig, { ref: divRef, className: classes.columnsConfigContainer, children: [
3248
- /* @__PURE__ */ jsx(DivSelColumns, { className: classes.columnsLabelSetColumns, children: getLabel("data_grid.settings_sel_columns") }),
3249
- /* @__PURE__ */ jsx(WrapperDataGrid, { className: classes.columnsConfigContent, children: /* @__PURE__ */ jsx("div", { className: classes.wrapperDataGridCss, children: /* @__PURE__ */ jsx(
3250
- DataGrid$1,
3251
- {
3252
- className: classes.columnsConfigGrid,
3253
- ref: refdata_grid,
3254
- columns: columnsdata_grid,
3255
- rows,
3256
- onRowsChange: onInternalRowsChange,
3257
- selectedRows: selRows,
3258
- onSelectedRowsChange: onInternalSelectedRowsChange,
3259
- onRowClick,
3260
- rowKeyGetter: (row) => row.key,
3261
- cellNavigationMode: "CHANGE_ROW",
3262
- defaultColumnOptions: { resizable: true, sortable: true }
3263
- }
3264
- ) }) }),
3265
- /* @__PURE__ */ jsxs(ColumnActions, { className: classes.columnsConfigActions, children: [
3266
- /* @__PURE__ */ jsx(
3267
- IconButton$1,
3268
- {
3269
- tooltip: getLabel("data_grid.settings_move_first"),
3270
- onClick: handleMoveFirst,
3271
- "aria-label": "move first place",
3272
- disabled: rowSelectedIndex < 1,
3273
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_first_place.svg`
3274
- }
3275
- ),
3276
- /* @__PURE__ */ jsx(
3277
- IconButton$1,
3278
- {
3279
- tooltip: getLabel("data_grid.settings_move_up"),
3280
- dictionaryTooltipId: "data_grid.settings_move_up",
3281
- onClick: () => handleMoveUpDownd(-1),
3282
- "aria-label": "move up place",
3283
- disabled: rowSelectedIndex < 1,
3284
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_up_place.svg`
3285
- }
3286
- ),
3287
- /* @__PURE__ */ jsx(
3288
- IconButton$1,
3289
- {
3290
- tooltip: getLabel("data_grid.settings_move_last"),
3291
- onClick: handleMoveLast,
3292
- "aria-label": "move last place",
3293
- disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
3294
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_last_place.svg`
3295
- }
3296
- ),
3297
- /* @__PURE__ */ jsx(
3298
- IconButton$1,
3299
- {
3300
- tooltip: getLabel("data_grid.settings_move_down"),
3301
- onClick: () => handleMoveUpDownd(1),
3302
- "aria-label": "move down place",
3303
- disabled: !!(rowSelectedIndex === rows.length - 1 || rowSelectedIndex === -1),
3304
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/move_down_place.svg`
3305
- }
3306
- ),
3307
- /* @__PURE__ */ jsx(
3308
- IconButton$1,
3309
- {
3310
- tooltip: getLabel("data_grid.settings_visible_all"),
3311
- onClick: checkAll,
3312
- "aria-label": "check visible all",
3313
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/check_all.svg`
3314
- }
3315
- ),
3316
- /* @__PURE__ */ jsx(
3317
- IconButton$1,
3318
- {
3319
- tooltip: getLabel("data_grid.settings_no_visible_all"),
3320
- onClick: unCheckAll,
3321
- "aria-label": "un check all",
3322
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/uncheck_all.svg`
3323
- }
3324
- ),
3325
- /* @__PURE__ */ jsx(
3326
- IconButton$1,
3327
- {
3328
- tooltip: getLabel("data_grid.settings_restore"),
3329
- onClick: restoreAll,
3330
- "aria-label": "Restore columns",
3331
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/restore_columns.svg`
3332
- }
3333
- )
3334
- ] })
3335
- ] });
3336
- });
3337
- ColumnsConfig.displayName = "ColumnsConfig";
3338
- function Settings() {
3339
- const { host_static_assets, environment_assets } = useEnvironment();
3340
- const { classes } = useDataGrid();
3341
- const modalSettings = useModalSettings();
3342
- return /* @__PURE__ */ jsx(
3343
- IconButton$1,
3344
- {
3345
- className: classes.actionSettings,
3346
- dictionaryTooltipId: "data_grid.tooltip_settings",
3347
- onClick: modalSettings,
3348
- "aria-label": "settings",
3349
- src: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/configuration.svg`
3350
- }
3351
- );
3352
- }
3353
- function RowsCount() {
3354
- const { rowsCount, classes } = useDataGrid();
3355
- const { getLabel } = useModuleDictionary();
3356
- const isSkeleton = useModuleSkeleton();
3357
- return /* @__PURE__ */ jsx("div", { className: classes.rowsCount, children: !isSkeleton ? /* @__PURE__ */ jsxs(Fragment, { children: [
3358
- /* @__PURE__ */ jsx("div", { className: classes.rowsCountLabel, children: getLabel("data_grid.rows") }),
3359
- /* @__PURE__ */ jsx("div", { className: classes.rowsCountValue, children: rowsCount })
3360
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3361
- /* @__PURE__ */ jsx("div", { className: classes.rowsCountLabel, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "40px", height: "16px" }) }),
3362
- /* @__PURE__ */ jsx("div", { className: classes.rowsCountValue, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "20px", height: "16px" }) })
3363
- ] }) });
3364
- }
3365
- function Density() {
3366
- const { host_static_assets, environment_assets } = useEnvironment();
3367
- const { rowHeights, currentRowHeightVariant, setRowHeightVariant, classes } = useDataGrid();
3368
- const { getLabel } = useModuleDictionary();
3369
- const menuActions = useMemo(() => {
3370
- if (typeof rowHeights === "number") {
3371
- return [];
3372
- }
3373
- return [
3374
- {
3375
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/compact.svg`,
3376
- onClick: () => setRowHeightVariant("compact"),
3377
- disabled: currentRowHeightVariant === "compact",
3378
- dictionaryField: "data_grid.density_compact"
3379
- },
3380
- {
3381
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/standard.svg`,
3382
- onClick: () => setRowHeightVariant("standard"),
3383
- disabled: currentRowHeightVariant === "standard",
3384
- dictionaryField: "data_grid.density_standard"
3385
- },
3386
- {
3387
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/confortable.svg`,
3388
- onClick: () => setRowHeightVariant("confortable"),
3389
- disabled: currentRowHeightVariant === "confortable",
3390
- dictionaryField: "data_grid.density_confortable"
3391
- }
3392
- ];
3393
- }, [
3394
- rowHeights,
3395
- currentRowHeightVariant,
3396
- setRowHeightVariant,
3397
- host_static_assets,
3398
- environment_assets
3399
- ]);
3400
- const theme = useTheme();
3401
- const currenViewIcon = useMemo(() => {
3402
- if (currentRowHeightVariant === "compact") {
3403
- return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/compact.svg`;
3404
- }
3405
- if (currentRowHeightVariant === "standard") {
3406
- return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/standard.svg`;
3407
- }
3408
- return `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/confortable.svg`;
3409
- }, [currentRowHeightVariant, host_static_assets, environment_assets]);
3410
- if (menuActions.length === 0) {
3411
- return /* @__PURE__ */ jsx(Fragment, {});
3412
- }
3413
- return /* @__PURE__ */ jsx(
3414
- MenuActions,
3415
- {
3416
- arrowType: "right-top",
3417
- className: classes.actionDensityPopover,
3418
- menuActionSx: theme.components?.M4LDataGridDensityPopover?.styleOverrides,
3419
- anchorOrigin: { vertical: "top", horizontal: "left" },
3420
- transformOrigin: { vertical: "top", horizontal: "right" },
3421
- menuActions,
3422
- urlIcon: currenViewIcon,
3423
- toolTip: getLabel("data_grid.tooltip_density")
3424
- }
3425
- );
3426
- }
3427
- const MobileMenuActions = () => {
3428
- const { host_static_assets, environment_assets } = useEnvironment();
3429
- const { currentRowHeightVariant, setRowHeightVariant } = useDataGrid();
3430
- const { activeFilters, setActiveFilters } = useFilters();
3431
- const modalSettings = useModalSettings();
3432
- const toggleIcon = () => {
3433
- setActiveFilters(!activeFilters);
3434
- };
3435
- const menuActions = [
3436
- {
3437
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/compact.svg`,
3438
- onClick: () => setRowHeightVariant("compact"),
3439
- disabled: currentRowHeightVariant === "compact",
3440
- dictionaryId: "data_grid.density_compact"
3441
- },
3442
- {
3443
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/standard.svg`,
3444
- onClick: () => setRowHeightVariant("standard"),
3445
- disabled: currentRowHeightVariant === "standard",
3446
- dictionaryId: "data_grid.density_standard"
3447
- },
3448
- {
3449
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/confortable.svg`,
3450
- onClick: () => setRowHeightVariant("confortable"),
3451
- disabled: currentRowHeightVariant === "confortable",
3452
- dictionaryId: "data_grid.density_confortable"
3453
- },
3454
- {
3455
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/filter.svg`,
3456
- onClick: () => toggleIcon(),
3457
- dictionaryId: activeFilters ? "data_grid.tooltip_filter_hide" : "data_grid.tooltip_filter_show"
3458
- },
3459
- {
3460
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/configuration.svg`,
3461
- onClick: () => modalSettings(),
3462
- dictionaryId: "data_grid.tooltip_settings"
3463
- }
3464
- ];
3465
- return /* @__PURE__ */ jsx(
3466
- MenuActions,
3467
- {
3468
- urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/data_grid/assets/icons/menu.svg`,
3469
- arrowType: "no-arrow",
3470
- marginTop: "12px",
3471
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
3472
- transformOrigin: { vertical: "top", horizontal: "right" },
3473
- menuActions
3474
- }
3475
- );
3476
- };
3477
- function Actions(props) {
3478
- const isXs = useResponsiveContainerStore((state) => state.isXs, shallow);
3479
- const { rowHeights, classes } = useDataGrid();
3480
- const isSkeleton = useModuleSkeleton();
3481
- const { getLabel } = useModuleDictionary();
3482
- const {
3483
- withRowsCount = true,
3484
- withPager = true,
3485
- pagerOptions,
3486
- withSettings = true,
3487
- settingsProps,
3488
- withLocalFilters
3489
- } = props;
3490
- return /* @__PURE__ */ jsxs("div", { className: classes.actions, children: [
3491
- withRowsCount && !isXs && /* @__PURE__ */ jsx(RowsCount, {}),
3492
- withPager && pagerOptions && /* @__PURE__ */ jsx(
3493
- Pager,
3494
- {
3495
- ...pagerOptions,
3496
- totalRecords: pagerOptions.totalRecords,
3497
- isSkeleton,
3498
- isXs,
3499
- labelRows: getLabel(dictionary.LABEL_ROWS_PER_PAGE),
3500
- labelOf: getLabel(dictionary.LABEL_OF)
3501
- }
3502
- ),
3503
- isXs ? /* @__PURE__ */ jsx(MobileMenuActions, {}) : /* @__PURE__ */ jsxs("div", { className: classes.actionsConfigContainer, children: [
3504
- typeof rowHeights !== "number" && /* @__PURE__ */ jsx(Density, {}),
3505
- withLocalFilters && /* @__PURE__ */ jsx(Filter, {}),
3506
- withSettings && /* @__PURE__ */ jsx(Settings, { ...settingsProps })
3507
- ] })
3508
- ] });
3509
- }
3510
- const DATAGRID_TEST_ID = "m4ldatagrid";
3511
- const PREFIX_TEST_ATTRIBUTE = "data-testid";
3512
- const TEST_PROP_COLUMNS = `${PREFIX_TEST_ATTRIBUTE}-${DATAGRID_TEST_ID}-columns`;
3513
- function DataGrid(props) {
3514
- const {
3515
- id,
3516
- withActions = true,
3517
- rows,
3518
- columns,
3519
- actionsProps,
3520
- selectedRows,
3521
- onSelectedRowsChange,
3522
- rowKeyGetter,
3523
- rowActionsGetter,
3524
- onRowsChange,
3525
- rowHeaderHeights,
3526
- rowHeights,
3527
- initialRowHeightVariant,
3528
- checkedRows,
3529
- onCheckedRowsChange,
3530
- dataTestId = ""
3531
- } = props;
3532
- const ownerState = {
3533
- actionsProps,
3534
- withActions
3535
- };
3536
- const classes = dataGridUtilityClasses(ownerState);
3537
- return /* @__PURE__ */ jsx(
3538
- DataGridRoot,
3539
- {
3540
- className: classes.root,
3541
- ...process.env.NODE_ENV !== "production" ? {
3542
- [TEST_PROP_COLUMNS]: JSON.stringify(columns),
3543
- [TEST_PROP_ID]: getNameDataTestId$1(DATAGRID_PREFIX_NAME, "root", dataTestId)
3544
- } : {},
3545
- children: /* @__PURE__ */ jsx(
3546
- DataGridProvider,
3547
- {
3548
- id: props.id,
3549
- columns: props.columns,
3550
- rowHeights,
3551
- rowHeaderHeights,
3552
- initialRowHeightVariant,
3553
- rowsCount: rows.length,
3554
- checkedRows,
3555
- rowActionsGetter,
3556
- onCheckedRowsChange,
3557
- rowKeyGetter,
3558
- rows,
3559
- classes,
3560
- children: /* @__PURE__ */ jsxs(FilterProvider, { initialActiveFilters: false, children: [
3561
- withActions && actionsProps && /* @__PURE__ */ jsx(
3562
- Actions,
3563
- {
3564
- ...actionsProps
3565
- }
3566
- ),
3567
- /* @__PURE__ */ jsx(
3568
- Table,
3569
- {
3570
- id,
3571
- withActions,
3572
- columns,
3573
- rows,
3574
- selectedRows,
3575
- onSelectedRowsChange,
3576
- rowKeyGetter,
3577
- onRowsChange
3578
- }
3579
- )
3580
- ] })
3581
- }
3582
- )
3583
- }
3584
- );
3585
- }
3586
- const Input = styled$1("input")(() => ({
3587
- appearance: "none",
3588
- boxSizing: "border-box",
3589
- inlineSize: "100%",
3590
- blockSize: "100%",
3591
- paddingBlock: "0",
3592
- verticalAlign: "top",
3593
- textAlign: "right",
3594
- color: "var(--rdg-color)",
3595
- backgroundColor: "var(--rdg-background-color)",
3596
- fontFamily: "inherit",
3597
- "&:focus": {
3598
- outline: "none"
3599
- },
3600
- "&::placeholder": {
3601
- color: "#999",
3602
- opacity: "1"
3603
- }
3604
- }));
3605
- function autoFocusAndSelect(input) {
3606
- input?.focus();
3607
- input?.select();
3608
- }
3609
- function TextEditor({
3610
- row,
3611
- column,
3612
- onRowChange,
3613
- onClose
3614
- }) {
3615
- return /* @__PURE__ */ jsx(
3616
- Input,
3617
- {
3618
- className: "rdg-text-editor",
3619
- ref: autoFocusAndSelect,
3620
- value: row[column.key],
3621
- onChange: (event) => onRowChange({ ...row, [column.key]: event.target.value }),
3622
- onBlur: () => onClose(true)
3623
- }
3624
- );
3625
- }
3626
- function NumberEditor({
3627
- row,
3628
- column,
3629
- onRowChange,
3630
- onClose
3631
- }) {
3632
- const handleKeyDown = (event) => {
3633
- if (event.key === "ArrowUp" || event.key === "ArrowDown") {
3634
- onClose(true);
3635
- }
3636
- if (event.key === "Enter") {
3637
- onClose(true);
3638
- }
3639
- };
3640
- return /* @__PURE__ */ jsx(
3641
- Input,
3642
- {
3643
- className: "rdg-text-editor",
3644
- ref: autoFocusAndSelect,
3645
- type: "number",
3646
- value: row[column.key],
3647
- onKeyDown: handleKeyDown,
3648
- onChange: (event) => onRowChange({
3649
- ...row,
3650
- [column.key]: event.target.value !== "" ? Number(event.target.value) : ""
3651
- }),
3652
- onBlur: () => onClose(true)
3653
- }
3654
- );
3655
- }
3656
- generateUtilityClasses(
3657
- componentName$3,
3658
- [
3659
- "root"
3660
- ]
3661
- );
3662
- const useAppBarComercialUtilityClasses$1 = () => {
3663
- const slots = {
3664
- root: ["root"]
3665
- };
3666
- return unstable_composeClasses(slots, getComponentUtilityClass(componentName$3), {});
3667
- };
3668
- const AppBarComercialRoot = styled$1("div")(({ theme }) => ({
3669
- ...theme.components?.M4LAppBarCommercial?.styleOverrides
3670
- }));
3671
- const AppBarComercial = (props) => {
3672
- const { children } = props;
3673
- const classes = useAppBarComercialUtilityClasses$1();
3674
- return /* @__PURE__ */ jsx(AppBarComercialRoot, { className: classes.root, children });
3675
- };
3676
- const TopBarClasses = generateUtilityClasses(componentName$4, [
3677
- "root",
3678
- "ContainerImageComercial",
3679
- "SimplebarComercial",
3680
- "ItemRoot",
3681
- "ItemSelect",
3682
- "ContainerAccordion",
3683
- "ContainerAccordionCase1",
3684
- "IconAndButton",
3685
- "IsActive"
3686
- ]);
3687
- function getTopBarClassesUtilityClass() {
3688
- const slots = {
3689
- root: ["root"],
3690
- ContainerImageComercial: ["ContainerImageComercial"],
3691
- SimplebarComercial: ["SimplebarComercial"],
3692
- ItemRoot: ["ItemRoot"],
3693
- ItemSelect: ["ItemSelect"],
3694
- ContainerAccordion: ["ContainerAccordion"],
3695
- ContainerAccordionCase1: ["ContainerAccordionCase1"],
3696
- IconAndButton: ["IconAndButton"]
3697
- };
3698
- const composedClasses = unstable_composeClasses(slots, getComponentUtilityClass(componentName$4), {});
3699
- return {
3700
- ...composedClasses
3701
- };
3702
- }
3703
- const initialstate = {
3704
- dataMenu: [],
3705
- classes: getTopBarClassesUtilityClass(),
3706
- dataTestId: ""
3707
- };
3708
- const TopBarContext = createContext(initialstate);
3709
- const TopBarProvider = (props) => {
3710
- const { children, value } = props;
3711
- const { dataMenu: DataMenu, classes, dataTestId } = value;
3712
- return /* @__PURE__ */ jsx(
3713
- TopBarContext.Provider,
3714
- {
3715
- value: { dataMenu: DataMenu, classes, dataTestId },
3716
- children
3717
- }
3718
- );
3719
- };
3720
- const useTopBar = () => useContext(TopBarContext);
3721
- const useTopBar$1 = useTopBar;
3722
- const NavItemRoot = (props) => {
3723
- const theme = useTheme();
3724
- const { classes, dataTestId } = useTopBar$1();
3725
- const { itemRootData } = props;
3726
- const { title, children, module_id } = itemRootData;
3727
- const [anchorEl, setAnchorEl] = useState(null);
3728
- const [openedPopoverId, setOpenedPopoverId] = useState(null);
3729
- const handleClick = (event, popoverId) => {
3730
- setAnchorEl(event.currentTarget);
3731
- setOpenedPopoverId(popoverId);
3732
- };
3733
- const handleClose = () => {
3734
- setAnchorEl(null);
3735
- setOpenedPopoverId(null);
3736
- };
3737
- const renderMenuItems = (items) => {
3738
- return items.map((item, index) => /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: item.children ? item.children && item.children.length > 0 && /* @__PURE__ */ jsx(Accordion, { label: item.title, children: renderMenuItems(item.children) }) : /* @__PURE__ */ jsx(
3739
- "div",
3740
- {
3741
- className: clsx(
3742
- classes.ItemSelect,
3743
- item.path === window.location.pathname ? TopBarClasses.IsActive : null
3744
- ),
3745
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId$1(componentName$4, "ItemSelect", dataTestId) } : {},
3746
- children: /* @__PURE__ */ jsx(Button, { variant: "text", href: item.path, fullWidth: true, children: item.title })
3747
- }
3748
- ) }, index));
3749
- };
3750
- const renderPopover = () => {
3751
- return /* @__PURE__ */ jsx(
3752
- Popover,
3753
- {
3754
- elevation: 3,
3755
- id: module_id,
3756
- open: openedPopoverId === itemRootData.module_id ? true : false,
3757
- anchorEl,
3758
- onClose: handleClose,
3759
- anchorOrigin: {
3760
- vertical: "bottom",
3761
- horizontal: "center"
3762
- },
3763
- transformOrigin: {
3764
- vertical: "top",
3765
- horizontal: "center"
3766
- },
3767
- arrowType: "top-center",
3768
- sx: { ...theme.components?.M4LPopoverTopBar?.styleOverrides },
3769
- children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 0.5, children: children && children.length > 0 && renderMenuItems(children) })
3770
- }
3771
- );
3772
- };
3773
- const render = () => {
3774
- if (itemRootData.children && itemRootData.path) {
3775
- return /* @__PURE__ */ jsxs(
3776
- "div",
3777
- {
3778
- className: classes.ContainerAccordionCase1,
3779
- ...process.env.NODE_ENV !== "production" ? {
3780
- [TEST_PROP_ID]: getNameDataTestId$1(
3781
- componentName$4,
3782
- "ContainerAccordionCase1",
3783
- dataTestId
3784
- )
3785
- } : {},
3786
- children: [
3787
- /* @__PURE__ */ jsx(Button, { size: "medium", variant: "text", href: itemRootData.path, children: title }),
3788
- /* @__PURE__ */ jsx(
3789
- Button,
3790
- {
3791
- variant: "text",
3792
- id: module_id,
3793
- onClick: (e) => handleClick(e, module_id),
3794
- endIcon: /* @__PURE__ */ jsx(ArrowIcon, { openState: openedPopoverId === module_id ? true : false })
3795
- }
3796
- ),
3797
- renderPopover()
3798
- ]
3799
- }
3800
- );
3801
- }
3802
- if (itemRootData.children) {
3803
- return /* @__PURE__ */ jsxs(
3804
- "div",
3805
- {
3806
- className: classes.ContainerAccordion,
3807
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId$1(componentName$4, "ContainerAccordion", dataTestId) } : {},
3808
- children: [
3809
- /* @__PURE__ */ jsx(
3810
- Button,
3811
- {
3812
- "aria-describedby": module_id,
3813
- variant: "text",
3814
- size: "medium",
3815
- onClick: (e) => handleClick(e, itemRootData.module_id),
3816
- endIcon: /* @__PURE__ */ jsx(ArrowIcon, { openState: openedPopoverId === module_id ? true : false }),
3817
- children: title
3818
- }
3819
- ),
3820
- renderPopover()
3821
- ]
3822
- }
3823
- );
3824
- }
3825
- if (itemRootData.path)
3826
- return /* @__PURE__ */ jsx(Button, { variant: "text", size: "medium", href: itemRootData.path, "aria-describedby": module_id, children: /* @__PURE__ */ jsx("div", { children: title }) });
3827
- };
3828
- return /* @__PURE__ */ jsx(
3829
- Box,
3830
- {
3831
- className: clsx(
3832
- classes.ItemRoot,
3833
- isActive(itemRootData) || openedPopoverId === itemRootData.module_id ? TopBarClasses.IsActive : null
3834
- ),
3835
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId$1(componentName$4, "ItemRoot", dataTestId) } : {},
3836
- children: render()
3837
- }
3838
- );
3839
- };
3840
- const ConteinItem = () => {
3841
- const { dataMenu: DataMenu, classes, dataTestId } = useTopBar$1();
3842
- return /* @__PURE__ */ jsx(
3843
- "div",
3844
- {
3845
- className: classes.SimplebarComercial,
3846
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId$1(componentName$4, "SimplebarComercial", dataTestId) } : {},
3847
- children: DataMenu.map((group) => /* @__PURE__ */ jsx(NavItemRoot, { itemRootData: group }, group.module_id))
3848
- }
3849
- );
3850
- };
3851
- const TopBarRoot = styled$1("header")(({ theme }) => ({
3852
- ...theme.components?.M4LTopBar?.styleOverrides
3853
- }));
3854
- const TopBar = (props) => {
3855
- const { dataMenu: DataMenu, dataTestId } = props;
3856
- const classes = getTopBarClassesUtilityClass();
3857
- return /* @__PURE__ */ jsx(
3858
- TopBarRoot,
3859
- {
3860
- className: classes.root,
3861
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId$1(componentName$4, "root", dataTestId) } : {},
3862
- children: /* @__PURE__ */ jsx(TopBarProvider, { value: { dataMenu: DataMenu, classes, dataTestId }, children: /* @__PURE__ */ jsx(ConteinItem, {}) })
3863
- }
3864
- );
3865
- };
3866
- generateUtilityClasses(
3867
- componentName$5,
3868
- [
3869
- "root",
3870
- "fullWidth",
3871
- "boxed",
3872
- "columnReverse"
3873
- ]
3874
- );
3875
- const useAppBarComercialUtilityClasses = (ownerState) => {
3876
- const slots = {
3877
- root: [
3878
- "root",
3879
- ownerState.contentWith === "fullWidth" && "fullWidth",
3880
- ownerState.contentWith === "boxed" && "boxed",
3881
- ownerState.columnReverse && "columnReverse"
3882
- ]
3883
- };
3884
- return unstable_composeClasses(slots, getComponentUtilityClass(componentName$5), {});
3885
- };
3886
- const SectionCommercialRoot = styled$1(Stack)(({ theme }) => ({
3887
- ...theme.components?.M4LSectionCommercial?.styleOverrides
3888
- }));
3889
- const SectionCommercial = (props) => {
3890
- const {
3891
- children,
3892
- contentWith = "boxed",
3893
- paddingX = "40px",
3894
- paddingY,
3895
- columnReverse = false,
3896
- ...others
3897
- } = props;
3898
- const ownerState = {
3899
- contentWith,
3900
- columnReverse
3901
- };
3902
- const classes = useAppBarComercialUtilityClasses(ownerState);
3903
- return /* @__PURE__ */ jsx(
3904
- SectionCommercialRoot,
3905
- {
3906
- className: classes.root,
3907
- paddingY,
3908
- ...others,
3909
- ...contentWith === "boxed" ? { paddingX } : null,
3910
- children
3911
- }
3912
- );
3913
- };
3914
- export {
3915
- AreasAdmin as A,
3916
- BooleanFormatter as B,
3917
- ColumnSetCheckFormatter as C,
3918
- DateFormatter as D,
3919
- MenuActions as M,
3920
- NumberEditor as N,
3921
- PointsFormatter as P,
3922
- RHFAutocomplete as R,
3923
- SectionCommercial as S,
3924
- TextEditor as T,
3925
- UncertaintyFormatter as U,
3926
- DataGrid as a,
3927
- useAreasAdminUtilityClasses as b,
3928
- useFormFocus as c,
3929
- useDataGrid as d,
3930
- useFilters as e,
3931
- ColumnDateFormatter as f,
3932
- DataGridRoot as g,
3933
- ColumnsConfig as h,
3934
- AreasViewer as i,
3935
- getFormatDate as j,
3936
- getUncertaintyFormat as k,
3937
- getFormatPoints as l,
3938
- getFormatConcatenated as m,
3939
- ConcatenatedFormatter as n,
3940
- PriceFormatter as o,
3941
- getFormatPrice as p,
3942
- ColumnUncertaintyFormatter as q,
3943
- ColumnPointsFormatter as r,
3944
- ColumnNestedValueFormatter as s,
3945
- ColumnBooleanFormatter as t,
3946
- useAreasViewerUtilityClasses as u,
3947
- ColumnConcatenatedValueFormatter as v,
3948
- ColumnPriceFormatter as w,
3949
- ColumnInteractiveCheckFormatter as x,
3950
- AppBarComercial as y,
3951
- TopBar as z
3952
- };