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