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"),o=require("element-plus");require("element-plus/es/components/message-box/style/index");const t=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,t,l={})=>{o.ElMessageBox.confirm(e,(null==l?void 0:l.title)||"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",...l}).then((()=>{t()})).catch((()=>{}))},n={width:"30%",showFooter:!0,autoClose:!0,confirmText:"确认",cancelText:"取消",draggable:!0,closeOnClickModal:!1},s=async e=>{let l;const s=t.ref(!0),u=t.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 b=t.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=()=>t.h("div",{class:"flex justify-end gap-10"},[t.h(o.ElButton,{onClick:this.close,plain:!0},{default:()=>g}),t.h(o.ElButton,{onClick:this.selfSubmit,loading:u.value},{default:()=>p})]);return t.h(o.ElDialog,{modelValue:s.value,...a,beforeClose:()=>{this.close(),d&&d()},onClosed:()=>{l.unmount(),document.body.removeChild(v)}},{default:()=>h&&h instanceof Function?h():h,footer:()=>r?e():null})}}),v=document.createElement("div");document.body.appendChild(v),l=t.createApp(b),l.use(o).mount(v)},u={width:"30%",showFooter:!0,autoClose:!0,confirmText:"确认",cancelText:"取消",draggable:!0,closeOnClickModal:!1},a=async e=>{let l;const n=t.ref(!0),s=t.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 b=t.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=()=>t.h("div",{class:"flex justify-end gap-10"},[t.h(o.ElButton,{onClick:this.close,plain:!0},{default:()=>g}),t.h(o.ElButton,{onClick:this.selfSubmit,loading:s.value},{default:()=>p})]);return t.h(o.ElDrawer,{modelValue:n.value,...a,size:a.width,beforeClose:()=>{this.close(),d&&d()},onClosed:()=>{l.unmount(),document.body.removeChild(v)}},{default:()=>h&&h instanceof Function?h():h,footer:()=>r?e():null})}}),v=document.createElement("div");document.body.appendChild(v),l=t.createApp(b),l.use(o).mount(v)},r=e=>{if(e){const{data:l,callback:n,isShowError:s=!0}=e;try{(null==l?void 0:l.isSuccess)?(o.ElMessage.success((null==l?void 0:l.resultMsg)||"操作成功"),n&&n()):s&&o.ElMessage.error((null==l?void 0:l.resultMsg)||"操作失败")}catch(t){}}return{success:e=>o.ElMessage.success(e),error:e=>o.ElMessage.error(e),warning:e=>o.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;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yxuse",
3
- "version": "3.0.72",
3
+ "version": "3.0.73",
4
4
  "keywords": [
5
5
  "yx"
6
6
  ],
@@ -1,4 +1,4 @@
1
1
  import { DialogOptions } from './type';
2
2
 
3
3
  /**命令式弹窗 */
4
- export declare const useDialog: (options: DialogOptions) => Promise<void>;
4
+ export declare const useDialog: (options: DialogOptions) => Promise<() => void>;
@@ -1,4 +1,4 @@
1
1
  import { DrawerOptions } from './type';
2
2
 
3
3
  /**命令式抽屉 */
4
- export declare const useDrawer: (options: DrawerOptions) => Promise<void>;
4
+ export declare const useDrawer: (options: DrawerOptions) => Promise<() => void>;