mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-05 19:42:07 +08:00
2 lines
7.4 KiB
JavaScript
2 lines
7.4 KiB
JavaScript
import{U as B,V as D,I,J as S,r as K,W as A}from"./hooks-DtYdZWXJ.js";import{u as G}from"./utils-BmI4YPvf.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"./lodash-es@4.17.21-3YkgETI-.js";import"./@vueuse_core@10.9.0_vue@3.4.30-CHk58Nsj.js";import"./@vueuse_shared@10.9.0_vue@3.4.30-BTLxKjPf.js";import"./vue-hooks-plus@2.2.0_vue@3.4.30-DdMBTcyt.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@3.2.1_pinia@2.1.7-RV7uh3T-.js";import"./dom-to-image@2.6.0-DCOFUeQU.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-core@3.4.30-CrcfNDdL.js";import"./@vue_reactivity@3.4.30-DnhErqw9.js";import"./@vue_shared@3.4.30-Bev2jR-5.js";function h(u){return typeof u=="function"||Object.prototype.toString.call(u)==="[object Object]"&&!Vue.isVNode(u)}const ne=Vue.defineComponent({name:"TableView",setup(){const[u,{getTableInstance:l,clearFilters:r,clearSorter:i,scrollTo:d,filters:c,sort:s,downloadCsv:V,print:N}]=B(),p=[{type:"selection"},{title:"Name",key:"name",filterOptions:[{label:"John Brown",value:"John Brown"},{label:"Jim Green",value:"Jim Green"}],filter:(e,a)=>a.name.includes(e.toString())},{title:"Age",key:"age",sorter:(e,a)=>e.age-a.age},{title:"Address",key:"address"},{title:"Tags",key:"tags",render:e=>e.tags.map(n=>Vue.createVNode(naive.NTag,{type:"info",bordered:!1,style:"margin-right: 6px"},h(n)?n:{default:()=>[n]}))},{title:"Remark",key:"remark"},{title:"Action",key:"actions",render:e=>Vue.createVNode(naive.NFlex,{align:"center"},{default:()=>[Vue.createVNode(naive.NButton,{size:"tiny"},{default:()=>[Vue.createTextVNode("查看")]}),Vue.createVNode(A,{options:[{label:"编辑",key:"edit"},{label:"新增",key:"add"}],onSelect:a=>{window.$message.info(`当前选择: ${a}`)}},null)]})}],m=Vue.ref([...p].map((e,a)=>({...e}))),o=Vue.ref([]),f=[{label:"编辑",key:"edit"},{label:()=>Vue.createVNode("span",{style:"color: red;"},[Vue.createTextVNode("删除")]),key:"delete"}],v=Vue.reactive({gridItemCount:4,gridCollapsedRows:1,tableLoading:!1}),[k,{checkedRowKeysBind:y,getKeys:C,getRows:t,clearKey:b,clearAll:w,selectKey:g}]=D(o,m,{rowKey:"key",onChange:(e,a,n)=>{}}),T=()=>{for(let e=0;e<10;e++)o.value.push({key:G(),name:e%2===0?"John Brown":"Jim Green",age:e+20,address:"New York No. 1 Lake Park",tags:["nice","developer"],remark:"我是一条很长很长的备注"})},x=e=>{window.$message.info(`${e}`)},F=()=>{const{key:e}=o.value[1];b(e)},E=()=>{o.value.map(a=>a.key).forEach(a=>g(a))},R=()=>{const{key:e}=o.value[1];g(e)};return T(),{...Vue.toRefs(v),tableData:o,actionColumns:m,baseColumns:p,tableMenuOptions:f,menuSelect:x,register:u,getKeys:C,getRows:t,clearKey:b,clearAll:w,checkedRowKeysBind:y,checkedRowKeys:k,clearSecondIndexRow:F,selectAll:E,selectSecondIndexRow:R,clearFilters:r,clearSorter:i,scrollTo:d,filters:c,sort:s,downloadCsv:V,getTableInstance:l,print:N}},render(){let u;const{register:l,clearAll:r,checkedRowKeysBind:i,clearSecondIndexRow:d,selectAll:c,selectSecondIndexRow:s,clearFilters:V,clearSorter:N,scrollTo:p,filters:m,sort:o,downloadCsv:f,getTableInstance:v,getRows:k,getKeys:y,print:C}=this;return Vue.createVNode(naive.NFlex,{vertical:!0},{default:()=>[Vue.createVNode(naive.NCard,{title:"RTable"},{default:()=>[Vue.createTextVNode("基于 NDataTable 封装,继承该组件所有 props 属性。查看 RTable props 文件即可查看该组件拓展项")]}),Vue.createVNode(naive.NCard,{title:"useTable"},{default:()=>[Vue.createVNode(naive.NFlex,{vertical:!0,style:"width: 100%"},{default:()=>[Vue.createVNode(naive.NAlert,{title:"DataTable Methods",type:"info"},{default:()=>[Vue.createTextVNode("其余的方法查看")," ",Vue.createVNode("a",{style:"color: transparent",href:"https://www.naiveui.com/zh-CN/dark/components/data-table#DataTable-Methods"},[Vue.createTextVNode("Naive UI")]),Vue.createTextVNode("官网,保持一致。")]}),Vue.createVNode(naive.NFlex,null,{default:()=>[Vue.createVNode(naive.NButton,{onClick:N.bind(this)},{default:()=>[Vue.createTextVNode("清除所有排序")]}),Vue.createVNode(naive.NButton,{onClick:V.bind(this)},{default:()=>[Vue.createTextVNode("清除所有过滤")]}),Vue.createVNode(naive.NButton,{onClick:()=>{f()}},{default:()=>[Vue.createTextVNode("下载 CSV")]}),Vue.createVNode(naive.NButton,{onClick:v.bind(this)},{default:()=>[Vue.createTextVNode("getTableInstance")]}),Vue.createVNode(naive.NButton,{onClick:C.bind(this)},{default:()=>[Vue.createTextVNode("打印")]})]})]})]}),Vue.createVNode(naive.NCard,{title:"useCheckedRowKeys"},{default:()=>[Vue.createVNode(naive.NFlex,{vertical:!0},{default:()=>[Vue.createVNode(naive.NFlex,null,{default:()=>[Vue.createVNode(naive.NButton,{onClick:c.bind(this)},{default:()=>[Vue.createTextVNode("选中所有行")]}),Vue.createVNode(naive.NButton,{onClick:r.bind(this)},{default:()=>[Vue.createTextVNode("取消所有已选中行")]}),Vue.createVNode(naive.NButton,{onClick:s.bind(this)},{default:()=>[Vue.createTextVNode("选中第二行")]}),Vue.createVNode(naive.NButton,{onClick:d.bind(this)},{default:()=>[Vue.createTextVNode("取消第二行选中")]})]}),Vue.createVNode(naive.NFlex,null,h(u=this.checkedRowKeys.map(t=>Vue.createVNode(naive.NTag,{type:"success",key:t},h(t)?t:{default:()=>[t]})))?u:{default:()=>[u]})]})]}),Vue.createVNode(I,{bordered:!1,collapsedRows:this.gridCollapsedRows,cols:this.gridItemCount,onUpdateValue:t=>window.$message.info(`我是 RCollapseGrid 组件${t?"收起":"展开"}的回调函数`)},{action:()=>Vue.createVNode(Vue.Fragment,null,[Vue.createVNode(naive.NButton,{type:"primary"},{default:()=>[Vue.createTextVNode("搜索")]}),Vue.createVNode(naive.NButton,null,{default:()=>[Vue.createTextVNode("重置")]})]),default:()=>Vue.createVNode(Vue.Fragment,null,[Vue.createVNode(naive.NGridItem,null,{default:()=>[Vue.createVNode(naive.NSelect,null,null)]}),Vue.createVNode(naive.NGridItem,null,{default:()=>[Vue.createVNode(naive.NInput,null,null)]}),Vue.createVNode(naive.NGridItem,null,{default:()=>[Vue.createVNode(naive.NDatePicker,{type:"datetimerange",clearable:!0},null)]}),Vue.createVNode(naive.NGridItem,null,{default:()=>[Vue.createVNode(naive.NInput,null,null)]}),Vue.createVNode(naive.NGridItem,null,{default:()=>[Vue.createVNode(naive.NInput,null,null)]})])}),Vue.createVNode(S,{checkedRowKeys:this.checkedRowKeys,"onUpdate:checkedRowKeys":t=>this.checkedRowKeys=t,onUpdateCheckedRowKeys:i.bind(this),onRegister:l.bind(this),scrollX:1e3,title:Vue.createVNode(naive.NFlex,{align:"center"},{default:()=>[Vue.createVNode("span",null,[Vue.createTextVNode("标题插槽:")]),Vue.createVNode(naive.NSwitch,{onUpdateValue:t=>this.tableLoading=t},null)]}),data:this.tableData,columns:this.actionColumns,"onUpdate:columns":t=>this.actionColumns=t,pagination:{pageSize:10},contextMenuOptions:this.tableMenuOptions,loading:this.tableLoading,onContextMenuClick:this.menuSelect.bind(this),toolOptions:[Vue.createVNode(naive.NPopover,null,{trigger:()=>Vue.createVNode(K,{name:"search",size:"18",cursor:"pointer",onClick:()=>{window.$message.info("点击了搜索按钮")}},null),default:()=>"我是自定义工具栏示例"})],rowKey:t=>t.key,striped:!0},{tableFooter:()=>"表格的底部内容区域插槽,有时候你可能会用上",tableAction:()=>"表格的操作区域内容插槽,有时候可能会用上"})]})}});export{ne as default};
|