mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-15 09:21:13 +08:00
fix:修复select组件在非可多选情况下,配置checkAll:true属性导致无法选中值的问题 (#4393)
Co-authored-by: ”jiatianqi“ <”jiatianqi@baidu.com“>
This commit is contained in:
parent
da82f8374a
commit
6a1e4fa595
@ -1124,10 +1124,8 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
||||
isOpen={this.state.isOpen}
|
||||
inputValue={inputValue}
|
||||
onChange={
|
||||
/*展示 Checkbox 的时候,会出发多次 onChange 原因待查*/ multiple ||
|
||||
checkAll
|
||||
? noop
|
||||
: this.handleChange
|
||||
/*展示 Checkbox 的时候,会出发多次 onChange 原因待查*/
|
||||
multiple ? noop : this.handleChange
|
||||
}
|
||||
onStateChange={this.handleStateChange}
|
||||
itemToString={item => (item ? `${item[labelField]}` : '')}
|
||||
|
@ -85,6 +85,18 @@ export interface SelectControlSchema extends FormOptionsControl {
|
||||
* 搜索 API
|
||||
*/
|
||||
searchApi?: SchemaApi;
|
||||
/**
|
||||
* 可多选条件下,是否可全选
|
||||
*/
|
||||
checkAll?: boolean;
|
||||
/**
|
||||
* 可多选条件下,是否默认全选中所有值
|
||||
*/
|
||||
defaultCheckAll?: boolean;
|
||||
/**
|
||||
* 可多选条件下,全选项文案,默认 ”全选“
|
||||
*/
|
||||
checkAllLabel?: string;
|
||||
}
|
||||
|
||||
export interface SelectProps extends OptionsControlProps {
|
||||
@ -412,9 +424,7 @@ export default class SelectControl extends React.Component<SelectProps, any> {
|
||||
onFocus={(e: any) => this.dispatchEvent('focus', e)}
|
||||
onAdd={() => this.dispatchEvent('add')}
|
||||
onEdit={(item: any) => this.dispatchEvent('edit', item)}
|
||||
onDelete={(item: any) =>
|
||||
this.dispatchEvent('delete', item)
|
||||
}
|
||||
onDelete={(item: any) => this.dispatchEvent('delete', item)}
|
||||
loading={loading}
|
||||
noResultsText={noResultsText}
|
||||
renderMenu={menuTpl ? this.renderMenu : undefined}
|
||||
|
Loading…
Reference in New Issue
Block a user