|
-import{S as d}from"./searchs.b637f0d6.js";import{d as y,e as h,a as z,r as m,B as v,bx as w,M as s,F as K,i as P,ci as b}from"./index.52190234.js";const x=y({name:"table-container",props:{page:{type:Number,default:1,required:!0},pageSize:{type:Number,default:10},pageTotal:{type:Number,default:0},saveKey:{type:String,default:""},sync:{type:Boolean,default:!1},checkedRowKeysRef:{type:Object},pageSizes:{type:Array,default:()=>[10,20,30,40]},pageSlot:{type:Number,default:9}},emits:["update:page","update:pageSize","list"],setup(e,{slots:T,attrs:k,emit:t}){const o=h(),p=z({pageInformation:null}),g=m(0);g.value=Math.ceil(e.pageTotal/e.pageSize);const l=a=>{t("update:page",a),t("list"),i()},r=a=>{t("update:page",1),t("update:pageSize",a),t("list"),i()};v(()=>{if(e.sync){const a=new d(e.saveKey||o.path),n=a.get(e.saveKey||o.path);if(p.pageInformation=n,n&&n.page){for(const u in n.page)if(n.page.hasOwnProperty(u)&&["page","pageSize"].includes(u)){const f=n.page[u],S=`update:${u}`;t(S,f)}}e.saveKey&&a.update(o.path,void 0,"bind")}window.addEventListener("watchStorage",c)}),w(()=>{window.removeEventListener("watchStorage",c)}),s(()=>e.pageSize,()=>{g.value=Math.ceil(e.pageTotal/e.pageSize),i()}),s(()=>e.page,()=>{i()}),s(()=>e.pageTotal,()=>{g.value=Math.ceil(e.pageTotal/e.pageSize),i()}),K({get(){return e.page},set(a){t("update:page",a)}});const i=()=>{e.sync&&new d(e.saveKey||o.path).update({page:e.page,pageCount:g.value,pageSize:e.pageSize,saveKey:e.saveKey},void 0,"page")},c=()=>{let a=p.pageInformation&&p.pageInformation.page?p.pageInformation.page:null;a&&a.page&&a.page};return()=>P(b,{style:{marginTop:"12px",justifyContent:"flex-end"},page:e.page,"onUpdate:page":a=>e.page=a,displayOrder:["quick-jumper","pages","size-picker"],pageCount:g.value,showQuickJumper:!0,showSizePicker:!0,pageSize:e.pageSize,prefix:()=>`\u5171 ${e.pageTotal} \u6761`,pageSizes:e.pageSizes,onUpdatePage:l,onUpdatePageSize:r,pageSlot:e.pageSlot},null)}});export{x as P};
|
|
|
|
|
|
+import{S as d}from"./searchs.b637f0d6.js";import{d as y,e as h,a as z,r as m,B as v,bx as w,M as s,F as K,i as P,ci as b}from"./index.e7f9cb6e.js";const x=y({name:"table-container",props:{page:{type:Number,default:1,required:!0},pageSize:{type:Number,default:10},pageTotal:{type:Number,default:0},saveKey:{type:String,default:""},sync:{type:Boolean,default:!1},checkedRowKeysRef:{type:Object},pageSizes:{type:Array,default:()=>[10,20,30,40]},pageSlot:{type:Number,default:9}},emits:["update:page","update:pageSize","list"],setup(e,{slots:T,attrs:k,emit:t}){const o=h(),p=z({pageInformation:null}),g=m(0);g.value=Math.ceil(e.pageTotal/e.pageSize);const l=a=>{t("update:page",a),t("list"),i()},r=a=>{t("update:page",1),t("update:pageSize",a),t("list"),i()};v(()=>{if(e.sync){const a=new d(e.saveKey||o.path),n=a.get(e.saveKey||o.path);if(p.pageInformation=n,n&&n.page){for(const u in n.page)if(n.page.hasOwnProperty(u)&&["page","pageSize"].includes(u)){const f=n.page[u],S=`update:${u}`;t(S,f)}}e.saveKey&&a.update(o.path,void 0,"bind")}window.addEventListener("watchStorage",c)}),w(()=>{window.removeEventListener("watchStorage",c)}),s(()=>e.pageSize,()=>{g.value=Math.ceil(e.pageTotal/e.pageSize),i()}),s(()=>e.page,()=>{i()}),s(()=>e.pageTotal,()=>{g.value=Math.ceil(e.pageTotal/e.pageSize),i()}),K({get(){return e.page},set(a){t("update:page",a)}});const i=()=>{e.sync&&new d(e.saveKey||o.path).update({page:e.page,pageCount:g.value,pageSize:e.pageSize,saveKey:e.saveKey},void 0,"page")},c=()=>{let a=p.pageInformation&&p.pageInformation.page?p.pageInformation.page:null;a&&a.page&&a.page};return()=>P(b,{style:{marginTop:"12px",justifyContent:"flex-end"},page:e.page,"onUpdate:page":a=>e.page=a,displayOrder:["quick-jumper","pages","size-picker"],pageCount:g.value,showQuickJumper:!0,showSizePicker:!0,pageSize:e.pageSize,prefix:()=>`\u5171 ${e.pageTotal} \u6761`,pageSizes:e.pageSizes,onUpdatePage:l,onUpdatePageSize:r,pageSlot:e.pageSlot},null)}});export{x as P};
|