import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, Injector, OnChanges, OnDestroy, OnInit, Renderer2, SimpleChanges } from "@angular/core"; import { MatDatepicker, MatDatepickerInput, MatDatepickerInputEvent } from "@angular/material/datepicker"; import moment from "moment"; import { ControlValueAccessor, Validator } from "@angular/forms"; import { MatDateFormats } from "@angular/material/core"; import { MatLegacyFormFieldControl as MatFormFieldControl } from "@angular/material/legacy-form-field"; import { FocusMonitor } from "@angular/cdk/a11y"; import { BooleanInput } from "@angular/cdk/coercion"; import { TranslateService } from "@ngx-translate/core"; import { StarkLoggingService } from "@nationalbankbelgium/stark-core"; import { StarkTimestampMaskConfig } from "@nationalbankbelgium/stark-ui/src/modules/input-mask-directives"; import { AbstractStarkUiComponent } from "@nationalbankbelgium/stark-ui/src/internal-common"; import * as i0 from "@angular/core"; /** * Type expected by [StarkDatePickerComponent dateFilter]{@link StarkDatePickerComponent#dateFilter} input. */ export type StarkDatePickerFilter = "OnlyWeekends" | "OnlyWeekdays" | ((date: Date) => boolean); /** * Type expected by [StarkDatePickerComponent maskConfig]{@link StarkDatePickerComponent#maskConfig} input. */ export type StarkDatePickerMaskConfig = StarkTimestampMaskConfig | boolean; /** * Type expected by [StarkDatePickerComponent max]{@link StarkDatePickerComponent#max} and * [StarkDatePickerComponent min]{@link StarkDatePickerComponent#min} inputs. */ export type StarkDateInput = Date | moment.Moment | null | undefined; /** * Default date mask configuration used by the {@link StarkDatePickerComponent} */ export declare const DEFAULT_DATE_MASK_CONFIG: StarkTimestampMaskConfig; /** * Component to display the stark date-picker */ export declare class StarkDatePickerComponent extends AbstractStarkUiComponent implements OnInit, AfterViewInit, OnChanges, OnDestroy, ControlValueAccessor, Validator, MatFormFieldControl { logger: StarkLoggingService; private cdRef; private dateFormats; private fm; private injector; private translateService; /** * Part of {@link MatFormFieldControl} API * @ignore */ id: string; /** * Part of {@link MatFormFieldControl} API * @ignore */ describedBy: string; /** * Part of {@link MatFormFieldControl} API * @ignore */ get shouldLabelFloat(): boolean; /** * Filter function or a string * Whenever this value is changed, we set the dateFilter */ get dateFilter(): StarkDatePickerFilter | undefined; set dateFilter(value: StarkDatePickerFilter | undefined); /** * Timestamp Mask Configuration to apply on the date-picker. * - If `true` is passed, the default mask config is applied: {@link DEFAULT_DATE_MASK_CONFIG} * - If `false` is passed or if `dateMask` is not present, the directive is disabled. * - If a {@link StarkTimestampMaskConfig} is passed, it is set as the date mask config. */ set dateMask(value: StarkDatePickerMaskConfig); static ngAcceptInputType_dateMask: BooleanInput | StarkDatePickerMaskConfig; /** * Whether the datepicker is disabled */ get disabled(): boolean; set disabled(value: boolean); static ngAcceptInputType_disabled: BooleanInput; /** * Maximum date of the date picker * * Supported types: `Date | moment.Moment | undefined | null` */ set max(value: moment.Moment | null); get max(): moment.Moment | null; static ngAcceptInputType_max: StarkDateInput; /** * @ignore * Angular expects a Moment or null value. */ private _max; /** * Minimum date of the date picker * * Supported types: `Date | moment.Moment | undefined | null` */ set min(value: moment.Moment | null); get min(): moment.Moment | null; static ngAcceptInputType_min: StarkDateInput; /** * @ignore * Angular expects a Moment or null value. */ _min: moment.Moment | null; /** * The HTML `id` attribute of the date picker's calendar popup. * This id is also used, suffixed with `"-input"`, as the HTML `id` attribute of the date picker's input field. */ pickerId: string; /** * HTML `name` attribute of the element. */ pickerName: string; /** * Placeholder to be displayed in the datepicker. * This is dynamically translated via the @ngx-translate service if the provided text is defined in the translation keys). */ set placeholder(value: string); get placeholder(): string; /** * @ignore */ private _placeholder; /** * If the date-picker is required or not. * * Default: `false` (the date-picker is not required) */ get required(): boolean; set required(value: boolean); static ngAcceptInputType_required: BooleanInput; /** * Source Date to be bound to the datepicker model */ get value(): Date | null; set value(value: Date | null); /** * Output that will emit a specific date whenever the selection has changed */ readonly dateChange: EventEmitter; /** * Output that will emit a specific date whenever the input has changed */ readonly dateInput: EventEmitter; /** * Reference to the MatDatepicker embedded in this component */ picker: MatDatepicker; /** * Reference to the MatDatepickerInput embedded in this component */ pickerInput: MatDatepickerInput; /** * Class constructor * @param logger - The `StarkLoggingService` instance of the application. * @param renderer - Angular `Renderer2` wrapper for DOM manipulations. * @param elementRef - Reference to the DOM element where this component is attached to. * @param cdRef - Reference to the change detector attached to this component * @param dateFormats - Reference to the date formats provided to MAT_DATE_FORMATS * @param fm - The Focus Monitor Service * @param injector - The Injector of the application * @param translateService - The `TranslateService` instance of the application. */ constructor(logger: StarkLoggingService, renderer: Renderer2, elementRef: ElementRef, cdRef: ChangeDetectorRef, dateFormats: MatDateFormats, fm: FocusMonitor, injector: Injector, translateService: TranslateService); /** * Component lifecycle hook */ ngOnInit(): void; /** * Component lifecycle hook */ ngAfterViewInit(): void; /** * Component lifecycle hook * @param changes - Contains the changed properties */ ngOnChanges(changes: SimpleChanges): void; /** * Component lifecycle hook */ ngOnDestroy(): void; /** * Wrap the dateFilter function * We use the MomentDateModule, so the MatDatepicker will return a moment.Moment object. * To keep consistency with the old code, the end user should be able to specify a custom dateFilter accepting a Date object as a parameter * @param momentDate - The date to be checked * @returns Whether the date is filtered or not */ dateFilterFnWrapper: (momentDate: moment.Moment | null) => boolean; /** * Filter only the weekend days * @param date - The date to be checked * @returns Whether the date is a weekend day or not */ filterOnlyWeekends(date: Date): boolean; /** * Filter only the week days * @param date - The date to be checked * @returns Whether the date is a week day or not */ filterOnlyWeekdays(date: Date): boolean; /** * Handled when a `change` event is fired on the `` element, then emits on `dateChange`. * @param event - The MatDatepickerInputEvent to re-emit */ onDateChange(event: MatDatepickerInputEvent): void; /** * Handled when an `input` event is fired on this `` element, then emits the `dateInput`. * @param event - The MatDatepickerInputEvent to re-emit */ onDateInput(event: MatDatepickerInputEvent): void; /** * Get the `starkTimestampMask` configuration. * If the inputMask is not enabled, it returns `undefined` to disable `starkTimestampMask`. * Otherwise, it returns the defined configuration. */ getTimestampMaskConfig(): StarkTimestampMaskConfig | undefined; /** * Method triggered when the date-picker input is focused. * This method changes the displayed value to make the starkTimestampInput directive working and enables the directive. * * @param focusEvent - The focus event */ onFocus(focusEvent: FocusEvent): void; /** * Method triggered when the date-picker input is blurred. * This method disables the starkTimestampInput directive. */ onBlur(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }