index.1d37754d.js 1.6 KB

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