12345678910111213141516 |
- import{be as O,d as k,a9 as g,W as T,aU as S,C as u,a1 as B,ab as m,ai as h,k as a,m as P,ag as N,aj as w,aL as R,bg as I,T as C,V as f,U as x,$ as y,bE as $,f as U,aZ as F,bi as E,bF as V,n as K,bG as L,al as _}from"./index-e497b666.js";const j=O("n-popconfirm"),z={positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},onPositiveClick:{type:Function,required:!0},onNegativeClick:{type:Function,required:!0}},b=I(z),W=k({name:"NPopconfirmPanel",props:z,setup(e){const{localeRef:t}=g("Popconfirm"),{inlineThemeDisabled:s}=T(),{mergedClsPrefixRef:n,mergedThemeRef:p,props:r}=S(j),d=u(()=>{const{common:{cubicBezierEaseInOut:i},self:{fontSize:c,iconSize:v,iconColor:l}}=p.value;return{"--n-bezier":i,"--n-font-size":c,"--n-icon-size":v,"--n-icon-color":l}}),o=s?B("popconfirm-panel",void 0,d,r):void 0;return Object.assign(Object.assign({},g("Popconfirm")),{mergedClsPrefix:n,cssVars:s?void 0:d,localizedPositiveText:u(()=>e.positiveText||t.value.positiveText),localizedNegativeText:u(()=>e.negativeText||t.value.negativeText),positiveButtonProps:m(r,"positiveButtonProps"),negativeButtonProps:m(r,"negativeButtonProps"),handlePositiveClick(i){e.onPositiveClick(i)},handleNegativeClick(i){e.onNegativeClick(i)},themeClass:o==null?void 0:o.themeClass,onRender:o==null?void 0:o.onRender})},render(){var e;const{mergedClsPrefix:t,showIcon:s,$slots:n}=this,p=h(n.action,()=>this.negativeText===null&&this.positiveText===null?[]:[this.negativeText!==null&&a(P,Object.assign({size:"small",onClick:this.handleNegativeClick},this.negativeButtonProps),{default:()=>this.localizedNegativeText}),this.positiveText!==null&&a(P,Object.assign({size:"small",type:"primary",onClick:this.handlePositiveClick},this.positiveButtonProps),{default:()=>this.localizedPositiveText})]);return(e=this.onRender)===null||e===void 0||e.call(this),a("div",{class:[`${t}-popconfirm__panel`,this.themeClass],style:this.cssVars},N(n.default,r=>s||r?a("div",{class:`${t}-popconfirm__body`},s?a("div",{class:`${t}-popconfirm__icon`},h(n.icon,()=>[a(w,{clsPrefix:t},{default:()=>a(R,null)})])):null,r):null),p?a("div",{class:[`${t}-popconfirm__action`]},p):null)}}),q=C("popconfirm",[f("body",`
- font-size: var(--n-font-size);
- display: flex;
- align-items: center;
- flex-wrap: nowrap;
- position: relative;
- `,[f("icon",`
- display: flex;
- font-size: var(--n-icon-size);
- color: var(--n-icon-color);
- transition: color .3s var(--n-bezier);
- margin: 0 8px 0 0;
- `)]),f("action",`
- display: flex;
- justify-content: flex-end;
- `,[x("&:not(:first-child)","margin-top: 8px"),C("button",[x("&:not(:last-child)","margin-right: 8px;")])])]),M=Object.assign(Object.assign(Object.assign({},y.props),L),{positiveText:String,negativeText:String,showIcon:{type:Boolean,default:!0},trigger:{type:String,default:"click"},positiveButtonProps:Object,negativeButtonProps:Object,onPositiveClick:Function,onNegativeClick:Function}),G=k({name:"Popconfirm",props:M,__popover__:!0,setup(e){const{mergedClsPrefixRef:t}=T(),s=y("Popconfirm","-popconfirm",q,$,e,t),n=U(null);function p(o){const{onPositiveClick:i,"onUpdate:show":c}=e;Promise.resolve(i?i(o):!0).then(v=>{var l;v!==!1&&((l=n.value)===null||l===void 0||l.setShow(!1),c&&_(c,!1))})}function r(o){const{onNegativeClick:i,"onUpdate:show":c}=e;Promise.resolve(i?i(o):!0).then(v=>{var l;v!==!1&&((l=n.value)===null||l===void 0||l.setShow(!1),c&&_(c,!1))})}return F(j,{mergedThemeRef:s,mergedClsPrefixRef:t,props:e}),Object.assign(Object.assign({},{setShow(o){var i;(i=n.value)===null||i===void 0||i.setShow(o)},syncPosition(){var o;(o=n.value)===null||o===void 0||o.syncPosition()}}),{mergedTheme:s,popoverInstRef:n,handlePositiveClick:p,handleNegativeClick:r})},render(){const{$slots:e,$props:t,mergedTheme:s}=this;return a(K,V(t,b,{theme:s.peers.Popover,themeOverrides:s.peerOverrides.Popover,internalExtraClass:["popconfirm"],ref:"popoverInstRef"}),{trigger:e.activator||e.trigger,default:()=>{const n=E(t,b);return a(W,Object.assign(Object.assign({},n),{onPositiveClick:this.handlePositiveClick,onNegativeClick:this.handleNegativeClick}),e)}})}});export{G as _};
|