Commit 6138c036 authored by 陈帅's avatar 陈帅

add hideCheckAll in TagSelect

parent d2de675e
......@@ -6,6 +6,7 @@ export interface ITagSelectProps {
expandable?: boolean;
value?: string[] | number[];
style?: React.CSSProperties;
hideCheckAll?: boolean;
}
export default class TagSelect extends React.Component<ITagSelectProps, any> {
......
......@@ -15,6 +15,9 @@ const TagSelectOption = ({ children, checked, onChange, value }) => (
TagSelectOption.isTagSelectOption = true;
class TagSelect extends Component {
static defaultProps = {
hideCheckAll: false,
};
constructor(props) {
super(props);
this.state = {
......@@ -87,7 +90,7 @@ class TagSelect extends Component {
render() {
const { value, expand } = this.state;
const { children, className, style, expandable } = this.props;
const { children, hideCheckAll, className, style, expandable } = this.props;
const checkedAll = this.getAllTags().length === value.length;
......@@ -97,9 +100,11 @@ class TagSelect extends Component {
});
return (
<div className={cls} style={style}>
{hideCheckAll ? null : (
<CheckableTag checked={checkedAll} key="tag-select-__all__" onChange={this.onSelectAll}>
全部
</CheckableTag>
)}
{value &&
React.Children.map(children, child => {
if (this.isTagSelectOption(child)) {
......
......@@ -19,7 +19,7 @@ order: 13
| defaultValue |默认选中的项 |string[] \| number[] | |
| onChange | 标签选择的回调函数 | Function(checkedTags) | |
| expandable | 是否展示 `展开/收起` 按钮 | Boolean | false |
| hideCheckAll | 隐藏 `全部` 按钮 | Boolean | false |
### TagSelectOption
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment