import PropTypes from '../_util/vue-types'; import classNames from '../_util/classNames'; import type { TransferLocale } from '.'; import DeleteOutlined from '@ant-design/icons-vue/DeleteOutlined'; import defaultLocale from '../locale/default'; import Checkbox from '../checkbox'; import TransButton from '../_util/transButton'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; import type { ExtractPropTypes } from 'vue'; import { defineComponent } from 'vue'; function noop() {} export const transferListItemProps = { renderedText: PropTypes.any, renderedEl: PropTypes.any, item: PropTypes.any, checked: PropTypes.looseBool, prefixCls: PropTypes.string, disabled: PropTypes.looseBool, showRemove: PropTypes.looseBool, onClick: PropTypes.func, onRemove: PropTypes.func, }; export type TransferListItemProps = Partial>; export default defineComponent({ 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({ [`${prefixCls}-content-item`]: true, [`${prefixCls}-content-item-disabled`]: disabled || item.disabled, }); let title: string; if (typeof renderedText === 'string' || typeof renderedText === 'number') { title = String(renderedText); } return ( {(transferLocale: TransferLocale) => { const labelNode = {renderedEl}; if (showRemove) { return (
  • {labelNode} { emit('remove', item); }} >
  • ); } return (
  • { emit('click', item); } } > {labelNode}
  • ); }}
    ); }; }, });