@opengis/widgets 0.0.55 → 0.0.57
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/index.js +128 -127
- package/dist/index.umd.cjs +2 -2
- package/dist/widgets/map/MapWidget.vue.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1669,7 +1669,7 @@ function es(e) {
|
|
|
1669
1669
|
}));
|
|
1670
1670
|
}, k = (p) => {
|
|
1671
1671
|
const N = Array.isArray(p) ? p : [];
|
|
1672
|
-
r.value = N, N.some((
|
|
1672
|
+
r.value = N, N.some((q) => q.key === o.value.selectedBasemap) || (o.value.selectedBasemap = N[0]?.key ?? "");
|
|
1673
1673
|
}, w = (p) => {
|
|
1674
1674
|
p && i.value.forEach((N) => {
|
|
1675
1675
|
N.layerIds.forEach((V) => {
|
|
@@ -1685,9 +1685,9 @@ function es(e) {
|
|
|
1685
1685
|
const V = dc(N.config);
|
|
1686
1686
|
V === "vtile" ? $(p, N) : V === "raster" && U(p, N);
|
|
1687
1687
|
}, U = (p, N) => {
|
|
1688
|
-
const V = N.config,
|
|
1688
|
+
const V = N.config, q = N.sourceId, te = ds(V.url);
|
|
1689
1689
|
if (!te) return;
|
|
1690
|
-
p.getSource(
|
|
1690
|
+
p.getSource(q) || p.addSource(q, {
|
|
1691
1691
|
type: "raster",
|
|
1692
1692
|
tiles: [te],
|
|
1693
1693
|
minzoom: V.minzoom ?? 0,
|
|
@@ -1697,20 +1697,20 @@ function es(e) {
|
|
|
1697
1697
|
p.getLayer(K) || p.addLayer({
|
|
1698
1698
|
id: K,
|
|
1699
1699
|
type: "raster",
|
|
1700
|
-
source:
|
|
1700
|
+
source: q,
|
|
1701
1701
|
layout: { visibility: N.visible ? "visible" : "none" }
|
|
1702
1702
|
}), N.layerIds = [K], O(p, N);
|
|
1703
1703
|
}, $ = (p, N) => {
|
|
1704
|
-
const V = N.config,
|
|
1704
|
+
const V = N.config, q = N.sourceId, te = ds(V.url);
|
|
1705
1705
|
if (!te) return;
|
|
1706
|
-
p.getSource(
|
|
1706
|
+
p.getSource(q) || p.addSource(q, {
|
|
1707
1707
|
type: "vector",
|
|
1708
1708
|
tiles: [te],
|
|
1709
1709
|
minzoom: V.minzoom ?? 0,
|
|
1710
1710
|
maxzoom: V.maxzoom ?? 24
|
|
1711
1711
|
});
|
|
1712
1712
|
const K = V.style ?? {}, xe = pc(K), $e = [], be = { visibility: N.visible ? "visible" : "none" }, gt = fc(V), Je = {
|
|
1713
|
-
source:
|
|
1713
|
+
source: q,
|
|
1714
1714
|
layout: be
|
|
1715
1715
|
};
|
|
1716
1716
|
if (gt && (Je["source-layer"] = gt), (K.type ?? "polygon").toLowerCase() === "point") {
|
|
@@ -1773,37 +1773,37 @@ function es(e) {
|
|
|
1773
1773
|
N.layerIds = $e, O(p, N);
|
|
1774
1774
|
}, O = (p, N) => {
|
|
1775
1775
|
const V = N.visible ? "visible" : "none";
|
|
1776
|
-
N.layerIds.forEach((
|
|
1777
|
-
p.getLayer(
|
|
1776
|
+
N.layerIds.forEach((q) => {
|
|
1777
|
+
p.getLayer(q) && p.setLayoutProperty(q, "visibility", V);
|
|
1778
1778
|
});
|
|
1779
1779
|
}, B = (p) => {
|
|
1780
1780
|
const N = Array.isArray(p) ? p : [];
|
|
1781
1781
|
w(n.value ?? void 0), c.value = null, A();
|
|
1782
|
-
const V = N.map((
|
|
1783
|
-
if (!
|
|
1784
|
-
const K = ds(
|
|
1782
|
+
const V = N.map((q, te) => {
|
|
1783
|
+
if (!q) return null;
|
|
1784
|
+
const K = ds(q.url);
|
|
1785
1785
|
if (!K) return null;
|
|
1786
|
-
const xe =
|
|
1786
|
+
const xe = q.id != null ? String(q.id) : `overlay-${te}`;
|
|
1787
1787
|
return {
|
|
1788
1788
|
id: xe,
|
|
1789
|
-
config: { ...
|
|
1789
|
+
config: { ...q, id: xe, url: K },
|
|
1790
1790
|
visible: !1,
|
|
1791
1791
|
sourceId: `${xe}-source`,
|
|
1792
1792
|
layerIds: []
|
|
1793
1793
|
};
|
|
1794
|
-
}).filter((
|
|
1794
|
+
}).filter((q) => !!q);
|
|
1795
1795
|
i.value = V, x(), S();
|
|
1796
1796
|
}, D = (p, N) => {
|
|
1797
1797
|
const V = i.value.find((te) => te.id === p);
|
|
1798
1798
|
if (!V) return;
|
|
1799
1799
|
V.visible = N, x();
|
|
1800
|
-
const
|
|
1801
|
-
if (!(!
|
|
1800
|
+
const q = n.value;
|
|
1801
|
+
if (!(!q || typeof q.isStyleLoaded != "function" || !q.isStyleLoaded())) {
|
|
1802
1802
|
if (!V.layerIds.length) {
|
|
1803
|
-
E(
|
|
1803
|
+
E(q, V);
|
|
1804
1804
|
return;
|
|
1805
1805
|
}
|
|
1806
|
-
O(
|
|
1806
|
+
O(q, V);
|
|
1807
1807
|
}
|
|
1808
1808
|
}, M = () => {
|
|
1809
1809
|
a.value && (a.value.remove(), a.value = null);
|
|
@@ -1814,12 +1814,12 @@ function es(e) {
|
|
|
1814
1814
|
const N = n.value;
|
|
1815
1815
|
if (!N || !p?.point) return;
|
|
1816
1816
|
const V = N.queryRenderedFeatures(p.point);
|
|
1817
|
-
for (const
|
|
1818
|
-
const te =
|
|
1817
|
+
for (const q of V) {
|
|
1818
|
+
const te = q.layer?.id ?? q.sourceLayer;
|
|
1819
1819
|
if (!te) continue;
|
|
1820
1820
|
const K = tt(te);
|
|
1821
1821
|
if (!K) continue;
|
|
1822
|
-
const xe = y(K,
|
|
1822
|
+
const xe = y(K, q.properties ?? q.layer?.properties ?? {});
|
|
1823
1823
|
if (!xe.length) continue;
|
|
1824
1824
|
const $e = cc(xe), be = di();
|
|
1825
1825
|
if (!be) return;
|
|
@@ -1885,34 +1885,34 @@ function es(e) {
|
|
|
1885
1885
|
if (p)
|
|
1886
1886
|
return typeof p == "string" ? p : p.label ?? p.title ?? p.field ?? p.name;
|
|
1887
1887
|
}, he = (p, N) => !p || !p.length ? [] : p.map((V) => {
|
|
1888
|
-
const
|
|
1889
|
-
if (!
|
|
1890
|
-
const te = H(V), K = us(N?.[
|
|
1888
|
+
const q = _(V);
|
|
1889
|
+
if (!q) return null;
|
|
1890
|
+
const te = H(V), K = us(N?.[q]);
|
|
1891
1891
|
return !te || K === "" ? null : { label: te, value: K };
|
|
1892
1892
|
}).filter((V) => !!V), at = (p, N) => !Array.isArray(p) || !p.length ? [] : p.map((V) => {
|
|
1893
1893
|
if (!V?.name) return null;
|
|
1894
|
-
const
|
|
1895
|
-
return !
|
|
1896
|
-
}).filter((V) => !!V), Oe = (p, N) => !Array.isArray(p) || !p.length ? [] : p.map((
|
|
1897
|
-
const te = No(
|
|
1898
|
-
return te ? { label: K, url: te, target:
|
|
1899
|
-
}).filter((
|
|
1894
|
+
const q = V.title ?? V.name, te = us(N?.[V.name]);
|
|
1895
|
+
return !q || te === "" ? null : { label: q, value: te };
|
|
1896
|
+
}).filter((V) => !!V), Oe = (p, N) => !Array.isArray(p) || !p.length ? [] : p.map((q) => {
|
|
1897
|
+
const te = No(q.url, N), K = q.label ?? q.url;
|
|
1898
|
+
return te ? { label: K, url: te, target: q.target } : null;
|
|
1899
|
+
}).filter((q) => !!q), Se = async (p, N) => {
|
|
1900
1900
|
const V = No(p, N);
|
|
1901
1901
|
if (!V) return null;
|
|
1902
1902
|
try {
|
|
1903
|
-
const
|
|
1904
|
-
return
|
|
1903
|
+
const q = await fetch(V);
|
|
1904
|
+
return q.ok ? await q.json() : null;
|
|
1905
1905
|
} catch {
|
|
1906
1906
|
return null;
|
|
1907
1907
|
}
|
|
1908
1908
|
}, Be = async (p, N) => {
|
|
1909
|
-
const V = N.properties ?? N.layer?.properties ?? {},
|
|
1909
|
+
const V = N.properties ?? N.layer?.properties ?? {}, q = he(p.card?.rows, V);
|
|
1910
1910
|
let te, K;
|
|
1911
1911
|
if (p.card?.api) {
|
|
1912
1912
|
const be = await Se(p.card.api, V);
|
|
1913
1913
|
be && (typeof be.html == "string" && be.html.trim() && (te = be.html), Array.isArray(be.columns) && be.columns.length && (K = be.columns));
|
|
1914
1914
|
}
|
|
1915
|
-
let xe =
|
|
1915
|
+
let xe = q;
|
|
1916
1916
|
if (!te && K) {
|
|
1917
1917
|
const be = at(K, V);
|
|
1918
1918
|
be.length && (xe = be);
|
|
@@ -1924,14 +1924,14 @@ function es(e) {
|
|
|
1924
1924
|
const N = n.value;
|
|
1925
1925
|
if (!N || !p?.point) return;
|
|
1926
1926
|
const V = N.queryRenderedFeatures(p.point);
|
|
1927
|
-
for (const
|
|
1928
|
-
const te =
|
|
1927
|
+
for (const q of V) {
|
|
1928
|
+
const te = q.layer?.id ?? q.sourceLayer;
|
|
1929
1929
|
if (!te) continue;
|
|
1930
1930
|
const K = tt(te);
|
|
1931
1931
|
if (!K || !K.card) continue;
|
|
1932
|
-
const xe = await Be(K,
|
|
1932
|
+
const xe = await Be(K, q);
|
|
1933
1933
|
if (xe) {
|
|
1934
|
-
c.value = xe, X(
|
|
1934
|
+
c.value = xe, X(q);
|
|
1935
1935
|
return;
|
|
1936
1936
|
}
|
|
1937
1937
|
}
|
|
@@ -1958,10 +1958,10 @@ function es(e) {
|
|
|
1958
1958
|
...e.mapOptions
|
|
1959
1959
|
};
|
|
1960
1960
|
n.value = new p.Map(V);
|
|
1961
|
-
const
|
|
1961
|
+
const q = () => {
|
|
1962
1962
|
S();
|
|
1963
1963
|
};
|
|
1964
|
-
d =
|
|
1964
|
+
d = q, n.value.on("style.load", q), n.value.on("load", () => {
|
|
1965
1965
|
s.value = !0, m && n.value && (n.value.setStyle(m), m = null), S(), ct();
|
|
1966
1966
|
});
|
|
1967
1967
|
}), It(() => {
|
|
@@ -2249,23 +2249,23 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2249
2249
|
console.log(p);
|
|
2250
2250
|
const N = p.slice(0, 2).map(Number);
|
|
2251
2251
|
if (console.log(N), !N.every((be) => Number.isFinite(be))) return null;
|
|
2252
|
-
let [V,
|
|
2252
|
+
let [V, q] = N, te = V, K = q;
|
|
2253
2253
|
const xe = (be) => Math.abs(be) <= 90, $e = (be) => Math.abs(be) <= 180;
|
|
2254
2254
|
if (!xe(te) || !$e(K))
|
|
2255
2255
|
if (xe(K) && $e(te))
|
|
2256
|
-
te = V, K =
|
|
2256
|
+
te = V, K = q;
|
|
2257
2257
|
else
|
|
2258
2258
|
return null;
|
|
2259
2259
|
return console.log(te, K), { lat: te, lng: K };
|
|
2260
2260
|
}
|
|
2261
2261
|
function at(G) {
|
|
2262
2262
|
return (G?.items || []).map((p, N) => {
|
|
2263
|
-
const V = Number(p?.position?.lat),
|
|
2264
|
-
return !Number.isFinite(V) || !Number.isFinite(
|
|
2263
|
+
const V = Number(p?.position?.lat), q = Number(p?.position?.lng);
|
|
2264
|
+
return !Number.isFinite(V) || !Number.isFinite(q) ? null : {
|
|
2265
2265
|
id: String(p?.id ?? N),
|
|
2266
2266
|
title: p?.title || p?.address?.label || "Знайдений обʼєкт",
|
|
2267
2267
|
lat: V,
|
|
2268
|
-
lng:
|
|
2268
|
+
lng: q
|
|
2269
2269
|
};
|
|
2270
2270
|
}).filter((p) => !!p);
|
|
2271
2271
|
}
|
|
@@ -2286,10 +2286,10 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2286
2286
|
}
|
|
2287
2287
|
function Se(G) {
|
|
2288
2288
|
return (Array.isArray(G?.features) ? G.features : []).map((p, N) => {
|
|
2289
|
-
const V = p?.geometry?.coordinates,
|
|
2290
|
-
if (!Number.isFinite(
|
|
2289
|
+
const V = p?.geometry?.coordinates, q = Number(V?.[0]), te = Number(V?.[1]);
|
|
2290
|
+
if (!Number.isFinite(q) || !Number.isFinite(te)) return null;
|
|
2291
2291
|
const K = p?.properties || {}, xe = K?.geocoding?.label || K?.display_name || K?.label || "Адреса";
|
|
2292
|
-
return { id: String(K?.geocoding?.place_id || K?.place_id || N), title: xe, lat:
|
|
2292
|
+
return { id: String(K?.geocoding?.place_id || K?.place_id || N), title: xe, lat: q, lng: te };
|
|
2293
2293
|
}).filter((p) => !!p);
|
|
2294
2294
|
}
|
|
2295
2295
|
async function Be(G) {
|
|
@@ -2300,12 +2300,12 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2300
2300
|
p && J.searchParams.set("viewbox", p);
|
|
2301
2301
|
const N = await fetch(J.toString());
|
|
2302
2302
|
if (!N.ok) throw new Error(`HTTP ${N.status}`);
|
|
2303
|
-
const V = await N.json(),
|
|
2304
|
-
if (!
|
|
2303
|
+
const V = await N.json(), q = Se(V);
|
|
2304
|
+
if (!q.length) {
|
|
2305
2305
|
pt({ type: "warning", title: "Пошук адреси", message: "Не знайдено результатів" });
|
|
2306
2306
|
return;
|
|
2307
2307
|
}
|
|
2308
|
-
w.value =
|
|
2308
|
+
w.value = q;
|
|
2309
2309
|
}
|
|
2310
2310
|
function lt(G) {
|
|
2311
2311
|
ut(G), w.value = [], m.value = "";
|
|
@@ -2314,7 +2314,7 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2314
2314
|
const p = G.replace(/\s+/g, "").split(":");
|
|
2315
2315
|
if (p.length !== 4) return !1;
|
|
2316
2316
|
const N = [10, 2, 3, 4];
|
|
2317
|
-
return p.every((V,
|
|
2317
|
+
return p.every((V, q) => V.length === N[q] && /^\d+$/.test(V));
|
|
2318
2318
|
}
|
|
2319
2319
|
function ut(G) {
|
|
2320
2320
|
const J = t.config?.zoom ?? 17;
|
|
@@ -2358,8 +2358,8 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2358
2358
|
if (!V.length)
|
|
2359
2359
|
pt({ type: "warning", title: "Пошук", message: "Не знайдено результатів" });
|
|
2360
2360
|
else {
|
|
2361
|
-
const
|
|
2362
|
-
ut(
|
|
2361
|
+
const q = V[0];
|
|
2362
|
+
ut(q), c.value === "parcel" && $ && ($.value = ""), m.value = "";
|
|
2363
2363
|
}
|
|
2364
2364
|
} catch (J) {
|
|
2365
2365
|
const p = J?.message || "Помилка пошуку";
|
|
@@ -2645,13 +2645,13 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2645
2645
|
function i(h) {
|
|
2646
2646
|
if (h) {
|
|
2647
2647
|
if (Array.isArray(h) && h.length >= 2) {
|
|
2648
|
-
const R = Number(h[0]),
|
|
2649
|
-
return !Number.isFinite(R) || !Number.isFinite(
|
|
2648
|
+
const R = Number(h[0]), W = Number(h[1]);
|
|
2649
|
+
return !Number.isFinite(R) || !Number.isFinite(W) ? void 0 : [R, W];
|
|
2650
2650
|
}
|
|
2651
2651
|
if (typeof h == "object") {
|
|
2652
|
-
const R = h,
|
|
2653
|
-
if (
|
|
2654
|
-
const Ve = Number(
|
|
2652
|
+
const R = h, W = R.lng ?? R.lon ?? R.long ?? R.x, se = R.lat ?? R.y;
|
|
2653
|
+
if (W != null && se != null) {
|
|
2654
|
+
const Ve = Number(W), ft = Number(se);
|
|
2655
2655
|
if (Number.isFinite(Ve) && Number.isFinite(ft))
|
|
2656
2656
|
return [Ve, ft];
|
|
2657
2657
|
}
|
|
@@ -2663,14 +2663,14 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2663
2663
|
const R = Number(h);
|
|
2664
2664
|
return Number.isFinite(R) ? R : void 0;
|
|
2665
2665
|
}
|
|
2666
|
-
const l = Y(() => t.katottg != null ? t.katottg : r.katottg), c = Y(() => (Array.isArray(r.basemaps) && r.basemaps.length ? r.basemaps : n).map((
|
|
2667
|
-
const Ve = typeof
|
|
2666
|
+
const l = Y(() => t.katottg != null ? t.katottg : r.katottg), c = Y(() => (Array.isArray(r.basemaps) && r.basemaps.length ? r.basemaps : n).map((W, se) => {
|
|
2667
|
+
const Ve = typeof W.url == "string" ? W.url.trim() : "";
|
|
2668
2668
|
return Ve ? {
|
|
2669
|
-
key: (
|
|
2669
|
+
key: (W.key ?? W.name ?? `base-${se}`).trim() || `base-${se}`,
|
|
2670
2670
|
url: Ve,
|
|
2671
|
-
name:
|
|
2671
|
+
name: W.name ?? W.key ?? `Layer ${se + 1}`
|
|
2672
2672
|
} : null;
|
|
2673
|
-
}).filter((
|
|
2673
|
+
}).filter((W) => !!W)), m = i(r.center), d = a(r.zoom), v = as(t.geom), x = bo(v), k = x ? [
|
|
2674
2674
|
(x[0] + x[2]) / 2,
|
|
2675
2675
|
(x[1] + x[3]) / 2
|
|
2676
2676
|
] : void 0, w = P(null), S = Y(() => i(t.center) ?? null), E = Y(() => S.value ?? m ?? null), U = es({
|
|
@@ -2702,7 +2702,7 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2702
2702
|
}), _ = Y(() => {
|
|
2703
2703
|
const h = t.height;
|
|
2704
2704
|
return { height: typeof h == "number" ? `${h}px` : String(h) };
|
|
2705
|
-
}), H = P(!1), he = P(!1), at = Y(() => H.value ? "fixed inset-0 w-screen h-screen z-[9999] bg-white" : "relative w-full"), Oe = Y(() => {
|
|
2705
|
+
}), H = P(!1), he = P(!1), at = Y(() => H.value ? "!fixed inset-0 w-screen h-screen z-[9999] bg-white" : "relative w-full"), Oe = Y(() => {
|
|
2706
2706
|
const h = ["w-full", "h-full"];
|
|
2707
2707
|
return H.value || h.push(`min-h-[${_.value.height}]`), h.join(" ");
|
|
2708
2708
|
}), Se = Y(() => y.value), Be = () => j?.(), lt = P(k ?? E.value ?? null), ct = P(t.zoom ?? d ?? null), ut = P(E.value);
|
|
@@ -2719,22 +2719,22 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2719
2719
|
([h, R]) => {
|
|
2720
2720
|
if (!(!h || !R)) {
|
|
2721
2721
|
if (!lt.value) {
|
|
2722
|
-
const
|
|
2723
|
-
lt.value = [
|
|
2722
|
+
const W = h.getCenter();
|
|
2723
|
+
lt.value = [W.lng, W.lat];
|
|
2724
2724
|
}
|
|
2725
2725
|
ct.value == null && (ct.value = h.getZoom());
|
|
2726
2726
|
}
|
|
2727
2727
|
},
|
|
2728
2728
|
{ immediate: !0 }
|
|
2729
2729
|
);
|
|
2730
|
-
const V = P(null),
|
|
2730
|
+
const V = P(null), q = P(""), te = P(null), K = (h) => h ? he.value ? !0 : typeof h.isStyleLoaded == "function" && h.isStyleLoaded() ? (he.value = !0, !0) : !1 : !1, xe = (h) => {
|
|
2731
2731
|
if (!h) return "";
|
|
2732
|
-
const R = Number(h.lat ?? h[1]),
|
|
2733
|
-
return !Number.isFinite(R) || !Number.isFinite(
|
|
2732
|
+
const R = Number(h.lat ?? h[1]), W = Number(h.lng ?? h[0]);
|
|
2733
|
+
return !Number.isFinite(R) || !Number.isFinite(W) ? "" : `${W.toFixed(5)}, ${R.toFixed(5)}`;
|
|
2734
2734
|
}, $e = (h) => {
|
|
2735
|
-
h?.lngLat && (
|
|
2735
|
+
h?.lngLat && (q.value = xe(h.lngLat));
|
|
2736
2736
|
}, be = () => {
|
|
2737
|
-
|
|
2737
|
+
q.value = "";
|
|
2738
2738
|
}, gt = (h) => {
|
|
2739
2739
|
h && (h.on("mousemove", $e), h.on("mouseleave", be), te.value = h);
|
|
2740
2740
|
}, Je = (h) => {
|
|
@@ -2742,22 +2742,22 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2742
2742
|
}, Nn = Y(() => N("scale"));
|
|
2743
2743
|
me(
|
|
2744
2744
|
[$, X],
|
|
2745
|
-
([h, R], [
|
|
2746
|
-
|
|
2745
|
+
([h, R], [W]) => {
|
|
2746
|
+
W && Je(W), !(!h || !R) && gt(h);
|
|
2747
2747
|
},
|
|
2748
2748
|
{ immediate: !0 }
|
|
2749
2749
|
), me(
|
|
2750
2750
|
[$, X, Nn],
|
|
2751
|
-
([h, R,
|
|
2752
|
-
if (V.value && Z && (Z(V.value), V.value = null), !h || !R || !
|
|
2751
|
+
([h, R, W]) => {
|
|
2752
|
+
if (V.value && Z && (Z(V.value), V.value = null), !h || !R || !W) return;
|
|
2753
2753
|
const se = window?.maplibregl;
|
|
2754
2754
|
se && (V.value = new se.ScaleControl({ unit: "metric" }), z?.(V.value, "bottom-left"));
|
|
2755
2755
|
},
|
|
2756
2756
|
{ immediate: !0 }
|
|
2757
2757
|
);
|
|
2758
2758
|
const nt = Y(() => Array.isArray(t.legend) ? t.legend.map((h, R) => {
|
|
2759
|
-
const
|
|
2760
|
-
return !
|
|
2759
|
+
const W = typeof h?.color == "string" ? h.color.trim() : "", se = typeof h?.label == "string" ? h.label.trim() : "";
|
|
2760
|
+
return !W || !se ? null : { color: W, label: se, key: `${se}-${R}` };
|
|
2761
2761
|
}).filter((h) => !!h) : []), st = Y(() => Array.isArray(t.layers) && t.layers.length ? t.layers : Array.isArray(r.layers) && r.layers.length ? r.layers : []);
|
|
2762
2762
|
me(
|
|
2763
2763
|
c,
|
|
@@ -2781,13 +2781,13 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2781
2781
|
return Ve ? `${Ve}/${ft}` : ft ? `/${ft}` : "";
|
|
2782
2782
|
}, Kt = (h) => {
|
|
2783
2783
|
if (!h?.getStyle) return;
|
|
2784
|
-
const R = h.getStyle() ?? {},
|
|
2785
|
-
return
|
|
2784
|
+
const R = h.getStyle() ?? {}, W = Array.isArray(R.layers) ? R.layers : [];
|
|
2785
|
+
return W.length ? W.find((Ve) => Ve.type !== "background")?.id ?? W[0]?.id : void 0;
|
|
2786
2786
|
}, Gt = (h) => {
|
|
2787
2787
|
h && (h.getLayer(fs) && h.removeLayer(fs), h.getSource(An) && h.removeSource(An));
|
|
2788
2788
|
}, Mt = (h, R) => {
|
|
2789
2789
|
if (!h) return;
|
|
2790
|
-
const
|
|
2790
|
+
const W = Kt(h);
|
|
2791
2791
|
h.addSource(An, {
|
|
2792
2792
|
type: "raster",
|
|
2793
2793
|
tiles: [R],
|
|
@@ -2799,7 +2799,7 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2799
2799
|
source: An,
|
|
2800
2800
|
layout: { visibility: "visible" }
|
|
2801
2801
|
},
|
|
2802
|
-
|
|
2802
|
+
W
|
|
2803
2803
|
);
|
|
2804
2804
|
}, Zt = (h) => {
|
|
2805
2805
|
if (!h) return;
|
|
@@ -2818,16 +2818,17 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2818
2818
|
h.once("style.load", R), h.once("styledata", R);
|
|
2819
2819
|
}, Dt = () => {
|
|
2820
2820
|
const h = $.value, R = dt.value;
|
|
2821
|
-
if (!R || !h)
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2821
|
+
if (!(!R || !h)) {
|
|
2822
|
+
if (!K(h)) {
|
|
2823
|
+
os(h);
|
|
2824
|
+
return;
|
|
2825
|
+
}
|
|
2826
|
+
Gt(h), Mt(h, R);
|
|
2825
2827
|
}
|
|
2826
|
-
Gt(h), Mt(h, R);
|
|
2827
2828
|
}, b = () => {
|
|
2828
2829
|
const h = A.value;
|
|
2829
2830
|
if (!h) return;
|
|
2830
|
-
const R = c.value.find((
|
|
2831
|
+
const R = c.value.find((W) => W.key === h);
|
|
2831
2832
|
R && Zt(R);
|
|
2832
2833
|
};
|
|
2833
2834
|
me(
|
|
@@ -2867,8 +2868,8 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2867
2868
|
"line-dasharray": [6, 4]
|
|
2868
2869
|
}, fe = P(v), Ce = P(x), Ye = P(!1), ye = Y(() => {
|
|
2869
2870
|
if (!Ce.value) return null;
|
|
2870
|
-
const [h, R,
|
|
2871
|
-
return [(h +
|
|
2871
|
+
const [h, R, W, se] = Ce.value;
|
|
2872
|
+
return [(h + W) / 2, (R + se) / 2];
|
|
2872
2873
|
}), Jt = Y(() => !!Ce.value), Ie = P(!!x);
|
|
2873
2874
|
P(!1);
|
|
2874
2875
|
const kt = () => {
|
|
@@ -2881,8 +2882,8 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2881
2882
|
Vt(h);
|
|
2882
2883
|
return;
|
|
2883
2884
|
}
|
|
2884
|
-
let
|
|
2885
|
-
|
|
2885
|
+
let W = h.getSource(Et);
|
|
2886
|
+
W ? W.setData(R) : (h.addSource(Et, { type: "geojson", data: R }), is(h), W = h.getSource(Et)), go(h, F.value ? "visible" : "none"), sr(), vo(), Ce.value && (!Ie.value && (Ye.value || !yt.value) ? (h.fitBounds(
|
|
2886
2887
|
Ce.value,
|
|
2887
2888
|
{ padding: 40, maxZoom: 16, duration: 0 }
|
|
2888
2889
|
), yt.value = !0, Ye.value = !1) : Ie.value && (Ie.value = !1, Ye.value = !1, yt.value = !0));
|
|
@@ -2910,19 +2911,19 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2910
2911
|
h.getLayer(R) && h.removeLayer(R);
|
|
2911
2912
|
}), h.getSource(Et) && h.removeSource(Et);
|
|
2912
2913
|
}, go = (h, R) => {
|
|
2913
|
-
K(h) && [en, Qt, Xt].forEach((
|
|
2914
|
-
h.getLayer(
|
|
2914
|
+
K(h) && [en, Qt, Xt].forEach((W) => {
|
|
2915
|
+
h.getLayer(W) && h.setLayoutProperty(W, "visibility", R);
|
|
2915
2916
|
});
|
|
2916
2917
|
}, sr = () => {
|
|
2917
2918
|
const h = $.value;
|
|
2918
2919
|
if (!h || !K(h)) return;
|
|
2919
2920
|
const R = oe;
|
|
2920
|
-
h.getLayer(Xt) && Object.entries(R.fill).forEach(([
|
|
2921
|
-
h.setPaintProperty(Xt,
|
|
2922
|
-
}), h.getLayer(Qt) && Object.entries(R.line).forEach(([
|
|
2923
|
-
h.setPaintProperty(Qt,
|
|
2924
|
-
}), h.getLayer(en) && Object.entries(R.circle).forEach(([
|
|
2925
|
-
h.setPaintProperty(en,
|
|
2921
|
+
h.getLayer(Xt) && Object.entries(R.fill).forEach(([W, se]) => {
|
|
2922
|
+
h.setPaintProperty(Xt, W, se);
|
|
2923
|
+
}), h.getLayer(Qt) && Object.entries(R.line).forEach(([W, se]) => {
|
|
2924
|
+
h.setPaintProperty(Qt, W, se);
|
|
2925
|
+
}), h.getLayer(en) && Object.entries(R.circle).forEach(([W, se]) => {
|
|
2926
|
+
h.setPaintProperty(en, W, se);
|
|
2926
2927
|
});
|
|
2927
2928
|
}, yo = (h) => {
|
|
2928
2929
|
h.getLayer(In) || h.addLayer({
|
|
@@ -2940,28 +2941,28 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
2940
2941
|
h.addSource(Yt, { type: "geojson", data: R }), yo(h);
|
|
2941
2942
|
return;
|
|
2942
2943
|
}
|
|
2943
|
-
const
|
|
2944
|
-
|
|
2944
|
+
const W = h.getSource(Yt);
|
|
2945
|
+
W && typeof W.setData == "function" && W.setData(R), yo(h);
|
|
2945
2946
|
}, or = (h) => {
|
|
2946
2947
|
h.getLayer(In) && h.removeLayer(In), h.getSource(Yt) && h.removeSource(Yt);
|
|
2947
2948
|
}, ir = async (h) => {
|
|
2948
|
-
const R = typeof h == "string" ? h.trim() : "",
|
|
2949
|
+
const R = typeof h == "string" ? h.trim() : "", W = ++C;
|
|
2949
2950
|
if (!R) {
|
|
2950
2951
|
I.value = null;
|
|
2951
2952
|
return;
|
|
2952
2953
|
}
|
|
2953
2954
|
try {
|
|
2954
2955
|
const se = await fetch(`https://data.gki.com.ua/api-user/atu/${R}`);
|
|
2955
|
-
if (C !==
|
|
2956
|
+
if (C !== W) return;
|
|
2956
2957
|
if (!se.ok) {
|
|
2957
2958
|
I.value = null;
|
|
2958
2959
|
return;
|
|
2959
2960
|
}
|
|
2960
2961
|
const Ve = await se.json();
|
|
2961
|
-
if (C !==
|
|
2962
|
+
if (C !== W) return;
|
|
2962
2963
|
I.value = Ve;
|
|
2963
2964
|
} catch {
|
|
2964
|
-
if (C !==
|
|
2965
|
+
if (C !== W) return;
|
|
2965
2966
|
I.value = null;
|
|
2966
2967
|
}
|
|
2967
2968
|
};
|
|
@@ -3029,22 +3030,22 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
3029
3030
|
const R = h.geometry ?? h;
|
|
3030
3031
|
if (!R?.type) return null;
|
|
3031
3032
|
if (R.type === "GeometryCollection" && Array.isArray(R.geometries)) {
|
|
3032
|
-
const
|
|
3033
|
-
return
|
|
3033
|
+
const W = R.geometries.filter((se) => se && typeof se.type == "string").map((se) => ({ type: "Feature", geometry: se }));
|
|
3034
|
+
return W.length ? { type: "FeatureCollection", features: W } : null;
|
|
3034
3035
|
}
|
|
3035
3036
|
if (R.type === "MultiPoint" && Array.isArray(R.coordinates)) {
|
|
3036
|
-
const
|
|
3037
|
-
return
|
|
3037
|
+
const W = R.coordinates.filter((se) => Array.isArray(se) && se.length >= 2).map((se) => ({ type: "Feature", geometry: { type: "Point", coordinates: se } }));
|
|
3038
|
+
return W.length ? { type: "FeatureCollection", features: W } : null;
|
|
3038
3039
|
}
|
|
3039
3040
|
return { type: "FeatureCollection", features: [{ type: "Feature", geometry: R }] };
|
|
3040
3041
|
}
|
|
3041
3042
|
function bo(h) {
|
|
3042
3043
|
if (!h?.features?.length) return null;
|
|
3043
|
-
let R = 1 / 0,
|
|
3044
|
+
let R = 1 / 0, W = 1 / 0, se = -1 / 0, Ve = -1 / 0;
|
|
3044
3045
|
const ft = (fn) => {
|
|
3045
3046
|
if (typeof fn[0] == "number") {
|
|
3046
3047
|
const [Pt, wo] = fn;
|
|
3047
|
-
R = Math.min(R, Pt),
|
|
3048
|
+
R = Math.min(R, Pt), W = Math.min(W, wo), se = Math.max(se, Pt), Ve = Math.max(Ve, wo);
|
|
3048
3049
|
return;
|
|
3049
3050
|
}
|
|
3050
3051
|
fn.forEach((Pt) => ft(Pt));
|
|
@@ -3052,7 +3053,7 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
3052
3053
|
return h.features.forEach((fn) => {
|
|
3053
3054
|
const Pt = fn?.geometry?.coordinates;
|
|
3054
3055
|
Pt && ft(Pt);
|
|
3055
|
-
}), R === 1 / 0 ||
|
|
3056
|
+
}), R === 1 / 0 || W === 1 / 0 ? null : [R, W, se, Ve];
|
|
3056
3057
|
}
|
|
3057
3058
|
return (h, R) => (f(), g("div", {
|
|
3058
3059
|
class: ne(at.value),
|
|
@@ -3117,29 +3118,29 @@ const vc = { class: "map-base-layer-menu" }, bc = {
|
|
|
3117
3118
|
class: ne(["text-[0.75rem] text-slate-700 leading-relaxed overflow-auto", `max-h-[calc(${_.value.height}-120px)]`]),
|
|
3118
3119
|
innerHTML: Se.value.html
|
|
3119
3120
|
}, null, 10, ru)) : (f(), g("div", au, [
|
|
3120
|
-
(f(!0), g(re, null, le(Se.value.rows, (
|
|
3121
|
-
key:
|
|
3121
|
+
(f(!0), g(re, null, le(Se.value.rows, (W) => (f(), g("div", {
|
|
3122
|
+
key: W.label,
|
|
3122
3123
|
class: "flex justify-between text-[0.85rem] text-slate-700"
|
|
3123
3124
|
}, [
|
|
3124
|
-
u("span", lu, ee(
|
|
3125
|
-
u("span", cu, ee(
|
|
3125
|
+
u("span", lu, ee(W.label) + ":", 1),
|
|
3126
|
+
u("span", cu, ee(W.value), 1)
|
|
3126
3127
|
]))), 128))
|
|
3127
3128
|
])),
|
|
3128
3129
|
Se.value.actions?.length ? (f(), g("div", uu, [
|
|
3129
|
-
(f(!0), g(re, null, le(Se.value.actions, (
|
|
3130
|
-
key:
|
|
3130
|
+
(f(!0), g(re, null, le(Se.value.actions, (W) => (f(), g("a", {
|
|
3131
|
+
key: W.url,
|
|
3131
3132
|
class: "bg-sky-600 hover:bg-sky-700 transition-colors text-white font-semibold text-center py-[0.55rem] rounded-md w-full",
|
|
3132
|
-
href:
|
|
3133
|
-
target:
|
|
3133
|
+
href: W.url,
|
|
3134
|
+
target: W.target ?? void 0,
|
|
3134
3135
|
rel: "noreferrer"
|
|
3135
|
-
}, ee(
|
|
3136
|
+
}, ee(W.label), 9, du))), 128))
|
|
3136
3137
|
])) : Q("", !0)
|
|
3137
3138
|
])) : Q("", !0),
|
|
3138
3139
|
ce(Ac),
|
|
3139
|
-
N("position") &&
|
|
3140
|
+
N("position") && q.value ? (f(), ge(Vc, {
|
|
3140
3141
|
key: 3,
|
|
3141
3142
|
class: "absolute bottom-[10px] right-[10px] z-[500]",
|
|
3142
|
-
coordinates:
|
|
3143
|
+
coordinates: q.value
|
|
3143
3144
|
}, null, 8, ["coordinates"])) : Q("", !0)
|
|
3144
3145
|
], 6));
|
|
3145
3146
|
}
|
|
@@ -7827,7 +7828,7 @@ const rp = {
|
|
|
7827
7828
|
const I = k.value || "id";
|
|
7828
7829
|
return !!(b?.token || b?.[I] || b?.id);
|
|
7829
7830
|
}
|
|
7830
|
-
function
|
|
7831
|
+
function q(b) {
|
|
7831
7832
|
return U.value === tt(b);
|
|
7832
7833
|
}
|
|
7833
7834
|
function te(b) {
|
|
@@ -8151,7 +8152,7 @@ const rp = {
|
|
|
8151
8152
|
ce(op, {
|
|
8152
8153
|
row: C,
|
|
8153
8154
|
actions: F.value,
|
|
8154
|
-
"is-open":
|
|
8155
|
+
"is-open": q(C),
|
|
8155
8156
|
"action-key": tt(C),
|
|
8156
8157
|
onToggle: (T) => te(C)
|
|
8157
8158
|
}, null, 8, ["row", "actions", "is-open", "action-key", "onToggle"])
|