ray-template/js/index-BPAe6vWH.js

2 lines
6.9 KiB
JavaScript

import{Q as T,U as B,H as D,I,t as S,V as K}from"./hooks-DxjADXf2.js";import"./dayjs@1.11.10-BYZwCyGy.js";import"./print-js@1.6.0-C3lAJnMa.js";import{u as G}from"./utils-XwSDXJUe.js";import"./currency.js@2.0.4-9OAR_aOO.js";import"./awesome-qr@2.1.5-rc.0-Ds7AaOTE.js";import"./lodash-es@4.17.21-Dos9GOhk.js";import"./@vueuse_core@10.9.0_vue@3.4.26-BxvIaqQO.js";import"./@vueuse_shared@10.9.0_vue@3.4.26-7aSumFzu.js";import"./vue-hooks-plus@1.9.0_vue@3.4.26-C_BRgauB.js";import"./lodash@4.17.21-CM7ROh5r.js";import"./js-cookie@3.0.5-Z_8Sd105.js";import"./screenfull@5.2.0-DuGDi0R7.js";import"./interactjs@1.10.26-DmsZVOf4.js";import"./pinia-plugin-persistedstate@3.2.1_pinia@2.1.7-RV7uh3T-.js";import"./dom-to-image@2.6.0-CaeIWam-.js";import"./echarts@5.5.0-BEyY33Zi.js";import"./zrender@5.5.0-JN1hODMT.js";import"./tslib@2.3.0-BDyQ-Jie.js";import"./@vue_runtime-core@3.4.26-Cq5aFJKF.js";import"./@vue_reactivity@3.4.26-DTbxPGxS.js";import"./@vue_shared@3.4.26-DWpY0PUk.js";import"./canvas@2.11.2-CVRTzJty.js";import"./js-binary-schema-parser@2.0.3-D0akQrQ7.js";function p(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:m,clearFilters:r,clearSorter:i,scrollTo:d,filters:c,sort:s,downloadCsv:V}]=T(),l=[{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"},p(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(K,{options:[{label:"编辑",key:"edit"},{label:"新增",key:"add"}],onSelect:a=>{window.$message.info(`当前选择: ${a}`)}},null)]})}],f=Vue.ref([...l].map((e,a)=>({...e}))),o=Vue.ref([]),C=[{label:"编辑",key:"edit"},{label:()=>Vue.createVNode("span",{style:"color: red;"},[Vue.createTextVNode("删除")]),key:"delete"}],N=Vue.reactive({gridItemCount:4,gridCollapsedRows:1,tableLoading:!1}),[t,{checkedRowKeysBind:y,getKeys:g,getRows:h,clearKey:v,clearAll:b,selectKey:k}]=B(o,{rowKey:"key",onChange:(e,a,n)=>{}}),w=()=>{for(let e=0;e<20;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:"我是一条很长很长的备注"})},E=e=>{window.$message.info(`${e}`)},F=()=>{const{key:e}=o.value[1];v(e)},x=()=>{o.value.map(a=>a.key).forEach(a=>k(a))},R=()=>{const{key:e}=o.value[1];k(e)};return w(),{...Vue.toRefs(N),tableData:o,actionColumns:f,baseColumns:l,tableMenuOptions:C,menuSelect:E,register:u,getKeys:g,getRows:h,clearKey:v,clearAll:b,checkedRowKeysBind:y,checkedRowKeys:t,clearSecondIndexRow:F,selectAll:x,selectSecondIndexRow:R,clearFilters:r,clearSorter:i,scrollTo:d,filters:c,sort:s,downloadCsv:V}},render(){let u;const{register:m,clearAll:r,checkedRowKeysBind:i,clearSecondIndexRow:d,selectAll:c,selectSecondIndexRow:s,clearFilters:V,clearSorter:l,scrollTo:f,filters:o,sort:C,downloadCsv:N}=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,{align:"center"},{default:()=>[Vue.createVNode(naive.NButton,{onClick:l.bind(this)},{default:()=>[Vue.createTextVNode("清除所有排序")]}),Vue.createVNode(naive.NButton,{onClick:V.bind(this)},{default:()=>[Vue.createTextVNode("清除所有过滤")]}),Vue.createVNode(naive.NButton,{onClick:()=>{N()}},{default:()=>[Vue.createTextVNode("下载 CSV")]}),Vue.createVNode("div",null,[Vue.createTextVNode("其余的方法查看 Naive UI 官网,保持一致。")])]})]}),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,p(u=this.checkedRowKeys.map(t=>Vue.createVNode(naive.NTag,{type:"success",key:t},p(t)?t:{default:()=>[t]})))?u:{default:()=>[u]})]})]}),Vue.createVNode(D,{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(I,{checkedRowKeys:this.checkedRowKeys,"onUpdate:checkedRowKeys":t=>this.checkedRowKeys=t,onUpdateCheckedRowKeys:i.bind(this),onRegister:m.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(S,{name:"search",size:"18",cursor:"pointer",onClick:()=>{window.$message.info("点击了搜索按钮")}},null),default:()=>"我是自定义工具栏示例"})],rowKey:t=>t.key,striped:!0},{tableFooter:()=>"表格的底部内容区域插槽,有时候你可能会用上",tableAction:()=>"表格的操作区域内容插槽,有时候可能会用上"})]})}});export{ne as default};