
/**
 * 由 Fantastic-admin 提供技术支持
 * Powered by Fantastic-admin
 * https://fantastic-admin.hurui.me
 */
  
import{B as e,C as t,Ct as n,Tt as r,bt as i}from"./reactivity.esm-bundler-D9OPVc9J.js";import{D as a,_ as o,b as s,bt as c,ct as l,g as u,mt as d,o as f,xt as p,y as m}from"./runtime-core.esm-bundler-D-xeQwTN.js";import{C as h,m as g}from"./runtime-dom.esm-bundler-Dnva3vcP.js";import{t as _}from"./_plugin-vue_export-helper-B3ysoDQm-BDNMzG2s.js";import{t as v}from"./Shape-Dmh9jBFh-B2aZ5PK0.js";import{n as y}from"./BaseIcon-DJbOzCDs-C4GBSsnJ.js";var b={class:`vue-ui-data-table`},x={style:{display:`flex`,"align-items":`center`,"justify-content":`flex-end`,"padding-right":`3px`,gap:`3px`}},S={style:{width:`12px`,height:`12px`}},C={key:0,height:`12`,width:`12`,viewBox:`0 0 20 20`,style:{background:`none`}},w=[`fill`],T=[`data-cell`],E={dir:`auto`,style:{display:`flex`,"align-items":`center`,gap:`5px`,"justify-content":`flex-end`,width:`100%`,"padding-right":`3px`}},D={key:0,height:`12`,width:`12`,viewBox:`0 0 20 20`,style:{background:`none`,overflow:`visible`}},O=_({__name:`DataTable`,props:{colNames:{type:Array,default(){return[]}},head:Array,body:Array,title:String,config:Object,withCloseButton:{type:Boolean,default:!0},isCursorPointer:{type:Boolean,default:!1}},emits:[`close`],setup(_,{emit:O}){g(t=>({v7ded12c6:e(F)}));let k=_,{backgroundColor:A,color:j,outline:M}=k.config.th,{backgroundColor:N,color:P,outline:F}=k.config.td,I=u(()=>k.config.breakpoint),L=t(null),R=t(!1);l(()=>{let e=new ResizeObserver(e=>{e.forEach(e=>{R.value=e.contentRect.width<I.value})});L.value&&e.observe(L.value)});let z=O;return(t,l)=>(d(),s(`div`,{ref_key:`tableContainer`,ref:L,style:n(`width: 100%; container-type: inline-size; position:relative;${_.withCloseButton?`padding-top: 36px;`:``}overflow:auto`),class:i({"atom-data-table":!0,"vue-ui-responsive":R.value})},[_.withCloseButton?(d(),s(`div`,{key:0,"data-dom-to-png-ignore":``,role:`button`,tabindex:`0`,style:n(`width:32px; position: absolute; top: 0; right:4px; padding: 0 0px; display: flex; align-items:center;justify-content:center;height: 36px; width: 32px; cursor:${_.isCursorPointer?`pointer`:`default`}; background:${e(A)};`),onClick:l[0]||(l[0]=e=>z(`close`)),onKeypress:l[1]||(l[1]=h(e=>z(`close`),[`enter`]))},[a(y,{name:`close`,stroke:e(j),"stroke-width":2},null,8,[`stroke`])],36)):m(``,!0),o(`table`,b,[o(`caption`,{style:n({backgroundColor:e(A),color:e(j),outline:e(M)}),class:`vue-ui-data-table__caption`},r(_.title),5),o(`thead`,null,[o(`tr`,{role:`row`,style:n([{"font-variant-numeric":`tabular-nums`},{backgroundColor:e(A),color:e(j)}]),class:`vue-ui-data-table__thead-row`},[(d(!0),s(f,null,c(_.head,(r,i)=>(d(),s(`th`,{role:`cell`,style:n({outline:e(M)}),key:`th_${i}`},[o(`div`,x,[o(`div`,S,[r?.color?(d(),s(`svg`,C,[o(`circle`,{cx:`10`,cy:`10`,r:`10`,fill:r.color},null,8,w)])):m(``,!0)]),p(t.$slots,`th`,{th:r},void 0,!0)])],4))),128))],4)]),o(`tbody`,null,[(d(!0),s(f,null,c(_.body,(r,l)=>(d(),s(`tr`,{role:`row`,style:n([{"font-variant-numeric":`tabular-nums`},{backgroundColor:e(N),color:e(P)}]),class:i({"vue-ui-data-table__tbody__row":!0,"vue-ui-data-table__tbody__row-even":l%2==0,"vue-ui-data-table__tbody__row-odd":l%2!=0})},[(d(!0),s(f,null,c(r,(r,i)=>(d(),s(`td`,{role:`cell`,"data-cell":(_.colNames[i]&&_.colNames[i].name?_.colNames[i].name:``)||_.colNames[i]||``,style:n({outline:e(F)}),class:`vue-ui-data-table__tbody__td`},[o(`div`,E,[r?.color?(d(),s(`svg`,D,[a(v,{plot:{x:10,y:10},color:r.color,radius:9,shape:_.config.shape||r.shape||`circle`},null,8,[`color`,`shape`])])):m(``,!0),p(t.$slots,`td`,{td:r},void 0,!0)])],12,T))),256))],6))),256))])])],6))}},[[`__scopeId`,`data-v-c3927505`]]);export{O as default};