Browse Source

Fixed imposible to save new boolean attribute

pull/5305/head
ArtemDzhereleiko 5 years ago
parent
commit
3d9003b11d
  1. 6
      ui-ngx/src/app/shared/components/value-input.component.ts

6
ui-ngx/src/app/shared/components/value-input.component.ts

@ -17,7 +17,7 @@
import { Component, forwardRef, Input, OnInit, ViewChild } from '@angular/core'; import { Component, forwardRef, Input, OnInit, ViewChild } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR, NgForm } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, NgForm } from '@angular/forms';
import { ValueType, valueTypesMap } from '@shared/models/constants'; import { ValueType, valueTypesMap } from '@shared/models/constants';
import { isObject } from '@core/utils'; import { isObject, isDefinedAndNotNull } from '@core/utils';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { import {
JsonObjectEditDialogComponent, JsonObjectEditDialogComponent,
@ -114,7 +114,7 @@ export class ValueInputComponent implements OnInit, ControlValueAccessor {
} }
updateView() { updateView() {
if (this.inputForm.valid || this.valueType === ValueType.BOOLEAN) { if (this.inputForm.valid || this.valueType === ValueType.BOOLEAN || this.valueType === ValueType.JSON) {
this.propagateChange(this.modelValue); this.propagateChange(this.modelValue);
} else { } else {
this.propagateChange(null); this.propagateChange(null);
@ -124,7 +124,7 @@ export class ValueInputComponent implements OnInit, ControlValueAccessor {
onValueTypeChanged() { onValueTypeChanged() {
if (this.valueType === ValueType.BOOLEAN) { if (this.valueType === ValueType.BOOLEAN) {
this.modelValue = false; this.modelValue = false;
} if (this.valueType === ValueType.JSON) { } else if (this.valueType === ValueType.JSON) {
this.modelValue = {}; this.modelValue = {};
} else { } else {
this.modelValue = null; this.modelValue = null;

Loading…
Cancel
Save