@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.
Files changed (102) hide show
  1. package/Marker.js +9 -5
  2. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.d.ts +38 -3
  3. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js +104 -109
  4. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js.map +1 -1
  5. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.d.ts +24 -5
  6. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js +60 -56
  7. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js.map +1 -1
  8. package/components/datepicker/DayPicker.js +72 -70
  9. package/components/datepicker/DayPicker.js.map +1 -1
  10. package/components/datepicker/DayPickerDropdown.d.ts +1 -0
  11. package/components/datepicker/DayPickerDropdown.js +61 -48
  12. package/components/datepicker/DayPickerDropdown.js.map +1 -1
  13. package/components/datepicker/useStackedDayPickerCalendars.js +26 -26
  14. package/components/datepicker/useStackedDayPickerCalendars.js.map +1 -1
  15. package/components/listMenu/ListMenu.d.ts +8 -0
  16. package/components/listMenu/ListMenu.js +74 -66
  17. package/components/listMenu/ListMenu.js.map +1 -1
  18. package/components/map/components/Map.js +189 -157
  19. package/components/map/components/Map.js.map +1 -1
  20. package/components/map/components/MapContext.d.ts +1 -0
  21. package/components/map/components/MapContext.js +8 -7
  22. package/components/map/components/MapContext.js.map +1 -1
  23. package/components/map/components/features/Route.d.ts +65 -1
  24. package/components/map/components/features/Route.js +184 -98
  25. package/components/map/components/features/Route.js.map +1 -1
  26. package/components/map/components/features/basics/Marker.d.ts +21 -1
  27. package/components/map/components/features/basics/Marker.js +99 -40
  28. package/components/map/components/features/basics/Marker.js.map +1 -1
  29. package/components/map/components/features/basics/Polygon.d.ts +24 -1
  30. package/components/map/components/features/basics/Polygon.js +72 -19
  31. package/components/map/components/features/basics/Polygon.js.map +1 -1
  32. package/components/map/components/features/basics/Polyline.d.ts +29 -0
  33. package/components/map/components/features/basics/Polyline.js +69 -39
  34. package/components/map/components/features/basics/Polyline.js.map +1 -1
  35. package/components/map/components/features/layers/MarkerLayer.js +8 -8
  36. package/components/map/components/features/layers/MarkerLayer.js.map +1 -1
  37. package/components/map/components/features/layers/clustering/SimpleClusterLayer.js +13 -6
  38. package/components/map/components/features/layers/clustering/SimpleClusterLayer.js.map +1 -1
  39. package/components/map/utils/clustering.d.ts +1 -1
  40. package/components/map/utils/clustering.js +30 -30
  41. package/components/map/utils/clustering.js.map +1 -1
  42. package/components/map/utils/mapTypes.d.ts +135 -0
  43. package/components/map/utils/mapTypes.js.map +1 -1
  44. package/components/mapMarker/ClusterMapMarker.d.ts +2 -0
  45. package/components/mapMarker/ClusterMapMarker.js.map +1 -1
  46. package/components/mapMarker/SingleMapMarker.d.ts +2 -0
  47. package/components/mapMarker/SingleMapMarker.js.map +1 -1
  48. package/components/selects/ClearButton.js +9 -7
  49. package/components/selects/ClearButton.js.map +1 -1
  50. package/components/table/Table.js +208 -205
  51. package/components/table/Table.js.map +1 -1
  52. package/components/table/Table.types.d.ts +13 -4
  53. package/components/table/TableColumn.d.ts +8 -1
  54. package/components/table/TableColumn.js +66 -64
  55. package/components/table/TableColumn.js.map +1 -1
  56. package/components/table/TableExpandedRow.js +11 -11
  57. package/components/table/TableExpandedRow.js.map +1 -1
  58. package/components/table/TableHeader.d.ts +17 -0
  59. package/components/table/TableHeader.js +89 -76
  60. package/components/table/TableHeader.js.map +1 -1
  61. package/components/table/TableHeaderColumn.d.ts +11 -1
  62. package/components/table/TableHeaderColumn.js +63 -58
  63. package/components/table/TableHeaderColumn.js.map +1 -1
  64. package/components/table/TableRow.d.ts +6 -0
  65. package/components/table/TableRow.js +49 -48
  66. package/components/table/TableRow.js.map +1 -1
  67. package/components/table/context/TableLayoutContext.d.ts +1 -0
  68. package/components/table/context/TableLayoutContext.js.map +1 -1
  69. package/components/table/layout/useHorizontalSectionSync.d.ts +2 -1
  70. package/components/table/layout/useHorizontalSectionSync.js +32 -31
  71. package/components/table/layout/useHorizontalSectionSync.js.map +1 -1
  72. package/components/table/layout/useTableLayout.d.ts +2 -1
  73. package/components/table/layout/useTableLayout.js +37 -30
  74. package/components/table/layout/useTableLayout.js.map +1 -1
  75. package/components/table/render/header/TableDraggableHeaderCell.js +38 -36
  76. package/components/table/render/header/TableDraggableHeaderCell.js.map +1 -1
  77. package/components/table/render/header/TableHeader.types.d.ts +2 -0
  78. package/components/table/render/header/TableHeaderCellContent.js +16 -16
  79. package/components/table/render/header/TableHeaderCellContent.js.map +1 -1
  80. package/components/table/render/header/TableStaticHeaderCell.js +31 -29
  81. package/components/table/render/header/TableStaticHeaderCell.js.map +1 -1
  82. package/components/table/render/header/resolveHeaderCellClassName.d.ts +1 -0
  83. package/components/table/render/header/resolveHeaderCellClassName.js +10 -9
  84. package/components/table/render/header/resolveHeaderCellClassName.js.map +1 -1
  85. package/components/table/runtime/useResolvedRenderColumns.d.ts +4 -4
  86. package/components/table/runtime/useResolvedRenderColumns.js +13 -13
  87. package/components/table/runtime/useResolvedRenderColumns.js.map +1 -1
  88. package/components/table/runtime/useResolvedRenderHeader.d.ts +1 -1
  89. package/components/table/runtime/useResolvedRenderHeader.js.map +1 -1
  90. package/hooks/useDraggableElement.d.ts +27 -5
  91. package/hooks/useDraggableElement.js +100 -23
  92. package/hooks/useDraggableElement.js.map +1 -1
  93. package/hooks/usePopperDropdown.d.ts +1 -0
  94. package/hooks/usePopperDropdown.js +15 -12
  95. package/hooks/usePopperDropdown.js.map +1 -1
  96. package/package.json +1 -1
  97. package/utils/analytics/createAnalyticsOverlayTooltip.js.map +1 -1
  98. package/utils/init/initConfig.js +5 -5
  99. package/utils/init/initConfig.js.map +1 -1
  100. package/version.d.ts +1 -1
  101. package/version.js +1 -1
  102. package/version.js.map +1 -1
@@ -1,193 +1,225 @@
1
- import { jsx as p, jsxs as Ae } from "react/jsx-runtime";
2
- import { useRef as _e, useState as m, useEffect as T } from "react";
3
- import { isEmpty as ye } from "es-toolkit/compat";
4
- import { isEqual as Ce } from "es-toolkit/predicate";
5
- import { DEFAULT_MAX_ZOOM as W, MAP_TYPE_DEFAULT as v, DEFAULT_PIXEL_RATIO as Re, DEFAULT_MIN_ZOOM as Ie, MAP_LAYER_ROAD_RESTRICTIONS as J, MAP_TYPE_NIGHT as b, MAP_TYPE_FLEET_STYLE as Pe, MAP_TYPE_SATELLITE as Se, MAP_TYPE_TERRAIN as be, MAP_LAYER_INCIDENTS as Oe, MAP_LAYER_TRAFFIC as Ye } from "./constants.js";
6
- import { removeEventListenerMap as xe, addEventListenerMap as we } from "../utils/eventHandling.js";
7
- import { MapContext as Ne } from "./MapContext.js";
8
- import { getMapBounds as Fe, createUtils as Ze } from "../utils/mapUtils.js";
9
- import { getHereUi as De } from "../utils/mapUi.js";
10
- import Be from "../../../hooks/useDarkMode.js";
11
- import He from "./features/MapZoom.js";
12
- import Ue from "./features/layers/MapOverlayLayers.js";
13
- import ze from "./MapSize.js";
14
- import je from "./MapPosition.js";
15
- import qe from "./MapElements.js";
16
- import { getPlatform as Ge, getBaseLayer as ke, getEngineType as Xe } from "../utils/rendering.js";
17
- const n = (K) => {
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: Q,
20
- credentials: O,
21
- width: Y,
22
- height: x,
23
- language: V = "en",
24
- center: w,
25
- zoom: N,
26
- zoomAnimation: F = !1,
27
- boundingBox: g,
28
- hideClusterSettings: ee = !1,
29
- hideMapLayerSettings: te = !1,
30
- disableMapEvents: Z,
31
- disableBehavior: D = !1,
32
- disableZoomMomentum: oe = !0,
33
- eventListenerMap: ae,
34
- mapType: E = v,
35
- mapLayer: l = [],
36
- showCluster: A = !0,
37
- showScaleBar: se = !1,
38
- onMapLayerChange: ne = () => {
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: ie = () => {
40
+ onMapTypeChange: fe = () => {
41
41
  },
42
- onShowClusterChange: re = () => {
42
+ onShowClusterChange: Le = () => {
43
43
  },
44
- onZoomIn: pe = () => {
44
+ onZoomIn: Te = () => {
45
45
  },
46
- onZoomOut: me = () => {
46
+ onZoomOut: ge = () => {
47
47
  },
48
- onIncidentsChange: le = () => {
48
+ onIncidentsChange: _e = () => {
49
49
  },
50
- mapSettingsTooltip: ce,
51
- mapSettings: B,
52
- enableWebGL: c = !0,
53
- enableDevicePixelRatio: U = !0,
54
- pixelRatio: z = Re,
55
- minZoom: h = Ie,
56
- maxZoom: _ = W
57
- } = K;
58
- let y = _;
59
- h > _ && (y = W, console.error("Invalid condition for zoom limits: min <= max)"));
60
- const j = _e(null), [de, ue] = m(!1), [t, Ee] = m(), [o, he] = m(E), [a, q] = m(l), [G, k] = m(A), X = U && window.devicePixelRatio || z, i = /* @__PURE__ */ ((e) => e === "nb" ? "no" : e)(V.split("-")[0].toLowerCase());
61
- T(() => {
62
- let e = [];
63
- t?.map ? (e = t.map.getObjects(), console.debug("re-initialize here map")) : console.debug("initialize here map"), t?.map && (console.debug("disposing previous map"), xe(t.map), t.mapEvents && t.mapEvents.dispose(), t.map.dispose());
64
- const I = g && Fe(g), r = Ge(O), d = Xe(o, c), u = r.createDefaultLayers({ engineType: d, lg: i, pois: !0 });
65
- ke({
66
- baseLayerName: o,
67
- defaultLayers: u,
68
- enableWebGL: c,
69
- platform: r,
70
- engineType: d,
71
- vehicleRestrictions: a.includes(J),
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: h,
74
- maxZoom: y
75
- }).then((P) => {
76
- const s = new H.Map(j.current, P.baseLayer, {
77
- zoom: N,
78
- center: w,
79
- bounds: I,
80
- engineType: d,
81
- pixelRatio: X,
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
- P.overlayLayer && s.addLayer(P.overlayLayer), ue(!0);
85
- let S = !1, L;
86
- Z || (S = new H.mapevents.MapEvents(s)), Z || D || (L = new H.mapevents.Behavior(S), L.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM), oe && L.disable(H.mapevents.Behavior.Feature.ZOOM_MOMENTUM)), we(s, ae, s);
87
- const ge = De(s, u, se, i);
88
- Ee({
89
- credentials: O,
90
- defaultLayers: u,
91
- map: s,
92
- mapEvents: S,
93
- behavior: L,
94
- platform: r,
95
- ui: ge,
96
- utils: Ze(s),
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: c,
101
- baseLayer: o,
102
- activeLayers: a,
103
- showCluster: G,
104
- minZoom: h,
105
- maxZoom: y
122
+ enableWebGL: E,
123
+ baseLayer: a,
124
+ activeLayers: o,
125
+ showCluster: Q,
126
+ minZoom: T,
127
+ maxZoom: b
106
128
  }
107
- }), e && s.addObjects(e);
108
- });
109
- }, [c, U, i, o, h, _]);
110
- const C = Be();
111
- T(() => {
112
- C && o === v ? M(b) : !C && o === b && M(v);
113
- }, [C, i]), T(() => M(E), [E]);
114
- const [Me, fe] = m(l);
115
- Ce(l, Me) || (q(l), fe(l)), T(() => k(A), [A]);
116
- const M = (e) => {
117
- he(e), ie(e, E);
118
- }, Le = (e) => {
119
- const I = (d) => a.filter((u) => u !== d), r = a.includes(e) ? I(e) : [...a, e];
120
- q(r), ne(r, a);
121
- }, Te = (e) => {
122
- k(e), re(e);
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
- }, R = () => {
153
+ }, N = () => {
126
154
  document.querySelector(".AssetTree")?.classList.remove("pointer-events-none");
127
- }, f = {};
128
- x && (f.height = x), Y && (f.width = Y);
129
- const ve = ye(f) ? "height-100pct" : "";
130
- return /* @__PURE__ */ p(
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-${o.toLowerCase()} ${ve}`,
134
- style: f,
135
- ref: j,
136
- onTouchStart: $,
137
- onTouchEnd: R,
138
- onMouseEnter: $,
139
- onMouseOut: R,
140
- onBlur: R,
141
- children: de && t && /* @__PURE__ */ Ae(
142
- Ne.Provider,
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: c,
148
- showCluster: G,
149
- activeLayers: a,
150
- baseLayer: o,
151
- hideMapLayerSettings: te,
152
- hideClusterSettings: ee,
153
- onMapTypeChange: M,
154
- onMapLayerChange: Le,
155
- onShowClusterChange: Te,
156
- mapSettingsTooltip: ce,
157
- onIncidentsChange: le,
158
- devicePixelRatio: X
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__ */ p(je, { api: t, boundingBox: g, center: w, zoomAnimation: F }),
162
- /* @__PURE__ */ p(ze, { api: t }),
163
- /* @__PURE__ */ p(
164
- He,
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: N,
167
- hideZoomButtons: D,
168
- onZoomIn: pe,
169
- onZoomOut: me,
170
- zoomAnimation: F
198
+ zoom: j,
199
+ hideZoomButtons: q,
200
+ onZoomIn: Te,
201
+ onZoomOut: ge,
202
+ zoomAnimation: V
171
203
  }
172
204
  ),
173
- B && B,
174
- /* @__PURE__ */ p(Ue, { layers: a }),
175
- /* @__PURE__ */ p(qe, { api: t, children: Q })
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
- n.TYPE_DEFAULT = v;
183
- n.TYPE_FLEET_STYLE = Pe;
184
- n.TYPE_SATELLITE = Se;
185
- n.TYPE_TERRAIN = be;
186
- n.TYPE_NIGHT = b;
187
- n.LAYER_INCIDENTS = Oe;
188
- n.LAYER_TRAFFIC = Ye;
189
- n.LAYER_ROAD_RESTRICTIONS = J;
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
- n as default
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,IACA,aAAAC,IAAc;AAAA,IACd,wBAAAC,IAAyB;AAAA,IACzB,YAAAC,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ACnBlB,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;AAAA,IAChB,aAAAC;AAAA,IACA,qBAAAC,KAAsB;AAAA,IACtB,sBAAAC,KAAu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ACA,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;"}
@@ -3,6 +3,7 @@ export type MapContextType = {
3
3
  api: MapApi;
4
4
  language: string;
5
5
  enableWebGL: boolean;
6
+ enableMarkerIconCache: boolean;
6
7
  baseLayer: MapType;
7
8
  activeLayers: MapLayer[];
8
9
  showCluster: boolean;
@@ -1,19 +1,20 @@
1
1
  import { createContext as e, useContext as t } from "react";
2
- import { MAP_TYPE_DEFAULT as o } from "./constants.js";
3
- const a = {
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
- baseLayer: o,
7
+ enableMarkerIconCache: !0,
8
+ baseLayer: a,
8
9
  activeLayers: [],
9
10
  showCluster: !0,
10
11
  devicePixelRatio: 1,
11
12
  onIncidentsChange: () => {
12
13
  }
13
- }, n = e(a), i = () => t(n);
14
+ }, o = e(n), c = () => t(o);
14
15
  export {
15
- n as MapContext,
16
- a as defaultMapContext,
17
- i as useMapContext
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":";;AAsBO,MAAMA,IAAoC;AAAA,EAC7C,KAAK,CAAA;AAAA,EACL,UAAU;AAAA,EACV,aAAa;AAAA,EACb,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
+ {"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 | null;
102
+ declare const Route: (props: RouteProps) => import("react/jsx-runtime").JSX.Element;
39
103
  export default Route;