@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.
175 lines (174 loc) • 9.56 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, forwardRef, Input, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { LocalizationService } from '@progress/kendo-angular-l10n';
import { SchedulerView } from '../../types';
import { TimelineBase } from './timeline-base';
import { ViewContextService } from '../view-context.service';
import { ViewStateService } from '../view-state.service';
import { WorkHoursFooterDirective } from '../common/work-hours-footer.directive';
import { ViewFooterComponent } from '../common/view-footer.component';
import { TimelineMultiDayViewComponent } from './timeline-multi-day-view.component';
import { NgIf } from '@angular/common';
import * as i0 from "@angular/core";
import * as i1 from "@progress/kendo-angular-l10n";
import * as i2 from "../view-context.service";
import * as i3 from "../view-state.service";
/**
* The component for rendering the **Timeline** view.
*/
export class TimelineViewComponent extends TimelineBase {
/**
* @hidden
*/
get title() {
return this.localization.get('timelineViewTitle');
}
/**
* The long-date format for displaying the
* selected date in the Scheduler toolbar.
* ([more information]({% slug parsingandformatting_intl %}#toc-date-formatting)).
* > Note: If [numberOfDays](#toc-numberofdays) > 1, the default format value shows a range - `'{0:D} - {1:D}'`, where `0` is the start and `1` is the end date.
* @default '{0:D}'
*/
set selectedDateFormat(format) {
this._selectedDateFormat = format;
}
get selectedDateFormat() {
if (this._selectedDateFormat) {
return this._selectedDateFormat;
}
return this.numberOfDays && this.numberOfDays > 1 ? '{0:D} - {1:D}' : '{0:D}';
}
_selectedDateFormat;
/**
* The short-date format for displaying the
* selected date in the Scheduler toolbar.
* ([more information]({% slug parsingandformatting_intl %}#toc-date-formatting)).
* > Note: If [numberOfDays](#toc-numberofdays) > 1, the default format value shows a range - `'{0:d} - {1:d}'`, where `0` is the start and `1` is the end date.
* @default '{0:d}'
*/
set selectedShortDateFormat(format) {
this._selectedShortDateFormat = format;
}
get selectedShortDateFormat() {
if (this._selectedShortDateFormat) {
return this._selectedShortDateFormat;
}
return this.numberOfDays && this.numberOfDays > 1 ? '{0:d} - {1:d}' : '{0:d}';
}
_selectedShortDateFormat;
/**
* Specifies the number of days that the view will render.
* > Normalized to `1` if the provided value is <= 0.
* @default 1
*/
set numberOfDays(days) {
this._numberOfDays = days > 0 ? days : 1;
}
get numberOfDays() {
return this._numberOfDays;
}
_numberOfDays = 1;
/**
* The invariant name for this view.
* @default 'timeline'
*/
name = 'timeline';
constructor(localization, changeDetector, viewContext, viewState) {
super(localization, changeDetector, viewContext, viewState);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TimelineViewComponent, deps: [{ token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i2.ViewContextService }, { token: i3.ViewStateService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TimelineViewComponent, isStandalone: true, selector: "kendo-scheduler-timeline-view", inputs: { selectedDateFormat: "selectedDateFormat", selectedShortDateFormat: "selectedShortDateFormat", numberOfDays: "numberOfDays" }, providers: [{
provide: SchedulerView,
useExisting: forwardRef(() => TimelineViewComponent)
}], usesInheritance: true, ngImport: i0, template: `
<ng-template
<timeline-multi-day-view
[ ]="name"
[ ]="numberOfDays"
[ ]="viewEventHeight"
[ ]="viewColumnWidth"
[ ]="viewCurrentTimeMarker"
[ ]="viewHighlightOngoingEvents"
[ ]="shouldShowWorkHours"
[ ]="viewScrollTime"
[ ]="viewStartTime"
[ ]="viewEndTime"
[ ]="viewWorkDayStart"
[ ]="viewWorkDayEnd"
[ ]="viewWorkWeekStart"
[ ]="viewWorkWeekEnd"
[ ]="viewSlotDuration"
[ ]="viewSlotDivisions"
[ ]="viewSlotClass"
[ ]="viewEventClass"
[ ]="viewEventStyles"
[ ]="eventTemplate?.templateRef"
[ ]="groupHeaderTemplate?.templateRef"
[ ]="timeSlotTemplate?.templateRef"
[ ]="majorTimeHeaderTemplate?.templateRef"
[ ]="minorTimeHeaderTemplate?.templateRef"
[ ]="dateHeaderTemplate?.templateRef"
[ ]="selectedDateFormat"
[ ]="selectedShortDateFormat">
</timeline-multi-day-view>
<div *ngIf="viewShowFooter" viewFooter kendoWorkHoursFooter [showWorkHours]="shouldShowWorkHours" (itemClick)="showWorkHours = !shouldShowWorkHours"></div>
</ng-template>
`, isInline: true, dependencies: [{ kind: "component", type: TimelineMultiDayViewComponent, selector: "timeline-multi-day-view", inputs: ["name", "columnWidth", "viewName"] }, { kind: "component", type: ViewFooterComponent, selector: "[viewFooter]", inputs: ["items"], outputs: ["itemClick"] }, { kind: "directive", type: WorkHoursFooterDirective, selector: "[kendoWorkHoursFooter]", inputs: ["showWorkHours"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TimelineViewComponent, decorators: [{
type: Component,
args: [{
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'kendo-scheduler-timeline-view',
providers: [{
provide: SchedulerView,
useExisting: forwardRef(() => TimelineViewComponent)
}],
template: `
<ng-template
<timeline-multi-day-view
[ ]="name"
[ ]="numberOfDays"
[ ]="viewEventHeight"
[ ]="viewColumnWidth"
[ ]="viewCurrentTimeMarker"
[ ]="viewHighlightOngoingEvents"
[ ]="shouldShowWorkHours"
[ ]="viewScrollTime"
[ ]="viewStartTime"
[ ]="viewEndTime"
[ ]="viewWorkDayStart"
[ ]="viewWorkDayEnd"
[ ]="viewWorkWeekStart"
[ ]="viewWorkWeekEnd"
[ ]="viewSlotDuration"
[ ]="viewSlotDivisions"
[ ]="viewSlotClass"
[ ]="viewEventClass"
[ ]="viewEventStyles"
[ ]="eventTemplate?.templateRef"
[ ]="groupHeaderTemplate?.templateRef"
[ ]="timeSlotTemplate?.templateRef"
[ ]="majorTimeHeaderTemplate?.templateRef"
[ ]="minorTimeHeaderTemplate?.templateRef"
[ ]="dateHeaderTemplate?.templateRef"
[ ]="selectedDateFormat"
[ ]="selectedShortDateFormat">
</timeline-multi-day-view>
<div *ngIf="viewShowFooter" viewFooter kendoWorkHoursFooter [showWorkHours]="shouldShowWorkHours" (itemClick)="showWorkHours = !shouldShowWorkHours"></div>
</ng-template>
`,
standalone: true,
imports: [TimelineMultiDayViewComponent, ViewFooterComponent, WorkHoursFooterDirective, NgIf]
}]
}], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i2.ViewContextService }, { type: i3.ViewStateService }]; }, propDecorators: { selectedDateFormat: [{
type: Input
}], selectedShortDateFormat: [{
type: Input
}], numberOfDays: [{
type: Input
}] } });