@worm-print-platform/echarts 1.6.4 → 1.6.6

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/ui.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.6.4
2
+ * @worm-print-platform/echarts v1.6.6
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,6 +74,8 @@ var zh_CN_default = {
74
74
  "echarts.panel.labelLine.length2": "\u7B2C\u4E8C\u6BB5\u957F\u5EA6",
75
75
  "echarts.panel.labelLine.smooth": "\u5E73\u6ED1\u5F15\u5BFC\u7EBF",
76
76
  "echarts.panel.dataSourceTitle": "\u6570\u636E\u6E90",
77
+ "echarts.panel.selectField": "\u9009\u62E9\u5B57\u6BB5",
78
+ "echarts.panel.autoSource": "\u81EA\u52A8",
77
79
  "echarts.panel.categoryField": "\u7C7B\u76EE\u5B57\u6BB5",
78
80
  "echarts.panel.removeField": "\u5220\u9664\u8BE5\u5B57\u6BB5",
79
81
  "echarts.panel.addField": "+ \u6DFB\u52A0\u5B57\u6BB5",
@@ -229,6 +231,8 @@ var en_US_default = {
229
231
  "echarts.panel.labelLine.length2": "Second segment length",
230
232
  "echarts.panel.labelLine.smooth": "Smooth label line",
231
233
  "echarts.panel.dataSourceTitle": "Data source",
234
+ "echarts.panel.selectField": "Select field",
235
+ "echarts.panel.autoSource": "Auto",
232
236
  "echarts.panel.categoryField": "Category field",
233
237
  "echarts.panel.removeField": "Remove this field",
234
238
  "echarts.panel.addField": "+ Add field",
@@ -384,6 +388,8 @@ var th_TH_default = {
384
388
  "echarts.panel.labelLine.length2": "\u0E04\u0E27\u0E32\u0E21\u0E22\u0E32\u0E27\u0E17\u0E48\u0E2D\u0E19\u0E17\u0E35\u0E48\u0E2A\u0E2D\u0E07",
385
389
  "echarts.panel.labelLine.smooth": "\u0E40\u0E2A\u0E49\u0E19\u0E1B\u0E49\u0E32\u0E22\u0E42\u0E04\u0E49\u0E07",
386
390
  "echarts.panel.dataSourceTitle": "\u0E41\u0E2B\u0E25\u0E48\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25",
391
+ "echarts.panel.selectField": "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E1F\u0E34\u0E25\u0E14\u0E4C",
392
+ "echarts.panel.autoSource": "\u0E2D\u0E31\u0E15\u0E42\u0E19\u0E21\u0E31\u0E15\u0E34",
387
393
  "echarts.panel.categoryField": "\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E2B\u0E21\u0E27\u0E14\u0E2B\u0E21\u0E39\u0E48",
388
394
  "echarts.panel.removeField": "\u0E25\u0E1A\u0E1F\u0E34\u0E25\u0E14\u0E4C\u0E19\u0E35\u0E49",
389
395
  "echarts.panel.addField": "+ \u0E40\u0E1E\u0E34\u0E48\u0E21\u0E1F\u0E34\u0E25\u0E14\u0E4C",
@@ -928,8 +934,8 @@ function chartFactoryDefaults(type, partial) {
928
934
  title: def?.label ?? "\u56FE\u8868",
929
935
  chartOption: createDefaultChartOption(type),
930
936
  chartDataSource: "",
931
- chartCategoryField: "name",
932
- chartValueFields: ["value"],
937
+ chartCategoryField: "",
938
+ chartValueFields: [],
933
939
  chartSeriesField: "",
934
940
  ...partial
935
941
  };
@@ -1605,18 +1611,9 @@ var CANVAS_STYLE = "width:100%;height:100%;min-width:0;min-height:0;pointer-even
1605
1611
  var STYLES = [
1606
1612
  ".echarts-canvas-element{overflow:hidden}",
1607
1613
  ".echarts-field-row{display:flex;gap:6px;align-items:center}",
1614
+ ".echarts-field-current{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--pd-text-secondary,#6b7280)}",
1608
1615
  ".echarts-field-row>.pd-input{flex:1;min-width:0}",
1609
1616
  ".echarts-field-row>.pd-button{flex:none}",
1610
- ".echarts-dropdown-trigger{display:flex;align-items:center;justify-content:space-between;gap:6px;width:100%;height:26px;min-height:26px;padding:3px 6px;border:1px solid var(--pd-border,#d9dde6);border-radius:6px;background:var(--pd-input-bg,#fff);color:inherit;font:inherit;box-sizing:border-box;cursor:pointer;text-align:left}",
1611
- ".echarts-dropdown-trigger:hover{border-color:var(--pd-text-faint,#b4b9c4)}",
1612
- '.echarts-dropdown-trigger[aria-expanded="true"]{border-color:var(--pd-accent,#165dff);box-shadow:0 0 0 2px rgb(22 93 255 / 12%)}',
1613
- ".echarts-dropdown-value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
1614
- ".echarts-dropdown-arrow{flex:none;color:var(--pd-text-muted,#909399);font-size:10px;transition:transform .14s}",
1615
- '.echarts-dropdown-trigger[aria-expanded="true"] .echarts-dropdown-arrow{transform:rotate(180deg)}',
1616
- ".echarts-dropdown-panel{position:fixed;z-index:1200;max-height:240px;overflow:auto;padding:3px;border:1px solid var(--pd-border,#d9dde6);border-radius:6px;background:var(--pd-input-bg,#fff);box-shadow:0 6px 18px rgb(0 0 0 / 14%);box-sizing:border-box}",
1617
- ".echarts-dropdown-option{padding:5px 8px;border-radius:4px;cursor:pointer;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",
1618
- ".echarts-dropdown-option:hover{background:var(--pd-accent-soft,rgb(22 93 255 / 9%))}",
1619
- ".echarts-dropdown-option.is-active{background:var(--pd-accent-soft,rgb(22 93 255 / 9%));color:var(--pd-accent,#165dff)}",
1620
1617
  ".echarts-label-group{margin-top:8px;border-top:1px solid var(--pd-border,#e5e7eb);padding-top:8px}",
1621
1618
  ".echarts-label-group>summary{display:flex;align-items:center;cursor:pointer;list-style:none;font-size:12px;font-weight:600}",
1622
1619
  ".echarts-label-summary>.pd-field{flex:1;margin:0;font-weight:400}",
@@ -1697,22 +1694,6 @@ function valueFieldsLabel(def, limit) {
1697
1694
  if (def?.seriesType === "radar") return t2("echarts.panel.field.dimension");
1698
1695
  return limit === 1 ? t2("echarts.panel.field.value") : t2("echarts.panel.field.valueMulti");
1699
1696
  }
1700
- function dataSourceCandidates(data, fields) {
1701
- const first = data?.[0];
1702
- const keys = first ? Object.keys(first).filter((key) => Array.isArray(first[key])) : [];
1703
- for (const field2 of fields ?? []) {
1704
- if (field2.fieldType === "list" && field2.fieldKey && !keys.includes(field2.fieldKey)) keys.push(field2.fieldKey);
1705
- }
1706
- return keys;
1707
- }
1708
- function dataRowFields(data, dataSource) {
1709
- const first = data?.[0];
1710
- if (!first) return [];
1711
- const key = dataSource ? Array.isArray(first[dataSource]) ? dataSource : "" : Object.keys(first).find((k) => Array.isArray(first[k]));
1712
- if (!key) return [];
1713
- const rows = first[key];
1714
- return rows.length > 0 && typeof rows[0] === "object" && rows[0] !== null ? Object.keys(rows[0]) : [];
1715
- }
1716
1697
  function fieldLabelMap(fields) {
1717
1698
  const map = /* @__PURE__ */ new Map();
1718
1699
  for (const field2 of fields ?? []) {
@@ -1720,17 +1701,41 @@ function fieldLabelMap(fields) {
1720
1701
  }
1721
1702
  return map;
1722
1703
  }
1723
- function optionLabel(value, labels, fallbackSuffix) {
1724
- if (!value) return fallbackSuffix ?? t2("echarts.panel.default");
1704
+ function optionLabel(value, labels) {
1705
+ if (!value) return t2("echarts.panel.default");
1725
1706
  const name = labels.get(value);
1726
- const base = name ? `${name}\uFF08${value}\uFF09` : value;
1727
- return fallbackSuffix ? `${base}${fallbackSuffix}` : base;
1728
- }
1729
- function dropdownOptions(candidates, current, labels = /* @__PURE__ */ new Map()) {
1730
- const opts = candidates.map((value) => ({ value, label: optionLabel(value, labels) }));
1731
- if (current && !candidates.includes(current)) opts.unshift({ value: current, label: optionLabel(current, labels, t2("echarts.panel.current")) });
1732
- if (!current) opts.unshift({ value: "", label: t2("echarts.panel.defaultFirstArray") });
1733
- return opts;
1707
+ return name ? `${name}\uFF08${value}\uFF09` : value;
1708
+ }
1709
+ function fieldBindingKey(next) {
1710
+ if (next.binding) return next.binding;
1711
+ const matched = /^\{\s*([^{}]+?)\s*\}$/.exec(next.formatter?.trim() ?? "");
1712
+ return matched?.[1]?.trim() ?? "";
1713
+ }
1714
+ function fieldPicker(ctx, current, targetPath, fields, labels, onSelect, allowAuto = false) {
1715
+ const row = el("div", "echarts-field-row");
1716
+ const display = el(
1717
+ "span",
1718
+ "echarts-field-current",
1719
+ current ? optionLabel(current, labels) : allowAuto ? t2("echarts.panel.autoSource") : t2("echarts.panel.default")
1720
+ );
1721
+ const picker = el("button", "pd-button small echarts-field-picker", t2("echarts.panel.selectField"));
1722
+ picker.type = "button";
1723
+ picker.addEventListener("click", () => ctx.openExpression({
1724
+ elementId: ctx.element.id,
1725
+ targetPath,
1726
+ value: current ? `{${current}}` : "",
1727
+ binding: current || void 0,
1728
+ fieldOnly: true,
1729
+ fields
1730
+ }, (next) => onSelect(fieldBindingKey(next))));
1731
+ row.append(display, picker);
1732
+ if (allowAuto) {
1733
+ const auto = el("button", "pd-button small echarts-auto-source", t2("echarts.panel.autoSource"));
1734
+ auto.type = "button";
1735
+ auto.addEventListener("click", () => onSelect(""));
1736
+ row.appendChild(auto);
1737
+ }
1738
+ return row;
1734
1739
  }
1735
1740
  function seriesList(option) {
1736
1741
  return Array.isArray(option.series) ? option.series : [];
@@ -1810,84 +1815,6 @@ function selectInput(options, value, onCommit) {
1810
1815
  select.addEventListener("change", () => onCommit(select.value));
1811
1816
  return select;
1812
1817
  }
1813
- var activeDropdown = null;
1814
- function composedPathOf(ev) {
1815
- const composed = typeof ev.composedPath === "function" ? ev.composedPath() : [];
1816
- return composed.length ? composed : [ev.target];
1817
- }
1818
- function dropdownSelect(options, value, onCommit) {
1819
- const current = options.find((item) => item.value === value) ?? { value, label: value || t2("echarts.panel.optionDefault") };
1820
- const trigger = el("button", "echarts-dropdown-trigger");
1821
- trigger.type = "button";
1822
- trigger.setAttribute("aria-haspopup", "listbox");
1823
- trigger.setAttribute("aria-expanded", "false");
1824
- const valueEl = el("span", "echarts-dropdown-value", current.label);
1825
- const arrow = el("span", "echarts-dropdown-arrow", "\u25BE");
1826
- trigger.appendChild(valueEl);
1827
- trigger.appendChild(arrow);
1828
- let panel = null;
1829
- let off = [];
1830
- const close = () => {
1831
- off.forEach((fn) => fn());
1832
- off = [];
1833
- panel?.remove();
1834
- panel = null;
1835
- trigger.setAttribute("aria-expanded", "false");
1836
- if (activeDropdown?.close === close) activeDropdown = null;
1837
- };
1838
- const open = () => {
1839
- activeDropdown?.close();
1840
- const root = trigger.getRootNode();
1841
- const mount = root instanceof ShadowRoot ? root : document.body;
1842
- panel = el("div", "echarts-dropdown-panel");
1843
- panel.setAttribute("role", "listbox");
1844
- for (const item of options) {
1845
- const optionEl = el("div", `echarts-dropdown-option${item.value === value ? " is-active" : ""}`, item.label);
1846
- optionEl.setAttribute("role", "option");
1847
- optionEl.setAttribute("aria-selected", item.value === value ? "true" : "false");
1848
- optionEl.addEventListener("click", (ev) => {
1849
- ev.stopPropagation();
1850
- close();
1851
- onCommit(item.value);
1852
- });
1853
- panel.appendChild(optionEl);
1854
- }
1855
- mount.appendChild(panel);
1856
- const rect = trigger.getBoundingClientRect();
1857
- panel.style.left = `${rect.left}px`;
1858
- panel.style.top = `${rect.bottom + 4}px`;
1859
- panel.style.minWidth = `${rect.width}px`;
1860
- trigger.setAttribute("aria-expanded", "true");
1861
- activeDropdown = { close };
1862
- const onPointerDown = (ev) => {
1863
- const path = composedPathOf(ev);
1864
- if (path.includes(trigger) || path.includes(panel)) return;
1865
- close();
1866
- };
1867
- const onKeydown = (ev) => {
1868
- if (ev.key === "Escape") close();
1869
- };
1870
- const onScroll = () => close();
1871
- document.addEventListener("pointerdown", onPointerDown, true);
1872
- document.addEventListener("keydown", onKeydown);
1873
- window.addEventListener("scroll", onScroll, true);
1874
- window.addEventListener("resize", onScroll);
1875
- root.addEventListener("scroll", onScroll, true);
1876
- off.push(
1877
- () => document.removeEventListener("pointerdown", onPointerDown, true),
1878
- () => document.removeEventListener("keydown", onKeydown),
1879
- () => window.removeEventListener("scroll", onScroll, true),
1880
- () => window.removeEventListener("resize", onScroll),
1881
- () => root.removeEventListener("scroll", onScroll, true)
1882
- );
1883
- };
1884
- trigger.addEventListener("click", (ev) => {
1885
- ev.stopPropagation();
1886
- if (panel) close();
1887
- else open();
1888
- });
1889
- return trigger;
1890
- }
1891
1818
  var overflowOptions = () => [
1892
1819
  { value: "", label: t2("echarts.panel.overflow.default") },
1893
1820
  { value: "none", label: t2("echarts.panel.overflow.none") },
@@ -2069,60 +1996,67 @@ function renderProperty(ctx) {
2069
1996
  return withTranslator(ctx.t, () => renderPropertyInner(ctx));
2070
1997
  }
2071
1998
  function renderPropertyInner(ctx) {
1999
+ if (!ctx.openExpression) throw new Error("[echarts] \u56FE\u8868\u5C5E\u6027\u9762\u677F\u9700\u8981\u5BBF\u4E3B\u63D0\u4F9B openExpression\uFF08\u5B57\u6BB5\u9009\u62E9\u4EC5\u652F\u6301\u8868\u8FBE\u5F0F\u5F39\u6846\uFF09");
2072
2000
  const element = ctx.element;
2073
2001
  const type = elementType(element);
2074
2002
  const def = getChartKindDefinition(type);
2075
- const fields = resolveChartPanelFields(type);
2076
- const has = (key) => fields.includes(key);
2003
+ const panelFields = resolveChartPanelFields(type);
2004
+ const has = (key) => panelFields.includes(key);
2077
2005
  const options = element.options;
2078
2006
  const widthMm = Number(options.width) || 0;
2079
2007
  const heightMm = Number(options.height) || 0;
2080
2008
  const limit = maxValueFields(def);
2081
2009
  const palettes = getChartPalettes();
2082
2010
  const fieldLabels = fieldLabelMap(ctx.fields);
2011
+ const allFields = ctx.fields ?? [];
2012
+ const sourceFields = allFields.filter((field2) => field2.fieldType === "list");
2013
+ const bound = String(options.chartDataSource ?? "");
2014
+ const prefixed = bound ? allFields.filter((field2) => field2.fieldKey.startsWith(`${bound}.`)) : [];
2015
+ const rowFields = prefixed.length > 0 ? prefixed : allFields.filter((field2) => field2.fieldType !== "list");
2083
2016
  const root = el("div", "echarts-property");
2084
2017
  const form = el("form", "pd-form");
2085
2018
  form.addEventListener("submit", (event) => event.preventDefault());
2086
2019
  root.appendChild(form);
2087
2020
  if (has("dataSource")) {
2088
2021
  const wrap = field(t2("echarts.panel.dataSourceTitle"));
2089
- const current = String(options.chartDataSource ?? "");
2090
- wrap.appendChild(
2091
- dropdownSelect(
2092
- dropdownOptions(dataSourceCandidates(ctx.data, ctx.fields), current, fieldLabels),
2093
- current,
2094
- (value) => commitOption(ctx, type, panelOption(element), { chartDataSource: value })
2095
- )
2096
- );
2022
+ wrap.appendChild(fieldPicker(
2023
+ ctx,
2024
+ String(options.chartDataSource ?? ""),
2025
+ "options.chartDataSource",
2026
+ sourceFields,
2027
+ fieldLabels,
2028
+ (value) => commitOption(ctx, type, panelOption(element), { chartDataSource: value }),
2029
+ true
2030
+ ));
2097
2031
  form.appendChild(wrap);
2098
2032
  }
2099
2033
  if (has("categoryField")) {
2100
2034
  const wrap = field(t2("echarts.panel.categoryField"));
2101
- const current = String(options.chartCategoryField ?? "");
2102
- wrap.appendChild(
2103
- dropdownSelect(
2104
- dropdownOptions(dataRowFields(ctx.data, String(options.chartDataSource ?? "")), current, fieldLabels),
2105
- current,
2106
- (value) => commitOption(ctx, type, panelOption(element), { chartCategoryField: value })
2107
- )
2108
- );
2035
+ wrap.appendChild(fieldPicker(
2036
+ ctx,
2037
+ String(options.chartCategoryField ?? ""),
2038
+ "options.chartCategoryField",
2039
+ rowFields,
2040
+ fieldLabels,
2041
+ (value) => commitOption(ctx, type, panelOption(element), { chartCategoryField: value })
2042
+ ));
2109
2043
  form.appendChild(wrap);
2110
2044
  }
2111
2045
  if (has("valueFields")) {
2112
2046
  const wrap = field(valueFieldsLabel(def, limit));
2113
2047
  const fieldsNow = readValueFields(element);
2114
2048
  fieldsNow.forEach((value, index) => {
2115
- const row = el("div", "echarts-field-row");
2116
- row.appendChild(
2117
- dropdownSelect(
2118
- dropdownOptions(dataRowFields(ctx.data, String(options.chartDataSource ?? "")), value, fieldLabels),
2119
- value,
2120
- (next) => {
2121
- const list = readValueFields(element);
2122
- list[index] = next;
2123
- syncValueFields(ctx, type, list);
2124
- }
2125
- )
2049
+ const row = fieldPicker(
2050
+ ctx,
2051
+ value,
2052
+ `options.chartValueFields.${index}`,
2053
+ rowFields,
2054
+ fieldLabels,
2055
+ (next) => {
2056
+ const list = readValueFields(element);
2057
+ list[index] = next;
2058
+ syncValueFields(ctx, type, list);
2059
+ }
2126
2060
  );
2127
2061
  if (fieldsNow.length > 1) {
2128
2062
  const remove = el("button", "pd-button small", "\u2212");
@@ -2143,12 +2077,14 @@ function renderPropertyInner(ctx) {
2143
2077
  }
2144
2078
  if (has("seriesField")) {
2145
2079
  const wrap = field(t2("echarts.panel.seriesField"));
2146
- wrap.appendChild(
2147
- textInput(
2148
- { value: String(options.chartSeriesField ?? ""), placeholder: t2("echarts.panel.seriesFieldHint") },
2149
- (value) => commitOption(ctx, type, panelOption(element), { chartSeriesField: value })
2150
- )
2151
- );
2080
+ wrap.appendChild(fieldPicker(
2081
+ ctx,
2082
+ String(options.chartSeriesField ?? ""),
2083
+ "options.chartSeriesField",
2084
+ rowFields,
2085
+ fieldLabels,
2086
+ (value) => commitOption(ctx, type, panelOption(element), { chartSeriesField: value })
2087
+ ));
2152
2088
  form.appendChild(wrap);
2153
2089
  }
2154
2090
  if (has("bubble")) {
package/dist/units.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @worm-print-platform/echarts v1.6.4
2
+ * @worm-print-platform/echarts v1.6.6
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.6.4
2
+ * @worm-print-platform/echarts v1.6.6
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.6.4",
3
+ "version": "1.6.6",
4
4
  "type": "module",
5
5
  "description": "兼容镜像包:源码唯一真源在 marketplace/plugins/echarts(@worm-print-platform/plugin-echarts),本包由同一源码生成,保留原包名与子路径供存量依赖方零改动使用",
6
6
  "main": "./dist/index.cjs",
@@ -45,7 +45,7 @@
45
45
  "dir": "dist/i18n",
46
46
  "base": "zh-CN"
47
47
  },
48
- "version": "1.6.4",
48
+ "version": "1.6.6",
49
49
  "entry": "dist/marketplace.js",
50
50
  "kinds": [
51
51
  "barChart",
@@ -61,8 +61,8 @@
61
61
  ],
62
62
  "exportFormats": [],
63
63
  "peerDeps": {
64
- "@worm-print-platform/core": "^1.6.4",
65
- "@worm-print-platform/plugin-kit": "^1.6.4"
64
+ "@worm-print-platform/core": "^1.6.6",
65
+ "@worm-print-platform/plugin-kit": "^1.6.6"
66
66
  }
67
67
  },
68
68
  "license": "MIT",
@@ -87,8 +87,8 @@
87
87
  "test:watch": "npm --prefix ../../marketplace/plugins/echarts run test:watch"
88
88
  },
89
89
  "dependencies": {
90
- "@worm-print-platform/core": "^1.6.4",
91
- "@worm-print-platform/plugin-kit": "^1.6.4",
90
+ "@worm-print-platform/core": "^1.6.6",
91
+ "@worm-print-platform/plugin-kit": "^1.6.6",
92
92
  "echarts": "^6.1.0"
93
93
  },
94
94
  "devDependencies": {
@@ -1,6 +0,0 @@
1
- /*!
2
- * @worm-print-platform/echarts v1.6.4
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[n,i]of Object.entries(e)){const o=r||n==="label"||n==="detail";a[n]=z(i,t,o)}return a}return e}function K(e){return Array.isArray(e.data)&&e.data.includes("$data")}function Ce(e,t){const r=typeof e.chartDataSource=="string"?e.chartDataSource:"",a=typeof e.dataSource=="string"?e.dataSource:"",n=r||a;if(n)return Array.isArray(t[n])?t[n]:[];for(const i of Object.values(t))if(Array.isArray(i))return i;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],n=Array.isArray(a)?a:a?[a]:[];for(const i of n)i&&typeof i=="object"&&Array.isArray(i.data)&&i.data.includes("$data")&&(i.data=[...t])}}function Ke(e,t,r,a,n){const i=F(e);if(!i.some(K))return;const o=t.map((c,u)=>r?c[r]:u+1),l=c=>a[Math.min(c,a.length-1)];if(n){const c=i[0],u=new Map;for(const d of t){const y=String(d[n]??""),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=i[i.length-1];for(;i.length<a.length;)i.push({...s,data:["$data"]});e.series=i.map((c,u)=>K(c)?{...c,data:t.map(f=>m(f,l(u)))}:c),Y(e,o)}function J(e,t,r,a,n){const i=F(e);if(!i.some(K))return;const o=t.map(l=>({name:r?String(l[r]??""):"",value:m(l,a)}));n&&o.sort((l,s)=>s.value-l.value),e.series=i.map(l=>({...l,data:o}))}function Te(e,t,r,a,n){const i=F(e);if(!i.some(K))return;const o=a[0],l=n?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=i.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 n=F(e);if(!n.some(K))return;const i=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(i[l])}))},e.series=n.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 n=t[0]??{};e.series=a.map(i=>({...i,data:[{value:m(n,r),name:r}]}))}function te(e,t,r){const a=t.chartOption;if(!a||typeof a!="object"||Array.isArray(a))return{};const n=z(a,r),i=xe(t.chartValueFields);if(i.length===0)return{_chartOption:n};const o=Ce(t,r);if(o.length===0)return{_chartOption:n};const l=X(t.chartCategoryField);switch(b(e)?.seriesType){case"radar":Oe(n,o,l,i);break;case"gauge":Ee(n,o,i[0]);break;case"funnel":J(n,o,l,i[0],!0);break;case"pie":J(n,o,l,i[0],!1);break;case"scatter":Te(n,o,l,i,t.chartBubble===!0);break;default:Ke(n,o,l,i,X(t.chartSeriesField));break}return{_chartOption:n}}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},ne=75,ie=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:`${ne}%`},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",n=t?.seriesType==="line"&&e==="areaChart",i=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:i,name:"数量",data:["$data"],...n?{areaStyle:{}}:{}}]}}}}function Fe(e){x.configurePlugin(L,e)}function R(){return x.getPluginConfig(L)}function Le(){const e=R().palettes??{},t=$.map(a=>{const n=e[a.key];return n?{key:a.key,label:n.label??a.label,labelKey:n.label?void 0:a.labelKey,colors:n.colors}:{key:a.key,label:a.label,labelKey:a.labelKey,colors:a.colors}}),r=Object.entries(e).filter(([a])=>!$.some(n=>n.key===a)).map(([a,n])=>({key:a,label:n.label??a,colors:n.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),n=[...oe()],i=[...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=[...n])}};switch(a?.seriesType){case"pie":l(()=>n.map((c,u)=>({name:c,value:i[u]??10})));break;case"funnel":l(()=>n.map((c,u)=>({name:c,value:i[u]??10})));break;case"scatter":l(()=>i.map(c=>[c,c+6]));break;case"radar":r.radar={...r.radar??{},indicator:n.map(c=>({name:c,max:30}))},l(()=>[{name:"示例",value:i}]);break;case"gauge":l(()=>[{value:i[0]??40,name:"数量"}]);break;default:l(()=>[...i]),s();break}return r}function ke(e,t){const r=Array.isArray(e?.color)?(e?.color).map(String):[];return t.find(n=>n.colors.every((i,o)=>i===r[o])&&r.length===n.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),n=Array.isArray(a.series)?a.series:[],i=b(r),o=n[0]??{type:i?.seriesType==="line"?"line":"bar",data:["$data"]};return a.series=Array.from({length:Math.max(t,1)},(l,s)=>({...o,...n[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 n=Ie(e&&typeof e=="object"?e:{}),i=C(t),o=C(r);return{top:D(n.top,o,O.top),right:D(n.right,i,O.right),bottom:D(n.bottom,o,O.bottom),left:D(n.left,i,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 n=a[0];return n.top=E(t.top),n.right=E(t.right),n.bottom=E(t.bottom),n.left=E(t.left),r.series=a,r}function je(e,t,r){const n=q((e&&typeof e=="object"?e:{}).radar).radius,i=Array.isArray(n)?n[n.length-1]:n,o=C(t),l=C(r),s=Math.min(o,l)/2;if(typeof i=="string"&&i.trim().endsWith("%")){const c=Number.parseFloat(i);if(Number.isFinite(c))return H(c)}return typeof i=="number"&&Number.isFinite(i)?W(i,s):ie}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),n=k(a[0]?.[M(t)]);G(n);const i={show:typeof n.show=="boolean"?n.show:r?Ue[r.seriesType]:!1,labelLine:k(a[0]?.labelLine)};for(const l of Ve){const s=n[l];l!=="offset"&&(typeof s=="string"||typeof s=="number")&&(i[l]=s)}const o=n.offset;return Array.isArray(o)&&typeof o[0]=="number"&&typeof o[1]=="number"&&(i.offset=[o[0],o[1]]),i}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??{}),n=Array.isArray(a.series)?a.series:[];if(!b(t)||n.length===0)return a;const o=M(t),{enabled:l,labelLine:s,...c}=r;for(const u of n){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),n=et(a.series);if(n.length===0)return a;const i=M(e);for(const s of n){const c=s[i];if(c&&typeof c=="object"&&!Array.isArray(c)){const u={...c};G(u),s[i]=u}}if(r.seriesType==="pie")return a.series=n.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=n.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=n.map(s=>({...s,type:"radar"})),a;if(r.seriesType==="funnel")return a.series=n.map(s=>({...s,type:"funnel",sort:"descending"})),a;if(r.seriesType==="gauge")return a.series=n.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=n.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 n=a[0],i=n.slice(4,-1),l=(/\sstyle\s*=\s*"([^"]*)"/i.exec(i)?.[1]??"").split(";").map(f=>f.trim()).filter(f=>f&&!/^(width|height|display)\s*:/i.test(f)).join(";"),s=i.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+n.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),n=B.init(null,null,{renderer:"svg",ssr:!0,width:r,height:a});try{const i=t.textStyle&&typeof t.textStyle=="object"&&!Array.isArray(t.textStyle)?t.textStyle:void 0,o={...e.fontFamily?{fontFamily:e.fontFamily}:{},...i??{}};return n.setOption({animation:!1,...t,...Object.keys(o).length>0?{textStyle:o}:{}}),fe(n.renderToSVGString(),r,a)}finally{n.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 nt="2";function ye(e=!1){return{chartOption:{kind:"object",get label(){return A.t("echarts.meta.chartOption")}},chartDataSource:{kind:"text",get label(){return A.t("echarts.meta.dataSource")}},chartCategoryField:{kind:"text",get label(){return A.t("echarts.meta.categoryField")}},chartValueFields:{kind:"object",get label(){return A.t("echarts.meta.valueFields")}},chartSeriesField:{kind:"text",get label(){return A.t("echarts.meta.seriesField")}},...e?{chartBubble:{kind:"bool",get label(){return A.t("echarts.meta.bubbleSize")}}}:{}}}const it=ye(),st=ye(!0),_=x.defineElementPlugin({id:L,version:nt,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"?st:it,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 i=x.registerElementPlugin(_);return w=i,i}const a={..._,designer:e??r?.designer??_.designer,render:{..._.render,...r?.render,...t}},n=x.registerElementPlugin(a);return w=n,n}function ot(e){return j(e)}function lt(e){return j(void 0,{executorBundle:e})}function ct(){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=ie;exports.FALLBACK_SAMPLE_CATEGORIES=re;exports.FUNNEL_PADDING_DEFAULTS=ae;exports.LABEL_POSITIONS=We;exports.LABEL_PRESETS=$e;exports.RADAR_RADIUS_DEFAULT=ne;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=ot;exports.registerChartExecutorBundle=lt;exports.registerChartPlugin=j;exports.renderChartElement=U;exports.renderChartToSvg=de;exports.resolveChartPanelFields=Ae;exports.syncSeriesCount=we;exports.uninstallChartPlugin=ct;exports.updateChartLabel=Ze;exports.writeFunnelPadding=Me;exports.writeRadarRadius=ze;