@progress/kendo-angular-scheduler
Version:
Kendo UI Scheduler Angular - Outlook or Google-style angular scheduler calendar. Full-featured and customizable embedded scheduling from the creator developers trust for professional UI components.
78 lines (77 loc) • 3.6 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Directive, Input, HostBinding, Renderer2, ElementRef, ChangeDetectorRef } from "@angular/core";
import { RecurrenceService } from './recurrence.service';
import * as i0 from "@angular/core";
import * as i1 from "./recurrence.service";
/**
* @hidden
*/
export class EndRuleRadioButtonDirective {
el;
renderer;
recurrence;
changeDetector;
type = 'radio';
radioClass = true;
radioSizeClass = true;
endRuleId;
destroyClick;
endRule;
constructor(el, renderer, recurrence, changeDetector) {
this.el = el;
this.renderer = renderer;
this.recurrence = recurrence;
this.changeDetector = changeDetector;
this.destroyClick = this.renderer.listen(this.elem, 'click', this.onClick.bind(this));
}
ngOnInit() {
this.endRule = this.endRuleId.split('-')[2];
this.renderer.setAttribute(this.elem, 'id', this.endRuleId);
this.renderer.setAttribute(this.elem, 'name', `end-${this.endRuleId.split('-').pop()}`);
}
ngAfterContentChecked() {
this.setCheckedState();
}
ngOnDestroy() {
if (this.destroyClick) {
this.destroyClick();
}
}
onClick() {
if (this.elem.checked) {
this.recurrence.endRule = this.endRule;
this.changeDetector.markForCheck();
}
}
setCheckedState() {
const isChecked = this.endRule === this.recurrence.endRule;
this.renderer.setProperty(this.elem, 'checked', isChecked);
}
get elem() {
return this.el.nativeElement;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EndRuleRadioButtonDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1.RecurrenceService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: EndRuleRadioButtonDirective, isStandalone: true, selector: "[kendoRecurrenceEndRuleRadioButton]", inputs: { endRuleId: ["kendoRecurrenceEndRuleRadioButton", "endRuleId"] }, host: { properties: { "attr.type": "this.type", "class.k-radio": "this.radioClass", "class.k-radio-md": "this.radioSizeClass" } }, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EndRuleRadioButtonDirective, decorators: [{
type: Directive,
args: [{
selector: '[kendoRecurrenceEndRuleRadioButton]',
standalone: true
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.RecurrenceService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { type: [{
type: HostBinding,
args: ['attr.type']
}], radioClass: [{
type: HostBinding,
args: ['class.k-radio']
}], radioSizeClass: [{
type: HostBinding,
args: ['class.k-radio-md']
}], endRuleId: [{
type: Input,
args: ["kendoRecurrenceEndRuleRadioButton"]
}] } });