帆软报表设计器源代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2 lines
38 KiB

!function(e){var t={};function i(s){if(t[s])return t[s].exports;var o=t[s]={i:s,l:!1,exports:{}};return e[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=t,i.d=function(e,t,s){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(s,o,function(t){return e[t]}.bind(null,o));return s},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t,i){BI.DOM.ready(()=>{const e=i(5).default;BI.createWidget({type:e,element:"body"})})},function(e,t,i){},function(e,t){const i=BI.Constants.getConstant("dec.constant.database.conf.connect.form.redis.value"),s=BI.inherit(BI.Widget,{render:()=>({type:"bi.vertical",cls:"bi-plugin-redis",bgap:10,items:[{type:"bi.left",height:30,items:[{type:"bi.label",text:"数据库地址:",height:24,width:115,textAlign:"left"},{type:"bi.label",text:i.url,height:24}]},{type:"bi.left",height:30,items:[{type:"bi.label",text:"端口:",height:24,width:115,textAlign:"left"},{type:"bi.label",text:i.port,height:24}]},{type:"bi.left",height:30,items:[{type:"bi.label",text:"密码:",height:24,width:115,textAlign:"left"},{type:"bi.label",text:"********",height:24}]}]})});BI.shortcut("fr.plugin.redis.preview",s),BI.constant("dec.constant.database.conf.connect.form.redis.preview","fr.plugin.redis.preview")},function(e,t){const i=BI.inherit(BI.Widget,{render(){const{maxActive:e,maxIdle:t,numActive:i,numIdle:s}=this.options;return{type:"bi.left",items:[{type:"bi.left",cls:"right-status-item",items:[{type:"bi.vertical",cls:"right-status-board",items:[{type:"bi.vertical",cls:"right-status-board-item",items:[{type:"bi.label",cls:"right-status-text",extraCls:"card-font1",text:i},{type:"bi.label",cls:"right-status-text",text:"/"},{type:"bi.label",cls:"right-status-text",text:e}]},{type:"bi.label",text:"Redis连接数"}]}]}]}}});BI.shortcut("fr.plugin.redis.pool",i),BI.constant("dec.constant.database.conf.connect.form.redis.pool","fr.plugin.redis.pool")},function(e,t,i){},function(e,t,i){"use strict";i.r(t);const s="bi.icon_label",o="bi.label",r="bi.button",n="bi.editor",l="bi.vtape",a="bi.htape",c="bi.layout",d="bi.vertical",h="bi.left",p=[],m={childContext:["tab","linkList","linkSelected","linkUpdate","moreLinkSelected","statusSelected","connectionNameErr"],state:()=>({tab:"数据连接管理",linkList:p,linkSelected:{},linkUpdate:{},moreLinkSelected:"",statusSelected:"",connectionNameErr:""}),computed:{},actions:{setLinkList(e){this.model.linkList=e}}};BI.model("fr.model.main",BI.inherit(Fix.Model,m));const b=BI.inherit(Fix.Model,{context:["tab"],actions:{setTab(e){this.model.tab=e}}});BI.model("fr.model.title.item",b);function u(e,t){return e===t?{color:"#3685f2","border-bottom":"solid 2px #3685f2"}:{color:"#3d4d66","border-bottom":"none"}}const g=BI.inherit(BI.Widget,{props:{text:""},_store:()=>BI.Models.getModel("fr.model.title.item"),watch:{tab(e){const{text:t}=this.options;this.element.css(u(t,e))}},render(){const{text:e}=this.options;return{type:o,cls:"title-item",text:e}},mounted(){const{text:e}=this.options;this.element.css(u("数据连接管理",e)),this.element.on("click",()=>{this.store.setTab(e)})}});BI.shortcut("fr.title.item",g);const y={data:[{connectionId:"8c1c52f1-3d0a-429e-b35f-ee1e085a8b72",database:"",connectionName:"FRDemo",driver:"org.sqlite.JDBC",url:"jdbc:sqlite://${ENV_HOME}/../help/FRDemo.db",user:"",password:"",queryType:"",newCharsetName:"null",originalCharsetName:"",validationQuery:"",schema:"",testOnBorrow:!0,maxActive:50,options:"null",port:0,authType:"",creator:"designer",principal:"",keyPath:"",databaseType:"designer",privilegeDetailBeanList:"null"}]},f=window.parent.Dec,v=window.PluginHelper;const x=["数据连接管理","连接池状态"],I={render(){return{type:h,cls:"title",items:[...BI.map(x,(e,t)=>({type:"fr.title.item",text:t})),{type:"bi.icon_button",cls:"close-button",handler(){!function(){if(v)return v.closeWindow();console.log("关闭窗口")}()},invisible:!0,ref:e=>{this.CloseButton=e}}]}},mounted(){v&&v.isDesigner()&&this.CloseButton.setVisible(!0)}};BI.shortcut("fr.title",BI.inherit(BI.Widget,I));const k="dec.constant.database.conf.connect.list",B=["APACHE KYLIN","DERBY","HP Vertica","IBM DB2","INFORMIX","Microsoft SQL Server","MySQL","Oracle","Privotal Greenplum Database","Postgresql","GaussDB 200"];BI.constant(k,[]);var E=k;const w=[{text:"APACHE KYLIN",databaseType:"apache-kylin",driver:"org.apache.kylin.jdbc.Driver",url:"jdbc:kylin://<hostname>:<port>/<kylin_project_name>"},{text:"DERBY",databaseType:"derby",driver:"org.apache.derby.jdbc.ClientDriver",url:"jdbc:derby://localhost:1527/"},{text:"HP Vertica",databaseType:"hp-vertica",driver:"com.vertica.jdbc.Driver",url:"jdbc:vertica://ip:port/databaseName"},{text:"IBM DB2",databaseType:"ibm-db2",driver:"com.ibm.db2.jcc.DB2Driver",url:"jdbc:db2://hostname:port/dbname"},{text:"INFORMIX",databaseType:"informix",driver:"com.informix.jdbc.IfxDriver",url:"jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}"},{text:"Microsoft SQL Server",databaseType:"sql-server",driver:"com.microsoft.sqlserver.jdbc.SQLServerDriver",url:"jdbc:sqlserver://localhost:1433;databaseName="},{text:"Oracle",databaseType:"oracle",driver:"oracle.jdbc.driver.OracleDriver",url:"jdbc:oracle:thin:@localhost:1521:databaseName"},{text:"Privotal Greenplum Database",databaseType:"pivotal-greenplum-database",driver:"org.postgresql.Driver",url:"jdbc:postgresql://hostname:port/dbname"},{text:"Postgresql",databaseType:"postgresql",driver:"org.postgresql.Driver",url:"jdbc:postgresql://hostname:port/dbname"},{text:"GaussDB 200",databaseType:"hw-libr-a",driver:"org.postgresql.Driver",url:"jdbc:postgresql://hostname:port/dbname"},{text:"MySQL",databaseType:"mysql",driver:"com.mysql.jdbc.Driver",drivers:["com.mysql.jdbc.Driver","org.gjt.mm.mysql.Driver"],url:"jdbc:mysql://localhost/dbname"},{text:"其他",databaseType:"other",driver:"org.h2.Driver",drivers:["org.h2.Driver","com.fr.third.org.hsqldb.jdbcDriver","org.sqlite.JDBC"],url:"jdbc:h2://${ENV_HOME}/../databaseName"},{text:"ADS",databaseType:"ads",driver:"com.mysql.jdbc.Driver",url:"jdbc:mysql://hostname:port/my_ads_db"},{text:"Amazon Redshift",databaseType:"amazon-redshift",driver:"com.amazon.redshift.jdbc4.Driver",drivers:["com.amazon.redshift.jdbc4.Driver","com.amazon.redshift.jdbc41.Driver"],url:"jdbc:redshift://endpoint:port/database"},{text:"APACHE IMPALA",databaseType:"apache-impala",driver:"com.cloudera.impala.jdbc41.Driver",url:"jdbc:impala://hostname:port/_impala_builtins"},{text:"APACHE KYLIN",databaseType:"apache-kylin",driver:"org.apache.kylin.jdbc.Driver",url:"jdbc:kylin://<hostname>:<port>/<kylin_project_name>"},{text:"APACHE Phoenix",databaseType:"apache-phoenix",driver:"org.apache.phoenix.jdbc.PhoenixDriver",url:"jdbc:phoenix:hostname:port/dbname"},{text:"DERBY",databaseType:"derby",driver:"org.apache.derby.jdbc.ClientDriver",url:"jdbc:derby://localhost:1527/"},{text:"Gbase 8A",databaseType:"gbase-8a",driver:"com.gbase.jdbc.Driver",url:"jdbc:gbase://hostname:port/dbname"},{text:"Gbase 8S",databaseType:"gbase-8s",driver:"com.gbasedbt.jdbc.IfxDriver",url:"jdbc:gbasedbt-sqli://{host}:{port}/{database}"},{text:"Gbase 8T",databaseType:"gbase-8t",driver:"com.informix.jdbc.IfxDriver",url:"jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}"},{text:"H2",databaseType:"h2",driver:"org.h2.Driver",url:"jdbc:h2://${ENV_HOME}/../databaseName"},{text:"华为云DWS",databaseType:"hw-dws",driver:"org.postgresql.Driver",url:"jdbc:postgresql://hostname:port/dbname"},{text:"FusionInsight elk",databaseType:"hw-elk",driver:"org.postgresql.Driver",url:"jdbc:postgresql://hostname:port/dbname"},{text:"FusionInsight HD",databaseType:"hw-fusioninsight-hd",driver:"org.apache.hive.jdbc.HiveDriver",url:"jdbc:hive2://10.135.0.110:24002,10.135.0.67:24002,10.135.0.66:24002/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;sasl.qop=auth-conf;auth=KERBEROS;zk.principal=zookeeper/hadoop;principal=hive/hadoop.hadoop.com@HADOOP.COM;"},{text:"GaussDB 200",databaseType:"hw-libr-a",driver:"org.postgresql.Driver",url:"jdbc:postgresql://hostname:port/dbname"},{text:"Hadoop Hive",databaseType:"hadoop-hive",driver:"org.apache.hive.jdbc.HiveDriver",url:"jdbc:hive2://hostname:port/databasename"},{text:"Hbase",databaseType:"hbase",driver:"org.apache.phoenix.jdbc.PhoenixDriver",url:"jdbc:phoenix:hostname:port/dbname"},{text:"HP Vertica",databaseType:"hp-vertica",driver:"com.vertica.jdbc.Driver",url:"jdbc:vertica://ip:port/databaseName"},{text:"Hsql",databaseType:"hsql",driver:"com.fr.third.org.hsqldb.jdbcDriver",url:"jdbc:hsqldb:file:[PATH_TO_DB_FILES]"},{text:"IBM DB2",databaseType:"ibm-db2",driver:"com.ibm.db2.jcc.DB2Driver",url:"jdbc:db2://hostname:port/dbname"},{text:"INFORMIX",databaseType:"informix",driver:"com.informix.jdbc.IfxDriver",url:"jdbc:informix-sqli://{host}:{port}/{database}:INFORMIXSERVER={server}"},{text:"KINGBASE",databaseType:"kingbase",driver:"com.kingbase.Driver",url:"jdbc:kingbase://hostname:port"},{text:"Microsoft SQL Server",databaseType:"sql-server",driver:"com.microsoft.sqlserver.jdbc.SQLServerDriver",url:"jdbc:sqlserver://localhost:1433;databaseName="},{text:"MySQL",databaseType:"mysql",driver:"com.mysql.jdbc.Driver",drivers:["com.mysql.jdbc.Driver","org.gjt.mm.mysql.Driver"],url:"jdbc:mysql://localhost/dbname"},{text:"Oracle",databaseType:"oracle",driver:"oracle.jdbc.driver.OracleDriver",url:"jdbc:oracle:thin:@localhost:1521:databaseName"},{text:"Pivotal Greenplum Database",databaseType:"pivotal-greenplum-database",driver:"org.postgresql.Driver",url:"jdbc:postgresql://hostname:port/dbname"},{text:"Postgresql",databaseType:"postgresql",driver:"org.postgresql.Driver",url:"jdbc:postgresql://hostname:port/dbname"},{text:"Presto",databaseType:"presto",driver:"com.facebook.presto.jdbc.PrestoDriver",url:"jdbc:presto://host:port/catalog"},{text:"SAP HANA",databaseType:"sap-hana",driver:"com.sap.db.jdbc.Driver",url:"jdbc:sap://hostname:port?reconnect=true"},{text:"SAP Sybase",databaseType:"sap-sybase",driver:"com.sybase.jdbc4.jdbc.SybDriver",url:"jdbc:sybase:Tds:hostname:2638/databasename"},{text:"SPARK",databaseType:"spark",driver:"org.apache.hive.jdbc.HiveDriver",url:"jdbc:hive2://hostname:port/databasename"},{text:"Sqlite",databaseType:"sqlite",driver:"org.sqlite.JDBC",url:"jdbc:sqlite:[PATH_TO_DB_FILES]"},{text:"TeraData",databaseType:"teradata",driver:"com.ncr.teradata.TeraDriver",url:"jdbc:teradata://localhost/CLIENT_CHARSET=EUC_CN,TMODE=TERA,CHARSET=ASCII,LOB_SUPPORT"},{text:"TRANSWARP INCEPTOR",databaseType:"transwarp-inceptor",driver:"org.apache.hive.jdbc.HiveDriver",url:"jdbc:hive2://hostname:port/databasename"}],N=(e,t)=>{const i=BI.Constants.getConstant(E);let s=0;const o=t.replace(/[0-9]/g,""),r=BI.some(i,(e,t)=>t===o)?o:"数据连接";return e.forEach(e=>{if(e.isSelected=!1,e.connectionName.startsWith(r)){const t=e.connectionName.replace(r,"0"),i=parseInt(t,10)+1;i>s&&(s=i)}}),`${r}${s>0?s:""}`};var T=new class{confirm(e,t){const i=BI.UUID();return BI.Popovers.create(i,{type:"bi.bar_popover",size:"normal",header:"提示",width:450,height:220,body:{type:"bi.left",cls:"comfirm-content",items:[{type:"bi.layout",cls:"comfirm-icon",width:50,height:50},{type:"bi.label",text:e}]},listeners:[{eventName:"EVENT_CONFIRM",action(){t&&t(!0)}},{eventName:"EVENT_CANCEL",action(){t&&t(!1)}}]}).open(i),i}loading(e){const t={type:"bi.center_adapt",cls:"show-content",items:[{type:d,items:[{type:"bi.layout",cls:"loading-icon",width:100,height:100},{type:o,text:e}]}]};return this.show(t)}success(e){const t={type:"bi.center_adapt",cls:"show-content",items:[{type:d,items:[{type:"bi.layout",cls:"success-icon",width:100,height:100},{type:o,text:e}]}]};return this.show(t,1e3)}error(e){const t={type:"bi.center_adapt",cls:"show-content",items:[{type:d,items:[{type:"bi.layout",cls:"error-icon",width:100,height:100},{type:o,text:e}]}]};return this.show(t,2e3)}linkFail(e,t,i){let s=null,n=null;const l=BI.UUID(),a=this,p={type:d,items:[{type:"bi.center_adapt",cls:"show-content",tgap:10,items:[{type:d,items:[{type:c,cls:"error-icon",width:100,height:100},{type:o,text:e},{type:h,cls:"buttons",items:[{type:r,text:"详细信息",level:"ignore",handler(){const e="详细信息"===this.getText();s.element.css({height:e?"290":"220"}),n.setVisible(e),this.setText(e?"收起信息":"详细信息")}},{type:r,text:"返回",level:"ignore",handler(){a.close(l)}},{type:r,text:"重新连接",handler(){a.close(l),i&&i()}}]}]}]},{type:o,cls:"show-more",text:t,invisible:!0,ref(e){n=e}}]};return BI.Popovers.create(l,{type:"bi.popover",cls:"popover-notitle",extraCls:"bi-custom-show",size:"normal",width:450,height:220,body:p,ref(e){s=e}}).open(l),l}close(e){BI.Popovers.close(e)}show(e,t=0){const i=BI.UUID();return BI.Popovers.create(i,{type:"bi.popover",cls:"popover-notitle",extraCls:"bi-custom-show",size:"normal",width:450,height:220,body:e}).open(i),t>0&&setTimeout(()=>{this.close(i)},t),i}};function C(e){return e.connectionId?new Promise((t,i)=>{try{!function(e,t){console.log("%cdata: ","color: MidnightBlue; background: Aquamarine;",e),f?f.reqPost("/v10/config/connection",e,e=>{t(e.data)}):t("success")}(e,e=>{t(e)})}catch(e){i(e)}}):new Promise((t,i)=>{try{!function(e,t){console.log("%cdata: ","color: MidnightBlue; background: Aquamarine;",e),f?f.reqPut("/v10/config/connection",e,e=>{t(e.data)}):t("success")}(e,e=>{t(e)})}catch(e){i(e)}})}const S={context:["tab","linkList","linkSelected","linkUpdate","connectionNameErr"],actions:{setLinkSelected(e){this.noSaveConfirm(()=>{this._setLinkSelected(e)})},_setLinkSelected(e){this.model.linkList.forEach(t=>{t.isSelected=t.connectionName===e,t.connectionName===e&&(this.model.linkSelected=Object.assign({},t,{isSelected:!1}))}),this.model.linkList=[...this.model.linkList],this.model.linkUpdate=this.model.linkSelected},onIconClick(e,t){switch(e){case"删除":!function(e,t){console.log("%cid: ","color: MidnightBlue; background: Aquamarine;",e),f?f.reqDeleta(`/v10/config/connection/${e}`,e=>{t(e.data)}):t("success")}(t,()=>{this.model.linkList=[...this.model.linkList.filter(e=>e.connectionId!==t)],this.model.linkSelected={},this.model.linkUpdate={}});break;case"测试连接":this._textLink(t);break;case"复制":this.noSaveConfirm(()=>{this.copyLink(t)})}},_textLink(e){const t=T.loading("正在测试连接,请稍候..."),i=this.model.linkList.find(t=>t.connectionId===e);var s,o;s=i,o=(s=>{T.close(t),s&&s.errorCode?T.linkFail(`${i.connectionName}测试连接失败`,s.errorMsg,()=>{this._textLink(e)}):T.success("连接成功")}),console.log("%cdata: ","color: MidnightBlue; background: Aquamarine;",s),f?f.reqPost("/v10/config/connection/test",s,e=>{o(e)}):setTimeout(()=>{o({errorCode:"500",errorMsg:"createConnectionThread not start!"})},2e3)},copyLink(e){const t=BI.find(this.model.linkList,(t,i)=>i.connectionId===e).connectionName,i=N(this.model.linkList,t);let s={};this.model.linkList.forEach(t=>{t.connectionId===e&&(s=t)});const o=Object.assign({},s,{isSelected:!0,connectionName:i,connectionId:""});this.model.linkList=[o,...this.model.linkList],this.model.linkSelected=Object.assign({},o),this.model.linkUpdate=Object.assign({},o)},setLinkUpdate(e){this.model.linkUpdate=e},setEdit(e){this.model.linkSelected=Object.assign({},this.model.linkSelected,{isSelected:e}),this.model.linkUpdate=this.model.linkSelected},setCancel(){const e=this.model.linkSelected,t=this.model.linkList;e.connectionId?this.setEdit(!1):(this.model.linkList=[...t.filter(e=>!!e.connectionId)],this.model.linkList.length>0?(this.model.linkList[0].isSelected=!0,this.model.linkSelected=Object.assign({},this.model.linkList[0],{isSelected:!1})):this.model.linkSelected={},this.model.linkUpdate=this.model.linkSelected)},setNewLink(e){w.some(t=>t.text===e)||BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${e.toLowerCase()}.edit`)?this.noSaveConfirm(()=>{this._setNewLink(e)}):T.error("找不到该连接的配置信息")},_setNewLink(e){const t=N(this.model.linkList,e);let i={};w.forEach(t=>{t.text===e&&(i=t)}),this.model.linkList=[Object.assign({connectionName:t,isSelected:!0},i,{text:e}),...this.model.linkList],this.model.linkSelected=Object.assign({},i,{connectionName:t,isSelected:!0,text:e}),this.model.linkUpdate=Object.assign({},i,{connectionName:t,text:e})},setConnectionNameErr(e){this.model.connectionNameErr=e},noSaveConfirm(e){this.model.linkSelected&&this.model.linkSelected.isSelected?T.confirm("当前设置尚未保存,是否保存?",t=>{t?this.saveLink():this.setCancel(),e()}):e()},saveLink(){const e=this.model.linkUpdate.text?BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${this.model.linkUpdate.text.toLowerCase()}.value`):{};C(Object.assign({},this.model.linkUpdate,e)).then(()=>{this.setEdit(!1)})}}};BI.model("fr.model.linkset",BI.inherit(Fix.Model,S));var j="fr.model.linkset";const _={_store:()=>BI.Models.getModel(j),render(){const{cls:e,title:t,id:i}=this.options,o=this;let r=null,n=null;return"删除"===t?{type:"bi.bubble_combo",direction:"bottom",ref(){n=this},el:{type:s,cls:e,extraCls:"action-icon",height:24,width:26,title:t,ref(e){r=e}},popup:{type:"bi.text_bubble_bar_popup_view",text:"确定删除该数据连接?",listeners:[{eventName:BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON,action(e){n.hideView(),e&&o.store.onIconClick(t,i)}}]},listeners:[{eventName:BI.BubbleCombo.EVENT_EXPAND,action(){r.element.css({visibility:"visible"})}},{eventName:BI.BubbleCombo.EVENT_AFTER_HIDEVIEW,action(){r.element.css({visibility:"hidden"})}}]}:{type:s,cls:e,extraCls:"action-icon",height:24,width:26,title:t}},mounted(){const{title:e,id:t}=this.options;"删除"!==e?this.element.on("click",i=>{i.stopPropagation(),this.store.onIconClick(e,t)}):this.element.on("click",e=>{e.stopPropagation()})}};BI.shortcut("fr.component.linkSet.left.item.icon",BI.inherit(BI.Widget,_));const L={props:{title:"",id:"",creator:""},_store:()=>BI.Models.getModel(j),render(){const{title:e,extraCls:t,creator:i,text:r,id:n}=this.options;return{type:h,cls:"left-item",extraCls:t,items:[{type:s,cls:"link-font",height:24,width:26,text:"连接",title:e},{type:o,cls:"link-title",textAlign:"left",text:e,title:e},{type:h,cls:"icons",items:[{type:"fr.component.linkSet.left.item.icon",cls:"link-text-font",title:"测试连接",id:n},{type:"fr.component.linkSet.left.item.icon",cls:"copy-font",title:"复制",id:n},{type:"fr.component.linkSet.left.item.icon",cls:"info-font",title:`类型:${"DESIGNER"===r?"其他":r} \r\n创建者:${i}`,id:n},{type:"fr.component.linkSet.left.item.icon",cls:"delete-font",title:"删除",id:n}]}]}},mounted(){const{title:e}=this.options;this.element.on("click",()=>{this.store.setLinkSelected(e)})}};BI.shortcut("fr.component.linkSet.left.item",BI.inherit(BI.Widget,L));let D=null;const A={_store:()=>BI.Models.getModel(j),watch:{linkList(e){D.populate(BI.createItems((e=>{const t=[];return e.forEach(e=>{t.push({type:"fr.component.linkSet.left.item",extraCls:e.isSelected?"left-item-selected":"",title:e.connectionName,id:e.connectionId,creator:e.creator,text:e.text?e.text:"默认"})}),t})(e)))}},render:()=>({type:d,ref(e){D=e}})};BI.shortcut("fr.component.linkset.left",BI.inherit(BI.Widget,A));const M={render(){const{text:e,name:t,selected:i}=this.options;return{type:d,cls:"link-item",width:120,height:117,items:[{type:"bi.img",width:120,height:90,src:`./img/${t}.jpg`},{type:c,cls:"selected",invisible:!i,width:30,height:30},{type:o,cls:"text",text:e}]}},mounted(){const{text:e}=this.options;this.element.on("click",()=>{this.fireEvent("EVENT_SELECT",e)})}};BI.shortcut("fr.component.linkSet.morelink.item",BI.inherit(BI.Widget,M));let O=null;const U={render:()=>({type:l,cls:"more-link",items:[{el:{type:d,items:[{type:"bi.search_editor",width:300,watermark:"搜索"}]},height:30},{type:h,cls:"more-link-item",ref(e){O=e}}]}),mounted(){this._renderItems()},_renderItems(e=""){const t=w.slice(12,45),i=[],s=this;t.forEach(t=>{i.push({type:"fr.component.linkSet.morelink.item",text:t.text,name:t.databaseType,selected:e===t.text,listeners:[{eventName:"EVENT_SELECT",action(e){s._renderItems(e),s.fireEvent("EVENT_SELECT",e)}}]})}),O.populate(BI.createItems(i))}};BI.shortcut("fr.component.linkSet.morelink",BI.inherit(BI.Widget,U));let q=null,V="";const P={_store:()=>BI.Models.getModel(j),render(){let e=null;return{type:"bi.combo",cls:"select",trigger:"click",adjustYOffset:4,el:{type:"bi.button",text:"新建数据连接",height:24},popup:{el:{type:"bi.button_group",cls:"database-link-items",items:[...BI.map([...B,...BI.Constants.getConstant(E)],(e,t)=>({type:"bi.text_item",height:24,width:152,text:t,title:t,value:t})),{type:"bi.text_item",cls:"link-item",height:24,width:152,text:"更多数据连接...",title:"更多数据连接...",value:"more"},{type:"bi.text_item",cls:"link-item",height:24,width:152,text:"其他",title:"其他",value:"其他"}],layouts:[{type:d}]},maxHeight:400},listeners:[{eventName:"EVENT_CHANGE",action:t=>{"more"===t?(e=>{const t=BI.UUID();let i=null;BI.Popovers.create(t,{type:"bi.bar_popover",size:"normal",header:"更多数据连接",width:550,height:500,body:{type:"fr.component.linkSet.morelink",listeners:[{eventName:"EVENT_SELECT",action(e){V=e,q.setEnable(!0)}}]},footer:{type:"bi.right_vertical_adapt",lgap:10,items:[{type:"bi.button",text:"取消",value:1,level:"ignore",handler(e){i.close(e)}},{type:"bi.button",text:"确定",disabled:!0,value:0,ref(e){q=e},handler(t){i.close(t),e&&e(V)}}]},ref(e){i=e}}).open(t)})(e=>{this.store.setNewLink(e)}):this.store.setNewLink(t),e.hideView()}}],ref(){e=this}}}};BI.shortcut("fr.linkset.select",BI.inherit(BI.Widget,P));const H={render:()=>({type:"bi.center_adapt",items:[{type:d,width:260,height:180,items:[{type:c,cls:"data-connection-background",width:260,height:130},{type:o,cls:"bi-tips",height:20,text:"请选择左侧数据连接或点击新建数据连接"},{type:o,cls:"bi-tips",height:20,text:"平台仅支持使用JDBC的数据连接的管理"}]}]})};BI.shortcut("fr.component.right.nothing",BI.inherit(BI.Widget,H));const R={_store:()=>BI.Models.getModel(j),render(){const e=this.model.linkSelected,t=this.model.linkList,i=this,{isEdit:s}=this.options;return{type:h,height:40,cls:"right-title",items:[{type:o,cls:"right-title-text",text:`数据连接(${e.text?e.text:"默认"})`},{type:r,cls:"right-title-button",invisible:s,text:"编辑",handler(){i.store.setEdit(!0)}},{type:r,cls:"right-title-button",invisible:!s,text:"保存",handler(){BI.find(t,(e,t)=>i.model.linkUpdate.connectionName===t.connectionName&&t.connectionId!==i.model.linkUpdate.connectionId)?i.store.setConnectionNameErr("数据连接名已存在"):i.store.saveLink()}},{type:r,cls:"right-title-button",invisible:!s,level:"ignore",text:"取消",handler(){i.store.setCancel()}}]}}};BI.shortcut("fr.component.right.title",BI.inherit(BI.Widget,R));const G="fr.shared.component.both.side",W={render(){const{leftText:e,rightText:t}=this.options;return{type:a,cls:"both-side",height:24,items:[{el:{type:o,cls:"left",textAlign:"left",text:e},width:115},{type:o,textAlign:"left",text:t}]}}};BI.shortcut(G,BI.inherit(BI.Widget,W));var F=G;const $={render(){const{text:e}=this.options;return{type:o,cls:"shared-component-title",textAlign:"left",text:e}}};BI.shortcut("fr.shared.component.title",BI.inherit(BI.Widget,$));const Q={_store:()=>BI.Models.getModel(j),render(){const e=this.model.linkSelected;return{type:d,cls:"right-show",items:[{type:F,leftText:"数据连接名",rightText:e.connectionName},{type:F,leftText:"驱动器",rightText:e.driver},{type:F,leftText:"URL",rightText:e.url},{type:F,leftText:"编码",rightText:""===e.originalCharsetName?"自动":e.originalCharsetName},{type:F,leftText:"用户名",rightText:e.user},{type:F,leftText:"密码",rightText:e.password},{type:"fr.shared.component.title",text:"连接池属性"},{type:F,leftText:"SQL验证查询",rightText:e.validationQuery},{type:F,leftText:"获取连接前校验",rightText:e.testOnBorrow?"是":"否"},{type:F,leftText:"最大连接数量",rightText:e.maxActive}]}}};BI.shortcut("fr.component.right.show",BI.inherit(BI.Widget,Q));BI.constant("bi.constant.database.conf.charset.list",[{text:"自动",value:""},{text:"GBK",value:"GBK"},{text:"BIG5",value:"BIG5"},{text:"ISO-8859-1",value:"ISO-8859-1"},{text:"UTF-8",value:"UTF-8"},{text:"UTF-16",value:"UTF-16"},{text:"EUC_JP",value:"EUC_JP"},{text:"EUC_KR",value:"EUC_KR"},{text:"CP850",value:"CP850"}]);const z={render(){const{text:e,form:t,hint:i,height:s}=this.options;return{type:a,cls:"both-side",height:s||24,items:[{el:{type:o,cls:"left",textAlign:"left",text:e},width:115},t,{type:o,cls:"hint",textAlign:"left",text:i}]}}};BI.shortcut("fr.shared.component.form.item",BI.inherit(BI.Widget,z));var K="fr.shared.component.form.item";function X(e){const t=[];return e.drivers&&e.drivers.length>0?e.drivers.forEach(e=>{t.push({text:e,value:e})}):t.push({text:e.driver,value:e.driver}),t}let Y=null;const J={_store:()=>BI.Models.getModel(j),watch:{connectionNameErr(e){e?BI.Bubbles.show("singleBubble",e,Y,{level:"error"}):BI.Bubbles.hide("singleBubble")}},render(){const e=this.model.linkSelected,t=this;return{type:d,cls:"right-show",items:[{type:K,text:"数据连接名",hint:"*修改数据连接名会影响相关数据表和仪表板",form:{type:n,cls:"bi-border",width:300,value:e.connectionName,ref(e){Y=e},listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{connectionName:this.getValue()}))}},{eventName:BI.Editor.EVENT_FOCUS,action(){t.store.setConnectionNameErr("")}}]}},{type:K,text:"第一步",height:400,form:{type:d,cls:"right-form",items:[{type:K,text:"驱动器",form:{type:"bi.text_value_combo",cls:"bi-border",width:300,text:e.driver,items:X(e),listeners:[{eventName:BI.TextValueCombo.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{driver:this.getValue()[0]}))}}]}},{type:K,text:"URL",form:{type:n,cls:"bi-border",watermark:"请输入",width:300,value:e.url,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{url:this.getValue()}))}}]}},{type:K,text:"编码",form:{type:"bi.text_value_combo",cls:"bi-border",width:300,text:""===e.originalCharsetName?"自动":e.originalCharsetName,items:BI.Constants.getConstant("bi.constant.database.conf.charset.list"),listeners:[{eventName:BI.TextValueCombo.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{originalCharsetName:this.getValue()[0]}))}}]}},{type:K,text:"用户名",form:{type:n,cls:"bi-border",allowBlank:!0,watermark:"请输入",width:300,value:e.user,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{user:this.getValue()}))}}]}},{type:K,text:"密码",form:{type:n,cls:"bi-border",inputType:"password",allowBlank:!0,watermark:"请输入",width:300,value:e.password,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{password:this.getValue()}))}}]}},{type:"fr.shared.component.title",text:"连接池属性"},{type:K,text:"SQL验证查询",height:100,form:{type:"bi.textarea_editor",cls:"bi-border",allowBlank:!0,watermark:"请输入",width:300,height:100,value:e.validationQuery,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{validationQuery:this.getValue()}))}}]}},{type:K,text:"获取连接前校验",form:{type:"bi.multi_select_item",text:"是",selected:e.testOnBorrow,width:60,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{testOnBorrow:this.isSelected()}))}}]}},{type:K,text:"最大活动连接数",form:{type:n,cls:"bi-border",allowBlank:!0,watermark:"请输入",width:60,value:e.maxActive,errorText:"请输入有效的正整数",validationChecker:e=>!!/^\+?[1-9][0-9]*$/.test(e),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{maxActive:this.getValue()}))}}]}}]}},{type:K,text:"第二步",form:{type:r,text:"测试连接",level:"ignore"}},{type:K,text:"第三步",form:{type:K,text:"模式",form:{type:n,cls:"bi-border",width:300,disabled:!0}}}]}}};BI.shortcut("fr.component.right.edit",BI.inherit(BI.Widget,J));const Z={_store:()=>BI.Models.getModel(j),render(){const e=this.model.linkSelected,t=this;return{type:d,cls:"right-show",items:[{type:K,text:"数据连接名",hint:"*修改数据连接名会影响相关数据表和仪表板",form:{type:n,cls:"bi-border",width:300,value:e.connectionName,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{connectionName:this.getValue()}))}}]}},{type:K,text:"驱动器",form:{type:"bi.text_value_combo",cls:"bi-border",width:300,text:e.driver,items:X(e),listeners:[{eventName:BI.TextValueCombo.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{driver:this.getValue()[0]}))}}]}},{type:K,text:"URL",form:{type:n,cls:"bi-border",watermark:"请输入",width:300,value:e.url,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{url:this.getValue()}))}}]}},{type:K,text:"编码",form:{type:"bi.text_value_combo",cls:"bi-border",width:300,text:""===e.originalCharsetName?"自动":e.originalCharsetName,items:BI.Constants.getConstant("bi.constant.database.conf.charset.list"),listeners:[{eventName:BI.TextValueCombo.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{originalCharsetName:this.getValue()[0]}))}}]}},{type:K,text:"用户名",form:{type:n,cls:"bi-border",allowBlank:!0,watermark:"请输入",width:300,value:e.user,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{user:this.getValue()}))}}]}},{type:K,text:"密码",form:{type:n,cls:"bi-border",inputType:"password",allowBlank:!0,watermark:"请输入",width:300,value:e.password,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{password:this.getValue()}))}}]}},{type:"fr.shared.component.title",text:"连接池属性"},{type:K,text:"SQL验证查询",height:100,form:{type:"bi.textarea_editor",cls:"bi-border",allowBlank:!0,watermark:"请输入",width:300,height:100,value:e.validationQuery,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{validationQuery:this.getValue()}))}}]}},{type:K,text:"获取连接前校验",form:{type:"bi.multi_select_item",text:"是",selected:e.testOnBorrow,width:60,listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{testOnBorrow:this.isSelected()}))}}]}},{type:K,text:"最大活动连接数",form:{type:n,cls:"bi-border",allowBlank:!0,watermark:"请输入",width:60,value:e.maxActive,errorText:"请输入有效的正整数",validationChecker:e=>!!/^\+?[1-9][0-9]*$/.test(e),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action(){t.store.setLinkUpdate(Object.assign({},t.model.linkUpdate,{maxActive:this.getValue()}))}}]}},{type:K,text:"测试连接",form:{type:r,text:"测试连接",level:"ignore"}}]}}};BI.shortcut("fr.component.right.edit.mysql",BI.inherit(BI.Widget,Z));let ee=null;const te=e=>{const t=BI.Constants.getConstant(E),i=BI.some(t,(t,i)=>i===e.text);let s="mysql"===e.databaseType?"fr.component.right.edit.mysql":"fr.component.right.edit";i&&(s=BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${e.text.toLowerCase()}.edit`));const o=i?BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${e.text.toLowerCase()}.preview`):"fr.component.right.show";ee.populate(BI.createItems([{type:"fr.component.right.title",isEdit:e.isSelected,linkSelected:e},{type:e.isSelected?s:o,linkSelected:e}]))},ie={_store:()=>BI.Models.getModel(j),watch:{linkSelected(e){te(e)}},render:()=>({type:d,cls:"right-content",ref(e){ee=e}}),mounted(){const e=this.model.linkSelected;te(e)}};BI.shortcut("fr.component.right.detail",BI.inherit(BI.Widget,ie));let se=null;const oe={_store:()=>BI.Models.getModel(j),watch:{linkSelected(e){se.populate(BI.createItems([{type:e&&e.connectionName?"fr.component.right.detail":"fr.component.right.nothing"}]))}},render:()=>({type:d,cls:"database-right",ref(e){se=e}}),mounted(){se.populate(BI.createItems([{type:"fr.component.right.nothing"}]))}};BI.shortcut("fr.component.right",BI.inherit(BI.Widget,oe));const re={_store:()=>BI.Models.getModel(j),watch:{tab(e){this.setVisible("数据连接管理"===e)}},render:()=>({type:a,cls:"linkset",items:[{el:{type:l,cls:"database-left",items:[{el:{type:h,cls:"select-group",items:[{type:"fr.linkset.select"}]},height:40},{type:"fr.component.linkset.left",cls:"left-list"}]},width:280},{type:"fr.component.right"}]})};BI.shortcut("fr.linkset",BI.inherit(BI.Widget,re));BI.model("fr.model.linkstatus",BI.inherit(Fix.Model,{context:["tab","linkList"],actions:{}}));const ne={context:["tab","linkList","statusSelected"],state:()=>({selected:""}),actions:{setStatusSelected(e){this.model.statusSelected=e}}};BI.model("fr.model.linkstatus.left",BI.inherit(Fix.Model,ne));const le={props:{title:"",id:"",creator:""},_store:()=>BI.Models.getModel("fr.model.linkstatus.left"),render(){const{title:e,extraCls:t,creator:i,text:s,id:r}=this.options;return{type:h,cls:"left-item",extraCls:t,items:[{type:o,cls:"link-title",textAlign:"left",text:e,title:e}]}},mounted(){const{title:e}=this.options;this.element.on("click",()=>{this.store.setStatusSelected(e)})}};BI.shortcut("fr.component.linkStatus.left.item",BI.inherit(BI.Widget,le));let ae=null;const ce={_store:()=>BI.Models.getModel("fr.model.linkstatus.left"),watch:{linkList(e){const t=e.length>0?e[0].connectionName:"";this.store.setStatusSelected(t)},statusSelected(e){const t=this.model.linkList;ae.populate(BI.createItems(((e,t="")=>{const i=[];return e.forEach(e=>{i.push({type:"fr.component.linkStatus.left.item",extraCls:e.connectionName===t?"left-item-selected":"",title:e.connectionName,id:e.connectionId,creator:e.creator,text:e.text?e.text:"默认"})}),i})(t,e)))}},render:()=>({type:d,ref(e){ae=e}})};BI.shortcut("fr.component.linkStatus.left",BI.inherit(BI.Widget,ce));const de={context:["linkList","statusSelected"],state:()=>({selected:""}),actions:{}};BI.model("fr.model.linkstatus.right",BI.inherit(Fix.Model,de));const he={render(){const{maxActive:e,maxIdle:t,numActive:i,numIdle:s}=this.options;return{type:h,items:[{type:h,cls:"right-status-item",items:[{type:d,cls:"right-status-board",items:[{type:d,cls:"right-status-board-item",items:[{type:o,cls:"right-status-text",extraCls:"card-font1",text:i},{type:o,cls:"right-status-text",text:"/"},{type:o,cls:"right-status-text",text:e}]},{type:o,height:20,text:"活动连接数"}]}]},{type:h,cls:"right-status-right",items:[{type:d,cls:"right-status-board",items:[{type:d,cls:"right-status-board-item",items:[{type:o,cls:"right-status-text",extraCls:"card-font2",text:s},{type:o,cls:"right-status-text",text:"/"},{type:o,cls:"right-status-text",text:t}]},{type:o,height:20,text:"空闲连接数"}]}]}]}}};BI.shortcut("fr.component.linkStatus.right.card",BI.inherit(BI.Widget,he));let pe=null,me=null;const be={_store:()=>BI.Models.getModel("fr.model.linkstatus.right"),watch:{statusSelected(e){const t=BI.find(this.model.linkList,(t,i)=>i.connectionName===e),i=BI.Constants.getConstant(E),s=t.text&&BI.some(i,(e,i)=>i===t.text)?BI.Constants.getConstant(`dec.constant.database.conf.connect.form.${t.text.toLowerCase()}.pool`):"fr.component.linkStatus.right.card";!function(e,t){console.log("%cname: ","color: MidnightBlue; background: Aquamarine;",e),f?f.reqDeleta(`/v10/config/connection/pool/info?connectionName=${e}`,e=>{t(e.data)}):t({maxActive:50,maxIdle:10,numActive:0,numIdle:0})}(name,e=>{me.populate(BI.createItems([Object.assign({type:s},e)]))}),pe.setText(`数据连接(${e})`)}},render:()=>({type:d,cls:"database-right",items:[{type:h,height:40,cls:"right-status-title",items:[{type:o,text:"数据连接"}],ref(e){pe=e}},{type:d,cls:"right-status-body",ref(e){me=e}}]}),mounted(){}};BI.shortcut("fr.component.linkStatus.right",BI.inherit(BI.Widget,be));const ue={_store:()=>BI.Models.getModel("fr.model.linkstatus"),watch:{tab(e){this.setVisible("连接池状态"===e)}},render:()=>({type:a,cls:"linkStatus",items:[{el:{type:l,cls:"database-left",items:[{el:{type:h,cls:"select-group",items:[{type:o,cls:"status-title",text:"数据连接"}]},height:40},{type:"fr.component.linkStatus.left",cls:"left-list"}]},width:280},{type:"fr.component.linkStatus.right"}]}),mounted(){this.setVisible(!1)}};BI.shortcut("fr.linkstatus",BI.inherit(BI.Widget,ue));i(1);const ge={url:"192.168.1.22",port:6379,password:"123456"},ye=BI.inherit(BI.Widget,{render:()=>({type:"bi.vertical",cls:"bi-plugin-redis",bgap:10,items:[{type:"bi.left",height:30,items:[{type:"bi.label",text:"数据库地址:",height:24,width:115,textAlign:"left"},{type:"bi.editor",cls:"bi-border",watermark:"数据库地址",value:ge.url,allowBlank:!0,width:300,height:24}]},{type:"bi.left",height:30,items:[{type:"bi.label",text:"端口:",height:24,width:115,textAlign:"left"},{type:"bi.editor",cls:"bi-border",watermark:"端口",allowBlank:!0,width:300,height:24,value:ge.port,errorText:"请输入有效的正整数",validationChecker:e=>!!/^\+?[1-9][0-9]*$/.test(e)}]},{type:"bi.left",height:30,items:[{type:"bi.label",text:"密码:",height:24,width:115,textAlign:"left"},{type:"bi.editor",cls:"bi-border",inputType:"password",value:ge.password,allowBlank:!0,width:300,height:24}]}]})});BI.shortcut("fr.plugin.redis.edit",ye);BI.config("dec.constant.database.conf.connect.list",e=>[...e,"Redis"]),BI.constant("dec.constant.database.conf.connect.form.redis.value",ge),BI.constant("dec.constant.database.conf.connect.form.redis.edit","fr.plugin.redis.edit");i(2),i(3),i(4);const fe=BI.inherit(BI.Widget,{_store:()=>BI.Models.getModel("fr.model.main"),render:()=>({type:l,cls:"database-connection-layout",items:[{el:{type:"fr.title"},height:40},{type:"fr.linkset"},{type:"fr.linkstatus"}]}),mounted(){var e;e=(e=>{this.store.setLinkList(e)}),f?f.reqGet("/v10/config/connection/list","getInstalledPlugins",t=>{e(t.data)}):e(y.data)}});BI.shortcut("fr.main",fe);t.default="fr.main"}]);
//# sourceMappingURL=index.js.map