ngx-animating-datepicker
Version:
An Animating Datepicker for Angular 2+, for some smooth date picking :).
192 lines (191 loc) • 4.96 kB
TypeScript
import { ElementRef, EventEmitter, OnInit } from '@angular/core';
import { Options } from '../../models/datepicker-options.model';
import { YearMonth, Day, Month, Week } from '../../models/datepicker.model';
import { UtilitiesService } from '../../services/utilities.service';
export declare class DatepickerComponent implements OnInit {
utils: UtilitiesService;
element: ElementRef;
date: Date;
year: number;
month: number;
today: Date;
months: Month[];
weekdays: string[];
totalYearMonth: YearMonth[];
selectedRange: string;
startDate: Date;
endDate: Date;
initialised: boolean;
private weekStartArray;
_options: Options;
options: Options;
/**
* Set the the language manualy. A string with a BCP 47 language tag
* @example nl-NL
*/
_language: string;
language: string;
/**
* Minimal Date: If set the dates before it will be disabled
*/
_minDate: any;
minDate: Date;
/**
* Maximal Date: If set the dates after it will be disabled
*/
_maxDate: any;
maxDate: Date;
/**
* Selected Dates: handles the selected dates array. Can be set both internally and externally
*/
private _selectedDates;
selectedDatesChange: EventEmitter<{}>;
selectedDates: Date[];
calendarContainer: ElementRef;
calendarTopContainer: ElementRef;
theme: string;
isOpen: boolean;
asDirective: boolean;
animate: boolean;
topPosition: number;
leftPosition: number;
bottomPosition: number;
rightPosition: number;
constructor(utils: UtilitiesService, element: ElementRef);
ngOnInit(): void;
/**
* Creates a day array
*
* @param year
* @param month
* @param isRestDays
*/
createDayArray(year: number, month: number, isRestDays?: boolean): Day[];
/**
* Get the days from the next month
*
* @param year
* @param month
*/
getNextRestDays(year: number, month: number): Day[];
/**
* Get the days of the previous month
*
* @param year
* @param month
*/
getPreviousRestDays(year: number, month: number): Day[];
/**
* Merge all the day arrays together
*
* @param year
* @param month
*/
getMergedDayArrays(year: number, month: number): Day[];
/**
* Create the calendar array from the week arrays
*
* @param year
* @param month
*/
createCalendarArray(year: number, month: number): [{
weeks: Week[];
}];
/**
* Update value is being triggered
*
* @param date
*/
updateValue(date: Date): void;
/**
* Select range method - contains the logic to select the start- and endrange
*
* @param date
*/
selectRange(date: Date): void;
/**
* Reset the range if the selected dates change externally
*/
resetRange(): void;
/**
* Toggle a date. One in, on out.
*
* @param date - Date to be toggled on
* @param toggleDate - Optional set specific date to toggle off
* @param unshift - Optional set to unshift in the selectedDates array. is passed to selectDate method
*/
toggleDate(date: Date, toggleDate?: Date, unshift?: boolean): void;
/**
* Select a date
*
* @param date
* @param unshift - Optional set to unshift instead of push the date in the selectedDates array
*/
selectDate(date: Date, unshift?: boolean): void;
/**
* Deselect a date
*
* @param date
*/
deselectDate(date: Date): void;
/**
* Go to the next month
*/
goToNextMonth(): void;
/**
* Go to the previous month
*/
goToPreviousMonth(): void;
/**
* Go to a specific month. Is also used to rerender the datepicker
*
* @param date - default is the current date.
*/
goToDate(date?: Date): void;
/**
* Render weekdays when options or language changes
*/
renderWeekdays(): void;
/**
* Set the open state to true
*/
open(): void;
/**
* Close the datepicker
*
* @param useTimeout - optional timeout
*/
close(useTimeout?: boolean): void;
/**
* Select the start date - used for range functionality
*/
selectStartDate(): void;
/**
* Select the end date - used for range functionality
*/
selectEndDate(): void;
/**
* Check if date is the start date
*/
isStartDate(date: Date): boolean;
/**
* Check if date is the end date
*/
isEndDate(date: Date): boolean;
/**
* Check if date is today
*/
isToday(date: Date): boolean;
/**
* Check if date is selected
*/
isSelected(dateToCheck: Date): boolean;
/**
* Check if date is disabled
*/
isDisabled(date: Date): boolean;
/**
* Check if date is in range
*/
isInRange(date: Date): boolean;
}