Commit 3d9003b11d2c3af2bdd449d07c85bbe9734a7241

Authored by ArtemDzhereleiko
1 parent 75817a16

Fixed imposible to save new boolean attribute

... ... @@ -17,7 +17,7 @@
17 17 import { Component, forwardRef, Input, OnInit, ViewChild } from '@angular/core';
18 18 import { ControlValueAccessor, NG_VALUE_ACCESSOR, NgForm } from '@angular/forms';
19 19 import { ValueType, valueTypesMap } from '@shared/models/constants';
20   -import { isObject } from '@core/utils';
  20 +import { isObject, isDefinedAndNotNull } from '@core/utils';
21 21 import { MatDialog } from '@angular/material/dialog';
22 22 import {
23 23 JsonObjectEditDialogComponent,
... ... @@ -114,7 +114,7 @@ export class ValueInputComponent implements OnInit, ControlValueAccessor {
114 114 }
115 115
116 116 updateView() {
117   - if (this.inputForm.valid || this.valueType === ValueType.BOOLEAN) {
  117 + if (this.inputForm.valid || this.valueType === ValueType.BOOLEAN || this.valueType === ValueType.JSON) {
118 118 this.propagateChange(this.modelValue);
119 119 } else {
120 120 this.propagateChange(null);
... ... @@ -124,7 +124,7 @@ export class ValueInputComponent implements OnInit, ControlValueAccessor {
124 124 onValueTypeChanged() {
125 125 if (this.valueType === ValueType.BOOLEAN) {
126 126 this.modelValue = false;
127   - } if (this.valueType === ValueType.JSON) {
  127 + } else if (this.valueType === ValueType.JSON) {
128 128 this.modelValue = {};
129 129 } else {
130 130 this.modelValue = null;
... ...