import{r,c as m,u as i}from"./framework.e8f655c8.js";import{s as z}from"./dom.1d8ecbf3.js";import{b as w}from"./index.8c202964.js";function M(v,g={},a={}){const p=a.pageSize||10,u=r(a.pageNum||1),l=r(p),d=m(()=>({[a.paramProps.page]:u.value,[a.paramProps.pageSize]:l.value,...i(g)}));a={...{immediate:!0,resultHandle(t){const{rows:e,total:P}=t.data;a.append?s.value=[...s.value,...e]:s.value=e,n.value=P},append:!1,paramProps:{page:"page",pageSize:"rows"}},...a};const n=r(0),s=r([]),o=r(!1),f=m(()=>Math.ceil(n.value/l.value)),h=m(()=>f.value>u.value);function c(t){o.value=!0,i(v)(d.value).then(e=>{a.resultHandle(e),w(t,e.data.rows)}).finally(()=>{o.value=!1,z(0)})}function S(t=p,e){u.value=1,l.value=t,c(e)}return a.immediate&&c(),{total:n,isLoading:o,search:c,refresh:S,pageNum:u,pageSize:l,tableData:s,pages:f,hasMore:h}}export{M as u};
