mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-09 01:47:20 +08:00
2 lines
4.4 KiB
JavaScript
2 lines
4.4 KiB
JavaScript
import{m,d as f}from"./index-8c77f9cd.js";import{a as _,d as x,b as w,c}from"./index-f2c12fe6.js";import"./_commonjsHelpers-042e6b4d.js";import"./hot-cf4dcfeb.js";import"./index-5e5694dd.js";import"./multiTags-d9cd5aad.js";import"./index-4b83e049.js";import"./index-2b23ea72.js";const h=Vue.defineComponent({name:"ReTreeLine",props:{node:{type:Object,required:!0},data:{type:Array,default:()=>{}},treeData:{type:Array,default:()=>[]},indent:{type:Number,default:16},showLabelLine:{type:Boolean,default:!0}},setup(u,r){const{slots:o}=r;return{getScopedSlot:t=>{if(!t)return null;const a=t.split("||");let e=null;for(let n=0;n<a.length;n++){const s=a[n];e=(o||{})[s]}return e},getSlotValue:(t,a,e=null)=>m(t)?t(a)||e:t||e}},render(){const u=this.getScopedSlot("default"),r=this.getScopedSlot("node-label"),o=this.getScopedSlot("after-node-label"),i=u?this.getSlotValue(u,{node:this.node,data:this.data}):[r?this.getSlotValue(r,{node:this.node,data:this.data}):Vue.h("span",{class:"element-tree-node-label"},this.node.label),this.showLabelLine?Vue.h("span",{class:"element-tree-node-label-line"}):null,this.getSlotValue(o,{node:this.node,data:this.data})],l=[];let t=this.node;for(;t;){let e=t.parent;if(t.level===1&&!t.parent){if(!this.treeData||!Array.isArray(this.treeData))throw Error("if you using el-tree-v2 (Virtualized Tree) of element-plus,element-tree-line required data.");e={children:Array.isArray(this.treeData)?this.treeData.map(n=>({...n,key:n.id})):[],level:0,key:"node-0",parent:null}}if(e){const n=(e.children||e.childNodes).findIndex(s=>(s.key||s.id)===(t.key||t.id));l.unshift(n===(e.children||e.childNodes).length-1)}t=e}const a=[];for(let e=0;e<this.node.level;e++)a.push(Vue.h("span",{class:{"element-tree-node-line-ver":!0,"last-node-line":l[e]&&this.node.level-1!==e,"last-node-isLeaf-line":l[e]&&this.node.level-1===e},style:{left:this.indent*e+"px"}}));return Vue.h("span",{class:"element-tree-node-label-wrapper"},[i].concat(a).concat([Vue.h("span",{class:"element-tree-node-line-hor",style:{width:(this.node.isLeaf?24:8)+"px",left:(this.node.level-1)*this.indent+"px"}})]))}}),v=Vue.createElementVNode("div",{class:"card-header"},[Vue.createElementVNode("span",{class:"font-medium"}," 扩展elemenet-plus的树形组件包括虚拟树组件,支持连接线 ")],-1),y=Vue.createElementVNode("div",{class:"card-header"},[Vue.createElementVNode("span",{class:"font-medium"}," 普通树结构 ")],-1),N={class:"max-h-[550px] overflow-y-auto"},C={class:"text-sm"},S=Vue.createElementVNode("div",{class:"card-header"},[Vue.createElementVNode("span",{class:"font-medium"}," 虚拟树结构 ")],-1),b={class:"max-h-[550px] overflow-y-auto"},g={class:"text-sm"},L=Vue.defineComponent({name:"LineTree"}),P=Vue.defineComponent({...L,setup(u){const r=f(_().wholeMenus,!0),o=Vue.computed(()=>x(r)),i=w(o.value),l={value:"uniqueId",children:"children"};return(t,a)=>{const e=Vue.resolveComponent("el-tree"),n=Vue.resolveComponent("el-card"),s=Vue.resolveComponent("el-col"),V=Vue.resolveComponent("el-tree-v2"),p=Vue.resolveComponent("el-row");return Vue.openBlock(),Vue.createBlock(n,{shadow:"never"},{header:Vue.withCtx(()=>[v]),default:Vue.withCtx(()=>[Vue.createVNode(p,{gutter:24},{default:Vue.withCtx(()=>[Vue.createVNode(s,{xs:24,sm:24,md:12,lg:12,xl:12,class:"mb-[20px]"},{default:Vue.withCtx(()=>[Vue.createVNode(n,{shadow:"never"},{header:Vue.withCtx(()=>[y]),default:Vue.withCtx(()=>[Vue.createElementVNode("div",N,[Vue.createVNode(e,{data:Vue.unref(o),props:l,"show-checkbox":"","default-expand-all":"","node-key":"uniqueId",indent:30},{default:Vue.withCtx(({node:d})=>[Vue.createVNode(Vue.unref(h),{node:d,showLabelLine:!0},{"node-label":Vue.withCtx(()=>[Vue.createElementVNode("span",C,Vue.toDisplayString(Vue.unref(c)(d.data.meta.title)),1)]),_:2},1032,["node"])]),_:1},8,["data"])])]),_:1})]),_:1}),Vue.createVNode(s,{xs:24,sm:24,md:12,lg:12,xl:12},{default:Vue.withCtx(()=>[Vue.createVNode(n,{shadow:"never"},{header:Vue.withCtx(()=>[S]),default:Vue.withCtx(()=>[Vue.createElementVNode("div",b,[Vue.createVNode(V,{data:Vue.unref(o),props:l,"show-checkbox":"",height:550,"default-expanded-keys":Vue.unref(i)},{default:Vue.withCtx(({node:d})=>[Vue.createVNode(Vue.unref(h),{node:d,treeData:Vue.unref(o),showLabelLine:!0,indent:30},{"node-label":Vue.withCtx(()=>[Vue.createElementVNode("span",g,Vue.toDisplayString(Vue.unref(c)(d.data.meta.title)),1)]),_:2},1032,["node","treeData"])]),_:1},8,["data","default-expanded-keys"])])]),_:1})]),_:1})]),_:1})]),_:1})}}});export{P as default};
|