@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.
118 lines (113 loc) • 6.58 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 { 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 { NgIf, 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: "16.2.12", ngImport: i0, type: AgendaTaskItemComponent, deps: [{ token: i1.LocalizationService }, { token: i2.IntlService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", 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">
<span class="k-scheduler-mark" *ngIf="eventColor" [style.background-color]="eventColor"></span>
<kendo-icon-wrapper *ngIf="isRecurrence" name="arrow-rotate-cw" [svgIcon]="arrowRotateCWIcon"></kendo-icon-wrapper>
<kendo-icon-wrapper *ngIf="isRecurrenceException" name="arrows-no-repeat" [svgIcon]="arrowsNoRepeatIcon"></kendo-icon-wrapper>
<ng-container *ngIf="!eventTemplate">
{{item?.title }}
</ng-container>
<ng-container *ngIf="eventTemplate" [ngTemplateOutlet]="eventTemplate"
[ngTemplateOutletContext]="{ $implicit: item.event, event: item.event, resources: item.resources }">
</ng-container>
<span *ngIf="removable" 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: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: "16.2.12", 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">
<span class="k-scheduler-mark" *ngIf="eventColor" [style.background-color]="eventColor"></span>
<kendo-icon-wrapper *ngIf="isRecurrence" name="arrow-rotate-cw" [svgIcon]="arrowRotateCWIcon"></kendo-icon-wrapper>
<kendo-icon-wrapper *ngIf="isRecurrenceException" name="arrows-no-repeat" [svgIcon]="arrowsNoRepeatIcon"></kendo-icon-wrapper>
<ng-container *ngIf="!eventTemplate">
{{item?.title }}
</ng-container>
<ng-container *ngIf="eventTemplate" [ngTemplateOutlet]="eventTemplate"
[ngTemplateOutletContext]="{ $implicit: item.event, event: item.event, resources: item.resources }">
</ng-container>
<span *ngIf="removable" 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: [NgIf, IconWrapperComponent, NgTemplateOutlet]
}]
}], ctorParameters: function () { return [{ 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']
}] } });