update ctrl

This commit is contained in:
AntoXa PRO 2023-09-19 22:43:11 +03:00
parent a6c220b499
commit 20c21ea73d
2 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "axp-ts",
"version": "1.9.8",
"version": "1.9.9",
"description": "TypeScript helper library",
"author": "AntoXa PRO <info@antoxa.pro>",
"homepage": "https://antoxahub.ru/antoxa/axp-ts",

View File

@ -3,7 +3,6 @@ import type { TNotificationItem } from '../notification'
import { FormSchemaCtrl } from './ctrl'
/**
* Интерфейс базовой формы для сущностей в БД.
*/
@ -101,4 +100,9 @@ export class BaseFormModel<T extends object = {}> implements IFormModel<T> {
mergeObj(obj: any) {
this.obj = Object.assign(this.obj, obj)
}
updateCtrl(key: keyof T, ctrl: Partial<FormSchemaCtrl>) {
const fieldIndex = this.ctrls.findIndex(e => e.key === key)
this.ctrls[fieldIndex] = Object.assign(this.ctrls[fieldIndex], ctrl)
}
}