@ipi-soft/ng-components
Version:
Custom Angular Components
97 lines (96 loc) • 4.84 kB
TypeScript
import { ChangeDetectorRef, EventEmitter } from '@angular/core';
import { DateRange } from './../../datepicker.component';
import { CalendarBody, CalendarCell } from './../calendar-body/calendar-body.component';
import { IpiDatepickerService } from './../../datepicker-service';
import * as i0 from "@angular/core";
export declare class IpiCalendarYearView {
datePickerService: IpiDatepickerService;
private changeDetectorRef;
constructor(datePickerService: IpiDatepickerService, changeDetectorRef: ChangeDetectorRef);
/** The body of calendar table */
CalendarBody: CalendarBody;
get activeDate(): Date;
set activeDate(value: Date);
get selected(): DateRange | Date | null;
set selected(value: DateRange | Date | null);
get minDate(): Date | null;
set minDate(value: Date | null);
get maxDate(): Date | null;
set maxDate(value: Date | null);
/** Emits when a new month is selected. */
selectedChange: EventEmitter<Date>;
/** Emits the selected month. This doesn't imply a change on the selected date */
monthSelected: EventEmitter<Date>;
/** Emits when any date is activated. */
activeDateChange: EventEmitter<Date>;
/** Grid of calendar cells representing the months of the year. */
months: CalendarCell[][];
/**
* The month in this year that the selected Date falls on.
* Null if the selected Date is in a different year.
*/
selectedMonth: number | null;
/** The label for this year (e.g. "2017"). */
yearLabel: string;
/** The month in this year that today falls on. Null if today is in a different year. */
todayMonth: number | null;
private _activeDate;
private _minDate;
private _maxDate;
private _selected;
/** Flag used to filter out space/enter keyup events that originated outside of the view. */
private selectionKeyPressed;
private dateFormats;
ngAfterContentInit(): void;
/** Initializes this year view. */
init(): void;
/** Handles when a new month is selected. */
onMonthSelected(event: any): 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: any): void;
/** Handles keydown events on the calendar body when calendar is in year view. */
handleCalendarBodyKeydown(event: KeyboardEvent): void;
/** Handles keyup events on the calendar body when calendar is in year view. */
handleCalendarBodyKeyup(event: KeyboardEvent): void;
/** Focuses the active cell after the microtask queue is empty. */
focusActiveCell(): void;
/** Schedules the matCalendarBody to focus the active cell after change detection has run */
focusActiveCellAfterViewChecked(): void;
/**
* Gets the month in this year that the given Date falls on.
* Returns null if the given Date is in another year.
*/
private getMonthInCurrentYear;
/**
* Takes a month and returns a new date in the same day and year as the currently active date.
* The returned date will have the same month as the argument date.
*/
private getDateFromMonth;
/** Creates an MatCalendarCell for the given month. */
private createCellForMonth;
/** Whether the given month is enabled. */
private shouldEnableMonth;
/**
* Tests whether the combination month/year is after this.maxDate, considering
* just the month and year of this.maxDate
*/
private isYearAndMonthAfterMaxDate;
/**
* Tests whether the combination month/year is before this.minDate, considering
* just the month and year of this.minDate
*/
private isYearAndMonthBeforeMinDate;
/** Sets the currently-selected month based on a model value. */
private setSelectedMonth;
static ɵfac: i0.ɵɵFactoryDeclaration<IpiCalendarYearView, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<IpiCalendarYearView, "ipi-calendar-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"; "monthSelected": "monthSelected"; "activeDateChange": "activeDateChange"; }, never, never, true, never>;
}