@blazes/data-visualization 1.0.0-alpha.0 → 1.0.0-alpha.2

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