/**
 * ldesign v0.2.3
 * (c) 2022年9月24日 swimly
 * @license MIT
 */

'use strict';

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

var helper = require('../../chunks/helper.js');
var components_popup_index = require('../popup/index.js');
var components_dropdown_dropdownMenu = require('./dropdown-menu.js');
var utils_event = require('../../utils/event.js');
var components_dropdown_props = require('./props.js');
var components_configProvider_configReceiver = require('../config-provider/config-receiver.js');
var utils_mixins = require('../../utils/mixins.js');
require('../popup/popup.js');
require('@popperjs/core');
require('../../chunks/set-style.js');
require('../../utils/dom.js');
require('vue');
require('raf');
require('lodash/isString');
require('../../utils/easing.js');
require('../../utils/render-node.js');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../../utils/helper.js');
require('../popup/props.js');
require('../popup/container.js');
require('lodash/mergeWith');
require('lodash');
require('../config-provider/context.js');
require('../../chunks/zh_CN.js');
require('../../utils/map-props.js');
require('../../utils/with-install.js');
require('../../config.js');
require('./dropdown-item.js');
require('@ldesign/icons-vue');
require('../divider/index.js');
require('../divider/divider.js');
require('../divider/props.js');
require('../../utils/ripple.js');

const classPrefixMixins = components_configProvider_configReceiver.getClassPrefixMixins("dropdown");
var _Dropdown = utils_mixins["default"](classPrefixMixins).extend({
  name: "LDropdown",
  props: { ...components_dropdown_props.DropdownProps
  },
  components: {
    LPopup: components_popup_index.Popup
  },

  provide() {
    return {
      dropdown: this
    };
  },

  methods: {
    handleMenuClick(data, context) {
      if (this.hideAfterItemClick) {
        const {
          popupElem
        } = this.$refs;
        popupElem.handleClose();
      }

      utils_event.emitEvent(this, "click", data, context);
    }

  },

  render() {
    const h = arguments[0];
    const trigger = this.$scopedSlots.default ? this.$scopedSlots.default(null) : "";
    const contentSlot = this.$scopedSlots.dropdown ? this.$scopedSlots.dropdown(null) : "";
    const popupProps = {
      props: { ...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("l-popup", helper.helper([{}, popupProps, {
      "ref": "popupElem",
      "attrs": {
        "expandAnimation": true
      }
    }]), [h("template", {
      "slot": "content",
      "attrs": {
        "role": "dropdown"
      }
    }, [contentSlot || h(components_dropdown_dropdownMenu["default"])]), trigger]);
  }

});

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