@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.
- package/README.md +50 -52
- package/config.js +12 -12
- package/dist/bi.js +1 -1
- package/dist/bi.umd.cjs +120 -134
- package/dist/{import-file-1T7kpSzt.js → import-file-CRC0sYYT.js} +11974 -11522
- package/dist/{map-component-mixin-BLM9iEWA.js → map-component-mixin-BCtWEvzv.js} +4830 -3150
- package/dist/style.css +1 -1
- package/dist/vs-calendar-5ot79n0N.js +110 -0
- package/dist/vs-funnel-bar-CLo6gXI_.js +105 -0
- package/dist/vs-heatmap-DHGA8dRk.js +97 -0
- package/dist/{vs-map-cluster-Dfe9INqE.js → vs-map-cluster-CNgX6JVF.js} +28 -25
- package/dist/vs-map-pIn5wS4G.js +74 -0
- package/dist/vs-number-DYfok8VU.js +55 -0
- package/dist/{vs-text-DcrAdQ40.js → vs-text-Dckykz09.js} +19 -13
- package/package.json +107 -72
- package/plugin.js +14 -13
- package/server/migrations/bi.dataset.sql +26 -0
- package/server/migrations/bi.sql +93 -27
- package/server/plugins/docs.js +48 -47
- package/server/plugins/hook.js +89 -86
- package/server/plugins/vite.js +69 -55
- package/server/routes/dashboard/controllers/dashboard.delete.js +38 -35
- package/server/routes/dashboard/controllers/dashboard.js +118 -80
- package/server/routes/dashboard/controllers/dashboard.list.js +30 -39
- package/server/routes/dashboard/controllers/utils/yaml.js +11 -12
- package/server/routes/dashboard/index.mjs +25 -24
- package/server/routes/data/controllers/data.js +168 -97
- package/server/routes/data/controllers/util/chartSQL.js +42 -25
- package/server/routes/data/controllers/util/normalizeData.js +59 -34
- package/server/routes/data/index.mjs +29 -26
- package/server/routes/dataset/controllers/bi.dataset.demo.add.js +97 -0
- package/server/routes/dataset/controllers/bi.dataset.import.js +67 -0
- package/server/routes/dataset/controllers/util/create.table.js +22 -0
- package/server/routes/dataset/controllers/util/prepare.data.js +49 -0
- package/server/routes/dataset/index.mjs +19 -0
- package/server/routes/db/controllers/dbTablePreview.js +63 -0
- package/server/routes/db/controllers/dbTables.js +36 -0
- package/server/routes/db/index.mjs +17 -0
- package/server/routes/edit/controllers/dashboard.add.js +26 -23
- package/server/routes/edit/controllers/dashboard.edit.js +46 -37
- package/server/routes/edit/controllers/widget.add.js +75 -49
- package/server/routes/edit/controllers/widget.del.js +69 -63
- package/server/routes/edit/controllers/widget.edit.js +52 -82
- package/server/routes/edit/index.mjs +31 -27
- package/server/routes/map/controllers/cluster.js +109 -75
- package/server/routes/map/controllers/clusterVtile.js +166 -143
- package/server/routes/map/controllers/geojson.js +127 -101
- package/server/routes/map/controllers/map.js +60 -57
- package/server/routes/map/controllers/utils/downloadClusterData.js +43 -0
- package/server/routes/map/controllers/vtile.js +183 -161
- package/server/routes/map/index.mjs +25 -25
- package/server/utils/getWidget.js +85 -56
- package/utils.js +12 -11
- package/dist/vs-calendar-WiK1hcHS.js +0 -96
- package/dist/vs-funnel-bar-CpPbYZ0_.js +0 -92
- package/dist/vs-heatmap-BG4eIROH.js +0 -83
- package/dist/vs-map-BRk6Fmks.js +0 -66
- package/dist/vs-number-CJq-vi95.js +0 -39
|
@@ -1,56 +1,85 @@
|
|
|
1
|
-
import { getTemplate } from '@opengis/fastify-table/utils.js';
|
|
2
|
-
|
|
3
|
-
const pg = pgClients.client;
|
|
4
|
-
|
|
5
|
-
async function getWidget({ dashboard, widget }) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
1
|
+
import { getTemplate, pgClients } from '@opengis/fastify-table/utils.js';
|
|
2
|
+
|
|
3
|
+
const pg = pgClients.client;
|
|
4
|
+
|
|
5
|
+
async function getWidget({ dashboard, widget }) {
|
|
6
|
+
if (!dashboard && !widget) {
|
|
7
|
+
return { message: `not enough params: dashboard / widget`, status: 400 };
|
|
8
|
+
}
|
|
9
|
+
const dashboardData = dashboard
|
|
10
|
+
? await getTemplate('dashboard', dashboard)
|
|
11
|
+
: null;
|
|
12
|
+
|
|
13
|
+
const { id, tableName } =
|
|
14
|
+
!dashboardData && pg.pk['bi.dashboard'] && dashboard
|
|
15
|
+
? await pg
|
|
16
|
+
.query(
|
|
17
|
+
`select dashboard_id as id, table_name as "tableName" from bi.dashboard where $1 in (dashboard_id, name)`,
|
|
18
|
+
[dashboard]
|
|
19
|
+
)
|
|
20
|
+
.then((res1) => res1.rows?.[0] || {})
|
|
21
|
+
: {};
|
|
22
|
+
|
|
23
|
+
if (!dashboardData && dashboard && !id) {
|
|
24
|
+
return { message: `dashboard not found: ${dashboard}`, status: 404 };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
dashboardData?.forEach((el) => {
|
|
28
|
+
el[2] = el[0].split('.')[0];
|
|
29
|
+
});
|
|
30
|
+
const dashboardIndex = dashboardData?.find((el) => el[2] == 'index')?.[1];
|
|
31
|
+
|
|
32
|
+
const widgetData = dashboard
|
|
33
|
+
? dashboardData?.find((el) => el[2] === (widget || 'index'))?.[1]
|
|
34
|
+
: await getTemplate('widget', widget);
|
|
35
|
+
if (typeof widgetData === 'string') {
|
|
36
|
+
return { source: widgetData, status: 200 };
|
|
37
|
+
}
|
|
38
|
+
if (!id && !dashboardData && !widgetData) {
|
|
39
|
+
return { message: `not found ${widget} ${dashboard}`, status: 404 };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const q = `select *, coalesce(data::jsonb, '{}'::jsonb) || jsonb_build_object('table', table_name) as data from bi.widget where dashboard_id=$1 and name=$2`;
|
|
43
|
+
|
|
44
|
+
const {
|
|
45
|
+
type,
|
|
46
|
+
text,
|
|
47
|
+
data = {},
|
|
48
|
+
controls,
|
|
49
|
+
style,
|
|
50
|
+
options,
|
|
51
|
+
yml
|
|
52
|
+
} = widgetData ||
|
|
53
|
+
(await pg
|
|
54
|
+
.query(q, [id || dashboard, widget])
|
|
55
|
+
.then((res1) => res1.rows?.[0] || {}));
|
|
56
|
+
|
|
57
|
+
if (!type) {
|
|
58
|
+
return { message: `widget not found: ${widget}`, status: 404 };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Object.assign(data, {
|
|
62
|
+
table:
|
|
63
|
+
data.table ||
|
|
64
|
+
tableName ||
|
|
65
|
+
widgetData?.table_name ||
|
|
66
|
+
dashboardIndex?.table ||
|
|
67
|
+
dashboardIndex?.table_name,
|
|
68
|
+
db: dashboardIndex?.db || pgClients.client?.options?.database,
|
|
69
|
+
});
|
|
70
|
+
const main = { ...(dashboardIndex || {}), ...widgetData, ...data, ...data?.data || {} };
|
|
71
|
+
|
|
72
|
+
if (!main?.table) {
|
|
73
|
+
return {
|
|
74
|
+
message: /* json.error || */ `invalid ${widget ? 'widget' : 'dashboard'}: 1`,
|
|
75
|
+
status: 404,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const tableSQL = main?.sql?.map(
|
|
80
|
+
(el, i) => `left join lateral(${el})t${i + 1} on 1=1`
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
return { ...main, tableSQL, data, type, text, controls, style, options, yml };
|
|
84
|
+
}
|
|
85
|
+
export default getWidget;
|
package/utils.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
// This file contains code that we reuse
|
|
2
|
-
// between our tests.
|
|
3
|
-
|
|
4
|
-
// import getTemplatePath from '@opengis/fastify-table/table/controllers/utils/getTemplatePath.js';
|
|
5
|
-
import getWidget from './server/utils/getWidget.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
// This file contains code that we reuse
|
|
2
|
+
// between our tests.
|
|
3
|
+
|
|
4
|
+
// import getTemplatePath from '@opengis/fastify-table/table/controllers/utils/getTemplatePath.js';
|
|
5
|
+
import getWidget from './server/utils/getWidget.js';
|
|
6
|
+
import yamlSafe from './server/routes/dashboard/controllers/utils/yaml.js';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
// getTemplatePath,
|
|
10
|
+
yamlSafe,
|
|
11
|
+
getWidget,
|
|
12
|
+
};
|
|
@@ -1,96 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -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
|
-
};
|
package/dist/vs-map-BRk6Fmks.js
DELETED
|
@@ -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
|
-
};
|