@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/units.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/version.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worm-print-platform/echarts",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "type": "module",
5
5
  "description": "兼容镜像包:源码唯一真源在 marketplace/plugins/echarts(@worm-print-platform/plugin-echarts),本包由同一源码生成,保留原包名与子路径供存量依赖方零改动使用",
6
6
  "main": "./dist/index.cjs",
@@ -39,6 +39,32 @@
39
39
  "files": [
40
40
  "dist"
41
41
  ],
42
+ "wormPrint": {
43
+ "id": "echarts",
44
+ "i18n": {
45
+ "dir": "dist/i18n",
46
+ "base": "zh-CN"
47
+ },
48
+ "version": "1.6.2",
49
+ "entry": "dist/marketplace.js",
50
+ "kinds": [
51
+ "barChart",
52
+ "barHChart",
53
+ "lineChart",
54
+ "areaChart",
55
+ "pieChart",
56
+ "doughnutChart",
57
+ "scatterChart",
58
+ "radarChart",
59
+ "funnelChart",
60
+ "gaugeChart"
61
+ ],
62
+ "exportFormats": [],
63
+ "peerDeps": {
64
+ "@worm-print-platform/core": "^1.6.2",
65
+ "@worm-print-platform/plugin-kit": "^1.6.2"
66
+ }
67
+ },
42
68
  "license": "MIT",
43
69
  "author": "worm <liu_long_qqcom@qq.com>",
44
70
  "repository": {
@@ -61,8 +87,8 @@
61
87
  "test:watch": "npm --prefix ../../marketplace/plugins/echarts run test:watch"
62
88
  },
63
89
  "dependencies": {
64
- "@worm-print-platform/core": "^1.6.0",
65
- "@worm-print-platform/plugin-kit": "^1.6.0",
90
+ "@worm-print-platform/core": "^1.6.2",
91
+ "@worm-print-platform/plugin-kit": "^1.6.2",
66
92
  "echarts": "^6.1.0"
67
93
  },
68
94
  "devDependencies": {
@@ -1,6 +0,0 @@
1
- /*!
2
- * @worm-print-platform/echarts v1.6.0
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 C=require("@worm-print-platform/core/designer"),ye=require("@worm-print-platform/core"),A=require("echarts/charts"),v=require("echarts/components"),he=require("echarts/core"),pe=require("echarts/renderers");function be(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 U=be(he),b=["left","top","width","height","chartOption"],P=["dataSource","categoryField","valueFields","seriesField"],g=["title","legend","palette"],I=[{type:"barChart",label:"柱状图",icon:"ChartColumn",seriesType:"bar",orientation:"vertical",fields:[...P,...g,"stack","label"],requiredOptionKeys:b,defaultWidth:100,defaultHeight:60,notes:"柱状图:类目 + 多个数值字段,每字段一个 series;series[].data 写 $data 占位;固定高,禁止 autoHeight"},{type:"barHChart",label:"条形图",icon:"ChartBar",seriesType:"bar",orientation:"horizontal",fields:[...P,...g,"stack","label"],requiredOptionKeys:b,defaultWidth:100,defaultHeight:60,notes:"横向条形图:xAxis 为数值、yAxis 为类目;类目写 yAxis.data 的 $data 占位"},{type:"lineChart",label:"折线图",icon:"ChartLine",seriesType:"line",fields:[...P,...g,"stack","label"],requiredOptionKeys:b,defaultWidth:100,defaultHeight:60,notes:"折线图:类目 + 多个数值字段;不写 areaStyle"},{type:"areaChart",label:"面积图",icon:"ChartArea",seriesType:"line",fields:[...P,...g,"stack","label"],requiredOptionKeys:b,defaultWidth:100,defaultHeight:60,notes:"面积图:折线 + series[].areaStyle;其余同折线图"},{type:"pieChart",label:"饼图",icon:"ChartPie",seriesType:"pie",fields:["dataSource","categoryField","valueFields",...g,"label"],requiredOptionKeys:b,defaultWidth:60,defaultHeight:60,notes:"饼图:类目 + 首个数值字段生成 { name, value };只需一个数值字段"},{type:"doughnutChart",label:"环形图",icon:"Donut",seriesType:"pie",fields:["dataSource","categoryField","valueFields",...g,"innerRadius","label"],requiredOptionKeys:b,defaultWidth:60,defaultHeight:60,notes:"环形图:饼图 + radius:[内径,外径];内径由面板配置"},{type:"scatterChart",label:"散点图",icon:"ChartScatter",seriesType:"scatter",fields:["dataSource","categoryField","valueFields",...g,"bubble","label"],requiredOptionKeys:b,defaultWidth:80,defaultHeight:60,notes:"散点图:类目字段作 x、首个数值字段作 y;chartBubble 开启时用第二个数值字段作点大小"},{type:"radarChart",label:"雷达图",icon:"Radar",seriesType:"radar",fields:["dataSource","categoryField","valueFields",...g,"radius","label"],requiredOptionKeys:b,defaultWidth:70,defaultHeight:60,notes:"雷达图:每个数值字段是一个维度(radar.indicator),每行数据是一个系列(类目字段作系列名);半径由面板写 radar.radius(%,默认 75)"},{type:"funnelChart",label:"漏斗图",icon:"Funnel",seriesType:"funnel",fields:["dataSource","categoryField","valueFields",...g,"padding","label"],requiredOptionKeys:b,defaultWidth:60,defaultHeight:60,notes:"漏斗图:类目 + 首个数值字段,按数值降序;四边内边距由面板写 series.left/right/top/bottom(%,右侧需留外置标签空间)"},{type:"gaugeChart",label:"仪表盘",icon:"Gauge",seriesType:"gauge",fields:["dataSource","valueFields",...g,"gaugeRange","label"],requiredOptionKeys:b,defaultWidth:60,defaultHeight:60,notes:"仪表盘:取首行数据的首个数值字段作指针值;min/max 由面板写入 series[0].min/max"}],ge=I.map(e=>e.type);function h(e){return I.find(t=>t.type===e)}function me(e){return h(e)?.fields??[]}function Ae(e){const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:0}function $(e,t,r=!1){if(typeof e=="string")return e.startsWith("$data")||r?e:e.includes("{")?ye.evaluateTemplate(e,t):e;if(Array.isArray(e))return e.map(a=>$(a,t,r));if(e&&typeof e=="object"){const a={};for(const[n,i]of Object.entries(e)){const s=r||n==="label"||n==="detail";a[n]=$(i,t,s)}return a}return e}function x(e){return Array.isArray(e.data)&&e.data.includes("$data")}function Se(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 V(e){return typeof e=="string"&&e.length>0?e:void 0}function Ce(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function L(e){return Array.isArray(e.series)?e.series:[]}function m(e,t){return t?Ae(e[t]):0}function X(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 xe(e,t,r,a,n){const i=L(e);if(!i.some(x))return;const s=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]??""),p=u.get(y)??new Map,G=String(d[r??""]);p.set(G,(p.get(G)??0)+m(d,l(0))),u.set(y,p)}const f=[...new Set(s)];e.series=[...u.entries()].map(([d,y])=>({...c,name:d,data:f.map(p=>y.get(String(p))??null)})),X(e,f);return}const o=i[i.length-1];for(;i.length<a.length;)i.push({...o,data:["$data"]});e.series=i.map((c,u)=>x(c)?{...c,data:t.map(f=>m(f,l(u)))}:c),X(e,s)}function Y(e,t,r,a,n){const i=L(e);if(!i.some(x))return;const s=t.map(l=>({name:r?String(l[r]??""):"",value:m(l,a)}));n&&s.sort((l,o)=>o.value-l.value),e.series=i.map(l=>({...l,data:s}))}function Te(e,t,r,a,n){const i=L(e);if(!i.some(x))return;const s=a[0],l=n?a[1]:void 0,o=l?t.map(d=>m(d,l)):[],c=o.length>0?Math.min(...o):0,u=o.length>0?Math.max(...o):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 p=[m(y,r),m(y,s)];return l?{value:p,symbolSize:f(m(y,l))}:p})}))}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 Ee(e,t,r,a){const n=L(e);if(!n.some(x))return;const i=a.map(s=>Math.max(0,...t.map(l=>m(l,s))));e.radar={...e.radar??{},indicator:a.map((s,l)=>({name:s,max:ve(i[l])}))},e.series=n.map(s=>({...s,data:t.map(l=>({name:r?String(l[r]??""):"",value:a.map(o=>m(l,o))}))}))}function Oe(e,t,r){const a=L(e);if(!a.some(x))return;const n=t[0]??{};e.series=a.map(i=>({...i,data:[{value:m(n,r),name:r}]}))}function ee(e,t,r){const a=t.chartOption;if(!a||typeof a!="object"||Array.isArray(a))return{};const n=$(a,r),i=Ce(t.chartValueFields);if(i.length===0)return{_chartOption:n};const s=Se({...t,dataSource:t.chartDataSource??t.dataSource},r);if(s.length===0)return{_chartOption:n};const l=V(t.chartCategoryField);switch(h(e)?.seriesType){case"radar":Ee(n,s,l,i);break;case"gauge":Oe(n,s,i[0]);break;case"funnel":Y(n,s,l,i[0],!0);break;case"pie":Y(n,s,l,i[0],!1);break;case"scatter":Te(n,s,l,i,t.chartBubble===!0);break;default:xe(n,s,l,i,V(t.chartSeriesField));break}return{_chartOption:n}}const F="@worm-print-platform/echarts",z=[{key:"default",label:"默认蓝",colors:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de"]},{key:"fresh",label:"清新绿",colors:["#2f9e6e","#5cc9a7","#9ad6c1","#f2c94c","#4a90e2"]},{key:"warm",label:"暖橙红",colors:["#f2704e","#f7a35c","#f7d56d","#c54e3f","#8f5a4a"]},{key:"purple",label:"紫灰",colors:["#7b61ff","#9b8cff","#c3baff","#596275","#8d99ae"]}],te=["示例一","示例二","示例三"],re={top:6,right:25,bottom:6,left:5},ae=75,ne=50,E={top:60,right:80,bottom:65,left:80},J={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 ie(e){const t=h(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:J,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:`${ae}%`},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(re)}]};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:J,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 Le(e){C.configurePlugin(F,e)}function R(){return C.getPluginConfig(F)}function Fe(){const e=R().palettes??{},t=z.map(a=>{const n=e[a.key];return n?{key:a.key,label:n.label??a.label,colors:n.colors}:{key:a.key,label:a.label,colors:a.colors}}),r=Object.entries(e).filter(([a])=>!z.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:te}function se(e,t){const r=R(),a=h(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:ie(e),chartDataSource:"",chartCategoryField:"name",chartValueFields:["value"],chartSeriesField:"",...t}}U.use([A.BarChart,A.LineChart,A.PieChart,A.ScatterChart,A.RadarChart,A.FunnelChart,A.GaugeChart,v.GridComponent,v.TooltipComponent,v.LegendComponent,v.TitleComponent,v.DatasetComponent,pe.SVGRenderer]);const Q=new Set;function Re(){const t=(R().components??[]).filter(r=>r!=null&&!Q.has(r));if(t.length!==0){U.use(t);for(const r of t)Q.add(r)}}const Pe=96/25.4;function S(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 ke(e,t){if(!t||typeof t!="object"||Array.isArray(t))return{};const r=T(t),a=h(e),n=[...oe()],i=[...De],s=Array.isArray(r.series)?r.series:[],l=c=>{for(const u of s)Array.isArray(u.data)&&u.data.includes("$data")&&(u.data=c(u))},o=()=>{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]),o();break}return r}function we(e,t){const r=Array.isArray(e?.color)?(e?.color).map(String):[];return t.find(n=>n.colors.every((i,s)=>i===r[s])&&r.length===n.colors.length)?.key??"default"}function B(e){return Array.isArray(e)?e[0]&&typeof e[0]=="object"?{...e[0]}:{}:e&&typeof e=="object"?{...e}:{}}function Ne(e,t,r){const a=T(e),n=Array.isArray(a.series)?a.series:[],i=h(r),s=n[0]??{type:i?.seriesType==="line"?"line":"bar",data:["$data"]};return a.series=Array.from({length:Math.max(t,1)},(l,o)=>({...s,...n[o]??{},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 le(e,t,r){return Math.min(r,Math.max(t,e))}function O(e){return`${le(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=S(t),s=S(r);return{top:D(n.top,s,E.top),right:D(n.right,i,E.right),bottom:D(n.bottom,s,E.bottom),left:D(n.left,i,E.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=O(t.top),n.right=O(t.right),n.bottom=O(t.bottom),n.left=O(t.left),r.series=a,r}function je(e,t,r){const n=B((e&&typeof e=="object"?e:{}).radar).radius,i=Array.isArray(n)?n[n.length-1]:n,s=S(t),l=S(r),o=Math.min(s,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,o):ne}function $e(e,t){const r=T(e);return r.radar={...B(r.radar),radius:O(le(t,20,100))},r}const ze=[{key:"value",label:"数值",formatter:"{c}"},{key:"name-value",label:"名称: 数值",formatter:"{b}: {c}"},{key:"name",label:"名称",formatter:"{b}"},{key:"percent",label:"百分比",formatter:"{d}%"}],We={bar:[{value:"top",label:"顶部"},{value:"inside",label:"内部"},{value:"insideTop",label:"内部顶端"},{value:"bottom",label:"底部"},{value:"insideBottom",label:"内部底端"},{value:"right",label:"右侧"},{value:"left",label:"左侧"},{value:"middle",label:"居中"}],line:[{value:"top",label:"顶部"},{value:"bottom",label:"底部"},{value:"inside",label:"内部"},{value:"left",label:"左侧"},{value:"right",label:"右侧"}],pie:[{value:"outside",label:"外侧"},{value:"inside",label:"内部"},{value:"center",label:"中心"}],scatter:[{value:"top",label:"顶部"},{value:"bottom",label:"底部"},{value:"left",label:"左侧"},{value:"right",label:"右侧"},{value:"inside",label:"内部"}],radar:[{value:"top",label:"顶部"},{value:"bottom",label:"底部"},{value:"left",label:"左侧"},{value:"right",label:"右侧"},{value:"inside",label:"内部"}],funnel:[{value:"outer",label:"外侧"},{value:"inner",label:"内部"},{value:"left",label:"左侧"},{value:"right",label:"右侧"},{value:"top",label:"顶部"},{value:"bottom",label:"底部"}],gauge:[]},Ke={bar:!1,line:!1,pie:!0,scatter:!1,radar:!1,funnel:!0,gauge:!0},Ue={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}},Be={barHChart:{position:"right",fontSize:12}},qe={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"]},Ge=["formatter","overflow","position","distance","rotate","offset","fontSize","fontWeight","color","backgroundColor","borderColor","borderWidth","borderRadius","padding"];function Ve(e){const t=e?.series;return Array.isArray(t)?t:[]}function w(e){return e&&typeof e=="object"&&!Array.isArray(e)?{...e}:{}}function q(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 h(e)?.seriesType==="gauge"?"detail":"label"}function Xe(e){const t=h(e);return t?qe[t.seriesType]:[]}function Ye(e,t){const r=h(t),a=Ve(e),n=w(a[0]?.[M(t)]);q(n);const i={show:typeof n.show=="boolean"?n.show:r?Ke[r.seriesType]:!1,labelLine:w(a[0]?.labelLine)};for(const l of Ge){const o=n[l];l!=="offset"&&(typeof o=="string"||typeof o=="number")&&(i[l]=o)}const s=n.offset;return Array.isArray(s)&&typeof s[0]=="number"&&typeof s[1]=="number"&&(i.offset=[s[0],s[1]]),i}function Je(e){const t=h(e);return t?{...Ue[t.seriesType],...Be[e]}:{}}function Z(e){return e==null||e===""}function Qe(e,t,r){const a=T(e??{}),n=Array.isArray(a.series)?a.series:[];if(!h(t)||n.length===0)return a;const s=M(t),{enabled:l,labelLine:o,...c}=r;for(const u of n){if(!u||typeof u!="object")continue;const f=w(u[s]);q(f),l===!0?Object.assign(f,{...Je(t),...f,show:!0}):l===!1&&(f.show=!1);for(const[d,y]of Object.entries(c))Z(y)?delete f[d]:f[d]=y;if(o){const d=w(u.labelLine);for(const[y,p]of Object.entries(o))Z(p)?delete d[y]:d[y]=p;u.labelLine=d}u[s]=f}return a}function Ze(e){return Array.isArray(e)?e.map(t=>({...t})):[]}function et(e,t){const r={...e,type:t?"value":"category"};return t?delete r.data:Array.isArray(r.data)||(r.data=["$data"]),r}function tt(e,t){const r={...e,type:t?"category":"value"};return t&&!Array.isArray(r.data)&&(r.data=["$data"]),t||delete r.data,r}function k(e,t){return Array.isArray(e)?e.map(r=>t({...r})):t(e&&typeof e=="object"?{...e}:{})}function ce(e,t){const r=h(e);if(!r)return t;const a=structuredClone(t),n=Ze(a.series);if(n.length===0)return a;const i=M(e);for(const o of n){const c=o[i];if(c&&typeof c=="object"&&!Array.isArray(c)){const u={...c};q(u),o[i]=u}}if(r.seriesType==="pie")return a.series=n.map(o=>({...o,type:"pie",...e==="doughnutChart"?{radius:o.radius??["40%","70%"]}:{}})),delete a.xAxis,delete a.yAxis,a;if(r.seriesType==="scatter")return a.series=n.map(o=>({...o,type:"scatter"})),a.xAxis=k(a.xAxis,o=>({...o,type:"value",data:void 0})),a.yAxis=k(a.yAxis,o=>({...o,type:"value",data:void 0})),a;if(r.seriesType==="radar")return a.series=n.map(o=>({...o,type:"radar"})),a;if(r.seriesType==="funnel")return a.series=n.map(o=>({...o,type:"funnel",sort:"descending"})),a;if(r.seriesType==="gauge")return a.series=n.map(o=>({...o,type:"gauge"})),a;const s=r.orientation==="horizontal",l=r.seriesType==="line"?"line":"bar";return a.xAxis=k(a.xAxis,o=>et(o,s)),a.yAxis=k(a.yAxis,o=>tt(o,s)),a.series=n.map(o=>{const c={...o,type:l};return e==="areaChart"?c.areaStyle=o.areaStyle??{}:delete c.areaStyle,c}),a}function ue(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(";"),o=i.replace(/\s(width|height|style|viewBox)\s*=\s*"[^"]*"/gi,"").trimEnd(),c=["display:block","width:100%","height:100%",l].filter(Boolean).join(";"),u=`<svg${o} 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 fe(e){Re();const t=ce(e.type,e.option);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("图表 option 非法:需要对象");const r=S(e.widthMm),a=S(e.heightMm),n=U.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,s={...e.fontFamily?{fontFamily:e.fontFamily}:{},...i??{}};return n.setOption({animation:!1,...t,...Object.keys(s).length>0?{textStyle:s}:{}}),ue(n.renderToSVGString(),r,a)}finally{n.dispose()}}function rt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function K(e){const t=e._chartOption??e.chartOption,r=`<span>${rt(String(e.title??"图表"))}</span>`;if(!t||typeof t!="object"||Array.isArray(t))return r;try{return fe({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 at="2",de={chartOption:{kind:"object",label:"图表 option"},chartDataSource:{kind:"text",label:"数据源"},chartCategoryField:{kind:"text",label:"类目字段"},chartValueFields:{kind:"object",label:"数值字段"},chartSeriesField:{kind:"text",label:"系列拆分字段"}},nt={...de,chartBubble:{kind:"bool",label:"气泡大小"}},_=C.defineElementPlugin({id:F,version:at,kinds:I.map(e=>({type:e.type,label:e.label,icon:e.icon,fixedHeight:!0,requiredOptionKeys:e.requiredOptionKeys,notes:e.notes,optionMeta:e.type==="scatterChart"?nt:de,defaultOptions:t=>se(e.type,t),binding:{bind:(t,r)=>ee(e.type,t,r)}})),render:{html:K,createRenderer:()=>({render:K})}});let N;function j(e,t){const r=C.getElementPluginById(F);if(!e&&!t){const i=C.registerElementPlugin(_);return N=i,i}const a={..._,designer:e??r?.designer??_.designer,render:{..._.render,...r?.render,...t}},n=C.registerElementPlugin(a);return N=n,n}function it(e){return j(e)}function ot(e){return j(void 0,{executorBundle:e})}function st(){N?.(),N=void 0}j();exports.CHART_KINDS=ge;exports.CHART_KIND_DEFINITIONS=I;exports.CHART_PALETTES=z;exports.CHART_PLUGIN=_;exports.CHART_PLUGIN_ID=F;exports.ECHARTS_FUNNEL_PADDING_PX=E;exports.ECHARTS_RADAR_RADIUS_DEFAULT=ne;exports.FALLBACK_SAMPLE_CATEGORIES=te;exports.FUNNEL_PADDING_DEFAULTS=re;exports.LABEL_POSITIONS=We;exports.LABEL_PRESETS=ze;exports.RADAR_RADIUS_DEFAULT=ae;exports.asObject=B;exports.bindChartData=ee;exports.chartFactoryDefaults=se;exports.cloneChartOption=T;exports.configureChartPlugin=Le;exports.createDefaultChartOption=ie;exports.fitSvgRoot=ue;exports.getChartKindDefinition=h;exports.getChartPalettes=Fe;exports.getChartPluginConfig=R;exports.getSampleCategories=oe;exports.labelFieldsOf=Xe;exports.labelTargetOf=M;exports.mmToChartPx=S;exports.normalizeChartOption=ce;exports.previewChartOption=ke;exports.readChartLabel=Ye;exports.readFunnelPadding=He;exports.readPaletteKey=we;exports.readRadarRadius=je;exports.registerChartDesigner=it;exports.registerChartExecutorBundle=ot;exports.registerChartPlugin=j;exports.renderChartElement=K;exports.renderChartToSvg=fe;exports.resolveChartPanelFields=me;exports.syncSeriesCount=Ne;exports.uninstallChartPlugin=st;exports.updateChartLabel=Qe;exports.writeFunnelPadding=Me;exports.writeRadarRadius=$e;