@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.
182 lines (181 loc) • 10.1 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, ContentChild, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { LocalizationService } from '@progress/kendo-angular-l10n';
import { SchedulerView } from '../../types';
import { MultiDayViewBase } from './multi-day-view-base';
import { IntlService } from '@progress/kendo-angular-intl';
import { ViewContextService } from '../view-context.service';
import { ViewStateService } from '../view-state.service';
import { firstDayInWeek, getDate } from '@progress/kendo-date-math';
import { AllDaySlotTemplateDirective, AllDayEventTemplateDirective } from '../templates';
import { WorkHoursFooterDirective } from '../common/work-hours-footer.directive';
import { ViewFooterComponent } from '../common/view-footer.component';
import { MultiDayViewRendererComponent } from './multi-day-view-renderer.component';
import { NgIf } from '@angular/common';
import * as i0 from "@angular/core";
import * as i1 from "@progress/kendo-angular-intl";
import * as i2 from "@progress/kendo-angular-l10n";
import * as i3 from "../view-context.service";
import * as i4 from "../view-state.service";
/**
* The component for rendering the **Week** view.
*/
export class WeekViewComponent extends MultiDayViewBase {
intl;
/**
* @hidden
*/
get title() {
return this.localization.get('weekViewTitle');
}
/**
* The long-date format for displaying the
* selected date in the Scheduler toolbar.
* Defaults to `{0:D} - {1:D}`,
* where `0` is the start and `1` is the end date
* ([more information]({% slug parsingandformatting_intl %}#toc-date-formatting).
* @default '{0:D} - {1:D}'
*/
selectedDateFormat = '{0:D} - {1:D}';
/**
* The short date format for displaying the
* selected date in the Scheduler toolbar.
* Defaults to `{0:d} - {1:d}`,
* where `0` is the start and `1` is the end date
* ([more information]({% slug parsingandformatting_intl %}#toc-date-formatting).
* @default '{0:d} - {1:d}'
*/
selectedShortDateFormat = '{0:d} - {1:d}';
/**
* @hidden
*/
allDaySlotTemplate;
/**
* @hidden
*/
allDayEventTemplate;
/**
* The invariant name for this view.
* @default 'week'
*/
name = 'week';
constructor(intl, localization, changeDetector, viewContext, viewState) {
super(localization, changeDetector, viewContext, viewState);
this.intl = intl;
this.getStartDate = this.getStartDate.bind(this);
}
/**
* @hidden
*/
getStartDate(selectedDate) {
return firstDayInWeek(getDate(selectedDate), this.viewWeekStart);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WeekViewComponent, deps: [{ token: i1.IntlService }, { token: i2.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i3.ViewContextService }, { token: i4.ViewStateService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WeekViewComponent, isStandalone: true, selector: "kendo-scheduler-week-view", inputs: { selectedDateFormat: "selectedDateFormat", selectedShortDateFormat: "selectedShortDateFormat" }, providers: [{
provide: SchedulerView,
useExisting: forwardRef(() => WeekViewComponent)
}], queries: [{ propertyName: "allDaySlotTemplate", first: true, predicate: AllDaySlotTemplateDirective, descendants: true }, { propertyName: "allDayEventTemplate", first: true, predicate: AllDayEventTemplateDirective, descendants: true }], usesInheritance: true, ngImport: i0, template: `
<ng-template
<multi-day-view
[ ]="name"
[ ]="viewAllDaySlot"
[ ]="7"
[ ]="getStartDate"
[ ]="viewEventHeight"
[ ]="viewCurrentTimeMarker"
[ ]="viewHighlightOngoingEvents"
[ ]="shouldShowWorkHours"
[ ]="viewScrollTime"
[ ]="viewStartTime"
[ ]="viewEndTime"
[ ]="viewWorkDayStart"
[ ]="viewWorkDayEnd"
[ ]="viewWorkWeekStart"
[ ]="viewWorkWeekEnd"
[ ]="viewWeekStart"
[ ]="viewSlotDuration"
[ ]="viewSlotDivisions"
[ ]="viewSlotFill"
[ ]="viewSlotClass"
[ ]="viewEventClass"
[ ]="viewEventStyles"
[ ]="allDaySlotTemplate?.templateRef"
[ ]="allDayEventTemplate?.templateRef"
[ ]="eventTemplate?.templateRef"
[ ]="groupHeaderTemplate?.templateRef"
[ ]="timeSlotTemplate?.templateRef"
[ ]="minorTimeHeaderTemplate?.templateRef"
[ ]="majorTimeHeaderTemplate?.templateRef"
[ ]="dateHeaderTemplate?.templateRef"
[ ]="selectedDateFormat"
[ ]="selectedShortDateFormat">
</multi-day-view>
<div *ngIf="viewShowFooter" viewFooter kendoWorkHoursFooter [showWorkHours]="shouldShowWorkHours" (itemClick)="showWorkHours = !shouldShowWorkHours"></div>
</ng-template>
`, isInline: true, dependencies: [{ kind: "component", type: MultiDayViewRendererComponent, selector: "multi-day-view", inputs: ["allDaySlot", "name", "slotFill", "allDaySlotTemplate", "allDayEventTemplate"] }, { 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: WeekViewComponent, decorators: [{
type: Component,
args: [{
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'kendo-scheduler-week-view',
providers: [{
provide: SchedulerView,
useExisting: forwardRef(() => WeekViewComponent)
}],
template: `
<ng-template
<multi-day-view
[ ]="name"
[ ]="viewAllDaySlot"
[ ]="7"
[ ]="getStartDate"
[ ]="viewEventHeight"
[ ]="viewCurrentTimeMarker"
[ ]="viewHighlightOngoingEvents"
[ ]="shouldShowWorkHours"
[ ]="viewScrollTime"
[ ]="viewStartTime"
[ ]="viewEndTime"
[ ]="viewWorkDayStart"
[ ]="viewWorkDayEnd"
[ ]="viewWorkWeekStart"
[ ]="viewWorkWeekEnd"
[ ]="viewWeekStart"
[ ]="viewSlotDuration"
[ ]="viewSlotDivisions"
[ ]="viewSlotFill"
[ ]="viewSlotClass"
[ ]="viewEventClass"
[ ]="viewEventStyles"
[ ]="allDaySlotTemplate?.templateRef"
[ ]="allDayEventTemplate?.templateRef"
[ ]="eventTemplate?.templateRef"
[ ]="groupHeaderTemplate?.templateRef"
[ ]="timeSlotTemplate?.templateRef"
[ ]="minorTimeHeaderTemplate?.templateRef"
[ ]="majorTimeHeaderTemplate?.templateRef"
[ ]="dateHeaderTemplate?.templateRef"
[ ]="selectedDateFormat"
[ ]="selectedShortDateFormat">
</multi-day-view>
<div *ngIf="viewShowFooter" viewFooter kendoWorkHoursFooter [showWorkHours]="shouldShowWorkHours" (itemClick)="showWorkHours = !shouldShowWorkHours"></div>
</ng-template>
`,
standalone: true,
imports: [MultiDayViewRendererComponent, ViewFooterComponent, WorkHoursFooterDirective, NgIf]
}]
}], ctorParameters: function () { return [{ type: i1.IntlService }, { type: i2.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i3.ViewContextService }, { type: i4.ViewStateService }]; }, propDecorators: { selectedDateFormat: [{
type: Input
}], selectedShortDateFormat: [{
type: Input
}], allDaySlotTemplate: [{
type: ContentChild,
args: [AllDaySlotTemplateDirective, { static: false }]
}], allDayEventTemplate: [{
type: ContentChild,
args: [AllDayEventTemplateDirective, { static: false }]
}] } });