UNPKG

primeng

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primeng.svg)](https://badge.fury.io/js/primeng) [![npm downloads](https://img.shields.io/npm/dm/primeng.sv

62 lines (58 loc) 3.05 kB
import { DomHandler } from 'primeng/dom'; import { CommonModule } from '@angular/common'; import * as i0 from '@angular/core'; import { Directive, Input, HostListener, NgModule } from '@angular/core'; class FocusTrap { constructor(el) { this.el = el; } onkeydown(e) { var _a; if (this.pFocusTrapDisabled !== true) { e.preventDefault(); const focusableElement = DomHandler.getNextFocusableElement(this.el.nativeElement, e.shiftKey); if (focusableElement) { focusableElement.focus(); (_a = focusableElement.select) === null || _a === void 0 ? void 0 : _a.call(focusableElement); } } } } FocusTrap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FocusTrap, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); FocusTrap.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0", type: FocusTrap, selector: "[pFocusTrap]", inputs: { pFocusTrapDisabled: "pFocusTrapDisabled" }, host: { listeners: { "keydown.tab": "onkeydown($event)", "keydown.shift.tab": "onkeydown($event)" }, classAttribute: "p-element" }, ngImport: i0 }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FocusTrap, decorators: [{ type: Directive, args: [{ selector: '[pFocusTrap]', host: { class: 'p-element' } }] }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { pFocusTrapDisabled: [{ type: Input }], onkeydown: [{ type: HostListener, args: ['keydown.tab', ['$event']] }, { type: HostListener, args: ['keydown.shift.tab', ['$event']] }] } }); class FocusTrapModule { } FocusTrapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FocusTrapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); FocusTrapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: FocusTrapModule, declarations: [FocusTrap], imports: [CommonModule], exports: [FocusTrap] }); FocusTrapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FocusTrapModule, imports: [CommonModule] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FocusTrapModule, decorators: [{ type: NgModule, args: [{ imports: [CommonModule], exports: [FocusTrap], declarations: [FocusTrap] }] }] }); /** * Generated bundle index. Do not edit. */ export { FocusTrap, FocusTrapModule }; //# sourceMappingURL=primeng-focustrap.mjs.map //# sourceMappingURL=primeng-focustrap.mjs.map