@opengis/bi 1.0.11 → 1.0.13

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.
Files changed (76) hide show
  1. package/dist/assets/charts/bar.png +0 -0
  2. package/dist/assets/charts/funnel.png +0 -0
  3. package/dist/assets/charts/no_data.jpg +0 -0
  4. package/dist/assets/charts/number.png +0 -0
  5. package/dist/assets/charts/pie.png +0 -0
  6. package/dist/assets/charts/progress.png +0 -0
  7. package/dist/assets/charts/stat.png +0 -0
  8. package/dist/assets/images/bar.png +0 -0
  9. package/dist/assets/images/funnel.png +0 -0
  10. package/dist/assets/images/no_data.jpg +0 -0
  11. package/dist/assets/images/number.png +0 -0
  12. package/dist/assets/images/pie.png +0 -0
  13. package/dist/assets/images/progress.png +0 -0
  14. package/dist/assets/images/stat.png +0 -0
  15. package/dist/bi.js +1 -1
  16. package/dist/bi.umd.cjs +722 -113
  17. package/dist/{import-file-D6RYWvi_.js → import-file-1T7kpSzt.js} +43137 -43183
  18. package/dist/map-component-mixin-BLM9iEWA.js +18712 -0
  19. package/dist/style.css +1 -1
  20. package/dist/vs-calendar-WiK1hcHS.js +96 -0
  21. package/dist/vs-funnel-bar-CpPbYZ0_.js +92 -0
  22. package/dist/vs-heatmap-BG4eIROH.js +83 -0
  23. package/dist/vs-map-BRk6Fmks.js +66 -0
  24. package/dist/vs-map-cluster-Dfe9INqE.js +103 -0
  25. package/dist/vs-number-CJq-vi95.js +39 -0
  26. package/dist/{vs-text-UyIWGqQO.js → vs-text-DcrAdQ40.js} +60 -60
  27. package/package.json +11 -6
  28. package/server/migrations/bi.sql +27 -0
  29. package/server/plugins/hook.js +86 -0
  30. package/server/plugins/vite.js +7 -4
  31. package/server/routes/dashboard/controllers/dashboard.js +24 -4
  32. package/server/routes/data/controllers/data.js +48 -52
  33. package/server/routes/data/controllers/util/chartSQL.js +8 -7
  34. package/server/routes/data/controllers/util/normalizeData.js +22 -9
  35. package/server/routes/edit/controllers/dashboard.add.js +5 -1
  36. package/server/routes/edit/controllers/dashboard.edit.js +5 -1
  37. package/server/routes/edit/controllers/widget.add.js +23 -7
  38. package/server/routes/edit/controllers/widget.del.js +1 -1
  39. package/server/routes/edit/controllers/widget.edit.js +8 -5
  40. package/server/routes/map/controllers/cluster.js +75 -0
  41. package/server/routes/map/controllers/clusterVtile.js +143 -0
  42. package/server/routes/map/controllers/geojson.js +9 -23
  43. package/server/routes/map/controllers/map.js +57 -0
  44. package/server/routes/map/controllers/vtile.js +25 -32
  45. package/server/routes/map/index.mjs +7 -4
  46. package/server/utils/getWidget.js +56 -0
  47. package/utils.js +11 -0
  48. package/dist/vs-number-DKF5ptAP.js +0 -34
  49. package/server/templates/dashboard/erobota/bar_area.yml +0 -17
  50. package/server/templates/dashboard/erobota/bar_culture.yml +0 -18
  51. package/server/templates/dashboard/erobota/bar_grand.yml +0 -18
  52. package/server/templates/dashboard/erobota/count_grand.yml +0 -8
  53. package/server/templates/dashboard/erobota/index.yml +0 -47
  54. package/server/templates/dashboard/erobota/list_culture.yml +0 -12
  55. package/server/templates/dashboard/erobota/list_grant.yml +0 -12
  56. package/server/templates/dashboard/erobota/map.yml +0 -4
  57. package/server/templates/dashboard/erobota/pie_area.yml +0 -17
  58. package/server/templates/dashboard/erobota/pie_grant.yml +0 -17
  59. package/server/templates/dashboard/erobota/total_area.yml +0 -9
  60. package/server/templates/dashboard/erobota/total_grand.yml +0 -9
  61. package/server/templates/dashboard/sales/index.yml +0 -40
  62. package/server/templates/dashboard/sales/quarterly_revenue.yml +0 -19
  63. package/server/templates/dashboard/sales/quarterly_revenue_by_product_line.yml +0 -19
  64. package/server/templates/dashboard/sales/total_products_sold.yml +0 -9
  65. package/server/templates/dashboard/sales/total_products_sold_by_product_line.yml +0 -12
  66. package/server/templates/dashboard/sales/total_revenue.yml +0 -8
  67. package/server/templates/dashboard/sales/total_revenue_by_product_line.yml +0 -17
  68. package/server/templates/dashboard/sales/vehicle_sales_info.md +0 -17
  69. package/server/templates/dashboard/test3/index.yml +0 -29
  70. package/server/templates/dashboard/test3/quarterly_revenue.yml +0 -19
  71. package/server/templates/dashboard/test3/widget1.yml +0 -8
  72. package/server/templates/pt/vehicle_sales.md +0 -17
  73. package/server/templates/table/demo.cleaned_sales_data.table.json +0 -104
  74. package/server/templates/table/test.dataset.table.json +0 -16
  75. package/server/templates/widget/product_line.yml +0 -20
  76. package/server/templates/widget/test_vtile.yml +0 -7
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .vs-chart{width:100%;height:100%}.vs-chart-tooltip{border-radius:7px;max-height:100px;max-width:340px;min-width:140px;background-color:#fff;box-shadow:0 0 8px #0000002e}.vs-chart-tooltip__head{padding:5px;border-bottom:1px solid #eee;margin-bottom:5px}.vs-chart-tooltip__head-title{font-size:14px;font-weight:700;display:flex;align-items:center}.vs-chart-tooltip__head-value{margin-right:5px}.vs-chart-tooltip__head-series{font-size:14px;display:flex;align-items:center}.vs-chart-tooltip__color{width:12px;height:12px;display:block;border-radius:50%;margin-right:5px}.vs-chart-tooltip__body{padding:5px;font-size:14px;display:flex;align-items:start;flex-direction:column}.vs-chart-tooltip__body .vs-chart-tooltip__color{border-radius:3px}.vs-chart-tooltip__item{width:100%;display:flex;align-items:center;justify-content:space-between}.vs-chart-tooltip__text{margin-right:auto}.vs-chart-tooltip__body svg{margin-right:8px}
1
+ .custom-x-scrollbar{overflow-x:auto;overflow-y:clip}.custom-x-scrollbar::-webkit-scrollbar{height:6px}.custom-x-scrollbar::-webkit-scrollbar-thumb{background-color:#e0e0e0}.custom-x-scrollbar::-webkit-scrollbar-track{background-color:#f1f1f1}.ui-dialog__wrapper[data-v-5dd8dafb]{z-index:10001;position:relative}.ui-dialog__modal[data-v-5dd8dafb]{margin:10px;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);min-height:0;height:fit-content;max-height:80vh;overflow:hidden}.ui-dialog__content[data-v-5dd8dafb]{min-height:0;height:100%;overflow:auto}.ui-dialog__content[data-v-5dd8dafb]::-webkit-scrollbar{width:6px;height:6px;background-color:#f5f5f5}.ui-dialog__content[data-v-5dd8dafb]::-webkit-scrollbar-thumb{border-radius:10px;background-color:#d9d9d9bf}.ui-dialog__content[data-v-5dd8dafb]::-webkit-scrollbar-track{background-color:#f5f5f5}@media (max-width: 650px){.ui-dialog__modal[data-v-5dd8dafb]{top:50%}}.fade-enter-active[data-v-5dd8dafb],.fade-leave-active[data-v-5dd8dafb]{transition:opacity .2s}.fade-enter-from[data-v-5dd8dafb],.fade-leave-to[data-v-5dd8dafb]{opacity:0}.content-enter-active[data-v-5dd8dafb],.content-leave-active[data-v-5dd8dafb]{transition:transform .4s}.content-enter-from[data-v-5dd8dafb],.content-leave-to[data-v-5dd8dafb]{transform:translate(-50%,-50%) scale(.95)}.vs-chart{width:100%;height:100%}.vs-chart-tooltip{border-radius:7px;max-height:100px;max-width:340px;min-width:140px;background-color:#fff;box-shadow:0 0 8px #0000002e}.vs-chart-tooltip__head{padding:5px;border-bottom:1px solid #eee;margin-bottom:5px}.vs-chart-tooltip__head-title{font-size:14px;font-weight:700;display:flex;align-items:center}.vs-chart-tooltip__head-value{margin-right:5px}.vs-chart-tooltip__head-series{font-size:14px;display:flex;align-items:center}.vs-chart-tooltip__color{width:12px;height:12px;display:block;border-radius:50%;margin-right:5px}.vs-chart-tooltip__body{padding:5px;font-size:14px;display:flex;align-items:start;flex-direction:column}.vs-chart-tooltip__body .vs-chart-tooltip__color{border-radius:3px}.vs-chart-tooltip__item{width:100%;display:flex;align-items:center;justify-content:space-between}.vs-chart-tooltip__text{margin-right:auto}.vs-chart-tooltip__body svg{margin-right:8px}body{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.vs-map-portal__legend{position:absolute;bottom:10px;right:10px}.map__settings{display:flex;padding:3px 1px;background:#fff;position:absolute;right:0;bottom:15px;height:30px;align-items:center;font-weight:100;text-align:center}.map__settings-item{display:flex;white-space:nowrap;padding:0 2px;font-size:10px;font-weight:400}.map__settings-attribution{padding:0}.map__settings-menu{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:15px!important;position:absolute;background-color:#fff;bottom:60px;right:90px;width:260px}.map__settings-menu-item{display:flex;align-items:center;color:#2c2c2c;margin-bottom:5px;font-size:12px;justify-content:space-between;height:28px}.map__settings-menu-item-text{height:28px;line-height:28px;background-color:#fff;background-image:none;border-radius:4px;border:1px solid #DCDFE6;-webkit-box-sizing:border-box;box-sizing:border-box;color:#606266;display:inline-block;font-size:12px;height:40px;line-height:40px;outline:0;padding:0 10px}.map__settings-menu-item--checktext{color:#000!important;font-size:12px;display:inline-block;padding-left:10px;line-height:19px;cursor:pointer}.checked{color:#409eff!important}.vs-map-slot-layers[data-v-490e9838]{position:absolute;display:flex;bottom:10px;left:15px}.vs-map-slot-layers__layer[data-v-490e9838]{width:50px;height:50px;background-color:#fff;box-shadow:0 0 7px #434c5626;padding:5px;border-radius:5px;margin-top:10px;margin-right:10px;cursor:pointer;transition:all .3s}.vs-map-slot-layers__layer[data-v-490e9838]:hover{background-color:#eee}.vs-map-slot-layers__image[data-v-490e9838]{width:100%;border-radius:5px;object-fit:contain}.focused[data-v-490e9838]{background-color:#1989fa!important}.vs-map-portal__list{position:absolute}.vs-map-portal__legend-title{padding-bottom:5px;border-bottom:1px solid #ebebeb}.vs-map-portal__legend-button{cursor:pointer;display:flex;align-items:center;justify-content:center;flex-direction:column;height:35px;background-color:#fff;border-radius:5px;border:1px solid #dcdfe5;padding:5px}.vs-map-portal__legend-body{background-color:#fff;border-radius:5px;border:1px solid #dcdfe5;padding:5px;width:250px;max-height:250px}.vs-map-portal__legend-body__content{padding-top:10px}.vs-map-portal__legend-category{font-weight:700;margin-bottom:5px}.vs-map-portal__legend-item{margin-right:10px;display:flex;flex-shrink:0}.vs-map-portal__legend-item__color{width:16px;height:16px;border-radius:3px;margin-right:10px;display:flex;flex-shrink:0}.maplibregl-popup-content{padding:0}
@@ -0,0 +1,96 @@
1
+ import { _ as s, c as o, g as l, i as c, t as h, j as p } from "./import-file-1T7kpSzt.js";
2
+ import { openBlock as d, createElementBlock as m } from "vue";
3
+ const u = {
4
+ mixins: [o],
5
+ data() {
6
+ return {
7
+ myChartvt: null,
8
+ label: null,
9
+ uniqueID: null
10
+ };
11
+ },
12
+ computed: {
13
+ calendarRange() {
14
+ return this.getCalendarRange();
15
+ }
16
+ },
17
+ async mounted() {
18
+ this.uniqueID = l(), await this.$nextTick(), await this.getData(), this.initChart();
19
+ },
20
+ methods: {
21
+ prepareData() {
22
+ var a;
23
+ try {
24
+ const t = Object.keys((a = this.sourceData) == null ? void 0 : a[0]);
25
+ return this.sourceData.map((e) => [
26
+ e[t[0]].split("T")[0],
27
+ Number(e[t[1]])
28
+ ]);
29
+ } catch (t) {
30
+ console.error(t);
31
+ }
32
+ },
33
+ getCalendarRange() {
34
+ var i;
35
+ const a = Object.keys((i = this.sourceData) == null ? void 0 : i[0]), t = this.sourceData.map((n) => new Date(n[a[0]].split("T")[0])), r = new Date(Math.min(...t)), e = new Date(Math.max(...t));
36
+ return [r.getFullYear().toString(), e.getFullYear().toString()];
37
+ },
38
+ async initChart() {
39
+ var a, t;
40
+ try {
41
+ const r = document.getElementById(this.uniqueID), e = c(r);
42
+ console.log(this.calendarRange);
43
+ const i = {
44
+ tooltip: {
45
+ ...h((a = this.styleData) == null ? void 0 : a.tooltip, (t = this.styleData) == null ? void 0 : t.show_tooltip),
46
+ trigger: "item",
47
+ formatter: (n) => p(n)
48
+ },
49
+ visualMap: {
50
+ min: Math.min(...this.prepareData().map((n) => n[1])),
51
+ max: Math.max(...this.prepareData().map((n) => n[1])),
52
+ type: "piecewise",
53
+ orient: "horizontal",
54
+ left: "center",
55
+ top: 65
56
+ },
57
+ calendar: {
58
+ top: 120,
59
+ left: 30,
60
+ right: 30,
61
+ cellSize: ["auto", 20],
62
+ range: this.calendarRange,
63
+ itemStyle: {
64
+ borderWidth: 0.5
65
+ },
66
+ yearLabel: { show: !1 }
67
+ },
68
+ series: {
69
+ name: "calendar",
70
+ type: "heatmap",
71
+ coordinateSystem: "calendar",
72
+ data: this.prepareData(),
73
+ itemStyle: {
74
+ borderWidth: 0.5
75
+ }
76
+ }
77
+ };
78
+ e.setOption(i), e.resize(), window.addEventListener("resize", () => {
79
+ e.resize();
80
+ });
81
+ } catch (r) {
82
+ console.error(r);
83
+ }
84
+ }
85
+ }
86
+ }, D = ["id"];
87
+ function g(a, t, r, e, i, n) {
88
+ return d(), m("div", {
89
+ id: i.uniqueID,
90
+ class: "h-full w-full min-h-[200px] pb-2"
91
+ }, null, 8, D);
92
+ }
93
+ const _ = /* @__PURE__ */ s(u, [["render", g]]);
94
+ export {
95
+ _ as default
96
+ };
@@ -0,0 +1,92 @@
1
+ import { _ as l, c as h, g as u, a as d, b as p, d as n, i as m } from "./import-file-1T7kpSzt.js";
2
+ import { openBlock as f, createElementBlock as y } from "vue";
3
+ const D = {
4
+ mixins: [h],
5
+ data() {
6
+ return {
7
+ myChartvt: null,
8
+ uniqueID: null
9
+ };
10
+ },
11
+ async mounted() {
12
+ this.uniqueID = u(), await this.$nextTick(), await this.getData();
13
+ const { series: e } = this.prepareData();
14
+ e && this.initChart(e);
15
+ },
16
+ methods: {
17
+ buildTooltipForDonut(e, t) {
18
+ const { name: r, value: a, percent: s } = e;
19
+ return `
20
+ <div style="background-color:${t[0]};font-size: 12px; font-family: Helvetica, Arial, sans-serif;color:#ffff; padding:5px; border-radius:5px; ![box-shadow:none]">
21
+ ${d(r)}: ${p(a)} (${s}%)
22
+ </div>`;
23
+ },
24
+ prepareData() {
25
+ var e;
26
+ try {
27
+ const t = Object.keys((e = this.sourceData) == null ? void 0 : e[0]), r = Array.from(new Set(this.sourceData.map((o) => o[t[0]]))), a = Array.from(new Set(this.sourceData.map((o) => o[t[1]]))), s = r.map((o, c) => ({
28
+ name: o,
29
+ value: a[c]
30
+ }));
31
+ return { series: [
32
+ {
33
+ name: this.titleCharts ? this.titleCharts : t[0],
34
+ type: "funnel",
35
+ ...n(this.styleData),
36
+ data: s,
37
+ height: "100%",
38
+ emphasis: {
39
+ label: {
40
+ show: !1
41
+ }
42
+ }
43
+ }
44
+ ] };
45
+ } catch (t) {
46
+ console.error(t);
47
+ }
48
+ },
49
+ async initChart(e) {
50
+ try {
51
+ const t = document.getElementById(this.uniqueID), r = m(t), a = {
52
+ series: e,
53
+ ...n(this.styleData),
54
+ tooltip: {
55
+ trigger: "item",
56
+ formatter: (s) => this.buildTooltipForDonut(s, [s.color]),
57
+ borderWidth: 0,
58
+ appendToBody: !0,
59
+ borderColor: "transparent",
60
+ textStyle: {
61
+ color: "#000"
62
+ },
63
+ padding: [10, 15],
64
+ shadowColor: "transparent",
65
+ backgroundColor: "transparent"
66
+ },
67
+ itemStyle: {
68
+ height: "15px"
69
+ },
70
+ labelLine: {
71
+ show: !1
72
+ }
73
+ };
74
+ r.setOption(a), r.resize(), window.addEventListener("resize", () => {
75
+ r.resize();
76
+ });
77
+ } catch (t) {
78
+ console.error(t);
79
+ }
80
+ }
81
+ }
82
+ }, b = ["id"];
83
+ function x(e, t, r, a, s, i) {
84
+ return f(), y("div", {
85
+ id: s.uniqueID,
86
+ class: "h-[90%] custom-scrollbar min-h-[200px]"
87
+ }, null, 8, b);
88
+ }
89
+ const v = /* @__PURE__ */ l(D, [["render", x]]);
90
+ export {
91
+ v as default
92
+ };
@@ -0,0 +1,83 @@
1
+ import { _ as p, c as m, g as d, a as y, i as x, t as f, e as D, h as c, d as _ } from "./import-file-1T7kpSzt.js";
2
+ import { openBlock as g, createElementBlock as b } from "vue";
3
+ const w = {
4
+ mixins: [m],
5
+ data() {
6
+ return {
7
+ myChartvt: null,
8
+ label: null,
9
+ uniqueID: null
10
+ };
11
+ },
12
+ async mounted() {
13
+ this.uniqueID = d(), await this.$nextTick(), await this.getData();
14
+ const { series: s, xs: e, ys: n } = this.prepareData();
15
+ s && this.initChart(s, e, n, !0);
16
+ },
17
+ methods: {
18
+ prepareData() {
19
+ var s;
20
+ try {
21
+ const e = Object.keys((s = this.sourceData) == null ? void 0 : s[0]), n = Array.from(new Set(this.sourceData.map((t) => t[e[0]])));
22
+ let i;
23
+ e[0].includes("date") ? i = n.map((t) => y(t)) : i = [...n];
24
+ const r = e.filter((t, a) => a != 0);
25
+ let o = [];
26
+ for (let t = 0; t < i.length; t++)
27
+ for (let a = 0; a < r.length; a++)
28
+ o.push([t, a, this.sourceData[t][r[a]]]);
29
+ return { series: {
30
+ name: this.titleCharts ? this.titleCharts : e[0],
31
+ type: "heatmap",
32
+ data: o
33
+ }, xs: i, ys: r };
34
+ } catch (e) {
35
+ console.error(e);
36
+ }
37
+ },
38
+ async initChart(s, e, n) {
39
+ var i, r, o, l;
40
+ try {
41
+ const t = document.getElementById(this.uniqueID), a = x(t), h = {
42
+ tooltip: {
43
+ ...f((i = this.styleData) == null ? void 0 : i.tooltip, (r = this.styleData) == null ? void 0 : r.show_tooltip),
44
+ trigger: "item",
45
+ formatter: (u) => D(u)
46
+ },
47
+ xAxis: {
48
+ data: e,
49
+ axisLabel: c((o = this.styleData) == null ? void 0 : o.x_axis)
50
+ },
51
+ visualMap: {
52
+ min: 0,
53
+ max: 1e6,
54
+ calculable: !0,
55
+ orient: "horizontal",
56
+ left: "center"
57
+ },
58
+ yAxis: {
59
+ data: n,
60
+ axisLabel: c((l = this.styleData) == null ? void 0 : l.y_axis)
61
+ },
62
+ series: s,
63
+ ..._(this.styleData)
64
+ };
65
+ a.setOption(h), a.resize(), window.addEventListener("resize", () => {
66
+ a.resize();
67
+ });
68
+ } catch (t) {
69
+ console.error(t);
70
+ }
71
+ }
72
+ }
73
+ }, v = ["id"];
74
+ function C(s, e, n, i, r, o) {
75
+ return g(), b("div", {
76
+ id: r.uniqueID,
77
+ class: "h-full w-full min-h-[200px] pb-2"
78
+ }, null, 8, v);
79
+ }
80
+ const k = /* @__PURE__ */ p(w, [["render", C]]);
81
+ export {
82
+ k as default
83
+ };
@@ -0,0 +1,66 @@
1
+ import { l as b, m as w } from "./map-component-mixin-BLM9iEWA.js";
2
+ import { _ as y, c as M } from "./import-file-1T7kpSzt.js";
3
+ import { resolveComponent as i, openBlock as u, createElementBlock as _, createElementVNode as r, createBlock as v, createCommentVNode as V, createVNode as d } from "vue";
4
+ const $ = {
5
+ mixins: [M, b, w],
6
+ async mounted() {
7
+ await this.getMapData(), await this.createMap();
8
+ },
9
+ methods: {
10
+ async getMapData() {
11
+ const s = await (await fetch(`/api/bi-map?widget=${this.widget}&dashboard=${this.dashboard}`)).json();
12
+ this.data = s;
13
+ },
14
+ async loadHandler() {
15
+ const e = ["#69D2E7", "yellow", "#FE4365"], s = this.data.colors ? ["match", ["get", "x"]].concat(this.data.colors.reduce((o, a, c) => o.concat(a.val, e[c]), [])).concat(["gray"]) : "blue", l = [5, 7, 9, 11, 13], t = this.data.sizes ? ["case"] : 5;
16
+ this.data.sizes && (this.data.sizes.reverse().forEach((o, a) => {
17
+ t.push([">", ["get", "metric"], o]), t.push(l[a]);
18
+ }), t.push(5));
19
+ const n = {
20
+ type: "circle",
21
+ color: s,
22
+ width: 2,
23
+ radius: t,
24
+ stroke: "#eee"
25
+ };
26
+ Object.assign(n, this.data.style || {}), this.addVtileLayer({
27
+ id: "bi",
28
+ url: `${window.location.origin}/api/bi-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,
29
+ style: n
30
+ });
31
+ }
32
+ }
33
+ }, x = { class: "h-full w-full relative" }, z = ["id"], k = { ref: "popup" }, E = { class: "relative w-full h-[50px] flex justify-end rounded-[7px] bottom-[80px] right-[10px]" };
34
+ function L(e, s, l, t, n, o) {
35
+ var p, m, h;
36
+ const a = i("VsMapSetting"), c = i("VsMapSlotLayers"), f = i("VsMapGoHome"), g = i("VsMapLegend");
37
+ return u(), _("div", x, [
38
+ r("div", {
39
+ id: e.mapId,
40
+ class: "h-[96%] w-full flex items-end relative"
41
+ }, [
42
+ r("div", k, null, 512)
43
+ ], 8, z),
44
+ e.showSetting ? (u(), v(a, {
45
+ key: 0,
46
+ map: e.map,
47
+ coordinates: e.coordinatesByMouse
48
+ }, null, 8, ["map", "coordinates"])) : V("", !0),
49
+ d(c, { map: e.map }, null, 8, ["map"]),
50
+ r("div", E, [
51
+ d(f, {
52
+ map: e.map,
53
+ bbox: (p = e.data) == null ? void 0 : p.bbox
54
+ }, null, 8, ["map", "bbox"])
55
+ ]),
56
+ d(g, {
57
+ colors: (m = e.data) == null ? void 0 : m.colors,
58
+ sizes: (h = e.data) == null ? void 0 : h.sizes,
59
+ color: e.color
60
+ }, null, 8, ["colors", "sizes", "color"])
61
+ ]);
62
+ }
63
+ const C = /* @__PURE__ */ y($, [["render", L]]);
64
+ export {
65
+ C as default
66
+ };
@@ -0,0 +1,103 @@
1
+ import { l as V, m as v } from "./map-component-mixin-BLM9iEWA.js";
2
+ import { _, c as $ } from "./import-file-1T7kpSzt.js";
3
+ import { resolveComponent as d, openBlock as M, createElementBlock as L, createVNode as p, createElementVNode as w, createBlock as S, createCommentVNode as k } from "vue";
4
+ function C(t, n) {
5
+ t = t.replace(/^#/, ""), t.length === 3 && (t = t.split("").map((r) => r + r).join(""));
6
+ const o = parseInt(t.substring(0, 2), 16) / 255, s = parseInt(t.substring(2, 4), 16) / 255, a = parseInt(t.substring(4, 6), 16) / 255, e = Math.max(o, s, a), l = Math.min(o, s, a);
7
+ let i, c, m = (e + l) / 2;
8
+ if (e === l)
9
+ i = c = 0;
10
+ else {
11
+ const r = e - l;
12
+ switch (c = m > 0.5 ? r / (2 - e - l) : r / (e + l), e) {
13
+ case o:
14
+ i = (s - a) / r + (s < a ? 6 : 0);
15
+ break;
16
+ case s:
17
+ i = (a - o) / r + 2;
18
+ break;
19
+ case a:
20
+ i = (o - s) / r + 4;
21
+ break;
22
+ }
23
+ i /= 6;
24
+ }
25
+ return `hsl(${Math.round(i * 360)},${Math.round(c * 100)}%,${n}%)`;
26
+ }
27
+ function H(t, n) {
28
+ var e;
29
+ const o = document.createElement("div");
30
+ o.style.color = t, document.body.appendChild(o);
31
+ let s = ((e = window.getComputedStyle(o)) == null ? void 0 : e.color) || [];
32
+ document.body.removeChild(o);
33
+ const a = s.match(/\d+/g).map(Number) || [];
34
+ return this.rgbToHSL(a[0], a[1], n);
35
+ }
36
+ function z(t, n) {
37
+ return t != null && t.includes("#") ? C(t, n) : H(t, n);
38
+ }
39
+ const E = {
40
+ mixins: [$, V, v],
41
+ async mounted() {
42
+ await this.getMapData(), await this.createMap();
43
+ },
44
+ methods: {
45
+ async getMapData() {
46
+ const n = await (await fetch(`/api/bi-cluster?widget=${this.widget}&dashboard=${this.dashboard}`)).json();
47
+ this.data = n;
48
+ },
49
+ async loadHandler() {
50
+ const t = ["#2980b9", "yellow", "#FE4365", "blue", "green"], n = [90, 80, 70, 60, 50], o = ["case"];
51
+ this.data.sizes.reverse().forEach((a, e) => {
52
+ o.push([">", ["get", "metric"], a]), o.push(z(t[0], n[e])), e++;
53
+ }), o.push("gray");
54
+ const s = {
55
+ type: "polygon",
56
+ color: o,
57
+ opacity: 0.2
58
+ };
59
+ Object.assign(s, this.data.style || {}), this.addVtileLayer({
60
+ id: "bi",
61
+ url: `${window.location.origin}/api/bi-cluster-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,
62
+ style: s
63
+ });
64
+ }
65
+ }
66
+ }, j = { class: "h-full w-full relative" }, B = ["id"], I = { class: "relative w-full h-[50px] flex justify-end rounded-[7px] bottom-[80px] right-[10px]" };
67
+ function N(t, n, o, s, a, e) {
68
+ var u, h, b, g, f, y;
69
+ const l = d("VsList"), i = d("VsMapSetting"), c = d("VsMapSlotLayers"), m = d("VsMapGoHome"), r = d("VsMapLegend");
70
+ return M(), L("div", j, [
71
+ p(l, {
72
+ source: (u = t.data) == null ? void 0 : u.rows,
73
+ total: ((h = t.data) == null ? void 0 : h.total) || 0,
74
+ count: ((b = t.data) == null ? void 0 : b.count) || 0
75
+ }, null, 8, ["source", "total", "count"]),
76
+ w("div", {
77
+ id: t.mapId,
78
+ class: "h-[96%] w-full flex items-end"
79
+ }, null, 8, B),
80
+ t.showSetting ? (M(), S(i, {
81
+ key: 0,
82
+ map: t.map,
83
+ coordinates: t.coordinatesByMouse
84
+ }, null, 8, ["map", "coordinates"])) : k("", !0),
85
+ p(c, { map: t.map }, null, 8, ["map"]),
86
+ w("div", I, [
87
+ p(m, {
88
+ map: t.map,
89
+ bbox: ((g = t.data) == null ? void 0 : g.bbox) || {}
90
+ }, null, 8, ["map", "bbox"])
91
+ ]),
92
+ p(r, {
93
+ colors: (f = t.data) == null ? void 0 : f.colors,
94
+ sizes: (y = t.data) == null ? void 0 : y.sizes,
95
+ cluster: !0,
96
+ color: t.color
97
+ }, null, 8, ["colors", "sizes", "color"])
98
+ ]);
99
+ }
100
+ const A = /* @__PURE__ */ _(E, [["render", N]]);
101
+ export {
102
+ A as default
103
+ };
@@ -0,0 +1,39 @@
1
+ import { _ as s, c as i, f as o } from "./import-file-1T7kpSzt.js";
2
+ import { openBlock as c, createElementBlock as n, toDisplayString as a } from "vue";
3
+ const m = {
4
+ mixins: [i],
5
+ data() {
6
+ return {
7
+ number: ""
8
+ };
9
+ },
10
+ computed: {
11
+ formattedNumber() {
12
+ return o(this.number);
13
+ },
14
+ prefix() {
15
+ var t, e;
16
+ return (t = this.styleData) != null && t.prefix ? (e = this.styleData) == null ? void 0 : e.prefix : "";
17
+ }
18
+ },
19
+ async mounted() {
20
+ await this.getData(), this.getNumber();
21
+ },
22
+ methods: {
23
+ async getNumber() {
24
+ var t;
25
+ try {
26
+ this.number = this.sourceData[0][Object.keys((t = this.sourceData) == null ? void 0 : t[0])];
27
+ } catch (e) {
28
+ console.error(e);
29
+ }
30
+ }
31
+ }
32
+ }, u = { class: "font-[Inter,_Helvetica,_Arial] p-4 w-full text-[28px] pt-[10px] min-h-[130px] border-0" };
33
+ function p(t, e, f, h, d, r) {
34
+ return c(), n("div", u, a(r.prefix) + a(r.formattedNumber), 1);
35
+ }
36
+ const _ = /* @__PURE__ */ s(m, [["render", p]]);
37
+ export {
38
+ _ as default
39
+ };