@opengis/gis 0.2.129 → 0.2.130
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/{CardIcon-DgpYeKbG.js → CardIcon-BeZkp0PF.js} +1 -1
- package/dist/{EntityTablePage-DNdVavT4.js → EntityTablePage-A1oEJgB4.js} +1 -1
- package/dist/{ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-DQnIBCpE.js → ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-Wr8oJ-ni.js} +24 -22
- package/dist/{HeaderActions.vue_vue_type_script_setup_true_lang-Cg2y4sIa.js → HeaderActions.vue_vue_type_script_setup_true_lang-6BnXldBs.js} +345 -321
- package/dist/{MapSettings-CHF3VpUu.js → MapSettings-EmXkXJ90.js} +12 -12
- package/dist/{RastersTablePage-Ci3P3r4c.js → RastersTablePage-Cgecxbky.js} +1 -1
- package/dist/cartocss-C29B9mz3.js +1024 -0
- package/dist/{import-utils-ElncWVJV.js → import-utils-CFjQD50e.js} +1 -1
- package/dist/{index-UGx54M0Q.js → index-1vaLWtnh.js} +377 -386
- package/dist/index.css +1 -1
- package/dist/index.js +4 -4
- package/dist/index.umd.cjs +41 -41
- package/dist/raster-DFuH49fc.js +792 -0
- package/dist/{register-BfNUPbey.js → register-COO0Y_MS.js} +3 -3
- package/dist/{service-DsykdHry.js → service-DagZaIev.js} +911 -879
- package/dist/{vs-datatable-D6g7tjZo.js → vs-datatable-BaMRTZVi.js} +1 -1
- package/package.json +2 -2
- package/server/routes/gis/cartocss/get.cartocss.js +11 -2
- package/server/routes/gis/registers/add.registry.js +3 -4
- package/server/routes/gis/registers/funcs/columns.js +2 -4
- package/server/routes/mapnik/controllers/pretile.js +7 -9
- package/server/routes/mapnik/functions/cartoBounds.js +6 -2
- package/dist/cartocss-BsaIlSRb.js +0 -894
- package/dist/raster-BDWEafwx.js +0 -663
|
@@ -0,0 +1,1024 @@
|
|
|
1
|
+
import { openBlock as w, createElementBlock as z, createElementVNode as o, defineComponent as W, computed as M, createTextVNode as Le, createVNode as E, mergeModels as Ye, defineAsyncComponent as me, useModel as Ge, ref as b, withCtx as G, toDisplayString as U, unref as le, watch as T, onUnmounted as We, createCommentVNode as B, onBeforeUnmount as Me, onMounted as Xe, withDirectives as Ze, vModelText as Ke, createBlock as P, normalizeClass as ke, normalizeStyle as et, Fragment as Ce, renderList as tt, resolveDynamicComponent as at } from "vue";
|
|
2
|
+
import { useRouter as ot, useRoute as nt } from "vue-router";
|
|
3
|
+
import { notify as D } from "@opengis/core";
|
|
4
|
+
import { _ as st, f as ze, o as lt, p as rt, q as ut, M as it, i as ct, j as Se, m as dt } from "./index-1vaLWtnh.js";
|
|
5
|
+
import { S as ft, C as mt } from "./CardIcon-BeZkp0PF.js";
|
|
6
|
+
import { _ as pt, a as yt, b as vt, c as ht } from "./HeaderActions.vue_vue_type_script_setup_true_lang-6BnXldBs.js";
|
|
7
|
+
import { _ as Ee } from "./MonacoEditor.vue_vue_type_script_setup_true_lang-D3ZPeXMw.js";
|
|
8
|
+
import { V as gt } from "./vs-datatable-BaMRTZVi.js";
|
|
9
|
+
import { _ as $e } from "./ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-Wr8oJ-ni.js";
|
|
10
|
+
const bt = {}, xt = {
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
width: "24",
|
|
13
|
+
height: "24",
|
|
14
|
+
viewBox: "0 0 24 24",
|
|
15
|
+
fill: "none",
|
|
16
|
+
stroke: "currentColor",
|
|
17
|
+
"stroke-width": "2",
|
|
18
|
+
"stroke-linecap": "round",
|
|
19
|
+
"stroke-linejoin": "round",
|
|
20
|
+
class: "lucide lucide-table"
|
|
21
|
+
};
|
|
22
|
+
function wt(A, u) {
|
|
23
|
+
return w(), z("svg", xt, [...u[0] || (u[0] = [
|
|
24
|
+
o("path", { d: "M12 3v18" }, null, -1),
|
|
25
|
+
o("rect", {
|
|
26
|
+
width: "18",
|
|
27
|
+
height: "18",
|
|
28
|
+
x: "3",
|
|
29
|
+
y: "3",
|
|
30
|
+
rx: "2"
|
|
31
|
+
}, null, -1),
|
|
32
|
+
o("path", { d: "M3 9h18" }, null, -1),
|
|
33
|
+
o("path", { d: "M3 15h18" }, null, -1)
|
|
34
|
+
])]);
|
|
35
|
+
}
|
|
36
|
+
const _t = /* @__PURE__ */ st(bt, [["render", wt]]), kt = { class: "flex flex-col h-full" }, Ct = { class: "flex justify-end mb-3 gap-2" }, St = /* @__PURE__ */ W({
|
|
37
|
+
__name: "cartocss-css-tab",
|
|
38
|
+
props: {
|
|
39
|
+
modelValue: {}
|
|
40
|
+
},
|
|
41
|
+
emits: ["update:modelValue", "save"],
|
|
42
|
+
setup(A, { emit: u }) {
|
|
43
|
+
const i = A, j = u, S = M({
|
|
44
|
+
get: () => i.modelValue,
|
|
45
|
+
set: (x) => j("update:modelValue", x)
|
|
46
|
+
});
|
|
47
|
+
return (x, c) => (w(), z("div", kt, [
|
|
48
|
+
o("div", Ct, [
|
|
49
|
+
o("button", {
|
|
50
|
+
type: "button",
|
|
51
|
+
class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
|
|
52
|
+
onClick: c[0] || (c[0] = (d) => x.$emit("save"))
|
|
53
|
+
}, [...c[2] || (c[2] = [
|
|
54
|
+
o("svg", {
|
|
55
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
56
|
+
width: "24",
|
|
57
|
+
height: "24",
|
|
58
|
+
viewBox: "0 0 24 24",
|
|
59
|
+
fill: "none",
|
|
60
|
+
stroke: "currentColor",
|
|
61
|
+
"stroke-width": "2",
|
|
62
|
+
"stroke-linecap": "round",
|
|
63
|
+
"stroke-linejoin": "round",
|
|
64
|
+
class: "h-3.5 w-3.5"
|
|
65
|
+
}, [
|
|
66
|
+
o("path", { d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a 2 2 0 0 1-2-2V5a 2 2 0 0 1 2-2z" }),
|
|
67
|
+
o("path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a 1 1 0 0 0-1 1v7" }),
|
|
68
|
+
o("path", { d: "M7 3v4a1 1 0 0 0 1 1h7" })
|
|
69
|
+
], -1),
|
|
70
|
+
Le(" Зберегти ", -1)
|
|
71
|
+
])])
|
|
72
|
+
]),
|
|
73
|
+
E(Ee, {
|
|
74
|
+
modelValue: S.value,
|
|
75
|
+
"onUpdate:modelValue": c[1] || (c[1] = (d) => S.value = d),
|
|
76
|
+
language: "cartocss",
|
|
77
|
+
class: "flex-1 rounded-lg overflow-hidden"
|
|
78
|
+
}, null, 8, ["modelValue"])
|
|
79
|
+
]));
|
|
80
|
+
}
|
|
81
|
+
}), $t = { class: "flex flex-col flex-1 min-h-0" }, Vt = { class: "flex justify-between mb-3 gap-2" }, Lt = { class: "text-left" }, Mt = { class: "font-medium text-gray-900" }, zt = { class: "text-xs text-gray-500" }, Et = { class: "flex justify-center gap-2" }, jt = ["checked", "onChange"], At = { class: "text-sm font-medium text-gray-900" }, Nt = /* @__PURE__ */ W({
|
|
82
|
+
__name: "cartocss-data-tab",
|
|
83
|
+
props: {
|
|
84
|
+
modelValue: { default: [] },
|
|
85
|
+
modelModifiers: {}
|
|
86
|
+
},
|
|
87
|
+
emits: /* @__PURE__ */ Ye(["save"], ["update:modelValue"]),
|
|
88
|
+
setup(A, { emit: u }) {
|
|
89
|
+
const i = [
|
|
90
|
+
{ key: "table", label: "Таблиця", slot: "datasetCell" },
|
|
91
|
+
{
|
|
92
|
+
key: "active",
|
|
93
|
+
label: "Активний",
|
|
94
|
+
slot: "activeCell",
|
|
95
|
+
width: "140px"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: "zoom",
|
|
99
|
+
label: "Min Зум",
|
|
100
|
+
slot: "zoomCell",
|
|
101
|
+
width: "140px"
|
|
102
|
+
}
|
|
103
|
+
], j = me(
|
|
104
|
+
() => import("@opengis/core").then((_) => _.VsModal)
|
|
105
|
+
), S = me(() => import("@opengis/form")), x = Ge(A, "modelValue"), c = u, d = b(!1), s = b({
|
|
106
|
+
table: "",
|
|
107
|
+
query: "",
|
|
108
|
+
srid: "",
|
|
109
|
+
key: "",
|
|
110
|
+
columns: "",
|
|
111
|
+
minzoom: "",
|
|
112
|
+
maxzoom: "",
|
|
113
|
+
proj4text: "",
|
|
114
|
+
active: !0
|
|
115
|
+
}), m = {
|
|
116
|
+
table: { type: "text", label: "Таблиця", validators: ["required"] },
|
|
117
|
+
key: { type: "text", label: "Ключ", validators: ["required"] },
|
|
118
|
+
query: { type: "text", label: "Query" },
|
|
119
|
+
columns: { type: "text", label: "Колонки" },
|
|
120
|
+
srid: { type: "number", label: "SRID" },
|
|
121
|
+
proj4text: { type: "text", label: "PROJ4" },
|
|
122
|
+
active: { type: "switcher", label: "Активна" },
|
|
123
|
+
minzoom: { type: "number", label: "Min Зум", col: 6 },
|
|
124
|
+
maxzoom: { type: "number", label: "Max Зум", col: 6 }
|
|
125
|
+
};
|
|
126
|
+
function r() {
|
|
127
|
+
s.value = {
|
|
128
|
+
table: "",
|
|
129
|
+
query: "",
|
|
130
|
+
srid: "",
|
|
131
|
+
key: "",
|
|
132
|
+
columns: "",
|
|
133
|
+
minzoom: "",
|
|
134
|
+
maxzoom: "",
|
|
135
|
+
proj4text: "",
|
|
136
|
+
active: !0
|
|
137
|
+
}, d.value = !0;
|
|
138
|
+
}
|
|
139
|
+
function $() {
|
|
140
|
+
d.value = !1;
|
|
141
|
+
}
|
|
142
|
+
function N() {
|
|
143
|
+
var f, k;
|
|
144
|
+
const _ = (f = s.value.table) == null ? void 0 : f.trim(), v = (k = s.value.key) == null ? void 0 : k.trim();
|
|
145
|
+
if (!_ || !v) {
|
|
146
|
+
D({
|
|
147
|
+
type: "warning",
|
|
148
|
+
title: "Перевірка",
|
|
149
|
+
message: "Вкажіть таблицю та підпис"
|
|
150
|
+
});
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
x.value = [
|
|
154
|
+
...Array.isArray(x.value) ? x.value : [],
|
|
155
|
+
{ ...s.value, table: _, key: v }
|
|
156
|
+
], d.value = !1;
|
|
157
|
+
}
|
|
158
|
+
function p(_, v) {
|
|
159
|
+
var k;
|
|
160
|
+
const f = ((k = v == null ? void 0 : v.target) == null ? void 0 : k.checked) ?? !1;
|
|
161
|
+
_.active = f, x.value = Array.isArray(x.value) ? [...x.value] : [];
|
|
162
|
+
}
|
|
163
|
+
return (_, v) => (w(), z("div", $t, [
|
|
164
|
+
o("div", Vt, [
|
|
165
|
+
o("button", {
|
|
166
|
+
type: "button",
|
|
167
|
+
class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium bg-gradient-to-r from-gray-500 to-gray-400 text-white h-9 px-4 py-2 hover:from-gray-600 hover:to-gray-500",
|
|
168
|
+
onClick: r
|
|
169
|
+
}, " Додати таблицю "),
|
|
170
|
+
o("button", {
|
|
171
|
+
type: "button",
|
|
172
|
+
class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
|
|
173
|
+
onClick: v[0] || (v[0] = (f) => c("save"))
|
|
174
|
+
}, " Зберегти ")
|
|
175
|
+
]),
|
|
176
|
+
E(gt, {
|
|
177
|
+
modelValue: x.value,
|
|
178
|
+
"onUpdate:modelValue": v[1] || (v[1] = (f) => x.value = f),
|
|
179
|
+
"columns-scheme": i,
|
|
180
|
+
"form-scheme": m,
|
|
181
|
+
"add-button": !1,
|
|
182
|
+
"main-col-width": "260px"
|
|
183
|
+
}, {
|
|
184
|
+
datasetCell: G(({ row: f }) => [
|
|
185
|
+
o("div", Lt, [
|
|
186
|
+
o("div", Mt, U(f.table), 1),
|
|
187
|
+
o("div", zt, U(f.key), 1)
|
|
188
|
+
])
|
|
189
|
+
]),
|
|
190
|
+
activeCell: G(({ row: f }) => [
|
|
191
|
+
o("label", Et, [
|
|
192
|
+
o("input", {
|
|
193
|
+
type: "checkbox",
|
|
194
|
+
class: "h-4 w-4 text-sky-500 border-gray-300 rounded focus:ring-sky-300",
|
|
195
|
+
checked: f.active,
|
|
196
|
+
onChange: (k) => p(f, k)
|
|
197
|
+
}, null, 40, jt)
|
|
198
|
+
])
|
|
199
|
+
]),
|
|
200
|
+
zoomCell: G(({ row: f }) => [
|
|
201
|
+
o("div", At, U(f.zoom), 1)
|
|
202
|
+
]),
|
|
203
|
+
_: 1
|
|
204
|
+
}, 8, ["modelValue"]),
|
|
205
|
+
E(le(j), {
|
|
206
|
+
teleport: "#modal",
|
|
207
|
+
visible: d.value,
|
|
208
|
+
"onUpdate:visible": v[3] || (v[3] = (f) => d.value = f),
|
|
209
|
+
title: "Нова таблиця CartoCSS"
|
|
210
|
+
}, {
|
|
211
|
+
footer: G(() => [
|
|
212
|
+
o("div", { class: "flex justify-end gap-2 p-4 border-т" }, [
|
|
213
|
+
o("button", {
|
|
214
|
+
type: "button",
|
|
215
|
+
class: "px-4 py-2 rounded bg-gray-100 text-gray-700",
|
|
216
|
+
onClick: $
|
|
217
|
+
}, " Скасувати "),
|
|
218
|
+
o("button", {
|
|
219
|
+
type: "button",
|
|
220
|
+
class: "px-4 py-2 rounded bg-blue-600 text-white",
|
|
221
|
+
onClick: N
|
|
222
|
+
}, " Додати ")
|
|
223
|
+
])
|
|
224
|
+
]),
|
|
225
|
+
default: G(() => [
|
|
226
|
+
E(le(S), {
|
|
227
|
+
values: s.value,
|
|
228
|
+
"onUpdate:values": v[2] || (v[2] = (f) => s.value = f),
|
|
229
|
+
schema: m
|
|
230
|
+
}, null, 8, ["values"])
|
|
231
|
+
]),
|
|
232
|
+
_: 1
|
|
233
|
+
}, 8, ["visible"])
|
|
234
|
+
]));
|
|
235
|
+
}
|
|
236
|
+
}), Bt = { class: "flex flex-col flex-1 min-h-0 gap-4" }, qt = { class: "h-[calc(100vh-230px)] rounded-md border border-gray-200 bg-white" }, Tt = /* @__PURE__ */ W({
|
|
237
|
+
__name: "cartocss-card-tab",
|
|
238
|
+
props: {
|
|
239
|
+
card: {},
|
|
240
|
+
table: {}
|
|
241
|
+
},
|
|
242
|
+
emits: ["save"],
|
|
243
|
+
setup(A, { emit: u }) {
|
|
244
|
+
const i = A, j = u, S = b(i.table), x = b(i.card), c = me(() => import("@opengis/form").then((s) => s.VsInputText));
|
|
245
|
+
function d() {
|
|
246
|
+
j("save", {
|
|
247
|
+
card_html: x.value,
|
|
248
|
+
card_table: S.value
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return (s, m) => (w(), z("div", Bt, [
|
|
252
|
+
o("div", { class: "flex items-center justify-end gap-3" }, [
|
|
253
|
+
o("button", {
|
|
254
|
+
type: "button",
|
|
255
|
+
class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
|
|
256
|
+
onClick: d
|
|
257
|
+
}, [...m[2] || (m[2] = [
|
|
258
|
+
o("svg", {
|
|
259
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
260
|
+
width: "24",
|
|
261
|
+
height: "24",
|
|
262
|
+
viewBox: "0 0 24 24",
|
|
263
|
+
fill: "none",
|
|
264
|
+
stroke: "currentColor",
|
|
265
|
+
"stroke-width": "2",
|
|
266
|
+
"stroke-linecap": "round",
|
|
267
|
+
"stroke-linejoin": "round",
|
|
268
|
+
class: "h-3.5 w-3.5"
|
|
269
|
+
}, [
|
|
270
|
+
o("path", { d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a 2 2 0 0 1-2-2V5a 2 2 0 0 1 2-2z" }),
|
|
271
|
+
o("path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a 1 1 0 0 0-1 1v7" }),
|
|
272
|
+
o("path", { d: "M7 3v4a1 1 0 0 0 1 1h7" })
|
|
273
|
+
], -1),
|
|
274
|
+
Le(" Зберегти картку ", -1)
|
|
275
|
+
])])
|
|
276
|
+
]),
|
|
277
|
+
o("div", null, [
|
|
278
|
+
E(le(c), {
|
|
279
|
+
modelValue: S.value,
|
|
280
|
+
"onUpdate:modelValue": m[0] || (m[0] = (r) => S.value = r)
|
|
281
|
+
}, null, 8, ["modelValue"])
|
|
282
|
+
]),
|
|
283
|
+
o("div", qt, [
|
|
284
|
+
E(Ee, {
|
|
285
|
+
modelValue: x.value,
|
|
286
|
+
"onUpdate:modelValue": m[1] || (m[1] = (r) => x.value = r),
|
|
287
|
+
language: "html",
|
|
288
|
+
theme: "vs-light",
|
|
289
|
+
class: "h-full w-full rounded-md"
|
|
290
|
+
}, null, 8, ["modelValue"])
|
|
291
|
+
])
|
|
292
|
+
]));
|
|
293
|
+
}
|
|
294
|
+
}), Dt = /* @__PURE__ */ W({
|
|
295
|
+
__name: "CartocssLayerLoader",
|
|
296
|
+
props: {
|
|
297
|
+
layerId: { type: String, required: !0 },
|
|
298
|
+
tileUrl: { type: String, default: "" },
|
|
299
|
+
title: { type: String, default: "" },
|
|
300
|
+
active: { type: Boolean, default: !1 },
|
|
301
|
+
owner: { type: String, default: "" },
|
|
302
|
+
opacity: { type: Number, default: 1 }
|
|
303
|
+
},
|
|
304
|
+
setup(A) {
|
|
305
|
+
const u = A, i = ze(), {
|
|
306
|
+
activateTemporaryLayer: j,
|
|
307
|
+
deactivateTemporaryLayer: S,
|
|
308
|
+
setTemporaryLayerOpacity: x
|
|
309
|
+
} = lt(i.map), c = M(() => {
|
|
310
|
+
var $;
|
|
311
|
+
const r = `${($ = u == null ? void 0 : u.tileUrl) == null ? void 0 : $.trim()}`;
|
|
312
|
+
return r ? typeof window > "u" || typeof location > "u" || /^https?:\/\//i.test(r) ? r : r.startsWith("//") ? `${window.location.protocol}${r}` : r.startsWith("/") ? `${location.origin}${r}` : `${location.origin}/${r}` : "";
|
|
313
|
+
});
|
|
314
|
+
let d = "", s = "";
|
|
315
|
+
function m() {
|
|
316
|
+
const r = u.active && !!c.value;
|
|
317
|
+
d && (!r || d !== u.layerId) && (S(d, s || void 0), d = "", s = ""), r && (j(
|
|
318
|
+
{
|
|
319
|
+
id: u.layerId,
|
|
320
|
+
title: u.title || u.layerId,
|
|
321
|
+
url: c.value,
|
|
322
|
+
opacity: u.opacity
|
|
323
|
+
},
|
|
324
|
+
{},
|
|
325
|
+
u.owner
|
|
326
|
+
), d = u.layerId, s = u.owner || "");
|
|
327
|
+
}
|
|
328
|
+
return T(
|
|
329
|
+
() => [u.layerId, c.value, u.active, u.owner],
|
|
330
|
+
m,
|
|
331
|
+
{ immediate: !0 }
|
|
332
|
+
), T(
|
|
333
|
+
() => u.opacity,
|
|
334
|
+
(r) => {
|
|
335
|
+
!d || !u.active || x(d, r, s || void 0);
|
|
336
|
+
},
|
|
337
|
+
{ immediate: !0 }
|
|
338
|
+
), We(() => {
|
|
339
|
+
d && (S(d, s || void 0), d = "", s = "");
|
|
340
|
+
}), (r, $) => B("", !0);
|
|
341
|
+
}
|
|
342
|
+
}), Ut = /* @__PURE__ */ W({
|
|
343
|
+
__name: "CartocssMapClickListener",
|
|
344
|
+
props: {
|
|
345
|
+
cartocssId: {},
|
|
346
|
+
infoEnabled: { type: [Boolean, null] }
|
|
347
|
+
},
|
|
348
|
+
setup(A) {
|
|
349
|
+
const u = A, i = M(() => u.cartocssId ?? null), j = M(() => !!u.infoEnabled), { map: S, ready: x } = ze(), c = (p) => {
|
|
350
|
+
!p || typeof window > "u" || window.dispatchEvent(
|
|
351
|
+
new CustomEvent(ut, { detail: p })
|
|
352
|
+
);
|
|
353
|
+
}, d = async (p) => {
|
|
354
|
+
const _ = await fetch(`/api/map-format?${p.toString()}`);
|
|
355
|
+
if (!_.ok)
|
|
356
|
+
throw new Error(`API returned ${_.status}`);
|
|
357
|
+
return _.json();
|
|
358
|
+
};
|
|
359
|
+
let s = null, m = null;
|
|
360
|
+
const r = (p) => {
|
|
361
|
+
if (!p) return null;
|
|
362
|
+
if (typeof p == "string")
|
|
363
|
+
try {
|
|
364
|
+
return JSON.parse(p);
|
|
365
|
+
} catch {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
return p;
|
|
369
|
+
}, $ = async (p, _) => {
|
|
370
|
+
var k;
|
|
371
|
+
const v = i.value ? `external:${i.value},${String(p)}` : null, f = new URLSearchParams({
|
|
372
|
+
layer: i.value ?? "",
|
|
373
|
+
id: String(p)
|
|
374
|
+
});
|
|
375
|
+
try {
|
|
376
|
+
const V = await d(f), F = typeof V.html == "string" ? V.html : null, R = r(
|
|
377
|
+
((k = V == null ? void 0 : V.data) == null ? void 0 : k.geom) ?? (V == null ? void 0 : V.geom) ?? null
|
|
378
|
+
);
|
|
379
|
+
(F || R) && c({
|
|
380
|
+
html: F,
|
|
381
|
+
geometry: R ?? _,
|
|
382
|
+
infoToken: v
|
|
383
|
+
});
|
|
384
|
+
} catch (V) {
|
|
385
|
+
console.warn("CartoCSS map-format (id) error", V);
|
|
386
|
+
}
|
|
387
|
+
}, N = async (p) => {
|
|
388
|
+
var k, V, F, R;
|
|
389
|
+
if (!i.value) return;
|
|
390
|
+
if (!j.value) {
|
|
391
|
+
D({
|
|
392
|
+
type: "error",
|
|
393
|
+
title: "CartoCSS",
|
|
394
|
+
message: "Картка не налаштована"
|
|
395
|
+
});
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
const _ = (k = p == null ? void 0 : p.lngLat) == null ? void 0 : k.lng, v = (V = p == null ? void 0 : p.lngLat) == null ? void 0 : V.lat;
|
|
399
|
+
if (typeof _ != "number" || typeof v != "number") return;
|
|
400
|
+
const f = new URLSearchParams({
|
|
401
|
+
layer: i.value,
|
|
402
|
+
lat: v.toFixed(6),
|
|
403
|
+
lng: _.toFixed(6)
|
|
404
|
+
});
|
|
405
|
+
try {
|
|
406
|
+
const y = await d(f), Q = r(
|
|
407
|
+
((F = y == null ? void 0 : y.data) == null ? void 0 : F.geom) ?? (y == null ? void 0 : y.geom) ?? null
|
|
408
|
+
), H = ((R = y == null ? void 0 : y.data) == null ? void 0 : R.id) ?? (y == null ? void 0 : y.id);
|
|
409
|
+
if (H != null) {
|
|
410
|
+
await $(H, Q);
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
rt({ html: y == null ? void 0 : y.html }) && c({
|
|
414
|
+
html: y == null ? void 0 : y.html,
|
|
415
|
+
geometry: Q,
|
|
416
|
+
infoToken: null
|
|
417
|
+
});
|
|
418
|
+
} catch (y) {
|
|
419
|
+
console.warn("CartoCSS map-format error", y);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
return x().then(() => {
|
|
423
|
+
m = S.value, m && (m.on("click", N), s = () => m == null ? void 0 : m.off("click", N));
|
|
424
|
+
}), Me(() => {
|
|
425
|
+
s == null || s(), s = null, m = null;
|
|
426
|
+
}), () => {
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
}), It = { class: "flex h-full bg-gradient-to-br from-slate-50 to-white" }, Ot = { class: "flex-1 relative overflow-hidden" }, Pt = { class: "absolute top-0 left-0 w-full z-20" }, Ft = { class: "px-4 sm:px-6 py-4 border-b border-gray-200 bg-white shadow-sm" }, Rt = { class: "flex items-start justify-between gap-4" }, Qt = { class: "flex-1 min-w-0" }, Ht = { class: "flex items-center text-sm text-gray-500 mb-3" }, Jt = { class: "text-gray-900 font-medium truncate max-w-xs" }, Yt = { class: "flex items-center justify-between gap-4" }, Gt = { class: "flex-1 min-w-0" }, Wt = { class: "flex items-center gap-3 mb-1" }, Xt = { class: "text-base font-semibold text-gray-900 truncate" }, Zt = {
|
|
430
|
+
key: 0,
|
|
431
|
+
class: "px-2 py-0.5 bg-green-50 border border-green-200 rounded flex-shrink-0"
|
|
432
|
+
}, Kt = { class: "text-xs font-medium text-green-700" }, ea = ["title"], ta = { class: "w-full h-full bg-gradient-to-br from-sky-50 via-white to-blue-50 flex items-center justify-center relative pt-[115px]" }, aa = { class: "relative w-full h-full" }, oa = { class: "absolute top-[5.5rem] left-4 z-30 flex flex-col items-start gap-2" }, na = { class: "rounded-2xl bg-white/90 px-3 py-2 text-xs font-medium text-slate-600 shadow-sm backdrop-blur" }, sa = { class: "flex items-center gap-2" }, la = { class: "rounded-2xl bg-white/90 px-3 py-2 text-xs font-medium text-slate-600 shadow-sm backdrop-blur" }, ra = { class: "inline-flex items-center gap-2 text-[11px] text-slate-600" }, ua = ["checked"], ia = { class: "absolute top-4 left-4 z-20" }, ca = { class: "absolute top-[6.5rem] right-2 space-y-1 z-20" }, da = {
|
|
433
|
+
key: 0,
|
|
434
|
+
class: "absolute bottom-4 left-1/2 z-30 -translate-x-1/2 rounded-2xl border border-sky-200 bg-white/95 px-4 py-2 text-xs font-medium text-slate-700 shadow-lg backdrop-blur"
|
|
435
|
+
}, fa = { class: "flex-1 flex flex-col h-full" }, ma = {
|
|
436
|
+
key: 0,
|
|
437
|
+
class: "px-3 pt-3 pb-2 border-b border-gray-100"
|
|
438
|
+
}, pa = ["aria-selected", "onClick"], ya = { class: "leading-none" }, va = { class: "flex flex-col flex-1 overflow-y-hidden p-3" }, ha = {
|
|
439
|
+
key: 0,
|
|
440
|
+
class: "flex-1 flex items-center justify-center text-sm text-gray-500"
|
|
441
|
+
}, ga = "cartocss-demo-001", ba = "OpenGIS", Ve = 2, se = 5, xa = 5, Ea = /* @__PURE__ */ W({
|
|
442
|
+
__name: "cartocss",
|
|
443
|
+
setup(A) {
|
|
444
|
+
const u = ot(), i = nt(), j = b(null), S = [
|
|
445
|
+
{ key: "css", label: "CSS", icon: ft },
|
|
446
|
+
{ key: "data", label: "Дані", icon: _t },
|
|
447
|
+
{ key: "metadata", label: "Метадані", icon: ht },
|
|
448
|
+
{ key: "card", label: "Картка", icon: mt }
|
|
449
|
+
], x = S.map((e) => e.key), c = b(
|
|
450
|
+
x.includes(i.query.tab) ? i.query.tab : "css"
|
|
451
|
+
), d = b(!0), s = b(null), m = M(() => {
|
|
452
|
+
var e;
|
|
453
|
+
return (e = s.value) != null && e.source_path ? S.filter((a) => a.key === "card" || a.key === "metadata") : S;
|
|
454
|
+
}), r = M(
|
|
455
|
+
() => i.params.id || ga
|
|
456
|
+
), $ = b({
|
|
457
|
+
id: r.value,
|
|
458
|
+
name: "",
|
|
459
|
+
description: ""
|
|
460
|
+
});
|
|
461
|
+
let N = null;
|
|
462
|
+
const p = b(!1);
|
|
463
|
+
function _(e) {
|
|
464
|
+
if (Array.isArray(e)) return _(e[0]);
|
|
465
|
+
if (typeof e != "string" && typeof e != "number") return null;
|
|
466
|
+
const a = typeof e == "number" ? e : Number(e.trim());
|
|
467
|
+
return Number.isFinite(a) ? a : null;
|
|
468
|
+
}
|
|
469
|
+
function v(e, a) {
|
|
470
|
+
return e.toFixed(a);
|
|
471
|
+
}
|
|
472
|
+
function f(e, a, t) {
|
|
473
|
+
const n = 0.5 * 10 ** -t;
|
|
474
|
+
return Math.abs(e - a) > n;
|
|
475
|
+
}
|
|
476
|
+
function k() {
|
|
477
|
+
var e;
|
|
478
|
+
return (e = j.value) == null ? void 0 : e.ctx;
|
|
479
|
+
}
|
|
480
|
+
function V() {
|
|
481
|
+
var h, C, O, q;
|
|
482
|
+
const e = (C = (h = k()) == null ? void 0 : h.map) == null ? void 0 : C.value;
|
|
483
|
+
if (!e) return;
|
|
484
|
+
const a = _(i.query.z), t = _(i.query.x), n = _(i.query.y);
|
|
485
|
+
if (a == null || t == null || n == null) return;
|
|
486
|
+
const l = (O = e.getCenter) == null ? void 0 : O.call(e), g = (q = e.getZoom) == null ? void 0 : q.call(e);
|
|
487
|
+
(!l || f(l.lng, t, se) || f(l.lat, n, se) || f(g ?? 0, a, Ve)) && (p.value = !0, e.jumpTo({ center: [t, n], zoom: a }), p.value = !1);
|
|
488
|
+
}
|
|
489
|
+
function F() {
|
|
490
|
+
var l, g, L, h;
|
|
491
|
+
if (p.value) return;
|
|
492
|
+
const e = (g = (l = k()) == null ? void 0 : l.map) == null ? void 0 : g.value;
|
|
493
|
+
if (!e) return;
|
|
494
|
+
const a = (L = e.getCenter) == null ? void 0 : L.call(e), t = (h = e.getZoom) == null ? void 0 : h.call(e);
|
|
495
|
+
if (!a || t == null) return;
|
|
496
|
+
const n = {
|
|
497
|
+
...i.query,
|
|
498
|
+
z: v(t, Ve),
|
|
499
|
+
x: v(a.lng, se),
|
|
500
|
+
y: v(a.lat, se)
|
|
501
|
+
};
|
|
502
|
+
i.query.z === n.z && i.query.x === n.x && i.query.y === n.y || u.replace({ query: n });
|
|
503
|
+
}
|
|
504
|
+
function R(e) {
|
|
505
|
+
typeof document > "u" || (document.title = e ? `${e} — CartoCSS` : ba);
|
|
506
|
+
}
|
|
507
|
+
const y = b(""), Q = b([]), H = b(!1), K = b(!1), re = b(""), ue = b(0), ee = b(!1), te = b(1), ie = b(!0), I = b(!1), X = b(null), je = M(() => `cartocss-layer-${r.value}`), Ae = M(() => `${Math.round(te.value * 100)}%`), Ne = M(() => `cartocss-extent-${r.value}`), Be = M(() => `cartocss-extent-draft-${r.value}`), pe = M(() => {
|
|
508
|
+
var l;
|
|
509
|
+
const e = (l = re.value) == null ? void 0 : l.trim();
|
|
510
|
+
if (!e) return "";
|
|
511
|
+
const a = e.includes("?") ? "&" : "?", t = `${e}${a}nottl=1`, n = ue.value;
|
|
512
|
+
return n ? `${e}${a}ts=${n}&nocache=1` : t;
|
|
513
|
+
}), ye = b(""), ve = b(""), he = M(() => {
|
|
514
|
+
var g;
|
|
515
|
+
const e = (g = s.value) == null ? void 0 : g.bounds;
|
|
516
|
+
if (!Array.isArray(e) || e.length < 4) return null;
|
|
517
|
+
const [a, t, n, l] = e;
|
|
518
|
+
return [a, t, n, l].some(
|
|
519
|
+
(L) => typeof L != "number" || Number.isNaN(L)
|
|
520
|
+
) ? null : [(a + n) / 2, (t + l) / 2];
|
|
521
|
+
}), qe = M(() => {
|
|
522
|
+
var g;
|
|
523
|
+
const e = (g = s.value) == null ? void 0 : g.bounds;
|
|
524
|
+
if (!Array.isArray(e) || e.length < 4) return null;
|
|
525
|
+
const [a, t, n, l] = e;
|
|
526
|
+
return [a, t, n, l].some(
|
|
527
|
+
(L) => typeof L != "number" || Number.isNaN(L)
|
|
528
|
+
) ? null : [a, t, n, l];
|
|
529
|
+
}), ce = M(() => {
|
|
530
|
+
const e = s.value;
|
|
531
|
+
return e ? [
|
|
532
|
+
e.description,
|
|
533
|
+
e.group_id ? `Група: ${e.group_id}` : null,
|
|
534
|
+
e.source_path ? `Шлях: ${e.source_path}` : null,
|
|
535
|
+
e.is_public === !0 ? "Публічний" : "Не публічний",
|
|
536
|
+
e.enabled === !0 ? "Активний" : "Неактивний"
|
|
537
|
+
].filter(Boolean).join(", ") : "";
|
|
538
|
+
}), ge = M(() => {
|
|
539
|
+
var a;
|
|
540
|
+
const e = (a = s.value) == null ? void 0 : a.group_id;
|
|
541
|
+
return e ? String(e).toUpperCase() : "";
|
|
542
|
+
});
|
|
543
|
+
let J = null, Z = !1, Y = null;
|
|
544
|
+
function ae(e) {
|
|
545
|
+
return Number(e.toFixed(xa));
|
|
546
|
+
}
|
|
547
|
+
function be(e, a) {
|
|
548
|
+
const [t, n] = e, [l, g] = a;
|
|
549
|
+
return [
|
|
550
|
+
ae(Math.min(t, l)),
|
|
551
|
+
ae(Math.min(n, g)),
|
|
552
|
+
ae(Math.max(t, l)),
|
|
553
|
+
ae(Math.max(n, g))
|
|
554
|
+
];
|
|
555
|
+
}
|
|
556
|
+
function Te(e) {
|
|
557
|
+
const [a, t, n, l] = e;
|
|
558
|
+
return {
|
|
559
|
+
type: "Polygon",
|
|
560
|
+
coordinates: [[
|
|
561
|
+
[a, t],
|
|
562
|
+
[n, t],
|
|
563
|
+
[n, l],
|
|
564
|
+
[a, l],
|
|
565
|
+
[a, t]
|
|
566
|
+
]]
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
function de(e) {
|
|
570
|
+
var n, l, g;
|
|
571
|
+
const a = (l = (n = k()) == null ? void 0 : n.map) == null ? void 0 : l.value, t = (g = a == null ? void 0 : a.getCanvas) == null ? void 0 : g.call(a);
|
|
572
|
+
t != null && t.style && (t.style.cursor = e);
|
|
573
|
+
}
|
|
574
|
+
async function De(e, a) {
|
|
575
|
+
if (!(!r.value || !s.value)) {
|
|
576
|
+
K.value = !0;
|
|
577
|
+
try {
|
|
578
|
+
const t = Te(e), n = await fetch(`/api/gis-css/${r.value}`, {
|
|
579
|
+
method: "POST",
|
|
580
|
+
headers: { "Content-Type": "application/json" },
|
|
581
|
+
body: JSON.stringify({ geom: t })
|
|
582
|
+
});
|
|
583
|
+
if (!n.ok) throw new Error(`Failed to save cartocss bounds: ${n.status}`);
|
|
584
|
+
D({
|
|
585
|
+
type: "success",
|
|
586
|
+
title: "Bounds збережено",
|
|
587
|
+
message: "Нові межі успішно збережено."
|
|
588
|
+
}), await oe(r.value, { bustCache: !0 });
|
|
589
|
+
} catch (t) {
|
|
590
|
+
console.error("Failed to save CartoCSS bounds", t), s.value && (s.value = {
|
|
591
|
+
...s.value,
|
|
592
|
+
bounds: a ? [...a] : null
|
|
593
|
+
}), D({
|
|
594
|
+
type: "error",
|
|
595
|
+
title: "Помилка",
|
|
596
|
+
message: "Не вдалося зберегти Bounds"
|
|
597
|
+
});
|
|
598
|
+
} finally {
|
|
599
|
+
K.value = !1;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
function xe(e) {
|
|
604
|
+
var t, n, l;
|
|
605
|
+
const a = (n = (t = k()) == null ? void 0 : t.map) == null ? void 0 : n.value;
|
|
606
|
+
if ((l = a == null ? void 0 : a.dragPan) != null && l.enable && a.dragPan.enable(), (e == null ? void 0 : e.length) === 4 && s.value) {
|
|
607
|
+
const g = Array.isArray(s.value.bounds) ? [...s.value.bounds] : null;
|
|
608
|
+
s.value = {
|
|
609
|
+
...s.value,
|
|
610
|
+
bounds: [...e]
|
|
611
|
+
}, De(e, g);
|
|
612
|
+
}
|
|
613
|
+
J = null, Z = !1, X.value = null, I.value = !1, de("");
|
|
614
|
+
}
|
|
615
|
+
function fe() {
|
|
616
|
+
xe(null);
|
|
617
|
+
}
|
|
618
|
+
function Ue() {
|
|
619
|
+
var g, L;
|
|
620
|
+
const e = (L = (g = k()) == null ? void 0 : g.map) == null ? void 0 : L.value;
|
|
621
|
+
if (!e) return;
|
|
622
|
+
const a = (h) => {
|
|
623
|
+
var O, q, ne;
|
|
624
|
+
if (!I.value || ((O = h == null ? void 0 : h.originalEvent) == null ? void 0 : O.button) != null && h.originalEvent.button !== 0) return;
|
|
625
|
+
const C = h == null ? void 0 : h.lngLat;
|
|
626
|
+
C && (J = [C.lng, C.lat], Z = !0, X.value = [
|
|
627
|
+
C.lng,
|
|
628
|
+
C.lat,
|
|
629
|
+
C.lng,
|
|
630
|
+
C.lat
|
|
631
|
+
], (ne = (q = e.dragPan) == null ? void 0 : q.disable) == null || ne.call(q));
|
|
632
|
+
}, t = (h) => {
|
|
633
|
+
if (!I.value || !Z || !J) return;
|
|
634
|
+
const C = h == null ? void 0 : h.lngLat;
|
|
635
|
+
C && (X.value = be(J, [C.lng, C.lat]));
|
|
636
|
+
}, n = (h) => {
|
|
637
|
+
if (!I.value || !Z || !J) return;
|
|
638
|
+
const C = h == null ? void 0 : h.lngLat;
|
|
639
|
+
if (!C) {
|
|
640
|
+
fe();
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
const O = be(J, [C.lng, C.lat]), [q, ne, He, Je] = O;
|
|
644
|
+
if (!(Math.abs(He - q) > 0 && Math.abs(Je - ne) > 0)) {
|
|
645
|
+
D({
|
|
646
|
+
type: "warning",
|
|
647
|
+
title: "Bounds не змінено",
|
|
648
|
+
message: "Потрібно протягнути прямокутник з ненульовою площею."
|
|
649
|
+
}), fe();
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
xe(O);
|
|
653
|
+
}, l = (h) => {
|
|
654
|
+
I.value && h.key === "Escape" && (h.preventDefault(), fe());
|
|
655
|
+
};
|
|
656
|
+
e.on("mousedown", a), e.on("mousemove", t), e.on("mouseup", n), window.addEventListener("keydown", l), Y = () => {
|
|
657
|
+
e.off("mousedown", a), e.off("mousemove", t), e.off("mouseup", n), window.removeEventListener("keydown", l);
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
async function Ie() {
|
|
661
|
+
var t;
|
|
662
|
+
const e = k();
|
|
663
|
+
!(e != null && e.ready) || (await e.ready(), !((t = e.map) == null ? void 0 : t.value)) || (Y || Ue(), I.value = !0, Z = !1, J = null, X.value = null, de("crosshair"), D({
|
|
664
|
+
type: "info",
|
|
665
|
+
title: "Редагування Bounds",
|
|
666
|
+
message: "Протягніть прямокутник на карті, щоб задати нові межі."
|
|
667
|
+
}));
|
|
668
|
+
}
|
|
669
|
+
T(
|
|
670
|
+
r,
|
|
671
|
+
(e) => {
|
|
672
|
+
e && oe(e);
|
|
673
|
+
},
|
|
674
|
+
{ immediate: !0 }
|
|
675
|
+
), T(
|
|
676
|
+
() => {
|
|
677
|
+
var e;
|
|
678
|
+
return (e = $.value) == null ? void 0 : e.name;
|
|
679
|
+
},
|
|
680
|
+
(e) => R(e),
|
|
681
|
+
{ immediate: !0 }
|
|
682
|
+
);
|
|
683
|
+
async function Oe() {
|
|
684
|
+
var n;
|
|
685
|
+
const e = k();
|
|
686
|
+
if (!(e != null && e.ready)) return;
|
|
687
|
+
await e.ready(), V();
|
|
688
|
+
const a = (n = e.map) == null ? void 0 : n.value;
|
|
689
|
+
if (!a) return;
|
|
690
|
+
const t = () => F();
|
|
691
|
+
a.on("moveend", t), a.on("zoomend", t), N = () => {
|
|
692
|
+
a.off("moveend", t), a.off("zoomend", t);
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
T(
|
|
696
|
+
() => [i.query.z, i.query.x, i.query.y],
|
|
697
|
+
() => {
|
|
698
|
+
V();
|
|
699
|
+
}
|
|
700
|
+
), Xe(() => {
|
|
701
|
+
Oe();
|
|
702
|
+
}), Me(() => {
|
|
703
|
+
N == null || N(), N = null, Y == null || Y(), Y = null, de("");
|
|
704
|
+
}), T(
|
|
705
|
+
() => i.query.tab,
|
|
706
|
+
(e) => {
|
|
707
|
+
e && m.value.some((a) => a.key === e) && c.value !== e && (c.value = e);
|
|
708
|
+
}
|
|
709
|
+
), T(
|
|
710
|
+
m,
|
|
711
|
+
(e) => {
|
|
712
|
+
e.length && !e.some((a) => a.key === c.value) && (c.value = e[0].key);
|
|
713
|
+
},
|
|
714
|
+
{ immediate: !0 }
|
|
715
|
+
), T(c, (e) => {
|
|
716
|
+
i.query.tab !== e && m.value.some((a) => a.key === e) && u.replace({ query: { ...i.query, tab: e } });
|
|
717
|
+
}), T(
|
|
718
|
+
() => s.value,
|
|
719
|
+
(e) => {
|
|
720
|
+
const a = e == null ? void 0 : e.card_html;
|
|
721
|
+
ye.value = a, ve.value = e == null ? void 0 : e.card_table;
|
|
722
|
+
},
|
|
723
|
+
{ immediate: !0 }
|
|
724
|
+
);
|
|
725
|
+
function we() {
|
|
726
|
+
r.value && oe(r.value, { bustCache: !0 });
|
|
727
|
+
}
|
|
728
|
+
async function Pe(e, a) {
|
|
729
|
+
if (r.value) {
|
|
730
|
+
K.value = !0;
|
|
731
|
+
try {
|
|
732
|
+
const t = await fetch(`/api/gis-css/${r.value}`, {
|
|
733
|
+
method: "POST",
|
|
734
|
+
headers: { "Content-Type": "application/json" },
|
|
735
|
+
body: JSON.stringify(e)
|
|
736
|
+
});
|
|
737
|
+
if (!t.ok) throw new Error(`Failed to save cartocss: ${t.status}`);
|
|
738
|
+
D({ type: "success", title: "Збережено", message: a }), await oe(r.value, { bustCache: !0 });
|
|
739
|
+
} catch (t) {
|
|
740
|
+
console.error("Failed to save CartoCSS", t), D({ type: "error", title: "Помилка", message: "Не вдалося зберегти CartoCSS" });
|
|
741
|
+
} finally {
|
|
742
|
+
K.value = !1;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
function Fe(e) {
|
|
747
|
+
if (!e) return null;
|
|
748
|
+
if (typeof e == "string")
|
|
749
|
+
try {
|
|
750
|
+
return JSON.parse(e);
|
|
751
|
+
} catch (a) {
|
|
752
|
+
return console.warn("Failed to parse CartoCSS config", a), null;
|
|
753
|
+
}
|
|
754
|
+
return typeof e == "object" ? e : null;
|
|
755
|
+
}
|
|
756
|
+
function Re(e) {
|
|
757
|
+
const a = Array.isArray(e) ? e : e == null ? void 0 : e.datasets;
|
|
758
|
+
return Array.isArray(a) ? a.map((t, n) => ({
|
|
759
|
+
table: (t == null ? void 0 : t.table) || (t == null ? void 0 : t.id) || `dataset_${n + 1}`,
|
|
760
|
+
query: (t == null ? void 0 : t.query) || "",
|
|
761
|
+
srid: (t == null ? void 0 : t.srid) || "",
|
|
762
|
+
key: (t == null ? void 0 : t.key) || (t == null ? void 0 : t.label) || "Без підпису",
|
|
763
|
+
active: typeof (t == null ? void 0 : t.active) == "boolean" ? t.active : !0,
|
|
764
|
+
minzoom: typeof (t == null ? void 0 : t.zoom) > "u" ? "" : String(t.zoom),
|
|
765
|
+
maxzoom: typeof (t == null ? void 0 : t.maxzoom) > "u" ? "" : String(t.maxzoom),
|
|
766
|
+
columns: (t == null ? void 0 : t.columns) || "",
|
|
767
|
+
proj4text: (t == null ? void 0 : t.proj4text) || ""
|
|
768
|
+
})) : [];
|
|
769
|
+
}
|
|
770
|
+
async function oe(e, a) {
|
|
771
|
+
H.value = !0;
|
|
772
|
+
try {
|
|
773
|
+
const t = await fetch(`/api/gis-css/${e}`);
|
|
774
|
+
if (!t.ok) throw new Error(`Failed to load cartocss: ${t.status}`);
|
|
775
|
+
const n = await t.json(), l = (n == null ? void 0 : n.message) || n || {};
|
|
776
|
+
s.value = l, $.value = {
|
|
777
|
+
id: l.cartocss_key || e,
|
|
778
|
+
name: l.name || $.value.name,
|
|
779
|
+
description: l.description || $.value.description
|
|
780
|
+
}, y.value = typeof l.style == "string" ? l.style : "";
|
|
781
|
+
const g = Fe(l.config ?? []);
|
|
782
|
+
Q.value = Re(g);
|
|
783
|
+
const L = typeof l.url == "string" ? l.url : "";
|
|
784
|
+
re.value = L, ee.value = !!(L && l.enabled !== !1), ue.value = a != null && a.bustCache ? Date.now() : 0;
|
|
785
|
+
} catch (t) {
|
|
786
|
+
console.error("Failed to fetch CartoCSS", t), ee.value = !1, re.value = "", ue.value = 0, s.value = null;
|
|
787
|
+
} finally {
|
|
788
|
+
H.value = !1;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
async function _e() {
|
|
792
|
+
await Pe(
|
|
793
|
+
{
|
|
794
|
+
style: y.value || "",
|
|
795
|
+
config: Q.value
|
|
796
|
+
},
|
|
797
|
+
"CartoCSS оновлено"
|
|
798
|
+
);
|
|
799
|
+
}
|
|
800
|
+
async function Qe(e) {
|
|
801
|
+
const a = await fetch(`/api/gis-css/${r.value}`, {
|
|
802
|
+
method: "POST",
|
|
803
|
+
headers: { "Content-Type": "application/json" },
|
|
804
|
+
body: JSON.stringify(e)
|
|
805
|
+
});
|
|
806
|
+
if (!a.ok) throw new Error(`Failed to save cartocss: ${a.status}`);
|
|
807
|
+
D({ type: "success", title: "Збережено", message: "Картка CartoCSS оновлена" });
|
|
808
|
+
}
|
|
809
|
+
return (e, a) => (w(), z("div", It, [
|
|
810
|
+
o("div", Ot, [
|
|
811
|
+
o("div", Pt, [
|
|
812
|
+
o("div", Ft, [
|
|
813
|
+
o("div", Rt, [
|
|
814
|
+
o("div", Qt, [
|
|
815
|
+
o("div", Ht, [
|
|
816
|
+
o("button", {
|
|
817
|
+
type: "button",
|
|
818
|
+
class: "hover:text-gray-700 cursor-pointer transition-colors",
|
|
819
|
+
onClick: a[0] || (a[0] = (t) => le(u).push("/gis.cartocss"))
|
|
820
|
+
}, " CartoCSS "),
|
|
821
|
+
a[6] || (a[6] = o("svg", {
|
|
822
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
823
|
+
width: "24",
|
|
824
|
+
height: "24",
|
|
825
|
+
viewBox: "0 0 24 24",
|
|
826
|
+
fill: "none",
|
|
827
|
+
stroke: "currentColor",
|
|
828
|
+
"stroke-width": "2",
|
|
829
|
+
"stroke-linecap": "round",
|
|
830
|
+
"stroke-linejoin": "round",
|
|
831
|
+
class: "lucide lucide-chevron-right w-4 h-4 mx-1"
|
|
832
|
+
}, [
|
|
833
|
+
o("path", { d: "m9 18 6-6-6-6" })
|
|
834
|
+
], -1)),
|
|
835
|
+
o("span", Jt, U($.value.name || "CartoCSS"), 1)
|
|
836
|
+
]),
|
|
837
|
+
o("div", Yt, [
|
|
838
|
+
o("div", Gt, [
|
|
839
|
+
o("div", Wt, [
|
|
840
|
+
o("h1", Xt, U($.value.name || "CartoCSS"), 1),
|
|
841
|
+
ge.value ? (w(), z("div", Zt, [
|
|
842
|
+
o("span", Kt, U(ge.value), 1)
|
|
843
|
+
])) : B("", !0)
|
|
844
|
+
]),
|
|
845
|
+
ce.value ? (w(), z("p", {
|
|
846
|
+
key: 0,
|
|
847
|
+
class: "text-xs text-gray-500 truncate",
|
|
848
|
+
title: ce.value
|
|
849
|
+
}, U(ce.value), 9, ea)) : B("", !0)
|
|
850
|
+
])
|
|
851
|
+
])
|
|
852
|
+
]),
|
|
853
|
+
E(pt, {
|
|
854
|
+
class: "flex-shrink-0",
|
|
855
|
+
"entity-id": r.value,
|
|
856
|
+
"entity-info": $.value,
|
|
857
|
+
"form-endpoint": (t) => `/api/form/gis.cartocss.table/${t}`,
|
|
858
|
+
"save-endpoint": (t) => `/api/gis-css/${t}`,
|
|
859
|
+
"entity-label": "CartoCSS",
|
|
860
|
+
"save-method": "post",
|
|
861
|
+
onSaved: we
|
|
862
|
+
}, null, 8, ["entity-id", "entity-info", "form-endpoint", "save-endpoint"])
|
|
863
|
+
])
|
|
864
|
+
])
|
|
865
|
+
]),
|
|
866
|
+
o("div", ta, [
|
|
867
|
+
o("div", aa, [
|
|
868
|
+
E(it, {
|
|
869
|
+
ref_key: "mapViewRef",
|
|
870
|
+
ref: j
|
|
871
|
+
}, {
|
|
872
|
+
default: G(() => {
|
|
873
|
+
var t, n;
|
|
874
|
+
return [
|
|
875
|
+
o("div", oa, [
|
|
876
|
+
o("div", na, [
|
|
877
|
+
o("div", sa, [
|
|
878
|
+
a[7] || (a[7] = o("span", null, "Прозорість:", -1)),
|
|
879
|
+
Ze(o("input", {
|
|
880
|
+
"onUpdate:modelValue": a[1] || (a[1] = (l) => te.value = l),
|
|
881
|
+
type: "range",
|
|
882
|
+
min: "0",
|
|
883
|
+
max: "1",
|
|
884
|
+
step: "0.01",
|
|
885
|
+
class: "h-1 w-28 cursor-pointer appearance-none rounded-full bg-slate-300 focus:outline-none",
|
|
886
|
+
style: { "accent-color": "#3b82f6" }
|
|
887
|
+
}, null, 512), [
|
|
888
|
+
[
|
|
889
|
+
Ke,
|
|
890
|
+
te.value,
|
|
891
|
+
void 0,
|
|
892
|
+
{ number: !0 }
|
|
893
|
+
]
|
|
894
|
+
]),
|
|
895
|
+
o("span", null, U(Ae.value), 1)
|
|
896
|
+
])
|
|
897
|
+
]),
|
|
898
|
+
o("div", la, [
|
|
899
|
+
o("label", ra, [
|
|
900
|
+
o("input", {
|
|
901
|
+
type: "checkbox",
|
|
902
|
+
class: "h-3.5 w-3.5 rounded border-slate-300 text-blue-600 focus:ring-blue-200",
|
|
903
|
+
checked: ie.value,
|
|
904
|
+
onChange: a[2] || (a[2] = (l) => ie.value = l.target.checked)
|
|
905
|
+
}, null, 40, ua),
|
|
906
|
+
a[8] || (a[8] = o("span", null, "Межі css", -1))
|
|
907
|
+
])
|
|
908
|
+
])
|
|
909
|
+
]),
|
|
910
|
+
o("div", ia, [
|
|
911
|
+
E(ct)
|
|
912
|
+
]),
|
|
913
|
+
o("div", ca, [
|
|
914
|
+
E(Se),
|
|
915
|
+
he.value ? (w(), P(Se, {
|
|
916
|
+
key: 0,
|
|
917
|
+
targetCenter: he.value,
|
|
918
|
+
targetLabel: "Центр даних",
|
|
919
|
+
targetAriaLabel: "Перейти до центру даних"
|
|
920
|
+
}, null, 8, ["targetCenter"])) : B("", !0)
|
|
921
|
+
]),
|
|
922
|
+
I.value ? (w(), z("div", da, " Потягніть на карті, щоб намалювати нові Bounds. Esc скасовує редагування. ")) : B("", !0),
|
|
923
|
+
pe.value ? (w(), P(Dt, {
|
|
924
|
+
key: 1,
|
|
925
|
+
"layer-id": je.value,
|
|
926
|
+
"tile-url": pe.value,
|
|
927
|
+
active: ee.value,
|
|
928
|
+
opacity: te.value,
|
|
929
|
+
title: $.value.name,
|
|
930
|
+
owner: r.value
|
|
931
|
+
}, null, 8, ["layer-id", "tile-url", "active", "opacity", "title", "owner"])) : B("", !0),
|
|
932
|
+
E($e, {
|
|
933
|
+
extent: ie.value ? qe.value : null,
|
|
934
|
+
"layer-id": Ne.value
|
|
935
|
+
}, null, 8, ["extent", "layer-id"]),
|
|
936
|
+
E($e, {
|
|
937
|
+
extent: X.value,
|
|
938
|
+
"layer-id": Be.value,
|
|
939
|
+
"line-color": "#0ea5e9",
|
|
940
|
+
"line-width": 3
|
|
941
|
+
}, null, 8, ["extent", "layer-id"]),
|
|
942
|
+
E(Ut, {
|
|
943
|
+
"cartocss-id": r.value,
|
|
944
|
+
bounds: ((t = s.value) == null ? void 0 : t.bounds) ?? null,
|
|
945
|
+
active: ee.value && !I.value,
|
|
946
|
+
"info-enabled": (n = s.value) == null ? void 0 : n.info
|
|
947
|
+
}, null, 8, ["cartocss-id", "bounds", "active", "info-enabled"]),
|
|
948
|
+
E(dt, { "map-id": r.value }, null, 8, ["map-id"])
|
|
949
|
+
];
|
|
950
|
+
}),
|
|
951
|
+
_: 1
|
|
952
|
+
}, 512)
|
|
953
|
+
])
|
|
954
|
+
]),
|
|
955
|
+
s.value ? (w(), P(yt, {
|
|
956
|
+
key: 0,
|
|
957
|
+
open: d.value,
|
|
958
|
+
onToggle: a[3] || (a[3] = (t) => d.value = !d.value)
|
|
959
|
+
}, null, 8, ["open"])) : B("", !0)
|
|
960
|
+
]),
|
|
961
|
+
s.value ? (w(), z("div", {
|
|
962
|
+
key: 0,
|
|
963
|
+
class: ke(["bg-white border-l border-gray-100 flex flex-col overflow-hidden shadow-lg flex-shrink-0 transition-[width] duration-100 ease-in-out", d.value ? "w-[650px]" : "w-0"])
|
|
964
|
+
}, [
|
|
965
|
+
o("div", fa, [
|
|
966
|
+
m.value.length > 1 ? (w(), z("div", ma, [
|
|
967
|
+
o("div", {
|
|
968
|
+
class: "items-center justify-center text-muted-foreground grid w-full h-12 p-1 bg-gray-50 rounded-xl shadow-sm",
|
|
969
|
+
style: et({ gridTemplateColumns: `repeat(${m.value.length}, minmax(0, 1fr))` })
|
|
970
|
+
}, [
|
|
971
|
+
(w(!0), z(Ce, null, tt(m.value, (t) => (w(), z("button", {
|
|
972
|
+
key: t.key,
|
|
973
|
+
type: "button",
|
|
974
|
+
role: "tab",
|
|
975
|
+
"aria-selected": c.value === t.key,
|
|
976
|
+
class: ke([
|
|
977
|
+
"whitespace-nowrap flex flex-col items-center justify-center gap-0.5 py-1 px-1 text-[9px] font-medium transition-all duration-300 hover:bg-white/70 rounded-lg group",
|
|
978
|
+
c.value === t.key ? "bg-white shadow-sm text-gray-700" : ""
|
|
979
|
+
]),
|
|
980
|
+
onClick: (n) => c.value = t.key
|
|
981
|
+
}, [
|
|
982
|
+
(w(), P(at(t.icon), { class: "h-3.5 w-3.5 mb-0.5" })),
|
|
983
|
+
o("span", ya, U(t.label), 1)
|
|
984
|
+
], 10, pa))), 128))
|
|
985
|
+
], 4)
|
|
986
|
+
])) : B("", !0),
|
|
987
|
+
o("div", va, [
|
|
988
|
+
H.value ? (w(), z("div", ha, " Завантаження стилю… ")) : (w(), z(Ce, { key: 1 }, [
|
|
989
|
+
c.value === "css" ? (w(), P(St, {
|
|
990
|
+
key: 0,
|
|
991
|
+
modelValue: y.value,
|
|
992
|
+
"onUpdate:modelValue": a[4] || (a[4] = (t) => y.value = t),
|
|
993
|
+
class: "flex-1 min-h-0",
|
|
994
|
+
onSave: _e
|
|
995
|
+
}, null, 8, ["modelValue"])) : c.value === "data" ? (w(), P(Nt, {
|
|
996
|
+
key: 1,
|
|
997
|
+
modelValue: Q.value,
|
|
998
|
+
"onUpdate:modelValue": a[5] || (a[5] = (t) => Q.value = t),
|
|
999
|
+
class: "flex-1 min-h-0 flex flex-col",
|
|
1000
|
+
onSave: _e
|
|
1001
|
+
}, null, 8, ["modelValue"])) : c.value === "card" ? (w(), P(Tt, {
|
|
1002
|
+
key: 2,
|
|
1003
|
+
card: ye.value,
|
|
1004
|
+
table: ve.value,
|
|
1005
|
+
class: "flex-1 min-h-0",
|
|
1006
|
+
onSave: Qe
|
|
1007
|
+
}, null, 8, ["card", "table"])) : c.value === "metadata" ? (w(), P(vt, {
|
|
1008
|
+
key: 3,
|
|
1009
|
+
data: s.value,
|
|
1010
|
+
"entity-id": r.value,
|
|
1011
|
+
"entity-type": "css",
|
|
1012
|
+
onSaved: we,
|
|
1013
|
+
onEditCssBounds: Ie
|
|
1014
|
+
}, null, 8, ["data", "entity-id"])) : B("", !0)
|
|
1015
|
+
], 64))
|
|
1016
|
+
])
|
|
1017
|
+
])
|
|
1018
|
+
], 2)) : B("", !0)
|
|
1019
|
+
]));
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
export {
|
|
1023
|
+
Ea as default
|
|
1024
|
+
};
|