index.84851ef1.js 1.7 KB

1
  1. import{t as g,N as S,aB as v,v as o,aw as I,u as y,aC as w,d as x,c as a,E as B,al as T,P as N,a5 as O,ay as _,L as D,_ as E,D as K}from"./index.ffe80dbe.js";const[H,t]=g("action-sheet"),L=S({},v,{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 a("div",{class:t("header")},[n.title,n.closeable&&a(O,{name:n.closeIcon,class:[t("close"),_],onClick:i},null)])},f=()=>{if(c.cancel||n.cancelText)return[a("div",{class:t("gap")},null),a("button",{type:"button",class:t("cancel"),onClick:i},[c.cancel?c.cancel():n.cancelText])]},b=(e,s)=>e.loading?a(D,{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: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 a("button",{type:"button",style:{color:P},class:[t("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 a("div",{class:t("description")},[e])}};return()=>a(N,B({class:t(),position:"bottom","onUpdate:show":r},T(n,F)),{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 j=K(U);export{j as A};