/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

'use strict';

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

var VueCompositionAPI = require('@vue/composition-api');
var hooks_lnode = require('../../hooks/lnode.js');
var hooks_useConfig = require('../../hooks/use-config.js');
var utils_helper = require('../../utils/helper.js');
var utils_ripple = require('../../utils/ripple.js');
var components_configProvider_configReceiver = require('../config-provider/config-receiver.js');
var components_dropdown_props = require('./props.js');
require('lodash/isEmpty');
require('lodash/isFunction');
require('lodash/camelCase');
require('lodash/kebabCase');
require('../../hooks/render-lnode.js');
require('lodash');
require('../config-provider/useConfig.js');
require('../config-provider/context.js');
require('../../chunks/zh_CN.js');
require('../../chunks/set-style.js');
require('../../config.js');
require('vue');
require('lodash/mergeWith');

const keepAnimationMixins = components_configProvider_configReceiver.getKeepAnimationMixins();
var _DropdownItem = VueCompositionAPI.defineComponent({
  name: "LDropdownItem",
  directives: {
    ripple: utils_ripple["default"]
  },
  mixins: [keepAnimationMixins],
  props: {
    ...components_dropdown_props.DropdownItemProps,
    maxColumnWidth: {
      type: [String, Number],
      default: 100
    },
    minColumnWidth: {
      type: [String, Number],
      default: 10
    },
    isSubmenu: Boolean
  },
  setup(props, _ref) {
    let {
      emit
    } = _ref;
    const itemRef = VueCompositionAPI.ref();
    const dropdownItemClass = hooks_useConfig.usePrefixClass("dropdown__item");
    const handleItemClick = e => {
      var _props$onClick;
      (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, props.value, {
        e
      });
      emit("click", props.value, {
        e
      });
    };
    return {
      itemRef,
      dropdownItemClass,
      handleItemClick
    };
  },
  render() {
    const h = arguments[0];
    const classes = [this.dropdownItemClass, `${this.dropdownItemClass}--theme-${this.theme}`, {
      [`${this.dropdownItemClass}--active`]: this.active,
      [`${this.dropdownItemClass}--disabled`]: this.disabled
    }];
    const renderTNodeJSX = hooks_lnode.useLNodeJSX();
    const prefixIcon = renderTNodeJSX("prefixIcon");
    return h("li", {
      "class": classes,
      "on": {
        "click": this.handleItemClick
      },
      "style": {
        maxWidth: utils_helper.pxCompat(this.maxColumnWidth),
        minWidth: utils_helper.pxCompat(this.minColumnWidth)
      },
      "directives": [{
        name: "ripple",
        value: !this.isSubmenu && this.keepAnimation.ripple
      }],
      "ref": this.itemRef
    }, [this.prefixIcon ? h("div", {
      "class": `${this.dropdownItemClass}-icon`
    }, [prefixIcon]) : null, renderTNodeJSX("default")]);
  }
});

exports["default"] = _DropdownItem;
//# sourceMappingURL=dropdown-item.js.map
