@opengis/bi 1.0.39 → 1.0.41

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