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

import { defineComponent, ref } from '@vue/composition-api';
import { useLNodeJSX } from '../../hooks/lnode.js';
import { usePrefixClass } from '../../hooks/use-config.js';
import { pxCompat } from '../../utils/helper.js';
import Ripple from '../../utils/ripple.js';
import { getKeepAnimationMixins } from '../config-provider/config-receiver.js';
import { DropdownItemProps } from './props.js';
import 'lodash/isEmpty';
import 'lodash/isFunction';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../../hooks/render-lnode.js';
import 'lodash';
import '../config-provider/useConfig.js';
import '../config-provider/context.js';
import '../../chunks/zh_CN.js';
import '../config-provider/type.js';
import '../../chunks/set-style.js';
import '../../config.js';
import 'vue';
import 'lodash/mergeWith';

const keepAnimationMixins = getKeepAnimationMixins();
var _DropdownItem = defineComponent({
  name: "LDropdownItem",
  directives: {
    ripple: Ripple
  },
  mixins: [keepAnimationMixins],
  props: {
    ...DropdownItemProps,
    maxColumnWidth: {
      type: [String, Number],
      default: 100
    },
    minColumnWidth: {
      type: [String, Number],
      default: 10
    },
    isSubmenu: Boolean
  },
  setup(props, _ref) {
    let {
      emit
    } = _ref;
    const itemRef = ref();
    const dropdownItemClass = 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 = useLNodeJSX();
    const prefixIcon = renderTNodeJSX("prefixIcon");
    return h("li", {
      "class": classes,
      "on": {
        "click": this.handleItemClick
      },
      "style": {
        maxWidth: pxCompat(this.maxColumnWidth),
        minWidth: 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")]);
  }
});

export { _DropdownItem as default };
//# sourceMappingURL=dropdown-item.js.map
