@rio-cloud/rio-uikit 2.3.0-beta.2 → 2.3.0-beta.3
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/Marker.js +9 -5
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.d.ts +38 -3
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js +104 -109
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js.map +1 -1
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.d.ts +24 -5
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js +60 -56
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js.map +1 -1
- package/components/datepicker/DayPicker.js +72 -70
- package/components/datepicker/DayPicker.js.map +1 -1
- package/components/datepicker/DayPickerDropdown.d.ts +1 -0
- package/components/datepicker/DayPickerDropdown.js +61 -48
- package/components/datepicker/DayPickerDropdown.js.map +1 -1
- package/components/datepicker/useStackedDayPickerCalendars.js +26 -26
- package/components/datepicker/useStackedDayPickerCalendars.js.map +1 -1
- package/components/listMenu/ListMenu.d.ts +8 -0
- package/components/listMenu/ListMenu.js +74 -66
- package/components/listMenu/ListMenu.js.map +1 -1
- package/components/map/components/Map.js +189 -157
- package/components/map/components/Map.js.map +1 -1
- package/components/map/components/MapContext.d.ts +1 -0
- package/components/map/components/MapContext.js +8 -7
- package/components/map/components/MapContext.js.map +1 -1
- package/components/map/components/features/Route.d.ts +65 -1
- package/components/map/components/features/Route.js +184 -98
- package/components/map/components/features/Route.js.map +1 -1
- package/components/map/components/features/basics/Marker.d.ts +21 -1
- package/components/map/components/features/basics/Marker.js +99 -40
- package/components/map/components/features/basics/Marker.js.map +1 -1
- package/components/map/components/features/basics/Polygon.d.ts +24 -1
- package/components/map/components/features/basics/Polygon.js +72 -19
- package/components/map/components/features/basics/Polygon.js.map +1 -1
- package/components/map/components/features/basics/Polyline.d.ts +29 -0
- package/components/map/components/features/basics/Polyline.js +69 -39
- package/components/map/components/features/basics/Polyline.js.map +1 -1
- package/components/map/components/features/layers/MarkerLayer.js +8 -8
- package/components/map/components/features/layers/MarkerLayer.js.map +1 -1
- package/components/map/components/features/layers/clustering/SimpleClusterLayer.js +13 -6
- package/components/map/components/features/layers/clustering/SimpleClusterLayer.js.map +1 -1
- package/components/map/utils/clustering.d.ts +1 -1
- package/components/map/utils/clustering.js +30 -30
- package/components/map/utils/clustering.js.map +1 -1
- package/components/map/utils/mapTypes.d.ts +135 -0
- package/components/map/utils/mapTypes.js.map +1 -1
- package/components/mapMarker/ClusterMapMarker.d.ts +2 -0
- package/components/mapMarker/ClusterMapMarker.js.map +1 -1
- package/components/mapMarker/SingleMapMarker.d.ts +2 -0
- package/components/mapMarker/SingleMapMarker.js.map +1 -1
- package/components/selects/ClearButton.js +9 -7
- package/components/selects/ClearButton.js.map +1 -1
- package/components/table/Table.js +208 -205
- package/components/table/Table.js.map +1 -1
- package/components/table/Table.types.d.ts +13 -4
- package/components/table/TableColumn.d.ts +8 -1
- package/components/table/TableColumn.js +66 -64
- package/components/table/TableColumn.js.map +1 -1
- package/components/table/TableExpandedRow.js +11 -11
- package/components/table/TableExpandedRow.js.map +1 -1
- package/components/table/TableHeader.d.ts +17 -0
- package/components/table/TableHeader.js +89 -76
- package/components/table/TableHeader.js.map +1 -1
- package/components/table/TableHeaderColumn.d.ts +11 -1
- package/components/table/TableHeaderColumn.js +63 -58
- package/components/table/TableHeaderColumn.js.map +1 -1
- package/components/table/TableRow.d.ts +6 -0
- package/components/table/TableRow.js +49 -48
- package/components/table/TableRow.js.map +1 -1
- package/components/table/context/TableLayoutContext.d.ts +1 -0
- package/components/table/context/TableLayoutContext.js.map +1 -1
- package/components/table/layout/useHorizontalSectionSync.d.ts +2 -1
- package/components/table/layout/useHorizontalSectionSync.js +32 -31
- package/components/table/layout/useHorizontalSectionSync.js.map +1 -1
- package/components/table/layout/useTableLayout.d.ts +2 -1
- package/components/table/layout/useTableLayout.js +37 -30
- package/components/table/layout/useTableLayout.js.map +1 -1
- package/components/table/render/header/TableDraggableHeaderCell.js +38 -36
- package/components/table/render/header/TableDraggableHeaderCell.js.map +1 -1
- package/components/table/render/header/TableHeader.types.d.ts +2 -0
- package/components/table/render/header/TableHeaderCellContent.js +16 -16
- package/components/table/render/header/TableHeaderCellContent.js.map +1 -1
- package/components/table/render/header/TableStaticHeaderCell.js +31 -29
- package/components/table/render/header/TableStaticHeaderCell.js.map +1 -1
- package/components/table/render/header/resolveHeaderCellClassName.d.ts +1 -0
- package/components/table/render/header/resolveHeaderCellClassName.js +10 -9
- package/components/table/render/header/resolveHeaderCellClassName.js.map +1 -1
- package/components/table/runtime/useResolvedRenderColumns.d.ts +4 -4
- package/components/table/runtime/useResolvedRenderColumns.js +13 -13
- package/components/table/runtime/useResolvedRenderColumns.js.map +1 -1
- package/components/table/runtime/useResolvedRenderHeader.d.ts +1 -1
- package/components/table/runtime/useResolvedRenderHeader.js.map +1 -1
- package/hooks/useDraggableElement.d.ts +27 -5
- package/hooks/useDraggableElement.js +100 -23
- package/hooks/useDraggableElement.js.map +1 -1
- package/hooks/usePopperDropdown.d.ts +1 -0
- package/hooks/usePopperDropdown.js +15 -12
- package/hooks/usePopperDropdown.js.map +1 -1
- package/package.json +1 -1
- package/utils/analytics/createAnalyticsOverlayTooltip.js.map +1 -1
- package/utils/init/initConfig.js +5 -5
- package/utils/init/initConfig.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
|
@@ -1,193 +1,225 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { isEmpty as
|
|
4
|
-
import { isEqual as
|
|
5
|
-
import { DEFAULT_MAX_ZOOM as
|
|
6
|
-
import { removeEventListenerMap as
|
|
7
|
-
import { MapContext as
|
|
8
|
-
import { getMapBounds as
|
|
9
|
-
import { getHereUi as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { getPlatform as
|
|
17
|
-
const
|
|
1
|
+
import { jsx as l, jsxs as xe } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as C, useState as m, useEffect as p } from "react";
|
|
3
|
+
import { isEmpty as Ze } from "es-toolkit/compat";
|
|
4
|
+
import { isEqual as Fe } from "es-toolkit/predicate";
|
|
5
|
+
import { DEFAULT_MAX_ZOOM as ie, MAP_TYPE_DEFAULT as P, DEFAULT_PIXEL_RATIO as Be, DEFAULT_MIN_ZOOM as ke, MAP_LAYER_ROAD_RESTRICTIONS as le, MAP_TYPE_NIGHT as F, MAP_TYPE_FLEET_STYLE as He, MAP_TYPE_SATELLITE as Ue, MAP_TYPE_TERRAIN as ze, MAP_LAYER_INCIDENTS as je, MAP_LAYER_TRAFFIC as Ve } from "./constants.js";
|
|
6
|
+
import { removeEventListenerMap as We, addEventListenerMap as qe } from "../utils/eventHandling.js";
|
|
7
|
+
import { MapContext as Ge } from "./MapContext.js";
|
|
8
|
+
import { getMapBounds as Ke, createUtils as Xe } from "../utils/mapUtils.js";
|
|
9
|
+
import { getHereUi as $e } from "../utils/mapUi.js";
|
|
10
|
+
import Je from "../../../hooks/useDarkMode.js";
|
|
11
|
+
import Qe from "./features/MapZoom.js";
|
|
12
|
+
import et from "./features/layers/MapOverlayLayers.js";
|
|
13
|
+
import tt from "./MapSize.js";
|
|
14
|
+
import nt from "./MapPosition.js";
|
|
15
|
+
import at from "./MapElements.js";
|
|
16
|
+
import { getPlatform as ot, getBaseLayer as rt, getEngineType as st } from "../utils/rendering.js";
|
|
17
|
+
const it = "map-disable-marker-pointer-events", lt = 140, r = (me) => {
|
|
18
18
|
const {
|
|
19
|
-
children:
|
|
20
|
-
credentials:
|
|
21
|
-
width:
|
|
22
|
-
height:
|
|
23
|
-
language:
|
|
24
|
-
center:
|
|
25
|
-
zoom:
|
|
26
|
-
zoomAnimation:
|
|
27
|
-
boundingBox:
|
|
28
|
-
hideClusterSettings:
|
|
29
|
-
hideMapLayerSettings:
|
|
30
|
-
disableMapEvents:
|
|
31
|
-
disableBehavior:
|
|
32
|
-
disableZoomMomentum:
|
|
33
|
-
eventListenerMap:
|
|
34
|
-
mapType:
|
|
35
|
-
mapLayer:
|
|
36
|
-
showCluster:
|
|
37
|
-
showScaleBar:
|
|
38
|
-
onMapLayerChange:
|
|
19
|
+
children: pe,
|
|
20
|
+
credentials: B,
|
|
21
|
+
width: k,
|
|
22
|
+
height: U,
|
|
23
|
+
language: ce = "en",
|
|
24
|
+
center: z,
|
|
25
|
+
zoom: j,
|
|
26
|
+
zoomAnimation: V = !1,
|
|
27
|
+
boundingBox: y,
|
|
28
|
+
hideClusterSettings: Ee = !1,
|
|
29
|
+
hideMapLayerSettings: ue = !1,
|
|
30
|
+
disableMapEvents: W,
|
|
31
|
+
disableBehavior: q = !1,
|
|
32
|
+
disableZoomMomentum: de = !0,
|
|
33
|
+
eventListenerMap: he,
|
|
34
|
+
mapType: L = P,
|
|
35
|
+
mapLayer: c = [],
|
|
36
|
+
showCluster: S = !0,
|
|
37
|
+
showScaleBar: ve = !1,
|
|
38
|
+
onMapLayerChange: Me = () => {
|
|
39
39
|
},
|
|
40
|
-
onMapTypeChange:
|
|
40
|
+
onMapTypeChange: fe = () => {
|
|
41
41
|
},
|
|
42
|
-
onShowClusterChange:
|
|
42
|
+
onShowClusterChange: Le = () => {
|
|
43
43
|
},
|
|
44
|
-
onZoomIn:
|
|
44
|
+
onZoomIn: Te = () => {
|
|
45
45
|
},
|
|
46
|
-
onZoomOut:
|
|
46
|
+
onZoomOut: ge = () => {
|
|
47
47
|
},
|
|
48
|
-
onIncidentsChange:
|
|
48
|
+
onIncidentsChange: _e = () => {
|
|
49
49
|
},
|
|
50
|
-
mapSettingsTooltip:
|
|
51
|
-
mapSettings:
|
|
52
|
-
enableWebGL:
|
|
53
|
-
enableDevicePixelRatio:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
T((
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
mapSettingsTooltip: Ae,
|
|
51
|
+
mapSettings: G,
|
|
52
|
+
enableWebGL: E = !0,
|
|
53
|
+
enableDevicePixelRatio: K = !0,
|
|
54
|
+
enableMarkerIconCache: Re = !0,
|
|
55
|
+
disableMarkerPointerEventsWhileZooming: u = !1,
|
|
56
|
+
pixelRatio: X = Be,
|
|
57
|
+
minZoom: T = ke,
|
|
58
|
+
maxZoom: I = ie
|
|
59
|
+
} = me;
|
|
60
|
+
let b = I;
|
|
61
|
+
T > I && (b = ie, console.error("Invalid condition for zoom limits: min <= max)"));
|
|
62
|
+
const w = C(null), d = C(), $ = C(!1), O = C(u), [Ce, Pe] = m(!1), [t, ye] = m(), [a, Se] = m(L), [o, J] = m(c), [Q, ee] = m(S), te = K && window.devicePixelRatio || X, i = /* @__PURE__ */ ((e) => e === "nb" ? "no" : e)(ce.split("-")[0].toLowerCase()), h = (e) => {
|
|
63
|
+
if (e && !O.current)
|
|
64
|
+
return;
|
|
65
|
+
const s = w.current;
|
|
66
|
+
s && (s.classList.toggle(it, e), $.current = e);
|
|
67
|
+
}, v = () => {
|
|
68
|
+
d.current !== void 0 && (window.clearTimeout(d.current), d.current = void 0);
|
|
69
|
+
}, ne = () => {
|
|
70
|
+
v(), d.current = window.setTimeout(() => {
|
|
71
|
+
h(!1), d.current = void 0;
|
|
72
|
+
}, lt);
|
|
73
|
+
}, ae = () => {
|
|
74
|
+
O.current && (v(), $.current || h(!0));
|
|
75
|
+
};
|
|
76
|
+
p(() => {
|
|
77
|
+
O.current = u;
|
|
78
|
+
}, [u]), p(() => {
|
|
79
|
+
let e = [], s = () => {
|
|
80
|
+
};
|
|
81
|
+
t?.map ? (e = t.map.getObjects(), console.debug("re-initialize here map")) : console.debug("initialize here map"), t?.map && (console.debug("disposing previous map"), We(t.map), t.mapEvents && t.mapEvents.dispose(), t.map.dispose());
|
|
82
|
+
const A = y && Ke(y), M = ot(B), f = st(a, E), Y = M.createDefaultLayers({ engineType: f, lg: i, pois: !0 });
|
|
83
|
+
return rt({
|
|
84
|
+
baseLayerName: a,
|
|
85
|
+
defaultLayers: Y,
|
|
86
|
+
enableWebGL: E,
|
|
87
|
+
platform: M,
|
|
88
|
+
engineType: f,
|
|
89
|
+
vehicleRestrictions: o.includes(le),
|
|
72
90
|
language: i,
|
|
73
|
-
minZoom:
|
|
74
|
-
maxZoom:
|
|
75
|
-
}).then((
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
91
|
+
minZoom: T,
|
|
92
|
+
maxZoom: b
|
|
93
|
+
}).then((x) => {
|
|
94
|
+
const re = () => {
|
|
95
|
+
ae();
|
|
96
|
+
}, se = () => {
|
|
97
|
+
ne();
|
|
98
|
+
}, n = new H.Map(w.current, x.baseLayer, {
|
|
99
|
+
zoom: j,
|
|
100
|
+
center: z,
|
|
101
|
+
bounds: A,
|
|
102
|
+
engineType: f,
|
|
103
|
+
pixelRatio: te,
|
|
82
104
|
fixedCenter: !0
|
|
83
105
|
});
|
|
84
|
-
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
credentials:
|
|
90
|
-
defaultLayers:
|
|
91
|
-
map:
|
|
92
|
-
mapEvents:
|
|
93
|
-
behavior:
|
|
94
|
-
platform:
|
|
95
|
-
ui:
|
|
96
|
-
utils:
|
|
106
|
+
x.overlayLayer && n.addLayer(x.overlayLayer), Pe(!0);
|
|
107
|
+
let Z = !1, R;
|
|
108
|
+
W || (Z = new H.mapevents.MapEvents(n)), W || q || (R = new H.mapevents.Behavior(Z), R.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM), de && R.disable(H.mapevents.Behavior.Feature.ZOOM_MOMENTUM)), qe(n, he, n), n.addEventListener("mapviewchangestart", re), n.addEventListener("mapviewchangeend", se);
|
|
109
|
+
const Ye = $e(n, Y, ve, i);
|
|
110
|
+
ye({
|
|
111
|
+
credentials: B,
|
|
112
|
+
defaultLayers: Y,
|
|
113
|
+
map: n,
|
|
114
|
+
mapEvents: Z,
|
|
115
|
+
behavior: R,
|
|
116
|
+
platform: M,
|
|
117
|
+
ui: Ye,
|
|
118
|
+
utils: Xe(n),
|
|
97
119
|
// Put settings back into the map API object so the invoking service
|
|
98
120
|
// can check on these settings for instance inside a test
|
|
99
121
|
settings: {
|
|
100
|
-
enableWebGL:
|
|
101
|
-
baseLayer:
|
|
102
|
-
activeLayers:
|
|
103
|
-
showCluster:
|
|
104
|
-
minZoom:
|
|
105
|
-
maxZoom:
|
|
122
|
+
enableWebGL: E,
|
|
123
|
+
baseLayer: a,
|
|
124
|
+
activeLayers: o,
|
|
125
|
+
showCluster: Q,
|
|
126
|
+
minZoom: T,
|
|
127
|
+
maxZoom: b
|
|
106
128
|
}
|
|
107
|
-
}), e &&
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}, [
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
129
|
+
}), e && n.addObjects(e), s = () => {
|
|
130
|
+
n.removeEventListener("mapviewchangestart", re), n.removeEventListener("mapviewchangeend", se);
|
|
131
|
+
};
|
|
132
|
+
}), () => {
|
|
133
|
+
s(), v(), h(!1);
|
|
134
|
+
};
|
|
135
|
+
}, [E, K, i, a, T, I]), p(() => (u || (v(), h(!1)), () => {
|
|
136
|
+
v(), h(!1);
|
|
137
|
+
}), [u]);
|
|
138
|
+
const D = Je();
|
|
139
|
+
p(() => {
|
|
140
|
+
D && a === P ? g(F) : !D && a === F && g(P);
|
|
141
|
+
}, [D, i]), p(() => g(L), [L]);
|
|
142
|
+
const [Ie, be] = m(c);
|
|
143
|
+
Fe(c, Ie) || (J(c), be(c)), p(() => ee(S), [S]);
|
|
144
|
+
const g = (e) => {
|
|
145
|
+
Se(e), fe(e, L);
|
|
146
|
+
}, we = (e) => {
|
|
147
|
+
const s = (M) => o.filter((f) => f !== M), A = o.includes(e) ? s(e) : [...o, e];
|
|
148
|
+
J(A), Me(A, o);
|
|
149
|
+
}, Oe = (e) => {
|
|
150
|
+
ee(e), Le(e);
|
|
151
|
+
}, oe = () => {
|
|
124
152
|
document.querySelector(".AssetTree")?.classList.add("pointer-events-none");
|
|
125
|
-
},
|
|
153
|
+
}, N = () => {
|
|
126
154
|
document.querySelector(".AssetTree")?.classList.remove("pointer-events-none");
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
|
|
155
|
+
}, _ = {};
|
|
156
|
+
U && (_.height = U), k && (_.width = k);
|
|
157
|
+
const De = Ze(_) ? "height-100pct" : "", Ne = () => {
|
|
158
|
+
ae(), ne();
|
|
159
|
+
};
|
|
160
|
+
return /* @__PURE__ */ l(
|
|
131
161
|
"div",
|
|
132
162
|
{
|
|
133
|
-
className: `Map position-relative map-type-${
|
|
134
|
-
style:
|
|
135
|
-
ref:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
163
|
+
className: `Map position-relative map-type-${a.toLowerCase()} ${De}`,
|
|
164
|
+
style: _,
|
|
165
|
+
ref: w,
|
|
166
|
+
onWheelCapture: Ne,
|
|
167
|
+
onTouchStart: oe,
|
|
168
|
+
onTouchEnd: N,
|
|
169
|
+
onMouseEnter: oe,
|
|
170
|
+
onMouseOut: N,
|
|
171
|
+
onBlur: N,
|
|
172
|
+
children: Ce && t && /* @__PURE__ */ xe(
|
|
173
|
+
Ge.Provider,
|
|
143
174
|
{
|
|
144
175
|
value: {
|
|
145
176
|
api: t,
|
|
146
177
|
language: i,
|
|
147
|
-
enableWebGL:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
178
|
+
enableWebGL: E,
|
|
179
|
+
enableMarkerIconCache: Re,
|
|
180
|
+
showCluster: Q,
|
|
181
|
+
activeLayers: o,
|
|
182
|
+
baseLayer: a,
|
|
183
|
+
hideMapLayerSettings: ue,
|
|
184
|
+
hideClusterSettings: Ee,
|
|
185
|
+
onMapTypeChange: g,
|
|
186
|
+
onMapLayerChange: we,
|
|
187
|
+
onShowClusterChange: Oe,
|
|
188
|
+
mapSettingsTooltip: Ae,
|
|
189
|
+
onIncidentsChange: _e,
|
|
190
|
+
devicePixelRatio: te
|
|
159
191
|
},
|
|
160
192
|
children: [
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
|
|
193
|
+
/* @__PURE__ */ l(nt, { api: t, boundingBox: y, center: z, zoomAnimation: V }),
|
|
194
|
+
/* @__PURE__ */ l(tt, { api: t }),
|
|
195
|
+
/* @__PURE__ */ l(
|
|
196
|
+
Qe,
|
|
165
197
|
{
|
|
166
|
-
zoom:
|
|
167
|
-
hideZoomButtons:
|
|
168
|
-
onZoomIn:
|
|
169
|
-
onZoomOut:
|
|
170
|
-
zoomAnimation:
|
|
198
|
+
zoom: j,
|
|
199
|
+
hideZoomButtons: q,
|
|
200
|
+
onZoomIn: Te,
|
|
201
|
+
onZoomOut: ge,
|
|
202
|
+
zoomAnimation: V
|
|
171
203
|
}
|
|
172
204
|
),
|
|
173
|
-
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
/* @__PURE__ */
|
|
205
|
+
G && G,
|
|
206
|
+
/* @__PURE__ */ l(et, { layers: o }),
|
|
207
|
+
/* @__PURE__ */ l(at, { api: t, children: pe })
|
|
176
208
|
]
|
|
177
209
|
}
|
|
178
210
|
)
|
|
179
211
|
}
|
|
180
212
|
);
|
|
181
213
|
};
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
214
|
+
r.TYPE_DEFAULT = P;
|
|
215
|
+
r.TYPE_FLEET_STYLE = He;
|
|
216
|
+
r.TYPE_SATELLITE = Ue;
|
|
217
|
+
r.TYPE_TERRAIN = ze;
|
|
218
|
+
r.TYPE_NIGHT = F;
|
|
219
|
+
r.LAYER_INCIDENTS = je;
|
|
220
|
+
r.LAYER_TRAFFIC = Ve;
|
|
221
|
+
r.LAYER_ROAD_RESTRICTIONS = le;
|
|
190
222
|
export {
|
|
191
|
-
|
|
223
|
+
r as default
|
|
192
224
|
};
|
|
193
225
|
//# sourceMappingURL=Map.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sources":["../../../../src/components/map/components/Map.tsx"],"sourcesContent":["import { useRef, useState, useEffect, type CSSProperties } from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { isEqual } from 'es-toolkit/predicate';\n\nimport {\n MAP_TYPE_DEFAULT,\n MAP_TYPE_FLEET_STYLE,\n MAP_TYPE_SATELLITE,\n MAP_TYPE_TERRAIN,\n MAP_TYPE_NIGHT,\n MAP_LAYER_INCIDENTS,\n MAP_LAYER_TRAFFIC,\n MAP_LAYER_ROAD_RESTRICTIONS,\n DEFAULT_MIN_ZOOM,\n DEFAULT_MAX_ZOOM,\n DEFAULT_PIXEL_RATIO,\n} from './constants';\n\nimport { addEventListenerMap, removeEventListenerMap } from '../utils/eventHandling';\nimport { MapContext } from './MapContext';\nimport { createUtils, getMapBounds } from '../utils/mapUtils';\nimport { getHereUi } from '../utils/mapUi';\nimport useDarkMode from '../../../hooks/useDarkMode';\nimport MapZoom from './features/MapZoom';\nimport MapOverlayLayers from './features/layers/MapOverlayLayers';\nimport MapSize from './MapSize';\nimport MapPosition from './MapPosition';\nimport MapElements from './MapElements';\nimport type { MapApi, MapLayer, MapProps, MapType } from '../utils/mapTypes';\nimport { getPlatform, getEngineType, getBaseLayer } from '../utils/rendering';\n\nconst Map = (props: MapProps) => {\n const {\n children,\n credentials,\n width,\n height,\n language: lang = 'en',\n center,\n zoom,\n zoomAnimation = false,\n boundingBox,\n hideClusterSettings = false,\n hideMapLayerSettings = false,\n disableMapEvents,\n disableBehavior = false,\n disableZoomMomentum = true,\n eventListenerMap,\n mapType = MAP_TYPE_DEFAULT,\n mapLayer = [],\n showCluster: externalShowCluster = true,\n showScaleBar = false,\n onMapLayerChange = () => {},\n onMapTypeChange = () => {},\n onShowClusterChange = () => {},\n onZoomIn = () => {},\n onZoomOut = () => {},\n onIncidentsChange = () => {},\n mapSettingsTooltip,\n mapSettings,\n enableWebGL = true,\n enableDevicePixelRatio = true,\n pixelRatio = DEFAULT_PIXEL_RATIO,\n minZoom = DEFAULT_MIN_ZOOM,\n maxZoom = DEFAULT_MAX_ZOOM,\n } = props;\n\n let safeMaxZoom = maxZoom;\n\n if (minZoom > maxZoom) {\n // Avoid crashing the map for invalid zoom limits\n safeMaxZoom = DEFAULT_MAX_ZOOM;\n console.error('Invalid condition for zoom limits: min <= max)');\n }\n\n const mapRef = useRef<HTMLDivElement>(null);\n\n const [isMapInitialized, setMapInitialized] = useState(false);\n\n const [api, setApi] = useState<MapApi>();\n\n const [baseLayer, setBaseLayer] = useState<MapType>(mapType);\n const [activeLayers, setActiveLayers] = useState<MapLayer[]>(mapLayer);\n const [showCluster, setShowCluster] = useState(externalShowCluster);\n\n const devicePixelRatio = enableDevicePixelRatio ? window.devicePixelRatio || pixelRatio : pixelRatio;\n\n // Only short locale is supported by HERE Map\n const language = (locale => (locale === 'nb' ? 'no' : locale))(lang.split('-')[0].toLowerCase());\n\n useEffect(() => {\n let allMapObjects: H.map.Object[] = [];\n\n if (api?.map) {\n allMapObjects = api.map.getObjects();\n console.debug('re-initialize here map');\n } else {\n console.debug('initialize here map');\n }\n\n if (api?.map) {\n // Cleanup any previously initialized map before doing anything else\n console.debug('disposing previous map');\n removeEventListenerMap(api.map);\n\n if (api.mapEvents) {\n api.mapEvents.dispose();\n }\n\n api.map.dispose();\n }\n\n const bounds = boundingBox && getMapBounds(boundingBox);\n\n // Initialize communication with the platform\n const platform = getPlatform(credentials);\n\n // Specify engine type. In this example, we use HARP rendering engine, which is capable\n // of rendering vector data using the style configuration exported from the HERE Style Editor.\n // HARP engine is not the default engine, and it's not included in the mapsjs-core.js module.\n // To use this engine, you need to include mapsjs-harp.js file to your HTML page\n const engineType = getEngineType(baseLayer, enableWebGL);\n\n // Obtain the default map types from the platform object\n // @ts-expect-error-next-line: according to the Here docs, the engine type exists\n // see https://www.here.com/docs/bundle/maps-api-for-javascript-developer-guide/page/topics/harp-migrate.html\n const defaultLayers = platform.createDefaultLayers({ engineType, lg: language, pois: true });\n\n getBaseLayer({\n baseLayerName: baseLayer,\n defaultLayers,\n enableWebGL,\n platform,\n engineType,\n vehicleRestrictions: activeLayers.includes(MAP_LAYER_ROAD_RESTRICTIONS),\n language,\n minZoom,\n maxZoom: safeMaxZoom,\n }).then(defaultLayerMap => {\n // Initialize the map\n const hereMap = new H.Map(mapRef.current as Element, defaultLayerMap.baseLayer, {\n zoom,\n center,\n bounds,\n engineType,\n pixelRatio: devicePixelRatio,\n fixedCenter: true,\n });\n\n if (defaultLayerMap.overlayLayer) {\n // Special case for satellite map where we render street labels and road signs as well as additional pois as vector data\n // hereMap.setBaseLayer(defaultLayerMap.baseLayer);\n hereMap.addLayer(defaultLayerMap.overlayLayer);\n }\n\n setMapInitialized(true);\n\n let hereMapEvents: H.mapevents.MapEvents | false = false;\n let hereBehavior: H.mapevents.Behavior | undefined;\n\n if (!disableMapEvents) {\n // Enable the map event system\n hereMapEvents = new H.mapevents.MapEvents(hereMap);\n }\n\n if (!(disableMapEvents || disableBehavior)) {\n hereBehavior = new H.mapevents.Behavior(hereMapEvents as H.mapevents.MapEvents);\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM);\n\n if (disableZoomMomentum) {\n // Disable the inertia that occurs on WebGL maps when scrolling/zooming.\n // This resulted in a very high scroll sensitivity.\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.ZOOM_MOMENTUM);\n }\n }\n\n addEventListenerMap(hereMap, eventListenerMap, hereMap);\n\n const hereUi = getHereUi(hereMap, defaultLayers, showScaleBar, language);\n\n // The api will be passed to services when using a render function.\n // This allows the service to access the map internals\n setApi({\n credentials,\n defaultLayers,\n map: hereMap,\n mapEvents: hereMapEvents,\n behavior: hereBehavior,\n platform,\n ui: hereUi,\n utils: createUtils(hereMap),\n // Put settings back into the map API object so the invoking service\n // can check on these settings for instance inside a test\n settings: {\n enableWebGL,\n baseLayer,\n activeLayers,\n showCluster,\n minZoom,\n maxZoom: safeMaxZoom,\n },\n });\n\n if (allMapObjects) {\n // If the base layer changed, re-add all previous objects again,\n // otherwise the map would be empty\n hereMap.addObjects(allMapObjects);\n }\n });\n }, [enableWebGL, enableDevicePixelRatio, language, baseLayer, minZoom, maxZoom]);\n\n const isDarkMode = useDarkMode();\n useEffect(() => {\n // Toggle night map only if current map type is default\n if (isDarkMode && baseLayer === MAP_TYPE_DEFAULT) {\n handleMapTypeChange(MAP_TYPE_NIGHT);\n }\n // Toggle back to default map only if current map type is night\n else if (!isDarkMode && baseLayer === MAP_TYPE_NIGHT) {\n handleMapTypeChange(MAP_TYPE_DEFAULT);\n }\n }, [isDarkMode, language]);\n\n // Update MapType from outside\n useEffect(() => handleMapTypeChange(mapType), [mapType]);\n\n // Update MapLayer from outside\n const [previousMapLayer, setPreviousMapLayer] = useState(mapLayer);\n if (!isEqual(mapLayer, previousMapLayer)) {\n setActiveLayers(mapLayer);\n setPreviousMapLayer(mapLayer);\n }\n\n // Update Cluster setting from outside\n useEffect(() => setShowCluster(externalShowCluster), [externalShowCluster]);\n\n const handleMapTypeChange = (newMapType: MapType) => {\n setBaseLayer(newMapType);\n onMapTypeChange(newMapType, mapType);\n };\n\n const handleMapLayerChange = (layer: MapLayer) => {\n const removeLayer = (layerToRemove: string) => activeLayers.filter(item => item !== layerToRemove);\n const newActiveLayers = activeLayers.includes(layer) ? removeLayer(layer) : [...activeLayers, layer];\n setActiveLayers(newActiveLayers);\n onMapLayerChange(newActiveLayers, activeLayers);\n };\n\n const handleShowClusterChange = (newShowCluster: boolean) => {\n setShowCluster(newShowCluster);\n onShowClusterChange(newShowCluster);\n };\n\n // Note: For performance reasons, we deactivate pointer events and hence CSS style recalculation for the\n // the body. Having for instance many assets in the tree causes a performance loss when clicking on the map\n // to move it and zoom in/out since the map triggers a style invalidation and recalculation and\n // due to the nature of the AssetTree with it's hundreds DOM nodes, applying the CSS selectors\n // takes time.\n const handleMapInteractionStart = () => {\n document.querySelector('.AssetTree')?.classList.add('pointer-events-none');\n };\n const handleMapInteractionEnd = () => {\n document.querySelector('.AssetTree')?.classList.remove('pointer-events-none');\n };\n\n const style: CSSProperties = {};\n if (height) {\n style.height = height;\n }\n if (width) {\n style.width = width;\n }\n const autoHeightClass = isEmpty(style) ? 'height-100pct' : '';\n\n return (\n <div\n className={`Map position-relative map-type-${baseLayer.toLowerCase()} ${autoHeightClass}`}\n style={style}\n ref={mapRef}\n onTouchStart={handleMapInteractionStart}\n onTouchEnd={handleMapInteractionEnd}\n onMouseEnter={handleMapInteractionStart}\n onMouseOut={handleMapInteractionEnd}\n onBlur={handleMapInteractionEnd}\n >\n {isMapInitialized && api && (\n <MapContext.Provider\n value={{\n api,\n language,\n enableWebGL,\n showCluster,\n activeLayers,\n baseLayer,\n hideMapLayerSettings,\n hideClusterSettings,\n onMapTypeChange: handleMapTypeChange,\n onMapLayerChange: handleMapLayerChange,\n onShowClusterChange: handleShowClusterChange,\n mapSettingsTooltip,\n onIncidentsChange,\n devicePixelRatio,\n }}\n >\n <MapPosition api={api} boundingBox={boundingBox} center={center} zoomAnimation={zoomAnimation} />\n <MapSize api={api} />\n <MapZoom\n zoom={zoom}\n hideZoomButtons={disableBehavior}\n onZoomIn={onZoomIn}\n onZoomOut={onZoomOut}\n zoomAnimation={zoomAnimation}\n />\n {mapSettings && mapSettings}\n <MapOverlayLayers layers={activeLayers} />\n <MapElements api={api}>{children}</MapElements>\n </MapContext.Provider>\n )}\n </div>\n );\n};\n\nMap.TYPE_DEFAULT = MAP_TYPE_DEFAULT;\nMap.TYPE_FLEET_STYLE = MAP_TYPE_FLEET_STYLE;\nMap.TYPE_SATELLITE = MAP_TYPE_SATELLITE;\nMap.TYPE_TERRAIN = MAP_TYPE_TERRAIN;\nMap.TYPE_NIGHT = MAP_TYPE_NIGHT;\n\nMap.LAYER_INCIDENTS = MAP_LAYER_INCIDENTS;\nMap.LAYER_TRAFFIC = MAP_LAYER_TRAFFIC;\nMap.LAYER_ROAD_RESTRICTIONS = MAP_LAYER_ROAD_RESTRICTIONS;\n\nexport default Map;\n"],"names":["Map","props","children","credentials","width","height","lang","center","zoom","zoomAnimation","boundingBox","hideClusterSettings","hideMapLayerSettings","disableMapEvents","disableBehavior","disableZoomMomentum","eventListenerMap","mapType","MAP_TYPE_DEFAULT","mapLayer","externalShowCluster","showScaleBar","onMapLayerChange","onMapTypeChange","onShowClusterChange","onZoomIn","onZoomOut","onIncidentsChange","mapSettingsTooltip","mapSettings","enableWebGL","enableDevicePixelRatio","pixelRatio","DEFAULT_PIXEL_RATIO","minZoom","DEFAULT_MIN_ZOOM","maxZoom","DEFAULT_MAX_ZOOM","safeMaxZoom","mapRef","useRef","isMapInitialized","setMapInitialized","useState","api","setApi","baseLayer","setBaseLayer","activeLayers","setActiveLayers","showCluster","setShowCluster","devicePixelRatio","language","locale","useEffect","allMapObjects","removeEventListenerMap","bounds","getMapBounds","platform","getPlatform","engineType","getEngineType","defaultLayers","getBaseLayer","MAP_LAYER_ROAD_RESTRICTIONS","defaultLayerMap","hereMap","hereMapEvents","hereBehavior","addEventListenerMap","hereUi","getHereUi","createUtils","isDarkMode","useDarkMode","handleMapTypeChange","MAP_TYPE_NIGHT","previousMapLayer","setPreviousMapLayer","isEqual","newMapType","handleMapLayerChange","layer","removeLayer","layerToRemove","item","newActiveLayers","handleShowClusterChange","newShowCluster","handleMapInteractionStart","handleMapInteractionEnd","style","autoHeightClass","isEmpty","jsx","jsxs","MapContext","MapPosition","MapSize","MapZoom","MapOverlayLayers","MapElements","MAP_TYPE_FLEET_STYLE","MAP_TYPE_SATELLITE","MAP_TYPE_TERRAIN","MAP_LAYER_INCIDENTS","MAP_LAYER_TRAFFIC"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAMA,IAAM,CAACC,MAAoB;AAC7B,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAUC,IAAO;AAAA,IACjB,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,aAAAC;AAAA,IACA,qBAAAC,KAAsB;AAAA,IACtB,sBAAAC,KAAuB;AAAA,IACvB,kBAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,qBAAAC,KAAsB;AAAA,IACtB,kBAAAC;AAAA,IACA,SAAAC,IAAUC;AAAA,IACV,UAAAC,IAAW,CAAA;AAAA,IACX,aAAaC,IAAsB;AAAA,IACnC,cAAAC,KAAe;AAAA,IACf,kBAAAC,KAAmB,MAAM;AAAA,IAAC;AAAA,IAC1B,iBAAAC,KAAkB,MAAM;AAAA,IAAC;AAAA,IACzB,qBAAAC,KAAsB,MAAM;AAAA,IAAC;AAAA,IAC7B,UAAAC,KAAW,MAAM;AAAA,IAAC;AAAA,IAClB,WAAAC,KAAY,MAAM;AAAA,IAAC;AAAA,IACnB,mBAAAC,KAAoB,MAAM;AAAA,IAAC;AAAA,IAC3B,oBAAAC;AAAA,IACA,aAAAC;AAAA,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AAA,MAAA;AAAA,IACrC;AAAA,EAAA;AAIhB;AAEAF,EAAI,eAAekB;AACnBlB,EAAI,mBAAmBwG;AACvBxG,EAAI,iBAAiByG;AACrBzG,EAAI,eAAe0G;AACnB1G,EAAI,aAAa8E;AAEjB9E,EAAI,kBAAkB2G;AACtB3G,EAAI,gBAAgB4G;AACpB5G,EAAI,0BAA0BkE;"}
|
|
1
|
+
{"version":3,"file":"Map.js","sources":["../../../../src/components/map/components/Map.tsx"],"sourcesContent":["import { useRef, useState, useEffect, type CSSProperties } from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { isEqual } from 'es-toolkit/predicate';\n\nimport {\n MAP_TYPE_DEFAULT,\n MAP_TYPE_FLEET_STYLE,\n MAP_TYPE_SATELLITE,\n MAP_TYPE_TERRAIN,\n MAP_TYPE_NIGHT,\n MAP_LAYER_INCIDENTS,\n MAP_LAYER_TRAFFIC,\n MAP_LAYER_ROAD_RESTRICTIONS,\n DEFAULT_MIN_ZOOM,\n DEFAULT_MAX_ZOOM,\n DEFAULT_PIXEL_RATIO,\n} from './constants';\n\nimport { addEventListenerMap, removeEventListenerMap } from '../utils/eventHandling';\nimport { MapContext } from './MapContext';\nimport { createUtils, getMapBounds } from '../utils/mapUtils';\nimport { getHereUi } from '../utils/mapUi';\nimport useDarkMode from '../../../hooks/useDarkMode';\nimport MapZoom from './features/MapZoom';\nimport MapOverlayLayers from './features/layers/MapOverlayLayers';\nimport MapSize from './MapSize';\nimport MapPosition from './MapPosition';\nimport MapElements from './MapElements';\nimport type { MapApi, MapLayer, MapProps, MapType } from '../utils/mapTypes';\nimport { getPlatform, getEngineType, getBaseLayer } from '../utils/rendering';\n\nconst MARKER_POINTER_EVENTS_DISABLED_CLASS = 'map-disable-marker-pointer-events';\nconst MARKER_POINTER_EVENTS_RESET_DELAY_MS = 140;\n\nconst Map = (props: MapProps) => {\n const {\n children,\n credentials,\n width,\n height,\n language: lang = 'en',\n center,\n zoom,\n zoomAnimation = false,\n boundingBox,\n hideClusterSettings = false,\n hideMapLayerSettings = false,\n disableMapEvents,\n disableBehavior = false,\n disableZoomMomentum = true,\n eventListenerMap,\n mapType = MAP_TYPE_DEFAULT,\n mapLayer = [],\n showCluster: externalShowCluster = true,\n showScaleBar = false,\n onMapLayerChange = () => {},\n onMapTypeChange = () => {},\n onShowClusterChange = () => {},\n onZoomIn = () => {},\n onZoomOut = () => {},\n onIncidentsChange = () => {},\n mapSettingsTooltip,\n mapSettings,\n enableWebGL = true,\n enableDevicePixelRatio = true,\n enableMarkerIconCache = true,\n disableMarkerPointerEventsWhileZooming = false,\n pixelRatio = DEFAULT_PIXEL_RATIO,\n minZoom = DEFAULT_MIN_ZOOM,\n maxZoom = DEFAULT_MAX_ZOOM,\n } = props;\n\n let safeMaxZoom = maxZoom;\n\n if (minZoom > maxZoom) {\n // Avoid crashing the map for invalid zoom limits\n safeMaxZoom = DEFAULT_MAX_ZOOM;\n console.error('Invalid condition for zoom limits: min <= max)');\n }\n\n const mapRef = useRef<HTMLDivElement>(null);\n const markerPointerEventsResetTimeoutRef = useRef<number | undefined>();\n const markerPointerEventsDisabledRef = useRef(false);\n const disableMarkerPointerEventsWhileZoomingRef = useRef(disableMarkerPointerEventsWhileZooming);\n\n const [isMapInitialized, setMapInitialized] = useState(false);\n\n const [api, setApi] = useState<MapApi>();\n\n const [baseLayer, setBaseLayer] = useState<MapType>(mapType);\n const [activeLayers, setActiveLayers] = useState<MapLayer[]>(mapLayer);\n const [showCluster, setShowCluster] = useState(externalShowCluster);\n\n const devicePixelRatio = enableDevicePixelRatio ? window.devicePixelRatio || pixelRatio : pixelRatio;\n\n // Only short locale is supported by HERE Map\n const language = (locale => (locale === 'nb' ? 'no' : locale))(lang.split('-')[0].toLowerCase());\n\n const setMarkerPointerEventsDisabled = (disabled: boolean) => {\n if (disabled && !disableMarkerPointerEventsWhileZoomingRef.current) {\n return;\n }\n\n const mapElement = mapRef.current;\n\n if (!mapElement) {\n return;\n }\n\n mapElement.classList.toggle(MARKER_POINTER_EVENTS_DISABLED_CLASS, disabled);\n markerPointerEventsDisabledRef.current = disabled;\n };\n\n const clearMarkerPointerEventsResetTimeout = () => {\n if (markerPointerEventsResetTimeoutRef.current !== undefined) {\n window.clearTimeout(markerPointerEventsResetTimeoutRef.current);\n markerPointerEventsResetTimeoutRef.current = undefined;\n }\n };\n\n const scheduleMarkerPointerEventsEnable = () => {\n clearMarkerPointerEventsResetTimeout();\n markerPointerEventsResetTimeoutRef.current = window.setTimeout(() => {\n setMarkerPointerEventsDisabled(false);\n markerPointerEventsResetTimeoutRef.current = undefined;\n }, MARKER_POINTER_EVENTS_RESET_DELAY_MS);\n };\n\n const temporarilyDisableMarkerPointerEvents = () => {\n if (!disableMarkerPointerEventsWhileZoomingRef.current) {\n return;\n }\n\n clearMarkerPointerEventsResetTimeout();\n\n if (!markerPointerEventsDisabledRef.current) {\n setMarkerPointerEventsDisabled(true);\n }\n };\n\n useEffect(() => {\n disableMarkerPointerEventsWhileZoomingRef.current = disableMarkerPointerEventsWhileZooming;\n }, [disableMarkerPointerEventsWhileZooming]);\n\n useEffect(() => {\n let allMapObjects: H.map.Object[] = [];\n let removeMapViewChangeListeners = () => {};\n\n if (api?.map) {\n allMapObjects = api.map.getObjects();\n console.debug('re-initialize here map');\n } else {\n console.debug('initialize here map');\n }\n\n if (api?.map) {\n // Cleanup any previously initialized map before doing anything else\n console.debug('disposing previous map');\n removeEventListenerMap(api.map);\n\n if (api.mapEvents) {\n api.mapEvents.dispose();\n }\n\n api.map.dispose();\n }\n\n const bounds = boundingBox && getMapBounds(boundingBox);\n\n // Initialize communication with the platform\n const platform = getPlatform(credentials);\n\n // Specify engine type. In this example, we use HARP rendering engine, which is capable\n // of rendering vector data using the style configuration exported from the HERE Style Editor.\n // HARP engine is not the default engine, and it's not included in the mapsjs-core.js module.\n // To use this engine, you need to include mapsjs-harp.js file to your HTML page\n const engineType = getEngineType(baseLayer, enableWebGL);\n\n // Obtain the default map types from the platform object\n // @ts-expect-error-next-line: according to the Here docs, the engine type exists\n // see https://www.here.com/docs/bundle/maps-api-for-javascript-developer-guide/page/topics/harp-migrate.html\n const defaultLayers = platform.createDefaultLayers({ engineType, lg: language, pois: true });\n\n getBaseLayer({\n baseLayerName: baseLayer,\n defaultLayers,\n enableWebGL,\n platform,\n engineType,\n vehicleRestrictions: activeLayers.includes(MAP_LAYER_ROAD_RESTRICTIONS),\n language,\n minZoom,\n maxZoom: safeMaxZoom,\n }).then(defaultLayerMap => {\n const handleMapViewChangeStart = () => {\n temporarilyDisableMarkerPointerEvents();\n };\n\n const handleMapViewChangeEnd = () => {\n scheduleMarkerPointerEventsEnable();\n };\n\n // Initialize the map\n const hereMap = new H.Map(mapRef.current as Element, defaultLayerMap.baseLayer, {\n zoom,\n center,\n bounds,\n engineType,\n pixelRatio: devicePixelRatio,\n fixedCenter: true,\n });\n\n if (defaultLayerMap.overlayLayer) {\n // Special case for satellite map where we render street labels and road signs as well as additional pois as vector data\n // hereMap.setBaseLayer(defaultLayerMap.baseLayer);\n hereMap.addLayer(defaultLayerMap.overlayLayer);\n }\n\n setMapInitialized(true);\n\n let hereMapEvents: H.mapevents.MapEvents | false = false;\n let hereBehavior: H.mapevents.Behavior | undefined;\n\n if (!disableMapEvents) {\n // Enable the map event system\n hereMapEvents = new H.mapevents.MapEvents(hereMap);\n }\n\n if (!(disableMapEvents || disableBehavior)) {\n hereBehavior = new H.mapevents.Behavior(hereMapEvents as H.mapevents.MapEvents);\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM);\n\n if (disableZoomMomentum) {\n // Disable the inertia that occurs on WebGL maps when scrolling/zooming.\n // This resulted in a very high scroll sensitivity.\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.ZOOM_MOMENTUM);\n }\n }\n\n addEventListenerMap(hereMap, eventListenerMap, hereMap);\n hereMap.addEventListener('mapviewchangestart', handleMapViewChangeStart as EventListener);\n hereMap.addEventListener('mapviewchangeend', handleMapViewChangeEnd as EventListener);\n\n const hereUi = getHereUi(hereMap, defaultLayers, showScaleBar, language);\n\n // The api will be passed to services when using a render function.\n // This allows the service to access the map internals\n setApi({\n credentials,\n defaultLayers,\n map: hereMap,\n mapEvents: hereMapEvents,\n behavior: hereBehavior,\n platform,\n ui: hereUi,\n utils: createUtils(hereMap),\n // Put settings back into the map API object so the invoking service\n // can check on these settings for instance inside a test\n settings: {\n enableWebGL,\n baseLayer,\n activeLayers,\n showCluster,\n minZoom,\n maxZoom: safeMaxZoom,\n },\n });\n\n if (allMapObjects) {\n // If the base layer changed, re-add all previous objects again,\n // otherwise the map would be empty\n hereMap.addObjects(allMapObjects);\n }\n\n removeMapViewChangeListeners = () => {\n hereMap.removeEventListener('mapviewchangestart', handleMapViewChangeStart as EventListener);\n hereMap.removeEventListener('mapviewchangeend', handleMapViewChangeEnd as EventListener);\n };\n });\n\n return () => {\n removeMapViewChangeListeners();\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n };\n }, [enableWebGL, enableDevicePixelRatio, language, baseLayer, minZoom, maxZoom]);\n\n useEffect(() => {\n if (!disableMarkerPointerEventsWhileZooming) {\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n }\n\n return () => {\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n };\n }, [disableMarkerPointerEventsWhileZooming]);\n\n const isDarkMode = useDarkMode();\n useEffect(() => {\n // Toggle night map only if current map type is default\n if (isDarkMode && baseLayer === MAP_TYPE_DEFAULT) {\n handleMapTypeChange(MAP_TYPE_NIGHT);\n }\n // Toggle back to default map only if current map type is night\n else if (!isDarkMode && baseLayer === MAP_TYPE_NIGHT) {\n handleMapTypeChange(MAP_TYPE_DEFAULT);\n }\n }, [isDarkMode, language]);\n\n // Update MapType from outside\n useEffect(() => handleMapTypeChange(mapType), [mapType]);\n\n // Update MapLayer from outside\n const [previousMapLayer, setPreviousMapLayer] = useState(mapLayer);\n if (!isEqual(mapLayer, previousMapLayer)) {\n setActiveLayers(mapLayer);\n setPreviousMapLayer(mapLayer);\n }\n\n // Update Cluster setting from outside\n useEffect(() => setShowCluster(externalShowCluster), [externalShowCluster]);\n\n const handleMapTypeChange = (newMapType: MapType) => {\n setBaseLayer(newMapType);\n onMapTypeChange(newMapType, mapType);\n };\n\n const handleMapLayerChange = (layer: MapLayer) => {\n const removeLayer = (layerToRemove: string) => activeLayers.filter(item => item !== layerToRemove);\n const newActiveLayers = activeLayers.includes(layer) ? removeLayer(layer) : [...activeLayers, layer];\n setActiveLayers(newActiveLayers);\n onMapLayerChange(newActiveLayers, activeLayers);\n };\n\n const handleShowClusterChange = (newShowCluster: boolean) => {\n setShowCluster(newShowCluster);\n onShowClusterChange(newShowCluster);\n };\n\n // Note: For performance reasons, we deactivate pointer events and hence CSS style recalculation for the\n // the body. Having for instance many assets in the tree causes a performance loss when clicking on the map\n // to move it and zoom in/out since the map triggers a style invalidation and recalculation and\n // due to the nature of the AssetTree with it's hundreds DOM nodes, applying the CSS selectors\n // takes time.\n const handleMapInteractionStart = () => {\n document.querySelector('.AssetTree')?.classList.add('pointer-events-none');\n };\n const handleMapInteractionEnd = () => {\n document.querySelector('.AssetTree')?.classList.remove('pointer-events-none');\n };\n\n const style: CSSProperties = {};\n if (height) {\n style.height = height;\n }\n if (width) {\n style.width = width;\n }\n const autoHeightClass = isEmpty(style) ? 'height-100pct' : '';\n\n const handleMapWheelCapture = () => {\n temporarilyDisableMarkerPointerEvents();\n scheduleMarkerPointerEventsEnable();\n };\n\n return (\n <div\n className={`Map position-relative map-type-${baseLayer.toLowerCase()} ${autoHeightClass}`}\n style={style}\n ref={mapRef}\n onWheelCapture={handleMapWheelCapture}\n onTouchStart={handleMapInteractionStart}\n onTouchEnd={handleMapInteractionEnd}\n onMouseEnter={handleMapInteractionStart}\n onMouseOut={handleMapInteractionEnd}\n onBlur={handleMapInteractionEnd}\n >\n {isMapInitialized && api && (\n <MapContext.Provider\n value={{\n api,\n language,\n enableWebGL,\n enableMarkerIconCache,\n showCluster,\n activeLayers,\n baseLayer,\n hideMapLayerSettings,\n hideClusterSettings,\n onMapTypeChange: handleMapTypeChange,\n onMapLayerChange: handleMapLayerChange,\n onShowClusterChange: handleShowClusterChange,\n mapSettingsTooltip,\n onIncidentsChange,\n devicePixelRatio,\n }}\n >\n <MapPosition api={api} boundingBox={boundingBox} center={center} zoomAnimation={zoomAnimation} />\n <MapSize api={api} />\n <MapZoom\n zoom={zoom}\n hideZoomButtons={disableBehavior}\n onZoomIn={onZoomIn}\n onZoomOut={onZoomOut}\n zoomAnimation={zoomAnimation}\n />\n {mapSettings && mapSettings}\n <MapOverlayLayers layers={activeLayers} />\n <MapElements api={api}>{children}</MapElements>\n </MapContext.Provider>\n )}\n </div>\n );\n};\n\nMap.TYPE_DEFAULT = MAP_TYPE_DEFAULT;\nMap.TYPE_FLEET_STYLE = MAP_TYPE_FLEET_STYLE;\nMap.TYPE_SATELLITE = MAP_TYPE_SATELLITE;\nMap.TYPE_TERRAIN = MAP_TYPE_TERRAIN;\nMap.TYPE_NIGHT = MAP_TYPE_NIGHT;\n\nMap.LAYER_INCIDENTS = MAP_LAYER_INCIDENTS;\nMap.LAYER_TRAFFIC = MAP_LAYER_TRAFFIC;\nMap.LAYER_ROAD_RESTRICTIONS = MAP_LAYER_ROAD_RESTRICTIONS;\n\nexport default Map;\n"],"names":["MARKER_POINTER_EVENTS_DISABLED_CLASS","MARKER_POINTER_EVENTS_RESET_DELAY_MS","Map","props","children","credentials","width","height","lang","center","zoom","zoomAnimation","boundingBox","hideClusterSettings","hideMapLayerSettings","disableMapEvents","disableBehavior","disableZoomMomentum","eventListenerMap","mapType","MAP_TYPE_DEFAULT","mapLayer","externalShowCluster","showScaleBar","onMapLayerChange","onMapTypeChange","onShowClusterChange","onZoomIn","onZoomOut","onIncidentsChange","mapSettingsTooltip","mapSettings","enableWebGL","enableDevicePixelRatio","enableMarkerIconCache","disableMarkerPointerEventsWhileZooming","pixelRatio","DEFAULT_PIXEL_RATIO","minZoom","DEFAULT_MIN_ZOOM","maxZoom","DEFAULT_MAX_ZOOM","safeMaxZoom","mapRef","useRef","markerPointerEventsResetTimeoutRef","markerPointerEventsDisabledRef","disableMarkerPointerEventsWhileZoomingRef","isMapInitialized","setMapInitialized","useState","api","setApi","baseLayer","setBaseLayer","activeLayers","setActiveLayers","showCluster","setShowCluster","devicePixelRatio","language","locale","setMarkerPointerEventsDisabled","disabled","mapElement","clearMarkerPointerEventsResetTimeout","scheduleMarkerPointerEventsEnable","temporarilyDisableMarkerPointerEvents","useEffect","allMapObjects","removeMapViewChangeListeners","removeEventListenerMap","bounds","getMapBounds","platform","getPlatform","engineType","getEngineType","defaultLayers","getBaseLayer","MAP_LAYER_ROAD_RESTRICTIONS","defaultLayerMap","handleMapViewChangeStart","handleMapViewChangeEnd","hereMap","hereMapEvents","hereBehavior","addEventListenerMap","hereUi","getHereUi","createUtils","isDarkMode","useDarkMode","handleMapTypeChange","MAP_TYPE_NIGHT","previousMapLayer","setPreviousMapLayer","isEqual","newMapType","handleMapLayerChange","layer","removeLayer","layerToRemove","item","newActiveLayers","handleShowClusterChange","newShowCluster","handleMapInteractionStart","handleMapInteractionEnd","style","autoHeightClass","isEmpty","handleMapWheelCapture","jsx","jsxs","MapContext","MapPosition","MapSize","MapZoom","MapOverlayLayers","MapElements","MAP_TYPE_FLEET_STYLE","MAP_TYPE_SATELLITE","MAP_TYPE_TERRAIN","MAP_LAYER_INCIDENTS","MAP_LAYER_TRAFFIC"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAMA,KAAuC,qCACvCC,KAAuC,KAEvCC,IAAM,CAACC,OAAoB;AAC7B,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAUC,KAAO;AAAA,IACjB,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,eAAAC,IAAgB;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,OAAO;AAAA,YACH,KAAAhE;AAAA,YACA,UAAAS;AAAA,YACA,aAAA5B;AAAA,YACA,uBAAAE;AAAA,YACA,aAAAuB;AAAA,YACA,cAAAF;AAAA,YACA,WAAAF;AAAA,YACA,sBAAAvC;AAAA,YACA,qBAAAD;AAAA,YACA,iBAAiBgF;AAAA,YACjB,kBAAkBM;AAAA,YAClB,qBAAqBM;AAAA,YACrB,oBAAA3E;AAAA,YACA,mBAAAD;AAAA,YACA,kBAAA8B;AAAA,UAAA;AAAA,UAGJ,UAAA;AAAA,YAAA,gBAAAsD,EAACG,IAAA,EAAY,KAAAjE,GAAU,aAAAvC,GAA0B,QAAAH,GAAgB,eAAAE,GAA8B;AAAA,YAC/F,gBAAAsG,EAACI,MAAQ,KAAAlE,GAAU;AAAA,YACnB,gBAAA8D;AAAA,cAACK;AAAA,cAAA;AAAA,gBACG,MAAA5G;AAAA,gBACA,iBAAiBM;AAAA,gBACjB,UAAAW;AAAA,gBACA,WAAAC;AAAA,gBACA,eAAAjB;AAAA,cAAA;AAAA,YAAA;AAAA,YAEHoB,KAAeA;AAAA,YAChB,gBAAAkF,EAACM,IAAA,EAAiB,QAAQhE,EAAA,CAAc;AAAA,YACxC,gBAAA0D,EAACO,IAAA,EAAY,KAAArE,GAAW,UAAA/C,GAAA,CAAS;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACrC;AAAA,EAAA;AAIhB;AAEAF,EAAI,eAAekB;AACnBlB,EAAI,mBAAmBuH;AACvBvH,EAAI,iBAAiBwH;AACrBxH,EAAI,eAAeyH;AACnBzH,EAAI,aAAa4F;AAEjB5F,EAAI,kBAAkB0H;AACtB1H,EAAI,gBAAgB2H;AACpB3H,EAAI,0BAA0B8E;"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { createContext as e, useContext as t } from "react";
|
|
2
|
-
import { MAP_TYPE_DEFAULT as
|
|
3
|
-
const
|
|
2
|
+
import { MAP_TYPE_DEFAULT as a } from "./constants.js";
|
|
3
|
+
const n = {
|
|
4
4
|
api: {},
|
|
5
5
|
language: "en",
|
|
6
6
|
enableWebGL: !0,
|
|
7
|
-
|
|
7
|
+
enableMarkerIconCache: !0,
|
|
8
|
+
baseLayer: a,
|
|
8
9
|
activeLayers: [],
|
|
9
10
|
showCluster: !0,
|
|
10
11
|
devicePixelRatio: 1,
|
|
11
12
|
onIncidentsChange: () => {
|
|
12
13
|
}
|
|
13
|
-
},
|
|
14
|
+
}, o = e(n), c = () => t(o);
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
o as MapContext,
|
|
17
|
+
n as defaultMapContext,
|
|
18
|
+
c as useMapContext
|
|
18
19
|
};
|
|
19
20
|
//# sourceMappingURL=MapContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapContext.js","sources":["../../../../src/components/map/components/MapContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nimport type { MapApi, MapIncidents, MapLayer, MapType } from '../utils/mapTypes';\nimport { MAP_TYPE_DEFAULT } from './constants';\n\nexport type MapContextType = {\n api: MapApi;\n language: string;\n enableWebGL: boolean;\n baseLayer: MapType;\n activeLayers: MapLayer[];\n showCluster: boolean;\n devicePixelRatio: number;\n onMapTypeChange?: (type: MapType) => void;\n onMapLayerChange?: (layer: MapLayer) => void;\n onShowClusterChange?: (showCluster: boolean) => void;\n mapSettingsTooltip?: string | React.ReactNode;\n hideMapLayerSettings?: boolean;\n hideClusterSettings?: boolean;\n onIncidentsChange: (incidentsResult: MapIncidents) => void;\n};\n\nexport const defaultMapContext: MapContextType = {\n api: {},\n language: 'en',\n enableWebGL: true,\n baseLayer: MAP_TYPE_DEFAULT,\n activeLayers: [],\n showCluster: true,\n devicePixelRatio: 1,\n onIncidentsChange: () => {},\n};\n\nexport const MapContext = createContext<MapContextType>(defaultMapContext);\n\nexport const useMapContext = () => useContext(MapContext);\n"],"names":["defaultMapContext","MAP_TYPE_DEFAULT","MapContext","createContext","useMapContext","useContext"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"MapContext.js","sources":["../../../../src/components/map/components/MapContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nimport type { MapApi, MapIncidents, MapLayer, MapType } from '../utils/mapTypes';\nimport { MAP_TYPE_DEFAULT } from './constants';\n\nexport type MapContextType = {\n api: MapApi;\n language: string;\n enableWebGL: boolean;\n enableMarkerIconCache: boolean;\n baseLayer: MapType;\n activeLayers: MapLayer[];\n showCluster: boolean;\n devicePixelRatio: number;\n onMapTypeChange?: (type: MapType) => void;\n onMapLayerChange?: (layer: MapLayer) => void;\n onShowClusterChange?: (showCluster: boolean) => void;\n mapSettingsTooltip?: string | React.ReactNode;\n hideMapLayerSettings?: boolean;\n hideClusterSettings?: boolean;\n onIncidentsChange: (incidentsResult: MapIncidents) => void;\n};\n\nexport const defaultMapContext: MapContextType = {\n api: {},\n language: 'en',\n enableWebGL: true,\n enableMarkerIconCache: true,\n baseLayer: MAP_TYPE_DEFAULT,\n activeLayers: [],\n showCluster: true,\n devicePixelRatio: 1,\n onIncidentsChange: () => {},\n};\n\nexport const MapContext = createContext<MapContextType>(defaultMapContext);\n\nexport const useMapContext = () => useContext(MapContext);\n"],"names":["defaultMapContext","MAP_TYPE_DEFAULT","MapContext","createContext","useMapContext","useContext"],"mappings":";;AAuBO,MAAMA,IAAoC;AAAA,EAC7C,KAAK,CAAA;AAAA,EACL,UAAU;AAAA,EACV,aAAa;AAAA,EACb,uBAAuB;AAAA,EACvB,WAAWC;AAAA,EACX,cAAc,CAAA;AAAA,EACd,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,mBAAmB,MAAM;AAAA,EAAC;AAC9B,GAEaC,IAAaC,EAA8BH,CAAiB,GAE5DI,IAAgB,MAAMC,EAAWH,CAAU;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
1
2
|
import { ArrowStyle } from './basics/Polyline';
|
|
2
3
|
import { Position } from '../../utils/mapTypes';
|
|
3
4
|
import { EventListenerMap } from '../../utils/eventHandling';
|
|
@@ -22,18 +23,81 @@ export type RouteStyle = {
|
|
|
22
23
|
lineDash?: number[];
|
|
23
24
|
};
|
|
24
25
|
export type RouteProps = {
|
|
26
|
+
/**
|
|
27
|
+
* Defines the arrow appearance when arrows are rendered on the route.
|
|
28
|
+
*
|
|
29
|
+
* @default {}
|
|
30
|
+
*/
|
|
25
31
|
arrowStyle?: ArrowStyle;
|
|
32
|
+
/**
|
|
33
|
+
* Controls whether directional arrows are rendered on the route line.
|
|
34
|
+
*
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
26
37
|
hasArrows?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Ordered geographic positions that define the route geometry.
|
|
40
|
+
*/
|
|
27
41
|
positions: Position[];
|
|
42
|
+
/**
|
|
43
|
+
* Overrides the default route styling for line and border.
|
|
44
|
+
*
|
|
45
|
+
* @default { width: 5, color: 'rgba(48, 194, 255, 1)', borderWidth: 2, borderColor: 'rgba(22, 100, 141, 1)', isBorderIncludedInWidth: false }
|
|
46
|
+
*/
|
|
28
47
|
style?: RouteStyle;
|
|
48
|
+
/**
|
|
49
|
+
* Style overrides applied while the route is hovered via its hit area.
|
|
50
|
+
*/
|
|
51
|
+
hoverStyle?: RouteStyle;
|
|
52
|
+
/**
|
|
53
|
+
* Shows the internal hit area polyline in red for debugging.
|
|
54
|
+
*
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
showHitArea?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Event handlers attached to the interactive route hit area.
|
|
60
|
+
*/
|
|
29
61
|
eventListenerMap?: EventListenerMap;
|
|
62
|
+
/**
|
|
63
|
+
* Renders the route in its reduced visual style.
|
|
64
|
+
*
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
30
67
|
isReduced?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Applies the alternative route base styling.
|
|
70
|
+
*
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
31
73
|
isRouteAlternative?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Icon rendered at the first route position.
|
|
76
|
+
*/
|
|
32
77
|
startIcon?: JSX.Element;
|
|
78
|
+
/**
|
|
79
|
+
* Icon rendered at the middle route position.
|
|
80
|
+
*/
|
|
33
81
|
middleIcon?: JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* Icon rendered at the last route position.
|
|
84
|
+
*/
|
|
34
85
|
endIcon?: JSX.Element;
|
|
86
|
+
/**
|
|
87
|
+
* Additional markers rendered alongside the route.
|
|
88
|
+
*
|
|
89
|
+
* @default []
|
|
90
|
+
*/
|
|
35
91
|
markers?: JSX.Element[];
|
|
92
|
+
/**
|
|
93
|
+
* Custom payload forwarded to the rendered route polylines and their events.
|
|
94
|
+
*/
|
|
36
95
|
customData?: object;
|
|
96
|
+
/**
|
|
97
|
+
* Cursor shown while hovering the interactive route hit area.
|
|
98
|
+
* If omitted, clickable routes automatically use `pointer`.
|
|
99
|
+
*/
|
|
100
|
+
cursor?: CSSProperties['cursor'];
|
|
37
101
|
};
|
|
38
|
-
declare const Route: (props: RouteProps) => import("react/jsx-runtime").JSX.Element
|
|
102
|
+
declare const Route: (props: RouteProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
103
|
export default Route;
|