diff --git a/src/components/TagSelect/index.d.ts b/src/components/TagSelect/index.d.ts index b17d34d859df6b93ce17856c9dfc3d6cc00bfbcf..736ca52f17bb12a137d0c04b1be260b4c7c6c1e8 100644 --- a/src/components/TagSelect/index.d.ts +++ b/src/components/TagSelect/index.d.ts @@ -6,6 +6,7 @@ export interface ITagSelectProps { expandable?: boolean; value?: string[] | number[]; style?: React.CSSProperties; + hideCheckAll?: boolean; } export default class TagSelect extends React.Component { diff --git a/src/components/TagSelect/index.js b/src/components/TagSelect/index.js index 7b2ef95bf9e077af76f23c6b38ce8a4bdda7a09a..b7aea130fa5f2cf17e6e0ea5d80f1f7884c6d72a 100644 --- a/src/components/TagSelect/index.js +++ b/src/components/TagSelect/index.js @@ -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 (
- - 全部 - + {hideCheckAll ? null : ( + + 全部 + + )} {value && React.Children.map(children, child => { if (this.isTagSelectOption(child)) { diff --git a/src/components/TagSelect/index.md b/src/components/TagSelect/index.md index 608219cdbb7af05ceefdbad286658e2ec9334c9a..25a42b57a114818e4de2d30d58124acfde99eef7 100644 --- a/src/components/TagSelect/index.md +++ b/src/components/TagSelect/index.md @@ -19,7 +19,7 @@ order: 13 | defaultValue |默认选中的项 |string[] \| number[] | | | onChange | 标签选择的回调函数 | Function(checkedTags) | | | expandable | 是否展示 `展开/收起` 按钮 | Boolean | false | - +| hideCheckAll | 隐藏 `全部` 按钮 | Boolean | false | ### TagSelectOption