update recipe detail

This commit is contained in:
Kenta420 2023-11-27 19:58:07 +07:00
parent d52cad09fd
commit 9279ef0247
11 changed files with 58 additions and 123 deletions

View file

@ -68,7 +68,6 @@ export class RecipeDetailsComponent implements OnInit {
isUse: false,
isShow: false,
disable: false,
recipeListData: this._formBuilder.array([]),
});
ngOnInit() {
@ -83,6 +82,8 @@ export class RecipeDetailsComponent implements OnInit {
this.recipeOriginalDetail = { ...this.recipeDetailForm.getRawValue() };
});
this.recipeDetailForm.valueChanges.subscribe(this.onRecipeDetailFormChange);
// snap recipe detail form value
this.actionRecord.registerOnAddAction((currAction, allAction) => {
@ -144,10 +145,14 @@ export class RecipeDetailsComponent implements OnInit {
}
}
get isValueChanged() {
return !isEqual(
this.recipeOriginalDetail,
this.recipeDetailForm.getRawValue()
);
isValueChanged: boolean = false;
onRecipeDetailFormChange(recipeDetail: typeof this.recipeDetailForm.value) {
console.log('Recipe Detail Form Changed', recipeDetail);
}
onRecipeListFormChange(isValueChanged: boolean) {
console.log('Recipe List Form Changed', isValueChanged);
this.isValueChanged ||= isValueChanged;
}
}