diff --git a/src/client/stores/CalculationStore/index.ts b/src/client/stores/CalculationStore/index.ts index 52b3c10..54bd715 100644 --- a/src/client/stores/CalculationStore/index.ts +++ b/src/client/stores/CalculationStore/index.ts @@ -50,13 +50,16 @@ const CalculationStore: ICalculationStore = observable( tableName: string, rowIndex: number, propName: string, - value: any + value: any, ) { this.tables[tableName].values[rowIndex][propName] = value; }, + deleteTableRow(tableName: string, rowIndex: number) { + this.tables[tableName].values.splice(rowIndex, 1); + }, }, - computedEffects - ) + computedEffects, + ), ); autorunEffects.map(autorunEffect => diff --git a/src/core/types/stores.ts b/src/core/types/stores.ts index 97a617f..7eb0957 100644 --- a/src/core/types/stores.ts +++ b/src/core/types/stores.ts @@ -26,4 +26,5 @@ export interface ICalculationStore { propName: string, value: any ) => void; + deleteTableRow: (tableName: string, rowIndex: number) => void; } diff --git a/src/core/types/tables.ts b/src/core/types/tables.ts index 464d2aa..3ebd909 100644 --- a/src/core/types/tables.ts +++ b/src/core/types/tables.ts @@ -1,8 +1,16 @@ +import { Status } from './statuses'; +export type TableNames = 'fruitTable'; +export type TableValuesNames = 'fruit' | 'number'; + +export type TTableValues = { + [propName in TableValuesNames]?: T; +}; + export type IStoreTable = { - [tableName: string]: { - values: Array; - options?: Array; - status?: Array; - filter?: Array; + [tableName in TableNames]: { + values: TTableValues[]; + options?: TTableValues[]; + status?: TTableValues[]; + filter?: TTableValues[]; }; };