@worm-print-platform/echarts 1.5.0 → 1.5.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/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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/kinds.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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/kit.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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/kit.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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/kit.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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.5.0
2
+ * @worm-print-platform/echarts v1.5.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.5.0
2
+ * @worm-print-platform/echarts v1.5.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.5.0
2
+ * @worm-print-platform/echarts v1.5.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.5.0
2
+ * @worm-print-platform/echarts v1.5.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.5.0
2
+ * @worm-print-platform/echarts v1.5.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/plugin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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.5.0
2
+ * @worm-print-platform/echarts v1.5.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.5.0
2
+ * @worm-print-platform/echarts v1.5.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/ui.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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
@@ -74,8 +74,7 @@ function escapeHtml(value) {
74
74
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
75
75
  }
76
76
  function elementType(element) {
77
- var _a, _b;
78
- return (_b = (_a = element.printElementType) == null ? void 0 : _a.type) != null ? _b : "";
77
+ return element.printElementType?.type ?? "";
79
78
  }
80
79
  function rawChartOption(element) {
81
80
  const raw = element.options.chartOption;
@@ -83,10 +82,10 @@ function rawChartOption(element) {
83
82
  }
84
83
  function panelOption(element) {
85
84
  const raw = rawChartOption(element);
86
- return (0, import_kit.cloneChartOption)(raw != null ? raw : (0, import_kit.createDefaultChartOption)(elementType(element)));
85
+ return (0, import_kit.cloneChartOption)(raw ?? (0, import_kit.createDefaultChartOption)(elementType(element)));
87
86
  }
88
87
  function chartHasProperties(element) {
89
- const options = element == null ? void 0 : element.options;
88
+ const options = element?.options;
90
89
  if (!options || typeof options !== "object") return false;
91
90
  const record = options;
92
91
  return CHART_OPTION_KEYS.some((key) => record[key] !== void 0);
@@ -99,7 +98,7 @@ function readValueFields(element) {
99
98
  return Array.isArray(raw) ? raw.map(String) : [];
100
99
  }
101
100
  function maxValueFields(def) {
102
- switch (def == null ? void 0 : def.seriesType) {
101
+ switch (def?.seriesType) {
103
102
  case "pie":
104
103
  case "funnel":
105
104
  case "gauge":
@@ -111,11 +110,11 @@ function maxValueFields(def) {
111
110
  }
112
111
  }
113
112
  function valueFieldsLabel(def, limit) {
114
- if ((def == null ? void 0 : def.seriesType) === "radar") return "\u7EF4\u5EA6\u5B57\u6BB5\uFF08\u6BCF\u4E2A\u5B57\u6BB5\u4E00\u4E2A\u7EF4\u5EA6\uFF09";
113
+ if (def?.seriesType === "radar") return "\u7EF4\u5EA6\u5B57\u6BB5\uFF08\u6BCF\u4E2A\u5B57\u6BB5\u4E00\u4E2A\u7EF4\u5EA6\uFF09";
115
114
  return limit === 1 ? "\u6570\u503C\u5B57\u6BB5" : "\u6570\u503C\u5B57\u6BB5\uFF08\u591A\u503C\u591A\u7CFB\u5217\uFF09";
116
115
  }
117
116
  function dataSourceCandidates(data) {
118
- const first = data == null ? void 0 : data[0];
117
+ const first = data?.[0];
119
118
  if (!first) return [];
120
119
  return Object.keys(first).filter((key) => Array.isArray(first[key]));
121
120
  }
@@ -129,28 +128,26 @@ function syncValueFields(ctx, type, nextFields) {
129
128
  const next = (0, import_kit.syncSeriesCount)(panelOption(ctx.element), nextFields.length, type);
130
129
  const series = Array.isArray(next.series) ? next.series : [];
131
130
  series.forEach((item, index) => {
132
- var _a;
133
- const name = (_a = nextFields[index]) == null ? void 0 : _a.trim();
131
+ const name = nextFields[index]?.trim();
134
132
  if (name) item.name = name;
135
133
  });
136
134
  commitOption(ctx, type, next, { chartValueFields: nextFields });
137
135
  }
138
136
  function renderCanvas(ctx) {
139
- var _a, _b, _c;
140
137
  const element = ctx.element;
141
138
  const type = elementType(element);
142
139
  const options = element.options;
143
140
  const widthMm = Number(options.width) || 0;
144
141
  const heightMm = Number(options.height) || 0;
145
142
  try {
146
- const preview = (0, import_kit.previewChartOption)(type, (_a = rawChartOption(element)) != null ? _a : (0, import_kit.createDefaultChartOption)(type));
143
+ const preview = (0, import_kit.previewChartOption)(type, rawChartOption(element) ?? (0, import_kit.createDefaultChartOption)(type));
147
144
  const option = (0, import_kit.normalizeChartOption)(type, preview);
148
145
  if (!option || typeof option !== "object" || Array.isArray(option)) throw new Error("\u56FE\u8868 option \u975E\u6CD5\uFF1A\u9700\u8981\u5BF9\u8C61");
149
146
  const fontFamily = typeof options.fontFamily === "string" && options.fontFamily ? options.fontFamily : void 0;
150
147
  const svg = (0, import_kit.renderChartToSvg)({ key: element.id, type, option, widthMm, heightMm, fontFamily });
151
148
  return `<div class="echarts-canvas-element" style="${CANVAS_STYLE}">${svg}</div>`;
152
- } catch (e) {
153
- const title = typeof options.title === "string" && options.title.trim() ? options.title : (_c = (_b = (0, import_kit.getChartKindDefinition)(type)) == null ? void 0 : _b.label) != null ? _c : "\u56FE\u8868";
149
+ } catch {
150
+ const title = typeof options.title === "string" && options.title.trim() ? options.title : (0, import_kit.getChartKindDefinition)(type)?.label ?? "\u56FE\u8868";
154
151
  return `<div class="echarts-canvas-element" style="${CANVAS_STYLE}">${escapeHtml(title)}</div>`;
155
152
  }
156
153
  }
@@ -188,7 +185,6 @@ function checkboxField(labelText, checked, onCommit) {
188
185
  return wrap;
189
186
  }
190
187
  function renderProperty(ctx) {
191
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
192
188
  const element = ctx.element;
193
189
  const type = elementType(element);
194
190
  const def = (0, import_kit.getChartKindDefinition)(type);
@@ -219,9 +215,9 @@ function renderProperty(ctx) {
219
215
  wrap.appendChild(
220
216
  textInput(
221
217
  {
222
- value: String((_a = options.chartDataSource) != null ? _a : ""),
218
+ value: String(options.chartDataSource ?? ""),
223
219
  placeholder: "\u6570\u636E\u96C6\u8DEF\u5F84\uFF08\u7559\u7A7A\u53D6\u9876\u5C42\u7B2C\u4E00\u4E2A\u6570\u7EC4\uFF09",
224
- list: datalist == null ? void 0 : datalist.id
220
+ list: datalist?.id
225
221
  },
226
222
  (value) => commitOption(ctx, type, panelOption(element), { chartDataSource: value })
227
223
  )
@@ -233,7 +229,7 @@ function renderProperty(ctx) {
233
229
  const wrap = field("\u7C7B\u76EE\u5B57\u6BB5");
234
230
  wrap.appendChild(
235
231
  textInput(
236
- { value: String((_b = options.chartCategoryField) != null ? _b : ""), placeholder: "\u5982 name" },
232
+ { value: String(options.chartCategoryField ?? ""), placeholder: "\u5982 name" },
237
233
  (value) => commitOption(ctx, type, panelOption(element), { chartCategoryField: value })
238
234
  )
239
235
  );
@@ -275,7 +271,7 @@ function renderProperty(ctx) {
275
271
  const wrap = field("\u7CFB\u5217\u62C6\u5206\u5B57\u6BB5");
276
272
  wrap.appendChild(
277
273
  textInput(
278
- { value: String((_c = options.chartSeriesField) != null ? _c : ""), placeholder: "\u53EF\u9009\uFF0C\u5982 region\uFF08\u6309\u503C\u62C6\u6210\u591A\u7CFB\u5217\uFF09" },
274
+ { value: String(options.chartSeriesField ?? ""), placeholder: "\u53EF\u9009\uFF0C\u5982 region\uFF08\u6309\u503C\u62C6\u6210\u591A\u7CFB\u5217\uFF09" },
279
275
  (value) => commitOption(ctx, type, panelOption(element), { chartSeriesField: value })
280
276
  )
281
277
  );
@@ -292,7 +288,7 @@ function renderProperty(ctx) {
292
288
  const wrap = field("\u56FE\u8868\u6807\u9898");
293
289
  wrap.appendChild(
294
290
  textInput(
295
- { value: String((_d = (0, import_kit.asObject)(panelOption(element).title).text) != null ? _d : ""), placeholder: "\u7559\u7A7A\u4E0D\u663E\u793A\u6807\u9898" },
291
+ { value: String((0, import_kit.asObject)(panelOption(element).title).text ?? ""), placeholder: "\u7559\u7A7A\u4E0D\u663E\u793A\u6807\u9898" },
296
292
  (value) => {
297
293
  const next = panelOption(element);
298
294
  next.title = { ...(0, import_kit.asObject)(next.title), text: value };
@@ -323,8 +319,7 @@ function renderProperty(ctx) {
323
319
  }
324
320
  select.value = (0, import_kit.readPaletteKey)(panelOption(element), palettes);
325
321
  select.addEventListener("change", () => {
326
- var _a2;
327
- const palette = (_a2 = palettes.find((item) => item.key === select.value)) != null ? _a2 : palettes[0];
322
+ const palette = palettes.find((item) => item.key === select.value) ?? palettes[0];
328
323
  const next = panelOption(element);
329
324
  next.color = [...palette.colors];
330
325
  commitOption(ctx, type, next);
@@ -348,8 +343,8 @@ function renderProperty(ctx) {
348
343
  }
349
344
  if (has("innerRadius")) {
350
345
  const wrap = field("\u5185\u5F84\uFF08%\uFF09");
351
- const radius = (_e = seriesList(panelOption(element))[0]) == null ? void 0 : _e.radius;
352
- const inner = Array.isArray(radius) ? Number(String((_f = radius[0]) != null ? _f : "40%").replace("%", "")) || 40 : 40;
346
+ const radius = seriesList(panelOption(element))[0]?.radius;
347
+ const inner = Array.isArray(radius) ? Number(String(radius[0] ?? "40%").replace("%", "")) || 40 : 40;
353
348
  wrap.appendChild(
354
349
  textInput({ value: String(inner), type: "number", min: 0, max: 90 }, (value) => {
355
350
  const next = panelOption(element);
@@ -403,7 +398,7 @@ function renderProperty(ctx) {
403
398
  const series = seriesList(panelOption(element));
404
399
  const row = el("div", "echarts-field-row");
405
400
  row.appendChild(
406
- textInput({ value: String(Number((_h = (_g = series[0]) == null ? void 0 : _g.min) != null ? _h : 0)), type: "number" }, (value) => {
401
+ textInput({ value: String(Number(series[0]?.min ?? 0)), type: "number" }, (value) => {
407
402
  const next = panelOption(element);
408
403
  const list = seriesList(next);
409
404
  if (list[0]) list[0].min = Number(value) || 0;
@@ -411,7 +406,7 @@ function renderProperty(ctx) {
411
406
  })
412
407
  );
413
408
  row.appendChild(
414
- textInput({ value: String(Number((_j = (_i = series[0]) == null ? void 0 : _i.max) != null ? _j : 100)), type: "number" }, (value) => {
409
+ textInput({ value: String(Number(series[0]?.max ?? 100)), type: "number" }, (value) => {
415
410
  const next = panelOption(element);
416
411
  const list = seriesList(next);
417
412
  if (list[0]) list[0].max = Number(value) || 100;
@@ -435,12 +430,12 @@ var CHART_ELEMENT_UI = (0, import_plugin_kit.defineElementUI)({
435
430
  });
436
431
  var disposeHandle;
437
432
  function installChartCommonUI() {
438
- disposeHandle == null ? void 0 : disposeHandle();
433
+ disposeHandle?.();
439
434
  disposeHandle = (0, import_plugin_kit.registerElementUI)(CHART_ELEMENT_UI);
440
435
  return disposeHandle;
441
436
  }
442
437
  function uninstallChartCommonUI() {
443
- disposeHandle == null ? void 0 : disposeHandle();
438
+ disposeHandle?.();
444
439
  disposeHandle = void 0;
445
440
  }
446
441
  installChartCommonUI();
package/dist/ui.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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/ui.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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
@@ -68,8 +68,7 @@ function escapeHtml(value) {
68
68
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
69
69
  }
70
70
  function elementType(element) {
71
- var _a, _b;
72
- return (_b = (_a = element.printElementType) == null ? void 0 : _a.type) != null ? _b : "";
71
+ return element.printElementType?.type ?? "";
73
72
  }
74
73
  function rawChartOption(element) {
75
74
  const raw = element.options.chartOption;
@@ -77,10 +76,10 @@ function rawChartOption(element) {
77
76
  }
78
77
  function panelOption(element) {
79
78
  const raw = rawChartOption(element);
80
- return cloneChartOption(raw != null ? raw : createDefaultChartOption(elementType(element)));
79
+ return cloneChartOption(raw ?? createDefaultChartOption(elementType(element)));
81
80
  }
82
81
  function chartHasProperties(element) {
83
- const options = element == null ? void 0 : element.options;
82
+ const options = element?.options;
84
83
  if (!options || typeof options !== "object") return false;
85
84
  const record = options;
86
85
  return CHART_OPTION_KEYS.some((key) => record[key] !== void 0);
@@ -93,7 +92,7 @@ function readValueFields(element) {
93
92
  return Array.isArray(raw) ? raw.map(String) : [];
94
93
  }
95
94
  function maxValueFields(def) {
96
- switch (def == null ? void 0 : def.seriesType) {
95
+ switch (def?.seriesType) {
97
96
  case "pie":
98
97
  case "funnel":
99
98
  case "gauge":
@@ -105,11 +104,11 @@ function maxValueFields(def) {
105
104
  }
106
105
  }
107
106
  function valueFieldsLabel(def, limit) {
108
- if ((def == null ? void 0 : def.seriesType) === "radar") return "\u7EF4\u5EA6\u5B57\u6BB5\uFF08\u6BCF\u4E2A\u5B57\u6BB5\u4E00\u4E2A\u7EF4\u5EA6\uFF09";
107
+ if (def?.seriesType === "radar") return "\u7EF4\u5EA6\u5B57\u6BB5\uFF08\u6BCF\u4E2A\u5B57\u6BB5\u4E00\u4E2A\u7EF4\u5EA6\uFF09";
109
108
  return limit === 1 ? "\u6570\u503C\u5B57\u6BB5" : "\u6570\u503C\u5B57\u6BB5\uFF08\u591A\u503C\u591A\u7CFB\u5217\uFF09";
110
109
  }
111
110
  function dataSourceCandidates(data) {
112
- const first = data == null ? void 0 : data[0];
111
+ const first = data?.[0];
113
112
  if (!first) return [];
114
113
  return Object.keys(first).filter((key) => Array.isArray(first[key]));
115
114
  }
@@ -123,28 +122,26 @@ function syncValueFields(ctx, type, nextFields) {
123
122
  const next = syncSeriesCount(panelOption(ctx.element), nextFields.length, type);
124
123
  const series = Array.isArray(next.series) ? next.series : [];
125
124
  series.forEach((item, index) => {
126
- var _a;
127
- const name = (_a = nextFields[index]) == null ? void 0 : _a.trim();
125
+ const name = nextFields[index]?.trim();
128
126
  if (name) item.name = name;
129
127
  });
130
128
  commitOption(ctx, type, next, { chartValueFields: nextFields });
131
129
  }
132
130
  function renderCanvas(ctx) {
133
- var _a, _b, _c;
134
131
  const element = ctx.element;
135
132
  const type = elementType(element);
136
133
  const options = element.options;
137
134
  const widthMm = Number(options.width) || 0;
138
135
  const heightMm = Number(options.height) || 0;
139
136
  try {
140
- const preview = previewChartOption(type, (_a = rawChartOption(element)) != null ? _a : createDefaultChartOption(type));
137
+ const preview = previewChartOption(type, rawChartOption(element) ?? createDefaultChartOption(type));
141
138
  const option = normalizeChartOption(type, preview);
142
139
  if (!option || typeof option !== "object" || Array.isArray(option)) throw new Error("\u56FE\u8868 option \u975E\u6CD5\uFF1A\u9700\u8981\u5BF9\u8C61");
143
140
  const fontFamily = typeof options.fontFamily === "string" && options.fontFamily ? options.fontFamily : void 0;
144
141
  const svg = renderChartToSvg({ key: element.id, type, option, widthMm, heightMm, fontFamily });
145
142
  return `<div class="echarts-canvas-element" style="${CANVAS_STYLE}">${svg}</div>`;
146
- } catch (e) {
147
- const title = typeof options.title === "string" && options.title.trim() ? options.title : (_c = (_b = getChartKindDefinition(type)) == null ? void 0 : _b.label) != null ? _c : "\u56FE\u8868";
143
+ } catch {
144
+ const title = typeof options.title === "string" && options.title.trim() ? options.title : getChartKindDefinition(type)?.label ?? "\u56FE\u8868";
148
145
  return `<div class="echarts-canvas-element" style="${CANVAS_STYLE}">${escapeHtml(title)}</div>`;
149
146
  }
150
147
  }
@@ -182,7 +179,6 @@ function checkboxField(labelText, checked, onCommit) {
182
179
  return wrap;
183
180
  }
184
181
  function renderProperty(ctx) {
185
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
186
182
  const element = ctx.element;
187
183
  const type = elementType(element);
188
184
  const def = getChartKindDefinition(type);
@@ -213,9 +209,9 @@ function renderProperty(ctx) {
213
209
  wrap.appendChild(
214
210
  textInput(
215
211
  {
216
- value: String((_a = options.chartDataSource) != null ? _a : ""),
212
+ value: String(options.chartDataSource ?? ""),
217
213
  placeholder: "\u6570\u636E\u96C6\u8DEF\u5F84\uFF08\u7559\u7A7A\u53D6\u9876\u5C42\u7B2C\u4E00\u4E2A\u6570\u7EC4\uFF09",
218
- list: datalist == null ? void 0 : datalist.id
214
+ list: datalist?.id
219
215
  },
220
216
  (value) => commitOption(ctx, type, panelOption(element), { chartDataSource: value })
221
217
  )
@@ -227,7 +223,7 @@ function renderProperty(ctx) {
227
223
  const wrap = field("\u7C7B\u76EE\u5B57\u6BB5");
228
224
  wrap.appendChild(
229
225
  textInput(
230
- { value: String((_b = options.chartCategoryField) != null ? _b : ""), placeholder: "\u5982 name" },
226
+ { value: String(options.chartCategoryField ?? ""), placeholder: "\u5982 name" },
231
227
  (value) => commitOption(ctx, type, panelOption(element), { chartCategoryField: value })
232
228
  )
233
229
  );
@@ -269,7 +265,7 @@ function renderProperty(ctx) {
269
265
  const wrap = field("\u7CFB\u5217\u62C6\u5206\u5B57\u6BB5");
270
266
  wrap.appendChild(
271
267
  textInput(
272
- { value: String((_c = options.chartSeriesField) != null ? _c : ""), placeholder: "\u53EF\u9009\uFF0C\u5982 region\uFF08\u6309\u503C\u62C6\u6210\u591A\u7CFB\u5217\uFF09" },
268
+ { value: String(options.chartSeriesField ?? ""), placeholder: "\u53EF\u9009\uFF0C\u5982 region\uFF08\u6309\u503C\u62C6\u6210\u591A\u7CFB\u5217\uFF09" },
273
269
  (value) => commitOption(ctx, type, panelOption(element), { chartSeriesField: value })
274
270
  )
275
271
  );
@@ -286,7 +282,7 @@ function renderProperty(ctx) {
286
282
  const wrap = field("\u56FE\u8868\u6807\u9898");
287
283
  wrap.appendChild(
288
284
  textInput(
289
- { value: String((_d = asObject(panelOption(element).title).text) != null ? _d : ""), placeholder: "\u7559\u7A7A\u4E0D\u663E\u793A\u6807\u9898" },
285
+ { value: String(asObject(panelOption(element).title).text ?? ""), placeholder: "\u7559\u7A7A\u4E0D\u663E\u793A\u6807\u9898" },
290
286
  (value) => {
291
287
  const next = panelOption(element);
292
288
  next.title = { ...asObject(next.title), text: value };
@@ -317,8 +313,7 @@ function renderProperty(ctx) {
317
313
  }
318
314
  select.value = readPaletteKey(panelOption(element), palettes);
319
315
  select.addEventListener("change", () => {
320
- var _a2;
321
- const palette = (_a2 = palettes.find((item) => item.key === select.value)) != null ? _a2 : palettes[0];
316
+ const palette = palettes.find((item) => item.key === select.value) ?? palettes[0];
322
317
  const next = panelOption(element);
323
318
  next.color = [...palette.colors];
324
319
  commitOption(ctx, type, next);
@@ -342,8 +337,8 @@ function renderProperty(ctx) {
342
337
  }
343
338
  if (has("innerRadius")) {
344
339
  const wrap = field("\u5185\u5F84\uFF08%\uFF09");
345
- const radius = (_e = seriesList(panelOption(element))[0]) == null ? void 0 : _e.radius;
346
- const inner = Array.isArray(radius) ? Number(String((_f = radius[0]) != null ? _f : "40%").replace("%", "")) || 40 : 40;
340
+ const radius = seriesList(panelOption(element))[0]?.radius;
341
+ const inner = Array.isArray(radius) ? Number(String(radius[0] ?? "40%").replace("%", "")) || 40 : 40;
347
342
  wrap.appendChild(
348
343
  textInput({ value: String(inner), type: "number", min: 0, max: 90 }, (value) => {
349
344
  const next = panelOption(element);
@@ -397,7 +392,7 @@ function renderProperty(ctx) {
397
392
  const series = seriesList(panelOption(element));
398
393
  const row = el("div", "echarts-field-row");
399
394
  row.appendChild(
400
- textInput({ value: String(Number((_h = (_g = series[0]) == null ? void 0 : _g.min) != null ? _h : 0)), type: "number" }, (value) => {
395
+ textInput({ value: String(Number(series[0]?.min ?? 0)), type: "number" }, (value) => {
401
396
  const next = panelOption(element);
402
397
  const list = seriesList(next);
403
398
  if (list[0]) list[0].min = Number(value) || 0;
@@ -405,7 +400,7 @@ function renderProperty(ctx) {
405
400
  })
406
401
  );
407
402
  row.appendChild(
408
- textInput({ value: String(Number((_j = (_i = series[0]) == null ? void 0 : _i.max) != null ? _j : 100)), type: "number" }, (value) => {
403
+ textInput({ value: String(Number(series[0]?.max ?? 100)), type: "number" }, (value) => {
409
404
  const next = panelOption(element);
410
405
  const list = seriesList(next);
411
406
  if (list[0]) list[0].max = Number(value) || 100;
@@ -429,12 +424,12 @@ var CHART_ELEMENT_UI = defineElementUI({
429
424
  });
430
425
  var disposeHandle;
431
426
  function installChartCommonUI() {
432
- disposeHandle == null ? void 0 : disposeHandle();
427
+ disposeHandle?.();
433
428
  disposeHandle = registerElementUI(CHART_ELEMENT_UI);
434
429
  return disposeHandle;
435
430
  }
436
431
  function uninstallChartCommonUI() {
437
- disposeHandle == null ? void 0 : disposeHandle();
432
+ disposeHandle?.();
438
433
  disposeHandle = void 0;
439
434
  }
440
435
  installChartCommonUI();
package/dist/units.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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/version.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.5.0
2
+ * @worm-print-platform/echarts v1.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worm-print-platform/echarts",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "type": "module",
5
5
  "description": "打印模板 ECharts 图表元素可选包:SSR/浏览器 SVG 渲染器、页面执行器与设计器图表扩展(主包不依赖图表库)",
6
6
  "main": "./dist/index.cjs",
@@ -61,8 +61,8 @@
61
61
  "test:watch": "vitest"
62
62
  },
63
63
  "dependencies": {
64
- "@worm-print-platform/core": "^1.5.0",
65
- "@worm-print-platform/plugin-kit": "^1.5.0",
64
+ "@worm-print-platform/core": "^1.5.2",
65
+ "@worm-print-platform/plugin-kit": "^1.5.2",
66
66
  "echarts": "^6.1.0"
67
67
  },
68
68
  "devDependencies": {