@deepkit/desktop-ui
Version:
Library for desktop UI widgets in Angular 10+
53 lines (45 loc) • 1.4 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 { ChangeDetectorRef, Component, HostBinding, HostListener, Injector, Input, SkipSelf } from '@angular/core';
import { ngValueAccessor, ValueAccessorBase } from '../../core/form';
export class RadioboxComponent<T> extends ValueAccessorBase<T> {
value?: T;
get tabIndex() {
return 1;
}
get isChecked() {
return this.value === this.innerValue;
}
constructor(
protected injector: Injector,
public readonly cd: ChangeDetectorRef,
public readonly cdParent: ChangeDetectorRef,
) {
super(injector, cd, cdParent);
}
public onClick() {
if (this.isDisabled) return;
this.innerValue = this.value;
this.touch();
}
}