@m4l/gclick 0.3.7 → 0.3.8
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/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.d.ts +3 -2
- package/components/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.d.ts.map +1 -1
- package/components/ReportsViewer/subcomponents/ReportSheetMapFitBounds/ReportSheetMapFitBounds.js +16 -20
- package/components/index.d.ts +1 -0
- package/components/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/constants.d.ts +1 -0
- package/components/maps/components/GpsMap/constants.d.ts.map +1 -1
- package/components/maps/components/GpsMap/constants.js +16 -14
- package/components/maps/components/GpsMap/contexts/MapContext/MapContext.d.ts +2 -1
- package/components/maps/components/GpsMap/contexts/MapContext/MapContext.d.ts.map +1 -1
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.d.ts +28 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.d.ts.map +1 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/featureObservability.js +111 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.d.ts +9 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.d.ts.map +1 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/geoJsonBounds.js +183 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.d.ts +112 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.d.ts.map +1 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/helpers.js +87 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.d.ts +10 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.d.ts.map +1 -0
- package/components/maps/components/GpsMap/contexts/MapContext/helpers/layerDataBounds.js +12 -0
- package/components/maps/components/GpsMap/contexts/MapContext/index.d.ts +2 -1
- package/components/maps/components/GpsMap/contexts/MapContext/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/contexts/MapContext/store.d.ts +6 -2
- package/components/maps/components/GpsMap/contexts/MapContext/store.d.ts.map +1 -1
- package/components/maps/components/GpsMap/contexts/MapContext/store.js +301 -123
- package/components/maps/components/GpsMap/contexts/MapContext/types.d.ts +191 -20
- package/components/maps/components/GpsMap/contexts/MapContext/types.d.ts.map +1 -1
- package/components/maps/components/GpsMap/contexts/MapContext/types.js +8 -0
- package/components/maps/components/GpsMap/featureRenders/CommonFeatureRender/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/featureRenders/CommonFeatureRender/index.js +93 -124
- package/components/maps/components/GpsMap/hooks/index.d.ts +3 -0
- package/components/maps/components/GpsMap/hooks/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.d.ts +12 -0
- package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.d.ts.map +1 -0
- package/components/maps/components/GpsMap/hooks/useAutoFocus/helpers.js +29 -0
- package/components/maps/components/GpsMap/hooks/useAutoFocus/index.d.ts +1 -4
- package/components/maps/components/GpsMap/hooks/useAutoFocus/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/hooks/useAutoFocus/index.js +32 -59
- package/components/maps/components/GpsMap/hooks/useAutoFocus/types.d.ts +4 -13
- package/components/maps/components/GpsMap/hooks/useAutoFocus/types.d.ts.map +1 -1
- package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.d.ts +7 -0
- package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.d.ts.map +1 -0
- package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.js +42 -0
- package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.types.d.ts +19 -0
- package/components/maps/components/GpsMap/hooks/useMapInteractionCapture.types.d.ts.map +1 -0
- package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.d.ts +12 -0
- package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.d.ts.map +1 -0
- package/components/maps/components/GpsMap/hooks/useObservableFeatureEventHandlers.js +43 -0
- package/components/maps/components/GpsMap/index.d.ts +1 -0
- package/components/maps/components/GpsMap/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.d.ts +5 -0
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/constants.js +20 -13
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.d.ts +4 -3
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/index.js +175 -120
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/types.d.ts +6 -0
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/hooks/useMeasure/types.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/subcomponents/MyActions/MyActions.d.ts.map +1 -1
- package/components/maps/components/GpsMap/subcomponents/Controls/subcomponents/ButtonsToolsList/subcomponents/MeasureTool/subcomponents/MyActions/MyActions.js +26 -12
- package/components/maps/components/GpsMap/subcomponents/LayersContainer/subcomponents/Layer/Layer.js +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.d.ts +6 -0
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/constants.js +38 -26
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useDatagridFiltered.js +26 -26
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useFilterAndSort/useFilterAndSort.js +27 -27
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useMaster.js +4 -4
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.d.ts +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useModuleDynamicActions.js +34 -28
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useRowActionsGetter.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useRowActionsGetter.js +41 -36
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/hooks/useTabFiltered.js +17 -17
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/Form.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/Form.js +16 -18
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts +3 -2
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/hooks/useDrawing.js +136 -92
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/GeneralData.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/GeneralData.js +29 -23
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.d.ts +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.d.ts.map +1 -1
- package/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.js +60 -95
- package/components/maps/index.d.ts +1 -0
- package/components/maps/index.d.ts.map +1 -1
- package/index.js +143 -136
- package/package.json +3 -4
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { useFormContext as
|
|
3
|
-
import { useModuleDictionary as
|
|
4
|
-
import { useMap as
|
|
5
|
-
import * as
|
|
6
|
-
import { getLayerFromGeometry as
|
|
7
|
-
import { useFormReadyForUpdate as
|
|
8
|
-
import { MAP_GPSTOOLS_DICCTIONARY as
|
|
9
|
-
import { getStyleFromProperties as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { useState as G, useRef as b, useEffect as g, useCallback as k, useMemo as U } from "react";
|
|
2
|
+
import { useFormContext as J } from "react-hook-form";
|
|
3
|
+
import { useModuleDictionary as q } from "@m4l/core";
|
|
4
|
+
import { useMap as Q } from "react-leaflet";
|
|
5
|
+
import * as Y from "leaflet";
|
|
6
|
+
import { getLayerFromGeometry as Z } from "../helpers.js";
|
|
7
|
+
import { useFormReadyForUpdate as K, useWatchTyped as X } from "@m4l/components";
|
|
8
|
+
import { MAP_GPSTOOLS_DICCTIONARY as l } from "../../../../../dictionary.js";
|
|
9
|
+
import { getStyleFromProperties as x } from "../../../helpers.js";
|
|
10
|
+
import { useMapInteractionCapture as B } from "../../../../../../GpsMap/hooks/useMapInteractionCapture.js";
|
|
11
|
+
import { useMapStore as j } from "../../../../../../GpsMap/hooks/useMapStore/index.js";
|
|
12
|
+
import { GEOFENCES_DRAW_INTERACTION_OWNER_ID as v, GEOFENCES_DRAW_REQUIRED_INTERACTION_CHANNELS as z, GEOFENCES_ADD_EDIT_VISUAL_REQUIRED_INTERACTION_CHANNELS as $ } from "../../../constants.js";
|
|
13
|
+
function pe() {
|
|
14
|
+
const { getLabel: i } = q(), d = K(), t = Q(), { control: V, setValue: r } = J(), A = j((o) => o.mapActions.moveToBounds), [
|
|
15
|
+
u,
|
|
16
|
+
O,
|
|
16
17
|
f,
|
|
18
|
+
E,
|
|
19
|
+
_,
|
|
17
20
|
L,
|
|
18
21
|
h,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
] =
|
|
23
|
-
control:
|
|
22
|
+
N,
|
|
23
|
+
R,
|
|
24
|
+
W
|
|
25
|
+
] = X({
|
|
26
|
+
control: V,
|
|
24
27
|
name: [
|
|
25
28
|
"geofenceTypeId",
|
|
26
29
|
"inEdition",
|
|
@@ -33,112 +36,153 @@ function Z() {
|
|
|
33
36
|
"geometry",
|
|
34
37
|
"properties.radius"
|
|
35
38
|
]
|
|
36
|
-
}), [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
}), [D, y] = G(!1), e = b(null), {
|
|
40
|
+
isAvailable: S,
|
|
41
|
+
releaseCapture: c,
|
|
42
|
+
requestCapture: T
|
|
43
|
+
} = B({
|
|
44
|
+
ownerId: v,
|
|
45
|
+
channels: z
|
|
46
|
+
}), { requestCapture: M } = B({
|
|
47
|
+
ownerId: v,
|
|
48
|
+
channels: $
|
|
49
|
+
}), m = b(x({
|
|
50
|
+
strokeColor: f,
|
|
51
|
+
strokeOpacity: E,
|
|
52
|
+
strokeWeight: _,
|
|
40
53
|
strokeDashArray: L,
|
|
41
54
|
fillColor: h,
|
|
42
|
-
fillOpacity:
|
|
55
|
+
fillOpacity: N
|
|
43
56
|
}));
|
|
44
|
-
|
|
45
|
-
strokeColor:
|
|
46
|
-
strokeOpacity:
|
|
47
|
-
strokeWeight:
|
|
57
|
+
m.current = x({
|
|
58
|
+
strokeColor: f,
|
|
59
|
+
strokeOpacity: E,
|
|
60
|
+
strokeWeight: _,
|
|
48
61
|
strokeDashArray: L,
|
|
49
62
|
fillColor: h,
|
|
50
|
-
fillOpacity:
|
|
63
|
+
fillOpacity: N
|
|
51
64
|
});
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
const H = W ?? null, [a, F] = G(u);
|
|
66
|
+
g(() => {
|
|
67
|
+
d && M();
|
|
68
|
+
}, [d, M]), g(() => {
|
|
69
|
+
if (d) {
|
|
70
|
+
if (R && (e.current = Z(R, u, H, {
|
|
71
|
+
...m.current
|
|
72
|
+
}), e.current)) {
|
|
73
|
+
t.addLayer(e.current);
|
|
74
|
+
const o = e.current.getBounds();
|
|
75
|
+
A({
|
|
76
|
+
southWest: {
|
|
77
|
+
lat: o.getSouth(),
|
|
78
|
+
lng: o.getWest()
|
|
79
|
+
},
|
|
80
|
+
northEast: {
|
|
81
|
+
lat: o.getNorth(),
|
|
82
|
+
lng: o.getEast()
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
animate: !1,
|
|
86
|
+
padding: [0, 0],
|
|
87
|
+
maxZoom: t.getMaxZoom()
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return () => {
|
|
58
91
|
e.current && e.current.remove();
|
|
59
92
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
93
|
+
}
|
|
94
|
+
}, [t, A, d]), g(() => {
|
|
95
|
+
if (!d) {
|
|
96
|
+
a !== u && F(u);
|
|
63
97
|
return;
|
|
64
98
|
}
|
|
65
|
-
|
|
66
|
-
}, [
|
|
67
|
-
e.current && e.current.setStyle(
|
|
68
|
-
}, [
|
|
69
|
-
|
|
99
|
+
u !== a && (F(u), a !== "gt_circle" && (r("properties.radius", null, { shouldDirty: !0 }), r("lat", null, { shouldDirty: !0 }), r("lng", null, { shouldDirty: !0 })), r("geometry", null, { shouldDirty: !0 }), e.current && (e.current.remove(), e.current = null), c(["draw_geometry"]), y(!1), r("inEdition", !1, { shouldDirty: !0 }));
|
|
100
|
+
}, [u, a, d, c, r]), g(() => {
|
|
101
|
+
e.current && e.current.setStyle(m.current);
|
|
102
|
+
}, [f, E, _, L, h, N]), g(() => {
|
|
103
|
+
t.pm.setLang("en", {
|
|
70
104
|
tooltips: {
|
|
71
105
|
placeMarker: void 0,
|
|
72
|
-
firstVertex: i(
|
|
73
|
-
continueLine: i(
|
|
74
|
-
finishLine: i(
|
|
75
|
-
finishPoly: i(
|
|
76
|
-
finishRect: i(
|
|
77
|
-
startCircle: i(
|
|
78
|
-
finishCircle: i(
|
|
79
|
-
placeCircleMarker: i(
|
|
106
|
+
firstVertex: i(l.LABEL_GEOMAN_FIRST_VERTEX),
|
|
107
|
+
continueLine: i(l.LABEL_GEOMAN_CONTINUE_LINE),
|
|
108
|
+
finishLine: i(l.LABEL_GEOMAN_FINISH_LINE),
|
|
109
|
+
finishPoly: i(l.LABEL_GEOMAN_FINISH_POLYLINE),
|
|
110
|
+
finishRect: i(l.LABEL_GEOMAN_FINISH_RECT),
|
|
111
|
+
startCircle: i(l.LABEL_GEOMAN_START_CIRCLE),
|
|
112
|
+
finishCircle: i(l.LABEL_GEOMAN_FINISH_CIRCLE),
|
|
113
|
+
placeCircleMarker: i(l.LABEL_GEOMAN_PLACE_CIRCLE_MARKER)
|
|
80
114
|
}
|
|
81
115
|
});
|
|
82
|
-
}, [
|
|
83
|
-
if (
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
e.current =
|
|
116
|
+
}, [t, i]), g(() => {
|
|
117
|
+
if (t) {
|
|
118
|
+
let o = "Circle", C = "Circle";
|
|
119
|
+
a === "gt_polygon" ? (o = "Polygon", C = "Polygon") : a === "gt_multipolygon" ? (o = "MultiPolygon", C = "Polygon") : a === "gt_rectangle" && (o = "Rectangle", C = "Rectangle"), D ? e.current ? (e.current.pm.enable(), r("inEdition", !0), e.current.on("pm:disable", (s) => {
|
|
120
|
+
e.current = s.layer, r("geometry", e.current.toGeoJSON()?.geometry, {
|
|
87
121
|
shouldTouch: !0,
|
|
88
122
|
shouldValidate: !0,
|
|
89
123
|
shouldDirty: !0
|
|
90
|
-
}),
|
|
91
|
-
}),
|
|
92
|
-
e.current =
|
|
93
|
-
})) : (
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
color:
|
|
98
|
-
opacity:
|
|
99
|
-
weight:
|
|
124
|
+
}), r("inEdition", !1), y(!1), c(["draw_geometry"]);
|
|
125
|
+
}), o === "Circle" && e.current.on("pm:change", (s) => {
|
|
126
|
+
e.current = s.layer, r("lat", Number(e.current.getLatLng().lat.toFixed(8))), r("lng", Number(e.current.getLatLng().lng.toFixed(8))), r("properties.radius", e.current.getRadius()), r("properties.radius", Number(e.current.getRadius().toFixed(1)));
|
|
127
|
+
})) : (r("inEdition", !0), o === "Circle" ? t.on("pm:drawstart", ({ workingLayer: s }) => {
|
|
128
|
+
s.on("pm:centerplaced", (p) => {
|
|
129
|
+
const n = p.workingLayer;
|
|
130
|
+
n.setStyle({
|
|
131
|
+
color: f,
|
|
132
|
+
opacity: E,
|
|
133
|
+
weight: _,
|
|
100
134
|
dashArray: L,
|
|
101
135
|
fillColor: h,
|
|
102
|
-
fillOpacity:
|
|
103
|
-
}),
|
|
104
|
-
|
|
136
|
+
fillOpacity: N
|
|
137
|
+
}), r("lat", Number(n.getLatLng().lat.toFixed(8))), r("lng", Number(n.getLatLng().lng.toFixed(8))), n.on("pm:change", (I) => {
|
|
138
|
+
r("properties.radius", Number(n.getRadius().toFixed(1)));
|
|
105
139
|
});
|
|
106
140
|
});
|
|
107
|
-
}) : (
|
|
108
|
-
|
|
109
|
-
|
|
141
|
+
}) : (o === "Polygon" || o === "MultiPolygon") && t.on("pm:drawstart", ({ workingLayer: s }) => {
|
|
142
|
+
s.on("pm:vertexadded", (p) => {
|
|
143
|
+
p.workingLayer.setStyle(m.current);
|
|
110
144
|
});
|
|
111
|
-
}),
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
145
|
+
}), t.pm.enableDraw(C), t.pm.setPathOptions(m.current), t.on("pm:create", (s) => {
|
|
146
|
+
const p = s.layer, n = p.toGeoJSON()?.geometry;
|
|
147
|
+
if (o === "MultiPolygon" && n?.type === "Polygon") {
|
|
148
|
+
const I = {
|
|
115
149
|
type: "MultiPolygon",
|
|
116
|
-
coordinates: [
|
|
150
|
+
coordinates: [n.coordinates]
|
|
117
151
|
};
|
|
118
|
-
|
|
119
|
-
style:
|
|
120
|
-
}),
|
|
152
|
+
t.removeLayer(p), e.current = Y.geoJSON(I, {
|
|
153
|
+
style: m.current
|
|
154
|
+
}), t.addLayer(e.current), r("geometry", I, {
|
|
121
155
|
shouldTouch: !0,
|
|
122
156
|
shouldValidate: !0,
|
|
123
157
|
shouldDirty: !0
|
|
124
158
|
});
|
|
125
159
|
} else
|
|
126
|
-
e.current =
|
|
160
|
+
e.current = p, r("geometry", n, {
|
|
127
161
|
shouldTouch: !0,
|
|
128
162
|
shouldValidate: !0,
|
|
129
163
|
shouldDirty: !0
|
|
130
164
|
});
|
|
131
|
-
|
|
132
|
-
})) : (
|
|
165
|
+
r("inEdition", !1), y(!1), c(["draw_geometry"]);
|
|
166
|
+
})) : (t.pm.disableDraw("Polygon"), t.off("pm:create"), t.off("pm:edit"), t.off("pm:drawstart"));
|
|
167
|
+
}
|
|
168
|
+
}, [D, t, c]);
|
|
169
|
+
const P = k(() => {
|
|
170
|
+
T() && y(!0);
|
|
171
|
+
}, [T]), w = k(() => {
|
|
172
|
+
if (c(["draw_geometry"]), e.current) {
|
|
173
|
+
e.current.pm.disable();
|
|
174
|
+
return;
|
|
133
175
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
176
|
+
y(!1), r("inEdition", !1, { shouldDirty: !0 });
|
|
177
|
+
}, [c, r]);
|
|
178
|
+
return U(() => ({
|
|
179
|
+
inEdition: O,
|
|
180
|
+
handleDraw: P,
|
|
181
|
+
handleFinish: w,
|
|
182
|
+
geometrTypeIdCached: a,
|
|
183
|
+
isInteractionAvailable: S
|
|
184
|
+
}), [a, P, w, O, S]);
|
|
141
185
|
}
|
|
142
186
|
export {
|
|
143
|
-
|
|
187
|
+
pe as useDrawing
|
|
144
188
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneralData.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/GeneralData.tsx"],"names":[],"mappings":"AAoBA;;GAEG;AACH,wBAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"GeneralData.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/GeneralData.tsx"],"names":[],"mappings":"AAoBA;;GAEG;AACH,wBAAgB,WAAW,qDAoE1B"}
|
|
@@ -1,44 +1,50 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useModuleDictionary as
|
|
3
|
-
import { PaperForm as
|
|
4
|
-
import { useDrawing as
|
|
1
|
+
import { jsxs as n, jsx as e } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useModuleDictionary as L } from "@m4l/core";
|
|
3
|
+
import { PaperForm as f, RHFTextField as r, Stack as l, RHFSelect as g, Button as A, RHFHelperError as m } from "@m4l/components";
|
|
4
|
+
import { useDrawing as E } from "../../hooks/useDrawing.js";
|
|
5
5
|
import { MAP_GPSTOOLS_DICCTIONARY as i } from "../../../../../../dictionary.js";
|
|
6
|
-
import { useGeneral as
|
|
7
|
-
function
|
|
8
|
-
const { getLabel: t } =
|
|
9
|
-
|
|
6
|
+
import { useGeneral as I } from "./hooks/useGeneral.js";
|
|
7
|
+
function y() {
|
|
8
|
+
const { getLabel: t } = L(), {
|
|
9
|
+
inEdition: o,
|
|
10
|
+
handleDraw: s,
|
|
11
|
+
handleFinish: c,
|
|
12
|
+
geometrTypeIdCached: a,
|
|
13
|
+
isInteractionAvailable: d
|
|
14
|
+
} = E(), { urlIcon: p, geofencesTypes: u } = I();
|
|
15
|
+
return /* @__PURE__ */ n(f, { urlIcon: p, title: t(i.PAPER_GENERAL), variant: "text", isForm: !0, children: [
|
|
10
16
|
/* @__PURE__ */ e(
|
|
11
|
-
|
|
17
|
+
r,
|
|
12
18
|
{
|
|
13
19
|
name: "name",
|
|
14
20
|
type: "text",
|
|
15
21
|
label: t(`${i.LABEL_NAME}`)
|
|
16
22
|
}
|
|
17
23
|
),
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ n(l, { direction: "column", spacing: 1, alignItems: "flex-start", children: [
|
|
25
|
+
/* @__PURE__ */ n(l, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
20
26
|
/* @__PURE__ */ e(
|
|
21
|
-
|
|
27
|
+
g,
|
|
22
28
|
{
|
|
23
29
|
name: "geofenceTypeId",
|
|
24
|
-
options:
|
|
30
|
+
options: u
|
|
25
31
|
}
|
|
26
32
|
),
|
|
27
33
|
/* @__PURE__ */ e(
|
|
28
|
-
|
|
34
|
+
A,
|
|
29
35
|
{
|
|
30
|
-
onClick:
|
|
31
|
-
disabled: !o,
|
|
32
|
-
label: t(
|
|
36
|
+
onClick: o ? c : s,
|
|
37
|
+
disabled: !a || !o && !d,
|
|
38
|
+
label: t(o ? i.LABEL_FINISH : i.LABEL_DRAW)
|
|
33
39
|
}
|
|
34
40
|
)
|
|
35
41
|
] }),
|
|
36
42
|
/* @__PURE__ */ e(m, { name: "geometry" }, "geometry"),
|
|
37
43
|
/* @__PURE__ */ e(m, { name: "inEdition" }, "inEdition"),
|
|
38
|
-
|
|
39
|
-
/* @__PURE__ */
|
|
44
|
+
a && a === "gt_circle" && // <HelperText variant='info' message={'undefined'} />
|
|
45
|
+
/* @__PURE__ */ n(l, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
40
46
|
/* @__PURE__ */ e(
|
|
41
|
-
|
|
47
|
+
r,
|
|
42
48
|
{
|
|
43
49
|
name: "properties.radius",
|
|
44
50
|
label: t(i.LABEL_RADIUS),
|
|
@@ -48,7 +54,7 @@ function x() {
|
|
|
48
54
|
}
|
|
49
55
|
),
|
|
50
56
|
/* @__PURE__ */ e(
|
|
51
|
-
|
|
57
|
+
r,
|
|
52
58
|
{
|
|
53
59
|
name: "lat",
|
|
54
60
|
label: t(i.LABEL_LAT),
|
|
@@ -58,7 +64,7 @@ function x() {
|
|
|
58
64
|
}
|
|
59
65
|
),
|
|
60
66
|
/* @__PURE__ */ e(
|
|
61
|
-
|
|
67
|
+
r,
|
|
62
68
|
{
|
|
63
69
|
name: "lng",
|
|
64
70
|
label: t(i.LABEL_LON),
|
|
@@ -72,5 +78,5 @@ function x() {
|
|
|
72
78
|
] });
|
|
73
79
|
}
|
|
74
80
|
export {
|
|
75
|
-
|
|
81
|
+
y as GeneralData
|
|
76
82
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentRenderPropFeature } from '../../../../../GpsMap/contexts/MapContext';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* `GeofenceFeatureRender` renders geofences on the map.
|
|
4
4
|
*/
|
|
5
5
|
export declare const GeofenceFeatureRender: ComponentRenderPropFeature;
|
|
6
6
|
//# sourceMappingURL=GeofenceFeatureRender.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeofenceFeatureRender.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAcvF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"GeofenceFeatureRender.d.ts","sourceRoot":"","sources":["../../../../../../../../../../../../packages/gclick/src/components/maps/components/GpsMapTools/subcomponents/GeofencesTool/subcomponents/GeofenceFeatureRender/GeofenceFeatureRender.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAcvF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,0BAgJnC,CAAC"}
|
|
@@ -1,67 +1,52 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Circle as
|
|
3
|
-
import { shallow as
|
|
4
|
-
import { useMapStore as
|
|
5
|
-
import p
|
|
6
|
-
import { MarkerIconLabel as
|
|
7
|
-
import { getLabelPositionForCircle as
|
|
8
|
-
import { getStyleFromProperties as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsxs as g, jsx as s } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Circle as F, Polyline as L, Polygon as v, GeoJSON as I } from "react-leaflet";
|
|
3
|
+
import { shallow as j } from "zustand/shallow";
|
|
4
|
+
import { useMapStore as k } from "../../../../../GpsMap/hooks/useMapStore/index.js";
|
|
5
|
+
import p from "react";
|
|
6
|
+
import { MarkerIconLabel as u } from "../../../../../GpsMap/featureRenders/MarkerIconLabel/index.js";
|
|
7
|
+
import { getLabelPositionForCircle as H, getLabelPositionForLineString as M, getLabelPositionForPolygon as P } from "./helpers.js";
|
|
8
|
+
import { getStyleFromProperties as d } from "../../helpers.js";
|
|
9
|
+
import { useObservableFeatureEventHandlers as S } from "../../../../../GpsMap/hooks/useObservableFeatureEventHandlers.js";
|
|
10
|
+
const N = (b) => {
|
|
11
|
+
const { id: y, layerId: f } = b, m = S(f, y), e = k((o) => {
|
|
12
|
+
const r = o.hashLayers[f].geoJsonObject;
|
|
12
13
|
if (!r)
|
|
13
14
|
return null;
|
|
14
15
|
if (r.object.type === "FeatureCollection") {
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
16
|
+
const t = r.object.features.find((n) => n.id === y);
|
|
17
|
+
if (t)
|
|
17
18
|
return {
|
|
18
|
-
id:
|
|
19
|
-
geometry:
|
|
20
|
-
properties:
|
|
19
|
+
id: t.id,
|
|
20
|
+
geometry: t.geometry,
|
|
21
|
+
properties: t.properties
|
|
21
22
|
};
|
|
22
23
|
} else
|
|
23
|
-
throw new Error("GeofenceFeatureRender
|
|
24
|
+
throw new Error("GeofenceFeatureRender cannot be used with a single Feature payload");
|
|
24
25
|
return null;
|
|
25
|
-
},
|
|
26
|
-
if (!e)
|
|
27
|
-
return;
|
|
28
|
-
const r = {
|
|
29
|
-
// visible: true,
|
|
30
|
-
boundsNW: t.target.getBounds().getNorthWest(),
|
|
31
|
-
boundsSE: t.target.getBounds().getSouthEast(),
|
|
32
|
-
getTarget: () => t.target
|
|
33
|
-
// target: e.target,
|
|
34
|
-
};
|
|
35
|
-
f(y, e.id, r);
|
|
36
|
-
}, [e, f, y]);
|
|
26
|
+
}, j);
|
|
37
27
|
if (!e)
|
|
38
28
|
return null;
|
|
39
|
-
const
|
|
29
|
+
const c = {
|
|
40
30
|
featureId: e.id
|
|
41
31
|
};
|
|
42
32
|
if (e.geometry?.type === "Point") {
|
|
43
|
-
const [
|
|
33
|
+
const [o, r] = e.geometry.coordinates;
|
|
44
34
|
if (e.properties?.radius) {
|
|
45
|
-
const { radius:
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
35
|
+
const { radius: t, markerIconLabel: n, ...i } = e.properties, a = d(i), l = H(r, o, t);
|
|
36
|
+
return /* @__PURE__ */ g(p.Fragment, { children: [
|
|
37
|
+
/* @__PURE__ */ s(
|
|
38
|
+
F,
|
|
49
39
|
{
|
|
50
|
-
center: { lat: r, lng:
|
|
40
|
+
center: { lat: r, lng: o },
|
|
51
41
|
radius: e.properties?.radius,
|
|
52
|
-
eventHandlers:
|
|
53
|
-
add: c
|
|
54
|
-
// remove: () => {
|
|
55
|
-
// removeLefletLayerToFeature(layerId, feature.id)
|
|
56
|
-
// },
|
|
57
|
-
},
|
|
42
|
+
eventHandlers: m,
|
|
58
43
|
...a,
|
|
59
|
-
...
|
|
44
|
+
...c
|
|
60
45
|
},
|
|
61
46
|
Math.random()
|
|
62
47
|
),
|
|
63
|
-
n && /* @__PURE__ */
|
|
64
|
-
|
|
48
|
+
n && /* @__PURE__ */ s(
|
|
49
|
+
u,
|
|
65
50
|
{
|
|
66
51
|
position: l,
|
|
67
52
|
...n
|
|
@@ -70,78 +55,58 @@ const A = (F) => {
|
|
|
70
55
|
] });
|
|
71
56
|
}
|
|
72
57
|
} else if (e.geometry?.type === "LineString") {
|
|
73
|
-
const
|
|
74
|
-
(
|
|
75
|
-
), { markerIconLabel: r, ...
|
|
76
|
-
return /* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
58
|
+
const o = e.geometry.coordinates.map(
|
|
59
|
+
(i) => [i[1], i[0]]
|
|
60
|
+
), { markerIconLabel: r, ...t } = e.properties, n = d(t);
|
|
61
|
+
return /* @__PURE__ */ g(p.Fragment, { children: [
|
|
62
|
+
/* @__PURE__ */ s(
|
|
63
|
+
L,
|
|
79
64
|
{
|
|
80
|
-
positions:
|
|
65
|
+
positions: o,
|
|
81
66
|
stroke: !0,
|
|
82
|
-
eventHandlers:
|
|
83
|
-
add: c
|
|
84
|
-
// remove: () => {
|
|
85
|
-
// removeLefletLayerToFeature(layerId, feature.id)
|
|
86
|
-
// },
|
|
87
|
-
},
|
|
67
|
+
eventHandlers: m,
|
|
88
68
|
...n,
|
|
89
|
-
...
|
|
69
|
+
...c
|
|
90
70
|
},
|
|
91
71
|
Math.random()
|
|
92
72
|
),
|
|
93
|
-
r && /* @__PURE__ */
|
|
94
|
-
|
|
73
|
+
r && /* @__PURE__ */ s(
|
|
74
|
+
u,
|
|
95
75
|
{
|
|
96
|
-
position:
|
|
76
|
+
position: M(o),
|
|
97
77
|
...r
|
|
98
78
|
}
|
|
99
79
|
)
|
|
100
80
|
] });
|
|
101
81
|
} else if (e.geometry?.type === "Polygon") {
|
|
102
|
-
const
|
|
103
|
-
(
|
|
104
|
-
), { markerIconLabel: r, ...
|
|
105
|
-
return /* @__PURE__ */
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
|
|
82
|
+
const o = e.geometry.coordinates.map(
|
|
83
|
+
(i) => i.map(([a, l]) => [l, a])
|
|
84
|
+
), { markerIconLabel: r, ...t } = e.properties, n = d(t);
|
|
85
|
+
return /* @__PURE__ */ g(p.Fragment, { children: [
|
|
86
|
+
/* @__PURE__ */ s(
|
|
87
|
+
v,
|
|
108
88
|
{
|
|
109
|
-
positions:
|
|
110
|
-
eventHandlers:
|
|
111
|
-
add: c
|
|
112
|
-
// remove: () => {
|
|
113
|
-
// removeLefletLayerToFeature(layerId, feature.id)
|
|
114
|
-
// },
|
|
115
|
-
},
|
|
89
|
+
positions: o,
|
|
90
|
+
eventHandlers: m,
|
|
116
91
|
...n,
|
|
117
|
-
...
|
|
92
|
+
...c
|
|
118
93
|
}
|
|
119
94
|
),
|
|
120
|
-
r && /* @__PURE__ */
|
|
95
|
+
r && /* @__PURE__ */ s(u, { position: P(o), ...r })
|
|
121
96
|
] });
|
|
122
97
|
} else if (e.geometry?.type === "MultiPolygon") {
|
|
123
|
-
const
|
|
124
|
-
(
|
|
125
|
-
(a) => a.map(([l,
|
|
98
|
+
const o = e.geometry.coordinates.map(
|
|
99
|
+
(i) => i.map(
|
|
100
|
+
(a) => a.map(([l, h]) => [h, l])
|
|
126
101
|
)
|
|
127
|
-
), { markerIconLabel: r, ...
|
|
128
|
-
return /* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
-
|
|
131
|
-
{
|
|
132
|
-
data: e.geometry,
|
|
133
|
-
...n,
|
|
134
|
-
...m,
|
|
135
|
-
eventHandlers: {
|
|
136
|
-
add: c
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
),
|
|
140
|
-
r && /* @__PURE__ */ i(p.Fragment, { children: t.map((s, a) => /* @__PURE__ */ i(g, { position: h(s), ...r, label: `${r.label} (${a + 1}/${t.length})` }, a)) })
|
|
102
|
+
), { markerIconLabel: r, ...t } = e.properties, n = d(t);
|
|
103
|
+
return /* @__PURE__ */ g(p.Fragment, { children: [
|
|
104
|
+
/* @__PURE__ */ s(I, { data: e.geometry, eventHandlers: m, ...n, ...c }),
|
|
105
|
+
r && /* @__PURE__ */ s(p.Fragment, { children: o.map((i, a) => /* @__PURE__ */ s(u, { position: P(i), ...r, label: `${r.label} (${a + 1}/${o.length})` }, a)) })
|
|
141
106
|
] });
|
|
142
107
|
}
|
|
143
108
|
return null;
|
|
144
109
|
};
|
|
145
110
|
export {
|
|
146
|
-
|
|
111
|
+
N as GeofenceFeatureRender
|
|
147
112
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './components/GpsMap';
|
|
2
|
+
export { isObservableFeatureEventCaptured } from './components/GpsMap';
|
|
2
3
|
export * from './utils';
|
|
3
4
|
export type { MapProps, RendePropFeatureArgs, ComponentRenderPropFeature, FeatureId, FeatureCollection, Feature, Geometry, } from './components/GpsMap';
|
|
4
5
|
export * from './components/GpsMapTools';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/maps/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/maps/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AAEvE,cAAc,SAAS,CAAC;AACxB,YAAY,EACV,QAAQ,EACR,oBAAoB,EACpB,0BAA0B,EAC1B,SAAS,EACT,iBAAiB,EACjB,OAAO,EACP,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAE7B,cAAc,0BAA0B,CAAC;AAGzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC"}
|