UNPKG

@dhutaryan/ngx-mat-timepicker

Version:

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

63 lines (62 loc) 2.62 kB
import { FactoryProvider, OnDestroy } from '@angular/core'; import { Observable } from 'rxjs'; import { TimeAdapter } from './adapter'; import * as i0 from "@angular/core"; export type ExtractTimeTypeFromSelection<T> = NonNullable<T>; /** * Event emitted by the time selection model when its selection changes. * @docs-private */ export 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. */ export 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>>; } /** * A selection model that contains a single time. */ export declare class MatSingleTimeSelectionModel<T> extends MatTimeSelectionModel<T | null, T> { constructor(adapter: TimeAdapter<T>); /** * Adds a time to the current selection. In the case of a single time selection, the added time * simply overwrites the previous selection */ add(time: T | null): void; /** Clones the selection model. */ clone(): MatSingleTimeSelectionModel<T>; static ɵfac: i0.ɵɵFactoryDeclaration<MatSingleTimeSelectionModel<any>, never>; static ɵprov: i0.ɵɵInjectableDeclaration<MatSingleTimeSelectionModel<any>>; } export declare function MAT_SINGLE_TIME_SELECTION_MODEL_FACTORY(parent: MatSingleTimeSelectionModel<unknown>, adapter: TimeAdapter<unknown>): MatSingleTimeSelectionModel<unknown>; /** * Used to provide a single selection model to a component. */ export declare const MAT_SINGLE_TIME_SELECTION_MODEL_PROVIDER: FactoryProvider;