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.

130 lines (129 loc) 6.13 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, forwardRef, ChangeDetectionStrategy, ChangeDetectorRef, Input } from '@angular/core'; import { LocalizationService } from '@progress/kendo-angular-l10n'; import { SchedulerView } from '../../types'; import { ViewContextService } from '../view-context.service'; import { ViewStateService } from '../view-state.service'; import { ConfigurationViewBase } from '../common/configuration-view-base'; import { addYears } from '@progress/kendo-date-math'; import { IntlService } from '@progress/kendo-angular-intl'; import { yearEnd, yearStart } from './utils'; import { YearViewInternalComponent } from './year-view-internal.component'; 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"; import * as i4 from "@progress/kendo-angular-intl"; /** * Represents the component that renders the **Year** view in the Scheduler. * * @example * ```html * <kendo-scheduler> * <kendo-scheduler-year-view></kendo-scheduler-year-view> * </kendo-scheduler> * ``` */ export class YearViewComponent extends ConfigurationViewBase { intl; /** * Sets the long-date format for the selected year in the Scheduler toolbar. * For more information, see [Parsing and Formatting Dates and Numbers](slug:parsingandformatting_intl#date-formatting). * @default '{0:yyy}' */ selectedDateFormat = '{0:yyy}'; /** * Sets the short-date format for the selected year in the Scheduler toolbar. * For more information, see [Parsing and Formatting Dates and Numbers](slug:parsingandformatting_intl#date-formatting). * @default '{0:yyy}' */ selectedShortDateFormat = '{0:yyy}'; /** * @hidden */ get title() { return this.localization.get('yearViewTitle'); } /** * @hidden */ highlightOngoingEvents; /** * The invariant name for this view. * @default 'year' */ name = 'year'; constructor(localization, changeDetector, viewContext, viewState, intl) { super(localization, changeDetector, viewContext, viewState); this.intl = intl; } /** * @hidden */ dateRange(date) { const year = date.getFullYear(); const start = yearStart(year); const end = yearEnd(year); const text = this.intl.format(this.selectedDateFormat, start); const shortText = this.intl.format(this.selectedShortDateFormat, start); return { start, end, text, shortText }; } /** * @hidden */ newRange(date, direction = 1) { return new Date(addYears(date, direction)); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: YearViewComponent, deps: [{ token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i2.ViewContextService }, { token: i3.ViewStateService }, { token: i4.IntlService }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: YearViewComponent, isStandalone: true, selector: "kendo-scheduler-year-view", inputs: { selectedDateFormat: "selectedDateFormat", selectedShortDateFormat: "selectedShortDateFormat", highlightOngoingEvents: "highlightOngoingEvents" }, providers: [{ provide: SchedulerView, useExisting: forwardRef(() => YearViewComponent) }], usesInheritance: true, ngImport: i0, template: ` <ng-template #content> <year-view-internal [selectedDateFormat]="selectedDateFormat" [selectedShortDateFormat]="selectedShortDateFormat" [slotClass]="viewSlotClass" [eventClass]="viewEventClass" [eventStyles]="viewEventStyles" [dateRangeFn]="dateRange" [newRange]="newRange"> </year-view-internal> </ng-template> `, isInline: true, dependencies: [{ kind: "component", type: YearViewInternalComponent, selector: "year-view-internal", inputs: ["newRange", "dateRangeFn"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: YearViewComponent, decorators: [{ type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'kendo-scheduler-year-view', providers: [{ provide: SchedulerView, useExisting: forwardRef(() => YearViewComponent) }], template: ` <ng-template #content> <year-view-internal [selectedDateFormat]="selectedDateFormat" [selectedShortDateFormat]="selectedShortDateFormat" [slotClass]="viewSlotClass" [eventClass]="viewEventClass" [eventStyles]="viewEventStyles" [dateRangeFn]="dateRange" [newRange]="newRange"> </year-view-internal> </ng-template> `, standalone: true, imports: [YearViewInternalComponent] }] }], ctorParameters: () => [{ type: i1.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i2.ViewContextService }, { type: i3.ViewStateService }, { type: i4.IntlService }], propDecorators: { selectedDateFormat: [{ type: Input }], selectedShortDateFormat: [{ type: Input }], highlightOngoingEvents: [{ type: Input }] } });