@forgeroute/ui 0.4.88 → 0.4.89
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/fesm2022/forgeroute-ui-map.mjs +2799 -0
- package/fesm2022/forgeroute-ui-map.mjs.map +1 -0
- package/fesm2022/{forgeroute-ui-ui-labels.es-Hp0NTuG7.mjs → forgeroute-ui-ui-labels.es-D3a6iMnB.mjs} +120 -2
- package/fesm2022/{forgeroute-ui-ui-labels.es-Hp0NTuG7.mjs.map → forgeroute-ui-ui-labels.es-D3a6iMnB.mjs.map} +1 -1
- package/fesm2022/forgeroute-ui.mjs +12855 -10891
- package/fesm2022/forgeroute-ui.mjs.map +1 -1
- package/package.json +9 -1
- package/types/forgeroute-ui-map.d.ts +743 -0
- package/types/forgeroute-ui-messaging.d.ts +5 -5
- package/types/forgeroute-ui-stripe.d.ts +1 -1
- package/types/forgeroute-ui.d.ts +565 -20
|
@@ -0,0 +1,2799 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, Directive, InjectionToken, NgZone, PLATFORM_ID, TemplateRef, ViewEncapsulation, computed, contentChild, effect, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
|
|
4
|
+
import { ButtonComponent, FormRowComponent, FormSectionComponent, SelectComponent, TextInputComponent, UiLabelsService } from "@forgeroute/ui";
|
|
5
|
+
import * as i1 from "@angular/forms";
|
|
6
|
+
import { FormsModule } from "@angular/forms";
|
|
7
|
+
const EARTH_RADIUS_METERS = 6371008.8;
|
|
8
|
+
const toRad = (deg) => deg * Math.PI / 180;
|
|
9
|
+
const toDeg = (rad) => rad * 180 / Math.PI;
|
|
10
|
+
function isValidLat(value) {
|
|
11
|
+
return typeof value === "number" && Number.isFinite(value) && value >= -90 && value <= 90;
|
|
12
|
+
}
|
|
13
|
+
function isValidLng(value) {
|
|
14
|
+
return typeof value === "number" && Number.isFinite(value) && value >= -180 && value <= 180;
|
|
15
|
+
}
|
|
16
|
+
function isValidLatLng(value) {
|
|
17
|
+
const v = value;
|
|
18
|
+
return !!v && isValidLat(v.lat) && isValidLng(v.lng);
|
|
19
|
+
}
|
|
20
|
+
function clampLat(value) {
|
|
21
|
+
return Math.min(90, Math.max(-90, value));
|
|
22
|
+
}
|
|
23
|
+
function clampLng(value) {
|
|
24
|
+
return Math.min(180, Math.max(-180, value));
|
|
25
|
+
}
|
|
26
|
+
function haversineMeters(a, b) {
|
|
27
|
+
const dLat = toRad(b.lat - a.lat);
|
|
28
|
+
const dLng = toRad(b.lng - a.lng);
|
|
29
|
+
const sinLat = Math.sin(dLat / 2);
|
|
30
|
+
const sinLng = Math.sin(dLng / 2);
|
|
31
|
+
const h = sinLat * sinLat + Math.cos(toRad(a.lat)) * Math.cos(toRad(b.lat)) * sinLng * sinLng;
|
|
32
|
+
return 2 * EARTH_RADIUS_METERS * Math.asin(Math.min(1, Math.sqrt(h)));
|
|
33
|
+
}
|
|
34
|
+
function pointInPolygon(point, polygon) {
|
|
35
|
+
const ring = openRing(polygon);
|
|
36
|
+
if (ring.length < 3) return false;
|
|
37
|
+
const x = point.lng;
|
|
38
|
+
const y = point.lat;
|
|
39
|
+
let inside = false;
|
|
40
|
+
for (let i = 0, j = ring.length - 1; i < ring.length; j = i++) {
|
|
41
|
+
const xi = ring[i].lng, yi = ring[i].lat;
|
|
42
|
+
const xj = ring[j].lng, yj = ring[j].lat;
|
|
43
|
+
if (onSegment(x, y, xi, yi, xj, yj)) return true;
|
|
44
|
+
if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) inside = !inside;
|
|
45
|
+
}
|
|
46
|
+
return inside;
|
|
47
|
+
}
|
|
48
|
+
function openRing(polygon) {
|
|
49
|
+
if (polygon.length > 1) {
|
|
50
|
+
const first = polygon[0];
|
|
51
|
+
const last = polygon[polygon.length - 1];
|
|
52
|
+
if (first.lat === last.lat && first.lng === last.lng) return polygon.slice(0, -1);
|
|
53
|
+
}
|
|
54
|
+
return polygon;
|
|
55
|
+
}
|
|
56
|
+
function onSegment(px, py, ax, ay, bx, by) {
|
|
57
|
+
const cross = (px - ax) * (by - ay) - (py - ay) * (bx - ax);
|
|
58
|
+
if (Math.abs(cross) > 1e-12) return false;
|
|
59
|
+
return px >= Math.min(ax, bx) && px <= Math.max(ax, bx) && py >= Math.min(ay, by) && py <= Math.max(ay, by);
|
|
60
|
+
}
|
|
61
|
+
function boundsOf(points) {
|
|
62
|
+
let north = -Infinity, south = Infinity, east = -Infinity, west = Infinity;
|
|
63
|
+
for (const p of points) {
|
|
64
|
+
if (!Number.isFinite(p.lat) || !Number.isFinite(p.lng)) continue;
|
|
65
|
+
if (p.lat > north) north = p.lat;
|
|
66
|
+
if (p.lat < south) south = p.lat;
|
|
67
|
+
if (p.lng > east) east = p.lng;
|
|
68
|
+
if (p.lng < west) west = p.lng;
|
|
69
|
+
}
|
|
70
|
+
return north === -Infinity ? null : {
|
|
71
|
+
north,
|
|
72
|
+
south,
|
|
73
|
+
east,
|
|
74
|
+
west
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function circleToBounds(center, radiusMeters) {
|
|
78
|
+
const angular = Math.max(0, radiusMeters) / EARTH_RADIUS_METERS;
|
|
79
|
+
const dLat = toDeg(angular);
|
|
80
|
+
const north = center.lat + dLat;
|
|
81
|
+
const south = center.lat - dLat;
|
|
82
|
+
if (north >= 90 || south <= -90 || angular >= Math.PI / 2) return {
|
|
83
|
+
north: Math.min(90, north),
|
|
84
|
+
south: Math.max(-90, south),
|
|
85
|
+
east: 180,
|
|
86
|
+
west: -180
|
|
87
|
+
};
|
|
88
|
+
const dLng = toDeg(Math.asin(Math.sin(angular) / Math.cos(toRad(center.lat))));
|
|
89
|
+
const east = center.lng + dLng;
|
|
90
|
+
const west = center.lng - dLng;
|
|
91
|
+
if (east > 180 || west < -180) return {
|
|
92
|
+
north,
|
|
93
|
+
south,
|
|
94
|
+
east: 180,
|
|
95
|
+
west: -180
|
|
96
|
+
};
|
|
97
|
+
return {
|
|
98
|
+
north,
|
|
99
|
+
south,
|
|
100
|
+
east,
|
|
101
|
+
west
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function boundsToPolygon(b) {
|
|
105
|
+
return [
|
|
106
|
+
{
|
|
107
|
+
lat: b.north,
|
|
108
|
+
lng: b.west
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
lat: b.north,
|
|
112
|
+
lng: b.east
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
lat: b.south,
|
|
116
|
+
lng: b.east
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
lat: b.south,
|
|
120
|
+
lng: b.west
|
|
121
|
+
}
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
function boundsContains(b, p) {
|
|
125
|
+
return p.lat <= b.north && p.lat >= b.south && p.lng <= b.east && p.lng >= b.west;
|
|
126
|
+
}
|
|
127
|
+
function boundsIntersect(a, b) {
|
|
128
|
+
return a.south <= b.north && a.north >= b.south && a.west <= b.east && a.east >= b.west;
|
|
129
|
+
}
|
|
130
|
+
const cross = (o, a, b) => (a.lng - o.lng) * (b.lat - o.lat) - (a.lat - o.lat) * (b.lng - o.lng);
|
|
131
|
+
function segmentsIntersect(a, b, c, d) {
|
|
132
|
+
const d1 = cross(a, b, c), d2 = cross(a, b, d), d3 = cross(c, d, a), d4 = cross(c, d, b);
|
|
133
|
+
if ((d1 > 0 && d2 < 0 || d1 < 0 && d2 > 0) && (d3 > 0 && d4 < 0 || d3 < 0 && d4 > 0)) return true;
|
|
134
|
+
const within = (p, q, r) => r.lng >= Math.min(p.lng, q.lng) && r.lng <= Math.max(p.lng, q.lng) && r.lat >= Math.min(p.lat, q.lat) && r.lat <= Math.max(p.lat, q.lat);
|
|
135
|
+
return d1 === 0 && within(a, b, c) || d2 === 0 && within(a, b, d) || d3 === 0 && within(c, d, a) || d4 === 0 && within(c, d, b);
|
|
136
|
+
}
|
|
137
|
+
function isSimplePolygon(polygon) {
|
|
138
|
+
const ring = openRing(polygon);
|
|
139
|
+
const n = ring.length;
|
|
140
|
+
if (n < 3) return false;
|
|
141
|
+
for (let i = 0; i < n; i++) for (let j = i + 1; j < n; j++) if (ring[i].lat === ring[j].lat && ring[i].lng === ring[j].lng) return false;
|
|
142
|
+
for (let i = 0; i < n; i++) {
|
|
143
|
+
const a = ring[i], b = ring[(i + 1) % n];
|
|
144
|
+
for (let j = i + 1; j < n; j++) {
|
|
145
|
+
const c = ring[j], d = ring[(j + 1) % n];
|
|
146
|
+
if (j === i + 1 || i === 0 && j === n - 1) {
|
|
147
|
+
const shared = j === i + 1 ? b : a;
|
|
148
|
+
const p = j === i + 1 ? a : b;
|
|
149
|
+
const q = j === i + 1 ? d : c;
|
|
150
|
+
if (cross(shared, p, q) === 0 && (p.lng - shared.lng) * (q.lng - shared.lng) + (p.lat - shared.lat) * (q.lat - shared.lat) > 0) return false;
|
|
151
|
+
} else if (segmentsIntersect(a, b, c, d)) return false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
function edgeCrossesChain(points, next) {
|
|
157
|
+
const n = points.length;
|
|
158
|
+
if (points.some((p) => p.lat === next.lat && p.lng === next.lng)) return true;
|
|
159
|
+
if (n < 2) return false;
|
|
160
|
+
const last = points[n - 1];
|
|
161
|
+
for (let i = 0; i < n - 2; i++) if (segmentsIntersect(points[i], points[i + 1], last, next)) return true;
|
|
162
|
+
const prev = points[n - 2];
|
|
163
|
+
return cross(last, prev, next) === 0 && (prev.lng - last.lng) * (next.lng - last.lng) + (prev.lat - last.lat) * (next.lat - last.lat) > 0;
|
|
164
|
+
}
|
|
165
|
+
function areaBounds(area) {
|
|
166
|
+
switch (area.type) {
|
|
167
|
+
case "circle": return circleToBounds(area, area.radiusMeters);
|
|
168
|
+
case "bbox": return {
|
|
169
|
+
north: area.north,
|
|
170
|
+
south: area.south,
|
|
171
|
+
east: area.east,
|
|
172
|
+
west: area.west
|
|
173
|
+
};
|
|
174
|
+
case "polygon": return boundsOf(area.points);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function areaContains(area, point) {
|
|
178
|
+
switch (area.type) {
|
|
179
|
+
case "circle": return haversineMeters(area, point) <= area.radiusMeters;
|
|
180
|
+
case "bbox": return boundsContains(area, point);
|
|
181
|
+
case "polygon": return pointInPolygon(point, area.points);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function areaRing(area) {
|
|
185
|
+
switch (area.type) {
|
|
186
|
+
case "circle": return null;
|
|
187
|
+
case "bbox": return boundsToPolygon(area);
|
|
188
|
+
case "polygon": return area.points;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function isValidArea(area) {
|
|
192
|
+
if (!area) return false;
|
|
193
|
+
switch (area.type) {
|
|
194
|
+
case "circle": return isValidLat(area.lat) && isValidLng(area.lng) && Number.isFinite(area.radiusMeters) && area.radiusMeters > 0;
|
|
195
|
+
case "bbox": return isValidLat(area.north) && isValidLat(area.south) && isValidLng(area.east) && isValidLng(area.west) && area.south < area.north && area.west < area.east;
|
|
196
|
+
case "polygon": return Array.isArray(area.points) && area.points.length >= 3 && area.points.every((p) => isValidLat(p.lat) && isValidLng(p.lng)) && isSimplePolygon(area.points);
|
|
197
|
+
default: return false;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function sameArea(a, b) {
|
|
201
|
+
if (!a || !b) return !a && !b;
|
|
202
|
+
if (a.type !== b.type) return false;
|
|
203
|
+
switch (a.type) {
|
|
204
|
+
case "circle": {
|
|
205
|
+
const o = b;
|
|
206
|
+
return a.lat === o.lat && a.lng === o.lng && a.radiusMeters === o.radiusMeters;
|
|
207
|
+
}
|
|
208
|
+
case "bbox": {
|
|
209
|
+
const o = b;
|
|
210
|
+
return a.north === o.north && a.south === o.south && a.east === o.east && a.west === o.west;
|
|
211
|
+
}
|
|
212
|
+
case "polygon": {
|
|
213
|
+
const o = b;
|
|
214
|
+
return a.points.length === o.points.length && a.points.every((p, i) => p.lat === o.points[i].lat && p.lng === o.points[i].lng);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
const TILE_SIZE = 256;
|
|
219
|
+
const MAX_MERCATOR_LAT = 85.0511287798;
|
|
220
|
+
function projectToPixels(point, zoom) {
|
|
221
|
+
const scale = TILE_SIZE * Math.pow(2, zoom);
|
|
222
|
+
const lat = Math.max(-85.0511287798, Math.min(MAX_MERCATOR_LAT, point.lat));
|
|
223
|
+
const sin = Math.sin(lat * Math.PI / 180);
|
|
224
|
+
return {
|
|
225
|
+
x: (point.lng + 180) / 360 * scale,
|
|
226
|
+
y: (.5 - Math.log((1 + sin) / (1 - sin)) / (4 * Math.PI)) * scale
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function clusterMarkers(items, zoom, options = {}) {
|
|
230
|
+
const radius = options.radiusPx && options.radiusPx > 0 ? options.radiusPx : 60;
|
|
231
|
+
const maxZoom = options.maxZoom ?? 16;
|
|
232
|
+
const valid = items.filter((i) => Number.isFinite(i.lat) && Number.isFinite(i.lng));
|
|
233
|
+
if (zoom >= maxZoom) return valid.map((item) => ({
|
|
234
|
+
kind: "marker",
|
|
235
|
+
item
|
|
236
|
+
}));
|
|
237
|
+
const cells = /* @__PURE__ */ new Map();
|
|
238
|
+
for (const item of valid) {
|
|
239
|
+
const { x, y } = projectToPixels(item, zoom);
|
|
240
|
+
const cx = Math.floor(x / radius);
|
|
241
|
+
const cy = Math.floor(y / radius);
|
|
242
|
+
const key = `${cx}:${cy}`;
|
|
243
|
+
const cell = cells.get(key);
|
|
244
|
+
if (cell) cell.members.push(item);
|
|
245
|
+
else cells.set(key, {
|
|
246
|
+
cx,
|
|
247
|
+
cy,
|
|
248
|
+
members: [item]
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
const out = [];
|
|
252
|
+
for (const cell of cells.values()) {
|
|
253
|
+
if (cell.members.length === 1) {
|
|
254
|
+
out.push({
|
|
255
|
+
kind: "marker",
|
|
256
|
+
item: cell.members[0]
|
|
257
|
+
});
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const count = cell.members.length;
|
|
261
|
+
out.push({
|
|
262
|
+
kind: "cluster",
|
|
263
|
+
id: `cluster:${zoom}:${cell.cx}:${cell.cy}`,
|
|
264
|
+
lat: cell.members.reduce((s, m) => s + m.lat, 0) / count,
|
|
265
|
+
lng: cell.members.reduce((s, m) => s + m.lng, 0) / count,
|
|
266
|
+
count,
|
|
267
|
+
members: cell.members,
|
|
268
|
+
bounds: boundsOf(cell.members)
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
return out;
|
|
272
|
+
}
|
|
273
|
+
var DrawSession = class {
|
|
274
|
+
constructor(shape) {
|
|
275
|
+
this.shape = shape;
|
|
276
|
+
this._points = [];
|
|
277
|
+
}
|
|
278
|
+
get points() {
|
|
279
|
+
return this._points;
|
|
280
|
+
}
|
|
281
|
+
get missing() {
|
|
282
|
+
const need = this.shape === "polygon" ? 3 : 2;
|
|
283
|
+
return Math.max(0, need - this._points.length);
|
|
284
|
+
}
|
|
285
|
+
addPoint(point) {
|
|
286
|
+
if (!isValidLat(point.lat) || !isValidLng(point.lng)) return {
|
|
287
|
+
status: "rejected",
|
|
288
|
+
reason: "invalid"
|
|
289
|
+
};
|
|
290
|
+
const p = {
|
|
291
|
+
lat: point.lat,
|
|
292
|
+
lng: point.lng
|
|
293
|
+
};
|
|
294
|
+
if (this.shape !== "polygon") {
|
|
295
|
+
if (this._points.length >= 2) return {
|
|
296
|
+
status: "rejected",
|
|
297
|
+
reason: "invalid"
|
|
298
|
+
};
|
|
299
|
+
const first = this._points[0];
|
|
300
|
+
if (first && (haversineMeters(first, p) < 1 || this.shape === "rectangle" && (first.lat === p.lat || first.lng === p.lng))) return {
|
|
301
|
+
status: "rejected",
|
|
302
|
+
reason: "invalid"
|
|
303
|
+
};
|
|
304
|
+
this._points.push(p);
|
|
305
|
+
if (this._points.length === 2) return {
|
|
306
|
+
status: "finished",
|
|
307
|
+
area: this.finish()
|
|
308
|
+
};
|
|
309
|
+
return {
|
|
310
|
+
status: "added",
|
|
311
|
+
count: this._points.length
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (edgeCrossesChain(this._points, p)) return {
|
|
315
|
+
status: "rejected",
|
|
316
|
+
reason: "self-intersecting"
|
|
317
|
+
};
|
|
318
|
+
this._points.push(p);
|
|
319
|
+
return {
|
|
320
|
+
status: "added",
|
|
321
|
+
count: this._points.length
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
undo() {
|
|
325
|
+
return this._points.pop() !== void 0;
|
|
326
|
+
}
|
|
327
|
+
get problem() {
|
|
328
|
+
if (this.missing > 0) return "too-few";
|
|
329
|
+
return this.shape === "polygon" && !isSimplePolygon(this._points) ? "self-intersecting" : null;
|
|
330
|
+
}
|
|
331
|
+
finish() {
|
|
332
|
+
if (this.problem !== null) return null;
|
|
333
|
+
const pts = this._points;
|
|
334
|
+
switch (this.shape) {
|
|
335
|
+
case "circle": return {
|
|
336
|
+
type: "circle",
|
|
337
|
+
lat: pts[0].lat,
|
|
338
|
+
lng: pts[0].lng,
|
|
339
|
+
radiusMeters: Math.max(1, haversineMeters(pts[0], pts[1]))
|
|
340
|
+
};
|
|
341
|
+
case "rectangle": return {
|
|
342
|
+
type: "bbox",
|
|
343
|
+
north: Math.max(pts[0].lat, pts[1].lat),
|
|
344
|
+
south: Math.min(pts[0].lat, pts[1].lat),
|
|
345
|
+
east: Math.max(pts[0].lng, pts[1].lng),
|
|
346
|
+
west: Math.min(pts[0].lng, pts[1].lng)
|
|
347
|
+
};
|
|
348
|
+
case "polygon": return {
|
|
349
|
+
type: "polygon",
|
|
350
|
+
points: pts.map((p) => ({ ...p }))
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
const PIN_SHAPES = [
|
|
356
|
+
"circle",
|
|
357
|
+
"square",
|
|
358
|
+
"diamond",
|
|
359
|
+
"hexagon"
|
|
360
|
+
];
|
|
361
|
+
const PIN_COLORS = [
|
|
362
|
+
"#1d4ed8",
|
|
363
|
+
"#047857",
|
|
364
|
+
"#b45309",
|
|
365
|
+
"#be123c",
|
|
366
|
+
"#6d28d9",
|
|
367
|
+
"#0e7490",
|
|
368
|
+
"#a21caf",
|
|
369
|
+
"#475569"
|
|
370
|
+
];
|
|
371
|
+
function categoriesOf(markers) {
|
|
372
|
+
return Array.from(new Set(markers.map((m) => m.category).filter((c) => !!c))).sort((a, b) => a.localeCompare(b, "en-US"));
|
|
373
|
+
}
|
|
374
|
+
function pinStyle(marker, categories) {
|
|
375
|
+
const index = marker.category ? Math.max(0, categories.indexOf(marker.category)) : 0;
|
|
376
|
+
return {
|
|
377
|
+
shape: PIN_SHAPES[index % PIN_SHAPES.length],
|
|
378
|
+
color: marker.color?.trim() || PIN_COLORS[index % PIN_COLORS.length]
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
function pinGlyph(marker) {
|
|
382
|
+
const icon = Array.from((marker.icon ?? "").trim()).slice(0, 2).join("");
|
|
383
|
+
if (icon) return icon;
|
|
384
|
+
return (Array.from((marker.label ?? "").trim())[0] ?? "").toUpperCase();
|
|
385
|
+
}
|
|
386
|
+
function buildPin(doc, style, glyph, selected) {
|
|
387
|
+
const pin = doc.createElement("div");
|
|
388
|
+
pin.className = `ui-map__pin ui-map__pin--${style.shape}${selected ? " ui-map__pin--selected" : ""}`;
|
|
389
|
+
pin.style.setProperty("--pin-color", style.color);
|
|
390
|
+
const shape = doc.createElement("span");
|
|
391
|
+
shape.className = "ui-map__pin-shape";
|
|
392
|
+
const text = doc.createElement("span");
|
|
393
|
+
text.className = "ui-map__pin-glyph";
|
|
394
|
+
text.textContent = glyph;
|
|
395
|
+
pin.append(shape, text);
|
|
396
|
+
return pin;
|
|
397
|
+
}
|
|
398
|
+
function buildCluster(doc, countText) {
|
|
399
|
+
const el = doc.createElement("div");
|
|
400
|
+
el.className = "ui-map__cluster";
|
|
401
|
+
const text = doc.createElement("span");
|
|
402
|
+
text.className = "ui-map__cluster-count";
|
|
403
|
+
text.textContent = countText;
|
|
404
|
+
el.append(text);
|
|
405
|
+
return el;
|
|
406
|
+
}
|
|
407
|
+
function tileSourceState(template, attribution) {
|
|
408
|
+
const t = (template ?? "").trim();
|
|
409
|
+
if (!t) return "none";
|
|
410
|
+
if (/[\u0000-\u001f\u007f\\]/.test(t)) return "invalid";
|
|
411
|
+
if (!/^(https?:\/\/|\/\/|\/(?![\/\\])|data:image\/)/i.test(t)) return "invalid";
|
|
412
|
+
if (!(attribution ?? "").trim()) return "no-attribution";
|
|
413
|
+
return "ok";
|
|
414
|
+
}
|
|
415
|
+
function normalizeSubdomains(value) {
|
|
416
|
+
if (Array.isArray(value)) {
|
|
417
|
+
const list = value.map((v) => String(v).trim()).filter(Boolean);
|
|
418
|
+
return list.length ? list : "abc";
|
|
419
|
+
}
|
|
420
|
+
return (typeof value === "string" ? value.trim() : "") || "abc";
|
|
421
|
+
}
|
|
422
|
+
const UI_MAP_ENGINE_LOADER = new InjectionToken("UI_MAP_ENGINE_LOADER", {
|
|
423
|
+
providedIn: "root",
|
|
424
|
+
factory: () => () => import("leaflet")
|
|
425
|
+
});
|
|
426
|
+
var UiMapInfoDirective = class UiMapInfoDirective {
|
|
427
|
+
constructor() {
|
|
428
|
+
this.typeFrom = input("", {
|
|
429
|
+
...ngDevMode ? { debugName: "typeFrom" } : /* istanbul ignore next */ {},
|
|
430
|
+
alias: "uiMapInfo"
|
|
431
|
+
});
|
|
432
|
+
this.template = inject(TemplateRef);
|
|
433
|
+
}
|
|
434
|
+
static ngTemplateContextGuard(_dir, _ctx) {
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
static {
|
|
438
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
439
|
+
minVersion: "12.0.0",
|
|
440
|
+
version: "22.2.2",
|
|
441
|
+
ngImport: i0,
|
|
442
|
+
type: UiMapInfoDirective,
|
|
443
|
+
deps: [],
|
|
444
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
static {
|
|
448
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
449
|
+
minVersion: "17.1.0",
|
|
450
|
+
version: "22.2.2",
|
|
451
|
+
type: UiMapInfoDirective,
|
|
452
|
+
isStandalone: true,
|
|
453
|
+
selector: "ng-template[uiMapInfo]",
|
|
454
|
+
inputs: { typeFrom: {
|
|
455
|
+
classPropertyName: "typeFrom",
|
|
456
|
+
publicName: "uiMapInfo",
|
|
457
|
+
isSignal: true,
|
|
458
|
+
isRequired: false,
|
|
459
|
+
transformFunction: null
|
|
460
|
+
} },
|
|
461
|
+
ngImport: i0
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
466
|
+
minVersion: "12.0.0",
|
|
467
|
+
version: "22.2.2",
|
|
468
|
+
ngImport: i0,
|
|
469
|
+
type: UiMapInfoDirective,
|
|
470
|
+
decorators: [{
|
|
471
|
+
type: Directive,
|
|
472
|
+
args: [{
|
|
473
|
+
selector: "ng-template[uiMapInfo]",
|
|
474
|
+
standalone: true
|
|
475
|
+
}]
|
|
476
|
+
}],
|
|
477
|
+
propDecorators: { typeFrom: [{
|
|
478
|
+
type: i0.Input,
|
|
479
|
+
args: [{
|
|
480
|
+
isSignal: true,
|
|
481
|
+
alias: "uiMapInfo",
|
|
482
|
+
required: false
|
|
483
|
+
}]
|
|
484
|
+
}] }
|
|
485
|
+
});
|
|
486
|
+
const DEFAULT_CENTER = {
|
|
487
|
+
lat: 39.8283,
|
|
488
|
+
lng: -98.5795
|
|
489
|
+
};
|
|
490
|
+
const DEFAULT_ZOOM = 4;
|
|
491
|
+
const IDLE_EMIT_MS = 250;
|
|
492
|
+
let nextMapId = 0;
|
|
493
|
+
var MapComponent = class MapComponent {
|
|
494
|
+
constructor() {
|
|
495
|
+
this.labels = inject(UiLabelsService);
|
|
496
|
+
this.zone = inject(NgZone);
|
|
497
|
+
this.destroyRef = inject(DestroyRef);
|
|
498
|
+
this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
499
|
+
this.loadEngine = inject(UI_MAP_ENGINE_LOADER);
|
|
500
|
+
this.helpId = `ui-map-help-${nextMapId++}`;
|
|
501
|
+
this.markers = input([], ...ngDevMode ? [{ debugName: "markers" }] : /* istanbul ignore next */ []);
|
|
502
|
+
this.selectedId = model(null, ...ngDevMode ? [{ debugName: "selectedId" }] : /* istanbul ignore next */ []);
|
|
503
|
+
this.center = input(null, ...ngDevMode ? [{ debugName: "center" }] : /* istanbul ignore next */ []);
|
|
504
|
+
this.zoom = input(null, ...ngDevMode ? [{ debugName: "zoom" }] : /* istanbul ignore next */ []);
|
|
505
|
+
this.initialCenter = input(DEFAULT_CENTER, ...ngDevMode ? [{ debugName: "initialCenter" }] : /* istanbul ignore next */ []);
|
|
506
|
+
this.initialZoom = input(DEFAULT_ZOOM, ...ngDevMode ? [{ debugName: "initialZoom" }] : /* istanbul ignore next */ []);
|
|
507
|
+
this.fitToMarkers = input(true, ...ngDevMode ? [{ debugName: "fitToMarkers" }] : /* istanbul ignore next */ []);
|
|
508
|
+
this.fitKey = input(void 0, ...ngDevMode ? [{ debugName: "fitKey" }] : /* istanbul ignore next */ []);
|
|
509
|
+
this.fitPadding = input(40, ...ngDevMode ? [{ debugName: "fitPadding" }] : /* istanbul ignore next */ []);
|
|
510
|
+
this.fitMaxZoom = input(16, ...ngDevMode ? [{ debugName: "fitMaxZoom" }] : /* istanbul ignore next */ []);
|
|
511
|
+
this.tileUrlTemplate = input("", ...ngDevMode ? [{ debugName: "tileUrlTemplate" }] : /* istanbul ignore next */ []);
|
|
512
|
+
this.tileAttribution = input("", ...ngDevMode ? [{ debugName: "tileAttribution" }] : /* istanbul ignore next */ []);
|
|
513
|
+
this.tileAttributionUrl = input("", ...ngDevMode ? [{ debugName: "tileAttributionUrl" }] : /* istanbul ignore next */ []);
|
|
514
|
+
this.subdomains = input("abc", ...ngDevMode ? [{ debugName: "subdomains" }] : /* istanbul ignore next */ []);
|
|
515
|
+
this.minZoom = input(0, ...ngDevMode ? [{ debugName: "minZoom" }] : /* istanbul ignore next */ []);
|
|
516
|
+
this.maxZoom = input(19, ...ngDevMode ? [{ debugName: "maxZoom" }] : /* istanbul ignore next */ []);
|
|
517
|
+
this.clustering = input(true, ...ngDevMode ? [{ debugName: "clustering" }] : /* istanbul ignore next */ []);
|
|
518
|
+
this.clusterRadius = input(60, ...ngDevMode ? [{ debugName: "clusterRadius" }] : /* istanbul ignore next */ []);
|
|
519
|
+
this.clusterMaxZoom = input(16, ...ngDevMode ? [{ debugName: "clusterMaxZoom" }] : /* istanbul ignore next */ []);
|
|
520
|
+
this.drawModes = input([], ...ngDevMode ? [{ debugName: "drawModes" }] : /* istanbul ignore next */ []);
|
|
521
|
+
this.area = model(null, ...ngDevMode ? [{ debugName: "area" }] : /* istanbul ignore next */ []);
|
|
522
|
+
this.readOnly = input(false, ...ngDevMode ? [{ debugName: "readOnly" }] : /* istanbul ignore next */ []);
|
|
523
|
+
this.fitToArea = input(true, ...ngDevMode ? [{ debugName: "fitToArea" }] : /* istanbul ignore next */ []);
|
|
524
|
+
this.ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
525
|
+
this.height = input("420px", ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
526
|
+
this.showList = input(false, ...ngDevMode ? [{ debugName: "showList" }] : /* istanbul ignore next */ []);
|
|
527
|
+
this.listLimit = input(200, ...ngDevMode ? [{ debugName: "listLimit" }] : /* istanbul ignore next */ []);
|
|
528
|
+
this.loading = input(false, ...ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []);
|
|
529
|
+
this.idleDelay = input(IDLE_EMIT_MS, ...ngDevMode ? [{ debugName: "idleDelay" }] : /* istanbul ignore next */ []);
|
|
530
|
+
this.scrollWheelZoom = input(true, ...ngDevMode ? [{ debugName: "scrollWheelZoom" }] : /* istanbul ignore next */ []);
|
|
531
|
+
this.boundsChange = output();
|
|
532
|
+
this.viewChange = output();
|
|
533
|
+
this.markerClick = output();
|
|
534
|
+
this.info = contentChild(UiMapInfoDirective, ...ngDevMode ? [{ debugName: "info" }] : /* istanbul ignore next */ []);
|
|
535
|
+
this.canvas = viewChild("canvas", ...ngDevMode ? [{ debugName: "canvas" }] : /* istanbul ignore next */ []);
|
|
536
|
+
this.engine = signal(null, ...ngDevMode ? [{ debugName: "engine" }] : /* istanbul ignore next */ []);
|
|
537
|
+
this.engineFailed = signal(false, ...ngDevMode ? [{ debugName: "engineFailed" }] : /* istanbul ignore next */ []);
|
|
538
|
+
this.tilesFailed = signal(false, ...ngDevMode ? [{ debugName: "tilesFailed" }] : /* istanbul ignore next */ []);
|
|
539
|
+
this.announcement = signal("", ...ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []);
|
|
540
|
+
this.zoomLevel = signal(DEFAULT_ZOOM, ...ngDevMode ? [{ debugName: "zoomLevel" }] : /* istanbul ignore next */ []);
|
|
541
|
+
this.bounds = signal(null, ...ngDevMode ? [{ debugName: "bounds" }] : /* istanbul ignore next */ []);
|
|
542
|
+
this.drawing = signal(null, ...ngDevMode ? [{ debugName: "drawing" }] : /* istanbul ignore next */ []);
|
|
543
|
+
this.draftPoints = signal([], ...ngDevMode ? [{ debugName: "draftPoints" }] : /* istanbul ignore next */ []);
|
|
544
|
+
this.ready = computed(() => this.engine() !== null, ...ngDevMode ? [{ debugName: "ready" }] : /* istanbul ignore next */ []);
|
|
545
|
+
this.tileState = computed(() => tileSourceState(this.tileUrlTemplate(), this.tileAttribution()), ...ngDevMode ? [{ debugName: "tileState" }] : /* istanbul ignore next */ []);
|
|
546
|
+
this.unavailable = computed(() => this.tileState() !== "ok" || this.engineFailed(), ...ngDevMode ? [{ debugName: "unavailable" }] : /* istanbul ignore next */ []);
|
|
547
|
+
this.unavailableText = computed(() => {
|
|
548
|
+
if (this.engineFailed() && this.tileState() === "ok") return this.labels.t("map.unavailableLoadFailed");
|
|
549
|
+
switch (this.tileState()) {
|
|
550
|
+
case "invalid": return this.labels.t("map.unavailableInvalidTiles");
|
|
551
|
+
case "no-attribution": return this.labels.t("map.unavailableNoAttribution");
|
|
552
|
+
default: return this.labels.t("map.unavailableNoTiles");
|
|
553
|
+
}
|
|
554
|
+
}, ...ngDevMode ? [{ debugName: "unavailableText" }] : /* istanbul ignore next */ []);
|
|
555
|
+
this.regionLabel = computed(() => this.ariaLabel() ?? this.labels.t("map.ariaLabel"), ...ngDevMode ? [{ debugName: "regionLabel" }] : /* istanbul ignore next */ []);
|
|
556
|
+
this.attributionUrl = computed(() => {
|
|
557
|
+
const u = this.tileAttributionUrl().trim();
|
|
558
|
+
return /^https?:\/\//i.test(u) && !/[\s\\]/.test(u) ? u : null;
|
|
559
|
+
}, ...ngDevMode ? [{ debugName: "attributionUrl" }] : /* istanbul ignore next */ []);
|
|
560
|
+
this.drawEnabled = computed(() => !this.readOnly() && this.drawModes().length > 0, ...ngDevMode ? [{ debugName: "drawEnabled" }] : /* istanbul ignore next */ []);
|
|
561
|
+
this.canZoomIn = computed(() => this.zoomLevel() < this.maxZoom(), ...ngDevMode ? [{ debugName: "canZoomIn" }] : /* istanbul ignore next */ []);
|
|
562
|
+
this.canZoomOut = computed(() => this.zoomLevel() > this.minZoom(), ...ngDevMode ? [{ debugName: "canZoomOut" }] : /* istanbul ignore next */ []);
|
|
563
|
+
this.validMarkers = computed(() => this.markers().filter((m) => isValidLatLng(m)), ...ngDevMode ? [{ debugName: "validMarkers" }] : /* istanbul ignore next */ []);
|
|
564
|
+
this.selectedMarker = computed(() => {
|
|
565
|
+
const id = this.selectedId();
|
|
566
|
+
return id === null ? null : this.validMarkers().find((m) => m.id === id) ?? null;
|
|
567
|
+
}, ...ngDevMode ? [{ debugName: "selectedMarker" }] : /* istanbul ignore next */ []);
|
|
568
|
+
this.categories = computed(() => categoriesOf(this.validMarkers()), ...ngDevMode ? [{ debugName: "categories" }] : /* istanbul ignore next */ []);
|
|
569
|
+
this.styles = computed(() => {
|
|
570
|
+
const cats = this.categories();
|
|
571
|
+
return new Map(this.validMarkers().map((m) => [m.id, pinStyle(m, cats)]));
|
|
572
|
+
}, ...ngDevMode ? [{ debugName: "styles" }] : /* istanbul ignore next */ []);
|
|
573
|
+
this.renderItems = computed(() => {
|
|
574
|
+
const valid = this.validMarkers();
|
|
575
|
+
const selected = this.selectedId();
|
|
576
|
+
const win = this.engine() ? this.renderWindow() : null;
|
|
577
|
+
const all = win ? valid.filter((m) => m.id === selected || boundsContains(win.outer, m)) : valid;
|
|
578
|
+
if (!this.clustering()) return all.map((item) => ({
|
|
579
|
+
kind: "marker",
|
|
580
|
+
item
|
|
581
|
+
}));
|
|
582
|
+
const chosen = selected === null ? void 0 : all.find((m) => m.id === selected);
|
|
583
|
+
const items = clusterMarkers(chosen ? all.filter((m) => m !== chosen) : all, this.zoomLevel(), {
|
|
584
|
+
radiusPx: this.clusterRadius(),
|
|
585
|
+
maxZoom: this.dissolveZoom()
|
|
586
|
+
});
|
|
587
|
+
return chosen ? [...items, {
|
|
588
|
+
kind: "marker",
|
|
589
|
+
item: chosen
|
|
590
|
+
}] : items;
|
|
591
|
+
}, ...ngDevMode ? [{ debugName: "renderItems" }] : /* istanbul ignore next */ []);
|
|
592
|
+
this.dissolveZoom = computed(() => Math.min(this.clusterMaxZoom(), this.maxZoom()), ...ngDevMode ? [{ debugName: "dissolveZoom" }] : /* istanbul ignore next */ []);
|
|
593
|
+
this.markerSignature = computed(() => this.validMarkers().map((m) => `${m.id}@${m.lat},${m.lng}`).join("|"), ...ngDevMode ? [{ debugName: "markerSignature" }] : /* istanbul ignore next */ []);
|
|
594
|
+
this.inView = computed(() => {
|
|
595
|
+
const b = this.bounds();
|
|
596
|
+
const all = this.validMarkers();
|
|
597
|
+
return b && !this.unavailable() && this.engine() ? all.filter((m) => boundsContains(b, m)) : all;
|
|
598
|
+
}, ...ngDevMode ? [{ debugName: "inView" }] : /* istanbul ignore next */ []);
|
|
599
|
+
this.listItems = computed(() => {
|
|
600
|
+
const limit = Math.max(0, Math.floor(this.listLimit()));
|
|
601
|
+
return this.inView().slice(0, limit);
|
|
602
|
+
}, ...ngDevMode ? [{ debugName: "listItems" }] : /* istanbul ignore next */ []);
|
|
603
|
+
this.listSummary = computed(() => {
|
|
604
|
+
const shown = this.listItems().length;
|
|
605
|
+
const total = this.inView().length;
|
|
606
|
+
if (shown < total) return this.labels.t("map.listShowing", {
|
|
607
|
+
shown,
|
|
608
|
+
total
|
|
609
|
+
});
|
|
610
|
+
return this.labels.t(total === 1 ? "map.listCount_one" : "map.listCount_other", { count: total });
|
|
611
|
+
}, ...ngDevMode ? [{ debugName: "listSummary" }] : /* istanbul ignore next */ []);
|
|
612
|
+
this.listTab = signal(null, ...ngDevMode ? [{ debugName: "listTab" }] : /* istanbul ignore next */ []);
|
|
613
|
+
this.listTabId = computed(() => {
|
|
614
|
+
const ids = this.listItems().map((m) => m.id);
|
|
615
|
+
const wanted = this.listTab();
|
|
616
|
+
if (wanted && ids.includes(wanted)) return wanted;
|
|
617
|
+
const sel = this.selectedId();
|
|
618
|
+
if (sel && ids.includes(sel)) return sel;
|
|
619
|
+
return ids[0] ?? null;
|
|
620
|
+
}, ...ngDevMode ? [{ debugName: "listTabId" }] : /* istanbul ignore next */ []);
|
|
621
|
+
this.areaText = computed(() => {
|
|
622
|
+
const a = this.area();
|
|
623
|
+
return a ? this.describeArea(a) : "";
|
|
624
|
+
}, ...ngDevMode ? [{ debugName: "areaText" }] : /* istanbul ignore next */ []);
|
|
625
|
+
this.drawInstruction = computed(() => {
|
|
626
|
+
const shape = this.drawing();
|
|
627
|
+
return shape ? this.labels.t(shape === "circle" ? "map.draw.circle" : shape === "rectangle" ? "map.draw.rectangle" : "map.draw.polygon") : "";
|
|
628
|
+
}, ...ngDevMode ? [{ debugName: "drawInstruction" }] : /* istanbul ignore next */ []);
|
|
629
|
+
this.session = null;
|
|
630
|
+
this.lastDrawn = null;
|
|
631
|
+
this.autoFitDone = false;
|
|
632
|
+
this.userMoved = false;
|
|
633
|
+
this.lastFitKey = void 0;
|
|
634
|
+
this.pendingFit = false;
|
|
635
|
+
this.wasLoading = false;
|
|
636
|
+
this.windowCell = -1;
|
|
637
|
+
this.listenersAbort = null;
|
|
638
|
+
this.renderWindow = signal(null, ...ngDevMode ? [{ debugName: "renderWindow" }] : /* istanbul ignore next */ []);
|
|
639
|
+
this.renderInner = null;
|
|
640
|
+
this.emitTimer = null;
|
|
641
|
+
this.resizeObserver = null;
|
|
642
|
+
this.layerById = /* @__PURE__ */ new Map();
|
|
643
|
+
this.itemById = /* @__PURE__ */ new Map();
|
|
644
|
+
this.readyWaiters = [];
|
|
645
|
+
this.cursor = null;
|
|
646
|
+
this.centerNow = DEFAULT_CENTER;
|
|
647
|
+
effect((onCleanup) => {
|
|
648
|
+
const host = this.canvas()?.nativeElement;
|
|
649
|
+
if (!host || !this.isBrowser) return;
|
|
650
|
+
let cancelled = false;
|
|
651
|
+
onCleanup(() => {
|
|
652
|
+
cancelled = true;
|
|
653
|
+
this.teardown();
|
|
654
|
+
});
|
|
655
|
+
Promise.resolve().then(() => this.loadEngine()).then((mod) => {
|
|
656
|
+
if (cancelled) return;
|
|
657
|
+
const L = mod.default ?? mod;
|
|
658
|
+
this.zone.runOutsideAngular(() => this.create(L, host));
|
|
659
|
+
}).catch(() => {
|
|
660
|
+
if (cancelled) return;
|
|
661
|
+
this.engineFailed.set(true);
|
|
662
|
+
this.resolveWaiters(false);
|
|
663
|
+
});
|
|
664
|
+
});
|
|
665
|
+
effect(() => {
|
|
666
|
+
const e = this.engine();
|
|
667
|
+
if (e) {
|
|
668
|
+
this.tileState();
|
|
669
|
+
this.tileUrlTemplate();
|
|
670
|
+
this.subdomains();
|
|
671
|
+
this.minZoom();
|
|
672
|
+
this.maxZoom();
|
|
673
|
+
untracked(() => this.syncTiles(e));
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
effect(() => {
|
|
677
|
+
const e = this.engine();
|
|
678
|
+
if (e) {
|
|
679
|
+
this.renderItems();
|
|
680
|
+
this.styles();
|
|
681
|
+
untracked(() => this.syncMarkers(e));
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
effect(() => {
|
|
685
|
+
const e = this.engine();
|
|
686
|
+
if (e) {
|
|
687
|
+
this.area();
|
|
688
|
+
untracked(() => this.syncArea(e));
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
effect(() => {
|
|
692
|
+
const e = this.engine();
|
|
693
|
+
if (e) {
|
|
694
|
+
this.draftPoints();
|
|
695
|
+
this.drawing();
|
|
696
|
+
untracked(() => this.syncDraft(e));
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
effect(() => {
|
|
700
|
+
const e = this.engine();
|
|
701
|
+
if (e) {
|
|
702
|
+
this.center();
|
|
703
|
+
this.zoom();
|
|
704
|
+
untracked(() => this.applyControlledView(e));
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
effect(() => {
|
|
708
|
+
if (this.engine()) {
|
|
709
|
+
this.markerSignature();
|
|
710
|
+
this.fitToMarkers();
|
|
711
|
+
this.center();
|
|
712
|
+
this.zoom();
|
|
713
|
+
untracked(() => this.autoFit());
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
effect(() => {
|
|
717
|
+
if (this.engine()) {
|
|
718
|
+
const key = this.fitKey();
|
|
719
|
+
untracked(() => this.fitOnKey(key));
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
effect(() => {
|
|
723
|
+
const e = this.engine();
|
|
724
|
+
const cell = this.clustering() ? Math.max(1, this.clusterRadius()) : 0;
|
|
725
|
+
if (e) untracked(() => {
|
|
726
|
+
if (cell !== this.windowCell) this.updateRenderWindow(e.map, this.visibleBox(e.map), true);
|
|
727
|
+
});
|
|
728
|
+
});
|
|
729
|
+
effect(() => {
|
|
730
|
+
const e = this.engine();
|
|
731
|
+
const loading = this.loading();
|
|
732
|
+
if (e) untracked(() => {
|
|
733
|
+
if (this.wasLoading && !loading && this.pendingFit) this.autoFit();
|
|
734
|
+
});
|
|
735
|
+
this.wasLoading = loading;
|
|
736
|
+
});
|
|
737
|
+
effect(() => {
|
|
738
|
+
const e = this.engine();
|
|
739
|
+
if (e) {
|
|
740
|
+
this.drawing();
|
|
741
|
+
untracked(() => this.syncDrawMode(e));
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
effect(() => {
|
|
745
|
+
const e = this.engine();
|
|
746
|
+
if (e) {
|
|
747
|
+
const wheel = this.scrollWheelZoom();
|
|
748
|
+
untracked(() => wheel ? e.map.scrollWheelZoom.enable() : e.map.scrollWheelZoom.disable());
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
this.destroyRef.onDestroy(() => {
|
|
752
|
+
this.teardown();
|
|
753
|
+
this.resolveWaiters(false);
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
whenReady() {
|
|
757
|
+
if (this.engine()) return Promise.resolve(true);
|
|
758
|
+
if (this.unavailable()) return Promise.resolve(false);
|
|
759
|
+
return new Promise((resolve) => this.readyWaiters.push(resolve));
|
|
760
|
+
}
|
|
761
|
+
fitMarkers(animate = !this.reducedMotion()) {
|
|
762
|
+
if (!this.engine()) return;
|
|
763
|
+
const b = boundsOf(this.validMarkers());
|
|
764
|
+
if (b) this.fitBounds(b, animate);
|
|
765
|
+
}
|
|
766
|
+
fitBounds(b, animate = !this.reducedMotion(), maxZoom = this.fitMaxZoom()) {
|
|
767
|
+
const e = this.engine();
|
|
768
|
+
if (!e) return;
|
|
769
|
+
const pad = Math.max(0, this.fitPadding());
|
|
770
|
+
e.map.fitBounds(e.L.latLngBounds([b.south, b.west], [b.north, b.east]), {
|
|
771
|
+
padding: [pad, pad],
|
|
772
|
+
maxZoom,
|
|
773
|
+
animate
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
setView(center, zoom) {
|
|
777
|
+
const e = this.engine();
|
|
778
|
+
if (!e || !isValidLatLng(center)) return;
|
|
779
|
+
e.map.setView([center.lat, center.lng], zoom ?? e.map.getZoom(), { animate: !this.reducedMotion() });
|
|
780
|
+
}
|
|
781
|
+
zoomIn() {
|
|
782
|
+
this.engine()?.map.zoomIn(1, { animate: !this.reducedMotion() });
|
|
783
|
+
}
|
|
784
|
+
zoomOut() {
|
|
785
|
+
this.engine()?.map.zoomOut(1, { animate: !this.reducedMotion() });
|
|
786
|
+
}
|
|
787
|
+
onZoomButton(direction) {
|
|
788
|
+
this.markUserMoved();
|
|
789
|
+
if (direction === "in") this.zoomIn();
|
|
790
|
+
else this.zoomOut();
|
|
791
|
+
}
|
|
792
|
+
markUserMoved() {
|
|
793
|
+
this.userMoved = true;
|
|
794
|
+
this.pendingFit = false;
|
|
795
|
+
}
|
|
796
|
+
invalidateSize() {
|
|
797
|
+
this.engine()?.map.invalidateSize();
|
|
798
|
+
}
|
|
799
|
+
startDraw(shape) {
|
|
800
|
+
if (this.readOnly() || !this.drawModes().includes(shape) || !this.engine()) return;
|
|
801
|
+
this.session = new DrawSession(shape);
|
|
802
|
+
this.cursor = null;
|
|
803
|
+
this.draftPoints.set([]);
|
|
804
|
+
this.drawing.set(shape);
|
|
805
|
+
this.selectedId.set(null);
|
|
806
|
+
this.announce(this.labels.t(shape === "circle" ? "map.draw.circle" : shape === "rectangle" ? "map.draw.rectangle" : "map.draw.polygon"));
|
|
807
|
+
}
|
|
808
|
+
addPointAtCenter() {
|
|
809
|
+
const e = this.engine();
|
|
810
|
+
if (!e || !this.session) return;
|
|
811
|
+
const c = e.map.getCenter();
|
|
812
|
+
this.addDrawPoint({
|
|
813
|
+
lat: clampLat(c.lat),
|
|
814
|
+
lng: clampLng(c.lng)
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
finishDraw() {
|
|
818
|
+
const s = this.session;
|
|
819
|
+
if (!s) return;
|
|
820
|
+
const area = s.finish();
|
|
821
|
+
if (!area) {
|
|
822
|
+
if (s.problem === "self-intersecting") this.announce(this.labels.t("map.draw.finishSelfIntersecting"));
|
|
823
|
+
else this.announce(this.labels.t(s.missing === 1 ? "map.draw.needMore_one" : "map.draw.needMore_other", { count: s.missing }));
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
this.commitArea(area);
|
|
827
|
+
}
|
|
828
|
+
undoDrawPoint() {
|
|
829
|
+
const s = this.session;
|
|
830
|
+
if (!s || !s.undo()) return;
|
|
831
|
+
this.draftPoints.set([...s.points]);
|
|
832
|
+
this.announce(this.labels.t("map.draw.pointRemoved", { count: s.points.length }));
|
|
833
|
+
}
|
|
834
|
+
cancelDraw() {
|
|
835
|
+
if (!this.session) return;
|
|
836
|
+
this.endSession();
|
|
837
|
+
this.announce(this.labels.t("map.draw.cancelled"));
|
|
838
|
+
}
|
|
839
|
+
clearArea() {
|
|
840
|
+
if (this.readOnly() || !this.area()) return;
|
|
841
|
+
this.lastDrawn = null;
|
|
842
|
+
this.area.set(null);
|
|
843
|
+
this.announce(this.labels.t("map.draw.cleared"));
|
|
844
|
+
}
|
|
845
|
+
styleOf(m) {
|
|
846
|
+
return this.styles().get(m.id) ?? pinStyle(m, this.categories());
|
|
847
|
+
}
|
|
848
|
+
glyphOf(m) {
|
|
849
|
+
return pinGlyph(m);
|
|
850
|
+
}
|
|
851
|
+
drawLabel(shape) {
|
|
852
|
+
return this.labels.t(shape === "circle" ? "map.drawCircle" : shape === "rectangle" ? "map.drawRectangle" : "map.drawPolygon");
|
|
853
|
+
}
|
|
854
|
+
closeInfo() {
|
|
855
|
+
this.selectedId.set(null);
|
|
856
|
+
}
|
|
857
|
+
selectFromList(m) {
|
|
858
|
+
this.selectedId.set(m.id);
|
|
859
|
+
this.markerClick.emit(m);
|
|
860
|
+
this.announceSelected(m);
|
|
861
|
+
this.panToMarker(m);
|
|
862
|
+
}
|
|
863
|
+
announceSelected(m) {
|
|
864
|
+
const name = m.ariaLabel || m.label;
|
|
865
|
+
this.announce(this.labels.t(this.info() ? "map.infoLabel" : "map.placeSelected", { name }));
|
|
866
|
+
}
|
|
867
|
+
onListKey(event) {
|
|
868
|
+
if (![
|
|
869
|
+
"ArrowDown",
|
|
870
|
+
"ArrowUp",
|
|
871
|
+
"Home",
|
|
872
|
+
"End"
|
|
873
|
+
].includes(event.key) || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
874
|
+
const list = event.currentTarget;
|
|
875
|
+
const buttons = Array.from(list.querySelectorAll(".ui-map__place"));
|
|
876
|
+
const at = buttons.indexOf(event.target);
|
|
877
|
+
if (at < 0) return;
|
|
878
|
+
event.preventDefault();
|
|
879
|
+
buttons[event.key === "Home" ? 0 : event.key === "End" ? buttons.length - 1 : Math.min(buttons.length - 1, Math.max(0, at + (event.key === "ArrowDown" ? 1 : -1)))]?.focus();
|
|
880
|
+
}
|
|
881
|
+
onStageKey(event) {
|
|
882
|
+
if (event.altKey || event.ctrlKey || event.metaKey) return;
|
|
883
|
+
const onMap = !!event.target?.classList.contains("leaflet-container");
|
|
884
|
+
if (event.key === "Escape") {
|
|
885
|
+
if (this.session) {
|
|
886
|
+
event.preventDefault();
|
|
887
|
+
this.cancelDraw();
|
|
888
|
+
} else if (this.selectedId() !== null) {
|
|
889
|
+
event.preventDefault();
|
|
890
|
+
this.closeInfo();
|
|
891
|
+
}
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
if (!this.session || !onMap) return;
|
|
895
|
+
if (event.key === " ") {
|
|
896
|
+
event.preventDefault();
|
|
897
|
+
this.addPointAtCenter();
|
|
898
|
+
} else if (event.key === "Enter") {
|
|
899
|
+
event.preventDefault();
|
|
900
|
+
this.finishDraw();
|
|
901
|
+
} else if (event.key === "Backspace") {
|
|
902
|
+
event.preventDefault();
|
|
903
|
+
this.undoDrawPoint();
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
reducedMotion() {
|
|
907
|
+
return this.isBrowser && typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
908
|
+
}
|
|
909
|
+
create(L, host) {
|
|
910
|
+
const reduced = this.reducedMotion();
|
|
911
|
+
const box = boundsOf(this.validMarkers());
|
|
912
|
+
const c = this.center() ?? (box ? {
|
|
913
|
+
lat: (box.north + box.south) / 2,
|
|
914
|
+
lng: (box.east + box.west) / 2
|
|
915
|
+
} : this.initialCenter());
|
|
916
|
+
const z = this.zoom() ?? this.initialZoom();
|
|
917
|
+
const map = L.map(host, {
|
|
918
|
+
center: [c.lat, c.lng],
|
|
919
|
+
zoom: z,
|
|
920
|
+
minZoom: this.minZoom(),
|
|
921
|
+
maxZoom: this.maxZoom(),
|
|
922
|
+
zoomControl: false,
|
|
923
|
+
attributionControl: false,
|
|
924
|
+
zoomAnimation: !reduced,
|
|
925
|
+
fadeAnimation: !reduced,
|
|
926
|
+
markerZoomAnimation: !reduced,
|
|
927
|
+
inertia: !reduced,
|
|
928
|
+
keyboard: true,
|
|
929
|
+
scrollWheelZoom: this.scrollWheelZoom(),
|
|
930
|
+
maxBounds: [[-90, -180], [90, 180]],
|
|
931
|
+
maxBoundsViscosity: 1
|
|
932
|
+
});
|
|
933
|
+
const engine = {
|
|
934
|
+
L,
|
|
935
|
+
map,
|
|
936
|
+
markers: L.layerGroup().addTo(map),
|
|
937
|
+
area: L.layerGroup().addTo(map),
|
|
938
|
+
draft: L.layerGroup().addTo(map),
|
|
939
|
+
tiles: null
|
|
940
|
+
};
|
|
941
|
+
map.on("zoomend", () => this.zone.run(() => {
|
|
942
|
+
this.zoomLevel.set(map.getZoom());
|
|
943
|
+
this.updateRenderWindow(map, this.visibleBox(map));
|
|
944
|
+
}));
|
|
945
|
+
map.on("moveend", () => this.onMoveEnd(map));
|
|
946
|
+
map.on("move", () => this.onMove(map));
|
|
947
|
+
map.on("click", (ev) => this.zone.run(() => this.onMapClick({
|
|
948
|
+
lat: clampLat(ev.latlng.lat),
|
|
949
|
+
lng: clampLng(ev.latlng.lng)
|
|
950
|
+
})));
|
|
951
|
+
map.on("mousemove", (ev) => this.onCursor(engine, {
|
|
952
|
+
lat: clampLat(ev.latlng.lat),
|
|
953
|
+
lng: clampLng(ev.latlng.lng)
|
|
954
|
+
}));
|
|
955
|
+
map.on("dragstart boxzoomend", () => this.markUserMoved());
|
|
956
|
+
this.listenersAbort = new AbortController();
|
|
957
|
+
const opts = {
|
|
958
|
+
signal: this.listenersAbort.signal,
|
|
959
|
+
passive: true
|
|
960
|
+
};
|
|
961
|
+
host.addEventListener("wheel", () => {
|
|
962
|
+
if (this.scrollWheelZoom()) this.markUserMoved();
|
|
963
|
+
}, opts);
|
|
964
|
+
host.addEventListener("dblclick", () => this.markUserMoved(), opts);
|
|
965
|
+
host.addEventListener("touchstart", (ev) => {
|
|
966
|
+
if (ev.touches.length > 1) this.markUserMoved();
|
|
967
|
+
}, opts);
|
|
968
|
+
host.addEventListener("keydown", (ev) => {
|
|
969
|
+
if (!ev.ctrlKey && !ev.metaKey && !ev.altKey && /^(Arrow(Up|Down|Left|Right)|[+\-=_])$/.test(ev.key)) this.markUserMoved();
|
|
970
|
+
}, opts);
|
|
971
|
+
if (typeof ResizeObserver === "function") {
|
|
972
|
+
this.resizeObserver = new ResizeObserver(() => map.invalidateSize());
|
|
973
|
+
this.resizeObserver.observe(host);
|
|
974
|
+
}
|
|
975
|
+
this.autoFitDone = false;
|
|
976
|
+
this.userMoved = false;
|
|
977
|
+
this.lastFitKey = this.fitKey();
|
|
978
|
+
this.pendingFit = false;
|
|
979
|
+
this.renderInner = null;
|
|
980
|
+
this.windowCell = -1;
|
|
981
|
+
this.onMoveEnd(map);
|
|
982
|
+
this.zone.run(() => {
|
|
983
|
+
this.zoomLevel.set(map.getZoom());
|
|
984
|
+
this.engineFailed.set(false);
|
|
985
|
+
this.engine.set(engine);
|
|
986
|
+
this.resolveWaiters(true);
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
teardown() {
|
|
990
|
+
if (this.emitTimer) {
|
|
991
|
+
clearTimeout(this.emitTimer);
|
|
992
|
+
this.emitTimer = null;
|
|
993
|
+
}
|
|
994
|
+
this.resizeObserver?.disconnect();
|
|
995
|
+
this.resizeObserver = null;
|
|
996
|
+
this.listenersAbort?.abort();
|
|
997
|
+
this.listenersAbort = null;
|
|
998
|
+
const e = this.engine();
|
|
999
|
+
if (e) {
|
|
1000
|
+
this.layerById.clear();
|
|
1001
|
+
this.itemById.clear();
|
|
1002
|
+
e.map.off();
|
|
1003
|
+
e.map.remove();
|
|
1004
|
+
this.engine.set(null);
|
|
1005
|
+
this.bounds.set(null);
|
|
1006
|
+
this.renderWindow.set(null);
|
|
1007
|
+
this.renderInner = null;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
resolveWaiters(ok) {
|
|
1011
|
+
const waiters = this.readyWaiters;
|
|
1012
|
+
this.readyWaiters = [];
|
|
1013
|
+
for (const w of waiters) w(ok);
|
|
1014
|
+
}
|
|
1015
|
+
syncTiles(e) {
|
|
1016
|
+
e.tiles?.remove();
|
|
1017
|
+
e.tiles = null;
|
|
1018
|
+
this.tilesFailed.set(false);
|
|
1019
|
+
if (this.tileState() !== "ok") return;
|
|
1020
|
+
const tiles = e.L.tileLayer(this.tileUrlTemplate().trim(), {
|
|
1021
|
+
subdomains: normalizeSubdomains(this.subdomains()),
|
|
1022
|
+
minZoom: this.minZoom(),
|
|
1023
|
+
maxZoom: this.maxZoom(),
|
|
1024
|
+
attribution: "",
|
|
1025
|
+
crossOrigin: false,
|
|
1026
|
+
noWrap: true
|
|
1027
|
+
});
|
|
1028
|
+
tiles.on("tileerror", () => this.zone.run(() => this.tilesFailed.set(true)));
|
|
1029
|
+
tiles.on("load", () => this.zone.run(() => this.tilesFailed.set(false)));
|
|
1030
|
+
tiles.addTo(e.map);
|
|
1031
|
+
e.tiles = tiles;
|
|
1032
|
+
e.map.setMinZoom(this.minZoom());
|
|
1033
|
+
e.map.setMaxZoom(this.maxZoom());
|
|
1034
|
+
}
|
|
1035
|
+
onMoveEnd(map) {
|
|
1036
|
+
const b = map.getBounds();
|
|
1037
|
+
const c = map.getCenter();
|
|
1038
|
+
const next = {
|
|
1039
|
+
north: clampLat(b.getNorth()),
|
|
1040
|
+
south: clampLat(b.getSouth()),
|
|
1041
|
+
east: clampLng(b.getEast()),
|
|
1042
|
+
west: clampLng(b.getWest()),
|
|
1043
|
+
zoom: map.getZoom()
|
|
1044
|
+
};
|
|
1045
|
+
this.centerNow = {
|
|
1046
|
+
lat: clampLat(c.lat),
|
|
1047
|
+
lng: clampLng(c.lng)
|
|
1048
|
+
};
|
|
1049
|
+
this.zone.run(() => {
|
|
1050
|
+
this.bounds.set(next);
|
|
1051
|
+
this.updateRenderWindow(map, next);
|
|
1052
|
+
});
|
|
1053
|
+
if (this.emitTimer) {
|
|
1054
|
+
clearTimeout(this.emitTimer);
|
|
1055
|
+
this.emitTimer = null;
|
|
1056
|
+
}
|
|
1057
|
+
const emit = () => this.zone.run(() => {
|
|
1058
|
+
this.boundsChange.emit(next);
|
|
1059
|
+
this.viewChange.emit({
|
|
1060
|
+
center: this.centerNow,
|
|
1061
|
+
zoom: next.zoom
|
|
1062
|
+
});
|
|
1063
|
+
});
|
|
1064
|
+
const delay = Math.max(0, this.idleDelay());
|
|
1065
|
+
if (delay === 0) emit();
|
|
1066
|
+
else this.emitTimer = setTimeout(() => {
|
|
1067
|
+
this.emitTimer = null;
|
|
1068
|
+
emit();
|
|
1069
|
+
}, delay);
|
|
1070
|
+
}
|
|
1071
|
+
visibleBox(map) {
|
|
1072
|
+
const b = map.getBounds();
|
|
1073
|
+
return {
|
|
1074
|
+
north: clampLat(b.getNorth()),
|
|
1075
|
+
south: clampLat(b.getSouth()),
|
|
1076
|
+
east: clampLng(b.getEast()),
|
|
1077
|
+
west: clampLng(b.getWest()),
|
|
1078
|
+
zoom: map.getZoom()
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
onMove(map) {
|
|
1082
|
+
const inner = this.renderInner;
|
|
1083
|
+
if (!inner) return;
|
|
1084
|
+
const v = this.visibleBox(map);
|
|
1085
|
+
if (v.north <= inner.north && v.south >= inner.south && v.east <= inner.east && v.west >= inner.west) return;
|
|
1086
|
+
this.zone.run(() => this.updateRenderWindow(map, v));
|
|
1087
|
+
}
|
|
1088
|
+
updateRenderWindow(map, v, force = false) {
|
|
1089
|
+
const inner = this.renderInner;
|
|
1090
|
+
const current = this.renderWindow();
|
|
1091
|
+
if (!force && inner && current && current.zoom === v.zoom && v.north <= inner.north && v.south >= inner.south && v.east <= inner.east && v.west >= inner.west) return;
|
|
1092
|
+
const size = map.getSize();
|
|
1093
|
+
const cell = this.clustering() ? Math.max(1, this.clusterRadius()) : 0;
|
|
1094
|
+
const inX = Math.max(size.x * .25, cell), inY = Math.max(size.y * .25, cell);
|
|
1095
|
+
const outX = Math.max(size.x * .5, inX + cell), outY = Math.max(size.y * .5, inY + cell);
|
|
1096
|
+
const grow = (mx, my) => {
|
|
1097
|
+
const nw = map.containerPointToLatLng([-mx, -my]);
|
|
1098
|
+
const se = map.containerPointToLatLng([size.x + mx, size.y + my]);
|
|
1099
|
+
return {
|
|
1100
|
+
north: clampLat(nw.lat),
|
|
1101
|
+
south: clampLat(se.lat),
|
|
1102
|
+
east: clampLng(se.lng),
|
|
1103
|
+
west: clampLng(nw.lng)
|
|
1104
|
+
};
|
|
1105
|
+
};
|
|
1106
|
+
this.windowCell = cell;
|
|
1107
|
+
this.renderInner = grow(inX, inY);
|
|
1108
|
+
this.renderWindow.set({
|
|
1109
|
+
outer: grow(outX, outY),
|
|
1110
|
+
zoom: v.zoom
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1113
|
+
syncMarkers(e) {
|
|
1114
|
+
const items = this.renderItems();
|
|
1115
|
+
const selected = this.selectedId();
|
|
1116
|
+
const keep = /* @__PURE__ */ new Set();
|
|
1117
|
+
const doc = e.map.getContainer().ownerDocument;
|
|
1118
|
+
for (const item of items) {
|
|
1119
|
+
const id = item.kind === "marker" ? `m:${item.item.id}` : item.id;
|
|
1120
|
+
keep.add(id);
|
|
1121
|
+
this.itemById.set(id, item);
|
|
1122
|
+
let signature;
|
|
1123
|
+
let latLng;
|
|
1124
|
+
let build;
|
|
1125
|
+
let title;
|
|
1126
|
+
if (item.kind === "marker") {
|
|
1127
|
+
const m = item.item;
|
|
1128
|
+
const st = this.styles().get(m.id) ?? pinStyle(m, this.categories());
|
|
1129
|
+
const glyph = pinGlyph(m);
|
|
1130
|
+
const isSelected = m.id === selected;
|
|
1131
|
+
signature = `${m.lat},${m.lng}|${st.shape}|${st.color}|${glyph}|${isSelected}|${m.label}`;
|
|
1132
|
+
latLng = [m.lat, m.lng];
|
|
1133
|
+
title = m.label;
|
|
1134
|
+
build = () => e.L.divIcon({
|
|
1135
|
+
html: buildPin(doc, st, glyph, isSelected),
|
|
1136
|
+
className: "ui-map__icon",
|
|
1137
|
+
iconSize: [32, 32],
|
|
1138
|
+
iconAnchor: [16, 16]
|
|
1139
|
+
});
|
|
1140
|
+
} else {
|
|
1141
|
+
title = this.labels.t("map.clusterTitle", { count: item.count });
|
|
1142
|
+
signature = `${item.lat},${item.lng}|c${item.count}|${title}`;
|
|
1143
|
+
latLng = [item.lat, item.lng];
|
|
1144
|
+
build = () => e.L.divIcon({
|
|
1145
|
+
html: buildCluster(doc, this.labels.formatNumber(item.count)),
|
|
1146
|
+
className: "ui-map__icon",
|
|
1147
|
+
iconSize: [44, 44],
|
|
1148
|
+
iconAnchor: [22, 22]
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
const existing = this.layerById.get(id);
|
|
1152
|
+
if (existing && existing.signature === signature) continue;
|
|
1153
|
+
if (existing) {
|
|
1154
|
+
existing.layer.setLatLng(latLng);
|
|
1155
|
+
existing.layer.options.title = title;
|
|
1156
|
+
existing.layer.setZIndexOffset(item.kind === "marker" && item.item.id === selected ? 1e3 : 0);
|
|
1157
|
+
existing.layer.setIcon(build());
|
|
1158
|
+
existing.signature = signature;
|
|
1159
|
+
this.markIconHidden(existing.layer);
|
|
1160
|
+
continue;
|
|
1161
|
+
}
|
|
1162
|
+
const layer = e.L.marker(latLng, {
|
|
1163
|
+
icon: build(),
|
|
1164
|
+
keyboard: false,
|
|
1165
|
+
title,
|
|
1166
|
+
alt: "",
|
|
1167
|
+
riseOnHover: true,
|
|
1168
|
+
zIndexOffset: item.kind === "marker" && item.item.id === selected ? 1e3 : 0
|
|
1169
|
+
});
|
|
1170
|
+
layer.on("click", () => this.zone.run(() => this.onItemClick(id)));
|
|
1171
|
+
layer.addTo(e.markers);
|
|
1172
|
+
this.markIconHidden(layer);
|
|
1173
|
+
this.layerById.set(id, {
|
|
1174
|
+
layer,
|
|
1175
|
+
signature
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
for (const [id, entry] of this.layerById) {
|
|
1179
|
+
if (keep.has(id)) continue;
|
|
1180
|
+
entry.layer.remove();
|
|
1181
|
+
this.layerById.delete(id);
|
|
1182
|
+
this.itemById.delete(id);
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
markIconHidden(layer) {
|
|
1186
|
+
layer.getElement()?.setAttribute("aria-hidden", "true");
|
|
1187
|
+
}
|
|
1188
|
+
onItemClick(id) {
|
|
1189
|
+
const item = this.itemById.get(id);
|
|
1190
|
+
if (!item) return;
|
|
1191
|
+
if (this.session) return;
|
|
1192
|
+
if (item.kind === "cluster") {
|
|
1193
|
+
this.fitBounds(item.bounds, void 0, this.dissolveZoom());
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
this.selectedId.set(item.item.id);
|
|
1197
|
+
this.markerClick.emit(item.item);
|
|
1198
|
+
this.announceSelected(item.item);
|
|
1199
|
+
}
|
|
1200
|
+
panToMarker(m) {
|
|
1201
|
+
const e = this.engine();
|
|
1202
|
+
if (!e) return;
|
|
1203
|
+
if (!e.map.getBounds().contains([m.lat, m.lng])) e.map.panTo([m.lat, m.lng], { animate: !this.reducedMotion() });
|
|
1204
|
+
}
|
|
1205
|
+
applyControlledView(e) {
|
|
1206
|
+
const c = this.center();
|
|
1207
|
+
const z = this.zoom();
|
|
1208
|
+
if (c === null && z === null) return;
|
|
1209
|
+
this.pendingFit = false;
|
|
1210
|
+
const now = e.map.getCenter();
|
|
1211
|
+
const target = c ?? {
|
|
1212
|
+
lat: now.lat,
|
|
1213
|
+
lng: now.lng
|
|
1214
|
+
};
|
|
1215
|
+
const level = z ?? e.map.getZoom();
|
|
1216
|
+
if (!isValidLatLng(target)) return;
|
|
1217
|
+
const half = 360 / (256 * Math.pow(2, level)) / 2;
|
|
1218
|
+
if (Math.abs(now.lat - target.lat) < half && Math.abs(now.lng - target.lng) < half && level === e.map.getZoom()) return;
|
|
1219
|
+
e.map.setView([target.lat, target.lng], level, { animate: false });
|
|
1220
|
+
}
|
|
1221
|
+
autoFit() {
|
|
1222
|
+
if (this.center() !== null || this.zoom() !== null) {
|
|
1223
|
+
this.pendingFit = false;
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
if (this.validMarkers().length === 0) return;
|
|
1227
|
+
if (this.pendingFit) {
|
|
1228
|
+
if (this.loading()) return;
|
|
1229
|
+
this.pendingFit = false;
|
|
1230
|
+
this.autoFitDone = true;
|
|
1231
|
+
this.fitMarkers(false);
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
if (this.autoFitDone || this.userMoved || !this.fitToMarkers()) return;
|
|
1235
|
+
this.autoFitDone = true;
|
|
1236
|
+
this.fitMarkers(false);
|
|
1237
|
+
}
|
|
1238
|
+
fitOnKey(key) {
|
|
1239
|
+
if (Object.is(key, this.lastFitKey)) return;
|
|
1240
|
+
this.lastFitKey = key;
|
|
1241
|
+
if (this.center() !== null || this.zoom() !== null) {
|
|
1242
|
+
this.pendingFit = false;
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
if (this.validMarkers().length === 0 || this.loading()) {
|
|
1246
|
+
this.pendingFit = true;
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
this.pendingFit = false;
|
|
1250
|
+
this.autoFitDone = true;
|
|
1251
|
+
this.fitMarkers(false);
|
|
1252
|
+
}
|
|
1253
|
+
describeArea(a) {
|
|
1254
|
+
const n = (v) => this.labels.formatNumber(v, { maximumFractionDigits: 5 });
|
|
1255
|
+
switch (a.type) {
|
|
1256
|
+
case "circle": return this.labels.t("map.area.circle", {
|
|
1257
|
+
lat: n(a.lat),
|
|
1258
|
+
lng: n(a.lng),
|
|
1259
|
+
radius: this.describeRadius(a.radiusMeters)
|
|
1260
|
+
});
|
|
1261
|
+
case "bbox": return this.labels.t("map.area.bbox", {
|
|
1262
|
+
north: n(a.north),
|
|
1263
|
+
south: n(a.south),
|
|
1264
|
+
east: n(a.east),
|
|
1265
|
+
west: n(a.west)
|
|
1266
|
+
});
|
|
1267
|
+
case "polygon": return this.labels.t("map.area.polygon", { count: a.points.length });
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
describeRadius(meters) {
|
|
1271
|
+
if (meters >= 1e3) return this.labels.t("map.unitKilometers", { value: this.labels.formatNumber(meters / 1e3, { maximumFractionDigits: 2 }) });
|
|
1272
|
+
return this.labels.t("map.unitMeters", { value: this.labels.formatNumber(Math.round(meters)) });
|
|
1273
|
+
}
|
|
1274
|
+
announce(text) {
|
|
1275
|
+
this.announcement.set(text === this.announcement() ? text + "\xA0" : text);
|
|
1276
|
+
}
|
|
1277
|
+
onMapClick(p) {
|
|
1278
|
+
if (this.session) {
|
|
1279
|
+
this.addDrawPoint(p);
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
if (this.selectedId() !== null) this.closeInfo();
|
|
1283
|
+
}
|
|
1284
|
+
addDrawPoint(p) {
|
|
1285
|
+
const s = this.session;
|
|
1286
|
+
if (!s) return;
|
|
1287
|
+
const r = s.addPoint(p);
|
|
1288
|
+
if (r.status === "rejected") {
|
|
1289
|
+
this.announce(this.labels.t(r.reason === "self-intersecting" ? "map.draw.selfIntersecting" : "map.draw.rejected"));
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1292
|
+
if (r.status === "finished") {
|
|
1293
|
+
this.commitArea(r.area);
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
this.draftPoints.set([...s.points]);
|
|
1297
|
+
this.announce(this.labels.t("map.draw.pointAdded", { count: r.count }));
|
|
1298
|
+
}
|
|
1299
|
+
commitArea(area) {
|
|
1300
|
+
this.endSession();
|
|
1301
|
+
this.lastDrawn = area;
|
|
1302
|
+
this.area.set(area);
|
|
1303
|
+
this.announce(this.labels.t("map.draw.finished", { area: this.describeArea(area) }));
|
|
1304
|
+
}
|
|
1305
|
+
endSession() {
|
|
1306
|
+
this.session = null;
|
|
1307
|
+
this.cursor = null;
|
|
1308
|
+
this.draftPoints.set([]);
|
|
1309
|
+
this.drawing.set(null);
|
|
1310
|
+
}
|
|
1311
|
+
syncDrawMode(e) {
|
|
1312
|
+
const drawing = this.drawing() !== null;
|
|
1313
|
+
e.map.getContainer().classList.toggle("leaflet-crosshair", drawing);
|
|
1314
|
+
if (drawing) e.map.doubleClickZoom.disable();
|
|
1315
|
+
else e.map.doubleClickZoom.enable();
|
|
1316
|
+
}
|
|
1317
|
+
syncArea(e) {
|
|
1318
|
+
e.area.clearLayers();
|
|
1319
|
+
const a = this.area();
|
|
1320
|
+
if (!a) return;
|
|
1321
|
+
const opts = {
|
|
1322
|
+
className: "ui-map__area",
|
|
1323
|
+
interactive: false
|
|
1324
|
+
};
|
|
1325
|
+
if (a.type === "circle") e.L.circle([a.lat, a.lng], {
|
|
1326
|
+
...opts,
|
|
1327
|
+
radius: a.radiusMeters
|
|
1328
|
+
}).addTo(e.area);
|
|
1329
|
+
else if (a.type === "bbox") e.L.rectangle([[a.south, a.west], [a.north, a.east]], opts).addTo(e.area);
|
|
1330
|
+
else e.L.polygon(a.points.map((p) => [p.lat, p.lng]), opts).addTo(e.area);
|
|
1331
|
+
if (this.fitToArea() && !sameArea(a, this.lastDrawn) && this.center() === null && this.zoom() === null) {
|
|
1332
|
+
const b = areaBounds(a);
|
|
1333
|
+
if (b) this.fitBounds(b, false);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
onCursor(e, p) {
|
|
1337
|
+
if (!this.session || this.session.points.length === 0) return;
|
|
1338
|
+
this.cursor = p;
|
|
1339
|
+
this.drawDraft(e);
|
|
1340
|
+
}
|
|
1341
|
+
syncDraft(e) {
|
|
1342
|
+
this.drawDraft(e);
|
|
1343
|
+
}
|
|
1344
|
+
drawDraft(e) {
|
|
1345
|
+
e.draft.clearLayers();
|
|
1346
|
+
const s = this.session;
|
|
1347
|
+
const shape = this.drawing();
|
|
1348
|
+
if (!s || !shape) return;
|
|
1349
|
+
const pts = s.points;
|
|
1350
|
+
const style = {
|
|
1351
|
+
className: "ui-map__draft",
|
|
1352
|
+
interactive: false
|
|
1353
|
+
};
|
|
1354
|
+
const dot = {
|
|
1355
|
+
className: "ui-map__draft-point",
|
|
1356
|
+
interactive: false,
|
|
1357
|
+
radius: 6
|
|
1358
|
+
};
|
|
1359
|
+
for (const p of pts) e.L.circleMarker([p.lat, p.lng], dot).addTo(e.draft);
|
|
1360
|
+
const cur = this.cursor;
|
|
1361
|
+
if (shape === "polygon") {
|
|
1362
|
+
const line = pts.map((p) => [p.lat, p.lng]);
|
|
1363
|
+
if (cur) line.push([cur.lat, cur.lng]);
|
|
1364
|
+
if (line.length > 1) (line.length > 2 ? e.L.polygon(line, style) : e.L.polyline(line, style)).addTo(e.draft);
|
|
1365
|
+
} else if (pts.length === 1 && cur) {
|
|
1366
|
+
if (shape === "circle") {
|
|
1367
|
+
const radius = haversineMeters(pts[0], cur);
|
|
1368
|
+
if (radius > 0) e.L.circle([pts[0].lat, pts[0].lng], {
|
|
1369
|
+
...style,
|
|
1370
|
+
radius
|
|
1371
|
+
}).addTo(e.draft);
|
|
1372
|
+
} else e.L.rectangle([[pts[0].lat, pts[0].lng], [cur.lat, cur.lng]], style).addTo(e.draft);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
static {
|
|
1376
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1377
|
+
minVersion: "12.0.0",
|
|
1378
|
+
version: "22.2.2",
|
|
1379
|
+
ngImport: i0,
|
|
1380
|
+
type: MapComponent,
|
|
1381
|
+
deps: [],
|
|
1382
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
static {
|
|
1386
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1387
|
+
minVersion: "17.0.0",
|
|
1388
|
+
version: "22.2.2",
|
|
1389
|
+
type: MapComponent,
|
|
1390
|
+
isStandalone: true,
|
|
1391
|
+
selector: "ui-map",
|
|
1392
|
+
inputs: {
|
|
1393
|
+
markers: {
|
|
1394
|
+
classPropertyName: "markers",
|
|
1395
|
+
publicName: "markers",
|
|
1396
|
+
isSignal: true,
|
|
1397
|
+
isRequired: false,
|
|
1398
|
+
transformFunction: null
|
|
1399
|
+
},
|
|
1400
|
+
selectedId: {
|
|
1401
|
+
classPropertyName: "selectedId",
|
|
1402
|
+
publicName: "selectedId",
|
|
1403
|
+
isSignal: true,
|
|
1404
|
+
isRequired: false,
|
|
1405
|
+
transformFunction: null
|
|
1406
|
+
},
|
|
1407
|
+
center: {
|
|
1408
|
+
classPropertyName: "center",
|
|
1409
|
+
publicName: "center",
|
|
1410
|
+
isSignal: true,
|
|
1411
|
+
isRequired: false,
|
|
1412
|
+
transformFunction: null
|
|
1413
|
+
},
|
|
1414
|
+
zoom: {
|
|
1415
|
+
classPropertyName: "zoom",
|
|
1416
|
+
publicName: "zoom",
|
|
1417
|
+
isSignal: true,
|
|
1418
|
+
isRequired: false,
|
|
1419
|
+
transformFunction: null
|
|
1420
|
+
},
|
|
1421
|
+
initialCenter: {
|
|
1422
|
+
classPropertyName: "initialCenter",
|
|
1423
|
+
publicName: "initialCenter",
|
|
1424
|
+
isSignal: true,
|
|
1425
|
+
isRequired: false,
|
|
1426
|
+
transformFunction: null
|
|
1427
|
+
},
|
|
1428
|
+
initialZoom: {
|
|
1429
|
+
classPropertyName: "initialZoom",
|
|
1430
|
+
publicName: "initialZoom",
|
|
1431
|
+
isSignal: true,
|
|
1432
|
+
isRequired: false,
|
|
1433
|
+
transformFunction: null
|
|
1434
|
+
},
|
|
1435
|
+
fitToMarkers: {
|
|
1436
|
+
classPropertyName: "fitToMarkers",
|
|
1437
|
+
publicName: "fitToMarkers",
|
|
1438
|
+
isSignal: true,
|
|
1439
|
+
isRequired: false,
|
|
1440
|
+
transformFunction: null
|
|
1441
|
+
},
|
|
1442
|
+
fitKey: {
|
|
1443
|
+
classPropertyName: "fitKey",
|
|
1444
|
+
publicName: "fitKey",
|
|
1445
|
+
isSignal: true,
|
|
1446
|
+
isRequired: false,
|
|
1447
|
+
transformFunction: null
|
|
1448
|
+
},
|
|
1449
|
+
fitPadding: {
|
|
1450
|
+
classPropertyName: "fitPadding",
|
|
1451
|
+
publicName: "fitPadding",
|
|
1452
|
+
isSignal: true,
|
|
1453
|
+
isRequired: false,
|
|
1454
|
+
transformFunction: null
|
|
1455
|
+
},
|
|
1456
|
+
fitMaxZoom: {
|
|
1457
|
+
classPropertyName: "fitMaxZoom",
|
|
1458
|
+
publicName: "fitMaxZoom",
|
|
1459
|
+
isSignal: true,
|
|
1460
|
+
isRequired: false,
|
|
1461
|
+
transformFunction: null
|
|
1462
|
+
},
|
|
1463
|
+
tileUrlTemplate: {
|
|
1464
|
+
classPropertyName: "tileUrlTemplate",
|
|
1465
|
+
publicName: "tileUrlTemplate",
|
|
1466
|
+
isSignal: true,
|
|
1467
|
+
isRequired: false,
|
|
1468
|
+
transformFunction: null
|
|
1469
|
+
},
|
|
1470
|
+
tileAttribution: {
|
|
1471
|
+
classPropertyName: "tileAttribution",
|
|
1472
|
+
publicName: "tileAttribution",
|
|
1473
|
+
isSignal: true,
|
|
1474
|
+
isRequired: false,
|
|
1475
|
+
transformFunction: null
|
|
1476
|
+
},
|
|
1477
|
+
tileAttributionUrl: {
|
|
1478
|
+
classPropertyName: "tileAttributionUrl",
|
|
1479
|
+
publicName: "tileAttributionUrl",
|
|
1480
|
+
isSignal: true,
|
|
1481
|
+
isRequired: false,
|
|
1482
|
+
transformFunction: null
|
|
1483
|
+
},
|
|
1484
|
+
subdomains: {
|
|
1485
|
+
classPropertyName: "subdomains",
|
|
1486
|
+
publicName: "subdomains",
|
|
1487
|
+
isSignal: true,
|
|
1488
|
+
isRequired: false,
|
|
1489
|
+
transformFunction: null
|
|
1490
|
+
},
|
|
1491
|
+
minZoom: {
|
|
1492
|
+
classPropertyName: "minZoom",
|
|
1493
|
+
publicName: "minZoom",
|
|
1494
|
+
isSignal: true,
|
|
1495
|
+
isRequired: false,
|
|
1496
|
+
transformFunction: null
|
|
1497
|
+
},
|
|
1498
|
+
maxZoom: {
|
|
1499
|
+
classPropertyName: "maxZoom",
|
|
1500
|
+
publicName: "maxZoom",
|
|
1501
|
+
isSignal: true,
|
|
1502
|
+
isRequired: false,
|
|
1503
|
+
transformFunction: null
|
|
1504
|
+
},
|
|
1505
|
+
clustering: {
|
|
1506
|
+
classPropertyName: "clustering",
|
|
1507
|
+
publicName: "clustering",
|
|
1508
|
+
isSignal: true,
|
|
1509
|
+
isRequired: false,
|
|
1510
|
+
transformFunction: null
|
|
1511
|
+
},
|
|
1512
|
+
clusterRadius: {
|
|
1513
|
+
classPropertyName: "clusterRadius",
|
|
1514
|
+
publicName: "clusterRadius",
|
|
1515
|
+
isSignal: true,
|
|
1516
|
+
isRequired: false,
|
|
1517
|
+
transformFunction: null
|
|
1518
|
+
},
|
|
1519
|
+
clusterMaxZoom: {
|
|
1520
|
+
classPropertyName: "clusterMaxZoom",
|
|
1521
|
+
publicName: "clusterMaxZoom",
|
|
1522
|
+
isSignal: true,
|
|
1523
|
+
isRequired: false,
|
|
1524
|
+
transformFunction: null
|
|
1525
|
+
},
|
|
1526
|
+
drawModes: {
|
|
1527
|
+
classPropertyName: "drawModes",
|
|
1528
|
+
publicName: "drawModes",
|
|
1529
|
+
isSignal: true,
|
|
1530
|
+
isRequired: false,
|
|
1531
|
+
transformFunction: null
|
|
1532
|
+
},
|
|
1533
|
+
area: {
|
|
1534
|
+
classPropertyName: "area",
|
|
1535
|
+
publicName: "area",
|
|
1536
|
+
isSignal: true,
|
|
1537
|
+
isRequired: false,
|
|
1538
|
+
transformFunction: null
|
|
1539
|
+
},
|
|
1540
|
+
readOnly: {
|
|
1541
|
+
classPropertyName: "readOnly",
|
|
1542
|
+
publicName: "readOnly",
|
|
1543
|
+
isSignal: true,
|
|
1544
|
+
isRequired: false,
|
|
1545
|
+
transformFunction: null
|
|
1546
|
+
},
|
|
1547
|
+
fitToArea: {
|
|
1548
|
+
classPropertyName: "fitToArea",
|
|
1549
|
+
publicName: "fitToArea",
|
|
1550
|
+
isSignal: true,
|
|
1551
|
+
isRequired: false,
|
|
1552
|
+
transformFunction: null
|
|
1553
|
+
},
|
|
1554
|
+
ariaLabel: {
|
|
1555
|
+
classPropertyName: "ariaLabel",
|
|
1556
|
+
publicName: "ariaLabel",
|
|
1557
|
+
isSignal: true,
|
|
1558
|
+
isRequired: false,
|
|
1559
|
+
transformFunction: null
|
|
1560
|
+
},
|
|
1561
|
+
height: {
|
|
1562
|
+
classPropertyName: "height",
|
|
1563
|
+
publicName: "height",
|
|
1564
|
+
isSignal: true,
|
|
1565
|
+
isRequired: false,
|
|
1566
|
+
transformFunction: null
|
|
1567
|
+
},
|
|
1568
|
+
showList: {
|
|
1569
|
+
classPropertyName: "showList",
|
|
1570
|
+
publicName: "showList",
|
|
1571
|
+
isSignal: true,
|
|
1572
|
+
isRequired: false,
|
|
1573
|
+
transformFunction: null
|
|
1574
|
+
},
|
|
1575
|
+
listLimit: {
|
|
1576
|
+
classPropertyName: "listLimit",
|
|
1577
|
+
publicName: "listLimit",
|
|
1578
|
+
isSignal: true,
|
|
1579
|
+
isRequired: false,
|
|
1580
|
+
transformFunction: null
|
|
1581
|
+
},
|
|
1582
|
+
loading: {
|
|
1583
|
+
classPropertyName: "loading",
|
|
1584
|
+
publicName: "loading",
|
|
1585
|
+
isSignal: true,
|
|
1586
|
+
isRequired: false,
|
|
1587
|
+
transformFunction: null
|
|
1588
|
+
},
|
|
1589
|
+
idleDelay: {
|
|
1590
|
+
classPropertyName: "idleDelay",
|
|
1591
|
+
publicName: "idleDelay",
|
|
1592
|
+
isSignal: true,
|
|
1593
|
+
isRequired: false,
|
|
1594
|
+
transformFunction: null
|
|
1595
|
+
},
|
|
1596
|
+
scrollWheelZoom: {
|
|
1597
|
+
classPropertyName: "scrollWheelZoom",
|
|
1598
|
+
publicName: "scrollWheelZoom",
|
|
1599
|
+
isSignal: true,
|
|
1600
|
+
isRequired: false,
|
|
1601
|
+
transformFunction: null
|
|
1602
|
+
}
|
|
1603
|
+
},
|
|
1604
|
+
outputs: {
|
|
1605
|
+
selectedId: "selectedIdChange",
|
|
1606
|
+
area: "areaChange",
|
|
1607
|
+
boundsChange: "boundsChange",
|
|
1608
|
+
viewChange: "viewChange",
|
|
1609
|
+
markerClick: "markerClick"
|
|
1610
|
+
},
|
|
1611
|
+
queries: [{
|
|
1612
|
+
propertyName: "info",
|
|
1613
|
+
first: true,
|
|
1614
|
+
predicate: UiMapInfoDirective,
|
|
1615
|
+
descendants: true,
|
|
1616
|
+
isSignal: true
|
|
1617
|
+
}],
|
|
1618
|
+
viewQueries: [{
|
|
1619
|
+
propertyName: "canvas",
|
|
1620
|
+
first: true,
|
|
1621
|
+
predicate: ["canvas"],
|
|
1622
|
+
descendants: true,
|
|
1623
|
+
isSignal: true
|
|
1624
|
+
}],
|
|
1625
|
+
ngImport: i0,
|
|
1626
|
+
template: `
|
|
1627
|
+
<div class="ui-map" [class.ui-map--drawing]="!!drawing()" [class.ui-map--unavailable]="unavailable()" [style.--ui-map-height]="height()">
|
|
1628
|
+
<div class="ui-map__stage" (keydown)="onStageKey($event)">
|
|
1629
|
+
@if (unavailable()) {
|
|
1630
|
+
<div class="ui-map__unavailable" role="status">
|
|
1631
|
+
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M9 4 3 6v14l6-2 6 2 6-2V4l-6 2-6-2z"/><path d="M9 4v14M15 6v14"/></svg>
|
|
1632
|
+
<p class="ui-map__unavailable-text">{{ unavailableText() }}</p>
|
|
1633
|
+
</div>
|
|
1634
|
+
} @else {
|
|
1635
|
+
<div #canvas class="ui-map__canvas" role="group" [attr.aria-label]="regionLabel()" [attr.aria-describedby]="helpId" [attr.aria-busy]="loading() ? 'true' : null"></div>
|
|
1636
|
+
@if (drawing()) { <div class="ui-map__crosshair" aria-hidden="true"></div> }
|
|
1637
|
+
@if (!ready() && !engineFailed()) { <div class="ui-map__loading" role="status">{{ labels.t('map.loading') }}</div> }
|
|
1638
|
+
@if (tilesFailed()) { <div class="ui-map__notice" role="status">{{ labels.t('map.tilesFailed') }}</div> }
|
|
1639
|
+
<div class="ui-map__controls">
|
|
1640
|
+
<ui-button variant="secondary" size="sm" [ariaLabel]="labels.t('map.zoomIn')" [disabled]="!ready() || !canZoomIn()" (click)="onZoomButton('in')">
|
|
1641
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M12 5v14M5 12h14"/></svg>
|
|
1642
|
+
</ui-button>
|
|
1643
|
+
<ui-button variant="secondary" size="sm" [ariaLabel]="labels.t('map.zoomOut')" [disabled]="!ready() || !canZoomOut()" (click)="onZoomButton('out')">
|
|
1644
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M5 12h14"/></svg>
|
|
1645
|
+
</ui-button>
|
|
1646
|
+
@if (markers().length > 0) {
|
|
1647
|
+
<ui-button variant="secondary" size="sm" [ariaLabel]="labels.t('map.fitMarkers')" [disabled]="!ready()" (click)="fitMarkers()">
|
|
1648
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>
|
|
1649
|
+
</ui-button>
|
|
1650
|
+
}
|
|
1651
|
+
</div>
|
|
1652
|
+
@if (drawEnabled()) {
|
|
1653
|
+
<div class="ui-map__tools" role="group" [attr.aria-label]="labels.t('map.drawToolbar')">
|
|
1654
|
+
@if (drawing(); as shape) {
|
|
1655
|
+
<p class="ui-map__tools-note">{{ drawInstruction() }}</p>
|
|
1656
|
+
<div class="ui-map__tools-row">
|
|
1657
|
+
<ui-button variant="secondary" size="sm" (click)="addPointAtCenter()">{{ labels.t('map.addPointAtCenter') }}</ui-button>
|
|
1658
|
+
@if (draftPoints().length > 0) { <ui-button variant="secondary" size="sm" (click)="undoDrawPoint()">{{ labels.t('map.drawUndo') }}</ui-button> }
|
|
1659
|
+
@if (shape === 'polygon') { <ui-button variant="primary" size="sm" [disabled]="draftPoints().length < 3" (click)="finishDraw()">{{ labels.t('map.drawFinish') }}</ui-button> }
|
|
1660
|
+
<ui-button variant="ghost" size="sm" (click)="cancelDraw()">{{ labels.t('map.drawCancel') }}</ui-button>
|
|
1661
|
+
</div>
|
|
1662
|
+
} @else {
|
|
1663
|
+
<div class="ui-map__tools-row">
|
|
1664
|
+
@for (shape of drawModes(); track shape) {
|
|
1665
|
+
<ui-button variant="secondary" size="sm" [disabled]="!ready()" (click)="startDraw(shape)">{{ drawLabel(shape) }}</ui-button>
|
|
1666
|
+
}
|
|
1667
|
+
@if (area()) { <ui-button variant="ghost" size="sm" (click)="clearArea()">{{ labels.t('map.clearArea') }}</ui-button> }
|
|
1668
|
+
</div>
|
|
1669
|
+
@if (areaText(); as summary) { <p class="ui-map__tools-note">{{ labels.t('map.areaSummary', { area: summary }) }}</p> }
|
|
1670
|
+
}
|
|
1671
|
+
</div>
|
|
1672
|
+
}
|
|
1673
|
+
@if (selectedMarker(); as marker) {
|
|
1674
|
+
@if (info(); as tpl) {
|
|
1675
|
+
<div class="ui-map__info" role="group" [attr.aria-label]="labels.t('map.infoLabel', { name: marker.ariaLabel || marker.label })">
|
|
1676
|
+
<div class="ui-map__info-body">
|
|
1677
|
+
<ng-container [ngTemplateOutlet]="tpl.template" [ngTemplateOutletContext]="{ $implicit: marker, marker: marker }" />
|
|
1678
|
+
</div>
|
|
1679
|
+
<ui-button variant="icon" size="sm" [ariaLabel]="labels.t('map.closeInfo')" (click)="closeInfo()">
|
|
1680
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg>
|
|
1681
|
+
</ui-button>
|
|
1682
|
+
</div>
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
<div class="ui-map__attribution">
|
|
1686
|
+
@if (attributionUrl(); as url) {
|
|
1687
|
+
<a [href]="url" target="_blank" rel="noopener noreferrer">{{ tileAttribution() }}<span class="ui-map__sr"> {{ labels.t('dataTable.opensInNewTab') }}</span></a>
|
|
1688
|
+
} @else {
|
|
1689
|
+
<span>{{ tileAttribution() }}</span>
|
|
1690
|
+
}
|
|
1691
|
+
</div>
|
|
1692
|
+
}
|
|
1693
|
+
</div>
|
|
1694
|
+
|
|
1695
|
+
@if (!unavailable()) { <p class="ui-map__sr" [id]="helpId">{{ labels.t('map.keyboardHelp') }}</p> }
|
|
1696
|
+
<div class="ui-map__sr" role="status" aria-live="polite" aria-atomic="true">{{ announcement() }}</div>
|
|
1697
|
+
|
|
1698
|
+
<section class="ui-map__list" [class.ui-map__list--shown]="showList() || unavailable()" [attr.aria-label]="labels.t('map.listLabel')">
|
|
1699
|
+
<div class="ui-map__list-head">
|
|
1700
|
+
<span class="ui-map__list-title">{{ labels.t('map.listLabel') }}</span>
|
|
1701
|
+
<span class="ui-map__list-count">{{ listSummary() }}</span>
|
|
1702
|
+
</div>
|
|
1703
|
+
@if (listItems().length === 0) {
|
|
1704
|
+
<p class="ui-map__list-empty">{{ labels.t('map.listEmpty') }}</p>
|
|
1705
|
+
} @else {
|
|
1706
|
+
<ul class="ui-map__places" (keydown)="onListKey($event)">
|
|
1707
|
+
@for (m of listItems(); track m.id) {
|
|
1708
|
+
@let st = styleOf(m);
|
|
1709
|
+
<li>
|
|
1710
|
+
<button type="button" class="ui-map__place" [class.ui-map__place--selected]="m.id === selectedId()"
|
|
1711
|
+
[attr.aria-current]="m.id === selectedId() ? 'true' : null"
|
|
1712
|
+
[attr.data-marker-id]="m.id"
|
|
1713
|
+
[attr.tabindex]="m.id === listTabId() ? 0 : -1"
|
|
1714
|
+
(focus)="listTab.set(m.id)"
|
|
1715
|
+
(click)="selectFromList(m)">
|
|
1716
|
+
<span class="ui-map__pin ui-map__pin--{{ st.shape }} ui-map__pin--inline" [style.--pin-color]="st.color" aria-hidden="true">
|
|
1717
|
+
<span class="ui-map__pin-shape"></span><span class="ui-map__pin-glyph">{{ glyphOf(m) }}</span>
|
|
1718
|
+
</span>
|
|
1719
|
+
<span class="ui-map__place-text">
|
|
1720
|
+
<span class="ui-map__place-label">{{ m.label }}</span>
|
|
1721
|
+
@if (m.category) { <span class="ui-map__place-category">{{ m.category }}</span> }
|
|
1722
|
+
</span>
|
|
1723
|
+
</button>
|
|
1724
|
+
</li>
|
|
1725
|
+
}
|
|
1726
|
+
</ul>
|
|
1727
|
+
}
|
|
1728
|
+
</section>
|
|
1729
|
+
</div>
|
|
1730
|
+
`,
|
|
1731
|
+
isInline: true,
|
|
1732
|
+
styles: ["ui-map{display:block}.ui-map{position:relative;display:flex;flex-direction:column;gap:12px;width:100%}.ui-map .leaflet-pane,.ui-map .leaflet-tile,.ui-map .leaflet-marker-icon,.ui-map .leaflet-marker-shadow,.ui-map .leaflet-tile-container,.ui-map .leaflet-pane>svg,.ui-map .leaflet-pane>canvas,.ui-map .leaflet-zoom-box,.ui-map .leaflet-image-layer,.ui-map .leaflet-layer{position:absolute;left:0;top:0}.ui-map .leaflet-container{overflow:hidden}.ui-map .leaflet-tile,.ui-map .leaflet-marker-icon,.ui-map .leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.ui-map .leaflet-tile::selection{background:transparent}.ui-map .leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.ui-map .leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.ui-map .leaflet-marker-icon,.ui-map .leaflet-marker-shadow{display:block}.ui-map .leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.ui-map .leaflet-container .leaflet-marker-pane img,.ui-map .leaflet-container .leaflet-shadow-pane img,.ui-map .leaflet-container .leaflet-tile-pane img,.ui-map .leaflet-container img.leaflet-image-layer,.ui-map .leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.ui-map .leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.ui-map .leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.ui-map .leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.ui-map .leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.ui-map .leaflet-container{-webkit-tap-highlight-color:transparent}.ui-map .leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.ui-map .leaflet-tile{filter:inherit;visibility:hidden}.ui-map .leaflet-tile-loaded{visibility:inherit}.ui-map .leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.ui-map .leaflet-overlay-pane svg{-moz-user-select:none}.ui-map .leaflet-pane{z-index:400}.ui-map .leaflet-tile-pane{z-index:200}.ui-map .leaflet-overlay-pane{z-index:400}.ui-map .leaflet-shadow-pane{z-index:500}.ui-map .leaflet-marker-pane{z-index:600}.ui-map .leaflet-tooltip-pane{z-index:650}.ui-map .leaflet-popup-pane{z-index:700}.ui-map .leaflet-map-pane canvas{z-index:100}.ui-map .leaflet-map-pane svg{z-index:200}.ui-map .leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.ui-map .leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.ui-map .leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.ui-map svg.leaflet-zoom-animated{will-change:transform}.ui-map .leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.ui-map .leaflet-zoom-anim .leaflet-tile,.ui-map .leaflet-pan-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.ui-map .leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.ui-map .leaflet-interactive{cursor:pointer}.ui-map .leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ui-map .leaflet-crosshair,.ui-map .leaflet-crosshair .leaflet-interactive{cursor:crosshair}.ui-map .leaflet-popup-pane,.ui-map .leaflet-control{cursor:auto}.ui-map .leaflet-dragging .leaflet-grab,.ui-map .leaflet-dragging .leaflet-grab .leaflet-interactive,.ui-map .leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ui-map .leaflet-marker-icon,.ui-map .leaflet-marker-shadow,.ui-map .leaflet-image-layer,.ui-map .leaflet-pane>svg path,.ui-map .leaflet-tile-container{pointer-events:none}.ui-map .leaflet-marker-icon.leaflet-interactive,.ui-map .leaflet-image-layer.leaflet-interactive,.ui-map .leaflet-pane>svg path.leaflet-interactive,.ui-map svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.ui-map .leaflet-container{background:#ddd;outline-offset:1px}.ui-map .leaflet-container a{color:#0078a8}.ui-map .leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.ui-map .ui-map__stage{position:relative;height:var(--ui-map-height, 420px);min-height:240px;border:1px solid #cbd5e1;border-radius:10px;overflow:hidden;background:#e2e8f0}.ui-map .ui-map__canvas{position:absolute;inset:0;z-index:0}.ui-map .ui-map__canvas:focus{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:-2px}.ui-map .ui-map__canvas:focus:not(:focus-visible){outline:none}.ui-map .ui-map__canvas:focus-visible{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:-2px}.ui-map .leaflet-container{font:inherit;background:#e2e8f0}.ui-map .leaflet-container:focus-visible{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:-2px}.ui-map .ui-map__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ui-map .ui-map__controls{position:absolute;top:10px;right:10px;z-index:800;display:flex;flex-direction:column;gap:6px}.ui-map .ui-map__tools{position:absolute;top:10px;left:10px;z-index:800;max-width:calc(100% - 76px);display:flex;flex-direction:column;gap:6px;padding:8px;background:#fff;border:1px solid #cbd5e1;border-radius:8px;box-shadow:0 2px 8px #0f172a26}.ui-map .ui-map__tools-row{display:flex;flex-wrap:wrap;gap:6px}.ui-map .ui-map__tools-note{margin:0;font-size:12px;line-height:1.4;color:#334155}.ui-map .ui-map__attribution{position:absolute;right:0;bottom:0;z-index:800;max-width:100%;padding:2px 8px;font-size:11px;line-height:1.5;color:#1e293b;background:#ffffffd9;border-top-left-radius:6px}.ui-map .ui-map__attribution a{display:inline-block;color:#1d4ed8;text-decoration:underline;padding:7px 0}.ui-map .ui-map__attribution a:focus-visible{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:2px}.ui-map .ui-map__info{position:absolute;left:10px;bottom:28px;z-index:800;display:flex;align-items:flex-start;gap:4px;max-width:min(360px,100% - 20px);max-height:60%;padding:10px 6px 10px 12px;background:#fff;border:1px solid #94a3b8;border-radius:8px;box-shadow:0 4px 14px #0f172a40;overflow:auto}.ui-map .ui-map__info-body{min-width:0;flex:1;font-size:13px;color:#0f172a}.ui-map .ui-map__notice,.ui-map .ui-map__loading{position:absolute;left:50%;top:10px;z-index:900;transform:translate(-50%);padding:6px 12px;font-size:12px;font-weight:600;color:#0f172a;background:#fef3c7;border:1px solid #b45309;border-radius:8px}.ui-map .ui-map__loading{background:#fff;border-color:#94a3b8}.ui-map .ui-map__crosshair{position:absolute;left:50%;top:50%;z-index:700;width:28px;height:28px;margin:-14px 0 0 -14px;pointer-events:none}.ui-map .ui-map__crosshair:before,.ui-map .ui-map__crosshair:after{content:\"\";position:absolute;background:#0f172a;box-shadow:0 0 0 1.5px #fff}.ui-map .ui-map__crosshair:before{left:13px;top:0;width:2px;height:28px}.ui-map .ui-map__crosshair:after{top:13px;left:0;height:2px;width:28px}.ui-map.ui-map--drawing .leaflet-marker-icon{pointer-events:none!important}.ui-map .ui-map__unavailable{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:24px;text-align:center;color:#334155;background:repeating-linear-gradient(45deg,#f1f5f9,#f1f5f9 12px,#e2e8f0 12px 24px)}.ui-map .ui-map__unavailable-text{margin:0;max-width:40ch;font-size:14px;font-weight:600;line-height:1.4;color:#0f172a}.ui-map .ui-map__icon{background:transparent;border:0}.ui-map .ui-map__pin{position:relative;width:32px;height:32px;--pin-color: #1d4ed8}.ui-map .ui-map__pin-shape{position:absolute;inset:2px;background:var(--pin-color);border:2px solid #fff;box-shadow:0 1px 4px #0f172a80;box-sizing:border-box}.ui-map .ui-map__pin--circle .ui-map__pin-shape{border-radius:50%}.ui-map .ui-map__pin--square .ui-map__pin-shape{border-radius:5px}.ui-map .ui-map__pin--diamond .ui-map__pin-shape{inset:5px;transform:rotate(45deg);border-radius:3px}.ui-map .ui-map__pin--hexagon .ui-map__pin-shape{border:0;box-shadow:none;clip-path:polygon(25% 3%,75% 3%,100% 50%,75% 97%,25% 97%,0 50%)}.ui-map .ui-map__pin-glyph{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;line-height:1;color:#fff;pointer-events:none}.ui-map .ui-map__pin--selected:after{content:\"\";position:absolute;inset:-2px;border:3px solid #0f172a;border-radius:50%;box-shadow:0 0 0 2px #fff;pointer-events:none}.ui-map .ui-map__pin--selected{z-index:2;transform:scale(1.18)}.ui-map .ui-map__icon:after{content:\"\";position:absolute;inset:-6px}.ui-map .ui-map__cluster{width:44px;height:44px;display:flex;align-items:center;justify-content:center;border-radius:50%;color:#fff;background:#0f172a;border:3px solid #fff;box-shadow:0 1px 5px #0f172a8c;box-sizing:border-box}.ui-map .ui-map__cluster-count{font-size:13px;font-weight:700;line-height:1}.ui-map .ui-map__area{stroke:#1d4ed8;stroke-width:3;fill:#1d4ed8;fill-opacity:.14}.ui-map .ui-map__draft{stroke:#0f172a;stroke-width:3;stroke-dasharray:8 6;fill:#1d4ed8;fill-opacity:.08}.ui-map .ui-map__draft-point{stroke:#fff;stroke-width:2;fill:#0f172a;fill-opacity:1}.ui-map .ui-map__list{display:flex;flex-direction:column;gap:6px}.ui-map .ui-map__list:not(.ui-map__list--shown):not(:focus-within){position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ui-map .ui-map__list-head{display:flex;justify-content:space-between;gap:8px;font-size:12px;color:#475569}.ui-map .ui-map__list-title{font-weight:700;color:#0f172a;text-transform:uppercase;letter-spacing:.04em}.ui-map .ui-map__list-empty{margin:0;font-size:13px;color:#475569}.ui-map .ui-map__places{list-style:none;margin:0;padding:0;max-height:240px;overflow-y:auto;border:1px solid #e2e8f0;border-radius:8px}.ui-map .ui-map__places>li+li{border-top:1px solid #e2e8f0}.ui-map .ui-map__place{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:6px 12px;font:inherit;text-align:left;color:#0f172a;background:#fff;border:0;cursor:pointer}.ui-map .ui-map__place:hover{background:#f1f5f9}.ui-map .ui-map__place:focus-visible{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:-2px}.ui-map .ui-map__place--selected{background:#eff6ff;box-shadow:inset 4px 0 #0f172a;font-weight:600}.ui-map .ui-map__pin--inline{flex:0 0 auto;width:28px;height:28px}.ui-map .ui-map__pin--inline .ui-map__pin-glyph{font-size:11px}.ui-map .ui-map__place-text{display:flex;flex-direction:column;min-width:0}.ui-map .ui-map__place-label{overflow-wrap:anywhere;font-size:14px}.ui-map .ui-map__place-category{font-size:12px;color:#475569;font-weight:400}@media(prefers-reduced-motion:reduce){.ui-map .leaflet-zoom-anim .leaflet-zoom-animated,.ui-map .leaflet-fade-anim .leaflet-tile,.ui-map .leaflet-fade-anim .leaflet-zoom-animated{transition:none}.ui-map .ui-map__pin--selected{transform:none}}@media(forced-colors:active){.ui-map .ui-map__stage,.ui-map .ui-map__tools,.ui-map .ui-map__info,.ui-map .ui-map__places,.ui-map .ui-map__notice,.ui-map .ui-map__loading{border:1px solid CanvasText;background:Canvas;color:CanvasText}.ui-map .ui-map__pin-shape{background:ButtonFace;border:2px solid ButtonText;box-shadow:none}.ui-map .ui-map__pin-glyph{color:ButtonText}.ui-map .ui-map__pin--hexagon .ui-map__pin-shape{background:ButtonText}.ui-map .ui-map__pin--selected:after{border-color:Highlight;box-shadow:none}.ui-map .ui-map__cluster{background:ButtonFace;color:ButtonText;border:3px solid ButtonText;box-shadow:none}.ui-map .ui-map__area{stroke:Highlight;fill:Highlight}.ui-map .ui-map__draft{stroke:CanvasText;fill:Canvas}.ui-map .ui-map__draft-point{stroke:Canvas;fill:CanvasText}.ui-map .ui-map__crosshair:before,.ui-map .ui-map__crosshair:after{background:CanvasText;box-shadow:none}.ui-map .ui-map__place--selected{outline:2px solid Highlight;outline-offset:-2px;box-shadow:none}.ui-map .ui-map__place:focus-visible,.ui-map .ui-map__canvas:focus-visible{outline:3px solid Highlight}.ui-map .ui-map__attribution{background:Canvas;color:CanvasText}.ui-map .ui-map__attribution a{color:LinkText}}@media(pointer:coarse){.ui-map .ui-map__place{min-height:48px}.ui-map .ui-map__attribution{padding:6px 10px}}@media(max-width:640px){.ui-map .ui-map__stage{height:max(var(--ui-map-height, 420px),320px)}.ui-map .ui-map__tools{max-width:calc(100% - 64px)}.ui-map .ui-map__info{left:6px;right:6px;max-width:none;bottom:30px}.ui-map .ui-map__places{max-height:200px}}\n"],
|
|
1733
|
+
dependencies: [{
|
|
1734
|
+
kind: "directive",
|
|
1735
|
+
type: NgTemplateOutlet,
|
|
1736
|
+
selector: "[ngTemplateOutlet]",
|
|
1737
|
+
inputs: [
|
|
1738
|
+
"ngTemplateOutletContext",
|
|
1739
|
+
"ngTemplateOutlet",
|
|
1740
|
+
"ngTemplateOutletInjector"
|
|
1741
|
+
]
|
|
1742
|
+
}, {
|
|
1743
|
+
kind: "component",
|
|
1744
|
+
type: ButtonComponent,
|
|
1745
|
+
selector: "ui-button",
|
|
1746
|
+
inputs: [
|
|
1747
|
+
"variant",
|
|
1748
|
+
"routerLink",
|
|
1749
|
+
"queryParams",
|
|
1750
|
+
"fragment",
|
|
1751
|
+
"state",
|
|
1752
|
+
"href",
|
|
1753
|
+
"target",
|
|
1754
|
+
"rel",
|
|
1755
|
+
"shortLabel",
|
|
1756
|
+
"shortBelow",
|
|
1757
|
+
"color",
|
|
1758
|
+
"active",
|
|
1759
|
+
"size",
|
|
1760
|
+
"type",
|
|
1761
|
+
"disabled",
|
|
1762
|
+
"loading",
|
|
1763
|
+
"fullWidth",
|
|
1764
|
+
"ariaLabel",
|
|
1765
|
+
"ariaExpanded",
|
|
1766
|
+
"ariaPressed",
|
|
1767
|
+
"ariaDescribedBy",
|
|
1768
|
+
"modal-footer-left",
|
|
1769
|
+
"modal-footer-right"
|
|
1770
|
+
]
|
|
1771
|
+
}],
|
|
1772
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1773
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
1774
|
+
});
|
|
1775
|
+
}
|
|
1776
|
+
};
|
|
1777
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1778
|
+
minVersion: "12.0.0",
|
|
1779
|
+
version: "22.2.2",
|
|
1780
|
+
ngImport: i0,
|
|
1781
|
+
type: MapComponent,
|
|
1782
|
+
decorators: [{
|
|
1783
|
+
type: Component,
|
|
1784
|
+
args: [{
|
|
1785
|
+
selector: "ui-map",
|
|
1786
|
+
standalone: true,
|
|
1787
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1788
|
+
encapsulation: ViewEncapsulation.None,
|
|
1789
|
+
imports: [NgTemplateOutlet, ButtonComponent],
|
|
1790
|
+
template: `
|
|
1791
|
+
<div class="ui-map" [class.ui-map--drawing]="!!drawing()" [class.ui-map--unavailable]="unavailable()" [style.--ui-map-height]="height()">
|
|
1792
|
+
<div class="ui-map__stage" (keydown)="onStageKey($event)">
|
|
1793
|
+
@if (unavailable()) {
|
|
1794
|
+
<div class="ui-map__unavailable" role="status">
|
|
1795
|
+
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M9 4 3 6v14l6-2 6 2 6-2V4l-6 2-6-2z"/><path d="M9 4v14M15 6v14"/></svg>
|
|
1796
|
+
<p class="ui-map__unavailable-text">{{ unavailableText() }}</p>
|
|
1797
|
+
</div>
|
|
1798
|
+
} @else {
|
|
1799
|
+
<div #canvas class="ui-map__canvas" role="group" [attr.aria-label]="regionLabel()" [attr.aria-describedby]="helpId" [attr.aria-busy]="loading() ? 'true' : null"></div>
|
|
1800
|
+
@if (drawing()) { <div class="ui-map__crosshair" aria-hidden="true"></div> }
|
|
1801
|
+
@if (!ready() && !engineFailed()) { <div class="ui-map__loading" role="status">{{ labels.t('map.loading') }}</div> }
|
|
1802
|
+
@if (tilesFailed()) { <div class="ui-map__notice" role="status">{{ labels.t('map.tilesFailed') }}</div> }
|
|
1803
|
+
<div class="ui-map__controls">
|
|
1804
|
+
<ui-button variant="secondary" size="sm" [ariaLabel]="labels.t('map.zoomIn')" [disabled]="!ready() || !canZoomIn()" (click)="onZoomButton('in')">
|
|
1805
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M12 5v14M5 12h14"/></svg>
|
|
1806
|
+
</ui-button>
|
|
1807
|
+
<ui-button variant="secondary" size="sm" [ariaLabel]="labels.t('map.zoomOut')" [disabled]="!ready() || !canZoomOut()" (click)="onZoomButton('out')">
|
|
1808
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M5 12h14"/></svg>
|
|
1809
|
+
</ui-button>
|
|
1810
|
+
@if (markers().length > 0) {
|
|
1811
|
+
<ui-button variant="secondary" size="sm" [ariaLabel]="labels.t('map.fitMarkers')" [disabled]="!ready()" (click)="fitMarkers()">
|
|
1812
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>
|
|
1813
|
+
</ui-button>
|
|
1814
|
+
}
|
|
1815
|
+
</div>
|
|
1816
|
+
@if (drawEnabled()) {
|
|
1817
|
+
<div class="ui-map__tools" role="group" [attr.aria-label]="labels.t('map.drawToolbar')">
|
|
1818
|
+
@if (drawing(); as shape) {
|
|
1819
|
+
<p class="ui-map__tools-note">{{ drawInstruction() }}</p>
|
|
1820
|
+
<div class="ui-map__tools-row">
|
|
1821
|
+
<ui-button variant="secondary" size="sm" (click)="addPointAtCenter()">{{ labels.t('map.addPointAtCenter') }}</ui-button>
|
|
1822
|
+
@if (draftPoints().length > 0) { <ui-button variant="secondary" size="sm" (click)="undoDrawPoint()">{{ labels.t('map.drawUndo') }}</ui-button> }
|
|
1823
|
+
@if (shape === 'polygon') { <ui-button variant="primary" size="sm" [disabled]="draftPoints().length < 3" (click)="finishDraw()">{{ labels.t('map.drawFinish') }}</ui-button> }
|
|
1824
|
+
<ui-button variant="ghost" size="sm" (click)="cancelDraw()">{{ labels.t('map.drawCancel') }}</ui-button>
|
|
1825
|
+
</div>
|
|
1826
|
+
} @else {
|
|
1827
|
+
<div class="ui-map__tools-row">
|
|
1828
|
+
@for (shape of drawModes(); track shape) {
|
|
1829
|
+
<ui-button variant="secondary" size="sm" [disabled]="!ready()" (click)="startDraw(shape)">{{ drawLabel(shape) }}</ui-button>
|
|
1830
|
+
}
|
|
1831
|
+
@if (area()) { <ui-button variant="ghost" size="sm" (click)="clearArea()">{{ labels.t('map.clearArea') }}</ui-button> }
|
|
1832
|
+
</div>
|
|
1833
|
+
@if (areaText(); as summary) { <p class="ui-map__tools-note">{{ labels.t('map.areaSummary', { area: summary }) }}</p> }
|
|
1834
|
+
}
|
|
1835
|
+
</div>
|
|
1836
|
+
}
|
|
1837
|
+
@if (selectedMarker(); as marker) {
|
|
1838
|
+
@if (info(); as tpl) {
|
|
1839
|
+
<div class="ui-map__info" role="group" [attr.aria-label]="labels.t('map.infoLabel', { name: marker.ariaLabel || marker.label })">
|
|
1840
|
+
<div class="ui-map__info-body">
|
|
1841
|
+
<ng-container [ngTemplateOutlet]="tpl.template" [ngTemplateOutletContext]="{ $implicit: marker, marker: marker }" />
|
|
1842
|
+
</div>
|
|
1843
|
+
<ui-button variant="icon" size="sm" [ariaLabel]="labels.t('map.closeInfo')" (click)="closeInfo()">
|
|
1844
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg>
|
|
1845
|
+
</ui-button>
|
|
1846
|
+
</div>
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
<div class="ui-map__attribution">
|
|
1850
|
+
@if (attributionUrl(); as url) {
|
|
1851
|
+
<a [href]="url" target="_blank" rel="noopener noreferrer">{{ tileAttribution() }}<span class="ui-map__sr"> {{ labels.t('dataTable.opensInNewTab') }}</span></a>
|
|
1852
|
+
} @else {
|
|
1853
|
+
<span>{{ tileAttribution() }}</span>
|
|
1854
|
+
}
|
|
1855
|
+
</div>
|
|
1856
|
+
}
|
|
1857
|
+
</div>
|
|
1858
|
+
|
|
1859
|
+
@if (!unavailable()) { <p class="ui-map__sr" [id]="helpId">{{ labels.t('map.keyboardHelp') }}</p> }
|
|
1860
|
+
<div class="ui-map__sr" role="status" aria-live="polite" aria-atomic="true">{{ announcement() }}</div>
|
|
1861
|
+
|
|
1862
|
+
<section class="ui-map__list" [class.ui-map__list--shown]="showList() || unavailable()" [attr.aria-label]="labels.t('map.listLabel')">
|
|
1863
|
+
<div class="ui-map__list-head">
|
|
1864
|
+
<span class="ui-map__list-title">{{ labels.t('map.listLabel') }}</span>
|
|
1865
|
+
<span class="ui-map__list-count">{{ listSummary() }}</span>
|
|
1866
|
+
</div>
|
|
1867
|
+
@if (listItems().length === 0) {
|
|
1868
|
+
<p class="ui-map__list-empty">{{ labels.t('map.listEmpty') }}</p>
|
|
1869
|
+
} @else {
|
|
1870
|
+
<ul class="ui-map__places" (keydown)="onListKey($event)">
|
|
1871
|
+
@for (m of listItems(); track m.id) {
|
|
1872
|
+
@let st = styleOf(m);
|
|
1873
|
+
<li>
|
|
1874
|
+
<button type="button" class="ui-map__place" [class.ui-map__place--selected]="m.id === selectedId()"
|
|
1875
|
+
[attr.aria-current]="m.id === selectedId() ? 'true' : null"
|
|
1876
|
+
[attr.data-marker-id]="m.id"
|
|
1877
|
+
[attr.tabindex]="m.id === listTabId() ? 0 : -1"
|
|
1878
|
+
(focus)="listTab.set(m.id)"
|
|
1879
|
+
(click)="selectFromList(m)">
|
|
1880
|
+
<span class="ui-map__pin ui-map__pin--{{ st.shape }} ui-map__pin--inline" [style.--pin-color]="st.color" aria-hidden="true">
|
|
1881
|
+
<span class="ui-map__pin-shape"></span><span class="ui-map__pin-glyph">{{ glyphOf(m) }}</span>
|
|
1882
|
+
</span>
|
|
1883
|
+
<span class="ui-map__place-text">
|
|
1884
|
+
<span class="ui-map__place-label">{{ m.label }}</span>
|
|
1885
|
+
@if (m.category) { <span class="ui-map__place-category">{{ m.category }}</span> }
|
|
1886
|
+
</span>
|
|
1887
|
+
</button>
|
|
1888
|
+
</li>
|
|
1889
|
+
}
|
|
1890
|
+
</ul>
|
|
1891
|
+
}
|
|
1892
|
+
</section>
|
|
1893
|
+
</div>
|
|
1894
|
+
`,
|
|
1895
|
+
styles: ["ui-map{display:block}.ui-map{position:relative;display:flex;flex-direction:column;gap:12px;width:100%}.ui-map .leaflet-pane,.ui-map .leaflet-tile,.ui-map .leaflet-marker-icon,.ui-map .leaflet-marker-shadow,.ui-map .leaflet-tile-container,.ui-map .leaflet-pane>svg,.ui-map .leaflet-pane>canvas,.ui-map .leaflet-zoom-box,.ui-map .leaflet-image-layer,.ui-map .leaflet-layer{position:absolute;left:0;top:0}.ui-map .leaflet-container{overflow:hidden}.ui-map .leaflet-tile,.ui-map .leaflet-marker-icon,.ui-map .leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.ui-map .leaflet-tile::selection{background:transparent}.ui-map .leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.ui-map .leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.ui-map .leaflet-marker-icon,.ui-map .leaflet-marker-shadow{display:block}.ui-map .leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.ui-map .leaflet-container .leaflet-marker-pane img,.ui-map .leaflet-container .leaflet-shadow-pane img,.ui-map .leaflet-container .leaflet-tile-pane img,.ui-map .leaflet-container img.leaflet-image-layer,.ui-map .leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.ui-map .leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.ui-map .leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.ui-map .leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.ui-map .leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.ui-map .leaflet-container{-webkit-tap-highlight-color:transparent}.ui-map .leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.ui-map .leaflet-tile{filter:inherit;visibility:hidden}.ui-map .leaflet-tile-loaded{visibility:inherit}.ui-map .leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.ui-map .leaflet-overlay-pane svg{-moz-user-select:none}.ui-map .leaflet-pane{z-index:400}.ui-map .leaflet-tile-pane{z-index:200}.ui-map .leaflet-overlay-pane{z-index:400}.ui-map .leaflet-shadow-pane{z-index:500}.ui-map .leaflet-marker-pane{z-index:600}.ui-map .leaflet-tooltip-pane{z-index:650}.ui-map .leaflet-popup-pane{z-index:700}.ui-map .leaflet-map-pane canvas{z-index:100}.ui-map .leaflet-map-pane svg{z-index:200}.ui-map .leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.ui-map .leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.ui-map .leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.ui-map svg.leaflet-zoom-animated{will-change:transform}.ui-map .leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.ui-map .leaflet-zoom-anim .leaflet-tile,.ui-map .leaflet-pan-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.ui-map .leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.ui-map .leaflet-interactive{cursor:pointer}.ui-map .leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ui-map .leaflet-crosshair,.ui-map .leaflet-crosshair .leaflet-interactive{cursor:crosshair}.ui-map .leaflet-popup-pane,.ui-map .leaflet-control{cursor:auto}.ui-map .leaflet-dragging .leaflet-grab,.ui-map .leaflet-dragging .leaflet-grab .leaflet-interactive,.ui-map .leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ui-map .leaflet-marker-icon,.ui-map .leaflet-marker-shadow,.ui-map .leaflet-image-layer,.ui-map .leaflet-pane>svg path,.ui-map .leaflet-tile-container{pointer-events:none}.ui-map .leaflet-marker-icon.leaflet-interactive,.ui-map .leaflet-image-layer.leaflet-interactive,.ui-map .leaflet-pane>svg path.leaflet-interactive,.ui-map svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.ui-map .leaflet-container{background:#ddd;outline-offset:1px}.ui-map .leaflet-container a{color:#0078a8}.ui-map .leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.ui-map .ui-map__stage{position:relative;height:var(--ui-map-height, 420px);min-height:240px;border:1px solid #cbd5e1;border-radius:10px;overflow:hidden;background:#e2e8f0}.ui-map .ui-map__canvas{position:absolute;inset:0;z-index:0}.ui-map .ui-map__canvas:focus{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:-2px}.ui-map .ui-map__canvas:focus:not(:focus-visible){outline:none}.ui-map .ui-map__canvas:focus-visible{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:-2px}.ui-map .leaflet-container{font:inherit;background:#e2e8f0}.ui-map .leaflet-container:focus-visible{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:-2px}.ui-map .ui-map__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ui-map .ui-map__controls{position:absolute;top:10px;right:10px;z-index:800;display:flex;flex-direction:column;gap:6px}.ui-map .ui-map__tools{position:absolute;top:10px;left:10px;z-index:800;max-width:calc(100% - 76px);display:flex;flex-direction:column;gap:6px;padding:8px;background:#fff;border:1px solid #cbd5e1;border-radius:8px;box-shadow:0 2px 8px #0f172a26}.ui-map .ui-map__tools-row{display:flex;flex-wrap:wrap;gap:6px}.ui-map .ui-map__tools-note{margin:0;font-size:12px;line-height:1.4;color:#334155}.ui-map .ui-map__attribution{position:absolute;right:0;bottom:0;z-index:800;max-width:100%;padding:2px 8px;font-size:11px;line-height:1.5;color:#1e293b;background:#ffffffd9;border-top-left-radius:6px}.ui-map .ui-map__attribution a{display:inline-block;color:#1d4ed8;text-decoration:underline;padding:7px 0}.ui-map .ui-map__attribution a:focus-visible{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:2px}.ui-map .ui-map__info{position:absolute;left:10px;bottom:28px;z-index:800;display:flex;align-items:flex-start;gap:4px;max-width:min(360px,100% - 20px);max-height:60%;padding:10px 6px 10px 12px;background:#fff;border:1px solid #94a3b8;border-radius:8px;box-shadow:0 4px 14px #0f172a40;overflow:auto}.ui-map .ui-map__info-body{min-width:0;flex:1;font-size:13px;color:#0f172a}.ui-map .ui-map__notice,.ui-map .ui-map__loading{position:absolute;left:50%;top:10px;z-index:900;transform:translate(-50%);padding:6px 12px;font-size:12px;font-weight:600;color:#0f172a;background:#fef3c7;border:1px solid #b45309;border-radius:8px}.ui-map .ui-map__loading{background:#fff;border-color:#94a3b8}.ui-map .ui-map__crosshair{position:absolute;left:50%;top:50%;z-index:700;width:28px;height:28px;margin:-14px 0 0 -14px;pointer-events:none}.ui-map .ui-map__crosshair:before,.ui-map .ui-map__crosshair:after{content:\"\";position:absolute;background:#0f172a;box-shadow:0 0 0 1.5px #fff}.ui-map .ui-map__crosshair:before{left:13px;top:0;width:2px;height:28px}.ui-map .ui-map__crosshair:after{top:13px;left:0;height:2px;width:28px}.ui-map.ui-map--drawing .leaflet-marker-icon{pointer-events:none!important}.ui-map .ui-map__unavailable{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:24px;text-align:center;color:#334155;background:repeating-linear-gradient(45deg,#f1f5f9,#f1f5f9 12px,#e2e8f0 12px 24px)}.ui-map .ui-map__unavailable-text{margin:0;max-width:40ch;font-size:14px;font-weight:600;line-height:1.4;color:#0f172a}.ui-map .ui-map__icon{background:transparent;border:0}.ui-map .ui-map__pin{position:relative;width:32px;height:32px;--pin-color: #1d4ed8}.ui-map .ui-map__pin-shape{position:absolute;inset:2px;background:var(--pin-color);border:2px solid #fff;box-shadow:0 1px 4px #0f172a80;box-sizing:border-box}.ui-map .ui-map__pin--circle .ui-map__pin-shape{border-radius:50%}.ui-map .ui-map__pin--square .ui-map__pin-shape{border-radius:5px}.ui-map .ui-map__pin--diamond .ui-map__pin-shape{inset:5px;transform:rotate(45deg);border-radius:3px}.ui-map .ui-map__pin--hexagon .ui-map__pin-shape{border:0;box-shadow:none;clip-path:polygon(25% 3%,75% 3%,100% 50%,75% 97%,25% 97%,0 50%)}.ui-map .ui-map__pin-glyph{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;line-height:1;color:#fff;pointer-events:none}.ui-map .ui-map__pin--selected:after{content:\"\";position:absolute;inset:-2px;border:3px solid #0f172a;border-radius:50%;box-shadow:0 0 0 2px #fff;pointer-events:none}.ui-map .ui-map__pin--selected{z-index:2;transform:scale(1.18)}.ui-map .ui-map__icon:after{content:\"\";position:absolute;inset:-6px}.ui-map .ui-map__cluster{width:44px;height:44px;display:flex;align-items:center;justify-content:center;border-radius:50%;color:#fff;background:#0f172a;border:3px solid #fff;box-shadow:0 1px 5px #0f172a8c;box-sizing:border-box}.ui-map .ui-map__cluster-count{font-size:13px;font-weight:700;line-height:1}.ui-map .ui-map__area{stroke:#1d4ed8;stroke-width:3;fill:#1d4ed8;fill-opacity:.14}.ui-map .ui-map__draft{stroke:#0f172a;stroke-width:3;stroke-dasharray:8 6;fill:#1d4ed8;fill-opacity:.08}.ui-map .ui-map__draft-point{stroke:#fff;stroke-width:2;fill:#0f172a;fill-opacity:1}.ui-map .ui-map__list{display:flex;flex-direction:column;gap:6px}.ui-map .ui-map__list:not(.ui-map__list--shown):not(:focus-within){position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.ui-map .ui-map__list-head{display:flex;justify-content:space-between;gap:8px;font-size:12px;color:#475569}.ui-map .ui-map__list-title{font-weight:700;color:#0f172a;text-transform:uppercase;letter-spacing:.04em}.ui-map .ui-map__list-empty{margin:0;font-size:13px;color:#475569}.ui-map .ui-map__places{list-style:none;margin:0;padding:0;max-height:240px;overflow-y:auto;border:1px solid #e2e8f0;border-radius:8px}.ui-map .ui-map__places>li+li{border-top:1px solid #e2e8f0}.ui-map .ui-map__place{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:6px 12px;font:inherit;text-align:left;color:#0f172a;background:#fff;border:0;cursor:pointer}.ui-map .ui-map__place:hover{background:#f1f5f9}.ui-map .ui-map__place:focus-visible{outline:2px solid var(--ui-focus, #3b82f6);outline-offset:-2px}.ui-map .ui-map__place--selected{background:#eff6ff;box-shadow:inset 4px 0 #0f172a;font-weight:600}.ui-map .ui-map__pin--inline{flex:0 0 auto;width:28px;height:28px}.ui-map .ui-map__pin--inline .ui-map__pin-glyph{font-size:11px}.ui-map .ui-map__place-text{display:flex;flex-direction:column;min-width:0}.ui-map .ui-map__place-label{overflow-wrap:anywhere;font-size:14px}.ui-map .ui-map__place-category{font-size:12px;color:#475569;font-weight:400}@media(prefers-reduced-motion:reduce){.ui-map .leaflet-zoom-anim .leaflet-zoom-animated,.ui-map .leaflet-fade-anim .leaflet-tile,.ui-map .leaflet-fade-anim .leaflet-zoom-animated{transition:none}.ui-map .ui-map__pin--selected{transform:none}}@media(forced-colors:active){.ui-map .ui-map__stage,.ui-map .ui-map__tools,.ui-map .ui-map__info,.ui-map .ui-map__places,.ui-map .ui-map__notice,.ui-map .ui-map__loading{border:1px solid CanvasText;background:Canvas;color:CanvasText}.ui-map .ui-map__pin-shape{background:ButtonFace;border:2px solid ButtonText;box-shadow:none}.ui-map .ui-map__pin-glyph{color:ButtonText}.ui-map .ui-map__pin--hexagon .ui-map__pin-shape{background:ButtonText}.ui-map .ui-map__pin--selected:after{border-color:Highlight;box-shadow:none}.ui-map .ui-map__cluster{background:ButtonFace;color:ButtonText;border:3px solid ButtonText;box-shadow:none}.ui-map .ui-map__area{stroke:Highlight;fill:Highlight}.ui-map .ui-map__draft{stroke:CanvasText;fill:Canvas}.ui-map .ui-map__draft-point{stroke:Canvas;fill:CanvasText}.ui-map .ui-map__crosshair:before,.ui-map .ui-map__crosshair:after{background:CanvasText;box-shadow:none}.ui-map .ui-map__place--selected{outline:2px solid Highlight;outline-offset:-2px;box-shadow:none}.ui-map .ui-map__place:focus-visible,.ui-map .ui-map__canvas:focus-visible{outline:3px solid Highlight}.ui-map .ui-map__attribution{background:Canvas;color:CanvasText}.ui-map .ui-map__attribution a{color:LinkText}}@media(pointer:coarse){.ui-map .ui-map__place{min-height:48px}.ui-map .ui-map__attribution{padding:6px 10px}}@media(max-width:640px){.ui-map .ui-map__stage{height:max(var(--ui-map-height, 420px),320px)}.ui-map .ui-map__tools{max-width:calc(100% - 64px)}.ui-map .ui-map__info{left:6px;right:6px;max-width:none;bottom:30px}.ui-map .ui-map__places{max-height:200px}}\n"]
|
|
1896
|
+
}]
|
|
1897
|
+
}],
|
|
1898
|
+
ctorParameters: () => [],
|
|
1899
|
+
propDecorators: {
|
|
1900
|
+
markers: [{
|
|
1901
|
+
type: i0.Input,
|
|
1902
|
+
args: [{
|
|
1903
|
+
isSignal: true,
|
|
1904
|
+
alias: "markers",
|
|
1905
|
+
required: false
|
|
1906
|
+
}]
|
|
1907
|
+
}],
|
|
1908
|
+
selectedId: [{
|
|
1909
|
+
type: i0.Input,
|
|
1910
|
+
args: [{
|
|
1911
|
+
isSignal: true,
|
|
1912
|
+
alias: "selectedId",
|
|
1913
|
+
required: false
|
|
1914
|
+
}]
|
|
1915
|
+
}, {
|
|
1916
|
+
type: i0.Output,
|
|
1917
|
+
args: ["selectedIdChange"]
|
|
1918
|
+
}],
|
|
1919
|
+
center: [{
|
|
1920
|
+
type: i0.Input,
|
|
1921
|
+
args: [{
|
|
1922
|
+
isSignal: true,
|
|
1923
|
+
alias: "center",
|
|
1924
|
+
required: false
|
|
1925
|
+
}]
|
|
1926
|
+
}],
|
|
1927
|
+
zoom: [{
|
|
1928
|
+
type: i0.Input,
|
|
1929
|
+
args: [{
|
|
1930
|
+
isSignal: true,
|
|
1931
|
+
alias: "zoom",
|
|
1932
|
+
required: false
|
|
1933
|
+
}]
|
|
1934
|
+
}],
|
|
1935
|
+
initialCenter: [{
|
|
1936
|
+
type: i0.Input,
|
|
1937
|
+
args: [{
|
|
1938
|
+
isSignal: true,
|
|
1939
|
+
alias: "initialCenter",
|
|
1940
|
+
required: false
|
|
1941
|
+
}]
|
|
1942
|
+
}],
|
|
1943
|
+
initialZoom: [{
|
|
1944
|
+
type: i0.Input,
|
|
1945
|
+
args: [{
|
|
1946
|
+
isSignal: true,
|
|
1947
|
+
alias: "initialZoom",
|
|
1948
|
+
required: false
|
|
1949
|
+
}]
|
|
1950
|
+
}],
|
|
1951
|
+
fitToMarkers: [{
|
|
1952
|
+
type: i0.Input,
|
|
1953
|
+
args: [{
|
|
1954
|
+
isSignal: true,
|
|
1955
|
+
alias: "fitToMarkers",
|
|
1956
|
+
required: false
|
|
1957
|
+
}]
|
|
1958
|
+
}],
|
|
1959
|
+
fitKey: [{
|
|
1960
|
+
type: i0.Input,
|
|
1961
|
+
args: [{
|
|
1962
|
+
isSignal: true,
|
|
1963
|
+
alias: "fitKey",
|
|
1964
|
+
required: false
|
|
1965
|
+
}]
|
|
1966
|
+
}],
|
|
1967
|
+
fitPadding: [{
|
|
1968
|
+
type: i0.Input,
|
|
1969
|
+
args: [{
|
|
1970
|
+
isSignal: true,
|
|
1971
|
+
alias: "fitPadding",
|
|
1972
|
+
required: false
|
|
1973
|
+
}]
|
|
1974
|
+
}],
|
|
1975
|
+
fitMaxZoom: [{
|
|
1976
|
+
type: i0.Input,
|
|
1977
|
+
args: [{
|
|
1978
|
+
isSignal: true,
|
|
1979
|
+
alias: "fitMaxZoom",
|
|
1980
|
+
required: false
|
|
1981
|
+
}]
|
|
1982
|
+
}],
|
|
1983
|
+
tileUrlTemplate: [{
|
|
1984
|
+
type: i0.Input,
|
|
1985
|
+
args: [{
|
|
1986
|
+
isSignal: true,
|
|
1987
|
+
alias: "tileUrlTemplate",
|
|
1988
|
+
required: false
|
|
1989
|
+
}]
|
|
1990
|
+
}],
|
|
1991
|
+
tileAttribution: [{
|
|
1992
|
+
type: i0.Input,
|
|
1993
|
+
args: [{
|
|
1994
|
+
isSignal: true,
|
|
1995
|
+
alias: "tileAttribution",
|
|
1996
|
+
required: false
|
|
1997
|
+
}]
|
|
1998
|
+
}],
|
|
1999
|
+
tileAttributionUrl: [{
|
|
2000
|
+
type: i0.Input,
|
|
2001
|
+
args: [{
|
|
2002
|
+
isSignal: true,
|
|
2003
|
+
alias: "tileAttributionUrl",
|
|
2004
|
+
required: false
|
|
2005
|
+
}]
|
|
2006
|
+
}],
|
|
2007
|
+
subdomains: [{
|
|
2008
|
+
type: i0.Input,
|
|
2009
|
+
args: [{
|
|
2010
|
+
isSignal: true,
|
|
2011
|
+
alias: "subdomains",
|
|
2012
|
+
required: false
|
|
2013
|
+
}]
|
|
2014
|
+
}],
|
|
2015
|
+
minZoom: [{
|
|
2016
|
+
type: i0.Input,
|
|
2017
|
+
args: [{
|
|
2018
|
+
isSignal: true,
|
|
2019
|
+
alias: "minZoom",
|
|
2020
|
+
required: false
|
|
2021
|
+
}]
|
|
2022
|
+
}],
|
|
2023
|
+
maxZoom: [{
|
|
2024
|
+
type: i0.Input,
|
|
2025
|
+
args: [{
|
|
2026
|
+
isSignal: true,
|
|
2027
|
+
alias: "maxZoom",
|
|
2028
|
+
required: false
|
|
2029
|
+
}]
|
|
2030
|
+
}],
|
|
2031
|
+
clustering: [{
|
|
2032
|
+
type: i0.Input,
|
|
2033
|
+
args: [{
|
|
2034
|
+
isSignal: true,
|
|
2035
|
+
alias: "clustering",
|
|
2036
|
+
required: false
|
|
2037
|
+
}]
|
|
2038
|
+
}],
|
|
2039
|
+
clusterRadius: [{
|
|
2040
|
+
type: i0.Input,
|
|
2041
|
+
args: [{
|
|
2042
|
+
isSignal: true,
|
|
2043
|
+
alias: "clusterRadius",
|
|
2044
|
+
required: false
|
|
2045
|
+
}]
|
|
2046
|
+
}],
|
|
2047
|
+
clusterMaxZoom: [{
|
|
2048
|
+
type: i0.Input,
|
|
2049
|
+
args: [{
|
|
2050
|
+
isSignal: true,
|
|
2051
|
+
alias: "clusterMaxZoom",
|
|
2052
|
+
required: false
|
|
2053
|
+
}]
|
|
2054
|
+
}],
|
|
2055
|
+
drawModes: [{
|
|
2056
|
+
type: i0.Input,
|
|
2057
|
+
args: [{
|
|
2058
|
+
isSignal: true,
|
|
2059
|
+
alias: "drawModes",
|
|
2060
|
+
required: false
|
|
2061
|
+
}]
|
|
2062
|
+
}],
|
|
2063
|
+
area: [{
|
|
2064
|
+
type: i0.Input,
|
|
2065
|
+
args: [{
|
|
2066
|
+
isSignal: true,
|
|
2067
|
+
alias: "area",
|
|
2068
|
+
required: false
|
|
2069
|
+
}]
|
|
2070
|
+
}, {
|
|
2071
|
+
type: i0.Output,
|
|
2072
|
+
args: ["areaChange"]
|
|
2073
|
+
}],
|
|
2074
|
+
readOnly: [{
|
|
2075
|
+
type: i0.Input,
|
|
2076
|
+
args: [{
|
|
2077
|
+
isSignal: true,
|
|
2078
|
+
alias: "readOnly",
|
|
2079
|
+
required: false
|
|
2080
|
+
}]
|
|
2081
|
+
}],
|
|
2082
|
+
fitToArea: [{
|
|
2083
|
+
type: i0.Input,
|
|
2084
|
+
args: [{
|
|
2085
|
+
isSignal: true,
|
|
2086
|
+
alias: "fitToArea",
|
|
2087
|
+
required: false
|
|
2088
|
+
}]
|
|
2089
|
+
}],
|
|
2090
|
+
ariaLabel: [{
|
|
2091
|
+
type: i0.Input,
|
|
2092
|
+
args: [{
|
|
2093
|
+
isSignal: true,
|
|
2094
|
+
alias: "ariaLabel",
|
|
2095
|
+
required: false
|
|
2096
|
+
}]
|
|
2097
|
+
}],
|
|
2098
|
+
height: [{
|
|
2099
|
+
type: i0.Input,
|
|
2100
|
+
args: [{
|
|
2101
|
+
isSignal: true,
|
|
2102
|
+
alias: "height",
|
|
2103
|
+
required: false
|
|
2104
|
+
}]
|
|
2105
|
+
}],
|
|
2106
|
+
showList: [{
|
|
2107
|
+
type: i0.Input,
|
|
2108
|
+
args: [{
|
|
2109
|
+
isSignal: true,
|
|
2110
|
+
alias: "showList",
|
|
2111
|
+
required: false
|
|
2112
|
+
}]
|
|
2113
|
+
}],
|
|
2114
|
+
listLimit: [{
|
|
2115
|
+
type: i0.Input,
|
|
2116
|
+
args: [{
|
|
2117
|
+
isSignal: true,
|
|
2118
|
+
alias: "listLimit",
|
|
2119
|
+
required: false
|
|
2120
|
+
}]
|
|
2121
|
+
}],
|
|
2122
|
+
loading: [{
|
|
2123
|
+
type: i0.Input,
|
|
2124
|
+
args: [{
|
|
2125
|
+
isSignal: true,
|
|
2126
|
+
alias: "loading",
|
|
2127
|
+
required: false
|
|
2128
|
+
}]
|
|
2129
|
+
}],
|
|
2130
|
+
idleDelay: [{
|
|
2131
|
+
type: i0.Input,
|
|
2132
|
+
args: [{
|
|
2133
|
+
isSignal: true,
|
|
2134
|
+
alias: "idleDelay",
|
|
2135
|
+
required: false
|
|
2136
|
+
}]
|
|
2137
|
+
}],
|
|
2138
|
+
scrollWheelZoom: [{
|
|
2139
|
+
type: i0.Input,
|
|
2140
|
+
args: [{
|
|
2141
|
+
isSignal: true,
|
|
2142
|
+
alias: "scrollWheelZoom",
|
|
2143
|
+
required: false
|
|
2144
|
+
}]
|
|
2145
|
+
}],
|
|
2146
|
+
boundsChange: [{
|
|
2147
|
+
type: i0.Output,
|
|
2148
|
+
args: ["boundsChange"]
|
|
2149
|
+
}],
|
|
2150
|
+
viewChange: [{
|
|
2151
|
+
type: i0.Output,
|
|
2152
|
+
args: ["viewChange"]
|
|
2153
|
+
}],
|
|
2154
|
+
markerClick: [{
|
|
2155
|
+
type: i0.Output,
|
|
2156
|
+
args: ["markerClick"]
|
|
2157
|
+
}],
|
|
2158
|
+
info: [{
|
|
2159
|
+
type: i0.ContentChild,
|
|
2160
|
+
args: [i0.forwardRef(() => UiMapInfoDirective), { isSignal: true }]
|
|
2161
|
+
}],
|
|
2162
|
+
canvas: [{
|
|
2163
|
+
type: i0.ViewChild,
|
|
2164
|
+
args: ["canvas", { isSignal: true }]
|
|
2165
|
+
}]
|
|
2166
|
+
}
|
|
2167
|
+
});
|
|
2168
|
+
const UNIT_METERS = {
|
|
2169
|
+
m: 1,
|
|
2170
|
+
km: 1e3,
|
|
2171
|
+
mi: 1609.344
|
|
2172
|
+
};
|
|
2173
|
+
const asNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
2174
|
+
var MapAreaFormComponent = class MapAreaFormComponent {
|
|
2175
|
+
constructor() {
|
|
2176
|
+
this.labels = inject(UiLabelsService);
|
|
2177
|
+
this.area = model(null, ...ngDevMode ? [{ debugName: "area" }] : /* istanbul ignore next */ []);
|
|
2178
|
+
this.shapes = input([
|
|
2179
|
+
"circle",
|
|
2180
|
+
"rectangle",
|
|
2181
|
+
"polygon"
|
|
2182
|
+
], ...ngDevMode ? [{ debugName: "shapes" }] : /* istanbul ignore next */ []);
|
|
2183
|
+
this.defaultUnit = input("mi", ...ngDevMode ? [{ debugName: "defaultUnit" }] : /* istanbul ignore next */ []);
|
|
2184
|
+
this.readOnly = input(false, ...ngDevMode ? [{ debugName: "readOnly" }] : /* istanbul ignore next */ []);
|
|
2185
|
+
this.shape = signal("circle", ...ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []);
|
|
2186
|
+
this.unit = signal("mi", ...ngDevMode ? [{ debugName: "unit" }] : /* istanbul ignore next */ []);
|
|
2187
|
+
this.lat = signal(null, ...ngDevMode ? [{ debugName: "lat" }] : /* istanbul ignore next */ []);
|
|
2188
|
+
this.lng = signal(null, ...ngDevMode ? [{ debugName: "lng" }] : /* istanbul ignore next */ []);
|
|
2189
|
+
this.radius = signal(null, ...ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []);
|
|
2190
|
+
this.meters = signal(null, ...ngDevMode ? [{ debugName: "meters" }] : /* istanbul ignore next */ []);
|
|
2191
|
+
this.north = signal(null, ...ngDevMode ? [{ debugName: "north" }] : /* istanbul ignore next */ []);
|
|
2192
|
+
this.south = signal(null, ...ngDevMode ? [{ debugName: "south" }] : /* istanbul ignore next */ []);
|
|
2193
|
+
this.east = signal(null, ...ngDevMode ? [{ debugName: "east" }] : /* istanbul ignore next */ []);
|
|
2194
|
+
this.west = signal(null, ...ngDevMode ? [{ debugName: "west" }] : /* istanbul ignore next */ []);
|
|
2195
|
+
this.pointLat = signal(null, ...ngDevMode ? [{ debugName: "pointLat" }] : /* istanbul ignore next */ []);
|
|
2196
|
+
this.pointLng = signal(null, ...ngDevMode ? [{ debugName: "pointLng" }] : /* istanbul ignore next */ []);
|
|
2197
|
+
this.points = signal([], ...ngDevMode ? [{ debugName: "points" }] : /* istanbul ignore next */ []);
|
|
2198
|
+
this.touched = signal(false, ...ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []);
|
|
2199
|
+
this.pointTouched = signal(false, ...ngDevMode ? [{ debugName: "pointTouched" }] : /* istanbul ignore next */ []);
|
|
2200
|
+
this.announcement = signal("", ...ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []);
|
|
2201
|
+
this.lastApplied = null;
|
|
2202
|
+
this.unitChosen = false;
|
|
2203
|
+
this.shapeOptions = computed(() => this.shapes().map((value) => ({
|
|
2204
|
+
value,
|
|
2205
|
+
label: this.labels.t(value === "circle" ? "map.form.circle" : value === "rectangle" ? "map.form.rectangle" : "map.form.polygon")
|
|
2206
|
+
})), ...ngDevMode ? [{ debugName: "shapeOptions" }] : /* istanbul ignore next */ []);
|
|
2207
|
+
this.unitOptions = computed(() => [
|
|
2208
|
+
{
|
|
2209
|
+
value: "m",
|
|
2210
|
+
label: this.labels.t("map.form.unitM")
|
|
2211
|
+
},
|
|
2212
|
+
{
|
|
2213
|
+
value: "km",
|
|
2214
|
+
label: this.labels.t("map.form.unitKm")
|
|
2215
|
+
},
|
|
2216
|
+
{
|
|
2217
|
+
value: "mi",
|
|
2218
|
+
label: this.labels.t("map.form.unitMi")
|
|
2219
|
+
}
|
|
2220
|
+
], ...ngDevMode ? [{ debugName: "unitOptions" }] : /* istanbul ignore next */ []);
|
|
2221
|
+
this.errors = computed(() => {
|
|
2222
|
+
const show = this.touched();
|
|
2223
|
+
const latMsg = (v) => v === null ? this.labels.t("map.form.errorNumber") : isValidLat(v) ? "" : this.labels.t("map.form.errorLat");
|
|
2224
|
+
const lngMsg = (v) => v === null ? this.labels.t("map.form.errorNumber") : isValidLng(v) ? "" : this.labels.t("map.form.errorLng");
|
|
2225
|
+
const r = this.radius();
|
|
2226
|
+
const n = this.north(), s = this.south(), e = this.east(), w = this.west();
|
|
2227
|
+
const out = {
|
|
2228
|
+
lat: "",
|
|
2229
|
+
lng: "",
|
|
2230
|
+
radius: "",
|
|
2231
|
+
north: "",
|
|
2232
|
+
south: "",
|
|
2233
|
+
east: "",
|
|
2234
|
+
west: "",
|
|
2235
|
+
pointLat: "",
|
|
2236
|
+
pointLng: "",
|
|
2237
|
+
points: ""
|
|
2238
|
+
};
|
|
2239
|
+
if (show) {
|
|
2240
|
+
if (this.shape() === "circle") {
|
|
2241
|
+
out.lat = latMsg(this.lat());
|
|
2242
|
+
out.lng = lngMsg(this.lng());
|
|
2243
|
+
out.radius = r === null ? this.labels.t("map.form.errorNumber") : r > 0 ? "" : this.labels.t("map.form.errorRadius");
|
|
2244
|
+
} else if (this.shape() === "rectangle") {
|
|
2245
|
+
out.north = latMsg(n);
|
|
2246
|
+
out.south = latMsg(s);
|
|
2247
|
+
out.east = lngMsg(e);
|
|
2248
|
+
out.west = lngMsg(w);
|
|
2249
|
+
if (!out.north && !out.south && n <= s) out.north = this.labels.t("map.form.errorNorthSouth");
|
|
2250
|
+
if (!out.east && !out.west && e <= w) out.east = this.labels.t("map.form.errorEastWest");
|
|
2251
|
+
} else if (this.points().length < 3) out.points = this.labels.t("map.form.errorPolygon");
|
|
2252
|
+
else if (!isSimplePolygon(this.points())) out.points = this.labels.t("map.form.errorSelfIntersecting");
|
|
2253
|
+
}
|
|
2254
|
+
if (this.pointTouched()) {
|
|
2255
|
+
out.pointLat = latMsg(this.pointLat());
|
|
2256
|
+
out.pointLng = lngMsg(this.pointLng());
|
|
2257
|
+
}
|
|
2258
|
+
return out;
|
|
2259
|
+
}, ...ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []);
|
|
2260
|
+
this.hasErrors = computed(() => Object.entries(this.errors()).some(([field, m]) => m !== "" && field !== "pointLat" && field !== "pointLng"), ...ngDevMode ? [{ debugName: "hasErrors" }] : /* istanbul ignore next */ []);
|
|
2261
|
+
effect(() => {
|
|
2262
|
+
const unit = this.defaultUnit();
|
|
2263
|
+
untracked(() => {
|
|
2264
|
+
if (!this.unitChosen) this.unit.set(unit);
|
|
2265
|
+
});
|
|
2266
|
+
});
|
|
2267
|
+
effect(() => {
|
|
2268
|
+
const a = this.area();
|
|
2269
|
+
untracked(() => {
|
|
2270
|
+
if (a === null) {
|
|
2271
|
+
if (this.lastApplied !== null) this.reset();
|
|
2272
|
+
return;
|
|
2273
|
+
}
|
|
2274
|
+
if (sameArea(a, this.lastApplied)) return;
|
|
2275
|
+
this.fillFrom(a);
|
|
2276
|
+
});
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
2279
|
+
num(value) {
|
|
2280
|
+
return asNumber(value);
|
|
2281
|
+
}
|
|
2282
|
+
onRadius(value) {
|
|
2283
|
+
this.radius.set(value);
|
|
2284
|
+
this.meters.set(value === null ? null : value * UNIT_METERS[this.unit()]);
|
|
2285
|
+
}
|
|
2286
|
+
fmt(value) {
|
|
2287
|
+
return this.labels.formatNumber(value, { maximumFractionDigits: 6 });
|
|
2288
|
+
}
|
|
2289
|
+
setShape(value) {
|
|
2290
|
+
if (value !== "circle" && value !== "rectangle" && value !== "polygon") return;
|
|
2291
|
+
this.shape.set(value);
|
|
2292
|
+
this.touched.set(false);
|
|
2293
|
+
this.pointTouched.set(false);
|
|
2294
|
+
}
|
|
2295
|
+
setUnit(value) {
|
|
2296
|
+
if (value !== "m" && value !== "km" && value !== "mi") return;
|
|
2297
|
+
this.unitChosen = true;
|
|
2298
|
+
const m = this.meters();
|
|
2299
|
+
if (m !== null) this.radius.set(this.round(m / UNIT_METERS[value]));
|
|
2300
|
+
this.unit.set(value);
|
|
2301
|
+
}
|
|
2302
|
+
addPoint() {
|
|
2303
|
+
this.pointTouched.set(true);
|
|
2304
|
+
const la = this.pointLat();
|
|
2305
|
+
const ln = this.pointLng();
|
|
2306
|
+
if (la === null || ln === null || !isValidLat(la) || !isValidLng(ln)) return;
|
|
2307
|
+
this.points.update((list) => [...list, {
|
|
2308
|
+
lat: la,
|
|
2309
|
+
lng: ln
|
|
2310
|
+
}]);
|
|
2311
|
+
this.pointLat.set(null);
|
|
2312
|
+
this.pointLng.set(null);
|
|
2313
|
+
this.pointTouched.set(false);
|
|
2314
|
+
}
|
|
2315
|
+
removePoint(index) {
|
|
2316
|
+
this.points.update((list) => list.filter((_, i) => i !== index));
|
|
2317
|
+
}
|
|
2318
|
+
apply() {
|
|
2319
|
+
this.touched.set(true);
|
|
2320
|
+
if (this.hasErrors()) return;
|
|
2321
|
+
const next = this.build();
|
|
2322
|
+
if (!next || !isValidArea(next)) return;
|
|
2323
|
+
this.lastApplied = next;
|
|
2324
|
+
this.area.set(next);
|
|
2325
|
+
this.announce(this.labels.t("map.form.applied"));
|
|
2326
|
+
}
|
|
2327
|
+
clear() {
|
|
2328
|
+
this.reset();
|
|
2329
|
+
this.lastApplied = null;
|
|
2330
|
+
this.area.set(null);
|
|
2331
|
+
this.announce(this.labels.t("map.draw.cleared"));
|
|
2332
|
+
}
|
|
2333
|
+
build() {
|
|
2334
|
+
switch (this.shape()) {
|
|
2335
|
+
case "circle": {
|
|
2336
|
+
const lat = this.lat(), lng = this.lng(), m = this.meters();
|
|
2337
|
+
if (lat === null || lng === null || m === null) return null;
|
|
2338
|
+
return {
|
|
2339
|
+
type: "circle",
|
|
2340
|
+
lat,
|
|
2341
|
+
lng,
|
|
2342
|
+
radiusMeters: m
|
|
2343
|
+
};
|
|
2344
|
+
}
|
|
2345
|
+
case "rectangle": {
|
|
2346
|
+
const n = this.north(), s = this.south(), e = this.east(), w = this.west();
|
|
2347
|
+
if (n === null || s === null || e === null || w === null) return null;
|
|
2348
|
+
return {
|
|
2349
|
+
type: "bbox",
|
|
2350
|
+
north: n,
|
|
2351
|
+
south: s,
|
|
2352
|
+
east: e,
|
|
2353
|
+
west: w
|
|
2354
|
+
};
|
|
2355
|
+
}
|
|
2356
|
+
case "polygon": return {
|
|
2357
|
+
type: "polygon",
|
|
2358
|
+
points: this.points().map((p) => ({ ...p }))
|
|
2359
|
+
};
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
fillFrom(a) {
|
|
2363
|
+
this.touched.set(false);
|
|
2364
|
+
this.pointTouched.set(false);
|
|
2365
|
+
if (a.type === "circle") {
|
|
2366
|
+
this.shape.set("circle");
|
|
2367
|
+
this.lat.set(a.lat);
|
|
2368
|
+
this.lng.set(a.lng);
|
|
2369
|
+
this.meters.set(a.radiusMeters);
|
|
2370
|
+
this.radius.set(this.round(a.radiusMeters / UNIT_METERS[this.unit()]));
|
|
2371
|
+
} else if (a.type === "bbox") {
|
|
2372
|
+
this.shape.set("rectangle");
|
|
2373
|
+
this.north.set(a.north);
|
|
2374
|
+
this.south.set(a.south);
|
|
2375
|
+
this.east.set(a.east);
|
|
2376
|
+
this.west.set(a.west);
|
|
2377
|
+
} else {
|
|
2378
|
+
this.shape.set("polygon");
|
|
2379
|
+
this.points.set(a.points.map((p) => ({ ...p })));
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
reset() {
|
|
2383
|
+
this.touched.set(false);
|
|
2384
|
+
this.pointTouched.set(false);
|
|
2385
|
+
for (const s of [
|
|
2386
|
+
this.lat,
|
|
2387
|
+
this.lng,
|
|
2388
|
+
this.radius,
|
|
2389
|
+
this.north,
|
|
2390
|
+
this.south,
|
|
2391
|
+
this.east,
|
|
2392
|
+
this.west,
|
|
2393
|
+
this.pointLat,
|
|
2394
|
+
this.pointLng
|
|
2395
|
+
]) s.set(null);
|
|
2396
|
+
this.points.set([]);
|
|
2397
|
+
this.meters.set(null);
|
|
2398
|
+
}
|
|
2399
|
+
round(v) {
|
|
2400
|
+
return Math.round(v * 1e6) / 1e6;
|
|
2401
|
+
}
|
|
2402
|
+
announce(text) {
|
|
2403
|
+
this.announcement.set(text === this.announcement() ? text + "\xA0" : text);
|
|
2404
|
+
}
|
|
2405
|
+
static {
|
|
2406
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
2407
|
+
minVersion: "12.0.0",
|
|
2408
|
+
version: "22.2.2",
|
|
2409
|
+
ngImport: i0,
|
|
2410
|
+
type: MapAreaFormComponent,
|
|
2411
|
+
deps: [],
|
|
2412
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
2413
|
+
});
|
|
2414
|
+
}
|
|
2415
|
+
static {
|
|
2416
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
2417
|
+
minVersion: "17.0.0",
|
|
2418
|
+
version: "22.2.2",
|
|
2419
|
+
type: MapAreaFormComponent,
|
|
2420
|
+
isStandalone: true,
|
|
2421
|
+
selector: "ui-map-area-form",
|
|
2422
|
+
inputs: {
|
|
2423
|
+
area: {
|
|
2424
|
+
classPropertyName: "area",
|
|
2425
|
+
publicName: "area",
|
|
2426
|
+
isSignal: true,
|
|
2427
|
+
isRequired: false,
|
|
2428
|
+
transformFunction: null
|
|
2429
|
+
},
|
|
2430
|
+
shapes: {
|
|
2431
|
+
classPropertyName: "shapes",
|
|
2432
|
+
publicName: "shapes",
|
|
2433
|
+
isSignal: true,
|
|
2434
|
+
isRequired: false,
|
|
2435
|
+
transformFunction: null
|
|
2436
|
+
},
|
|
2437
|
+
defaultUnit: {
|
|
2438
|
+
classPropertyName: "defaultUnit",
|
|
2439
|
+
publicName: "defaultUnit",
|
|
2440
|
+
isSignal: true,
|
|
2441
|
+
isRequired: false,
|
|
2442
|
+
transformFunction: null
|
|
2443
|
+
},
|
|
2444
|
+
readOnly: {
|
|
2445
|
+
classPropertyName: "readOnly",
|
|
2446
|
+
publicName: "readOnly",
|
|
2447
|
+
isSignal: true,
|
|
2448
|
+
isRequired: false,
|
|
2449
|
+
transformFunction: null
|
|
2450
|
+
}
|
|
2451
|
+
},
|
|
2452
|
+
outputs: { area: "areaChange" },
|
|
2453
|
+
ngImport: i0,
|
|
2454
|
+
template: `
|
|
2455
|
+
<ui-form-section>
|
|
2456
|
+
<p class="maf-title">{{ labels.t('map.form.title') }}</p>
|
|
2457
|
+
<ui-select [label]="labels.t('map.form.shape')" [options]="shapeOptions()" [ngModel]="shape()" (ngModelChange)="setShape($event)" [disabled]="readOnly()" />
|
|
2458
|
+
|
|
2459
|
+
@switch (shape()) {
|
|
2460
|
+
@case ('circle') {
|
|
2461
|
+
<ui-form-row>
|
|
2462
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.centerLat')" [required]="true"
|
|
2463
|
+
[ngModel]="lat()" (ngModelChange)="lat.set(num($event))" [error]="errors().lat" [disabled]="readOnly()" inputTestId="maf-lat" />
|
|
2464
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.centerLng')" [required]="true"
|
|
2465
|
+
[ngModel]="lng()" (ngModelChange)="lng.set(num($event))" [error]="errors().lng" [disabled]="readOnly()" inputTestId="maf-lng" />
|
|
2466
|
+
</ui-form-row>
|
|
2467
|
+
<ui-form-row>
|
|
2468
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.radius')" [required]="true"
|
|
2469
|
+
[ngModel]="radius()" (ngModelChange)="onRadius(num($event))" [error]="errors().radius" [disabled]="readOnly()" inputTestId="maf-radius" />
|
|
2470
|
+
<ui-select [label]="labels.t('map.form.radiusUnit')" [options]="unitOptions()" [ngModel]="unit()" (ngModelChange)="setUnit($event)" [disabled]="readOnly()" />
|
|
2471
|
+
</ui-form-row>
|
|
2472
|
+
}
|
|
2473
|
+
@case ('rectangle') {
|
|
2474
|
+
<ui-form-row>
|
|
2475
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.north')" [required]="true"
|
|
2476
|
+
[ngModel]="north()" (ngModelChange)="north.set(num($event))" [error]="errors().north" [disabled]="readOnly()" inputTestId="maf-north" />
|
|
2477
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.south')" [required]="true"
|
|
2478
|
+
[ngModel]="south()" (ngModelChange)="south.set(num($event))" [error]="errors().south" [disabled]="readOnly()" inputTestId="maf-south" />
|
|
2479
|
+
</ui-form-row>
|
|
2480
|
+
<ui-form-row>
|
|
2481
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.west')" [required]="true"
|
|
2482
|
+
[ngModel]="west()" (ngModelChange)="west.set(num($event))" [error]="errors().west" [disabled]="readOnly()" inputTestId="maf-west" />
|
|
2483
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.east')" [required]="true"
|
|
2484
|
+
[ngModel]="east()" (ngModelChange)="east.set(num($event))" [error]="errors().east" [disabled]="readOnly()" inputTestId="maf-east" />
|
|
2485
|
+
</ui-form-row>
|
|
2486
|
+
}
|
|
2487
|
+
@case ('polygon') {
|
|
2488
|
+
<ui-form-row>
|
|
2489
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.pointLat')"
|
|
2490
|
+
[ngModel]="pointLat()" (ngModelChange)="pointLat.set(num($event))" [error]="errors().pointLat" [disabled]="readOnly()" inputTestId="maf-point-lat" />
|
|
2491
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.pointLng')"
|
|
2492
|
+
[ngModel]="pointLng()" (ngModelChange)="pointLng.set(num($event))" [error]="errors().pointLng" [disabled]="readOnly()" inputTestId="maf-point-lng" />
|
|
2493
|
+
</ui-form-row>
|
|
2494
|
+
<div class="maf-actions">
|
|
2495
|
+
<ui-button variant="secondary" size="sm" [disabled]="readOnly()" (click)="addPoint()">{{ labels.t('map.form.addPoint') }}</ui-button>
|
|
2496
|
+
</div>
|
|
2497
|
+
<div role="group" [attr.aria-label]="labels.t('map.form.pointsLabel')">
|
|
2498
|
+
@if (points().length === 0) {
|
|
2499
|
+
<p class="maf-empty">{{ labels.t('map.form.noPoints') }}</p>
|
|
2500
|
+
} @else {
|
|
2501
|
+
<ul class="maf-points">
|
|
2502
|
+
@for (p of points(); track $index) {
|
|
2503
|
+
<li>
|
|
2504
|
+
<span>{{ labels.t('map.form.pointItem', { n: $index + 1, lat: fmt(p.lat), lng: fmt(p.lng) }) }}</span>
|
|
2505
|
+
<ui-button variant="ghost" size="sm" [disabled]="readOnly()" [ariaLabel]="labels.t('map.form.removePoint', { n: $index + 1 })" (click)="removePoint($index)">
|
|
2506
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg>
|
|
2507
|
+
</ui-button>
|
|
2508
|
+
</li>
|
|
2509
|
+
}
|
|
2510
|
+
</ul>
|
|
2511
|
+
}
|
|
2512
|
+
@if (errors().points; as message) { <p class="maf-error" role="alert">{{ message }}</p> }
|
|
2513
|
+
</div>
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
<div class="maf-actions">
|
|
2518
|
+
<ui-button variant="primary" size="sm" [disabled]="readOnly() || (touched() && hasErrors())" (click)="apply()">{{ labels.t('map.form.apply') }}</ui-button>
|
|
2519
|
+
<ui-button variant="ghost" size="sm" [disabled]="readOnly() || !area()" (click)="clear()">{{ labels.t('map.form.clear') }}</ui-button>
|
|
2520
|
+
</div>
|
|
2521
|
+
<div class="maf-sr" role="status" aria-live="polite" aria-atomic="true">{{ announcement() }}</div>
|
|
2522
|
+
</ui-form-section>
|
|
2523
|
+
`,
|
|
2524
|
+
isInline: true,
|
|
2525
|
+
styles: [":host{display:block}.maf-title{margin:0 0 8px;font-size:12px;font-weight:700;color:#0f172a;text-transform:uppercase;letter-spacing:.04em}.maf-points{list-style:none;margin:0;padding:0;border:1px solid #e2e8f0;border-radius:8px}.maf-points>li{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 4px 4px 12px;font-size:13px;color:#0f172a}.maf-points>li+li{border-top:1px solid #e2e8f0}.maf-empty{margin:0;font-size:13px;color:#475569}.maf-error{margin:0;font-size:12px;color:#b91c1c}.maf-actions{display:flex;flex-wrap:wrap;gap:8px}.maf-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@media(forced-colors:active){.maf-points{border:1px solid CanvasText}.maf-error{color:CanvasText}}\n"],
|
|
2526
|
+
dependencies: [
|
|
2527
|
+
{
|
|
2528
|
+
kind: "ngmodule",
|
|
2529
|
+
type: FormsModule
|
|
2530
|
+
},
|
|
2531
|
+
{
|
|
2532
|
+
kind: "directive",
|
|
2533
|
+
type: i1.NgControlStatus,
|
|
2534
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
2535
|
+
},
|
|
2536
|
+
{
|
|
2537
|
+
kind: "directive",
|
|
2538
|
+
type: i1.RequiredValidator,
|
|
2539
|
+
selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]",
|
|
2540
|
+
inputs: ["required"]
|
|
2541
|
+
},
|
|
2542
|
+
{
|
|
2543
|
+
kind: "directive",
|
|
2544
|
+
type: i1.NgModel,
|
|
2545
|
+
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
2546
|
+
inputs: [
|
|
2547
|
+
"name",
|
|
2548
|
+
"disabled",
|
|
2549
|
+
"ngModel",
|
|
2550
|
+
"ngModelOptions"
|
|
2551
|
+
],
|
|
2552
|
+
outputs: ["ngModelChange"],
|
|
2553
|
+
exportAs: ["ngModel"]
|
|
2554
|
+
},
|
|
2555
|
+
{
|
|
2556
|
+
kind: "component",
|
|
2557
|
+
type: ButtonComponent,
|
|
2558
|
+
selector: "ui-button",
|
|
2559
|
+
inputs: [
|
|
2560
|
+
"variant",
|
|
2561
|
+
"routerLink",
|
|
2562
|
+
"queryParams",
|
|
2563
|
+
"fragment",
|
|
2564
|
+
"state",
|
|
2565
|
+
"href",
|
|
2566
|
+
"target",
|
|
2567
|
+
"rel",
|
|
2568
|
+
"shortLabel",
|
|
2569
|
+
"shortBelow",
|
|
2570
|
+
"color",
|
|
2571
|
+
"active",
|
|
2572
|
+
"size",
|
|
2573
|
+
"type",
|
|
2574
|
+
"disabled",
|
|
2575
|
+
"loading",
|
|
2576
|
+
"fullWidth",
|
|
2577
|
+
"ariaLabel",
|
|
2578
|
+
"ariaExpanded",
|
|
2579
|
+
"ariaPressed",
|
|
2580
|
+
"ariaDescribedBy",
|
|
2581
|
+
"modal-footer-left",
|
|
2582
|
+
"modal-footer-right"
|
|
2583
|
+
]
|
|
2584
|
+
},
|
|
2585
|
+
{
|
|
2586
|
+
kind: "component",
|
|
2587
|
+
type: FormRowComponent,
|
|
2588
|
+
selector: "ui-form-row",
|
|
2589
|
+
inputs: ["cols"]
|
|
2590
|
+
},
|
|
2591
|
+
{
|
|
2592
|
+
kind: "component",
|
|
2593
|
+
type: FormSectionComponent,
|
|
2594
|
+
selector: "ui-form-section",
|
|
2595
|
+
inputs: ["label", "divider"]
|
|
2596
|
+
},
|
|
2597
|
+
{
|
|
2598
|
+
kind: "component",
|
|
2599
|
+
type: SelectComponent,
|
|
2600
|
+
selector: "ui-select",
|
|
2601
|
+
inputs: [
|
|
2602
|
+
"label",
|
|
2603
|
+
"ariaLabel",
|
|
2604
|
+
"labelHidden",
|
|
2605
|
+
"inputName",
|
|
2606
|
+
"placeholder",
|
|
2607
|
+
"options",
|
|
2608
|
+
"valueType",
|
|
2609
|
+
"required",
|
|
2610
|
+
"hint",
|
|
2611
|
+
"ariaDescribedBy",
|
|
2612
|
+
"error",
|
|
2613
|
+
"showErrors",
|
|
2614
|
+
"size",
|
|
2615
|
+
"disabled"
|
|
2616
|
+
],
|
|
2617
|
+
outputs: ["invalidChange", "valueChange"]
|
|
2618
|
+
},
|
|
2619
|
+
{
|
|
2620
|
+
kind: "component",
|
|
2621
|
+
type: TextInputComponent,
|
|
2622
|
+
selector: "ui-text-input",
|
|
2623
|
+
inputs: [
|
|
2624
|
+
"label",
|
|
2625
|
+
"ariaLabel",
|
|
2626
|
+
"inputTestId",
|
|
2627
|
+
"inputName",
|
|
2628
|
+
"placeholder",
|
|
2629
|
+
"prefix",
|
|
2630
|
+
"leadingIcon",
|
|
2631
|
+
"revealable",
|
|
2632
|
+
"passwordRequirements",
|
|
2633
|
+
"passwordRules",
|
|
2634
|
+
"type",
|
|
2635
|
+
"maxlength",
|
|
2636
|
+
"required",
|
|
2637
|
+
"autocomplete",
|
|
2638
|
+
"inputmode",
|
|
2639
|
+
"readonly",
|
|
2640
|
+
"hint",
|
|
2641
|
+
"ariaDescribedBy",
|
|
2642
|
+
"error",
|
|
2643
|
+
"phoneFormat",
|
|
2644
|
+
"min",
|
|
2645
|
+
"max",
|
|
2646
|
+
"maxDecimals",
|
|
2647
|
+
"step",
|
|
2648
|
+
"valueType",
|
|
2649
|
+
"formatter",
|
|
2650
|
+
"integer",
|
|
2651
|
+
"showErrors",
|
|
2652
|
+
"disabled"
|
|
2653
|
+
],
|
|
2654
|
+
outputs: [
|
|
2655
|
+
"valueChange",
|
|
2656
|
+
"focused",
|
|
2657
|
+
"blurred",
|
|
2658
|
+
"invalidChange"
|
|
2659
|
+
]
|
|
2660
|
+
}
|
|
2661
|
+
],
|
|
2662
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
2663
|
+
});
|
|
2664
|
+
}
|
|
2665
|
+
};
|
|
2666
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2667
|
+
minVersion: "12.0.0",
|
|
2668
|
+
version: "22.2.2",
|
|
2669
|
+
ngImport: i0,
|
|
2670
|
+
type: MapAreaFormComponent,
|
|
2671
|
+
decorators: [{
|
|
2672
|
+
type: Component,
|
|
2673
|
+
args: [{
|
|
2674
|
+
selector: "ui-map-area-form",
|
|
2675
|
+
standalone: true,
|
|
2676
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2677
|
+
imports: [
|
|
2678
|
+
FormsModule,
|
|
2679
|
+
ButtonComponent,
|
|
2680
|
+
FormRowComponent,
|
|
2681
|
+
FormSectionComponent,
|
|
2682
|
+
SelectComponent,
|
|
2683
|
+
TextInputComponent
|
|
2684
|
+
],
|
|
2685
|
+
template: `
|
|
2686
|
+
<ui-form-section>
|
|
2687
|
+
<p class="maf-title">{{ labels.t('map.form.title') }}</p>
|
|
2688
|
+
<ui-select [label]="labels.t('map.form.shape')" [options]="shapeOptions()" [ngModel]="shape()" (ngModelChange)="setShape($event)" [disabled]="readOnly()" />
|
|
2689
|
+
|
|
2690
|
+
@switch (shape()) {
|
|
2691
|
+
@case ('circle') {
|
|
2692
|
+
<ui-form-row>
|
|
2693
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.centerLat')" [required]="true"
|
|
2694
|
+
[ngModel]="lat()" (ngModelChange)="lat.set(num($event))" [error]="errors().lat" [disabled]="readOnly()" inputTestId="maf-lat" />
|
|
2695
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.centerLng')" [required]="true"
|
|
2696
|
+
[ngModel]="lng()" (ngModelChange)="lng.set(num($event))" [error]="errors().lng" [disabled]="readOnly()" inputTestId="maf-lng" />
|
|
2697
|
+
</ui-form-row>
|
|
2698
|
+
<ui-form-row>
|
|
2699
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.radius')" [required]="true"
|
|
2700
|
+
[ngModel]="radius()" (ngModelChange)="onRadius(num($event))" [error]="errors().radius" [disabled]="readOnly()" inputTestId="maf-radius" />
|
|
2701
|
+
<ui-select [label]="labels.t('map.form.radiusUnit')" [options]="unitOptions()" [ngModel]="unit()" (ngModelChange)="setUnit($event)" [disabled]="readOnly()" />
|
|
2702
|
+
</ui-form-row>
|
|
2703
|
+
}
|
|
2704
|
+
@case ('rectangle') {
|
|
2705
|
+
<ui-form-row>
|
|
2706
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.north')" [required]="true"
|
|
2707
|
+
[ngModel]="north()" (ngModelChange)="north.set(num($event))" [error]="errors().north" [disabled]="readOnly()" inputTestId="maf-north" />
|
|
2708
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.south')" [required]="true"
|
|
2709
|
+
[ngModel]="south()" (ngModelChange)="south.set(num($event))" [error]="errors().south" [disabled]="readOnly()" inputTestId="maf-south" />
|
|
2710
|
+
</ui-form-row>
|
|
2711
|
+
<ui-form-row>
|
|
2712
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.west')" [required]="true"
|
|
2713
|
+
[ngModel]="west()" (ngModelChange)="west.set(num($event))" [error]="errors().west" [disabled]="readOnly()" inputTestId="maf-west" />
|
|
2714
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.east')" [required]="true"
|
|
2715
|
+
[ngModel]="east()" (ngModelChange)="east.set(num($event))" [error]="errors().east" [disabled]="readOnly()" inputTestId="maf-east" />
|
|
2716
|
+
</ui-form-row>
|
|
2717
|
+
}
|
|
2718
|
+
@case ('polygon') {
|
|
2719
|
+
<ui-form-row>
|
|
2720
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.pointLat')"
|
|
2721
|
+
[ngModel]="pointLat()" (ngModelChange)="pointLat.set(num($event))" [error]="errors().pointLat" [disabled]="readOnly()" inputTestId="maf-point-lat" />
|
|
2722
|
+
<ui-text-input type="number" valueType="number" inputmode="decimal" [label]="labels.t('map.form.pointLng')"
|
|
2723
|
+
[ngModel]="pointLng()" (ngModelChange)="pointLng.set(num($event))" [error]="errors().pointLng" [disabled]="readOnly()" inputTestId="maf-point-lng" />
|
|
2724
|
+
</ui-form-row>
|
|
2725
|
+
<div class="maf-actions">
|
|
2726
|
+
<ui-button variant="secondary" size="sm" [disabled]="readOnly()" (click)="addPoint()">{{ labels.t('map.form.addPoint') }}</ui-button>
|
|
2727
|
+
</div>
|
|
2728
|
+
<div role="group" [attr.aria-label]="labels.t('map.form.pointsLabel')">
|
|
2729
|
+
@if (points().length === 0) {
|
|
2730
|
+
<p class="maf-empty">{{ labels.t('map.form.noPoints') }}</p>
|
|
2731
|
+
} @else {
|
|
2732
|
+
<ul class="maf-points">
|
|
2733
|
+
@for (p of points(); track $index) {
|
|
2734
|
+
<li>
|
|
2735
|
+
<span>{{ labels.t('map.form.pointItem', { n: $index + 1, lat: fmt(p.lat), lng: fmt(p.lng) }) }}</span>
|
|
2736
|
+
<ui-button variant="ghost" size="sm" [disabled]="readOnly()" [ariaLabel]="labels.t('map.form.removePoint', { n: $index + 1 })" (click)="removePoint($index)">
|
|
2737
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true" focusable="false"><path d="M6 6l12 12M18 6 6 18"/></svg>
|
|
2738
|
+
</ui-button>
|
|
2739
|
+
</li>
|
|
2740
|
+
}
|
|
2741
|
+
</ul>
|
|
2742
|
+
}
|
|
2743
|
+
@if (errors().points; as message) { <p class="maf-error" role="alert">{{ message }}</p> }
|
|
2744
|
+
</div>
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
<div class="maf-actions">
|
|
2749
|
+
<ui-button variant="primary" size="sm" [disabled]="readOnly() || (touched() && hasErrors())" (click)="apply()">{{ labels.t('map.form.apply') }}</ui-button>
|
|
2750
|
+
<ui-button variant="ghost" size="sm" [disabled]="readOnly() || !area()" (click)="clear()">{{ labels.t('map.form.clear') }}</ui-button>
|
|
2751
|
+
</div>
|
|
2752
|
+
<div class="maf-sr" role="status" aria-live="polite" aria-atomic="true">{{ announcement() }}</div>
|
|
2753
|
+
</ui-form-section>
|
|
2754
|
+
`,
|
|
2755
|
+
styles: [":host{display:block}.maf-title{margin:0 0 8px;font-size:12px;font-weight:700;color:#0f172a;text-transform:uppercase;letter-spacing:.04em}.maf-points{list-style:none;margin:0;padding:0;border:1px solid #e2e8f0;border-radius:8px}.maf-points>li{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 4px 4px 12px;font-size:13px;color:#0f172a}.maf-points>li+li{border-top:1px solid #e2e8f0}.maf-empty{margin:0;font-size:13px;color:#475569}.maf-error{margin:0;font-size:12px;color:#b91c1c}.maf-actions{display:flex;flex-wrap:wrap;gap:8px}.maf-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@media(forced-colors:active){.maf-points{border:1px solid CanvasText}.maf-error{color:CanvasText}}\n"]
|
|
2756
|
+
}]
|
|
2757
|
+
}],
|
|
2758
|
+
ctorParameters: () => [],
|
|
2759
|
+
propDecorators: {
|
|
2760
|
+
area: [{
|
|
2761
|
+
type: i0.Input,
|
|
2762
|
+
args: [{
|
|
2763
|
+
isSignal: true,
|
|
2764
|
+
alias: "area",
|
|
2765
|
+
required: false
|
|
2766
|
+
}]
|
|
2767
|
+
}, {
|
|
2768
|
+
type: i0.Output,
|
|
2769
|
+
args: ["areaChange"]
|
|
2770
|
+
}],
|
|
2771
|
+
shapes: [{
|
|
2772
|
+
type: i0.Input,
|
|
2773
|
+
args: [{
|
|
2774
|
+
isSignal: true,
|
|
2775
|
+
alias: "shapes",
|
|
2776
|
+
required: false
|
|
2777
|
+
}]
|
|
2778
|
+
}],
|
|
2779
|
+
defaultUnit: [{
|
|
2780
|
+
type: i0.Input,
|
|
2781
|
+
args: [{
|
|
2782
|
+
isSignal: true,
|
|
2783
|
+
alias: "defaultUnit",
|
|
2784
|
+
required: false
|
|
2785
|
+
}]
|
|
2786
|
+
}],
|
|
2787
|
+
readOnly: [{
|
|
2788
|
+
type: i0.Input,
|
|
2789
|
+
args: [{
|
|
2790
|
+
isSignal: true,
|
|
2791
|
+
alias: "readOnly",
|
|
2792
|
+
required: false
|
|
2793
|
+
}]
|
|
2794
|
+
}]
|
|
2795
|
+
}
|
|
2796
|
+
});
|
|
2797
|
+
export { EARTH_RADIUS_METERS, MapAreaFormComponent, MapComponent, UI_MAP_ENGINE_LOADER, UiMapInfoDirective, areaBounds, areaContains, areaRing, boundsContains, boundsIntersect, boundsOf, boundsToPolygon, circleToBounds, clampLat, clampLng, clusterMarkers, haversineMeters, isSimplePolygon, isValidArea, isValidLat, isValidLatLng, isValidLng, pointInPolygon, projectToPixels, sameArea, tileSourceState };
|
|
2798
|
+
|
|
2799
|
+
//# sourceMappingURL=forgeroute-ui-map.mjs.map
|