|
@@ -2,7 +2,7 @@
|
|
/* eslint-disable max-len */
|
|
/* eslint-disable max-len */
|
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
import KeyCode from '../utils/keyCode';
|
|
import KeyCode from '../utils/keyCode';
|
|
-import { isNumber, isString, isEqual } from 'lodash-es';
|
|
|
|
|
|
+import { isNumber, isString, isEqual, omit } from 'lodash-es';
|
|
import warning from '../utils/warning';
|
|
import warning from '../utils/warning';
|
|
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
import { BasicOptionProps } from './optionFoundation';
|
|
import { BasicOptionProps } from './optionFoundation';
|
|
@@ -230,9 +230,9 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
selections.set(optionExist.label, optionExist);
|
|
selections.set(optionExist.label, optionExist);
|
|
} else if (noMatchOptionInList) {
|
|
} else if (noMatchOptionInList) {
|
|
// If the current value does not have a corresponding item in the optionList, construct an option and update it to the selection. However, it does not need to be inserted into the list
|
|
// If the current value does not have a corresponding item in the optionList, construct an option and update it to the selection. However, it does not need to be inserted into the list
|
|
- let optionNotExist = { value: propValue, label: propValue, _notExist: true };
|
|
|
|
|
|
+ let optionNotExist = { value: propValue, label: propValue, _notExist: true, _scrollIndex: -1 } as BasicOptionProps;
|
|
if (onChangeWithObject) {
|
|
if (onChangeWithObject) {
|
|
- optionNotExist = { ...propValue as BasicOptionProps, _notExist: true } as any;
|
|
|
|
|
|
+ optionNotExist = { ...propValue as BasicOptionProps, _notExist: true, _scrollIndex: -1 };
|
|
}
|
|
}
|
|
selections.set(optionNotExist.label, optionNotExist);
|
|
selections.set(optionNotExist.label, optionNotExist);
|
|
}
|
|
}
|
|
@@ -277,7 +277,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
// The current value does not exist in the current optionList or the list before the change. Construct an option and update it to the selection
|
|
// The current value does not exist in the current optionList or the list before the change. Construct an option and update it to the selection
|
|
let optionNotExist = { value: selectedValue, label: selectedValue, _notExist: true };
|
|
let optionNotExist = { value: selectedValue, label: selectedValue, _notExist: true };
|
|
onChangeWithObject ? (optionNotExist = { ...propValue[i] as any, _notExist: true }) : null;
|
|
onChangeWithObject ? (optionNotExist = { ...propValue[i] as any, _notExist: true }) : null;
|
|
- selections.set(optionNotExist.label, optionNotExist);
|
|
|
|
|
|
+ selections.set(optionNotExist.label, { ...optionNotExist, _scrollIndex: -1 });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -409,7 +409,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
this._notifyDeselect(value, { value, label, ...rest });
|
|
this._notifyDeselect(value, { value, label, ...rest });
|
|
selections.delete(label);
|
|
selections.delete(label);
|
|
} else if (maxLimit && selections.size === maxLimit) {
|
|
} else if (maxLimit && selections.size === maxLimit) {
|
|
- this._adapter.notifyMaxLimit({ value, label, ...rest });
|
|
|
|
|
|
+ this._adapter.notifyMaxLimit({ value, label, ...omit(rest, '_scrollIndex') });
|
|
return;
|
|
return;
|
|
} else {
|
|
} else {
|
|
this._notifySelect(value, { value, label, ...rest });
|
|
this._notifySelect(value, { value, label, ...rest });
|
|
@@ -787,6 +787,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
delete option._parentGroup;
|
|
delete option._parentGroup;
|
|
delete option._show;
|
|
delete option._show;
|
|
delete option._selected;
|
|
delete option._selected;
|
|
|
|
+ delete option._scrollIndex;
|
|
if ('_keyInOptionList' in option) {
|
|
if ('_keyInOptionList' in option) {
|
|
option.key = option._keyInOptionList;
|
|
option.key = option._keyInOptionList;
|
|
delete option._keyInOptionList;
|
|
delete option._keyInOptionList;
|