UNPKG

amis-reports

Version:

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

1 lines 163 kB
import e from"lodash/pick";import a from"lodash/floor";import d from"lodash/find";import c from"lodash/isObject";import f from"lodash/isArray";import t from"lodash/isString";import n from"lodash/isEqual";import{isExpression as i,FormulaExec as b,isEffectiveApi as o,collectVariables as r,isApiOutdated as l,numberFormatter as s,isPureVariable as u,resolveVariableAndFilter as h,normalizeDate as g}from"amis-core";import p from"lodash/omit";import{extendLocale as m}from"i18n-runtime";function y(e,a,d,c){var f,t=arguments.length,n=t<3?a:null===c?c=Object.getOwnPropertyDescriptor(a,d):c;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,a,d,c);else for(var i=e.length-1;i>=0;i--)(f=e[i])&&(n=(t<3?f(n):t>3?f(a,d,n):f(a,d))||n);return t>3&&n&&Object.defineProperty(a,d,n),n}"function"==typeof SuppressedError&&SuppressedError;const x={"河北":"hebei","山西":"shanxi","内蒙古":"neimenggu","辽宁":"liaoning","吉林":"jilin","黑龙江":"heilongjiang","江苏":"jiangsu","浙江":"zhejiang","安徽":"anhui","福建":"fujian","江西":"jiangxi","山东":"shandong","河南":"henan","湖北":"hubei","湖南":"hunan","广东":"guangdong","广西":"guangxi","海南":"hainan","四川":"sichuan","贵州":"guizhou","云南":"yunnan","西藏":"xizang","陕西":"shanxi1","甘肃":"gansu","青海":"qinghai","宁夏":"ningxia","新疆":"xinjiang","台湾":"taiwan"},w={...x,"澳门":"aomen","北京":"beijing","重庆":"chongqing","上海":"shanghai","天津":"tianjin","香港":"xianggang","石家庄":"hebei_shijiazhuang","唐山":"hebei_tangshan","秦皇岛":"hebei_qinhuangdao","邯郸":"hebei_handan","邢台":"hebei_xingtai","保定":"hebei_baoding","张家口":"hebei_zhangjiakou","承德":"hebei_chengde","沧州":"hebei_cangzhou","廊坊":"hebei_langfang","衡水":"hebei_hengshui","太原":"shanxi_taiyuan","大同":"shanxi_datong","阳泉":"shanxi_yangquan","长治":"shanxi_changzhi","晋城":"shanxi_jincheng","朔州":"shanxi_shuozhou","晋中":"shanxi_jinzhong","运城":"shanxi_yuncheng","忻州":"shanxi_xinzhou","临汾":"shanxi_linfen","吕梁":"shanxi_lvliang","呼和浩特":"neimenggu_huhehaote","包头":"neimenggu_baotou","乌海":"neimenggu_wuhai","赤峰":"neimenggu_chifeng","通辽":"neimenggu_tongliao","鄂尔多斯":"neimenggu_eerduosi","呼伦贝尔":"neimenggu_hulunbeier","巴彦淖尔":"neimenggu_bayannaoer","乌兰察布":"neimenggu_wulanchabu","兴安盟":"neimenggu_xinganmeng","锡林郭勒盟":"neimenggu_xilinguolemeng","阿拉善盟":"neimenggu_alashanmeng","沈阳":"liaoning_shenyang","大连":"liaoning_dalian","鞍山":"liaoning_anshan","抚顺":"liaoning_fushun","本溪":"liaoning_benxi","丹东":"liaoning_dandong","锦州":"liaoning_jinzhou","营口":"liaoning_yingkou","阜新":"liaoning_fuxin","辽阳":"liaoning_liaoyang","盘锦":"liaoning_panjin","铁岭":"liaoning_tieling","朝阳":"liaoning_chaoyang","葫芦岛":"liaoning_huludao","长春":"jilin_changchun","吉林":"jilin_jilin","四平":"jilin_siping","辽源":"jilin_liaoyuan","通化":"jilin_tonghua","白山":"jilin_baishan","松原":"jilin_songyuan","白城":"jilin_baicheng","延边朝鲜族自治州":"jilin_yanbianchaoxianzuzizhizhou","哈尔滨":"heilongjiang_haerbin","齐齐哈尔":"heilongjiang_qiqihaer","鸡西":"heilongjiang_jixi","鹤岗":"heilongjiang_hegang","双鸭山":"heilongjiang_shuangyashan","大庆":"heilongjiang_daqing","伊春":"heilongjiang_yichun","佳木斯":"heilongjiang_jiamusi","七台河":"heilongjiang_qitaihe","牡丹江":"heilongjiang_mudanjiang","黑河":"heilongjiang_heihe","绥化":"heilongjiang_suihua","大兴安岭地区":"heilongjiang_daxinganlingdiqu","南京":"jiangsu_nanjing","无锡":"jiangsu_wuxi","徐州":"jiangsu_xuzhou","常州":"jiangsu_changzhou","苏州":"jiangsu_suzhou","南通":"jiangsu_nantong","连云港":"jiangsu_lianyungang","淮安":"jiangsu_huaian","盐城":"jiangsu_yancheng","扬州":"jiangsu_yangzhou","镇江":"jiangsu_zhenjiang","泰州":"jiangsu_taizhou","宿迁":"jiangsu_suqian","杭州":"zhejiang_hangzhou","宁波":"zhejiang_ningbo","温州":"zhejiang_wenzhou","嘉兴":"zhejiang_jiaxing","湖州":"zhejiang_huzhou","绍兴":"zhejiang_shaoxing","金华":"zhejiang_jinhua","衢州":"zhejiang_quzhou","舟山":"zhejiang_zhoushan","台州":"zhejiang_taizhou","丽水":"zhejiang_lishui","合肥":"anhui_hefei","芜湖":"anhui_wuhu","蚌埠":"anhui_bengbu","淮南":"anhui_huainan","马鞍山":"anhui_maanshan","淮北":"anhui_huaibei","铜陵":"anhui_tongling","安庆":"anhui_anqing","黄山":"anhui_huangshan","滁州":"anhui_chuzhou","阜阳":"anhui_fuyang","宿州":"anhui_suzhou","六安":"anhui_liuan","亳州":"anhui_bozhou","池州":"anhui_chizhou","宣城":"anhui_xuancheng","福州":"fujian_fuzhou","厦门":"fujian_xiamen","莆田":"fujian_putian","三明":"fujian_sanming","泉州":"fujian_quanzhou","漳州":"fujian_zhangzhou","南平":"fujian_nanping","龙岩":"fujian_longyan","宁德":"fujian_ningde","南昌":"jiangxi_nanchang","景德镇":"jiangxi_jingdezhen","萍乡":"jiangxi_pingxiang","九江":"jiangxi_jiujiang","新余":"jiangxi_xinyu","鹰潭":"jiangxi_yingtan","赣州":"jiangxi_ganzhou","吉安":"jiangxi_jian","宜春":"jiangxi_yichun","抚州":"jiangxi_fuzhou","上饶":"jiangxi_shangrao","济南":"shandong_jinan","青岛":"shandong_qingdao","淄博":"shandong_zibo","枣庄":"shandong_zaozhuang","东营":"shandong_dongying","烟台":"shandong_yantai","潍坊":"shandong_weifang","济宁":"shandong_jining","泰安":"shandong_taian","威海":"shandong_weihai","日照":"shandong_rizhao","临沂":"shandong_linyi","德州":"shandong_dezhou","聊城":"shandong_liaocheng","滨州":"shandong_binzhou","菏泽":"shandong_heze","郑州":"henan_zhengzhou","开封":"henan_kaifeng","洛阳":"henan_luoyang","平顶山":"henan_pingdingshan","安阳":"henan_anyang","鹤壁":"henan_hebi","新乡":"henan_xinxiang","焦作":"henan_jiaozuo","濮阳":"henan_puyang","许昌":"henan_xuchang","漯河":"henan_luohe","三门峡":"henan_sanmenxia","南阳":"henan_nanyang","商丘":"henan_shangqiu","信阳":"henan_xinyang","周口":"henan_zhoukou","驻马店":"henan_zhumadian","济源":"henan_jiyuan","武汉":"hubei_wuhan","黄石":"hubei_huangshi","十堰":"hubei_shiyan","宜昌":"hubei_yichang","襄阳":"hubei_xiangyang","鄂州":"hubei_ezhou","荆门":"hubei_jingmen","孝感":"hubei_xiaogan","荆州":"hubei_jingzhou","黄冈":"hubei_huanggang","咸宁":"hubei_xianning","随州":"hubei_suizhou","恩施土家族苗族自治州":"hubei_enshitujiazumiaozuzizhizhou","仙桃":"hubei_xiantao","潜江":"hubei_qianjiang","天门":"hubei_tianmen","神农架林区":"hubei_shennongjialinqu","长沙":"hunan_changsha","株洲":"hunan_zhuzhou","湘潭":"hunan_xiangtan","衡阳":"hunan_hengyang","邵阳":"hunan_shaoyang","岳阳":"hunan_yueyang","常德":"hunan_changde","张家界":"hunan_zhangjiajie","益阳":"hunan_yiyang","郴州":"hunan_chenzhou","永州":"hunan_yongzhou","怀化":"hunan_huaihua","娄底":"hunan_loudi","湘西土家族苗族自治州":"hunan_xiangxitujiazumiaozuzizhizhou","广州":"guangdong_guangzhou","韶关":"guangdong_shaoguan","深圳":"guangdong_shenzhen","珠海":"guangdong_zhuhai","汕头":"guangdong_shantou","佛山":"guangdong_foshan","江门":"guangdong_jiangmen","湛江":"guangdong_zhanjiang","茂名":"guangdong_maoming","肇庆":"guangdong_zhaoqing","惠州":"guangdong_huizhou","梅州":"guangdong_meizhou","汕尾":"guangdong_shanwei","河源":"guangdong_heyuan","阳江":"guangdong_yangjiang","清远":"guangdong_qingyuan","东莞":"guangdong_dongguan","中山":"guangdong_zhongshan","潮州":"guangdong_chaozhou","揭阳":"guangdong_jieyang","云浮":"guangdong_yunfu","南宁":"guangxi_nanning","柳州":"guangxi_liuzhou","桂林":"guangxi_guilin","梧州":"guangxi_wuzhou","北海":"guangxi_beihai","防城港":"guangxi_fangchenggang","钦州":"guangxi_qinzhou","贵港":"guangxi_guigang","玉林":"guangxi_yulin","百色":"guangxi_baise","贺州":"guangxi_hezhou","河池":"guangxi_hechi","来宾":"guangxi_laibin","崇左":"guangxi_chongzuo","海口":"hainan_haikou","三亚":"hainan_sanya","三沙":"hainan_sansha","儋州":"hainan_danzhou","五指山":"hainan_wuzhishan","琼海":"hainan_qionghai","文昌":"hainan_wenchang","万宁":"hainan_wanning","东方":"hainan_dongfang","定安县":"hainan_dinganxian","屯昌县":"hainan_tunchangxian","澄迈县":"hainan_chengmaixian","临高县":"hainan_lingaoxian","白沙黎族自治县":"hainan_baishalizuzizhixian","昌江黎族自治县":"hainan_changjianglizuzizhixian","乐东黎族自治县":"hainan_ledonglizuzizhixian","陵水黎族自治县":"hainan_lingshuilizuzizhixian","保亭黎族苗族自治县":"hainan_baotinglizumiaozuzizhixian","琼中黎族苗族自治县":"hainan_qiongzhonglizumiaozuzizhixian","重庆":"chongqing","成都":"sichuan_chengdu","自贡":"sichuan_zigong","攀枝花":"sichuan_panzhihua","泸州":"sichuan_luzhou","德阳":"sichuan_deyang","绵阳":"sichuan_mianyang","广元":"sichuan_guangyuan","遂宁":"sichuan_suining","内江":"sichuan_neijiang","乐山":"sichuan_leshan","南充":"sichuan_nanchong","眉山":"sichuan_meishan","宜宾":"sichuan_yibin","广安":"sichuan_guangan","达州":"sichuan_dazhou","雅安":"sichuan_yaan","巴中":"sichuan_bazhong","资阳":"sichuan_ziyang","阿坝藏族羌族自治州":"sichuan_abazangzuqiangzuzizhizhou","甘孜藏族自治州":"sichuan_ganzizangzuzizhizhou","凉山彝族自治州":"sichuan_liangshanyizuzizhizhou","贵阳":"guizhou_guiyang","六盘水":"guizhou_liupanshui","遵义":"guizhou_zunyi","安顺":"guizhou_anshun","毕节":"guizhou_bijie","铜仁":"guizhou_tongren","黔西南布依族苗族自治州":"guizhou_qianxinanbuyizumiaozuzizhizhou","黔东南苗族侗族自治州":"guizhou_qiandongnanmiaozudongzuzizhizhou","黔南布依族苗族自治州":"guizhou_qiannanbuyizumiaozuzizhizhou","昆明":"yunnan_kunming","曲靖":"yunnan_qujing","玉溪":"yunnan_yuxi","保山":"yunnan_baoshan","昭通":"yunnan_zhaotong","丽江":"yunnan_lijiang","普洱":"yunnan_puer","临沧":"yunnan_lincang","楚雄彝族自治州":"yunnan_chuxiongyizuzizhizhou","红河哈尼族彝族自治州":"yunnan_honghehanizuyizuzizhizhou","文山壮族苗族自治州":"yunnan_wenshanzhuangzumiaozuzizhizhou","西双版纳傣族自治州":"yunnan_xishuangbannadaizuzizhizhou","大理白族自治州":"yunnan_dalibaizuzizhizhou","德宏傣族景颇族自治州":"yunnan_dehongdaizujingpozuzizhizhou","怒江傈僳族自治州":"yunnan_nujianglisuzuzizhizhou","迪庆藏族自治州":"yunnan_diqingcangzuzizhizhou","拉萨":"xizang_lasa","日喀则":"xizang_rikaze","昌都":"xizang_changdu","林芝":"xizang_linzhi","山南":"xizang_shannan","那曲":"xizang_naqudiqu","那曲地区":"xizang_naqudiqu","阿里地区":"xizang_alidiqu","西安":"shanxi1_xian","铜川":"shanxi1_tongchuan","宝鸡":"shanxi1_baoji","咸阳":"shanxi1_xianyang","渭南":"shanxi1_weinan","延安":"shanxi1_yanan","汉中":"shanxi1_hanzhong","榆林":"shanxi1_yulin","安康":"shanxi1_ankang","商洛":"shanxi1_shangluo","兰州":"gansu_lanzhou","嘉峪关":"gansu_jiayuguan","金昌":"gansu_jinchang","白银":"gansu_baiyin","天水":"gansu_tianshui","武威":"gansu_wuwei","张掖":"gansu_zhangye","平凉":"gansu_pingliang","酒泉":"gansu_jiuquan","庆阳":"gansu_qingyang","定西":"gansu_dingxi","陇南":"gansu_longnan","临夏回族自治州":"gansu_linxiahuizuzizhizhou","甘南藏族自治州":"gansu_gannanzangzuzizhizhou","西宁":"qinghai_xining","海东":"qinghai_haidong","海北藏族自治州":"qinghai_haibeizangzuzizhizhou","黄南藏族自治州":"qinghai_huangnanzangzuzizhizhou","海南藏族自治州":"qinghai_hainanzangzuzizhizhou","果洛藏族自治州":"qinghai_guoluozangzuzizhizhou","玉树藏族自治州":"qinghai_yushuzangzuzizhizhou","海西蒙古族藏族自治州":"qinghai_haiximengguzuzangzuzizhizhou","银川":"ningxia_yinchuan","石嘴山":"ningxia_shizuishan","吴忠":"ningxia_wuzhong","固原":"ningxia_guyuan","中卫":"ningxia_zhongwei","乌鲁木齐":"xinjiang_wulumuqi","克拉玛依":"xinjiang_kelamayi","吐鲁番":"xinjiang_tulufan","哈密":"xinjiang_hami","昌吉回族自治州":"xinjiang_changjihuizuzizhizhou","博尔塔拉蒙古自治州":"xinjiang_boertalamengguzizhizhou","巴音郭楞蒙古自治州":"xinjiang_bayinguolengmengguzizhizhou","阿克苏地区":"xinjiang_akesudiqu","克孜勒苏柯尔克孜自治州":"xinjiang_kezilesukeerkezizizhizhou","喀什地区":"xinjiang_kashidiqu","和田地区":"xinjiang_hetiandiqu","伊犁哈萨克自治州":"xinjiang_yilihasakezizhizhou","塔城地区":"xinjiang_tachengdiqu","阿勒泰地区":"xinjiang_aletaidiqu","石河子":"xinjiang_shihezi","阿拉尔":"xinjiang_alaer","图木舒克":"xinjiang_tumushuke","五家渠":"xinjiang_wujiaqu","北屯":"xinjiang_beitun","铁门关":"xinjiang_tiemenguan","双河":"xinjiang_shuanghe","可克达拉":"xinjiang_kekedala","昆玉":"xinjiang_kunyu","胡杨河":"xinjiang_huyanghe"},_=["hebei","shanxi","neimenggu","liaoning","jilin","heilongjiang","jiangsu","zhejiang","anhui","fujian","jiangxi","shandong","henan","hubei","hunan","guangdong","guangxi","hainan","sichuan","guizhou","yunnan","xizang","shanxi1","gansu","qinghai","ningxia","xinjiang","taiwan"];function S(e){return x[e]||_.indexOf(e)>-1}function z(e){let a=e;return a=S(e)?x[e]:w[e],!a&&e&&(e.endsWith("市")||e.endsWith("县")||e.endsWith("区"))&&(a=w[e.substring(0,e.length-1)]),a}function v(e){const a={};return e?(e.forEach((e=>{a[e.key]=e.val})),a):{}}function C(e){let a=!1;return null==e&&(a=!0),a}function T(e){let a=!1;return"is_empty"!==e&&"is_not_empty"!==e&&"IS NULL"!==e&&"IS NOT NULL"!==e||(a=!0),a}function k(e){return/^http[s]?:\/\/.*/.test(e)||/^api:\/\/.*/.test(e)}const A={},L=[{label:"计数",value:"COUNT"},{label:"去重计数",value:"COUNT_DISTINCT"}],D=[{label:"求和",value:"SUM"},{label:"均值",value:"AVG"},{label:"最大值",value:"MAX"},{label:"最小值",value:"MIN"}],j={text:"text",textarea:"text",int:"number",float:"number",date:"date",datetime:"datetime","date-range":"",enum:"select",boolean:"boolean",password:"text",ciphertext:"text",attachement:"",image:"file",address:"text",location:"text","serial-number":"text",user:"user",department:"dep",owner:"user","owner-department":"dep",mpath:"",json:"",money:"number",parent:""};function M(e){const a={},d=window.store?.page?.id||"";e.forEach((e=>{e.children.forEach((e=>{a[e.value]=e.form||e}))})),A[d]=a}function $(e){let a=[];const d=window.store?.page?.id||"";return e&&d&&A[d]&&(a=A[d][e]?.fields||[]),a}function F(e){let a=[];const d=window.store?.page?.id||"";return e&&d&&A[d]&&(a=A[d][e]?.relationFields||[]),a}function R(e){let[a,d,c]=e;return!c||a||d||(a=$(c),d=F(c)),a.concat((d||[]).filter((e=>"n"!==e.relationMode?.split(":")[1]&&!e.joinColumnAtTarget&&"relation"!==e.type))).filter((e=>!e.isForeignKey&&"deletedAt"!==e.name&&"deletedAt"!==e.key))}function B(e,a){let{model:c,__modelFields:f,__relationModelFields:t,dimensions:n,measures:i,measures2:b,doubleYAxis:o,whereConditionRaw:r,havingConditionRaw:l,limit:s,dataSet:u,dataSourceType:h,groupField:g,bubbleField:p}=e,m=f||[],y=t||[];if(!c&&!u)return;m||y||(m=$(c||u),y=F(c||u));const x=p||[],w=X?.groups,_=X?.dataBuckets,S=X?.expressions;n=n||[],i=o?(i||[]).concat(b||[]):i||[];const z=[],v=[];let C={};const T={statement:"SELECT",many:a},k={},A=n.concat(i).concat(x).map(((e,a)=>{const c=d(m,(a=>a.name===e.field||a.key===e.field));if("modelField"===e.fieldType){const a=d(y,(a=>a.name===e.field));if(!c&&!a)return{};C={as:e.as},c&&"dataModel"===h?C.column=c.name:a&&"dataModel"===h?(C.column=a.key,C.table=a.targetKey):c&&"dataSet"===h&&(C.column=c.key,C.table=c.table),e.statisticsFunction&&(C.func=e.statisticsFunction),e.statisticsFunction&&(f=e.statisticsFunction,!dd.some((e=>e.value===f)))||!C.column||k[C.column]||(k[C.column]=C.column,v.push({name:C.column}))}else if("expression"===e.fieldType){if(!S)return{};const a=d(S,(a=>a.id===e.field));if(!a)return{};const{expressionStr:c}=a;C={exp:`${c}`,as:e.as}}else if("group"===e.fieldType){if(!w)return{};const a=d(w,(a=>a.id===e.field));if(!a)return{};const{dimensionGroups:c}=a;C={case:[],else:a.else||"其他",as:e.as};let f={column:a.dimensionField};"dataSet"===h&&(f={column:a.dimensionField,table:a.model||a.table});const t=y?.find((e=>e.name===a.dimensionField));t&&(f={column:t.key,table:t.targetKey}),C.case=c?.map((e=>({when:{operator:"and",children:[{left:f,op:"in",right:e.groupValues.split(",")}]},then:e.groupName}))),C.as&&!k[C.as]&&(k[C.as]=C.as,v.push({name:C.as}))}else if("dataBucket"===e.fieldType){if(!_)return{};const a=d(_,(a=>a.id===e.field));if(!a)return{};const{buckets:c}=a;C={case:[],as:e.as,else:a.else||"其他"},C.case=c.map((e=>({when:P(e.filterCondition,y),then:e.bucketName}))),C.as&&!k[C.as]&&(k[C.as]=C.as,v.push({name:C.as}))}var f;return e.orderBy&&z.push({name:C.as,sort:e.orderBy}),C})).filter((e=>e&&e.as)),L=i[0]||{},D=L.totalField;if("totalToPercent"===L.formatter&&D){const e=d(m,(e=>e.name===D||e.key===D)),a=d(y,(e=>e.name===D));if(e||a){const d={as:L.totalFieldAs};L.totalFieldFunc&&(d.func=L.totalFieldFunc),e&&"dataModel"===h?d.column=e.name:a&&"dataModel"===h?(d.column=a.key,d.table=a.targetKey):e&&"dataSet"===h&&(d.column=e.key,d.table=e.table),A.push(d)}}if(g){const e=d(m,(e=>e.name===g||e.key===g));e&&"dataModel"===h?(A.push({column:g}),v.push({name:g})):e&&"dataSet"===h&&(A.push({column:e.key,as:g,table:e.table}),v.push({name:g}))}T.select=A;let j=[];if("dataModel"===h&&c){const[e,a]=c.split(":");T.from=`${e}.${a}`,j=Y(m,y,a)}else"dataSet"===h&&(T.fromDataSet=u);return j?.length&&(T.join=j),v.length&&(T.groupBy=v),z.length&&(T.orderBy=z),r?.children?.length&&(T.where=P(r,y)),l?.children?.length&&(T.having=function(e,a){return{operator:e.conjunction,children:e.children.map((e=>{if(e.children?.length)return P(e,a);const d={left:{name:e.left?.field},op:W[e.op]||e.op};return e.right&&(d.right="between"===e.op?[e.right[0]&&E(e.right[0],e.op),e.right[1]&&E(e.right[1],e.op)]:E(e.right,e.op)),d}))}}(l,A)),s&&(T.limit=s),T}function N(e,a){let d=e;if(e&&t(e))try{const c=JSON.parse(e);c.where=O(c.where,a),c.having=O(c.having,a),d=JSON.stringify(c)}catch(a){return console.warn(`当前JSONQL字符串解析错误:${e}`),d}return d}function O(e,a){return e&&f(e.children)&&(e.children=e.children.filter((e=>{if(e.children){const d=O({children:e.children},a);e.children=d?.children}else if(i(e.right)){C(b.formula(e.right,a))&&!T(e.op)&&(e.deleted=!0)}else C(e.right)&&!T(e.op)&&(e.deleted=!0);return!e.deleted}))),e}function I(e,a){return e&&f(e.children)&&(e.children=e.children.filter((e=>{if(e.children){const d=O({children:e.children},a);e.children=d?.children}else i(e.right)?(e.right=b.formula(e.right,a),C(e.right)&&!T(e.op)&&(e.deleted=!0)):C(e.right)&&!T(e.op)&&(e.deleted=!0);return!e.deleted}))),e}const q=["model","dataSet","dataSourceType","dimensions","measures","measures2","doubleYAxis","whereConditionRaw","havingConditionRaw","limit","bubbleField","groupField"];function P(e,a,d){const c={operator:e.conjunction,children:[]};return e.children&&e.children.length>0&&e.children.forEach((e=>{if(e.children?.length){const d=P(e,a);return void c.children.push(d)}const d={left:{column:e.left?.field},op:W[e.op]||e.op};e.right&&(d.right="between"===e.op?[e.right[0]&&E(e.right[0],e.op),e.right[1]&&E(e.right[1],e.op)]:E(e.right,e.op));const f=a?.find((a=>a.name===e.left?.field));if(f&&(d.left={column:f.key,table:f.targetKey}),0===e.left?.field.indexOf("dataset.")){const[a,c,f]=e.left?.field.split(".");d.left={column:f,table:c}}c.children.push(d)})),c}function Y(e,a,d){const c=[],f=[];if(a?.length){a.filter((e=>e.parentKey===d&&"1:n"!==e.relationMode&&"n:n"!==e.relationMode&&!e.joinColumnAtTarget&&"relation"!==e.type&&e.isPrimaryKey)).forEach((e=>{const a=e.targetKey;-1===c.indexOf(a)&&(c.push(a),f.push({table:a,joinType:"LEFT JOIN",on:{operator:"and",children:[{left:{column:e.parentForeignKey||`${a}Id`},op:"=",right:{column:e.key,table:a}}]}}))}))}return f}const W={is_not_empty:"IS NOT NULL",is_empty:"IS NULL",equal:"=",not_equal:"<>",less:"<",less_or_equal:"<=",greater:">",greater_or_equal:">=",not_between:"NOT BETWEEN",between:"BETWEEN",like:"LIKE",not_like:"NOT LIKE",starts_with:"LIKE",ends_with:"LIKE",select_equals:"=",select_not_equals:"<>",select_any_in:"IN",select_not_any_in:"NOT IN",user_equal:"",user_not_equal:"",user_belong_deps:"",user_not_belong_deps:"",user_belong_roles:"",user_not_belong_roles:"",dep_equal:"",dep_not_equa:"",dep_belong:"",dep_not_belong:""};function E(e,a){return e?("like"!==a&&"not_like"!==a||(e=`%${e}%`),"starts_with"===a&&(e=`${e}%`),"ends_with"===a&&(e=`%${e}`),e):""}const X={expressions:[],groups:[],dataBuckets:[]};function U(e,a){X[e]=a}const H={color:{brand:"--colors-brand-5",text:"--colors-neutral-text-2",subText:"--colors-neutral-text-4",descText:"--colors-neutral-text-5",fill:"--colors-neutral-fill-10",line:"--colors-neutral-line-6",dividerLine:"--colors-neutral-line-8",background:"--colors-neutral-text-11"},border:{color:"--colors-neutral-line-4"},shadows:{value:"--shadows-shadow-normal"}},G={color:{brand:"#2468f2",text:"#151B26",subText:"#5C5F66",descText:"#84878C",fill:"#F7F8FA",line:"#E8E9EB",dividerLine:"#E8E9EB",background:"#FFFFFF"},border:{color:"#E8E9EB"},shadows:{value:"0px 1px 2px 0px rgba(0, 0, 0, 0.05)"},report:{negativeDataColor:"#389e0d",positiveDataColor:"#f5222d"}},V=["color","width","fontStyle","fontWeight","fontFamily","font-family","fontSize","lineHeight","shadowColor","top-left-border-radius","top-right-border-radius","bottom-left-border-radius","bottom-right-border-radius","InRangeMinColor","InRangeMaxColor","borderColor"],K=["lineShadowColor","dataTitleColor","dataDetailColor","progressColor","axisLineColor","splitLineColor","axisTickColor","axisLabelColor","pointerColor","columnBorderColor","columnShadowColor","tooltipColor","tooltipBackgroundColor","tooltipBorderColor","fontColor","markPointBackground","markLineAvarageColor","markLineBaseColor","labelColor","legendColor","visualMapInRangeMin","visualMapInRangeMax","mapBorderColor","mapAreaColor","titleColor","titleBackgroundColor","backgroundColor","borderColor","shadowColor","negativeLabelColor","positiveDataColor","negativeDataColor"],J=["titleTextStyle","legendTextStyle","labelTextStyle","tooltipTextStyle","subTitleStyle","yAxisLabelStyle","yAxis2LabelStyle","xAxisLabelStyle","xAxisLineStyle","dataTitleStyle","dataDetailStyle","axisLabelStyle","axisTickStyle","xAxisNameStyle","chartItemStyle","columnBorderRadius","axisLineStyle","splitLineStyle","chartStyle","bubbleStyle","visualMap"],Q=["yAxisNameConfig","calendar"],Z=["nameTextStyle","itemStyle","splitLine"];function ee(e,a){const d=a||document.documentElement,c=e?.replace("var","").replace("(","").replace(")","");try{return getComputedStyle(d).getPropertyValue(c)}catch(e){return""}}function ae(e){return!(!e||!t(e))&&/^var\(.+\)$/.test(e)}function de(e,a){const d={};for(const c of K)ae(e[c])&&(d[c]=ee(e[c],a));for(const c of J)if(e[c]){d[c]||(d[c]={...e[c]||{}});for(const f of V)e[c][f]&&(ae(e[c][f])?d[c][f]=ee(e[c][f],a):d[c][f]=e[c][f])}for(const c of Q)if(e[c]){d[c]||(d[c]=p(e[c],Z));for(const f of Z)if(e[c][f]){d[c][f]||(d[c][f]={...e[c][f]||{}});for(const t of V)e[c][f][t]&&(ae(e[c][f][t])?d[c][f][t]=ee(e[c][f][t],a):d[c][f][t]=e[c][f][t])}}return{...e,...d}}function ce(e,a){if(!e||!a)return"";const d=e.split(".")||[],c=H[d[0]][d[1]],f=G[d[0]][d[1]];return ee(c,a)||f}function fe(e){if(!e)return"";const a=e.split(".")||[],d=H[a[0]][a[1]],c=G[a[0]][a[1]];return d||c}function te(e){let a={};if("saas"===e.reportMode){const d=e.webServerRootPath||"",c=window.store||{},f=c.app||{},t=e.companyKey||c.company?.key,n=e.appKey||`${f.key}${"latest"!==f.env?`-${f.env}`:""}`,i=e.pageKey||c.page?.id;t&&n&&(a={sourceOptionsAll:`${d}/api/company/${t}/app/${n}/source/optionsAll?withRelationFields=true&withSystemFields=true`,datasetOptionsAll:`${d}/api/company/${t}/app/${n}/dataset/selectOptions`},i&&(a=Object.assign(a,{jsonqlApi:`${d}/api/company/${t}/app/${n}/page/${i}/jsonql`,expressions:`${d}/api/company/${t}/app/${n}/page/${i}/reportFields/expressions?model=\${model}&dataSet=\${dataSet}`,groups:`${d}/api/company/${t}/app/${n}/page/${i}/reportFields/groups?model=\${model}&dataSet=\${dataSet}`,dataBuckets:`${d}/api/company/${t}/app/${n}/page/${i}/reportFields/dataBuckets?model=\${model}&dataSet=\${dataSet}`})))}window.DefaultReportConfig=Object.assign(window.DefaultReportConfig,a,e||{})}function ne(e){return e?window.DefaultReportConfig[e]:window.DefaultReportConfig}function ie(e){if("jssdk"===window.DefaultReportConfig.reportMode&&e){const a=function(e){return e.split(":")[0]}(e);return window.DefaultReportConfig.jsonqlApi?.replaceAll("${dsKey}",a)}const a=window.store||{};if("saas"===window.DefaultReportConfig.reportMode&&a.page){const e=window.DefaultReportConfig.webServerRootPath||"",d=a.company?.key||"xxCompany",c=a.app||{};return`${e}/api/company/${d}/app/${`${c.key}${"latest"!==c.env?`-${c.env}`:""}`||"xxApp"}/page/${a.page?.id||"xxPage"}/jsonql`}return window.DefaultReportConfig.jsonqlApi}function be(e){return e?`/api/jsonql/${e}/query`:window.DefaultReportConfig.jsonqlQuery}function oe(){const e=window.store||{};if("saas"===window.DefaultReportConfig.reportMode&&e.app){const a=window.DefaultReportConfig.webServerRootPath||"",d=e.company?.key||"xxCompany",c=e.app||{};return`${a}/api/company/${d}/app/${`${c.key}${"latest"!==c.env?`-${c.env}`:""}`||"xxApp"}/source/optionsAll?withRelationFields=true&withSystemFields=true`}return window.DefaultReportConfig.sourceOptionsAll}function re(){const e=window.store||{};if("saas"===window.DefaultReportConfig.reportMode&&e.app){const a=window.DefaultReportConfig.webServerRootPath||"",d=e.company?.key||"xxCompany",c=e.app||{};return`${a}/api/company/${d}/app/${`${c.key}${"latest"!==c.env?`-${c.env}`:""}`||"xxApp"}/dataset/selectOptions`}return window.DefaultReportConfig.datasetOptionsAll}function le(e){let a=window.DefaultReportConfig[e];const d=window.store||{};if("saas"===window.DefaultReportConfig.reportMode&&d.page){const c=window.DefaultReportConfig.webServerRootPath||"",f=d.company?.key||"xxCompany",t=d.app||{};a=`${c}/api/company/${f}/app/${`${t.key}${"latest"!==t.env?`-${t.env}`:""}`||"xxApp"}/page/${d.page?.id||"xxPage"}/reportFields/${e}?model=\${model}&dataSet=\${dataSet}`}return a}function se(e){let a=le(e);return a+="&dataId=${id}",a}window.DefaultReportConfig={reportMode:"static",useDataModelSource:!1,useDataSetSource:!1,useReportDesignConfig:!0,sourceOptionsAll:"/design/source/optionsAll?withRelationFields=true&withSystemFields=true",jsonqlApi:"/resource/source/${dsKey}/jsonql",jsonqlQuery:"/api/jsonql/${dslKey}/query",datasetOptionsAll:"/api/company/xxCompany/app/xxApp/dataset/selectOptions",expressions:"/resource/reportFields/expressions?model=${model}&dataSet=${dataSet}",groups:"/resource/reportFields/groups?model=${model}&dataSet=${dataSet}",dataBuckets:"/resource/reportFields/dataBuckets?model=${model}&dataSet=${dataSet}",DEFAULT_COLOR:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"]};const ue=["gradientStatus","gradientMode","gradientAlpha"],he=["tooltipShow","tooltipContent","tooltipFontSize","tooltipColor","tooltipBackgroundColor","tooltipBorderWidth","tooltipBorderColor","tooltipPadding"],ge=["centerHorizontal","centerVertical","innerRadius","radius"],pe=["pieChartType","pieChartRoseType"],me=["gridTop","gridLeft","gridRight","gridBottom"],ye=["xAxisShow","xAxisInverse","xAxisLineShow","xAxisLineShow","xAxisLabelShowOverlap","xAxisLabelRotate","xAxisFontSize","xAxisName","xAxisNameRotate","columnChartType","xyFlip","xAxisNameGap","xAxisNameLocation","xAxisMin","xAxisMax","xAxisSplitLineShow","xAxisSplitAreaShow"],xe=["columnChartType","xyFlip","yAxisShow","yAxisMinAsDataMinAndMaxAsDataMax","yAxisSplitLineShow","yAxisSplitAreaShow","doubleYAxis","doubleYAxisAlign","yAxisLabelFontSize","yAxisMin","yAxisMax","yAxisLabelRotate","yAxisPreUnit","yAxisAfterUnit","yAxisName","yAxisFormatter","formatterToFixed","formatterClearZero","yAxisLabelStyle","yAxisNameConfig"],we=["doubleYAxis","doubleYAxisAlign","yAxisLabelFontSize2","yAxisMin2","yAxisMax2","yAxisLabelRotate2","yAxisPreUnit2","yAxisAfterUnit2","yAxisName2","yAxisFormatter2","yAxis2LabelStyle","yAxis2NameConfig"],_e=["markPointMax","markPointMin","markPointBackground","markPointSymbol","markPointSymbolSize","markPointSymboloffsetX","markPointSymboloffsetY","markPointSymbolRotate"],Se=["markLineAvarage","markLineAvarageColor","markLineSymbolLeft","markLineSymbolRight","markLineBase","markLineBaseValue","markLineBaseColor"],ze=["labelShow","labelFontSize","labelColor","labelLineHeight","labelOverflow","labelPosition","labelFontWeight","labelContent","negativeLabelPosition"],ve=["symbolSize","symbol"],Ce=["fontSize","fontColor","fontWeight","alignClass"],Te=["dataTitleShow","dataTitleOffsetX","dataTitleOffsetY","dataTitleColor","dataTitleFontSize","dataTitleFontWeight"],ke=["dataDetailShow","dataDetailOffsetX","dataDetailOffsetY","dataDetailColor","dataDetailFontSize","dataDetailFontWeight"],Ae=["progressShow","progressWidth","progressColor"],Le=["progressWidth","axisLineShow","axisLineColor"],De=["splitLineShow","splitLineLength","splitLineDistance","splitLineColor","splitLineWidth"],je=["axisTickShow","axisTickSplitNumber","axisTickLength","axisTickDistance","axisTickColor","axisTickWidth"],Me=["axisLabelShow","axisLabelDistance","axisLabelRotate","axisLabelColor","axisLabelFontSize","axisLabelFontWeight"],$e=["pointerShow","pointerColor"],Fe=["legendShow","legendType","legendColor","legendFontSize","legendAlign","legendOrient","legendPosition","legendWidth","legendHeight","legendTop","legendRight","legendBottom","legendLeft","legendDataShow","legendDataFormat"],Re=["backgroundColor","borderRadius","borderWidth","borderStyle","borderColor","shadowWidth","shadowOffset","shadowColor"],Be=["titleShow","titleText","titleAlignment","titleBackgroundColor","titleLink"],Ne=["animationDurationUpdate","animationThreshold","animationDuration"],Oe=["funnelOrient"],Ie=["columnBarWidth","columnBarMaxWidth","columnBarMinWidth","columnBarGap","columnBarMinHeight","positiveDataColor","negativeDataColor"],qe=["columnBorderWidth","columnBorderColor","columnBorderType","columnShadowBlur","columnShadowColor","columnShadowOffsetX","columnShadowOffsetY"],Pe=["lineWidth","lineCap","lineSymbol","lineJoin","lineShadowBlur","lineShadowColor","lineShadowOffsetX","lineShadowOffsetY","lineOpacity"],Ye=["stackedLineChart","columnLineMix","doubleYAxis","doubleYAxisAlign"],We=["padding","paddingTop","paddingRight","paddingBottom","paddingLeft"],Ee=["shape","sizeRangeBegin","sizeRangeEnd","rotationRangeBegin","rotationRangeEnd","gridSize"],Xe=["mapZoom","mapRoam","mapBorderColor","mapBorderWidth","mapAreaColor"],Ue=["visualMapShow","visualMapMin","visualMapMax","visualMapItemWidth","visualMapItemHeight","visualMapHoverLink","visualMapOrient","visualMapInverse","visualMapCalculable","visualMapRealtime","visualMapTextMax","visualMapTextMin","visualMapInRangeMin","visualMapInRangeMax"],He=["nodeWidth","nodeGap","nodeAlign","orient"],Ge=[...J,"measures","style","yAxisNameConfig","bubbleField","groupField","waveletStyle","visualMap","calendar"],Ve={SUM:"求和",AVG:"均值",MAX:"最大值",MIN:"最小值",COUNT:"计数",COUNT_DISTINCT:"去重计数"};function Ke(e){const a=Ve[e];return a?`[${a}]`:""}async function Je(a){const{data:d,env:c,dsl:f,dataSourceType:n,whereConditionRaw:i,havingConditionRaw:b,contextData:r,dataApi:l,staticJson:s,inPreviewPanel:u}=a;if("context"===n){return{data:Ya((r&&r[0]?r[0]:{}).data,d)}}if("api"===n&&l){let e=[];if(o(l,d)){let a={};try{a=await c.fetcher(l,d)}catch(e){console.warn(`[${l.url}]接口请求异常:`,e)}a.data&&(a.data.data||a.data.items)?e=a.data.data||a.data.items:!a.data&&!a.items||a.data.errcode||a.data.stack||(e=a.data||a.items)}return{data:e}}if("staticJson"===n)return{data:s};const h=Qe(i,[]),g=Qe(b,[]),p=e(d,h.concat(g));if("dataModel"!==n&&"dataSet"!==n)return{data:[]};const m=f&&~f?.indexOf("jsonql://");let y,x=f&&~f?.indexOf("preview://"),w=be(f),_="",S={};if(m){const{model:e}=a;w=ie(e),S=function(e,a){let d={};if(e&&t(e))try{d=JSON.parse(e)}catch(a){return console.warn(`当前JSONQL字符串解析错误:${e}`),{}}else e&&(d=e);return d.where&&a&&(d.where=I(d.where,a)),d.having&&a&&(d.having=I(d.having,a)),d}(f.split("jsonql://")[1],p)}else if(x){const[e,a,d]=f.split("|");w=a,_=N(d,p)}else if(u){const{previewUrl:e}=a;w=e,_=N(f.split("jsonql://")[1],p),x=!0}return y=m?await c.fetcher(w,S,{method:"post"}):x?await c.fetcher(w,{jsonqlstr:_,queryParams:p},{method:"post"}):await c.fetcher(w,{queryParams:p},{method:"post"}),y}function Qe(e,a){if(!e)return[];if(e.children?.length)e.children.forEach((e=>{Qe(e,a)}));else if(e.right)if("between"===e.op){const d=r(e.right[0]),c=r(e.right[1]);for(const e of d.concat(c))a.push(e)}else{const d=e.right&&"string"==typeof e.right?r(e.right):[];for(const e of d)a.push(e)}return a}async function Ze(e,a){const d=a||{},{data:c,dataApi:f,dimensions:t,measures:i,measures2:b,staticJson:o}=d,{data:r,whereConditionRaw:s,havingConditionRaw:u,dataSourceType:h,contextData:g,dataApi:p,dimensions:m,measures:y,measures2:x,staticJson:w}=e;if("context"===h){return{data:Ya((g&&g[0]?g[0]:{}).data,r)}}if("api"===h&&(!n(p,f)||l(f,p,c,r)||function(e,a,d,c){if(void 0===e&&void 0!==a||void 0!==e&&void 0===a)return!0;const f=ed(e,d),t=ed(a,c);return!n(f,t)}(f?.data,p?.data,c,r)||!n(m,t)||!n(y,i)||!n(x,b)))return await Je(e);if(!("staticJson"!==h||n(w,o)&&n(m,t)&&n(y,i)&&n(x,b)))return await Je(e);if(d.dsl!==e.dsl)return await Je(e);const _=Qe(s,[]),S=Qe(u,[]);for(const a of _.concat(S))if((r||{})[a]!==(c||{})[a])return await Je(e);return!1}function ea(a,d){const{colorTheme:c,color:f,colorBy:t,areaStyle:i,axisTickStyle:b,xAxisNameStyle:o}=d||{},{colorTheme:r,color:l,areaStyle:s,axisTickStyle:u,xAxisNameStyle:h,colorBy:g}=a,p={};for(const e of Ge)if(!n(a[e],d[e]))return p[e]=a[e],p;for(const e of ue)if(d[e]!==a[e])return!0;if("chart-map"===a.type||"chart-scatter-map"===a.type){if(d.mapChartType!==a.mapChartType)return p.mapChartType=a.mapChartType,p;if(d.mapName!==a.mapName)return p.mapName=a.mapName,p.mapURL=a.mapURL,p;for(const e of Xe)if(d[e]!==a[e])return!0;for(const e of Ue)if(d[e]!==a[e])return!0}if("chart-sankey"===a.type)for(const e of He)if(d[e]!==a[e])return!0;if(r!==c||g!==t||!n(l,f))return!0;for(const e of Be)if(d[e]!==a[e])return!0;for(const e of Fe)if(d[e]!==a[e])return!0;for(const e of ze)if(d[e]!==a[e])return!0;for(const e of Ne)if(d[e]!==a[e])return!0;for(const e of me)if(d[e]!==a[e])return p.grid={[e]:a[e]},p;if("chart-pie"===a.type)for(const e of pe)if(d[e]!==a[e])return"rose"===a.pieChartType?p.roseType=a.pieChartRoseType:p.roseType="",p;if(d.dataType!==a.dataType)return p.dataType=a.dataType,p;if(d.showTotolData!==a.showTotolData)return p.showTotolData=a.showTotolData,p;if(p.__notEChartsDiff={},"chart-percent"===a.type){for(const e of Ae)if(d[e]!==a[e])return!0;for(const e of Le)if(d[e]!==a[e])return!0;for(const e of De)if(d[e]!==a[e])return!0;for(const e of je)if(d[e]!==a[e])return!0;for(const e of Me)if(d[e]!==a[e])return!0;for(const e of $e)if(d[e]!==a[e])return!0;for(const e of Te)if(d[e]!==a[e])return!0;for(const e of ke)if(d[e]!==a[e])return!0;if(d.progressStartAngle!==a.progressStartAngle)return!0;if(d.progressEndAngle!==a.progressEndAngle)return!0}if("chart-pie"===a.type||"chart-radar"===a.type||"chart-percent"===a.type){if(d.areaShow!==a.areaShow)return!0;if(!n(s,i))return!0;for(const e of ge)if(d[e]!==a[e])return!0}if("chart-line"===a.type){for(const e of Ye)if(d[e]!==a[e])return p.__notEChartsDiff[e]=a[e],p;for(const e of Pe)if(d[e]!==a[e])return!0;const e=["lineType","lineStepPosition","markLine","markPoint","cateAxis","lineChartLineDiff","columnBarMinHeight","columnItemStyle"];for(const c of e)if(d[c]!==a[c])return!0}for(const e of he)if(d[e]!==a[e])return!0;for(const e of Re)if(d[e]!==a[e])return!0;if("target-number"===a.type)for(const e of Ce)if(d[e]!==a[e])return!0;if("chart-scatter"===a.type||"chart-bubble"===a.type)for(const e of ve)if(d[e]!==a[e])return!0;if("chart-column"===a.type||"chart-waterfall"===a.type||"chart-line"===a.type||"chart-scatter"===a.type||"chart-bubble"===a.type){if(d.columnChartType!==a.columnChartType)return p.__notEChartsDiff.columnChartType=a.columnChartType,p;for(const e of ye)if(d[e]!==a[e])return!0;for(const c of xe)if(d[c]!==a[c])return p.__notEChartsDiff.valueAxis=$a(e(a,xe)),p;for(const c of we)if(d[c]!==a[c])return p.__notEChartsDiff.valueAxis2=$a(e(a,we)),p;for(const e of _e)if(d[e]!==a[e])return!0;for(const e of Se)if(d[e]!==a[e])return!0;if(!n(u,b))return p.axisTickStyle=u,p;if(!n(h,o))return p.xAxisNameStyle=h,p}if("chart-funnel"===a.type)for(const e of Oe)if(d[e]!==a[e])return!0;if("chart-column"===a.type||"chart-waterfall"===a.type||"chart-line"===a.type&&a.columnLineMix){for(const e of Ie)if(d[e]!==a[e])return!0;for(const e of qe)if(d[e]!==a[e])return!0}if("chart-word-cloud"===a.type)for(const e of Ee)if(d[e]!==a[e])return!0;return Object.keys(p.__notEChartsDiff).length||delete p.__notEChartsDiff,!!Object.keys(p).length&&p}const aa={default:e=>e,centToYuan:e=>isNaN(e)||0===e||"-"===e?e:e/100,precision(e,a){const{formatterToFixed:d,formatterClearZero:c}=a||{};if(isNaN(e)||"-"===e)return e;return s(e,d>0?d:0)},pureNumber:e=>`${e}`,thousandSeparatorNumber(e,a){const{formatterToFixed:d,formatterClearZero:c}=a||{};if(isNaN(e)||0===e||"-"===e)return e;if(e.toString().indexOf(",")>-1)return e;return s(e,d>0?d:0)},numberAddPercentTag:e=>isNaN(e)||0===e||"-"===e?e:`${e}%`,numberToPercent(e,a){if(0===e||"-"===e)return e;const{formatterToFixed:d,formatterClearZero:c}=a||{};let f=Number(e);if(isNaN(f))return 0;if(void 0!==d){f=(100*f).toFixed(d>0?d:0)}else f*=100;return c&&(f=parseFloat(f)),`${f}%`},numberToMillionBillion(e,d){if(isNaN(e)||0===e||"-"===e)return e;const{formatterToFixed:c}=d||{},f=c>0?c:2;return e>=1e8||e<=-1e8?`${a(e/1e8,f)}亿`:e>=1e4||e<=-1e4?`${a(e/1e4,f)}万`:e},secondToHMS(e){if(isNaN(e)||0===e||"-"===e)return e;let a=e,d=0,c=0;return a>60&&(d=Math.trunc(a/60),a%=60),d>60&&(c=Math.trunc(d/60),d%=60),`${c} 时 ${d}分 ${a} 秒`},secondToDHMS(e){if(isNaN(e)||0===e||"-"===e)return e;let a=e,d=0,c=0,f=0;return a>60&&(d=Math.trunc(a/60),a%=60),d>60&&(c=Math.trunc(d/60),d%=60),c>24&&(f=Math.trunc(c/24),c%=24),`${f}天 ${c} 时 ${d}分 ${a} 秒`},byteToMGB(e){if(isNaN(e)||0===e||"-"===e)return e;const a=e,d=1024;return a<d?`${a}B`:a<d**2?`${(a/d).toFixed(2)}KB`:a<d**3?`${(a/d**2).toFixed(2)}MB`:a<d**4?`${(a/d**3).toFixed(2)}G`:`${(a/d**4).toFixed(2)}T`},byteToMbps(e){if(isNaN(e)||0===e||"-"===e)return e;const a=8*e,d=1024;return a<d?`${a}bps`:a<d**2?`${(a/d).toFixed(2)}Kbps`:a<d**3?`${(a/d**2).toFixed(2)}Mbps`:a<d**4?`${(a/d**3).toFixed(2)}Gbps`:`${(a/d**4).toFixed(2)}Tbps`}};function da(e,a){const{titleShow:d,titleText:c,titleAlignment:f,titleColor:t,titleBackgroundColor:n,titleFontSize:i,titleLink:b,titleTextStyle:o}=e,{color:r,fontSize:l,fontStyle:s,fontWeight:u,fontFamily:h,lineHeight:g}=o||{},p=h||(o||{})["font-family"];return{show:d??!0,text:c,left:f||"left",textStyle:{...o,color:r||t||ce("color.text",a),fontSize:l||i||12,fontStyle:s,fontWeight:u,fontFamily:p,lineHeight:g},backgroundColor:n||"none",link:b}}function ca(e,a,d,c){const f=e[a||"chartStyle"],{color:t,fontSize:n,fontStyle:i,fontWeight:b,fontFamily:o,lineHeight:r,backgroundColor:l}=f||{},s=o||(f||{})["font-family"],{color:u,fontSize:h}=d||{};return{...f,color:t||u||ce("color.subText",c),fontSize:n||h||16,fontStyle:i,fontWeight:b,fontFamily:s,lineHeight:r,backgroundColor:l||"none"}}function fa(e,a,d){const c=e[a||"xAxisLineStyle"],{color:f,width:t}=c||{};return{color:f||ce("border.color",d),width:t}}function ta(e,a,d){const c=e[a||"lineStyle"],{color:f,width:t}=c||{};return{color:f||ce("color.line",d),width:t}}function na(e){const{centerHorizontal:a,centerVertical:d,radius:c,innerRadius:f}=e,t={};return t.center=[a||"50%",d||"50%"],t.radius=c||"70%",f&&(t.radius=[f,t.radius]),t}function ia(e,a){const{gridLeft:d,gridTop:c,gridBottom:f,gridRight:t}=e,{notNeedDefaultVal:n,defaultGridLeft:i,defaultGridTop:b,defaultGridBottom:o,defaultGridRight:r}=a||{},l={left:oa(d,i??"7%"),right:oa(t,r??"7%"),top:oa(c,b??"60"),bottom:oa(f,o??"60"),containLabel:!0};return n&&!d&&0!==d&&delete l.left,n&&!t&&0!==t&&delete l.right,n&&!c&&0!==c&&delete l.top,n&&!f&&0!==f&&delete l.bottom,l}function ba(e,a,d){const c=e[a||"chartStyle"]||{},{nameGap:f,nameRotate:t,nameLocation:n}=c||{},i=c.nameTextStyle||{};return{...c,nameGap:f??15,nameRotate:t??0,nameLocation:n??"end",nameTextStyle:{...i,color:i.color||ce("color.text",d),fontSize:i.fontSize||12,fontWeight:i.fontWeight||"normal"}}}function oa(e,a){return 0===e||"0"===e?e:e||a}const ra={SUM:e=>{let a=0;for(let d=0,c=e.length;d<c;d++)a+=e[d];return a},AVG:e=>a(ra.SUM(e)/e.length,2),MAX:e=>Math.max(...e),MIN:e=>Math.min(...e)};function la(e,a,d){const{type:c,legendType:f,legendShow:t,legendColor:n,legendFontSize:i,legendAlign:b,legendOrient:o,legendPosition:r,legendWidth:l,legendHeight:s,legendTop:u,legendRight:h,legendBottom:g,legendLeft:p,legendTextStyle:m,legendDataShow:y,legendDataFormat:x,groupField:w}=e,{color:_,fontSize:S,fontStyle:z,fontWeight:v,fontFamily:C,lineHeight:T}=m||{},k=C||(m||{})["font-family"],A=e.dimensions||[],L=e.measures||[];let D=!1;"chart-column"!==c&&"chart-line"!==c&&"chart-radar"!==c&&"chart-scatter"!==c&&"chart-bubble"!==c||(D=!0);const j={left:"auto",right:"auto",top:"auto",bottom:"auto"};return"left"===r?(j.left=p||"left",j.top="center"):"right"===r?(j.right=h||"right",j.top="center"):"bottom"===r?(j.bottom=g||"bottom",j.left="center"):"leftTop"===r?(j.left=p||"left",j.top=u||"top"):"rightTop"===r?(j.right=h||"right",j.top=u||"top"):"leftBottom"===r?(j.left=p||"left",j.bottom=g||"bottom"):"rightBottom"===r?(j.right=h||"right",j.bottom=g||"bottom"):(j.top=u||"top",j.left="center"),{type:f??"plain",show:t??!0,textStyle:{color:_||n||ce("color.text",d),fontSize:S||i||12,fontStyle:z,fontWeight:v,fontFamily:k,lineHeight:T},align:b||"auto",orient:o||"horizontal",width:"horizontal"===o?l:"auto",height:"vertical"===o?s:"auto",formatter:e=>{let d=e;if("chart-scatter"===c||"chart-bubble"===c){const a=A[0]||{},c=a.label||a.as,f=L[0]||{},t=f.label||f.as;d=L&&1===L.length&&w?`${e}(${c}/${t})`:`${c}/${e}`}const f=(a||[]).find((a=>a.name===e));return f&&y?D?`${d} ${ra[x||"AVG"](f.data||f.value)}`:`${d} ${f.value||f.data}`:d},...j}}function sa(e,a){const{progressShow:d,progressWidth:c,progressColor:f}=e;return{show:d??!0,width:c||20,itemStyle:{color:f||ce("color.brand",a)}}}function ua(e,a){const{dataTitleShow:d,dataTitleOffsetX:c,dataTitleOffsetY:f,dataTitleColor:t,dataTitleFontSize:n,dataTitleFontWeight:i}=e;return{show:d??!0,offsetCenter:[c||0,f||0],...{color:t,fontSize:n,fontWeight:i,...ca(e,"dataTitleStyle",{fontSize:12,color:t||ce("color.text",a)},a)||{}}}}function ha(e,a,d){const{dataDetailShow:c,dataDetailOffsetX:f,dataDetailOffsetY:t,dataDetailColor:n,dataDetailFontSize:i,dataDetailFontWeight:b}=e,o={show:c??!0,offsetCenter:[f||0,t||0],...{color:n||ce("color.text",d),fontSize:i,fontWeight:b,...ca(e,"dataDetailStyle",{fontSize:28},d)||{}}};if(a?.formatter){const e="totalToPercent"===a.formatter?"precision":"default",d=aa[a.formatter]||aa[e];o.formatter=e=>d(e,a)}return o}function ga(e,a){const{axisLineShow:d,axisLineColor:c,progressWidth:f}=e;return{show:d??!0,lineStyle:{color:[[1,c||ce("color.fill",a)]],width:f}}}function pa(e,a){const{axisTickShow:d,axisTickSplitNumber:c,axisTickLength:f,axisTickDistance:t,axisTickColor:n,axisTickWidth:i}=e;return{show:d??!1,splitNumber:c||5,length:f||5,distance:t,lineStyle:{color:n||ce("color.line",a),width:i}}}function ma(e,a){const{splitLineShow:d,splitLineLength:c,splitLineDistance:f,splitLineColor:t,splitLineWidth:n}=e;return{show:d??!1,length:c||10,distance:f||10,lineStyle:{color:t||ce("color.line",a),width:n||3}}}function ya(e,a){const{axisLabelShow:d,axisLabelDistance:c,axisLabelRotate:f,axisLabelColor:t,axisLabelFontSize:n,axisLabelFontWeight:i}=e;return{show:d??!1,distance:c,rotate:f,...{fontWeight:i,...ca(e,"axisLabelStyle",{color:t||ce("color.descText",a),fontSize:n||12},a)||{}}}}function xa(e){const{pointerShow:a,pointerColor:d}=e;return{show:a??!0,itemStyle:{color:d}}}function wa(e,a){const{markPointSymbol:d,markPointMax:c,markPointMin:f,markPointBackground:t,markPointSymbolSize:n,markPointSymbolRotate:i,markPointSymboloffsetX:b,markPointSymboloffsetY:o}=e,r={symbol:d,symbolSize:n,symbolOffset:[b,o],data:[],symbolRotate:i,itemStyle:{color:t,background:t}};return c&&r.data.push({type:"max",name:"Max"}),f&&r.data.push({type:"min",name:"Min"}),r}function _a(e,a,d){const{markLineAvarage:c,markLineAvarageColor:f,markLineSymbolLeft:t,markLineSymbolRight:n,markLineBase:i,markLineBaseValue:b,markLineBaseColor:o}=e,r={symbol:[t||"none",n||"none"],data:[]};return c&&r.data.push({type:"average",name:"Avg",lineStyle:{color:f}}),i&&a&&r.data.push({xAxis:b??100,lineStyle:{color:o||ce("color.line",d)}}),i&&!a&&r.data.push({yAxis:b??100,lineStyle:{color:o||ce("color.line",d)}}),r}function Sa(e,a,d){const c=(e.measures||[]).concat(e.measures2||[]),t=e.dimensions||[],{type:n,tooltipShow:i,tooltipFontSize:b,tooltipColor:o,tooltipBackgroundColor:r,tooltipBorderWidth:l,tooltipBorderColor:s,tooltipPadding:u,tooltipContent:h,tooltipTextStyle:g,dataType:p,bubbleField:m,groupField:y}=e,{color:x,fontSize:w,fontStyle:_,fontWeight:S,fontFamily:z,lineHeight:v}=g||{},C=z||(g||{})["font-family"];let T=m||"气泡值";f(m)&&(T=(m[0]||{}).label||(m[0]||{}).as||"气泡值");const k={trigger:"chart-column"===n||"chart-line"===n?"axis":"item",show:i??!0,confine:!0,backgroundColor:r||ce("color.fill",d),borderWidth:l||0,borderColor:s||ce("color.line",d),padding:u||5,textStyle:{color:x||o||ce("color.text",d),fontSize:w?parseInt(w):b||12,fontStyle:_||"normal",fontWeight:S||"normal",fontFamily:C||"sans-serif",height:50}},A=h??"b,c";return k.formatter=A?d=>{let i="",b=(f(d)?d:[d]).map(((b,o)=>{let r=b.seriesIndex??0;2===p&&(r=b.dataIndex),("chart-waterfall"===n||"chart-scatter-map"===n||y&&c&&1===c.length)&&(r=0);let l=b.value??"-";isNaN(l)&&!f(l)&&(l="-");let s=t[r]||{};const u=c[r]||{},h=u?.formatter||"default";if("scatter"===d.seriesType&&(s=t[0]||{}),f(l))if("chart-scatter-map"===n)l=aa[h](l[2],u);else if("chart-calendar"===n)l=aa[h](l[1],u);else if("chart-scatter"===n&&f(l))l=`${l[0]},${aa[h](l[1],u)}`;else if("chart-bubble"===n&&f(l))l=`${l[0]},${aa[h](l[1],u)},${l[2]}`;else if(a&&f(a)){const e=l.map(((e,d)=>`${a[d].name}: ${aa[h](e,u)}`)).join("<br/>");l=`${-1!==A.indexOf("b")?"<br/>":""}${e}`}else l=l.map((e=>aa[h](e,u))).join(",");else"chart-column"===n&&"twoWayComparison"===e?.columnChartType&&0===r&&(l=-l),"chart-waterfall"===n&&2===b.componentIndex&&(l=-l),l=aa[h](l,u);i=b.name;let g="";return-1!==A.indexOf("b")&&("scatter"===d.seriesType?(g+=`${s.label||s.as},${u.label||u.as}`,"chart-bubble"===n&&(g+=`,${T}`)):"heatmap"===d.seriesType?g+=`${b.value[0]} ${u.label||u.as}`:g+=`${"axis"===k.trigger?b.seriesName:b.name}`,A.length>1&&(g+=": ")),-1!==A.indexOf("c")&&(g+=l),-1!==A.indexOf("d")&&(g+=` ${b.percent}%`),g})).join("<br/>");return"chart-line"!==n&&"chart-column"!==n||-1===A.indexOf("x")||(b=`${i}<br/>${b}`),b}:e=>"",k}function za(e,a,d){const{type:c,labelShow:t,labelFontSize:n,labelColor:i,labelFontWeight:b,labelContent:o,labelOverflow:r,labelLineHeight:l,labelPosition:s,labelTextStyle:u,dataType:h,bubbleField:g,groupField:p}=e,m=(e.measures||[]).concat(e.measures2||[]),y=e.dimensions||[],{color:x,fontSize:w,fontStyle:_,fontWeight:S,fontFamily:z,lineHeight:v}=u||{},C=z||(u||{})["font-family"];let T=g||"气泡值";f(g)&&(T=(g[0]||{}).label||(g[0]||{}).as||"气泡值");const k={trigger:"chart-column"===c||"chart-line"===c?"axis":"item",show:t??!0,position:s||"outside",fontSize:w||n||12,color:x||i||ce("color.text",d),fontWeight:S||b||"normal",fontFamily:C||"sans-serif",fontStyle:_||"normal",width:120,overflow:r||"truncate"};s||"chart-map"!==c&&"chart-scatter-map"!==c||delete k.position;const A=o??"b,c";return k.formatter=A?e=>{let d=e.value??"-",t=e.seriesIndex??0;2===h&&(t=e.dataIndex),("chart-waterfall"===c||"chart-scatter-map"===c||("chart-scatter"===c||"chart-bubble"===c)&&p&&m&&1===m.length)&&(t=0),a?.negative&&("chart-column"===c&&0===e.seriesIndex||"chart-waterfall"===c&&2===e.seriesIndex)&&(d=-d);let n=y[t]||{};const i=m[t]||{};if("scatter"===e.seriesType){n=y[0]||{};const a=e.value||[];d=[aa[n.formatter||"default"](a[0],n),aa[i.formatter||"default"](a[1],i)],"chart-bubble"===c&&d.push(a[2])}else"chart-scatter-map"===c&&f(d)?d=aa[i.formatter||"default"](d[2],i):"chart-calendar"===c&&f(d)?d=aa[i.formatter||"default"](d[1],i):isNaN(d)&&!f(d)?d="-":a?.type?d=aa[a.type||"default"](d,a):i?.formatter&&(d=aa[i.formatter||"default"](d,i));let b="";return-1!==A.indexOf("b")&&("scatter"===e.seriesType?(b+=`${n.label||n.as},${i.label||i.as}`,"chart-bubble"===c&&(b+=`,${T}`)):"heatmap"===e.seriesType?b+=`${i.label||i.as}`:b+=`${"axis"===k.trigger?e.seriesName:e.name}`,A.length>1&&(b+=": ")),-1!==A.indexOf("c")&&(b+=d),-1!==A.indexOf("d")&&(b+=` ${e.percent}%`),b}:e=>"",k}function va(e){const{lineWidth:a,lineCap:d,lineJoin:c,lineShadowBlur:f,lineShadowColor:t,lineShadowOffsetX:n,lineShadowOffsetY:i,lineOpacity:b}=e;return{lineStyle:{width:a||2,cap:d||"butt",join:c||"bevel",shadowBlur:f,shadowColor:t,shadowOffsetX:n,shadowOffsetY:i,opacity:b}}}function Ca(e,a){const{columnBorderWidth:d,columnBorderColor:f,columnBorderType:t,columnShadowBlur:n,columnShadowColor:i,columnShadowOffsetX:b,columnShadowOffsetY:o}=e,r=e.columnBorderRadius||0;let l=r;return c(r)&&(l=[parseInt(r["top-left-border-radius"])||0,parseInt(r["top-right-border-radius"])||0,parseInt(r["bottom-left-border-radius"])||0,parseInt(r["bottom-right-border-radius"])||0]),{borderColor:f,borderWidth:d,borderType:t,borderRadius:l,shadowBlur:n,shadowColor:i||ce("color.line",a),shadowOffsetX:b,shadowOffsetY:o}}function Ta(e){const{bubbleShadowShow:a,shadowBlur:d,shadowColor:c,shadowOffsetX:f,shadowOffsetY:t}=e||{};return a?{shadowBlur:d??10,shadowColor:c||"#ccc",shadowOffsetX:f??3,shadowOffsetY:t??-3}:{shadowBlur:0,shadowColor:void 0,shadowOffsetX:0,shadowOffsetY:0}}function ka(e,a,d){const{columnChartType:c,xAxisShow:f,xAxisInverse:t,xAxisLabelShow:n,xAxisLabelShowOverlap:i,xAxisLabelRotate:b,xAxisFontSize:o,xAxisName:r,xAxisNameRotate:l,xAxisLineShow:s,axisTickStyle:u,xAxisNameGap:h,xAxisNameLocation:g,xAxisNameStyle:p,xAxisMin:m,xAxisMax:y,xAxisSplitLineShow:x,xAxisSplitAreaShow:w}=e,_=u||{},S={type:a?"value":"category",min:m||"dataMin",max:y||"dataMax",show:f??!0,inverse:t,splitLine:{show:x??!1},splitArea:{show:w??!1},axisLabel:{show:n??!0,rotate:b,interval:i?0:"auto",...{fontSize:o,...ca(e,"xAxisLabelStyle",{},d)||{}}},axisLine:{show:s??!0,lineStyle:fa(e,"xAxisLineStyle",d)},axisTick:{show:_.show??!0,length:_.length??5,lineStyle:{color:_.color??ce("color.line",d),width:_.width??1}},name:r,nameRotate:l,nameGap:h,nameLocation:g??"end",nameTextStyle:{...p,color:p?.color||ce("color.text",d)}};return"twoWayComparison"===c&&"value"===S.type&&(S.axisLabel.formatter=function(e){return e<0?-e:e}),S.data=[],S}function Aa(e){const{chartItemStyle:a}=e,{borderRadius:d}=a||{};return{borderRadius:d}}function La(e){const{areaShow:a,areaStyle:d}=e||{},{shadowBlur:c,shadowColor:f,shadowOffsetX:t,shadowOffsetY:n,opacity:i}=d||{};if(!a)return null;return{shadowBlur:c,shadowColor:f,shadowOffsetX:t,shadowOffsetY:n,opacity:i??.5}}function Da(e,a,d){const c=e,f=function(e,a){if(4===e.length){let a="#";for(let d=1;d<4;d+=1)a+=e.slice(d,d+1).concat(e.slice(d,d+1));e=a}const d=a||.5;d>1&&console.info("提示:透明度设置大于1会导致图表渐变失效(如刻意设置请忽略)。");const c=[];for(let a=1;a<7;a+=2)c.push(parseInt(`0x${e.slice(a,a+2)}`));return`rgba(${c[0]}, ${c[1]}, ${c[2]}, ${d})`}(e,d);let t={x:0,y:0,x2:0,y2:1};return"bottom2top"===a?t={x:0,y:1,x2:0,y2:0}:"left2right"===a?t={x:0,y:0,x2:1,y2:0}:"right2left"===a&&(t={x:1,y:0,x2:0,y2:0}),{type:"linear",...t,colorStops:[{offset:0,color:c},{offset:1,color:f}]}}function ja(e){const{color:a,colorTheme:d,gradientStatus:c,gradientMode:f,gradientAlpha:t}=e,n=window.store?.app?.theme||{},i=n.themeList||[],b=n.defaultThemeId,o=window.store?.app?.curTheme||b,r=i.find((e=>e.value===o||e.url===o))?.config?.dataColor?.body||[],l={};let s="";r.forEach((e=>{e&&("默认"===e.