@agorapulse/ui-components 22.2.7 → 22.2.8-beta.1
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/agorapulse-ui-components-22.2.8-beta.1.tgz +0 -0
- package/fesm2022/agorapulse-ui-components-action-dropdown.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-action-dropdown.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-avatar-group.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-avatar-group.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-datepicker.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-datepicker.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-filter-chips-list.mjs +2 -2
- package/fesm2022/agorapulse-ui-components-filter-chips-list.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-filter-dropdown.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-labels.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-labels.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-nav-selector.mjs +4 -4
- package/fesm2022/agorapulse-ui-components-nav-selector.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-radio-button-card.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-radio-button-card.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-select.mjs +5 -5
- package/fesm2022/agorapulse-ui-components-select.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-selection-dropdown.mjs +1 -1
- package/fesm2022/agorapulse-ui-components-selection-dropdown.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-tooltip.mjs +181 -373
- package/fesm2022/agorapulse-ui-components-tooltip.mjs.map +1 -1
- package/package.json +1 -1
- package/types/agorapulse-ui-components-tooltip.d.ts +65 -34
- package/agorapulse-ui-components-22.2.7.tgz +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, NgZone, input, Directive, ViewEncapsulation, ChangeDetectionStrategy, Component,
|
|
2
|
+
import { inject, ElementRef, NgZone, input, Directive, ViewEncapsulation, ChangeDetectionStrategy, Component, computed, DestroyRef, TemplateRef } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import DOMPurify from 'dompurify';
|
|
3
5
|
import { AvatarComponent } from '@agorapulse/ui-components/avatar';
|
|
6
|
+
import { createFloatingOverlay } from '@agorapulse/ui-components/floating';
|
|
4
7
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
-
import DOMPurify from 'dompurify';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Directive that triggers a tooltip to show/hide
|
|
@@ -24,9 +26,12 @@ class TooltipExternalTriggerDirective {
|
|
|
24
26
|
return this.apTooltipExternalTrigger() ?? null;
|
|
25
27
|
}
|
|
26
28
|
ngAfterViewInit() {
|
|
27
|
-
|
|
29
|
+
const tooltip = this.targetTooltip;
|
|
30
|
+
if (!tooltip) {
|
|
28
31
|
return;
|
|
29
32
|
}
|
|
33
|
+
// Otherwise the CDK's outside-click dispatcher, which runs first in capture, closes and this toggle reopens.
|
|
34
|
+
tooltip.registerExternalTrigger(this.elementRef.nativeElement);
|
|
30
35
|
this.setupEventListeners();
|
|
31
36
|
}
|
|
32
37
|
setupEventListeners() {
|
|
@@ -45,6 +50,7 @@ class TooltipExternalTriggerDirective {
|
|
|
45
50
|
}
|
|
46
51
|
}
|
|
47
52
|
ngOnDestroy() {
|
|
53
|
+
this.targetTooltip?.unregisterExternalTrigger(this.elementRef.nativeElement);
|
|
48
54
|
this.cleanupEventListeners();
|
|
49
55
|
}
|
|
50
56
|
onClick() {
|
|
@@ -100,42 +106,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
100
106
|
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-tooltip', imports: [AvatarComponent], providers: [], encapsulation: ViewEncapsulation.None, template: "<div class=\"custom-tooltip-container\">\n @switch (type()) {\n @case (CUSTOM_TOOLTIP_TYPE.PRESENTATION) {\n @let presentation = presentationContext();\n @if (presentation) {\n <div class=\"tooltip-presentation-title\">{{ presentation.title }}</div>\n <div class=\"tooltip-presentation-caption\">{{ presentation.description }}</div>\n }\n }\n @case (CUSTOM_TOOLTIP_TYPE.LIST) {\n <div class=\"tooltip-list-container\">\n @for (avatar of tooltipListItems(); track avatar) {\n <div class=\"tooltip-item\">\n <ap-avatar\n [profilePicture]=\"avatar.profilePicture\"\n [alt]=\"avatar.alt ?? ''\"\n [network]=\"avatar.network\"\n [size]=\"showCaption() && avatar.caption ? 32 : 24\"\n [username]=\"avatar.username\"\n [showInitials]=\"avatar.showInitials\"\n [bigNetwork]=\"avatar.bigNetwork ?? false\"\n [anonymous]=\"avatar.anonymous ?? false\"\n [online]=\"avatar.online ?? false\"\n [rounded]=\"avatar.rounded ?? true\" />\n\n <div class=\"tooltip-item-info\">\n <div class=\"tooltip-item-title\">\n {{ avatar.username }}\n </div>\n @if (showCaption() && avatar.caption) {\n <div class=\"tooltip-item-caption\">\n {{ avatar.caption }}\n </div>\n }\n </div>\n </div>\n }\n </div>\n }\n @default {\n\n }\n }\n\n</div>\n", styles: [".custom-tooltip-container{display:flex;flex-direction:column;width:100%;height:100%;max-height:280px;overflow:auto;padding:var(--ref-spacing-xs);gap:var(--ref-spacing-xxxs);scrollbar-color:var(--ref-color-grey-20) transparent;scrollbar-width:thin}.custom-tooltip-container .tooltip-presentation-title{color:var(--ref-color-grey-100);font-family:Averta;font-size:var(--ref-font-size-md);font-style:normal;font-weight:var(--ref-font-weight-bold);line-height:var(--ref-font-line-height-lg)}.custom-tooltip-container .tooltip-presentation-caption{color:var(--ref-color-grey-80);font-family:Averta;font-size:var(--ref-font-size-sm);font-style:normal;font-weight:var(--ref-font-weight-regular);line-height:var(--ref-font-line-height-sm)}.custom-tooltip-container .tooltip-list-container{display:flex;flex-direction:column;align-items:flex-start;gap:var(--ref-spacing-xs)}.custom-tooltip-container .tooltip-list-container .tooltip-item{display:flex;flex-direction:row;align-items:center;gap:var(--ref-spacing-xxs)}.custom-tooltip-container .tooltip-list-container .tooltip-item .tooltip-item-info{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;flex:1 0 0}.custom-tooltip-container .tooltip-list-container .tooltip-item .tooltip-item-info .tooltip-item-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;align-self:stretch;overflow:hidden;color:var(--ref-color-grey-100);text-overflow:ellipsis;font-family:Averta;font-size:var(--ref-font-size-sm);font-style:normal;font-weight:var(--ref-font-weight-bold);line-height:var(--ref-font-line-height-sm)}.custom-tooltip-container .tooltip-list-container .tooltip-item .tooltip-item-info .tooltip-item-caption{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;align-self:stretch;overflow:hidden;color:var(--ref-color-grey-80);text-overflow:ellipsis;font-family:Averta;font-size:var(--ref-font-size-xs);font-style:normal;font-weight:var(--ref-font-weight-regular);line-height:var(--ref-font-line-height-xs)}\n"] }]
|
|
101
107
|
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], presentationContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "presentationContext", required: false }] }], tooltipListItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipListItems", required: false }] }], showCaption: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCaption", required: false }] }] } });
|
|
102
108
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
109
|
+
/**
|
|
110
|
+
* A tooltip's floating surface, internal to the directive: `role="tooltip"`, no focus handling — taking focus is `ap-popover`'s job.
|
|
111
|
+
* `ViewEncapsulation.None` and the `ap-tooltip*` class names stay: the styles are global, and the product overrides them by name.
|
|
112
|
+
* The host carries `ap-tooltip` because the engine reads the arrow's colour from the pane's first element child.
|
|
113
|
+
*/
|
|
114
|
+
class TooltipPanelComponent {
|
|
115
|
+
/** Plain-string content. Sanitised before it reaches the template. */
|
|
116
|
+
text = input(/* @ts-ignore */
|
|
117
|
+
...(ngDevMode ? [undefined, { debugName: "text" }] : /* istanbul ignore next */ []));
|
|
118
|
+
/** Consumer template, which takes precedence over `text`. */
|
|
119
|
+
template = input(/* @ts-ignore */
|
|
120
|
+
...(ngDevMode ? [undefined, { debugName: "template" }] : /* istanbul ignore next */ []));
|
|
121
|
+
/** The consumer template's `ngTemplateOutletContext`, read through its `let-` bindings. */
|
|
122
|
+
templateContext = input(/* @ts-ignore */
|
|
123
|
+
...(ngDevMode ? [undefined, { debugName: "templateContext" }] : /* istanbul ignore next */ []));
|
|
124
|
+
type = input(CustomTooltipType.DEFAULT, /* @ts-ignore */
|
|
125
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
126
|
+
presentationContext = input(/* @ts-ignore */
|
|
127
|
+
...(ngDevMode ? [undefined, { debugName: "presentationContext" }] : /* istanbul ignore next */ []));
|
|
128
|
+
listItems = input([], /* @ts-ignore */
|
|
129
|
+
...(ngDevMode ? [{ debugName: "listItems" }] : /* istanbul ignore next */ []));
|
|
130
|
+
showCaption = input(true, /* @ts-ignore */
|
|
131
|
+
...(ngDevMode ? [{ debugName: "showCaption" }] : /* istanbul ignore next */ []));
|
|
132
|
+
/** Only mirrored onto the host, for the class the product may hook onto. */
|
|
133
|
+
clickTriggered = input(false, /* @ts-ignore */
|
|
134
|
+
...(ngDevMode ? [{ debugName: "clickTriggered" }] : /* istanbul ignore next */ []));
|
|
135
|
+
isDefaultType = computed(() => !this.type() || this.type() === CustomTooltipType.DEFAULT, /* @ts-ignore */
|
|
136
|
+
...(ngDevMode ? [{ debugName: "isDefaultType" }] : /* istanbul ignore next */ []));
|
|
137
|
+
hasTemplate = computed(() => this.template() !== undefined, /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "hasTemplate" }] : /* istanbul ignore next */ []));
|
|
139
|
+
/** DOMPurify strips more than the `[innerHTML]` sanitiser that runs after it; neither pass adds anything. */
|
|
140
|
+
sanitizedText = computed(() => {
|
|
141
|
+
const text = this.text();
|
|
142
|
+
return text ? DOMPurify.sanitize(text) : '';
|
|
143
|
+
}, /* @ts-ignore */
|
|
144
|
+
...(ngDevMode ? [{ debugName: "sanitizedText" }] : /* istanbul ignore next */ []));
|
|
145
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
146
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: TooltipPanelComponent, isStandalone: true, selector: "ap-tooltip-panel", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null }, templateContext: { classPropertyName: "templateContext", publicName: "templateContext", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, presentationContext: { classPropertyName: "presentationContext", publicName: "presentationContext", isSignal: true, isRequired: false, transformFunction: null }, listItems: { classPropertyName: "listItems", publicName: "listItems", isSignal: true, isRequired: false, transformFunction: null }, showCaption: { classPropertyName: "showCaption", publicName: "showCaption", isSignal: true, isRequired: false, transformFunction: null }, clickTriggered: { classPropertyName: "clickTriggered", publicName: "clickTriggered", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "tooltip" }, properties: { "class.ap-predefined-tooltip": "!isDefaultType()", "class.ap-tooltip-custom-template": "hasTemplate()", "class.ap-tooltip-click-trigger": "!isDefaultType() && clickTriggered()" }, classAttribute: "ap-tooltip" }, ngImport: i0, template: "<div\n class=\"ap-content-container\"\n [class.ap-content-predefined-container]=\"!isDefaultType()\">\n <!-- No arrow here: the engine draws it as the pane's `::before`, out of the accessibility tree. -->\n @if (isDefaultType()) {\n @if (template(); as content) {\n <div class=\"ap-tooltip-text\">\n <ng-container\n [ngTemplateOutlet]=\"content\"\n [ngTemplateOutletContext]=\"templateContext() ?? null\" />\n </div>\n } @else {\n <div\n class=\"ap-tooltip-text\"\n [innerHTML]=\"sanitizedText()\"></div>\n }\n } @else {\n <ap-tooltip\n [type]=\"type()\"\n [presentationContext]=\"presentationContext()\"\n [tooltipListItems]=\"listItems()\"\n [showCaption]=\"showCaption()\" />\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TooltipComponent, selector: "ap-tooltip", inputs: ["type", "presentationContext", "tooltipListItems", "showCaption"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
125
147
|
}
|
|
126
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type:
|
|
127
|
-
type:
|
|
128
|
-
|
|
148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipPanelComponent, decorators: [{
|
|
149
|
+
type: Component,
|
|
150
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-tooltip-panel', imports: [NgTemplateOutlet, TooltipComponent], encapsulation: ViewEncapsulation.None, host: {
|
|
151
|
+
role: 'tooltip',
|
|
152
|
+
class: 'ap-tooltip',
|
|
153
|
+
'[class.ap-predefined-tooltip]': '!isDefaultType()',
|
|
154
|
+
'[class.ap-tooltip-custom-template]': 'hasTemplate()',
|
|
155
|
+
'[class.ap-tooltip-click-trigger]': '!isDefaultType() && clickTriggered()',
|
|
156
|
+
}, template: "<div\n class=\"ap-content-container\"\n [class.ap-content-predefined-container]=\"!isDefaultType()\">\n <!-- No arrow here: the engine draws it as the pane's `::before`, out of the accessibility tree. -->\n @if (isDefaultType()) {\n @if (template(); as content) {\n <div class=\"ap-tooltip-text\">\n <ng-container\n [ngTemplateOutlet]=\"content\"\n [ngTemplateOutletContext]=\"templateContext() ?? null\" />\n </div>\n } @else {\n <div\n class=\"ap-tooltip-text\"\n [innerHTML]=\"sanitizedText()\"></div>\n }\n } @else {\n <ap-tooltip\n [type]=\"type()\"\n [presentationContext]=\"presentationContext()\"\n [tooltipListItems]=\"listItems()\"\n [showCaption]=\"showCaption()\" />\n }\n</div>\n" }]
|
|
157
|
+
}], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: false }] }], templateContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "templateContext", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], presentationContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "presentationContext", required: false }] }], listItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "listItems", required: false }] }], showCaption: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCaption", required: false }] }], clickTriggered: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickTriggered", required: false }] }] } });
|
|
129
158
|
|
|
130
159
|
class TooltipDirective {
|
|
131
160
|
elementRef = inject(ElementRef);
|
|
132
161
|
zone = inject(NgZone);
|
|
133
|
-
viewContainerRef = inject(ViewContainerRef);
|
|
134
162
|
destroyRef = inject(DestroyRef);
|
|
135
|
-
|
|
136
|
-
|
|
163
|
+
/** Decides where the tooltip goes — flip, shift, scroll following, arrow; this directive only decides when. */
|
|
164
|
+
overlay = createFloatingOverlay();
|
|
137
165
|
apTooltip = input.required(/* @ts-ignore */
|
|
138
166
|
...(ngDevMode ? [{ debugName: "apTooltip" }] : /* istanbul ignore next */ []));
|
|
167
|
+
/** Where the panel opens, in the engine's vocabulary. */
|
|
139
168
|
apTooltipPosition = input('top', /* @ts-ignore */
|
|
140
169
|
...(ngDevMode ? [{ debugName: "apTooltipPosition" }] : /* istanbul ignore next */ []));
|
|
141
170
|
apTooltipShowDelay = input(80, /* @ts-ignore */
|
|
@@ -154,6 +183,9 @@ class TooltipDirective {
|
|
|
154
183
|
...(ngDevMode ? [undefined, { debugName: "apTooltipVirtualScrollElement" }] : /* istanbul ignore next */ []));
|
|
155
184
|
apTooltipTrigger = input('hover', /* @ts-ignore */
|
|
156
185
|
...(ngDevMode ? [{ debugName: "apTooltipTrigger" }] : /* istanbul ignore next */ []));
|
|
186
|
+
/** Shows the arrow aimed at the trigger. */
|
|
187
|
+
apTooltipArrow = input(true, /* @ts-ignore */
|
|
188
|
+
...(ngDevMode ? [{ debugName: "apTooltipArrow" }] : /* istanbul ignore next */ []));
|
|
157
189
|
// Predefined template variables
|
|
158
190
|
apTooltipType = input(CustomTooltipType.DEFAULT, /* @ts-ignore */
|
|
159
191
|
...(ngDevMode ? [{ debugName: "apTooltipType" }] : /* istanbul ignore next */ []));
|
|
@@ -172,15 +204,38 @@ class TooltipDirective {
|
|
|
172
204
|
...(ngDevMode ? [{ debugName: "isValidPredefinedTooltip" }] : /* istanbul ignore next */ []));
|
|
173
205
|
triggeredByClick = computed(() => this.apTooltipTrigger() === 'click' || this.externallyTriggerred, /* @ts-ignore */
|
|
174
206
|
...(ngDevMode ? [{ debugName: "triggeredByClick" }] : /* istanbul ignore next */ []));
|
|
207
|
+
/** True while the panel is attached — not yet during the show delay. */
|
|
208
|
+
isOpen = this.overlay.isOpen;
|
|
175
209
|
clickListener = undefined;
|
|
176
|
-
container = undefined;
|
|
177
210
|
hideTimeout;
|
|
178
211
|
mouseEnterListener = undefined;
|
|
179
212
|
mouseLeaveListener = undefined;
|
|
180
213
|
nativeElement = this.elementRef.nativeElement;
|
|
181
214
|
showTimeout;
|
|
182
|
-
tooltipText;
|
|
183
215
|
_externallyTriggerred = false;
|
|
216
|
+
panelRef = null;
|
|
217
|
+
/** Where the opening click landed, in viewport coordinates; `null` after a keyboard click. */
|
|
218
|
+
clickPoint = null;
|
|
219
|
+
/** The pointer while a click-opened tooltip is shown; `null` while unknown. */
|
|
220
|
+
pointer = null;
|
|
221
|
+
stopScrollDismissal = null;
|
|
222
|
+
/** `apTooltipExternalTrigger` elements: they carry their own toggle, so the engine must not count them as the outside. */
|
|
223
|
+
externalTriggers = new Set();
|
|
224
|
+
/** @internal Called by `apTooltipExternalTrigger`. */
|
|
225
|
+
registerExternalTrigger(element) {
|
|
226
|
+
this.externalTriggers.add(element);
|
|
227
|
+
}
|
|
228
|
+
/** @internal Called by `apTooltipExternalTrigger`. */
|
|
229
|
+
unregisterExternalTrigger(element) {
|
|
230
|
+
this.externalTriggers.delete(element);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The `.ap-tooltip` surface while one is shown.
|
|
234
|
+
* @deprecated Use {@link isOpen} to know whether a tooltip is shown.
|
|
235
|
+
*/
|
|
236
|
+
get container() {
|
|
237
|
+
return this.panelRef?.location.nativeElement;
|
|
238
|
+
}
|
|
184
239
|
ngOnInit() {
|
|
185
240
|
const apTooltipVirtualScrollElement = this.apTooltipVirtualScrollElement();
|
|
186
241
|
if (apTooltipVirtualScrollElement) {
|
|
@@ -196,7 +251,7 @@ class TooltipDirective {
|
|
|
196
251
|
}
|
|
197
252
|
setupEventListeners(trigger) {
|
|
198
253
|
// Close any open tooltip when switching modes
|
|
199
|
-
if (this.
|
|
254
|
+
if (this.isOpen()) {
|
|
200
255
|
this.remove();
|
|
201
256
|
}
|
|
202
257
|
this.cleanupEventListeners();
|
|
@@ -226,13 +281,13 @@ class TooltipDirective {
|
|
|
226
281
|
}
|
|
227
282
|
}
|
|
228
283
|
ngOnDestroy() {
|
|
229
|
-
if (this.
|
|
284
|
+
if (this.isOpen()) {
|
|
230
285
|
this.deactivate();
|
|
231
286
|
}
|
|
232
287
|
this.cleanupEventListeners();
|
|
233
288
|
}
|
|
234
289
|
onMouseEnter() {
|
|
235
|
-
if (!this.
|
|
290
|
+
if (!this.isOpen()) {
|
|
236
291
|
this.activate();
|
|
237
292
|
}
|
|
238
293
|
}
|
|
@@ -241,14 +296,16 @@ class TooltipDirective {
|
|
|
241
296
|
this.deactivate();
|
|
242
297
|
}
|
|
243
298
|
}
|
|
244
|
-
onInputClick() {
|
|
299
|
+
onInputClick(event) {
|
|
245
300
|
this.zone.run(() => {
|
|
246
301
|
const trigger = this.apTooltipTrigger();
|
|
247
302
|
if (trigger === 'click') {
|
|
248
|
-
if (this.
|
|
303
|
+
if (this.isOpen()) {
|
|
249
304
|
this.deactivate();
|
|
250
305
|
}
|
|
251
306
|
else {
|
|
307
|
+
// A click synthesised from the keyboard has `detail: 0` and sits at `(0, 0)`.
|
|
308
|
+
this.clickPoint = event && event.detail > 0 ? { x: event.clientX, y: event.clientY } : null;
|
|
252
309
|
this.activate();
|
|
253
310
|
}
|
|
254
311
|
}
|
|
@@ -259,9 +316,6 @@ class TooltipDirective {
|
|
|
259
316
|
}
|
|
260
317
|
activate() {
|
|
261
318
|
this.clearHideTimeout();
|
|
262
|
-
if (this.triggeredByClick()) {
|
|
263
|
-
this.addDocumentClickListener();
|
|
264
|
-
}
|
|
265
319
|
if (this.apTooltipShowDelay()) {
|
|
266
320
|
this.showTimeout = window.setTimeout(() => {
|
|
267
321
|
this.show();
|
|
@@ -279,7 +333,6 @@ class TooltipDirective {
|
|
|
279
333
|
}
|
|
280
334
|
deactivate() {
|
|
281
335
|
this.clearShowTimeout();
|
|
282
|
-
this.removeDocumentClickListener();
|
|
283
336
|
if (this.apTooltipHideDelay()) {
|
|
284
337
|
this.clearHideTimeout();
|
|
285
338
|
this.hideTimeout = window.setTimeout(() => {
|
|
@@ -305,294 +358,101 @@ class TooltipDirective {
|
|
|
305
358
|
return;
|
|
306
359
|
}
|
|
307
360
|
this.create();
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
361
|
+
}
|
|
362
|
+
remove() {
|
|
363
|
+
this.stopScrollDismissal?.();
|
|
364
|
+
this.overlay.close();
|
|
365
|
+
this.panelRef = null;
|
|
366
|
+
this.clearTimeouts();
|
|
367
|
+
this._externallyTriggerred = false;
|
|
312
368
|
}
|
|
313
369
|
create() {
|
|
314
|
-
if (this.
|
|
370
|
+
if (this.isOpen()) {
|
|
315
371
|
this.clearHideTimeout();
|
|
316
372
|
this.remove();
|
|
317
373
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
this.
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
this.
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
// Set inputs
|
|
346
|
-
componentRef.setInput('type', this.apTooltipType());
|
|
347
|
-
componentRef.setInput('presentationContext', this.apTooltipPresentationContext());
|
|
348
|
-
componentRef.setInput('tooltipListItems', this.apTooltipListItems());
|
|
349
|
-
componentRef.setInput('showCaption', this.apTooltipShowAvatarCaption());
|
|
350
|
-
// Force change detection to render the component immediately
|
|
351
|
-
componentRef.changeDetectorRef.detectChanges();
|
|
352
|
-
this.container = document.createElement('div');
|
|
353
|
-
this.container.setAttribute('role', 'tooltip');
|
|
354
|
-
const contentContainer = document.createElement('div');
|
|
355
|
-
contentContainer.classList.add('ap-content-container', 'ap-content-predefined-container');
|
|
356
|
-
contentContainer.appendChild(componentRef.location.nativeElement);
|
|
357
|
-
contentContainer.appendChild(this.createSvgElement());
|
|
358
|
-
this.container.appendChild(contentContainer);
|
|
359
|
-
document.body.appendChild(this.container);
|
|
360
|
-
this.container.classList.add('ap-tooltip', 'ap-predefined-tooltip');
|
|
361
|
-
if (this.triggeredByClick()) {
|
|
362
|
-
this.container.classList.add('ap-tooltip-click-trigger');
|
|
363
|
-
}
|
|
364
|
-
// Has to wait for the TooltipComponent to be rendered in order to align and then set the CSS variable --ap-tooltip-height
|
|
365
|
-
requestAnimationFrame(() => {
|
|
366
|
-
this.align();
|
|
367
|
-
this.setCssVariables();
|
|
374
|
+
// Entered on purpose: hover is listened for outside the zone, where the panel's inputs would never render.
|
|
375
|
+
this.zone.run(() => {
|
|
376
|
+
const content = this.apTooltip();
|
|
377
|
+
const isTemplate = this.isDefaultTooltipType() && content instanceof TemplateRef;
|
|
378
|
+
this.panelRef = this.overlay.open(TooltipPanelComponent, this.nativeElement, {
|
|
379
|
+
placement: this.apTooltipPosition(),
|
|
380
|
+
arrow: this.apTooltipArrow(),
|
|
381
|
+
panelClass: this.paneClasses(isTemplate),
|
|
382
|
+
// Explicit dismissals skip the hide delay, which only exists to cross the gap to the panel.
|
|
383
|
+
onClose: () => this.zone.run(() => this.remove()),
|
|
384
|
+
additionalTriggers: () => [...this.externalTriggers],
|
|
385
|
+
});
|
|
386
|
+
if (!this.panelRef) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
this.panelRef.setInput('text', content instanceof TemplateRef ? undefined : (content ?? undefined));
|
|
390
|
+
this.panelRef.setInput('template', isTemplate ? content : undefined);
|
|
391
|
+
this.panelRef.setInput('templateContext', this.apTooltipTemplateContext());
|
|
392
|
+
this.panelRef.setInput('type', this.apTooltipType());
|
|
393
|
+
this.panelRef.setInput('presentationContext', this.apTooltipPresentationContext());
|
|
394
|
+
this.panelRef.setInput('listItems', this.apTooltipListItems());
|
|
395
|
+
this.panelRef.setInput('showCaption', this.apTooltipShowAvatarCaption());
|
|
396
|
+
this.panelRef.setInput('clickTriggered', this.triggeredByClick());
|
|
397
|
+
// Render synchronously, then re-place: `attach()` measured an empty box, and background tabs stall timers and rAF.
|
|
398
|
+
this.panelRef.changeDetectorRef.detectChanges();
|
|
399
|
+
this.overlay.updatePosition();
|
|
400
|
+
this.listenForScrollDismissal();
|
|
368
401
|
});
|
|
369
402
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
path.setAttribute('d', 'M6.68299 1.15238C7.43705 0.492586 8.56296 0.492588 9.31701 1.15238L16 7L0 7L6.68299 1.15238Z');
|
|
379
|
-
arrowSvg.appendChild(path);
|
|
380
|
-
return arrowSvg;
|
|
381
|
-
}
|
|
382
|
-
align() {
|
|
383
|
-
switch (this.apTooltipPosition()) {
|
|
384
|
-
case 'top-left':
|
|
385
|
-
this.alignTopLeft();
|
|
386
|
-
if (this.isOutOfBounds()) {
|
|
387
|
-
this.alignBottom();
|
|
388
|
-
if (this.isOutOfBounds()) {
|
|
389
|
-
this.alignRight();
|
|
390
|
-
if (this.isOutOfBounds()) {
|
|
391
|
-
this.alignLeft();
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
break;
|
|
396
|
-
case 'top-right':
|
|
397
|
-
this.alignTopRight();
|
|
398
|
-
if (this.isOutOfBounds()) {
|
|
399
|
-
this.alignBottom();
|
|
400
|
-
if (this.isOutOfBounds()) {
|
|
401
|
-
this.alignRight();
|
|
402
|
-
if (this.isOutOfBounds()) {
|
|
403
|
-
this.alignLeft();
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
break;
|
|
408
|
-
case 'top':
|
|
409
|
-
this.alignTop();
|
|
410
|
-
if (this.isOutOfBounds()) {
|
|
411
|
-
this.alignBottom();
|
|
412
|
-
if (this.isOutOfBounds()) {
|
|
413
|
-
this.alignRight();
|
|
414
|
-
if (this.isOutOfBounds()) {
|
|
415
|
-
this.alignLeft();
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
break;
|
|
420
|
-
case 'bottom':
|
|
421
|
-
this.alignBottom();
|
|
422
|
-
if (this.isOutOfBounds()) {
|
|
423
|
-
this.alignTop();
|
|
424
|
-
if (this.isOutOfBounds()) {
|
|
425
|
-
this.alignRight();
|
|
426
|
-
if (this.isOutOfBounds()) {
|
|
427
|
-
this.alignLeft();
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
break;
|
|
432
|
-
case 'bottom-left':
|
|
433
|
-
this.alignBottomLeft();
|
|
434
|
-
if (this.isOutOfBounds()) {
|
|
435
|
-
this.alignTop();
|
|
436
|
-
if (this.isOutOfBounds()) {
|
|
437
|
-
this.alignRight();
|
|
438
|
-
if (this.isOutOfBounds()) {
|
|
439
|
-
this.alignLeft();
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
break;
|
|
444
|
-
case 'bottom-right':
|
|
445
|
-
this.alignBottomRight();
|
|
446
|
-
if (this.isOutOfBounds()) {
|
|
447
|
-
this.alignTop();
|
|
448
|
-
if (this.isOutOfBounds()) {
|
|
449
|
-
this.alignRight();
|
|
450
|
-
if (this.isOutOfBounds()) {
|
|
451
|
-
this.alignLeft();
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
break;
|
|
456
|
-
case 'left':
|
|
457
|
-
this.alignLeft();
|
|
458
|
-
if (this.isOutOfBounds()) {
|
|
459
|
-
this.alignRight();
|
|
460
|
-
if (this.isOutOfBounds()) {
|
|
461
|
-
this.alignTop();
|
|
462
|
-
if (this.isOutOfBounds()) {
|
|
463
|
-
this.alignBottom();
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
break;
|
|
468
|
-
case 'right':
|
|
469
|
-
this.alignRight();
|
|
470
|
-
if (this.isOutOfBounds()) {
|
|
471
|
-
this.alignLeft();
|
|
472
|
-
if (this.isOutOfBounds()) {
|
|
473
|
-
this.alignTop();
|
|
474
|
-
if (this.isOutOfBounds()) {
|
|
475
|
-
this.alignBottom();
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
break;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
alignRight() {
|
|
483
|
-
this.preAlign('right');
|
|
484
|
-
if (this.container) {
|
|
485
|
-
const hostOffset = this.getHostOffset();
|
|
486
|
-
const left = hostOffset.left + TooltipService.getOuterWidth(this.nativeElement) + TooltipService.defaultOffset;
|
|
487
|
-
const top = hostOffset.top + (TooltipService.getOuterHeight(this.nativeElement) - TooltipService.getOuterHeight(this.container)) / 2;
|
|
488
|
-
this.container.style.left = left + 'px';
|
|
489
|
-
this.container.style.top = top + 'px';
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
alignLeft() {
|
|
493
|
-
this.preAlign('left');
|
|
494
|
-
if (this.container) {
|
|
495
|
-
const hostOffset = this.getHostOffset();
|
|
496
|
-
const left = hostOffset.left - TooltipService.getOuterWidth(this.container) - TooltipService.defaultOffset;
|
|
497
|
-
const top = hostOffset.top + (TooltipService.getOuterHeight(this.nativeElement) - TooltipService.getOuterHeight(this.container)) / 2;
|
|
498
|
-
this.container.style.left = left + 'px';
|
|
499
|
-
this.container.style.top = top + 'px';
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
alignTop() {
|
|
503
|
-
this.preAlign('top');
|
|
504
|
-
if (this.container) {
|
|
505
|
-
const hostOffset = this.getHostOffset();
|
|
506
|
-
const left = hostOffset.left + (TooltipService.getOuterWidth(this.nativeElement) - TooltipService.getOuterWidth(this.container)) / 2;
|
|
507
|
-
const top = hostOffset.top - TooltipService.getOuterHeight(this.container) - TooltipService.defaultOffset;
|
|
508
|
-
this.container.style.left = left + 'px';
|
|
509
|
-
this.container.style.top = top + 'px';
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
alignTopLeft() {
|
|
513
|
-
this.preAlign('top-left');
|
|
514
|
-
if (this.container) {
|
|
515
|
-
const hostOffset = this.getHostOffset();
|
|
516
|
-
const left = hostOffset.left;
|
|
517
|
-
const top = hostOffset.top - TooltipService.getOuterHeight(this.container) - TooltipService.defaultOffset;
|
|
518
|
-
this.container.style.left = left + 'px';
|
|
519
|
-
this.container.style.top = top + 'px';
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
alignTopRight() {
|
|
523
|
-
this.preAlign('top-right');
|
|
524
|
-
if (this.container) {
|
|
525
|
-
const hostOffset = this.getHostOffset();
|
|
526
|
-
const left = hostOffset.left + TooltipService.getOuterWidth(this.nativeElement) - TooltipService.getOuterWidth(this.container);
|
|
527
|
-
const top = hostOffset.top - TooltipService.getOuterHeight(this.container) - TooltipService.defaultOffset;
|
|
528
|
-
this.container.style.left = left + 'px';
|
|
529
|
-
this.container.style.top = top + 'px';
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
alignBottom() {
|
|
533
|
-
this.preAlign('bottom');
|
|
534
|
-
if (this.container) {
|
|
535
|
-
const hostOffset = this.getHostOffset();
|
|
536
|
-
const left = hostOffset.left + (TooltipService.getOuterWidth(this.nativeElement) - TooltipService.getOuterWidth(this.container)) / 2;
|
|
537
|
-
const top = hostOffset.top + TooltipService.getOuterHeight(this.nativeElement) + TooltipService.defaultOffset;
|
|
538
|
-
this.container.style.left = left + 'px';
|
|
539
|
-
this.container.style.top = top + 'px';
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
alignBottomLeft() {
|
|
543
|
-
this.preAlign('bottom-left');
|
|
544
|
-
if (this.container) {
|
|
545
|
-
const hostOffset = this.getHostOffset();
|
|
546
|
-
const left = hostOffset.left;
|
|
547
|
-
const top = hostOffset.top + TooltipService.getOuterHeight(this.nativeElement) + TooltipService.defaultOffset;
|
|
548
|
-
this.container.style.left = left + 'px';
|
|
549
|
-
this.container.style.top = top + 'px';
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
alignBottomRight() {
|
|
553
|
-
this.preAlign('bottom-right');
|
|
554
|
-
if (this.container) {
|
|
555
|
-
const hostOffset = this.getHostOffset();
|
|
556
|
-
const left = hostOffset.left + (TooltipService.getOuterWidth(this.nativeElement) - TooltipService.getOuterWidth(this.container));
|
|
557
|
-
const top = hostOffset.top + TooltipService.getOuterHeight(this.nativeElement) + TooltipService.defaultOffset;
|
|
558
|
-
this.container.style.left = left + 'px';
|
|
559
|
-
this.container.style.top = top + 'px';
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
preAlign(position) {
|
|
563
|
-
this.removePreviousAlignHtmlClasses();
|
|
564
|
-
if (this.container) {
|
|
565
|
-
this.container.style.left = -999 + 'px';
|
|
566
|
-
this.container.style.top = -999 + 'px';
|
|
567
|
-
const defaultClassName = 'ap-tooltip-' + position;
|
|
568
|
-
this.container.classList.add(defaultClassName);
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
getHostOffset() {
|
|
572
|
-
const offset = this.nativeElement.getBoundingClientRect();
|
|
573
|
-
return { left: offset.left, top: offset.top };
|
|
574
|
-
}
|
|
575
|
-
isOutOfBounds() {
|
|
576
|
-
if (this.container) {
|
|
577
|
-
const offset = this.container.getBoundingClientRect();
|
|
578
|
-
const targetTop = offset.top;
|
|
579
|
-
const targetLeft = offset.left;
|
|
580
|
-
const width = TooltipService.getOuterWidth(this.container);
|
|
581
|
-
const height = TooltipService.getOuterHeight(this.container);
|
|
582
|
-
const viewport = TooltipService.getViewport();
|
|
583
|
-
return targetLeft + width > viewport.width || targetLeft < 0 || targetTop < 0 || targetTop + height > viewport.height;
|
|
403
|
+
/**
|
|
404
|
+
* A click-opened tooltip closes on scroll once the pointer is off its trigger; an unknown pointer counts as off.
|
|
405
|
+
* A scroll inside the panel never closes it. The trigger's box is measured, since browsers freeze `:hover` while scrolling.
|
|
406
|
+
*/
|
|
407
|
+
listenForScrollDismissal() {
|
|
408
|
+
// Not `triggeredByClick()`: that `computed` reads the non-signal `externallyTriggerred` and can go stale.
|
|
409
|
+
if (this.apTooltipTrigger() !== 'click' && !this._externallyTriggerred) {
|
|
410
|
+
return;
|
|
584
411
|
}
|
|
585
|
-
|
|
412
|
+
const pane = this.overlay.overlayRef?.overlayElement;
|
|
413
|
+
this.pointer = this.clickPoint;
|
|
414
|
+
this.clickPoint = null;
|
|
415
|
+
const onPointer = (event) => {
|
|
416
|
+
this.pointer = { x: event.clientX, y: event.clientY };
|
|
417
|
+
};
|
|
418
|
+
const onScroll = (event) => {
|
|
419
|
+
const target = event.target;
|
|
420
|
+
if (pane && target instanceof Node && pane.contains(target)) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
if (!this.isPointerOnTrigger()) {
|
|
424
|
+
this.zone.run(() => this.remove());
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
this.zone.runOutsideAngular(() => {
|
|
428
|
+
document.addEventListener('pointermove', onPointer, { capture: true, passive: true });
|
|
429
|
+
document.addEventListener('pointerdown', onPointer, { capture: true, passive: true });
|
|
430
|
+
document.addEventListener('scroll', onScroll, { capture: true, passive: true });
|
|
431
|
+
});
|
|
432
|
+
this.stopScrollDismissal = () => {
|
|
433
|
+
document.removeEventListener('pointermove', onPointer, { capture: true });
|
|
434
|
+
document.removeEventListener('pointerdown', onPointer, { capture: true });
|
|
435
|
+
document.removeEventListener('scroll', onScroll, { capture: true });
|
|
436
|
+
this.stopScrollDismissal = null;
|
|
437
|
+
this.pointer = null;
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
isPointerOnTrigger() {
|
|
441
|
+
const pointer = this.pointer;
|
|
442
|
+
if (!pointer) {
|
|
586
443
|
return false;
|
|
587
444
|
}
|
|
445
|
+
return [this.nativeElement, ...this.externalTriggers].some(element => {
|
|
446
|
+
const box = element.getBoundingClientRect();
|
|
447
|
+
return pointer.x >= box.left && pointer.x <= box.right && pointer.y >= box.top && pointer.y <= box.bottom;
|
|
448
|
+
});
|
|
588
449
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
450
|
+
/** Pane classes: each of the three surfaces gives panel and tip a different shadow. */
|
|
451
|
+
paneClasses(isTemplate) {
|
|
452
|
+
if (!this.isDefaultTooltipType()) {
|
|
453
|
+
return ['ap-tooltip-pane', 'predefined'];
|
|
592
454
|
}
|
|
593
|
-
|
|
594
|
-
this._externallyTriggerred = false;
|
|
595
|
-
this.container = undefined;
|
|
455
|
+
return isTemplate ? ['ap-tooltip-pane', 'custom-template'] : ['ap-tooltip-pane'];
|
|
596
456
|
}
|
|
597
457
|
clearShowTimeout() {
|
|
598
458
|
if (this.showTimeout) {
|
|
@@ -610,58 +470,6 @@ class TooltipDirective {
|
|
|
610
470
|
this.clearShowTimeout();
|
|
611
471
|
this.clearHideTimeout();
|
|
612
472
|
}
|
|
613
|
-
updateText() {
|
|
614
|
-
const apTooltip = this.apTooltip();
|
|
615
|
-
if (apTooltip instanceof TemplateRef) {
|
|
616
|
-
const embeddedViewRef = this.viewContainerRef.createEmbeddedView(apTooltip);
|
|
617
|
-
embeddedViewRef.context = this.apTooltipTemplateContext();
|
|
618
|
-
embeddedViewRef.detectChanges();
|
|
619
|
-
embeddedViewRef.rootNodes.forEach(node => this.tooltipText?.appendChild(node));
|
|
620
|
-
}
|
|
621
|
-
else if (this.tooltipText) {
|
|
622
|
-
this.tooltipText.innerHTML = apTooltip ? DOMPurify.sanitize(apTooltip) : '';
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
setCssVariables() {
|
|
626
|
-
if (this.container) {
|
|
627
|
-
this.container.style.setProperty('--ap-tooltip-height', this.container.offsetHeight + 'px');
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
removePreviousAlignHtmlClasses() {
|
|
631
|
-
if (this.container) {
|
|
632
|
-
this.container.classList.remove('ap-tooltip-top', 'ap-tooltip-top-left', 'ap-tooltip-top-right', 'ap-tooltip-bottom', 'ap-tooltip-bottom-left', 'ap-tooltip-bottom-right', 'ap-tooltip-left', 'ap-tooltip-right');
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
addDocumentClickListener() {
|
|
636
|
-
if (this.documentClickListener)
|
|
637
|
-
return;
|
|
638
|
-
this.zone.runOutsideAngular(() => {
|
|
639
|
-
this.documentClickListener = (event) => {
|
|
640
|
-
const target = event.target;
|
|
641
|
-
if (this.container && !this.container.contains(target) && !this.nativeElement.contains(target)) {
|
|
642
|
-
this.deactivate();
|
|
643
|
-
}
|
|
644
|
-
};
|
|
645
|
-
this.documentScrollListener = (event) => {
|
|
646
|
-
const target = event.target;
|
|
647
|
-
if (this.container && !(target instanceof Node && this.container.contains(target))) {
|
|
648
|
-
this.deactivate();
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
document.addEventListener('click', this.documentClickListener);
|
|
652
|
-
document.addEventListener('scroll', this.documentScrollListener, { capture: true, passive: true });
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
removeDocumentClickListener() {
|
|
656
|
-
if (!this.documentClickListener)
|
|
657
|
-
return;
|
|
658
|
-
document.removeEventListener('click', this.documentClickListener);
|
|
659
|
-
this.documentClickListener = undefined;
|
|
660
|
-
if (this.documentScrollListener) {
|
|
661
|
-
document.removeEventListener('scroll', this.documentScrollListener, { capture: true });
|
|
662
|
-
this.documentScrollListener = undefined;
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
473
|
get externallyTriggerred() {
|
|
666
474
|
return this._externallyTriggerred;
|
|
667
475
|
}
|
|
@@ -669,16 +477,16 @@ class TooltipDirective {
|
|
|
669
477
|
this._externallyTriggerred = value;
|
|
670
478
|
}
|
|
671
479
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
672
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TooltipDirective, isStandalone: true, selector: "[apTooltip]", inputs: { apTooltip: { classPropertyName: "apTooltip", publicName: "apTooltip", isSignal: true, isRequired: true, transformFunction: null }, apTooltipPosition: { classPropertyName: "apTooltipPosition", publicName: "apTooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, apTooltipShowDelay: { classPropertyName: "apTooltipShowDelay", publicName: "apTooltipShowDelay", isSignal: true, isRequired: false, transformFunction: null }, apTooltipHideDelay: { classPropertyName: "apTooltipHideDelay", publicName: "apTooltipHideDelay", isSignal: true, isRequired: false, transformFunction: null }, apTooltipDuration: { classPropertyName: "apTooltipDuration", publicName: "apTooltipDuration", isSignal: true, isRequired: false, transformFunction: null }, apTooltipDisabled: { classPropertyName: "apTooltipDisabled", publicName: "apTooltipDisabled", isSignal: true, isRequired: false, transformFunction: null }, apTooltipTruncatedTextOnly: { classPropertyName: "apTooltipTruncatedTextOnly", publicName: "apTooltipTruncatedTextOnly", isSignal: true, isRequired: false, transformFunction: null }, apTooltipTemplateContext: { classPropertyName: "apTooltipTemplateContext", publicName: "apTooltipTemplateContext", isSignal: true, isRequired: false, transformFunction: null }, apTooltipVirtualScrollElement: { classPropertyName: "apTooltipVirtualScrollElement", publicName: "apTooltipVirtualScrollElement", isSignal: true, isRequired: false, transformFunction: null }, apTooltipTrigger: { classPropertyName: "apTooltipTrigger", publicName: "apTooltipTrigger", isSignal: true, isRequired: false, transformFunction: null }, apTooltipType: { classPropertyName: "apTooltipType", publicName: "apTooltipType", isSignal: true, isRequired: false, transformFunction: null }, apTooltipPresentationContext: { classPropertyName: "apTooltipPresentationContext", publicName: "apTooltipPresentationContext", isSignal: true, isRequired: false, transformFunction: null }, apTooltipListItems: { classPropertyName: "apTooltipListItems", publicName: "apTooltipListItems", isSignal: true, isRequired: false, transformFunction: null }, apTooltipShowAvatarCaption: { classPropertyName: "apTooltipShowAvatarCaption", publicName: "apTooltipShowAvatarCaption", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["apTooltip"], ngImport: i0 });
|
|
480
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TooltipDirective, isStandalone: true, selector: "[apTooltip]", inputs: { apTooltip: { classPropertyName: "apTooltip", publicName: "apTooltip", isSignal: true, isRequired: true, transformFunction: null }, apTooltipPosition: { classPropertyName: "apTooltipPosition", publicName: "apTooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, apTooltipShowDelay: { classPropertyName: "apTooltipShowDelay", publicName: "apTooltipShowDelay", isSignal: true, isRequired: false, transformFunction: null }, apTooltipHideDelay: { classPropertyName: "apTooltipHideDelay", publicName: "apTooltipHideDelay", isSignal: true, isRequired: false, transformFunction: null }, apTooltipDuration: { classPropertyName: "apTooltipDuration", publicName: "apTooltipDuration", isSignal: true, isRequired: false, transformFunction: null }, apTooltipDisabled: { classPropertyName: "apTooltipDisabled", publicName: "apTooltipDisabled", isSignal: true, isRequired: false, transformFunction: null }, apTooltipTruncatedTextOnly: { classPropertyName: "apTooltipTruncatedTextOnly", publicName: "apTooltipTruncatedTextOnly", isSignal: true, isRequired: false, transformFunction: null }, apTooltipTemplateContext: { classPropertyName: "apTooltipTemplateContext", publicName: "apTooltipTemplateContext", isSignal: true, isRequired: false, transformFunction: null }, apTooltipVirtualScrollElement: { classPropertyName: "apTooltipVirtualScrollElement", publicName: "apTooltipVirtualScrollElement", isSignal: true, isRequired: false, transformFunction: null }, apTooltipTrigger: { classPropertyName: "apTooltipTrigger", publicName: "apTooltipTrigger", isSignal: true, isRequired: false, transformFunction: null }, apTooltipArrow: { classPropertyName: "apTooltipArrow", publicName: "apTooltipArrow", isSignal: true, isRequired: false, transformFunction: null }, apTooltipType: { classPropertyName: "apTooltipType", publicName: "apTooltipType", isSignal: true, isRequired: false, transformFunction: null }, apTooltipPresentationContext: { classPropertyName: "apTooltipPresentationContext", publicName: "apTooltipPresentationContext", isSignal: true, isRequired: false, transformFunction: null }, apTooltipListItems: { classPropertyName: "apTooltipListItems", publicName: "apTooltipListItems", isSignal: true, isRequired: false, transformFunction: null }, apTooltipShowAvatarCaption: { classPropertyName: "apTooltipShowAvatarCaption", publicName: "apTooltipShowAvatarCaption", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["apTooltip"], ngImport: i0 });
|
|
673
481
|
}
|
|
674
482
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipDirective, decorators: [{
|
|
675
483
|
type: Directive,
|
|
676
484
|
args: [{ selector: '[apTooltip]', standalone: true, exportAs: 'apTooltip' }]
|
|
677
|
-
}], propDecorators: { apTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltip", required: true }] }], apTooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipPosition", required: false }] }], apTooltipShowDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipShowDelay", required: false }] }], apTooltipHideDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipHideDelay", required: false }] }], apTooltipDuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipDuration", required: false }] }], apTooltipDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipDisabled", required: false }] }], apTooltipTruncatedTextOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipTruncatedTextOnly", required: false }] }], apTooltipTemplateContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipTemplateContext", required: false }] }], apTooltipVirtualScrollElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipVirtualScrollElement", required: false }] }], apTooltipTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipTrigger", required: false }] }], apTooltipType: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipType", required: false }] }], apTooltipPresentationContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipPresentationContext", required: false }] }], apTooltipListItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipListItems", required: false }] }], apTooltipShowAvatarCaption: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipShowAvatarCaption", required: false }] }] } });
|
|
485
|
+
}], propDecorators: { apTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltip", required: true }] }], apTooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipPosition", required: false }] }], apTooltipShowDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipShowDelay", required: false }] }], apTooltipHideDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipHideDelay", required: false }] }], apTooltipDuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipDuration", required: false }] }], apTooltipDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipDisabled", required: false }] }], apTooltipTruncatedTextOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipTruncatedTextOnly", required: false }] }], apTooltipTemplateContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipTemplateContext", required: false }] }], apTooltipVirtualScrollElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipVirtualScrollElement", required: false }] }], apTooltipTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipTrigger", required: false }] }], apTooltipArrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipArrow", required: false }] }], apTooltipType: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipType", required: false }] }], apTooltipPresentationContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipPresentationContext", required: false }] }], apTooltipListItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipListItems", required: false }] }], apTooltipShowAvatarCaption: [{ type: i0.Input, args: [{ isSignal: true, alias: "apTooltipShowAvatarCaption", required: false }] }] } });
|
|
678
486
|
|
|
679
487
|
/**
|
|
680
488
|
* Generated bundle index. Do not edit.
|
|
681
489
|
*/
|
|
682
490
|
|
|
683
|
-
export { CustomTooltipType, TooltipDirective, TooltipExternalTriggerDirective };
|
|
491
|
+
export { CustomTooltipType, TooltipDirective, TooltipExternalTriggerDirective, TooltipPanelComponent };
|
|
684
492
|
//# sourceMappingURL=agorapulse-ui-components-tooltip.mjs.map
|