import{X as Z,Y as _,T as $,z as G,Z as Q,$ as W}from"./hooks-Bi_Q9OFa.js";import{m as ee}from"./utils-4asTneEs.js";import"./currency.js@2.0.4-9OAR_aOO.js";import"./crypto-js@4.2.0-CO3T8151.js";import"./print-js@1.6.0-CWwD-D0p.js";import{a as te}from"./vue-hooks-plus@2.2.1_vue@3.5.13_typescript@5.6.3_-BWv22OGL.js";import"./js-cookie@3.0.5-Z_8Sd105.js";import"./lodash@4.17.21-D1YkSij2.js";import"./screenfull@5.2.0-DQHhvod-.js";import"./jsbarcode@3.11.6-VhIBVAt6.js";import"./@logicflow_core@2.0.10-Dy_oAVRl.js";import"./mobx-preact@3.0.0_mobx@5.15.7_preact@10.25.4-CFsMsPXj.js";import"./preact@10.25.4--QYavupV.js";import"./instance-BbSLtO2c.js";import{M as O}from"./mockjs@1.1.0-C0u4TCrj.js";import{d as S}from"./dayjs@1.11.13-BI9XULUM.js";import{w as ae,ag as b,M as j,H as ue,ak as oe,e as f,P as m,N as U,I,al as z,an as T}from"./naive-ui@2.41.0_vue@3.5.13_typescript@5.6.3_-Pd0MfMWr.js";import{m as re,b as e,F as le,J as l,q as ie}from"./@vue_runtime-core@3.5.13-pPpmd6wL.js";import{k as p}from"./@vue_reactivity@3.5.13-CVvlldVq.js";import"./lodash-es@4.17.21-BbYRMHep.js";import"./@vueuse_core@12.4.0_typescript@5.6.3-DzjsbTKf.js";import"./@vueuse_shared@12.4.0_typescript@5.6.3-BcXCAzGo.js";import"./pinia-plugin-persistedstate@4.2.0_pinia@2.3.0_typescript@5.6.3_vue@3.5.13_typescript@5.6.3___rollup@4.30.1-7e9nenNP.js";import"./destr@2.0.3-Cx7WjB9q.js";import"./deep-pick-omit@1.2.1-B1UrSIxj.js";import"./pinia@2.3.0_typescript@5.6.3_vue@3.5.13_typescript@5.6.3_-D39uhmss.js";import"./html-to-image@1.11.11-D6_yziCT.js";import"./vue-router@4.4.0_vue@3.5.13_typescript@5.6.3_-Ddx7y29b.js";import"./@vue_runtime-dom@3.5.13-DJqlZTHq.js";import"./@vue_shared@3.5.13-CQ6Z-5d1.js";import"./interactjs@1.10.27-hUbPqkuo.js";import"./call-bind@1.0.7-BosuxZz1.js";import"./vue-i18n@9.13.1_vue@3.5.13_typescript@5.6.3_-DQlA9smo.js";import"./@intlify_shared@9.13.1-BxU0OzX2.js";import"./@intlify_core-base@9.13.1-CVxc1Bsn.js";import"./@intlify_message-compiler@9.13.1-GrLDMuy_.js";import"./echarts@5.6.0-Dq866SEH.js";import"./zrender@5.6.1-B_T0sHVE.js";import"./tslib@2.3.0-BDyQ-Jie.js";import"./mobx@5.15.7-BvNiR7Ki.js";import"./uuid@9.0.1-CtRu48qb.js";import"./classnames@2.5.1-BXd8anFz.js";import"./mousetrap@1.6.5-D2xAa-oQ.js";import"./mobx-utils@5.6.2_mobx@5.15.7-D4RSJWSh.js";import"./axios@1.7.9-upsvKRUO.js";import"./date-fns@3.6.0-CG906D2E.js";import"./seemly@0.3.9-BnJ6M8Cl.js";import"./vueuc@0.4.64_vue@3.5.13_typescript@5.6.3_-DZgPmxv3.js";import"./evtd@0.2.4-CI_DDEu_.js";import"./@css-render_vue3-ssr@0.15.14_vue@3.5.13_typescript@5.6.3_-DvmkD8RF.js";import"./vooks@0.2.12_vue@3.5.13_typescript@5.6.3_-rG9g4GjQ.js";import"./vdirs@0.1.8_vue@3.5.13_typescript@5.6.3_-C0KV5pCE.js";import"./@juggle_resize-observer@3.4.0-DY95s5UV.js";import"./css-render@0.15.14-BwokE0u2.js";import"./@emotion_hash@0.8.0-WldOFDRm.js";import"./treemate@0.3.11-CWtmm0QO.js";import"./date-fns-tz@3.2.0_date-fns@3.6.0-CULxTaQG.js";import"./async-validator@4.2.5-P8scd9xB.js";import"./@css-render_plugin-bem@0.15.14_css-render@0.15.14-BrMTnGYY.js";function se(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Object]"&&!ie(a)}const ft=re({name:"TableProDemo",setup(){const{format:a}=W(),[q,{runTableRequest:h,getCurrentTableRequestParams:E,print:v,downloadCsv:n}]=Z(),i=p([]),g=p([{type:"selection"},{title:"Name",key:"name"},{title:"Sign Status",key:"statusText"},{title:"Sign Time",key:"signTimeStart",render:u=>a(u.signTimeStart)+" ~ "+a(u.signTimeEnd)},{title:"Age",key:"age"},{title:"Address",key:"address"},{title:"Tags",key:"tags",render:u=>u.tags.map(o=>e(ae,{type:"info",bordered:!1,style:"margin-right: 6px"},se(o)?o:{default:()=>[o]}))},{title:"Remark",key:"remark"}]),y=p(0),D=p({}),k=p((()=>{const d=[],o=S().valueOf();for(let r=0;r<30;r++)d.push({key:ee(),name:O.Random.cname(),age:r+20,address:O.Random.city(),tags:["nice","developer"],remark:"我是一条很长很长的备注",status:r%2===0?"success":"error",statusText:r%2===0?"在线":"离线",signTimeStart:S(o).add(r*2,"year").valueOf(),signTimeEnd:S(o).add(r+5,"day").valueOf()});return d})()),w=p({pagination:!0,manual:!1}),[L,{checkedRowKeysBind:x,getKeys:F,getRows:P,clearKey:R,clearAll:t,selectKey:M}]=_(i,g,{rowKey:"key",onChange:(u,d,o)=>{}}),V=p(!0),C=u=>u==null,H=u=>new Promise(d=>{const{page:o=1,pageSize:r=10,name:A,status:K,signTimeStart:N,signTimeEnd:B}=u||{};let s=k.value;const Y=k.value.length;A&&(s=s.filter(c=>c.name.includes(A))),K&&(s=s.filter(c=>c.status===K)),N&&B&&(s=s.filter(c=>c.signTimeStart>=N&&c.signTimeEnd<=B)),s=s.slice((o-1)*r,o*r),setTimeout(()=>{d({code:0,data:s,total:C(K)&&C(A)&&(C(N)||C(B))?Y:s.length,message:"success",page:o,pageSize:r})},1e3)}),{run:J,loading:X}=te(H,{onSuccess:u=>{const{data:d,total:o}=u;i.value=d,y.value=o}});return{tableDataRef:i,baseColumns:g,itemCountRef:y,loadingGetPersonList:X,runGetPersonList:J,conditionRef:D,radioRef:w,runTableRequest:h,tableProRegister:q,print:v,downloadCsv:n,checkedRowKeysBind:x,checkedRowKeys:L,getKeys:F,getRows:P,clearKey:R,clearAll:t,collapseRef:V,selectKey:M}},render(){const{tableDataRef:a,baseColumns:q,itemCountRef:h,loadingGetPersonList:E,runGetPersonList:v,conditionRef:n,radioRef:i,runTableRequest:g,tableProRegister:y,print:D,downloadCsv:k,checkedRowKeysBind:w,getKeys:L,getRows:x,clearKey:F,clearAll:P,selectKey:R}=this;return e(f,{vertical:!0},{default:()=>[e($,{open:this.collapseRef,bordered:!0},{default:()=>e(le,null,[e(b,{label:"用户名"},{default:()=>[e(j,{value:n.name,"onUpdate:value":t=>n.name=t,clearable:!0},null)]}),e(b,{label:"状态"},{default:()=>[e(ue,{value:n.status,"onUpdate:value":t=>n.status=t,clearable:!0,options:[{label:"成功",value:"success"},{label:"失败",value:"error"}]},null)]}),e(b,{label:"登陆时间"},{default:()=>[e(oe,{type:"datetimerange",value:n.RangeTime,"onUpdate:value":t=>n.RangeTime=t,clearable:!0},null)]}),e(b,{label:"演示折叠的条件框"},{default:()=>[e(j,{readonly:!0,placeholder:"我只是为了占位"},null)]})]),action:()=>e(f,null,{default:()=>[e(m,{type:"primary",onClick:()=>g(),loading:E},{default:()=>[l("查询")]})]}),collapse:t=>t?e(m,{onClick:()=>this.collapseRef=!0,secondary:!0},{default:()=>"受控展开",icon:()=>e(G,{name:"dark",size:"18"},null)}):e(m,{onClick:()=>this.collapseRef=!1,secondary:!0},{default:()=>"受控收起",icon:()=>e(G,{name:"light",size:"18"},null)})}),e(U,{title:"常用高级拓展功能"},{default:()=>[e(f,null,{default:()=>[e(I,{label:"分页"},{default:()=>[e(z,{value:i.pagination,"onUpdate:value":t=>i.pagination=t},{default:()=>[e(T,{value:!0},{default:()=>[l("显示分页")]}),e(T,{value:!1},{default:()=>[l("隐藏分页")]})]})]}),e(I,{label:"自动更新"},{default:()=>[e(z,{value:i.manual,"onUpdate:value":t=>i.manual=t},{default:()=>[e(T,{value:!1},{default:()=>[l("自动更新")]}),e(T,{value:!0},{default:()=>[l("取消自动")]})]})]})]})]}),e(U,{title:"useTablePro 部分方法"},{default:()=>[e(f,null,{default:()=>[e(m,{type:"primary",onClick:()=>D()},{default:()=>[l("打印")]}),e(m,{type:"primary",onClick:()=>k()},{default:()=>[l("下载 csv")]})]})]}),e(U,{title:"useCheckedRowKeys 部分方法"},{default:()=>[e(f,null,{default:()=>[e(m,{type:"primary",onClick:()=>{const t=a[1].key;R(t)}},{default:()=>[l("选中第二行")]}),e(m,{type:"primary",onClick:()=>{const t=a[1].key;F(t)}},{default:()=>[l("取消选中第二行")]}),e(m,{type:"primary",onClick:()=>{a==null||a.forEach(t=>R(t.key))}},{default:()=>[l("选中当前页面所有行")]}),e(m,{type:"primary",onClick:()=>{P()}},{default:()=>[l("取消所有已选中行")]})]})]}),e(Q,{onRegister:y,data:a,columns:this.baseColumns,"onUpdate:columns":t=>this.baseColumns=t,loading:E,paginationCount:h,request:v,requestConfig:{params:n,formatRangeTime:[{key:"RangeTime",target:["signTimeStart","signTimeEnd"]}]},showPagination:i.pagination,manual:i.manual,rowKey:t=>t.key,checkedRowKeys:this.checkedRowKeys,"onUpdate:checkedRowKeys":t=>this.checkedRowKeys=t,onUpdateCheckedRowKeys:w},null)]})}});export{ft as default};