ray-template/js/index-DPtaassS.js

2 lines
7.3 KiB
JavaScript

import{Y as U,Q as j,J as z,K as G,t as L,Z as P}from"./hooks-c8QJeqZl.js";import{j as Y}from"./utils-BvBR3SlX.js";import"./currency.js@2.0.4-9OAR_aOO.js";import"./dayjs@1.11.10-C8LoRVP6.js";import"./print-js@1.6.0-BdoEj60G.js";import"./jsbarcode@3.11.6-DGNGFp02.js";import{N as D,c as i,ae as _,P as u,v as S,b as r,H,T as F,ai as Q,K as X,n as Z}from"./naive-ui@2.40.1_vue@3.5.12-S0J9kMkU.js";import{l as q,b as e,I as l,F as I,p as W}from"./@vue_runtime-core@3.5.12-Ds-HrVrM.js";import{k as x,e as ee,x as te}from"./@vue_reactivity@3.5.12-Bs6EYLxJ.js";import"./lodash-es@4.17.21-CeZG2a4n.js";import"./@vueuse_core@11.1.0_vue@3.5.12-C00EZtgk.js";import"./@vueuse_shared@11.1.0_vue@3.5.12-B9WpRTpD.js";import"./vue-hooks-plus@2.2.1_vue@3.5.12-C6aYKqdf.js";import"./lodash@4.17.21-Cw59kuJw.js";import"./call-bind@1.0.7-Cpj98o6Y.js";import"./js-cookie@3.0.5-Z_8Sd105.js";import"./screenfull@5.2.0-DmMZCkhi.js";import"./interactjs@1.10.26-DZL_TZzP.js";import"./pinia-plugin-persistedstate@4.1.1_pinia@2.2.4-_Zka_ujQ.js";import"./destr@2.0.3-CVtkxrq9.js";import"./deep-pick-omit@1.2.1-CegYQlcN.js";import"./pinia@2.2.4_typescript@5.2.2_vue@3.5.12-DjAImzYl.js";import"./vue-demi@0.14.10_vue@3.5.12-Dq6ymT-8.js";import"./html-to-image@1.11.11-BOFdlgi9.js";import"./vue-router@4.3.2_vue@3.5.12-DrIOQ45i.js";import"./vue-i18n@9.13.1_vue@3.5.12-DJkg4ac8.js";import"./@intlify_shared@9.13.1-BxU0OzX2.js";import"./@intlify_core-base@9.13.1-C6DqbPB6.js";import"./@intlify_message-compiler@9.13.1-GrLDMuy_.js";import"./echarts@5.5.0-CezqL3m-.js";import"./zrender@5.5.0-DW8ownf1.js";import"./tslib@2.3.0-BDyQ-Jie.js";import"./@vue_runtime-dom@3.5.12-ewSD1rNh.js";import"./@vue_shared@3.5.12--5_uv9t5.js";import"./date-fns@3.6.0-q9PkOyxq.js";import"./seemly@0.3.8-DjGKl9dV.js";import"./vueuc@0.4.64_vue@3.5.12-gFk5c7Fb.js";import"./evtd@0.2.4-CI_DDEu_.js";import"./@css-render_vue3-ssr@0.15.14_vue@3.5.12-CJ-8xq3W.js";import"./vooks@0.2.12_vue@3.5.12-CeQQlSXI.js";import"./vdirs@0.1.8_vue@3.5.12-C0KV5pCE.js";import"./@juggle_resize-observer@3.4.0-C8OzoCMD.js";import"./css-render@0.15.14-C5toWlUr.js";import"./@emotion_hash@0.8.0-WldOFDRm.js";import"./treemate@0.3.11-DKekKYbv.js";import"./date-fns-tz@3.1.3_date-fns@3.6.0-ztskLDQQ.js";import"./async-validator@4.2.5-DKvM95Vc.js";import"./@css-render_plugin-bem@0.15.14_css-render@0.15.14-Be8eOoM-.js";function N(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!W(n)}const Xe=q({name:"TableView",setup(){const[n,{getTableInstance:c,clearFilters:p,clearSorter:m,scrollTo:f,filters:C,sort:k,downloadCsv:y,print:h}]=U(),b=[{type:"selection"},{title:"Name",key:"name",filterOptions:[{label:"John Brown",value:"John Brown"},{label:"Jim Green",value:"Jim Green"}],filter:(t,a)=>a.name.includes(t.toString())},{title:"Age",key:"age",sorter:(t,a)=>t.age-a.age},{title:"Address",key:"address"},{title:"Tags",key:"tags",render:t=>t.tags.map(d=>e(S,{type:"info",bordered:!1,style:"margin-right: 6px"},N(d)?d:{default:()=>[d]}))},{title:"Remark",key:"remark"},{title:"Action",key:"actions",render:t=>e(i,{align:"center"},{default:()=>[e(u,{size:"tiny"},{default:()=>[l("查看")]}),e(P,{options:[{label:"编辑",key:"edit"},{label:"新增",key:"add"}],onSelect:a=>{window.$message.info(`当前选择: ${a}`)}},null)]})}],w=x([...b].map((t,a)=>({...t}))),s=x([]),g=[{label:"编辑",key:"edit"},{label:()=>e("span",{style:"color: red;"},[l("删除")]),key:"delete"}],E=ee({gridItemCount:4,gridCollapsedRows:1,tableLoading:!1}),[T,{checkedRowKeysBind:v,getKeys:R,getRows:o,clearKey:B,clearAll:A,selectKey:K}]=j(s,w,{rowKey:"key",onChange:(t,a,d)=>{}}),O=()=>{for(let t=0;t<10;t++)s.value.push({key:Y(),name:t%2===0?"John Brown":"Jim Green",age:t+20,address:"New York No. 1 Lake Park",tags:["nice","developer"],remark:"我是一条很长很长的备注"})},J=t=>{window.$message.info(`${t}`)},M=()=>{const{key:t}=s.value[1];B(t)},V=()=>{s.value.map(a=>a.key).forEach(a=>K(a))},$=()=>{const{key:t}=s.value[1];K(t)};return O(),{...te(E),tableData:s,actionColumns:w,baseColumns:b,tableMenuOptions:g,menuSelect:J,register:n,getKeys:R,getRows:o,clearKey:B,clearAll:A,checkedRowKeysBind:v,checkedRowKeys:T,clearSecondIndexRow:M,selectAll:V,selectSecondIndexRow:$,clearFilters:p,clearSorter:m,scrollTo:f,filters:C,sort:k,downloadCsv:y,getTableInstance:c,print:h}},render(){let n;const{register:c,clearAll:p,checkedRowKeysBind:m,clearSecondIndexRow:f,selectAll:C,selectSecondIndexRow:k,clearFilters:y,clearSorter:h,scrollTo:b,filters:w,sort:s,downloadCsv:g,getTableInstance:E,getRows:T,getKeys:v,print:R}=this;return e(i,{vertical:!0},{default:()=>[e(D,{title:"RTable"},{default:()=>[l("基于 NDataTable 封装,继承该组件所有 props 属性。查看 RTable props 文件即可查看该组件拓展项")]}),e(D,{title:"useTable"},{default:()=>[e(i,{vertical:!0,style:"width: 100%"},{default:()=>[e(_,{title:"DataTable Methods",type:"info"},{default:()=>[l("其余的方法查看")," ",e("a",{style:"color: transparent",href:"https://www.naiveui.com/zh-CN/dark/components/data-table#DataTable-Methods"},[l("Naive UI")]),l("官网,保持一致。")]}),e(i,null,{default:()=>[e(u,{onClick:h.bind(this)},{default:()=>[l("清除所有排序")]}),e(u,{onClick:y.bind(this)},{default:()=>[l("清除所有过滤")]}),e(u,{onClick:()=>{g()}},{default:()=>[l("下载 CSV")]}),e(u,{onClick:()=>E()},{default:()=>[l("getTableInstance")]}),e(u,{onClick:()=>R()},{default:()=>[l("打印")]})]})]})]}),e(D,{title:"useCheckedRowKeys"},{default:()=>[e(i,{vertical:!0},{default:()=>[e(i,null,{default:()=>[e(u,{onClick:C.bind(this)},{default:()=>[l("选中所有行")]}),e(u,{onClick:p.bind(this)},{default:()=>[l("取消所有已选中行")]}),e(u,{onClick:k.bind(this)},{default:()=>[l("选中第二行")]}),e(u,{onClick:f.bind(this)},{default:()=>[l("取消第二行选中")]})]}),e(i,null,N(n=this.checkedRowKeys.map(o=>e(S,{type:"success",key:o},N(o)?o:{default:()=>[o]})))?n:{default:()=>[n]})]})]}),e(z,{collapsedRows:this.gridCollapsedRows,cols:this.gridItemCount,onUpdateOpen:o=>window.$message.info(`我是 RCollapse 组件${o?"收起":"展开"}的回调函数`)},{action:()=>e(I,null,[e(u,{type:"primary"},{default:()=>[l("搜索")]}),e(u,null,{default:()=>[l("重置")]})]),default:()=>e(I,null,[e(r,null,{default:()=>[e(H,null,null)]}),e(r,null,{default:()=>[e(F,null,null)]}),e(r,null,{default:()=>[e(Q,{type:"datetimerange",clearable:!0},null)]}),e(r,null,{default:()=>[e(F,null,null)]}),e(r,null,{default:()=>[e(F,null,null)]})])}),e(G,{checkedRowKeys:this.checkedRowKeys,"onUpdate:checkedRowKeys":o=>this.checkedRowKeys=o,onUpdateCheckedRowKeys:m.bind(this),onRegister:c.bind(this),scrollX:1e3,title:e(i,{align:"center"},{default:()=>[e("span",null,[l("标题插槽:")]),e(X,{onUpdateValue:o=>this.tableLoading=o},null)]}),data:this.tableData,columns:this.actionColumns,"onUpdate:columns":o=>this.actionColumns=o,pagination:{pageSize:10},contextMenuOptions:this.tableMenuOptions,loading:this.tableLoading,onContextMenuClick:this.menuSelect.bind(this),toolOptions:[e(Z,null,{trigger:()=>e(L,{name:"search",size:"18",cursor:"pointer",onClick:()=>{window.$message.info("点击了搜索按钮")}},null),default:()=>"我是自定义工具栏示例"})],rowKey:o=>o.key,striped:!0},{tableFooter:()=>"表格的底部内容区域插槽,有时候你可能会用上",tableAction:()=>"表格的操作区域内容插槽,有时候可能会用上"})]})}});export{Xe as default};