index.8ec5fd1e.js 1.7 KB

1
  1. import{A as S,I as g,aU as v,G as o,aV as I,$ as x,aW as y,d as w,j as a,a7 as T,aA as B,aR as N,M as O,aX as K,aS as _,W as D,N as E}from"./index.e6d6174e.js";const[H,t]=S("action-sheet"),U=g({},v,{title:String,round:o,actions:I(),closeIcon:x("cross"),closeable:o,cancelText:String,description:String,closeOnPopstate:o,closeOnClickAction:Boolean,safeAreaInsetBottom:o}),V=[...y,"round","closeOnPopstate","safeAreaInsetBottom"];var W=w({name:H,props:U,emits:["select","cancel","update:show"],setup(n,{slots:c,emit:r}){const i=e=>r("update:show",e),l=()=>{i(!1),r("cancel")},m=()=>{if(n.title)return a("div",{class:t("header")},[n.title,n.closeable&&a(O,{name:n.closeIcon,class:[t("close"),K],onClick:l},null)])},f=()=>{if(c.cancel||n.cancelText)return[a("div",{class:t("gap")},null),a("button",{type:"button",class:t("cancel"),onClick:l},[c.cancel?c.cancel():n.cancelText])]},b=(e,s)=>e.loading?a(_,{class:t("loading-icon")},null):c.action?c.action({action:e,index:s}):[a("span",{class:t("name")},[e.name]),e.subname&&a("div",{class:t("subname")},[e.subname])],h=(e,s)=>{const{color:C,loading:d,callback:u,disabled:p,className:k}=e,P=()=>{p||d||(u&&u(e),n.closeOnClickAction&&i(!1),D(()=>r("select",e,s)))};return a("button",{type:"button",style:{color:C},class:[t("item",{loading:d,disabled:p}),k],onClick:P},[b(e,s)])},A=()=>{if(n.description||c.description){const e=c.description?c.description():n.description;return a("div",{class:t("description")},[e])}};return()=>a(N,T({class:t(),position:"bottom","onUpdate:show":i},B(n,V)),{default:()=>{var e;return[m(),A(),a("div",{class:t("content")},[n.actions.map(h),(e=c.default)==null?void 0:e.call(c)]),f()]}})}});const F=E(W);export{F as A};