@iyulab/u-widgets 0.9.1 → 0.10.0

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.
@@ -1,82 +1,87 @@
1
- import { css as P, LitElement as T, nothing as E, html as R } from "lit";
1
+ import { css as E, LitElement as P, nothing as T, html as R } from "lit";
2
2
  import { property as $, customElement as B } from "lit/decorators.js";
3
- import { a as W, f as q, t as G } from "./tokens-SjA7YdRs.js";
3
+ import { a as W, f as q } from "./format-DiXp3HTj.js";
4
+ import { t as G } from "./tokens-byMop3gk.js";
4
5
  import * as O from "echarts/core";
5
6
  import { BarChart as H, LineChart as U, PieChart as Y, ScatterChart as J, RadarChart as Q, HeatmapChart as X, BoxplotChart as Z, FunnelChart as K, TreemapChart as ee } from "echarts/charts";
6
- import { GridComponent as te, TooltipComponent as re, LegendComponent as ie, RadarComponent as se, MarkLineComponent as ne, VisualMapComponent as ae } from "echarts/components";
7
- import { CanvasRenderer as oe } from "echarts/renderers";
8
- function M(e, i) {
9
- for (const r of i) {
10
- const t = e[r.field];
7
+ import { GridComponent as te, TooltipComponent as re, LegendComponent as ie, RadarComponent as se, MarkLineComponent as ne, VisualMapComponent as oe } from "echarts/components";
8
+ import { CanvasRenderer as ae } from "echarts/renderers";
9
+ function M(e, r) {
10
+ for (const i of r) {
11
+ const t = e[i.field];
11
12
  if (t == null) continue;
12
13
  const n = Number(t);
13
14
  if (Number.isNaN(n)) continue;
14
- const s = r.above === void 0 || n > r.above, u = r.below === void 0 || n < r.below;
15
- if (s && u) return r;
15
+ const s = i.above === void 0 || n > i.above, f = i.below === void 0 || n < i.below;
16
+ if (s && f) return i;
16
17
  }
17
18
  }
18
19
  function le(e) {
19
- const i = e.widget, r = e.data, t = e.mapping ? W(e.mapping) : void 0, n = e.options ?? {};
20
- if (!r) return {};
20
+ const r = e.widget, i = e.data, t = e.mapping ? W(e.mapping) : void 0, n = e.options ?? {};
21
+ if (!i) return {};
21
22
  let s;
22
- switch (i) {
23
+ switch (r) {
23
24
  case "chart.bar":
24
- s = N(r, t, "bar", n);
25
+ s = N(i, t, "bar", n);
25
26
  break;
26
27
  case "chart.line":
27
- s = N(r, t, "line", n);
28
+ s = N(i, t, "line", n);
28
29
  break;
29
30
  case "chart.area":
30
- s = N(r, t, "line", { ...n, _area: !0 });
31
+ s = N(i, t, "line", { ...n, _area: !0 });
31
32
  break;
32
33
  case "chart.pie":
33
- s = ue(r, t, n);
34
+ s = ue(i, t, n);
34
35
  break;
35
36
  case "chart.scatter":
36
- s = ce(r, t, n);
37
+ s = ce(i, t, n);
37
38
  break;
38
39
  case "chart.radar":
39
- s = fe(r, t);
40
+ s = fe(i, t);
40
41
  break;
41
42
  case "chart.heatmap":
42
- s = ye(r, t, n);
43
+ s = ye(i, t, n);
43
44
  break;
44
45
  case "chart.box":
45
- s = he(r, t);
46
+ s = he(i, t);
46
47
  break;
47
48
  case "chart.funnel":
48
- s = me(r, t);
49
+ s = me(i, t);
49
50
  break;
50
51
  case "chart.waterfall":
51
- s = de(r, t);
52
+ s = de(i, t);
52
53
  break;
53
54
  case "chart.treemap":
54
- s = be(r);
55
+ s = pe(i);
55
56
  break;
56
57
  case "chart.histogram":
57
- s = pe(r, t, n);
58
+ s = be(i, t, n);
58
59
  break;
59
60
  default:
60
61
  return {};
61
62
  }
62
- n.legend === !1 && s.legend && (s.legend = { ...s.legend, show: !1 }), n.grid === !1 && (s.xAxis && typeof s.xAxis == "object" && !Array.isArray(s.xAxis) && (s.xAxis = { ...s.xAxis, splitLine: { show: !1 } }), s.yAxis && typeof s.yAxis == "object" && !Array.isArray(s.yAxis) && (s.yAxis = { ...s.yAxis, splitLine: { show: !1 } })), n.animate === !1 && (s.animation = !1), Array.isArray(n.colors) && n.colors.length > 0 && (s.color = n.colors);
63
- const u = n.locale;
64
- L(s, "xAxis", n.xFormat, u), L(s, "yAxis", n.yFormat, u);
63
+ if (n.legend === !1 && s.legend && (s.legend = { ...s.legend, show: !1 }), n.grid === !1) {
64
+ const y = (u) => !u || typeof u != "object" ? u : Array.isArray(u) ? u.map(y) : { ...u, splitLine: { show: !1 } };
65
+ s.xAxis && (s.xAxis = y(s.xAxis)), s.yAxis && (s.yAxis = y(s.yAxis));
66
+ }
67
+ n.animate === !1 && (s.animation = !1), Array.isArray(n.colors) && n.colors.length > 0 && (s.color = n.colors);
68
+ const f = n.locale;
69
+ z(s, "xAxis", n.xFormat, f), z(s, "yAxis", n.yFormat, f);
65
70
  const h = n.echarts;
66
71
  return h && typeof h == "object" && (s = V(s, h)), s;
67
72
  }
68
- function N(e, i, r, t) {
73
+ function N(e, r, i, t) {
69
74
  if (!Array.isArray(e)) return {};
70
- const n = i?.x ?? C(e), s = i?.y ?? [_(e)].filter(Boolean);
75
+ const n = r?.x ?? C(e), s = r?.y ?? [_(e)].filter(Boolean);
71
76
  if (!n || s.length === 0) return {};
72
- const u = e.map((a) => String(a[n] ?? "")), h = !!t.horizontal, d = Array.isArray(t.series) ? t.series : [], m = t.conditionalStyles, f = s.map((a, l) => {
77
+ const f = e.map((o) => String(o[n] ?? "")), h = !!t.horizontal, y = Array.isArray(t.series) ? t.series : [], u = t.conditionalStyles, m = s.map((o, l) => {
73
78
  const c = {
74
- name: a,
75
- type: r,
76
- data: e.map((p) => {
77
- const w = p[a] ?? null;
78
- if (m?.length) {
79
- const v = M(p, m);
79
+ name: o,
80
+ type: i,
81
+ data: e.map((b) => {
82
+ const w = b[o] ?? null;
83
+ if (u?.length) {
84
+ const v = M(b, u);
80
85
  if (v) {
81
86
  const F = { value: w, itemStyle: { color: v.color } };
82
87
  return v.symbol && (F.symbol = v.symbol), v.symbolSize && (F.symbolSize = v.symbolSize), F;
@@ -86,156 +91,156 @@ function N(e, i, r, t) {
86
91
  })
87
92
  };
88
93
  t._area && (c.areaStyle = {}), t.smooth && (c.smooth = !0), t.step && (c.step = t.step === !0 ? "end" : t.step);
89
- const o = d[l];
90
- return o && (o.color && (c.itemStyle = { color: o.color }, c.lineStyle = { ...c.lineStyle ?? {}, color: o.color }), o.lineStyle && (c.lineStyle = { ...c.lineStyle ?? {}, ...o.lineStyle }), o.symbol !== void 0 && (c.symbol = o.symbol), o.label && (c.name = o.label), o.type && (c.type = o.type), o.yAxisIndex !== void 0 && (c.yAxisIndex = o.yAxisIndex)), c;
91
- }), x = { type: "category", data: u }, g = { type: "value" };
92
- t.histogram && (x.axisTick = { alignWithLabel: !0 }, f.forEach((a) => {
93
- a.barCategoryGap = "0%";
94
+ const a = y[l];
95
+ return a && (a.color && (c.itemStyle = { color: a.color }, c.lineStyle = { ...c.lineStyle ?? {}, color: a.color }), a.lineStyle && (c.lineStyle = { ...c.lineStyle ?? {}, ...a.lineStyle }), a.symbol !== void 0 && (c.symbol = a.symbol), a.label && (c.name = a.label), a.type && (c.type = a.type), a.yAxisIndex !== void 0 && (c.yAxisIndex = a.yAxisIndex)), c;
96
+ }), g = { type: "category", data: f }, x = { type: "value" };
97
+ t.histogram && (g.axisTick = { alignWithLabel: !0 }, m.forEach((o) => {
98
+ o.barCategoryGap = "0%";
94
99
  }));
95
- const A = !h && f.some((a) => a.yAxisIndex >= 1);
96
- let y;
100
+ const A = !h && m.some((o) => o.yAxisIndex >= 1);
101
+ let d;
97
102
  if (A) {
98
- const a = Array.isArray(t.yAxis) && t.yAxis.length >= 2 ? t.yAxis[1] : { type: "value" };
99
- y = [g, a];
103
+ const o = Array.isArray(t.yAxis) && t.yAxis.length >= 2 ? t.yAxis[1] : { type: "value" };
104
+ d = [x, o];
100
105
  } else
101
- y = h ? x : g;
102
- const b = {
103
- xAxis: h ? g : x,
104
- yAxis: y,
105
- series: f,
106
+ d = h ? g : x;
107
+ const p = {
108
+ xAxis: h ? x : g,
109
+ yAxis: d,
110
+ series: m,
106
111
  tooltip: { trigger: "axis" }
107
112
  };
108
113
  if (s.length > 1) {
109
- const a = f.map((l) => l.name);
110
- b.legend = { data: a };
114
+ const o = m.map((l) => l.name);
115
+ p.legend = { data: o };
111
116
  }
112
- t.stack && b.series.forEach((a) => {
113
- a.stack = "total";
117
+ t.stack && p.series.forEach((o) => {
118
+ o.stack = "total";
114
119
  });
115
120
  const S = t.referenceLines;
116
- return Array.isArray(S) && S.length > 0 && f.length > 0 && (f[0].markLine = {
121
+ return Array.isArray(S) && S.length > 0 && m.length > 0 && (m[0].markLine = {
117
122
  silent: !0,
118
123
  symbol: "none",
119
- data: S.map((a) => {
124
+ data: S.map((o) => {
120
125
  const l = {};
121
- a.axis === "x" ? l.xAxis = a.value : l.yAxis = a.value, a.label && (l.name = a.label);
126
+ o.axis === "x" ? l.xAxis = o.value : l.yAxis = o.value, o.label && (l.name = o.label);
122
127
  const c = {};
123
- return a.color && (c.color = a.color), a.style && (c.type = a.style), Object.keys(c).length > 0 && (l.lineStyle = c), a.label && (l.label = { formatter: a.label, position: "end" }), l;
128
+ return o.color && (c.color = o.color), o.style && (c.type = o.style), Object.keys(c).length > 0 && (l.lineStyle = c), o.label && (l.label = { formatter: o.label, position: "end" }), l;
124
129
  })
125
- }), b;
130
+ }), p;
126
131
  }
127
- function ce(e, i, r) {
132
+ function ce(e, r, i) {
128
133
  if (!Array.isArray(e)) return {};
129
- const t = I(e), n = i?.x ?? t[0], s = (i?.y ?? [t[1]])[0], u = i?.color, h = i?.size, d = i?.opacity;
134
+ const t = I(e), n = r?.x ?? t[0], s = (r?.y ?? [t[1]])[0], f = r?.color, h = r?.size, y = r?.opacity;
130
135
  if (!n || !s) return {};
131
- const m = {
136
+ const u = {
132
137
  xAxis: { type: "value" },
133
138
  yAxis: { type: "value" },
134
139
  tooltip: { trigger: "item" }
135
140
  };
136
- let f = 1 / 0, x = -1 / 0;
137
- if (d)
138
- for (const a of e) {
139
- const l = Number(a[d] ?? 0);
140
- l < f && (f = l), l > x && (x = l);
141
+ let m = 1 / 0, g = -1 / 0;
142
+ if (y)
143
+ for (const o of e) {
144
+ const l = Number(o[y] ?? 0);
145
+ l < m && (m = l), l > g && (g = l);
141
146
  }
142
- const g = x - f || 1, A = r.conditionalStyles, y = (a) => {
143
- const l = [Number(a[n] ?? 0), Number(a[s] ?? 0)];
144
- if (h && l.push(Number(a[h] ?? 0)), A?.length) {
145
- const c = M(a, A);
147
+ const x = g - m || 1, A = i.conditionalStyles, d = (o) => {
148
+ const l = [Number(o[n] ?? 0), Number(o[s] ?? 0)];
149
+ if (h && l.push(Number(o[h] ?? 0)), A?.length) {
150
+ const c = M(o, A);
146
151
  if (c) {
147
- const o = { color: c.color };
148
- if (d) {
149
- const w = Number(a[d] ?? 0);
150
- o.opacity = Math.round((0.1 + 0.9 * ((w - f) / g)) * 100) / 100;
152
+ const a = { color: c.color };
153
+ if (y) {
154
+ const w = Number(o[y] ?? 0);
155
+ a.opacity = Math.round((0.1 + 0.9 * ((w - m) / x)) * 100) / 100;
151
156
  }
152
- const p = { value: l, itemStyle: o };
153
- return c.symbol && (p.symbol = c.symbol), c.symbolSize && (p.symbolSize = c.symbolSize), p;
157
+ const b = { value: l, itemStyle: a };
158
+ return c.symbol && (b.symbol = c.symbol), c.symbolSize && (b.symbolSize = c.symbolSize), b;
154
159
  }
155
160
  }
156
- if (d) {
157
- const o = 0.1 + 0.9 * ((Number(a[d] ?? 0) - f) / g);
158
- return { value: l, itemStyle: { opacity: Math.round(o * 100) / 100 } };
161
+ if (y) {
162
+ const a = 0.1 + 0.9 * ((Number(o[y] ?? 0) - m) / x);
163
+ return { value: l, itemStyle: { opacity: Math.round(a * 100) / 100 } };
159
164
  }
160
165
  return l;
161
- }, b = h ? (a) => {
162
- const c = (Array.isArray(a) ? a : a.value)[2] ?? 0;
166
+ }, p = h ? (o) => {
167
+ const c = (Array.isArray(o) ? o : o.value)[2] ?? 0;
163
168
  return Math.max(4, Math.min(60, Math.sqrt(c) * 4));
164
169
  } : void 0;
165
- if (u) {
166
- const a = /* @__PURE__ */ new Map();
170
+ if (f) {
171
+ const o = /* @__PURE__ */ new Map();
167
172
  for (const c of e) {
168
- const o = String(c[u] ?? "unknown");
169
- a.has(o) || a.set(o, []), a.get(o).push(y(c));
173
+ const a = String(c[f] ?? "unknown");
174
+ o.has(a) || o.set(a, []), o.get(a).push(d(c));
170
175
  }
171
176
  const l = [];
172
- for (const [c, o] of a) {
173
- const p = { name: c, type: "scatter", data: o };
174
- b && (p.symbolSize = b), l.push(p);
177
+ for (const [c, a] of o) {
178
+ const b = { name: c, type: "scatter", data: a };
179
+ p && (b.symbolSize = p), l.push(b);
175
180
  }
176
- m.series = l, m.legend = { data: Array.from(a.keys()) };
181
+ u.series = l, u.legend = { data: Array.from(o.keys()) };
177
182
  } else {
178
- const l = { type: "scatter", data: e.map((c) => y(c)) };
179
- b && (l.symbolSize = b), m.series = [l];
183
+ const l = { type: "scatter", data: e.map((c) => d(c)) };
184
+ p && (l.symbolSize = p), u.series = [l];
180
185
  }
181
- const S = r.referenceLines;
186
+ const S = i.referenceLines;
182
187
  if (Array.isArray(S) && S.length > 0) {
183
- const a = m.series[0];
184
- a.markLine = {
188
+ const o = u.series[0];
189
+ o.markLine = {
185
190
  silent: !0,
186
191
  symbol: "none",
187
192
  data: S.map((l) => {
188
193
  const c = {};
189
194
  l.axis === "x" ? c.xAxis = l.value : c.yAxis = l.value, l.label && (c.name = l.label);
190
- const o = {};
191
- return l.color && (o.color = l.color), l.style && (o.type = l.style), Object.keys(o).length > 0 && (c.lineStyle = o), l.label && (c.label = { formatter: l.label, position: "end" }), c;
195
+ const a = {};
196
+ return l.color && (a.color = l.color), l.style && (a.type = l.style), Object.keys(a).length > 0 && (c.lineStyle = a), l.label && (c.label = { formatter: l.label, position: "end" }), c;
192
197
  })
193
198
  };
194
199
  }
195
- return m;
200
+ return u;
196
201
  }
197
- function ue(e, i, r) {
202
+ function ue(e, r, i) {
198
203
  if (!Array.isArray(e)) return {};
199
- const t = i?.label ?? C(e), n = i?.value ?? _(e);
204
+ const t = r?.label ?? C(e), n = r?.value ?? _(e);
200
205
  if (!t || !n) return {};
201
- const s = e.map((f) => ({
202
- name: String(f[t] ?? ""),
203
- value: Number(f[n] ?? 0)
206
+ const s = e.map((m) => ({
207
+ name: String(m[t] ?? ""),
208
+ value: Number(m[n] ?? 0)
204
209
  })), h = {
205
210
  type: "pie",
206
- radius: r.donut ? ["40%", "70%"] : "50%",
211
+ radius: i.donut ? ["40%", "70%"] : "50%",
207
212
  data: s,
208
213
  label: { overflow: "truncate", width: 80 }
209
214
  };
210
- r.showLabel === !1 && (h.label = { show: !1 });
211
- const d = {
215
+ i.showLabel === !1 && (h.label = { show: !1 });
216
+ const y = {
212
217
  tooltip: { trigger: "item" },
213
218
  legend: { orient: "vertical", left: "left" },
214
219
  series: [h]
215
- }, m = r.center;
216
- if (r.donut && m && (m.label || m.value)) {
217
- const f = [];
218
- m.label && f.push({
220
+ }, u = i.center;
221
+ if (i.donut && u && (u.label || u.value)) {
222
+ const m = [];
223
+ u.label && m.push({
219
224
  type: "text",
220
- top: m.value ? -16 : 0,
221
- style: { text: m.label, fontSize: 13, fill: "#999", textAlign: "center" }
222
- }), m.value && f.push({
225
+ top: u.value ? -16 : 0,
226
+ style: { text: u.label, fontSize: 13, fill: "#999", textAlign: "center" }
227
+ }), u.value && m.push({
223
228
  type: "text",
224
- top: m.label ? 8 : 0,
225
- style: { text: m.value, fontSize: 20, fontWeight: "bold", fill: "#333", textAlign: "center" }
226
- }), d.graphic = [{ type: "group", left: "center", top: "middle", children: f }];
229
+ top: u.label ? 8 : 0,
230
+ style: { text: u.value, fontSize: 20, fontWeight: "bold", fill: "#333", textAlign: "center" }
231
+ }), y.graphic = [{ type: "group", left: "center", top: "middle", children: m }];
227
232
  }
228
- return d;
233
+ return y;
229
234
  }
230
- function fe(e, i, r) {
235
+ function fe(e, r, i) {
231
236
  if (!Array.isArray(e)) return {};
232
- const t = i?.axis ?? C(e), n = i?.y ?? I(e);
237
+ const t = r?.axis ?? C(e), n = r?.y ?? I(e);
233
238
  if (!t || n.length === 0) return {};
234
239
  const s = e.map((h) => ({
235
240
  name: String(h[t] ?? "")
236
- })), u = n.map((h) => ({
241
+ })), f = n.map((h) => ({
237
242
  name: h,
238
- value: e.map((d) => Number(d[h] ?? 0))
243
+ value: e.map((y) => Number(y[h] ?? 0))
239
244
  }));
240
245
  return {
241
246
  tooltip: {},
@@ -244,38 +249,38 @@ function fe(e, i, r) {
244
249
  series: [
245
250
  {
246
251
  type: "radar",
247
- data: u
252
+ data: f
248
253
  }
249
254
  ]
250
255
  };
251
256
  }
252
- function ye(e, i, r) {
257
+ function ye(e, r, i) {
253
258
  if (!Array.isArray(e)) return {};
254
- const t = e[0] ?? {}, n = Object.keys(t), s = n.filter((o) => typeof t[o] == "string"), u = n.filter((o) => typeof t[o] == "number"), h = i?.x ?? s[0], d = i?.y?.[0] ?? s.find((o) => o !== h), m = i?.value ?? u[0];
255
- if (!h || !d || !m) return {};
256
- const f = [], x = [], g = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Set();
257
- for (const o of e) {
258
- const p = String(o[h] ?? ""), w = String(o[d] ?? "");
259
- g.has(p) || (g.add(p), f.push(p)), A.has(w) || (A.add(w), x.push(w));
259
+ const t = e[0] ?? {}, n = Object.keys(t), s = n.filter((a) => typeof t[a] == "string"), f = n.filter((a) => typeof t[a] == "number"), h = r?.x ?? s[0], y = r?.y?.[0] ?? s.find((a) => a !== h), u = r?.value ?? f[0];
260
+ if (!h || !y || !u) return {};
261
+ const m = [], g = [], x = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Set();
262
+ for (const a of e) {
263
+ const b = String(a[h] ?? ""), w = String(a[y] ?? "");
264
+ x.has(b) || (x.add(b), m.push(b)), A.has(w) || (A.add(w), g.push(w));
260
265
  }
261
- const y = /* @__PURE__ */ new Map();
262
- f.forEach((o, p) => y.set(o, p));
263
- const b = /* @__PURE__ */ new Map();
264
- x.forEach((o, p) => b.set(o, p));
266
+ const d = /* @__PURE__ */ new Map();
267
+ m.forEach((a, b) => d.set(a, b));
268
+ const p = /* @__PURE__ */ new Map();
269
+ g.forEach((a, b) => p.set(a, b));
265
270
  const S = [];
266
- let a = 1 / 0, l = -1 / 0;
267
- for (const o of e) {
268
- const p = y.get(String(o[h] ?? "")) ?? 0, w = b.get(String(o[d] ?? "")) ?? 0, v = o[m] != null ? Number(o[m]) : null;
269
- S.push([p, w, v]), v != null && (v < a && (a = v), v > l && (l = v));
271
+ let o = 1 / 0, l = -1 / 0;
272
+ for (const a of e) {
273
+ const b = d.get(String(a[h] ?? "")) ?? 0, w = p.get(String(a[y] ?? "")) ?? 0, v = a[u] != null ? Number(a[u]) : null;
274
+ S.push([b, w, v]), v != null && (v < o && (o = v), v > l && (l = v));
270
275
  }
271
- isFinite(a) || (a = 0, l = 1);
272
- const c = r.colorRange ?? ["#313695", "#4575b4", "#74add1", "#abd9e9", "#fee090", "#fdae61", "#f46d43", "#d73027"];
276
+ isFinite(o) || (o = 0, l = 1);
277
+ const c = i.colorRange ?? ["#313695", "#4575b4", "#74add1", "#abd9e9", "#fee090", "#fdae61", "#f46d43", "#d73027"];
273
278
  return {
274
- xAxis: { type: "category", data: f, splitArea: { show: !0 } },
275
- yAxis: { type: "category", data: x, splitArea: { show: !0 } },
279
+ xAxis: { type: "category", data: m, splitArea: { show: !0 } },
280
+ yAxis: { type: "category", data: g, splitArea: { show: !0 } },
276
281
  visualMap: {
277
- min: r.min != null ? Number(r.min) : a,
278
- max: r.max != null ? Number(r.max) : l,
282
+ min: i.min != null ? Number(i.min) : o,
283
+ max: i.max != null ? Number(i.max) : l,
279
284
  calculable: !0,
280
285
  orient: "horizontal",
281
286
  left: "center",
@@ -284,58 +289,58 @@ function ye(e, i, r) {
284
289
  },
285
290
  tooltip: {
286
291
  trigger: "item",
287
- formatter: (o) => {
288
- const p = o.data;
289
- return p ? `${f[p[0]]} × ${x[p[1]]}: ${p[2] != null ? p[2] : "-"}` : "";
292
+ formatter: (a) => {
293
+ const b = a.data;
294
+ return b ? `${m[b[0]]} × ${g[b[1]]}: ${b[2] != null ? b[2] : "-"}` : "";
290
295
  }
291
296
  },
292
297
  grid: { bottom: 60 },
293
298
  series: [{
294
299
  type: "heatmap",
295
300
  data: S,
296
- label: { show: r.showLabel !== !1 }
301
+ label: { show: i.showLabel !== !1 }
297
302
  }]
298
303
  };
299
304
  }
300
- function he(e, i, r) {
305
+ function he(e, r, i) {
301
306
  if (!Array.isArray(e) || e.length === 0) return {};
302
- const t = e[0] ?? {}, n = Object.keys(t), s = n.filter((g) => typeof t[g] == "string"), u = n.filter((g) => typeof t[g] == "number"), h = i?.x ?? s[0];
303
- let d;
304
- if (i?.y && i.y.length >= 5)
305
- d = i.y.slice(0, 5);
307
+ const t = e[0] ?? {}, n = Object.keys(t), s = n.filter((x) => typeof t[x] == "string"), f = n.filter((x) => typeof t[x] == "number"), h = r?.x ?? s[0];
308
+ let y;
309
+ if (r?.y && r.y.length >= 5)
310
+ y = r.y.slice(0, 5);
306
311
  else {
307
- const A = ["min", "q1", "median", "q3", "max"].filter((y) => u.includes(y));
308
- d = A.length === 5 ? A : u.slice(0, 5);
312
+ const A = ["min", "q1", "median", "q3", "max"].filter((d) => f.includes(d));
313
+ y = A.length === 5 ? A : f.slice(0, 5);
309
314
  }
310
- if (d.length < 5) return {};
311
- const m = h ? e.map((g) => String(g[h] ?? "")) : void 0, f = e.map(
312
- (g) => d.map((A) => Number(g[A] ?? 0))
313
- ), x = {
315
+ if (y.length < 5) return {};
316
+ const u = h ? e.map((x) => String(x[h] ?? "")) : void 0, m = e.map(
317
+ (x) => y.map((A) => Number(x[A] ?? 0))
318
+ ), g = {
314
319
  tooltip: { trigger: "item" },
315
320
  series: [{
316
321
  type: "boxplot",
317
- data: f
322
+ data: m
318
323
  }]
319
324
  };
320
- return m ? (x.xAxis = { type: "category", data: m }, x.yAxis = { type: "value" }) : (x.xAxis = { type: "category" }, x.yAxis = { type: "value" }), x;
325
+ return u ? (g.xAxis = { type: "category", data: u }, g.yAxis = { type: "value" }) : (g.xAxis = { type: "category" }, g.yAxis = { type: "value" }), g;
321
326
  }
322
327
  function C(e) {
323
328
  if (e.length === 0) return;
324
- const i = e[0];
325
- return Object.keys(i).find((r) => typeof i[r] == "string");
329
+ const r = e[0];
330
+ return Object.keys(r).find((i) => typeof r[i] == "string");
326
331
  }
327
332
  function _(e) {
328
333
  if (e.length === 0) return;
329
- const i = e[0];
330
- return Object.keys(i).find((r) => typeof i[r] == "number");
334
+ const r = e[0];
335
+ return Object.keys(r).find((i) => typeof r[i] == "number");
331
336
  }
332
- function me(e, i, r) {
337
+ function me(e, r, i) {
333
338
  if (!Array.isArray(e)) return {};
334
- const t = i?.label ?? C(e), n = i?.value ?? _(e);
339
+ const t = r?.label ?? C(e), n = r?.value ?? _(e);
335
340
  if (!t || !n) return {};
336
- const s = e.map((u) => ({
337
- name: String(u[t] ?? ""),
338
- value: Number(u[n] ?? 0)
341
+ const s = e.map((f) => ({
342
+ name: String(f[t] ?? ""),
343
+ value: Number(f[n] ?? 0)
339
344
  }));
340
345
  return {
341
346
  tooltip: { trigger: "item", formatter: "{b}: {c} ({d}%)" },
@@ -349,19 +354,19 @@ function me(e, i, r) {
349
354
  }]
350
355
  };
351
356
  }
352
- function de(e, i, r) {
357
+ function de(e, r, i) {
353
358
  if (!Array.isArray(e)) return {};
354
- const t = e, n = i?.x ?? C(t), s = (i?.y ?? [_(t)])[0];
359
+ const t = e, n = r?.x ?? C(t), s = (r?.y ?? [_(t)])[0];
355
360
  if (!n || !s) return {};
356
- const u = [], h = [], d = [], m = [];
357
- let f = 0;
358
- for (const x of t) {
359
- const g = String(x[n] ?? ""), A = Number(x[s] ?? 0);
360
- u.push(g), A >= 0 ? (h.push(f), d.push(A), m.push(null)) : (h.push(f + A), d.push(null), m.push(Math.abs(A))), f += A;
361
+ const f = [], h = [], y = [], u = [];
362
+ let m = 0;
363
+ for (const g of t) {
364
+ const x = String(g[n] ?? ""), A = Number(g[s] ?? 0);
365
+ f.push(x), A >= 0 ? (h.push(m), y.push(A), u.push(null)) : (h.push(m + A), y.push(null), u.push(Math.abs(A))), m += A;
361
366
  }
362
367
  return {
363
368
  tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
364
- xAxis: { type: "category", data: u },
369
+ xAxis: { type: "category", data: f },
365
370
  yAxis: { type: "value" },
366
371
  series: [
367
372
  {
@@ -376,25 +381,25 @@ function de(e, i, r) {
376
381
  name: "Positive",
377
382
  type: "bar",
378
383
  stack: "waterfall",
379
- data: d
384
+ data: y
380
385
  },
381
386
  {
382
387
  name: "Negative",
383
388
  type: "bar",
384
389
  stack: "waterfall",
385
- data: m
390
+ data: u
386
391
  }
387
392
  ]
388
393
  };
389
394
  }
390
- function be(e, i) {
395
+ function pe(e, r) {
391
396
  if (!Array.isArray(e)) return {};
392
- const r = e.map((t) => j(t));
397
+ const i = e.map((t) => j(t));
393
398
  return {
394
399
  tooltip: { trigger: "item" },
395
400
  series: [{
396
401
  type: "treemap",
397
- data: r,
402
+ data: i,
398
403
  leafDepth: 1,
399
404
  roam: !1,
400
405
  label: { show: !0, formatter: "{b}" }
@@ -402,80 +407,80 @@ function be(e, i) {
402
407
  };
403
408
  }
404
409
  function j(e) {
405
- const i = {
410
+ const r = {
406
411
  name: String(e.name ?? ""),
407
412
  value: Number(e.value ?? 0)
408
413
  };
409
- return Array.isArray(e.children) && (i.children = e.children.map((r) => j(r))), i;
414
+ return Array.isArray(e.children) && (r.children = e.children.map((i) => j(i))), r;
410
415
  }
411
- function pe(e, i, r) {
416
+ function be(e, r, i) {
412
417
  let t;
413
418
  if (!Array.isArray(e) || e.length === 0) return {};
414
419
  if (typeof e[0] == "number")
415
420
  t = e;
416
421
  else {
417
- const y = i?.value ?? _(e);
418
- if (!y) return {};
419
- t = e.map((b) => Number(b[y] ?? 0));
422
+ const d = r?.value ?? _(e);
423
+ if (!d) return {};
424
+ t = e.map((p) => Number(p[d] ?? 0));
420
425
  }
421
426
  if (t.length === 0) return {};
422
- const n = typeof r.bins == "number" ? r.bins : Math.ceil(Math.log2(t.length) + 1), s = Math.min(...t), d = (Math.max(...t) - s) / n || 1, m = new Array(n).fill(0), f = [];
423
- for (let y = 0; y < n; y++) {
424
- const b = s + y * d, S = s + (y + 1) * d, a = (l) => Number.isInteger(l) ? String(l) : l.toFixed(1);
425
- f.push(`${a(b)}–${a(S)}`);
427
+ const n = typeof i.bins == "number" ? i.bins : Math.ceil(Math.log2(t.length) + 1), s = Math.min(...t), y = (Math.max(...t) - s) / n || 1, u = new Array(n).fill(0), m = [];
428
+ for (let d = 0; d < n; d++) {
429
+ const p = s + d * y, S = s + (d + 1) * y, o = (l) => Number.isInteger(l) ? String(l) : l.toFixed(1);
430
+ m.push(`${o(p)}–${o(S)}`);
426
431
  }
427
- for (const y of t) {
428
- let b = Math.floor((y - s) / d);
429
- b >= n && (b = n - 1), m[b]++;
432
+ for (const d of t) {
433
+ let p = Math.floor((d - s) / y);
434
+ p >= n && (p = n - 1), u[p]++;
430
435
  }
431
- const x = {
436
+ const g = {
432
437
  type: "bar",
433
- data: m,
438
+ data: u,
434
439
  barCategoryGap: "0%"
435
- }, g = {
436
- xAxis: { type: "category", data: f, axisTick: { alignWithLabel: !0 } },
440
+ }, x = {
441
+ xAxis: { type: "category", data: m, axisTick: { alignWithLabel: !0 } },
437
442
  yAxis: { type: "value" },
438
- series: [x],
443
+ series: [g],
439
444
  tooltip: { trigger: "axis" }
440
- }, A = r.referenceLines;
441
- return Array.isArray(A) && A.length > 0 && (x.markLine = {
445
+ }, A = i.referenceLines;
446
+ return Array.isArray(A) && A.length > 0 && (g.markLine = {
442
447
  silent: !0,
443
448
  symbol: "none",
444
- data: A.map((y) => {
445
- const b = {};
446
- y.axis === "x" ? b.xAxis = y.value : b.yAxis = y.value, y.label && (b.name = y.label);
449
+ data: A.map((d) => {
450
+ const p = {};
451
+ d.axis === "x" ? p.xAxis = d.value : p.yAxis = d.value, d.label && (p.name = d.label);
447
452
  const S = {};
448
- return y.color && (S.color = y.color), y.style && (S.type = y.style), Object.keys(S).length > 0 && (b.lineStyle = S), y.label && (b.label = { formatter: y.label, position: "end" }), b;
453
+ return d.color && (S.color = d.color), d.style && (S.type = d.style), Object.keys(S).length > 0 && (p.lineStyle = S), d.label && (p.label = { formatter: d.label, position: "end" }), p;
449
454
  })
450
- }), g;
455
+ }), x;
451
456
  }
452
457
  function I(e) {
453
458
  if (e.length === 0) return [];
454
- const i = e[0];
455
- return Object.keys(i).filter((r) => typeof i[r] == "number");
459
+ const r = e[0];
460
+ return Object.keys(r).filter((i) => typeof r[i] == "number");
456
461
  }
457
- function V(e, i) {
458
- const r = { ...e };
459
- for (const t of Object.keys(i)) {
460
- const n = e[t], s = i[t];
461
- z(n) && z(s) ? r[t] = V(n, s) : r[t] = s;
462
+ function V(e, r) {
463
+ const i = { ...e };
464
+ for (const t of Object.keys(r)) {
465
+ const n = e[t], s = r[t];
466
+ L(n) && L(s) ? i[t] = V(n, s) : i[t] = s;
462
467
  }
463
- return r;
468
+ return i;
464
469
  }
465
- function z(e) {
470
+ function L(e) {
466
471
  return e != null && typeof e == "object" && !Array.isArray(e);
467
472
  }
468
- function xe(e, i) {
469
- return (r) => {
473
+ function ge(e, r) {
474
+ return (i) => {
470
475
  let t;
471
476
  if (e.type) {
472
477
  const n = e.type === "currency" && e.currency ? `currency:${e.currency}` : e.type;
473
- t = q(r, n, i), e.type === "percent" && (t = typeof r == "number" ? new Intl.NumberFormat(i, { maximumFractionDigits: e.decimals ?? 2 }).format(r) + "%" : String(r) + "%");
478
+ t = q(i, n, r), e.type === "percent" && (t = typeof i == "number" ? new Intl.NumberFormat(r, { maximumFractionDigits: e.decimals ?? 2 }).format(i) + "%" : String(i) + "%");
474
479
  } else
475
- t = String(r);
480
+ t = String(i);
476
481
  if (e.decimals !== void 0 && e.type === "number") {
477
- const n = Number(r);
478
- isNaN(n) || (t = new Intl.NumberFormat(i, {
482
+ const n = Number(i);
483
+ isNaN(n) || (t = new Intl.NumberFormat(r, {
479
484
  minimumFractionDigits: e.decimals,
480
485
  maximumFractionDigits: e.decimals
481
486
  }).format(n));
@@ -483,20 +488,20 @@ function xe(e, i) {
483
488
  return e.prefix && (t = e.prefix + t), e.suffix && (t = t + e.suffix), t;
484
489
  };
485
490
  }
486
- function L(e, i, r, t) {
487
- if (!r || !e[i]) return;
488
- const n = xe(r, t), s = e[i];
491
+ function z(e, r, i, t) {
492
+ if (!i || !e[r]) return;
493
+ const n = ge(i, t), s = e[r];
489
494
  if (Array.isArray(s))
490
- e[i] = s.map((u) => u.type === "value" ? { ...u, axisLabel: { ...u.axisLabel ?? {}, formatter: n } } : u);
491
- else if (z(s)) {
492
- const u = s;
493
- e[i] = { ...u, axisLabel: { ...u.axisLabel ?? {}, formatter: n } };
495
+ e[r] = s.map((f) => f.type === "value" ? { ...f, axisLabel: { ...f.axisLabel ?? {}, formatter: n } } : f);
496
+ else if (L(s)) {
497
+ const f = s;
498
+ e[r] = { ...f, axisLabel: { ...f.axisLabel ?? {}, formatter: n } };
494
499
  }
495
500
  }
496
- var ge = Object.defineProperty, Ae = Object.getOwnPropertyDescriptor, D = (e, i, r, t) => {
497
- for (var n = t > 1 ? void 0 : t ? Ae(i, r) : i, s = e.length - 1, u; s >= 0; s--)
498
- (u = e[s]) && (n = (t ? u(i, r, n) : u(n)) || n);
499
- return t && n && ge(i, r, n), n;
501
+ var xe = Object.defineProperty, Ae = Object.getOwnPropertyDescriptor, D = (e, r, i, t) => {
502
+ for (var n = t > 1 ? void 0 : t ? Ae(r, i) : r, s = e.length - 1, f; s >= 0; s--)
503
+ (f = e[s]) && (n = (t ? f(r, i, n) : f(n)) || n);
504
+ return t && n && xe(r, i, n), n;
500
505
  };
501
506
  O.use([
502
507
  H,
@@ -513,15 +518,15 @@ O.use([
513
518
  ie,
514
519
  se,
515
520
  ne,
516
- ae,
517
- oe
521
+ oe,
522
+ ae
518
523
  ]);
519
- let k = class extends T {
524
+ let k = class extends P {
520
525
  constructor() {
521
526
  super(...arguments), this.spec = null, this._chart = null, this._container = null, this._resizeObserver = null;
522
527
  }
523
528
  render() {
524
- if (!this.spec) return E;
529
+ if (!this.spec) return T;
525
530
  const e = this.spec.title ?? `${this.spec.widget} chart`;
526
531
  return R`<div class="chart-container" part="chart" role="img" aria-label=${e}></div>`;
527
532
  }
@@ -543,7 +548,7 @@ let k = class extends T {
543
548
  }
544
549
  _onChartClick(e) {
545
550
  if (!this.spec) return;
546
- const i = {
551
+ const r = {
547
552
  type: "select",
548
553
  widget: this.spec.widget,
549
554
  id: this.spec.id,
@@ -556,7 +561,7 @@ let k = class extends T {
556
561
  };
557
562
  this.dispatchEvent(
558
563
  new CustomEvent("u-widget-internal", {
559
- detail: i,
564
+ detail: r,
560
565
  bubbles: !0,
561
566
  composed: !0
562
567
  })
@@ -568,38 +573,41 @@ let k = class extends T {
568
573
  if (!(Array.isArray(
569
574
  this.spec.options?.colors
570
575
  ) && this.spec.options.colors.length > 0)) {
571
- const r = this._readThemeColors();
572
- r.length > 0 && (e.color = r);
576
+ const t = this._readThemeColors();
577
+ t.length > 0 && (e.color = t);
573
578
  }
574
- this._readCSSVar("--u-widget-bg") && (e.backgroundColor = "transparent"), this._applyThemeStyle(e), this._chart.setOption(e, !0);
579
+ !!!this.spec.options?.echarts?.backgroundColor && this._readCSSVar("--u-widget-bg") && (e.backgroundColor = "transparent"), this._applyThemeStyle(e), this._chart.setOption(e, !0);
575
580
  }
576
581
  _applyThemeStyle(e) {
577
- const i = this._readCSSVar("--u-widget-text"), r = this._readCSSVar("--u-widget-text-secondary"), t = this._readCSSVar("--u-widget-border");
578
- if (!i) return;
579
- e.textStyle = { ...e.textStyle, color: i };
582
+ const r = this._readCSSVar("--u-widget-text"), i = this._readCSSVar("--u-widget-text-secondary"), t = this._readCSSVar("--u-widget-border");
583
+ if (!r) return;
584
+ e.textStyle = { ...e.textStyle, color: r };
580
585
  const n = (s) => {
581
586
  if (!s || typeof s != "object") return s;
582
587
  if (Array.isArray(s)) return s.map(n);
583
- const u = s;
588
+ const f = s, h = f.axisLine ?? {}, y = h.lineStyle ?? {}, u = f.splitLine ?? {}, m = u.lineStyle ?? {};
584
589
  return {
585
- ...u,
586
- axisLabel: { ...u.axisLabel ?? {}, color: r || i },
587
- axisLine: { lineStyle: { color: t || r } },
588
- splitLine: { lineStyle: { color: t } }
590
+ ...f,
591
+ axisLabel: { ...f.axisLabel ?? {}, color: i || r },
592
+ axisLine: { ...h, lineStyle: { ...y, color: t || i } },
593
+ splitLine: { ...u, lineStyle: { ...m, color: t } }
589
594
  };
590
595
  };
591
- e.xAxis && (e.xAxis = n(e.xAxis)), e.yAxis && (e.yAxis = n(e.yAxis)), e.legend && typeof e.legend == "object" && (e.legend = { ...e.legend, textStyle: { color: i } });
596
+ if (e.xAxis && (e.xAxis = n(e.xAxis)), e.yAxis && (e.yAxis = n(e.yAxis)), e.legend && typeof e.legend == "object") {
597
+ const s = e.legend;
598
+ e.legend = { ...s, textStyle: { ...s.textStyle ?? {}, color: r } };
599
+ }
592
600
  }
593
601
  _readThemeColors() {
594
602
  const e = [];
595
- for (let i = 1; i <= 10; i++) {
596
- const r = this._readCSSVar(`--u-widget-chart-color-${i}`);
597
- if (r) e.push(r);
603
+ for (let r = 1; r <= 10; r++) {
604
+ const i = this._readCSSVar(`--u-widget-chart-color-${r}`);
605
+ if (i) e.push(i);
598
606
  else break;
599
607
  }
600
608
  if (e.length === 0) {
601
- const i = this._readCSSVar("--u-widget-primary");
602
- i && e.push(i);
609
+ const r = this._readCSSVar("--u-widget-primary");
610
+ r && e.push(r);
603
611
  }
604
612
  return e;
605
613
  }
@@ -616,7 +624,7 @@ let k = class extends T {
616
624
  };
617
625
  k.styles = [
618
626
  G,
619
- P`
627
+ E`
620
628
  :host {
621
629
  display: block;
622
630
  container: uw-chart / inline-size;