ng-material-date-range-picker
Version:
This library provides the date range selection with two views.
121 lines (119 loc) • 3.79 kB
TypeScript
/**
* @(#)calendar.component.scss Sept 07, 2023
* @author Aakash Kumar
*/
import { AfterViewInit, ChangeDetectorRef, ElementRef, OnInit, Renderer2 } from '@angular/core';
import { DateRange, MatCalendar } from '@angular/material/datepicker';
import { CalendarViewData } from './../model/calendar-view-data';
import * as i0 from "@angular/core";
export declare class CalendarComponent implements OnInit, AfterViewInit {
private cdref;
private el;
private renderer;
firstCalendarViewData: CalendarViewData;
secondCalendarViewData: CalendarViewData;
selectedDates: DateRange<Date> | null;
minDate: Date;
maxDate: Date;
private isAllowHoverEvent;
firstCalendarView: MatCalendar<Date>;
secondCalendarView: MatCalendar<Date>;
constructor(cdref: ChangeDetectorRef, el: ElementRef, renderer: Renderer2);
ngOnInit(): void;
ngAfterViewInit(): void;
/**
* This method gets all eligible cells on second view for hover event.
*/
attachHoverEventOnSecondViewDates(): void;
/**
* This method handles second calendar view month selection.
*
* @param event Date
*/
secondViewMonthSelected(event: Date): void;
/**
* This method handles first calendar view month selection.
*
* @param event Date
*/
monthSelected(event: Date): void;
/**
* This method updates the date selection range.
*
* @param date Date
*/
updateDateRangeSelection(date: Date | null): void;
/**
* This method handles First calendar prev button event.
* @param classRef CalendarComponent
*/
private handleFirstCalDatePrevEvent;
/**
* This method gets all eligible cells on first view for hover event.
*/
private attachHoverEventOnFirstViewDates;
/**
* This method handle the next button event.
*
* @param classRef CalendarComponent
* @param isForced boolean
*/
private handleFirstCalendarNextEvent;
/**
* This method remove active focus on second view.
*
* @param classRef CalendarComponent
*/
removeDefaultFocus(classRef: CalendarComponent): void;
/**
* This method attaches next and prev events on buttons.
*
*/
private addFirstCalendarButtonEvents;
/**
* This method attaches next and prev events on buttons.
*
*/
private addSecondCalendarButtonEvents;
/**
* This method attach click event of next and prev button on second view.
*
*/
private attachSecondViewClickEvent;
/**
* This method will update the range selection on mouse hover event.
*
* @param date Date
*/
private updateSelectionOnMouseHover;
/**
* This method attach hover event on specified nodes.
*
* @param nodes any
*/
private addHoverEvents;
/**
* This method attach the next and prev events on specified nodes.
*
* @param nodes any
* @param handler Function
*/
private attachClickEvent;
/**
* This method initialize data for first calendar view.
*/
private initFirstCalendar;
/**
* This method initialize data for second calendar view.
*/
private initSecondCalendar;
/**
* This method returns the next months first date.
*
* @param currDate Date
* @returns Date
*/
private getFirstDateOfNextMonth;
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<CalendarComponent, "lib-calendar", never, { "selectedDates": { "alias": "selectedDates"; "required": false; }; "minDate": { "alias": "minDate"; "required": false; }; "maxDate": { "alias": "maxDate"; "required": false; }; }, {}, never, never, false, never>;
}