import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _createSuper from "@babel/runtime/helpers/createSuper";
import React, { Component } from 'react';
import Trigger from '../../../es/trigger';
import DropdownMenu from './DropdownMenu';
import BUILT_IN_PLACEMENTS from '../trigger-field/placements';

var KeywordTrigger = /*#__PURE__*/function (_Component) {
  _inherits(KeywordTrigger, _Component);

  var _super = _createSuper(KeywordTrigger);

  function KeywordTrigger() {
    _classCallCheck(this, KeywordTrigger);

    return _super.apply(this, arguments);
  }

  _createClass(KeywordTrigger, [{
    key: "getDropdownElement",
    value: function getDropdownElement() {
      var options = this.props.options;
      return /*#__PURE__*/React.createElement(DropdownMenu, {
        options: options
      });
    }
  }, {
    key: "getDropDownPlacement",
    value: function getDropDownPlacement() {
      var placement = this.props.placement;
      var popupPlacement = placement === 'top' ? 'topLeft' : 'bottomLeft';
      return popupPlacement;
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props = this.props,
          children = _this$props.children,
          visible = _this$props.visible,
          getPopupContainer = _this$props.getPopupContainer,
          prefixCls = _this$props.prefixCls;
      var popupElement = this.getDropdownElement();
      return /*#__PURE__*/React.createElement(Trigger, {
        prefixCls: prefixCls,
        popupHidden: !visible,
        popupContent: popupElement,
        popupPlacement: this.getDropDownPlacement(),
        builtinPlacements: BUILT_IN_PLACEMENTS,
        getPopupContainer: getPopupContainer
      }, children);
    }
  }]);

  return KeywordTrigger;
}(Component);

export default KeywordTrigger;
//# sourceMappingURL=KeywordTrigger.js.map
