UNPKG

@doku-dev/doku-fragment

Version:

A new Angular UI library that moving away from Bootstrap and built from scratch.

82 lines (81 loc) 3.31 kB
import { NgClass } from '@angular/common'; import { AfterViewInit, ChangeDetectorRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; import { ControlValueAccessor, NgControl } from '@angular/forms'; import { Subject } from 'rxjs'; import { DokuFormFieldAccessor, DokuFormFieldAccessorValidateValue, DokuFormFieldOptions } from '../form-field'; import * as i0 from "@angular/core"; export type DokuTimeType = 'hour' | 'minute' | 'second'; export interface DokuTimePartialOptions { hour?: boolean; minute?: boolean; second?: boolean; } export type DokuTimePickerValue = string; export declare class DokuTimePicker implements DokuFormFieldAccessor, OnChanges, OnDestroy, OnInit, ControlValueAccessor, AfterViewInit { private cdr; private ngControl; protected readonly classes: NgClass['ngClass']; /** * Whether to disable the time picker. * @default false */ disabled: boolean; /** * Whether to show the seconds input. * @default false */ showSeconds: boolean; /** * Value of the time picker in ISO String format. * @default '' */ value: string; /** * Minimum time that can be selected. Value in ISO String format. * @default '' */ min: string; /** * Maximum time that can be selected. Value in ISO String format. * @default '' */ max: string; /** * An event emitted when the time changes on blur and condition met. * * Conditions: * - All fields are filled. * - All fields were filled previously, but there is an empty field on the current change. * This case, the value will be an empty string. * - Previous and current values are different. */ timeChange: EventEmitter<string>; protected hourValue: string; protected minuteValue: string; protected secondValue: string; protected notifyOnBlur$: Subject<unknown>; private destroy$; constructor(cdr: ChangeDetectorRef, ngControl: NgControl); fieldOptions?: DokuFormFieldOptions | undefined; onDisable?: ((value: boolean) => void) | undefined; onValidate?: ((value?: DokuFormFieldAccessorValidateValue | undefined) => void) | undefined; registerOnDisable(fn: (value: boolean) => void): void; registerOnValidate?(fn: (value?: DokuFormFieldAccessorValidateValue | undefined) => void): void; onChange?: (value: string) => void; onTouched?: () => void; writeValue(value: string): void; registerOnChange(fn: (value: string) => void): void; registerOnTouched(fn: () => void): void; setDisabledState?(isDisabled: boolean): void; ngOnInit(): void; ngAfterViewInit(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; private constructFinalValue; private setMinMaxTime; private getTimeFromISODateString; private setValueFromISOString; private addPadToValueItem; static ɵfac: i0.ɵɵFactoryDeclaration<DokuTimePicker, [null, { optional: true; self: true; }]>; static ɵcmp: i0.ɵɵComponentDeclaration<DokuTimePicker, "doku-time-picker", ["dokuTimePicker"], { "disabled": "disabled"; "showSeconds": "showSeconds"; "value": "value"; "min": "min"; "max": "max"; }, { "timeChange": "timeChange"; }, never, never, true>; }