UNPKG

@progress/kendo-angular-map

Version:
121 lines (120 loc) 5.69 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { Component, Input, NgZone, Output, EventEmitter } from '@angular/core'; import { NgClass, NgStyle, NgTemplateOutlet } from '@angular/common'; import { BaseTooltip } from './base-tooltip'; import { hasParent } from '../common/has-parent'; import { TooltipTemplateService } from './tooltip-template.service'; import { PopupService, POPUP_CONTAINER } from '@progress/kendo-angular-popup'; import { bodyFactory } from './body-factory'; import { LocalizationService } from '@progress/kendo-angular-l10n'; import * as i0 from "@angular/core"; import * as i1 from "@progress/kendo-angular-popup"; import * as i2 from "./tooltip-template.service"; import * as i3 from "@progress/kendo-angular-l10n"; /** * @hidden */ export class TooltipPopupComponent extends BaseTooltip { popupService; templateService; localizationService; ngZone; tooltipTemplateRef; tooltipContext = {}; animate = true; classNames; wrapperClass = 'k-tooltip-wrapper'; leave = new EventEmitter(); popupClasses = {}; mouseleaveSubscription; constructor(popupService, templateService, localizationService, ngZone) { super(popupService, localizationService); this.popupService = popupService; this.templateService = templateService; this.localizationService = localizationService; this.ngZone = ngZone; } show(e) { this.tooltipTemplateRef = this.templateService.getTemplate(e.layerIndex); if (!this.tooltipTemplateRef) { return; } this.popupClasses = Object.assign({ 'k-tooltip': true, 'k-map-tooltip': true, [e.className]: Boolean(e.className) }, this.classNames); this.tooltipContext = e; super.show(e); } containsElement(element) { if (this.popupRef) { return hasParent(element, this.popupRef.popupElement); } } onInit() { this.ngZone.runOutsideAngular(() => { this.mouseleaveSubscription = this.popupRef.popupElement.addEventListener('mouseleave', (args) => { this.leave.emit(args); }); }); this.popupRef.popupElement.classList.add(this.wrapperClass); } hide() { if (this.mouseleaveSubscription) { this.mouseleaveSubscription(); this.mouseleaveSubscription = null; } this.tooltipTemplateRef = null; super.hide(); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TooltipPopupComponent, deps: [{ token: i1.PopupService }, { token: i2.TooltipTemplateService }, { token: i3.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TooltipPopupComponent, isStandalone: true, selector: "kendo-map-tooltip-popup", inputs: { animate: "animate", classNames: "classNames", wrapperClass: "wrapperClass" }, outputs: { leave: "leave" }, providers: [PopupService, { provide: POPUP_CONTAINER, useFactory: bodyFactory }], usesInheritance: true, ngImport: i0, template: ` <ng-template #content> <div [ngClass]="popupClasses" [ngStyle]="style"> <div class="k-tooltip-content"> <ng-template [ngTemplateOutlet]="tooltipTemplateRef" [ngTemplateOutletContext]="tooltipContext"> </ng-template> </div> </div> </ng-template> `, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TooltipPopupComponent, decorators: [{ type: Component, args: [{ providers: [PopupService, { provide: POPUP_CONTAINER, useFactory: bodyFactory }], selector: 'kendo-map-tooltip-popup', template: ` <ng-template #content> <div [ngClass]="popupClasses" [ngStyle]="style"> <div class="k-tooltip-content"> <ng-template [ngTemplateOutlet]="tooltipTemplateRef" [ngTemplateOutletContext]="tooltipContext"> </ng-template> </div> </div> </ng-template> `, standalone: true, imports: [NgClass, NgStyle, NgTemplateOutlet] }] }], ctorParameters: function () { return [{ type: i1.PopupService }, { type: i2.TooltipTemplateService }, { type: i3.LocalizationService }, { type: i0.NgZone }]; }, propDecorators: { animate: [{ type: Input }], classNames: [{ type: Input }], wrapperClass: [{ type: Input }], leave: [{ type: Output }] } });