project: move mobx tools to @/utils/mobx
This commit is contained in:
parent
4215310adf
commit
20211630e5
@ -1,10 +1,10 @@
|
||||
import type { ProcessContext } from '../../types';
|
||||
import helper from '../lib/helper';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { reaction } from 'mobx';
|
||||
import { disposableReaction } from 'tools';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@ import { createValidationSchema } from '../validation';
|
||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { debouncedReaction } from '@/utils/mobx';
|
||||
import { uid } from 'radash';
|
||||
import { debouncedReaction } from 'tools';
|
||||
|
||||
const key = uid(7);
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@ import type * as Values from '@/Components/Calculation/config/map/values';
|
||||
import type * as Insurance from '@/Components/Calculation/Form/Insurance/InsuranceTable/types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import { reaction } from 'mobx';
|
||||
import { uid } from 'radash';
|
||||
import { disposableReaction } from 'tools';
|
||||
import type { BaseOption } from 'ui/elements/types';
|
||||
|
||||
function hasInvalidValueOrOptions(value: unknown, options: Array<BaseOption<unknown>>) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { disposableReaction, normalizeOptions } from 'tools';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import { normalizeOptions } from 'tools';
|
||||
|
||||
export default function unlimitedReactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $process } = store;
|
||||
|
||||
@ -2,8 +2,8 @@ import { createValidationSchema } from '../validation';
|
||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { debouncedReaction } from '@/utils/mobx';
|
||||
import { uid } from 'radash';
|
||||
import { debouncedReaction } from 'tools';
|
||||
|
||||
const key = uid(7);
|
||||
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { reaction } from 'mobx';
|
||||
import { first, sort } from 'radash';
|
||||
import { disposableReaction, normalizeOptions } from 'tools';
|
||||
import { normalizeOptions } from 'tools';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
|
||||
@ -7,12 +7,13 @@ import { selectObjectCategoryTax } from '@/config/default-options';
|
||||
import { STALE_TIME } from '@/constants/request';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { debouncedReaction, disposableReaction } from '@/utils/mobx';
|
||||
import type { QueryFunctionContext } from '@tanstack/react-query';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { reaction } from 'mobx';
|
||||
import { uid } from 'radash';
|
||||
import { debouncedReaction, disposableReaction, normalizeOptions } from 'tools';
|
||||
import { normalizeOptions } from 'tools';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
|
||||
@ -5,9 +5,10 @@ import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import { selectLeaseObjectUseFor } from '@/config/default-options';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { debouncedReaction } from '@/utils/mobx';
|
||||
import { comparer, reaction, toJS } from 'mobx';
|
||||
import { uid } from 'radash';
|
||||
import { debouncedReaction, normalizeOptions } from 'tools';
|
||||
import { normalizeOptions } from 'tools';
|
||||
|
||||
export function common({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $tables } = store;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import { reaction } from 'mobx';
|
||||
import { normalizeOptions } from 'tools/entity';
|
||||
import { disposableReaction } from 'tools/mobx';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $process } = store;
|
||||
|
||||
@ -2,9 +2,9 @@ import { createValidationSchema } from '../validation';
|
||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { debouncedReaction } from '@/utils/mobx';
|
||||
import { autorun } from 'mobx';
|
||||
import { uid } from 'radash';
|
||||
import { debouncedReaction } from 'tools';
|
||||
|
||||
const key = uid(7);
|
||||
|
||||
|
||||
@ -5,10 +5,10 @@ import { selectHighSeasonStart } from '@/config/default-options';
|
||||
import { MIN_PAYMENT } from '@/constants/values';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import type { Row } from '@/stores/tables/payments/types';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import { comparer, reaction, toJS } from 'mobx';
|
||||
import { shift } from 'radash';
|
||||
import { difference } from 'tools/array';
|
||||
import { disposableReaction } from 'tools/mobx';
|
||||
|
||||
const {
|
||||
generateSeasonPaymentsRows,
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import { VAT } from '@/constants/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import { reaction } from 'mobx';
|
||||
import { disposableReaction, round } from 'tools';
|
||||
import { round } from 'tools';
|
||||
|
||||
export default function reactions({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation, $process } = store;
|
||||
|
||||
@ -2,8 +2,8 @@ import { createValidationSchema } from '../validation';
|
||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { debouncedReaction } from '@/utils/mobx';
|
||||
import { uid } from 'radash';
|
||||
import { debouncedReaction } from 'tools';
|
||||
|
||||
const key = uid(7);
|
||||
|
||||
|
||||
@ -5,11 +5,12 @@ import { selectRequirementTelematic } from '@/config/default-options';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { Values } from '@/stores/calculation/values/types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { debouncedReaction, disposableReaction } from '@/utils/mobx';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { reaction } from 'mobx';
|
||||
import { uid } from 'radash';
|
||||
import { debouncedReaction, disposableReaction, normalizeOptions } from 'tools';
|
||||
import { normalizeOptions } from 'tools';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import type { AgentsFields, AgentsRewardConditionsFields, AgentsSumFields } from './types';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type RootStore from '@/stores/root';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import type { ApolloClient } from '@apollo/client';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { reaction } from 'mobx';
|
||||
import { normalizeOptions } from 'tools/entity';
|
||||
import { disposableReaction } from 'tools/mobx';
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@ import * as createReactions from '../lib/create-reactions';
|
||||
import * as fillAgentsFromLead from '../lib/fill-agents-from-lead';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import { disposableReaction } from '@/utils/mobx';
|
||||
import dayjs from 'dayjs';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
import { reaction } from 'mobx';
|
||||
import { disposableReaction } from 'tools/mobx';
|
||||
|
||||
const { fillIndAgent, fillCalcBroker, fillCalcDoubleAgent, fillFinDepartment } = fillAgentsFromLead;
|
||||
const { fillAgentRewardReaction, fillAgentRewardSummReaction } = createReactions;
|
||||
|
||||
@ -2,8 +2,8 @@ import { createValidationSchema } from '../validation';
|
||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import type { ProcessContext } from '@/process/types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { debouncedReaction } from '@/utils/mobx';
|
||||
import { uid } from 'radash';
|
||||
import { debouncedReaction } from 'tools';
|
||||
|
||||
const key = uid(7);
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@ import { createValidationSchema } from './validation';
|
||||
import type { Elements } from '@/Components/Calculation/config/map/values';
|
||||
import * as CRMTypes from '@/graphql/crm.types';
|
||||
import ValidationHelper from '@/stores/validation/helper';
|
||||
import { debouncedReaction } from '@/utils/mobx';
|
||||
import { reaction } from 'mobx';
|
||||
import { uid } from 'radash';
|
||||
import { debouncedReaction } from 'tools';
|
||||
|
||||
export function common({ store, apolloClient }: ProcessContext) {
|
||||
const { $calculation } = store;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
export * from './array';
|
||||
export * from './common';
|
||||
export * from './entity';
|
||||
export * from './mobx';
|
||||
export * from './number';
|
||||
export * from './object';
|
||||
|
||||
@ -11,8 +11,5 @@
|
||||
"eslint": "^8.35.0",
|
||||
"eslint-config-custom": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"mobx": "^6.8.0",
|
||||
"radash": "^10.8.1"
|
||||
}
|
||||
"dependencies": {}
|
||||
}
|
||||
|
||||
@ -7829,11 +7829,6 @@ radash@^10.7.0:
|
||||
resolved "https://registry.yarnpkg.com/radash/-/radash-10.7.0.tgz#aaa164f9697a440d848b88323d51d1bc4f39608a"
|
||||
integrity sha512-dz5NUcGnvn080kKJnyPtqVnP4MWoiwp5qQhEQFK/qMJxCjffQd8tMR4cybxy6y5hupYa5UkSlJRSRY2F7GPBxQ==
|
||||
|
||||
radash@^10.8.1:
|
||||
version "10.8.1"
|
||||
resolved "https://registry.yarnpkg.com/radash/-/radash-10.8.1.tgz#7a49fa1ec07381dba9174ddadf83401e1db293f9"
|
||||
integrity sha512-NzYo3XgM9Tzjf5iFPIMG2l5+LSOCi2H7Axe3Ry/1PrhlvuqxUoiLsmcTBtw4CfKtzy5Fzo79STiEj9JZWMfDQg==
|
||||
|
||||
rambda@^7.1.0:
|
||||
version "7.4.0"
|
||||
resolved "https://registry.yarnpkg.com/rambda/-/rambda-7.4.0.tgz#61ec9de31d3dd6affe804de3bae04a5b818781e5"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user