mat-pick-range-dates
Version:
Angular 2 component range date picker.
152 lines (142 loc) • 6.39 kB
TypeScript
import * as i0 from '@angular/core';
import { OnChanges, EventEmitter, SimpleChanges, Injector, ElementRef, OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
import * as i6 from '@angular/material/datepicker';
import { MatCalendar } from '@angular/material/datepicker';
import * as i4 from '@angular/common';
import { DatePipe } from '@angular/common';
import * as i11 from '@angular/cdk/overlay';
import { Overlay, OverlayRef } from '@angular/cdk/overlay';
import { Subject } from 'rxjs';
import * as i5 from '@angular/material/form-field';
import * as i7 from '@angular/material/core';
import * as i8 from '@angular/material/input';
import * as i9 from '@angular/material/button';
import * as i10 from '@angular/material/tooltip';
interface PresetItem {
presetLabel: string;
range: Range;
}
interface Range {
fromDate: Date;
toDate: Date;
}
interface CalendarOverlayConfig {
panelClass?: string;
hasBackdrop?: boolean;
backdropClass?: string;
shouldCloseOnBackdropClick?: boolean;
}
interface Options {
presets?: Array<PresetItem>;
format?: string;
range?: Range;
excludeWeekends?: boolean;
locale?: string;
fromMinMax?: Range;
toMinMax?: Range;
applyLabel?: string;
cancelLabel?: string;
calendarOverlayConfig?: CalendarOverlayConfig;
placeholder?: string;
matLabel?: string;
startDatePrefix?: string;
endDatePrefix?: string;
}
declare class ConfigStoreService {
private _rdpOptions;
private defaultOptions;
constructor();
get options(): Options;
set options(options: Options);
static ɵfac: i0.ɵɵFactoryDeclaration<ConfigStoreService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ConfigStoreService>;
}
declare class CalendarComponent implements OnChanges {
private configStore;
matCalendar: MatCalendar<Date>;
readonly selectedDateChange: EventEmitter<Date>;
dateFormat: string;
selectedDate: Date;
prefixLabel: string;
minDate: Date;
maxDate: Date;
weekendFilter: (d: Date) => boolean;
constructor(configStore: ConfigStoreService);
ngOnChanges(changes: SimpleChanges): void;
onSelectedChange(date: any): void;
onYearSelected(e: any): void;
onUserSelection(e: any): void;
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<CalendarComponent, "calendar", never, { "selectedDate": { "alias": "selectedDate"; "required": false; }; "prefixLabel": { "alias": "prefixLabel"; "required": false; }; "minDate": { "alias": "minDate"; "required": false; }; "maxDate": { "alias": "maxDate"; "required": false; }; }, { "selectedDateChange": "selectedDateChange"; }, never, never, false, never>;
}
declare class CalendarOverlayService {
private readonly overlay;
private readonly injector;
private hostElemRef;
constructor(overlay: Overlay, injector: Injector);
open(config: CalendarOverlayConfig, hostElemRef: ElementRef): OverlayRef;
private createOverlay;
private getOverlayConfig;
private createInjector;
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarOverlayService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CalendarOverlayService>;
}
declare class RangeStoreService {
private _fromDate;
private _toDate;
rangeUpdate$: Subject<Range>;
constructor(_fromDate: Date, _toDate: Date);
get fromDate(): Date;
get toDate(): Date;
updateRange(fromDate?: Date, toDate?: Date): void;
static ɵfac: i0.ɵɵFactoryDeclaration<RangeStoreService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<RangeStoreService>;
}
declare class MatPickRangeComponent implements OnInit, OnDestroy {
private changeDetectionRef;
private calendarOverlayService;
rangeStoreService: RangeStoreService;
confStore: ConfigStoreService;
private datePipe;
calendarInput: ElementRef;
readonly selectedDateRangeChanged: EventEmitter<Range>;
options: Options;
private rangeUpdate$;
selectedDateRange: string;
constructor(changeDetectionRef: ChangeDetectorRef, calendarOverlayService: CalendarOverlayService, rangeStoreService: RangeStoreService, confStore: ConfigStoreService, datePipe: DatePipe);
ngOnInit(): void;
private formatToDateString;
openCalendar(event: any): void;
resetDates(range: Range): void;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<MatPickRangeComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<MatPickRangeComponent, "mat-pick-range", never, { "options": { "alias": "options"; "required": false; }; }, { "selectedDateRangeChanged": "selectedDateRangeChanged"; }, never, never, false, never>;
}
declare class PickerOverlayComponent implements OnInit {
private rangeStoreService;
configService: ConfigStoreService;
private overlayRef;
fromDate: Date;
toDate: Date;
fromMinDate: Date;
fromMaxDate: Date;
toMinDate: Date;
toMaxDate: Date;
constructor(rangeStoreService: RangeStoreService, configService: ConfigStoreService, overlayRef: OverlayRef);
ngOnInit(): void;
updateFromDate(date: Date): void;
updateToDate(date: Date): void;
updateRangeByPreset(presetItem: PresetItem): void;
applyNewDates(e: any): void;
discardNewDates(e: any): void;
private disposeOverLay;
static ɵfac: i0.ɵɵFactoryDeclaration<PickerOverlayComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<PickerOverlayComponent, "picker-overlay", never, {}, {}, never, never, false, never>;
}
declare class MatPickRangeModule {
static ɵfac: i0.ɵɵFactoryDeclaration<MatPickRangeModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<MatPickRangeModule, [typeof MatPickRangeComponent, typeof CalendarComponent, typeof PickerOverlayComponent], [typeof i4.CommonModule, typeof i5.MatFormFieldModule, typeof i6.MatDatepickerModule, typeof i7.MatNativeDateModule, typeof i8.MatInputModule, typeof i9.MatButtonModule, typeof i10.MatTooltipModule, typeof i11.OverlayModule], [typeof MatPickRangeComponent]>;
static ɵinj: i0.ɵɵInjectorDeclaration<MatPickRangeModule>;
}
export { CalendarComponent, CalendarOverlayService, ConfigStoreService, MatPickRangeComponent, MatPickRangeModule, PickerOverlayComponent, RangeStoreService };
export type { CalendarOverlayConfig, Options, PresetItem, Range };