frontal
Version:
An Angular select/dropdown component
133 lines (132 loc) • 4.27 kB
TypeScript
import { TemplateRef, ElementRef, ChangeDetectorRef, OnInit, OnDestroy, EventEmitter, AfterViewInit, QueryList } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { Subject, BehaviorSubject } from 'rxjs';
import { Action } from './actions';
import { State } from './state';
export declare class FrontalInputDirective implements OnInit, AfterViewInit, OnDestroy {
private element;
private frontal;
role: string;
ariaAutocomplete: string;
autocomplete: string;
ariaExpanded: boolean;
ariaActiveDescendant: string;
ariaLabeledBy: string;
ariaControls: string;
attrId: string;
private destroy;
constructor(element: ElementRef, frontal: FrontalComponent);
ngOnInit(): void;
ngAfterViewInit(): void;
ngOnDestroy(): void;
private setValue(value);
private setAriaAttributes({isOpen, highlightedIndex});
}
export declare class FrontalButtonDirective implements OnInit, AfterViewInit, OnDestroy {
private element;
private frontal;
type: string;
role: string;
dataToggle: boolean;
ariaHasPopup: string;
ariaExpanded: boolean;
ariaLabel: string;
attrId: string;
ariaLabeledBy: string;
private destroy;
constructor(element: ElementRef, frontal: FrontalComponent);
ngOnInit(): void;
ngAfterViewInit(): void;
ngOnDestroy(): void;
private setAriaAttributes({isOpen});
}
export declare class FrontalLabelDirective {
private frontal;
attrId: string;
attrFor: string;
constructor(frontal: FrontalComponent);
}
export declare class FrontalListDirective implements AfterViewInit, OnDestroy {
private element;
private frontal;
role: string;
attrId: string;
ariaLabeledBy: string;
private destroy;
constructor(element: ElementRef, frontal: FrontalComponent);
ngAfterViewInit(): void;
ngOnDestroy(): void;
}
export declare class FrontalItemDirective implements OnInit, AfterViewInit, OnDestroy {
private element;
private frontal;
private destroy;
role: string;
ariaSelected: boolean;
attrId: string;
value: any;
constructor(element: ElementRef, frontal: FrontalComponent);
ngOnInit(): void;
ngAfterViewInit(): void;
ngOnDestroy(): void;
private setAriaAttributes({highlightedIndex});
}
export declare const FRONTAL_VALUE_ACCESSOR: any;
export declare class FrontalComponent implements AfterViewInit, OnDestroy, ControlValueAccessor {
private _changeDetector;
private platformId;
private _id;
private initialState;
private destroy;
state: BehaviorSubject<State>;
actions: Subject<Action>;
statusStyle: {
border: string;
clip: string;
height: string;
margin: string;
overflow: string;
padding: string;
position: string;
width: string;
};
reducer: ({state, action, changes}: {
state: State;
action: Action;
changes: Partial<State>;
}) => Partial<State>;
itemToString: (value: any) => string;
isOpen: boolean;
defaultHighlightedIndex: number | null;
readonly id: string;
change: EventEmitter<string>;
select: EventEmitter<any>;
template: TemplateRef<any>;
frontalInput: FrontalInputDirective;
frontalItems: QueryList<FrontalItemDirective>;
private _onChange;
constructor(_changeDetector: ChangeDetectorRef, platformId: any);
ngAfterViewInit(): void;
ngOnDestroy(): void;
writeValue(value: any): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
toggleList(): void;
openList(): void;
closeList(): void;
buttonClick(): void;
inputFocus(): void;
inputBlur(): void;
inputChange(value: string): void;
inputArrowDown(): void;
inputArrowUp(): void;
inputEnter(): void;
inputEscape(): void;
itemClick(value: any): void;
itemEnter(index: number): void;
itemLeave(): void;
getItemAtIndex(index: number | null): FrontalItemDirective | null;
private stateReducer(state, action);
private emitSelect;
private emitOnChange;
}