@chewel611/naive-ui-plus 0.0.42 → 0.0.44

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.
@@ -6,9 +6,7 @@ declare function __VLS_template(): {
6
6
  'header-extra'?(_: {}): any;
7
7
  default?(_: {}): any;
8
8
  footer?(_: {}): any;
9
- 'action-extra'?(_: {
10
- loading: boolean;
11
- }): any;
9
+ 'action-extra'?(_: {}): any;
12
10
  };
13
11
  refs: {
14
12
  $modal: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("naive-ui"),e=require("vue"),g=e.defineComponent({__name:"PModal",props:{saveBtnText:{default:"保存"},cancelBtnText:{default:"取消"},hideCancelBtn:{type:Boolean,default:!1},hideSaveBtn:{type:Boolean,default:!1},title:{},width:{default:800},height:{default:500},visible:{type:Boolean},loading:{type:Boolean},onSave:{},onClose:{},onAfterEnter:{},onAfterLeave:{},onUpdateShow:{}},emits:["update:visible","update:loading"],setup(n,{expose:i,emit:c}){const r=l.useMessage(),t=n,a=c,f=async()=>{a("update:loading",!0);try{t.onSave&&await t.onSave()&&s()}catch(o){r.error(o.message)}finally{a("update:loading",!1)}},s=()=>{a("update:visible",!1),a("update:loading",!1)},u=async()=>{try{t.onClose?await t.onClose()&&s():s()}catch(o){r.error(o.message),a("update:loading",!1)}};return i({open:()=>{a("update:visible",!0),a("update:loading",!1)},close:()=>{a("update:visible",!1),a("update:loading",!1)}}),(o,v)=>{const h=l.NText,d=l.NButton,p=l.NSpace;return e.openBlock(),e.createBlock(e.unref(l.NModal),e.mergeProps({ref:"$modal",preset:"card"},o.$attrs,{"header-class":"bg-gray-50",show:t.visible,draggable:!0,closable:!1,"close-on-esc":!1,"mask-closable":!1,bordered:!1,style:{width:`${t.width}px`},onClose:s,onAfterEnter:t.onAfterEnter,onAfterLeave:t.onAfterLeave,onUpdateShow:t.onUpdateShow}),{header:e.withCtx(()=>[o.$slots.header?e.renderSlot(o.$slots,"header",{key:0}):t.title?(e.openBlock(),e.createBlock(h,{key:1},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.title),1)]),_:1})):e.createCommentVNode("",!0)]),"header-extra":e.withCtx(()=>[e.renderSlot(o.$slots,"header-extra")]),default:e.withCtx(()=>[e.createElementVNode("div",{class:"overflow-y-auto overflow-hidden mt-5",style:e.normalizeStyle({maxHeight:`${t.height}px`})},[e.renderSlot(o.$slots,"default")],4)]),footer:e.withCtx(()=>[e.renderSlot(o.$slots,"footer")]),action:e.withCtx(()=>[e.createVNode(p,{justify:"end"},{default:e.withCtx(()=>[t.hideSaveBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(d,{key:0,type:"primary",loading:n.loading,onClick:f},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.saveBtnText),1)]),_:1},8,["loading"])),e.renderSlot(o.$slots,"action-extra",{loading:n.loading}),t.hideCancelBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(d,{key:1,onClick:u,loading:n.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.cancelBtnText),1)]),_:1},8,["loading"]))]),_:3})]),_:3},16,["show","style","onAfterEnter","onAfterLeave","onUpdateShow"])}}});exports.default=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("naive-ui"),e=require("vue"),y=e.defineComponent({__name:"PModal",props:{saveBtnText:{default:"保存"},cancelBtnText:{default:"取消"},hideCancelBtn:{type:Boolean,default:!1},hideSaveBtn:{type:Boolean,default:!1},title:{},width:{default:800},height:{default:500},visible:{type:Boolean},onSave:{},onClose:{},onAfterEnter:{},onAfterLeave:{},onUpdateVisible:{}},emits:["update:visible","update:loading"],setup(r,{expose:f,emit:u}){const i=s.useMessage(),o=e.ref(!1),l=e.ref(!1),d=u,t=r,v=async()=>{try{o.value=!0,t.onSave&&await t.onSave()&&n()}catch(a){i.error(a.message)}finally{o.value=!1}},n=()=>{o.value=!1,l.value=!1,d("update:visible",!1)},h=async()=>{try{l.value=!0,t.onClose?await t.onClose()&&n():n()}catch(a){i.error(a.message)}finally{l.value=!1}};return f({open:()=>{o.value=!1,l.value=!1,d("update:visible",!0)},close:n}),(a,C)=>{const p=s.NText,c=s.NButton,m=s.NSpace;return e.openBlock(),e.createBlock(e.unref(s.NModal),e.mergeProps({ref:"$modal",preset:"card"},a.$attrs,{"header-class":"bg-gray-50",show:t.visible,draggable:!0,closable:!1,"close-on-esc":!1,"mask-closable":!1,bordered:!1,style:{width:`${t.width}px`},onClose:n,onAfterEnter:t.onAfterEnter,onAfterLeave:t.onAfterLeave,onUpdateVisible:t.onUpdateVisible}),{header:e.withCtx(()=>[a.$slots.header?e.renderSlot(a.$slots,"header",{key:0}):t.title?(e.openBlock(),e.createBlock(p,{key:1},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.title),1)]),_:1})):e.createCommentVNode("",!0)]),"header-extra":e.withCtx(()=>[e.renderSlot(a.$slots,"header-extra")]),default:e.withCtx(()=>[e.createElementVNode("div",{class:"overflow-y-auto overflow-hidden mt-5",style:e.normalizeStyle({maxHeight:`${t.height}px`})},[e.renderSlot(a.$slots,"default")],4)]),footer:e.withCtx(()=>[e.renderSlot(a.$slots,"footer")]),action:e.withCtx(()=>[e.createVNode(m,{justify:"end"},{default:e.withCtx(()=>[t.hideSaveBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(c,{key:0,type:"primary",loading:o.value,onClick:v},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.saveBtnText),1)]),_:1},8,["loading"])),e.renderSlot(a.$slots,"action-extra"),t.hideCancelBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(c,{key:1,loading:l.value,onClick:h},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.cancelBtnText),1)]),_:1},8,["loading"]))]),_:3})]),_:3},16,["show","style","onAfterEnter","onAfterLeave","onUpdateVisible"])}}});exports.default=y;
@@ -2149,8 +2149,6 @@ export declare const PModalPlugin: {
2149
2149
  'header-extra'?(_: {}): any;
2150
2150
  default?(_: {}): any;
2151
2151
  footer?(_: {}): any;
2152
- 'action-extra'?(_: {
2153
- loading: boolean;
2154
- }): any;
2152
+ 'action-extra'?(_: {}): any;
2155
2153
  };
2156
2154
  }) & import('vue').Plugin;
@@ -7,12 +7,11 @@ export type ModalProps = {
7
7
  width?: number;
8
8
  height?: number;
9
9
  visible: boolean;
10
- loading: boolean;
11
10
  onSave?: () => Promise<boolean> | boolean;
12
11
  onClose?: () => Promise<boolean> | boolean;
13
12
  onAfterEnter?: () => void;
14
13
  onAfterLeave?: () => void;
15
- onUpdateShow?: (value: boolean) => void;
14
+ onUpdateVisible?: (value: boolean) => void;
16
15
  };
17
16
  export type ModalMethods = {
18
17
  open: () => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chewel611/naive-ui-plus",
3
3
  "private": false,
4
- "version": "0.0.42",
4
+ "version": "0.0.44",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "sideEffects": false,