UI: set value of not option to false if relation type cleared
This commit is contained in:
parent
0968de8881
commit
f77ad0d3ad
@ -27,10 +27,7 @@
|
||||
<div class="tb-form-table-row align-start"
|
||||
*ngFor="let relationFilterControl of relationFiltersFormArray.controls; let $index = index">
|
||||
<mat-chip-listbox *ngIf="enableNotOption" class="flex-18 center-stretch" [formControl]="relationFilterControl.get('negate')">
|
||||
<mat-chip-option color="primary" [value]="true"
|
||||
[disabled]="!relationFilterControl.get('relationType').value">
|
||||
{{ 'relation.not' | translate}}
|
||||
</mat-chip-option>
|
||||
<mat-chip-option color="primary" [value]="true">{{ 'relation.not' | translate }}</mat-chip-option>
|
||||
</mat-chip-listbox>
|
||||
<tb-relation-type-autocomplete subscriptSizing="dynamic"
|
||||
class="flex-50" showLabel="false"
|
||||
|
||||
@ -128,7 +128,17 @@ export class RelationFiltersComponent extends PageComponent implements ControlVa
|
||||
entityTypes: [filter ? filter.entityTypes : []]
|
||||
});
|
||||
if (this.enableNotOption) {
|
||||
formGroup.addControl('negate', this.fb.control(filter ? filter.negate : false));
|
||||
formGroup.addControl('negate', this.fb.control({value: filter ? filter.negate : false, disabled: true}));
|
||||
formGroup.get('relationType').valueChanges.pipe(
|
||||
takeUntil(this.destroy$)
|
||||
).subscribe(value => {
|
||||
if (value) {
|
||||
formGroup.get('negate').enable({emitEvent: false});
|
||||
} else {
|
||||
formGroup.get('negate').setValue(false, {emitEvent:false});
|
||||
formGroup.get('negate').disable({emitEvent: false});
|
||||
}
|
||||
});
|
||||
}
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user