/**
 * ldesign v0.2.22
 * (c) 2022/12/7 16:21 built by swimly
 * @license MIT
 */

import { usePrefixClass } from '../../../hooks/useConfig.js';
import { getTNode } from '../utils.js';
import '@vue/composition-api';
import '../../config-provider/useConfig.js';
import '../../config-provider/context.js';
import 'lodash/merge';
import 'lodash/mergeWith';
import '../../../chunks/zh_CN.js';
import '../../config-provider/type.js';
import 'lodash/camelCase';

function useRenderOperations(props) {
  const componentName = usePrefixClass("tree").value;
  const renderOperations = h => {
    const {
      node,
      treeScope
    } = props;
    const {
      scopedSlots
    } = treeScope;
    const treeProps = treeScope?.treeProps || {};
    const {
      operations
    } = treeProps;
    let opNode = null;
    if (scopedSlots?.operations) {
      opNode = scopedSlots.operations({
        node: node?.getModel()
      });
    } else {
      opNode = getTNode(operations, {
        createElement: h,
        node
      });
    }
    if (opNode) {
      opNode = h("span", {
        "class": `${componentName}__operations`,
        "attrs": {
          "ignore": "active,expand"
        }
      }, [opNode]);
    }
    return opNode;
  };
  return {
    renderOperations
  };
}

export { useRenderOperations as default };
//# sourceMappingURL=useRenderOperations.js.map
