@siemens/maps-ng 47.12.1 → 47.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,5 @@
1
- /**
2
- * Copyright (c) Siemens 2016 - 2025
3
- * SPDX-License-Identifier: MIT
4
- */
5
- import { ElementRef } from '@angular/core';
6
1
  import * as i0 from "@angular/core";
7
2
  export declare class SiMapTooltipComponent {
8
- protected readonly content: import("@angular/core").Signal<ElementRef<any>>;
9
3
  /**
10
4
  * Cutoff text for tooltips, when cluster combines more than 4 features
11
5
  *
@@ -23,6 +17,7 @@ export declare class SiMapTooltipComponent {
23
17
  readonly maxLabelLength: import("@angular/core").InputSignal<number>;
24
18
  get nativeElement(): HTMLElement;
25
19
  protected readonly hiddenEntries: import("@angular/core").WritableSignal<number>;
20
+ protected readonly tooltipLabels: import("@angular/core").WritableSignal<string[]>;
26
21
  private readonly elementRef;
27
22
  /**
28
23
  * Method sets tooltip content. If parameter is of type
@@ -32,8 +27,7 @@ export declare class SiMapTooltipComponent {
32
27
  * @param labels - array of strings or string itself
33
28
  */
34
29
  setTooltip(labels: string[] | string): void;
35
- private getLabelSnippet;
36
- private setContent;
30
+ private getLabelText;
37
31
  static ɵfac: i0.ɵɵFactoryDeclaration<SiMapTooltipComponent, never>;
38
32
  static ɵcmp: i0.ɵɵComponentDeclaration<SiMapTooltipComponent, "si-map-tooltip", never, { "moreText": { "alias": "moreText"; "required": false; "isSignal": true; }; "maxLabelLength": { "alias": "maxLabelLength"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
39
33
  }
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { viewChild, input, signal, inject, ElementRef, Component, Directive, ViewContainerRef, TemplateRef, Injectable, model, output, contentChild, computed, NgZone, Injector, HostListener, ChangeDetectionStrategy, NgModule } from '@angular/core';
2
+ import { input, signal, inject, ElementRef, Component, Directive, viewChild, ViewContainerRef, TemplateRef, Injectable, model, output, contentChild, computed, NgZone, Injector, HostListener, ChangeDetectionStrategy, NgModule } from '@angular/core';
3
3
  import * as i1 from '@siemens/element-translate-ng/translate';
4
4
  import { SiTranslateModule, SiTranslateServiceBuilder, SiNoTranslateService } from '@siemens/element-translate-ng/translate';
5
5
  import AnimatedCluster from 'ol-ext/layer/AnimatedCluster';
@@ -64,7 +64,6 @@ const LAYER_NAME = 'layerName';
64
64
  * SPDX-License-Identifier: MIT
65
65
  */
66
66
  class SiMapTooltipComponent {
67
- content = viewChild.required('content');
68
67
  /**
69
68
  * Cutoff text for tooltips, when cluster combines more than 4 features
70
69
  *
@@ -84,6 +83,7 @@ class SiMapTooltipComponent {
84
83
  return this.elementRef.nativeElement;
85
84
  }
86
85
  hiddenEntries = signal(0);
86
+ tooltipLabels = signal([]);
87
87
  elementRef = inject(ElementRef);
88
88
  /**
89
89
  * Method sets tooltip content. If parameter is of type
@@ -93,37 +93,22 @@ class SiMapTooltipComponent {
93
93
  * @param labels - array of strings or string itself
94
94
  */
95
95
  setTooltip(labels) {
96
- if (typeof labels === 'string') {
97
- this.setContent(this.getLabelSnippet(labels));
98
- this.hiddenEntries.set(0);
99
- return;
100
- }
101
- const list = [];
102
- if (labels.length > 1) {
103
- const toDisplay = [...labels];
104
- const rest = toDisplay.splice(TOOLTIP_FEATURES_TO_DISPLAY, toDisplay.length - TOOLTIP_FEATURES_TO_DISPLAY);
105
- toDisplay.forEach(feat => list.push(this.getLabelSnippet(feat)));
106
- this.hiddenEntries.set(rest.length ?? 0);
107
- }
108
- this.setContent(list.join(''));
96
+ const labelList = typeof labels === 'string' ? [labels] : labels.length > 1 ? labels : [];
97
+ this.tooltipLabels.set(labelList.slice(0, TOOLTIP_FEATURES_TO_DISPLAY).map(label => this.getLabelText(label)));
98
+ this.hiddenEntries.set(Math.max(labelList.length - TOOLTIP_FEATURES_TO_DISPLAY, 0));
109
99
  }
110
- getLabelSnippet(label) {
100
+ getLabelText(label) {
111
101
  if (this.maxLabelLength() != -1 && label.length > this.maxLabelLength()) {
112
- return `<div>${label.substring(0, this.maxLabelLength())}...</div>`;
102
+ return `${label.substring(0, this.maxLabelLength())}…`;
113
103
  }
114
- else {
115
- return `<div>${label}</div>`;
116
- }
117
- }
118
- setContent(tooltip) {
119
- this.content().nativeElement.innerHTML = tooltip;
104
+ return label;
120
105
  }
121
106
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiMapTooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
122
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.6", type: SiMapTooltipComponent, isStandalone: true, selector: "si-map-tooltip", inputs: { moreText: { classPropertyName: "moreText", publicName: "moreText", isSignal: true, isRequired: false, transformFunction: null }, maxLabelLength: { classPropertyName: "maxLabelLength", publicName: "maxLabelLength", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"si-map-tooltip\">\n <div #content></div>\n @if (hiddenEntries()) {\n <div>{{ moreText() | translate: { length: hiddenEntries() } }}</div>\n }\n</div>\n", styles: [".si-map-tooltip{text-align:start;margin-block-start:4px;position:relative;max-inline-size:max-content;padding-block:4px;padding-inline:8px;color:var(--element-ui-5);background-color:var(--element-ui-1);border-radius:var(--element-radius-1)}.si-map-tooltip:before{content:\"\";position:absolute;inset-block-start:-4px;left:50%;transform:translate(-50%) rotate(45deg);block-size:8px;inline-size:8px;background-color:inherit}\n"], dependencies: [{ kind: "ngmodule", type: SiTranslateModule }, { kind: "pipe", type: i1.SiTranslatePipe, name: "translate" }] });
107
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.6", type: SiMapTooltipComponent, isStandalone: true, selector: "si-map-tooltip", inputs: { moreText: { classPropertyName: "moreText", publicName: "moreText", isSignal: true, isRequired: false, transformFunction: null }, maxLabelLength: { classPropertyName: "maxLabelLength", publicName: "maxLabelLength", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"si-map-tooltip\">\n @for (label of tooltipLabels(); track $index) {\n <div>{{ label }}</div>\n }\n @if (hiddenEntries()) {\n <div>{{ moreText() | translate: { length: hiddenEntries() } }}</div>\n }\n</div>\n", styles: [".si-map-tooltip{text-align:start;margin-block-start:4px;position:relative;max-inline-size:max-content;padding-block:4px;padding-inline:8px;color:var(--element-ui-5);background-color:var(--element-ui-1);border-radius:var(--element-radius-1)}.si-map-tooltip:before{content:\"\";position:absolute;inset-block-start:-4px;left:50%;transform:translate(-50%) rotate(45deg);block-size:8px;inline-size:8px;background-color:inherit}\n"], dependencies: [{ kind: "ngmodule", type: SiTranslateModule }, { kind: "pipe", type: i1.SiTranslatePipe, name: "translate" }] });
123
108
  }
124
109
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiMapTooltipComponent, decorators: [{
125
110
  type: Component,
126
- args: [{ selector: 'si-map-tooltip', imports: [SiTranslateModule], template: "<div class=\"si-map-tooltip\">\n <div #content></div>\n @if (hiddenEntries()) {\n <div>{{ moreText() | translate: { length: hiddenEntries() } }}</div>\n }\n</div>\n", styles: [".si-map-tooltip{text-align:start;margin-block-start:4px;position:relative;max-inline-size:max-content;padding-block:4px;padding-inline:8px;color:var(--element-ui-5);background-color:var(--element-ui-1);border-radius:var(--element-radius-1)}.si-map-tooltip:before{content:\"\";position:absolute;inset-block-start:-4px;left:50%;transform:translate(-50%) rotate(45deg);block-size:8px;inline-size:8px;background-color:inherit}\n"] }]
111
+ args: [{ selector: 'si-map-tooltip', imports: [SiTranslateModule], template: "<div class=\"si-map-tooltip\">\n @for (label of tooltipLabels(); track $index) {\n <div>{{ label }}</div>\n }\n @if (hiddenEntries()) {\n <div>{{ moreText() | translate: { length: hiddenEntries() } }}</div>\n }\n</div>\n", styles: [".si-map-tooltip{text-align:start;margin-block-start:4px;position:relative;max-inline-size:max-content;padding-block:4px;padding-inline:8px;color:var(--element-ui-5);background-color:var(--element-ui-1);border-radius:var(--element-radius-1)}.si-map-tooltip:before{content:\"\";position:absolute;inset-block-start:-4px;left:50%;transform:translate(-50%) rotate(45deg);block-size:8px;inline-size:8px;background-color:inherit}\n"] }]
127
112
  }] });
128
113
 
129
114
  /**