@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,1044 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { P as PopoverMenuStyled, p as PopoverMenuItemStyled, q as PopoverMenuItemIconStyled, r as PopoverMenuItemLabelStyled, s as PopoverStyled, t as PopoverHeaderStyled, u as PopoverHeaderIconStyled, v as PopoverHeaderTitleStyled, w as PopoverContainerFieldsStyled, x as PopoverHeaderActionsStyled } from "../../DynamicFilter/slots/index.00b68384.js";
3
- import { useModuleDictionary, useEnvironment, useNetwork, useModulePrivileges } from "@m4l/core";
4
- import { u as useDynamicFilterStore } from "../../DynamicFilter/store/index.85a2812f.js";
5
- import React__default, { useRef, useMemo, useCallback, useState, useEffect } from "react";
6
- import { f as fieldFactory, c as DataTypeComponent } from "../../DynamicFilter/subcomponents/index.86c6fda2.js";
7
- import { R as RHFormProvider } from "../../../contexts/RHFormContext/index.95ebabc9.js";
8
- import { a as ActionCancel, b as ActionIntro } from "../../CommonActions/index.19f39dca.js";
9
- import { Popover as Popover$1, generateUtilityClasses, generateUtilityClass, Stack, MenuItem, Tooltip, FormControl, RadioGroup, FormControlLabel, Radio, useTheme } from "@mui/material";
10
- import { I as Image } from "../../Image/index.4a822ede.js";
11
- import { useLocales } from "@m4l/graphics";
12
- import { styled } from "@mui/material/styles";
13
- import { I as ImageButton } from "../Button/index.52852c42.js";
14
- import { unstable_composeClasses } from "@mui/base";
15
- import { T as TEST_PROP_ID } from "../../areas/constants.0d3ba950.js";
16
- import { C as CircularProgress } from "../CircularProgress/index.967e70b7.js";
17
- import { M as MAP_DICCTIONARY } from "../../areas/dictionary.6168209a.js";
18
- import { M as MAP_ICONS } from "../../areas/icons.504ec098.js";
19
- import { C as ColumnSetCheckFormatter, a as DataGrid } from "../../../vendor.5b266106.js";
20
- import { shallow } from "zustand/shallow";
21
- import { I as Icon } from "../../Icon/index.8ecfb193.js";
22
- import { u as useMapStore, a as useDisableZoomEvents, m as mapClasses } from "../../maps/index.a1bf63f2.js";
23
- import { u as useStateRef } from "../../../hooks/useStateRef/index.538edb89.js";
24
- import clsx from "clsx";
25
- import { C as CheckBox } from "../CheckBox/index.01218423.js";
26
- import { I as IconButton } from "../IconButton/index.d5b273e6.js";
27
- const PopoverRoot = styled(Popover$1)(({ theme }) => ({
28
- ...theme.components?.M4LPopover?.styleOverrides
29
- }));
30
- generateUtilityClasses("M4LPopover", [
31
- "root",
32
- "arrowStyle",
33
- "noArrow",
34
- "topLeft",
35
- "topCenter",
36
- "topRight",
37
- "bottomLeft",
38
- "bottomCenter",
39
- "bottomRight",
40
- "leftTop",
41
- "leftCenter",
42
- "leftBottom",
43
- "rightTop",
44
- "rightCenter",
45
- "rightBottom"
46
- ]);
47
- function getPopoverClassesUtilityClass(slot) {
48
- return generateUtilityClass("M4LPopover", slot);
49
- }
50
- const useUtilityClasses$1 = (ownerState) => {
51
- const slots = {
52
- root: ["root"],
53
- arrowStyle: [
54
- "arrowStyle",
55
- ownerState.arrowType === "top-left" && "topLeft",
56
- ownerState.arrowType === "top-center" && "topCenter",
57
- ownerState.arrowType === "top-right" && "topRight",
58
- ownerState.arrowType === "bottom-left" && "bottomLeft",
59
- ownerState.arrowType === "bottom-center" && "bottomCenter",
60
- ownerState.arrowType === "bottom-right" && "bottomRight",
61
- ownerState.arrowType === "left-top" && "leftTop",
62
- ownerState.arrowType === "left-center" && "leftCenter",
63
- ownerState.arrowType === "left-bottom" && "leftBottom",
64
- ownerState.arrowType === "right-top" && "rightTop",
65
- ownerState.arrowType === "right-center" && "rightCenter",
66
- ownerState.arrowType === "right-bottom" && "rightBottom"
67
- ]
68
- };
69
- const composedClasses = unstable_composeClasses(slots, getPopoverClassesUtilityClass, {});
70
- return {
71
- ...composedClasses
72
- };
73
- };
74
- const ArrowStyle = styled("span")(({ arrowType, theme }) => {
75
- const SIZE = 12;
76
- const POSITION = -(SIZE / 2);
77
- const borderStyle = `solid 1px ${theme.vars.palette.state.borderDens}`;
78
- const topStyle = {
79
- borderRadius: "0 0 3px 0",
80
- top: POSITION,
81
- borderBottom: borderStyle,
82
- borderRight: borderStyle
83
- };
84
- const bottomStyle = {
85
- borderRadius: "3px 0 0 0",
86
- bottom: POSITION,
87
- borderTop: borderStyle,
88
- borderLeft: borderStyle
89
- };
90
- const leftStyle = {
91
- borderRadius: "0 3px 0 0",
92
- left: POSITION,
93
- borderTop: borderStyle,
94
- borderRight: borderStyle
95
- };
96
- const rightStyle = {
97
- borderRadius: "0 0 0 3px",
98
- right: POSITION,
99
- borderBottom: borderStyle,
100
- borderLeft: borderStyle
101
- };
102
- return {
103
- display: "none",
104
- [theme.breakpoints.up("sm")]: {
105
- width: SIZE,
106
- height: SIZE,
107
- content: "''",
108
- position: "absolute",
109
- display: "block",
110
- transform: "rotate(-135deg)",
111
- background: theme.vars.palette.background.default
112
- },
113
- ...arrowType === "top-left" && { ...topStyle, left: 20 },
114
- ...arrowType === "top-center" && { ...topStyle, left: 0, right: 0, margin: "auto" },
115
- ...arrowType === "top-right" && { ...topStyle, right: 20 },
116
- ...arrowType === "bottom-left" && { ...bottomStyle, left: 20 },
117
- ...arrowType === "bottom-center" && { ...bottomStyle, left: 0, right: 0, margin: "auto" },
118
- ...arrowType === "bottom-right" && { ...bottomStyle, right: 20 },
119
- ...arrowType === "left-top" && { ...leftStyle, top: 20 },
120
- ...arrowType === "left-center" && { ...leftStyle, top: 0, bottom: 0, margin: "auto" },
121
- ...arrowType === "left-bottom" && { ...leftStyle, bottom: 20 },
122
- ...arrowType === "right-top" && { ...rightStyle, top: 20 },
123
- ...arrowType === "right-center" && { ...rightStyle, top: 0, bottom: 0, margin: "auto" },
124
- ...arrowType === "right-bottom" && { ...rightStyle, bottom: 20 }
125
- };
126
- });
127
- const Popover = (props) => {
128
- const { children, arrowType = "top-right", className, ...other } = props;
129
- const ownerState = {
130
- arrowType
131
- };
132
- const classes = useUtilityClasses$1(ownerState);
133
- return /* @__PURE__ */ jsxs(
134
- PopoverRoot,
135
- {
136
- className: clsx(classes.root, className),
137
- "data-testid": "PopoverRoot",
138
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
139
- transformOrigin: { vertical: "top", horizontal: "right" },
140
- transitionDuration: 0,
141
- PaperProps: {
142
- sx: {
143
- p: 1,
144
- overflow: "inherit"
145
- }
146
- },
147
- ...other,
148
- children: [
149
- /* @__PURE__ */ jsx(
150
- ArrowStyle,
151
- {
152
- className: classes.arrowStyle,
153
- "data-testid": "ArrowStyle",
154
- arrowType
155
- }
156
- ),
157
- children
158
- ]
159
- }
160
- );
161
- };
162
- function usePopoverMenuFields() {
163
- const { getLabel } = useModuleDictionary();
164
- const fnAnchorEl = useDynamicFilterStore((state) => state.fnAnchorEl);
165
- const { showPopoverFilterForAdd, closePopoverMenuFields } = useDynamicFilterStore(
166
- (state) => state.actions
167
- );
168
- function handleOpenPopUpClickItem(_event, field) {
169
- if (fnAnchorEl) {
170
- showPopoverFilterForAdd(fnAnchorEl(), field);
171
- }
172
- }
173
- function handleClosePopover() {
174
- closePopoverMenuFields(false);
175
- }
176
- function getItemLabel(field) {
177
- return field.label ?? getLabel(field.dictionaryId);
178
- }
179
- return {
180
- fnAnchorEl,
181
- getItemLabel,
182
- handleClosePopover,
183
- handleOpenPopUpClickItem
184
- };
185
- }
186
- function PopoverMenuFields(props) {
187
- const { fields, selectFieldIndex } = props;
188
- const { fnAnchorEl, handleOpenPopUpClickItem, handleClosePopover, getItemLabel } = usePopoverMenuFields();
189
- return /* @__PURE__ */ jsx(
190
- PopoverMenuStyled,
191
- {
192
- disableAutoFocus: true,
193
- disableRestoreFocus: true,
194
- arrowType: "top-left",
195
- anchorOrigin: { vertical: "bottom", horizontal: "left" },
196
- transformOrigin: { vertical: "top", horizontal: "left" },
197
- open: Boolean(fnAnchorEl),
198
- onClose: handleClosePopover,
199
- anchorEl: fnAnchorEl?.(),
200
- ownerState: {},
201
- children: Boolean(fnAnchorEl) && fields.map((field, index) => /* @__PURE__ */ jsxs(
202
- PopoverMenuItemStyled,
203
- {
204
- dense: true,
205
- selected: index === selectFieldIndex,
206
- onClick: (event) => handleOpenPopUpClickItem(event, field),
207
- ownerState: {},
208
- children: [
209
- /* @__PURE__ */ jsx(PopoverMenuItemIconStyled, { src: field.urlIcon, ownerState: {} }),
210
- /* @__PURE__ */ jsx(PopoverMenuItemLabelStyled, { ownerState: {}, children: getItemLabel(field) })
211
- ]
212
- },
213
- `menu_action_${getItemLabel(field)}`
214
- ))
215
- }
216
- );
217
- }
218
- function usePopoverFilter() {
219
- let anchorEl;
220
- let field;
221
- let formFilter;
222
- let filterFormValue;
223
- let popupValidationSchema;
224
- const { getLabel } = useModuleDictionary();
225
- const popoverFilterData = useDynamicFilterStore((state) => state.popoverFilterData);
226
- const { hidePopoverFilter, addFilter, updateFilter, getNewId } = useDynamicFilterStore(
227
- (state) => state.actions
228
- );
229
- const refPreviousPopoverFilterData = useRef(popoverFilterData);
230
- const statusLoad = useMemo(() => {
231
- let returnStatus;
232
- if (popoverFilterData && refPreviousPopoverFilterData.current === void 0) {
233
- returnStatus = "ready";
234
- } else if (!popoverFilterData) {
235
- returnStatus = "initial";
236
- } else {
237
- returnStatus = "reload_values_provider";
238
- }
239
- refPreviousPopoverFilterData.current = popoverFilterData;
240
- return returnStatus;
241
- }, [popoverFilterData]);
242
- if (popoverFilterData?.openFor === "add") {
243
- anchorEl = popoverFilterData?.fnAnchorEl();
244
- field = popoverFilterData.field;
245
- const helperField = fieldFactory(field.type);
246
- popupValidationSchema = helperField.getSchema(getLabel);
247
- filterFormValue = helperField.getFormValue(field, getLabel);
248
- formFilter = {
249
- field,
250
- id: getNewId(),
251
- isSet: true,
252
- fixed: false,
253
- ...filterFormValue
254
- };
255
- } else if (popoverFilterData) {
256
- anchorEl = popoverFilterData?.fnAnchorEl();
257
- field = popoverFilterData?.filter.field;
258
- const helperField = fieldFactory(field.type);
259
- popupValidationSchema = helperField.getSchema(getLabel);
260
- filterFormValue = helperField.getFormValue(field, getLabel, popoverFilterData.filter);
261
- formFilter = { ...popoverFilterData?.filter, ...filterFormValue };
262
- } else {
263
- filterFormValue = {};
264
- field = {};
265
- formFilter = {};
266
- anchorEl = {};
267
- }
268
- const onClose = useCallback(() => {
269
- hidePopoverFilter(false);
270
- }, []);
271
- const handleKeyDownPopper = useCallback((event) => {
272
- if (event.key === "Escape") {
273
- onClose();
274
- }
275
- }, []);
276
- function handleClosePopover() {
277
- hidePopoverFilter(false);
278
- }
279
- async function onSubmit(dataFieldValues) {
280
- const filterField = { ...filterFormValue, ...dataFieldValues };
281
- const newFilter = {
282
- ...formFilter,
283
- ...fieldFactory(filterField.fieldType).getFilterFromFormValue(filterField),
284
- isSet: true
285
- };
286
- if (popoverFilterData?.openFor === "add") {
287
- addFilter(newFilter);
288
- } else {
289
- updateFilter(newFilter);
290
- }
291
- hidePopoverFilter(false);
292
- }
293
- const labelField = field?.label ?? getLabel(field?.dictionaryId ?? "");
294
- return {
295
- field,
296
- labelField,
297
- canRender: Boolean(popoverFilterData),
298
- anchorEl,
299
- handleKeyDownPopper,
300
- handleClosePopover,
301
- onSubmit,
302
- onClose,
303
- filterFormValue,
304
- formFilter,
305
- popupValidationSchema,
306
- statusLoad
307
- };
308
- }
309
- function PopoverFilter() {
310
- const {
311
- field,
312
- labelField,
313
- anchorEl,
314
- handleKeyDownPopper,
315
- handleClosePopover,
316
- onSubmit,
317
- onClose,
318
- filterFormValue,
319
- formFilter,
320
- popupValidationSchema,
321
- statusLoad,
322
- canRender
323
- } = usePopoverFilter();
324
- if (!canRender) {
325
- return null;
326
- }
327
- return /* @__PURE__ */ jsx(
328
- PopoverStyled,
329
- {
330
- open: true,
331
- disableRestoreFocus: true,
332
- transitionDuration: 0,
333
- anchorOrigin: { vertical: "bottom", horizontal: "left" },
334
- transformOrigin: { vertical: "top", horizontal: "left" },
335
- arrowType: "top-left",
336
- anchorEl,
337
- onKeyDown: handleKeyDownPopper,
338
- onClose: handleClosePopover,
339
- ownerState: {},
340
- children: /* @__PURE__ */ jsxs(
341
- RHFormProvider,
342
- {
343
- onSubmit,
344
- values: filterFormValue,
345
- validationSchema: popupValidationSchema,
346
- statusLoad,
347
- children: [
348
- /* @__PURE__ */ jsxs(PopoverHeaderStyled, { ownerState: {}, children: [
349
- field.urlIcon && /* @__PURE__ */ jsx(PopoverHeaderIconStyled, { src: field.urlIcon, ownerState: {} }),
350
- /* @__PURE__ */ jsx(PopoverHeaderTitleStyled, { variant: "paragraphDens", ownerState: {}, children: labelField })
351
- ] }),
352
- /* @__PURE__ */ jsx(PopoverContainerFieldsStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(DataTypeComponent, { formFilter, statusLoad }) }),
353
- /* @__PURE__ */ jsxs(PopoverHeaderActionsStyled, { ownerState: {}, children: [
354
- /* @__PURE__ */ jsx(ActionCancel, { onClick: onClose, skeletonWidth: "68px" }),
355
- /* @__PURE__ */ jsx(ActionIntro, { skeletonWidth: "64px" })
356
- ] })
357
- ]
358
- }
359
- )
360
- }
361
- );
362
- }
363
- const LanguagePopoverRoot = styled("div")(({ theme }) => ({
364
- ...theme.components?.M4LanguagePopover?.styleOverrides
365
- }));
366
- const LabelItem = styled("div")(({ theme }) => ({
367
- marginLeft: theme.spacing(1)
368
- }));
369
- const ContainerProgress = styled("div")(({ theme }) => ({
370
- padding: theme.spacing(0.75, 0),
371
- margin: theme.spacing(0, 1.25)
372
- }));
373
- const ContainerMenuItems = styled("div")(() => ({
374
- display: "flex",
375
- flexDirection: "column"
376
- }));
377
- const ContainerImage = styled("div")(() => ({
378
- display: "flex",
379
- gap: "4px",
380
- width: "16px",
381
- height: "16px"
382
- }));
383
- const componentName = "M4LanguagePopover";
384
- generateUtilityClasses(
385
- componentName,
386
- [
387
- "root",
388
- "containerItems",
389
- "containerProgress",
390
- "labelItem",
391
- "imageButton"
392
- ]
393
- );
394
- function getM4LanguagePopoverClassesUtilityClass(slot) {
395
- return generateUtilityClass(componentName, slot);
396
- }
397
- const useUtilityClasses = () => {
398
- const slots = {
399
- root: ["root"],
400
- containerItems: ["containerItems"],
401
- containerProgress: ["containerProgress"],
402
- labelItem: ["labelItem"]
403
- };
404
- const composedClasses = unstable_composeClasses(slots, getM4LanguagePopoverClassesUtilityClass, {});
405
- return {
406
- ...composedClasses
407
- };
408
- };
409
- const LANGUAGEPOPOVER_PREFIX = "LanguagePopover";
410
- const getNameDataTestId = (KEY) => {
411
- return `${LANGUAGEPOPOVER_PREFIX}-${KEY}`;
412
- };
413
- function LanguagePopover(props) {
414
- const { testingProps } = props;
415
- const { currentLocale, onChangeLocale } = useLocales();
416
- const { domain_token } = useEnvironment();
417
- const { networkOperation } = useNetwork();
418
- const [open, setOpen] = useState(testingProps?.open || null);
419
- const [loading, setLoading] = useState(testingProps?.loading || false);
420
- const [allLocales, setAllLocales] = useState(
421
- testingProps?.allLocales || []
422
- );
423
- const handleOpen = (event) => {
424
- setOpen(event.currentTarget);
425
- };
426
- const handleClose = () => {
427
- setOpen(null);
428
- };
429
- useEffect(() => {
430
- let mounted = true;
431
- if (open === null || loading || allLocales.length > 0) {
432
- return;
433
- }
434
- setLoading(true);
435
- networkOperation({
436
- method: "GET",
437
- endPoint: `na/locales`,
438
- parms: { domain_token }
439
- }).then((response) => {
440
- if (mounted) {
441
- !testingProps && setAllLocales(response.data);
442
- }
443
- }).finally(() => {
444
- setLoading(false);
445
- });
446
- return function cleanUp() {
447
- mounted = false;
448
- };
449
- }, [open]);
450
- const classes = useUtilityClasses();
451
- return /* @__PURE__ */ jsxs(
452
- LanguagePopoverRoot,
453
- {
454
- className: classes.root,
455
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("root") } : {},
456
- children: [
457
- /* @__PURE__ */ jsx(
458
- ImageButton,
459
- {
460
- className: classes.imageButton,
461
- onClick: handleOpen,
462
- sx: {
463
- width: 28,
464
- height: 28,
465
- ...open && { bgcolor: "action.selected" }
466
- },
467
- src: currentLocale?.url_icon || "",
468
- alt: currentLocale?.name,
469
- width: "24px",
470
- height: "24px",
471
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("imageButton") } : {}
472
- }
473
- ),
474
- /* @__PURE__ */ jsx(
475
- Popover,
476
- {
477
- arrowType: "top-right",
478
- open: Boolean(open),
479
- anchorEl: open,
480
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
481
- onClose: handleClose,
482
- sx: {
483
- mt: 1.5,
484
- ml: 0.75,
485
- width: 180,
486
- rowGap: "100px",
487
- "& .MuiMenuItem-root": { px: 1, typography: "body2", borderRadius: 0.75 }
488
- },
489
- children: /* @__PURE__ */ jsxs(
490
- ContainerMenuItems,
491
- {
492
- className: classes.containerItems,
493
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("containerItems") } : {},
494
- children: [
495
- allLocales.length === 0 && /* @__PURE__ */ jsx(
496
- ContainerProgress,
497
- {
498
- className: classes.containerProgress,
499
- ...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("containerProgress") } : {},
500
- children: /* @__PURE__ */ jsx(CircularProgress, { size: "20px" })
501
- }
502
- ),
503
- allLocales.length > 0 && /* @__PURE__ */ jsx(Stack, { spacing: 0.75, children: allLocales.map((option) => /* @__PURE__ */ jsxs(
504
- MenuItem,
505
- {
506
- selected: option.lang === currentLocale?.lang && option?.script === currentLocale?.script && option?.region === currentLocale?.region,
507
- onClick: () => {
508
- onChangeLocale(option);
509
- handleClose();
510
- },
511
- children: [
512
- /* @__PURE__ */ jsx(ContainerImage, { children: /* @__PURE__ */ jsx(Image, { alt: option.name, src: option.url_icon, ratio: "1:1" }) }),
513
- /* @__PURE__ */ jsx(
514
- LabelItem,
515
- {
516
- className: classes.labelItem,
517
- ...process.env.NODE_ENV !== "production" ? {
518
- [TEST_PROP_ID]: getNameDataTestId("labelItem")
519
- } : {},
520
- children: option.name
521
- }
522
- )
523
- ]
524
- },
525
- option.lang || option.script || option.region
526
- )) })
527
- ]
528
- }
529
- )
530
- }
531
- )
532
- ]
533
- }
534
- );
535
- }
536
- const TILE_LAYER_OSM = {
537
- id: "osm_roadmap",
538
- sourceType: "OSM",
539
- iconUrl: MAP_ICONS.MAP_SOURCE_OSM,
540
- mapTypeTile: "roadmap",
541
- dictionaryId: MAP_DICCTIONARY.LABEL_TILE_OSM,
542
- urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
543
- options: {
544
- minZoom: 0,
545
- maxZoom: 19,
546
- subdomains: ["a", "b", "c"],
547
- attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a>',
548
- tms: false
549
- },
550
- roadSelectedOptions: {
551
- trafficLayer: false,
552
- transitLayer: false,
553
- bicyclingLayer: false
554
- }
555
- };
556
- const TILE_LAYER_GOOGLE = {
557
- id: "google_rodmap",
558
- sourceType: "Google",
559
- iconUrl: MAP_ICONS.MAP_SOURCE_GOOGLE_ROADS,
560
- mapTypeTile: "roadmap",
561
- dictionaryId: MAP_DICCTIONARY.LABEL_TILE_GOOGLE,
562
- urlTemplate: "http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&key=AIzaSyDfhTK9us4kuqPTeFIm89yB3uvk2_G5AMw",
563
- hasBicyclingLayer: true,
564
- hasTrafficLayer: true,
565
- hasTransitLayer: true,
566
- options: {
567
- minZoom: 0,
568
- maxZoom: 22,
569
- subdomains: ["mt0", "mt1", "mt2", "mt3"],
570
- attribution: "Map data \xA9 Google",
571
- tms: false
572
- },
573
- roadSelectedOptions: {
574
- trafficLayer: false,
575
- transitLayer: false,
576
- bicyclingLayer: false
577
- }
578
- };
579
- const TILE_LAYER_GOOGLE_SATELLITE = {
580
- id: "google_satellite",
581
- sourceType: "Google",
582
- iconUrl: MAP_ICONS.MAP_SOURCE_GOOGLE_SATELLITE,
583
- mapTypeTile: "satellite",
584
- dictionaryId: MAP_DICCTIONARY.LABEL_TILE_GOOGLE_SATELLITE,
585
- urlTemplate: "http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}&key=AIzaSyDfhTK9us4kuqPTeFIm89yB3uvk2_G5AMw",
586
- options: {
587
- minZoom: 0,
588
- maxZoom: 22,
589
- subdomains: ["mt0", "mt1", "mt2", "mt3"],
590
- attribution: "Map data \xA9 Google",
591
- tms: false
592
- },
593
- roadSelectedOptions: {
594
- trafficLayer: false,
595
- transitLayer: false,
596
- bicyclingLayer: false
597
- }
598
- };
599
- const TILE_LAYER_GOOGLE_HYBRID = {
600
- id: "google_hybrid",
601
- sourceType: "Google",
602
- iconUrl: MAP_ICONS.MAP_SOURCE_GOOGLE_HYBRID,
603
- mapTypeTile: "hybrid",
604
- dictionaryId: MAP_DICCTIONARY.LABEL_TILE_GOOGLE_HYBRID,
605
- urlTemplate: "http://{s}.google.com/vt/lyrs=y&x={x}&y={y}&z={z}&key=AIzaSyDfhTK9us4kuqPTeFIm89yB3uvk2_G5AMw",
606
- hasBicyclingLayer: true,
607
- hasTrafficLayer: true,
608
- hasTransitLayer: true,
609
- options: {
610
- minZoom: 0,
611
- maxZoom: 22,
612
- subdomains: ["mt0", "mt1", "mt2", "mt3"],
613
- attribution: "Map data \xA9 Google",
614
- tms: false
615
- },
616
- roadSelectedOptions: {
617
- trafficLayer: false,
618
- transitLayer: false,
619
- bicyclingLayer: false
620
- }
621
- };
622
- function toQuadKey(x, y, z) {
623
- let quadKey = "";
624
- for (let i = z; i > 0; i--) {
625
- let digit = 0;
626
- const mask = 1 << i - 1;
627
- if ((x & mask) !== 0) {
628
- digit++;
629
- }
630
- if ((y & mask) !== 0) {
631
- digit++;
632
- digit++;
633
- }
634
- quadKey += digit.toString();
635
- }
636
- return quadKey;
637
- }
638
- const BING_URL_TEMPLATE = "https://{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/|QK|?mkt=en-us&it=G,VE,BX,L,LA&shading=hill&og=22&n=z";
639
- const BING_SUB_DOMAINS = ["t2", "t3"];
640
- const TILE_LAYER_BING = {
641
- id: "bing_rodmap",
642
- sourceType: "Bing",
643
- mapTypeTile: "roadmap",
644
- dictionaryId: MAP_DICCTIONARY.LABEL_TILE_BING,
645
- iconUrl: MAP_ICONS.MAP_SOURCE_BING,
646
- urlTemplate: BING_URL_TEMPLATE,
647
- options: {
648
- minZoom: 0,
649
- maxZoom: 21,
650
- subdomains: BING_SUB_DOMAINS,
651
- attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a>',
652
- tms: true
653
- },
654
- roadSelectedOptions: {
655
- trafficLayer: false,
656
- transitLayer: false,
657
- bicyclingLayer: false
658
- },
659
- getTileUrl: (tileCoord) => {
660
- const i = Math.abs(tileCoord.x + tileCoord.y) % BING_SUB_DOMAINS.length;
661
- const z = tileCoord.z;
662
- const x = tileCoord.x;
663
- const y = tileCoord.y;
664
- const gk = toQuadKey(x, y, z);
665
- return BING_URL_TEMPLATE.replace("|QK|", gk).replace("{s}", BING_SUB_DOMAINS[i]);
666
- }
667
- };
668
- function useColumns(props) {
669
- const {
670
- rowKeyGetter,
671
- visibleLayers,
672
- setVisibleLayers,
673
- autoFocusLayers,
674
- setAutoFocusLayers,
675
- clusterLayers,
676
- setClusterLayers
677
- } = props;
678
- const { getLabel } = useModuleDictionary();
679
- const { host_static_assets, environment_assets } = useEnvironment();
680
- const useHook = useCallback(
681
- (field) => {
682
- if (field === "visible") {
683
- return [visibleLayers, setVisibleLayers];
684
- } else if (field === "autoFocus") {
685
- return [autoFocusLayers, setAutoFocusLayers];
686
- } else {
687
- return [clusterLayers, setClusterLayers];
688
- }
689
- },
690
- [visibleLayers, autoFocusLayers, clusterLayers]
691
- );
692
- const columns = useMemo(
693
- () => [
694
- {
695
- key: "name",
696
- name: getLabel(MAP_DICCTIONARY.LABEL_NAME),
697
- type: "string",
698
- width: 150,
699
- frozen: true
700
- },
701
- {
702
- key: "visible",
703
- name: getLabel(MAP_DICCTIONARY.LABEL_LAYER_VISIBLE),
704
- width: 50,
705
- minWidth: 20,
706
- type: "boolean",
707
- formatter: ColumnSetCheckFormatter({
708
- field: "visible",
709
- rowKeyGetter,
710
- useHook
711
- }),
712
- cellClass: "rdg-cell-align-center",
713
- headerRenderer: (_p) => /* @__PURE__ */ jsx(Tooltip, { title: getLabel(MAP_DICCTIONARY.LABEL_LAYER_VISIBLE), children: /* @__PURE__ */ jsx(
714
- Icon,
715
- {
716
- size: "medium",
717
- src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_LAYER_VISIBLE}`
718
- }
719
- ) })
720
- },
721
- {
722
- key: "autoFocus",
723
- name: getLabel(MAP_DICCTIONARY.LABEL_LAYER_AUTOFOCUS),
724
- minWidth: 20,
725
- width: 50,
726
- type: "boolean",
727
- formatter: ColumnSetCheckFormatter({
728
- field: "autoFocus",
729
- rowKeyGetter,
730
- useHook
731
- }),
732
- cellClass: "rdg-cell-align-center",
733
- headerRenderer: (_p) => /* @__PURE__ */ jsx(Tooltip, { title: getLabel(MAP_DICCTIONARY.LABEL_LAYER_AUTOFOCUS), children: /* @__PURE__ */ jsx(
734
- Icon,
735
- {
736
- size: "medium",
737
- src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_LAYER_AUTOFOCUS}`
738
- }
739
- ) })
740
- },
741
- {
742
- key: "cluster",
743
- name: getLabel(MAP_DICCTIONARY.LABEL_LAYER_CLUSTER),
744
- minWidth: 20,
745
- width: 50,
746
- type: "boolean",
747
- formatter: ColumnSetCheckFormatter({
748
- field: "cluster",
749
- disabledGetter: (row) => !row.clusterAble,
750
- rowKeyGetter,
751
- useHook
752
- }),
753
- cellClass: "rdg-cell-align-center",
754
- headerRenderer: (_p) => /* @__PURE__ */ jsx(Tooltip, { title: getLabel(MAP_DICCTIONARY.LABEL_LAYER_CLUSTER), children: /* @__PURE__ */ jsx(
755
- Icon,
756
- {
757
- size: "medium",
758
- src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_LAYER_CLUSTER}`
759
- }
760
- ) })
761
- }
762
- ],
763
- [getLabel, useHook]
764
- );
765
- return { columns };
766
- }
767
- function useCheckedLayers(checkedNameSet) {
768
- const [checkedLayers, setCheckedLayers] = useMapStore(
769
- (state) => [
770
- state[`${checkedNameSet}CheckedLayers`],
771
- (newSet) => {
772
- state.mapActions.setCheckedLayers(checkedNameSet, newSet);
773
- }
774
- ],
775
- shallow
776
- );
777
- return [checkedLayers, setCheckedLayers];
778
- }
779
- function useRowActionsGetter() {
780
- const { getLabel } = useModuleDictionary();
781
- const { hasPrivilege } = useModulePrivileges();
782
- const { host_static_assets, environment_assets } = useEnvironment();
783
- const { removeLayer } = useMapStore((state) => state.mapActions, shallow);
784
- const [urlIconDelete] = useState(
785
- `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_LAYER_DELETE}`
786
- );
787
- const onDelete = useCallback(
788
- (row) => {
789
- removeLayer(row.id);
790
- },
791
- [getLabel]
792
- );
793
- const rowActionsGetter = useCallback(
794
- (row) => {
795
- const conditionalItems = [];
796
- conditionalItems.push({
797
- urlIcon: urlIconDelete,
798
- dictionaryId: MAP_DICCTIONARY.ROW_ACTION_LAYER_DELETE,
799
- onClick: () => {
800
- onDelete(row);
801
- },
802
- disabled: !row.deleteAble
803
- });
804
- return conditionalItems;
805
- },
806
- [hasPrivilege, onDelete, urlIconDelete]
807
- );
808
- return { rowActionsGetter };
809
- }
810
- function useMaster() {
811
- const [hashLayers, layersIds] = useMapStore(
812
- (state) => [state.hashLayers, state.layersIds],
813
- shallow
814
- );
815
- const rowKeyGetter = useCallback((row) => row.id, []);
816
- const [visibleLayers, setVisibleLayers] = useCheckedLayers("visible");
817
- const [autoFocusLayers, setAutoFocusLayers] = useCheckedLayers("autoFocus");
818
- const [clusterLayers, setClusterLayers] = useCheckedLayers("cluster");
819
- const rows = useMemo(() => {
820
- const rows2 = [];
821
- layersIds.forEach((layerId) => {
822
- if (hashLayers[layerId]) {
823
- rows2.push({
824
- id: layerId,
825
- name: hashLayers[layerId].name || `*${layerId}`,
826
- active: hashLayers[layerId].visible,
827
- clusterAble: hashLayers[layerId].clusterAble || false,
828
- deleteAble: hashLayers[layerId].deleteAble || false
829
- });
830
- }
831
- });
832
- return rows2;
833
- }, [hashLayers, layersIds]);
834
- const { rowActionsGetter } = useRowActionsGetter();
835
- const { columns } = useColumns({
836
- rowKeyGetter,
837
- visibleLayers,
838
- setVisibleLayers,
839
- autoFocusLayers,
840
- setAutoFocusLayers,
841
- clusterLayers,
842
- setClusterLayers
843
- });
844
- return {
845
- rowKeyGetter,
846
- columns,
847
- rows,
848
- checkedRows: visibleLayers,
849
- onCheckedRowsChange: setVisibleLayers,
850
- rowActionsGetter
851
- };
852
- }
853
- function LayersTool() {
854
- const { columns, rows, rowKeyGetter, rowActionsGetter } = useMaster();
855
- const [divRef, setDivRef] = useStateRef(null);
856
- useDisableZoomEvents(divRef);
857
- return /* @__PURE__ */ jsx("div", { ref: setDivRef, style: { position: "relative", height: "100%" }, children: /* @__PURE__ */ jsx(
858
- DataGrid,
859
- {
860
- id: "layers",
861
- columns,
862
- rows,
863
- rowActionsGetter,
864
- rowKeyGetter,
865
- withActions: true,
866
- actionsProps: {
867
- withRowsCount: false,
868
- withSettings: false,
869
- withPager: false,
870
- withLocalFilters: false
871
- }
872
- }
873
- ) });
874
- }
875
- function MapSourcesTool() {
876
- const { getLabel } = useModuleDictionary();
877
- const { host_static_assets, environment_assets } = useEnvironment();
878
- const currentMapSourceId = useMapStore((state) => state.currentMapSourceId, shallow);
879
- const mapSources = useMapStore((state) => {
880
- return state.mapSourcesIds.map((id) => ({
881
- id,
882
- dictionaryId: state.hashMapSources[id].dictionaryId,
883
- iconUrl: state.hashMapSources[id].iconUrl,
884
- hasBicyclingLayer: state.hashMapSources[id].hasBicyclingLayer,
885
- hasTrafficLayer: state.hashMapSources[id].hasTrafficLayer,
886
- hasTransitLayer: state.hashMapSources[id].hasTransitLayer,
887
- roadSeletedOptions: state.hashMapSources[id].roadSelectedOptions
888
- }));
889
- }, shallow);
890
- const { setCurrentMapSource, setMapSourceRoadOptions: setMapSourceRoadMapOptions } = useMapStore(
891
- (state) => state.mapActions,
892
- shallow
893
- );
894
- const [divRef, setDivRef] = useStateRef(null);
895
- useDisableZoomEvents(divRef);
896
- const handleChange = (event) => {
897
- setCurrentMapSource(event.target.value);
898
- };
899
- return /* @__PURE__ */ jsx("div", { className: mapClasses.mapSourcesRoot, ref: setDivRef, children: /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
900
- RadioGroup,
901
- {
902
- "aria-labelledby": "demo-controlled-radio-buttons-group",
903
- name: "controlled-radio-buttons-group",
904
- value: currentMapSourceId,
905
- onChange: handleChange,
906
- children: mapSources.map((mapSourceOption) => /* @__PURE__ */ jsxs("div", { className: mapClasses.mapSourcesOption, children: [
907
- /* @__PURE__ */ jsx(
908
- FormControlLabel,
909
- {
910
- className: "",
911
- value: mapSourceOption.id,
912
- control: /* @__PURE__ */ jsx(Radio, {}),
913
- label: /* @__PURE__ */ jsxs("div", { className: mapClasses.mapSourcesOptionIconLabel, children: [
914
- /* @__PURE__ */ jsx(
915
- Icon,
916
- {
917
- src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${mapSourceOption.iconUrl}`
918
- }
919
- ),
920
- /* @__PURE__ */ jsx("span", { children: getLabel(mapSourceOption.dictionaryId) })
921
- ] })
922
- }
923
- ),
924
- (mapSourceOption.hasBicyclingLayer || mapSourceOption.hasTrafficLayer || mapSourceOption.hasTransitLayer) && /* @__PURE__ */ jsxs(
925
- "div",
926
- {
927
- className: clsx(
928
- mapClasses.mapSourcesOptionRoadOptions,
929
- currentMapSourceId !== mapSourceOption.id ? mapClasses.disabled : mapClasses.active
930
- ),
931
- children: [
932
- mapSourceOption.hasTrafficLayer && /* @__PURE__ */ jsxs("div", { className: mapClasses.mapSourcesOptionRoadOptionsCheck, children: [
933
- /* @__PURE__ */ jsx(
934
- CheckBox,
935
- {
936
- disabled: currentMapSourceId !== mapSourceOption.id,
937
- checked: mapSourceOption.roadSeletedOptions?.trafficLayer || false,
938
- onChange: (_e, checked) => {
939
- setMapSourceRoadMapOptions({ trafficLayer: checked });
940
- }
941
- }
942
- ),
943
- /* @__PURE__ */ jsx(
944
- Icon,
945
- {
946
- src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_SOURCE_ROAD_TRAFFIC}`
947
- }
948
- )
949
- ] }),
950
- mapSourceOption.hasTransitLayer && /* @__PURE__ */ jsxs("div", { className: mapClasses.mapSourcesOptionRoadOptionsCheck, children: [
951
- /* @__PURE__ */ jsx(
952
- CheckBox,
953
- {
954
- disabled: currentMapSourceId !== mapSourceOption.id,
955
- checked: mapSourceOption.roadSeletedOptions?.transitLayer || false,
956
- onChange: (_e, checked) => {
957
- setMapSourceRoadMapOptions({ transitLayer: checked });
958
- }
959
- }
960
- ),
961
- /* @__PURE__ */ jsx(
962
- Icon,
963
- {
964
- src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_SOURCE_ROAD_TRANSIT}`
965
- }
966
- )
967
- ] }),
968
- mapSourceOption.hasBicyclingLayer && /* @__PURE__ */ jsxs("div", { className: mapClasses.mapSourcesOptionRoadOptionsCheck, children: [
969
- /* @__PURE__ */ jsx(
970
- CheckBox,
971
- {
972
- disabled: currentMapSourceId !== mapSourceOption.id,
973
- checked: mapSourceOption.roadSeletedOptions?.bicyclingLayer || false,
974
- label: "Bycicle",
975
- onChange: (_e, checked) => {
976
- setMapSourceRoadMapOptions({ bicyclingLayer: checked });
977
- }
978
- }
979
- ),
980
- /* @__PURE__ */ jsx(
981
- Icon,
982
- {
983
- src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_SOURCE_ROAD_BICYCLING}`
984
- }
985
- )
986
- ] })
987
- ]
988
- }
989
- )
990
- ] }, mapSourceOption.dictionaryId))
991
- }
992
- ) }) });
993
- }
994
- function LayersButton(props) {
995
- const { type } = props;
996
- const [open, setOpen] = useState(null);
997
- const { host_static_assets, environment_assets } = useEnvironment();
998
- const theme = useTheme();
999
- const handleOpen = (event) => {
1000
- setOpen(event.currentTarget);
1001
- };
1002
- const handleClose = () => {
1003
- setOpen(null);
1004
- };
1005
- return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
1006
- /* @__PURE__ */ jsx(
1007
- IconButton,
1008
- {
1009
- onClick: handleOpen,
1010
- src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${type === "MapSources" ? MAP_ICONS.MAP_SOURCES_TOOL : MAP_ICONS.MAP_LAYERS_TOOL}`
1011
- }
1012
- ),
1013
- /* @__PURE__ */ jsx(
1014
- Popover,
1015
- {
1016
- className: type === "MapSources" ? mapClasses.mapSourcesPopoverRoot : mapClasses.layersPopoverRoot,
1017
- arrowType: "no-arrow",
1018
- open: Boolean(open),
1019
- anchorEl: open,
1020
- anchorOrigin: { vertical: "bottom", horizontal: "left" },
1021
- onClose: handleClose,
1022
- sx: {
1023
- ...type === "MapSources" ? theme.components?.M4LMapMapSources?.styleOverrides : theme.components?.M4LMapLayers?.styleOverrides
1024
- },
1025
- disableAutoFocus: true,
1026
- disableRestoreFocus: true,
1027
- disableEnforceFocus: true,
1028
- children: type === "MapSources" ? /* @__PURE__ */ jsx(MapSourcesTool, {}) : /* @__PURE__ */ jsx(LayersTool, {})
1029
- }
1030
- )
1031
- ] });
1032
- }
1033
- export {
1034
- LayersButton as L,
1035
- Popover as P,
1036
- TILE_LAYER_OSM as T,
1037
- PopoverMenuFields as a,
1038
- PopoverFilter as b,
1039
- TILE_LAYER_GOOGLE as c,
1040
- TILE_LAYER_GOOGLE_SATELLITE as d,
1041
- TILE_LAYER_GOOGLE_HYBRID as e,
1042
- TILE_LAYER_BING as f,
1043
- LanguagePopover as g
1044
- };