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 { Component, forwardRef, Input, OnInit } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
AbstractControl,
|
|
||||||
ControlValueAccessor,
|
ControlValueAccessor,
|
||||||
FormBuilder,
|
FormBuilder,
|
||||||
FormGroup,
|
FormGroup,
|
||||||
@ -44,7 +43,11 @@ export class AlarmDynamicValue implements ControlValueAccessor, OnInit{
|
|||||||
public dynamicValueSourceTypeTranslations = dynamicValueSourceTypeTranslationMap;
|
public dynamicValueSourceTypeTranslations = dynamicValueSourceTypeTranslationMap;
|
||||||
private propagateChange = (v: any) => { };
|
private propagateChange = (v: any) => { };
|
||||||
|
|
||||||
@Input() helpId: string;
|
@Input()
|
||||||
|
helpId: string;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
disabled: boolean;
|
||||||
|
|
||||||
constructor(private fb: FormBuilder) {
|
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() {
|
private updateModel() {
|
||||||
this.propagateChange(this.dynamicValue.value);
|
this.propagateChange(this.dynamicValue.value);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user