@worm-print-platform/echarts 1.5.3 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -1
- package/dist/bind.d.ts +1 -1
- package/dist/browser/executor.iife.d.ts +1 -1
- package/dist/browser-bundle.d.ts +1 -1
- package/dist/config.d.ts +3 -1
- package/dist/constants.d.ts +5 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/echarts.d.ts +1 -1
- package/dist/echarts.js +38 -14
- package/dist/executor.iife.global.d.ts +1 -1
- package/dist/executor.iife.global.js +29 -17
- package/dist/i18n/en-US.json +153 -0
- package/dist/i18n/th-TH.json +153 -0
- package/dist/i18n/zh-CN.json +153 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -12
- package/dist/kinds.d.ts +6 -2
- package/dist/kit.cjs +2 -2
- package/dist/kit.d.ts +3 -1
- package/dist/kit.js +45 -148
- package/dist/label.d.ts +65 -0
- package/dist/marketplace.d.ts +1 -1
- package/dist/marketplace.js +1361 -126
- package/dist/node.cjs +93 -39
- package/dist/node.d.ts +1 -1
- package/dist/node.js +93 -39
- package/dist/normalize.d.ts +1 -1
- package/dist/option-utils.d.ts +1 -1
- package/dist/plugin-8R67OtBD.cjs +6 -0
- package/dist/plugin-CKyaiHYF.js +960 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/renderer.d.ts +1 -1
- package/dist/test-setup.d.ts +7 -0
- package/dist/type-augmentation.d.ts +1 -1
- package/dist/ui.cjs +1973 -87
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +1953 -86
- package/dist/units.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +29 -3
- package/dist/plugin-Bf6QDbHO.cjs +0 -6
- package/dist/plugin-CUoE2jMs.js +0 -573
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @worm-print-platform/echarts v1.6.1
|
|
3
|
+
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
|
+
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
|
+
* SPDX-License-Identifier: MIT
|
|
6
|
+
*/"use strict";const A=require("@worm-print-platform/core/i18n"),x=require("@worm-print-platform/core/designer"),be=require("@worm-print-platform/core"),S=require("echarts/charts"),v=require("echarts/components"),he=require("echarts/core"),pe=require("echarts/renderers");function ge(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const B=ge(he),p=["left","top","width","height","chartOption"],P=["dataSource","categoryField","valueFields","seriesField"],g=["title","legend","palette"],I=[{type:"barChart",label:"柱状图",labelKey:"echarts.series.typeNames.bar",icon:"ChartColumn",seriesType:"bar",orientation:"vertical",fields:[...P,...g,"stack","label"],requiredOptionKeys:p,defaultWidth:100,defaultHeight:60,notes:"柱状图:类目 + 多个数值字段,每字段一个 series;series[].data 写 $data 占位;固定高,禁止 autoHeight",notesKey:"echarts.notes.bar"},{type:"barHChart",label:"条形图",labelKey:"echarts.series.typeNames.barH",icon:"ChartBar",seriesType:"bar",orientation:"horizontal",fields:[...P,...g,"stack","label"],requiredOptionKeys:p,defaultWidth:100,defaultHeight:60,notes:"横向条形图:xAxis 为数值、yAxis 为类目;类目写 yAxis.data 的 $data 占位",notesKey:"echarts.notes.barH"},{type:"lineChart",label:"折线图",labelKey:"echarts.series.typeNames.line",icon:"ChartLine",seriesType:"line",fields:[...P,...g,"stack","label"],requiredOptionKeys:p,defaultWidth:100,defaultHeight:60,notes:"折线图:类目 + 多个数值字段;不写 areaStyle",notesKey:"echarts.notes.line"},{type:"areaChart",label:"面积图",labelKey:"echarts.series.typeNames.area",icon:"ChartArea",seriesType:"line",fields:[...P,...g,"stack","label"],requiredOptionKeys:p,defaultWidth:100,defaultHeight:60,notes:"面积图:折线 + series[].areaStyle;其余同折线图",notesKey:"echarts.notes.area"},{type:"pieChart",label:"饼图",labelKey:"echarts.series.typeNames.pie",icon:"ChartPie",seriesType:"pie",fields:["dataSource","categoryField","valueFields",...g,"label"],requiredOptionKeys:p,defaultWidth:60,defaultHeight:60,notes:"饼图:类目 + 首个数值字段生成 { name, value };只需一个数值字段",notesKey:"echarts.notes.pie"},{type:"doughnutChart",label:"环形图",labelKey:"echarts.series.typeNames.doughnut",icon:"Donut",seriesType:"pie",fields:["dataSource","categoryField","valueFields",...g,"innerRadius","label"],requiredOptionKeys:p,defaultWidth:60,defaultHeight:60,notes:"环形图:饼图 + radius:[内径,外径];内径由面板配置",notesKey:"echarts.notes.doughnut"},{type:"scatterChart",label:"散点图",labelKey:"echarts.series.typeNames.scatter",icon:"ChartScatter",seriesType:"scatter",fields:["dataSource","categoryField","valueFields",...g,"bubble","label"],requiredOptionKeys:p,defaultWidth:80,defaultHeight:60,notes:"散点图:类目字段作 x、首个数值字段作 y;chartBubble 开启时用第二个数值字段作点大小",notesKey:"echarts.notes.scatter"},{type:"radarChart",label:"雷达图",labelKey:"echarts.series.typeNames.radar",icon:"Radar",seriesType:"radar",fields:["dataSource","categoryField","valueFields",...g,"radius","label"],requiredOptionKeys:p,defaultWidth:70,defaultHeight:60,notes:"雷达图:每个数值字段是一个维度(radar.indicator),每行数据是一个系列(类目字段作系列名);半径由面板写 radar.radius(%,默认 75)",notesKey:"echarts.notes.radar"},{type:"funnelChart",label:"漏斗图",labelKey:"echarts.series.typeNames.funnel",icon:"Funnel",seriesType:"funnel",fields:["dataSource","categoryField","valueFields",...g,"padding","label"],requiredOptionKeys:p,defaultWidth:60,defaultHeight:60,notes:"漏斗图:类目 + 首个数值字段,按数值降序;四边内边距由面板写 series.left/right/top/bottom(%,右侧需留外置标签空间)",notesKey:"echarts.notes.funnel"},{type:"gaugeChart",label:"仪表盘",labelKey:"echarts.series.typeNames.gauge",icon:"Gauge",seriesType:"gauge",fields:["dataSource","valueFields",...g,"gaugeRange","label"],requiredOptionKeys:p,defaultWidth:60,defaultHeight:60,notes:"仪表盘:取首行数据的首个数值字段作指针值;min/max 由面板写入 series[0].min/max",notesKey:"echarts.notes.gauge"}],me=I.map(e=>e.type);function b(e){return I.find(t=>t.type===e)}function Ae(e){return b(e)?.fields??[]}function Se(e){const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:0}function z(e,t,r=!1){if(typeof e=="string")return e.startsWith("$data")||r?e:e.includes("{")?be.evaluateTemplate(e,t):e;if(Array.isArray(e))return e.map(a=>z(a,t,r));if(e&&typeof e=="object"){const a={};for(const[i,n]of Object.entries(e)){const o=r||i==="label"||i==="detail";a[i]=z(n,t,o)}return a}return e}function K(e){return Array.isArray(e.data)&&e.data.includes("$data")}function Ce(e,t){const r=e.dataSource;if(typeof r=="string"&&Array.isArray(t[r]))return t[r];for(const a of Object.values(t))if(Array.isArray(a))return a;return[]}function X(e){return typeof e=="string"&&e.length>0?e:void 0}function xe(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function F(e){return Array.isArray(e.series)?e.series:[]}function m(e,t){return t?Se(e[t]):0}function Y(e,t){for(const r of["xAxis","yAxis"]){const a=e[r],i=Array.isArray(a)?a:a?[a]:[];for(const n of i)n&&typeof n=="object"&&Array.isArray(n.data)&&n.data.includes("$data")&&(n.data=[...t])}}function Ke(e,t,r,a,i){const n=F(e);if(!n.some(K))return;const o=t.map((c,u)=>r?c[r]:u+1),l=c=>a[Math.min(c,a.length-1)];if(i){const c=n[0],u=new Map;for(const d of t){const y=String(d[i]??""),h=u.get(y)??new Map,V=String(d[r??""]);h.set(V,(h.get(V)??0)+m(d,l(0))),u.set(y,h)}const f=[...new Set(o)];e.series=[...u.entries()].map(([d,y])=>({...c,name:d,data:f.map(h=>y.get(String(h))??null)})),Y(e,f);return}const s=n[n.length-1];for(;n.length<a.length;)n.push({...s,data:["$data"]});e.series=n.map((c,u)=>K(c)?{...c,data:t.map(f=>m(f,l(u)))}:c),Y(e,o)}function J(e,t,r,a,i){const n=F(e);if(!n.some(K))return;const o=t.map(l=>({name:r?String(l[r]??""):"",value:m(l,a)}));i&&o.sort((l,s)=>s.value-l.value),e.series=n.map(l=>({...l,data:o}))}function Te(e,t,r,a,i){const n=F(e);if(!n.some(K))return;const o=a[0],l=i?a[1]:void 0,s=l?t.map(d=>m(d,l)):[],c=s.length>0?Math.min(...s):0,u=s.length>0?Math.max(...s):0,f=d=>u===c?12:Math.round(6+(d-c)/(u-c)*18);e.series=n.map(d=>({...d,data:t.map(y=>{const h=[m(y,r),m(y,o)];return l?{value:h,symbolSize:f(m(y,l))}:h})}))}function ve(e){if(e<=0)return 10;const t=10**Math.floor(Math.log10(e)),r=t>=10?t:10;return Math.ceil(e/r)*r}function Oe(e,t,r,a){const i=F(e);if(!i.some(K))return;const n=a.map(o=>Math.max(0,...t.map(l=>m(l,o))));e.radar={...e.radar??{},indicator:a.map((o,l)=>({name:o,max:ve(n[l])}))},e.series=i.map(o=>({...o,data:t.map(l=>({name:r?String(l[r]??""):"",value:a.map(s=>m(l,s))}))}))}function Ee(e,t,r){const a=F(e);if(!a.some(K))return;const i=t[0]??{};e.series=a.map(n=>({...n,data:[{value:m(i,r),name:r}]}))}function te(e,t,r){const a=t.chartOption;if(!a||typeof a!="object"||Array.isArray(a))return{};const i=z(a,r),n=xe(t.chartValueFields);if(n.length===0)return{_chartOption:i};const o=Ce({...t,dataSource:t.chartDataSource??t.dataSource},r);if(o.length===0)return{_chartOption:i};const l=X(t.chartCategoryField);switch(b(e)?.seriesType){case"radar":Oe(i,o,l,n);break;case"gauge":Ee(i,o,n[0]);break;case"funnel":J(i,o,l,n[0],!0);break;case"pie":J(i,o,l,n[0],!1);break;case"scatter":Te(i,o,l,n,t.chartBubble===!0);break;default:Ke(i,o,l,n,X(t.chartSeriesField));break}return{_chartOption:i}}const L="@worm-print-platform/echarts",$=[{key:"default",label:"默认蓝",labelKey:"echarts.palette.default",colors:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de"]},{key:"fresh",label:"清新绿",labelKey:"echarts.palette.fresh",colors:["#2f9e6e","#5cc9a7","#9ad6c1","#f2c94c","#4a90e2"]},{key:"warm",label:"暖橙红",labelKey:"echarts.palette.warm",colors:["#f2704e","#f7a35c","#f7d56d","#c54e3f","#8f5a4a"]},{key:"purple",label:"紫灰",labelKey:"echarts.palette.purple",colors:["#7b61ff","#9b8cff","#c3baff","#596275","#8d99ae"]}],re=["示例一","示例二","示例三"],ae={top:6,right:25,bottom:6,left:5},ie=75,ne=50,O={top:60,right:80,bottom:65,left:80},Q={left:"8%",right:"8%",bottom:"12%",top:"18%",containLabel:!0};function _e(e){return{top:`${e.top}%`,right:`${e.right}%`,bottom:`${e.bottom}%`,left:`${e.left}%`}}function se(e){const t=b(e),r={text:""};switch(t?.seriesType){case"pie":return{title:r,tooltip:{trigger:"item"},series:[{type:"pie",name:"数量",data:["$data"],radius:e==="doughnutChart"?["40%","70%"]:"62%"}]};case"scatter":return{title:r,grid:Q,tooltip:{trigger:"axis"},xAxis:{type:"value"},yAxis:{type:"value"},series:[{type:"scatter",name:"数量",data:["$data"],symbolSize:8}]};case"radar":return{title:r,tooltip:{trigger:"item"},radar:{indicator:[],radius:`${ie}%`},series:[{type:"radar",name:"数量",data:["$data"]}]};case"funnel":return{title:r,tooltip:{trigger:"item"},legend:{show:!1},series:[{type:"funnel",name:"数量",data:["$data"],sort:"descending",..._e(ae)}]};case"gauge":return{title:r,tooltip:{trigger:"item"},series:[{type:"gauge",name:"数量",min:0,max:100,data:[{value:0,name:"数量"}]}]};default:{const a=t?.orientation==="horizontal",i=t?.seriesType==="line"&&e==="areaChart",n=t?.seriesType==="line"?"line":"bar";return{title:r,grid:Q,tooltip:{trigger:"axis"},xAxis:a?{type:"value"}:{type:"category",data:["$data"]},yAxis:a?{type:"category",data:["$data"]}:{type:"value"},series:[{type:n,name:"数量",data:["$data"],...i?{areaStyle:{}}:{}}]}}}}function Fe(e){x.configurePlugin(L,e)}function R(){return x.getPluginConfig(L)}function Le(){const e=R().palettes??{},t=$.map(a=>{const i=e[a.key];return i?{key:a.key,label:i.label??a.label,labelKey:i.label?void 0:a.labelKey,colors:i.colors}:{key:a.key,label:a.label,labelKey:a.labelKey,colors:a.colors}}),r=Object.entries(e).filter(([a])=>!$.some(i=>i.key===a)).map(([a,i])=>({key:a,label:i.label??a,colors:i.colors}));return[...t,...r]}function oe(){const e=R().sampleCategories;return Array.isArray(e)&&e.length>0?e:re}function le(e,t){const r=R(),a=b(e);return{width:typeof r.defaultWidth=="number"?r.defaultWidth:a?.defaultWidth??100,height:typeof r.defaultHeight=="number"?r.defaultHeight:a?.defaultHeight??60,title:a?.label??"图表",chartOption:se(e),chartDataSource:"",chartCategoryField:"name",chartValueFields:["value"],chartSeriesField:"",...t}}B.use([S.BarChart,S.LineChart,S.PieChart,S.ScatterChart,S.RadarChart,S.FunnelChart,S.GaugeChart,v.GridComponent,v.TooltipComponent,v.LegendComponent,v.TitleComponent,v.DatasetComponent,pe.SVGRenderer]);const Z=new Set;function Re(){const t=(R().components??[]).filter(r=>r!=null&&!Z.has(r));if(t.length!==0){B.use(t);for(const r of t)Z.add(r)}}const Pe=96/25.4;function C(e){const t=Number.isFinite(e)?e:0;return Math.max(1,Math.round(t*Pe))}const De=[12,20,15];function T(e){try{return JSON.parse(JSON.stringify(e))}catch{return e}}function Ne(e,t){if(!t||typeof t!="object"||Array.isArray(t))return{};const r=T(t),a=b(e),i=[...oe()],n=[...De],o=Array.isArray(r.series)?r.series:[],l=c=>{for(const u of o)Array.isArray(u.data)&&u.data.includes("$data")&&(u.data=c(u))},s=()=>{for(const c of["xAxis","yAxis"]){const u=Array.isArray(r[c])?r[c]:r[c]?[r[c]]:[];for(const f of u)f&&Array.isArray(f.data)&&f.data.includes("$data")&&(f.data=[...i])}};switch(a?.seriesType){case"pie":l(()=>i.map((c,u)=>({name:c,value:n[u]??10})));break;case"funnel":l(()=>i.map((c,u)=>({name:c,value:n[u]??10})));break;case"scatter":l(()=>n.map(c=>[c,c+6]));break;case"radar":r.radar={...r.radar??{},indicator:i.map(c=>({name:c,max:30}))},l(()=>[{name:"示例",value:n}]);break;case"gauge":l(()=>[{value:n[0]??40,name:"数量"}]);break;default:l(()=>[...n]),s();break}return r}function ke(e,t){const r=Array.isArray(e?.color)?(e?.color).map(String):[];return t.find(i=>i.colors.every((n,o)=>n===r[o])&&r.length===i.colors.length)?.key??"default"}function q(e){return Array.isArray(e)?e[0]&&typeof e[0]=="object"?{...e[0]}:{}:e&&typeof e=="object"?{...e}:{}}function we(e,t,r){const a=T(e),i=Array.isArray(a.series)?a.series:[],n=b(r),o=i[0]??{type:n?.seriesType==="line"?"line":"bar",data:["$data"]};return a.series=Array.from({length:Math.max(t,1)},(l,s)=>({...o,...i[s]??{},data:["$data"]})),a}const H=e=>Math.round(e*10)/10;function W(e,t){return t>0?H(e/t*100):0}function D(e,t,r){if(typeof e=="string"&&e.trim().endsWith("%")){const a=Number.parseFloat(e);if(Number.isFinite(a))return H(a)}return typeof e=="number"&&Number.isFinite(e)?W(e,t):W(r,t)}function ce(e,t,r){return Math.min(r,Math.max(t,e))}function E(e){return`${ce(H(e),0,100)}%`}function Ie(e){const r=(Array.isArray(e.series)?e.series:[])[0];return r&&typeof r=="object"?r:{}}function He(e,t,r){const i=Ie(e&&typeof e=="object"?e:{}),n=C(t),o=C(r);return{top:D(i.top,o,O.top),right:D(i.right,n,O.right),bottom:D(i.bottom,o,O.bottom),left:D(i.left,n,O.left)}}function Me(e,t){const r=T(e),a=Array.isArray(r.series)?r.series:[];a.length===0&&a.push({type:"funnel",data:["$data"]});const i=a[0];return i.top=E(t.top),i.right=E(t.right),i.bottom=E(t.bottom),i.left=E(t.left),r.series=a,r}function je(e,t,r){const i=q((e&&typeof e=="object"?e:{}).radar).radius,n=Array.isArray(i)?i[i.length-1]:i,o=C(t),l=C(r),s=Math.min(o,l)/2;if(typeof n=="string"&&n.trim().endsWith("%")){const c=Number.parseFloat(n);if(Number.isFinite(c))return H(c)}return typeof n=="number"&&Number.isFinite(n)?W(n,s):ne}function ze(e,t){const r=T(e);return r.radar={...q(r.radar),radius:E(ce(t,20,100))},r}const $e=[{key:"value",label:"数值",labelKey:"echarts.label.formatter.value",formatter:"{c}"},{key:"name-value",label:"名称: 数值",labelKey:"echarts.label.formatter.nameValue",formatter:"{b}: {c}"},{key:"name",label:"名称",labelKey:"echarts.label.formatter.name",formatter:"{b}"},{key:"percent",label:"百分比",labelKey:"echarts.label.formatter.percent",formatter:"{d}%"}],We={bar:[{value:"top",label:"顶部",labelKey:"echarts.label.position.bar.top"},{value:"inside",label:"内部",labelKey:"echarts.label.position.bar.inside"},{value:"insideTop",label:"内部顶端",labelKey:"echarts.label.position.bar.insideTop"},{value:"bottom",label:"底部",labelKey:"echarts.label.position.bar.bottom"},{value:"insideBottom",label:"内部底端",labelKey:"echarts.label.position.bar.insideBottom"},{value:"right",label:"右侧",labelKey:"echarts.label.position.bar.right"},{value:"left",label:"左侧",labelKey:"echarts.label.position.bar.left"},{value:"middle",label:"居中",labelKey:"echarts.label.position.bar.middle"}],line:[{value:"top",label:"顶部",labelKey:"echarts.label.position.line.top"},{value:"bottom",label:"底部",labelKey:"echarts.label.position.line.bottom"},{value:"inside",label:"内部",labelKey:"echarts.label.position.line.inside"},{value:"left",label:"左侧",labelKey:"echarts.label.position.line.left"},{value:"right",label:"右侧",labelKey:"echarts.label.position.line.right"}],pie:[{value:"outside",label:"外侧",labelKey:"echarts.label.position.pie.outside"},{value:"inside",label:"内部",labelKey:"echarts.label.position.pie.inside"},{value:"center",label:"中心",labelKey:"echarts.label.position.pie.center"}],scatter:[{value:"top",label:"顶部",labelKey:"echarts.label.position.scatter.top"},{value:"bottom",label:"底部",labelKey:"echarts.label.position.scatter.bottom"},{value:"left",label:"左侧",labelKey:"echarts.label.position.scatter.left"},{value:"right",label:"右侧",labelKey:"echarts.label.position.scatter.right"},{value:"inside",label:"内部",labelKey:"echarts.label.position.scatter.inside"}],radar:[{value:"top",label:"顶部",labelKey:"echarts.label.position.radar.top"},{value:"bottom",label:"底部",labelKey:"echarts.label.position.radar.bottom"},{value:"left",label:"左侧",labelKey:"echarts.label.position.radar.left"},{value:"right",label:"右侧",labelKey:"echarts.label.position.radar.right"},{value:"inside",label:"内部",labelKey:"echarts.label.position.radar.inside"}],funnel:[{value:"outer",label:"外侧",labelKey:"echarts.label.position.funnel.outer"},{value:"inner",label:"内部",labelKey:"echarts.label.position.funnel.inner"},{value:"left",label:"左侧",labelKey:"echarts.label.position.funnel.left"},{value:"right",label:"右侧",labelKey:"echarts.label.position.funnel.right"},{value:"top",label:"顶部",labelKey:"echarts.label.position.funnel.top"},{value:"bottom",label:"底部",labelKey:"echarts.label.position.funnel.bottom"}],gauge:[]},Ue={bar:!1,line:!1,pie:!0,scatter:!1,radar:!1,funnel:!0,gauge:!0},Be={bar:{position:"top",fontSize:12},line:{position:"top",fontSize:12},pie:{position:"outside",overflow:"none",fontSize:11},scatter:{position:"top",fontSize:11},radar:{position:"top",fontSize:10},funnel:{position:"outer",fontSize:11},gauge:{fontSize:14}},qe={barHChart:{position:"right",fontSize:12}},Ge={bar:["formatter","overflow","position","rotate","offset","fontSize","fontWeight","color","backgroundColor","borderColor","borderWidth","borderRadius","padding"],line:["formatter","overflow","position","rotate","offset","fontSize","fontWeight","color","backgroundColor","borderColor","borderWidth","borderRadius","padding"],pie:["formatter","overflow","position","distance","offset","fontSize","fontWeight","color","backgroundColor","borderColor","borderWidth","borderRadius","padding","labelLine.show","labelLine.length","labelLine.length2","labelLine.smooth"],scatter:["formatter","overflow","position","distance","rotate","offset","fontSize","fontWeight","color","backgroundColor","borderColor","borderWidth","borderRadius","padding"],radar:["formatter","fontSize","fontWeight","color"],funnel:["formatter","overflow","position","distance","fontSize","fontWeight","color","labelLine.show","labelLine.length","labelLine.smooth"],gauge:["formatter","fontSize","fontWeight","color","offset"]},Ve=["formatter","overflow","position","distance","rotate","offset","fontSize","fontWeight","color","backgroundColor","borderColor","borderWidth","borderRadius","padding"];function Xe(e){const t=e?.series;return Array.isArray(t)?t:[]}function k(e){return e&&typeof e=="object"&&!Array.isArray(e)?{...e}:{}}function G(e){typeof e.offsetX!="number"&&typeof e.offsetY!="number"||(Array.isArray(e.offset)||(e.offset=[typeof e.offsetX=="number"?e.offsetX:0,typeof e.offsetY=="number"?e.offsetY:0]),delete e.offsetX,delete e.offsetY)}function M(e){return b(e)?.seriesType==="gauge"?"detail":"label"}function Ye(e){const t=b(e);return t?Ge[t.seriesType]:[]}function Je(e,t){const r=b(t),a=Xe(e),i=k(a[0]?.[M(t)]);G(i);const n={show:typeof i.show=="boolean"?i.show:r?Ue[r.seriesType]:!1,labelLine:k(a[0]?.labelLine)};for(const l of Ve){const s=i[l];l!=="offset"&&(typeof s=="string"||typeof s=="number")&&(n[l]=s)}const o=i.offset;return Array.isArray(o)&&typeof o[0]=="number"&&typeof o[1]=="number"&&(n.offset=[o[0],o[1]]),n}function Qe(e){const t=b(e);return t?{...Be[t.seriesType],...qe[e]}:{}}function ee(e){return e==null||e===""}function Ze(e,t,r){const a=T(e??{}),i=Array.isArray(a.series)?a.series:[];if(!b(t)||i.length===0)return a;const o=M(t),{enabled:l,labelLine:s,...c}=r;for(const u of i){if(!u||typeof u!="object")continue;const f=k(u[o]);G(f),l===!0?Object.assign(f,{...Qe(t),...f,show:!0}):l===!1&&(f.show=!1);for(const[d,y]of Object.entries(c))ee(y)?delete f[d]:f[d]=y;if(s){const d=k(u.labelLine);for(const[y,h]of Object.entries(s))ee(h)?delete d[y]:d[y]=h;u.labelLine=d}u[o]=f}return a}function et(e){return Array.isArray(e)?e.map(t=>({...t})):[]}function tt(e,t){const r={...e,type:t?"value":"category"};return t?delete r.data:Array.isArray(r.data)||(r.data=["$data"]),r}function rt(e,t){const r={...e,type:t?"category":"value"};return t&&!Array.isArray(r.data)&&(r.data=["$data"]),t||delete r.data,r}function N(e,t){return Array.isArray(e)?e.map(r=>t({...r})):t(e&&typeof e=="object"?{...e}:{})}function ue(e,t){const r=b(e);if(!r)return t;const a=structuredClone(t),i=et(a.series);if(i.length===0)return a;const n=M(e);for(const s of i){const c=s[n];if(c&&typeof c=="object"&&!Array.isArray(c)){const u={...c};G(u),s[n]=u}}if(r.seriesType==="pie")return a.series=i.map(s=>({...s,type:"pie",...e==="doughnutChart"?{radius:s.radius??["40%","70%"]}:{}})),delete a.xAxis,delete a.yAxis,a;if(r.seriesType==="scatter")return a.series=i.map(s=>({...s,type:"scatter"})),a.xAxis=N(a.xAxis,s=>({...s,type:"value",data:void 0})),a.yAxis=N(a.yAxis,s=>({...s,type:"value",data:void 0})),a;if(r.seriesType==="radar")return a.series=i.map(s=>({...s,type:"radar"})),a;if(r.seriesType==="funnel")return a.series=i.map(s=>({...s,type:"funnel",sort:"descending"})),a;if(r.seriesType==="gauge")return a.series=i.map(s=>({...s,type:"gauge"})),a;const o=r.orientation==="horizontal",l=r.seriesType==="line"?"line":"bar";return a.xAxis=N(a.xAxis,s=>tt(s,o)),a.yAxis=N(a.yAxis,s=>rt(s,o)),a.series=i.map(s=>{const c={...s,type:l};return e==="areaChart"?c.areaStyle=s.areaStyle??{}:delete c.areaStyle,c}),a}function fe(e,t,r){const a=/<svg\b[^>]*>/i.exec(e);if(!a)return e;const i=a[0],n=i.slice(4,-1),l=(/\sstyle\s*=\s*"([^"]*)"/i.exec(n)?.[1]??"").split(";").map(f=>f.trim()).filter(f=>f&&!/^(width|height|display)\s*:/i.test(f)).join(";"),s=n.replace(/\s(width|height|style|viewBox)\s*=\s*"[^"]*"/gi,"").trimEnd(),c=["display:block","width:100%","height:100%",l].filter(Boolean).join(";"),u=`<svg${s} width="100%" height="100%" viewBox="0 0 ${t} ${r}" style="${c}">`;return e.slice(0,a.index)+u+e.slice(a.index+i.length)}function de(e){Re();const t=ue(e.type,e.option);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("图表 option 非法:需要对象");const r=C(e.widthMm),a=C(e.heightMm),i=B.init(null,null,{renderer:"svg",ssr:!0,width:r,height:a});try{const n=t.textStyle&&typeof t.textStyle=="object"&&!Array.isArray(t.textStyle)?t.textStyle:void 0,o={...e.fontFamily?{fontFamily:e.fontFamily}:{},...n??{}};return i.setOption({animation:!1,...t,...Object.keys(o).length>0?{textStyle:o}:{}}),fe(i.renderToSVGString(),r,a)}finally{i.dispose()}}function at(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function U(e){const t=e._chartOption??e.chartOption,r=`<span>${at(String(e.title??"图表"))}</span>`;if(!t||typeof t!="object"||Array.isArray(t))return r;try{return de({key:String(e.key??""),type:String(e.type??""),option:t,widthMm:Number(e.widthMm??0),heightMm:Number(e.heightMm??0),fontFamily:typeof e.fontFamily=="string"?e.fontFamily:void 0})}catch{return r}}const it="2",ye={chartOption:{kind:"object",label:A.t("echarts.meta.chartOption")},chartDataSource:{kind:"text",label:A.t("echarts.meta.dataSource")},chartCategoryField:{kind:"text",label:A.t("echarts.meta.categoryField")},chartValueFields:{kind:"object",label:A.t("echarts.meta.valueFields")},chartSeriesField:{kind:"text",label:A.t("echarts.meta.seriesField")}},nt={...ye,chartBubble:{kind:"bool",label:A.t("echarts.meta.bubbleSize")}},_=x.defineElementPlugin({id:L,version:it,kinds:I.map(e=>({type:e.type,get label(){return A.t(e.labelKey)},icon:e.icon,fixedHeight:!0,requiredOptionKeys:e.requiredOptionKeys,get notes(){return A.t(e.notesKey)},optionMeta:e.type==="scatterChart"?nt:ye,defaultOptions:t=>le(e.type,t),binding:{bind:(t,r)=>te(e.type,t,r)}})),render:{html:U,createRenderer:()=>({render:U})}});let w;function j(e,t){const r=x.getElementPluginById(L);if(!e&&!t){const n=x.registerElementPlugin(_);return w=n,n}const a={..._,designer:e??r?.designer??_.designer,render:{..._.render,...r?.render,...t}},i=x.registerElementPlugin(a);return w=i,i}function st(e){return j(e)}function ot(e){return j(void 0,{executorBundle:e})}function lt(){w?.(),w=void 0}j();exports.CHART_KINDS=me;exports.CHART_KIND_DEFINITIONS=I;exports.CHART_PALETTES=$;exports.CHART_PLUGIN=_;exports.CHART_PLUGIN_ID=L;exports.ECHARTS_FUNNEL_PADDING_PX=O;exports.ECHARTS_RADAR_RADIUS_DEFAULT=ne;exports.FALLBACK_SAMPLE_CATEGORIES=re;exports.FUNNEL_PADDING_DEFAULTS=ae;exports.LABEL_POSITIONS=We;exports.LABEL_PRESETS=$e;exports.RADAR_RADIUS_DEFAULT=ie;exports.asObject=q;exports.bindChartData=te;exports.chartFactoryDefaults=le;exports.cloneChartOption=T;exports.configureChartPlugin=Fe;exports.createDefaultChartOption=se;exports.fitSvgRoot=fe;exports.getChartKindDefinition=b;exports.getChartPalettes=Le;exports.getChartPluginConfig=R;exports.getSampleCategories=oe;exports.labelFieldsOf=Ye;exports.labelTargetOf=M;exports.mmToChartPx=C;exports.normalizeChartOption=ue;exports.previewChartOption=Ne;exports.readChartLabel=Je;exports.readFunnelPadding=He;exports.readPaletteKey=ke;exports.readRadarRadius=je;exports.registerChartDesigner=st;exports.registerChartExecutorBundle=ot;exports.registerChartPlugin=j;exports.renderChartElement=U;exports.renderChartToSvg=de;exports.resolveChartPanelFields=Ae;exports.syncSeriesCount=we;exports.uninstallChartPlugin=lt;exports.updateChartLabel=Ze;exports.writeFunnelPadding=Me;exports.writeRadarRadius=ze;
|