yxuse 3.0.72 → 3.0.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs9.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./index.cjs11.js"),
|
|
1
|
+
"use strict";const e=require("./index.cjs11.js"),t=require("element-plus");require("element-plus/es/components/message-box/style/index");const o=require("vue");require("element-plus/es/components/dialog/style/index"),require("element-plus/es/components/button/style/index"),require("element-plus/es/components/drawer/style/index"),require("element-plus/es/components/message/style/index");const l=(e,o,l={})=>{t.ElMessageBox.confirm(e,(null==l?void 0:l.title)||"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",...l}).then((()=>{o()})).catch((()=>{}))},n={width:"30%",showFooter:!0,autoClose:!0,confirmText:"确认",cancelText:"取消",draggable:!0,closeOnClickModal:!1},s=async e=>{let l;const s=o.ref(!0),u=o.ref(!1),a={...n,...e},{showFooter:r,autoClose:i,submit:c,cancel:d,beforeOpen:m,beforeSubmit:f,confirmText:p,cancelText:g,content:h}=a;m&&await m();const v=o.defineComponent({setup:()=>({open:open,close:()=>{s.value=!1},selfSubmit:async()=>{try{(!f||await f())&&(u.value=!0,await(null==c?void 0:c()))}finally{i&&(s.value=!1),u.value=!1}}}),render(){const e=()=>o.h("div",{class:"flex justify-end gap-10"},[o.h(t.ElButton,{onClick:this.close,plain:!0},{default:()=>g}),o.h(t.ElButton,{onClick:this.selfSubmit,loading:u.value},{default:()=>p})]);return o.h(t.ElDialog,{modelValue:s.value,...a,beforeClose:()=>{this.close(),d&&d()},onClosed:()=>{l.unmount(),document.body.removeChild(b)}},{default:()=>h&&h instanceof Function?h():h,footer:()=>r?e():null})}}),b=document.createElement("div");return document.body.appendChild(b),l=o.createApp(v),l.use(t).mount(b),()=>{s.value=!1}},u={width:"30%",showFooter:!0,autoClose:!0,confirmText:"确认",cancelText:"取消",draggable:!0,closeOnClickModal:!1},a=async e=>{let l;const n=o.ref(!0),s=o.ref(!1),a={...u,...e},{showFooter:r,autoClose:i,submit:c,cancel:d,beforeOpen:m,beforeSubmit:f,confirmText:p,cancelText:g,content:h}=a;m&&await m();const v=o.defineComponent({setup:()=>({open:open,close:()=>{n.value=!1},selfSubmit:async()=>{try{(!f||await f())&&(s.value=!0,await(null==c?void 0:c()))}finally{i&&(n.value=!1),s.value=!1}}}),render(){const e=()=>o.h("div",{class:"flex justify-end gap-10"},[o.h(t.ElButton,{onClick:this.close,plain:!0},{default:()=>g}),o.h(t.ElButton,{onClick:this.selfSubmit,loading:s.value},{default:()=>p})]);return o.h(t.ElDrawer,{modelValue:n.value,...a,size:a.width,beforeClose:()=>{this.close(),d&&d()},onClosed:()=>{l.unmount(),document.body.removeChild(b)}},{default:()=>h&&h instanceof Function?h():h,footer:()=>r?e():null})}}),b=document.createElement("div");return document.body.appendChild(b),l=o.createApp(v),l.use(t).mount(b),()=>{n.value=!1}},r=e=>{if(e){const{data:l,callback:n,isShowError:s=!0}=e;try{(null==l?void 0:l.isSuccess)?(t.ElMessage.success((null==l?void 0:l.resultMsg)||"操作成功"),n&&n()):s&&t.ElMessage.error((null==l?void 0:l.resultMsg)||"操作失败")}catch(o){}}return{success:e=>t.ElMessage.success(e),error:e=>t.ElMessage.error(e),warning:e=>t.ElMessage.warning(e)}},i=Object.freeze(Object.defineProperty({__proto__:null,useConfirm:l,useDialog:s,useDrawer:a,useMessage:r,useTime:e.useTime},Symbol.toStringTag,{value:"Module"}));exports.useConfirm=l,exports.useDialog=s,exports.useDrawer=a,exports.useMessage=r,exports.yxHooks=i;
|
package/lib/index.es9.js
CHANGED
|
@@ -96,6 +96,9 @@ const useDialog = async (options) => {
|
|
|
96
96
|
document.body.appendChild(container);
|
|
97
97
|
app = createApp(dialogWrapper);
|
|
98
98
|
app.use(ElementPlus).mount(container);
|
|
99
|
+
return () => {
|
|
100
|
+
visible.value = false;
|
|
101
|
+
};
|
|
99
102
|
};
|
|
100
103
|
const diaConfig = {
|
|
101
104
|
width: "30%",
|
|
@@ -177,6 +180,9 @@ const useDrawer = async (options) => {
|
|
|
177
180
|
document.body.appendChild(container);
|
|
178
181
|
app = createApp(dialogWrapper);
|
|
179
182
|
app.use(ElementPlus).mount(container);
|
|
183
|
+
return () => {
|
|
184
|
+
visible.value = false;
|
|
185
|
+
};
|
|
180
186
|
};
|
|
181
187
|
const useMessage = (arg) => {
|
|
182
188
|
if (arg) {
|
package/package.json
CHANGED