@m3ui-vue/m3ui-vue 1.6.2 → 1.7.0
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 +649 -28
- package/dist/{MButton-OQ4wIERQ.js → MButton-CN3wYwIG.js} +2 -2
- package/dist/{MButton-OQ4wIERQ.js.map → MButton-CN3wYwIG.js.map} +1 -1
- package/dist/{MColorPickerModal-NtkihoK6.js → MColorPickerModal-BKM1CHxr.js} +4 -4
- package/dist/{MColorPickerModal-NtkihoK6.js.map → MColorPickerModal-BKM1CHxr.js.map} +1 -1
- package/dist/{MDialog-DYMnaBlt.js → MDialog-1LAk9WAO.js} +2 -2
- package/dist/{MDialog-DYMnaBlt.js.map → MDialog-1LAk9WAO.js.map} +1 -1
- package/dist/{MListItem-D2cNUyzP.js → MListItem-BU5KDRCB.js} +376 -270
- package/dist/MListItem-BU5KDRCB.js.map +1 -0
- package/dist/{MLoadingIndicator-DWUj0BAB.js → MLoadingIndicator-RykOo5tf.js} +2 -2
- package/dist/{MLoadingIndicator-DWUj0BAB.js.map → MLoadingIndicator-RykOo5tf.js.map} +1 -1
- package/dist/{MSeekBar-C4cn9RIF.js → MSeekBar-B_Y3MpVz.js} +2 -2
- package/dist/{MSeekBar-C4cn9RIF.js.map → MSeekBar-B_Y3MpVz.js.map} +1 -1
- package/dist/MSegmentedButton-CiOOY1-N.js +105 -0
- package/dist/MSegmentedButton-CiOOY1-N.js.map +1 -0
- package/dist/MSlider-BCeVIxcq.js +739 -0
- package/dist/MSlider-BCeVIxcq.js.map +1 -0
- package/dist/{MSpinner-DZkXZJpc.js → MSpinner-Cs03qoqE.js} +2 -2
- package/dist/{MSpinner-DZkXZJpc.js.map → MSpinner-Cs03qoqE.js.map} +1 -1
- package/dist/{MTextField-CNH-byir.js → MTextField-NaFbMkjv.js} +162 -115
- package/dist/MTextField-NaFbMkjv.js.map +1 -0
- package/dist/_useFieldValidation-Bz34IAQY.js +191 -0
- package/dist/_useFieldValidation-Bz34IAQY.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/code-editor.js +184 -103
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MAddressField.vue.d.ts +18 -3
- package/dist/components/MAppBarWithSearch.vue.d.ts +1 -1
- package/dist/components/MAudioRecorder.vue.d.ts +2 -2
- package/dist/components/MAutocomplete.vue.d.ts +22 -3
- package/dist/components/MCheckbox.vue.d.ts +23 -1
- package/dist/components/MCodeEditor.vue.d.ts +23 -1
- package/dist/components/MColorPicker.vue.d.ts +24 -3
- package/dist/components/MConfirmDialog.vue.d.ts +2 -2
- package/dist/components/MCountrySelect.vue.d.ts +13 -2
- package/dist/components/MCreditCardInput.vue.d.ts +33 -0
- package/dist/components/MCronField.vue.d.ts +23 -1
- package/dist/components/MDataTable.vue.d.ts +1 -1
- package/dist/components/MDatePicker.vue.d.ts +24 -3
- package/dist/components/MDateRangePicker.vue.d.ts +24 -3
- package/dist/components/MFileUpload.vue.d.ts +23 -2
- package/dist/components/MForm.vue.d.ts +61 -0
- package/dist/components/MJsonEditor.vue.d.ts +23 -1
- package/dist/components/MMapRoute.vue.d.ts +168 -0
- package/dist/components/MMaskField.vue.d.ts +20 -2
- package/dist/components/MMentionField.vue.d.ts +13 -2
- package/dist/components/MMultiAutocomplete.vue.d.ts +22 -3
- package/dist/components/MMultiSelect.vue.d.ts +22 -3
- package/dist/components/MNavigationRail.vue.d.ts +1 -1
- package/dist/components/MNotificationCenter.vue.d.ts +2 -2
- package/dist/components/MNumberField.vue.d.ts +20 -2
- package/dist/components/MPhoneInput.vue.d.ts +19 -4
- package/dist/components/MPinInput.vue.d.ts +24 -3
- package/dist/components/MPosKeypad.vue.d.ts +2 -2
- package/dist/components/MRadioGroup.vue.d.ts +23 -1
- package/dist/components/MRating.vue.d.ts +23 -1
- package/dist/components/MRichTextEditor.vue.d.ts +23 -1
- package/dist/components/MSearchBar.vue.d.ts +1 -1
- package/dist/components/MSegmentedButton.vue.d.ts +23 -2
- package/dist/components/MSelect.vue.d.ts +22 -3
- package/dist/components/MSignaturePad.vue.d.ts +19 -0
- package/dist/components/MSlider.vue.d.ts +23 -1
- package/dist/components/MSwitch.vue.d.ts +23 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +20 -2
- package/dist/components/MText.vue.d.ts +1 -1
- package/dist/components/MTextField.vue.d.ts +26 -3
- package/dist/components/MTimePicker.vue.d.ts +24 -3
- package/dist/components/MTimezoneSelect.vue.d.ts +13 -2
- package/dist/components/MTour.vue.d.ts +2 -2
- package/dist/components/MTrackingTimeline.vue.d.ts +75 -0
- package/dist/components/MWindow.vue.d.ts +2 -2
- package/dist/composables/_routeGeometry.d.ts +26 -0
- package/dist/composables/_useFieldValidation.d.ts +91 -0
- package/dist/composables/mapRouting.d.ts +35 -0
- package/dist/composables/useLocale.d.ts +23 -0
- package/dist/composables/validation.d.ts +82 -0
- package/dist/draw.js +2 -2
- package/dist/flow.js +1 -1
- package/dist/gantt.js +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/locales/index.js +154 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +6768 -5602
- package/dist/m3ui.js.map +1 -1
- package/dist/map.d.ts +4 -0
- package/dist/map.js +1230 -784
- package/dist/map.js.map +1 -1
- package/dist/media.js +4 -4
- package/dist/pdf.js +4 -4
- package/dist/rich-text-editor.js +189 -146
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-DaVSTdm0.js → useLocale-Dh1xZZ8i.js} +22 -1
- package/dist/useLocale-Dh1xZZ8i.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MForm.test.ts +325 -0
- package/src/__tests__/MMapRoute.test.ts +384 -0
- package/src/__tests__/MPhoneInput.test.ts +5 -2
- package/src/__tests__/MRichTextEditor.test.ts +2 -1
- package/src/__tests__/MTrackingTimeline.test.ts +66 -0
- package/src/__tests__/_fakeMaplibre.ts +4 -1
- package/src/__tests__/_osrmRoutes.ts +10 -0
- package/src/__tests__/attrsFallthrough.test.ts +11 -0
- package/src/__tests__/fieldsValidation.test.ts +229 -0
- package/src/__tests__/ssr.test.ts +1 -0
- package/src/__tests__/validation.test.ts +77 -0
- package/src/components/MAddressField.vue +45 -8
- package/src/components/MAutocomplete.vue +69 -23
- package/src/components/MCheckbox.vue +80 -17
- package/src/components/MCodeEditor.vue +59 -2
- package/src/components/MColorPicker.vue +65 -16
- package/src/components/MCountrySelect.vue +17 -3
- package/src/components/MCreditCardInput.vue +76 -7
- package/src/components/MCronField.vue +60 -10
- package/src/components/MDatePicker.vue +65 -16
- package/src/components/MDateRangePicker.vue +66 -16
- package/src/components/MFileUpload.vue +71 -8
- package/src/components/MForm.vue +208 -0
- package/src/components/MJsonEditor.vue +57 -3
- package/src/components/MMapRoute.vue +470 -0
- package/src/components/MMaskField.vue +55 -13
- package/src/components/MMentionField.vue +17 -2
- package/src/components/MMultiAutocomplete.vue +70 -23
- package/src/components/MMultiSelect.vue +70 -23
- package/src/components/MNumberField.vue +58 -16
- package/src/components/MPhoneInput.vue +60 -18
- package/src/components/MPinInput.vue +58 -10
- package/src/components/MRadioGroup.vue +65 -4
- package/src/components/MRating.vue +62 -6
- package/src/components/MRichTextEditor.vue +64 -4
- package/src/components/MSegmentedButton.vue +59 -2
- package/src/components/MSelect.vue +72 -26
- package/src/components/MSignaturePad.vue +71 -6
- package/src/components/MSlider.vue +61 -10
- package/src/components/MSwitch.vue +63 -8
- package/src/components/MTagInput.vue +67 -25
- package/src/components/MTextField.vue +68 -14
- package/src/components/MTimePicker.vue +65 -16
- package/src/components/MTimezoneSelect.vue +17 -3
- package/src/components/MTrackingTimeline.vue +257 -0
- package/src/composables/_routeGeometry.ts +140 -0
- package/src/composables/_useFieldValidation.ts +287 -0
- package/src/composables/mapRouting.ts +55 -0
- package/src/composables/useLocale.ts +46 -0
- package/src/composables/validation.ts +178 -0
- package/src/index.ts +5 -0
- package/src/locales/de.ts +21 -0
- package/src/locales/es.ts +28 -7
- package/src/locales/fr.ts +21 -0
- package/src/locales/ja.ts +21 -0
- package/src/locales/ko.ts +21 -0
- package/src/locales/pt.ts +21 -0
- package/src/locales/zh.ts +21 -0
- package/src/map.ts +4 -0
- package/dist/MListItem-D2cNUyzP.js.map +0 -1
- package/dist/MSegmentedButton-BEB4gXLA.js +0 -64
- package/dist/MSegmentedButton-BEB4gXLA.js.map +0 -1
- package/dist/MSlider-BIkA6DiE.js +0 -690
- package/dist/MSlider-BIkA6DiE.js.map +0 -1
- package/dist/MTextField-CNH-byir.js.map +0 -1
- package/dist/useLocale-DaVSTdm0.js.map +0 -1
package/dist/map.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { t as e } from "./MIcon-DpajuUTJ.js";
|
|
2
2
|
import { i as t } from "./motion-BcejVTeX.js";
|
|
3
3
|
import { d as n, f as r, l as i, t as a, u as o } from "./MIconButton-BBggVwBV.js";
|
|
4
|
-
import { i as s } from "./useLocale-
|
|
4
|
+
import { i as s } from "./useLocale-Dh1xZZ8i.js";
|
|
5
5
|
import { o as c } from "./_storageKeys-C4W_4xK4.js";
|
|
6
6
|
import { t as l } from "./useThemeTokens-DyAdPQB0.js";
|
|
7
|
-
import { t as u } from "./MTextField-
|
|
8
|
-
import { t as d } from "./MSlider-
|
|
7
|
+
import { t as u } from "./MTextField-NaFbMkjv.js";
|
|
8
|
+
import { t as d } from "./MSlider-BCeVIxcq.js";
|
|
9
9
|
import { t as f } from "./MTooltip-CK39Zon4.js";
|
|
10
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-
|
|
12
|
-
import { t as b } from "./MSpinner-
|
|
13
|
-
import {
|
|
11
|
+
import { a as h, l as g, r as _, s as v, t as y } from "./MListItem-BU5KDRCB.js";
|
|
12
|
+
import { t as b } from "./MSpinner-Cs03qoqE.js";
|
|
13
|
+
import { n as x, t as S } from "./_useFieldValidation-Bz34IAQY.js";
|
|
14
|
+
import { Fragment as C, Teleport as w, Transition as T, computed as E, createBlock as D, createCommentVNode as O, createElementBlock as k, createElementVNode as A, createSlots as j, createTextVNode as M, createVNode as N, defineComponent as P, getCurrentInstance as F, inject as I, markRaw as L, mergeProps as R, nextTick as ee, normalizeClass as z, normalizeStyle as te, onBeforeUnmount as ne, onMounted as B, onUnmounted as V, openBlock as H, provide as U, reactive as W, ref as G, renderList as re, renderSlot as K, shallowRef as q, toDisplayString as J, toValue as Y, unref as X, useId as ie, useSlots as ae, watch as Z, watchEffect as oe, withCtx as Q, withModifiers as se } from "vue";
|
|
14
15
|
// src/composables/useMap.ts
|
|
15
16
|
var ce;
|
|
16
17
|
function le(e) {
|
|
@@ -21,43 +22,43 @@ function ue() {
|
|
|
21
22
|
}
|
|
22
23
|
var de = Symbol("m3-map");
|
|
23
24
|
function fe(e) {
|
|
24
|
-
let t =
|
|
25
|
+
let t = I(de, null);
|
|
25
26
|
if (t || e === void 0) return t;
|
|
26
|
-
let n =
|
|
27
|
-
let t =
|
|
27
|
+
let n = E(() => {
|
|
28
|
+
let t = Y(e);
|
|
28
29
|
return t ? "context" in t ? t.context : t : void 0;
|
|
29
30
|
}), r = {
|
|
30
|
-
map:
|
|
31
|
-
maplibre:
|
|
32
|
-
styleVersion:
|
|
33
|
-
model:
|
|
31
|
+
map: E(() => n.value?.map.value),
|
|
32
|
+
maplibre: E(() => n.value?.maplibre.value),
|
|
33
|
+
styleVersion: E(() => n.value?.styleVersion.value ?? 0),
|
|
34
|
+
model: E(() => n.value?.model.value),
|
|
34
35
|
layerState: new Proxy({
|
|
35
36
|
visible: {},
|
|
36
37
|
opacity: {}
|
|
37
38
|
}, { get: (e, t) => Reflect.get(n.value?.layerState ?? e, t) }),
|
|
38
|
-
activeTool:
|
|
39
|
+
activeTool: E({
|
|
39
40
|
get: () => n.value?.activeTool.value ?? null,
|
|
40
41
|
set: (e) => {
|
|
41
42
|
n.value && (n.value.activeTool.value = e);
|
|
42
43
|
}
|
|
43
44
|
})
|
|
44
45
|
};
|
|
45
|
-
return
|
|
46
|
+
return U(de, r), r;
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function pe(e) {
|
|
48
49
|
let t = fe(e);
|
|
49
50
|
if (!t) throw Error("useMap() must be called in a component inside <MMap>, or be given one");
|
|
50
51
|
let n = [];
|
|
51
|
-
|
|
52
|
+
F() && ne(() => n.splice(0).forEach((e) => e()));
|
|
52
53
|
function r(e) {
|
|
53
54
|
let r = () => {
|
|
54
55
|
if (t.map.value && t.maplibre.value) return e(t.map.value, t.maplibre.value);
|
|
55
|
-
let r =
|
|
56
|
+
let r = Z(t.map, (n) => {
|
|
56
57
|
n && t.maplibre.value && (r(), e(n, t.maplibre.value));
|
|
57
58
|
});
|
|
58
59
|
n.push(r);
|
|
59
|
-
}, i =
|
|
60
|
-
i && !i.isMounted ?
|
|
60
|
+
}, i = F();
|
|
61
|
+
i && !i.isMounted ? B(r) : r();
|
|
61
62
|
}
|
|
62
63
|
function i(e, t) {
|
|
63
64
|
r((r) => {
|
|
@@ -70,9 +71,9 @@ function Z(e) {
|
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
return {
|
|
73
|
-
map:
|
|
74
|
-
maplibre:
|
|
75
|
-
styleVersion:
|
|
74
|
+
map: E(() => t.map.value),
|
|
75
|
+
maplibre: E(() => t.maplibre.value),
|
|
76
|
+
styleVersion: E(() => t.styleVersion.value),
|
|
76
77
|
activeTool: t.activeTool,
|
|
77
78
|
onReady: r,
|
|
78
79
|
on: i,
|
|
@@ -80,10 +81,10 @@ function Z(e) {
|
|
|
80
81
|
};
|
|
81
82
|
}
|
|
82
83
|
// src/components/MMapControl.vue?vue&type=script&setup=true&lang.ts
|
|
83
|
-
var
|
|
84
|
+
var me = { class: "hidden" }, he = {
|
|
84
85
|
key: 0,
|
|
85
86
|
class: "m3-map-control-panel-in"
|
|
86
|
-
},
|
|
87
|
+
}, ge = /* @__PURE__ */ P({
|
|
87
88
|
inheritAttrs: !1,
|
|
88
89
|
__name: "MMapControl",
|
|
89
90
|
props: {
|
|
@@ -103,11 +104,11 @@ var pe = { class: "hidden" }, me = {
|
|
|
103
104
|
},
|
|
104
105
|
emits: ["update:expanded"],
|
|
105
106
|
setup(e, { emit: a }) {
|
|
106
|
-
let s = e, c = a, l =
|
|
107
|
-
|
|
107
|
+
let s = e, c = a, l = ae(), u = G(), { onReady: d } = pe(), f = G(s.expanded);
|
|
108
|
+
Z(() => s.expanded, (e) => {
|
|
108
109
|
f.value = e;
|
|
109
110
|
});
|
|
110
|
-
let p =
|
|
111
|
+
let p = E(() => f.value && !!l.panel);
|
|
111
112
|
function m(e) {
|
|
112
113
|
e !== f.value && (f.value = e, c("update:expanded", e));
|
|
113
114
|
}
|
|
@@ -124,20 +125,20 @@ var pe = { class: "hidden" }, me = {
|
|
|
124
125
|
}, C = {
|
|
125
126
|
w: 0,
|
|
126
127
|
h: 0
|
|
127
|
-
},
|
|
128
|
-
function
|
|
128
|
+
}, w = null;
|
|
129
|
+
function T() {
|
|
129
130
|
return {
|
|
130
131
|
w: u.value.offsetWidth,
|
|
131
132
|
h: u.value.offsetHeight
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
+
function D() {
|
|
135
136
|
let e = u.value;
|
|
136
137
|
if (!e || b) return;
|
|
137
|
-
let t =
|
|
138
|
-
y && (t.w !== y.w || t.h !== y.h) && s.animate && !o() &&
|
|
138
|
+
let t = T();
|
|
139
|
+
y && (t.w !== y.w || t.h !== y.h) && s.animate && !o() && O(e, y, t), y = t;
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
+
function O(e, n, a) {
|
|
141
142
|
if (S = n, C = a, x = r(0, 1, 0, t.standard.defaultSpatial, .002), e.style.overflow = "hidden", b = i(e, x, (e) => ({
|
|
142
143
|
width: `${n.w + (a.w - n.w) * e}px`,
|
|
143
144
|
height: `${n.h + (a.h - n.h) * e}px`
|
|
@@ -146,8 +147,8 @@ var pe = { class: "hidden" }, me = {
|
|
|
146
147
|
}
|
|
147
148
|
function j(e) {
|
|
148
149
|
b?.cancel(), b = null, e.style.overflow = "";
|
|
149
|
-
let t =
|
|
150
|
-
t.w !== C.w || t.h !== C.h ? (y = C,
|
|
150
|
+
let t = T();
|
|
151
|
+
t.w !== C.w || t.h !== C.h ? (y = C, D()) : y = t;
|
|
151
152
|
}
|
|
152
153
|
function M() {
|
|
153
154
|
if (!u.value || !b) return;
|
|
@@ -155,39 +156,39 @@ var pe = { class: "hidden" }, me = {
|
|
|
155
156
|
w: S.w + (C.w - S.w) * e,
|
|
156
157
|
h: S.h + (C.h - S.h) * e
|
|
157
158
|
};
|
|
158
|
-
b.onfinish = null, b.cancel(), b = null, y = t,
|
|
159
|
+
b.onfinish = null, b.cancel(), b = null, y = t, D();
|
|
159
160
|
}
|
|
160
|
-
|
|
161
|
+
Z(p, M, { flush: "post" });
|
|
161
162
|
let N, P = {
|
|
162
163
|
onAdd: () => u.value,
|
|
163
164
|
onRemove: () => u.value?.remove()
|
|
164
165
|
};
|
|
165
166
|
return d((e) => {
|
|
166
167
|
N = e, u.value && e.addControl(P, s.position);
|
|
167
|
-
}),
|
|
168
|
+
}), Z(() => s.position, (e) => {
|
|
168
169
|
N && u.value && (N.removeControl(P), N.addControl(P, e));
|
|
169
|
-
}),
|
|
170
|
-
document.addEventListener("pointerdown", _, !0), typeof ResizeObserver < "u" && u.value && (
|
|
170
|
+
}), B(() => {
|
|
171
|
+
document.addEventListener("pointerdown", _, !0), typeof ResizeObserver < "u" && u.value && (w = new ResizeObserver(D), w.observe(u.value));
|
|
171
172
|
}), ne(() => {
|
|
172
|
-
document.removeEventListener("pointerdown", _, !0),
|
|
173
|
-
}), (t, n) => (
|
|
173
|
+
document.removeEventListener("pointerdown", _, !0), w?.disconnect(), b?.cancel(), N?.hasControl(P) && N.removeControl(P);
|
|
174
|
+
}), (t, n) => (H(), k("div", me, [A("div", R({
|
|
174
175
|
ref_key: "el",
|
|
175
176
|
ref: u,
|
|
176
177
|
class: ["maplibregl-ctrl m3-map-control", p.value ? "m3-map-control-panel" : e.group ? "maplibregl-ctrl-group" : ""]
|
|
177
|
-
}, t.$attrs, { onKeydown: v }), [p.value ? (
|
|
178
|
+
}, t.$attrs, { onKeydown: v }), [p.value ? (H(), k("div", he, [K(t.$slots, "panel", { close: g })])) : K(t.$slots, "default", {
|
|
178
179
|
expanded: f.value,
|
|
179
180
|
toggle: h
|
|
180
181
|
}, void 0, void 0, 1)], 16)]));
|
|
181
182
|
}
|
|
182
|
-
}),
|
|
183
|
+
}), _e = [
|
|
183
184
|
"title",
|
|
184
185
|
"aria-label",
|
|
185
186
|
"aria-expanded"
|
|
186
|
-
],
|
|
187
|
+
], ve = ["innerHTML"], ye = /* @__PURE__ */ P({
|
|
187
188
|
__name: "_MMapAttribution",
|
|
188
189
|
props: { position: {} },
|
|
189
190
|
setup(t) {
|
|
190
|
-
let n = t, r = s(), { on: i, onReady: a } =
|
|
191
|
+
let n = t, r = s(), { on: i, onReady: a } = pe(), o = G([]), c = G(!0), l = G(0), u;
|
|
191
192
|
function d() {
|
|
192
193
|
if (!u) return;
|
|
193
194
|
let e = u.getStyle?.();
|
|
@@ -206,35 +207,35 @@ var pe = { class: "hidden" }, me = {
|
|
|
206
207
|
}), i("styledata", d), i("sourcedata", d), i("resize", d), i("dragstart", () => {
|
|
207
208
|
c.value = !1;
|
|
208
209
|
});
|
|
209
|
-
let f =
|
|
210
|
-
return (n, i) => f.value ? (
|
|
210
|
+
let f = E(() => o.value.join(" ")), p = E(() => n.position.endsWith("right"));
|
|
211
|
+
return (n, i) => f.value ? (H(), D(ge, {
|
|
211
212
|
key: 0,
|
|
212
213
|
position: t.position,
|
|
213
214
|
group: !1,
|
|
214
|
-
class:
|
|
215
|
+
class: z(["m3-map-attrib", c.value ? "m3-map-attrib-open" : ""])
|
|
215
216
|
}, {
|
|
216
|
-
default:
|
|
217
|
-
class:
|
|
217
|
+
default: Q(() => [A("div", {
|
|
218
|
+
class: z(["m3-map-attrib-row", p.value ? "flex-row-reverse" : ""]),
|
|
218
219
|
style: te(l.value ? { maxWidth: `${l.value}px` } : void 0)
|
|
219
|
-
}, [
|
|
220
|
+
}, [A("button", {
|
|
220
221
|
type: "button",
|
|
221
222
|
class: "m3-map-attrib-button",
|
|
222
|
-
title:
|
|
223
|
-
"aria-label":
|
|
223
|
+
title: X(r).mapToggleAttribution,
|
|
224
|
+
"aria-label": X(r).mapToggleAttribution,
|
|
224
225
|
"aria-expanded": c.value,
|
|
225
226
|
onClick: i[0] ||= (e) => c.value = !c.value
|
|
226
|
-
}, [
|
|
227
|
+
}, [N(e, {
|
|
227
228
|
name: "info",
|
|
228
229
|
size: 20
|
|
229
|
-
})], 8,
|
|
230
|
+
})], 8, _e), c.value ? (H(), k("div", {
|
|
230
231
|
key: 0,
|
|
231
|
-
class:
|
|
232
|
+
class: z(["m3-map-attrib-text", p.value ? "pl-3.5" : "pr-3.5"]),
|
|
232
233
|
innerHTML: f.value
|
|
233
|
-
}, null, 10,
|
|
234
|
+
}, null, 10, ve)) : O("", !0)], 6)]),
|
|
234
235
|
_: 1
|
|
235
|
-
}, 8, ["position", "class"])) :
|
|
236
|
+
}, 8, ["position", "class"])) : O("", !0);
|
|
236
237
|
}
|
|
237
|
-
}),
|
|
238
|
+
}), be = {
|
|
238
239
|
fill: ["fill-opacity"],
|
|
239
240
|
line: ["line-opacity"],
|
|
240
241
|
circle: ["circle-opacity", "circle-stroke-opacity"],
|
|
@@ -243,27 +244,27 @@ var pe = { class: "hidden" }, me = {
|
|
|
243
244
|
heatmap: ["heatmap-opacity"],
|
|
244
245
|
"fill-extrusion": ["fill-extrusion-opacity"]
|
|
245
246
|
};
|
|
246
|
-
function
|
|
247
|
-
return
|
|
247
|
+
function xe() {
|
|
248
|
+
return W({
|
|
248
249
|
visible: {},
|
|
249
250
|
opacity: {}
|
|
250
251
|
});
|
|
251
252
|
}
|
|
252
|
-
function
|
|
253
|
+
function Se(e, t, n) {
|
|
253
254
|
let r = {}, i = {};
|
|
254
255
|
for (let e of n?.layers ?? []) {
|
|
255
256
|
let n = t.getLayer(e.id);
|
|
256
257
|
if (!n) continue;
|
|
257
258
|
r[e.id] = t.getLayoutProperty(e.id, "visibility") !== "none";
|
|
258
|
-
let a =
|
|
259
|
+
let a = be[n.type]?.[0], o = a ? t.getPaintProperty(e.id, a) : void 0;
|
|
259
260
|
i[e.id] = typeof o == "number" ? o : 1;
|
|
260
261
|
}
|
|
261
262
|
e.visible = r, e.opacity = i;
|
|
262
263
|
}
|
|
263
|
-
function
|
|
264
|
+
function Ce(e) {
|
|
264
265
|
let t = fe(e);
|
|
265
266
|
if (!t) throw Error("useMapLayers() must be called in a component inside <MMap>, or be given one");
|
|
266
|
-
let { map: n, model: r, layerState: i } = t, a =
|
|
267
|
+
let { map: n, model: r, layerState: i } = t, a = E(() => r.value?.layers ?? []), o = E(() => new Map(a.value.map((e) => [e.id, e])));
|
|
267
268
|
function s(e) {
|
|
268
269
|
return i.visible[e] ?? !0;
|
|
269
270
|
}
|
|
@@ -280,7 +281,7 @@ function Q(e) {
|
|
|
280
281
|
}
|
|
281
282
|
function d(e, t) {
|
|
282
283
|
let r = n.value, a = r?.getLayer(e);
|
|
283
|
-
if (a) for (let n of
|
|
284
|
+
if (a) for (let n of be[a.type] ?? []) r.setPaintProperty(e, n, t);
|
|
284
285
|
i.opacity[e] = t;
|
|
285
286
|
for (let n of o.value.get(e)?.children ?? []) d(n, t);
|
|
286
287
|
}
|
|
@@ -294,12 +295,12 @@ function Q(e) {
|
|
|
294
295
|
function m(e, t) {
|
|
295
296
|
for (let n of f(e)) c(n.id, t);
|
|
296
297
|
}
|
|
297
|
-
let h =
|
|
298
|
+
let h = E(() => a.value.filter((e) => e.base)), g = E(() => h.value.find((e) => s(e.id))?.id ?? null);
|
|
298
299
|
function _(e) {
|
|
299
300
|
for (let t of h.value) c(t.id, t.id === e);
|
|
300
301
|
}
|
|
301
302
|
return {
|
|
302
|
-
model:
|
|
303
|
+
model: E(() => r.value),
|
|
303
304
|
layers: a,
|
|
304
305
|
isVisible: s,
|
|
305
306
|
setVisible: c,
|
|
@@ -315,13 +316,13 @@ function Q(e) {
|
|
|
315
316
|
};
|
|
316
317
|
}
|
|
317
318
|
// src/composables/_mapStyle.ts
|
|
318
|
-
function
|
|
319
|
+
function $(e) {
|
|
319
320
|
return {
|
|
320
321
|
sources: new Set(Object.keys(e?.sources ?? {})),
|
|
321
322
|
layers: new Set((e?.layers ?? []).map((e) => e.id))
|
|
322
323
|
};
|
|
323
324
|
}
|
|
324
|
-
function
|
|
325
|
+
function we(e, t, n, r = () => !0) {
|
|
325
326
|
if (!e) return t;
|
|
326
327
|
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 };
|
|
327
328
|
for (let [t, r] of Object.entries(e.sources)) !n.sources.has(t) && !(t in o) && (o[t] = r);
|
|
@@ -332,7 +333,7 @@ function Ce(e, t, n, r = () => !0) {
|
|
|
332
333
|
};
|
|
333
334
|
}
|
|
334
335
|
// src/components/MMap.vue?vue&type=script&setup=true&lang.ts
|
|
335
|
-
var
|
|
336
|
+
var Te = 600, Ee = /* @__PURE__ */ P({
|
|
336
337
|
__name: "MMap",
|
|
337
338
|
props: {
|
|
338
339
|
mapStyle: {},
|
|
@@ -382,17 +383,17 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
382
383
|
"update:pitch"
|
|
383
384
|
],
|
|
384
385
|
setup(e, { expose: t, emit: n }) {
|
|
385
|
-
let r = e, i = n, a =
|
|
386
|
+
let r = e, i = n, a = G(), o = G(), l = q(), u = q(), d = G(0), f, p = q(), m = xe(), h = {
|
|
386
387
|
map: l,
|
|
387
388
|
maplibre: u,
|
|
388
389
|
styleVersion: d,
|
|
389
390
|
model: p,
|
|
390
391
|
layerState: m,
|
|
391
|
-
activeTool:
|
|
392
|
+
activeTool: G(null)
|
|
392
393
|
};
|
|
393
|
-
|
|
394
|
+
U(de, h);
|
|
394
395
|
function g(e) {
|
|
395
|
-
p.value = r.adapter ? r.adapter(e.getStyle(), { styleUrl: typeof r.mapStyle == "string" ? r.mapStyle : void 0 }) : void 0,
|
|
396
|
+
p.value = r.adapter ? r.adapter(e.getStyle(), { styleUrl: typeof r.mapStyle == "string" ? r.mapStyle : void 0 }) : void 0, Se(m, e, p.value);
|
|
396
397
|
}
|
|
397
398
|
let _ = s(), v = () => typeof r.persist == "string" ? r.persist : r.persist ? c("m3-map-view") : null;
|
|
398
399
|
function y() {
|
|
@@ -438,7 +439,7 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
438
439
|
})
|
|
439
440
|
}
|
|
440
441
|
}, S = /* @__PURE__ */ new Map();
|
|
441
|
-
function
|
|
442
|
+
function C(e) {
|
|
442
443
|
let t = l.value, n = u.value;
|
|
443
444
|
if (!t || !n) return;
|
|
444
445
|
let i = S.get(e);
|
|
@@ -448,8 +449,8 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
448
449
|
let o = x[e].create(n);
|
|
449
450
|
t.addControl(o, a === !0 ? x[e].corner : a), S.set(e, o);
|
|
450
451
|
}
|
|
451
|
-
for (let e of Object.keys(x))
|
|
452
|
-
function
|
|
452
|
+
for (let e of Object.keys(x)) Z(() => r[e], () => C(e));
|
|
453
|
+
function w() {
|
|
453
454
|
return {
|
|
454
455
|
"AttributionControl.ToggleAttribution": _.mapToggleAttribution,
|
|
455
456
|
"AttributionControl.MapFeedback": _.mapFeedback,
|
|
@@ -468,7 +469,7 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
468
469
|
"CooperativeGesturesHandler.MobileHelpText": _.mapTwoFingers
|
|
469
470
|
};
|
|
470
471
|
}
|
|
471
|
-
let
|
|
472
|
+
let E = G(null), j, M;
|
|
472
473
|
function P(e) {
|
|
473
474
|
let t = e.getAttribute("title");
|
|
474
475
|
t && e.closest(".maplibregl-ctrl") && (e.setAttribute("data-m3-tip", t), e.hasAttribute("aria-label") || e.setAttribute("aria-label", t), e.removeAttribute("title"));
|
|
@@ -477,7 +478,7 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
477
478
|
let t = e.getAttribute("data-m3-tip"), n = a.value?.getBoundingClientRect();
|
|
478
479
|
if (!t || !n) return;
|
|
479
480
|
let r = e.getBoundingClientRect(), i = r.left + r.width / 2 > n.left + n.width / 2;
|
|
480
|
-
|
|
481
|
+
E.value = {
|
|
481
482
|
text: t,
|
|
482
483
|
left: i,
|
|
483
484
|
x: (i ? r.left - 8 : r.right + 8) - n.left,
|
|
@@ -485,40 +486,40 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
485
486
|
};
|
|
486
487
|
}
|
|
487
488
|
function I() {
|
|
488
|
-
clearTimeout(
|
|
489
|
+
clearTimeout(j), E.value = null;
|
|
489
490
|
}
|
|
490
|
-
let
|
|
491
|
-
function
|
|
492
|
-
let t =
|
|
493
|
-
t && e.pointerType !== "touch" && (clearTimeout(
|
|
491
|
+
let R = (e) => e.target?.closest?.(".maplibregl-ctrl [data-m3-tip]") ?? null;
|
|
492
|
+
function ee(e) {
|
|
493
|
+
let t = R(e);
|
|
494
|
+
t && e.pointerType !== "touch" && (clearTimeout(j), j = setTimeout(() => F(t), Te));
|
|
494
495
|
}
|
|
495
|
-
function
|
|
496
|
-
let t =
|
|
496
|
+
function W(e) {
|
|
497
|
+
let t = R(e);
|
|
497
498
|
t && !t.contains(e.relatedTarget) && I();
|
|
498
499
|
}
|
|
499
|
-
function
|
|
500
|
-
let t =
|
|
500
|
+
function re(e) {
|
|
501
|
+
let t = R(e);
|
|
501
502
|
t?.matches(":focus-visible") && F(t);
|
|
502
503
|
}
|
|
503
|
-
|
|
504
|
+
B(() => {
|
|
504
505
|
let e = a.value;
|
|
505
|
-
e && (e.querySelectorAll("[title]").forEach(P),
|
|
506
|
+
e && (e.querySelectorAll("[title]").forEach(P), M = new MutationObserver((e) => {
|
|
506
507
|
for (let t of e) t.type === "attributes" ? P(t.target) : t.addedNodes.forEach((e) => {
|
|
507
508
|
e instanceof Element && (P(e), e.querySelectorAll("[title]").forEach(P));
|
|
508
509
|
});
|
|
509
|
-
}),
|
|
510
|
+
}), M.observe(e, {
|
|
510
511
|
subtree: !0,
|
|
511
512
|
childList: !0,
|
|
512
513
|
attributes: !0,
|
|
513
514
|
attributeFilter: ["title"]
|
|
514
515
|
}));
|
|
515
516
|
}), ne(() => {
|
|
516
|
-
|
|
517
|
+
M?.disconnect(), clearTimeout(j);
|
|
517
518
|
});
|
|
518
|
-
let
|
|
519
|
-
|
|
519
|
+
let Y = !1;
|
|
520
|
+
B(async () => {
|
|
520
521
|
let e = await import("maplibre-gl"), t = "Map" in e ? e : e.default;
|
|
521
|
-
if (
|
|
522
|
+
if (Y || !o.value) return;
|
|
522
523
|
let n = r.workerUrl ?? ue();
|
|
523
524
|
n && t.setWorkerUrl(n);
|
|
524
525
|
let a = y(), s = {
|
|
@@ -526,16 +527,16 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
526
527
|
zoom: a.zoom ?? r.zoom,
|
|
527
528
|
bearing: a.bearing ?? r.bearing,
|
|
528
529
|
pitch: a.pitch ?? r.pitch
|
|
529
|
-
}, c =
|
|
530
|
+
}, c = L(new t.Map({
|
|
530
531
|
container: o.value,
|
|
531
532
|
style: r.mapStyle,
|
|
532
533
|
attributionControl: !1,
|
|
533
|
-
locale:
|
|
534
|
+
locale: w(),
|
|
534
535
|
...Object.fromEntries(Object.entries(s).filter(([, e]) => e !== void 0)),
|
|
535
536
|
...r.options
|
|
536
537
|
}));
|
|
537
538
|
u.value = t, c.on("style.load", () => {
|
|
538
|
-
f ||=
|
|
539
|
+
f ||= $(c.getStyle()), g(c), d.value++;
|
|
539
540
|
}), c.on("click", (e) => i("click", e)), c.on("moveend", () => {
|
|
540
541
|
let e = b(c);
|
|
541
542
|
i("update:center", e.center), i("update:zoom", e.zoom), i("update:bearing", e.bearing), i("update:pitch", e.pitch);
|
|
@@ -545,87 +546,87 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
545
546
|
} catch {}
|
|
546
547
|
}), c.once("load", () => {
|
|
547
548
|
l.value = c;
|
|
548
|
-
for (let e of Object.keys(x))
|
|
549
|
+
for (let e of Object.keys(x)) C(e);
|
|
549
550
|
i("ready", c);
|
|
550
551
|
});
|
|
551
|
-
}),
|
|
552
|
-
|
|
552
|
+
}), V(() => {
|
|
553
|
+
Y = !0, l.value?.remove(), l.value = void 0;
|
|
553
554
|
});
|
|
554
|
-
let
|
|
555
|
-
return
|
|
555
|
+
let X = (e, t) => Math.abs(e - t) < 1e-9;
|
|
556
|
+
return Z(() => r.center?.join(","), () => {
|
|
556
557
|
let e = l.value;
|
|
557
558
|
if (!e || !r.center) return;
|
|
558
559
|
let t = e.getCenter();
|
|
559
|
-
|
|
560
|
-
}),
|
|
561
|
-
l.value && e !== void 0 && !
|
|
562
|
-
}),
|
|
563
|
-
l.value && e !== void 0 && !
|
|
564
|
-
}),
|
|
565
|
-
l.value && e !== void 0 && !
|
|
566
|
-
}),
|
|
560
|
+
X(t.lng, r.center[0]) && X(t.lat, r.center[1]) || e.jumpTo({ center: r.center });
|
|
561
|
+
}), Z(() => r.zoom, (e) => {
|
|
562
|
+
l.value && e !== void 0 && !X(l.value.getZoom(), e) && l.value.jumpTo({ zoom: e });
|
|
563
|
+
}), Z(() => r.bearing, (e) => {
|
|
564
|
+
l.value && e !== void 0 && !X(l.value.getBearing(), e) && l.value.jumpTo({ bearing: e });
|
|
565
|
+
}), Z(() => r.pitch, (e) => {
|
|
566
|
+
l.value && e !== void 0 && !X(l.value.getPitch(), e) && l.value.jumpTo({ pitch: e });
|
|
567
|
+
}), Z(() => r.adapter, () => {
|
|
567
568
|
l.value && g(l.value);
|
|
568
|
-
}),
|
|
569
|
+
}), Z(() => r.mapStyle, (e) => l.value?.setStyle(e, {
|
|
569
570
|
diff: !1,
|
|
570
571
|
transformStyle: (e, t) => {
|
|
571
|
-
let n = f ??
|
|
572
|
-
f =
|
|
573
|
-
let i = r.keepLayers, a = i === !1 ? t :
|
|
572
|
+
let n = f ?? $(void 0);
|
|
573
|
+
f = $(t);
|
|
574
|
+
let i = r.keepLayers, a = i === !1 ? t : we(e, t, n, typeof i == "function" ? i : void 0);
|
|
574
575
|
return r.transformStyle && (a = r.transformStyle(e, a)), a;
|
|
575
576
|
}
|
|
576
577
|
})), t({
|
|
577
578
|
map: l,
|
|
578
579
|
context: h
|
|
579
|
-
}), (t, n) => (
|
|
580
|
+
}), (t, n) => (H(), k("div", {
|
|
580
581
|
ref_key: "root",
|
|
581
582
|
ref: a,
|
|
582
583
|
class: "m3-map relative overflow-hidden",
|
|
583
|
-
onPointerover:
|
|
584
|
-
onPointerout:
|
|
584
|
+
onPointerover: ee,
|
|
585
|
+
onPointerout: W,
|
|
585
586
|
onPointerdown: I,
|
|
586
|
-
onFocusin:
|
|
587
|
+
onFocusin: re,
|
|
587
588
|
onFocusout: I
|
|
588
589
|
}, [
|
|
589
|
-
|
|
590
|
+
A("div", {
|
|
590
591
|
ref_key: "container",
|
|
591
592
|
ref: o,
|
|
592
593
|
class: "h-full w-full"
|
|
593
594
|
}, null, 512),
|
|
594
|
-
l.value && e.attribution ? (
|
|
595
|
+
l.value && e.attribution ? (H(), D(ye, {
|
|
595
596
|
key: 0,
|
|
596
597
|
position: e.attribution === !0 ? "bottom-right" : e.attribution
|
|
597
|
-
}, null, 8, ["position"])) :
|
|
598
|
-
l.value ?
|
|
599
|
-
|
|
598
|
+
}, null, 8, ["position"])) : O("", !0),
|
|
599
|
+
l.value ? K(t.$slots, "default", {}, void 0, void 0, 1) : O("", !0),
|
|
600
|
+
N(T, {
|
|
600
601
|
"enter-active-class": "transition-opacity duration-150",
|
|
601
602
|
"enter-from-class": "opacity-0",
|
|
602
603
|
"leave-active-class": "transition-opacity duration-100",
|
|
603
604
|
"leave-to-class": "opacity-0"
|
|
604
605
|
}, {
|
|
605
|
-
default:
|
|
606
|
+
default: Q(() => [E.value ? (H(), k("div", {
|
|
606
607
|
key: 0,
|
|
607
608
|
role: "tooltip",
|
|
608
|
-
class:
|
|
609
|
+
class: z(["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", E.value.left ? "-translate-x-full" : ""]),
|
|
609
610
|
style: te({
|
|
610
|
-
left: `${
|
|
611
|
-
top: `${
|
|
611
|
+
left: `${E.value.x}px`,
|
|
612
|
+
top: `${E.value.y}px`
|
|
612
613
|
})
|
|
613
|
-
},
|
|
614
|
+
}, J(E.value.text), 7)) : O("", !0)]),
|
|
614
615
|
_: 1
|
|
615
616
|
})
|
|
616
617
|
], 544));
|
|
617
618
|
}
|
|
618
|
-
}),
|
|
619
|
+
}), De = 13.5, Oe = De / Math.SQRT2, ke = [0, -14], Ae = {
|
|
619
620
|
center: [0, 0],
|
|
620
621
|
top: [0, 0],
|
|
621
622
|
"top-left": [0, 0],
|
|
622
623
|
"top-right": [0, 0],
|
|
623
624
|
bottom: [0, -38.1],
|
|
624
|
-
"bottom-left": [
|
|
625
|
-
"bottom-right": [-
|
|
626
|
-
left: [
|
|
625
|
+
"bottom-left": [Oe, (24.6 + Oe) * -1],
|
|
626
|
+
"bottom-right": [-Oe, (24.6 + Oe) * -1],
|
|
627
|
+
left: [De, -24.6],
|
|
627
628
|
right: [-13.5, -24.6]
|
|
628
|
-
},
|
|
629
|
+
}, je = { class: "hidden" }, Me = /* @__PURE__ */ P({
|
|
629
630
|
inheritAttrs: !1,
|
|
630
631
|
__name: "MMapMarker",
|
|
631
632
|
props: {
|
|
@@ -641,7 +642,7 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
641
642
|
},
|
|
642
643
|
emits: ["update:lngLat", "click"],
|
|
643
644
|
setup(e, { expose: t, emit: n }) {
|
|
644
|
-
let r = e, i = n, a =
|
|
645
|
+
let r = e, i = n, a = ae(), o = G(), s = G(), { onReady: c } = pe(), l, u = !1;
|
|
645
646
|
c((e, t) => {
|
|
646
647
|
u = !!a.default && !!o.value, l = new t.Marker({
|
|
647
648
|
...u ? { element: o.value } : { color: r.color ?? "currentColor" },
|
|
@@ -660,20 +661,20 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
660
661
|
function d(e) {
|
|
661
662
|
i("click", e);
|
|
662
663
|
}
|
|
663
|
-
return
|
|
664
|
+
return Z(() => r.lngLat.join(","), () => l?.setLngLat(r.lngLat)), Z(() => r.draggable, (e) => l?.setDraggable(e)), Z(() => r.rotation, (e) => l?.setRotation(e)), Z(() => r.offset?.join(","), () => l?.setOffset(r.offset ?? (u ? [0, 0] : ke))), ne(() => {
|
|
664
665
|
l?.getElement().removeEventListener("click", d), l?.getPopup()?.remove(), l?.remove();
|
|
665
|
-
}), t({ marker: () => l }), (e, t) => (
|
|
666
|
+
}), t({ marker: () => l }), (e, t) => (H(), k("div", je, [e.$slots.default ? (H(), k("div", R({
|
|
666
667
|
key: 0,
|
|
667
668
|
ref_key: "content",
|
|
668
669
|
ref: o,
|
|
669
670
|
class: "m3-map-marker"
|
|
670
|
-
}, e.$attrs), [
|
|
671
|
+
}, e.$attrs), [K(e.$slots, "default")], 16)) : O("", !0), e.$slots.popup ? (H(), k("div", {
|
|
671
672
|
key: 1,
|
|
672
673
|
ref_key: "popupContent",
|
|
673
674
|
ref: s
|
|
674
|
-
}, [
|
|
675
|
+
}, [K(e.$slots, "popup")], 512)) : O("", !0)]));
|
|
675
676
|
}
|
|
676
|
-
}),
|
|
677
|
+
}), Ne = { class: "hidden" }, Pe = /* @__PURE__ */ P({
|
|
677
678
|
inheritAttrs: !1,
|
|
678
679
|
__name: "MMapPopup",
|
|
679
680
|
props: {
|
|
@@ -696,7 +697,7 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
696
697
|
},
|
|
697
698
|
emits: ["update:open"],
|
|
698
699
|
setup(e, { expose: t, emit: n }) {
|
|
699
|
-
let r = e, i = n, a =
|
|
700
|
+
let r = e, i = n, a = G(), { onReady: o } = pe(), s, c, l = !1;
|
|
700
701
|
function u() {
|
|
701
702
|
s && c && !s.isOpen() && s.setLngLat(r.lngLat).addTo(c);
|
|
702
703
|
}
|
|
@@ -712,16 +713,16 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
712
713
|
}), a.value && s.setDOMContent(a.value), s.on("close", () => {
|
|
713
714
|
l || i("update:open", !1);
|
|
714
715
|
}), r.open && u();
|
|
715
|
-
}),
|
|
716
|
+
}), Z(() => r.open, (e) => {
|
|
716
717
|
e ? u() : s?.isOpen() && (l = !0, s.remove(), l = !1);
|
|
717
|
-
}),
|
|
718
|
+
}), Z(() => r.lngLat.join(","), () => s?.setLngLat(r.lngLat)), Z(() => r.maxWidth, (e) => s?.setMaxWidth(e)), Z(() => r.offset, (e) => s?.setOffset(e ?? 0)), ne(() => {
|
|
718
719
|
l = !0, s?.remove();
|
|
719
|
-
}), t({ popup: () => s }), (e, t) => (
|
|
720
|
+
}), t({ popup: () => s }), (e, t) => (H(), k("div", Ne, [A("div", R({
|
|
720
721
|
ref_key: "content",
|
|
721
722
|
ref: a
|
|
722
|
-
}, e.$attrs), [
|
|
723
|
+
}, e.$attrs), [K(e.$slots, "default")], 16)]));
|
|
723
724
|
}
|
|
724
|
-
}),
|
|
725
|
+
}), Fe = /* @__PURE__ */ P({
|
|
725
726
|
inheritAttrs: !1,
|
|
726
727
|
__name: "MMapGeoJson",
|
|
727
728
|
props: {
|
|
@@ -737,13 +738,13 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
737
738
|
},
|
|
738
739
|
emits: ["click"],
|
|
739
740
|
setup(e, { expose: t, emit: n }) {
|
|
740
|
-
let r = e, i = n, a = r.id ?? `m3-geojson-${
|
|
741
|
+
let r = e, i = n, a = r.id ?? `m3-geojson-${ie()}`, { onReady: o, styleVersion: s } = pe(), c = l(["primary", "surface"]), u = (...e) => [
|
|
741
742
|
"match",
|
|
742
743
|
["geometry-type"],
|
|
743
744
|
e,
|
|
744
745
|
!0,
|
|
745
746
|
!1
|
|
746
|
-
], d =
|
|
747
|
+
], d = E(() => {
|
|
747
748
|
let { primary: e, surface: t } = c.value;
|
|
748
749
|
return [
|
|
749
750
|
{
|
|
@@ -776,7 +777,7 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
776
777
|
}
|
|
777
778
|
}
|
|
778
779
|
];
|
|
779
|
-
}), f =
|
|
780
|
+
}), f = E(() => (r.layers ?? d.value).map((e, t) => ({
|
|
780
781
|
...e,
|
|
781
782
|
id: e.id ?? `${a}-${t}`,
|
|
782
783
|
source: a
|
|
@@ -806,14 +807,14 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
806
807
|
}
|
|
807
808
|
return o((e) => {
|
|
808
809
|
p = e, b();
|
|
809
|
-
}),
|
|
810
|
+
}), Z(s, () => b()), Z(() => r.data, (e) => (p?.getSource(a))?.setData(e)), Z(() => JSON.stringify(f.value), () => y()), Z(() => r.before, () => y()), ne(() => {
|
|
810
811
|
p &&= (v(), p.getSource(a) && p.removeSource(a), void 0);
|
|
811
812
|
}), t({
|
|
812
813
|
sourceId: a,
|
|
813
814
|
layerIds: () => [...m]
|
|
814
815
|
}), (e, t) => null;
|
|
815
816
|
}
|
|
816
|
-
}),
|
|
817
|
+
}), Ie = ["aria-label", "onClick"], Le = /* @__PURE__ */ P({
|
|
817
818
|
inheritAttrs: !1,
|
|
818
819
|
__name: "MMapCluster",
|
|
819
820
|
props: {
|
|
@@ -836,12 +837,12 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
836
837
|
},
|
|
837
838
|
emits: ["click", "cluster-click"],
|
|
838
839
|
setup(e, { expose: t, emit: n }) {
|
|
839
|
-
let r = e, i = n, a = r.id ?? `m3-cluster-${
|
|
840
|
+
let r = e, i = n, a = r.id ?? `m3-cluster-${ie()}`, o = s(), { onReady: c, styleVersion: u } = pe(), d = l([
|
|
840
841
|
"primary",
|
|
841
842
|
"secondary",
|
|
842
843
|
"tertiary",
|
|
843
844
|
"surface"
|
|
844
|
-
]), f = ["!", ["has", "point_count"]], p =
|
|
845
|
+
]), f = ["!", ["has", "point_count"]], p = E(() => {
|
|
845
846
|
let e = d.value[r.color];
|
|
846
847
|
return (r.pointLayers ?? [{
|
|
847
848
|
type: "circle",
|
|
@@ -865,29 +866,29 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
865
866
|
function h(e) {
|
|
866
867
|
return e < 10 ? 32 : e < 100 ? 40 : e < 1e3 ? 48 : 56;
|
|
867
868
|
}
|
|
868
|
-
let g =
|
|
869
|
+
let g = E(() => {
|
|
869
870
|
let e = typeof document < "u" && document.documentElement.lang || void 0;
|
|
870
871
|
return new Intl.NumberFormat(e, {
|
|
871
872
|
notation: "compact",
|
|
872
873
|
maximumFractionDigits: 1
|
|
873
874
|
});
|
|
874
|
-
}), _, v, y = [], b = /* @__PURE__ */ new Map(),
|
|
875
|
-
function
|
|
875
|
+
}), _, v, y = [], b = /* @__PURE__ */ new Map(), x = q([]), S = () => _?.getSource(a);
|
|
876
|
+
function T(e, t, n) {
|
|
876
877
|
return {
|
|
877
878
|
id: e,
|
|
878
879
|
count: t,
|
|
879
880
|
lngLat: n,
|
|
880
881
|
zoomIn: async () => {
|
|
881
|
-
let t = await
|
|
882
|
+
let t = await S()?.getClusterExpansionZoom(e);
|
|
882
883
|
t !== void 0 && _ && _.easeTo({
|
|
883
884
|
center: n,
|
|
884
885
|
zoom: Math.min(t, _.getMaxZoom())
|
|
885
886
|
});
|
|
886
887
|
},
|
|
887
|
-
leaves: async (t = Infinity) => await
|
|
888
|
+
leaves: async (t = Infinity) => await S()?.getClusterLeaves(e, t, 0) ?? []
|
|
888
889
|
};
|
|
889
890
|
}
|
|
890
|
-
function
|
|
891
|
+
function O() {
|
|
891
892
|
if (j = 0, !_ || !v || !_.getSource(a)) return;
|
|
892
893
|
let e = /* @__PURE__ */ new Set();
|
|
893
894
|
for (let t of _.querySourceFeatures(a, { filter: ["has", "point_count"] })) {
|
|
@@ -907,38 +908,38 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
907
908
|
anchor: "center"
|
|
908
909
|
}).setLngLat([i, a]).addTo(_);
|
|
909
910
|
b.set(r, {
|
|
910
|
-
...
|
|
911
|
+
...T(r, n.point_count, [i, a]),
|
|
911
912
|
el: s,
|
|
912
913
|
marker: c
|
|
913
914
|
});
|
|
914
915
|
}
|
|
915
916
|
for (let [t, n] of b) e.has(t) || (n.marker.remove(), b.delete(t));
|
|
916
|
-
|
|
917
|
+
x.value = [...b.values()];
|
|
917
918
|
}
|
|
918
919
|
let j = 0;
|
|
919
920
|
function M() {
|
|
920
|
-
j ||= requestAnimationFrame(
|
|
921
|
+
j ||= requestAnimationFrame(O);
|
|
921
922
|
}
|
|
922
923
|
let N = (e) => {
|
|
923
924
|
e.sourceId === a && M();
|
|
924
|
-
}, P = (e) => i("click", e),
|
|
925
|
+
}, P = (e) => i("click", e), F = () => {
|
|
925
926
|
r.interactive && _ && (_.getCanvas().style.cursor = "pointer");
|
|
926
|
-
},
|
|
927
|
+
}, I = () => {
|
|
927
928
|
r.interactive && _ && (_.getCanvas().style.cursor = "");
|
|
928
929
|
};
|
|
929
|
-
function
|
|
930
|
+
function L() {
|
|
930
931
|
if (_) {
|
|
931
|
-
for (let e of y) _.off("click", e, P), _.off("mouseenter", e,
|
|
932
|
+
for (let e of y) _.off("click", e, P), _.off("mouseenter", e, F), _.off("mouseleave", e, I), _.getLayer(e) && _.removeLayer(e);
|
|
932
933
|
y = [];
|
|
933
934
|
}
|
|
934
935
|
}
|
|
935
936
|
function R() {
|
|
936
937
|
if (_) {
|
|
937
|
-
|
|
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,
|
|
938
|
+
L();
|
|
939
|
+
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, F), _.on("mouseleave", e.id, I), y.push(e.id);
|
|
939
940
|
}
|
|
940
941
|
}
|
|
941
|
-
function
|
|
942
|
+
function ee() {
|
|
942
943
|
return {
|
|
943
944
|
type: "geojson",
|
|
944
945
|
data: r.data,
|
|
@@ -949,21 +950,21 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
949
950
|
};
|
|
950
951
|
}
|
|
951
952
|
function B() {
|
|
952
|
-
_ && (_.getSource(a) || (_.addSource(a,
|
|
953
|
+
_ && (_.getSource(a) || (_.addSource(a, ee()), y = []), y.length && _.getLayer(y[0]) || R(), M());
|
|
953
954
|
}
|
|
954
|
-
function
|
|
955
|
-
_ && (
|
|
955
|
+
function V() {
|
|
956
|
+
_ && (L(), _.getSource(a) && _.removeSource(a), B());
|
|
956
957
|
}
|
|
957
958
|
c((e, t) => {
|
|
958
959
|
_ = e, v = t, B(), _.on("sourcedata", N), _.on("move", M), _.on("moveend", M);
|
|
959
|
-
}),
|
|
960
|
-
|
|
961
|
-
}),
|
|
960
|
+
}), Z(u, () => B()), Z(() => r.data, (e) => {
|
|
961
|
+
S()?.setData(e), M();
|
|
962
|
+
}), Z(() => [
|
|
962
963
|
r.radius,
|
|
963
964
|
r.maxZoom,
|
|
964
965
|
JSON.stringify(r.sourceOptions)
|
|
965
|
-
].join("|"),
|
|
966
|
-
function
|
|
966
|
+
].join("|"), V), Z(() => JSON.stringify(p.value), () => R()), Z(() => r.before, () => R());
|
|
967
|
+
function U(e) {
|
|
967
968
|
let t = {
|
|
968
969
|
id: e.id,
|
|
969
970
|
count: e.count,
|
|
@@ -973,55 +974,523 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
973
974
|
};
|
|
974
975
|
i("cluster-click", t), r.zoomOnClick && e.zoomIn();
|
|
975
976
|
}
|
|
976
|
-
let
|
|
977
|
+
let W = (e) => o.mapClusterZoom.replace("{count}", String(e));
|
|
977
978
|
return ne(() => {
|
|
978
979
|
j && cancelAnimationFrame(j);
|
|
979
980
|
for (let e of b.values()) e.marker.remove();
|
|
980
|
-
b.clear(),
|
|
981
|
+
b.clear(), x.value = [], _ &&= (_.off("sourcedata", N), _.off("move", M), _.off("moveend", M), L(), _.getSource(a) && _.removeSource(a), void 0);
|
|
981
982
|
}), t({
|
|
982
983
|
sourceId: a,
|
|
983
984
|
layerIds: () => [...y],
|
|
984
|
-
clusters: () =>
|
|
985
|
+
clusters: () => x.value.map(({ id: e, count: t, lngLat: n, zoomIn: r, leaves: i }) => ({
|
|
985
986
|
id: e,
|
|
986
987
|
count: t,
|
|
987
988
|
lngLat: n,
|
|
988
989
|
zoomIn: r,
|
|
989
990
|
leaves: i
|
|
990
991
|
}))
|
|
991
|
-
}), (t, n) => (
|
|
992
|
+
}), (t, n) => (H(!0), k(C, null, re(x.value, (n) => (H(), D(w, {
|
|
992
993
|
key: n.id,
|
|
993
994
|
to: n.el
|
|
994
|
-
}, [
|
|
995
|
+
}, [K(t.$slots, "cluster", {
|
|
995
996
|
id: n.id,
|
|
996
997
|
count: n.count,
|
|
997
998
|
label: g.value.format(n.count),
|
|
998
999
|
lngLat: n.lngLat,
|
|
999
1000
|
zoomIn: n.zoomIn,
|
|
1000
1001
|
leaves: n.leaves
|
|
1001
|
-
}, () => [
|
|
1002
|
+
}, () => [A("button", {
|
|
1002
1003
|
type: "button",
|
|
1003
|
-
class:
|
|
1004
|
+
class: z(["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]]),
|
|
1004
1005
|
style: te({
|
|
1005
1006
|
width: `${h(n.count)}px`,
|
|
1006
1007
|
height: `${h(n.count)}px`
|
|
1007
1008
|
}),
|
|
1008
|
-
"aria-label":
|
|
1009
|
-
onClick: se((e) =>
|
|
1010
|
-
},
|
|
1009
|
+
"aria-label": W(n.count),
|
|
1010
|
+
onClick: se((e) => U(n), ["stop"])
|
|
1011
|
+
}, J(g.value.format(n.count)), 15, Ie)])], 8, ["to"]))), 128));
|
|
1012
|
+
}
|
|
1013
|
+
}), Re = 6371008.8, ze = Math.PI / 180;
|
|
1014
|
+
function Be(e, t) {
|
|
1015
|
+
let n = (t[1] - e[1]) * ze, r = (t[0] - e[0]) * ze, i = Math.sin(n / 2) ** 2 + Math.cos(e[1] * ze) * Math.cos(t[1] * ze) * Math.sin(r / 2) ** 2;
|
|
1016
|
+
return 2 * Re * Math.asin(Math.min(1, Math.sqrt(i)));
|
|
1017
|
+
}
|
|
1018
|
+
function Ve(e) {
|
|
1019
|
+
let t = 0;
|
|
1020
|
+
for (let n = 1; n < e.length; n++) t += Be(e[n - 1], e[n]);
|
|
1021
|
+
return t;
|
|
1022
|
+
}
|
|
1023
|
+
function He(e, t) {
|
|
1024
|
+
let [n, r, i, a] = [
|
|
1025
|
+
e[0] * ze,
|
|
1026
|
+
e[1] * ze,
|
|
1027
|
+
t[0] * ze,
|
|
1028
|
+
t[1] * ze
|
|
1029
|
+
], 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));
|
|
1030
|
+
return [(n + Math.atan2(s, Math.cos(r) + o)) / ze, c / ze];
|
|
1031
|
+
}
|
|
1032
|
+
function Ue(e) {
|
|
1033
|
+
let t = We(e), n = t.length - 1;
|
|
1034
|
+
if (n <= 2) return 0;
|
|
1035
|
+
let r = 0;
|
|
1036
|
+
for (let e = 0; e < n; e++) {
|
|
1037
|
+
let i = t[e], a = t[e + 1 === n ? 0 : e + 1], o = t[e + 2 >= n ? (e + 2) % n : e + 2];
|
|
1038
|
+
r += (o[0] - i[0]) * ze * Math.sin(a[1] * ze);
|
|
1039
|
+
}
|
|
1040
|
+
return Math.abs(r * Re * Re / 2);
|
|
1041
|
+
}
|
|
1042
|
+
function We(e) {
|
|
1043
|
+
let t = e[0], n = e[e.length - 1];
|
|
1044
|
+
return t && n && (t[0] !== n[0] || t[1] !== n[1]) ? [...e, t] : e;
|
|
1045
|
+
}
|
|
1046
|
+
function Ge(e) {
|
|
1047
|
+
let t = We(e), n = 0, r = 0, i = 0;
|
|
1048
|
+
for (let e = 0; e < t.length - 1; e++) {
|
|
1049
|
+
let [a, o] = t[e], [s, c] = t[e + 1], l = a * c - s * o;
|
|
1050
|
+
n += l, r += (a + s) * l, i += (o + c) * l;
|
|
1051
|
+
}
|
|
1052
|
+
if (Math.abs(n) < 1e-12) {
|
|
1053
|
+
let e = t.slice(0, -1);
|
|
1054
|
+
return [e.reduce((e, t) => e + t[0], 0) / e.length, e.reduce((e, t) => e + t[1], 0) / e.length];
|
|
1055
|
+
}
|
|
1056
|
+
return [r / (3 * n), i / (3 * n)];
|
|
1057
|
+
}
|
|
1058
|
+
// src/composables/_routeGeometry.ts
|
|
1059
|
+
var Ke = Math.PI / 180;
|
|
1060
|
+
function qe(e) {
|
|
1061
|
+
let t = [0];
|
|
1062
|
+
for (let n = 1; n < e.length; n++) t.push(t[n - 1] + Be(e[n - 1], e[n]));
|
|
1063
|
+
return t;
|
|
1064
|
+
}
|
|
1065
|
+
function Je(e, t) {
|
|
1066
|
+
let n = e[1] * Ke, r = t[1] * Ke, i = (t[0] - e[0]) * Ke, a = Math.sin(i) * Math.cos(r), o = Math.cos(n) * Math.sin(r) - Math.sin(n) * Math.cos(r) * Math.cos(i);
|
|
1067
|
+
return (Math.atan2(a, o) / Ke + 360) % 360;
|
|
1068
|
+
}
|
|
1069
|
+
function Ye(e, t) {
|
|
1070
|
+
let n = 0, r = e.length - 1;
|
|
1071
|
+
for (; r - n > 1;) {
|
|
1072
|
+
let i = n + r >> 1;
|
|
1073
|
+
e[i] <= t ? n = i : r = i;
|
|
1074
|
+
}
|
|
1075
|
+
return n;
|
|
1076
|
+
}
|
|
1077
|
+
function Xe(e, t, n) {
|
|
1078
|
+
if (e.length === 0) return {
|
|
1079
|
+
lngLat: [0, 0],
|
|
1080
|
+
bearing: 0
|
|
1081
|
+
};
|
|
1082
|
+
if (e.length === 1) return {
|
|
1083
|
+
lngLat: e[0],
|
|
1084
|
+
bearing: 0
|
|
1085
|
+
};
|
|
1086
|
+
let r = t[t.length - 1], i = Math.min(Math.max(n, 0), r), a = Math.min(Ye(t, i), e.length - 2), o = e[a], s = e[a + 1], c = t[a + 1] - t[a], l = c > 0 ? (i - t[a]) / c : 0;
|
|
1087
|
+
return {
|
|
1088
|
+
lngLat: [o[0] + (s[0] - o[0]) * l, o[1] + (s[1] - o[1]) * l],
|
|
1089
|
+
bearing: Ze(e, t, a)
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
function Ze(e, t, n) {
|
|
1093
|
+
for (let r = n; r < e.length - 1; r++) if (t[r + 1] > t[r]) return Je(e[r], e[r + 1]);
|
|
1094
|
+
for (let r = n - 1; r >= 0; r--) if (t[r + 1] > t[r]) return Je(e[r], e[r + 1]);
|
|
1095
|
+
return 0;
|
|
1096
|
+
}
|
|
1097
|
+
function Qe(e, t, n, r) {
|
|
1098
|
+
if (e.length < 2) return [...e];
|
|
1099
|
+
let i = t[t.length - 1], a = Math.min(Math.max(n, 0), i), o = Math.min(Math.max(r, a), i), s = [Xe(e, t, a).lngLat];
|
|
1100
|
+
for (let n = 0; n < e.length; n++) t[n] > a && t[n] < o && s.push(e[n]);
|
|
1101
|
+
return s.push(Xe(e, t, o).lngLat), s;
|
|
1102
|
+
}
|
|
1103
|
+
function $e(e, t, n) {
|
|
1104
|
+
if (e.length < 2) return 0;
|
|
1105
|
+
let r = Math.cos(n[1] * Ke), i = Infinity, a = 0;
|
|
1106
|
+
for (let o = 0; o < e.length - 1; o++) {
|
|
1107
|
+
let s = e[o], c = e[o + 1], l = s[0] * r, u = s[1], d = c[0] * r, f = c[1], p = n[0] * r, m = n[1], h = d - l, g = f - u, _ = h * h + g * g, v = _ > 0 ? Math.min(1, Math.max(0, ((p - l) * h + (m - u) * g) / _)) : 0, y = l + h * v - p, b = u + g * v - m, x = y * y + b * b;
|
|
1108
|
+
x < i && (i = x, a = t[o] + (t[o + 1] - t[o]) * v);
|
|
1109
|
+
}
|
|
1110
|
+
return a;
|
|
1111
|
+
}
|
|
1112
|
+
function et(e, t, n, r, i = 25) {
|
|
1113
|
+
if (e.length < 2) return 0;
|
|
1114
|
+
let a = Math.cos(n[1] * Ke), o = t[t.length - 1];
|
|
1115
|
+
if (r >= o) return o;
|
|
1116
|
+
let s = Infinity, c = r;
|
|
1117
|
+
for (let o = 0; o < e.length - 1; o++) {
|
|
1118
|
+
if (t[o + 1] < r - i) continue;
|
|
1119
|
+
let l = e[o], u = e[o + 1], d = l[0] * a, f = l[1], p = u[0] * a, m = u[1], h = n[0] * a, g = n[1], _ = p - d, v = m - f, y = _ * _ + v * v, b = y > 0 ? Math.min(1, Math.max(0, ((h - d) * _ + (g - f) * v) / y)) : 0, x = Math.hypot(d + _ * b - h, f + v * b - g) * 111320, S = t[o] + (t[o + 1] - t[o]) * b, C = x + .05 * Math.max(0, S - r);
|
|
1120
|
+
C < s && (s = C, c = S);
|
|
1011
1121
|
}
|
|
1012
|
-
|
|
1122
|
+
return Math.max(c, r);
|
|
1123
|
+
}
|
|
1124
|
+
function tt(e) {
|
|
1125
|
+
let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
|
|
1126
|
+
for (let [a, o] of e) t = Math.min(t, a), r = Math.max(r, a), n = Math.min(n, o), i = Math.max(i, o);
|
|
1127
|
+
return [[t, n], [r, i]];
|
|
1128
|
+
}
|
|
1129
|
+
// src/components/MMapRoute.vue?vue&type=script&setup=true&lang.ts
|
|
1130
|
+
var nt = { class: "hidden" }, rt = ["aria-label", "title"], it = ["aria-label"], at = /* @__PURE__ */ P({
|
|
1131
|
+
inheritAttrs: !1,
|
|
1132
|
+
__name: "MMapRoute",
|
|
1133
|
+
props: {
|
|
1134
|
+
stops: {},
|
|
1135
|
+
path: {},
|
|
1136
|
+
progress: {},
|
|
1137
|
+
vehicle: {},
|
|
1138
|
+
vehicleIcon: { default: "navigation" },
|
|
1139
|
+
rotateVehicle: {
|
|
1140
|
+
type: Boolean,
|
|
1141
|
+
default: void 0
|
|
1142
|
+
},
|
|
1143
|
+
showVehicle: {
|
|
1144
|
+
type: Boolean,
|
|
1145
|
+
default: !0
|
|
1146
|
+
},
|
|
1147
|
+
duration: { default: 1e3 },
|
|
1148
|
+
fit: {
|
|
1149
|
+
type: Boolean,
|
|
1150
|
+
default: !0
|
|
1151
|
+
},
|
|
1152
|
+
follow: {
|
|
1153
|
+
type: Boolean,
|
|
1154
|
+
default: !1
|
|
1155
|
+
},
|
|
1156
|
+
padding: { default: 64 },
|
|
1157
|
+
color: {},
|
|
1158
|
+
flow: {
|
|
1159
|
+
type: Boolean,
|
|
1160
|
+
default: !0
|
|
1161
|
+
},
|
|
1162
|
+
width: { default: 5 },
|
|
1163
|
+
before: {},
|
|
1164
|
+
id: {},
|
|
1165
|
+
provider: {},
|
|
1166
|
+
snap: { default: "forward" }
|
|
1167
|
+
},
|
|
1168
|
+
emits: [
|
|
1169
|
+
"stop-click",
|
|
1170
|
+
"arrive",
|
|
1171
|
+
"route",
|
|
1172
|
+
"error"
|
|
1173
|
+
],
|
|
1174
|
+
setup(t, { expose: n, emit: r }) {
|
|
1175
|
+
let i = t, a = r, c = ae(), u = s(), d = i.id ?? `m3-route-${ie()}`, { onReady: f, styleVersion: p } = pe(), m = l([
|
|
1176
|
+
"primary",
|
|
1177
|
+
"outline",
|
|
1178
|
+
"surface"
|
|
1179
|
+
]), h = q(null), g = E(() => i.path && i.path.length > 1 ? i.path : h.value && h.value.length > 1 ? h.value : i.stops.map((e) => e.lngLat)), _ = E(() => JSON.stringify(g.value)), v = E(() => qe(g.value)), y = E(() => v.value[v.value.length - 1] ?? 0), b = E(() => {
|
|
1180
|
+
let e = 0;
|
|
1181
|
+
return i.stops.map((t) => e = et(g.value, v.value, t.lngLat, e, 0));
|
|
1182
|
+
}), x = null;
|
|
1183
|
+
function S() {
|
|
1184
|
+
if (i.vehicle) {
|
|
1185
|
+
let e = i.snap === "nearest" || x == null ? $e(g.value, v.value, i.vehicle) : et(g.value, v.value, i.vehicle, x);
|
|
1186
|
+
return x = e, e;
|
|
1187
|
+
}
|
|
1188
|
+
return x = null, i.progress != null && Number.isFinite(i.progress) ? Math.min(Math.max(i.progress, 0), 1) * y.value : null;
|
|
1189
|
+
}
|
|
1190
|
+
let w = G(S());
|
|
1191
|
+
Z([
|
|
1192
|
+
() => i.vehicle?.join(","),
|
|
1193
|
+
() => i.progress,
|
|
1194
|
+
() => i.snap
|
|
1195
|
+
], () => w.value = S());
|
|
1196
|
+
let T;
|
|
1197
|
+
async function O() {
|
|
1198
|
+
if (T?.abort(), !i.provider || i.path && i.path.length > 1 || i.stops.length < 2) {
|
|
1199
|
+
h.value = null;
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
let e = T = new AbortController();
|
|
1203
|
+
try {
|
|
1204
|
+
let t = await i.provider(i.stops.map((e) => e.lngLat), { signal: e.signal });
|
|
1205
|
+
if (e.signal.aborted) return;
|
|
1206
|
+
h.value = t.path, a("route", t);
|
|
1207
|
+
} catch (t) {
|
|
1208
|
+
e.signal.aborted || (h.value = null, a("error", t));
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
B(O), Z([
|
|
1212
|
+
() => JSON.stringify(i.stops.map((e) => e.lngLat)),
|
|
1213
|
+
() => i.provider,
|
|
1214
|
+
() => !!(i.path && i.path.length > 1)
|
|
1215
|
+
], () => O());
|
|
1216
|
+
let P = 0, F = G(0), I = G(0), L = 0, R = (e) => i.stops[e]?.done ?? (w.value != null && F.value >= b.value[e] - 1), ee = E(() => i.color ?? m.value.primary), V, U, W = G(), Y = [
|
|
1217
|
+
`${d}-rest`,
|
|
1218
|
+
`${d}-casing`,
|
|
1219
|
+
`${d}-done`
|
|
1220
|
+
];
|
|
1221
|
+
function oe(e) {
|
|
1222
|
+
let t = (e, t) => ({
|
|
1223
|
+
type: "Feature",
|
|
1224
|
+
properties: { part: t },
|
|
1225
|
+
geometry: {
|
|
1226
|
+
type: "LineString",
|
|
1227
|
+
coordinates: e
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
return {
|
|
1231
|
+
type: "FeatureCollection",
|
|
1232
|
+
features: [t(g.value, "rest"), t(Qe(g.value, v.value, 0, e), "done")]
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
function se() {
|
|
1236
|
+
let e = i.width, t = {
|
|
1237
|
+
"line-cap": "round",
|
|
1238
|
+
"line-join": "round"
|
|
1239
|
+
};
|
|
1240
|
+
return [
|
|
1241
|
+
{
|
|
1242
|
+
id: Y[0],
|
|
1243
|
+
type: "line",
|
|
1244
|
+
source: d,
|
|
1245
|
+
filter: [
|
|
1246
|
+
"==",
|
|
1247
|
+
["get", "part"],
|
|
1248
|
+
"rest"
|
|
1249
|
+
],
|
|
1250
|
+
layout: {
|
|
1251
|
+
"line-cap": "butt",
|
|
1252
|
+
"line-join": "round"
|
|
1253
|
+
},
|
|
1254
|
+
paint: {
|
|
1255
|
+
"line-color": m.value.outline,
|
|
1256
|
+
"line-width": e * .8,
|
|
1257
|
+
"line-dasharray": me(Math.max(_e, 0))
|
|
1258
|
+
}
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
id: Y[1],
|
|
1262
|
+
type: "line",
|
|
1263
|
+
source: d,
|
|
1264
|
+
filter: [
|
|
1265
|
+
"==",
|
|
1266
|
+
["get", "part"],
|
|
1267
|
+
"done"
|
|
1268
|
+
],
|
|
1269
|
+
layout: t,
|
|
1270
|
+
paint: {
|
|
1271
|
+
"line-color": m.value.surface,
|
|
1272
|
+
"line-width": e + 4
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
id: Y[2],
|
|
1277
|
+
type: "line",
|
|
1278
|
+
source: d,
|
|
1279
|
+
filter: [
|
|
1280
|
+
"==",
|
|
1281
|
+
["get", "part"],
|
|
1282
|
+
"done"
|
|
1283
|
+
],
|
|
1284
|
+
layout: t,
|
|
1285
|
+
paint: {
|
|
1286
|
+
"line-color": ee.value,
|
|
1287
|
+
"line-width": e
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
];
|
|
1291
|
+
}
|
|
1292
|
+
function ce() {
|
|
1293
|
+
if (V) {
|
|
1294
|
+
V.getSource(d) || V.addSource(d, {
|
|
1295
|
+
type: "geojson",
|
|
1296
|
+
data: oe(P),
|
|
1297
|
+
tolerance: 0
|
|
1298
|
+
});
|
|
1299
|
+
for (let e of se()) V.getLayer(e.id) && V.removeLayer(e.id), V.addLayer(e, i.before && V.getLayer(i.before) ? i.before : void 0);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
function le(e) {
|
|
1303
|
+
P = e;
|
|
1304
|
+
let { lngLat: t } = Xe(g.value, v.value, e), n = Ce(e);
|
|
1305
|
+
(V?.getSource(d))?.setData(oe(e)), U?.setLngLat(t), $.value && U?.setRotation(n), I.value = n, n > 200 && n < 340 ? de.value = !0 : n > 20 && n < 160 && (de.value = !1), i.follow && V?.jumpTo({ center: t }), ue(e) !== ue(F.value) && (F.value = e);
|
|
1306
|
+
}
|
|
1307
|
+
let ue = (e) => b.value.filter((t) => e >= t - 1).length, de = G(!1), fe = 1.6;
|
|
1308
|
+
function me(e) {
|
|
1309
|
+
let t = 2.6, n = e / 16 * t;
|
|
1310
|
+
return n <= fe ? [
|
|
1311
|
+
0,
|
|
1312
|
+
n,
|
|
1313
|
+
1,
|
|
1314
|
+
fe - n
|
|
1315
|
+
] : [
|
|
1316
|
+
n - fe,
|
|
1317
|
+
fe,
|
|
1318
|
+
t - n,
|
|
1319
|
+
0
|
|
1320
|
+
];
|
|
1321
|
+
}
|
|
1322
|
+
let he = 0, ge = 0, _e = -1;
|
|
1323
|
+
function ve(e) {
|
|
1324
|
+
let t = 2.6 * i.width * .8, n = Math.floor((e - ge) / 1e3 * 16 / t * 16) % 16;
|
|
1325
|
+
n !== _e && V?.getLayer(Y[0]) && (_e = n, V.setPaintProperty(Y[0], "line-dasharray", me(n))), he = requestAnimationFrame(ve);
|
|
1326
|
+
}
|
|
1327
|
+
let ye = !0, be;
|
|
1328
|
+
function xe() {
|
|
1329
|
+
!be && V && typeof IntersectionObserver < "u" && (be = new IntersectionObserver(([e]) => {
|
|
1330
|
+
let t = !!e?.isIntersecting;
|
|
1331
|
+
t !== ye && (ye = t, Se());
|
|
1332
|
+
}), be.observe(V.getContainer()));
|
|
1333
|
+
}
|
|
1334
|
+
function Se() {
|
|
1335
|
+
cancelAnimationFrame(he), _e = -1, xe(), (ye || !i.flow) && (i.flow && V && !o() ? (ge = performance.now(), he = requestAnimationFrame(ve)) : V?.getLayer(Y[0]) && V.setPaintProperty(Y[0], "line-dasharray", me(0)));
|
|
1336
|
+
}
|
|
1337
|
+
function Ce(e) {
|
|
1338
|
+
let t = Xe(g.value, v.value, Math.max(e - 10, 0)).lngLat, n = Xe(g.value, v.value, Math.min(e + 25, y.value)).lngLat;
|
|
1339
|
+
return t[0] === n[0] && t[1] === n[1] ? Xe(g.value, v.value, e).bearing : Je(t, n);
|
|
1340
|
+
}
|
|
1341
|
+
let $ = E(() => i.rotateVehicle ?? (i.vehicleIcon === "navigation" && !c.vehicle));
|
|
1342
|
+
function we(e) {
|
|
1343
|
+
cancelAnimationFrame(L);
|
|
1344
|
+
let t = P, n = o() ? 0 : i.duration;
|
|
1345
|
+
if (n <= 0 || t === e) {
|
|
1346
|
+
le(e), F.value = e, Ee();
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
let r = performance.now(), a = (i) => {
|
|
1350
|
+
let o = Math.min(1, (i - r) / n);
|
|
1351
|
+
le(t + (e - t) * o), o < 1 ? L = requestAnimationFrame(a) : (F.value = e, Ee());
|
|
1352
|
+
};
|
|
1353
|
+
L = requestAnimationFrame(a);
|
|
1354
|
+
}
|
|
1355
|
+
let Te = !1;
|
|
1356
|
+
function Ee() {
|
|
1357
|
+
let e = y.value > 0 && P >= y.value - 1;
|
|
1358
|
+
e && !Te && a("arrive"), Te = e;
|
|
1359
|
+
}
|
|
1360
|
+
function De() {
|
|
1361
|
+
!V || g.value.length < 2 || V.fitBounds(tt(g.value), {
|
|
1362
|
+
padding: i.padding,
|
|
1363
|
+
duration: o() ? 0 : 600
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
let Oe = E(() => i.showVehicle && w.value != null);
|
|
1367
|
+
f((e, t) => {
|
|
1368
|
+
V = e, P = w.value ?? 0, F.value = P, ce(), W.value && (U = new t.Marker({
|
|
1369
|
+
element: W.value,
|
|
1370
|
+
rotationAlignment: $.value ? "map" : "viewport",
|
|
1371
|
+
subpixelPositioning: !0
|
|
1372
|
+
}), Oe.value && U.setLngLat(Xe(g.value, v.value, P).lngLat).addTo(e)), le(P), Te = y.value > 0 && P >= y.value - 1, i.fit && De(), Se();
|
|
1373
|
+
}), Z(() => i.flow, Se), Z(p, () => ce()), Z($, (e) => {
|
|
1374
|
+
U?.setRotationAlignment(e ? "map" : "viewport"), U?.setRotation(e ? I.value : 0);
|
|
1375
|
+
}), Z(w, (e) => {
|
|
1376
|
+
e != null && V && we(e);
|
|
1377
|
+
}), Z(Oe, (e) => {
|
|
1378
|
+
V && U && (e ? U.setLngLat(Xe(g.value, v.value, P).lngLat).addTo(V) : U.remove());
|
|
1379
|
+
}), Z(_, () => {
|
|
1380
|
+
x = null, w.value = S(), V && (P = Math.min(w.value ?? 0, y.value), F.value = P, le(P), i.fit && De());
|
|
1381
|
+
}), Z(() => [
|
|
1382
|
+
ee.value,
|
|
1383
|
+
m.value.outline,
|
|
1384
|
+
m.value.surface,
|
|
1385
|
+
i.width,
|
|
1386
|
+
i.before
|
|
1387
|
+
], () => ce()), ne(() => {
|
|
1388
|
+
if (T?.abort(), cancelAnimationFrame(he), be?.disconnect(), cancelAnimationFrame(L), U?.remove(), V) {
|
|
1389
|
+
for (let e of Y) V.getLayer(e) && V.removeLayer(e);
|
|
1390
|
+
V.getSource(d) && V.removeSource(d);
|
|
1391
|
+
}
|
|
1392
|
+
V = void 0;
|
|
1393
|
+
});
|
|
1394
|
+
let ke = (e, t) => e.icon ?? (t === i.stops.length - 1 ? "flag" : t === 0 ? "trip_origin" : void 0), Ae = (e, t) => e.label ?? `${u.mapRouteStop} ${t + 1}`;
|
|
1395
|
+
return n({
|
|
1396
|
+
fit: De,
|
|
1397
|
+
length: y,
|
|
1398
|
+
travelled: F,
|
|
1399
|
+
sourceId: d
|
|
1400
|
+
}), (n, r) => (H(), k("div", nt, [(H(!0), k(C, null, re(t.stops, (r, i) => (H(), D(Me, {
|
|
1401
|
+
key: i,
|
|
1402
|
+
"lng-lat": r.lngLat,
|
|
1403
|
+
onClick: (e) => a("stop-click", r, i)
|
|
1404
|
+
}, j({
|
|
1405
|
+
default: Q(() => [K(n.$slots, "stop", {
|
|
1406
|
+
stop: r,
|
|
1407
|
+
index: i,
|
|
1408
|
+
done: R(i)
|
|
1409
|
+
}, () => [A("span", {
|
|
1410
|
+
role: "img",
|
|
1411
|
+
"aria-label": Ae(r, i),
|
|
1412
|
+
title: Ae(r, i),
|
|
1413
|
+
class: z(["m3-map-route-stop flex h-7 w-7 items-center justify-center rounded-full border-2 text-label-medium font-medium shadow-elevation-1 transition-colors duration-300", R(i) ? "border-transparent bg-primary text-on-primary" : "border-primary bg-surface text-primary"]),
|
|
1414
|
+
style: te(t.color ? R(i) ? { background: t.color } : {
|
|
1415
|
+
borderColor: t.color,
|
|
1416
|
+
color: t.color
|
|
1417
|
+
} : void 0)
|
|
1418
|
+
}, [ke(r, i) ? (H(), D(e, {
|
|
1419
|
+
key: 0,
|
|
1420
|
+
name: ke(r, i),
|
|
1421
|
+
size: 16
|
|
1422
|
+
}, null, 8, ["name"])) : (H(), k(C, { key: 1 }, [M(J(i), 1)], 64))], 14, rt)])]),
|
|
1423
|
+
_: 2
|
|
1424
|
+
}, [n.$slots["stop-popup"] ? {
|
|
1425
|
+
name: "popup",
|
|
1426
|
+
fn: Q(() => [K(n.$slots, "stop-popup", {
|
|
1427
|
+
stop: r,
|
|
1428
|
+
index: i,
|
|
1429
|
+
done: R(i)
|
|
1430
|
+
})]),
|
|
1431
|
+
key: "0"
|
|
1432
|
+
} : void 0]), 1032, ["lng-lat", "onClick"]))), 128)), A("div", {
|
|
1433
|
+
ref_key: "vehicleEl",
|
|
1434
|
+
ref: W,
|
|
1435
|
+
class: "m3-map-route-vehicle",
|
|
1436
|
+
"aria-label": X(u).mapRouteVehicle,
|
|
1437
|
+
role: "img"
|
|
1438
|
+
}, [K(n.$slots, "vehicle", {
|
|
1439
|
+
bearing: I.value,
|
|
1440
|
+
west: de.value
|
|
1441
|
+
}, () => [A("span", {
|
|
1442
|
+
class: "flex h-10 w-10 items-center justify-center rounded-full border-2 border-surface bg-primary text-on-primary shadow-elevation-2",
|
|
1443
|
+
style: te(t.color ? { background: t.color } : void 0)
|
|
1444
|
+
}, [N(e, {
|
|
1445
|
+
name: t.vehicleIcon,
|
|
1446
|
+
size: 22,
|
|
1447
|
+
filled: t.vehicleIcon === "navigation",
|
|
1448
|
+
style: te(!$.value && de.value ? { transform: "scaleX(-1)" } : void 0)
|
|
1449
|
+
}, null, 8, [
|
|
1450
|
+
"name",
|
|
1451
|
+
"filled",
|
|
1452
|
+
"style"
|
|
1453
|
+
])], 4)])], 8, it)]));
|
|
1454
|
+
}
|
|
1455
|
+
});
|
|
1456
|
+
// src/composables/mapRouting.ts
|
|
1457
|
+
function ot(e = {}) {
|
|
1458
|
+
let t = (e.url ?? "https://router.project-osrm.org").replace(/\/$/, ""), n = e.profile ?? "driving";
|
|
1459
|
+
return async (r, { signal: i }) => {
|
|
1460
|
+
if (r.length < 2) return {
|
|
1461
|
+
path: [...r],
|
|
1462
|
+
distance: 0,
|
|
1463
|
+
duration: 0
|
|
1464
|
+
};
|
|
1465
|
+
let a = r.map(([e, t]) => `${e},${t}`).join(";"), o = new URLSearchParams({
|
|
1466
|
+
overview: "full",
|
|
1467
|
+
geometries: "geojson",
|
|
1468
|
+
...e.params
|
|
1469
|
+
}), s = await fetch(`${t}/route/v1/${n}/${a}?${o}`, { signal: i });
|
|
1470
|
+
if (!s.ok) throw Error(`OSRM ${s.status}`);
|
|
1471
|
+
let c = await s.json(), l = c.routes?.[0];
|
|
1472
|
+
if (c.code !== "Ok" || !l) throw Error(`OSRM: ${c.message ?? c.code}`);
|
|
1473
|
+
return {
|
|
1474
|
+
path: l.geometry.coordinates,
|
|
1475
|
+
distance: l.distance,
|
|
1476
|
+
duration: l.duration
|
|
1477
|
+
};
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
// src/components/_MMapLayerItem.vue?vue&type=script&setup=true&lang.ts
|
|
1481
|
+
var st = { class: "flex min-w-0 flex-1 flex-col" }, ct = ["aria-label", "aria-pressed"], lt = { class: "flex min-w-0 flex-1 flex-col" }, ut = {
|
|
1013
1482
|
key: 0,
|
|
1014
1483
|
class: "truncate text-label-small text-on-surface-variant"
|
|
1015
|
-
},
|
|
1484
|
+
}, dt = {
|
|
1016
1485
|
key: 0,
|
|
1017
1486
|
class: "rounded-full bg-primary/8 px-2 py-0.5 text-label-small tabular-nums text-primary"
|
|
1018
|
-
},
|
|
1487
|
+
}, ft = { class: "min-h-0 overflow-hidden" }, pt = { class: "flex flex-col gap-3 px-3 pb-3" }, mt = {
|
|
1019
1488
|
key: 0,
|
|
1020
1489
|
class: "text-body-small text-on-surface-variant"
|
|
1021
|
-
},
|
|
1490
|
+
}, ht = { class: "flex items-center gap-2 rounded-2xl bg-surface-container-highest/60 px-3 py-1" }, gt = ["src"], _t = {
|
|
1022
1491
|
key: 2,
|
|
1023
1492
|
class: "flex flex-wrap items-center gap-2"
|
|
1024
|
-
},
|
|
1493
|
+
}, vt = ["href"], yt = /* @__PURE__ */ P({
|
|
1025
1494
|
__name: "_MMapLayerItem",
|
|
1026
1495
|
props: {
|
|
1027
1496
|
layer: {},
|
|
@@ -1029,80 +1498,80 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
1029
1498
|
},
|
|
1030
1499
|
emits: ["toggle-expanded"],
|
|
1031
1500
|
setup(t, { emit: n }) {
|
|
1032
|
-
let r = n, i = s(), { isVisible: a, toggle: o, opacityOf: c, setOpacity: l } =
|
|
1033
|
-
return (n, s) => (
|
|
1501
|
+
let r = n, i = s(), { isVisible: a, toggle: o, opacityOf: c, setOpacity: l } = Ce();
|
|
1502
|
+
return (n, s) => (H(), k("div", { class: z(["flex overflow-hidden rounded-2xl bg-surface-container", X(a)(t.layer.id) ? "" : "opacity-75"]) }, [A("div", { class: z(["w-1 shrink-0 transition-colors duration-200", X(a)(t.layer.id) ? "bg-primary" : "bg-outline-variant"]) }, null, 2), A("div", st, [A("div", {
|
|
1034
1503
|
class: "flex cursor-pointer items-center gap-2 px-3 py-2",
|
|
1035
1504
|
onClick: s[1] ||= (e) => r("toggle-expanded")
|
|
1036
1505
|
}, [
|
|
1037
|
-
|
|
1506
|
+
A("button", {
|
|
1038
1507
|
type: "button",
|
|
1039
|
-
class:
|
|
1040
|
-
"aria-label":
|
|
1041
|
-
"aria-pressed":
|
|
1042
|
-
onClick: s[0] ||= se((e) =>
|
|
1043
|
-
}, [
|
|
1044
|
-
name:
|
|
1508
|
+
class: z(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", X(a)(t.layer.id) ? "bg-primary/12 text-primary" : "bg-on-surface/5 text-on-surface-variant"]),
|
|
1509
|
+
"aria-label": X(a)(t.layer.id) ? X(i).mapHideLayer : X(i).mapShowLayer,
|
|
1510
|
+
"aria-pressed": X(a)(t.layer.id),
|
|
1511
|
+
onClick: s[0] ||= se((e) => X(o)(t.layer.id), ["stop"])
|
|
1512
|
+
}, [N(e, {
|
|
1513
|
+
name: X(a)(t.layer.id) ? "visibility" : "visibility_off",
|
|
1045
1514
|
size: 18
|
|
1046
|
-
}, null, 8, ["name"])], 10,
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1515
|
+
}, null, 8, ["name"])], 10, ct),
|
|
1516
|
+
A("div", lt, [A("span", { class: z(["truncate text-body-medium", X(a)(t.layer.id) ? "text-on-surface" : "text-on-surface-variant"]) }, J(t.layer.title), 3), t.layer.description && !t.expanded ? (H(), k("span", ut, J(t.layer.description), 1)) : O("", !0)]),
|
|
1517
|
+
X(a)(t.layer.id) && X(c)(t.layer.id) < 1 ? (H(), k("span", dt, J(Math.round(X(c)(t.layer.id) * 100)) + "% ", 1)) : O("", !0),
|
|
1518
|
+
N(e, {
|
|
1050
1519
|
name: "expand_more",
|
|
1051
1520
|
size: 18,
|
|
1052
|
-
class:
|
|
1521
|
+
class: z(["shrink-0 text-on-surface-variant transition-transform duration-300", t.expanded ? "rotate-180" : ""])
|
|
1053
1522
|
}, null, 8, ["class"])
|
|
1054
|
-
]),
|
|
1523
|
+
]), A("div", {
|
|
1055
1524
|
class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
1056
1525
|
style: te({ gridTemplateRows: t.expanded ? "1fr" : "0fr" })
|
|
1057
|
-
}, [
|
|
1058
|
-
t.layer.description ? (
|
|
1059
|
-
|
|
1526
|
+
}, [A("div", ft, [A("div", pt, [
|
|
1527
|
+
t.layer.description ? (H(), k("p", mt, J(t.layer.description), 1)) : O("", !0),
|
|
1528
|
+
A("div", ht, [N(e, {
|
|
1060
1529
|
name: "opacity",
|
|
1061
1530
|
size: 16,
|
|
1062
1531
|
class: "shrink-0 text-on-surface-variant"
|
|
1063
|
-
}),
|
|
1064
|
-
"model-value":
|
|
1532
|
+
}), N(d, {
|
|
1533
|
+
"model-value": X(c)(t.layer.id),
|
|
1065
1534
|
min: 0,
|
|
1066
1535
|
max: 1,
|
|
1067
1536
|
step: .01,
|
|
1068
|
-
label:
|
|
1537
|
+
label: X(i).mapOpacity,
|
|
1069
1538
|
class: "flex-1",
|
|
1070
|
-
"onUpdate:modelValue": s[2] ||= (e) =>
|
|
1539
|
+
"onUpdate:modelValue": s[2] ||= (e) => X(l)(t.layer.id, Number(e))
|
|
1071
1540
|
}, null, 8, ["model-value", "label"])]),
|
|
1072
|
-
t.layer.legend ? (
|
|
1541
|
+
t.layer.legend ? (H(), k("img", {
|
|
1073
1542
|
key: 1,
|
|
1074
1543
|
src: t.layer.legend,
|
|
1075
1544
|
alt: "",
|
|
1076
1545
|
class: "max-w-full self-start",
|
|
1077
1546
|
loading: "lazy"
|
|
1078
|
-
}, null, 8,
|
|
1079
|
-
t.layer.download || n.$slots.actions ? (
|
|
1547
|
+
}, null, 8, gt)) : O("", !0),
|
|
1548
|
+
t.layer.download || n.$slots.actions ? (H(), k("div", _t, [t.layer.download ? (H(), k("a", {
|
|
1080
1549
|
key: 0,
|
|
1081
1550
|
href: t.layer.download,
|
|
1082
1551
|
target: "_blank",
|
|
1083
1552
|
rel: "noopener",
|
|
1084
1553
|
download: "",
|
|
1085
1554
|
class: "inline-flex items-center gap-1 rounded-full px-3 py-1.5 text-label-large text-primary hover:bg-primary/8"
|
|
1086
|
-
}, [
|
|
1555
|
+
}, [N(e, {
|
|
1087
1556
|
name: "download",
|
|
1088
1557
|
size: 18
|
|
1089
|
-
}),
|
|
1558
|
+
}), M(" " + J(X(i).mapDownload), 1)], 8, vt)) : O("", !0), K(n.$slots, "actions", {
|
|
1090
1559
|
layer: t.layer,
|
|
1091
|
-
visible:
|
|
1092
|
-
})])) :
|
|
1560
|
+
visible: X(a)(t.layer.id)
|
|
1561
|
+
})])) : O("", !0)
|
|
1093
1562
|
])])], 4)])], 2));
|
|
1094
1563
|
}
|
|
1095
|
-
}),
|
|
1564
|
+
}), bt = { class: "flex flex-col gap-3" }, xt = ["onClick"], St = [
|
|
1096
1565
|
"aria-label",
|
|
1097
1566
|
"aria-pressed",
|
|
1098
1567
|
"onClick"
|
|
1099
|
-
],
|
|
1568
|
+
], Ct = { class: "flex-1 select-none truncate text-label-large text-on-surface" }, wt = { class: "rounded-full bg-surface-container-highest px-2 py-0.5 text-label-small tabular-nums text-on-surface-variant" }, Tt = {
|
|
1100
1569
|
key: 1,
|
|
1101
1570
|
class: "flex flex-col gap-1.5"
|
|
1102
|
-
},
|
|
1571
|
+
}, Et = {
|
|
1103
1572
|
key: 2,
|
|
1104
1573
|
class: "flex flex-col items-center gap-3 py-8"
|
|
1105
|
-
},
|
|
1574
|
+
}, Dt = { class: "grid size-14 place-items-center rounded-full bg-surface-container-highest" }, Ot = { class: "text-body-medium text-on-surface-variant" }, kt = /* @__PURE__ */ P({
|
|
1106
1575
|
__name: "MMapLayers",
|
|
1107
1576
|
props: {
|
|
1108
1577
|
search: {
|
|
@@ -1116,98 +1585,98 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
1116
1585
|
map: {}
|
|
1117
1586
|
},
|
|
1118
1587
|
setup(t) {
|
|
1119
|
-
let n = t, r = s(), { model: i, layersOf: a, isVisible: o, groupState: c, setGroupVisible: l } =
|
|
1588
|
+
let n = t, r = s(), { model: i, layersOf: a, isVisible: o, groupState: c, setGroupVisible: l } = Ce(() => n.map), d = G(""), f = (e) => !d.value || e.title.toLowerCase().includes(d.value.toLowerCase()), p = E(() => (i.value?.groups ?? []).map((e) => ({
|
|
1120
1589
|
...e,
|
|
1121
1590
|
all: a(e.name),
|
|
1122
1591
|
layers: a(e.name).filter(f)
|
|
1123
|
-
})).filter((e) => e.layers.length)), m =
|
|
1592
|
+
})).filter((e) => e.layers.length)), m = E(() => a(null).filter(f)), h = G(/* @__PURE__ */ new Set()), g = (e) => h.value.has(e) === n.collapsed;
|
|
1124
1593
|
function _(e) {
|
|
1125
1594
|
let t = new Set(h.value);
|
|
1126
1595
|
t.delete(e) || t.add(e), h.value = t;
|
|
1127
1596
|
}
|
|
1128
|
-
let v =
|
|
1597
|
+
let v = G(/* @__PURE__ */ new Set());
|
|
1129
1598
|
function y(e) {
|
|
1130
1599
|
let t = new Set(v.value);
|
|
1131
1600
|
t.delete(e) || t.add(e), v.value = t;
|
|
1132
1601
|
}
|
|
1133
1602
|
let b = (e) => e.filter((e) => o(e.id)).length;
|
|
1134
|
-
return (n, i) => (
|
|
1135
|
-
t.search ? (
|
|
1603
|
+
return (n, i) => (H(), k("div", bt, [
|
|
1604
|
+
t.search ? (H(), D(u, {
|
|
1136
1605
|
key: 0,
|
|
1137
1606
|
modelValue: d.value,
|
|
1138
1607
|
"onUpdate:modelValue": i[0] ||= (e) => d.value = e,
|
|
1139
|
-
label:
|
|
1608
|
+
label: X(r).mapSearchLayers,
|
|
1140
1609
|
"leading-icon": "search",
|
|
1141
1610
|
variant: "outlined",
|
|
1142
1611
|
clearable: ""
|
|
1143
|
-
}, null, 8, ["modelValue", "label"])) :
|
|
1144
|
-
(
|
|
1612
|
+
}, null, 8, ["modelValue", "label"])) : O("", !0),
|
|
1613
|
+
(H(!0), k(C, null, re(p.value, (t) => (H(), k("section", {
|
|
1145
1614
|
key: t.name,
|
|
1146
1615
|
class: "flex flex-col"
|
|
1147
|
-
}, [
|
|
1616
|
+
}, [A("div", {
|
|
1148
1617
|
class: "m3-map-layers-row flex cursor-pointer items-center gap-2 rounded-xl px-2 py-1.5",
|
|
1149
1618
|
onClick: (e) => _(t.name)
|
|
1150
1619
|
}, [
|
|
1151
|
-
|
|
1620
|
+
A("button", {
|
|
1152
1621
|
type: "button",
|
|
1153
|
-
class:
|
|
1154
|
-
"aria-label":
|
|
1155
|
-
"aria-pressed":
|
|
1156
|
-
onClick: se((e) =>
|
|
1157
|
-
}, [
|
|
1158
|
-
name:
|
|
1622
|
+
class: z(["grid size-8 shrink-0 cursor-pointer place-items-center rounded-full transition-colors duration-200", X(c)(t.name) === "visible" ? "bg-primary-container text-on-primary-container" : X(c)(t.name) === "partial" ? "bg-secondary-container text-on-secondary-container" : "bg-on-surface/8 text-on-surface-variant"]),
|
|
1623
|
+
"aria-label": X(c)(t.name) === "hidden" ? X(r).mapShowLayer : X(r).mapHideLayer,
|
|
1624
|
+
"aria-pressed": X(c)(t.name) !== "hidden",
|
|
1625
|
+
onClick: se((e) => X(l)(t.name, X(c)(t.name) !== "visible"), ["stop"])
|
|
1626
|
+
}, [N(e, {
|
|
1627
|
+
name: X(c)(t.name) === "hidden" ? "visibility_off" : "visibility",
|
|
1159
1628
|
size: 18
|
|
1160
|
-
}, null, 8, ["name"])], 10,
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1629
|
+
}, null, 8, ["name"])], 10, St),
|
|
1630
|
+
A("span", Ct, J(t.title), 1),
|
|
1631
|
+
A("span", wt, J(b(t.all)) + "/" + J(t.all.length), 1),
|
|
1632
|
+
N(e, {
|
|
1164
1633
|
name: "expand_more",
|
|
1165
1634
|
size: 18,
|
|
1166
|
-
class:
|
|
1635
|
+
class: z(["text-on-surface-variant transition-transform duration-300", g(t.name) ? "rotate-180" : ""])
|
|
1167
1636
|
}, null, 8, ["class"])
|
|
1168
|
-
], 8,
|
|
1637
|
+
], 8, xt), A("div", {
|
|
1169
1638
|
class: "grid transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.2,0,0,1)]",
|
|
1170
1639
|
style: te({ gridTemplateRows: g(t.name) ? "1fr" : "0fr" })
|
|
1171
|
-
}, [
|
|
1640
|
+
}, [A("div", { class: z(["flex min-h-0 flex-col gap-1.5 overflow-hidden", g(t.name) ? "pt-1.5" : ""]) }, [(H(!0), k(C, null, re(t.layers, (e) => (H(), D(yt, {
|
|
1172
1641
|
key: e.id,
|
|
1173
1642
|
layer: e,
|
|
1174
1643
|
expanded: v.value.has(e.id),
|
|
1175
1644
|
onToggleExpanded: (t) => y(e.id)
|
|
1176
|
-
},
|
|
1645
|
+
}, j({ _: 2 }, [n.$slots.actions ? {
|
|
1177
1646
|
name: "actions",
|
|
1178
|
-
fn:
|
|
1647
|
+
fn: Q((e) => [K(n.$slots, "actions", R({ ref_for: !0 }, e))]),
|
|
1179
1648
|
key: "0"
|
|
1180
1649
|
} : void 0]), 1032, [
|
|
1181
1650
|
"layer",
|
|
1182
1651
|
"expanded",
|
|
1183
1652
|
"onToggleExpanded"
|
|
1184
1653
|
]))), 128))], 2)], 4)]))), 128)),
|
|
1185
|
-
m.value.length ? (
|
|
1654
|
+
m.value.length ? (H(), k("div", Tt, [(H(!0), k(C, null, re(m.value, (e) => (H(), D(yt, {
|
|
1186
1655
|
key: e.id,
|
|
1187
1656
|
layer: e,
|
|
1188
1657
|
expanded: v.value.has(e.id),
|
|
1189
1658
|
onToggleExpanded: (t) => y(e.id)
|
|
1190
|
-
},
|
|
1659
|
+
}, j({ _: 2 }, [n.$slots.actions ? {
|
|
1191
1660
|
name: "actions",
|
|
1192
|
-
fn:
|
|
1661
|
+
fn: Q((e) => [K(n.$slots, "actions", R({ ref_for: !0 }, e))]),
|
|
1193
1662
|
key: "0"
|
|
1194
1663
|
} : void 0]), 1032, [
|
|
1195
1664
|
"layer",
|
|
1196
1665
|
"expanded",
|
|
1197
1666
|
"onToggleExpanded"
|
|
1198
|
-
]))), 128))])) :
|
|
1199
|
-
!p.value.length && !m.value.length ? (
|
|
1667
|
+
]))), 128))])) : O("", !0),
|
|
1668
|
+
!p.value.length && !m.value.length ? (H(), k("div", Et, [A("div", Dt, [N(e, {
|
|
1200
1669
|
name: "layers_clear",
|
|
1201
1670
|
size: 28,
|
|
1202
1671
|
class: "text-on-surface-variant"
|
|
1203
|
-
})]),
|
|
1672
|
+
})]), A("p", Ot, J(X(r).mapNoLayers), 1)])) : O("", !0)
|
|
1204
1673
|
]));
|
|
1205
1674
|
}
|
|
1206
|
-
}),
|
|
1675
|
+
}), At = [
|
|
1207
1676
|
"aria-label",
|
|
1208
1677
|
"aria-checked",
|
|
1209
1678
|
"onClick"
|
|
1210
|
-
],
|
|
1679
|
+
], jt = ["src"], Mt = ["aria-label", "aria-checked"], Nt = /* @__PURE__ */ P({
|
|
1211
1680
|
__name: "MMapBaseLayers",
|
|
1212
1681
|
props: {
|
|
1213
1682
|
imageBase: { default: "" },
|
|
@@ -1222,101 +1691,101 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
1222
1691
|
map: {}
|
|
1223
1692
|
},
|
|
1224
1693
|
setup(t) {
|
|
1225
|
-
let n = t, r = s(), { baseLayers: i, baseLayer: a, setBaseLayer: o } =
|
|
1226
|
-
return (n, s) => (
|
|
1227
|
-
class:
|
|
1694
|
+
let n = t, r = s(), { baseLayers: i, baseLayer: a, setBaseLayer: o } = Ce(() => n.map), c = (e, t) => /^(https?:|data:|\/\/)/.test(e) ? e : `${t}${e}`;
|
|
1695
|
+
return (n, s) => (H(), k("div", {
|
|
1696
|
+
class: z(["flex gap-2", t.vertical ? "flex-col" : "flex-row flex-wrap"]),
|
|
1228
1697
|
role: "radiogroup"
|
|
1229
|
-
}, [(
|
|
1698
|
+
}, [(H(!0), k(C, null, re(X(i), (n) => (H(), D(f, {
|
|
1230
1699
|
key: n.id,
|
|
1231
1700
|
text: n.title,
|
|
1232
1701
|
placement: t.vertical ? "right" : "top"
|
|
1233
1702
|
}, {
|
|
1234
|
-
default:
|
|
1703
|
+
default: Q(() => [A("button", {
|
|
1235
1704
|
type: "button",
|
|
1236
1705
|
role: "radio",
|
|
1237
|
-
class:
|
|
1706
|
+
class: z(["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", X(a) === n.id ? "m3-map-base--active border-primary" : "border-transparent"]),
|
|
1238
1707
|
"aria-label": n.title,
|
|
1239
|
-
"aria-checked":
|
|
1240
|
-
onClick: (e) =>
|
|
1241
|
-
}, [n.base?.image ? (
|
|
1708
|
+
"aria-checked": X(a) === n.id,
|
|
1709
|
+
onClick: (e) => X(o)(n.id)
|
|
1710
|
+
}, [n.base?.image ? (H(), k("img", {
|
|
1242
1711
|
key: 0,
|
|
1243
1712
|
src: c(n.base.image, t.imageBase),
|
|
1244
1713
|
alt: "",
|
|
1245
1714
|
class: "size-full object-cover"
|
|
1246
|
-
}, null, 8,
|
|
1715
|
+
}, null, 8, jt)) : (H(), D(e, {
|
|
1247
1716
|
key: 1,
|
|
1248
1717
|
name: "map",
|
|
1249
1718
|
size: 22,
|
|
1250
1719
|
class: "text-on-surface-variant"
|
|
1251
|
-
}))], 10,
|
|
1720
|
+
}))], 10, At)]),
|
|
1252
1721
|
_: 2
|
|
1253
|
-
}, 1032, ["text", "placement"]))), 128)), t.none ? (
|
|
1722
|
+
}, 1032, ["text", "placement"]))), 128)), t.none ? (H(), D(f, {
|
|
1254
1723
|
key: 0,
|
|
1255
|
-
text:
|
|
1724
|
+
text: X(r).mapNoBaseLayer,
|
|
1256
1725
|
placement: t.vertical ? "right" : "top"
|
|
1257
1726
|
}, {
|
|
1258
|
-
default:
|
|
1727
|
+
default: Q(() => [A("button", {
|
|
1259
1728
|
type: "button",
|
|
1260
1729
|
role: "radio",
|
|
1261
|
-
class:
|
|
1262
|
-
"aria-label":
|
|
1263
|
-
"aria-checked":
|
|
1264
|
-
onClick: s[0] ||= (e) =>
|
|
1265
|
-
}, [
|
|
1730
|
+
class: z(["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", X(a) === null ? "m3-map-base--active border-primary" : "border-transparent"]),
|
|
1731
|
+
"aria-label": X(r).mapNoBaseLayer,
|
|
1732
|
+
"aria-checked": X(a) === null,
|
|
1733
|
+
onClick: s[0] ||= (e) => X(o)(null)
|
|
1734
|
+
}, [N(e, {
|
|
1266
1735
|
name: "layers_clear",
|
|
1267
1736
|
size: 22,
|
|
1268
1737
|
class: "text-on-surface-variant"
|
|
1269
|
-
})], 10,
|
|
1738
|
+
})], 10, Mt)]),
|
|
1270
1739
|
_: 1
|
|
1271
|
-
}, 8, ["text", "placement"])) :
|
|
1740
|
+
}, 8, ["text", "placement"])) : O("", !0)], 2));
|
|
1272
1741
|
}
|
|
1273
|
-
}),
|
|
1742
|
+
}), Pt = { class: "flex flex-col gap-2" }, Ft = { class: "flex items-center gap-2 bg-primary-container/40 px-4 py-2" }, It = { class: "text-label-large text-on-primary-container" }, Lt = { class: "flex flex-col px-4 py-1" }, Rt = { class: "text-label-small text-on-surface-variant" }, zt = { class: "text-body-medium text-on-surface" }, Bt = {
|
|
1274
1743
|
key: 0,
|
|
1275
1744
|
class: "break-words"
|
|
1276
|
-
},
|
|
1745
|
+
}, Vt = {
|
|
1277
1746
|
key: 1,
|
|
1278
1747
|
class: "text-body-small italic text-on-surface-variant"
|
|
1279
|
-
},
|
|
1748
|
+
}, Ht = /* @__PURE__ */ P({
|
|
1280
1749
|
__name: "MMapFeatureInfo",
|
|
1281
1750
|
props: { results: {} },
|
|
1282
1751
|
setup(t) {
|
|
1283
1752
|
let n = s();
|
|
1284
|
-
return (r, i) => (
|
|
1753
|
+
return (r, i) => (H(), k("div", Pt, [(H(!0), k(C, null, re(t.results, (t, i) => (H(), k("div", {
|
|
1285
1754
|
key: i,
|
|
1286
1755
|
class: "overflow-hidden rounded-2xl bg-surface-container"
|
|
1287
|
-
}, [
|
|
1756
|
+
}, [A("div", Ft, [N(e, {
|
|
1288
1757
|
name: "layers",
|
|
1289
1758
|
size: 16,
|
|
1290
1759
|
class: "text-on-primary-container"
|
|
1291
|
-
}),
|
|
1760
|
+
}), A("span", It, J(t.layer.title), 1)]), A("dl", Lt, [(H(!0), k(C, null, re(t.fields, (e) => (H(), k("div", {
|
|
1292
1761
|
key: e.key,
|
|
1293
1762
|
class: "flex flex-col gap-0.5 border-b border-outline-variant py-1.5 last:border-b-0"
|
|
1294
|
-
}, [
|
|
1763
|
+
}, [A("dt", Rt, J(e.label), 1), A("dd", zt, [K(r.$slots, "value", {
|
|
1295
1764
|
field: e,
|
|
1296
1765
|
result: t
|
|
1297
|
-
}, () => [e.value ? (
|
|
1766
|
+
}, () => [e.value ? (H(), k("span", Bt, J(e.value), 1)) : (H(), k("span", Vt, J(X(n).mapNoValue), 1))])])]))), 128))])]))), 128))]));
|
|
1298
1767
|
}
|
|
1299
|
-
}),
|
|
1768
|
+
}), Ut = (e) => e.metadata, Wt = /* @__PURE__ */ new Set([
|
|
1300
1769
|
"fill",
|
|
1301
1770
|
"line",
|
|
1302
1771
|
"circle",
|
|
1303
1772
|
"symbol",
|
|
1304
1773
|
"fill-extrusion",
|
|
1305
1774
|
"heatmap"
|
|
1306
|
-
]),
|
|
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(
|
|
1775
|
+
]), Gt = (e) => {
|
|
1776
|
+
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(Ut(e)) ? r(Ut(e)) : []));
|
|
1308
1777
|
return {
|
|
1309
1778
|
title: e.name,
|
|
1310
1779
|
groups: [],
|
|
1311
1780
|
layers: t.map((e) => {
|
|
1312
|
-
let t =
|
|
1781
|
+
let t = Ut(e), a = n(t);
|
|
1313
1782
|
return {
|
|
1314
1783
|
id: e.id,
|
|
1315
1784
|
title: t?.title ?? e.id,
|
|
1316
1785
|
listed: !a && !i.has(e.id) && t?.listed !== !1,
|
|
1317
1786
|
base: a ? { image: t.base.image ?? t.image } : void 0,
|
|
1318
1787
|
children: r(t),
|
|
1319
|
-
identify:
|
|
1788
|
+
identify: Wt.has(e.type) && !a && !i.has(e.id) ? {
|
|
1320
1789
|
format: {},
|
|
1321
1790
|
exclude: []
|
|
1322
1791
|
} : !1,
|
|
@@ -1325,9 +1794,9 @@ var $ = 600, we = /* @__PURE__ */ M({
|
|
|
1325
1794
|
})
|
|
1326
1795
|
};
|
|
1327
1796
|
};
|
|
1328
|
-
function
|
|
1797
|
+
function Kt(e = {}) {
|
|
1329
1798
|
let t = e.legend ?? ((e, t) => {
|
|
1330
|
-
let n =
|
|
1799
|
+
let n = Ut(e)?.legend;
|
|
1331
1800
|
if (n?.show === !1) return;
|
|
1332
1801
|
if (n?.wmslegend) return n.wmslegend;
|
|
1333
1802
|
if (!t?.includes("/services/styles/")) return;
|
|
@@ -1343,7 +1812,7 @@ function xt(e = {}) {
|
|
|
1343
1812
|
title: e.alias ?? e.name
|
|
1344
1813
|
})),
|
|
1345
1814
|
layers: e.layers.filter((e) => e.type !== "background").map((e) => {
|
|
1346
|
-
let r =
|
|
1815
|
+
let r = Ut(e) ?? {}, i = { ...r.fields }, a = i.exclude ?? [];
|
|
1347
1816
|
delete i.exclude;
|
|
1348
1817
|
let o = {};
|
|
1349
1818
|
for (let [e, t] of Object.entries(i)) o[e] = {
|
|
@@ -1380,10 +1849,10 @@ function xt(e = {}) {
|
|
|
1380
1849
|
};
|
|
1381
1850
|
};
|
|
1382
1851
|
}
|
|
1383
|
-
function
|
|
1852
|
+
function qt(e, t) {
|
|
1384
1853
|
return t?.label ?? e.charAt(0).toUpperCase() + e.slice(1);
|
|
1385
1854
|
}
|
|
1386
|
-
function
|
|
1855
|
+
function Jt(e, t) {
|
|
1387
1856
|
if (e == null || String(e).trim() === "") return "";
|
|
1388
1857
|
let n = String(e), r = typeof e == "number" ? e : Number(e);
|
|
1389
1858
|
if (t?.mask && !Number.isNaN(r)) {
|
|
@@ -1396,23 +1865,23 @@ function Ct(e, t) {
|
|
|
1396
1865
|
}
|
|
1397
1866
|
return t?.prefix && (n = `${t.prefix} ${n}`), t?.suffix && (n = `${n} ${t.suffix}`), n;
|
|
1398
1867
|
}
|
|
1399
|
-
var
|
|
1868
|
+
var Yt = /* @__PURE__ */ new Set([
|
|
1400
1869
|
"coordinates",
|
|
1401
1870
|
"mapCoordinates",
|
|
1402
1871
|
"layerId",
|
|
1403
1872
|
"__layerMetadata"
|
|
1404
1873
|
]);
|
|
1405
|
-
function
|
|
1874
|
+
function Xt(e, t, n) {
|
|
1406
1875
|
let r = new Map((n?.layers ?? []).filter((t) => t.identify && e.getLayer(t.id)).map((e) => [e.id, e]));
|
|
1407
1876
|
if (!r.size) return [];
|
|
1408
1877
|
let i = [];
|
|
1409
1878
|
for (let n of e.queryRenderedFeatures(t, { layers: [...r.keys()] })) {
|
|
1410
1879
|
let e = r.get(n.layer.id);
|
|
1411
1880
|
if (!e || !e.identify) continue;
|
|
1412
|
-
let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) => !
|
|
1881
|
+
let { format: t, exclude: a } = e.identify, o = Object.entries(n.properties ?? {}).filter(([e]) => !Yt.has(e) && !a.includes(e) && !t[e]?.hidden).map(([e, n]) => ({
|
|
1413
1882
|
key: e,
|
|
1414
|
-
label:
|
|
1415
|
-
value:
|
|
1883
|
+
label: qt(e, t[e]),
|
|
1884
|
+
value: Jt(n, t[e])
|
|
1416
1885
|
}));
|
|
1417
1886
|
o.length && i.push({
|
|
1418
1887
|
layer: e,
|
|
@@ -1423,7 +1892,7 @@ function Tt(e, t, n) {
|
|
|
1423
1892
|
return i;
|
|
1424
1893
|
}
|
|
1425
1894
|
// src/components/MMapIdentify.vue?vue&type=script&setup=true&lang.ts
|
|
1426
|
-
var
|
|
1895
|
+
var Zt = { class: "hidden" }, Qt = /* @__PURE__ */ P({
|
|
1427
1896
|
inheritAttrs: !1,
|
|
1428
1897
|
__name: "MMapIdentify",
|
|
1429
1898
|
props: {
|
|
@@ -1442,16 +1911,16 @@ var Et = { class: "hidden" }, Dt = /* @__PURE__ */ M({
|
|
|
1442
1911
|
},
|
|
1443
1912
|
emits: ["identify"],
|
|
1444
1913
|
setup(e, { expose: t, emit: n }) {
|
|
1445
|
-
let r = e, i = n, { on: a, onReady: o, activeTool: s } =
|
|
1914
|
+
let r = e, i = n, { on: a, onReady: o, activeTool: s } = pe(), { model: c } = Ce(), l = q([]), u = G([0, 0]), d = G(!1);
|
|
1446
1915
|
a("click", (e) => {
|
|
1447
1916
|
if (!r.enabled || s.value) return;
|
|
1448
1917
|
let t = e.target;
|
|
1449
|
-
l.value =
|
|
1918
|
+
l.value = Xt(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);
|
|
1450
1919
|
});
|
|
1451
1920
|
function f() {
|
|
1452
1921
|
d.value = !1;
|
|
1453
1922
|
}
|
|
1454
|
-
|
|
1923
|
+
Z(() => r.enabled, (e) => {
|
|
1455
1924
|
e || f();
|
|
1456
1925
|
});
|
|
1457
1926
|
let p, m = [], h = () => {
|
|
@@ -1468,38 +1937,38 @@ var Et = { class: "hidden" }, Dt = /* @__PURE__ */ M({
|
|
|
1468
1937
|
}
|
|
1469
1938
|
return o((e) => {
|
|
1470
1939
|
p = e, _();
|
|
1471
|
-
}),
|
|
1940
|
+
}), Z(c, _), ne(() => {
|
|
1472
1941
|
m.forEach((e) => {
|
|
1473
1942
|
p?.off("mouseenter", e, h), p?.off("mouseleave", e, g);
|
|
1474
1943
|
});
|
|
1475
|
-
}), t({ close: f }), (t, n) => (
|
|
1944
|
+
}), t({ close: f }), (t, n) => (H(), k("div", Zt, [e.marker && d.value ? (H(), D(Me, {
|
|
1476
1945
|
key: 0,
|
|
1477
1946
|
"lng-lat": u.value
|
|
1478
|
-
}, null, 8, ["lng-lat"])) :
|
|
1947
|
+
}, null, 8, ["lng-lat"])) : O("", !0), e.popup && l.value.length ? (H(), D(Pe, {
|
|
1479
1948
|
key: 1,
|
|
1480
1949
|
open: d.value,
|
|
1481
1950
|
"onUpdate:open": n[0] ||= (e) => d.value = e,
|
|
1482
1951
|
"lng-lat": u.value,
|
|
1483
1952
|
"max-width": "360px",
|
|
1484
|
-
offset: e.marker ?
|
|
1953
|
+
offset: e.marker ? X(Ae) : void 0
|
|
1485
1954
|
}, {
|
|
1486
|
-
default:
|
|
1955
|
+
default: Q(() => [A("div", R({ class: "max-h-80 overflow-y-auto" }, t.$attrs), [K(t.$slots, "default", {
|
|
1487
1956
|
results: l.value,
|
|
1488
1957
|
lngLat: u.value,
|
|
1489
1958
|
close: f
|
|
1490
|
-
}, () => [
|
|
1959
|
+
}, () => [N(Ht, { results: l.value }, null, 8, ["results"])])], 16)]),
|
|
1491
1960
|
_: 3
|
|
1492
1961
|
}, 8, [
|
|
1493
1962
|
"open",
|
|
1494
1963
|
"lng-lat",
|
|
1495
1964
|
"offset"
|
|
1496
|
-
])) :
|
|
1965
|
+
])) : O("", !0)]));
|
|
1497
1966
|
}
|
|
1498
|
-
}),
|
|
1967
|
+
}), $t = { class: "hidden" }, en = [
|
|
1499
1968
|
"title",
|
|
1500
1969
|
"aria-label",
|
|
1501
1970
|
"aria-pressed"
|
|
1502
|
-
],
|
|
1971
|
+
], tn = { class: "-mx-4 -mt-3 mb-1 bg-primary-container px-3 py-1.5 text-label-medium text-on-primary-container" }, nn = { class: "flex flex-col" }, rn = { class: "text-label-small text-on-surface-variant" }, an = { class: "text-body-small text-on-surface" }, on = /* @__PURE__ */ P({
|
|
1503
1972
|
__name: "MMapHover",
|
|
1504
1973
|
props: {
|
|
1505
1974
|
modelValue: {
|
|
@@ -1513,7 +1982,7 @@ var Et = { class: "hidden" }, Dt = /* @__PURE__ */ M({
|
|
|
1513
1982
|
},
|
|
1514
1983
|
emits: ["update:modelValue"],
|
|
1515
1984
|
setup(t, { emit: n }) {
|
|
1516
|
-
let r = t, i = n, a = s(), { onReady: o } =
|
|
1985
|
+
let r = t, i = n, a = s(), { onReady: o } = pe(), { model: c } = Ce(), l = E(() => (c.value?.layers ?? []).filter((e) => e.hover && e.hover.fields.length)), u = q(null), d = G([0, 0]), f = G(!1), p, m = [];
|
|
1517
1986
|
function h(e) {
|
|
1518
1987
|
let t = e.features?.[0], n = l.value.find((e) => e.id === t?.layer.id);
|
|
1519
1988
|
if (!t || !n || !n.hover) return;
|
|
@@ -1522,8 +1991,8 @@ var Et = { class: "hidden" }, Dt = /* @__PURE__ */ M({
|
|
|
1522
1991
|
layer: n,
|
|
1523
1992
|
fields: n.hover.fields.map((e) => ({
|
|
1524
1993
|
key: e.key,
|
|
1525
|
-
label:
|
|
1526
|
-
value:
|
|
1994
|
+
label: qt(e.key, e),
|
|
1995
|
+
value: Jt(r[e.key], e)
|
|
1527
1996
|
})).filter((e) => e.value)
|
|
1528
1997
|
}, d.value = [e.lngLat.lng, e.lngLat.lat], f.value = !0;
|
|
1529
1998
|
}
|
|
@@ -1540,27 +2009,27 @@ var Et = { class: "hidden" }, Dt = /* @__PURE__ */ M({
|
|
|
1540
2009
|
}
|
|
1541
2010
|
o((e) => {
|
|
1542
2011
|
p = e, _();
|
|
1543
|
-
}),
|
|
2012
|
+
}), Z([() => r.modelValue, l], _), ne(() => {
|
|
1544
2013
|
for (let e of m) p?.off("mousemove", e, h), p?.off("mouseleave", e, g);
|
|
1545
2014
|
});
|
|
1546
|
-
let v =
|
|
1547
|
-
return (n, r) => (
|
|
2015
|
+
let v = E(() => r.control === !0 ? "top-right" : r.control || "top-right");
|
|
2016
|
+
return (n, r) => (H(), k("div", $t, [t.control && l.value.length ? (H(), D(ge, {
|
|
1548
2017
|
key: 0,
|
|
1549
2018
|
position: v.value
|
|
1550
2019
|
}, {
|
|
1551
|
-
default:
|
|
2020
|
+
default: Q(() => [A("button", {
|
|
1552
2021
|
type: "button",
|
|
1553
2022
|
class: "grid place-items-center",
|
|
1554
|
-
title:
|
|
1555
|
-
"aria-label":
|
|
2023
|
+
title: X(a).mapHoverInfo,
|
|
2024
|
+
"aria-label": X(a).mapHoverInfo,
|
|
1556
2025
|
"aria-pressed": t.modelValue,
|
|
1557
2026
|
onClick: r[0] ||= (e) => i("update:modelValue", !t.modelValue)
|
|
1558
|
-
}, [
|
|
2027
|
+
}, [N(e, {
|
|
1559
2028
|
name: "ads_click",
|
|
1560
2029
|
size: 20
|
|
1561
|
-
})], 8,
|
|
2030
|
+
})], 8, en)]),
|
|
1562
2031
|
_: 1
|
|
1563
|
-
}, 8, ["position"])) :
|
|
2032
|
+
}, 8, ["position"])) : O("", !0), u.value ? (H(), D(Pe, {
|
|
1564
2033
|
key: 1,
|
|
1565
2034
|
open: f.value,
|
|
1566
2035
|
"onUpdate:open": r[1] ||= (e) => f.value = e,
|
|
@@ -1571,64 +2040,18 @@ var Et = { class: "hidden" }, Dt = /* @__PURE__ */ M({
|
|
|
1571
2040
|
"max-width": "280px",
|
|
1572
2041
|
class: "m3-map-hover"
|
|
1573
2042
|
}, {
|
|
1574
|
-
default:
|
|
2043
|
+
default: Q(() => [A("p", tn, J(u.value.layer.title), 1), A("dl", nn, [(H(!0), k(C, null, re(u.value.fields, (e) => (H(), k("div", {
|
|
1575
2044
|
key: e.key,
|
|
1576
2045
|
class: "border-b border-outline-variant py-1 last:border-b-0"
|
|
1577
|
-
}, [
|
|
2046
|
+
}, [A("dt", rn, J(e.label), 1), A("dd", an, J(e.value), 1)]))), 128))])]),
|
|
1578
2047
|
_: 1
|
|
1579
|
-
}, 8, ["open", "lng-lat"])) :
|
|
2048
|
+
}, 8, ["open", "lng-lat"])) : O("", !0)]));
|
|
1580
2049
|
}
|
|
1581
|
-
}),
|
|
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)));
|
|
1585
|
-
}
|
|
1586
|
-
function Rt(e) {
|
|
1587
|
-
let t = 0;
|
|
1588
|
-
for (let n = 1; n < e.length; n++) t += Lt(e[n - 1], e[n]);
|
|
1589
|
-
return t;
|
|
1590
|
-
}
|
|
1591
|
-
function zt(e, t) {
|
|
1592
|
-
let [n, r, i, a] = [
|
|
1593
|
-
e[0] * It,
|
|
1594
|
-
e[1] * It,
|
|
1595
|
-
t[0] * It,
|
|
1596
|
-
t[1] * It
|
|
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));
|
|
1598
|
-
return [(n + Math.atan2(s, Math.cos(r) + o)) / It, c / It];
|
|
1599
|
-
}
|
|
1600
|
-
function Bt(e) {
|
|
1601
|
-
let t = Vt(e), n = t.length - 1;
|
|
1602
|
-
if (n <= 2) return 0;
|
|
1603
|
-
let r = 0;
|
|
1604
|
-
for (let e = 0; e < n; e++) {
|
|
1605
|
-
let i = t[e], a = t[e + 1 === n ? 0 : e + 1], o = t[e + 2 >= n ? (e + 2) % n : e + 2];
|
|
1606
|
-
r += (o[0] - i[0]) * It * Math.sin(a[1] * It);
|
|
1607
|
-
}
|
|
1608
|
-
return Math.abs(r * Ft * Ft / 2);
|
|
1609
|
-
}
|
|
1610
|
-
function Vt(e) {
|
|
1611
|
-
let t = e[0], n = e[e.length - 1];
|
|
1612
|
-
return t && n && (t[0] !== n[0] || t[1] !== n[1]) ? [...e, t] : e;
|
|
1613
|
-
}
|
|
1614
|
-
function Ht(e) {
|
|
1615
|
-
let t = Vt(e), n = 0, r = 0, i = 0;
|
|
1616
|
-
for (let e = 0; e < t.length - 1; e++) {
|
|
1617
|
-
let [a, o] = t[e], [s, c] = t[e + 1], l = a * c - s * o;
|
|
1618
|
-
n += l, r += (a + s) * l, i += (o + c) * l;
|
|
1619
|
-
}
|
|
1620
|
-
if (Math.abs(n) < 1e-12) {
|
|
1621
|
-
let e = t.slice(0, -1);
|
|
1622
|
-
return [e.reduce((e, t) => e + t[0], 0) / e.length, e.reduce((e, t) => e + t[1], 0) / e.length];
|
|
1623
|
-
}
|
|
1624
|
-
return [r / (3 * n), i / (3 * n)];
|
|
1625
|
-
}
|
|
1626
|
-
// src/components/MMapMeasure.vue?vue&type=script&setup=true&lang.ts
|
|
1627
|
-
var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "aria-pressed"], Kt = ["title", "disabled"], qt = [
|
|
2050
|
+
}), sn = { class: "hidden" }, cn = ["title", "aria-pressed"], ln = ["title", "aria-pressed"], un = ["title", "disabled"], dn = [
|
|
1628
2051
|
"aria-label",
|
|
1629
2052
|
"title",
|
|
1630
2053
|
"onClick"
|
|
1631
|
-
],
|
|
2054
|
+
], fn = /* @__PURE__ */ P({
|
|
1632
2055
|
__name: "MMapMeasure",
|
|
1633
2056
|
props: {
|
|
1634
2057
|
modelValue: { default: null },
|
|
@@ -1639,14 +2062,14 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
1639
2062
|
},
|
|
1640
2063
|
emits: ["update:modelValue", "change"],
|
|
1641
2064
|
setup(t, { expose: n, emit: r }) {
|
|
1642
|
-
let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } =
|
|
2065
|
+
let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } = pe(), f = l(["primary", "surface"]), p = `m3-measure-${ie()}`, h = {
|
|
1643
2066
|
done: `${p}-done`,
|
|
1644
2067
|
draft: `${p}-draft`,
|
|
1645
2068
|
handles: `${p}-handles`
|
|
1646
|
-
}, g = `${h.handles}-vertex`, _ = `${h.handles}-midpoint`, v = [], y = [], b = null,
|
|
2069
|
+
}, g = `${h.handles}-vertex`, _ = `${h.handles}-midpoint`, v = [], y = [], b = null, x = !1, S = null, w = 0, T, j = G(null), P = G(0), F = q([]), I = () => typeof document < "u" && document.documentElement.lang || void 0, L = (e, t) => new Intl.NumberFormat(I(), {
|
|
1647
2070
|
minimumFractionDigits: t,
|
|
1648
2071
|
maximumFractionDigits: t
|
|
1649
|
-
}).format(e),
|
|
2072
|
+
}).format(e), R = (e) => e === 0 ? "" : e < 1e3 ? `${L(Math.round(e), 0)} m` : `${L(e / 1e3, 2)} km`, ee = (e) => e >= 1e6 ? `${L(e / 1e6, 2)} km²` : e >= 1e4 ? `${L(e / 1e4, 2)} ha` : `${L(Math.round(e), 0)} m²`, te = (e, t = {}) => ({
|
|
1650
2073
|
type: "Feature",
|
|
1651
2074
|
geometry: {
|
|
1652
2075
|
type: "Point",
|
|
@@ -1655,7 +2078,7 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
1655
2078
|
properties: t
|
|
1656
2079
|
});
|
|
1657
2080
|
function B(e, t, n, r) {
|
|
1658
|
-
let i = e.map((e) =>
|
|
2081
|
+
let i = e.map((e) => te(e)), a = [];
|
|
1659
2082
|
if (e.length < 2) return {
|
|
1660
2083
|
features: i,
|
|
1661
2084
|
labels: a
|
|
@@ -1670,10 +2093,10 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
1670
2093
|
});
|
|
1671
2094
|
let s = (e) => {
|
|
1672
2095
|
for (let t = 0; t < e.length - 1; t++) {
|
|
1673
|
-
let r =
|
|
2096
|
+
let r = R(Be(e[t], e[t + 1]));
|
|
1674
2097
|
r && a.push({
|
|
1675
2098
|
key: `${n}-s${t}`,
|
|
1676
|
-
at:
|
|
2099
|
+
at: He(e[t], e[t + 1]),
|
|
1677
2100
|
text: r,
|
|
1678
2101
|
kind: "segment"
|
|
1679
2102
|
});
|
|
@@ -1682,12 +2105,12 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
1682
2105
|
if (t === "distance") s(e), a.push({
|
|
1683
2106
|
key: `${n}-t`,
|
|
1684
2107
|
at: e[e.length - 1],
|
|
1685
|
-
text: `${o.mapTotal}: ${
|
|
2108
|
+
text: `${o.mapTotal}: ${R(Ve(e))}`,
|
|
1686
2109
|
kind: "total",
|
|
1687
2110
|
m: r
|
|
1688
2111
|
});
|
|
1689
2112
|
else if (e.length >= 3) {
|
|
1690
|
-
let t =
|
|
2113
|
+
let t = We(e);
|
|
1691
2114
|
i.push({
|
|
1692
2115
|
type: "Feature",
|
|
1693
2116
|
geometry: {
|
|
@@ -1697,15 +2120,15 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
1697
2120
|
properties: {}
|
|
1698
2121
|
}), s(t), a.push({
|
|
1699
2122
|
key: `${n}-a`,
|
|
1700
|
-
at:
|
|
1701
|
-
text:
|
|
2123
|
+
at: Ge(t),
|
|
2124
|
+
text: ee(Ue(t)),
|
|
1702
2125
|
kind: "area",
|
|
1703
2126
|
m: r
|
|
1704
2127
|
});
|
|
1705
2128
|
} else a.push({
|
|
1706
2129
|
key: `${n}-t`,
|
|
1707
2130
|
at: e[e.length - 1],
|
|
1708
|
-
text:
|
|
2131
|
+
text: R(Ve(e)),
|
|
1709
2132
|
kind: "total",
|
|
1710
2133
|
m: r
|
|
1711
2134
|
});
|
|
@@ -1714,46 +2137,46 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
1714
2137
|
labels: a
|
|
1715
2138
|
};
|
|
1716
2139
|
}
|
|
1717
|
-
let
|
|
2140
|
+
let V = (e) => ({
|
|
1718
2141
|
type: "FeatureCollection",
|
|
1719
2142
|
features: e
|
|
1720
|
-
}), U = (e, t) => (
|
|
1721
|
-
function
|
|
1722
|
-
if (!
|
|
1723
|
-
let e = v.map((e, t) => B(e.points, e.mode, `m${t}`, t)), t =
|
|
2143
|
+
}), U = (e, t) => (T?.getSource(e))?.setData(V(t));
|
|
2144
|
+
function W() {
|
|
2145
|
+
if (!T) return;
|
|
2146
|
+
let e = v.map((e, t) => B(e.points, e.mode, `m${t}`, t)), t = j.value && y.length ? B(b ? [...y, b] : y, j.value, "draft") : {
|
|
1724
2147
|
features: [],
|
|
1725
2148
|
labels: []
|
|
1726
2149
|
};
|
|
1727
2150
|
U(h.done, e.flatMap((e) => e.features)), U(h.draft, t.features);
|
|
1728
2151
|
let n = [];
|
|
1729
|
-
|
|
1730
|
-
(e.closed ? e.points.slice(0, -1) : e.points).forEach((e, r) => n.push(
|
|
2152
|
+
j.value || v.forEach((e, t) => {
|
|
2153
|
+
(e.closed ? e.points.slice(0, -1) : e.points).forEach((e, r) => n.push(te(e, {
|
|
1731
2154
|
handle: "vertex",
|
|
1732
2155
|
m: t,
|
|
1733
2156
|
v: r
|
|
1734
2157
|
})));
|
|
1735
|
-
for (let r = 0; r < e.points.length - 1; r++) n.push(
|
|
2158
|
+
for (let r = 0; r < e.points.length - 1; r++) n.push(te(He(e.points[r], e.points[r + 1]), {
|
|
1736
2159
|
handle: "midpoint",
|
|
1737
2160
|
m: t,
|
|
1738
2161
|
after: r
|
|
1739
2162
|
}));
|
|
1740
|
-
}), U(h.handles, n),
|
|
2163
|
+
}), U(h.handles, n), F.value = [...e.flatMap((e) => e.labels), ...t.labels];
|
|
1741
2164
|
}
|
|
1742
|
-
function
|
|
2165
|
+
function K() {
|
|
1743
2166
|
P.value = v.length, a("change", v.map((e) => ({
|
|
1744
2167
|
mode: e.mode,
|
|
1745
2168
|
points: e.points.map((e) => [...e]),
|
|
1746
2169
|
closed: e.closed,
|
|
1747
|
-
length:
|
|
1748
|
-
...e.mode === "area" || e.closed ? { area:
|
|
2170
|
+
length: Ve(e.points),
|
|
2171
|
+
...e.mode === "area" || e.closed ? { area: Ue(e.points) } : {}
|
|
1749
2172
|
})));
|
|
1750
2173
|
}
|
|
1751
|
-
let
|
|
2174
|
+
let Y = (e) => [
|
|
1752
2175
|
"==",
|
|
1753
2176
|
["geometry-type"],
|
|
1754
2177
|
e
|
|
1755
2178
|
];
|
|
1756
|
-
function
|
|
2179
|
+
function ae() {
|
|
1757
2180
|
let { primary: e, surface: t } = f.value;
|
|
1758
2181
|
return {
|
|
1759
2182
|
fill: { "fill-color": e },
|
|
@@ -1764,20 +2187,20 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
1764
2187
|
}
|
|
1765
2188
|
};
|
|
1766
2189
|
}
|
|
1767
|
-
function
|
|
1768
|
-
if (!
|
|
1769
|
-
for (let e of Object.values(h))
|
|
2190
|
+
function oe() {
|
|
2191
|
+
if (!T) return;
|
|
2192
|
+
for (let e of Object.values(h)) T.getSource(e) || T.addSource(e, {
|
|
1770
2193
|
type: "geojson",
|
|
1771
|
-
data:
|
|
2194
|
+
data: V([])
|
|
1772
2195
|
});
|
|
1773
|
-
let e =
|
|
1774
|
-
|
|
2196
|
+
let e = ae(), t = (e) => {
|
|
2197
|
+
T.getLayer(e.id) || T.addLayer(e);
|
|
1775
2198
|
};
|
|
1776
2199
|
for (let [n, r] of [[h.done, !1], [h.draft, !0]]) t({
|
|
1777
2200
|
id: `${n}-fill`,
|
|
1778
2201
|
type: "fill",
|
|
1779
2202
|
source: n,
|
|
1780
|
-
filter:
|
|
2203
|
+
filter: Y("Polygon"),
|
|
1781
2204
|
paint: {
|
|
1782
2205
|
...e.fill,
|
|
1783
2206
|
"fill-opacity": r ? .15 : .2
|
|
@@ -1800,7 +2223,7 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
1800
2223
|
id: `${n}-points`,
|
|
1801
2224
|
type: "circle",
|
|
1802
2225
|
source: n,
|
|
1803
|
-
filter:
|
|
2226
|
+
filter: Y("Point"),
|
|
1804
2227
|
paint: {
|
|
1805
2228
|
...e.vertices,
|
|
1806
2229
|
"circle-radius": 5,
|
|
@@ -1838,121 +2261,121 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
1838
2261
|
}
|
|
1839
2262
|
});
|
|
1840
2263
|
}
|
|
1841
|
-
|
|
1842
|
-
if (!
|
|
1843
|
-
let e =
|
|
1844
|
-
if (
|
|
2264
|
+
Z(f, () => {
|
|
2265
|
+
if (!T) return;
|
|
2266
|
+
let e = ae(), t = (e, t) => {
|
|
2267
|
+
if (T.getLayer(e)) for (let [n, r] of Object.entries(t)) T.setPaintProperty(e, n, r);
|
|
1845
2268
|
};
|
|
1846
2269
|
for (let n of [h.done, h.draft]) t(`${n}-fill`, e.fill), t(`${n}-line`, e.line), t(`${n}-points`, e.vertices);
|
|
1847
2270
|
t(_, e.vertices), t(g, e.vertices);
|
|
1848
2271
|
});
|
|
1849
|
-
let
|
|
1850
|
-
function
|
|
2272
|
+
let ce = (e) => [e.lngLat.lng, e.lngLat.lat];
|
|
2273
|
+
function le(e) {
|
|
1851
2274
|
if (y.length >= 2) {
|
|
1852
|
-
let t =
|
|
2275
|
+
let t = T.project(y[0]);
|
|
1853
2276
|
if (Math.hypot(t.x - e.point.x, t.y - e.point.y) < 20) {
|
|
1854
|
-
|
|
2277
|
+
x = !0, xe();
|
|
1855
2278
|
return;
|
|
1856
2279
|
}
|
|
1857
2280
|
}
|
|
1858
|
-
y.push(
|
|
2281
|
+
y.push(ce(e)), W();
|
|
1859
2282
|
}
|
|
1860
|
-
function
|
|
1861
|
-
b =
|
|
1862
|
-
|
|
2283
|
+
function ue(e) {
|
|
2284
|
+
b = ce(e), w ||= requestAnimationFrame(() => {
|
|
2285
|
+
w = 0, W();
|
|
1863
2286
|
});
|
|
1864
2287
|
}
|
|
1865
|
-
function
|
|
2288
|
+
function de(e) {
|
|
1866
2289
|
if (e.preventDefault(), y.length < 2) return;
|
|
1867
|
-
let t =
|
|
1868
|
-
Math.hypot(t.x - n.x, t.y - n.y) < 10 && y.pop(),
|
|
2290
|
+
let t = T.project(y[y.length - 1]), n = T.project(y[y.length - 2]);
|
|
2291
|
+
Math.hypot(t.x - n.x, t.y - n.y) < 10 && y.pop(), xe();
|
|
1869
2292
|
}
|
|
1870
|
-
function
|
|
1871
|
-
e.key === "Enter" &&
|
|
2293
|
+
function fe(e) {
|
|
2294
|
+
e.key === "Enter" && xe();
|
|
1872
2295
|
}
|
|
1873
|
-
m(() => !!
|
|
1874
|
-
let
|
|
1875
|
-
function
|
|
1876
|
-
|
|
1877
|
-
|
|
2296
|
+
m(() => !!j.value, () => xe(!0));
|
|
2297
|
+
let me = () => typeof navigator < "u" ? navigator.keyboard : void 0, he = !1;
|
|
2298
|
+
function _e() {
|
|
2299
|
+
j.value && document.fullscreenElement && me()?.lock && me().lock(["Escape"]).then(() => {
|
|
2300
|
+
he = !0;
|
|
1878
2301
|
}, () => {});
|
|
1879
2302
|
}
|
|
1880
|
-
function
|
|
1881
|
-
|
|
2303
|
+
function ve() {
|
|
2304
|
+
j.value || (he && me()?.unlock?.(), he = !1);
|
|
1882
2305
|
}
|
|
1883
|
-
function
|
|
2306
|
+
function ye() {
|
|
1884
2307
|
let e, t = () => {
|
|
1885
|
-
document.removeEventListener("keyup", n, !0), clearTimeout(e), setTimeout(
|
|
2308
|
+
document.removeEventListener("keyup", n, !0), clearTimeout(e), setTimeout(ve);
|
|
1886
2309
|
}, n = (e) => {
|
|
1887
2310
|
e.key === "Escape" && t();
|
|
1888
2311
|
};
|
|
1889
2312
|
document.addEventListener("keyup", n, !0), e = setTimeout(t, 1500);
|
|
1890
2313
|
}
|
|
1891
|
-
function
|
|
1892
|
-
if (
|
|
1893
|
-
if (
|
|
1894
|
-
|
|
2314
|
+
function be(e) {
|
|
2315
|
+
if (T) {
|
|
2316
|
+
if (j.value === e) return xe();
|
|
2317
|
+
j.value && xe(), j.value = e, d.value = "measure", y = [], b = null, T.getCanvas().style.cursor = "crosshair", T.doubleClickZoom.disable(), T.on("click", le), T.on("mousemove", ue), T.on("dblclick", de), document.addEventListener("keydown", fe), document.addEventListener("fullscreenchange", _e), _e(), W(), i.modelValue !== e && a("update:modelValue", e);
|
|
1895
2318
|
}
|
|
1896
2319
|
}
|
|
1897
|
-
function
|
|
1898
|
-
if (!
|
|
1899
|
-
cancelAnimationFrame(
|
|
1900
|
-
let t = y.length >= 3 && (
|
|
2320
|
+
function xe(e = !1) {
|
|
2321
|
+
if (!T || !j.value) return;
|
|
2322
|
+
cancelAnimationFrame(w), w = 0;
|
|
2323
|
+
let t = y.length >= 3 && (x || j.value === "area");
|
|
1901
2324
|
y.length >= 2 && v.push({
|
|
1902
|
-
mode:
|
|
2325
|
+
mode: j.value,
|
|
1903
2326
|
points: t ? [...y, [...y[0]]] : y,
|
|
1904
2327
|
closed: t
|
|
1905
|
-
}), y = [], b = null,
|
|
2328
|
+
}), y = [], b = null, x = !1, j.value = null, d.value === "measure" && (d.value = null), T.getCanvas().style.cursor = "", T.doubleClickZoom.enable(), T.off("click", le), T.off("mousemove", ue), T.off("dblclick", de), document.removeEventListener("keydown", fe), document.removeEventListener("fullscreenchange", _e), e && he ? ye() : ve(), W(), K(), i.modelValue !== null && a("update:modelValue", null);
|
|
1906
2329
|
}
|
|
1907
2330
|
function Se(e) {
|
|
1908
|
-
v[e] && (v.splice(e, 1),
|
|
2331
|
+
v[e] && (v.splice(e, 1), W(), K());
|
|
1909
2332
|
}
|
|
1910
2333
|
function Ce() {
|
|
1911
|
-
|
|
2334
|
+
j.value && xe(), v.length = 0, W(), K();
|
|
1912
2335
|
}
|
|
1913
2336
|
function $(e) {
|
|
1914
2337
|
let t = e.features?.[0];
|
|
1915
|
-
if (!t ||
|
|
2338
|
+
if (!t || j.value || !T) return;
|
|
1916
2339
|
e.preventDefault();
|
|
1917
2340
|
let n = t.properties.m, r = v[n];
|
|
1918
2341
|
if (!r) return;
|
|
1919
2342
|
let i = t.properties.v;
|
|
1920
|
-
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0,
|
|
2343
|
+
t.properties.handle === "midpoint" && (i = t.properties.after + 1, r.points.splice(i, 0, ce(e))), S = {
|
|
1921
2344
|
m: n,
|
|
1922
2345
|
v: i
|
|
1923
|
-
}, d.value = "measure",
|
|
2346
|
+
}, d.value = "measure", T.getCanvas().style.cursor = "grabbing";
|
|
1924
2347
|
let a = e.type === "touchstart";
|
|
1925
|
-
a &&
|
|
2348
|
+
a && T.dragPan.disable(), T.on(a ? "touchmove" : "mousemove", we), T.once(a ? "touchend" : "mouseup", Te), W();
|
|
1926
2349
|
}
|
|
1927
2350
|
function we(e) {
|
|
1928
|
-
if (!
|
|
1929
|
-
let t = v[
|
|
2351
|
+
if (!S) return;
|
|
2352
|
+
let t = v[S.m];
|
|
1930
2353
|
if (!t) return;
|
|
1931
|
-
let n =
|
|
1932
|
-
t.points[
|
|
2354
|
+
let n = ce(e);
|
|
2355
|
+
t.points[S.v] = n, t.closed && S.v === 0 && (t.points[t.points.length - 1] = n), W();
|
|
1933
2356
|
}
|
|
1934
2357
|
function Te() {
|
|
1935
|
-
|
|
1936
|
-
d.value === "measure" && !
|
|
2358
|
+
T && (S = null, T.off("mousemove", we), T.off("touchmove", we), T.dragPan.enable(), T.getCanvas().style.cursor = "", K(), setTimeout(() => {
|
|
2359
|
+
d.value === "measure" && !j.value && (d.value = null);
|
|
1937
2360
|
}));
|
|
1938
2361
|
}
|
|
1939
2362
|
let Ee = () => {
|
|
1940
|
-
|
|
2363
|
+
T && !S && !j.value && (T.getCanvas().style.cursor = "grab");
|
|
1941
2364
|
}, De = () => {
|
|
1942
|
-
|
|
2365
|
+
T && !S && !j.value && (T.getCanvas().style.cursor = "");
|
|
1943
2366
|
};
|
|
1944
2367
|
c((e) => {
|
|
1945
|
-
|
|
2368
|
+
T = e, oe();
|
|
1946
2369
|
for (let t of [g, _]) e.on("mousedown", t, $), e.on("touchstart", t, $), e.on("mouseenter", t, Ee), e.on("mouseleave", t, De);
|
|
1947
|
-
i.modelValue &&
|
|
1948
|
-
}),
|
|
1949
|
-
|
|
1950
|
-
}),
|
|
1951
|
-
e && e !==
|
|
2370
|
+
i.modelValue && be(i.modelValue);
|
|
2371
|
+
}), Z(u, () => {
|
|
2372
|
+
oe(), W();
|
|
2373
|
+
}), Z(() => i.modelValue, (e) => {
|
|
2374
|
+
e && e !== j.value ? be(e) : !e && j.value && xe();
|
|
1952
2375
|
}), ne(() => {
|
|
1953
|
-
if (!
|
|
1954
|
-
|
|
1955
|
-
for (let e of [g, _])
|
|
2376
|
+
if (!T) return;
|
|
2377
|
+
j.value && xe();
|
|
2378
|
+
for (let e of [g, _]) T.off("mousedown", e, $), T.off("touchstart", e, $), T.off("mouseenter", e, Ee), T.off("mouseleave", e, De);
|
|
1956
2379
|
let e = [
|
|
1957
2380
|
g,
|
|
1958
2381
|
_,
|
|
@@ -1962,74 +2385,74 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
1962
2385
|
`${e}-fill`
|
|
1963
2386
|
])
|
|
1964
2387
|
];
|
|
1965
|
-
for (let t of e)
|
|
1966
|
-
for (let e of Object.values(h))
|
|
2388
|
+
for (let t of e) T.getLayer(t) && T.removeLayer(t);
|
|
2389
|
+
for (let e of Object.values(h)) T.getSource(e) && T.removeSource(e);
|
|
1967
2390
|
});
|
|
1968
|
-
let Oe =
|
|
2391
|
+
let Oe = E(() => i.control === !0 ? "top-right" : i.control || "top-right");
|
|
1969
2392
|
return n({
|
|
1970
|
-
start:
|
|
1971
|
-
finish:
|
|
2393
|
+
start: be,
|
|
2394
|
+
finish: xe,
|
|
1972
2395
|
clear: Ce,
|
|
1973
2396
|
remove: Se
|
|
1974
|
-
}), (n, r) => (
|
|
2397
|
+
}), (n, r) => (H(), k("div", sn, [t.control ? (H(), D(ge, {
|
|
1975
2398
|
key: 0,
|
|
1976
2399
|
position: Oe.value
|
|
1977
2400
|
}, {
|
|
1978
|
-
default:
|
|
1979
|
-
|
|
2401
|
+
default: Q(() => [
|
|
2402
|
+
A("button", {
|
|
1980
2403
|
type: "button",
|
|
1981
2404
|
class: "grid place-items-center",
|
|
1982
|
-
title:
|
|
1983
|
-
"aria-pressed":
|
|
1984
|
-
onClick: r[0] ||= (e) =>
|
|
1985
|
-
}, [
|
|
2405
|
+
title: X(o).mapMeasureDistance,
|
|
2406
|
+
"aria-pressed": j.value === "distance",
|
|
2407
|
+
onClick: r[0] ||= (e) => be("distance")
|
|
2408
|
+
}, [N(e, {
|
|
1986
2409
|
name: "straighten",
|
|
1987
2410
|
size: 20
|
|
1988
|
-
})], 8,
|
|
1989
|
-
|
|
2411
|
+
})], 8, cn),
|
|
2412
|
+
A("button", {
|
|
1990
2413
|
type: "button",
|
|
1991
2414
|
class: "grid place-items-center",
|
|
1992
|
-
title:
|
|
1993
|
-
"aria-pressed":
|
|
1994
|
-
onClick: r[1] ||= (e) =>
|
|
1995
|
-
}, [
|
|
2415
|
+
title: X(o).mapMeasureArea,
|
|
2416
|
+
"aria-pressed": j.value === "area",
|
|
2417
|
+
onClick: r[1] ||= (e) => be("area")
|
|
2418
|
+
}, [N(e, {
|
|
1996
2419
|
name: "square_foot",
|
|
1997
2420
|
size: 20
|
|
1998
|
-
})], 8,
|
|
1999
|
-
|
|
2421
|
+
})], 8, ln),
|
|
2422
|
+
A("button", {
|
|
2000
2423
|
type: "button",
|
|
2001
2424
|
class: "grid place-items-center",
|
|
2002
|
-
title:
|
|
2003
|
-
disabled: !P.value && !
|
|
2425
|
+
title: X(o).mapClearMeasurements,
|
|
2426
|
+
disabled: !P.value && !j.value,
|
|
2004
2427
|
onClick: Ce
|
|
2005
|
-
}, [
|
|
2428
|
+
}, [N(e, {
|
|
2006
2429
|
name: "delete",
|
|
2007
2430
|
size: 20
|
|
2008
|
-
})], 8,
|
|
2431
|
+
})], 8, un)
|
|
2009
2432
|
]),
|
|
2010
2433
|
_: 1
|
|
2011
|
-
}, 8, ["position"])) :
|
|
2434
|
+
}, 8, ["position"])) : O("", !0), (H(!0), k(C, null, re(F.value, (t) => (H(), D(Me, {
|
|
2012
2435
|
key: t.key,
|
|
2013
2436
|
"lng-lat": t.at,
|
|
2014
2437
|
anchor: t.kind === "area" ? "center" : "top",
|
|
2015
2438
|
offset: t.kind === "area" ? [0, 0] : [0, 8],
|
|
2016
2439
|
class: "pointer-events-none"
|
|
2017
2440
|
}, {
|
|
2018
|
-
default:
|
|
2441
|
+
default: Q(() => [A("span", { class: z(["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"]]) }, [M(J(t.text) + " ", 1), t.m === void 0 ? O("", !0) : (H(), k("button", {
|
|
2019
2442
|
key: 0,
|
|
2020
2443
|
type: "button",
|
|
2021
2444
|
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",
|
|
2022
|
-
"aria-label":
|
|
2023
|
-
title:
|
|
2445
|
+
"aria-label": X(o).mapDeleteMeasurement,
|
|
2446
|
+
title: X(o).mapDeleteMeasurement,
|
|
2024
2447
|
onClick: se((e) => Se(t.m), ["stop"]),
|
|
2025
2448
|
onPointerdown: r[2] ||= se(() => {}, ["stop"]),
|
|
2026
2449
|
onMousedown: r[3] ||= se(() => {}, ["stop"]),
|
|
2027
2450
|
onTouchstart: r[4] ||= se(() => {}, ["stop"]),
|
|
2028
2451
|
onDblclick: r[5] ||= se(() => {}, ["stop"])
|
|
2029
|
-
}, [
|
|
2452
|
+
}, [N(e, {
|
|
2030
2453
|
name: "close",
|
|
2031
2454
|
size: 14
|
|
2032
|
-
})], 40,
|
|
2455
|
+
})], 40, dn))], 2)]),
|
|
2033
2456
|
_: 2
|
|
2034
2457
|
}, 1032, [
|
|
2035
2458
|
"lng-lat",
|
|
@@ -2037,16 +2460,16 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2037
2460
|
"offset"
|
|
2038
2461
|
]))), 128))]));
|
|
2039
2462
|
}
|
|
2040
|
-
}),
|
|
2463
|
+
}), pn = { class: "hidden" }, mn = [
|
|
2041
2464
|
"title",
|
|
2042
2465
|
"aria-label",
|
|
2043
2466
|
"aria-pressed",
|
|
2044
2467
|
"onClick"
|
|
2045
|
-
],
|
|
2468
|
+
], hn = [
|
|
2046
2469
|
"title",
|
|
2047
2470
|
"aria-label",
|
|
2048
2471
|
"disabled"
|
|
2049
|
-
],
|
|
2472
|
+
], gn = "draw", _n = 6, vn = /* @__PURE__ */ P({
|
|
2050
2473
|
__name: "MMapDraw",
|
|
2051
2474
|
props: {
|
|
2052
2475
|
modelValue: {},
|
|
@@ -2072,12 +2495,12 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2072
2495
|
"select"
|
|
2073
2496
|
],
|
|
2074
2497
|
setup(t, { expose: n, emit: r }) {
|
|
2075
|
-
let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } =
|
|
2498
|
+
let i = t, a = r, o = s(), { onReady: c, styleVersion: u, activeTool: d } = pe(), f = l([
|
|
2076
2499
|
"primary",
|
|
2077
2500
|
"secondary",
|
|
2078
2501
|
"tertiary",
|
|
2079
2502
|
"surface"
|
|
2080
|
-
]), p = `m3-draw-${
|
|
2503
|
+
]), p = `m3-draw-${ie()}`, h = {
|
|
2081
2504
|
shapes: `${p}-shapes`,
|
|
2082
2505
|
draft: `${p}-draft`,
|
|
2083
2506
|
handles: `${p}-handles`
|
|
@@ -2085,24 +2508,24 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2085
2508
|
`${h.shapes}-fill`,
|
|
2086
2509
|
`${h.shapes}-line`,
|
|
2087
2510
|
`${h.shapes}-point`
|
|
2088
|
-
], _ = `${h.handles}-vertex`, v = `${h.handles}-midpoint`, y = [], b = "",
|
|
2089
|
-
function
|
|
2090
|
-
y =
|
|
2091
|
-
for (let e of y) (e.id === void 0 || e.id === null) && (e.id =
|
|
2092
|
-
P.value !== null && !
|
|
2511
|
+
], _ = `${h.handles}-vertex`, v = `${h.handles}-midpoint`, y = [], b = "", x = 1, S = [], w = null, T = null, A = 0, j, M = G(null), P = G(null), F = (e) => JSON.parse(JSON.stringify(e)), I = (e) => e === null ? void 0 : y.find((t) => t.id === e);
|
|
2512
|
+
function L(e) {
|
|
2513
|
+
y = F(e?.features ?? []);
|
|
2514
|
+
for (let e of y) (e.id === void 0 || e.id === null) && (e.id = xe());
|
|
2515
|
+
P.value !== null && !I(P.value) && (P.value = null);
|
|
2093
2516
|
}
|
|
2094
|
-
function
|
|
2517
|
+
function R() {
|
|
2095
2518
|
let e = {
|
|
2096
2519
|
type: "FeatureCollection",
|
|
2097
|
-
features:
|
|
2520
|
+
features: F(y)
|
|
2098
2521
|
};
|
|
2099
2522
|
b = JSON.stringify(e.features), a("update:modelValue", e);
|
|
2100
2523
|
}
|
|
2101
|
-
function
|
|
2524
|
+
function ee(e) {
|
|
2102
2525
|
let t = e.geometry;
|
|
2103
2526
|
return t.type === "Point" ? [t.coordinates] : t.type === "LineString" ? t.coordinates : t.type === "Polygon" ? (t.coordinates[0] ?? []).slice(0, -1) : null;
|
|
2104
2527
|
}
|
|
2105
|
-
function
|
|
2528
|
+
function z(e, t) {
|
|
2106
2529
|
let n = e.geometry;
|
|
2107
2530
|
if (n.type === "Point") n.coordinates = t[0];
|
|
2108
2531
|
else if (n.type === "LineString") n.coordinates = t;
|
|
@@ -2111,19 +2534,19 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2111
2534
|
e[0] = [...t, [...t[0]]];
|
|
2112
2535
|
}
|
|
2113
2536
|
}
|
|
2114
|
-
let
|
|
2537
|
+
let te = (e) => e.geometry.type === "Polygon" ? 3 : e.geometry.type === "LineString" ? 2 : 1, B = (e, t = {}) => ({
|
|
2115
2538
|
type: "Feature",
|
|
2116
2539
|
geometry: {
|
|
2117
2540
|
type: "Point",
|
|
2118
2541
|
coordinates: e
|
|
2119
2542
|
},
|
|
2120
2543
|
properties: t
|
|
2121
|
-
}),
|
|
2544
|
+
}), V = (e) => ({
|
|
2122
2545
|
type: "FeatureCollection",
|
|
2123
2546
|
features: e
|
|
2124
|
-
}), U = (e, t) => (
|
|
2547
|
+
}), U = (e, t) => (j?.getSource(e))?.setData(V(t));
|
|
2125
2548
|
function W() {
|
|
2126
|
-
if (!
|
|
2549
|
+
if (!j) return;
|
|
2127
2550
|
U(h.shapes, y.map((e) => ({
|
|
2128
2551
|
type: "Feature",
|
|
2129
2552
|
geometry: e.geometry,
|
|
@@ -2134,16 +2557,16 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2134
2557
|
}
|
|
2135
2558
|
})));
|
|
2136
2559
|
let e = [];
|
|
2137
|
-
if (
|
|
2138
|
-
let t =
|
|
2139
|
-
|
|
2560
|
+
if (M.value && M.value !== "point" && S.length) {
|
|
2561
|
+
let t = w ? [...S, w] : S;
|
|
2562
|
+
S.forEach((t) => e.push(B(t))), t.length >= 2 && e.push({
|
|
2140
2563
|
type: "Feature",
|
|
2141
2564
|
geometry: {
|
|
2142
2565
|
type: "LineString",
|
|
2143
|
-
coordinates:
|
|
2566
|
+
coordinates: M.value === "polygon" && t.length >= 3 ? [...t, t[0]] : t
|
|
2144
2567
|
},
|
|
2145
2568
|
properties: {}
|
|
2146
|
-
}),
|
|
2569
|
+
}), M.value === "polygon" && t.length >= 3 && e.push({
|
|
2147
2570
|
type: "Feature",
|
|
2148
2571
|
geometry: {
|
|
2149
2572
|
type: "Polygon",
|
|
@@ -2153,25 +2576,25 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2153
2576
|
});
|
|
2154
2577
|
}
|
|
2155
2578
|
U(h.draft, e);
|
|
2156
|
-
let t = [], n =
|
|
2579
|
+
let t = [], n = I(P.value), r = n && !M.value && i.editable ? ee(n) : null;
|
|
2157
2580
|
if (n && r && (r.forEach((e, n) => t.push(B(e, {
|
|
2158
2581
|
handle: "vertex",
|
|
2159
2582
|
v: n
|
|
2160
2583
|
}))), n.geometry.type !== "Point")) {
|
|
2161
2584
|
let e = n.geometry.type === "Polygon" ? [...r, r[0]] : r;
|
|
2162
|
-
for (let n = 0; n < e.length - 1; n++) t.push(B(
|
|
2585
|
+
for (let n = 0; n < e.length - 1; n++) t.push(B(He(e[n], e[n + 1]), {
|
|
2163
2586
|
handle: "midpoint",
|
|
2164
2587
|
after: n
|
|
2165
2588
|
}));
|
|
2166
2589
|
}
|
|
2167
2590
|
U(h.handles, t);
|
|
2168
2591
|
}
|
|
2169
|
-
function
|
|
2592
|
+
function K() {
|
|
2170
2593
|
A ||= requestAnimationFrame(() => {
|
|
2171
2594
|
A = 0, W();
|
|
2172
2595
|
});
|
|
2173
2596
|
}
|
|
2174
|
-
let
|
|
2597
|
+
let q = (...e) => [
|
|
2175
2598
|
"match",
|
|
2176
2599
|
["geometry-type"],
|
|
2177
2600
|
e,
|
|
@@ -2182,7 +2605,7 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2182
2605
|
["get", "__draw_selected"],
|
|
2183
2606
|
!0
|
|
2184
2607
|
];
|
|
2185
|
-
function
|
|
2608
|
+
function Y() {
|
|
2186
2609
|
let e = f.value[i.color], t = f.value.surface;
|
|
2187
2610
|
return {
|
|
2188
2611
|
fill: {
|
|
@@ -2225,44 +2648,44 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2225
2648
|
}
|
|
2226
2649
|
};
|
|
2227
2650
|
}
|
|
2228
|
-
function
|
|
2229
|
-
if (!
|
|
2230
|
-
for (let e of Object.values(h))
|
|
2651
|
+
function ae() {
|
|
2652
|
+
if (!j) return;
|
|
2653
|
+
for (let e of Object.values(h)) j.getSource(e) || j.addSource(e, {
|
|
2231
2654
|
type: "geojson",
|
|
2232
|
-
data:
|
|
2655
|
+
data: V([])
|
|
2233
2656
|
});
|
|
2234
|
-
let e =
|
|
2235
|
-
|
|
2657
|
+
let e = Y(), t = (e) => {
|
|
2658
|
+
j.getLayer(e.id) || j.addLayer(e);
|
|
2236
2659
|
};
|
|
2237
2660
|
t({
|
|
2238
2661
|
id: g[0],
|
|
2239
2662
|
type: "fill",
|
|
2240
2663
|
source: h.shapes,
|
|
2241
|
-
filter:
|
|
2664
|
+
filter: q("Polygon", "MultiPolygon"),
|
|
2242
2665
|
paint: e.fill
|
|
2243
2666
|
}), t({
|
|
2244
2667
|
id: g[1],
|
|
2245
2668
|
type: "line",
|
|
2246
2669
|
source: h.shapes,
|
|
2247
|
-
filter:
|
|
2670
|
+
filter: q("LineString", "MultiLineString", "Polygon", "MultiPolygon"),
|
|
2248
2671
|
paint: e.line
|
|
2249
2672
|
}), t({
|
|
2250
2673
|
id: g[2],
|
|
2251
2674
|
type: "circle",
|
|
2252
2675
|
source: h.shapes,
|
|
2253
|
-
filter:
|
|
2676
|
+
filter: q("Point", "MultiPoint"),
|
|
2254
2677
|
paint: e.point
|
|
2255
2678
|
}), t({
|
|
2256
2679
|
id: `${h.draft}-fill`,
|
|
2257
2680
|
type: "fill",
|
|
2258
2681
|
source: h.draft,
|
|
2259
|
-
filter:
|
|
2682
|
+
filter: q("Polygon"),
|
|
2260
2683
|
paint: e.draftFill
|
|
2261
2684
|
}), t({
|
|
2262
2685
|
id: `${h.draft}-line`,
|
|
2263
2686
|
type: "line",
|
|
2264
2687
|
source: h.draft,
|
|
2265
|
-
filter:
|
|
2688
|
+
filter: q("LineString"),
|
|
2266
2689
|
paint: {
|
|
2267
2690
|
...e.draftLine,
|
|
2268
2691
|
"line-width": 2.5,
|
|
@@ -2272,7 +2695,7 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2272
2695
|
id: `${h.draft}-point`,
|
|
2273
2696
|
type: "circle",
|
|
2274
2697
|
source: h.draft,
|
|
2275
|
-
filter:
|
|
2698
|
+
filter: q("Point"),
|
|
2276
2699
|
paint: {
|
|
2277
2700
|
...e.handle,
|
|
2278
2701
|
"circle-radius": 5,
|
|
@@ -2309,100 +2732,100 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2309
2732
|
}
|
|
2310
2733
|
});
|
|
2311
2734
|
}
|
|
2312
|
-
|
|
2313
|
-
if (!
|
|
2314
|
-
let e =
|
|
2315
|
-
if (
|
|
2735
|
+
Z([f, () => i.color], () => {
|
|
2736
|
+
if (!j) return;
|
|
2737
|
+
let e = Y(), t = (e, t) => {
|
|
2738
|
+
if (j.getLayer(e)) for (let [n, r] of Object.entries(t)) j.setPaintProperty(e, n, r);
|
|
2316
2739
|
};
|
|
2317
2740
|
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);
|
|
2318
2741
|
});
|
|
2319
|
-
function
|
|
2320
|
-
if (e !== null && !
|
|
2742
|
+
function oe(e) {
|
|
2743
|
+
if (e !== null && !I(e) && (e = null), P.value === e) return;
|
|
2321
2744
|
P.value = e, W();
|
|
2322
|
-
let t =
|
|
2323
|
-
a("select", t ?
|
|
2745
|
+
let t = I(e);
|
|
2746
|
+
a("select", t ? F(t) : null);
|
|
2324
2747
|
}
|
|
2325
|
-
function
|
|
2748
|
+
function se(e = P.value) {
|
|
2326
2749
|
let t = y.findIndex((t) => t.id === e);
|
|
2327
|
-
t < 0 || (y.splice(t, 1), P.value === e && (P.value = null, a("select", null)), W(),
|
|
2750
|
+
t < 0 || (y.splice(t, 1), P.value === e && (P.value = null, a("select", null)), W(), R());
|
|
2328
2751
|
}
|
|
2329
|
-
function
|
|
2330
|
-
|
|
2752
|
+
function ce() {
|
|
2753
|
+
M.value && $(), y.length && (y = [], P.value !== null && (P.value = null, a("select", null)), W(), R());
|
|
2331
2754
|
}
|
|
2332
|
-
let
|
|
2333
|
-
function
|
|
2334
|
-
if (
|
|
2335
|
-
let { x: t, y: n } = e.point, r = [[t -
|
|
2336
|
-
if (a === void 0) return
|
|
2755
|
+
let le = (e) => [e.lngLat.lng, e.lngLat.lat];
|
|
2756
|
+
function ue(e) {
|
|
2757
|
+
if (M.value || !j || !i.editable || d.value && d.value !== gn) return;
|
|
2758
|
+
let { x: t, y: n } = e.point, r = [[t - _n, n - _n], [t + _n, n + _n]], a = j.queryRenderedFeatures(r, { layers: g.filter((e) => j.getLayer(e)) })[0]?.properties?.__draw_id;
|
|
2759
|
+
if (a === void 0) return oe(null);
|
|
2337
2760
|
let o = y.find((e) => String(e.id) === a);
|
|
2338
|
-
|
|
2761
|
+
oe(o ? o.id : null);
|
|
2339
2762
|
}
|
|
2340
|
-
function
|
|
2341
|
-
|
|
2342
|
-
d.value ===
|
|
2763
|
+
function de() {
|
|
2764
|
+
M.value || !i.editable || d.value || (d.value = gn, setTimeout(() => {
|
|
2765
|
+
d.value === gn && !M.value && !T && (d.value = null);
|
|
2343
2766
|
}, 0));
|
|
2344
2767
|
}
|
|
2345
|
-
let
|
|
2346
|
-
|
|
2347
|
-
},
|
|
2348
|
-
|
|
2768
|
+
let fe = () => {
|
|
2769
|
+
j && !M.value && !T && i.editable && (j.getCanvas().style.cursor = "pointer");
|
|
2770
|
+
}, me = () => {
|
|
2771
|
+
j && !M.value && !T && (j.getCanvas().style.cursor = "");
|
|
2349
2772
|
};
|
|
2350
|
-
function
|
|
2351
|
-
if (
|
|
2352
|
-
if (
|
|
2773
|
+
function he(e) {
|
|
2774
|
+
if (M.value && j) {
|
|
2775
|
+
if (M.value === "point") Se({
|
|
2353
2776
|
type: "Point",
|
|
2354
|
-
coordinates:
|
|
2777
|
+
coordinates: le(e)
|
|
2355
2778
|
}), $();
|
|
2356
2779
|
else {
|
|
2357
|
-
if (
|
|
2358
|
-
let t =
|
|
2780
|
+
if (M.value === "polygon" && S.length >= 3) {
|
|
2781
|
+
let t = j.project(S[0]);
|
|
2359
2782
|
if (Math.hypot(t.x - e.point.x, t.y - e.point.y) < 20) return $();
|
|
2360
2783
|
}
|
|
2361
|
-
|
|
2784
|
+
S.push(le(e)), W();
|
|
2362
2785
|
}
|
|
2363
2786
|
}
|
|
2364
2787
|
}
|
|
2365
|
-
function
|
|
2366
|
-
|
|
2788
|
+
function _e(e) {
|
|
2789
|
+
w = le(e), K();
|
|
2367
2790
|
}
|
|
2368
|
-
function
|
|
2369
|
-
if (e.preventDefault(), !
|
|
2370
|
-
let t =
|
|
2371
|
-
Math.hypot(t.x - n.x, t.y - n.y) < 10 &&
|
|
2791
|
+
function ve(e) {
|
|
2792
|
+
if (e.preventDefault(), !j || S.length < 2) return;
|
|
2793
|
+
let t = j.project(S[S.length - 1]), n = j.project(S[S.length - 2]);
|
|
2794
|
+
Math.hypot(t.x - n.x, t.y - n.y) < 10 && S.pop(), $();
|
|
2372
2795
|
}
|
|
2373
|
-
function
|
|
2796
|
+
function ye() {
|
|
2374
2797
|
let e = document.activeElement;
|
|
2375
|
-
return !e || e === document.body ? !0 :
|
|
2798
|
+
return !e || e === document.body ? !0 : j?.getContainer().contains(e) ? !(e instanceof HTMLElement && (e.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName))) : !1;
|
|
2376
2799
|
}
|
|
2377
|
-
function
|
|
2378
|
-
|
|
2800
|
+
function be(e) {
|
|
2801
|
+
ye() && (M.value ? e.key === "Enter" ? (e.preventDefault(), $()) : e.key === "Backspace" && S.length && (e.preventDefault(), S.pop(), W()) : (e.key === "Delete" || e.key === "Backspace") && P.value !== null && i.editable && (e.preventDefault(), se()));
|
|
2379
2802
|
}
|
|
2380
|
-
m(() => !!
|
|
2381
|
-
function
|
|
2382
|
-
let e = `shape-${
|
|
2383
|
-
for (; y.some((t) => t.id === e);) e = `shape-${
|
|
2803
|
+
m(() => !!M.value || P.value !== null, () => M.value ? $() : oe(null));
|
|
2804
|
+
function xe() {
|
|
2805
|
+
let e = `shape-${x++}`;
|
|
2806
|
+
for (; y.some((t) => t.id === e);) e = `shape-${x++}`;
|
|
2384
2807
|
return e;
|
|
2385
2808
|
}
|
|
2386
2809
|
function Se(e) {
|
|
2387
2810
|
let t = {
|
|
2388
2811
|
type: "Feature",
|
|
2389
|
-
id:
|
|
2812
|
+
id: xe(),
|
|
2390
2813
|
geometry: e,
|
|
2391
2814
|
properties: {}
|
|
2392
2815
|
};
|
|
2393
|
-
y.push(t), P.value = i.editable ? t.id : null,
|
|
2816
|
+
y.push(t), P.value = i.editable ? t.id : null, R(), i.editable && a("select", F(t));
|
|
2394
2817
|
}
|
|
2395
2818
|
function Ce(e) {
|
|
2396
|
-
if (
|
|
2397
|
-
if (
|
|
2398
|
-
|
|
2819
|
+
if (j) {
|
|
2820
|
+
if (M.value === e) return $();
|
|
2821
|
+
M.value && $(), P.value !== null && oe(null), M.value = e, d.value = gn, S = [], w = null, j.getCanvas().style.cursor = "crosshair", j.doubleClickZoom.disable(), j.on("click", he), j.on("mousemove", _e), j.on("dblclick", ve), W(), i.mode !== e && a("update:mode", e);
|
|
2399
2822
|
}
|
|
2400
2823
|
}
|
|
2401
2824
|
function $() {
|
|
2402
|
-
if (!
|
|
2825
|
+
if (!j || !M.value) return;
|
|
2403
2826
|
cancelAnimationFrame(A), A = 0;
|
|
2404
|
-
let e =
|
|
2405
|
-
|
|
2827
|
+
let e = M.value, t = S;
|
|
2828
|
+
S = [], w = null, M.value = null, d.value === gn && (d.value = null), j.getCanvas().style.cursor = "", j.doubleClickZoom.enable(), j.off("click", he), j.off("mousemove", _e), j.off("dblclick", ve), e === "line" && t.length >= 2 ? Se({
|
|
2406
2829
|
type: "LineString",
|
|
2407
2830
|
coordinates: t
|
|
2408
2831
|
}) : e === "polygon" && t.length >= 3 && Se({
|
|
@@ -2411,62 +2834,62 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2411
2834
|
}), W(), i.mode !== null && a("update:mode", null);
|
|
2412
2835
|
}
|
|
2413
2836
|
function we(e) {
|
|
2414
|
-
let t = e.features?.[0], n =
|
|
2415
|
-
if (!t || !n ||
|
|
2416
|
-
let r =
|
|
2837
|
+
let t = e.features?.[0], n = I(P.value);
|
|
2838
|
+
if (!t || !n || M.value || !j || !i.editable) return;
|
|
2839
|
+
let r = ee(n);
|
|
2417
2840
|
if (!r) return;
|
|
2418
2841
|
e.preventDefault();
|
|
2419
2842
|
let a = t.properties.v;
|
|
2420
|
-
t.properties.handle === "midpoint" && (a = t.properties.after + 1, r.splice(a, 0,
|
|
2843
|
+
t.properties.handle === "midpoint" && (a = t.properties.after + 1, r.splice(a, 0, le(e)), z(n, r)), T = {
|
|
2421
2844
|
id: n.id,
|
|
2422
2845
|
v: a,
|
|
2423
2846
|
moved: t.properties.handle === "midpoint"
|
|
2424
|
-
}, d.value =
|
|
2847
|
+
}, d.value = gn, j.getCanvas().style.cursor = "grabbing";
|
|
2425
2848
|
let o = e.type === "touchstart";
|
|
2426
|
-
o &&
|
|
2849
|
+
o && j.dragPan.disable(), j.on(o ? "touchmove" : "mousemove", Te), j.once(o ? "touchend" : "mouseup", Ee), W();
|
|
2427
2850
|
}
|
|
2428
2851
|
function Te(e) {
|
|
2429
|
-
let t =
|
|
2430
|
-
|
|
2852
|
+
let t = T && I(T.id), n = t && ee(t);
|
|
2853
|
+
T && t && n && (n[T.v] = le(e), z(t, n), T.moved = !0, K());
|
|
2431
2854
|
}
|
|
2432
2855
|
function Ee() {
|
|
2433
|
-
if (!
|
|
2434
|
-
let e =
|
|
2435
|
-
|
|
2436
|
-
d.value ===
|
|
2856
|
+
if (!j) return;
|
|
2857
|
+
let e = T?.moved;
|
|
2858
|
+
T = null, j.off("mousemove", Te), j.off("touchmove", Te), j.dragPan.enable(), j.getCanvas().style.cursor = "", W(), e && R(), setTimeout(() => {
|
|
2859
|
+
d.value === gn && !M.value && (d.value = null);
|
|
2437
2860
|
});
|
|
2438
2861
|
}
|
|
2439
2862
|
function De(e) {
|
|
2440
|
-
let t = e.features?.[0], n =
|
|
2441
|
-
if (!t || !n ||
|
|
2863
|
+
let t = e.features?.[0], n = I(P.value);
|
|
2864
|
+
if (!t || !n || M.value || !i.editable) return;
|
|
2442
2865
|
e.preventDefault();
|
|
2443
|
-
let r =
|
|
2444
|
-
!r || r.length <=
|
|
2866
|
+
let r = ee(n);
|
|
2867
|
+
!r || r.length <= te(n) || (r.splice(t.properties.v, 1), z(n, r), W(), R());
|
|
2445
2868
|
}
|
|
2446
2869
|
let Oe = () => {
|
|
2447
|
-
|
|
2870
|
+
j && !T && !M.value && (j.getCanvas().style.cursor = "grab");
|
|
2448
2871
|
}, ke = () => {
|
|
2449
|
-
|
|
2872
|
+
j && !T && !M.value && (j.getCanvas().style.cursor = "");
|
|
2450
2873
|
};
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
for (let t of g) e.on("mousedown", t,
|
|
2874
|
+
L(i.modelValue), b = JSON.stringify(y), c((e) => {
|
|
2875
|
+
j = e, ae(), W(), e.on("click", ue);
|
|
2876
|
+
for (let t of g) e.on("mousedown", t, de), e.on("touchstart", t, de), e.on("mouseenter", t, fe), e.on("mouseleave", t, me);
|
|
2454
2877
|
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);
|
|
2455
|
-
e.on("dblclick", _, De), document.addEventListener("keydown",
|
|
2456
|
-
}),
|
|
2457
|
-
|
|
2458
|
-
}),
|
|
2459
|
-
JSON.stringify(e?.features ?? []) !== b && (
|
|
2460
|
-
}, { deep: !0 }),
|
|
2461
|
-
e && e !==
|
|
2462
|
-
}),
|
|
2463
|
-
!e && P.value !== null &&
|
|
2878
|
+
e.on("dblclick", _, De), document.addEventListener("keydown", be), i.mode && Ce(i.mode);
|
|
2879
|
+
}), Z(u, () => {
|
|
2880
|
+
ae(), W();
|
|
2881
|
+
}), Z(() => i.modelValue, (e) => {
|
|
2882
|
+
JSON.stringify(e?.features ?? []) !== b && (L(e), b = JSON.stringify(y), W());
|
|
2883
|
+
}, { deep: !0 }), Z(() => i.mode, (e) => {
|
|
2884
|
+
e && e !== M.value ? Ce(e) : !e && M.value && $();
|
|
2885
|
+
}), Z(() => i.editable, (e) => {
|
|
2886
|
+
!e && P.value !== null && oe(null);
|
|
2464
2887
|
}), ne(() => {
|
|
2465
|
-
if (document.removeEventListener("keydown",
|
|
2466
|
-
|
|
2467
|
-
for (let e of g)
|
|
2468
|
-
for (let e of [_, v])
|
|
2469
|
-
|
|
2888
|
+
if (document.removeEventListener("keydown", be), !j) return;
|
|
2889
|
+
M.value && $(), cancelAnimationFrame(A), j.off("click", ue);
|
|
2890
|
+
for (let e of g) j.off("mousedown", e, de), j.off("touchstart", e, de), j.off("mouseenter", e, fe), j.off("mouseleave", e, me);
|
|
2891
|
+
for (let e of [_, v]) j.off("mousedown", e, we), j.off("touchstart", e, we), j.off("mouseenter", e, Oe), j.off("mouseleave", e, ke);
|
|
2892
|
+
j.off("dblclick", _, De);
|
|
2470
2893
|
let e = [
|
|
2471
2894
|
_,
|
|
2472
2895
|
v,
|
|
@@ -2475,15 +2898,15 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2475
2898
|
`${h.draft}-fill`,
|
|
2476
2899
|
...[...g].reverse()
|
|
2477
2900
|
];
|
|
2478
|
-
for (let t of e)
|
|
2479
|
-
for (let e of Object.values(h))
|
|
2480
|
-
|
|
2901
|
+
for (let t of e) j.getLayer(t) && j.removeLayer(t);
|
|
2902
|
+
for (let e of Object.values(h)) j.getSource(e) && j.removeSource(e);
|
|
2903
|
+
j = void 0;
|
|
2481
2904
|
});
|
|
2482
|
-
let Ae =
|
|
2905
|
+
let Ae = E(() => i.control === !0 ? "top-right" : i.control || "top-right"), je = {
|
|
2483
2906
|
point: "location_on",
|
|
2484
2907
|
line: "polyline",
|
|
2485
2908
|
polygon: "pentagon"
|
|
2486
|
-
}, Me =
|
|
2909
|
+
}, Me = E(() => ({
|
|
2487
2910
|
point: o.mapDrawPoint,
|
|
2488
2911
|
line: o.mapDrawLine,
|
|
2489
2912
|
polygon: o.mapDrawPolygon
|
|
@@ -2491,48 +2914,48 @@ var Ut = { class: "hidden" }, Wt = ["title", "aria-pressed"], Gt = ["title", "ar
|
|
|
2491
2914
|
return n({
|
|
2492
2915
|
start: Ce,
|
|
2493
2916
|
finish: $,
|
|
2494
|
-
select:
|
|
2495
|
-
remove:
|
|
2496
|
-
clear:
|
|
2497
|
-
}), (n, r) => (
|
|
2917
|
+
select: oe,
|
|
2918
|
+
remove: se,
|
|
2919
|
+
clear: ce
|
|
2920
|
+
}), (n, r) => (H(), k("div", pn, [t.control ? (H(), D(ge, {
|
|
2498
2921
|
key: 0,
|
|
2499
2922
|
position: Ae.value
|
|
2500
2923
|
}, {
|
|
2501
|
-
default:
|
|
2924
|
+
default: Q(() => [(H(!0), k(C, null, re(t.modes, (t) => (H(), k("button", {
|
|
2502
2925
|
key: t,
|
|
2503
2926
|
type: "button",
|
|
2504
2927
|
class: "grid place-items-center",
|
|
2505
2928
|
title: Me.value[t],
|
|
2506
2929
|
"aria-label": Me.value[t],
|
|
2507
|
-
"aria-pressed":
|
|
2930
|
+
"aria-pressed": M.value === t,
|
|
2508
2931
|
onClick: (e) => Ce(t)
|
|
2509
|
-
}, [
|
|
2932
|
+
}, [N(e, {
|
|
2510
2933
|
name: je[t],
|
|
2511
2934
|
size: 20
|
|
2512
|
-
}, null, 8, ["name"])], 8,
|
|
2935
|
+
}, null, 8, ["name"])], 8, mn))), 128)), t.editable ? (H(), k("button", {
|
|
2513
2936
|
key: 0,
|
|
2514
2937
|
type: "button",
|
|
2515
2938
|
class: "grid place-items-center",
|
|
2516
|
-
title:
|
|
2517
|
-
"aria-label":
|
|
2939
|
+
title: X(o).mapDeleteFeature,
|
|
2940
|
+
"aria-label": X(o).mapDeleteFeature,
|
|
2518
2941
|
disabled: P.value === null,
|
|
2519
|
-
onClick: r[0] ||= (e) =>
|
|
2520
|
-
}, [
|
|
2942
|
+
onClick: r[0] ||= (e) => se()
|
|
2943
|
+
}, [N(e, {
|
|
2521
2944
|
name: "delete",
|
|
2522
2945
|
size: 20
|
|
2523
|
-
})], 8,
|
|
2946
|
+
})], 8, hn)) : O("", !0)]),
|
|
2524
2947
|
_: 1
|
|
2525
|
-
}, 8, ["position"])) :
|
|
2948
|
+
}, 8, ["position"])) : O("", !0)]));
|
|
2526
2949
|
}
|
|
2527
|
-
}),
|
|
2528
|
-
function
|
|
2950
|
+
}), yn = /* @__PURE__ */ new WeakMap();
|
|
2951
|
+
function bn(e) {
|
|
2529
2952
|
let t = fe(e);
|
|
2530
2953
|
if (!t) throw Error("useMapFilter() must be called in a component inside <MMap>, or be given one");
|
|
2531
2954
|
function n(e, n) {
|
|
2532
2955
|
let r = t.map.value;
|
|
2533
2956
|
if (!r?.getLayer(e)) return;
|
|
2534
|
-
let i =
|
|
2535
|
-
i ||
|
|
2957
|
+
let i = yn.get(r);
|
|
2958
|
+
i || yn.set(r, i = /* @__PURE__ */ new Map()), i.has(e) || i.set(e, r.getFilter(e) ?? void 0);
|
|
2536
2959
|
let a = i.get(e);
|
|
2537
2960
|
r.setFilter(e, n ? a ? [
|
|
2538
2961
|
"all",
|
|
@@ -2556,7 +2979,7 @@ function nn(e) {
|
|
|
2556
2979
|
};
|
|
2557
2980
|
}
|
|
2558
2981
|
// src/components/MMapFilter.vue?vue&type=script&setup=true&lang.ts
|
|
2559
|
-
var
|
|
2982
|
+
var xn = { class: "flex flex-wrap gap-2" }, Sn = /* @__PURE__ */ P({
|
|
2560
2983
|
__name: "MMapFilter",
|
|
2561
2984
|
props: {
|
|
2562
2985
|
layer: {},
|
|
@@ -2568,7 +2991,7 @@ var rn = { class: "flex flex-wrap gap-2" }, an = /* @__PURE__ */ M({
|
|
|
2568
2991
|
},
|
|
2569
2992
|
emits: ["update:modelValue"],
|
|
2570
2993
|
setup(e, { emit: t }) {
|
|
2571
|
-
let n = e, r = t, { onReady: i, styleVersion: a } =
|
|
2994
|
+
let n = e, r = t, { onReady: i, styleVersion: a } = pe(() => n.map), { setFilter: o, valuesOf: s } = bn(() => n.map), c = G([]), l = E(() => n.values ?? c.value), u = G([]), d = E(() => n.modelValue ?? u.value);
|
|
2572
2995
|
function f() {
|
|
2573
2996
|
let e = d.value;
|
|
2574
2997
|
o(n.layer, e.length ? [
|
|
@@ -2589,22 +3012,22 @@ var rn = { class: "flex flex-wrap gap-2" }, an = /* @__PURE__ */ M({
|
|
|
2589
3012
|
}
|
|
2590
3013
|
return i((e) => {
|
|
2591
3014
|
m(e), f();
|
|
2592
|
-
}),
|
|
3015
|
+
}), Z(d, f, { deep: !0 }), Z(a, () => f()), Z(() => [n.layer, n.property], ([e], [t]) => {
|
|
2593
3016
|
e !== t && o(t, null), f();
|
|
2594
|
-
}), ne(() => o(n.layer, null)), (t, n) => (
|
|
3017
|
+
}), ne(() => o(n.layer, null)), (t, n) => (H(), k("div", xn, [(H(!0), k(C, null, re(l.value, (t) => (H(), D(h, {
|
|
2595
3018
|
key: t,
|
|
2596
3019
|
type: "filter",
|
|
2597
3020
|
clickable: "",
|
|
2598
3021
|
selected: d.value.includes(t),
|
|
2599
3022
|
onClick: (e) => p(t)
|
|
2600
3023
|
}, {
|
|
2601
|
-
default:
|
|
3024
|
+
default: Q(() => [M(J(e.labels?.[String(t)] ?? t), 1)]),
|
|
2602
3025
|
_: 2
|
|
2603
3026
|
}, 1032, ["selected", "onClick"]))), 128))]));
|
|
2604
3027
|
}
|
|
2605
3028
|
});
|
|
2606
3029
|
// src/composables/mapSearch.ts
|
|
2607
|
-
function
|
|
3030
|
+
function Cn(e = {}) {
|
|
2608
3031
|
return async (t, n) => {
|
|
2609
3032
|
let r = new URLSearchParams({
|
|
2610
3033
|
format: "jsonv2",
|
|
@@ -2630,7 +3053,7 @@ function on(e = {}) {
|
|
|
2630
3053
|
});
|
|
2631
3054
|
};
|
|
2632
3055
|
}
|
|
2633
|
-
var
|
|
3056
|
+
var wn = {
|
|
2634
3057
|
city: "location_city",
|
|
2635
3058
|
town: "location_city",
|
|
2636
3059
|
village: "holiday_village",
|
|
@@ -2657,17 +3080,17 @@ var sn = {
|
|
|
2657
3080
|
administrative: "map",
|
|
2658
3081
|
country: "public",
|
|
2659
3082
|
state: "map"
|
|
2660
|
-
},
|
|
3083
|
+
}, Tn = (e) => e && wn[e] || "location_on", En = { class: "hidden" }, Dn = [
|
|
2661
3084
|
"value",
|
|
2662
3085
|
"placeholder",
|
|
2663
3086
|
"aria-label"
|
|
2664
|
-
],
|
|
3087
|
+
], On = {
|
|
2665
3088
|
key: 0,
|
|
2666
3089
|
class: "border-t border-outline-variant"
|
|
2667
|
-
},
|
|
3090
|
+
}, kn = {
|
|
2668
3091
|
key: 1,
|
|
2669
3092
|
class: "flex flex-col items-center gap-2 py-6"
|
|
2670
|
-
},
|
|
3093
|
+
}, An = { class: "text-body-small text-on-surface-variant" }, jn = /* @__PURE__ */ P({
|
|
2671
3094
|
__name: "MMapSearch",
|
|
2672
3095
|
props: {
|
|
2673
3096
|
provider: {},
|
|
@@ -2685,8 +3108,8 @@ var sn = {
|
|
|
2685
3108
|
},
|
|
2686
3109
|
emits: ["select"],
|
|
2687
3110
|
setup(t, { emit: n }) {
|
|
2688
|
-
let r = t, i = n, o = s(), { map: c } =
|
|
2689
|
-
async function
|
|
3111
|
+
let r = t, i = n, o = s(), { map: c } = pe(), l = E(() => r.provider ?? Cn()), u = G(""), d = q([]), f = G(!1), p = G(!1), m = G(!1), h = q(null), g, x;
|
|
3112
|
+
async function S() {
|
|
2690
3113
|
let e = u.value.trim();
|
|
2691
3114
|
if (!e) return;
|
|
2692
3115
|
g?.abort(), g = new AbortController();
|
|
@@ -2701,11 +3124,11 @@ var sn = {
|
|
|
2701
3124
|
g === t && (f.value = !1, p.value = !0);
|
|
2702
3125
|
}
|
|
2703
3126
|
}
|
|
2704
|
-
function
|
|
2705
|
-
if (u.value = e, !e) return
|
|
2706
|
-
r.instant && (clearTimeout(
|
|
3127
|
+
function w(e) {
|
|
3128
|
+
if (u.value = e, !e) return j();
|
|
3129
|
+
r.instant && (clearTimeout(x), x = setTimeout(S, 350));
|
|
2707
3130
|
}
|
|
2708
|
-
function
|
|
3131
|
+
function T(e) {
|
|
2709
3132
|
h.value = e, m.value = !1;
|
|
2710
3133
|
let t = c.value;
|
|
2711
3134
|
e.bbox && e.bbox[0] !== e.bbox[2] ? t?.fitBounds([[e.bbox[0], e.bbox[1]], [e.bbox[2], e.bbox[3]]], {
|
|
@@ -2716,100 +3139,100 @@ var sn = {
|
|
|
2716
3139
|
zoom: r.zoom
|
|
2717
3140
|
}), i("select", e);
|
|
2718
3141
|
}
|
|
2719
|
-
function
|
|
2720
|
-
g?.abort(), clearTimeout(
|
|
3142
|
+
function j() {
|
|
3143
|
+
g?.abort(), clearTimeout(x), u.value = "", d.value = [], p.value = !1, f.value = !1, m.value = !1, h.value = null;
|
|
2721
3144
|
}
|
|
2722
3145
|
return ne(() => {
|
|
2723
|
-
g?.abort(), clearTimeout(
|
|
2724
|
-
}), (n, r) => (
|
|
3146
|
+
g?.abort(), clearTimeout(x);
|
|
3147
|
+
}), (n, r) => (H(), k("div", En, [N(ge, {
|
|
2725
3148
|
position: t.position,
|
|
2726
3149
|
group: !1
|
|
2727
3150
|
}, {
|
|
2728
|
-
default:
|
|
3151
|
+
default: Q(() => [N(v, {
|
|
2729
3152
|
variant: "elevated",
|
|
2730
3153
|
class: "w-80 max-w-[calc(100vw-5rem)] overflow-hidden"
|
|
2731
3154
|
}, {
|
|
2732
|
-
default:
|
|
3155
|
+
default: Q(() => [A("form", {
|
|
2733
3156
|
class: "flex items-center gap-2 py-1 pr-1 pl-3",
|
|
2734
3157
|
role: "search",
|
|
2735
|
-
onSubmit: se(
|
|
3158
|
+
onSubmit: se(S, ["prevent"])
|
|
2736
3159
|
}, [
|
|
2737
|
-
|
|
3160
|
+
N(e, {
|
|
2738
3161
|
name: "search",
|
|
2739
3162
|
size: 20,
|
|
2740
3163
|
class: "shrink-0 text-on-surface-variant"
|
|
2741
3164
|
}),
|
|
2742
|
-
|
|
3165
|
+
A("input", {
|
|
2743
3166
|
value: u.value,
|
|
2744
3167
|
type: "search",
|
|
2745
3168
|
enterkeyhint: "search",
|
|
2746
|
-
placeholder: t.placeholder ??
|
|
2747
|
-
"aria-label": t.placeholder ??
|
|
3169
|
+
placeholder: t.placeholder ?? X(o).mapSearchPlaces,
|
|
3170
|
+
"aria-label": t.placeholder ?? X(o).mapSearchPlaces,
|
|
2748
3171
|
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",
|
|
2749
|
-
onInput: r[0] ||= (e) =>
|
|
3172
|
+
onInput: r[0] ||= (e) => w(e.target.value),
|
|
2750
3173
|
onFocus: r[1] ||= (e) => m.value = p.value && !h.value
|
|
2751
|
-
}, null, 40,
|
|
2752
|
-
f.value ? (
|
|
3174
|
+
}, null, 40, Dn),
|
|
3175
|
+
f.value ? (H(), D(b, {
|
|
2753
3176
|
key: 0,
|
|
2754
3177
|
size: 20,
|
|
2755
3178
|
class: "mr-2 shrink-0"
|
|
2756
|
-
})) : u.value ? (
|
|
3179
|
+
})) : u.value ? (H(), D(a, {
|
|
2757
3180
|
key: 1,
|
|
2758
3181
|
icon: "close",
|
|
2759
|
-
label:
|
|
3182
|
+
label: X(o).clearSearch,
|
|
2760
3183
|
size: "sm",
|
|
2761
|
-
onClick:
|
|
2762
|
-
}, null, 8, ["label"])) :
|
|
2763
|
-
], 32), m.value && p.value && !f.value ? (
|
|
3184
|
+
onClick: j
|
|
3185
|
+
}, null, 8, ["label"])) : O("", !0)
|
|
3186
|
+
], 32), m.value && p.value && !f.value ? (H(), k("div", On, [d.value.length ? (H(), D(_, {
|
|
2764
3187
|
key: 0,
|
|
2765
3188
|
class: "max-h-72 overflow-y-auto"
|
|
2766
3189
|
}, {
|
|
2767
|
-
default:
|
|
3190
|
+
default: Q(() => [(H(!0), k(C, null, re(d.value, (e, t) => (H(), D(y, {
|
|
2768
3191
|
key: t,
|
|
2769
3192
|
title: e.label,
|
|
2770
|
-
icon:
|
|
3193
|
+
icon: X(Tn)(e.type),
|
|
2771
3194
|
leading: "icon",
|
|
2772
3195
|
clickable: "",
|
|
2773
|
-
onClick: (t) =>
|
|
3196
|
+
onClick: (t) => T(e)
|
|
2774
3197
|
}, null, 8, [
|
|
2775
3198
|
"title",
|
|
2776
3199
|
"icon",
|
|
2777
3200
|
"onClick"
|
|
2778
3201
|
]))), 128))]),
|
|
2779
3202
|
_: 1
|
|
2780
|
-
})) : (
|
|
3203
|
+
})) : (H(), k("div", kn, [N(e, {
|
|
2781
3204
|
name: "search_off",
|
|
2782
3205
|
size: 28,
|
|
2783
3206
|
class: "text-on-surface-variant"
|
|
2784
|
-
}),
|
|
3207
|
+
}), A("span", An, J(X(o).noResults), 1)]))])) : O("", !0)]),
|
|
2785
3208
|
_: 1
|
|
2786
3209
|
})]),
|
|
2787
3210
|
_: 1
|
|
2788
|
-
}, 8, ["position"]), t.marker && h.value ? (
|
|
3211
|
+
}, 8, ["position"]), t.marker && h.value ? (H(), D(Me, {
|
|
2789
3212
|
key: 0,
|
|
2790
3213
|
"lng-lat": h.value.lngLat
|
|
2791
|
-
}, null, 8, ["lng-lat"])) :
|
|
3214
|
+
}, null, 8, ["lng-lat"])) : O("", !0)]));
|
|
2792
3215
|
}
|
|
2793
|
-
}),
|
|
3216
|
+
}), Mn = ["aria-label"], Nn = {
|
|
2794
3217
|
key: 0,
|
|
2795
3218
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant",
|
|
2796
3219
|
role: "status"
|
|
2797
|
-
},
|
|
3220
|
+
}, Pn = {
|
|
2798
3221
|
key: 1,
|
|
2799
3222
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant"
|
|
2800
|
-
},
|
|
3223
|
+
}, Fn = {
|
|
2801
3224
|
key: 2,
|
|
2802
3225
|
class: "flex items-center gap-3 px-4 py-3 text-body-medium text-on-surface-variant",
|
|
2803
3226
|
role: "status"
|
|
2804
|
-
},
|
|
3227
|
+
}, In = [
|
|
2805
3228
|
"id",
|
|
2806
3229
|
"aria-selected",
|
|
2807
3230
|
"onMousedown",
|
|
2808
3231
|
"onMousemove"
|
|
2809
|
-
],
|
|
3232
|
+
], Ln = { class: "flex min-w-0 flex-col" }, Rn = { class: "truncate text-body-large" }, zn = {
|
|
2810
3233
|
key: 0,
|
|
2811
3234
|
class: "truncate text-body-small text-on-surface-variant"
|
|
2812
|
-
},
|
|
3235
|
+
}, Bn = /* @__PURE__ */ P({
|
|
2813
3236
|
inheritAttrs: !1,
|
|
2814
3237
|
__name: "MAddressField",
|
|
2815
3238
|
props: {
|
|
@@ -2825,130 +3248,154 @@ var sn = {
|
|
|
2825
3248
|
debounce: { default: 400 },
|
|
2826
3249
|
minLength: { default: 3 },
|
|
2827
3250
|
hint: {},
|
|
2828
|
-
error: { type: Boolean },
|
|
3251
|
+
error: { type: [Boolean, String] },
|
|
2829
3252
|
errorLabel: {},
|
|
3253
|
+
rules: {},
|
|
3254
|
+
validateOn: {},
|
|
3255
|
+
validateDebounce: {},
|
|
3256
|
+
name: {},
|
|
2830
3257
|
required: { type: Boolean },
|
|
2831
3258
|
disabled: { type: Boolean }
|
|
2832
3259
|
},
|
|
2833
|
-
emits: [
|
|
3260
|
+
emits: [
|
|
3261
|
+
"update:modelValue",
|
|
3262
|
+
"select",
|
|
3263
|
+
"blur"
|
|
3264
|
+
],
|
|
2834
3265
|
setup(t, { expose: n, emit: r }) {
|
|
2835
|
-
let i = t, o = r, c = s(), l =
|
|
2836
|
-
|
|
2837
|
-
|
|
3266
|
+
let i = t, o = r, c = s(), l = ie(), d = `${l}-list`, f = (e) => `${l}-opt-${e}`, h = E(() => i.provider ?? Cn()), _ = G(i.modelValue?.label ?? ""), v = q([]), y = G(!1), T = G(!1), j = G(!1), P = G(!1), F = G(-1), I, L, B = G(), V = x({
|
|
3267
|
+
value: () => i.modelValue,
|
|
3268
|
+
rules: () => i.rules,
|
|
3269
|
+
required: () => i.required,
|
|
3270
|
+
error: () => i.error,
|
|
3271
|
+
errorLabel: () => i.errorLabel,
|
|
3272
|
+
name: () => i.name,
|
|
3273
|
+
validateOn: () => i.validateOn,
|
|
3274
|
+
validateDebounce: () => i.validateDebounce,
|
|
3275
|
+
disabled: () => i.disabled,
|
|
3276
|
+
focus: () => B.value?.focus(),
|
|
3277
|
+
el: () => Y.value,
|
|
3278
|
+
setValue: (e) => o("update:modelValue", e ?? null)
|
|
3279
|
+
}), W = V.disabled, K = E(() => V.message.value || V.hasError.value);
|
|
3280
|
+
U(S, null);
|
|
3281
|
+
let Y = G(), ae = G(), ce = E(() => Y.value?.firstElementChild?.firstElementChild ?? null), le = G({}), ue = E(() => _.value.trim().length >= i.minLength), de = E(() => !i.instant && j.value && ue.value && !T.value && !y.value && !i.modelValue);
|
|
3282
|
+
Z(() => i.modelValue, (e) => {
|
|
3283
|
+
e && e.label !== _.value ? _.value = e.label : !e && !j.value && (_.value = "");
|
|
2838
3284
|
});
|
|
2839
|
-
async function
|
|
3285
|
+
async function fe() {
|
|
2840
3286
|
let e = _.value.trim();
|
|
2841
3287
|
if (e.length < i.minLength) return;
|
|
2842
|
-
|
|
2843
|
-
let t =
|
|
2844
|
-
y.value = !0,
|
|
3288
|
+
I?.abort(), clearTimeout(L), I = new AbortController();
|
|
3289
|
+
let t = I;
|
|
3290
|
+
y.value = !0, P.value = !0;
|
|
2845
3291
|
try {
|
|
2846
|
-
v.value = await h.value(e, t.signal),
|
|
3292
|
+
v.value = await h.value(e, t.signal), F.value = v.value.length ? 0 : -1;
|
|
2847
3293
|
} catch {
|
|
2848
3294
|
if (t.signal.aborted) return;
|
|
2849
3295
|
v.value = [];
|
|
2850
3296
|
} finally {
|
|
2851
|
-
|
|
3297
|
+
I === t && (y.value = !1, T.value = !0);
|
|
2852
3298
|
}
|
|
2853
3299
|
}
|
|
2854
|
-
function
|
|
2855
|
-
_.value = String(e),
|
|
3300
|
+
function pe(e) {
|
|
3301
|
+
_.value = String(e), T.value = !1, v.value = [], F.value = -1, i.modelValue && o("update:modelValue", null), I?.abort(), y.value = !1, clearTimeout(L), ue.value ? (P.value = !i.instant, i.instant && (L = setTimeout(fe, i.debounce))) : P.value = !1;
|
|
2856
3302
|
}
|
|
2857
|
-
function
|
|
2858
|
-
_.value = e.label,
|
|
3303
|
+
function me(e) {
|
|
3304
|
+
_.value = e.label, P.value = !1, v.value = [], T.value = !1, o("update:modelValue", e), o("select", e);
|
|
2859
3305
|
}
|
|
2860
|
-
function
|
|
2861
|
-
|
|
3306
|
+
function he() {
|
|
3307
|
+
I?.abort(), clearTimeout(L), _.value = "", v.value = [], T.value = !1, y.value = !1, P.value = !1, i.modelValue && o("update:modelValue", null), B.value?.focus();
|
|
2862
3308
|
}
|
|
2863
|
-
function
|
|
3309
|
+
function ge(e) {
|
|
2864
3310
|
if (e.key === "Enter") {
|
|
2865
3311
|
e.preventDefault();
|
|
2866
|
-
let t = v.value[
|
|
2867
|
-
|
|
3312
|
+
let t = v.value[F.value];
|
|
3313
|
+
P.value && t && T.value ? me(t) : fe();
|
|
2868
3314
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
2869
|
-
if (!
|
|
3315
|
+
if (!P.value || !v.value.length) return;
|
|
2870
3316
|
e.preventDefault();
|
|
2871
3317
|
let t = v.value.length;
|
|
2872
|
-
|
|
3318
|
+
F.value = (F.value + (e.key === "ArrowDown" ? 1 : -1) + t) % t, ee(() => ae.value?.querySelector(`#${CSS.escape(f(F.value))}`)?.scrollIntoView({ block: "nearest" }));
|
|
2873
3319
|
}
|
|
2874
3320
|
}
|
|
2875
|
-
function
|
|
2876
|
-
|
|
3321
|
+
function _e() {
|
|
3322
|
+
j.value = !0, (T.value && v.value.length && !i.modelValue || de.value) && (P.value = !0);
|
|
2877
3323
|
}
|
|
2878
|
-
function
|
|
3324
|
+
function ve(e) {
|
|
2879
3325
|
let t = e.relatedTarget;
|
|
2880
|
-
t && (
|
|
3326
|
+
t && (Y.value?.contains(t) || ae.value?.contains(t)) || (j.value = !1, P.value = !1, V.onBlur(), o("blur"));
|
|
2881
3327
|
}
|
|
2882
|
-
m(() =>
|
|
2883
|
-
let
|
|
2884
|
-
function
|
|
2885
|
-
let e =
|
|
3328
|
+
m(() => P.value, () => P.value = !1);
|
|
3329
|
+
let ye = E(() => P.value && (y.value || T.value || de.value));
|
|
3330
|
+
function be() {
|
|
3331
|
+
let e = ce.value?.getBoundingClientRect(), t = ae.value;
|
|
2886
3332
|
if (!e || !t) return;
|
|
2887
3333
|
let n = t.offsetHeight, r = p([e.bottom + 4, e.top - 4 - n], n, window.innerHeight, 8);
|
|
2888
|
-
|
|
3334
|
+
le.value = {
|
|
2889
3335
|
top: `${r}px`,
|
|
2890
3336
|
left: `${e.left}px`,
|
|
2891
3337
|
width: `${e.width}px`
|
|
2892
3338
|
};
|
|
2893
3339
|
}
|
|
2894
|
-
|
|
2895
|
-
|
|
3340
|
+
Z([
|
|
3341
|
+
ye,
|
|
2896
3342
|
v,
|
|
2897
3343
|
y
|
|
2898
|
-
], () =>
|
|
2899
|
-
open: () =>
|
|
2900
|
-
anchor:
|
|
2901
|
-
popup:
|
|
2902
|
-
place:
|
|
2903
|
-
close: () =>
|
|
3344
|
+
], () => ee(be)), g({
|
|
3345
|
+
open: () => ye.value,
|
|
3346
|
+
anchor: ce,
|
|
3347
|
+
popup: ae,
|
|
3348
|
+
place: be,
|
|
3349
|
+
close: () => P.value = !1
|
|
2904
3350
|
}), oe(() => {
|
|
2905
|
-
let e =
|
|
2906
|
-
e && (e.setAttribute("role", "combobox"), e.setAttribute("aria-autocomplete", "list"), e.setAttribute("aria-expanded", String(
|
|
3351
|
+
let e = B.value?.inputEl;
|
|
3352
|
+
e && (e.setAttribute("role", "combobox"), e.setAttribute("aria-autocomplete", "list"), e.setAttribute("aria-expanded", String(ye.value && v.value.length > 0)), e.setAttribute("aria-controls", d), e.setAttribute("enterkeyhint", "search"), ye.value && F.value >= 0 && v.value.length ? e.setAttribute("aria-activedescendant", f(F.value)) : e.removeAttribute("aria-activedescendant"));
|
|
2907
3353
|
}), ne(() => {
|
|
2908
|
-
|
|
3354
|
+
I?.abort(), clearTimeout(L);
|
|
2909
3355
|
});
|
|
2910
|
-
function
|
|
3356
|
+
function xe(e) {
|
|
2911
3357
|
let t = e.indexOf(", ");
|
|
2912
3358
|
return t < 0 ? [e, ""] : [e.slice(0, t), e.slice(t + 2)];
|
|
2913
3359
|
}
|
|
2914
3360
|
return n({
|
|
2915
|
-
search:
|
|
2916
|
-
clear:
|
|
2917
|
-
focus: () =>
|
|
2918
|
-
|
|
3361
|
+
search: fe,
|
|
3362
|
+
clear: he,
|
|
3363
|
+
focus: () => B.value?.focus(),
|
|
3364
|
+
validate: V.validate,
|
|
3365
|
+
resetValidation: V.resetValidation
|
|
3366
|
+
}), (n, r) => (H(), k(C, null, [A("div", R({
|
|
2919
3367
|
ref_key: "wrapEl",
|
|
2920
|
-
ref:
|
|
3368
|
+
ref: Y
|
|
2921
3369
|
}, n.$attrs, {
|
|
2922
|
-
onFocusin:
|
|
2923
|
-
onFocusout:
|
|
2924
|
-
onKeydown:
|
|
2925
|
-
}), [
|
|
3370
|
+
onFocusin: _e,
|
|
3371
|
+
onFocusout: ve,
|
|
3372
|
+
onKeydown: ge
|
|
3373
|
+
}), [N(u, {
|
|
2926
3374
|
ref_key: "field",
|
|
2927
|
-
ref:
|
|
3375
|
+
ref: B,
|
|
2928
3376
|
"model-value": _.value,
|
|
2929
|
-
label: t.label ??
|
|
3377
|
+
label: t.label ?? X(c).mapAddress,
|
|
2930
3378
|
variant: t.variant,
|
|
2931
3379
|
"leading-icon": t.leadingIcon,
|
|
2932
3380
|
hint: t.hint,
|
|
2933
|
-
error:
|
|
2934
|
-
"error-label": t.errorLabel,
|
|
3381
|
+
error: K.value,
|
|
2935
3382
|
required: t.required,
|
|
2936
|
-
disabled:
|
|
3383
|
+
disabled: X(W),
|
|
2937
3384
|
autocomplete: "street-address",
|
|
2938
|
-
"onUpdate:modelValue":
|
|
3385
|
+
"onUpdate:modelValue": pe
|
|
2939
3386
|
}, {
|
|
2940
|
-
trailing:
|
|
3387
|
+
trailing: Q(() => [y.value ? (H(), D(b, {
|
|
2941
3388
|
key: 0,
|
|
2942
3389
|
size: 20,
|
|
2943
3390
|
class: "m-2"
|
|
2944
|
-
})) : _.value ? (
|
|
3391
|
+
})) : _.value ? (H(), D(a, {
|
|
2945
3392
|
key: 1,
|
|
2946
3393
|
icon: "close",
|
|
2947
|
-
label:
|
|
3394
|
+
label: X(c).clearSearch,
|
|
2948
3395
|
size: "sm",
|
|
2949
|
-
disabled:
|
|
2950
|
-
onClick:
|
|
2951
|
-
}, null, 8, ["label", "disabled"])) :
|
|
3396
|
+
disabled: X(W),
|
|
3397
|
+
onClick: he
|
|
3398
|
+
}, null, 8, ["label", "disabled"])) : O("", !0)]),
|
|
2952
3399
|
_: 1
|
|
2953
3400
|
}, 8, [
|
|
2954
3401
|
"model-value",
|
|
@@ -2957,39 +3404,38 @@ var sn = {
|
|
|
2957
3404
|
"leading-icon",
|
|
2958
3405
|
"hint",
|
|
2959
3406
|
"error",
|
|
2960
|
-
"error-label",
|
|
2961
3407
|
"required",
|
|
2962
3408
|
"disabled"
|
|
2963
|
-
])], 16), (
|
|
3409
|
+
])], 16), (H(), D(w, { to: "body" }, [ye.value ? (H(), k("div", {
|
|
2964
3410
|
key: 0,
|
|
2965
3411
|
id: d,
|
|
2966
3412
|
ref_key: "listEl",
|
|
2967
|
-
ref:
|
|
3413
|
+
ref: ae,
|
|
2968
3414
|
role: "listbox",
|
|
2969
|
-
"aria-label": t.label ??
|
|
3415
|
+
"aria-label": t.label ?? X(c).mapAddress,
|
|
2970
3416
|
class: "fixed z-500 max-h-72 overflow-auto rounded-xs bg-surface-container py-1 shadow-elevation-2",
|
|
2971
|
-
style: te(
|
|
2972
|
-
}, [y.value ? (
|
|
3417
|
+
style: te(le.value)
|
|
3418
|
+
}, [y.value ? (H(), k("div", Nn, [N(b, { size: 20 }), M(J(X(c).mapSearching), 1)])) : de.value ? (H(), k("div", Pn, [N(e, {
|
|
2973
3419
|
name: "keyboard_return",
|
|
2974
3420
|
size: 20
|
|
2975
|
-
}),
|
|
3421
|
+
}), M(J(X(c).mapPressEnterToSearch), 1)])) : v.value.length ? (H(!0), k(C, { key: 3 }, re(v.value, (t, n) => (H(), k("div", {
|
|
2976
3422
|
id: f(n),
|
|
2977
3423
|
key: n,
|
|
2978
3424
|
role: "option",
|
|
2979
|
-
"aria-selected": n ===
|
|
2980
|
-
class:
|
|
2981
|
-
onMousedown: se((e) =>
|
|
2982
|
-
onMousemove: (e) =>
|
|
2983
|
-
}, [
|
|
2984
|
-
name:
|
|
3425
|
+
"aria-selected": n === F.value,
|
|
3426
|
+
class: z(["flex cursor-pointer items-center gap-3 px-4 py-2 text-on-surface hover:bg-on-surface/8", n === F.value ? "bg-on-surface/12" : ""]),
|
|
3427
|
+
onMousedown: se((e) => me(t), ["prevent"]),
|
|
3428
|
+
onMousemove: (e) => F.value = n
|
|
3429
|
+
}, [N(e, {
|
|
3430
|
+
name: X(Tn)(t.type),
|
|
2985
3431
|
size: 20,
|
|
2986
3432
|
class: "shrink-0 text-on-surface-variant"
|
|
2987
|
-
}, null, 8, ["name"]),
|
|
3433
|
+
}, null, 8, ["name"]), A("span", Ln, [A("span", Rn, J(xe(t.label)[0]), 1), xe(t.label)[1] ? (H(), k("span", zn, J(xe(t.label)[1]), 1)) : O("", !0)])], 42, In))), 128)) : (H(), k("div", Fn, [N(e, {
|
|
2988
3434
|
name: "search_off",
|
|
2989
3435
|
size: 20
|
|
2990
|
-
}),
|
|
3436
|
+
}), M(J(X(c).mapNoPlaces), 1)]))], 12, Mn)) : O("", !0)]))], 64));
|
|
2991
3437
|
}
|
|
2992
3438
|
});
|
|
2993
|
-
export {
|
|
3439
|
+
export { Bn as MAddressField, Ee as MMap, Nt as MMapBaseLayers, Le as MMapCluster, ge as MMapControl, vn as MMapDraw, Ht as MMapFeatureInfo, Sn as MMapFilter, Fe as MMapGeoJson, on as MMapHover, Qt as MMapIdentify, kt as MMapLayers, Me as MMapMarker, fn as MMapMeasure, Pe as MMapPopup, at as MMapRoute, jn as MMapSearch, qt as fieldLabel, Jt as formatFieldValue, Gt as genericAdapter, Xt as identifyFeatures, Cn as nominatimProvider, Kt as orvianAdapter, ot as osrmRouteProvider, le as setMapWorker, pe as useMap, bn as useMapFilter, Ce as useMapLayers };
|
|
2994
3440
|
|
|
2995
3441
|
//# sourceMappingURL=map.js.map
|