@opengis/bi 1.2.7 → 1.2.10

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