@m3ui-vue/m3ui-vue 1.6.1 → 1.6.2
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/dist/API.md +1 -1
- package/dist/MColorPickerModal-NtkihoK6.js +577 -0
- package/dist/MColorPickerModal-NtkihoK6.js.map +1 -0
- package/dist/MTooltip-CK39Zon4.js +183 -0
- package/dist/MTooltip-CK39Zon4.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/draw.js +26 -25
- package/dist/draw.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +1157 -1156
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +638 -632
- package/dist/map.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/MAudioRecorder.vue +9 -9
- package/src/components/MMapBaseLayers.vue +29 -28
- package/src/components/MMapMeasure.vue +1 -1
- package/dist/MTooltip-Dd5g2zhh.js +0 -754
- package/dist/MTooltip-Dd5g2zhh.js.map +0 -1
package/dist/map.js
CHANGED
|
@@ -6,48 +6,49 @@ import { o as c } from "./_storageKeys-C4W_4xK4.js";
|
|
|
6
6
|
import { t as l } from "./useThemeTokens-DyAdPQB0.js";
|
|
7
7
|
import { t as u } from "./MTextField-CNH-byir.js";
|
|
8
8
|
import { t as d } from "./MSlider-BIkA6DiE.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { t as y } from "./
|
|
12
|
-
import {
|
|
9
|
+
import { t as f } from "./MTooltip-CK39Zon4.js";
|
|
10
|
+
import { n as p, r as m } from "./_popupPosition-nL8SVKPK.js";
|
|
11
|
+
import { a as h, l as g, r as _, s as v, t as y } from "./MListItem-D2cNUyzP.js";
|
|
12
|
+
import { t as b } from "./MSpinner-DZkXZJpc.js";
|
|
13
|
+
import { Fragment as x, Teleport as S, Transition as C, computed as w, createBlock as T, createCommentVNode as E, createElementBlock as D, createElementVNode as O, createSlots as k, createTextVNode as A, createVNode as j, defineComponent as M, getCurrentInstance as N, inject as P, markRaw as ee, mergeProps as F, nextTick as I, normalizeClass as L, normalizeStyle as te, onBeforeUnmount as ne, onMounted as R, onUnmounted as re, openBlock as z, provide as B, reactive as ie, ref as V, renderList as H, renderSlot as U, shallowRef as W, toDisplayString as G, toValue as K, unref as q, useId as ae, useSlots as J, watch as Y, watchEffect as oe, withCtx as X, withModifiers as se } from "vue";
|
|
13
14
|
// src/composables/useMap.ts
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
|
|
15
|
+
var ce;
|
|
16
|
+
function le(e) {
|
|
17
|
+
ce = e;
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
19
|
+
function ue() {
|
|
20
|
+
return ce;
|
|
20
21
|
}
|
|
21
|
-
var
|
|
22
|
-
function
|
|
23
|
-
let t =
|
|
22
|
+
var de = Symbol("m3-map");
|
|
23
|
+
function fe(e) {
|
|
24
|
+
let t = P(de, null);
|
|
24
25
|
if (t || e === void 0) return t;
|
|
25
|
-
let n =
|
|
26
|
-
let t =
|
|
26
|
+
let n = w(() => {
|
|
27
|
+
let t = K(e);
|
|
27
28
|
return t ? "context" in t ? t.context : t : void 0;
|
|
28
29
|
}), r = {
|
|
29
|
-
map:
|
|
30
|
-
maplibre:
|
|
31
|
-
styleVersion:
|
|
32
|
-
model:
|
|
30
|
+
map: w(() => n.value?.map.value),
|
|
31
|
+
maplibre: w(() => n.value?.maplibre.value),
|
|
32
|
+
styleVersion: w(() => n.value?.styleVersion.value ?? 0),
|
|
33
|
+
model: w(() => n.value?.model.value),
|
|
33
34
|
layerState: new Proxy({
|
|
34
35
|
visible: {},
|
|
35
36
|
opacity: {}
|
|
36
37
|
}, { get: (e, t) => Reflect.get(n.value?.layerState ?? e, t) }),
|
|
37
|
-
activeTool:
|
|
38
|
+
activeTool: w({
|
|
38
39
|
get: () => n.value?.activeTool.value ?? null,
|
|
39
40
|
set: (e) => {
|
|
40
41
|
n.value && (n.value.activeTool.value = e);
|
|
41
42
|
}
|
|
42
43
|
})
|
|
43
44
|
};
|
|
44
|
-
return
|
|
45
|
+
return B(de, r), r;
|
|
45
46
|
}
|
|
46
47
|
function Z(e) {
|
|
47
|
-
let t =
|
|
48
|
+
let t = fe(e);
|
|
48
49
|
if (!t) throw Error("useMap() must be called in a component inside <MMap>, or be given one");
|
|
49
50
|
let n = [];
|
|
50
|
-
|
|
51
|
+
N() && ne(() => n.splice(0).forEach((e) => e()));
|
|
51
52
|
function r(e) {
|
|
52
53
|
let r = () => {
|
|
53
54
|
if (t.map.value && t.maplibre.value) return e(t.map.value, t.maplibre.value);
|
|
@@ -55,8 +56,8 @@ function Z(e) {
|
|
|
55
56
|
n && t.maplibre.value && (r(), e(n, t.maplibre.value));
|
|
56
57
|
});
|
|
57
58
|
n.push(r);
|
|
58
|
-
}, i =
|
|
59
|
-
i && !i.isMounted ?
|
|
59
|
+
}, i = N();
|
|
60
|
+
i && !i.isMounted ? R(r) : r();
|
|
60
61
|
}
|
|
61
62
|
function i(e, t) {
|
|
62
63
|
r((r) => {
|
|
@@ -69,9 +70,9 @@ function Z(e) {
|
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
return {
|
|
72
|
-
map:
|
|
73
|
-
maplibre:
|
|
74
|
-
styleVersion:
|
|
73
|
+
map: w(() => t.map.value),
|
|
74
|
+
maplibre: w(() => t.maplibre.value),
|
|
75
|
+
styleVersion: w(() => t.styleVersion.value),
|
|
75
76
|
activeTool: t.activeTool,
|
|
76
77
|
onReady: r,
|
|
77
78
|
on: i,
|
|
@@ -79,10 +80,10 @@ function Z(e) {
|
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
82
|
// src/components/MMapControl.vue?vue&type=script&setup=true&lang.ts
|
|
82
|
-
var
|
|
83
|
+
var pe = { class: "hidden" }, me = {
|
|
83
84
|
key: 0,
|
|
84
85
|
class: "m3-map-control-panel-in"
|
|
85
|
-
},
|
|
86
|
+
}, he = /* @__PURE__ */ M({
|
|
86
87
|
inheritAttrs: !1,
|
|
87
88
|
__name: "MMapControl",
|
|
88
89
|
props: {
|
|
@@ -102,11 +103,11 @@ var fe = { class: "hidden" }, pe = {
|
|
|
102
103
|
},
|
|
103
104
|
emits: ["update:expanded"],
|
|
104
105
|
setup(e, { emit: a }) {
|
|
105
|
-
let s = e, c = a, l = J(), u =
|
|
106
|
+
let s = e, c = a, l = J(), u = V(), { onReady: d } = Z(), f = V(s.expanded);
|
|
106
107
|
Y(() => s.expanded, (e) => {
|
|
107
108
|
f.value = e;
|
|
108
109
|
});
|
|
109
|
-
let p =
|
|
110
|
+
let p = w(() => f.value && !!l.panel);
|
|
110
111
|
function m(e) {
|
|
111
112
|
e !== f.value && (f.value = e, c("update:expanded", e));
|
|
112
113
|
}
|
|
@@ -120,11 +121,11 @@ var fe = { class: "hidden" }, pe = {
|
|
|
120
121
|
let y = null, b = null, x = [], S = {
|
|
121
122
|
w: 0,
|
|
122
123
|
h: 0
|
|
123
|
-
},
|
|
124
|
+
}, C = {
|
|
124
125
|
w: 0,
|
|
125
126
|
h: 0
|
|
126
127
|
}, T = null;
|
|
127
|
-
function
|
|
128
|
+
function E() {
|
|
128
129
|
return {
|
|
129
130
|
w: u.value.offsetWidth,
|
|
130
131
|
h: u.value.offsetHeight
|
|
@@ -133,11 +134,11 @@ var fe = { class: "hidden" }, pe = {
|
|
|
133
134
|
function k() {
|
|
134
135
|
let e = u.value;
|
|
135
136
|
if (!e || b) return;
|
|
136
|
-
let t =
|
|
137
|
+
let t = E();
|
|
137
138
|
y && (t.w !== y.w || t.h !== y.h) && s.animate && !o() && A(e, y, t), y = t;
|
|
138
139
|
}
|
|
139
140
|
function A(e, n, a) {
|
|
140
|
-
if (S = n,
|
|
141
|
+
if (S = n, C = a, x = r(0, 1, 0, t.standard.defaultSpatial, .002), e.style.overflow = "hidden", b = i(e, x, (e) => ({
|
|
141
142
|
width: `${n.w + (a.w - n.w) * e}px`,
|
|
142
143
|
height: `${n.h + (a.h - n.h) * e}px`
|
|
143
144
|
})), !b) return j(e);
|
|
@@ -145,14 +146,14 @@ var fe = { class: "hidden" }, pe = {
|
|
|
145
146
|
}
|
|
146
147
|
function j(e) {
|
|
147
148
|
b?.cancel(), b = null, e.style.overflow = "";
|
|
148
|
-
let t =
|
|
149
|
-
t.w !==
|
|
149
|
+
let t = E();
|
|
150
|
+
t.w !== C.w || t.h !== C.h ? (y = C, k()) : y = t;
|
|
150
151
|
}
|
|
151
152
|
function M() {
|
|
152
153
|
if (!u.value || !b) return;
|
|
153
154
|
let e = n(x, b.currentTime), t = {
|
|
154
|
-
w: S.w + (
|
|
155
|
-
h: S.h + (
|
|
155
|
+
w: S.w + (C.w - S.w) * e,
|
|
156
|
+
h: S.h + (C.h - S.h) * e
|
|
156
157
|
};
|
|
157
158
|
b.onfinish = null, b.cancel(), b = null, y = t, k();
|
|
158
159
|
}
|
|
@@ -165,28 +166,28 @@ var fe = { class: "hidden" }, pe = {
|
|
|
165
166
|
N = e, u.value && e.addControl(P, s.position);
|
|
166
167
|
}), Y(() => s.position, (e) => {
|
|
167
168
|
N && u.value && (N.removeControl(P), N.addControl(P, e));
|
|
168
|
-
}),
|
|
169
|
+
}), R(() => {
|
|
169
170
|
document.addEventListener("pointerdown", _, !0), typeof ResizeObserver < "u" && u.value && (T = new ResizeObserver(k), T.observe(u.value));
|
|
170
|
-
}),
|
|
171
|
+
}), ne(() => {
|
|
171
172
|
document.removeEventListener("pointerdown", _, !0), T?.disconnect(), b?.cancel(), N?.hasControl(P) && N.removeControl(P);
|
|
172
|
-
}), (t, n) => (
|
|
173
|
+
}), (t, n) => (z(), D("div", pe, [O("div", F({
|
|
173
174
|
ref_key: "el",
|
|
174
175
|
ref: u,
|
|
175
176
|
class: ["maplibregl-ctrl m3-map-control", p.value ? "m3-map-control-panel" : e.group ? "maplibregl-ctrl-group" : ""]
|
|
176
|
-
}, t.$attrs, { onKeydown: v }), [p.value ? (
|
|
177
|
+
}, t.$attrs, { onKeydown: v }), [p.value ? (z(), D("div", me, [U(t.$slots, "panel", { close: g })])) : U(t.$slots, "default", {
|
|
177
178
|
expanded: f.value,
|
|
178
179
|
toggle: h
|
|
179
180
|
}, void 0, void 0, 1)], 16)]));
|
|
180
181
|
}
|
|
181
|
-
}),
|
|
182
|
+
}), ge = [
|
|
182
183
|
"title",
|
|
183
184
|
"aria-label",
|
|
184
185
|
"aria-expanded"
|
|
185
|
-
],
|
|
186
|
+
], _e = ["innerHTML"], ve = /* @__PURE__ */ M({
|
|
186
187
|
__name: "_MMapAttribution",
|
|
187
188
|
props: { position: {} },
|
|
188
189
|
setup(t) {
|
|
189
|
-
let n = t, r = s(), { on: i, onReady: a } = Z(), o =
|
|
190
|
+
let n = t, r = s(), { on: i, onReady: a } = Z(), o = V([]), c = V(!0), l = V(0), u;
|
|
190
191
|
function d() {
|
|
191
192
|
if (!u) return;
|
|
192
193
|
let e = u.getStyle?.();
|
|
@@ -205,35 +206,35 @@ var fe = { class: "hidden" }, pe = {
|
|
|
205
206
|
}), i("styledata", d), i("sourcedata", d), i("resize", d), i("dragstart", () => {
|
|
206
207
|
c.value = !1;
|
|
207
208
|
});
|
|
208
|
-
let f =
|
|
209
|
-
return (n, i) => f.value ? (
|
|
209
|
+
let f = w(() => o.value.join(" ")), p = w(() => n.position.endsWith("right"));
|
|
210
|
+
return (n, i) => f.value ? (z(), T(he, {
|
|
210
211
|
key: 0,
|
|
211
212
|
position: t.position,
|
|
212
213
|
group: !1,
|
|
213
214
|
class: L(["m3-map-attrib", c.value ? "m3-map-attrib-open" : ""])
|
|
214
215
|
}, {
|
|
215
|
-
default: X(() => [
|
|
216
|
+
default: X(() => [O("div", {
|
|
216
217
|
class: L(["m3-map-attrib-row", p.value ? "flex-row-reverse" : ""]),
|
|
217
|
-
style:
|
|
218
|
-
}, [
|
|
218
|
+
style: te(l.value ? { maxWidth: `${l.value}px` } : void 0)
|
|
219
|
+
}, [O("button", {
|
|
219
220
|
type: "button",
|
|
220
221
|
class: "m3-map-attrib-button",
|
|
221
222
|
title: q(r).mapToggleAttribution,
|
|
222
223
|
"aria-label": q(r).mapToggleAttribution,
|
|
223
224
|
"aria-expanded": c.value,
|
|
224
225
|
onClick: i[0] ||= (e) => c.value = !c.value
|
|
225
|
-
}, [
|
|
226
|
+
}, [j(e, {
|
|
226
227
|
name: "info",
|
|
227
228
|
size: 20
|
|
228
|
-
})], 8,
|
|
229
|
+
})], 8, ge), c.value ? (z(), D("div", {
|
|
229
230
|
key: 0,
|
|
230
231
|
class: L(["m3-map-attrib-text", p.value ? "pl-3.5" : "pr-3.5"]),
|
|
231
232
|
innerHTML: f.value
|
|
232
|
-
}, null, 10,
|
|
233
|
+
}, null, 10, _e)) : E("", !0)], 6)]),
|
|
233
234
|
_: 1
|
|
234
|
-
}, 8, ["position", "class"])) :
|
|
235
|
+
}, 8, ["position", "class"])) : E("", !0);
|
|
235
236
|
}
|
|
236
|
-
}),
|
|
237
|
+
}), ye = {
|
|
237
238
|
fill: ["fill-opacity"],
|
|
238
239
|
line: ["line-opacity"],
|
|
239
240
|
circle: ["circle-opacity", "circle-stroke-opacity"],
|
|
@@ -242,27 +243,27 @@ var fe = { class: "hidden" }, pe = {
|
|
|
242
243
|
heatmap: ["heatmap-opacity"],
|
|
243
244
|
"fill-extrusion": ["fill-extrusion-opacity"]
|
|
244
245
|
};
|
|
245
|
-
function
|
|
246
|
-
return
|
|
246
|
+
function be() {
|
|
247
|
+
return ie({
|
|
247
248
|
visible: {},
|
|
248
249
|
opacity: {}
|
|
249
250
|
});
|
|
250
251
|
}
|
|
251
|
-
function
|
|
252
|
+
function xe(e, t, n) {
|
|
252
253
|
let r = {}, i = {};
|
|
253
254
|
for (let e of n?.layers ?? []) {
|
|
254
255
|
let n = t.getLayer(e.id);
|
|
255
256
|
if (!n) continue;
|
|
256
257
|
r[e.id] = t.getLayoutProperty(e.id, "visibility") !== "none";
|
|
257
|
-
let a =
|
|
258
|
+
let a = ye[n.type]?.[0], o = a ? t.getPaintProperty(e.id, a) : void 0;
|
|
258
259
|
i[e.id] = typeof o == "number" ? o : 1;
|
|
259
260
|
}
|
|
260
261
|
e.visible = r, e.opacity = i;
|
|
261
262
|
}
|
|
262
|
-
function
|
|
263
|
-
let t =
|
|
263
|
+
function Q(e) {
|
|
264
|
+
let t = fe(e);
|
|
264
265
|
if (!t) throw Error("useMapLayers() must be called in a component inside <MMap>, or be given one");
|
|
265
|
-
let { map: n, model: r, layerState: i } = t, a =
|
|
266
|
+
let { map: n, model: r, layerState: i } = t, a = w(() => r.value?.layers ?? []), o = w(() => new Map(a.value.map((e) => [e.id, e])));
|
|
266
267
|
function s(e) {
|
|
267
268
|
return i.visible[e] ?? !0;
|
|
268
269
|
}
|
|
@@ -279,7 +280,7 @@ function xe(e) {
|
|
|
279
280
|
}
|
|
280
281
|
function d(e, t) {
|
|
281
282
|
let r = n.value, a = r?.getLayer(e);
|
|
282
|
-
if (a) for (let n of
|
|
283
|
+
if (a) for (let n of ye[a.type] ?? []) r.setPaintProperty(e, n, t);
|
|
283
284
|
i.opacity[e] = t;
|
|
284
285
|
for (let n of o.value.get(e)?.children ?? []) d(n, t);
|
|
285
286
|
}
|
|
@@ -293,12 +294,12 @@ function xe(e) {
|
|
|
293
294
|
function m(e, t) {
|
|
294
295
|
for (let n of f(e)) c(n.id, t);
|
|
295
296
|
}
|
|
296
|
-
let h =
|
|
297
|
+
let h = w(() => a.value.filter((e) => e.base)), g = w(() => h.value.find((e) => s(e.id))?.id ?? null);
|
|
297
298
|
function _(e) {
|
|
298
299
|
for (let t of h.value) c(t.id, t.id === e);
|
|
299
300
|
}
|
|
300
301
|
return {
|
|
301
|
-
model:
|
|
302
|
+
model: w(() => r.value),
|
|
302
303
|
layers: a,
|
|
303
304
|
isVisible: s,
|
|
304
305
|
setVisible: c,
|
|
@@ -314,13 +315,13 @@ function xe(e) {
|
|
|
314
315
|
};
|
|
315
316
|
}
|
|
316
317
|
// src/composables/_mapStyle.ts
|
|
317
|
-
function
|
|
318
|
+
function Se(e) {
|
|
318
319
|
return {
|
|
319
320
|
sources: new Set(Object.keys(e?.sources ?? {})),
|
|
320
321
|
layers: new Set((e?.layers ?? []).map((e) => e.id))
|
|
321
322
|
};
|
|
322
323
|
}
|
|
323
|
-
function
|
|
324
|
+
function Ce(e, t, n, r = () => !0) {
|
|
324
325
|
if (!e) return t;
|
|
325
326
|
let i = new Set(t.layers.map((e) => e.id)), a = e.layers.filter((e) => !n.layers.has(e.id) && !i.has(e.id) && r(e)), o = { ...t.sources };
|
|
326
327
|
for (let [t, r] of Object.entries(e.sources)) !n.sources.has(t) && !(t in o) && (o[t] = r);
|
|
@@ -331,7 +332,7 @@ function Se(e, t, n, r = () => !0) {
|
|
|
331
332
|
};
|
|
332
333
|
}
|
|
333
334
|
// src/components/MMap.vue?vue&type=script&setup=true&lang.ts
|
|
334
|
-
var
|
|
335
|
+
var $ = 600, we = /* @__PURE__ */ M({
|
|
335
336
|
__name: "MMap",
|
|
336
337
|
props: {
|
|
337
338
|
mapStyle: {},
|
|
@@ -381,17 +382,17 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
381
382
|
"update:pitch"
|
|
382
383
|
],
|
|
383
384
|
setup(e, { expose: t, emit: n }) {
|
|
384
|
-
let r = e, i = n, a =
|
|
385
|
+
let r = e, i = n, a = V(), o = V(), l = W(), u = W(), d = V(0), f, p = W(), m = be(), h = {
|
|
385
386
|
map: l,
|
|
386
387
|
maplibre: u,
|
|
387
388
|
styleVersion: d,
|
|
388
389
|
model: p,
|
|
389
390
|
layerState: m,
|
|
390
|
-
activeTool:
|
|
391
|
+
activeTool: V(null)
|
|
391
392
|
};
|
|
392
|
-
|
|
393
|
+
B(de, h);
|
|
393
394
|
function g(e) {
|
|
394
|
-
p.value = r.adapter ? r.adapter(e.getStyle(), { styleUrl: typeof r.mapStyle == "string" ? r.mapStyle : void 0 }) : void 0,
|
|
395
|
+
p.value = r.adapter ? r.adapter(e.getStyle(), { styleUrl: typeof r.mapStyle == "string" ? r.mapStyle : void 0 }) : void 0, xe(m, e, p.value);
|
|
395
396
|
}
|
|
396
397
|
let _ = s(), v = () => typeof r.persist == "string" ? r.persist : r.persist ? c("m3-map-view") : null;
|
|
397
398
|
function y() {
|
|
@@ -436,18 +437,18 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
436
437
|
unit: "metric"
|
|
437
438
|
})
|
|
438
439
|
}
|
|
439
|
-
},
|
|
440
|
-
function
|
|
440
|
+
}, S = /* @__PURE__ */ new Map();
|
|
441
|
+
function w(e) {
|
|
441
442
|
let t = l.value, n = u.value;
|
|
442
443
|
if (!t || !n) return;
|
|
443
|
-
let i =
|
|
444
|
-
i && (t.removeControl(i),
|
|
444
|
+
let i = S.get(e);
|
|
445
|
+
i && (t.removeControl(i), S.delete(e));
|
|
445
446
|
let a = r[e];
|
|
446
447
|
if (!a) return;
|
|
447
448
|
let o = x[e].create(n);
|
|
448
|
-
t.addControl(o, a === !0 ? x[e].corner : a),
|
|
449
|
+
t.addControl(o, a === !0 ? x[e].corner : a), S.set(e, o);
|
|
449
450
|
}
|
|
450
|
-
for (let e of Object.keys(x)) Y(() => r[e], () =>
|
|
451
|
+
for (let e of Object.keys(x)) Y(() => r[e], () => w(e));
|
|
451
452
|
function k() {
|
|
452
453
|
return {
|
|
453
454
|
"AttributionControl.ToggleAttribution": _.mapToggleAttribution,
|
|
@@ -467,43 +468,43 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
467
468
|
"CooperativeGesturesHandler.MobileHelpText": _.mapTwoFingers
|
|
468
469
|
};
|
|
469
470
|
}
|
|
470
|
-
let
|
|
471
|
-
function
|
|
471
|
+
let A = V(null), M, N;
|
|
472
|
+
function P(e) {
|
|
472
473
|
let t = e.getAttribute("title");
|
|
473
474
|
t && e.closest(".maplibregl-ctrl") && (e.setAttribute("data-m3-tip", t), e.hasAttribute("aria-label") || e.setAttribute("aria-label", t), e.removeAttribute("title"));
|
|
474
475
|
}
|
|
475
|
-
function
|
|
476
|
+
function F(e) {
|
|
476
477
|
let t = e.getAttribute("data-m3-tip"), n = a.value?.getBoundingClientRect();
|
|
477
478
|
if (!t || !n) return;
|
|
478
479
|
let r = e.getBoundingClientRect(), i = r.left + r.width / 2 > n.left + n.width / 2;
|
|
479
|
-
|
|
480
|
+
A.value = {
|
|
480
481
|
text: t,
|
|
481
482
|
left: i,
|
|
482
483
|
x: (i ? r.left - 8 : r.right + 8) - n.left,
|
|
483
484
|
y: r.top + r.height / 2 - n.top
|
|
484
485
|
};
|
|
485
486
|
}
|
|
486
|
-
function
|
|
487
|
-
clearTimeout(M),
|
|
487
|
+
function I() {
|
|
488
|
+
clearTimeout(M), A.value = null;
|
|
488
489
|
}
|
|
489
|
-
let
|
|
490
|
-
function
|
|
491
|
-
let t =
|
|
492
|
-
t && e.pointerType !== "touch" && (clearTimeout(M), M = setTimeout(() =>
|
|
490
|
+
let ie = (e) => e.target?.closest?.(".maplibregl-ctrl [data-m3-tip]") ?? null;
|
|
491
|
+
function H(e) {
|
|
492
|
+
let t = ie(e);
|
|
493
|
+
t && e.pointerType !== "touch" && (clearTimeout(M), M = setTimeout(() => F(t), $));
|
|
493
494
|
}
|
|
494
|
-
function
|
|
495
|
-
let t =
|
|
496
|
-
t && !t.contains(e.relatedTarget) &&
|
|
495
|
+
function K(e) {
|
|
496
|
+
let t = ie(e);
|
|
497
|
+
t && !t.contains(e.relatedTarget) && I();
|
|
497
498
|
}
|
|
498
|
-
function
|
|
499
|
-
let t =
|
|
500
|
-
t?.matches(":focus-visible") &&
|
|
499
|
+
function q(e) {
|
|
500
|
+
let t = ie(e);
|
|
501
|
+
t?.matches(":focus-visible") && F(t);
|
|
501
502
|
}
|
|
502
|
-
|
|
503
|
+
R(() => {
|
|
503
504
|
let e = a.value;
|
|
504
|
-
e && (e.querySelectorAll("[title]").forEach(
|
|
505
|
-
for (let t of e) t.type === "attributes" ?
|
|
506
|
-
e instanceof Element && (
|
|
505
|
+
e && (e.querySelectorAll("[title]").forEach(P), N = new MutationObserver((e) => {
|
|
506
|
+
for (let t of e) t.type === "attributes" ? P(t.target) : t.addedNodes.forEach((e) => {
|
|
507
|
+
e instanceof Element && (P(e), e.querySelectorAll("[title]").forEach(P));
|
|
507
508
|
});
|
|
508
509
|
}), N.observe(e, {
|
|
509
510
|
subtree: !0,
|
|
@@ -511,21 +512,21 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
511
512
|
attributes: !0,
|
|
512
513
|
attributeFilter: ["title"]
|
|
513
514
|
}));
|
|
514
|
-
}),
|
|
515
|
+
}), ne(() => {
|
|
515
516
|
N?.disconnect(), clearTimeout(M);
|
|
516
517
|
});
|
|
517
|
-
let
|
|
518
|
-
|
|
518
|
+
let ae = !1;
|
|
519
|
+
R(async () => {
|
|
519
520
|
let e = await import("maplibre-gl"), t = "Map" in e ? e : e.default;
|
|
520
|
-
if (
|
|
521
|
-
let n = r.workerUrl ??
|
|
521
|
+
if (ae || !o.value) return;
|
|
522
|
+
let n = r.workerUrl ?? ue();
|
|
522
523
|
n && t.setWorkerUrl(n);
|
|
523
524
|
let a = y(), s = {
|
|
524
525
|
center: a.center ?? r.center,
|
|
525
526
|
zoom: a.zoom ?? r.zoom,
|
|
526
527
|
bearing: a.bearing ?? r.bearing,
|
|
527
528
|
pitch: a.pitch ?? r.pitch
|
|
528
|
-
}, c =
|
|
529
|
+
}, c = ee(new t.Map({
|
|
529
530
|
container: o.value,
|
|
530
531
|
style: r.mapStyle,
|
|
531
532
|
attributionControl: !1,
|
|
@@ -534,7 +535,7 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
534
535
|
...r.options
|
|
535
536
|
}));
|
|
536
537
|
u.value = t, c.on("style.load", () => {
|
|
537
|
-
f ||=
|
|
538
|
+
f ||= Se(c.getStyle()), g(c), d.value++;
|
|
538
539
|
}), c.on("click", (e) => i("click", e)), c.on("moveend", () => {
|
|
539
540
|
let e = b(c);
|
|
540
541
|
i("update:center", e.center), i("update:zoom", e.zoom), i("update:bearing", e.bearing), i("update:pitch", e.pitch);
|
|
@@ -544,87 +545,87 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
544
545
|
} catch {}
|
|
545
546
|
}), c.once("load", () => {
|
|
546
547
|
l.value = c;
|
|
547
|
-
for (let e of Object.keys(x))
|
|
548
|
+
for (let e of Object.keys(x)) w(e);
|
|
548
549
|
i("ready", c);
|
|
549
550
|
});
|
|
550
|
-
}),
|
|
551
|
-
|
|
551
|
+
}), re(() => {
|
|
552
|
+
ae = !0, l.value?.remove(), l.value = void 0;
|
|
552
553
|
});
|
|
553
|
-
let
|
|
554
|
+
let J = (e, t) => Math.abs(e - t) < 1e-9;
|
|
554
555
|
return Y(() => r.center?.join(","), () => {
|
|
555
556
|
let e = l.value;
|
|
556
557
|
if (!e || !r.center) return;
|
|
557
558
|
let t = e.getCenter();
|
|
558
|
-
|
|
559
|
+
J(t.lng, r.center[0]) && J(t.lat, r.center[1]) || e.jumpTo({ center: r.center });
|
|
559
560
|
}), Y(() => r.zoom, (e) => {
|
|
560
|
-
l.value && e !== void 0 && !
|
|
561
|
+
l.value && e !== void 0 && !J(l.value.getZoom(), e) && l.value.jumpTo({ zoom: e });
|
|
561
562
|
}), Y(() => r.bearing, (e) => {
|
|
562
|
-
l.value && e !== void 0 && !
|
|
563
|
+
l.value && e !== void 0 && !J(l.value.getBearing(), e) && l.value.jumpTo({ bearing: e });
|
|
563
564
|
}), Y(() => r.pitch, (e) => {
|
|
564
|
-
l.value && e !== void 0 && !
|
|
565
|
+
l.value && e !== void 0 && !J(l.value.getPitch(), e) && l.value.jumpTo({ pitch: e });
|
|
565
566
|
}), Y(() => r.adapter, () => {
|
|
566
567
|
l.value && g(l.value);
|
|
567
568
|
}), Y(() => r.mapStyle, (e) => l.value?.setStyle(e, {
|
|
568
569
|
diff: !1,
|
|
569
570
|
transformStyle: (e, t) => {
|
|
570
|
-
let n = f ??
|
|
571
|
-
f =
|
|
572
|
-
let i = r.keepLayers, a = i === !1 ? t :
|
|
571
|
+
let n = f ?? Se(void 0);
|
|
572
|
+
f = Se(t);
|
|
573
|
+
let i = r.keepLayers, a = i === !1 ? t : Ce(e, t, n, typeof i == "function" ? i : void 0);
|
|
573
574
|
return r.transformStyle && (a = r.transformStyle(e, a)), a;
|
|
574
575
|
}
|
|
575
576
|
})), t({
|
|
576
577
|
map: l,
|
|
577
578
|
context: h
|
|
578
|
-
}), (t, n) => (
|
|
579
|
+
}), (t, n) => (z(), D("div", {
|
|
579
580
|
ref_key: "root",
|
|
580
581
|
ref: a,
|
|
581
582
|
class: "m3-map relative overflow-hidden",
|
|
582
|
-
onPointerover:
|
|
583
|
-
onPointerout:
|
|
584
|
-
onPointerdown:
|
|
585
|
-
onFocusin:
|
|
586
|
-
onFocusout:
|
|
583
|
+
onPointerover: H,
|
|
584
|
+
onPointerout: K,
|
|
585
|
+
onPointerdown: I,
|
|
586
|
+
onFocusin: q,
|
|
587
|
+
onFocusout: I
|
|
587
588
|
}, [
|
|
588
|
-
|
|
589
|
+
O("div", {
|
|
589
590
|
ref_key: "container",
|
|
590
591
|
ref: o,
|
|
591
592
|
class: "h-full w-full"
|
|
592
593
|
}, null, 512),
|
|
593
|
-
l.value && e.attribution ? (
|
|
594
|
+
l.value && e.attribution ? (z(), T(ve, {
|
|
594
595
|
key: 0,
|
|
595
596
|
position: e.attribution === !0 ? "bottom-right" : e.attribution
|
|
596
|
-
}, null, 8, ["position"])) :
|
|
597
|
-
l.value ?
|
|
598
|
-
|
|
597
|
+
}, null, 8, ["position"])) : E("", !0),
|
|
598
|
+
l.value ? U(t.$slots, "default", {}, void 0, void 0, 1) : E("", !0),
|
|
599
|
+
j(C, {
|
|
599
600
|
"enter-active-class": "transition-opacity duration-150",
|
|
600
601
|
"enter-from-class": "opacity-0",
|
|
601
602
|
"leave-active-class": "transition-opacity duration-100",
|
|
602
603
|
"leave-to-class": "opacity-0"
|
|
603
604
|
}, {
|
|
604
|
-
default: X(() => [
|
|
605
|
+
default: X(() => [A.value ? (z(), D("div", {
|
|
605
606
|
key: 0,
|
|
606
607
|
role: "tooltip",
|
|
607
|
-
class: L(["pointer-events-none absolute z-10 min-h-6 max-w-[200px] -translate-y-1/2 rounded bg-inverse-surface px-2 py-1 text-body-small whitespace-nowrap text-inverse-on-surface",
|
|
608
|
-
style:
|
|
609
|
-
left: `${
|
|
610
|
-
top: `${
|
|
608
|
+
class: L(["pointer-events-none absolute z-10 min-h-6 max-w-[200px] -translate-y-1/2 rounded bg-inverse-surface px-2 py-1 text-body-small whitespace-nowrap text-inverse-on-surface", A.value.left ? "-translate-x-full" : ""]),
|
|
609
|
+
style: te({
|
|
610
|
+
left: `${A.value.x}px`,
|
|
611
|
+
top: `${A.value.y}px`
|
|
611
612
|
})
|
|
612
|
-
},
|
|
613
|
+
}, G(A.value.text), 7)) : E("", !0)]),
|
|
613
614
|
_: 1
|
|
614
615
|
})
|
|
615
616
|
], 544));
|
|
616
617
|
}
|
|
617
|
-
}),
|
|
618
|
+
}), Te = 13.5, Ee = Te / Math.SQRT2, De = [0, -14], Oe = {
|
|
618
619
|
center: [0, 0],
|
|
619
620
|
top: [0, 0],
|
|
620
621
|
"top-left": [0, 0],
|
|
621
622
|
"top-right": [0, 0],
|
|
622
623
|
bottom: [0, -38.1],
|
|
623
|
-
"bottom-left": [
|
|
624
|
-
"bottom-right": [-
|
|
625
|
-
left: [
|
|
624
|
+
"bottom-left": [Ee, (24.6 + Ee) * -1],
|
|
625
|
+
"bottom-right": [-Ee, (24.6 + Ee) * -1],
|
|
626
|
+
left: [Te, -24.6],
|
|
626
627
|
right: [-13.5, -24.6]
|
|
627
|
-
},
|
|
628
|
+
}, ke = { class: "hidden" }, Ae = /* @__PURE__ */ M({
|
|
628
629
|
inheritAttrs: !1,
|
|
629
630
|
__name: "MMapMarker",
|
|
630
631
|
props: {
|
|
@@ -640,7 +641,7 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
640
641
|
},
|
|
641
642
|
emits: ["update:lngLat", "click"],
|
|
642
643
|
setup(e, { expose: t, emit: n }) {
|
|
643
|
-
let r = e, i = n, a = J(), o =
|
|
644
|
+
let r = e, i = n, a = J(), o = V(), s = V(), { onReady: c } = Z(), l, u = !1;
|
|
644
645
|
c((e, t) => {
|
|
645
646
|
u = !!a.default && !!o.value, l = new t.Marker({
|
|
646
647
|
...u ? { element: o.value } : { color: r.color ?? "currentColor" },
|
|
@@ -659,20 +660,20 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
659
660
|
function d(e) {
|
|
660
661
|
i("click", e);
|
|
661
662
|
}
|
|
662
|
-
return Y(() => r.lngLat.join(","), () => l?.setLngLat(r.lngLat)), Y(() => r.draggable, (e) => l?.setDraggable(e)), Y(() => r.rotation, (e) => l?.setRotation(e)), Y(() => r.offset?.join(","), () => l?.setOffset(r.offset ?? (u ? [0, 0] :
|
|
663
|
+
return Y(() => r.lngLat.join(","), () => l?.setLngLat(r.lngLat)), Y(() => r.draggable, (e) => l?.setDraggable(e)), Y(() => r.rotation, (e) => l?.setRotation(e)), Y(() => r.offset?.join(","), () => l?.setOffset(r.offset ?? (u ? [0, 0] : De))), ne(() => {
|
|
663
664
|
l?.getElement().removeEventListener("click", d), l?.getPopup()?.remove(), l?.remove();
|
|
664
|
-
}), t({ marker: () => l }), (e, t) => (
|
|
665
|
+
}), t({ marker: () => l }), (e, t) => (z(), D("div", ke, [e.$slots.default ? (z(), D("div", F({
|
|
665
666
|
key: 0,
|
|
666
667
|
ref_key: "content",
|
|
667
668
|
ref: o,
|
|
668
669
|
class: "m3-map-marker"
|
|
669
|
-
}, e.$attrs), [
|
|
670
|
+
}, e.$attrs), [U(e.$slots, "default")], 16)) : E("", !0), e.$slots.popup ? (z(), D("div", {
|
|
670
671
|
key: 1,
|
|
671
672
|
ref_key: "popupContent",
|
|
672
673
|
ref: s
|
|
673
|
-
}, [
|
|
674
|
+
}, [U(e.$slots, "popup")], 512)) : E("", !0)]));
|
|
674
675
|
}
|
|
675
|
-
}),
|
|
676
|
+
}), je = { class: "hidden" }, Me = /* @__PURE__ */ M({
|
|
676
677
|
inheritAttrs: !1,
|
|
677
678
|
__name: "MMapPopup",
|
|
678
679
|
props: {
|
|
@@ -695,7 +696,7 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
695
696
|
},
|
|
696
697
|
emits: ["update:open"],
|
|
697
698
|
setup(e, { expose: t, emit: n }) {
|
|
698
|
-
let r = e, i = n, a =
|
|
699
|
+
let r = e, i = n, a = V(), { onReady: o } = Z(), s, c, l = !1;
|
|
699
700
|
function u() {
|
|
700
701
|
s && c && !s.isOpen() && s.setLngLat(r.lngLat).addTo(c);
|
|
701
702
|
}
|
|
@@ -713,14 +714,14 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
713
714
|
}), r.open && u();
|
|
714
715
|
}), Y(() => r.open, (e) => {
|
|
715
716
|
e ? u() : s?.isOpen() && (l = !0, s.remove(), l = !1);
|
|
716
|
-
}), Y(() => r.lngLat.join(","), () => s?.setLngLat(r.lngLat)), Y(() => r.maxWidth, (e) => s?.setMaxWidth(e)), Y(() => r.offset, (e) => s?.setOffset(e ?? 0)),
|
|
717
|
+
}), Y(() => r.lngLat.join(","), () => s?.setLngLat(r.lngLat)), Y(() => r.maxWidth, (e) => s?.setMaxWidth(e)), Y(() => r.offset, (e) => s?.setOffset(e ?? 0)), ne(() => {
|
|
717
718
|
l = !0, s?.remove();
|
|
718
|
-
}), t({ popup: () => s }), (e, t) => (
|
|
719
|
+
}), t({ popup: () => s }), (e, t) => (z(), D("div", je, [O("div", F({
|
|
719
720
|
ref_key: "content",
|
|
720
721
|
ref: a
|
|
721
|
-
}, e.$attrs), [
|
|
722
|
+
}, e.$attrs), [U(e.$slots, "default")], 16)]));
|
|
722
723
|
}
|
|
723
|
-
}),
|
|
724
|
+
}), Ne = /* @__PURE__ */ M({
|
|
724
725
|
inheritAttrs: !1,
|
|
725
726
|
__name: "MMapGeoJson",
|
|
726
727
|
props: {
|
|
@@ -736,13 +737,13 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
736
737
|
},
|
|
737
738
|
emits: ["click"],
|
|
738
739
|
setup(e, { expose: t, emit: n }) {
|
|
739
|
-
let r = e, i = n, a = r.id ?? `m3-geojson-${
|
|
740
|
+
let r = e, i = n, a = r.id ?? `m3-geojson-${ae()}`, { onReady: o, styleVersion: s } = Z(), c = l(["primary", "surface"]), u = (...e) => [
|
|
740
741
|
"match",
|
|
741
742
|
["geometry-type"],
|
|
742
743
|
e,
|
|
743
744
|
!0,
|
|
744
745
|
!1
|
|
745
|
-
], d =
|
|
746
|
+
], d = w(() => {
|
|
746
747
|
let { primary: e, surface: t } = c.value;
|
|
747
748
|
return [
|
|
748
749
|
{
|
|
@@ -775,7 +776,7 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
775
776
|
}
|
|
776
777
|
}
|
|
777
778
|
];
|
|
778
|
-
}), f =
|
|
779
|
+
}), f = w(() => (r.layers ?? d.value).map((e, t) => ({
|
|
779
780
|
...e,
|
|
780
781
|
id: e.id ?? `${a}-${t}`,
|
|
781
782
|
source: a
|
|
@@ -805,14 +806,14 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
805
806
|
}
|
|
806
807
|
return o((e) => {
|
|
807
808
|
p = e, b();
|
|
808
|
-
}), Y(s, () => b()), Y(() => r.data, (e) => (p?.getSource(a))?.setData(e)), Y(() => JSON.stringify(f.value), () => y()), Y(() => r.before, () => y()),
|
|
809
|
+
}), Y(s, () => b()), Y(() => r.data, (e) => (p?.getSource(a))?.setData(e)), Y(() => JSON.stringify(f.value), () => y()), Y(() => r.before, () => y()), ne(() => {
|
|
809
810
|
p &&= (v(), p.getSource(a) && p.removeSource(a), void 0);
|
|
810
811
|
}), t({
|
|
811
812
|
sourceId: a,
|
|
812
813
|
layerIds: () => [...m]
|
|
813
814
|
}), (e, t) => null;
|
|
814
815
|
}
|
|
815
|
-
}),
|
|
816
|
+
}), Pe = ["aria-label", "onClick"], Fe = /* @__PURE__ */ M({
|
|
816
817
|
inheritAttrs: !1,
|
|
817
818
|
__name: "MMapCluster",
|
|
818
819
|
props: {
|
|
@@ -835,12 +836,12 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
835
836
|
},
|
|
836
837
|
emits: ["click", "cluster-click"],
|
|
837
838
|
setup(e, { expose: t, emit: n }) {
|
|
838
|
-
let r = e, i = n, a = r.id ?? `m3-cluster-${
|
|
839
|
+
let r = e, i = n, a = r.id ?? `m3-cluster-${ae()}`, o = s(), { onReady: c, styleVersion: u } = Z(), d = l([
|
|
839
840
|
"primary",
|
|
840
841
|
"secondary",
|
|
841
842
|
"tertiary",
|
|
842
843
|
"surface"
|
|
843
|
-
]), f = ["!", ["has", "point_count"]], p =
|
|
844
|
+
]), f = ["!", ["has", "point_count"]], p = w(() => {
|
|
844
845
|
let e = d.value[r.color];
|
|
845
846
|
return (r.pointLayers ?? [{
|
|
846
847
|
type: "circle",
|
|
@@ -864,26 +865,26 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
864
865
|
function h(e) {
|
|
865
866
|
return e < 10 ? 32 : e < 100 ? 40 : e < 1e3 ? 48 : 56;
|
|
866
867
|
}
|
|
867
|
-
let g =
|
|
868
|
+
let g = w(() => {
|
|
868
869
|
let e = typeof document < "u" && document.documentElement.lang || void 0;
|
|
869
870
|
return new Intl.NumberFormat(e, {
|
|
870
871
|
notation: "compact",
|
|
871
872
|
maximumFractionDigits: 1
|
|
872
873
|
});
|
|
873
|
-
}), _, v, y = [],
|
|
874
|
+
}), _, v, y = [], b = /* @__PURE__ */ new Map(), C = W([]), E = () => _?.getSource(a);
|
|
874
875
|
function k(e, t, n) {
|
|
875
876
|
return {
|
|
876
877
|
id: e,
|
|
877
878
|
count: t,
|
|
878
879
|
lngLat: n,
|
|
879
880
|
zoomIn: async () => {
|
|
880
|
-
let t = await
|
|
881
|
+
let t = await E()?.getClusterExpansionZoom(e);
|
|
881
882
|
t !== void 0 && _ && _.easeTo({
|
|
882
883
|
center: n,
|
|
883
884
|
zoom: Math.min(t, _.getMaxZoom())
|
|
884
885
|
});
|
|
885
886
|
},
|
|
886
|
-
leaves: async (t = Infinity) => await
|
|
887
|
+
leaves: async (t = Infinity) => await E()?.getClusterLeaves(e, t, 0) ?? []
|
|
887
888
|
};
|
|
888
889
|
}
|
|
889
890
|
function A() {
|
|
@@ -893,7 +894,7 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
893
894
|
let n = t.properties, r = n.cluster_id;
|
|
894
895
|
if (e.has(r)) continue;
|
|
895
896
|
e.add(r);
|
|
896
|
-
let [i, a] = t.geometry.coordinates, o =
|
|
897
|
+
let [i, a] = t.geometry.coordinates, o = b.get(r);
|
|
897
898
|
if (o && o.count === n.point_count) {
|
|
898
899
|
o.marker.setLngLat([i, a]);
|
|
899
900
|
continue;
|
|
@@ -905,14 +906,14 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
905
906
|
element: s,
|
|
906
907
|
anchor: "center"
|
|
907
908
|
}).setLngLat([i, a]).addTo(_);
|
|
908
|
-
|
|
909
|
+
b.set(r, {
|
|
909
910
|
...k(r, n.point_count, [i, a]),
|
|
910
911
|
el: s,
|
|
911
912
|
marker: c
|
|
912
913
|
});
|
|
913
914
|
}
|
|
914
|
-
for (let [t, n] of
|
|
915
|
-
|
|
915
|
+
for (let [t, n] of b) e.has(t) || (n.marker.remove(), b.delete(t));
|
|
916
|
+
C.value = [...b.values()];
|
|
916
917
|
}
|
|
917
918
|
let j = 0;
|
|
918
919
|
function M() {
|
|
@@ -920,24 +921,24 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
920
921
|
}
|
|
921
922
|
let N = (e) => {
|
|
922
923
|
e.sourceId === a && M();
|
|
923
|
-
}, P = (e) => i("click", e),
|
|
924
|
+
}, P = (e) => i("click", e), ee = () => {
|
|
924
925
|
r.interactive && _ && (_.getCanvas().style.cursor = "pointer");
|
|
925
|
-
},
|
|
926
|
+
}, F = () => {
|
|
926
927
|
r.interactive && _ && (_.getCanvas().style.cursor = "");
|
|
927
928
|
};
|
|
928
|
-
function
|
|
929
|
+
function I() {
|
|
929
930
|
if (_) {
|
|
930
|
-
for (let e of y) _.off("click", e, P), _.off("mouseenter", e,
|
|
931
|
+
for (let e of y) _.off("click", e, P), _.off("mouseenter", e, ee), _.off("mouseleave", e, F), _.getLayer(e) && _.removeLayer(e);
|
|
931
932
|
y = [];
|
|
932
933
|
}
|
|
933
934
|
}
|
|
934
|
-
function
|
|
935
|
+
function R() {
|
|
935
936
|
if (_) {
|
|
936
|
-
|
|
937
|
-
for (let e of p.value) _.addLayer(e, r.before && _.getLayer(r.before) ? r.before : void 0), _.on("click", e.id, P), _.on("mouseenter", e.id,
|
|
937
|
+
I();
|
|
938
|
+
for (let e of p.value) _.addLayer(e, r.before && _.getLayer(r.before) ? r.before : void 0), _.on("click", e.id, P), _.on("mouseenter", e.id, ee), _.on("mouseleave", e.id, F), y.push(e.id);
|
|
938
939
|
}
|
|
939
940
|
}
|
|
940
|
-
function
|
|
941
|
+
function re() {
|
|
941
942
|
return {
|
|
942
943
|
type: "geojson",
|
|
943
944
|
data: r.data,
|
|
@@ -947,22 +948,22 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
947
948
|
clusterMaxZoom: r.maxZoom
|
|
948
949
|
};
|
|
949
950
|
}
|
|
950
|
-
function
|
|
951
|
-
_ && (_.getSource(a) || (_.addSource(a,
|
|
951
|
+
function B() {
|
|
952
|
+
_ && (_.getSource(a) || (_.addSource(a, re()), y = []), y.length && _.getLayer(y[0]) || R(), M());
|
|
952
953
|
}
|
|
953
|
-
function
|
|
954
|
-
_ && (
|
|
954
|
+
function ie() {
|
|
955
|
+
_ && (I(), _.getSource(a) && _.removeSource(a), B());
|
|
955
956
|
}
|
|
956
957
|
c((e, t) => {
|
|
957
|
-
_ = e, v = t,
|
|
958
|
-
}), Y(u, () =>
|
|
959
|
-
|
|
958
|
+
_ = e, v = t, B(), _.on("sourcedata", N), _.on("move", M), _.on("moveend", M);
|
|
959
|
+
}), Y(u, () => B()), Y(() => r.data, (e) => {
|
|
960
|
+
E()?.setData(e), M();
|
|
960
961
|
}), Y(() => [
|
|
961
962
|
r.radius,
|
|
962
963
|
r.maxZoom,
|
|
963
964
|
JSON.stringify(r.sourceOptions)
|
|
964
|
-
].join("|"),
|
|
965
|
-
function
|
|
965
|
+
].join("|"), ie), Y(() => JSON.stringify(p.value), () => R()), Y(() => r.before, () => R());
|
|
966
|
+
function V(e) {
|
|
966
967
|
let t = {
|
|
967
968
|
id: e.id,
|
|
968
969
|
count: e.count,
|
|
@@ -972,55 +973,55 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
972
973
|
};
|
|
973
974
|
i("cluster-click", t), r.zoomOnClick && e.zoomIn();
|
|
974
975
|
}
|
|
975
|
-
let
|
|
976
|
-
return
|
|
976
|
+
let K = (e) => o.mapClusterZoom.replace("{count}", String(e));
|
|
977
|
+
return ne(() => {
|
|
977
978
|
j && cancelAnimationFrame(j);
|
|
978
|
-
for (let e of
|
|
979
|
-
|
|
979
|
+
for (let e of b.values()) e.marker.remove();
|
|
980
|
+
b.clear(), C.value = [], _ &&= (_.off("sourcedata", N), _.off("move", M), _.off("moveend", M), I(), _.getSource(a) && _.removeSource(a), void 0);
|
|
980
981
|
}), t({
|
|
981
982
|
sourceId: a,
|
|
982
983
|
layerIds: () => [...y],
|
|
983
|
-
clusters: () =>
|
|
984
|
+
clusters: () => C.value.map(({ id: e, count: t, lngLat: n, zoomIn: r, leaves: i }) => ({
|
|
984
985
|
id: e,
|
|
985
986
|
count: t,
|
|
986
987
|
lngLat: n,
|
|
987
988
|
zoomIn: r,
|
|
988
989
|
leaves: i
|
|
989
990
|
}))
|
|
990
|
-
}), (t, n) => (
|
|
991
|
+
}), (t, n) => (z(!0), D(x, null, H(C.value, (n) => (z(), T(S, {
|
|
991
992
|
key: n.id,
|
|
992
993
|
to: n.el
|
|
993
|
-
}, [
|
|
994
|
+
}, [U(t.$slots, "cluster", {
|
|
994
995
|
id: n.id,
|
|
995
996
|
count: n.count,
|
|
996
997
|
label: g.value.format(n.count),
|
|
997
998
|
lngLat: n.lngLat,
|
|
998
999
|
zoomIn: n.zoomIn,
|
|
999
1000
|
leaves: n.leaves
|
|
1000
|
-
}, () => [
|
|
1001
|
+
}, () => [O("button", {
|
|
1001
1002
|
type: "button",
|
|
1002
1003
|
class: L(["m3-map-cluster__bubble relative grid cursor-pointer place-items-center rounded-full border-2 border-surface text-label-large font-medium shadow-elevation-1 outline-none transition-[transform,box-shadow] duration-150 after:pointer-events-none after:absolute after:inset-0 after:rounded-full after:opacity-0 after:transition-opacity hover:shadow-elevation-2 hover:after:opacity-8 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-secondary active:after:opacity-10", m[e.color]]),
|
|
1003
|
-
style:
|
|
1004
|
+
style: te({
|
|
1004
1005
|
width: `${h(n.count)}px`,
|
|
1005
1006
|
height: `${h(n.count)}px`
|
|
1006
1007
|
}),
|
|
1007
|
-
"aria-label":
|
|
1008
|
-
onClick:
|
|
1009
|
-
},
|
|
1008
|
+
"aria-label": K(n.count),
|
|
1009
|
+
onClick: se((e) => V(n), ["stop"])
|
|
1010
|
+
}, G(g.value.format(n.count)), 15, Pe)])], 8, ["to"]))), 128));
|
|
1010
1011
|
}
|
|
1011
|
-
}),
|
|
1012
|
+
}), Ie = { class: "flex min-w-0 flex-1 flex-col" }, Le = ["aria-label", "aria-pressed"], Re = { class: "flex min-w-0 flex-1 flex-col" }, ze = {
|
|
1012
1013
|
key: 0,
|
|
1013
1014
|
class: "truncate text-label-small text-on-surface-variant"
|
|
1014
|
-
},
|
|
1015
|
+
}, Be = {
|
|
1015
1016
|
key: 0,
|
|
1016
1017
|
class: "rounded-full bg-primary/8 px-2 py-0.5 text-label-small tabular-nums text-primary"
|
|
1017
|
-
},
|
|
1018
|
+
}, Ve = { class: "min-h-0 overflow-hidden" }, He = { class: "flex flex-col gap-3 px-3 pb-3" }, Ue = {
|
|
1018
1019
|
key: 0,
|
|
1019
1020
|
class: "text-body-small text-on-surface-variant"
|
|
1020
|
-
},
|
|
1021
|
+
}, We = { class: "flex items-center gap-2 rounded-2xl bg-surface-container-highest/60 px-3 py-1" }, Ge = ["src"], Ke = {
|
|
1021
1022
|
key: 2,
|
|
1022
1023
|
class: "flex flex-wrap items-center gap-2"
|
|
1023
|
-
},
|
|
1024
|
+
}, qe = ["href"], Je = /* @__PURE__ */ M({
|
|
1024
1025
|
__name: "_MMapLayerItem",
|
|
1025
1026
|
props: {
|
|
1026
1027
|
layer: {},
|
|
@@ -1028,38 +1029,38 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
1028
1029
|
},
|
|
1029
1030
|
emits: ["toggle-expanded"],
|
|
1030
1031
|
setup(t, { emit: n }) {
|
|
1031
|
-
let r = n, i = s(), { isVisible: a, toggle: o, opacityOf: c, setOpacity: l } =
|
|
1032
|
-
return (n, s) => (
|
|
1032
|
+
let r = n, i = s(), { isVisible: a, toggle: o, opacityOf: c, setOpacity: l } = Q();
|
|
1033
|
+
return (n, s) => (z(), D("div", { class: L(["flex overflow-hidden rounded-2xl bg-surface-container", q(a)(t.layer.id) ? "" : "opacity-75"]) }, [O("div", { class: L(["w-1 shrink-0 transition-colors duration-200", q(a)(t.layer.id) ? "bg-primary" : "bg-outline-variant"]) }, null, 2), O("div", Ie, [O("div", {
|
|
1033
1034
|
class: "flex cursor-pointer items-center gap-2 px-3 py-2",
|
|
1034
1035
|
onClick: s[1] ||= (e) => r("toggle-expanded")
|
|
1035
1036
|
}, [
|
|
1036
|
-
|
|
1037
|
+
O("button", {
|
|
1037
1038
|
type: "button",
|
|
1038
1039
|
class: L(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", q(a)(t.layer.id) ? "bg-primary/12 text-primary" : "bg-on-surface/5 text-on-surface-variant"]),
|
|
1039
1040
|
"aria-label": q(a)(t.layer.id) ? q(i).mapHideLayer : q(i).mapShowLayer,
|
|
1040
1041
|
"aria-pressed": q(a)(t.layer.id),
|
|
1041
|
-
onClick: s[0] ||=
|
|
1042
|
-
}, [
|
|
1042
|
+
onClick: s[0] ||= se((e) => q(o)(t.layer.id), ["stop"])
|
|
1043
|
+
}, [j(e, {
|
|
1043
1044
|
name: q(a)(t.layer.id) ? "visibility" : "visibility_off",
|
|
1044
1045
|
size: 18
|
|
1045
|
-
}, null, 8, ["name"])], 10,
|
|
1046
|
-
|
|
1047
|
-
q(a)(t.layer.id) && q(c)(t.layer.id) < 1 ? (
|
|
1048
|
-
|
|
1046
|
+
}, null, 8, ["name"])], 10, Le),
|
|
1047
|
+
O("div", Re, [O("span", { class: L(["truncate text-body-medium", q(a)(t.layer.id) ? "text-on-surface" : "text-on-surface-variant"]) }, G(t.layer.title), 3), t.layer.description && !t.expanded ? (z(), D("span", ze, G(t.layer.description), 1)) : E("", !0)]),
|
|
1048
|
+
q(a)(t.layer.id) && q(c)(t.layer.id) < 1 ? (z(), D("span", Be, G(Math.round(q(c)(t.layer.id) * 100)) + "% ", 1)) : E("", !0),
|
|
1049
|
+
j(e, {
|
|
1049
1050
|
name: "expand_more",
|
|
1050
1051
|
size: 18,
|
|
1051
1052
|
class: L(["shrink-0 text-on-surface-variant transition-transform duration-300", t.expanded ? "rotate-180" : ""])
|
|
1052
1053
|
}, null, 8, ["class"])
|
|
1053
|
-
]),
|
|
1054
|
+
]), O("div", {
|
|
1054
1055
|
class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
1055
|
-
style:
|
|
1056
|
-
}, [
|
|
1057
|
-
t.layer.description ? (
|
|
1058
|
-
|
|
1056
|
+
style: te({ gridTemplateRows: t.expanded ? "1fr" : "0fr" })
|
|
1057
|
+
}, [O("div", Ve, [O("div", He, [
|
|
1058
|
+
t.layer.description ? (z(), D("p", Ue, G(t.layer.description), 1)) : E("", !0),
|
|
1059
|
+
O("div", We, [j(e, {
|
|
1059
1060
|
name: "opacity",
|
|
1060
1061
|
size: 16,
|
|
1061
1062
|
class: "shrink-0 text-on-surface-variant"
|
|
1062
|
-
}),
|
|
1063
|
+
}), j(d, {
|
|
1063
1064
|
"model-value": q(c)(t.layer.id),
|
|
1064
1065
|
min: 0,
|
|
1065
1066
|
max: 1,
|
|
@@ -1068,40 +1069,40 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
1068
1069
|
class: "flex-1",
|
|
1069
1070
|
"onUpdate:modelValue": s[2] ||= (e) => q(l)(t.layer.id, Number(e))
|
|
1070
1071
|
}, null, 8, ["model-value", "label"])]),
|
|
1071
|
-
t.layer.legend ? (
|
|
1072
|
+
t.layer.legend ? (z(), D("img", {
|
|
1072
1073
|
key: 1,
|
|
1073
1074
|
src: t.layer.legend,
|
|
1074
1075
|
alt: "",
|
|
1075
1076
|
class: "max-w-full self-start",
|
|
1076
1077
|
loading: "lazy"
|
|
1077
|
-
}, null, 8,
|
|
1078
|
-
t.layer.download || n.$slots.actions ? (
|
|
1078
|
+
}, null, 8, Ge)) : E("", !0),
|
|
1079
|
+
t.layer.download || n.$slots.actions ? (z(), D("div", Ke, [t.layer.download ? (z(), D("a", {
|
|
1079
1080
|
key: 0,
|
|
1080
1081
|
href: t.layer.download,
|
|
1081
1082
|
target: "_blank",
|
|
1082
1083
|
rel: "noopener",
|
|
1083
1084
|
download: "",
|
|
1084
1085
|
class: "inline-flex items-center gap-1 rounded-full px-3 py-1.5 text-label-large text-primary hover:bg-primary/8"
|
|
1085
|
-
}, [
|
|
1086
|
+
}, [j(e, {
|
|
1086
1087
|
name: "download",
|
|
1087
1088
|
size: 18
|
|
1088
|
-
}),
|
|
1089
|
+
}), A(" " + G(q(i).mapDownload), 1)], 8, qe)) : E("", !0), U(n.$slots, "actions", {
|
|
1089
1090
|
layer: t.layer,
|
|
1090
1091
|
visible: q(a)(t.layer.id)
|
|
1091
|
-
})])) :
|
|
1092
|
+
})])) : E("", !0)
|
|
1092
1093
|
])])], 4)])], 2));
|
|
1093
1094
|
}
|
|
1094
|
-
}),
|
|
1095
|
+
}), Ye = { class: "flex flex-col gap-3" }, Xe = ["onClick"], Ze = [
|
|
1095
1096
|
"aria-label",
|
|
1096
1097
|
"aria-pressed",
|
|
1097
1098
|
"onClick"
|
|
1098
|
-
],
|
|
1099
|
+
], Qe = { class: "flex-1 select-none truncate text-label-large text-on-surface" }, $e = { class: "rounded-full bg-surface-container-highest px-2 py-0.5 text-label-small tabular-nums text-on-surface-variant" }, et = {
|
|
1099
1100
|
key: 1,
|
|
1100
1101
|
class: "flex flex-col gap-1.5"
|
|
1101
|
-
},
|
|
1102
|
+
}, tt = {
|
|
1102
1103
|
key: 2,
|
|
1103
1104
|
class: "flex flex-col items-center gap-3 py-8"
|
|
1104
|
-
},
|
|
1105
|
+
}, nt = { class: "grid size-14 place-items-center rounded-full bg-surface-container-highest" }, rt = { class: "text-body-medium text-on-surface-variant" }, it = /* @__PURE__ */ M({
|
|
1105
1106
|
__name: "MMapLayers",
|
|
1106
1107
|
props: {
|
|
1107
1108
|
search: {
|
|
@@ -1115,23 +1116,23 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
1115
1116
|
map: {}
|
|
1116
1117
|
},
|
|
1117
1118
|
setup(t) {
|
|
1118
|
-
let n = t, r = s(), { model: i, layersOf: a, isVisible: o, groupState: c, setGroupVisible: l } =
|
|
1119
|
+
let n = t, r = s(), { model: i, layersOf: a, isVisible: o, groupState: c, setGroupVisible: l } = Q(() => n.map), d = V(""), f = (e) => !d.value || e.title.toLowerCase().includes(d.value.toLowerCase()), p = w(() => (i.value?.groups ?? []).map((e) => ({
|
|
1119
1120
|
...e,
|
|
1120
1121
|
all: a(e.name),
|
|
1121
1122
|
layers: a(e.name).filter(f)
|
|
1122
|
-
})).filter((e) => e.layers.length)), m =
|
|
1123
|
+
})).filter((e) => e.layers.length)), m = w(() => a(null).filter(f)), h = V(/* @__PURE__ */ new Set()), g = (e) => h.value.has(e) === n.collapsed;
|
|
1123
1124
|
function _(e) {
|
|
1124
1125
|
let t = new Set(h.value);
|
|
1125
1126
|
t.delete(e) || t.add(e), h.value = t;
|
|
1126
1127
|
}
|
|
1127
|
-
let v =
|
|
1128
|
+
let v = V(/* @__PURE__ */ new Set());
|
|
1128
1129
|
function y(e) {
|
|
1129
1130
|
let t = new Set(v.value);
|
|
1130
1131
|
t.delete(e) || t.add(e), v.value = t;
|
|
1131
1132
|
}
|
|
1132
|
-
let
|
|
1133
|
-
return (n, i) => (
|
|
1134
|
-
t.search ? (
|
|
1133
|
+
let b = (e) => e.filter((e) => o(e.id)).length;
|
|
1134
|
+
return (n, i) => (z(), D("div", Ye, [
|
|
1135
|
+
t.search ? (z(), T(u, {
|
|
1135
1136
|
key: 0,
|
|
1136
1137
|
modelValue: d.value,
|
|
1137
1138
|
"onUpdate:modelValue": i[0] ||= (e) => d.value = e,
|
|
@@ -1139,79 +1140,74 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
1139
1140
|
"leading-icon": "search",
|
|
1140
1141
|
variant: "outlined",
|
|
1141
1142
|
clearable: ""
|
|
1142
|
-
}, null, 8, ["modelValue", "label"])) :
|
|
1143
|
-
(
|
|
1143
|
+
}, null, 8, ["modelValue", "label"])) : E("", !0),
|
|
1144
|
+
(z(!0), D(x, null, H(p.value, (t) => (z(), D("section", {
|
|
1144
1145
|
key: t.name,
|
|
1145
1146
|
class: "flex flex-col"
|
|
1146
|
-
}, [
|
|
1147
|
+
}, [O("div", {
|
|
1147
1148
|
class: "m3-map-layers-row flex cursor-pointer items-center gap-2 rounded-xl px-2 py-1.5",
|
|
1148
1149
|
onClick: (e) => _(t.name)
|
|
1149
1150
|
}, [
|
|
1150
|
-
|
|
1151
|
+
O("button", {
|
|
1151
1152
|
type: "button",
|
|
1152
1153
|
class: L(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", q(c)(t.name) === "visible" ? "bg-primary-container text-on-primary-container" : q(c)(t.name) === "partial" ? "bg-secondary-container text-on-secondary-container" : "bg-on-surface/8 text-on-surface-variant"]),
|
|
1153
1154
|
"aria-label": q(c)(t.name) === "hidden" ? q(r).mapShowLayer : q(r).mapHideLayer,
|
|
1154
1155
|
"aria-pressed": q(c)(t.name) !== "hidden",
|
|
1155
|
-
onClick:
|
|
1156
|
-
}, [
|
|
1156
|
+
onClick: se((e) => q(l)(t.name, q(c)(t.name) !== "visible"), ["stop"])
|
|
1157
|
+
}, [j(e, {
|
|
1157
1158
|
name: q(c)(t.name) === "hidden" ? "visibility_off" : "visibility",
|
|
1158
1159
|
size: 18
|
|
1159
|
-
}, null, 8, ["name"])], 10,
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1160
|
+
}, null, 8, ["name"])], 10, Ze),
|
|
1161
|
+
O("span", Qe, G(t.title), 1),
|
|
1162
|
+
O("span", $e, G(b(t.all)) + "/" + G(t.all.length), 1),
|
|
1163
|
+
j(e, {
|
|
1163
1164
|
name: "expand_more",
|
|
1164
1165
|
size: 18,
|
|
1165
1166
|
class: L(["text-on-surface-variant transition-transform duration-300", g(t.name) ? "rotate-180" : ""])
|
|
1166
1167
|
}, null, 8, ["class"])
|
|
1167
|
-
], 8,
|
|
1168
|
+
], 8, Xe), O("div", {
|
|
1168
1169
|
class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
1169
|
-
style:
|
|
1170
|
-
}, [
|
|
1170
|
+
style: te({ gridTemplateRows: g(t.name) ? "1fr" : "0fr" })
|
|
1171
|
+
}, [O("div", { class: L(["flex min-h-0 flex-col gap-1.5 overflow-hidden", g(t.name) ? "pt-1.5" : ""]) }, [(z(!0), D(x, null, H(t.layers, (e) => (z(), T(Je, {
|
|
1171
1172
|
key: e.id,
|
|
1172
1173
|
layer: e,
|
|
1173
1174
|
expanded: v.value.has(e.id),
|
|
1174
1175
|
onToggleExpanded: (t) => y(e.id)
|
|
1175
|
-
},
|
|
1176
|
+
}, k({ _: 2 }, [n.$slots.actions ? {
|
|
1176
1177
|
name: "actions",
|
|
1177
|
-
fn: X((e) => [
|
|
1178
|
+
fn: X((e) => [U(n.$slots, "actions", F({ ref_for: !0 }, e))]),
|
|
1178
1179
|
key: "0"
|
|
1179
1180
|
} : void 0]), 1032, [
|
|
1180
1181
|
"layer",
|
|
1181
1182
|
"expanded",
|
|
1182
1183
|
"onToggleExpanded"
|
|
1183
1184
|
]))), 128))], 2)], 4)]))), 128)),
|
|
1184
|
-
m.value.length ? (
|
|
1185
|
+
m.value.length ? (z(), D("div", et, [(z(!0), D(x, null, H(m.value, (e) => (z(), T(Je, {
|
|
1185
1186
|
key: e.id,
|
|
1186
1187
|
layer: e,
|
|
1187
1188
|
expanded: v.value.has(e.id),
|
|
1188
1189
|
onToggleExpanded: (t) => y(e.id)
|
|
1189
|
-
},
|
|
1190
|
+
}, k({ _: 2 }, [n.$slots.actions ? {
|
|
1190
1191
|
name: "actions",
|
|
1191
|
-
fn: X((e) => [
|
|
1192
|
+
fn: X((e) => [U(n.$slots, "actions", F({ ref_for: !0 }, e))]),
|
|
1192
1193
|
key: "0"
|
|
1193
1194
|
} : void 0]), 1032, [
|
|
1194
1195
|
"layer",
|
|
1195
1196
|
"expanded",
|
|
1196
1197
|
"onToggleExpanded"
|
|
1197
|
-
]))), 128))])) :
|
|
1198
|
-
!p.value.length && !m.value.length ? (
|
|
1198
|
+
]))), 128))])) : E("", !0),
|
|
1199
|
+
!p.value.length && !m.value.length ? (z(), D("div", tt, [O("div", nt, [j(e, {
|
|
1199
1200
|
name: "layers_clear",
|
|
1200
1201
|
size: 28,
|
|
1201
1202
|
class: "text-on-surface-variant"
|
|
1202
|
-
})]),
|
|
1203
|
+
})]), O("p", rt, G(q(r).mapNoLayers), 1)])) : E("", !0)
|
|
1203
1204
|
]));
|
|
1204
1205
|
}
|
|
1205
|
-
}),
|
|
1206
|
-
"title",
|
|
1206
|
+
}), at = [
|
|
1207
1207
|
"aria-label",
|
|
1208
1208
|
"aria-checked",
|
|
1209
1209
|
"onClick"
|
|
1210
|
-
],
|
|
1211
|
-
"title",
|
|
1212
|
-
"aria-label",
|
|
1213
|
-
"aria-checked"
|
|
1214
|
-
], st = /* @__PURE__ */ j({
|
|
1210
|
+
], ot = ["src"], st = ["aria-label", "aria-checked"], ct = /* @__PURE__ */ M({
|
|
1215
1211
|
__name: "MMapBaseLayers",
|
|
1216
1212
|
props: {
|
|
1217
1213
|
imageBase: { default: "" },
|
|
@@ -1226,91 +1222,101 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
1226
1222
|
map: {}
|
|
1227
1223
|
},
|
|
1228
1224
|
setup(t) {
|
|
1229
|
-
let n = t, r = s(), { baseLayers: i, baseLayer: a, setBaseLayer: o } =
|
|
1230
|
-
return (n, s) => (
|
|
1225
|
+
let n = t, r = s(), { baseLayers: i, baseLayer: a, setBaseLayer: o } = Q(() => n.map), c = (e, t) => /^(https?:|data:|\/\/)/.test(e) ? e : `${t}${e}`;
|
|
1226
|
+
return (n, s) => (z(), D("div", {
|
|
1231
1227
|
class: L(["flex gap-2", t.vertical ? "flex-col" : "flex-row flex-wrap"]),
|
|
1232
1228
|
role: "radiogroup"
|
|
1233
|
-
}, [(
|
|
1229
|
+
}, [(z(!0), D(x, null, H(q(i), (n) => (z(), T(f, {
|
|
1234
1230
|
key: n.id,
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1231
|
+
text: n.title,
|
|
1232
|
+
placement: t.vertical ? "right" : "top"
|
|
1233
|
+
}, {
|
|
1234
|
+
default: X(() => [O("button", {
|
|
1235
|
+
type: "button",
|
|
1236
|
+
role: "radio",
|
|
1237
|
+
class: L(["m3-map-base grid size-12 shrink-0 cursor-pointer place-items-center overflow-hidden rounded-full border-2 bg-surface-variant transition-[border-color,transform] duration-150 hover:scale-110", q(a) === n.id ? "m3-map-base--active border-primary" : "border-transparent"]),
|
|
1238
|
+
"aria-label": n.title,
|
|
1239
|
+
"aria-checked": q(a) === n.id,
|
|
1240
|
+
onClick: (e) => q(o)(n.id)
|
|
1241
|
+
}, [n.base?.image ? (z(), D("img", {
|
|
1242
|
+
key: 0,
|
|
1243
|
+
src: c(n.base.image, t.imageBase),
|
|
1244
|
+
alt: "",
|
|
1245
|
+
class: "size-full object-cover"
|
|
1246
|
+
}, null, 8, ot)) : (z(), T(e, {
|
|
1247
|
+
key: 1,
|
|
1248
|
+
name: "map",
|
|
1249
|
+
size: 22,
|
|
1250
|
+
class: "text-on-surface-variant"
|
|
1251
|
+
}))], 10, at)]),
|
|
1252
|
+
_: 2
|
|
1253
|
+
}, 1032, ["text", "placement"]))), 128)), t.none ? (z(), T(f, {
|
|
1253
1254
|
key: 0,
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1255
|
+
text: q(r).mapNoBaseLayer,
|
|
1256
|
+
placement: t.vertical ? "right" : "top"
|
|
1257
|
+
}, {
|
|
1258
|
+
default: X(() => [O("button", {
|
|
1259
|
+
type: "button",
|
|
1260
|
+
role: "radio",
|
|
1261
|
+
class: L(["m3-map-base grid size-12 shrink-0 cursor-pointer place-items-center rounded-full border-2 bg-surface-variant transition-[border-color,transform] duration-150 hover:scale-110", q(a) === null ? "m3-map-base--active border-primary" : "border-transparent"]),
|
|
1262
|
+
"aria-label": q(r).mapNoBaseLayer,
|
|
1263
|
+
"aria-checked": q(a) === null,
|
|
1264
|
+
onClick: s[0] ||= (e) => q(o)(null)
|
|
1265
|
+
}, [j(e, {
|
|
1266
|
+
name: "layers_clear",
|
|
1267
|
+
size: 22,
|
|
1268
|
+
class: "text-on-surface-variant"
|
|
1269
|
+
})], 10, st)]),
|
|
1270
|
+
_: 1
|
|
1271
|
+
}, 8, ["text", "placement"])) : E("", !0)], 2));
|
|
1266
1272
|
}
|
|
1267
|
-
}),
|
|
1273
|
+
}), lt = { class: "flex flex-col gap-2" }, ut = { class: "flex items-center gap-2 bg-primary-container/40 px-4 py-2" }, dt = { class: "text-label-large text-on-primary-container" }, ft = { class: "flex flex-col px-4 py-1" }, pt = { class: "text-label-small text-on-surface-variant" }, mt = { class: "text-body-medium text-on-surface" }, ht = {
|
|
1268
1274
|
key: 0,
|
|
1269
1275
|
class: "break-words"
|
|
1270
|
-
},
|
|
1276
|
+
}, gt = {
|
|
1271
1277
|
key: 1,
|
|
1272
1278
|
class: "text-body-small italic text-on-surface-variant"
|
|
1273
|
-
},
|
|
1279
|
+
}, _t = /* @__PURE__ */ M({
|
|
1274
1280
|
__name: "MMapFeatureInfo",
|
|
1275
1281
|
props: { results: {} },
|
|
1276
1282
|
setup(t) {
|
|
1277
1283
|
let n = s();
|
|
1278
|
-
return (r, i) => (
|
|
1284
|
+
return (r, i) => (z(), D("div", lt, [(z(!0), D(x, null, H(t.results, (t, i) => (z(), D("div", {
|
|
1279
1285
|
key: i,
|
|
1280
1286
|
class: "overflow-hidden rounded-2xl bg-surface-container"
|
|
1281
|
-
}, [
|
|
1287
|
+
}, [O("div", ut, [j(e, {
|
|
1282
1288
|
name: "layers",
|
|
1283
1289
|
size: 16,
|
|
1284
1290
|
class: "text-on-primary-container"
|
|
1285
|
-
}),
|
|
1291
|
+
}), O("span", dt, G(t.layer.title), 1)]), O("dl", ft, [(z(!0), D(x, null, H(t.fields, (e) => (z(), D("div", {
|
|
1286
1292
|
key: e.key,
|
|
1287
1293
|
class: "flex flex-col gap-0.5 border-b border-outline-variant py-1.5 last:border-b-0"
|
|
1288
|
-
}, [
|
|
1294
|
+
}, [O("dt", pt, G(e.label), 1), O("dd", mt, [U(r.$slots, "value", {
|
|
1289
1295
|
field: e,
|
|
1290
1296
|
result: t
|
|
1291
|
-
}, () => [e.value ? (
|
|
1297
|
+
}, () => [e.value ? (z(), D("span", ht, G(e.value), 1)) : (z(), D("span", gt, G(q(n).mapNoValue), 1))])])]))), 128))])]))), 128))]));
|
|
1292
1298
|
}
|
|
1293
|
-
}),
|
|
1299
|
+
}), vt = (e) => e.metadata, yt = /* @__PURE__ */ new Set([
|
|
1294
1300
|
"fill",
|
|
1295
1301
|
"line",
|
|
1296
1302
|
"circle",
|
|
1297
1303
|
"symbol",
|
|
1298
1304
|
"fill-extrusion",
|
|
1299
1305
|
"heatmap"
|
|
1300
|
-
]),
|
|
1301
|
-
let t = e.layers.filter((e) => e.type !== "background"), n = (e) => e?.base === !0 || typeof e?.base == "object" && e.base !== null ? e : void 0, r = (e) => Array.isArray(e?.children) ? e.children : [], i = new Set(t.flatMap((e) => n(
|
|
1306
|
+
]), bt = (e) => {
|
|
1307
|
+
let t = e.layers.filter((e) => e.type !== "background"), n = (e) => e?.base === !0 || typeof e?.base == "object" && e.base !== null ? e : void 0, r = (e) => Array.isArray(e?.children) ? e.children : [], i = new Set(t.flatMap((e) => n(vt(e)) ? r(vt(e)) : []));
|
|
1302
1308
|
return {
|
|
1303
1309
|
title: e.name,
|
|
1304
1310
|
groups: [],
|
|
1305
1311
|
layers: t.map((e) => {
|
|
1306
|
-
let t =
|
|
1312
|
+
let t = vt(e), a = n(t);
|
|
1307
1313
|
return {
|
|
1308
1314
|
id: e.id,
|
|
1309
1315
|
title: t?.title ?? e.id,
|
|
1310
1316
|
listed: !a && !i.has(e.id) && t?.listed !== !1,
|
|
1311
1317
|
base: a ? { image: t.base.image ?? t.image } : void 0,
|
|
1312
1318
|
children: r(t),
|
|
1313
|
-
identify:
|
|
1319
|
+
identify: yt.has(e.type) && !a && !i.has(e.id) ? {
|
|
1314
1320
|
format: {},
|
|
1315
1321
|
exclude: []
|
|
1316
1322
|
} : !1,
|
|
@@ -1319,9 +1325,9 @@ var Ce = 600, $ = /* @__PURE__ */ j({
|
|
|
1319
1325
|
})
|
|
1320
1326
|
};
|
|
1321
1327
|
};
|
|
1322
|
-
function
|
|
1328
|
+
function xt(e = {}) {
|
|
1323
1329
|
let t = e.legend ?? ((e, t) => {
|
|
1324
|
-
let n =
|
|
1330
|
+
let n = vt(e)?.legend;
|
|
1325
1331
|
if (n?.show === !1) return;
|
|
1326
1332
|
if (n?.wmslegend) return n.wmslegend;
|
|
1327
1333
|
if (!t?.includes("/services/styles/")) return;
|
|
@@ -1337,7 +1343,7 @@ function bt(e = {}) {
|
|
|
1337
1343
|
title: e.alias ?? e.name
|
|
1338
1344
|
})),
|
|
1339
1345
|
layers: e.layers.filter((e) => e.type !== "background").map((e) => {
|
|
1340
|
-
let r =
|
|
1346
|
+
let r = vt(e) ?? {}, i = { ...r.fields }, a = i.exclude ?? [];
|
|
1341
1347
|
delete i.exclude;
|
|
1342
1348
|
let o = {};
|
|
1343
1349
|
for (let [e, t] of Object.entries(i)) o[e] = {
|
|
@@ -1374,10 +1380,10 @@ function bt(e = {}) {
|
|
|
1374
1380
|
};
|
|
1375
1381
|
};
|
|
1376
1382
|
}
|
|
1377
|
-
function
|
|
1383
|
+
function St(e, t) {
|
|
1378
1384
|
return t?.label ?? e.charAt(0).toUpperCase() + e.slice(1);
|
|
1379
1385
|
}
|
|
1380
|
-
function
|
|
1386
|
+
function Ct(e, t) {
|
|
1381
1387
|
if (e == null || String(e).trim() === "") return "";
|
|
1382
1388
|
let n = String(e), r = typeof e == "number" ? e : Number(e);
|
|
1383
1389
|
if (t?.mask && !Number.isNaN(r)) {
|
|
@@ -1390,23 +1396,23 @@ function St(e, t) {
|
|
|
1390
1396
|
}
|
|
1391
1397
|
return t?.prefix && (n = `${t.prefix} ${n}`), t?.suffix && (n = `${n} ${t.suffix}`), n;
|
|
1392
1398
|
}
|
|
1393
|
-
var
|
|
1399
|
+
var wt = /* @__PURE__ */ new Set([
|
|
1394
1400
|
"coordinates",
|
|
1395
1401
|
"mapCoordinates",
|
|
1396
1402
|
"layerId",
|
|
1397
1403
|
"__layerMetadata"
|
|
1398
1404
|
]);
|
|
1399
|
-
function
|
|
1405
|
+
function Tt(e, t, n) {
|
|
1400
1406
|
let r = new Map((n?.layers ?? []).filter((t) => t.identify && e.getLayer(t.id)).map((e) => [e.id, e]));
|
|
1401
1407
|
if (!r.size) return [];
|
|
1402
1408
|
let i = [];
|
|
1403
1409
|
for (let n of e.queryRenderedFeatures(t, { layers: [...r.keys()] })) {
|
|
1404
1410
|
let e = r.get(n.layer.id);
|
|
1405
1411
|
if (!e || !e.identify) continue;
|
|
1406
|
-
let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) => !
|
|
1412
|
+
let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) => !wt.has(e) && !a.includes(e) && !t[e]?.hidden).map(([e, n]) => ({
|
|
1407
1413
|
key: e,
|
|
1408
|
-
label:
|
|
1409
|
-
value:
|
|
1414
|
+
label: St(e, t[e]),
|
|
1415
|
+
value: Ct(n, t[e])
|
|
1410
1416
|
}));
|
|
1411
1417
|
o.length && i.push({
|
|
1412
1418
|
layer: e,
|
|
@@ -1417,7 +1423,7 @@ function wt(e, t, n) {
|
|
|
1417
1423
|
return i;
|
|
1418
1424
|
}
|
|
1419
1425
|
// src/components/MMapIdentify.vue?vue&type=script&setup=true&lang.ts
|
|
1420
|
-
var
|
|
1426
|
+
var Et = { class: "hidden" }, Dt = /* @__PURE__ */ M({
|
|
1421
1427
|
inheritAttrs: !1,
|
|
1422
1428
|
__name: "MMapIdentify",
|
|
1423
1429
|
props: {
|
|
@@ -1436,11 +1442,11 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1436
1442
|
},
|
|
1437
1443
|
emits: ["identify"],
|
|
1438
1444
|
setup(e, { expose: t, emit: n }) {
|
|
1439
|
-
let r = e, i = n, { on: a, onReady: o, activeTool: s } = Z(), { model: c } =
|
|
1445
|
+
let r = e, i = n, { on: a, onReady: o, activeTool: s } = Z(), { model: c } = Q(), l = W([]), u = V([0, 0]), d = V(!1);
|
|
1440
1446
|
a("click", (e) => {
|
|
1441
1447
|
if (!r.enabled || s.value) return;
|
|
1442
1448
|
let t = e.target;
|
|
1443
|
-
l.value =
|
|
1449
|
+
l.value = Tt(t, e.point, c.value), u.value = [e.lngLat.lng, e.lngLat.lat], d.value = l.value.length > 0, i("identify", l.value, u.value);
|
|
1444
1450
|
});
|
|
1445
1451
|
function f() {
|
|
1446
1452
|
d.value = !1;
|
|
@@ -1462,38 +1468,38 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1462
1468
|
}
|
|
1463
1469
|
return o((e) => {
|
|
1464
1470
|
p = e, _();
|
|
1465
|
-
}), Y(c, _),
|
|
1471
|
+
}), Y(c, _), ne(() => {
|
|
1466
1472
|
m.forEach((e) => {
|
|
1467
1473
|
p?.off("mouseenter", e, h), p?.off("mouseleave", e, g);
|
|
1468
1474
|
});
|
|
1469
|
-
}), t({ close: f }), (t, n) => (
|
|
1475
|
+
}), t({ close: f }), (t, n) => (z(), D("div", Et, [e.marker && d.value ? (z(), T(Ae, {
|
|
1470
1476
|
key: 0,
|
|
1471
1477
|
"lng-lat": u.value
|
|
1472
|
-
}, null, 8, ["lng-lat"])) :
|
|
1478
|
+
}, null, 8, ["lng-lat"])) : E("", !0), e.popup && l.value.length ? (z(), T(Me, {
|
|
1473
1479
|
key: 1,
|
|
1474
1480
|
open: d.value,
|
|
1475
1481
|
"onUpdate:open": n[0] ||= (e) => d.value = e,
|
|
1476
1482
|
"lng-lat": u.value,
|
|
1477
1483
|
"max-width": "360px",
|
|
1478
|
-
offset: e.marker ? q(
|
|
1484
|
+
offset: e.marker ? q(Oe) : void 0
|
|
1479
1485
|
}, {
|
|
1480
|
-
default: X(() => [
|
|
1486
|
+
default: X(() => [O("div", F({ class: "max-h-80 overflow-y-auto" }, t.$attrs), [U(t.$slots, "default", {
|
|
1481
1487
|
results: l.value,
|
|
1482
1488
|
lngLat: u.value,
|
|
1483
1489
|
close: f
|
|
1484
|
-
}, () => [
|
|
1490
|
+
}, () => [j(_t, { results: l.value }, null, 8, ["results"])])], 16)]),
|
|
1485
1491
|
_: 3
|
|
1486
1492
|
}, 8, [
|
|
1487
1493
|
"open",
|
|
1488
1494
|
"lng-lat",
|
|
1489
1495
|
"offset"
|
|
1490
|
-
])) :
|
|
1496
|
+
])) : E("", !0)]));
|
|
1491
1497
|
}
|
|
1492
|
-
}),
|
|
1498
|
+
}), Ot = { class: "hidden" }, kt = [
|
|
1493
1499
|
"title",
|
|
1494
1500
|
"aria-label",
|
|
1495
1501
|
"aria-pressed"
|
|
1496
|
-
],
|
|
1502
|
+
], At = { class: "-mx-4 -mt-3 mb-1 bg-primary-container px-3 py-1.5 text-label-medium text-on-primary-container" }, jt = { class: "flex flex-col" }, Mt = { class: "text-label-small text-on-surface-variant" }, Nt = { class: "text-body-small text-on-surface" }, Pt = /* @__PURE__ */ M({
|
|
1497
1503
|
__name: "MMapHover",
|
|
1498
1504
|
props: {
|
|
1499
1505
|
modelValue: {
|
|
@@ -1507,7 +1513,7 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1507
1513
|
},
|
|
1508
1514
|
emits: ["update:modelValue"],
|
|
1509
1515
|
setup(t, { emit: n }) {
|
|
1510
|
-
let r = t, i = n, a = s(), { onReady: o } = Z(), { model: c } =
|
|
1516
|
+
let r = t, i = n, a = s(), { onReady: o } = Z(), { model: c } = Q(), l = w(() => (c.value?.layers ?? []).filter((e) => e.hover && e.hover.fields.length)), u = W(null), d = V([0, 0]), f = V(!1), p, m = [];
|
|
1511
1517
|
function h(e) {
|
|
1512
1518
|
let t = e.features?.[0], n = l.value.find((e) => e.id === t?.layer.id);
|
|
1513
1519
|
if (!t || !n || !n.hover) return;
|
|
@@ -1516,8 +1522,8 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1516
1522
|
layer: n,
|
|
1517
1523
|
fields: n.hover.fields.map((e) => ({
|
|
1518
1524
|
key: e.key,
|
|
1519
|
-
label:
|
|
1520
|
-
value:
|
|
1525
|
+
label: St(e.key, e),
|
|
1526
|
+
value: Ct(r[e.key], e)
|
|
1521
1527
|
})).filter((e) => e.value)
|
|
1522
1528
|
}, d.value = [e.lngLat.lng, e.lngLat.lat], f.value = !0;
|
|
1523
1529
|
}
|
|
@@ -1534,27 +1540,27 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1534
1540
|
}
|
|
1535
1541
|
o((e) => {
|
|
1536
1542
|
p = e, _();
|
|
1537
|
-
}), Y([() => r.modelValue, l], _),
|
|
1543
|
+
}), Y([() => r.modelValue, l], _), ne(() => {
|
|
1538
1544
|
for (let e of m) p?.off("mousemove", e, h), p?.off("mouseleave", e, g);
|
|
1539
1545
|
});
|
|
1540
|
-
let v =
|
|
1541
|
-
return (n, r) => (
|
|
1546
|
+
let v = w(() => r.control === !0 ? "top-right" : r.control || "top-right");
|
|
1547
|
+
return (n, r) => (z(), D("div", Ot, [t.control && l.value.length ? (z(), T(he, {
|
|
1542
1548
|
key: 0,
|
|
1543
1549
|
position: v.value
|
|
1544
1550
|
}, {
|
|
1545
|
-
default: X(() => [
|
|
1551
|
+
default: X(() => [O("button", {
|
|
1546
1552
|
type: "button",
|
|
1547
1553
|
class: "grid place-items-center",
|
|
1548
1554
|
title: q(a).mapHoverInfo,
|
|
1549
1555
|
"aria-label": q(a).mapHoverInfo,
|
|
1550
1556
|
"aria-pressed": t.modelValue,
|
|
1551
1557
|
onClick: r[0] ||= (e) => i("update:modelValue", !t.modelValue)
|
|
1552
|
-
}, [
|
|
1558
|
+
}, [j(e, {
|
|
1553
1559
|
name: "ads_click",
|
|
1554
1560
|
size: 20
|
|
1555
|
-
})], 8,
|
|
1561
|
+
})], 8, kt)]),
|
|
1556
1562
|
_: 1
|
|
1557
|
-
}, 8, ["position"])) :
|
|
1563
|
+
}, 8, ["position"])) : E("", !0), u.value ? (z(), T(Me, {
|
|
1558
1564
|
key: 1,
|
|
1559
1565
|
open: f.value,
|
|
1560
1566
|
"onUpdate:open": r[1] ||= (e) => f.value = e,
|
|
@@ -1565,48 +1571,48 @@ var Tt = { class: "hidden" }, Et = /* @__PURE__ */ j({
|
|
|
1565
1571
|
"max-width": "280px",
|
|
1566
1572
|
class: "m3-map-hover"
|
|
1567
1573
|
}, {
|
|
1568
|
-
default: X(() => [
|
|
1574
|
+
default: X(() => [O("p", At, G(u.value.layer.title), 1), O("dl", jt, [(z(!0), D(x, null, H(u.value.fields, (e) => (z(), D("div", {
|
|
1569
1575
|
key: e.key,
|
|
1570
1576
|
class: "border-b border-outline-variant py-1 last:border-b-0"
|
|
1571
|
-
}, [
|
|
1577
|
+
}, [O("dt", Mt, G(e.label), 1), O("dd", Nt, G(e.value), 1)]))), 128))])]),
|
|
1572
1578
|
_: 1
|
|
1573
|
-
}, 8, ["open", "lng-lat"])) :
|
|
1579
|
+
}, 8, ["open", "lng-lat"])) : E("", !0)]));
|
|
1574
1580
|
}
|
|
1575
|
-
}),
|
|
1576
|
-
function
|
|
1577
|
-
let n = (t[1] - e[1]) *
|
|
1578
|
-
return 2 *
|
|
1581
|
+
}), Ft = 6371008.8, It = Math.PI / 180;
|
|
1582
|
+
function Lt(e, t) {
|
|
1583
|
+
let n = (t[1] - e[1]) * It, r = (t[0] - e[0]) * It, i = Math.sin(n / 2) ** 2 + Math.cos(e[1] * It) * Math.cos(t[1] * It) * Math.sin(r / 2) ** 2;
|
|
1584
|
+
return 2 * Ft * Math.asin(Math.min(1, Math.sqrt(i)));
|
|
1579
1585
|
}
|
|
1580
|
-
function
|
|
1586
|
+
function Rt(e) {
|
|
1581
1587
|
let t = 0;
|
|
1582
|
-
for (let n = 1; n < e.length; n++) t +=
|
|
1588
|
+
for (let n = 1; n < e.length; n++) t += Lt(e[n - 1], e[n]);
|
|
1583
1589
|
return t;
|
|
1584
1590
|
}
|
|
1585
|
-
function
|
|
1591
|
+
function zt(e, t) {
|
|
1586
1592
|
let [n, r, i, a] = [
|
|
1587
|
-
e[0] *
|
|
1588
|
-
e[1] *
|
|
1589
|
-
t[0] *
|
|
1590
|
-
t[1] *
|
|
1593
|
+
e[0] * It,
|
|
1594
|
+
e[1] * It,
|
|
1595
|
+
t[0] * It,
|
|
1596
|
+
t[1] * It
|
|
1591
1597
|
], o = Math.cos(a) * Math.cos(i - n), s = Math.cos(a) * Math.sin(i - n), c = Math.atan2(Math.sin(r) + Math.sin(a), Math.sqrt((Math.cos(r) + o) ** 2 + s ** 2));
|
|
1592
|
-
return [(n + Math.atan2(s, Math.cos(r) + o)) /
|
|
1598
|
+
return [(n + Math.atan2(s, Math.cos(r) + o)) / It, c / It];
|
|
1593
1599
|
}
|
|
1594
|
-
function
|
|
1595
|
-
let t =
|
|
1600
|
+
function Bt(e) {
|
|
1601
|
+
let t = Vt(e), n = t.length - 1;
|
|
1596
1602
|
if (n <= 2) return 0;
|
|
1597
1603
|
let r = 0;
|
|
1598
1604
|
for (let e = 0; e < n; e++) {
|
|
1599
1605
|
let i = t[e], a = t[e + 1 === n ? 0 : e + 1], o = t[e + 2 >= n ? (e + 2) % n : e + 2];
|
|
1600
|
-
r += (o[0] - i[0]) *
|
|
1606
|
+
r += (o[0] - i[0]) * It * Math.sin(a[1] * It);
|
|
1601
1607
|
}
|
|
1602
|
-
return Math.abs(r *
|
|
1608
|
+
return Math.abs(r * Ft * Ft / 2);
|
|
1603
1609
|
}
|
|
1604
|
-
function
|
|
1610
|
+
function Vt(e) {
|
|
1605
1611
|
let t = e[0], n = e[e.length - 1];
|
|
1606
1612
|
return t && n && (t[0] !== n[0] || t[1] !== n[1]) ? [...e, t] : e;
|
|
1607
1613
|
}
|
|
1608
|
-
function
|
|
1609
|
-
let t =
|
|
1614
|
+
function Ht(e) {
|
|
1615
|
+
let t = Vt(e), n = 0, r = 0, i = 0;
|
|
1610
1616
|
for (let e = 0; e < t.length - 1; e++) {
|
|
1611
1617
|
let [a, o] = t[e], [s, c] = t[e + 1], l = a * c - s * o;
|
|
1612
1618
|
n += l, r += (a + s) * l, i += (o + c) * l;
|
|
@@ -1618,11 +1624,11 @@ function Vt(e) {
|
|
|
1618
1624
|
return [r / (3 * n), i / (3 * n)];
|
|
1619
1625
|
}
|
|
1620
1626
|
// src/components/MMapMeasure.vue?vue&type=script&setup=true&lang.ts
|
|
1621
|
-
var
|
|
1627
|
+
var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "aria-pressed"], Kt = ["title", "disabled"], qt = [
|
|
1622
1628
|
"aria-label",
|
|
1623
1629
|
"title",
|
|
1624
1630
|
"onClick"
|
|
1625
|
-
],
|
|
1631
|
+
], Jt = /* @__PURE__ */ M({
|
|
1626
1632
|
__name: "MMapMeasure",
|
|
1627
1633
|
props: {
|
|
1628
1634
|
modelValue: { default: null },
|
|
@@ -1633,14 +1639,14 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1633
1639
|
},
|
|
1634
1640
|
emits: ["update:modelValue", "change"],
|
|
1635
1641
|
setup(t, { expose: n, emit: r }) {
|
|
1636
|
-
let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } = Z(), f = l(["primary", "surface"]),
|
|
1637
|
-
done: `${
|
|
1638
|
-
draft: `${
|
|
1639
|
-
handles: `${
|
|
1640
|
-
}, g = `${h.handles}-vertex`, _ = `${h.handles}-midpoint`, v = [], y = [],
|
|
1642
|
+
let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } = Z(), f = l(["primary", "surface"]), p = `m3-measure-${ae()}`, h = {
|
|
1643
|
+
done: `${p}-done`,
|
|
1644
|
+
draft: `${p}-draft`,
|
|
1645
|
+
handles: `${p}-handles`
|
|
1646
|
+
}, g = `${h.handles}-vertex`, _ = `${h.handles}-midpoint`, v = [], y = [], b = null, S = !1, C = null, k = 0, M, N = V(null), P = V(0), ee = W([]), F = () => typeof document < "u" && document.documentElement.lang || void 0, I = (e, t) => new Intl.NumberFormat(F(), {
|
|
1641
1647
|
minimumFractionDigits: t,
|
|
1642
1648
|
maximumFractionDigits: t
|
|
1643
|
-
}).format(e),
|
|
1649
|
+
}).format(e), te = (e) => e === 0 ? "" : e < 1e3 ? `${I(Math.round(e), 0)} m` : `${I(e / 1e3, 2)} km`, R = (e) => e >= 1e6 ? `${I(e / 1e6, 2)} km²` : e >= 1e4 ? `${I(e / 1e4, 2)} ha` : `${I(Math.round(e), 0)} m²`, re = (e, t = {}) => ({
|
|
1644
1650
|
type: "Feature",
|
|
1645
1651
|
geometry: {
|
|
1646
1652
|
type: "Point",
|
|
@@ -1648,8 +1654,8 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1648
1654
|
},
|
|
1649
1655
|
properties: t
|
|
1650
1656
|
});
|
|
1651
|
-
function
|
|
1652
|
-
let i = e.map((e) =>
|
|
1657
|
+
function B(e, t, n, r) {
|
|
1658
|
+
let i = e.map((e) => re(e)), a = [];
|
|
1653
1659
|
if (e.length < 2) return {
|
|
1654
1660
|
features: i,
|
|
1655
1661
|
labels: a
|
|
@@ -1664,10 +1670,10 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1664
1670
|
});
|
|
1665
1671
|
let s = (e) => {
|
|
1666
1672
|
for (let t = 0; t < e.length - 1; t++) {
|
|
1667
|
-
let r =
|
|
1673
|
+
let r = te(Lt(e[t], e[t + 1]));
|
|
1668
1674
|
r && a.push({
|
|
1669
1675
|
key: `${n}-s${t}`,
|
|
1670
|
-
at:
|
|
1676
|
+
at: zt(e[t], e[t + 1]),
|
|
1671
1677
|
text: r,
|
|
1672
1678
|
kind: "segment"
|
|
1673
1679
|
});
|
|
@@ -1676,12 +1682,12 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1676
1682
|
if (t === "distance") s(e), a.push({
|
|
1677
1683
|
key: `${n}-t`,
|
|
1678
1684
|
at: e[e.length - 1],
|
|
1679
|
-
text: `${o.mapTotal}: ${
|
|
1685
|
+
text: `${o.mapTotal}: ${te(Rt(e))}`,
|
|
1680
1686
|
kind: "total",
|
|
1681
1687
|
m: r
|
|
1682
1688
|
});
|
|
1683
1689
|
else if (e.length >= 3) {
|
|
1684
|
-
let t =
|
|
1690
|
+
let t = Vt(e);
|
|
1685
1691
|
i.push({
|
|
1686
1692
|
type: "Feature",
|
|
1687
1693
|
geometry: {
|
|
@@ -1691,15 +1697,15 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1691
1697
|
properties: {}
|
|
1692
1698
|
}), s(t), a.push({
|
|
1693
1699
|
key: `${n}-a`,
|
|
1694
|
-
at:
|
|
1695
|
-
text:
|
|
1700
|
+
at: Ht(t),
|
|
1701
|
+
text: R(Bt(t)),
|
|
1696
1702
|
kind: "area",
|
|
1697
1703
|
m: r
|
|
1698
1704
|
});
|
|
1699
1705
|
} else a.push({
|
|
1700
1706
|
key: `${n}-t`,
|
|
1701
1707
|
at: e[e.length - 1],
|
|
1702
|
-
text:
|
|
1708
|
+
text: te(Rt(e)),
|
|
1703
1709
|
kind: "total",
|
|
1704
1710
|
m: r
|
|
1705
1711
|
});
|
|
@@ -1708,41 +1714,41 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1708
1714
|
labels: a
|
|
1709
1715
|
};
|
|
1710
1716
|
}
|
|
1711
|
-
let
|
|
1717
|
+
let ie = (e) => ({
|
|
1712
1718
|
type: "FeatureCollection",
|
|
1713
1719
|
features: e
|
|
1714
|
-
}),
|
|
1715
|
-
function
|
|
1720
|
+
}), U = (e, t) => (M?.getSource(e))?.setData(ie(t));
|
|
1721
|
+
function K() {
|
|
1716
1722
|
if (!M) return;
|
|
1717
|
-
let e = v.map((e, t) =>
|
|
1723
|
+
let e = v.map((e, t) => B(e.points, e.mode, `m${t}`, t)), t = N.value && y.length ? B(b ? [...y, b] : y, N.value, "draft") : {
|
|
1718
1724
|
features: [],
|
|
1719
1725
|
labels: []
|
|
1720
1726
|
};
|
|
1721
|
-
|
|
1727
|
+
U(h.done, e.flatMap((e) => e.features)), U(h.draft, t.features);
|
|
1722
1728
|
let n = [];
|
|
1723
1729
|
N.value || v.forEach((e, t) => {
|
|
1724
|
-
(e.closed ? e.points.slice(0, -1) : e.points).forEach((e, r) => n.push(
|
|
1730
|
+
(e.closed ? e.points.slice(0, -1) : e.points).forEach((e, r) => n.push(re(e, {
|
|
1725
1731
|
handle: "vertex",
|
|
1726
1732
|
m: t,
|
|
1727
1733
|
v: r
|
|
1728
1734
|
})));
|
|
1729
|
-
for (let r = 0; r < e.points.length - 1; r++) n.push(
|
|
1735
|
+
for (let r = 0; r < e.points.length - 1; r++) n.push(re(zt(e.points[r], e.points[r + 1]), {
|
|
1730
1736
|
handle: "midpoint",
|
|
1731
1737
|
m: t,
|
|
1732
1738
|
after: r
|
|
1733
1739
|
}));
|
|
1734
|
-
}),
|
|
1740
|
+
}), U(h.handles, n), ee.value = [...e.flatMap((e) => e.labels), ...t.labels];
|
|
1735
1741
|
}
|
|
1736
|
-
function
|
|
1742
|
+
function J() {
|
|
1737
1743
|
P.value = v.length, a("change", v.map((e) => ({
|
|
1738
1744
|
mode: e.mode,
|
|
1739
1745
|
points: e.points.map((e) => [...e]),
|
|
1740
1746
|
closed: e.closed,
|
|
1741
|
-
length:
|
|
1742
|
-
...e.mode === "area" || e.closed ? { area:
|
|
1747
|
+
length: Rt(e.points),
|
|
1748
|
+
...e.mode === "area" || e.closed ? { area: Bt(e.points) } : {}
|
|
1743
1749
|
})));
|
|
1744
1750
|
}
|
|
1745
|
-
let
|
|
1751
|
+
let oe = (e) => [
|
|
1746
1752
|
"==",
|
|
1747
1753
|
["geometry-type"],
|
|
1748
1754
|
e
|
|
@@ -1762,7 +1768,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1762
1768
|
if (!M) return;
|
|
1763
1769
|
for (let e of Object.values(h)) M.getSource(e) || M.addSource(e, {
|
|
1764
1770
|
type: "geojson",
|
|
1765
|
-
data:
|
|
1771
|
+
data: ie([])
|
|
1766
1772
|
});
|
|
1767
1773
|
let e = ce(), t = (e) => {
|
|
1768
1774
|
M.getLayer(e.id) || M.addLayer(e);
|
|
@@ -1771,7 +1777,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1771
1777
|
id: `${n}-fill`,
|
|
1772
1778
|
type: "fill",
|
|
1773
1779
|
source: n,
|
|
1774
|
-
filter:
|
|
1780
|
+
filter: oe("Polygon"),
|
|
1775
1781
|
paint: {
|
|
1776
1782
|
...e.fill,
|
|
1777
1783
|
"fill-opacity": r ? .15 : .2
|
|
@@ -1794,7 +1800,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1794
1800
|
id: `${n}-points`,
|
|
1795
1801
|
type: "circle",
|
|
1796
1802
|
source: n,
|
|
1797
|
-
filter:
|
|
1803
|
+
filter: oe("Point"),
|
|
1798
1804
|
paint: {
|
|
1799
1805
|
...e.vertices,
|
|
1800
1806
|
"circle-radius": 5,
|
|
@@ -1849,11 +1855,11 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1849
1855
|
return;
|
|
1850
1856
|
}
|
|
1851
1857
|
}
|
|
1852
|
-
y.push(ue(e)),
|
|
1858
|
+
y.push(ue(e)), K();
|
|
1853
1859
|
}
|
|
1854
1860
|
function fe(e) {
|
|
1855
|
-
|
|
1856
|
-
|
|
1861
|
+
b = ue(e), k ||= requestAnimationFrame(() => {
|
|
1862
|
+
k = 0, K();
|
|
1857
1863
|
});
|
|
1858
1864
|
}
|
|
1859
1865
|
function pe(e) {
|
|
@@ -1861,10 +1867,10 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1861
1867
|
let t = M.project(y[y.length - 1]), n = M.project(y[y.length - 2]);
|
|
1862
1868
|
Math.hypot(t.x - n.x, t.y - n.y) < 10 && y.pop(), Q();
|
|
1863
1869
|
}
|
|
1864
|
-
function
|
|
1870
|
+
function me(e) {
|
|
1865
1871
|
e.key === "Enter" && Q();
|
|
1866
1872
|
}
|
|
1867
|
-
|
|
1873
|
+
m(() => !!N.value, () => Q(!0));
|
|
1868
1874
|
let ge = () => typeof navigator < "u" ? navigator.keyboard : void 0, _e = !1;
|
|
1869
1875
|
function ve() {
|
|
1870
1876
|
N.value && document.fullscreenElement && ge()?.lock && ge().lock(["Escape"]).then(() => {
|
|
@@ -1885,24 +1891,24 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1885
1891
|
function xe(e) {
|
|
1886
1892
|
if (M) {
|
|
1887
1893
|
if (N.value === e) return Q();
|
|
1888
|
-
N.value && Q(), N.value = e, d.value = "measure", y = [],
|
|
1894
|
+
N.value && Q(), N.value = e, d.value = "measure", y = [], b = null, M.getCanvas().style.cursor = "crosshair", M.doubleClickZoom.disable(), M.on("click", de), M.on("mousemove", fe), M.on("dblclick", pe), document.addEventListener("keydown", me), document.addEventListener("fullscreenchange", ve), ve(), K(), i.modelValue !== e && a("update:modelValue", e);
|
|
1889
1895
|
}
|
|
1890
1896
|
}
|
|
1891
1897
|
function Q(e = !1) {
|
|
1892
1898
|
if (!M || !N.value) return;
|
|
1893
|
-
cancelAnimationFrame(
|
|
1899
|
+
cancelAnimationFrame(k), k = 0;
|
|
1894
1900
|
let t = y.length >= 3 && (S || N.value === "area");
|
|
1895
1901
|
y.length >= 2 && v.push({
|
|
1896
1902
|
mode: N.value,
|
|
1897
1903
|
points: t ? [...y, [...y[0]]] : y,
|
|
1898
1904
|
closed: t
|
|
1899
|
-
}), y = [],
|
|
1905
|
+
}), y = [], b = null, S = !1, N.value = null, d.value === "measure" && (d.value = null), M.getCanvas().style.cursor = "", M.doubleClickZoom.enable(), M.off("click", de), M.off("mousemove", fe), M.off("dblclick", pe), document.removeEventListener("keydown", me), document.removeEventListener("fullscreenchange", ve), e && _e ? be() : ye(), K(), J(), i.modelValue !== null && a("update:modelValue", null);
|
|
1900
1906
|
}
|
|
1901
1907
|
function Se(e) {
|
|
1902
|
-
v[e] && (v.splice(e, 1),
|
|
1908
|
+
v[e] && (v.splice(e, 1), K(), J());
|
|
1903
1909
|
}
|
|
1904
1910
|
function Ce() {
|
|
1905
|
-
N.value && Q(), v.length = 0,
|
|
1911
|
+
N.value && Q(), v.length = 0, K(), J();
|
|
1906
1912
|
}
|
|
1907
1913
|
function $(e) {
|
|
1908
1914
|
let t = e.features?.[0];
|
|
@@ -1911,39 +1917,39 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1911
1917
|
let n = t.properties.m, r = v[n];
|
|
1912
1918
|
if (!r) return;
|
|
1913
1919
|
let i = t.properties.v;
|
|
1914
|
-
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0, ue(e))),
|
|
1920
|
+
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0, ue(e))), C = {
|
|
1915
1921
|
m: n,
|
|
1916
1922
|
v: i
|
|
1917
1923
|
}, d.value = "measure", M.getCanvas().style.cursor = "grabbing";
|
|
1918
1924
|
let a = e.type === "touchstart";
|
|
1919
|
-
a && M.dragPan.disable(), M.on(a ? "touchmove" : "mousemove", we), M.once(a ? "touchend" : "mouseup", Te),
|
|
1925
|
+
a && M.dragPan.disable(), M.on(a ? "touchmove" : "mousemove", we), M.once(a ? "touchend" : "mouseup", Te), K();
|
|
1920
1926
|
}
|
|
1921
1927
|
function we(e) {
|
|
1922
|
-
if (!
|
|
1923
|
-
let t = v[
|
|
1928
|
+
if (!C) return;
|
|
1929
|
+
let t = v[C.m];
|
|
1924
1930
|
if (!t) return;
|
|
1925
1931
|
let n = ue(e);
|
|
1926
|
-
t.points[
|
|
1932
|
+
t.points[C.v] = n, t.closed && C.v === 0 && (t.points[t.points.length - 1] = n), K();
|
|
1927
1933
|
}
|
|
1928
1934
|
function Te() {
|
|
1929
|
-
M && (
|
|
1935
|
+
M && (C = null, M.off("mousemove", we), M.off("touchmove", we), M.dragPan.enable(), M.getCanvas().style.cursor = "", J(), setTimeout(() => {
|
|
1930
1936
|
d.value === "measure" && !N.value && (d.value = null);
|
|
1931
1937
|
}));
|
|
1932
1938
|
}
|
|
1933
1939
|
let Ee = () => {
|
|
1934
|
-
M && !
|
|
1940
|
+
M && !C && !N.value && (M.getCanvas().style.cursor = "grab");
|
|
1935
1941
|
}, De = () => {
|
|
1936
|
-
M && !
|
|
1942
|
+
M && !C && !N.value && (M.getCanvas().style.cursor = "");
|
|
1937
1943
|
};
|
|
1938
1944
|
c((e) => {
|
|
1939
1945
|
M = e, le();
|
|
1940
1946
|
for (let t of [g, _]) e.on("mousedown", t, $), e.on("touchstart", t, $), e.on("mouseenter", t, Ee), e.on("mouseleave", t, De);
|
|
1941
1947
|
i.modelValue && xe(i.modelValue);
|
|
1942
1948
|
}), Y(u, () => {
|
|
1943
|
-
le(),
|
|
1949
|
+
le(), K();
|
|
1944
1950
|
}), Y(() => i.modelValue, (e) => {
|
|
1945
1951
|
e && e !== N.value ? xe(e) : !e && N.value && Q();
|
|
1946
|
-
}),
|
|
1952
|
+
}), ne(() => {
|
|
1947
1953
|
if (!M) return;
|
|
1948
1954
|
N.value && Q();
|
|
1949
1955
|
for (let e of [g, _]) M.off("mousedown", e, $), M.off("touchstart", e, $), M.off("mouseenter", e, Ee), M.off("mouseleave", e, De);
|
|
@@ -1959,71 +1965,71 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
1959
1965
|
for (let t of e) M.getLayer(t) && M.removeLayer(t);
|
|
1960
1966
|
for (let e of Object.values(h)) M.getSource(e) && M.removeSource(e);
|
|
1961
1967
|
});
|
|
1962
|
-
let Oe =
|
|
1968
|
+
let Oe = w(() => i.control === !0 ? "top-right" : i.control || "top-right");
|
|
1963
1969
|
return n({
|
|
1964
1970
|
start: xe,
|
|
1965
1971
|
finish: Q,
|
|
1966
1972
|
clear: Ce,
|
|
1967
1973
|
remove: Se
|
|
1968
|
-
}), (n, r) => (
|
|
1974
|
+
}), (n, r) => (z(), D("div", Ut, [t.control ? (z(), T(he, {
|
|
1969
1975
|
key: 0,
|
|
1970
1976
|
position: Oe.value
|
|
1971
1977
|
}, {
|
|
1972
1978
|
default: X(() => [
|
|
1973
|
-
|
|
1979
|
+
O("button", {
|
|
1974
1980
|
type: "button",
|
|
1975
1981
|
class: "grid place-items-center",
|
|
1976
1982
|
title: q(o).mapMeasureDistance,
|
|
1977
1983
|
"aria-pressed": N.value === "distance",
|
|
1978
1984
|
onClick: r[0] ||= (e) => xe("distance")
|
|
1979
|
-
}, [
|
|
1985
|
+
}, [j(e, {
|
|
1980
1986
|
name: "straighten",
|
|
1981
1987
|
size: 20
|
|
1982
|
-
})], 8,
|
|
1983
|
-
|
|
1988
|
+
})], 8, Wt),
|
|
1989
|
+
O("button", {
|
|
1984
1990
|
type: "button",
|
|
1985
1991
|
class: "grid place-items-center",
|
|
1986
1992
|
title: q(o).mapMeasureArea,
|
|
1987
1993
|
"aria-pressed": N.value === "area",
|
|
1988
1994
|
onClick: r[1] ||= (e) => xe("area")
|
|
1989
|
-
}, [
|
|
1990
|
-
name: "
|
|
1995
|
+
}, [j(e, {
|
|
1996
|
+
name: "square_foot",
|
|
1991
1997
|
size: 20
|
|
1992
|
-
})], 8,
|
|
1993
|
-
|
|
1998
|
+
})], 8, Gt),
|
|
1999
|
+
O("button", {
|
|
1994
2000
|
type: "button",
|
|
1995
2001
|
class: "grid place-items-center",
|
|
1996
2002
|
title: q(o).mapClearMeasurements,
|
|
1997
2003
|
disabled: !P.value && !N.value,
|
|
1998
2004
|
onClick: Ce
|
|
1999
|
-
}, [
|
|
2005
|
+
}, [j(e, {
|
|
2000
2006
|
name: "delete",
|
|
2001
2007
|
size: 20
|
|
2002
|
-
})], 8,
|
|
2008
|
+
})], 8, Kt)
|
|
2003
2009
|
]),
|
|
2004
2010
|
_: 1
|
|
2005
|
-
}, 8, ["position"])) :
|
|
2011
|
+
}, 8, ["position"])) : E("", !0), (z(!0), D(x, null, H(ee.value, (t) => (z(), T(Ae, {
|
|
2006
2012
|
key: t.key,
|
|
2007
2013
|
"lng-lat": t.at,
|
|
2008
2014
|
anchor: t.kind === "area" ? "center" : "top",
|
|
2009
2015
|
offset: t.kind === "area" ? [0, 0] : [0, 8],
|
|
2010
2016
|
class: "pointer-events-none"
|
|
2011
2017
|
}, {
|
|
2012
|
-
default: X(() => [
|
|
2018
|
+
default: X(() => [O("span", { class: L(["flex items-center gap-1 whitespace-nowrap rounded-full py-0.5 shadow-elevation-1", [t.kind === "segment" ? "bg-surface-container-highest text-label-small text-on-surface" : "bg-primary text-label-medium text-on-primary", t.m === void 0 ? "px-2" : "pr-0.5 pl-2"]]) }, [A(G(t.text) + " ", 1), t.m === void 0 ? E("", !0) : (z(), D("button", {
|
|
2013
2019
|
key: 0,
|
|
2014
2020
|
type: "button",
|
|
2015
2021
|
class: "pointer-events-auto grid size-5 cursor-pointer place-items-center rounded-full hover:bg-on-primary/12 focus-visible:outline-2 focus-visible:outline-on-primary",
|
|
2016
2022
|
"aria-label": q(o).mapDeleteMeasurement,
|
|
2017
2023
|
title: q(o).mapDeleteMeasurement,
|
|
2018
|
-
onClick:
|
|
2019
|
-
onPointerdown: r[2] ||=
|
|
2020
|
-
onMousedown: r[3] ||=
|
|
2021
|
-
onTouchstart: r[4] ||=
|
|
2022
|
-
onDblclick: r[5] ||=
|
|
2023
|
-
}, [
|
|
2024
|
+
onClick: se((e) => Se(t.m), ["stop"]),
|
|
2025
|
+
onPointerdown: r[2] ||= se(() => {}, ["stop"]),
|
|
2026
|
+
onMousedown: r[3] ||= se(() => {}, ["stop"]),
|
|
2027
|
+
onTouchstart: r[4] ||= se(() => {}, ["stop"]),
|
|
2028
|
+
onDblclick: r[5] ||= se(() => {}, ["stop"])
|
|
2029
|
+
}, [j(e, {
|
|
2024
2030
|
name: "close",
|
|
2025
2031
|
size: 14
|
|
2026
|
-
})], 40,
|
|
2032
|
+
})], 40, qt))], 2)]),
|
|
2027
2033
|
_: 2
|
|
2028
2034
|
}, 1032, [
|
|
2029
2035
|
"lng-lat",
|
|
@@ -2031,16 +2037,16 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2031
2037
|
"offset"
|
|
2032
2038
|
]))), 128))]));
|
|
2033
2039
|
}
|
|
2034
|
-
}),
|
|
2040
|
+
}), Yt = { class: "hidden" }, Xt = [
|
|
2035
2041
|
"title",
|
|
2036
2042
|
"aria-label",
|
|
2037
2043
|
"aria-pressed",
|
|
2038
2044
|
"onClick"
|
|
2039
|
-
],
|
|
2045
|
+
], Zt = [
|
|
2040
2046
|
"title",
|
|
2041
2047
|
"aria-label",
|
|
2042
2048
|
"disabled"
|
|
2043
|
-
],
|
|
2049
|
+
], Qt = "draw", $t = 6, en = /* @__PURE__ */ M({
|
|
2044
2050
|
__name: "MMapDraw",
|
|
2045
2051
|
props: {
|
|
2046
2052
|
modelValue: {},
|
|
@@ -2071,32 +2077,32 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2071
2077
|
"secondary",
|
|
2072
2078
|
"tertiary",
|
|
2073
2079
|
"surface"
|
|
2074
|
-
]),
|
|
2075
|
-
shapes: `${
|
|
2076
|
-
draft: `${
|
|
2077
|
-
handles: `${
|
|
2080
|
+
]), p = `m3-draw-${ae()}`, h = {
|
|
2081
|
+
shapes: `${p}-shapes`,
|
|
2082
|
+
draft: `${p}-draft`,
|
|
2083
|
+
handles: `${p}-handles`
|
|
2078
2084
|
}, g = [
|
|
2079
2085
|
`${h.shapes}-fill`,
|
|
2080
2086
|
`${h.shapes}-line`,
|
|
2081
2087
|
`${h.shapes}-point`
|
|
2082
|
-
], _ = `${h.handles}-vertex`, v = `${h.handles}-midpoint`, y = [],
|
|
2083
|
-
function
|
|
2084
|
-
y =
|
|
2088
|
+
], _ = `${h.handles}-vertex`, v = `${h.handles}-midpoint`, y = [], b = "", S = 1, C = [], O = null, k = null, A = 0, M, N = V(null), P = V(null), ee = (e) => JSON.parse(JSON.stringify(e)), F = (e) => e === null ? void 0 : y.find((t) => t.id === e);
|
|
2089
|
+
function I(e) {
|
|
2090
|
+
y = ee(e?.features ?? []);
|
|
2085
2091
|
for (let e of y) (e.id === void 0 || e.id === null) && (e.id = Q());
|
|
2086
|
-
P.value !== null && !
|
|
2092
|
+
P.value !== null && !F(P.value) && (P.value = null);
|
|
2087
2093
|
}
|
|
2088
|
-
function
|
|
2094
|
+
function L() {
|
|
2089
2095
|
let e = {
|
|
2090
2096
|
type: "FeatureCollection",
|
|
2091
|
-
features:
|
|
2097
|
+
features: ee(y)
|
|
2092
2098
|
};
|
|
2093
|
-
|
|
2099
|
+
b = JSON.stringify(e.features), a("update:modelValue", e);
|
|
2094
2100
|
}
|
|
2095
|
-
function
|
|
2101
|
+
function te(e) {
|
|
2096
2102
|
let t = e.geometry;
|
|
2097
2103
|
return t.type === "Point" ? [t.coordinates] : t.type === "LineString" ? t.coordinates : t.type === "Polygon" ? (t.coordinates[0] ?? []).slice(0, -1) : null;
|
|
2098
2104
|
}
|
|
2099
|
-
function
|
|
2105
|
+
function R(e, t) {
|
|
2100
2106
|
let n = e.geometry;
|
|
2101
2107
|
if (n.type === "Point") n.coordinates = t[0];
|
|
2102
2108
|
else if (n.type === "LineString") n.coordinates = t;
|
|
@@ -2105,20 +2111,20 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2105
2111
|
e[0] = [...t, [...t[0]]];
|
|
2106
2112
|
}
|
|
2107
2113
|
}
|
|
2108
|
-
let
|
|
2114
|
+
let re = (e) => e.geometry.type === "Polygon" ? 3 : e.geometry.type === "LineString" ? 2 : 1, B = (e, t = {}) => ({
|
|
2109
2115
|
type: "Feature",
|
|
2110
2116
|
geometry: {
|
|
2111
2117
|
type: "Point",
|
|
2112
2118
|
coordinates: e
|
|
2113
2119
|
},
|
|
2114
2120
|
properties: t
|
|
2115
|
-
}),
|
|
2121
|
+
}), ie = (e) => ({
|
|
2116
2122
|
type: "FeatureCollection",
|
|
2117
2123
|
features: e
|
|
2118
|
-
}),
|
|
2119
|
-
function
|
|
2124
|
+
}), U = (e, t) => (M?.getSource(e))?.setData(ie(t));
|
|
2125
|
+
function W() {
|
|
2120
2126
|
if (!M) return;
|
|
2121
|
-
|
|
2127
|
+
U(h.shapes, y.map((e) => ({
|
|
2122
2128
|
type: "Feature",
|
|
2123
2129
|
geometry: e.geometry,
|
|
2124
2130
|
properties: {
|
|
@@ -2128,9 +2134,9 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2128
2134
|
}
|
|
2129
2135
|
})));
|
|
2130
2136
|
let e = [];
|
|
2131
|
-
if (N.value && N.value !== "point" &&
|
|
2132
|
-
let t = O ? [...
|
|
2133
|
-
|
|
2137
|
+
if (N.value && N.value !== "point" && C.length) {
|
|
2138
|
+
let t = O ? [...C, O] : C;
|
|
2139
|
+
C.forEach((t) => e.push(B(t))), t.length >= 2 && e.push({
|
|
2134
2140
|
type: "Feature",
|
|
2135
2141
|
geometry: {
|
|
2136
2142
|
type: "LineString",
|
|
@@ -2146,32 +2152,32 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2146
2152
|
properties: {}
|
|
2147
2153
|
});
|
|
2148
2154
|
}
|
|
2149
|
-
|
|
2150
|
-
let t = [], n =
|
|
2151
|
-
if (n && r && (r.forEach((e, n) => t.push(
|
|
2155
|
+
U(h.draft, e);
|
|
2156
|
+
let t = [], n = F(P.value), r = n && !N.value && i.editable ? te(n) : null;
|
|
2157
|
+
if (n && r && (r.forEach((e, n) => t.push(B(e, {
|
|
2152
2158
|
handle: "vertex",
|
|
2153
2159
|
v: n
|
|
2154
2160
|
}))), n.geometry.type !== "Point")) {
|
|
2155
2161
|
let e = n.geometry.type === "Polygon" ? [...r, r[0]] : r;
|
|
2156
|
-
for (let n = 0; n < e.length - 1; n++) t.push(
|
|
2162
|
+
for (let n = 0; n < e.length - 1; n++) t.push(B(zt(e[n], e[n + 1]), {
|
|
2157
2163
|
handle: "midpoint",
|
|
2158
2164
|
after: n
|
|
2159
2165
|
}));
|
|
2160
2166
|
}
|
|
2161
|
-
|
|
2167
|
+
U(h.handles, t);
|
|
2162
2168
|
}
|
|
2163
|
-
function
|
|
2164
|
-
|
|
2165
|
-
|
|
2169
|
+
function G() {
|
|
2170
|
+
A ||= requestAnimationFrame(() => {
|
|
2171
|
+
A = 0, W();
|
|
2166
2172
|
});
|
|
2167
2173
|
}
|
|
2168
|
-
let
|
|
2174
|
+
let K = (...e) => [
|
|
2169
2175
|
"match",
|
|
2170
2176
|
["geometry-type"],
|
|
2171
2177
|
e,
|
|
2172
2178
|
!0,
|
|
2173
2179
|
!1
|
|
2174
|
-
],
|
|
2180
|
+
], J = [
|
|
2175
2181
|
"==",
|
|
2176
2182
|
["get", "__draw_selected"],
|
|
2177
2183
|
!0
|
|
@@ -2183,7 +2189,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2183
2189
|
"fill-color": e,
|
|
2184
2190
|
"fill-opacity": [
|
|
2185
2191
|
"case",
|
|
2186
|
-
|
|
2192
|
+
J,
|
|
2187
2193
|
.3,
|
|
2188
2194
|
.18
|
|
2189
2195
|
]
|
|
@@ -2192,7 +2198,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2192
2198
|
"line-color": e,
|
|
2193
2199
|
"line-width": [
|
|
2194
2200
|
"case",
|
|
2195
|
-
|
|
2201
|
+
J,
|
|
2196
2202
|
4,
|
|
2197
2203
|
2.5
|
|
2198
2204
|
]
|
|
@@ -2201,7 +2207,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2201
2207
|
"circle-color": e,
|
|
2202
2208
|
"circle-radius": [
|
|
2203
2209
|
"case",
|
|
2204
|
-
|
|
2210
|
+
J,
|
|
2205
2211
|
8,
|
|
2206
2212
|
6
|
|
2207
2213
|
],
|
|
@@ -2223,7 +2229,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2223
2229
|
if (!M) return;
|
|
2224
2230
|
for (let e of Object.values(h)) M.getSource(e) || M.addSource(e, {
|
|
2225
2231
|
type: "geojson",
|
|
2226
|
-
data:
|
|
2232
|
+
data: ie([])
|
|
2227
2233
|
});
|
|
2228
2234
|
let e = oe(), t = (e) => {
|
|
2229
2235
|
M.getLayer(e.id) || M.addLayer(e);
|
|
@@ -2232,31 +2238,31 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2232
2238
|
id: g[0],
|
|
2233
2239
|
type: "fill",
|
|
2234
2240
|
source: h.shapes,
|
|
2235
|
-
filter:
|
|
2241
|
+
filter: K("Polygon", "MultiPolygon"),
|
|
2236
2242
|
paint: e.fill
|
|
2237
2243
|
}), t({
|
|
2238
2244
|
id: g[1],
|
|
2239
2245
|
type: "line",
|
|
2240
2246
|
source: h.shapes,
|
|
2241
|
-
filter:
|
|
2247
|
+
filter: K("LineString", "MultiLineString", "Polygon", "MultiPolygon"),
|
|
2242
2248
|
paint: e.line
|
|
2243
2249
|
}), t({
|
|
2244
2250
|
id: g[2],
|
|
2245
2251
|
type: "circle",
|
|
2246
2252
|
source: h.shapes,
|
|
2247
|
-
filter:
|
|
2253
|
+
filter: K("Point", "MultiPoint"),
|
|
2248
2254
|
paint: e.point
|
|
2249
2255
|
}), t({
|
|
2250
2256
|
id: `${h.draft}-fill`,
|
|
2251
2257
|
type: "fill",
|
|
2252
2258
|
source: h.draft,
|
|
2253
|
-
filter:
|
|
2259
|
+
filter: K("Polygon"),
|
|
2254
2260
|
paint: e.draftFill
|
|
2255
2261
|
}), t({
|
|
2256
2262
|
id: `${h.draft}-line`,
|
|
2257
2263
|
type: "line",
|
|
2258
2264
|
source: h.draft,
|
|
2259
|
-
filter:
|
|
2265
|
+
filter: K("LineString"),
|
|
2260
2266
|
paint: {
|
|
2261
2267
|
...e.draftLine,
|
|
2262
2268
|
"line-width": 2.5,
|
|
@@ -2266,7 +2272,7 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2266
2272
|
id: `${h.draft}-point`,
|
|
2267
2273
|
type: "circle",
|
|
2268
2274
|
source: h.draft,
|
|
2269
|
-
filter:
|
|
2275
|
+
filter: K("Point"),
|
|
2270
2276
|
paint: {
|
|
2271
2277
|
...e.handle,
|
|
2272
2278
|
"circle-radius": 5,
|
|
@@ -2311,32 +2317,32 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2311
2317
|
t(g[0], e.fill), t(g[1], e.line), t(g[2], e.point), t(`${h.draft}-fill`, e.draftFill), t(`${h.draft}-line`, e.draftLine), t(`${h.draft}-point`, e.handle), t(v, e.handle), t(_, e.handle);
|
|
2312
2318
|
});
|
|
2313
2319
|
function ce(e) {
|
|
2314
|
-
if (e !== null && !
|
|
2315
|
-
P.value = e,
|
|
2316
|
-
let t =
|
|
2317
|
-
a("select", t ?
|
|
2320
|
+
if (e !== null && !F(e) && (e = null), P.value === e) return;
|
|
2321
|
+
P.value = e, W();
|
|
2322
|
+
let t = F(e);
|
|
2323
|
+
a("select", t ? ee(t) : null);
|
|
2318
2324
|
}
|
|
2319
2325
|
function le(e = P.value) {
|
|
2320
2326
|
let t = y.findIndex((t) => t.id === e);
|
|
2321
|
-
t < 0 || (y.splice(t, 1), P.value === e && (P.value = null, a("select", null)),
|
|
2327
|
+
t < 0 || (y.splice(t, 1), P.value === e && (P.value = null, a("select", null)), W(), L());
|
|
2322
2328
|
}
|
|
2323
2329
|
function ue() {
|
|
2324
|
-
N.value && $(), y.length && (y = [], P.value !== null && (P.value = null, a("select", null)),
|
|
2330
|
+
N.value && $(), y.length && (y = [], P.value !== null && (P.value = null, a("select", null)), W(), L());
|
|
2325
2331
|
}
|
|
2326
2332
|
let de = (e) => [e.lngLat.lng, e.lngLat.lat];
|
|
2327
2333
|
function fe(e) {
|
|
2328
|
-
if (N.value || !M || !i.editable || d.value && d.value !==
|
|
2329
|
-
let { x: t, y: n } = e.point, r = [[t -
|
|
2334
|
+
if (N.value || !M || !i.editable || d.value && d.value !== Qt) return;
|
|
2335
|
+
let { x: t, y: n } = e.point, r = [[t - $t, n - $t], [t + $t, n + $t]], a = M.queryRenderedFeatures(r, { layers: g.filter((e) => M.getLayer(e)) })[0]?.properties?.__draw_id;
|
|
2330
2336
|
if (a === void 0) return ce(null);
|
|
2331
2337
|
let o = y.find((e) => String(e.id) === a);
|
|
2332
2338
|
ce(o ? o.id : null);
|
|
2333
2339
|
}
|
|
2334
2340
|
function pe() {
|
|
2335
|
-
N.value || !i.editable || d.value || (d.value =
|
|
2336
|
-
d.value ===
|
|
2341
|
+
N.value || !i.editable || d.value || (d.value = Qt, setTimeout(() => {
|
|
2342
|
+
d.value === Qt && !N.value && !k && (d.value = null);
|
|
2337
2343
|
}, 0));
|
|
2338
2344
|
}
|
|
2339
|
-
let
|
|
2345
|
+
let me = () => {
|
|
2340
2346
|
M && !N.value && !k && i.editable && (M.getCanvas().style.cursor = "pointer");
|
|
2341
2347
|
}, ge = () => {
|
|
2342
2348
|
M && !N.value && !k && (M.getCanvas().style.cursor = "");
|
|
@@ -2348,30 +2354,30 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2348
2354
|
coordinates: de(e)
|
|
2349
2355
|
}), $();
|
|
2350
2356
|
else {
|
|
2351
|
-
if (N.value === "polygon" &&
|
|
2352
|
-
let t = M.project(
|
|
2357
|
+
if (N.value === "polygon" && C.length >= 3) {
|
|
2358
|
+
let t = M.project(C[0]);
|
|
2353
2359
|
if (Math.hypot(t.x - e.point.x, t.y - e.point.y) < 20) return $();
|
|
2354
2360
|
}
|
|
2355
|
-
|
|
2361
|
+
C.push(de(e)), W();
|
|
2356
2362
|
}
|
|
2357
2363
|
}
|
|
2358
2364
|
}
|
|
2359
2365
|
function ve(e) {
|
|
2360
|
-
O = de(e),
|
|
2366
|
+
O = de(e), G();
|
|
2361
2367
|
}
|
|
2362
2368
|
function ye(e) {
|
|
2363
|
-
if (e.preventDefault(), !M ||
|
|
2364
|
-
let t = M.project(
|
|
2365
|
-
Math.hypot(t.x - n.x, t.y - n.y) < 10 &&
|
|
2369
|
+
if (e.preventDefault(), !M || C.length < 2) return;
|
|
2370
|
+
let t = M.project(C[C.length - 1]), n = M.project(C[C.length - 2]);
|
|
2371
|
+
Math.hypot(t.x - n.x, t.y - n.y) < 10 && C.pop(), $();
|
|
2366
2372
|
}
|
|
2367
2373
|
function be() {
|
|
2368
2374
|
let e = document.activeElement;
|
|
2369
2375
|
return !e || e === document.body ? !0 : M?.getContainer().contains(e) ? !(e instanceof HTMLElement && (e.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName))) : !1;
|
|
2370
2376
|
}
|
|
2371
2377
|
function xe(e) {
|
|
2372
|
-
be() && (N.value ? e.key === "Enter" ? (e.preventDefault(), $()) : e.key === "Backspace" &&
|
|
2378
|
+
be() && (N.value ? e.key === "Enter" ? (e.preventDefault(), $()) : e.key === "Backspace" && C.length && (e.preventDefault(), C.pop(), W()) : (e.key === "Delete" || e.key === "Backspace") && P.value !== null && i.editable && (e.preventDefault(), le()));
|
|
2373
2379
|
}
|
|
2374
|
-
|
|
2380
|
+
m(() => !!N.value || P.value !== null, () => N.value ? $() : ce(null));
|
|
2375
2381
|
function Q() {
|
|
2376
2382
|
let e = `shape-${S++}`;
|
|
2377
2383
|
for (; y.some((t) => t.id === e);) e = `shape-${S++}`;
|
|
@@ -2384,81 +2390,81 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2384
2390
|
geometry: e,
|
|
2385
2391
|
properties: {}
|
|
2386
2392
|
};
|
|
2387
|
-
y.push(t), P.value = i.editable ? t.id : null,
|
|
2393
|
+
y.push(t), P.value = i.editable ? t.id : null, L(), i.editable && a("select", ee(t));
|
|
2388
2394
|
}
|
|
2389
2395
|
function Ce(e) {
|
|
2390
2396
|
if (M) {
|
|
2391
2397
|
if (N.value === e) return $();
|
|
2392
|
-
N.value && $(), P.value !== null && ce(null), N.value = e, d.value =
|
|
2398
|
+
N.value && $(), P.value !== null && ce(null), N.value = e, d.value = Qt, C = [], O = null, M.getCanvas().style.cursor = "crosshair", M.doubleClickZoom.disable(), M.on("click", _e), M.on("mousemove", ve), M.on("dblclick", ye), W(), i.mode !== e && a("update:mode", e);
|
|
2393
2399
|
}
|
|
2394
2400
|
}
|
|
2395
2401
|
function $() {
|
|
2396
2402
|
if (!M || !N.value) return;
|
|
2397
|
-
cancelAnimationFrame(
|
|
2398
|
-
let e = N.value, t =
|
|
2399
|
-
|
|
2403
|
+
cancelAnimationFrame(A), A = 0;
|
|
2404
|
+
let e = N.value, t = C;
|
|
2405
|
+
C = [], O = null, N.value = null, d.value === Qt && (d.value = null), M.getCanvas().style.cursor = "", M.doubleClickZoom.enable(), M.off("click", _e), M.off("mousemove", ve), M.off("dblclick", ye), e === "line" && t.length >= 2 ? Se({
|
|
2400
2406
|
type: "LineString",
|
|
2401
2407
|
coordinates: t
|
|
2402
2408
|
}) : e === "polygon" && t.length >= 3 && Se({
|
|
2403
2409
|
type: "Polygon",
|
|
2404
2410
|
coordinates: [[...t, [...t[0]]]]
|
|
2405
|
-
}),
|
|
2411
|
+
}), W(), i.mode !== null && a("update:mode", null);
|
|
2406
2412
|
}
|
|
2407
2413
|
function we(e) {
|
|
2408
|
-
let t = e.features?.[0], n =
|
|
2414
|
+
let t = e.features?.[0], n = F(P.value);
|
|
2409
2415
|
if (!t || !n || N.value || !M || !i.editable) return;
|
|
2410
|
-
let r =
|
|
2416
|
+
let r = te(n);
|
|
2411
2417
|
if (!r) return;
|
|
2412
2418
|
e.preventDefault();
|
|
2413
2419
|
let a = t.properties.v;
|
|
2414
|
-
t.properties.handle === "midpoint" && (a = t.properties.after + 1, r.splice(a, 0, de(e)),
|
|
2420
|
+
t.properties.handle === "midpoint" && (a = t.properties.after + 1, r.splice(a, 0, de(e)), R(n, r)), k = {
|
|
2415
2421
|
id: n.id,
|
|
2416
2422
|
v: a,
|
|
2417
2423
|
moved: t.properties.handle === "midpoint"
|
|
2418
|
-
}, d.value =
|
|
2424
|
+
}, d.value = Qt, M.getCanvas().style.cursor = "grabbing";
|
|
2419
2425
|
let o = e.type === "touchstart";
|
|
2420
|
-
o && M.dragPan.disable(), M.on(o ? "touchmove" : "mousemove", Te), M.once(o ? "touchend" : "mouseup", Ee),
|
|
2426
|
+
o && M.dragPan.disable(), M.on(o ? "touchmove" : "mousemove", Te), M.once(o ? "touchend" : "mouseup", Ee), W();
|
|
2421
2427
|
}
|
|
2422
2428
|
function Te(e) {
|
|
2423
|
-
let t = k &&
|
|
2424
|
-
k && t && n && (n[k.v] = de(e),
|
|
2429
|
+
let t = k && F(k.id), n = t && te(t);
|
|
2430
|
+
k && t && n && (n[k.v] = de(e), R(t, n), k.moved = !0, G());
|
|
2425
2431
|
}
|
|
2426
2432
|
function Ee() {
|
|
2427
2433
|
if (!M) return;
|
|
2428
2434
|
let e = k?.moved;
|
|
2429
|
-
k = null, M.off("mousemove", Te), M.off("touchmove", Te), M.dragPan.enable(), M.getCanvas().style.cursor = "",
|
|
2430
|
-
d.value ===
|
|
2435
|
+
k = null, M.off("mousemove", Te), M.off("touchmove", Te), M.dragPan.enable(), M.getCanvas().style.cursor = "", W(), e && L(), setTimeout(() => {
|
|
2436
|
+
d.value === Qt && !N.value && (d.value = null);
|
|
2431
2437
|
});
|
|
2432
2438
|
}
|
|
2433
2439
|
function De(e) {
|
|
2434
|
-
let t = e.features?.[0], n =
|
|
2440
|
+
let t = e.features?.[0], n = F(P.value);
|
|
2435
2441
|
if (!t || !n || N.value || !i.editable) return;
|
|
2436
2442
|
e.preventDefault();
|
|
2437
|
-
let r =
|
|
2438
|
-
!r || r.length <=
|
|
2443
|
+
let r = te(n);
|
|
2444
|
+
!r || r.length <= re(n) || (r.splice(t.properties.v, 1), R(n, r), W(), L());
|
|
2439
2445
|
}
|
|
2440
2446
|
let Oe = () => {
|
|
2441
2447
|
M && !k && !N.value && (M.getCanvas().style.cursor = "grab");
|
|
2442
2448
|
}, ke = () => {
|
|
2443
2449
|
M && !k && !N.value && (M.getCanvas().style.cursor = "");
|
|
2444
2450
|
};
|
|
2445
|
-
|
|
2446
|
-
M = e, se(),
|
|
2447
|
-
for (let t of g) e.on("mousedown", t, pe), e.on("touchstart", t, pe), e.on("mouseenter", t,
|
|
2451
|
+
I(i.modelValue), b = JSON.stringify(y), c((e) => {
|
|
2452
|
+
M = e, se(), W(), e.on("click", fe);
|
|
2453
|
+
for (let t of g) e.on("mousedown", t, pe), e.on("touchstart", t, pe), e.on("mouseenter", t, me), e.on("mouseleave", t, ge);
|
|
2448
2454
|
for (let t of [_, v]) e.on("mousedown", t, we), e.on("touchstart", t, we), e.on("mouseenter", t, Oe), e.on("mouseleave", t, ke);
|
|
2449
2455
|
e.on("dblclick", _, De), document.addEventListener("keydown", xe), i.mode && Ce(i.mode);
|
|
2450
2456
|
}), Y(u, () => {
|
|
2451
|
-
se(),
|
|
2457
|
+
se(), W();
|
|
2452
2458
|
}), Y(() => i.modelValue, (e) => {
|
|
2453
|
-
JSON.stringify(e?.features ?? []) !==
|
|
2459
|
+
JSON.stringify(e?.features ?? []) !== b && (I(e), b = JSON.stringify(y), W());
|
|
2454
2460
|
}, { deep: !0 }), Y(() => i.mode, (e) => {
|
|
2455
2461
|
e && e !== N.value ? Ce(e) : !e && N.value && $();
|
|
2456
2462
|
}), Y(() => i.editable, (e) => {
|
|
2457
2463
|
!e && P.value !== null && ce(null);
|
|
2458
|
-
}),
|
|
2464
|
+
}), ne(() => {
|
|
2459
2465
|
if (document.removeEventListener("keydown", xe), !M) return;
|
|
2460
|
-
N.value && $(), cancelAnimationFrame(
|
|
2461
|
-
for (let e of g) M.off("mousedown", e, pe), M.off("touchstart", e, pe), M.off("mouseenter", e,
|
|
2466
|
+
N.value && $(), cancelAnimationFrame(A), M.off("click", fe);
|
|
2467
|
+
for (let e of g) M.off("mousedown", e, pe), M.off("touchstart", e, pe), M.off("mouseenter", e, me), M.off("mouseleave", e, ge);
|
|
2462
2468
|
for (let e of [_, v]) M.off("mousedown", e, we), M.off("touchstart", e, we), M.off("mouseenter", e, Oe), M.off("mouseleave", e, ke);
|
|
2463
2469
|
M.off("dblclick", _, De);
|
|
2464
2470
|
let e = [
|
|
@@ -2473,11 +2479,11 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2473
2479
|
for (let e of Object.values(h)) M.getSource(e) && M.removeSource(e);
|
|
2474
2480
|
M = void 0;
|
|
2475
2481
|
});
|
|
2476
|
-
let Ae =
|
|
2482
|
+
let Ae = w(() => i.control === !0 ? "top-right" : i.control || "top-right"), je = {
|
|
2477
2483
|
point: "location_on",
|
|
2478
2484
|
line: "polyline",
|
|
2479
2485
|
polygon: "pentagon"
|
|
2480
|
-
}, Me =
|
|
2486
|
+
}, Me = w(() => ({
|
|
2481
2487
|
point: o.mapDrawPoint,
|
|
2482
2488
|
line: o.mapDrawLine,
|
|
2483
2489
|
polygon: o.mapDrawPolygon
|
|
@@ -2488,11 +2494,11 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2488
2494
|
select: ce,
|
|
2489
2495
|
remove: le,
|
|
2490
2496
|
clear: ue
|
|
2491
|
-
}), (n, r) => (
|
|
2497
|
+
}), (n, r) => (z(), D("div", Yt, [t.control ? (z(), T(he, {
|
|
2492
2498
|
key: 0,
|
|
2493
2499
|
position: Ae.value
|
|
2494
2500
|
}, {
|
|
2495
|
-
default: X(() => [(
|
|
2501
|
+
default: X(() => [(z(!0), D(x, null, H(t.modes, (t) => (z(), D("button", {
|
|
2496
2502
|
key: t,
|
|
2497
2503
|
type: "button",
|
|
2498
2504
|
class: "grid place-items-center",
|
|
@@ -2500,10 +2506,10 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2500
2506
|
"aria-label": Me.value[t],
|
|
2501
2507
|
"aria-pressed": N.value === t,
|
|
2502
2508
|
onClick: (e) => Ce(t)
|
|
2503
|
-
}, [
|
|
2509
|
+
}, [j(e, {
|
|
2504
2510
|
name: je[t],
|
|
2505
2511
|
size: 20
|
|
2506
|
-
}, null, 8, ["name"])], 8,
|
|
2512
|
+
}, null, 8, ["name"])], 8, Xt))), 128)), t.editable ? (z(), D("button", {
|
|
2507
2513
|
key: 0,
|
|
2508
2514
|
type: "button",
|
|
2509
2515
|
class: "grid place-items-center",
|
|
@@ -2511,22 +2517,22 @@ var Ht = { class: "hidden" }, Ut = ["title", "aria-pressed"], Wt = ["title", "ar
|
|
|
2511
2517
|
"aria-label": q(o).mapDeleteFeature,
|
|
2512
2518
|
disabled: P.value === null,
|
|
2513
2519
|
onClick: r[0] ||= (e) => le()
|
|
2514
|
-
}, [
|
|
2520
|
+
}, [j(e, {
|
|
2515
2521
|
name: "delete",
|
|
2516
2522
|
size: 20
|
|
2517
|
-
})], 8,
|
|
2523
|
+
})], 8, Zt)) : E("", !0)]),
|
|
2518
2524
|
_: 1
|
|
2519
|
-
}, 8, ["position"])) :
|
|
2525
|
+
}, 8, ["position"])) : E("", !0)]));
|
|
2520
2526
|
}
|
|
2521
|
-
}),
|
|
2522
|
-
function
|
|
2523
|
-
let t =
|
|
2527
|
+
}), tn = /* @__PURE__ */ new WeakMap();
|
|
2528
|
+
function nn(e) {
|
|
2529
|
+
let t = fe(e);
|
|
2524
2530
|
if (!t) throw Error("useMapFilter() must be called in a component inside <MMap>, or be given one");
|
|
2525
2531
|
function n(e, n) {
|
|
2526
2532
|
let r = t.map.value;
|
|
2527
2533
|
if (!r?.getLayer(e)) return;
|
|
2528
|
-
let i =
|
|
2529
|
-
i ||
|
|
2534
|
+
let i = tn.get(r);
|
|
2535
|
+
i || tn.set(r, i = /* @__PURE__ */ new Map()), i.has(e) || i.set(e, r.getFilter(e) ?? void 0);
|
|
2530
2536
|
let a = i.get(e);
|
|
2531
2537
|
r.setFilter(e, n ? a ? [
|
|
2532
2538
|
"all",
|
|
@@ -2550,7 +2556,7 @@ function tn(e) {
|
|
|
2550
2556
|
};
|
|
2551
2557
|
}
|
|
2552
2558
|
// src/components/MMapFilter.vue?vue&type=script&setup=true&lang.ts
|
|
2553
|
-
var
|
|
2559
|
+
var rn = { class: "flex flex-wrap gap-2" }, an = /* @__PURE__ */ M({
|
|
2554
2560
|
__name: "MMapFilter",
|
|
2555
2561
|
props: {
|
|
2556
2562
|
layer: {},
|
|
@@ -2562,7 +2568,7 @@ var nn = { class: "flex flex-wrap gap-2" }, rn = /* @__PURE__ */ j({
|
|
|
2562
2568
|
},
|
|
2563
2569
|
emits: ["update:modelValue"],
|
|
2564
2570
|
setup(e, { emit: t }) {
|
|
2565
|
-
let n = e, r = t, { onReady: i, styleVersion: a } = Z(() => n.map), { setFilter: o, valuesOf: s } =
|
|
2571
|
+
let n = e, r = t, { onReady: i, styleVersion: a } = Z(() => n.map), { setFilter: o, valuesOf: s } = nn(() => n.map), c = V([]), l = w(() => n.values ?? c.value), u = V([]), d = w(() => n.modelValue ?? u.value);
|
|
2566
2572
|
function f() {
|
|
2567
2573
|
let e = d.value;
|
|
2568
2574
|
o(n.layer, e.length ? [
|
|
@@ -2575,30 +2581,30 @@ var nn = { class: "flex flex-wrap gap-2" }, rn = /* @__PURE__ */ j({
|
|
|
2575
2581
|
let t = d.value.includes(e) ? d.value.filter((t) => t !== e) : [...d.value, e];
|
|
2576
2582
|
u.value = t, r("update:modelValue", t);
|
|
2577
2583
|
}
|
|
2578
|
-
function
|
|
2584
|
+
function m(e) {
|
|
2579
2585
|
let t = () => {
|
|
2580
2586
|
n.values || (c.value = s(n.layer, n.property));
|
|
2581
2587
|
};
|
|
2582
2588
|
t(), e.once("idle", t);
|
|
2583
2589
|
}
|
|
2584
2590
|
return i((e) => {
|
|
2585
|
-
|
|
2591
|
+
m(e), f();
|
|
2586
2592
|
}), Y(d, f, { deep: !0 }), Y(a, () => f()), Y(() => [n.layer, n.property], ([e], [t]) => {
|
|
2587
2593
|
e !== t && o(t, null), f();
|
|
2588
|
-
}),
|
|
2594
|
+
}), ne(() => o(n.layer, null)), (t, n) => (z(), D("div", rn, [(z(!0), D(x, null, H(l.value, (t) => (z(), T(h, {
|
|
2589
2595
|
key: t,
|
|
2590
2596
|
type: "filter",
|
|
2591
2597
|
clickable: "",
|
|
2592
2598
|
selected: d.value.includes(t),
|
|
2593
2599
|
onClick: (e) => p(t)
|
|
2594
2600
|
}, {
|
|
2595
|
-
default: X(() => [
|
|
2601
|
+
default: X(() => [A(G(e.labels?.[String(t)] ?? t), 1)]),
|
|
2596
2602
|
_: 2
|
|
2597
2603
|
}, 1032, ["selected", "onClick"]))), 128))]));
|
|
2598
2604
|
}
|
|
2599
2605
|
});
|
|
2600
2606
|
// src/composables/mapSearch.ts
|
|
2601
|
-
function
|
|
2607
|
+
function on(e = {}) {
|
|
2602
2608
|
return async (t, n) => {
|
|
2603
2609
|
let r = new URLSearchParams({
|
|
2604
2610
|
format: "jsonv2",
|
|
@@ -2624,7 +2630,7 @@ function an(e = {}) {
|
|
|
2624
2630
|
});
|
|
2625
2631
|
};
|
|
2626
2632
|
}
|
|
2627
|
-
var
|
|
2633
|
+
var sn = {
|
|
2628
2634
|
city: "location_city",
|
|
2629
2635
|
town: "location_city",
|
|
2630
2636
|
village: "holiday_village",
|
|
@@ -2651,17 +2657,17 @@ var on = {
|
|
|
2651
2657
|
administrative: "map",
|
|
2652
2658
|
country: "public",
|
|
2653
2659
|
state: "map"
|
|
2654
|
-
},
|
|
2660
|
+
}, cn = (e) => e && sn[e] || "location_on", ln = { class: "hidden" }, un = [
|
|
2655
2661
|
"value",
|
|
2656
2662
|
"placeholder",
|
|
2657
2663
|
"aria-label"
|
|
2658
|
-
],
|
|
2664
|
+
], dn = {
|
|
2659
2665
|
key: 0,
|
|
2660
2666
|
class: "border-t border-outline-variant"
|
|
2661
|
-
},
|
|
2667
|
+
}, fn = {
|
|
2662
2668
|
key: 1,
|
|
2663
2669
|
class: "flex flex-col items-center gap-2 py-6"
|
|
2664
|
-
},
|
|
2670
|
+
}, pn = { class: "text-body-small text-on-surface-variant" }, mn = /* @__PURE__ */ M({
|
|
2665
2671
|
__name: "MMapSearch",
|
|
2666
2672
|
props: {
|
|
2667
2673
|
provider: {},
|
|
@@ -2679,12 +2685,12 @@ var on = {
|
|
|
2679
2685
|
},
|
|
2680
2686
|
emits: ["select"],
|
|
2681
2687
|
setup(t, { emit: n }) {
|
|
2682
|
-
let r = t, i = n, o = s(), { map: c } = Z(), l =
|
|
2683
|
-
async function
|
|
2688
|
+
let r = t, i = n, o = s(), { map: c } = Z(), l = w(() => r.provider ?? on()), u = V(""), d = W([]), f = V(!1), p = V(!1), m = V(!1), h = W(null), g, S;
|
|
2689
|
+
async function C() {
|
|
2684
2690
|
let e = u.value.trim();
|
|
2685
2691
|
if (!e) return;
|
|
2686
|
-
|
|
2687
|
-
let t =
|
|
2692
|
+
g?.abort(), g = new AbortController();
|
|
2693
|
+
let t = g;
|
|
2688
2694
|
f.value = !0, m.value = !0;
|
|
2689
2695
|
try {
|
|
2690
2696
|
d.value = await l.value(e, t.signal);
|
|
@@ -2692,14 +2698,14 @@ var on = {
|
|
|
2692
2698
|
if (t.signal.aborted) return;
|
|
2693
2699
|
d.value = [];
|
|
2694
2700
|
} finally {
|
|
2695
|
-
|
|
2701
|
+
g === t && (f.value = !1, p.value = !0);
|
|
2696
2702
|
}
|
|
2697
2703
|
}
|
|
2698
2704
|
function k(e) {
|
|
2699
2705
|
if (u.value = e, !e) return M();
|
|
2700
|
-
r.instant && (clearTimeout(S), S = setTimeout(
|
|
2706
|
+
r.instant && (clearTimeout(S), S = setTimeout(C, 350));
|
|
2701
2707
|
}
|
|
2702
|
-
function
|
|
2708
|
+
function A(e) {
|
|
2703
2709
|
h.value = e, m.value = !1;
|
|
2704
2710
|
let t = c.value;
|
|
2705
2711
|
e.bbox && e.bbox[0] !== e.bbox[2] ? t?.fitBounds([[e.bbox[0], e.bbox[1]], [e.bbox[2], e.bbox[3]]], {
|
|
@@ -2711,29 +2717,29 @@ var on = {
|
|
|
2711
2717
|
}), i("select", e);
|
|
2712
2718
|
}
|
|
2713
2719
|
function M() {
|
|
2714
|
-
|
|
2720
|
+
g?.abort(), clearTimeout(S), u.value = "", d.value = [], p.value = !1, f.value = !1, m.value = !1, h.value = null;
|
|
2715
2721
|
}
|
|
2716
|
-
return
|
|
2717
|
-
|
|
2718
|
-
}), (n, r) => (
|
|
2722
|
+
return ne(() => {
|
|
2723
|
+
g?.abort(), clearTimeout(S);
|
|
2724
|
+
}), (n, r) => (z(), D("div", ln, [j(he, {
|
|
2719
2725
|
position: t.position,
|
|
2720
2726
|
group: !1
|
|
2721
2727
|
}, {
|
|
2722
|
-
default: X(() => [
|
|
2728
|
+
default: X(() => [j(v, {
|
|
2723
2729
|
variant: "elevated",
|
|
2724
2730
|
class: "w-80 max-w-[calc(100vw-5rem)] overflow-hidden"
|
|
2725
2731
|
}, {
|
|
2726
|
-
default: X(() => [
|
|
2732
|
+
default: X(() => [O("form", {
|
|
2727
2733
|
class: "flex items-center gap-2 py-1 pr-1 pl-3",
|
|
2728
2734
|
role: "search",
|
|
2729
|
-
onSubmit:
|
|
2735
|
+
onSubmit: se(C, ["prevent"])
|
|
2730
2736
|
}, [
|
|
2731
|
-
|
|
2737
|
+
j(e, {
|
|
2732
2738
|
name: "search",
|
|
2733
2739
|
size: 20,
|
|
2734
2740
|
class: "shrink-0 text-on-surface-variant"
|
|
2735
2741
|
}),
|
|
2736
|
-
|
|
2742
|
+
O("input", {
|
|
2737
2743
|
value: u.value,
|
|
2738
2744
|
type: "search",
|
|
2739
2745
|
enterkeyhint: "search",
|
|
@@ -2742,68 +2748,68 @@ var on = {
|
|
|
2742
2748
|
class: "min-w-0 flex-1 bg-transparent py-2 text-body-medium text-on-surface outline-none placeholder:text-on-surface-variant [&::-webkit-search-cancel-button]:hidden",
|
|
2743
2749
|
onInput: r[0] ||= (e) => k(e.target.value),
|
|
2744
2750
|
onFocus: r[1] ||= (e) => m.value = p.value && !h.value
|
|
2745
|
-
}, null, 40,
|
|
2746
|
-
f.value ? (
|
|
2751
|
+
}, null, 40, un),
|
|
2752
|
+
f.value ? (z(), T(b, {
|
|
2747
2753
|
key: 0,
|
|
2748
2754
|
size: 20,
|
|
2749
2755
|
class: "mr-2 shrink-0"
|
|
2750
|
-
})) : u.value ? (
|
|
2756
|
+
})) : u.value ? (z(), T(a, {
|
|
2751
2757
|
key: 1,
|
|
2752
2758
|
icon: "close",
|
|
2753
2759
|
label: q(o).clearSearch,
|
|
2754
2760
|
size: "sm",
|
|
2755
2761
|
onClick: M
|
|
2756
|
-
}, null, 8, ["label"])) :
|
|
2757
|
-
], 32), m.value && p.value && !f.value ? (
|
|
2762
|
+
}, null, 8, ["label"])) : E("", !0)
|
|
2763
|
+
], 32), m.value && p.value && !f.value ? (z(), D("div", dn, [d.value.length ? (z(), T(_, {
|
|
2758
2764
|
key: 0,
|
|
2759
2765
|
class: "max-h-72 overflow-y-auto"
|
|
2760
2766
|
}, {
|
|
2761
|
-
default: X(() => [(
|
|
2767
|
+
default: X(() => [(z(!0), D(x, null, H(d.value, (e, t) => (z(), T(y, {
|
|
2762
2768
|
key: t,
|
|
2763
2769
|
title: e.label,
|
|
2764
|
-
icon: q(
|
|
2770
|
+
icon: q(cn)(e.type),
|
|
2765
2771
|
leading: "icon",
|
|
2766
2772
|
clickable: "",
|
|
2767
|
-
onClick: (t) =>
|
|
2773
|
+
onClick: (t) => A(e)
|
|
2768
2774
|
}, null, 8, [
|
|
2769
2775
|
"title",
|
|
2770
2776
|
"icon",
|
|
2771
2777
|
"onClick"
|
|
2772
2778
|
]))), 128))]),
|
|
2773
2779
|
_: 1
|
|
2774
|
-
})) : (
|
|
2780
|
+
})) : (z(), D("div", fn, [j(e, {
|
|
2775
2781
|
name: "search_off",
|
|
2776
2782
|
size: 28,
|
|
2777
2783
|
class: "text-on-surface-variant"
|
|
2778
|
-
}),
|
|
2784
|
+
}), O("span", pn, G(q(o).noResults), 1)]))])) : E("", !0)]),
|
|
2779
2785
|
_: 1
|
|
2780
2786
|
})]),
|
|
2781
2787
|
_: 1
|
|
2782
|
-
}, 8, ["position"]), t.marker && h.value ? (
|
|
2788
|
+
}, 8, ["position"]), t.marker && h.value ? (z(), T(Ae, {
|
|
2783
2789
|
key: 0,
|
|
2784
2790
|
"lng-lat": h.value.lngLat
|
|
2785
|
-
}, null, 8, ["lng-lat"])) :
|
|
2791
|
+
}, null, 8, ["lng-lat"])) : E("", !0)]));
|
|
2786
2792
|
}
|
|
2787
|
-
}),
|
|
2793
|
+
}), hn = ["aria-label"], gn = {
|
|
2788
2794
|
key: 0,
|
|
2789
2795
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant",
|
|
2790
2796
|
role: "status"
|
|
2791
|
-
},
|
|
2797
|
+
}, _n = {
|
|
2792
2798
|
key: 1,
|
|
2793
2799
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant"
|
|
2794
|
-
},
|
|
2800
|
+
}, vn = {
|
|
2795
2801
|
key: 2,
|
|
2796
2802
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant",
|
|
2797
2803
|
role: "status"
|
|
2798
|
-
},
|
|
2804
|
+
}, yn = [
|
|
2799
2805
|
"id",
|
|
2800
2806
|
"aria-selected",
|
|
2801
2807
|
"onMousedown",
|
|
2802
2808
|
"onMousemove"
|
|
2803
|
-
],
|
|
2809
|
+
], bn = { class: "flex min-w-0 flex-col" }, xn = { class: "truncate text-body-large" }, Sn = {
|
|
2804
2810
|
key: 0,
|
|
2805
2811
|
class: "truncate text-body-small text-on-surface-variant"
|
|
2806
|
-
},
|
|
2812
|
+
}, Cn = /* @__PURE__ */ M({
|
|
2807
2813
|
inheritAttrs: !1,
|
|
2808
2814
|
__name: "MAddressField",
|
|
2809
2815
|
props: {
|
|
@@ -2826,60 +2832,60 @@ var on = {
|
|
|
2826
2832
|
},
|
|
2827
2833
|
emits: ["update:modelValue", "select"],
|
|
2828
2834
|
setup(t, { expose: n, emit: r }) {
|
|
2829
|
-
let i = t, o = r, c = s(), l =
|
|
2835
|
+
let i = t, o = r, c = s(), l = ae(), d = `${l}-list`, f = (e) => `${l}-opt-${e}`, h = w(() => i.provider ?? on()), _ = V(i.modelValue?.label ?? ""), v = W([]), y = V(!1), C = V(!1), k = V(!1), M = V(!1), N = V(-1), P, ee, R = V(), re = V(), B = V(), ie = w(() => re.value?.firstElementChild?.firstElementChild ?? null), U = V({}), K = w(() => _.value.trim().length >= i.minLength), J = w(() => !i.instant && k.value && K.value && !C.value && !y.value && !i.modelValue);
|
|
2830
2836
|
Y(() => i.modelValue, (e) => {
|
|
2831
|
-
e && e.label !== _.value ? _.value = e.label : !e && !
|
|
2837
|
+
e && e.label !== _.value ? _.value = e.label : !e && !k.value && (_.value = "");
|
|
2832
2838
|
});
|
|
2833
2839
|
async function ce() {
|
|
2834
2840
|
let e = _.value.trim();
|
|
2835
2841
|
if (e.length < i.minLength) return;
|
|
2836
|
-
P?.abort(), clearTimeout(
|
|
2842
|
+
P?.abort(), clearTimeout(ee), P = new AbortController();
|
|
2837
2843
|
let t = P;
|
|
2838
|
-
|
|
2844
|
+
y.value = !0, M.value = !0;
|
|
2839
2845
|
try {
|
|
2840
|
-
v.value = await
|
|
2846
|
+
v.value = await h.value(e, t.signal), N.value = v.value.length ? 0 : -1;
|
|
2841
2847
|
} catch {
|
|
2842
2848
|
if (t.signal.aborted) return;
|
|
2843
2849
|
v.value = [];
|
|
2844
2850
|
} finally {
|
|
2845
|
-
P === t && (
|
|
2851
|
+
P === t && (y.value = !1, C.value = !0);
|
|
2846
2852
|
}
|
|
2847
2853
|
}
|
|
2848
2854
|
function le(e) {
|
|
2849
|
-
_.value = String(e),
|
|
2855
|
+
_.value = String(e), C.value = !1, v.value = [], N.value = -1, i.modelValue && o("update:modelValue", null), P?.abort(), y.value = !1, clearTimeout(ee), K.value ? (M.value = !i.instant, i.instant && (ee = setTimeout(ce, i.debounce))) : M.value = !1;
|
|
2850
2856
|
}
|
|
2851
2857
|
function ue(e) {
|
|
2852
|
-
_.value = e.label, M.value = !1, v.value = [],
|
|
2858
|
+
_.value = e.label, M.value = !1, v.value = [], C.value = !1, o("update:modelValue", e), o("select", e);
|
|
2853
2859
|
}
|
|
2854
2860
|
function de() {
|
|
2855
|
-
P?.abort(), clearTimeout(
|
|
2861
|
+
P?.abort(), clearTimeout(ee), _.value = "", v.value = [], C.value = !1, y.value = !1, M.value = !1, i.modelValue && o("update:modelValue", null), R.value?.focus();
|
|
2856
2862
|
}
|
|
2857
|
-
function
|
|
2863
|
+
function fe(e) {
|
|
2858
2864
|
if (e.key === "Enter") {
|
|
2859
2865
|
e.preventDefault();
|
|
2860
2866
|
let t = v.value[N.value];
|
|
2861
|
-
M.value && t &&
|
|
2867
|
+
M.value && t && C.value ? ue(t) : ce();
|
|
2862
2868
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
2863
2869
|
if (!M.value || !v.value.length) return;
|
|
2864
2870
|
e.preventDefault();
|
|
2865
2871
|
let t = v.value.length;
|
|
2866
|
-
N.value = (N.value + (e.key === "ArrowDown" ? 1 : -1) + t) % t, I(() =>
|
|
2872
|
+
N.value = (N.value + (e.key === "ArrowDown" ? 1 : -1) + t) % t, I(() => B.value?.querySelector(`#${CSS.escape(f(N.value))}`)?.scrollIntoView({ block: "nearest" }));
|
|
2867
2873
|
}
|
|
2868
2874
|
}
|
|
2869
|
-
function
|
|
2870
|
-
|
|
2875
|
+
function Z() {
|
|
2876
|
+
k.value = !0, (C.value && v.value.length && !i.modelValue || J.value) && (M.value = !0);
|
|
2871
2877
|
}
|
|
2872
2878
|
function pe(e) {
|
|
2873
2879
|
let t = e.relatedTarget;
|
|
2874
|
-
t && (
|
|
2880
|
+
t && (re.value?.contains(t) || B.value?.contains(t)) || (k.value = !1, M.value = !1);
|
|
2875
2881
|
}
|
|
2876
|
-
|
|
2877
|
-
let me =
|
|
2882
|
+
m(() => M.value, () => M.value = !1);
|
|
2883
|
+
let me = w(() => M.value && (y.value || C.value || J.value));
|
|
2878
2884
|
function he() {
|
|
2879
|
-
let e =
|
|
2885
|
+
let e = ie.value?.getBoundingClientRect(), t = B.value;
|
|
2880
2886
|
if (!e || !t) return;
|
|
2881
|
-
let n = t.offsetHeight, r =
|
|
2882
|
-
|
|
2887
|
+
let n = t.offsetHeight, r = p([e.bottom + 4, e.top - 4 - n], n, window.innerHeight, 8);
|
|
2888
|
+
U.value = {
|
|
2883
2889
|
top: `${r}px`,
|
|
2884
2890
|
left: `${e.left}px`,
|
|
2885
2891
|
width: `${e.width}px`
|
|
@@ -2888,18 +2894,18 @@ var on = {
|
|
|
2888
2894
|
Y([
|
|
2889
2895
|
me,
|
|
2890
2896
|
v,
|
|
2891
|
-
|
|
2892
|
-
], () => I(he)),
|
|
2897
|
+
y
|
|
2898
|
+
], () => I(he)), g({
|
|
2893
2899
|
open: () => me.value,
|
|
2894
|
-
anchor:
|
|
2895
|
-
popup:
|
|
2900
|
+
anchor: ie,
|
|
2901
|
+
popup: B,
|
|
2896
2902
|
place: he,
|
|
2897
2903
|
close: () => M.value = !1
|
|
2898
|
-
}),
|
|
2899
|
-
let e =
|
|
2900
|
-
e && (e.setAttribute("role", "combobox"), e.setAttribute("aria-autocomplete", "list"), e.setAttribute("aria-expanded", String(me.value && v.value.length > 0)), e.setAttribute("aria-controls", d), e.setAttribute("enterkeyhint", "search"), me.value && N.value >= 0 && v.value.length ? e.setAttribute("aria-activedescendant",
|
|
2901
|
-
}),
|
|
2902
|
-
P?.abort(), clearTimeout(
|
|
2904
|
+
}), oe(() => {
|
|
2905
|
+
let e = R.value?.inputEl;
|
|
2906
|
+
e && (e.setAttribute("role", "combobox"), e.setAttribute("aria-autocomplete", "list"), e.setAttribute("aria-expanded", String(me.value && v.value.length > 0)), e.setAttribute("aria-controls", d), e.setAttribute("enterkeyhint", "search"), me.value && N.value >= 0 && v.value.length ? e.setAttribute("aria-activedescendant", f(N.value)) : e.removeAttribute("aria-activedescendant"));
|
|
2907
|
+
}), ne(() => {
|
|
2908
|
+
P?.abort(), clearTimeout(ee);
|
|
2903
2909
|
});
|
|
2904
2910
|
function ge(e) {
|
|
2905
2911
|
let t = e.indexOf(", ");
|
|
@@ -2908,17 +2914,17 @@ var on = {
|
|
|
2908
2914
|
return n({
|
|
2909
2915
|
search: ce,
|
|
2910
2916
|
clear: de,
|
|
2911
|
-
focus: () =>
|
|
2912
|
-
}), (n, r) => (
|
|
2917
|
+
focus: () => R.value?.focus()
|
|
2918
|
+
}), (n, r) => (z(), D(x, null, [O("div", F({
|
|
2913
2919
|
ref_key: "wrapEl",
|
|
2914
|
-
ref:
|
|
2920
|
+
ref: re
|
|
2915
2921
|
}, n.$attrs, {
|
|
2916
|
-
onFocusin:
|
|
2922
|
+
onFocusin: Z,
|
|
2917
2923
|
onFocusout: pe,
|
|
2918
|
-
onKeydown:
|
|
2919
|
-
}), [
|
|
2924
|
+
onKeydown: fe
|
|
2925
|
+
}), [j(u, {
|
|
2920
2926
|
ref_key: "field",
|
|
2921
|
-
ref:
|
|
2927
|
+
ref: R,
|
|
2922
2928
|
"model-value": _.value,
|
|
2923
2929
|
label: t.label ?? q(c).mapAddress,
|
|
2924
2930
|
variant: t.variant,
|
|
@@ -2931,18 +2937,18 @@ var on = {
|
|
|
2931
2937
|
autocomplete: "street-address",
|
|
2932
2938
|
"onUpdate:modelValue": le
|
|
2933
2939
|
}, {
|
|
2934
|
-
trailing: X(() => [
|
|
2940
|
+
trailing: X(() => [y.value ? (z(), T(b, {
|
|
2935
2941
|
key: 0,
|
|
2936
2942
|
size: 20,
|
|
2937
2943
|
class: "m-2"
|
|
2938
|
-
})) : _.value ? (
|
|
2944
|
+
})) : _.value ? (z(), T(a, {
|
|
2939
2945
|
key: 1,
|
|
2940
2946
|
icon: "close",
|
|
2941
2947
|
label: q(c).clearSearch,
|
|
2942
2948
|
size: "sm",
|
|
2943
2949
|
disabled: t.disabled,
|
|
2944
2950
|
onClick: de
|
|
2945
|
-
}, null, 8, ["label", "disabled"])) :
|
|
2951
|
+
}, null, 8, ["label", "disabled"])) : E("", !0)]),
|
|
2946
2952
|
_: 1
|
|
2947
2953
|
}, 8, [
|
|
2948
2954
|
"model-value",
|
|
@@ -2954,36 +2960,36 @@ var on = {
|
|
|
2954
2960
|
"error-label",
|
|
2955
2961
|
"required",
|
|
2956
2962
|
"disabled"
|
|
2957
|
-
])], 16), (
|
|
2963
|
+
])], 16), (z(), T(S, { to: "body" }, [me.value ? (z(), D("div", {
|
|
2958
2964
|
key: 0,
|
|
2959
2965
|
id: d,
|
|
2960
2966
|
ref_key: "listEl",
|
|
2961
|
-
ref:
|
|
2967
|
+
ref: B,
|
|
2962
2968
|
role: "listbox",
|
|
2963
2969
|
"aria-label": t.label ?? q(c).mapAddress,
|
|
2964
2970
|
class: "fixed z-500 max-h-72 overflow-auto rounded-xs bg-surface-container py-1 shadow-elevation-2",
|
|
2965
|
-
style:
|
|
2966
|
-
}, [
|
|
2971
|
+
style: te(U.value)
|
|
2972
|
+
}, [y.value ? (z(), D("div", gn, [j(b, { size: 20 }), A(G(q(c).mapSearching), 1)])) : J.value ? (z(), D("div", _n, [j(e, {
|
|
2967
2973
|
name: "keyboard_return",
|
|
2968
2974
|
size: 20
|
|
2969
|
-
}),
|
|
2970
|
-
id:
|
|
2975
|
+
}), A(G(q(c).mapPressEnterToSearch), 1)])) : v.value.length ? (z(!0), D(x, { key: 3 }, H(v.value, (t, n) => (z(), D("div", {
|
|
2976
|
+
id: f(n),
|
|
2971
2977
|
key: n,
|
|
2972
2978
|
role: "option",
|
|
2973
2979
|
"aria-selected": n === N.value,
|
|
2974
2980
|
class: L(["flex cursor-pointer items-center gap-3 px-4 py-2 text-on-surface hover:bg-on-surface/8", n === N.value ? "bg-on-surface/12" : ""]),
|
|
2975
|
-
onMousedown:
|
|
2981
|
+
onMousedown: se((e) => ue(t), ["prevent"]),
|
|
2976
2982
|
onMousemove: (e) => N.value = n
|
|
2977
|
-
}, [
|
|
2978
|
-
name: q(
|
|
2983
|
+
}, [j(e, {
|
|
2984
|
+
name: q(cn)(t.type),
|
|
2979
2985
|
size: 20,
|
|
2980
2986
|
class: "shrink-0 text-on-surface-variant"
|
|
2981
|
-
}, null, 8, ["name"]),
|
|
2987
|
+
}, null, 8, ["name"]), O("span", bn, [O("span", xn, G(ge(t.label)[0]), 1), ge(t.label)[1] ? (z(), D("span", Sn, G(ge(t.label)[1]), 1)) : E("", !0)])], 42, yn))), 128)) : (z(), D("div", vn, [j(e, {
|
|
2982
2988
|
name: "search_off",
|
|
2983
2989
|
size: 20
|
|
2984
|
-
}),
|
|
2990
|
+
}), A(G(q(c).mapNoPlaces), 1)]))], 12, hn)) : E("", !0)]))], 64));
|
|
2985
2991
|
}
|
|
2986
2992
|
});
|
|
2987
|
-
export {
|
|
2993
|
+
export { Cn as MAddressField, we as MMap, ct as MMapBaseLayers, Fe as MMapCluster, he as MMapControl, en as MMapDraw, _t as MMapFeatureInfo, an as MMapFilter, Ne as MMapGeoJson, Pt as MMapHover, Dt as MMapIdentify, it as MMapLayers, Ae as MMapMarker, Jt as MMapMeasure, Me as MMapPopup, mn as MMapSearch, St as fieldLabel, Ct as formatFieldValue, bt as genericAdapter, Tt as identifyFeatures, on as nominatimProvider, xt as orvianAdapter, le as setMapWorker, Z as useMap, nn as useMapFilter, Q as useMapLayers };
|
|
2988
2994
|
|
|
2989
2995
|
//# sourceMappingURL=map.js.map
|