59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import {
|
|
modalActions,
|
|
modalData,
|
|
} from 'client/stores/CalculationStore/Data/modal';
|
|
import actionsEffects from 'client/stores/CalculationStore/Effects/action';
|
|
// import assignProperties from 'client/tools/assignProps';
|
|
import { ICalculationStore } from 'core/types/stores';
|
|
import { autorun, makeAutoObservable, reaction, when } from 'mobx';
|
|
import CommonStore from '../CommonStore';
|
|
import {
|
|
tablesActions,
|
|
tablesData,
|
|
valuesActions,
|
|
valuesData,
|
|
} from './Data/index';
|
|
import { staticData, staticDataAction } from './Data/staticEntities';
|
|
import autorunEffects from './Effects/autorun';
|
|
import computedEffects from './Effects/computed';
|
|
import reactionEffects from './Effects/reaction';
|
|
import whenEffects from './Effects/when';
|
|
|
|
const CalculationStore: ICalculationStore = makeAutoObservable(
|
|
Object.assign(
|
|
{},
|
|
// assignProperties(
|
|
// {},
|
|
staticData,
|
|
staticDataAction,
|
|
valuesData,
|
|
valuesActions,
|
|
tablesData,
|
|
tablesActions,
|
|
computedEffects,
|
|
actionsEffects,
|
|
modalData,
|
|
modalActions,
|
|
),
|
|
);
|
|
|
|
autorunEffects.map(autorunEffect =>
|
|
autorun(autorunEffect(CalculationStore, CommonStore)),
|
|
);
|
|
|
|
reactionEffects.map(reactionEffectBuilder => {
|
|
const reactionEffect = reactionEffectBuilder(CalculationStore);
|
|
return reaction(
|
|
reactionEffect.expression,
|
|
reactionEffect.effect,
|
|
reactionEffect.options,
|
|
);
|
|
});
|
|
|
|
whenEffects.map(whenEffectBuilder => {
|
|
const whenEffect = whenEffectBuilder(CalculationStore);
|
|
return when(whenEffect.predicate, whenEffect.effect);
|
|
});
|
|
|
|
export default CalculationStore;
|