@m4l/components 0.2.32 → 0.2.34

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 (279) hide show
  1. package/@types/export.d.ts +441 -413
  2. package/{commonjs.333e55c7.js → commonjs.565e6834.js} +0 -5
  3. package/components/AccountPopover/{index.69cda48b.js → index.39efc8f0.js} +1 -1
  4. package/components/AppBar/{index.0cc0bd40.js → index.c8850b99.js} +2 -2
  5. package/components/CommonActions/components/ActionCancel/{index.f00f026d.js → index.416cbf9b.js} +2 -2
  6. package/components/CommonActions/components/ActionFormCancel/{index.08fe4e27.js → index.78267f7c.js} +4 -4
  7. package/components/CommonActions/components/ActionFormIntro/{index.b5a5c4b4.js → index.dcb4d280.js} +2 -2
  8. package/components/CommonActions/components/ActionIntro/{index.574967a0.js → index.094290fd.js} +2 -2
  9. package/components/CommonActions/components/Actions/{index.23bfc86b.js → index.fa7ab18c.js} +1 -8
  10. package/components/DataGrid/assets/icons/datagrid.svg +4 -4
  11. package/components/DataGrid/formatters/ColumnBooleanFormatter/{index.cf410875.js → index.cd6e553a.js} +1 -1
  12. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/{index.00f9ed87.js → index.0c439ac3.js} +1 -1
  13. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/{index.4089f91b.js → index.867b8745.js} +1 -1
  14. package/components/DataGrid/formatters/ColumnSetCheckFormatter/{index.eb406256.js → index.0b23ba88.js} +6 -0
  15. package/components/DataGrid/formatters/ColumnSetCheckFormatter/types.d.ts +1 -0
  16. package/components/DataGrid/{index.c283b50b.js → index.abe0f9b9.js} +43 -41
  17. package/components/DataGrid/subcomponents/Actions/{index.d945647f.js → index.4f2071ee.js} +12 -11
  18. package/components/DragResizeWindow/DragResizeWindow.d.ts +15 -9
  19. package/components/DragResizeWindow/classes/types.d.ts +1 -0
  20. package/components/DragResizeWindow/{index.82cf6408.js → index.13ef022e.js} +108 -63
  21. package/components/DragResizeWindow/types.d.ts +23 -1
  22. package/components/DynamicFilter/DynamicFilter.d.ts +2 -2
  23. package/components/DynamicFilter/classes/index.d.ts +1 -1
  24. package/components/DynamicFilter/classes/types.d.ts +1 -0
  25. package/components/DynamicFilter/constants.d.ts +2 -1
  26. package/components/DynamicFilter/contexts/DynamicFilterContext/helpers.d.ts +2 -3
  27. package/components/DynamicFilter/contexts/DynamicFilterContext/store.d.ts +3 -2
  28. package/components/DynamicFilter/dictionary.d.ts +4 -0
  29. package/components/DynamicFilter/{index.75c66024.js → index.c52a8e96.js} +189 -35
  30. package/components/DynamicFilter/subcomponents/fieldstypes/SelectFilter/helpers.d.ts +51 -0
  31. package/components/DynamicFilter/subcomponents/fieldstypes/SelectFilter/index.d.ts +5 -0
  32. package/components/DynamicFilter/subcomponents/fieldstypes/factory.d.ts +12 -4
  33. package/components/DynamicFilter/subcomponents/fieldstypes/validations.d.ts +8 -1
  34. package/components/DynamicFilter/types.d.ts +40 -19
  35. package/components/FieldLabel/{index.75e89ace.js → index.0412576c.js} +2 -2
  36. package/components/GridLayout/{index.00740f82.js → index.65470f01.js} +2 -2
  37. package/components/GridLayout/subcomponents/Griditem/{index.3d479abb.js → index.30016fc1.js} +3 -3
  38. package/components/GridLayout/subcomponents/Responsive/{index.733e8ba6.js → index.5b3e0521.js} +1 -1
  39. package/components/GridLayout/subcomponents/SizeProvider/{index.247cc027.js → index.0328ad0a.js} +1 -1
  40. package/components/Icon/{index.14670a00.js → index.ad330e78.js} +65 -89
  41. package/components/Image/{index.6aa1ae49.js → index.b799c514.js} +2 -2
  42. package/components/LanguagePopover/{index.4149a8da.js → index.93c48ec5.js} +2 -2
  43. package/components/LinearProgressIndeterminate/{index.6e5db737.js → index.c46da124.js} +1 -1
  44. package/components/LoadingError/{index.1ec78dd5.js → index.ee29dd48.js} +3 -3
  45. package/components/MFLoader/{index.6037f834.js → index.3a37407c.js} +1 -1
  46. package/components/ModalDialog/{index.f27b7c2d.js → index.78c9650a.js} +4 -4
  47. package/components/NoItemSelected/{index.54023226.js → index.3a479c64.js} +1 -1
  48. package/components/ObjectLogs/{index.32ddae31.js → index.1d85a021.js} +6 -6
  49. package/components/PDFViewer/{index.d185afd0.js → index.88c6ff6a.js} +1 -1
  50. package/components/Page/{index.2c550c91.js → index.5d34dc4d.js} +1 -1
  51. package/components/PaperForm/{index.63dc4b29.js → index.d08b43f6.js} +1 -1
  52. package/components/Period/{index.ddf8716c.js → index.3f89d8a4.js} +2 -2
  53. package/components/PrintingSystem/{index.bcef9a6f.js → index.27f1f209.js} +13 -13
  54. package/components/PrintingSystem/subcomponents/BodyNode/{index.14ecdd97.js → index.319a3bb9.js} +1 -1
  55. package/components/PrintingSystem/subcomponents/ChartNode/{index.aa2b8706.js → index.990e164c.js} +1 -1
  56. package/components/PrintingSystem/subcomponents/DividerNode/{index.ce81726b.js → index.e504dbd2.js} +1 -1
  57. package/components/PrintingSystem/subcomponents/FooterNode/{index.7fc8c316.js → index.9a19a7cb.js} +1 -1
  58. package/components/PrintingSystem/subcomponents/GridNode/{index.88fcc856.js → index.8d14e1b6.js} +1 -1
  59. package/components/PrintingSystem/subcomponents/HeaderNode/{index.d3f4e000.js → index.89e4eaab.js} +1 -1
  60. package/components/PrintingSystem/subcomponents/PaperNode/{index.30cbab70.js → index.dd4ca449.js} +1 -1
  61. package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.05a3579e.js → index.048d7ebf.js} +1 -1
  62. package/components/PrintingSystem/subcomponents/SectionNode/{index.d6344807.js → index.83f1efea.js} +1 -1
  63. package/components/PrintingSystem/subcomponents/TextBoxNode/{index.79d2e283.js → index.5427cb75.js} +1 -1
  64. package/components/PropertyValue/{index.1dbf6ef8.js → index.15c61a4b.js} +2 -2
  65. package/components/Resizeable/{index.eba4fda9.js → index.cb5aad75.js} +1 -1
  66. package/components/SideBar/{index.b1455bd0.js → index.b0359a2b.js} +4 -4
  67. package/components/SplitLayout/{index.3856385c.js → index.7302ceb3.js} +1 -1
  68. package/components/ToastContainer/{index.a33ebb52.js → index.4d44ce53.js} +4 -4
  69. package/components/areas/components/AreasAdmin/{index.922cdb11.js → index.820a00ab.js} +10 -10
  70. package/components/areas/components/AreasViewer/{index.f7126815.js → index.6d7194e2.js} +14 -14
  71. package/components/areas/contexts/AreasContext/{index.37be3e4e.js → index.c5a3b322.js} +4 -4
  72. package/components/areas/hooks/useAreas/{index.e3971ffa.js → index.caa92660.js} +1 -1
  73. package/components/areas/types.d.ts +1 -1
  74. package/components/commercial/AppBarCommercial/{index.3e0ad6ef.js → index.9cf586a2.js} +1 -1
  75. package/components/commercial/SectionCommercial/index.4dbfc0a7.js +48 -0
  76. package/components/commercial/TopBar/{index.7b22d97b.js → index.93a7d26a.js} +4 -4
  77. package/components/{HamburgerMenu/index.fb1a3aae.js → commercial/index.89ad149c.js} +2 -2
  78. package/components/formatters/BooleanFormatter/{index.fb44d69d.js → index.9ccf9298.js} +2 -2
  79. package/components/formatters/{index.05c4e1a4.js → index.03471e3f.js} +1 -1
  80. package/components/hook-form/HelperError/index.66bbcac3.js +30 -0
  81. package/components/hook-form/RHFAutocomplete/classes/index.d.ts +1 -0
  82. package/components/hook-form/RHFAutocomplete/classes/types.d.ts +2 -1
  83. package/components/hook-form/RHFAutocomplete/{index.3592430b.js → index.1f2afb6b.js} +75 -42
  84. package/components/hook-form/RHFAutocomplete/types.d.ts +4 -2
  85. package/components/hook-form/RHFAutocompleteAsync/{index.dfbaece5.js → index.bc278965.js} +1 -1
  86. package/components/hook-form/RHFCheckbox/{index.251a36b5.js → index.eca64469.js} +2 -2
  87. package/components/hook-form/RHFColorPicker/{index.e7d27ca0.js → index.dc13d5a3.js} +6 -8
  88. package/components/hook-form/RHFDateTime/{index.fc474c35.js → index.e554b068.js} +3 -3
  89. package/components/hook-form/RHFHelperError/index.d.ts +4 -0
  90. package/components/hook-form/RHFPeriod/{index.2bf650c4.js → index.e4e4530f.js} +3 -3
  91. package/components/hook-form/RHFTextField/{index.db56e769.js → index.1bfa601f.js} +4 -4
  92. package/components/hook-form/RHFUpload/{index.9d4d4460.js → index.6e98b291.js} +4 -4
  93. package/components/index.d.ts +2 -0
  94. package/components/maps/components/GpsTools/GpsTools.d.ts +1 -0
  95. package/components/maps/components/GpsTools/classes/index.d.ts +4 -0
  96. package/components/maps/components/GpsTools/classes/types.d.ts +13 -0
  97. package/components/maps/components/GpsTools/constants.d.ts +8 -0
  98. package/components/maps/components/GpsTools/contexts/GpsToolsContext/index.d.ts +19 -0
  99. package/components/maps/components/GpsTools/contexts/GpsToolsContext/store.d.ts +16 -0
  100. package/components/maps/components/GpsTools/contexts/GpsToolsContext/types.d.ts +165 -0
  101. package/components/maps/components/GpsTools/hooks/useGpsToolsStore/index.d.ts +2 -0
  102. package/components/maps/components/GpsTools/hooks/useLayers/index.d.ts +1 -0
  103. package/components/maps/components/GpsTools/icons.d.ts +15 -0
  104. package/components/maps/components/GpsTools/index.d.ts +3 -0
  105. package/components/maps/components/GpsTools/index.d93188ad.js +1792 -0
  106. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/index.d.ts +9 -0
  107. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/constants.d.ts +20 -0
  108. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/helpers.d.ts +19 -0
  109. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts +11 -0
  110. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/hooks/useSubmit.d.ts +8 -0
  111. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/hooks/useSumbitErrorsFocus.d.ts +5 -0
  112. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/hooks/useValidation.d.ts +22 -0
  113. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/index.d.ts +2 -0
  114. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/index.d.ts +1 -0
  115. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/types.d.ts +6 -0
  116. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/validations.d.ts +5 -0
  117. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/index.d.ts +1 -0
  118. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/types.d.ts +7 -0
  119. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/validations.d.ts +6 -0
  120. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyActions/index.d.ts +2 -0
  121. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyActions/types.d.ts +2 -0
  122. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyTabs/index.d.ts +1 -0
  123. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/StyleData/index.d.ts +1 -0
  124. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/StyleData/subcomponents/FillData/index.d.ts +1 -0
  125. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/StyleData/subcomponents/StrokeData/index.d.ts +1 -0
  126. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/StyleData/types.d.ts +10 -0
  127. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/types.d.ts +27 -0
  128. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useCheckedFeatures.d.ts +9 -0
  129. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useCheckedGeofences.d.ts +4 -0
  130. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useColumns.d.ts +9 -0
  131. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useMaster.d.ts +20 -0
  132. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useRowActionsGetter.d.ts +9 -0
  133. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/index.d.ts +1 -0
  134. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/subcomponents/Filter/index.d.ts +7 -0
  135. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/constants.d.ts +7 -0
  136. package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/model.d.ts +122 -0
  137. package/components/maps/components/GpsTools/types.d.ts +34 -0
  138. package/components/maps/components/Map/Map.d.ts +9 -0
  139. package/components/maps/components/Map/classes/index.d.ts +5 -0
  140. package/components/maps/components/Map/classes/types.d.ts +69 -0
  141. package/components/maps/components/Map/constants.d.ts +24 -0
  142. package/components/maps/components/Map/contexts/MapContext/MapContext.d.ts +19 -0
  143. package/components/maps/components/Map/contexts/MapContext/helper.d.ts +8 -0
  144. package/components/maps/components/Map/contexts/MapContext/index.d.ts +2 -0
  145. package/components/maps/components/Map/contexts/MapContext/store.d.ts +16 -0
  146. package/components/maps/components/Map/contexts/MapContext/types.d.ts +592 -0
  147. package/components/maps/components/Map/dictionary.d.ts +86 -0
  148. package/components/maps/components/Map/external/Control/index.d.ts +11 -0
  149. package/components/maps/components/Map/external/Control/types.d.ts +8 -0
  150. package/components/maps/components/Map/external/googleMutant/index.d.ts +94 -0
  151. package/components/maps/components/Map/featureRenders/CommonFeatureRender/index.d.ts +8 -0
  152. package/components/maps/components/Map/featureRenders/CommonFeatureRender/subcomponents/FeatureDivIconLabel/index.d.ts +3 -0
  153. package/components/maps/components/Map/featureRenders/CommonFeatureRender/subcomponents/FeatureDivIconLabel/types.d.ts +7 -0
  154. package/components/maps/components/Map/featureRenders/CommonFeatureRender/subcomponents/MarkerIconLabel/index.d.ts +2 -0
  155. package/components/maps/components/Map/featureRenders/CommonFeatureRender/subcomponents/MarkerIconLabel/types.d.ts +6 -0
  156. package/components/maps/components/Map/featureRenders/MarkerFeatureRender/IconMarker.d.ts +6 -0
  157. package/components/maps/components/Map/featureRenders/MarkerFeatureRender/IconMarkerGrua.d.ts +1 -0
  158. package/components/maps/components/Map/featureRenders/MarkerFeatureRender/IconMarkerTaxi.d.ts +1 -0
  159. package/components/maps/components/Map/featureRenders/MarkerFeatureRender/index.d.ts +2 -0
  160. package/components/maps/components/Map/featureRenders/index.d.ts +2 -0
  161. package/components/maps/components/Map/hooks/useAutoFocus/index.d.ts +8 -0
  162. package/components/maps/components/Map/hooks/useAutoFocus/types.d.ts +15 -0
  163. package/components/maps/components/Map/hooks/useDisableZoomEvents/index.d.ts +6 -0
  164. package/components/maps/components/Map/hooks/useMapStore/index.d.ts +3 -0
  165. package/components/maps/components/Map/icons.d.ts +50 -0
  166. package/components/maps/components/Map/index.accb1f77.js +2386 -0
  167. package/components/maps/components/Map/index.d.ts +7 -0
  168. package/components/maps/components/Map/pluginLayers/PolylineWithArrows/index.d.ts +9 -0
  169. package/components/maps/components/Map/pluginLayers/index.d.ts +1 -0
  170. package/components/maps/components/Map/subcomponents/Controls/index.d.ts +17 -0
  171. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/index.d.ts +1 -0
  172. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/index.d.ts +7 -0
  173. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/hooks/useCheckedLayers.d.ts +9 -0
  174. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/hooks/useColumns.d.ts +15 -0
  175. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/hooks/useMaster.d.ts +13 -0
  176. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/hooks/useRowActionsGetter.d.ts +5 -0
  177. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/index.d.ts +1 -0
  178. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/model.d.ts +27 -0
  179. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/index.d.ts +1 -0
  180. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/sourceTypes/bing.d.ts +2 -0
  181. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/sourceTypes/google.d.ts +4 -0
  182. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/sourceTypes/osm.d.ts +2 -0
  183. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/sourceTypes/utils.d.ts +1 -0
  184. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/types.d.ts +4 -0
  185. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/index.d.ts +12 -0
  186. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/constants.d.ts +30 -0
  187. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/hooks/useMeasure/helpers.d.ts +11 -0
  188. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/hooks/useMeasure/index.d.ts +13 -0
  189. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/hooks/useMeasure/types.d.ts +13 -0
  190. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/hooks/useValidation.d.ts +10 -0
  191. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/index.d.ts +1 -0
  192. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MeasureData/index.d.ts +5 -0
  193. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MeasureData/types.d.ts +6 -0
  194. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MeasureData/validations.d.ts +2 -0
  195. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MyActions/index.d.ts +1 -0
  196. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/types.d.ts +9 -0
  197. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/ZoomButtons/index.d.ts +1 -0
  198. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/types.d.ts +4 -0
  199. package/components/maps/components/Map/subcomponents/Controls/types.d.ts +22 -0
  200. package/components/maps/components/Map/subcomponents/LayersContainer/index.d.ts +2 -0
  201. package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/index.d.ts +17 -0
  202. package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/subcomponents/MarkerClusterGroup/index.d.ts +20 -0
  203. package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/subcomponents/MarkerClusterGroup/types.d.ts +11 -0
  204. package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/subcomponents/RenderByEachFeatureComponent/index.d.ts +12 -0
  205. package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/subcomponents/RenderByEachFeatureComponent/types.d.ts +5 -0
  206. package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/types.d.ts +2 -0
  207. package/components/maps/components/Map/subcomponents/TileLayers/index.d.ts +6 -0
  208. package/components/maps/components/Map/subcomponents/TileLayers/subcomponents/TileLayerGoogle/index.d.ts +1 -0
  209. package/components/maps/components/Map/subcomponents/TileLayers/subcomponents/TileLayerOthers/index.d.ts +6 -0
  210. package/components/maps/components/Map/types.d.ts +40 -0
  211. package/components/maps/index.34ab6a68.js +7 -0
  212. package/components/maps/index.d.ts +3 -0
  213. package/components/maps/leaflet-geoman.d.ts +1633 -1633
  214. package/components/maps/utils.d.ts +15 -0
  215. package/components/modal/{WindowBase.2e5506d7.js → WindowBase.fd86f575.js} +3 -3
  216. package/components/modal/{WindowConfirm.ce47a48a.js → WindowConfirm.ee6de236.js} +6 -6
  217. package/components/mui_extended/Accordion/{index.f9042228.js → index.7dcdfd3a.js} +2 -2
  218. package/components/mui_extended/Button/{index.d5a031be.js → index.c3084916.js} +1 -1
  219. package/components/mui_extended/{CheckBox.0dcf39ae.js → CheckBox.2a3b86c5.js} +1 -1
  220. package/components/mui_extended/IconButton/{index.d8bdadaa.js → index.f8a3021b.js} +1 -1
  221. package/components/mui_extended/MenuActions/{index.154d57f0.js → index.90f53670.js} +2 -2
  222. package/components/mui_extended/Pager/{index.da7ea851.js → index.ea2a4f3e.js} +2 -2
  223. package/components/mui_extended/Tab/{index.2068925d.js → index.9214d9cc.js} +4 -4
  224. package/components/mui_extended/TabContent/types.d.ts +1 -1
  225. package/components/mui_extended/ToggleButton/ToggleButton.d.ts +2 -1
  226. package/components/mui_extended/ToggleButton/{index.595ea955.js → index.191711f3.js} +6 -9
  227. package/components/mui_extended/ToggleButton/types.d.ts +2 -2
  228. package/components/mui_extended/ToggleIconButton/ToggleIconButton.d.ts +1 -12
  229. package/components/mui_extended/ToggleIconButton/index.d9dbf650.js +19 -0
  230. package/components/mui_extended/ToggleIconButton/types.d.ts +2 -3
  231. package/components/popups/PopupsProvider/index.d7409f48.js +179 -0
  232. package/components/popups/PopupsViewer/index.1500ce72.js +186 -0
  233. package/components/popups/components/PopupsProvider/contexts/PopupsContext/PopupsContext.d.ts +19 -0
  234. package/components/popups/components/PopupsProvider/contexts/PopupsContext/helper.d.ts +7 -0
  235. package/components/popups/components/PopupsProvider/contexts/PopupsContext/index.d.ts +1 -0
  236. package/components/popups/components/PopupsProvider/contexts/PopupsContext/store.d.ts +16 -0
  237. package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +160 -0
  238. package/components/popups/components/PopupsProvider/hooks/usePopupsStore/index.d.ts +3 -0
  239. package/components/popups/components/PopupsProvider/index.d.ts +2 -0
  240. package/components/popups/components/PopupsViewer/PopupsViewer.d.ts +8 -0
  241. package/components/popups/components/PopupsViewer/classes/index.d.ts +15 -0
  242. package/components/popups/components/PopupsViewer/classes/types.d.ts +13 -0
  243. package/components/{PopupsProvider → popups/components/PopupsViewer}/constants.d.ts +2 -2
  244. package/components/popups/components/PopupsViewer/icons.d.ts +3 -0
  245. package/components/popups/components/PopupsViewer/index.d.ts +1 -0
  246. package/components/popups/components/PopupsViewer/subcomponents/Popup/index.d.ts +9 -0
  247. package/components/popups/components/PopupsViewer/subcomponents/Popup/subcomponents/Header/index.d.ts +2 -0
  248. package/components/popups/components/PopupsViewer/subcomponents/Popup/subcomponents/Header/types.d.ts +2 -0
  249. package/components/popups/components/PopupsViewer/subcomponents/Popup/types.d.ts +16 -0
  250. package/components/popups/components/PopupsViewer/types.d.ts +3 -0
  251. package/components/popups/index.c5eae682.js +1 -0
  252. package/components/popups/index.d.ts +2 -0
  253. package/contexts/ModalContext/{index.3d48d675.js → index.2368bb19.js} +1 -1
  254. package/hocs/withToggle/index.50aec5e4.js +22 -0
  255. package/hocs/withToggle/index.d.ts +2 -2
  256. package/hocs/withToggle/types.d.ts +6 -4
  257. package/hooks/useFormAddEdit/{index.07e5258d.js → index.000ce60b.js} +2 -2
  258. package/hooks/useFormReadyForUpdate/index.d.ts +6 -0
  259. package/hooks/useFormReadyForUpdate/index.f60f500e.js +20 -0
  260. package/hooks/useModal/{index.cb1d6a37.js → index.f73d7e42.js} +1 -1
  261. package/hooks/useSizeContainer/contants.d.ts +1 -0
  262. package/hooks/useSizeContainer/index.62b4e0c4.js +35 -0
  263. package/hooks/useSizeContainer/index.d.ts +8 -0
  264. package/hooks/useStateRef/index.538edb89.js +15 -0
  265. package/hooks/useStateRef/index.d.ts +8 -0
  266. package/hooks/useTab/{index.c0564138.js → index.976d5e1e.js} +1 -1
  267. package/index.js +157 -115
  268. package/package.json +11 -5
  269. package/{react-draggable.6cf19cba.js → react-draggable.e4725f3a.js} +4 -4
  270. package/{react-json-view.5636414a.js → react-json-view.57125fcf.js} +1 -1
  271. package/{react-resizable.0ebffd82.js → react-resizable.c07d63fb.js} +5 -5
  272. package/{react-splitter-layout.c5d98bf7.js → react-splitter-layout.8b1655c8.js} +3 -3
  273. package/vite-env.d.ts +3 -3
  274. package/components/PopupsProvider/index.3d5ad0ee.js +0 -4
  275. package/components/mui_extended/ToggleIconButton/index.c588d5e1.js +0 -29
  276. package/hocs/withToggle/index.e44eb0da.js +0 -24
  277. package/node_modules.98455a76.js +0 -6921
  278. package/vendor.55925cb3.js +0 -182
  279. /package/utils/{index.24b5284a.js → index.6469f148.js} +0 -0
@@ -0,0 +1,1792 @@
1
+ import { createContext, useRef, useEffect, useContext, useState, useMemo, useCallback } from "react";
2
+ import { useModuleDictionary, useModuleSkeleton, useEnvironment, useHostTools, useNetwork, useModulePrivileges, usePaginate } from "@m4l/core";
3
+ import { u as useMapStore, C as CommonFeatureRender, M as MAP_ZINDEX_OVER_MAP, b as MAP_DICCTIONARY } from "../Map/index.accb1f77.js";
4
+ import { shallow } from "zustand/shallow";
5
+ import { createStore, useStore } from "zustand";
6
+ import { useResponsiveDesktop, useFirstRender } from "@m4l/graphics";
7
+ import { devtools } from "zustand/middleware";
8
+ import { immer } from "zustand/middleware/immer";
9
+ import { enableMapSet } from "immer";
10
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
11
+ import "@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css";
12
+ import "@geoman-io/leaflet-geoman-free";
13
+ import { styled } from "@mui/material/styles";
14
+ import { generateUtilityClasses } from "@mui/material";
15
+ import "@mui/base";
16
+ import clsx from "clsx";
17
+ import { D as DynamicFilter } from "../../../DynamicFilter/index.c52a8e96.js";
18
+ import { C as ColumnDateFormatter } from "../../../DataGrid/formatters/ColumnDateFormatter/index.704db1ca.js";
19
+ import { useFormContext, useWatch } from "react-hook-form";
20
+ import { H as HelperError } from "../../../hook-form/HelperError/index.66bbcac3.js";
21
+ import { u as usePopupsStore } from "../../../popups/PopupsProvider/index.d7409f48.js";
22
+ import { A as ActionFormIntro } from "../../../CommonActions/components/ActionFormIntro/index.dcb4d280.js";
23
+ import { A as Actions } from "../../../CommonActions/components/Actions/index.fa7ab18c.js";
24
+ import { B as Button } from "../../../mui_extended/Button/index.c3084916.js";
25
+ import { useMap } from "react-leaflet";
26
+ import { u as useFormReadyForUpdate } from "../../../../hooks/useFormReadyForUpdate/index.f60f500e.js";
27
+ import * as L from "leaflet";
28
+ import { u as useTab } from "../../../../hooks/useTab/index.976d5e1e.js";
29
+ import { P as PaperForm } from "../../../PaperForm/index.d08b43f6.js";
30
+ import { R as RHFAutocomplete } from "../../../hook-form/RHFAutocomplete/index.1f2afb6b.js";
31
+ import { R as RHFTextField } from "../../../hook-form/RHFTextField/index.1bfa601f.js";
32
+ import { S as Stack } from "../../../mui_extended/Stack/index.0e53197c.js";
33
+ import { P as PropertyValue } from "../../../PropertyValue/index.15c61a4b.js";
34
+ import { R as RHFColorPicker } from "../../../hook-form/RHFColorPicker/index.dc13d5a3.js";
35
+ import { T as Tabs, a as Tab, b as TabContent, c as TabProvider } from "../../../mui_extended/Tab/index.9214d9cc.js";
36
+ import { T as Tooltip } from "../../../mui_extended/Tooltip/index.24a2bc3f.js";
37
+ import * as Yup from "yup";
38
+ import { R as RHFormProvider } from "../../../../contexts/RHFormContext/index.7b2a8723.js";
39
+ import { u as useFormAddEdit } from "../../../../hooks/useFormAddEdit/index.000ce60b.js";
40
+ import { u as useModal } from "../../../../hooks/useModal/index.f73d7e42.js";
41
+ import { W as WindowConfirm } from "../../../modal/WindowConfirm.ee6de236.js";
42
+ import { c as DataGrid } from "../../../DataGrid/index.abe0f9b9.js";
43
+ enableMapSet();
44
+ const createGpsToolsStore = (initProps) => {
45
+ const startProps = {
46
+ currentTabGpsTool: "geofences",
47
+ geofenceState: {
48
+ rows: [],
49
+ checkedGeofences: /* @__PURE__ */ new Set(),
50
+ checkedCrossingFeatures: /* @__PURE__ */ new Set(),
51
+ checkedInternalFeatures: /* @__PURE__ */ new Set(),
52
+ hashGeofences: {}
53
+ },
54
+ ...initProps
55
+ };
56
+ return createStore(
57
+ devtools(
58
+ immer((set, _get) => ({
59
+ ...startProps,
60
+ gpsToolsActions: {
61
+ init: () => {
62
+ set((state) => {
63
+ state.ownerState.status = "ready";
64
+ });
65
+ },
66
+ setGpsToolsState: (status) => {
67
+ set((state) => {
68
+ state.ownerState.status = status;
69
+ });
70
+ },
71
+ setHandlerGetLabel: (newHandler) => {
72
+ set((state) => {
73
+ state.getLabel = newHandler;
74
+ });
75
+ },
76
+ setExternalState: (newExternalState) => {
77
+ set((state) => {
78
+ state.ownerState = { ...state.ownerState, ...newExternalState };
79
+ });
80
+ },
81
+ setCurrentTabTool: (newTabTool) => {
82
+ set((state) => {
83
+ state.currentTabGpsTool = newTabTool;
84
+ });
85
+ }
86
+ },
87
+ geofenceActions: {
88
+ addGeofence: (geofenceId, geofence) => {
89
+ set((state) => {
90
+ state.geofenceState.hashGeofences[geofenceId] = geofence;
91
+ });
92
+ },
93
+ updatePartialGeofence: (geofenceId, geofence) => {
94
+ set((state) => {
95
+ state.geofenceState.hashGeofences[geofenceId] = { ...state.geofenceState.hashGeofences[geofenceId], ...geofence };
96
+ });
97
+ },
98
+ updateRows: (newRows) => {
99
+ set((state) => {
100
+ state.geofenceState.rows = newRows;
101
+ });
102
+ },
103
+ addCheckedGeofence: (geofenceId) => {
104
+ set((state) => {
105
+ state.geofenceState.checkedGeofences.add(geofenceId);
106
+ state.geofenceState.checkedGeofences = new Set(state.geofenceState.checkedGeofences);
107
+ });
108
+ },
109
+ removeCheckedGeofence: (geofenceId) => {
110
+ set((state) => {
111
+ state.geofenceState.checkedGeofences.delete(geofenceId);
112
+ state.geofenceState.checkedGeofences = new Set(state.geofenceState.checkedGeofences);
113
+ });
114
+ },
115
+ setCheckedGeofences: (newGeofences) => {
116
+ set((state) => {
117
+ state.geofenceState.checkedGeofences = new Set(newGeofences);
118
+ });
119
+ },
120
+ setCheckedCrossingFeatures: (newFeatures) => {
121
+ set((state) => {
122
+ state.geofenceState.checkedCrossingFeatures = new Set(newFeatures);
123
+ });
124
+ },
125
+ setCheckedInternalFeatures: (newFeatures) => {
126
+ set((state) => {
127
+ state.geofenceState.checkedInternalFeatures = new Set(newFeatures);
128
+ });
129
+ }
130
+ }
131
+ })),
132
+ { name: `Map Tools Store` }
133
+ )
134
+ );
135
+ };
136
+ const GpsToolsContext = createContext(null);
137
+ function GpsToolsProvider(props) {
138
+ const {
139
+ children
140
+ } = props;
141
+ const {
142
+ getLabel
143
+ } = useModuleDictionary();
144
+ const isDesktop = useResponsiveDesktop();
145
+ const isSkeleton = useModuleSkeleton();
146
+ const isFirstRender = useFirstRender([getLabel]);
147
+ const mapStoreRef = useRef();
148
+ if (!mapStoreRef.current) {
149
+ mapStoreRef.current = createGpsToolsStore({
150
+ getLabel,
151
+ ownerState: {
152
+ status: "init",
153
+ isMobile: !isDesktop,
154
+ isSkeleton,
155
+ focus: false
156
+ }
157
+ });
158
+ }
159
+ const {
160
+ setHandlerGetLabel,
161
+ setExternalState
162
+ } = useStore(mapStoreRef.current, (state) => state.gpsToolsActions, shallow);
163
+ useEffect(() => {
164
+ if (!isFirstRender) {
165
+ setHandlerGetLabel(getLabel);
166
+ }
167
+ }, [getLabel]);
168
+ useEffect(() => {
169
+ if (isFirstRender) {
170
+ return;
171
+ }
172
+ setExternalState({
173
+ isMobile: !isDesktop,
174
+ isSkeleton
175
+ });
176
+ }, [isDesktop, isSkeleton]);
177
+ return /* @__PURE__ */ jsx(GpsToolsContext.Provider, {
178
+ value: mapStoreRef.current,
179
+ children
180
+ });
181
+ }
182
+ function useGpsToolsStore(selector, equalityFn) {
183
+ const context = useContext(GpsToolsContext);
184
+ if (!context)
185
+ throw new Error("useGpsToolsStore context must be use inside GpsToolsContext");
186
+ return useStore(context, selector, equalityFn);
187
+ }
188
+ const ENDPOINT_GEOFENCE_GET = "geofences";
189
+ const ENDPOINT_GEOFENCE_NEW_EDIT = "geofences";
190
+ var GeofencesFeaturesLayers = /* @__PURE__ */ ((GeofencesFeaturesLayers2) => {
191
+ GeofencesFeaturesLayers2["LAYER_GEOFENCES"] = "geofences";
192
+ GeofencesFeaturesLayers2["LAYER_GEOFENCES_TRANSIT_FEATURES"] = "geofencesCrossingFeatures";
193
+ GeofencesFeaturesLayers2["LAYER_GEOFENCES_INTERNAL_FEATURES"] = "geofencesInternalFeatures";
194
+ return GeofencesFeaturesLayers2;
195
+ })(GeofencesFeaturesLayers || {});
196
+ function useLayers() {
197
+ const {
198
+ addLayer,
199
+ removeLayer
200
+ } = useMapStore((state) => state.mapActions, shallow);
201
+ const {
202
+ init
203
+ } = useGpsToolsStore((state) => state.gpsToolsActions, shallow);
204
+ useEffect(() => {
205
+ addLayer({
206
+ layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES,
207
+ name: "Geocercas",
208
+ renderFeature: CommonFeatureRender,
209
+ geoJsonObject: {
210
+ object: {
211
+ type: "FeatureCollection",
212
+ features: []
213
+ }
214
+ },
215
+ autoFocus: false
216
+ });
217
+ addLayer({
218
+ layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES_TRANSIT_FEATURES,
219
+ name: "Geometr\xEDas de tr\xE1nsito",
220
+ renderFeature: CommonFeatureRender,
221
+ geoJsonObject: {
222
+ object: {
223
+ type: "FeatureCollection",
224
+ features: []
225
+ }
226
+ },
227
+ autoFocus: false
228
+ });
229
+ addLayer({
230
+ layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES_INTERNAL_FEATURES,
231
+ name: "Geometr\xEDas internas",
232
+ renderFeature: CommonFeatureRender,
233
+ geoJsonObject: {
234
+ object: {
235
+ type: "FeatureCollection",
236
+ features: []
237
+ }
238
+ },
239
+ autoFocus: false
240
+ });
241
+ init();
242
+ return () => {
243
+ removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES);
244
+ removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES_INTERNAL_FEATURES);
245
+ removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES_TRANSIT_FEATURES);
246
+ };
247
+ }, []);
248
+ }
249
+ const COMPONENT_CLASS_NAME = "M4LGpsTools";
250
+ const COMPONENT_MAP_TOOLS_ID = "gps_tools";
251
+ const STYLE_OPACITIES = [
252
+ {
253
+ value: 0,
254
+ label: "0%"
255
+ },
256
+ {
257
+ value: 0.1,
258
+ label: "10%"
259
+ },
260
+ {
261
+ value: 0.2,
262
+ label: "20%"
263
+ },
264
+ {
265
+ value: 0.3,
266
+ label: "30%"
267
+ },
268
+ {
269
+ value: 0.4,
270
+ label: "40%"
271
+ },
272
+ {
273
+ value: 0.5,
274
+ label: "50%"
275
+ },
276
+ {
277
+ value: 1,
278
+ label: "100%"
279
+ }
280
+ ];
281
+ const STYLE_WHEIGHTS = [
282
+ {
283
+ value: 0,
284
+ label: "0px"
285
+ },
286
+ {
287
+ value: 1,
288
+ label: "1px"
289
+ },
290
+ {
291
+ value: 2,
292
+ label: "2px"
293
+ },
294
+ {
295
+ value: 3,
296
+ label: "3px"
297
+ },
298
+ {
299
+ value: 4,
300
+ label: "4px"
301
+ }
302
+ ];
303
+ const STYLE_PATTERNS = [
304
+ {
305
+ value: "",
306
+ label: "------"
307
+ },
308
+ {
309
+ value: "4 1 2",
310
+ label: "-- - - --"
311
+ }
312
+ ];
313
+ const gpsToolsClasses = generateUtilityClasses(COMPONENT_CLASS_NAME, [
314
+ "gpsToolsRoot",
315
+ "gpsToolsTab",
316
+ "gpsToolsTabContent",
317
+ "gpsToolsGeofencesList",
318
+ "gpsToolsGeofencesAddEdit",
319
+ "gpsToolsGeofencesAddEditContent",
320
+ "toolGeofencesAddEditGeneral",
321
+ "toolGeofencesAddEditStyle",
322
+ "visible",
323
+ "hidden"
324
+ ]);
325
+ const DivGpsToolsRoot = styled("div")`
326
+ position:relative;
327
+ display:flex;
328
+ flex-direction:column;
329
+ flex-grow:1;
330
+ width:100%;
331
+ height:100%;
332
+
333
+
334
+ z-index:${MAP_ZINDEX_OVER_MAP};
335
+
336
+
337
+ .${gpsToolsClasses.gpsToolsTabContent}.${gpsToolsClasses.hidden} {
338
+ display:none;
339
+ }
340
+
341
+
342
+ .${gpsToolsClasses.gpsToolsGeofencesList} .M4LDataGrid-root{
343
+ height:unset!important;
344
+ flex-grow:1;
345
+ }
346
+
347
+
348
+ .${gpsToolsClasses.toolGeofencesAddEditGeneral} {
349
+ flex-grow:1;
350
+ }
351
+
352
+
353
+ ${(props) => props.theme.components?.M4LGpsTools?.styleOverrides}
354
+ `;
355
+ const GPSTOOLSICONS = {
356
+ GEOMETRY_CIRCLE: "geometry_circle.svg",
357
+ GEOMETRY_RECTANGLE: "geometry_rectangle.svg",
358
+ GEOMETRY_POLYGON: "geometry_polygon.svg",
359
+ ADD: "add.svg",
360
+ MEASURE: "measure.svg",
361
+ GENERAL: "general.svg",
362
+ CONFIG: "config.svg",
363
+ STROKE: "stroke.svg",
364
+ FILL: "fill.svg",
365
+ EDIT: "edit.svg",
366
+ DELETE: "delete.svg",
367
+ ACTIVE: "active.svg",
368
+ NAME: "name.svg"
369
+ };
370
+ function Filter(props) {
371
+ const {
372
+ refresh,
373
+ setBackendQueryParams
374
+ } = props;
375
+ const {
376
+ host_static_assets,
377
+ environment_assets
378
+ } = useEnvironment();
379
+ const [initialFilter] = useState(() => {
380
+ return [];
381
+ });
382
+ const onChangeFilter = (_initialFilters, rawFilters) => {
383
+ setBackendQueryParams({
384
+ f: rawFilters
385
+ });
386
+ refresh();
387
+ };
388
+ return /* @__PURE__ */ jsx(DynamicFilter, {
389
+ withAllField: true,
390
+ onChangeFilters: onChangeFilter,
391
+ fields: [{
392
+ name: "id",
393
+ dictionaryId: MAP_DICCTIONARY.LABEL_ID,
394
+ type: "number",
395
+ multiple: true,
396
+ presence: "optional",
397
+ urlIcon: `${host_static_assets}/${environment_assets}/components/${COMPONENT_MAP_TOOLS_ID}/assets/icons/${GPSTOOLSICONS.ACTIVE}`
398
+ }, {
399
+ name: "name",
400
+ dictionaryId: MAP_DICCTIONARY.LABEL_NAME,
401
+ type: "string",
402
+ multiple: true,
403
+ presence: "optional",
404
+ urlIcon: `${host_static_assets}/${environment_assets}/components/${COMPONENT_MAP_TOOLS_ID}/assets/icons/${GPSTOOLSICONS.NAME}`
405
+ }],
406
+ initialApplyedFilters: initialFilter
407
+ });
408
+ }
409
+ function useColumns(props) {
410
+ const {
411
+ getLabel
412
+ } = useModuleDictionary();
413
+ const columns = useMemo(() => [
414
+ {
415
+ key: "id",
416
+ name: getLabel(MAP_DICCTIONARY.LABEL_ID),
417
+ type: "number",
418
+ width: 40,
419
+ visible: false
420
+ },
421
+ {
422
+ key: "name",
423
+ name: getLabel(MAP_DICCTIONARY.LABEL_NAME),
424
+ type: "string",
425
+ width: 300
426
+ },
427
+ {
428
+ key: "created_at",
429
+ name: getLabel(MAP_DICCTIONARY.LABEL_CREATED_AT),
430
+ type: "date",
431
+ formatter: ColumnDateFormatter({
432
+ presentationType: "datetime",
433
+ fieldValue: "row.created_at"
434
+ }),
435
+ visible: false
436
+ },
437
+ {
438
+ key: "updated_at",
439
+ name: getLabel(MAP_DICCTIONARY.LABEL_UPDATED_AT),
440
+ type: "date",
441
+ formatter: ColumnDateFormatter({
442
+ presentationType: "datetime",
443
+ fieldValue: "row.updated_at"
444
+ }),
445
+ visible: false
446
+ }
447
+ ], [getLabel]);
448
+ return {
449
+ columns
450
+ };
451
+ }
452
+ function MyActions(props) {
453
+ const {
454
+ geofenceId
455
+ } = props;
456
+ const {
457
+ control
458
+ } = useFormContext();
459
+ const inEdition = useWatch({
460
+ control,
461
+ name: "inEdition"
462
+ });
463
+ const {
464
+ closePopup,
465
+ showPopup
466
+ } = usePopupsStore((state) => state.popupsActions);
467
+ const {
468
+ addCheckedGeofence
469
+ } = useGpsToolsStore((state) => state.geofenceActions);
470
+ const onClickCancel = () => {
471
+ closePopup("geofencesAddEdit");
472
+ if (geofenceId !== void 0) {
473
+ addCheckedGeofence(geofenceId);
474
+ }
475
+ showPopup("gpsTools");
476
+ };
477
+ return /* @__PURE__ */ jsxs(Actions, {
478
+ children: [/* @__PURE__ */ jsx(HelperError, {
479
+ name: "geometry"
480
+ }), /* @__PURE__ */ jsx(Button, {
481
+ onClick: onClickCancel,
482
+ disabled: inEdition,
483
+ children: "Cancelar"
484
+ }), /* @__PURE__ */ jsx(ActionFormIntro, {
485
+ disabled: inEdition
486
+ })]
487
+ });
488
+ }
489
+ const STROKE_COLOR_DEFAULT = "#aaccaa";
490
+ const STROKE_OPACITY_DEFAULT = { value: 1, label: "100%" };
491
+ const STROKE_WHEIGTH_DEFAULT = { value: 1, label: "1 px" };
492
+ const STROKE_DASH_ARRAY_DEFAULT = { value: "", label: "-----" };
493
+ const FILL_COLOR_DEFAULT = "#aa3000";
494
+ const FILL_OPACITY_DEFAULT = { value: 0.2, label: "20%" };
495
+ const initialValues = {
496
+ name: "",
497
+ geofenceType: null,
498
+ alias: null,
499
+ customerId: null,
500
+ timeMinInSeconds: 5,
501
+ timeMinOutSeconds: 5,
502
+ inEdition: false,
503
+ geometry: null,
504
+ lat: null,
505
+ lng: null,
506
+ properties: {
507
+ radius: null,
508
+ strokeColor: STROKE_COLOR_DEFAULT,
509
+ strokeOpacity: STROKE_OPACITY_DEFAULT,
510
+ strokeWeight: STROKE_WHEIGTH_DEFAULT,
511
+ strokeDashArray: STROKE_DASH_ARRAY_DEFAULT,
512
+ fillColor: FILL_COLOR_DEFAULT,
513
+ fillOpacity: FILL_OPACITY_DEFAULT
514
+ }
515
+ };
516
+ const formatDataEnpoint = (response) => {
517
+ try {
518
+ const { data } = response;
519
+ const obRet = {
520
+ ...initialValues,
521
+ inEdition: false,
522
+ name: data.name,
523
+ geometry: data.geometry,
524
+ geofenceType: { id: data.type.id, name: data.type.name, url: "" },
525
+ properties: {
526
+ strokeColor: data.properties.strokeColor || STROKE_COLOR_DEFAULT,
527
+ strokeOpacity: STROKE_OPACITY_DEFAULT,
528
+ strokeWeight: STROKE_WHEIGTH_DEFAULT,
529
+ strokeDashArray: STROKE_DASH_ARRAY_DEFAULT,
530
+ fillColor: data.properties.fillColor || FILL_COLOR_DEFAULT,
531
+ fillOpacity: FILL_OPACITY_DEFAULT
532
+ }
533
+ };
534
+ console.log("formatDataEnpoint", obRet);
535
+ if (obRet.geofenceType?.id === "gt_circle") {
536
+ if (data.properties.radius) {
537
+ obRet.properties.radius = data.properties.radius;
538
+ }
539
+ if (data.geometry && data.geometry.type === "Point") {
540
+ obRet.lng = data.geometry.coordinates[0];
541
+ obRet.lat = data.geometry.coordinates[1];
542
+ }
543
+ }
544
+ return obRet;
545
+ } catch (error) {
546
+ return { ...initialValues };
547
+ }
548
+ };
549
+ const getLayerFromGeometry = (geometry, geofenceTypeId, radius, options) => {
550
+ if (geometry) {
551
+ if (geofenceTypeId === "gt_circle" && geometry.type === "Point") {
552
+ return L.circle([geometry.coordinates[1], geometry.coordinates[0]], radius || 0, options);
553
+ } else if (geofenceTypeId === "gt_polygon" && geometry.type === "Polygon") {
554
+ const coordinates = geometry.coordinates.map(
555
+ (ring) => ring.map((position) => [position[1], position[0]])
556
+ );
557
+ return L.polygon(coordinates, options);
558
+ } else if (geofenceTypeId === "gt_rectangle" && geometry.type === "Polygon") {
559
+ const latLngs = geometry.coordinates[0].map((coord) => [coord[1], coord[0]]);
560
+ const lats = latLngs.map(
561
+ (coord) => {
562
+ if (Array.isArray(coord)) {
563
+ return coord[0];
564
+ }
565
+ return 0;
566
+ }
567
+ );
568
+ const lngs = latLngs.map(
569
+ (coord) => {
570
+ if (Array.isArray(coord)) {
571
+ return coord[1];
572
+ }
573
+ return 0;
574
+ }
575
+ );
576
+ const southWest = [Math.min(...lats), Math.min(...lngs)];
577
+ const northEast = [Math.max(...lats), Math.max(...lngs)];
578
+ return L.rectangle([southWest, northEast], options);
579
+ }
580
+ }
581
+ return null;
582
+ };
583
+ function useDrawing() {
584
+ const { getLabel } = useModuleDictionary();
585
+ const readyToUpdate = useFormReadyForUpdate();
586
+ const map = useMap();
587
+ const { control, setValue } = useFormContext();
588
+ const fieldsWatch = useWatch({
589
+ control,
590
+ name: [
591
+ "geofenceType",
592
+ "inEdition",
593
+ "properties.strokeColor",
594
+ "properties.strokeOpacity",
595
+ "properties.strokeWeight",
596
+ "properties.strokeDashArray",
597
+ "properties.fillColor",
598
+ "properties.fillOpacity",
599
+ "geometry",
600
+ "properties.radius"
601
+ ]
602
+ });
603
+ const geofenceTypeId = fieldsWatch[0]?.id;
604
+ const inEdition = fieldsWatch[1];
605
+ const strokeColor = fieldsWatch[2];
606
+ const strokeOpacity = fieldsWatch[3].value;
607
+ const strokeWeight = fieldsWatch[4].value;
608
+ const strokeDashArray = fieldsWatch[5].value;
609
+ const fillColor = fieldsWatch[6];
610
+ const fillOpacity = fieldsWatch[7].value;
611
+ const geometry = fieldsWatch[8];
612
+ const radius = fieldsWatch[9];
613
+ const [drawing, setDrawing] = useState(false);
614
+ const currentLayer = useRef(null);
615
+ const [geometrTypeIdCached, setgeofenceTypeIdCached] = useState(geofenceTypeId);
616
+ useEffect(() => {
617
+ if (geometry) {
618
+ console.log("useEffect geometry load", geometry, {
619
+ color: strokeColor,
620
+ opacity: strokeOpacity,
621
+ weight: strokeWeight,
622
+ dashArray: strokeDashArray,
623
+ fillColor,
624
+ fillOpacity
625
+ });
626
+ currentLayer.current = getLayerFromGeometry(geometry, geofenceTypeId, radius, {
627
+ color: strokeColor,
628
+ opacity: strokeOpacity,
629
+ weight: strokeWeight,
630
+ dashArray: strokeDashArray,
631
+ fillColor,
632
+ fillOpacity
633
+ });
634
+ if (currentLayer.current) {
635
+ map.addLayer(currentLayer.current);
636
+ map.fitBounds(currentLayer.current.getBounds());
637
+ }
638
+ }
639
+ return () => {
640
+ if (currentLayer.current) {
641
+ currentLayer.current.remove();
642
+ }
643
+ };
644
+ }, [map]);
645
+ useEffect(() => {
646
+ if (currentLayer.current) {
647
+ currentLayer.current.setStyle({
648
+ color: strokeColor,
649
+ opacity: strokeOpacity,
650
+ weight: strokeWeight,
651
+ dashArray: strokeDashArray,
652
+ fillColor,
653
+ fillOpacity
654
+ });
655
+ }
656
+ }, [strokeColor, strokeOpacity, strokeWeight, strokeDashArray, fillColor, fillOpacity]);
657
+ useEffect(() => {
658
+ map.pm.setLang("en", {
659
+ tooltips: {
660
+ placeMarker: void 0,
661
+ firstVertex: getLabel(MAP_DICCTIONARY.LABEL_FIRST_VERTEX),
662
+ continueLine: getLabel(MAP_DICCTIONARY.LABEL_CONTINUE_LINE),
663
+ finishLine: getLabel(MAP_DICCTIONARY.LABEL_FINISH_LINE),
664
+ finishPoly: getLabel(MAP_DICCTIONARY.LABEL_FINISH_POLY),
665
+ finishRect: getLabel(MAP_DICCTIONARY.LABEL_FINISH_RECT),
666
+ startCircle: getLabel(MAP_DICCTIONARY.LABEL_START_CIRCLE),
667
+ finishCircle: getLabel(MAP_DICCTIONARY.LABEL_FINISH_CIRCLE),
668
+ placeCircleMarker: getLabel(MAP_DICCTIONARY.LABEL_PLACE_CIRCLE_MARKER)
669
+ }
670
+ });
671
+ }, [map, getLabel]);
672
+ useEffect(() => {
673
+ if (map) {
674
+ let shape = "Circle";
675
+ if (geometrTypeIdCached === "gt_polygon") {
676
+ shape = "Polygon";
677
+ } else if (geometrTypeIdCached === "gt_rectangle") {
678
+ shape = "Rectangle";
679
+ }
680
+ if (drawing) {
681
+ if (!currentLayer.current) {
682
+ setValue("inEdition", true);
683
+ if (shape === "Circle") {
684
+ map.on("pm:drawstart", ({ workingLayer }) => {
685
+ workingLayer.on("pm:centerplaced", (e) => {
686
+ var layer = e.workingLayer;
687
+ layer.setStyle(
688
+ {
689
+ color: strokeColor,
690
+ opacity: strokeOpacity,
691
+ weight: strokeWeight,
692
+ dashArray: strokeDashArray,
693
+ fillColor,
694
+ fillOpacity
695
+ }
696
+ );
697
+ setValue("lat", layer.getLatLng().lat);
698
+ setValue("lng", layer.getLatLng().lng);
699
+ layer.on("pm:change", (_e) => {
700
+ setValue("properties.radius", layer.getRadius());
701
+ });
702
+ });
703
+ });
704
+ setValue("properties.subType", shape);
705
+ } else if (shape === "Polygon") {
706
+ map.on("pm:drawstart", ({ workingLayer }) => {
707
+ workingLayer.on("pm:vertexadded", (e) => {
708
+ var layer = e.workingLayer;
709
+ layer.setStyle(
710
+ {
711
+ color: strokeColor,
712
+ opacity: strokeOpacity,
713
+ weight: strokeWeight,
714
+ dashArray: strokeDashArray,
715
+ fillColor,
716
+ fillOpacity
717
+ }
718
+ );
719
+ });
720
+ });
721
+ }
722
+ map.pm.enableDraw(shape);
723
+ map.pm.setPathOptions(
724
+ {
725
+ color: strokeColor,
726
+ opacity: strokeOpacity,
727
+ weight: strokeWeight,
728
+ dashArray: strokeDashArray,
729
+ fillColor,
730
+ fillOpacity
731
+ }
732
+ );
733
+ map.on("pm:create", (e) => {
734
+ currentLayer.current = e.layer;
735
+ setValue("geometry", currentLayer.current.toGeoJSON()?.geometry, {
736
+ shouldTouch: false,
737
+ shouldValidate: true
738
+ });
739
+ setValue("inEdition", false);
740
+ setDrawing(false);
741
+ });
742
+ } else {
743
+ currentLayer.current.pm.enable();
744
+ setValue("inEdition", true);
745
+ currentLayer.current.on("pm:disable", (e) => {
746
+ currentLayer.current = e.layer;
747
+ console.log("Geometr\xEDa editada **", currentLayer.current.toGeoJSON());
748
+ setValue("geometry", currentLayer.current.toGeoJSON()?.geometry, {
749
+ shouldTouch: false,
750
+ shouldValidate: true
751
+ });
752
+ setValue("inEdition", false);
753
+ setDrawing(false);
754
+ });
755
+ if (shape === "Circle") {
756
+ currentLayer.current.on("pm:change", (e) => {
757
+ currentLayer.current = e.layer;
758
+ setValue("properties.radius", currentLayer.current.getRadius());
759
+ });
760
+ }
761
+ }
762
+ } else {
763
+ map.pm.disableDraw("Polygon");
764
+ map.off("pm:create");
765
+ map.off("pm:edit");
766
+ map.off("pm:drawstart");
767
+ }
768
+ }
769
+ }, [map, drawing]);
770
+ const handleDraw = useCallback(() => {
771
+ setDrawing(true);
772
+ }, []);
773
+ const handleFinish = useCallback(() => {
774
+ if (currentLayer.current) {
775
+ currentLayer.current.pm.disable();
776
+ currentLayer.current.setStyle({ color: "#ff0000", fillColor: "#ff0000" });
777
+ }
778
+ }, []);
779
+ useEffect(() => {
780
+ if (!readyToUpdate)
781
+ return;
782
+ if (geofenceTypeId) {
783
+ if (geofenceTypeId !== geometrTypeIdCached) {
784
+ setgeofenceTypeIdCached(geofenceTypeId);
785
+ if (geometrTypeIdCached !== "gt_circle") {
786
+ setValue("properties.radius", null);
787
+ setValue("lat", null);
788
+ setValue("lng", null);
789
+ }
790
+ setValue("geometry", null);
791
+ if (currentLayer.current) {
792
+ currentLayer.current.remove();
793
+ currentLayer.current = null;
794
+ }
795
+ }
796
+ }
797
+ }, [geofenceTypeId]);
798
+ return { inEdition, handleDraw, handleFinish, geometrTypeIdCached };
799
+ }
800
+ function useSumbitErrorsFocus() {
801
+ const {
802
+ setFocus,
803
+ formState: { isSubmitted, errors }
804
+ } = useFormContext();
805
+ const { handleChange } = useTab();
806
+ useEffect(() => {
807
+ if (isSubmitted) {
808
+ const firstError = Object.keys(errors).reduce((field, a) => {
809
+ const fieldKey = field;
810
+ return !!errors[fieldKey] ? fieldKey : a;
811
+ }, null);
812
+ if (firstError) {
813
+ let found = ["name", "geometry", "geofenceType", "timeMinInSeconds", "timeMinOutSeconds"].some((field) => field.includes(firstError));
814
+ if (found) {
815
+ handleChange(null, "general");
816
+ }
817
+ if (firstError) {
818
+ setFocus(firstError);
819
+ }
820
+ }
821
+ }
822
+ }, [isSubmitted, errors]);
823
+ }
824
+ function GeneralData() {
825
+ const {
826
+ getLabel
827
+ } = useModuleDictionary();
828
+ const {
829
+ host_static_assets,
830
+ environment_assets
831
+ } = useEnvironment();
832
+ const {
833
+ inEdition,
834
+ handleDraw,
835
+ handleFinish,
836
+ geometrTypeIdCached
837
+ } = useDrawing();
838
+ useSumbitErrorsFocus();
839
+ const urlIcon = `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${GPSTOOLSICONS.GENERAL}`;
840
+ const geofencesTypes = useMemo(() => {
841
+ return [{
842
+ id: "gt_circle",
843
+ name: getLabel(MAP_DICCTIONARY.LABEL_GEOMETRY_CIRCLE),
844
+ url: `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${GPSTOOLSICONS.GEOMETRY_CIRCLE}`
845
+ }, {
846
+ id: "gt_polygon",
847
+ name: getLabel(MAP_DICCTIONARY.LABEL_GEOMETRY_POLYGON),
848
+ url: `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${GPSTOOLSICONS.GEOMETRY_POLYGON}`
849
+ }, {
850
+ id: "gt_rectangle",
851
+ name: getLabel(MAP_DICCTIONARY.LABEL_GEOMETRY_RECTANGLE),
852
+ url: `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${GPSTOOLSICONS.GEOMETRY_RECTANGLE}`
853
+ }];
854
+ }, [getLabel]);
855
+ return /* @__PURE__ */ jsxs(PaperForm, {
856
+ urlIcon,
857
+ title: getLabel(MAP_DICCTIONARY.PAPER_GENERAL),
858
+ children: [/* @__PURE__ */ jsx(RHFTextField, {
859
+ name: "name",
860
+ disabled: false,
861
+ type: "text",
862
+ label: getLabel(`${MAP_DICCTIONARY.LABEL_NAME}`)
863
+ }), /* @__PURE__ */ jsxs(Stack, {
864
+ direction: "column",
865
+ spacing: 1,
866
+ alignItems: "center",
867
+ children: [/* @__PURE__ */ jsxs(Stack, {
868
+ direction: "row",
869
+ spacing: 1,
870
+ alignItems: "center",
871
+ children: [/* @__PURE__ */ jsx(RHFAutocomplete, {
872
+ name: "geofenceType",
873
+ autoComplete: "off",
874
+ options: geofencesTypes,
875
+ getOptionLabel: (option) => option.name,
876
+ isOptionEqualToValue: (option, value) => option.id === value.id,
877
+ getOptionUrlImage: (option) => option.url,
878
+ label: getLabel(MAP_DICCTIONARY.LABEL_GEOMETRY_TYPE)
879
+ }), /* @__PURE__ */ jsx(Button, {
880
+ onClick: handleDraw,
881
+ disabled: inEdition || !geometrTypeIdCached,
882
+ children: getLabel(MAP_DICCTIONARY.LABEL_DRAW)
883
+ }), /* @__PURE__ */ jsx(Button, {
884
+ onClick: handleFinish,
885
+ disabled: !inEdition,
886
+ children: getLabel(MAP_DICCTIONARY.LABEL_FINISH)
887
+ })]
888
+ }), geometrTypeIdCached && geometrTypeIdCached === "gt_circle" && /* @__PURE__ */ jsxs(Stack, {
889
+ direction: "row",
890
+ spacing: 1,
891
+ alignItems: "center",
892
+ children: [/* @__PURE__ */ jsx(RHFTextField, {
893
+ name: "properties.radius",
894
+ label: getLabel(MAP_DICCTIONARY.LABEL_RADIUS),
895
+ autoComplete: "on",
896
+ skeletonWidth: "70%",
897
+ skeletonHeight: "18px",
898
+ disabled: true,
899
+ size: "medium"
900
+ }), /* @__PURE__ */ jsx(RHFTextField, {
901
+ name: "lat",
902
+ label: getLabel(MAP_DICCTIONARY.LABEL_LAT),
903
+ autoComplete: "on",
904
+ skeletonWidth: "70%",
905
+ skeletonHeight: "18px",
906
+ disabled: true,
907
+ size: "medium"
908
+ }), /* @__PURE__ */ jsx(RHFTextField, {
909
+ name: "lng",
910
+ label: getLabel(MAP_DICCTIONARY.LABEL_LON),
911
+ autoComplete: "on",
912
+ skeletonWidth: "70%",
913
+ skeletonHeight: "18px",
914
+ disabled: true,
915
+ size: "medium"
916
+ })]
917
+ })]
918
+ })]
919
+ });
920
+ }
921
+ function ConfigData() {
922
+ const {
923
+ getLabel
924
+ } = useModuleDictionary();
925
+ const {
926
+ host_static_assets,
927
+ environment_assets
928
+ } = useEnvironment();
929
+ const urlIcon = `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${GPSTOOLSICONS.CONFIG}`;
930
+ return /* @__PURE__ */ jsxs(PaperForm, {
931
+ urlIcon,
932
+ title: getLabel(MAP_DICCTIONARY.PAPER_CONFIG),
933
+ children: [/* @__PURE__ */ jsx(RHFTextField, {
934
+ name: "alias",
935
+ disabled: false,
936
+ type: "text",
937
+ label: getLabel(`${MAP_DICCTIONARY.LABEL_ALIAS}`)
938
+ }), /* @__PURE__ */ jsx(RHFTextField, {
939
+ name: "customerId",
940
+ disabled: false,
941
+ type: "text",
942
+ label: getLabel(`${MAP_DICCTIONARY.LABEL_CUSTOMER_ID}`)
943
+ }), /* @__PURE__ */ jsx(RHFTextField, {
944
+ name: "timeMinInSeconds",
945
+ disabled: false,
946
+ type: "number",
947
+ label: getLabel(`${MAP_DICCTIONARY.LABEL_TIME_MIN_IN_SECONDS}`)
948
+ }), /* @__PURE__ */ jsx(RHFTextField, {
949
+ name: "timeMinOutSeconds",
950
+ disabled: false,
951
+ type: "number",
952
+ label: getLabel(`${MAP_DICCTIONARY.LABEL_TIME_MIN_OUT_SECONDS}`)
953
+ })]
954
+ });
955
+ }
956
+ function FillData() {
957
+ const {
958
+ getLabel
959
+ } = useModuleDictionary();
960
+ const {
961
+ host_static_assets,
962
+ environment_assets
963
+ } = useEnvironment();
964
+ const urlIcon = `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${GPSTOOLSICONS.FILL}`;
965
+ return /* @__PURE__ */ jsxs(PaperForm, {
966
+ urlIcon,
967
+ title: getLabel(MAP_DICCTIONARY.PAPER_STROKE),
968
+ children: [/* @__PURE__ */ jsx(PropertyValue, {
969
+ property: getLabel(`${MAP_DICCTIONARY.LABEL_COLOR}`),
970
+ isForm: true,
971
+ propertyWidth: 150,
972
+ value: /* @__PURE__ */ jsx(RHFColorPicker, {
973
+ name: "properties.fillColor"
974
+ })
975
+ }, "properties.fillColor"), /* @__PURE__ */ jsx(PropertyValue, {
976
+ property: getLabel(`${MAP_DICCTIONARY.LABEL_OPACITY}`),
977
+ isForm: true,
978
+ propertyWidth: 150,
979
+ value: /* @__PURE__ */ jsx(RHFAutocomplete, {
980
+ name: "properties.fillOpacity",
981
+ autoComplete: "off",
982
+ options: STYLE_OPACITIES,
983
+ getOptionLabel: (option) => option.label,
984
+ isOptionEqualToValue: (option, value) => option.value === value.value,
985
+ label: "ssss"
986
+ })
987
+ }, "properties.fillOpacity")]
988
+ });
989
+ }
990
+ function StrokeData() {
991
+ const {
992
+ getLabel
993
+ } = useModuleDictionary();
994
+ const {
995
+ host_static_assets,
996
+ environment_assets
997
+ } = useEnvironment();
998
+ const urlIcon = `${host_static_assets}/${environment_assets}/frontend/domain/components/map/assets/icons/${GPSTOOLSICONS.STROKE}`;
999
+ return /* @__PURE__ */ jsxs(PaperForm, {
1000
+ urlIcon,
1001
+ title: getLabel(MAP_DICCTIONARY.PAPER_STROKE),
1002
+ children: [/* @__PURE__ */ jsx(PropertyValue, {
1003
+ property: getLabel(`${MAP_DICCTIONARY.LABEL_COLOR}`),
1004
+ isForm: true,
1005
+ propertyWidth: 150,
1006
+ value: /* @__PURE__ */ jsx(RHFColorPicker, {
1007
+ name: "properties.strokeColor"
1008
+ })
1009
+ }, "properties.strokeColor"), /* @__PURE__ */ jsx(PropertyValue, {
1010
+ property: getLabel(`${MAP_DICCTIONARY.LABEL_OPACITY}`),
1011
+ isForm: true,
1012
+ propertyWidth: 150,
1013
+ value: /* @__PURE__ */ jsx(RHFAutocomplete, {
1014
+ name: "properties.strokeOpacity",
1015
+ autoComplete: "off",
1016
+ options: STYLE_OPACITIES,
1017
+ getOptionLabel: (option) => option.label,
1018
+ isOptionEqualToValue: (option, value) => option.value === value.value,
1019
+ label: "ssss"
1020
+ })
1021
+ }, "properties.strokeOpacity"), /* @__PURE__ */ jsx(PropertyValue, {
1022
+ property: getLabel(`${MAP_DICCTIONARY.LABEL_WEIGHT}`),
1023
+ isForm: true,
1024
+ propertyWidth: 150,
1025
+ value: /* @__PURE__ */ jsx(RHFAutocomplete, {
1026
+ name: "properties.strokeWeight",
1027
+ autoComplete: "off",
1028
+ options: STYLE_WHEIGHTS,
1029
+ getOptionLabel: (option) => option.label,
1030
+ isOptionEqualToValue: (option, value) => option.value === value.value,
1031
+ label: "ssss"
1032
+ })
1033
+ }, "properties.strokeWeight"), /* @__PURE__ */ jsx(PropertyValue, {
1034
+ property: getLabel(`${MAP_DICCTIONARY.LABEL_DASH_ARRAY}`),
1035
+ isForm: true,
1036
+ propertyWidth: 150,
1037
+ value: /* @__PURE__ */ jsx(RHFAutocomplete, {
1038
+ name: "properties.strokeDashArray",
1039
+ autoComplete: "off",
1040
+ options: STYLE_PATTERNS,
1041
+ getOptionLabel: (option) => option.label,
1042
+ isOptionEqualToValue: (option, value) => option.value === value.value,
1043
+ label: "ssss"
1044
+ })
1045
+ }, "properties.strokeDashArray")]
1046
+ });
1047
+ }
1048
+ function StyleData() {
1049
+ return /* @__PURE__ */ jsxs(Fragment, {
1050
+ children: [/* @__PURE__ */ jsx(StrokeData, {}), /* @__PURE__ */ jsx(FillData, {})]
1051
+ });
1052
+ }
1053
+ function MyTabs() {
1054
+ const {
1055
+ getLabel
1056
+ } = useModuleDictionary();
1057
+ const {
1058
+ currentTab,
1059
+ handleChange
1060
+ } = useTab();
1061
+ const geofenceAddEditTabs = useMemo(() => {
1062
+ return [{
1063
+ value: "general",
1064
+ icon: void 0,
1065
+ components: /* @__PURE__ */ jsxs(Fragment, {
1066
+ children: [/* @__PURE__ */ jsx(GeneralData, {}), /* @__PURE__ */ jsx(ConfigData, {})]
1067
+ }),
1068
+ toolTip: getLabel(MAP_DICCTIONARY.TAB_GENERAL_CONFIG_TOOLTIP),
1069
+ className: gpsToolsClasses.toolGeofencesAddEditGeneral
1070
+ }, {
1071
+ value: "style",
1072
+ icon: void 0,
1073
+ components: /* @__PURE__ */ jsx(StyleData, {}),
1074
+ toolTip: getLabel(MAP_DICCTIONARY.TAB_STYLE_CONFIG_TOOLTIP),
1075
+ className: gpsToolsClasses.toolGeofencesAddEditStyle
1076
+ }];
1077
+ }, [getLabel]);
1078
+ return /* @__PURE__ */ jsxs("div", {
1079
+ className: gpsToolsClasses.gpsToolsGeofencesAddEditContent,
1080
+ children: [/* @__PURE__ */ jsx(Tabs, {
1081
+ value: currentTab,
1082
+ scrollButtons: "auto",
1083
+ variant: "scrollable",
1084
+ allowScrollButtonsMobile: true,
1085
+ onChange: (_e, newValue) => handleChange(_e, newValue),
1086
+ children: geofenceAddEditTabs.map((tab) => /* @__PURE__ */ jsx(Tab, {
1087
+ value: tab.value,
1088
+ icon: tab.icon,
1089
+ label: /* @__PURE__ */ jsx(Tooltip, {
1090
+ title: tab.toolTip,
1091
+ children: /* @__PURE__ */ jsx("span", {
1092
+ children: tab.toolTip
1093
+ })
1094
+ }),
1095
+ SKTWidth: "100px",
1096
+ SKTHeight: "14px"
1097
+ }, tab.value))
1098
+ }), geofenceAddEditTabs.map((tab) => {
1099
+ const isMatched = tab.value === currentTab;
1100
+ return /* @__PURE__ */ jsx(TabContent, {
1101
+ className: clsx(gpsToolsClasses.gpsToolsTabContent, tab.className, isMatched ? gpsToolsClasses.visible : gpsToolsClasses.hidden),
1102
+ children: tab.components
1103
+ }, tab.value);
1104
+ })]
1105
+ });
1106
+ }
1107
+ function GeneralDataValidation(getLabel) {
1108
+ return {
1109
+ name: Yup.string().required(getLabel(MAP_DICCTIONARY.VALIDATION_FIELD_REQUIRED)),
1110
+ geometry: Yup.object().nullable().required(getLabel(MAP_DICCTIONARY.VALIDATION_GEOMETRY_REQUIRED)),
1111
+ geofenceType: Yup.object().nullable().required(getLabel(MAP_DICCTIONARY.VALIDATION_FIELD_REQUIRED))
1112
+ };
1113
+ }
1114
+ function ConfigDataValidation(getLabel) {
1115
+ return {
1116
+ timeMinInSeconds: Yup.number().required(getLabel(MAP_DICCTIONARY.VALIDATION_FIELD_REQUIRED)).typeError(getLabel(MAP_DICCTIONARY.VALIDATION_FIELD_TYPE_NUMBER_ERROR)),
1117
+ timeMinOutSeconds: Yup.number().required(getLabel(MAP_DICCTIONARY.VALIDATION_FIELD_REQUIRED)).typeError(getLabel(MAP_DICCTIONARY.VALIDATION_FIELD_TYPE_NUMBER_ERROR))
1118
+ };
1119
+ }
1120
+ function useValidation() {
1121
+ const { getLabel } = useModuleDictionary();
1122
+ const validationSchema = useMemo(
1123
+ () => Yup.object().shape({
1124
+ ...GeneralDataValidation(getLabel),
1125
+ ...ConfigDataValidation(getLabel)
1126
+ }),
1127
+ [getLabel]
1128
+ );
1129
+ return { validationSchema };
1130
+ }
1131
+ const getSummitData = (values, geofenceId) => {
1132
+ const newEditObj = {
1133
+ name: values.name,
1134
+ typeId: values.geofenceType.id,
1135
+ geometry: values.geometry,
1136
+ properties: {
1137
+ subType: values.properties.subType,
1138
+ strokeColor: values.properties.fillColor,
1139
+ strokeOpacity: values.properties.strokeOpacity.value,
1140
+ strokeWeight: values.properties.strokeWeight.value,
1141
+ strokeDashArray: values.properties.strokeDashArray.value,
1142
+ fillColor: values.properties.fillColor,
1143
+ fillOpacity: values.properties.fillOpacity.value
1144
+ },
1145
+ timeMinInSeconds: values.timeMinInSeconds,
1146
+ timeMinOutSeconds: values.timeMinOutSeconds,
1147
+ alias: values.alias,
1148
+ customerId: values.customerId,
1149
+ ...geofenceId ? { geofenceId } : {}
1150
+ };
1151
+ if (values.geofenceType.id === "gt_circle") {
1152
+ newEditObj.properties.radius = values.properties.radius;
1153
+ }
1154
+ return newEditObj;
1155
+ };
1156
+ function useSubmit(props) {
1157
+ const { objectId, fullRefresh } = props;
1158
+ const { toast } = useHostTools();
1159
+ const { networkOperation } = useNetwork();
1160
+ const { closePopup, showPopup } = usePopupsStore((state) => state.popupsActions);
1161
+ const { addCheckedGeofence } = useGpsToolsStore((state) => state.geofenceActions, shallow);
1162
+ const onSubmit = async (data) => {
1163
+ await networkOperation({
1164
+ method: objectId ? "PUT" : "POST",
1165
+ endPoint: `${ENDPOINT_GEOFENCE_NEW_EDIT}${objectId ? `/${objectId}` : ""}`,
1166
+ data: getSummitData(data, objectId),
1167
+ toastError: true,
1168
+ toastSuccess: false,
1169
+ bodyToSnakeCase: true,
1170
+ isRemote: false
1171
+ }).then((response) => {
1172
+ toast(
1173
+ response.message,
1174
+ { type: "success" }
1175
+ );
1176
+ closePopup("geofencesAddEdit");
1177
+ showPopup("gpsTools");
1178
+ if (objectId !== void 0) {
1179
+ addCheckedGeofence(objectId);
1180
+ }
1181
+ if (fullRefresh) {
1182
+ fullRefresh();
1183
+ }
1184
+ }).catch(() => {
1185
+ });
1186
+ };
1187
+ return { onSubmit };
1188
+ }
1189
+ const RHFormProviderStyled = styled(RHFormProvider)`
1190
+ height:100%!important;
1191
+
1192
+ .${gpsToolsClasses.gpsToolsGeofencesAddEditContent} {
1193
+ display:flex;
1194
+ flex-direction:column;
1195
+ flex-grow:1;
1196
+ height:100%;
1197
+ }
1198
+
1199
+
1200
+ .${gpsToolsClasses.gpsToolsTabContent}.${gpsToolsClasses.hidden} {
1201
+ display:none;
1202
+ }
1203
+
1204
+
1205
+ ${(props) => props.theme.components?.M4LGpsToolsGeofencesAddEdit?.styleOverrides}
1206
+ `;
1207
+ function GeofenceAddEdit(props) {
1208
+ const {
1209
+ geofenceId
1210
+ } = props;
1211
+ const [finalInitalValues, omitCallEnpoint] = useGpsToolsStore((state) => {
1212
+ if (geofenceId === void 0) {
1213
+ return [initialValues, false];
1214
+ }
1215
+ const geofence = state.geofenceState.hashGeofences[geofenceId];
1216
+ if (geofence?.geometry) {
1217
+ const emulateResponse = {
1218
+ data: {
1219
+ type: geofence.type,
1220
+ name: geofence.name,
1221
+ id: geofence.id,
1222
+ active: false,
1223
+ geometry: geofence.geometry,
1224
+ properties: geofence.properties,
1225
+ countCrossingFeatures: geofence.countCrossingFeatures,
1226
+ countInternalFeatures: geofence.countInternalFeatures,
1227
+ createdAt: geofence.createdAt,
1228
+ updatedAt: geofence.updatedAt,
1229
+ timeMinInSeconds: geofence.timeMinInSeconds,
1230
+ timeMinOutSeconds: geofence.timeMinOutSeconds,
1231
+ alias: geofence.alias,
1232
+ customerId: geofence.customerId
1233
+ }
1234
+ };
1235
+ console.log("emulateResponse", emulateResponse);
1236
+ return [formatDataEnpoint(emulateResponse), true];
1237
+ } else {
1238
+ return [initialValues, false];
1239
+ }
1240
+ });
1241
+ console.log("finalInitalValues", finalInitalValues);
1242
+ const {
1243
+ formValues,
1244
+ statusLoad
1245
+ } = useFormAddEdit({
1246
+ objectId: geofenceId,
1247
+ formatDataEnpoint,
1248
+ initialValues: finalInitalValues,
1249
+ endPoint: ENDPOINT_GEOFENCE_GET,
1250
+ isRemote: false,
1251
+ omitCallEnpoint
1252
+ });
1253
+ const {
1254
+ validationSchema
1255
+ } = useValidation();
1256
+ const {
1257
+ onSubmit
1258
+ } = useSubmit({
1259
+ objectId: geofenceId
1260
+ });
1261
+ return /* @__PURE__ */ jsxs(RHFormProviderStyled, {
1262
+ statusLoad,
1263
+ onSubmit,
1264
+ values: formValues,
1265
+ validationSchema,
1266
+ className: gpsToolsClasses.gpsToolsGeofencesAddEdit,
1267
+ children: [/* @__PURE__ */ jsx(TabProvider, {
1268
+ initialValue: "general",
1269
+ children: /* @__PURE__ */ jsx(MyTabs, {})
1270
+ }), /* @__PURE__ */ jsx(MyActions, {
1271
+ ...props
1272
+ })]
1273
+ });
1274
+ }
1275
+ function useRowActionsGetter(props) {
1276
+ const {
1277
+ fullRefresh
1278
+ } = props;
1279
+ const {
1280
+ networkOperation
1281
+ } = useNetwork();
1282
+ const {
1283
+ openModal,
1284
+ closeModal
1285
+ } = useModal();
1286
+ const {
1287
+ getLabel
1288
+ } = useModuleDictionary();
1289
+ const {
1290
+ hasPrivilege
1291
+ } = useModulePrivileges();
1292
+ const {
1293
+ host_static_assets,
1294
+ environment_assets
1295
+ } = useEnvironment();
1296
+ const {
1297
+ hidePopup,
1298
+ addPopup
1299
+ } = usePopupsStore((state) => state.popupsActions, shallow);
1300
+ const {
1301
+ removeCheckedGeofence
1302
+ } = useGpsToolsStore((state) => state.geofenceActions, shallow);
1303
+ const {
1304
+ toast
1305
+ } = useHostTools();
1306
+ const isDesktop = useResponsiveDesktop();
1307
+ const [urlIconEdit] = useState(`${host_static_assets}/${environment_assets}/frontend/components/maptools/assets/icons/${GPSTOOLSICONS.EDIT}`);
1308
+ const [urlIconDelete] = useState(`${host_static_assets}/${environment_assets}/frontend/domain/microfrontends/maptools/assets/icons/${GPSTOOLSICONS.DELETE}`);
1309
+ const goEdit = (objectId) => {
1310
+ console.log("onClickAddGeofence");
1311
+ hidePopup("gpsTools");
1312
+ addPopup({
1313
+ popupId: "geofencesAddEdit",
1314
+ title: "geofencesAddEdit",
1315
+ componentProps: {
1316
+ fullRefresh,
1317
+ geofenceId: objectId
1318
+ },
1319
+ functionComponent: GeofenceAddEdit,
1320
+ defaultPosition: {
1321
+ vertical: {
1322
+ top: 50,
1323
+ bottom: 50
1324
+ },
1325
+ horizontal: {
1326
+ right: 50,
1327
+ width: 380
1328
+ }
1329
+ },
1330
+ iconUrl: ""
1331
+ });
1332
+ removeCheckedGeofence(objectId);
1333
+ };
1334
+ const onDelete = useCallback((row) => {
1335
+ openModal({
1336
+ window: /* @__PURE__ */ jsx(WindowConfirm, {
1337
+ title: getLabel(MAP_DICCTIONARY.MODAL_DELETE_GEO_TITLE),
1338
+ msg: getLabel(MAP_DICCTIONARY.MODAL_DELETE_GEO_MESSAGE),
1339
+ onClickIntro: () => onConfirmDelete(row)
1340
+ }),
1341
+ variant: "delete",
1342
+ initialWidth: 300,
1343
+ initialHeigth: 350
1344
+ });
1345
+ }, [getLabel]);
1346
+ const onConfirmDelete = useCallback((row) => {
1347
+ networkOperation({
1348
+ method: "DELETE",
1349
+ endPoint: `geofences/${row.id}`
1350
+ }).then((response) => {
1351
+ toast(response.message, {
1352
+ type: "success"
1353
+ });
1354
+ fullRefresh();
1355
+ });
1356
+ closeModal();
1357
+ }, []);
1358
+ const rowActionsGetter = useCallback((row) => {
1359
+ const conditionalItems = [];
1360
+ conditionalItems.push({
1361
+ urlIcon: urlIconEdit,
1362
+ dictionaryId: MAP_DICCTIONARY.ROW_ACTION_GEO_EDIT,
1363
+ onClick: () => {
1364
+ goEdit(row.id);
1365
+ },
1366
+ disabled: !row.authUserOptions.edit
1367
+ });
1368
+ return conditionalItems;
1369
+ }, [hasPrivilege, goEdit, onDelete, urlIconDelete, urlIconEdit, isDesktop]);
1370
+ return {
1371
+ rowActionsGetter
1372
+ };
1373
+ }
1374
+ function useCheckedGeofences() {
1375
+ const layersIds = useMapStore((state) => state.layersIds, shallow);
1376
+ const [checkedGeofences, hashGeofences] = useGpsToolsStore((state) => [state.geofenceState.checkedGeofences, state.geofenceState.hashGeofences], shallow);
1377
+ const {
1378
+ setCheckedGeofences,
1379
+ updatePartialGeofence
1380
+ } = useGpsToolsStore((state) => state.geofenceActions, shallow);
1381
+ const {
1382
+ setFeatureData,
1383
+ removeFeature,
1384
+ getFeatureIds
1385
+ } = useMapStore((state) => state.mapActions, shallow);
1386
+ const {
1387
+ networkOperation
1388
+ } = useNetwork();
1389
+ useEffect(() => {
1390
+ console.log("useCheckedGeofences, layersIds:", layersIds);
1391
+ if (!layersIds.includes(GeofencesFeaturesLayers.LAYER_GEOFENCES)) {
1392
+ return;
1393
+ }
1394
+ const mapFeatureIds = getFeatureIds(GeofencesFeaturesLayers.LAYER_GEOFENCES);
1395
+ checkedGeofences.forEach((chkRow) => {
1396
+ const geofence = hashGeofences[chkRow];
1397
+ if (!geofence) {
1398
+ return;
1399
+ }
1400
+ if (!mapFeatureIds.includes(chkRow) || !geofence.hasRenderizedGeofence) {
1401
+ if (!geofence.geometry) {
1402
+ networkOperation({
1403
+ method: "GET",
1404
+ endPoint: `geofences/${geofence.id}`,
1405
+ isRemote: false,
1406
+ responseToCamelCase: true
1407
+ }).then((response) => {
1408
+ console.log("onCheckedRowsChange response:", response.data);
1409
+ const geoLoaded = {
1410
+ geometry: response.data.geometry,
1411
+ name: response.data.name,
1412
+ properties: response.data.properties,
1413
+ countCrossingFeatures: response.data.countCrossingFeatures,
1414
+ hasRenderizedGeofence: false
1415
+ };
1416
+ if (geoLoaded.geometry) {
1417
+ if (checkedGeofences.has(geofence.id)) {
1418
+ setFeatureData("geofences", chkRow, geoLoaded.geometry, geoLoaded.properties, {
1419
+ label: geoLoaded.name,
1420
+ labelColor: geoLoaded.properties?.color
1421
+ });
1422
+ geoLoaded.hasRenderizedGeofence = true;
1423
+ }
1424
+ }
1425
+ updatePartialGeofence(geofence.id, geoLoaded);
1426
+ });
1427
+ } else {
1428
+ setFeatureData(GeofencesFeaturesLayers.LAYER_GEOFENCES, chkRow, geofence.geometry, geofence.properties, {
1429
+ label: geofence.name
1430
+ });
1431
+ updatePartialGeofence(geofence.id, {
1432
+ hasRenderizedGeofence: true
1433
+ });
1434
+ }
1435
+ }
1436
+ });
1437
+ mapFeatureIds.forEach((mapFeatureId) => {
1438
+ if (!checkedGeofences.has(Number(mapFeatureId))) {
1439
+ removeFeature(GeofencesFeaturesLayers.LAYER_GEOFENCES, mapFeatureId);
1440
+ }
1441
+ });
1442
+ return () => {
1443
+ };
1444
+ }, [checkedGeofences, layersIds]);
1445
+ return {
1446
+ checkedGeofences,
1447
+ setCheckedGeofences
1448
+ };
1449
+ }
1450
+ function useCheckedFeatures(layerId, featuresType, endpoint) {
1451
+ const layersIds = useMapStore((state) => state.layersIds, shallow);
1452
+ const [checkedFeatures, setCheckedFeatures, hashGeofences] = useGpsToolsStore((state) => {
1453
+ return featuresType === "CrossingFeatures" ? [state.geofenceState.checkedCrossingFeatures, state.geofenceActions.setCheckedCrossingFeatures, state.geofenceState.hashGeofences] : [state.geofenceState.checkedInternalFeatures, state.geofenceActions.setCheckedInternalFeatures, state.geofenceState.hashGeofences];
1454
+ }, shallow);
1455
+ const {
1456
+ setFeatureData,
1457
+ removeFeature,
1458
+ getFeatureIds
1459
+ } = useMapStore((state) => state.mapActions, shallow);
1460
+ const {
1461
+ networkOperation
1462
+ } = useNetwork();
1463
+ useEffect(() => {
1464
+ if (!layersIds.includes(layerId)) {
1465
+ return;
1466
+ }
1467
+ const mapFeatureIds = getFeatureIds(layerId);
1468
+ checkedFeatures.forEach((chkRow) => {
1469
+ const geofence = hashGeofences[chkRow];
1470
+ if (!geofence) {
1471
+ return;
1472
+ }
1473
+ if (!mapFeatureIds.find((fId) => fId.toString().includes(`geo_${geofence.id}_fid`)) || !geofence[`hasRenderized${featuresType}`]) {
1474
+ const currentGeofenceLoadedFeatures = geofence[`loaded${featuresType}`];
1475
+ if (!currentGeofenceLoadedFeatures) {
1476
+ networkOperation({
1477
+ method: "GET",
1478
+ endPoint: `geofences/${geofence.id}/${endpoint}`,
1479
+ isRemote: false,
1480
+ responseToCamelCase: true
1481
+ }).then((response) => {
1482
+ console.log("onCheckedGeometriesChange response:", response.data);
1483
+ geofence[`loaded${featuresType}`] = response.data;
1484
+ const newGeofenceLoadedFeatures = geofence[`loaded${featuresType}`];
1485
+ if (newGeofenceLoadedFeatures && Array.isArray(geofence[`loaded${featuresType}`])) {
1486
+ if (checkedFeatures.has(geofence.id)) {
1487
+ newGeofenceLoadedFeatures.forEach((feature) => {
1488
+ setFeatureData(layerId, `geo_${geofence.id}_fid_${feature.id}`, feature.geometry, feature.properties);
1489
+ });
1490
+ geofence[`hasRenderized${featuresType}`] = true;
1491
+ }
1492
+ }
1493
+ }).catch(() => {
1494
+ });
1495
+ } else {
1496
+ currentGeofenceLoadedFeatures.forEach((feature) => {
1497
+ setFeatureData(layerId, `geo_${geofence.id}_fid_${feature.id}`, feature.geometry, feature.properties);
1498
+ });
1499
+ geofence[`hasRenderized${featuresType}`] = true;
1500
+ }
1501
+ }
1502
+ });
1503
+ mapFeatureIds.forEach((mapFeatureId) => {
1504
+ const featureId = Number(mapFeatureId.toString().split("_")[1]);
1505
+ if (!checkedFeatures.has(featureId)) {
1506
+ removeFeature(layerId, mapFeatureId);
1507
+ }
1508
+ });
1509
+ return () => {
1510
+ };
1511
+ }, [checkedFeatures, layersIds]);
1512
+ return [checkedFeatures, setCheckedFeatures];
1513
+ }
1514
+ function useMaster() {
1515
+ const {
1516
+ hidePopup,
1517
+ addPopup
1518
+ } = usePopupsStore((state) => state.popupsActions, shallow);
1519
+ const onClickAddGeofence = () => {
1520
+ console.log("onClickAddGeofence");
1521
+ hidePopup("gpsTools");
1522
+ addPopup({
1523
+ popupId: "geofencesAddEdit",
1524
+ title: "geofencesAddEdit",
1525
+ functionComponent: () => /* @__PURE__ */ jsx(GeofenceAddEdit, {}),
1526
+ defaultPosition: {
1527
+ vertical: {
1528
+ top: 50,
1529
+ bottom: 50
1530
+ },
1531
+ horizontal: {
1532
+ right: 50,
1533
+ width: 380
1534
+ }
1535
+ },
1536
+ iconUrl: ""
1537
+ });
1538
+ };
1539
+ const [checkedGeofences, hashGeofences, initialRows] = useGpsToolsStore((state) => [state.geofenceState.checkedGeofences, state.geofenceState.hashGeofences, state.geofenceState.rows], shallow);
1540
+ const {
1541
+ setCheckedGeofences,
1542
+ addGeofence,
1543
+ updatePartialGeofence,
1544
+ updateRows
1545
+ } = useGpsToolsStore((state) => state.geofenceActions, shallow);
1546
+ useCheckedGeofences();
1547
+ const [checkedCrossingFeatures, setCheckedCrossingFeatures] = useCheckedFeatures(GeofencesFeaturesLayers.LAYER_GEOFENCES_TRANSIT_FEATURES, "CrossingFeatures", "crossing_features");
1548
+ const [checkedInternalFeatures, setCheckedInternalFeatures] = useCheckedFeatures(GeofencesFeaturesLayers.LAYER_GEOFENCES_INTERNAL_FEATURES, "InternalFeatures", "internal_features");
1549
+ const rowKeyGetter = useCallback((row) => row.id, []);
1550
+ const [selectedRows, setSelectedRows] = useState(/* @__PURE__ */ new Set());
1551
+ const [backendQueryParams, setBackendQueryParams] = useState({});
1552
+ const {
1553
+ columns
1554
+ } = useColumns();
1555
+ const {
1556
+ pagerState,
1557
+ rows,
1558
+ onPageChange,
1559
+ onRowsPerPageChange,
1560
+ Refresh,
1561
+ setRows
1562
+ } = usePaginate({
1563
+ endPoint: "geofences",
1564
+ fireOnChangeParms: false,
1565
+ fireOnFirstLoad: false,
1566
+ queryParams: backendQueryParams,
1567
+ isRemote: false,
1568
+ responseToCamelCase: true,
1569
+ initialRows
1570
+ });
1571
+ const onSelectedRowsChange = (newRowsSelectSet) => {
1572
+ setSelectedRows(newRowsSelectSet);
1573
+ };
1574
+ const fullRefresh = useCallback((_id) => {
1575
+ Refresh();
1576
+ }, []);
1577
+ useEffect(() => {
1578
+ const newCheckedGeofences = new Set(checkedGeofences);
1579
+ const newCheckedCrossingFeatures = new Set(checkedCrossingFeatures);
1580
+ const newCheckedInternalFeatures = new Set(checkedInternalFeatures);
1581
+ let updatedCheckedGeofences = false;
1582
+ let updatedCheckedCrossingFeatures = false;
1583
+ let updatedCheckedInternalFeatures = false;
1584
+ newCheckedGeofences.forEach((chkRow) => {
1585
+ if (rows.findIndex((row) => row.id === chkRow) === -1) {
1586
+ newCheckedGeofences.delete(chkRow);
1587
+ }
1588
+ });
1589
+ newCheckedCrossingFeatures.forEach((chkTF) => {
1590
+ if (rows.findIndex((row) => row.id === chkTF) === -1) {
1591
+ newCheckedCrossingFeatures.delete(chkTF);
1592
+ }
1593
+ });
1594
+ newCheckedInternalFeatures.forEach((chkIF) => {
1595
+ if (rows.findIndex((row) => row.id === chkIF) === -1) {
1596
+ newCheckedInternalFeatures.delete(chkIF);
1597
+ }
1598
+ });
1599
+ rows.forEach((row) => {
1600
+ let hasGeo = hashGeofences[row.id];
1601
+ if (!hasGeo) {
1602
+ hasGeo = {
1603
+ ...row,
1604
+ hasRenderizedGeofence: false,
1605
+ loadedCrossingFeatures: null,
1606
+ loadedInternalFeatures: null,
1607
+ hasRenderizedCrossingFeatures: false,
1608
+ hasRenderizedInternalFeatures: false,
1609
+ createdAt: row.createdAt
1610
+ };
1611
+ addGeofence(row.id, hasGeo);
1612
+ return;
1613
+ }
1614
+ if (row.updatedAt && row.updatedAt !== hasGeo.updatedAt) {
1615
+ updatePartialGeofence(row.id, {
1616
+ updatedAt: row.updatedAt,
1617
+ geometry: null,
1618
+ hasRenderizedGeofence: false,
1619
+ hasRenderizedCrossingFeatures: false,
1620
+ hasRenderizedInternalFeatures: false,
1621
+ loadedCrossingFeatures: null,
1622
+ loadedInternalFeatures: null
1623
+ });
1624
+ updatedCheckedGeofences = true;
1625
+ updatedCheckedCrossingFeatures = true;
1626
+ updatedCheckedInternalFeatures = true;
1627
+ }
1628
+ });
1629
+ if (newCheckedGeofences.size !== checkedGeofences.size || updatedCheckedGeofences) {
1630
+ setCheckedGeofences(newCheckedGeofences);
1631
+ }
1632
+ if (newCheckedCrossingFeatures.size !== checkedCrossingFeatures.size || updatedCheckedCrossingFeatures) {
1633
+ setCheckedCrossingFeatures(newCheckedCrossingFeatures);
1634
+ }
1635
+ if (newCheckedInternalFeatures.size !== checkedInternalFeatures.size || updatedCheckedInternalFeatures) {
1636
+ setCheckedInternalFeatures(newCheckedInternalFeatures);
1637
+ }
1638
+ onSelectedRowsChange(selectedRows);
1639
+ updateRows(rows);
1640
+ }, [rows]);
1641
+ const {
1642
+ rowActionsGetter
1643
+ } = useRowActionsGetter({
1644
+ fullRefresh
1645
+ });
1646
+ return {
1647
+ rowKeyGetter,
1648
+ columns,
1649
+ refresh: Refresh,
1650
+ setBackendQueryParams,
1651
+ pagerState,
1652
+ rows,
1653
+ onPageChange,
1654
+ onRowsPerPageChange,
1655
+ rowActionsGetter,
1656
+ selectedRows,
1657
+ onSelectedRowsChange,
1658
+ checkedRows: checkedGeofences,
1659
+ onCheckedRowsChange: setCheckedGeofences,
1660
+ setRows,
1661
+ goToAddEdit: onClickAddGeofence
1662
+ };
1663
+ }
1664
+ const StackGeofenceListRoot = styled(Stack)`
1665
+ padding:12px;
1666
+ position: relative!important;
1667
+ flex-grow:1;
1668
+ width:100%;
1669
+
1670
+ .M4LDataGrid-root{
1671
+ height:unset!important;
1672
+ flex-grow:1;
1673
+ }
1674
+
1675
+ ${(props) => props.theme.components?.M4LGpsToolsGeofencesList?.styleOverrides}
1676
+ `;
1677
+ function GeofencesList() {
1678
+ const {
1679
+ refresh,
1680
+ setBackendQueryParams,
1681
+ columns,
1682
+ rows,
1683
+ rowActionsGetter,
1684
+ selectedRows,
1685
+ onSelectedRowsChange,
1686
+ pagerState,
1687
+ onPageChange,
1688
+ onRowsPerPageChange,
1689
+ checkedRows,
1690
+ onCheckedRowsChange,
1691
+ setRows,
1692
+ rowKeyGetter,
1693
+ goToAddEdit
1694
+ } = useMaster();
1695
+ return /* @__PURE__ */ jsxs(StackGeofenceListRoot, {
1696
+ direction: "column",
1697
+ gap: "8px",
1698
+ className: gpsToolsClasses.gpsToolsGeofencesList,
1699
+ children: [/* @__PURE__ */ jsx(Filter, {
1700
+ refresh,
1701
+ setBackendQueryParams
1702
+ }), /* @__PURE__ */ jsx(DataGrid, {
1703
+ id: "geofences",
1704
+ columns,
1705
+ rows,
1706
+ onRowsChange: setRows,
1707
+ checkedRows,
1708
+ onCheckedRowsChange,
1709
+ rowActionsGetter,
1710
+ rowKeyGetter,
1711
+ selectedRows,
1712
+ onSelectedRowsChange,
1713
+ withActions: true,
1714
+ actionsProps: {
1715
+ withPager: true,
1716
+ withLocalFilters: true,
1717
+ pagerOptions: {
1718
+ records: rows.length,
1719
+ totalRecords: pagerState.totalRecords,
1720
+ rowsPerPageOptions: [1, 2, 3, 4, 5, 10, 25],
1721
+ page: pagerState.page,
1722
+ rowsPerPage: pagerState.rowsPerPage,
1723
+ onPageChange,
1724
+ onRowsPerPageChange
1725
+ }
1726
+ }
1727
+ }, "list"), /* @__PURE__ */ jsx(Actions, {
1728
+ children: /* @__PURE__ */ jsx(Button, {
1729
+ onClick: () => goToAddEdit(),
1730
+ children: "Agregar geocerca"
1731
+ })
1732
+ })]
1733
+ });
1734
+ }
1735
+ function TabsGpsTools() {
1736
+ const {
1737
+ getLabel
1738
+ } = useModuleDictionary();
1739
+ const status = useGpsToolsStore((state) => state.ownerState.status, shallow);
1740
+ const currentTabTool = useGpsToolsStore((state) => state.currentTabGpsTool, shallow);
1741
+ const {
1742
+ setCurrentTabTool
1743
+ } = useGpsToolsStore((state) => state.gpsToolsActions, shallow);
1744
+ const toolTabs = useMemo(() => {
1745
+ return [{
1746
+ id: "geofences",
1747
+ icon: void 0,
1748
+ component: /* @__PURE__ */ jsx(GeofencesList, {}),
1749
+ label: getLabel(MAP_DICCTIONARY.LABEL_TAB_GEO),
1750
+ className: gpsToolsClasses.gpsToolsGeofencesList
1751
+ }];
1752
+ }, [getLabel]);
1753
+ useLayers();
1754
+ if (status !== "ready") {
1755
+ return null;
1756
+ }
1757
+ return /* @__PURE__ */ jsxs(DivGpsToolsRoot, {
1758
+ className: gpsToolsClasses.gpsToolsRoot,
1759
+ children: [/* @__PURE__ */ jsx(Tabs, {
1760
+ value: currentTabTool,
1761
+ scrollButtons: "auto",
1762
+ variant: "scrollable",
1763
+ allowScrollButtonsMobile: true,
1764
+ onChange: (_e, value) => setCurrentTabTool(value),
1765
+ children: toolTabs.map((tab) => /* @__PURE__ */ jsx(Tab, {
1766
+ value: tab.id,
1767
+ icon: tab.icon,
1768
+ label: tab.label,
1769
+ className: clsx(gpsToolsClasses.gpsToolsTab, tab.className),
1770
+ SKTWidth: "100px",
1771
+ SKTHeight: "14px"
1772
+ }, tab.id))
1773
+ }), toolTabs.map((tab) => {
1774
+ const isMatched = tab.id === currentTabTool;
1775
+ return /* @__PURE__ */ jsx(TabContent, {
1776
+ className: clsx(gpsToolsClasses.gpsToolsTabContent, tab.className, isMatched ? gpsToolsClasses.visible : gpsToolsClasses.hidden),
1777
+ children: tab.component
1778
+ }, tab.id);
1779
+ })]
1780
+ });
1781
+ }
1782
+ function GpsTools() {
1783
+ const isSkeleton = useModuleSkeleton();
1784
+ return /* @__PURE__ */ jsx(Fragment, {
1785
+ children: !isSkeleton && /* @__PURE__ */ jsx(TabsGpsTools, {})
1786
+ });
1787
+ }
1788
+ export {
1789
+ GpsTools as G,
1790
+ GpsToolsProvider as a,
1791
+ useGpsToolsStore as u
1792
+ };