mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 12:38:53 +08:00
BaseTransfer新增change事件
This commit is contained in:
parent
639f621f77
commit
8d46a49195
@ -116,7 +116,6 @@ export default class SelectControl extends React.Component<SelectProps, any> {
|
||||
super(props);
|
||||
|
||||
this.changeValue = this.changeValue.bind(this);
|
||||
this.otherChangeValue = this.otherChangeValue.bind(this);
|
||||
this.lazyloadRemote = debouce(this.loadRemote.bind(this), 250, {
|
||||
trailing: true,
|
||||
leading: false
|
||||
@ -223,20 +222,6 @@ export default class SelectControl extends React.Component<SelectProps, any> {
|
||||
onChange(newValue);
|
||||
}
|
||||
|
||||
otherChangeValue(newValue: Option | Array<Option> | string | void) {
|
||||
const {
|
||||
onChange,
|
||||
options,
|
||||
dispatchEvent
|
||||
} = this.props;
|
||||
|
||||
dispatchEvent('change', {
|
||||
value: newValue,
|
||||
options
|
||||
});
|
||||
onChange(newValue);
|
||||
}
|
||||
|
||||
async loadRemote(input: string) {
|
||||
const {
|
||||
autoComplete,
|
||||
@ -330,7 +315,6 @@ export default class SelectControl extends React.Component<SelectProps, any> {
|
||||
<TransferDropdownRenderer
|
||||
{...rest}
|
||||
selectMode={selectMode === 'group' ? 'list' : selectMode}
|
||||
onChange={this.otherChangeValue}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -136,6 +136,7 @@ export class BaseTransferRenderer<
|
||||
valueField,
|
||||
extractValue,
|
||||
options,
|
||||
dispatchEvent,
|
||||
setOptions
|
||||
} = this.props;
|
||||
let newValue: any = value;
|
||||
@ -178,6 +179,11 @@ export class BaseTransferRenderer<
|
||||
|
||||
(newOptions.length > options.length || optionModified) &&
|
||||
setOptions(newOptions, true);
|
||||
|
||||
dispatchEvent('change', {
|
||||
value: newValue,
|
||||
options
|
||||
});
|
||||
onChange(newValue);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user