/**
 * tdesign v0.46.4
 * (c) 2022 tdesign
 * @license MIT
 */

'use strict';

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

var helper = require('../_chunks/dep-d7a1e02c.js');
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var popup_index = require('../popup/index.js');
var dropdown_dropdownMenu = require('./dropdown-menu.js');
var utils_event = require('../utils/event.js');
var dropdown_props = require('./props.js');
var configProvider_configReceiver = require('../config-provider/config-receiver.js');
var utils_mixins = require('../utils/mixins.js');
require('../popup/popup.js');
require('@babel/runtime/helpers/typeof');
require('@popperjs/core');
require('../utils/dom.js');
require('vue');
require('raf');
require('lodash/isString');
require('../utils/easing.js');
require('../utils/render-tnode.js');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../utils/helper.js');
require('@babel/runtime/helpers/objectWithoutProperties');
require('@babel/runtime/helpers/slicedToArray');
require('../_common/js/utils/set-style.js');
require('../popup/props.js');
require('../popup/container.js');
require('../utils/map-props.js');
require('../utils/withInstall.js');
require('lodash/capitalize');
require('lodash/mergeWith');
require('../config-provider/context.js');
require('lodash/merge');
require('../_common/js/global-config/default-config.js');
require('../_common/js/global-config/locale/zh_CN.js');
require('./dropdown-item.js');
require('tdesign-icons-vue');
require('../divider/index.js');
require('../divider/divider.js');
require('../divider/props.js');
require('./dropdown-item-props.js');
require('../utils/ripple.js');
require('../config.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var classPrefixMixins = configProvider_configReceiver.getClassPrefixMixins("dropdown");
var _Dropdown = utils_mixins["default"](classPrefixMixins).extend({
  name: "TDropdown",
  props: _objectSpread({}, dropdown_props["default"]),
  provide: function provide() {
    return {
      dropdown: this
    };
  },
  methods: {
    handleMenuClick: function handleMenuClick(data, context) {
      if (this.hideAfterItemClick) {
        var popupElem = this.$refs.popupElem;
        popupElem.handleClose();
      }

      utils_event.emitEvent(this, "click", data, context);
    }
  },
  render: function render() {
    var h = arguments[0];
    var trigger = this.$scopedSlots["default"] ? this.$scopedSlots["default"](null) : "";
    var contentSlot = this.$scopedSlots.dropdown ? this.$scopedSlots.dropdown(null) : "";

    var popupProps = _objectSpread(_objectSpread({
      props: _objectSpread(_objectSpread(_objectSpread({}, this.$attrs), this.popupProps), {}, {
        disabled: this.disabled,
        placement: this.placement,
        trigger: this.trigger,
        overlayClassName: this.popupProps && this.popupProps.overlayClassName ? [this.componentName, this.popupProps.overlayClassName] : this.componentName
      })
    }, this.popupProps), {}, {
      ref: "popup"
    });

    return h(popup_index.Popup, helper.helper([{}, popupProps, {
      "ref": "popupElem",
      "attrs": {
        "expandAnimation": true
      }
    }]), [h("template", {
      "slot": "content",
      "attrs": {
        "role": "dropdown"
      }
    }, [contentSlot || h(dropdown_dropdownMenu["default"])]), trigger]);
  }
});

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