@opengis/bi 1.0.24 → 1.0.25
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/dist/bi.js +1 -1
- package/dist/bi.umd.cjs +112 -138
- package/dist/{import-file-ChpPHgUN.js → import-file-D1BXgBLh.js} +10978 -11267
- package/dist/{map-component-mixin-C0Z88c8b.js → map-component-mixin-DVK92yIp.js} +254 -252
- package/dist/style.css +1 -1
- package/dist/vs-donut-DFofoWWE.js +148 -0
- package/dist/{vs-funnel-bar-Ba0HB6U8.js → vs-funnel-bar-CUEOqNnJ.js} +1 -1
- package/dist/{vs-map-T9bTjwSG.js → vs-map-DxaSAhZH.js} +3 -3
- package/dist/{vs-map-cluster-CQik8xir.js → vs-map-cluster-BqOHAVDj.js} +2 -2
- package/dist/{vs-number-DhACUDku.js → vs-number-C1s9pa7F.js} +1 -1
- package/dist/{vs-table-Df4lMM4d.js → vs-table-DCBSLb1s.js} +6 -6
- package/dist/{vs-text-D9iYudVA.js → vs-text-SoIN8Lt8.js} +1 -1
- package/package.json +4 -4
- package/server/routes/dashboard/controllers/dashboard.import.js +17 -5
- package/server/routes/dashboard/controllers/dashboard.js +39 -28
- package/server/routes/dashboard/controllers/dashboard.list.js +12 -9
- package/server/routes/data/controllers/data.js +13 -6
- package/server/routes/data/controllers/util/chartSQL.js +2 -1
- package/server/routes/data/controllers/util/normalizeData.js +7 -5
- package/server/routes/dataset/controllers/bi.dataset.list.js +1 -3
- package/server/routes/dataset/controllers/createDatasetPost.js +8 -5
- package/server/routes/dataset/controllers/dbTablePreview.js +3 -1
- package/server/routes/dataset/controllers/dbTables.js +3 -1
- package/server/routes/dataset/controllers/delete.js +1 -0
- package/server/routes/dataset/controllers/deleteDataset.js +1 -0
- package/server/routes/dataset/controllers/editDataset.js +1 -0
- package/server/routes/dataset/controllers/format.js +3 -1
- package/server/routes/dataset/controllers/insert.js +1 -0
- package/server/routes/dataset/controllers/update.js +1 -0
- package/server/routes/dataset/utils/createTableQuery.js +1 -1
- package/server/routes/dataset/utils/executeQuery.js +2 -2
- package/server/routes/edit/controllers/dashboard.add.js +16 -5
- package/server/routes/edit/controllers/dashboard.delete.js +11 -8
- package/server/routes/edit/controllers/dashboard.edit.js +20 -18
- package/server/routes/edit/controllers/widget.add.js +8 -8
- package/server/routes/edit/controllers/widget.del.js +4 -2
- package/server/routes/edit/controllers/widget.edit.js +25 -7
- package/server/routes/map/controllers/cluster.js +3 -2
- package/server/routes/map/controllers/clusterVtile.js +1 -1
- package/server/routes/map/controllers/geojson.js +2 -2
- package/server/routes/map/controllers/heatmap.js +2 -2
- package/server/routes/map/controllers/map.js +3 -2
- package/server/routes/map/controllers/vtile.js +1 -1
- package/server/templates/page/login.html +59 -0
- package/server/utils/getWidget.js +31 -18
- package/dist/vs-calendar-B4_gYR3Q.js +0 -116
- package/dist/vs-donut-BF1K_2LP.js +0 -150
- package/dist/vs-heatmap-Bzwa1rgF.js +0 -97
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" dir="">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<!-- scripts -->
|
|
6
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
7
|
+
</head>
|
|
8
|
+
|
|
9
|
+
<body class="bg-[#f3f4f6] flex items-center flex-1 w-full h-[100vh] overflow-x-hidden min-h-full ">
|
|
10
|
+
<main class="w-full">
|
|
11
|
+
<div class="flex w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-lg dark:bg-gray-800 lg:max-w-4xl">
|
|
12
|
+
<div class="hidden bg-left bg-cover lg:block lg:w-1/2" style="background-image: url('https://media.istockphoto.com/id/1296381479/vector/set-of-simple-infographic-graphs-and-charts-data-visualization-statistics-and-business.jpg?s=612x612&w=0&k=20&c=JpEoP-6w16OwVC49Sq2PEI8-dHF1CZnm7rHyL5DoxqA=');"></div>
|
|
13
|
+
|
|
14
|
+
<div class="w-full px-6 py-8 md:px-8 lg:w-1/2">
|
|
15
|
+
<div class="flex justify-center mx-auto">
|
|
16
|
+
<img width="300" height="100" src="https://cdn.softpro.ua/data/icons/logo-softpro.png" alt="logo">
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<p class="mt-3 mb-[32px] text-xl text-center text-gray-600 dark:text-gray-200">
|
|
20
|
+
Аналітичний модуль
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<form action="/api/login" method="get" >
|
|
24
|
+
<div class="mt-4">
|
|
25
|
+
<label class="block mb-2 text-sm font-medium text-gray-600 dark:text-gray-200" for="LoggingEmailAddress">Електронна пошта</label>
|
|
26
|
+
<input name="username" id="LoggingEmailAddress" class="block w-full px-4 py-2 text-gray-700 bg-white border rounded-lg dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 focus:border-blue-400 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring focus:ring-blue-300" type="text">
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div class="mt-4">
|
|
30
|
+
<div class="flex justify-between">
|
|
31
|
+
<label class="block mb-2 text-sm font-medium text-gray-600 dark:text-gray-200" for="loggingPassword">Пароль</label>
|
|
32
|
+
<!-- <a class="text-xs text-gray-500 dark:text-gray-300 hover:underline">Forget Password?</a> -->
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<input id="loggingPassword" name="password" class="block w-full px-4 py-2 text-gray-700 bg-white border rounded-lg dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 focus:border-blue-400 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring focus:ring-blue-300" type="password">
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<div class="mt-6">
|
|
39
|
+
<button type="submit" class="w-full px-6 py-3 text-sm font-medium tracking-wide text-white capitalize transition-colors duration-300 transform bg-gray-800 rounded-lg hover:bg-gray-700 focus:outline-none focus:ring focus:ring-gray-300 focus:ring-opacity-50">
|
|
40
|
+
Увійти
|
|
41
|
+
</button>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
</form>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</main>
|
|
48
|
+
|
|
49
|
+
</body>
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
const error = location.search.includes('wrong_pass')
|
|
54
|
+
if (error) {
|
|
55
|
+
document.getElementById('login_error').innerHTML = 'Не вірний користувач або пароль';
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
</html>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getTemplate, getPGAsync, pgClients } from '@opengis/fastify-table/utils.js';
|
|
1
|
+
import { getTemplate, getPGAsync, pgClients, getMeta } from '@opengis/fastify-table/utils.js';
|
|
2
2
|
|
|
3
3
|
import mdToHTML from '../helpers/mdToHTML.js';
|
|
4
4
|
|
|
5
|
-
async function getWidget({ dashboard, widget }) {
|
|
5
|
+
async function getWidget({ pg: pg1 = pgClients.client, dashboard, widget }) {
|
|
6
6
|
if (!dashboard && !widget) {
|
|
7
7
|
return { message: `not enough params: dashboard / widget`, status: 400 };
|
|
8
8
|
}
|
|
@@ -10,20 +10,21 @@ async function getWidget({ dashboard, widget }) {
|
|
|
10
10
|
? await getTemplate('dashboard', dashboard)
|
|
11
11
|
: null;
|
|
12
12
|
|
|
13
|
+
const dashboardData1 = await pg1.query(`select db, table_name, widgets as "dashboardWidgets" from bi.dashboard where dashboard_id=$1`, [dashboard])
|
|
14
|
+
.then(el => el.rows?.[0] || {});
|
|
15
|
+
const { dashboardWidgets = [] } = dashboardData1;
|
|
16
|
+
const dashboardDb = typeof dashboardData1?.db === 'string' && dashboardData1?.db?.startsWith('{') ? JSON.parse(dashboardData1?.db) : dashboardData1?.db;
|
|
17
|
+
|
|
13
18
|
const dashboardIndex = dashboardData?.find((el) => el[0] == 'index.yml')?.[1]; // dashboardData?.find((el) => el[2] == 'index')?.[1]
|
|
14
|
-
const pg = dashboardIndex?.db ? await getPGAsync(dashboardIndex?.db) :
|
|
19
|
+
const pg = dashboardDb || dashboardIndex?.db ? await getPGAsync(dashboardDb || dashboardIndex?.db) : pg1;
|
|
15
20
|
|
|
16
21
|
const { id, tableName } =
|
|
17
|
-
!dashboardData && pg.pk['bi.dashboard'] && dashboard
|
|
18
|
-
? await
|
|
19
|
-
.query(
|
|
20
|
-
`select dashboard_id as id, table_name as "tableName" from bi.dashboard where $1 in (dashboard_id, name)`,
|
|
21
|
-
[dashboard]
|
|
22
|
-
)
|
|
22
|
+
!dashboardData && !dashboardData1 && pg.pk['bi.dashboard'] && dashboard
|
|
23
|
+
? await pg1.query(`select dashboard_id as id, table_name as "tableName" from bi.dashboard where $1 in (dashboard_id, name)`, [dashboard])
|
|
23
24
|
.then(el => el.rows?.[0] || {})
|
|
24
25
|
: {};
|
|
25
26
|
|
|
26
|
-
if (!dashboardData && dashboard && !id) {
|
|
27
|
+
if (!dashboardData && !dashboardData1 && dashboard && !id) {
|
|
27
28
|
return { message: `dashboard not found: ${dashboard}`, status: 404 };
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -33,12 +34,15 @@ async function getWidget({ dashboard, widget }) {
|
|
|
33
34
|
|
|
34
35
|
const widgetData = dashboard
|
|
35
36
|
? dashboardData?.find((el) => el[2] === (widget || 'index'))?.[1]
|
|
37
|
+
|| dashboardWidgets?.find(el => el.name === widget)
|
|
36
38
|
: await getTemplate('widget', widget);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
|
|
40
|
+
if (typeof widgetData === 'string' || (widgetData?.type === 'text' && typeof widgetData?.data?.text === 'string')) {
|
|
41
|
+
const html = mdToHTML(widgetData?.data?.text || widgetData);
|
|
39
42
|
return { source: html, status: 200 };
|
|
40
43
|
}
|
|
41
|
-
|
|
44
|
+
|
|
45
|
+
if (!id && !dashboardData && !dashboardData1 && !widgetData) {
|
|
42
46
|
return { message: `not found ${widget} ${dashboard}`, status: 404 };
|
|
43
47
|
}
|
|
44
48
|
|
|
@@ -67,15 +71,24 @@ async function getWidget({ dashboard, widget }) {
|
|
|
67
71
|
tableName ||
|
|
68
72
|
widgetData?.table_name ||
|
|
69
73
|
dashboardIndex?.table ||
|
|
70
|
-
dashboardIndex?.table_name
|
|
71
|
-
|
|
74
|
+
dashboardIndex?.table_name ||
|
|
75
|
+
dashboardData1?.table_name,
|
|
76
|
+
db: dashboardDb?.db || dashboardDb || dashboardIndex?.db || widgetData?.db || pg?.options?.database,
|
|
72
77
|
});
|
|
73
78
|
const main = { ...(dashboardIndex || {}), ...widgetData, ...data, ...data?.data || {} };
|
|
74
|
-
const
|
|
79
|
+
const widgetDb = widgetData?.db ? await getPGAsync(widgetData?.db) : pg;
|
|
75
80
|
|
|
76
81
|
if (!main?.table) {
|
|
77
82
|
return {
|
|
78
|
-
message: /* json.error || */ `invalid ${widget ? 'widget' : 'dashboard'}:
|
|
83
|
+
message: /* json.error || */ `invalid ${widget ? 'widget' : 'dashboard'}: empty table`,
|
|
84
|
+
status: 404,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const { pk, view } = await getMeta({ pg: widgetDb, table: main?.table });
|
|
89
|
+
if (!pk && !view) {
|
|
90
|
+
return {
|
|
91
|
+
message: /* json.error || */ `invalid ${widget ? 'widget' : 'dashboard'}: table not found (${main?.table})`,
|
|
79
92
|
status: 404,
|
|
80
93
|
};
|
|
81
94
|
}
|
|
@@ -84,6 +97,6 @@ async function getWidget({ dashboard, widget }) {
|
|
|
84
97
|
(el, i) => `left join lateral(${el})t${i + 1} on 1=1`
|
|
85
98
|
);
|
|
86
99
|
|
|
87
|
-
return { ...main, pg:
|
|
100
|
+
return { ...main, pg: widgetDb, tableSQL, data, type, text, controls, style, options, yml };
|
|
88
101
|
}
|
|
89
102
|
export default getWidget;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { _ as l, c, i as h, t as p, h as d } from "./import-file-ChpPHgUN.js";
|
|
2
|
-
import { openBlock as u, createElementBlock as m } from "vue";
|
|
3
|
-
const D = {
|
|
4
|
-
name: "VsCalendar",
|
|
5
|
-
mixins: [c],
|
|
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: a, ys: e } = this.prepareData();
|
|
26
|
-
t && (this == null || this.initChart(t, a, e));
|
|
27
|
-
}
|
|
28
|
-
} catch (t) {
|
|
29
|
-
console.error(t);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
prepareData() {
|
|
33
|
-
try {
|
|
34
|
-
return this.sourceData.map((a) => {
|
|
35
|
-
var e, r, n;
|
|
36
|
-
return [
|
|
37
|
-
(n = (r = a == null ? void 0 : a[(e = this.dimensions) == null ? void 0 : e[0]]) == null ? void 0 : r.split("T")) == null ? void 0 : n[0],
|
|
38
|
-
Number(a[this.dimensions[1]])
|
|
39
|
-
];
|
|
40
|
-
});
|
|
41
|
-
} catch (t) {
|
|
42
|
-
console.error(t);
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
getCalendarRange() {
|
|
46
|
-
const t = this.sourceData.map(
|
|
47
|
-
(r) => {
|
|
48
|
-
var n, s;
|
|
49
|
-
return new Date((s = r == null ? void 0 : r[(n = this.dimensions) == null ? void 0 : n[0]]) == null ? void 0 : s.split("T")[0]);
|
|
50
|
-
}
|
|
51
|
-
), a = new Date(Math.min(...t)), e = new Date(Math.max(...t));
|
|
52
|
-
return [
|
|
53
|
-
a.getFullYear().toString(),
|
|
54
|
-
e.getFullYear().toString()
|
|
55
|
-
];
|
|
56
|
-
},
|
|
57
|
-
async initChart() {
|
|
58
|
-
var t, a, e, r;
|
|
59
|
-
try {
|
|
60
|
-
const n = this.$refs.chart, s = h(n), o = {
|
|
61
|
-
tooltip: {
|
|
62
|
-
...p(
|
|
63
|
-
(t = this.styleData) == null ? void 0 : t.tooltip,
|
|
64
|
-
(a = this.styleData) == null ? void 0 : a.show_tooltip
|
|
65
|
-
),
|
|
66
|
-
trigger: "item",
|
|
67
|
-
formatter: (i) => d(i)
|
|
68
|
-
},
|
|
69
|
-
visualMap: {
|
|
70
|
-
min: Math.min(...(e = this.prepareData()) == null ? void 0 : e.map((i) => i[1])),
|
|
71
|
-
max: Math.max(...(r = this.prepareData()) == null ? void 0 : r.map((i) => i[1])),
|
|
72
|
-
type: "piecewise",
|
|
73
|
-
orient: "horizontal",
|
|
74
|
-
left: "center",
|
|
75
|
-
top: 65
|
|
76
|
-
},
|
|
77
|
-
calendar: {
|
|
78
|
-
top: 120,
|
|
79
|
-
left: 30,
|
|
80
|
-
right: 30,
|
|
81
|
-
cellSize: ["auto", 20],
|
|
82
|
-
range: this.calendarRange,
|
|
83
|
-
itemStyle: {
|
|
84
|
-
borderWidth: 0.5
|
|
85
|
-
},
|
|
86
|
-
yearLabel: { show: !1 }
|
|
87
|
-
},
|
|
88
|
-
series: {
|
|
89
|
-
name: "calendar",
|
|
90
|
-
type: "heatmap",
|
|
91
|
-
coordinateSystem: "calendar",
|
|
92
|
-
data: this.prepareData(),
|
|
93
|
-
itemStyle: {
|
|
94
|
-
borderWidth: 0.5
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
s.setOption(o), s.resize(), window.addEventListener("resize", () => {
|
|
99
|
-
s.resize();
|
|
100
|
-
});
|
|
101
|
-
} catch (n) {
|
|
102
|
-
console.error(n);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}, f = {
|
|
107
|
-
ref: "chart",
|
|
108
|
-
class: "h-full w-full min-h-[200px] pb-2"
|
|
109
|
-
};
|
|
110
|
-
function g(t, a, e, r, n, s) {
|
|
111
|
-
return u(), m("div", f, null, 512);
|
|
112
|
-
}
|
|
113
|
-
const x = /* @__PURE__ */ l(D, [["render", g]]);
|
|
114
|
-
export {
|
|
115
|
-
x as default
|
|
116
|
-
};
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { _ as y, c as g, a as c, P as h, b as l, i as b } from "./import-file-ChpPHgUN.js";
|
|
2
|
-
import { openBlock as x, createElementBlock as I } from "vue";
|
|
3
|
-
const w = {
|
|
4
|
-
name: "VsPie",
|
|
5
|
-
props: ["currentWidget"],
|
|
6
|
-
mixins: [g],
|
|
7
|
-
data() {
|
|
8
|
-
return {
|
|
9
|
-
chartInstance: null,
|
|
10
|
-
uniqueID: null,
|
|
11
|
-
resizeObserver: null
|
|
12
|
-
};
|
|
13
|
-
},
|
|
14
|
-
async mounted() {
|
|
15
|
-
var e, a;
|
|
16
|
-
this.uniqueID = this.widget, await this.$nextTick(), await this.getData();
|
|
17
|
-
const { series: t } = this.prepareData();
|
|
18
|
-
t && this.initChart(t);
|
|
19
|
-
const r = (e = this.$refs) == null ? void 0 : e.chart;
|
|
20
|
-
r && (this.resizeObserver = new ResizeObserver(() => {
|
|
21
|
-
var s;
|
|
22
|
-
this.chartInstance && ((s = this.chartInstance) == null || s.resize());
|
|
23
|
-
}), (a = this.resizeObserver) == null || a.observe(r));
|
|
24
|
-
},
|
|
25
|
-
beforeUnmount() {
|
|
26
|
-
var t;
|
|
27
|
-
(t = this.resizeObserver) == null || t.disconnect();
|
|
28
|
-
},
|
|
29
|
-
methods: {
|
|
30
|
-
onChangedData() {
|
|
31
|
-
try {
|
|
32
|
-
if (this.sourceData) {
|
|
33
|
-
const { series: t, xs: r, ys: e } = this.prepareData();
|
|
34
|
-
t && (this == null || this.initChart(t, r, e));
|
|
35
|
-
}
|
|
36
|
-
} catch (t) {
|
|
37
|
-
console.error(t);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
buildTooltipForDonut(t, r) {
|
|
41
|
-
const { name: e, value: a, percent: s } = t;
|
|
42
|
-
return `
|
|
43
|
-
<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]">
|
|
44
|
-
${e == null ? void 0 : e.replace("null", "Не визначено")}: ${c(a)} (${s}%)
|
|
45
|
-
</div>`;
|
|
46
|
-
},
|
|
47
|
-
prepareData() {
|
|
48
|
-
var t, r, e, a;
|
|
49
|
-
try {
|
|
50
|
-
const s = Array.from(
|
|
51
|
-
new Set(this.sourceData.map((i) => i[this.dimensions[0]]))
|
|
52
|
-
), n = Array.from(
|
|
53
|
-
new Set(this.sourceData.map((i) => i[this.dimensions[1]]))
|
|
54
|
-
), d = parseInt(
|
|
55
|
-
(t = this.sourceData) == null ? void 0 : t.reduce((i, o) => i += parseFloat(o == null ? void 0 : o.metric), 0)
|
|
56
|
-
), u = s.map((i, o) => {
|
|
57
|
-
const D = (n[o] / d * 100).toFixed(2);
|
|
58
|
-
return {
|
|
59
|
-
name: `${i} (${D}%)`,
|
|
60
|
-
value: n[o]
|
|
61
|
-
};
|
|
62
|
-
}), p = ((r = this.styleData) == null ? void 0 : r.innerRadius) || "80%", m = ((e = this.styleData) == null ? void 0 : e.outerRadius) || "100%", f = [p, m];
|
|
63
|
-
return this.styleData.legend = h.getLegendOpions({
|
|
64
|
-
borderRadius: 10,
|
|
65
|
-
height: "100%",
|
|
66
|
-
padding: 10,
|
|
67
|
-
bottom: "0",
|
|
68
|
-
type: "scroll",
|
|
69
|
-
itemWidth: 14,
|
|
70
|
-
itemHeight: 14,
|
|
71
|
-
formatter: (i) => i == null ? void 0 : i.replace("null", "Не визначено"),
|
|
72
|
-
...this.styleData.legend
|
|
73
|
-
}), this.styleData.label = h.getLabelOptions(
|
|
74
|
-
this.styleData.label
|
|
75
|
-
), this.styleData.show_legend = ((a = this.styleData) == null ? void 0 : a.show_legend) || !0, { series: [
|
|
76
|
-
{
|
|
77
|
-
name: this.titleCharts ? this.titleCharts : this.dimensions[0],
|
|
78
|
-
type: "pie",
|
|
79
|
-
radius: f,
|
|
80
|
-
center: ["50%", "60%"],
|
|
81
|
-
height: "75%",
|
|
82
|
-
...l(this.styleData),
|
|
83
|
-
data: u
|
|
84
|
-
}
|
|
85
|
-
] };
|
|
86
|
-
} catch (s) {
|
|
87
|
-
return console.error(s), null;
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
async initChart(t) {
|
|
91
|
-
var r;
|
|
92
|
-
try {
|
|
93
|
-
const e = document.getElementById(this.uniqueID);
|
|
94
|
-
this.chartInstance = b(e);
|
|
95
|
-
const a = {
|
|
96
|
-
tooltip: {
|
|
97
|
-
trigger: "item",
|
|
98
|
-
formatter: (s) => this.buildTooltipForDonut(s, [s.color]),
|
|
99
|
-
borderWidth: 0,
|
|
100
|
-
appendToBody: !0,
|
|
101
|
-
borderColor: "transparent",
|
|
102
|
-
textStyle: {
|
|
103
|
-
color: "#000"
|
|
104
|
-
},
|
|
105
|
-
padding: [15, 15],
|
|
106
|
-
shadowColor: "transparent",
|
|
107
|
-
backgroundColor: "transparent"
|
|
108
|
-
},
|
|
109
|
-
series: t,
|
|
110
|
-
...l({
|
|
111
|
-
...this.styleData
|
|
112
|
-
}),
|
|
113
|
-
title: {
|
|
114
|
-
text: c(
|
|
115
|
-
parseInt(
|
|
116
|
-
(r = this.sourceData) == null ? void 0 : r.reduce(
|
|
117
|
-
(s, n) => s += parseFloat(n == null ? void 0 : n.metric),
|
|
118
|
-
0
|
|
119
|
-
)
|
|
120
|
-
)
|
|
121
|
-
),
|
|
122
|
-
left: "center",
|
|
123
|
-
top: "41%",
|
|
124
|
-
textStyle: {
|
|
125
|
-
color: "black",
|
|
126
|
-
fontWeight: 400,
|
|
127
|
-
fontSize: "22px"
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
this.chartInstance.setOption(a), this.$emit("update:currentWidget", this.chartInstance), this.chartInstance.resize(), window.addEventListener("resize", () => {
|
|
132
|
-
this.chartInstance.resize();
|
|
133
|
-
});
|
|
134
|
-
} catch (e) {
|
|
135
|
-
console.error(e);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}, _ = ["id"];
|
|
140
|
-
function $(t, r, e, a, s, n) {
|
|
141
|
-
return x(), I("div", {
|
|
142
|
-
id: s.uniqueID,
|
|
143
|
-
ref: "chart",
|
|
144
|
-
class: "h-full min-h-[200px] flex items-center"
|
|
145
|
-
}, null, 8, _);
|
|
146
|
-
}
|
|
147
|
-
const O = /* @__PURE__ */ y(w, [["render", $]]);
|
|
148
|
-
export {
|
|
149
|
-
O as default
|
|
150
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { _ as u, c as m, d, i as f, t as x, e as y, g as c, b as D } from "./import-file-ChpPHgUN.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
|
-
};
|