@ecan-bi/tools 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +685 -693
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @ecan-bi/tools@1.0.
|
|
2
|
-
(function(
|
|
3
|
-
`),
|
|
4
|
-
`))==null?void 0:
|
|
5
|
-
`;let s=e;if(l!=null&&l.length){for(const d of l){const i=Z(d,{textData:o},{useNewline:!1,useSpace:!1});i&&(s=s.replace(d,i))}return`${m}{text|${s}}`}else return e};function Je(e){let o="",l="",t="",m="";e.indexOf(".")>-1?(l=e.split(".")[0],t=e.split(".")[1]):l=e;let s=0,a=0;for(a=l.length-1;a>=0;)s%3===0&&s!==0?l[a]==="-"?o+=l[a]:o+=","+l[a]:o+=l[a],a--,s++;return o=o.split("").reverse().join(""),e.indexOf(".")>-1?m=o+"."+t:m=o,m}function Ze(s){return Qe(this,arguments,function*({graphicConfig:e,request:o,INDICATOR_URL:l="",PAGE_ID:t,dataSourceId:m}){var a;try{const{leftAxisList:d=[],rightAxisList:i=[],queryColumnList:n=[],indicators:f=[]}=L.unref(e),r=[...d,...i,...n,...f],b={};for(const u of r){const{indexCode:S="",parentId:A=""}=u;A&&!R(u,"calcType")&&!b[A]&&(b[A]=S)}if((a=Object.keys(b))!=null&&a.length){const u=[];for(const x in b)u.push(new Promise((c,y)=>{o.post(`${l}/diagram/hrpIndexWithComplex`,{pageId:t,indexGuid:x,indexCode:b[x],dataSourceId:m}).then(g=>{var h;const{success:w,data:V=[]}=g.data;w&&((h=V==null?void 0:V.dataViewColumns)!=null&&h.length)?c(V.dataViewColumns):y(V)}).catch(g=>{y(g)})}));return(yield Promise.all(u)).reduce((x,c)=>x.filter(y=>c.find(g=>g.typeGuid===y.typeGuid))).filter(x=>x.typeGuid)}}catch(d){}return[]})}const Oe=["table","bar","combograph","line","pie","radar","scatter","list","circulate"];let Ce=new Map;const el=["keyValue","conditionKey","conditionLabel","conditionName","conditionValueType","customValue","id","keyName"],se=e=>Ce.get(e),ll=(e,o={})=>{const{around:l,unit:t,id:m}=e;let s="";const{pageMode:a="",componentList:d=[]}=(o==null?void 0:o.graphicConfig)||{};let i=null,n=null;if(a==="design"){const f=d==null?void 0:d.find(c=>c.id===m);if(!f)return[];const{interval:r,intervalUnit:b,startTime:u,endTime:S,operate:A,useCurrentTime:x}=f||{};if(x&&(i=F().subtract(r,b),n=F()),u&&(i=F(u)),S&&(n=F(S)),A){const{type:c,value:y,mode:g}=A;switch(c){case"add":i=i&&i.add(y,g),n=n&&n.add(y,g);break;case"minus":i=i&&i.subtract(y,g),n=n&&n.subtract(y,g)}}}else{const f=se(m)||{};L.unref(f.startTime)&&(i=F(L.unref(f.startTime))),L.unref(f.endTime)&&(n=F(L.unref(f.endTime)))}if(i&&n){const f=n.diff(i,t.toLowerCase());s=`${l==="before"?"-":""}${f+1}`}return s?[s]:[]},Te=(e,o)=>{if(o)R(e,"indexCode")&&(e.hrpIndexCode=e.indexCode,delete e.indexCode),R(e,"indexCodeNum")&&(e.hrpIndexCodeNum=e.indexCodeNum,delete e.indexCodeNum),R(e,"dataType")&&delete e.dataType;else{const{calcWays:l=[],dateCalcTypes:t=[],activeKey:m,componentId:s=""}=e;if(m===5&&(l!=null&&l.length)&&(t!=null&&t.length)&&s){const a=l[0].split("-");(a==null?void 0:a.length)>1&&a[0]==="rangeValue"&&(e.calcWays=ll({around:a[1],unit:t[0],id:s})),delete e.radioValue}if(R(e,"dataType")){if(e.fieldType==="DATE"&&(e.label=e.fieldName),e.dataType==="component")if(e.fieldValue==="PARENT"){let a=e.modelKey;a&&e.prop&&(a+=`-${e.prop}`),e.fieldValue="${"+a+"}"}else e.fieldValue="${"+e.fieldValue+"}";delete e.dataType}R(e,"activeKey")&&delete e.activeKey,R(e,"radioValue")&&delete e.radioValue,R(e,"indexCode")&&(e.hrpIndexCode=e.indexCode,delete e.indexCode),R(e,"indexCodeNum")&&(e.hrpIndexCodeNum=e.indexCodeNum,delete e.indexCodeNum),e.dataType!=="component"&&e.useCurrentTime&&(e.fieldValue=F().format(e.dateFormat)),R(e,"modelKey")&&delete e.modelKey,R(e,"prop")&&delete e.prop,delete e.useCurrentTime}},oe=(e,o)=>{const l=[];return e!=null&&e.length&&G.cloneDeep(e).forEach(t=>{if(t.join&&t.conditions){const m=!t.conditions.some(s=>s.join&&s.conditions);t.conditions.forEach((s,a)=>{Te(s,o);const d={};if(a<t.conditions.length-1&&(d.join=t.join),m)l.push(T(T({},d),s));else if(s.join&&s.conditions){const i=o?"sqlConditions":"conditions";l.push(T({[i]:oe([s],o)},d))}else l.push(T(T({},d),s))})}else Te(t,o),l.push(t)}),l},ge=(e={},o)=>{if(e!=null&&e.sortCpnts&&o){const w=Fe(e);w&&(o.sort=w)}const{label:l,name:t,location:m,show:s,indexCode:a,indexCodeNum:d,calcType:i="COLUMN",builtInFormula:n,builtInValueSource:f,builtInCalcWay:r,formula:b,conditions:u,aggregate:S,distinct:A,dimByCount:x,dataTo:c}=e;let y;if(u&&(y=oe(u)),i==="COMPONENT"){const w={};return ue(w,f),{label:l.trim(),columnName:t,show:s,calcType:i,componentAlias:r,componentValue:w.fieldValue||null}}const g={label:l.trim(),columnName:t,location:m,show:s,calcType:c==="1"?"VIEW":i,hrpIndexCode:a,hrpIndexCodeNum:d,aggregate:S,builtInFormula:n,builtInValueSource:f,formula:b,conditions:y};if(n==="DATE_OFFSET"){const w=r.split("-");if((w==null?void 0:w.length)===3){let V=w[0];return w[2]==="before"&&w[0]!=="0"&&(V=`-${w[0]}`),_(T({},g),{calcWays:[V],dateCalcTypes:[w[1]]})}}else return t==="the_count"&&(g.calcType="AGGREGATE",g.distinct=!!A,g.typeGuid=x),_(T({},g),{builtInCalcWay:r})},ol=e=>{if(!e)return[];const o=G.cloneDeep((e==null?void 0:e.controlList)||[]).filter(S=>S.conditionKey!=="parentCode"),{classificationList:l=[],rowHeaderList:t=[],dimensionList:m=[],seriesList:s=[],leftAxisList:a=[],rightAxisList:d=[],queryColumnList:i=[],indicators:n=[]}=e;Ne(o);const f=[...l,...t,...m,...s,...a,...d,...i,...n],r=[];for(const S of f){const A=$((S==null?void 0:S.conditions)||[]);if(A!=null&&A.length){const x=A.filter(c=>(c==null?void 0:c.dataType)==="component").map(c=>{const y={};return c!=null&&c.dateFormat&&(y.format=c.dateFormat),c.fieldValue==="PARENT"&&(y.id="PARENT",y.keyName=c.modelKey,y.modelKey=c.modelKey,y.prop=c.prop),T({conditionKey:c.fieldName,conditionLabel:c.fieldName,conditionName:c.fieldName,conditionValueType:c.fieldType,id:c.componentId,keyName:c.fieldValue,rule:c.rule,notGlobal:!0,indexCode:c.indexCode,typeGuid:c.typeGuid,indexCodeNum:c.indexCodeNum},y)});if(x!=null&&x.length)for(const c of x)r.find(y=>y.keyName===c.keyName)||r.push(c)}}const b=r.length,u=o;for(let S=0;S<b;S++){const A=r[S];if((A==null?void 0:A.conditionKey)==="parentCode")continue;const{id:x,keyName:c,prop:y,format:g,modelKey:w,dataType:V="component",customValue:h}=A,Y=pe(A);ue(Y,x,{prop:y,dateFormat:g,modelKey:w,keyName:c}),V===""&&(Y.fieldValue=h||""),u.push(Y)}for(let S=u.length-1;S>=0;S--){const A=u[S];A.globalCondition||$(u).find(c=>c.alias===A.alias&&c.globalCondition)&&u.splice(S,1)}return u};function pe(e){const{id:o,keyName:l,conditionLabel:t,conditionKey:m,conditionValueType:s,prop:a,rule:d="NONE",notGlobal:i=!1,indexCode:n,typeGuid:f,indexCodeNum:r,dataType:b="component"}=e;let u=l||o;u&&a&&(u+=`-${a}`);let S=d;return S==="NONE"&&(["startTime","endTime"].includes(a)?S=a==="startTime"?"GREATER_EQUAL":"LESS_EQUAL":l!=null&&l.includes("startTime")?S=a==="GREATER_EQUAL":l!=null&&l.includes("endTime")?S=a==="LESS_EQUAL":S="EQUAL"),o==="PARENT"&&(u=e.modelKey,u&&a&&(u+=`-${a}`),S=d),{rule:S,label:t,fieldName:m,fieldValue:"",valueType:s,alias:u,globalCondition:!i,indexCode:n,typeGuid:f,indexCodeNum:r,dataType:b}}function Ne(e){if(e!=null&&e.length)for(const o of e)if(o!=null&&o.conditions)Ne(o.conditions);else{const{id:l,keyName:t,prop:m,modelKey:s,format:a,dataType:d="component",customValue:i}=o,n=pe(o);ue(n,l,{prop:m,dateFormat:a,modelKey:s,keyName:t}),d===""&&(n.fieldValue=i||"");for(const f in n)o[f]=n[f];for(const f of el)delete o[f]}}function tl(e){const o=[];if(e!=null&&e.length){for(const l of e)if(l.variableName){const t={variateName:l.variableName,globalCondition:!1,valueType:l.variableType,alias:l.keyName||""};ue(t,l.id,{dateFormat:l.format,prop:l.dateTypeValue,keyName:l.keyName,operateType:l.operateType,operateMode:l.operateMode,operateValue:l.operateValue}),l.dataType===""&&(t.fieldValue=l.variableValue),l.format&&(t.dateFormat=l.format),l.label&&(t.label=l.label),o.push(t)}}return o}function ue(e,o,l){const{prop:t="",dateFormat:m="",modelKey:s="",keyName:a="",operateValue:d,operateMode:i,operateType:n}=l||{},f=s||a;if(o==="PARENT"&&f&&t){const y=window.config.record;let g=t,w=m;const V=t.match(/\{(.+?)\}/g);if(V!=null&&V.length){const h=V[0].slice(1,-1).trim();g=t.replace(V[0],""),w=h,e.dateFormat=w}if(y&&y[f]){const h=L.unref(y[f][g]);F.isDayjs(h)?e.fieldValue=h.format(w||"YYYY-MM-DD"):e.fieldValue=h}return}const r=se(o)||{},{value:b,format:u="YYYY-MM-DD",type:S="",useCurrentTime:A,RECORD:x}=r||{},c=m||u;if(B(r.type,"date")){let y;if(A?b?y=L.unref(b):y=F():y=L.unref(b),d&&i&&n)switch(n){case"add":y=y.add(d,i);break;case"minus":y=y.subtract(d,i);break}e.fieldValue=y==null?void 0:y.format(c),e.dateFormat=c}else if(S==="ecanRangePicker"){let y=t;if(!t){const w=a&&a.split("-");w!=null&&w.length&&(y=w[w.length-1])}if(!y)return;let g=null;if(L.unref(r[y])&&(g=F(L.unref(r[y]))),d&&i&&n){if(d==="rangeValue"){if(r.startTime&&r.endTime){const w=L.unref(r.endTime).diff(L.unref(r.startTime),i)+1;switch(n){case"add":g=g&&g.add(w,i);break;case"minus":g=g&&g.subtract(w,i)}}}else if(!isNaN(+d))switch(n){case"add":g=g&&g.add(d,i);break;case"minus":g=g&&g.subtract(d,i)}}if(g&&(e.fieldValue=g==null?void 0:g.format(c)),y==="rangeValue"&&r.startTime&&r.endTime){const w=de(c);w&&(e.fieldValue=L.unref(r.endTime).diff(L.unref(r.startTime),w)+1)}e.dateFormat=c}else B(S,Oe)?s&&x?e.fieldValue=x[s]:!s&&x?e.fieldValue=x.value:e.fieldValue=L.unref(b):e.fieldValue=L.unref(b)}const ce=e=>{var o;if(e){const l=Array.isArray(e)?G.cloneDeep(e):[G.cloneDeep(e)];let t="",m=[];const s=[],a=[],d=[];for(const i of l){if(i.defaultCode&&(i.label=i.columnName,delete i.defaultCode),i.type==="CUSTOM"&&(m=i.customOrderColumns),t=i.type,s.push(i.label),(o=i.columnName)!=null&&o.includes("_ecanrepeat_")){const n=i.columnName.split("_ecanrepeat_");a.push(n[0])}else a.push(i.columnName);d.push(i.order)}return t!=="CUSTOM"&&(s==null?void 0:s.length)>1&&(t="COMBINATION"),t==="CUSTOM"?{label:s.join(","),columnName:a.join(","),type:t,customOrderColumns:m}:{label:s.join(","),columnName:a.join(","),order:d.join(","),type:t}}else return e},Fe=e=>{const{sortCpnts:o=[]}=e;let l,t="";for(const m of o){const s=se(m)||{},{type:a,RECORD:d}=s;if(B(a,"image")&&B(d==null?void 0:d.value,["asc","desc"])){t=d.value.toUpperCase();break}}return t&&(l={label:e.label,columnName:e.name,order:t,type:"NORMAL"}),l},nl={formatIndicatorParams:(e,o={})=>{var Me,ve,Ee,De,Ge,Re,Ye,Ue,We,je;const{graphicConfig:l,type:t,globalModel:m,isGroupTable:s=!1}=e;m&&(Ce=m);let a=e.pageId;const d=B(t,"pivottable");let{source:i,dataViewId:n,plugin:f="1",layer:r,chartType:b,classificationList:u=[],rowHeaderList:S=[],dimensionList:A=[],seriesList:x=[],leftAxisList:c=[],rightAxisList:y=[],queryColumnList:g=[],indicators:w=[],controlList:V=[],formFields:h={},variableList:Y=[],variableConditions:ne=[],idxLibMode:me,preview:be=!1,edvDataSetId:ke}=l||{},v=[];if((l==null?void 0:l.pageMode)==="design"?(v=((Me=l.sqlConditions)!=null?Me:[]).map(C=>{const p={};if(!R(C,"globalCondition")&&!C.join&&(p.globalCondition=!0),!C.join){const N=C.rule||"EQUAL";p.rule=N==="NONE"?"EQUAL":N}return T(T({},C),p)}),ne!=null&&ne.length&&(v=v.concat(ne))):(v=ol(l),Y!=null&&Y.length&&(v=v.concat(tl(Y)))),v!=null&&v.length){const C=v.filter(N=>N.globalCondition),p=v.filter(N=>!N.globalCondition);(C==null?void 0:C.length)>1&&(v=[{join:"&&",conditions:C},...p])}v!=null&&v.length&&(v=oe(v,"1")),r==null&&(B(t,["table","card"])||B(t,["list","circulate"])&&(u==null?void 0:u.length)>1?r="1":B(t,["select","checkbox","radio"])?r="3":r="2");let q;const Ve=[];let Se="";if(Array.isArray(u)&&u.length>0&&(!["ecanList","ecanCirculate"].includes(t)||(u==null?void 0:u.length)===1)){const C=u.length;for(let p=0;p<C;p++){const N=u[p]||{},{label:K="",name:U="",show:W=!1,sort:X,customGroup:O,conditions:I,dateFormat:M,typeGuid:j="",truncations:D=[]}=N;if(W||C===1){Se=j,q={label:K.trim(),columnName:U,show:W,sort:Fe(N)||ce(X)||X,customGroup:O,conditions:oe(I),typeGuid:j},M&&(q.dateFormat=M),U==="the_date"&&!q.dateFormat&&(q.dateFormat="YYYY-MM");const E={};if(Array.isArray(D)&&D.length>0){const H=D.length;for(let P=0;P<H;P++){const Q=D[P]||{},{rule:J="",num:ee=0,name:re=""}=Q;J&&ee&&(E.num=ee,E.rule=J,re&&(E.otherGroupName=re))}}if((ve=Object.keys(E))!=null&&ve.length&&(q.truncation=E),B(t,["scatter","valueline"]))Ve.push(q);else break}}}let Ie;if(Array.isArray(x)&&x.length>0){const C=x.length;for(let p=0;p<C;p++){const N=x[p]||{},{label:K="",name:U="",show:W=!1,sort:X,customGroup:O,conditions:I,typeGuid:M}=N;if(W||C===1){Ie={label:K.trim(),columnName:U,show:W,sort:ce(X),customGroup:O,conditions:oe(I),typeGuid:M};break}}}const z=[];c==null||c.forEach(C=>{C.location="LEFT",z.push(ge(C,q))}),y==null||y.forEach(C=>{C.location="RIGHT",z.push(ge(C,q))});let ye=w;(De=(Ee=o==null?void 0:o.pivotTableCal)==null?void 0:Ee.indicators)!=null&&De.length&&(ye=o.pivotTableCal.indicators),ye==null||ye.forEach(C=>{C.location="LEFT",z.push(ge(C,q))});const le=[];["ecanList","ecanCirculate"].includes(t)&&(u==null?void 0:u.length)>1&&(g=u),(Re=(Ge=o==null?void 0:o.pivotTableCal)==null?void 0:Ge.dimensions)!=null&&Re.length&&(g=o.pivotTableCal.dimensions),g==null||g.forEach(C=>{const{label:p,name:N,location:K,show:U,indexCode:W,sort:X,typeGuid:O,indexCodeNum:I,dateFormat:M,conditions:j}=C;let D=ce(X);if(o.sort){const{field:H,order:P}=o.sort;let Q=z.find(J=>J.label===H);!Q&&p===H&&(Q=C),Q&&(D={columnName:Q.columnName,label:o.sort.field,order:P.toUpperCase(),type:"NORMAL"})}const E={label:p,columnName:N,location:K,show:U,sort:D,calcType:"COLUMN",hrpIndexCode:W,hrpIndexCodeNum:I,conditions:oe(j),typeGuid:O};M&&(E.dateFormat=M),N==="the_date"&&!E.dateFormat&&(E.dateFormat="YYYY-MM"),le.push(E)});let fe=[],ie=[];if(Array.isArray(S)&&S.length>0?ie=S:Array.isArray(A)&&A.length>0&&(ie=A),ie!=null&&ie.length){const C=ie.length;for(let p=0;p<C;p++){const N=ie[p]||{},{label:K="",name:U="",show:W=!1,sort:X,customGroup:O,conditions:I,truncations:M,typeGuid:j="",dateFormat:D}=N;let E=ce(X);if(o.sort){const{field:Q,order:J}=o.sort;let ee=z.find(re=>re.label===Q);!ee&&N.label===Q&&(ee=N),ee&&(E={columnName:ee.columnName,label:o.sort.field,order:J.toUpperCase(),type:"NORMAL"})}const H={label:K.trim(),columnName:U,show:W,sort:E,customGroup:O,conditions:oe(I),typeGuid:j};D&&(H.dateFormat=D),U==="the_date"&&!H.dateFormat&&(H.dateFormat="YYYY-MM");const P={};if(Array.isArray(M)&&M.length>0){const Q=M.length;for(let J=0;J<Q;J++){const ee=M[J]||{},{rule:re="",num:_e=0,name:ze=""}=ee;re&&_e&&(P.num=_e,P.rule=re,ze&&(P.otherGroupName=ze))}}(Ye=Object.keys(P))!=null&&Ye.length&&(H.truncation=P),fe.push(H)}}let Ae=[],he;if(o!=null&&o.pivotTableCal){let C=[];const{calc:p=[],filter:N=[],truncations:K=[],sorts:U=[],aggregateMethod:W=[],rowDimensionKeys:X=[],colDimensionKeys:O=[]}=o.pivotTableCal;if(z.push(...p),N!=null&&N.length)for(const I of N){const Be=I,{type:M}=Be,j=we(Be,["type"]);M==="indicators"?C=z:M==="dimension"&&(C=le);const D=C.find(E=>E.columnName===I.fieldName);D&&(D.conditions||(D.conditions=[]),D.conditions.push(j))}if(K!=null&&K.length)for(const I of K){const M=le.find(j=>j.columnName===I.key);M&&(M.truncation={num:I.num,rule:I.rule})}if(U!=null&&U.length)for(const I of U){const Ke=I,{fieldType:M,columnData:j}=Ke,D=we(Ke,["fieldType","columnData"]);M==="indicators"?(C=z,he=j):M==="dimension"&&(C=le);const E=C.find(H=>H.label===D.label);E&&(E.sort=_(T({},D),{columnName:E.columnName}))}if((Ue=Object.keys(W))!=null&&Ue.length)for(const I in W){const M=le.find(j=>j.label===I);M&&((We=W[I])!=null&&We.length)&&(M.aggregateMethod=W[I])}fe=[],Ae=[];for(const I of le)X.includes(I.columnName)?fe.push(I):O.includes(I.columnName)&&Ae.push(I)}if(B(t,["text","proportion","counter"])?b="zb":B(t,["valueline"])&&(b="valueline"),s||t==="card"){if(fe.length===0||z.length===0)return;b="grouptable"}else{if(r==="1"&&le.length===0)return;if(r==="2"&&z.length===0)return;if(r==="3"&&(!Se&&i!=="EDV_DATA_SET"||!h.labelField||!h.valueField))return;if(r==="3"&&t==="ecanDataSelect"&&z.length===0)return}if(A!=null&&A.length&&(r="1",b="grouptable"),!a){const{pathname:C}=window==null?void 0:window.location;if(C){const p=C.split("/");p!=null&&p.length&&(a=p[p.length-1])}}let Le;if(!B(t,["scatter","valueline"])&&((je=Object.keys(h))!=null&&je.length)){const C=$(V).find(N=>N.conditionKey==="parentCode"),p={};if(C){const N=se(C.id)||{};if(N!=null&&N.itemCodes)p.parentItemCodes=N.itemCodes;else return}t==="ecanDataSelect"&&(p.indicatorList=z.filter(N=>N.show)),i==="EDV_DATA_SET"&&(p.edvDataSetId=ke),Le=T({url:"/diagram/formData",source:i,dataViewId:n,plugin:"4",layer:r,chartType:"normalSelect",rangeIndexTypeGuid:Se,type:t==="ecanDataSelect"?"normalSelectData":"normalSelect",labelField:h.labelField,valueField:h.valueField,pageId:a,sqlConditions:v,idxLibMode:"WITH_DATE_DIM_TABLE",keyName:e.keyName},p)}else{let C={};B(t,["scatter","valueline"])?C={classifications:Ve}:C={classification:q},Le=T({url:"/diagram",source:i,dataViewId:n,plugin:d?"5":f,layer:r,chartType:d?"pivot-table":b,series:Ie,indicatorList:z,queryColumns:s?[]:le,pageFlag:!0,pageId:a,edvDataSetId:ke||"",sqlConditions:v.map(p=>{const{fieldValue:N}=p,K={};return N&&Array.isArray(N)&&(K.fieldValue=JSON.stringify(N)),T(T({},p),K)}),idxLibMode:me,preview:be,rowHeaders:fe,keyName:e.keyName,columnData:he,columnHeaders:Ae},C)}return Le}},il=(e=[],o)=>{let{name:l="name",types:t=[]}=o||{};l=(l==null?void 0:l.trim())||l;const m=new Set,s=new Map,a=e.length,d=t.length;if(a===1){const f=[];for(let b=0;b<d;b++){const u=t[b],{label:S,value:A}=u,x=_(T({},e[0]),{value:e[0][A]});m.add(S),f.push(x)}const r=e[0][l]||"";s.set(r,f)}else for(let f=0;f<a;f++){const r=e[f],b=r[l];m.add(b);for(let u=0;u<d;u++){const S=t[u],{label:A,value:x}=S,c=_(T({},r),{value:r[x]});if(s.has(A)){const y=s.get(A);y.push(c),s.set(A,y)}else s.set(A,[c])}}const i=Array.from(m),n=[];for(const[f,r]of s)n.push({name:f,data:r});return{dimensions:i,dataset:n}},rl=(e,o)=>{let{name:l="name",value:t="value",type:m="type"}=o||{};l=l==null?void 0:l.trim(),t=t==null?void 0:t.trim(),m=m==null?void 0:m.trim();const s=new Set,a=new Map,d=e.length;for(let f=0;f<d;f++){const r=e[f],b=r[l]||"",u=r[t]||"",S=r[m]||"";if(s.add(b),a.has(S)){const A=a.get(S);A.push(T({name:b,value:u},r)),a.set(S,A)}else a.set(S,[T({name:b,value:u},r)])}const i=Array.from(s),n=[];for(const[f,r]of a)n.push({name:f,data:r});return{dimensions:i,dataset:n}},te=(e,o)=>{var m;if(e==null)return o;const l=e.match(/\{.*\}/g);if(l==null||l.length===0)return o;const t=l.length;for(let s=0;s<t;s++){const a=l[s];if(a==null||a==="")break;let d=(m=a.slice(1,-1))==null?void 0:m.trim();d=d==null?void 0:d.replace(/value/g,o);try{let i=d;(/\(.*\)/g.test(d)||/[+/\\*]/g.test(d))&&(i=ae(d)),e=e.replace(a,i)}catch(i){e=e.replace(a,d)}}return e};function al(e){return e.isShowMarkLine?{markLine:{data:[{type:e.markLineType}]}}:{}}const dl=(e,o,l)=>{switch(e.type){case"bar":return fl(e,o,l);case"line":return sl(e,o,l);case"pie":return ul(e,o,l);case"comboGraph":return cl(e,o,l);default:return{}}},fl=(e,o,l)=>{const t=e.yAxisLabelFormatter,m=e.xAxisLabelFormatter,{dimensions:s=[],dataset:a=[]}=o,d=L.computed(()=>{const{gradientShow:n,gradientColors:f,gradientOffset:r,barBorderRadius:b}=e,u=a,S=u.length,A=[];for(let x=0;x<S;x++){const c=_(T({},u[x]),{type:"bar",barWidth:e.barWidth,showBackground:e.showBarBackground}),{isStack:y,stackColumns:g}=e;if(y&&g.includes(u[x].name||!g)&&(c.stack="stack"),c.label={show:e.labelShow,fontSize:e.labelFontSize,position:e.labelPosition,color:e.labelColor,width:e.labelWidth,overflow:e.labelOverflow,formatter:w=>{let V="",h=e.labelFormatter;h===""&&(h="{c}");const{seriesName:Y,name:ne,value:me,data:be}=w||{};return V+=Z(h,{textData:T({name:ne,value:me,a:Y,b:ne,c:me||0},be)},{useNewline:!0,useSpace:!0}),V}},c.itemStyle={},n&&(c.itemStyle={color:{x:e.isUseHorizontalAxis?1:0,y:0,x2:0,y2:e.isUseHorizontalAxis?0:1,colorStops:[{offset:0,color:e.colors[x]},{offset:r,color:f[x]},{offset:1,color:f[x]}]}}),b){const w=b.split(",");if(w!=null&&w.length){const V=[];for(const h of w){const Y=parseFloat(h);isNaN(Y)||V.push(Y)}c.itemStyle.barBorderRadius=V}}e.isShowMarkLine&&(c.markLine={data:[{type:e.markLineType}]}),A.push(c)}return A}),i=L.computed(()=>s.map(n=>{let f={};return n&&typeof n=="object"?f=_(T({},n),{textStyle:{fontSize:l}}):f={value:n,textStyle:{fontSize:l}},f}));return{tooltip:{trigger:"axis",show:e.tooltipShow,formatter:n=>{const f=n.length;let r="",b=e.tooltipFormatter;b===""&&(b="{marker} {a} {c}");for(let u=0;u<f;u++){const{marker:S,seriesName:A,name:x,value:c,data:y}=n[u]||{};if(u===0){let g=x;typeof x=="string"&&x[0]==="0"&&!isNaN(+x)&&(g=(+x).toString()),r+=`${te(m,g)}<br/>`}r+=Z(b,{textData:T({marker:S,name:x,value:c,Qfw:Je,a:A,b:x,c:c||0},y)},{useNewline:!0,useSpace:!0}),r+="<br/>"}return r},textStyle:{color:e.tooltipTextStyleColor,fontSize:l},position:e.tooltipPosition||void 0,backgroundColor:e.tooltipBackgroundColor||"#fff"},legend:{type:e.legendScroll?"scroll":"plain",width:e.legendWidth,height:e.legendHeight,show:e.legendShow,orient:e.legendOrient,top:e.legendTop,left:e.legendLeft,textStyle:{rich:{text:{width:e.legendTextWidth,color:e.legendTextStyleColor,fontSize:e.legendFontSize}}},itemHeight:e.legendItemHeight,itemWidth:e.legendItemWidth,itemGap:e.legendItemGap,data:a.map((n,f)=>({name:n.name,itemStyle:{color:e.colors[f]},icon:e.legendType})),formatter:n=>Xe(e.legendFormatter,{name:n})},xAxis:{type:e.isUseHorizontalAxis?"value":"category",data:e.isUseHorizontalAxis?null:L.unref(i),inverse:e.isUseHorizontalAxis?e.xAxisInverse:e.axisInverse,minInterval:e.xAxisMinInterval,splitLine:{show:e.xAxisSplitLineShow,lineStyle:{color:e.xAxisSplitLineStyleColor,type:e.xAxisSplitLineType},interval:e.xAxisSplitLineInterval},splitArea:{show:e.xAxisSplitAreaShow},axisLabel:{color:e.xAxisLabelColor,interval:e.xAxisLabelInterval||0,rotate:e.xAxisLabelRotate,width:e.xAxisLabelWidth,overflow:e.xAxisLabelOverflow,fontSize:e.xAxisLabelFontSize,formatter(n){return typeof n=="string"&&n[0]==="0"&&!isNaN(+n)&&(n=(+n).toString()),te(m,n)}},axisLine:{show:e.xAxisLineShow,lineStyle:{color:e.xAxisLineStyleColor}},axisTick:{show:e.xAxisTickShow},name:e.xAxisName,nameTextStyle:{fontSize:e.xAxisLabelFontSize,color:e.xAxisLabelColor,align:"left"},max:e.xAxisMaxValue||null},yAxis:{type:e.isUseHorizontalAxis?"category":"value",data:e.isUseHorizontalAxis?L.unref(s):null,inverse:e.isUseHorizontalAxis?e.axisInverse:e.yAxisInverse,minInterval:e.yAxisMinInterval,splitLine:{show:e.yAxisSplitLineShow,lineStyle:{color:e.yAxisSplitLineStyleColor,type:e.yAxisSplitLineType}},splitArea:{show:e.yAxisSplitAreaShow},axisLabel:{show:e.yAxisLabelShow,fontSize:e.yAxisLabelFontSize,color:e.yAxisLabelColor,rotate:e.yAxisLabelRotate,width:e.yAxisLabelWidth,overflow:e.yAxisLabelOverflow,formatter(n){return te(t,n)}},axisLine:{show:e.yAxisLineAlwaysDisplay,lineStyle:{color:e.yAxisLineStyleColor}},name:e.yAxisName,nameTextStyle:{fontSize:e.yAxisLabelFontSize,color:e.yAxisLabelColor,align:"right"},max:e.yAxisMaxValue||null},series:L.unref(d)}},sl=(e,o,l)=>{const t=e.yAxisLabelFormatter,m=e.xAxisLabelFormatter,{dimensions:s=[],dataset:a=[]}=o,d=L.computed(()=>s.map(n=>{let f={};return n&&typeof n=="object"?f=_(T({},n),{textStyle:{fontSize:l}}):f={value:n,textStyle:{fontSize:l}},f})),i=L.computed(()=>{const n=[],f=a.length;for(let r=0;r<f;r++){const b={};e.shadowColor&&(b.shadowColor=e.shadowColor,b.shadowBlur=e.shadowBlur,b.shadowOffsetY=e.shadowOffsetY,b.shadowOffsetX=e.shadowOffsetX),n.push(T(_(T({type:"line"},a[r]),{symbolSize:e.symbolSize,smooth:e.smooth,areaStyle:{color:e.areaGradientShow?{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:e.colors[r]},{offset:1,color:e.areaGradientColor||"transparent"}],global:!1}:e.colors[r],opacity:e.areaStyleOpacity},lineStyle:T({width:e.lineStyleWidth},b)}),al(e)))}return n});return{tooltip:{trigger:"axis",show:e.tooltipShow,formatter:n=>{const f=n.length;let r="",b=e.tooltipFormatter;b===""&&(b="{marker} {a} {c}");for(let u=0;u<f;u++){const{marker:S,seriesName:A,name:x,value:c,data:y}=n[u]||{};u===0&&(r+=`${x}<br/>`),r+=Z(b,{textData:T({marker:S,name:x,value:c,a:A,b:x,c},y)},{useNewline:!0,useSpace:!0}),r+="<br/>"}return r},textStyle:{color:e.tooltipTextStyleColor,fontSize:l.value},position:e.tooltipPosition||void 0,backgroundColor:e.tooltipBackgroundColor||"#fff"},xAxis:{name:e.xAxisName,type:"category",data:L.unref(d),minInterval:e.xAxisMinInterval,splitLine:{show:e.xAxisSplitLineShow,lineStyle:{color:e.xAxisSplitLineStyleColor}},axisLabel:{color:e.xAxisLabelColor,interval:e.xAxisLabelInterval||0,rotate:e.xAxisLabelRotate,width:e.xAxisLabelWidth,overflow:e.xAxisLabelOverflow,formatter(n){return te(m,n)}},axisLine:{lineStyle:{color:e.xAxisLineStyleColor}},axisTick:{show:e.xAxisTickShow}},yAxis:{type:"value",name:e.yAxisName,minInterval:e.yAxisMinInterval,splitLine:{show:e.yAxisSplitLineShow,lineStyle:{color:e.yAxisSplitLineStyleColor}},axisLabel:{fontSize:l,color:e.yAxisLabelColor,formatter(n){return te(t,n)}},axisLine:{show:e.yAxisLineAlwaysDisplay,lineStyle:{color:e.yAxisLineStyleColor}}},legend:{show:e.legendShow,orient:e.legendOrient,top:e.legendTop,left:e.legendLeft,textStyle:{fontSize:l}},series:L.unref(i)}},ul=(e,o,l)=>{const{dataset:t=[]}=o;let{data:m=[]}=t[0]||{};if(Array.isArray(e.colors)){const s=e.isUseLabelColors,a=e.colors;m=m.map((d,i)=>T({label:s?{color:a[i]}:{}},d))}return{title:{text:e.titleText,subtext:e.titleSubtext,textStyle:{fontSize:e.titleFontSize,fontWeight:e.fontWeight,color:e.titleColor},left:e.textAlign||"center"},tooltip:{show:e.tooltipShow,trigger:e.tooltipTrigger,formatter:s=>{const{marker:a,seriesName:d,name:i,value:n,percent:f,data:r}=s||{};return Z(e.tooltipFormatter,{textData:T({marker:a,name:i,value:n,percent:f,a:d,b:i,c:n,d:f},r)},{useNewline:!0,useSpace:!0})},textStyle:{color:e.tooltipTextStyleColor||"#333"},backgroundColor:e.tooltipBackgroundColor||"#fff",borderColor:e.tooltipBorderColor||"#eee"},legend:{show:e.legendShow,orient:e.legendOrient,top:e.legendTop,left:e.legendLeft,textStyle:{color:e.legendTextStyleColor,fontSize:l===18?l:e.labelFontSize}},series:[{data:m,type:"pie",radius:[e.innerRadius,e.outerRadius],center:[e.centerLeft,e.centerTop],roseType:e.roseType,avoidLabelOverlap:!1,minAngle:e.minAngle,label:{show:e.labelPosition!=="center"&&e.labelShow,color:e.labelColor,fontSize:l===18?l:e.labelFontSize,position:e.labelPosition,formatter:qe(e.labelFormatter)},labelLine:{show:e.labelLineShow,length:e.labelLineLength,length2:e.labelLineLength2},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"},label:{}}}]}},cl=(e,o,l)=>{const{dimensions:t=[],dataset:m=[]}=o,s=L.computed(()=>t.map(i=>{let n={};return i&&typeof i=="object"?n=_(T({},i),{textStyle:{fontSize:l}}):n={value:i,textStyle:{fontSize:l}},n})),a=L.computed(()=>{const i=[],n=m.length,f=e.seriesTypes;for(let r=0;r<n;r++){const b=f[r],{type:u,axisIndex:S}=b||{};let A=T({type:u,yAxisIndex:S},m[r]);if(u==="line"){const x={};e.shadowColor&&(x.shadowColor=e.shadowColor,x.shadowBlur=e.shadowBlur,x.shadowOffsetY=e.shadowOffsetY,x.shadowOffsetX=e.shadowOffsetX),A=_(T({},A),{symbolSize:e.symbolSize,smooth:e.smooth,itemStyle:{color:e.colors[r]},areaStyle:{color:e.areaGradientShow?{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:e.colors[r]},{offset:1,color:e.areaGradientColor||"transparent"}],global:!1}:e.colors[r],opacity:e.areaStyleOpacity},lineStyle:T({width:e.lineStyleWidth},x)})}if(u==="bar"){const{gradientShow:x,gradientColors:c,gradientOffset:y}=e,g={};if(e.barBorderRadius){const w=e.barBorderRadius.split(",");if(w!=null&&w.length){const V=[];for(const h of w){const Y=parseFloat(h);isNaN(Y)||V.push(Y)}g.borderRadius=V}}x&&(g.color={x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:e.colors[r]},{offset:y,color:c[r]},{offset:1,color:c[r]}]}),A=_(T({},A),{barWidth:e.barWidth,itemStyle:g})}e.isShowMarkLine&&(A.markLine={data:[{type:e.markLineType}]}),i.push(A)}return i}),d=L.computed(()=>{const i=e.yAxis;return i==null?void 0:i.map((n,f)=>({type:"value",minInterval:e.yAxisMinInterval,splitLine:{show:f===0?e.yAxisLeftSplitLineShow:e.yAxisRightSplitLineShow,lineStyle:{color:e.yAxisSplitLineStyleColor,type:f===0?e.yAxisLeftSplitLineType:e.yAxisRightSplitLineType}},splitArea:{show:e.yAxisSplitAreaShow},axisLabel:{fontSize:l,show:e.yAxisLabelShow,color:e.yAxisLabelColor,formatter(r){return te(n.axisLabelFormatter,r)}},axisLine:{show:e.yAxisLineAlwaysDisplay,lineStyle:{color:e.yAxisLineStyleColor}},name:f===0?e.yAxisLeftName:e.yAxisRightName,nameTextStyle:{fontSize:e.yAxisLabelFontSize,color:e.yAxisLabelColor,align:f===0?"right":"left"},max:e.yAxisMaxValue||null}))});return{legend:{show:e.legendShow,orient:e.legendOrient,top:e.legendTop,left:e.legendLeft,textStyle:{color:e.legendTextStyleColor,fontSize:l}},tooltip:{trigger:"axis",show:e.tooltipShow,formatter:i=>{const n=i.length;let f="",r=e.tooltipFormatter;r===""&&(r="{marker} {a} {c}");const b=e.seriesTypes;for(let u=0;u<n;u++){const S=b[u],{tooltipFormatter:A}=S||{},{marker:x,seriesName:c,name:y,value:g,data:w}=i[u]||{};u===0&&(f+=`${y}<br/>`),f+=Z(A||r,{textData:T({marker:x,name:y,value:g,seriesName:c,a:c,b:y,c:g},w)},{useNewline:!0,useSpace:!0}),f+="<br/>"}return f},textStyle:{color:e.tooltipTextStyleColor||"#333",fontSize:l},backgroundColor:e.tooltipBackgroundColor||"#fff",borderColor:e.tooltipBorderColor||"#eee"},xAxis:{name:e.xAxisName,minInterval:e.xAxisMinInterval,type:"category",data:L.unref(s),splitLine:{show:e.xAxisSplitLineShow,lineStyle:{color:e.xAxisSplitLineStyleColor}},axisLabel:{color:e.xAxisLabelColor,interval:e.xAxisLabelInterval||0,rotate:e.xAxisLabelRotate,width:e.xAxisLabelWidth,overflow:e.xAxisLabelOverflow},axisLine:{lineStyle:{color:e.xAxisLineStyleColor}},axisTick:{show:e.xAxisTickShow}},yAxis:L.unref(d),series:L.unref(a)}},ml=e=>({title:{text:e.titleText,subtext:e.titleSubtext,textStyle:{fontSize:e.titleFontSize,fontWeight:e.fontWeight,color:e.titleColor},left:e.textAlign||"center"},grid:{top:e.gridTop,bottom:e.gridBottom,left:e.gridLeft,right:e.gridRight,containLabel:e.gridContainLabel},color:e.colors}),yl=(e,o,l=12)=>T(T({},ml(e)),dl(e,o,l)),xl=_(T({},nl),{runCode:ae,useTransformChartDataByAttrKey:il,useTransformChartDataByAttrValue:rl,useValueFormatter:te,useVariablesInText:Z,transformProps:yl,getIndicatorParams:Ze});k.default=xl,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
/*! @ecan-bi/tools@1.0.20 */
|
|
2
|
+
(function(V,L){typeof exports=="object"&&typeof module!="undefined"?L(exports,require("vue"),require("dayjs"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","vue","dayjs","lodash-es"],L):(V=typeof globalThis!="undefined"?globalThis:V||self,L(V["@ecan/bi-tools"]={},V.Vue,V.Dayjs,V.LodashEs))})(this,function(V,L,N,G){"use strict";var xl=Object.defineProperty,gl=Object.defineProperties;var bl=Object.getOwnPropertyDescriptors;var ge=Object.getOwnPropertySymbols;var $e=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable;var ze=(V,L,N)=>L in V?xl(V,L,{enumerable:!0,configurable:!0,writable:!0,value:N}):V[L]=N,T=(V,L)=>{for(var N in L||(L={}))$e.call(L,N)&&ze(V,N,L[N]);if(ge)for(var N of ge(L))He.call(L,N)&&ze(V,N,L[N]);return V},_=(V,L)=>gl(V,bl(L));var we=(V,L)=>{var N={};for(var G in V)$e.call(V,G)&&L.indexOf(G)<0&&(N[G]=V[G]);if(V!=null&&ge)for(var G of ge(V))L.indexOf(G)<0&&He.call(V,G)&&(N[G]=V[G]);return N};var Pe=(V,L,N)=>new Promise((G,re)=>{var Z=$=>{try{R(N.next($))}catch(ae){re(ae)}},B=$=>{try{R(N.throw($))}catch(ae){re(ae)}},R=$=>$.done?G($.value):Promise.resolve($.value).then(Z,B);R((N=N.apply(V,L)).next())});const re=(e,o)=>{const l=T({dayjs:N},o);let t="";const m=[];for(const f in l)t+=`${f},`,m.push(l[f]);t=t.replace(/,$/,"");const s=`function (${t}){return ${e}}`;let r;try{r=Function(`"use strict";return (${s})`)()(...m)}catch(f){return e}return r},Z=(e="",{textData:o,codeData:l}={},{useNewline:t=!1,useSpace:m=!1}={})=>{const s=T({},o),r=(e||"").match(/\{(.+?)\}/g);if(r==null||r.length===0)return e;for(let f=0;f<r.length;f++){const i=r[f];let n=i.slice(1,-1).trim();const a=/[\u4e00-\u9fa5a-z-_A-Z0-9]*/g,d=n.match(a);for(let c=0;c<d.length;c++){const y=d[c],g=s[y];g!=null&&(n=n.replace(y,g))}(/\(.*\)/g.test(n)||/[+/\\*]/g.test(n))&&(n=re(n,l)),e=e.replace(i,n)}return t&&(e=e==null?void 0:e.replace(/\n|\\n/g,"<br/>")),m&&(e=e==null?void 0:e.replace(/\s{2,}?/g," ")),e=e.replace(/Qfw\((.*?)\)/,(f,i)=>o!=null&&o.Qfw?o==null?void 0:o.Qfw(i):i),e},B=(e,o)=>{if(typeof e=="string"&&typeof o=="string")return e.toLocaleLowerCase().includes(o.toLocaleLowerCase());if(typeof e=="string"&&Array.isArray(o)){const l=o.length;for(let t=0;t<l;t++){const m=o[t];if(typeof m=="string"&&e.toLocaleLowerCase().includes(m.toLocaleLowerCase()))return!0}}return!1},R=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),$=e=>{const o=[];for(const l of e)l.conditions?o.push(...$(l.conditions)):(l==null?void 0:l.dataType)==="component"&&o.push(l);return o};function ae(e){const o=e.split("-");let l="";if(o!=null&&o.length)switch(o[o.length-1]){case"YYYY":l="year";break;case"MM":l="month";break;case"DD":l="day";break}return l}const Qe=e=>e.replace(/\\n/g,`
|
|
3
|
+
`),qe=(e="",o)=>{var r;const l=e.match(/\{(.+?)\}/g),t=((r=e.split(`
|
|
4
|
+
`))==null?void 0:r.length)-1;let m="";if(t)for(let f=0;f<t;f++)m+=`
|
|
5
|
+
`;let s=e;if(l!=null&&l.length){for(const f of l){const i=Z(f,{textData:o},{useNewline:!1,useSpace:!1});i&&(s=s.replace(f,i))}return`${m}{text|${s}}`}else return e};function Xe(e){let o="",l="",t="",m="";e.indexOf(".")>-1?(l=e.split(".")[0],t=e.split(".")[1]):l=e;let s=0,r=0;for(r=l.length-1;r>=0;)s%3===0&&s!==0?l[r]==="-"?o+=l[r]:o+=","+l[r]:o+=l[r],r--,s++;return o=o.split("").reverse().join(""),e.indexOf(".")>-1?m=o+"."+t:m=o,m}function Je(s){return Pe(this,arguments,function*({graphicConfig:e,request:o,INDICATOR_URL:l="",PAGE_ID:t,dataSourceId:m}){var r;try{const{leftAxisList:f=[],rightAxisList:i=[],queryColumnList:n=[],indicators:a=[]}=L.unref(e),d=[...f,...i,...n,...a],c={};for(const y of d){const{indexCode:g="",parentId:A=""}=y;A&&!R(y,"calcType")&&!c[A]&&(c[A]=g)}if((r=Object.keys(c))!=null&&r.length){const y=[];for(const b in c)y.push(new Promise((u,x)=>{o.post(`${l}/diagram/hrpIndexWithComplex`,{pageId:t,indexGuid:b,indexCode:c[b],dataSourceId:m}).then(S=>{var M;const{success:w,data:F=[]}=S.data;w&&((M=F==null?void 0:F.dataViewColumns)!=null&&M.length)?u(F.dataViewColumns):x(F)}).catch(S=>{console.error(S),x(S)})}));return(yield Promise.all(y)).reduce((b,u)=>b.filter(x=>u.find(S=>S.typeGuid===x.typeGuid))).filter(b=>b.typeGuid)}}catch(f){console.error(f)}return[]})}const Ze=["table","bar","combograph","line","pie","radar","scatter","list","circulate"];let Ce=new Map;const Oe=["keyValue","conditionKey","conditionLabel","conditionName","conditionValueType","customValue","id","keyName"],fe=e=>Ce.get(e),el=(e,o={})=>{const{around:l,unit:t,id:m}=e;let s="";const{pageMode:r="",componentList:f=[]}=(o==null?void 0:o.graphicConfig)||{};let i=null,n=null;if(r==="design"){const a=f==null?void 0:f.find(u=>u.id===m);if(!a)return[];const{interval:d,intervalUnit:c,startTime:y,endTime:g,operate:A,useCurrentTime:b}=a||{};if(b&&(i=N().subtract(d,c),n=N()),y&&(i=N(y)),g&&(n=N(g)),A){const{type:u,value:x,mode:S}=A;switch(u){case"add":i=i&&i.add(x,S),n=n&&n.add(x,S);break;case"minus":i=i&&i.subtract(x,S),n=n&&n.subtract(x,S)}}}else{const a=fe(m)||{};L.unref(a.startTime)&&(i=N(L.unref(a.startTime))),L.unref(a.endTime)&&(n=N(L.unref(a.endTime)))}if(i&&n){const a=n.diff(i,t.toLowerCase());s=`${l==="before"?"-":""}${a+1}`}return s?[s]:[]},Te=(e,o)=>{if(o)R(e,"indexCode")&&(e.hrpIndexCode=e.indexCode,delete e.indexCode),R(e,"indexCodeNum")&&(e.hrpIndexCodeNum=e.indexCodeNum,delete e.indexCodeNum),R(e,"dataType")&&delete e.dataType;else{const{calcWays:l=[],dateCalcTypes:t=[],activeKey:m,componentId:s=""}=e;if(m===5&&(l!=null&&l.length)&&(t!=null&&t.length)&&s){const r=l[0].split("-");(r==null?void 0:r.length)>1&&r[0]==="rangeValue"&&(e.calcWays=el({around:r[1],unit:t[0],id:s})),delete e.radioValue}if(R(e,"dataType")){if(e.fieldType==="DATE"&&(e.label=e.fieldName),e.dataType==="component")if(e.fieldValue==="PARENT"){let r=e.modelKey;r&&e.prop&&(r+=`-${e.prop}`),e.fieldValue="${"+r+"}"}else e.fieldValue="${"+e.fieldValue+"}";delete e.dataType}R(e,"activeKey")&&delete e.activeKey,R(e,"radioValue")&&delete e.radioValue,R(e,"indexCode")&&(e.hrpIndexCode=e.indexCode,delete e.indexCode),R(e,"indexCodeNum")&&(e.hrpIndexCodeNum=e.indexCodeNum,delete e.indexCodeNum),e.dataType!=="component"&&e.useCurrentTime&&(e.fieldValue=N().format(e.dateFormat)),R(e,"modelKey")&&delete e.modelKey,R(e,"prop")&&delete e.prop,delete e.useCurrentTime}},oe=(e,o)=>{const l=[];return e!=null&&e.length&&G.cloneDeep(e).forEach(t=>{if(t.join&&t.conditions){const m=!t.conditions.some(s=>s.join&&s.conditions);t.conditions.forEach((s,r)=>{Te(s,o);const f={};if(r<t.conditions.length-1&&(f.join=t.join),m)l.push(T(T({},f),s));else if(s.join&&s.conditions){const i=o?"sqlConditions":"conditions";l.push(T({[i]:oe([s],o)},f))}else l.push(T(T({},f),s))})}else Te(t,o),l.push(t)}),l},be=(e={},o)=>{if(e!=null&&e.sortCpnts&&o){const w=Fe(e);w&&(o.sort=w)}const{label:l,name:t,location:m,show:s,indexCode:r,indexCodeNum:f,calcType:i="COLUMN",builtInFormula:n,builtInValueSource:a,builtInCalcWay:d,formula:c,conditions:y,aggregate:g,distinct:A,dimByCount:b,dataTo:u}=e;let x;if(y&&(x=oe(y)),i==="COMPONENT"){const w={};return se(w,a),{label:l.trim(),columnName:t,show:s,calcType:i,componentAlias:d,componentValue:w.fieldValue||null}}const S={label:l.trim(),columnName:t,location:m,show:s,calcType:u==="1"?"VIEW":i,hrpIndexCode:r,hrpIndexCodeNum:f,aggregate:g,builtInFormula:n,builtInValueSource:a,formula:c,conditions:x};if(n==="DATE_OFFSET"){const w=d.split("-");if((w==null?void 0:w.length)===3){let F=w[0];return w[2]==="before"&&w[0]!=="0"&&(F=`-${w[0]}`),_(T({},S),{calcWays:[F],dateCalcTypes:[w[1]]})}}else return t==="the_count"&&(S.calcType="AGGREGATE",S.distinct=!!A,S.typeGuid=b),_(T({},S),{builtInCalcWay:d})},ll=e=>{if(!e)return[];const o=G.cloneDeep((e==null?void 0:e.controlList)||[]).filter(g=>g.conditionKey!=="parentCode"),{classificationList:l=[],rowHeaderList:t=[],dimensionList:m=[],seriesList:s=[],leftAxisList:r=[],rightAxisList:f=[],queryColumnList:i=[],indicators:n=[]}=e;Ne(o);const a=[...l,...t,...m,...s,...r,...f,...i,...n],d=[];for(const g of a){const A=$((g==null?void 0:g.conditions)||[]);if(A!=null&&A.length){const b=A.filter(u=>(u==null?void 0:u.dataType)==="component").map(u=>{const x={};return u!=null&&u.dateFormat&&(x.format=u.dateFormat),u.fieldValue==="PARENT"&&(x.id="PARENT",x.keyName=u.modelKey,x.modelKey=u.modelKey,x.prop=u.prop),T({conditionKey:u.fieldName,conditionLabel:u.fieldName,conditionName:u.fieldName,conditionValueType:u.fieldType,id:u.componentId,keyName:u.fieldValue,rule:u.rule,notGlobal:!0,indexCode:u.indexCode,typeGuid:u.typeGuid,indexCodeNum:u.indexCodeNum},x)});if(b!=null&&b.length)for(const u of b)d.find(x=>x.keyName===u.keyName)||d.push(u)}}const c=d.length,y=o;for(let g=0;g<c;g++){const A=d[g];if((A==null?void 0:A.conditionKey)==="parentCode")continue;const{id:b,keyName:u,prop:x,format:S,modelKey:w,dataType:F="component",customValue:M}=A,Y=pe(A);se(Y,b,{prop:x,dateFormat:S,modelKey:w,keyName:u}),F===""&&(Y.fieldValue=M||""),y.push(Y)}for(let g=y.length-1;g>=0;g--){const A=y[g];A.globalCondition||$(y).find(u=>u.alias===A.alias&&u.globalCondition)&&y.splice(g,1)}return y};function pe(e){const{id:o,keyName:l,conditionLabel:t,conditionKey:m,conditionValueType:s,prop:r,rule:f="NONE",notGlobal:i=!1,indexCode:n,typeGuid:a,indexCodeNum:d,dataType:c="component"}=e;let y=l||o;y&&r&&(y+=`-${r}`);let g=f;return g==="NONE"&&(["startTime","endTime"].includes(r)?g=r==="startTime"?"GREATER_EQUAL":"LESS_EQUAL":l!=null&&l.includes("startTime")?g=r==="GREATER_EQUAL":l!=null&&l.includes("endTime")?g=r==="LESS_EQUAL":g="EQUAL"),o==="PARENT"&&(y=e.modelKey,y&&r&&(y+=`-${r}`),g=f),{rule:g,label:t,fieldName:m,fieldValue:"",valueType:s,alias:y,globalCondition:!i,indexCode:n,typeGuid:a,indexCodeNum:d,dataType:c}}function Ne(e){if(e!=null&&e.length)for(const o of e)if(o!=null&&o.conditions)Ne(o.conditions);else{const{id:l,keyName:t,prop:m,modelKey:s,format:r,dataType:f="component",customValue:i}=o,n=pe(o);se(n,l,{prop:m,dateFormat:r,modelKey:s,keyName:t}),f===""&&(n.fieldValue=i||"");for(const a in n)o[a]=n[a];for(const a of Oe)delete o[a]}}function ol(e){const o=[];if(e!=null&&e.length){for(const l of e)if(l.variableName){const t={variateName:l.variableName,globalCondition:!1,valueType:l.variableType,alias:l.keyName||""};se(t,l.id,{dateFormat:l.format,prop:l.dateTypeValue,keyName:l.keyName,operateType:l.operateType,operateMode:l.operateMode,operateValue:l.operateValue}),l.dataType===""&&(t.fieldValue=l.variableValue),l.format&&(t.dateFormat=l.format),l.label&&(t.label=l.label),o.push(t)}}return o}function se(e,o,l){const{prop:t="",dateFormat:m="",modelKey:s="",keyName:r="",operateValue:f,operateMode:i,operateType:n}=l||{},a=s||r;if(o==="PARENT"&&a&&t){const x=window.config.record;let S=t,w=m;const F=t.match(/\{(.+?)\}/g);if(F!=null&&F.length){const M=F[0].slice(1,-1).trim();S=t.replace(F[0],""),w=M,e.dateFormat=w}if(x&&x[a]){const M=L.unref(x[a][S]);N.isDayjs(M)?e.fieldValue=M.format(w||"YYYY-MM-DD"):e.fieldValue=M}return}const d=fe(o)||{},{value:c,format:y="YYYY-MM-DD",type:g="",useCurrentTime:A,RECORD:b}=d||{},u=m||y;if(B(d.type,"date")){let x;if(A?c?x=L.unref(c):x=N():x=L.unref(c),f&&i&&n)switch(n){case"add":x=x.add(f,i);break;case"minus":x=x.subtract(f,i);break}e.fieldValue=x==null?void 0:x.format(u),e.dateFormat=u}else if(g==="ecanRangePicker"){let x=t;if(!t){const w=r&&r.split("-");w!=null&&w.length&&(x=w[w.length-1])}if(!x)return;let S=null;if(L.unref(d[x])&&(S=N(L.unref(d[x]))),f&&i&&n){if(f==="rangeValue"){if(d.startTime&&d.endTime){const w=L.unref(d.endTime).diff(L.unref(d.startTime),i)+1;switch(n){case"add":S=S&&S.add(w,i);break;case"minus":S=S&&S.subtract(w,i)}}}else if(!isNaN(+f))switch(n){case"add":S=S&&S.add(f,i);break;case"minus":S=S&&S.subtract(f,i)}}if(S&&(e.fieldValue=S==null?void 0:S.format(u)),x==="rangeValue"&&d.startTime&&d.endTime){const w=ae(u);w&&(e.fieldValue=L.unref(d.endTime).diff(L.unref(d.startTime),w)+1)}e.dateFormat=u}else B(g,Ze)?s&&b?e.fieldValue=b[s]:!s&&b?e.fieldValue=b.value:e.fieldValue=L.unref(c):e.fieldValue=L.unref(c)}const ue=e=>{var o;if(e){const l=Array.isArray(e)?G.cloneDeep(e):[G.cloneDeep(e)];let t="",m=[];const s=[],r=[],f=[];for(const i of l){if(i.defaultCode&&(i.label=i.columnName,delete i.defaultCode),i.type==="CUSTOM"&&(m=i.customOrderColumns),t=i.type,s.push(i.label),(o=i.columnName)!=null&&o.includes("_ecanrepeat_")){const n=i.columnName.split("_ecanrepeat_");r.push(n[0])}else r.push(i.columnName);f.push(i.order)}return t!=="CUSTOM"&&(s==null?void 0:s.length)>1&&(t="COMBINATION"),t==="CUSTOM"?{label:s.join(","),columnName:r.join(","),type:t,customOrderColumns:m}:{label:s.join(","),columnName:r.join(","),order:f.join(","),type:t}}else return e},Fe=e=>{const{sortCpnts:o=[]}=e;let l,t="";for(const m of o){const s=fe(m)||{},{type:r,RECORD:f}=s;if(B(r,"image")&&B(f==null?void 0:f.value,["asc","desc"])){t=f.value.toUpperCase();break}}return t&&(l={label:e.label,columnName:e.name,order:t,type:"NORMAL"}),l},tl={formatIndicatorParams:(e,o={})=>{var he,Me,ve,Ee,De,Ge,Re,Ke,Ue,We;const{graphicConfig:l,type:t,globalModel:m,isGroupTable:s=!1}=e;m&&(Ce=m);const r=B(t,"pivottable");let{source:f,dataViewId:i,plugin:n="1",layer:a,chartType:d,classificationList:c=[],rowHeaderList:y=[],dimensionList:g=[],seriesList:A=[],leftAxisList:b=[],rightAxisList:u=[],queryColumnList:x=[],indicators:S=[],controlList:w=[],formFields:F={},variableList:M=[],variableConditions:Y=[],idxLibMode:ce,preview:me=!1,edvDataSetId:ye}=l||{},v=[];if((l==null?void 0:l.pageMode)==="design"?(v=((he=l.sqlConditions)!=null?he:[]).map(C=>{const k={};if(!R(C,"globalCondition")&&!C.join&&(k.globalCondition=!0),!C.join){const p=C.rule||"EQUAL";k.rule=p==="NONE"?"EQUAL":p}return T(T({},C),k)}),Y!=null&&Y.length&&(v=v.concat(Y))):(v=ll(l),M!=null&&M.length&&(v=v.concat(ol(M)))),v!=null&&v.length){const C=v.filter(p=>p.globalCondition),k=v.filter(p=>!p.globalCondition);(C==null?void 0:C.length)>1&&(v=[{join:"&&",conditions:C},...k])}v!=null&&v.length&&(v=oe(v,"1")),a==null&&(B(t,["table","card"])||B(t,["list","circulate"])&&(c==null?void 0:c.length)>1?a="1":B(t,["select","checkbox","radio"])?a="3":a="2");let q;const ke=[];let Se="";if(Array.isArray(c)&&c.length>0&&(!["ecanList","ecanCirculate"].includes(t)||(c==null?void 0:c.length)===1)){const C=c.length;for(let k=0;k<C;k++){const p=c[k]||{},{label:K="",name:U="",show:W=!1,sort:X,customGroup:O,conditions:I,dateFormat:h,typeGuid:j="",truncations:D=[]}=p;if(W||C===1){Se=j,q={label:K.trim(),columnName:U,show:W,sort:Fe(p)||ue(X)||X,customGroup:O,conditions:oe(I),typeGuid:j},h&&(q.dateFormat=h),U==="the_date"&&!q.dateFormat&&(q.dateFormat="YYYY-MM");const E={};if(Array.isArray(D)&&D.length>0){const H=D.length;for(let P=0;P<H;P++){const Q=D[P]||{},{rule:J="",num:ee=0,name:ie=""}=Q;J&&ee&&(E.num=ee,E.rule=J,ie&&(E.otherGroupName=ie))}}if((Me=Object.keys(E))!=null&&Me.length&&(q.truncation=E),B(t,["scatter","valueline"]))ke.push(q);else break}}}let Ve;if(Array.isArray(A)&&A.length>0){const C=A.length;for(let k=0;k<C;k++){const p=A[k]||{},{label:K="",name:U="",show:W=!1,sort:X,customGroup:O,conditions:I,typeGuid:h}=p;if(W||C===1){Ve={label:K.trim(),columnName:U,show:W,sort:ue(X),customGroup:O,conditions:oe(I),typeGuid:h};break}}}const z=[];b==null||b.forEach(C=>{C.location="LEFT",z.push(be(C,q))}),u==null||u.forEach(C=>{C.location="RIGHT",z.push(be(C,q))});let xe=S;(Ee=(ve=o==null?void 0:o.pivotTableCal)==null?void 0:ve.indicators)!=null&&Ee.length&&(xe=o.pivotTableCal.indicators),xe==null||xe.forEach(C=>{C.location="LEFT",z.push(be(C,q))});const le=[];["ecanList","ecanCirculate"].includes(t)&&(c==null?void 0:c.length)>1&&(x=c),(Ge=(De=o==null?void 0:o.pivotTableCal)==null?void 0:De.dimensions)!=null&&Ge.length&&(x=o.pivotTableCal.dimensions),x==null||x.forEach(C=>{const{label:k,name:p,location:K,show:U,indexCode:W,sort:X,typeGuid:O,indexCodeNum:I,dateFormat:h,conditions:j}=C;let D=ue(X);if(o.sort){const{field:H,order:P}=o.sort;let Q=z.find(J=>J.label===H);!Q&&k===H&&(Q=C),Q&&(D={columnName:Q.columnName,label:o.sort.field,order:P.toUpperCase(),type:"NORMAL"})}const E={label:k,columnName:p,location:K,show:U,sort:D,calcType:"COLUMN",hrpIndexCode:W,hrpIndexCodeNum:I,conditions:oe(j),typeGuid:O};h&&(E.dateFormat=h),p==="the_date"&&!E.dateFormat&&(E.dateFormat="YYYY-MM"),le.push(E)});let de=[],ne=[];if(Array.isArray(y)&&y.length>0?ne=y:Array.isArray(g)&&g.length>0&&(ne=g),ne!=null&&ne.length){const C=ne.length;for(let k=0;k<C;k++){const p=ne[k]||{},{label:K="",name:U="",show:W=!1,sort:X,customGroup:O,conditions:I,truncations:h,typeGuid:j="",dateFormat:D}=p;let E=ue(X);if(o.sort){const{field:Q,order:J}=o.sort;let ee=z.find(ie=>ie.label===Q);!ee&&p.label===Q&&(ee=p),ee&&(E={columnName:ee.columnName,label:o.sort.field,order:J.toUpperCase(),type:"NORMAL"})}const H={label:K.trim(),columnName:U,show:W,sort:E,customGroup:O,conditions:oe(I),typeGuid:j};D&&(H.dateFormat=D),U==="the_date"&&!H.dateFormat&&(H.dateFormat="YYYY-MM");const P={};if(Array.isArray(h)&&h.length>0){const Q=h.length;for(let J=0;J<Q;J++){const ee=h[J]||{},{rule:ie="",num:je=0,name:_e=""}=ee;ie&&je&&(P.num=je,P.rule=ie,_e&&(P.otherGroupName=_e))}}(Re=Object.keys(P))!=null&&Re.length&&(H.truncation=P),de.push(H)}}let Ae=[],Ie;if(o!=null&&o.pivotTableCal){let C=[];const{calc:k=[],filter:p=[],truncations:K=[],sorts:U=[],aggregateMethod:W=[],rowDimensionKeys:X=[],colDimensionKeys:O=[]}=o.pivotTableCal;if(z.push(...k),p!=null&&p.length)for(const I of p){const Ye=I,{type:h}=Ye,j=we(Ye,["type"]);h==="indicators"?C=z:h==="dimension"&&(C=le);const D=C.find(E=>E.columnName===I.fieldName);D&&(D.conditions||(D.conditions=[]),D.conditions.push(j))}if(K!=null&&K.length)for(const I of K){const h=le.find(j=>j.columnName===I.key);h&&(h.truncation={num:I.num,rule:I.rule})}if(U!=null&&U.length)for(const I of U){const Be=I,{fieldType:h,columnData:j}=Be,D=we(Be,["fieldType","columnData"]);h==="indicators"?(C=z,Ie=j):h==="dimension"&&(C=le);const E=C.find(H=>H.label===D.label);E&&(E.sort=_(T({},D),{columnName:E.columnName}))}if((Ke=Object.keys(W))!=null&&Ke.length)for(const I in W){const h=le.find(j=>j.label===I);h&&((Ue=W[I])!=null&&Ue.length)&&(h.aggregateMethod=W[I])}de=[],Ae=[];for(const I of le)X.includes(I.columnName)?de.push(I):O.includes(I.columnName)&&Ae.push(I)}if(B(t,["text","proportion","counter"])?d="zb":B(t,["valueline"])&&(d="valueline"),s||t==="card"){if(de.length===0||z.length===0)return;d="grouptable"}else{if(a==="1"&&le.length===0)return;if(a==="2"&&z.length===0)return;if(a==="3"&&(!Se&&f!=="EDV_DATA_SET"||!F.labelField||!F.valueField))return;if(a==="3"&&t==="ecanDataSelect"&&z.length===0)return}g!=null&&g.length&&(a="1",d="grouptable");let Le;if(!B(t,["scatter","valueline"])&&((We=Object.keys(F))!=null&&We.length)){const C=$(w).find(p=>p.conditionKey==="parentCode"),k={};if(C){const p=fe(C.id)||{};if(p!=null&&p.itemCodes)k.parentItemCodes=p.itemCodes;else return}t==="ecanDataSelect"&&(k.indicatorList=z.filter(p=>p.show)),f==="EDV_DATA_SET"&&(k.edvDataSetId=ye),Le=T({url:"/diagram/formData",source:f,dataViewId:i,plugin:"4",layer:a,chartType:"normalSelect",rangeIndexTypeGuid:Se,type:t==="ecanDataSelect"?"normalSelectData":"normalSelect",labelField:F.labelField,valueField:F.valueField,sqlConditions:v,idxLibMode:"WITH_DATE_DIM_TABLE",keyName:e.keyName},k)}else{let C={};B(t,["scatter","valueline"])?C={classifications:ke}:C={classification:q},Le=T({url:"/diagram",source:f,dataViewId:i,plugin:r?"5":n,layer:a,chartType:r?"pivot-table":d,series:Ve,indicatorList:z,queryColumns:s?[]:le,pageFlag:!0,edvDataSetId:ye||"",sqlConditions:v.map(k=>{const{fieldValue:p}=k,K={};return p&&Array.isArray(p)&&(K.fieldValue=JSON.stringify(p)),T(T({},k),K)}),idxLibMode:ce,preview:me,rowHeaders:de,keyName:e.keyName,columnData:Ie,columnHeaders:Ae},C)}return Le}},nl=(e=[],o)=>{let{name:l="name",types:t=[]}=o||{};l=(l==null?void 0:l.trim())||l;const m=new Set,s=new Map,r=e.length,f=t.length;if(r===1){const a=[];for(let c=0;c<f;c++){const y=t[c],{label:g,value:A}=y,b=_(T({},e[0]),{value:e[0][A]});m.add(g),a.push(b)}const d=e[0][l]||"";s.set(d,a)}else for(let a=0;a<r;a++){const d=e[a],c=d[l];m.add(c);for(let y=0;y<f;y++){const g=t[y],{label:A,value:b}=g,u=_(T({},d),{value:d[b]});if(s.has(A)){const x=s.get(A);x.push(u),s.set(A,x)}else s.set(A,[u])}}const i=Array.from(m),n=[];for(const[a,d]of s)n.push({name:a,data:d});return{dimensions:i,dataset:n}},il=(e,o)=>{let{name:l="name",value:t="value",type:m="type"}=o||{};l=l==null?void 0:l.trim(),t=t==null?void 0:t.trim(),m=m==null?void 0:m.trim();const s=new Set,r=new Map,f=e.length;for(let a=0;a<f;a++){const d=e[a],c=d[l]||"",y=d[t]||"",g=d[m]||"";if(s.add(c),r.has(g)){const A=r.get(g);A.push(T({name:c,value:y},d)),r.set(g,A)}else r.set(g,[T({name:c,value:y},d)])}const i=Array.from(s),n=[];for(const[a,d]of r)n.push({name:a,data:d});return{dimensions:i,dataset:n}},te=(e,o)=>{var m;if(e==null)return o;const l=e.match(/\{.*\}/g);if(l==null||l.length===0)return o;const t=l.length;for(let s=0;s<t;s++){const r=l[s];if(r==null||r==="")break;let f=(m=r.slice(1,-1))==null?void 0:m.trim();f=f==null?void 0:f.replace(/value/g,o);try{let i=f;(/\(.*\)/g.test(f)||/[+/\\*]/g.test(f))&&(i=re(f)),e=e.replace(r,i)}catch(i){e=e.replace(r,f)}}return e};function rl(e){return e.isShowMarkLine?{markLine:{data:[{type:e.markLineType}]}}:{}}const al=(e,o,l)=>{switch(e.type){case"bar":return dl(e,o,l);case"line":return fl(e,o,l);case"pie":return sl(e,o,l);case"comboGraph":return ul(e,o,l);default:return{}}},dl=(e,o,l)=>{const t=e.yAxisLabelFormatter,m=e.xAxisLabelFormatter,{dimensions:s=[],dataset:r=[]}=o,f=L.computed(()=>{const{gradientShow:n,gradientColors:a,gradientOffset:d,barBorderRadius:c}=e,y=r,g=y.length,A=[];for(let b=0;b<g;b++){const u=_(T({},y[b]),{type:"bar",barWidth:e.barWidth,showBackground:e.showBarBackground}),{isStack:x,stackColumns:S}=e;if(x&&S.includes(y[b].name||!S)&&(u.stack="stack"),u.label={show:e.labelShow,fontSize:e.labelFontSize,position:e.labelPosition,color:e.labelColor,width:e.labelWidth,overflow:e.labelOverflow,formatter:w=>{let F="",M=e.labelFormatter;M===""&&(M="{c}");const{seriesName:Y,name:ce,value:me,data:ye}=w||{};return F+=Z(M,{textData:T({name:ce,value:me,a:Y,b:ce,c:me||0},ye)},{useNewline:!0,useSpace:!0}),F}},u.itemStyle={},n&&(u.itemStyle={color:{x:e.isUseHorizontalAxis?1:0,y:0,x2:0,y2:e.isUseHorizontalAxis?0:1,colorStops:[{offset:0,color:e.colors[b]},{offset:d,color:a[b]},{offset:1,color:a[b]}]}}),c){const w=c.split(",");if(w!=null&&w.length){const F=[];for(const M of w){const Y=parseFloat(M);isNaN(Y)||F.push(Y)}u.itemStyle.barBorderRadius=F}}e.isShowMarkLine&&(u.markLine={data:[{type:e.markLineType}]}),A.push(u)}return A}),i=L.computed(()=>s.map(n=>{let a={};return n&&typeof n=="object"?a=_(T({},n),{textStyle:{fontSize:l}}):a={value:n,textStyle:{fontSize:l}},a}));return{tooltip:{trigger:"axis",show:e.tooltipShow,formatter:n=>{const a=n.length;let d="",c=e.tooltipFormatter;c===""&&(c="{marker} {a} {c}");for(let y=0;y<a;y++){const{marker:g,seriesName:A,name:b,value:u,data:x}=n[y]||{};if(y===0){let S=b;typeof b=="string"&&b[0]==="0"&&!isNaN(+b)&&(S=(+b).toString()),d+=`${te(m,S)}<br/>`}d+=Z(c,{textData:T({marker:g,name:b,value:u,Qfw:Xe,a:A,b,c:u||0},x)},{useNewline:!0,useSpace:!0}),d+="<br/>"}return d},textStyle:{color:e.tooltipTextStyleColor,fontSize:l},position:e.tooltipPosition||void 0,backgroundColor:e.tooltipBackgroundColor||"#fff"},legend:{type:e.legendScroll?"scroll":"plain",width:e.legendWidth,height:e.legendHeight,show:e.legendShow,orient:e.legendOrient,top:e.legendTop,left:e.legendLeft,textStyle:{rich:{text:{width:e.legendTextWidth,color:e.legendTextStyleColor,fontSize:e.legendFontSize}}},itemHeight:e.legendItemHeight,itemWidth:e.legendItemWidth,itemGap:e.legendItemGap,data:r.map((n,a)=>({name:n.name,itemStyle:{color:e.colors[a]},icon:e.legendType})),formatter:n=>qe(e.legendFormatter,{name:n})},xAxis:{type:e.isUseHorizontalAxis?"value":"category",data:e.isUseHorizontalAxis?null:L.unref(i),inverse:e.isUseHorizontalAxis?e.xAxisInverse:e.axisInverse,minInterval:e.xAxisMinInterval,splitLine:{show:e.xAxisSplitLineShow,lineStyle:{color:e.xAxisSplitLineStyleColor,type:e.xAxisSplitLineType},interval:e.xAxisSplitLineInterval},splitArea:{show:e.xAxisSplitAreaShow},axisLabel:{color:e.xAxisLabelColor,interval:e.xAxisLabelInterval||0,rotate:e.xAxisLabelRotate,width:e.xAxisLabelWidth,overflow:e.xAxisLabelOverflow,fontSize:e.xAxisLabelFontSize,formatter(n){return typeof n=="string"&&n[0]==="0"&&!isNaN(+n)&&(n=(+n).toString()),te(m,n)}},axisLine:{show:e.xAxisLineShow,lineStyle:{color:e.xAxisLineStyleColor}},axisTick:{show:e.xAxisTickShow},name:e.xAxisName,nameTextStyle:{fontSize:e.xAxisLabelFontSize,color:e.xAxisLabelColor,align:"left"},max:e.xAxisMaxValue||null},yAxis:{type:e.isUseHorizontalAxis?"category":"value",data:e.isUseHorizontalAxis?L.unref(s):null,inverse:e.isUseHorizontalAxis?e.axisInverse:e.yAxisInverse,minInterval:e.yAxisMinInterval,splitLine:{show:e.yAxisSplitLineShow,lineStyle:{color:e.yAxisSplitLineStyleColor,type:e.yAxisSplitLineType}},splitArea:{show:e.yAxisSplitAreaShow},axisLabel:{show:e.yAxisLabelShow,fontSize:e.yAxisLabelFontSize,color:e.yAxisLabelColor,rotate:e.yAxisLabelRotate,width:e.yAxisLabelWidth,overflow:e.yAxisLabelOverflow,formatter(n){return te(t,n)}},axisLine:{show:e.yAxisLineAlwaysDisplay,lineStyle:{color:e.yAxisLineStyleColor}},name:e.yAxisName,nameTextStyle:{fontSize:e.yAxisLabelFontSize,color:e.yAxisLabelColor,align:"right"},max:e.yAxisMaxValue||null},series:L.unref(f)}},fl=(e,o,l)=>{const t=e.yAxisLabelFormatter,m=e.xAxisLabelFormatter,{dimensions:s=[],dataset:r=[]}=o,f=L.computed(()=>s.map(n=>{let a={};return n&&typeof n=="object"?a=_(T({},n),{textStyle:{fontSize:l}}):a={value:n,textStyle:{fontSize:l}},a})),i=L.computed(()=>{const n=[],a=r.length;for(let d=0;d<a;d++){const c={};e.shadowColor&&(c.shadowColor=e.shadowColor,c.shadowBlur=e.shadowBlur,c.shadowOffsetY=e.shadowOffsetY,c.shadowOffsetX=e.shadowOffsetX),n.push(T(_(T({type:"line"},r[d]),{symbolSize:e.symbolSize,smooth:e.smooth,areaStyle:{color:e.areaGradientShow?{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:e.colors[d]},{offset:1,color:e.areaGradientColor||"transparent"}],global:!1}:e.colors[d],opacity:e.areaStyleOpacity},lineStyle:T({width:e.lineStyleWidth},c)}),rl(e)))}return n});return{tooltip:{trigger:"axis",show:e.tooltipShow,formatter:n=>{const a=n.length;let d="",c=e.tooltipFormatter;c===""&&(c="{marker} {a} {c}");for(let y=0;y<a;y++){const{marker:g,seriesName:A,name:b,value:u,data:x}=n[y]||{};y===0&&(d+=`${b}<br/>`),d+=Z(c,{textData:T({marker:g,name:b,value:u,a:A,b,c:u},x)},{useNewline:!0,useSpace:!0}),d+="<br/>"}return d},textStyle:{color:e.tooltipTextStyleColor,fontSize:l.value},position:e.tooltipPosition||void 0,backgroundColor:e.tooltipBackgroundColor||"#fff"},xAxis:{name:e.xAxisName,type:"category",data:L.unref(f),minInterval:e.xAxisMinInterval,splitLine:{show:e.xAxisSplitLineShow,lineStyle:{color:e.xAxisSplitLineStyleColor}},axisLabel:{color:e.xAxisLabelColor,interval:e.xAxisLabelInterval||0,rotate:e.xAxisLabelRotate,width:e.xAxisLabelWidth,overflow:e.xAxisLabelOverflow,formatter(n){return te(m,n)}},axisLine:{lineStyle:{color:e.xAxisLineStyleColor}},axisTick:{show:e.xAxisTickShow}},yAxis:{type:"value",name:e.yAxisName,minInterval:e.yAxisMinInterval,splitLine:{show:e.yAxisSplitLineShow,lineStyle:{color:e.yAxisSplitLineStyleColor}},axisLabel:{fontSize:l,color:e.yAxisLabelColor,formatter(n){return te(t,n)}},axisLine:{show:e.yAxisLineAlwaysDisplay,lineStyle:{color:e.yAxisLineStyleColor}}},legend:{show:e.legendShow,orient:e.legendOrient,top:e.legendTop,left:e.legendLeft,textStyle:{fontSize:l}},series:L.unref(i)}},sl=(e,o,l)=>{const{dataset:t=[]}=o;let{data:m=[]}=t[0]||{};if(Array.isArray(e.colors)){const s=e.isUseLabelColors,r=e.colors;m=m.map((f,i)=>T({label:s?{color:r[i]}:{}},f))}return{title:{text:e.titleText,subtext:e.titleSubtext,textStyle:{fontSize:e.titleFontSize,fontWeight:e.fontWeight,color:e.titleColor},left:e.textAlign||"center"},tooltip:{show:e.tooltipShow,trigger:e.tooltipTrigger,formatter:s=>{const{marker:r,seriesName:f,name:i,value:n,percent:a,data:d}=s||{};return Z(e.tooltipFormatter,{textData:T({marker:r,name:i,value:n,percent:a,a:f,b:i,c:n,d:a},d)},{useNewline:!0,useSpace:!0})},textStyle:{color:e.tooltipTextStyleColor||"#333"},backgroundColor:e.tooltipBackgroundColor||"#fff",borderColor:e.tooltipBorderColor||"#eee"},legend:{show:e.legendShow,orient:e.legendOrient,top:e.legendTop,left:e.legendLeft,textStyle:{color:e.legendTextStyleColor,fontSize:l===18?l:e.labelFontSize}},series:[{data:m,type:"pie",radius:[e.innerRadius,e.outerRadius],center:[e.centerLeft,e.centerTop],roseType:e.roseType,avoidLabelOverlap:!1,minAngle:e.minAngle,label:{show:e.labelPosition!=="center"&&e.labelShow,color:e.labelColor,fontSize:l===18?l:e.labelFontSize,position:e.labelPosition,formatter:Qe(e.labelFormatter)},labelLine:{show:e.labelLineShow,length:e.labelLineLength,length2:e.labelLineLength2},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"},label:{}}}]}},ul=(e,o,l)=>{const{dimensions:t=[],dataset:m=[]}=o,s=L.computed(()=>t.map(i=>{let n={};return i&&typeof i=="object"?n=_(T({},i),{textStyle:{fontSize:l}}):n={value:i,textStyle:{fontSize:l}},n})),r=L.computed(()=>{const i=[],n=m.length,a=e.seriesTypes;for(let d=0;d<n;d++){const c=a[d],{type:y,axisIndex:g}=c||{};let A=T({type:y,yAxisIndex:g},m[d]);if(y==="line"){const b={};e.shadowColor&&(b.shadowColor=e.shadowColor,b.shadowBlur=e.shadowBlur,b.shadowOffsetY=e.shadowOffsetY,b.shadowOffsetX=e.shadowOffsetX),A=_(T({},A),{symbolSize:e.symbolSize,smooth:e.smooth,itemStyle:{color:e.colors[d]},areaStyle:{color:e.areaGradientShow?{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:e.colors[d]},{offset:1,color:e.areaGradientColor||"transparent"}],global:!1}:e.colors[d],opacity:e.areaStyleOpacity},lineStyle:T({width:e.lineStyleWidth},b)})}if(y==="bar"){const{gradientShow:b,gradientColors:u,gradientOffset:x}=e,S={};if(e.barBorderRadius){const w=e.barBorderRadius.split(",");if(w!=null&&w.length){const F=[];for(const M of w){const Y=parseFloat(M);isNaN(Y)||F.push(Y)}S.borderRadius=F}}b&&(S.color={x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:e.colors[d]},{offset:x,color:u[d]},{offset:1,color:u[d]}]}),A=_(T({},A),{barWidth:e.barWidth,itemStyle:S})}e.isShowMarkLine&&(A.markLine={data:[{type:e.markLineType}]}),i.push(A)}return i}),f=L.computed(()=>{const i=e.yAxis;return i==null?void 0:i.map((n,a)=>({type:"value",minInterval:e.yAxisMinInterval,splitLine:{show:a===0?e.yAxisLeftSplitLineShow:e.yAxisRightSplitLineShow,lineStyle:{color:e.yAxisSplitLineStyleColor,type:a===0?e.yAxisLeftSplitLineType:e.yAxisRightSplitLineType}},splitArea:{show:e.yAxisSplitAreaShow},axisLabel:{fontSize:l,show:e.yAxisLabelShow,color:e.yAxisLabelColor,formatter(d){return te(n.axisLabelFormatter,d)}},axisLine:{show:e.yAxisLineAlwaysDisplay,lineStyle:{color:e.yAxisLineStyleColor}},name:a===0?e.yAxisLeftName:e.yAxisRightName,nameTextStyle:{fontSize:e.yAxisLabelFontSize,color:e.yAxisLabelColor,align:a===0?"right":"left"},max:e.yAxisMaxValue||null}))});return{legend:{show:e.legendShow,orient:e.legendOrient,top:e.legendTop,left:e.legendLeft,textStyle:{color:e.legendTextStyleColor,fontSize:l}},tooltip:{trigger:"axis",show:e.tooltipShow,formatter:i=>{const n=i.length;let a="",d=e.tooltipFormatter;d===""&&(d="{marker} {a} {c}");const c=e.seriesTypes;for(let y=0;y<n;y++){const g=c[y],{tooltipFormatter:A}=g||{},{marker:b,seriesName:u,name:x,value:S,data:w}=i[y]||{};y===0&&(a+=`${x}<br/>`),a+=Z(A||d,{textData:T({marker:b,name:x,value:S,seriesName:u,a:u,b:x,c:S},w)},{useNewline:!0,useSpace:!0}),a+="<br/>"}return a},textStyle:{color:e.tooltipTextStyleColor||"#333",fontSize:l},backgroundColor:e.tooltipBackgroundColor||"#fff",borderColor:e.tooltipBorderColor||"#eee"},xAxis:{name:e.xAxisName,minInterval:e.xAxisMinInterval,type:"category",data:L.unref(s),splitLine:{show:e.xAxisSplitLineShow,lineStyle:{color:e.xAxisSplitLineStyleColor}},axisLabel:{color:e.xAxisLabelColor,interval:e.xAxisLabelInterval||0,rotate:e.xAxisLabelRotate,width:e.xAxisLabelWidth,overflow:e.xAxisLabelOverflow},axisLine:{lineStyle:{color:e.xAxisLineStyleColor}},axisTick:{show:e.xAxisTickShow}},yAxis:L.unref(f),series:L.unref(r)}},cl=e=>({title:{text:e.titleText,subtext:e.titleSubtext,textStyle:{fontSize:e.titleFontSize,fontWeight:e.fontWeight,color:e.titleColor},left:e.textAlign||"center"},grid:{top:e.gridTop,bottom:e.gridBottom,left:e.gridLeft,right:e.gridRight,containLabel:e.gridContainLabel},color:e.colors}),ml=(e,o,l=12)=>T(T({},cl(e)),al(e,o,l)),yl=_(T({},tl),{runCode:re,useTransformChartDataByAttrKey:nl,useTransformChartDataByAttrValue:il,useValueFormatter:te,useVariablesInText:Z,transformProps:ml,getIndicatorParams:Je});V.default=yl,Object.defineProperties(V,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
6
6
|
//# sourceMappingURL=index.umd.js.map
|