@siemens/element-ng 49.14.0 → 51.0.0-rc.5
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.
- package/README.md +1 -1
- package/fesm2022/siemens-element-ng-about.mjs +41 -25
- package/fesm2022/siemens-element-ng-about.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-accordion.mjs +58 -40
- package/fesm2022/siemens-element-ng-accordion.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-action-modal.mjs +83 -53
- package/fesm2022/siemens-element-ng-action-modal.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-ag-grid.mjs +15 -12
- package/fesm2022/siemens-element-ng-ag-grid.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-application-header.mjs +176 -166
- package/fesm2022/siemens-element-ng-application-header.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-auto-collapsable-list.mjs +34 -28
- package/fesm2022/siemens-element-ng-auto-collapsable-list.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-autocomplete.mjs +27 -22
- package/fesm2022/siemens-element-ng-autocomplete.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-avatar.mjs +31 -21
- package/fesm2022/siemens-element-ng-avatar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-badge.mjs +9 -8
- package/fesm2022/siemens-element-ng-badge.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-breadcrumb-router.mjs +17 -14
- package/fesm2022/siemens-element-ng-breadcrumb-router.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-breadcrumb.mjs +21 -17
- package/fesm2022/siemens-element-ng-breadcrumb.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-card.mjs +71 -46
- package/fesm2022/siemens-element-ng-card.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-carousel.mjs +57 -33
- package/fesm2022/siemens-element-ng-carousel.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-chat-messages.mjs +181 -117
- package/fesm2022/siemens-element-ng-chat-messages.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-circle-status.mjs +39 -25
- package/fesm2022/siemens-element-ng-circle-status.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-color-picker.mjs +26 -17
- package/fesm2022/siemens-element-ng-color-picker.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-column-selection-dialog.mjs +56 -35
- package/fesm2022/siemens-element-ng-column-selection-dialog.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-common.mjs +12 -12
- package/fesm2022/siemens-element-ng-connection-strength.mjs +14 -12
- package/fesm2022/siemens-element-ng-connection-strength.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-content-action-bar.mjs +36 -27
- package/fesm2022/siemens-element-ng-content-action-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-copyright-notice.mjs +19 -14
- package/fesm2022/siemens-element-ng-copyright-notice.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-dashboard.mjs +335 -221
- package/fesm2022/siemens-element-ng-dashboard.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-datatable.mjs +8 -8
- package/fesm2022/siemens-element-ng-datatable.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-date-range-filter.mjs +119 -72
- package/fesm2022/siemens-element-ng-date-range-filter.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-datepicker.mjs +376 -244
- package/fesm2022/siemens-element-ng-datepicker.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-electron-titlebar.mjs +22 -17
- package/fesm2022/siemens-element-ng-electron-titlebar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-empty-state.mjs +15 -12
- package/fesm2022/siemens-element-ng-empty-state.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-file-uploader.mjs +105 -91
- package/fesm2022/siemens-element-ng-file-uploader.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-filter-bar.mjs +32 -24
- package/fesm2022/siemens-element-ng-filter-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-filtered-search.mjs +251 -153
- package/fesm2022/siemens-element-ng-filtered-search.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-footer.mjs +12 -10
- package/fesm2022/siemens-element-ng-footer.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-form.mjs +345 -113
- package/fesm2022/siemens-element-ng-form.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-formly-legacy.mjs +99 -0
- package/fesm2022/siemens-element-ng-formly-legacy.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-formly.mjs +222 -316
- package/fesm2022/siemens-element-ng-formly.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-header-dropdown.mjs +40 -30
- package/fesm2022/siemens-element-ng-header-dropdown.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-help-button.mjs +5 -5
- package/fesm2022/siemens-element-ng-help-button.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-icon.mjs +46 -47
- package/fesm2022/siemens-element-ng-icon.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-info-page.mjs +17 -11
- package/fesm2022/siemens-element-ng-info-page.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-inline-notification.mjs +19 -14
- package/fesm2022/siemens-element-ng-inline-notification.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-ip-input.mjs +25 -25
- package/fesm2022/siemens-element-ng-ip-input.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-landing-page.mjs +120 -74
- package/fesm2022/siemens-element-ng-landing-page.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-language-switcher.mjs +16 -12
- package/fesm2022/siemens-element-ng-language-switcher.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-link.mjs +31 -21
- package/fesm2022/siemens-element-ng-link.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-list-details.mjs +76 -56
- package/fesm2022/siemens-element-ng-list-details.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-loading-spinner.mjs +46 -63
- package/fesm2022/siemens-element-ng-loading-spinner.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-localization.mjs +14 -12
- package/fesm2022/siemens-element-ng-localization.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-main-detail-container.mjs +47 -30
- package/fesm2022/siemens-element-ng-main-detail-container.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-maplibre.mjs +42 -0
- package/fesm2022/siemens-element-ng-maplibre.mjs.map +1 -0
- package/fesm2022/siemens-element-ng-markdown-renderer.mjs +6 -5
- package/fesm2022/siemens-element-ng-markdown-renderer.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-menu.mjs +56 -48
- package/fesm2022/siemens-element-ng-menu.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-modal.mjs +14 -11
- package/fesm2022/siemens-element-ng-modal.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar-vertical-next.mjs +249 -204
- package/fesm2022/siemens-element-ng-navbar-vertical-next.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar-vertical.mjs +120 -83
- package/fesm2022/siemens-element-ng-navbar-vertical.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-navbar.mjs +72 -45
- package/fesm2022/siemens-element-ng-navbar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-notification-item.mjs +19 -11
- package/fesm2022/siemens-element-ng-notification-item.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-number-input.mjs +40 -28
- package/fesm2022/siemens-element-ng-number-input.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-pagination.mjs +31 -20
- package/fesm2022/siemens-element-ng-pagination.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-password-strength.mjs +32 -23
- package/fesm2022/siemens-element-ng-password-strength.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-password-toggle.mjs +18 -13
- package/fesm2022/siemens-element-ng-password-toggle.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-phone-number.mjs +123 -139
- package/fesm2022/siemens-element-ng-phone-number.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-photo-upload.mjs +84 -51
- package/fesm2022/siemens-element-ng-photo-upload.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-pills-input.mjs +63 -58
- package/fesm2022/siemens-element-ng-pills-input.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-popover-legacy.mjs +43 -28
- package/fesm2022/siemens-element-ng-popover-legacy.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-popover.mjs +35 -27
- package/fesm2022/siemens-element-ng-popover.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-progressbar.mjs +23 -16
- package/fesm2022/siemens-element-ng-progressbar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-resize-observer.mjs +32 -43
- package/fesm2022/siemens-element-ng-resize-observer.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-result-details-list.mjs +12 -10
- package/fesm2022/siemens-element-ng-result-details-list.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-search-bar.mjs +38 -31
- package/fesm2022/siemens-element-ng-search-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-select.mjs +218 -163
- package/fesm2022/siemens-element-ng-select.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-shadow-root.mjs +3 -3
- package/fesm2022/siemens-element-ng-side-panel.mjs +128 -86
- package/fesm2022/siemens-element-ng-side-panel.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-skip-links.mjs +21 -24
- package/fesm2022/siemens-element-ng-skip-links.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-slider.mjs +44 -29
- package/fesm2022/siemens-element-ng-slider.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-split.mjs +273 -293
- package/fesm2022/siemens-element-ng-split.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-status-bar.mjs +65 -51
- package/fesm2022/siemens-element-ng-status-bar.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-status-counter.mjs +15 -11
- package/fesm2022/siemens-element-ng-status-counter.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-status-toggle.mjs +26 -16
- package/fesm2022/siemens-element-ng-status-toggle.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-summary-chip.mjs +25 -16
- package/fesm2022/siemens-element-ng-summary-chip.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-summary-widget.mjs +27 -17
- package/fesm2022/siemens-element-ng-summary-widget.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-system-banner.mjs +11 -8
- package/fesm2022/siemens-element-ng-system-banner.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tabs-legacy.mjs +20 -17
- package/fesm2022/siemens-element-ng-tabs-legacy.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tabs.mjs +73 -70
- package/fesm2022/siemens-element-ng-tabs.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-theme.mjs +29 -6
- package/fesm2022/siemens-element-ng-theme.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-threshold.mjs +60 -41
- package/fesm2022/siemens-element-ng-threshold.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-toast-notification.mjs +45 -40
- package/fesm2022/siemens-element-ng-toast-notification.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tooltip.mjs +105 -82
- package/fesm2022/siemens-element-ng-tooltip.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tour.mjs +24 -18
- package/fesm2022/siemens-element-ng-tour.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-translate.mjs +0 -1
- package/fesm2022/siemens-element-ng-translate.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-tree-view.mjs +96 -75
- package/fesm2022/siemens-element-ng-tree-view.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-typeahead.mjs +76 -70
- package/fesm2022/siemens-element-ng-typeahead.mjs.map +1 -1
- package/fesm2022/siemens-element-ng-wizard.mjs +72 -48
- package/fesm2022/siemens-element-ng-wizard.mjs.map +1 -1
- package/formly-legacy/package.json +4 -0
- package/maplibre/package.json +4 -0
- package/maplibre/styles/_index.scss +1 -0
- package/maplibre/styles/maplibre-gl.scss +715 -0
- package/package.json +37 -23
- package/schematics/migration.json +4 -4
- package/schematics/migrations/data/class-member-replacement.js +1 -19
- package/schematics/migrations/data/component-property-names.js +1 -25
- package/schematics/migrations/data/element-class-changes.js +1 -28
- package/schematics/migrations/data/element-migration-data.js +2 -0
- package/schematics/migrations/data/element-selectors.js +1 -11
- package/schematics/migrations/data/index.js +0 -4
- package/schematics/migrations/data/migration-test-data.js +9 -6
- package/schematics/migrations/data/provider-function-removals.js +7 -0
- package/schematics/migrations/data/symbol-removals.js +7 -7
- package/schematics/migrations/data/symbol-renaming.js +1 -48
- package/schematics/migrations/element-migration/element-migration.js +3 -6
- package/schematics/migrations/utilities/import-removal.js +39 -0
- package/schematics/migrations/utilities/index.js +2 -0
- package/schematics/migrations/utilities/provider-function-removal.migration.js +116 -0
- package/schematics/ng-update/index.js +1 -1
- package/schematics/ng-update/migrate-split-sizes.js +105 -0
- package/schematics/ng-update/{migrate-to-v49.js → migrate-to-v51.js} +5 -3
- package/template-i18n.json +45 -47
- package/types/siemens-element-ng-application-header.d.ts +8 -28
- package/types/siemens-element-ng-breadcrumb.d.ts +1 -1
- package/types/siemens-element-ng-chat-messages.d.ts +11 -9
- package/types/siemens-element-ng-circle-status.d.ts +1 -1
- package/types/siemens-element-ng-content-action-bar.d.ts +1 -1
- package/types/siemens-element-ng-dashboard.d.ts +2 -2
- package/types/siemens-element-ng-date-range-filter.d.ts +1 -1
- package/types/siemens-element-ng-datepicker.d.ts +3 -14
- package/types/siemens-element-ng-electron-titlebar.d.ts +1 -1
- package/types/siemens-element-ng-file-uploader.d.ts +13 -31
- package/types/siemens-element-ng-filter-bar.d.ts +1 -1
- package/types/siemens-element-ng-filtered-search.d.ts +4 -4
- package/types/siemens-element-ng-form.d.ts +180 -44
- package/types/siemens-element-ng-formly-legacy.d.ts +40 -0
- package/types/siemens-element-ng-formly.d.ts +34 -167
- package/types/siemens-element-ng-icon.d.ts +2 -19
- package/types/siemens-element-ng-ip-input.d.ts +1 -1
- package/types/siemens-element-ng-landing-page.d.ts +2 -2
- package/types/siemens-element-ng-loading-spinner.d.ts +7 -17
- package/types/siemens-element-ng-maplibre.d.ts +26 -0
- package/types/siemens-element-ng-navbar-vertical-next.d.ts +86 -38
- package/types/siemens-element-ng-navbar-vertical.d.ts +1 -1
- package/types/siemens-element-ng-navbar.d.ts +3 -3
- package/types/siemens-element-ng-notification-item.d.ts +12 -0
- package/types/siemens-element-ng-phone-number.d.ts +5 -8
- package/types/siemens-element-ng-photo-upload.d.ts +4 -4
- package/types/siemens-element-ng-resize-observer.d.ts +0 -17
- package/types/siemens-element-ng-search-bar.d.ts +1 -1
- package/types/siemens-element-ng-select.d.ts +1 -1
- package/types/siemens-element-ng-side-panel.d.ts +3 -3
- package/types/siemens-element-ng-split.d.ts +99 -70
- package/types/siemens-element-ng-status-bar.d.ts +5 -13
- package/types/siemens-element-ng-status-counter.d.ts +1 -1
- package/types/siemens-element-ng-tabs.d.ts +1 -2
- package/types/siemens-element-ng-theme.d.ts +12 -2
- package/types/siemens-element-ng-threshold.d.ts +1 -1
- package/types/siemens-element-ng-toast-notification.d.ts +0 -1
- package/types/siemens-element-ng-tooltip.d.ts +7 -7
- package/types/siemens-element-ng-translate.d.ts +2 -5
- package/fesm2022/siemens-element-ng-icon-status.mjs +0 -46
- package/fesm2022/siemens-element-ng-icon-status.mjs.map +0 -1
- package/fesm2022/siemens-element-ng-sort-bar.mjs +0 -99
- package/fesm2022/siemens-element-ng-sort-bar.mjs.map +0 -1
- package/icon-status/package.json +0 -4
- package/schematics/vitest-setup.js +0 -5
- package/sort-bar/package.json +0 -4
- package/types/siemens-element-ng-icon-status.d.ts +0 -25
- package/types/siemens-element-ng-sort-bar.d.ts +0 -59
- /package/{LICENSE.md → LICENSE} +0 -0
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, signal, inject, ElementRef, afterRenderEffect, computed, TemplateRef, ChangeDetectionStrategy, Component, DestroyRef, effect, Injector, inputBinding, PLATFORM_ID, Injectable, booleanAttribute, Directive, NgModule } from '@angular/core';
|
|
3
3
|
import { OverlayRef, Overlay } from '@angular/cdk/overlay';
|
|
4
4
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
5
5
|
import { NgTemplateOutlet, NgComponentOutlet, isPlatformBrowser } from '@angular/common';
|
|
6
|
-
import { calculateOverlayArrowPosition, getOverlay, getPositionStrategy } from '@siemens/element-ng/common';
|
|
6
|
+
import { calculateOverlayArrowPosition, getOverlay, getPositionStrategy, getOverlayPositions } from '@siemens/element-ng/common';
|
|
7
7
|
import { Subject, fromEvent, timer } from 'rxjs';
|
|
8
8
|
import { filter, takeUntil, delayWhen } from 'rxjs/operators';
|
|
9
9
|
import { SiTranslatePipe } from '@siemens/element-translate-ng/translate';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Copyright (c) Siemens 2016 - 2026
|
|
13
|
-
* SPDX-License-Identifier: MIT
|
|
14
|
-
*/
|
|
15
|
-
const SI_TOOLTIP_CONFIG = new InjectionToken('SiTooltipConfig');
|
|
16
|
-
|
|
17
11
|
/**
|
|
18
12
|
* Copyright (c) Siemens 2016 - 2026
|
|
19
13
|
* SPDX-License-Identifier: MIT
|
|
20
14
|
*/
|
|
21
15
|
class TooltipComponent {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
id = input(/* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
|
|
18
|
+
tooltip = input(/* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [undefined, { debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
20
|
+
tooltipContext = input(/* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [undefined, { debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
22
|
+
tooltipPositionClass = signal('', /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "tooltipPositionClass" }] : /* istanbul ignore next */ []));
|
|
24
|
+
arrowPos = signal(undefined, /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "arrowPos" }] : /* istanbul ignore next */ []));
|
|
25
26
|
elementRef = inject(ElementRef);
|
|
26
27
|
overlayRef = inject(OverlayRef);
|
|
27
28
|
lastPositionChange;
|
|
@@ -29,8 +30,8 @@ class TooltipComponent {
|
|
|
29
30
|
constructor() {
|
|
30
31
|
let isFirstRun = true;
|
|
31
32
|
afterRenderEffect(() => {
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
33
|
+
this.tooltip();
|
|
34
|
+
this.tooltipContext();
|
|
34
35
|
if (isFirstRun) {
|
|
35
36
|
isFirstRun = false;
|
|
36
37
|
return;
|
|
@@ -42,7 +43,7 @@ class TooltipComponent {
|
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
tooltipText = computed(() => {
|
|
45
|
-
const tooltip = this.
|
|
46
|
+
const tooltip = this.tooltip();
|
|
46
47
|
if (typeof tooltip === 'string') {
|
|
47
48
|
return tooltip;
|
|
48
49
|
}
|
|
@@ -53,19 +54,22 @@ class TooltipComponent {
|
|
|
53
54
|
return tooltip.nativeElement.textContent.trim();
|
|
54
55
|
}
|
|
55
56
|
return null;
|
|
56
|
-
},
|
|
57
|
+
}, /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "tooltipText" }] : /* istanbul ignore next */ []));
|
|
57
59
|
tooltipTemplate = computed(() => {
|
|
58
|
-
const tooltip = this.
|
|
60
|
+
const tooltip = this.tooltip();
|
|
59
61
|
return tooltip instanceof TemplateRef ? tooltip : null;
|
|
60
|
-
},
|
|
62
|
+
}, /* @ts-ignore */
|
|
63
|
+
...(ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []));
|
|
61
64
|
tooltipComponent = computed(() => {
|
|
62
|
-
const tooltip = this.
|
|
65
|
+
const tooltip = this.tooltip();
|
|
63
66
|
return !(tooltip instanceof TemplateRef) &&
|
|
64
67
|
!(tooltip instanceof ElementRef) &&
|
|
65
68
|
typeof tooltip !== 'string'
|
|
66
69
|
? tooltip
|
|
67
70
|
: null;
|
|
68
|
-
},
|
|
71
|
+
}, /* @ts-ignore */
|
|
72
|
+
...(ngDevMode ? [{ debugName: "tooltipComponent" }] : /* istanbul ignore next */ []));
|
|
69
73
|
/** @internal */
|
|
70
74
|
updateTooltipPosition(change, anchor) {
|
|
71
75
|
this.lastPositionChange = change;
|
|
@@ -78,15 +82,15 @@ class TooltipComponent {
|
|
|
78
82
|
const arrowPos = calculateOverlayArrowPosition(change, this.elementRef, anchor);
|
|
79
83
|
this.arrowPos.set(arrowPos);
|
|
80
84
|
}
|
|
81
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
82
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
85
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
86
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: TooltipComponent, isStandalone: true, selector: "si-tooltip", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, tooltipContext: { classPropertyName: "tooltipContext", publicName: "tooltipContext", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "animate.leave": "tooltip-leave" } }, ngImport: i0, template: "<div\n class=\"tooltip show position-relative\"\n role=\"tooltip\"\n [id]=\"id()\"\n [class]=\"tooltipPositionClass()\"\n>\n <div\n class=\"tooltip-arrow\"\n [style.left.px]=\"arrowPos()?.left\"\n [style.right.px]=\"arrowPos()?.right\"\n ></div>\n <div class=\"tooltip-inner\">\n @if (tooltipText()) {\n <div class=\"si-body\">{{ tooltipText() | translate }}</div>\n } @else if (tooltipTemplate()) {\n <ng-template\n [ngTemplateOutlet]=\"tooltipTemplate()\"\n [ngTemplateOutletContext]=\"tooltipContext()\"\n />\n } @else if (tooltipComponent()) {\n <ng-container [ngComponentOutlet]=\"tooltipComponent()!\" />\n }\n </div>\n</div>\n", styles: [":host .tooltip,:host{transition:opacity calc(.15s * var(--element-animations-enabled, 1)) ease-out,transform calc(.15s * var(--element-animations-enabled, 1)) ease-out}:host{opacity:1;transform:scale(1)}:host.tooltip-leave{opacity:0;transform:scale(.8)}@starting-style{:host .tooltip{opacity:0;transform:scale(.8)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
83
87
|
}
|
|
84
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
88
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
85
89
|
type: Component,
|
|
86
|
-
args: [{ selector: 'si-tooltip', imports: [NgTemplateOutlet, SiTranslatePipe, NgComponentOutlet], changeDetection: ChangeDetectionStrategy.
|
|
90
|
+
args: [{ selector: 'si-tooltip', imports: [NgTemplateOutlet, SiTranslatePipe, NgComponentOutlet], changeDetection: ChangeDetectionStrategy.Eager, host: {
|
|
87
91
|
'animate.leave': 'tooltip-leave'
|
|
88
|
-
}, template: "<div\n class=\"tooltip show position-relative\"\n role=\"tooltip\"\n [id]=\"
|
|
89
|
-
}], ctorParameters: () => [] });
|
|
92
|
+
}, template: "<div\n class=\"tooltip show position-relative\"\n role=\"tooltip\"\n [id]=\"id()\"\n [class]=\"tooltipPositionClass()\"\n>\n <div\n class=\"tooltip-arrow\"\n [style.left.px]=\"arrowPos()?.left\"\n [style.right.px]=\"arrowPos()?.right\"\n ></div>\n <div class=\"tooltip-inner\">\n @if (tooltipText()) {\n <div class=\"si-body\">{{ tooltipText() | translate }}</div>\n } @else if (tooltipTemplate()) {\n <ng-template\n [ngTemplateOutlet]=\"tooltipTemplate()\"\n [ngTemplateOutletContext]=\"tooltipContext()\"\n />\n } @else if (tooltipComponent()) {\n <ng-container [ngComponentOutlet]=\"tooltipComponent()!\" />\n }\n </div>\n</div>\n", styles: [":host .tooltip,:host{transition:opacity calc(.15s * var(--element-animations-enabled, 1)) ease-out,transform calc(.15s * var(--element-animations-enabled, 1)) ease-out}:host{opacity:1;transform:scale(1)}:host.tooltip-leave{opacity:0;transform:scale(.8)}@starting-style{:host .tooltip{opacity:0;transform:scale(.8)}}\n"] }]
|
|
93
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], tooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltip", required: false }] }], tooltipContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipContext", required: false }] }] } });
|
|
90
94
|
|
|
91
95
|
/**
|
|
92
96
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -108,14 +112,24 @@ class NoopTooltipRef {
|
|
|
108
112
|
*/
|
|
109
113
|
class BrowserTooltipRef {
|
|
110
114
|
config;
|
|
115
|
+
destroyRef = inject(DestroyRef);
|
|
111
116
|
destroy$ = new Subject();
|
|
112
117
|
isFocused = false;
|
|
113
118
|
isHovered = false;
|
|
114
119
|
overlayRef;
|
|
115
120
|
positionSubscription;
|
|
121
|
+
canShowEffect;
|
|
122
|
+
placementEffect;
|
|
116
123
|
constructor(config) {
|
|
117
124
|
this.config = config;
|
|
118
125
|
const nativeElement = this.config.element.nativeElement;
|
|
126
|
+
this.destroyRef.onDestroy(() => this.destroy());
|
|
127
|
+
if (this.config.canShow) {
|
|
128
|
+
this.canShowEffect = effect(() => this.updateCanShow(), /* @ts-ignore */
|
|
129
|
+
...(ngDevMode ? [{ debugName: "canShowEffect" }] : /* istanbul ignore next */ []));
|
|
130
|
+
}
|
|
131
|
+
this.placementEffect = effect(() => this.updatePlacement(this.config.placement()), /* @ts-ignore */
|
|
132
|
+
...(ngDevMode ? [{ debugName: "placementEffect" }] : /* istanbul ignore next */ []));
|
|
119
133
|
fromEvent(nativeElement, 'focus')
|
|
120
134
|
.pipe(filter(event => event instanceof FocusEvent), takeUntil(this.destroy$))
|
|
121
135
|
.subscribe(event => this.onFocus(event));
|
|
@@ -134,11 +148,22 @@ class BrowserTooltipRef {
|
|
|
134
148
|
fromEvent(nativeElement, 'touchstart')
|
|
135
149
|
.pipe(takeUntil(this.destroy$))
|
|
136
150
|
.subscribe(() => this.onTouchStart());
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
151
|
+
this.showForCurrentInteraction();
|
|
152
|
+
}
|
|
153
|
+
updateCanShow() {
|
|
154
|
+
if (!this.config.canShow()) {
|
|
155
|
+
this.isFocused = false;
|
|
156
|
+
this.isHovered = false;
|
|
157
|
+
this.hide();
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
this.showForCurrentInteraction();
|
|
161
|
+
}
|
|
162
|
+
showForCurrentInteraction() {
|
|
163
|
+
const nativeElement = this.config.element.nativeElement;
|
|
164
|
+
// The tooltip may become eligible after the element is already focused or
|
|
165
|
+
// hovered (e.g. validation errors appear on blur while the pointer still
|
|
166
|
+
// hovers the element). In that case show it based on the live interaction state.
|
|
142
167
|
if (nativeElement === document.activeElement && nativeElement.matches(':focus-visible')) {
|
|
143
168
|
this.isFocused = true;
|
|
144
169
|
this.show();
|
|
@@ -176,10 +201,13 @@ class BrowserTooltipRef {
|
|
|
176
201
|
this.hide();
|
|
177
202
|
}
|
|
178
203
|
getOrCreateOverlay() {
|
|
179
|
-
this.overlayRef ??= getOverlay(this.config.element, this.config.overlay, false, this.
|
|
204
|
+
this.overlayRef ??= getOverlay(this.config.element, this.config.overlay, false, this.getPlacement(), false, true, this.config.scrollStrategy?.());
|
|
180
205
|
return this.overlayRef;
|
|
181
206
|
}
|
|
182
207
|
show() {
|
|
208
|
+
if (this.config.canShow && !this.config.canShow()) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
183
211
|
const overlayRef = this.getOrCreateOverlay();
|
|
184
212
|
if (overlayRef.hasAttached()) {
|
|
185
213
|
return;
|
|
@@ -188,12 +216,26 @@ class BrowserTooltipRef {
|
|
|
188
216
|
parent: this.config.injector,
|
|
189
217
|
providers: [{ provide: OverlayRef, useValue: overlayRef }]
|
|
190
218
|
});
|
|
191
|
-
const toolTipPortal = new ComponentPortal(TooltipComponent, undefined, injector
|
|
219
|
+
const toolTipPortal = new ComponentPortal(TooltipComponent, undefined, injector, undefined, [
|
|
220
|
+
inputBinding('id', () => this.config.describedBy),
|
|
221
|
+
inputBinding('tooltip', this.config.tooltip),
|
|
222
|
+
inputBinding('tooltipContext', this.config.tooltipContext)
|
|
223
|
+
]);
|
|
192
224
|
const tooltipRef = overlayRef.attach(toolTipPortal);
|
|
193
225
|
const positionStrategy = getPositionStrategy(overlayRef);
|
|
194
226
|
this.positionSubscription?.unsubscribe();
|
|
195
227
|
this.positionSubscription = positionStrategy?.positionChanges.subscribe(change => tooltipRef.instance.updateTooltipPosition(change, this.config.element));
|
|
196
228
|
}
|
|
229
|
+
getPlacement() {
|
|
230
|
+
return this.config.placement();
|
|
231
|
+
}
|
|
232
|
+
updatePlacement(placement) {
|
|
233
|
+
const positionStrategy = this.overlayRef && getPositionStrategy(this.overlayRef);
|
|
234
|
+
if (positionStrategy) {
|
|
235
|
+
positionStrategy.withPositions(getOverlayPositions(this.config.element, placement));
|
|
236
|
+
this.overlayRef?.updatePosition();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
197
239
|
hide() {
|
|
198
240
|
if (this.isFocused || this.isHovered) {
|
|
199
241
|
return;
|
|
@@ -204,6 +246,8 @@ class BrowserTooltipRef {
|
|
|
204
246
|
destroy() {
|
|
205
247
|
this.destroy$.next();
|
|
206
248
|
this.destroy$.complete();
|
|
249
|
+
this.canShowEffect?.destroy();
|
|
250
|
+
this.placementEffect?.destroy();
|
|
207
251
|
this.overlayRef?.dispose();
|
|
208
252
|
this.positionSubscription?.unsubscribe();
|
|
209
253
|
}
|
|
@@ -223,29 +267,15 @@ class SiTooltipService {
|
|
|
223
267
|
if (!this.isBrowser) {
|
|
224
268
|
return new NoopTooltipRef();
|
|
225
269
|
}
|
|
226
|
-
const injector = Injector.create({
|
|
227
|
-
parent: config.injector,
|
|
228
|
-
providers: [
|
|
229
|
-
{
|
|
230
|
-
provide: SI_TOOLTIP_CONFIG,
|
|
231
|
-
useValue: {
|
|
232
|
-
id: config.describedBy,
|
|
233
|
-
tooltip: config.tooltip,
|
|
234
|
-
tooltipContext: config.tooltipContext
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
]
|
|
238
|
-
});
|
|
239
270
|
return new BrowserTooltipRef({
|
|
240
271
|
...config,
|
|
241
|
-
injector,
|
|
242
272
|
overlay: this.overlay
|
|
243
273
|
});
|
|
244
274
|
}
|
|
245
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
246
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
275
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTooltipService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
276
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTooltipService });
|
|
247
277
|
}
|
|
248
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
278
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTooltipService, decorators: [{
|
|
249
279
|
type: Injectable
|
|
250
280
|
}] });
|
|
251
281
|
|
|
@@ -256,59 +286,52 @@ class SiTooltipDirective {
|
|
|
256
286
|
*
|
|
257
287
|
* @defaultValue ''
|
|
258
288
|
*/
|
|
259
|
-
siTooltip = input('',
|
|
289
|
+
siTooltip = input('', /* @ts-ignore */
|
|
290
|
+
...(ngDevMode ? [{ debugName: "siTooltip" }] : /* istanbul ignore next */ []));
|
|
260
291
|
/**
|
|
261
292
|
* The placement of the tooltip. One of 'top', 'start', end', 'bottom'
|
|
262
293
|
*
|
|
263
294
|
* @defaultValue 'auto'
|
|
264
295
|
*/
|
|
265
|
-
placement = input('auto',
|
|
296
|
+
placement = input('auto', /* @ts-ignore */
|
|
297
|
+
...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
266
298
|
/**
|
|
267
299
|
* Allows the tooltip to be disabled
|
|
268
300
|
*
|
|
269
301
|
* @defaultValue false
|
|
270
302
|
*/
|
|
271
|
-
isDisabled = input(false, { ...(ngDevMode ? { debugName: "isDisabled" } : {}), transform: booleanAttribute });
|
|
303
|
+
isDisabled = input(false, { ...(ngDevMode ? { debugName: "isDisabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
272
304
|
/**
|
|
273
305
|
* Optional CDK scroll strategy used for the tooltip overlay.
|
|
274
306
|
* If not provided, the default reposition strategy is used.
|
|
275
307
|
*/
|
|
276
|
-
tooltipScrollStrategy = input(
|
|
308
|
+
tooltipScrollStrategy = input(/* @ts-ignore */
|
|
309
|
+
...(ngDevMode ? [undefined, { debugName: "tooltipScrollStrategy" }] : /* istanbul ignore next */ []));
|
|
277
310
|
/**
|
|
278
311
|
* The context for the attached template
|
|
279
312
|
*/
|
|
280
|
-
tooltipContext = input(
|
|
313
|
+
tooltipContext = input(/* @ts-ignore */
|
|
314
|
+
...(ngDevMode ? [undefined, { debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
281
315
|
describedBy = `__tooltip_${SiTooltipDirective.idCounter++}`;
|
|
282
|
-
|
|
316
|
+
canShow = computed(() => !!this.siTooltip() && !this.isDisabled(), /* @ts-ignore */
|
|
317
|
+
...(ngDevMode ? [{ debugName: "canShow" }] : /* istanbul ignore next */ []));
|
|
283
318
|
tooltipService = inject(SiTooltipService);
|
|
284
319
|
elementRef = inject(ElementRef);
|
|
285
320
|
constructor() {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
tooltip: this.siTooltip,
|
|
295
|
-
tooltipContext: this.tooltipContext,
|
|
296
|
-
scrollStrategy: this.tooltipScrollStrategy
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
else if (this.tooltipRef) {
|
|
300
|
-
this.tooltipRef.destroy();
|
|
301
|
-
this.tooltipRef = undefined;
|
|
302
|
-
}
|
|
321
|
+
this.tooltipService.createTooltip({
|
|
322
|
+
describedBy: this.describedBy,
|
|
323
|
+
element: this.elementRef,
|
|
324
|
+
placement: this.placement,
|
|
325
|
+
canShow: this.canShow,
|
|
326
|
+
tooltip: this.siTooltip,
|
|
327
|
+
tooltipContext: this.tooltipContext,
|
|
328
|
+
scrollStrategy: this.tooltipScrollStrategy
|
|
303
329
|
});
|
|
304
330
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: SiTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
309
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.8", type: SiTooltipDirective, isStandalone: true, selector: "[siTooltip]", inputs: { siTooltip: { classPropertyName: "siTooltip", publicName: "siTooltip", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, tooltipScrollStrategy: { classPropertyName: "tooltipScrollStrategy", publicName: "tooltipScrollStrategy", isSignal: true, isRequired: false, transformFunction: null }, tooltipContext: { classPropertyName: "tooltipContext", publicName: "tooltipContext", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-describedby": "isDisabled() ? null : describedBy" } }, providers: [SiTooltipService], ngImport: i0 });
|
|
331
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
332
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.7", type: SiTooltipDirective, isStandalone: true, selector: "[siTooltip]", inputs: { siTooltip: { classPropertyName: "siTooltip", publicName: "siTooltip", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, tooltipScrollStrategy: { classPropertyName: "tooltipScrollStrategy", publicName: "tooltipScrollStrategy", isSignal: true, isRequired: false, transformFunction: null }, tooltipContext: { classPropertyName: "tooltipContext", publicName: "tooltipContext", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-describedby": "isDisabled() ? null : describedBy" } }, providers: [SiTooltipService], ngImport: i0 });
|
|
310
333
|
}
|
|
311
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
334
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTooltipDirective, decorators: [{
|
|
312
335
|
type: Directive,
|
|
313
336
|
args: [{
|
|
314
337
|
selector: '[siTooltip]',
|
|
@@ -324,11 +347,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
324
347
|
* SPDX-License-Identifier: MIT
|
|
325
348
|
*/
|
|
326
349
|
class SiTooltipModule {
|
|
327
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
328
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
329
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
350
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTooltipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
351
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.7", ngImport: i0, type: SiTooltipModule, imports: [SiTooltipDirective], exports: [SiTooltipDirective] });
|
|
352
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTooltipModule });
|
|
330
353
|
}
|
|
331
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTooltipModule, decorators: [{
|
|
332
355
|
type: NgModule,
|
|
333
356
|
args: [{
|
|
334
357
|
imports: [SiTooltipDirective],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siemens-element-ng-tooltip.mjs","sources":["../../../../projects/element-ng/tooltip/si-tooltip.model.ts","../../../../projects/element-ng/tooltip/si-tooltip.component.ts","../../../../projects/element-ng/tooltip/si-tooltip.component.html","../../../../projects/element-ng/tooltip/si-tooltip.service.ts","../../../../projects/element-ng/tooltip/si-tooltip.directive.ts","../../../../projects/element-ng/tooltip/si-tooltip.module.ts","../../../../projects/element-ng/tooltip/index.ts","../../../../projects/element-ng/tooltip/siemens-element-ng-tooltip.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ElementRef, InjectionToken, TemplateRef, Type } from '@angular/core';\nimport { TranslatableString } from '@siemens/element-translate-ng/translate';\n\nexport type SiTooltipContent =\n | TranslatableString\n | TemplateRef<any>\n | Type<any>\n | ElementRef<Element>\n | null\n | undefined;\n\nexport interface SiTooltipConfig {\n id?: string;\n tooltip: () => SiTooltipContent;\n tooltipContext: () => unknown;\n}\n\nexport const SI_TOOLTIP_CONFIG = new InjectionToken<SiTooltipConfig>('SiTooltipConfig');\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ConnectedOverlayPositionChange, OverlayRef } from '@angular/cdk/overlay';\nimport { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';\nimport {\n afterRenderEffect,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n signal,\n TemplateRef\n} from '@angular/core';\nimport { calculateOverlayArrowPosition, OverlayArrowPosition } from '@siemens/element-ng/common';\nimport { SiTranslatePipe } from '@siemens/element-translate-ng/translate';\n\nimport { SI_TOOLTIP_CONFIG } from './si-tooltip.model';\n\n@Component({\n selector: 'si-tooltip',\n imports: [NgTemplateOutlet, SiTranslatePipe, NgComponentOutlet],\n templateUrl: './si-tooltip.component.html',\n styleUrl: './si-tooltip.component.scss',\n changeDetection: ChangeDetectionStrategy.Default,\n host: {\n 'animate.leave': 'tooltip-leave'\n }\n})\nexport class TooltipComponent {\n protected readonly tooltipPositionClass = signal('');\n protected readonly arrowPos = signal<OverlayArrowPosition | undefined>(undefined);\n\n protected readonly config = inject(SI_TOOLTIP_CONFIG);\n private readonly elementRef = inject(ElementRef);\n private readonly overlayRef = inject(OverlayRef);\n\n private lastPositionChange?: ConnectedOverlayPositionChange;\n private lastAnchor?: ElementRef;\n\n constructor() {\n let isFirstRun = true;\n afterRenderEffect(() => {\n this.config.tooltip();\n this.config.tooltipContext();\n if (isFirstRun) {\n isFirstRun = false;\n return;\n }\n this.overlayRef.updatePosition();\n if (this.lastPositionChange) {\n this.updateTooltipPosition(this.lastPositionChange, this.lastAnchor);\n }\n });\n }\n\n protected readonly tooltipText = computed<string | null>(() => {\n const tooltip = this.config.tooltip();\n if (typeof tooltip === 'string') {\n return tooltip;\n }\n // When an ElementRef is provided, read its current text content whenever the\n // tooltip is shown, so dynamic content is always reflected.\n // The tooltip content is not updated while being displayed.\n if (tooltip instanceof ElementRef) {\n return tooltip.nativeElement.textContent.trim();\n }\n return null;\n });\n\n protected readonly tooltipTemplate = computed<TemplateRef<any> | null>(() => {\n const tooltip = this.config.tooltip();\n return tooltip instanceof TemplateRef ? tooltip : null;\n });\n\n protected readonly tooltipComponent = computed(() => {\n const tooltip = this.config.tooltip();\n return !(tooltip instanceof TemplateRef) &&\n !(tooltip instanceof ElementRef) &&\n typeof tooltip !== 'string'\n ? tooltip\n : null;\n });\n\n /** @internal */\n updateTooltipPosition(change: ConnectedOverlayPositionChange, anchor?: ElementRef): void {\n this.lastPositionChange = change;\n this.lastAnchor = anchor;\n const arrowClassTooltip = `tooltip-${change.connectionPair.overlayX}-${change.connectionPair.overlayY}`;\n // need two updates as class changes affect the position\n if (arrowClassTooltip !== this.tooltipPositionClass()) {\n this.tooltipPositionClass.set(arrowClassTooltip);\n }\n const arrowPos = calculateOverlayArrowPosition(change, this.elementRef, anchor);\n this.arrowPos.set(arrowPos);\n }\n}\n","<div\n class=\"tooltip show position-relative\"\n role=\"tooltip\"\n [id]=\"config.id\"\n [class]=\"tooltipPositionClass()\"\n>\n <div\n class=\"tooltip-arrow\"\n [style.left.px]=\"arrowPos()?.left\"\n [style.right.px]=\"arrowPos()?.right\"\n ></div>\n <div class=\"tooltip-inner\">\n @if (tooltipText()) {\n <div class=\"si-body\">{{ tooltipText() | translate }}</div>\n } @else if (tooltipTemplate()) {\n <ng-template\n [ngTemplateOutlet]=\"tooltipTemplate()\"\n [ngTemplateOutletContext]=\"config.tooltipContext()\"\n />\n } @else if (tooltipComponent()) {\n <ng-container [ngComponentOutlet]=\"tooltipComponent()!\" />\n }\n </div>\n</div>\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { Overlay, OverlayRef, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport { ComponentRef, ElementRef, inject, Injectable, Injector, PLATFORM_ID } from '@angular/core';\nimport { getOverlay, getPositionStrategy, positions } from '@siemens/element-ng/common';\nimport { fromEvent, Subject, Subscription, timer } from 'rxjs';\nimport { delayWhen, filter, takeUntil } from 'rxjs/operators';\n\nimport { TooltipComponent } from './si-tooltip.component';\nimport { SI_TOOLTIP_CONFIG, SiTooltipContent } from './si-tooltip.model';\n\n/** @internal */\ninterface TooltipRef {\n destroy(): void;\n}\n\n/**\n * A no-op TooltipRef used on platform server where DOM APIs are unavailable.\n *\n * @internal\n */\nclass NoopTooltipRef {\n destroy(): void {}\n}\n\n/**\n * BrowserTooltipRef is attached to a specific element.\n * Use it to show or hide a tooltip for that element.\n *\n * @internal\n */\nclass BrowserTooltipRef {\n private readonly destroy$ = new Subject<void>();\n private isFocused = false;\n private isHovered = false;\n private overlayRef?: OverlayRef;\n private positionSubscription?: Subscription;\n\n constructor(\n private config: {\n describedBy?: string;\n element: ElementRef;\n injector?: Injector;\n overlay: Overlay;\n placement: keyof typeof positions;\n scrollStrategy?: () => ScrollStrategy | undefined;\n tooltip: () => SiTooltipContent;\n tooltipContext: () => unknown;\n }\n ) {\n const nativeElement = this.config.element.nativeElement;\n\n fromEvent(nativeElement, 'focus')\n .pipe(\n filter(event => event instanceof FocusEvent),\n takeUntil(this.destroy$)\n )\n .subscribe(event => this.onFocus(event));\n\n fromEvent(nativeElement, 'mouseenter')\n .pipe(\n delayWhen(() =>\n // UX Guideline: tooltips on hover should be delayed by 500ms\n timer(500).pipe(\n takeUntil(fromEvent(nativeElement, 'mouseleave')),\n takeUntil(fromEvent(nativeElement, 'focusout')) // user started using keyboard\n )\n ),\n takeUntil(this.destroy$)\n )\n .subscribe(() => this.onMouseEnter());\n\n fromEvent(nativeElement, 'focusout')\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.onFocusOut());\n\n fromEvent(nativeElement, 'mouseleave')\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.onMouseLeave());\n\n fromEvent(nativeElement, 'touchstart')\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.onTouchStart());\n\n // The tooltip may be created lazily, after the element is already focused or\n // hovered (e.g. when validation errors appear on blur while the pointer still\n // hovers the element). In that case the initial `focus`/`mouseenter` was\n // missed, so show the tooltip immediately based on the live `:focus-visible`\n // and `:hover` state.\n if (nativeElement === document.activeElement && nativeElement.matches(':focus-visible')) {\n this.isFocused = true;\n this.show();\n } else if (nativeElement.matches(':hover')) {\n this.onMouseEnter();\n }\n }\n\n private onFocus(event: FocusEvent): void {\n if (event.target instanceof Element) {\n if (event.target.matches(':focus-visible')) {\n this.isFocused = true;\n this.show();\n }\n }\n }\n\n private onFocusOut(): void {\n this.isFocused = false;\n this.isHovered = false;\n this.hide();\n }\n\n private onMouseEnter(): void {\n this.isHovered = true;\n this.show();\n }\n\n private onMouseLeave(): void {\n this.isHovered = false;\n this.hide();\n }\n\n private onTouchStart(): void {\n // On touch devices a tooltip is not useful and would obscure the content the\n // user just tapped. Reset the hover/focus state so it is hidden immediately.\n this.isFocused = false;\n this.isHovered = false;\n this.hide();\n }\n\n private getOrCreateOverlay(): OverlayRef {\n this.overlayRef ??= getOverlay(\n this.config.element,\n this.config.overlay,\n false,\n this.config.placement,\n false,\n true,\n this.config.scrollStrategy?.()\n );\n return this.overlayRef;\n }\n\n private show(): void {\n const overlayRef = this.getOrCreateOverlay();\n if (overlayRef.hasAttached()) {\n return;\n }\n\n const injector = Injector.create({\n parent: this.config.injector,\n providers: [{ provide: OverlayRef, useValue: overlayRef }]\n });\n\n const toolTipPortal = new ComponentPortal(TooltipComponent, undefined, injector);\n const tooltipRef: ComponentRef<TooltipComponent> = overlayRef.attach(toolTipPortal);\n\n const positionStrategy = getPositionStrategy(overlayRef);\n this.positionSubscription?.unsubscribe();\n this.positionSubscription = positionStrategy?.positionChanges.subscribe(change =>\n tooltipRef.instance.updateTooltipPosition(change, this.config.element)\n );\n }\n\n private hide(): void {\n if (this.isFocused || this.isHovered) {\n return;\n }\n this.overlayRef?.detach();\n this.positionSubscription?.unsubscribe();\n }\n\n destroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n this.overlayRef?.dispose();\n this.positionSubscription?.unsubscribe();\n }\n}\n\n/**\n * A service to create tooltips for specific elements.\n * Use this if the tooltip directive is not suitable.\n * Must not be used outside element-ng.\n *\n * @internal\n */\n// We cannot provide this in root, as people may override the cdk overlay creation.\n@Injectable()\nexport class SiTooltipService {\n private overlay = inject(Overlay);\n private isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n createTooltip(config: {\n describedBy?: string;\n element: ElementRef;\n placement: keyof typeof positions;\n injector?: Injector;\n tooltip: () => SiTooltipContent;\n tooltipContext: () => unknown;\n scrollStrategy?: () => ScrollStrategy | undefined;\n }): TooltipRef {\n if (!this.isBrowser) {\n return new NoopTooltipRef();\n }\n\n const injector = Injector.create({\n parent: config.injector,\n providers: [\n {\n provide: SI_TOOLTIP_CONFIG,\n useValue: {\n id: config.describedBy,\n tooltip: config.tooltip,\n tooltipContext: config.tooltipContext\n }\n }\n ]\n });\n\n return new BrowserTooltipRef({\n ...config,\n injector,\n overlay: this.overlay\n });\n }\n}\n\nexport type { TooltipRef };\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ScrollStrategy } from '@angular/cdk/overlay';\nimport {\n booleanAttribute,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n OnDestroy,\n TemplateRef\n} from '@angular/core';\nimport { positions } from '@siemens/element-ng/common';\nimport { TranslatableString } from '@siemens/element-translate-ng/translate';\n\nimport { SiTooltipService, TooltipRef } from './si-tooltip.service';\n\n@Directive({\n selector: '[siTooltip]',\n providers: [SiTooltipService],\n host: {\n '[attr.aria-describedby]': 'isDisabled() ? null : describedBy'\n }\n})\nexport class SiTooltipDirective implements OnDestroy {\n private static idCounter = 0;\n\n /**\n * The tooltip text to be displayed\n *\n * @defaultValue ''\n */\n readonly siTooltip = input<TranslatableString | TemplateRef<any>>('');\n\n /**\n * The placement of the tooltip. One of 'top', 'start', end', 'bottom'\n *\n * @defaultValue 'auto'\n */\n readonly placement = input<keyof typeof positions>('auto');\n\n /**\n * Allows the tooltip to be disabled\n *\n * @defaultValue false\n */\n readonly isDisabled = input(false, { transform: booleanAttribute });\n\n /**\n * Optional CDK scroll strategy used for the tooltip overlay.\n * If not provided, the default reposition strategy is used.\n */\n readonly tooltipScrollStrategy = input<ScrollStrategy>();\n\n /**\n * The context for the attached template\n */\n readonly tooltipContext = input();\n\n protected describedBy = `__tooltip_${SiTooltipDirective.idCounter++}`;\n\n private tooltipRef?: TooltipRef;\n private tooltipService = inject(SiTooltipService);\n private elementRef = inject(ElementRef);\n\n constructor() {\n effect(() => {\n const tooltip = this.siTooltip();\n const disabled = this.isDisabled();\n\n if (tooltip && !disabled) {\n this.tooltipRef ??= this.tooltipService.createTooltip({\n describedBy: this.describedBy,\n element: this.elementRef,\n placement: this.placement(),\n tooltip: this.siTooltip,\n tooltipContext: this.tooltipContext,\n scrollStrategy: this.tooltipScrollStrategy\n });\n } else if (this.tooltipRef) {\n this.tooltipRef.destroy();\n this.tooltipRef = undefined;\n }\n });\n }\n\n ngOnDestroy(): void {\n this.tooltipRef?.destroy();\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { NgModule } from '@angular/core';\n\nimport { SiTooltipDirective } from './si-tooltip.directive';\n\n@NgModule({\n imports: [SiTooltipDirective],\n exports: [SiTooltipDirective]\n})\nexport class SiTooltipModule {}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-tooltip.module';\nexport * from './si-tooltip.directive';\nexport * from './si-tooltip.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;AAGG;AAkBI,MAAM,iBAAiB,GAAG,IAAI,cAAc,CAAkB,iBAAiB,CAAC;;ACrBvF;;;AAGG;MA4BU,gBAAgB,CAAA;AACR,IAAA,oBAAoB,GAAG,MAAM,CAAC,EAAE,gEAAC;AACjC,IAAA,QAAQ,GAAG,MAAM,CAAmC,SAAS,oDAAC;AAE9D,IAAA,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC;AACpC,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAExC,IAAA,kBAAkB;AAClB,IAAA,UAAU;AAElB,IAAA,WAAA,GAAA;QACE,IAAI,UAAU,GAAG,IAAI;QACrB,iBAAiB,CAAC,MAAK;AACrB,YAAA,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;AACrB,YAAA,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;YAC5B,IAAI,UAAU,EAAE;gBACd,UAAU,GAAG,KAAK;gBAClB;YACF;AACA,YAAA,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE;AAChC,YAAA,IAAI,IAAI,CAAC,kBAAkB,EAAE;gBAC3B,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,UAAU,CAAC;YACtE;AACF,QAAA,CAAC,CAAC;IACJ;AAEmB,IAAA,WAAW,GAAG,QAAQ,CAAgB,MAAK;QAC5D,MAAM,OAAO,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S;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;oBACvB,SAAS,EAAE,CAAC,gBAAgB,CAAC;AAC7B,oBAAA,IAAI,EAAE;AACJ,wBAAA,yBAAyB,EAAE;AAC5B;AACF,iBAAA;;;AC1BD;;;AAGG;MASU,eAAe,CAAA;uGAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAAf,eAAe,EAAA,OAAA,EAAA,CAHhB,kBAAkB,CAAA,EAAA,OAAA,EAAA,CAClB,kBAAkB,CAAA,EAAA,CAAA;wGAEjB,eAAe,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,kBAAkB,CAAC;oBAC7B,OAAO,EAAE,CAAC,kBAAkB;AAC7B,iBAAA;;;ACXD;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"siemens-element-ng-tooltip.mjs","sources":["../../../../projects/element-ng/tooltip/si-tooltip.component.ts","../../../../projects/element-ng/tooltip/si-tooltip.component.html","../../../../projects/element-ng/tooltip/si-tooltip.service.ts","../../../../projects/element-ng/tooltip/si-tooltip.directive.ts","../../../../projects/element-ng/tooltip/si-tooltip.module.ts","../../../../projects/element-ng/tooltip/index.ts","../../../../projects/element-ng/tooltip/siemens-element-ng-tooltip.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ConnectedOverlayPositionChange, OverlayRef } from '@angular/cdk/overlay';\nimport { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';\nimport {\n afterRenderEffect,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n input,\n signal,\n TemplateRef\n} from '@angular/core';\nimport { calculateOverlayArrowPosition, OverlayArrowPosition } from '@siemens/element-ng/common';\nimport { SiTranslatePipe } from '@siemens/element-translate-ng/translate';\n\nimport { SiTooltipContent } from './si-tooltip.model';\n\n@Component({\n selector: 'si-tooltip',\n imports: [NgTemplateOutlet, SiTranslatePipe, NgComponentOutlet],\n templateUrl: './si-tooltip.component.html',\n styleUrl: './si-tooltip.component.scss',\n changeDetection: ChangeDetectionStrategy.Eager,\n host: {\n 'animate.leave': 'tooltip-leave'\n }\n})\nexport class TooltipComponent {\n readonly id = input<string>();\n\n readonly tooltip = input<SiTooltipContent>();\n\n readonly tooltipContext = input<unknown>();\n\n protected readonly tooltipPositionClass = signal('');\n protected readonly arrowPos = signal<OverlayArrowPosition | undefined>(undefined);\n\n private readonly elementRef = inject(ElementRef);\n private readonly overlayRef = inject(OverlayRef);\n\n private lastPositionChange?: ConnectedOverlayPositionChange;\n private lastAnchor?: ElementRef;\n\n constructor() {\n let isFirstRun = true;\n afterRenderEffect(() => {\n this.tooltip();\n this.tooltipContext();\n if (isFirstRun) {\n isFirstRun = false;\n return;\n }\n this.overlayRef.updatePosition();\n if (this.lastPositionChange) {\n this.updateTooltipPosition(this.lastPositionChange, this.lastAnchor);\n }\n });\n }\n\n protected readonly tooltipText = computed<string | null>(() => {\n const tooltip = this.tooltip();\n if (typeof tooltip === 'string') {\n return tooltip;\n }\n // When an ElementRef is provided, read its current text content whenever the\n // tooltip is shown, so dynamic content is always reflected.\n // The tooltip content is not updated while being displayed.\n if (tooltip instanceof ElementRef) {\n return tooltip.nativeElement.textContent.trim();\n }\n return null;\n });\n\n protected readonly tooltipTemplate = computed<TemplateRef<any> | null>(() => {\n const tooltip = this.tooltip();\n return tooltip instanceof TemplateRef ? tooltip : null;\n });\n\n protected readonly tooltipComponent = computed(() => {\n const tooltip = this.tooltip();\n return !(tooltip instanceof TemplateRef) &&\n !(tooltip instanceof ElementRef) &&\n typeof tooltip !== 'string'\n ? tooltip\n : null;\n });\n\n /** @internal */\n updateTooltipPosition(change: ConnectedOverlayPositionChange, anchor?: ElementRef): void {\n this.lastPositionChange = change;\n this.lastAnchor = anchor;\n const arrowClassTooltip = `tooltip-${change.connectionPair.overlayX}-${change.connectionPair.overlayY}`;\n // need two updates as class changes affect the position\n if (arrowClassTooltip !== this.tooltipPositionClass()) {\n this.tooltipPositionClass.set(arrowClassTooltip);\n }\n const arrowPos = calculateOverlayArrowPosition(change, this.elementRef, anchor);\n this.arrowPos.set(arrowPos);\n }\n}\n","<div\n class=\"tooltip show position-relative\"\n role=\"tooltip\"\n [id]=\"id()\"\n [class]=\"tooltipPositionClass()\"\n>\n <div\n class=\"tooltip-arrow\"\n [style.left.px]=\"arrowPos()?.left\"\n [style.right.px]=\"arrowPos()?.right\"\n ></div>\n <div class=\"tooltip-inner\">\n @if (tooltipText()) {\n <div class=\"si-body\">{{ tooltipText() | translate }}</div>\n } @else if (tooltipTemplate()) {\n <ng-template\n [ngTemplateOutlet]=\"tooltipTemplate()\"\n [ngTemplateOutletContext]=\"tooltipContext()\"\n />\n } @else if (tooltipComponent()) {\n <ng-container [ngComponentOutlet]=\"tooltipComponent()!\" />\n }\n </div>\n</div>\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { Overlay, OverlayRef, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n ComponentRef,\n DestroyRef,\n effect,\n ElementRef,\n EffectRef,\n inject,\n Injectable,\n Injector,\n inputBinding,\n PLATFORM_ID\n} from '@angular/core';\nimport {\n getOverlay,\n getOverlayPositions,\n getPositionStrategy,\n positions\n} from '@siemens/element-ng/common';\nimport { fromEvent, Subject, Subscription, timer } from 'rxjs';\nimport { delayWhen, filter, takeUntil } from 'rxjs/operators';\n\nimport { TooltipComponent } from './si-tooltip.component';\nimport { SiTooltipContent } from './si-tooltip.model';\n\n/** @internal */\ninterface TooltipRef {\n destroy(): void;\n}\n\n/**\n * A no-op TooltipRef used on platform server where DOM APIs are unavailable.\n *\n * @internal\n */\nclass NoopTooltipRef {\n destroy(): void {}\n}\n\n/**\n * BrowserTooltipRef is attached to a specific element.\n * Use it to show or hide a tooltip for that element.\n *\n * @internal\n */\nclass BrowserTooltipRef {\n private readonly destroyRef = inject(DestroyRef);\n private readonly destroy$ = new Subject<void>();\n private isFocused = false;\n private isHovered = false;\n private overlayRef?: OverlayRef;\n private positionSubscription?: Subscription;\n private canShowEffect?: EffectRef;\n private placementEffect?: EffectRef;\n\n constructor(\n private config: {\n describedBy?: string;\n element: ElementRef;\n injector?: Injector;\n overlay: Overlay;\n placement: () => keyof typeof positions;\n canShow?: () => boolean;\n scrollStrategy?: () => ScrollStrategy | undefined;\n tooltip: () => SiTooltipContent;\n tooltipContext: () => unknown;\n }\n ) {\n const nativeElement = this.config.element.nativeElement;\n this.destroyRef.onDestroy(() => this.destroy());\n\n if (this.config.canShow) {\n this.canShowEffect = effect(() => this.updateCanShow());\n }\n\n this.placementEffect = effect(() => this.updatePlacement(this.config.placement()));\n\n fromEvent(nativeElement, 'focus')\n .pipe(\n filter(event => event instanceof FocusEvent),\n takeUntil(this.destroy$)\n )\n .subscribe(event => this.onFocus(event));\n\n fromEvent(nativeElement, 'mouseenter')\n .pipe(\n delayWhen(() =>\n // UX Guideline: tooltips on hover should be delayed by 500ms\n timer(500).pipe(\n takeUntil(fromEvent(nativeElement, 'mouseleave')),\n takeUntil(fromEvent(nativeElement, 'focusout')) // user started using keyboard\n )\n ),\n takeUntil(this.destroy$)\n )\n .subscribe(() => this.onMouseEnter());\n\n fromEvent(nativeElement, 'focusout')\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.onFocusOut());\n\n fromEvent(nativeElement, 'mouseleave')\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.onMouseLeave());\n\n fromEvent(nativeElement, 'touchstart')\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.onTouchStart());\n\n this.showForCurrentInteraction();\n }\n\n private updateCanShow(): void {\n if (!this.config.canShow!()) {\n this.isFocused = false;\n this.isHovered = false;\n this.hide();\n return;\n }\n\n this.showForCurrentInteraction();\n }\n\n private showForCurrentInteraction(): void {\n const nativeElement = this.config.element.nativeElement;\n // The tooltip may become eligible after the element is already focused or\n // hovered (e.g. validation errors appear on blur while the pointer still\n // hovers the element). In that case show it based on the live interaction state.\n if (nativeElement === document.activeElement && nativeElement.matches(':focus-visible')) {\n this.isFocused = true;\n this.show();\n } else if (nativeElement.matches(':hover')) {\n this.onMouseEnter();\n }\n }\n\n private onFocus(event: FocusEvent): void {\n if (event.target instanceof Element) {\n if (event.target.matches(':focus-visible')) {\n this.isFocused = true;\n this.show();\n }\n }\n }\n\n private onFocusOut(): void {\n this.isFocused = false;\n this.isHovered = false;\n this.hide();\n }\n\n private onMouseEnter(): void {\n this.isHovered = true;\n this.show();\n }\n\n private onMouseLeave(): void {\n this.isHovered = false;\n this.hide();\n }\n\n private onTouchStart(): void {\n // On touch devices a tooltip is not useful and would obscure the content the\n // user just tapped. Reset the hover/focus state so it is hidden immediately.\n this.isFocused = false;\n this.isHovered = false;\n this.hide();\n }\n\n private getOrCreateOverlay(): OverlayRef {\n this.overlayRef ??= getOverlay(\n this.config.element,\n this.config.overlay,\n false,\n this.getPlacement(),\n false,\n true,\n this.config.scrollStrategy?.()\n );\n return this.overlayRef;\n }\n\n private show(): void {\n if (this.config.canShow && !this.config.canShow()) {\n return;\n }\n\n const overlayRef = this.getOrCreateOverlay();\n if (overlayRef.hasAttached()) {\n return;\n }\n\n const injector = Injector.create({\n parent: this.config.injector,\n providers: [{ provide: OverlayRef, useValue: overlayRef }]\n });\n\n const toolTipPortal = new ComponentPortal(TooltipComponent, undefined, injector, undefined, [\n inputBinding('id', () => this.config.describedBy),\n inputBinding('tooltip', this.config.tooltip),\n inputBinding('tooltipContext', this.config.tooltipContext)\n ]);\n const tooltipRef: ComponentRef<TooltipComponent> = overlayRef.attach(toolTipPortal);\n\n const positionStrategy = getPositionStrategy(overlayRef);\n this.positionSubscription?.unsubscribe();\n this.positionSubscription = positionStrategy?.positionChanges.subscribe(change =>\n tooltipRef.instance.updateTooltipPosition(change, this.config.element)\n );\n }\n\n private getPlacement(): keyof typeof positions {\n return this.config.placement();\n }\n\n private updatePlacement(placement: keyof typeof positions): void {\n const positionStrategy = this.overlayRef && getPositionStrategy(this.overlayRef);\n if (positionStrategy) {\n positionStrategy.withPositions(getOverlayPositions(this.config.element, placement));\n this.overlayRef?.updatePosition();\n }\n }\n\n private hide(): void {\n if (this.isFocused || this.isHovered) {\n return;\n }\n this.overlayRef?.detach();\n this.positionSubscription?.unsubscribe();\n }\n\n destroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n this.canShowEffect?.destroy();\n this.placementEffect?.destroy();\n this.overlayRef?.dispose();\n this.positionSubscription?.unsubscribe();\n }\n}\n\n/**\n * A service to create tooltips for specific elements.\n * Use this if the tooltip directive is not suitable.\n * Must not be used outside element-ng.\n *\n * @internal\n */\n// We cannot provide this in root, as people may override the cdk overlay creation.\n@Injectable()\nexport class SiTooltipService {\n private overlay = inject(Overlay);\n private isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n createTooltip(config: {\n describedBy?: string;\n element: ElementRef;\n placement: () => keyof typeof positions;\n injector?: Injector;\n canShow?: () => boolean;\n tooltip: () => SiTooltipContent;\n tooltipContext: () => unknown;\n scrollStrategy?: () => ScrollStrategy | undefined;\n }): TooltipRef {\n if (!this.isBrowser) {\n return new NoopTooltipRef();\n }\n\n return new BrowserTooltipRef({\n ...config,\n overlay: this.overlay\n });\n }\n}\n\nexport type { TooltipRef };\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { ScrollStrategy } from '@angular/cdk/overlay';\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n TemplateRef\n} from '@angular/core';\nimport { positions } from '@siemens/element-ng/common';\nimport { TranslatableString } from '@siemens/element-translate-ng/translate';\n\nimport { SiTooltipService } from './si-tooltip.service';\n\n@Directive({\n selector: '[siTooltip]',\n providers: [SiTooltipService],\n host: {\n '[attr.aria-describedby]': 'isDisabled() ? null : describedBy'\n }\n})\nexport class SiTooltipDirective {\n private static idCounter = 0;\n\n /**\n * The tooltip text to be displayed\n *\n * @defaultValue ''\n */\n readonly siTooltip = input<TranslatableString | TemplateRef<any>>('');\n\n /**\n * The placement of the tooltip. One of 'top', 'start', end', 'bottom'\n *\n * @defaultValue 'auto'\n */\n readonly placement = input<keyof typeof positions>('auto');\n\n /**\n * Allows the tooltip to be disabled\n *\n * @defaultValue false\n */\n readonly isDisabled = input(false, { transform: booleanAttribute });\n\n /**\n * Optional CDK scroll strategy used for the tooltip overlay.\n * If not provided, the default reposition strategy is used.\n */\n readonly tooltipScrollStrategy = input<ScrollStrategy>();\n\n /**\n * The context for the attached template\n */\n readonly tooltipContext = input();\n\n protected describedBy = `__tooltip_${SiTooltipDirective.idCounter++}`;\n\n private readonly canShow = computed(() => !!this.siTooltip() && !this.isDisabled());\n private readonly tooltipService = inject(SiTooltipService);\n private readonly elementRef = inject(ElementRef);\n\n constructor() {\n this.tooltipService.createTooltip({\n describedBy: this.describedBy,\n element: this.elementRef,\n placement: this.placement,\n canShow: this.canShow,\n tooltip: this.siTooltip,\n tooltipContext: this.tooltipContext,\n scrollStrategy: this.tooltipScrollStrategy\n });\n }\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport { NgModule } from '@angular/core';\n\nimport { SiTooltipDirective } from './si-tooltip.directive';\n\n@NgModule({\n imports: [SiTooltipDirective],\n exports: [SiTooltipDirective]\n})\nexport class SiTooltipModule {}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-tooltip.module';\nexport * from './si-tooltip.directive';\nexport * from './si-tooltip.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;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,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,EAAA,iBAAA,EAAA,gBAAA,EAAA,UAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,uBAAA,EAAA,mCAAA,EAAA,EAAA,EAAA,SAAA,EALlB,CAAC,gBAAgB,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAKlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAP9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;oBACvB,SAAS,EAAE,CAAC,gBAAgB,CAAC;AAC7B,oBAAA,IAAI,EAAE;AACJ,wBAAA,yBAAyB,EAAE;AAC5B;AACF,iBAAA;;;ACzBD;;;AAGG;MASU,eAAe,CAAA;uGAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAAf,eAAe,EAAA,OAAA,EAAA,CAHhB,kBAAkB,CAAA,EAAA,OAAA,EAAA,CAClB,kBAAkB,CAAA,EAAA,CAAA;wGAEjB,eAAe,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,kBAAkB,CAAC;oBAC7B,OAAO,EAAE,CAAC,kBAAkB;AAC7B,iBAAA;;;ACXD;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Overlay, OverlayOutsideClickDispatcher, FlexibleConnectedPositionStrategy } from '@angular/cdk/overlay';
|
|
2
2
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken, inject, signal,
|
|
4
|
+
import { InjectionToken, inject, signal, Component, ElementRef, viewChild, DOCUMENT, HostListener, Injector, Injectable } from '@angular/core';
|
|
5
5
|
import { isRTL, calculateOverlayArrowPosition } from '@siemens/element-ng/common';
|
|
6
6
|
import { ResizeObserverService } from '@siemens/element-ng/resize-observer';
|
|
7
7
|
import { Subject, map, merge, throttleTime, tap } from 'rxjs';
|
|
@@ -21,7 +21,8 @@ const SI_TOUR_TOKEN = new InjectionToken('SI_TOUR_TOKEN');
|
|
|
21
21
|
class SiTourHighlightComponent {
|
|
22
22
|
tourToken = inject(SI_TOUR_TOKEN);
|
|
23
23
|
anchor;
|
|
24
|
-
dim = signal({ top: 0, left: 0, width: 0, height: 0 },
|
|
24
|
+
dim = signal({ top: 0, left: 0, width: 0, height: 0 }, /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "dim" }] : /* istanbul ignore next */ []));
|
|
25
26
|
constructor() {
|
|
26
27
|
this.tourToken.currentStep.pipe(takeUntilDestroyed()).subscribe(step => {
|
|
27
28
|
this.anchor = step.anchor;
|
|
@@ -37,12 +38,12 @@ class SiTourHighlightComponent {
|
|
|
37
38
|
const rect = this.anchor.nativeElement.getBoundingClientRect();
|
|
38
39
|
this.dim.set({ top: rect.top, left: rect.left, width: rect.width, height: rect.height });
|
|
39
40
|
}
|
|
40
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
41
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
41
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTourHighlightComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
42
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.7", type: SiTourHighlightComponent, isStandalone: true, selector: "si-tour-highlight", ngImport: i0, template: "@let rect = dim();\n<div\n class=\"highlighter\"\n [style.top.px]=\"rect.top\"\n [style.left.px]=\"rect.left\"\n [style.inline-size.px]=\"rect.width\"\n [style.block-size.px]=\"rect.height\"\n></div>\n", styles: [".highlighter{position:fixed;box-shadow:var(--element-base-translucent-1) 0 0 0 1000vmax;pointer-events:none}::ng-deep .cdk-global-overlay-wrapper:has(si-tour-highlight){z-index:2000}\n"] });
|
|
42
43
|
}
|
|
43
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTourHighlightComponent, decorators: [{
|
|
44
45
|
type: Component,
|
|
45
|
-
args: [{ selector: 'si-tour-highlight',
|
|
46
|
+
args: [{ selector: 'si-tour-highlight', template: "@let rect = dim();\n<div\n class=\"highlighter\"\n [style.top.px]=\"rect.top\"\n [style.left.px]=\"rect.left\"\n [style.inline-size.px]=\"rect.width\"\n [style.block-size.px]=\"rect.height\"\n></div>\n", styles: [".highlighter{position:fixed;box-shadow:var(--element-base-translucent-1) 0 0 0 1000vmax;pointer-events:none}::ng-deep .cdk-global-overlay-wrapper:has(si-tour-highlight){z-index:2000}\n"] }]
|
|
46
47
|
}], ctorParameters: () => [] });
|
|
47
48
|
|
|
48
49
|
/**
|
|
@@ -50,10 +51,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
50
51
|
* SPDX-License-Identifier: MIT
|
|
51
52
|
*/
|
|
52
53
|
class SiTourComponent {
|
|
53
|
-
positionClass = signal('',
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
positionClass = signal('', /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "positionClass" }] : /* istanbul ignore next */ []));
|
|
56
|
+
arrowPos = signal(undefined, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "arrowPos" }] : /* istanbul ignore next */ []));
|
|
58
|
+
step = signal(undefined, /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
|
|
60
|
+
show = signal(false, /* @ts-ignore */
|
|
61
|
+
...(ngDevMode ? [{ debugName: "show" }] : /* istanbul ignore next */ []));
|
|
57
62
|
icons = addIcons({ elementCancel });
|
|
58
63
|
tourToken = inject(SI_TOUR_TOKEN);
|
|
59
64
|
backText = t(() => $localize `:@@SI_TOUR.BACK:Back`);
|
|
@@ -66,7 +71,8 @@ class SiTourComponent {
|
|
|
66
71
|
subscription;
|
|
67
72
|
prevFocus = null;
|
|
68
73
|
lastPositionChange;
|
|
69
|
-
focusTrap = viewChild('focusTrap',
|
|
74
|
+
focusTrap = viewChild('focusTrap', /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "focusTrap" }] : /* istanbul ignore next */ []));
|
|
70
76
|
document = inject(DOCUMENT);
|
|
71
77
|
constructor() {
|
|
72
78
|
this.subscription = this.tourToken.currentStep.subscribe(step => {
|
|
@@ -124,12 +130,12 @@ class SiTourComponent {
|
|
|
124
130
|
this.positionClass.set(`popover-${connPair.overlayX}-${connPair.overlayY}`);
|
|
125
131
|
setTimeout(() => this.arrowPos.set(calculateOverlayArrowPosition(update.change, this.elementRef, update.anchor)));
|
|
126
132
|
}
|
|
127
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
128
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
133
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTourComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
134
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: SiTourComponent, isStandalone: true, selector: "si-tour", host: { listeners: { "window:keydown": "keyListener($event)" }, properties: { "attr.data-step-id": "step()?.step?.id" } }, viewQueries: [{ propertyName: "focusTrap", first: true, predicate: ["focusTrap"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"backdrop\"></div>\n<div\n #focusTrap=\"cdkTrapFocus\"\n role=\"dialog\"\n aria-labelledby=\"__si-tour-step-title\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n [class]=\"['tour-content', 'popover', 'position-relative', positionClass()]\"\n [class.show]=\"show()\"\n>\n @if (arrowPos()) {\n <div\n class=\"popover-arrow\"\n [style.left.px]=\"arrowPos()?.left\"\n [style.right.px]=\"arrowPos()?.right\"\n ></div>\n }\n @if (step()) {\n @let tourStep = step()!;\n <div class=\"d-flex\">\n <div class=\"p-6 flex-fill\">\n <div class=\"pb-2 si-body text-secondary\">\n {{ progressText | translate: { step: tourStep.stepNumber, total: tourStep.totalSteps } }}\n </div>\n <div id=\"__si-tour-step-title\" class=\"si-h4 mb-0\">\n {{ tourStep.step.title | translate }}\n </div>\n </div>\n <button\n type=\"button\"\n class=\"btn btn-circle btn-tertiary-ghost mt-4 me-5\"\n [attr.aria-label]=\"ariaLabelClose | translate\"\n (click)=\"action('cancel')\"\n >\n <si-icon [icon]=\"icons.elementCancel\" />\n </button>\n </div>\n <div class=\"step-text si-body px-6 pb-8\">\n {{ tourStep.step.text | translate }}\n </div>\n <div class=\"d-flex justify-content-end align-items-center p-6 gap-6\">\n @if (tourStep.stepNumber !== 1) {\n <button\n type=\"button\"\n class=\"btn btn-secondary\"\n [disabled]=\"tourToken.blocked()\"\n (click)=\"action('back')\"\n >\n {{ backText | translate }}\n </button>\n } @else {\n <button type=\"button\" class=\"btn btn-tertiary\" (click)=\"action('cancel')\">\n {{ skipText | translate }}\n </button>\n }\n <button\n type=\"button\"\n class=\"btn btn-primary\"\n cdkFocusInitial\n [disabled]=\"tourToken.blocked()\"\n (click)=\"action(tourStep.stepNumber !== tourStep.totalSteps ? 'next' : 'complete')\"\n >\n @if (tourStep.stepNumber !== tourStep.totalSteps) {\n {{ nextText | translate }}\n } @else {\n {{ doneText | translate }}\n }\n </button>\n </div>\n }\n</div>\n", styles: [".tour-content{--popover-arrow-width: 24px;--popover-arrow-height: 12px;--popover-bg-color: var(--element-base-1);max-inline-size:400px;inline-size:100vi;opacity:0}.tour-content.show{opacity:1}.backdrop{position:fixed;inset:-200vmax}::ng-deep .cdk-overlay-connected-position-bounding-box:has(si-tour),::ng-deep .cdk-global-overlay-wrapper:has(si-tour){z-index:2000}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: SiIconComponent, selector: "si-icon", inputs: ["icon"] }, { kind: "pipe", type: SiTranslatePipe, name: "translate" }] });
|
|
129
135
|
}
|
|
130
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
136
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTourComponent, decorators: [{
|
|
131
137
|
type: Component,
|
|
132
|
-
args: [{ selector: 'si-tour', imports: [A11yModule, SiIconComponent, SiTranslatePipe],
|
|
138
|
+
args: [{ selector: 'si-tour', imports: [A11yModule, SiIconComponent, SiTranslatePipe], host: {
|
|
133
139
|
'[attr.data-step-id]': 'step()?.step?.id'
|
|
134
140
|
}, template: "<div class=\"backdrop\"></div>\n<div\n #focusTrap=\"cdkTrapFocus\"\n role=\"dialog\"\n aria-labelledby=\"__si-tour-step-title\"\n cdkTrapFocus\n cdkTrapFocusAutoCapture\n [class]=\"['tour-content', 'popover', 'position-relative', positionClass()]\"\n [class.show]=\"show()\"\n>\n @if (arrowPos()) {\n <div\n class=\"popover-arrow\"\n [style.left.px]=\"arrowPos()?.left\"\n [style.right.px]=\"arrowPos()?.right\"\n ></div>\n }\n @if (step()) {\n @let tourStep = step()!;\n <div class=\"d-flex\">\n <div class=\"p-6 flex-fill\">\n <div class=\"pb-2 si-body text-secondary\">\n {{ progressText | translate: { step: tourStep.stepNumber, total: tourStep.totalSteps } }}\n </div>\n <div id=\"__si-tour-step-title\" class=\"si-h4 mb-0\">\n {{ tourStep.step.title | translate }}\n </div>\n </div>\n <button\n type=\"button\"\n class=\"btn btn-circle btn-tertiary-ghost mt-4 me-5\"\n [attr.aria-label]=\"ariaLabelClose | translate\"\n (click)=\"action('cancel')\"\n >\n <si-icon [icon]=\"icons.elementCancel\" />\n </button>\n </div>\n <div class=\"step-text si-body px-6 pb-8\">\n {{ tourStep.step.text | translate }}\n </div>\n <div class=\"d-flex justify-content-end align-items-center p-6 gap-6\">\n @if (tourStep.stepNumber !== 1) {\n <button\n type=\"button\"\n class=\"btn btn-secondary\"\n [disabled]=\"tourToken.blocked()\"\n (click)=\"action('back')\"\n >\n {{ backText | translate }}\n </button>\n } @else {\n <button type=\"button\" class=\"btn btn-tertiary\" (click)=\"action('cancel')\">\n {{ skipText | translate }}\n </button>\n }\n <button\n type=\"button\"\n class=\"btn btn-primary\"\n cdkFocusInitial\n [disabled]=\"tourToken.blocked()\"\n (click)=\"action(tourStep.stepNumber !== tourStep.totalSteps ? 'next' : 'complete')\"\n >\n @if (tourStep.stepNumber !== tourStep.totalSteps) {\n {{ nextText | translate }}\n } @else {\n {{ doneText | translate }}\n }\n </button>\n </div>\n }\n</div>\n", styles: [".tour-content{--popover-arrow-width: 24px;--popover-arrow-height: 12px;--popover-bg-color: var(--element-base-1);max-inline-size:400px;inline-size:100vi;opacity:0}.tour-content.show{opacity:1}.backdrop{position:fixed;inset:-200vmax}::ng-deep .cdk-overlay-connected-position-bounding-box:has(si-tour),::ng-deep .cdk-global-overlay-wrapper:has(si-tour){z-index:2000}\n"] }]
|
|
135
141
|
}], ctorParameters: () => [], propDecorators: { focusTrap: [{ type: i0.ViewChild, args: ['focusTrap', { isSignal: true }] }], keyListener: [{
|
|
@@ -402,10 +408,10 @@ class SiTourService {
|
|
|
402
408
|
this.overlayRefHighlight?.dispose();
|
|
403
409
|
this.overlayRefHighlight = undefined;
|
|
404
410
|
}
|
|
405
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
406
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
411
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTourService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
412
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTourService, providedIn: 'root' });
|
|
407
413
|
}
|
|
408
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
414
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SiTourService, decorators: [{
|
|
409
415
|
type: Injectable,
|
|
410
416
|
args: [{ providedIn: 'root' }]
|
|
411
417
|
}], ctorParameters: () => [] });
|