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

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var hooks_useConfig = require('../../../hooks/useConfig.js');
var components_tree_utils = require('../utils.js');
require('@vue/composition-api');
require('../../config-provider/useConfig.js');
require('../../config-provider/context.js');
require('lodash/merge');
require('lodash/mergeWith');
require('../../../chunks/zh_CN.js');
require('lodash/camelCase');

function useRenderOperations(props) {
  const componentName = hooks_useConfig.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 = components_tree_utils.getTNode(operations, {
        createElement: h,
        node
      });
    }
    if (opNode) {
      opNode = h("span", {
        "class": `${componentName}__operations`,
        "attrs": {
          "ignore": "active,expand"
        }
      }, [opNode]);
    }
    return opNode;
  };
  return {
    renderOperations
  };
}

exports["default"] = useRenderOperations;
//# sourceMappingURL=useRenderOperations.js.map
