index.78e196a2.js 1.7 KB

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