pm-controls
Version:
ProModel Controls
54 lines (49 loc) • 1.42 kB
text/typescript
import {
ChangeDetectorRef,
Component,
Input,
Output,
EventEmitter,
} from '@angular/core';
export class CheckBoxComponent {
constructor(public changeDetectorRef: ChangeDetectorRef) { }
Label;
CheckBoxTheme: string = "check-box-default";
IsAnimated: boolean = true;
IsReadOnly: boolean;
IsChecked: boolean;
IsDisabled: boolean;
IsCheckedChange: EventEmitter<any> = new EventEmitter<any>();
CheckBoxStateClass: string;
OnClick() {
if (this.IsReadOnly || this.IsDisabled) return;
this.CheckBoxStateClass = "check-box-click-animate";
this.IsChecked = !this.IsChecked;
this.IsCheckedChange.emit(this.IsChecked);
this.changeDetectorRef.detectChanges();
}
get CheckBoxClass() {
if (this.IsChecked) {
if (this.IsDisabled)
return "is-checked-disabled";
return this.CheckBoxTheme;
}
else {
if (this.IsDisabled)
return "is-unchecked-disabled";
return "is-unchecked";
}
}
}