@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
@@ -1,83 +0,0 @@
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
- };
@@ -1,66 +0,0 @@
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
- };
@@ -1,39 +0,0 @@
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
- };