@wdslib/go-utils 0.2.2 → 0.2.4

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 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(/&gt;/g,">").replace(/&lt;/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"";case S.ERROR:return"";case S.WARN:return"";case S.INFO:return"";case S.DEBUG:return"";case S.TRACE:return"";default:return""}}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}`);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}`)}}}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:ee(e.params,r),headers:ee(e.headers,r)};case"indicatorCQ":return{zbName:e.zbName,params:ee(e.params,r)};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(/&gt;/g,">").replace(/&lt;/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=e=>{let t=window.goFetchList;return t||(window.goFetchList={},t=window.goFetchList),t[e]?!t[e]&&void 0:(t[e]={id:e,time:(new Date).getTime()},!0)},k=e=>{let t=window.goFetchList;t&&t[e]&&delete t[e]},C="anov@2019:helloX",V="anov@2020:helloX";function A(e){let t=r.enc.Utf8.parse(C),i=r.enc.Utf8.parse(V);return r.AES.encrypt(e,t,{iv:i,mode:r.mode.CBC,padding:r.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"]),F=URL.createObjectURL(O);function T(e,t,i={},r="worker"){return o(this,void 0,void 0,(function*(){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,t=5e3){return o(this,void 0,void 0,(function*(){let i=new Worker(F);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 x,E,S,j;!function(e){e.StaticFile="staticFile",e.DataSource="datasource"}(x||(x={})),function(e){e.json="application/json;charset=UTF-8",e.form="application/x-www-form-urlencoded; charset=UTF-8"}(E||(E={})),function(e){e.get="GET",e.post="POST",e.put="PUT",e.patch="PATCH",e.delete="DELETE"}(S||(S={}));class P{constructor(e){this.db=null,this.dbName=e.databaseName,this.tableName=e.tableName,this.keyPath=e.keyPath}static getInstance(e){return P.instance||(P.instance=new P(e)),P.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)}}))}))}}P.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"}(j||(j={}));const I={databaseName:"GODB",tableName:"go-log",keyPath:"time"};class U{constructor(){this.logLevel=j.INFO,this.indexedDBInstance=P.getInstance(I);try{this.indexedDBInstance.init(),console.log("IndexedDB 初始化成功。")}catch(e){console.error("初始化 IndexedDB 时出错:",e)}}static getInstance(){return U.instance||(U.instance=new U),U.instance}setLogLevel(e){this.logLevel=e}getColor(e){switch(e){case j.FATAL:return"";case j.ERROR:return"";case j.WARN:return"";case j.INFO:return"";case j.DEBUG:return"";case j.TRACE:return"";default:return""}}log(e,t){if(t<=this.logLevel){const i=(new Date).toISOString(),r=`[${i}] [${j[t]}]`,o=this.getColor(t);if(null===window||void 0===window?void 0:window.goDev)console.log(`${o}${r} ${e}`);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}`)}}}fatal(e){this.log(e,j.FATAL)}error(e){this.log(e,j.ERROR)}warn(e){this.log(e,j.WARN)}info(e){this.log(e,j.INFO)}debug(e){this.log(e,j.DEBUG)}trace(e){this.log(e,j.TRACE)}}const $=U.getInstance(),M=(e,t)=>"string"!=typeof e?Promise.reject(new Error("URL should be a string")):s(e,t),R=s();let q=s();function L(e,i="get",r={},a={}){return o(this,void 0,void 0,(function*(){try{const s={method:S[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 R({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 R(e)).data}}catch(e){throw console.error("请求数据发生错误-Error:",e),e}}))}(s)}catch(e){throw console.error("获取数据:Error:",e),e}}))}function H(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 R({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?H(t,e,i,r):L(e,t,i,r)}))}function z(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=te("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 R({method:"POST",url:l,data:{headers:i,param:d},timeout:a})}const B=(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 q({method:"GET",url:`${i}ds/v1/metrics/v1/data-alarm?dateType=${r}&endPeriod=${o}&metricsName=${n}&startPeriod=${s}`,timeout:a})})),J=(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 R(Object.assign({timeout:a},n))})),W=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")})),X=(e,t,i)=>{try{switch(t){case"api":{let t=re(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=ie(e.inputSql,i);return{dsName:e.dsName,dsType:"1",sql:A(t),filter:e.sqlFilter}}case"staticFile":return{dsName:e.dsName,dsType:e.dsType,sql:""};case"indicator":return{zbId:e.zbId,params:ie(e.params,i),headers:ie(e.headers,i)};case"indicatorCQ":return{zbName:e.zbName,params:ie(e.params,i)};case"packData":return{};default:throw new Error("Invalid type")}}catch(t){console.log("准备请求数据发生错误",t,e)}},_=(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 W(e.data);case"datasource":return yield J(e.dsName,{dsType:e.dsType,sql:e.sql,filter:e.filter},"datasource");case"staticFile":return yield J(e.dsName,{dsType:e.dsType,sql:e.sql},"staticFile");case"indicator":return yield z(e.zbId,e.params,e.headers);case"indicatorCQ":return yield B(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})}))}})),Q=(e,t,i,r=[],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=r.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 Y(e,i),r={key:n.id,data:t};return c(n.id,r),t}return}const s=X(n,o,i),l=yield _(s,o);return(null==l?void 0:l.data)?l.data:l})),Y=(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=X(o,r,t),n=yield _(a,r);return yield K(n.data,i,!0,t)})),K=(e,i,r=!0,a)=>o(void 0,void 0,void 0,(function*(){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 T(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)}))}})),Z=(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},ee=(e,t,i=[],r,a,n)=>o(void 0,void 0,void 0,(function*(){try{if(null==e?void 0:e.cid){if(!N(e.cid))return void console.warn("请求已经执行!")}let o=e.tmpData.source.type,s=yield Q(e,o,i,r,n||!1);if(null==s||!s)return a&&a({error:!0}),Promise.resolve({error:!0});let l=yield K(s,e,t,i);return Z(e,l),a&&a(l),(null==e?void 0:e.cid)&&k(e.cid),Promise.resolve(l)}catch(e){return a&&a(e),$.error("Error in updateComData"),console.error("Error in updateComData:",e),Promise.reject(e)}})),te=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},ie=(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=>ie(e,t)));if("object"==typeof e&&null!==e){const i={};for(let r in e)i[r]=ie(e[r],t);return i}return e},re=(e,t)=>{const i=e.agency,r=e,{url:o=null,headers:a,params:n,requestType:s}=r,l=o?ie(o,t):void 0,d=a&&a.use?ie(a.value,t):{};return{url:l,requestType:s,params:n?ie(n,t):{},headers:d,agency:i}},oe=(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 ee({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&&ee(t,!0,i,e,(e=>{a(t,e)}),!1)}})))}})),ae=(e,t,i,r,a)=>o(void 0,void 0,void 0,(function*(){e&&(yield ee({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&&ee(r,!0,t,i,(e=>{a(r,e)}),!1)}})))}));class ne{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;console.log(this.mapField,e,"--------"),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 ne(e,t)}}class se{constructor(){this.variables=new Map,this.globalObservers=[],this.url=window.location.search,this.list=[]}clearVars(){this.list=[],this.variables.clear()}static getInstance(){return se.instance||(se.instance=new se),se.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}delVariable(e,t){this.variables.delete(e),this.list=this.list.filter((t=>t.mapField!=e)),t&&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=ne.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);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),t&&t(e),e.isUpdating=!1}};i?i.updateValue(e,r):this.addVariable(e,r)}getForkList(e){let t=this.isMapFieldInForkValues(e);return t||[]}editVariableForValue(e,t,i,r){const o=this.getVariable(e),a=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}};o&&o.updateWidthOriginalValue(t,a)}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 i;let r=[];for(const[,t]of this.variables)(t.id===e||(null===(i=t.id)||void 0===i?void 0:i.includes(e)))&&r.push(t);return t.uniq(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)}))}}se.instance=null;const le=se.getInstance(),de=(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))),ce=(e,t,i,r)=>{const o=((e,t,i,r)=>{var o;let a;if(de(e,null==t?void 0:t.field)||de(e,null==t?void 0:t.forkValue))a=e[null==t?void 0:t.field]||"";else if(de(e.data,null==t?void 0:t.field)||de(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},ue=(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&&ee(a,!0,i,r,(e=>{o({cid:a.cid,data:e})}))}})(e,i,a,n,s)}},he=(e,i,r,o,a,n,s,l,d,c)=>{const{cid:u,actions:h,index:p}=a,{eventName:f,mode:m}=h,g=2===m;((e,i,r,o,a,n)=>{let s=le.getVariableForId(i.cid);if(console.log("changeVarNew"),null==s?void 0:s.length)for(const l of s)if(l.type==e){let e=ce(i,l,r,o);le.editVariableForValue(l.mapField,e,(()=>{let e=a[l.mapField]||[],i=le.getForkList(l.mapField);if(i)for(const r of i){let i=a[r.mapField];e=t.concat(e,i)}n&&n(l,t.uniq(e))}))}})(f,a,o,u,r,((e,t)=>{if(oe(d,e.mapFile,le.getAllVariables(),o,((e,t)=>{s({cid:e.cid,data:t})})),null==t?void 0:t.length)for(const i of t){e.eventSourceId=i;const t=b(o,i);!(null==e?void 0:e.delayUpdate)&&t&&ee(t,!0,le.getAllVariables(),d,(e=>{s({cid:t.cid,data:e})}))}}));const v=((e,t,i,r,o)=>e.filter((e=>e.id===t&&e.eventType===i&&(!o||parseInt(e.index||"0")+1===parseInt(r||"0")))))(e,u,f,p,g);for(const e of v)ue(e,a,o,g,n,le.getAllVariables(),d,s,l)},pe=(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},fe=(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:pe(a,l),actions:o},baseData:ge(),dynamic:null,filePath:"",origin:"anov-ui",name:"",componentType:"",viewComName:e,optionComName:"AnOptionPanel",dataComName:"AnSourcePanel",eventComName:"AnActionsPanel",assemblyDeveloper:"",devEmail:"",version:"",devDept:""}},me=(e,i,r)=>{let o=fe(e,i);return r?t.merge(o,r):o},ge=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 ve{constructor(e,t,i){this.theme=null,this.plant=null,this.list=[],this.titleHeqadeHeight=70,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(),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}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=me("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{ve as ConfigOptimizer,se as GlobalVariables,M as Http,$ as Log,H as agentData,k as delFetchStatus,Z as editItem,he as emitEvent,Y as fetchDataByGlobal,Q as fetchDataByType,K as filterData,b as findItemDeep,y as findItemDeep2,L as getData,G as getDataForApi,J as getDataForSource,W as getDataForStatic,z as getDataForZb,B as getDataForZbCQ,u as getSessionData,l as getStandardData,m as getStringVars,ce as getVarDefaultVal,le as globalVars,v as hasVar,d as isJSON,f as recursion,w as safeEval,D as safeEvalForCode,N as setFetchStatus,c as setSessionData,oe as updataGlobalDataSourceForVar,ee as updateComData,ae as updateGlobalDataSource};
@@ -0,0 +1,201 @@
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
+ /**
49
+ * 计算接近的 width 值的均值
50
+ * @param data 数据项数组
51
+ * @returns 每个接近的 width 组的平均值数组
52
+ */
53
+ calculateMaxWidths(data: any[]): number[];
54
+ /**
55
+ * 查找最接近目标值的值
56
+ * @param target 目标值
57
+ * @param values 数组
58
+ * @returns 最接近目标值的值
59
+ */
60
+ private findClosestValue;
61
+ /**
62
+ * 调整数据项的高度并保持位置不变
63
+ * @param data 数据项数组
64
+ * @param targetHeight 目标高度
65
+ * @returns 调整后的数据项数组
66
+ */
67
+ private adjustHeightAndTop;
68
+ /**
69
+ * 找到离目标组件下方最近的组件,
70
+ * @param data 数据项数组
71
+ * @param targetComponent 目标组件
72
+ * @param excluded 要排除的组件列表
73
+ * @returns 最近的组件,如果没有找到符合条件的组件则返回 null
74
+ */
75
+ findNearestComponent(data: any[], targetComponent: any, excluded?: any[]): any | null;
76
+ /**
77
+ * 找到离目标组件下方最近的组件(两个顶点距离),
78
+ * @param data 数据项数组
79
+ * @param targetComponent 目标组件
80
+ * @param excluded 要排除的组件列表
81
+ * @returns 最近的组件,如果没有找到符合条件的组件则返回 null
82
+ */
83
+ findNearestComponentForPoint(data: any[], targetComponent: any, excluded?: any[]): any | null;
84
+ /**
85
+ * 找到离目标组件下方最近的组件(两个顶点距离)-标题,
86
+ * @param data 数据项数组
87
+ * @param targetComponent 目标组件
88
+ * @param excluded 要排除的组件列表
89
+ * @returns 最近的组件,如果没有找到符合条件的组件则返回 null
90
+ */
91
+ findNearestComponentForTitlePoint(data: any[], targetComponent: any, excluded?: any[]): any | null;
92
+ /**
93
+ * 找到离目标组件下方最近的组件(两个顶点距离)-标题,
94
+ * @param data 数据项数组
95
+ * @param targetComponent 目标组件
96
+ * @param excluded 要排除的组件列表
97
+ * @returns 最近的组件,如果没有找到符合条件的组件则返回 null
98
+ */
99
+ findNearestTitleForPoint(data: any[], targetComponent: any, excluded?: any[]): any | null;
100
+ getDistance(x1: number, y1: number, x2: number, y2: number): number;
101
+ findNearestComponent2(data: any[], targetComponent: any, excluded?: any[]): any | null;
102
+ /**
103
+ * 计算两个组件在垂直方向上的距离
104
+ * @param component1 第一个组件
105
+ * @param component2 第二个组件
106
+ * @returns 垂直方向上的距离
107
+ */
108
+ verticalDistance(component1: any, component2: any): number;
109
+ /**
110
+ *
111
+ * 判断两个组件是否相交或者离得比较近的函数
112
+ * @private
113
+ * @param {*} comp1
114
+ * @param {*} comp2
115
+ * @param {number} [threshold=10]
116
+ * @memberof ConfigOptimizer
117
+ */
118
+ private checkComponentIntersection;
119
+ /**
120
+ *
121
+ * 计算多个组件组合后的位置和大小
122
+ * @private
123
+ * @param {BaseData[]} components
124
+ * @memberof ConfigOptimizer
125
+ */
126
+ private calculateCombinedComponent;
127
+ /**
128
+ * 从输入字符串中提取数字和单位。
129
+ * @param inputStr 输入字符串,例如 '3,748,902万元'
130
+ * @returns 成功匹配到数字和单位时返回 [number, string],匹配失败时返回 [false, false]
131
+ */
132
+ private extractAmount;
133
+ /**
134
+ *
135
+ * 获取文本组件
136
+ * @private
137
+ * @return {*} {Array<any>}
138
+ * @memberof ConfigOptimizer
139
+ */
140
+ private getAnTextNormal;
141
+ /**
142
+ *
143
+ * 获取文本组件
144
+ * @private
145
+ * @return {*} {Array<any>}
146
+ * @memberof ConfigOptimizer
147
+ */
148
+ private getAnDeckTitle3;
149
+ private getAnTextNormaltText;
150
+ /**
151
+ *
152
+ * 判断复合替换的文本组件
153
+ * @private
154
+ * @return {*} {any[]}
155
+ * @memberof ConfigOptimizer
156
+ */
157
+ private judgeAnOdometer;
158
+ /**
159
+ *
160
+ * 转换文本组件为指标组件
161
+ * @private
162
+ * @memberof ConfigOptimizer
163
+ */
164
+ private createAnOdometer;
165
+ /**
166
+ *
167
+ * 优化头部装饰组件
168
+ * @memberof ConfigOptimizer
169
+ */
170
+ upgradeHeaderComponent(): void;
171
+ /**
172
+ *
173
+ * 优化标题装饰组件
174
+ * @memberof ConfigOptimizer
175
+ */
176
+ upgradeTitleComponent(): void;
177
+ containsFractionStructure(text: string): boolean;
178
+ /**
179
+ *
180
+ * 去除识别错误产生的标题组件
181
+ * @memberof ConfigOptimizer
182
+ */
183
+ removeErroneousComponents(): void;
184
+ /**
185
+ *
186
+ * 优化标题装饰组件和图表组件的组合
187
+ * @memberof ConfigOptimizer
188
+ */
189
+ upgradeGroupComponent(): void;
190
+ /**
191
+ *
192
+ * 优化标题装饰组件和图表组件的组合
193
+ * @param {*} titleComponen
194
+ * @param {any[]} titleList
195
+ * @param {any[]} [excluded=[]]
196
+ * @return {*} {number}
197
+ * @memberof ConfigOptimizer
198
+ */
199
+ upgradeComponentHeight(titleComponen: any, titleList: any[], excluded?: any[]): number;
200
+ getData(): any;
201
+ }
@@ -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 {};
@@ -1,5 +1,5 @@
1
- import { GlobalEvent, GlobalVar } from './type';
2
- import { GlobalDataSourceItem, GoComponent } from '../fetchUtils/type';
1
+ import { GlobalEvent, GlobalVar } from "./type";
2
+ import { GlobalDataSourceItem, GoComponent } from "../fetchUtils/type";
3
3
  export declare const filterCurrentEvent: (globalEvents: GlobalEvent[], cid: string, eventName: string, index: any, isMode2: boolean) => GlobalEvent[];
4
4
  /**
5
5
  * 处理 dynamic 类型事件
@@ -35,17 +35,17 @@ export declare const handleToggleEvent: (item: any, element: GoComponent, list:
35
35
  */
36
36
  export declare const handleUpdateEvent: (item: any, list: any, globalVars: GlobalVar[], globalSource?: GlobalDataSourceItem[], updataSourceForComponent?: any) => void;
37
37
  /**
38
- * 处理不同类型的事件
39
- * @param {Object} item - 当前事件
40
- * @param {GoComponent} element - 当前组件
41
- * @param {Object} list - 组件列表
42
- * @param {boolean} isMode2 - 是否为模式2
43
- * @param {Function} changeShow - 更新组件显示状态的函数
44
- * @param {Function} callback - 回调函数
45
- * @param {GlobalVar[]} globalVars - 全局变量列表
46
- * @param {GlobalDataSourceItem[]} globalSource - 全局数据源列表
47
- * @param {Function} updataSourceForComponent - 更新组件数据的函数
48
- */
38
+ * 处理不同类型的事件
39
+ * @param {Object} item - 当前事件
40
+ * @param {GoComponent} element - 当前组件
41
+ * @param {Object} list - 组件列表
42
+ * @param {boolean} isMode2 - 是否为模式2
43
+ * @param {Function} changeShow - 更新组件显示状态的函数
44
+ * @param {Function} callback - 回调函数
45
+ * @param {GlobalVar[]} globalVars - 全局变量列表
46
+ * @param {GlobalDataSourceItem[]} globalSource - 全局数据源列表
47
+ * @param {Function} updataSourceForComponent - 更新组件数据的函数
48
+ */
49
49
  export declare const handleEventType: (item: any, element: GoComponent, list: any, isMode2: boolean, changeShow: (props: {
50
50
  cid: string;
51
51
  flag: boolean;
@@ -1,6 +1,6 @@
1
- import { GlobalEvent, GlobalVar } from './type';
2
- import { GlobalDataSourceItem, GoComponent } from '../fetchUtils/type';
3
- import { getVarDefaultVal } from './changeVar';
1
+ import { GlobalEvent, GlobalVar } from "./type";
2
+ import { GlobalDataSourceItem, GoComponent } from "../fetchUtils/type";
3
+ import { getVarDefaultVal } from "./changeVar";
4
4
  export { getVarDefaultVal };
5
5
  /**
6
6
  * 触发并处理组件事件
@@ -1,4 +1,4 @@
1
- import { BasicVariable, BasicVariableParams } from './BasicVariable';
1
+ import { BasicVariable, BasicVariableParams } from "./BasicVariable";
2
2
  type CallbackFunction = (result?: any) => void;
3
3
  interface GlobalObserver {
4
4
  update(variable: BasicVariable): void;
@@ -16,6 +16,7 @@ declare class GlobalVariables {
16
16
  getAllUrlParams(): {
17
17
  [key: string]: string;
18
18
  };
19
+ delVariable(mapField: string, callback?: CallbackFunction): void;
19
20
  addUrlParamsToGlobalVars(): void;
20
21
  addVariables(variablesData: BasicVariableParams[] | BasicVariableParams): void;
21
22
  addVariable(variableData: BasicVariableParams, callback?: CallbackFunction): BasicVariable;
@@ -24,7 +25,13 @@ declare class GlobalVariables {
24
25
  creatVarJson(item: BasicVariable | BasicVariableParams): any;
25
26
  private addToObjectArray;
26
27
  editVariable(variableData: BasicVariableParams, callback?: CallbackFunction): void;
27
- editVariableForValue(mapfield: string, value: any, callback?: CallbackFunction): void;
28
+ /**
29
+ *
30
+ *
31
+ * @memberof GlobalVariables
32
+ */
33
+ getForkList(mapFiled: string): any[];
34
+ editVariableForValue(mapfield: string, value: any, callback?: CallbackFunction, callback2?: CallbackFunction): void;
28
35
  isMapFieldInForkValues(mapField: string): BasicVariable[];
29
36
  private isVariableNameExist;
30
37
  checkExist(parameter: string | string[], cid: string): false | {
@@ -1,5 +1,6 @@
1
1
  export * from "./fetchUtils";
2
2
  export * from "./log";
3
3
  export * from "./event";
4
- export * from './tool';
5
- export * from './globalVars';
4
+ export * from "./tool";
5
+ export * from "./globalVars";
6
+ export * from "./ConfigOptimizer";
@@ -0,0 +1,7 @@
1
+ interface ThemeParams {
2
+ depends: boolean;
3
+ [prop: string]: any;
4
+ }
5
+ export declare function setInitialColorByTheme(params: ThemeParams): void;
6
+ export declare function setColorByTheme(params: ThemeParams): void;
7
+ export {};
@@ -73,3 +73,11 @@ export declare function safeEval(code: string, params: any, globalVars?: any): a
73
73
  * @returns {any} - 执行结果或默认参数值
74
74
  */
75
75
  export declare function safeEvalForCode(code: string, _params: any): any;
76
+ /**
77
+ * 设置请求状态
78
+ *
79
+ * @param {string} fetchId
80
+ * @return {*}
81
+ */
82
+ export declare const setFetchStatus: (fetchId: string) => any;
83
+ export declare const delFetchStatus: (fetchId: string) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdslib/go-utils",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "go-core utils",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/types/index.d.ts",