/**
 * tdesign v0.39.1-alpha.1
 * (c) 2022 tdesign
 * @license MIT
 */

'use strict';

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

var helper = require('../_chunks/dep-33ee4bce.js');
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var Vue = require('vue');
var config = require('../config.js');
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');
require('../popup/popup.js');
require('@babel/runtime/helpers/typeof');
require('@popperjs/core');
require('../utils/classnames.js');
require('../utils/dom.js');
require('raf');
require('lodash/isString');
require('../utils/easing.js');
require('../utils/render-tnode.js');
require('lodash/isObject');
require('../utils/helper.js');
require('@babel/runtime/helpers/objectWithoutProperties');
require('@babel/runtime/helpers/slicedToArray');
require('lodash/camelCase');
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('./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('../utils/mixins.js');
require('../config-provider/config-receiver.js');
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');

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

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

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 name = "".concat(config.prefix, "-dropdown");
var _Dropdown = Vue__default["default"].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 = {
      props: _objectSpread(_objectSpread(_objectSpread({}, this.$attrs), this.popupProps), {}, {
        disabled: this.disabled,
        placement: this.placement,
        trigger: this.trigger,
        overlayClassName: this.popupProps && this.popupProps.overlayClassName ? [name, this.popupProps.overlayClassName] : name
      }),
      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
