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