vue-pure-admin/dist/static/js/line-tree-26ddd513.js
2023-05-11 20:37:21 +08:00

2 lines
4.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{b as m,J as f,u as _,d as x,e as w,t as c}from"./index-c61a73ff.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:a}=r;return{getScopedSlot:t=>{if(!t)return null;const l=t.split("||");let e=null;for(let n=0;n<l.length;n++){const s=l[n];e=(a||{})[s]}return e},getSlotValue:(t,l,e=null)=>m(t)?t(l)||e:t||e}},render(){const u=this.getScopedSlot("default"),r=this.getScopedSlot("node-label"),a=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(a,{node:this.node,data:this.data})],o=[];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));o.unshift(n===(e.children||e.childNodes).length-1)}t=e}const l=[];for(let e=0;e<this.node.level;e++)l.push(Vue.h("span",{class:{"element-tree-node-line-ver":!0,"last-node-line":o[e]&&this.node.level-1!==e,"last-node-isLeaf-line":o[e]&&this.node.level-1===e},style:{left:this.indent*e+"px"}}));return Vue.h("span",{class:"element-tree-node-label-wrapper"},[i].concat(l).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"},S={class:"text-sm"},b=Vue.createElementVNode("div",{class:"card-header"},[Vue.createElementVNode("span",{class:"font-medium"}," 虚拟树结构 ")],-1),C={class:"max-h-[550px] overflow-y-auto"},g={class:"text-sm"},k=Vue.defineComponent({name:"LineTree",__name:"line-tree",setup(u){const r=f(_().wholeMenus,!0),a=Vue.computed(()=>x(r)),i=w(a.value),o={value:"uniqueId",children:"children"};return(t,l)=>{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:a.value,props:o,"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",S,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(()=>[b]),default:Vue.withCtx(()=>[Vue.createElementVNode("div",C,[Vue.createVNode(V,{data:a.value,props:o,"show-checkbox":"",height:550,"default-expanded-keys":Vue.unref(i)},{default:Vue.withCtx(({node:d})=>[Vue.createVNode(Vue.unref(h),{node:d,treeData:a.value,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{k as default};