@worm-print-platform/echarts 1.5.3 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -1
- package/dist/bind.d.ts +1 -1
- package/dist/browser/executor.iife.d.ts +1 -1
- package/dist/browser-bundle.d.ts +1 -1
- package/dist/config.d.ts +3 -1
- package/dist/constants.d.ts +5 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/echarts.d.ts +1 -1
- package/dist/echarts.js +38 -14
- package/dist/executor.iife.global.d.ts +1 -1
- package/dist/executor.iife.global.js +29 -17
- package/dist/i18n/en-US.json +153 -0
- package/dist/i18n/th-TH.json +153 -0
- package/dist/i18n/zh-CN.json +153 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -12
- package/dist/kinds.d.ts +6 -2
- package/dist/kit.cjs +2 -2
- package/dist/kit.d.ts +3 -1
- package/dist/kit.js +45 -148
- package/dist/label.d.ts +65 -0
- package/dist/marketplace.d.ts +1 -1
- package/dist/marketplace.js +1361 -126
- package/dist/node.cjs +93 -39
- package/dist/node.d.ts +1 -1
- package/dist/node.js +93 -39
- package/dist/normalize.d.ts +1 -1
- package/dist/option-utils.d.ts +1 -1
- package/dist/plugin-8R67OtBD.cjs +6 -0
- package/dist/plugin-CKyaiHYF.js +960 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/renderer.d.ts +1 -1
- package/dist/test-setup.d.ts +7 -0
- package/dist/type-augmentation.d.ts +1 -1
- package/dist/ui.cjs +1973 -87
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +1953 -86
- package/dist/units.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +29 -3
- package/dist/plugin-Bf6QDbHO.cjs +0 -6
- package/dist/plugin-CUoE2jMs.js +0 -573
package/dist/kit.js
CHANGED
|
@@ -1,154 +1,51 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/echarts v1.
|
|
2
|
+
* @worm-print-platform/echarts v1.6.1
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
|
-
*/import {
|
|
7
|
-
import { C as O, a as j, b as H, c as M, d as v, F as $, x as G, R as K, e as z, f as B, g as J, h as W, i as q, k as V, l as X, o as Q, p as Y, q as Z, r as rr, s as tr, t as er, u as ar, v as sr } from "./plugin-CUoE2jMs.js";
|
|
8
|
-
const x = [12, 20, 15];
|
|
9
|
-
function m(r) {
|
|
10
|
-
try {
|
|
11
|
-
return JSON.parse(JSON.stringify(r));
|
|
12
|
-
} catch {
|
|
13
|
-
return r;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function R(r, e) {
|
|
17
|
-
if (!e || typeof e != "object" || Array.isArray(e)) return {};
|
|
18
|
-
const t = m(e), i = C(r), a = [...D()], s = [...x], o = Array.isArray(t.series) ? t.series : [], u = (n) => {
|
|
19
|
-
for (const c of o)
|
|
20
|
-
Array.isArray(c.data) && c.data.includes("$data") && (c.data = n(c));
|
|
21
|
-
}, f = () => {
|
|
22
|
-
for (const n of ["xAxis", "yAxis"]) {
|
|
23
|
-
const c = Array.isArray(t[n]) ? t[n] : t[n] ? [t[n]] : [];
|
|
24
|
-
for (const h of c)
|
|
25
|
-
h && Array.isArray(h.data) && h.data.includes("$data") && (h.data = [...a]);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
switch (i?.seriesType) {
|
|
29
|
-
case "pie":
|
|
30
|
-
u(() => a.map((n, c) => ({ name: n, value: s[c] ?? 10 })));
|
|
31
|
-
break;
|
|
32
|
-
case "funnel":
|
|
33
|
-
u(() => a.map((n, c) => ({ name: n, value: s[c] ?? 10 })));
|
|
34
|
-
break;
|
|
35
|
-
case "scatter":
|
|
36
|
-
u(() => s.map((n) => [n, n + 6]));
|
|
37
|
-
break;
|
|
38
|
-
case "radar":
|
|
39
|
-
t.radar = {
|
|
40
|
-
...t.radar ?? {},
|
|
41
|
-
indicator: a.map((n) => ({ name: n, max: 30 }))
|
|
42
|
-
}, u(() => [{ name: "示例", value: s }]);
|
|
43
|
-
break;
|
|
44
|
-
case "gauge":
|
|
45
|
-
u(() => [{ value: s[0] ?? 40, name: "数量" }]);
|
|
46
|
-
break;
|
|
47
|
-
default:
|
|
48
|
-
u(() => [...s]), f();
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
return t;
|
|
52
|
-
}
|
|
53
|
-
function T(r, e) {
|
|
54
|
-
const t = Array.isArray(r?.color) ? (r?.color).map(String) : [];
|
|
55
|
-
return e.find((a) => a.colors.every((s, o) => s === t[o]) && t.length === a.colors.length)?.key ?? "default";
|
|
56
|
-
}
|
|
57
|
-
function b(r) {
|
|
58
|
-
return Array.isArray(r) ? r[0] && typeof r[0] == "object" ? { ...r[0] } : {} : r && typeof r == "object" ? { ...r } : {};
|
|
59
|
-
}
|
|
60
|
-
function E(r, e, t) {
|
|
61
|
-
const i = m(r), a = Array.isArray(i.series) ? i.series : [], s = C(t), o = a[0] ?? { type: s?.seriesType === "line" ? "line" : "bar", data: ["$data"] };
|
|
62
|
-
return i.series = Array.from({ length: Math.max(e, 1) }, (u, f) => ({
|
|
63
|
-
...o,
|
|
64
|
-
...a[f] ?? {},
|
|
65
|
-
data: ["$data"]
|
|
66
|
-
})), i;
|
|
67
|
-
}
|
|
68
|
-
const g = (r) => Math.round(r * 10) / 10;
|
|
69
|
-
function p(r, e) {
|
|
70
|
-
return e > 0 ? g(r / e * 100) : 0;
|
|
71
|
-
}
|
|
72
|
-
function y(r, e, t) {
|
|
73
|
-
if (typeof r == "string" && r.trim().endsWith("%")) {
|
|
74
|
-
const i = Number.parseFloat(r);
|
|
75
|
-
if (Number.isFinite(i)) return g(i);
|
|
76
|
-
}
|
|
77
|
-
return typeof r == "number" && Number.isFinite(r) ? p(r, e) : p(t, e);
|
|
78
|
-
}
|
|
79
|
-
function S(r, e, t) {
|
|
80
|
-
return Math.min(t, Math.max(e, r));
|
|
81
|
-
}
|
|
82
|
-
function A(r) {
|
|
83
|
-
return `${S(g(r), 0, 100)}%`;
|
|
84
|
-
}
|
|
85
|
-
function _(r) {
|
|
86
|
-
const t = (Array.isArray(r.series) ? r.series : [])[0];
|
|
87
|
-
return t && typeof t == "object" ? t : {};
|
|
88
|
-
}
|
|
89
|
-
function F(r, e, t) {
|
|
90
|
-
const a = _(r && typeof r == "object" ? r : {}), s = d(e), o = d(t);
|
|
91
|
-
return {
|
|
92
|
-
top: y(a.top, o, l.top),
|
|
93
|
-
right: y(a.right, s, l.right),
|
|
94
|
-
bottom: y(a.bottom, o, l.bottom),
|
|
95
|
-
left: y(a.left, s, l.left)
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
function I(r, e) {
|
|
99
|
-
const t = m(r), i = Array.isArray(t.series) ? t.series : [];
|
|
100
|
-
i.length === 0 && i.push({ type: "funnel", data: ["$data"] });
|
|
101
|
-
const a = i[0];
|
|
102
|
-
return a.top = A(e.top), a.right = A(e.right), a.bottom = A(e.bottom), a.left = A(e.left), t.series = i, t;
|
|
103
|
-
}
|
|
104
|
-
function L(r, e, t) {
|
|
105
|
-
const a = b((r && typeof r == "object" ? r : {}).radar).radius, s = Array.isArray(a) ? a[a.length - 1] : a, o = d(e), u = d(t), f = Math.min(o, u) / 2;
|
|
106
|
-
if (typeof s == "string" && s.trim().endsWith("%")) {
|
|
107
|
-
const n = Number.parseFloat(s);
|
|
108
|
-
if (Number.isFinite(n)) return g(n);
|
|
109
|
-
}
|
|
110
|
-
return typeof s == "number" && Number.isFinite(s) ? p(s, f) : P;
|
|
111
|
-
}
|
|
112
|
-
function w(r, e) {
|
|
113
|
-
const t = m(r);
|
|
114
|
-
return t.radar = { ...b(t.radar), radius: A(S(e, 20, 100)) }, t;
|
|
115
|
-
}
|
|
6
|
+
*/import { C as s, a as t, b as r, c as i, d as n, E as C, e as l, F as A, f as d, L as g, g as h, R as o, h as D, i as R, j as _, k as E, l as P, m as T, n as L, o as S, p as u, q as I, r as N, s as F, t as O, u as f, v as c, w as p, x as U, y as H, z as b, A as m, B as G, D as K, G as v, H as B, I as w, J as x, K as y, M as j, N as z, O as M, P as k } from "./plugin-CKyaiHYF.js";
|
|
116
7
|
export {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
w as
|
|
8
|
+
s as CHART_KINDS,
|
|
9
|
+
t as CHART_KIND_DEFINITIONS,
|
|
10
|
+
r as CHART_PALETTES,
|
|
11
|
+
i as CHART_PLUGIN,
|
|
12
|
+
n as CHART_PLUGIN_ID,
|
|
13
|
+
C as ECHARTS_FUNNEL_PADDING_PX,
|
|
14
|
+
l as ECHARTS_RADAR_RADIUS_DEFAULT,
|
|
15
|
+
A as FALLBACK_SAMPLE_CATEGORIES,
|
|
16
|
+
d as FUNNEL_PADDING_DEFAULTS,
|
|
17
|
+
g as LABEL_POSITIONS,
|
|
18
|
+
h as LABEL_PRESETS,
|
|
19
|
+
o as RADAR_RADIUS_DEFAULT,
|
|
20
|
+
D as asObject,
|
|
21
|
+
R as bindChartData,
|
|
22
|
+
_ as chartFactoryDefaults,
|
|
23
|
+
E as cloneChartOption,
|
|
24
|
+
P as configureChartPlugin,
|
|
25
|
+
T as createDefaultChartOption,
|
|
26
|
+
L as fitSvgRoot,
|
|
27
|
+
S as getChartKindDefinition,
|
|
28
|
+
u as getChartPalettes,
|
|
29
|
+
I as getChartPluginConfig,
|
|
30
|
+
N as getSampleCategories,
|
|
31
|
+
F as labelFieldsOf,
|
|
32
|
+
O as labelTargetOf,
|
|
33
|
+
f as mmToChartPx,
|
|
34
|
+
c as normalizeChartOption,
|
|
35
|
+
p as previewChartOption,
|
|
36
|
+
U as readChartLabel,
|
|
37
|
+
H as readFunnelPadding,
|
|
38
|
+
b as readPaletteKey,
|
|
39
|
+
m as readRadarRadius,
|
|
40
|
+
G as registerChartDesigner,
|
|
41
|
+
K as registerChartExecutorBundle,
|
|
42
|
+
v as registerChartPlugin,
|
|
43
|
+
B as renderChartElement,
|
|
44
|
+
w as renderChartToSvg,
|
|
45
|
+
x as resolveChartPanelFields,
|
|
46
|
+
y as syncSeriesCount,
|
|
47
|
+
j as uninstallChartPlugin,
|
|
48
|
+
z as updateChartLabel,
|
|
49
|
+
M as writeFunnelPadding,
|
|
50
|
+
k as writeRadarRadius
|
|
154
51
|
};
|
package/dist/label.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @worm-print-platform/echarts v1.6.1
|
|
3
|
+
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
|
+
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/
|
|
7
|
+
import type { ChartSeriesType } from './kinds.js';
|
|
8
|
+
export type LabelFieldKey = 'formatter' | 'overflow' | 'position' | 'distance' | 'rotate' | 'offset' | 'fontSize' | 'fontWeight' | 'color' | 'backgroundColor' | 'borderColor' | 'borderWidth' | 'borderRadius' | 'padding' | 'labelLine.show' | 'labelLine.length' | 'labelLine.length2' | 'labelLine.smooth';
|
|
9
|
+
export interface ChartLabelState {
|
|
10
|
+
show: boolean;
|
|
11
|
+
formatter?: string;
|
|
12
|
+
overflow?: string;
|
|
13
|
+
position?: string;
|
|
14
|
+
distance?: number;
|
|
15
|
+
rotate?: number;
|
|
16
|
+
/** ECharts 原生标签偏移 [x, y];旧模板的 offsetX / offsetY 在读取时迁移至此 */
|
|
17
|
+
offset?: [number, number];
|
|
18
|
+
fontSize?: number;
|
|
19
|
+
fontWeight?: string;
|
|
20
|
+
color?: string;
|
|
21
|
+
backgroundColor?: string;
|
|
22
|
+
borderColor?: string;
|
|
23
|
+
borderWidth?: number;
|
|
24
|
+
borderRadius?: number;
|
|
25
|
+
padding?: number;
|
|
26
|
+
labelLine: {
|
|
27
|
+
show?: boolean;
|
|
28
|
+
length?: number;
|
|
29
|
+
length2?: number;
|
|
30
|
+
smooth?: boolean;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface ChartLabelPatch extends Partial<Omit<ChartLabelState, 'labelLine'>> {
|
|
34
|
+
/** 总开关:true 写默认集(只补缺失键),false 只写 show:false */
|
|
35
|
+
enabled?: boolean;
|
|
36
|
+
labelLine?: {
|
|
37
|
+
show?: boolean;
|
|
38
|
+
length?: number | null;
|
|
39
|
+
length2?: number | null;
|
|
40
|
+
smooth?: boolean;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** formatter 预设:底层仍是 ECharts 字符串模板,选中即写入 formatter */
|
|
44
|
+
export declare const LABEL_PRESETS: readonly {
|
|
45
|
+
key: string;
|
|
46
|
+
label: string;
|
|
47
|
+
labelKey: string;
|
|
48
|
+
formatter: string;
|
|
49
|
+
}[];
|
|
50
|
+
/** 标签位置候选:按 seriesType 给,ECharts 对不适用项会忽略,面板只做引导 */
|
|
51
|
+
export declare const LABEL_POSITIONS: Readonly<Record<ChartSeriesType, readonly {
|
|
52
|
+
value: string;
|
|
53
|
+
label: string;
|
|
54
|
+
labelKey: string;
|
|
55
|
+
}[]>>;
|
|
56
|
+
/**
|
|
57
|
+
* 把单个 label / detail 上的旧 offsetX / offsetY 迁成 ECharts 原生 offset: [x, y](原地修改)。
|
|
58
|
+
* 旧键来自早期面板误写,ECharts 不识别,必须在读取、写入与出图归一三处统一迁移。
|
|
59
|
+
*/
|
|
60
|
+
export declare function normalizeLabelOffsetInPlace(target: Record<string, any>): void;
|
|
61
|
+
/** 仪表盘的数值文本走 series[].detail,其余走 series[].label */
|
|
62
|
+
export declare function labelTargetOf(type: string): 'label' | 'detail';
|
|
63
|
+
export declare function labelFieldsOf(type: string): readonly LabelFieldKey[];
|
|
64
|
+
export declare function readChartLabel(option: Record<string, unknown> | undefined, type: string): ChartLabelState;
|
|
65
|
+
export declare function updateChartLabel(option: Record<string, unknown> | undefined, type: string, patch: ChartLabelPatch): Record<string, unknown>;
|
package/dist/marketplace.d.ts
CHANGED