/**
 * ldesign v0.3.13
 * (c) 2023 ldesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { defineComponent, computed, provide, createVNode, TransitionGroup } from 'vue';
import '../hooks/useConfig.js';
import { useTNodeDefault } from '../hooks/tnode.js';
import props from './props.js';
import { useCLASSNAMES, injectKey } from './constants.js';
import useTree from './useTree.js';
import useExposeFunc from './hooks/useExposeFunc.js';
import { useConfig } from '../config-provider/useConfig.js';
import 'lodash/isFunction';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../utils/render-tnode.js';
import 'lodash/isEmpty';
import 'lodash/isString';
import 'lodash/isObject';
import '@babel/runtime/helpers/slicedToArray';
import 'lodash/isArray';
import '../_common/js/tree/tree-store.js';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import 'lodash/isNumber';
import 'lodash/difference';
import 'lodash/isPlainObject';
import 'mitt';
import '../_common/js/tree/tree-node.js';
import '@babel/runtime/helpers/asyncToGenerator';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/regenerator';
import 'lodash/isNull';
import 'lodash/uniqueId';
import 'lodash/isNil';
import 'lodash/get';
import '../_common/js/tree/tree-node-model.js';
import 'lodash/isUndefined';
import 'lodash/isBoolean';
import 'lodash/pick';
import 'lodash/omit';
import '../_common/js/log/log.js';
import '../_common/js/log/index.js';
import '../hooks/useDefaultValue.js';
import '../hooks/useVModel.js';
import './tree-item.js';
import '@ldesign/icons-vue-next';
import '../checkbox/index.js';
import '../utils/withInstall.js';
import '../checkbox/checkbox.js';
import '../form/hooks.js';
import '../hooks/useRipple.js';
import '../utils/set-style.js';
import '../hooks/useKeepAnimation.js';
import '../config-provider/context.js';
import 'lodash/mergeWith';
import 'lodash/merge';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import '../_chunks/dep-512eb181.js';
import 'dayjs';
import '../_chunks/dep-ac28b67c.js';
import '../checkbox/props.js';
import '../checkbox/constants.js';
import 'lodash/cloneDeep';
import '../config-provider/type.js';
import '../checkbox/group.js';
import 'lodash/intersection';
import '../hooks/slot.js';
import '../checkbox/checkbox-group-props.js';
import '../checkbox/style';
import '../checkbox/type.js';
import '../loading/index.js';
import '../loading/directive.js';
import '../loading/plugin.js';
import '../utils/dom.js';
import '../utils/easing.js';
import '../loading/loading.js';
import '../hooks/useTeleport.js';
import '../loading/props.js';
import '../loading/icon/gradient.js';
import '../_common/js/loading/circle-adapter.js';
import '../_common/js/utils/set-style.js';
import '../_common/js/utils/helper.js';
import '@babel/runtime/helpers/objectWithoutProperties';
import '../loading/style';
import '../loading/type.js';
import '../hooks/useGlobalIcon.js';
import './util.js';
import './hooks/useDraggable.js';
import 'lodash/throttle';
import './hooks/useOnDrag.js';
import 'lodash/upperFirst';

var _TdTree = defineComponent({
  name: "TTree",
  props: props,
  setup: function setup(props2, _ref) {
    var expose = _ref.expose,
      slots = _ref.slots;
    var _useConfig = useConfig("tree"),
      globalConfig = _useConfig.globalConfig,
      t = _useConfig.t;
    var CLASS_NAMES = useCLASSNAMES();
    var renderTNodeJSX = useTNodeDefault();
    var statusContext = computed(function () {
      var checkProps = props2.checkProps,
        empty = props2.empty,
        icon = props2.icon,
        label = props2.label,
        line = props2.line,
        disableCheck = props2.disableCheck,
        operations = props2.operations;
      return {
        checkProps: checkProps,
        empty: empty,
        icon: icon,
        label: label,
        line: line,
        disableCheck: disableCheck,
        operations: operations,
        scopedSlots: slots
      };
    });
    provide(injectKey, statusContext);
    var _useTree = useTree(props2),
      treeStore = _useTree.treeStore,
      treeNodeViews = _useTree.treeNodeViews;
    useExposeFunc(treeStore, expose);
    var classList = computed(function () {
      var _ref2;
      return [CLASS_NAMES.value.tree, (_ref2 = {}, _defineProperty(_ref2, CLASS_NAMES.value.disabled, props2.disabled), _defineProperty(_ref2, CLASS_NAMES.value.treeHoverAble, props2.hover), _defineProperty(_ref2, CLASS_NAMES.value.treeCheckable, props2.checkable), _defineProperty(_ref2, CLASS_NAMES.value.treeTransition, props2.transition), _defineProperty(_ref2, CLASS_NAMES.value.treeBlockNode, props2.expandOnClickNode), _ref2)];
    });
    return function () {
      return createVNode("div", {
        "class": classList.value
      }, [treeNodeViews.value.length === 0 ? createVNode("div", {
        "class": CLASS_NAMES.value.treeEmpty
      }, [renderTNodeJSX("empty", {
        defaultNode: t(globalConfig.value.empty)
      })]) : createVNode(TransitionGroup, {
        "name": CLASS_NAMES.value.treeNodeToggle,
        "tag": "div",
        "enter-active-class": CLASS_NAMES.value.treeNodeEnter,
        "leave-active-class": CLASS_NAMES.value.treeNodeLeave
      }, {
        "default": function _default() {
          return [treeNodeViews.value];
        }
      })]);
    };
  }
});

export { _TdTree as default };
//# sourceMappingURL=td-tree.js.map
