BaseTransfer新增change事件

This commit is contained in:
xujiahao01 2022-01-28 16:52:20 +08:00
parent 639f621f77
commit 8d46a49195
2 changed files with 6 additions and 16 deletions

View File

@ -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}
/>
);
}

View File

@ -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);
}