import { OnInit, OnDestroy, EventEmitter, ElementRef, Renderer } from '@angular/core'; import { DatePipe } from '@angular/common'; import { ControlValueAccessor } from '@angular/forms'; import { MYOptions, MYDateModel } from './interfaces/common'; import { PageScrollService } from 'ng2-page-scroll'; /** * `MonthYearPickerComponent` implements a month and year picker */ export declare class MonthYearPickerComponent implements OnInit, OnDestroy, ControlValueAccessor { private elementRef; private renderer; private datePipe; private pageScrollService; private document; /** * Month year picker options */ options: MYOptions; /** * Selected date */ selectedDate: MYDateModel; /** * Store if is disabled or not */ disabled: boolean; /** * Selected date change event */ selectedDateChange: EventEmitter; /** * MonthPicker child */ scrollContainer: any; /** * Months */ months: number[]; /** * Years */ years: number[]; /** * Picker visivility */ visible: boolean; /** * Default options */ private defaultOpts; /** * Global listener */ private listener; /** * Propagate change function */ private propagateChange; /** * Creates a new `MonthYearPickerComponent` instance. */ constructor(elementRef: ElementRef, renderer: Renderer, datePipe: DatePipe, pageScrollService: PageScrollService, document: any); /** * Implements on init method. * @author Leandro Diaz */ ngOnInit(): void; /** * Implements on destroy method * @author Leandro Diaz */ ngOnDestroy(): void; /** * Implements toggle for default scroll and set visivility */ toggle(): void; /** * Select next month */ nextMonth(): void; /** * Select prev month */ prevMonth(): void; /** * Select cell * @author Leandro Diaz */ selectCell(month: number, year: number): void; /** * Implements writeValue for ControlValueAccessor interface, this takes the value from model and updates it on the view * @author Leandro Diaz */ writeValue(newDate: MYDateModel): void; /** * Implements setDisabledState for ControlValueAccessor interface * @author Joaquin Volpe */ setDisabledState(isDisabled: boolean): void; /** * Implements registerOnChange for ControlValueAccessor interface, this updates our propagation function * @author Leandro Diaz */ registerOnChange(fn: any): void; /** * Implements registerOnTouched for ControlValueAccessor interface, this updates our propagation function * @author Leandro Diaz */ registerOnTouched(): void; /** * Returns if a month is selected for a given year * @author Leandro Diaz */ isCellSelected(month: number, year: number): boolean; /** * Returns if a month is disabled for a given year * @author Leandro Diaz */ isCellDisabled(month: number, year: number): boolean; /** * Handles user click event * @author Leandro Diaz */ handleClick(event: any): void; /** * On key down event * @author Leandro Diaz */ onKeyDown(event: KeyboardEvent): void; /** * Disable next button */ isNextMonthDisabled(): boolean; /** * Disable back button */ isPrevMonthDisabled(): boolean; private selectDate(date); private checkIfCellIsDisabled(month, year); /** * Set options for the Month Year picker * @author Leandro Diaz */ private setOptions(); /** * Get current date * @author Leandro Diaz */ private getCurrentDate(); /** * Generate array of years * @author Leandro Diaz */ private generateYears(); /** * Returns if the month for a given year is disabled until given date * @author Leandro Diaz */ private isDisabledUntil(month, year); /** * Returns if the month for a given year is disabled since given date * @author Leandro Diaz */ private isDisabledSince(month, year); /** * Get date model * @author Leandro Diaz */ private getDateModel(date); /** * Format dateModel * @author Leandro Diaz */ private formatDate(date); /** * Default scroll * @param year Year to scroll */ private scrollTo(year); /** * View date */ private formatViewDate(date); }