From 2d23c56a5f3c94d8d4a1182ac6e2218a2e7ab3a3 Mon Sep 17 00:00:00 2001 From: Chika Date: Thu, 23 Jun 2022 17:09:02 +0300 Subject: [PATCH] store(insurance): few renaming --- .../Calculation/Form/Insurance/InsuranceTable/config.tsx | 2 +- .../Calculation/Form/Insurance/InsuranceTable/types.ts | 6 +++--- config/tables/insurance-table.ts | 2 +- stores/tables/insurance/hooks.js | 8 ++++---- stores/tables/insurance/index.ts | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx b/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx index 7c6e205..8464cee 100644 --- a/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx +++ b/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx @@ -6,7 +6,7 @@ import Select from 'Elements/Select'; import { buildOptionComponent, buildValueComponent } from './builders'; import type * as Insurance from './types'; -export const columns: ColumnsType = [ +export const columns: ColumnsType = [ { key: 'policyType', dataIndex: 'policyType', diff --git a/Components/Calculation/Form/Insurance/InsuranceTable/types.ts b/Components/Calculation/Form/Insurance/InsuranceTable/types.ts index c47c852..be4df17 100644 --- a/Components/Calculation/Form/Insurance/InsuranceTable/types.ts +++ b/Components/Calculation/Form/Insurance/InsuranceTable/types.ts @@ -1,6 +1,6 @@ import type { BaseOption, Status } from 'Elements/types'; -export type Row = { +export type RowValues = { key: string; policyType: string; insuranceCompany: string | null; @@ -9,10 +9,10 @@ export type Row = { insTerm: 100_000_000 | 100_000_001 | null; }; -export type Keys = keyof Row; +export type Keys = keyof RowValues; type Options = { - [Key in keyof Row]?: BaseOption[]; + [ValueName in keyof RowValues]?: BaseOption[]; }; export type RowOptions = Omit & { key: string }; diff --git a/config/tables/insurance-table.ts b/config/tables/insurance-table.ts index ef4f52a..2dab343 100644 --- a/config/tables/insurance-table.ts +++ b/config/tables/insurance-table.ts @@ -119,7 +119,7 @@ export const defaultOptions: Insurance.RowOptions[] = [ }, ]; -export const defaultRows: Insurance.Row[] = [ +export const defaultValues: Insurance.RowValues[] = [ { key: 'osago', policyType: 'ОСАГО', diff --git a/stores/tables/insurance/hooks.js b/stores/tables/insurance/hooks.js index 1b2c008..fe750ab 100644 --- a/stores/tables/insurance/hooks.js +++ b/stores/tables/insurance/hooks.js @@ -17,15 +17,15 @@ export function useRowValue(key, valueName) { export function useRowOptions(key) { const { $tables } = useStore(); - const options = $tables.insurance.getRowOptions(key); + const rowOptions = $tables.insurance.getRowOptions(key); - return options; + return rowOptions; } export function useRowStatuses(key) { const { $tables } = useStore(); - const statuses = $tables.insurance.getRowStatuses(key); + const rowStatuses = $tables.insurance.getRowStatuses(key); - return statuses; + return rowStatuses; } diff --git a/stores/tables/insurance/index.ts b/stores/tables/insurance/index.ts index 219e6aa..5f91f3f 100644 --- a/stores/tables/insurance/index.ts +++ b/stores/tables/insurance/index.ts @@ -6,14 +6,14 @@ import { makeAutoObservable } from 'mobx'; import type RootStore from 'stores/root'; export interface InsuranceTableData { - values: Insurance.Row[]; + values: Insurance.RowValues[]; options: Insurance.RowOptions[]; statuses: Insurance.RowStatuses[]; } export default class InsuranceTable { root: RootStore; - values: Insurance.Row[] = insuranceTableConfig.defaultRows; + values: Insurance.RowValues[] = insuranceTableConfig.defaultValues; options: Insurance.RowOptions[] = insuranceTableConfig.defaultOptions; statuses: Insurance.RowStatuses[] = insuranceTableConfig.defaultStatuses; @@ -38,7 +38,7 @@ export default class InsuranceTable { return this.values[rowIndex][valueName]; } - setRowValues = (key: string, row: Partial) => { + setRowValues = (key: string, row: Partial) => { const rowIndex = this.values.findIndex((x) => x.key === key); if (rowIndex >= 0) {