@opengis/bi 1.1.2 → 1.2.1
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/bi.js +11 -2
- package/dist/bi.umd.cjs +72 -720
- package/dist/import-file-D06AZEtP.js +3493 -0
- package/dist/style.css +1 -7
- package/dist/{vs-funnel-bar-mWZ8lvEq.js → vs-funnel-bar-C8m-602x.js} +11 -11
- package/dist/vs-list-BJ0NjSm5.js +525 -0
- package/dist/vs-map-PLlJqaaW.js +294 -0
- package/dist/vs-map-cluster-9tV6eiDA.js +356 -0
- package/dist/{vs-number-CRUhHKym.js → vs-number-B2V_BPer.js} +3 -3
- package/dist/{vs-table-OddIdr1s.js → vs-table-WGE9jyDq.js} +6 -6
- package/dist/vs-text-DkLKRC7F.js +1528 -0
- package/package.json +77 -84
- package/plugin.js +13 -13
- package/server/plugins/vite.js +69 -69
- package/server/routes/dashboard/controllers/utils/yaml.js +11 -11
- package/server/routes/data/controllers/data.js +7 -6
- package/server/routes/data/controllers/util/chartSQL.js +2 -2
- package/server/routes/map/controllers/cluster.js +125 -125
- package/server/routes/map/controllers/clusterVtile.js +166 -166
- package/server/routes/map/controllers/geojson.js +127 -127
- package/server/routes/map/controllers/map.js +69 -69
- package/server/routes/map/controllers/utils/downloadClusterData.js +44 -44
- package/server/routes/map/controllers/vtile.js +183 -183
- package/server/utils/getWidget.js +3 -3
- package/utils.js +12 -12
- package/config.js +0 -12
- package/dist/import-file-XFI3CaVb.js +0 -63458
- package/dist/vs-donut-al85JwBt.js +0 -148
- package/dist/vs-list-1QDnN3pH.js +0 -18510
- package/dist/vs-map-CwR6ZYur.js +0 -285
- package/dist/vs-map-cluster-YdXTBIVf.js +0 -314
- package/dist/vs-text-CQ9vn0qO.js +0 -40
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { l as E, c as L, p as $, V as T, a as B, b as H, d as O, e as F } from "./vs-list-BJ0NjSm5.js";
|
|
2
|
+
import { _ as V, c as N } from "./import-file-D06AZEtP.js";
|
|
3
|
+
import { resolveComponent as u, openBlock as i, createElementBlock as p, Fragment as w, createElementVNode as l, createVNode as x, createBlock as C, Teleport as P, toDisplayString as f, createCommentVNode as m, renderList as S, normalizeStyle as k, normalizeClass as I } from "vue";
|
|
4
|
+
const R = {
|
|
5
|
+
components: { legendIcon: E, closeIcon: L },
|
|
6
|
+
props: {
|
|
7
|
+
mapId: { type: String },
|
|
8
|
+
colors: { type: Array },
|
|
9
|
+
sizes: { type: Array, default: () => [] },
|
|
10
|
+
cluster: { type: [Boolean, String] },
|
|
11
|
+
color: { type: String, default: "gray" },
|
|
12
|
+
colorTitle: { type: String },
|
|
13
|
+
sizesTitle: { type: String },
|
|
14
|
+
resizeItem: { type: [Boolean, String], default: !1 },
|
|
15
|
+
changeOpacityItem: { type: [Boolean, String], default: !1 }
|
|
16
|
+
},
|
|
17
|
+
data() {
|
|
18
|
+
return {
|
|
19
|
+
isOpenLegend: !1,
|
|
20
|
+
palette: $
|
|
21
|
+
// palette: ['#69D2E7', 'yellow', '#FE4365'],
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
computed: {
|
|
25
|
+
borderRadius() {
|
|
26
|
+
return this.cluster ? "rounded-sm" : "rounded-full";
|
|
27
|
+
},
|
|
28
|
+
sortedSizes() {
|
|
29
|
+
return [...this.sizes].sort((e, o) => e - o);
|
|
30
|
+
},
|
|
31
|
+
maxWidht() {
|
|
32
|
+
var t;
|
|
33
|
+
const e = ((t = this.sizes) == null ? void 0 : t.length) - 1;
|
|
34
|
+
return this.calcSize(e);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
sizeClass(e) {
|
|
39
|
+
return this.resizeItem ? `h-[${this.calcSize(e)}] w-[${this.calcSize(e)}] ${this.borderRadius}` : `h-[18px] w-[18px] ${this.borderRadius}`;
|
|
40
|
+
},
|
|
41
|
+
calcSize(e) {
|
|
42
|
+
return `${10 + e * 2}px`;
|
|
43
|
+
},
|
|
44
|
+
getOpacity(e) {
|
|
45
|
+
return (e + 1) / this.sortedSizes.length;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, A = { class: "w-full absolute max-w-[200px] bg-white border rounded-lg bottom-[10px] right-[50px]" }, G = { class: "flex items-center justify-between border-b border-[#0000001A] px-2" }, W = { class: "w-full flex flex-col gap-[8px] px-2 py-2 max-h-[200px] overflow-auto [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-gray-300 [&::-webkit-scrollbar-track]:bg-transparent" }, Z = {
|
|
49
|
+
key: 0,
|
|
50
|
+
class: "flex flex-col w-full"
|
|
51
|
+
}, j = {
|
|
52
|
+
key: 0,
|
|
53
|
+
class: "text-xs font-semibold leading-[1.2] text-[#1F2937] mb-[8px]"
|
|
54
|
+
}, q = { class: "flex flex-col gap-[6px]" }, D = { class: "text-xs text-[#1F2937] font-normal leading-[1.2]" }, J = {
|
|
55
|
+
key: 1,
|
|
56
|
+
class: "flex flex-col w-full"
|
|
57
|
+
}, K = {
|
|
58
|
+
key: 0,
|
|
59
|
+
class: "text-xs font-semibold leading-[1.2] text-[#1F2937] mb-[8px]"
|
|
60
|
+
}, Q = { class: "flex flex-col gap-[6px]" }, U = { class: "flex flex-row items-center justify-start" }, X = { class: "text-xs text-[#1F2937] font-normal leading-[1.2]" };
|
|
61
|
+
function Y(e, o, t, s, r, a) {
|
|
62
|
+
var y, b;
|
|
63
|
+
const n = u("legendIcon"), h = u("closeIcon");
|
|
64
|
+
return i(), p(w, null, [
|
|
65
|
+
l("div", {
|
|
66
|
+
class: "flex justify-center items-center rounded-md w-[32px] h-[32px] cursor-pointer bg-white p-1 border-[2px]",
|
|
67
|
+
onClick: o[0] || (o[0] = (d) => r.isOpenLegend = !r.isOpenLegend)
|
|
68
|
+
}, [
|
|
69
|
+
x(n)
|
|
70
|
+
]),
|
|
71
|
+
r.isOpenLegend ? (i(), C(P, {
|
|
72
|
+
key: 0,
|
|
73
|
+
to: `#wrapper-${t.mapId}`
|
|
74
|
+
}, [
|
|
75
|
+
l("div", A, [
|
|
76
|
+
l("div", G, [
|
|
77
|
+
o[2] || (o[2] = l("h3", { class: "text-[16px] font-normal text-black" }, "Легенда", -1)),
|
|
78
|
+
l("button", {
|
|
79
|
+
type: "button",
|
|
80
|
+
class: "inline-flex items-center text-sm font-medium text-gray-500 rounded-lg gap-x-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 dark:hover:text-blue-500 dark:focus:text-blue-500",
|
|
81
|
+
onClick: o[1] || (o[1] = (d) => r.isOpenLegend = !1)
|
|
82
|
+
}, [
|
|
83
|
+
x(h, { class: "w-[20px]" })
|
|
84
|
+
])
|
|
85
|
+
]),
|
|
86
|
+
l("div", W, [
|
|
87
|
+
(y = t.colors) != null && y.length ? (i(), p("div", Z, [
|
|
88
|
+
t.colorTitle ? (i(), p("h4", j, f(t.colorTitle), 1)) : m("", !0),
|
|
89
|
+
l("div", q, [
|
|
90
|
+
(i(!0), p(w, null, S(t.colors, (d, c) => (i(), p("div", {
|
|
91
|
+
key: c,
|
|
92
|
+
class: "flex items-center gap-[10px]"
|
|
93
|
+
}, [
|
|
94
|
+
d.color ? (i(), p("div", {
|
|
95
|
+
key: 0,
|
|
96
|
+
class: "w-[12px] h-[12px] rounded-full",
|
|
97
|
+
style: k({
|
|
98
|
+
backgroundColor: d.color
|
|
99
|
+
})
|
|
100
|
+
}, null, 4)) : m("", !0),
|
|
101
|
+
l("p", D, f(d.text || d.val), 1)
|
|
102
|
+
]))), 128))
|
|
103
|
+
])
|
|
104
|
+
])) : m("", !0),
|
|
105
|
+
(b = t.sizes) != null && b.length ? (i(), p("div", J, [
|
|
106
|
+
e.sizeTitle ? (i(), p("h4", K, f(e.sizeTitle), 1)) : m("", !0),
|
|
107
|
+
l("div", Q, [
|
|
108
|
+
a.sortedSizes.length ? (i(!0), p(w, { key: 0 }, S(a.sortedSizes, (d, c) => {
|
|
109
|
+
var g, v, _, z, M;
|
|
110
|
+
return i(), p("div", null, [
|
|
111
|
+
l("div", U, [
|
|
112
|
+
l("div", {
|
|
113
|
+
class: I([a.maxWidht ? `w-[${a.maxWidht}]` : "", "mr-[10px]"])
|
|
114
|
+
}, [
|
|
115
|
+
l("div", {
|
|
116
|
+
class: I(a.sizeClass(c)),
|
|
117
|
+
style: k({
|
|
118
|
+
backgroundColor: ((v = (g = r.palette) == null ? void 0 : g[t.color]) == null ? void 0 : v[c]) || t.color
|
|
119
|
+
})
|
|
120
|
+
}, null, 6)
|
|
121
|
+
], 2),
|
|
122
|
+
l("p", X, f(c === ((_ = a.sortedSizes) == null ? void 0 : _.length) - 1 ? ">" + d : c == ((z = a.sortedSizes) == null ? void 0 : z.length) - 1 ? ">" + a.sortedSizes[((M = a.sortedSizes) == null ? void 0 : M.length) - 1] : d + "-" + a.sortedSizes[c + 1]), 1)
|
|
123
|
+
])
|
|
124
|
+
]);
|
|
125
|
+
}), 256)) : m("", !0)
|
|
126
|
+
])
|
|
127
|
+
])) : m("", !0)
|
|
128
|
+
])
|
|
129
|
+
])
|
|
130
|
+
], 8, ["to"])) : m("", !0)
|
|
131
|
+
], 64);
|
|
132
|
+
}
|
|
133
|
+
const ee = /* @__PURE__ */ V(R, [["render", Y]]), te = {
|
|
134
|
+
components: {
|
|
135
|
+
VsMapSetting: T,
|
|
136
|
+
VsMapSlotLayers: B,
|
|
137
|
+
VsMapLegend: ee,
|
|
138
|
+
VsMapGoHome: H,
|
|
139
|
+
VsList: O
|
|
140
|
+
},
|
|
141
|
+
data() {
|
|
142
|
+
return {
|
|
143
|
+
mapId: `map-${Math.floor(Math.random() * 1e3)}`,
|
|
144
|
+
layerId: `layer${Math.floor(Math.random() * 1e3)}`,
|
|
145
|
+
map: null,
|
|
146
|
+
hoverData: null,
|
|
147
|
+
data: null,
|
|
148
|
+
coordinatesByMouse: [],
|
|
149
|
+
showSetting: !1,
|
|
150
|
+
popup: null,
|
|
151
|
+
color: "#69D2E7"
|
|
152
|
+
};
|
|
153
|
+
},
|
|
154
|
+
methods: {
|
|
155
|
+
async createMap() {
|
|
156
|
+
var o, t;
|
|
157
|
+
const e = {
|
|
158
|
+
version: 8,
|
|
159
|
+
glyphs: "https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",
|
|
160
|
+
sources: {},
|
|
161
|
+
layers: []
|
|
162
|
+
};
|
|
163
|
+
this.map = await new maplibregl.Map({
|
|
164
|
+
container: this.mapId,
|
|
165
|
+
style: e,
|
|
166
|
+
center: [31, 48.5],
|
|
167
|
+
zoom: ((t = (o = this.data) == null ? void 0 : o.style) == null ? void 0 : t.zoom) || 5,
|
|
168
|
+
minZoom: 3,
|
|
169
|
+
maxZoom: 20,
|
|
170
|
+
attributionControl: !1
|
|
171
|
+
}), this.map.addControl(
|
|
172
|
+
new maplibregl.NavigationControl({
|
|
173
|
+
visualizePitch: !0
|
|
174
|
+
})
|
|
175
|
+
), this.map.on("load", () => {
|
|
176
|
+
this.loadHandler();
|
|
177
|
+
}), this.map.on("mousemove", (s) => {
|
|
178
|
+
this.moveMouseHadler(s);
|
|
179
|
+
}), this.map.on("mouseout", () => {
|
|
180
|
+
var s;
|
|
181
|
+
this.showLegend = !1, this.showSetting = !1, this.coordinatesByMouse = 0, (s = this.popup) == null || s.remove();
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
getPopoverTitle(e) {
|
|
185
|
+
var o, t, s, r, a;
|
|
186
|
+
return (t = (o = this.data) == null ? void 0 : o.colors) != null && t.find((n) => n.val === e) ? (a = (r = (s = this.data) == null ? void 0 : s.colors) == null ? void 0 : r.find((n) => n.val === e)) == null ? void 0 : a.text : e;
|
|
187
|
+
},
|
|
188
|
+
moveMouseHadler(e) {
|
|
189
|
+
var o;
|
|
190
|
+
try {
|
|
191
|
+
const t = this.map.queryRenderedFeatures(e.point), s = ((o = t[0]) == null ? void 0 : o.properties) || {};
|
|
192
|
+
if (!t.length) {
|
|
193
|
+
this.map.getCanvas().style.cursor = "", this.popupElement && this.popupElement.remove();
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
this.map.getCanvas().style.cursor = "pointer", this.popupElement && this.popupElement.remove(), this.popupElement = document.createElement("div"), this.popupElement.className = "absolute text-gray-800 border border-gray-200 rounded-lg shadow-md min-w-28", this.popupElement.style.backgroundColor = "rgba(255, 255, 255, 0.7)", this.popupElement.innerHTML = `<div class="font-semibold text-sm border-b border-solid border-gray-200 text-gray-800 rounded-t-lg px-2 py-1">
|
|
197
|
+
${this.getPopoverTitle((s == null ? void 0 : s.x) || (s == null ? void 0 : s.title) || (s == null ? void 0 : s.name)) || ""}
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div class="flex justify-between items-center text-xs px-2 py-0.5 text-gray-500 ">
|
|
201
|
+
<span class="flex items-center">
|
|
202
|
+
<span class="font-medium mr-[6px]">Значення</span>
|
|
203
|
+
</span>
|
|
204
|
+
<span>${(s == null ? void 0 : s.metric) || 0}</span>
|
|
205
|
+
</div>`;
|
|
206
|
+
const r = this.map.project(e.lngLat);
|
|
207
|
+
this.popupElement.style.left = `${r.x}px`, this.popupElement.style.top = `${r.y - 60}px`, this.map.getContainer().appendChild(this.popupElement);
|
|
208
|
+
} catch (t) {
|
|
209
|
+
console.error(t);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}, se = {
|
|
214
|
+
mixins: [N, F, te],
|
|
215
|
+
name: "VsMap",
|
|
216
|
+
async mounted() {
|
|
217
|
+
await this.getMapData(), await this.createMap();
|
|
218
|
+
},
|
|
219
|
+
methods: {
|
|
220
|
+
async getMapData() {
|
|
221
|
+
const o = await (await fetch(
|
|
222
|
+
`/api/bi-map?widget=${this.widget}&dashboard=${this.dashboard}`
|
|
223
|
+
)).json();
|
|
224
|
+
this.data = o, this.$emit("update:widgetData", o), setTimeout(() => {
|
|
225
|
+
var t;
|
|
226
|
+
return (t = this.map) == null ? void 0 : t.resize();
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
async loadHandler() {
|
|
230
|
+
const e = ["#69D2E7", "yellow", "#FE4365"], o = this.data.colors ? ["match", ["get", "x"]].concat(
|
|
231
|
+
this.data.colors.reduce(
|
|
232
|
+
(a, n, h) => a.concat(n.val, (n == null ? void 0 : n.color) || e[h]),
|
|
233
|
+
[]
|
|
234
|
+
)
|
|
235
|
+
).concat(["gray"]) : "blue", t = [5, 7, 9, 11, 13], s = this.data.sizes ? ["case"] : 5;
|
|
236
|
+
this.data.sizes && (this.data.sizes.reverse().forEach((a, n) => {
|
|
237
|
+
s.push([">", ["get", "metric"], a]), s.push(t[n]);
|
|
238
|
+
}), s.push(5));
|
|
239
|
+
const r = {
|
|
240
|
+
type: "circle",
|
|
241
|
+
color: o,
|
|
242
|
+
width: 2,
|
|
243
|
+
radius: s,
|
|
244
|
+
stroke: "#eee"
|
|
245
|
+
};
|
|
246
|
+
Object.assign(r, this.data.style || {}), this.addVtileLayer({
|
|
247
|
+
id: "bi",
|
|
248
|
+
url: `${window.top.location.origin}/api/bi-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,
|
|
249
|
+
style: r
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}, oe = { class: "w-full h-full" }, ae = { class: "flex items-start justify-between mb-[6px] w-full" }, le = { class: "text-gray-800 font-[600]" }, re = ["id"], ne = ["id"], ie = { class: "absolute flex flex-col right-[10px] top-[105px] gap-1" };
|
|
254
|
+
function de(e, o, t, s, r, a) {
|
|
255
|
+
var d, c, g;
|
|
256
|
+
const n = u("VsMapSetting"), h = u("VsMapSlotLayers"), y = u("VsMapLegend"), b = u("VsMapGoHome");
|
|
257
|
+
return i(), p("div", oe, [
|
|
258
|
+
l("div", ae, [
|
|
259
|
+
l("h5", le, f(e.title), 1)
|
|
260
|
+
]),
|
|
261
|
+
l("div", {
|
|
262
|
+
class: "relative w-full h-[calc(100%-40px)]",
|
|
263
|
+
id: `wrapper-${e.mapId}`
|
|
264
|
+
}, [
|
|
265
|
+
l("div", {
|
|
266
|
+
id: e.mapId,
|
|
267
|
+
class: "w-full flex items-end relative h-full min-h-[250px]"
|
|
268
|
+
}, null, 8, ne),
|
|
269
|
+
e.showSetting ? (i(), C(n, {
|
|
270
|
+
key: 0,
|
|
271
|
+
map: e.map,
|
|
272
|
+
coordinates: e.coordinatesByMouse
|
|
273
|
+
}, null, 8, ["map", "coordinates"])) : m("", !0),
|
|
274
|
+
x(h, { map: e.map }, null, 8, ["map"]),
|
|
275
|
+
l("div", ie, [
|
|
276
|
+
x(y, {
|
|
277
|
+
mapId: e.mapId,
|
|
278
|
+
colors: (d = e.data) == null ? void 0 : d.colors,
|
|
279
|
+
sizes: (c = e.data) == null ? void 0 : c.sizes,
|
|
280
|
+
color: e.color,
|
|
281
|
+
resizeItem: "true"
|
|
282
|
+
}, null, 8, ["mapId", "colors", "sizes", "color"]),
|
|
283
|
+
x(b, {
|
|
284
|
+
map: e.map,
|
|
285
|
+
bbox: (g = e.data) == null ? void 0 : g.bounds
|
|
286
|
+
}, null, 8, ["map", "bbox"])
|
|
287
|
+
])
|
|
288
|
+
], 8, re)
|
|
289
|
+
]);
|
|
290
|
+
}
|
|
291
|
+
const ue = /* @__PURE__ */ V(se, [["render", de]]);
|
|
292
|
+
export {
|
|
293
|
+
ue as default
|
|
294
|
+
};
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { l as F, c as G, p as T, e as A, V as P, b as Z, d as q, a as D } from "./vs-list-BJ0NjSm5.js";
|
|
2
|
+
import { _ as x, c as K, V as W, e as j } from "./import-file-D06AZEtP.js";
|
|
3
|
+
import { openBlock as c, createElementBlock as p, createElementVNode as r, normalizeClass as I, Fragment as N, renderList as R, toDisplayString as O, normalizeStyle as J, createCommentVNode as S, createStaticVNode as Q, resolveComponent as g, createBlock as M, resolveDynamicComponent as U, withDirectives as k, createVNode as z, vShow as C } from "vue";
|
|
4
|
+
const X = {
|
|
5
|
+
components: { legendIcon: F, closeIcon: G },
|
|
6
|
+
props: {
|
|
7
|
+
mapId: { type: String },
|
|
8
|
+
colors: { type: Array },
|
|
9
|
+
sizes: { type: Array, default: () => [] },
|
|
10
|
+
cluster: { type: [Boolean, String] },
|
|
11
|
+
color: { type: String, default: "gray" },
|
|
12
|
+
colorTitle: { type: String },
|
|
13
|
+
sizesTitle: { type: String },
|
|
14
|
+
resizeItem: { type: [Boolean, String], default: !1 },
|
|
15
|
+
changeOpacityItem: { type: [Boolean, String], default: !1 }
|
|
16
|
+
},
|
|
17
|
+
data() {
|
|
18
|
+
return {
|
|
19
|
+
isOpenLegend: !1,
|
|
20
|
+
palette: T
|
|
21
|
+
// palette: ['#69D2E7', 'yellow', '#FE4365'],
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
computed: {
|
|
25
|
+
borderRadius() {
|
|
26
|
+
return this.cluster ? "rounded-sm" : "rounded-full";
|
|
27
|
+
},
|
|
28
|
+
sortedSizes() {
|
|
29
|
+
return [...this.sizes].sort((e, s) => e - s);
|
|
30
|
+
},
|
|
31
|
+
maxWidht() {
|
|
32
|
+
var n;
|
|
33
|
+
const e = ((n = this.sizes) == null ? void 0 : n.length) - 1;
|
|
34
|
+
return this.calcSize(e);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
sizeClass(e) {
|
|
39
|
+
return this.resizeItem ? `h-[${this.calcSize(e)}] w-[${this.calcSize(e)}] ${this.borderRadius}` : `h-[10px] ${this.borderRadius}`;
|
|
40
|
+
},
|
|
41
|
+
calcSize(e) {
|
|
42
|
+
return `${10 + e * 2}px`;
|
|
43
|
+
},
|
|
44
|
+
getOpacity(e) {
|
|
45
|
+
return (e + 1) / this.sortedSizes.length;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, Y = {
|
|
49
|
+
key: 0,
|
|
50
|
+
class: "absolute flex items-end w-fit bottom-[10px] max-w-[80%] left-[50%] translate-x-[-50%] bg-[rgba(255,255,255,0.7)] p-[10px] rounded"
|
|
51
|
+
}, $ = { class: "w-[80px] mr-[10px]" }, tt = ["title"], et = { class: "text-[10px] mb-[2px] text-[#1F2937] font-normal leading-[1.2]" };
|
|
52
|
+
function st(e, s, n, o, t, a) {
|
|
53
|
+
var h;
|
|
54
|
+
return (h = n.sizes) != null && h.length ? (c(), p("div", Y, [
|
|
55
|
+
r("div", $, [
|
|
56
|
+
s[0] || (s[0] = r("p", { class: "text-[10px] mb-[2px] text-[#1F2937] leading-[1.2]" }, " Дані відсутні ", -1)),
|
|
57
|
+
r("div", {
|
|
58
|
+
class: I([a.sizeClass(e.index), "w-full border border-gray-500"])
|
|
59
|
+
}, null, 2)
|
|
60
|
+
]),
|
|
61
|
+
a.sortedSizes.length ? (c(!0), p(N, { key: 0 }, R(a.sortedSizes, (d, i) => {
|
|
62
|
+
var u, m, w, f, y, b, v, _;
|
|
63
|
+
return c(), p("div", {
|
|
64
|
+
class: "w-[80px]",
|
|
65
|
+
title: i === ((u = a.sortedSizes) == null ? void 0 : u.length) - 1 ? ">" + d : i == ((m = a.sortedSizes) == null ? void 0 : m.length) - 1 ? ">" + a.sortedSizes[((w = a.sortedSizes) == null ? void 0 : w.length) - 1] : d + "-" + a.sortedSizes[i + 1]
|
|
66
|
+
}, [
|
|
67
|
+
r("p", et, O(i === ((f = a.sortedSizes) == null ? void 0 : f.length) - 1 ? ">" + parseInt(d) : i == ((y = a.sortedSizes) == null ? void 0 : y.length) - 1 ? ">" + parseInt(a.sortedSizes[((b = a.sortedSizes) == null ? void 0 : b.length) - 1]) : parseInt(d) + "-" + parseInt(a.sortedSizes[i + 1])), 1),
|
|
68
|
+
r("div", {
|
|
69
|
+
class: I([a.sizeClass(i), "w-full border border-r-0 border-gray-500"]),
|
|
70
|
+
style: J({
|
|
71
|
+
backgroundColor: ((_ = (v = t.palette) == null ? void 0 : v[n.color]) == null ? void 0 : _[i]) || n.color
|
|
72
|
+
})
|
|
73
|
+
}, null, 6)
|
|
74
|
+
], 8, tt);
|
|
75
|
+
}), 256)) : S("", !0)
|
|
76
|
+
])) : S("", !0);
|
|
77
|
+
}
|
|
78
|
+
const ot = /* @__PURE__ */ x(X, [["render", st]]), rt = {}, nt = {
|
|
79
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
80
|
+
width: "24",
|
|
81
|
+
height: "24",
|
|
82
|
+
viewBox: "0 0 24 24",
|
|
83
|
+
fill: "none",
|
|
84
|
+
stroke: "currentColor",
|
|
85
|
+
"stroke-width": "2",
|
|
86
|
+
"stroke-linecap": "round",
|
|
87
|
+
"stroke-linejoin": "round",
|
|
88
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-map"
|
|
89
|
+
};
|
|
90
|
+
function at(e, s) {
|
|
91
|
+
return c(), p("svg", nt, s[0] || (s[0] = [
|
|
92
|
+
r("path", {
|
|
93
|
+
stroke: "none",
|
|
94
|
+
d: "M0 0h24v24H0z",
|
|
95
|
+
fill: "none"
|
|
96
|
+
}, null, -1),
|
|
97
|
+
r("path", { d: "M3 7l6 -3l6 3l6 -3v13l-6 3l-6 -3l-6 3v-13" }, null, -1),
|
|
98
|
+
r("path", { d: "M9 4v13" }, null, -1),
|
|
99
|
+
r("path", { d: "M15 7v13" }, null, -1)
|
|
100
|
+
]));
|
|
101
|
+
}
|
|
102
|
+
const lt = /* @__PURE__ */ x(rt, [["render", at]]), it = {}, ct = {
|
|
103
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
104
|
+
width: "24",
|
|
105
|
+
height: "24",
|
|
106
|
+
viewBox: "0 0 24 24",
|
|
107
|
+
fill: "none",
|
|
108
|
+
stroke: "currentColor",
|
|
109
|
+
"stroke-width": "2",
|
|
110
|
+
"stroke-linecap": "round",
|
|
111
|
+
"stroke-linejoin": "round",
|
|
112
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-table"
|
|
113
|
+
};
|
|
114
|
+
function pt(e, s) {
|
|
115
|
+
return c(), p("svg", ct, s[0] || (s[0] = [
|
|
116
|
+
r("path", {
|
|
117
|
+
stroke: "none",
|
|
118
|
+
d: "M0 0h24v24H0z",
|
|
119
|
+
fill: "none"
|
|
120
|
+
}, null, -1),
|
|
121
|
+
r("path", { d: "M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z" }, null, -1),
|
|
122
|
+
r("path", { d: "M3 10h18" }, null, -1),
|
|
123
|
+
r("path", { d: "M10 3v18" }, null, -1)
|
|
124
|
+
]));
|
|
125
|
+
}
|
|
126
|
+
const dt = /* @__PURE__ */ x(it, [["render", pt]]), ht = {}, ut = {
|
|
127
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
128
|
+
width: "24",
|
|
129
|
+
height: "24",
|
|
130
|
+
viewBox: "0 0 24 24",
|
|
131
|
+
fill: "none",
|
|
132
|
+
stroke: "currentColor",
|
|
133
|
+
"stroke-width": "2",
|
|
134
|
+
"stroke-linecap": "round",
|
|
135
|
+
"stroke-linejoin": "round",
|
|
136
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-align-box-left-stretch"
|
|
137
|
+
};
|
|
138
|
+
function mt(e, s) {
|
|
139
|
+
return c(), p("svg", ut, s[0] || (s[0] = [
|
|
140
|
+
Q('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"></path><path d="M9 17h-2"></path><path d="M13 12h-6"></path><path d="M11 7h-4"></path>', 5)
|
|
141
|
+
]));
|
|
142
|
+
}
|
|
143
|
+
const gt = /* @__PURE__ */ x(ht, [["render", mt]]), ft = {
|
|
144
|
+
mixins: [K, A],
|
|
145
|
+
components: {
|
|
146
|
+
VsMapSetting: P,
|
|
147
|
+
VsClusterLegend: ot,
|
|
148
|
+
VsMapGoHome: Z,
|
|
149
|
+
VsList: q,
|
|
150
|
+
VsMapSlotLayers: D,
|
|
151
|
+
// VsListbar,
|
|
152
|
+
VsBar: W
|
|
153
|
+
},
|
|
154
|
+
data() {
|
|
155
|
+
return {
|
|
156
|
+
baseColor: "pink",
|
|
157
|
+
kattotg: "",
|
|
158
|
+
options: [
|
|
159
|
+
{ id: "map", text: "Карта", component: lt },
|
|
160
|
+
{ id: "table", text: "Таблиця", component: dt },
|
|
161
|
+
{ id: "chart", text: "Віджет", component: gt }
|
|
162
|
+
],
|
|
163
|
+
activeTab: "map",
|
|
164
|
+
mapId: `map-${Math.floor(Math.random() * 1e3)}`,
|
|
165
|
+
layerId: `layer${Math.floor(Math.random() * 1e3)}`,
|
|
166
|
+
map: null,
|
|
167
|
+
hoverData: null,
|
|
168
|
+
data: null,
|
|
169
|
+
coordinatesByMouse: [],
|
|
170
|
+
showSetting: !1,
|
|
171
|
+
popup: null,
|
|
172
|
+
color: "#69D2E7",
|
|
173
|
+
label: "<div><icon-map/></div>"
|
|
174
|
+
};
|
|
175
|
+
},
|
|
176
|
+
async mounted() {
|
|
177
|
+
await this.getMapData(), await this.createMap();
|
|
178
|
+
},
|
|
179
|
+
watch: {
|
|
180
|
+
kattotg() {
|
|
181
|
+
this.loadHandler();
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
methods: {
|
|
185
|
+
async getMapData() {
|
|
186
|
+
const e = await j.get(
|
|
187
|
+
`/bi-cluster?widget=${this.widget}&dashboard=${this.dashboard}`
|
|
188
|
+
);
|
|
189
|
+
this.data = e.data, this.$emit("update:widgetData", this.data), setTimeout(() => {
|
|
190
|
+
var s;
|
|
191
|
+
return (s = this.map) == null ? void 0 : s.resize();
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
async loadHandler() {
|
|
195
|
+
var o, t, a, h;
|
|
196
|
+
this.baseColor = ((o = this.data.style) == null ? void 0 : o.color) || "blue";
|
|
197
|
+
const e = ["case"];
|
|
198
|
+
(h = (a = (t = this.data) == null ? void 0 : t.sizes) == null ? void 0 : a.toReversed()) == null || h.forEach((d, i) => {
|
|
199
|
+
var u, m;
|
|
200
|
+
e.push([">", ["get", "metric"], d]), e.push((m = (u = T[this.baseColor]) == null ? void 0 : u.toReversed()) == null ? void 0 : m[i]), i++;
|
|
201
|
+
}), e.push("gray");
|
|
202
|
+
const s = {
|
|
203
|
+
type: "polygon",
|
|
204
|
+
color: e,
|
|
205
|
+
opacity: 0.4
|
|
206
|
+
};
|
|
207
|
+
Object.assign(s, this.data.style || {}), this.map.getSource("bi") || this.addVtileLayer({
|
|
208
|
+
id: "bi",
|
|
209
|
+
url: `${window.location.origin}/api/bi-cluster-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,
|
|
210
|
+
style: s
|
|
211
|
+
}), this.map.getLayer("highlighted") && this.map.removeLayer("highlighted"), this.map.getSource("highlighted") && this.map.removeSource("highlighted");
|
|
212
|
+
const n = ["case"];
|
|
213
|
+
this.kattotg && n.push(
|
|
214
|
+
["==", ["to-string", ["get", "name"]], String(this.kattotg)],
|
|
215
|
+
"red"
|
|
216
|
+
), n.push("transparent"), this.map.addLayer({
|
|
217
|
+
id: "highlighted",
|
|
218
|
+
type: "fill",
|
|
219
|
+
source: "bi",
|
|
220
|
+
"source-layer": "bi",
|
|
221
|
+
paint: {
|
|
222
|
+
"fill-color": n,
|
|
223
|
+
"fill-opacity": 0.6
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
},
|
|
227
|
+
async createMap() {
|
|
228
|
+
var s, n;
|
|
229
|
+
const e = {
|
|
230
|
+
version: 8,
|
|
231
|
+
glyphs: "https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",
|
|
232
|
+
sources: {},
|
|
233
|
+
layers: []
|
|
234
|
+
};
|
|
235
|
+
this.map = await new maplibregl.Map({
|
|
236
|
+
container: this.mapId,
|
|
237
|
+
style: e,
|
|
238
|
+
center: [31, 48.5],
|
|
239
|
+
zoom: ((n = (s = this.data) == null ? void 0 : s.style) == null ? void 0 : n.zoom) || 5,
|
|
240
|
+
minZoom: 3,
|
|
241
|
+
maxZoom: 20,
|
|
242
|
+
attributionControl: !1
|
|
243
|
+
}), this.map.addControl(
|
|
244
|
+
new maplibregl.NavigationControl({
|
|
245
|
+
visualizePitch: !0
|
|
246
|
+
})
|
|
247
|
+
), this.map.on("load", () => {
|
|
248
|
+
this.loadHandler();
|
|
249
|
+
}), this.map.on("mousemove", (o) => {
|
|
250
|
+
this.moveMouseHadler(o);
|
|
251
|
+
}), this.map.on("mouseout", () => {
|
|
252
|
+
var o;
|
|
253
|
+
this.showLegend = !1, this.showSetting = !1, this.coordinatesByMouse = 0, (o = this.popup) == null || o.remove();
|
|
254
|
+
});
|
|
255
|
+
},
|
|
256
|
+
moveMouseHadler(e) {
|
|
257
|
+
var s;
|
|
258
|
+
try {
|
|
259
|
+
const n = this.map.queryRenderedFeatures(e.point), o = ((s = n[0]) == null ? void 0 : s.properties) || {};
|
|
260
|
+
if (!n.length) {
|
|
261
|
+
this.map.getCanvas().style.cursor = "", this.popupElement && this.popupElement.remove();
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
this.map.getCanvas().style.cursor = "pointer", this.popupElement && this.popupElement.remove(), this.popupElement = document.createElement("div"), this.popupElement.className = "absolute text-gray-800 border border-gray-200 rounded-lg shadow-md min-w-28", this.popupElement.style.backgroundColor = "rgba(255, 255, 255, 0.7)", this.popupElement.innerHTML = `<div class="px-2 py-1 text-sm font-semibold text-gray-800 border-b border-gray-200 border-solid rounded-t-lg">
|
|
265
|
+
${(o == null ? void 0 : o.x) || (o == null ? void 0 : o.title) || (o == null ? void 0 : o.name) || ""}
|
|
266
|
+
</div>
|
|
267
|
+
|
|
268
|
+
<div class="flex justify-between items-center text-xs px-2 py-0.5 text-gray-500 ">
|
|
269
|
+
<span class="flex items-center">
|
|
270
|
+
<span class="font-medium mr-[6px]">Значення</span>
|
|
271
|
+
</span>
|
|
272
|
+
<span>${(o == null ? void 0 : o.metric) || 0}</span>
|
|
273
|
+
</div>`;
|
|
274
|
+
const t = this.map.project(e.lngLat);
|
|
275
|
+
this.popupElement.style.left = `${t.x}px`, this.popupElement.style.top = `${t.y - 60}px`, this.map.getContainer().appendChild(this.popupElement);
|
|
276
|
+
} catch (n) {
|
|
277
|
+
console.error(n);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}, yt = { class: "h-full" }, bt = { class: "flex items-start justify-between mb-[6px] w-full" }, vt = { class: "text-gray-800 font-[600]" }, _t = { class: "flex gap-2" }, xt = ["onClick"], wt = ["id"], zt = ["id"], St = { class: "absolute flex flex-col right-[10px] top-[105px] gap-1" }, Mt = { class: "h-[calc(250px)]" };
|
|
282
|
+
function kt(e, s, n, o, t, a) {
|
|
283
|
+
var f, y, b, v, _, V, L, E, B, H;
|
|
284
|
+
const h = g("VsMapSetting"), d = g("VsMapSlotLayers"), i = g("VsMapGoHome"), u = g("VsClusterLegend"), m = g("VsList"), w = g("VsBar");
|
|
285
|
+
return c(), p("div", yt, [
|
|
286
|
+
r("div", bt, [
|
|
287
|
+
r("h3", vt, O(e.title), 1),
|
|
288
|
+
r("div", _t, [
|
|
289
|
+
(c(!0), p(N, null, R(t.options, (l) => (c(), p("button", {
|
|
290
|
+
class: I(["p-1 text-gray-700 border rounded", [t.activeTab === (l == null ? void 0 : l.id) ? "ring-2 ring-blue-500" : ""]]),
|
|
291
|
+
onClick: (Ct) => t.activeTab = l == null ? void 0 : l.id
|
|
292
|
+
}, [
|
|
293
|
+
(c(), M(U(l == null ? void 0 : l.component), {
|
|
294
|
+
height: "16",
|
|
295
|
+
width: "16"
|
|
296
|
+
}))
|
|
297
|
+
], 10, xt))), 256))
|
|
298
|
+
])
|
|
299
|
+
]),
|
|
300
|
+
k(r("div", {
|
|
301
|
+
class: "relative w-full h-[calc(100%-40px)]",
|
|
302
|
+
id: `wrapper-${t.mapId}`
|
|
303
|
+
}, [
|
|
304
|
+
r("div", {
|
|
305
|
+
id: t.mapId,
|
|
306
|
+
class: "h-full w-full flex items-end min-h-[250px]"
|
|
307
|
+
}, null, 8, zt),
|
|
308
|
+
t.showSetting ? (c(), M(h, {
|
|
309
|
+
key: 0,
|
|
310
|
+
map: t.map,
|
|
311
|
+
coordinates: t.coordinatesByMouse
|
|
312
|
+
}, null, 8, ["map", "coordinates"])) : S("", !0),
|
|
313
|
+
z(d, { map: t.map }, null, 8, ["map"]),
|
|
314
|
+
r("div", St, [
|
|
315
|
+
z(i, {
|
|
316
|
+
map: t.map,
|
|
317
|
+
bbox: (f = t.data) == null ? void 0 : f.bounds
|
|
318
|
+
}, null, 8, ["map", "bbox"])
|
|
319
|
+
]),
|
|
320
|
+
z(u, {
|
|
321
|
+
mapId: t.mapId,
|
|
322
|
+
colors: (y = t.data) == null ? void 0 : y.colors,
|
|
323
|
+
sizes: (b = t.data) == null ? void 0 : b.sizes,
|
|
324
|
+
color: t.baseColor,
|
|
325
|
+
changeOpacityItem: "true",
|
|
326
|
+
cluster: "true"
|
|
327
|
+
}, null, 8, ["mapId", "colors", "sizes", "color"])
|
|
328
|
+
], 8, wt), [
|
|
329
|
+
[C, t.activeTab == "map"]
|
|
330
|
+
]),
|
|
331
|
+
k(z(m, {
|
|
332
|
+
mapId: t.mapId,
|
|
333
|
+
source: (v = t.data) == null ? void 0 : v.rows,
|
|
334
|
+
total: ((_ = t.data) == null ? void 0 : _.total) || 0,
|
|
335
|
+
count: ((V = t.data) == null ? void 0 : V.count) || 0,
|
|
336
|
+
onKattotg: s[0] || (s[0] = (l) => t.kattotg = l)
|
|
337
|
+
}, null, 8, ["mapId", "source", "total", "count"]), [
|
|
338
|
+
[C, t.activeTab == "table"]
|
|
339
|
+
]),
|
|
340
|
+
k(r("div", Mt, [
|
|
341
|
+
(E = (L = t.data) == null ? void 0 : L.rows) != null && E.length ? (c(), M(w, {
|
|
342
|
+
key: 0,
|
|
343
|
+
source: (H = (B = t.data) == null ? void 0 : B.rows) == null ? void 0 : H.map((l) => ({
|
|
344
|
+
title: l == null ? void 0 : l.title,
|
|
345
|
+
metric: l == null ? void 0 : l.metric
|
|
346
|
+
}))
|
|
347
|
+
}, null, 8, ["source"])) : S("", !0)
|
|
348
|
+
], 512), [
|
|
349
|
+
[C, t.activeTab == "chart"]
|
|
350
|
+
])
|
|
351
|
+
]);
|
|
352
|
+
}
|
|
353
|
+
const Et = /* @__PURE__ */ x(ft, [["render", kt]]);
|
|
354
|
+
export {
|
|
355
|
+
Et as default
|
|
356
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as c, c as o, f as n } from "./import-file-
|
|
2
|
-
import {
|
|
1
|
+
import { _ as c, c as o, f as n } from "./import-file-D06AZEtP.js";
|
|
2
|
+
import { openBlock as i, createElementBlock as m, toDisplayString as s } from "vue";
|
|
3
3
|
const u = {
|
|
4
4
|
name: "VsNumber",
|
|
5
5
|
mixins: [o],
|
|
@@ -47,7 +47,7 @@ const u = {
|
|
|
47
47
|
}
|
|
48
48
|
}, h = { class: "text-lg lg:text-xl xl:text-2xl text-gray-800 h-[32px] flex items-center" };
|
|
49
49
|
function x(e, t, r, f, l, a) {
|
|
50
|
-
return
|
|
50
|
+
return i(), m("div", h, s(a.prefix) + s(a.formattedNumber), 1);
|
|
51
51
|
}
|
|
52
52
|
const b = /* @__PURE__ */ c(u, [["render", x]]);
|
|
53
53
|
export {
|