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