import{a1 as F,D,d as H,o as s,c as a,b as l,r as d,w as V,Q as _,h as u,F as g,g as f,l as K,e as p,t as x,n as b,i as h,a as M,u as T,a2 as z}from"./vendor-1-1-47.js";const I={key:0},U={class:"flex flex-col justify-center items-center text-center mx-auto max-w-[900px] bg-white rounded-md space-y-8 mt-8 lg:px-48 px-4 lg:py-10 py-5"},q={class:"w-full bg-white divide-y divide-gray-200 dark:divide-neutral-700"},E={key:0,class:"text-xs text-gray-700 text-left bg-gray-50 dark:bg-gray-700 dark:text-gray-400"},O={key:0,class:"px-4 py-3",scope:"col"},Q=["src","alt"],G={key:1},J=["colspan"],P={class:"flex flex-col rounded items-center justify-center p-4"},R=["onMouseover","onMouseleave"],W={key:0,class:"px-4 py-3",scope:"col"},X=["value"],Y=["onClick"],Z={key:2,class:"text-xs text-gray-700 bg-white dark:bg-gray-700 dark:text-gray-400"},ee=["colspan"],ae={__name:"MdrTable",props:{headers:{type:Array,required:!0},items:{type:[Array,Object],default:()=>[]},selectable:{type:Boolean,default:!1},selectableKey:{type:String,default:"id"},noDataText:{type:String,default:"Veri bulunamadı."},showHeader:{type:Boolean,default:!0}},emits:["selected","tr-clicked","tr-mouseover","tr-mouseleave"],setup(o,{emit:B}){const m=B,i=o,w=e=>e===i.headers.length-1,N=e=>e===i.items.length-1,$=h(()=>i.selectable?i.headers.length+1:i.headers.length),C=h(()=>{var e,n;return!!((n=(e=z())==null?void 0:e.vnode.props)!=null&&n.onTrClicked)}),k=F(),y=M([]),v=M(!1),S=h(()=>!!k.footer),L=h(()=>!!k.noData);return D(v,e=>{e?y.value=i.items.map(n=>n[i.selectableKey]):y.value=[]}),D(y,e=>{m("selected",e)}),(e,n)=>{const j=H("magnifying-glass-icon");return o.items.length===0&&L.value?(s(),a("div",I,[l("div",U,[d(e.$slots,"noData")])])):(s(),a("div",{key:1,class:b(`border rounded-lg overflow-x-auto overflow-y-hidden sm:overflow-x-hidden ${o.items.length===0?"p-1":"p-0"} dark:border-neutral-700`)},[d(e.$slots,"top"),l("table",q,[o.showHeader&&o.items.length>0?(s(),a("thead",E,[o.selectable?(s(),a("th",O,[V(l("input",{"onUpdate:modelValue":n[0]||(n[0]=t=>v.value=t),type:"checkbox",class:"w-4 h-4 text-primary-800 bg-gray-100 border-gray-300 rounded focus:ring-primary-500 dark:focus:ring-primary-800 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"},null,512),[[_,v.value]])])):u("",!0),(s(!0),a(g,null,f(o.headers,(t,c)=>(s(),a("th",{key:c,scope:"col",class:b(`px-4 py-3 w-auto ${w(c)?"text-right":""} ${t.class?t.class:""} `)},[T(k)[`${t.key}-header`]?d(e.$slots,`${t.key}-header`,{key:0,header:t}):(s(),a(g,{key:1},[p(x(t.title)+" ",1),t.img?(s(),a("img",{key:0,src:t.img,alt:t.title,class:"size-8 rounded inline-block"},null,8,Q)):u("",!0)],64))],2))),128))])):u("",!0),o.items.length===0?(s(),a("tbody",G,[l("tr",null,[l("td",{colspan:$.value},[l("div",P,[K(j,{class:"w-8 h-8"}),p(" "+x(o.noDataText),1)])],8,J)])])):u("",!0),l("tbody",null,[(s(!0),a(g,null,f(o.items,(t,c)=>(s(),a("tr",{key:c,class:b(`${C.value?"cursor-pointer":""} bg-white dark:bg-gray-800 ${N(c)?"":"border-b"} text-sm dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600`),onMouseover:r=>m("tr-mouseover",c),onMouseleave:r=>m("tr-mouseleave",c)},[o.selectable?(s(),a("td",W,[V(l("input",{"onUpdate:modelValue":n[1]||(n[1]=r=>y.value=r),type:"checkbox",class:"w-4 h-4 text-primary-800 bg-gray-100 border-gray-300 rounded focus:ring-primary-500 dark:focus:ring-primary-800 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",value:t[o.selectableKey]},null,8,X),[[_,y.value]])])):u("",!0),(s(!0),a(g,null,f(o.headers,(r,A)=>(s(),a("td",{key:r.key,class:b(`px-4 py-3 w-auto ${w(A)?"text-right":""} ${r.class?r.class:""} `),scope:"col",onClick:te=>C.value?m("tr-clicked",t,r):!1},[T(k)[r.key]?d(e.$slots,r.key,{key:0,item:t,index:c}):(s(),a(g,{key:1},[p(x(t[r.key]),1)],64))],10,Y))),128))],42,R))),128))]),S.value?(s(),a("tfoot",Z,[l("tr",null,[l("td",{class:"px-4 py-4",colspan:$.value},[d(e.$slots,"footer")],8,ee)])])):u("",!0)]),d(e.$slots,"bottom")],2))}}};export{ae as _};
