@ngx-dummy/select-simple
Version:
A simple select component to use in Angular / Ionic projects .. (WIP) and sample app using it
113 lines • 5.64 kB
TypeScript
import { AfterContentInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnChanges, Provider, QueryList, Renderer2, SimpleChanges, TemplateRef } from '@angular/core';
import { AbstractControl, ControlValueAccessor } from '@angular/forms';
import { DomSanitizer } from '@angular/platform-browser';
import { Observable } from 'rxjs';
import { SelectItemComponent } from './select-item.component';
import { BasicStylesSet, IOption, IOptionClickEvent, ITemplates } from './settings/models';
import * as i0 from "@angular/core";
export declare const SELECT_VALUE_ACCESSOR_PROVIDER: Provider;
export declare const NG_VALIDATORS_PROVIDER: Provider;
export declare class SelectComponent implements AfterContentInit, OnChanges, ControlValueAccessor {
el: ElementRef<Element>;
renderer: Renderer2;
cd: ChangeDetectorRef;
private sanitizer;
zone: NgZone;
defaultOpenerTemplate: TemplateRef<HTMLElement> | undefined;
itemsListDefaultTmpl: TemplateRef<HTMLElement> | undefined;
projectedItems: QueryList<SelectItemComponent> | undefined;
templates: ITemplates | undefined;
name: string | null;
/** set additional custom classList to the Select component's panel */
panelStyleClass: string;
/** set additional custom classList to the Select component */
styleClass: string;
readonly: boolean;
required: boolean;
/** whether to display reset button in the end of the options */
resetBtn: boolean;
/** whether to display search field */
searchField: boolean;
/** whether to set auto focus to component */
autofocus: boolean;
/** default component caption (panel caption) */
placeholder?: string;
/** string key of the Options input (in case of complex object) of kind: 'key' / 'key.subkey'... if set, would resolve the options' captions */
optionLabelKey?: string | undefined;
selectIconClass: string;
tabindex: number;
itemSize: number | undefined;
onChange: EventEmitter<any>;
onClick: EventEmitter<any>;
onShow: EventEmitter<boolean>;
onHide: EventEmitter<boolean>;
onFocus: EventEmitter<any>;
onBlur: EventEmitter<any>;
openerBtnTemplate: TemplateRef<HTMLElement> | undefined;
itemslistTemplate: TemplateRef<HTMLElement> | undefined;
trigger_icon: import("@angular/platform-browser").SafeResourceUrl;
private _overlayVisible$$;
private _optionsToDisplay$$;
private _headerStyle;
private _options;
private _disabled;
private _panelStyle;
overlayVisible$: Observable<boolean>;
optionsToDisplay$: Observable<IOption[]>;
itemTemplate: TemplateRef<HTMLElement> | undefined;
selectedItemTemplate: TemplateRef<HTMLElement> | null;
selectedOption: IOption | null;
selectedItemIndex: number;
hover: boolean;
optionsChanged: boolean;
focused: boolean;
panel: HTMLDivElement | undefined;
prevValue: any;
value: any;
onModelChange: (...args: unknown[]) => unknown;
onModelTouched: () => void;
onHostFocus(): void;
onHostBlur(): void;
/**
* @property
* @param {BasicStylesSet} headStyleObj - styles to override the defaults of Select component panel
*/
set headerStyle(headStyleObj: BasicStylesSet);
get headerStyle(): BasicStylesSet;
set panelStyle(stylesObj: BasicStylesSet);
get panelStyle(): BasicStylesSet;
set options(val: IOption[]);
get disabled(): boolean;
set disabled(_disabled: boolean);
constructor(el: ElementRef<Element>, renderer: Renderer2, cd: ChangeDetectorRef, sanitizer: DomSanitizer, zone: NgZone);
ngOnChanges(changes: SimpleChanges): void;
ngAfterContentInit(): void;
onInputFocus($event: Event): void;
onInputBlur($event: Event): void;
get label(): string | null;
getOptionLabel(option: IOption): string | null;
getOptionValue(option: IOption | null): string | null;
isOptionDisabled(option: IOption): boolean;
onItemClick({ option, baseEvent }: IOptionClickEvent): void;
selectItem($event: Event, option: IOption | null, update?: boolean): void;
writeValue(value: any): void;
validate({ value }: AbstractControl): false | {
invalid: boolean;
};
updateSelectedOption(): void;
registerOnChange(fn: (...args: unknown[]) => unknown): void;
registerOnTouched(fn: (...args: unknown[]) => unknown): void;
setDisabledState(val: boolean): void;
onMouseclick($event: Event): void;
reset(): void;
isOutsideClicked(event: Event): boolean;
show(): void;
hide(): void;
onKeydown($event: KeyboardEvent): void;
findOptionIndex(val: string | null, opts: IOption[]): number;
findPrevEnabledOption(index: number): IOption;
findNextEnabledOption(index: number): IOption;
static ɵfac: i0.ɵɵFactoryDeclaration<SelectComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<SelectComponent, "ngxd-select", never, { "templates": "templates"; "name": "name"; "panelStyleClass": "panelStyleClass"; "styleClass": "styleClass"; "readonly": "readonly"; "required": "required"; "resetBtn": "resetBtn"; "searchField": "searchField"; "autofocus": "autofocus"; "placeholder": "placeholder"; "optionLabelKey": "optionLabelKey"; "selectIconClass": "selectIconClass"; "tabindex": "tabindex"; "itemSize": "itemSize"; "headerStyle": "headerStyle"; "panelStyle": "panelStyle"; "options": "options"; "disabled": "disabled"; }, { "onChange": "onChange"; "onClick": "onClick"; "onShow": "onShow"; "onHide": "onHide"; "onFocus": "onFocus"; "onBlur": "onBlur"; }, ["projectedItems"], [".simple-items"]>;
}
//# sourceMappingURL=select.component.d.ts.map