@cpsoft13/z-agent-ui 0.2.1 → 0.3.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.
- package/bin/lines-baseline.json +1 -15
- package/bin/text-baseline.json +1 -2
- package/dist/build-info.json +2 -2
- package/dist/components/context-menu/ContextMenu.js +7 -7
- package/dist/components/context-menu/ContextMenu.js.map +1 -1
- package/dist/components/date-range/DateRange.js +4 -4
- package/dist/components/date-range/DateRange.js.map +1 -1
- package/dist/components/datepicker/Datepicker.js +207 -332
- package/dist/components/datepicker/Datepicker.js.map +1 -1
- package/dist/components/datepicker/datepicker-keyboard.js +66 -0
- package/dist/components/datepicker/datepicker-keyboard.js.map +1 -0
- package/dist/components/datepicker/datepicker-panel-render.js +78 -0
- package/dist/components/datepicker/datepicker-panel-render.js.map +1 -0
- package/dist/components/form/Form.js +69 -47
- package/dist/components/form/Form.js.map +1 -1
- package/dist/components/form/form-context.js +9 -0
- package/dist/components/form/form-context.js.map +1 -0
- package/dist/components/form.js +2 -0
- package/dist/components/form.js.map +1 -1
- package/dist/components/menu/Menu.js +27 -27
- package/dist/components/menu/Menu.js.map +1 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/popover/Popover.js.map +1 -1
- package/dist/components/select/Select.js +235 -351
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/select/option-search.js +49 -0
- package/dist/components/select/option-search.js.map +1 -0
- package/dist/components/select/select-render.js +75 -0
- package/dist/components/select/select-render.js.map +1 -0
- package/dist/components/select/selection-strategy.js +151 -0
- package/dist/components/select/selection-strategy.js.map +1 -0
- package/dist/components/time-picker/TimePicker.js +1 -1
- package/dist/components/time-picker/TimePicker.js.map +1 -1
- package/dist/components/tooltip/Tooltip.js +16 -16
- package/dist/components/tooltip/Tooltip.js.map +1 -1
- package/dist/core/BaseElement.js +96 -77
- package/dist/core/BaseElement.js.map +1 -1
- package/dist/core/context.js +68 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/controller.js +2 -0
- package/dist/core/controller.js.map +1 -0
- package/dist/core/public.js +35 -30
- package/dist/core/public.js.map +1 -1
- package/dist/core.js +95 -90
- package/dist/core.js.map +1 -1
- package/dist/doc/doc-template-editor-core.js +12 -11
- package/dist/doc/doc-template-editor-core.js.map +1 -1
- package/dist/doc/doc-template-editor-panel.css.js +202 -0
- package/dist/doc/doc-template-editor-panel.css.js.map +1 -0
- package/dist/doc/doc-template-editor.css.js +1 -200
- package/dist/doc/doc-template-editor.css.js.map +1 -1
- package/dist/flow/Flow.js +104 -195
- package/dist/flow/Flow.js.map +1 -1
- package/dist/flow/flow-keyboard-controller.js +101 -0
- package/dist/flow/flow-keyboard-controller.js.map +1 -0
- package/dist/primitives/overlay/floatingPanel.js +6 -2
- package/dist/primitives/overlay/floatingPanel.js.map +1 -1
- package/dist/report/chart/Chart.js +271 -761
- package/dist/report/chart/Chart.js.map +1 -1
- package/dist/report/chart/chart-brush-controller.js +187 -0
- package/dist/report/chart/chart-brush-controller.js.map +1 -0
- package/dist/report/chart/chart-layout-pipeline.js +158 -0
- package/dist/report/chart/chart-layout-pipeline.js.map +1 -0
- package/dist/report/chart/chart-zoom.js +79 -0
- package/dist/report/chart/chart-zoom.js.map +1 -0
- package/dist/report/chart/geometry/build.js +41 -26
- package/dist/report/chart/geometry/build.js.map +1 -1
- package/dist/report/chart/geometry/extra-flow-dist.js +283 -0
- package/dist/report/chart/geometry/extra-flow-dist.js.map +1 -0
- package/dist/report/chart/geometry/extra-radial-grid.js +280 -0
- package/dist/report/chart/geometry/extra-radial-grid.js.map +1 -0
- package/dist/report/chart/geometry/extra-shared.js +36 -0
- package/dist/report/chart/geometry/extra-shared.js.map +1 -0
- package/dist/report/chart/geometry/extra.js +20 -583
- package/dist/report/chart/geometry/extra.js.map +1 -1
- package/dist/report/chart/geometry/registry.js +20 -0
- package/dist/report/chart/geometry/registry.js.map +1 -0
- package/dist/report/chart.js +12 -6
- package/dist/report/chart.js.map +1 -1
- package/dist/report/gantt/Gantt.js +199 -308
- package/dist/report/gantt/Gantt.js.map +1 -1
- package/dist/report/gantt/gantt-bars.css.js +247 -0
- package/dist/report/gantt/gantt-bars.css.js.map +1 -0
- package/dist/report/gantt/gantt-edit-controller.js +94 -0
- package/dist/report/gantt/gantt-edit-controller.js.map +1 -0
- package/dist/report/gantt/gantt.css.js +0 -272
- package/dist/report/gantt/gantt.css.js.map +1 -1
- package/dist/report/table/ReportTable.js +336 -493
- package/dist/report/table/ReportTable.js.map +1 -1
- package/dist/report/table/report-table-config.css.js +172 -0
- package/dist/report/table/report-table-config.css.js.map +1 -0
- package/dist/report/table/report-table-types.js.map +1 -1
- package/dist/report/table/report-table.css.js +0 -176
- package/dist/report/table/report-table.css.js.map +1 -1
- package/dist/report/table/table-cell-registry.js +29 -0
- package/dist/report/table/table-cell-registry.js.map +1 -0
- package/dist/report/table/table-keyboard-controller.js +96 -0
- package/dist/report/table/table-keyboard-controller.js.map +1 -0
- package/dist/report/table/table-pipeline.js +36 -0
- package/dist/report/table/table-pipeline.js.map +1 -0
- package/dist/report/table/table-render.js +97 -96
- package/dist/report/table/table-render.js.map +1 -1
- package/dist/report/table/table-scroll-controller.js +33 -0
- package/dist/report/table/table-scroll-controller.js.map +1 -0
- package/dist/report/table.js +7 -2
- package/dist/report/table.js.map +1 -1
- package/dist/report.js +39 -28
- package/dist/report.js.map +1 -1
- package/dist/types/components/datepicker/Datepicker.d.ts +1 -109
- package/dist/types/components/datepicker/datepicker-keyboard.d.ts +21 -0
- package/dist/types/components/datepicker/datepicker-panel-render.d.ts +25 -0
- package/dist/types/components/form/Form.d.ts +7 -2
- package/dist/types/components/form/form-context.d.ts +11 -0
- package/dist/types/components/form/index.d.ts +1 -1
- package/dist/types/components/select/Select.d.ts +7 -110
- package/dist/types/components/select/option-search.d.ts +38 -0
- package/dist/types/components/select/select-render.d.ts +39 -0
- package/dist/types/components/select/selection-strategy.d.ts +86 -0
- package/dist/types/core/BaseElement.d.ts +7 -1
- package/dist/types/core/context.d.ts +66 -0
- package/dist/types/core/controller.d.ts +22 -0
- package/dist/types/core/public.d.ts +2 -0
- package/dist/types/flow/Flow.d.ts +3 -76
- package/dist/types/flow/flow-keyboard-controller.d.ts +35 -0
- package/dist/types/primitives/overlay/floatingPanel.d.ts +2 -0
- package/dist/types/report/chart/Chart.d.ts +2 -245
- package/dist/types/report/chart/chart-brush-controller.d.ts +59 -0
- package/dist/types/report/chart/chart-layout-pipeline.d.ts +42 -0
- package/dist/types/report/chart/chart-zoom.d.ts +12 -0
- package/dist/types/report/chart/geometry/build.d.ts +2 -0
- package/dist/types/report/chart/geometry/extra-flow-dist.d.ts +6 -0
- package/dist/types/report/chart/geometry/extra-radial-grid.d.ts +6 -0
- package/dist/types/report/chart/geometry/extra-shared.d.ts +24 -0
- package/dist/types/report/chart/geometry/extra.d.ts +2 -34
- package/dist/types/report/chart/geometry/registry.d.ts +26 -0
- package/dist/types/report/chart/index.d.ts +1 -0
- package/dist/types/report/gantt/Gantt.d.ts +7 -97
- package/dist/types/report/gantt/gantt-edit-controller.d.ts +34 -0
- package/dist/types/report/table/ReportTable.d.ts +9 -180
- package/dist/types/report/table/index.d.ts +1 -0
- package/dist/types/report/table/report-table-types.d.ts +2 -0
- package/dist/types/report/table/table-cell-registry.d.ts +17 -0
- package/dist/types/report/table/table-keyboard-controller.d.ts +30 -0
- package/dist/types/report/table/table-pipeline.d.ts +33 -0
- package/dist/types/report/table/table-scroll-controller.d.ts +25 -0
- package/dist/z-agent-ui.js +35 -30
- package/dist/z-agent-ui.js.map +1 -1
- package/package.json +1 -1
- package/registry/component-manifest.json +39 -7
- package/src/components/context-menu/ContextMenu.ts +1 -1
- package/src/components/date-range/DateRange.ts +1 -1
- package/src/components/datepicker/Datepicker.ts +99 -417
- package/src/components/datepicker/datepicker-keyboard.ts +94 -0
- package/src/components/datepicker/datepicker-panel-render.ts +169 -0
- package/src/components/form/Form.ts +39 -11
- package/src/components/form/form-context.ts +11 -0
- package/src/components/form/index.ts +1 -1
- package/src/components/menu/Menu.ts +1 -1
- package/src/components/popover/Popover.ts +1 -1
- package/src/components/select/Select.ts +140 -525
- package/src/components/select/option-search.ts +114 -0
- package/src/components/select/select-render.ts +161 -0
- package/src/components/select/selection-strategy.ts +245 -0
- package/src/components/time-picker/TimePicker.ts +1 -1
- package/src/components/tooltip/Tooltip.ts +1 -1
|
@@ -1,596 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
function at(d) {
|
|
16
|
-
const n = /^#([0-9a-f]{6})$/i.exec(d.trim());
|
|
17
|
-
if (!n) return "#0f172a";
|
|
18
|
-
const o = parseInt(n[1], 16);
|
|
19
|
-
return (0.299 * (o >> 16 & 255) + 0.587 * (o >> 8 & 255) + 0.114 * (o & 255)) / 255 > 0.55 ? "#0f172a" : "#ffffff";
|
|
20
|
-
}
|
|
21
|
-
function it(d, n, o, l, c) {
|
|
22
|
-
const t = d.find((p) => p.visible) ?? d[0], s = ((t == null ? void 0 : t.data) ?? []).filter((p) => Number.isFinite(p.value) && p.value >= 0);
|
|
23
|
-
if (s.length === 0) return _();
|
|
24
|
-
const { plot: x } = n, $ = Math.min(x.width * 0.28, 120), m = Math.max(x.width - $ * 2, 20), h = x.x + $, F = h + m, u = h + m / 2, i = Math.max(...s.map((p) => p.value), 1), a = s.length, M = 2, g = Math.max((x.height - M * (a - 1)) / a, 1), b = V((t == null ? void 0 : t.format) ?? "auto", c.locale), v = parseFloat(o.labelFontSize) || 12, I = [], z = [];
|
|
25
|
-
return s.forEach((p, y) => {
|
|
26
|
-
const w = x.y + (g + M) * y, S = g * Math.max(l, 1e-3), O = p.value / i * m, G = (y + 1 < a ? s[y + 1].value : p.value) / i * m, P = g > 0 ? S / g : 1, Q = O + (G - O) * P, e = `M ${u - O / 2} ${w} L ${u + O / 2} ${w} L ${u + Q / 2} ${w + S} L ${u - Q / 2} ${w + S} Z`;
|
|
27
|
-
I.push({
|
|
28
|
-
kind: "path",
|
|
29
|
-
seriesIndex: t.index,
|
|
30
|
-
dataIndex: y,
|
|
31
|
-
d: e,
|
|
32
|
-
color: q(c, y, t.color),
|
|
33
|
-
fillOpacity: 0.92,
|
|
34
|
-
visible: !0
|
|
35
|
-
});
|
|
36
|
-
const T = w + g / 2 + v * 0.36;
|
|
37
|
-
I.push({
|
|
38
|
-
kind: "text",
|
|
39
|
-
seriesIndex: t.index,
|
|
40
|
-
dataIndex: y,
|
|
41
|
-
cx: h - 8,
|
|
42
|
-
cy: T,
|
|
43
|
-
color: o.text,
|
|
44
|
-
label: p.label ?? String(y + 1),
|
|
45
|
-
textAnchor: "end",
|
|
46
|
-
fontSize: v,
|
|
47
|
-
opacity: l,
|
|
48
|
-
visible: !0
|
|
49
|
-
});
|
|
50
|
-
const A = i > 0 ? p.value / i * 100 : 0;
|
|
51
|
-
I.push({
|
|
52
|
-
kind: "text",
|
|
53
|
-
seriesIndex: t.index,
|
|
54
|
-
dataIndex: y,
|
|
55
|
-
cx: F + 8,
|
|
56
|
-
cy: T,
|
|
57
|
-
color: o.text,
|
|
58
|
-
label: `${b(p.value)} ${A.toFixed(0)}%`,
|
|
59
|
-
textAnchor: "start",
|
|
60
|
-
fontSize: v,
|
|
61
|
-
opacity: l,
|
|
62
|
-
visible: !0
|
|
63
|
-
});
|
|
64
|
-
const k = Math.max(O, Q);
|
|
65
|
-
z.push({
|
|
66
|
-
seriesIndex: t.index,
|
|
67
|
-
dataIndex: y,
|
|
68
|
-
label: p.label ?? String(y + 1),
|
|
69
|
-
values: [
|
|
70
|
-
{ name: t.name || "值", value: p.value, formatted: b(p.value), color: q(c, y, t.color) },
|
|
71
|
-
{ name: "占比", value: A, formatted: `${A.toFixed(1)}%`, color: q(c, y, t.color) }
|
|
72
|
-
],
|
|
73
|
-
x: u - k / 2,
|
|
74
|
-
y: w,
|
|
75
|
-
w: k,
|
|
76
|
-
h: Math.max(S, 1)
|
|
77
|
-
});
|
|
78
|
-
}), { marks: I, gridLines: [], axes: [], legend: [], tooltipTargets: z, noData: !1 };
|
|
79
|
-
}
|
|
80
|
-
function lt(d, n, o, l, c) {
|
|
81
|
-
var D;
|
|
82
|
-
const t = d.filter((r) => r.visible), s = [];
|
|
83
|
-
for (const r of t)
|
|
84
|
-
for (const L of r.data) {
|
|
85
|
-
const H = L.label ?? "";
|
|
86
|
-
H && !s.includes(H) && s.push(H);
|
|
87
|
-
}
|
|
88
|
-
if (t.length === 0 || s.length === 0) return _();
|
|
89
|
-
const x = parseFloat(o.labelFontSize) || 12, $ = V(((D = t[0]) == null ? void 0 : D.format) ?? "auto", c.locale), m = Math.max(...t.map((r) => R(r.name, x))) + 10, h = x + 8, F = 12 + x, u = n.plot.x + m, i = n.plot.y, a = Math.max(n.plot.width - m - 4, 10), M = Math.max(n.plot.height - h - F, 10), g = t.length, b = s.length, v = a / b, I = M / g, z = [];
|
|
90
|
-
for (const r of t) for (const L of r.data) Number.isFinite(L.value) && z.push(L.value);
|
|
91
|
-
const p = 7, y = et(z, p, { min: c.clampMin, max: c.clampMax }), w = o.dark ? nt : ot, S = [], O = [];
|
|
92
|
-
t.forEach((r, L) => {
|
|
93
|
-
s.forEach((H, W) => {
|
|
94
|
-
const C = r.data.find((tt) => (tt.label ?? "") === H);
|
|
95
|
-
if (!C || !Number.isFinite(C.value)) return;
|
|
96
|
-
const K = y.bucketIndex(C.value), Y = w[Math.min(K, w.length - 1)], B = u + v * W, U = i + I * L, X = Math.max(v - 1, 1), j = Math.max(I - 1, 1);
|
|
97
|
-
S.push({
|
|
98
|
-
kind: "rect",
|
|
99
|
-
seriesIndex: r.index,
|
|
100
|
-
dataIndex: r.data.indexOf(C),
|
|
101
|
-
x: B,
|
|
102
|
-
y: U,
|
|
103
|
-
width: X,
|
|
104
|
-
height: j,
|
|
105
|
-
color: Y,
|
|
106
|
-
visible: !0
|
|
107
|
-
}), v >= 38 && I >= 18 && c.labels !== !1 && S.push({
|
|
108
|
-
kind: "text",
|
|
109
|
-
seriesIndex: r.index,
|
|
110
|
-
dataIndex: r.data.indexOf(C),
|
|
111
|
-
cx: B + X / 2,
|
|
112
|
-
cy: U + j / 2 + x * 0.36,
|
|
113
|
-
color: at(Y),
|
|
114
|
-
label: $(C.value),
|
|
115
|
-
textAnchor: "middle",
|
|
116
|
-
fontSize: 10,
|
|
117
|
-
opacity: l,
|
|
118
|
-
visible: !0
|
|
119
|
-
}), O.push({
|
|
120
|
-
seriesIndex: r.index,
|
|
121
|
-
dataIndex: r.data.indexOf(C),
|
|
122
|
-
label: `${r.name} · ${H}`,
|
|
123
|
-
values: [{ name: r.name || "值", value: C.value, formatted: $(C.value), color: Y }],
|
|
124
|
-
x: B,
|
|
125
|
-
y: U,
|
|
126
|
-
w: X,
|
|
127
|
-
h: j
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
const f = i + M + h - 2, G = a / p;
|
|
132
|
-
for (let r = 0; r < p; r++)
|
|
133
|
-
S.push({
|
|
134
|
-
kind: "rect",
|
|
135
|
-
seriesIndex: -1,
|
|
136
|
-
dataIndex: -1,
|
|
137
|
-
x: u + G * r,
|
|
138
|
-
y: f,
|
|
139
|
-
width: Math.max(G - 1, 1),
|
|
140
|
-
height: 8,
|
|
141
|
-
color: w[Math.min(r, w.length - 1)],
|
|
142
|
-
visible: !0
|
|
143
|
-
});
|
|
144
|
-
const P = f + 8 + x - 1;
|
|
145
|
-
S.push({
|
|
146
|
-
kind: "text",
|
|
147
|
-
seriesIndex: -1,
|
|
148
|
-
dataIndex: -1,
|
|
149
|
-
cx: u,
|
|
150
|
-
cy: P,
|
|
151
|
-
color: o.textSecondary,
|
|
152
|
-
label: $(y.min),
|
|
153
|
-
textAnchor: "start",
|
|
154
|
-
fontSize: x - 2,
|
|
155
|
-
opacity: l,
|
|
156
|
-
visible: !0
|
|
157
|
-
}), S.push({
|
|
158
|
-
kind: "text",
|
|
159
|
-
seriesIndex: -1,
|
|
160
|
-
dataIndex: -1,
|
|
161
|
-
cx: u + a,
|
|
162
|
-
cy: P,
|
|
163
|
-
color: o.textSecondary,
|
|
164
|
-
label: $(y.max),
|
|
165
|
-
textAnchor: "end",
|
|
166
|
-
fontSize: x - 2,
|
|
167
|
-
opacity: l,
|
|
168
|
-
visible: !0
|
|
169
|
-
});
|
|
170
|
-
const Q = Math.max(...s.map((r) => R(r, x)), 1) + 8, e = Math.max(1, Math.ceil(Q / Math.max(v, 1))), T = s.map((r, L) => ({ value: L, label: r, x: u + v * L + v / 2, y: i + M })).filter((r, L) => L % e === 0), A = x + 2, k = Math.max(1, Math.ceil(A / Math.max(I, 1))), N = t.map((r, L) => ({ value: L, label: r.name, x: u, y: i + I * L + I / 2 })).filter((r, L) => L % k === 0), E = [
|
|
171
|
-
{
|
|
172
|
-
position: "bottom",
|
|
173
|
-
kind: "category",
|
|
174
|
-
title: "",
|
|
175
|
-
ticks: T,
|
|
176
|
-
color: o.textSecondary,
|
|
177
|
-
fontFamily: o.fontFamily,
|
|
178
|
-
fontSize: o.labelFontSize
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
position: "left",
|
|
182
|
-
kind: "category",
|
|
183
|
-
title: "",
|
|
184
|
-
ticks: N,
|
|
185
|
-
color: o.textSecondary,
|
|
186
|
-
fontFamily: o.fontFamily,
|
|
187
|
-
fontSize: o.labelFontSize
|
|
188
|
-
}
|
|
189
|
-
];
|
|
190
|
-
return { marks: S, gridLines: [], axes: E, legend: [], tooltipTargets: O, noData: !1 };
|
|
191
|
-
}
|
|
192
|
-
function st(d, n, o, l, c) {
|
|
193
|
-
var w;
|
|
194
|
-
const t = d.find((S) => S.visible) ?? d[0], s = (w = t == null ? void 0 : t.data) == null ? void 0 : w.find((S) => Number.isFinite(S.value));
|
|
195
|
-
if (!s) return _();
|
|
196
|
-
const x = Number.isFinite(c.gaugeMin) ? c.gaugeMin : 0, $ = Number.isFinite(c.gaugeMax) ? c.gaugeMax : void 0, m = $ !== void 0 && $ > x ? $ : Math.max(s.value * 1.25, x + 1), h = Math.max(0, Math.min(1, (s.value - x) / (m - x || 1))), { plot: F } = n, u = Math.max(Math.min(F.width / 2 - 16, F.height * 0.58), 12), i = F.x + F.width / 2, a = F.y + F.height * 0.66, M = Math.max(u * 0.16, 6), g = V((t == null ? void 0 : t.format) ?? "auto", c.locale), b = parseFloat(o.labelFontSize) || 12, v = [], I = Math.PI, z = Math.PI * 2;
|
|
197
|
-
v.push({
|
|
198
|
-
kind: "path",
|
|
199
|
-
seriesIndex: t.index,
|
|
200
|
-
dataIndex: 0,
|
|
201
|
-
d: J(i, a, u, I, z),
|
|
202
|
-
color: o.grid,
|
|
203
|
-
strokeWidth: M,
|
|
204
|
-
opacity: 1,
|
|
205
|
-
visible: !0
|
|
206
|
-
}), h > 0 && v.push({
|
|
207
|
-
kind: "path",
|
|
208
|
-
seriesIndex: t.index,
|
|
209
|
-
dataIndex: 0,
|
|
210
|
-
d: J(i, a, u, I, I + (z - I) * h * Math.max(l, 1e-3)),
|
|
211
|
-
color: t.color,
|
|
212
|
-
strokeWidth: M,
|
|
213
|
-
opacity: 1,
|
|
214
|
-
visible: !0
|
|
215
|
-
});
|
|
216
|
-
const p = I + (z - I) * h, y = u - M - 4;
|
|
217
|
-
return v.push({
|
|
218
|
-
kind: "path",
|
|
219
|
-
seriesIndex: t.index,
|
|
220
|
-
dataIndex: 0,
|
|
221
|
-
d: `M ${i} ${a} L ${i + y * Math.cos(p)} ${a + y * Math.sin(p)}`,
|
|
222
|
-
color: o.text,
|
|
223
|
-
strokeWidth: 2,
|
|
224
|
-
opacity: l,
|
|
225
|
-
visible: !0
|
|
226
|
-
}), v.push({
|
|
227
|
-
kind: "circle",
|
|
228
|
-
seriesIndex: t.index,
|
|
229
|
-
dataIndex: 0,
|
|
230
|
-
cx: i,
|
|
231
|
-
cy: a,
|
|
232
|
-
r: Math.max(M * 0.5, 3),
|
|
233
|
-
color: o.text,
|
|
234
|
-
opacity: l,
|
|
235
|
-
visible: !0
|
|
236
|
-
}), v.push({
|
|
237
|
-
kind: "text",
|
|
238
|
-
seriesIndex: t.index,
|
|
239
|
-
dataIndex: 0,
|
|
240
|
-
cx: i,
|
|
241
|
-
cy: a + b * 2.6,
|
|
242
|
-
color: o.text,
|
|
243
|
-
label: g(s.value),
|
|
244
|
-
textAnchor: "middle",
|
|
245
|
-
fontSize: Math.max(b * 1.6, 16),
|
|
246
|
-
fontWeight: 600,
|
|
247
|
-
opacity: l,
|
|
248
|
-
visible: !0
|
|
249
|
-
}), v.push({
|
|
250
|
-
kind: "text",
|
|
251
|
-
seriesIndex: t.index,
|
|
252
|
-
dataIndex: 0,
|
|
253
|
-
cx: i - u,
|
|
254
|
-
cy: a + M * 0.5 + b * 0.9,
|
|
255
|
-
color: o.textSecondary,
|
|
256
|
-
label: g(x),
|
|
257
|
-
textAnchor: "middle",
|
|
258
|
-
fontSize: b,
|
|
259
|
-
opacity: l,
|
|
260
|
-
visible: !0
|
|
261
|
-
}), v.push({
|
|
262
|
-
kind: "text",
|
|
263
|
-
seriesIndex: t.index,
|
|
264
|
-
dataIndex: 0,
|
|
265
|
-
cx: i + u,
|
|
266
|
-
cy: a + M * 0.5 + b * 0.9,
|
|
267
|
-
color: o.textSecondary,
|
|
268
|
-
label: g(m),
|
|
269
|
-
textAnchor: "middle",
|
|
270
|
-
fontSize: b,
|
|
271
|
-
opacity: l,
|
|
272
|
-
visible: !0
|
|
273
|
-
}), {
|
|
274
|
-
marks: v,
|
|
275
|
-
gridLines: [],
|
|
276
|
-
axes: [],
|
|
277
|
-
legend: [],
|
|
278
|
-
tooltipTargets: [{
|
|
279
|
-
seriesIndex: t.index,
|
|
280
|
-
dataIndex: 0,
|
|
281
|
-
label: s.label ?? t.name ?? "",
|
|
282
|
-
values: [{ name: t.name || "值", value: s.value, formatted: g(s.value), color: t.color }],
|
|
283
|
-
x: i - u,
|
|
284
|
-
y: a - u,
|
|
285
|
-
w: u * 2,
|
|
286
|
-
h: u + M
|
|
287
|
-
}],
|
|
288
|
-
noData: !1
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
function ct(d, n, o) {
|
|
292
|
-
if (!d || n <= 0) return "";
|
|
293
|
-
if (R(d, o) <= n) return d;
|
|
294
|
-
let l = "";
|
|
295
|
-
for (const c of d) {
|
|
296
|
-
if (R(`${l}${c}…`, o) > n) break;
|
|
297
|
-
l += c;
|
|
298
|
-
}
|
|
299
|
-
return l ? `${l}…` : "";
|
|
300
|
-
}
|
|
301
|
-
function Z(d, n, o) {
|
|
302
|
-
if (d.length === 0) return;
|
|
303
|
-
if (d.length === 1) {
|
|
304
|
-
o.push({ ...n, index: d[0].index });
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
const l = d.reduce((F, u) => F + u.value, 0) || 1;
|
|
308
|
-
let c = 0, t = 0;
|
|
309
|
-
for (; t < d.length - 1 && !(c + d[t].value >= l / 2); t++)
|
|
310
|
-
c += d[t].value;
|
|
311
|
-
const s = Math.min(Math.max(t + 1, 1), d.length - 1), x = d.slice(0, s), $ = d.slice(s), m = x.reduce((F, u) => F + u.value, 0) || 1, h = Math.max(Math.min(m / l, 0.95), 0.05);
|
|
312
|
-
n.w >= n.h ? (Z(x, { ...n, w: n.w * h }, o), Z($, { x: n.x + n.w * h, y: n.y, w: n.w * (1 - h), h: n.h }, o)) : (Z(x, { ...n, h: n.h * h }, o), Z($, { x: n.x, y: n.y + n.h * h, w: n.w, h: n.h * (1 - h) }, o));
|
|
313
|
-
}
|
|
314
|
-
function dt(d, n, o, l, c) {
|
|
315
|
-
const t = d.find((i) => i.visible) ?? d[0], s = ((t == null ? void 0 : t.data) ?? []).map((i, a) => ({ index: a, value: i.value, label: i.label })).filter((i) => Number.isFinite(i.value) && i.value > 0);
|
|
316
|
-
if (s.length === 0) return _();
|
|
317
|
-
const x = V((t == null ? void 0 : t.format) ?? "auto", c.locale), $ = parseFloat(o.labelFontSize) || 12, m = [];
|
|
318
|
-
Z(
|
|
319
|
-
[...s].sort((i, a) => a.value - i.value),
|
|
320
|
-
{ x: n.plot.x, y: n.plot.y, w: n.plot.width, h: n.plot.height },
|
|
321
|
-
m
|
|
322
|
-
);
|
|
323
|
-
const h = [], F = [], u = s.reduce((i, a) => i + a.value, 0) || 1;
|
|
324
|
-
for (const i of m) {
|
|
325
|
-
const a = s.find((z) => z.index === i.index), M = i.x + 1.5, g = i.y + 1.5, b = Math.max(i.w - 3, 0), v = Math.max(i.h - 3, 0);
|
|
326
|
-
if (b < 2 || v < 2) continue;
|
|
327
|
-
const I = q(c, a.index, t.color);
|
|
328
|
-
if (h.push({
|
|
329
|
-
kind: "rect",
|
|
330
|
-
seriesIndex: t.index,
|
|
331
|
-
dataIndex: a.index,
|
|
332
|
-
x: M,
|
|
333
|
-
y: g,
|
|
334
|
-
width: b,
|
|
335
|
-
height: v,
|
|
336
|
-
color: I,
|
|
337
|
-
visible: !0
|
|
338
|
-
}), b >= 34 && v >= 20) {
|
|
339
|
-
const z = Math.min($, 12), p = ct(String(a.label ?? ""), b - 10, z);
|
|
340
|
-
if (p && h.push({
|
|
341
|
-
kind: "text",
|
|
342
|
-
seriesIndex: t.index,
|
|
343
|
-
dataIndex: a.index,
|
|
344
|
-
cx: M + 5,
|
|
345
|
-
cy: g + $ + 3,
|
|
346
|
-
color: "#ffffff",
|
|
347
|
-
label: p,
|
|
348
|
-
textAnchor: "start",
|
|
349
|
-
fontSize: z,
|
|
350
|
-
opacity: l,
|
|
351
|
-
visible: !0
|
|
352
|
-
}), v >= 34) {
|
|
353
|
-
const y = `${x(a.value)} (${(a.value / u * 100).toFixed(0)}%)`, w = R(y, 10) <= b - 10 ? y : R(x(a.value), 10) <= b - 10 ? x(a.value) : "";
|
|
354
|
-
w && h.push({
|
|
355
|
-
kind: "text",
|
|
356
|
-
seriesIndex: t.index,
|
|
357
|
-
dataIndex: a.index,
|
|
358
|
-
cx: M + 5,
|
|
359
|
-
cy: g + $ * 2 + 5,
|
|
360
|
-
color: "#ffffff",
|
|
361
|
-
label: w,
|
|
362
|
-
textAnchor: "start",
|
|
363
|
-
fontSize: 10,
|
|
364
|
-
opacity: l,
|
|
365
|
-
visible: !0
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
F.push({
|
|
370
|
-
seriesIndex: t.index,
|
|
371
|
-
dataIndex: a.index,
|
|
372
|
-
label: String(a.label ?? a.index + 1),
|
|
373
|
-
values: [
|
|
374
|
-
{ name: t.name || "值", value: a.value, formatted: x(a.value), color: I },
|
|
375
|
-
{ name: "占比", value: a.value / u * 100, formatted: `${(a.value / u * 100).toFixed(1)}%`, color: I }
|
|
376
|
-
],
|
|
377
|
-
x: M,
|
|
378
|
-
y: g,
|
|
379
|
-
w: b,
|
|
380
|
-
h: v
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
return { marks: h, gridLines: [], axes: [], legend: [], tooltipTargets: F, noData: !1 };
|
|
384
|
-
}
|
|
385
|
-
const rt = ["→", "->", ">", "|"];
|
|
386
|
-
function ut(d, n, o, l, c) {
|
|
387
|
-
const t = d.find((e) => e.visible) ?? d[0], s = [];
|
|
388
|
-
if (((t == null ? void 0 : t.data) ?? []).forEach((e, T) => {
|
|
389
|
-
if (!Number.isFinite(e.value) || e.value <= 0) return;
|
|
390
|
-
const A = String(e.label ?? ""), k = rt.find((r) => A.includes(r));
|
|
391
|
-
if (!k) return;
|
|
392
|
-
const N = A.split(k), E = (N[0] ?? "").trim(), D = (N[1] ?? "").trim();
|
|
393
|
-
!E || !D || s.push({ from: E, to: D, value: e.value, index: T });
|
|
394
|
-
}), s.length === 0) return _();
|
|
395
|
-
const x = V((t == null ? void 0 : t.format) ?? "auto", c.locale), $ = parseFloat(o.labelFontSize) || 12, m = [], h = [];
|
|
396
|
-
for (const e of s)
|
|
397
|
-
m.includes(e.from) || m.push(e.from), h.includes(e.to) || h.push(e.to);
|
|
398
|
-
const F = s.reduce((e, T) => e + T.value, 0) || 1, u = F, i = Math.min(78, n.plot.width * 0.22), a = n.plot.x + i, M = Math.max(n.plot.width - i * 2, 20), g = 10, b = 4, v = n.plot.height - b * Math.max(m.length - 1, 0), I = n.plot.height - b * Math.max(h.length - 1, 0), z = (e, T) => s.filter((A) => (T === "from" ? A.from : A.to) === e).reduce((A, k) => A + k.value, 0), p = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map();
|
|
399
|
-
for (const e of m) p.set(e, Math.max(z(e, "from") / F * v, 1));
|
|
400
|
-
for (const e of h) y.set(e, Math.max(z(e, "to") / u * I, 1));
|
|
401
|
-
const w = /* @__PURE__ */ new Map();
|
|
402
|
-
let S = n.plot.y;
|
|
403
|
-
for (const e of m)
|
|
404
|
-
w.set(e, S), S += p.get(e) + b;
|
|
405
|
-
const O = /* @__PURE__ */ new Map();
|
|
406
|
-
S = n.plot.y;
|
|
407
|
-
for (const e of h)
|
|
408
|
-
O.set(e, S), S += y.get(e) + b;
|
|
409
|
-
const f = [], G = [];
|
|
410
|
-
for (const e of m)
|
|
411
|
-
f.push({
|
|
412
|
-
kind: "rect",
|
|
413
|
-
seriesIndex: t.index,
|
|
414
|
-
dataIndex: -1,
|
|
415
|
-
x: a,
|
|
416
|
-
y: w.get(e),
|
|
417
|
-
width: g,
|
|
418
|
-
height: p.get(e),
|
|
419
|
-
color: q(c, m.indexOf(e), t.color),
|
|
420
|
-
visible: !0
|
|
421
|
-
}), f.push({
|
|
422
|
-
kind: "text",
|
|
423
|
-
seriesIndex: t.index,
|
|
424
|
-
dataIndex: -1,
|
|
425
|
-
cx: a - 6,
|
|
426
|
-
cy: w.get(e) + p.get(e) / 2 + $ * 0.36,
|
|
427
|
-
color: o.text,
|
|
428
|
-
label: e,
|
|
429
|
-
textAnchor: "end",
|
|
430
|
-
fontSize: $,
|
|
431
|
-
opacity: l,
|
|
432
|
-
visible: !0
|
|
433
|
-
});
|
|
434
|
-
for (const e of h)
|
|
435
|
-
f.push({
|
|
436
|
-
kind: "rect",
|
|
437
|
-
seriesIndex: t.index,
|
|
438
|
-
dataIndex: -1,
|
|
439
|
-
x: a + M - g,
|
|
440
|
-
y: O.get(e),
|
|
441
|
-
width: g,
|
|
442
|
-
height: y.get(e),
|
|
443
|
-
color: q(c, h.indexOf(e), t.color),
|
|
444
|
-
visible: !0
|
|
445
|
-
}), f.push({
|
|
446
|
-
kind: "text",
|
|
447
|
-
seriesIndex: t.index,
|
|
448
|
-
dataIndex: -1,
|
|
449
|
-
cx: a + M + 6,
|
|
450
|
-
cy: O.get(e) + y.get(e) / 2 + $ * 0.36,
|
|
451
|
-
color: o.text,
|
|
452
|
-
label: e,
|
|
453
|
-
textAnchor: "start",
|
|
454
|
-
fontSize: $,
|
|
455
|
-
opacity: l,
|
|
456
|
-
visible: !0
|
|
457
|
-
});
|
|
458
|
-
const P = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map();
|
|
459
|
-
for (const e of m) P.set(e, w.get(e));
|
|
460
|
-
for (const e of h) Q.set(e, O.get(e));
|
|
461
|
-
for (const e of s) {
|
|
462
|
-
const T = e.value / F * v, A = e.value / u * I, k = P.get(e.from), N = Q.get(e.to);
|
|
463
|
-
P.set(e.from, k + T), Q.set(e.to, N + A);
|
|
464
|
-
const E = a + g, D = a + M - g, r = (E + D) / 2, L = `M ${E} ${k} C ${r} ${k}, ${r} ${N}, ${D} ${N} L ${D} ${N + A} C ${r} ${N + A}, ${r} ${k + T}, ${E} ${k + T} Z`, H = q(c, s.indexOf(e), t.color);
|
|
465
|
-
f.push({
|
|
466
|
-
kind: "path",
|
|
467
|
-
seriesIndex: t.index,
|
|
468
|
-
dataIndex: e.index,
|
|
469
|
-
d: L,
|
|
470
|
-
color: H,
|
|
471
|
-
fillOpacity: 0.32 * Math.max(l, 1e-3),
|
|
472
|
-
visible: !0
|
|
473
|
-
}), G.push({
|
|
474
|
-
seriesIndex: t.index,
|
|
475
|
-
dataIndex: e.index,
|
|
476
|
-
label: `${e.from} → ${e.to}`,
|
|
477
|
-
values: [
|
|
478
|
-
{ name: "流量", value: e.value, formatted: x(e.value), color: H },
|
|
479
|
-
{ name: "占来源", value: e.value, formatted: `${(e.value / (z(e.from, "from") || 1) * 100).toFixed(1)}%`, color: H }
|
|
480
|
-
],
|
|
481
|
-
x: Math.min(E, D),
|
|
482
|
-
y: Math.min(k, N),
|
|
483
|
-
w: Math.abs(D - E),
|
|
484
|
-
h: Math.max(Math.abs(N - k) + T, 1)
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
return { marks: f, gridLines: [], axes: [], legend: [], tooltipTargets: G, noData: !1 };
|
|
488
|
-
}
|
|
489
|
-
function xt(d, n, o, l, c, t) {
|
|
490
|
-
var z, p, y, w, S, O;
|
|
491
|
-
const s = d.filter((f) => f.visible);
|
|
492
|
-
if (!o || s.length < 5) return _();
|
|
493
|
-
const [x, $, m, h, F] = s.slice(0, 5), u = x.data.length;
|
|
494
|
-
if (u === 0) return _();
|
|
495
|
-
const { plot: i } = n, a = i.width / Math.max(u, 1) * 0.5, M = V(m.format ?? "auto", t.locale), g = (f) => {
|
|
496
|
-
const G = o.leftDomain[1] - o.leftDomain[0] || 1;
|
|
497
|
-
return i.y + i.height - (f - o.leftDomain[0]) / G * i.height;
|
|
498
|
-
}, b = [], v = [];
|
|
499
|
-
for (let f = 0; f < u; f++) {
|
|
500
|
-
const G = (z = x.data[f]) == null ? void 0 : z.value, P = (p = $.data[f]) == null ? void 0 : p.value, Q = (y = m.data[f]) == null ? void 0 : y.value, e = (w = h.data[f]) == null ? void 0 : w.value, T = (S = F.data[f]) == null ? void 0 : S.value;
|
|
501
|
-
if (![G, P, Q, e, T].every((B) => Number.isFinite(B))) continue;
|
|
502
|
-
const A = i.width / Math.max(u, 1), k = i.x + A * f + A / 2, N = k - a / 2, E = g(G), D = g(P), r = g(Q), L = g(e), H = g(T), W = (B) => r + (B - r) * Math.max(c, 1e-3), C = Math.min(W(D), W(L)), K = Math.abs(W(L) - W(D)), Y = q(t, 0, m.color);
|
|
503
|
-
b.push({
|
|
504
|
-
kind: "path",
|
|
505
|
-
seriesIndex: m.index,
|
|
506
|
-
dataIndex: f,
|
|
507
|
-
d: `M ${N} ${C} L ${N + a} ${C} L ${N + a} ${C + K} L ${N} ${C + K} Z`,
|
|
508
|
-
color: Y,
|
|
509
|
-
fillOpacity: 0.22,
|
|
510
|
-
strokeWidth: 1.5,
|
|
511
|
-
visible: !0
|
|
512
|
-
}), b.push({
|
|
513
|
-
kind: "path",
|
|
514
|
-
seriesIndex: m.index,
|
|
515
|
-
dataIndex: f,
|
|
516
|
-
d: `M ${N} ${W(r)} L ${N + a} ${W(r)}`,
|
|
517
|
-
color: Y,
|
|
518
|
-
strokeWidth: 2,
|
|
519
|
-
visible: !0
|
|
520
|
-
}), b.push({
|
|
521
|
-
kind: "path",
|
|
522
|
-
seriesIndex: m.index,
|
|
523
|
-
dataIndex: f,
|
|
524
|
-
d: `M ${k} ${W(H)} L ${k} ${W(L)} M ${k} ${W(D)} L ${k} ${W(E)} M ${k - a / 4} ${W(H)} L ${k + a / 4} ${W(H)} M ${k - a / 4} ${W(E)} L ${k + a / 4} ${W(E)}`,
|
|
525
|
-
color: Y,
|
|
526
|
-
strokeWidth: 1.2,
|
|
527
|
-
visible: !0
|
|
528
|
-
}), v.push({
|
|
529
|
-
seriesIndex: m.index,
|
|
530
|
-
dataIndex: f,
|
|
531
|
-
label: ((O = x.data[f]) == null ? void 0 : O.label) ?? String(f + 1),
|
|
532
|
-
values: [
|
|
533
|
-
{ name: "最大", value: T, formatted: M(T), color: Y },
|
|
534
|
-
{ name: "Q3", value: e, formatted: M(e), color: Y },
|
|
535
|
-
{ name: "中位", value: Q, formatted: M(Q), color: Y },
|
|
536
|
-
{ name: "Q1", value: P, formatted: M(P), color: Y },
|
|
537
|
-
{ name: "最小", value: G, formatted: M(G), color: Y }
|
|
538
|
-
],
|
|
539
|
-
x: N,
|
|
540
|
-
y: Math.min(W(H), W(E)),
|
|
541
|
-
w: a,
|
|
542
|
-
h: Math.max(Math.abs(W(E) - W(H)), 1)
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
if (b.length === 0) return _();
|
|
546
|
-
const I = [
|
|
547
|
-
{
|
|
548
|
-
position: "bottom",
|
|
549
|
-
kind: "category",
|
|
550
|
-
title: "",
|
|
551
|
-
ticks: n.xTicks,
|
|
552
|
-
color: l.textSecondary,
|
|
553
|
-
fontFamily: l.fontFamily,
|
|
554
|
-
fontSize: l.labelFontSize
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
position: "left",
|
|
558
|
-
kind: "value",
|
|
559
|
-
title: "",
|
|
560
|
-
ticks: n.yTicks.left,
|
|
561
|
-
color: l.textSecondary,
|
|
562
|
-
fontFamily: l.fontFamily,
|
|
563
|
-
fontSize: l.labelFontSize
|
|
564
|
-
}
|
|
565
|
-
];
|
|
566
|
-
return {
|
|
567
|
-
marks: b,
|
|
568
|
-
gridLines: n.yTicks.left.filter((f) => f.y > i.y + 0.5 && f.y < i.y + i.height - 0.5).map((f) => ({ x1: i.x, y1: f.y, x2: i.x + i.width, y2: f.y, color: l.grid })),
|
|
569
|
-
axes: I,
|
|
570
|
-
legend: [],
|
|
571
|
-
tooltipTargets: v,
|
|
572
|
-
noData: !1
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
function pt(d, n, o, l, c, t, s) {
|
|
576
|
-
switch (d) {
|
|
1
|
+
import { buildGaugeGeometry as d, buildHeatmapGeometry as y, buildFunnelGeometry as b } from "./extra-radial-grid.js";
|
|
2
|
+
import { buildBoxplotGeometry as i, buildSankeyGeometry as m, buildTreemapGeometry as G } from "./extra-flow-dist.js";
|
|
3
|
+
const l = {
|
|
4
|
+
value: "值",
|
|
5
|
+
share: "占比",
|
|
6
|
+
flow: "流量",
|
|
7
|
+
sourceShare: "占来源",
|
|
8
|
+
max: "最大",
|
|
9
|
+
median: "中位",
|
|
10
|
+
min: "最小"
|
|
11
|
+
};
|
|
12
|
+
function E(o, u, n, r, a, t, e) {
|
|
13
|
+
switch (o) {
|
|
577
14
|
case "funnel":
|
|
578
|
-
return
|
|
15
|
+
return b(u, n, a, t, e, l);
|
|
579
16
|
case "heatmap":
|
|
580
|
-
return
|
|
17
|
+
return y(u, n, a, t, e, l);
|
|
581
18
|
case "gauge":
|
|
582
|
-
return
|
|
19
|
+
return d(u, n, a, t, e, l);
|
|
583
20
|
case "treemap":
|
|
584
|
-
return
|
|
21
|
+
return G(u, n, a, t, e, l);
|
|
585
22
|
case "sankey":
|
|
586
|
-
return
|
|
23
|
+
return m(u, n, a, t, e, l);
|
|
587
24
|
case "boxplot":
|
|
588
|
-
return
|
|
25
|
+
return i(u, n, r, a, t, e, l);
|
|
589
26
|
default:
|
|
590
27
|
return null;
|
|
591
28
|
}
|
|
592
29
|
}
|
|
593
30
|
export {
|
|
594
|
-
|
|
31
|
+
E as buildExtraGeometry
|
|
595
32
|
};
|
|
596
33
|
//# sourceMappingURL=extra.js.map
|