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