@opengis/bi 1.1.0 → 1.1.2
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/config.js +12 -12
- package/dist/assets/charts/bar.png +0 -0
- package/dist/assets/charts/funnel.png +0 -0
- package/dist/assets/charts/no_data.jpg +0 -0
- package/dist/assets/charts/number.png +0 -0
- package/dist/assets/charts/pie.png +0 -0
- package/dist/assets/charts/progress.png +0 -0
- package/dist/assets/charts/stat.png +0 -0
- package/dist/assets/images/bar.png +0 -0
- package/dist/assets/images/funnel.png +0 -0
- package/dist/assets/images/no_data.jpg +0 -0
- package/dist/assets/images/number.png +0 -0
- package/dist/assets/images/pie.png +0 -0
- package/dist/assets/images/progress.png +0 -0
- package/dist/assets/images/stat.png +0 -0
- package/dist/bi.js +4 -0
- package/dist/bi.umd.cjs +749 -0
- package/dist/favicon.ico +0 -0
- package/dist/import-file-XFI3CaVb.js +63458 -0
- package/dist/style.css +7 -0
- package/dist/vs-donut-al85JwBt.js +148 -0
- package/dist/vs-funnel-bar-mWZ8lvEq.js +116 -0
- package/dist/vs-list-1QDnN3pH.js +18510 -0
- package/dist/vs-map-CwR6ZYur.js +285 -0
- package/dist/vs-map-cluster-YdXTBIVf.js +314 -0
- package/dist/vs-number-CRUhHKym.js +55 -0
- package/dist/vs-table-OddIdr1s.js +71 -0
- package/dist/vs-text-CQ9vn0qO.js +40 -0
- package/package.json +7 -12
- package/server/plugins/vite.js +69 -69
- package/server/routes/dashboard/controllers/utils/yaml.js +11 -11
- package/server/routes/dataset/controllers/createDatasetPost.js +1 -2
- package/server/routes/dataset/utils/convertJSONToXls.js +1 -3
- 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/utils.js +12 -12
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { c as L, l as $, p as T, V as B, a as H, b as O, d as F, m as S, e as N } from "./vs-list-1QDnN3pH.js";
|
|
2
|
+
import { _ as C, c as P } from "./import-file-XFI3CaVb.js";
|
|
3
|
+
import { resolveComponent as u, createElementBlock as p, openBlock as i, Fragment as v, createElementVNode as r, createBlock as E, createCommentVNode as m, createVNode as f, Teleport as R, toDisplayString as b, renderList as k, normalizeStyle as I, normalizeClass as V } from "vue";
|
|
4
|
+
const A = {
|
|
5
|
+
components: { legendIcon: $, 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: 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, t) => e - t);
|
|
30
|
+
},
|
|
31
|
+
maxWidht() {
|
|
32
|
+
var s;
|
|
33
|
+
const e = ((s = this.sizes) == null ? void 0 : s.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
|
+
}, G = { class: "w-full absolute max-w-[200px] bg-white border rounded-lg bottom-[10px] right-[50px]" }, W = { class: "flex items-center justify-between border-b border-[#0000001A] px-2" }, Z = { 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" }, q = {
|
|
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
|
+
}, J = { class: "flex flex-col gap-[6px]" }, K = { class: "text-xs text-[#1F2937] font-normal leading-[1.2]" }, Q = {
|
|
55
|
+
key: 1,
|
|
56
|
+
class: "flex flex-col w-full"
|
|
57
|
+
}, U = {
|
|
58
|
+
key: 0,
|
|
59
|
+
class: "text-xs font-semibold leading-[1.2] text-[#1F2937] mb-[8px]"
|
|
60
|
+
}, X = { class: "flex flex-col gap-[6px]" }, Y = { class: "flex flex-row items-center justify-start" }, D = { class: "text-xs text-[#1F2937] font-normal leading-[1.2]" };
|
|
61
|
+
function ee(e, t, s, o, l, a) {
|
|
62
|
+
var x, y;
|
|
63
|
+
const n = u("legendIcon"), h = u("closeIcon");
|
|
64
|
+
return i(), p(v, null, [
|
|
65
|
+
r("div", {
|
|
66
|
+
class: "flex justify-center items-center rounded-md w-[32px] h-[32px] cursor-pointer bg-white p-1 border-[2px]",
|
|
67
|
+
onClick: t[0] || (t[0] = (d) => l.isOpenLegend = !l.isOpenLegend)
|
|
68
|
+
}, [
|
|
69
|
+
f(n)
|
|
70
|
+
]),
|
|
71
|
+
l.isOpenLegend ? (i(), E(R, {
|
|
72
|
+
key: 0,
|
|
73
|
+
to: `#wrapper-${s.mapId}`
|
|
74
|
+
}, [
|
|
75
|
+
r("div", G, [
|
|
76
|
+
r("div", W, [
|
|
77
|
+
t[2] || (t[2] = r("h3", { class: "text-[16px] font-normal text-black" }, "Легенда", -1)),
|
|
78
|
+
r("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: t[1] || (t[1] = (d) => l.isOpenLegend = !1)
|
|
82
|
+
}, [
|
|
83
|
+
f(h, { class: "w-[20px]" })
|
|
84
|
+
])
|
|
85
|
+
]),
|
|
86
|
+
r("div", Z, [
|
|
87
|
+
(x = s.colors) != null && x.length ? (i(), p("div", q, [
|
|
88
|
+
s.colorTitle ? (i(), p("h4", j, b(s.colorTitle), 1)) : m("", !0),
|
|
89
|
+
r("div", J, [
|
|
90
|
+
(i(!0), p(v, null, k(s.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: I({
|
|
98
|
+
backgroundColor: d.color
|
|
99
|
+
})
|
|
100
|
+
}, null, 4)) : m("", !0),
|
|
101
|
+
r("p", K, b(d.text || d.val), 1)
|
|
102
|
+
]))), 128))
|
|
103
|
+
])
|
|
104
|
+
])) : m("", !0),
|
|
105
|
+
(y = s.sizes) != null && y.length ? (i(), p("div", Q, [
|
|
106
|
+
e.sizeTitle ? (i(), p("h4", U, b(e.sizeTitle), 1)) : m("", !0),
|
|
107
|
+
r("div", X, [
|
|
108
|
+
a.sortedSizes.length ? (i(!0), p(v, { key: 0 }, k(a.sortedSizes, (d, c) => {
|
|
109
|
+
var g, w, z, _, M;
|
|
110
|
+
return i(), p("div", null, [
|
|
111
|
+
r("div", Y, [
|
|
112
|
+
r("div", {
|
|
113
|
+
class: V([a.maxWidht ? `w-[${a.maxWidht}]` : "", "mr-[10px]"])
|
|
114
|
+
}, [
|
|
115
|
+
r("div", {
|
|
116
|
+
class: V(a.sizeClass(c)),
|
|
117
|
+
style: I({
|
|
118
|
+
backgroundColor: ((w = (g = l.palette) == null ? void 0 : g[s.color]) == null ? void 0 : w[c]) || s.color
|
|
119
|
+
})
|
|
120
|
+
}, null, 6)
|
|
121
|
+
], 2),
|
|
122
|
+
r("p", D, b(c === ((z = a.sortedSizes) == null ? void 0 : z.length) - 1 ? ">" + d : c == ((_ = a.sortedSizes) == null ? void 0 : _.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 te = /* @__PURE__ */ C(A, [["render", ee]]), se = {
|
|
134
|
+
components: {
|
|
135
|
+
VsMapSetting: F,
|
|
136
|
+
VsMapSlotLayers: O,
|
|
137
|
+
VsMapLegend: te,
|
|
138
|
+
VsMapGoHome: H,
|
|
139
|
+
VsList: B
|
|
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
|
+
const e = {
|
|
157
|
+
version: 8,
|
|
158
|
+
glyphs: "https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",
|
|
159
|
+
sources: {},
|
|
160
|
+
layers: []
|
|
161
|
+
};
|
|
162
|
+
this.map = await new S.Map({
|
|
163
|
+
container: this.mapId,
|
|
164
|
+
style: e,
|
|
165
|
+
center: [31, 48.5],
|
|
166
|
+
zoom: 5,
|
|
167
|
+
minZoom: 3,
|
|
168
|
+
maxZoom: 20,
|
|
169
|
+
attributionControl: !1
|
|
170
|
+
}), this.map.addControl(
|
|
171
|
+
new S.NavigationControl({
|
|
172
|
+
visualizePitch: !0
|
|
173
|
+
})
|
|
174
|
+
), this.map.on("load", () => {
|
|
175
|
+
this.loadHandler();
|
|
176
|
+
}), this.map.on("mousemove", (t) => {
|
|
177
|
+
this.moveMouseHadler(t);
|
|
178
|
+
}), this.map.on("mouseout", () => {
|
|
179
|
+
var t;
|
|
180
|
+
this.showLegend = !1, this.showSetting = !1, this.coordinatesByMouse = 0, (t = this.popup) == null || t.remove();
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
getPopoverTitle(e) {
|
|
184
|
+
var t, s, o, l, a;
|
|
185
|
+
return (s = (t = this.data) == null ? void 0 : t.colors) != null && s.find((n) => n.val === e) ? (a = (l = (o = this.data) == null ? void 0 : o.colors) == null ? void 0 : l.find((n) => n.val === e)) == null ? void 0 : a.text : e;
|
|
186
|
+
},
|
|
187
|
+
moveMouseHadler(e) {
|
|
188
|
+
var t;
|
|
189
|
+
try {
|
|
190
|
+
const s = this.map.queryRenderedFeatures(e.point), o = ((t = s[0]) == null ? void 0 : t.properties) || {};
|
|
191
|
+
if (!s.length) {
|
|
192
|
+
this.map.getCanvas().style.cursor = "", this.popupElement && this.popupElement.remove();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
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">
|
|
196
|
+
${this.getPopoverTitle((o == null ? void 0 : o.x) || (o == null ? void 0 : o.title) || (o == null ? void 0 : o.name)) || ""}
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div class="flex justify-between items-center text-xs px-2 py-0.5 text-gray-500 ">
|
|
200
|
+
<span class="flex items-center">
|
|
201
|
+
<span class="font-medium mr-[6px]">Значення</span>
|
|
202
|
+
</span>
|
|
203
|
+
<span>${(o == null ? void 0 : o.metric) || 0}</span>
|
|
204
|
+
</div>`;
|
|
205
|
+
const l = this.map.project(e.lngLat);
|
|
206
|
+
this.popupElement.style.left = `${l.x}px`, this.popupElement.style.top = `${l.y - 60}px`, this.map.getContainer().appendChild(this.popupElement);
|
|
207
|
+
} catch (s) {
|
|
208
|
+
console.error(s);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}, oe = {
|
|
213
|
+
mixins: [P, N, se],
|
|
214
|
+
name: "VsMap",
|
|
215
|
+
async mounted() {
|
|
216
|
+
await this.getMapData(), await this.createMap();
|
|
217
|
+
},
|
|
218
|
+
methods: {
|
|
219
|
+
async getMapData() {
|
|
220
|
+
const t = await (await fetch(
|
|
221
|
+
`/api/bi-map?widget=${this.widget}&dashboard=${this.dashboard}`
|
|
222
|
+
)).json();
|
|
223
|
+
this.data = t;
|
|
224
|
+
},
|
|
225
|
+
async loadHandler() {
|
|
226
|
+
const e = ["#69D2E7", "yellow", "#FE4365"], t = this.data.colors ? ["match", ["get", "x"]].concat(
|
|
227
|
+
this.data.colors.reduce(
|
|
228
|
+
(a, n, h) => a.concat(n.val, (n == null ? void 0 : n.color) || e[h]),
|
|
229
|
+
[]
|
|
230
|
+
)
|
|
231
|
+
).concat(["gray"]) : "blue", s = [5, 7, 9, 11, 13], o = this.data.sizes ? ["case"] : 5;
|
|
232
|
+
this.data.sizes && (this.data.sizes.reverse().forEach((a, n) => {
|
|
233
|
+
o.push([">", ["get", "metric"], a]), o.push(s[n]);
|
|
234
|
+
}), o.push(5));
|
|
235
|
+
const l = {
|
|
236
|
+
type: "circle",
|
|
237
|
+
color: t,
|
|
238
|
+
width: 2,
|
|
239
|
+
radius: o,
|
|
240
|
+
stroke: "#eee"
|
|
241
|
+
};
|
|
242
|
+
Object.assign(l, this.data.style || {}), this.addVtileLayer({
|
|
243
|
+
id: "bi",
|
|
244
|
+
url: `${window.top.location.origin}/api/bi-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,
|
|
245
|
+
style: l
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}, ae = ["id"], le = ["id"], re = { class: "absolute flex flex-col right-[10px] top-[105px] gap-1" };
|
|
250
|
+
function ne(e, t, s, o, l, a) {
|
|
251
|
+
var d, c, g;
|
|
252
|
+
const n = u("VsMapSetting"), h = u("VsMapSlotLayers"), x = u("VsMapLegend"), y = u("VsMapGoHome");
|
|
253
|
+
return i(), p("div", {
|
|
254
|
+
class: "relative w-full h-full",
|
|
255
|
+
id: `wrapper-${e.mapId}`
|
|
256
|
+
}, [
|
|
257
|
+
r("div", {
|
|
258
|
+
id: e.mapId,
|
|
259
|
+
class: "w-full flex items-end relative h-[250px]"
|
|
260
|
+
}, null, 8, le),
|
|
261
|
+
e.showSetting ? (i(), E(n, {
|
|
262
|
+
key: 0,
|
|
263
|
+
map: e.map,
|
|
264
|
+
coordinates: e.coordinatesByMouse
|
|
265
|
+
}, null, 8, ["map", "coordinates"])) : m("", !0),
|
|
266
|
+
f(h, { map: e.map }, null, 8, ["map"]),
|
|
267
|
+
r("div", re, [
|
|
268
|
+
f(x, {
|
|
269
|
+
mapId: e.mapId,
|
|
270
|
+
colors: (d = e.data) == null ? void 0 : d.colors,
|
|
271
|
+
sizes: (c = e.data) == null ? void 0 : c.sizes,
|
|
272
|
+
color: e.color,
|
|
273
|
+
resizeItem: "true"
|
|
274
|
+
}, null, 8, ["mapId", "colors", "sizes", "color"]),
|
|
275
|
+
f(y, {
|
|
276
|
+
map: e.map,
|
|
277
|
+
bbox: (g = e.data) == null ? void 0 : g.bounds
|
|
278
|
+
}, null, 8, ["map", "bbox"])
|
|
279
|
+
])
|
|
280
|
+
], 8, ae);
|
|
281
|
+
}
|
|
282
|
+
const ce = /* @__PURE__ */ C(oe, [["render", ne]]);
|
|
283
|
+
export {
|
|
284
|
+
ce as default
|
|
285
|
+
};
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { c as G, l as A, p as R, b as P, V as Z, a as q, d as D, e as K, m as H } from "./vs-list-1QDnN3pH.js";
|
|
2
|
+
import { _ as V, V as W, c as J, e as Q, I as U, g as X } from "./import-file-XFI3CaVb.js";
|
|
3
|
+
import { createElementBlock as m, createCommentVNode as S, openBlock as p, createElementVNode as l, normalizeClass as I, Fragment as N, renderList as O, toDisplayString as F, normalizeStyle as Y, resolveComponent as g, withDirectives as z, createBlock as M, resolveDynamicComponent as j, createVNode as w, vShow as C } from "vue";
|
|
4
|
+
const $ = {
|
|
5
|
+
components: { legendIcon: A, 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: R
|
|
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((t, s) => t - s);
|
|
30
|
+
},
|
|
31
|
+
maxWidht() {
|
|
32
|
+
var n;
|
|
33
|
+
const t = ((n = this.sizes) == null ? void 0 : n.length) - 1;
|
|
34
|
+
return this.calcSize(t);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
sizeClass(t) {
|
|
39
|
+
return this.resizeItem ? `h-[${this.calcSize(t)}] w-[${this.calcSize(t)}] ${this.borderRadius}` : `h-[10px] ${this.borderRadius}`;
|
|
40
|
+
},
|
|
41
|
+
calcSize(t) {
|
|
42
|
+
return `${10 + t * 2}px`;
|
|
43
|
+
},
|
|
44
|
+
getOpacity(t) {
|
|
45
|
+
return (t + 1) / this.sortedSizes.length;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, ee = {
|
|
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
|
+
}, te = { class: "w-[80px] mr-[10px]" }, se = ["title"], oe = { class: "text-[10px] mb-[2px] text-[#1F2937] font-normal leading-[1.2]" };
|
|
52
|
+
function re(t, s, n, a, e, o) {
|
|
53
|
+
var d;
|
|
54
|
+
return (d = n.sizes) != null && d.length ? (p(), m("div", ee, [
|
|
55
|
+
l("div", te, [
|
|
56
|
+
s[0] || (s[0] = l("p", { class: "text-[10px] mb-[2px] text-[#1F2937] leading-[1.2]" }, " Дані відсутні ", -1)),
|
|
57
|
+
l("div", {
|
|
58
|
+
class: I([o.sizeClass(t.index), "w-full border border-gray-500"])
|
|
59
|
+
}, null, 2)
|
|
60
|
+
]),
|
|
61
|
+
o.sortedSizes.length ? (p(!0), m(N, { key: 0 }, O(o.sortedSizes, (c, i) => {
|
|
62
|
+
var h, u, _, y, f, b, v, x;
|
|
63
|
+
return p(), m("div", {
|
|
64
|
+
class: "w-[80px]",
|
|
65
|
+
title: i === ((h = o.sortedSizes) == null ? void 0 : h.length) - 1 ? ">" + c : i == ((u = o.sortedSizes) == null ? void 0 : u.length) - 1 ? ">" + o.sortedSizes[((_ = o.sortedSizes) == null ? void 0 : _.length) - 1] : c + "-" + o.sortedSizes[i + 1]
|
|
66
|
+
}, [
|
|
67
|
+
l("p", oe, F(i === ((y = o.sortedSizes) == null ? void 0 : y.length) - 1 ? ">" + parseInt(c) : i == ((f = o.sortedSizes) == null ? void 0 : f.length) - 1 ? ">" + parseInt(o.sortedSizes[((b = o.sortedSizes) == null ? void 0 : b.length) - 1]) : parseInt(c) + "-" + parseInt(o.sortedSizes[i + 1])), 1),
|
|
68
|
+
l("div", {
|
|
69
|
+
class: I([o.sizeClass(i), "w-full border border-r-0 border-gray-500"]),
|
|
70
|
+
style: Y({
|
|
71
|
+
backgroundColor: ((x = (v = e.palette) == null ? void 0 : v[n.color]) == null ? void 0 : x[i]) || n.color
|
|
72
|
+
})
|
|
73
|
+
}, null, 6)
|
|
74
|
+
], 8, se);
|
|
75
|
+
}), 256)) : S("", !0)
|
|
76
|
+
])) : S("", !0);
|
|
77
|
+
}
|
|
78
|
+
const ae = /* @__PURE__ */ V($, [["render", re]]), ne = {}, le = {
|
|
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 ie(t, s) {
|
|
91
|
+
return p(), m("svg", le, s[0] || (s[0] = [
|
|
92
|
+
l("path", {
|
|
93
|
+
stroke: "none",
|
|
94
|
+
d: "M0 0h24v24H0z",
|
|
95
|
+
fill: "none"
|
|
96
|
+
}, null, -1),
|
|
97
|
+
l("path", { d: "M3 7l6 -3l6 3l6 -3v13l-6 3l-6 -3l-6 3v-13" }, null, -1),
|
|
98
|
+
l("path", { d: "M9 4v13" }, null, -1),
|
|
99
|
+
l("path", { d: "M15 7v13" }, null, -1)
|
|
100
|
+
]));
|
|
101
|
+
}
|
|
102
|
+
const pe = /* @__PURE__ */ V(ne, [["render", ie]]), ce = {
|
|
103
|
+
mixins: [J, K],
|
|
104
|
+
components: {
|
|
105
|
+
VsMapSetting: D,
|
|
106
|
+
VsClusterLegend: ae,
|
|
107
|
+
VsMapGoHome: q,
|
|
108
|
+
VsList: Z,
|
|
109
|
+
VsMapSlotLayers: P,
|
|
110
|
+
// VsListbar,
|
|
111
|
+
VsBar: W
|
|
112
|
+
},
|
|
113
|
+
data() {
|
|
114
|
+
return {
|
|
115
|
+
baseColor: "pink",
|
|
116
|
+
kattotg: "",
|
|
117
|
+
options: [
|
|
118
|
+
{ id: "map", text: "Карта", component: pe },
|
|
119
|
+
{ id: "table", text: "Таблиця", component: U },
|
|
120
|
+
{ id: "chart", text: "Віджет", component: X }
|
|
121
|
+
],
|
|
122
|
+
activeTab: "map",
|
|
123
|
+
mapId: `map-${Math.floor(Math.random() * 1e3)}`,
|
|
124
|
+
layerId: `layer${Math.floor(Math.random() * 1e3)}`,
|
|
125
|
+
map: null,
|
|
126
|
+
hoverData: null,
|
|
127
|
+
data: null,
|
|
128
|
+
coordinatesByMouse: [],
|
|
129
|
+
showSetting: !1,
|
|
130
|
+
popup: null,
|
|
131
|
+
color: "#69D2E7",
|
|
132
|
+
label: "<div><icon-map/></div>"
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
async mounted() {
|
|
136
|
+
await this.getMapData(), await this.createMap();
|
|
137
|
+
},
|
|
138
|
+
watch: {
|
|
139
|
+
kattotg() {
|
|
140
|
+
this.loadHandler();
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
methods: {
|
|
144
|
+
async getMapData() {
|
|
145
|
+
const t = await Q.get(
|
|
146
|
+
`/bi-cluster?widget=${this.widget}&dashboard=${this.dashboard}`
|
|
147
|
+
);
|
|
148
|
+
this.data = t.data, this.$emit("update:widgetData", this.data), setTimeout(() => {
|
|
149
|
+
var s;
|
|
150
|
+
return (s = this.map) == null ? void 0 : s.resize();
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
async loadHandler() {
|
|
154
|
+
var a, e, o, d;
|
|
155
|
+
this.baseColor = ((a = this.data.style) == null ? void 0 : a.color) || "blue";
|
|
156
|
+
const t = ["case"];
|
|
157
|
+
(d = (o = (e = this.data) == null ? void 0 : e.sizes) == null ? void 0 : o.toReversed()) == null || d.forEach((c, i) => {
|
|
158
|
+
var h, u;
|
|
159
|
+
t.push([">", ["get", "metric"], c]), t.push((u = (h = R[this.baseColor]) == null ? void 0 : h.toReversed()) == null ? void 0 : u[i]), i++;
|
|
160
|
+
}), t.push("gray");
|
|
161
|
+
const s = {
|
|
162
|
+
type: "polygon",
|
|
163
|
+
color: t,
|
|
164
|
+
opacity: 0.4
|
|
165
|
+
};
|
|
166
|
+
Object.assign(s, this.data.style || {}), this.map.getSource("bi") || this.addVtileLayer({
|
|
167
|
+
id: "bi",
|
|
168
|
+
url: `${window.location.origin}/api/bi-cluster-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,
|
|
169
|
+
style: s
|
|
170
|
+
}), this.map.getLayer("highlighted") && this.map.removeLayer("highlighted"), this.map.getSource("highlighted") && this.map.removeSource("highlighted");
|
|
171
|
+
const n = ["case"];
|
|
172
|
+
this.kattotg && n.push(
|
|
173
|
+
["==", ["to-string", ["get", "name"]], String(this.kattotg)],
|
|
174
|
+
"red"
|
|
175
|
+
), n.push("transparent"), this.map.addLayer({
|
|
176
|
+
id: "highlighted",
|
|
177
|
+
type: "fill",
|
|
178
|
+
source: "bi",
|
|
179
|
+
"source-layer": "bi",
|
|
180
|
+
paint: {
|
|
181
|
+
"fill-color": n,
|
|
182
|
+
"fill-opacity": 0.6
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
async createMap() {
|
|
187
|
+
const t = {
|
|
188
|
+
version: 8,
|
|
189
|
+
glyphs: "https://cdn.softpro.ua/data/fonts/{fontstack}/{range}.pbf",
|
|
190
|
+
sources: {},
|
|
191
|
+
layers: []
|
|
192
|
+
};
|
|
193
|
+
this.map = await new H.Map({
|
|
194
|
+
container: this.mapId,
|
|
195
|
+
style: t,
|
|
196
|
+
center: [31, 48.5],
|
|
197
|
+
zoom: 5,
|
|
198
|
+
minZoom: 3,
|
|
199
|
+
maxZoom: 20,
|
|
200
|
+
attributionControl: !1
|
|
201
|
+
}), this.map.addControl(
|
|
202
|
+
new H.NavigationControl({
|
|
203
|
+
visualizePitch: !0
|
|
204
|
+
})
|
|
205
|
+
), this.map.on("load", () => {
|
|
206
|
+
this.loadHandler();
|
|
207
|
+
}), this.map.on("mousemove", (s) => {
|
|
208
|
+
this.moveMouseHadler(s);
|
|
209
|
+
}), this.map.on("mouseout", () => {
|
|
210
|
+
var s;
|
|
211
|
+
this.showLegend = !1, this.showSetting = !1, this.coordinatesByMouse = 0, (s = this.popup) == null || s.remove();
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
moveMouseHadler(t) {
|
|
215
|
+
var s;
|
|
216
|
+
try {
|
|
217
|
+
const n = this.map.queryRenderedFeatures(t.point), a = ((s = n[0]) == null ? void 0 : s.properties) || {};
|
|
218
|
+
if (!n.length) {
|
|
219
|
+
this.map.getCanvas().style.cursor = "", this.popupElement && this.popupElement.remove();
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
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">
|
|
223
|
+
${(a == null ? void 0 : a.x) || (a == null ? void 0 : a.title) || (a == null ? void 0 : a.name) || ""}
|
|
224
|
+
</div>
|
|
225
|
+
|
|
226
|
+
<div class="flex justify-between items-center text-xs px-2 py-0.5 text-gray-500 ">
|
|
227
|
+
<span class="flex items-center">
|
|
228
|
+
<span class="font-medium mr-[6px]">Значення</span>
|
|
229
|
+
</span>
|
|
230
|
+
<span>${(a == null ? void 0 : a.metric) || 0}</span>
|
|
231
|
+
</div>`;
|
|
232
|
+
const e = this.map.project(t.lngLat);
|
|
233
|
+
this.popupElement.style.left = `${e.x}px`, this.popupElement.style.top = `${e.y - 60}px`, this.map.getContainer().appendChild(this.popupElement);
|
|
234
|
+
} catch (n) {
|
|
235
|
+
console.error(n);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}, de = { class: "h-full" }, he = { class: "flex items-start justify-between mb-[6px] w-full" }, ue = { class: "text-gray-800 font-[600]" }, me = { class: "flex gap-2" }, ge = ["onClick"], ye = ["id"], fe = ["id"], be = { class: "absolute flex flex-col right-[10px] top-[105px] gap-1" }, ve = { class: "h-[calc(250px)]" };
|
|
240
|
+
function xe(t, s, n, a, e, o) {
|
|
241
|
+
var y, f, b, v, x, k, L, E, B, T;
|
|
242
|
+
const d = g("VsMapSetting"), c = g("VsMapSlotLayers"), i = g("VsMapGoHome"), h = g("VsClusterLegend"), u = g("VsList"), _ = g("VsBar");
|
|
243
|
+
return p(), m("div", de, [
|
|
244
|
+
l("div", he, [
|
|
245
|
+
l("h3", ue, F(t.title), 1),
|
|
246
|
+
l("div", me, [
|
|
247
|
+
(p(!0), m(N, null, O(e.options, (r) => (p(), m("button", {
|
|
248
|
+
class: I(["p-1 text-gray-700 border rounded", [e.activeTab === (r == null ? void 0 : r.id) ? "ring-2 ring-blue-500" : ""]]),
|
|
249
|
+
onClick: (_e) => e.activeTab = r == null ? void 0 : r.id
|
|
250
|
+
}, [
|
|
251
|
+
(p(), M(j(r == null ? void 0 : r.component), {
|
|
252
|
+
height: "16",
|
|
253
|
+
width: "16"
|
|
254
|
+
}))
|
|
255
|
+
], 10, ge))), 256))
|
|
256
|
+
])
|
|
257
|
+
]),
|
|
258
|
+
z(l("div", {
|
|
259
|
+
class: "relative w-full h-[calc(100%-40px)]",
|
|
260
|
+
id: `wrapper-${e.mapId}`
|
|
261
|
+
}, [
|
|
262
|
+
l("div", {
|
|
263
|
+
id: e.mapId,
|
|
264
|
+
class: "h-[calc(100%-40px)] w-full flex items-end min-h-[250px]"
|
|
265
|
+
}, null, 8, fe),
|
|
266
|
+
e.showSetting ? (p(), M(d, {
|
|
267
|
+
key: 0,
|
|
268
|
+
map: e.map,
|
|
269
|
+
coordinates: e.coordinatesByMouse
|
|
270
|
+
}, null, 8, ["map", "coordinates"])) : S("", !0),
|
|
271
|
+
w(c, { map: e.map }, null, 8, ["map"]),
|
|
272
|
+
l("div", be, [
|
|
273
|
+
w(i, {
|
|
274
|
+
map: e.map,
|
|
275
|
+
bbox: (y = e.data) == null ? void 0 : y.bounds
|
|
276
|
+
}, null, 8, ["map", "bbox"])
|
|
277
|
+
]),
|
|
278
|
+
w(h, {
|
|
279
|
+
mapId: e.mapId,
|
|
280
|
+
colors: (f = e.data) == null ? void 0 : f.colors,
|
|
281
|
+
sizes: (b = e.data) == null ? void 0 : b.sizes,
|
|
282
|
+
color: e.baseColor,
|
|
283
|
+
changeOpacityItem: "true",
|
|
284
|
+
cluster: "true"
|
|
285
|
+
}, null, 8, ["mapId", "colors", "sizes", "color"])
|
|
286
|
+
], 8, ye), [
|
|
287
|
+
[C, e.activeTab == "map"]
|
|
288
|
+
]),
|
|
289
|
+
z(w(u, {
|
|
290
|
+
mapId: e.mapId,
|
|
291
|
+
source: (v = e.data) == null ? void 0 : v.rows,
|
|
292
|
+
total: ((x = e.data) == null ? void 0 : x.total) || 0,
|
|
293
|
+
count: ((k = e.data) == null ? void 0 : k.count) || 0,
|
|
294
|
+
onKattotg: s[0] || (s[0] = (r) => e.kattotg = r)
|
|
295
|
+
}, null, 8, ["mapId", "source", "total", "count"]), [
|
|
296
|
+
[C, e.activeTab == "table"]
|
|
297
|
+
]),
|
|
298
|
+
z(l("div", ve, [
|
|
299
|
+
(E = (L = e.data) == null ? void 0 : L.rows) != null && E.length ? (p(), M(_, {
|
|
300
|
+
key: 0,
|
|
301
|
+
source: (T = (B = e.data) == null ? void 0 : B.rows) == null ? void 0 : T.map((r) => ({
|
|
302
|
+
title: r == null ? void 0 : r.title,
|
|
303
|
+
metric: r == null ? void 0 : r.metric
|
|
304
|
+
}))
|
|
305
|
+
}, null, 8, ["source"])) : S("", !0)
|
|
306
|
+
], 512), [
|
|
307
|
+
[C, e.activeTab == "chart"]
|
|
308
|
+
])
|
|
309
|
+
]);
|
|
310
|
+
}
|
|
311
|
+
const Me = /* @__PURE__ */ V(ce, [["render", xe]]);
|
|
312
|
+
export {
|
|
313
|
+
Me as default
|
|
314
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { _ as c, c as o, f as n } from "./import-file-XFI3CaVb.js";
|
|
2
|
+
import { createElementBlock as i, openBlock as m, toDisplayString as s } from "vue";
|
|
3
|
+
const u = {
|
|
4
|
+
name: "VsNumber",
|
|
5
|
+
mixins: [o],
|
|
6
|
+
data() {
|
|
7
|
+
return {
|
|
8
|
+
number: ""
|
|
9
|
+
};
|
|
10
|
+
},
|
|
11
|
+
computed: {
|
|
12
|
+
formattedNumber() {
|
|
13
|
+
return n(this.number);
|
|
14
|
+
},
|
|
15
|
+
prefix() {
|
|
16
|
+
var e, t;
|
|
17
|
+
return (e = this.styleData) != null && e.prefix ? (t = this.styleData) == null ? void 0 : t.prefix : "";
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
watch: {
|
|
21
|
+
sourceData: {
|
|
22
|
+
async handler() {
|
|
23
|
+
this.getNumber();
|
|
24
|
+
},
|
|
25
|
+
deep: !0
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
async mounted() {
|
|
29
|
+
await this.getData(), this.getNumber();
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
onChangedData() {
|
|
33
|
+
try {
|
|
34
|
+
this.sourceData && this.getNumber();
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.error(e);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
async getNumber() {
|
|
40
|
+
var e, t;
|
|
41
|
+
try {
|
|
42
|
+
this.number = ((t = this.sourceData[0]) == null ? void 0 : t[Object.keys((e = this.sourceData) == null ? void 0 : e[0])]) || 0;
|
|
43
|
+
} catch (r) {
|
|
44
|
+
console.error(r);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, h = { class: "text-lg lg:text-xl xl:text-2xl text-gray-800 h-[32px] flex items-center" };
|
|
49
|
+
function x(e, t, r, f, l, a) {
|
|
50
|
+
return m(), i("div", h, s(a.prefix) + s(a.formattedNumber), 1);
|
|
51
|
+
}
|
|
52
|
+
const b = /* @__PURE__ */ c(u, [["render", x]]);
|
|
53
|
+
export {
|
|
54
|
+
b as default
|
|
55
|
+
};
|