import * as i0 from '@angular/core'; import { ElementRef, AfterViewInit, OnDestroy, DoCheck, EventEmitter } from '@angular/core'; import { NgForm, FormGroupDirective, NgControl, ControlValueAccessor, Validator, AbstractControl, ValidationErrors } from '@angular/forms'; import { MatDatepickerInputEvent, MatDatepicker, MatCalendar } from '@angular/material/datepicker'; import { MatFormFieldControl } from '@angular/material/form-field'; import { ErrorStateMatcher, ThemePalette } from '@angular/material/core'; import { Subject } from 'rxjs'; /** * Date class item. * @template D Date type. */ declare class DateClass { /** Date value. */ value: D; /** CSS class name(s). */ className: string; } /** * An event used for `ngx-multiple-dates` date removal. * @template D Date type. */ declare class DateRemoveEvent { /** Event type Specifies where the date was removed from (chip, datepicker). */ type: 'chip' | 'datepicker'; /** Date removed. */ date: D; } declare abstract class MultipleDatesBaseMixinBase { protected $elementRef: ElementRef; _defaultErrorStateMatcher: ErrorStateMatcher; _parentForm: NgForm; _parentFormGroup: FormGroupDirective; ngControl: NgControl; /** * Stream that emits whenever the state of the control changes such that the parent * `MatFormField` needs to run change detection. */ readonly stateChanges: Subject; constructor($elementRef: ElementRef, _defaultErrorStateMatcher: ErrorStateMatcher, _parentForm: NgForm, _parentFormGroup: FormGroupDirective, ngControl: NgControl); } declare const _MultipleDatesBaseMixinBase: typeof MultipleDatesBaseMixinBase; /** * Multiple dates component. * @template D Date type. */ declare class MultipleDatesComponent extends _MultipleDatesBaseMixinBase implements AfterViewInit, OnDestroy, DoCheck, ControlValueAccessor, MatFormFieldControl, Validator { ngControl: NgControl; protected $elementRef: ElementRef; private readonly _changeDetectorRef; private readonly _focusMonitor; private readonly _dateAdapter; static nextId: number; /** Unique id of the element. */ id: string; describedBy: string; /** Whether the control is in an error state. */ errorState: boolean; /** An object used to control when error messages are shown. */ errorStateMatcher: ErrorStateMatcher; tabIndex: number; /** * The date/time components to include, using predefined options or a custom format string. * @see {@link https://angular.io/api/common/DatePipe#usage-notes DatePipe Usage notes} for more * information. */ format?: string; /** Emits when a change event is fired on this `ngx-multiple-dates` element. */ readonly dateChange: EventEmitter>; /** Emits on a date removal. */ readonly remove: EventEmitter>; /** Whether `ngx-multiple-dates` element has focus. */ focused: boolean; /** A name for this control that can be used by mat-form-field. */ controlType?: string | undefined; /** * Model used to reset datepicker selected value, so unselect just selected date will be * possible. */ resetModel: D; private readonly _destroy; /** * The datepicker (or calendar - for inline view) that this `ngx-multiple-dates` element is * associated with. */ private _matDatepicker; /** Whether datepicker should be closed on date selected, or opened to select more dates. */ private _closeOnSelected; /** Placeholder to be shown if no value has been selected. */ private _placeholder; /** Whether the component is required. */ private _required; /** Whether the component is disabled. */ private _disabled; /** The value of the `ngx-multiple-dates` control. */ private _value; /** * Theme color palette for the component. This API is supported in M2 themes only, it has no * effect in M3 themes. * For information on applying color variants in M3, see * https://material.angular.io/guide/theming#using-component-color-variants. */ private _color; /** Function that can be used to filter out dates within the datepicker. */ private _dateFilter; /** The minimum valid date. */ private _min; /** The maximum valid date. */ private _max; /** Custom date classes. */ private _classes; private _validator; private _onChange; private _onTouched; private _onValidatorChange; private _filterValidator; private _minValidator; private _maxValidator; /** * The datepicker (or calendar - for inline view) that this `ngx-multiple-dates` element is * associated with. */ get matDatepicker(): MatDatepicker | MatCalendar; set matDatepicker(value: MatDatepicker | MatCalendar); /** Whether datepicker should be closed on date selected, or opened to select more dates. */ get closeOnSelected(): boolean; set closeOnSelected(value: boolean); /** Placeholder to be shown if no value has been selected. */ get placeholder(): string; set placeholder(value: string); /** Whether the component is required. */ get required(): boolean; set required(value: boolean); /** Whether the component is disabled. */ get disabled(): boolean; set disabled(value: boolean); /** The value of the `ngx-multiple-dates` control. */ get value(): D[] | null; set value(value: D[] | null); /** * Theme color palette for the component. This API is supported in M2 themes only, it has no * effect in M3 themes. * For information on applying color variants in M3, see * https://material.angular.io/guide/theming#using-component-color-variants. */ get color(): ThemePalette | null; set color(value: ThemePalette | null); /** Function that can be used to filter out dates within the datepicker. */ get matDatepickerFilter(): (date: D | null) => boolean; set matDatepickerFilter(value: (date: D | null) => boolean); /** The minimum valid date. */ get min(): D | null; set min(value: D | null); /** The maximum valid date. */ get max(): D | null; set max(value: D | null); /** Custom date classes. */ get classes(): Array>; set classes(value: Array>); /** Whether the `MatFormField` label should try to float. */ get shouldLabelFloat(): boolean; /** Whether the select has a value. */ get empty(): boolean; /** Whether the settled picker is a datepicker. */ get isDatepicker(): boolean; /** * Creates an instance of MultipleDatesComponent. * @param ngControl Form control to manage component. * @param $elementRef A wrapper around a native element inside of a View. * @param _changeDetectorRef Base class that provides change detection functionality. * @param _focusMonitor Monitors mouse and keyboard events to determine the cause of focus events. * @param _dateAdapter Adapts type `D` to be usable as a date by cdk-based components that work * with dates. * @param parentForm Parent form. * @param parentFormGroup Parent form group. * @param defaultErrorStateMatcher Provider that defines how form controls behave with regards to * displaying error messages. * @param tabIndex Tab index. */ constructor(); ngAfterViewInit(): void; ngOnDestroy(): void; ngDoCheck(): void; private _updateErrorState; /** Focuses the `ngx-multiple-dates` element. */ focus(): void; /** Used to leave focus from the `ngx-multiple-dates` element. */ blur(): void; writeValue(value: D[] | null): void; registerOnChange(fn: (_: any) => void): void; registerOnTouched(fn: () => void): void; registerOnValidatorChange(fn: () => void): void; /** * Sets the list of element IDs that currently describe this control. * @param ids Ids to set. */ setDescribedByIds(ids: string[]): void; /** Handles a click on the control's container. */ onContainerClick(): void; /** * Performs synchronous validation for the control. * @param control The control to validate against. * @returns A map of validation errors if validation fails, otherwise null. */ validate(control: AbstractControl): ValidationErrors | null; /** * Function used to add CSS classes to selected dates. * @param date Date to check if classes should be applied. * @returns CSS classes to apply. */ dateClass: (date: D) => string[]; /** * Fires when a change event is fired on the datepicker ``. * @param event Change event. */ dateChanged(event: MatDatepickerInputEvent): void; /** * Removes selected chip from the list. * @param date Value to remove. */ removeChip(date: D): void; trackByValue(_index: number, item: D): D; getClassName(value: D): string | undefined; private _setStartAt; private _setDisabled; private _setDateClass; private _find; private _sort; private _getValidDateOrNull; getDateFormat(date: unknown): string; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "ngx-multiple-dates", ["ngxMultipleDates"], { "id": { "alias": "id"; "required": false; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "format": { "alias": "format"; "required": false; }; "matDatepicker": { "alias": "matDatepicker"; "required": false; }; "closeOnSelected": { "alias": "closeOnSelected"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "required": { "alias": "required"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "value": { "alias": "value"; "required": false; }; "color": { "alias": "color"; "required": false; }; "matDatepickerFilter": { "alias": "matDatepickerFilter"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "classes": { "alias": "classes"; "required": false; }; }, { "dateChange": "dateChange"; "remove": "remove"; }, never, never, true, never>; } export { DateClass, DateRemoveEvent, MultipleDatesComponent };