@opengis/bi 1.0.13 → 1.0.15

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 (58) hide show
  1. package/README.md +50 -52
  2. package/config.js +12 -12
  3. package/dist/bi.js +1 -1
  4. package/dist/bi.umd.cjs +120 -134
  5. package/dist/{import-file-1T7kpSzt.js → import-file-CRC0sYYT.js} +11974 -11522
  6. package/dist/{map-component-mixin-BLM9iEWA.js → map-component-mixin-BCtWEvzv.js} +4830 -3150
  7. package/dist/style.css +1 -1
  8. package/dist/vs-calendar-5ot79n0N.js +110 -0
  9. package/dist/vs-funnel-bar-CLo6gXI_.js +105 -0
  10. package/dist/vs-heatmap-DHGA8dRk.js +97 -0
  11. package/dist/{vs-map-cluster-Dfe9INqE.js → vs-map-cluster-CNgX6JVF.js} +28 -25
  12. package/dist/vs-map-pIn5wS4G.js +74 -0
  13. package/dist/vs-number-DYfok8VU.js +55 -0
  14. package/dist/{vs-text-DcrAdQ40.js → vs-text-Dckykz09.js} +19 -13
  15. package/package.json +107 -72
  16. package/plugin.js +14 -13
  17. package/server/migrations/bi.dataset.sql +26 -0
  18. package/server/migrations/bi.sql +93 -27
  19. package/server/plugins/docs.js +48 -47
  20. package/server/plugins/hook.js +89 -86
  21. package/server/plugins/vite.js +69 -55
  22. package/server/routes/dashboard/controllers/dashboard.delete.js +38 -35
  23. package/server/routes/dashboard/controllers/dashboard.js +118 -80
  24. package/server/routes/dashboard/controllers/dashboard.list.js +30 -39
  25. package/server/routes/dashboard/controllers/utils/yaml.js +11 -12
  26. package/server/routes/dashboard/index.mjs +25 -24
  27. package/server/routes/data/controllers/data.js +168 -97
  28. package/server/routes/data/controllers/util/chartSQL.js +42 -25
  29. package/server/routes/data/controllers/util/normalizeData.js +59 -34
  30. package/server/routes/data/index.mjs +29 -26
  31. package/server/routes/dataset/controllers/bi.dataset.demo.add.js +97 -0
  32. package/server/routes/dataset/controllers/bi.dataset.import.js +67 -0
  33. package/server/routes/dataset/controllers/util/create.table.js +22 -0
  34. package/server/routes/dataset/controllers/util/prepare.data.js +49 -0
  35. package/server/routes/dataset/index.mjs +19 -0
  36. package/server/routes/db/controllers/dbTablePreview.js +63 -0
  37. package/server/routes/db/controllers/dbTables.js +36 -0
  38. package/server/routes/db/index.mjs +17 -0
  39. package/server/routes/edit/controllers/dashboard.add.js +26 -23
  40. package/server/routes/edit/controllers/dashboard.edit.js +46 -37
  41. package/server/routes/edit/controllers/widget.add.js +75 -49
  42. package/server/routes/edit/controllers/widget.del.js +69 -63
  43. package/server/routes/edit/controllers/widget.edit.js +52 -82
  44. package/server/routes/edit/index.mjs +31 -27
  45. package/server/routes/map/controllers/cluster.js +109 -75
  46. package/server/routes/map/controllers/clusterVtile.js +166 -143
  47. package/server/routes/map/controllers/geojson.js +127 -101
  48. package/server/routes/map/controllers/map.js +60 -57
  49. package/server/routes/map/controllers/utils/downloadClusterData.js +43 -0
  50. package/server/routes/map/controllers/vtile.js +183 -161
  51. package/server/routes/map/index.mjs +25 -25
  52. package/server/utils/getWidget.js +85 -56
  53. package/utils.js +12 -11
  54. package/dist/vs-calendar-WiK1hcHS.js +0 -96
  55. package/dist/vs-funnel-bar-CpPbYZ0_.js +0 -92
  56. package/dist/vs-heatmap-BG4eIROH.js +0 -83
  57. package/dist/vs-map-BRk6Fmks.js +0 -66
  58. package/dist/vs-number-CJq-vi95.js +0 -39
package/dist/style.css CHANGED
@@ -1 +1 @@
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}
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-307b1e51]{position:relative}.ui-dialog__modal[data-v-307b1e51]{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-307b1e51]{min-height:0;height:100%;overflow:auto}.ui-dialog__content[data-v-307b1e51]::-webkit-scrollbar{width:6px;height:6px;background-color:#f5f5f5}.ui-dialog__content[data-v-307b1e51]::-webkit-scrollbar-thumb{border-radius:10px;background-color:#d9d9d9bf}.ui-dialog__content[data-v-307b1e51]::-webkit-scrollbar-track{background-color:#f5f5f5}@media (max-width: 650px){.ui-dialog__modal[data-v-307b1e51]{top:50%}}.fade-enter-active[data-v-307b1e51],.fade-leave-active[data-v-307b1e51]{transition:opacity .2s}.fade-enter-from[data-v-307b1e51],.fade-leave-to[data-v-307b1e51]{opacity:0}.content-enter-active[data-v-307b1e51],.content-leave-active[data-v-307b1e51]{transition:transform .4s}.content-enter-from[data-v-307b1e51],.content-leave-to[data-v-307b1e51]{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:45px}.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-87fc4740]{position:absolute;display:flex;bottom:10px;left:15px}.vs-map-slot-layers__layer[data-v-87fc4740]{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-87fc4740]:hover{background-color:#eee}.vs-map-slot-layers__image[data-v-87fc4740]{width:100%;border-radius:5px;object-fit:contain}.focused[data-v-87fc4740]{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,110 @@
1
+ import { _ as s, c as o, i as l, t as c, h } from "./import-file-CRC0sYYT.js";
2
+ import { openBlock as p, createElementBlock as d } from "vue";
3
+ const m = {
4
+ name: "VsCalendar",
5
+ mixins: [o],
6
+ data() {
7
+ return {
8
+ chartInstance: null,
9
+ label: null,
10
+ uniqueID: null
11
+ };
12
+ },
13
+ computed: {
14
+ calendarRange() {
15
+ return this.getCalendarRange();
16
+ }
17
+ },
18
+ async mounted() {
19
+ this.uniqueID = this.widget, await this.$nextTick(), await this.getData(), this.initChart();
20
+ },
21
+ methods: {
22
+ onChangedData() {
23
+ try {
24
+ if (this.sourceData) {
25
+ const { series: t, xs: e, ys: a } = this.prepareData();
26
+ t && (this == null || this.initChart(t, e, a));
27
+ }
28
+ } catch (t) {
29
+ console.error(t);
30
+ }
31
+ },
32
+ prepareData() {
33
+ try {
34
+ return this.sourceData.map((e) => [
35
+ e[this.dimensions[0]].split("T")[0],
36
+ Number(e[this.dimensions[1]])
37
+ ]);
38
+ } catch (t) {
39
+ console.error(t);
40
+ }
41
+ },
42
+ getCalendarRange() {
43
+ const t = this.sourceData.map(
44
+ (r) => new Date(r[this.dimensions[0]].split("T")[0])
45
+ ), e = new Date(Math.min(...t)), a = new Date(Math.max(...t));
46
+ return [
47
+ e.getFullYear().toString(),
48
+ a.getFullYear().toString()
49
+ ];
50
+ },
51
+ async initChart() {
52
+ var t, e;
53
+ try {
54
+ const a = this.$refs.chart, r = l(a), n = {
55
+ tooltip: {
56
+ ...c(
57
+ (t = this.styleData) == null ? void 0 : t.tooltip,
58
+ (e = this.styleData) == null ? void 0 : e.show_tooltip
59
+ ),
60
+ trigger: "item",
61
+ formatter: (i) => h(i)
62
+ },
63
+ visualMap: {
64
+ min: Math.min(...this.prepareData().map((i) => i[1])),
65
+ max: Math.max(...this.prepareData().map((i) => i[1])),
66
+ type: "piecewise",
67
+ orient: "horizontal",
68
+ left: "center",
69
+ top: 65
70
+ },
71
+ calendar: {
72
+ top: 120,
73
+ left: 30,
74
+ right: 30,
75
+ cellSize: ["auto", 20],
76
+ range: this.calendarRange,
77
+ itemStyle: {
78
+ borderWidth: 0.5
79
+ },
80
+ yearLabel: { show: !1 }
81
+ },
82
+ series: {
83
+ name: "calendar",
84
+ type: "heatmap",
85
+ coordinateSystem: "calendar",
86
+ data: this.prepareData(),
87
+ itemStyle: {
88
+ borderWidth: 0.5
89
+ }
90
+ }
91
+ };
92
+ r.setOption(n), r.resize(), window.addEventListener("resize", () => {
93
+ r.resize();
94
+ });
95
+ } catch (a) {
96
+ console.error(a);
97
+ }
98
+ }
99
+ }
100
+ }, u = {
101
+ ref: "chart",
102
+ class: "h-full w-full min-h-[200px] pb-2"
103
+ };
104
+ function D(t, e, a, r, n, i) {
105
+ return p(), d("div", u, null, 512);
106
+ }
107
+ const y = /* @__PURE__ */ s(m, [["render", D]]);
108
+ export {
109
+ y as default
110
+ };
@@ -0,0 +1,105 @@
1
+ import { _ as o, c, a as h, b as l, d as n, i as d } from "./import-file-CRC0sYYT.js";
2
+ import { openBlock as p, createElementBlock as u } from "vue";
3
+ const m = {
4
+ name: "VsFunnelBar",
5
+ mixins: [c],
6
+ data() {
7
+ return {
8
+ chartInstance: null,
9
+ uniqueID: null
10
+ };
11
+ },
12
+ async mounted() {
13
+ this.uniqueID = this.widget, await this.$nextTick(), await this.getData();
14
+ const { series: t } = this.prepareData();
15
+ t && this.initChart(t);
16
+ },
17
+ methods: {
18
+ buildTooltipForDonut(t, r) {
19
+ const { name: s, value: a, percent: e } = t;
20
+ return `
21
+ <div style="background-color:${r[0]};font-size: 12px; font-family: Helvetica, Arial, sans-serif;color:#ffff; padding:5px; border-radius:5px; ![box-shadow:none]">
22
+ ${h(s)}: ${l(a)} (${e}%)
23
+ </div>`;
24
+ },
25
+ onChangedData() {
26
+ try {
27
+ if (this.sourceData) {
28
+ const { series: t, xs: r, ys: s } = this.prepareData();
29
+ t && (this == null || this.initChart(t, r, s));
30
+ }
31
+ } catch {
32
+ }
33
+ },
34
+ prepareData() {
35
+ try {
36
+ const t = Array.from(
37
+ new Set(this.sourceData.map((e) => e[this.dimensions[0]]))
38
+ ), r = Array.from(
39
+ new Set(this.sourceData.map((e) => e[this.dimensions[1]]))
40
+ ), s = t.map((e, i) => ({
41
+ name: e,
42
+ value: r[i]
43
+ }));
44
+ return { series: [
45
+ {
46
+ name: this.titleCharts ? this.titleCharts : this.dimensions[0],
47
+ type: "funnel",
48
+ ...n(this.styleData),
49
+ data: s,
50
+ height: "100%",
51
+ emphasis: {
52
+ label: {
53
+ show: !1
54
+ }
55
+ }
56
+ }
57
+ ] };
58
+ } catch (t) {
59
+ console.error(t);
60
+ }
61
+ },
62
+ async initChart(t) {
63
+ try {
64
+ const r = this.$refs.chart, s = d(r), a = {
65
+ series: t,
66
+ ...n(this.styleData),
67
+ tooltip: {
68
+ trigger: "item",
69
+ formatter: (e) => this.buildTooltipForDonut(e, [e.color]),
70
+ borderWidth: 0,
71
+ appendToBody: !0,
72
+ borderColor: "transparent",
73
+ textStyle: {
74
+ color: "#000"
75
+ },
76
+ padding: [10, 15],
77
+ shadowColor: "transparent",
78
+ backgroundColor: "transparent"
79
+ },
80
+ itemStyle: {
81
+ height: "15px"
82
+ },
83
+ labelLine: {
84
+ show: !1
85
+ }
86
+ };
87
+ s.setOption(a), s.resize(), window.addEventListener("resize", () => {
88
+ s.resize();
89
+ });
90
+ } catch (r) {
91
+ console.error(r);
92
+ }
93
+ }
94
+ }
95
+ }, f = {
96
+ ref: "chart",
97
+ class: "h-[90%] custom-scrollbar min-h-[200px]"
98
+ };
99
+ function y(t, r, s, a, e, i) {
100
+ return p(), u("div", f, null, 512);
101
+ }
102
+ const b = /* @__PURE__ */ o(m, [["render", y]]);
103
+ export {
104
+ b as default
105
+ };
@@ -0,0 +1,97 @@
1
+ import { _ as u, c as m, a as d, i as f, t as x, e as y, g as c, d as D } from "./import-file-CRC0sYYT.js";
2
+ import { openBlock as _, createElementBlock as g } from "vue";
3
+ const w = {
4
+ name: "VsHeatmap",
5
+ mixins: [m],
6
+ data() {
7
+ return {
8
+ chartInstance: null,
9
+ label: null,
10
+ uniqueID: null
11
+ };
12
+ },
13
+ async mounted() {
14
+ this.uniqueID = this.widget, await this.$nextTick(), await this.getData();
15
+ const { series: t, xs: s, ys: a } = this.prepareData();
16
+ t && this.initChart(t, s, a, !0);
17
+ },
18
+ methods: {
19
+ onChangedData() {
20
+ try {
21
+ if (this.sourceData) {
22
+ const { series: t, xs: s, ys: a } = this.prepareData();
23
+ t && (this == null || this.initChart(t, s, a));
24
+ }
25
+ } catch {
26
+ return null;
27
+ }
28
+ },
29
+ prepareData() {
30
+ try {
31
+ const t = Array.from(
32
+ new Set(this.sourceData.map((e) => e[this.dimensions[0]]))
33
+ );
34
+ let s;
35
+ this.dimensions[0].includes("date") ? s = t.map((e) => d(e)) : s = [...t];
36
+ const a = this.dimensions.filter((e, i) => i != 0), r = [];
37
+ for (let e = 0; e < s.length; e++)
38
+ for (let i = 0; i < a.length; i++)
39
+ r.push([e, i, this.sourceData[e][a[i]]]);
40
+ return { series: {
41
+ name: this.titleCharts ? this.titleCharts : this.dimensions[0],
42
+ type: "heatmap",
43
+ data: r
44
+ }, xs: s, ys: a };
45
+ } catch (t) {
46
+ return console.error(t), null;
47
+ }
48
+ },
49
+ async initChart(t, s, a) {
50
+ var r, n, e, i;
51
+ try {
52
+ const o = this.$refs.chart, l = f(o), h = {
53
+ tooltip: {
54
+ ...x(
55
+ (r = this.styleData) == null ? void 0 : r.tooltip,
56
+ (n = this.styleData) == null ? void 0 : n.show_tooltip
57
+ ),
58
+ trigger: "item",
59
+ formatter: (p) => y(p)
60
+ },
61
+ xAxis: {
62
+ data: s,
63
+ axisLabel: c((e = this.styleData) == null ? void 0 : e.x_axis)
64
+ },
65
+ visualMap: {
66
+ min: 0,
67
+ max: 1e6,
68
+ calculable: !0,
69
+ orient: "horizontal",
70
+ left: "center"
71
+ },
72
+ yAxis: {
73
+ data: a,
74
+ axisLabel: c((i = this.styleData) == null ? void 0 : i.y_axis)
75
+ },
76
+ series: t,
77
+ ...D(this.styleData)
78
+ };
79
+ l.setOption(h), l.resize(), window.addEventListener("resize", () => {
80
+ l.resize();
81
+ });
82
+ } catch (o) {
83
+ console.error(o);
84
+ }
85
+ }
86
+ }
87
+ }, b = {
88
+ ref: "chart",
89
+ class: "h-full w-full min-h-[200px] pb-2"
90
+ };
91
+ function C(t, s, a, r, n, e) {
92
+ return _(), g("div", b, null, 512);
93
+ }
94
+ const z = /* @__PURE__ */ u(w, [["render", C]]);
95
+ export {
96
+ z as default
97
+ };
@@ -1,15 +1,16 @@
1
- import { l as V, m as v } from "./map-component-mixin-BLM9iEWA.js";
2
- import { _, c as $ } from "./import-file-1T7kpSzt.js";
1
+ import { l as V, m as v } from "./map-component-mixin-BCtWEvzv.js";
2
+ import { _, c as $ } from "./import-file-CRC0sYYT.js";
3
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
4
  function C(t, n) {
5
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;
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), c = Math.min(o, s, a);
7
+ let i, l;
8
+ const m = (e + c) / 2;
9
+ if (e === c)
10
+ i = l = 0;
10
11
  else {
11
- const r = e - l;
12
- switch (c = m > 0.5 ? r / (2 - e - l) : r / (e + l), e) {
12
+ const r = e - c;
13
+ switch (l = m > 0.5 ? r / (2 - e - c) : r / (e + c), e) {
13
14
  case o:
14
15
  i = (s - a) / r + (s < a ? 6 : 0);
15
16
  break;
@@ -22,13 +23,13 @@ function C(t, n) {
22
23
  }
23
24
  i /= 6;
24
25
  }
25
- return `hsl(${Math.round(i * 360)},${Math.round(c * 100)}%,${n}%)`;
26
+ return `hsl(${Math.round(i * 360)},${Math.round(l * 100)}%,${n}%)`;
26
27
  }
27
28
  function H(t, n) {
28
29
  var e;
29
30
  const o = document.createElement("div");
30
31
  o.style.color = t, document.body.appendChild(o);
31
- let s = ((e = window.getComputedStyle(o)) == null ? void 0 : e.color) || [];
32
+ const s = ((e = window.getComputedStyle(o)) == null ? void 0 : e.color) || [];
32
33
  document.body.removeChild(o);
33
34
  const a = s.match(/\d+/g).map(Number) || [];
34
35
  return this.rgbToHSL(a[0], a[1], n);
@@ -43,7 +44,9 @@ const E = {
43
44
  },
44
45
  methods: {
45
46
  async getMapData() {
46
- const n = await (await fetch(`/api/bi-cluster?widget=${this.widget}&dashboard=${this.dashboard}`)).json();
47
+ const n = await (await fetch(
48
+ `/api/bi-cluster?widget=${this.widget}&dashboard=${this.dashboard}`
49
+ )).json();
47
50
  this.data = n;
48
51
  },
49
52
  async loadHandler() {
@@ -63,38 +66,38 @@ const E = {
63
66
  });
64
67
  }
65
68
  }
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]" };
69
+ }, j = { class: "h-full w-full relative" }, B = ["id"], I = { class: "absolute h-[50px] flex w-[80px] justify-end rounded-[7px] bottom-[40px] right-[10px]" };
67
70
  function N(t, n, o, s, a, e) {
68
71
  var u, h, b, g, f, y;
69
- const l = d("VsList"), i = d("VsMapSetting"), c = d("VsMapSlotLayers"), m = d("VsMapGoHome"), r = d("VsMapLegend");
72
+ const c = d("VsList"), i = d("VsMapSetting"), l = d("VsMapSlotLayers"), m = d("VsMapGoHome"), r = d("VsMapLegend");
70
73
  return M(), L("div", j, [
71
- p(l, {
74
+ p(c, {
72
75
  source: (u = t.data) == null ? void 0 : u.rows,
73
76
  total: ((h = t.data) == null ? void 0 : h.total) || 0,
74
77
  count: ((b = t.data) == null ? void 0 : b.count) || 0
75
78
  }, null, 8, ["source", "total", "count"]),
76
79
  w("div", {
77
80
  id: t.mapId,
78
- class: "h-[96%] w-full flex items-end"
81
+ class: "h-[96%] w-full flex items-end min-h-[250px]"
79
82
  }, null, 8, B),
80
83
  t.showSetting ? (M(), S(i, {
81
84
  key: 0,
82
85
  map: t.map,
83
86
  coordinates: t.coordinatesByMouse
84
87
  }, null, 8, ["map", "coordinates"])) : k("", !0),
85
- p(c, { map: t.map }, null, 8, ["map"]),
88
+ p(l, { map: t.map }, null, 8, ["map"]),
86
89
  w("div", I, [
87
90
  p(m, {
88
91
  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"])
92
+ bbox: (g = t.data) == null ? void 0 : g.bbox
93
+ }, null, 8, ["map", "bbox"]),
94
+ p(r, {
95
+ colors: (f = t.data) == null ? void 0 : f.colors,
96
+ sizes: (y = t.data) == null ? void 0 : y.sizes,
97
+ color: t.color,
98
+ cluster: !0
99
+ }, null, 8, ["colors", "sizes", "color"])
100
+ ])
98
101
  ]);
99
102
  }
100
103
  const A = /* @__PURE__ */ _(E, [["render", N]]);
@@ -0,0 +1,74 @@
1
+ import { l as g, m as M } from "./map-component-mixin-BCtWEvzv.js";
2
+ import { _ as w, c as y } from "./import-file-CRC0sYYT.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 x = {
5
+ mixins: [y, g, M],
6
+ name: "VsMap",
7
+ async mounted() {
8
+ await this.getMapData(), await this.createMap();
9
+ },
10
+ methods: {
11
+ async getMapData() {
12
+ const s = await (await fetch(
13
+ `/api/bi-map?widget=${this.widget}&dashboard=${this.dashboard}`
14
+ )).json();
15
+ this.data = s;
16
+ },
17
+ async loadHandler() {
18
+ const a = ["#69D2E7", "yellow", "#FE4365"], s = this.data.colors ? ["match", ["get", "x"]].concat(
19
+ this.data.colors.reduce(
20
+ (o, t, c) => o.concat(t.val, a[c]),
21
+ []
22
+ )
23
+ ).concat(["gray"]) : "blue", l = [5, 7, 9, 11, 13], e = this.data.sizes ? ["case"] : 5;
24
+ this.data.sizes && (this.data.sizes.reverse().forEach((o, t) => {
25
+ e.push([">", ["get", "metric"], o]), e.push(l[t]);
26
+ }), e.push(5));
27
+ const n = {
28
+ type: "circle",
29
+ color: s,
30
+ width: 2,
31
+ radius: e,
32
+ stroke: "#eee"
33
+ };
34
+ Object.assign(n, this.data.style || {}), this.addVtileLayer({
35
+ id: "bi",
36
+ url: `${window.location.origin}/api/bi-vtile/{z}/{x}/{y}.vmt?widget=${this.widget}&dashboard=${this.dashboard}&nocache=1`,
37
+ style: n
38
+ });
39
+ }
40
+ }
41
+ }, $ = { class: "h-full w-full relative" }, z = ["id"], k = { ref: "popup" }, E = { class: "absolute h-[50px] flex w-[80px] justify-end rounded-[7px] bottom-[40px] right-[10px]" };
42
+ function L(a, s, l, e, n, o) {
43
+ var p, m, h;
44
+ const t = i("VsMapSetting"), c = i("VsMapSlotLayers"), f = i("VsMapGoHome"), b = i("VsMapLegend");
45
+ return u(), _("div", $, [
46
+ r("div", {
47
+ id: a.mapId,
48
+ class: "h-[96%] w-full flex items-end relative min-h-[250px]"
49
+ }, [
50
+ r("div", k, null, 512)
51
+ ], 8, z),
52
+ a.showSetting ? (u(), V(t, {
53
+ key: 0,
54
+ map: a.map,
55
+ coordinates: a.coordinatesByMouse
56
+ }, null, 8, ["map", "coordinates"])) : v("", !0),
57
+ d(c, { map: a.map }, null, 8, ["map"]),
58
+ r("div", E, [
59
+ d(f, {
60
+ map: a.map,
61
+ bbox: (p = a.data) == null ? void 0 : p.bbox
62
+ }, null, 8, ["map", "bbox"]),
63
+ d(b, {
64
+ colors: (m = a.data) == null ? void 0 : m.colors,
65
+ sizes: (h = a.data) == null ? void 0 : h.sizes,
66
+ color: a.color
67
+ }, null, 8, ["colors", "sizes", "color"])
68
+ ])
69
+ ]);
70
+ }
71
+ const C = /* @__PURE__ */ w(x, [["render", L]]);
72
+ export {
73
+ C as default
74
+ };
@@ -0,0 +1,55 @@
1
+ import { _ as c, c as o, f as n } from "./import-file-CRC0sYYT.js";
2
+ import { openBlock as i, createElementBlock 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: "font-[Inter,_Helvetica,_Arial] p-4 w-full text-[28px] pt-[10px] min-h-[150px] border-0" };
49
+ function p(e, t, r, f, d, a) {
50
+ return i(), m("div", h, s(a.prefix) + s(a.formattedNumber), 1);
51
+ }
52
+ const x = /* @__PURE__ */ c(u, [["render", p]]);
53
+ export {
54
+ x as default
55
+ };