@agorapulse/ui-components 22.2.6 → 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 -361
- package/fesm2022/agorapulse-ui-components-tooltip.mjs.map +1 -1
- package/package.json +1 -1
- package/types/agorapulse-ui-components-tooltip.d.ts +65 -33
- package/agorapulse-ui-components-22.2.6.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,41 +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
|
-
|
|
163
|
+
/** Decides where the tooltip goes — flip, shift, scroll following, arrow; this directive only decides when. */
|
|
164
|
+
overlay = createFloatingOverlay();
|
|
136
165
|
apTooltip = input.required(/* @ts-ignore */
|
|
137
166
|
...(ngDevMode ? [{ debugName: "apTooltip" }] : /* istanbul ignore next */ []));
|
|
167
|
+
/** Where the panel opens, in the engine's vocabulary. */
|
|
138
168
|
apTooltipPosition = input('top', /* @ts-ignore */
|
|
139
169
|
...(ngDevMode ? [{ debugName: "apTooltipPosition" }] : /* istanbul ignore next */ []));
|
|
140
170
|
apTooltipShowDelay = input(80, /* @ts-ignore */
|
|
@@ -153,6 +183,9 @@ class TooltipDirective {
|
|
|
153
183
|
...(ngDevMode ? [undefined, { debugName: "apTooltipVirtualScrollElement" }] : /* istanbul ignore next */ []));
|
|
154
184
|
apTooltipTrigger = input('hover', /* @ts-ignore */
|
|
155
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 */ []));
|
|
156
189
|
// Predefined template variables
|
|
157
190
|
apTooltipType = input(CustomTooltipType.DEFAULT, /* @ts-ignore */
|
|
158
191
|
...(ngDevMode ? [{ debugName: "apTooltipType" }] : /* istanbul ignore next */ []));
|
|
@@ -171,15 +204,38 @@ class TooltipDirective {
|
|
|
171
204
|
...(ngDevMode ? [{ debugName: "isValidPredefinedTooltip" }] : /* istanbul ignore next */ []));
|
|
172
205
|
triggeredByClick = computed(() => this.apTooltipTrigger() === 'click' || this.externallyTriggerred, /* @ts-ignore */
|
|
173
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;
|
|
174
209
|
clickListener = undefined;
|
|
175
|
-
container = undefined;
|
|
176
210
|
hideTimeout;
|
|
177
211
|
mouseEnterListener = undefined;
|
|
178
212
|
mouseLeaveListener = undefined;
|
|
179
213
|
nativeElement = this.elementRef.nativeElement;
|
|
180
214
|
showTimeout;
|
|
181
|
-
tooltipText;
|
|
182
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
|
+
}
|
|
183
239
|
ngOnInit() {
|
|
184
240
|
const apTooltipVirtualScrollElement = this.apTooltipVirtualScrollElement();
|
|
185
241
|
if (apTooltipVirtualScrollElement) {
|
|
@@ -195,7 +251,7 @@ class TooltipDirective {
|
|
|
195
251
|
}
|
|
196
252
|
setupEventListeners(trigger) {
|
|
197
253
|
// Close any open tooltip when switching modes
|
|
198
|
-
if (this.
|
|
254
|
+
if (this.isOpen()) {
|
|
199
255
|
this.remove();
|
|
200
256
|
}
|
|
201
257
|
this.cleanupEventListeners();
|
|
@@ -225,13 +281,13 @@ class TooltipDirective {
|
|
|
225
281
|
}
|
|
226
282
|
}
|
|
227
283
|
ngOnDestroy() {
|
|
228
|
-
if (this.
|
|
284
|
+
if (this.isOpen()) {
|
|
229
285
|
this.deactivate();
|
|
230
286
|
}
|
|
231
287
|
this.cleanupEventListeners();
|
|
232
288
|
}
|
|
233
289
|
onMouseEnter() {
|
|
234
|
-
if (!this.
|
|
290
|
+
if (!this.isOpen()) {
|
|
235
291
|
this.activate();
|
|
236
292
|
}
|
|
237
293
|
}
|
|
@@ -240,14 +296,16 @@ class TooltipDirective {
|
|
|
240
296
|
this.deactivate();
|
|
241
297
|
}
|
|
242
298
|
}
|
|
243
|
-
onInputClick() {
|
|
299
|
+
onInputClick(event) {
|
|
244
300
|
this.zone.run(() => {
|
|
245
301
|
const trigger = this.apTooltipTrigger();
|
|
246
302
|
if (trigger === 'click') {
|
|
247
|
-
if (this.
|
|
303
|
+
if (this.isOpen()) {
|
|
248
304
|
this.deactivate();
|
|
249
305
|
}
|
|
250
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;
|
|
251
309
|
this.activate();
|
|
252
310
|
}
|
|
253
311
|
}
|
|
@@ -258,9 +316,6 @@ class TooltipDirective {
|
|
|
258
316
|
}
|
|
259
317
|
activate() {
|
|
260
318
|
this.clearHideTimeout();
|
|
261
|
-
if (this.triggeredByClick()) {
|
|
262
|
-
this.addDocumentClickListener();
|
|
263
|
-
}
|
|
264
319
|
if (this.apTooltipShowDelay()) {
|
|
265
320
|
this.showTimeout = window.setTimeout(() => {
|
|
266
321
|
this.show();
|
|
@@ -278,7 +333,6 @@ class TooltipDirective {
|
|
|
278
333
|
}
|
|
279
334
|
deactivate() {
|
|
280
335
|
this.clearShowTimeout();
|
|
281
|
-
this.removeDocumentClickListener();
|
|
282
336
|
if (this.apTooltipHideDelay()) {
|
|
283
337
|
this.clearHideTimeout();
|
|
284
338
|
this.hideTimeout = window.setTimeout(() => {
|
|
@@ -304,294 +358,101 @@ class TooltipDirective {
|
|
|
304
358
|
return;
|
|
305
359
|
}
|
|
306
360
|
this.create();
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
361
|
+
}
|
|
362
|
+
remove() {
|
|
363
|
+
this.stopScrollDismissal?.();
|
|
364
|
+
this.overlay.close();
|
|
365
|
+
this.panelRef = null;
|
|
366
|
+
this.clearTimeouts();
|
|
367
|
+
this._externallyTriggerred = false;
|
|
311
368
|
}
|
|
312
369
|
create() {
|
|
313
|
-
if (this.
|
|
370
|
+
if (this.isOpen()) {
|
|
314
371
|
this.clearHideTimeout();
|
|
315
372
|
this.remove();
|
|
316
373
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
this.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
this.
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
// Set inputs
|
|
345
|
-
componentRef.setInput('type', this.apTooltipType());
|
|
346
|
-
componentRef.setInput('presentationContext', this.apTooltipPresentationContext());
|
|
347
|
-
componentRef.setInput('tooltipListItems', this.apTooltipListItems());
|
|
348
|
-
componentRef.setInput('showCaption', this.apTooltipShowAvatarCaption());
|
|
349
|
-
// Force change detection to render the component immediately
|
|
350
|
-
componentRef.changeDetectorRef.detectChanges();
|
|
351
|
-
this.container = document.createElement('div');
|
|
352
|
-
this.container.setAttribute('role', 'tooltip');
|
|
353
|
-
const contentContainer = document.createElement('div');
|
|
354
|
-
contentContainer.classList.add('ap-content-container', 'ap-content-predefined-container');
|
|
355
|
-
contentContainer.appendChild(componentRef.location.nativeElement);
|
|
356
|
-
contentContainer.appendChild(this.createSvgElement());
|
|
357
|
-
this.container.appendChild(contentContainer);
|
|
358
|
-
document.body.appendChild(this.container);
|
|
359
|
-
this.container.classList.add('ap-tooltip', 'ap-predefined-tooltip');
|
|
360
|
-
if (this.triggeredByClick()) {
|
|
361
|
-
this.container.classList.add('ap-tooltip-click-trigger');
|
|
362
|
-
}
|
|
363
|
-
// Has to wait for the TooltipComponent to be rendered in order to align and then set the CSS variable --ap-tooltip-height
|
|
364
|
-
requestAnimationFrame(() => {
|
|
365
|
-
this.align();
|
|
366
|
-
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();
|
|
367
401
|
});
|
|
368
402
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
path.setAttribute('d', 'M6.68299 1.15238C7.43705 0.492586 8.56296 0.492588 9.31701 1.15238L16 7L0 7L6.68299 1.15238Z');
|
|
378
|
-
arrowSvg.appendChild(path);
|
|
379
|
-
return arrowSvg;
|
|
380
|
-
}
|
|
381
|
-
align() {
|
|
382
|
-
switch (this.apTooltipPosition()) {
|
|
383
|
-
case 'top-left':
|
|
384
|
-
this.alignTopLeft();
|
|
385
|
-
if (this.isOutOfBounds()) {
|
|
386
|
-
this.alignBottom();
|
|
387
|
-
if (this.isOutOfBounds()) {
|
|
388
|
-
this.alignRight();
|
|
389
|
-
if (this.isOutOfBounds()) {
|
|
390
|
-
this.alignLeft();
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
break;
|
|
395
|
-
case 'top-right':
|
|
396
|
-
this.alignTopRight();
|
|
397
|
-
if (this.isOutOfBounds()) {
|
|
398
|
-
this.alignBottom();
|
|
399
|
-
if (this.isOutOfBounds()) {
|
|
400
|
-
this.alignRight();
|
|
401
|
-
if (this.isOutOfBounds()) {
|
|
402
|
-
this.alignLeft();
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
break;
|
|
407
|
-
case 'top':
|
|
408
|
-
this.alignTop();
|
|
409
|
-
if (this.isOutOfBounds()) {
|
|
410
|
-
this.alignBottom();
|
|
411
|
-
if (this.isOutOfBounds()) {
|
|
412
|
-
this.alignRight();
|
|
413
|
-
if (this.isOutOfBounds()) {
|
|
414
|
-
this.alignLeft();
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
break;
|
|
419
|
-
case 'bottom':
|
|
420
|
-
this.alignBottom();
|
|
421
|
-
if (this.isOutOfBounds()) {
|
|
422
|
-
this.alignTop();
|
|
423
|
-
if (this.isOutOfBounds()) {
|
|
424
|
-
this.alignRight();
|
|
425
|
-
if (this.isOutOfBounds()) {
|
|
426
|
-
this.alignLeft();
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
break;
|
|
431
|
-
case 'bottom-left':
|
|
432
|
-
this.alignBottomLeft();
|
|
433
|
-
if (this.isOutOfBounds()) {
|
|
434
|
-
this.alignTop();
|
|
435
|
-
if (this.isOutOfBounds()) {
|
|
436
|
-
this.alignRight();
|
|
437
|
-
if (this.isOutOfBounds()) {
|
|
438
|
-
this.alignLeft();
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
break;
|
|
443
|
-
case 'bottom-right':
|
|
444
|
-
this.alignBottomRight();
|
|
445
|
-
if (this.isOutOfBounds()) {
|
|
446
|
-
this.alignTop();
|
|
447
|
-
if (this.isOutOfBounds()) {
|
|
448
|
-
this.alignRight();
|
|
449
|
-
if (this.isOutOfBounds()) {
|
|
450
|
-
this.alignLeft();
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
break;
|
|
455
|
-
case 'left':
|
|
456
|
-
this.alignLeft();
|
|
457
|
-
if (this.isOutOfBounds()) {
|
|
458
|
-
this.alignRight();
|
|
459
|
-
if (this.isOutOfBounds()) {
|
|
460
|
-
this.alignTop();
|
|
461
|
-
if (this.isOutOfBounds()) {
|
|
462
|
-
this.alignBottom();
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
break;
|
|
467
|
-
case 'right':
|
|
468
|
-
this.alignRight();
|
|
469
|
-
if (this.isOutOfBounds()) {
|
|
470
|
-
this.alignLeft();
|
|
471
|
-
if (this.isOutOfBounds()) {
|
|
472
|
-
this.alignTop();
|
|
473
|
-
if (this.isOutOfBounds()) {
|
|
474
|
-
this.alignBottom();
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
break;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
alignRight() {
|
|
482
|
-
this.preAlign('right');
|
|
483
|
-
if (this.container) {
|
|
484
|
-
const hostOffset = this.getHostOffset();
|
|
485
|
-
const left = hostOffset.left + TooltipService.getOuterWidth(this.nativeElement) + TooltipService.defaultOffset;
|
|
486
|
-
const top = hostOffset.top + (TooltipService.getOuterHeight(this.nativeElement) - TooltipService.getOuterHeight(this.container)) / 2;
|
|
487
|
-
this.container.style.left = left + 'px';
|
|
488
|
-
this.container.style.top = top + 'px';
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
alignLeft() {
|
|
492
|
-
this.preAlign('left');
|
|
493
|
-
if (this.container) {
|
|
494
|
-
const hostOffset = this.getHostOffset();
|
|
495
|
-
const left = hostOffset.left - TooltipService.getOuterWidth(this.container) - TooltipService.defaultOffset;
|
|
496
|
-
const top = hostOffset.top + (TooltipService.getOuterHeight(this.nativeElement) - TooltipService.getOuterHeight(this.container)) / 2;
|
|
497
|
-
this.container.style.left = left + 'px';
|
|
498
|
-
this.container.style.top = top + 'px';
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
alignTop() {
|
|
502
|
-
this.preAlign('top');
|
|
503
|
-
if (this.container) {
|
|
504
|
-
const hostOffset = this.getHostOffset();
|
|
505
|
-
const left = hostOffset.left + (TooltipService.getOuterWidth(this.nativeElement) - TooltipService.getOuterWidth(this.container)) / 2;
|
|
506
|
-
const top = hostOffset.top - TooltipService.getOuterHeight(this.container) - TooltipService.defaultOffset;
|
|
507
|
-
this.container.style.left = left + 'px';
|
|
508
|
-
this.container.style.top = top + 'px';
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
alignTopLeft() {
|
|
512
|
-
this.preAlign('top-left');
|
|
513
|
-
if (this.container) {
|
|
514
|
-
const hostOffset = this.getHostOffset();
|
|
515
|
-
const left = hostOffset.left;
|
|
516
|
-
const top = hostOffset.top - TooltipService.getOuterHeight(this.container) - TooltipService.defaultOffset;
|
|
517
|
-
this.container.style.left = left + 'px';
|
|
518
|
-
this.container.style.top = top + 'px';
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
alignTopRight() {
|
|
522
|
-
this.preAlign('top-right');
|
|
523
|
-
if (this.container) {
|
|
524
|
-
const hostOffset = this.getHostOffset();
|
|
525
|
-
const left = hostOffset.left + TooltipService.getOuterWidth(this.nativeElement) - TooltipService.getOuterWidth(this.container);
|
|
526
|
-
const top = hostOffset.top - TooltipService.getOuterHeight(this.container) - TooltipService.defaultOffset;
|
|
527
|
-
this.container.style.left = left + 'px';
|
|
528
|
-
this.container.style.top = top + 'px';
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
alignBottom() {
|
|
532
|
-
this.preAlign('bottom');
|
|
533
|
-
if (this.container) {
|
|
534
|
-
const hostOffset = this.getHostOffset();
|
|
535
|
-
const left = hostOffset.left + (TooltipService.getOuterWidth(this.nativeElement) - TooltipService.getOuterWidth(this.container)) / 2;
|
|
536
|
-
const top = hostOffset.top + TooltipService.getOuterHeight(this.nativeElement) + TooltipService.defaultOffset;
|
|
537
|
-
this.container.style.left = left + 'px';
|
|
538
|
-
this.container.style.top = top + 'px';
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
alignBottomLeft() {
|
|
542
|
-
this.preAlign('bottom-left');
|
|
543
|
-
if (this.container) {
|
|
544
|
-
const hostOffset = this.getHostOffset();
|
|
545
|
-
const left = hostOffset.left;
|
|
546
|
-
const top = hostOffset.top + TooltipService.getOuterHeight(this.nativeElement) + TooltipService.defaultOffset;
|
|
547
|
-
this.container.style.left = left + 'px';
|
|
548
|
-
this.container.style.top = top + 'px';
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
alignBottomRight() {
|
|
552
|
-
this.preAlign('bottom-right');
|
|
553
|
-
if (this.container) {
|
|
554
|
-
const hostOffset = this.getHostOffset();
|
|
555
|
-
const left = hostOffset.left + (TooltipService.getOuterWidth(this.nativeElement) - TooltipService.getOuterWidth(this.container));
|
|
556
|
-
const top = hostOffset.top + TooltipService.getOuterHeight(this.nativeElement) + TooltipService.defaultOffset;
|
|
557
|
-
this.container.style.left = left + 'px';
|
|
558
|
-
this.container.style.top = top + 'px';
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
preAlign(position) {
|
|
562
|
-
this.removePreviousAlignHtmlClasses();
|
|
563
|
-
if (this.container) {
|
|
564
|
-
this.container.style.left = -999 + 'px';
|
|
565
|
-
this.container.style.top = -999 + 'px';
|
|
566
|
-
const defaultClassName = 'ap-tooltip-' + position;
|
|
567
|
-
this.container.classList.add(defaultClassName);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
getHostOffset() {
|
|
571
|
-
const offset = this.nativeElement.getBoundingClientRect();
|
|
572
|
-
return { left: offset.left, top: offset.top };
|
|
573
|
-
}
|
|
574
|
-
isOutOfBounds() {
|
|
575
|
-
if (this.container) {
|
|
576
|
-
const offset = this.container.getBoundingClientRect();
|
|
577
|
-
const targetTop = offset.top;
|
|
578
|
-
const targetLeft = offset.left;
|
|
579
|
-
const width = TooltipService.getOuterWidth(this.container);
|
|
580
|
-
const height = TooltipService.getOuterHeight(this.container);
|
|
581
|
-
const viewport = TooltipService.getViewport();
|
|
582
|
-
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;
|
|
583
411
|
}
|
|
584
|
-
|
|
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) {
|
|
585
443
|
return false;
|
|
586
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
|
+
});
|
|
587
449
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
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'];
|
|
591
454
|
}
|
|
592
|
-
|
|
593
|
-
this._externallyTriggerred = false;
|
|
594
|
-
this.container = undefined;
|
|
455
|
+
return isTemplate ? ['ap-tooltip-pane', 'custom-template'] : ['ap-tooltip-pane'];
|
|
595
456
|
}
|
|
596
457
|
clearShowTimeout() {
|
|
597
458
|
if (this.showTimeout) {
|
|
@@ -609,47 +470,6 @@ class TooltipDirective {
|
|
|
609
470
|
this.clearShowTimeout();
|
|
610
471
|
this.clearHideTimeout();
|
|
611
472
|
}
|
|
612
|
-
updateText() {
|
|
613
|
-
const apTooltip = this.apTooltip();
|
|
614
|
-
if (apTooltip instanceof TemplateRef) {
|
|
615
|
-
const embeddedViewRef = this.viewContainerRef.createEmbeddedView(apTooltip);
|
|
616
|
-
embeddedViewRef.context = this.apTooltipTemplateContext();
|
|
617
|
-
embeddedViewRef.detectChanges();
|
|
618
|
-
embeddedViewRef.rootNodes.forEach(node => this.tooltipText?.appendChild(node));
|
|
619
|
-
}
|
|
620
|
-
else if (this.tooltipText) {
|
|
621
|
-
this.tooltipText.innerHTML = apTooltip ? DOMPurify.sanitize(apTooltip) : '';
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
setCssVariables() {
|
|
625
|
-
if (this.container) {
|
|
626
|
-
this.container.style.setProperty('--ap-tooltip-height', this.container.offsetHeight + 'px');
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
removePreviousAlignHtmlClasses() {
|
|
630
|
-
if (this.container) {
|
|
631
|
-
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');
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
addDocumentClickListener() {
|
|
635
|
-
if (this.documentClickListener)
|
|
636
|
-
return;
|
|
637
|
-
this.zone.runOutsideAngular(() => {
|
|
638
|
-
this.documentClickListener = (event) => {
|
|
639
|
-
const target = event.target;
|
|
640
|
-
if (this.container && !this.container.contains(target) && !this.nativeElement.contains(target)) {
|
|
641
|
-
this.deactivate();
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
document.addEventListener('click', this.documentClickListener);
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
removeDocumentClickListener() {
|
|
648
|
-
if (!this.documentClickListener)
|
|
649
|
-
return;
|
|
650
|
-
document.removeEventListener('click', this.documentClickListener);
|
|
651
|
-
this.documentClickListener = undefined;
|
|
652
|
-
}
|
|
653
473
|
get externallyTriggerred() {
|
|
654
474
|
return this._externallyTriggerred;
|
|
655
475
|
}
|
|
@@ -657,16 +477,16 @@ class TooltipDirective {
|
|
|
657
477
|
this._externallyTriggerred = value;
|
|
658
478
|
}
|
|
659
479
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
660
|
-
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 });
|
|
661
481
|
}
|
|
662
482
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipDirective, decorators: [{
|
|
663
483
|
type: Directive,
|
|
664
484
|
args: [{ selector: '[apTooltip]', standalone: true, exportAs: 'apTooltip' }]
|
|
665
|
-
}], 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 }] }] } });
|
|
666
486
|
|
|
667
487
|
/**
|
|
668
488
|
* Generated bundle index. Do not edit.
|
|
669
489
|
*/
|
|
670
490
|
|
|
671
|
-
export { CustomTooltipType, TooltipDirective, TooltipExternalTriggerDirective };
|
|
491
|
+
export { CustomTooltipType, TooltipDirective, TooltipExternalTriggerDirective, TooltipPanelComponent };
|
|
672
492
|
//# sourceMappingURL=agorapulse-ui-components-tooltip.mjs.map
|