Added disable mod
This commit is contained in:
parent
5118b21f26
commit
440e5eb67b
@ -16,7 +16,6 @@
|
||||
|
||||
import { Component, forwardRef, Input, OnInit } from '@angular/core';
|
||||
import {
|
||||
AbstractControl,
|
||||
ControlValueAccessor,
|
||||
FormBuilder,
|
||||
FormGroup,
|
||||
@ -44,7 +43,11 @@ export class AlarmDynamicValue implements ControlValueAccessor, OnInit{
|
||||
public dynamicValueSourceTypeTranslations = dynamicValueSourceTypeTranslationMap;
|
||||
private propagateChange = (v: any) => { };
|
||||
|
||||
@Input() helpId: string;
|
||||
@Input()
|
||||
helpId: string;
|
||||
|
||||
@Input()
|
||||
disabled: boolean;
|
||||
|
||||
constructor(private fb: FormBuilder) {
|
||||
}
|
||||
@ -81,6 +84,15 @@ export class AlarmDynamicValue implements ControlValueAccessor, OnInit{
|
||||
}
|
||||
}
|
||||
|
||||
setDisabledState(isDisabled: boolean): void {
|
||||
this.disabled = isDisabled;
|
||||
if (this.disabled) {
|
||||
this.dynamicValue.disable({emitEvent: false});
|
||||
} else {
|
||||
this.dynamicValue.enable({emitEvent: false});
|
||||
}
|
||||
}
|
||||
|
||||
private updateModel() {
|
||||
this.propagateChange(this.dynamicValue.value);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user