UNPKG

@nova-ui/bits

Version:

SolarWinds Nova Framework

40 lines (39 loc) 1.84 kB
import { AfterViewInit, ElementRef, EventEmitter, OnChanges, SimpleChanges } from "@angular/core"; import * as i0 from "@angular/core"; /** * <example-url>./../examples/index.html#/common/set-focus</example-url> * * Allows focus to be databound. Note: a "tabindex" property may be required. * * Under the hood directive calls element.focus() and element.blur() on data bound changes. * If host element is not a focusable HTML element (neither \<input\> nor \<textarea\>, e.g. \<nui-textbox\>), * directive tries to find an appropriate focusable one among children. * * @dynamic * @ignore */ export declare class SetFocusDirective implements AfterViewInit, OnChanges { private el; private document; private static readonly focusablesToCapture; /** * This property controls whether element is focused (true) or not (false). */ nuiSetFocus: boolean; preventScroll: boolean; /** * Event fired on extarnal focus changes (initiated from UI by user). * Passed value indicates whether element gets focus (true) of lose it (false). * Use it when you need to synchronize inner state of directive's 'nuiSetFocus' property and bound input property. */ focusChange: EventEmitter<boolean>; private focusableElement; constructor(el: ElementRef, document: Document); ngOnChanges(changes: SimpleChanges): void; ngAfterViewInit(): void; private onBlur; private onFocus; private getFirstFocusable; static ɵfac: i0.ɵɵFactoryDeclaration<SetFocusDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<SetFocusDirective, "[nuiSetFocus]", never, { "nuiSetFocus": { "alias": "nuiSetFocus"; "required": false; }; "preventScroll": { "alias": "preventScroll"; "required": false; }; }, { "focusChange": "focusChange"; }, never, never, false, never>; }