mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 19:50:05 +08:00
8501b708ea
* 📦 samller bundlesize limit * 🗑️ remove React static PropTypes * 🗑️ remove react-lifecycles-compat * 🗑️ remove matchMedia polyfill * 🗑️ remove Transfer buggy lazy prop * 🗑️ remove enquire.js dep * 🗑️ remove Transfer lazy related code and fix ci * 🗑️ remove used dom-closest * ⚡ replace dom-scroll-into-view to scroll-into-view for bundle size * ✅ fix eslint * 🆙 upgrade browserslist * ✅ fix test cases * 🗑️ remove @ant-design/create-react-context * 🆙 upgrade @ant-design/bisheng-plugin * 🆙 upgrade rc-slider * ✅ fix ci * 🆙 upgrade rc-tabs and rc-mentions * 📦 scroll-into-view -> scroll-into-view-if-needed * remove unused devDep * docs: 📝 update instruction about IE9/10 * 📦 reduce css bundle size by drop IE9/10 support * 🆙 upgrade rc-upload * 🗑️ drop unused swing motion css * ✅ update upload snapshots * 📦 lift css bundlesize limit to 55kb
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import * as React from 'react';
|
|
import classNames from 'classnames';
|
|
import PureRenderMixin from 'rc-util/lib/PureRenderMixin';
|
|
import Checkbox from '../checkbox';
|
|
|
|
export default class ListItem extends React.Component<any, any> {
|
|
shouldComponentUpdate(...args: any[]) {
|
|
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
|
|
}
|
|
|
|
render() {
|
|
const { renderedText, renderedEl, item, checked, disabled, prefixCls, onClick } = this.props;
|
|
|
|
const className = classNames({
|
|
[`${prefixCls}-content-item`]: true,
|
|
[`${prefixCls}-content-item-disabled`]: disabled || item.disabled,
|
|
[`${prefixCls}-content-item-checked`]: checked,
|
|
});
|
|
|
|
let title: string | undefined;
|
|
if (typeof renderedText === 'string' || typeof renderedText === 'number') {
|
|
title = String(renderedText);
|
|
}
|
|
|
|
const listItem = (
|
|
<li
|
|
className={className}
|
|
title={title}
|
|
onClick={disabled || item.disabled ? undefined : () => onClick(item)}
|
|
>
|
|
<Checkbox checked={checked} disabled={disabled || item.disabled} />
|
|
<span className={`${prefixCls}-content-item-text`}>{renderedEl}</span>
|
|
</li>
|
|
);
|
|
|
|
return listItem;
|
|
}
|
|
}
|