UNPKG

@dhutaryan/ngx-mat-timepicker

Version:

Angular timepicker to add time which is based on material design and Angular material.

1,055 lines (1,034 loc) 54.2 kB
import * as i0 from '@angular/core'; import { EventEmitter, InjectionToken, Provider, OnDestroy, AfterContentInit, AfterViewChecked, OnInit, NgZone, ElementRef, ChangeDetectorRef, AfterViewInit, OnChanges, ViewContainerRef, SimpleChanges, TemplateRef } from '@angular/core'; import * as i1$1 from '@angular/cdk/overlay'; import { Overlay, ScrollStrategy } from '@angular/cdk/overlay'; import * as i2 from '@angular/cdk/portal'; import { TemplatePortal, ComponentPortal, ComponentType } from '@angular/cdk/portal'; import * as i3 from '@angular/cdk/a11y'; import { ThemePalette } from '@angular/material/core'; import { BooleanInput } from '@angular/cdk/coercion'; import { Subject, Observable } from 'rxjs'; import { AnimationEvent } from '@angular/animations'; import { ControlValueAccessor, Validator, ValidatorFn, AbstractControl, ValidationErrors } from '@angular/forms'; import { MatFormField } from '@angular/material/form-field'; import * as i15 from '@angular/cdk/scrolling'; import * as i1 from '@angular/cdk/platform'; declare class MatTimepickerIntl { /** * Stream that emits whenever the labels here are changed. Use this to notify * components if the labels have changed after initialization. */ readonly changes: Subject<void>; /** A label for inputs title. */ inputsTitle: string; /** A label for dials title. */ dialsTitle: string; /** A label for hour input hint. */ hourInputHint: string; /** A label for minute input hint. */ minuteInputHint: string; /** Label for the button used to open the timepicker popup (used by screen readers). */ openTimepickerLabel: string; /** Label for the button used to close the timepicker popup (used by screen readers). */ closeTimepickerLabel: string; /** A label for OK button to apply time. */ okButton: string; /** A label for cancel button to close timepicker. */ cancelButton: string; /** A label for am text. */ am: string; /** A label for am text. */ pm: string; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimepickerIntl, never>; static ɵprov: i0.ɵɵInjectableDeclaration<MatTimepickerIntl>; } type MatTimePeriodType = 'am' | 'pm'; declare class MatTimePeriod { _intl: MatTimepickerIntl; /** Whether the time period is vertically aligned. */ get vertical(): boolean; set vertical(value: BooleanInput); private _vertical; get period(): MatTimePeriodType; set period(value: MatTimePeriodType); private _period; get disabledPeriod(): MatTimePeriodType | null; set disabledPeriod(value: MatTimePeriodType | null); private _disabledPeriod; periodChanged: EventEmitter<MatTimePeriodType>; constructor(_intl: MatTimepickerIntl); setPeriod(event: Event, period: MatTimePeriodType): void; _isPeriodDisabled(period: MatTimePeriodType): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimePeriod, never>; static ɵcmp: i0.ɵɵComponentDeclaration<MatTimePeriod, "mat-time-period", never, { "vertical": { "alias": "vertical"; "required": false; }; "period": { "alias": "period"; "required": false; }; "disabledPeriod": { "alias": "disabledPeriod"; "required": false; }; }, { "periodChanged": "periodChanged"; }, never, never, true, never>; } /** InjectionToken for timepicker that can be used to override default locale code. */ declare const MAT_TIME_LOCALE: InjectionToken<string>; declare function MAT_DATE_TIME_LOCALE_FACTORY(): string; /** * No longer needed since MAT_TIME_LOCALE has been changed to a scoped injectable. * If you are importing and providing this in your code you can simply remove it. * @deprecated * @breaking-change 18.0.0 */ declare const MAT_TIME_LOCALE_PROVIDER: { provide: InjectionToken<string>; useExisting: InjectionToken<string>; }; declare abstract class TimeAdapter<T, L = any> { /** The locale to use for time. */ protected locale: L; /** * Gets now's time. * @returns Now's time. */ abstract now(): T; /** * Parses a time from a user-provided value. * @param value The value to parse. * @param parseFormat The expected format of the value being parsed * (type is implementation-dependent). * @returns The parsed time. */ abstract parse(value: any, parseFormat: any): T | null; /** * Gets the hour component of the given time. * @param time The time to extract the hour from. * @returns The hour component. */ abstract getHour(time: T): number; /** * Gets the minute component of the given time. * @param time The time to extract the minute from. * @returns The minute component. */ abstract getMinute(time: T): number; /** * Update the hour component of the given time. * @param time The time to update the hour. * @param hour The new hour to update given time. * @returns The new time with updated hour component. */ abstract updateHour(time: T, hour: number): T; /** * Update the minute component of the given time. * @param time The time to update the minute. * @param minute The new minute to update given time. * @returns The new time with updated minute component. */ abstract updateMinute(time: T, minute: number): T; /** * Gets the period component of the given time. * @param time The time to extract the period from. * @returns The period component. */ abstract getPeriod(time: T): MatTimePeriodType; /** * Formats a time as a string according to the given format. * @param time The value to format. * @param displayFormat The format to use to display the time as a string. * @returns The formatted time string. */ abstract format(time: T, displayFormat: any): string; /** * Checks whether the given object is considered a time instance by this timeAdapter. * @param obj The object to check * @returns Whether the object is a time instance. */ abstract isTimeInstance(obj: any): boolean; /** * Checks whether the given time is valid. * @param time The time to check. * @returns Whether the time is valid. */ abstract isValid(time: T): boolean; /** * Gets time instance that is not valid. * @returns An invalid time. */ abstract invalid(): T; /** * Given a potential time object, returns that same time object if it is * a valid time, or `null` if it's not a valid time. * @param obj The object to check. * @returns A time or `null`. */ getValidTimeOrNull(obj: unknown): T | null; /** * Attempts to deserialize a value to a valid time object. The `<mat-timepicker>` will call this * method on all of its `@Input()` properties that accept time. It is therefore possible to * support passing values from your backend directly to these properties by overriding this method * to also deserialize the format used by your backend. * @param value The value to be deserialized into a time object. * @returns The deserialized time object, either a valid time, null if the value can be * deserialized into a null time (e.g. the empty string), or an invalid date. */ deserialize(value: any): T | null; /** * Sets the locale used for all time. * @param locale The new locale. */ setLocale(locale: L): void; /** * Compares two time. * @param first The first time to compare. * @param second The second time to compare. * @returns 0 if the time are equal, a number less than 0 if the first time is earlier, * a number greater than 0 if the first time is later. */ abstract compareTime(first: T, second: T): number; /** * Checks if two time are equal. * @param first The first time to check. * @param second The second time to check. * @returns Whether the two time are equal. * Null time are considered equal to other null time. */ sameTime(first: T | null, second: T | null): boolean; /** * Clamp the given time between min and max time. * @param time The time to clamp. * @param min The minimum value to allow. If null or omitted no min is enforced. * @param max The maximum value to allow. If null or omitted no max is enforced. * @returns `min` if `time` is less than `min`, `max` if time is greater than `max`, * otherwise `time`. */ clampTime(time: T, min?: T | null, max?: T | null): T; } /** Adapts the native JS Date for components that work with time. */ declare class NativeDateTimeAdapter extends TimeAdapter<Date> { private readonly _matTimeLocale; constructor(matTimeLocale: string); now(): Date; parse(value: any, parseFormat?: any): Date | null; parseTime(value: string): { hour: number; minute: number; meridiem?: 'am' | 'pm'; }; getHour(date: Date): number; getMinute(date: Date): number; updateHour(date: Date, hour: number): Date; updateMinute(date: Date, minute: number): Date; getPeriod(date: Date): MatTimePeriodType; format(date: Date, displayFormat: Object): string; /** * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an * invalid date for all other values. */ deserialize(value: any): Date | null; isTimeInstance(obj: any): boolean; isValid(date: Date): boolean; invalid(): Date; compareTime(first: Date, second: Date): number; /** * When converting Date object to string, javascript built-in functions may return wrong * results because it applies its internal DST rules. The DST rules around the world change * very frequently, and the current valid rule is not always valid in previous years though. * We work around this problem building a new Date object which has its internal UTC * representation with the local date and time. * @param dtf Intl.DateTimeFormat object, containing the desired string format. It must have * timeZone set to 'utc' to work fine. * @param date Date from which we want to get the string representation according to dtf * @returns A Date object with its UTC representation based on the passed in date info */ private _format; static ɵfac: i0.ɵɵFactoryDeclaration<NativeDateTimeAdapter, [{ optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<NativeDateTimeAdapter>; } declare class NativeDateTimeModule { static ɵfac: i0.ɵɵFactoryDeclaration<NativeDateTimeModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<NativeDateTimeModule, never, [typeof i1.PlatformModule], never>; static ɵinj: i0.ɵɵInjectorDeclaration<NativeDateTimeModule>; } declare class MatNativeDateTimeModule { static ɵfac: i0.ɵɵFactoryDeclaration<MatNativeDateTimeModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<MatNativeDateTimeModule, never, never, never>; static ɵinj: i0.ɵɵInjectorDeclaration<MatNativeDateTimeModule>; } declare function provideNativeDateTimeAdapter(): Provider; type ExtractTimeTypeFromSelection<T> = NonNullable<T>; /** * Event emitted by the time selection model when its selection changes. * @docs-private */ interface TimeSelectionModelChange<S> { /** New value for the selection. */ selection: S; /** Object that triggered the change. */ source: unknown; /** Previous value */ oldValue?: S; } /** * A selection model containing a time selection. */ declare abstract class MatTimeSelectionModel<S, T = ExtractTimeTypeFromSelection<S>> implements OnDestroy { protected _adapter: TimeAdapter<T>; /** The current selection. */ readonly selection: S; private readonly _selectionChanged; /** Emits when the selection has changed. */ selectionChanged: Observable<TimeSelectionModelChange<S>>; /** * Updates the current selection in the model. * @param value New selection that should be assigned. * @param source Object that triggered the selection change. */ updateSelection(value: S, source: unknown): void; protected constructor(_adapter: TimeAdapter<T>); ngOnDestroy(): void; /** Adds a time to the current selection. */ abstract add(time: T | null): void; /** Clones the selection model. */ abstract clone(): MatTimeSelectionModel<S, T>; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimeSelectionModel<any, any>, never>; static ɵprov: i0.ɵɵInjectableDeclaration<MatTimeSelectionModel<any, any>>; } declare abstract class MatTimeFaceBase<T> implements AfterContentInit, AfterViewChecked { protected _timeAdapter: TimeAdapter<T>; /** The currently selected time. */ get selected(): T | null; set selected(value: T | null); private _selected; /** The minimum selectable time. */ get minTime(): T | null; set minTime(value: T | null); private _minTime; /** The maximum selectable time. */ get maxTime(): T | null; set maxTime(value: T | null); private _maxTime; /** Step over minutes. */ get minuteInterval(): number; set minuteInterval(value: number); private _minuteInterval; /** Whether the clock uses 12 hour format. */ isMeridiem: boolean; /** Color palette. */ color: ThemePalette; /** Emits when any hour, minute or period is selected. */ _userSelection: EventEmitter<T>; selectedChange: EventEmitter<T>; selectedHour: number; selectedMinute: number; period: MatTimePeriodType; disabledPeriod: MatTimePeriodType | null; availableMinutes: number[]; availableHours: number[]; /** * Used for scheduling that focus should be moved to the active cell on the next tick. * We need to schedule it, rather than do it immediately, because we have to wait * for Angular to re-evaluate the view children. */ private _moveFocusOnNextTick; constructor(_timeAdapter: TimeAdapter<T>); ngAfterContentInit(): void; ngAfterViewChecked(): void; /** * Focuses the active cell after or input the microtask queue is empty. * * Adding a 0ms setTimeout seems to fix Voiceover losing focus when pressing PageUp/PageDown. * * Determined a 0ms by gradually increasing duration from 0 and testing two use cases with screen * reader enabled: * * 1. Pressing PageUp/PageDown repeatedly with pausing between each key press. * 2. Pressing and holding the PageDown key with repeated keys enabled. * * Test 1 worked roughly 95-99% of the time with 0ms and got a little bit better as the duration * increased. Test 2 got slightly better until the duration was long enough to interfere with * repeated keys. If the repeated key speed was faster than the timeout duration, then pressing * and holding pagedown caused the entire page to scroll. * * Since repeated key speed can verify across machines, determined that any duration could * potentially interfere with repeated keys. 0ms would be best because it almost entirely * eliminates the focus being lost in Voiceover without causing unintended side effects. * Adding delay also complicates writing tests. */ abstract focusActiveCell(): void; /** Handles hour selection. */ _onHourSelected(hour: number): void; /** Handles minute selection. */ _onMinuteSelected(minute: number): void; /** Handles period changing. */ _onPeriodChanged(period: MatTimePeriodType): void; _getAvailableHours(): number[]; _onKeydown(event: KeyboardEvent, view: 'hour' | 'minute'): void; private _handleHourKeydown; private _handleMinuteKeydown; /** Gets a correct hours based on meridiem and period. */ private _getHourBasedOnPeriod; private _timeSelected; /** Sets min hour. */ private _setMinHour; /** Sets max hour. */ private _setMaxHour; /** Sets min minute. */ private _setMinMinute; /** Sets max minute. */ private _setMaxMinute; /** Sets disabled period. */ private _setDisabledPeriod; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimeFaceBase<any>, [{ optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatTimeFaceBase<any>, never, never, { "selected": { "alias": "selected"; "required": false; }; "minTime": { "alias": "minTime"; "required": false; }; "maxTime": { "alias": "maxTime"; "required": false; }; "minuteInterval": { "alias": "minuteInterval"; "required": false; }; "isMeridiem": { "alias": "isMeridiem"; "required": false; }; "color": { "alias": "color"; "required": false; }; }, { "_userSelection": "_userSelection"; "selectedChange": "selectedChange"; }, never, never, true, never>; } /** Possible options for the timepicker orientation (dial mode only). */ type TimepickerOrientation = 'horizontal' | 'vertical'; type MatDialView = 'hours' | 'minutes'; declare class MatClockDials<T> extends MatTimeFaceBase<T> implements OnInit, OnDestroy { _intl: MatTimepickerIntl; private _ngZone; private _elementRef; private _cdr; /** Layout orientation. */ orientation: TimepickerOrientation; /** Whether the timepicker UI is in touch mode. */ touchUi: boolean; isHoursView: boolean; /** Specifies the view of clock dial. */ private readonly _view; private _viewSubscription; constructor(_intl: MatTimepickerIntl, _timeAdapter: TimeAdapter<T>, _ngZone: NgZone, _elementRef: ElementRef, _cdr: ChangeDetectorRef); ngOnInit(): void; ngOnDestroy(): void; /** Changes clock dial view. */ onViewChange(event: Event, view: MatDialView): void; focusActiveCell(): void; _withZeroPrefix(value: number): string; _onMinuteSelected(minute: number): void; /** Handles hour selection. */ _onHourChanged({ hour, changeView, }: { hour: number; changeView?: boolean; }): void; static ɵfac: i0.ɵɵFactoryDeclaration<MatClockDials<any>, [null, { optional: true; }, null, null, null]>; static ɵcmp: i0.ɵɵComponentDeclaration<MatClockDials<any>, "mat-clock-dials", ["matClockDials"], { "orientation": { "alias": "orientation"; "required": false; }; "touchUi": { "alias": "touchUi"; "required": false; }; }, {}, never, never, true, never>; } declare const MAT_TIMEPICKER_INPUTS_KEYDOWN_HANDLER: InjectionToken<(event: KeyboardEvent) => void>; declare function provideMatTimepickerInputsKeydownHandler(handler: (event: KeyboardEvent) => void): { provide: InjectionToken<(event: KeyboardEvent) => void>; useValue: (event: KeyboardEvent) => void; }; declare abstract class MatTimeInputBase { private element; private _cdr; private _document; get value(): number; set value(value: number); private _value; timeChanged: EventEmitter<number>; _keydown(event: KeyboardEvent): void; private readonly _keydownHandler; get inputElement(): HTMLInputElement; get hasFocus(): boolean; constructor(element: ElementRef<HTMLInputElement>, _cdr: ChangeDetectorRef, _document: Document); focus(): void; blur(): void; setInputValue(value: number | null): void; setInputPlaceholder(value: number): void; abstract _withZeroPrefix(value: number): string; abstract _formatValue(value: number): number; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimeInputBase, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatTimeInputBase, never, never, { "value": { "alias": "value"; "required": false; }; }, { "timeChanged": "timeChanged"; }, never, never, true, never>; } declare class MatHourInput extends MatTimeInputBase { get availableHours(): number[]; set availableHours(value: number[]); private _availableHours; isMeridiem: boolean; constructor(element: ElementRef<HTMLInputElement>, _cdr: ChangeDetectorRef, _document: Document); _withZeroPrefix(value: number): string; _formatValue(hour: number): number; static ɵfac: i0.ɵɵFactoryDeclaration<MatHourInput, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatHourInput, "input[matHourInput]", ["matTimeInput"], { "availableHours": { "alias": "availableHours"; "required": false; }; "isMeridiem": { "alias": "isMeridiem"; "required": false; }; }, {}, never, never, true, never>; } declare class MatMinuteInput extends MatTimeInputBase { /** Step over minutes. */ get interval(): number; set interval(value: number); private _interval; get availableMinutes(): number[]; set availableMinutes(value: number[]); private _availableMinutes; constructor(element: ElementRef<HTMLInputElement>, _cdr: ChangeDetectorRef, _document: Document); _withZeroPrefix(value: number): string; _formatValue(value: number): number; static ɵfac: i0.ɵɵFactoryDeclaration<MatMinuteInput, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatMinuteInput, "input[matMinuteInput]", ["matTimeInput"], { "interval": { "alias": "interval"; "required": false; }; "availableMinutes": { "alias": "availableMinutes"; "required": false; }; }, {}, never, never, true, never>; } declare class MatTimeInputs<T> extends MatTimeFaceBase<T> { _intl: MatTimepickerIntl; private _ngZone; private _elementRef; constructor(_intl: MatTimepickerIntl, _timeAdapter: TimeAdapter<T>, _ngZone: NgZone, _elementRef: ElementRef); /** * Using for skipping that focus shouldn't be moved to the active cell on the next tick. * We need to use it to avoid focusing input for input mode. */ private _skipNextTickFocus; focusActiveCell(): void; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimeInputs<any>, [null, { optional: true; }, null, null]>; static ɵcmp: i0.ɵɵComponentDeclaration<MatTimeInputs<any>, "mat-time-inputs", never, {}, {}, never, never, true, never>; } declare class MatTimepickerContent<S, T = ExtractTimeTypeFromSelection<S>> implements OnInit, AfterViewInit { private _globalModel; private _changeDetectorRef; /** Reference to the internal clock dials component. */ _dials: MatClockDials<T> | undefined; /** Reference to the internal time inputs component. */ _inputs: MatTimeInputs<T> | undefined; /** Reference to the timepicker that created the overlay. */ timepicker: MatTimepickerBase<any, S, T>; /** Display mode. */ mode: TimepickerMode; /** Current state of the animation. */ _animationState: 'enter-dropdown' | 'enter-dialog' | 'void'; /** Whether the clock uses 12 hour format. */ isMeridiem: boolean; /** Whether should toggle face button be shown. */ showToggleModeButton: boolean; /** Step for minutes. */ minuteInterval: number; /** Orientation for dial mode. */ orientation: TimepickerOrientation; /** Portal with projected action buttons. */ _actionsPortal: TemplatePortal | ComponentPortal<any> | null; /** Id of the label for the `role="dialog"` element. */ _dialogLabelId: string | null; /** Text for the close button. */ _closeButtonText: string; /** Whether the close button currently has focus. */ _closeButtonFocused: boolean; /** Whether there is an in-progress animation. */ _isAnimating: boolean; /** * Theme color of the internal timepicker. This API is supported in M2 themes * only, it has no effect in M3 themes. */ color: ThemePalette; /** Emits when an animation has finished. */ readonly _animationDone: Subject<void>; private _model; private _subscriptions; constructor(intl: MatTimepickerIntl, _globalModel: MatTimeSelectionModel<S, T>, _changeDetectorRef: ChangeDetectorRef); ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; /** Changes animation state while closing timepicker content. */ _startExitAnimation(): void; _handleAnimationEvent(event: AnimationEvent): void; onToggleMode(mode: TimepickerMode): void; _getSelected(): T | null; /** Applies the current pending selection to the global model. */ _applyPendingSelection(): void; /** * Assigns a new portal containing the timepicker actions. * @param portal Portal with the actions to be assigned. * @param forceRerender Whether a re-render of the portal should be triggered. This isn't * necessary if the portal is assigned during initialization, but it may be required if it's * added at a later point. */ _assignActions(portal: TemplatePortal<any> | ComponentPortal<any> | null, forceRerender: boolean): void; _handleUserSelection(event: T): void; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimepickerContent<any, any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<MatTimepickerContent<any, any>, "mat-timepicker-content", ["matTimepickerContent"], {}, {}, never, never, true, never>; } /** Possible options for the timepicker to open. */ type TimepickerOpenAs = 'dialog' | 'popup'; /** Possible positions for the timepicker dropdown along the X axis. */ type TimepickerDropdownPositionX = 'start' | 'end'; /** Possible positions for the timepicker dropdown along the Y axis. */ type TimepickerDropdownPositionY = 'above' | 'below'; /** Possible options for the timepicker to display. */ type TimepickerMode = 'input' | 'dial'; /** Possible options for the timepicker period format. */ type TimepickerFormat = '12h' | '24h'; /** Form control that can be associated with a timepicker. */ interface MatTimepickerControl<T> { disabled: boolean; min: T | null; max: T | null; stateChanges: Observable<void>; getThemePalette(): ThemePalette; getConnectedOverlayOrigin(): ElementRef; getOverlayLabelId(): string | null; } /** A timepicker that can be attached to a {@link MatTimepickerControl}. */ interface MatTimepickerPanel<C extends MatTimepickerControl<T>, S, T = ExtractTimeTypeFromSelection<S>> { /** Stream that emits whenever the timepicker is opened. */ openedStream: EventEmitter<void>; /** Stream that emits whenever the timepicker is closed. */ closedStream: EventEmitter<void>; /** Emits when the timepicker's state changes. */ stateChanges: Subject<void>; /** Register an input with the timeepicker. */ registerInput(input: C): MatTimeSelectionModel<S, T>; } /** * Represents the default options for the form field that can be configured * using the `MAT_TIMEPICKER_DEFAULT_OPTIONS` injection token. */ interface MatTimepickerDefaultOptions { /** Default color of the timepicker. */ color?: ThemePalette; /** Default timepicker mode. */ mode: TimepickerMode; /** Defines how timepicker will be appeared. */ openAs: TimepickerOpenAs; /** Default timepicker format. */ format: TimepickerFormat; /** Should toggle face button be visible. */ showToggleModeButton: boolean; /** Step for minutes. */ minuteInterval: number; /** Orientation for dial mode. */ orientation: TimepickerOrientation; } /** * Injection token that can be used to configure the * default options for all timepickers within an app. */ declare const MAT_TIMEPICKER_DEFAULT_OPTIONS: InjectionToken<MatTimepickerDefaultOptions>; declare abstract class MatTimepickerBase<C extends MatTimepickerControl<T>, S, T = ExtractTimeTypeFromSelection<S>> implements OnChanges { private _viewContainerRef; private _overlay; private _ngZone; private _defaultActionsComponent; private _model; private _defaults?; /** Whether the timepicker pop-up should be disabled. */ get disabled(): boolean; set disabled(value: BooleanInput); private _disabled; /** Whether the timepicker is open. */ get opened(): boolean; set opened(value: BooleanInput); private _opened; /** Whether the timepicker mode which determines what the timepicker will be opened as. */ get openAs(): TimepickerOpenAs; set openAs(value: TimepickerOpenAs); private _openAs; /** Color palette to use on the timepicker's content. */ get color(): ThemePalette; set color(value: ThemePalette); private _color; /** Timepicker display mode. */ get mode(): TimepickerMode; set mode(value: TimepickerMode); private _mode; /** Timepicker period format. */ get format(): TimepickerFormat; set format(value: TimepickerFormat); private _format; /** Show or hide toggle button between dial and input. */ get showToggleModeButton(): boolean; set showToggleModeButton(value: boolean); private _showToggleModeButton; /** Step for minutes. */ get minuteInterval(): number; set minuteInterval(value: number); private _minuteInterval; /** Orientation for dial mode. */ get orientation(): TimepickerOrientation; set orientation(value: TimepickerOrientation); private _orientation; /** * Whether the timepicker UI is in touch mode. In touch mode elements are larger for bigger touch targets. */ get touchUi(): boolean; set touchUi(value: boolean); private _touchUi; /** Preferred position of the timepicker in the X axis. */ xPosition: TimepickerDropdownPositionX; /** Preferred position of the timepicker in the Y axis. */ yPosition: TimepickerDropdownPositionY; /** * Whether to restore focus to the previously-focused element when the timepicker is closed. * Note that automatic focus restoration is an accessibility feature and it is recommended that * you provide your own equivalent, if you decide to turn it off. */ restoreFocus: boolean; /** Emits when the timepicker has been opened. */ readonly openedStream: EventEmitter<void>; /** Emits when the timepicker has been closed. */ readonly closedStream: EventEmitter<void>; /** The id for the timepicker. */ id: string; /** The input element this timepicker is associated with. */ timepickerInput: C; /** Portal with projected action buttons. */ _actionsPortal: TemplatePortal | null; /** Emits when the timepicker's state changes. */ readonly stateChanges: Subject<void>; /** A reference to the overlay into which we've rendered the timepicker. */ private _overlayRef; /** Reference to the component instance rendered in the overlay. */ private _componentRef; /** Unique class that will be added to the backdrop so that the test harnesses can look it up. */ private _backdropHarnessClass; /** The element that was focused before the timepicker was opened. */ private _focusedElementBeforeOpen; private _document; /** Scroll strategy. */ private _scrollStrategy; /** The minimum selectable time. */ _getMinTime(): T | null; /** The maximum selectable time. */ _getMaxTime(): T | null; constructor(_viewContainerRef: ViewContainerRef, _overlay: Overlay, _ngZone: NgZone, scrollStrategy: any, _defaultActionsComponent: ComponentType<any>, _model: MatTimeSelectionModel<S, T>, _defaults?: MatTimepickerDefaultOptions | undefined); ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** Opens the timepicker. */ open(): void; /** Closes the timepicker. */ close(): void; /** * Register an input with this timepicker. * @param input The timepicker input to register with this timepicker. * @returns Selection model that the input should hook itself up to. */ registerInput(input: C): MatTimeSelectionModel<S, T>; /** * Registers a portal containing action buttons with the timepicker. * @param portal Portal to be registered. */ registerActions(portal: TemplatePortal): void; /** * Removes a portal containing action buttons from the timepicker. * @param portal Portal to be removed. */ removeActions(portal: TemplatePortal): void; /** Applies the current pending selection on the overlay to the model. */ _applyPendingSelection(): void; /** Forwards relevant values from the timepicker to the timepicker content inside the overlay. */ protected _forwardContentValues(instance: MatTimepickerContent<S, T>): void; /** Opens the overlay with the timepicker. */ private _openOverlay; /** Destroys the current overlay. */ private _destroyOverlay; /** Gets a position strategy that will open the timepicker as a dropdown. */ private _getDialogStrategy; /** Gets a position strategy that will open the timepicker as a dropdown. */ private _getDropdownStrategy; /** Sets the positions of the timepicker in dropdown mode based on the current configuration. */ private _setConnectedPositions; /** Gets an observable that will emit when the overlay is supposed to be closed. */ private _getCloseStream; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimepickerBase<any, any, any>, [null, null, null, null, null, null, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatTimepickerBase<any, any, any>, never, never, { "disabled": { "alias": "disabled"; "required": false; }; "opened": { "alias": "opened"; "required": false; }; "openAs": { "alias": "openAs"; "required": false; }; "color": { "alias": "color"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "format": { "alias": "format"; "required": false; }; "showToggleModeButton": { "alias": "showToggleModeButton"; "required": false; }; "minuteInterval": { "alias": "minuteInterval"; "required": false; }; "orientation": { "alias": "orientation"; "required": false; }; "touchUi": { "alias": "touchUi"; "required": false; }; "xPosition": { "alias": "xPosition"; "required": false; }; "yPosition": { "alias": "yPosition"; "required": false; }; "restoreFocus": { "alias": "restoreFocus"; "required": false; }; }, { "openedStream": "opened"; "closedStream": "closed"; }, never, never, true, never>; static ngAcceptInputType_touchUi: unknown; static ngAcceptInputType_restoreFocus: unknown; } declare class MatTimepicker<T> extends MatTimepickerBase<MatTimepickerControl<T>, T | null, T> { static ɵfac: i0.ɵɵFactoryDeclaration<MatTimepicker<any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<MatTimepicker<any>, "mat-timepicker", ["matTimepicker"], {}, {}, never, never, true, never>; } declare class MatTimepickerToggleIcon { static ɵfac: i0.ɵɵFactoryDeclaration<MatTimepickerToggleIcon, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatTimepickerToggleIcon, "[matTimepickerToggleIcon]", never, {}, {}, never, never, true, never>; } declare class MatTimepickerToggle<T> implements OnChanges, OnDestroy { _intl: MatTimepickerIntl; private _cdr; /** Timepicker instance. */ timepicker: MatTimepicker<T>; /** Whether the toggle button is disabled. */ get disabled(): boolean; set disabled(value: BooleanInput); private _disabled; /** Whether ripples on the toggle should be disabled. */ disableRipple: boolean; /** Tabindex for the toggle. */ tabIndex: number | null; /** Custom icon set by the consumer. */ customIcon: MatTimepickerToggleIcon; /** Screen-reader label for the button. */ ariaLabel: string; private _stateChanges; constructor(defaultTabIndex: string, _intl: MatTimepickerIntl, _cdr: ChangeDetectorRef); ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** Opens timepicker. */ open(event: Event): void; private _watchStateChanges; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimepickerToggle<any>, [{ attribute: "tabindex"; }, null, null]>; static ɵcmp: i0.ɵɵComponentDeclaration<MatTimepickerToggle<any>, "mat-timepicker-toggle", ["matTimepickerToggle"], { "timepicker": { "alias": "for"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "ariaLabel": { "alias": "aria-label"; "required": false; }; }, {}, ["customIcon"], ["[matTimepickerToggleIcon]"], true, never>; } declare class MatTimepickerContentLayout { /** Content title. */ title: string; /** Layout orientation. */ orientation: TimepickerOrientation; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimepickerContentLayout, never>; static ɵcmp: i0.ɵɵComponentDeclaration<MatTimepickerContentLayout, "mat-timepicker-content-layout", ["matTimepickerContent"], { "title": { "alias": "title"; "required": false; }; "orientation": { "alias": "orientation"; "required": false; }; }, {}, never, ["[hours]", "[minutes]", "[mat-time-period]", "*"], true, never>; } /** * An event used for timepicker input and change events. We don't always have access to a native * input or change event because the event may have been triggered by the user clicking on the * clock popup. For consistency, we always use MatTimepickerInputEvent instead. */ declare class MatTimepickerInputEvent<D, S = unknown> { /** Reference to the timepicker input component that emitted the event. */ target: MatTimepickerInputBase<S, D>; /** Reference to the native input element associated with the timepicker input. */ targetElement: HTMLElement; /** The new value for the target timepicker input. */ value: D | null; constructor( /** Reference to the timepicker input component that emitted the event. */ target: MatTimepickerInputBase<S, D>, /** Reference to the native input element associated with the timepicker input. */ targetElement: HTMLElement); } declare abstract class MatTimepickerInputBase<S, T = ExtractTimeTypeFromSelection<S>> implements OnChanges, OnDestroy, ControlValueAccessor, Validator { protected _elementRef: ElementRef<HTMLInputElement>; _timeAdapter: TimeAdapter<T>; /** The value of the input. */ get value(): T | null; set value(value: any); protected _model: MatTimeSelectionModel<S, T> | undefined; /** Whether the timepicker-input is disabled. */ get disabled(): boolean; set disabled(value: BooleanInput); private _disabled; /** Emits when a change event is fired on this <input>. */ readonly timeChange: EventEmitter<MatTimepickerInputEvent<T, S>>; /** Emits when an input event is fired on this <input>. */ readonly timeInput: EventEmitter<MatTimepickerInputEvent<T, S>>; /** Gets the minimum time for the input. Used for validation. */ abstract _getMinTime(): T | null; /** Gets the maximum time for the input. Used for validation. */ abstract _getMaxTime(): T | null; /** Combined form control validator for this input. */ protected abstract _validator: ValidatorFn | null; /** Whether the component has been initialized. */ private _isInitialized; /** * Since the value is kept on the model which is assigned in an Input, * we might get a value before we have a model. This property keeps track * of the value until we have somewhere to assign it. */ private _pendingValue; /** Emits when the internal state has changed */ readonly stateChanges: Subject<void>; _onTouched: () => void; _validatorOnChange: () => void; private _cvaOnChange; private _valueChangesSubscription; constructor(_elementRef: ElementRef<HTMLInputElement>, _timeAdapter: TimeAdapter<T>); ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** Registers a time selection model with the input. */ _registerModel(model: MatTimeSelectionModel<S, T>): void; _onInput(value: string): void; /** Handles change event on the input. */ _onChange(): void; /** Handles blur event on the input. */ _onBlur(): void; /** Implemented as part of ControlValueAccessor. */ writeValue(value: T | null): void; /** Implemented as part of ControlValueAccessor. */ registerOnChange(fn: any): void; /** Implemented as part of ControlValueAccessor. */ registerOnTouched(fn: () => void): void; /** Implemented as part of ControlValueAccessor. */ setDisabledState?(isDisabled: boolean): void; registerOnValidatorChange(fn: () => void): void; validate(c: AbstractControl): ValidationErrors | null; /** Whether the last value set on the input was valid. */ protected _lastValueValid: boolean; /** Assigns a value to the input's model. */ protected abstract _assignValueToModel(model: T | null): void; /** Converts a value from the model into a native value for the input. */ protected abstract _getValueFromModel(modelValue: S): T | null; /** Predicate that determines whether the input should handle a particular change event. */ protected abstract _shouldHandleChangeEvent(event: TimeSelectionModelChange<S>): boolean; /** Programmatically assigns a value to the input. */ protected _assignValueProgrammatically(value: T | null): void; /** Formats a value and sets it on the input element. */ protected _formatValue(value: T | null): void; /** Gets the base validator functions. */ protected _getValidators(): ValidatorFn[]; /** Whether a value is considered valid. */ private _isValidValue; /** Assigns a value to the model. */ private _assignValue; /** The form control validator for whether the input parses. */ private _parseValidator; /** The form control validator for the min time. */ private _minValidator; /** The form control validator for the max time. */ private _maxValidator; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimepickerInputBase<any, any>, [null, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatTimepickerInputBase<any, any>, never, never, { "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "timeChange": "timeChange"; "timeInput": "timeInput"; }, never, never, true, never>; } /** * Checks whether the `SimpleChanges` object from an `ngOnChanges` * callback has any changes, accounting for time objects. */ declare function timeInputsHaveChanged(changes: SimpleChanges, adapter: TimeAdapter<unknown>): boolean; declare const MAT_TIMEPICKER_VALUE_ACCESSOR: any; declare const MAT_TIMEPICKER_VALIDATORS: any; /** Directive used to connect an input to a MatTimepicker. */ declare class MatTimepickerInput<T> extends MatTimepickerInputBase<T | null, T> implements MatTimepickerControl<T | null> { private _formField?; /** The timepicker that this input is associated with. */ set matTimepicker(timepicker: MatTimepickerPanel<MatTimepickerControl<T>, T | null, T>); _timepicker: MatTimepickerPanel<MatTimepickerControl<T>, T | null, T>; /** The combined form control validator for this input. */ protected _validator: ValidatorFn | null; /** The minimum valid date. */ get min(): T | null; set min(value: T | null); private _min; /** The maximum valid date. */ get max(): T | null; set max(value: T | null); private _max; constructor(elementRef: ElementRef<HTMLInputElement>, timeAdapter: TimeAdapter<T>, _formField?: MatFormField | undefined); /** * Gets the element that the timepicker popup should be connected to. * @return The element to connect the popup to. */ getConnectedOverlayOrigin(): ElementRef; /** Returns the palette used by the input's form field, if any. */ getThemePalette(): ThemePalette; /** Gets the ID of an element that should be used a description for the timepicker overlay. */ getOverlayLabelId(): string | null; /** Gets the input's minimum time. */ _getMinTime(): T | null; /** Gets the input's maximum time. */ _getMaxTime(): T | null; protected _assignValueToModel(value: T | null): void; protected _getValueFromModel(modelValue: T | null): T | null; protected _shouldHandleChangeEvent(event: TimeSelectionModelChange<T>): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimepickerInput<any>, [null, { optional: true; }, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatTimepickerInput<any>, "input[matTimepicker]", ["matTimepickerInput"], { "matTimepicker": { "alias": "matTimepicker"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; }, {}, never, never, true, never>; } interface ClockDialViewCell { value: number; displayValue: string; left: number; top: number; disabled: boolean; } declare const ALL_HOURS: number[]; declare class MatHoursClockDial implements OnInit { private _element; private _cdr; private _document; /** Selected hour. */ get selectedHour(): number; set selectedHour(value: number); private _selectedHour; /** Whether the clock uses 12 hour format. */ get isMeridiem(): boolean; set isMeridiem(value: boolean); private _isMeridiem; get availableHours(): number[]; set availableHours(value: number[]); private _availableHours; /** Color palette. */ color: ThemePalette; /** Whether the timepicker UI is in touch mode. */ get touchUi(): boolean; set touchUi(value: boolean); private _touchUi; /** Emits selected hour. */ selectedChange: EventEmitter<{ hour: number; changeView?: boolean; }>; hours: ClockDialViewCell[]; get disabledHand(): boolean; get isHour(): boolean; constructor(_element: ElementRef<HTMLElement>, _cdr: ChangeDetectorRef, _document: Document); ngOnInit(): void; /** Hand styles based on selected hour. */ _handStyles(): any; /** Handles mouse and touch events on dial and document. */ _onUserAction(event: MouseEvent | TouchEvent): void; _isActiveCell(hour: number): boolean; /** Changes selected hour based on coordinates. */ private _setHour; /** Return value of hour. */ private _getHourValue; /** Creates list of hours. */ private _initHours; /** Returns radius based on hour */ private _getRadius; /** Use defaultView of injected document if available or fallback to global window reference */ private _getWindow; static ɵfac: i0.ɵɵFactoryDeclaration<MatHoursClockDial, never>; static ɵcmp: i0.ɵɵComponentDeclaration<MatHoursClockDial, "mat-hours-clock-dial", ["matHoursClockDial"], { "selectedHour": { "alias": "selectedHour"; "required": false; }; "isMeridiem": { "alias": "isMeridiem"; "required": false; }; "availableHours": { "alias": "availableHours"; "required": false; }; "color": { "alias": "color"; "required": false; }; "touchUi": { "alias": "touchUi"; "required": false; }; }, { "selectedChange": "selectedChange"; }, never, never, true, never>; } declare const ALL_MINUTES: number[]; declare class MatMinutesClockDial implements OnInit { private _element; private _cdr; private _document; /** Selected minute. */ get selectedMinute(): number; set selectedMinute(value: number); private _selectedMinute; /** Step over minutes. */ get interval(): number; set interval(value: number); private _interval; get availableMinutes(): number[]; set availableMinutes(value: number[]); private _availableMinutes; /** Color palette. */ color: ThemePalette; /** Whether the timepicker UI is in touch mode. */ get touchUi(): boolean; set touchUi(value: boolean); private _touchUi; /** Emits selected minute. */ selectedChange: EventEmitter<number>; minutes: ClockDialViewCell[]; get disabled(): boolean; get isMinutePoint(): boolean; constructor(_element: ElementRef<HTMLElement>, _cdr: ChangeDetectorRef, _document: Document); ngOnInit(): void; /** Hand styles based on selected minute. */ _handStyles(): any; /** Handles mouse and touch events on dial and document. */ _onUserAction(event: MouseEvent | TouchEvent): void; _isActiveCell(minute: number): boolean; private _setMinute; /** Creates list of minutes. */ private _initMinutes; /** Use defaultView of injected document if available or fallback to global window reference */ private _getWindow; static ɵfac: i0.ɵɵFactoryDeclaration<MatMinutesClockDial, never>; static ɵcmp: i0.ɵɵComponentDeclaration<MatMinutesClockDial, "mat-minutes-clock-dial", ["matMinutesClockDial"], { "selectedMinute": { "alias": "selectedMinute"; "required": false; }; "interval": { "alias": "interval"; "required": false; }; "availableMinutes": { "alias": "availableMinutes"; "required": false; }; "color": { "alias": "color"; "required": false; }; "touchUi": { "alias": "touchUi"; "required": false; }; }, { "selectedChange": "selectedChange"; }, never, never, true, never>; } /** Button that will close the timepicker and assign the current selection to the data model. */ declare class MatTimepickerApply { private _timepicker; constructor(_timepicker: MatTimepickerBase<MatTimepickerControl<any>, unknown>); _applySelection(): void; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimepickerApply, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatTimepickerApply, "[matTimepickerApply]", never, {}, {}, never, never, true, never>; } /** Button that will close the timepicker and discard the current selection. */ declare class MatTimepickerCancel { private _timepicker; constructor(_timepicker: MatTimepickerBase<MatTimepickerControl<any>, unknown>); close(): void; static ɵfac: i0.ɵɵFactoryDeclaration<MatTimepickerCancel, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatTimepickerCancel, "[matTimepickerCancel]", never, {}, {}, never, never, true, never>; } /** * Container that can be used to project a row of action buttons * to the bottom of a timepicker. */ declare class MatTimepickerActions implements AfterViewInit, OnDestroy { private _timepicker; private _viewContainerRef; _template: TemplateRef<unknown>; private _portal; constructor(_timepicker: MatTimepickerBase<MatTimepickerControl<any>, unknown>, _