@ux-aspects/ux-aspects
Version:
Open source user interface framework for building modern, responsive, mobile big data applications
85 lines (84 loc) • 4.47 kB
TypeScript
import { BooleanInput } from '@angular/cdk/coercion';
import { EventEmitter, OnChanges, OnDestroy } from '@angular/core';
import { ControlValueAccessor, FormGroupDirective } from '@angular/forms';
import * as i0 from "@angular/core";
export declare const NUMBER_PICKER_VALUE_ACCESSOR: {
provide: import("@angular/core").InjectionToken<readonly ControlValueAccessor[]>;
useExisting: import("@angular/core").Type<any>;
multi: boolean;
};
export declare class NumberPickerComponent implements ControlValueAccessor, OnDestroy, OnChanges {
readonly _formGroup: FormGroupDirective;
private readonly _changeDetector;
private _min;
private _max;
private _step;
private _disabled;
private _value;
private _lastValue;
private _focused;
private _propagateChange;
_touchedChange: () => void;
/** Sets the id of the number picker. The child input will have this value with a -input suffix as its id. */
id: string;
/** Provide an aria label for the number picker. */
ariaLabel: string;
/** Provide an aria labelledby attribute */
labelledBy: string;
/** Define the precision of floating point values */
precision: number;
/** The placeholder text which appears in the text input area when it is empty.*/
placeholder: string;
/** Specified if this is a required input. */
required: boolean;
/** Specified if this is a readonly input. */
set readonly(value: boolean);
get readonly(): boolean;
/** If two way binding is used this value will be updated any time the number picker value changes. */
valueChange: EventEmitter<number>;
/** Sets the value displayed in the number picker component. */
get value(): number;
set value(value: number);
/** Defines the minimum value the number picker can set. */
get min(): number;
set min(value: number);
/** Defines the maximum value the number picker can set. */
get max(): number;
set max(value: number);
/** Defines the amount the number picker should increase or decrease when the buttons or arrow keys are used. */
set step(value: number | ((value: number, direction: StepDirection) => number));
/** Indicate if the number picker is disabled or not. */
get disabled(): boolean;
set disabled(value: boolean);
get inputId(): string;
/** Store the current valid state */
_valid: boolean;
/** This is a flag to indicate when the component has been destroyed to avoid change detection being made after the component
* is no longer instantiated. A workaround for Angular Forms bug (https://github.com/angular/angular/issues/27803) */
private _isDestroyed;
private _readonly;
ngOnChanges(): void;
ngOnDestroy(): void;
getStep(direction: StepDirection): number;
increment(event?: MouseEvent | KeyboardEvent): void;
decrement(event?: MouseEvent | KeyboardEvent): void;
isValid(): boolean;
onScroll(event: WheelEvent): void;
writeValue(value: number): void;
registerOnChange(fn: (_: number) => void): void;
registerOnTouched(fn: () => void): void;
setDisabledState(isDisabled: boolean): void;
/** Set the value and emit the change to the output and Angular forms. */
_emitValueChange(value: number): void;
getMaxValueForComparison(): number;
getMinValueForComparison(): number;
onFocusIn(): void;
onFocusOut(): void;
static ngAcceptInputType_readonly: BooleanInput;
static ɵfac: i0.ɵɵFactoryDeclaration<NumberPickerComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NumberPickerComponent, "ux-number-picker, ux-number-picker-inline", never, { "id": { "alias": "id"; "required": false; }; "ariaLabel": { "alias": "aria-label"; "required": false; }; "labelledBy": { "alias": "aria-labelledby"; "required": false; }; "precision": { "alias": "precision"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "required": { "alias": "required"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "value": { "alias": "value"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "step": { "alias": "step"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "valueChange": "valueChange"; }, never, never, false, never>;
}
export declare enum StepDirection {
Increment = 0,
Decrement = 1
}