import{_ as y}from"./_plugin-vue_export-helper-c27b6911.js";import{o as r,k as u,c,w as e,b as t,f as b,e as m,t as n,n as i,W as _,U as g,F as v,m as V,a0 as I,C as h,P as C,aG as x,A as k,D as S,aH as T,R as E,S as B,z as F,p,B as w}from"./index-13e6f925.js";const z={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)}}},G={class:"text-grey mt-4"},A=["title"];function D(l,N,s,U,P,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(b,{size:"64",color:"grey-lighten-1"},{default:e(()=>[m(n(s.emptyIcon),1)]),_:1}),i("p",G,n(s.emptyText),1)]),_:1})]),_:1})):(r(),c(g,{key:1},{default:e(()=>[(r(!0),u(v,null,V(s.items,(a,f)=>(r(),c(_,{key:f,cols:"12",md:"6",lg:"4",xl:"3"},{default:e(()=>[t(w,{class:"item-card hover-elevation",color:d.getItemEnabled(a)?"":"grey-lighten-4"},{default:e(()=>[i("div",{class:I(["item-status-indicator",{active:d.getItemEnabled(a)}])},null,2),t(h,{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,A),t(C,{location:"top"},{activator:e(({props:o})=>[t(x,k({color:"primary","hide-details":"",density:"compact","model-value":d.getItemEnabled(a)},o,{"onUpdate:modelValue":R=>d.toggleEnabled(a)}),null,16,["model-value","onUpdate:modelValue"])]),default:e(()=>[i("span",null,n(d.getItemEnabled(a)?"已启用":"已禁用"),1)]),_:2},1024)]),_:2},1024),t(S,null,{default:e(()=>[T(l.$slots,"item-details",{item:a},void 0,!0)]),_:2},1024),t(E),t(B,{class:"pa-2"},{default:e(()=>[t(F),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 H=y(z,[["render",D],["__scopeId","data-v-b62774e7"]]);export{H as I};
