UNPKG

@ipi-soft/ng-components

Version:

Custom Angular Components

82 lines (81 loc) 4.44 kB
import { ChangeDetectorRef, EventEmitter } from '@angular/core'; import { DateSelectionEvent } from './../../datepicker.component'; import { IpiDatepickerService } from './../../datepicker-service'; import { DateRange } from './../../datepicker.component'; import { CalendarCell, CalendarBody } from './../calendar-body/calendar-body.component'; import * as i0 from "@angular/core"; export declare class IpiCalendarMultiYearView { private changeDetectorRef; private datePickerService; constructor(changeDetectorRef: ChangeDetectorRef, datePickerService: IpiDatepickerService); /** Flag used to filter out space/enter keyup events that originated outside of the view. */ private selectionKeyPressed; /** The date to display in this multi-year view (everything other than the year is ignored). */ get activeDate(): Date; set activeDate(value: Date); get selected(): DateRange | Date | null; set selected(value: DateRange | Date | null); private _selected; /** The minimum selectable date. */ get minDate(): Date | null; set minDate(value: Date | null); /** The maximum selectable date. */ get maxDate(): Date | null; set maxDate(value: Date | null); /** Emits when a new year is selected. */ selectedChange: EventEmitter<Date>; /** Emits the selected year. This doesn't imply a change on the selected date */ yearSelected: EventEmitter<Date>; /** Emits when any date is activated. */ activeDateChange: EventEmitter<Date>; /** The body of calendar table */ calendarBody: CalendarBody; /** Grid of calendar cells representing the currently displayed years. */ _years: CalendarCell[][]; /** The year that today falls on. */ _todayYear: number; /** The year of the selected date. Null if the selected date is null. */ selectedYear: number | null; private _activeDate; private _maxDate; private _minDate; ngAfterContentInit(): void; init(): void; /** Handles when a new year is selected. */ onYearSelected(event: DateSelectionEvent<number>): void; /** * Takes the index of a calendar body cell wrapped in an event as argument. For the date that * corresponds to the given cell, set `activeDate` to that date and fire `activeDateChange` with * that date. * * This function is used to match each component's model of the active date with the calendar * body cell that was focused. It updates its value of `activeDate` synchronously and updates the * parent's value asynchronously via the `activeDateChange` event. The child component receives an * updated value asynchronously via the `activeCell` Input. */ updateActiveDate(event: DateSelectionEvent<number>): void; /** Handles keydown events on the calendar body when calendar is in multi-year view. */ handleCalendarBodyKeydown(event: KeyboardEvent): void; /** Handles keyup events on the calendar body when calendar is in multi-year view. */ handleCalendarBodyKeyup(event: KeyboardEvent): void; getActiveCell(): number; /** Focuses the active cell after the microtask queue is empty. */ focusActiveCell(): void; /** Focuses the active cell after change detection has run and the microtask queue is empty. */ focusActiveCellAfterViewChecked(): void; /** * Takes a year and returns a new date on the same day and month as the currently active date * The returned date will have the same year as the argument date. */ private getDateFromYear; /** Creates an CalendarCell for the given year. */ private createCellForYear; /** Whether the given year is enabled. */ private shouldEnableYear; /** Sets the currently-highlighted year based on a model value. */ private setSelectedYear; private isSameMultiYearView; private getStartingYear; static ɵfac: i0.ɵɵFactoryDeclaration<IpiCalendarMultiYearView, never>; static ɵcmp: i0.ɵɵComponentDeclaration<IpiCalendarMultiYearView, "ipi-calendar-multi-year-view", never, { "activeDate": { "alias": "activeDate"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "minDate": { "alias": "minDate"; "required": false; }; "maxDate": { "alias": "maxDate"; "required": false; }; }, { "selectedChange": "selectedChange"; "yearSelected": "yearSelected"; "activeDateChange": "activeDateChange"; }, never, never, true, never>; }