mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-06 03:57:49 +08:00
2 lines
7.9 KiB
JavaScript
2 lines
7.9 KiB
JavaScript
import{a2 as U,X as z,Q as G,T as L,z as j,a3 as P}from"./hooks-DKN08swi.js";import{k as X}from"./utils-DMI3ftdH.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"./@logicflow_core@2.0.6-CHqfytjt.js";import"./mobx-preact@3.0.0_mobx@5.15.7_preact@10.22.0-q-IhwcFu.js";import"./preact@10.22.0-D1_UwAj3.js";import{N as D,c as n,ag as _,O as u,v as I,b as r,G as Q,L as F,aj as Y,I as q,n as H}from"./naive-ui@2.40.1_vue@3.5.13_typescript@5.6.3_-Bx4bEkBQ.js";import{l as W,b as e,I as o,F as K,p as Z}from"./@vue_runtime-core@3.5.13-BEg_yh4N.js";import{k as x,e as ee,x as te}from"./@vue_reactivity@3.5.13-Ch1DBDRK.js";import"./lodash-es@4.17.21-B-5kLwAl.js";import"./@vueuse_core@11.2.0_vue@3.5.13_typescript@5.6.3_-qLonknDl.js";import"./@vueuse_shared@11.2.0_vue@3.5.13_typescript@5.6.3_-C-DuMGMJ.js";import"./vue-hooks-plus@2.2.1_vue@3.5.13_typescript@5.6.3_-3eMKHOaU.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"./pinia-plugin-persistedstate@4.1.1_pinia@2.2.4_typescript@5.6.3_vue@3.5.13_typescript@5.6.3____yt6biirdeg4kqzievtaggbt2mm-_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.6.3_vue@3.5.13_typescript@5.6.3_-BSK3SS9R.js";import"./vue-demi@0.14.10_vue@3.5.13_typescript@5.6.3_-Dq6ymT-8.js";import"./html-to-image@1.11.11-BOFdlgi9.js";import"./vue-router@4.3.2_vue@3.5.13_typescript@5.6.3_-BP6RbFeK.js";import"./vue-i18n@9.13.1_vue@3.5.13_typescript@5.6.3_-B3N1nvv4.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.1-C65RY-Xl.js";import"./zrender@5.6.0-1zVsYK9t.js";import"./tslib@2.3.0-BDyQ-Jie.js";import"./@vue_runtime-dom@3.5.13-BO5HcqNg.js";import"./@vue_shared@3.5.13-Dh1pNJXy.js";import"./interactjs@1.10.26-DZL_TZzP.js";import"./mobx@5.15.7-CEMJDQot.js";import"./uuid@9.0.1-CQkTLCs1.js";import"./classnames@2.5.1-nUTIn1-D.js";import"./mousetrap@1.6.5-BTGDluHR.js";import"./mobx-utils@5.6.2_mobx@5.15.7-C1xBETkd.js";import"./date-fns@3.6.0-q9PkOyxq.js";import"./seemly@0.3.8-DjGKl9dV.js";import"./vueuc@0.4.64_vue@3.5.13_typescript@5.6.3_-BkAdx2tT.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_-BRDj2ZMK.js";import"./vooks@0.2.12_vue@3.5.13_typescript@5.6.3_-B9mUPMHL.js";import"./vdirs@0.1.8_vue@3.5.13_typescript@5.6.3_-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(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Object]"&&!Z(i)}const at=W({name:"TableView",setup(){const[i,{getTableInstance:c,clearFilters:p,clearSorter:m,scrollTo:f,filters:k,sort:C,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(I,{type:"info",bordered:!1,style:"margin-right: 6px"},N(d)?d:{default:()=>[d]}))},{title:"Remark",key:"remark"},{title:"Action",key:"actions",render:t=>e(n,{align:"center"},{default:()=>[e(u,{size:"tiny"},{default:()=>[o("查看")]}),e(P,{options:[{label:"编辑",key:"edit"},{label:"新增",key:"add"}],onSelect:a=>{window.$message.info(`当前选择: ${a}`)}},null)]})}],g=x([...b].map((t,a)=>({...t}))),s=x([]),w=[{label:"编辑",key:"edit"},{label:()=>e("span",{style:"color: red;"},[o("删除")]),key:"delete"}],E=ee({gridItemCount:4,gridCollapsedRows:1,tableLoading:!1}),[T,{checkedRowKeysBind:v,getKeys:R,getRows:l,clearKey:B,clearAll:A,selectKey:S}]=z(s,g,{rowKey:"key",onChange:(t,a,d)=>{}}),O=()=>{for(let t=0;t<10;t++)s.value.push({key:X(),name:t%2===0?"John Brown":"Jim Green",age:t+20,address:"New York No. 1 Lake Park",tags:["nice","developer"],remark:"我是一条很长很长的备注"})},M=t=>{window.$message.info(`${t}`)},V=()=>{const{key:t}=s.value[1];B(t)},$=()=>{s.value.map(a=>a.key).forEach(a=>S(a))},J=()=>{const{key:t}=s.value[1];S(t)};return O(),{...te(E),tableData:s,actionColumns:g,baseColumns:b,tableMenuOptions:w,menuSelect:M,register:i,getKeys:R,getRows:l,clearKey:B,clearAll:A,checkedRowKeysBind:v,checkedRowKeys:T,clearSecondIndexRow:V,selectAll:$,selectSecondIndexRow:J,clearFilters:p,clearSorter:m,scrollTo:f,filters:k,sort:C,downloadCsv:y,getTableInstance:c,print:h}},render(){let i;const{register:c,clearAll:p,checkedRowKeysBind:m,clearSecondIndexRow:f,selectAll:k,selectSecondIndexRow:C,clearFilters:y,clearSorter:h,scrollTo:b,filters:g,sort:s,downloadCsv:w,getTableInstance:E,getRows:T,getKeys:v,print:R}=this;return e(n,{vertical:!0},{default:()=>[e(D,{title:"RTable"},{default:()=>[o("基于 NDataTable 封装,继承该组件所有 props 属性。查看 RTable props 文件即可查看该组件拓展项")]}),e(D,{title:"useTable"},{default:()=>[e(n,{vertical:!0,style:"width: 100%"},{default:()=>[e(_,{title:"DataTable Methods",type:"info"},{default:()=>[o("其余的方法查看")," ",e("a",{style:"color: transparent",href:"https://www.naiveui.com/zh-CN/dark/components/data-table#DataTable-Methods"},[o("Naive UI")]),o("官网,保持一致。")]}),e(n,null,{default:()=>[e(u,{onClick:h.bind(this)},{default:()=>[o("清除所有排序")]}),e(u,{onClick:y.bind(this)},{default:()=>[o("清除所有过滤")]}),e(u,{onClick:()=>{w()}},{default:()=>[o("下载 CSV")]}),e(u,{onClick:()=>E()},{default:()=>[o("getTableInstance")]}),e(u,{onClick:()=>R()},{default:()=>[o("打印")]})]})]})]}),e(D,{title:"useCheckedRowKeys"},{default:()=>[e(n,{vertical:!0},{default:()=>[e(n,null,{default:()=>[e(u,{onClick:k.bind(this)},{default:()=>[o("选中所有行")]}),e(u,{onClick:p.bind(this)},{default:()=>[o("取消所有已选中行")]}),e(u,{onClick:C.bind(this)},{default:()=>[o("选中第二行")]}),e(u,{onClick:f.bind(this)},{default:()=>[o("取消第二行选中")]})]}),e(n,null,N(i=this.checkedRowKeys.map(l=>e(I,{type:"success",key:l},N(l)?l:{default:()=>[l]})))?i:{default:()=>[i]})]})]}),e(G,{collapsedRows:this.gridCollapsedRows,cols:this.gridItemCount,onUpdateOpen:l=>window.$message.info(`我是 RCollapse 组件${l?"收起":"展开"}的回调函数`)},{action:()=>e(K,null,[e(u,{type:"primary"},{default:()=>[o("搜索")]}),e(u,null,{default:()=>[o("重置")]})]),default:()=>e(K,null,[e(r,null,{default:()=>[e(Q,null,null)]}),e(r,null,{default:()=>[e(F,null,null)]}),e(r,null,{default:()=>[e(Y,{type:"datetimerange",clearable:!0},null)]}),e(r,null,{default:()=>[e(F,null,null)]}),e(r,null,{default:()=>[e(F,null,null)]})])}),e(L,{checkedRowKeys:this.checkedRowKeys,"onUpdate:checkedRowKeys":l=>this.checkedRowKeys=l,onUpdateCheckedRowKeys:m.bind(this),onRegister:c.bind(this),scrollX:1e3,title:e(n,{align:"center"},{default:()=>[e("span",null,[o("标题插槽:")]),e(q,{onUpdateValue:l=>this.tableLoading=l},null)]}),data:this.tableData,columns:this.actionColumns,"onUpdate:columns":l=>this.actionColumns=l,pagination:{pageSize:10},contextMenuOptions:this.tableMenuOptions,loading:this.tableLoading,onContextMenuClick:this.menuSelect.bind(this),toolOptions:[e(H,null,{trigger:()=>e(j,{name:"search",size:"18",cursor:"pointer",onClick:()=>{window.$message.info("点击了搜索按钮")}},null),default:()=>"我是自定义工具栏示例"})],rowKey:l=>l.key,striped:!0},{tableFooter:()=>"表格的底部内容区域插槽,有时候你可能会用上",tableAction:()=>"表格的操作区域内容插槽,有时候可能会用上"})]})}});export{at as default};
|