source: trip-planner-front/node_modules/primeng/fesm2020/primeng-focustrap.mjs@ b738035

Last change on this file since b738035 was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago

adding photos

  • Property mode set to 100644
File size: 3.6 KB
Line 
1import * as i0 from '@angular/core';
2import { Directive, Input, HostListener, NgModule } from '@angular/core';
3import { CommonModule } from '@angular/common';
4import { DomHandler } from 'primeng/dom';
5
6class FocusTrap {
7 constructor(el) {
8 this.el = el;
9 }
10 onkeydown(e) {
11 if (this.pFocusTrapDisabled !== true) {
12 e.preventDefault();
13 let focusableElements = DomHandler.getFocusableElements(this.el.nativeElement);
14 if (focusableElements && focusableElements.length > 0) {
15 if (!focusableElements[0].ownerDocument.activeElement) {
16 focusableElements[0].focus();
17 }
18 else {
19 let focusedIndex = focusableElements.indexOf(focusableElements[0].ownerDocument.activeElement);
20 if (e.shiftKey) {
21 if (focusedIndex == -1 || focusedIndex === 0)
22 focusableElements[focusableElements.length - 1].focus();
23 else
24 focusableElements[focusedIndex - 1].focus();
25 }
26 else {
27 if (focusedIndex == -1 || focusedIndex === (focusableElements.length - 1))
28 focusableElements[0].focus();
29 else
30 focusableElements[focusedIndex + 1].focus();
31 }
32 }
33 }
34 }
35 }
36}
37FocusTrap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FocusTrap, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
38FocusTrap.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0", type: FocusTrap, selector: "[pFocusTrap]", inputs: { pFocusTrapDisabled: "pFocusTrapDisabled" }, host: { listeners: { "keydown.tab": "onkeydown($event)", "keydown.shift.tab": "onkeydown($event)" }, classAttribute: "p-element" }, ngImport: i0 });
39i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FocusTrap, decorators: [{
40 type: Directive,
41 args: [{
42 selector: '[pFocusTrap]',
43 host: {
44 'class': 'p-element'
45 }
46 }]
47 }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { pFocusTrapDisabled: [{
48 type: Input
49 }], onkeydown: [{
50 type: HostListener,
51 args: ['keydown.tab', ['$event']]
52 }, {
53 type: HostListener,
54 args: ['keydown.shift.tab', ['$event']]
55 }] } });
56class FocusTrapModule {
57}
58FocusTrapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FocusTrapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
59FocusTrapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FocusTrapModule, declarations: [FocusTrap], imports: [CommonModule], exports: [FocusTrap] });
60FocusTrapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FocusTrapModule, imports: [[CommonModule]] });
61i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FocusTrapModule, decorators: [{
62 type: NgModule,
63 args: [{
64 imports: [CommonModule],
65 exports: [FocusTrap],
66 declarations: [FocusTrap]
67 }]
68 }] });
69
70/**
71 * Generated bundle index. Do not edit.
72 */
73
74export { FocusTrap, FocusTrapModule };
Note: See TracBrowser for help on using the repository browser.