Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const option: PopupOptions = {
pos: this._elementRef,
posType: PopupPositionType.absolute,
posOffset: {
top: this._elementRef.nativeElement.offsetHeight
},
size: {width: Number(this._elementRef.nativeElement.offsetWidth)}
};
const popupInfo: PopupInfo = this._popupService.popup(this._contentTemplateRef, option);
this._popupElement = popupInfo.element;
this._disposePopup = () => {
popupInfo.dispose()
};
PopupService.setBackground(this._popupElement, this._render);
if (this._openTrigger === DropDownTrigger.mouseover && this._popupElement) {
this._removeMouseoverHandler = this._render.listen(this._popupElement, 'mouseover', () => {
if (this._timeout) {
clearTimeout(this._timeout);
this._timeout = null;
}
});
}
if (this._closeTrigger === DropDownTrigger.mouseout && this._popupElement) {
this._removeMouseoutHandler = this._render.listen(this._popupElement, 'mouseout', () => {
if (!this._timeout) {
this._timeout = setTimeout(() => {
this._closeDropDown();
}, 400);
}
private _openDropDown(): void {
if (this.open) {
return;
}
this._$opened = true;
//TODO 阻止click冒泡事件可以实现autoCloseDropDown这一属性
if (this._closeTrigger === DropDownTrigger.click) {
this._removeClickHandler = this._render.listen('window', 'click', () => this._closeDropDown());
}
const option: PopupOptions = {
pos: this._elementRef,
posType: PopupPositionType.absolute,
posOffset: {
top: this._elementRef.nativeElement.offsetHeight
},
size: {width: Number(this._elementRef.nativeElement.offsetWidth)}
};
const popupInfo: PopupInfo = this._popupService.popup(this._contentTemplateRef, option);
this._popupElement = popupInfo.element;
this._disposePopup = () => {
popupInfo.dispose()
};
PopupService.setBackground(this._popupElement, this._render);
if (this._openTrigger === DropDownTrigger.mouseover && this._popupElement) {
this._removeMouseoverHandler = this._render.listen(this._popupElement, 'mouseover', () => {
if (this._timeout) {
clearTimeout(this._timeout);