adtec-hnyzfc-core-package 1.4.3 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -221,4 +221,4 @@ import{computed as M,ref as _,unref as Z,createApp as oo,nextTick as eo,h as s}f
|
|
|
221
221
|
background: transparent !important;
|
|
222
222
|
background-color: transparent !important;
|
|
223
223
|
}
|
|
224
|
-
`,document.head.appendChild(i)}function xo(o){const e=!!o.querySelector(".dialog-hooks-body-contained");o.querySelectorAll(e?".el-dialog-body__content":".el-drawer__body, .el-dialog__body").forEach(i=>{let n;const b=()=>{i.classList.add("is-scrolling"),n&&window.clearTimeout(n),n=window.setTimeout(()=>i.classList.remove("is-scrolling"),600)};i.addEventListener("scroll",b,{passive:!0}),i.addEventListener("mouseenter",b),i.addEventListener("mouseleave",()=>{n&&window.clearTimeout(n),i.classList.remove("is-scrolling")})})}function Lo(o,e,l){return o===!1?{enabled:!1,scroll:l,class:void 0,contentClass:void 0}:o===!0||o===void 0?{enabled:o===!0?!0:e,scroll:l,class:void 0,contentClass:void 0}:{enabled:o.enabled??e,scroll:o.scroll??l,class:o.class,contentClass:o.contentClass}}function Io(o,e){if(e)return e;try{const l=o.router.currentRoute.value.meta?.sysMenuData?.icon;if(l)return l}catch{}try{const l=sessionStorage.getItem("permissionStore");if(l){const i=JSON.parse(ho.parse(l).toString(po));if(i?.activeMenuInfo?.icon)return i.activeMenuInfo.icon}}catch{}try{return so($).getActiveMenuInfo?.icon||""}catch{return""}}function ye(o){return function(l){const i=[],n=()=>i[i.length-1],b=(c,a,v,S="drawer",w,Y=!0)=>{wo();const{icon:G,hideConfirm:x,hideFooter:K,dialogBody:W,...d}=v||{},m=Lo(W,o.defaultDialogBody??!0,Y),C=`${S}|${typeof c=="string"?c:c?.__name||c?.name||""}|${d.title||""}`;if(i.some(r=>r.renderKey===C&&(r.open.value||r.closing)))return;const O=_(!1),A=_(!1),t={open:_(!0),loading:M(()=>O.value||A.value),manualLoading:O,requestLoading:A,requestLoadingIds:new Set,childInstance:_(),app:null,div:null,closing:!1,renderKey:C,actionName:d.title||"确认"},F=Object.fromEntries(Object.entries(a||{}).map(([r,h])=>[r,Z(h)])),J={...d,class:["dialog-hooks-host",...m.enabled?["dialog-hooks-body-contained"]:[],...m.scroll?[]:["dialog-hooks-no-scroll"],"dialog-hooks-scroll-auto",...Array.isArray(d.class)?d.class:d.class?[d.class]:[]]},Q=d.onClosed,L=typeof d.title=="string"&&d.title,D=L?Io(o,G):"",X=()=>s("div",{class:"dialog-hooks-header"},[D?s("div",{class:"dialog-hooks-header-icon"},[s(co,{modelValue:D})]):null,s("div",{class:"dialog-hooks-header-title"},[d.title]),t.loading.value&&!x?null:s("button",{type:"button",class:"dialog-hooks-header-close",onClick:()=>u(t)},[s(B.Close)])]),g=oo(()=>s(S==="drawer"?lo:io,{...J,modelValue:t.open.value,showClose:L?!1:d.showClose??!0,onClosed(){P(t,!1),N(o,t,!1),ko(t),Q?.();const r=i.indexOf(t);r>-1&&i.splice(r,1),t.app?.unmount(),t.div?.parentNode&&t.div.parentNode.removeChild(t.div),t.app=null,t.div=null},onClose(){u(t)}},{...L?{header:X}:{},default:()=>{const r=s(c,{...F,loading:t.loading.value,"onUpdate:loading":h=>{t.manualLoading.value=h},ref:t.childInstance});return m.enabled?s(go,{scroll:m.scroll,class:m.class,contentClass:m.contentClass},{default:()=>r}):r},...K?{}:{footer:()=>{if(w&&w.length){const r=w.map(h=>typeof h=="function"?h():h);return s("div",{className:"dialog-footer"},r)}return s("div",{className:"dialog-footer"},[s(T,{onClick:()=>u(t),loading:!x&&t.loading.value},"取 消"),x?null:s(T,{type:"primary",onClick:()=>H(t),loading:t.loading.value},"确 认")])}}}));o.plugins?.forEach(r=>g.use(r)),g.use(to,{locale:ro}),g.use($),g.use(o.router);for(const[r,h]of Object.entries(B))g.component(r,h);ao(g),o.setupApp?.(g);const I=document.createElement("div");return document.body.appendChild(I),t.app=g,t.div=I,i.push(t),yo(t),P(t,!0),
|
|
224
|
+
`,document.head.appendChild(i)}function xo(o){const e=!!o.querySelector(".dialog-hooks-body-contained");o.querySelectorAll(e?".el-dialog-body__content":".el-drawer__body, .el-dialog__body").forEach(i=>{let n;const b=()=>{i.classList.add("is-scrolling"),n&&window.clearTimeout(n),n=window.setTimeout(()=>i.classList.remove("is-scrolling"),600)};i.addEventListener("scroll",b,{passive:!0}),i.addEventListener("mouseenter",b),i.addEventListener("mouseleave",()=>{n&&window.clearTimeout(n),i.classList.remove("is-scrolling")})})}function Lo(o,e,l){return o===!1?{enabled:!1,scroll:l,class:void 0,contentClass:void 0}:o===!0||o===void 0?{enabled:o===!0?!0:e,scroll:l,class:void 0,contentClass:void 0}:{enabled:o.enabled??e,scroll:o.scroll??l,class:o.class,contentClass:o.contentClass}}function Io(o,e){if(e)return e;try{const l=o.router.currentRoute.value.meta?.sysMenuData?.icon;if(l)return l}catch{}try{const l=sessionStorage.getItem("permissionStore");if(l){const i=JSON.parse(ho.parse(l).toString(po));if(i?.activeMenuInfo?.icon)return i.activeMenuInfo.icon}}catch{}try{return so($).getActiveMenuInfo?.icon||""}catch{return""}}function ye(o){return function(l){const i=[],n=()=>i[i.length-1],b=(c,a,v,S="drawer",w,Y=!0)=>{wo();const{icon:G,hideConfirm:x,hideFooter:K,dialogBody:W,...d}=v||{},m=Lo(W,o.defaultDialogBody??!0,Y),C=`${S}|${typeof c=="string"?c:c?.__name||c?.name||""}|${d.title||""}`;if(i.some(r=>r.renderKey===C&&(r.open.value||r.closing)))return;const O=_(!1),A=_(!1),t={open:_(!0),loading:M(()=>O.value||A.value),manualLoading:O,requestLoading:A,requestLoadingIds:new Set,childInstance:_(),app:null,div:null,closing:!1,renderKey:C,actionName:d.title||"确认"},F=Object.fromEntries(Object.entries(a||{}).map(([r,h])=>[r,Z(h)])),J={...d,class:["dialog-hooks-host",...m.enabled?["dialog-hooks-body-contained"]:[],...m.scroll?[]:["dialog-hooks-no-scroll"],"dialog-hooks-scroll-auto",...Array.isArray(d.class)?d.class:d.class?[d.class]:[]]},Q=d.onClosed,L=typeof d.title=="string"&&d.title,D=L?Io(o,G):"",X=()=>s("div",{class:"dialog-hooks-header"},[D?s("div",{class:"dialog-hooks-header-icon"},[s(co,{modelValue:D})]):null,s("div",{class:"dialog-hooks-header-title"},[d.title]),t.loading.value&&!x?null:s("button",{type:"button",class:"dialog-hooks-header-close",onClick:()=>u(t)},[s(B.Close)])]),g=oo(()=>s(S==="drawer"?lo:io,{...J,modelValue:t.open.value,showClose:L?!1:d.showClose??!0,onClosed(){P(t,!1),N(o,t,!1),ko(t),Q?.();const r=i.indexOf(t);r>-1&&i.splice(r,1),t.app?.unmount(),t.div?.parentNode&&t.div.parentNode.removeChild(t.div),t.app=null,t.div=null},onClose(){u(t)}},{...L?{header:X}:{},default:()=>{const r=s(c,{...F,loading:t.loading.value,"onUpdate:loading":h=>{t.manualLoading.value=h},ref:t.childInstance});return m.enabled?s(go,{scroll:m.scroll,class:m.class,contentClass:m.contentClass},{default:()=>r}):r},...K?{}:{footer:()=>{if(w&&w.length){const r=w.map(h=>typeof h=="function"?h():h);return s("div",{className:"dialog-footer"},r)}return s("div",{className:"dialog-footer"},[s(T,{onClick:()=>u(t),loading:!x&&t.loading.value},"取 消"),x?null:s(T,{type:"primary",onClick:()=>H(t),loading:t.loading.value},"确 认")])}}}));o.plugins?.forEach(r=>g.use(r)),g.use(to,{locale:ro}),g.use($),g.use(o.router);for(const[r,h]of Object.entries(B))g.component(r,h);ao(g),o.setupApp?.(g);const I=document.createElement("div");return document.body.appendChild(I),t.app=g,t.div=I,i.push(t),yo(t),P(t,!0),N(o,t,!0),g.mount(I),eo(()=>{xo(t.div),t.childInstance.value?.resetQuery?.(),setTimeout(()=>{window.dispatchEvent(new Event("resize"))},350)}),no(),{cancel:()=>u(t)}},H=async c=>{const a=c||n();if(!a)return;const{runBehaviorAction:v}=mo();await v({code:`dialog:${a.renderKey}:confirm`,name:a.actionName||"确认",actionType:"SUBMIT"},async()=>{try{a.manualLoading.value=!0,await a.childInstance.value?.confirm?.(),l&&u(a)}finally{a.manualLoading.value=!1}})},u=c=>{const a=c||n();!a||!a.open.value||(a.closing=!0,a.open.value=!1)},R=c=>{const a=n();a&&(a.manualLoading.value=c)},U=()=>n()?.loading.value??!1,j=M(()=>n()?.childInstance.value);return{render:b,cancel:u,setLoading:R,getLoading:U,instance:j}}}export{ye as createDialogHooks,ye as default};
|