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