@ecan-bi/tools 1.0.12 → 1.0.13
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 +818 -816
- 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 +14 -6
- package/types/hooks/useTransformChartDataByAttrKey.d.ts +0 -25
- package/types/hooks/useTransformChartDataByAttrValue.d.ts +0 -23
- package/types/hooks/useValueFormatter.d.ts +0 -2
- package/types/hooks/useVariablesInText.d.ts +0 -12
- package/types/index.d.ts +0 -53
- package/types/indicator.d.ts +0 -4
- package/types/utils/constant.d.ts +0 -1
- package/types/utils/runCode.d.ts +0 -4
- package/types/utils/transformProps.d.ts +0 -21
- package/types/utils/util.d.ts +0 -31
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @ecan-bi/tools@1.0.
|
|
2
|
-
(function(
|
|
3
|
-
`),
|
|
4
|
-
`))==null?void 0:a.length)-1;let m="";if(t)for(let
|
|
5
|
-
`;let d=e;if(l!=null&&l.length){for(const s of l){const r=J(s,{textData:o},{useNewline:!1,useSpace:!1});r&&(d=d.replace(s,r))}return`${m}{text|${d}}`}else return e};function Ue(e){let o="",l="",t="",m="";e.indexOf(".")>-1?(l=e.split(".")[0],t=e.split(".")[1]):l=e;let d=0,a=0;for(a=l.length-1;a>=0;)d%3===0&&d!==0?l[a]==="-"?o+=l[a]:o+=","+l[a]:o+=l[a],a--,d++;return o=o.split("").reverse().join(""),e.indexOf(".")>-1?m=o+"."+t:m=o,m}async function We({graphicConfig:e,request:o,INDICATOR_URL:l="",PAGE_ID:t,dataSourceId:m}){var d;try{const{leftAxisList:a=[],rightAxisList:s=[],queryColumnList:r=[],indicators:n=[]}=p.unref(e),f=[...a,...s,...r,...n],i={};for(const g of f){const{indexCode:u="",parentId:x=""}=g;x&&!K(g,"calcType")&&!i[x]&&(i[x]=u)}if((d=Object.keys(i))!=null&&d.length){const g=[];for(const b in i)g.push(new Promise((S,c)=>{o.post(`${l}/diagram/hrpIndexWithComplex`,{pageId:t,indexGuid:b,indexCode:i[b],dataSourceId:m}).then(y=>{var F;const{success:A,data:L=[]}=y.data;A&&((F=L==null?void 0:L.dataViewColumns)!=null&&F.length)?S(L.dataViewColumns):c(L)}).catch(y=>{c(y)})}));return(await Promise.all(g)).reduce((b,S)=>b.filter(c=>S.find(y=>y.typeGuid===c.typeGuid))).filter(b=>b.typeGuid)}}catch{}return[]}const je=["table","bar","combograph","line","pie","radar","scatter","list","circulate"];let be=new Map;const _e=["keyValue","conditionKey","conditionLabel","conditionName","conditionValueType","customValue","id","keyName"],re=e=>be.get(e),ze=(e,o={})=>{const{around:l,unit:t,id:m}=e;let d="";const{pageMode:a="",componentList:s=[]}=(o==null?void 0:o.graphicConfig)||{};let r=null,n=null;if(a==="design"){const f=s==null?void 0:s.find(c=>c.id===m);if(!f)return[];const{interval:i,intervalUnit:g,startTime:u,endTime:x,operate:b,useCurrentTime:S}=f||{};if(S&&(r=W().subtract(i,g),n=W()),u&&(r=W(u)),x&&(n=W(x)),b){const{type:c,value:y,mode:A}=b;switch(c){case"add":r=r&&r.add(y,A),n=n&&n.add(y,A);break;case"minus":r=r&&r.subtract(y,A),n=n&&n.subtract(y,A)}}}else{const f=re(m)||{};p.unref(f.startTime)&&(r=W(p.unref(f.startTime))),p.unref(f.endTime)&&(n=W(p.unref(f.endTime)))}if(r&&n){const f=n.diff(r,t.toLowerCase());d=`${l==="before"?"-":""}${f+1}`}return d?[d]:[]},Se=(e,o)=>{if(o)K(e,"indexCode")&&(e.hrpIndexCode=e.indexCode,delete e.indexCode),K(e,"indexCodeNum")&&(e.hrpIndexCodeNum=e.indexCodeNum,delete e.indexCodeNum),K(e,"dataType")&&delete e.dataType;else{const{calcWays:l=[],dateCalcTypes:t=[],activeKey:m,componentId:d=""}=e;if(m===5&&(l!=null&&l.length)&&(t!=null&&t.length)&&d){const a=l[0].split("-");(a==null?void 0:a.length)>1&&a[0]==="rangeValue"&&(e.calcWays=ze({around:a[1],unit:t[0],id:d})),delete e.radioValue}if(K(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}K(e,"activeKey")&&delete e.activeKey,K(e,"radioValue")&&delete e.radioValue,K(e,"indexCode")&&(e.hrpIndexCode=e.indexCode,delete e.indexCode),K(e,"indexCodeNum")&&(e.hrpIndexCodeNum=e.indexCodeNum,delete e.indexCodeNum),e.dataType!=="component"&&e.useCurrentTime&&(e.fieldValue=W().format(e.dateFormat)),K(e,"modelKey")&&delete e.modelKey,K(e,"prop")&&delete e.prop,delete e.useCurrentTime}},Z=(e,o)=>{const l=[];return e!=null&&e.length&&ne.cloneDeep(e).forEach(t=>{if(t.join&&t.conditions){const m=!t.conditions.some(d=>d.join&&d.conditions);t.conditions.forEach((d,a)=>{Se(d,o);const s={};if(a<t.conditions.length-1&&(s.join=t.join),m)l.push({...s,...d});else if(d.join&&d.conditions){const r=o?"sqlConditions":"conditions";l.push({[r]:Z([d],o),...s})}else l.push({...s,...d})})}else Se(t,o),l.push(t)}),l},ce=(e={},o)=>{if(e!=null&&e.sortCpnts&&o){const L=we(e);L&&(o.sort=L)}const{label:l,name:t,location:m,show:d,indexCode:a,indexCodeNum:s,calcType:r="COLUMN",builtInFormula:n,builtInValueSource:f,builtInCalcWay:i,formula:g,conditions:u,aggregate:x,distinct:b,dimByCount:S,dataTo:c}=e;let y;if(u&&(y=Z(u)),r==="COMPONENT"){const L={};return ae(L,f),{label:l.trim(),columnName:t,show:d,calcType:r,componentAlias:i,componentValue:L.fieldValue||null}}const A={label:l.trim(),columnName:t,location:m,show:d,calcType:c==="1"?"VIEW":r,hrpIndexCode:a,hrpIndexCodeNum:s,aggregate:x,builtInFormula:n,builtInValueSource:f,formula:g,conditions:y};if(n==="DATE_OFFSET"){const L=i.split("-");if((L==null?void 0:L.length)===3){let F=L[0];return L[2]==="before"&&L[0]!=="0"&&(F=`-${L[0]}`),{...A,calcWays:[F],dateCalcTypes:[L[1]]}}}else return t==="the_count"&&(A.calcType="AGGREGATE",A.distinct=!!b,A.typeGuid=S),{...A,builtInCalcWay:i}},$e=e=>{if(!e)return[];const o=ne.cloneDeep((e==null?void 0:e.controlList)||[]).filter(x=>x.conditionKey!=="parentCode"),{classificationList:l=[],rowHeaderList:t=[],dimensionList:m=[],seriesList:d=[],leftAxisList:a=[],rightAxisList:s=[],queryColumnList:r=[],indicators:n=[]}=e;Le(o);const f=[...l,...t,...m,...d,...a,...s,...r,...n],i=[];for(const x of f){const b=ie((x==null?void 0:x.conditions)||[]);if(b!=null&&b.length){const S=b.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),{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(S!=null&&S.length)for(const c of S)i.find(y=>y.keyName===c.keyName)||i.push(c)}}const g=i.length,u=o;for(let x=0;x<g;x++){const b=i[x];if((b==null?void 0:b.conditionKey)==="parentCode")continue;const{id:S,keyName:c,prop:y,format:A,modelKey:L,dataType:F="component",customValue:V}=b,v=Ae(b);ae(v,S,{prop:y,dateFormat:A,modelKey:L,keyName:c}),F===""&&(v.fieldValue=V||""),u.push(v)}for(let x=u.length-1;x>=0;x--){const b=u[x];b.globalCondition||ie(u).find(c=>c.alias===b.alias&&c.globalCondition)&&u.splice(x,1)}return u};function Ae(e){const{id:o,keyName:l,conditionLabel:t,conditionKey:m,conditionValueType:d,prop:a,rule:s="NONE",notGlobal:r=!1,indexCode:n,typeGuid:f,indexCodeNum:i,dataType:g="component"}=e;let u=l||o;u&&a&&(u+=`-${a}`);let x=s;return x==="NONE"&&(["startTime","endTime"].includes(a)?x=a==="startTime"?"GREATER_EQUAL":"LESS_EQUAL":l!=null&&l.includes("startTime")?x=a==="GREATER_EQUAL":l!=null&&l.includes("endTime")?x=a==="LESS_EQUAL":x="EQUAL"),o==="PARENT"&&(u=e.modelKey,u&&a&&(u+=`-${a}`),x=s),{rule:x,label:t,fieldName:m,fieldValue:"",valueType:d,alias:u,globalCondition:!r,indexCode:n,typeGuid:f,indexCodeNum:i,dataType:g}}function Le(e){if(e!=null&&e.length)for(const o of e)if(o!=null&&o.conditions)Le(o.conditions);else{const{id:l,keyName:t,prop:m,modelKey:d,format:a,dataType:s="component",customValue:r}=o,n=Ae(o);ae(n,l,{prop:m,dateFormat:a,modelKey:d,keyName:t}),s===""&&(n.fieldValue=r||"");for(const f in n)o[f]=n[f];for(const f of _e)delete o[f]}}function He(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||""};ae(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 ae(e,o,l){const{prop:t="",dateFormat:m="",modelKey:d="",keyName:a="",operateValue:s,operateMode:r,operateType:n}=l||{},f=d||a;if(o==="PARENT"&&f&&t){const y=window.config.record;let A=t,L=m;const F=t.match(/\{(.+?)\}/g);if(F!=null&&F.length){const V=F[0].slice(1,-1).trim();A=t.replace(F[0],""),L=V,e.dateFormat=L}if(y&&y[f]){const V=p.unref(y[f][A]);W.isDayjs(V)?e.fieldValue=V.format(L||"YYYY-MM-DD"):e.fieldValue=V}return}const i=re(o)||{},{value:g,format:u="YYYY-MM-DD",type:x="",useCurrentTime:b,RECORD:S}=i||{},c=m||u;if(Y(i.type,"date")){let y;if(b?g?y=p.unref(g):y=W():y=p.unref(g),s&&r&&n)switch(n){case"add":y=y.add(s,r);break;case"minus":y=y.subtract(s,r);break}e.fieldValue=y==null?void 0:y.format(c),e.dateFormat=c}else if(x==="ecanRangePicker"){let y=t;if(!t){const L=a&&a.split("-");L!=null&&L.length&&(y=L[L.length-1])}if(!y)return;let A=null;if(p.unref(i[y])&&(A=W(p.unref(i[y]))),s&&r&&n){if(s==="rangeValue"){if(i.startTime&&i.endTime){const L=p.unref(i.endTime).diff(p.unref(i.startTime),r)+1;switch(n){case"add":A=A&&A.add(L,r);break;case"minus":A=A&&A.subtract(L,r)}}}else if(!isNaN(+s))switch(n){case"add":A=A&&A.add(s,r);break;case"minus":A=A&&A.subtract(s,r)}}if(A&&(e.fieldValue=A==null?void 0:A.format(c)),y==="rangeValue"&&i.startTime&&i.endTime){const L=Ye(c);L&&(e.fieldValue=p.unref(i.endTime).diff(p.unref(i.startTime),L)+1)}e.dateFormat=c}else Y(x,je)?d&&S?e.fieldValue=S[d]:!d&&S?e.fieldValue=S.value:e.fieldValue=p.unref(g):e.fieldValue=p.unref(g)}const de=e=>{var o;if(e){const l=Array.isArray(e)?ne.cloneDeep(e):[ne.cloneDeep(e)];let t="",m=[];const d=[],a=[],s=[];for(const r of l){if(r.defaultCode&&(r.label=r.columnName,delete r.defaultCode),r.type==="CUSTOM"&&(m=r.customOrderColumns),t=r.type,d.push(r.label),(o=r.columnName)!=null&&o.includes("_ecanrepeat_")){const n=r.columnName.split("_ecanrepeat_");a.push(n[0])}else a.push(r.columnName);s.push(r.order)}return t!=="CUSTOM"&&(d==null?void 0:d.length)>1&&(t="COMBINATION"),t==="CUSTOM"?{label:d.join(","),columnName:a.join(","),type:t,customOrderColumns:m}:{label:d.join(","),columnName:a.join(","),order:s.join(","),type:t}}else return e},we=e=>{const{sortCpnts:o=[]}=e;let l,t="";for(const m of o){const d=re(m)||{},{type:a,RECORD:s}=d;if(Y(a,"image")&&Y(s==null?void 0:s.value,["asc","desc"])){t=s.value.toUpperCase();break}}return t&&(l={label:e.label,columnName:e.name,order:t,type:"NORMAL"}),l},Pe={formatIndicatorParams:(e,o={})=>{var Fe,ke,Ve,Ie,he,Me,ve,Ee,De;const{graphicConfig:l,type:t,globalModel:m,isGroupTable:d=!1}=e;m&&(be=m);let a=e.pageId;const s=Y(t,"pivottable");let{source:r,dataViewId:n,plugin:f="1",layer:i,chartType:g,classificationList:u=[],rowHeaderList:x=[],dimensionList:b=[],seriesList:S=[],leftAxisList:c=[],rightAxisList:y=[],queryColumnList:A=[],indicators:L=[],controlList:F=[],formFields:V={},variableList:v=[],variableConditions:ee=[],idxLibMode:fe,preview:me=!1,edvDataSetId:Ce}=l||{},I=[];if((l==null?void 0:l.pageMode)==="design"?(I=(l.sqlConditions??[]).map(w=>{const C={};if(!K(w,"globalCondition")&&!w.join&&(C.globalCondition=!0),!w.join){const T=w.rule||"EQUAL";C.rule=T==="NONE"?"EQUAL":T}return{...w,...C}}),ee!=null&&ee.length&&(I=I.concat(ee))):(I=$e(l),v!=null&&v.length&&(I=I.concat(He(v)))),I!=null&&I.length){const w=I.filter(T=>T.globalCondition),C=I.filter(T=>!T.globalCondition);(w==null?void 0:w.length)>1&&(I=[{join:"&&",conditions:w},...C])}I!=null&&I.length&&(I=Z(I,"1")),i==null&&(Y(t,["table","card"])||Y(t,["list","circulate"])&&(u==null?void 0:u.length)>1?i="1":Y(t,["select","checkbox","radio"])?i="3":i="2");let z;const Te=[];let ye="";if(Array.isArray(u)&&u.length>0&&(!["ecanList","ecanCirculate"].includes(t)||(u==null?void 0:u.length)===1)){const w=u.length;for(let C=0;C<w;C++){const T=u[C]||{},{label:E="",name:D="",show:G=!1,sort:$,customGroup:Q,conditions:N,dateFormat:k,typeGuid:R="",truncations:M=[]}=T;if(G||w===1){ye=R,z={label:E.trim(),columnName:D,show:G,sort:we(T)||de($)||$,customGroup:Q,conditions:Z(N),typeGuid:R},k&&(z.dateFormat=k),D==="the_date"&&!z.dateFormat&&(z.dateFormat="YYYY-MM");const h={};if(Array.isArray(M)&&M.length>0){const U=M.length;for(let j=0;j<U;j++){const _=M[j]||{},{rule:H="",num:q=0,name:oe=""}=_;H&&q&&(h.num=q,h.rule=H,oe&&(h.otherGroupName=oe))}}if((Fe=Object.keys(h))!=null&&Fe.length&&(z.truncation=h),Y(t,["scatter","valueline"]))Te.push(z);else break}}}let pe;if(Array.isArray(S)&&S.length>0){const w=S.length;for(let C=0;C<w;C++){const T=S[C]||{},{label:E="",name:D="",show:G=!1,sort:$,customGroup:Q,conditions:N,typeGuid:k}=T;if(G||w===1){pe={label:E.trim(),columnName:D,show:G,sort:de($),customGroup:Q,conditions:Z(N),typeGuid:k};break}}}const B=[];c==null||c.forEach(w=>{w.location="LEFT",B.push(ce(w,z))}),y==null||y.forEach(w=>{w.location="RIGHT",B.push(ce(w,z))});let se=L;(Ve=(ke=o==null?void 0:o.pivotTableCal)==null?void 0:ke.indicators)!=null&&Ve.length&&(se=o.pivotTableCal.indicators),se==null||se.forEach(w=>{w.location="LEFT",B.push(ce(w,z))});const X=[];["ecanList","ecanCirculate"].includes(t)&&(u==null?void 0:u.length)>1&&(A=u),(he=(Ie=o==null?void 0:o.pivotTableCal)==null?void 0:Ie.dimensions)!=null&&he.length&&(A=o.pivotTableCal.dimensions),A==null||A.forEach(w=>{const{label:C,name:T,location:E,show:D,indexCode:G,sort:$,typeGuid:Q,indexCodeNum:N,dateFormat:k,conditions:R}=w;let M=de($);if(o.sort){const{field:U,order:j}=o.sort;let _=B.find(H=>H.label===U);!_&&C===U&&(_=w),_&&(M={columnName:_.columnName,label:o.sort.field,order:j.toUpperCase(),type:"NORMAL"})}const h={label:C,columnName:T,location:E,show:D,sort:M,calcType:"COLUMN",hrpIndexCode:G,hrpIndexCodeNum:N,conditions:Z(R),typeGuid:Q};k&&(h.dateFormat=k),T==="the_date"&&!h.dateFormat&&(h.dateFormat="YYYY-MM"),X.push(h)});let te=[],le=[];if(Array.isArray(x)&&x.length>0?le=x:Array.isArray(b)&&b.length>0&&(le=b),le!=null&&le.length){const w=le.length;for(let C=0;C<w;C++){const T=le[C]||{},{label:E="",name:D="",show:G=!1,sort:$,customGroup:Q,conditions:N,truncations:k,typeGuid:R="",dateFormat:M}=T;let h=de($);if(o.sort){const{field:_,order:H}=o.sort;let q=B.find(oe=>oe.label===_);!q&&T.label===_&&(q=T),q&&(h={columnName:q.columnName,label:o.sort.field,order:H.toUpperCase(),type:"NORMAL"})}const U={label:E.trim(),columnName:D,show:G,sort:h,customGroup:Q,conditions:Z(N),typeGuid:R};M&&(U.dateFormat=M),D==="the_date"&&!U.dateFormat&&(U.dateFormat="YYYY-MM");const j={};if(Array.isArray(k)&&k.length>0){const _=k.length;for(let H=0;H<_;H++){const q=k[H]||{},{rule:oe="",num:Ge=0,name:Re=""}=q;oe&&Ge&&(j.num=Ge,j.rule=oe,Re&&(j.otherGroupName=Re))}}(Me=Object.keys(j))!=null&&Me.length&&(U.truncation=j),te.push(U)}}let xe=[],Ne;if(o!=null&&o.pivotTableCal){let w=[];const{calc:C=[],filter:T=[],truncations:E=[],sorts:D=[],aggregateMethod:G=[],rowDimensionKeys:$=[],colDimensionKeys:Q=[]}=o.pivotTableCal;if(B.push(...C),T!=null&&T.length)for(const N of T){const{type:k,...R}=N;k==="indicators"?w=B:k==="dimension"&&(w=X);const M=w.find(h=>h.columnName===N.fieldName);M&&(M.conditions||(M.conditions=[]),M.conditions.push(R))}if(E!=null&&E.length)for(const N of E){const k=X.find(R=>R.columnName===N.key);k&&(k.truncation={num:N.num,rule:N.rule})}if(D!=null&&D.length)for(const N of D){const{fieldType:k,columnData:R,...M}=N;k==="indicators"?(w=B,Ne=R):k==="dimension"&&(w=X);const h=w.find(U=>U.label===M.label);h&&(h.sort={...M,columnName:h.columnName})}if((ve=Object.keys(G))!=null&&ve.length)for(const N in G){const k=X.find(R=>R.label===N);k&&((Ee=G[N])!=null&&Ee.length)&&(k.aggregateMethod=G[N])}te=[],xe=[];for(const N of X)$.includes(N.columnName)?te.push(N):Q.includes(N.columnName)&&xe.push(N)}if(Y(t,["text","proportion","counter"])?g="zb":Y(t,["valueline"])&&(g="valueline"),d||t==="card"){if(te.length===0||B.length===0)return;g="grouptable"}else{if(i==="1"&&X.length===0)return;if(i==="2"&&B.length===0)return;if(i==="3"&&(!ye&&r!=="EDV_DATA_SET"||!V.labelField||!V.valueField))return;if(i==="3"&&t==="ecanDataSelect"&&B.length===0)return}if(b!=null&&b.length&&(i="1",g="grouptable"),!a){const{pathname:w}=window==null?void 0:window.location;if(w){const C=w.split("/");C!=null&&C.length&&(a=C[C.length-1])}}let ge;if(!Y(t,["scatter","valueline"])&&((De=Object.keys(V))!=null&&De.length)){const w=ie(F).find(T=>T.conditionKey==="parentCode"),C={};if(w){const T=re(w.id)||{};if(T!=null&&T.itemCodes)C.parentItemCodes=T.itemCodes;else return}t==="ecanDataSelect"&&(C.indicatorList=B.filter(T=>T.show)),r==="EDV_DATA_SET"&&(C.edvDataSetId=Ce),ge={url:"/diagram/formData",source:r,dataViewId:n,plugin:"4",layer:i,chartType:"normalSelect",rangeIndexTypeGuid:ye,type:t==="ecanDataSelect"?"normalSelectData":"normalSelect",labelField:V.labelField,valueField:V.valueField,pageId:a,sqlConditions:I,idxLibMode:"WITH_DATE_DIM_TABLE",keyName:e.keyName,...C}}else{let w={};Y(t,["scatter","valueline"])?w={classifications:Te}:w={classification:z},ge={url:"/diagram",source:r,dataViewId:n,plugin:s?"5":f,layer:i,chartType:s?"pivot-table":g,series:pe,indicatorList:B,queryColumns:d?[]:X,pageFlag:!0,pageId:a,edvDataSetId:Ce||"",sqlConditions:I.map(C=>{const{fieldValue:T}=C,E={};return T&&Array.isArray(T)&&(E.fieldValue=JSON.stringify(T)),{...C,...E}}),idxLibMode:fe,preview:me,rowHeaders:te,keyName:e.keyName,columnData:Ne,columnHeaders:xe,...w}}return ge}},Qe=(e=[],o)=>{let{name:l="name",types:t=[]}=o||{};l=(l==null?void 0:l.trim())||l;const m=new Set,d=new Map,a=e.length,s=t.length;if(a===1){const f=[];for(let g=0;g<s;g++){const u=t[g],{label:x,value:b}=u,S={...e[0],value:e[0][b]};m.add(x),f.push(S)}const i=e[0][l]||"";d.set(i,f)}else for(let f=0;f<a;f++){const i=e[f],g=i[l];m.add(g);for(let u=0;u<s;u++){const x=t[u],{label:b,value:S}=x,c={...i,value:i[S]};if(d.has(b)){const y=d.get(b);y.push(c),d.set(b,y)}else d.set(b,[c])}}const r=Array.from(m),n=[];for(const[f,i]of d)n.push({name:f,data:i});return{dimensions:r,dataset:n}},qe=(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 d=new Set,a=new Map,s=e.length;for(let f=0;f<s;f++){const i=e[f],g=i[l]||"",u=i[t]||"",x=i[m]||"";if(d.add(g),a.has(x)){const b=a.get(x);b.push({name:g,value:u,...i}),a.set(x,b)}else a.set(x,[{name:g,value:u,...i}])}const r=Array.from(d),n=[];for(const[f,i]of a)n.push({name:f,data:i});return{dimensions:r,dataset:n}},O=(e,o)=>{var m;if(console.log("This is useValueFormatter"),e==null)return o;const l=e.match(/\{.*\}/g);if(l==null||l.length===0)return o;const t=l.length;for(let d=0;d<t;d++){const a=l[d];if(a==null||a==="")break;let s=(m=a.slice(1,-1))==null?void 0:m.trim();s=s==null?void 0:s.replace(/value/g,o);try{let r=s;(/\(.*\)/g.test(s)||/[+/\\*]/g.test(s))&&(r=ue(s)),e=e.replace(a,r)}catch{e=e.replace(a,s)}}return e};function Xe(e){return e.isShowMarkLine?{markLine:{data:[{type:e.markLineType}]}}:{}}const Je=(e,o,l)=>{switch(e.type){case"bar":return Ze(e,o,l);case"line":return Oe(e,o,l);case"pie":return el(e,o,l);case"comboGraph":return ll(e,o,l);default:return{}}},Ze=(e,o,l)=>{const t=e.yAxisLabelFormatter,m=e.xAxisLabelFormatter,{dimensions:d=[],dataset:a=[]}=o,s=p.computed(()=>{const{gradientShow:n,gradientColors:f,gradientOffset:i,barBorderRadius:g}=e,u=a,x=u.length,b=[];for(let S=0;S<x;S++){const c={...u[S],type:"bar",barWidth:e.barWidth,showBackground:e.showBarBackground},{isStack:y,stackColumns:A}=e;if(y&&A.includes(u[S].name||!A)&&(c.stack="stack"),c.label={show:e.labelShow,fontSize:e.labelFontSize,position:e.labelPosition,color:e.labelColor,width:e.labelWidth,overflow:e.labelOverflow,formatter:L=>{let F="",V=e.labelFormatter;V===""&&(V="{c}");const{seriesName:v,name:ee,value:fe,data:me}=L||{};return F+=J(V,{textData:{name:ee,value:fe,a:v,b:ee,c:fe||0,...me}},{useNewline:!0,useSpace:!0}),F}},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[S]},{offset:i,color:f[S]},{offset:1,color:f[S]}]}}),g){const L=g.split(",");if(L!=null&&L.length){const F=[];for(const V of L){const v=parseFloat(V);isNaN(v)||F.push(v)}c.itemStyle.barBorderRadius=F}}e.isShowMarkLine&&(c.markLine={data:[{type:e.markLineType}]}),b.push(c)}return b}),r=p.computed(()=>d.map(n=>{let f={};return n&&typeof n=="object"?f={...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 i="",g=e.tooltipFormatter;g===""&&(g="{marker} {a} {c}");for(let u=0;u<f;u++){const{marker:x,seriesName:b,name:S,value:c,data:y}=n[u]||{};if(u===0){let A=S;typeof S=="string"&&S[0]==="0"&&!isNaN(+S)&&(A=(+S).toString()),i+=`${O(m,A)}<br/>`}i+=J(g,{textData:{marker:x,name:S,value:c,Qfw:Ue,a:b,b:S,c:c||0,...y}},{useNewline:!0,useSpace:!0}),i+="<br/>"}return i},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=>Ke(e.legendFormatter,{name:n})},xAxis:{type:e.isUseHorizontalAxis?"value":"category",data:e.isUseHorizontalAxis?null:p.unref(r),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()),O(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?p.unref(d):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 O(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:p.unref(s)}},Oe=(e,o,l)=>{const t=e.yAxisLabelFormatter,m=e.xAxisLabelFormatter,{dimensions:d=[],dataset:a=[]}=o,s=p.computed(()=>d.map(n=>{let f={};return n&&typeof n=="object"?f={...n,textStyle:{fontSize:l}}:f={value:n,textStyle:{fontSize:l}},f})),r=p.computed(()=>{const n=[],f=a.length;for(let i=0;i<f;i++){const g={};e.shadowColor&&(g.shadowColor=e.shadowColor,g.shadowBlur=e.shadowBlur,g.shadowOffsetY=e.shadowOffsetY,g.shadowOffsetX=e.shadowOffsetX),n.push({type:"line",...a[i],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[i]},{offset:1,color:e.areaGradientColor||"transparent"}],global:!1}:e.colors[i],opacity:e.areaStyleOpacity},lineStyle:{width:e.lineStyleWidth,...g},...Xe(e)})}return n});return{tooltip:{trigger:"axis",show:e.tooltipShow,formatter:n=>{const f=n.length;let i="",g=e.tooltipFormatter;g===""&&(g="{marker} {a} {c}");for(let u=0;u<f;u++){const{marker:x,seriesName:b,name:S,value:c,data:y}=n[u]||{};u===0&&(i+=`${S}<br/>`),i+=J(g,{textData:{marker:x,name:S,value:c,a:b,b:S,c,...y}},{useNewline:!0,useSpace:!0}),i+="<br/>"}return i},textStyle:{color:e.tooltipTextStyleColor,fontSize:l.value},position:e.tooltipPosition||void 0,backgroundColor:e.tooltipBackgroundColor||"#fff"},xAxis:{name:e.xAxisName,type:"category",data:p.unref(s),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 O(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 O(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:p.unref(r)}},el=(e,o,l)=>{const{dataset:t=[]}=o;let{data:m=[]}=t[0]||{};if(Array.isArray(e.colors)){const d=e.isUseLabelColors,a=e.colors;m=m.map((s,r)=>({label:d?{color:a[r]}:{},...s}))}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:d=>{const{marker:a,seriesName:s,name:r,value:n,percent:f,data:i}=d||{};return J(e.tooltipFormatter,{textData:{marker:a,name:r,value:n,percent:f,a:s,b:r,c:n,d:f,...i}},{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:Be(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:{}}}]}},ll=(e,o,l)=>{const{dimensions:t=[],dataset:m=[]}=o,d=p.computed(()=>t.map(r=>{let n={};return r&&typeof r=="object"?n={...r,textStyle:{fontSize:l}}:n={value:r,textStyle:{fontSize:l}},n})),a=p.computed(()=>{const r=[],n=m.length,f=e.seriesTypes;for(let i=0;i<n;i++){const g=f[i],{type:u,axisIndex:x}=g||{};let b={type:u,yAxisIndex:x,...m[i]};if(u==="line"){const S={};e.shadowColor&&(S.shadowColor=e.shadowColor,S.shadowBlur=e.shadowBlur,S.shadowOffsetY=e.shadowOffsetY,S.shadowOffsetX=e.shadowOffsetX),b={...b,symbolSize:e.symbolSize,smooth:e.smooth,itemStyle:{color:e.colors[i]},areaStyle:{color:e.areaGradientShow?{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:e.colors[i]},{offset:1,color:e.areaGradientColor||"transparent"}],global:!1}:e.colors[i],opacity:e.areaStyleOpacity},lineStyle:{width:e.lineStyleWidth,...S}}}if(u==="bar"){const{gradientShow:S,gradientColors:c,gradientOffset:y}=e,A={};if(e.barBorderRadius){const L=e.barBorderRadius.split(",");if(L!=null&&L.length){const F=[];for(const V of L){const v=parseFloat(V);isNaN(v)||F.push(v)}A.borderRadius=F}}S&&(A.color={x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:e.colors[i]},{offset:y,color:c[i]},{offset:1,color:c[i]}]}),b={...b,barWidth:e.barWidth,itemStyle:A}}e.isShowMarkLine&&(b.markLine={data:[{type:e.markLineType}]}),r.push(b)}return r}),s=p.computed(()=>{const r=e.yAxis;return r==null?void 0:r.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(i){return O(n.axisLabelFormatter,i)}},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:r=>{const n=r.length;let f="",i=e.tooltipFormatter;i===""&&(i="{marker} {a} {c}");const g=e.seriesTypes;for(let u=0;u<n;u++){const x=g[u],{tooltipFormatter:b}=x||{},{marker:S,seriesName:c,name:y,value:A,data:L}=r[u]||{};u===0&&(f+=`${y}<br/>`),f+=J(b||i,{textData:{marker:S,name:y,value:A,seriesName:c,a:c,b:y,c:A,...L}},{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:p.unref(d),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:p.unref(s),series:p.unref(a)}},ol=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}),tl={...Pe,runCode:ue,useTransformChartDataByAttrKey:Qe,useTransformChartDataByAttrValue:qe,useValueFormatter:O,useVariablesInText:J,transformProps:(e,o,l=12)=>({...ol(e),...Je(e,o,l)}),getIndicatorParams:We};P.default=tl,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
/*! @ecan-bi/tools@1.0.13 */
|
|
2
|
+
(function(k,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):(k=typeof globalThis!="undefined"?globalThis:k||self,L(k["@ecan/bi-tools"]={},k.Vue,k.Dayjs,k.LodashEs))})(this,function(k,L,F,G){"use strict";var gl=Object.defineProperty,bl=Object.defineProperties;var Sl=Object.getOwnPropertyDescriptors;var xe=Object.getOwnPropertySymbols;var He=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable;var $e=(k,L,F)=>L in k?gl(k,L,{enumerable:!0,configurable:!0,writable:!0,value:F}):k[L]=F,T=(k,L)=>{for(var F in L||(L={}))He.call(L,F)&&$e(k,F,L[F]);if(xe)for(var F of xe(L))Pe.call(L,F)&&$e(k,F,L[F]);return k},_=(k,L)=>bl(k,Sl(L));var we=(k,L)=>{var F={};for(var G in k)He.call(k,G)&&L.indexOf(G)<0&&(F[G]=k[G]);if(k!=null&&xe)for(var G of xe(k))L.indexOf(G)<0&&Pe.call(k,G)&&(F[G]=k[G]);return F};var Qe=(k,L,F)=>new Promise((G,ae)=>{var Z=$=>{try{R(F.next($))}catch(de){ae(de)}},B=$=>{try{R(F.throw($))}catch(de){ae(de)}},R=$=>$.done?G($.value):Promise.resolve($.value).then(Z,B);R((F=F.apply(k,L)).next())});const ae=(e,o)=>{const l=T({dayjs:F},o);let t="";const m=[];for(const d in l)t+=`${d},`,m.push(l[d]);t=t.replace(/,$/,"");const s=`function (${t}){return ${e}}`;let a;try{a=Function(`"use strict";return (${s})`)()(...m)}catch(d){return e}return a},Z=(e="",{textData:o,codeData:l}={},{useNewline:t=!1,useSpace:m=!1}={})=>{const s=T({},o),a=(e||"").match(/\{(.+?)\}/g);if(a==null||a.length===0)return e;for(let d=0;d<a.length;d++){const i=a[d];let n=i.slice(1,-1).trim();const f=/[\u4e00-\u9fa5a-z-_A-Z0-9]*/g,r=n.match(f);for(let b=0;b<r.length;b++){const u=r[b],S=s[u];S!=null&&(n=n.replace(u,S))}(/\(.*\)/g.test(n)||/[+/\\*]/g.test(n))&&(n=ae(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\((.*?)\)/,(d,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 de(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
|
+
`),Xe=(e="",o)=>{var a;const l=e.match(/\{(.+?)\}/g),t=((a=e.split(`
|
|
4
|
+
`))==null?void 0:a.length)-1;let m="";if(t)for(let d=0;d<t;d++)m+=`
|
|
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},formatTest:()=>{console.log("This is indicator")}},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(console.log("This is useValueFormatter"),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"}})});
|
|
6
6
|
//# sourceMappingURL=index.umd.js.map
|