@progress/kendo-angular-tooltip 21.4.1 → 22.0.0-develop.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.
Files changed (30) hide show
  1. package/fesm2022/progress-kendo-angular-tooltip.mjs +51 -51
  2. package/package.json +11 -19
  3. package/popover/directives-base.d.ts +1 -1
  4. package/esm2022/constants.mjs +0 -12
  5. package/esm2022/directives.mjs +0 -101
  6. package/esm2022/index.mjs +0 -22
  7. package/esm2022/localization/localized-messages.directive.mjs +0 -44
  8. package/esm2022/models/animation.model.mjs +0 -5
  9. package/esm2022/models/events.mjs +0 -87
  10. package/esm2022/models/functions.model.mjs +0 -5
  11. package/esm2022/models/popover-show-option.type.mjs +0 -5
  12. package/esm2022/models/position.type.mjs +0 -5
  13. package/esm2022/models/show.option.type.mjs +0 -5
  14. package/esm2022/package-metadata.mjs +0 -16
  15. package/esm2022/popover/anchor.directive.mjs +0 -172
  16. package/esm2022/popover/container.directive.mjs +0 -190
  17. package/esm2022/popover/directives-base.mjs +0 -319
  18. package/esm2022/popover/popover.component.mjs +0 -562
  19. package/esm2022/popover/popover.service.mjs +0 -71
  20. package/esm2022/popover/template-directives/actions-template.directive.mjs +0 -38
  21. package/esm2022/popover/template-directives/body-template.directive.mjs +0 -38
  22. package/esm2022/popover/template-directives/title-template.directive.mjs +0 -38
  23. package/esm2022/popover.module.mjs +0 -47
  24. package/esm2022/progress-kendo-angular-tooltip.mjs +0 -8
  25. package/esm2022/tooltip/tooltip.content.component.mjs +0 -293
  26. package/esm2022/tooltip/tooltip.directive.mjs +0 -490
  27. package/esm2022/tooltip/tooltip.settings.mjs +0 -70
  28. package/esm2022/tooltip.module.mjs +0 -44
  29. package/esm2022/tooltips.module.mjs +0 -51
  30. package/esm2022/utils.mjs +0 -153
@@ -1,319 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /* eslint-disable @typescript-eslint/no-unused-vars */
6
- /* eslint-disable @typescript-eslint/no-explicit-any */
7
- import { Directive, ElementRef, Input, isDevMode, NgZone, Renderer2 } from "@angular/core";
8
- import { PopupService } from "@progress/kendo-angular-popup";
9
- import { closest, hasObservers, isDocumentAvailable, Keys } from "@progress/kendo-angular-common";
10
- import { ERRORS } from '../constants';
11
- import { PopoverHideEvent, PopoverShowEvent, PopoverShownEvent, PopoverHiddenEvent } from "../models/events";
12
- import { align, containsItem } from "../utils";
13
- import { PopoverComponent } from "./popover.component";
14
- import { Subscription } from "rxjs";
15
- import * as i0 from "@angular/core";
16
- import * as i1 from "@progress/kendo-angular-popup";
17
- const validShowOptions = ['hover', 'click', 'none', 'focus'];
18
- /**
19
- * @hidden
20
- */
21
- export class PopoverDirectivesBase {
22
- ngZone;
23
- popupService;
24
- renderer;
25
- /**
26
- * Specifies the popover instance to render.
27
- * Accepts a [`PopoverComponent`]({% slug api_tooltip_popovercomponent %}) instance or a [`PopoverFn`]({% slug api_tooltip_popoverfn %}) callback that returns a [`PopoverComponent`]({% slug api_tooltip_popovercomponent %}) instance for the current anchor element. [See example](slug:templates_popover#toc-passing-data-to-templates).
28
- */
29
- set popover(value) {
30
- if (value instanceof PopoverComponent || typeof value === `function`) {
31
- this._popover = value;
32
- }
33
- else {
34
- if (isDevMode) {
35
- throw new Error(ERRORS.popover);
36
- }
37
- }
38
- }
39
- get popover() {
40
- return this._popover;
41
- }
42
- /**
43
- * Specifies the mouse action that triggers the popover to show. [See example]({% slug programmaticcontrol_popover %}).
44
- */
45
- set showOn(value) {
46
- if (isDevMode && !containsItem(validShowOptions, value)) {
47
- throw new Error(ERRORS.showOn);
48
- }
49
- this._showOn = value;
50
- }
51
- get showOn() {
52
- return this._showOn;
53
- }
54
- /**
55
- * @hidden
56
- */
57
- anchor = null;
58
- popupRef;
59
- disposeHoverOverListener;
60
- disposeHoverOutListener;
61
- disposeClickListener;
62
- disposePopupHoverOutListener;
63
- disposePopupHoverInListener;
64
- disposePopupFocusOutListener;
65
- subs = new Subscription();
66
- _popoverService;
67
- _hideSub;
68
- _focusInsideSub;
69
- _popover;
70
- _showOn = 'click';
71
- _popupOpenSub;
72
- _popupCloseSub;
73
- _popupSubs;
74
- constructor(ngZone, popupService, renderer) {
75
- this.ngZone = ngZone;
76
- this.popupService = popupService;
77
- this.renderer = renderer;
78
- }
79
- ngAfterViewInit() {
80
- if (!isDocumentAvailable()) {
81
- return;
82
- }
83
- this.manageEvents();
84
- }
85
- ngOnDestroy() {
86
- this.closePopup();
87
- this.subs.unsubscribe();
88
- this._popupSubs && this._popupSubs.unsubscribe();
89
- if (this.disposeHoverOverListener) {
90
- this.disposeHoverOverListener();
91
- }
92
- if (this.disposeHoverOutListener) {
93
- this.disposeHoverOutListener();
94
- }
95
- if (this.disposeClickListener) {
96
- this.disposeClickListener();
97
- }
98
- if (this._focusInsideSub) {
99
- this._focusInsideSub.unsubscribe();
100
- }
101
- if (this._hideSub) {
102
- this._hideSub.unsubscribe();
103
- }
104
- if (this._popupOpenSub) {
105
- this._popupOpenSub.unsubscribe();
106
- }
107
- if (this._popupCloseSub) {
108
- this._popupCloseSub.unsubscribe();
109
- }
110
- }
111
- /**
112
- * Hides the Popover. [See example]({% slug programmaticcontrol_popover %}).
113
- */
114
- hide() {
115
- this.closePopup();
116
- }
117
- /**
118
- * @hidden
119
- */
120
- closePopup() {
121
- if (this.popupRef) {
122
- if (this.anchor) {
123
- this.renderer.removeAttribute(this.anchor, 'aria-describedby');
124
- }
125
- this.popupRef.close();
126
- this.popupRef = null;
127
- if (this.disposePopupHoverOutListener) {
128
- this.disposePopupHoverOutListener();
129
- }
130
- if (this.disposePopupHoverInListener) {
131
- this.disposePopupHoverInListener();
132
- }
133
- if (this.disposePopupFocusOutListener) {
134
- this.disposePopupFocusOutListener();
135
- }
136
- this._popupSubs.unsubscribe();
137
- }
138
- }
139
- /**
140
- * @hidden
141
- */
142
- openPopup(anchor) {
143
- this.anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;
144
- const popoverComp = this.popover instanceof PopoverComponent ? this.popover : this.popover(this.anchor);
145
- const alignSettings = align(popoverComp.position, popoverComp.offset);
146
- const anchorAlign = alignSettings.anchorAlign;
147
- const popupAlign = alignSettings.popupAlign;
148
- const popupMargin = alignSettings.popupMargin;
149
- const _animation = popoverComp.animation;
150
- this.popupRef = this.popupService.open({
151
- anchor: { nativeElement: this.anchor },
152
- animate: _animation,
153
- content: PopoverComponent,
154
- popupAlign,
155
- anchorAlign,
156
- margin: popupMargin,
157
- collision: { horizontal: 'fit', vertical: 'fit' }
158
- });
159
- const popupInstance = this.popupRef.content.instance;
160
- // Avoid adding the default k-popup class which leads to visual and rendering discrepancies
161
- this.popupRef && (this.popupRef.popup.instance.renderDefaultClass = false);
162
- this._popupSubs = new Subscription();
163
- if (anchor) {
164
- this._popupSubs.add(this.renderer.listen(this.anchor, 'keydown', event => this.onKeyDown(event)));
165
- this.renderer.setAttribute(this.anchor, 'aria-describedby', popupInstance.popoverId);
166
- }
167
- this._popupSubs.add(popupInstance.closeOnKeyDown.subscribe(() => {
168
- this.anchor.focus();
169
- this.hide();
170
- }));
171
- this.applySettings(this.popupRef.content, popoverComp);
172
- this.monitorPopup();
173
- this.initializeCompletionEvents(popoverComp, this.anchor);
174
- }
175
- /**
176
- * @hidden
177
- */
178
- isPrevented(anchorElement, show) {
179
- const popoverComp = this.popover instanceof PopoverComponent ? this.popover : this.popover(anchorElement);
180
- let eventArgs;
181
- // eslint-disable-next-line prefer-const
182
- eventArgs = this.initializeEvents(popoverComp, eventArgs, show, anchorElement);
183
- return eventArgs.isDefaultPrevented();
184
- }
185
- /**
186
- * @hidden
187
- */
188
- monitorPopup() {
189
- if (this.showOn === 'hover') {
190
- this.ngZone.runOutsideAngular(() => {
191
- const popup = this.popupRef.popupElement;
192
- this.disposePopupHoverInListener = this.renderer.listen(popup, 'mouseenter', _ => {
193
- this.ngZone.run(_ => this._popoverService.emitPopoverState(true));
194
- });
195
- this.disposePopupHoverOutListener = this.renderer.listen(popup, 'mouseleave', _ => {
196
- this.ngZone.run(_ => this._popoverService.emitPopoverState(false));
197
- });
198
- });
199
- }
200
- if (this.showOn === 'focus') {
201
- this.ngZone.runOutsideAngular(() => {
202
- const popup = this.popupRef.popupElement;
203
- this.disposePopupFocusOutListener = this.renderer.listen(popup, 'focusout', (e) => {
204
- const isInsidePopover = closest(e.relatedTarget, (node) => node.classList && node.classList.contains('k-popover'));
205
- if (!isInsidePopover) {
206
- this.ngZone.run(_ => this._popoverService.emitFocusInsidePopover(false));
207
- }
208
- });
209
- });
210
- }
211
- }
212
- applySettings(contentComponent, popover) {
213
- const content = contentComponent.instance;
214
- content.visible = true;
215
- content.anchor = this.anchor;
216
- content.position = popover.position;
217
- content.offset = popover.offset;
218
- content.width = popover.width;
219
- content.height = popover.height;
220
- content.title = popover.title;
221
- content.body = popover.body;
222
- content.callout = popover.callout;
223
- content.animation = popover.animation;
224
- content.contextData = popover.templateData(this.anchor);
225
- content.titleTemplate = popover.titleTemplate;
226
- content.bodyTemplate = popover.bodyTemplate;
227
- content.actionsTemplate = popover.actionsTemplate;
228
- this.popupRef.content.changeDetectorRef.detectChanges();
229
- }
230
- manageEvents() {
231
- this.ngZone.runOutsideAngular(() => {
232
- switch (this.showOn) {
233
- case 'hover':
234
- this.subscribeToShowEvents([{
235
- name: 'mouseenter', handler: this.mouseenterHandler
236
- }, {
237
- name: 'mouseleave', handler: this.mouseleaveHandler
238
- }]);
239
- break;
240
- case 'focus':
241
- this.subscribeToShowEvents([{
242
- name: 'focus', handler: this.focusHandler
243
- }, {
244
- name: 'blur', handler: this.blurHandler
245
- }]);
246
- break;
247
- case 'click':
248
- this.subscribeClick();
249
- break;
250
- default:
251
- break;
252
- }
253
- });
254
- }
255
- /**
256
- * @hidden
257
- */
258
- initializeEvents(popoverComp, eventArgs, show, anchorElement) {
259
- if (show) {
260
- eventArgs = new PopoverShowEvent(anchorElement);
261
- if (this.shouldEmitEvent(!!this.popupRef, 'show', popoverComp)) {
262
- this.ngZone.run(() => popoverComp.show.emit(eventArgs));
263
- }
264
- }
265
- else {
266
- eventArgs = new PopoverHideEvent(anchorElement, this.popupRef);
267
- if (this.shouldEmitEvent(!!this.popupRef, 'hide', popoverComp)) {
268
- this.ngZone.run(() => popoverComp.hide.emit(eventArgs));
269
- }
270
- }
271
- return eventArgs;
272
- }
273
- onKeyDown(event) {
274
- const keyCode = event.code;
275
- if (keyCode === Keys.Escape) {
276
- this.hide();
277
- }
278
- }
279
- initializeCompletionEvents(popoverComp, _anchor) {
280
- if (this.shouldEmitCompletionEvents('shown', popoverComp)) {
281
- this.popupRef.popupOpen.subscribe(() => {
282
- const eventArgs = new PopoverShownEvent(_anchor, this.popupRef);
283
- popoverComp.shown.emit(eventArgs);
284
- });
285
- }
286
- if (this.shouldEmitCompletionEvents('hidden', popoverComp)) {
287
- this.popupRef.popupClose.subscribe(() => {
288
- this.ngZone.run(_ => {
289
- const eventArgs = new PopoverHiddenEvent(_anchor);
290
- popoverComp.hidden.emit(eventArgs);
291
- });
292
- });
293
- }
294
- }
295
- shouldEmitEvent(hasPopup, event, popoverComp) {
296
- if ((event === 'show' && !hasPopup && hasObservers(popoverComp[event]))
297
- || (event === 'hide' && hasPopup && hasObservers(popoverComp[event]))) {
298
- return true;
299
- }
300
- return false;
301
- }
302
- shouldEmitCompletionEvents(event, popoverComp) {
303
- if ((hasObservers(popoverComp[event]) && !this._popupOpenSub)
304
- || (hasObservers(popoverComp[event]) && !this._popupCloseSub)) {
305
- return true;
306
- }
307
- return false;
308
- }
309
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PopoverDirectivesBase, deps: [{ token: i0.NgZone }, { token: i1.PopupService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
310
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: PopoverDirectivesBase, inputs: { popover: "popover", showOn: "showOn" }, ngImport: i0 });
311
- }
312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PopoverDirectivesBase, decorators: [{
313
- type: Directive,
314
- args: [{}]
315
- }], ctorParameters: () => [{ type: i0.NgZone }, { type: i1.PopupService }, { type: i0.Renderer2 }], propDecorators: { popover: [{
316
- type: Input
317
- }], showOn: [{
318
- type: Input
319
- }] } });