ablok-components 0.3.85 → 0.3.86
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as q, shallowRef as G, ref as C, onMounted as H, markRaw as m, watch as S, computed as
|
|
1
|
+
import { defineComponent as q, shallowRef as G, ref as C, onMounted as H, markRaw as m, watch as S, computed as y, nextTick as J, openBlock as i, createElementBlock as k, renderSlot as K, toDisplayString as w, createCommentVNode as f, createElementVNode as Q, normalizeStyle as X, normalizeClass as ee, createBlock as d, resolveDynamicComponent as p, withCtx as h, Fragment as te, renderList as ae, createTextVNode as U } from "vue";
|
|
2
2
|
/* empty css */
|
|
3
3
|
const le = { class: "base-map" }, ne = {
|
|
4
4
|
key: 0,
|
|
@@ -149,29 +149,29 @@ const le = { class: "base-map" }, ne = {
|
|
|
149
149
|
url: "https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}{r}.png",
|
|
150
150
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>'
|
|
151
151
|
}
|
|
152
|
-
}, a = n,
|
|
152
|
+
}, a = n, s = $, u = G(null), L = C(null), z = C(null), R = C(a.zoom), r = C(o(a.modelValue));
|
|
153
153
|
H(async () => {
|
|
154
154
|
if (typeof window > "u")
|
|
155
155
|
return;
|
|
156
156
|
const [e, t] = await Promise.all([
|
|
157
157
|
import("@vue-leaflet/vue-leaflet"),
|
|
158
158
|
import("leaflet")
|
|
159
|
-
])
|
|
160
|
-
|
|
161
|
-
LCircle: m(
|
|
162
|
-
LMap: m(
|
|
163
|
-
LMarker: m(
|
|
164
|
-
LPopup: m(
|
|
165
|
-
LPolyline: m(
|
|
166
|
-
LTileLayer: m(
|
|
159
|
+
]);
|
|
160
|
+
u.value = m({
|
|
161
|
+
LCircle: m(e.LCircle),
|
|
162
|
+
LMap: m(e.LMap),
|
|
163
|
+
LMarker: m(e.LMarker),
|
|
164
|
+
LPopup: m(e.LPopup),
|
|
165
|
+
LPolyline: m(e.LPolyline),
|
|
166
|
+
LTileLayer: m(e.LTileLayer)
|
|
167
167
|
}), L.value = {
|
|
168
|
-
list: v("list",
|
|
169
|
-
selected: v("selected",
|
|
170
|
-
search: v("search",
|
|
171
|
-
user: v("user",
|
|
168
|
+
list: v("list", t.divIcon),
|
|
169
|
+
selected: v("selected", t.divIcon),
|
|
170
|
+
search: v("search", t.divIcon),
|
|
171
|
+
user: v("user", t.divIcon)
|
|
172
172
|
};
|
|
173
173
|
}), S(() => a.zoom, (e) => {
|
|
174
|
-
|
|
174
|
+
R.value = e;
|
|
175
175
|
}), S(() => a.modelValue, (e) => {
|
|
176
176
|
r.value = o(e);
|
|
177
177
|
}), S(() => a.center, (e) => {
|
|
@@ -194,7 +194,7 @@ const le = { class: "base-map" }, ne = {
|
|
|
194
194
|
},
|
|
195
195
|
{ flush: "post" }
|
|
196
196
|
);
|
|
197
|
-
const b =
|
|
197
|
+
const b = y(() => o(a.userLocation)), M = y(() => o(a.selectionRadiusCenter) || r.value), B = y(() => {
|
|
198
198
|
const e = (a.markers || []).map((t) => {
|
|
199
199
|
const l = o(t);
|
|
200
200
|
return l ? {
|
|
@@ -209,15 +209,15 @@ const le = { class: "base-map" }, ne = {
|
|
|
209
209
|
type: "search",
|
|
210
210
|
...r.value
|
|
211
211
|
}), e;
|
|
212
|
-
}), T =
|
|
212
|
+
}), T = y(() => (a.routeCoordinates || []).map((e) => W(e)).filter((e) => !!e)), E = y(() => {
|
|
213
213
|
const e = o(a.center) || r.value || o(a.markers[0]) || N;
|
|
214
214
|
return [e.lat, e.lng];
|
|
215
|
-
}), I =
|
|
215
|
+
}), I = y(() => {
|
|
216
216
|
if (a.tileLayerUrl.trim())
|
|
217
217
|
return a.tileLayerUrl;
|
|
218
218
|
const e = a.mapStyle === "custom" ? "streets" : a.mapStyle;
|
|
219
219
|
return x[e].url;
|
|
220
|
-
}), j =
|
|
220
|
+
}), j = y(() => {
|
|
221
221
|
if (a.tileLayerAttribution.trim())
|
|
222
222
|
return a.tileLayerAttribution;
|
|
223
223
|
const e = a.mapStyle === "custom" ? "streets" : a.mapStyle;
|
|
@@ -247,31 +247,31 @@ const le = { class: "base-map" }, ne = {
|
|
|
247
247
|
}
|
|
248
248
|
function W(e) {
|
|
249
249
|
if (Array.isArray(e)) {
|
|
250
|
-
const l = Number(e[0]),
|
|
251
|
-
return Number.isFinite(l) && Number.isFinite(
|
|
250
|
+
const l = Number(e[0]), c = Number(e[1]);
|
|
251
|
+
return Number.isFinite(l) && Number.isFinite(c) ? [l, c] : null;
|
|
252
252
|
}
|
|
253
253
|
const t = o(e);
|
|
254
254
|
return t ? [t.lat, t.lng] : null;
|
|
255
255
|
}
|
|
256
256
|
function P(e, t) {
|
|
257
|
-
const l = o(e),
|
|
258
|
-
return !l || !
|
|
257
|
+
const l = o(e), c = o(t);
|
|
258
|
+
return !l || !c ? !1 : Math.abs(l.lat - c.lat) < 1e-6 && Math.abs(l.lng - c.lng) < 1e-6;
|
|
259
259
|
}
|
|
260
260
|
async function V() {
|
|
261
|
-
await J(),
|
|
261
|
+
await J(), z.value?.invalidateSize();
|
|
262
262
|
}
|
|
263
263
|
function g(e) {
|
|
264
|
-
|
|
264
|
+
z.value?.panTo([e.lat, e.lng]);
|
|
265
265
|
}
|
|
266
266
|
function D(e) {
|
|
267
|
-
|
|
267
|
+
z.value = e, g(o(a.center) || r.value || N), V();
|
|
268
268
|
}
|
|
269
269
|
function Z(e) {
|
|
270
|
-
|
|
270
|
+
R.value = e, s("update:zoom", e);
|
|
271
271
|
}
|
|
272
272
|
function Y(e) {
|
|
273
273
|
const t = o(e);
|
|
274
|
-
t && (g(t),
|
|
274
|
+
t && (g(t), s("update:center", t));
|
|
275
275
|
}
|
|
276
276
|
function _(e) {
|
|
277
277
|
if (!a.interactive || a.disabled)
|
|
@@ -280,17 +280,17 @@ const le = { class: "base-map" }, ne = {
|
|
|
280
280
|
lat: Number(e.latlng.lat.toFixed(6)),
|
|
281
281
|
lng: Number(e.latlng.lng.toFixed(6))
|
|
282
282
|
};
|
|
283
|
-
r.value = t, g(t),
|
|
283
|
+
r.value = t, g(t), s("update:modelValue", t), s("update:center", t), s("map-click", t);
|
|
284
284
|
}
|
|
285
285
|
function F(e) {
|
|
286
286
|
r.value = {
|
|
287
287
|
lat: Number(e.lat),
|
|
288
288
|
lng: Number(e.lng)
|
|
289
|
-
}, g(r.value),
|
|
289
|
+
}, g(r.value), s("update:modelValue", r.value), s("update:center", r.value), s("marker-click", e);
|
|
290
290
|
}
|
|
291
|
-
return (e, t) => (
|
|
291
|
+
return (e, t) => (i(), k("div", le, [
|
|
292
292
|
K(e.$slots, "label", {}, () => [
|
|
293
|
-
n.label ? (
|
|
293
|
+
n.label ? (i(), k("label", ne, w(n.label), 1)) : f("", !0)
|
|
294
294
|
]),
|
|
295
295
|
Q("div", {
|
|
296
296
|
class: ee(["base-map__frame", {
|
|
@@ -300,11 +300,11 @@ const le = { class: "base-map" }, ne = {
|
|
|
300
300
|
style: X({ height: n.height }),
|
|
301
301
|
"data-testid": "base-map"
|
|
302
302
|
}, [
|
|
303
|
-
|
|
303
|
+
u.value ? (i(), d(p(u.value?.LMap), {
|
|
304
304
|
key: 0,
|
|
305
305
|
class: "base-map__canvas",
|
|
306
306
|
"use-global-leaflet": !1,
|
|
307
|
-
zoom:
|
|
307
|
+
zoom: R.value,
|
|
308
308
|
center: E.value,
|
|
309
309
|
onReady: D,
|
|
310
310
|
onClick: _,
|
|
@@ -312,46 +312,46 @@ const le = { class: "base-map" }, ne = {
|
|
|
312
312
|
"onUpdate:center": Y
|
|
313
313
|
}, {
|
|
314
314
|
default: h(() => [
|
|
315
|
-
(
|
|
315
|
+
(i(), d(p(u.value.LTileLayer), {
|
|
316
316
|
url: I.value,
|
|
317
317
|
attribution: j.value,
|
|
318
318
|
"layer-type": "base",
|
|
319
319
|
name: "OpenStreetMap"
|
|
320
320
|
}, null, 8, ["url", "attribution"])),
|
|
321
|
-
T.value.length > 1 ? (
|
|
321
|
+
T.value.length > 1 ? (i(), d(p(u.value.LPolyline), {
|
|
322
322
|
key: 0,
|
|
323
323
|
"lat-lngs": T.value,
|
|
324
324
|
color: n.routeColor,
|
|
325
325
|
weight: n.routeWeight
|
|
326
|
-
}, null, 8, ["lat-lngs", "color", "weight"])) :
|
|
327
|
-
|
|
326
|
+
}, null, 8, ["lat-lngs", "color", "weight"])) : f("", !0),
|
|
327
|
+
M.value && n.selectionRadius > 0 ? (i(), d(p(u.value.LCircle), {
|
|
328
328
|
key: 1,
|
|
329
|
-
"lat-lng": [
|
|
329
|
+
"lat-lng": [M.value.lat, M.value.lng],
|
|
330
330
|
radius: n.selectionRadius,
|
|
331
331
|
color: n.selectionRadiusColor,
|
|
332
332
|
"fill-color": n.selectionRadiusFillColor,
|
|
333
333
|
"fill-opacity": n.selectionRadiusFillOpacity,
|
|
334
334
|
opacity: n.selectionRadiusOpacity,
|
|
335
335
|
weight: n.selectionRadiusStrokeWeight
|
|
336
|
-
}, null, 8, ["lat-lng", "radius", "color", "fill-color", "fill-opacity", "opacity", "weight"])) :
|
|
337
|
-
(
|
|
338
|
-
key: l.id ?? `${l.lat}-${l.lng}-${
|
|
336
|
+
}, null, 8, ["lat-lng", "radius", "color", "fill-color", "fill-opacity", "opacity", "weight"])) : f("", !0),
|
|
337
|
+
(i(!0), k(te, null, ae(B.value, (l, c) => (i(), d(p(u.value.LMarker), {
|
|
338
|
+
key: l.id ?? `${l.lat}-${l.lng}-${c}`,
|
|
339
339
|
"lat-lng": [l.lat, l.lng],
|
|
340
340
|
icon: O(l.type),
|
|
341
341
|
"z-index-offset": A(l.type),
|
|
342
342
|
onClick: (oe) => F(l)
|
|
343
343
|
}, {
|
|
344
344
|
default: h(() => [
|
|
345
|
-
l.label ? (
|
|
345
|
+
l.label ? (i(), d(p(u.value.LPopup), { key: 0 }, {
|
|
346
346
|
default: h(() => [
|
|
347
347
|
U(w(l.label), 1)
|
|
348
348
|
]),
|
|
349
349
|
_: 2
|
|
350
|
-
}, 1024)) :
|
|
350
|
+
}, 1024)) : f("", !0)
|
|
351
351
|
]),
|
|
352
352
|
_: 2
|
|
353
353
|
}, 1032, ["lat-lng", "icon", "z-index-offset", "onClick"]))), 128)),
|
|
354
|
-
b.value ? (
|
|
354
|
+
b.value ? (i(), d(p(u.value.LMarker), {
|
|
355
355
|
key: `user-${b.value.lat}-${b.value.lng}`,
|
|
356
356
|
"lat-lng": [b.value.lat, b.value.lng],
|
|
357
357
|
icon: O("user"),
|
|
@@ -364,7 +364,7 @@ const le = { class: "base-map" }, ne = {
|
|
|
364
364
|
}))
|
|
365
365
|
}, {
|
|
366
366
|
default: h(() => [
|
|
367
|
-
(
|
|
367
|
+
(i(), d(p(u.value.LPopup), null, {
|
|
368
368
|
default: h(() => [
|
|
369
369
|
U(w(n.userLocationLabel), 1)
|
|
370
370
|
]),
|
|
@@ -372,12 +372,12 @@ const le = { class: "base-map" }, ne = {
|
|
|
372
372
|
}))
|
|
373
373
|
]),
|
|
374
374
|
_: 1
|
|
375
|
-
}, 8, ["lat-lng", "icon", "z-index-offset"])) :
|
|
375
|
+
}, 8, ["lat-lng", "icon", "z-index-offset"])) : f("", !0)
|
|
376
376
|
]),
|
|
377
377
|
_: 1
|
|
378
|
-
}, 40, ["zoom", "center"])) :
|
|
378
|
+
}, 40, ["zoom", "center"])) : f("", !0)
|
|
379
379
|
], 6),
|
|
380
|
-
n.interactive && n.helperText ? (
|
|
380
|
+
n.interactive && n.helperText ? (i(), k("p", re, w(n.helperText), 1)) : f("", !0)
|
|
381
381
|
]));
|
|
382
382
|
}
|
|
383
383
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ablok-components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.86",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite --host",
|
|
7
|
+
"story:dev": "histoire dev",
|
|
8
|
+
"story:build": "histoire build",
|
|
9
|
+
"story:preview": "histoire preview",
|
|
10
|
+
"build": "vue-tsc --noEmit --project tsconfig.build.json && vite build",
|
|
11
|
+
"build:watch": "vue-tsc --noEmit --watch --project tsconfig.build.json & vite build --watch",
|
|
12
|
+
"preview": "vite preview",
|
|
13
|
+
"build-lib-bak": "vite build && vue-tsc --emitDeclarationOnly && mv dist/src dist/types",
|
|
14
|
+
"build-lib": "vite build && vue-tsc --emitDeclarationOnly",
|
|
15
|
+
"release": "bash ./scripts/release.sh",
|
|
16
|
+
"postrelease": "bash ./scripts/publish.sh",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test:watch": "vitest",
|
|
19
|
+
"test:ui": "vitest --ui"
|
|
20
|
+
},
|
|
5
21
|
"dependencies": {
|
|
6
22
|
"date-fns": "^3.0.0",
|
|
7
23
|
"dompurify": "^3.3.1",
|
|
@@ -120,21 +136,5 @@
|
|
|
120
136
|
"./package.json": "./package.json"
|
|
121
137
|
},
|
|
122
138
|
"types": "./dist/index.d.ts",
|
|
123
|
-
"sideEffects": false
|
|
124
|
-
|
|
125
|
-
"dev": "vite --host",
|
|
126
|
-
"story:dev": "histoire dev",
|
|
127
|
-
"story:build": "histoire build",
|
|
128
|
-
"story:preview": "histoire preview",
|
|
129
|
-
"build": "vue-tsc --noEmit --project tsconfig.build.json && vite build",
|
|
130
|
-
"build:watch": "vue-tsc --noEmit --watch --project tsconfig.build.json & vite build --watch",
|
|
131
|
-
"preview": "vite preview",
|
|
132
|
-
"build-lib-bak": "vite build && vue-tsc --emitDeclarationOnly && mv dist/src dist/types",
|
|
133
|
-
"build-lib": "vite build && vue-tsc --emitDeclarationOnly",
|
|
134
|
-
"release": "bash ./scripts/release.sh",
|
|
135
|
-
"postrelease": "bash ./scripts/publish.sh",
|
|
136
|
-
"test": "vitest run",
|
|
137
|
-
"test:watch": "vitest",
|
|
138
|
-
"test:ui": "vitest --ui"
|
|
139
|
-
}
|
|
140
|
-
}
|
|
139
|
+
"sideEffects": false
|
|
140
|
+
}
|