@opengis/bi 1.0.13 → 1.0.14

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 (50) hide show
  1. package/README.md +2 -4
  2. package/config.js +5 -5
  3. package/dist/bi.js +1 -1
  4. package/dist/bi.umd.cjs +116 -130
  5. package/dist/{import-file-1T7kpSzt.js → import-file-DUp3rsNI.js} +11132 -10748
  6. package/dist/{map-component-mixin-BLM9iEWA.js → map-component-mixin-CGM0P5ub.js} +1135 -1134
  7. package/dist/style.css +1 -1
  8. package/dist/{vs-calendar-WiK1hcHS.js → vs-calendar-cOoinEwc.js} +33 -30
  9. package/dist/vs-funnel-bar-kLkPoIhJ.js +105 -0
  10. package/dist/vs-heatmap-3XAVGTSo.js +98 -0
  11. package/dist/vs-map-B1tr6V5_.js +74 -0
  12. package/dist/{vs-map-cluster-Dfe9INqE.js → vs-map-cluster-BWJPx7wE.js} +28 -25
  13. package/dist/vs-number-CrU7LmkV.js +48 -0
  14. package/dist/{vs-text-DcrAdQ40.js → vs-text-DRPx3aID.js} +2 -1
  15. package/package.json +37 -12
  16. package/plugin.js +4 -4
  17. package/server/migrations/bi.sql +66 -0
  18. package/server/plugins/docs.js +36 -35
  19. package/server/plugins/hook.js +72 -69
  20. package/server/plugins/vite.js +22 -8
  21. package/server/routes/dashboard/controllers/dashboard.delete.js +5 -3
  22. package/server/routes/dashboard/controllers/dashboard.js +66 -32
  23. package/server/routes/dashboard/controllers/dashboard.list.js +2 -5
  24. package/server/routes/dashboard/controllers/utils/yaml.js +1 -2
  25. package/server/routes/dashboard/index.mjs +5 -4
  26. package/server/routes/data/controllers/data.js +94 -34
  27. package/server/routes/data/controllers/util/chartSQL.js +24 -10
  28. package/server/routes/data/controllers/util/normalizeData.js +51 -29
  29. package/server/routes/data/index.mjs +1 -3
  30. package/server/routes/db/controllers/dbTablePreview.js +63 -0
  31. package/server/routes/db/controllers/dbTables.js +36 -0
  32. package/server/routes/db/index.mjs +17 -0
  33. package/server/routes/edit/controllers/dashboard.add.js +6 -5
  34. package/server/routes/edit/controllers/dashboard.edit.js +16 -9
  35. package/server/routes/edit/controllers/widget.add.js +43 -19
  36. package/server/routes/edit/controllers/widget.del.js +13 -6
  37. package/server/routes/edit/controllers/widget.edit.js +34 -13
  38. package/server/routes/edit/index.mjs +14 -10
  39. package/server/routes/map/controllers/cluster.js +89 -60
  40. package/server/routes/map/controllers/clusterVtile.js +154 -84
  41. package/server/routes/map/controllers/geojson.js +48 -22
  42. package/server/routes/map/controllers/map.js +51 -51
  43. package/server/routes/map/controllers/vtile.js +61 -40
  44. package/server/routes/map/index.mjs +1 -1
  45. package/server/utils/getWidget.js +67 -40
  46. package/utils.js +5 -4
  47. package/dist/vs-funnel-bar-CpPbYZ0_.js +0 -92
  48. package/dist/vs-heatmap-BG4eIROH.js +0 -83
  49. package/dist/vs-map-BRk6Fmks.js +0 -66
  50. 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-e51369e3]{position:relative}.ui-dialog__modal[data-v-e51369e3]{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-e51369e3]{min-height:0;height:100%;overflow:auto}.ui-dialog__content[data-v-e51369e3]::-webkit-scrollbar{width:6px;height:6px;background-color:#f5f5f5}.ui-dialog__content[data-v-e51369e3]::-webkit-scrollbar-thumb{border-radius:10px;background-color:#d9d9d9bf}.ui-dialog__content[data-v-e51369e3]::-webkit-scrollbar-track{background-color:#f5f5f5}@media (max-width: 650px){.ui-dialog__modal[data-v-e51369e3]{top:50%}}.fade-enter-active[data-v-e51369e3],.fade-leave-active[data-v-e51369e3]{transition:opacity .2s}.fade-enter-from[data-v-e51369e3],.fade-leave-to[data-v-e51369e3]{opacity:0}.content-enter-active[data-v-e51369e3],.content-leave-active[data-v-e51369e3]{transition:transform .4s}.content-enter-from[data-v-e51369e3],.content-leave-to[data-v-e51369e3]{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-aebbde6b]{position:absolute;display:flex;bottom:10px;left:15px}.vs-map-slot-layers__layer[data-v-aebbde6b]{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-aebbde6b]:hover{background-color:#eee}.vs-map-slot-layers__image[data-v-aebbde6b]{width:100%;border-radius:5px;object-fit:contain}.focused[data-v-aebbde6b]{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,10 +1,12 @@
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 = {
1
+ import { _ as s, c as o, i as l, t as c, h } from "./import-file-DUp3rsNI.js";
2
+ import { openBlock as p, createElementBlock as d } from "vue";
3
+ const m = {
4
+ name: "VsCalendar",
4
5
  mixins: [o],
6
+ name: "VsCalendar",
5
7
  data() {
6
8
  return {
7
- myChartvt: null,
9
+ chartInstance: null,
8
10
  label: null,
9
11
  uniqueID: null
10
12
  };
@@ -15,36 +17,37 @@ const u = {
15
17
  }
16
18
  },
17
19
  async mounted() {
18
- this.uniqueID = l(), await this.$nextTick(), await this.getData(), this.initChart();
20
+ this.uniqueID = this.widget, await this.$nextTick(), await this.getData(), this.initChart();
19
21
  },
20
22
  methods: {
21
23
  prepareData() {
22
- var a;
23
24
  try {
24
- const t = Object.keys((a = this.sourceData) == null ? void 0 : a[0]);
25
25
  return this.sourceData.map((e) => [
26
- e[t[0]].split("T")[0],
27
- Number(e[t[1]])
26
+ e[this.dimensions[0]].split("T")[0],
27
+ Number(e[this.dimensions[1]])
28
28
  ]);
29
29
  } catch (t) {
30
30
  console.error(t);
31
31
  }
32
32
  },
33
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()];
34
+ const t = this.sourceData.map((r) => new Date(r[this.dimensions[0]].split("T")[0])), e = new Date(Math.min(...t)), a = new Date(Math.max(...t));
35
+ return [
36
+ e.getFullYear().toString(),
37
+ a.getFullYear().toString()
38
+ ];
37
39
  },
38
40
  async initChart() {
39
- var a, t;
41
+ var t, e;
40
42
  try {
41
- const r = document.getElementById(this.uniqueID), e = c(r);
42
- console.log(this.calendarRange);
43
- const i = {
43
+ const a = this.$refs.chart, r = l(a), i = {
44
44
  tooltip: {
45
- ...h((a = this.styleData) == null ? void 0 : a.tooltip, (t = this.styleData) == null ? void 0 : t.show_tooltip),
45
+ ...c(
46
+ (t = this.styleData) == null ? void 0 : t.tooltip,
47
+ (e = this.styleData) == null ? void 0 : e.show_tooltip
48
+ ),
46
49
  trigger: "item",
47
- formatter: (n) => p(n)
50
+ formatter: (n) => h(n)
48
51
  },
49
52
  visualMap: {
50
53
  min: Math.min(...this.prepareData().map((n) => n[1])),
@@ -75,22 +78,22 @@ const u = {
75
78
  }
76
79
  }
77
80
  };
78
- e.setOption(i), e.resize(), window.addEventListener("resize", () => {
79
- e.resize();
81
+ r.setOption(i), r.resize(), window.addEventListener("resize", () => {
82
+ r.resize();
80
83
  });
81
- } catch (r) {
82
- console.error(r);
84
+ } catch (a) {
85
+ console.error(a);
83
86
  }
84
87
  }
85
88
  }
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);
89
+ }, u = {
90
+ ref: "chart",
91
+ class: "h-full w-full min-h-[200px] pb-2"
92
+ };
93
+ function D(t, e, a, r, i, n) {
94
+ return p(), d("div", u, null, 512);
92
95
  }
93
- const _ = /* @__PURE__ */ s(u, [["render", g]]);
96
+ const y = /* @__PURE__ */ s(m, [["render", D]]);
94
97
  export {
95
- _ as default
98
+ y as default
96
99
  };
@@ -0,0 +1,105 @@
1
+ import { _ as o, c, a as h, b as l, d as n, i as d } from "./import-file-DUp3rsNI.js";
2
+ import { openBlock as p, createElementBlock as u } from "vue";
3
+ const m = {
4
+ mixins: [c],
5
+ name: "VsFunnelBar",
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,98 @@
1
+ import { _ as m, c as u, a as d, i as f, t as x, e as y, g as c, d as D } from "./import-file-DUp3rsNI.js";
2
+ import { openBlock as _, createElementBlock as g } from "vue";
3
+ const w = {
4
+ name: "VsHeatmap",
5
+ mixins: [u],
6
+ name: "VsHeatmap",
7
+ data() {
8
+ return {
9
+ chartInstance: null,
10
+ label: null,
11
+ uniqueID: null
12
+ };
13
+ },
14
+ async mounted() {
15
+ this.uniqueID = this.widget, await this.$nextTick(), await this.getData();
16
+ const { series: t, xs: s, ys: a } = this.prepareData();
17
+ t && this.initChart(t, s, a, !0);
18
+ },
19
+ methods: {
20
+ onChangedData() {
21
+ try {
22
+ if (this.sourceData) {
23
+ const { series: t, xs: s, ys: a } = this.prepareData();
24
+ t && (this == null || this.initChart(t, s, a));
25
+ }
26
+ } catch {
27
+ return null;
28
+ }
29
+ },
30
+ prepareData() {
31
+ try {
32
+ const t = Array.from(
33
+ new Set(this.sourceData.map((e) => e[this.dimensions[0]]))
34
+ );
35
+ let s;
36
+ this.dimensions[0].includes("date") ? s = t.map((e) => d(e)) : s = [...t];
37
+ const a = this.dimensions.filter((e, i) => i != 0), r = [];
38
+ for (let e = 0; e < s.length; e++)
39
+ for (let i = 0; i < a.length; i++)
40
+ r.push([e, i, this.sourceData[e][a[i]]]);
41
+ return { series: {
42
+ name: this.titleCharts ? this.titleCharts : this.dimensions[0],
43
+ type: "heatmap",
44
+ data: r
45
+ }, xs: s, ys: a };
46
+ } catch (t) {
47
+ return console.error(t), null;
48
+ }
49
+ },
50
+ async initChart(t, s, a) {
51
+ var r, n, e, i;
52
+ try {
53
+ const o = this.$refs.chart, l = f(o), h = {
54
+ tooltip: {
55
+ ...x(
56
+ (r = this.styleData) == null ? void 0 : r.tooltip,
57
+ (n = this.styleData) == null ? void 0 : n.show_tooltip
58
+ ),
59
+ trigger: "item",
60
+ formatter: (p) => y(p)
61
+ },
62
+ xAxis: {
63
+ data: s,
64
+ axisLabel: c((e = this.styleData) == null ? void 0 : e.x_axis)
65
+ },
66
+ visualMap: {
67
+ min: 0,
68
+ max: 1e6,
69
+ calculable: !0,
70
+ orient: "horizontal",
71
+ left: "center"
72
+ },
73
+ yAxis: {
74
+ data: a,
75
+ axisLabel: c((i = this.styleData) == null ? void 0 : i.y_axis)
76
+ },
77
+ series: t,
78
+ ...D(this.styleData)
79
+ };
80
+ l.setOption(h), l.resize(), window.addEventListener("resize", () => {
81
+ l.resize();
82
+ });
83
+ } catch (o) {
84
+ console.error(o);
85
+ }
86
+ }
87
+ }
88
+ }, b = {
89
+ ref: "chart",
90
+ class: "h-full w-full min-h-[200px] pb-2"
91
+ };
92
+ function C(t, s, a, r, n, e) {
93
+ return _(), g("div", b, null, 512);
94
+ }
95
+ const z = /* @__PURE__ */ m(w, [["render", C]]);
96
+ export {
97
+ z as default
98
+ };
@@ -0,0 +1,74 @@
1
+ import { l as g, m as M } from "./map-component-mixin-CGM0P5ub.js";
2
+ import { _ as w, c as y } from "./import-file-DUp3rsNI.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
+ };
@@ -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-CGM0P5ub.js";
2
+ import { _, c as $ } from "./import-file-DUp3rsNI.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,48 @@
1
+ import { _ as n, c, f as i } from "./import-file-DUp3rsNI.js";
2
+ import { openBlock as o, createElementBlock as m, toDisplayString as s } from "vue";
3
+ const u = {
4
+ mixins: [c],
5
+ name: "VsNumber",
6
+ data() {
7
+ return {
8
+ number: ""
9
+ };
10
+ },
11
+ computed: {
12
+ formattedNumber() {
13
+ return i(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
+ async mounted() {
21
+ await this.getData(), this.getNumber();
22
+ },
23
+ watch: {
24
+ sourceData: {
25
+ handler: async function() {
26
+ this.getNumber();
27
+ },
28
+ deep: !0
29
+ }
30
+ },
31
+ methods: {
32
+ async getNumber() {
33
+ var e, t;
34
+ try {
35
+ this.number = ((t = this.sourceData[0]) == null ? void 0 : t[Object.keys((e = this.sourceData) == null ? void 0 : e[0])]) || 0;
36
+ } catch (r) {
37
+ console.error(r);
38
+ }
39
+ }
40
+ }
41
+ }, p = { class: "font-[Inter,_Helvetica,_Arial] p-4 w-full text-[28px] pt-[10px] min-h-[150px] border-0" };
42
+ function f(e, t, r, h, d, a) {
43
+ return o(), m("div", p, s(a.prefix) + s(a.formattedNumber), 1);
44
+ }
45
+ const x = /* @__PURE__ */ n(u, [["render", f]]);
46
+ export {
47
+ x as default
48
+ };
@@ -1,7 +1,7 @@
1
1
  var ge = Object.defineProperty;
2
2
  var ke = (c, e, t) => e in c ? ge(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
3
3
  var k = (c, e, t) => ke(c, typeof e != "symbol" ? e + "" : e, t);
4
- import { _ as de, c as xe } from "./import-file-1T7kpSzt.js";
4
+ import { _ as de, c as xe } from "./import-file-DUp3rsNI.js";
5
5
  import { openBlock as V, createElementBlock as J, createCommentVNode as be } from "vue";
6
6
  function D() {
7
7
  return {
@@ -1490,6 +1490,7 @@ y.parse;
1490
1490
  w.lex;
1491
1491
  const Ke = {
1492
1492
  mixins: [xe],
1493
+ name: "VsText",
1493
1494
  data() {
1494
1495
  return {
1495
1496
  markedText: null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/bi",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "BI data visualization module",
5
5
  "main": "dist/bi.js",
6
6
  "browser": "dist/bi.umd.cjs",
@@ -15,9 +15,11 @@
15
15
  "scripts": {
16
16
  "debug": "node --watch-path=server server",
17
17
  "dev": "vite",
18
+ "type-check": "vue-tsc --noEmit",
18
19
  "build": "vite build",
19
20
  "build-app": "cross-env APP=true vite build",
20
- "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
21
+ "lint": "eslint .",
22
+ "format": "prettier --write .",
21
23
  "test": "node --test",
22
24
  "test21": "node --test ./test/plugins/*",
23
25
  "start": "node server.js",
@@ -30,7 +32,9 @@
30
32
  "docs-dev:dev": "vitepress dev docs-dev",
31
33
  "docs-dev:build": "vitepress build docs-dev",
32
34
  "docs-dev:preview": "vitepress preview docs-dev",
33
- "adduser": "node script/adduser.js"
35
+ "adduser": "node script/adduser.js",
36
+ "prepare": "husky",
37
+ "commit": "cz --no-verify"
34
38
  },
35
39
  "keywords": [],
36
40
  "author": "Softpro",
@@ -39,11 +43,12 @@
39
43
  "@grpc/grpc-js": "^1.9.13",
40
44
  "@grpc/proto-loader": "^0.6.9",
41
45
  "@mapbox/sphericalmercator": "^1.2.0",
42
- "@opengis/fastify-auth": "^1.0.35",
43
- "@opengis/fastify-table": "^1.1.24",
46
+ "@opengis/fastify-auth": "^1.0.40",
47
+ "@opengis/fastify-table": "^1.1.29",
44
48
  "@opengis/v3-core": "^0.1.103",
45
- "@opengis/v3-filter": "^0.0.31",
49
+ "@opengis/v3-filter": "^0.0.36",
46
50
  "@turf/turf": "^7.1.0",
51
+ "@vueuse/core": "^11.1.0",
47
52
  "axios": "^1.3.1",
48
53
  "cross-env": "^7.0.3",
49
54
  "d3-format": "^3.1.0",
@@ -55,18 +60,38 @@
55
60
  "marked": "^14.1.2",
56
61
  "vite": "^5.1.5",
57
62
  "vue": "^3.4.27",
58
- "vue-router": "^4.4.3"
63
+ "vue-router": "^4.4.3",
64
+ "vue3-ace-editor": "^2.2.4"
59
65
  },
60
66
  "devDependencies": {
61
- "eslint": "^8.49.0",
67
+ "@commitlint/cli": "^19.5.0",
68
+ "@commitlint/config-conventional": "^19.5.0",
69
+ "@eslint/eslintrc": "^3.1.0",
70
+ "@eslint/js": "^9.12.0",
71
+ "@types/node": "^22.7.5",
72
+ "@types/echarts": "^4.9.22",
73
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
74
+ "@typescript-eslint/parser": "^8.8.1",
75
+ "@vitejs/plugin-vue": "^5.1.4",
76
+ "commitizen": "^4.3.1",
77
+ "eslint": "^8.57.1",
62
78
  "eslint-config-airbnb": "^19.0.4",
63
- "eslint-plugin-vue": "^9.17.0",
64
- "prettier": "^3.0.3",
79
+ "eslint-config-standard-with-typescript": "^43.0.1",
80
+ "globals": "^15.10.0",
81
+ "husky": "^9.1.6",
82
+ "prettier": "^3.3.3",
65
83
  "sass": "^1.77.0",
66
- "typescript": "~5.4.0",
84
+ "typescript": "^5.4.5",
85
+ "typescript-eslint": "~8.8.1",
67
86
  "vitepress": "^1.1.4",
68
87
  "vitepress-plugin-mermaid": "^2.0.16",
69
88
  "vitepress-plugin-tabs": "^0.5.0",
70
- "vitepress-sidebar": "^1.22.0"
89
+ "vitepress-sidebar": "^1.22.0",
90
+ "vue-tsc": "^2.1.6"
91
+ },
92
+ "config": {
93
+ "commitizen": {
94
+ "path": "cz-conventional-changelog"
95
+ }
71
96
  }
72
97
  }