@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,1338 @@
1
+ import "leaflet/dist/leaflet.css";
2
+ import { MapContainer, useMap, LayerGroup, TileLayer, Marker, Polyline, Polygon, Circle } from "react-leaflet";
3
+ import { styled } from "@mui/material/styles";
4
+ import { shallow } from "zustand/shallow";
5
+ import React__default, { useRef, useEffect, createContext, useContext, useCallback, useMemo } from "react";
6
+ import L__default from "leaflet";
7
+ import { createPathComponent } from "@react-leaflet/core";
8
+ import "leaflet.markercluster";
9
+ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
10
+ import { cloneDeep, throttle } from "lodash";
11
+ import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
12
+ import { e as ColumnSetCheckFormatter, c as DataGrid } from "../../../DataGrid/index.e127cac8.js";
13
+ import { u as useStateRef } from "../../../../hooks/useStateRef/index.538edb89.js";
14
+ import { u as usePopupsStore, P as PopupsProvider } from "../../../PopupsProvider/index.ae1bd010.js";
15
+ import { T as ToggleButton } from "../../../mui_extended/ToggleButton/index.b053aa70.js";
16
+ import { createStore, useStore } from "zustand";
17
+ import { useResponsiveDesktop, useFirstRender } from "@m4l/graphics";
18
+ import { devtools } from "zustand/middleware";
19
+ import { immer } from "zustand/middleware/immer";
20
+ import { generateUtilityClasses } from "@mui/material";
21
+ import { unstable_composeClasses } from "@mui/base";
22
+ import { g as getComponentUtilityClass } from "../../../../utils/index.9ad3909a.js";
23
+ import "leaflet-polylinedecorator";
24
+ const COMPONENT_CLASS_NAME = "M4LMap";
25
+ const MAP_ZINDEX_DEFAULT = 0;
26
+ const MAP_ZINDEX_OVER_MAP = 1100;
27
+ const TIME_DOUBLE_CLICK = 250;
28
+ const mapClasses = generateUtilityClasses(COMPONENT_CLASS_NAME, [
29
+ "root",
30
+ "mapContainer",
31
+ "svgLayersContainer",
32
+ "svgLayer",
33
+ "svgLayerMultiPoints",
34
+ "layerMarker",
35
+ "mainToolsRoot",
36
+ "measureMarkerRoot",
37
+ "measureMarkerContainer",
38
+ "measureMarkerContainerRhomb",
39
+ "measureMarkerContainerSlot",
40
+ "measureMarkerContainerSlotNumber",
41
+ "measureLabelMarkerRoot",
42
+ "measureLabelMarkerContainer",
43
+ "measureLabelMarkerDistance",
44
+ "measureLabelMarkerRemove"
45
+ ]);
46
+ const useMapUtilityClasses = (_ownerState) => {
47
+ const slots = {
48
+ root: ["root"],
49
+ mapContainer: ["mapContainer"],
50
+ svgLayersContainer: ["svgLayersContainer"],
51
+ svgLayer: ["svgLayer"],
52
+ svgLayerMultiPoints: ["svgLayerMultiPoints"],
53
+ layerMarker: ["layerMarker"],
54
+ mainToolsRoot: ["mainToolsRoot"],
55
+ measureMarkerRoot: ["measureMarkerRoot"],
56
+ measureMarkerContainer: ["measureMarkerContainer"],
57
+ measureMarkerContainerRhomb: ["measureMarkerContainerRhomb"],
58
+ measureMarkerContainerSlot: ["measureMarkerContainerSlot"],
59
+ measureMarkerContainerSlotNumber: ["measureMarkerContainerSlotNumber"],
60
+ measureLabelMarkerRoot: ["measureLabelMarkerRoot"],
61
+ measureLabelMarkerContainer: ["measureLabelMarkerContainer"],
62
+ measureLabelMarkerDistance: ["measureLabelMarkerDistance"],
63
+ measureLabelMarkerRemove: ["measureLabelMarkerRemove"]
64
+ };
65
+ return unstable_composeClasses(slots, getComponentUtilityClass(COMPONENT_CLASS_NAME), {});
66
+ };
67
+ const MapRootContainer = styled(MapContainer)`
68
+ width: 100%;
69
+ height: 100%;
70
+ flex-grow: 1;
71
+ overflow: auto;
72
+ position: relative;
73
+
74
+ .leaflet-control-scale-line{
75
+ color: red; //Ejemplo de como estilar el control de scala
76
+ }
77
+ .${mapClasses.mainToolsRoot} {
78
+ display: flex;
79
+ top: 20px;
80
+ left: 80px;
81
+ position: absolute;
82
+ background-color: gray;
83
+ z-index: ${MAP_ZINDEX_OVER_MAP};
84
+ }
85
+ .${mapClasses.svgLayersContainer} {
86
+ width: 100%;
87
+ height: 100%;
88
+ position: absolute;
89
+ }
90
+
91
+ .${mapClasses.svgLayer} {
92
+ z-index: 1;
93
+ width: 100%;
94
+ height: 100%;
95
+ overflow: hidden;
96
+ user-select: none;
97
+ pointer-events: none;
98
+ position: absolute !important;
99
+ }
100
+
101
+ .${mapClasses.layerMarker} {
102
+ z-index: 2;
103
+ }
104
+
105
+
106
+
107
+ .${mapClasses.measureMarkerRoot} {
108
+ --color: red;
109
+ }
110
+
111
+ .${mapClasses.measureMarkerContainer} {
112
+ position: relative;
113
+ cursor: pointer;
114
+ }
115
+
116
+ .${mapClasses.measureMarkerContainerRhomb} {
117
+ position: absolute;
118
+ filter: drop-shadow(0px 0px 3px rgba(0,0,0,.4));
119
+ width: 31px;
120
+ height: 31px;
121
+ border-radius: 50% 50% 50% 0;
122
+ border: 4px solid var(--color);
123
+ background-color: var(--color);
124
+ transform: rotate(-45deg);
125
+
126
+ }
127
+ .${mapClasses.measureMarkerContainerSlot} {
128
+ position: absolute;
129
+ background: #fff;
130
+ border-radius: 50%;
131
+ overflow: hidden;
132
+ top: 3px;
133
+ left: 3px;
134
+ width: 25px;
135
+ height: 24px;
136
+
137
+ },
138
+
139
+ .${mapClasses.measureMarkerContainerSlotNumber} {
140
+ font-size: 14px;
141
+ font-weight: 600;
142
+ text-align: center;
143
+ margin-top: 1px;
144
+ color: black;
145
+ }
146
+
147
+ .${mapClasses.measureLabelMarkerContainer} {
148
+ background-color:white;
149
+ border:1px solid gray;
150
+ color:#fff;
151
+ width:80px;
152
+ margin-left:15px;
153
+ margin-top:15px;
154
+ }
155
+ .${mapClasses.measureLabelMarkerDistance} {
156
+ color:gray;
157
+ }
158
+ .${mapClasses.measureLabelMarkerRemove} {
159
+ color:blue;
160
+ }
161
+
162
+ .leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
163
+ -webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
164
+ -moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
165
+ -o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
166
+ transition: transform 0.3s ease-out, opacity 0.3s ease-in;
167
+ }
168
+
169
+ .leaflet-cluster-spider-leg {
170
+ /* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */
171
+ -webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;
172
+ -moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in;
173
+ -o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in;
174
+ transition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;
175
+ }
176
+
177
+ .marker-cluster-small {
178
+ background-color: rgba(181, 226, 140, 0.6);
179
+ }
180
+ .marker-cluster-small div {
181
+ background-color: rgba(110, 204, 57, 0.6);
182
+ }
183
+
184
+ .marker-cluster-medium {
185
+ background-color: rgba(241, 211, 87, 0.6);
186
+ }
187
+ .marker-cluster-medium div {
188
+ background-color: rgba(240, 194, 12, 0.6);
189
+ }
190
+
191
+ .marker-cluster-large {
192
+ background-color: rgba(253, 156, 115, 0.6);
193
+ }
194
+ .marker-cluster-large div {
195
+ background-color: rgba(241, 128, 23, 0.6);
196
+ }
197
+
198
+ /* IE 6-8 fallback colors */
199
+ .leaflet-oldie .marker-cluster-small {
200
+ background-color: rgb(181, 226, 140);
201
+ }
202
+ .leaflet-oldie .marker-cluster-small div {
203
+ background-color: rgb(110, 204, 57);
204
+ }
205
+
206
+ .leaflet-oldie .marker-cluster-medium {
207
+ background-color: rgb(241, 211, 87);
208
+ }
209
+ .leaflet-oldie .marker-cluster-medium div {
210
+ background-color: rgb(240, 194, 12);
211
+ }
212
+
213
+ .leaflet-oldie .marker-cluster-large {
214
+ background-color: rgb(253, 156, 115);
215
+ }
216
+ .leaflet-oldie .marker-cluster-large div {
217
+ background-color: rgb(241, 128, 23);
218
+ }
219
+
220
+ .marker-cluster {
221
+ background-clip: padding-box;
222
+ border-radius: 20px;
223
+ }
224
+ .marker-cluster div {
225
+ width: 30px;
226
+ height: 30px;
227
+ margin-left: 5px;
228
+ margin-top: 5px;
229
+
230
+ text-align: center;
231
+ border-radius: 15px;
232
+ font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
233
+ }
234
+ .marker-cluster span {
235
+ line-height: 30px;
236
+ }
237
+ `;
238
+ const MarkerClusterGroup = createPathComponent(({
239
+ children: _c,
240
+ ...props
241
+ }, ctx) => {
242
+ const clusterProps = {};
243
+ const clusterEvents = {};
244
+ console.log("MarkerClusterGroup props", props, ctx);
245
+ Object.entries(props).forEach(([propName, prop]) => {
246
+ if (propName !== void 0 && prop !== "") {
247
+ propName.startsWith("on") ? clusterEvents[propName] = prop : clusterProps[propName] = prop;
248
+ }
249
+ });
250
+ const markerClusterGroup = new L__default.MarkerClusterGroup(clusterProps);
251
+ Object.entries(clusterEvents).forEach(([eventAsProp, callback]) => {
252
+ console.log("eventAsProp", eventAsProp);
253
+ const clusterEvent = `cluster${eventAsProp.substring(2).toLowerCase()}`;
254
+ markerClusterGroup.on(clusterEvent, callback);
255
+ });
256
+ return {
257
+ instance: markerClusterGroup,
258
+ context: {
259
+ ...ctx,
260
+ layerContainer: markerClusterGroup
261
+ }
262
+ };
263
+ });
264
+ const RenderByEachFeatureComponent = ({
265
+ renderFeature,
266
+ ...props
267
+ }) => {
268
+ const feature = renderFeature(props);
269
+ return feature ? /* @__PURE__ */ jsx(Fragment, {
270
+ children: feature
271
+ }) : null;
272
+ };
273
+ const MemonizedRenderByEachFeatureComponent = React__default.memo(RenderByEachFeatureComponent);
274
+ const MyLayer = (props) => {
275
+ const {
276
+ layerId
277
+ } = props;
278
+ const map = useMap();
279
+ const popupRef = useRef(null);
280
+ const lefaletLayerRef = useRef({
281
+ clickTimeout: null,
282
+ clickCount: 0,
283
+ handleClickSetted: false
284
+ });
285
+ const featureIdOrCollection = useMapStore((state) => {
286
+ const geoJsonObject = state.hashLayers[layerId]?.geoJsonObject;
287
+ if (geoJsonObject && geoJsonObject.object.type === "Feature") {
288
+ return geoJsonObject.object.id;
289
+ } else if (geoJsonObject && geoJsonObject.object.type === "FeatureCollection") {
290
+ return geoJsonObject && geoJsonObject.object.features.map((feature) => feature.id);
291
+ }
292
+ }, shallow);
293
+ const renderFeature = useMapStore((state) => state.hashLayers[layerId]?.renderFeature, shallow);
294
+ const [visible, cluster = false] = useMapStore((state) => [state.hashLayers[layerId]?.visible, state.hashLayers[layerId]?.cluster], shallow);
295
+ const markerClusterGroupRef = useRef(null);
296
+ const handleClick = (a) => {
297
+ lefaletLayerRef.current.clickCount++;
298
+ if (lefaletLayerRef.current.clickCount === 1) {
299
+ lefaletLayerRef.current.clickTimeout = setTimeout(() => {
300
+ console.log("cluster clicked", a, popupRef.current);
301
+ const cluster2 = a.propagatedFrom;
302
+ if (cluster2 && cluster2 instanceof L__default.MarkerCluster) {
303
+ const childMarkers = cluster2.getAllChildMarkers();
304
+ console.log("Markers in this cluster: ", childMarkers);
305
+ }
306
+ if (!popupRef.current) {
307
+ popupRef.current = L__default.popup().setLatLng(a.sourceTarget._cLatLng).setContent("Hello, World!");
308
+ map.addLayer(popupRef.current);
309
+ } else {
310
+ popupRef.current.openOn(map);
311
+ }
312
+ lefaletLayerRef.current.clickCount = 0;
313
+ }, TIME_DOUBLE_CLICK);
314
+ } else if (lefaletLayerRef.current.clickCount === 2) {
315
+ clearTimeout(lefaletLayerRef.current.clickTimeout);
316
+ console.log("Double click");
317
+ lefaletLayerRef.current.clickCount = 0;
318
+ }
319
+ };
320
+ useEffect(() => {
321
+ if (markerClusterGroupRef.current) {
322
+ markerClusterGroupRef.current.on("clusterclick", handleClick);
323
+ console.log("markerClusterGroupRef.current", markerClusterGroupRef.current);
324
+ }
325
+ }, [markerClusterGroupRef.current]);
326
+ if (!featureIdOrCollection || !renderFeature) {
327
+ return null;
328
+ }
329
+ if (visible === false) {
330
+ return null;
331
+ }
332
+ const isFeaturCollection = Array.isArray(featureIdOrCollection);
333
+ if (!isFeaturCollection) {
334
+ return /* @__PURE__ */ jsx(RenderByEachFeatureComponent, {
335
+ renderFeature,
336
+ id: featureIdOrCollection,
337
+ layerId
338
+ });
339
+ } else {
340
+ const createClusterCustomIcon = (cluster2) => {
341
+ var childCount = cluster2.getChildCount();
342
+ var c = " marker-cluster-";
343
+ if (childCount < 10) {
344
+ c += "small";
345
+ } else if (childCount < 100) {
346
+ c += "medium";
347
+ } else {
348
+ c += "large";
349
+ }
350
+ const DivIcon2 = new L__default.DivIcon({
351
+ html: "<div><span>" + childCount + "</span></div>",
352
+ className: "marker-cluster" + c,
353
+ iconSize: new L__default.Point(40, 40)
354
+ });
355
+ return DivIcon2;
356
+ };
357
+ if (!cluster) {
358
+ return /* @__PURE__ */ jsx(LayerGroup, {
359
+ children: featureIdOrCollection.map((featureId) => {
360
+ return /* @__PURE__ */ jsx(RenderByEachFeatureComponent, {
361
+ renderFeature,
362
+ id: featureId,
363
+ layerId
364
+ }, `k_${featureId}`);
365
+ })
366
+ });
367
+ } else {
368
+ console.log("cluster", cluster, featureIdOrCollection);
369
+ return /* @__PURE__ */ jsx(
370
+ MarkerClusterGroup,
371
+ {
372
+ showCoverageOnHover: false,
373
+ zoomToBoundsOnClick: false,
374
+ spiderfyOnMaxZoom: false,
375
+ iconCreateFunction: createClusterCustomIcon,
376
+ eventHandlers: {
377
+ click: (e) => {
378
+ console.log("click", e);
379
+ }
380
+ },
381
+ children: featureIdOrCollection.map((featureId) => {
382
+ console.log("featureId", featureId);
383
+ return /* @__PURE__ */ jsx(MemonizedRenderByEachFeatureComponent, {
384
+ renderFeature,
385
+ id: featureId,
386
+ layerId
387
+ }, `k_${featureId}`);
388
+ })
389
+ }
390
+ );
391
+ }
392
+ }
393
+ };
394
+ const updateOwnerStateClasses = (state) => {
395
+ state.classes = useMapUtilityClasses(state.ownerState);
396
+ };
397
+ const createMapStore = (initProps) => {
398
+ const startProps = {
399
+ classes: useMapUtilityClasses(initProps.ownerState),
400
+ visibleCheckedLayers: /* @__PURE__ */ new Set(),
401
+ autoFocusCheckedLayers: /* @__PURE__ */ new Set(),
402
+ clusterCheckedLayers: /* @__PURE__ */ new Set(),
403
+ layersIds: [],
404
+ hashLayers: {},
405
+ ...initProps
406
+ };
407
+ return createStore(
408
+ devtools(
409
+ immer((set, get) => ({
410
+ ...startProps,
411
+ mapActions: {
412
+ init: (layersStore) => {
413
+ set((state) => {
414
+ for (let index = 0; index < layersStore.length; index++) {
415
+ state.hashLayers[layersStore[index].layerId] = cloneDeep(
416
+ layersStore[index]
417
+ );
418
+ state.layersIds.push(layersStore[index].layerId);
419
+ if (layersStore[index].visible !== false) {
420
+ state.visibleCheckedLayers.add(layersStore[index].layerId);
421
+ }
422
+ if (state.hashLayers[layersStore[index].layerId].autoFocus !== false) {
423
+ state.autoFocusCheckedLayers.add(layersStore[index].layerId);
424
+ }
425
+ if (state.hashLayers[layersStore[index].layerId].cluster !== false) {
426
+ state.clusterCheckedLayers.add(layersStore[index].layerId);
427
+ }
428
+ }
429
+ });
430
+ },
431
+ setMapState: (status) => {
432
+ set((state) => {
433
+ state.ownerState.status = status;
434
+ });
435
+ },
436
+ setDataLayer: (layerId, geoJson) => {
437
+ if (!get().hashLayers[layerId]) {
438
+ throw new Error(`Layer with id ${layerId} not found`);
439
+ }
440
+ set((state) => {
441
+ const layer = state.hashLayers[layerId];
442
+ layer.geoJsonObject = geoJson;
443
+ });
444
+ },
445
+ getFeatureIds: (layerId) => {
446
+ if (!get().hashLayers[layerId]) {
447
+ throw new Error(`Layer with id ${layerId} not found`);
448
+ }
449
+ const geoJsonObject = get().hashLayers[layerId]?.geoJsonObject;
450
+ if (geoJsonObject && geoJsonObject.object.type === "Feature") {
451
+ return [geoJsonObject.object.id];
452
+ } else if (geoJsonObject && geoJsonObject.object.type === "FeatureCollection") {
453
+ return geoJsonObject.object.features.map((feature) => feature.id);
454
+ }
455
+ return [];
456
+ },
457
+ setFeatureData: (layerId, featureId, geometry, properties) => {
458
+ if (!get().hashLayers[layerId]) {
459
+ throw new Error(`Layer with id ${layerId} not found`);
460
+ }
461
+ set((state) => {
462
+ if (state.hashLayers[layerId].geoJsonObject?.object.type === "FeatureCollection") {
463
+ const layer = state.hashLayers[layerId].geoJsonObject?.object;
464
+ let feature = layer.features.find((f) => f.id === featureId);
465
+ if (feature) {
466
+ feature.geometry = cloneDeep(geometry);
467
+ feature.properties = cloneDeep(properties);
468
+ } else {
469
+ feature = {
470
+ type: "Feature",
471
+ geometry,
472
+ id: featureId,
473
+ properties
474
+ };
475
+ layer.features.push(feature);
476
+ }
477
+ } else if (state.hashLayers[layerId].geoJsonObject?.object.type === "Feature") {
478
+ const feature = state.hashLayers[layerId].geoJsonObject?.object;
479
+ feature.id = featureId;
480
+ feature.geometry = cloneDeep(geometry);
481
+ feature.properties = cloneDeep(properties);
482
+ }
483
+ });
484
+ },
485
+ removeFeature: (layerId, featureId) => {
486
+ if (!get().hashLayers[layerId]) {
487
+ throw new Error(`Layer with id ${layerId} not found`);
488
+ }
489
+ set((state) => {
490
+ if (state.hashLayers[layerId].geoJsonObject?.object.type === "FeatureCollection") {
491
+ const layer = state.hashLayers[layerId].geoJsonObject?.object;
492
+ const index = layer.features.findIndex((f) => f.id === featureId);
493
+ if (index !== -1) {
494
+ layer.features.splice(index, 1);
495
+ }
496
+ } else if (state.hashLayers[layerId].geoJsonObject?.object.type === "Feature") {
497
+ const feature = state.hashLayers[layerId].geoJsonObject?.object;
498
+ feature.geometry = { type: "Point", coordinates: [0, 0] };
499
+ feature.properties = {};
500
+ }
501
+ });
502
+ },
503
+ setLayerRenderProp: (layerId, renderProp) => {
504
+ set((state) => {
505
+ state.hashLayers[layerId].renderFeature = renderProp;
506
+ });
507
+ },
508
+ addLayer: (layer) => {
509
+ if (get().hashLayers[layer.layerId]) {
510
+ throw new Error(`Layer with id ${layer.layerId} already exists`);
511
+ }
512
+ set((state) => {
513
+ state.hashLayers[layer.layerId] = layer;
514
+ state.layersIds.push(layer.layerId);
515
+ if (layer.visible !== false) {
516
+ state.hashLayers[layer.layerId].visible = true;
517
+ state.visibleCheckedLayers.add(layer.layerId);
518
+ }
519
+ if (layer.autoFocus !== false) {
520
+ state.hashLayers[layer.layerId].autoFocus = true;
521
+ state.autoFocusCheckedLayers.add(layer.layerId);
522
+ }
523
+ if (layer.clusterable && layer.cluster !== false) {
524
+ state.hashLayers[layer.layerId].cluster = true;
525
+ state.clusterCheckedLayers.add(layer.layerId);
526
+ }
527
+ });
528
+ },
529
+ addLayerDataToFeature: (layerId, featureId, layerData) => {
530
+ set((state) => {
531
+ if (state.hashLayers[layerId]) {
532
+ if (state.hashLayers[layerId].geoJsonObject?.object.type === "FeatureCollection") {
533
+ const layer = state.hashLayers[layerId].geoJsonObject?.object;
534
+ const feature = layer.features.find((feature2) => feature2.id === featureId);
535
+ if (feature) {
536
+ feature.layerData = layerData;
537
+ console.log("addLefletLayerToFeature - feature", layerId, featureId, feature.layerData);
538
+ }
539
+ } else if (state.hashLayers[layerId].geoJsonObject?.object.type === "Feature") {
540
+ const feature = state.hashLayers[layerId].geoJsonObject?.object;
541
+ if (feature.layerData) {
542
+ feature.layerData = layerData;
543
+ }
544
+ }
545
+ }
546
+ });
547
+ },
548
+ removeLayer: (layerId) => {
549
+ if (!get().hashLayers[layerId]) {
550
+ return;
551
+ }
552
+ set((state) => {
553
+ if (!state.hashLayers[layerId].visible) {
554
+ state.visibleCheckedLayers.delete(layerId);
555
+ state.autoFocusCheckedLayers.delete(layerId);
556
+ }
557
+ state.layersIds.splice(state.layersIds.indexOf(layerId), 1);
558
+ delete state.hashLayers[layerId];
559
+ });
560
+ },
561
+ setCheckedLayers: (checkedNameSet, newCheckedSet) => {
562
+ set((state) => {
563
+ state[`${checkedNameSet}CheckedLayers`] = new Set(newCheckedSet);
564
+ for (const layerId in state.hashLayers) {
565
+ state.hashLayers[layerId][checkedNameSet] = newCheckedSet.has(layerId);
566
+ }
567
+ });
568
+ },
569
+ setHandlerGetLabel: (newHandler) => {
570
+ set((state) => {
571
+ state.getLabel = newHandler;
572
+ });
573
+ },
574
+ setExternalState: (newExternalState) => {
575
+ set((state) => {
576
+ state.ownerState = { ...state.ownerState, ...newExternalState };
577
+ updateOwnerStateClasses(state);
578
+ });
579
+ }
580
+ }
581
+ })),
582
+ { name: `Map store` }
583
+ )
584
+ );
585
+ };
586
+ const MapContext = createContext(null);
587
+ function MapProvider(props) {
588
+ const {
589
+ children,
590
+ initialLayers
591
+ } = props;
592
+ const {
593
+ getLabel
594
+ } = useModuleDictionary();
595
+ const isDesktop = useResponsiveDesktop();
596
+ const isSkeleton = useModuleSkeleton();
597
+ const isFirstRender = useFirstRender([getLabel]);
598
+ const mapStoreRef = useRef();
599
+ if (!mapStoreRef.current) {
600
+ mapStoreRef.current = createMapStore({
601
+ getLabel,
602
+ ownerState: {
603
+ status: "init",
604
+ isMobile: !isDesktop,
605
+ isSkeleton,
606
+ focus: false
607
+ }
608
+ });
609
+ mapStoreRef.current?.getState().mapActions.init(initialLayers || []);
610
+ }
611
+ const {
612
+ setHandlerGetLabel,
613
+ setExternalState
614
+ } = useStore(mapStoreRef.current, (state) => state.mapActions, shallow);
615
+ useEffect(() => {
616
+ if (!isFirstRender) {
617
+ setHandlerGetLabel(getLabel);
618
+ }
619
+ }, [getLabel]);
620
+ useEffect(() => {
621
+ if (isFirstRender) {
622
+ return;
623
+ }
624
+ setExternalState({
625
+ isMobile: !isDesktop,
626
+ isSkeleton
627
+ });
628
+ }, [isDesktop, isSkeleton]);
629
+ return /* @__PURE__ */ jsx(MapContext.Provider, {
630
+ value: mapStoreRef.current,
631
+ children
632
+ });
633
+ }
634
+ function useMapStore(selector, equalityFn) {
635
+ const context = useContext(MapContext);
636
+ if (!context)
637
+ throw new Error("useMapStore context must be use inside MapContext");
638
+ return useStore(context, selector, equalityFn);
639
+ }
640
+ function useAutoFocus() {
641
+ const map = useMap();
642
+ const layerWithAutoFocus = useMapStore((state) => {
643
+ return state.layersIds.filter((lId) => {
644
+ if (state.hashLayers[lId].autoFocus && state.hashLayers[lId].visible) {
645
+ return true;
646
+ }
647
+ return false;
648
+ }).map((layerId) => ({
649
+ layerId,
650
+ features: function() {
651
+ if (state.hashLayers[layerId].geoJsonObject?.object.type === "FeatureCollection") {
652
+ const layer = state.hashLayers[layerId].geoJsonObject?.object;
653
+ return layer.features.filter((feature) => feature.layerData !== void 0).map((feature) => ({
654
+ featureId: feature.id,
655
+ layerData: feature.layerData
656
+ }));
657
+ } else {
658
+ const feature = state.hashLayers[layerId].geoJsonObject?.object;
659
+ if (feature.layerData !== void 0) {
660
+ return [{
661
+ featureId: feature.id,
662
+ layerData: feature.layerData
663
+ }];
664
+ }
665
+ }
666
+ return [];
667
+ }()
668
+ }));
669
+ }, shallow);
670
+ useEffect(() => {
671
+ const proccesLayerWithAutoFocus = (layersFoucus) => {
672
+ const layersToFitBounds = [];
673
+ for (const layerWhitFeatures of layersFoucus) {
674
+ const features = layerWhitFeatures?.features;
675
+ for (let i = 0; i < features.length; i++) {
676
+ const feature = features[i];
677
+ if (feature.layerData !== void 0) {
678
+ const featureForBounds = {
679
+ layerId: layerWhitFeatures.layerId,
680
+ featureId: feature.featureId,
681
+ layerData: feature.layerData
682
+ };
683
+ console.log("layerForBonds - feature.featureId", feature.featureId, featureForBounds);
684
+ layersToFitBounds.push(featureForBounds);
685
+ } else {
686
+ console.error(`La capa ${layerWhitFeatures.layerId} no tiene un m\xE9todo getBounds`);
687
+ }
688
+ }
689
+ }
690
+ if (layersToFitBounds.length > 0) {
691
+ let featureForBounds = layersToFitBounds[0];
692
+ let bounds = L__default.latLngBounds(featureForBounds.layerData.boundsNW, featureForBounds.layerData.boundsSE);
693
+ console.log(`bounds i:0 - featureeId: ${layersToFitBounds[0].featureId} - bounds:`, bounds.getNorthWest().lng, bounds.getNorthWest().lat, bounds.getSouthEast().lng, bounds.getSouthEast().lat);
694
+ for (let i = 1; i < layersToFitBounds.length; i++) {
695
+ featureForBounds = layersToFitBounds[i];
696
+ const newBounds = L__default.latLngBounds(featureForBounds.layerData.boundsNW, featureForBounds.layerData.boundsSE);
697
+ console.log(`bounds i:{${i}} - featureeId ${layersToFitBounds[i].featureId} - bounds`, newBounds.getNorthWest().lng, newBounds.getNorthWest().lat, newBounds.getSouthEast().lng, newBounds.getSouthEast().lat);
698
+ bounds = bounds.extend(newBounds);
699
+ }
700
+ console.log("bounds total", bounds.getNorthWest().lng, bounds.getNorthWest().lat, bounds.getSouthEast().lng, bounds.getSouthEast().lat);
701
+ map.fitBounds(bounds, {
702
+ animate: false
703
+ });
704
+ }
705
+ };
706
+ const throttleBounds = throttle(proccesLayerWithAutoFocus, 300, {
707
+ leading: false,
708
+ trailing: true
709
+ });
710
+ throttleBounds(layerWithAutoFocus);
711
+ }, [layerWithAutoFocus]);
712
+ }
713
+ const LayersContainer = () => {
714
+ const layersId = useMapStore((state) => state.layersIds, shallow);
715
+ const isSkeleton = useMapStore((state) => state.ownerState.isSkeleton, shallow);
716
+ const map = useMap();
717
+ useAutoFocus();
718
+ useEffect(() => {
719
+ if (!map) {
720
+ return;
721
+ }
722
+ L__default.control.scale().addTo(map);
723
+ return () => {
724
+ L__default.control.scale().remove();
725
+ };
726
+ }, [map]);
727
+ if (isSkeleton) {
728
+ return null;
729
+ }
730
+ if (!map) {
731
+ return null;
732
+ }
733
+ return /* @__PURE__ */ jsx(React__default.Fragment, {
734
+ children: layersId.map((l) => /* @__PURE__ */ jsx(MyLayer, {
735
+ layerId: l
736
+ }, l))
737
+ });
738
+ };
739
+ const DICCTIONARY = {
740
+ LABEL_TAB_GEO: "label_tab_geo",
741
+ TAB_GENERAL_CONFIG_TOOLTIP: "tab_general_config_tooltip",
742
+ PAPER_GENERAL: "paper_general",
743
+ LABEL_ID: "label_id",
744
+ LABEL_NAME: "label_name",
745
+ LABEL_GEOMETRY_TYPE: "label_geometry_type",
746
+ LABEL_GEOMETRY_CIRCLE: "label_geometry_circle",
747
+ LABEL_GEOMETRY_RECTANGLE: "label_geometry_rectangle",
748
+ LABEL_GEOMETRY_POLYGON: "label_geometry_polygon",
749
+ LABEL_DRAW: "label_draw",
750
+ LABEL_FINISH: "label_finish",
751
+ PAPER_CONFIG: "paper_config",
752
+ LABEL_ALIAS: "label_alias",
753
+ LABEL_CUSTOMER_ID: "label_customer_id",
754
+ LABEL_TIME_MIN_IN_SECONDS: "label_time_min_in_seconds",
755
+ LABEL_TIME_MIN_OUT_SECONDS: "label_time_min_out_seconds",
756
+ TAB_STYLE_CONFIG_TOOLTIP: "tab_style_tooltip",
757
+ PAPER_STROKE: "paper_stroke",
758
+ LABEL_COLOR: "label_color",
759
+ LABEL_OPACITY: "label_opacity",
760
+ LABEL_WEIGHT: "label_weight",
761
+ LABEL_DASH_ARRAY: "label_dash_array",
762
+ LABEL_DASH_OFFSET: "label_dash_offset",
763
+ LABEL_RADIUS: "label_radius",
764
+ LABEL_LAT: "label_lat",
765
+ LABEL_LON: "label_lon",
766
+ LABEL_PLACE_MARKER: "label_place_marker",
767
+ LABEL_FIRST_VERTEX: "label_first_vertex",
768
+ LABEL_CONTINUE_LINE: "label_continue_line",
769
+ LABEL_FINISH_LINE: "label_finish_line",
770
+ LABEL_FINISH_POLY: "label_finish_poly",
771
+ LABEL_FINISH_RECT: "label_finish_rect",
772
+ LABEL_START_CIRCLE: "label_start_circle",
773
+ LABEL_FINISH_CIRCLE: "label_finish_circle",
774
+ LABEL_PLACE_CIRCLE_MARKER: "label_place_circle_marker",
775
+ VALIDATION_GEOMETRY_REQUIRED: "validation_geometry_required",
776
+ VALIDATION_FIELD_REQUIRED: "validation_field_required",
777
+ VALIDATION_FIELD_TYPE_NUMBER_ERROR: "validation_field_type_number_error",
778
+ LABEL_VIEW_TRANSIT_FEATURES: "label_view_crossing_features",
779
+ LABEL_VIEW_INTERNAL_FEATURES: "label_view_internal_features",
780
+ LABEL_CREATED_AT: "label_created_at",
781
+ LABEL_UPDATED_AT: "label_updated_at",
782
+ MODAL_DELETE_GEO_TITLE: "modal_delete_geo_title",
783
+ MODAL_DELETE_GEO_MESSAGE: "modal_delete_geo_message",
784
+ MODAL_DISABLE_GEO_TITLE: "modal_disable_geo_title",
785
+ MODAL_DISABLE_MESSAGE: "modal_disable_geo_message",
786
+ ROW_ACTION_GEO_EDIT: "row_action_geo_edit",
787
+ ROW_ACTION_GEO_ENABLE: "row_action_geo_enable",
788
+ ROW_ACTION_GEO_DISABLE: "row_action_geo_disable",
789
+ ROW_ACTION_GEO_DELETE: "row_action_geo_delete",
790
+ LABEL_TAB_MEASURE: "label_tab_measure",
791
+ PAPER_MEASURE: "paper_measure",
792
+ LABEL_MEASURE_START: "label_measure_start",
793
+ LABEL_MEASURE_RESTART: "label_measure_restart",
794
+ LABEL_MEASURE_DISTANCE: "label_measure_distance",
795
+ LABEL_MEASURE_AREA: "label_measure_area",
796
+ LABEL_MEASURE_UNIT: "label_measure_unit",
797
+ LABEL_MEASURE_UNIT_BASE_KILOMETERS: "label_measure_unit_base_kilometers",
798
+ LABEL_MEASURE_REMOVE_POINT: "label_measure_remove_point",
799
+ LABEL_LAYERS: "label_layes",
800
+ LABEL_LAYER_NAME: "label_layer_name",
801
+ LABEL_LAYER_VISIBLE: "label_layer_visible",
802
+ LABEL_LAYER_AUTOFOCUS: "label_layer_autofocus",
803
+ LABEL_LAYER_CLUSTER: "label_layer_cluster",
804
+ LABEL_LAYER_DELETE: "label_layer_delete"
805
+ };
806
+ function useColumns(props) {
807
+ const {
808
+ rowKeyGetter,
809
+ visibleLayers,
810
+ setVisibleLayers,
811
+ autoFocusLayers,
812
+ setAutoFocusLayers,
813
+ clusterLayers,
814
+ setClusterLayers
815
+ } = props;
816
+ const {
817
+ getLabel
818
+ } = useModuleDictionary();
819
+ const useHook = useCallback((field) => {
820
+ if (field === "visible") {
821
+ return [visibleLayers, setVisibleLayers];
822
+ } else if (field === "autoFocus") {
823
+ return [autoFocusLayers, setAutoFocusLayers];
824
+ } else {
825
+ return [clusterLayers, setClusterLayers];
826
+ }
827
+ }, [visibleLayers, autoFocusLayers, clusterLayers]);
828
+ const columns = useMemo(() => [
829
+ {
830
+ key: "name",
831
+ name: getLabel(DICCTIONARY.LABEL_NAME),
832
+ type: "string",
833
+ width: 300,
834
+ frozen: true
835
+ },
836
+ {
837
+ key: "visible",
838
+ name: getLabel(DICCTIONARY.LABEL_LAYER_VISIBLE),
839
+ width: 80,
840
+ type: "boolean",
841
+ formatter: ColumnSetCheckFormatter({
842
+ field: "visible",
843
+ rowKeyGetter,
844
+ useHook
845
+ }),
846
+ cellClass: "rdg-cell-align-center"
847
+ },
848
+ {
849
+ key: "autoFocus",
850
+ name: getLabel(DICCTIONARY.LABEL_LAYER_AUTOFOCUS),
851
+ width: 80,
852
+ type: "boolean",
853
+ formatter: ColumnSetCheckFormatter({
854
+ field: "autoFocus",
855
+ rowKeyGetter,
856
+ useHook
857
+ }),
858
+ cellClass: "rdg-cell-align-center"
859
+ },
860
+ {
861
+ key: "cluster",
862
+ name: getLabel(DICCTIONARY.LABEL_LAYER_CLUSTER),
863
+ width: 80,
864
+ type: "boolean",
865
+ formatter: ColumnSetCheckFormatter({
866
+ field: "cluster",
867
+ rowKeyGetter,
868
+ useHook
869
+ }),
870
+ cellClass: "rdg-cell-align-center"
871
+ }
872
+ ], [getLabel, useHook]);
873
+ return {
874
+ columns
875
+ };
876
+ }
877
+ function useCheckedLayers(checkedNameSet) {
878
+ const [checkedLayers, setCheckedLayers] = useMapStore((state) => [state[`${checkedNameSet}CheckedLayers`], (newSet) => {
879
+ state.mapActions.setCheckedLayers(checkedNameSet, newSet);
880
+ }], shallow);
881
+ return [checkedLayers, setCheckedLayers];
882
+ }
883
+ function useMaster() {
884
+ const [hashLayers, layersIds] = useMapStore((state) => [state.hashLayers, state.layersIds], shallow);
885
+ const rowKeyGetter = useCallback((row) => row.id, []);
886
+ const [visibleLayers, setVisibleLayers] = useCheckedLayers("visible");
887
+ const [autoFocusLayers, setAutoFocusLayers] = useCheckedLayers("autoFocus");
888
+ const [clusterLayers, setClusterLayers] = useCheckedLayers("cluster");
889
+ const rows = useMemo(() => {
890
+ const rows2 = [];
891
+ layersIds.forEach((layerId) => {
892
+ if (hashLayers[layerId]) {
893
+ rows2.push({
894
+ id: layerId,
895
+ name: hashLayers[layerId].name || `*${layerId}`,
896
+ active: hashLayers[layerId].visible
897
+ });
898
+ }
899
+ });
900
+ return rows2;
901
+ }, [hashLayers, layersIds]);
902
+ const {
903
+ columns
904
+ } = useColumns({
905
+ rowKeyGetter,
906
+ visibleLayers,
907
+ setVisibleLayers,
908
+ autoFocusLayers,
909
+ setAutoFocusLayers,
910
+ clusterLayers,
911
+ setClusterLayers
912
+ });
913
+ return {
914
+ rowKeyGetter,
915
+ columns,
916
+ rows,
917
+ checkedRows: visibleLayers,
918
+ onCheckedRowsChange: setVisibleLayers
919
+ };
920
+ }
921
+ function useDisableZoomEvents(node) {
922
+ const map = useMap();
923
+ useEffect(() => {
924
+ if (!map || !node)
925
+ return;
926
+ node.addEventListener("mouseover", function() {
927
+ map.doubleClickZoom.disable();
928
+ map.scrollWheelZoom.disable();
929
+ });
930
+ node.addEventListener("mouseleave", function() {
931
+ map.scrollWheelZoom.enable();
932
+ map.doubleClickZoom.enable();
933
+ });
934
+ }, [map, node]);
935
+ }
936
+ function LayersTool() {
937
+ const {
938
+ columns,
939
+ rows,
940
+ rowKeyGetter
941
+ } = useMaster();
942
+ const [node, divRef] = useStateRef(null);
943
+ useDisableZoomEvents(node);
944
+ return /* @__PURE__ */ jsx("div", {
945
+ ref: divRef,
946
+ style: {
947
+ position: "relative",
948
+ height: "100%"
949
+ },
950
+ children: /* @__PURE__ */ jsx(DataGrid, {
951
+ id: "layers",
952
+ columns,
953
+ rows,
954
+ rowKeyGetter,
955
+ withActions: true,
956
+ actionsProps: {
957
+ withPager: false,
958
+ withLocalFilters: true
959
+ }
960
+ })
961
+ });
962
+ }
963
+ function MainTools(props) {
964
+ const {
965
+ gpsTools,
966
+ aditionalMainTools
967
+ } = props;
968
+ const {
969
+ addPopup,
970
+ removePopup
971
+ } = usePopupsStore((state) => state.popupsActions);
972
+ const map = useMap();
973
+ const onMouseDown = (e) => {
974
+ map.dragging.disable();
975
+ e.stopPropagation();
976
+ document.addEventListener("mouseup", onMouseUp);
977
+ };
978
+ const onMouseUp = (e) => {
979
+ map.dragging.enable();
980
+ e.stopPropagation();
981
+ document.removeEventListener("mouseup", onMouseUp);
982
+ };
983
+ const onGpsToolsClick = useCallback((e, isPressed) => {
984
+ if (isPressed) {
985
+ addPopup({
986
+ popupId: "gpsTools",
987
+ title: "Primer popup",
988
+ functionComponent: () => gpsTools,
989
+ onMouseDown,
990
+ defaultPosition: {
991
+ left: 490,
992
+ top: 50,
993
+ width: 360,
994
+ height: 420
995
+ }
996
+ });
997
+ } else {
998
+ removePopup("gpsTools");
999
+ }
1000
+ e.stopPropagation();
1001
+ }, []);
1002
+ const onLayersClick = useCallback((e, isPressed) => {
1003
+ if (isPressed) {
1004
+ addPopup({
1005
+ popupId: "layers",
1006
+ title: "Primer popup",
1007
+ functionComponent: () => /* @__PURE__ */ jsx(LayersTool, {}),
1008
+ onMouseDown,
1009
+ defaultPosition: {
1010
+ left: 5,
1011
+ top: 240,
1012
+ width: 440,
1013
+ height: 450
1014
+ }
1015
+ });
1016
+ } else {
1017
+ removePopup("layers");
1018
+ }
1019
+ e.stopPropagation();
1020
+ }, []);
1021
+ return /* @__PURE__ */ jsxs("div", {
1022
+ className: mapClasses.mainToolsRoot,
1023
+ children: [/* @__PURE__ */ jsx(ToggleButton, {
1024
+ defaultIsPressed: false,
1025
+ onClick: onGpsToolsClick,
1026
+ children: "GPS Tools"
1027
+ }), /* @__PURE__ */ jsx(ToggleButton, {
1028
+ defaultIsPressed: false,
1029
+ onClick: onLayersClick,
1030
+ children: "Layers"
1031
+ }), aditionalMainTools]
1032
+ });
1033
+ }
1034
+ function Map(props) {
1035
+ const {
1036
+ children,
1037
+ gpsTools,
1038
+ aditionalMainTools
1039
+ } = props;
1040
+ return /* @__PURE__ */ jsxs(MapRootContainer, {
1041
+ className: mapClasses.root,
1042
+ center: [6.215749485905093, -75.58622905191254],
1043
+ zoom: 16,
1044
+ maxZoom: 22,
1045
+ preferCanvas: true,
1046
+ placeholder: /* @__PURE__ */ jsx("div", {
1047
+ children: "Loading..."
1048
+ }),
1049
+ children: [/* @__PURE__ */ jsx(TileLayer, {
1050
+ url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
1051
+ attribution: '\xA9 <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
1052
+ }), /* @__PURE__ */ jsx(LayersContainer, {}), children, /* @__PURE__ */ jsx(PopupsProvider, {
1053
+ children: /* @__PURE__ */ jsx(MainTools, {
1054
+ aditionalMainTools,
1055
+ gpsTools
1056
+ })
1057
+ })]
1058
+ });
1059
+ }
1060
+ function CustomMarker(props) {
1061
+ const {
1062
+ position,
1063
+ width,
1064
+ height,
1065
+ iconForm,
1066
+ bearing,
1067
+ ...other
1068
+ } = props;
1069
+ const html = useMemo(() => {
1070
+ }, [bearing]);
1071
+ const customIcon = useMemo(() => {
1072
+ return L__default.divIcon({
1073
+ className: "custom-icon",
1074
+ iconSize: [width, height],
1075
+ html: `<div>Hola</div>`
1076
+ });
1077
+ }, [html]);
1078
+ return /* @__PURE__ */ jsx(Marker, {
1079
+ position,
1080
+ icon: customIcon,
1081
+ ...other
1082
+ });
1083
+ }
1084
+ const MarkerFeatureRender = (props) => {
1085
+ const {
1086
+ id,
1087
+ layerId
1088
+ } = props;
1089
+ const feature = useMapStore((state) => {
1090
+ const gObject = state.hashLayers[layerId].geoJsonObject;
1091
+ console.log(`renderByEachFeature gObject`, gObject);
1092
+ if (!gObject) {
1093
+ return null;
1094
+ }
1095
+ if (gObject.object.type === "Feature") {
1096
+ return {
1097
+ id: gObject.object.id,
1098
+ geometry: gObject.object.geometry,
1099
+ properties: gObject.object.properties
1100
+ };
1101
+ } else {
1102
+ const feat = gObject.object.features.find((f) => f.id === id);
1103
+ if (feat) {
1104
+ return {
1105
+ id: feat.id,
1106
+ geometry: feat.geometry,
1107
+ properties: feat.properties
1108
+ };
1109
+ }
1110
+ return null;
1111
+ }
1112
+ }, shallow);
1113
+ console.log(`renderByEachFeature: ${id}`, feature);
1114
+ if (!feature) {
1115
+ return null;
1116
+ }
1117
+ if (feature.geometry.type === "Point") {
1118
+ const [lat, lng] = feature.geometry.coordinates;
1119
+ const bearing = feature.properties?.bearing ?? 0;
1120
+ return /* @__PURE__ */ jsx(CustomMarker, {
1121
+ position: {
1122
+ lat,
1123
+ lng
1124
+ },
1125
+ width: 32,
1126
+ height: 32,
1127
+ bearing,
1128
+ iconForm: "grua",
1129
+ id: feature.id
1130
+ });
1131
+ }
1132
+ return null;
1133
+ };
1134
+ const PolylineWithArrows = ({
1135
+ positions,
1136
+ enableEdit,
1137
+ ...other
1138
+ }) => {
1139
+ const map = useMap();
1140
+ const polylineRef = useRef(null);
1141
+ const decoratorRef = useRef(null);
1142
+ useEffect(() => {
1143
+ if (polylineRef.current) {
1144
+ const decorator = L__default.polylineDecorator(polylineRef.current, {
1145
+ patterns: [{
1146
+ repeat: 50,
1147
+ symbol: L__default.Symbol.arrowHead({
1148
+ pixelSize: 4,
1149
+ polygon: false,
1150
+ pathOptions: {
1151
+ stroke: true,
1152
+ color: "#ffffff",
1153
+ weight: 2
1154
+ }
1155
+ })
1156
+ }]
1157
+ }).addTo(map);
1158
+ decoratorRef.current = decorator;
1159
+ if (enableEdit) {
1160
+ polylineRef.current.pm.enable();
1161
+ } else {
1162
+ polylineRef.current.pm.disable();
1163
+ }
1164
+ polylineRef.current.on("pm:change", () => {
1165
+ if (decoratorRef.current) {
1166
+ map.removeLayer(decoratorRef.current);
1167
+ }
1168
+ if (polylineRef.current) {
1169
+ decoratorRef.current = L__default.polylineDecorator(polylineRef.current, {
1170
+ patterns: [{
1171
+ repeat: 40,
1172
+ symbol: L__default.Symbol.arrowHead({
1173
+ pixelSize: 4,
1174
+ polygon: false,
1175
+ pathOptions: {
1176
+ stroke: true,
1177
+ color: "#cc0000",
1178
+ weight: 2
1179
+ }
1180
+ })
1181
+ }]
1182
+ }).addTo(map);
1183
+ }
1184
+ });
1185
+ return () => {
1186
+ if (decoratorRef.current) {
1187
+ map.removeLayer(decoratorRef.current);
1188
+ }
1189
+ };
1190
+ }
1191
+ }, [map, enableEdit]);
1192
+ return /* @__PURE__ */ jsx(Polyline, {
1193
+ positions,
1194
+ ref: polylineRef,
1195
+ ...other
1196
+ });
1197
+ };
1198
+ const CommonFeatureRender = (props) => {
1199
+ const {
1200
+ id,
1201
+ layerId
1202
+ } = props;
1203
+ const feature = useMapStore((state) => {
1204
+ const gObject = state.hashLayers[layerId].geoJsonObject;
1205
+ if (!gObject) {
1206
+ return null;
1207
+ }
1208
+ if (gObject.object.type === "Feature") {
1209
+ return {
1210
+ id: gObject.object.id,
1211
+ geometry: gObject.object.geometry,
1212
+ properties: gObject.object.properties
1213
+ };
1214
+ } else {
1215
+ const feat = gObject.object.features.find((f) => f.id === id);
1216
+ if (feat) {
1217
+ return {
1218
+ id: feat.id,
1219
+ geometry: feat.geometry,
1220
+ properties: feat.properties
1221
+ };
1222
+ }
1223
+ return null;
1224
+ }
1225
+ }, shallow);
1226
+ const {
1227
+ addLayerDataToFeature
1228
+ } = useMapStore((state) => state.mapActions, shallow);
1229
+ if (!feature) {
1230
+ return null;
1231
+ }
1232
+ const propFeature = {
1233
+ featureId: feature.id
1234
+ };
1235
+ if (feature.geometry?.type === "LineString") {
1236
+ const polylinePositions = feature.geometry.coordinates.map((coord) => [coord[1], coord[0]]);
1237
+ return /* @__PURE__ */ jsx(
1238
+ PolylineWithArrows,
1239
+ {
1240
+ positions: polylinePositions,
1241
+ stroke: true,
1242
+ weight: 10,
1243
+ eventHandlers: {
1244
+ add: (e) => {
1245
+ const layerData = {
1246
+ boundsNW: e.target.getBounds().getNorthWest(),
1247
+ boundsSE: e.target.getBounds().getSouthEast()
1248
+ };
1249
+ addLayerDataToFeature(layerId, feature.id, layerData);
1250
+ }
1251
+ },
1252
+ dashArray: "20 30",
1253
+ ...feature.properties,
1254
+ ...propFeature
1255
+ },
1256
+ Math.random()
1257
+ );
1258
+ }
1259
+ if (feature.geometry?.type === "Polygon") {
1260
+ const polygonPositions = feature.geometry.coordinates.map((ring) => ring.map(([lng, lat]) => [lat, lng]));
1261
+ return /* @__PURE__ */ jsx(
1262
+ Polygon,
1263
+ {
1264
+ positions: polygonPositions,
1265
+ opacity: 1,
1266
+ eventHandlers: {
1267
+ add: (e) => {
1268
+ const layerData = {
1269
+ boundsNW: e.target.getBounds().getNorthWest(),
1270
+ boundsSE: e.target.getBounds().getSouthEast()
1271
+ };
1272
+ addLayerDataToFeature(layerId, feature.id, layerData);
1273
+ }
1274
+ },
1275
+ ...feature.properties,
1276
+ ...propFeature
1277
+ }
1278
+ );
1279
+ }
1280
+ if (feature.geometry?.type === "Point") {
1281
+ if (feature.properties?.subType === "Marker") {
1282
+ const [lat, lng] = feature.geometry.coordinates;
1283
+ return /* @__PURE__ */ jsx(Marker, {
1284
+ position: {
1285
+ lat,
1286
+ lng
1287
+ },
1288
+ eventHandlers: {
1289
+ click: (e) => {
1290
+ console.log("click Custom marker", e);
1291
+ }
1292
+ },
1293
+ ...propFeature
1294
+ });
1295
+ } else if (feature.properties?.subType === "CustomMarker")
1296
+ ;
1297
+ else if (feature.properties?.subType === "Circle" && feature.properties?.radius) {
1298
+ const {
1299
+ subType,
1300
+ radius,
1301
+ ...styleProperties
1302
+ } = feature.properties;
1303
+ const [lng, lat] = feature.geometry.coordinates;
1304
+ return /* @__PURE__ */ jsx(Circle, {
1305
+ center: {
1306
+ lat,
1307
+ lng
1308
+ },
1309
+ radius: feature.properties?.radius,
1310
+ ...styleProperties,
1311
+ eventHandlers: {
1312
+ add: (e) => {
1313
+ const layerData = {
1314
+ boundsNW: e.target.getBounds().getNorthWest(),
1315
+ boundsSE: e.target.getBounds().getSouthEast()
1316
+ };
1317
+ addLayerDataToFeature(layerId, feature.id, layerData);
1318
+ }
1319
+ },
1320
+ ...propFeature
1321
+ }, Math.random());
1322
+ }
1323
+ }
1324
+ return null;
1325
+ };
1326
+ export {
1327
+ CommonFeatureRender as C,
1328
+ DICCTIONARY as D,
1329
+ MAP_ZINDEX_OVER_MAP as M,
1330
+ MAP_ZINDEX_DEFAULT as a,
1331
+ useDisableZoomEvents as b,
1332
+ Map as c,
1333
+ MapProvider as d,
1334
+ MapContext as e,
1335
+ MarkerFeatureRender as f,
1336
+ mapClasses as m,
1337
+ useMapStore as u
1338
+ };