"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),$=require("../_util/classNames.js"),U=require("../_util/omit.js"),A=require("../_util/props-util/index.js"),j=require("../_util/props-util/initDefaultProps.js"),e=require("../_util/type.js"),p=require("../_util/vue-types/index.js"),F=require("../config-provider/hooks/useConfigInject.js"),L=require("../vc-tree/Tree.js"),M=require("../vc-util/warning.js");require("../vc-tree/contextTypes.js");const O=require("../vc-tree/props.js"),R=require("../vc-util/devWarning.js"),B=require("./style/index.js"),V=require("./utils/dropIndicator.js"),_=require("./utils/iconUtil.js"),y=()=>{const o=O.treeProps();return{...o,showLine:e.someType([Boolean,Object]),multiple:e.booleanType(),autoExpandParent:e.booleanType(),checkStrictly:e.booleanType(),checkable:e.booleanType(),disabled:e.booleanType(),defaultExpandAll:e.booleanType(),defaultExpandParent:e.booleanType(),defaultExpandedKeys:e.arrayType(),expandedKeys:e.arrayType(),checkedKeys:e.someType([Array,Object]),defaultCheckedKeys:e.arrayType(),selectedKeys:e.arrayType(),defaultSelectedKeys:e.arrayType(),selectable:e.booleanType(),loadedKeys:e.arrayType(),draggable:e.booleanType(),showIcon:e.booleanType(),icon:e.functionType(),switcherIcon:p.default.any,prefixCls:String,replaceFields:e.objectType(),blockNode:e.booleanType(),openAnimation:p.default.any,onDoubleclick:o.onDblclick,"onUpdate:selectedKeys":e.functionType(),"onUpdate:checkedKeys":e.functionType(),"onUpdate:expandedKeys":e.functionType()}},H=n.defineComponent({compatConfig:{MODE:3},name:"ATree",inheritAttrs:!1,props:j.default(y(),{checkable:!1,selectable:!0,showIcon:!1,blockNode:!1}),slots:Object,setup(o,{attrs:s,expose:f,emit:r,slots:d}){M.warning(!(o.treeData===void 0&&d.default));const{prefixCls:c,direction:u,virtual:h}=F.default("tree",o),[b,T]=B.default(c),l=n.ref();f({treeRef:l,onNodeExpand:(...a)=>{l.value?.onNodeExpand(...a)},scrollTo:a=>{l.value?.scrollTo(a)},selectedKeys:n.computed(()=>l.value?.selectedKeys),checkedKeys:n.computed(()=>l.value?.checkedKeys),halfCheckedKeys:n.computed(()=>l.value?.halfCheckedKeys),loadedKeys:n.computed(()=>l.value?.loadedKeys),loadingKeys:n.computed(()=>l.value?.loadingKeys),expandedKeys:n.computed(()=>l.value?.expandedKeys)}),n.watchEffect(()=>{R.default(o.replaceFields===void 0,"Tree","`replaceFields` is deprecated, please use fieldNames instead")});const k=(a,t)=>{r("update:checkedKeys",a),r("check",a,t)},v=(a,t)=>{r("update:expandedKeys",a),r("expand",a,t)},K=(a,t)=>{r("update:selectedKeys",a),r("select",a,t)};return()=>{const{showIcon:a,showLine:t,switcherIcon:x=d.switcherIcon,icon:m=d.icon,blockNode:q,checkable:w,selectable:i,fieldNames:g=o.replaceFields,motion:I=o.openAnimation,itemHeight:C=28,onDoubleclick:E,onDblclick:N}=o,D={...s,...U.default(o,["onUpdate:checkedKeys","onUpdate:expandedKeys","onUpdate:selectedKeys","onDoubleclick"]),showLine:!!t,dropIndicatorRender:V.default,fieldNames:g,icon:m,itemHeight:C},P=d.default?A.filterEmpty(d.default()):void 0;return b(n.createVNode(L.default,{...D,virtual:h.value,motion:I,ref:l,prefixCls:c.value,class:$.default({[`${c.value}-icon-hide`]:!a,[`${c.value}-block-node`]:q,[`${c.value}-unselectable`]:!i,[`${c.value}-rtl`]:u.value==="rtl"},s.class,T.value),direction:u.value,checkable:w,selectable:i,switcherIcon:S=>_.default(c.value,x,S,d.leafIcon,t),onCheck:k,onExpand:v,onSelect:K,onDblclick:N||E,children:P},{...d,checkable:()=>n.createVNode("span",{class:`${c.value}-checkbox-inner`},null)}))}}});exports.default=H;exports.treeProps=y;
