ngx-animating-datepicker
Version:
An Animating Datepicker for Angular 2+, for some smooth date picking :).
115 lines (114 loc) • 3.25 kB
TypeScript
import { AfterViewInit, ElementRef, OnInit } from '@angular/core';
import { YearMonth, Month } from '../../models/datepicker.model';
import { UtilitiesService } from '../../services/utilities.service';
import { DatepickerComponent } from '../datepicker/datepicker.component';
export declare class AnimatepickerComponent extends DatepickerComponent implements OnInit, AfterViewInit {
elementRef: ElementRef;
utilities: UtilitiesService;
animate: boolean;
initialWidth: number;
calendarWidth: number;
isAnimating: boolean;
leftInnerPosition: number;
transition: string;
translateX: number;
currentYearMonth: object;
datepickerPosition: object;
initialised: boolean;
calendarHeight: number;
/**
* Number of months: the number of months displayed
*/
private _numberOfMonths;
numberOfMonths: Number[];
calendarContainer: ElementRef;
calendarTopContainer: ElementRef;
footer: ElementRef;
datepickerWidth: number;
datepickerHeight: number;
constructor(elementRef: ElementRef, utilities: UtilitiesService);
ngOnInit(): void;
ngAfterViewInit(): void;
/**
* Set the height and the width properties
*/
setDatePickerDimension(): void;
/**
* Go to a specific month
*
* @param date - optional
*/
goToDate(date?: Date): void;
/**
* Create an array of the next year and months
*
* @param year
* @param month
*/
getNextYearMonthArray(year: number, month: number): YearMonth[];
/**
* Create an array of the previous year and months
*
* @param year
* @param month
*/
getPreviousYearMonthArray(year: number, month: number): YearMonth[];
/**
* Set the datepicker height, used when animating
*
* @param directionRight - Set optional when sliding to the right
*/
setDatepickerHeight(directionRight?: boolean): void;
/**
* Get next month array, gets multiple months.
* Used when the options animate is set or multiple months are visable
*
* @return Month[]
*/
getNextMonthArray(currentYearMonth: any, keepDate?: boolean, nextMonthsYearMonthArray?: any): Month[];
/**
* Gets an array of previous months.
* Used for animation and when more months are displayed
*
* @param currentYearMonth
* @param keepDate
*/
getPreviousMonthArray(currentYearMonth: any, keepDate?: boolean): Month[];
/**
* Update value is being triggered
*
* @param date
*/
updateValue(date: Date): void;
/**
* Go to the next month
*/
goToNextMonth(): void;
/**
* Go to the previous month
*/
goToPreviousMonth(): void;
/**
* Go to a specific month
* TODO: WIP Check if date is in current range, or if it is later or earlier
*/
goToMonth(date: Date): void;
/**
* Slide to the right
*/
slideRight(): void;
/**
* Slide to the left (criss cross)
*/
slideLeft(): void;
/**
* Set animating state
*/
setIsAnimating(): void;
/**
* Reset Style
*
* @param resetForPrevious - Optional
*/
resetStyle(resetForPrevious?: boolean): void;
}