@worm-print-platform/echarts 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.6.0
2
+ * @worm-print-platform/echarts v1.6.2
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
@@ -37,6 +37,7 @@ var import_node_fs = require("fs");
37
37
  var import_node_url = require("url");
38
38
 
39
39
  // src/plugin.ts
40
+ var import_i18n = require("@worm-print-platform/core/i18n");
40
41
  var import_designer2 = require("@worm-print-platform/core/designer");
41
42
 
42
43
  // src/kinds.ts
@@ -47,6 +48,7 @@ var CHART_KIND_DEFINITIONS = [
47
48
  {
48
49
  type: "barChart",
49
50
  label: "\u67F1\u72B6\u56FE",
51
+ labelKey: "echarts.series.typeNames.bar",
50
52
  icon: "ChartColumn",
51
53
  seriesType: "bar",
52
54
  orientation: "vertical",
@@ -54,11 +56,13 @@ var CHART_KIND_DEFINITIONS = [
54
56
  requiredOptionKeys: BASE_REQUIRED,
55
57
  defaultWidth: 100,
56
58
  defaultHeight: 60,
57
- notes: "\u67F1\u72B6\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6BCF\u5B57\u6BB5\u4E00\u4E2A series\uFF1Bseries[].data \u5199 $data \u5360\u4F4D\uFF1B\u56FA\u5B9A\u9AD8\uFF0C\u7981\u6B62 autoHeight"
59
+ notes: "\u67F1\u72B6\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6BCF\u5B57\u6BB5\u4E00\u4E2A series\uFF1Bseries[].data \u5199 $data \u5360\u4F4D\uFF1B\u56FA\u5B9A\u9AD8\uFF0C\u7981\u6B62 autoHeight",
60
+ notesKey: "echarts.notes.bar"
58
61
  },
59
62
  {
60
63
  type: "barHChart",
61
64
  label: "\u6761\u5F62\u56FE",
65
+ labelKey: "echarts.series.typeNames.barH",
62
66
  icon: "ChartBar",
63
67
  seriesType: "bar",
64
68
  orientation: "horizontal",
@@ -66,95 +70,112 @@ var CHART_KIND_DEFINITIONS = [
66
70
  requiredOptionKeys: BASE_REQUIRED,
67
71
  defaultWidth: 100,
68
72
  defaultHeight: 60,
69
- notes: "\u6A2A\u5411\u6761\u5F62\u56FE\uFF1AxAxis \u4E3A\u6570\u503C\u3001yAxis \u4E3A\u7C7B\u76EE\uFF1B\u7C7B\u76EE\u5199 yAxis.data \u7684 $data \u5360\u4F4D"
73
+ notes: "\u6A2A\u5411\u6761\u5F62\u56FE\uFF1AxAxis \u4E3A\u6570\u503C\u3001yAxis \u4E3A\u7C7B\u76EE\uFF1B\u7C7B\u76EE\u5199 yAxis.data \u7684 $data \u5360\u4F4D",
74
+ notesKey: "echarts.notes.barH"
70
75
  },
71
76
  {
72
77
  type: "lineChart",
73
78
  label: "\u6298\u7EBF\u56FE",
79
+ labelKey: "echarts.series.typeNames.line",
74
80
  icon: "ChartLine",
75
81
  seriesType: "line",
76
82
  fields: [...DATA_FIELDS, ...STYLE_FIELDS, "stack", "label"],
77
83
  requiredOptionKeys: BASE_REQUIRED,
78
84
  defaultWidth: 100,
79
85
  defaultHeight: 60,
80
- notes: "\u6298\u7EBF\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF1B\u4E0D\u5199 areaStyle"
86
+ notes: "\u6298\u7EBF\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF1B\u4E0D\u5199 areaStyle",
87
+ notesKey: "echarts.notes.line"
81
88
  },
82
89
  {
83
90
  type: "areaChart",
84
91
  label: "\u9762\u79EF\u56FE",
92
+ labelKey: "echarts.series.typeNames.area",
85
93
  icon: "ChartArea",
86
94
  seriesType: "line",
87
95
  fields: [...DATA_FIELDS, ...STYLE_FIELDS, "stack", "label"],
88
96
  requiredOptionKeys: BASE_REQUIRED,
89
97
  defaultWidth: 100,
90
98
  defaultHeight: 60,
91
- notes: "\u9762\u79EF\u56FE\uFF1A\u6298\u7EBF + series[].areaStyle\uFF1B\u5176\u4F59\u540C\u6298\u7EBF\u56FE"
99
+ notes: "\u9762\u79EF\u56FE\uFF1A\u6298\u7EBF + series[].areaStyle\uFF1B\u5176\u4F59\u540C\u6298\u7EBF\u56FE",
100
+ notesKey: "echarts.notes.area"
92
101
  },
93
102
  {
94
103
  type: "pieChart",
95
104
  label: "\u997C\u56FE",
105
+ labelKey: "echarts.series.typeNames.pie",
96
106
  icon: "ChartPie",
97
107
  seriesType: "pie",
98
108
  fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "label"],
99
109
  requiredOptionKeys: BASE_REQUIRED,
100
110
  defaultWidth: 60,
101
111
  defaultHeight: 60,
102
- notes: "\u997C\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u751F\u6210 { name, value }\uFF1B\u53EA\u9700\u4E00\u4E2A\u6570\u503C\u5B57\u6BB5"
112
+ notes: "\u997C\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u751F\u6210 { name, value }\uFF1B\u53EA\u9700\u4E00\u4E2A\u6570\u503C\u5B57\u6BB5",
113
+ notesKey: "echarts.notes.pie"
103
114
  },
104
115
  {
105
116
  type: "doughnutChart",
106
117
  label: "\u73AF\u5F62\u56FE",
118
+ labelKey: "echarts.series.typeNames.doughnut",
107
119
  icon: "Donut",
108
120
  seriesType: "pie",
109
121
  fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "innerRadius", "label"],
110
122
  requiredOptionKeys: BASE_REQUIRED,
111
123
  defaultWidth: 60,
112
124
  defaultHeight: 60,
113
- notes: "\u73AF\u5F62\u56FE\uFF1A\u997C\u56FE + radius:[\u5185\u5F84,\u5916\u5F84]\uFF1B\u5185\u5F84\u7531\u9762\u677F\u914D\u7F6E"
125
+ notes: "\u73AF\u5F62\u56FE\uFF1A\u997C\u56FE + radius:[\u5185\u5F84,\u5916\u5F84]\uFF1B\u5185\u5F84\u7531\u9762\u677F\u914D\u7F6E",
126
+ notesKey: "echarts.notes.doughnut"
114
127
  },
115
128
  {
116
129
  type: "scatterChart",
117
130
  label: "\u6563\u70B9\u56FE",
131
+ labelKey: "echarts.series.typeNames.scatter",
118
132
  icon: "ChartScatter",
119
133
  seriesType: "scatter",
120
134
  fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "bubble", "label"],
121
135
  requiredOptionKeys: BASE_REQUIRED,
122
136
  defaultWidth: 80,
123
137
  defaultHeight: 60,
124
- notes: "\u6563\u70B9\u56FE\uFF1A\u7C7B\u76EE\u5B57\u6BB5\u4F5C x\u3001\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C y\uFF1BchartBubble \u5F00\u542F\u65F6\u7528\u7B2C\u4E8C\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u70B9\u5927\u5C0F"
138
+ notes: "\u6563\u70B9\u56FE\uFF1A\u7C7B\u76EE\u5B57\u6BB5\u4F5C x\u3001\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C y\uFF1BchartBubble \u5F00\u542F\u65F6\u7528\u7B2C\u4E8C\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u70B9\u5927\u5C0F",
139
+ notesKey: "echarts.notes.scatter"
125
140
  },
126
141
  {
127
142
  type: "radarChart",
128
143
  label: "\u96F7\u8FBE\u56FE",
144
+ labelKey: "echarts.series.typeNames.radar",
129
145
  icon: "Radar",
130
146
  seriesType: "radar",
131
147
  fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "radius", "label"],
132
148
  requiredOptionKeys: BASE_REQUIRED,
133
149
  defaultWidth: 70,
134
150
  defaultHeight: 60,
135
- notes: "\u96F7\u8FBE\u56FE\uFF1A\u6BCF\u4E2A\u6570\u503C\u5B57\u6BB5\u662F\u4E00\u4E2A\u7EF4\u5EA6\uFF08radar.indicator\uFF09\uFF0C\u6BCF\u884C\u6570\u636E\u662F\u4E00\u4E2A\u7CFB\u5217\uFF08\u7C7B\u76EE\u5B57\u6BB5\u4F5C\u7CFB\u5217\u540D\uFF09\uFF1B\u534A\u5F84\u7531\u9762\u677F\u5199 radar.radius\uFF08%\uFF0C\u9ED8\u8BA4 75\uFF09"
151
+ notes: "\u96F7\u8FBE\u56FE\uFF1A\u6BCF\u4E2A\u6570\u503C\u5B57\u6BB5\u662F\u4E00\u4E2A\u7EF4\u5EA6\uFF08radar.indicator\uFF09\uFF0C\u6BCF\u884C\u6570\u636E\u662F\u4E00\u4E2A\u7CFB\u5217\uFF08\u7C7B\u76EE\u5B57\u6BB5\u4F5C\u7CFB\u5217\u540D\uFF09\uFF1B\u534A\u5F84\u7531\u9762\u677F\u5199 radar.radius\uFF08%\uFF0C\u9ED8\u8BA4 75\uFF09",
152
+ notesKey: "echarts.notes.radar"
136
153
  },
137
154
  {
138
155
  type: "funnelChart",
139
156
  label: "\u6F0F\u6597\u56FE",
157
+ labelKey: "echarts.series.typeNames.funnel",
140
158
  icon: "Funnel",
141
159
  seriesType: "funnel",
142
160
  fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "padding", "label"],
143
161
  requiredOptionKeys: BASE_REQUIRED,
144
162
  defaultWidth: 60,
145
163
  defaultHeight: 60,
146
- notes: "\u6F0F\u6597\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6309\u6570\u503C\u964D\u5E8F\uFF1B\u56DB\u8FB9\u5185\u8FB9\u8DDD\u7531\u9762\u677F\u5199 series.left/right/top/bottom\uFF08%\uFF0C\u53F3\u4FA7\u9700\u7559\u5916\u7F6E\u6807\u7B7E\u7A7A\u95F4\uFF09"
164
+ notes: "\u6F0F\u6597\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6309\u6570\u503C\u964D\u5E8F\uFF1B\u56DB\u8FB9\u5185\u8FB9\u8DDD\u7531\u9762\u677F\u5199 series.left/right/top/bottom\uFF08%\uFF0C\u53F3\u4FA7\u9700\u7559\u5916\u7F6E\u6807\u7B7E\u7A7A\u95F4\uFF09",
165
+ notesKey: "echarts.notes.funnel"
147
166
  },
148
167
  {
149
168
  type: "gaugeChart",
150
169
  label: "\u4EEA\u8868\u76D8",
170
+ labelKey: "echarts.series.typeNames.gauge",
151
171
  icon: "Gauge",
152
172
  seriesType: "gauge",
153
173
  fields: ["dataSource", "valueFields", ...STYLE_FIELDS, "gaugeRange", "label"],
154
174
  requiredOptionKeys: BASE_REQUIRED,
155
175
  defaultWidth: 60,
156
176
  defaultHeight: 60,
157
- notes: "\u4EEA\u8868\u76D8\uFF1A\u53D6\u9996\u884C\u6570\u636E\u7684\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u6307\u9488\u503C\uFF1Bmin/max \u7531\u9762\u677F\u5199\u5165 series[0].min/max"
177
+ notes: "\u4EEA\u8868\u76D8\uFF1A\u53D6\u9996\u884C\u6570\u636E\u7684\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u6307\u9488\u503C\uFF1Bmin/max \u7531\u9762\u677F\u5199\u5165 series[0].min/max",
178
+ notesKey: "echarts.notes.gauge"
158
179
  }
159
180
  ];
160
181
  var CHART_KINDS = CHART_KIND_DEFINITIONS.map((def) => def.type);
@@ -635,26 +656,32 @@ var CHART_EXECUTOR_VERSION = "2";
635
656
 
636
657
  // src/plugin.ts
637
658
  var CHART_OPTION_META = {
638
- chartOption: { kind: "object", label: "\u56FE\u8868 option" },
639
- chartDataSource: { kind: "text", label: "\u6570\u636E\u6E90" },
640
- chartCategoryField: { kind: "text", label: "\u7C7B\u76EE\u5B57\u6BB5" },
641
- chartValueFields: { kind: "object", label: "\u6570\u503C\u5B57\u6BB5" },
642
- chartSeriesField: { kind: "text", label: "\u7CFB\u5217\u62C6\u5206\u5B57\u6BB5" }
659
+ chartOption: { kind: "object", label: (0, import_i18n.t)("echarts.meta.chartOption") },
660
+ chartDataSource: { kind: "text", label: (0, import_i18n.t)("echarts.meta.dataSource") },
661
+ chartCategoryField: { kind: "text", label: (0, import_i18n.t)("echarts.meta.categoryField") },
662
+ chartValueFields: { kind: "object", label: (0, import_i18n.t)("echarts.meta.valueFields") },
663
+ chartSeriesField: { kind: "text", label: (0, import_i18n.t)("echarts.meta.seriesField") }
643
664
  };
644
665
  var SCATTER_OPTION_META = {
645
666
  ...CHART_OPTION_META,
646
- chartBubble: { kind: "bool", label: "\u6C14\u6CE1\u5927\u5C0F" }
667
+ chartBubble: { kind: "bool", label: (0, import_i18n.t)("echarts.meta.bubbleSize") }
647
668
  };
648
669
  var CHART_PLUGIN = (0, import_designer2.defineElementPlugin)({
649
670
  id: CHART_PLUGIN_ID,
650
671
  version: CHART_EXECUTOR_VERSION,
651
672
  kinds: CHART_KIND_DEFINITIONS.map((def) => ({
652
673
  type: def.type,
653
- label: def.label,
674
+ // getter:每次读取按当前实例语言取词,避免模块加载期冻结为单一语言
675
+ get label() {
676
+ return (0, import_i18n.t)(def.labelKey);
677
+ },
654
678
  icon: def.icon,
655
679
  fixedHeight: true,
656
680
  requiredOptionKeys: def.requiredOptionKeys,
657
- notes: def.notes,
681
+ // getter:每次读取按当前实例语言取词,避免模块加载期冻结为单一语言
682
+ get notes() {
683
+ return (0, import_i18n.t)(def.notesKey);
684
+ },
658
685
  optionMeta: def.type === "scatterChart" ? SCATTER_OPTION_META : CHART_OPTION_META,
659
686
  defaultOptions: (partial) => chartFactoryDefaults(def.type, partial),
660
687
  binding: { bind: (options, data) => bindChartData(def.type, options, data) }
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.6.0
2
+ * @worm-print-platform/echarts v1.6.2
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
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.6.0
2
+ * @worm-print-platform/echarts v1.6.2
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
@@ -10,6 +10,7 @@ import { readFileSync } from "fs";
10
10
  import { fileURLToPath } from "url";
11
11
 
12
12
  // src/plugin.ts
13
+ import { t } from "@worm-print-platform/core/i18n";
13
14
  import {
14
15
  defineElementPlugin,
15
16
  getElementPluginById,
@@ -24,6 +25,7 @@ var CHART_KIND_DEFINITIONS = [
24
25
  {
25
26
  type: "barChart",
26
27
  label: "\u67F1\u72B6\u56FE",
28
+ labelKey: "echarts.series.typeNames.bar",
27
29
  icon: "ChartColumn",
28
30
  seriesType: "bar",
29
31
  orientation: "vertical",
@@ -31,11 +33,13 @@ var CHART_KIND_DEFINITIONS = [
31
33
  requiredOptionKeys: BASE_REQUIRED,
32
34
  defaultWidth: 100,
33
35
  defaultHeight: 60,
34
- notes: "\u67F1\u72B6\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6BCF\u5B57\u6BB5\u4E00\u4E2A series\uFF1Bseries[].data \u5199 $data \u5360\u4F4D\uFF1B\u56FA\u5B9A\u9AD8\uFF0C\u7981\u6B62 autoHeight"
36
+ notes: "\u67F1\u72B6\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6BCF\u5B57\u6BB5\u4E00\u4E2A series\uFF1Bseries[].data \u5199 $data \u5360\u4F4D\uFF1B\u56FA\u5B9A\u9AD8\uFF0C\u7981\u6B62 autoHeight",
37
+ notesKey: "echarts.notes.bar"
35
38
  },
36
39
  {
37
40
  type: "barHChart",
38
41
  label: "\u6761\u5F62\u56FE",
42
+ labelKey: "echarts.series.typeNames.barH",
39
43
  icon: "ChartBar",
40
44
  seriesType: "bar",
41
45
  orientation: "horizontal",
@@ -43,95 +47,112 @@ var CHART_KIND_DEFINITIONS = [
43
47
  requiredOptionKeys: BASE_REQUIRED,
44
48
  defaultWidth: 100,
45
49
  defaultHeight: 60,
46
- notes: "\u6A2A\u5411\u6761\u5F62\u56FE\uFF1AxAxis \u4E3A\u6570\u503C\u3001yAxis \u4E3A\u7C7B\u76EE\uFF1B\u7C7B\u76EE\u5199 yAxis.data \u7684 $data \u5360\u4F4D"
50
+ notes: "\u6A2A\u5411\u6761\u5F62\u56FE\uFF1AxAxis \u4E3A\u6570\u503C\u3001yAxis \u4E3A\u7C7B\u76EE\uFF1B\u7C7B\u76EE\u5199 yAxis.data \u7684 $data \u5360\u4F4D",
51
+ notesKey: "echarts.notes.barH"
47
52
  },
48
53
  {
49
54
  type: "lineChart",
50
55
  label: "\u6298\u7EBF\u56FE",
56
+ labelKey: "echarts.series.typeNames.line",
51
57
  icon: "ChartLine",
52
58
  seriesType: "line",
53
59
  fields: [...DATA_FIELDS, ...STYLE_FIELDS, "stack", "label"],
54
60
  requiredOptionKeys: BASE_REQUIRED,
55
61
  defaultWidth: 100,
56
62
  defaultHeight: 60,
57
- notes: "\u6298\u7EBF\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF1B\u4E0D\u5199 areaStyle"
63
+ notes: "\u6298\u7EBF\u56FE\uFF1A\u7C7B\u76EE + \u591A\u4E2A\u6570\u503C\u5B57\u6BB5\uFF1B\u4E0D\u5199 areaStyle",
64
+ notesKey: "echarts.notes.line"
58
65
  },
59
66
  {
60
67
  type: "areaChart",
61
68
  label: "\u9762\u79EF\u56FE",
69
+ labelKey: "echarts.series.typeNames.area",
62
70
  icon: "ChartArea",
63
71
  seriesType: "line",
64
72
  fields: [...DATA_FIELDS, ...STYLE_FIELDS, "stack", "label"],
65
73
  requiredOptionKeys: BASE_REQUIRED,
66
74
  defaultWidth: 100,
67
75
  defaultHeight: 60,
68
- notes: "\u9762\u79EF\u56FE\uFF1A\u6298\u7EBF + series[].areaStyle\uFF1B\u5176\u4F59\u540C\u6298\u7EBF\u56FE"
76
+ notes: "\u9762\u79EF\u56FE\uFF1A\u6298\u7EBF + series[].areaStyle\uFF1B\u5176\u4F59\u540C\u6298\u7EBF\u56FE",
77
+ notesKey: "echarts.notes.area"
69
78
  },
70
79
  {
71
80
  type: "pieChart",
72
81
  label: "\u997C\u56FE",
82
+ labelKey: "echarts.series.typeNames.pie",
73
83
  icon: "ChartPie",
74
84
  seriesType: "pie",
75
85
  fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "label"],
76
86
  requiredOptionKeys: BASE_REQUIRED,
77
87
  defaultWidth: 60,
78
88
  defaultHeight: 60,
79
- notes: "\u997C\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u751F\u6210 { name, value }\uFF1B\u53EA\u9700\u4E00\u4E2A\u6570\u503C\u5B57\u6BB5"
89
+ notes: "\u997C\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u751F\u6210 { name, value }\uFF1B\u53EA\u9700\u4E00\u4E2A\u6570\u503C\u5B57\u6BB5",
90
+ notesKey: "echarts.notes.pie"
80
91
  },
81
92
  {
82
93
  type: "doughnutChart",
83
94
  label: "\u73AF\u5F62\u56FE",
95
+ labelKey: "echarts.series.typeNames.doughnut",
84
96
  icon: "Donut",
85
97
  seriesType: "pie",
86
98
  fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "innerRadius", "label"],
87
99
  requiredOptionKeys: BASE_REQUIRED,
88
100
  defaultWidth: 60,
89
101
  defaultHeight: 60,
90
- notes: "\u73AF\u5F62\u56FE\uFF1A\u997C\u56FE + radius:[\u5185\u5F84,\u5916\u5F84]\uFF1B\u5185\u5F84\u7531\u9762\u677F\u914D\u7F6E"
102
+ notes: "\u73AF\u5F62\u56FE\uFF1A\u997C\u56FE + radius:[\u5185\u5F84,\u5916\u5F84]\uFF1B\u5185\u5F84\u7531\u9762\u677F\u914D\u7F6E",
103
+ notesKey: "echarts.notes.doughnut"
91
104
  },
92
105
  {
93
106
  type: "scatterChart",
94
107
  label: "\u6563\u70B9\u56FE",
108
+ labelKey: "echarts.series.typeNames.scatter",
95
109
  icon: "ChartScatter",
96
110
  seriesType: "scatter",
97
111
  fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "bubble", "label"],
98
112
  requiredOptionKeys: BASE_REQUIRED,
99
113
  defaultWidth: 80,
100
114
  defaultHeight: 60,
101
- notes: "\u6563\u70B9\u56FE\uFF1A\u7C7B\u76EE\u5B57\u6BB5\u4F5C x\u3001\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C y\uFF1BchartBubble \u5F00\u542F\u65F6\u7528\u7B2C\u4E8C\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u70B9\u5927\u5C0F"
115
+ notes: "\u6563\u70B9\u56FE\uFF1A\u7C7B\u76EE\u5B57\u6BB5\u4F5C x\u3001\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C y\uFF1BchartBubble \u5F00\u542F\u65F6\u7528\u7B2C\u4E8C\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u70B9\u5927\u5C0F",
116
+ notesKey: "echarts.notes.scatter"
102
117
  },
103
118
  {
104
119
  type: "radarChart",
105
120
  label: "\u96F7\u8FBE\u56FE",
121
+ labelKey: "echarts.series.typeNames.radar",
106
122
  icon: "Radar",
107
123
  seriesType: "radar",
108
124
  fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "radius", "label"],
109
125
  requiredOptionKeys: BASE_REQUIRED,
110
126
  defaultWidth: 70,
111
127
  defaultHeight: 60,
112
- notes: "\u96F7\u8FBE\u56FE\uFF1A\u6BCF\u4E2A\u6570\u503C\u5B57\u6BB5\u662F\u4E00\u4E2A\u7EF4\u5EA6\uFF08radar.indicator\uFF09\uFF0C\u6BCF\u884C\u6570\u636E\u662F\u4E00\u4E2A\u7CFB\u5217\uFF08\u7C7B\u76EE\u5B57\u6BB5\u4F5C\u7CFB\u5217\u540D\uFF09\uFF1B\u534A\u5F84\u7531\u9762\u677F\u5199 radar.radius\uFF08%\uFF0C\u9ED8\u8BA4 75\uFF09"
128
+ notes: "\u96F7\u8FBE\u56FE\uFF1A\u6BCF\u4E2A\u6570\u503C\u5B57\u6BB5\u662F\u4E00\u4E2A\u7EF4\u5EA6\uFF08radar.indicator\uFF09\uFF0C\u6BCF\u884C\u6570\u636E\u662F\u4E00\u4E2A\u7CFB\u5217\uFF08\u7C7B\u76EE\u5B57\u6BB5\u4F5C\u7CFB\u5217\u540D\uFF09\uFF1B\u534A\u5F84\u7531\u9762\u677F\u5199 radar.radius\uFF08%\uFF0C\u9ED8\u8BA4 75\uFF09",
129
+ notesKey: "echarts.notes.radar"
113
130
  },
114
131
  {
115
132
  type: "funnelChart",
116
133
  label: "\u6F0F\u6597\u56FE",
134
+ labelKey: "echarts.series.typeNames.funnel",
117
135
  icon: "Funnel",
118
136
  seriesType: "funnel",
119
137
  fields: ["dataSource", "categoryField", "valueFields", ...STYLE_FIELDS, "padding", "label"],
120
138
  requiredOptionKeys: BASE_REQUIRED,
121
139
  defaultWidth: 60,
122
140
  defaultHeight: 60,
123
- notes: "\u6F0F\u6597\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6309\u6570\u503C\u964D\u5E8F\uFF1B\u56DB\u8FB9\u5185\u8FB9\u8DDD\u7531\u9762\u677F\u5199 series.left/right/top/bottom\uFF08%\uFF0C\u53F3\u4FA7\u9700\u7559\u5916\u7F6E\u6807\u7B7E\u7A7A\u95F4\uFF09"
141
+ notes: "\u6F0F\u6597\u56FE\uFF1A\u7C7B\u76EE + \u9996\u4E2A\u6570\u503C\u5B57\u6BB5\uFF0C\u6309\u6570\u503C\u964D\u5E8F\uFF1B\u56DB\u8FB9\u5185\u8FB9\u8DDD\u7531\u9762\u677F\u5199 series.left/right/top/bottom\uFF08%\uFF0C\u53F3\u4FA7\u9700\u7559\u5916\u7F6E\u6807\u7B7E\u7A7A\u95F4\uFF09",
142
+ notesKey: "echarts.notes.funnel"
124
143
  },
125
144
  {
126
145
  type: "gaugeChart",
127
146
  label: "\u4EEA\u8868\u76D8",
147
+ labelKey: "echarts.series.typeNames.gauge",
128
148
  icon: "Gauge",
129
149
  seriesType: "gauge",
130
150
  fields: ["dataSource", "valueFields", ...STYLE_FIELDS, "gaugeRange", "label"],
131
151
  requiredOptionKeys: BASE_REQUIRED,
132
152
  defaultWidth: 60,
133
153
  defaultHeight: 60,
134
- notes: "\u4EEA\u8868\u76D8\uFF1A\u53D6\u9996\u884C\u6570\u636E\u7684\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u6307\u9488\u503C\uFF1Bmin/max \u7531\u9762\u677F\u5199\u5165 series[0].min/max"
154
+ notes: "\u4EEA\u8868\u76D8\uFF1A\u53D6\u9996\u884C\u6570\u636E\u7684\u9996\u4E2A\u6570\u503C\u5B57\u6BB5\u4F5C\u6307\u9488\u503C\uFF1Bmin/max \u7531\u9762\u677F\u5199\u5165 series[0].min/max",
155
+ notesKey: "echarts.notes.gauge"
135
156
  }
136
157
  ];
137
158
  var CHART_KINDS = CHART_KIND_DEFINITIONS.map((def) => def.type);
@@ -618,26 +639,32 @@ var CHART_EXECUTOR_VERSION = "2";
618
639
 
619
640
  // src/plugin.ts
620
641
  var CHART_OPTION_META = {
621
- chartOption: { kind: "object", label: "\u56FE\u8868 option" },
622
- chartDataSource: { kind: "text", label: "\u6570\u636E\u6E90" },
623
- chartCategoryField: { kind: "text", label: "\u7C7B\u76EE\u5B57\u6BB5" },
624
- chartValueFields: { kind: "object", label: "\u6570\u503C\u5B57\u6BB5" },
625
- chartSeriesField: { kind: "text", label: "\u7CFB\u5217\u62C6\u5206\u5B57\u6BB5" }
642
+ chartOption: { kind: "object", label: t("echarts.meta.chartOption") },
643
+ chartDataSource: { kind: "text", label: t("echarts.meta.dataSource") },
644
+ chartCategoryField: { kind: "text", label: t("echarts.meta.categoryField") },
645
+ chartValueFields: { kind: "object", label: t("echarts.meta.valueFields") },
646
+ chartSeriesField: { kind: "text", label: t("echarts.meta.seriesField") }
626
647
  };
627
648
  var SCATTER_OPTION_META = {
628
649
  ...CHART_OPTION_META,
629
- chartBubble: { kind: "bool", label: "\u6C14\u6CE1\u5927\u5C0F" }
650
+ chartBubble: { kind: "bool", label: t("echarts.meta.bubbleSize") }
630
651
  };
631
652
  var CHART_PLUGIN = defineElementPlugin({
632
653
  id: CHART_PLUGIN_ID,
633
654
  version: CHART_EXECUTOR_VERSION,
634
655
  kinds: CHART_KIND_DEFINITIONS.map((def) => ({
635
656
  type: def.type,
636
- label: def.label,
657
+ // getter:每次读取按当前实例语言取词,避免模块加载期冻结为单一语言
658
+ get label() {
659
+ return t(def.labelKey);
660
+ },
637
661
  icon: def.icon,
638
662
  fixedHeight: true,
639
663
  requiredOptionKeys: def.requiredOptionKeys,
640
- notes: def.notes,
664
+ // getter:每次读取按当前实例语言取词,避免模块加载期冻结为单一语言
665
+ get notes() {
666
+ return t(def.notesKey);
667
+ },
641
668
  optionMeta: def.type === "scatterChart" ? SCATTER_OPTION_META : CHART_OPTION_META,
642
669
  defaultOptions: (partial) => chartFactoryDefaults(def.type, partial),
643
670
  binding: { bind: (options, data) => bindChartData(def.type, options, data) }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.6.0
2
+ * @worm-print-platform/echarts v1.6.2
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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.6.0
2
+ * @worm-print-platform/echarts v1.6.2
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
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * @worm-print-platform/echarts v1.6.2
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
+ */"use strict";const A=require("@worm-print-platform/core/i18n"),x=require("@worm-print-platform/core/designer"),be=require("@worm-print-platform/core"),S=require("echarts/charts"),v=require("echarts/components"),he=require("echarts/core"),pe=require("echarts/renderers");function ge(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const B=ge(he),p=["left","top","width","height","chartOption"],P=["dataSource","categoryField","valueFields","seriesField"],g=["title","legend","palette"],I=[{type:"barChart",label:"柱状图",labelKey:"echarts.series.typeNames.bar",icon:"ChartColumn",seriesType:"bar",orientation:"vertical",fields:[...P,...g,"stack","label"],requiredOptionKeys:p,defaultWidth:100,defaultHeight:60,notes:"柱状图:类目 + 多个数值字段,每字段一个 series;series[].data 写 $data 占位;固定高,禁止 autoHeight",notesKey:"echarts.notes.bar"},{type:"barHChart",label:"条形图",labelKey:"echarts.series.typeNames.barH",icon:"ChartBar",seriesType:"bar",orientation:"horizontal",fields:[...P,...g,"stack","label"],requiredOptionKeys:p,defaultWidth:100,defaultHeight:60,notes:"横向条形图:xAxis 为数值、yAxis 为类目;类目写 yAxis.data 的 $data 占位",notesKey:"echarts.notes.barH"},{type:"lineChart",label:"折线图",labelKey:"echarts.series.typeNames.line",icon:"ChartLine",seriesType:"line",fields:[...P,...g,"stack","label"],requiredOptionKeys:p,defaultWidth:100,defaultHeight:60,notes:"折线图:类目 + 多个数值字段;不写 areaStyle",notesKey:"echarts.notes.line"},{type:"areaChart",label:"面积图",labelKey:"echarts.series.typeNames.area",icon:"ChartArea",seriesType:"line",fields:[...P,...g,"stack","label"],requiredOptionKeys:p,defaultWidth:100,defaultHeight:60,notes:"面积图:折线 + series[].areaStyle;其余同折线图",notesKey:"echarts.notes.area"},{type:"pieChart",label:"饼图",labelKey:"echarts.series.typeNames.pie",icon:"ChartPie",seriesType:"pie",fields:["dataSource","categoryField","valueFields",...g,"label"],requiredOptionKeys:p,defaultWidth:60,defaultHeight:60,notes:"饼图:类目 + 首个数值字段生成 { name, value };只需一个数值字段",notesKey:"echarts.notes.pie"},{type:"doughnutChart",label:"环形图",labelKey:"echarts.series.typeNames.doughnut",icon:"Donut",seriesType:"pie",fields:["dataSource","categoryField","valueFields",...g,"innerRadius","label"],requiredOptionKeys:p,defaultWidth:60,defaultHeight:60,notes:"环形图:饼图 + radius:[内径,外径];内径由面板配置",notesKey:"echarts.notes.doughnut"},{type:"scatterChart",label:"散点图",labelKey:"echarts.series.typeNames.scatter",icon:"ChartScatter",seriesType:"scatter",fields:["dataSource","categoryField","valueFields",...g,"bubble","label"],requiredOptionKeys:p,defaultWidth:80,defaultHeight:60,notes:"散点图:类目字段作 x、首个数值字段作 y;chartBubble 开启时用第二个数值字段作点大小",notesKey:"echarts.notes.scatter"},{type:"radarChart",label:"雷达图",labelKey:"echarts.series.typeNames.radar",icon:"Radar",seriesType:"radar",fields:["dataSource","categoryField","valueFields",...g,"radius","label"],requiredOptionKeys:p,defaultWidth:70,defaultHeight:60,notes:"雷达图:每个数值字段是一个维度(radar.indicator),每行数据是一个系列(类目字段作系列名);半径由面板写 radar.radius(%,默认 75)",notesKey:"echarts.notes.radar"},{type:"funnelChart",label:"漏斗图",labelKey:"echarts.series.typeNames.funnel",icon:"Funnel",seriesType:"funnel",fields:["dataSource","categoryField","valueFields",...g,"padding","label"],requiredOptionKeys:p,defaultWidth:60,defaultHeight:60,notes:"漏斗图:类目 + 首个数值字段,按数值降序;四边内边距由面板写 series.left/right/top/bottom(%,右侧需留外置标签空间)",notesKey:"echarts.notes.funnel"},{type:"gaugeChart",label:"仪表盘",labelKey:"echarts.series.typeNames.gauge",icon:"Gauge",seriesType:"gauge",fields:["dataSource","valueFields",...g,"gaugeRange","label"],requiredOptionKeys:p,defaultWidth:60,defaultHeight:60,notes:"仪表盘:取首行数据的首个数值字段作指针值;min/max 由面板写入 series[0].min/max",notesKey:"echarts.notes.gauge"}],me=I.map(e=>e.type);function b(e){return I.find(t=>t.type===e)}function Ae(e){return b(e)?.fields??[]}function Se(e){const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:0}function z(e,t,r=!1){if(typeof e=="string")return e.startsWith("$data")||r?e:e.includes("{")?be.evaluateTemplate(e,t):e;if(Array.isArray(e))return e.map(a=>z(a,t,r));if(e&&typeof e=="object"){const a={};for(const[i,n]of Object.entries(e)){const o=r||i==="label"||i==="detail";a[i]=z(n,t,o)}return a}return e}function K(e){return Array.isArray(e.data)&&e.data.includes("$data")}function Ce(e,t){const r=e.dataSource;if(typeof r=="string"&&Array.isArray(t[r]))return t[r];for(const a of Object.values(t))if(Array.isArray(a))return a;return[]}function X(e){return typeof e=="string"&&e.length>0?e:void 0}function xe(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function F(e){return Array.isArray(e.series)?e.series:[]}function m(e,t){return t?Se(e[t]):0}function Y(e,t){for(const r of["xAxis","yAxis"]){const a=e[r],i=Array.isArray(a)?a:a?[a]:[];for(const n of i)n&&typeof n=="object"&&Array.isArray(n.data)&&n.data.includes("$data")&&(n.data=[...t])}}function Ke(e,t,r,a,i){const n=F(e);if(!n.some(K))return;const o=t.map((c,u)=>r?c[r]:u+1),l=c=>a[Math.min(c,a.length-1)];if(i){const c=n[0],u=new Map;for(const d of t){const y=String(d[i]??""),h=u.get(y)??new Map,V=String(d[r??""]);h.set(V,(h.get(V)??0)+m(d,l(0))),u.set(y,h)}const f=[...new Set(o)];e.series=[...u.entries()].map(([d,y])=>({...c,name:d,data:f.map(h=>y.get(String(h))??null)})),Y(e,f);return}const s=n[n.length-1];for(;n.length<a.length;)n.push({...s,data:["$data"]});e.series=n.map((c,u)=>K(c)?{...c,data:t.map(f=>m(f,l(u)))}:c),Y(e,o)}function J(e,t,r,a,i){const n=F(e);if(!n.some(K))return;const o=t.map(l=>({name:r?String(l[r]??""):"",value:m(l,a)}));i&&o.sort((l,s)=>s.value-l.value),e.series=n.map(l=>({...l,data:o}))}function Te(e,t,r,a,i){const n=F(e);if(!n.some(K))return;const o=a[0],l=i?a[1]:void 0,s=l?t.map(d=>m(d,l)):[],c=s.length>0?Math.min(...s):0,u=s.length>0?Math.max(...s):0,f=d=>u===c?12:Math.round(6+(d-c)/(u-c)*18);e.series=n.map(d=>({...d,data:t.map(y=>{const h=[m(y,r),m(y,o)];return l?{value:h,symbolSize:f(m(y,l))}:h})}))}function ve(e){if(e<=0)return 10;const t=10**Math.floor(Math.log10(e)),r=t>=10?t:10;return Math.ceil(e/r)*r}function Oe(e,t,r,a){const i=F(e);if(!i.some(K))return;const n=a.map(o=>Math.max(0,...t.map(l=>m(l,o))));e.radar={...e.radar??{},indicator:a.map((o,l)=>({name:o,max:ve(n[l])}))},e.series=i.map(o=>({...o,data:t.map(l=>({name:r?String(l[r]??""):"",value:a.map(s=>m(l,s))}))}))}function Ee(e,t,r){const a=F(e);if(!a.some(K))return;const i=t[0]??{};e.series=a.map(n=>({...n,data:[{value:m(i,r),name:r}]}))}function te(e,t,r){const a=t.chartOption;if(!a||typeof a!="object"||Array.isArray(a))return{};const i=z(a,r),n=xe(t.chartValueFields);if(n.length===0)return{_chartOption:i};const o=Ce({...t,dataSource:t.chartDataSource??t.dataSource},r);if(o.length===0)return{_chartOption:i};const l=X(t.chartCategoryField);switch(b(e)?.seriesType){case"radar":Oe(i,o,l,n);break;case"gauge":Ee(i,o,n[0]);break;case"funnel":J(i,o,l,n[0],!0);break;case"pie":J(i,o,l,n[0],!1);break;case"scatter":Te(i,o,l,n,t.chartBubble===!0);break;default:Ke(i,o,l,n,X(t.chartSeriesField));break}return{_chartOption:i}}const L="@worm-print-platform/echarts",$=[{key:"default",label:"默认蓝",labelKey:"echarts.palette.default",colors:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de"]},{key:"fresh",label:"清新绿",labelKey:"echarts.palette.fresh",colors:["#2f9e6e","#5cc9a7","#9ad6c1","#f2c94c","#4a90e2"]},{key:"warm",label:"暖橙红",labelKey:"echarts.palette.warm",colors:["#f2704e","#f7a35c","#f7d56d","#c54e3f","#8f5a4a"]},{key:"purple",label:"紫灰",labelKey:"echarts.palette.purple",colors:["#7b61ff","#9b8cff","#c3baff","#596275","#8d99ae"]}],re=["示例一","示例二","示例三"],ae={top:6,right:25,bottom:6,left:5},ie=75,ne=50,O={top:60,right:80,bottom:65,left:80},Q={left:"8%",right:"8%",bottom:"12%",top:"18%",containLabel:!0};function _e(e){return{top:`${e.top}%`,right:`${e.right}%`,bottom:`${e.bottom}%`,left:`${e.left}%`}}function se(e){const t=b(e),r={text:""};switch(t?.seriesType){case"pie":return{title:r,tooltip:{trigger:"item"},series:[{type:"pie",name:"数量",data:["$data"],radius:e==="doughnutChart"?["40%","70%"]:"62%"}]};case"scatter":return{title:r,grid:Q,tooltip:{trigger:"axis"},xAxis:{type:"value"},yAxis:{type:"value"},series:[{type:"scatter",name:"数量",data:["$data"],symbolSize:8}]};case"radar":return{title:r,tooltip:{trigger:"item"},radar:{indicator:[],radius:`${ie}%`},series:[{type:"radar",name:"数量",data:["$data"]}]};case"funnel":return{title:r,tooltip:{trigger:"item"},legend:{show:!1},series:[{type:"funnel",name:"数量",data:["$data"],sort:"descending",..._e(ae)}]};case"gauge":return{title:r,tooltip:{trigger:"item"},series:[{type:"gauge",name:"数量",min:0,max:100,data:[{value:0,name:"数量"}]}]};default:{const a=t?.orientation==="horizontal",i=t?.seriesType==="line"&&e==="areaChart",n=t?.seriesType==="line"?"line":"bar";return{title:r,grid:Q,tooltip:{trigger:"axis"},xAxis:a?{type:"value"}:{type:"category",data:["$data"]},yAxis:a?{type:"category",data:["$data"]}:{type:"value"},series:[{type:n,name:"数量",data:["$data"],...i?{areaStyle:{}}:{}}]}}}}function Fe(e){x.configurePlugin(L,e)}function R(){return x.getPluginConfig(L)}function Le(){const e=R().palettes??{},t=$.map(a=>{const i=e[a.key];return i?{key:a.key,label:i.label??a.label,labelKey:i.label?void 0:a.labelKey,colors:i.colors}:{key:a.key,label:a.label,labelKey:a.labelKey,colors:a.colors}}),r=Object.entries(e).filter(([a])=>!$.some(i=>i.key===a)).map(([a,i])=>({key:a,label:i.label??a,colors:i.colors}));return[...t,...r]}function oe(){const e=R().sampleCategories;return Array.isArray(e)&&e.length>0?e:re}function le(e,t){const r=R(),a=b(e);return{width:typeof r.defaultWidth=="number"?r.defaultWidth:a?.defaultWidth??100,height:typeof r.defaultHeight=="number"?r.defaultHeight:a?.defaultHeight??60,title:a?.label??"图表",chartOption:se(e),chartDataSource:"",chartCategoryField:"name",chartValueFields:["value"],chartSeriesField:"",...t}}B.use([S.BarChart,S.LineChart,S.PieChart,S.ScatterChart,S.RadarChart,S.FunnelChart,S.GaugeChart,v.GridComponent,v.TooltipComponent,v.LegendComponent,v.TitleComponent,v.DatasetComponent,pe.SVGRenderer]);const Z=new Set;function Re(){const t=(R().components??[]).filter(r=>r!=null&&!Z.has(r));if(t.length!==0){B.use(t);for(const r of t)Z.add(r)}}const Pe=96/25.4;function C(e){const t=Number.isFinite(e)?e:0;return Math.max(1,Math.round(t*Pe))}const De=[12,20,15];function T(e){try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ne(e,t){if(!t||typeof t!="object"||Array.isArray(t))return{};const r=T(t),a=b(e),i=[...oe()],n=[...De],o=Array.isArray(r.series)?r.series:[],l=c=>{for(const u of o)Array.isArray(u.data)&&u.data.includes("$data")&&(u.data=c(u))},s=()=>{for(const c of["xAxis","yAxis"]){const u=Array.isArray(r[c])?r[c]:r[c]?[r[c]]:[];for(const f of u)f&&Array.isArray(f.data)&&f.data.includes("$data")&&(f.data=[...i])}};switch(a?.seriesType){case"pie":l(()=>i.map((c,u)=>({name:c,value:n[u]??10})));break;case"funnel":l(()=>i.map((c,u)=>({name:c,value:n[u]??10})));break;case"scatter":l(()=>n.map(c=>[c,c+6]));break;case"radar":r.radar={...r.radar??{},indicator:i.map(c=>({name:c,max:30}))},l(()=>[{name:"示例",value:n}]);break;case"gauge":l(()=>[{value:n[0]??40,name:"数量"}]);break;default:l(()=>[...n]),s();break}return r}function ke(e,t){const r=Array.isArray(e?.color)?(e?.color).map(String):[];return t.find(i=>i.colors.every((n,o)=>n===r[o])&&r.length===i.colors.length)?.key??"default"}function q(e){return Array.isArray(e)?e[0]&&typeof e[0]=="object"?{...e[0]}:{}:e&&typeof e=="object"?{...e}:{}}function we(e,t,r){const a=T(e),i=Array.isArray(a.series)?a.series:[],n=b(r),o=i[0]??{type:n?.seriesType==="line"?"line":"bar",data:["$data"]};return a.series=Array.from({length:Math.max(t,1)},(l,s)=>({...o,...i[s]??{},data:["$data"]})),a}const H=e=>Math.round(e*10)/10;function W(e,t){return t>0?H(e/t*100):0}function D(e,t,r){if(typeof e=="string"&&e.trim().endsWith("%")){const a=Number.parseFloat(e);if(Number.isFinite(a))return H(a)}return typeof e=="number"&&Number.isFinite(e)?W(e,t):W(r,t)}function ce(e,t,r){return Math.min(r,Math.max(t,e))}function E(e){return`${ce(H(e),0,100)}%`}function Ie(e){const r=(Array.isArray(e.series)?e.series:[])[0];return r&&typeof r=="object"?r:{}}function He(e,t,r){const i=Ie(e&&typeof e=="object"?e:{}),n=C(t),o=C(r);return{top:D(i.top,o,O.top),right:D(i.right,n,O.right),bottom:D(i.bottom,o,O.bottom),left:D(i.left,n,O.left)}}function Me(e,t){const r=T(e),a=Array.isArray(r.series)?r.series:[];a.length===0&&a.push({type:"funnel",data:["$data"]});const i=a[0];return i.top=E(t.top),i.right=E(t.right),i.bottom=E(t.bottom),i.left=E(t.left),r.series=a,r}function je(e,t,r){const i=q((e&&typeof e=="object"?e:{}).radar).radius,n=Array.isArray(i)?i[i.length-1]:i,o=C(t),l=C(r),s=Math.min(o,l)/2;if(typeof n=="string"&&n.trim().endsWith("%")){const c=Number.parseFloat(n);if(Number.isFinite(c))return H(c)}return typeof n=="number"&&Number.isFinite(n)?W(n,s):ne}function ze(e,t){const r=T(e);return r.radar={...q(r.radar),radius:E(ce(t,20,100))},r}const $e=[{key:"value",label:"数值",labelKey:"echarts.label.formatter.value",formatter:"{c}"},{key:"name-value",label:"名称: 数值",labelKey:"echarts.label.formatter.nameValue",formatter:"{b}: {c}"},{key:"name",label:"名称",labelKey:"echarts.label.formatter.name",formatter:"{b}"},{key:"percent",label:"百分比",labelKey:"echarts.label.formatter.percent",formatter:"{d}%"}],We={bar:[{value:"top",label:"顶部",labelKey:"echarts.label.position.bar.top"},{value:"inside",label:"内部",labelKey:"echarts.label.position.bar.inside"},{value:"insideTop",label:"内部顶端",labelKey:"echarts.label.position.bar.insideTop"},{value:"bottom",label:"底部",labelKey:"echarts.label.position.bar.bottom"},{value:"insideBottom",label:"内部底端",labelKey:"echarts.label.position.bar.insideBottom"},{value:"right",label:"右侧",labelKey:"echarts.label.position.bar.right"},{value:"left",label:"左侧",labelKey:"echarts.label.position.bar.left"},{value:"middle",label:"居中",labelKey:"echarts.label.position.bar.middle"}],line:[{value:"top",label:"顶部",labelKey:"echarts.label.position.line.top"},{value:"bottom",label:"底部",labelKey:"echarts.label.position.line.bottom"},{value:"inside",label:"内部",labelKey:"echarts.label.position.line.inside"},{value:"left",label:"左侧",labelKey:"echarts.label.position.line.left"},{value:"right",label:"右侧",labelKey:"echarts.label.position.line.right"}],pie:[{value:"outside",label:"外侧",labelKey:"echarts.label.position.pie.outside"},{value:"inside",label:"内部",labelKey:"echarts.label.position.pie.inside"},{value:"center",label:"中心",labelKey:"echarts.label.position.pie.center"}],scatter:[{value:"top",label:"顶部",labelKey:"echarts.label.position.scatter.top"},{value:"bottom",label:"底部",labelKey:"echarts.label.position.scatter.bottom"},{value:"left",label:"左侧",labelKey:"echarts.label.position.scatter.left"},{value:"right",label:"右侧",labelKey:"echarts.label.position.scatter.right"},{value:"inside",label:"内部",labelKey:"echarts.label.position.scatter.inside"}],radar:[{value:"top",label:"顶部",labelKey:"echarts.label.position.radar.top"},{value:"bottom",label:"底部",labelKey:"echarts.label.position.radar.bottom"},{value:"left",label:"左侧",labelKey:"echarts.label.position.radar.left"},{value:"right",label:"右侧",labelKey:"echarts.label.position.radar.right"},{value:"inside",label:"内部",labelKey:"echarts.label.position.radar.inside"}],funnel:[{value:"outer",label:"外侧",labelKey:"echarts.label.position.funnel.outer"},{value:"inner",label:"内部",labelKey:"echarts.label.position.funnel.inner"},{value:"left",label:"左侧",labelKey:"echarts.label.position.funnel.left"},{value:"right",label:"右侧",labelKey:"echarts.label.position.funnel.right"},{value:"top",label:"顶部",labelKey:"echarts.label.position.funnel.top"},{value:"bottom",label:"底部",labelKey:"echarts.label.position.funnel.bottom"}],gauge:[]},Ue={bar:!1,line:!1,pie:!0,scatter:!1,radar:!1,funnel:!0,gauge:!0},Be={bar:{position:"top",fontSize:12},line:{position:"top",fontSize:12},pie:{position:"outside",overflow:"none",fontSize:11},scatter:{position:"top",fontSize:11},radar:{position:"top",fontSize:10},funnel:{position:"outer",fontSize:11},gauge:{fontSize:14}},qe={barHChart:{position:"right",fontSize:12}},Ge={bar:["formatter","overflow","position","rotate","offset","fontSize","fontWeight","color","backgroundColor","borderColor","borderWidth","borderRadius","padding"],line:["formatter","overflow","position","rotate","offset","fontSize","fontWeight","color","backgroundColor","borderColor","borderWidth","borderRadius","padding"],pie:["formatter","overflow","position","distance","offset","fontSize","fontWeight","color","backgroundColor","borderColor","borderWidth","borderRadius","padding","labelLine.show","labelLine.length","labelLine.length2","labelLine.smooth"],scatter:["formatter","overflow","position","distance","rotate","offset","fontSize","fontWeight","color","backgroundColor","borderColor","borderWidth","borderRadius","padding"],radar:["formatter","fontSize","fontWeight","color"],funnel:["formatter","overflow","position","distance","fontSize","fontWeight","color","labelLine.show","labelLine.length","labelLine.smooth"],gauge:["formatter","fontSize","fontWeight","color","offset"]},Ve=["formatter","overflow","position","distance","rotate","offset","fontSize","fontWeight","color","backgroundColor","borderColor","borderWidth","borderRadius","padding"];function Xe(e){const t=e?.series;return Array.isArray(t)?t:[]}function k(e){return e&&typeof e=="object"&&!Array.isArray(e)?{...e}:{}}function G(e){typeof e.offsetX!="number"&&typeof e.offsetY!="number"||(Array.isArray(e.offset)||(e.offset=[typeof e.offsetX=="number"?e.offsetX:0,typeof e.offsetY=="number"?e.offsetY:0]),delete e.offsetX,delete e.offsetY)}function M(e){return b(e)?.seriesType==="gauge"?"detail":"label"}function Ye(e){const t=b(e);return t?Ge[t.seriesType]:[]}function Je(e,t){const r=b(t),a=Xe(e),i=k(a[0]?.[M(t)]);G(i);const n={show:typeof i.show=="boolean"?i.show:r?Ue[r.seriesType]:!1,labelLine:k(a[0]?.labelLine)};for(const l of Ve){const s=i[l];l!=="offset"&&(typeof s=="string"||typeof s=="number")&&(n[l]=s)}const o=i.offset;return Array.isArray(o)&&typeof o[0]=="number"&&typeof o[1]=="number"&&(n.offset=[o[0],o[1]]),n}function Qe(e){const t=b(e);return t?{...Be[t.seriesType],...qe[e]}:{}}function ee(e){return e==null||e===""}function Ze(e,t,r){const a=T(e??{}),i=Array.isArray(a.series)?a.series:[];if(!b(t)||i.length===0)return a;const o=M(t),{enabled:l,labelLine:s,...c}=r;for(const u of i){if(!u||typeof u!="object")continue;const f=k(u[o]);G(f),l===!0?Object.assign(f,{...Qe(t),...f,show:!0}):l===!1&&(f.show=!1);for(const[d,y]of Object.entries(c))ee(y)?delete f[d]:f[d]=y;if(s){const d=k(u.labelLine);for(const[y,h]of Object.entries(s))ee(h)?delete d[y]:d[y]=h;u.labelLine=d}u[o]=f}return a}function et(e){return Array.isArray(e)?e.map(t=>({...t})):[]}function tt(e,t){const r={...e,type:t?"value":"category"};return t?delete r.data:Array.isArray(r.data)||(r.data=["$data"]),r}function rt(e,t){const r={...e,type:t?"category":"value"};return t&&!Array.isArray(r.data)&&(r.data=["$data"]),t||delete r.data,r}function N(e,t){return Array.isArray(e)?e.map(r=>t({...r})):t(e&&typeof e=="object"?{...e}:{})}function ue(e,t){const r=b(e);if(!r)return t;const a=structuredClone(t),i=et(a.series);if(i.length===0)return a;const n=M(e);for(const s of i){const c=s[n];if(c&&typeof c=="object"&&!Array.isArray(c)){const u={...c};G(u),s[n]=u}}if(r.seriesType==="pie")return a.series=i.map(s=>({...s,type:"pie",...e==="doughnutChart"?{radius:s.radius??["40%","70%"]}:{}})),delete a.xAxis,delete a.yAxis,a;if(r.seriesType==="scatter")return a.series=i.map(s=>({...s,type:"scatter"})),a.xAxis=N(a.xAxis,s=>({...s,type:"value",data:void 0})),a.yAxis=N(a.yAxis,s=>({...s,type:"value",data:void 0})),a;if(r.seriesType==="radar")return a.series=i.map(s=>({...s,type:"radar"})),a;if(r.seriesType==="funnel")return a.series=i.map(s=>({...s,type:"funnel",sort:"descending"})),a;if(r.seriesType==="gauge")return a.series=i.map(s=>({...s,type:"gauge"})),a;const o=r.orientation==="horizontal",l=r.seriesType==="line"?"line":"bar";return a.xAxis=N(a.xAxis,s=>tt(s,o)),a.yAxis=N(a.yAxis,s=>rt(s,o)),a.series=i.map(s=>{const c={...s,type:l};return e==="areaChart"?c.areaStyle=s.areaStyle??{}:delete c.areaStyle,c}),a}function fe(e,t,r){const a=/<svg\b[^>]*>/i.exec(e);if(!a)return e;const i=a[0],n=i.slice(4,-1),l=(/\sstyle\s*=\s*"([^"]*)"/i.exec(n)?.[1]??"").split(";").map(f=>f.trim()).filter(f=>f&&!/^(width|height|display)\s*:/i.test(f)).join(";"),s=n.replace(/\s(width|height|style|viewBox)\s*=\s*"[^"]*"/gi,"").trimEnd(),c=["display:block","width:100%","height:100%",l].filter(Boolean).join(";"),u=`<svg${s} width="100%" height="100%" viewBox="0 0 ${t} ${r}" style="${c}">`;return e.slice(0,a.index)+u+e.slice(a.index+i.length)}function de(e){Re();const t=ue(e.type,e.option);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("图表 option 非法:需要对象");const r=C(e.widthMm),a=C(e.heightMm),i=B.init(null,null,{renderer:"svg",ssr:!0,width:r,height:a});try{const n=t.textStyle&&typeof t.textStyle=="object"&&!Array.isArray(t.textStyle)?t.textStyle:void 0,o={...e.fontFamily?{fontFamily:e.fontFamily}:{},...n??{}};return i.setOption({animation:!1,...t,...Object.keys(o).length>0?{textStyle:o}:{}}),fe(i.renderToSVGString(),r,a)}finally{i.dispose()}}function at(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function U(e){const t=e._chartOption??e.chartOption,r=`<span>${at(String(e.title??"图表"))}</span>`;if(!t||typeof t!="object"||Array.isArray(t))return r;try{return de({key:String(e.key??""),type:String(e.type??""),option:t,widthMm:Number(e.widthMm??0),heightMm:Number(e.heightMm??0),fontFamily:typeof e.fontFamily=="string"?e.fontFamily:void 0})}catch{return r}}const it="2",ye={chartOption:{kind:"object",label:A.t("echarts.meta.chartOption")},chartDataSource:{kind:"text",label:A.t("echarts.meta.dataSource")},chartCategoryField:{kind:"text",label:A.t("echarts.meta.categoryField")},chartValueFields:{kind:"object",label:A.t("echarts.meta.valueFields")},chartSeriesField:{kind:"text",label:A.t("echarts.meta.seriesField")}},nt={...ye,chartBubble:{kind:"bool",label:A.t("echarts.meta.bubbleSize")}},_=x.defineElementPlugin({id:L,version:it,kinds:I.map(e=>({type:e.type,get label(){return A.t(e.labelKey)},icon:e.icon,fixedHeight:!0,requiredOptionKeys:e.requiredOptionKeys,get notes(){return A.t(e.notesKey)},optionMeta:e.type==="scatterChart"?nt:ye,defaultOptions:t=>le(e.type,t),binding:{bind:(t,r)=>te(e.type,t,r)}})),render:{html:U,createRenderer:()=>({render:U})}});let w;function j(e,t){const r=x.getElementPluginById(L);if(!e&&!t){const n=x.registerElementPlugin(_);return w=n,n}const a={..._,designer:e??r?.designer??_.designer,render:{..._.render,...r?.render,...t}},i=x.registerElementPlugin(a);return w=i,i}function st(e){return j(e)}function ot(e){return j(void 0,{executorBundle:e})}function lt(){w?.(),w=void 0}j();exports.CHART_KINDS=me;exports.CHART_KIND_DEFINITIONS=I;exports.CHART_PALETTES=$;exports.CHART_PLUGIN=_;exports.CHART_PLUGIN_ID=L;exports.ECHARTS_FUNNEL_PADDING_PX=O;exports.ECHARTS_RADAR_RADIUS_DEFAULT=ne;exports.FALLBACK_SAMPLE_CATEGORIES=re;exports.FUNNEL_PADDING_DEFAULTS=ae;exports.LABEL_POSITIONS=We;exports.LABEL_PRESETS=$e;exports.RADAR_RADIUS_DEFAULT=ie;exports.asObject=q;exports.bindChartData=te;exports.chartFactoryDefaults=le;exports.cloneChartOption=T;exports.configureChartPlugin=Fe;exports.createDefaultChartOption=se;exports.fitSvgRoot=fe;exports.getChartKindDefinition=b;exports.getChartPalettes=Le;exports.getChartPluginConfig=R;exports.getSampleCategories=oe;exports.labelFieldsOf=Ye;exports.labelTargetOf=M;exports.mmToChartPx=C;exports.normalizeChartOption=ue;exports.previewChartOption=Ne;exports.readChartLabel=Je;exports.readFunnelPadding=He;exports.readPaletteKey=ke;exports.readRadarRadius=je;exports.registerChartDesigner=st;exports.registerChartExecutorBundle=ot;exports.registerChartPlugin=j;exports.renderChartElement=U;exports.renderChartToSvg=de;exports.resolveChartPanelFields=Ae;exports.syncSeriesCount=we;exports.uninstallChartPlugin=lt;exports.updateChartLabel=Ze;exports.writeFunnelPadding=Me;exports.writeRadarRadius=ze;