stores/options: remove auto set value functional
This commit is contained in:
parent
7fdd21af22
commit
0655eaa822
@ -7,20 +7,6 @@ import { makeAutoObservable } from 'mobx';
|
||||
import type RootStore from 'stores/root';
|
||||
import type { CalculationOptions } from './types';
|
||||
|
||||
const AUTO_SET_VALUE_ELEMENTS: Elements[] = [
|
||||
'selectProduct',
|
||||
'selectLeaseObjectType',
|
||||
'selectBrand',
|
||||
'selectModel',
|
||||
'selectConfiguration',
|
||||
'selectTracker',
|
||||
'selectTelematic',
|
||||
'selectTechnicalCard',
|
||||
'selectFuelCard',
|
||||
'selectRegistration',
|
||||
'selectTownRegistration',
|
||||
];
|
||||
|
||||
export default class OptionsStore {
|
||||
root: RootStore;
|
||||
options: CalculationOptions = defaultOptions;
|
||||
@ -63,18 +49,6 @@ export default class OptionsStore {
|
||||
this.options[elementName] = options as BaseOption<any>[];
|
||||
|
||||
this.checkValueInOptions(elementName);
|
||||
|
||||
/**
|
||||
* Если в новом списке одна запись, то указываем ее
|
||||
* (для элементов из списка {@link AUTO_SET_VALUE_ELEMENTS})
|
||||
*/
|
||||
if (options?.length === 1 && AUTO_SET_VALUE_ELEMENTS.includes(elementName)) {
|
||||
const optionValue = options.at(0)?.value;
|
||||
|
||||
if (optionValue) {
|
||||
this.root.$calculation.setElementValue(elementName, optionValue);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
resetOptions = <T extends Elements>(elementName: T) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user