x-essential-lib 0.10.1 → 0.10.2
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/i18n-en.nsm1ldfp.js +113 -0
- package/dist/i18n-zhHans.do0bpr19.js +113 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1552 -1
- package/dist/rolldown-runtime.c6i0pdwe.js +18 -0
- package/dist/vendor.homyhtbu.js +751 -0
- package/package.json +3 -2
- package/dist/i18n-en.f0pmulir.js +0 -1
- package/dist/i18n-zhHans.ex0oq1u6.js +0 -1
- package/dist/rolldown-runtime.mam1o4z7.js +0 -1
- package/dist/style.css +0 -1
- package/dist/vendor.kktsxo4w.js +0 -3
package/dist/index.js
CHANGED
|
@@ -1 +1,1552 @@
|
|
|
1
|
-
import{a as e,i as t,o as n,r}from"./vendor.kktsxo4w.js";import{Fragment as i,Transition as a,computed as o,createBlock as s,createCommentVNode as c,createElementBlock as l,createElementVNode as u,createTextVNode as d,createVNode as f,defineComponent as p,inject as m,isRef as h,normalizeStyle as g,onBeforeMount as _,onBeforeUnmount as v,onMounted as y,openBlock as b,provide as x,ref as S,renderList as C,resolveComponent as w,toDisplayString as T,unref as E,useTemplateRef as D,watch as O,watchEffect as k,withCtx as A,withKeys as j,withModifiers as M}from"vue";import{useI18n as N}from"vue-i18n";import{useDisplay as ee,useTheme as P}from"vuetify";import{useRoute as te,useRouter as ne}from"vue-router";import re from"axios";function ie(){let e=P();return{primaryColor:o(()=>e.global.current.value.colors.primary),secondaryColor:o(()=>e.global.current.value.colors.secondary),backgroundColor0:o(()=>e.current.value.dark?`#2e2e2e`:`#bdbdbd`),backgroundColor1:o(()=>e.current.value.dark?`#272727`:`#eeeeee`),backgroundColor2:o(()=>e.current.value.dark?`#1e1e1e`:`#ffffff`),highlightColor:o(()=>e.current.value.dark?`#303030`:`#f6f6f6`),borderColor:o(()=>e.current.value.dark?`#ffffff1f`:`#0000001f`)}}function ae(e){let t=re.create({timeout:6e3});return t.defaults.baseURL=e.baseUrl,t.interceptors.request.use(e=>oe(e),t=>{se(t,e.onError)}),t.interceptors.response.use(e=>ce(e),t=>le(t,e.onError)),t}function oe(t){let n=e.get(`accessToken`)??``;return t.headers.Authorization=`Basic `+n,t.headers[`Content-Type`]=`application/json`,t.data=JSON.stringify(t.data),t}function se(e,t){console.error(e),t(`request timeout`)}function ce(e){return e.data}function le(e,t){let n=e.response;return n?(n.status===401&&ue(),n.data?.message?t(n.data?.message):t({code:n.status,message:n.statusText}),Promise.reject(e)):Promise.reject(e)}function ue(){e.remove(`accessToken`),e.remove(`refreshToken`),e.remove(`userId`),e.remove(`userName`),e.remove(`phone`),e.remove(`activeOrg`),ne().replace({path:`/passport/login`})}const de=(function(){return window.globalObjects||(window.globalObjects={router:null,i18n:null},console.log(`globalObjects created`)),window.globalObjects})(),F=(function(){return window.eventBus||(window.eventBus=t(),console.log(`eventBus created`)),window.eventBus})();async function fe(e){return new Promise(t=>{setTimeout(t,e)})}async function I(e,t,n){let r=Date.now();return new Promise(i=>{let a=async()=>{e()?i(!0):t&&Date.now()-r>t?i(!1):setTimeout(a,n??30)};a()})}function pe(e,t){let n=document.getElementById(`single-spa-application:`+e);n&&(n.classList.remove(`app-left`,`app-right`,`app-reset`),t?n.classList.add(`app-left`):n.classList.add(`app-right`),setTimeout(()=>{n.classList.add(`app-reset`)},50))}let L=Date.now();function R(){let e=Date.now();return e-L>500?(L=e,!0):!1}let me=0;function z(){return++me}async function he(e){if(!R())return;let t=!1,n,r=e=>{n=e,t=!0},i=z();return F.on(`confirmDlgResult`+i,r),F.emit(`confirmDlg`,{...e,seq:i}),await I(()=>t),F.off(`confirmDlgResult`+i,r),n}async function ge(e){if(!R())return;let t=!1,n,r=e=>{n=e,t=!0},i=z();return F.on(`numberDlgResult`+i,r),F.emit(`numberDlg`,{...e,seq:i}),await I(()=>t),F.off(`numberDlgResult`+i,r),n}async function _e(e){if(!R())return;let t=!1,n,r=e=>{n=e,t=!0},i=z();return F.on(`promptDlgResult`+i,r),F.emit(`promptDlg`,{...e,seq:i}),await I(()=>t),F.off(`promptDlgResult`+i,r),n}function ve(e){F.emit(`waitDlg`,{text:e})}function ye(){F.emit(`closeWaitDlg`)}function be(e,t){F.emit(`message`,{type:`error`,text:e,timeout:t})}function xe(e,t){F.emit(`message`,{type:`info`,text:e,timeout:t})}function Se(e,t){F.emit(`message`,{type:`success`,text:e,timeout:t})}function Ce(e,t){F.emit(`message`,{type:`warning`,text:e,timeout:t})}let we=function(e){return e.list_app_group=`list_app_group`,e.create_app_group=`create_app_group`,e.delete_app_group=`delete_app_group`,e.update_app_group=`update_app_group`,e.arrange_app_group=`arrange_app_group`,e.list_app=`list_app`,e.get_app=`get_app`,e.create_app=`create_app`,e.delete_app=`delete_app`,e.update_app=`update_app`,e.list_app_release=`list_app_release`,e.get_app_release=`get_app_release`,e.create_app_release=`create_app_release`,e.delete_app_release=`delete_app_release`,e.deploy_app_release=`deploy_app_release`,e.open_app_layer=`open_app_layer`,e.open_app=`open_app`,e.list_compute_space=`list_compute_space`,e.get_compute_space=`get_compute_space`,e.create_compute_space=`create_compute_space`,e.delete_compute_space=`delete_compute_space`,e.update_compute_space=`update_compute_space`,e.arrange_compute_space=`arrange_compute_space`,e.list_func_group=`list_func_group`,e.create_func_group=`create_func_group`,e.delete_func_group=`delete_func_group`,e.update_func_group=`update_func_group`,e.arrange_func_group=`arrange_func_group`,e.list_func=`list_func`,e.get_func=`get_func`,e.create_func=`create_func`,e.delete_func=`delete_func`,e.update_func=`update_func`,e.debug_func=`debug_func`,e.call_func=`call_func`,e.list_func_release=`list_func_release`,e.get_func_release=`get_func_release`,e.create_func_release=`create_func_release`,e.delete_func_release=`delete_func_release`,e.deploy_func_release=`deploy_func_release`,e.list_flow_group=`list_flow_group`,e.create_flow_group=`create_flow_group`,e.delete_flow_group=`delete_flow_group`,e.update_flow_group=`update_flow_group`,e.arrange_flow_group=`arrange_flow_group`,e.list_flow=`list_flow`,e.get_flow=`get_flow`,e.create_flow=`create_flow`,e.delete_flow=`delete_flow`,e.update_flow=`update_flow`,e.debug_flow=`debug_flow`,e.call_flow=`call_flow`,e.list_flow_release=`list_flow_release`,e.get_flow_release=`get_flow_release`,e.create_flow_release=`create_flow_release`,e.delete_flow_release=`delete_flow_release`,e.deploy_flow_release=`deploy_flow_release`,e.list_task=`list_task`,e.get_task=`get_task`,e.create_task=`create_task`,e.delete_task=`delete_task`,e.update_task=`update_task`,e.call_task=`call_task`,e.open_compute_layer=`open_compute_layer`,e.list_data_space=`list_data_space`,e.get_data_space=`get_data_space`,e.create_data_space=`create_data_space`,e.delete_data_space=`delete_data_space`,e.update_data_space=`update_data_space`,e.arrange_data_space=`arrange_data_space`,e.list_table_group=`list_table_group`,e.create_table_group=`create_table_group`,e.delete_table_group=`delete_table_group`,e.update_table_group=`update_table_group`,e.arrange_table_group=`arrange_table_group`,e.list_table=`list_table`,e.get_table=`get_table`,e.create_table=`create_table`,e.delete_table=`delete_table`,e.update_table=`update_table`,e.get_data=`get_data`,e.create_data=`create_data`,e.delete_data=`delete_data`,e.update_data=`update_data`,e.get_relation_graph=`get_relation_graph`,e.update_relation_graph=`update_relation_graph`,e.list_change=`list_change`,e.apply_change=`apply_change`,e.open_data_layer=`open_data_layer`,e.list_resource_space=`list_resource_space`,e.get_resource_space=`get_resource_space`,e.create_resource_space=`create_resource_space`,e.delete_resource_space=`delete_resource_space`,e.update_resource_space=`update_resource_space`,e.arrange_resource_space=`arrange_resource_space`,e.list_dir=`list_dir`,e.create_dir=`create_dir`,e.delete_dir=`delete_dir`,e.update_dir=`update_dir`,e.move_dir=`move_dir`,e.list_resource=`list_resource`,e.get_resource=`get_resource`,e.create_resource=`create_resource`,e.delete_resource=`delete_resource`,e.update_resource=`update_resource`,e.move_resource=`move_resource`,e.open_resource_layer=`open_resource_layer`,e.list_org_member=`list_org_member`,e.add_org_member=`add_org_member`,e.remove_org_member=`remove_org_member`,e.update_org_member=`update_org_member`,e.list_org_role_group=`list_org_role_group`,e.create_org_role_group=`create_org_role_group`,e.delete_org_role_group=`delete_org_role_group`,e.update_org_role_group=`update_org_role_group`,e.arrange_org_role_group=`arrange_org_role_group`,e.list_org_role=`list_org_role`,e.get_org_role=`get_org_role`,e.create_org_role=`create_org_role`,e.delete_org_role=`delete_org_role`,e.update_org_role=`update_org_role`,e.get_org_structure=`get_org_structure`,e.update_org_structure=`update_org_structure`,e.filter_table=`filter_table`,e}({});function B(e,t){if(!e)return!1;let n=e;return Object.keys(n).length<=0||(t.split(`/`).forEach(e=>{if(Object.keys(n).length<=0)return!0;if(n[e])n=n[e];else return!1}),Object.keys(n).length<=0)}function V(e,t,n){let r=e[t];return r?n?!(!B(r.includes,n)||B(r.excludes,n)):!0:!1}const H=`essentialDark`,U=`essentialLocale`,W=`essentialPermissionObjects`,G=`essentialPermissionChecksum`,K=`essentialLastAppPath`,q=`essentialViews`;function Te(e){x(H,e)}function Ee(){return m(H)}function De(e){x(U,e)}function Oe(){return m(U)}function ke(e){x(W,e)}function Ae(){return m(W)}function je(e){x(G,e)}function Me(){return m(G)}function Ne(e){x(K,e)}function Pe(){return m(K)}function Fe(e){x(q,e)}function Ie(){return m(q)}const Le=[{app:`x-passport-mf`,path:`/passport/login`,level:0,mainActive:1},{app:`x-passport-mf`,path:`/passport/loginAccount`,level:1,mainActive:1},{app:`x-passport-mf`,path:`/passport/register`,level:1,mainActive:1},{app:`x-org-mf`,path:`/org/joinOrCreate`,level:1,requiredState:`auth`},{app:`x-org-mf`,path:`/org/manager`,level:1,requiredState:`org`,mainActive:2},{app:`x-main-mf`,path:`/main`,level:0,requiredState:`org`},{app:`x-mine-mf`,path:`/mine/personalInfo`,level:1,requiredState:`org`,mainActive:4},{app:`x-mine-mf`,path:`/mine/accountSecurity`,level:2,requiredState:`org`},{app:`x-mine-mf`,path:`/mine/settings`,level:1,requiredState:`org`,mainActive:4},{app:`x-mine-mf`,path:`/mine/general`,level:2,requiredState:`org`},{app:`x-mine-mf`,path:`/mine/general/darkMode`,level:3,requiredState:`org`},{app:`x-mine-mf`,path:`/mine/general/language`,level:3,requiredState:`org`},{app:`x-app-mf`,path:`/app/manager`,level:1,requiredState:`org`,mainActive:2},{app:`x-app-mf`,path:`/app/editor`,level:2,requiredState:`org`},{app:`x-compute-mf`,path:`/compute`,level:1,requiredState:`org`,mainActive:2},{app:`x-data-mf`,path:`/data`,level:1,requiredState:`org`,mainActive:2},{app:`x-resource-mf`,path:`/resource`,level:1,requiredState:`org`,mainActive:2}];function J(e){let t,n=0,r=e.split(`/`).filter(e=>e.trim()!==``);return Le.forEach(e=>{let i=e.path.split(`/`).filter(e=>e.trim()!==``),a=0;for(let e=0;e<r.length&&!(e>=i.length||r[e]!==i[e]);e++)a++;a>0&&a>n&&(t=e,n=a)}),t}const Y=S(``);function X(e,t,n){t===`/`&&(t=n);let r=J(e),i=J(t);if(!r){console.assert(!1);return}if(console.info(`~~~~routeChange~~~~ ${t} -> ${e}`),!i)return;let a=r.app===i.app,o=r.path===i.path,s=r.level>=i.level;a?o?Y.value=``:Y.value=s?`inner-left`:`inner-right`:(Y.value=``,pe(r.app,s))}function Re(){return!!e.get(`accessToken`)}function ze(){return!!e.get(`activeOrg`)}function Be(e,t,n){let r=Re(),i=ze(),a=J(e.path);if(!a)throw Error(`to route meta invalid`);if(a.requiredState===`auth`)if(r)if(i){let e=`/main`;return X(e,t.path,n),{path:e}}else{X(e.path,t.path,n);return}else{let e=`/passport/login`;return X(e,t.path,n),{path:e}}else if(a.requiredState===`org`)if(r)if(i){X(e.path,t.path,n);return}else{let e=`/org/joinOrCreate`;return X(e,t.path,n),{path:e}}else{let e=`/passport/login`;return X(e,t.path,n),{path:e}}else if(r)if(i){let e=`/main`;return X(e,t.path,n),{path:e}}else{let e=`/org/joinOrCreate`;return X(e,t.path,n),{path:e}}else{X(e.path,t.path,n);return}}const Ve=[`string`,`number`,`boolean`,`array`,`object`,`any`];function He(e){switch(e){case`string`:return`#5ba58c`;case`number`:return`#5b67a5`;case`boolean`:return`#5b80a5`;case`array`:return`#745ba5`;case`object`:return`#80a55b`;case`any`:return`#9e9e9e`}}function Ue(e){switch(e){case`string`:return``;case`number`:return 0;case`boolean`:return!1;case`array`:return[];case`object`:return{};case`any`:return null}}function We(e){return e.value.length<=0}function Ge(e){if(e.value.length>0)return e.value[e.value.length-1]}function Z(e,t){return!!e.value.find(e=>e===t)}function Ke(e,t){let n=e.value.findIndex(e=>e===t);n>=0&&e.value.splice(n,1),e.value.push(t)}function qe(e,t){let n=e.value.findIndex(e=>e===t);n>=0&&e.value.splice(n,1)}function Je(e){console.assert(e.value.length>0),e.value.pop()}function Ye(e){e.value=[]}function Xe(e,t,r,i,a,o){let s=te(),c=ne(),l=n(),u=S(!1);k(()=>{let t;t=typeof e.value==`boolean`?e.value:l.value,u.value=t}),Te(u),De(t),ke(r),je(i),Ne(a),Fe(o);let d=P();k(()=>{d.change(u.value?`dark`:`light`)});let f=()=>{if(!We(o)){Z(o,`waitDlg`)||Je(o);return}let e=J(s.path);if(!e){console.assert(!1);return}e.level===0?navigator?.Backbutton?.goHome(()=>{},()=>{}):c.back()},p=e=>{if(e.key===`Escape`){f();return}},m=()=>{f()};y(()=>{window.addEventListener(`keydown`,p),F.on(`backbutton`,m)}),v(()=>{window.removeEventListener(`keydown`,p),F.off(`backbutton`,m)});let h=t=>{e.value=t},g=e=>{t.value=e},b=e=>{let t=e;r.value=t[0],i.value=t[1]},x=e=>{a.value=e};_(()=>{F.on(`updateDark`,h),F.on(`updateLocale`,g),F.on(`updatePermission`,b),F.on(`updateLastAppPath`,x),F.emit(`syncGlobalState`)}),v(()=>{F.off(`updateDark`,h),F.off(`updateLocale`,g),F.off(`updatePermission`,b),F.off(`updateLastAppPath`,x)})}function Ze(){let e=Ae();function t(t,n){return V(e.value,t,n??``)}return{verifyPermission:t}}function Qe(){let{locale:e,t}=N(),n=o(()=>!!window.cordova),i=ee();return{sysBarAvail:n,compactWidth:o(()=>i.width.value<=1280?i.width.value+`px`:i.width.value<=1920?`768px`:`1024px`),isCurvedScreen:o(()=>!1),isMobile:()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),nameList:(n,r)=>{let i,a=n.map(e=>t(e));return i=r?`${a.join(`/`)} <${r.join(`/`)}>`:e.value===`en`?a.join(` `):a.join(``),i},sentenceOfAsk:(n,i,a)=>e.value===`en`?t(`dlg.common.ask`,{verb:r(t(n)),object:r(t(i)),name:a}):t(`dlg.common.ask`,{verb:t(n),object:t(i),name:a})}}function Q(e,t){let n=Ie(),r=o({get(){return Z(n,e)},set(t){t?Ke(n,e):qe(n,e)}}),i=e=>{t?.(e),r.value=!0};return y(()=>{F.on(e,i)}),v(()=>{F.off(e,i)}),{open:r}}var $e=p({__name:`index`,setup(e){let{t}=N(),n=S(``),r=S(``),i=S(``),a=S(``),o=S(``),c=S(``),l=S(``),u=0,p=!1,{open:m}=Q(`confirmDlg`,e=>{n.value=e.title,r.value=e.subtitle??``,i.value=e.text,a.value=e.cancel?.color??`primary`,o.value=e.cancel?.text??t(`dlg.common.cancel`),c.value=e.confirm?.color??`primary`,l.value=e.confirm?.text??t(`dlg.common.confirm`),u=e.seq,p=!1,m.value=!0}),g=()=>{m.value=!1,p||(F.emit(`confirmDlgResult`+u,!0),p=!0)};return O(m,e=>{!e&&!p&&(F.emit(`confirmDlgResult`+u,!1),p=!0)}),(e,t)=>{let u=w(`v-card-text`),p=w(`v-btn`),_=w(`v-card-actions`),v=w(`v-card`),y=w(`v-dialog`);return b(),s(y,{modelValue:E(m),"onUpdate:modelValue":t[1]||(t[1]=e=>h(m)?m.value=e:null),attach:``,"max-width":`600px`,transition:`dialog-top-transition`,onKeydown:[j(M(g,[`stop`,`prevent`]),[`enter`]),t[2]||(t[2]=j(M(e=>m.value=!1,[`stop`,`prevent`]),[`esc`]))]},{default:A(()=>[f(v,{subtitle:r.value,title:n.value},{default:A(()=>[f(u,null,{default:A(()=>[d(T(i.value),1)]),_:1}),f(_,{class:`d-flex justify-end`},{default:A(()=>[f(p,{color:a.value,variant:`text`,onClick:t[0]||(t[0]=e=>m.value=!1)},{default:A(()=>[d(T(o.value),1)]),_:1},8,[`color`]),f(p,{color:c.value,variant:`text`,onClick:g},{default:A(()=>[d(T(l.value),1)]),_:1},8,[`color`])]),_:1})]),_:1},8,[`subtitle`,`title`])]),_:1},8,[`modelValue`,`onKeydown`])}}}),et=p({__name:`index`,props:{open:{type:Boolean,required:!1,default:!0},zIndex:{type:Number,required:!1,default:1}},setup(e){let{backgroundColor2:t}=ie(),n=o(()=>({background:t.value,zIndex:e.zIndex})),r=0;return(t,i)=>(b(),s(a,{name:`fade`},{default:A(()=>[e.open?(b(),l(`div`,{key:h(r)?++r.value:++r,class:`x-cont`,style:g(n.value)},[...i[0]||(i[0]=[u(`div`,{class:`lds-spinner`},[u(`div`),u(`div`),u(`div`),u(`div`),u(`div`),u(`div`),u(`div`),u(`div`),u(`div`),u(`div`),u(`div`),u(`div`)],-1)])],4)):c(`v-if`,!0)]),_:1}))}}),$=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},tt=$(et,[[`__scopeId`,`data-v-x-essential-lib-c3545c8d`]]),nt=$(p({__name:`item`,props:{id:{type:Number,required:!0},type:{type:null,required:!0},text:{type:String,required:!0},timeout:{type:Number,required:!1,default:5e3}},emits:[`timeout`],setup(e,{emit:t}){let n=o(()=>({width:`calc(100% - 64px)`,overflowWrap:`break-word`})),r=o(()=>{switch(e.type){case`success`:return`mdi-check-circle`;case`info`:return`mdi-information`;case`error`:return`mdi-close-circle`;case`warning`:return`mdi-alert-circle`;default:return``}}),i=S(!0),a=t;return y(()=>{setTimeout(()=>{a(`timeout`,e.id)},e.timeout)}),O(i,t=>{t||a(`timeout`,e.id)}),(t,i)=>{let o=w(`v-icon`),l=w(`v-sheet`);return b(),s(l,{class:`x-item d-flex align-center py-2 mb-2`,color:e.type,elevation:1},{default:A(()=>[r.value?(b(),s(o,{key:0,class:`mx-1`,icon:r.value},null,8,[`icon`])):c(`v-if`,!0),u(`div`,{style:g(n.value)},T(e.text),5),f(o,{class:`mx-1`,icon:`mdi-close`,onClick:i[0]||(i[0]=t=>a(`timeout`,e.id))})]),_:1},8,[`color`])}}}),[[`__scopeId`,`data-v-x-essential-lib-cfcda9d9`]]),rt=$(p({__name:`index`,setup(e){let t=S([]);y(()=>{F.on(`message`,n)}),v(()=>{F.off(`message`,n)});let n=e=>{let{type:t,text:n,timeout:r}=e;o(t,n,r)},r=e=>{c(e)},a=0,o=(e,n,r)=>{let i=a++;t.value.push({id:i,type:e,text:n,timeout:r})},c=e=>{let n=t.value.findIndex(t=>t.id===e);n>=0&&t.value.splice(n,1)};return(e,n)=>(b(),l(`div`,{class:`x-cont d-flex flex-column-reverse align-center`,onClick:n[0]||(n[0]=M(()=>{},[`stop`]))},[(b(!0),l(i,null,C(t.value,e=>(b(),s(nt,{id:e.id,key:e.id,text:e.text,timeout:e.timeout,type:e.type,onTimeout:r},null,8,[`id`,`text`,`timeout`,`type`]))),128))]))}}),[[`__scopeId`,`data-v-x-essential-lib-b973907d`]]),it=p({__name:`index`,setup(e){let{t}=N(),n=S(``),r=S(``),i=S(0),a=S(),o=S(-1/0),c=S(1/0),l=S(1),u=0,p=!1,m=D(`target`),{open:g}=Q(`numberDlg`,async e=>{n.value=e.title,r.value=e.subtitle??``,i.value=e.value,a.value=e.precision,o.value=e.min,c.value=e.max,l.value=e.step,u=e.seq,p=!1,g.value=!0,await I(()=>!!m.value),m.value.focus()}),_=S(!1),v=()=>{g.value=!1,p||(F.emit(`numberDlgResult${u}`,i.value),p=!0)};return O(g,e=>{!e&&!p&&(F.emit(`numberDlgResult${u}`,void 0),p=!0)}),(e,r)=>{let u=w(`v-number-input`),p=w(`v-btn`),y=w(`v-card-actions`),x=w(`v-form`),S=w(`v-card`),C=w(`v-dialog`);return b(),s(C,{modelValue:E(g),"onUpdate:modelValue":r[3]||(r[3]=e=>h(g)?g.value=e:null),attach:``,"max-width":`600px`,transition:`dialog-top-transition`,onKeydown:r[4]||(r[4]=j(M(e=>g.value=!1,[`stop`,`prevent`]),[`esc`]))},{default:A(()=>[f(S,{title:n.value},{default:A(()=>[f(x,{modelValue:_.value,"onUpdate:modelValue":r[2]||(r[2]=e=>_.value=e),class:`mx-3`,onSubmit:M(v,[`prevent`])},{default:A(()=>[f(u,{ref_key:`target`,ref:m,modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=e=>i.value=e),"control-variant":`stacked`,max:c.value,min:o.value,precision:a.value,step:l.value},null,8,[`modelValue`,`max`,`min`,`precision`,`step`]),f(y,{class:`d-flex justify-end`},{default:A(()=>[f(p,{color:`primary`,variant:`text`,onClick:r[1]||(r[1]=e=>g.value=!1)},{default:A(()=>[d(T(E(t)(`dlg.common.cancel`)),1)]),_:1}),f(p,{color:`primary`,disabled:!_.value,type:`submit`,variant:`text`},{default:A(()=>[d(T(E(t)(`dlg.common.confirm`)),1)]),_:1},8,[`disabled`])]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`title`])]),_:1},8,[`modelValue`])}}}),at=p({__name:`index`,setup(e){let{t}=N(),n=S(``),r=S(``),i=S(``),a=S(``),o=S(``),l=S(),u=S(``),p=S(``),m=S(``),g=S(``),_=S(``),v=0,y=!1,x=D(`target`),{open:C}=Q(`promptDlg`,async e=>{n.value=e.title,r.value=e.subtitle??``,i.value=e.text,a.value=e.label,o.value=e.placeholder,l.value=e.rules,u.value=e.value,p.value=e.cancel?.color??`primary`,m.value=e.cancel?.text??t(`dlg.common.cancel`),g.value=e.confirm?.color??`primary`,_.value=e.confirm?.text??t(`dlg.common.confirm`),v=e.seq,y=!1,C.value=!0,await I(()=>!!x.value),x.value.focus()}),k=S(!1),ee=()=>{C.value=!1,y||(F.emit(`promptDlgResult`+v,u.value??``),y=!0)};return O(C,e=>{!e&&!y&&(F.emit(`promptDlgResult`+v,void 0),y=!0)}),(e,t)=>{let v=w(`v-card-text`),y=w(`v-text-field`),S=w(`v-btn`),D=w(`v-card-actions`),O=w(`v-form`),N=w(`v-card`),P=w(`v-dialog`);return b(),s(P,{modelValue:E(C),"onUpdate:modelValue":t[3]||(t[3]=e=>h(C)?C.value=e:null),attach:``,"max-width":`600px`,transition:`dialog-top-transition`,onKeydown:t[4]||(t[4]=j(M(e=>C.value=!1,[`stop`,`prevent`]),[`esc`]))},{default:A(()=>[f(N,{subtitle:r.value,title:n.value},{default:A(()=>[i.value?(b(),s(v,{key:0},{default:A(()=>[d(T(i.value),1)]),_:1})):c(`v-if`,!0),f(O,{modelValue:k.value,"onUpdate:modelValue":t[2]||(t[2]=e=>k.value=e),class:`mx-3`,onSubmit:M(ee,[`prevent`])},{default:A(()=>[f(y,{ref_key:`target`,ref:x,modelValue:u.value,"onUpdate:modelValue":t[0]||(t[0]=e=>u.value=e),label:a.value,placeholder:o.value,rules:l.value},null,8,[`modelValue`,`label`,`placeholder`,`rules`]),f(D,{class:`d-flex justify-end`},{default:A(()=>[f(S,{color:p.value,variant:`text`,onClick:t[1]||(t[1]=e=>C.value=!1)},{default:A(()=>[d(T(m.value),1)]),_:1},8,[`color`]),f(S,{color:g.value,disabled:!k.value,type:`submit`,variant:`text`},{default:A(()=>[d(T(_.value),1)]),_:1},8,[`color`,`disabled`])]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`subtitle`,`title`])]),_:1},8,[`modelValue`])}}}),ot=p({__name:`index`,props:{show:{type:Boolean,required:!0},top:{type:Number,required:!0},left:{type:Number,required:!0}},setup(e){let t=o(()=>({position:`absolute`,backgroundColor:`#ff00cc`,width:`100%`,height:`1px`,top:`${e.top}px`,left:`0px`,zIndex:9999})),n=o(()=>({position:`absolute`,backgroundColor:`#ff00cc`,width:`1px`,height:`100%`,top:`0px`,left:`${e.left}px`,zIndex:9999}));return(r,a)=>(b(),l(i,null,[e.show?(b(),l(`span`,{key:0,style:g(t.value)},null,4)):c(`v-if`,!0),e.show?(b(),l(`span`,{key:1,style:g(n.value)},null,4)):c(`v-if`,!0)],64))}});const st={class:`ma-auto`},ct={class:`w-100 h-100 d-flex align-center justify-center`},lt={class:`text-body-large`};var ut=p({__name:`index`,setup(e){let{t}=N(),n=S(``),r=e=>{n.value=e.text??t(`dlg.common.responding`),a.value=!0},i=()=>{a.value=!1},{open:a}=Q(`waitDlg`,r);return y(()=>{F.on(`closeWaitDlg`,i)}),v(()=>{F.off(`closeWaitDlg`,i)}),(e,t)=>{let r=w(`v-card`),i=w(`v-dialog`);return b(),s(i,{modelValue:E(a),"onUpdate:modelValue":t[0]||(t[0]=e=>h(a)?a.value=e:null),attach:``,fullscreen:``,"no-click-animation":``,persistent:``},{default:A(()=>[u(`div`,st,[f(r,{height:`80px`,loading:``,width:`300px`},{default:A(()=>[u(`div`,ct,[u(`span`,lt,T(n.value),1)])]),_:1})])]),_:1},8,[`modelValue`])}}});const dt=e=>{e.component(`XConfirmDlg`,$e),e.component(`XLoading`,tt),e.component(`XMessage`,rt),e.component(`XNumberDlg`,it),e.component(`XPromptDlg`,at),e.component(`XRefLine`,ot),e.component(`XWaitDlg`,ut)};async function ft(e){if(e===`en`)return(await import(`./i18n-en.f0pmulir.js`).then(e=>e.t)).default;if(e===`zhHans`)return(await import(`./i18n-zhHans.ex0oq1u6.js`).then(e=>e.t)).default;throw Error(`invalid locale=${e}`)}var pt={install:dt};export{we as Permission,Ke as addView,pe as appAppear,Ye as clearViews,ye as closeWaitDlg,ae as createAxios,pt as default,qe as delView,F as eventBus,He as getTypeColor,Ue as getTypeDefault,de as globalObjects,Z as hasView,Ee as injectDark,Pe as injectLastAppPath,Oe as injectLocale,Me as injectPermissionChecksum,Ae as injectPermissionObjects,Ie as injectViews,We as isEmpty,B as isExist,Ge as lastView,ft as loadLocaleMessageEssential,J as matchRouteMeta,be as messageError,xe as messageInfo,Se as messageSuccess,Ce as messageWarning,Be as onBeforeEach,he as openConfirmDlg,ge as openNumberDlg,_e as openPromptDlg,ve as openWaitDlg,Je as popView,Te as provideDark,Ne as provideLastAppPath,De as provideLocale,je as providePermissionChecksum,ke as providePermissionObjects,Fe as provideViews,Y as routeTransName,Ve as types,ie as useColor,Xe as useMicroApp,Ze as usePermission,Qe as useSystem,Q as useViewStack,V as verifyPermission,fe as waitMs,I as waitUtil};
|
|
1
|
+
(function(){try{document.getElementById(`x-essential-lib`)?.remove();const e = document.createElement(`style`);e.setAttribute(`id`, `x-essential-lib`);const t = document.createTextNode(`.fade-leave-active[data-v-x-essential-lib-c3545c8d]{transition:opacity .5s}.fade-leave-to[data-v-x-essential-lib-c3545c8d]{opacity:0}.x-cont[data-v-x-essential-lib-c3545c8d]{justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.lds-spinner[data-v-x-essential-lib-c3545c8d]{color:official;width:40px;height:40px;display:inline-block;position:relative}.lds-spinner div[data-v-x-essential-lib-c3545c8d]{transform-origin:20px 20px;animation:1.2s linear infinite lds-spinner-x-essential-lib-c3545c8d}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:after{content:" ";background:#9e9e9e;border-radius:5%;width:2px;height:6px;display:block;position:absolute;top:3px;left:18px}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:first-child{animation-delay:-1.1s;transform:rotate(0)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(2){animation-delay:-1s;transform:rotate(30deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(3){animation-delay:-.9s;transform:rotate(60deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(4){animation-delay:-.8s;transform:rotate(90deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(5){animation-delay:-.7s;transform:rotate(120deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(6){animation-delay:-.6s;transform:rotate(150deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(7){animation-delay:-.5s;transform:rotate(180deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(8){animation-delay:-.4s;transform:rotate(210deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(9){animation-delay:-.3s;transform:rotate(240deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(10){animation-delay:-.2s;transform:rotate(270deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(11){animation-delay:-.1s;transform:rotate(300deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(12){animation-delay:0s;transform:rotate(330deg)}@keyframes lds-spinner-x-essential-lib-c3545c8d{0%{opacity:1}to{opacity:0}}.x-item[data-v-x-essential-lib-cfcda9d9]{width:600px}@media (width<=600px){.x-item[data-v-x-essential-lib-cfcda9d9]{width:calc(100vw - 16px)}}.x-cont[data-v-x-essential-lib-b973907d]{z-index:9999;position:fixed;bottom:20px;left:50%;transform:translate(-50%)}`);e.appendChild(t);document.head.appendChild(e);}catch(e){console.error('rolldown-plugin-inject-css', e);}})()
|
|
2
|
+
import { a as api, i as mitt_default, o as usePreferredDark, r as toLower } from "./vendor.homyhtbu.js";
|
|
3
|
+
import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, isRef, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, openBlock, provide, ref, renderList, resolveComponent, toDisplayString, unref, useTemplateRef, watch, watchEffect, withCtx, withKeys, withModifiers } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
5
|
+
import { useDisplay, useTheme } from "vuetify";
|
|
6
|
+
import { useRoute, useRouter } from "vue-router";
|
|
7
|
+
import axios from "axios";
|
|
8
|
+
|
|
9
|
+
//#region src/composables/color.ts
|
|
10
|
+
function useColor() {
|
|
11
|
+
const theme = useTheme();
|
|
12
|
+
return {
|
|
13
|
+
primaryColor: computed(() => {
|
|
14
|
+
return theme.global.current.value.colors.primary;
|
|
15
|
+
}),
|
|
16
|
+
secondaryColor: computed(() => {
|
|
17
|
+
return theme.global.current.value.colors.secondary;
|
|
18
|
+
}),
|
|
19
|
+
backgroundColor0: computed(() => {
|
|
20
|
+
return theme.current.value.dark ? "#2e2e2e" : "#bdbdbd";
|
|
21
|
+
}),
|
|
22
|
+
backgroundColor1: computed(() => {
|
|
23
|
+
return theme.current.value.dark ? "#272727" : "#eeeeee";
|
|
24
|
+
}),
|
|
25
|
+
backgroundColor2: computed(() => {
|
|
26
|
+
return theme.current.value.dark ? "#1e1e1e" : "#ffffff";
|
|
27
|
+
}),
|
|
28
|
+
highlightColor: computed(() => {
|
|
29
|
+
return theme.current.value.dark ? "#303030" : "#f6f6f6";
|
|
30
|
+
}),
|
|
31
|
+
borderColor: computed(() => {
|
|
32
|
+
return theme.current.value.dark ? "#ffffff1f" : "#0000001f";
|
|
33
|
+
})
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/utils/axios.ts
|
|
39
|
+
function createAxios(options) {
|
|
40
|
+
const instance = axios.create({ timeout: 6e3 });
|
|
41
|
+
instance.defaults.baseURL = options.baseUrl;
|
|
42
|
+
instance.interceptors.request.use((config) => {
|
|
43
|
+
return onReqFulfilled(config);
|
|
44
|
+
}, (error) => {
|
|
45
|
+
onReqRejected(error, options.onError);
|
|
46
|
+
});
|
|
47
|
+
instance.interceptors.response.use((resp) => {
|
|
48
|
+
return onRespFullfilled(resp);
|
|
49
|
+
}, (error) => {
|
|
50
|
+
return onRespRejected(error, options.onError);
|
|
51
|
+
});
|
|
52
|
+
return instance;
|
|
53
|
+
}
|
|
54
|
+
function onReqFulfilled(config) {
|
|
55
|
+
const token = api.get("accessToken") ?? "";
|
|
56
|
+
config.headers["Authorization"] = "Basic " + token;
|
|
57
|
+
config.headers["Content-Type"] = "application/json";
|
|
58
|
+
config.data = JSON.stringify(config.data);
|
|
59
|
+
return config;
|
|
60
|
+
}
|
|
61
|
+
function onReqRejected(error, onError) {
|
|
62
|
+
console.error(error);
|
|
63
|
+
onError("request timeout");
|
|
64
|
+
}
|
|
65
|
+
function onRespFullfilled(resp) {
|
|
66
|
+
return resp.data;
|
|
67
|
+
}
|
|
68
|
+
function onRespRejected(error, onError) {
|
|
69
|
+
const resp = error.response;
|
|
70
|
+
if (!resp) return Promise.reject(error);
|
|
71
|
+
if (resp.status === 401) onUnauthorized();
|
|
72
|
+
if (resp.data?.message) onError(resp.data?.message);
|
|
73
|
+
else onError({
|
|
74
|
+
code: resp.status,
|
|
75
|
+
message: resp.statusText
|
|
76
|
+
});
|
|
77
|
+
return Promise.reject(error);
|
|
78
|
+
}
|
|
79
|
+
function onUnauthorized() {
|
|
80
|
+
api.remove("accessToken");
|
|
81
|
+
api.remove("refreshToken");
|
|
82
|
+
api.remove("userId");
|
|
83
|
+
api.remove("userName");
|
|
84
|
+
api.remove("phone");
|
|
85
|
+
api.remove("activeOrg");
|
|
86
|
+
useRouter().replace({ path: "/passport/login" });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/utils/misc.ts
|
|
91
|
+
const globalObjects = (function() {
|
|
92
|
+
if (!window.globalObjects) {
|
|
93
|
+
window.globalObjects = {
|
|
94
|
+
router: null,
|
|
95
|
+
i18n: null
|
|
96
|
+
};
|
|
97
|
+
console.log("globalObjects created");
|
|
98
|
+
}
|
|
99
|
+
return window.globalObjects;
|
|
100
|
+
})();
|
|
101
|
+
const eventBus = (function() {
|
|
102
|
+
if (!window.eventBus) {
|
|
103
|
+
window.eventBus = mitt_default();
|
|
104
|
+
console.log("eventBus created");
|
|
105
|
+
}
|
|
106
|
+
return window.eventBus;
|
|
107
|
+
})();
|
|
108
|
+
async function waitMs(ms) {
|
|
109
|
+
return new Promise((resolve) => {
|
|
110
|
+
setTimeout(resolve, ms);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async function waitUtil(conditionFunc, timeout, interval) {
|
|
114
|
+
const timestamp = Date.now();
|
|
115
|
+
return new Promise((resolve) => {
|
|
116
|
+
const check = async () => {
|
|
117
|
+
if (conditionFunc()) resolve(true);
|
|
118
|
+
else if (timeout && Date.now() - timestamp > timeout) resolve(false);
|
|
119
|
+
else setTimeout(check, interval ?? 30);
|
|
120
|
+
};
|
|
121
|
+
check();
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function appAppear(name, forward) {
|
|
125
|
+
const appElement = document.getElementById("single-spa-application:" + name);
|
|
126
|
+
if (!appElement) return;
|
|
127
|
+
appElement.classList.remove("app-left", "app-right", "app-reset");
|
|
128
|
+
if (forward) appElement.classList.add("app-left");
|
|
129
|
+
else appElement.classList.add("app-right");
|
|
130
|
+
setTimeout(() => {
|
|
131
|
+
appElement.classList.add("app-reset");
|
|
132
|
+
}, 50);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/utils/dialog.ts
|
|
137
|
+
let lastTime = Date.now();
|
|
138
|
+
function tryCooldown() {
|
|
139
|
+
const now = Date.now();
|
|
140
|
+
if (now - lastTime > 500) {
|
|
141
|
+
lastTime = now;
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
let sequence = 0;
|
|
147
|
+
function getSequence() {
|
|
148
|
+
return ++sequence;
|
|
149
|
+
}
|
|
150
|
+
async function openConfirmDlg(params) {
|
|
151
|
+
if (!tryCooldown()) return;
|
|
152
|
+
let resp = false;
|
|
153
|
+
let result;
|
|
154
|
+
const onResult = (res) => {
|
|
155
|
+
result = res;
|
|
156
|
+
resp = true;
|
|
157
|
+
};
|
|
158
|
+
const seq = getSequence();
|
|
159
|
+
eventBus.on("confirmDlgResult" + seq, onResult);
|
|
160
|
+
eventBus.emit("confirmDlg", {
|
|
161
|
+
...params,
|
|
162
|
+
seq
|
|
163
|
+
});
|
|
164
|
+
await waitUtil(() => resp);
|
|
165
|
+
eventBus.off("confirmDlgResult" + seq, onResult);
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
async function openNumberDlg(params) {
|
|
169
|
+
if (!tryCooldown()) return;
|
|
170
|
+
let resp = false;
|
|
171
|
+
let result;
|
|
172
|
+
const onResult = (res) => {
|
|
173
|
+
result = res;
|
|
174
|
+
resp = true;
|
|
175
|
+
};
|
|
176
|
+
const seq = getSequence();
|
|
177
|
+
eventBus.on("numberDlgResult" + seq, onResult);
|
|
178
|
+
eventBus.emit("numberDlg", {
|
|
179
|
+
...params,
|
|
180
|
+
seq
|
|
181
|
+
});
|
|
182
|
+
await waitUtil(() => resp);
|
|
183
|
+
eventBus.off("numberDlgResult" + seq, onResult);
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
async function openPromptDlg(params) {
|
|
187
|
+
if (!tryCooldown()) return;
|
|
188
|
+
let resp = false;
|
|
189
|
+
let result;
|
|
190
|
+
const onResult = (res) => {
|
|
191
|
+
result = res;
|
|
192
|
+
resp = true;
|
|
193
|
+
};
|
|
194
|
+
const seq = getSequence();
|
|
195
|
+
eventBus.on("promptDlgResult" + seq, onResult);
|
|
196
|
+
eventBus.emit("promptDlg", {
|
|
197
|
+
...params,
|
|
198
|
+
seq
|
|
199
|
+
});
|
|
200
|
+
await waitUtil(() => resp);
|
|
201
|
+
eventBus.off("promptDlgResult" + seq, onResult);
|
|
202
|
+
return result;
|
|
203
|
+
}
|
|
204
|
+
function openWaitDlg(text) {
|
|
205
|
+
eventBus.emit("waitDlg", { text });
|
|
206
|
+
}
|
|
207
|
+
function closeWaitDlg() {
|
|
208
|
+
eventBus.emit("closeWaitDlg");
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/utils/message.ts
|
|
213
|
+
function messageError(text, timeout) {
|
|
214
|
+
eventBus.emit("message", {
|
|
215
|
+
type: "error",
|
|
216
|
+
text,
|
|
217
|
+
timeout
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function messageInfo(text, timeout) {
|
|
221
|
+
eventBus.emit("message", {
|
|
222
|
+
type: "info",
|
|
223
|
+
text,
|
|
224
|
+
timeout
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function messageSuccess(text, timeout) {
|
|
228
|
+
eventBus.emit("message", {
|
|
229
|
+
type: "success",
|
|
230
|
+
text,
|
|
231
|
+
timeout
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function messageWarning(text, timeout) {
|
|
235
|
+
eventBus.emit("message", {
|
|
236
|
+
type: "warning",
|
|
237
|
+
text,
|
|
238
|
+
timeout
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/utils/permission.ts
|
|
244
|
+
let Permission = /* @__PURE__ */ function(Permission) {
|
|
245
|
+
Permission["list_app_group"] = "list_app_group";
|
|
246
|
+
Permission["create_app_group"] = "create_app_group";
|
|
247
|
+
Permission["delete_app_group"] = "delete_app_group";
|
|
248
|
+
Permission["update_app_group"] = "update_app_group";
|
|
249
|
+
Permission["arrange_app_group"] = "arrange_app_group";
|
|
250
|
+
Permission["list_app"] = "list_app";
|
|
251
|
+
Permission["get_app"] = "get_app";
|
|
252
|
+
Permission["create_app"] = "create_app";
|
|
253
|
+
Permission["delete_app"] = "delete_app";
|
|
254
|
+
Permission["update_app"] = "update_app";
|
|
255
|
+
Permission["list_app_release"] = "list_app_release";
|
|
256
|
+
Permission["get_app_release"] = "get_app_release";
|
|
257
|
+
Permission["create_app_release"] = "create_app_release";
|
|
258
|
+
Permission["delete_app_release"] = "delete_app_release";
|
|
259
|
+
Permission["deploy_app_release"] = "deploy_app_release";
|
|
260
|
+
Permission["open_app_layer"] = "open_app_layer";
|
|
261
|
+
Permission["open_app"] = "open_app";
|
|
262
|
+
Permission["list_compute_space"] = "list_compute_space";
|
|
263
|
+
Permission["get_compute_space"] = "get_compute_space";
|
|
264
|
+
Permission["create_compute_space"] = "create_compute_space";
|
|
265
|
+
Permission["delete_compute_space"] = "delete_compute_space";
|
|
266
|
+
Permission["update_compute_space"] = "update_compute_space";
|
|
267
|
+
Permission["arrange_compute_space"] = "arrange_compute_space";
|
|
268
|
+
Permission["list_func_group"] = "list_func_group";
|
|
269
|
+
Permission["create_func_group"] = "create_func_group";
|
|
270
|
+
Permission["delete_func_group"] = "delete_func_group";
|
|
271
|
+
Permission["update_func_group"] = "update_func_group";
|
|
272
|
+
Permission["arrange_func_group"] = "arrange_func_group";
|
|
273
|
+
Permission["list_func"] = "list_func";
|
|
274
|
+
Permission["get_func"] = "get_func";
|
|
275
|
+
Permission["create_func"] = "create_func";
|
|
276
|
+
Permission["delete_func"] = "delete_func";
|
|
277
|
+
Permission["update_func"] = "update_func";
|
|
278
|
+
Permission["debug_func"] = "debug_func";
|
|
279
|
+
Permission["call_func"] = "call_func";
|
|
280
|
+
Permission["list_func_release"] = "list_func_release";
|
|
281
|
+
Permission["get_func_release"] = "get_func_release";
|
|
282
|
+
Permission["create_func_release"] = "create_func_release";
|
|
283
|
+
Permission["delete_func_release"] = "delete_func_release";
|
|
284
|
+
Permission["deploy_func_release"] = "deploy_func_release";
|
|
285
|
+
Permission["list_flow_group"] = "list_flow_group";
|
|
286
|
+
Permission["create_flow_group"] = "create_flow_group";
|
|
287
|
+
Permission["delete_flow_group"] = "delete_flow_group";
|
|
288
|
+
Permission["update_flow_group"] = "update_flow_group";
|
|
289
|
+
Permission["arrange_flow_group"] = "arrange_flow_group";
|
|
290
|
+
Permission["list_flow"] = "list_flow";
|
|
291
|
+
Permission["get_flow"] = "get_flow";
|
|
292
|
+
Permission["create_flow"] = "create_flow";
|
|
293
|
+
Permission["delete_flow"] = "delete_flow";
|
|
294
|
+
Permission["update_flow"] = "update_flow";
|
|
295
|
+
Permission["debug_flow"] = "debug_flow";
|
|
296
|
+
Permission["call_flow"] = "call_flow";
|
|
297
|
+
Permission["list_flow_release"] = "list_flow_release";
|
|
298
|
+
Permission["get_flow_release"] = "get_flow_release";
|
|
299
|
+
Permission["create_flow_release"] = "create_flow_release";
|
|
300
|
+
Permission["delete_flow_release"] = "delete_flow_release";
|
|
301
|
+
Permission["deploy_flow_release"] = "deploy_flow_release";
|
|
302
|
+
Permission["list_task"] = "list_task";
|
|
303
|
+
Permission["get_task"] = "get_task";
|
|
304
|
+
Permission["create_task"] = "create_task";
|
|
305
|
+
Permission["delete_task"] = "delete_task";
|
|
306
|
+
Permission["update_task"] = "update_task";
|
|
307
|
+
Permission["call_task"] = "call_task";
|
|
308
|
+
Permission["open_compute_layer"] = "open_compute_layer";
|
|
309
|
+
Permission["list_data_space"] = "list_data_space";
|
|
310
|
+
Permission["get_data_space"] = "get_data_space";
|
|
311
|
+
Permission["create_data_space"] = "create_data_space";
|
|
312
|
+
Permission["delete_data_space"] = "delete_data_space";
|
|
313
|
+
Permission["update_data_space"] = "update_data_space";
|
|
314
|
+
Permission["arrange_data_space"] = "arrange_data_space";
|
|
315
|
+
Permission["list_table_group"] = "list_table_group";
|
|
316
|
+
Permission["create_table_group"] = "create_table_group";
|
|
317
|
+
Permission["delete_table_group"] = "delete_table_group";
|
|
318
|
+
Permission["update_table_group"] = "update_table_group";
|
|
319
|
+
Permission["arrange_table_group"] = "arrange_table_group";
|
|
320
|
+
Permission["list_table"] = "list_table";
|
|
321
|
+
Permission["get_table"] = "get_table";
|
|
322
|
+
Permission["create_table"] = "create_table";
|
|
323
|
+
Permission["delete_table"] = "delete_table";
|
|
324
|
+
Permission["update_table"] = "update_table";
|
|
325
|
+
Permission["get_data"] = "get_data";
|
|
326
|
+
Permission["create_data"] = "create_data";
|
|
327
|
+
Permission["delete_data"] = "delete_data";
|
|
328
|
+
Permission["update_data"] = "update_data";
|
|
329
|
+
Permission["get_relation_graph"] = "get_relation_graph";
|
|
330
|
+
Permission["update_relation_graph"] = "update_relation_graph";
|
|
331
|
+
Permission["list_change"] = "list_change";
|
|
332
|
+
Permission["apply_change"] = "apply_change";
|
|
333
|
+
Permission["open_data_layer"] = "open_data_layer";
|
|
334
|
+
Permission["list_resource_space"] = "list_resource_space";
|
|
335
|
+
Permission["get_resource_space"] = "get_resource_space";
|
|
336
|
+
Permission["create_resource_space"] = "create_resource_space";
|
|
337
|
+
Permission["delete_resource_space"] = "delete_resource_space";
|
|
338
|
+
Permission["update_resource_space"] = "update_resource_space";
|
|
339
|
+
Permission["arrange_resource_space"] = "arrange_resource_space";
|
|
340
|
+
Permission["list_dir"] = "list_dir";
|
|
341
|
+
Permission["create_dir"] = "create_dir";
|
|
342
|
+
Permission["delete_dir"] = "delete_dir";
|
|
343
|
+
Permission["update_dir"] = "update_dir";
|
|
344
|
+
Permission["move_dir"] = "move_dir";
|
|
345
|
+
Permission["list_resource"] = "list_resource";
|
|
346
|
+
Permission["get_resource"] = "get_resource";
|
|
347
|
+
Permission["create_resource"] = "create_resource";
|
|
348
|
+
Permission["delete_resource"] = "delete_resource";
|
|
349
|
+
Permission["update_resource"] = "update_resource";
|
|
350
|
+
Permission["move_resource"] = "move_resource";
|
|
351
|
+
Permission["open_resource_layer"] = "open_resource_layer";
|
|
352
|
+
Permission["list_org_member"] = "list_org_member";
|
|
353
|
+
Permission["add_org_member"] = "add_org_member";
|
|
354
|
+
Permission["remove_org_member"] = "remove_org_member";
|
|
355
|
+
Permission["update_org_member"] = "update_org_member";
|
|
356
|
+
Permission["list_org_role_group"] = "list_org_role_group";
|
|
357
|
+
Permission["create_org_role_group"] = "create_org_role_group";
|
|
358
|
+
Permission["delete_org_role_group"] = "delete_org_role_group";
|
|
359
|
+
Permission["update_org_role_group"] = "update_org_role_group";
|
|
360
|
+
Permission["arrange_org_role_group"] = "arrange_org_role_group";
|
|
361
|
+
Permission["list_org_role"] = "list_org_role";
|
|
362
|
+
Permission["get_org_role"] = "get_org_role";
|
|
363
|
+
Permission["create_org_role"] = "create_org_role";
|
|
364
|
+
Permission["delete_org_role"] = "delete_org_role";
|
|
365
|
+
Permission["update_org_role"] = "update_org_role";
|
|
366
|
+
Permission["get_org_structure"] = "get_org_structure";
|
|
367
|
+
Permission["update_org_structure"] = "update_org_structure";
|
|
368
|
+
Permission["filter_table"] = "filter_table";
|
|
369
|
+
return Permission;
|
|
370
|
+
}({});
|
|
371
|
+
function isExist(instanceTree, instance) {
|
|
372
|
+
if (!instanceTree) return false;
|
|
373
|
+
let curr = instanceTree;
|
|
374
|
+
if (Object.keys(curr).length <= 0) return true;
|
|
375
|
+
instance.split("/").forEach((part) => {
|
|
376
|
+
if (Object.keys(curr).length <= 0) return true;
|
|
377
|
+
if (curr[part]) curr = curr[part];
|
|
378
|
+
else return false;
|
|
379
|
+
});
|
|
380
|
+
if (Object.keys(curr).length <= 0) return true;
|
|
381
|
+
else return false;
|
|
382
|
+
}
|
|
383
|
+
function verifyPermission(permissionObjects, permission, instance) {
|
|
384
|
+
const permissionObject = permissionObjects[permission];
|
|
385
|
+
if (!permissionObject) return false;
|
|
386
|
+
if (!instance) return true;
|
|
387
|
+
if (!isExist(permissionObject.includes, instance)) return false;
|
|
388
|
+
if (isExist(permissionObject.excludes, instance)) return false;
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region src/utils/provideInject.ts
|
|
394
|
+
const darkKey = "essentialDark";
|
|
395
|
+
const localeKey = "essentialLocale";
|
|
396
|
+
const permissionObjectsKey = "essentialPermissionObjects";
|
|
397
|
+
const permissionChecksumKey = "essentialPermissionChecksum";
|
|
398
|
+
const lastAppPathKey = "essentialLastAppPath";
|
|
399
|
+
const viewsKey = "essentialViews";
|
|
400
|
+
function provideDark(dark) {
|
|
401
|
+
provide(darkKey, dark);
|
|
402
|
+
}
|
|
403
|
+
function injectDark() {
|
|
404
|
+
return inject(darkKey);
|
|
405
|
+
}
|
|
406
|
+
function provideLocale(locale) {
|
|
407
|
+
provide(localeKey, locale);
|
|
408
|
+
}
|
|
409
|
+
function injectLocale() {
|
|
410
|
+
return inject(localeKey);
|
|
411
|
+
}
|
|
412
|
+
function providePermissionObjects(permissionObjects) {
|
|
413
|
+
provide(permissionObjectsKey, permissionObjects);
|
|
414
|
+
}
|
|
415
|
+
function injectPermissionObjects() {
|
|
416
|
+
return inject(permissionObjectsKey);
|
|
417
|
+
}
|
|
418
|
+
function providePermissionChecksum(permissionChecksum) {
|
|
419
|
+
provide(permissionChecksumKey, permissionChecksum);
|
|
420
|
+
}
|
|
421
|
+
function injectPermissionChecksum() {
|
|
422
|
+
return inject(permissionChecksumKey);
|
|
423
|
+
}
|
|
424
|
+
function provideLastAppPath(lastAppPath) {
|
|
425
|
+
provide(lastAppPathKey, lastAppPath);
|
|
426
|
+
}
|
|
427
|
+
function injectLastAppPath() {
|
|
428
|
+
return inject(lastAppPathKey);
|
|
429
|
+
}
|
|
430
|
+
function provideViews(views) {
|
|
431
|
+
provide(viewsKey, views);
|
|
432
|
+
}
|
|
433
|
+
function injectViews() {
|
|
434
|
+
return inject(viewsKey);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/utils/router.ts
|
|
439
|
+
const routeMetas = [
|
|
440
|
+
{
|
|
441
|
+
app: "x-passport-mf",
|
|
442
|
+
path: "/passport/login",
|
|
443
|
+
level: 0
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
app: "x-passport-mf",
|
|
447
|
+
path: "/passport/loginAccount",
|
|
448
|
+
level: 1
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
app: "x-passport-mf",
|
|
452
|
+
path: "/passport/register",
|
|
453
|
+
level: 1
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
app: "x-org-mf",
|
|
457
|
+
path: "/org/joinOrCreate",
|
|
458
|
+
level: 1,
|
|
459
|
+
requiredState: "auth"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
app: "x-org-mf",
|
|
463
|
+
path: "/org/manager",
|
|
464
|
+
level: 1,
|
|
465
|
+
requiredState: "org"
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
app: "x-main-mf",
|
|
469
|
+
path: "/main",
|
|
470
|
+
level: 0,
|
|
471
|
+
requiredState: "org"
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
app: "x-main-mf",
|
|
475
|
+
path: "/create",
|
|
476
|
+
level: 0,
|
|
477
|
+
requiredState: "org"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
app: "x-main-mf",
|
|
481
|
+
path: "/ecosystem",
|
|
482
|
+
level: 0,
|
|
483
|
+
requiredState: "org"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
app: "x-mine-mf",
|
|
487
|
+
path: "/mine",
|
|
488
|
+
level: 0,
|
|
489
|
+
requiredState: "org"
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
app: "x-mine-mf",
|
|
493
|
+
path: "/mine/personalInfo",
|
|
494
|
+
level: 1,
|
|
495
|
+
requiredState: "org"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
app: "x-mine-mf",
|
|
499
|
+
path: "/mine/accountSecurity",
|
|
500
|
+
level: 2,
|
|
501
|
+
requiredState: "org"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
app: "x-mine-mf",
|
|
505
|
+
path: "/mine/settings",
|
|
506
|
+
level: 1,
|
|
507
|
+
requiredState: "org"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
app: "x-mine-mf",
|
|
511
|
+
path: "/mine/general",
|
|
512
|
+
level: 2,
|
|
513
|
+
requiredState: "org"
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
app: "x-mine-mf",
|
|
517
|
+
path: "/mine/general/darkMode",
|
|
518
|
+
level: 3,
|
|
519
|
+
requiredState: "org"
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
app: "x-mine-mf",
|
|
523
|
+
path: "/mine/general/language",
|
|
524
|
+
level: 3,
|
|
525
|
+
requiredState: "org"
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
app: "x-app-mf",
|
|
529
|
+
path: "/app/manager",
|
|
530
|
+
level: 1,
|
|
531
|
+
requiredState: "org"
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
app: "x-app-mf",
|
|
535
|
+
path: "/app/editor",
|
|
536
|
+
level: 2,
|
|
537
|
+
requiredState: "org"
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
app: "x-compute-mf",
|
|
541
|
+
path: "/compute",
|
|
542
|
+
level: 1,
|
|
543
|
+
requiredState: "org"
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
app: "x-data-mf",
|
|
547
|
+
path: "/data",
|
|
548
|
+
level: 1,
|
|
549
|
+
requiredState: "org"
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
app: "x-resource-mf",
|
|
553
|
+
path: "/resource",
|
|
554
|
+
level: 1,
|
|
555
|
+
requiredState: "org"
|
|
556
|
+
}
|
|
557
|
+
];
|
|
558
|
+
function matchRouteMeta(path) {
|
|
559
|
+
let target;
|
|
560
|
+
let maxMatchCount = 0;
|
|
561
|
+
const srcParts = path.split("/").filter((part) => part.trim() !== "");
|
|
562
|
+
routeMetas.forEach((route) => {
|
|
563
|
+
const dstParts = route.path.split("/").filter((part) => part.trim() !== "");
|
|
564
|
+
let matchCount = 0;
|
|
565
|
+
for (let i = 0; i < srcParts.length; i++) {
|
|
566
|
+
if (i >= dstParts.length) break;
|
|
567
|
+
if (srcParts[i] !== dstParts[i]) break;
|
|
568
|
+
matchCount++;
|
|
569
|
+
}
|
|
570
|
+
if (matchCount > 0 && matchCount > maxMatchCount) {
|
|
571
|
+
target = route;
|
|
572
|
+
maxMatchCount = matchCount;
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
return target;
|
|
576
|
+
}
|
|
577
|
+
const routeTransName = ref("");
|
|
578
|
+
function onBeforeChange(toPath, fromPath, lastAppPath) {
|
|
579
|
+
if (fromPath === "/") fromPath = lastAppPath;
|
|
580
|
+
const toRouteMeta = matchRouteMeta(toPath);
|
|
581
|
+
const fromRouteMeta = matchRouteMeta(fromPath);
|
|
582
|
+
if (!toRouteMeta) {
|
|
583
|
+
console.assert(false);
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
console.info(`~~~~routeChange~~~~ ${fromPath} -> ${toPath}`);
|
|
587
|
+
if (!fromRouteMeta) return;
|
|
588
|
+
const sameApp = toRouteMeta.app === fromRouteMeta.app;
|
|
589
|
+
const samePath = toRouteMeta.path === fromRouteMeta.path;
|
|
590
|
+
const forward = toRouteMeta.level >= fromRouteMeta.level;
|
|
591
|
+
if (sameApp) if (samePath) routeTransName.value = "";
|
|
592
|
+
else routeTransName.value = forward ? "inner-left" : "inner-right";
|
|
593
|
+
else {
|
|
594
|
+
routeTransName.value = "";
|
|
595
|
+
appAppear(toRouteMeta.app, forward);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function isHasAccessToken() {
|
|
599
|
+
return !!api.get("accessToken");
|
|
600
|
+
}
|
|
601
|
+
function isHasActiveOrg() {
|
|
602
|
+
return !!api.get("activeOrg");
|
|
603
|
+
}
|
|
604
|
+
function onBeforeEach(to, from, lastAppPath) {
|
|
605
|
+
const hasAccessToken = isHasAccessToken();
|
|
606
|
+
const hasActiveOrg = isHasActiveOrg();
|
|
607
|
+
const toRouteMeta = matchRouteMeta(to.path);
|
|
608
|
+
if (!toRouteMeta) throw new Error(`to route meta invalid`);
|
|
609
|
+
if (toRouteMeta.requiredState === "auth") if (hasAccessToken) if (hasActiveOrg) {
|
|
610
|
+
const toPath = "/main";
|
|
611
|
+
onBeforeChange(toPath, from.path, lastAppPath);
|
|
612
|
+
return { path: toPath };
|
|
613
|
+
} else {
|
|
614
|
+
onBeforeChange(to.path, from.path, lastAppPath);
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
else {
|
|
618
|
+
const toPath = "/passport/login";
|
|
619
|
+
onBeforeChange(toPath, from.path, lastAppPath);
|
|
620
|
+
return { path: toPath };
|
|
621
|
+
}
|
|
622
|
+
else if (toRouteMeta.requiredState === "org") if (hasAccessToken) if (hasActiveOrg) {
|
|
623
|
+
onBeforeChange(to.path, from.path, lastAppPath);
|
|
624
|
+
return;
|
|
625
|
+
} else {
|
|
626
|
+
const toPath = "/org/joinOrCreate";
|
|
627
|
+
onBeforeChange(toPath, from.path, lastAppPath);
|
|
628
|
+
return { path: toPath };
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
const toPath = "/passport/login";
|
|
632
|
+
onBeforeChange(toPath, from.path, lastAppPath);
|
|
633
|
+
return { path: toPath };
|
|
634
|
+
}
|
|
635
|
+
else if (hasAccessToken) if (hasActiveOrg) {
|
|
636
|
+
const toPath = "/main";
|
|
637
|
+
onBeforeChange(toPath, from.path, lastAppPath);
|
|
638
|
+
return { path: toPath };
|
|
639
|
+
} else {
|
|
640
|
+
const toPath = "/org/joinOrCreate";
|
|
641
|
+
onBeforeChange(toPath, from.path, lastAppPath);
|
|
642
|
+
return { path: toPath };
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
onBeforeChange(to.path, from.path, lastAppPath);
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
//#endregion
|
|
651
|
+
//#region src/utils/type.ts
|
|
652
|
+
const types = [
|
|
653
|
+
"string",
|
|
654
|
+
"number",
|
|
655
|
+
"boolean",
|
|
656
|
+
"array",
|
|
657
|
+
"object",
|
|
658
|
+
"any"
|
|
659
|
+
];
|
|
660
|
+
function getTypeColor(type) {
|
|
661
|
+
switch (type) {
|
|
662
|
+
case "string": return "#5ba58c";
|
|
663
|
+
case "number": return "#5b67a5";
|
|
664
|
+
case "boolean": return "#5b80a5";
|
|
665
|
+
case "array": return "#745ba5";
|
|
666
|
+
case "object": return "#80a55b";
|
|
667
|
+
case "any": return "#9e9e9e";
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
function getTypeDefault(type) {
|
|
671
|
+
switch (type) {
|
|
672
|
+
case "string": return "";
|
|
673
|
+
case "number": return 0;
|
|
674
|
+
case "boolean": return false;
|
|
675
|
+
case "array": return [];
|
|
676
|
+
case "object": return {};
|
|
677
|
+
case "any": return null;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
//#endregion
|
|
682
|
+
//#region src/utils/viewMgr.ts
|
|
683
|
+
function isEmpty(views) {
|
|
684
|
+
return views.value.length <= 0;
|
|
685
|
+
}
|
|
686
|
+
function lastView(views) {
|
|
687
|
+
if (views.value.length > 0) return views.value[views.value.length - 1];
|
|
688
|
+
else return;
|
|
689
|
+
}
|
|
690
|
+
function hasView(views, name) {
|
|
691
|
+
return !!views.value.find((view) => view === name);
|
|
692
|
+
}
|
|
693
|
+
function addView(views, name) {
|
|
694
|
+
const index = views.value.findIndex((view) => view === name);
|
|
695
|
+
if (index >= 0) views.value.splice(index, 1);
|
|
696
|
+
views.value.push(name);
|
|
697
|
+
}
|
|
698
|
+
function delView(views, name) {
|
|
699
|
+
const index = views.value.findIndex((view) => view === name);
|
|
700
|
+
if (index >= 0) views.value.splice(index, 1);
|
|
701
|
+
}
|
|
702
|
+
function popView(views) {
|
|
703
|
+
console.assert(views.value.length > 0);
|
|
704
|
+
views.value.pop();
|
|
705
|
+
}
|
|
706
|
+
function clearViews(views) {
|
|
707
|
+
views.value = [];
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
//#endregion
|
|
711
|
+
//#region src/composables/microApp.ts
|
|
712
|
+
function useMicroApp(dark, locale, permissionObjects, permissionChecksum, lastAppPath, views) {
|
|
713
|
+
const route = useRoute();
|
|
714
|
+
const router = useRouter();
|
|
715
|
+
const prefDark = usePreferredDark();
|
|
716
|
+
const finalDark = ref(false);
|
|
717
|
+
watchEffect(() => {
|
|
718
|
+
let d;
|
|
719
|
+
if (typeof dark.value === "boolean") d = dark.value;
|
|
720
|
+
else d = prefDark.value;
|
|
721
|
+
finalDark.value = d;
|
|
722
|
+
});
|
|
723
|
+
provideDark(finalDark);
|
|
724
|
+
provideLocale(locale);
|
|
725
|
+
providePermissionObjects(permissionObjects);
|
|
726
|
+
providePermissionChecksum(permissionChecksum);
|
|
727
|
+
provideLastAppPath(lastAppPath);
|
|
728
|
+
provideViews(views);
|
|
729
|
+
const theme = useTheme();
|
|
730
|
+
watchEffect(() => {
|
|
731
|
+
theme.change(finalDark.value ? "dark" : "light");
|
|
732
|
+
});
|
|
733
|
+
const handleBack = () => {
|
|
734
|
+
if (!isEmpty(views)) {
|
|
735
|
+
if (!hasView(views, "waitDlg")) popView(views);
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
const routeMeta = matchRouteMeta(route.path);
|
|
739
|
+
if (!routeMeta) {
|
|
740
|
+
console.assert(false);
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
if (routeMeta.level === 0) navigator?.Backbutton?.goHome(() => {}, () => {});
|
|
744
|
+
else router.back();
|
|
745
|
+
};
|
|
746
|
+
const onKeyDown = (e) => {
|
|
747
|
+
if (e.key === "Escape") {
|
|
748
|
+
handleBack();
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
const onBackButton = () => {
|
|
753
|
+
handleBack();
|
|
754
|
+
};
|
|
755
|
+
onMounted(() => {
|
|
756
|
+
window.addEventListener("keydown", onKeyDown);
|
|
757
|
+
eventBus.on("backbutton", onBackButton);
|
|
758
|
+
});
|
|
759
|
+
onBeforeUnmount(() => {
|
|
760
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
761
|
+
eventBus.off("backbutton", onBackButton);
|
|
762
|
+
});
|
|
763
|
+
const onUpdateDark = (val) => {
|
|
764
|
+
dark.value = val;
|
|
765
|
+
};
|
|
766
|
+
const onUpdateLocale = (val) => {
|
|
767
|
+
locale.value = val;
|
|
768
|
+
};
|
|
769
|
+
const onUpdatePermission = (val) => {
|
|
770
|
+
const v = val;
|
|
771
|
+
permissionObjects.value = v[0];
|
|
772
|
+
permissionChecksum.value = v[1];
|
|
773
|
+
};
|
|
774
|
+
const onUpdateLastAppPath = (val) => {
|
|
775
|
+
lastAppPath.value = val;
|
|
776
|
+
};
|
|
777
|
+
onBeforeMount(() => {
|
|
778
|
+
eventBus.on("updateDark", onUpdateDark);
|
|
779
|
+
eventBus.on("updateLocale", onUpdateLocale);
|
|
780
|
+
eventBus.on("updatePermission", onUpdatePermission);
|
|
781
|
+
eventBus.on("updateLastAppPath", onUpdateLastAppPath);
|
|
782
|
+
eventBus.emit("syncGlobalState");
|
|
783
|
+
});
|
|
784
|
+
onBeforeUnmount(() => {
|
|
785
|
+
eventBus.off("updateDark", onUpdateDark);
|
|
786
|
+
eventBus.off("updateLocale", onUpdateLocale);
|
|
787
|
+
eventBus.off("updatePermission", onUpdatePermission);
|
|
788
|
+
eventBus.off("updateLastAppPath", onUpdateLastAppPath);
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
//#endregion
|
|
793
|
+
//#region src/composables/permission.ts
|
|
794
|
+
function usePermission() {
|
|
795
|
+
const permissionObjects = injectPermissionObjects();
|
|
796
|
+
function verifyPermission$1(permission, instance) {
|
|
797
|
+
return verifyPermission(permissionObjects.value, permission, instance ?? "");
|
|
798
|
+
}
|
|
799
|
+
return { verifyPermission: verifyPermission$1 };
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
//#endregion
|
|
803
|
+
//#region src/composables/system.ts
|
|
804
|
+
function useSystem() {
|
|
805
|
+
const { locale, t } = useI18n();
|
|
806
|
+
const sysBarAvail = computed(() => {
|
|
807
|
+
return !!window.cordova;
|
|
808
|
+
});
|
|
809
|
+
const display = useDisplay();
|
|
810
|
+
const compactWidth = computed(() => {
|
|
811
|
+
if (display.width.value <= 1280) return display.width.value + "px";
|
|
812
|
+
else if (display.width.value <= 1920) return "768px";
|
|
813
|
+
else return "1024px";
|
|
814
|
+
});
|
|
815
|
+
const isCurvedScreen = computed(() => {
|
|
816
|
+
return false;
|
|
817
|
+
});
|
|
818
|
+
const isMobile = () => {
|
|
819
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
820
|
+
};
|
|
821
|
+
const nameList = (entries, instances) => {
|
|
822
|
+
let name;
|
|
823
|
+
const names = entries.map((entry) => t(entry));
|
|
824
|
+
if (instances) name = `${names.join("/")} <${instances.join("/")}>`;
|
|
825
|
+
else if (locale.value === "en") name = names.join(" ");
|
|
826
|
+
else name = names.join("");
|
|
827
|
+
return name;
|
|
828
|
+
};
|
|
829
|
+
const sentenceOfAsk = (verb, object, name) => {
|
|
830
|
+
if (locale.value === "en") return t("dlg.common.ask", {
|
|
831
|
+
verb: toLower(t(verb)),
|
|
832
|
+
object: toLower(t(object)),
|
|
833
|
+
name
|
|
834
|
+
});
|
|
835
|
+
else return t("dlg.common.ask", {
|
|
836
|
+
verb: t(verb),
|
|
837
|
+
object: t(object),
|
|
838
|
+
name
|
|
839
|
+
});
|
|
840
|
+
};
|
|
841
|
+
return {
|
|
842
|
+
sysBarAvail,
|
|
843
|
+
compactWidth,
|
|
844
|
+
isCurvedScreen,
|
|
845
|
+
isMobile,
|
|
846
|
+
nameList,
|
|
847
|
+
sentenceOfAsk
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
//#endregion
|
|
852
|
+
//#region src/composables/viewStack.ts
|
|
853
|
+
function useViewStack(name, hook) {
|
|
854
|
+
const views = injectViews();
|
|
855
|
+
const open = computed({
|
|
856
|
+
get() {
|
|
857
|
+
return hasView(views, name);
|
|
858
|
+
},
|
|
859
|
+
set(val) {
|
|
860
|
+
if (val) addView(views, name);
|
|
861
|
+
else delView(views, name);
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
const onOpen = (params) => {
|
|
865
|
+
hook?.(params);
|
|
866
|
+
open.value = true;
|
|
867
|
+
};
|
|
868
|
+
onMounted(() => {
|
|
869
|
+
eventBus.on(name, onOpen);
|
|
870
|
+
});
|
|
871
|
+
onBeforeUnmount(() => {
|
|
872
|
+
eventBus.off(name, onOpen);
|
|
873
|
+
});
|
|
874
|
+
return { open };
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
//#endregion
|
|
878
|
+
//#region src/components/confirmDlg/index.vue?vue&type=script&setup=true&lang.ts
|
|
879
|
+
var index_vue_vue_type_script_setup_true_lang_default$6 = /*@__PURE__*/ defineComponent({
|
|
880
|
+
__name: "index",
|
|
881
|
+
setup(__props) {
|
|
882
|
+
const { t } = useI18n();
|
|
883
|
+
const title = ref("");
|
|
884
|
+
const subtitle = ref("");
|
|
885
|
+
const text = ref("");
|
|
886
|
+
const cancelColor = ref("");
|
|
887
|
+
const cancelText = ref("");
|
|
888
|
+
const confirmColor = ref("");
|
|
889
|
+
const confirmText = ref("");
|
|
890
|
+
let seq = 0;
|
|
891
|
+
let handled = false;
|
|
892
|
+
const onOpen = (params) => {
|
|
893
|
+
title.value = params.title;
|
|
894
|
+
subtitle.value = params.subtitle ?? "";
|
|
895
|
+
text.value = params.text;
|
|
896
|
+
cancelColor.value = params.cancel?.color ?? "primary";
|
|
897
|
+
cancelText.value = params.cancel?.text ?? t("dlg.common.cancel");
|
|
898
|
+
confirmColor.value = params.confirm?.color ?? "primary";
|
|
899
|
+
confirmText.value = params.confirm?.text ?? t("dlg.common.confirm");
|
|
900
|
+
seq = params.seq;
|
|
901
|
+
handled = false;
|
|
902
|
+
open.value = true;
|
|
903
|
+
};
|
|
904
|
+
const { open } = useViewStack("confirmDlg", onOpen);
|
|
905
|
+
const onConfirm = () => {
|
|
906
|
+
open.value = false;
|
|
907
|
+
if (!handled) {
|
|
908
|
+
eventBus.emit("confirmDlgResult" + seq, true);
|
|
909
|
+
handled = true;
|
|
910
|
+
}
|
|
911
|
+
};
|
|
912
|
+
watch(open, (val) => {
|
|
913
|
+
if (!val && !handled) {
|
|
914
|
+
eventBus.emit("confirmDlgResult" + seq, false);
|
|
915
|
+
handled = true;
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
return (_ctx, _cache) => {
|
|
919
|
+
const _component_v_card_text = resolveComponent("v-card-text");
|
|
920
|
+
const _component_v_btn = resolveComponent("v-btn");
|
|
921
|
+
const _component_v_card_actions = resolveComponent("v-card-actions");
|
|
922
|
+
const _component_v_card = resolveComponent("v-card");
|
|
923
|
+
const _component_v_dialog = resolveComponent("v-dialog");
|
|
924
|
+
return openBlock(), createBlock(_component_v_dialog, {
|
|
925
|
+
modelValue: unref(open),
|
|
926
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(open) ? open.value = $event : null),
|
|
927
|
+
attach: "",
|
|
928
|
+
"max-width": "600px",
|
|
929
|
+
transition: "dialog-top-transition",
|
|
930
|
+
onKeydown: [withKeys(withModifiers(onConfirm, ["stop", "prevent"]), ["enter"]), _cache[2] || (_cache[2] = withKeys(withModifiers(($event) => open.value = false, ["stop", "prevent"]), ["esc"]))]
|
|
931
|
+
}, {
|
|
932
|
+
default: withCtx(() => [createVNode(_component_v_card, {
|
|
933
|
+
subtitle: subtitle.value,
|
|
934
|
+
title: title.value
|
|
935
|
+
}, {
|
|
936
|
+
default: withCtx(() => [createVNode(_component_v_card_text, null, {
|
|
937
|
+
default: withCtx(() => [createTextVNode(toDisplayString(text.value), 1)]),
|
|
938
|
+
_: 1
|
|
939
|
+
}), createVNode(_component_v_card_actions, { class: "d-flex justify-end" }, {
|
|
940
|
+
default: withCtx(() => [createVNode(_component_v_btn, {
|
|
941
|
+
color: cancelColor.value,
|
|
942
|
+
variant: "text",
|
|
943
|
+
onClick: _cache[0] || (_cache[0] = ($event) => open.value = false)
|
|
944
|
+
}, {
|
|
945
|
+
default: withCtx(() => [createTextVNode(toDisplayString(cancelText.value), 1)]),
|
|
946
|
+
_: 1
|
|
947
|
+
}, 8, ["color"]), createVNode(_component_v_btn, {
|
|
948
|
+
color: confirmColor.value,
|
|
949
|
+
variant: "text",
|
|
950
|
+
onClick: onConfirm
|
|
951
|
+
}, {
|
|
952
|
+
default: withCtx(() => [createTextVNode(toDisplayString(confirmText.value), 1)]),
|
|
953
|
+
_: 1
|
|
954
|
+
}, 8, ["color"])]),
|
|
955
|
+
_: 1
|
|
956
|
+
})]),
|
|
957
|
+
_: 1
|
|
958
|
+
}, 8, ["subtitle", "title"])]),
|
|
959
|
+
_: 1
|
|
960
|
+
}, 8, ["modelValue", "onKeydown"]);
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
|
|
965
|
+
//#endregion
|
|
966
|
+
//#region src/components/confirmDlg/index.vue
|
|
967
|
+
var confirmDlg_default = index_vue_vue_type_script_setup_true_lang_default$6;
|
|
968
|
+
|
|
969
|
+
//#endregion
|
|
970
|
+
//#region src/components/loading/index.vue?vue&type=script&setup=true&lang.ts
|
|
971
|
+
var index_vue_vue_type_script_setup_true_lang_default$5 = /*@__PURE__*/ defineComponent({
|
|
972
|
+
__name: "index",
|
|
973
|
+
props: {
|
|
974
|
+
open: {
|
|
975
|
+
type: Boolean,
|
|
976
|
+
required: false,
|
|
977
|
+
default: true
|
|
978
|
+
},
|
|
979
|
+
zIndex: {
|
|
980
|
+
type: Number,
|
|
981
|
+
required: false,
|
|
982
|
+
default: 1
|
|
983
|
+
}
|
|
984
|
+
},
|
|
985
|
+
setup(__props) {
|
|
986
|
+
const { backgroundColor2 } = useColor();
|
|
987
|
+
const style = computed(() => {
|
|
988
|
+
return {
|
|
989
|
+
background: backgroundColor2.value,
|
|
990
|
+
zIndex: __props.zIndex
|
|
991
|
+
};
|
|
992
|
+
});
|
|
993
|
+
let seq = 0;
|
|
994
|
+
return (_ctx, _cache) => {
|
|
995
|
+
return openBlock(), createBlock(Transition, { name: "fade" }, {
|
|
996
|
+
default: withCtx(() => [__props.open ? (openBlock(), createElementBlock("div", {
|
|
997
|
+
key: isRef(seq) ? ++seq.value : ++seq,
|
|
998
|
+
class: "x-cont",
|
|
999
|
+
style: normalizeStyle(style.value)
|
|
1000
|
+
}, [..._cache[0] || (_cache[0] = [createElementVNode("div", { class: "lds-spinner" }, [
|
|
1001
|
+
createElementVNode("div"),
|
|
1002
|
+
createElementVNode("div"),
|
|
1003
|
+
createElementVNode("div"),
|
|
1004
|
+
createElementVNode("div"),
|
|
1005
|
+
createElementVNode("div"),
|
|
1006
|
+
createElementVNode("div"),
|
|
1007
|
+
createElementVNode("div"),
|
|
1008
|
+
createElementVNode("div"),
|
|
1009
|
+
createElementVNode("div"),
|
|
1010
|
+
createElementVNode("div"),
|
|
1011
|
+
createElementVNode("div"),
|
|
1012
|
+
createElementVNode("div")
|
|
1013
|
+
], -1)])], 4)) : createCommentVNode("v-if", true)]),
|
|
1014
|
+
_: 1
|
|
1015
|
+
});
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
|
|
1020
|
+
//#endregion
|
|
1021
|
+
//#region \0plugin-vue:export-helper
|
|
1022
|
+
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
1023
|
+
const target = sfc.__vccOpts || sfc;
|
|
1024
|
+
for (const [key, val] of props) target[key] = val;
|
|
1025
|
+
return target;
|
|
1026
|
+
};
|
|
1027
|
+
|
|
1028
|
+
//#endregion
|
|
1029
|
+
//#region src/components/loading/index.vue
|
|
1030
|
+
var loading_default = /*#__PURE__*/ _plugin_vue_export_helper_default(index_vue_vue_type_script_setup_true_lang_default$5, [["__scopeId", "data-v-x-essential-lib-c3545c8d"]]);
|
|
1031
|
+
|
|
1032
|
+
//#endregion
|
|
1033
|
+
//#region src/components/message/item.vue?vue&type=script&setup=true&lang.ts
|
|
1034
|
+
var item_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
1035
|
+
__name: "item",
|
|
1036
|
+
props: {
|
|
1037
|
+
id: {
|
|
1038
|
+
type: Number,
|
|
1039
|
+
required: true
|
|
1040
|
+
},
|
|
1041
|
+
type: {
|
|
1042
|
+
type: null,
|
|
1043
|
+
required: true
|
|
1044
|
+
},
|
|
1045
|
+
text: {
|
|
1046
|
+
type: String,
|
|
1047
|
+
required: true
|
|
1048
|
+
},
|
|
1049
|
+
timeout: {
|
|
1050
|
+
type: Number,
|
|
1051
|
+
required: false,
|
|
1052
|
+
default: 5e3
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
emits: ["timeout"],
|
|
1056
|
+
setup(__props, { emit: __emit }) {
|
|
1057
|
+
const wrapStyle = computed(() => {
|
|
1058
|
+
return {
|
|
1059
|
+
width: "calc(100% - 64px)",
|
|
1060
|
+
overflowWrap: "break-word"
|
|
1061
|
+
};
|
|
1062
|
+
});
|
|
1063
|
+
const icon = computed(() => {
|
|
1064
|
+
switch (__props.type) {
|
|
1065
|
+
case "success": return "mdi-check-circle";
|
|
1066
|
+
case "info": return "mdi-information";
|
|
1067
|
+
case "error": return "mdi-close-circle";
|
|
1068
|
+
case "warning": return "mdi-alert-circle";
|
|
1069
|
+
default: return "";
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
const open = ref(true);
|
|
1073
|
+
const emit = __emit;
|
|
1074
|
+
onMounted(() => {
|
|
1075
|
+
setTimeout(() => {
|
|
1076
|
+
emit("timeout", __props.id);
|
|
1077
|
+
}, __props.timeout);
|
|
1078
|
+
});
|
|
1079
|
+
watch(open, (val) => {
|
|
1080
|
+
if (!val) emit("timeout", __props.id);
|
|
1081
|
+
});
|
|
1082
|
+
return (_ctx, _cache) => {
|
|
1083
|
+
const _component_v_icon = resolveComponent("v-icon");
|
|
1084
|
+
const _component_v_sheet = resolveComponent("v-sheet");
|
|
1085
|
+
return openBlock(), createBlock(_component_v_sheet, {
|
|
1086
|
+
class: "x-item d-flex align-center py-2 mb-2",
|
|
1087
|
+
color: __props.type,
|
|
1088
|
+
elevation: 1
|
|
1089
|
+
}, {
|
|
1090
|
+
default: withCtx(() => [
|
|
1091
|
+
icon.value ? (openBlock(), createBlock(_component_v_icon, {
|
|
1092
|
+
key: 0,
|
|
1093
|
+
class: "mx-1",
|
|
1094
|
+
icon: icon.value
|
|
1095
|
+
}, null, 8, ["icon"])) : createCommentVNode("v-if", true),
|
|
1096
|
+
createElementVNode("div", { style: normalizeStyle(wrapStyle.value) }, toDisplayString(__props.text), 5),
|
|
1097
|
+
createVNode(_component_v_icon, {
|
|
1098
|
+
class: "mx-1",
|
|
1099
|
+
icon: "mdi-close",
|
|
1100
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("timeout", __props.id))
|
|
1101
|
+
})
|
|
1102
|
+
]),
|
|
1103
|
+
_: 1
|
|
1104
|
+
}, 8, ["color"]);
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
});
|
|
1108
|
+
|
|
1109
|
+
//#endregion
|
|
1110
|
+
//#region src/components/message/item.vue
|
|
1111
|
+
var item_default = /*#__PURE__*/ _plugin_vue_export_helper_default(item_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-x-essential-lib-cfcda9d9"]]);
|
|
1112
|
+
|
|
1113
|
+
//#endregion
|
|
1114
|
+
//#region src/components/message/index.vue?vue&type=script&setup=true&lang.ts
|
|
1115
|
+
var index_vue_vue_type_script_setup_true_lang_default$4 = /*@__PURE__*/ defineComponent({
|
|
1116
|
+
__name: "index",
|
|
1117
|
+
setup(__props) {
|
|
1118
|
+
const items = ref([]);
|
|
1119
|
+
onMounted(() => {
|
|
1120
|
+
eventBus.on("message", onMessage);
|
|
1121
|
+
});
|
|
1122
|
+
onBeforeUnmount(() => {
|
|
1123
|
+
eventBus.off("message", onMessage);
|
|
1124
|
+
});
|
|
1125
|
+
const onMessage = (params) => {
|
|
1126
|
+
const { type, text, timeout } = params;
|
|
1127
|
+
addItem(type, text, timeout);
|
|
1128
|
+
};
|
|
1129
|
+
const onItemTimeout = (id) => {
|
|
1130
|
+
removeItem(id);
|
|
1131
|
+
};
|
|
1132
|
+
let seq = 0;
|
|
1133
|
+
const addItem = (type, text, timeout) => {
|
|
1134
|
+
const id = seq++;
|
|
1135
|
+
items.value.push({
|
|
1136
|
+
id,
|
|
1137
|
+
type,
|
|
1138
|
+
text,
|
|
1139
|
+
timeout
|
|
1140
|
+
});
|
|
1141
|
+
};
|
|
1142
|
+
const removeItem = (id) => {
|
|
1143
|
+
const idx = items.value.findIndex((item) => item.id === id);
|
|
1144
|
+
if (idx >= 0) items.value.splice(idx, 1);
|
|
1145
|
+
};
|
|
1146
|
+
return (_ctx, _cache) => {
|
|
1147
|
+
return openBlock(), createElementBlock("div", {
|
|
1148
|
+
class: "x-cont d-flex flex-column-reverse align-center",
|
|
1149
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
|
|
1150
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item) => {
|
|
1151
|
+
return openBlock(), createBlock(item_default, {
|
|
1152
|
+
id: item.id,
|
|
1153
|
+
key: item.id,
|
|
1154
|
+
text: item.text,
|
|
1155
|
+
timeout: item.timeout,
|
|
1156
|
+
type: item.type,
|
|
1157
|
+
onTimeout: onItemTimeout
|
|
1158
|
+
}, null, 8, [
|
|
1159
|
+
"id",
|
|
1160
|
+
"text",
|
|
1161
|
+
"timeout",
|
|
1162
|
+
"type"
|
|
1163
|
+
]);
|
|
1164
|
+
}), 128))]);
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
});
|
|
1168
|
+
|
|
1169
|
+
//#endregion
|
|
1170
|
+
//#region src/components/message/index.vue
|
|
1171
|
+
var message_default = /*#__PURE__*/ _plugin_vue_export_helper_default(index_vue_vue_type_script_setup_true_lang_default$4, [["__scopeId", "data-v-x-essential-lib-b973907d"]]);
|
|
1172
|
+
|
|
1173
|
+
//#endregion
|
|
1174
|
+
//#region src/components/numberDlg/index.vue?vue&type=script&setup=true&lang.ts
|
|
1175
|
+
var index_vue_vue_type_script_setup_true_lang_default$3 = /*@__PURE__*/ defineComponent({
|
|
1176
|
+
__name: "index",
|
|
1177
|
+
setup(__props) {
|
|
1178
|
+
const { t } = useI18n();
|
|
1179
|
+
const title = ref("");
|
|
1180
|
+
const subtitle = ref("");
|
|
1181
|
+
const value = ref(0);
|
|
1182
|
+
const precision = ref();
|
|
1183
|
+
const min = ref(-Infinity);
|
|
1184
|
+
const max = ref(Infinity);
|
|
1185
|
+
const step = ref(1);
|
|
1186
|
+
let seq = 0;
|
|
1187
|
+
let handled = false;
|
|
1188
|
+
const target = useTemplateRef("target");
|
|
1189
|
+
const onOpen = async (params) => {
|
|
1190
|
+
title.value = params.title;
|
|
1191
|
+
subtitle.value = params.subtitle ?? "";
|
|
1192
|
+
value.value = params.value;
|
|
1193
|
+
precision.value = params.precision;
|
|
1194
|
+
min.value = params.min;
|
|
1195
|
+
max.value = params.max;
|
|
1196
|
+
step.value = params.step;
|
|
1197
|
+
seq = params.seq;
|
|
1198
|
+
handled = false;
|
|
1199
|
+
open.value = true;
|
|
1200
|
+
await waitUtil(() => !!target.value);
|
|
1201
|
+
target.value.focus();
|
|
1202
|
+
};
|
|
1203
|
+
const { open } = useViewStack("numberDlg", onOpen);
|
|
1204
|
+
const formValid = ref(false);
|
|
1205
|
+
const onSubmit = () => {
|
|
1206
|
+
open.value = false;
|
|
1207
|
+
if (!handled) {
|
|
1208
|
+
eventBus.emit(`numberDlgResult${seq}`, value.value);
|
|
1209
|
+
handled = true;
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
watch(open, (val) => {
|
|
1213
|
+
if (!val && !handled) {
|
|
1214
|
+
eventBus.emit(`numberDlgResult${seq}`, void 0);
|
|
1215
|
+
handled = true;
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
return (_ctx, _cache) => {
|
|
1219
|
+
const _component_v_number_input = resolveComponent("v-number-input");
|
|
1220
|
+
const _component_v_btn = resolveComponent("v-btn");
|
|
1221
|
+
const _component_v_card_actions = resolveComponent("v-card-actions");
|
|
1222
|
+
const _component_v_form = resolveComponent("v-form");
|
|
1223
|
+
const _component_v_card = resolveComponent("v-card");
|
|
1224
|
+
const _component_v_dialog = resolveComponent("v-dialog");
|
|
1225
|
+
return openBlock(), createBlock(_component_v_dialog, {
|
|
1226
|
+
modelValue: unref(open),
|
|
1227
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(open) ? open.value = $event : null),
|
|
1228
|
+
attach: "",
|
|
1229
|
+
"max-width": "600px",
|
|
1230
|
+
transition: "dialog-top-transition",
|
|
1231
|
+
onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => open.value = false, ["stop", "prevent"]), ["esc"]))
|
|
1232
|
+
}, {
|
|
1233
|
+
default: withCtx(() => [createVNode(_component_v_card, { title: title.value }, {
|
|
1234
|
+
default: withCtx(() => [createVNode(_component_v_form, {
|
|
1235
|
+
modelValue: formValid.value,
|
|
1236
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => formValid.value = $event),
|
|
1237
|
+
class: "mx-3",
|
|
1238
|
+
onSubmit: withModifiers(onSubmit, ["prevent"])
|
|
1239
|
+
}, {
|
|
1240
|
+
default: withCtx(() => [createVNode(_component_v_number_input, {
|
|
1241
|
+
ref_key: "target",
|
|
1242
|
+
ref: target,
|
|
1243
|
+
modelValue: value.value,
|
|
1244
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
1245
|
+
"control-variant": "stacked",
|
|
1246
|
+
max: max.value,
|
|
1247
|
+
min: min.value,
|
|
1248
|
+
precision: precision.value,
|
|
1249
|
+
step: step.value
|
|
1250
|
+
}, null, 8, [
|
|
1251
|
+
"modelValue",
|
|
1252
|
+
"max",
|
|
1253
|
+
"min",
|
|
1254
|
+
"precision",
|
|
1255
|
+
"step"
|
|
1256
|
+
]), createVNode(_component_v_card_actions, { class: "d-flex justify-end" }, {
|
|
1257
|
+
default: withCtx(() => [createVNode(_component_v_btn, {
|
|
1258
|
+
color: "primary",
|
|
1259
|
+
variant: "text",
|
|
1260
|
+
onClick: _cache[1] || (_cache[1] = ($event) => open.value = false)
|
|
1261
|
+
}, {
|
|
1262
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("dlg.common.cancel")), 1)]),
|
|
1263
|
+
_: 1
|
|
1264
|
+
}), createVNode(_component_v_btn, {
|
|
1265
|
+
color: "primary",
|
|
1266
|
+
disabled: !formValid.value,
|
|
1267
|
+
type: "submit",
|
|
1268
|
+
variant: "text"
|
|
1269
|
+
}, {
|
|
1270
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("dlg.common.confirm")), 1)]),
|
|
1271
|
+
_: 1
|
|
1272
|
+
}, 8, ["disabled"])]),
|
|
1273
|
+
_: 1
|
|
1274
|
+
})]),
|
|
1275
|
+
_: 1
|
|
1276
|
+
}, 8, ["modelValue"])]),
|
|
1277
|
+
_: 1
|
|
1278
|
+
}, 8, ["title"])]),
|
|
1279
|
+
_: 1
|
|
1280
|
+
}, 8, ["modelValue"]);
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region src/components/numberDlg/index.vue
|
|
1287
|
+
var numberDlg_default = index_vue_vue_type_script_setup_true_lang_default$3;
|
|
1288
|
+
|
|
1289
|
+
//#endregion
|
|
1290
|
+
//#region src/components/promptDlg/index.vue?vue&type=script&setup=true&lang.ts
|
|
1291
|
+
var index_vue_vue_type_script_setup_true_lang_default$2 = /*@__PURE__*/ defineComponent({
|
|
1292
|
+
__name: "index",
|
|
1293
|
+
setup(__props) {
|
|
1294
|
+
const { t } = useI18n();
|
|
1295
|
+
const title = ref("");
|
|
1296
|
+
const subtitle = ref("");
|
|
1297
|
+
const text = ref("");
|
|
1298
|
+
const label = ref("");
|
|
1299
|
+
const placeholder = ref("");
|
|
1300
|
+
const rules = ref();
|
|
1301
|
+
const value = ref("");
|
|
1302
|
+
const cancelColor = ref("");
|
|
1303
|
+
const cancelText = ref("");
|
|
1304
|
+
const confirmColor = ref("");
|
|
1305
|
+
const confirmText = ref("");
|
|
1306
|
+
let seq = 0;
|
|
1307
|
+
let handled = false;
|
|
1308
|
+
const target = useTemplateRef("target");
|
|
1309
|
+
const onOpen = async (params) => {
|
|
1310
|
+
title.value = params.title;
|
|
1311
|
+
subtitle.value = params.subtitle ?? "";
|
|
1312
|
+
text.value = params.text;
|
|
1313
|
+
label.value = params.label;
|
|
1314
|
+
placeholder.value = params.placeholder;
|
|
1315
|
+
rules.value = params.rules;
|
|
1316
|
+
value.value = params.value;
|
|
1317
|
+
cancelColor.value = params.cancel?.color ?? "primary";
|
|
1318
|
+
cancelText.value = params.cancel?.text ?? t("dlg.common.cancel");
|
|
1319
|
+
confirmColor.value = params.confirm?.color ?? "primary";
|
|
1320
|
+
confirmText.value = params.confirm?.text ?? t("dlg.common.confirm");
|
|
1321
|
+
seq = params.seq;
|
|
1322
|
+
handled = false;
|
|
1323
|
+
open.value = true;
|
|
1324
|
+
await waitUtil(() => !!target.value);
|
|
1325
|
+
target.value.focus();
|
|
1326
|
+
};
|
|
1327
|
+
const { open } = useViewStack("promptDlg", onOpen);
|
|
1328
|
+
const formValid = ref(false);
|
|
1329
|
+
const onSubmit = () => {
|
|
1330
|
+
open.value = false;
|
|
1331
|
+
if (!handled) {
|
|
1332
|
+
eventBus.emit("promptDlgResult" + seq, value.value ?? "");
|
|
1333
|
+
handled = true;
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1336
|
+
watch(open, (val) => {
|
|
1337
|
+
if (!val && !handled) {
|
|
1338
|
+
eventBus.emit("promptDlgResult" + seq, void 0);
|
|
1339
|
+
handled = true;
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
return (_ctx, _cache) => {
|
|
1343
|
+
const _component_v_card_text = resolveComponent("v-card-text");
|
|
1344
|
+
const _component_v_text_field = resolveComponent("v-text-field");
|
|
1345
|
+
const _component_v_btn = resolveComponent("v-btn");
|
|
1346
|
+
const _component_v_card_actions = resolveComponent("v-card-actions");
|
|
1347
|
+
const _component_v_form = resolveComponent("v-form");
|
|
1348
|
+
const _component_v_card = resolveComponent("v-card");
|
|
1349
|
+
const _component_v_dialog = resolveComponent("v-dialog");
|
|
1350
|
+
return openBlock(), createBlock(_component_v_dialog, {
|
|
1351
|
+
modelValue: unref(open),
|
|
1352
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(open) ? open.value = $event : null),
|
|
1353
|
+
attach: "",
|
|
1354
|
+
"max-width": "600px",
|
|
1355
|
+
transition: "dialog-top-transition",
|
|
1356
|
+
onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => open.value = false, ["stop", "prevent"]), ["esc"]))
|
|
1357
|
+
}, {
|
|
1358
|
+
default: withCtx(() => [createVNode(_component_v_card, {
|
|
1359
|
+
subtitle: subtitle.value,
|
|
1360
|
+
title: title.value
|
|
1361
|
+
}, {
|
|
1362
|
+
default: withCtx(() => [text.value ? (openBlock(), createBlock(_component_v_card_text, { key: 0 }, {
|
|
1363
|
+
default: withCtx(() => [createTextVNode(toDisplayString(text.value), 1)]),
|
|
1364
|
+
_: 1
|
|
1365
|
+
})) : createCommentVNode("v-if", true), createVNode(_component_v_form, {
|
|
1366
|
+
modelValue: formValid.value,
|
|
1367
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => formValid.value = $event),
|
|
1368
|
+
class: "mx-3",
|
|
1369
|
+
onSubmit: withModifiers(onSubmit, ["prevent"])
|
|
1370
|
+
}, {
|
|
1371
|
+
default: withCtx(() => [createVNode(_component_v_text_field, {
|
|
1372
|
+
ref_key: "target",
|
|
1373
|
+
ref: target,
|
|
1374
|
+
modelValue: value.value,
|
|
1375
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
1376
|
+
label: label.value,
|
|
1377
|
+
placeholder: placeholder.value,
|
|
1378
|
+
rules: rules.value
|
|
1379
|
+
}, null, 8, [
|
|
1380
|
+
"modelValue",
|
|
1381
|
+
"label",
|
|
1382
|
+
"placeholder",
|
|
1383
|
+
"rules"
|
|
1384
|
+
]), createVNode(_component_v_card_actions, { class: "d-flex justify-end" }, {
|
|
1385
|
+
default: withCtx(() => [createVNode(_component_v_btn, {
|
|
1386
|
+
color: cancelColor.value,
|
|
1387
|
+
variant: "text",
|
|
1388
|
+
onClick: _cache[1] || (_cache[1] = ($event) => open.value = false)
|
|
1389
|
+
}, {
|
|
1390
|
+
default: withCtx(() => [createTextVNode(toDisplayString(cancelText.value), 1)]),
|
|
1391
|
+
_: 1
|
|
1392
|
+
}, 8, ["color"]), createVNode(_component_v_btn, {
|
|
1393
|
+
color: confirmColor.value,
|
|
1394
|
+
disabled: !formValid.value,
|
|
1395
|
+
type: "submit",
|
|
1396
|
+
variant: "text"
|
|
1397
|
+
}, {
|
|
1398
|
+
default: withCtx(() => [createTextVNode(toDisplayString(confirmText.value), 1)]),
|
|
1399
|
+
_: 1
|
|
1400
|
+
}, 8, ["color", "disabled"])]),
|
|
1401
|
+
_: 1
|
|
1402
|
+
})]),
|
|
1403
|
+
_: 1
|
|
1404
|
+
}, 8, ["modelValue"])]),
|
|
1405
|
+
_: 1
|
|
1406
|
+
}, 8, ["subtitle", "title"])]),
|
|
1407
|
+
_: 1
|
|
1408
|
+
}, 8, ["modelValue"]);
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
});
|
|
1412
|
+
|
|
1413
|
+
//#endregion
|
|
1414
|
+
//#region src/components/promptDlg/index.vue
|
|
1415
|
+
var promptDlg_default = index_vue_vue_type_script_setup_true_lang_default$2;
|
|
1416
|
+
|
|
1417
|
+
//#endregion
|
|
1418
|
+
//#region src/components/refLine/index.vue?vue&type=script&setup=true&lang.ts
|
|
1419
|
+
var index_vue_vue_type_script_setup_true_lang_default$1 = /*@__PURE__*/ defineComponent({
|
|
1420
|
+
__name: "index",
|
|
1421
|
+
props: {
|
|
1422
|
+
show: {
|
|
1423
|
+
type: Boolean,
|
|
1424
|
+
required: true
|
|
1425
|
+
},
|
|
1426
|
+
top: {
|
|
1427
|
+
type: Number,
|
|
1428
|
+
required: true
|
|
1429
|
+
},
|
|
1430
|
+
left: {
|
|
1431
|
+
type: Number,
|
|
1432
|
+
required: true
|
|
1433
|
+
}
|
|
1434
|
+
},
|
|
1435
|
+
setup(__props) {
|
|
1436
|
+
const horizontalStyle = computed(() => {
|
|
1437
|
+
return {
|
|
1438
|
+
position: "absolute",
|
|
1439
|
+
backgroundColor: "#ff00cc",
|
|
1440
|
+
width: "100%",
|
|
1441
|
+
height: "1px",
|
|
1442
|
+
top: `${__props.top}px`,
|
|
1443
|
+
left: "0px",
|
|
1444
|
+
zIndex: 9999
|
|
1445
|
+
};
|
|
1446
|
+
});
|
|
1447
|
+
const verticalStyle = computed(() => {
|
|
1448
|
+
return {
|
|
1449
|
+
position: "absolute",
|
|
1450
|
+
backgroundColor: "#ff00cc",
|
|
1451
|
+
width: "1px",
|
|
1452
|
+
height: "100%",
|
|
1453
|
+
top: "0px",
|
|
1454
|
+
left: `${__props.left}px`,
|
|
1455
|
+
zIndex: 9999
|
|
1456
|
+
};
|
|
1457
|
+
});
|
|
1458
|
+
return (_ctx, _cache) => {
|
|
1459
|
+
return openBlock(), createElementBlock(Fragment, null, [__props.show ? (openBlock(), createElementBlock("span", {
|
|
1460
|
+
key: 0,
|
|
1461
|
+
style: normalizeStyle(horizontalStyle.value)
|
|
1462
|
+
}, null, 4)) : createCommentVNode("v-if", true), __props.show ? (openBlock(), createElementBlock("span", {
|
|
1463
|
+
key: 1,
|
|
1464
|
+
style: normalizeStyle(verticalStyle.value)
|
|
1465
|
+
}, null, 4)) : createCommentVNode("v-if", true)], 64);
|
|
1466
|
+
};
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
|
|
1470
|
+
//#endregion
|
|
1471
|
+
//#region src/components/refLine/index.vue
|
|
1472
|
+
var refLine_default = index_vue_vue_type_script_setup_true_lang_default$1;
|
|
1473
|
+
|
|
1474
|
+
//#endregion
|
|
1475
|
+
//#region src/components/waitDlg/index.vue?vue&type=script&setup=true&lang.ts
|
|
1476
|
+
const _hoisted_1 = { class: "ma-auto" };
|
|
1477
|
+
const _hoisted_2 = { class: "w-100 h-100 d-flex align-center justify-center" };
|
|
1478
|
+
const _hoisted_3 = { class: "text-body-large" };
|
|
1479
|
+
var index_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
1480
|
+
__name: "index",
|
|
1481
|
+
setup(__props) {
|
|
1482
|
+
const { t } = useI18n();
|
|
1483
|
+
const text = ref("");
|
|
1484
|
+
const onOpen = (params) => {
|
|
1485
|
+
text.value = params.text ?? t("dlg.common.responding");
|
|
1486
|
+
open.value = true;
|
|
1487
|
+
};
|
|
1488
|
+
const onClose = () => {
|
|
1489
|
+
open.value = false;
|
|
1490
|
+
};
|
|
1491
|
+
const { open } = useViewStack("waitDlg", onOpen);
|
|
1492
|
+
onMounted(() => {
|
|
1493
|
+
eventBus.on("closeWaitDlg", onClose);
|
|
1494
|
+
});
|
|
1495
|
+
onBeforeUnmount(() => {
|
|
1496
|
+
eventBus.off("closeWaitDlg", onClose);
|
|
1497
|
+
});
|
|
1498
|
+
return (_ctx, _cache) => {
|
|
1499
|
+
const _component_v_card = resolveComponent("v-card");
|
|
1500
|
+
const _component_v_dialog = resolveComponent("v-dialog");
|
|
1501
|
+
return openBlock(), createBlock(_component_v_dialog, {
|
|
1502
|
+
modelValue: unref(open),
|
|
1503
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(open) ? open.value = $event : null),
|
|
1504
|
+
attach: "",
|
|
1505
|
+
fullscreen: "",
|
|
1506
|
+
"no-click-animation": "",
|
|
1507
|
+
persistent: ""
|
|
1508
|
+
}, {
|
|
1509
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1, [createVNode(_component_v_card, {
|
|
1510
|
+
height: "80px",
|
|
1511
|
+
loading: "",
|
|
1512
|
+
width: "300px"
|
|
1513
|
+
}, {
|
|
1514
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_2, [createElementVNode("span", _hoisted_3, toDisplayString(text.value), 1)])]),
|
|
1515
|
+
_: 1
|
|
1516
|
+
})])]),
|
|
1517
|
+
_: 1
|
|
1518
|
+
}, 8, ["modelValue"]);
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
});
|
|
1522
|
+
|
|
1523
|
+
//#endregion
|
|
1524
|
+
//#region src/components/waitDlg/index.vue
|
|
1525
|
+
var waitDlg_default = index_vue_vue_type_script_setup_true_lang_default;
|
|
1526
|
+
|
|
1527
|
+
//#endregion
|
|
1528
|
+
//#region src/components/index.ts
|
|
1529
|
+
const install = (app) => {
|
|
1530
|
+
app.component("XConfirmDlg", confirmDlg_default);
|
|
1531
|
+
app.component("XLoading", loading_default);
|
|
1532
|
+
app.component("XMessage", message_default);
|
|
1533
|
+
app.component("XNumberDlg", numberDlg_default);
|
|
1534
|
+
app.component("XPromptDlg", promptDlg_default);
|
|
1535
|
+
app.component("XRefLine", refLine_default);
|
|
1536
|
+
app.component("XWaitDlg", waitDlg_default);
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
//#endregion
|
|
1540
|
+
//#region src/i18n/index.ts
|
|
1541
|
+
async function loadLocaleMessageEssential(locale) {
|
|
1542
|
+
if (locale === "en") return (await import("./i18n-en.nsm1ldfp.js").then((n) => n.t)).default;
|
|
1543
|
+
else if (locale === "zhHans") return (await import("./i18n-zhHans.do0bpr19.js").then((n) => n.t)).default;
|
|
1544
|
+
else throw new Error(`invalid locale=${locale}`);
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
//#endregion
|
|
1548
|
+
//#region src/index.ts
|
|
1549
|
+
var src_default = { install };
|
|
1550
|
+
|
|
1551
|
+
//#endregion
|
|
1552
|
+
export { Permission, addView, appAppear, clearViews, closeWaitDlg, createAxios, src_default as default, delView, eventBus, getTypeColor, getTypeDefault, globalObjects, hasView, injectDark, injectLastAppPath, injectLocale, injectPermissionChecksum, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, loadLocaleMessageEssential, matchRouteMeta, messageError, messageInfo, messageSuccess, messageWarning, onBeforeEach, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideDark, provideLastAppPath, provideLocale, providePermissionChecksum, providePermissionObjects, provideViews, routeTransName, types, useColor, useMicroApp, usePermission, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
|