import{_ as y}from"./_plugin-vue_export-helper-c27b6911.js";import{o as r,m as u,c as o,w as e,b as t,f as V,e as c,t as s,q as m,Y as p,X as _,F as b,p as v,E as h,G as x,x as I,aC as C,y as k,H as T,aG as E,T as S,U as F,D as w,v as g}from"./index-19df9d81.js";const B={name:"ItemCardGrid",props:{items:{type:Array,required:!0},titleField:{type:String,default:"id"},enabledField:{type:String,default:"enable"},emptyIcon:{type:String,default:"mdi-alert-circle-outline"},emptyText:{type:String,default:"暂无数据"}},emits:["toggle-enabled","delete","edit"],methods:{getItemTitle(a){return a[this.titleField]},getItemEnabled(a){return a[this.enabledField]},toggleEnabled(a){this.$emit("toggle-enabled",a)}}},G={class:"text-grey mt-4"},z=["title"];function D(a,N,n,U,q,d){return r(),u("div",null,[n.items.length===0?(r(),o(_,{key:0},{default:e(()=>[t(p,{cols:"12",class:"text-center pa-8"},{default:e(()=>[t(V,{size:"64",color:"grey-lighten-1"},{default:e(()=>[c(s(n.emptyIcon),1)]),_:1}),m("p",G,s(n.emptyText),1)]),_:1})]),_:1})):(r(),o(_,{key:1},{default:e(()=>[(r(!0),u(b,null,v(n.items,(l,f)=>(r(),o(p,{key:f,cols:"12",md:"6",lg:"4",xl:"3"},{default:e(()=>[t(h,{class:"item-card hover-elevation",color:d.getItemEnabled(l)?"":"grey-lighten-4"},{default:e(()=>[t(x,{class:"d-flex justify-space-between align-center pb-1 pt-3"},{default:e(()=>[m("span",{class:"text-h4 text-truncate",title:d.getItemTitle(l)},s(d.getItemTitle(l)),9,z),t(I,{location:"top"},{activator:e(({props:i})=>[t(C,k({color:"primary","hide-details":"",density:"compact","model-value":d.getItemEnabled(l)},i,{"onUpdate:modelValue":A=>d.toggleEnabled(l)}),null,16,["model-value","onUpdate:modelValue"])]),default:e(()=>[m("span",null,s(d.getItemEnabled(l)?"已启用":"已禁用"),1)]),_:2},1024)]),_:2},1024),t(T,null,{default:e(()=>[E(a.$slots,"item-details",{item:l},void 0,!0)]),_:2},1024),t(S),t(F,{class:"pa-2"},{default:e(()=>[t(w),t(g,{variant:"text",size:"small",color:"error","prepend-icon":"mdi-delete",onClick:i=>a.$emit("delete",l)},{default:e(()=>[c(" 删除 ")]),_:2},1032,["onClick"]),t(g,{variant:"text",size:"small",color:"primary","prepend-icon":"mdi-pencil",onClick:i=>a.$emit("edit",l)},{default:e(()=>[c(" 编辑 ")]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1032,["color"])]),_:2},1024))),128))]),_:3}))])}const L=y(B,[["render",D],["__scopeId","data-v-a8996b2e"]]);export{L as I};
