dootask/public/js/build/index.2aae29b9.js
2025-05-26 22:45:59 +08:00

2 lines
9.2 KiB
JavaScript
Vendored

import{V as m}from"./vue.fd9b772e.js";import{m as h}from"./vuex.cc7cb26e.js";import{i as f}from"./view-design-hi.18b9f7fe.js";import{m as r}from"./@micro-zoe.f728a9f4.js";import{D as v}from"./DialogWrapper.6fc66bf5.js";import{n as u,d,U as o,e as l,b as _,c as A,l as w}from"./app.47eab973.js";import{R as y}from"./index.b53ac940.js";var $=function(){var e=this,s=e.$createElement,t=e._self._c||s;return t("div",{directives:[{name:"transfer-dom",rawName:"v-transfer-dom"}],attrs:{"data-transfer":!0}},[t("div",{class:e.className},[t("transition",{attrs:{name:e.transitions[0]}},[e.value?t("div",{staticClass:"micro-modal-mask",style:e.maskStyle,on:{click:e.onClose}}):e._e()]),t("transition",{attrs:{name:e.transitions[1]}},[e.value?t("div",{staticClass:"micro-modal-content",style:e.contentStyle},[t("div",{staticClass:"micro-modal-close",on:{click:e.onClose}},[t("svg",{staticClass:"icon fill-current",attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 26 26",fill:"none",role:"img"}},[t("path",{attrs:{d:"M8.28596 6.51819C7.7978 6.03003 7.00634 6.03003 6.51819 6.51819C6.03003 7.00634 6.03003 7.7978 6.51819 8.28596L11.2322 13L6.51819 17.714C6.03003 18.2022 6.03003 18.9937 6.51819 19.4818C7.00634 19.97 7.7978 19.97 8.28596 19.4818L13 14.7678L17.714 19.4818C18.2022 19.97 18.9937 19.97 19.4818 19.4818C19.97 18.9937 19.97 18.2022 19.4818 17.714L14.7678 13L19.4818 8.28596C19.97 7.7978 19.97 7.00634 19.4818 6.51819C18.9937 6.03003 18.2022 6.03003 17.714 6.51819L13 11.2322L8.28596 6.51819Z",fill:"currentColor"}})])]),t("ResizeLine",{staticClass:"micro-modal-resize",attrs:{placement:"right",min:e.minSize,max:0,reverse:!0,beforeResize:e.beforeResize},on:{"on-change":e.onChangeResize},model:{value:e.dynamicSize,callback:function(i){e.dynamicSize=i},expression:"dynamicSize"}}),t("div",{ref:"body",staticClass:"micro-modal-body"},[e._t("default")],2)],1):e._e()])],1)])},b=[];const S={name:"MicroModal",components:{ResizeLine:y},directives:{TransferDom:d},props:{value:{type:Boolean,default:!1},size:{type:Number,default:300},minSize:{type:Number,default:300},transparent:{type:Boolean,default:!1},autoDarkTheme:{type:Boolean,default:!0},beforeClose:Function},data(){return{dynamicSize:0,zIndex:1e3}},computed:{className({value:e,transparent:s,autoDarkTheme:t}){return{"micro-modal":!0,"micro-modal-hidden":!e,"no-dark-content":!t,"transparent-mode":s}},transitions({transparent:e}){return e?["",""]:["micro-modal-fade","micro-modal-slide"]},maskStyle({zIndex:e}){return{zIndex:e}},contentStyle({dynamicSize:e,zIndex:s}){return{width:e<=100?`${e}%`:`${e}px`,zIndex:s}}},watch:{value:{handler(e){e&&(this.zIndex=typeof window.modalTransferIndex=="number"?window.modalTransferIndex++:1e3)},immediate:!0},size:{handler(e){this.dynamicSize=parseInt(e)},immediate:!0}},methods:{beforeResize(){return new Promise(e=>{this.dynamicSize<=100&&this.updateSize(),e()})},onChangeResize({event:e}){e==="up"&&this.updateSize()},updateSize(){this.$refs.body&&(this.dynamicSize=this.$refs.body.clientWidth)},onClose(){if(!this.beforeClose)return this.handleClose();const e=this.beforeClose();e&&e.then?e.then(()=>{this.handleClose()}):this.handleClose()},handleClose(){this.$emit("input",!1)}}},p={};var C=u(S,$,b,!1,M,null,null,null);function M(e){for(let s in p)this[s]=p[s]}var x=function(){return C.exports}(),g=function(){var e=this,s=e.$createElement,t=e._self._c||s;return t("div",[e._l(e.apps,function(i,n){return t("MicroModal",{key:n,ref:`ref-${i.name}`,refInFor:!0,attrs:{size:1200,transparent:i.transparent,autoDarkTheme:i.auto_dark_theme,beforeClose:async function(){await e.onBeforeClose(i.name)}},model:{value:i.isOpen,callback:function(a){e.$set(i,"isOpen",a)},expression:"app.isOpen"}},[i.isOpen&&i.url?t("micro-app",{attrs:{name:i.name,url:i.url,"keep-alive":i.keep_alive,"disable-scopecss":i.disable_scope_css,data:e.appData(i.name)},on:{created:e.created,beforemount:e.beforemount,mounted:e.mounted,unmount:e.unmount,error:e.error}}):e._e(),i.isLoading?t("div",{staticClass:"micro-app-loader"},[t("Loading")],1):e._e()],1)}),t("UserSelect",e._b({ref:"userSelect",attrs:{module:""},model:{value:e.userSelectOptions.value,callback:function(i){e.$set(e.userSelectOptions,"value",i)},expression:"userSelectOptions.value"}},"UserSelect",e.userSelectOptions.config,!1)),t("Modal",{attrs:{closable:!0,mask:!1,"mask-closable":!1,"footer-hide":!0,"transition-names":["",""],beforeClose:e.onAssistClose,"class-name":"micro-app-assist"},model:{value:e.assistShow,callback:function(i){e.assistShow=i},expression:"assistShow"}})],2)},k=[];const z={name:"MicroApps",directives:{TransferDom:d},components:{MicroModal:x,UserSelect:o},props:{windowType:{type:String,default:"embed"}},data(){return{apps:[],assistShow:!1,userSelectOptions:{value:[],config:{}}}},created(){r.start({iframe:!0,"router-mode":"state"})},mounted(){l.on("observeMicroApp:open",this.observeMicroApp)},beforeDestroy(){l.off("observeMicroApp:open",this.observeMicroApp)},watch:{userToken(e){e||this.closeAllMicroApp()},themeName(){this.closeAllMicroApp()},apps:{handler(e){this.assistShow=!!e.find(s=>s.isOpen)},deep:!0}},computed:{...h(["userInfo","themeName"])},methods:{created(){},beforemount(){},mounted(e){this.finish(e)},unmount(){},error(e){this.finish(e),$A.modalError({language:!1,title:this.$L("\u5E94\u7528\u52A0\u8F7D\u5931\u8D25"),content:e.detail.error,onOk:()=>{this.closeMicroApp(e.detail.name,!0)}})},finish(e){const s=this.apps.find(({name:t})=>t==e.detail.name);s&&(s.isLoading=!1)},appData(e){const s=this.apps.find(t=>t.name==e);return s?{type:"init",instance:{Vue:m,store:_,components:{DialogWrapper:v,UserSelect:o,DatePicker:f.exports.DatePicker}},props:{...s.props,userId:this.userId,userToken:this.userToken,userInfo:this.userInfo,baseUrl:$A.mainUrl(),systemInfo:window.systemInfo,windowType:this.windowType,isEEUIApp:$A.isEEUIApp,isElectron:$A.isElectron,isMainElectron:$A.isMainElectron,isSubElectron:$A.isSubElectron,languageList:A,languageName:w,themeName:this.themeName},methods:{close:(t=!1)=>{this.closeMicroApp(e,t)},back:()=>{this.closeByName(e)},nextZIndex:()=>typeof window.modalTransferIndex=="number"?window.modalTransferIndex++:1e3,selectUsers:async t=>($A.isJson(t)||(t={value:t}),$A.isArray(t.value)&&(t.value=t.value?[t.value]:[]),this.userSelectOptions.value=t.value,delete t.value,this.userSelectOptions.config=t,await new Promise(i=>{this.$refs.userSelect.onSelection(n=>i(n))})),popoutWindow:async(t=null)=>{const i=this.apps.find(n=>n.name==e);if(!i){$A.modalError("\u5E94\u7528\u4E0D\u5B58\u5728");return}await this.inlineBlank(i,t)},openWindow:t=>{$A.isJson(t)||(t={path:t}),t.url&&(t.path=t.url,delete t.url),this.$store.dispatch("openChildWindow",t)},openTabWindow:t=>{this.$store.dispatch("openWebTabWindow",t)},openAppPage:t=>{$A.isJson(t)||(t={url:t}),this.$store.dispatch("openAppChildPage",{pageType:"app",pageTitle:t.title||" ",url:"web.js",params:{url:t.url,titleFixed:typeof t.titleFixed=="boolean"?t.titleFixed:!1}})},extraCallA:(...t)=>{if(t.length>0&&typeof t[0]=="string"){const i=t[0],n=t.slice(1);if(typeof $A[i]=="function")return $A[i](...n)}return null}}}:{}},async observeMicroApp(e){if(e.url_type==="inline_blank"){await this.inlineBlank(e);return}if(e.url_type==="external"){await this.externalWindow(e);return}const s=this.apps.find(({name:t})=>t==e.name);s?(s.url!=e.url&&(await r.unmountApp(s.name,{destroy:!0}),s.isLoading=!0),Object.assign(s,e),requestAnimationFrame(t=>s.isOpen=!0)):(e.isLoading=!0,e.isOpen=!1,this.apps.push(e),requestAnimationFrame(t=>e.isOpen=!0))},async inlineBlank(e,s=null){const t={...e,url_type:"inline",transparent:!0,keep_alive:!1};s!=null&&s.url&&(t.url=s.url,delete s.url);const i=`/single/apps/${t.name}`,n=(await $A.IDBArray("cacheMicroApps")).filter(a=>a.name!=t.name);n.length>50&&n.splice(0,10),n.push(t),await $A.IDBSet("cacheMicroApps",n),this.$Electron?await this.$store.dispatch("openChildWindow",{name:`single-apps-${$A.randomString(6)}`,path:i,force:!1,config:Object.assign({title:" ",parent:null,width:Math.min(window.screen.availWidth,1440),height:Math.min(window.screen.availHeight,900)},$A.isJson(s)?s:{})}):this.$isEEUIApp?await this.$store.dispatch("openAppChildPage",{pageType:"app",pageTitle:" ",url:"web.js",params:{url:$A.urlReplaceHash(i)}}):window.open($A.mainUrl(i.substring(1)))},async externalWindow(e){this.$Electron?await this.$store.dispatch("openChildWindow",{name:`external-apps-${$A.randomString(6)}`,path:e.url,force:!1,config:{title:" ",parent:null,width:Math.min(window.screen.availWidth,1440),height:Math.min(window.screen.availHeight,900)}}):this.$isEEUIApp?await this.$store.dispatch("openAppChildPage",{pageType:"app",pageTitle:" ",url:"web.js",params:{url:e.url}}):window.open(e.url)},closeByName(e){try{this.$refs[`ref-${e}`][0].onClose()}catch{this.closeMicroApp(e)}},closeMicroApp(e,s){const t=this.apps.find(i=>i.name==e);!t||(t.isOpen=!1,s&&r.unmountApp(t.name,{destroy:!0}))},closeAllMicroApp(){this.apps=[],r.unmountAllApps({destroy:!0})},onBeforeClose(e){return new Promise(s=>{r.forceSetData(e,{type:"beforeClose"},t=>{t!=null&&t.find(i=>i===!0)||($A.leftExists(e,"appstore")&&this.$store.dispatch("updateMicroAppsStatus"),$A.isSubElectron?$A.Electron.sendMessage("windowDestroy"):s())})})},onAssistClose(){return new Promise(e=>{const s=this.apps.findLast(t=>t.isOpen);s?this.closeByName(s.name):e()})}}},c={};var E=u(z,g,k,!1,I,null,null,null);function I(e){for(let s in c)this[s]=c[s]}var U=function(){return E.exports}();export{U as M};