add remove row action && table types
This commit is contained in:
parent
51b54abd2b
commit
2d0e254f0e
@ -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 =>
|
||||
|
||||
@ -26,4 +26,5 @@ export interface ICalculationStore {
|
||||
propName: string,
|
||||
value: any
|
||||
) => void;
|
||||
deleteTableRow: (tableName: string, rowIndex: number) => void;
|
||||
}
|
||||
|
||||
@ -1,8 +1,16 @@
|
||||
import { Status } from './statuses';
|
||||
export type TableNames = 'fruitTable';
|
||||
export type TableValuesNames = 'fruit' | 'number';
|
||||
|
||||
export type TTableValues<T> = {
|
||||
[propName in TableValuesNames]?: T;
|
||||
};
|
||||
|
||||
export type IStoreTable = {
|
||||
[tableName: string]: {
|
||||
values: Array<any>;
|
||||
options?: Array<any>;
|
||||
status?: Array<any>;
|
||||
filter?: Array<any>;
|
||||
[tableName in TableNames]: {
|
||||
values: TTableValues<any>[];
|
||||
options?: TTableValues<any>[];
|
||||
status?: TTableValues<Status>[];
|
||||
filter?: TTableValues<any>[];
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user