@m4l/components 0.2.13 → 0.2.15

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 (320) hide show
  1. package/@types/export.d.ts +7 -16
  2. package/{commonjs.333e55c7.js → commonjs.565e6834.js} +0 -5
  3. package/components/AccountPopover/index.d.ts +0 -1
  4. package/components/AccountPopover/{index.7060320a.js → index.da84c424.js} +12 -22
  5. package/components/AppBar/AppBar.d.ts +0 -24
  6. package/components/AppBar/classes/index.d.ts +0 -2
  7. package/components/AppBar/classes/types.d.ts +0 -2
  8. package/components/AppBar/{index.c8e7b25c.js → index.46f2db0a.js} +7 -45
  9. package/components/AppBar/types.d.ts +0 -14
  10. package/components/CommonActions/components/ActionCancel/{index.82313aef.js → index.06365996.js} +2 -2
  11. package/components/CommonActions/components/ActionFormCancel/index.2c1fff45.js +70 -0
  12. package/components/CommonActions/components/ActionFormIntro/{index.29891df9.js → index.885f49af.js} +2 -2
  13. package/components/CommonActions/components/ActionIntro/{index.c70ae272.js → index.b97cfeec.js} +2 -2
  14. package/components/CommonActions/components/Actions/index.8368ac0f.js +74 -0
  15. package/components/DataGrid/assets/icons/datagrid.svg +4 -0
  16. package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.d.ts +9 -0
  17. package/components/DataGrid/formatters/ColumnSetCheckFormatter/types.d.ts +6 -0
  18. package/components/DataGrid/formatters/columnPointsFormatter/{index.a19b7b90.js → index.5e645334.js} +1 -1
  19. package/components/DataGrid/{index.387652a9.js → index.e127cac8.js} +54 -732
  20. package/components/DataGrid/subcomponents/Actions/index.5947f820.js +591 -0
  21. package/components/DataGrid/subcomponents/editors/TextEditor/index.91380a55.js +64 -0
  22. package/components/DragResizeWindow/DragResizeWindow.d.ts +15 -0
  23. package/components/DragResizeWindow/classes/index.d.ts +6 -0
  24. package/components/DragResizeWindow/classes/types.d.ts +8 -0
  25. package/components/DragResizeWindow/constants.d.ts +3 -0
  26. package/components/DragResizeWindow/index.67aa1e22.js +445 -0
  27. package/components/DragResizeWindow/index.d.ts +2 -0
  28. package/components/DragResizeWindow/types.d.ts +169 -0
  29. package/components/DragResizeWindow/utils.d.ts +2 -0
  30. package/components/DynamicFilter/classes/index.d.ts +1 -1
  31. package/components/DynamicFilter/classes/types.d.ts +0 -1
  32. package/components/DynamicFilter/{index.9e9885b0.js → index.068ca09c.js} +25 -96
  33. package/components/GridLayout/{index.68093cfb.js → index.367e44f9.js} +8 -63
  34. package/components/GridLayout/index.d.ts +1 -1
  35. package/components/GridLayout/subcomponents/Griditem/{index.8e4af155.js → index.b3c79b77.js} +3 -3
  36. package/components/GridLayout/subcomponents/Responsive/{index.c32210fc.js → index.4234d9f3.js} +1 -1
  37. package/components/GridLayout/subcomponents/SizeProvider/index.0676f896.js +62 -0
  38. package/components/GridLayout/subcomponents/{WidthProvider → withSizeProvider}/index.d.ts +1 -1
  39. package/components/HelperText/{index.918bba47.js → index.7d2afdb3.js} +2 -23
  40. package/components/Icon/index.aa9949f0.js +147 -0
  41. package/components/Icon/types.d.ts +0 -1
  42. package/components/Image/{index.d684bdf2.js → index.d5fed0ab.js} +5 -47
  43. package/components/Image/types.d.ts +2 -2
  44. package/components/LanguagePopover/{index.424bad09.js → index.02987c68.js} +4 -20
  45. package/components/LinearProgressIndeterminate/{index.a0ad2d9e.js → index.2d53ade4.js} +1 -1
  46. package/components/LoadingError/{index.b3e4e8e5.js → index.991393ca.js} +5 -23
  47. package/components/MFLoader/{index.3d17dfc3.js → index.b928e361.js} +13 -22
  48. package/components/ModalDialog/{index.40f6571e.js → index.a30831c9.js} +5 -5
  49. package/components/NavLink/{index.ed4c0609.js → index.b75c91e1.js} +2 -22
  50. package/components/NoItemSelected/{index.5ed80b8e.js → index.1ddc6a38.js} +1 -1
  51. package/components/ObjectLogs/{index.3a939c6b.js → index.546bf5bf.js} +7 -84
  52. package/components/Page/{index.890fbaac.js → index.c3767243.js} +1 -1
  53. package/components/PaperForm/classes/index.d.ts +1 -2
  54. package/components/PaperForm/classes/types.d.ts +0 -1
  55. package/components/PaperForm/{index.013ed28b.js → index.27dafbcc.js} +6 -11
  56. package/components/PaperForm/types.d.ts +1 -4
  57. package/components/Period/{index.3bd05e05.js → index.288a0ec2.js} +5 -88
  58. package/components/PopupsProvider/classes/index.d.ts +11 -0
  59. package/components/PopupsProvider/classes/types.d.ts +9 -0
  60. package/components/PopupsProvider/constants.d.ts +10 -0
  61. package/components/PopupsProvider/contexts/PopupsContext/PopupsContext.d.ts +19 -0
  62. package/components/PopupsProvider/contexts/PopupsContext/helper.d.ts +7 -0
  63. package/components/PopupsProvider/contexts/PopupsContext/index.d.ts +1 -0
  64. package/components/PopupsProvider/contexts/PopupsContext/store.d.ts +16 -0
  65. package/components/PopupsProvider/contexts/PopupsContext/types.d.ts +117 -0
  66. package/components/PopupsProvider/hooks/usePopupsStore/index.d.ts +3 -0
  67. package/components/PopupsProvider/index.ae1bd010.js +247 -0
  68. package/components/PopupsProvider/index.d.ts +2 -0
  69. package/components/PopupsProvider/subcomponents/Popup/index.d.ts +8 -0
  70. package/components/PopupsProvider/subcomponents/Popup/types.d.ts +16 -0
  71. package/components/PopupsProvider/subcomponents/PopupsContainer/index.d.ts +2 -0
  72. package/components/PopupsProvider/subcomponents/PopupsContainer/types.d.ts +1 -0
  73. package/components/PrintingSystem/{index.70234425.js → index.b69edc07.js} +44 -20
  74. package/components/PrintingSystem/subcomponents/BodyNode/{index.1dd418aa.js → index.81da2c9c.js} +1 -1
  75. package/components/PrintingSystem/subcomponents/ChartNode/{index.6aadd6b3.js → index.1863bcf1.js} +4 -4
  76. package/components/PrintingSystem/subcomponents/DividerNode/{index.91e65ff6.js → index.0e6e76ad.js} +1 -1
  77. package/components/PrintingSystem/subcomponents/FooterNode/{index.c2481749.js → index.5af68fd5.js} +1 -1
  78. package/components/PrintingSystem/subcomponents/GridNode/{index.758d94d1.js → index.07d4f9a4.js} +7 -3
  79. package/components/PrintingSystem/subcomponents/HeaderNode/{index.732d7c58.js → index.dbf08ab4.js} +1 -1
  80. package/components/PrintingSystem/subcomponents/PaperNode/{index.1a20a9d4.js → index.d81d2f30.js} +4 -4
  81. package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.8402e742.js → index.4c20215d.js} +5 -3
  82. package/components/PrintingSystem/subcomponents/SectionNode/{index.25aeb4aa.js → index.72cb64b8.js} +1 -1
  83. package/components/PrintingSystem/subcomponents/TextBoxNode/{index.2b632722.js → index.41c261f4.js} +3 -3
  84. package/components/PrintingSystem/types.d.ts +3 -12
  85. package/components/PrintingSystem/utils/getEvalValue/index.d.ts +1 -0
  86. package/components/PropertyValue/classes/index.d.ts +1 -1
  87. package/components/PropertyValue/classes/types.d.ts +1 -4
  88. package/components/PropertyValue/index.92ccdf7a.js +220 -0
  89. package/components/PropertyValue/skeleton.d.ts +2 -0
  90. package/components/PropertyValue/types.d.ts +7 -5
  91. package/components/Resizeable/{index.6478d7d8.js → index.e4f47710.js} +5 -5
  92. package/components/ResizeableWindow/types.d.ts +3 -5
  93. package/components/ScrollBar/{index.010f1b9d.js → index.65bb2930.js} +1 -5
  94. package/components/SideBar/classes/index.d.ts +1 -1
  95. package/components/SideBar/{index.614f85fb.js → index.e4d2ee53.js} +31 -30
  96. package/components/SideBar/types.d.ts +3 -3
  97. package/components/SplitLayout/{index.30fd5861.js → index.9ef430f6.js} +1 -1
  98. package/components/animate/{index.4e9774a6.js → index.5d4575bc.js} +2 -6
  99. package/components/areas/components/AreasAdmin/{index.c1539c1b.js → index.8426755c.js} +29 -98
  100. package/components/areas/components/AreasViewer/classes/index.d.ts +1 -1
  101. package/components/areas/components/AreasViewer/{index.e084d8e9.js → index.6b310068.js} +24 -88
  102. package/components/areas/components/index.558684b3.js +1 -0
  103. package/components/areas/contexts/AreasContext/helper.d.ts +2 -2
  104. package/components/areas/contexts/AreasContext/{index.cffa1526.js → index.1e3974e1.js} +17 -10
  105. package/components/areas/contexts/index.24025b97.js +1 -0
  106. package/components/areas/hooks/index.d9dc1e21.js +1 -0
  107. package/components/areas/hooks/useAreas/{index.00031ac3.js → index.21fa4ab1.js} +1 -1
  108. package/components/areas/index.4cc6a221.js +22 -0
  109. package/components/formatters/BooleanFormatter/{index.5ed55bda.js → index.fcc47dfd.js} +3 -2
  110. package/components/formatters/PointsFormatter/{index.5c94c5e8.js → index.80a4e414.js} +2 -2
  111. package/components/formatters/PointsFormatter/index.d.ts +1 -1
  112. package/components/formatters/{index.4426a315.js → index.7d5cbac9.js} +3 -7
  113. package/components/hook-form/HelperError/index.66bbcac3.js +30 -0
  114. package/components/hook-form/RHFAutocomplete/classes/types.d.ts +0 -2
  115. package/components/hook-form/RHFAutocomplete/{index.01a8f57e.js → index.ea720b8f.js} +38 -44
  116. package/components/hook-form/RHFAutocomplete/subcomponents/RenderOption/index.d.ts +1 -1
  117. package/components/hook-form/RHFAutocomplete/subcomponents/Skeleton/types.d.ts +2 -1
  118. package/components/hook-form/RHFAutocomplete/types.d.ts +3 -8
  119. package/components/hook-form/RHFAutocompleteAsync/{index.df1d5bca.js → index.1609eaf0.js} +1 -1
  120. package/components/hook-form/RHFCheckbox/{index.23fc4851.js → index.a38715e3.js} +2 -22
  121. package/components/hook-form/RHFColorPicker/index.259b6f38.js +61 -0
  122. package/components/hook-form/RHFColorPicker/index.d.ts +0 -6
  123. package/components/hook-form/RHFColorPicker/types.d.ts +0 -5
  124. package/components/hook-form/RHFDateTime/{index.984b803f.js → index.8bd9e41e.js} +5 -21
  125. package/components/hook-form/RHFDateTime/types.d.ts +1 -0
  126. package/components/hook-form/RHFHelperError/index.d.ts +4 -0
  127. package/components/hook-form/RHFPeriod/{index.1852e7d3.js → index.89bebd60.js} +3 -2
  128. package/components/hook-form/RHFRadioGroup/{index.3b17819b.js → index.1ddb3d93.js} +1 -1
  129. package/components/hook-form/RHFTextField/{index.1167879e.js → index.2c8d4613.js} +6 -8
  130. package/components/hook-form/RHFUpload/{index.49edcb02.js → index.55e495bb.js} +7 -24
  131. package/components/index.d.ts +2 -3
  132. package/components/maps/components/GpsTools/GpsTools.d.ts +1 -0
  133. package/components/maps/components/GpsTools/classes/index.d.ts +4 -0
  134. package/components/maps/components/GpsTools/classes/types.d.ts +20 -0
  135. package/components/maps/components/GpsTools/constants.d.ts +8 -0
  136. package/components/maps/components/GpsTools/contexts/GpsToolsContext/index.d.ts +19 -0
  137. package/components/maps/components/GpsTools/contexts/GpsToolsContext/store.d.ts +16 -0
  138. package/components/maps/components/GpsTools/contexts/GpsToolsContext/types.d.ts +173 -0
  139. package/components/maps/components/GpsTools/hooks/useGpsToolsStore/index.d.ts +2 -0
  140. package/components/maps/components/GpsTools/hooks/useLayers/index.d.ts +1 -0
  141. package/components/maps/components/GpsTools/icons.d.ts +15 -0
  142. package/components/maps/components/GpsTools/index.1b6d82bc.js +2086 -0
  143. package/components/maps/components/GpsTools/index.d.ts +2 -0
  144. package/components/maps/components/GpsTools/subcomponents/TabTools/index.d.ts +9 -0
  145. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/constants.d.ts +7 -0
  146. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/index.d.ts +1 -0
  147. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/model.d.ts +122 -0
  148. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/constants.d.ts +20 -0
  149. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/helpers.d.ts +7 -0
  150. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts +11 -0
  151. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useSubmit.d.ts +8 -0
  152. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useSumbitErrorsFocus.d.ts +5 -0
  153. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useValidation.d.ts +22 -0
  154. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/index.d.ts +1 -0
  155. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/index.d.ts +1 -0
  156. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/types.d.ts +6 -0
  157. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/validations.d.ts +5 -0
  158. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/index.d.ts +1 -0
  159. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/types.d.ts +7 -0
  160. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/validations.d.ts +6 -0
  161. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/MyActions/index.d.ts +1 -0
  162. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/MyTabs/index.d.ts +1 -0
  163. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/StyleData/index.d.ts +1 -0
  164. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/StyleData/subcomponents/FillData/index.d.ts +1 -0
  165. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/StyleData/subcomponents/StrokeData/index.d.ts +1 -0
  166. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/StyleData/types.d.ts +10 -0
  167. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/types.d.ts +25 -0
  168. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofencesList/hooks/useCheckedFeatures.d.ts +9 -0
  169. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofencesList/hooks/useCheckedGeofences.d.ts +4 -0
  170. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofencesList/hooks/useColumns.d.ts +9 -0
  171. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofencesList/hooks/useMaster.d.ts +20 -0
  172. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofencesList/hooks/useRowActionsGetter.d.ts +9 -0
  173. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofencesList/index.d.ts +1 -0
  174. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/GeofencesTool/subcomponents/GeofencesList/subcomponents/Filter/index.d.ts +7 -0
  175. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/constants.d.ts +30 -0
  176. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/hooks/useMeasure.d.ts +31 -0
  177. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/hooks/useValidation.d.ts +10 -0
  178. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/index.d.ts +1 -0
  179. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/subcomponents/MeasureData/index.d.ts +1 -0
  180. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/subcomponents/MeasureData/types.d.ts +6 -0
  181. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/subcomponents/MeasureData/validations.d.ts +2 -0
  182. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/subcomponents/MyActions/index.d.ts +1 -0
  183. package/components/maps/components/GpsTools/subcomponents/TabTools/subcomponents/MeasureTool/types.d.ts +9 -0
  184. package/components/maps/components/GpsTools/types.d.ts +34 -0
  185. package/components/maps/components/Map/Map.d.ts +2 -0
  186. package/components/maps/components/Map/classes/index.d.ts +5 -0
  187. package/components/maps/components/Map/classes/types.d.ts +19 -0
  188. package/components/maps/components/Map/constants.d.ts +11 -0
  189. package/components/maps/components/Map/contexts/MapContext/MapContext.d.ts +19 -0
  190. package/components/maps/components/Map/contexts/MapContext/helper.d.ts +8 -0
  191. package/components/maps/components/Map/contexts/MapContext/index.d.ts +2 -0
  192. package/components/maps/components/Map/contexts/MapContext/store.d.ts +16 -0
  193. package/components/maps/components/Map/contexts/MapContext/types.d.ts +414 -0
  194. package/components/maps/components/Map/dictionary.d.ts +70 -0
  195. package/components/maps/components/Map/featureRenders/CommonFeatureRender/index.d.ts +8 -0
  196. package/components/maps/components/Map/featureRenders/MarkerFeatureRender/IconMarker.d.ts +6 -0
  197. package/components/maps/components/Map/featureRenders/MarkerFeatureRender/IconMarkerGrua.d.ts +1 -0
  198. package/components/maps/components/Map/featureRenders/MarkerFeatureRender/IconMarkerTaxi.d.ts +1 -0
  199. package/components/maps/components/Map/featureRenders/MarkerFeatureRender/index.d.ts +2 -0
  200. package/components/maps/components/Map/featureRenders/index.d.ts +1 -0
  201. package/components/maps/components/Map/hooks/useAutoFocus/index.d.ts +8 -0
  202. package/components/maps/components/Map/hooks/useAutoFocus/types.d.ts +15 -0
  203. package/components/maps/components/Map/hooks/useDisableZoomEvents/index.d.ts +1 -0
  204. package/components/maps/components/Map/hooks/useMapStore/index.d.ts +3 -0
  205. package/components/maps/components/Map/index.d.ts +7 -0
  206. package/components/maps/components/Map/index.f38df83e.js +1338 -0
  207. package/components/maps/components/Map/pluginLayers/PolylineWithArrows/index.d.ts +9 -0
  208. package/components/maps/components/Map/pluginLayers/index.d.ts +1 -0
  209. package/components/maps/components/Map/subcomponents/LayersContainer/index.d.ts +2 -0
  210. package/components/maps/components/Map/subcomponents/LayersTool/hooks/useCheckedLayers.d.ts +9 -0
  211. package/components/maps/components/Map/subcomponents/LayersTool/hooks/useColumns.d.ts +15 -0
  212. package/components/maps/components/Map/subcomponents/LayersTool/hooks/useMaster.d.ts +12 -0
  213. package/components/maps/components/Map/subcomponents/LayersTool/index.d.ts +1 -0
  214. package/components/maps/components/Map/subcomponents/LayersTool/model.d.ts +19 -0
  215. package/components/maps/components/Map/subcomponents/MainTools/index.d.ts +2 -0
  216. package/components/maps/components/Map/subcomponents/MainTools/types.d.ts +5 -0
  217. package/components/maps/components/Map/subcomponents/MyLayer/index.d.ts +17 -0
  218. package/components/maps/components/Map/subcomponents/MyLayer/subcomponents/MarkerClusterGroup/index.d.ts +20 -0
  219. package/components/maps/components/Map/subcomponents/MyLayer/subcomponents/MarkerClusterGroup/types.d.ts +11 -0
  220. package/components/maps/components/Map/subcomponents/MyLayer/subcomponents/RenderByEachFeatureComponent/index.d.ts +12 -0
  221. package/components/maps/components/Map/subcomponents/MyLayer/subcomponents/RenderByEachFeatureComponent/types.d.ts +5 -0
  222. package/components/maps/components/Map/subcomponents/MyLayer/types.d.ts +2 -0
  223. package/components/maps/components/Map/types.d.ts +28 -0
  224. package/components/maps/index.d.ts +3 -0
  225. package/components/modal/WindowBase.a4534b0b.js +74 -0
  226. package/components/modal/WindowConfirm.7a79bfa5.js +102 -0
  227. package/components/modal/index.61389369.js +57 -0
  228. package/components/mui_extended/Accordion/{index.3087f40e.js → index.f1289de0.js} +4 -4
  229. package/components/mui_extended/Button/classes/types.d.ts +0 -2
  230. package/components/mui_extended/Button/{index.0f2552ed.js → index.007f5a6e.js} +5 -5
  231. package/components/mui_extended/{CheckBox.38abccd8.js → CheckBox.e662d20c.js} +1 -1
  232. package/components/mui_extended/IconButton/{index.5afe56b7.js → index.b705c196.js} +2 -2
  233. package/components/mui_extended/LoadingButton/classes/constants.d.ts +1 -1
  234. package/components/mui_extended/MenuActions/{index.cc54c35c.js → index.aa43c4f2.js} +5 -19
  235. package/components/mui_extended/Pager/{index.5fbbefe2.js → index.9928807e.js} +3 -2
  236. package/components/mui_extended/Tab/{index.ae9ea641.js → index.cefe27e7.js} +6 -6
  237. package/components/mui_extended/ToggleButton/ToggleButton.d.ts +1 -1
  238. package/components/mui_extended/ToggleButton/{index.667d63cd.js → index.b053aa70.js} +1 -5
  239. package/components/mui_extended/ToggleButton/types.d.ts +2 -2
  240. package/components/mui_extended/ToggleIconButton/{index.2de19be3.js → index.80d38bf4.js} +1 -6
  241. package/components/mui_extended/ToggleIconButton/types.d.ts +1 -1
  242. package/components/mui_extended/index.b606cd9d.js +1 -0
  243. package/contexts/ModalContext/{index.ef38d747.js → index.054af5d8.js} +1 -1
  244. package/hocs/withToggle/index.d.ts +1 -9
  245. package/hocs/withToggle/types.d.ts +10 -0
  246. package/hooks/useFormAddEdit/index.b4348b6a.js +96 -0
  247. package/hooks/useFormReadyForUpdate/index.d.ts +6 -0
  248. package/hooks/useFormReadyForUpdate/index.f60f500e.js +20 -0
  249. package/hooks/useModal/{index.8acace45.js → index.acc61361.js} +1 -1
  250. package/hooks/useSizeContainer/contants.d.ts +1 -0
  251. package/hooks/useSizeContainer/index.62b4e0c4.js +35 -0
  252. package/hooks/useSizeContainer/index.d.ts +8 -0
  253. package/hooks/useStateRef/index.538edb89.js +15 -0
  254. package/hooks/useStateRef/index.d.ts +8 -0
  255. package/hooks/useTab/index.500c048b.js +12 -0
  256. package/index.js +225 -213
  257. package/package.json +6 -8
  258. package/{react-draggable.ee21cb7e.js → react-draggable.2bc0e647.js} +4 -4
  259. package/{react-json-view.5636414a.js → react-json-view.57125fcf.js} +1 -1
  260. package/{react-resizable.ee028152.js → react-resizable.53094455.js} +5 -5
  261. package/{react-splitter-layout.c5d98bf7.js → react-splitter-layout.8b1655c8.js} +3 -3
  262. package/test/getNameDataTestId.14875ec7.js +6 -0
  263. package/utils/capitalizeFirstLetter.d.ts +1 -0
  264. package/utils/getComponentUtilityClass.d.ts +1 -0
  265. package/utils/getPaletteColor.d.ts +2 -0
  266. package/utils/getThemeVariantColor.d.ts +3 -0
  267. package/utils/getTransformXY.d.ts +4 -0
  268. package/utils/index.d.ts +6 -7
  269. package/utils/isValidDate.d.ts +1 -0
  270. package/utils/types.d.ts +16 -0
  271. package/components/CommonActions/components/ActionFormCancel/index.3b2605ee.js +0 -144
  272. package/components/CommonActions/components/Actions/index.93e9112b.js +0 -161
  273. package/components/DraggableWindow/index.d.ts +0 -3
  274. package/components/DraggableWindow/index.f9f067bd.js +0 -39
  275. package/components/DraggableWindow/types.d.ts +0 -5
  276. package/components/Icon/index.e215d0f0.js +0 -248
  277. package/components/PDFViewer/PDFViewer.d.ts +0 -2
  278. package/components/PDFViewer/classes/constants.d.ts +0 -1
  279. package/components/PDFViewer/classes/index.d.ts +0 -7
  280. package/components/PDFViewer/classes/types.d.ts +0 -7
  281. package/components/PDFViewer/index.4d16e5bc.js +0 -83
  282. package/components/PDFViewer/index.d.ts +0 -1
  283. package/components/PDFViewer/types.d.ts +0 -3
  284. package/components/PrintingSystem/subcomponents/QRImageNode/index.d.ts +0 -2
  285. package/components/PrintingSystem/subcomponents/QRImageNode/types.d.ts +0 -3
  286. package/components/PropertyValue/index.45482ca3.js +0 -222
  287. package/components/ToastContainer/ToastContainer.d.ts +0 -2
  288. package/components/ToastContainer/classes/constants.d.ts +0 -1
  289. package/components/ToastContainer/classes/index.d.ts +0 -8
  290. package/components/ToastContainer/classes/types.d.ts +0 -9
  291. package/components/ToastContainer/index.5e729fbb.js +0 -89
  292. package/components/ToastContainer/index.d.ts +0 -2
  293. package/components/ToastContainer/subcomponents/ToastMessage/index.d.ts +0 -2
  294. package/components/ToastContainer/subcomponents/ToastMessage/types.d.ts +0 -5
  295. package/components/ToastContainer/types.d.ts +0 -4
  296. package/components/areas/components/index.4381fcfa.js +0 -32
  297. package/components/areas/contexts/index.003a53c1.js +0 -4
  298. package/components/areas/hooks/index.0184c6f7.js +0 -4
  299. package/components/areas/index.1b5b2267.js +0 -56
  300. package/components/hook-form/RHFColorPicker/classes/constants.d.ts +0 -1
  301. package/components/hook-form/RHFColorPicker/classes/index.d.ts +0 -11
  302. package/components/hook-form/RHFColorPicker/classes/types.d.ts +0 -11
  303. package/components/hook-form/RHFColorPicker/index.c7695748.js +0 -166
  304. package/components/hook-form/RHFColorPicker/subcomponents/Skeleton/indext.d.ts +0 -1
  305. package/components/maps/leaflet.d.ts +0 -29
  306. package/components/modal/WindowBase.8e3e5337.js +0 -158
  307. package/components/modal/WindowConfirm.eec3e5d0.js +0 -186
  308. package/components/modal/index.ac0c9093.js +0 -146
  309. package/components/mui_extended/index.6837d969.js +0 -24
  310. package/hooks/useFormAddEdit/index.8276444a.js +0 -181
  311. package/hooks/useTab/index.07f652ec.js +0 -101
  312. package/node_modules.79f5ed2f.js +0 -6921
  313. package/vendor.f0742647.js +0 -140
  314. package/components/GridLayout/subcomponents/{GridItem → Griditem}/index.d.ts +0 -0
  315. package/components/GridLayout/subcomponents/{GridItem → Griditem}/types.d.ts +0 -0
  316. package/components/mui_extended/Badge/{index.b09524fe.js → index.09f5aee5.js} +1 -1
  317. package/components/mui_extended/Popover/{index.9f35d0eb.js → index.b3eca6b1.js} +2 -2
  318. package/components/mui_extended/Tooltip/{index.5a795dcd.js → index.24a2bc3f.js} +1 -1
  319. package/components/mui_extended/Typography/{index.443590d6.js → index.379dd374.js} +1 -1
  320. package/utils/{index.de903261.js → index.9ad3909a.js} +3 -3
@@ -0,0 +1,2086 @@
1
+ import { createContext, useRef, useEffect, useState, useMemo, useCallback, useContext } from "react";
2
+ import { createStore, useStore } from "zustand";
3
+ import { shallow } from "zustand/shallow";
4
+ import { useResponsiveDesktop, useFirstRender } from "@m4l/graphics";
5
+ import { useModuleDictionary, useModuleSkeleton, useEnvironment, useNetwork, useModulePrivileges, useHostTools, usePaginate } from "@m4l/core";
6
+ import { devtools } from "zustand/middleware";
7
+ import { immer } from "zustand/middleware/immer";
8
+ import { enableMapSet } from "immer";
9
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
10
+ import { D as DICCTIONARY, u as useMapStore, m as mapClasses, a as MAP_ZINDEX_DEFAULT, C as CommonFeatureRender, M as MAP_ZINDEX_OVER_MAP, b as useDisableZoomEvents } from "../Map/index.f38df83e.js";
11
+ import { D as DynamicFilter } from "../../../DynamicFilter/index.068ca09c.js";
12
+ import { e as ColumnSetCheckFormatter, f as columnDateFormatter, c as DataGrid } from "../../../DataGrid/index.e127cac8.js";
13
+ import { u as useModal } from "../../../../hooks/useModal/index.acc61361.js";
14
+ import { W as WindowConfirm } from "../../../modal/WindowConfirm.7a79bfa5.js";
15
+ import { generateUtilityClasses } from "@mui/material";
16
+ import "@mui/base";
17
+ import { S as Stack } from "../../../mui_extended/Stack/index.0e53197c.js";
18
+ import { B as Button } from "../../../mui_extended/Button/index.007f5a6e.js";
19
+ import { useFormContext, useWatch } from "react-hook-form";
20
+ import { H as HelperError } from "../../../hook-form/HelperError/index.66bbcac3.js";
21
+ import { A as Actions } from "../../../CommonActions/components/Actions/index.8368ac0f.js";
22
+ import { A as ActionFormIntro } from "../../../CommonActions/components/ActionFormIntro/index.885f49af.js";
23
+ import { useMap } from "react-leaflet";
24
+ import { u as useFormReadyForUpdate } from "../../../../hooks/useFormReadyForUpdate/index.f60f500e.js";
25
+ import * as L from "leaflet";
26
+ import { u as useTab } from "../../../../hooks/useTab/index.500c048b.js";
27
+ import { P as PaperForm } from "../../../PaperForm/index.27dafbcc.js";
28
+ import { R as RHFAutocomplete } from "../../../hook-form/RHFAutocomplete/index.ea720b8f.js";
29
+ import { R as RHFTextField } from "../../../hook-form/RHFTextField/index.2c8d4613.js";
30
+ import { P as PropertyValue } from "../../../PropertyValue/index.92ccdf7a.js";
31
+ import { R as RHFColorPicker } from "../../../hook-form/RHFColorPicker/index.259b6f38.js";
32
+ import clsx from "clsx";
33
+ import { T as Tabs, a as Tab, b as TabContent, c as TabProvider } from "../../../mui_extended/Tab/index.cefe27e7.js";
34
+ import { T as Tooltip } from "../../../mui_extended/Tooltip/index.24a2bc3f.js";
35
+ import * as Yup from "yup";
36
+ import { u as useFormAddEdit } from "../../../../hooks/useFormAddEdit/index.b4348b6a.js";
37
+ import { R as RHFormProvider } from "../../../../contexts/RHFormContext/index.7769076a.js";
38
+ import { R as RHFAutocompleteAsync } from "../../../hook-form/RHFAutocompleteAsync/index.1609eaf0.js";
39
+ import "@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css";
40
+ import "@geoman-io/leaflet-geoman-free";
41
+ import { styled } from "@mui/material/styles";
42
+ import { u as useStateRef } from "../../../../hooks/useStateRef/index.538edb89.js";
43
+ enableMapSet();
44
+ const createGpsToolsStore = (initProps) => {
45
+ const startProps = {
46
+ currentTabTool: "geofences",
47
+ geofenceState: {
48
+ currentGeofenceTool: "list",
49
+ rows: [],
50
+ checkedGeofences: /* @__PURE__ */ new Set(),
51
+ checkedCrossingFeatures: /* @__PURE__ */ new Set(),
52
+ checkedInternalFeatures: /* @__PURE__ */ new Set(),
53
+ hashGeofences: {}
54
+ },
55
+ ...initProps
56
+ };
57
+ return createStore(
58
+ devtools(
59
+ immer((set, _get) => ({
60
+ ...startProps,
61
+ gpsToolsActions: {
62
+ init: () => {
63
+ set((state) => {
64
+ state.ownerState.status = "ready";
65
+ });
66
+ },
67
+ setGpsToolsState: (status) => {
68
+ set((state) => {
69
+ state.ownerState.status = status;
70
+ });
71
+ },
72
+ setHandlerGetLabel: (newHandler) => {
73
+ set((state) => {
74
+ state.getLabel = newHandler;
75
+ });
76
+ },
77
+ setExternalState: (newExternalState) => {
78
+ set((state) => {
79
+ state.ownerState = { ...state.ownerState, ...newExternalState };
80
+ });
81
+ },
82
+ setCurrentTabTool: (newTabTool) => {
83
+ set((state) => {
84
+ state.currentTabTool = newTabTool;
85
+ });
86
+ }
87
+ },
88
+ geofenceActions: {
89
+ goToAddEdit: (geofenceId) => {
90
+ set((state) => {
91
+ state.geofenceState.currentGeofenceTool = "add_edit";
92
+ state.geofenceState.geofenceId = geofenceId;
93
+ });
94
+ },
95
+ goToList: (geofenceId) => {
96
+ set((state) => {
97
+ state.geofenceState.currentGeofenceTool = "list";
98
+ state.geofenceState.geofenceId = geofenceId;
99
+ });
100
+ },
101
+ addGeofence: (geofenceId, geofence) => {
102
+ set((state) => {
103
+ state.geofenceState.hashGeofences[geofenceId] = geofence;
104
+ });
105
+ },
106
+ updatePartialGeofence: (geofenceId, geofence) => {
107
+ set((state) => {
108
+ state.geofenceState.hashGeofences[geofenceId] = { ...state.geofenceState.hashGeofences[geofenceId], ...geofence };
109
+ });
110
+ },
111
+ updateRows: (newRows) => {
112
+ set((state) => {
113
+ state.geofenceState.rows = newRows;
114
+ });
115
+ },
116
+ setCheckedGeofences: (newGeofences) => {
117
+ set((state) => {
118
+ state.geofenceState.checkedGeofences = new Set(newGeofences);
119
+ });
120
+ },
121
+ setCheckedCrossingFeatures: (newFeatures) => {
122
+ set((state) => {
123
+ state.geofenceState.checkedCrossingFeatures = new Set(newFeatures);
124
+ });
125
+ },
126
+ setCheckedInternalFeatures: (newFeatures) => {
127
+ set((state) => {
128
+ state.geofenceState.checkedInternalFeatures = new Set(newFeatures);
129
+ });
130
+ }
131
+ }
132
+ })),
133
+ { name: `Map Tools Store` }
134
+ )
135
+ );
136
+ };
137
+ const GpsToolsContext = createContext(null);
138
+ function GpsToolsProvider(props) {
139
+ const {
140
+ children
141
+ } = props;
142
+ const {
143
+ getLabel
144
+ } = useModuleDictionary();
145
+ const isDesktop = useResponsiveDesktop();
146
+ const isSkeleton = useModuleSkeleton();
147
+ const isFirstRender = useFirstRender([getLabel]);
148
+ const mapStoreRef = useRef();
149
+ if (!mapStoreRef.current) {
150
+ mapStoreRef.current = createGpsToolsStore({
151
+ getLabel,
152
+ ownerState: {
153
+ status: "init",
154
+ isMobile: !isDesktop,
155
+ isSkeleton,
156
+ focus: false
157
+ }
158
+ });
159
+ }
160
+ const {
161
+ setHandlerGetLabel,
162
+ setExternalState
163
+ } = useStore(mapStoreRef.current, (state) => state.gpsToolsActions, shallow);
164
+ useEffect(() => {
165
+ if (!isFirstRender) {
166
+ setHandlerGetLabel(getLabel);
167
+ }
168
+ }, [getLabel]);
169
+ useEffect(() => {
170
+ if (isFirstRender) {
171
+ return;
172
+ }
173
+ setExternalState({
174
+ isMobile: !isDesktop,
175
+ isSkeleton
176
+ });
177
+ }, [isDesktop, isSkeleton]);
178
+ return /* @__PURE__ */ jsx(GpsToolsContext.Provider, {
179
+ value: mapStoreRef.current,
180
+ children
181
+ });
182
+ }
183
+ const COMPONENT_CLASS_NAME = "M4LGpsTools";
184
+ const COMPONENT_MAP_TOOLS_ID = "gps_tools";
185
+ const STYLE_OPACITIES = [
186
+ {
187
+ value: 0,
188
+ label: "0%"
189
+ },
190
+ {
191
+ value: 0.1,
192
+ label: "10%"
193
+ },
194
+ {
195
+ value: 0.2,
196
+ label: "20%"
197
+ },
198
+ {
199
+ value: 0.3,
200
+ label: "30%"
201
+ },
202
+ {
203
+ value: 0.4,
204
+ label: "40%"
205
+ },
206
+ {
207
+ value: 0.5,
208
+ label: "50%"
209
+ },
210
+ {
211
+ value: 1,
212
+ label: "100%"
213
+ }
214
+ ];
215
+ const STYLE_WHEIGHTS = [
216
+ {
217
+ value: 0,
218
+ label: "0px"
219
+ },
220
+ {
221
+ value: 1,
222
+ label: "1px"
223
+ },
224
+ {
225
+ value: 2,
226
+ label: "2px"
227
+ },
228
+ {
229
+ value: 3,
230
+ label: "3px"
231
+ },
232
+ {
233
+ value: 4,
234
+ label: "4px"
235
+ }
236
+ ];
237
+ const STYLE_PATTERNS = [
238
+ {
239
+ value: "",
240
+ label: "------"
241
+ },
242
+ {
243
+ value: "4 1 2",
244
+ label: "-- - - --"
245
+ }
246
+ ];
247
+ const icons = {
248
+ GEOMETRY_CIRCLE: "geometry_circle.svg",
249
+ GEOMETRY_RECTANGLE: "geometry_rectangle.svg",
250
+ GEOMETRY_POLYGON: "geometry_polygon.svg",
251
+ ADD: "add.svg",
252
+ MEASURE: "measure.svg",
253
+ GENERAL: "general.svg",
254
+ CONFIG: "config.svg",
255
+ STROKE: "stroke.svg",
256
+ FILL: "fill.svg",
257
+ EDIT: "edit.svg",
258
+ DELETE: "delete.svg",
259
+ ACTIVE: "active.svg",
260
+ NAME: "name.svg"
261
+ };
262
+ function Filter(props) {
263
+ const {
264
+ refresh,
265
+ setBackendQueryParams
266
+ } = props;
267
+ const {
268
+ host_static_assets,
269
+ environment_assets
270
+ } = useEnvironment();
271
+ const [initialFilter] = useState(() => {
272
+ return [];
273
+ });
274
+ const onChangeFilter = (_initialFilters, rawFilters) => {
275
+ setBackendQueryParams({
276
+ f: rawFilters
277
+ });
278
+ refresh();
279
+ };
280
+ return /* @__PURE__ */ jsx(DynamicFilter, {
281
+ withAllField: true,
282
+ onChangeFilters: onChangeFilter,
283
+ fields: [{
284
+ name: "id",
285
+ dictionaryId: DICCTIONARY.LABEL_ID,
286
+ type: "number",
287
+ multiple: true,
288
+ presence: "optional",
289
+ urlIcon: `${host_static_assets}/${environment_assets}/components/${COMPONENT_MAP_TOOLS_ID}/assets/icons/${icons.ACTIVE}`,
290
+ defaultOperand1: true
291
+ }, {
292
+ name: "name",
293
+ dictionaryId: DICCTIONARY.LABEL_NAME,
294
+ type: "string",
295
+ multiple: true,
296
+ presence: "optional",
297
+ urlIcon: `${host_static_assets}/${environment_assets}/components/${COMPONENT_MAP_TOOLS_ID}/assets/icons/${icons.NAME}`
298
+ }],
299
+ initialApplyedFilters: initialFilter
300
+ });
301
+ }
302
+ function useColumns(props) {
303
+ const {
304
+ rowKeyGetter
305
+ } = props;
306
+ const {
307
+ getLabel
308
+ } = useModuleDictionary();
309
+ const useHook = (field) => {
310
+ return useGpsToolsStore((state) => {
311
+ return field === "CrossingFeatures" ? [state.geofenceState.checkedCrossingFeatures, state.geofenceActions.setCheckedCrossingFeatures] : [state.geofenceState.checkedInternalFeatures, state.geofenceActions.setCheckedInternalFeatures];
312
+ }, shallow);
313
+ };
314
+ const columns = useMemo(() => [{
315
+ key: "id",
316
+ name: getLabel(DICCTIONARY.LABEL_ID),
317
+ type: "number",
318
+ width: 40,
319
+ visible: false
320
+ }, {
321
+ key: "name",
322
+ name: getLabel(DICCTIONARY.LABEL_NAME),
323
+ type: "string",
324
+ width: 300
325
+ }, {
326
+ key: "checkedCrossingFeatures",
327
+ name: getLabel(DICCTIONARY.LABEL_VIEW_TRANSIT_FEATURES),
328
+ width: 80,
329
+ type: "boolean",
330
+ formatter: ColumnSetCheckFormatter({
331
+ field: "CrossingFeatures",
332
+ rowKeyGetter,
333
+ useHook
334
+ }),
335
+ cellClass: "rdg-cell-align-center"
336
+ }, {
337
+ key: "checkedInternalFeatures",
338
+ name: getLabel(DICCTIONARY.LABEL_VIEW_INTERNAL_FEATURES),
339
+ width: 80,
340
+ type: "boolean",
341
+ formatter: ColumnSetCheckFormatter({
342
+ field: "InternalFeatures",
343
+ rowKeyGetter,
344
+ useHook
345
+ }),
346
+ cellClass: "rdg-cell-align-center"
347
+ }, {
348
+ key: "created_at",
349
+ name: getLabel(DICCTIONARY.LABEL_CREATED_AT),
350
+ type: "date",
351
+ formatter: columnDateFormatter({
352
+ presentationType: "datetime",
353
+ fieldValue: "row.created_at"
354
+ })
355
+ }, {
356
+ key: "updated_at",
357
+ name: getLabel(DICCTIONARY.LABEL_UPDATED_AT),
358
+ type: "date",
359
+ formatter: columnDateFormatter({
360
+ presentationType: "datetime",
361
+ fieldValue: "row.updated_at"
362
+ })
363
+ }], [getLabel]);
364
+ return {
365
+ columns
366
+ };
367
+ }
368
+ const ENDPOINT_GEOFENCE_GET = "geofences";
369
+ const ENDPOINT_GEOFENCE_NEW_EDIT = "geofences";
370
+ var GeofencesFeaturesLayers = /* @__PURE__ */ ((GeofencesFeaturesLayers2) => {
371
+ GeofencesFeaturesLayers2["LAYER_GEOFENCES"] = "geofences";
372
+ GeofencesFeaturesLayers2["LAYER_GEOFENCES_TRANSIT_FEATURES"] = "geofencesCrossingFeatures";
373
+ GeofencesFeaturesLayers2["LAYER_GEOFENCES_INTERNAL_FEATURES"] = "geofencesInternalFeatures";
374
+ return GeofencesFeaturesLayers2;
375
+ })(GeofencesFeaturesLayers || {});
376
+ function useRowActionsGetter(props) {
377
+ const {
378
+ fullRefresh
379
+ } = props;
380
+ const {
381
+ networkOperation
382
+ } = useNetwork();
383
+ const {
384
+ openModal,
385
+ closeModal
386
+ } = useModal();
387
+ const {
388
+ getLabel
389
+ } = useModuleDictionary();
390
+ const {
391
+ hasPrivilege
392
+ } = useModulePrivileges();
393
+ const {
394
+ host_static_assets,
395
+ environment_assets
396
+ } = useEnvironment();
397
+ const {
398
+ goToAddEdit
399
+ } = useGpsToolsStore((state) => state.geofenceActions, shallow);
400
+ const {
401
+ removeFeature
402
+ } = useMapStore((state) => state.mapActions, shallow);
403
+ const {
404
+ toast
405
+ } = useHostTools();
406
+ const isDesktop = useResponsiveDesktop();
407
+ const [urlIconEdit] = useState(`${host_static_assets}/${environment_assets}/frontend/components/maptools/assets/icons/${icons.EDIT}`);
408
+ const [urlIconDelete] = useState(`${host_static_assets}/${environment_assets}/frontend/domain/microfrontends/maptools/assets/icons/${icons.DELETE}`);
409
+ const goEdit = useCallback((objectId) => {
410
+ goToAddEdit(objectId);
411
+ removeFeature(GeofencesFeaturesLayers.LAYER_GEOFENCES, objectId);
412
+ }, [getLabel]);
413
+ const onDelete = useCallback((row) => {
414
+ openModal({
415
+ window: /* @__PURE__ */ jsx(WindowConfirm, {
416
+ title: getLabel(DICCTIONARY.MODAL_DELETE_GEO_TITLE),
417
+ msg: getLabel(DICCTIONARY.MODAL_DELETE_GEO_MESSAGE),
418
+ onClickIntro: () => onConfirmDelete(row)
419
+ }),
420
+ variant: "delete",
421
+ initialWidth: 300,
422
+ initialHeigth: 350
423
+ });
424
+ }, [getLabel]);
425
+ const onConfirmDelete = useCallback((row) => {
426
+ networkOperation({
427
+ method: "DELETE",
428
+ endPoint: `geofences/${row.id}`
429
+ }).then((response) => {
430
+ toast(response.message, {
431
+ type: "success"
432
+ });
433
+ fullRefresh();
434
+ });
435
+ closeModal();
436
+ }, []);
437
+ const rowActionsGetter = useCallback((row) => {
438
+ const conditionalItems = [];
439
+ conditionalItems.push({
440
+ urlIcon: urlIconEdit,
441
+ dictionaryId: DICCTIONARY.ROW_ACTION_GEO_EDIT,
442
+ onClick: () => {
443
+ goEdit(row.id);
444
+ },
445
+ disabled: !row.authUserOptions.edit
446
+ });
447
+ return conditionalItems;
448
+ }, [hasPrivilege, goEdit, onDelete, urlIconDelete, urlIconEdit, isDesktop]);
449
+ return {
450
+ rowActionsGetter
451
+ };
452
+ }
453
+ function useCheckedGeofences() {
454
+ const [checkedGeofences, hashGeofences] = useGpsToolsStore((state) => [state.geofenceState.checkedGeofences, state.geofenceState.hashGeofences], shallow);
455
+ const {
456
+ setCheckedGeofences,
457
+ updatePartialGeofence
458
+ } = useGpsToolsStore((state) => state.geofenceActions, shallow);
459
+ const {
460
+ setFeatureData,
461
+ removeFeature,
462
+ getFeatureIds
463
+ } = useMapStore((state) => state.mapActions, shallow);
464
+ const {
465
+ networkOperation
466
+ } = useNetwork();
467
+ useEffect(() => {
468
+ const mapFeatureIds = getFeatureIds(GeofencesFeaturesLayers.LAYER_GEOFENCES);
469
+ checkedGeofences.forEach((chkRow) => {
470
+ const geofence = hashGeofences[chkRow];
471
+ if (!geofence) {
472
+ return;
473
+ }
474
+ if (!mapFeatureIds.includes(chkRow) || !geofence.hasRenderizedGeofence) {
475
+ if (!geofence.geometry) {
476
+ networkOperation({
477
+ method: "GET",
478
+ endPoint: `geofences/${geofence.id}`,
479
+ isRemote: false,
480
+ responseToCamelCase: true
481
+ }).then((response) => {
482
+ console.log("onCheckedRowsChange response:", response.data);
483
+ const geoLoaded = {
484
+ geometry: response.data.geometry,
485
+ properties: response.data.properties,
486
+ countCrossingFeatures: response.data.countCrossingFeatures,
487
+ hasRenderizedGeofence: false
488
+ };
489
+ if (geoLoaded.geometry) {
490
+ if (checkedGeofences.has(geofence.id)) {
491
+ setFeatureData("geofences", chkRow, geoLoaded.geometry, geoLoaded.properties);
492
+ geoLoaded.hasRenderizedGeofence = true;
493
+ }
494
+ }
495
+ updatePartialGeofence(geofence.id, geoLoaded);
496
+ });
497
+ } else {
498
+ setFeatureData(GeofencesFeaturesLayers.LAYER_GEOFENCES, chkRow, geofence.geometry, geofence.properties);
499
+ updatePartialGeofence(geofence.id, {
500
+ hasRenderizedGeofence: true
501
+ });
502
+ }
503
+ }
504
+ });
505
+ mapFeatureIds.forEach((mapFeatureId) => {
506
+ if (!checkedGeofences.has(Number(mapFeatureId))) {
507
+ removeFeature(GeofencesFeaturesLayers.LAYER_GEOFENCES, mapFeatureId);
508
+ }
509
+ });
510
+ return () => {
511
+ };
512
+ }, [checkedGeofences]);
513
+ return {
514
+ checkedGeofences,
515
+ setCheckedGeofences
516
+ };
517
+ }
518
+ function useCheckedFeatures(layerId, featuresType, endpoint) {
519
+ const [checkedFeatures, setCheckedFeatures, hashGeofences] = useGpsToolsStore((state) => {
520
+ return featuresType === "CrossingFeatures" ? [state.geofenceState.checkedCrossingFeatures, state.geofenceActions.setCheckedCrossingFeatures, state.geofenceState.hashGeofences] : [state.geofenceState.checkedInternalFeatures, state.geofenceActions.setCheckedInternalFeatures, state.geofenceState.hashGeofences];
521
+ }, shallow);
522
+ const {
523
+ setFeatureData,
524
+ removeFeature,
525
+ getFeatureIds
526
+ } = useMapStore((state) => state.mapActions, shallow);
527
+ const {
528
+ networkOperation
529
+ } = useNetwork();
530
+ useEffect(() => {
531
+ const mapFeatureIds = getFeatureIds(layerId);
532
+ checkedFeatures.forEach((chkRow) => {
533
+ const geofence = hashGeofences[chkRow];
534
+ if (!geofence) {
535
+ return;
536
+ }
537
+ if (!mapFeatureIds.find((fId) => fId.toString().includes(`geo_${geofence.id}_fid`)) || !geofence[`hasRenderized${featuresType}`]) {
538
+ const currentGeofenceLoadedFeatures = geofence[`loaded${featuresType}`];
539
+ if (!currentGeofenceLoadedFeatures) {
540
+ networkOperation({
541
+ method: "GET",
542
+ endPoint: `geofences/${geofence.id}/${endpoint}`,
543
+ isRemote: false,
544
+ responseToCamelCase: true
545
+ }).then((response) => {
546
+ console.log("onCheckedGeometriesChange response:", response.data);
547
+ geofence[`loaded${featuresType}`] = response.data;
548
+ const newGeofenceLoadedFeatures = geofence[`loaded${featuresType}`];
549
+ if (newGeofenceLoadedFeatures && Array.isArray(geofence[`loaded${featuresType}`])) {
550
+ if (checkedFeatures.has(geofence.id)) {
551
+ newGeofenceLoadedFeatures.forEach((feature) => {
552
+ setFeatureData(layerId, `geo_${geofence.id}_fid_${feature.id}`, feature.geometry, feature.properties);
553
+ });
554
+ geofence[`hasRenderized${featuresType}`] = true;
555
+ }
556
+ }
557
+ }).catch(() => {
558
+ });
559
+ } else {
560
+ currentGeofenceLoadedFeatures.forEach((feature) => {
561
+ setFeatureData(layerId, `geo_${geofence.id}_fid_${feature.id}`, feature.geometry, feature.properties);
562
+ });
563
+ geofence[`hasRenderized${featuresType}`] = true;
564
+ }
565
+ }
566
+ });
567
+ mapFeatureIds.forEach((mapFeatureId) => {
568
+ const featureId = Number(mapFeatureId.toString().split("_")[1]);
569
+ if (!checkedFeatures.has(featureId)) {
570
+ removeFeature(layerId, mapFeatureId);
571
+ }
572
+ });
573
+ return () => {
574
+ };
575
+ }, [checkedFeatures]);
576
+ return [checkedFeatures, setCheckedFeatures];
577
+ }
578
+ function useMaster() {
579
+ const {
580
+ goToAddEdit
581
+ } = useGpsToolsStore((state) => state.geofenceActions, shallow);
582
+ const [checkedGeofences, hashGeofences, initialRows] = useGpsToolsStore((state) => [state.geofenceState.checkedGeofences, state.geofenceState.hashGeofences, state.geofenceState.rows], shallow);
583
+ const {
584
+ setCheckedGeofences,
585
+ addGeofence,
586
+ updatePartialGeofence,
587
+ updateRows
588
+ } = useGpsToolsStore((state) => state.geofenceActions, shallow);
589
+ useCheckedGeofences();
590
+ const [checkedCrossingFeatures, setCheckedCrossingFeatures] = useCheckedFeatures(GeofencesFeaturesLayers.LAYER_GEOFENCES_TRANSIT_FEATURES, "CrossingFeatures", "crossing_features");
591
+ const [checkedInternalFeatures, setCheckedInternalFeatures] = useCheckedFeatures(GeofencesFeaturesLayers.LAYER_GEOFENCES_INTERNAL_FEATURES, "InternalFeatures", "internal_features");
592
+ const rowKeyGetter = useCallback((row) => row.id, []);
593
+ const [selectedRows, setSelectedRows] = useState(/* @__PURE__ */ new Set());
594
+ const [backendQueryParams, setBackendQueryParams] = useState({});
595
+ const {
596
+ columns
597
+ } = useColumns({
598
+ rowKeyGetter
599
+ });
600
+ const {
601
+ pagerState,
602
+ rows,
603
+ onPageChange,
604
+ onRowsPerPageChange,
605
+ Refresh,
606
+ setRows
607
+ } = usePaginate({
608
+ endPoint: "geofences",
609
+ fireOnChangeParms: false,
610
+ fireOnFirstLoad: false,
611
+ queryParams: backendQueryParams,
612
+ isRemote: false,
613
+ responseToCamelCase: true,
614
+ initialRows
615
+ });
616
+ const onSelectedRowsChange = (newRowsSelectSet) => {
617
+ setSelectedRows(newRowsSelectSet);
618
+ };
619
+ const fullRefresh = useCallback((_id) => {
620
+ Refresh();
621
+ }, []);
622
+ useEffect(() => {
623
+ const newCheckedGeofences = new Set(checkedGeofences);
624
+ const newCheckedCrossingFeatures = new Set(checkedCrossingFeatures);
625
+ const newCheckedInternalFeatures = new Set(checkedInternalFeatures);
626
+ let updatedCheckedGeofences = false;
627
+ let updatedCheckedCrossingFeatures = false;
628
+ let updatedCheckedInternalFeatures = false;
629
+ newCheckedGeofences.forEach((chkRow) => {
630
+ if (rows.findIndex((row) => row.id === chkRow) === -1) {
631
+ newCheckedGeofences.delete(chkRow);
632
+ }
633
+ });
634
+ newCheckedCrossingFeatures.forEach((chkTF) => {
635
+ if (rows.findIndex((row) => row.id === chkTF) === -1) {
636
+ newCheckedCrossingFeatures.delete(chkTF);
637
+ }
638
+ });
639
+ newCheckedInternalFeatures.forEach((chkIF) => {
640
+ if (rows.findIndex((row) => row.id === chkIF) === -1) {
641
+ newCheckedInternalFeatures.delete(chkIF);
642
+ }
643
+ });
644
+ rows.forEach((row) => {
645
+ let hasGeo = hashGeofences[row.id];
646
+ if (!hasGeo) {
647
+ hasGeo = {
648
+ ...row,
649
+ hasRenderizedGeofence: false,
650
+ loadedCrossingFeatures: null,
651
+ loadedInternalFeatures: null,
652
+ hasRenderizedCrossingFeatures: false,
653
+ hasRenderizedInternalFeatures: false,
654
+ createdAt: row.createdAt
655
+ };
656
+ addGeofence(row.id, hasGeo);
657
+ return;
658
+ }
659
+ if (row.updatedAt && row.updatedAt !== hasGeo.updatedAt) {
660
+ updatePartialGeofence(row.id, {
661
+ updatedAt: row.updatedAt,
662
+ geometry: null,
663
+ hasRenderizedGeofence: false,
664
+ hasRenderizedCrossingFeatures: false,
665
+ hasRenderizedInternalFeatures: false,
666
+ loadedCrossingFeatures: null,
667
+ loadedInternalFeatures: null
668
+ });
669
+ updatedCheckedGeofences = true;
670
+ updatedCheckedCrossingFeatures = true;
671
+ updatedCheckedInternalFeatures = true;
672
+ }
673
+ });
674
+ if (newCheckedGeofences.size !== checkedGeofences.size || updatedCheckedGeofences) {
675
+ setCheckedGeofences(newCheckedGeofences);
676
+ }
677
+ if (newCheckedCrossingFeatures.size !== checkedCrossingFeatures.size || updatedCheckedCrossingFeatures) {
678
+ setCheckedCrossingFeatures(newCheckedCrossingFeatures);
679
+ }
680
+ if (newCheckedInternalFeatures.size !== checkedInternalFeatures.size || updatedCheckedInternalFeatures) {
681
+ setCheckedInternalFeatures(newCheckedInternalFeatures);
682
+ }
683
+ onSelectedRowsChange(selectedRows);
684
+ updateRows(rows);
685
+ }, [rows]);
686
+ const {
687
+ rowActionsGetter
688
+ } = useRowActionsGetter({
689
+ fullRefresh
690
+ });
691
+ return {
692
+ rowKeyGetter,
693
+ columns,
694
+ refresh: Refresh,
695
+ setBackendQueryParams,
696
+ pagerState,
697
+ rows,
698
+ onPageChange,
699
+ onRowsPerPageChange,
700
+ rowActionsGetter,
701
+ selectedRows,
702
+ onSelectedRowsChange,
703
+ checkedRows: checkedGeofences,
704
+ onCheckedRowsChange: setCheckedGeofences,
705
+ setRows,
706
+ goToAddEdit
707
+ };
708
+ }
709
+ const mapToolsClasses = generateUtilityClasses(COMPONENT_CLASS_NAME, [
710
+ "root",
711
+ "tabToolsRoot",
712
+ "tabContentRoot",
713
+ "toolGeofences",
714
+ "toolGeofencesList",
715
+ "toolGeofencesAddEdit",
716
+ "toolGeofencesAddEditGeneral",
717
+ "toolGeofencesAddEditStyle",
718
+ "toolMeasureFormValue",
719
+ "toolMeasureFormValueDistance",
720
+ "toolMeasureFormValueSymbol",
721
+ "toolMeasure",
722
+ "toolMeausureLabel",
723
+ "toolMeausureLabelDistance",
724
+ "toolMeausureLabelSymbol",
725
+ "visible",
726
+ "hidden"
727
+ ]);
728
+ function GeofencesList() {
729
+ const {
730
+ refresh,
731
+ setBackendQueryParams,
732
+ columns,
733
+ rows,
734
+ rowActionsGetter,
735
+ selectedRows,
736
+ onSelectedRowsChange,
737
+ pagerState,
738
+ onPageChange,
739
+ onRowsPerPageChange,
740
+ checkedRows,
741
+ onCheckedRowsChange,
742
+ setRows,
743
+ rowKeyGetter,
744
+ goToAddEdit
745
+ } = useMaster();
746
+ return /* @__PURE__ */ jsxs(Stack, {
747
+ direction: "column",
748
+ gap: "4px",
749
+ className: mapToolsClasses.toolGeofencesList,
750
+ children: [/* @__PURE__ */ jsx(Button, {
751
+ onClick: () => goToAddEdit(),
752
+ children: "Agregar geocerca"
753
+ }), /* @__PURE__ */ jsx(Filter, {
754
+ refresh,
755
+ setBackendQueryParams
756
+ }), /* @__PURE__ */ jsx(DataGrid, {
757
+ id: "geofences",
758
+ columns,
759
+ rows,
760
+ onRowsChange: setRows,
761
+ checkedRows,
762
+ onCheckedRowsChange,
763
+ rowActionsGetter,
764
+ rowKeyGetter,
765
+ selectedRows,
766
+ onSelectedRowsChange,
767
+ withActions: true,
768
+ actionsProps: {
769
+ withPager: true,
770
+ withLocalFilters: true,
771
+ pagerOptions: {
772
+ records: rows.length,
773
+ totalRecords: pagerState.totalRecords,
774
+ rowsPerPageOptions: [1, 2, 3, 4, 5, 10, 25],
775
+ page: pagerState.page,
776
+ rowsPerPage: pagerState.rowsPerPage,
777
+ onPageChange,
778
+ onRowsPerPageChange
779
+ }
780
+ }
781
+ }, "list")]
782
+ });
783
+ }
784
+ function MyActions$1() {
785
+ const {
786
+ control
787
+ } = useFormContext();
788
+ const inEdition = useWatch({
789
+ control,
790
+ name: "inEdition"
791
+ });
792
+ const {
793
+ goToList
794
+ } = useGpsToolsStore((state) => state.geofenceActions);
795
+ return /* @__PURE__ */ jsxs(Actions, {
796
+ children: [/* @__PURE__ */ jsx(HelperError, {
797
+ name: "geometry"
798
+ }), /* @__PURE__ */ jsx(Button, {
799
+ onClick: () => {
800
+ goToList();
801
+ },
802
+ disabled: inEdition,
803
+ children: "Cancelar"
804
+ }), /* @__PURE__ */ jsx(ActionFormIntro, {
805
+ disabled: inEdition
806
+ })]
807
+ });
808
+ }
809
+ const STROKE_COLOR_DEFAULT = "#aaccaa";
810
+ const STROKE_OPACITY_DEFAULT = { value: 1, label: "100%" };
811
+ const STROKE_WHEIGTH_DEFAULT = { value: 1, label: "1 px" };
812
+ const STROKE_DASH_ARRAY_DEFAULT = { value: "", label: "-----" };
813
+ const FILL_COLOR_DEFAULT = "#aa3000";
814
+ const FILL_OPACITY_DEFAULT = { value: 0.2, label: "20%" };
815
+ const initialValues = {
816
+ name: "",
817
+ geofenceType: null,
818
+ alias: null,
819
+ customerId: null,
820
+ timeMinInSeconds: 5,
821
+ timeMinOutSeconds: 5,
822
+ inEdition: false,
823
+ geometry: null,
824
+ lat: null,
825
+ lng: null,
826
+ properties: {
827
+ radius: null,
828
+ strokeColor: STROKE_COLOR_DEFAULT,
829
+ strokeOpacity: STROKE_OPACITY_DEFAULT,
830
+ strokeWeight: STROKE_WHEIGTH_DEFAULT,
831
+ strokeDashArray: STROKE_DASH_ARRAY_DEFAULT,
832
+ fillColor: FILL_COLOR_DEFAULT,
833
+ fillOpacity: FILL_OPACITY_DEFAULT
834
+ }
835
+ };
836
+ const formatDataEnpoint = (response) => {
837
+ try {
838
+ const { data } = response;
839
+ const obRet = {
840
+ ...initialValues,
841
+ inEdition: false,
842
+ name: data.name,
843
+ geometry: data.geometry,
844
+ geofenceType: { id: data.type.id, name: data.type.name, url: "" },
845
+ properties: {
846
+ strokeColor: data.properties.strokeColor || STROKE_COLOR_DEFAULT,
847
+ strokeOpacity: data.properties.strokeOpacity || STROKE_OPACITY_DEFAULT,
848
+ strokeWeight: data.properties.strokeWeight || STROKE_WHEIGTH_DEFAULT,
849
+ strokeDashArray: data.properties.strokeDashArray || STROKE_DASH_ARRAY_DEFAULT,
850
+ fillColor: data.properties.fillColor || FILL_COLOR_DEFAULT,
851
+ fillOpacity: data.properties.fillOpacity || FILL_OPACITY_DEFAULT
852
+ }
853
+ };
854
+ if (obRet.geofenceType?.id === "gt_circle") {
855
+ if (data.properties.radius) {
856
+ obRet.properties.radius = data.properties.radius;
857
+ }
858
+ if (data.geometry && data.geometry.type === "Point") {
859
+ obRet.lng = data.geometry.coordinates[0];
860
+ obRet.lat = data.geometry.coordinates[1];
861
+ }
862
+ }
863
+ return obRet;
864
+ } catch (error) {
865
+ return { ...initialValues };
866
+ }
867
+ };
868
+ const getLayerFromGeometry = (geometry, geofenceTypeId, radius) => {
869
+ if (geometry) {
870
+ if (geofenceTypeId === "gt_circle" && geometry.type === "Point") {
871
+ return L.circle([geometry.coordinates[1], geometry.coordinates[0]], radius || 0);
872
+ } else if (geofenceTypeId === "gt_polygon" && geometry.type === "Polygon") {
873
+ const coordinates = geometry.coordinates.map(
874
+ (ring) => ring.map((position) => [position[1], position[0]])
875
+ );
876
+ return L.polygon(coordinates);
877
+ } else if (geofenceTypeId === "gt_rectangle" && geometry.type === "Polygon") {
878
+ const latLngs = geometry.coordinates[0].map((coord) => [coord[1], coord[0]]);
879
+ const lats = latLngs.map((coord) => coord);
880
+ const lngs = latLngs.map((coord) => coord);
881
+ const southWest = [Math.min(...lats), Math.min(...lngs)];
882
+ const northEast = [Math.max(...lats), Math.max(...lngs)];
883
+ return L.rectangle([southWest, northEast]);
884
+ }
885
+ }
886
+ return null;
887
+ };
888
+ function useDrawing() {
889
+ const { getLabel } = useModuleDictionary();
890
+ const readyToUpdate = useFormReadyForUpdate();
891
+ const map = useMap();
892
+ const { control, setValue } = useFormContext();
893
+ const fieldsWatch = useWatch({
894
+ control,
895
+ name: [
896
+ "geofenceType",
897
+ "inEdition",
898
+ "properties.strokeColor",
899
+ "properties.strokeOpacity",
900
+ "properties.strokeWeight",
901
+ "properties.strokeDashArray",
902
+ "properties.fillColor",
903
+ "properties.fillOpacity",
904
+ "geometry",
905
+ "properties.radius"
906
+ ]
907
+ });
908
+ const geofenceTypeId = fieldsWatch[0]?.id;
909
+ const inEdition = fieldsWatch[1];
910
+ const strokeColor = fieldsWatch[2];
911
+ const strokeOpacity = fieldsWatch[3].value;
912
+ const strokeWeight = fieldsWatch[4].value;
913
+ const strokeDashArray = fieldsWatch[5].value;
914
+ const fillColor = fieldsWatch[6];
915
+ const fillOpacity = fieldsWatch[7].value;
916
+ const geometry = fieldsWatch[8];
917
+ const radius = fieldsWatch[9];
918
+ const [drawing, setDrawing] = useState(false);
919
+ const currentLayer = useRef(null);
920
+ const [geometrTypeIdCached, setgeofenceTypeIdCached] = useState(geofenceTypeId);
921
+ useEffect(() => {
922
+ if (geometry) {
923
+ currentLayer.current = getLayerFromGeometry(geometry, geofenceTypeId, radius);
924
+ if (currentLayer.current) {
925
+ map.addLayer(currentLayer.current);
926
+ }
927
+ }
928
+ return () => {
929
+ if (currentLayer.current) {
930
+ currentLayer.current.remove();
931
+ }
932
+ };
933
+ }, [map]);
934
+ useEffect(() => {
935
+ if (currentLayer.current) {
936
+ currentLayer.current.setStyle({
937
+ color: strokeColor,
938
+ opacity: strokeOpacity,
939
+ weight: strokeWeight,
940
+ dashArray: strokeDashArray,
941
+ fillColor,
942
+ fillOpacity
943
+ });
944
+ }
945
+ }, [strokeColor, strokeOpacity, strokeWeight, strokeDashArray, fillColor, fillOpacity]);
946
+ useEffect(() => {
947
+ map.pm.setLang("en", {
948
+ tooltips: {
949
+ placeMarker: void 0,
950
+ firstVertex: getLabel(DICCTIONARY.LABEL_FIRST_VERTEX),
951
+ continueLine: getLabel(DICCTIONARY.LABEL_CONTINUE_LINE),
952
+ finishLine: getLabel(DICCTIONARY.LABEL_FINISH_LINE),
953
+ finishPoly: getLabel(DICCTIONARY.LABEL_FINISH_POLY),
954
+ finishRect: getLabel(DICCTIONARY.LABEL_FINISH_RECT),
955
+ startCircle: getLabel(DICCTIONARY.LABEL_START_CIRCLE),
956
+ finishCircle: getLabel(DICCTIONARY.LABEL_FINISH_CIRCLE),
957
+ placeCircleMarker: getLabel(DICCTIONARY.LABEL_PLACE_CIRCLE_MARKER)
958
+ }
959
+ });
960
+ }, [map, getLabel]);
961
+ useEffect(() => {
962
+ if (map) {
963
+ let shape = "Circle";
964
+ if (geometrTypeIdCached === "gt_polygon") {
965
+ shape = "Polygon";
966
+ } else if (geometrTypeIdCached === "gt_rectangle") {
967
+ shape = "Rectangle";
968
+ }
969
+ if (drawing) {
970
+ if (!currentLayer.current) {
971
+ setValue("inEdition", true);
972
+ if (shape === "Circle") {
973
+ map.on("pm:drawstart", ({ workingLayer }) => {
974
+ workingLayer.on("pm:centerplaced", (e) => {
975
+ var layer = e.workingLayer;
976
+ layer.setStyle(
977
+ {
978
+ color: strokeColor,
979
+ opacity: strokeOpacity,
980
+ weight: strokeWeight,
981
+ dashArray: strokeDashArray,
982
+ fillColor,
983
+ fillOpacity
984
+ }
985
+ );
986
+ setValue("lat", layer.getLatLng().lat);
987
+ setValue("lng", layer.getLatLng().lng);
988
+ layer.on("pm:change", (_e) => {
989
+ setValue("properties.radius", layer.getRadius());
990
+ });
991
+ });
992
+ });
993
+ setValue("properties.subType", shape);
994
+ } else if (shape === "Polygon") {
995
+ map.on("pm:drawstart", ({ workingLayer }) => {
996
+ workingLayer.on("pm:vertexadded", (e) => {
997
+ var layer = e.workingLayer;
998
+ layer.setStyle(
999
+ {
1000
+ color: strokeColor,
1001
+ opacity: strokeOpacity,
1002
+ weight: strokeWeight,
1003
+ dashArray: strokeDashArray,
1004
+ fillColor,
1005
+ fillOpacity
1006
+ }
1007
+ );
1008
+ });
1009
+ });
1010
+ }
1011
+ map.pm.enableDraw(shape);
1012
+ map.pm.setPathOptions(
1013
+ {
1014
+ color: strokeColor,
1015
+ opacity: strokeOpacity,
1016
+ weight: strokeWeight,
1017
+ dashArray: strokeDashArray,
1018
+ fillColor,
1019
+ fillOpacity
1020
+ }
1021
+ );
1022
+ map.on("pm:create", (e) => {
1023
+ currentLayer.current = e.layer;
1024
+ setValue("geometry", currentLayer.current.toGeoJSON()?.geometry, {
1025
+ shouldTouch: false,
1026
+ shouldValidate: true
1027
+ });
1028
+ setValue("inEdition", false);
1029
+ setDrawing(false);
1030
+ });
1031
+ } else {
1032
+ currentLayer.current.pm.enable();
1033
+ setValue("inEdition", true);
1034
+ currentLayer.current.on("pm:disable", (e) => {
1035
+ currentLayer.current = e.layer;
1036
+ console.log("Geometr\xEDa editada **", currentLayer.current.toGeoJSON());
1037
+ setValue("geometry", currentLayer.current.toGeoJSON()?.geometry, {
1038
+ shouldTouch: false,
1039
+ shouldValidate: true
1040
+ });
1041
+ setValue("inEdition", false);
1042
+ setDrawing(false);
1043
+ });
1044
+ if (shape === "Circle") {
1045
+ currentLayer.current.on("pm:change", (e) => {
1046
+ currentLayer.current = e.layer;
1047
+ setValue("properties.radius", currentLayer.current.getRadius());
1048
+ });
1049
+ }
1050
+ }
1051
+ } else {
1052
+ map.pm.disableDraw("Polygon");
1053
+ map.off("pm:create");
1054
+ map.off("pm:edit");
1055
+ map.off("pm:drawstart");
1056
+ }
1057
+ }
1058
+ }, [map, drawing]);
1059
+ const handleDraw = useCallback(() => {
1060
+ setDrawing(true);
1061
+ }, []);
1062
+ const handleFinish = useCallback(() => {
1063
+ if (currentLayer.current) {
1064
+ currentLayer.current.pm.disable();
1065
+ currentLayer.current.setStyle({ color: "#ff0000", fillColor: "#ff0000" });
1066
+ }
1067
+ }, []);
1068
+ useEffect(() => {
1069
+ if (!readyToUpdate)
1070
+ return;
1071
+ if (geofenceTypeId) {
1072
+ if (geofenceTypeId !== geometrTypeIdCached) {
1073
+ setgeofenceTypeIdCached(geofenceTypeId);
1074
+ if (geometrTypeIdCached !== "gt_circle") {
1075
+ setValue("properties.radius", null);
1076
+ setValue("lat", null);
1077
+ setValue("lng", null);
1078
+ }
1079
+ setValue("geometry", null);
1080
+ if (currentLayer.current) {
1081
+ currentLayer.current.remove();
1082
+ currentLayer.current = null;
1083
+ }
1084
+ }
1085
+ }
1086
+ }, [geofenceTypeId]);
1087
+ return { inEdition, handleDraw, handleFinish, geometrTypeIdCached };
1088
+ }
1089
+ function useSumbitErrorsFocus() {
1090
+ const {
1091
+ setFocus,
1092
+ formState: { isSubmitted, errors }
1093
+ } = useFormContext();
1094
+ const { handleChange } = useTab();
1095
+ useEffect(() => {
1096
+ if (isSubmitted) {
1097
+ const firstError = Object.keys(errors).reduce((field, a) => {
1098
+ const fieldKey = field;
1099
+ return !!errors[fieldKey] ? fieldKey : a;
1100
+ }, null);
1101
+ if (firstError) {
1102
+ let found = ["name", "geometry", "geofenceType", "timeMinInSeconds", "timeMinOutSeconds"].some((field) => field.includes(firstError));
1103
+ if (found) {
1104
+ handleChange(null, "general");
1105
+ }
1106
+ if (firstError) {
1107
+ setFocus(firstError);
1108
+ }
1109
+ }
1110
+ }
1111
+ }, [isSubmitted, errors]);
1112
+ }
1113
+ function GeneralData() {
1114
+ const {
1115
+ getLabel
1116
+ } = useModuleDictionary();
1117
+ const {
1118
+ host_static_assets,
1119
+ environment_assets
1120
+ } = useEnvironment();
1121
+ const {
1122
+ inEdition,
1123
+ handleDraw,
1124
+ handleFinish,
1125
+ geometrTypeIdCached
1126
+ } = useDrawing();
1127
+ useSumbitErrorsFocus();
1128
+ const urlIcon = `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${icons.GENERAL}`;
1129
+ const geofencesTypes = useMemo(() => {
1130
+ return [{
1131
+ id: "gt_circle",
1132
+ name: getLabel(DICCTIONARY.LABEL_GEOMETRY_CIRCLE),
1133
+ url: `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${icons.GEOMETRY_CIRCLE}`
1134
+ }, {
1135
+ id: "gt_polygon",
1136
+ name: getLabel(DICCTIONARY.LABEL_GEOMETRY_POLYGON),
1137
+ url: `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${icons.GEOMETRY_POLYGON}`
1138
+ }, {
1139
+ id: "gt_rectangle",
1140
+ name: getLabel(DICCTIONARY.LABEL_GEOMETRY_RECTANGLE),
1141
+ url: `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${icons.GEOMETRY_RECTANGLE}`
1142
+ }];
1143
+ }, [getLabel]);
1144
+ return /* @__PURE__ */ jsxs(PaperForm, {
1145
+ urlIcon,
1146
+ title: getLabel(DICCTIONARY.PAPER_GENERAL),
1147
+ children: [/* @__PURE__ */ jsx(RHFTextField, {
1148
+ name: "name",
1149
+ disabled: false,
1150
+ type: "text",
1151
+ label: getLabel(`${DICCTIONARY.LABEL_NAME}`)
1152
+ }), /* @__PURE__ */ jsxs(Stack, {
1153
+ direction: "column",
1154
+ spacing: 1,
1155
+ alignItems: "center",
1156
+ children: [/* @__PURE__ */ jsxs(Stack, {
1157
+ direction: "row",
1158
+ spacing: 1,
1159
+ alignItems: "center",
1160
+ children: [/* @__PURE__ */ jsx(RHFAutocomplete, {
1161
+ name: "geofenceType",
1162
+ autoComplete: "off",
1163
+ options: geofencesTypes,
1164
+ getOptionLabel: (option) => option.name,
1165
+ isOptionEqualToValue: (option, value) => option.id === value.id,
1166
+ getOptionUrlImage: (option) => option.url,
1167
+ imageHeight: "12px",
1168
+ imageWidth: "12px",
1169
+ label: getLabel(DICCTIONARY.LABEL_GEOMETRY_TYPE)
1170
+ }), /* @__PURE__ */ jsx(Button, {
1171
+ onClick: handleDraw,
1172
+ disabled: inEdition || !geometrTypeIdCached,
1173
+ children: getLabel(DICCTIONARY.LABEL_DRAW)
1174
+ }), /* @__PURE__ */ jsx(Button, {
1175
+ onClick: handleFinish,
1176
+ disabled: !inEdition,
1177
+ children: getLabel(DICCTIONARY.LABEL_FINISH)
1178
+ })]
1179
+ }), geometrTypeIdCached && geometrTypeIdCached === "gt_circle" && /* @__PURE__ */ jsxs(Stack, {
1180
+ direction: "row",
1181
+ spacing: 1,
1182
+ alignItems: "center",
1183
+ children: [/* @__PURE__ */ jsx(RHFTextField, {
1184
+ name: "properties.radius",
1185
+ label: getLabel(DICCTIONARY.LABEL_RADIUS),
1186
+ autoComplete: "on",
1187
+ skeletonWidth: "70%",
1188
+ skeletonHeight: "18px",
1189
+ disabled: true,
1190
+ size: "medium"
1191
+ }), /* @__PURE__ */ jsx(RHFTextField, {
1192
+ name: "lat",
1193
+ label: getLabel(DICCTIONARY.LABEL_LAT),
1194
+ autoComplete: "on",
1195
+ skeletonWidth: "70%",
1196
+ skeletonHeight: "18px",
1197
+ disabled: true,
1198
+ size: "medium"
1199
+ }), /* @__PURE__ */ jsx(RHFTextField, {
1200
+ name: "lng",
1201
+ label: getLabel(DICCTIONARY.LABEL_LON),
1202
+ autoComplete: "on",
1203
+ skeletonWidth: "70%",
1204
+ skeletonHeight: "18px",
1205
+ disabled: true,
1206
+ size: "medium"
1207
+ })]
1208
+ })]
1209
+ })]
1210
+ });
1211
+ }
1212
+ function ConfigData() {
1213
+ const {
1214
+ getLabel
1215
+ } = useModuleDictionary();
1216
+ const {
1217
+ host_static_assets,
1218
+ environment_assets
1219
+ } = useEnvironment();
1220
+ const urlIcon = `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${icons.CONFIG}`;
1221
+ return /* @__PURE__ */ jsxs(PaperForm, {
1222
+ urlIcon,
1223
+ title: getLabel(DICCTIONARY.PAPER_CONFIG),
1224
+ children: [/* @__PURE__ */ jsx(RHFTextField, {
1225
+ name: "alias",
1226
+ disabled: false,
1227
+ type: "text",
1228
+ label: getLabel(`${DICCTIONARY.LABEL_ALIAS}`)
1229
+ }), /* @__PURE__ */ jsx(RHFTextField, {
1230
+ name: "customerId",
1231
+ disabled: false,
1232
+ type: "text",
1233
+ label: getLabel(`${DICCTIONARY.LABEL_CUSTOMER_ID}`)
1234
+ }), /* @__PURE__ */ jsx(RHFTextField, {
1235
+ name: "timeMinInSeconds",
1236
+ disabled: false,
1237
+ type: "number",
1238
+ label: getLabel(`${DICCTIONARY.LABEL_TIME_MIN_IN_SECONDS}`)
1239
+ }), /* @__PURE__ */ jsx(RHFTextField, {
1240
+ name: "timeMinOutSeconds",
1241
+ disabled: false,
1242
+ type: "number",
1243
+ label: getLabel(`${DICCTIONARY.LABEL_TIME_MIN_OUT_SECONDS}`)
1244
+ })]
1245
+ });
1246
+ }
1247
+ function FillData() {
1248
+ const {
1249
+ getLabel
1250
+ } = useModuleDictionary();
1251
+ const {
1252
+ host_static_assets,
1253
+ environment_assets
1254
+ } = useEnvironment();
1255
+ const urlIcon = `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${icons.FILL}`;
1256
+ return /* @__PURE__ */ jsxs(PaperForm, {
1257
+ urlIcon,
1258
+ title: getLabel(DICCTIONARY.PAPER_STROKE),
1259
+ children: [/* @__PURE__ */ jsx(PropertyValue, {
1260
+ property: getLabel(`${DICCTIONARY.LABEL_COLOR}`),
1261
+ isForm: true,
1262
+ propertyWidth: 150,
1263
+ value: /* @__PURE__ */ jsx(RHFColorPicker, {
1264
+ name: "properties.fillColor"
1265
+ })
1266
+ }, "properties.fillColor"), /* @__PURE__ */ jsx(PropertyValue, {
1267
+ property: getLabel(`${DICCTIONARY.LABEL_OPACITY}`),
1268
+ isForm: true,
1269
+ propertyWidth: 150,
1270
+ value: /* @__PURE__ */ jsx(RHFAutocomplete, {
1271
+ name: "properties.fillOpacity",
1272
+ autoComplete: "off",
1273
+ options: STYLE_OPACITIES,
1274
+ getOptionLabel: (option) => option.label,
1275
+ isOptionEqualToValue: (option, value) => option.value === value.value,
1276
+ label: "ssss"
1277
+ })
1278
+ }, "properties.fillOpacity")]
1279
+ });
1280
+ }
1281
+ function StrokeData() {
1282
+ const {
1283
+ getLabel
1284
+ } = useModuleDictionary();
1285
+ const {
1286
+ host_static_assets,
1287
+ environment_assets
1288
+ } = useEnvironment();
1289
+ const urlIcon = `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${icons.STROKE}`;
1290
+ return /* @__PURE__ */ jsxs(PaperForm, {
1291
+ urlIcon,
1292
+ title: getLabel(DICCTIONARY.PAPER_STROKE),
1293
+ children: [/* @__PURE__ */ jsx(PropertyValue, {
1294
+ property: getLabel(`${DICCTIONARY.LABEL_COLOR}`),
1295
+ isForm: true,
1296
+ propertyWidth: 150,
1297
+ value: /* @__PURE__ */ jsx(RHFColorPicker, {
1298
+ name: "properties.strokeColor"
1299
+ })
1300
+ }, "properties.strokeColor"), /* @__PURE__ */ jsx(PropertyValue, {
1301
+ property: getLabel(`${DICCTIONARY.LABEL_OPACITY}`),
1302
+ isForm: true,
1303
+ propertyWidth: 150,
1304
+ value: /* @__PURE__ */ jsx(RHFAutocomplete, {
1305
+ name: "properties.strokeOpacity",
1306
+ autoComplete: "off",
1307
+ options: STYLE_OPACITIES,
1308
+ getOptionLabel: (option) => option.label,
1309
+ isOptionEqualToValue: (option, value) => option.value === value.value,
1310
+ label: "ssss"
1311
+ })
1312
+ }, "properties.strokeOpacity"), /* @__PURE__ */ jsx(PropertyValue, {
1313
+ property: getLabel(`${DICCTIONARY.LABEL_WEIGHT}`),
1314
+ isForm: true,
1315
+ propertyWidth: 150,
1316
+ value: /* @__PURE__ */ jsx(RHFAutocomplete, {
1317
+ name: "properties.strokeWeight",
1318
+ autoComplete: "off",
1319
+ options: STYLE_WHEIGHTS,
1320
+ getOptionLabel: (option) => option.label,
1321
+ isOptionEqualToValue: (option, value) => option.value === value.value,
1322
+ label: "ssss"
1323
+ })
1324
+ }, "properties.strokeWeight"), /* @__PURE__ */ jsx(PropertyValue, {
1325
+ property: getLabel(`${DICCTIONARY.LABEL_DASH_ARRAY}`),
1326
+ isForm: true,
1327
+ propertyWidth: 150,
1328
+ value: /* @__PURE__ */ jsx(RHFAutocomplete, {
1329
+ name: "properties.strokeDashArray",
1330
+ autoComplete: "off",
1331
+ options: STYLE_PATTERNS,
1332
+ getOptionLabel: (option) => option.label,
1333
+ isOptionEqualToValue: (option, value) => option.value === value.value,
1334
+ label: "ssss"
1335
+ })
1336
+ }, "properties.strokeDashArray")]
1337
+ });
1338
+ }
1339
+ function StyleData() {
1340
+ return /* @__PURE__ */ jsxs(Fragment, {
1341
+ children: [/* @__PURE__ */ jsx(StrokeData, {}), /* @__PURE__ */ jsx(FillData, {})]
1342
+ });
1343
+ }
1344
+ function MyTabs() {
1345
+ const {
1346
+ getLabel
1347
+ } = useModuleDictionary();
1348
+ const {
1349
+ currentTab,
1350
+ handleChange
1351
+ } = useTab();
1352
+ const geofenceAddEditTabs = useMemo(() => {
1353
+ return [{
1354
+ value: "general",
1355
+ icon: void 0,
1356
+ components: /* @__PURE__ */ jsxs(Fragment, {
1357
+ children: [/* @__PURE__ */ jsx(GeneralData, {}), /* @__PURE__ */ jsx(ConfigData, {})]
1358
+ }),
1359
+ toolTip: getLabel(DICCTIONARY.TAB_GENERAL_CONFIG_TOOLTIP),
1360
+ className: mapToolsClasses.toolGeofencesAddEditGeneral
1361
+ }, {
1362
+ value: "style",
1363
+ icon: void 0,
1364
+ components: /* @__PURE__ */ jsx(StyleData, {}),
1365
+ toolTip: getLabel(DICCTIONARY.TAB_STYLE_CONFIG_TOOLTIP),
1366
+ className: mapToolsClasses.toolGeofencesAddEditStyle
1367
+ }];
1368
+ }, [getLabel]);
1369
+ console.log("MyTabs", currentTab);
1370
+ return /* @__PURE__ */ jsxs(Stack, {
1371
+ direction: "column",
1372
+ children: [/* @__PURE__ */ jsx(Tabs, {
1373
+ value: currentTab,
1374
+ scrollButtons: "auto",
1375
+ variant: "scrollable",
1376
+ allowScrollButtonsMobile: true,
1377
+ onChange: (_e, newValue) => handleChange(_e, newValue),
1378
+ children: geofenceAddEditTabs.map((tab) => /* @__PURE__ */ jsx(Tab, {
1379
+ value: tab.value,
1380
+ icon: tab.icon,
1381
+ label: /* @__PURE__ */ jsx(Tooltip, {
1382
+ title: tab.toolTip,
1383
+ children: /* @__PURE__ */ jsx("span", {
1384
+ children: tab.toolTip
1385
+ })
1386
+ }),
1387
+ SKTWidth: "100px",
1388
+ SKTHeight: "14px"
1389
+ }, tab.value))
1390
+ }), geofenceAddEditTabs.map((tab) => {
1391
+ const isMatched = tab.value === currentTab;
1392
+ return /* @__PURE__ */ jsx(TabContent, {
1393
+ className: clsx(mapToolsClasses.tabContentRoot, tab.className, isMatched ? mapToolsClasses.visible : mapToolsClasses.hidden),
1394
+ children: tab.components
1395
+ }, tab.value);
1396
+ })]
1397
+ });
1398
+ }
1399
+ function GeneralDataValidation(getLabel) {
1400
+ return {
1401
+ name: Yup.string().required(getLabel(DICCTIONARY.VALIDATION_FIELD_REQUIRED)),
1402
+ geometry: Yup.object().nullable().required(getLabel(DICCTIONARY.VALIDATION_GEOMETRY_REQUIRED)),
1403
+ geofenceType: Yup.object().nullable().required(getLabel(DICCTIONARY.VALIDATION_FIELD_REQUIRED))
1404
+ };
1405
+ }
1406
+ function ConfigDataValidation(getLabel) {
1407
+ return {
1408
+ timeMinInSeconds: Yup.number().required(getLabel(DICCTIONARY.VALIDATION_FIELD_REQUIRED)).typeError(getLabel(DICCTIONARY.VALIDATION_FIELD_TYPE_NUMBER_ERROR)),
1409
+ timeMinOutSeconds: Yup.number().required(getLabel(DICCTIONARY.VALIDATION_FIELD_REQUIRED)).typeError(getLabel(DICCTIONARY.VALIDATION_FIELD_TYPE_NUMBER_ERROR))
1410
+ };
1411
+ }
1412
+ function useValidation$1() {
1413
+ const { getLabel } = useModuleDictionary();
1414
+ const validationSchema = useMemo(
1415
+ () => Yup.object().shape({
1416
+ ...GeneralDataValidation(getLabel),
1417
+ ...ConfigDataValidation(getLabel)
1418
+ }),
1419
+ [getLabel]
1420
+ );
1421
+ return { validationSchema };
1422
+ }
1423
+ const getSummitData = (values, geofenceId) => {
1424
+ const newEditObj = {
1425
+ name: values.name,
1426
+ typeId: values.geofenceType.id,
1427
+ geometry: values.geometry,
1428
+ properties: {
1429
+ strokeColor: values.properties.fillColor,
1430
+ strokeOpacity: values.properties.strokeOpacity.value,
1431
+ strokeWeight: values.properties.strokeWeight.value,
1432
+ strokeDashArray: values.properties.strokeDashArray.value,
1433
+ fillColor: values.properties.fillColor,
1434
+ fillOpacity: values.properties.fillOpacity.value
1435
+ },
1436
+ timeMinInSeconds: values.timeMinInSeconds,
1437
+ timeMinOutSeconds: values.timeMinOutSeconds,
1438
+ alias: values.alias,
1439
+ customerId: values.customerId,
1440
+ ...geofenceId ? { geofenceId } : {}
1441
+ };
1442
+ if (values.geofenceType.id === "gt_circle") {
1443
+ newEditObj.properties.radius = values.properties.radius;
1444
+ }
1445
+ return newEditObj;
1446
+ };
1447
+ function useSubmit(props) {
1448
+ const { objectId } = props;
1449
+ const { toast } = useHostTools();
1450
+ const { goToList } = useGpsToolsStore((state) => state.geofenceActions);
1451
+ const { networkOperation } = useNetwork();
1452
+ const onSubmit = async (data) => {
1453
+ await networkOperation({
1454
+ method: objectId ? "PUT" : "POST",
1455
+ endPoint: `${ENDPOINT_GEOFENCE_NEW_EDIT}${objectId ? `/${objectId}` : ""}`,
1456
+ data: getSummitData(data, objectId),
1457
+ toastError: true,
1458
+ toastSuccess: false,
1459
+ bodyToSnakeCase: true,
1460
+ isRemote: false
1461
+ }).then((response) => {
1462
+ toast(
1463
+ response.message,
1464
+ { type: "success" }
1465
+ );
1466
+ goToList();
1467
+ }).catch(() => {
1468
+ });
1469
+ };
1470
+ return { onSubmit };
1471
+ }
1472
+ function GeofenceAddEdit() {
1473
+ const [geofenceId, finalInitalValues, omitCallEnpoint] = useGpsToolsStore((state) => {
1474
+ if (state.geofenceState.geofenceId === void 0) {
1475
+ return [void 0, initialValues, false];
1476
+ }
1477
+ const geofence = state.geofenceState.hashGeofences[state.geofenceState.geofenceId];
1478
+ if (geofence?.geometry) {
1479
+ const emulateResponse = {
1480
+ data: {
1481
+ type: geofence.type,
1482
+ name: geofence.name,
1483
+ id: geofence.id,
1484
+ active: false,
1485
+ geometry: geofence.geometry,
1486
+ properties: geofence.properties,
1487
+ countCrossingFeatures: geofence.countCrossingFeatures,
1488
+ countInternalFeatures: geofence.countInternalFeatures,
1489
+ createdAt: geofence.createdAt,
1490
+ updatedAt: geofence.updatedAt,
1491
+ timeMinInSeconds: geofence.timeMinInSeconds,
1492
+ timeMinOutSeconds: geofence.timeMinOutSeconds,
1493
+ alias: geofence.alias,
1494
+ customerId: geofence.customerId
1495
+ }
1496
+ };
1497
+ return [state.geofenceState.geofenceId, formatDataEnpoint(emulateResponse), true];
1498
+ } else {
1499
+ return [state.geofenceState.geofenceId, initialValues, false];
1500
+ }
1501
+ });
1502
+ const {
1503
+ formValues,
1504
+ statusLoad
1505
+ } = useFormAddEdit({
1506
+ objectId: geofenceId,
1507
+ formatDataEnpoint,
1508
+ initialValues: finalInitalValues,
1509
+ endPoint: ENDPOINT_GEOFENCE_GET,
1510
+ isRemote: false,
1511
+ omitCallEnpoint
1512
+ });
1513
+ const {
1514
+ validationSchema
1515
+ } = useValidation$1();
1516
+ const {
1517
+ onSubmit
1518
+ } = useSubmit({
1519
+ objectId: geofenceId
1520
+ });
1521
+ return /* @__PURE__ */ jsxs(RHFormProvider, {
1522
+ statusLoad,
1523
+ onSubmit,
1524
+ values: formValues,
1525
+ validationSchema,
1526
+ className: mapToolsClasses.toolGeofencesAddEditGeneral,
1527
+ children: [/* @__PURE__ */ jsx(Stack, {
1528
+ direction: "column",
1529
+ children: /* @__PURE__ */ jsx(TabProvider, {
1530
+ initialValue: "general",
1531
+ children: /* @__PURE__ */ jsx(MyTabs, {})
1532
+ })
1533
+ }), /* @__PURE__ */ jsx(MyActions$1, {})]
1534
+ });
1535
+ }
1536
+ function GeofencesTool() {
1537
+ const currentGeofenceTool = useGpsToolsStore((state) => state.geofenceState.currentGeofenceTool, shallow);
1538
+ return /* @__PURE__ */ jsxs(Stack, {
1539
+ direction: "column",
1540
+ gap: "4px",
1541
+ className: mapToolsClasses.toolGeofences,
1542
+ children: [currentGeofenceTool === "list" && /* @__PURE__ */ jsx(GeofencesList, {}), currentGeofenceTool === "add_edit" && /* @__PURE__ */ jsx(GeofenceAddEdit, {})]
1543
+ });
1544
+ }
1545
+ function MyActions() {
1546
+ const {
1547
+ control,
1548
+ setValue
1549
+ } = useFormContext();
1550
+ const {
1551
+ getLabel
1552
+ } = useModuleDictionary();
1553
+ const fieldsWatch = useWatch({
1554
+ control,
1555
+ name: ["statusEdition", "reInits"]
1556
+ });
1557
+ const statusEdition = fieldsWatch[0];
1558
+ const reInits = fieldsWatch[1];
1559
+ const initDraw = () => {
1560
+ if (statusEdition === "initial") {
1561
+ setValue("statusEdition", "draw");
1562
+ } else if (statusEdition === "draw") {
1563
+ setValue("reInits", reInits + 1);
1564
+ }
1565
+ };
1566
+ return /* @__PURE__ */ jsx(Actions, {
1567
+ children: /* @__PURE__ */ jsx(Button, {
1568
+ onClick: initDraw,
1569
+ children: statusEdition === "initial" ? getLabel(DICCTIONARY.LABEL_MEASURE_START) : getLabel(DICCTIONARY.LABEL_MEASURE_RESTART)
1570
+ })
1571
+ });
1572
+ }
1573
+ function MeasureDataValidation(_getLabel) {
1574
+ return {};
1575
+ }
1576
+ function useValidation() {
1577
+ const { getLabel } = useModuleDictionary();
1578
+ const validationSchema = useMemo(
1579
+ () => Yup.object().shape({
1580
+ ...MeasureDataValidation()
1581
+ }),
1582
+ [getLabel]
1583
+ );
1584
+ return { validationSchema };
1585
+ }
1586
+ const INITIAL_FORM_VALUES = {
1587
+ statusLoad: "ready",
1588
+ reInits: 0,
1589
+ value: "0",
1590
+ measureTypeId: "distance",
1591
+ magnitudFactor: { id: "m_kilometers", name: "Kilometers", symbol: "k", factor_x0: 0, factor_x1: 1, factor_x2: 0 },
1592
+ unitArea: null,
1593
+ statusEdition: "initial"
1594
+ };
1595
+ const STYLE_MEASURE_OPTIONS = {
1596
+ strokeLineColor: "#1E96DC",
1597
+ strokeLineWeight: 5,
1598
+ markerHeight: 37,
1599
+ markerWidth: 26,
1600
+ labelMarkerHeight: 0,
1601
+ labelMarkerWidth: 0,
1602
+ labelMarkerAnchorY: 0,
1603
+ labelMarkerAnchorX: 0
1604
+ };
1605
+ function useMeasure() {
1606
+ const { getLabel } = useModuleDictionary();
1607
+ const readyToUpdate = useFormReadyForUpdate();
1608
+ const map = useMap();
1609
+ const { control, setValue } = useFormContext();
1610
+ const fieldsWatch = useWatch({
1611
+ control,
1612
+ name: [
1613
+ "statusEdition",
1614
+ "value",
1615
+ "magnitudFactor",
1616
+ "reInits"
1617
+ ]
1618
+ });
1619
+ const statusEdition = fieldsWatch[0];
1620
+ const value = fieldsWatch[1];
1621
+ const magnitudFactor = fieldsWatch[2];
1622
+ const reInits = fieldsWatch[3];
1623
+ const [magnitudFactorCached, setMagnitudFactorCached] = useState(magnitudFactor);
1624
+ const currentMeasure = useRef({ measurePoints: [], addMarker: false, magnitudFactor, dragging: false });
1625
+ const clearMeasure = useCallback(() => {
1626
+ currentMeasure.current.measurePoints.forEach((measurePoint) => {
1627
+ measurePoint.marker.remove();
1628
+ measurePoint.labelMarker.remove();
1629
+ });
1630
+ currentMeasure.current.measurePoints = [];
1631
+ setValue("value", measureDistante());
1632
+ }, []);
1633
+ const getFormatFactorDistance = useCallback((distance, withSymbol = false) => {
1634
+ if (distance === void 0) {
1635
+ return void 0;
1636
+ }
1637
+ const cMagnitudeFactor = currentMeasure.current.magnitudFactor;
1638
+ return (cMagnitudeFactor.factor_x0 + distance * cMagnitudeFactor.factor_x1 + (distance ^ 2 * cMagnitudeFactor.factor_x2)).toFixed(2) + (withSymbol ? ` ${cMagnitudeFactor.symbol}` : "");
1639
+ }, []);
1640
+ const measureDistante = useCallback(() => {
1641
+ var totalDistance = 0;
1642
+ const measurePoints = currentMeasure.current.measurePoints;
1643
+ if (currentMeasure.current.layerLine) {
1644
+ if (measurePoints.length < 2) {
1645
+ currentMeasure.current.layerLine.remove();
1646
+ currentMeasure.current.layerLine = void 0;
1647
+ } else {
1648
+ currentMeasure.current.layerLine.setLatLngs(measurePoints.map((measurePoint) => measurePoint.marker.getLatLng()));
1649
+ }
1650
+ } else {
1651
+ if (measurePoints.length > 1) {
1652
+ currentMeasure.current.layerLine = L.polyline(
1653
+ measurePoints.map((measurePoint) => measurePoint.marker.getLatLng()),
1654
+ {
1655
+ color: STYLE_MEASURE_OPTIONS.strokeLineColor,
1656
+ weight: STYLE_MEASURE_OPTIONS.strokeLineWeight,
1657
+ interactive: false
1658
+ }
1659
+ ).addTo(map);
1660
+ }
1661
+ }
1662
+ for (let i = 0; i < measurePoints.length - 1; i++) {
1663
+ totalDistance += measurePoints[i].marker.getLatLng().distanceTo(measurePoints[i + 1].marker.getLatLng());
1664
+ }
1665
+ if (measurePoints.length > 0 && measurePoints[0].formatDistanceFromPrevious !== void 0) {
1666
+ measurePoints[0].formatDistanceFromPrevious = void 0;
1667
+ }
1668
+ for (let i = 1; i < measurePoints.length; i++) {
1669
+ const formatDistanceFromPrevious = getFormatFactorDistance(measurePoints[i - 1].marker.getLatLng().distanceTo(measurePoints[i].marker.getLatLng()), true);
1670
+ if (measurePoints[i].formatDistanceFromPrevious !== formatDistanceFromPrevious) {
1671
+ measurePoints[i].formatDistanceFromPrevious = formatDistanceFromPrevious;
1672
+ measurePoints[i].labelMarker.setIcon(getLabelMarkerPointIcon(formatDistanceFromPrevious));
1673
+ addClickListenerForRemove(measurePoints[i].labelMarker);
1674
+ }
1675
+ }
1676
+ return getFormatFactorDistance(totalDistance);
1677
+ }, [map]);
1678
+ const getMarkerPointIcon = useCallback((position) => {
1679
+ return L.divIcon({
1680
+ className: mapClasses.measureMarkerRoot,
1681
+ html: `<div class="${mapClasses.measureMarkerContainer}">
1682
+ <div class="${mapClasses.measureMarkerContainerRhomb}">
1683
+ </div>
1684
+ <div class="${mapClasses.measureMarkerContainerSlot}">
1685
+ <div class="${mapClasses.measureMarkerContainerSlotNumber}">
1686
+ ${position}
1687
+ </div>
1688
+ </div>
1689
+ </div>
1690
+ `,
1691
+ iconSize: [STYLE_MEASURE_OPTIONS.markerWidth, STYLE_MEASURE_OPTIONS.markerHeight],
1692
+ iconAnchor: [STYLE_MEASURE_OPTIONS.markerWidth / 2, STYLE_MEASURE_OPTIONS.markerHeight]
1693
+ });
1694
+ }, []);
1695
+ const getLabelMarkerPointIcon = useCallback((distance) => {
1696
+ return L.divIcon({
1697
+ className: mapClasses.measureLabelMarkerRoot,
1698
+ html: `<div class="${mapClasses.measureLabelMarkerContainer}">
1699
+ ${distance ? `<span class="${mapClasses.measureLabelMarkerDistance}">${distance}</span>` : ""}
1700
+ <div class="${mapClasses.measureLabelMarkerRemove}">${getLabel(DICCTIONARY.LABEL_MEASURE_REMOVE_POINT)}</div>
1701
+ </div>`,
1702
+ iconSize: [STYLE_MEASURE_OPTIONS.labelMarkerWidth, STYLE_MEASURE_OPTIONS.labelMarkerHeight],
1703
+ iconAnchor: [STYLE_MEASURE_OPTIONS.labelMarkerAnchorX, STYLE_MEASURE_OPTIONS.labelMarkerAnchorY]
1704
+ });
1705
+ }, [getLabel]);
1706
+ const onClickRemovePoint = useCallback((labelMarker) => {
1707
+ return (e) => {
1708
+ e.stopPropagation();
1709
+ if (!currentMeasure.current.dragging) {
1710
+ var markIndex = currentMeasure.current.measurePoints.findIndex((searchElement) => {
1711
+ return searchElement.labelMarker === labelMarker;
1712
+ });
1713
+ if (markIndex !== -1) {
1714
+ var measurePoint = currentMeasure.current.measurePoints[markIndex];
1715
+ measurePoint.marker.remove();
1716
+ measurePoint.labelMarker.remove();
1717
+ currentMeasure.current.measurePoints.splice(markIndex, 1);
1718
+ setValue("value", measureDistante());
1719
+ currentMeasure.current.addMarker = true;
1720
+ }
1721
+ currentMeasure.current.measurePoints.forEach((measurePoint2, index) => {
1722
+ measurePoint2.marker.setIcon(getMarkerPointIcon(index + 1));
1723
+ });
1724
+ }
1725
+ };
1726
+ }, []);
1727
+ const addClickListenerForRemove = useCallback((labelMarker) => {
1728
+ var element = labelMarker.getElement();
1729
+ if (element) {
1730
+ var elements = element.getElementsByClassName("M4L-MapTool-MeasureToolTip-Remove");
1731
+ element = elements[0];
1732
+ if (element) {
1733
+ element.addEventListener("click", onClickRemovePoint(labelMarker));
1734
+ }
1735
+ }
1736
+ }, []);
1737
+ const onClickMap = useCallback((e) => {
1738
+ var lat = e.latlng.lat;
1739
+ var lng = e.latlng.lng;
1740
+ var formatDistanceFromPrevious = void 0;
1741
+ if (currentMeasure.current.addMarker === false) {
1742
+ return;
1743
+ }
1744
+ if (currentMeasure.current.measurePoints.length > 0) {
1745
+ formatDistanceFromPrevious = getFormatFactorDistance(currentMeasure.current.measurePoints[currentMeasure.current.measurePoints.length - 1].marker.getLatLng().distanceTo(e.latlng));
1746
+ }
1747
+ var marker = L.marker([lat, lng], {
1748
+ draggable: true,
1749
+ riseOnHover: true,
1750
+ autoPan: true,
1751
+ icon: getMarkerPointIcon(currentMeasure.current.measurePoints.length + 1),
1752
+ zIndexOffset: MAP_ZINDEX_DEFAULT
1753
+ }).addTo(map);
1754
+ marker.on("moveend", function(_e) {
1755
+ var latlng = marker.getLatLng();
1756
+ labelMarker.setLatLng(latlng);
1757
+ setValue("value", measureDistante());
1758
+ });
1759
+ marker.on("mouseover", function() {
1760
+ currentMeasure.current.addMarker = false;
1761
+ });
1762
+ marker.on("mouseout", function() {
1763
+ currentMeasure.current.addMarker = true;
1764
+ });
1765
+ var labelMarker = L.marker([lat, lng], {
1766
+ draggable: true,
1767
+ riseOnHover: true,
1768
+ icon: getLabelMarkerPointIcon(formatDistanceFromPrevious),
1769
+ zIndexOffset: MAP_ZINDEX_DEFAULT
1770
+ }).addTo(map);
1771
+ labelMarker.on("moveend", function(_e) {
1772
+ var latlng = labelMarker.getLatLng();
1773
+ marker.setLatLng(latlng);
1774
+ setValue("value", measureDistante());
1775
+ });
1776
+ labelMarker.on("mouseover", function(_e) {
1777
+ currentMeasure.current.addMarker = false;
1778
+ });
1779
+ labelMarker.on("mouseout", function(_e) {
1780
+ currentMeasure.current.addMarker = true;
1781
+ });
1782
+ labelMarker.on("dragstart", function(_e) {
1783
+ currentMeasure.current.dragging = true;
1784
+ });
1785
+ labelMarker.on("dragend", function(_e) {
1786
+ setTimeout(function() {
1787
+ currentMeasure.current.dragging = false;
1788
+ }, 10);
1789
+ });
1790
+ addClickListenerForRemove(labelMarker);
1791
+ currentMeasure.current.measurePoints.push({
1792
+ marker,
1793
+ labelMarker,
1794
+ formatDistanceFromPrevious
1795
+ });
1796
+ setValue("value", measureDistante());
1797
+ }, [map, measureDistante, setValue]);
1798
+ const onMouseMoveMap = useCallback(() => {
1799
+ map.getContainer().style.cursor = "crosshair";
1800
+ }, [map]);
1801
+ const onMouseOutMap = useCallback(() => {
1802
+ map.getContainer().style.cursor = "default";
1803
+ }, [map]);
1804
+ useEffect(() => {
1805
+ if (map) {
1806
+ if (statusEdition === "initial") {
1807
+ return;
1808
+ } else {
1809
+ currentMeasure.current.addMarker = true;
1810
+ map.on("mousemove", onMouseMoveMap);
1811
+ map.on("mouseout", onMouseOutMap);
1812
+ map.on("click", onClickMap);
1813
+ }
1814
+ }
1815
+ }, [map, statusEdition]);
1816
+ useEffect(() => {
1817
+ console.log("useEffect magnitudFactor", readyToUpdate, magnitudFactor);
1818
+ if (!readyToUpdate)
1819
+ return;
1820
+ if (magnitudFactor.id !== magnitudFactorCached.id) {
1821
+ console.log("useEffect magnitudFactor CAMBIO");
1822
+ setMagnitudFactorCached({ ...magnitudFactor });
1823
+ currentMeasure.current.magnitudFactor = magnitudFactor;
1824
+ setValue("value", measureDistante());
1825
+ }
1826
+ }, [magnitudFactor]);
1827
+ useEffect(() => {
1828
+ console.log("useEffect reInits", readyToUpdate, reInits);
1829
+ if (!readyToUpdate)
1830
+ return;
1831
+ clearMeasure();
1832
+ }, [reInits]);
1833
+ useEffect(() => {
1834
+ return () => {
1835
+ map.off("mousemove", onMouseMoveMap);
1836
+ map.off("mouseout", onMouseOutMap);
1837
+ map.off("click", onClickMap);
1838
+ map.getContainer().style.cursor = "default";
1839
+ clearMeasure();
1840
+ console.debug("DESMONTAJES MARCAS Y EVENTOS");
1841
+ };
1842
+ }, []);
1843
+ return { statusEdition, magnitudFactor, value };
1844
+ }
1845
+ console.log("NODE_ENV", { "BASE_URL": "/", "MODE": "production", "DEV": false, "PROD": true });
1846
+ const DevTool = { "BASE_URL": "/", "MODE": "production", "DEV": false, "PROD": true }?.NODE_ENV === "development" ? require("@hookform/devtools").DevTool : () => null;
1847
+ function MeasureData() {
1848
+ const {
1849
+ getLabel
1850
+ } = useModuleDictionary();
1851
+ const {
1852
+ host_static_assets,
1853
+ environment_assets
1854
+ } = useEnvironment();
1855
+ const {
1856
+ control
1857
+ } = useFormContext();
1858
+ const {
1859
+ value,
1860
+ magnitudFactor
1861
+ } = useMeasure();
1862
+ const urlIcon = `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${icons.MEASURE}`;
1863
+ return /* @__PURE__ */ jsxs(PaperForm, {
1864
+ urlIcon,
1865
+ title: getLabel(DICCTIONARY.PAPER_MEASURE),
1866
+ children: [/* @__PURE__ */ jsx(RHFAutocompleteAsync, {
1867
+ endPoint: "magnitudes/factors?origin_unit_reference_id=m_kilometers",
1868
+ name: "magnitudFactor",
1869
+ autoComplete: "off",
1870
+ getOptionLabel: (option) => option.name,
1871
+ isOptionEqualToValue: (option, value2) => option.id === value2.id,
1872
+ label: getLabel(DICCTIONARY.LABEL_MEASURE_UNIT),
1873
+ isRemote: false
1874
+ }), /* @__PURE__ */ jsxs(Stack, {
1875
+ direction: "row",
1876
+ spacing: 2,
1877
+ className: mapToolsClasses.toolMeasureFormValue,
1878
+ children: [/* @__PURE__ */ jsx("span", {
1879
+ className: mapToolsClasses.toolMeasureFormValueDistance,
1880
+ children: value
1881
+ }), /* @__PURE__ */ jsx("span", {
1882
+ className: mapToolsClasses.toolMeasureFormValueSymbol,
1883
+ children: magnitudFactor.symbol
1884
+ })]
1885
+ }), process.env.NODE_ENV === "development" && /* @__PURE__ */ jsx(DevTool, {
1886
+ control
1887
+ })]
1888
+ });
1889
+ }
1890
+ function MeasureTool() {
1891
+ const {
1892
+ getLabel
1893
+ } = useModuleDictionary();
1894
+ const finalInitalValues = {
1895
+ ...INITIAL_FORM_VALUES
1896
+ };
1897
+ if (finalInitalValues?.magnitudFactor?.name) {
1898
+ finalInitalValues.magnitudFactor.name = getLabel(DICCTIONARY.LABEL_MEASURE_UNIT_BASE_KILOMETERS);
1899
+ }
1900
+ const {
1901
+ validationSchema
1902
+ } = useValidation();
1903
+ const onSubmit = () => {
1904
+ };
1905
+ return /* @__PURE__ */ jsxs(RHFormProvider, {
1906
+ statusLoad: INITIAL_FORM_VALUES.statusLoad,
1907
+ onSubmit,
1908
+ values: finalInitalValues,
1909
+ validationSchema,
1910
+ children: [/* @__PURE__ */ jsx(Stack, {
1911
+ direction: "column",
1912
+ children: /* @__PURE__ */ jsx(MeasureData, {})
1913
+ }), /* @__PURE__ */ jsx(MyActions, {})]
1914
+ });
1915
+ }
1916
+ function useGpsToolsStore(selector, equalityFn) {
1917
+ const context = useContext(GpsToolsContext);
1918
+ if (!context)
1919
+ throw new Error("useMapToolsStore context must be use inside GpsToolsContext");
1920
+ return useStore(context, selector, equalityFn);
1921
+ }
1922
+ function useLayers() {
1923
+ const {
1924
+ addLayer,
1925
+ removeLayer
1926
+ } = useMapStore((state) => state.mapActions, shallow);
1927
+ const {
1928
+ init
1929
+ } = useGpsToolsStore((state) => state.gpsToolsActions, shallow);
1930
+ useEffect(() => {
1931
+ addLayer({
1932
+ layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES,
1933
+ name: "Geocercas",
1934
+ renderFeature: CommonFeatureRender,
1935
+ geoJsonObject: {
1936
+ object: {
1937
+ type: "FeatureCollection",
1938
+ features: []
1939
+ }
1940
+ },
1941
+ autoFocus: false
1942
+ });
1943
+ addLayer({
1944
+ layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES_TRANSIT_FEATURES,
1945
+ name: "Geometr\xEDas de tr\xE1nsito",
1946
+ renderFeature: CommonFeatureRender,
1947
+ geoJsonObject: {
1948
+ object: {
1949
+ type: "FeatureCollection",
1950
+ features: []
1951
+ }
1952
+ },
1953
+ autoFocus: false
1954
+ });
1955
+ addLayer({
1956
+ layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES_INTERNAL_FEATURES,
1957
+ name: "Geometr\xEDas internas",
1958
+ renderFeature: CommonFeatureRender,
1959
+ geoJsonObject: {
1960
+ object: {
1961
+ type: "FeatureCollection",
1962
+ features: []
1963
+ }
1964
+ },
1965
+ autoFocus: false
1966
+ });
1967
+ init();
1968
+ return () => {
1969
+ removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES);
1970
+ removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES_INTERNAL_FEATURES);
1971
+ removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES_TRANSIT_FEATURES);
1972
+ };
1973
+ }, []);
1974
+ }
1975
+ const TabToolsRoot = styled("div")`
1976
+ position:relative;
1977
+ display:flex;
1978
+ flex-direction:column;
1979
+
1980
+ flex-grow:1;
1981
+ width:100%;
1982
+ height:100%;
1983
+
1984
+
1985
+ z-index:${MAP_ZINDEX_OVER_MAP};
1986
+
1987
+
1988
+ .${mapToolsClasses.tabContentRoot}.${mapToolsClasses.hidden} {
1989
+ height:0px;
1990
+ width:0px;
1991
+ overflow:hidden;
1992
+ opacity:0;
1993
+ visibility:hidden;
1994
+ }
1995
+
1996
+
1997
+ .${mapToolsClasses.toolMeasureFormValue} {
1998
+ justify-content: center;
1999
+ }
2000
+
2001
+ .${mapToolsClasses.toolMeasureFormValueDistance} {
2002
+ border: 1px solid white;
2003
+
2004
+ margin: 0 5px;
2005
+ }
2006
+ .${mapToolsClasses.toolMeasureFormValueSymbol} {
2007
+ border: 1px solid white;
2008
+
2009
+ margin: 0 5px;
2010
+ }
2011
+
2012
+ ${(props) => props.theme.components?.M4LGpsTools?.styleOverrides}
2013
+ `;
2014
+ function TabTools() {
2015
+ const {
2016
+ getLabel
2017
+ } = useModuleDictionary();
2018
+ const [node, divRef] = useStateRef(null);
2019
+ const status = useGpsToolsStore((state) => state.ownerState.status, shallow);
2020
+ const currentTabTool = useGpsToolsStore((state) => state.currentTabTool, shallow);
2021
+ const {
2022
+ setCurrentTabTool
2023
+ } = useGpsToolsStore((state) => state.gpsToolsActions, shallow);
2024
+ useDisableZoomEvents(node);
2025
+ const toolTabs = useMemo(() => {
2026
+ return [
2027
+ {
2028
+ id: "geofences",
2029
+ icon: void 0,
2030
+ component: /* @__PURE__ */ jsx(GeofencesTool, {}),
2031
+ label: getLabel(DICCTIONARY.LABEL_TAB_GEO),
2032
+ className: mapToolsClasses.toolGeofences
2033
+ },
2034
+ {
2035
+ id: "measure",
2036
+ icon: void 0,
2037
+ component: /* @__PURE__ */ jsx(MeasureTool, {}),
2038
+ label: getLabel(DICCTIONARY.LABEL_TAB_MEASURE),
2039
+ className: mapToolsClasses.toolMeasure
2040
+ }
2041
+ ];
2042
+ }, [getLabel]);
2043
+ useLayers();
2044
+ if (status !== "ready") {
2045
+ return null;
2046
+ }
2047
+ return /* @__PURE__ */ jsxs(
2048
+ TabToolsRoot,
2049
+ {
2050
+ ref: divRef,
2051
+ children: [/* @__PURE__ */ jsx(Tabs, {
2052
+ value: currentTabTool,
2053
+ scrollButtons: "auto",
2054
+ variant: "scrollable",
2055
+ allowScrollButtonsMobile: true,
2056
+ onChange: (_e, value) => setCurrentTabTool(value),
2057
+ children: toolTabs.map((tab) => /* @__PURE__ */ jsx(Tab, {
2058
+ value: tab.id,
2059
+ icon: tab.icon,
2060
+ label: tab.label,
2061
+ SKTWidth: "100px",
2062
+ SKTHeight: "14px"
2063
+ }, tab.id))
2064
+ }), toolTabs.map((tab) => {
2065
+ const isMatched = tab.id === currentTabTool;
2066
+ if (!isMatched && tab.id === "measure") {
2067
+ return null;
2068
+ }
2069
+ return /* @__PURE__ */ jsx(TabContent, {
2070
+ className: clsx(mapToolsClasses.tabContentRoot, tab.className, isMatched ? mapToolsClasses.visible : mapToolsClasses.hidden),
2071
+ children: tab.component
2072
+ }, tab.id);
2073
+ })]
2074
+ }
2075
+ );
2076
+ }
2077
+ function GpsTools() {
2078
+ const isSkeleton = useModuleSkeleton();
2079
+ return /* @__PURE__ */ jsx(GpsToolsProvider, {
2080
+ children: !isSkeleton && /* @__PURE__ */ jsx(TabTools, {})
2081
+ });
2082
+ }
2083
+ export {
2084
+ GpsTools as G,
2085
+ useGpsToolsStore as u
2086
+ };