ngnz-time-input
Version:
Material design time input for Angular 8
98 lines (97 loc) • 3.99 kB
TypeScript
import { FocusMonitor } from '@angular/cdk/a11y';
import { ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
import { ControlValueAccessor, FormControl, FormGroup, NgControl } from '@angular/forms';
import { MatFormFieldControl } from '@angular/material';
import * as moment from 'moment';
import { Subject } from 'rxjs/internal/Subject';
import { TimeValue } from '../../classes/time-value/time-value';
import { CssClasses } from '../../datatypes/css-classes';
import { CssClassesDefinition } from '../../datatypes/css-classes-definition';
import { TimeInputMode } from '../../datatypes/time-input-mode.enum';
/**
* Time Input Component.
* The component as a part of UI allows to change time part of Moment data type.
* It looks and uses like a input field.
* It is possible to use mouse wheel and/or control buttons to change time.
* Can be used with [value] attribute or FormControl inside angular reactive form
* @author Aleksey Nazarenko
* @version 0.0.1
*/
export declare class NgnzTimeInputInlineComponent implements ControlValueAccessor, MatFormFieldControl<moment.Moment>, OnInit, OnDestroy, DoCheck {
protected _fm: FocusMonitor;
protected _elRef: ElementRef<HTMLElement>;
protected _chDetector: ChangeDetectorRef;
ngControl: NgControl;
static nextId: number;
readonly BUTTON_HOST_ATTRIBUTES: string[];
stateChanges: Subject<void>;
protected _timeValue: TimeValue;
protected _inputValue: moment.Moment;
protected _hoursControl: FormControl;
protected _minutesControl: FormControl;
protected _secondsControl: FormControl;
parts: FormGroup;
protected _placeholder: string;
protected _required: boolean;
protected _disabled: boolean;
protected _unsubscribe: Subject<unknown>;
protected readonly _debounceTime = 300;
_focused: boolean;
focused: boolean;
controlType: string;
autofilled?: boolean;
id: string;
describedBy: string;
readonly shouldLabelFloat: boolean;
color: string;
colorClassName: string;
buttonMatType: string;
buttonMatTypeClassName: string;
inputClasses: CssClassesDefinition;
inputClassesConf: CssClasses;
buttonsClasses: CssClassesDefinition;
buttonDecreaseClasses: CssClassesDefinition;
buttonIncreaseClasses: CssClassesDefinition;
buttonDecreaseClassesConf: CssClasses;
buttonIncreaseClassesConf: CssClasses;
cssInp: CssClasses;
placeholder: string;
inputMode: TimeInputMode;
value: moment.Moment;
required: boolean;
disabled: boolean;
splitter: string;
protected _splitter: any;
noButtons: boolean;
showButtons: boolean;
noSeconds: boolean;
decreaseBtnIconName: string;
increaseBtnIconName: string;
timeChange: EventEmitter<moment.Moment>;
protected _timeChange: EventEmitter<moment.Moment>;
_onChange: (_: any) => void;
_onTouched: (_: any) => void;
constructor(_fm: FocusMonitor, _elRef: ElementRef<HTMLElement>, _chDetector: ChangeDetectorRef, ngControl: NgControl);
ngOnInit(): void;
ngDoCheck(): void;
ngOnDestroy(): void;
detectChangies(): void;
readonly errorState: boolean;
readonly empty: boolean;
setDescribedByIds(ids: string[]): void;
onContainerClick(event: MouseEvent): void;
writeValue(value: moment.Moment): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
setDisabledState?(isDisabled: boolean): void;
btnsAction(partName: string, step: number): void;
btnIncrease($event: MouseEvent, partName: string): void;
btnDecrease($event: MouseEvent, partName: string): void;
padNumber(value: number, places?: number): string;
wheel($event: WheelEvent, partName: string): void;
protected _cssClassChange(): void;
protected _defineMatButtonType(): string;
protected _defineMatButtonColor(): string;
protected _defineCssButtons(): void;
protected _defineCssInputs(): void;
}