UNPKG

1.77 kBTypeScriptView Raw
1import { NgbTimeStruct } from './ngb-time-struct';
2import * as i0 from "@angular/core";
3export declare function NGB_DATEPICKER_TIME_ADAPTER_FACTORY(): NgbTimeStructAdapter;
4/**
5 * An abstract service that does the conversion between the internal timepicker `NgbTimeStruct` model and
6 * any provided user time model `T`, ex. a string, a native date, etc.
7 *
8 * The adapter is used **only** for conversion when binding timepicker to a form control,
9 * ex. `[(ngModel)]="userTimeModel"`. Here `userTimeModel` can be of any type.
10 *
11 * The default timepicker implementation assumes we use `NgbTimeStruct` as a user model.
12 *
13 * See the [custom time adapter demo](#/components/timepicker/examples#adapter) for an example.
14 *
15 * @since 2.2.0
16 */
17export declare abstract class NgbTimeAdapter<T> {
18 /**
19 * Converts a user-model time of type `T` to an `NgbTimeStruct` for internal use.
20 */
21 abstract fromModel(value: T | null): NgbTimeStruct | null;
22 /**
23 * Converts an internal `NgbTimeStruct` time to a user-model time of type `T`.
24 */
25 abstract toModel(time: NgbTimeStruct | null): T | null;
26 static ɵfac: i0.ɵɵFactoryDeclaration<NgbTimeAdapter<any>, never>;
27 static ɵprov: i0.ɵɵInjectableDeclaration<NgbTimeAdapter<any>>;
28}
29export declare class NgbTimeStructAdapter extends NgbTimeAdapter<NgbTimeStruct> {
30 /**
31 * Converts a NgbTimeStruct value into NgbTimeStruct value
32 */
33 fromModel(time: NgbTimeStruct | null): NgbTimeStruct | null;
34 /**
35 * Converts a NgbTimeStruct value into NgbTimeStruct value
36 */
37 toModel(time: NgbTimeStruct | null): NgbTimeStruct | null;
38 static ɵfac: i0.ɵɵFactoryDeclaration<NgbTimeStructAdapter, never>;
39 static ɵprov: i0.ɵɵInjectableDeclaration<NgbTimeStructAdapter>;
40}