'use strict';

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

var vue = require('vue');
var CloseOutlined = require('@ant-design/icons-vue');
var en_US = require('../locale/lang/en_US.js');
require('../checkbox/index.js');
var LocaleReceiver = require('../locale-provider/LocaleReceiver.js');
var transButton = require('../_util/components/transButton.js');
var classNames = require('../_util/classNames.js');
var index = require('../_util/vue-types/index.js');
var type = require('../_util/type.js');
var Checkbox = require('../checkbox/Checkbox.js');

function noop() {
}
const transferListItemProps = {
  renderedText: index.default.any,
  renderedEl: index.default.any,
  item: index.default.any,
  checked: type.booleanType(),
  prefixCls: String,
  disabled: type.booleanType(),
  showRemove: type.booleanType(),
  onClick: Function,
  onRemove: Function
};
var ListItem = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ListItem",
  inheritAttrs: false,
  props: transferListItemProps,
  emits: ["click", "remove"],
  setup(props, {
    emit
  }) {
    return () => {
      const {
        renderedText,
        renderedEl,
        item,
        checked,
        disabled,
        prefixCls,
        showRemove
      } = props;
      const className = classNames.default({
        [`${prefixCls}-content-item`]: true,
        [`${prefixCls}-content-item-disabled`]: disabled || item.disabled
      });
      let title;
      if (typeof renderedText === "string" || typeof renderedText === "number")
        title = String(renderedText);
      return vue.createVNode(LocaleReceiver.default, {
        "componentName": "Transfer",
        "defaultLocale": en_US.default.Transfer
      }, {
        default: (transferLocale) => {
          const labelNode = vue.createVNode("span", {
            "class": `${prefixCls}-content-item-text`
          }, [renderedEl]);
          if (showRemove) {
            return vue.createVNode("li", {
              "class": className,
              "title": title
            }, [labelNode, vue.createVNode(transButton.default, {
              "disabled": disabled || item.disabled,
              "class": `${prefixCls}-content-item-remove`,
              "aria-label": transferLocale.remove,
              "onClick": () => {
                emit("remove", item);
              }
            }, {
              default: () => [vue.createVNode(CloseOutlined.DeleteOutlined, null, null)]
            })]);
          }
          return vue.createVNode("li", {
            "class": className,
            "title": title,
            "onClick": disabled || item.disabled ? noop : () => {
              emit("click", item);
            }
          }, [vue.createVNode(Checkbox.default, {
            "class": `${prefixCls}-checkbox`,
            "checked": checked,
            "disabled": disabled || item.disabled
          }, null), labelNode]);
        }
      });
    };
  }
});

exports.default = ListItem;
exports.transferListItemProps = transferListItemProps;
//# sourceMappingURL=ListItem.js.map
