@blazes/data-visualization 1.0.0-alpha.0 → 1.0.0-alpha.1
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/index.css +1 -1
- package/dist/vue/components/DashboardPanel.vue.d.ts.map +1 -1
- package/dist/vue/index.js +326 -315
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
package/dist/vue/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as O, openBlock as p, createElementBlock as w, normalizeClass as q, createElementVNode as
|
|
2
|
-
import { FormatType as Z, ChartBar as
|
|
1
|
+
import { defineComponent as O, openBlock as p, createElementBlock as w, normalizeClass as q, createElementVNode as I, Fragment as H, renderList as K, normalizeStyle as ue, toDisplayString as L, createVNode as R, unref as u, mergeProps as xe, withCtx as k, createTextVNode as U, createBlock as z, createCommentVNode as $, ref as j, computed as P, onErrorCaptured as Ce, watch as Se, resolveDynamicComponent as pe, pushScopeId as ke, popScopeId as Re, shallowRef as Ie, onMounted as fe, onBeforeUnmount as ve, onBeforeMount as $e, markRaw as Pe, toRaw as De, h as V } from "vue";
|
|
2
|
+
import { FormatType as Z, ChartBar as Ae, Size as J, ChartLine as ze, ChartPie as Le } from "@blazes/charts";
|
|
3
3
|
import { a as ee, b as G, c as Q, S as te } from "../visual-theme-DH-k3L51.js";
|
|
4
4
|
import { v as E } from "../value-formatter-D5QmLSMG.js";
|
|
5
|
-
import { RedoOutlined as X, ExclamationCircleOutlined as
|
|
6
|
-
import { RangePicker as
|
|
7
|
-
import { b as
|
|
8
|
-
const
|
|
5
|
+
import { RedoOutlined as X, ExclamationCircleOutlined as Te, BarChartOutlined as Fe, WarningOutlined as Ee, CloudDownloadOutlined as Ve, QuestionCircleOutlined as Oe, RiseOutlined as me, FallOutlined as _e, MinusOutlined as ge } from "@ant-design/icons-vue";
|
|
6
|
+
import { RangePicker as Be, RadioGroup as Ue, RadioButton as Ne, Select as le, Tooltip as N, Button as Y, Card as je, Spin as de, Dropdown as Ye, Menu as He, MenuItem as ce, Progress as qe, Tag as Ke, Table as Ge } from "ant-design-vue";
|
|
7
|
+
import { b as We, s as Ze, a as Qe, P as Xe } from "../csv-Dyrr2yMA.js";
|
|
8
|
+
const Je = { class: "dv-filter-bar__controls" }, et = { class: "dv-filter-bar__label" }, tt = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "dv-filter-bar__date-range"
|
|
11
|
-
},
|
|
11
|
+
}, nt = /* @__PURE__ */ O({
|
|
12
12
|
__name: "DashboardFilterBar",
|
|
13
13
|
props: {
|
|
14
14
|
config: {},
|
|
@@ -16,90 +16,90 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
16
16
|
loading: { type: Boolean }
|
|
17
17
|
},
|
|
18
18
|
emits: ["change", "refresh"],
|
|
19
|
-
setup(r, { emit:
|
|
20
|
-
const
|
|
21
|
-
function
|
|
19
|
+
setup(r, { emit: _ }) {
|
|
20
|
+
const o = r, e = _;
|
|
21
|
+
function h(i) {
|
|
22
22
|
return {
|
|
23
|
-
"--dv-filter-xs": String(
|
|
24
|
-
"--dv-filter-sm": String(
|
|
25
|
-
"--dv-filter-md": String(
|
|
26
|
-
"--dv-filter-lg": String(
|
|
27
|
-
"--dv-filter-xl": String(
|
|
23
|
+
"--dv-filter-xs": String(i.xs),
|
|
24
|
+
"--dv-filter-sm": String(i.sm ?? i.xs),
|
|
25
|
+
"--dv-filter-md": String(i.md ?? i.sm ?? i.xs),
|
|
26
|
+
"--dv-filter-lg": String(i.lg ?? i.md ?? i.sm ?? i.xs),
|
|
27
|
+
"--dv-filter-xl": String(i.xl ?? i.lg ?? i.md ?? i.sm ?? i.xs)
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function x(
|
|
31
|
-
return
|
|
30
|
+
function x(i) {
|
|
31
|
+
return i;
|
|
32
32
|
}
|
|
33
|
-
function C(
|
|
34
|
-
return
|
|
33
|
+
function C(i) {
|
|
34
|
+
return i.map((a) => ({ ...a }));
|
|
35
35
|
}
|
|
36
|
-
function s(
|
|
37
|
-
if (typeof
|
|
38
|
-
const a = /* @__PURE__ */ new Date(`${
|
|
36
|
+
function s(i) {
|
|
37
|
+
if (typeof i != "string" || !/^\d{4}-\d{2}-\d{2}$/.test(i)) return;
|
|
38
|
+
const a = /* @__PURE__ */ new Date(`${i}T12:00:00Z`);
|
|
39
39
|
return Number.isNaN(a.getTime()) ? void 0 : a;
|
|
40
40
|
}
|
|
41
|
-
function S(
|
|
42
|
-
return
|
|
41
|
+
function S(i) {
|
|
42
|
+
return i.toISOString().slice(0, 10);
|
|
43
43
|
}
|
|
44
44
|
function D() {
|
|
45
|
-
const
|
|
46
|
-
timeZone:
|
|
45
|
+
const i = new Intl.DateTimeFormat("en-CA", {
|
|
46
|
+
timeZone: o.context.timezone,
|
|
47
47
|
year: "numeric",
|
|
48
48
|
month: "2-digit",
|
|
49
49
|
day: "2-digit"
|
|
50
|
-
}).formatToParts(/* @__PURE__ */ new Date()), a = Object.fromEntries(
|
|
50
|
+
}).formatToParts(/* @__PURE__ */ new Date()), a = Object.fromEntries(i.map((g) => [g.type, g.value])), t = /* @__PURE__ */ new Date(`${a.year}-${a.month}-${a.day}T12:00:00Z`);
|
|
51
51
|
return t.setUTCDate(t.getUTCDate() - 1), t;
|
|
52
52
|
}
|
|
53
|
-
function c(
|
|
54
|
-
return
|
|
53
|
+
function c(i) {
|
|
54
|
+
return o.context.variables[i];
|
|
55
55
|
}
|
|
56
|
-
function l(
|
|
57
|
-
const a = c(
|
|
56
|
+
function l(i) {
|
|
57
|
+
const a = c(i.startVariableId), t = c(i.endVariableId);
|
|
58
58
|
return typeof a != "string" || typeof t != "string" || !s(a) || !s(t) ? {} : { value: [a, t] };
|
|
59
59
|
}
|
|
60
|
-
function f(
|
|
60
|
+
function f(i, a) {
|
|
61
61
|
if (!Array.isArray(a) || a.length !== 2) return;
|
|
62
|
-
const [t,
|
|
63
|
-
typeof t != "string" || typeof
|
|
64
|
-
[
|
|
65
|
-
[
|
|
62
|
+
const [t, g] = a;
|
|
63
|
+
typeof t != "string" || typeof g != "string" || e("change", {
|
|
64
|
+
[i.startVariableId]: t,
|
|
65
|
+
[i.endVariableId]: g
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function d(
|
|
69
|
-
var
|
|
70
|
-
const a = s(c(
|
|
68
|
+
function d(i) {
|
|
69
|
+
var y, A;
|
|
70
|
+
const a = s(c(i.startVariableId)), t = s(c(i.endVariableId));
|
|
71
71
|
if (!a || !t || t.getTime() !== D().getTime()) return;
|
|
72
|
-
const
|
|
73
|
-
return (
|
|
72
|
+
const g = Math.round((t.getTime() - a.getTime()) / 864e5) + 1;
|
|
73
|
+
return (A = (y = i.presets) == null ? void 0 : y.find((F) => F.days === g)) == null ? void 0 : A.id;
|
|
74
74
|
}
|
|
75
|
-
function n(
|
|
75
|
+
function n(i, a) {
|
|
76
76
|
var F;
|
|
77
|
-
const t = typeof a.target.value == "string" ? a.target.value : void 0,
|
|
78
|
-
if (!
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
[
|
|
82
|
-
[
|
|
77
|
+
const t = typeof a.target.value == "string" ? a.target.value : void 0, g = (F = i.presets) == null ? void 0 : F.find((W) => W.id === t);
|
|
78
|
+
if (!g) return;
|
|
79
|
+
const y = D(), A = new Date(y);
|
|
80
|
+
A.setUTCDate(A.getUTCDate() - g.days + 1), e("change", {
|
|
81
|
+
[i.startVariableId]: S(A),
|
|
82
|
+
[i.endVariableId]: S(y)
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
function M(
|
|
86
|
-
e("change", { [
|
|
85
|
+
function M(i, a) {
|
|
86
|
+
e("change", { [i]: a ?? null });
|
|
87
87
|
}
|
|
88
|
-
return (
|
|
88
|
+
return (i, a) => i.config ? (p(), w("div", {
|
|
89
89
|
key: 0,
|
|
90
|
-
class: q(["dv-filter-bar", { "dv-filter-bar--flow":
|
|
90
|
+
class: q(["dv-filter-bar", { "dv-filter-bar--flow": i.config.layout === "flow" }])
|
|
91
91
|
}, [
|
|
92
|
-
|
|
93
|
-
(p(!0), w(H, null, K(
|
|
94
|
-
var
|
|
92
|
+
I("div", Je, [
|
|
93
|
+
(p(!0), w(H, null, K(i.config.controls, (t) => {
|
|
94
|
+
var g;
|
|
95
95
|
return p(), w("div", {
|
|
96
96
|
key: t.id,
|
|
97
97
|
class: q(["dv-filter-bar__control", `dv-filter-bar__control--${t.type}`]),
|
|
98
|
-
style: ue(
|
|
98
|
+
style: ue(h(t.layout))
|
|
99
99
|
}, [
|
|
100
|
-
|
|
101
|
-
t.type === "date-range" ? (p(), w("div",
|
|
102
|
-
R(u(
|
|
100
|
+
I("label", et, L(t.label), 1),
|
|
101
|
+
t.type === "date-range" ? (p(), w("div", tt, [
|
|
102
|
+
R(u(Be), xe({
|
|
103
103
|
class: "dv-filter-bar__range-picker",
|
|
104
104
|
"allow-clear": !1,
|
|
105
105
|
disabled: t.disabled ?? !1,
|
|
@@ -107,35 +107,35 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
107
107
|
format: t.format ?? "YYYY-MM-DD"
|
|
108
108
|
}, l(t), {
|
|
109
109
|
"value-format": "YYYY-MM-DD",
|
|
110
|
-
onChange: (
|
|
110
|
+
onChange: (y) => f(t, y)
|
|
111
111
|
}), {
|
|
112
112
|
separator: k(() => [
|
|
113
113
|
U("至")
|
|
114
114
|
]),
|
|
115
115
|
_: 2
|
|
116
116
|
}, 1040, ["disabled", "format", "onChange"]),
|
|
117
|
-
(
|
|
117
|
+
(g = t.presets) != null && g.length ? (p(), z(u(Ue), {
|
|
118
118
|
key: 0,
|
|
119
119
|
class: "dv-filter-bar__presets",
|
|
120
120
|
disabled: t.disabled ?? !1,
|
|
121
121
|
size: "small",
|
|
122
122
|
value: d(t),
|
|
123
|
-
onChange: (
|
|
123
|
+
onChange: (y) => n(t, y)
|
|
124
124
|
}, {
|
|
125
125
|
default: k(() => [
|
|
126
|
-
(p(!0), w(H, null, K(t.presets, (
|
|
127
|
-
key:
|
|
128
|
-
value:
|
|
126
|
+
(p(!0), w(H, null, K(t.presets, (y) => (p(), z(u(Ne), {
|
|
127
|
+
key: y.id,
|
|
128
|
+
value: y.id
|
|
129
129
|
}, {
|
|
130
130
|
default: k(() => [
|
|
131
|
-
U(L(
|
|
131
|
+
U(L(y.label), 1)
|
|
132
132
|
]),
|
|
133
133
|
_: 2
|
|
134
134
|
}, 1032, ["value"]))), 128))
|
|
135
135
|
]),
|
|
136
136
|
_: 2
|
|
137
|
-
}, 1032, ["disabled", "value", "onChange"])) :
|
|
138
|
-
])) : t.type === "multi-select" ? (p(),
|
|
137
|
+
}, 1032, ["disabled", "value", "onChange"])) : $("", !0)
|
|
138
|
+
])) : t.type === "multi-select" ? (p(), z(u(le), {
|
|
139
139
|
key: 1,
|
|
140
140
|
"allow-clear": t.allowClear ?? !1,
|
|
141
141
|
disabled: t.disabled ?? !1,
|
|
@@ -145,9 +145,9 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
145
145
|
options: C(t.options),
|
|
146
146
|
placeholder: t.placeholder ?? "",
|
|
147
147
|
"show-search": t.showSearch ?? !1,
|
|
148
|
-
value:
|
|
149
|
-
onChange: (
|
|
150
|
-
}, null, 8, ["allow-clear", "disabled", "max-tag-count", "options", "placeholder", "show-search", "value", "onChange"])) : (p(),
|
|
148
|
+
value: i.context.variables[t.variableId],
|
|
149
|
+
onChange: (y) => M(t.variableId, y)
|
|
150
|
+
}, null, 8, ["allow-clear", "disabled", "max-tag-count", "options", "placeholder", "show-search", "value", "onChange"])) : (p(), z(u(le), {
|
|
151
151
|
key: 2,
|
|
152
152
|
"allow-clear": t.allowClear ?? !1,
|
|
153
153
|
disabled: t.disabled ?? !1,
|
|
@@ -155,13 +155,13 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
155
155
|
options: C(t.options),
|
|
156
156
|
placeholder: t.placeholder ?? "",
|
|
157
157
|
"show-search": t.showSearch ?? !1,
|
|
158
|
-
value:
|
|
159
|
-
onChange: (
|
|
158
|
+
value: i.context.variables[t.variableId],
|
|
159
|
+
onChange: (y) => M(t.variableId, y)
|
|
160
160
|
}, null, 8, ["allow-clear", "disabled", "options", "placeholder", "show-search", "value", "onChange"]))
|
|
161
161
|
], 6);
|
|
162
162
|
}), 128))
|
|
163
163
|
]),
|
|
164
|
-
|
|
164
|
+
i.config.showRefresh !== !1 ? (p(), z(u(N), {
|
|
165
165
|
key: 0,
|
|
166
166
|
title: "刷新全部"
|
|
167
167
|
}, {
|
|
@@ -169,8 +169,8 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
169
169
|
R(u(Y), {
|
|
170
170
|
type: "primary",
|
|
171
171
|
class: "dv-filter-bar__refresh",
|
|
172
|
-
loading:
|
|
173
|
-
onClick: a[0] || (a[0] = (t) =>
|
|
172
|
+
loading: i.loading ?? !1,
|
|
173
|
+
onClick: a[0] || (a[0] = (t) => i.$emit("refresh"))
|
|
174
174
|
}, {
|
|
175
175
|
icon: k(() => [
|
|
176
176
|
R(u(X))
|
|
@@ -182,15 +182,15 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
182
182
|
}, 8, ["loading"])
|
|
183
183
|
]),
|
|
184
184
|
_: 1
|
|
185
|
-
})) :
|
|
186
|
-
], 2)) :
|
|
185
|
+
})) : $("", !0)
|
|
186
|
+
], 2)) : $("", !0);
|
|
187
187
|
}
|
|
188
|
-
}), B = (r,
|
|
189
|
-
const
|
|
190
|
-
for (const [e,
|
|
191
|
-
|
|
192
|
-
return
|
|
193
|
-
},
|
|
188
|
+
}), B = (r, _) => {
|
|
189
|
+
const o = r.__vccOpts || r;
|
|
190
|
+
for (const [e, h] of _)
|
|
191
|
+
o[e] = h;
|
|
192
|
+
return o;
|
|
193
|
+
}, at = /* @__PURE__ */ B(nt, [["__scopeId", "data-v-45855b0b"]]), he = (r) => (ke("data-v-b524c4f2"), r = r(), Re(), r), it = { class: "dv-panel__heading" }, ot = { class: "dv-panel__title-group" }, rt = { class: "dv-panel__title" }, st = {
|
|
194
194
|
key: 0,
|
|
195
195
|
class: "dv-panel__title-note"
|
|
196
196
|
}, lt = { class: "dv-panel__actions" }, dt = {
|
|
@@ -200,25 +200,35 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
200
200
|
key: 1,
|
|
201
201
|
class: "dv-panel__state dv-panel__state--failure",
|
|
202
202
|
role: "status"
|
|
203
|
-
}, ut = { class: "dv-panel__failure" }, pt = { class: "dv-panel__failure-copy" }, ft = { class: "dv-panel__failure-heading" }, vt = ["title"], mt = /* @__PURE__ */
|
|
203
|
+
}, ut = { class: "dv-panel__failure" }, pt = { class: "dv-panel__failure-copy" }, ft = { class: "dv-panel__failure-heading" }, vt = ["title"], mt = /* @__PURE__ */ he(() => /* @__PURE__ */ I("span", { class: "dv-panel__retry-label" }, "重新加载", -1)), _t = {
|
|
204
204
|
key: 2,
|
|
205
205
|
class: "dv-panel__state dv-panel__state--loading"
|
|
206
|
-
},
|
|
206
|
+
}, gt = {
|
|
207
207
|
key: 0,
|
|
208
208
|
class: "dv-panel__state dv-panel__state--metric-empty"
|
|
209
|
+
}, ht = {
|
|
210
|
+
key: 1,
|
|
211
|
+
class: "dv-panel__state dv-panel__state--empty",
|
|
212
|
+
role: "status",
|
|
213
|
+
"aria-live": "polite"
|
|
209
214
|
}, yt = {
|
|
215
|
+
class: "dv-panel__empty-icon",
|
|
216
|
+
"aria-hidden": "true"
|
|
217
|
+
}, bt = /* @__PURE__ */ he(() => /* @__PURE__ */ I("div", { class: "dv-panel__empty-copy" }, [
|
|
218
|
+
/* @__PURE__ */ I("div", { class: "dv-panel__empty-title" }, "暂无数据")
|
|
219
|
+
], -1)), wt = {
|
|
210
220
|
key: 4,
|
|
211
221
|
class: "dv-panel__renderer"
|
|
212
|
-
},
|
|
222
|
+
}, Mt = {
|
|
213
223
|
key: 0,
|
|
214
224
|
class: "dv-panel__refreshing"
|
|
215
|
-
},
|
|
225
|
+
}, xt = {
|
|
216
226
|
key: 5,
|
|
217
227
|
class: "dv-panel__state dv-panel__idle"
|
|
218
|
-
},
|
|
228
|
+
}, Ct = {
|
|
219
229
|
key: 6,
|
|
220
230
|
class: "dv-panel__updated"
|
|
221
|
-
},
|
|
231
|
+
}, St = /* @__PURE__ */ O({
|
|
222
232
|
__name: "DashboardPanel",
|
|
223
233
|
props: {
|
|
224
234
|
panel: {},
|
|
@@ -230,19 +240,19 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
230
240
|
refreshDisabled: { type: Boolean }
|
|
231
241
|
},
|
|
232
242
|
emits: ["refresh", "retry", "exportCsv", "exportPng", "action", "visualizationEvent"],
|
|
233
|
-
setup(r, { expose:
|
|
234
|
-
const e = r,
|
|
243
|
+
setup(r, { expose: _, emit: o }) {
|
|
244
|
+
const e = r, h = o, x = j(), C = j(), s = P(() => e.panel.rendererId === "metric"), S = P(() => {
|
|
235
245
|
var n;
|
|
236
246
|
if (C.value)
|
|
237
247
|
return { title: "图表暂时无法展示", detail: C.value.message };
|
|
238
248
|
if (e.state.status === "error" || e.state.status === "cancelled")
|
|
239
249
|
return { title: "数据暂时无法加载", detail: (n = e.state.error) == null ? void 0 : n.message };
|
|
240
|
-
}), D =
|
|
250
|
+
}), D = P(
|
|
241
251
|
() => e.definition.capabilities.csv && !!e.state.dataset || e.definition.capabilities.png && !!e.state.viewModel
|
|
242
|
-
), c =
|
|
252
|
+
), c = P(() => {
|
|
243
253
|
const n = e.panel.layout.minHeight ?? (s.value ? 119 : 401), M = s.value ? 40 : 50;
|
|
244
254
|
return { minHeight: `${Math.max(n - M - 2, s.value ? 77 : 190)}px` };
|
|
245
|
-
}), l =
|
|
255
|
+
}), l = P(
|
|
246
256
|
() => e.state.lastSuccessfulAt ? new Intl.DateTimeFormat(e.context.locale, { timeStyle: "medium", timeZone: e.context.timezone }).format(
|
|
247
257
|
new Date(e.state.lastSuccessfulAt)
|
|
248
258
|
) : ""
|
|
@@ -252,47 +262,47 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
252
262
|
return (M = (n = x.value) == null ? void 0 : n.exportPng) == null ? void 0 : M.call(n);
|
|
253
263
|
}
|
|
254
264
|
function d(n) {
|
|
255
|
-
n.key === "csv" &&
|
|
265
|
+
n.key === "csv" && h("exportCsv"), n.key === "png" && h("exportPng");
|
|
256
266
|
}
|
|
257
|
-
return
|
|
267
|
+
return Ce((n) => (C.value = n instanceof Error ? n : new Error(String(n)), !1)), Se(
|
|
258
268
|
() => [e.state.generation, e.state.viewModel],
|
|
259
269
|
() => {
|
|
260
270
|
C.value = void 0;
|
|
261
271
|
}
|
|
262
|
-
),
|
|
272
|
+
), _({ exportPng: f }), (n, M) => (p(), z(u(je), {
|
|
263
273
|
class: q(["dv-panel", { "dv-panel--metric": s.value }]),
|
|
264
274
|
"body-style": c.value
|
|
265
275
|
}, {
|
|
266
276
|
title: k(() => [
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
n.panel.description ? (p(),
|
|
277
|
+
I("div", it, [
|
|
278
|
+
I("span", ot, [
|
|
279
|
+
I("span", rt, L(n.panel.title), 1),
|
|
280
|
+
n.panel.description ? (p(), z(u(N), {
|
|
271
281
|
key: 0,
|
|
272
282
|
title: n.panel.description
|
|
273
283
|
}, {
|
|
274
284
|
default: k(() => [
|
|
275
|
-
R(u(
|
|
285
|
+
R(u(Oe))
|
|
276
286
|
]),
|
|
277
287
|
_: 1
|
|
278
|
-
}, 8, ["title"])) :
|
|
288
|
+
}, 8, ["title"])) : $("", !0)
|
|
279
289
|
]),
|
|
280
|
-
n.panel.titleNote ? (p(), w("span", st, L(n.panel.titleNote), 1)) :
|
|
290
|
+
n.panel.titleNote ? (p(), w("span", st, L(n.panel.titleNote), 1)) : $("", !0)
|
|
281
291
|
])
|
|
282
292
|
]),
|
|
283
293
|
extra: k(() => {
|
|
284
|
-
var
|
|
294
|
+
var i;
|
|
285
295
|
return [
|
|
286
|
-
|
|
287
|
-
n.state.status === "stale" ? (p(),
|
|
296
|
+
I("div", lt, [
|
|
297
|
+
n.state.status === "stale" ? (p(), z(u(N), {
|
|
288
298
|
key: 0,
|
|
289
|
-
title: `刷新失败,当前展示上次成功数据${(
|
|
299
|
+
title: `刷新失败,当前展示上次成功数据${(i = n.state.error) != null && i.message ? `:${n.state.error.message}` : ""}`
|
|
290
300
|
}, {
|
|
291
301
|
default: k(() => [
|
|
292
|
-
R(u(
|
|
302
|
+
R(u(Ee), { class: "dv-panel__warning" })
|
|
293
303
|
]),
|
|
294
304
|
_: 1
|
|
295
|
-
}, 8, ["title"])) :
|
|
305
|
+
}, 8, ["title"])) : $("", !0),
|
|
296
306
|
R(u(N), {
|
|
297
307
|
title: n.refreshDisabled ? "正在刷新全部" : "刷新"
|
|
298
308
|
}, {
|
|
@@ -311,26 +321,26 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
311
321
|
]),
|
|
312
322
|
_: 1
|
|
313
323
|
}, 8, ["title"]),
|
|
314
|
-
D.value ? (p(),
|
|
324
|
+
D.value ? (p(), z(u(Ye), {
|
|
315
325
|
key: 1,
|
|
316
326
|
placement: "bottomRight",
|
|
317
327
|
trigger: ["click"]
|
|
318
328
|
}, {
|
|
319
329
|
overlay: k(() => [
|
|
320
|
-
R(u(
|
|
330
|
+
R(u(He), { onClick: d }, {
|
|
321
331
|
default: k(() => [
|
|
322
|
-
n.definition.capabilities.csv && n.state.dataset ? (p(),
|
|
332
|
+
n.definition.capabilities.csv && n.state.dataset ? (p(), z(u(ce), { key: "csv" }, {
|
|
323
333
|
default: k(() => [
|
|
324
334
|
U("导出 CSV")
|
|
325
335
|
]),
|
|
326
336
|
_: 1
|
|
327
|
-
})) :
|
|
328
|
-
n.definition.capabilities.png && n.state.viewModel ? (p(),
|
|
337
|
+
})) : $("", !0),
|
|
338
|
+
n.definition.capabilities.png && n.state.viewModel ? (p(), z(u(ce), { key: "png" }, {
|
|
329
339
|
default: k(() => [
|
|
330
340
|
U("导出 PNG")
|
|
331
341
|
]),
|
|
332
342
|
_: 1
|
|
333
|
-
})) :
|
|
343
|
+
})) : $("", !0)
|
|
334
344
|
]),
|
|
335
345
|
_: 1
|
|
336
346
|
})
|
|
@@ -343,7 +353,7 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
343
353
|
size: "small"
|
|
344
354
|
}, {
|
|
345
355
|
icon: k(() => [
|
|
346
|
-
R(u(
|
|
356
|
+
R(u(Ve))
|
|
347
357
|
]),
|
|
348
358
|
_: 1
|
|
349
359
|
})
|
|
@@ -352,8 +362,8 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
352
362
|
})
|
|
353
363
|
]),
|
|
354
364
|
_: 1
|
|
355
|
-
})) :
|
|
356
|
-
(p(!0), w(H, null, K(n.panel.actions ?? [], (a) => (p(),
|
|
365
|
+
})) : $("", !0),
|
|
366
|
+
(p(!0), w(H, null, K(n.panel.actions ?? [], (a) => (p(), z(u(Y), {
|
|
357
367
|
key: a.id,
|
|
358
368
|
type: "link",
|
|
359
369
|
size: "small",
|
|
@@ -368,17 +378,17 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
368
378
|
];
|
|
369
379
|
}),
|
|
370
380
|
default: k(() => [
|
|
371
|
-
n.filterSummary ? (p(), w("div", dt, L(n.filterSummary), 1)) :
|
|
381
|
+
n.filterSummary ? (p(), w("div", dt, L(n.filterSummary), 1)) : $("", !0),
|
|
372
382
|
S.value ? (p(), w("div", ct, [
|
|
373
|
-
|
|
374
|
-
R(u(
|
|
375
|
-
|
|
376
|
-
|
|
383
|
+
I("div", ut, [
|
|
384
|
+
R(u(Te), { class: "dv-panel__failure-icon" }),
|
|
385
|
+
I("div", pt, [
|
|
386
|
+
I("div", ft, L(S.value.title), 1),
|
|
377
387
|
S.value.detail ? (p(), w("div", {
|
|
378
388
|
key: 0,
|
|
379
389
|
class: "dv-panel__failure-detail",
|
|
380
390
|
title: S.value.detail
|
|
381
|
-
}, L(S.value.detail), 9, vt)) :
|
|
391
|
+
}, L(S.value.detail), 9, vt)) : $("", !0)
|
|
382
392
|
]),
|
|
383
393
|
R(u(N), { title: "重试" }, {
|
|
384
394
|
default: k(() => [
|
|
@@ -386,7 +396,7 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
386
396
|
class: "dv-panel__retry",
|
|
387
397
|
size: "small",
|
|
388
398
|
"aria-label": "重试",
|
|
389
|
-
onClick: M[1] || (M[1] = (
|
|
399
|
+
onClick: M[1] || (M[1] = (i) => n.$emit("retry"))
|
|
390
400
|
}, {
|
|
391
401
|
icon: k(() => [
|
|
392
402
|
R(u(X))
|
|
@@ -400,68 +410,69 @@ const Xe = { class: "dv-filter-bar__controls" }, Je = { class: "dv-filter-bar__l
|
|
|
400
410
|
_: 1
|
|
401
411
|
})
|
|
402
412
|
])
|
|
403
|
-
])) : n.state.status === "loading" && !n.state.viewModel ? (p(), w("div",
|
|
413
|
+
])) : n.state.status === "loading" && !n.state.viewModel ? (p(), w("div", _t, [
|
|
404
414
|
R(u(de))
|
|
405
415
|
])) : n.state.status === "empty" ? (p(), w(H, { key: 3 }, [
|
|
406
|
-
s.value ? (p(), w("div",
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
416
|
+
s.value ? (p(), w("div", gt, "暂无数据")) : (p(), w("div", ht, [
|
|
417
|
+
I("span", yt, [
|
|
418
|
+
R(u(Fe))
|
|
419
|
+
]),
|
|
420
|
+
bt
|
|
421
|
+
]))
|
|
422
|
+
], 64)) : n.state.viewModel ? (p(), w("div", wt, [
|
|
423
|
+
(p(), z(pe(n.renderer), {
|
|
413
424
|
ref_key: "rendererRef",
|
|
414
425
|
ref: x,
|
|
415
426
|
context: n.context,
|
|
416
427
|
panel: n.panel,
|
|
417
428
|
"view-model": n.state.viewModel,
|
|
418
|
-
onVisualizationEvent: M[2] || (M[2] = (
|
|
429
|
+
onVisualizationEvent: M[2] || (M[2] = (i) => n.$emit("visualizationEvent", i))
|
|
419
430
|
}, null, 40, ["context", "panel", "view-model"])),
|
|
420
|
-
n.state.isRefreshing ? (p(), w("div",
|
|
431
|
+
n.state.isRefreshing ? (p(), w("div", Mt, [
|
|
421
432
|
R(u(de))
|
|
422
|
-
])) :
|
|
423
|
-
])) : (p(), w("div",
|
|
424
|
-
n.state.lastSuccessfulAt ? (p(), w("div",
|
|
433
|
+
])) : $("", !0)
|
|
434
|
+
])) : (p(), w("div", xt, "等待加载")),
|
|
435
|
+
n.state.lastSuccessfulAt ? (p(), w("div", Ct, "更新于 " + L(l.value), 1)) : $("", !0)
|
|
425
436
|
]),
|
|
426
437
|
_: 1
|
|
427
438
|
}, 8, ["class", "body-style"]));
|
|
428
439
|
}
|
|
429
|
-
}),
|
|
430
|
-
function
|
|
431
|
-
const
|
|
440
|
+
}), kt = /* @__PURE__ */ B(St, [["__scopeId", "data-v-b524c4f2"]]);
|
|
441
|
+
function Rt(r, _ = {}) {
|
|
442
|
+
const o = Ie(r.snapshot);
|
|
432
443
|
let e;
|
|
433
444
|
return fe(() => {
|
|
434
|
-
e = r.subscribe((
|
|
435
|
-
|
|
436
|
-
}),
|
|
445
|
+
e = r.subscribe((h) => {
|
|
446
|
+
o.value = h;
|
|
447
|
+
}), _.autoLoad !== !1 && r.load();
|
|
437
448
|
}), ve(() => e == null ? void 0 : e()), {
|
|
438
|
-
snapshot:
|
|
439
|
-
context:
|
|
440
|
-
panelStates:
|
|
441
|
-
isLoading:
|
|
442
|
-
loadPanels: (
|
|
449
|
+
snapshot: o,
|
|
450
|
+
context: P(() => o.value.context),
|
|
451
|
+
panelStates: P(() => o.value.panelStates),
|
|
452
|
+
isLoading: P(() => o.value.isGlobalLoading),
|
|
453
|
+
loadPanels: (h) => r.loadPanels(h),
|
|
443
454
|
refreshAll: () => r.refreshAll(),
|
|
444
|
-
refreshPanels: (
|
|
445
|
-
refreshPanel: (
|
|
446
|
-
retryPanel: (
|
|
447
|
-
setVariables: (
|
|
455
|
+
refreshPanels: (h, x) => r.refreshPanels(h, x),
|
|
456
|
+
refreshPanel: (h) => r.refreshPanel(h),
|
|
457
|
+
retryPanel: (h) => r.retryPanel(h),
|
|
458
|
+
setVariables: (h, x) => r.setVariables(h, x)
|
|
448
459
|
};
|
|
449
460
|
}
|
|
450
|
-
function
|
|
451
|
-
const e = URL.createObjectURL(new Blob([r], { type:
|
|
452
|
-
ye(e,
|
|
461
|
+
function It(r, _, o) {
|
|
462
|
+
const e = URL.createObjectURL(new Blob([r], { type: _ }));
|
|
463
|
+
ye(e, o), window.setTimeout(() => URL.revokeObjectURL(e), 0);
|
|
453
464
|
}
|
|
454
|
-
function
|
|
455
|
-
ye(r,
|
|
465
|
+
function $t(r, _) {
|
|
466
|
+
ye(r, _);
|
|
456
467
|
}
|
|
457
|
-
function ye(r,
|
|
458
|
-
const
|
|
459
|
-
|
|
468
|
+
function ye(r, _) {
|
|
469
|
+
const o = document.createElement("a");
|
|
470
|
+
o.href = r, o.download = _, o.hidden = !0, document.body.append(o), o.click(), o.remove();
|
|
460
471
|
}
|
|
461
|
-
const
|
|
472
|
+
const Pt = {
|
|
462
473
|
key: 0,
|
|
463
474
|
class: "dv-dashboard__header"
|
|
464
|
-
},
|
|
475
|
+
}, Dt = { key: 0 }, At = { class: "dv-dashboard__grid" }, zt = ["data-panel-id"], Lt = /* @__PURE__ */ O({
|
|
465
476
|
__name: "DashboardRenderer",
|
|
466
477
|
props: {
|
|
467
478
|
runtime: {},
|
|
@@ -473,11 +484,11 @@ const Rt = {
|
|
|
473
484
|
syncUrl: { type: Boolean, default: !0 },
|
|
474
485
|
showHeader: { type: Boolean, default: !0 }
|
|
475
486
|
},
|
|
476
|
-
setup(r, { expose:
|
|
477
|
-
const
|
|
487
|
+
setup(r, { expose: _ }) {
|
|
488
|
+
const o = r, e = /* @__PURE__ */ new Map(), h = j(), x = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set();
|
|
478
489
|
let s, S = !1, D = !1;
|
|
479
|
-
|
|
480
|
-
|
|
490
|
+
$e(() => {
|
|
491
|
+
o.syncUrl && typeof window < "u" && o.runtime.restoreContext(window.location.search);
|
|
481
492
|
});
|
|
482
493
|
const {
|
|
483
494
|
context: c,
|
|
@@ -486,31 +497,31 @@ const Rt = {
|
|
|
486
497
|
loadPanels: d,
|
|
487
498
|
refreshAll: n,
|
|
488
499
|
refreshPanels: M,
|
|
489
|
-
refreshPanel:
|
|
500
|
+
refreshPanel: i,
|
|
490
501
|
retryPanel: a,
|
|
491
502
|
setVariables: t
|
|
492
|
-
} =
|
|
503
|
+
} = Rt(o.runtime, { autoLoad: o.autoLoad && !o.lazyLoad });
|
|
493
504
|
fe(() => {
|
|
494
505
|
var v;
|
|
495
|
-
if (!(!
|
|
506
|
+
if (!(!o.autoLoad || !o.lazyLoad)) {
|
|
496
507
|
if (typeof IntersectionObserver > "u") {
|
|
497
508
|
n();
|
|
498
509
|
return;
|
|
499
510
|
}
|
|
500
|
-
S = !0, s = new IntersectionObserver(
|
|
501
|
-
rootMargin:
|
|
502
|
-
}), (v =
|
|
511
|
+
S = !0, s = new IntersectionObserver(be, {
|
|
512
|
+
rootMargin: o.lazyLoadRootMargin
|
|
513
|
+
}), (v = h.value) == null || v.querySelectorAll(".dv-dashboard__cell").forEach((m) => s == null ? void 0 : s.observe(m));
|
|
503
514
|
}
|
|
504
515
|
}), ve(() => {
|
|
505
516
|
s == null || s.disconnect(), s = void 0, S = !1, x.clear(), C.clear();
|
|
506
517
|
});
|
|
507
|
-
const
|
|
508
|
-
() => (
|
|
518
|
+
const g = P(
|
|
519
|
+
() => (o.runtime.config.variables ?? []).map((v) => `${v.label}: ${y(c.value.variables[v.id])}`).join(" · ")
|
|
509
520
|
);
|
|
510
|
-
function
|
|
521
|
+
function y(v) {
|
|
511
522
|
return Array.isArray(v) ? v.join(", ") : String(v ?? "--");
|
|
512
523
|
}
|
|
513
|
-
function
|
|
524
|
+
function A(v) {
|
|
514
525
|
const m = v.layout.span;
|
|
515
526
|
return {
|
|
516
527
|
"--dv-panel-xs": String(m.xs),
|
|
@@ -522,13 +533,13 @@ const Rt = {
|
|
|
522
533
|
}
|
|
523
534
|
function F(v) {
|
|
524
535
|
var b;
|
|
525
|
-
const m = ((b =
|
|
526
|
-
return
|
|
536
|
+
const m = ((b = o.panelComponents) == null ? void 0 : b[v.id]) ?? o.rendererRegistry.require(v.rendererId).component;
|
|
537
|
+
return Pe(De(m));
|
|
527
538
|
}
|
|
528
539
|
function W(v, m) {
|
|
529
540
|
m ? e.set(v, m) : e.delete(v);
|
|
530
541
|
}
|
|
531
|
-
function
|
|
542
|
+
function be(v) {
|
|
532
543
|
v.forEach((m) => {
|
|
533
544
|
const b = m.target.dataset.panelId;
|
|
534
545
|
b && (m.isIntersecting ? (x.add(b), C.add(b)) : (x.delete(b), C.delete(b)));
|
|
@@ -538,13 +549,13 @@ const Rt = {
|
|
|
538
549
|
C.clear(), d(m);
|
|
539
550
|
}));
|
|
540
551
|
}
|
|
541
|
-
function
|
|
552
|
+
function ie() {
|
|
542
553
|
return S ? M(x, { deferUnselected: !0 }) : n();
|
|
543
554
|
}
|
|
544
|
-
async function
|
|
555
|
+
async function we(v) {
|
|
545
556
|
const m = t(v, S ? x : void 0);
|
|
546
|
-
if (
|
|
547
|
-
const b =
|
|
557
|
+
if (o.syncUrl && typeof window < "u") {
|
|
558
|
+
const b = We(o.runtime.config, o.runtime.context, window.location.search);
|
|
548
559
|
window.history.replaceState(
|
|
549
560
|
window.history.state,
|
|
550
561
|
"",
|
|
@@ -553,73 +564,73 @@ const Rt = {
|
|
|
553
564
|
}
|
|
554
565
|
await m;
|
|
555
566
|
}
|
|
556
|
-
function
|
|
567
|
+
function oe(v) {
|
|
557
568
|
var se;
|
|
558
|
-
const m =
|
|
569
|
+
const m = o.runtime.config.panels.find((Me) => Me.id === v), b = (se = l.value[v]) == null ? void 0 : se.dataset;
|
|
559
570
|
if (!b) return;
|
|
560
|
-
const T =
|
|
561
|
-
|
|
571
|
+
const T = Ze(b, m, c.value);
|
|
572
|
+
It(T, "text/csv;charset=utf-8", Qe(o.runtime.config.id, m.id));
|
|
562
573
|
}
|
|
563
574
|
function re(v) {
|
|
564
575
|
var b;
|
|
565
576
|
const m = (b = e.get(v)) == null ? void 0 : b.exportPng();
|
|
566
|
-
m &&
|
|
577
|
+
m && $t(m, `${o.runtime.config.id}-${v}.png`);
|
|
567
578
|
}
|
|
568
|
-
return
|
|
579
|
+
return _({ refreshAll: ie, refreshPanel: i, exportCsv: oe, exportPng: re }), (v, m) => (p(), w("section", {
|
|
569
580
|
ref_key: "dashboardElement",
|
|
570
|
-
ref:
|
|
581
|
+
ref: h,
|
|
571
582
|
class: "dv-dashboard"
|
|
572
583
|
}, [
|
|
573
|
-
v.showHeader ? (p(), w("header",
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
v.runtime.config.description ? (p(), w("p",
|
|
584
|
+
v.showHeader ? (p(), w("header", Pt, [
|
|
585
|
+
I("div", null, [
|
|
586
|
+
I("h1", null, L(v.runtime.config.title), 1),
|
|
587
|
+
v.runtime.config.description ? (p(), w("p", Dt, L(v.runtime.config.description), 1)) : $("", !0)
|
|
577
588
|
])
|
|
578
|
-
])) :
|
|
579
|
-
v.runtime.config.filterBar ? (p(),
|
|
589
|
+
])) : $("", !0),
|
|
590
|
+
v.runtime.config.filterBar ? (p(), z(at, {
|
|
580
591
|
key: 1,
|
|
581
592
|
config: v.runtime.config.filterBar,
|
|
582
593
|
context: u(c),
|
|
583
594
|
loading: u(f),
|
|
584
|
-
onChange:
|
|
585
|
-
onRefresh:
|
|
586
|
-
}, null, 8, ["config", "context", "loading"])) :
|
|
587
|
-
|
|
595
|
+
onChange: we,
|
|
596
|
+
onRefresh: ie
|
|
597
|
+
}, null, 8, ["config", "context", "loading"])) : $("", !0),
|
|
598
|
+
I("div", At, [
|
|
588
599
|
(p(!0), w(H, null, K(v.runtime.config.panels, (b) => (p(), w("div", {
|
|
589
600
|
key: b.id,
|
|
590
601
|
class: "dv-dashboard__cell",
|
|
591
602
|
"data-panel-id": b.id,
|
|
592
|
-
style: ue(
|
|
603
|
+
style: ue(A(b))
|
|
593
604
|
}, [
|
|
594
|
-
R(
|
|
605
|
+
R(kt, {
|
|
595
606
|
ref_for: !0,
|
|
596
607
|
ref: (T) => W(b.id, T),
|
|
597
608
|
context: u(c),
|
|
598
609
|
definition: v.runtime.dataRuntime.registries.rendererDefinitions.require(b.rendererId),
|
|
599
|
-
"filter-summary":
|
|
610
|
+
"filter-summary": g.value,
|
|
600
611
|
panel: b,
|
|
601
612
|
"refresh-disabled": u(f),
|
|
602
613
|
renderer: F(b),
|
|
603
614
|
state: u(l)[b.id],
|
|
604
615
|
onAction: (T) => v.runtime.executePanelAction(b.id, T),
|
|
605
|
-
onExportCsv: (T) =>
|
|
616
|
+
onExportCsv: (T) => oe(b.id),
|
|
606
617
|
onExportPng: (T) => re(b.id),
|
|
607
|
-
onRefresh: (T) => u(
|
|
618
|
+
onRefresh: (T) => u(i)(b.id),
|
|
608
619
|
onRetry: (T) => u(a)(b.id),
|
|
609
620
|
onVisualizationEvent: m[0] || (m[0] = (T) => v.runtime.dispatchEvent(T))
|
|
610
621
|
}, null, 8, ["context", "definition", "filter-summary", "panel", "refresh-disabled", "renderer", "state", "onAction", "onExportCsv", "onExportPng", "onRefresh", "onRetry"])
|
|
611
|
-
], 12,
|
|
622
|
+
], 12, zt))), 128))
|
|
612
623
|
])
|
|
613
624
|
], 512));
|
|
614
625
|
}
|
|
615
|
-
}),
|
|
626
|
+
}), dn = /* @__PURE__ */ B(Lt, [["__scopeId", "data-v-6d4b5bdb"]]);
|
|
616
627
|
function ne(r) {
|
|
617
628
|
return r.type === "percent" ? Z.PERCENT : r.type === "decimal" ? Z.DECIMAL : Z.COMMAS;
|
|
618
629
|
}
|
|
619
630
|
function ae(r) {
|
|
620
631
|
return typeof r == "object" && r !== null ? r : {};
|
|
621
632
|
}
|
|
622
|
-
const
|
|
633
|
+
const Tt = { class: "dv-chart-renderer dv-bar-renderer" }, Ft = /* @__PURE__ */ O({
|
|
623
634
|
__name: "BarRenderer",
|
|
624
635
|
props: {
|
|
625
636
|
viewModel: {},
|
|
@@ -627,13 +638,13 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
627
638
|
context: {}
|
|
628
639
|
},
|
|
629
640
|
emits: ["visualizationEvent"],
|
|
630
|
-
setup(r, { expose:
|
|
631
|
-
const e = r,
|
|
641
|
+
setup(r, { expose: _, emit: o }) {
|
|
642
|
+
const e = r, h = o, x = j();
|
|
632
643
|
function C(c, l, f = !1) {
|
|
633
644
|
const d = f ? E.formatAxis(c, l.format, e.context) : E.formatTooltip(c, l.format, e.context), n = l.format.type === "currency" || l.format.type === "percent" || l.format.unit;
|
|
634
645
|
return c != null && c !== "" && l.unit && !n ? `${d}${l.unit}` : d;
|
|
635
646
|
}
|
|
636
|
-
const s =
|
|
647
|
+
const s = P(() => ({
|
|
637
648
|
categories: [...e.viewModel.categories],
|
|
638
649
|
colors: [...te],
|
|
639
650
|
orientation: e.viewModel.orientation,
|
|
@@ -677,7 +688,7 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
677
688
|
}));
|
|
678
689
|
function S(c) {
|
|
679
690
|
const l = ae(c), f = typeof l.seriesIndex == "number" ? l.seriesIndex : 0, d = e.panel.binding.type === "bar" ? e.panel.binding : void 0;
|
|
680
|
-
d &&
|
|
691
|
+
d && h("visualizationEvent", {
|
|
681
692
|
type: "dataPointClick",
|
|
682
693
|
panelId: e.panel.id,
|
|
683
694
|
datasetId: d.datasetId,
|
|
@@ -692,8 +703,8 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
692
703
|
var c;
|
|
693
704
|
return (c = x.value) == null ? void 0 : c.exportPng();
|
|
694
705
|
}
|
|
695
|
-
return
|
|
696
|
-
R(u(
|
|
706
|
+
return _({ exportPng: D }), (c, l) => (p(), w("div", Tt, [
|
|
707
|
+
R(u(Ae), {
|
|
697
708
|
ref_key: "chartRef",
|
|
698
709
|
ref: x,
|
|
699
710
|
option: s.value,
|
|
@@ -702,7 +713,7 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
702
713
|
}, null, 8, ["option", "size"])
|
|
703
714
|
]));
|
|
704
715
|
}
|
|
705
|
-
}),
|
|
716
|
+
}), Et = /* @__PURE__ */ B(Ft, [["__scopeId", "data-v-4f111bdf"]]), Vt = { class: "dv-chart-renderer dv-line-renderer" }, Ot = /* @__PURE__ */ O({
|
|
706
717
|
__name: "LineRenderer",
|
|
707
718
|
props: {
|
|
708
719
|
viewModel: {},
|
|
@@ -710,8 +721,8 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
710
721
|
context: {}
|
|
711
722
|
},
|
|
712
723
|
emits: ["visualizationEvent"],
|
|
713
|
-
setup(r, { expose:
|
|
714
|
-
const e = r,
|
|
724
|
+
setup(r, { expose: _, emit: o }) {
|
|
725
|
+
const e = r, h = o, x = j();
|
|
715
726
|
function C(l, f) {
|
|
716
727
|
const d = E.formatAxis(l, f.format, e.context);
|
|
717
728
|
return s(d, f);
|
|
@@ -720,7 +731,7 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
720
731
|
const d = f.format.type === "currency" || f.format.type === "percent" || f.format.unit;
|
|
721
732
|
return f.unit && !d ? `${l}${f.unit}` : l;
|
|
722
733
|
}
|
|
723
|
-
const S =
|
|
734
|
+
const S = P(() => {
|
|
724
735
|
const l = Array.from(
|
|
725
736
|
new Map(e.viewModel.series.map((d) => [d.axisKey, d])).values()
|
|
726
737
|
), f = new Map(l.map((d, n) => [d.axisKey, n]));
|
|
@@ -756,8 +767,8 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
756
767
|
data: d.values.map((M) => M ?? void 0),
|
|
757
768
|
formatType: ne(d.format),
|
|
758
769
|
valueFormatter: (M) => {
|
|
759
|
-
const
|
|
760
|
-
return M == null || M === "" ?
|
|
770
|
+
const i = E.formatTooltip(M, d.format, e.context);
|
|
771
|
+
return M == null || M === "" ? i : s(i, d);
|
|
761
772
|
},
|
|
762
773
|
showLabel: e.viewModel.showLabels,
|
|
763
774
|
smooth: e.viewModel.smooth,
|
|
@@ -791,7 +802,7 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
791
802
|
});
|
|
792
803
|
function D(l) {
|
|
793
804
|
const f = ae(l), d = typeof f.seriesIndex == "number" ? f.seriesIndex : 0, n = e.panel.binding.type === "line" ? e.panel.binding : void 0;
|
|
794
|
-
n &&
|
|
805
|
+
n && h("visualizationEvent", {
|
|
795
806
|
type: "dataPointClick",
|
|
796
807
|
panelId: e.panel.id,
|
|
797
808
|
datasetId: n.datasetId,
|
|
@@ -806,8 +817,8 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
806
817
|
var l;
|
|
807
818
|
return (l = x.value) == null ? void 0 : l.exportPng();
|
|
808
819
|
}
|
|
809
|
-
return
|
|
810
|
-
R(u(
|
|
820
|
+
return _({ exportPng: c }), (l, f) => (p(), w("div", Vt, [
|
|
821
|
+
R(u(ze), {
|
|
811
822
|
ref_key: "chartRef",
|
|
812
823
|
ref: x,
|
|
813
824
|
option: S.value,
|
|
@@ -816,13 +827,13 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
816
827
|
}, null, 8, ["option", "size"])
|
|
817
828
|
]));
|
|
818
829
|
}
|
|
819
|
-
}),
|
|
830
|
+
}), Bt = /* @__PURE__ */ B(Ot, [["__scopeId", "data-v-efc34766"]]), Ut = { class: "dv-metric" }, Nt = { class: "dv-metric__value" }, jt = { class: "dv-metric__number" }, Yt = {
|
|
820
831
|
key: 0,
|
|
821
832
|
class: "dv-metric__unit"
|
|
822
|
-
},
|
|
833
|
+
}, Ht = {
|
|
823
834
|
key: 0,
|
|
824
835
|
class: "dv-metric__comparison"
|
|
825
|
-
},
|
|
836
|
+
}, qt = /* @__PURE__ */ O({
|
|
826
837
|
__name: "MetricRenderer",
|
|
827
838
|
props: {
|
|
828
839
|
viewModel: {},
|
|
@@ -830,37 +841,37 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
830
841
|
context: {}
|
|
831
842
|
},
|
|
832
843
|
setup(r) {
|
|
833
|
-
const
|
|
834
|
-
() => E.formatDisplay(
|
|
835
|
-
), e =
|
|
836
|
-
() =>
|
|
837
|
-
),
|
|
838
|
-
const s =
|
|
839
|
-
return s ? E.formatDisplay(s.value, s.format,
|
|
840
|
-
}), x =
|
|
844
|
+
const _ = r, o = P(
|
|
845
|
+
() => E.formatDisplay(_.viewModel.value, _.viewModel.format, _.context)
|
|
846
|
+
), e = P(
|
|
847
|
+
() => _.viewModel.format.type === "currency" || _.viewModel.format.type === "percent" ? void 0 : _.viewModel.unit
|
|
848
|
+
), h = P(() => {
|
|
849
|
+
const s = _.viewModel.comparison;
|
|
850
|
+
return s ? E.formatDisplay(s.value, s.format, _.context) : "";
|
|
851
|
+
}), x = P(() => {
|
|
841
852
|
var s, S;
|
|
842
|
-
return ((s =
|
|
843
|
-
}), C =
|
|
844
|
-
const s =
|
|
853
|
+
return ((s = _.viewModel.comparison) == null ? void 0 : s.direction) === "up" ? me : ((S = _.viewModel.comparison) == null ? void 0 : S.direction) === "down" ? _e : ge;
|
|
854
|
+
}), C = P(() => {
|
|
855
|
+
const s = _.viewModel.comparison;
|
|
845
856
|
return !s || s.direction === "flat" ? "neutral" : s.colorMode === "direction" ? s.direction === "up" ? "unfavorable" : "favorable" : s.meaning === "neutral" ? "neutral" : s.meaning === "positive" && s.direction === "up" || s.meaning === "negative" && s.direction === "down" ? "favorable" : "unfavorable";
|
|
846
857
|
});
|
|
847
|
-
return (s, S) => (p(), w("div",
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
e.value ? (p(), w("span",
|
|
858
|
+
return (s, S) => (p(), w("div", Ut, [
|
|
859
|
+
I("div", Nt, [
|
|
860
|
+
I("span", jt, L(o.value), 1),
|
|
861
|
+
e.value ? (p(), w("span", Yt, L(e.value), 1)) : $("", !0)
|
|
851
862
|
]),
|
|
852
|
-
s.viewModel.comparison ? (p(), w("div",
|
|
853
|
-
|
|
854
|
-
|
|
863
|
+
s.viewModel.comparison ? (p(), w("div", Ht, [
|
|
864
|
+
I("span", null, L(s.viewModel.comparison.label), 1),
|
|
865
|
+
I("strong", {
|
|
855
866
|
class: q(`dv-metric__comparison--${C.value}`)
|
|
856
867
|
}, [
|
|
857
|
-
(p(),
|
|
858
|
-
U(" " + L(
|
|
868
|
+
(p(), z(pe(x.value))),
|
|
869
|
+
U(" " + L(h.value), 1)
|
|
859
870
|
], 2)
|
|
860
|
-
])) :
|
|
871
|
+
])) : $("", !0)
|
|
861
872
|
]));
|
|
862
873
|
}
|
|
863
|
-
}),
|
|
874
|
+
}), Kt = /* @__PURE__ */ B(qt, [["__scopeId", "data-v-efa26253"]]), Gt = { class: "dv-chart-renderer dv-pie-renderer" }, Wt = /* @__PURE__ */ O({
|
|
864
875
|
__name: "PieRenderer",
|
|
865
876
|
props: {
|
|
866
877
|
viewModel: {},
|
|
@@ -868,13 +879,13 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
868
879
|
context: {}
|
|
869
880
|
},
|
|
870
881
|
emits: ["visualizationEvent"],
|
|
871
|
-
setup(r, { expose:
|
|
872
|
-
const e = r,
|
|
882
|
+
setup(r, { expose: _, emit: o }) {
|
|
883
|
+
const e = r, h = o, x = j();
|
|
873
884
|
function C(c) {
|
|
874
885
|
const l = E.formatTooltip(c, e.viewModel.valueFormat, e.context), f = e.viewModel.valueFormat.type === "currency" || e.viewModel.valueFormat.type === "percent" || e.viewModel.valueFormat.unit;
|
|
875
886
|
return e.viewModel.unit && !f ? `${l}${e.viewModel.unit}` : l;
|
|
876
887
|
}
|
|
877
|
-
const s =
|
|
888
|
+
const s = P(() => ({
|
|
878
889
|
colors: [...te],
|
|
879
890
|
donut: e.viewModel.donut,
|
|
880
891
|
showLegend: e.viewModel.showLegend,
|
|
@@ -900,7 +911,7 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
900
911
|
}));
|
|
901
912
|
function S(c) {
|
|
902
913
|
const l = ae(c), f = e.panel.binding.type === "pie" ? e.panel.binding : void 0;
|
|
903
|
-
f &&
|
|
914
|
+
f && h("visualizationEvent", {
|
|
904
915
|
type: "dataPointClick",
|
|
905
916
|
panelId: e.panel.id,
|
|
906
917
|
datasetId: f.datasetId,
|
|
@@ -911,8 +922,8 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
911
922
|
var c;
|
|
912
923
|
return (c = x.value) == null ? void 0 : c.exportPng();
|
|
913
924
|
}
|
|
914
|
-
return
|
|
915
|
-
R(u(
|
|
925
|
+
return _({ exportPng: D }), (c, l) => (p(), w("div", Gt, [
|
|
926
|
+
R(u(Le), {
|
|
916
927
|
ref_key: "chartRef",
|
|
917
928
|
ref: x,
|
|
918
929
|
option: s.value,
|
|
@@ -921,7 +932,7 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
921
932
|
}, null, 8, ["option", "size"])
|
|
922
933
|
]));
|
|
923
934
|
}
|
|
924
|
-
}),
|
|
935
|
+
}), Zt = /* @__PURE__ */ B(Wt, [["__scopeId", "data-v-ccdee116"]]), Qt = { class: "dv-table-scroll" }, Xt = /* @__PURE__ */ O({
|
|
925
936
|
__name: "TableRenderer",
|
|
926
937
|
props: {
|
|
927
938
|
viewModel: {},
|
|
@@ -929,17 +940,17 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
929
940
|
context: {}
|
|
930
941
|
},
|
|
931
942
|
emits: ["visualizationEvent"],
|
|
932
|
-
setup(r, { emit:
|
|
933
|
-
const
|
|
934
|
-
() =>
|
|
943
|
+
setup(r, { emit: _ }) {
|
|
944
|
+
const o = r, e = _, h = P(
|
|
945
|
+
() => o.viewModel.columns.map((a) => ({
|
|
935
946
|
title: a.label,
|
|
936
947
|
dataIndex: a.field,
|
|
937
948
|
key: a.field,
|
|
938
949
|
...a.width ? { width: a.width } : {},
|
|
939
950
|
sorter: a.sortable,
|
|
940
951
|
...a.filterable ? {
|
|
941
|
-
filters: Array.from(new Set(
|
|
942
|
-
onFilter: (t,
|
|
952
|
+
filters: Array.from(new Set(o.viewModel.rows.map((t) => String(t[a.field] ?? "")))).slice(0, 50).map((t) => ({ text: t || "--", value: t })),
|
|
953
|
+
onFilter: (t, g) => String(g[a.field] ?? "") === String(t)
|
|
943
954
|
} : {},
|
|
944
955
|
customRender: ({ text: t }) => C(t, a)
|
|
945
956
|
}))
|
|
@@ -950,39 +961,39 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
950
961
|
t.format ?? {
|
|
951
962
|
type: t.dataType === "date" ? "date" : t.dataType === "datetime" ? "datetime" : "number"
|
|
952
963
|
},
|
|
953
|
-
|
|
964
|
+
o.context
|
|
954
965
|
);
|
|
955
966
|
}
|
|
956
967
|
function C(a, t) {
|
|
957
|
-
const
|
|
958
|
-
return t.display ? t.display.type === "progress" ? S(a,
|
|
968
|
+
const g = x(a, t);
|
|
969
|
+
return t.display ? t.display.type === "progress" ? S(a, g, t.display) : t.display.type === "trend" ? D(a, g, t.display) : c(a, g, t.display) : g;
|
|
959
970
|
}
|
|
960
971
|
function s(a) {
|
|
961
972
|
return typeof a == "number" && Number.isFinite(a) ? a : void 0;
|
|
962
973
|
}
|
|
963
|
-
function S(a, t,
|
|
964
|
-
const
|
|
965
|
-
if (
|
|
966
|
-
const
|
|
974
|
+
function S(a, t, g) {
|
|
975
|
+
const y = s(a);
|
|
976
|
+
if (y === void 0) return t;
|
|
977
|
+
const A = g.max ?? 1, F = Math.min(100, Math.max(0, y / A * 100));
|
|
967
978
|
return V("div", { class: "dv-table__progress-cell" }, [
|
|
968
|
-
V(
|
|
979
|
+
V(qe, { percent: F, showInfo: !1, size: "small", strokeWidth: 6 }),
|
|
969
980
|
V("span", { class: "dv-table__cell-value" }, t)
|
|
970
981
|
]);
|
|
971
982
|
}
|
|
972
|
-
function D(a, t,
|
|
973
|
-
const
|
|
974
|
-
if (
|
|
975
|
-
const
|
|
976
|
-
return V("span", { class: ["dv-table__trend", `dv-table__trend--${
|
|
983
|
+
function D(a, t, g) {
|
|
984
|
+
const y = s(a);
|
|
985
|
+
if (y === void 0) return t;
|
|
986
|
+
const A = y > 0 ? g.positiveTone ?? "success" : y < 0 ? g.negativeTone ?? "danger" : g.zeroTone ?? "neutral", F = y > 0 ? me : y < 0 ? _e : ge;
|
|
987
|
+
return V("span", { class: ["dv-table__trend", `dv-table__trend--${A}`] }, [V(F), V("span", t)]);
|
|
977
988
|
}
|
|
978
|
-
function c(a, t,
|
|
979
|
-
var
|
|
980
|
-
const
|
|
981
|
-
return l(t,
|
|
989
|
+
function c(a, t, g) {
|
|
990
|
+
var A;
|
|
991
|
+
const y = ((A = g.toneByValue) == null ? void 0 : A[String(a ?? "")]) ?? g.defaultTone ?? "neutral";
|
|
992
|
+
return l(t, y);
|
|
982
993
|
}
|
|
983
|
-
function l(a, t,
|
|
994
|
+
function l(a, t, g) {
|
|
984
995
|
return V(
|
|
985
|
-
|
|
996
|
+
Ke,
|
|
986
997
|
{ class: ["dv-table__tag", `dv-table__tag--${t}`] },
|
|
987
998
|
{ default: () => [V("span", a)] }
|
|
988
999
|
);
|
|
@@ -992,73 +1003,73 @@ const At = { class: "dv-chart-renderer dv-bar-renderer" }, zt = /* @__PURE__ */
|
|
|
992
1003
|
function n(a) {
|
|
993
1004
|
const t = f.get(a);
|
|
994
1005
|
if (t) return t;
|
|
995
|
-
const
|
|
996
|
-
return f.set(a,
|
|
1006
|
+
const g = `row-${++d}`;
|
|
1007
|
+
return f.set(a, g), g;
|
|
997
1008
|
}
|
|
998
1009
|
function M(a) {
|
|
999
1010
|
return {
|
|
1000
1011
|
onClick: () => e("visualizationEvent", {
|
|
1001
1012
|
type: "rowClick",
|
|
1002
|
-
panelId:
|
|
1003
|
-
datasetId:
|
|
1013
|
+
panelId: o.panel.id,
|
|
1014
|
+
datasetId: o.panel.binding.datasetId,
|
|
1004
1015
|
fields: a
|
|
1005
1016
|
})
|
|
1006
1017
|
};
|
|
1007
1018
|
}
|
|
1008
|
-
function
|
|
1019
|
+
function i() {
|
|
1009
1020
|
}
|
|
1010
|
-
return (a, t) => (p(), w("div",
|
|
1011
|
-
R(u(
|
|
1021
|
+
return (a, t) => (p(), w("div", Qt, [
|
|
1022
|
+
R(u(Ge), {
|
|
1012
1023
|
class: "dv-table",
|
|
1013
|
-
columns:
|
|
1024
|
+
columns: h.value,
|
|
1014
1025
|
"data-source": [...a.viewModel.rows],
|
|
1015
1026
|
pagination: a.viewModel.showPagination ? { pageSize: a.viewModel.pageSize, showSizeChanger: !1 } : !1,
|
|
1016
1027
|
"row-key": n,
|
|
1017
1028
|
scroll: { x: "max-content" },
|
|
1018
1029
|
size: "small",
|
|
1019
|
-
onChange:
|
|
1030
|
+
onChange: i,
|
|
1020
1031
|
"custom-row": M
|
|
1021
1032
|
}, null, 8, ["columns", "data-source", "pagination"])
|
|
1022
1033
|
]));
|
|
1023
1034
|
}
|
|
1024
|
-
}),
|
|
1025
|
-
function
|
|
1035
|
+
}), Jt = /* @__PURE__ */ B(Xt, [["__scopeId", "data-v-c8a717c4"]]);
|
|
1036
|
+
function cn(r) {
|
|
1026
1037
|
return r.registerMany([
|
|
1027
|
-
{ id: "metric", component:
|
|
1028
|
-
{ id: "line", component:
|
|
1029
|
-
{ id: "bar", component:
|
|
1030
|
-
{ id: "pie", component:
|
|
1031
|
-
{ id: "table", component:
|
|
1038
|
+
{ id: "metric", component: Kt },
|
|
1039
|
+
{ id: "line", component: Bt },
|
|
1040
|
+
{ id: "bar", component: Et },
|
|
1041
|
+
{ id: "pie", component: Zt },
|
|
1042
|
+
{ id: "table", component: Jt }
|
|
1032
1043
|
]), r;
|
|
1033
1044
|
}
|
|
1034
|
-
class
|
|
1045
|
+
class en extends Xe {
|
|
1035
1046
|
constructor() {
|
|
1036
1047
|
super("VueVisualizationRenderer");
|
|
1037
1048
|
}
|
|
1038
1049
|
}
|
|
1039
|
-
function
|
|
1040
|
-
return new
|
|
1050
|
+
function un() {
|
|
1051
|
+
return new en();
|
|
1041
1052
|
}
|
|
1042
1053
|
export {
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1054
|
+
Et as BarRenderer,
|
|
1055
|
+
at as DashboardFilterBar,
|
|
1056
|
+
kt as DashboardPanel,
|
|
1057
|
+
dn as DashboardRenderer,
|
|
1058
|
+
Bt as LineRenderer,
|
|
1059
|
+
Kt as MetricRenderer,
|
|
1060
|
+
Zt as PieRenderer,
|
|
1050
1061
|
Q as STANDARD_CATEGORY_AXIS,
|
|
1051
1062
|
te as STANDARD_CHART_COLORS,
|
|
1052
1063
|
ee as STANDARD_CHART_TOOLTIP,
|
|
1053
1064
|
G as STANDARD_VALUE_AXIS,
|
|
1054
|
-
|
|
1055
|
-
|
|
1065
|
+
Jt as TableRenderer,
|
|
1066
|
+
en as VueRendererRegistry,
|
|
1056
1067
|
ae as chartEventFields,
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1068
|
+
un as createVueRendererRegistry,
|
|
1069
|
+
It as downloadBlob,
|
|
1070
|
+
$t as downloadDataUrl,
|
|
1071
|
+
cn as registerStandardVueRenderers,
|
|
1061
1072
|
ne as toChartFormat,
|
|
1062
|
-
|
|
1073
|
+
Rt as useDashboardRuntime
|
|
1063
1074
|
};
|
|
1064
1075
|
//# sourceMappingURL=index.js.map
|