yxuse 3.0.89 → 3.0.91
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/lib/index.cjs12.js +1 -1
- package/lib/index.cjs5.js +1 -1
- package/lib/index.cjs5.js.gz +0 -0
- package/lib/index.es12.js +18 -0
- package/lib/index.es12.js.gz +0 -0
- package/lib/index.es5.js +1 -1
- package/lib/index.es5.js.gz +0 -0
- package/package.json +1 -1
- package/types/components/CommonPage/index.d.ts +3 -0
- package/types/components/CommonPage/page.d.ts +64 -0
- package/types/components/CommonPage/pagination.d.ts +9 -0
- package/types/components/CommonPage/props.d.ts +36 -0
- package/types/components/CommonPage/search.d.ts +4 -0
- package/types/components/CommonPage/table.d.ts +3 -0
- package/types/components/CommonPage/type.d.ts +1 -0
- package/types/utils/http/index.d.ts +8 -0
package/lib/index.cjs12.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=Object.defineProperty,t=(t,s,r)=>((t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r)(t,"symbol"!=typeof s?s+"":s,r);const s=require("./vendor-axios.cjs.js"),r=require("element-plus");require("element-plus/es/components/notification/style/index"),require("element-plus/es/components/message/style/index"),require("element-plus/es/components/message/style/css"),require("element-plus/es/components/notification/style/css"),require("element-plus/es/components/message-box/style/index"),require("./vendor-dayjs.cjs.js"),require("element-plus/es/components/loading/style/index"),require("element-plus/es/components/loading/style/css"),require("./vendor-mqtt.cjs.js");const o={ttc:{LOGIN_URL:`${window.location.origin}/ttc/cloud/#/login`,HOME_URL:`${window.location.origin}/ttc/cloud/#/cloud`,INTEGRATED_BASE_URL:"/gateway/integrated-management/api/v1"}},n=(e="ttc")=>{p({token:""})},a=(e="ttc")=>{const t=`${e}GlobalState`,s=localStorage.getItem(t)??"{}";return JSON.parse(s)?JSON.parse(s).token:null},i=async({userName:e,password:t},s="ttc")=>{const o=d("loginApiUrl"),{data:n}=await N.post(o,{userName:e,password:t});n.tokenValue&&r.ElMessage.success("登录成功"),p({token:n.tokenValue,userInfo:n})},l=()=>{if(
|
|
1
|
+
"use strict";var e=Object.defineProperty,t=(t,s,r)=>((t,s,r)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r)(t,"symbol"!=typeof s?s+"":s,r);const s=require("./vendor-axios.cjs.js"),r=require("element-plus");require("element-plus/es/components/notification/style/index"),require("element-plus/es/components/message/style/index"),require("element-plus/es/components/message/style/css"),require("element-plus/es/components/notification/style/css"),require("element-plus/es/components/message-box/style/index"),require("./vendor-dayjs.cjs.js"),require("element-plus/es/components/loading/style/index"),require("element-plus/es/components/loading/style/css"),require("./vendor-mqtt.cjs.js");const o={ttc:{LOGIN_URL:`${window.location.origin}/ttc/cloud/#/login`,HOME_URL:`${window.location.origin}/ttc/cloud/#/cloud`,INTEGRATED_BASE_URL:"/gateway/integrated-management/api/v1"}},n=(e="ttc")=>{p({token:""})},a=(e="ttc")=>{const t=`${e}GlobalState`,s=localStorage.getItem(t)??"{}";return JSON.parse(s)?JSON.parse(s).token:null},i=async({userName:e,password:t},s="ttc")=>{const o=d("loginApiUrl"),{data:n}=await N.post(o,{userName:e,password:t});n.tokenValue&&r.ElMessage.success("登录成功"),p({token:n.tokenValue,userInfo:n})},l=()=>{if(h()){n();if(location.pathname.includes(u()))return;location.replace(u())}else{const e=window.prompt("当前系统处于开发环境,当前登录过期,请输入登录账号","");if(null!==e){const t=window.prompt("请输入登录密码","");null!==t&&""!=t||window.prompt("请输入登录密码",""),i({userName:e,password:t})}}},c=()=>{window.location.replace(g())},u=()=>d("loginUrl"),g=()=>d("homeUrl"),p=(e,t="ttc")=>{const s=localStorage.getItem(`${t}GlobalState`)??"{}",r={...JSON.parse(s),...e};localStorage.setItem(`${t}GlobalState`,JSON.stringify(r))},m=(e,t,s="ttc")=>{const r=localStorage.getItem(`${s}GlobalState`)??"{}",o={...JSON.parse(r),[e]:t};localStorage.setItem(`${s}GlobalState`,JSON.stringify(o))},d=(e,t="ttc")=>JSON.parse(localStorage.getItem(`${t}GlobalState`)??"{}")[e]??"",h=()=>"production"===d("environment"),R=e=>{if(!e)return!1;const t=sessionStorage.getItem("ttcUserBtnList")??"[]";return JSON.parse(t).includes(e)};let S=null;const f=async()=>{if(S)return S;const e=await N.get(d("userConfigApiUrl"),{},{headers:{noLoading:!0},customResHandler:e=>e});return S=e,e},E=Object.freeze(Object.defineProperty({__proto__:null,autoLogin:i,changeSystemConfig:m,getHomeUrl:g,getLoginUrl:u,getSystemConfig:d,getToken:a,getUserConfig:f,getUserInfo:(e="ttc")=>{const t=`${e}GlobalState`,s=localStorage.getItem(t)??"{}";return JSON.parse(s)?JSON.parse(s).userInfo:null},getUserIsHaveBtnPower:R,getUserPermissions:async(e,t=!0,s)=>{if(!a()&&t)return l();try{const{data:t}=await((e="ttc")=>N.get(`${o[e].INTEGRATED_BASE_URL}/account/auth/route/list`))(s),r=t.filter((t=>t.routeTag.startsWith(e))),n=r.filter((e=>"VIEW"===e.routeType)),a=r.filter((e=>"BTN"===e.routeType));return sessionStorage.setItem("ttcUserBtnList",JSON.stringify(a.map((e=>e.routeTag)))),{userMenuList:n,userBtnList:a}}catch(r){}},getUserRouteList:async()=>{if(!a())return[];return await((e="ttc")=>N.get(`${o[e].INTEGRATED_BASE_URL}/account/home/menu`))()},getUserRouter:(e,t)=>{let s=[];return e.forEach((e=>{const r=`/src/views${e.routeView}/index.vue`;if(t[r]){const o=(null==e?void 0:e.reservedRouteInfo)&&JSON.parse((null==e?void 0:e.reservedRouteInfo)??"{}"),n={path:e.routeView,name:e.routeView.split("/")[1],meta:{title:e.routeName,icon:null==o?void 0:o.routeIcon},component:t[r]};s.push(n)}})),s},isProduction:h,jumpToHome:c,jumpToLogin:l,removeToken:n,setSystemConfig:p,setSystemInfo:(e,t)=>{const s=`${e}GlobalState`;localStorage.setItem(s,JSON.stringify(t))},setUserInfo:(e,t)=>{const s=`${e}GlobalState`,r=localStorage.getItem(s)??"{}",o={...JSON.parse(r),userInfo:t};localStorage.setItem(s,JSON.stringify(o))}},Symbol.toStringTag,{value:"Module"}));let I;const b={lock:!0,text:"loading...",fullscreen:!0,background:"rgba(0, 0, 0, 0.6)"};let v=0;const M=()=>{0===v&&(I=r.ElLoading.service(b)),v++},w=()=>{v<=0||(v--,0===v&&I.close())};var y=(e=>(e[e.SUCCESS=200]="SUCCESS",e[e.ERROR=500]="ERROR",e[e.OVERDUE=401]="OVERDUE",e[e.TIMEOUT=3e4]="TIMEOUT",e))(y||{});const U=(e,t)=>{switch(e){case 400:r.ElMessage.error(t||"请求失败!请您稍后重试");break;case 401:r.ElMessage.error(t||"登录失效!请您重新登录"),location.href.includes(u())||l();break;case 403:r.ElMessage.error(t||"当前账号无权限访问!");break;case 404:r.ElMessage.error("你所访问的资源不存在");break;case 405:r.ElMessage.error(t||"请求方式错误!请您稍后重试");break;case 408:r.ElMessage.error(t||"请求超时!请您稍后重试");break;case 500:r.ElMessage.error(t||"服务异常!");break;case 502:r.ElMessage.error(t||"网关错误!");break;case 503:r.ElMessage.error(t||"服务不可用");break;case 504:r.ElMessage.error(t||"网关超时!");break;default:r.ElMessage.error(t||"请求失败!请您稍后重试!")}};d("isTranslateApi");const N=new class{constructor(e){t(this,"service"),t(this,"customResMap"),t(this,"customResquestInterceptors"),t(this,"customResponseInterceptors"),t(this,"customGlobalResHandler"),this.service=s.axios.create(e),this.setupInterceptors(),this.customResMap={}}setupInterceptors(){this.service.interceptors.request.use((e=>{var t;return(null==(t=e.headers)?void 0:t.noLoading)||M(),e.headers.token=a(),(null==e?void 0:e.customResHandler)&&(null==e?void 0:e.url)&&(this.customResMap[null==e?void 0:e.url]=e.customResHandler),this.customResquestInterceptors&&this.customResquestInterceptors(e),e}),(e=>Promise.reject(e))),this.service.interceptors.response.use((async e=>{const{config:t}=e;let s=e.data;if(w(),this.customResponseInterceptors)return this.customResponseInterceptors(e);if(this.customGlobalResHandler){if(!this.customGlobalResHandler(e))return}const r=e.status;return t.url&&this.customResMap[t.url]?this.customResMap[t.url](s,e):(r==y.OVERDUE||s.code===y.OVERDUE?this.handleOverdueResponse(s):s.code!==y.SUCCESS&&this.handleErrorResponse(s),s)}),(e=>{w();const t=e.response,{config:s}=e;if(this.customResponseInterceptors)return this.customResponseInterceptors(t);if(this.customGlobalResHandler){if(!this.customGlobalResHandler(t))return}return(null==s?void 0:s.url)&&this.customResMap[s.url]?this.customResMap[s.url](e.response):(e.message.includes("timeout")?r.ElMessage.error("请求超时!请稍后重试"):e.message.includes("Network Error")&&r.ElMessage.error("网络错误!请稍后重试"),t&&U(t.status,this.getResMessage(t.data)),window.navigator.onLine||r.ElNotification({title:"提示",message:"当前网络似乎开小差了",type:"warning",duration:5e3}),Promise.reject(e))}))}getResMessage(e){return(null==e?void 0:e.resultMsg)??(null==e?void 0:e.message)??(null==e?void 0:e.msg)??null}handleOverdueResponse(e){return r.ElNotification({title:"登录过期提醒",message:this.getResMessage(e)||"当前登录失效",type:"warning",duration:5e3}),l(),Promise.reject(e)}handleErrorResponse(e){return this.getResMessage(e)?r.ElMessage.error(this.getResMessage(e)):U(e.status),Promise.reject(e)}get(e,t,s={}){return this.service.get(e,{params:t,...s})}post(e,t,s={}){return this.service.post(e,t,s)}put(e,t,s={}){return this.service.put(e,t,s)}delete(e,t,s={}){return this.service.delete(e,{params:t,...s})}interceptorsRequestCallback(e){this.customResquestInterceptors=e}interceptorsResponseCallback(e){this.customResponseInterceptors=e}customGlobalResHandlerCallback(e){this.customGlobalResHandler=e}}({timeout:3e4,withCredentials:!0});exports.BC_LANG_NAME="LANG",exports.BC_THEME_NAME="THEME",exports.URL=o,exports.changeSystemConfig=m,exports.checkStatus=U,exports.getSystemConfig=d,exports.getToken=a,exports.getUserConfig=f,exports.getUserIsHaveBtnPower=R,exports.hideFullScreenLoading=w,exports.http=N,exports.index=E,exports.jumpToHome=c,exports.setSystemConfig=p,exports.showFullScreenLoading=M;
|
package/lib/index.cjs5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,o=e=>{throw TypeError(e)},n=(e,o,n)=>((e,o,n)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n)(e,"symbol"!=typeof o?o+"":o,n),s=(e,t,n)=>(((e,t,n)=>{t.has(e)||o("Cannot "+n)})(e,t,"read from private field"),n?n.call(e):t.get(e));const a=require("./index.cjs4.js"),r=require("vue");require("xlsx"),require("./vendor-file-saver.cjs.js"),require("xlsx-js-style");const l=require("./vendor-sortablejs.cjs.js");require("element-plus");const i=require("./index.cjs12.js"),c=require("./index.cjs13.js"),d=require("./index.cjs14.js");require("element-plus/es/components/message/style/index"),require("element-plus/es/components/loading/style/index"),require("element-plus/es/components/message/style/css"),require("element-plus/es/components/loading/style/css"),require("./vendor-mqtt.cjs.js");const u=require("./vendor-localforage.cjs.js");require("element-plus/es/components/message-box/style/index"),require("./vendor-dayjs.cjs.js");const h=require("./vendor-lodash.cjs.js");require("./index.cjs7.js"),require("./index.cjs11.js"),require("element-plus/es/components/dialog/style/index"),require("element-plus/es/components/button/style/index"),require("element-plus/es/components/drawer/style/index");const m={loginUrl:"/ttc/cloud/#/login",homeUrl:"/ttc/cloud/#/cloud",lang:"zh",themeApiUrl:"/gateway/integrated-management/api/v1/theme/list",loginApiUrl:"/gateway/integrated-management/api/v1/account/login",translateApiUrl:"/gateway/integrated-management/api/v1/translate/get",userConfigApiUrl:"/gateway/integrated-management/api/v1/basic/data/frontendConfig",environment:"production",isRenderToolbar:!0,isRenderIssue:!0,isRenderLang:!1,systemKey:"",isTranslateApi:!1,whitelistTranslateApi:[]},p=(e,t)=>{const o=e.__vccOpts||e;for(const[n,s]of t)o[n]=s;return o};const g=r.ref(),y=(e,{rowData:t})=>{let o;const{renderType:n,event:s={},prop:a,label:l,config:i={}}=e;if(!a||!n)return null;const c=r.resolveComponent("el-"+n),{options:d=[],...u}=i;if("cascader"===n)return r.createVNode(r.resolveComponent("el-cascader"),r.mergeProps({modelValue:t[a],"onUpdate:modelValue":e=>t[a]=e,placeholder:`请选择${l}`,options:d},s,u),null);const h=["select","cascader"].includes(n),m=t[a];var p;return r.createVNode(c,r.mergeProps({modelValue:m,"onUpdate:modelValue":e=>{t[a]="number"===(null==i?void 0:i.type)?Number(e):e},placeholder:`请${h?"选择":"输入"}${l}`},s,u),"function"==typeof(p=o=d&&0!==d.length?"select"===n?d.map((e=>r.createVNode(r.resolveComponent("el-option"),{label:e.label,value:e.value,key:e.value},null))):"radio-group"===n?d.map((e=>r.createVNode(r.resolveComponent("el-radio"),{label:e.value,key:e.value},{default:()=>[e.label]}))):null:null)||"[object Object]"===Object.prototype.toString.call(p)&&!r.isVNode(p)?o:{default:()=>[o]})},w=r.defineComponent({name:"YxTablePro",props:{tableData:{type:Array,default:()=>[]},rowKey:{type:String,default:"",required:!1},columns:{type:[Array,Function],default:()=>[]},pageInfo:{type:Object,default:()=>{},required:!1},sort:{type:Boolean,default:!1,required:!1}},emits:["operate-handle","update-page","sort-end"],setup(e,{emit:t,attrs:o,expose:n}){const s=r.ref([]),{tableData:a,rowKey:i,pageInfo:c}=e;r.onBeforeMount((()=>{d()})),r.onMounted((()=>{r.nextTick((()=>{u()}))})),r.watch((()=>e.columns),(()=>{d()})),n({tableProRef:g});const d=async()=>{const t="function"==typeof e.columns?await e.columns():e.columns;s.value=t.filter((e=>!e.show||e.show(e))).map((e=>{var t;const{width:o,...n}=e;return(null==e?void 0:e.renderType)&&["select","cascader"].includes(null==e?void 0:e.renderType)&&(null==(t=null==e?void 0:e.config)?void 0:t.loadOptions)&&(async e=>{(null==e?void 0:e.options)&&0===(null==e?void 0:e.options.length)&&(null==e?void 0:e.loadOptions)&&"function"==typeof(null==e?void 0:e.loadOptions)&&(e.options=await(null==e?void 0:e.loadOptions()))})(e.config),{flexGrow:o?0:1,width:o??100,cellRenderer:t=>h(e,t),headerCellRenderer:e.headerRender??null,title:e.label,dataKey:e.prop,key:e.prop,...n}}))},u=()=>{var o,n,s;if(!e.sort)return;const a=null==(s=null==(n=null==(o=g.value)?void 0:o.$el)?void 0:n.querySelector(".el-table-v2__body").children[0])?void 0:s.children[0];l.Sortable.create(a,{animation:200,sort:!0,handle:e.sortHandle?`.${e.sortHandle}`:null,onEnd:({oldIndex:e,newIndex:o})=>{t("sort-end",e,o)}})},h=(e,t)=>"operate"===(null==e?void 0:e.renderType)?m(e,t):(null==e?void 0:e.renderType)&&"operate"!==(null==e?void 0:e.renderType)?y(e,t):(null==e?void 0:e.render)?e.render(t,t.rowIndex,e):"index"===e.type?r.createVNode("span",{class:"w-full"},[t.rowIndex+1]):t.rowData[t.column.dataKey],m=(e,{rowIndex:o,rowData:n})=>{var s,a;return r.createVNode("div",{class:`flex justify-center items-center cursor-pointer gap-10 ${(null==(s=e.config)?void 0:s.className)??""}`},[null==(a=e.operate)?void 0:a.filter((e=>!e.show||e.show(n))).map((e=>{if(null==e?void 0:e.render)return e.render(n,o);const s="function"==typeof(null==e?void 0:e.disabled)?e.disabled(n,o):(null==e?void 0:e.disabled)??!1;return r.createVNode("span",{onClick:r.withModifiers((()=>{s||((null==e?void 0:e.onClick)&&(null==e||e.onClick(n,o)),t("operate-handle",e.key,n,o))}),["stop"]),class:`table-handle whitespace-nowrap ${(null==e?void 0:e.className)??""} ${s?"table-handle-disabled":""}`},[e.label])}))])},p=()=>{if(!c||0===c.total)return null;return r.createVNode("div",{class:"pagination-wrap"},[r.createVNode(r.resolveComponent("el-pagination"),{currentPage:c.pageIndex,"onUpdate:currentPage":e=>c.pageIndex=e,pageSize:c.pageSize,"onUpdate:pageSize":e=>c.pageSize=e,small:!1,disabled:!1,"page-sizes":[10,20,50,100],layout:(null==c?void 0:c.layout)?null==c?void 0:c.layout:"total,sizes,prev, pager, next",background:!1,total:c.total,onSizeChange:e=>{t("update-page","pageSize",e)},onCurrentChange:e=>{t("update-page","pageIndex",e)}},null)])},w=e=>e-(c&&0!==c.total?52:0);return()=>r.createVNode(r.resolveComponent("el-auto-resizer"),null,{default:({width:e,height:t})=>r.createVNode("div",{class:"w-full h-full"},[r.createVNode(r.resolveComponent("el-table-v2"),r.mergeProps({border:!0,"row-key":i,width:e,height:w(t),columns:s.value,data:a},o,{ref:g}),null),p()])})}});Array.prototype.handler=function(e){return e(this)};const f={status:!1,toolDom:null,panelWidth:200,panelHeight:200,mousePoint:{x:0,y:0}};function v(e){return document.querySelector(e)}const T={data:()=>f,mounted(){this.getAllDom(),this.move()},computed:{panelWidthPX(){return this.panelWidth+"px"},panelHeightPX(){return this.panelHeight+"px"}},methods:{getAllDom(){this.wrapDom=v("#toolbar-wrap"),this.toolDom=v("#toolbar-wrap .tool"),this.panelDom=v("#toolbar-wrap .panel")},move(){!function(e){let t=0,o=0;e.onmousedown=n=>{t=n.clientX-e.offsetLeft,o=n.clientY-e.offsetTop;const s=n=>{n.stopPropagation(),n.preventDefault();const s=n.clientX,a=n.clientY;let r=s-t,l=a-o;r<0&&(r=0),l<0&&(l=0),r>document.body.clientWidth-e.clientWidth&&(r=document.body.clientWidth-e.clientWidth),l>document.body.clientHeight-e.clientHeight&&(l=document.body.clientHeight-e.clientHeight),e.style.left=r+"px",e.style.top=l+"px"},a=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",s),document.addEventListener("mouseup",a)}}(this.toolDom)}}},x={xmlns:"http://www.w3.org/2000/svg",width:"50",height:"50",fill:"none",viewBox:"0 0 16 16"};const b={render:function(e,t){return r.openBlock(),r.createElementBlock("svg",x,t[0]||(t[0]=[r.createStaticVNode('<g stroke="currentColor" stroke-linejoin="round" stroke-width="1.333" clip-path="url(#a)"><path d="M8 14.666c1.986 0 .778-2.954 2-4.333 1.042-1.176 4.666-.638 4.666-2.333A6.667 6.667 0 1 0 8 14.666Z"></path><path d="M9.333 5.667a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5.333 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5.667 11.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"></path></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"></path></clipPath></defs>',2)]))}},k={xmlns:"http://www.w3.org/2000/svg",width:"50",height:"50",fill:"none",viewBox:"0 0 16 16"};const C={render:function(e,t){return r.openBlock(),r.createElementBlock("svg",k,t[0]||(t[0]=[r.createElementVNode("g",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.333"},[r.createElementVNode("path",{"stroke-linejoin":"round",d:"M13.333 11v3a.667.667 0 0 1-.666.667H10.5M13.334 5.333V2a.667.667 0 0 0-.667-.667H3.334A.667.667 0 0 0 2.667 2v12c0 .368.298.666.667.666h2"}),r.createElementVNode("path",{d:"M5.333 5.333H10M7.667 14.667l5.667-7M5.333 8H8"})],-1)]))}},N={width:"1.2em",height:"1.2em",viewBox:"0 0 24 24"};const E={render:function(e,t){return r.openBlock(),r.createElementBlock("svg",N,t[0]||(t[0]=[r.createElementVNode("path",{fill:"currentColor",d:"m18.5 10 4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10zM10 2v2h6v2h-1.968a18.2 18.2 0 0 1-3.62 6.301 15 15 0 0 0 2.336 1.707l-.751 1.878A17 17 0 0 1 9 13.725a16.7 16.7 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18 18 0 0 1 4.767 8h2.24A16 16 0 0 0 9 10.877a16.2 16.2 0 0 0 2.91-4.876L2 6V4h6V2zm7.5 10.885L16.253 16h2.492z"},null,-1)]))}};u.localforage.config({name:"yxI18n"});const V=async(e,t)=>{await u.localforage.setItem(e,t)},I=async e=>await u.localforage.getItem(e),S={URL:i.getSystemConfig("translateApiUrl")||"/gateway/integrated-management/api/v1/translate/get"},B=async({words:e,systemFlag:t,toSource:o="en",fromSource:n="zh",translateApiUrl:s})=>{try{const{data:a}=await i.http.post(s||S.URL,{words:e,systemFlag:t,toSource:o,fromSource:n},{headers:{noLoading:!0}});return a.dstMap||{}}catch(a){return null}},L=`${i.getSystemConfig("systemKey")}_${window.lang}`,_=["/gateway/integrated-management/api/v1/theme/list","/gateway/integrated-management/api/v1/translate/get",...i.getSystemConfig("whitelistTranslateApi")],M=async e=>{let t=JSON.stringify(e);const o=t.match(/[\u4e00-\u9fa5]+/g),n=await(async()=>{const e=await I("lang");return await I(`${i.getSystemConfig("systemKey")}_${e}`)})();let s=[];if(o){for(const e of o)n[e]?t=t.replace(new RegExp(e,"g"),n[e]):s.includes(e)||s.push(e);if(s.length>0){const e=await async function(e){const t=await B({words:e,toSource:window.lang,systemFlag:i.getSystemConfig("systemKey")});return t}(s);s.forEach((o=>{t=t.replace(new RegExp(o,"g"),e[o])}));const o={...n,...e};await V(L,o),s=[]}}return JSON.parse(t)};const A=/[\u4e00-\u9fa5]+/;let W;const j=["svg","g","path","polyline","circle"],P={childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["readonly","placeholder","aria-expanded"]};let U;const D=new class{constructor(){n(this,"from"),n(this,"to"),n(this,"yxI18nThesaurus"),n(this,"systemKey"),n(this,"asyncThesaurusList"),n(this,"dbKey"),n(this,"unknownWords"),n(this,"unknownWordsNode"),n(this,"rootDocument"),n(this,"unknownWordsInputNode"),n(this,"translateApiUrl"),n(this,"maxWordsLength"),this.from="zh",this.to="en",this.yxI18nThesaurus={},this.systemKey="station-control",this.dbKey="",this.initTranslate=this.initTranslate.bind(this),this.unknownWords=[],this.unknownWordsNode=new Map,this.unknownWordsInputNode=new Map,this.rootDocument=null,this.translateApiUrl=null,this.maxWordsLength=100}async initTranslate({to:e,systemKey:t,translateApiUrl:o,asyncThesaurusList:n}){if("zh"!==e){if("cht"===e)return this.handleTraditionalChinese();o&&(this.translateApiUrl=o),await this.initConfig({to:e,systemKey:t,asyncThesaurusList:n}),this.observerRouteChange()}}handleTraditionalChinese(){document.body.style.fontFamily="PingFang SC",document.body.style["font-variant-east-asian"]="traditional",document.documentElement.lang="zh-tw"}observerRouteChange(){U=new MutationObserver((e=>{e.length>0&&e.forEach(((e,t)=>{switch(e.type){case"characterData":this.handleTextNodes(e.target);break;case"childList":this.handleChildListMutation(e);break;case"attributes":"placeholder"===e.attributeName&&A.test(e.target.placeholder)?this.replaceInputValue(e.target,"placeholder"):"readonly"===e.attributeName?(this.replaceInputValue(e.target,"value"),this.replaceInputValue(e.target,"placeholder")):"aria-expanded"===e.attributeName&&"false"===e.target.ariaExpanded&&setTimeout((()=>{this.replaceInputValue(e.target,"value")}),0)}}))})),U.observe(this.rootDocument,P);const e=U.takeRecords();e.length>0&&e.forEach((e=>{}))}handleTextNodes(e){if(A.test(null==e?void 0:e.data)||A.test(null==e?void 0:e.nodeValue)){const t=e.nodeValue.replace(/\s/g,"");this.yxI18nThesaurus[t]?e.nodeValue=this.yxI18nThesaurus[t]:(!this.unknownWords.includes(t)&&t.length<=this.maxWordsLength&&this.unknownWords.push(t),this.collectNeedsTranslateNode(e,t))}}handleChildListMutation(e){if(e.addedNodes.length>0&&e.removedNodes.length>0)return this.addedNode(e);e.removedNodes.length>0&&"nprogress"!==e.removedNodes[0].id||this.addedNode(e)}addedNode(e){var t,o,n;if(e.addedNodes.length>0){const s=e.target.tagName.toLowerCase();if(j.includes(s))return;if(j.includes(null==(o=null==(t=e.addedNodes[0])?void 0:t.tagName)?void 0:o.toLowerCase()))return;const a=null==(n=e.addedNodes[0])?void 0:n.className,r=e.target.nodeValue;if(a&&""!==a)a.includes("v-modal")?this.throttleTraversingNode(e.previousSibling):a.includes("tooltip")||a.includes("message")||a.includes("loading")?this.throttleTraversingNode(e.addedNodes[0]):r?this.replaceValue("nodeValue",e.target):(A.test(e.addedNodes[0].innerText)||a.includes("input"))&&this.throttleTraversingNode(e.addedNodes[0]);else{const t=e.addedNodes[0];t&&t.nodeType===Node.TEXT_NODE&&A.test(t.nodeValue)?this.replaceValue("nodeValue",t):this.throttleTraversingNode(t)}}else this.throttleTraversingNode(e.target),this.replaceDocumentTitle()}startMicroTaskQueue(){W&&clearTimeout(W),W=setTimeout((()=>{if(this.replaceDocumentTitle(),this.unknownWords.length>0){h._.throttle((()=>this.translateUnknownWords(this.unknownWords,this.unknownWordsNode.size)),1e3,{leading:!0})()}else{if(this.unknownWordsInputNode.size>0){for(const e of this.unknownWordsInputNode.values())this.replaceInputValue(e,"placeholder",!0),""!==e.value&&this.replaceInputValue(e,"value",!0);this.unknownWordsInputNode.clear()}this.replaceUnknownWordsNodeList(!0)}}),500)}throttleTraversingNode(e){h._.throttle((()=>this.traversingNode(e)),500,{leading:!0})()}traversingNode(e){if(!e)return;const t=e=>this.replaceTextByNode(e),o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode:e=>e.tagName&&"svg"===e.tagName.toLowerCase()?NodeFilter.FILTER_REJECT:(t(e),NodeFilter.FILTER_SKIP)});let n;for(;n=o.nextNode();)t(n)}replaceTextByNode(e,t=!1){e.title&&A.test(e.title)&&this.replaceValue("title",e),e.nodeType===Node.ELEMENT_NODE?["textarea","input"].includes(e.tagName.toLowerCase())&&(A.test(e.placeholder)&&this.replaceInputValue(e,"placeholder"),e.value&&A.test(e.value)&&this.replaceInputValue(e,"value"),""!==e.value&&e.readOnly&&this.collectNeedsTranslateInputNode(e)):e.nodeType===Node.TEXT_NODE&&(A.test(e.nodeValue)||A.test(e.data))&&this.replaceValue("nodeValue",e,t)}replaceInputValue(e,t,o=!1){const n=e[t];A.test(n)&&(this.yxI18nThesaurus[n]?e[t]=this.yxI18nThesaurus[n]:(!this.unknownWords.includes(n)&&n.length<=this.maxWordsLength&&this.unknownWords.push(n),o||this.collectNeedsTranslateInputNode(e)))}collectNeedsTranslateInputNode(e){const t=Math.random().toString(16).split(".")[1];this.unknownWordsInputNode.has(t)||(this.unknownWordsInputNode.set(t,e),this.startMicroTaskQueue())}replaceDocumentTitle(){const e=document.title;A.test(e)&&this.yxI18nThesaurus[e]&&(document.title=this.yxI18nThesaurus[e])}collectNeedsTranslateNode(e){const t=Math.random().toString(16).split(".")[1];this.unknownWordsNode.has(t)||(this.unknownWordsNode.set(t,e),this.startMicroTaskQueue())}replaceValue(e,t,o=!1){if(""===t[e])return;const n=t[e].replace(/\s/g,"");this.yxI18nThesaurus[n]?t[e]=this.yxI18nThesaurus[n]:(!this.unknownWords.includes(n)&&n.length<=this.maxWordsLength&&this.unknownWords.push(n),o?this.startMicroTaskQueue():this.collectNeedsTranslateNode(t))}async translateUnknownWords(e,t){if(0==e.length)return;const o=e.filter((e=>""!==(e+"").trim()));if(0===o.length)return;const n=Array.from(new Set(o)),s=await B({words:n,toSource:this.to,systemFlag:this.systemKey,translateApiUrl:this.translateApiUrl});s&&0!==Object.keys(s).length?(this.yxI18nThesaurus={...this.yxI18nThesaurus,...s},await V(this.dbKey,this.yxI18nThesaurus),this.unknownWords=[],this.replaceUnknownWordsNodeList(),this.startMicroTaskQueue()):this.unknownWords=[]}replaceUnknownWordsNodeList(e=!1){if(this.unknownWordsNode.size>0){for(const e of this.unknownWordsNode.values())A.test(e.nodeValue)&&this.replaceTextByNode(e,!0);e&&this.unknownWordsNode.clear()}}async initConfig({to:e,systemKey:t,asyncThesaurusList:o}){this.to=e||this.to,this.systemKey=t||this.systemKey,this.dbKey=`${this.systemKey}_${this.to}`,document.querySelector("html").classList.add(e),this.rootDocument=document.querySelector("body");await I("lang")!==e&&await V("lang",e);const n=await I(this.dbKey),s=async()=>{const e=await B({words:[],toSource:this.to,systemFlag:this.systemKey,translateApiUrl:this.translateApiUrl});this.yxI18nThesaurus=e,await V(this.dbKey,this.yxI18nThesaurus)};if(n)try{s()}catch(a){this.yxI18nThesaurus=n}else await V(this.dbKey,{}),s();if(o&&o.length>0)for(const r of o){const e=await B({words:[],toSource:this.to,systemFlag:r,translateApiUrl:this.translateApiUrl}),t=`${r}_${this.to}`;await V(t,e)}}getYxI18nThesaurus(){return this.yxI18nThesaurus}},z=D.initTranslate,H=async e=>{(e=>{i.changeSystemConfig("lang",e)})(e);await I("lang")!==e&&(await V("lang",e),new Le(i.BC_LANG_NAME).postMessage(JSON.stringify({type:"lang"})),location.reload())},O=async()=>await I("lang")||"",$=e=>D.getYxI18nThesaurus()[e]||e,q=e=>{const t=D.getYxI18nThesaurus();return Object.keys(t).find((o=>t[o]===e))||e},R=async(e,t)=>{if("zh"===t)return{};try{const o=await B({words:[],toSource:t,systemFlag:e,translateApiUrl:D.translateApiUrl});return await V(`${e}_${t}`,o),o}catch(o){return I(`${e}_${t}`)}},K=Object.freeze(Object.defineProperty({__proto__:null,changeLang:H,getLang:O,getWordByYxI18nThesaurus:$,getZhWordByYxI18nThesaurus:q,handleTranslation:M,initTranslate:z,loadCustomThesaurus:R,whitelistApi:_},Symbol.toStringTag,{value:"Module"})),Y={class:"badge-container"};const F=p({props:{value:{typeof:Number}}},[["render",function(e,t,o,n,s,a){return r.withDirectives((r.openBlock(),r.createElementBlock("div",Y,[r.createElementVNode("sup",null,r.toDisplayString(o.value),1)],512)),[[r.vShow,o.value>0]])}],["__scopeId","data-v-588a1297"]]),X={components:{theme:b,issue:C,Badge:F,lang:E},props:{showTool:{typeof:Boolean,default:!1},badgeValue:{typeof:Number}},data:()=>({columns:"repeat(2, 1fr)",rows:window.isRenderLang?"repeat(2, 1fr)":"lfr",config:[{name:"theme",label:"主题切换",icon:"theme",icon_active:"https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/toolbar-theme-back.svg",position:[50,0],desc:"跳转到问题反馈页面",action:"hiddenTool",component:"Theme",data:window.theme,"grid-area":window.isRenderLang?"1 / 1 / 2 / 3":"1 / 1 / 2 / 2",show:window.theme.length>0},{name:"lang",label:"语言切换",icon:"lang",position:[100,0],desc:"语言切换",component:"Lang",isShowBadge:!0,"grid-area":"2 / 1 / 3 / 2",show:!!window.isRenderLang&&window.isRenderLang},{name:"issue",label:"问题反馈",icon:"issue",position:[100,0],desc:"跳转到问题反馈页面",component:"Issue",isShowBadge:!0,"grid-area":window.isRenderLang?"2 / 2 / 3 / 3":"1 / 2 / 2 / 3",show:!!window.isRenderIssue&&window.isRenderIssue}],curComponent:{},curTheme:Ne(),langList:[{name:"中文-Chinese",lang:"zh"},{name:"中文(香港)-Chinese(Hong Kong)",lang:"cht"},{name:"英语-English",lang:"en"}]}),computed:{configList(){return this.config.filter((e=>e.show))}},watch:{showTool(e){e?this.curTheme=this.getCurTheme():this.curComponent={}}},mounted(){this.curTheme=this.getCurTheme()},methods:{changeLang:H,getCurTheme:()=>Ne(),configHandle(e){if("issue"===e.name){const e=window.location.pathname.split("/")[1];window.open(`/${e}/integrated-management/#/workOrderManagement`),this.$emit("zero")}else this.curComponent=e},chooseTheme(e){xe(e),this.curTheme=e.id},getPosition:e=>({0:{"grid-row":2,"grid-column":1},1:{"grid-row":1,"grid-column":2},2:{"grid-row":2,"grid-column":3},3:{"grid-row":3,"grid-column":2}}[e])}},Z=["onClick"],J=["title"],G={class:"tool-icon relative flex justify-center items-center"},Q={class:"yx-icon",style:{color:"var(--color-main-100)"},color:"var(--color-main-100) \n ",size:"24"},ee={class:"mt-10 text-center"},te={key:1,class:"w-full h-full"},oe={key:0,class:"toolbar-wrap-component"},ne={class:"yx-icon",style:{color:"var(--color-main-100)"},color:"var(--color-main-100)",size:"30"},se=["title","onClick"],ae={key:1,class:"box-border w-full h-full py-10 overflow-y-auto"},re=["onClick","title"];const le={xmlns:"http://www.w3.org/2000/svg",width:"50",height:"50",fill:"none",viewBox:"0 0 25 25"};const ie={name:"YxToolbar",components:{ToolbarContainer:p(X,[["render",function(e,t,o,n,s,a){const l=r.resolveComponent("Badge");return r.openBlock(),r.createBlock(r.Transition,{name:"zoom",mode:"out-in"},{default:r.withCtx((()=>[r.withDirectives(r.createElementVNode("div",{class:r.normalizeClass(["toolbar-container",o.showTool?"zoom-in":"zoom-out "])},[s.curComponent.name?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",{key:0,style:r.normalizeStyle({"grid-template-columns":s.columns,"grid-template-rows":s.rows}),class:"toolbar-wrap"},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.configList,(e=>(r.openBlock(),r.createElementBlock("div",{class:"flex justify-center items-center",onClick:t=>a.configHandle(e),style:r.normalizeStyle({"grid-area":e["grid-area"]})},[r.createElementVNode("div",{title:e.label,class:"flex flex-col justify-center items-center"},[r.createElementVNode("div",G,[r.createElementVNode("i",Q,[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(e.icon)))]),e.isShowBadge?(r.openBlock(),r.createBlock(l,{key:0,value:o.badgeValue},null,8,["value"])):r.createCommentVNode("",!0)]),r.createElementVNode("span",ee,r.toDisplayString(e.label),1)],8,J)],12,Z)))),256))],4)),s.curComponent.name?(r.openBlock(),r.createElementBlock("div",te,["theme"===s.curComponent.name?(r.openBlock(),r.createElementBlock("div",oe,[r.createElementVNode("div",{class:"flex flex-col toolbar-center items-center",onClick:t[0]||(t[0]=e=>s.curComponent={}),title:"返回"},[r.createElementVNode("i",ne,[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(s.curComponent.icon)))])]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.curComponent.data,((e,t)=>(r.openBlock(),r.createElementBlock("div",{style:r.normalizeStyle([{background:e.themeColor,boxShadow:`0px 4px 7px 0px ${e.themeColor}`},a.getPosition(t)]),title:e.name,class:r.normalizeClass(["theme",s.curTheme===e.id?"select":""]),onClick:t=>a.chooseTheme(e)},null,14,se)))),256))])):"lang"===s.curComponent.name?(r.openBlock(),r.createElementBlock("div",ae,[r.createElementVNode("div",{onClick:t[1]||(t[1]=e=>s.curComponent={}),class:"px-10 cursor-pointer"},"返回"),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.langList,(e=>(r.openBlock(),r.createElementBlock("div",{onClick:t=>a.changeLang(e.lang),title:e.name,class:"px-10 cursor-pointer mt-10 whitespace-nowrap truncate"},r.toDisplayString(e.name),9,re)))),256))])):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0)],2),[[r.vShow,o.showTool]])])),_:1})}],["__scopeId","data-v-adceffc6"]]),menuIcon:{render:function(e,t){return r.openBlock(),r.createElementBlock("svg",le,t[0]||(t[0]=[r.createElementVNode("g",{stroke:"currentColor","stroke-linejoin":"round","stroke-width":"2"},[r.createElementVNode("path",{d:"M9 3H4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1ZM9 14H4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1ZM20 3h-5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1ZM20 14h-5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1Z"})],-1)]))}},Badge:F},mixins:[T],data:()=>({showTool:!1,position:{top:0,left:0},badgeValue:0,showBadge:window.isRenderIssue}),computed:{showClass(){return this.status?"expanded":"folded"}},mounted(){this.showBadge&&this.getCount(),this.initToolPosition()},methods:{initToolPosition(){const e=document.querySelector(".toolbar-wrap"),t=window.innerWidth-60-100+"px",o=window.innerHeight-60-100+"px";e.style.setProperty("--tool-left",t),e.style.setProperty("--tool-top",o)},async getCount(){const{data:e}=await a.getCommentUntreatedCount();this.badgeValue=e.count},handlerClickTool(e){this.mousePoint.x===e.screenX&&this.mousePoint.y===e.screenY&&(this.switchStatus(),this.getAllPosition(),this.setPanel(),this.showTool=!0)},switchStatus(){this.status=!this.status},getAllPosition(){this.toolPos=this.getDomPosition(this.toolDom),this.panelPos=this.getDomPosition(this.panelDom)},getDomPosition:e=>e.getBoundingClientRect(),setPanel(){const e=window.innerWidth-this.panelWidth,t=window.innerHeight-this.panelHeight;let o=this.toolPos.left+this.toolPos.width/2-this.panelWidth/2,n=this.toolPos.top+this.toolPos.height/2-this.panelHeight/2;o<0&&(o=0),n<0&&(n=0),o>e&&(o=e-40),n>t&&(n=t-40),this.setPanelPosition(o,n)},setPanelPosition(e,t){this.panelDom.style.left=e+"px",this.panelDom.style.top=t+"px"},mousedownTool(e){this.mousePoint.x=e.screenX,this.mousePoint.y=e.screenY},close(){this.status=!1,this.showTool=!1}}},ce=()=>{r.useCssVars((e=>({"0b6a2599":e.panelWidthPX,"7fe18f84":e.panelHeightPX})))},de=ie.setup;ie.setup=de?(e,t)=>(ce(),de(e,t)):ce;const ue={id:"toolbar-wrap",class:"toolbar-wrap"},he={class:"yx-icon"};const me=p(ie,[["render",function(e,t,o,n,s,a){const l=r.resolveComponent("Badge"),i=r.resolveComponent("ToolbarContainer");return r.openBlock(),r.createElementBlock("div",ue,[r.createElementVNode("div",{class:r.normalizeClass(["tool",`${a.showClass}`]),onClick:t[0]||(t[0]=(...e)=>a.handlerClickTool&&a.handlerClickTool(...e)),onMousedown:t[1]||(t[1]=(...e)=>a.mousedownTool&&a.mousedownTool(...e)),onMouseup:t[2]||(t[2]=(...t)=>e.mouseupTool&&e.mouseupTool(...t))},[r.createElementVNode("i",he,[(r.openBlock(),r.createBlock(r.resolveDynamicComponent("menuIcon")))]),s.showBadge?(r.openBlock(),r.createBlock(l,{key:0,value:s.badgeValue},null,8,["value"])):r.createCommentVNode("",!0)],34),r.createElementVNode("div",{class:r.normalizeClass(["mask",`${a.showClass}`]),onClick:t[3]||(t[3]=(...e)=>a.close&&a.close(...e))},null,2),r.createVNode(i,{onZero:t[4]||(t[4]=e=>s.badgeValue=0),badgeValue:s.badgeValue,class:"panel",showTool:s.showTool},null,8,["badgeValue","showTool"])])}],["__scopeId","data-v-1a4229ae"]]),pe=class t{constructor(n){var s,a,r;s=this,r="yxToolbarV2",(a=e).has(s)?o("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(s):a.set(s,r);const{theme:l,isRenderIssue:i,isRenderLang:c}=n;return t.instance||(window.theme=l,window.isRenderIssue=i,window.isRenderLang=c,this.init(),t.instance=this),t.instance}get vueVersion(){return r.version[0]}init(){this.mount()}mount(){const t=document.createElement("div");if(t.id=s(this,e),document.body.appendChild(t),"3"===this.vueVersion)return r.createApp(me).mount(`#${s(this,e)}`);return new(require("vue"))({render:e=>e(me)}).$mount(`#${s(this,e)}`)}};e=new WeakMap,pe.instance=null;let ge=pe;const ye="ttcGlobalTheme",we=async e=>{var t;e={...m,...e};let o=Ne();try{await fe(e);const{data:n}=await i.http.get(null==e?void 0:e.themeApiUrl,{},{headers:{noLoading:!0}});if(window.YX_THEME_LIST=n,e.isRenderLang&&e.systemKey){const t=await O();await z({to:t||e.lang,systemKey:e.systemKey})}e.isRenderToolbar&&new ge({theme:n,isRenderIssue:e.isRenderIssue,isRenderLang:e.isRenderLang});let s=o?null==(t=n.find((e=>e.id===o)))?void 0:t.themeUrl:"";if(!o||!s){const e=n.find((e=>1===e.defaultTheme))||n[0];s=e.themeUrl,o=e.id}const a=await ke(s);Te({themeCssVar:a,themeId:o}),ve(),new Le(i.BC_THEME_NAME).onmessage=e=>{var t;const o=JSON.parse(e.data);Se(o.data.themeCssVar),Te({themeCssVar:o.data.themeCssVar,themeId:null==(t=o.data)?void 0:t.themeId}),d.yxSubscribe.publish({type:"theme",data:null})},new Le(i.BC_LANG_NAME).onmessage=e=>{location.reload()}}catch(n){ve(),be()}},fe=e=>{i.setSystemConfig({...e})},ve=()=>{const e=document.createElement("style");e.innerHTML="@font-face {font-family: 'YX-TITLE';font-size: 16px; src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff'), url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff2'); font-style: normal;font-display: swap;}@font-face { font-family: 'YX-SP-TITLE'; font-size: 16px; src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699844184489_bt.ttf') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699844184489_bt.ttf') format('woff2');font-style: normal; font-display: swap}@font-face {font-family: 'YX-TEXT'; font-size: 16px;src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699611032932_ALIBABAPUHUITI-2-65-MEDIUM.TTF') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699611032932_ALIBABAPUHUITI-2-65-MEDIUM.TTF') format('woff2'); font-style: normal; font-display: swap;}@font-face {font-family: 'PingFang SC'; font-size: 16px;src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/苹方-繁 中黑体.otf') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/苹方-繁 中黑体.otf') format('woff2'); font-style: normal; font-display: swap}",document.head.appendChild(e)},Te=({themeCssVar:e,themeId:t})=>{const o=localStorage.getItem(ye)||"{}",n=JSON.parse(o);n.theme={themeCssVar:e,id:t},localStorage.setItem(ye,JSON.stringify(n))},xe=async e=>{const t=await ke(e.themeUrl);Te({themeCssVar:t,themeId:null==e?void 0:e.id}),new Le(i.BC_THEME_NAME).postMessage(JSON.stringify({type:"theme",data:{themeId:null==e?void 0:e.id,themeUrl:null==e?void 0:e.themeUrl,themeCssVar:t}})),d.yxSubscribe.publish({type:"theme",data:e})},be=()=>{const e=Ee(),t=document.documentElement;Object.keys(e).forEach((o=>{"exclude"!==o&&Object.keys(e[o]).forEach((n=>{const s=`--${o}-${n}`;t.style.setProperty(s,e[o][n])}))}))},ke=async e=>{const t=await fetch(e),o=await t.json(),n=()=>{let e=":root {\n";return Object.keys(o).forEach((t=>{"exclude"!==t&&Object.keys(o[t]).forEach((n=>{const s=`--${t}-${n}`,a=o[t][n];e+=` ${s}: ${a};\n`}))})),e+="}",e},s=document.querySelector(".YX_THEME_STYLE");if(s)s.innerHTML="",s.appendChild(document.createTextNode(n()));else{const e=document.createElement("style");e.className="YX_THEME_STYLE",e.appendChild(document.createTextNode(n())),document.head.appendChild(e)}return o},Ce=async()=>{const{data:e}=await a.getUserThemeList(),t=e.find((e=>1===e.defaultTheme));return t?t.themeUrl:e[0].themeUrl},Ne=()=>{var e;const t=localStorage.getItem(ye),o=t&&(null==(e=JSON.parse(t))?void 0:e.theme);return(null==o?void 0:o.id)||null},Ee=()=>{var e;const t=localStorage.getItem(ye),o=t&&(null==(e=JSON.parse(t))?void 0:e.theme);return(null==o?void 0:o.themeCssVar)||{}},Ve=e=>{const t=Ee();return(null==t?void 0:t[e])||{}},Ie=(e,t)=>{const o=Ee();if(!o.exclude)return null;for(let n in o.exclude){const s=o.exclude[n];for(let o of Object.keys(s))for(let n of Object.keys(s[o])){if(`--${o}-${n}`===e&&c.isColorEqual(s[o][n],t))return t}}return null},Se=(e,t)=>{const o=e||Ee(),n=()=>{let e=":root {\n";return Object.keys(o).forEach((t=>{"exclude"!==t&&Object.keys(o[t]).forEach((n=>{const s=`--${t}-${n}`,a=o[t][n];e+=` ${s}: ${a};\n`}))})),e+="}",e},s=t||"YX_THEME_STYLE",a=document.querySelector(`.${s}`);if(a)a.innerHTML="",a.appendChild(document.createTextNode(n()));else{const e=document.createElement("style");e.className="YX_THEME_STYLE",e.appendChild(document.createTextNode(n())),document.head.appendChild(e)}},Be=Object.freeze(Object.defineProperty({__proto__:null,changeTheme:xe,findColorByTheme:Ie,getCurTheme:Ne,getCurThemeCssVar:Ee,getDefaultThemeUrl:Ce,getGroupColor:Ve,install:we,installCssVarInSystemTheme:Se,saveCssVar:Te,setCssVar:ke,updateTheme:be},Symbol.toStringTag,{value:"Module"}));class Le{constructor(e){n(this,"onmessage"),n(this,"postMessage"),Le.init();const t=new BroadcastChannel(e);this.onmessage=e=>e,t.onmessage=e=>{const{type:t}=e.data;if("router"===t){if(window.pageActive)return this.onmessage(e)}else this.onmessage(e)},this.postMessage=e=>t.postMessage(e)}static init(){window.pageActive="visible"===document.visibilityState,document.addEventListener("visibilitychange",(()=>{window.pageActive="visible"===document.visibilityState}))}}const _e=Object.freeze(Object.defineProperty({__proto__:null,BC:Le},Symbol.toStringTag,{value:"Module"}));exports.BC=_e,exports.BC$1=Le,exports.Toolbar=ge,exports.YxTablePro=w,exports._export_sfc=p,exports.changeLang=H,exports.changeTheme=xe,exports.findColorByTheme=Ie,exports.getCurTheme=Ne,exports.getCurThemeCssVar=Ee,exports.getDefaultThemeUrl=Ce,exports.getGroupColor=Ve,exports.getLang=O,exports.getWordByYxI18nThesaurus=$,exports.getZhWordByYxI18nThesaurus=q,exports.handleTranslation=M,exports.initTranslate=z,exports.install=we,exports.installCssVarInSystemTheme=Se,exports.loadCustomThesaurus=R,exports.saveCssVar=Te,exports.setCssVar=ke,exports.theme2=Be,exports.translate2=K,exports.updateTheme=be,exports.whitelistApi=_;
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,o=e=>{throw TypeError(e)},n=(e,o,n)=>((e,o,n)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n)(e,"symbol"!=typeof o?o+"":o,n),s=(e,t,n)=>(((e,t,n)=>{t.has(e)||o("Cannot "+n)})(e,t,"read from private field"),n?n.call(e):t.get(e));const a=require("./index.cjs4.js"),r=require("vue");require("xlsx"),require("./vendor-file-saver.cjs.js"),require("xlsx-js-style");const l=require("./vendor-sortablejs.cjs.js");require("element-plus");const i=require("./index.cjs12.js"),c=require("./index.cjs13.js"),d=require("./index.cjs14.js");require("element-plus/es/components/message/style/index"),require("element-plus/es/components/loading/style/index"),require("element-plus/es/components/message/style/css"),require("element-plus/es/components/loading/style/css"),require("./vendor-mqtt.cjs.js");const u=require("./vendor-localforage.cjs.js");require("element-plus/es/components/message-box/style/index"),require("./vendor-dayjs.cjs.js");const h=require("./vendor-lodash.cjs.js");require("./index.cjs7.js"),require("./index.cjs11.js"),require("element-plus/es/components/dialog/style/index"),require("element-plus/es/components/button/style/index"),require("element-plus/es/components/drawer/style/index");const m={loginUrl:"/ttc/cloud/#/login",homeUrl:"/ttc/cloud/#/cloud",lang:"zh",themeApiUrl:"/gateway/integrated-management/api/v1/theme/list",loginApiUrl:"/gateway/integrated-management/api/v1/account/login",translateApiUrl:"/gateway/integrated-management/api/v1/translate/get",userConfigApiUrl:"/gateway/integrated-management/api/v1/basic/data/frontendConfig",environment:"production",isRenderToolbar:!0,isRenderIssue:!0,isRenderLang:!1,systemKey:"",isTranslateApi:!1,whitelistTranslateApi:[]},p=(e,t)=>{const o=e.__vccOpts||e;for(const[n,s]of t)o[n]=s;return o};const g=r.ref(),y=(e,{rowData:t})=>{let o;const{renderType:n,event:s={},prop:a,label:l,config:i={}}=e;if(!a||!n)return null;const c=r.resolveComponent("el-"+n),{options:d=[],...u}=i;if("cascader"===n)return r.createVNode(r.resolveComponent("el-cascader"),r.mergeProps({modelValue:t[a],"onUpdate:modelValue":e=>t[a]=e,placeholder:`请选择${l}`,options:d},s,u),null);const h=["select","cascader"].includes(n),m=t[a];var p;return r.createVNode(c,r.mergeProps({modelValue:m,"onUpdate:modelValue":e=>{t[a]="number"===(null==i?void 0:i.type)?Number(e):e},placeholder:`请${h?"选择":"输入"}${l}`},s,u),"function"==typeof(p=o=d&&0!==d.length?"select"===n?d.map((e=>r.createVNode(r.resolveComponent("el-option"),{label:e.label,value:e.value,key:e.value},null))):"radio-group"===n?d.map((e=>r.createVNode(r.resolveComponent("el-radio"),{label:e.value,key:e.value},{default:()=>[e.label]}))):null:null)||"[object Object]"===Object.prototype.toString.call(p)&&!r.isVNode(p)?o:{default:()=>[o]})},w=r.defineComponent({name:"YxTablePro",props:{tableData:{type:Array,default:()=>[]},rowKey:{type:String,default:"",required:!1},columns:{type:[Array,Function],default:()=>[]},pageInfo:{type:Object,default:()=>{},required:!1},sort:{type:Boolean,default:!1,required:!1}},emits:["operate-handle","update-page","sort-end"],setup(e,{emit:t,attrs:o,expose:n}){const s=r.ref([]),{tableData:a,rowKey:i,pageInfo:c}=e;r.onBeforeMount((()=>{d()})),r.onMounted((()=>{r.nextTick((()=>{u()}))})),r.watch((()=>e.columns),(()=>{d()})),n({tableProRef:g});const d=async()=>{const t="function"==typeof e.columns?await e.columns():e.columns;s.value=t.filter((e=>!e.show||e.show(e))).map((e=>{var t;const{width:o,...n}=e;return(null==e?void 0:e.renderType)&&["select","cascader"].includes(null==e?void 0:e.renderType)&&(null==(t=null==e?void 0:e.config)?void 0:t.loadOptions)&&(async e=>{(null==e?void 0:e.options)&&0===(null==e?void 0:e.options.length)&&(null==e?void 0:e.loadOptions)&&"function"==typeof(null==e?void 0:e.loadOptions)&&(e.options=await(null==e?void 0:e.loadOptions()))})(e.config),{flexGrow:o?0:1,width:o??100,cellRenderer:t=>h(e,t),headerCellRenderer:e.headerRender??null,title:e.label,dataKey:e.prop,key:e.prop,...n}}))},u=()=>{var o,n,s;if(!e.sort)return;const a=null==(s=null==(n=null==(o=g.value)?void 0:o.$el)?void 0:n.querySelector(".el-table-v2__body").children[0])?void 0:s.children[0];l.Sortable.create(a,{animation:200,sort:!0,handle:e.sortHandle?`.${e.sortHandle}`:null,onEnd:({oldIndex:e,newIndex:o})=>{t("sort-end",e,o)}})},h=(e,t)=>"operate"===(null==e?void 0:e.renderType)?m(e,t):(null==e?void 0:e.renderType)&&"operate"!==(null==e?void 0:e.renderType)?y(e,t):(null==e?void 0:e.render)?e.render(t,t.rowIndex,e):"index"===e.type?r.createVNode("span",{class:"w-full"},[t.rowIndex+1]):t.rowData[t.column.dataKey],m=(e,{rowIndex:o,rowData:n})=>{var s,a;return r.createVNode("div",{class:`flex justify-center items-center cursor-pointer gap-10 ${(null==(s=e.config)?void 0:s.className)??""}`},[null==(a=e.operate)?void 0:a.filter((e=>!e.show||e.show(n))).map((e=>{if(null==e?void 0:e.render)return e.render(n,o);const s="function"==typeof(null==e?void 0:e.disabled)?e.disabled(n,o):(null==e?void 0:e.disabled)??!1;return r.createVNode("span",{onClick:r.withModifiers((()=>{s||((null==e?void 0:e.onClick)&&(null==e||e.onClick(n,o)),t("operate-handle",e.key,n,o))}),["stop"]),class:`table-handle whitespace-nowrap ${(null==e?void 0:e.className)??""} ${s?"table-handle-disabled":""}`},[e.label])}))])},p=()=>{if(!c||0===c.total)return null;return r.createVNode("div",{class:"pagination-wrap"},[r.createVNode(r.resolveComponent("el-pagination"),{currentPage:c.pageIndex,"onUpdate:currentPage":e=>c.pageIndex=e,pageSize:c.pageSize,"onUpdate:pageSize":e=>c.pageSize=e,small:!1,disabled:!1,"page-sizes":[10,20,50,100],layout:(null==c?void 0:c.layout)?null==c?void 0:c.layout:"total,sizes,prev, pager, next",background:!1,total:c.total,onSizeChange:e=>{t("update-page","pageSize",e)},onCurrentChange:e=>{t("update-page","pageIndex",e)}},null)])},w=e=>e-(c&&0!==c.total?52:0);return()=>r.createVNode(r.resolveComponent("el-auto-resizer"),null,{default:({width:e,height:t})=>r.createVNode("div",{class:"w-full h-full"},[r.createVNode(r.resolveComponent("el-table-v2"),r.mergeProps({border:!0,"row-key":i,width:e,height:w(t),columns:s.value,data:a},o,{ref:g}),null),p()])})}});Array.prototype.handler=function(e){return e(this)};const f={status:!1,toolDom:null,panelWidth:200,panelHeight:200,mousePoint:{x:0,y:0}};function v(e){return document.querySelector(e)}const T={data:()=>f,mounted(){this.getAllDom(),this.move()},computed:{panelWidthPX(){return this.panelWidth+"px"},panelHeightPX(){return this.panelHeight+"px"}},methods:{getAllDom(){this.wrapDom=v("#toolbar-wrap"),this.toolDom=v("#toolbar-wrap .tool"),this.panelDom=v("#toolbar-wrap .panel")},move(){!function(e){let t=0,o=0;e.onmousedown=n=>{t=n.clientX-e.offsetLeft,o=n.clientY-e.offsetTop;const s=n=>{n.stopPropagation(),n.preventDefault();const s=n.clientX,a=n.clientY;let r=s-t,l=a-o;r<0&&(r=0),l<0&&(l=0),r>document.body.clientWidth-e.clientWidth&&(r=document.body.clientWidth-e.clientWidth),l>document.body.clientHeight-e.clientHeight&&(l=document.body.clientHeight-e.clientHeight),e.style.left=r+"px",e.style.top=l+"px"},a=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",s),document.addEventListener("mouseup",a)}}(this.toolDom)}}},x={xmlns:"http://www.w3.org/2000/svg",width:"50",height:"50",fill:"none",viewBox:"0 0 16 16"};const b={render:function(e,t){return r.openBlock(),r.createElementBlock("svg",x,t[0]||(t[0]=[r.createStaticVNode('<g stroke="currentColor" stroke-linejoin="round" stroke-width="1.333" clip-path="url(#a)"><path d="M8 14.666c1.986 0 .778-2.954 2-4.333 1.042-1.176 4.666-.638 4.666-2.333A6.667 6.667 0 1 0 8 14.666Z"></path><path d="M9.333 5.667a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5.333 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5.667 11.333a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"></path></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"></path></clipPath></defs>',2)]))}},k={xmlns:"http://www.w3.org/2000/svg",width:"50",height:"50",fill:"none",viewBox:"0 0 16 16"};const C={render:function(e,t){return r.openBlock(),r.createElementBlock("svg",k,t[0]||(t[0]=[r.createElementVNode("g",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.333"},[r.createElementVNode("path",{"stroke-linejoin":"round",d:"M13.333 11v3a.667.667 0 0 1-.666.667H10.5M13.334 5.333V2a.667.667 0 0 0-.667-.667H3.334A.667.667 0 0 0 2.667 2v12c0 .368.298.666.667.666h2"}),r.createElementVNode("path",{d:"M5.333 5.333H10M7.667 14.667l5.667-7M5.333 8H8"})],-1)]))}},N={width:"1.2em",height:"1.2em",viewBox:"0 0 24 24"};const E={render:function(e,t){return r.openBlock(),r.createElementBlock("svg",N,t[0]||(t[0]=[r.createElementVNode("path",{fill:"currentColor",d:"m18.5 10 4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10zM10 2v2h6v2h-1.968a18.2 18.2 0 0 1-3.62 6.301 15 15 0 0 0 2.336 1.707l-.751 1.878A17 17 0 0 1 9 13.725a16.7 16.7 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18 18 0 0 1 4.767 8h2.24A16 16 0 0 0 9 10.877a16.2 16.2 0 0 0 2.91-4.876L2 6V4h6V2zm7.5 10.885L16.253 16h2.492z"},null,-1)]))}};u.localforage.config({name:"yxI18n"});const V=async(e,t)=>{await u.localforage.setItem(e,t)},I=async e=>await u.localforage.getItem(e),S={URL:i.getSystemConfig("translateApiUrl")||"/gateway/integrated-management/api/v1/translate/get"},B=async({words:e,systemFlag:t,toSource:o="en",fromSource:n="zh",translateApiUrl:s})=>{try{const{data:a}=await i.http.post(s||S.URL,{words:e,systemFlag:t,toSource:o,fromSource:n},{headers:{noLoading:!0}});return a.dstMap||{}}catch(a){return null}},L=`${i.getSystemConfig("systemKey")}_${window.lang}`,_=["/gateway/integrated-management/api/v1/theme/list","/gateway/integrated-management/api/v1/translate/get",...i.getSystemConfig("whitelistTranslateApi")],M=async e=>{let t=JSON.stringify(e);const o=t.match(/[\u4e00-\u9fa5]+/g),n=await(async()=>{const e=await I("lang");return await I(`${i.getSystemConfig("systemKey")}_${e}`)})();let s=[];if(o){for(const e of o)n[e]?t=t.replace(new RegExp(e,"g"),n[e]):s.includes(e)||s.push(e);if(s.length>0){const e=await async function(e){const t=await B({words:e,toSource:window.lang,systemFlag:i.getSystemConfig("systemKey")});return t}(s);s.forEach((o=>{t=t.replace(new RegExp(o,"g"),e[o])}));const o={...n,...e};await V(L,o),s=[]}}return JSON.parse(t)};const A=/[\u4e00-\u9fa5]+/;let W;const j=["svg","g","path","polyline","circle"],P={childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["readonly","placeholder","aria-expanded"]};let U;const D=new class{constructor(){n(this,"from"),n(this,"to"),n(this,"yxI18nThesaurus"),n(this,"systemKey"),n(this,"asyncThesaurusList"),n(this,"dbKey"),n(this,"unknownWords"),n(this,"unknownWordsNode"),n(this,"rootDocument"),n(this,"unknownWordsInputNode"),n(this,"translateApiUrl"),n(this,"maxWordsLength"),this.from="zh",this.to="en",this.yxI18nThesaurus={},this.systemKey="station-control",this.dbKey="",this.initTranslate=this.initTranslate.bind(this),this.unknownWords=[],this.unknownWordsNode=new Map,this.unknownWordsInputNode=new Map,this.rootDocument=null,this.translateApiUrl=null,this.maxWordsLength=100}async initTranslate({to:e,systemKey:t,translateApiUrl:o,asyncThesaurusList:n}){if("zh"!==e){if("cht"===e)return this.handleTraditionalChinese();o&&(this.translateApiUrl=o),await this.initConfig({to:e,systemKey:t,asyncThesaurusList:n}),this.observerRouteChange()}}handleTraditionalChinese(){document.body.style.fontFamily="PingFang SC",document.body.style["font-variant-east-asian"]="traditional",document.documentElement.lang="zh-tw"}observerRouteChange(){U=new MutationObserver((e=>{e.length>0&&e.forEach(((e,t)=>{switch(e.type){case"characterData":this.handleTextNodes(e.target);break;case"childList":this.handleChildListMutation(e);break;case"attributes":"placeholder"===e.attributeName&&A.test(e.target.placeholder)?this.replaceInputValue(e.target,"placeholder"):"readonly"===e.attributeName?(this.replaceInputValue(e.target,"value"),this.replaceInputValue(e.target,"placeholder")):"aria-expanded"===e.attributeName&&"false"===e.target.ariaExpanded&&setTimeout((()=>{this.replaceInputValue(e.target,"value")}),0)}}))})),U.observe(this.rootDocument,P);const e=U.takeRecords();e.length>0&&e.forEach((e=>{}))}handleTextNodes(e){if(A.test(null==e?void 0:e.data)||A.test(null==e?void 0:e.nodeValue)){const t=e.nodeValue.replace(/\s/g,"");this.yxI18nThesaurus[t]?e.nodeValue=this.yxI18nThesaurus[t]:(!this.unknownWords.includes(t)&&t.length<=this.maxWordsLength&&this.unknownWords.push(t),this.collectNeedsTranslateNode(e,t))}}handleChildListMutation(e){if(e.addedNodes.length>0&&e.removedNodes.length>0)return this.addedNode(e);e.removedNodes.length>0&&"nprogress"!==e.removedNodes[0].id||this.addedNode(e)}addedNode(e){var t,o,n;if(e.addedNodes.length>0){const s=e.target.tagName.toLowerCase();if(j.includes(s))return;if(j.includes(null==(o=null==(t=e.addedNodes[0])?void 0:t.tagName)?void 0:o.toLowerCase()))return;const a=null==(n=e.addedNodes[0])?void 0:n.className,r=e.target.nodeValue;if(a&&""!==a)a.includes("v-modal")?this.throttleTraversingNode(e.previousSibling):a.includes("tooltip")||a.includes("message")||a.includes("loading")?this.throttleTraversingNode(e.addedNodes[0]):r?this.replaceValue("nodeValue",e.target):(A.test(e.addedNodes[0].innerText)||a.includes("input"))&&this.throttleTraversingNode(e.addedNodes[0]);else{const t=e.addedNodes[0];t&&t.nodeType===Node.TEXT_NODE&&A.test(t.nodeValue)?this.replaceValue("nodeValue",t):this.throttleTraversingNode(t)}}else this.throttleTraversingNode(e.target),this.replaceDocumentTitle()}startMicroTaskQueue(){W&&clearTimeout(W),W=setTimeout((()=>{if(this.replaceDocumentTitle(),this.unknownWords.length>0){h._.throttle((()=>this.translateUnknownWords(this.unknownWords,this.unknownWordsNode.size)),1e3,{leading:!0})()}else{if(this.unknownWordsInputNode.size>0){for(const e of this.unknownWordsInputNode.values())this.replaceInputValue(e,"placeholder",!0),""!==e.value&&this.replaceInputValue(e,"value",!0);this.unknownWordsInputNode.clear()}this.replaceUnknownWordsNodeList(!0)}}),500)}throttleTraversingNode(e){h._.throttle((()=>this.traversingNode(e)),500,{leading:!0})()}traversingNode(e){if(!e)return;const t=e=>this.replaceTextByNode(e),o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,{acceptNode:e=>e.tagName&&"svg"===e.tagName.toLowerCase()?NodeFilter.FILTER_REJECT:(t(e),NodeFilter.FILTER_SKIP)});let n;for(;n=o.nextNode();)t(n)}replaceTextByNode(e,t=!1){e.title&&A.test(e.title)&&this.replaceValue("title",e),e.nodeType===Node.ELEMENT_NODE?["textarea","input"].includes(e.tagName.toLowerCase())&&(A.test(e.placeholder)&&this.replaceInputValue(e,"placeholder"),e.value&&A.test(e.value)&&this.replaceInputValue(e,"value"),""!==e.value&&e.readOnly&&this.collectNeedsTranslateInputNode(e)):e.nodeType===Node.TEXT_NODE&&(A.test(e.nodeValue)||A.test(e.data))&&this.replaceValue("nodeValue",e,t)}replaceInputValue(e,t,o=!1){const n=e[t];A.test(n)&&(this.yxI18nThesaurus[n]?e[t]=this.yxI18nThesaurus[n]:(!this.unknownWords.includes(n)&&n.length<=this.maxWordsLength&&this.unknownWords.push(n),o||this.collectNeedsTranslateInputNode(e)))}collectNeedsTranslateInputNode(e){const t=Math.random().toString(16).split(".")[1];this.unknownWordsInputNode.has(t)||(this.unknownWordsInputNode.set(t,e),this.startMicroTaskQueue())}replaceDocumentTitle(){const e=document.title;A.test(e)&&this.yxI18nThesaurus[e]&&(document.title=this.yxI18nThesaurus[e])}collectNeedsTranslateNode(e){const t=Math.random().toString(16).split(".")[1];this.unknownWordsNode.has(t)||(this.unknownWordsNode.set(t,e),this.startMicroTaskQueue())}replaceValue(e,t,o=!1){if(""===t[e])return;const n=t[e].replace(/\s/g,"");this.yxI18nThesaurus[n]?t[e]=this.yxI18nThesaurus[n]:(!this.unknownWords.includes(n)&&n.length<=this.maxWordsLength&&this.unknownWords.push(n),o?this.startMicroTaskQueue():this.collectNeedsTranslateNode(t))}async translateUnknownWords(e,t){if(0==e.length)return;const o=e.filter((e=>""!==(e+"").trim()));if(0===o.length)return;const n=Array.from(new Set(o)),s=await B({words:n,toSource:this.to,systemFlag:this.systemKey,translateApiUrl:this.translateApiUrl});s&&0!==Object.keys(s).length?(this.yxI18nThesaurus={...this.yxI18nThesaurus,...s},await V(this.dbKey,this.yxI18nThesaurus),this.unknownWords=[],this.replaceUnknownWordsNodeList(),this.startMicroTaskQueue()):this.unknownWords=[]}replaceUnknownWordsNodeList(e=!1){if(this.unknownWordsNode.size>0){for(const e of this.unknownWordsNode.values())A.test(e.nodeValue)&&this.replaceTextByNode(e,!0);e&&this.unknownWordsNode.clear()}}async initConfig({to:e,systemKey:t,asyncThesaurusList:o}){this.to=e||this.to,this.systemKey=t||this.systemKey,this.dbKey=`${this.systemKey}_${this.to}`,document.querySelector("html").classList.add(e),this.rootDocument=document.querySelector("body");await I("lang")!==e&&await V("lang",e);const n=await I(this.dbKey),s=async()=>{const e=await B({words:[],toSource:this.to,systemFlag:this.systemKey,translateApiUrl:this.translateApiUrl});this.yxI18nThesaurus=e,await V(this.dbKey,this.yxI18nThesaurus)};if(n)try{s()}catch(a){this.yxI18nThesaurus=n}else await V(this.dbKey,{}),s();if(o&&o.length>0)for(const r of o){const e=await B({words:[],toSource:this.to,systemFlag:r,translateApiUrl:this.translateApiUrl}),t=`${r}_${this.to}`;await V(t,e)}}getYxI18nThesaurus(){return this.yxI18nThesaurus}},z=D.initTranslate,H=async e=>{(e=>{i.changeSystemConfig("lang",e)})(e);await I("lang")!==e&&(await V("lang",e),new Le(i.BC_LANG_NAME).postMessage(JSON.stringify({type:"lang"})),location.reload())},O=async()=>await I("lang")||"",$=e=>D.getYxI18nThesaurus()[e]||e,q=e=>{const t=D.getYxI18nThesaurus();return Object.keys(t).find((o=>t[o]===e))||e},R=async(e,t)=>{if("zh"===t)return{};try{const o=await B({words:[],toSource:t,systemFlag:e,translateApiUrl:D.translateApiUrl});return await V(`${e}_${t}`,o),o}catch(o){return I(`${e}_${t}`)}},K=Object.freeze(Object.defineProperty({__proto__:null,changeLang:H,getLang:O,getWordByYxI18nThesaurus:$,getZhWordByYxI18nThesaurus:q,handleTranslation:M,initTranslate:z,loadCustomThesaurus:R,whitelistApi:_},Symbol.toStringTag,{value:"Module"})),Y={class:"badge-container"};const F=p({props:{value:{typeof:Number}}},[["render",function(e,t,o,n,s,a){return r.withDirectives((r.openBlock(),r.createElementBlock("div",Y,[r.createElementVNode("sup",null,r.toDisplayString(o.value),1)],512)),[[r.vShow,o.value>0]])}],["__scopeId","data-v-588a1297"]]),X={components:{theme:b,issue:C,Badge:F,lang:E},props:{showTool:{typeof:Boolean,default:!1},badgeValue:{typeof:Number}},data:()=>({columns:"repeat(2, 1fr)",rows:window.isRenderLang?"repeat(2, 1fr)":"lfr",config:[{name:"theme",label:"主题切换",icon:"theme",icon_active:"https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/toolbar-theme-back.svg",position:[50,0],desc:"跳转到问题反馈页面",action:"hiddenTool",component:"Theme",data:window.theme,"grid-area":window.isRenderLang?"1 / 1 / 2 / 3":"1 / 1 / 2 / 2",show:window.theme.length>0},{name:"lang",label:"语言切换",icon:"lang",position:[100,0],desc:"语言切换",component:"Lang",isShowBadge:!0,"grid-area":"2 / 1 / 3 / 2",show:!!window.isRenderLang&&window.isRenderLang},{name:"issue",label:"问题反馈",icon:"issue",position:[100,0],desc:"跳转到问题反馈页面",component:"Issue",isShowBadge:!0,"grid-area":window.isRenderLang?"2 / 2 / 3 / 3":"1 / 2 / 2 / 3",show:!!window.isRenderIssue&&window.isRenderIssue}],curComponent:{},curTheme:Ne(),langList:[{name:"中文-Chinese",lang:"zh"},{name:"中文(香港)-Chinese(Hong Kong)",lang:"cht"},{name:"英语-English",lang:"en"}]}),computed:{configList(){return this.config.filter((e=>e.show))}},watch:{showTool(e){e?this.curTheme=this.getCurTheme():this.curComponent={}}},mounted(){this.curTheme=this.getCurTheme()},methods:{changeLang:H,getCurTheme:()=>Ne(),configHandle(e){if("issue"===e.name){const e=window.location.pathname.split("/")[1];window.open(`/${e}/integrated-management/#/workOrderManagement`),this.$emit("zero")}else this.curComponent=e},chooseTheme(e){xe(e),this.curTheme=e.id},getPosition:e=>({0:{"grid-row":2,"grid-column":1},1:{"grid-row":1,"grid-column":2},2:{"grid-row":2,"grid-column":3},3:{"grid-row":3,"grid-column":2}}[e])}},Z=["onClick"],J=["title"],G={class:"tool-icon relative flex justify-center items-center"},Q={class:"yx-icon",style:{color:"var(--color-main-100)"},color:"var(--color-main-100) \n ",size:"24"},ee={class:"mt-10 text-center"},te={key:1,class:"w-full h-full"},oe={key:0,class:"toolbar-wrap-component"},ne={class:"yx-icon",style:{color:"var(--color-main-100)"},color:"var(--color-main-100)",size:"30"},se=["title","onClick"],ae={key:1,class:"box-border w-full h-full py-10 overflow-y-auto"},re=["onClick","title"];const le={xmlns:"http://www.w3.org/2000/svg",width:"50",height:"50",fill:"none",viewBox:"0 0 25 25"};const ie={name:"YxToolbar",components:{ToolbarContainer:p(X,[["render",function(e,t,o,n,s,a){const l=r.resolveComponent("Badge");return r.openBlock(),r.createBlock(r.Transition,{name:"zoom",mode:"out-in"},{default:r.withCtx((()=>[r.withDirectives(r.createElementVNode("div",{class:r.normalizeClass(["toolbar-container",o.showTool?"zoom-in":"zoom-out "])},[s.curComponent.name?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",{key:0,style:r.normalizeStyle({"grid-template-columns":s.columns,"grid-template-rows":s.rows}),class:"toolbar-wrap"},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.configList,(e=>(r.openBlock(),r.createElementBlock("div",{class:"flex justify-center items-center",onClick:t=>a.configHandle(e),style:r.normalizeStyle({"grid-area":e["grid-area"]})},[r.createElementVNode("div",{title:e.label,class:"flex flex-col justify-center items-center"},[r.createElementVNode("div",G,[r.createElementVNode("i",Q,[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(e.icon)))]),e.isShowBadge?(r.openBlock(),r.createBlock(l,{key:0,value:o.badgeValue},null,8,["value"])):r.createCommentVNode("",!0)]),r.createElementVNode("span",ee,r.toDisplayString(e.label),1)],8,J)],12,Z)))),256))],4)),s.curComponent.name?(r.openBlock(),r.createElementBlock("div",te,["theme"===s.curComponent.name?(r.openBlock(),r.createElementBlock("div",oe,[r.createElementVNode("div",{class:"flex flex-col toolbar-center items-center",onClick:t[0]||(t[0]=e=>s.curComponent={}),title:"返回"},[r.createElementVNode("i",ne,[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(s.curComponent.icon)))])]),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.curComponent.data,((e,t)=>(r.openBlock(),r.createElementBlock("div",{style:r.normalizeStyle([{background:e.themeColor,boxShadow:`0px 4px 7px 0px ${e.themeColor}`},a.getPosition(t)]),title:e.name,class:r.normalizeClass(["theme",s.curTheme===e.id?"select":""]),onClick:t=>a.chooseTheme(e)},null,14,se)))),256))])):"lang"===s.curComponent.name?(r.openBlock(),r.createElementBlock("div",ae,[r.createElementVNode("div",{onClick:t[1]||(t[1]=e=>s.curComponent={}),class:"px-10 cursor-pointer"},"返回"),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.langList,(e=>(r.openBlock(),r.createElementBlock("div",{onClick:t=>a.changeLang(e.lang),title:e.name,class:"px-10 cursor-pointer mt-10 whitespace-nowrap truncate"},r.toDisplayString(e.name),9,re)))),256))])):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0)],2),[[r.vShow,o.showTool]])])),_:1})}],["__scopeId","data-v-adceffc6"]]),menuIcon:{render:function(e,t){return r.openBlock(),r.createElementBlock("svg",le,t[0]||(t[0]=[r.createElementVNode("g",{stroke:"currentColor","stroke-linejoin":"round","stroke-width":"2"},[r.createElementVNode("path",{d:"M9 3H4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1ZM9 14H4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1ZM20 3h-5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1ZM20 14h-5a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1Z"})],-1)]))}},Badge:F},mixins:[T],data:()=>({showTool:!1,position:{top:0,left:0},badgeValue:0,showBadge:window.isRenderIssue}),computed:{showClass(){return this.status?"expanded":"folded"}},mounted(){this.showBadge&&this.getCount(),this.initToolPosition()},methods:{initToolPosition(){const e=document.querySelector(".toolbar-wrap"),t=window.innerWidth-60-100+"px",o=window.innerHeight-60-100+"px";e.style.setProperty("--tool-left",t),e.style.setProperty("--tool-top",o)},async getCount(){const{data:e}=await a.getCommentUntreatedCount();this.badgeValue=e.count},handlerClickTool(e){this.mousePoint.x===e.screenX&&this.mousePoint.y===e.screenY&&(this.switchStatus(),this.getAllPosition(),this.setPanel(),this.showTool=!0)},switchStatus(){this.status=!this.status},getAllPosition(){this.toolPos=this.getDomPosition(this.toolDom),this.panelPos=this.getDomPosition(this.panelDom)},getDomPosition:e=>e.getBoundingClientRect(),setPanel(){const e=window.innerWidth-this.panelWidth,t=window.innerHeight-this.panelHeight;let o=this.toolPos.left+this.toolPos.width/2-this.panelWidth/2,n=this.toolPos.top+this.toolPos.height/2-this.panelHeight/2;o<0&&(o=0),n<0&&(n=0),o>e&&(o=e-40),n>t&&(n=t-40),this.setPanelPosition(o,n)},setPanelPosition(e,t){this.panelDom.style.left=e+"px",this.panelDom.style.top=t+"px"},mousedownTool(e){this.mousePoint.x=e.screenX,this.mousePoint.y=e.screenY},close(){this.status=!1,this.showTool=!1}}},ce=()=>{r.useCssVars((e=>({"0b6a2599":e.panelWidthPX,"7fe18f84":e.panelHeightPX})))},de=ie.setup;ie.setup=de?(e,t)=>(ce(),de(e,t)):ce;const ue={id:"toolbar-wrap",class:"toolbar-wrap"},he={class:"yx-icon"};const me=p(ie,[["render",function(e,t,o,n,s,a){const l=r.resolveComponent("Badge"),i=r.resolveComponent("ToolbarContainer");return r.openBlock(),r.createElementBlock("div",ue,[r.createElementVNode("div",{class:r.normalizeClass(["tool",`${a.showClass}`]),onClick:t[0]||(t[0]=(...e)=>a.handlerClickTool&&a.handlerClickTool(...e)),onMousedown:t[1]||(t[1]=(...e)=>a.mousedownTool&&a.mousedownTool(...e)),onMouseup:t[2]||(t[2]=(...t)=>e.mouseupTool&&e.mouseupTool(...t))},[r.createElementVNode("i",he,[(r.openBlock(),r.createBlock(r.resolveDynamicComponent("menuIcon")))]),s.showBadge?(r.openBlock(),r.createBlock(l,{key:0,value:s.badgeValue},null,8,["value"])):r.createCommentVNode("",!0)],34),r.createElementVNode("div",{class:r.normalizeClass(["mask",`${a.showClass}`]),onClick:t[3]||(t[3]=(...e)=>a.close&&a.close(...e))},null,2),r.createVNode(i,{onZero:t[4]||(t[4]=e=>s.badgeValue=0),badgeValue:s.badgeValue,class:"panel",showTool:s.showTool},null,8,["badgeValue","showTool"])])}],["__scopeId","data-v-1a4229ae"]]),pe=class t{constructor(n){var s,a,r;s=this,r="yxToolbarV2",(a=e).has(s)?o("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(s):a.set(s,r);const{theme:l,isRenderIssue:i,isRenderLang:c}=n;return t.instance||(window.theme=l,window.isRenderIssue=i,window.isRenderLang=c,this.init(),t.instance=this),t.instance}get vueVersion(){return r.version[0]}init(){this.mount()}mount(){const t=document.createElement("div");if(t.id=s(this,e),document.body.appendChild(t),"3"===this.vueVersion)return r.createApp(me).mount(`#${s(this,e)}`);return new(require("vue"))({render:e=>e(me)}).$mount(`#${s(this,e)}`)}};e=new WeakMap,pe.instance=null;let ge=pe;const ye="ttcGlobalState",we=async e=>{var t;e={...m,...e};let o=Ne();try{await fe(e);const{data:n}=await i.http.get(null==e?void 0:e.themeApiUrl,{},{headers:{noLoading:!0}});if(window.YX_THEME_LIST=n,e.isRenderLang&&e.systemKey){const t=await O();await z({to:t||e.lang,systemKey:e.systemKey})}e.isRenderToolbar&&new ge({theme:n,isRenderIssue:e.isRenderIssue,isRenderLang:e.isRenderLang});let s=o?null==(t=n.find((e=>e.id===o)))?void 0:t.themeUrl:"";if(!o||!s){const e=n.find((e=>1===e.defaultTheme))||n[0];s=e.themeUrl,o=e.id}const a=await ke(s);Te({themeCssVar:a,themeId:o}),ve(),new Le(i.BC_THEME_NAME).onmessage=e=>{var t;const o=JSON.parse(e.data);Se(o.data.themeCssVar),Te({themeCssVar:o.data.themeCssVar,themeId:null==(t=o.data)?void 0:t.themeId}),d.yxSubscribe.publish({type:"theme",data:null})},new Le(i.BC_LANG_NAME).onmessage=e=>{location.reload()}}catch(n){ve(),be()}},fe=e=>{i.setSystemConfig({...e})},ve=()=>{const e=document.createElement("style");e.innerHTML="@font-face {font-family: 'YX-TITLE';font-size: 16px; src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff'), url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699612675710_ALIBABAPUHUITI-2-105-HEAVY.TTF') format('woff2'); font-style: normal;font-display: swap;}@font-face { font-family: 'YX-SP-TITLE'; font-size: 16px; src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699844184489_bt.ttf') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699844184489_bt.ttf') format('woff2');font-style: normal; font-display: swap}@font-face {font-family: 'YX-TEXT'; font-size: 16px;src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699611032932_ALIBABAPUHUITI-2-65-MEDIUM.TTF') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/1699611032932_ALIBABAPUHUITI-2-65-MEDIUM.TTF') format('woff2'); font-style: normal; font-display: swap;}@font-face {font-family: 'PingFang SC'; font-size: 16px;src: url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/苹方-繁 中黑体.otf') format('woff'),url('https://yx-picture.obs.cn-north-4.myhuaweicloud.com/ttc/bucket/苹方-繁 中黑体.otf') format('woff2'); font-style: normal; font-display: swap}",document.head.appendChild(e)},Te=({themeCssVar:e,themeId:t})=>{const o=localStorage.getItem(ye)||"{}",n=JSON.parse(o);n.theme={themeCssVar:e,id:t},localStorage.setItem(ye,JSON.stringify(n))},xe=async e=>{const t=await ke(e.themeUrl);Te({themeCssVar:t,themeId:null==e?void 0:e.id}),new Le(i.BC_THEME_NAME).postMessage(JSON.stringify({type:"theme",data:{themeId:null==e?void 0:e.id,themeUrl:null==e?void 0:e.themeUrl,themeCssVar:t}})),d.yxSubscribe.publish({type:"theme",data:e})},be=()=>{const e=Ee(),t=document.documentElement;Object.keys(e).forEach((o=>{"exclude"!==o&&Object.keys(e[o]).forEach((n=>{const s=`--${o}-${n}`;t.style.setProperty(s,e[o][n])}))}))},ke=async e=>{const t=await fetch(e),o=await t.json(),n=()=>{let e=":root {\n";return Object.keys(o).forEach((t=>{"exclude"!==t&&Object.keys(o[t]).forEach((n=>{const s=`--${t}-${n}`,a=o[t][n];e+=` ${s}: ${a};\n`}))})),e+="}",e},s=document.querySelector(".YX_THEME_STYLE");if(s)s.innerHTML="",s.appendChild(document.createTextNode(n()));else{const e=document.createElement("style");e.className="YX_THEME_STYLE",e.appendChild(document.createTextNode(n())),document.head.appendChild(e)}return o},Ce=async()=>{const{data:e}=await a.getUserThemeList(),t=e.find((e=>1===e.defaultTheme));return t?t.themeUrl:e[0].themeUrl},Ne=()=>{var e;const t=localStorage.getItem(ye),o=t&&(null==(e=JSON.parse(t))?void 0:e.theme);return(null==o?void 0:o.id)||null},Ee=()=>{var e;const t=localStorage.getItem(ye),o=t&&(null==(e=JSON.parse(t))?void 0:e.theme);return(null==o?void 0:o.themeCssVar)||{}},Ve=e=>{const t=Ee();return(null==t?void 0:t[e])||{}},Ie=(e,t)=>{const o=Ee();if(!o.exclude)return null;for(let n in o.exclude){const s=o.exclude[n];for(let o of Object.keys(s))for(let n of Object.keys(s[o])){if(`--${o}-${n}`===e&&c.isColorEqual(s[o][n],t))return t}}return null},Se=(e,t)=>{const o=e||Ee(),n=()=>{let e=":root {\n";return Object.keys(o).forEach((t=>{"exclude"!==t&&Object.keys(o[t]).forEach((n=>{const s=`--${t}-${n}`,a=o[t][n];e+=` ${s}: ${a};\n`}))})),e+="}",e},s=t||"YX_THEME_STYLE",a=document.querySelector(`.${s}`);if(a)a.innerHTML="",a.appendChild(document.createTextNode(n()));else{const e=document.createElement("style");e.className="YX_THEME_STYLE",e.appendChild(document.createTextNode(n())),document.head.appendChild(e)}},Be=Object.freeze(Object.defineProperty({__proto__:null,changeTheme:xe,findColorByTheme:Ie,getCurTheme:Ne,getCurThemeCssVar:Ee,getDefaultThemeUrl:Ce,getGroupColor:Ve,install:we,installCssVarInSystemTheme:Se,saveCssVar:Te,setCssVar:ke,updateTheme:be},Symbol.toStringTag,{value:"Module"}));class Le{constructor(e){n(this,"onmessage"),n(this,"postMessage"),Le.init();const t=new BroadcastChannel(e);this.onmessage=e=>e,t.onmessage=e=>{const{type:t}=e.data;if("router"===t){if(window.pageActive)return this.onmessage(e)}else this.onmessage(e)},this.postMessage=e=>t.postMessage(e)}static init(){window.pageActive="visible"===document.visibilityState,document.addEventListener("visibilitychange",(()=>{window.pageActive="visible"===document.visibilityState}))}}const _e=Object.freeze(Object.defineProperty({__proto__:null,BC:Le},Symbol.toStringTag,{value:"Module"}));exports.BC=_e,exports.BC$1=Le,exports.Toolbar=ge,exports.YxTablePro=w,exports._export_sfc=p,exports.changeLang=H,exports.changeTheme=xe,exports.findColorByTheme=Ie,exports.getCurTheme=Ne,exports.getCurThemeCssVar=Ee,exports.getDefaultThemeUrl=Ce,exports.getGroupColor=Ve,exports.getLang=O,exports.getWordByYxI18nThesaurus=$,exports.getZhWordByYxI18nThesaurus=q,exports.handleTranslation=M,exports.initTranslate=z,exports.install=we,exports.installCssVarInSystemTheme=Se,exports.loadCustomThesaurus=R,exports.saveCssVar=Te,exports.setCssVar=ke,exports.theme2=Be,exports.translate2=K,exports.updateTheme=be,exports.whitelistApi=_;
|
package/lib/index.cjs5.js.gz
CHANGED
|
Binary file
|
package/lib/index.es12.js
CHANGED
|
@@ -278,6 +278,8 @@ class YxHttp {
|
|
|
278
278
|
__publicField(this, "customResquestInterceptors");
|
|
279
279
|
/**自定义响应拦截器逻辑 */
|
|
280
280
|
__publicField(this, "customResponseInterceptors");
|
|
281
|
+
/** 自定义全局响应处理回调*/
|
|
282
|
+
__publicField(this, "customGlobalResHandler");
|
|
281
283
|
this.service = axios.create(config2);
|
|
282
284
|
this.setupInterceptors();
|
|
283
285
|
this.customResMap = {};
|
|
@@ -306,6 +308,10 @@ class YxHttp {
|
|
|
306
308
|
let data = response.data;
|
|
307
309
|
hideFullScreenLoading();
|
|
308
310
|
if (this.customResponseInterceptors) return this.customResponseInterceptors(response);
|
|
311
|
+
if (this.customGlobalResHandler) {
|
|
312
|
+
const isContinue = this.customGlobalResHandler(response);
|
|
313
|
+
if (!isContinue) return;
|
|
314
|
+
}
|
|
309
315
|
const code = response.status;
|
|
310
316
|
if (config2.url && this.customResMap[config2.url]) {
|
|
311
317
|
return this.customResMap[config2.url](data, response);
|
|
@@ -322,6 +328,10 @@ class YxHttp {
|
|
|
322
328
|
const response = error.response;
|
|
323
329
|
const { config: config2 } = error;
|
|
324
330
|
if (this.customResponseInterceptors) return this.customResponseInterceptors(response);
|
|
331
|
+
if (this.customGlobalResHandler) {
|
|
332
|
+
const isContinue = this.customGlobalResHandler(response);
|
|
333
|
+
if (!isContinue) return;
|
|
334
|
+
}
|
|
325
335
|
if ((config2 == null ? void 0 : config2.url) && this.customResMap[config2.url]) {
|
|
326
336
|
return this.customResMap[config2.url](error.response);
|
|
327
337
|
}
|
|
@@ -418,6 +428,14 @@ class YxHttp {
|
|
|
418
428
|
interceptorsResponseCallback(callback) {
|
|
419
429
|
this.customResponseInterceptors = callback;
|
|
420
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* 自定义请求拦截器回调
|
|
433
|
+
* @param url
|
|
434
|
+
* @param callback
|
|
435
|
+
*/
|
|
436
|
+
customGlobalResHandlerCallback(callback) {
|
|
437
|
+
this.customGlobalResHandler = callback;
|
|
438
|
+
}
|
|
421
439
|
}
|
|
422
440
|
const http = new YxHttp(config);
|
|
423
441
|
export {
|
package/lib/index.es12.js.gz
CHANGED
|
Binary file
|
package/lib/index.es5.js
CHANGED
|
@@ -1342,7 +1342,7 @@ const _Toolbar = class _Toolbar {
|
|
|
1342
1342
|
_elId = new WeakMap();
|
|
1343
1343
|
_Toolbar.instance = null;
|
|
1344
1344
|
let Toolbar = _Toolbar;
|
|
1345
|
-
const TTC_THTEME_KEY = "
|
|
1345
|
+
const TTC_THTEME_KEY = "ttcGlobalState";
|
|
1346
1346
|
const install = async (config2) => {
|
|
1347
1347
|
var _a;
|
|
1348
1348
|
config2 = { ...defaultConfig, ...config2 };
|
package/lib/index.es5.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
searchProps: {
|
|
3
|
+
type: ObjectConstructor;
|
|
4
|
+
default: () => {};
|
|
5
|
+
};
|
|
6
|
+
tableProps: {
|
|
7
|
+
type: ObjectConstructor;
|
|
8
|
+
default: () => {};
|
|
9
|
+
};
|
|
10
|
+
pageInfo: {
|
|
11
|
+
type: ObjectConstructor;
|
|
12
|
+
default: () => {
|
|
13
|
+
pageSize: number;
|
|
14
|
+
pageIndex: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
pageConfig: {
|
|
18
|
+
type: ObjectConstructor;
|
|
19
|
+
default: () => {
|
|
20
|
+
isPage: boolean;
|
|
21
|
+
gap: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
requestConfig: {
|
|
25
|
+
type: ObjectConstructor;
|
|
26
|
+
default: () => {};
|
|
27
|
+
};
|
|
28
|
+
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
31
|
+
searchProps: {
|
|
32
|
+
type: ObjectConstructor;
|
|
33
|
+
default: () => {};
|
|
34
|
+
};
|
|
35
|
+
tableProps: {
|
|
36
|
+
type: ObjectConstructor;
|
|
37
|
+
default: () => {};
|
|
38
|
+
};
|
|
39
|
+
pageInfo: {
|
|
40
|
+
type: ObjectConstructor;
|
|
41
|
+
default: () => {
|
|
42
|
+
pageSize: number;
|
|
43
|
+
pageIndex: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
pageConfig: {
|
|
47
|
+
type: ObjectConstructor;
|
|
48
|
+
default: () => {
|
|
49
|
+
isPage: boolean;
|
|
50
|
+
gap: number;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
requestConfig: {
|
|
54
|
+
type: ObjectConstructor;
|
|
55
|
+
default: () => {};
|
|
56
|
+
};
|
|
57
|
+
}>> & Readonly<{}>, {
|
|
58
|
+
pageInfo: Record<string, any>;
|
|
59
|
+
searchProps: Record<string, any>;
|
|
60
|
+
tableProps: Record<string, any>;
|
|
61
|
+
pageConfig: Record<string, any>;
|
|
62
|
+
requestConfig: Record<string, any>;
|
|
63
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
64
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Author: wangxin wangxin@emposat.com
|
|
3
|
+
* @Date: 2025-08-12 16:18:41
|
|
4
|
+
* @LastEditors: wangxin wangxin@emposat.com
|
|
5
|
+
* @LastEditTime: 2025-08-12 16:23:18
|
|
6
|
+
* @FilePath: packages/components/CommonPage/pagination.tsx
|
|
7
|
+
* @Description: 这是默认设置,可以在设置》工具》File Description中进行配置
|
|
8
|
+
*/
|
|
9
|
+
export declare const paginationRender: (pageInfo: any, updatePage: any) => import("vue/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Author: wangxin wangxin@emposat.com
|
|
3
|
+
* @Date: 2025-08-12 15:42:00
|
|
4
|
+
* @LastEditors: wangxin wangxin@emposat.com
|
|
5
|
+
* @LastEditTime: 2025-08-12 16:09:56
|
|
6
|
+
* @FilePath: packages/components/CommonPage/props.ts
|
|
7
|
+
* @Description: 这是默认设置,可以在设置》工具》File Description中进行配置
|
|
8
|
+
*/
|
|
9
|
+
export declare const pageProps: {
|
|
10
|
+
searchProps: {
|
|
11
|
+
type: ObjectConstructor;
|
|
12
|
+
default: () => {};
|
|
13
|
+
};
|
|
14
|
+
tableProps: {
|
|
15
|
+
type: ObjectConstructor;
|
|
16
|
+
default: () => {};
|
|
17
|
+
};
|
|
18
|
+
pageInfo: {
|
|
19
|
+
type: ObjectConstructor;
|
|
20
|
+
default: () => {
|
|
21
|
+
pageSize: number;
|
|
22
|
+
pageIndex: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
pageConfig: {
|
|
26
|
+
type: ObjectConstructor;
|
|
27
|
+
default: () => {
|
|
28
|
+
isPage: boolean;
|
|
29
|
+
gap: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
requestConfig: {
|
|
33
|
+
type: ObjectConstructor;
|
|
34
|
+
default: () => {};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -14,6 +14,8 @@ declare class YxHttp {
|
|
|
14
14
|
customResquestInterceptors?: any;
|
|
15
15
|
/**自定义响应拦截器逻辑 */
|
|
16
16
|
customResponseInterceptors?: Function;
|
|
17
|
+
/** 自定义全局响应处理回调*/
|
|
18
|
+
customGlobalResHandler?: (res: any) => boolean;
|
|
17
19
|
constructor(config: CustomAxiosRequestConfig);
|
|
18
20
|
private setupInterceptors;
|
|
19
21
|
private getResMessage;
|
|
@@ -59,6 +61,12 @@ declare class YxHttp {
|
|
|
59
61
|
* @param callback
|
|
60
62
|
*/
|
|
61
63
|
interceptorsResponseCallback(callback: Function): void;
|
|
64
|
+
/**
|
|
65
|
+
* 自定义请求拦截器回调
|
|
66
|
+
* @param url
|
|
67
|
+
* @param callback
|
|
68
|
+
*/
|
|
69
|
+
customGlobalResHandlerCallback(callback: Function): void;
|
|
62
70
|
}
|
|
63
71
|
declare const _default: YxHttp;
|
|
64
72
|
export default _default;
|