@deepkit/desktop-ui
Version:
Library for desktop UI widgets in Angular 10+
63 lines (55 loc) • 1.52 kB
text/typescript
/*
* Deepkit Framework
* Copyright (C) 2021 Deepkit UG, Marc J. Schmidt
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the MIT License.
*
* You should have received a copy of the MIT License along with this program.
*/
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
HostBinding,
HostListener,
Injector,
SkipSelf,
} from '@angular/core';
import { ngValueAccessor, ValueAccessorBase } from '../../core/form';
export class CheckboxComponent extends ValueAccessorBase<any> {
get tabIndex() {
return 1;
}
get isChecked() {
return true === this.innerValue;
}
public onClick() {
if (this.isDisabled) return;
this.touch();
this.innerValue = !this.innerValue;
}
constructor(
protected injector: Injector,
public readonly cd: ChangeDetectorRef,
public readonly cdParent: ChangeDetectorRef,
) {
super(injector, cd, cdParent);
}
}