(function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.index={},r.Vue))})(this,function(r,e){"use strict";const x={data:{type:Array,required:!0,default:()=>[]}},w=t=>e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg",class:["svg-icon svg-icon-close",t.class]},[e.createVNode("g",{"stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("rect",{x:"0.5",y:"0.5",width:"15",height:"15",rx:"2",stroke:"#5e7ce0"},null),e.createVNode("rect",{x:"4",y:"7",width:"8",height:"2",fill:"#5e7ce0"},null)])]),N=()=>e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg",class:"svg-icon"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("rect",{x:"0.5",y:"0.5",width:"15",height:"15",rx:"2",stroke:"#252b3a"},null),e.createVNode("path",{fill:"#252b3a",d:"M8.75,4 L8.75,7.25 L12,7.25 L12,8.75 L8.749,8.75 L8.75,12 L7.25,12 L7.249,8.75 L4,8.75 L4,7.25 L7.25,7.25 L7.25,4 L8.75,4 Z"},null)])]);function V(t){const n=d=>d.reduce((s,a)=>a.open?s.concat(a,a.children?n(a.children):[]):s.concat(a),[]),o=e.ref(n(t.value));return e.watch(()=>t.value,d=>o.value=n(d),{deep:!0}),{openedData:o,toggle:(d,s)=>{d.stopPropagation(),s.children&&(s.open=!s.open,o.value=n(t.value))}}}const k="",g="g";function u(t,n,o){let i=t;return n&&(i+=`__${n}`),o&&(i+=`--${o}`),i}function L(t,n=!1){const o=n?`.${g}-${t}`:`${g}-${t}`;return{b:()=>u(o),e:l=>l?u(o,l):"",m:l=>l?u(o,"",l):"",em:(l,f)=>l&&f?u(o,l,f):""}}const v="G",p=e.defineComponent({name:`${v}Tree`,props:x,emits:[],setup(t){const n=L("tree"),o=e.ref(!1),{data:i}=e.toRefs(t),{openedData:d,toggle:s}=V(i),a=()=>e.createVNode("span",{style:"display: inline-block; width: 16px; height: 16px;"},null),l=()=>{o.value=!o.value},f=(c,T)=>{const b=c.level?c.level:0;return e.createVNode("div",{class:[n.e("node"),c.open&&n.em("node","open")],style:{paddingLeft:`${24*(b-1)}px`}},[e.createVNode("div",{class:[n.e("node-content")],onClick:()=>l()},[e.createVNode("div",{class:n.em("node-content","value-wrapper")},[c.children?c.open?e.createVNode(w,{class:"mr-xs",onClick:h=>s(h,c)},null):e.createVNode(N,{class:"mr-xs",onClick:h=>s(h,c)},null):e.createVNode(a,null,null),e.createVNode("span",{class:n.e("node-title")},[c.label])])])])};return()=>e.createVNode("div",{class:n.b()},[d.value.map((c,T)=>f(c))])}});p.install=function(t,n){t.component(n||p.name,p)};const y={title:"Tree 树",category:"数据描述",status:"100%",install(t){t.component(p.name,p)}};r.Tree=p,r.default=y,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
