UNPKG

amis-reports

Version:

爱速搭报表,基于 ECharts 实现的图表功能组件,旨在为用户提供简单和快捷的可视化报表能力,帮助用户在爱速搭平台上快速设计常见的数据报表页和大屏报表效果页。

1 lines 266 kB
import{getSchemaTpl as t,tipedLabel as l,utils as n,BasePlugin as i,setSchemaTpl as o,defaultValue as r}from"amis-editor";import{getEventControlConfig as s,getArgsWrapper as h}from"amis-editor/lib/renderer/event-control/helper";import m from"lodash/isObject";import p from"lodash/merge";import v from"lodash/omit";import{e as y,ai as x,f as S,aj as w,ak as T,al as O,g as F,am as C,J as L,an as N,V as M,ao as _,ap as $,c as A,aq as V,d as z,ar as B,as as D,at as k,au as E,av as P,a as J,_ as j,aw as R,ax as W,aa as H}from"./en-US-1cc0b4d9.js";export{d as getAppReportDatasetOptionsAllApi,f as getAppReportDesignDeleteApi,e as getAppReportDesignListApi,a as getAppReportJsonqlApi,c as getAppReportSourceOptionsAllApi,b as getJsonqlQueryApi,g as getReportConfig,u as updateReportConfig}from"./en-US-1cc0b4d9.js";import I from"lodash/isString";import*as q from"react";import Y from"lodash/isNumber";import X from"lodash/isBoolean";import U from"lodash/isPlainObject";import G from"lodash/isArray";import{CodeEditor as K}from"amis-editor-core";import{FormItem as Z,registerIcon as Q}from"amis";import ee from"lodash/debounce";import ae from"lodash/isEqual";import{registerFilter as te}from"amis-formula";import le from"lodash/find";import"lodash/pick";import"lodash/floor";import"amis-core";import"i18n-runtime";function ne(e){return[{type:"hidden",name:"model"},{type:"hidden",name:"dataSet"},{name:"name",label:"名称",mode:"vertical",required:!0,type:"input-text"},{name:"valueType",label:"数据类型",mode:"vertical",required:!0,type:"radios",value:"integer",options:"measures"===e?[{label:"字符串",value:"text"},{label:"整数",value:"integer"},{label:"小数",value:"decimal"}]:[{label:"字符串",value:"text"},{label:"整数",value:"integer"},{label:"小数",value:"decimal"},{label:"日期",value:"date"},{label:"日期时间",value:"datetime"}]},{type:"tpl",className:"block mb-5",tpl:"当前可用字段"},{mode:"vertical",style:{maxHeight:"300px",overflow:"auto"},...t("layout:wrapper-contanier",{body:[{type:"tpl",className:"block mb-5",tpl:"<h3>主表</h3>"},{type:"table",visibleOn:'dataSourceType == "dataModel"',source:"${[__modelFields, __relationModelFields, model]|getModelFields}",affixHeader:!1,columns:[{name:"name",label:"字段名称"},{name:"label",label:"显示标题"},{name:"type",type:"tpl",label:"字段类型",tpl:"${tag}(${type})"}]},{type:"crud",visibleOn:'dataSourceType == "dataSet"',source:"${[__modelFields, __relationModelFields, dataSet]|getModelFields}",affixHeader:!1,columns:[{name:"key",label:"字段名称"},{name:"table",label:"表名"},{name:"label",label:"显示标题"},{name:"type",type:"tpl",label:"字段类型"}]}]})},{type:"alert",visibleOn:'dataSourceType == "dataSet"',body:"注意:数据集需要以 数据模型.字段名称 的形式取字段, 如 model_student.id * 10",level:"warning",className:"mb-1"},{name:"expressionStr",label:l("SQL表达式","可对多个字段进行加减乘除、以及一些 SQL 函数计算(如:CONCAT、DATEDIFF、ADDDATE 等)等操作后形成一个新的计算字段。"),type:"editor",mode:"vertical",langguage:"sql",required:!0}]}function ie(e,a){return t("layout:wrapper-contanier",{visibleOn:'${fieldType == "expression"}',className:"tip-position-15p",body:[{type:"select",source:{method:"get",url:y("expressions"),adaptor:e=>(x("expressions",e?.data||[]),e)},name:"field",valueField:"id",labelField:"name",label:"选择表达式",creatable:!0,editable:!0,removable:!0,autoFill:{label:"${name}",valueType:"${valueType}"},addApi:{method:"post",url:y("expressions")},editApi:{method:"post",url:y("expressions")},deleteApi:{method:"delete",url:S("expressions")},addControls:ne(e),editControls:[...ne(e),{name:"id",type:"hidden"}]},{name:"as",type:"formula",formula:'${CONCATENATE(field, "_CASE")}'},a?{label:"基于字段排序",name:"orderBy",type:"select",options:[{label:"无",value:""},{label:"升序",value:"asc"},{label:"降序",value:"desc"}]}:null].filter((e=>e))})}const oe=()=>[{type:"hidden",name:"model"},{type:"hidden",name:"dataSet"},{name:"name",label:"名称",required:!0,type:"input-text"},{type:"select",visibleOn:'dataSourceType == "dataModel"',label:"选择字段",placeholder:"选择维度字段",name:"dimensionField",source:"${[__modelFields, __relationModelFields, model]|concatFieldsForDimension}",autoFill:{table:"${table}"},onChange(e,a,t,l){l.deleteValueByName("dimensionGroups")},valueField:"name",required:!0},{type:"select",visibleOn:'dataSourceType == "dataSet"',label:"选择字段",placeholder:"选择维度字段",name:"dimensionField",source:"${[__modelFields, __relationModelFields, dataSet]|concatFieldsForDimension}",autoFill:{table:"${table}"},onChange(e,a,t,l){l.deleteValueByName("dimensionGroups")},valueField:"key",required:!0},{name:"dimensionGroups",type:"combo",multiple:!0,visibleOn:"dimensionField",label:"维度值分组",canAccessSuperData:!0,strictMode:!1,required:!0,items:[{type:"input-text",placeholder:"自定义分组名称",name:"groupName"},{type:"select",name:"groupValues",id:"groupValues${index}",required:!0,multiple:!0,searchable:!0,source:{method:"post",requestAdaptor:(e,a)=>{const{model:t,dimensionField:l,__modelFields:n,__relationModelFields:i,dataSourceType:o,dataSet:r,table:c}=a;let s=n,d=i;s||d||(s=w(t||r),d=T(t||r));let h=[{column:l,as:c?`${c}${l}`:l}];if("dataModel"===o){const e=d?.find((e=>e.name===l));e&&(h=[{column:e.key,table:e.targetKey,as:l}])}else if("dataSet"===o){const e=s.find((e=>e.name===l||e.key===l));h=[{column:e?.key||l,table:c??e.table,as:l}]}const m={statement:"SELECT",select:h,many:!0,distinct:!0,where:{operator:"and",children:[{left:{column:l},op:"IS NOT NULL"}]}};if("dataModel"===o){m.from=t.split(":").join(".");const e=O(s,d,t.split(":")[1]);e.length&&(m.join=e)}else"dataSet"===o&&(m.fromDataSet=r);return"jssdk"===F("reportMode")?e.data=m:e.data={jsonqlstr:JSON.stringify(m)},e},adaptor:(e,a,t,l)=>{const{data:n}=e,{dimensionField:i,dataSourceType:o}=t.body,r=i;return e.data={options:n.map((e=>{const a=C(e[r],i);let t=a;return L(a)||I(a)||(t=a.toString()),{label:t,value:a}}))},e},url:"${model|getAppReportJsonqlApi}"}}]},{name:"else",label:l("其他","「其他」配置项的变更只是当前分组选项中的数据更新,如需更新到报表组件,请重新选择当前分组。"),type:"input-text"}];function re(e){return[{type:"hidden",name:"model"},{type:"hidden",name:"dataSet"},{name:"name",label:"名称",required:!0,type:"input-text"},{name:"buckets",type:"combo",multiple:!0,label:"数据桶",canAccessSuperData:!0,strictMode:!1,multiLine:!0,items:[{type:"input-text",placeholder:"自定义数据桶名称",name:"bucketName",required:!0},{type:"condition-builder",name:"filterCondition",label:"数据桶条件",formula:{variables:async a=>await n.resolveVariablesFromScope(e.context.node,e.manager),inputSettings:{},mixedMode:!0,variableMode:"tree"},required:!0,source:"${[dataSourceType, __modelFields, __relationModelFields, model, dataSet]|getReportWhereConditionBuilderFields}"}]},{name:"else",label:l("其他","「其他」配置项的变更只是数当前据桶选项中的数据更新,如需更新到报表组件,请重新选择当前数据桶。"),type:"input-text"}]}function ce(e){return t("layout:wrapper-contanier",{visibleOn:'${fieldType == "dataBucket"}',className:"tip-position-15p",body:[{type:"select",source:{method:"get",url:y("dataBuckets"),adaptor:e=>(x("dataBuckets",e?.data||[]),e)},name:"field",valueField:"id",labelField:"name",label:"选择数据桶",creatable:!0,editable:!0,removable:!0,autoFill:{label:"${name}"},addApi:{method:"post",url:y("dataBuckets")},editApi:{method:"post",url:y("dataBuckets")},deleteApi:{method:"delete",url:S("dataBuckets")},addControls:re(e),editControls:[...re(e),{name:"id",type:"hidden"}]},{name:"as",type:"formula",formula:'${CONCATENATE(field, "_CASE")}'},{name:"as",type:"formula",formula:'${CONCATENATE(field, "_CASE")}'},{label:"排序",name:"orderBy",type:"select",options:[{label:"无",value:""},{label:"升序",value:"asc"},{label:"降序",value:"desc"}]}]})}const se=({value:e,onChange:a})=>q.createElement("div",{className:"ae-JsonEditor"},q.createElement(K,{value:e,onChange:a}));function de(e){let a="undefined";switch(e){case"number":a="数字";break;case"boolean":a="布尔值";break;case"date":a="日期";break;case"string":a="文本";break;case"array":a="数组";break;case"object":a="对象"}return a}function he(e){let a="undefined";var t;return Y(e)?a="number":X(e)?a="boolean":(t=e)&&(function(e){return/^\d{4}(-|\/|\.)\d{1,2}(-|\/|\.)\d{1,2}$/.test(e)}(t)||function(e){return/^\d{4}(-|\/|\.)\d{1,2}(-|\/|\.)\d{1,2}\s\d{1,2}:\d{1,2}$/.test(e)||/^\d{4}(-|\/|\.)\d{1,2}(-|\/|\.)\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2}$/.test(e)}(t)||function(e){return/^\d{1,2}:\d{1,2}:\d{1,2}$/.test(e)||/^\d{1,2}:\d{1,2}$/.test(e)}(t)||Date.parse(t))?a="date":I(e)?a="string":G(e)?a="array":U(e)&&(a="object"),a}const me=["__super","__prev","__pristine","__page","__query","amisApp","amisCompany","amisPage","amisStore","amisUser","appVariables","app","router","appDics","acl","companyDics","amisEntity"];function pe(e,a){let t=[];if(!e)return t;let l=e;if(G(e)&&(l=e[0]),m(l)){Object.keys(l).map((e=>{if("$$id"===e)return;let n=l[e];const i=he(n),o=de(i);(G(n)||m(n))&&(n=JSON.stringify(n)),t.push({label:e,value:e,curValue:n,fxValue:`\${${e}}`,type:i,tag:o,disabled:!!a&&-1===a.indexOf(i)})})),l.__super&&(t=ue(l.__super,t,a))}return t}function ue(e,a,t){let l=a?a.concat([]):[];if(e){Object.keys(e).map((a=>{if("$$id"!==a&&-1===me.indexOf(a)){let n=e[a];const i=he(n),o=de(i);(G(n)||U(n))&&(n=JSON.stringify(n)),l.some((e=>e.label===a))||l.push({label:a,value:a,curValue:n,fxValue:`\${${a}}`,type:i,tag:o,disabled:!!t&&-1===t.indexOf(i)})}})),e.__super&&(l=ue(e.__super,l,t))}return l}async function be(e){const{rendererSchema:a,compContextData:t,needFieldTypes:l,fetcher:n}=e;let i=[];const o=p({},v(t,["amisPage","amisEntity","amisStore"]),t?.amisPage?.consts||{});if("api"===a.dataSourceType){const e=a.dataApi;if(N(e,o)&&e?.url&&n){let a={};try{a=await n(e,o)}catch(a){console.warn(`[${e.url}]接口请求异常:`,a)}let t={};a.data&&(a.data.data||a.data.items)?t=a.data.data||a.data.items:!a.data&&!a.items||a.data.errcode||a.data.stack||(t=a.data||a.items),i=t?pe(t,l):[]}}else if(a.contextData&&G(a.contextData)&&a.contextData.length>0){const e=(a.contextData||[])[0]?.data;i=pe(M(e,t),l)}return i}function ve(e,a){return{title:"事件",className:"p-none",body:[t("eventControl",{name:"onEvent",...s(e,a)})]}}const ye=[{label:"无",value:""},{label:"精度控制",value:"precision"},{label:"金额分转元",value:"centToYuan"},{label:"增加千位分隔符号",value:"thousandSeparatorNumber"},{label:"纯数字无千位分隔符号",value:"pureNumber"},{label:"末尾添加百分号(*%)",value:"numberAddPercentTag"},{label:"百分比(*%)",value:"numberToPercent"},{label:"数字转万/亿",value:"numberToMillionBillion"},{label:"秒转时分秒",value:"secondToHMS"},{label:"秒转天时分秒",value:"secondToDHMS"},{label:"字节转MB / GB",value:"byteToMGB"},{label:"字节转Mbps (带宽)",value:"byteToMbps"}],ge=[{label:"无",value:""},{label:"精度控制",value:"precision"},{label:"末尾添加百分号(*%)",value:"numberAddPercentTag"},{label:"百分比(*%)",value:"numberToPercent"},{label:"计算占比",value:"totalToPercent"}];function xe(e){const a=e??"formatter";return`${a} === "numberToPercent" || ${a} === "numberToMillionBillion" || ${a} === "precision"`}function fe(e){const a=e?.name??"formatter",n="chart-percent"===e?.chartType?ge:ye,i=e?.useContextVariables??!1;return[{label:"数值格式化",name:"formatter",options:n,selectFirst:!0,onChange:(e,a,t,l)=>{"numberToPercent"!==e&&l.deleteValueByName("formatterClearZero"),"numberToMillionBillion"!==e&&"precision"!==e&&l.deleteValueByName("formatterToFixed"),l.deleteValueByName("totalField"),l.deleteValueByName("totalFieldFunc"),l.deleteValueByName("totalFieldAs")},...e,type:"select"},t("layout:wrapper-contanier",{visibleOn:'${formatter == "totalToPercent"}',className:"tip-position-15p",body:[{label:l("总值字段","非必填,未配置则默认按总值100来计算当前进度值。"),visibleOn:'${dataSourceType == "context" || dataSourceType == "api" || dataSourceType == "staticJson"}',type:"select",name:"totalField",selectMode:"table",source:i?"${__contextVariables | getNumberFields}":"${__contextFields | getNumberFields}",columns:[{name:"label",label:"字段名称"},{name:"tag",label:"字段类型"}],required:!0,valueField:"label",clearable:!0,searchable:!0,creatable:!0},{visibleOn:'${dataSourceType === "dataModel"}',label:l("总值字段","非必填,未配置则默认按总值100来计算当前进度值。"),type:"select",source:"${[__modelFields, __relationModelFields, model]|getModelFields}",name:"totalField",valueField:"name",required:!0,autoFill:{__totalFieldType:"${type}"},onChange(e,a,t,l){l.deleteValueByName("totalFieldFunc"),l.deleteValueByName("totalFieldAs")}},{visibleOn:'${dataSourceType === "dataSet"}',label:l("总值字段","非必填,未配置则默认按总值100来计算当前进度值。"),type:"select",source:"${[__modelFields, __relationModelFields, dataSet]|getModelFields}",name:"totalField",valueField:"name",required:!0,autoFill:{__totalFieldType:"${type}"},onChange(e,a,t,l){l.deleteValueByName("totalFieldFunc"),l.deleteValueByName("totalFieldAs")}},{visibleOn:'${(dataSourceType === "dataModel" || dataSourceType === "dataSet") && (__totalFieldType === "int" || __totalFieldType === "float" || __totalFieldType === "money")}',label:"总值聚合方式",type:"select",name:"totalFieldFunc",required:!0,options:[..._,...$]},{visibleOn:'${(dataSourceType === "dataModel" || dataSourceType === "dataSet") && (__totalFieldType !== "int" && __totalFieldType !== "float" && __totalFieldType !== "money")}',label:"总值聚合方式",type:"select",name:"totalFieldFunc",required:!0,options:_},{name:"totalFieldAs",visibleOn:'${dataSourceType === "dataModel" || dataSourceType === "dataSet"}',type:"formula",formula:'${totalFieldFunc ? CONCATENATE(totalField, "_", totalFieldFunc) : totalField}'}]}),t("chart:input-number",{label:l("保留小数位数","可设置0-100之间的精度"),min:0,max:100,step:1,visibleOn:`\${${xe(a)}}`,name:"formatterToFixed"}),{label:l("小数点后0","开启后,不展示小数点右侧最后面的0"),visibleOn:`\${${a} === "numberToPercent"}`,name:"formatterClearZero",type:"switch"}]}function Se(){return{label:"实体数据源",mode:"horizontal",type:"nested-select",visibleOn:'${dataSourceType == "dataModel"}',name:"model",onlyLeaf:!0,autoFill:{__modelFields:"${form.fields}",__relationModelFields:"${form.relationFields}"},source:{url:A(),method:"get",adaptor:e=>(V(e.data?.options||[]),e)},reload:"whereConditionRaw,havingConditionRaw",onChange(e,a,t,l){l.setValueByName("dimensions",[]),l.setValueByName("measures",[]),l.deleteValueByName("whereConditionRaw"),l.deleteValueByName("havingConditionRaw")}}}function we(){return{label:"数据集",type:"nested-select",mode:"horizontal",visibleOn:'${dataSourceType == "dataSet"}',name:"dataSet",onlyLeaf:!0,source:{url:z(),method:"get",adaptor:(e,a,t,l)=>(V(e.data?.options||[]),e)},autoFill:{__modelFields:"${fields}"},reload:"whereConditionRaw,havingConditionRaw",onChange(e,a,t,l){l.setValueByName("dimensions",[]),l.setValueByName("measures",[]),l.deleteValueByName("whereConditionRaw"),l.deleteValueByName("havingConditionRaw")}}}function Te(e){return{visibleOn:'${dataSourceType == "dataModel" || dataSourceType == "dataSet"}',type:"condition-builder",embed:!1,name:"whereConditionRaw",label:"筛选条件",mode:"horizontal",formula:{variables:async a=>await n.resolveVariablesFromScope(e.context.node,e.manager),mode:"input-group",inputSettings:{},mixedMode:!0,variableMode:"tree"},source:"${[dataSourceType, __modelFields, __relationModelFields, model, dataSet]|getReportWhereConditionBuilderFields}"}}function Oe(e){return{visibleOn:e.visibleOn??'dataSourceType === "dataModel" || dataSourceType === "dataSet"',type:"condition-builder",name:"havingConditionRaw",embed:!1,mode:"horizontal",label:"聚合筛选条件",formula:{variables:async a=>await n.resolveVariablesFromScope(e.context.node,e.manager),mixedMode:!0,variableMode:"tree"},source:"${[dataSourceType, dimensions, measures, measures2, bubbleField, __modelFields, __relationModelFields, model, dataSet]|getReportHavingConditionBuilderFields}"}}function Fe(e){const{defaultChartData:a,defaultDimensions:t,defaultMeasures:l,customOptions:n,needFieldTypes:i}=e||{},o=[{label:"API拉取",value:"api"},{label:"静态JSON",value:"staticJson"},{label:"上下文",value:"context"}],r=i||["string","number","date"],c=F();return c.useDataModelSource&&o.push({label:"实体数据源",value:"dataModel"}),c.useDataSetSource&&o.push({label:"数据集",value:"dataSet"}),{type:"select",name:"dataSourceType",mode:"horizontal",label:"数据获取方式",value:"staticJson",onChange:(e,n,i,o)=>{if(o.setValueByName("dimensions",[]),o.setValueByName("measures",[]),o.setValueByName("__contextFields",[]),o.deleteValueByName("groupField"),o.deleteValueByName("bubbleField"),"dataModel"!==e&&"dataSet"!==e&&(o.deleteValueByName("dsl"),o.deleteValueByName("whereConditionRaw"),o.deleteValueByName("havingConditionRaw"),o.data?.modelFields&&o.deleteValueByName("modelFields"),o.data?.relationModelFields&&o.deleteValueByName("relationModelFields")),"dataModel"!==e&&o.deleteValueByName("model"),"dataSet"!==e&&o.deleteValueByName("dataSet"),"context"!==e&&o.deleteValueByName("contextData"),"api"!==e&&o.deleteValueByName("dataApi"),"staticJson"===e){const e=o.getValueByName("__staticJson")||a||[],n=o.getValueByName("__dimensions")||t||[],i=o.getValueByName("__measures")||l||[];o.setValueByName("staticJson",e),o.setValueByName("dimensions",n),o.setValueByName("measures",i);const c=pe(e,r);o.setValueByName("__contextFields",c)}else o.deleteValueByName("staticJson")},options:o.concat(n||[])}}function Ce(e){const{fetcher:a,needFieldTypes:n,contextData:i}=e,o=n||["string","number","date"],r=window.store?.app?.id,c=p({},v(i,["amisPage","amisEntity","amisStore"]),i?.amisPage?.consts||{});return t("apiControl",{name:"dataApi",label:l("数据接口","可通过接口获取图表所需业务数据"),mode:"vertical",visibleOn:'${dataSourceType === "api"}',hiddenSelectBtn:!r,onChange:(e,t,l,n)=>{N(e,c)&&e?.url&&a?(n.setValueByName("apiDataLoading","on"),a(e,c).then((e=>{n.deleteValueByName("apiDataLoading");let a={};e.data&&(e.data.data||e.data.items)?a=e.data.data||e.data.items:!e.data&&!e.items||e.data.errcode||e.data.stack||(a=e.data||e.items);const t=pe(a,o);n.setValueByName("__contextFields",t)}))):n.setValueByName("__contextFields",[])}})}function Le(e,a){const{needFieldTypes:t}=a||{},l=t||["string","number","date"];return{name:"staticJson",mode:"vertical",visibleOn:'${dataSourceType === "staticJson"}',label:"静态JSON数据",asFormItem:!0,component:se,onChange(a,t,n,i){if(i&&m(i)){e.node.updateSchema({staticJson:a});const t=pe(a,l);i.setValueByName("__contextFields",t)}}}}function Ne(e,a){const{label:l,visibleOn:n,minLength:i,maxLength:o,withOrder:r,addable:c}=e;a=a||[];let s=l;m(s)&&(s=s.body);let d=[{label:"模型字段",value:"modelField"}];const h=F();return(h.useDataModelSource||h.useDataSetSource)&&h.useReportDesignConfig&&(d=d.concat([{label:"表达式",value:"expression"},{label:"分组",value:"group"},{label:"数据桶",value:"dataBucket"}])),{type:"input-sub-form",visibleOn:n||'${dataSourceType == "dataModel" || dataSourceType == "dataSet"}',name:"dimensions",btnLabel:"${label}",multiple:!0,draggable:!0,addable:c??!0,removable:!0,minLength:i,maxLength:o,label:l||"选择维度",form:{title:`设置 ${s||"维度字段"}`,body:[{label:"字段类型",type:"select",name:"fieldType",value:"modelField",options:d,required:!0,onChange(e,a,t,l){l.deleteValueByName("field"),l.deleteValueByName("statisticsFunction"),l.deleteValueByName("as")}},t("layout:wrapper-contanier",{visibleOn:'${fieldType == "modelField"}',className:"tip-position-15p",body:[{visibleOn:'dataSourceType == "dataModel"',type:"select",source:"${[__modelFields, __relationModelFields, model]|concatFieldsForDimension}",name:"field",valueField:"name",autoFill:{label:"${label}",__modelFieldType:"${type}"},label:"选择实体字段",required:!0,onChange(e,a,t,l){l.setValueByName("statisticsFunction","")}},{visibleOn:'dataSourceType == "dataSet"',type:"select",source:"${[__modelFields, __relationModelFields, dataSet]|concatFieldsForDimension}",name:"field",valueField:"key",autoFill:{label:"${label}",as:"${name}",__modelFieldType:"${type}"},label:"选择数据集字段",required:!0,onChange(e,a,t,l){l.setValueByName("statisticsFunction","")}},{label:"日期数据聚合",visibleOn:'${__modelFieldType && __modelFieldType === "datetime" || __modelFieldType === "date" || __modelFieldType === "time"}',type:"select",name:"statisticsFunction",required:!0,clearValueOnHidden:!0,options:B},r?{label:"基于字段排序",name:"orderBy",type:"select",options:[{label:"无",value:""},{label:"升序",value:"asc"},{label:"降序",value:"desc"}]}:null,{name:"as",visibleOn:'dataSourceType == "dataModel"',type:"formula",formula:'${statisticsFunction ? CONCATENATE(field, "_", statisticsFunction) : field}'},{name:"as",visibleOn:'dataSourceType == "dataSet"',type:"formula",formula:'${statisticsFunction ? CONCATENATE(field, "_", statisticsFunction) : as}'}].filter((e=>e))}),ie("dimensions",r),t("layout:wrapper-contanier",{visibleOn:'${fieldType == "group"}',className:"tip-position-15p",body:[{type:"select",source:{method:"get",url:y("groups"),adaptor:e=>(x("groups",e?.data||[]),e)},name:"field",valueField:"id",labelField:"name",label:"选择分组",required:!0,creatable:!0,editable:!0,removable:!0,autoFill:{label:"${name}"},addApi:{method:"post",url:y("groups")},editApi:{method:"post",url:y("groups")},deleteApi:{method:"delete",url:S("groups")},addControls:oe(),editControls:[...oe(),{name:"id",type:"hidden"}]},{name:"as",type:"formula",formula:'${CONCATENATE(field, "_CASE")}'},{label:"排序",name:"orderBy",type:"select",selectFirst:!0,options:[{label:"无",value:""},{label:"升序",value:"asc"},{label:"降序",value:"desc"}]}]}),ce(e),...a]}}}function Me(e,a){const{label:t,visibleOn:n,minLength:i,maxLength:o,addable:r,withDateOrder:c,onlyUseNumberFields:s}=e;a=a||[];let d=t;const h=c??!1;return m(d)&&(d=d.body),{type:"input-sub-form",visibleOn:n||'${dataSourceType == "context" || dataSourceType == "api" || dataSourceType == "staticJson"}',name:"dimensions",btnLabel:"${label || as}",multiple:!0,draggable:!0,addable:r??!0,removable:!0,minLength:i,maxLength:o,label:t||"选择维度",form:{title:`设置 ${d||"维度字段"}`,body:[{label:"API字段",visibleOn:'${dataSourceType === "api"}',type:"select",name:"as",selectMode:"table",source:s?"${__contextFields | getNumberFields}":"${__contextFields}",columns:[{name:"label",label:"API字段"},{name:"tag",label:"字段类型"}],autoFill:{type:"${type}"},required:!0,valueField:"label",clearable:!0,searchable:!0,creatable:!0},{label:"上下文字段",visibleOn:'${dataSourceType === "context"}',type:"select",name:"as",selectMode:"table",source:s?"${__contextFields | getNumberFields}":"${__contextFields}",columns:[{name:"label",label:"上下文字段"},{name:"tag",label:"字段类型"}],autoFill:{type:"${type}"},required:!0,valueField:"label",clearable:!0,searchable:!0,creatable:!0},{label:"JSON字段",visibleOn:'${dataSourceType === "staticJson"}',type:"select",name:"as",selectMode:"table",source:s?"${__contextFields | getNumberFields}":"${__contextFields}",columns:[{name:"label",label:"JSON字段"},{name:"tag",label:"字段类型"}],autoFill:{type:"${type}"},required:!0,valueField:"label",clearable:!0,searchable:!0,creatable:!0},{type:"input-text",name:"label",label:l("字段名称","非必填,可用于备注字段名称。"),placeholder:"非必填,可用于备注字段名称"},h?{label:"基于日期排序",name:"orderBy",type:"select",selectFirst:!0,visibleOn:'${type === "date"}',options:[{label:"无",value:""},{label:"升序",value:"asc"},{label:"降序",value:"desc"}]}:null,...a]}}}function _e(e,a){const{name:t,label:n,visibleOn:i}=e||{};return{label:n||l("分组字段",'当设置一个Y轴/值轴时,可使用分组字段对图表数据进行分组展示,用于实现"行转列"对比功能。'),type:"select",name:t||"groupField",source:"${[dataSourceType, __modelFields, __relationModelFields, __contextFields, measures, dimensions, model, dataSet]|getGroupFields}",placeholder:"[非必填]请选择分组字段",clearable:!0,visibleOn:i||"${!doubleYAxis && measures && measures.length < 2 && dimensions && dimensions.length > 0}"}}function $e(e,a){const{name:n,label:i,visibleOn:o,minLength:r,maxLength:c,withFormatter:s,withOrder:d,addable:h,hiddenCutomLabel:p,chartType:u,onlyUseStringFields:b}=e;a=a||[];let v=[{label:"模型字段",value:"modelField"}];const y=F();(y.useDataModelSource||y.useDataSetSource)&&y.useReportDesignConfig&&(v=v.concat([{label:"表达式",value:"expression"}]));let g=i;return m(g)&&(g=g.body),{type:"input-sub-form",visibleOn:o||'${dataSourceType == "dataModel" || dataSourceType == "dataSet"}',name:n||"measures",btnLabel:"${statisticsFunction|functions_mark}${customLabel || label}",multiple:!0,draggable:!0,addable:h??!0,removable:!0,minLength:r,maxLength:c,label:i||"选择值轴",form:{title:`设置 ${g||"值轴字段"}`,body:[{label:"图表类型",type:"select",visibleOn:"${columnLineMix}",value:"bar",name:"serieChartType",required:!0,options:[{label:"折线",value:"line"},{label:"柱状",value:"bar"}]},{label:"字段类型",type:"select",value:"modelField",name:"fieldType",options:v,required:!0,onChange(e,a,t,l){l.deleteValueByName("field"),l.deleteValueByName("statisticsFunction"),l.deleteValueByName("as")}},t("layout:wrapper-contanier",{visibleOn:'${fieldType == "modelField"}',className:"tip-position-15p",body:[{visibleOn:'dataSourceType == "dataModel"',type:"select",source:"${[__modelFields, __relationModelFields, model]|getModelFields}",name:"field",valueField:"name",label:"选择实体字段",required:!0,autoFill:{label:"${label}",__modelFieldType:"${type}"},onChange(e,a,t,l){l.deleteValueByName("statisticsFunction"),l.deleteValueByName("as")}},{visibleOn:'dataSourceType == "dataSet"',type:"select",source:"${[__modelFields, __relationModelFields, dataSet]|getModelFields}",name:"field",valueField:"name",label:"选择数据集字段",required:!0,autoFill:{label:"${label}",__modelFieldType:"${type}"},onChange(e,a,t,l){l.deleteValueByName("statisticsFunction"),l.deleteValueByName("as")}},{type:"input-text",hidden:p??!1,name:"customLabel",label:l("字段名称","非必填,配置后图表中优先展示此字段名称。"),placeholder:"非必填,配置后图表中优先展示此字段名称。"},b?null:{visibleOn:'${__modelFieldType === "int" || __modelFieldType === "float" || __modelFieldType === "money"}',label:"聚合方式",type:"select",name:"statisticsFunction",required:!0,options:[..._,...$]},b?null:{visibleOn:'${__modelFieldType !== "int" && __modelFieldType !== "float" && __modelFieldType !== "money"}',label:"聚合方式",type:"select",name:"statisticsFunction",required:!0,options:_},{name:"as",type:"formula",formula:'${statisticsFunction ? CONCATENATE(field, "_", statisticsFunction) : field}'},d?{label:"基于字段排序",name:"orderBy",type:"select",selectFirst:!0,options:[{label:"无",value:""},{label:"升序",value:"asc"},{label:"降序",value:"desc"}]}:null].filter((e=>e))}),ie("measures",d),...s?fe({name:"formatter",chartType:u}):[],...a]}}}function Ae(e,a){const{name:t,label:n,visibleOn:i,minLength:o,maxLength:r,addable:c,onlyUseStringFields:s,withFormatter:d,withOrder:h,chartType:p}=e;a=a||[];const u=h??!1;let b=n;return m(b)&&(b=b.body),{type:"input-sub-form",visibleOn:i||'${dataSourceType == "context" || dataSourceType == "api" || dataSourceType == "staticJson"}',name:t||"measures",btnLabel:"${statisticsFunction|functions_mark}${label || as}",multiple:!0,draggable:!0,addable:c??!0,removable:!0,minLength:o,maxLength:r,label:n||"选择值轴",form:{title:`设置 ${b||"值轴字段"}`,body:[{label:"图表类型",type:"select",visibleOn:"${columnLineMix}",value:"bar",name:"serieChartType",required:!0,options:[{label:"折线",value:"line"},{label:"柱状",value:"bar"}]},{label:"JSON字段",visibleOn:'${dataSourceType === "staticJson"}',type:"select",name:"as",selectMode:"table",source:s?"${__contextFields}":"${__contextFields | getNumberFields}",columns:[{name:"label",label:"JSON字段"},{name:"tag",label:"字段类型"}],required:!0,valueField:"label",clearable:!0,searchable:!0,creatable:!0,autoFill:{modelFieldType:"${type}"}},{label:"API字段",visibleOn:'${dataSourceType === "api"}',type:"select",name:"as",selectMode:"table",source:s?"${__contextFields}":"${__contextFields | getNumberFields}",columns:[{name:"label",label:"API字段"},{name:"tag",label:"字段类型"}],required:!0,valueField:"label",clearable:!0,searchable:!0,creatable:!0,autoFill:{modelFieldType:"${type}"}},{label:"上下文字段",visibleOn:'${dataSourceType === "context"}',type:"select",name:"as",selectMode:"table",source:s?"${__contextFields}":"${__contextFields | getNumberFields}",columns:[{name:"label",label:"上下文字段"},{name:"tag",label:"字段类型"}],required:!0,valueField:"label",clearable:!0,searchable:!0,creatable:!0,autoFill:{modelFieldType:"${type}"}},{type:"input-text",name:"label",label:l("字段名称","非必填,配置后图表中优先展示此字段名称。"),placeholder:"非必填,配置后图表中优先展示此字段名称。"},u?{label:"基于字段排序",name:"orderBy",type:"select",selectFirst:!0,visibleOn:'${modelFieldType === "number"}',options:[{label:"无",value:""},{label:"升序",value:"asc"},{label:"降序",value:"desc"}]}:null,...d?fe({visibleOn:'${modelFieldType === "number"}',name:"formatter",chartType:p}):[],...a]}}}function Ve(){return t("chart:input-number",{visibleOn:'${dataSourceType == "dataModel" || dataSourceType == "dataSet"}',name:"limit",min:0,label:"查询结果行数"})}te("getModelFields",D),te("concatFieldsForDimension",(e=>{let[a,t,l]=e;return!l||a||t||(a=w(l),t=T(l)),t=t||[],a.concat(t.filter((e=>"n"!==e.relationMode?.split(":")[1]&&!e.joinColumnAtTarget&&"relation"!==e.type))).filter((e=>!e.isForeignKey&&!k(e.type)&&"deletedAt"!==e.name&&"deletedAt"!==e.key))})),te("getReportWhereConditionBuilderFields",(e=>{let[a,t,l,n,i]=e;if(!n&&!i)return[];if("dataSet"===a&&i&&t){return t.map((e=>{const a={label:e.label,name:`dataset.${e.table}.${e.key}`,type:E[e.type]};return"user"!==e.type&&"owner"!==e.type&&"department"!==e.type&&"owner-department"!==e.type||(a.operators=["equal","not_equal","is_empty","is_not_empty"]),a})).filter((e=>e.type&&"select"!==e.type&&"boolean"!==e.type))}return t||l||(t=w(n||i),l=T(n||i)),(t||[]).concat(l?.filter((e=>"n"!==e.relationMode?.split(":")[1]&&!e.joinColumnAtTarget&&"relation"!==e.type))||[]).filter((e=>!e.isForeignKey&&"deletedAt"!==e.name&&"deletedAt"!==e.key&&E[e.type])).map((e=>{const a={label:e.label,name:e.table?`dataset.${e.table}.${e.key}`:e.name,type:E[e.type]};return"select"===a.type&&(e.source?a.source=e.source:e.options&&(a.options=e.options)),"user"!==e.type&&"owner"!==e.type&&"department"!==e.type&&"owner-department"!==e.type||(a.operators=["equal","not_equal","is_empty","is_not_empty"]),a}))})),te("getReportHavingConditionBuilderFields",(e=>{let[a,t,l,n,i,o,r,c,s]=e;t=t||[],l=(l||[]).concat(n||[]).concat(i||[]),!c||o||r||(o=w(c),r=T(c));const d=[];return t.forEach((e=>{if("expression"===e.fieldType){const{valueType:a}=e;d.push({label:`[表达式]${e.label}`,type:"integer"===a||"decimal"===a?"number":a,name:e.as})}else"dataBucket"===e.fieldType?d.push({label:`[数据桶]${e.label}`,type:"number",name:e.as}):"group"===e.fieldType&&d.push({label:`[分组]${e.label}`,type:"text",name:e.as})})),l.forEach((e=>{if("modelField"===e.fieldType){let t;t=le("dataSet"===a?o:o.concat(r),(a=>a.name===e.field||a.key===e.field));const l=le([..._,...$],(a=>a.value===e.statisticsFunction));d.push({label:l?`[${l?.label}]${t?.label}`:t?.label,type:"number",name:e.as})}else"expression"===e.fieldType&&d.push({label:`[表达式]${e.label}`,type:"text",name:e.as})})),d})),te("functions_mark",P),te("getGroupFields",(e=>{const[a,t,l,n,i,o,r,c]=e,s=[],d=o||[],h=(i||[])[0],m=1===d.length?d[0]:{};let p=n;return"dataModel"!=a&&"dataSet"!=a||(p=D([t,l,r||c])),p&&0!==p.length?(p.forEach((e=>{e.value||(e.value=e.name),h.as===e.value||h.field===e.value||m.as===e.value||m.field===e.value?s.push({...e,disabled:!0}):s.push(e)})),s):[]})),te("getBubbleFields",(e=>{const[a,t,l,n,i,o]=e;let r=n;return"dataModel"!=a&&"dataSet"!=a||(r=D([t,l,i||o])),r&&0!==r.length?r:[]})),te("getNumberFields",(e=>{const a=[];return e.forEach((e=>{"number"!==e.type?a.push({...e,disabled:!0}):a.push(e)})),a})),te("getAppReportJsonqlApi",(e=>J(e))),te("getAppReportDesignListApi",(e=>y(e)));const ze=[{type:"object",properties:{data:{type:"object",title:"图表数据",properties:{seriesType:{type:"string",title:"seriesType",description:"图表类型,值可能为:line、bar、pie 等。"},seriesName:{type:"string",title:"seriesName",description:"图例名称"},name:{type:"string",title:"name",description:"数据名(X轴 / 维度数值)"},dataIndex:{type:"number",title:"dataIndex",description:"图表数据项所在位置"},value:{type:"number",title:"value",description:"当前图表数据值"},color:{type:"string",title:"color",description:"当前图表颜色"}}}}}],Be=[{eventName:"init",eventLabel:"初始化",description:"组件实例被创建并插入 DOM 中时触发",dataSchema:[{type:"object",properties:{data:{type:"object",title:"数据",description:"当前数据域,可以通过.字段名读取对应的值"}}}]},{eventName:"click",eventLabel:"鼠标点击",description:"鼠标点击时触发",dataSchema:ze},{eventName:"mouseover",eventLabel:"鼠标悬停",description:"鼠标悬停时触发",dataSchema:ze}],De=[...Be,{eventName:"legendselectchanged",eventLabel:"切换图例选中状态",description:"切换图例选中状态时触发",dataSchema:[{type:"object",properties:{data:{type:"object",title:"图表数据",properties:{name:{type:"string",title:"name",description:"切换的图例名称"},selected:{type:"object",title:"selected",description:"所有图例的选中状态表"}}}}}]}],ke=[{actionType:"reload",actionLabel:"重新加载",description:"触发组件数据刷新并重新渲染"},{actionType:"setValue",actionLabel:"变量赋值",description:"变更报表组件数据域,用于触发数据刷新",schema:h({type:"wrapper",className:"config-wrapper-contanier",body:[{type:"combo",name:"value",label:"报表数据域",multiple:!0,removable:!0,required:!0,addable:!0,strictMode:!1,canAccessSuperData:!0,size:"lg",mode:"horizontal",items:[{name:"key",type:"input-text",required:!0,placeholder:"数据字段"},t("formulaControl",{name:"val",variables:"${variables}",required:!0,placeholder:"字段数值"})]}]})},{actionType:"setSchema",actionLabel:"自定义属性变更",description:"直接变更报表属性字段数值,并重新渲染报表",schema:h({type:"wrapper",className:"config-wrapper-contanier",body:[{type:"combo",name:"chartSchema",label:"报表属性",multiple:!0,removable:!0,required:!0,addable:!0,strictMode:!1,canAccessSuperData:!0,size:"lg",mode:"horizontal",items:[{name:"key",type:"input-text",required:!0,placeholder:"报表属性字段"},t("formulaControl",{name:"val",variables:"${variables}",required:!0,placeholder:"新的属性值"})]}]})}];class Ee extends i{$schema="/schemas/ChartSchema.json";isBaseComponent=!0;order=-500;tags=["报表"];events=De;actions=ke;afterUpdate=e=>{const a=e.context;a.info.plugin===this&&(a.schema?.modelFields||a.schema?.relationModelFields)&&a.node.updateSchema({modelFields:void 0,relationModelFields:void 0})}}let Pe=class extends q.Component{chartDSLUpdateDebounce;preProps;constructor(e){super(e),this.chartDSLUpdateDebounce=ee(((e,a)=>{const t=this.preProps||a,{dataSourceType:l}=e?.data||{};if("dataModel"==l||"dataSet"==l)for(const a of R)if(!ae((e?.data||{})[a],(t?.data||{})[a])){this.preProps=e;const{onChange:a,data:t,many:l,manyByDataType:n}=e;let i=l;n&&(i=1===t.dataType),a(`jsonql://${JSON.stringify(W(t,i))}`);break}}),300,{leading:!0,trailing:!1})}componentDidUpdate(e){this.chartDSLUpdateDebounce(this.props,e)}componentWillUnmount(){this.chartDSLUpdateDebounce?.cancel()}render(){const{value:e}=this.props;return q.createElement("div",{style:{display:"none",height:0}},e)}};Pe=j([Z({type:"chart-dsl-container",wrap:!1,detectProps:["data"]})],Pe),o("chart:input-number",(e=>{const{label:a,deleteUnit:t,...l}=e||{},n={type:"input-number",label:a||!1,clearValueOnEmpty:!0,pipeOut:e=>{const a=parseInt(e);if("auto"===e||a||0===a)return a.toString()!==e&&t?a:e},...l};return"vertical"===e?.mode?{type:"group",mode:"vertical",visibleOn:e?.visibleOn,body:[{...n}]}:n})),o("chart:interval",(e=>{const{name:a,label:t,...n}=e||{},i={name:a||"reportInterval",label:t||l("定时刷新间隔","设置后将自动定时刷新,最小1000, 单位 ms")||!1,type:"input-number",step:500,min:1e3,unitOptions:["ms"],visibleOn:e?.visibleOn||'${dataSourceType == "dataModel" || dataSourceType == "api" || dataSourceType == "dataSet"}',...n};return"vertical"===e?.mode?{type:"group",mode:"vertical",visibleOn:e?.visibleOn,body:[{...i}]}:i})),o("chart:dsl-container",(e=>{const{type:a,name:t,...l}=e||{};return{type:"chart-dsl-container",name:t||"dsl",visibleOn:'${dataSourceType == "dataModel" || dataSourceType == "dataSet"}',...l}})),o("chart:colorPicker",((e={})=>({mode:"horizontal",type:"amis-theme-color-picker",label:"颜色",name:"themeCss.className.color:default",needCustom:!0,needTheme:!0,needImage:e.needImage??!1,labelMode:"input",placeholder:"请选择颜色",...e}))),o("chart:context-data-select",(e=>{const{type:a,name:t,contextVariables:l,addable:n,contextData:i,titlePlaceholder:o,titleLabel:r,withFormatter:c,chartType:s,useContextVariables:d,...h}=e||{};return{type:"input-sub-form",visibleOn:'${dataSourceType == "context"}',name:t||"contextData",btnLabel:"${title || data}",minLength:1,multiple:!0,draggable:!0,addable:n??!0,removable:!0,label:"上下文数据",form:{title:"绑定上下文数据",body:[{label:"上下文数据",type:"select",name:"data",selectMode:"table",columns:[{name:"label",label:"上下文变量"},{name:"tag",label:"变量类型"}],required:!0,placeholder:"支持公式表达式: ${xxx + xxx}",source:"${__contextVariables}",valueField:"fxValue",clearable:!0,searchable:!0,creatable:!0,createBtnLabel:"自定义数值",addControls:[{type:"input-text",name:"label",label:"选项标题"},{type:"input-text",name:"value",label:"自定义数值",placeholder:"支持公式表达式: ${xxx + xxx}"}]},{type:"input-text",name:"title",label:r??"变量名称",placeholder:o||"[非必填]可用于备注上下文变量名称"},...c?fe({name:"formatter",chartType:s,useContextVariables:d}):[]]},onChange(e,a,t,l){if(e&&0!==e.length){const a=e[0].data,t=pe(M(a,i),["string","number","date"]);l.setValueByName("__contextFields",t||[])}else l.setValueByName("__contextFields",[])},...h}})),o("chart:column-chart-type-display",(e=>{let a=[{label:"柱状图",value:"default",icon:"fa fa-bar-chart"},{label:"双向对比柱状图",value:"twoWayComparison",icon:"chart-column-up-down"},{label:"堆积柱状图",value:"stacked",icon:"chart-stacked-report"},{label:"水平柱状图",value:"horizontal",icon:"horizontal-columnar-report"}];e?.configOptions&&(a=e.configOptions);const t={type:"icon-button-group",label:e?.label||"图表类型",name:e?.name||"style.chartType",value:e?.value||e?.defaultValue||"default",visibleOn:e?.visibleOn,options:a,pipeIn:e?.pipeIn,pipeOut:e?.pipeOut,onChange:e?.onChange};return"vertical"===e?.mode?{type:"group",mode:"vertical",visibleOn:e?.visibleOn,body:[{...t}]}:t})),o("chart:map-select",(e=>{const a={type:"nested-select",label:e?.label||"省市级地图",name:e?.name||"mapName",value:e?.value||"beijing",visibleOn:e?.visibleOn,source:{url:"/api/geojson/provinceList",method:"get",adaptor:e=>e.concat([{label:"中国地图",mapURL:"/api/geojson/china",value:"china"},{label:"世界地图",mapURL:"/api/geojson/world",value:"world"}])},autoFill:{mapName:"${value}",mapURL:"${mapURL}"},searchable:e?.searchable??!0,pipeIn:e?.pipeIn,pipeOut:e?.pipeOut,onChange:e?.onChange};return"vertical"===e?.mode?{type:"group",mode:"vertical",visibleOn:e?.visibleOn,body:[{...a}]}:a}));const Je=[{label:"实线",value:"solid"},{label:"点状",value:"dotted"},{label:"双线",value:"double"},{label:"虚线",value:"dashed"}],je=[{label:"圆形(实心)",value:"circle"},{label:"矩形",value:"rect"},{label:"圆角矩形",value:"roundRect"},{label:"三角形",value:"triangle"},{label:"菱形",value:"diamond"},{label:"标记",value:"pin"},{label:"箭头",value:"arrow"},{label:"无",value:"none"}],Re={"chart-line":[{label:"顶部",value:"top"},{label:"左侧",value:"left"},{label:"右侧",value:"right"},{label:"底部",value:"bottom"},{label:"与连接点重合",value:"inside"}],"chart-column":[{label:"顶部",value:"top"},{label:"左侧",value:"left"},{label:"右侧",value:"right"},{label:"底部",value:"bottom"},{label:"内部",value:"inside"},{label:"内部左侧",value:"insideLeft"},{label:"内部右侧",value:"insideRight"},{label:"内部顶部",value:"insideTop"},{label:"内部底部",value:"insideBottom"},{label:"内部左上",value:"insideTopLeft"},{label:"内部左下",value:"insideBottomLeft"},{label:"内部右上",value:"insideTopRight"},{label:"内部右下",value:"insideBottomRight"}],"chart-sankey":[{label:"顶部",value:"top"},{label:"左侧",value:"left"},{label:"右侧",value:"right"},{label:"底部",value:"bottom"},{label:"内部",value:"inside"},{label:"内部左侧",value:"insideLeft"},{label:"内部右侧",value:"insideRight"},{label:"内部顶部",value:"insideTop"},{label:"内部底部",value:"insideBottom"},{label:"内部左上",value:"insideTopLeft"},{label:"内部左下",value:"insideBottomLeft"},{label:"内部右上",value:"insideTopRight"},{label:"内部右下",value:"insideBottomRight"}],"chart-waterfall":[{label:"顶部",value:"top"},{label:"左侧",value:"left"},{label:"右侧",value:"right"},{label:"底部",value:"bottom"},{label:"内部",value:"inside"},{label:"内部左侧",value:"insideLeft"},{label:"内部右侧",value:"insideRight"},{label:"内部顶部",value:"insideTop"},{label:"内部底部",value:"insideBottom"},{label:"内部左上",value:"insideTopLeft"},{label:"内部左下",value:"insideBottomLeft"},{label:"内部右上",value:"insideTopRight"},{label:"内部右下",value:"insideBottomRight"}],"chart-pie":[{label:"外部",value:"outside"},{label:"内部",value:"inside"},{label:"中心",value:"center"}],"chart-radar":[{label:"顶部",value:"top"},{label:"左侧",value:"left"},{label:"右侧",value:"right"},{label:"底部",value:"bottom"},{label:"与连接点重合",value:"inside"}],"chart-funnel":[{label:"左侧",value:"left",visibleOn:'${funnelOrient == "vertical"}'},{label:"右侧",value:"right",visibleOn:'${funnelOrient == "vertical"}'},{label:"上方",value:"top",visibleOn:'${funnelOrient == "horizontal"}'},{label:"下方",value:"bottom",visibleOn:'${funnelOrient == "horizontal"}'},{label:"内部",value:"inside"},{label:"内部右侧",value:"insideRight"},{label:"内部左侧",value:"insideLeft"},{label:"右侧上部",value:"rightTop"},{label:"右侧下部",value:"rightBottom"}],"chart-scatter":[{label:"顶部",value:"top"},{label:"左侧",value:"left"},{label:"右侧",value:"right"},{label:"底部",value:"bottom"},{label:"内部",value:"inside"}],"chart-bubble":[{label:"顶部",value:"top"},{label:"左侧",value:"left"},{label:"右侧",value:"right"},{label:"底部",value:"bottom"},{label:"内部",value:"inside"}],"chart-calendar":[{label:"顶部",value:"top"},{label:"左侧",value:"left"},{label:"右侧",value:"right"},{label:"底部",value:"bottom"}]};function We(e,a){const n=a??!0;let i=F("DEFAULT_COLOR")||[];"custom"===e?.colorTheme&&e?.color&&(i=e?.color||[]);let o=!1;"chart-column"!==e?.type&&"chart-line"!==e?.type&&"chart-scatter"!==e?.type&&"chart-bubble"!==e?.type||(o=!0);const r=void 0!==window.store?.app?.theme?.defaultThemeId;return{visibleOn:'${type!=="target-number" && type!=="chart-percent"}',title:"主题设置",collapsed:!0,body:[t("valueFormula",{rendererSchema:{type:"select",mode:"horizontal",selectFirst:!e?.colorTheme,source:{url:`/api/theme/getDataColor/${window.store?.app?.theme?.defaultThemeId}`,adaptor:(e,a)=>(e?.data?.length>-1&&e.data.push({label:"自定义",value:"custom",color:i||[]}),e)},autoFill:{color:"${color}"}},label:"图表配色",name:"colorTheme",value:"default",visible:r}),{type:"select",mode:"horizontal",label:"图表配色",name:"colorTheme",selectFirst:!e?.colorTheme,options:[{label:"默认",value:"default",color:[]},{label:"自定义",value:"custom",color:i||[]}],autoFill:{color:"${color}"},visible:!r},{type:"select",mode:"horizontal",label:l("取色策略","设置图表配色策略,可取值为 series 或 data。series表示按照系列分配颜色,同一系列中的所有数据用相同的颜色。data表示按照数据项分配颜色,每个数据项使用不同的颜色。"),name:"colorBy",selectFirst:!0,options:[{label:"按系列分配",value:"series"},{label:"按数据项分配",value:"data"}],visible:o},{label:"自定义配色",name:"color",type:"combo",visibleOn:'${colorTheme === "custom"}',multiple:!0,addable:!0,draggable:!0,flat:!0,items:[{name:"color",type:"input-color"}]},t("valueFormula",{rendererSchema:{type:"switch"},label:"启动渐变色",name:"gradientStatus",value:!1,visible:n,rendererWrapper:!0,valueType:"boolean"}),n?t("layout:wrapper-contanier",{visibleOn:"${gradientStatus}",body:[t("valueFormula",{rendererSchema:{type:"select",selectFirst:!0,options:[{value:"top2bottom",label:"从上到下渐变"},{value:"bottom2top",label:"从下到上渐变"},{value:"left2right",label:"从左到右渐变"},{value:"right2left",label:"从右到左渐变"}]},label:"渐变模式",name:"gradientMode"}),t("valueFormula",{rendererSchema:{type:"input-range",min:0,max:1,step:.1,value:.5},name:"gradientAlpha",label:"渐变透明度",rendererWrapper:!0})]}):null]}}function He(e){const a="chart-waterfall"===e?.type;return{visibleOn:'${type === "chart-column" || type === "chart-waterfall" || (type === "chart-line" && columnLineMix)}',title:"柱体间距/宽度设置",collapsed:!0,body:[t("chart:input-number",{label:"柱体固定宽度",min:0,name:"columnBarWidth"}),t("chart:input-number",{label:"柱体最大宽度",min:0,name:"columnBarMaxWidth",hiddenOn:"${columnBarWidth}"}),t("chart:input-number",{label:"柱体最小宽度",min:0,name:"columnBarMinWidth",hiddenOn:"${columnBarWidth}"}),!a&&t("chart:input-number",{label:l("柱间距离","不同系列的柱间距离,为百分比(如 '30%',表示柱子宽度的 30%)。"),min:0,name:"columnBarGap",hiddenOn:'${columnChartType === "stacked" || columnChartType === "twoWayComparison"}'}),t("chart:input-number",{label:"柱体最小高度",mode:"horizontal",min:0,name:"columnBarMinHeight"})]}}const Ie={visibleOn:'${type === "chart-column" || type === "chart-waterfall" || (type === "chart-line" && columnLineMix)}',title:"柱条样式设置",collapsed:!0,body:[t("chart:input-number",{label:"柱条描边粗细",name:"columnBorderWidth",min:0,visibleOn:'${type === "chart-column" || type === "chart-waterfall" || (type === "chart-line" && columnLineMix)}'}),t("chart:colorPicker",{label:"柱条描边颜色",name:"columnBorderColor"}),{type:"select",label:"柱条描边样式",mode:"horizontal",name:"columnBorderType",options:Je.filter((e=>"double"!==e.value))},t("theme:radius",{label:"柱条圆角",name:"columnBorderRadius",pipeIn:e=>e&&(Y(e)||I(e))?{"top-left-border-radius":e,"top-right-border-radius":e,"bottom-left-border-radius":e,"bottom-right-border-radius":e}:e}),t("chart:input-number",{label:l("阴影模糊大小","设置柱条阴影模糊大小"),min:0,name:"columnShadowBlur"}),t("chart:colorPicker",{label:"柱条阴影颜色",name:"columnShadowColor"}),t("chart:input-number",{label:l("阴影水平偏移","柱条阴影水平方向偏移距离"),name:"columnShadowOffsetX"}),t("chart:input-number",{label:l("阴影垂直偏移","柱条阴影垂直方向偏移距离"),name:"columnShadowOffsetY"})]};function qe(e,a){return{title:"提示设置(tooltip)",collapsed:!0,body:[t("switch",{label:"显示提示",name:"tooltipShow",value:!0}),{type:"checkboxes",label:"提示内容",mode:"horizontal",name:"tooltipContent",value:"b,c",options:[{label:"名称",value:"b"},{label:"数值",value:"c"},{label:"百分比",value:"d",visibleOn:'${type==="chart-pie" || type==="chart-funnel"}'},{label:"轴线名称",value:"x",visibleOn:'${type==="chart-line" || type==="chart-column"}'}],visibleOn:"${tooltipShow}"},t("theme:font",{title:"提示文本样式",name:"tooltipTextStyle",visibleOn:"${tooltipShow}",...a||{},pipeIn:a=>{const{color:t,fontSize:l}=a||{};return{color:t||e?.tooltipColor,fontSize:l||e?.tooltipFontSize,...a}},onChange:(a,t,l,n)=>{n.deleteValueByName("tooltipColor"),n.deleteValueByName("tooltipFontSize"),e&&(delete e.tooltipColor,delete e.tooltipFontSize)}}),t("chart:colorPicker",{label:"背景色",name:"tooltipBackgroundColor",visibleOn:"${tooltipShow}"}),t("chart:input-number",{label:"边框粗细",min:0,name:"tooltipBorderWidth",visibleOn:"${tooltipShow}"}),t("chart:colorPicker",{label:"边框颜色",name:"tooltipBorderColor",visibleOn:"${tooltipShow}"}),t("chart:input-number",{label:"内边距",name:"tooltipPadding",visibleOn:"${tooltipShow}"})]}}const Ye={title:"中心点及半径设置(center)",collapsed:!0,body:[t("chart:input-number",{name:"centerHorizontal",mode:"horizontal",label:l("横向位置","中心点横向位置,默认水平居中展示。可设置百分比或者数值,比如: 120px、35%。默认 50%。"),unitOptions:["px","%"]}),t("chart:input-number",{label:l("垂直位置","中心点垂直位置,默认垂直居中展示。可设置百分比或者数值,比如: 120px、35%。默认 50%。"),mode:"horizontal",name:"centerVertical",unitOptions:["px","%"]}),t("chart:input-number",{label:l("图区内半径","可以是相对于图表容器高宽中较小的一项的一半的百分比,也可以是绝对的数值。比如: 120px、35%。"),mode:"horizontal",name:"innerRadius",visibleOn:'${type === "chart-pie"}',min:0,unitOptions:["px","%"]}),t("chart:input-number",{label:l("图区半径","可以是相对于图表容器高宽中较小的一项的一半的百分比,也可以是绝对的数值。比如: 120px、35%。默认 70%"),mode:"horizontal",name:"radius",visibleOn:'${type === "chart-pie"}',min:0,unitOptions:["px","%"]})]};function Xe(e){const a="chart-map"!==e?.type&&"chart-scatter-map"!==e?.type;return{title:"图区位置设置(grid)",collapsed:!0,body:[t("chart:input-number",{name:"gridTop",mode:"horizontal",label:l("图区上边距","图表内容离容器上侧的距离,默认 60px"),unitOptions:["px","%"]}),a&&t("chart:input-number",{name:"gridRight",mode:"horizontal",label:l("图区右边距","图表内容离容器右侧的距离,默认 7%"),unitOptions:["px","%"]}),a&&t("chart:input-number",{name:"gridBottom",mode:"horizontal",label:l("图区下边距","图表内容离容器下侧的距离,默认 60px"),unitOptions:["px","%"]}),t("chart:input-number",{name:"gridLeft",mode:"horizontal",label:l("图区左边距","图表内容离容器左侧的距离,默认 7%"),unitOptions:["px","%"]})]}}function Ue(e,a,l){return{title:(e||{}).title??"图表字体设置",collapsed:!0,body:[t("theme:font",{title:"标题文本样式",name:"chartStyle",...l||{},pipeIn:e=>{const{color:t,fontSize:l,fontWeight:n}=e||{};return{color:t||a?.fontColor,fontSize:l||a?.fontSize,fontWeight:n||a?.fontWeight,...e}},onChange:(e,t,l,n)=>{n.deleteValueByName("fontColor"),n.deleteValueByName("fontSize"),n.deleteValueByName("fontWeight"),a&&(delete a.fontColor,delete a.fontSize,delete a.fontWeight)}})]}}function Ge(e,a){const l=e||{};return{title:l.title??"图表样式设置",collapsed:!0,body:[t("theme:font",{title:"标题文本样式",name:l.name??"chartStyle",...a||{}})]}}function Ke(e,a){const n="chart-scatter"===e?.type;return{title:"X轴设置",collapsed:!0,body:[t("switch",{label:"展示X轴",name:"xAxisShow",value:!0}),t("theme:font",{title:"X轴字体样式",name:"xAxisLabelStyle",...a||{},visibleOn:"${xAxisShow}",pipeIn:a=>{const{fontSize:t}=a||{};return{fontSize:t||e?.xAxisFontSize,...a}},onChange:(a,t,l,n)=>{n.deleteValueByName("xAxisFontSize"),e&&delete e.xAxisFontSize}}),t("chart:input-number",{label:l("最小值","设置X轴的最小展示数值,如果没有设置则默认自适应(使用当前图表数据中最小的数值作为起点值)。"),name:"xAxisMin",precision:2,visibleOn:`\${xAxisShow & ${n}}`}),t("chart:input-number",{label:l("最大值","设置X轴的最大展示数值,如果没有设置则默认自适应(使用当前图表数据中最大的数值作为终点值)。"),name:"xAxisMax",precision:2,visibleOn:`\${xAxisShow & ${n}}`}),t("switch",{label:"显示X轴网格线",value:!1,name:"xAxisSplitLineShow"}),t("switch",{label:"显示X轴区域分割",name:"xAxisSplitAreaShow",value:!1}),t("switch",{label:"X轴翻转",name:"xAxisInverse",value:!1}),t("switch",{label:"展示X轴标签",name:"xAxisLabelShow",value:!0,visibleOn:"${xAxisShow}"}),t("layout:wrapper-contanier",{visibleOn:"${xAxisLabelShow && xAxisShow}",body:[t("switch",{label:"标签全部展示",name:"xAxisLabelShowOverlap",value:!1,onChange:(e,a,t,l)=>{!e||void 0!==l?.data?.xAxisLabelRotate&&0!==l?.data?.xAxisLabelRotate&&""!==l?.data?.xAxisLabelRotate||l.setValueByName("xAxisLabelRotate",45)}}),t("chart:input-number",{label:"标签倾斜度",name:"xAxisLabelRotate"})]}),t("switch",{label:"展示X轴轴线",name:"xAxisLineShow",value:!0,visibleOn:"${xAxisShow}"}),t("layout:wrapper-contanier",{visibleOn:"${xAxisLineShow && xAxisShow}",body:[t("chart:colorPicker",{label:"轴线颜色",name:"xAxisLineStyle.color",visibleOn:"${xAxisShow}"}),t("chart:input-number",{label:"轴线粗细",name:"xAxisLineStyle.width",min:0,visibleOn:"${xAxisShow}"})]}),t("switch",{name:"axisTickStyle.show",value:!0,label:"展示刻度线",visibleOn:"${xAxisShow}"}),t("layout:wrapper-contanier",{visibleOn:"${xAxisShow && axisTickStyle.show}",body:[t("chart:input-number",{name:"axisTickStyle.length",min:0,value:5,label:"刻度线长度"}),t("chart:colorPicker",{label:"刻度线颜色",value:"#333",name:"axisTickStyle.color"}),t("chart:input-number",{name:"axisTickStyle.width",min:0,value:1,label:"刻度线粗细"})]}),{label:"X轴名称",mode:"horizontal",type:"input-text",name:"xAxisName",visibleOn:"${xAxisShow}"},t("layout:wrapper-contanier",{visibleOn:"${xAxisName && xAxisShow