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.

138 lines (133 loc) 6.63 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, Input, ChangeDetectionStrategy, TemplateRef, HostBinding } from '@angular/core'; import { LocalizationService } from '@progress/kendo-angular-l10n'; import { toLocalDate } from '@progress/kendo-date-math'; import { arrowRotateCwIcon, arrowsNoRepeatIcon, xIcon } from '@progress/kendo-svg-icons'; import { isRecurrence, isRecurrenceException, formatEventTime } from '../utils'; import { IconWrapperComponent } from '@progress/kendo-angular-icons'; import { NgTemplateOutlet } from '@angular/common'; import { IntlService } from '@progress/kendo-angular-intl'; import * as i0 from "@angular/core"; import * as i1 from "@progress/kendo-angular-l10n"; import * as i2 from "@progress/kendo-angular-intl"; /** * @hidden */ export class AgendaTaskItemComponent { localization; intl; arrowRotateCWIcon = arrowRotateCwIcon; arrowsNoRepeatIcon = arrowsNoRepeatIcon; xIcon = xIcon; item; color; eventTemplate; editable; cellClass = true; get eventTitle() { const start = toLocalDate(this.item.start); const end = toLocalDate(this.item.end); const time = formatEventTime(start, end, this.item.isAllDay, this.intl.localeId); return `${time}, ${this.item.event.title}`; } get eventColor() { return this.item.color; } get deleteMessage() { return this.localization.get('deleteTitle'); } get isRecurrence() { return isRecurrence(this.item); } get isRecurrenceException() { return isRecurrenceException(this.item); } get removable() { return this.editable && this.editable.remove !== false; } constructor(localization, intl) { this.localization = localization; this.intl = intl; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AgendaTaskItemComponent, deps: [{ token: i1.LocalizationService }, { token: i2.IntlService }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: AgendaTaskItemComponent, isStandalone: true, selector: "[kendoSchedulerAgendaTaskItem]", inputs: { item: ["kendoSchedulerAgendaTaskItem", "item"], color: "color", eventTemplate: "eventTemplate", editable: "editable" }, host: { properties: { "class.k-scheduler-cell": "this.cellClass", "attr.aria-label": "this.eventTitle" } }, ngImport: i0, template: ` <div class="k-task" [title]="item.title"> @if (eventColor) { <span class="k-scheduler-mark" [style.background-color]="eventColor"></span> } @if (isRecurrence) { <kendo-icon-wrapper name="arrow-rotate-cw" [svgIcon]="arrowRotateCWIcon"></kendo-icon-wrapper> } @if (isRecurrenceException) { <kendo-icon-wrapper name="arrows-no-repeat" [svgIcon]="arrowsNoRepeatIcon"></kendo-icon-wrapper> } @if (!eventTemplate) { {{item?.title }} } @if (eventTemplate) { <ng-container [ngTemplateOutlet]="eventTemplate" [ngTemplateOutletContext]="{ $implicit: item.event, event: item.event, resources: item.resources }"> </ng-container> } @if (removable) { <span class="k-link k-event-delete" aria-hidden="true" [attr.title]="deleteMessage"> <kendo-icon-wrapper name="x" [svgIcon]="xIcon"></kendo-icon-wrapper> </span> } </div> `, isInline: true, dependencies: [{ kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AgendaTaskItemComponent, decorators: [{ type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, // eslint-disable-next-line @angular-eslint/component-selector selector: '[kendoSchedulerAgendaTaskItem]', template: ` <div class="k-task" [title]="item.title"> @if (eventColor) { <span class="k-scheduler-mark" [style.background-color]="eventColor"></span> } @if (isRecurrence) { <kendo-icon-wrapper name="arrow-rotate-cw" [svgIcon]="arrowRotateCWIcon"></kendo-icon-wrapper> } @if (isRecurrenceException) { <kendo-icon-wrapper name="arrows-no-repeat" [svgIcon]="arrowsNoRepeatIcon"></kendo-icon-wrapper> } @if (!eventTemplate) { {{item?.title }} } @if (eventTemplate) { <ng-container [ngTemplateOutlet]="eventTemplate" [ngTemplateOutletContext]="{ $implicit: item.event, event: item.event, resources: item.resources }"> </ng-container> } @if (removable) { <span class="k-link k-event-delete" aria-hidden="true" [attr.title]="deleteMessage"> <kendo-icon-wrapper name="x" [svgIcon]="xIcon"></kendo-icon-wrapper> </span> } </div> `, standalone: true, imports: [IconWrapperComponent, NgTemplateOutlet] }] }], ctorParameters: () => [{ type: i1.LocalizationService }, { type: i2.IntlService }], propDecorators: { item: [{ type: Input, args: ["kendoSchedulerAgendaTaskItem"] }], color: [{ type: Input }], eventTemplate: [{ type: Input }], editable: [{ type: Input }], cellClass: [{ type: HostBinding, args: ["class.k-scheduler-cell"] }], eventTitle: [{ type: HostBinding, args: ['attr.aria-label'] }] } });