import{ao as h,aH as N,aI as b}from"./index-BTglIPU2.js?v=1773287522785";import{g as K}from"./data-BVsViUMm.js?v=1773287522785";import{p as R,at as $,ax as B}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{k as H,an as M,R as T,O as D,r as w,c as d,ar as E,e as I,a0 as y,w as m,$ as L,a8 as j,a9 as S,q as P,s as q,S as c,ao as F,N as J,n as O}from"./vue-core-DJjvd5ZC.js?v=1773287522785";const W=H({__name:"index",props:F({data:{default:()=>[]},rowKey:{default:"id"},loading:{type:Boolean,default:!1},loadingNum:{default:10},isPage:{type:Boolean,default:!1},maxHeight:{},columns:{default:()=>[]},rowProps:{},storeKey:{}},{page:{default:()=>({page:1,pageSize:10})},pageModifiers:{}}),emits:["update:page"],setup(v){const s=v,t=M(v,"page"),{t:x}=T(),{columns:z,data:g}=D(s),i=()=>R(J(z.value)),r=w(i()),u=i(),k=d(()=>{const{rowKey:e}=s;return h(e)?a=>a[e]:e}),p=d(()=>{const{storeKey:e}=s;return e?"".concat(e,"-page"):""}),l=w([]),f=E(),_=I({style:{width:"100%"},showSizePicker:!0,showQuickJumper:!0,pageSizes:[10,20,50,100],prefix:()=>{var e;return(e=f.pagePrefix)==null?void 0:e.call(f)},suffix:e=>y("span",{class:"text-13px text-default"},[x("Public.Table.Page.index_4",[e.itemCount])]),onChange:e=>{t.value.page=e},onUpdatePageSize:e=>{t.value.page=1,t.value.pageSize=e,p.value&&N(p.value,String(e))}});(()=>{if(p.value){const e=b(p.value);e&&(t.value.pageSize=K(e))}})();const C=d(()=>({..._,page:t.value.page,pageSize:t.value.pageSize}));return m(()=>g.value,e=>{s.loading||(l.value=e)},{deep:!0}),m(()=>s.loading,e=>{if(e){if(r.value.forEach(a=>{a.type!=="selection"&&(a.ellipsis&&delete a.ellipsis,a.render=()=>y(B,null,null))}),g.value.length===0)for(let a=0;a<s.loadingNum;a++){const o={},{rowKey:n}=s;o[h(n)?n:"id"]=a,l.value.push(o)}}else l.value=[],O(()=>{r.value.forEach((a,o)=>{if(a.type==="selection")return;const n=u[o];n.ellipsis&&(a.ellipsis=n.ellipsis),a.render=n.render}),l.value=g.value})},{immediate:!0}),m(()=>s.columns,()=>{r.value=i(),u.splice(0,u.length),u.push(...i())},{deep:!0}),(e,a)=>{const o=$;return L(),j(o,q(e.$attrs,{data:c(l),"max-height":e.maxHeight,"row-key":c(k),columns:c(r),pagination:e.isPage?c(C):!1,"row-props":e.rowProps}),{empty:S(()=>[P(e.$slots,"empty")]),default:S(()=>[P(e.$slots,"pagePrefix")]),_:3},16,["data","max-height","row-key","columns","pagination","row-props"])}}});export{W as _};
