@wdslib/go-utils 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/types/ConfigOptimizer/index.d.ts +202 -0
- package/dist/types/common/component.d.ts +11 -0
- package/dist/types/common/index.d.ts +4 -0
- package/dist/types/common/type.d.ts +138 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/theme/index.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"axios";import t,{uniq as r}from"lodash";import i from"crypto-js";function o(e,t,r,i){return new(r||(r=Promise))((function(o,a){function n(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(n,s)}l((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const a=5e3,n=5e3,s=(t="",r)=>{let i=e.create({baseURL:t,timeout:a,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}});return i.interceptors.request.use((function(e){return sessionStorage.getItem("anov-go-token")&&"null"!=sessionStorage.getItem("anov-go-token")&&(e.headers["X-ANOV-ACCESS-TOKEN"]=sessionStorage.getItem("anov-go-token")),sessionStorage.getItem("unify-access-token")&&"null"!=sessionStorage.getItem("unify-access-token")&&(e.headers["X-UNIFY-ACCESS-TOKEN"]=sessionStorage.getItem("unify-access-token")),sessionStorage.getItem("dgcc_authorization")&&"null"!=sessionStorage.getItem("dgcc_authorization")&&(e.headers.dgcc_authorization=sessionStorage.getItem("dgcc_authorization")),"post"===e.method?(e.headers["Content-Type"]="application/json;",e):"get"===e.method?e:"put"===e.method?(e.headers["Content-Type"]="application/json; charset=UTF-8",e):"delete"===e.method?e:void 0}),(function(e){return Promise.reject(e)})),i.interceptors.response.use((function(e){return 200===e.status||e.data.code,r&&r(e),e.data}),(function(e){return r&&r(null==e?void 0:e.response),Promise.reject(e.response)})),i};function l(e,t=!1){return t?d(e)?e:JSON.stringify(e):d(e)?JSON.parse(e):e}const d=e=>{if("string"==typeof e)try{const t=JSON.parse(e);return"object"==typeof t&&null!==t}catch(e){return!1}return!1},c=(e,t)=>{try{const r=JSON.stringify(t);sessionStorage.setItem(e,r)}catch(t){console.error(`Error setting session data for key ${e}:`,t)}},u=e=>{const t=sessionStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(t){console.error(`Error parsing session data for key ${e}:`,t)}return null},h=e=>{for(const t of e)t.code&&(t.code=t.code.replace(/>/g,">").replace(/</g,"<"))},f=(e,t)=>{e instanceof Map?e.forEach((e=>{t([e])})):Array.isArray(e)&&e.forEach((e=>{t(e.children)}))},p=(e,t)=>{const r=e=>{var i,o,a;if(e)for(const n of e){const e=null===(a=null===(o=null===(i=null==n?void 0:n.tmpData)||void 0===i?void 0:i.source)||void 0===o?void 0:o.converse)||void 0===a?void 0:a.data;(null==e?void 0:e.length)&&h(e),t(n),n.children?r(n.children):n.dynamicChildren?f(n.dynamicChildren,r):n.stateChildren&&r(n.stateChildren)}};r(e)},v=(e,t,r,i)=>{const o=e.match(/({{[\w]*}})|((@)[\w]*)/gm);if(o){const e=o.map((e=>e.replace(/{{|}}|@/gm,"")));for(const o of e)if(o&&t&&!(t.findIndex((e=>e.mapField===o))<0))return r&&i&&m(i,o,r.cid),!0}return!1},m=(e,t,r)=>{if(!e)throw new Error("Share variable tree is not defined");if("string"!=typeof t)throw new Error("Variable name should be a string");if(!r)throw new Error("ID is required");Array.isArray(e[t])||(e[t]=[]),e[t].includes(r)||e[t].push(r)},g=(e,t,r)=>{var i;let o=!1;const a=null==t?void 0:t.converse;if(a&&a.use&&a.data.length)for(const t of a.data)if((null==t?void 0:t.dependVars)&&t.dependVars.includes(e))return!0;const n=null==t?void 0:t[null==t?void 0:t.type];return((null==n?void 0:n.inputSql)||(null==n?void 0:n.url)||(null==n?void 0:n.headers)||(null==n?void 0:n.params))&&(o=v(n.inputSql||n.url||(null===(i=n.headers)||void 0===i?void 0:i.value)||n.params,r)),o},y=(e,r,i=!1)=>{let o=null;const a=e=>{for(const n of e){if(n.cid===r){o=n,i&&t.remove(e,(e=>e.cid===r));break}if(n.children&&a(n.children),n.dynamicChildren&&Array.isArray(n.dynamicChildren))for(const[,e]of Array.from(n.dynamicChildren))a(e);n.stateChildren&&a(n.stateChildren)}};return a(e),o},b=(e,r,i)=>{let o=!1;const a=e=>{for(let n=0;n<e.length;n++){if(e[n].cid==r){o=e[n],i&&t.remove(e,(e=>e.cid==r));break}if(e[n].children)a(e[n].children);else if(e[n].dynamicChildren){if(e[n].dynamicChildren instanceof Map){let t=Array.from(e[n].dynamicChildren);for(let e=0;e<t.length;e++)if(t[e]instanceof Array){let r=t[e][1];a(r)}}else if(e[n].dynamicChildren instanceof Array){let t=e[n].dynamicChildren;for(let e=0;e<t.length;e++)if(t[e]instanceof Array){let r=t[e][1];a(r)}}}else e[n].stateChildren&&a(e[n].stateChildren)}};return a(e),o||!1};function w(e,t,r){const i={};r&&r.forEach((e=>{(null==e?void 0:e.name)&&(i[e.name]=e.value||e.originvalue)}));try{return new Function("data","vars",e)(t,i)}catch(e){return console.error(e),t}}function V(e,r){let i=t.cloneDeep(r);try{return new Function("data",e)(i)}catch(e){return console.error(e),i}}const k="anov@2019:helloX",E="anov@2020:helloX";function F(e){let t=i.enc.Utf8.parse(k),r=i.enc.Utf8.parse(E);return i.AES.encrypt(e,t,{iv:r,mode:i.mode.CBC,padding:i.pad.Pkcs7}).toString()}const O=new Blob(["\nfunction proxyObj(originObj) {\n const exposeObj = new Proxy(originObj, {\n has: (target, key) => {\n if (['fetch', 'XMLHttpRequest', 'postMessage'].indexOf(key) >= 0) {\n throw new Error('Illegal operation for key'+key)\n } else {\n return target[key]\n }\n },\n })\n return exposeObj\n}\nfunction compileCode(src) {\n src = 'with (exposeObj) {'+src+'}'\n //console.log(src)\n return new Function('exposeObj', src)\n}\nfunction run(code) {\n let proxy = proxyObj({})\n let result = compileCode(code)(proxy)\n return result\n}\n\nonmessage = (e) => {\n try {\n let result = run(e.data.code)\n postMessage({\n code: 1,\n result,\n })\n } catch (err) {\n postMessage({\n code: -1,\n err,\n })\n }\n}\n"]),N=URL.createObjectURL(O);function A(e,t,r={},i="worker"){return o(this,void 0,void 0,(function*(){try{if("window"==i){let[i,o]=[["data"],[t]];"object"==typeof r&&Object.keys(r).forEach((e=>{i.push(e),o.push(r[e])}));const a=new Function(...i,e);return{success:!0,data:a(...o)}}{let[i,a,n]=[t,r,""];"object"==typeof i&&(i=JSON.stringify(t)),"object"==typeof r&&(a=JSON.stringify(r)),Object.keys(r).forEach((e=>n+=`${e},`));let s=`let data=eval(${i}); \n let app=${JSON.stringify({})};`;s+=n?`let {${n}} = eval(${a}); `:"",s+=`${e}`;let l=yield function(e,t=5e3){return o(this,void 0,void 0,(function*(){let r=new Worker(N);return new Promise(((i,o)=>{const a=()=>{clearTimeout(s),r.removeEventListener("message",n),r.terminate(),r=null},n=e=>{let{code:t,result:r,err:n}=e.data;a(),1===t?i(r):o(n)};r.postMessage({code:e}),r.addEventListener("message",n);let s=setTimeout((()=>{a(),o("timeout")}),t)}))}))}(s);return{success:!0,data:l}}}catch(e){return{success:!1,error:e,data:t}}}))}var D,T,C,S;!function(e){e.StaticFile="staticFile",e.DataSource="datasource"}(D||(D={})),function(e){e.json="application/json;charset=UTF-8",e.form="application/x-www-form-urlencoded; charset=UTF-8"}(T||(T={})),function(e){e.get="GET",e.post="POST",e.put="PUT",e.patch="PATCH",e.delete="DELETE"}(C||(C={}));class I{constructor(e){this.db=null,this.dbName=e.databaseName,this.tableName=e.tableName,this.keyPath=e.keyPath}static getInstance(e){return I.instance||(I.instance=new I(e)),I.instance}init(){return o(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{const r=indexedDB.open(this.dbName,1);r.onerror=e=>{t(e.target.error)},r.onupgradeneeded=e=>{this.db=e.target.result,this.db.objectStoreNames.contains(this.tableName)||this.db.createObjectStore(this.tableName,{keyPath:this.keyPath})},r.onsuccess=t=>{this.db=t.target.result,e()}}))}))}addRecord(e){return o(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,r)=>{const i=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).add(e);i.onsuccess=()=>{t()},i.onerror=e=>{r(e.target.error)}}))}))}deleteRecord(e){return o(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,r)=>{const i=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);i.onsuccess=()=>{t()},i.onerror=e=>{r(e.target.error)}}))}))}updateRecord(e){return o(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,r)=>{const i=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(e);i.onsuccess=()=>{t()},i.onerror=e=>{r(e.target.error)}}))}))}getRecord(e){return o(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,r)=>{const i=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);i.onsuccess=()=>{t(i.result)},i.onerror=e=>{r(e.target.error)}}))}))}getAllRecords(){return o(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((e,t)=>{const r=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAll();r.onsuccess=()=>{e(r.result)},r.onerror=e=>{t(e.target.error)}}))}))}}I.instance=null,function(e){e[e.FATAL=0]="FATAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e[e.TRACE=5]="TRACE"}(S||(S={}));const j={databaseName:"GODB",tableName:"go-log",keyPath:"time"};class P{constructor(){this.logLevel=S.INFO,this.indexedDBInstance=I.getInstance(j);try{this.indexedDBInstance.init(),console.log("IndexedDB 初始化成功。")}catch(e){console.error("初始化 IndexedDB 时出错:",e)}}static getInstance(){return P.instance||(P.instance=new P),P.instance}setLogLevel(e){this.logLevel=e}getColor(e){switch(e){case S.FATAL:return"[31;1m";case S.ERROR:return"[31m";case S.WARN:return"[33m";case S.INFO:return"[32m";case S.DEBUG:return"[36m";case S.TRACE:return"[34m";default:return"[0m"}}log(e,t){if(t<=this.logLevel){const r=(new Date).toISOString(),i=`[${r}] [${S[t]}]`,o=this.getColor(t);if(null===window||void 0===window?void 0:window.goDev)console.log(`${o}${i} ${e}[0m`);else{let t=u("anov-go-userInfo"),a=u("anov-go-proid"),n=` [操作人:${null==t?void 0:t.userName} 项目ID:${a}] `;const s={time:r,value:`${e}`};try{this.indexedDBInstance.addRecord(s)}catch(e){console.error("添加记录时出错:",e)}console.log(`${o}${i} ${n} ${e}[0m`)}}}fatal(e){this.log(e,S.FATAL)}error(e){this.log(e,S.ERROR)}warn(e){this.log(e,S.WARN)}info(e){this.log(e,S.INFO)}debug(e){this.log(e,S.DEBUG)}trace(e){this.log(e,S.TRACE)}}const U=P.getInstance(),x=(e,t)=>"string"!=typeof e?Promise.reject(new Error("URL should be a string")):s(e,t),$=s();let R=s();function q(e,r="get",i={},a={}){return o(this,void 0,void 0,(function*(){try{const s={method:C[r],url:e,headers:a,timeout:n};["post","put"].includes(r.toLowerCase())?s.data=t.cloneDeep(i):s.params=t.cloneDeep(i);return/.json$/.test(e)?function(e){return o(this,void 0,void 0,(function*(){try{return(yield $({method:"get",url:e})).data}catch(e){throw console.error("JSON 数据请求:",e),e}}))}(e):function(e){return o(this,void 0,void 0,(function*(){try{return{code:2e4,data:(yield $(e)).data}}catch(e){throw console.error("请求数据发生错误-Error:",e),e}}))}(s)}catch(e){throw console.error("获取数据:Error:",e),e}}))}function L(e,t,r,i){return o(this,void 0,void 0,(function*(){try{const o=window.anUrl||"",a=o+(window.agentPath||"/ds/v1/api-proxy/v1/query"),n=l(r,!0);return yield $({url:a,method:"post",headers:{"Content-Type":"application/json;charset=UTF-8"},data:{body:"post"===e?n:void 0,headers:d(i)?JSON.parse(i):i,method:e,url:t}})}catch(e){throw console.error("代理请求数据:Error:",e),e}}))}function G(e,t,r,i,a){return o(this,void 0,void 0,(function*(){return a?L(t,e,r,i):q(e,t,r,i)}))}function B(e,t="",r){var i,o,n,s;const l=`${null!==(o=null===(i=null===window||void 0===window?void 0:window.BaseUrl)||void 0===i?void 0:i.replace("/management",""))&&void 0!==o?o:""}/ds/data-engine/v1/${e}/zb-query?${`token=${(null===(n=Z("YZH_EXCHANGE_TOKEN"))||void 0===n?void 0:n.YZH_EXCHANGE_TOKEN)||(null===(s=null===window||void 0===window?void 0:window.yzhAuth)||void 0===s?void 0:s.getToken())}&passid=${null===window||void 0===window?void 0:window.gdPassid}`}${(null===window||void 0===window?void 0:window.BASE_RELEASE)?"&preview=1":""}`;let d={};try{d=t?JSON.parse(t):{}}catch(e){d=t||{}}return $({method:"POST",url:l,data:{headers:r,param:d},timeout:a})}const J=(e,t)=>o(void 0,void 0,void 0,(function*(){const r=window.BaseUrl,{dateType:i="",endPeriod:o="",metricsName:n=e,startPeriod:s=""}=t;return R({method:"GET",url:`${r}ds/v1/metrics/v1/data-alarm?dateType=${i}&endPeriod=${o}&metricsName=${n}&startPeriod=${s}`,timeout:a})})),z=(e,t,r)=>o(void 0,void 0,void 0,(function*(){var i;const o=(null===(i=window.BaseUrl)||void 0===i?void 0:i.replace("/management",""))||"";t.newEncryption=!0;const n={staticFile:{method:"get",params:t,url:`${o}/ds/v1/file/v1/${e}/query`},datasource:{method:"post",url:`${o}/ds/v1/database/v1/${e}/query`,data:Object.assign({},t)}}[r];if(!n)throw new Error("Invalid data type provided");return $(Object.assign({timeout:a},n))})),M=e=>new Promise(((t,r)=>{let i;i=e.originData&&Object.keys(e.originData).length?e.originData:e.data,void 0!==i?t({data:i}):r("Failed to retrieve cdata")})),_=(e,t,r)=>{try{switch(t){case"api":{let t=te(e,r);return{requestType:t.requestType,url:t.url,params:t.params,headers:t.headers,agency:t.agency}}case"static":return{data:e};case"datasource":{const t=ee(e.inputSql,r);return{dsName:e.dsName,dsType:"1",sql:F(t),filter:e.sqlFilter}}case"staticFile":return{dsName:e.dsName,dsType:e.dsType,sql:""};case"indicator":return{zbId:e.zbId,params:e.params,headers:e.headers};case"indicatorCQ":return{zbName:e.zbName,params:e.params};case"packData":return{};default:throw new Error("Invalid type")}}catch(t){console.log("准备请求数据发生错误",t,e)}},W=(e,t)=>o(void 0,void 0,void 0,(function*(){try{switch(t){case"api":return yield G(e.url,e.requestType,e.params,e.headers,e.agency);case"static":return yield M(e.data);case"datasource":return yield z(e.dsName,{dsType:e.dsType,sql:e.sql,filter:e.filter},"datasource");case"staticFile":return yield z(e.dsName,{dsType:e.dsType,sql:e.sql},"staticFile");case"indicator":return yield B(e.zbId,e.params,e.headers);case"indicatorCQ":return yield J(e.zbName,e.params);case"packData":return{};default:throw new Error("Invalid type")}}catch(e){return console.warn(e,"执行请求并获取数据发生错误"),yield new Promise(((e,t)=>{e({error:!0})}))}})),X=(e,t,r,i=[],a=!1)=>o(void 0,void 0,void 0,(function*(){const o=t||e.tmpData.source.dataType,n=e.tmpData.source["indicatorCQ"==o?"indicator":o];if("globalData"===o){const e=i.find((e=>e.key===n.id||e.key===n.key)),t=u(n.id);if(t&&!a)return t.data;if(e){let t=yield H(e,r),i={key:n.id,data:t};return c(n.id,i),t}return}const s=_(n,o,r),l=yield W(s,o);return(null==l?void 0:l.data)?l.data:l})),H=(e,t)=>o(void 0,void 0,void 0,(function*(){let r=Object.assign({},{tmpData:{source:e.value}});const i=r.tmpData.source.type,o=r.tmpData.source[i],a=_(o,i,t),n=yield W(a,i);return yield Q(n.data,r,!0,t)})),Q=(e,r,i=!0,a)=>o(void 0,void 0,void 0,(function*(){try{const{converse:n,mapFields:s}=r.tmpData.source;return n&&n.use&&i?yield new Promise(((r,i)=>{const s=function(e,r,i,a,n){return o(this,void 0,void 0,(function*(){let i,o=e,{use:n,data:s}=t.cloneDeep(r);if(n)for(let e=0;e<s.length;e++)if(s[e].use){let r=s[e].dependVars,n={};a&&n&&r&&r.length&&r.map((e=>{let r=t.cloneDeep(a).filter((t=>{let r=t.mapField==e;return r&&(n[e]=t.value),r}));r&&0!=r.length||(n[e]="")})),i=yield A(s[e].code,o,n,s[e].mode?s[e].mode:"worker"),o=i.data}return o}))}(e,n,0,a);r(s)})):yield new Promise(((t,r)=>{t(e)}))}catch(t){return console.error("执行过滤器发生错误:"+t),yield new Promise(((t,r)=>{t(e)}))}})),K=(e,t,r)=>{const{source:i}=e.tmpData,o=i.type;r?("static"===o&&i[o]&&(i[o].originData=r),"indicatorCQ"===o?i.indicator.data=t:i[o].data=t):"indicatorCQ"===o?i.indicator.data=t:i[o].data=t,e.source=t},Y=(e,t,r=[],i,a,n)=>o(void 0,void 0,void 0,(function*(){try{let o=e.tmpData.source.type,s=yield X(e,o,r,i,n||!1);if(null==s||!s)return a&&a({error:!0}),Promise.resolve({error:!0});let l=yield Q(s,e,t,r);return K(e,l),a&&a(l),Promise.resolve(l)}catch(e){return a&&a(e),U.error("Error in updateComData"),console.error("Error in updateComData:",e),Promise.reject(e)}})),Z=e=>{const t={};if(e&&e.includes("?")){const r=e.split("?")[1].split("&");for(let e of r){const[r,i]=e.split("=").map(decodeURIComponent);t[r]=i}}return t},ee=(e,t)=>{if(!t)return e;if("string"==typeof e)return""===e.trim()?"":e.replace(/@(\w+)|{{(\w+)}}/g,((e,r,i)=>{const o=r||i,a=t.find((e=>e.mapField===o));return a?a.value||a.originalValue||"":e}));if(Array.isArray(e))return e.map((e=>ee(e,t)));if("object"==typeof e&&null!==e){const r={};for(let i in e)r[i]=ee(e[i],t);return r}return e},te=(e,t)=>{const r=e.agency,i=e,{url:o=null,headers:a,params:n,requestType:s}=i,l=o?ee(o,t):void 0,d=a&&a.use?ee(a.value,t):{};return{url:l,requestType:s,params:n?ee(n,t):{},headers:d,agency:r}},re=(e,t,r,i,a)=>o(void 0,void 0,void 0,(function*(){if(e&&e.length)for(const o of e){g(t,o.value,r)&&(yield Y({tmpData:{source:{type:"globalData",globalData:{id:o.key}}}},!0,r,e,(e=>{console.log("数据更新成功-变量改变全局数据跟新")}),!0),p(i,(t=>{var i,n,s;if("globalData"===(null===(n=null===(i=null==t?void 0:t.tmpData)||void 0===i?void 0:i.source)||void 0===n?void 0:n.type)){(null===(s=null==t?void 0:t.tmpData)||void 0===s?void 0:s.source.globalData).id===o.key&&Y(t,!0,r,e,(e=>{a(t,e)}),!1)}})))}})),ie=(e,t,r,i,a)=>o(void 0,void 0,void 0,(function*(){e&&(yield Y({tmpData:{source:{type:"globalData",globalData:{id:e.key}}}},!0,t,r,(e=>{console.log("数据更新成功-数据源编辑")}),!0),p(i,(i=>{var o,n,s;if("globalData"===(null===(n=null===(o=null==i?void 0:i.tmpData)||void 0===o?void 0:o.source)||void 0===n?void 0:n.type)){(null===(s=null==i?void 0:i.tmpData)||void 0===s?void 0:s.source.globalData).id===e.key&&Y(i,!0,t,r,(e=>{a(i,e)}),!1)}})))}));class oe{constructor(e,t){this.isUpdating=!1,this.des=e.des,this.field=e.field,this.id=e.id,this.key=e.key,this.mapping=e.mapping,this.mapField=e.mapField,this.type=e.type,this.originalValue=e.originalValue,this.model=(null==e?void 0:e.model)?null==e?void 0:e.model:1,this.converter=e.converter,this.converterCode=e.converterCode,this.fork=e.fork,this.delayUpdate=!!(null==e?void 0:e.delayUpdate),t&&(this.globalVariables=t),e.fork&&(this.model=5,this.forkValue=e.forkValue,this.originalValue=this.getForkedValue())}get value(){return this.fork&&(this.originalValue=this.getForkedValue()),this.converter&&this.converterCode?V(this.converterCode,this.originalValue):this.originalValue}getForkedValue(){if(this.forkValue&&Array.isArray(this.forkValue))return this.forkValue.map((e=>{const t=this.globalVariables.get(e);return t?t.value:null}));if(this.forkValue){const e=this.globalVariables.get(this.forkValue);return e?e.value:null}return null}updateValue(e,t){var i;const o=Object.assign({},this,e);this.des=o.des,this.field=o.field,this.mapping=o.mapping,this.type=o.type,this.originalValue=o.originalValue,this.converter=o.converter,this.converterCode=o.converterCode,this.fork=o.fork,this.delayUpdate=null==o?void 0:o.delayUpdate,this.model=null==o?void 0:o.model,e.id&&(this.id?"string"==typeof this.id?e.id instanceof Array?this.id=r([this.id,...e.id]):this.id=[this.id,e.id]:this.id instanceof Array&&(e.id instanceof Array?this.id=r([...this.id,...e.id]):this.id=r([...this.id,e.id])):this.id=e.id),e.fork&&(this.model=5,this.forkValue=null!==(i=e.forkValue)&&void 0!==i?i:this.forkValue,this.originalValue=this.getForkedValue()),t&&t(this)}updateWidthOriginalValue(e,t){var r;this.originalValue=e,this.fork&&(this.forkValue=null!==(r=this.forkValue)&&void 0!==r?r:this.forkValue,this.originalValue=this.getForkedValue()),t&&t(this)}renew(e){e&&e(this)}static create(e,t){return new oe(e,t)}}class ae{constructor(){this.variables=new Map,this.globalObservers=[],this.url=window.location.search,this.list=[]}clearVars(){this.list=[],this.variables.clear()}static getInstance(){return ae.instance||(ae.instance=new ae),ae.instance}getFullUrl(){this.url=window.location.search}getAllUrlParams(){const e=new URLSearchParams(window.location.search),t={};for(const[r,i]of e.entries())t[r]=i;return t}addUrlParamsToGlobalVars(){this.getFullUrl();let e=this.getAllUrlParams(),t=Object.keys(e),r=[];for(const i of t)r.push({mapField:i,originalValue:e[i],model:4});if(r.length)for(const e of r)this.addVariable(e)}addVariables(e){Array.isArray(e)?e.map(((e,t)=>{this.addVariable(e)})):this.addVariable(e),this.addUrlParamsToGlobalVars()}addVariable(e,t){if(!e||!(null==e?void 0:e.mapField))return console.error(e+"参数不合法!"),!1;if(this.isVariableNameExist(e.mapField)){console.warn("变量名已存在");let r=this.getVariable(e.mapField);return this.sameValue(r,e)?r:(this.editVariable(e,t),!1)}const r=oe.create(e,this.variables);return this.variables.set(r.mapField,r),this.addToObjectArray(this.list,r),t&&t(r),this.notifyGlobalObservers(r),r}toJSON(e){try{return!!e&&JSON.stringify(e)}catch(e){return!1}}sameValue(e,t){if(e.mapfield!==t.mapfield)return!1;for(const r in t)if(!(["mapfield","field","key","value","name","globalVariables"].includes(r)||r in e&&e[r]==t[r]))return!1;return!0}creatVarJson(e){const{des:t,field:r,id:i,key:o,mapping:a,mapField:n,type:s,value:l,originalValue:d,model:c,converter:u,converterCode:h,fork:f,forkValue:p,update:v,delayUpdate:m}=e,g={};return void 0!==t&&(g.des=t),void 0!==r&&(g.field=r),void 0!==i&&(g.id=i),void 0!==o&&(g.key=o),void 0!==a&&(g.mapping=a),void 0!==n&&(g.mapField=n),void 0!==s&&(g.type=s),void 0!==l&&(g.value=l),void 0!==d&&(g.originalValue=d),void 0!==c&&(g.model=c),void 0!==u&&(g.converter=u),void 0!==h&&(g.converterCode=h),void 0!==f&&(g.fork=f),void 0!==p&&(g.forkValue=p),void 0!==v&&(g.update=v),void 0!==m&&(g.delayUpdate=m),g}addToObjectArray(e,t){let r=!1;for(let i=0;i<e.length;i++)if(e[i].mapField==t.mapField){e[i]=this.creatVarJson(t),r=!0;break}r||e.push(t)}editVariable(e,t){const r=this.getVariable(e.mapField);if(r&&this.isVariableNameExist(e.mapField)){if(this.sameValue(r,e))return}const i=e=>{if(!e.isUpdating){e.isUpdating=!0,this.notifyGlobalObservers(e);const r=this.isMapFieldInForkValues(e.mapField);console.log(r,"mapFieldsmapFields"),r.forEach((e=>{let t=this.getVariable(e.mapField);t&&t.renew((e=>{this.addToObjectArray(this.list,e),this.notifyGlobalObservers(e)}))})),this.addToObjectArray(this.list,e),t&&t(e),e.isUpdating=!1}};r?r.updateValue(e,i):this.addVariable(e,i)}editVariableForValue(e,t,r){const i=this.getVariable(e),o=e=>{if(!e.isUpdating){e.isUpdating=!0,this.notifyGlobalObservers(e);this.isMapFieldInForkValues(e.mapField).forEach((e=>{let t=this.getVariable(e.mapField);t&&t.renew((e=>{this.addToObjectArray(this.list,e),this.notifyGlobalObservers(e)}))})),this.addToObjectArray(this.list,e),r&&r(e),e.isUpdating=!1}};i&&i.updateWidthOriginalValue(t,o)}isMapFieldInForkValues(e){return this.getAllVariables().filter((e=>e.fork&&e.forkValue)).filter((t=>t.forkValue==e||Array.from(t.forkValue).includes(e)))}isVariableNameExist(e){return this.variables.has(e)}checkExist(e,t){if("string"==typeof e&&this.isVariableNameExist(e)){let r=this.getVariable(e);return t==r.id&&!r.id.includes(t)&&[{key:e}]}if(Array.isArray(e)){const r=e.filter((e=>{let r=this.getVariable(e);return this.isVariableNameExist(e)&&t!=r.id&&!(r.id&&r.id.includes(t))})).map((e=>({key:e})));return!!r.length&&r}return!1}getVariable(e){return this.variables.get(e)}getVariableForId(e){var t;let r=[];for(const[,i]of this.variables)(i.id===e||(null===(t=i.id)||void 0===t?void 0:t.includes(e)))&&r.push(i);return r}getAllVariables(e=!1){return e?(this.list=Array.from(this.variables.values()),this.list):[...this.list]}restoreVariables(e){e.forEach((e=>{this.addVariable(e)}))}registerGlobalObserver(e){this.globalObservers.push(e)}notifyGlobalObservers(e){this.globalObservers.forEach((t=>{t.update(e)}))}}ae.instance=null;const ne=ae.getInstance(),se=(e,t)=>Array.isArray(t)?t.some((t=>e&&(void 0!==e[t]||e.hasOwnProperty(t)))):"string"==typeof t&&(e&&(void 0!==e[t]||e.hasOwnProperty(t))),le=(e,t,r,i)=>{const o=((e,t,r,i)=>{var o;let a;if(se(e,null==t?void 0:t.field)||se(e,null==t?void 0:t.forkValue))a=e[null==t?void 0:t.field]||"";else if(se(e.data,null==t?void 0:t.field)||se(e.data,null==t?void 0:t.forkValue))a=e.data[null==t?void 0:t.field]||"";else{const e=y(r,i),n=(null===(o=null==e?void 0:e.tmpData)||void 0===o?void 0:o.actions)||[];for(const e of n){const r=e.vars.find((e=>(null==e?void 0:e.mapField)===(null==t?void 0:t.mapField)));if(r){a=r.value;break}}}return a})(e,t,r,i);return void 0!==o?o:t.value},de=(e,t,r,i,o,a,n,s,l)=>{switch(e.type){case"link":window.open(e.link,e.target);break;case"page":l&&l(e);break;case"dynamic":((e,t,r,i,o)=>{const a=e.dynamic||[];for(const n of a){if(e.id!==t.cid)continue;const a=y(r,n.pid);a&&(a.activeDynamic=n.name,a.isShow=n.visible||!i||e.index===t.index-1,o({cid:a.cid,flag:n.visible}))}})(e,t,r,i,o);break;case"toggle":((e,t,r,i,o)=>{const a=e.children||[];for(const r of a){const a=r.visible&&(!i||e.index===t.index-1);o({cid:r.cid,flag:a})}})(e,t,0,i,o);break;case"update":((e,t,r,i,o)=>{const a=e.children||[];for(const e of a){const a=y(t,e.cid);a&&Y(a,!0,r,i,(e=>{o({cid:a.cid,data:e})}))}})(e,r,a,n,s)}},ce=(e,t,r,i,o,a,n,s,l,d)=>{const{cid:c,actions:u,index:h}=o,{eventName:f,mode:p}=u,v=2===p;((e,t,r,i,o,a)=>{let n=ne.getVariableForId(t.cid);if(null==n?void 0:n.length)for(const s of n)if(s.type==e){let e=le(t,s,r,i);ne.editVariableForValue(s.mapField,e,(()=>{const e=o[s.mapField]||[];a&&a(s,e)}))}})(f,o,i,c,r,((e,t)=>{if(re(l,e.mapFile,ne.getAllVariables(),i,((e,t)=>{n({cid:e.cid,data:t})})),null==t?void 0:t.length)for(const r of t){e.eventSourceId=r;const t=y(i,r);!(null==e?void 0:e.delayUpdate)&&t&&Y(t,!0,ne.getAllVariables(),l,(e=>{n({cid:t.cid,data:e})}))}}));const m=((e,t,r,i,o)=>e.filter((e=>e.id===t&&e.eventType===r&&(!o||parseInt(e.index||"0")+1===parseInt(i||"0")))))(e,c,f,h,v);for(const e of m)de(e,o,i,v,a,ne.getAllVariables(),l,n,s)};export{ae as GlobalVariables,x as Http,U as Log,L as agentData,K as editItem,ce as emitEvent,H as fetchDataByGlobal,X as fetchDataByType,Q as filterData,y as findItemDeep,b as findItemDeep2,q as getData,G as getDataForApi,z as getDataForSource,M as getDataForStatic,B as getDataForZb,J as getDataForZbCQ,u as getSessionData,l as getStandardData,v as getStringVars,le as getVarDefaultVal,ne as globalVars,g as hasVar,d as isJSON,p as recursion,w as safeEval,V as safeEvalForCode,c as setSessionData,re as updataGlobalDataSourceForVar,Y as updateComData,ie as updateGlobalDataSource};
|
|
1
|
+
import e from"axios";import t,{uniq as i}from"lodash";import r from"crypto-js";function o(e,t,i,r){return new(i||(i=Promise))((function(o,a){function n(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,s)}l((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const a=5e3,n=5e3,s=(t="",i)=>{let r=e.create({baseURL:t,timeout:a,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}});return r.interceptors.request.use((function(e){return sessionStorage.getItem("anov-go-token")&&"null"!=sessionStorage.getItem("anov-go-token")&&(e.headers["X-ANOV-ACCESS-TOKEN"]=sessionStorage.getItem("anov-go-token")),sessionStorage.getItem("unify-access-token")&&"null"!=sessionStorage.getItem("unify-access-token")&&(e.headers["X-UNIFY-ACCESS-TOKEN"]=sessionStorage.getItem("unify-access-token")),sessionStorage.getItem("dgcc_authorization")&&"null"!=sessionStorage.getItem("dgcc_authorization")&&(e.headers.dgcc_authorization=sessionStorage.getItem("dgcc_authorization")),"post"===e.method?(e.headers["Content-Type"]="application/json;",e):"get"===e.method?e:"put"===e.method?(e.headers["Content-Type"]="application/json; charset=UTF-8",e):"delete"===e.method?e:void 0}),(function(e){return Promise.reject(e)})),r.interceptors.response.use((function(e){return 200===e.status||e.data.code,i&&i(e),e.data}),(function(e){return i&&i(null==e?void 0:e.response),Promise.reject(e.response)})),r};function l(e,t=!1){return t?d(e)?e:JSON.stringify(e):d(e)?JSON.parse(e):e}const d=e=>{if("string"==typeof e)try{const t=JSON.parse(e);return"object"==typeof t&&null!==t}catch(e){return!1}return!1},c=(e,t)=>{try{const i=JSON.stringify(t);sessionStorage.setItem(e,i)}catch(t){console.error(`Error setting session data for key ${e}:`,t)}},u=e=>{const t=sessionStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(t){console.error(`Error parsing session data for key ${e}:`,t)}return null},h=e=>{for(const t of e)t.code&&(t.code=t.code.replace(/>/g,">").replace(/</g,"<"))},p=(e,t)=>{e instanceof Map?e.forEach((e=>{t([e])})):Array.isArray(e)&&e.forEach((e=>{t(e.children)}))},f=(e,t)=>{const i=e=>{var r,o,a;if(e)for(const n of e){const e=null===(a=null===(o=null===(r=null==n?void 0:n.tmpData)||void 0===r?void 0:r.source)||void 0===o?void 0:o.converse)||void 0===a?void 0:a.data;(null==e?void 0:e.length)&&h(e),t(n),n.children?i(n.children):n.dynamicChildren?p(n.dynamicChildren,i):n.stateChildren&&i(n.stateChildren)}};i(e)},m=(e,t,i,r)=>{const o=e.match(/({{[\w]*}})|((@)[\w]*)/gm);if(o){const e=o.map((e=>e.replace(/{{|}}|@/gm,"")));for(const o of e)if(o&&t&&!(t.findIndex((e=>e.mapField===o))<0))return i&&r&&g(r,o,i.cid),!0}return!1},g=(e,t,i)=>{if(!e)throw new Error("Share variable tree is not defined");if("string"!=typeof t)throw new Error("Variable name should be a string");if(!i)throw new Error("ID is required");Array.isArray(e[t])||(e[t]=[]),e[t].includes(i)||e[t].push(i)},v=(e,t,i)=>{var r;let o=!1;const a=null==t?void 0:t.converse;if(a&&a.use&&a.data.length)for(const t of a.data)if((null==t?void 0:t.dependVars)&&t.dependVars.includes(e))return!0;const n=null==t?void 0:t[null==t?void 0:t.type];return((null==n?void 0:n.inputSql)||(null==n?void 0:n.url)||(null==n?void 0:n.headers)||(null==n?void 0:n.params))&&(o=m(n.inputSql||n.url||(null===(r=n.headers)||void 0===r?void 0:r.value)||n.params,i)),o},b=(e,i,r=!1)=>{let o=null;const a=e=>{for(const n of e){if(n.cid===i){o=n,r&&t.remove(e,(e=>e.cid===i));break}if(n.children&&a(n.children),n.dynamicChildren&&Array.isArray(n.dynamicChildren))for(const[,e]of Array.from(n.dynamicChildren))a(e);n.stateChildren&&a(n.stateChildren)}};return a(e),o},y=(e,i,r)=>{let o=!1;const a=e=>{for(let n=0;n<e.length;n++){if(e[n].cid==i){o=e[n],r&&t.remove(e,(e=>e.cid==i));break}if(e[n].children)a(e[n].children);else if(e[n].dynamicChildren){if(e[n].dynamicChildren instanceof Map){let t=Array.from(e[n].dynamicChildren);for(let e=0;e<t.length;e++)if(t[e]instanceof Array){let i=t[e][1];a(i)}}else if(e[n].dynamicChildren instanceof Array){let t=e[n].dynamicChildren;for(let e=0;e<t.length;e++)if(t[e]instanceof Array){let i=t[e][1];a(i)}}}else e[n].stateChildren&&a(e[n].stateChildren)}};return a(e),o||!1};function w(e,t,i){const r={};i&&i.forEach((e=>{(null==e?void 0:e.name)&&(r[e.name]=e.value||e.originvalue)}));try{return new Function("data","vars",e)(t,r)}catch(e){return console.error(e),t}}function D(e,i){let r=t.cloneDeep(i);try{return new Function("data",e)(r)}catch(e){return console.error(e),r}}const N="anov@2019:helloX",C="anov@2020:helloX";function k(e){let t=r.enc.Utf8.parse(N),i=r.enc.Utf8.parse(C);return r.AES.encrypt(e,t,{iv:i,mode:r.mode.CBC,padding:r.pad.Pkcs7}).toString()}const A=new Blob(["\nfunction proxyObj(originObj) {\n const exposeObj = new Proxy(originObj, {\n has: (target, key) => {\n if (['fetch', 'XMLHttpRequest', 'postMessage'].indexOf(key) >= 0) {\n throw new Error('Illegal operation for key'+key)\n } else {\n return target[key]\n }\n },\n })\n return exposeObj\n}\nfunction compileCode(src) {\n src = 'with (exposeObj) {'+src+'}'\n //console.log(src)\n return new Function('exposeObj', src)\n}\nfunction run(code) {\n let proxy = proxyObj({})\n let result = compileCode(code)(proxy)\n return result\n}\n\nonmessage = (e) => {\n try {\n let result = run(e.data.code)\n postMessage({\n code: 1,\n result,\n })\n } catch (err) {\n postMessage({\n code: -1,\n err,\n })\n }\n}\n"]),V=URL.createObjectURL(A);function O(e,t){return o(this,arguments,void 0,(function*(e,t,i={},r="worker"){try{if("window"==r){let[r,o]=[["data"],[t]];"object"==typeof i&&Object.keys(i).forEach((e=>{r.push(e),o.push(i[e])}));const a=new Function(...r,e);return{success:!0,data:a(...o)}}{let[r,a,n]=[t,i,""];"object"==typeof r&&(r=JSON.stringify(t)),"object"==typeof i&&(a=JSON.stringify(i)),Object.keys(i).forEach((e=>n+=`${e},`));let s=`let data=eval(${r}); \n let app=${JSON.stringify({})};`;s+=n?`let {${n}} = eval(${a}); `:"",s+=`${e}`;let l=yield function(e){return o(this,arguments,void 0,(function*(e,t=5e3){let i=new Worker(V);return new Promise(((r,o)=>{const a=()=>{clearTimeout(s),i.removeEventListener("message",n),i.terminate(),i=null},n=e=>{let{code:t,result:i,err:n}=e.data;a(),1===t?r(i):o(n)};i.postMessage({code:e}),i.addEventListener("message",n);let s=setTimeout((()=>{a(),o("timeout")}),t)}))}))}(s);return{success:!0,data:l}}}catch(e){return{success:!1,error:e,data:t}}}))}var T,F,x,E;!function(e){e.StaticFile="staticFile",e.DataSource="datasource"}(T||(T={})),function(e){e.json="application/json;charset=UTF-8",e.form="application/x-www-form-urlencoded; charset=UTF-8"}(F||(F={})),function(e){e.get="GET",e.post="POST",e.put="PUT",e.patch="PATCH",e.delete="DELETE"}(x||(x={}));class S{constructor(e){this.db=null,this.dbName=e.databaseName,this.tableName=e.tableName,this.keyPath=e.keyPath}static getInstance(e){return S.instance||(S.instance=new S(e)),S.instance}init(){return o(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{const i=indexedDB.open(this.dbName,1);i.onerror=e=>{t(e.target.error)},i.onupgradeneeded=e=>{this.db=e.target.result,this.db.objectStoreNames.contains(this.tableName)||this.db.createObjectStore(this.tableName,{keyPath:this.keyPath})},i.onsuccess=t=>{this.db=t.target.result,e()}}))}))}addRecord(e){return o(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,i)=>{const r=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).add(e);r.onsuccess=()=>{t()},r.onerror=e=>{i(e.target.error)}}))}))}deleteRecord(e){return o(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,i)=>{const r=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);r.onsuccess=()=>{t()},r.onerror=e=>{i(e.target.error)}}))}))}updateRecord(e){return o(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,i)=>{const r=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(e);r.onsuccess=()=>{t()},r.onerror=e=>{i(e.target.error)}}))}))}getRecord(e){return o(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((t,i)=>{const r=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);r.onsuccess=()=>{t(r.result)},r.onerror=e=>{i(e.target.error)}}))}))}getAllRecords(){return o(this,void 0,void 0,(function*(){if(!this.db)throw new Error("数据库未初始化。");return new Promise(((e,t)=>{const i=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAll();i.onsuccess=()=>{e(i.result)},i.onerror=e=>{t(e.target.error)}}))}))}}S.instance=null,function(e){e[e.FATAL=0]="FATAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e[e.TRACE=5]="TRACE"}(E||(E={}));const j={databaseName:"GODB",tableName:"go-log",keyPath:"time"};class P{constructor(){this.logLevel=E.INFO,this.indexedDBInstance=S.getInstance(j);try{this.indexedDBInstance.init(),console.log("IndexedDB 初始化成功。")}catch(e){console.error("初始化 IndexedDB 时出错:",e)}}static getInstance(){return P.instance||(P.instance=new P),P.instance}setLogLevel(e){this.logLevel=e}getColor(e){switch(e){case E.FATAL:return"[31;1m";case E.ERROR:return"[31m";case E.WARN:return"[33m";case E.INFO:return"[32m";case E.DEBUG:return"[36m";case E.TRACE:return"[34m";default:return"[0m"}}log(e,t){if(t<=this.logLevel){const i=(new Date).toISOString(),r=`[${i}] [${E[t]}]`,o=this.getColor(t);if(null===window||void 0===window?void 0:window.goDev)console.log(`${o}${r} ${e}[0m`);else{let t=u("anov-go-userInfo"),a=u("anov-go-proid"),n=` [操作人:${null==t?void 0:t.userName} 项目ID:${a}] `;const s={time:i,value:`${e}`};try{this.indexedDBInstance.addRecord(s)}catch(e){console.error("添加记录时出错:",e)}console.log(`${o}${r} ${n} ${e}[0m`)}}}fatal(e){this.log(e,E.FATAL)}error(e){this.log(e,E.ERROR)}warn(e){this.log(e,E.WARN)}info(e){this.log(e,E.INFO)}debug(e){this.log(e,E.DEBUG)}trace(e){this.log(e,E.TRACE)}}const I=P.getInstance(),U=(e,t)=>"string"!=typeof e?Promise.reject(new Error("URL should be a string")):s(e,t),$=s();let M=s();function R(e){return o(this,arguments,void 0,(function*(e,i="get",r={},a={}){try{const s={method:x[i],url:e,headers:a,timeout:n};["post","put"].includes(i.toLowerCase())?s.data=t.cloneDeep(r):s.params=t.cloneDeep(r);return/.json$/.test(e)?function(e){return o(this,void 0,void 0,(function*(){try{return(yield $({method:"get",url:e})).data}catch(e){throw console.error("JSON 数据请求:",e),e}}))}(e):function(e){return o(this,void 0,void 0,(function*(){try{return{code:2e4,data:(yield $(e)).data}}catch(e){throw console.error("请求数据发生错误-Error:",e),e}}))}(s)}catch(e){throw console.error("获取数据:Error:",e),e}}))}function q(e,t,i,r){return o(this,void 0,void 0,(function*(){try{const o=window.anUrl||"",a=o+(window.agentPath||"/ds/v1/api-proxy/v1/query"),n=l(i,!0);return yield $({url:a,method:"post",headers:{"Content-Type":"application/json;charset=UTF-8"},data:{body:"post"===e?n:void 0,headers:d(r)?JSON.parse(r):r,method:e,url:t}})}catch(e){throw console.error("代理请求数据:Error:",e),e}}))}function G(e,t,i,r,a){return o(this,void 0,void 0,(function*(){return a?q(t,e,i,r):R(e,t,i,r)}))}function H(e,t="",i){var r,o,n,s;const l=`${null!==(o=null===(r=null===window||void 0===window?void 0:window.BaseUrl)||void 0===r?void 0:r.replace("/management",""))&&void 0!==o?o:""}/ds/data-engine/v1/${e}/zb-query?${`token=${(null===(n=Z("YZH_EXCHANGE_TOKEN"))||void 0===n?void 0:n.YZH_EXCHANGE_TOKEN)||(null===(s=null===window||void 0===window?void 0:window.yzhAuth)||void 0===s?void 0:s.getToken())}&passid=${null===window||void 0===window?void 0:window.gdPassid}`}${(null===window||void 0===window?void 0:window.BASE_RELEASE)?"&preview=1":""}`;let d={};try{d=t?JSON.parse(t):{}}catch(e){d=t||{}}return $({method:"POST",url:l,data:{headers:i,param:d},timeout:a})}const L=(e,t)=>o(void 0,void 0,void 0,(function*(){const i=window.BaseUrl,{dateType:r="",endPeriod:o="",metricsName:n=e,startPeriod:s=""}=t;return M({method:"GET",url:`${i}ds/v1/metrics/v1/data-alarm?dateType=${r}&endPeriod=${o}&metricsName=${n}&startPeriod=${s}`,timeout:a})})),z=(e,t,i)=>o(void 0,void 0,void 0,(function*(){var r;const o=(null===(r=window.BaseUrl)||void 0===r?void 0:r.replace("/management",""))||"";t.newEncryption=!0;const n={staticFile:{method:"get",params:t,url:`${o}/ds/v1/file/v1/${e}/query`},datasource:{method:"post",url:`${o}/ds/v1/database/v1/${e}/query`,data:Object.assign({},t)}}[i];if(!n)throw new Error("Invalid data type provided");return $(Object.assign({timeout:a},n))})),B=e=>new Promise(((t,i)=>{let r;r=e.originData&&Object.keys(e.originData).length?e.originData:e.data,void 0!==r?t({data:r}):i("Failed to retrieve cdata")})),J=(e,t,i)=>{try{switch(t){case"api":{let t=te(e,i);return{requestType:t.requestType,url:t.url,params:t.params,headers:t.headers,agency:t.agency}}case"static":return{data:e};case"datasource":{const t=ee(e.inputSql,i);return{dsName:e.dsName,dsType:"1",sql:k(t),filter:e.sqlFilter}}case"staticFile":return{dsName:e.dsName,dsType:e.dsType,sql:""};case"indicator":return{zbId:e.zbId,params:ee(e.params,i),headers:ee(e.headers,i)};case"indicatorCQ":return{zbName:e.zbName,params:ee(e.params,i)};case"packData":return{};default:throw new Error("Invalid type")}}catch(t){console.log("准备请求数据发生错误",t,e)}},W=(e,t)=>o(void 0,void 0,void 0,(function*(){try{switch(t){case"api":return yield G(e.url,e.requestType,e.params,e.headers,e.agency);case"static":return yield B(e.data);case"datasource":return yield z(e.dsName,{dsType:e.dsType,sql:e.sql,filter:e.filter},"datasource");case"staticFile":return yield z(e.dsName,{dsType:e.dsType,sql:e.sql},"staticFile");case"indicator":return yield H(e.zbId,e.params,e.headers);case"indicatorCQ":return yield L(e.zbName,e.params);case"packData":return{};default:throw new Error("Invalid type")}}catch(e){return console.warn(e,"执行请求并获取数据发生错误"),yield new Promise(((e,t)=>{e({error:!0})}))}})),X=(e,t,i,...r)=>o(void 0,[e,t,i,...r],void 0,(function*(e,t,i,r=[],o=!1){const a=t||e.tmpData.source.dataType,n=e.tmpData.source["indicatorCQ"==a?"indicator":a];if("globalData"===a){const e=r.find((e=>e.key===n.id||e.key===n.key)),t=u(n.id);if(t&&!o)return t.data;if(e){let t=yield _(e,i),r={key:n.id,data:t};return c(n.id,r),t}return}const s=J(n,a,i),l=yield W(s,a);return(null==l?void 0:l.data)?l.data:l})),_=(e,t)=>o(void 0,void 0,void 0,(function*(){let i=Object.assign({},{tmpData:{source:e.value}});const r=i.tmpData.source.type,o=i.tmpData.source[r],a=J(o,r,t),n=yield W(a,r);return yield Q(n.data,i,!0,t)})),Q=(e,i,...r)=>o(void 0,[e,i,...r],void 0,(function*(e,i,r=!0,a){try{const{converse:n,mapFields:s}=i.tmpData.source;return n&&n.use&&r?yield new Promise(((i,r)=>{const s=function(e,i,r,a,n){return o(this,void 0,void 0,(function*(){let r,o=e,{use:n,data:s}=t.cloneDeep(i);if(n)for(let e=0;e<s.length;e++)if(s[e].use){let i=s[e].dependVars,n={};a&&n&&i&&i.length&&i.map((e=>{let i=t.cloneDeep(a).filter((t=>{let i=t.mapField==e;return i&&(n[e]=t.value),i}));i&&0!=i.length||(n[e]="")})),r=yield O(s[e].code,o,n,s[e].mode?s[e].mode:"worker"),o=r.data}return o}))}(e,n,0,a);i(s)})):yield new Promise(((t,i)=>{t(e)}))}catch(t){return console.error("执行过滤器发生错误:"+t),yield new Promise(((t,i)=>{t(e)}))}})),Y=(e,t,i)=>{const{source:r}=e.tmpData,o=r.type;i?("static"===o&&r[o]&&(r[o].originData=i),"indicatorCQ"===o?r.indicator.data=t:r[o].data=t):"indicatorCQ"===o?r.indicator.data=t:r[o].data=t,e.source=t},K=(e,t,...i)=>o(void 0,[e,t,...i],void 0,(function*(e,t,i=[],r,o,a){try{let n=e.tmpData.source.type,s=yield X(e,n,i,r,a||!1);if(null==s||!s)return o&&o({error:!0}),Promise.resolve({error:!0});let l=yield Q(s,e,t,i);return Y(e,l),o&&o(l),Promise.resolve(l)}catch(e){return o&&o(e),I.error("Error in updateComData"),console.error("Error in updateComData:",e),Promise.reject(e)}})),Z=e=>{const t={};if(e&&e.includes("?")){const i=e.split("?")[1].split("&");for(let e of i){const[i,r]=e.split("=").map(decodeURIComponent);t[i]=r}}return t},ee=(e,t)=>{if(!t)return e;if("string"==typeof e)return""===e.trim()?"":e.replace(/@(\w+)|{{(\w+)}}/g,((e,i,r)=>{const o=i||r,a=t.find((e=>e.mapField===o));return a?a.value||a.originalValue||"":e}));if(Array.isArray(e))return e.map((e=>ee(e,t)));if("object"==typeof e&&null!==e){const i={};for(let r in e)i[r]=ee(e[r],t);return i}return e},te=(e,t)=>{const i=e.agency,r=e,{url:o=null,headers:a,params:n,requestType:s}=r,l=o?ee(o,t):void 0,d=a&&a.use?ee(a.value,t):{};return{url:l,requestType:s,params:n?ee(n,t):{},headers:d,agency:i}},ie=(e,t,i,r,a)=>o(void 0,void 0,void 0,(function*(){if(e&&e.length)for(const o of e){v(t,o.value,i)&&(yield K({tmpData:{source:{type:"globalData",globalData:{id:o.key}}}},!0,i,e,(e=>{console.log("数据更新成功-变量改变全局数据跟新")}),!0),f(r,(t=>{var r,n,s;if("globalData"===(null===(n=null===(r=null==t?void 0:t.tmpData)||void 0===r?void 0:r.source)||void 0===n?void 0:n.type)){(null===(s=null==t?void 0:t.tmpData)||void 0===s?void 0:s.source.globalData).id===o.key&&K(t,!0,i,e,(e=>{a(t,e)}),!1)}})))}})),re=(e,t,i,r,a)=>o(void 0,void 0,void 0,(function*(){e&&(yield K({tmpData:{source:{type:"globalData",globalData:{id:e.key}}}},!0,t,i,(e=>{console.log("数据更新成功-数据源编辑")}),!0),f(r,(r=>{var o,n,s;if("globalData"===(null===(n=null===(o=null==r?void 0:r.tmpData)||void 0===o?void 0:o.source)||void 0===n?void 0:n.type)){(null===(s=null==r?void 0:r.tmpData)||void 0===s?void 0:s.source.globalData).id===e.key&&K(r,!0,t,i,(e=>{a(r,e)}),!1)}})))}));class oe{constructor(e,t){this.isUpdating=!1,this.des=e.des,this.field=e.field,this.id=e.id,this.key=e.key,this.mapping=e.mapping,this.mapField=e.mapField,this.type=e.type,this.originalValue=e.originalValue,this.model=(null==e?void 0:e.model)?null==e?void 0:e.model:1,this.converter=e.converter,this.converterCode=e.converterCode,this.fork=e.fork,this.delayUpdate=!!(null==e?void 0:e.delayUpdate),t&&(this.globalVariables=t),e.fork&&(this.model=5,this.forkValue=e.forkValue,this.originalValue=this.getForkedValue())}get value(){return this.fork&&(this.originalValue=this.getForkedValue()),this.converter&&this.converterCode?D(this.converterCode,this.originalValue):this.originalValue}getForkedValue(){if(this.forkValue&&Array.isArray(this.forkValue))return this.forkValue.map((e=>{const t=this.globalVariables.get(e);return t?t.value:null}));if(this.forkValue){const e=this.globalVariables.get(this.forkValue);return e?e.value:null}return null}updateValue(e,t){var r;const o=Object.assign({},this,e);this.des=o.des,this.field=o.field,this.mapping=o.mapping,this.type=o.type,this.originalValue=o.originalValue,this.converter=o.converter,this.converterCode=o.converterCode,this.fork=o.fork,this.delayUpdate=null==o?void 0:o.delayUpdate,this.model=null==o?void 0:o.model,e.id&&(this.id?"string"==typeof this.id?e.id instanceof Array?this.id=i([this.id,...e.id]):this.id=[this.id,e.id]:this.id instanceof Array&&(e.id instanceof Array?this.id=i([...this.id,...e.id]):this.id=i([...this.id,e.id])):this.id=e.id),e.fork&&(this.model=5,this.forkValue=null!==(r=e.forkValue)&&void 0!==r?r:this.forkValue,this.originalValue=this.getForkedValue()),t&&t(this)}updateWidthOriginalValue(e,t){var i;this.originalValue=e,this.fork&&(this.forkValue=null!==(i=this.forkValue)&&void 0!==i?i:this.forkValue,this.originalValue=this.getForkedValue()),t&&t(this)}renew(e){e&&e(this)}static create(e,t){return new oe(e,t)}}class ae{constructor(){this.variables=new Map,this.globalObservers=[],this.url=window.location.search,this.list=[]}clearVars(){this.list=[],this.variables.clear()}static getInstance(){return ae.instance||(ae.instance=new ae),ae.instance}getFullUrl(){this.url=window.location.search}getAllUrlParams(){const e=new URLSearchParams(window.location.search),t={};for(const[i,r]of e.entries())t[i]=r;return t}addUrlParamsToGlobalVars(){this.getFullUrl();let e=this.getAllUrlParams(),t=Object.keys(e),i=[];for(const r of t)i.push({mapField:r,originalValue:e[r],model:4});if(i.length)for(const e of i)this.addVariable(e)}addVariables(e){Array.isArray(e)?e.map(((e,t)=>{this.addVariable(e)})):this.addVariable(e),this.addUrlParamsToGlobalVars()}addVariable(e,t){if(!e||!(null==e?void 0:e.mapField))return console.error(e+"参数不合法!"),!1;if(this.isVariableNameExist(e.mapField)){console.warn("变量名已存在");let i=this.getVariable(e.mapField);return this.sameValue(i,e)?i:(this.editVariable(e,t),!1)}const i=oe.create(e,this.variables);return this.variables.set(i.mapField,i),this.addToObjectArray(this.list,i),t&&t(i),this.notifyGlobalObservers(i),i}toJSON(e){try{return!!e&&JSON.stringify(e)}catch(e){return!1}}sameValue(e,t){if(e.mapfield!==t.mapfield)return!1;for(const i in t)if(!(["mapfield","field","key","value","name","globalVariables"].includes(i)||i in e&&e[i]==t[i]))return!1;return!0}creatVarJson(e){const{des:t,field:i,id:r,key:o,mapping:a,mapField:n,type:s,value:l,originalValue:d,model:c,converter:u,converterCode:h,fork:p,forkValue:f,update:m,delayUpdate:g}=e,v={};return void 0!==t&&(v.des=t),void 0!==i&&(v.field=i),void 0!==r&&(v.id=r),void 0!==o&&(v.key=o),void 0!==a&&(v.mapping=a),void 0!==n&&(v.mapField=n),void 0!==s&&(v.type=s),void 0!==l&&(v.value=l),void 0!==d&&(v.originalValue=d),void 0!==c&&(v.model=c),void 0!==u&&(v.converter=u),void 0!==h&&(v.converterCode=h),void 0!==p&&(v.fork=p),void 0!==f&&(v.forkValue=f),void 0!==m&&(v.update=m),void 0!==g&&(v.delayUpdate=g),v}addToObjectArray(e,t){let i=!1;for(let r=0;r<e.length;r++)if(e[r].mapField==t.mapField){e[r]=this.creatVarJson(t),i=!0;break}i||e.push(t)}editVariable(e,t){const i=this.getVariable(e.mapField);if(i&&this.isVariableNameExist(e.mapField)){if(this.sameValue(i,e))return}const r=e=>{if(!e.isUpdating){e.isUpdating=!0,this.notifyGlobalObservers(e);const i=this.isMapFieldInForkValues(e.mapField);console.log(i,"mapFieldsmapFields"),i.forEach((e=>{let t=this.getVariable(e.mapField);t&&t.renew((e=>{this.addToObjectArray(this.list,e),this.notifyGlobalObservers(e)}))})),this.addToObjectArray(this.list,e),t&&t(e),e.isUpdating=!1}};i?i.updateValue(e,r):this.addVariable(e,r)}editVariableForValue(e,t,i){const r=this.getVariable(e),o=e=>{if(!e.isUpdating){e.isUpdating=!0,this.notifyGlobalObservers(e);this.isMapFieldInForkValues(e.mapField).forEach((e=>{let t=this.getVariable(e.mapField);t&&t.renew((e=>{this.addToObjectArray(this.list,e),this.notifyGlobalObservers(e)}))})),this.addToObjectArray(this.list,e),i&&i(e),e.isUpdating=!1}};r&&r.updateWidthOriginalValue(t,o)}isMapFieldInForkValues(e){return this.getAllVariables().filter((e=>e.fork&&e.forkValue)).filter((t=>t.forkValue==e||Array.from(t.forkValue).includes(e)))}isVariableNameExist(e){return this.variables.has(e)}checkExist(e,t){if("string"==typeof e&&this.isVariableNameExist(e)){let i=this.getVariable(e);return t==i.id&&!i.id.includes(t)&&[{key:e}]}if(Array.isArray(e)){const i=e.filter((e=>{let i=this.getVariable(e);return this.isVariableNameExist(e)&&t!=i.id&&!(i.id&&i.id.includes(t))})).map((e=>({key:e})));return!!i.length&&i}return!1}getVariable(e){return this.variables.get(e)}getVariableForId(e){var t;let i=[];for(const[,r]of this.variables)(r.id===e||(null===(t=r.id)||void 0===t?void 0:t.includes(e)))&&i.push(r);return i}getAllVariables(e=!1){return e?(this.list=Array.from(this.variables.values()),this.list):[...this.list]}restoreVariables(e){e.forEach((e=>{this.addVariable(e)}))}registerGlobalObserver(e){this.globalObservers.push(e)}notifyGlobalObservers(e){this.globalObservers.forEach((t=>{t.update(e)}))}}ae.instance=null;const ne=ae.getInstance(),se=(e,t)=>Array.isArray(t)?t.some((t=>e&&(void 0!==e[t]||e.hasOwnProperty(t)))):"string"==typeof t&&(e&&(void 0!==e[t]||e.hasOwnProperty(t))),le=(e,t,i,r)=>{const o=((e,t,i,r)=>{var o;let a;if(se(e,null==t?void 0:t.field)||se(e,null==t?void 0:t.forkValue))a=e[null==t?void 0:t.field]||"";else if(se(e.data,null==t?void 0:t.field)||se(e.data,null==t?void 0:t.forkValue))a=e.data[null==t?void 0:t.field]||"";else{const e=b(i,r),n=(null===(o=null==e?void 0:e.tmpData)||void 0===o?void 0:o.actions)||[];for(const e of n){const i=e.vars.find((e=>(null==e?void 0:e.mapField)===(null==t?void 0:t.mapField)));if(i){a=i.value;break}}}return a})(e,t,i,r);return void 0!==o?o:t.value},de=(e,t,i,r,o,a,n,s,l)=>{switch(e.type){case"link":window.open(e.link,e.target);break;case"page":l&&l(e);break;case"dynamic":((e,t,i,r,o)=>{const a=e.dynamic||[];for(const n of a){if(e.id!==t.cid)continue;const a=b(i,n.pid);a&&(a.activeDynamic=n.name,a.isShow=n.visible||!r||e.index===t.index-1,o({cid:a.cid,flag:n.visible}))}})(e,t,i,r,o);break;case"toggle":((e,t,i,r,o)=>{const a=e.children||[];for(const i of a){const a=i.visible&&(!r||e.index===t.index-1);o({cid:i.cid,flag:a})}})(e,t,0,r,o);break;case"update":((e,t,i,r,o)=>{const a=e.children||[];for(const e of a){const a=b(t,e.cid);a&&K(a,!0,i,r,(e=>{o({cid:a.cid,data:e})}))}})(e,i,a,n,s)}},ce=(e,t,i,r,o,a,n,s,l,d)=>{const{cid:c,actions:u,index:h}=o,{eventName:p,mode:f}=u,m=2===f;((e,t,i,r,o,a)=>{let n=ne.getVariableForId(t.cid);if(null==n?void 0:n.length)for(const s of n)if(s.type==e){let e=le(t,s,i,r);ne.editVariableForValue(s.mapField,e,(()=>{const e=o[s.mapField]||[];a&&a(s,e)}))}})(p,o,r,c,i,((e,t)=>{if(ie(l,e.mapFile,ne.getAllVariables(),r,((e,t)=>{n({cid:e.cid,data:t})})),null==t?void 0:t.length)for(const i of t){e.eventSourceId=i;const t=b(r,i);!(null==e?void 0:e.delayUpdate)&&t&&K(t,!0,ne.getAllVariables(),l,(e=>{n({cid:t.cid,data:e})}))}}));const g=((e,t,i,r,o)=>e.filter((e=>e.id===t&&e.eventType===i&&(!o||parseInt(e.index||"0")+1===parseInt(r||"0")))))(e,c,p,h,m);for(const e of g)de(e,o,r,m,a,ne.getAllVariables(),l,n,s)},ue=(e,t={})=>{let i={},r={type:"static",converse:{use:!1,data:[]},static:{data:e},api:{requestType:"get",url:"",headers:{use:!1,value:""},params:"",agency:!1,cookie:!0,autoUpdate:{open:!1,time:10},data:""}};return Object.assign(i,r,t),i},he=(e,i)=>{let{option:r,actions:o,data:a,optionDes:n,actionsDes:s,source:l,theme:d}=((e,i)=>{let{option:r,actions:o,data:a,optionDes:n,actionsDes:s,source:l,theme:d}=t.cloneDeep(i[e]);return{option:r,actions:o,data:a,optionDes:n,actionsDes:s,source:l,theme:d}})(e,i);return{iconClass:null,isAssembly:null,source:a,cid:(Math.random().toString().substr(3,10)+Date.now()).toString(),isLock:!1,isShow:!0,tmpData:{option:r,source:ue(a,l),actions:o},baseData:fe(),dynamic:null,filePath:"",origin:"anov-ui",name:"",componentType:"",viewComName:e,optionComName:"AnOptionPanel",dataComName:"AnSourcePanel",eventComName:"AnActionsPanel",assemblyDeveloper:"",devEmail:"",version:"",devDept:""}},pe=(e,i,r)=>{let o=he(e,i);return r?t.merge(o,r):o},fe=e=>{let t={left:0,top:0,width:100,height:100,angle:0,penetrate:0,opacity:100,perspective:100,rotateX:0,rotateY:0,rotateZ:0,transformOriginX:"center",transformOriginY:"center",transformSwitch:!1};return e?Object.assign(t,e):t};class me{constructor(e,t,i){this.theme=null,this.plant=null,this.list=[],this.titleHeqadeHeight=60,this.clearance=3,this.checkComponentIntersection=(e,t,i=10)=>{const r=e.left,o=e.left+e.width,a=e.top,n=e.top+e.height,s=t.left,l=t.left+t.width,d=t.top,c=t.top+t.height,u=r<l&&o>s&&a<c&&n>d,h=Math.abs(e.left+e.width/2-(t.left+t.width/2)),p=Math.abs(e.top+e.height/2-(t.top+t.height/2));return u||h<i&&p<i},this.calculateCombinedComponent=e=>{if(0===e.length)return{left:0,top:0,width:0,height:0};let t=e[0].left,i=e[0].top,r=e[0].left+e[0].width,o=e[0].top+e[0].height;for(let a=1;a<e.length;a++){const n=e[a];t=Math.min(t,n.left),i=Math.min(i,n.top),r=Math.max(r,n.left+n.width),o=Math.max(o,n.top+n.height)}return{left:t,top:i,width:r-t,height:o-i}},this.getAnTextNormaltText=e=>{var t,i;try{return null===(i=null===(t=null==e?void 0:e.tmpData)||void 0===t?void 0:t.option)||void 0===i?void 0:i.text}catch(e){return console.error("配置优化(ConfigOptimizer):",e),""}},this.initProp(e),this.upgradePlant(),this.staticComponentData=t,this.upgradeHeaderComponent(),this.upgradeTitleComponent(),this.upgradeGroupComponent(),i&&Object.assign(this,i)}isStringOrObject(e){return"string"==typeof e?"string":"object"==typeof e&&null!==e&&"object"}initProp(e){try{let t,i=this.isStringOrObject(e);if(i&&"string"===i)t=JSON.parse(e);else{if(!i||"object"!==i)throw new Error(`initProp fn error :-- 传入参数${e}不合法!`);t=e}if(t){this.originData=t;const{theme:e,plant:i,list:r}=t;this.theme=e,this.plant=i,this.list=r,this.filterFileGroup()}}catch(e){console.error("配置优化(ConfigOptimizer):",e)}}upgradePlant(){this.plant&&(this.plant.option.bg={type:1,code:"70942ec525344c96aa32b81b2c9155f6",path:"/anov-prod/resources/page/png/bg22 科技星球背景.png",thumb:"/anov-prod/resources/page/thumbnail/1e48f8fb26ec4edfb1a0f499627e84fc.png"})}areComponentsIntersecting(e,t){let i=e.baseData,r=t.baseData;const o=Math.max(0,Math.min(i.left+i.width,r.left+r.width)-Math.max(i.left,r.left)),a=Math.max(0,Math.min(i.top+i.height,r.top+r.height)-Math.max(i.top,r.top));return o>0&&a>0}filterFileGroup(){this.list=t.cloneDeep(this.list).map((e=>{var t,i;if(1===(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.length)&&!(null===(i=null==e?void 0:e.children[0])||void 0===i?void 0:i.children)){const t=e.children[0],{left:i,top:r}=e.baseData;return t.baseData.left=i,t.baseData.top=r,t}return e}))}getText(e,t,i){const r=document.createElement("canvas").getContext("2d");if(!r)throw new Error("Failed to get 2D context from canvas.");r.font=`${i}px ${t}`;return r.measureText(e).width}createIndicatorComponent(e,t,i){}calculateMaxWidths(e){const t=Math.min(...e.map((e=>e.width))),i=[];let r=[],o=e[0].width;for(const a of e){const e=a.width;Math.abs(e-o)<=t?r.push(e):(r.length>0&&i.push(r),r=[e]),o=e}r.length>0&&i.push(r);const a=[];for(const e of i){const t=Math.max(...e);a.push(t)}return a}findClosestValue(e,t){let i=t[0],r=Math.abs(e-i);for(const o of t){const t=Math.abs(e-o);t<r&&(r=t,i=o)}return i}adjustHeightAndTop(e,t){const i=t-e.height;return Object.assign(Object.assign({},e),{height:t,top:e.top-i/2})}findNearestComponent(e,i,r){let o=null,a=1/0;i.tmpData.option.textNormal.text;try{const n=t.cloneDeep(e).sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===i.cid||"AnTextNormal"===e.viewComName||r&&r.includes(e.cid)))),s=t.cloneDeep(i).baseData;s.top,s.height;for(const e of n){const t=e.baseData;t.top,t.height;if(s.left<t.left+t.width&&s.left+s.width>t.left){const i=t.top-s.top;i<a&&i<100&&(a=i,o=e)}}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return o}findNearestComponentForPoint(e,t,i){let r=null,o=1/0;t.tmpData.option.textNormal.text;try{const a=e.sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===t.cid||"AnTextNormal"===e.viewComName||i&&i.includes(e.cid)))),n=t.baseData;n.top,n.height;for(const e of a){const t=e.baseData;let i=this.getDistance(n.left,n.top+n.height,t.left,t.top);i<o&&i<n.width&&(o=i,r=e)}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return r}findNearestComponentForTitlePoint(e,t,i){let r=null,o=1/0;t.tmpData.option.textNormal.text;try{const a=e.sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===t.cid||"AnTextNormal"===e.viewComName||i&&i.includes(e.cid)))),n=t.baseData;n.top,n.height;for(const e of a){const t=e.baseData;let i=this.getDistance(n.left,n.top+n.height,t.left,t.top);i<o&&i<n.width&&t.top-n.top>100&&(o=i,r=e)}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return r}findNearestTitleForPoint(e,t,i){let r=null,o=1/0;t.tmpData.option.textNormal.text;try{const a=e.sort(((e,t)=>e.baseData.top-t.baseData.top)).sort(((e,t)=>e.baseData.left-t.baseData.left)).filter((e=>!(e.cid===t.cid||"AnTextNormal"===e.viewComName||i&&i.includes(e.cid)))),n=t.baseData;n.top,n.height;for(const e of a){const t=e.baseData;let i=t.top-n.top;i<o&&i<n.width&&t.top-n.top>100&&(o=i,r=e)}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return r}getDistance(e,t,i,r){return Math.sqrt(Math.pow(i-e,2)+Math.pow(r-t,2))}findNearestComponent2(e,i,r){let o=null,a=1/0,n=t.cloneDeep(e).sort(((e,t)=>e.baseData.top-t.baseData.top));try{const e=n.filter((e=>!(e.cid===i.cid||"AnTextNormal"===e.viewComName||r&&r.includes(e.cid)))),s=t.cloneDeep(i).baseData,l=s.top+s.height;for(const t of e){const e=t.baseData,i=e.top+e.height;if(s.left<e.left+e.width&&s.left+s.width>e.left){const e=i-l;e>=0&&e<a&&(a=e,o=t)}}}catch(e){console.error("配置优化(ConfigOptimizer)- findNearestComponent :",e)}return o}verticalDistance(e,t){e.left,e.width;const i=e.top+e.height,r=(t.left,t.width,t.top);return Math.abs(i-r)}extractAmount(e){const t=e.match(/(\d{1,3}(?:,\d{3})*)(\D+)/);if(t){const e=t[1].replace(/,/g,"");return[parseInt(e,10),t[2].trim()]}return[!1,!1]}getAnTextNormal(){return this.list.filter((e=>"AnTextNormal"==e.viewComName))}getAnDeckTitle3(){return this.list.filter((e=>"AnDeckTitle3"==e.viewComName)).sort(((e,t)=>e.baseData.left-t.baseData.left))}judgeAnOdometer(){let e=this.getAnTextNormal().sort(((e,t)=>e.baseData.left-t.baseData.left)),t=[],i=new Set;for(const r of e){if(i.has(r.cid))continue;let o=[];for(const t of e){if(!i.has(t.cid)&&r.cid!=t.cid){this.checkComponentIntersection(r.baseData,t.baseData)&&(i.add(t.cid),i.add(r.cid),o.push(t))}}t.push([r,...o])}let r=[];for(const e of t)for(const t of e){let i=this.getAnTextNormaltText(t);this.extractAmount(i).every((e=>e))&&r.push(e)}return r}createAnOdometer(){var e,i;let r=this.judgeAnOdometer();for(const o of r){let r,a,n,s=this.calculateCombinedComponent(o.map((e=>e.baseData)));for(const e of o){let i=this.getAnTextNormaltText(e),o=this.extractAmount(i);o.every((e=>!e))&&(r=i),o.every((e=>e))&&(a=o[0],n=o[1]),t.remove(this.list,(t=>t.cid==e.cid))}let l=pe("AnIndicatorNormal",this.staticComponentData,t.cloneDeep({baseData:s}));(null===(i=null===(e=null==l?void 0:l.tmpData)||void 0===e?void 0:e.source)||void 0===i?void 0:i.static)&&(l.tmpData.source.static.data={text:r,num:a,unit:n},l.tmpData.source.static.originData={text:r,num:a,unit:n}),this.list.push(l)}}upgradeHeaderComponent(){for(let e=0;e<this.list.length;e++){const t=this.list[e];"AnDeckHeader3"==t.viewComName&&(t.baseData.left=0,t.baseData.top=0)}}upgradeTitleComponent(){let e=this.getAnDeckTitle3().map((e=>e.baseData)),t=this.calculateMaxWidths(e);for(let e=0;e<this.list.length;e++){const i=this.list[e];if("AnDeckTitle3"==i.viewComName){let e=this.findClosestValue(i.baseData.width,t);i.baseData.width=e>300?e:300,i.baseData=this.adjustHeightAndTop(i.baseData,this.titleHeqadeHeight)}}this.removeErroneousComponents()}containsFractionStructure(e){return/\b\d+\/\d+\b/.test(e)}removeErroneousComponents(){let e=this.getAnDeckTitle3(),t=[];for(let i=0;i<e.length;i++){const r=e[i];let o=r.tmpData.option.textNormal.text;if(this.containsFractionStructure(o))for(let i=0;i<e.length;i++){const o=e[i];if(r.cid!=o.cid){this.areComponentsIntersecting(r,o)&&t.push(r.cid)}}}this.list=this.list.filter((e=>!t.includes(e.cid)))}upgradeGroupComponent(){try{let e=this.getAnDeckTitle3(),t=this.list.filter((e=>"AnDeckTitle3"!=e.viewComName&&"AnDeckHeader3"!=e.viewComName&&"AnTextNormal"!=e.viewComName)),i=[],r=[];for(let o=0;o<e.length;o++){const a=e[o];let n=this.findNearestComponentForPoint(t,a,i);if(n&&n.cid&&i.push(n.cid),n){a.baseData.left=n.baseData.left;let t=this.upgradeComponentHeight(a,e,r);t&&t>=30&&(n.baseData=Object.assign({},n.baseData,{top:a.baseData.top+a.baseData.height+this.clearance}))}}}catch(e){console.error("配置优化(ConfigOptimizer):",e)}}upgradeComponentHeight(e,i,r=[]){const o=e;let a=this.findNearestTitleForPoint(t.cloneDeep(i),o);return a?a.baseData.top-o.baseData.top-this.titleHeqadeHeight:1080-o.baseData.top-this.titleHeqadeHeight}getData(){return this.originData.list=this.list,this.originData.plant=this.plant,this.originData}}console.log(123);export{me as ConfigOptimizer,ae as GlobalVariables,U as Http,I as Log,q as agentData,Y as editItem,ce as emitEvent,_ as fetchDataByGlobal,X as fetchDataByType,Q as filterData,b as findItemDeep,y as findItemDeep2,R as getData,G as getDataForApi,z as getDataForSource,B as getDataForStatic,H as getDataForZb,L as getDataForZbCQ,u as getSessionData,l as getStandardData,m as getStringVars,le as getVarDefaultVal,ne as globalVars,v as hasVar,d as isJSON,f as recursion,w as safeEval,D as safeEvalForCode,c as setSessionData,ie as updataGlobalDataSourceForVar,K as updateComData,re as updateGlobalDataSource};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { ThemeConfig, Plant, GoComponentConfig } from "../common/type";
|
|
2
|
+
import { StaticComponentData } from "../common/type";
|
|
3
|
+
export declare class ConfigOptimizer {
|
|
4
|
+
originData: any;
|
|
5
|
+
theme: ThemeConfig | null;
|
|
6
|
+
plant: Plant | null;
|
|
7
|
+
list: Array<GoComponentConfig>;
|
|
8
|
+
staticComponentData: StaticComponentData;
|
|
9
|
+
titleHeqadeHeight: number;
|
|
10
|
+
clearance: number;
|
|
11
|
+
constructor(params: any, staticComponentData: StaticComponentData, option?: {
|
|
12
|
+
[prop: string]: any;
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @description 判断传入参数类型
|
|
17
|
+
* @private
|
|
18
|
+
* @param {(string | object)} input
|
|
19
|
+
* @return {*} {('string'|'object'| false)}
|
|
20
|
+
* @memberof ConfigOptimizer
|
|
21
|
+
*/
|
|
22
|
+
private isStringOrObject;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @description 初始化 theme plant 等属性
|
|
26
|
+
* @param {*} params
|
|
27
|
+
* @memberof ConfigOptimizer
|
|
28
|
+
*/
|
|
29
|
+
initProp(params: any): void;
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* 优化背景面板
|
|
33
|
+
* @memberof ConfigOptimizer
|
|
34
|
+
*/
|
|
35
|
+
upgradePlant(): void;
|
|
36
|
+
areComponentsIntersecting(component1: any, component2: any): boolean;
|
|
37
|
+
private filterFileGroup;
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @description 计算字体长度
|
|
41
|
+
* @param {string} text
|
|
42
|
+
* @param {string} font
|
|
43
|
+
* @param {number} fontSize
|
|
44
|
+
* @return {*} {number}
|
|
45
|
+
* @memberof ConfigOptimizer
|
|
46
|
+
*/
|
|
47
|
+
getText(text: string, font: string, fontSize: number): number;
|
|
48
|
+
createIndicatorComponent(text: string, num: number, unit: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* 计算接近的 width 值的均值
|
|
51
|
+
* @param data 数据项数组
|
|
52
|
+
* @returns 每个接近的 width 组的平均值数组
|
|
53
|
+
*/
|
|
54
|
+
calculateMaxWidths(data: any[]): number[];
|
|
55
|
+
/**
|
|
56
|
+
* 查找最接近目标值的值
|
|
57
|
+
* @param target 目标值
|
|
58
|
+
* @param values 数组
|
|
59
|
+
* @returns 最接近目标值的值
|
|
60
|
+
*/
|
|
61
|
+
private findClosestValue;
|
|
62
|
+
/**
|
|
63
|
+
* 调整数据项的高度并保持位置不变
|
|
64
|
+
* @param data 数据项数组
|
|
65
|
+
* @param targetHeight 目标高度
|
|
66
|
+
* @returns 调整后的数据项数组
|
|
67
|
+
*/
|
|
68
|
+
private adjustHeightAndTop;
|
|
69
|
+
/**
|
|
70
|
+
* 找到离目标组件下方最近的组件,
|
|
71
|
+
* @param data 数据项数组
|
|
72
|
+
* @param targetComponent 目标组件
|
|
73
|
+
* @param excluded 要排除的组件列表
|
|
74
|
+
* @returns 最近的组件,如果没有找到符合条件的组件则返回 null
|
|
75
|
+
*/
|
|
76
|
+
findNearestComponent(data: any[], targetComponent: any, excluded?: any[]): any | null;
|
|
77
|
+
/**
|
|
78
|
+
* 找到离目标组件下方最近的组件(两个顶点距离),
|
|
79
|
+
* @param data 数据项数组
|
|
80
|
+
* @param targetComponent 目标组件
|
|
81
|
+
* @param excluded 要排除的组件列表
|
|
82
|
+
* @returns 最近的组件,如果没有找到符合条件的组件则返回 null
|
|
83
|
+
*/
|
|
84
|
+
findNearestComponentForPoint(data: any[], targetComponent: any, excluded?: any[]): any | null;
|
|
85
|
+
/**
|
|
86
|
+
* 找到离目标组件下方最近的组件(两个顶点距离)-标题,
|
|
87
|
+
* @param data 数据项数组
|
|
88
|
+
* @param targetComponent 目标组件
|
|
89
|
+
* @param excluded 要排除的组件列表
|
|
90
|
+
* @returns 最近的组件,如果没有找到符合条件的组件则返回 null
|
|
91
|
+
*/
|
|
92
|
+
findNearestComponentForTitlePoint(data: any[], targetComponent: any, excluded?: any[]): any | null;
|
|
93
|
+
/**
|
|
94
|
+
* 找到离目标组件下方最近的组件(两个顶点距离)-标题,
|
|
95
|
+
* @param data 数据项数组
|
|
96
|
+
* @param targetComponent 目标组件
|
|
97
|
+
* @param excluded 要排除的组件列表
|
|
98
|
+
* @returns 最近的组件,如果没有找到符合条件的组件则返回 null
|
|
99
|
+
*/
|
|
100
|
+
findNearestTitleForPoint(data: any[], targetComponent: any, excluded?: any[]): any | null;
|
|
101
|
+
getDistance(x1: number, y1: number, x2: number, y2: number): number;
|
|
102
|
+
findNearestComponent2(data: any[], targetComponent: any, excluded?: any[]): any | null;
|
|
103
|
+
/**
|
|
104
|
+
* 计算两个组件在垂直方向上的距离
|
|
105
|
+
* @param component1 第一个组件
|
|
106
|
+
* @param component2 第二个组件
|
|
107
|
+
* @returns 垂直方向上的距离
|
|
108
|
+
*/
|
|
109
|
+
verticalDistance(component1: any, component2: any): number;
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* 判断两个组件是否相交或者离得比较近的函数
|
|
113
|
+
* @private
|
|
114
|
+
* @param {*} comp1
|
|
115
|
+
* @param {*} comp2
|
|
116
|
+
* @param {number} [threshold=10]
|
|
117
|
+
* @memberof ConfigOptimizer
|
|
118
|
+
*/
|
|
119
|
+
private checkComponentIntersection;
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
* 计算多个组件组合后的位置和大小
|
|
123
|
+
* @private
|
|
124
|
+
* @param {BaseData[]} components
|
|
125
|
+
* @memberof ConfigOptimizer
|
|
126
|
+
*/
|
|
127
|
+
private calculateCombinedComponent;
|
|
128
|
+
/**
|
|
129
|
+
* 从输入字符串中提取数字和单位。
|
|
130
|
+
* @param inputStr 输入字符串,例如 '3,748,902万元'
|
|
131
|
+
* @returns 成功匹配到数字和单位时返回 [number, string],匹配失败时返回 [false, false]
|
|
132
|
+
*/
|
|
133
|
+
private extractAmount;
|
|
134
|
+
/**
|
|
135
|
+
*
|
|
136
|
+
* 获取文本组件
|
|
137
|
+
* @private
|
|
138
|
+
* @return {*} {Array<any>}
|
|
139
|
+
* @memberof ConfigOptimizer
|
|
140
|
+
*/
|
|
141
|
+
private getAnTextNormal;
|
|
142
|
+
/**
|
|
143
|
+
*
|
|
144
|
+
* 获取文本组件
|
|
145
|
+
* @private
|
|
146
|
+
* @return {*} {Array<any>}
|
|
147
|
+
* @memberof ConfigOptimizer
|
|
148
|
+
*/
|
|
149
|
+
private getAnDeckTitle3;
|
|
150
|
+
private getAnTextNormaltText;
|
|
151
|
+
/**
|
|
152
|
+
*
|
|
153
|
+
* 判断复合替换的文本组件
|
|
154
|
+
* @private
|
|
155
|
+
* @return {*} {any[]}
|
|
156
|
+
* @memberof ConfigOptimizer
|
|
157
|
+
*/
|
|
158
|
+
private judgeAnOdometer;
|
|
159
|
+
/**
|
|
160
|
+
*
|
|
161
|
+
* 转换文本组件为指标组件
|
|
162
|
+
* @private
|
|
163
|
+
* @memberof ConfigOptimizer
|
|
164
|
+
*/
|
|
165
|
+
private createAnOdometer;
|
|
166
|
+
/**
|
|
167
|
+
*
|
|
168
|
+
* 优化头部装饰组件
|
|
169
|
+
* @memberof ConfigOptimizer
|
|
170
|
+
*/
|
|
171
|
+
upgradeHeaderComponent(): void;
|
|
172
|
+
/**
|
|
173
|
+
*
|
|
174
|
+
* 优化标题装饰组件
|
|
175
|
+
* @memberof ConfigOptimizer
|
|
176
|
+
*/
|
|
177
|
+
upgradeTitleComponent(): void;
|
|
178
|
+
containsFractionStructure(text: string): boolean;
|
|
179
|
+
/**
|
|
180
|
+
*
|
|
181
|
+
* 去除识别错误产生的标题组件
|
|
182
|
+
* @memberof ConfigOptimizer
|
|
183
|
+
*/
|
|
184
|
+
removeErroneousComponents(): void;
|
|
185
|
+
/**
|
|
186
|
+
*
|
|
187
|
+
* 优化标题装饰组件和图表组件的组合
|
|
188
|
+
* @memberof ConfigOptimizer
|
|
189
|
+
*/
|
|
190
|
+
upgradeGroupComponent(): void;
|
|
191
|
+
/**
|
|
192
|
+
*
|
|
193
|
+
* 优化标题装饰组件和图表组件的组合
|
|
194
|
+
* @param {*} titleComponen
|
|
195
|
+
* @param {any[]} titleList
|
|
196
|
+
* @param {any[]} [excluded=[]]
|
|
197
|
+
* @return {*} {number}
|
|
198
|
+
* @memberof ConfigOptimizer
|
|
199
|
+
*/
|
|
200
|
+
upgradeComponentHeight(titleComponen: any, titleList: any[], excluded?: any[]): number;
|
|
201
|
+
getData(): any;
|
|
202
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StaticComponentData, GoComponentConfig } from '../common/type';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* 更新组件配置信息
|
|
5
|
+
* @param {string} viewComName
|
|
6
|
+
* @param {StaticComponentData} staticData
|
|
7
|
+
* @param {*} [dataOption]
|
|
8
|
+
* @return {*}
|
|
9
|
+
*/
|
|
10
|
+
export declare const updataComponentConfig: (viewComName: string, staticData: StaticComponentData, dataOption?: any) => GoComponentConfig;
|
|
11
|
+
export declare const updataComponentConfigProp: (originData: any, dataOption: any) => any;
|
|
@@ -1 +1,5 @@
|
|
|
1
1
|
export declare function decrypAES(data: string): string;
|
|
2
|
+
export declare const genID: () => string;
|
|
3
|
+
type Mergeable<T> = T extends Record<string, any> ? T : never;
|
|
4
|
+
export declare function deepMerge<T extends Record<string, any>>(target: T, ...sources: Array<Partial<Mergeable<T>> | undefined>): T;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
export interface BaseData {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
angle?: number;
|
|
7
|
+
penetrate?: number;
|
|
8
|
+
opacity?: number;
|
|
9
|
+
perspective?: number;
|
|
10
|
+
rotateX?: number;
|
|
11
|
+
rotateY?: number;
|
|
12
|
+
rotateZ?: number;
|
|
13
|
+
transformOriginX?: "center" | "left" | "right" | "top" | "bottom";
|
|
14
|
+
transformOriginY?: "center" | "left" | "right" | "top" | "bottom";
|
|
15
|
+
transformSwitch?: boolean;
|
|
16
|
+
[props: string]: any;
|
|
17
|
+
}
|
|
18
|
+
export interface ThemeConfig {
|
|
19
|
+
name: string;
|
|
20
|
+
color: string;
|
|
21
|
+
background: string;
|
|
22
|
+
pageBackground: string;
|
|
23
|
+
text: string;
|
|
24
|
+
default: boolean;
|
|
25
|
+
groups: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface Resource {
|
|
28
|
+
jspaths: string[];
|
|
29
|
+
csspaths: string[];
|
|
30
|
+
otherpaths: string[];
|
|
31
|
+
fonts: string[];
|
|
32
|
+
}
|
|
33
|
+
export interface GlobalVar {
|
|
34
|
+
des: string;
|
|
35
|
+
key: number;
|
|
36
|
+
mapField: string;
|
|
37
|
+
mapping: string;
|
|
38
|
+
model: string;
|
|
39
|
+
name: string;
|
|
40
|
+
value: string | number | null;
|
|
41
|
+
originalValue: string | number | null;
|
|
42
|
+
}
|
|
43
|
+
export interface GlobalData {
|
|
44
|
+
globalVars: GlobalVar[];
|
|
45
|
+
globalEvents: any[];
|
|
46
|
+
globalSource: any[];
|
|
47
|
+
}
|
|
48
|
+
interface BgImage {
|
|
49
|
+
code: string;
|
|
50
|
+
header: string[];
|
|
51
|
+
index: number;
|
|
52
|
+
path: string;
|
|
53
|
+
tags: string[];
|
|
54
|
+
thumb: string;
|
|
55
|
+
type: number;
|
|
56
|
+
}
|
|
57
|
+
interface GroupAnimation {
|
|
58
|
+
animationDelay: number;
|
|
59
|
+
animationDuration: number;
|
|
60
|
+
animationRepeat: number;
|
|
61
|
+
animationType: string;
|
|
62
|
+
scrambleRightToLeft: boolean;
|
|
63
|
+
scrambleType: string;
|
|
64
|
+
}
|
|
65
|
+
interface Gradient {
|
|
66
|
+
flag: number;
|
|
67
|
+
style: string;
|
|
68
|
+
}
|
|
69
|
+
interface GroupEffect {
|
|
70
|
+
glowIntensity: number;
|
|
71
|
+
glowType: string;
|
|
72
|
+
gradient: Gradient;
|
|
73
|
+
}
|
|
74
|
+
interface TextStyle {
|
|
75
|
+
color: string;
|
|
76
|
+
fontFamily: string;
|
|
77
|
+
fontSize: number;
|
|
78
|
+
fontStyle: string;
|
|
79
|
+
fontWeight: string;
|
|
80
|
+
textAlign: string;
|
|
81
|
+
}
|
|
82
|
+
interface TextNormal {
|
|
83
|
+
groupAnimation: GroupAnimation;
|
|
84
|
+
groupEffect: GroupEffect;
|
|
85
|
+
letterSpacing: number;
|
|
86
|
+
lineHeight: number;
|
|
87
|
+
mode: string;
|
|
88
|
+
text: string;
|
|
89
|
+
textPosition: {
|
|
90
|
+
unit: string;
|
|
91
|
+
val: number;
|
|
92
|
+
}[];
|
|
93
|
+
textStyle: TextStyle;
|
|
94
|
+
}
|
|
95
|
+
export interface Plant {
|
|
96
|
+
name: string;
|
|
97
|
+
theme: string | null;
|
|
98
|
+
baseData: {
|
|
99
|
+
height: number;
|
|
100
|
+
width: number;
|
|
101
|
+
};
|
|
102
|
+
option: {
|
|
103
|
+
actions: any[];
|
|
104
|
+
bgImage: BgImage;
|
|
105
|
+
textNormal: TextNormal;
|
|
106
|
+
[prop: string]: any;
|
|
107
|
+
};
|
|
108
|
+
scaleType: number;
|
|
109
|
+
}
|
|
110
|
+
export interface ComConfig {
|
|
111
|
+
actions: any[];
|
|
112
|
+
actionsDes: any;
|
|
113
|
+
data: any;
|
|
114
|
+
key: string;
|
|
115
|
+
option: any;
|
|
116
|
+
optionDes: any;
|
|
117
|
+
source: any;
|
|
118
|
+
sourceDes: any;
|
|
119
|
+
theme: any;
|
|
120
|
+
[prop: string]: any;
|
|
121
|
+
}
|
|
122
|
+
export interface StaticComponentData {
|
|
123
|
+
[key: string]: ComConfig;
|
|
124
|
+
}
|
|
125
|
+
export interface GoComponentConfig {
|
|
126
|
+
name: string;
|
|
127
|
+
baseData: BaseData;
|
|
128
|
+
id?: string;
|
|
129
|
+
dev?: boolean;
|
|
130
|
+
loading?: boolean;
|
|
131
|
+
com?: any;
|
|
132
|
+
tmp?: any;
|
|
133
|
+
children?: Array<GoComponentConfig>;
|
|
134
|
+
[props: string]: any;
|
|
135
|
+
}
|
|
136
|
+
export interface AxiosPromise<T = any> extends Promise<T> {
|
|
137
|
+
}
|
|
138
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED