"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("lodash-unified"),n=require("vue");require("../../utils/index.js");const f=require("../../utils/is.js"),g=e=>{const u=n.ref(e.pagination&&e.pagination.defaultCurrent||1),o=n.ref(e.pagination&&e.pagination.defaultPageSize||10);function r(t,i){u.value=t,o.value=i}n.watch(()=>e.dataSource,t=>{if(!t?.length)return;const i=Math.max(Math.ceil(t.length/o.value),1);console.log(i,u.value),i<u.value&&r(i,o.value)},{deep:1});const l=n.computed(()=>e.dataSource?e.pagination===!1?[...e.dataSource]:e.dataSource.slice((n.unref(u)-1)*n.unref(o),n.unref(u)*n.unref(o)):[]);return{pagination:n.computed(()=>{const{showLessItems:t,showSizeChanger:i,showQuickJumper:a,pageSizeOptions:c}=e.pagination||{};return{current:n.unref(u),pageSize:n.unref(o),total:e.dataSource?.length||0,showSizeChanger:f.isDef(i)?i:!t,showQuickJumper:f.isDef(a)?a:!t,showLessItems:t,size:"default",pageSizeOptions:s.isUndefined(c)?["10","20","50","100"]:c}}),dataSource:l,onChange:r}};exports.useOfflineList=g;
