Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.documentEscapeListener = this.renderer.listen('document', 'keydown', (event) => {
if (event.which == 27 && (this.closeOnEscape && this.closable)) {
if (parseInt(this.container.style.zIndex) === (DomHandler.zindex + this.baseZIndex) && this.visible) {
this.close(event);
}
}
if(event.which === 9 && this.focusTrap) {
event.preventDefault();
let focusableElements = DomHandler.getFocusableElements(this.container);
if (focusableElements && focusableElements.length > 0) {
if (!document.activeElement) {
focusableElements[0].focus();
}
else {
let focusedIndex = focusableElements.indexOf(document.activeElement);
moveOnTop() {
if (this.autoZIndex) {
this.container.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex));
}
}
onOverlayAnimationStart(event: AnimationEvent) {
switch(event.toState) {
case 'visible':
if (!this.inline) {
this.overlay = event.element;
this.appendOverlay();
if (this.autoZIndex) {
this.overlay.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex));
}
this.alignOverlay();
this.bindDocumentClickListener();
this.updateColorSelector();
this.updateUI();
}
break;
case 'void':
this.onOverlayHide();
break;
}
}
onFocus(e) {
if (this.feedback) {
if (!this.panel) {
this.createPanel();
}
this.panel.style.zIndex = String(++DomHandler.zindex);
this.zone.runOutsideAngular(() => {
setTimeout(() => {
DomHandler.addClass(this.panel, 'ui-password-panel-visible');
DomHandler.removeClass(this.panel, 'ui-password-panel-hidden');
}, 1);
DomHandler.absolutePosition(this.panel, this.el.nativeElement);
});
}
}
onOverlayAnimationStart(event: AnimationEvent) {
switch (event.toState) {
case 'visible':
this.overlay = event.element;
let itemsWrapperSelector = this.virtualScroll ? '.cdk-virtual-scroll-viewport' : '.ui-dropdown-items-wrapper';
this.itemsWrapper = DomHandler.findSingle(this.overlay, itemsWrapperSelector);
this.appendOverlay();
if (this.autoZIndex) {
this.overlay.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex));
}
this.alignOverlay();
this.bindDocumentClickListener();
this.bindDocumentResizeListener();
if (this.options && this.options.length) {
if(!this.virtualScroll) {
let selectedListItem = DomHandler.findSingle(this.itemsWrapper, '.ui-dropdown-item.ui-state-highlight');
if (selectedListItem) {
DomHandler.scrollInView(this.itemsWrapper, selectedListItem);
}
}
}
if (this.filterViewChild && this.filterViewChild.nativeElement) {
this.filterViewChild.nativeElement.focus();