UNPKG

@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.

170 lines (169 loc) 8.18 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Component, HostBinding, Input } from '@angular/core'; import { RecurrenceService } from './recurrence.service'; import { isPresent } from '../../common/util'; import { LocalizationService } from '@progress/kendo-angular-l10n'; import { NumericTextBoxComponent, NumericTextBoxCustomMessagesComponent } from '@progress/kendo-angular-inputs'; import { LabelComponent } from '@progress/kendo-angular-label'; import * as i0 from "@angular/core"; import * as i1 from "./recurrence.service"; import * as i2 from "@progress/kendo-angular-l10n"; /** * @hidden */ export class RecurrenceIntervalEditorComponent { recurrence; localization; cssClass = true; set userNumericOptions(options) { this.numericOptions = { ...this.numericOptions, ...options }; } intervalValue; numericOptions = { min: 1, format: '#', autoCorrect: true, step: 1, spinners: true }; constructor(recurrence, localization) { this.recurrence = recurrence; this.localization = localization; this.intervalValue = this.recurrence.rrule.interval || 1; } get currentFreq() { return this.recurrence.frequency; } onIntervalChange(newInterval) { if (isPresent(newInterval)) { this.recurrence.interval = newInterval; } } onIntervalBlur() { if (!isPresent(this.intervalValue)) { this.recurrence.interval = this.intervalValue = 1; } } textForRepeatEvery() { const freq = this.currentFreq; switch (freq) { case 'daily': return this.textFor('dailyRepeatEvery'); case 'weekly': return this.textFor('weeklyRepeatEvery'); case 'monthly': return this.textFor('monthlyRepeatEvery'); case 'yearly': return this.textFor('yearlyRepeatEvery'); default: break; } } textForFrequency() { const freq = this.currentFreq; switch (freq) { case 'daily': return this.textFor('dailyInterval'); case 'weekly': return this.textFor('weeklyInterval'); case 'monthly': return this.textFor('monthlyInterval'); case 'yearly': return this.textFor('yearlyInterval'); default: break; } } textFor(key) { return this.localization.get(key); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RecurrenceIntervalEditorComponent, deps: [{ token: i1.RecurrenceService }, { token: i2.LocalizationService }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: RecurrenceIntervalEditorComponent, isStandalone: true, selector: "kendo-recurrence-interval-editor", inputs: { userNumericOptions: "userNumericOptions" }, host: { properties: { "class.k-scheduler-recurrence-interval-editor": "this.cssClass" } }, ngImport: i0, template: ` <div class="k-form-field"> <kendo-label [for]="intervalNumeric" [text]="textForRepeatEvery()" labelCssClass="k-form-label" (click)="intervalNumeric.focus()" ></kendo-label> <div class="k-form-field-wrap"> <kendo-numerictextbox #intervalNumeric class="k-recur-interval" [min]="numericOptions.min" [max]="numericOptions.max" [decimals]="0" [format]="numericOptions.format" [autoCorrect]="numericOptions.autoCorrect" [readonly]="numericOptions.readonly" [selectOnFocus]="numericOptions.selectOnFocus" [spinners]="numericOptions.spinners" [step]="numericOptions.step" [title]="numericOptions.title" [(value)]="intervalValue" (blur)="onIntervalBlur()" (valueChange)="onIntervalChange($event)" > <kendo-numerictextbox-messages [increment]="textFor('numericIncrement')" [decrement]="textFor('numericDecrement')" > </kendo-numerictextbox-messages> </kendo-numerictextbox> <span>&nbsp;{{ textForFrequency() }}</span> </div> </div> `, isInline: true, dependencies: [{ kind: "component", type: LabelComponent, selector: "kendo-label", inputs: ["text", "for", "optional", "labelCssStyle", "labelCssClass"], exportAs: ["kendoLabel"] }, { kind: "component", type: NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode", "inputAttributes"], outputs: ["valueChange", "focus", "blur", "inputFocus", "inputBlur"], exportAs: ["kendoNumericTextBox"] }, { kind: "component", type: NumericTextBoxCustomMessagesComponent, selector: "kendo-numerictextbox-messages" }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RecurrenceIntervalEditorComponent, decorators: [{ type: Component, args: [{ selector: 'kendo-recurrence-interval-editor', template: ` <div class="k-form-field"> <kendo-label [for]="intervalNumeric" [text]="textForRepeatEvery()" labelCssClass="k-form-label" (click)="intervalNumeric.focus()" ></kendo-label> <div class="k-form-field-wrap"> <kendo-numerictextbox #intervalNumeric class="k-recur-interval" [min]="numericOptions.min" [max]="numericOptions.max" [decimals]="0" [format]="numericOptions.format" [autoCorrect]="numericOptions.autoCorrect" [readonly]="numericOptions.readonly" [selectOnFocus]="numericOptions.selectOnFocus" [spinners]="numericOptions.spinners" [step]="numericOptions.step" [title]="numericOptions.title" [(value)]="intervalValue" (blur)="onIntervalBlur()" (valueChange)="onIntervalChange($event)" > <kendo-numerictextbox-messages [increment]="textFor('numericIncrement')" [decrement]="textFor('numericDecrement')" > </kendo-numerictextbox-messages> </kendo-numerictextbox> <span>&nbsp;{{ textForFrequency() }}</span> </div> </div> `, standalone: true, imports: [LabelComponent, NumericTextBoxComponent, NumericTextBoxCustomMessagesComponent] }] }], ctorParameters: function () { return [{ type: i1.RecurrenceService }, { type: i2.LocalizationService }]; }, propDecorators: { cssClass: [{ type: HostBinding, args: ['class.k-scheduler-recurrence-interval-editor'] }], userNumericOptions: [{ type: Input }] } });