forked from p96170835/amis
为NestedSelect添加checkAll和checkAllLabel选项
This commit is contained in:
parent
6e31b279b3
commit
fbd29830ec
|
@ -38,7 +38,9 @@ export default class NestedSelectControl extends React.Component<
|
||||||
static defaultProps: Partial<NestedSelectProps> = {
|
static defaultProps: Partial<NestedSelectProps> = {
|
||||||
cascade: false,
|
cascade: false,
|
||||||
withChildren: false,
|
withChildren: false,
|
||||||
searchPromptText: '输入内容进行检索'
|
searchPromptText: '输入内容进行检索',
|
||||||
|
checkAll: true,
|
||||||
|
checkAllLabel: '全选',
|
||||||
};
|
};
|
||||||
target: any;
|
target: any;
|
||||||
input: HTMLInputElement;
|
input: HTMLInputElement;
|
||||||
|
@ -395,6 +397,8 @@ export default class NestedSelectControl extends React.Component<
|
||||||
options,
|
options,
|
||||||
disabled,
|
disabled,
|
||||||
searchable,
|
searchable,
|
||||||
|
checkAll,
|
||||||
|
checkAllLabel,
|
||||||
searchPromptText,
|
searchPromptText,
|
||||||
translate: __,
|
translate: __,
|
||||||
labelField
|
labelField
|
||||||
|
@ -430,7 +434,7 @@ export default class NestedSelectControl extends React.Component<
|
||||||
{stack.map((options, index) => (
|
{stack.map((options, index) => (
|
||||||
<div key={index} className={cx('NestedSelect-menu')}>
|
<div key={index} className={cx('NestedSelect-menu')}>
|
||||||
{index === 0 ? searchInput : null}
|
{index === 0 ? searchInput : null}
|
||||||
{multiple && index === 0 ? (
|
{multiple && checkAll && index === 0 ? (
|
||||||
<div
|
<div
|
||||||
className={cx('NestedSelect-option', 'checkall')}
|
className={cx('NestedSelect-option', 'checkall')}
|
||||||
onMouseEnter={this.onMouseEnterAll}
|
onMouseEnter={this.onMouseEnterAll}
|
||||||
|
@ -440,7 +444,7 @@ export default class NestedSelectControl extends React.Component<
|
||||||
checked={partialChecked}
|
checked={partialChecked}
|
||||||
partial={partialChecked && !allChecked}
|
partial={partialChecked && !allChecked}
|
||||||
>
|
>
|
||||||
全选
|
{__(checkAllLabel)}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
Loading…
Reference in New Issue