@progress/kendo-angular-tooltip 4.0.0-next.202110211119 → 4.0.0-next.202203021431

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 (49) hide show
  1. package/LICENSE.md +1 -1
  2. package/NOTICE.txt +119 -79
  3. package/README.md +1 -1
  4. package/bundles/kendo-angular-tooltip.umd.js +1 -1
  5. package/constants.d.ts +12 -0
  6. package/esm2015/constants.js +12 -0
  7. package/esm2015/localization/localized-messages.directive.js +3 -3
  8. package/esm2015/main.js +12 -1
  9. package/esm2015/models/animation.model.js +5 -0
  10. package/esm2015/models/events.js +65 -0
  11. package/esm2015/models/functions.model.js +5 -0
  12. package/esm2015/models/popover-show-option.type.js +5 -0
  13. package/esm2015/package-metadata.js +1 -1
  14. package/esm2015/popover/anchor.directive.js +147 -0
  15. package/esm2015/popover/container.directive.js +172 -0
  16. package/esm2015/popover/directives-base.js +282 -0
  17. package/esm2015/popover/popover.component.js +308 -0
  18. package/esm2015/popover/popover.service.js +67 -0
  19. package/esm2015/popover/template-directives/actions-template.directive.js +27 -0
  20. package/esm2015/popover/template-directives/body-template.directive.js +27 -0
  21. package/esm2015/popover/template-directives/title-template.directive.js +27 -0
  22. package/esm2015/popover.module.js +78 -0
  23. package/esm2015/tooltip/tooltip.content.component.js +3 -3
  24. package/esm2015/tooltip/tooltip.directive.js +7 -7
  25. package/esm2015/tooltip/tooltip.settings.js +3 -3
  26. package/esm2015/tooltip.module.js +4 -4
  27. package/esm2015/tooltips.module.js +45 -0
  28. package/esm2015/utils.js +1 -1
  29. package/fesm2015/kendo-angular-tooltip.js +1188 -27
  30. package/main.d.ts +16 -2
  31. package/models/animation.model.d.ts +9 -0
  32. package/models/events.d.ts +78 -0
  33. package/models/functions.model.d.ts +17 -0
  34. package/models/popover-show-option.type.d.ts +8 -0
  35. package/models/position.type.d.ts +1 -1
  36. package/package.json +3 -3
  37. package/popover/anchor.directive.d.ts +47 -0
  38. package/popover/container.directive.d.ts +59 -0
  39. package/popover/directives-base.d.ts +95 -0
  40. package/popover/popover.component.d.ts +173 -0
  41. package/popover/popover.service.d.ts +33 -0
  42. package/popover/template-directives/actions-template.directive.d.ts +18 -0
  43. package/popover/template-directives/body-template.directive.d.ts +18 -0
  44. package/popover/template-directives/title-template.directive.d.ts +18 -0
  45. package/popover.module.d.ts +43 -0
  46. package/schematics/ngAdd/index.js +1 -2
  47. package/schematics/ngAdd/index.js.map +1 -1
  48. package/tooltips.module.d.ts +38 -0
  49. package/utils.d.ts +1 -1
@@ -0,0 +1,65 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { PreventableEvent } from "@progress/kendo-angular-common";
6
+ /**
7
+ * Arguments for the `show` event. The `show` event fires when a popover is about
8
+ * to be opened. If you cancel the event, the opening is prevented.
9
+ */
10
+ export class PopoverShowEvent extends PreventableEvent {
11
+ /**
12
+ * @hidden
13
+ * Constructs the event arguments for the `show` event.
14
+ * @param anchor - The host element related to the popover.
15
+ */
16
+ constructor(anchor) {
17
+ super();
18
+ this.anchor = anchor;
19
+ }
20
+ }
21
+ /**
22
+ * Arguments for the `hide` event. The `hide` event fires when a popover is about
23
+ * to be closed. If you cancel the event, the popover stays open.
24
+ */
25
+ export class PopoverHideEvent extends PreventableEvent {
26
+ /**
27
+ * @hidden
28
+ * Constructs the event arguments for the `hide` event.
29
+ * @param anchor - The host element related to the popover.
30
+ * @param popover - The popover element.
31
+ */
32
+ constructor(anchor, popover) {
33
+ super();
34
+ this.anchor = anchor;
35
+ this.popover = popover;
36
+ }
37
+ }
38
+ /**
39
+ * Arguments for the `shown` event. The `shown` event fires after the popover has opened and its opening animation has finished.
40
+ */
41
+ export class PopoverShownEvent {
42
+ /**
43
+ * @hidden
44
+ * Constructs the event arguments for the `shown` event.
45
+ * @param anchor - The host element related to the popover.
46
+ * @param popover - The popover element.
47
+ */
48
+ constructor(anchor, popover) {
49
+ this.anchor = anchor;
50
+ this.popover = popover;
51
+ }
52
+ }
53
+ /**
54
+ * Arguments for the `hidden` event. The `hidden` event fires after the popover has closed and its closing animation has finished.
55
+ */
56
+ export class PopoverHiddenEvent {
57
+ /**
58
+ * @hidden
59
+ * Constructs the event arguments for the `hidden` event.
60
+ * @param anchor - The host element related to the popover.
61
+ */
62
+ constructor(anchor) {
63
+ this.anchor = anchor;
64
+ }
65
+ }
@@ -0,0 +1,5 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ export {};
@@ -0,0 +1,5 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ export {};
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-tooltip',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1634815104,
12
+ publishDate: 1646231440,
13
13
  version: '',
14
14
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
15
15
  };
@@ -0,0 +1,147 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive } from "@angular/core";
6
+ import { closest } from "@progress/kendo-angular-common";
7
+ import { filter, take } from "rxjs/operators";
8
+ import { PopoverDirectivesBase } from "./directives-base";
9
+ import { PopoverService } from "./popover.service";
10
+ import * as i0 from "@angular/core";
11
+ import * as i1 from "@progress/kendo-angular-popup";
12
+ import * as i2 from "./popover.service";
13
+ /**
14
+ * Represents the [`kendoPopoverAnchor`]({% slug configuration_popover %}#toc-anchordirective) directive.
15
+ * It is used to target an element, which should display a popover on interaction.
16
+ *
17
+ * @example
18
+ * ```ts-no-run
19
+ * <button kendoPopoverAnchor [popover]="myPopover">Show Popover</button>
20
+ * ```
21
+ */
22
+ export class PopoverAnchorDirective extends PopoverDirectivesBase {
23
+ constructor(hostEl, ngZone, popupService, renderer, popoverService) {
24
+ super(ngZone, popupService, renderer);
25
+ this.hostEl = hostEl;
26
+ this.ngZone = ngZone;
27
+ this.popupService = popupService;
28
+ this.renderer = renderer;
29
+ this.popoverService = popoverService;
30
+ this.mouseenterHandler = () => {
31
+ this.controlVisibility(this.hostEl.nativeElement, true);
32
+ };
33
+ this.mouseleaveHandler = () => {
34
+ if (this.isPrevented(this.hostEl.nativeElement, false)) {
35
+ return;
36
+ }
37
+ if (!this._hideSub) {
38
+ this._hideSub = this.popoverService.hidePopover.subscribe((val) => {
39
+ const [isPopoverHovered, isAnchorHovered] = val;
40
+ if (!isPopoverHovered && !isAnchorHovered) {
41
+ this.hide();
42
+ }
43
+ });
44
+ }
45
+ };
46
+ this.focusHandler = () => {
47
+ this.controlVisibility(this.hostEl.nativeElement, true);
48
+ };
49
+ this.blurHandler = (args) => {
50
+ const event = args.domEvent;
51
+ if (this.isPrevented(this.hostEl.nativeElement, false)) {
52
+ return;
53
+ }
54
+ // from anchor to popup focus check
55
+ const isFocusInside = !!closest(event.relatedTarget, (node) => node.classList && node.classList.contains('k-popover'));
56
+ if (!isFocusInside) {
57
+ this.hide();
58
+ }
59
+ if (!this._focusInsideSub) {
60
+ // inside popup focus check
61
+ this._focusInsideSub = this.popoverService.isFocusInsidePopover.pipe(filter(v => v !== null)).subscribe((val) => {
62
+ if (!val) {
63
+ this.hide();
64
+ }
65
+ });
66
+ }
67
+ };
68
+ this._popoverService = this.popoverService;
69
+ }
70
+ /**
71
+ * Shows the Popover. [See example]({% slug programmaticcontrol_popover %})
72
+ */
73
+ show() {
74
+ if (this.popupRef) {
75
+ return;
76
+ }
77
+ this.ngZone.run(() => {
78
+ this.openPopup(this.hostEl);
79
+ });
80
+ this.popupRef.popupAnchorViewportLeave
81
+ .pipe(take(1))
82
+ .subscribe(() => this.hide());
83
+ }
84
+ /**
85
+ * Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
86
+ */
87
+ toggle() {
88
+ if (this.popupRef) {
89
+ this.hide();
90
+ }
91
+ else {
92
+ this.show();
93
+ }
94
+ }
95
+ subscribeToEvents(arr) {
96
+ this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[0].name, () => {
97
+ this.popoverService.emitAnchorState(true, this.hostEl.nativeElement);
98
+ arr[0].handler();
99
+ }));
100
+ this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[1].name, (e) => {
101
+ this.popoverService.emitAnchorState(false, null);
102
+ arr[1].handler({ domEvent: e });
103
+ }));
104
+ }
105
+ subscribeClick() {
106
+ if (this.disposeClickListener) {
107
+ this.disposeClickListener();
108
+ }
109
+ this.disposeClickListener = this.renderer.listen(document, 'click', (e) => {
110
+ this.onClick(e);
111
+ });
112
+ }
113
+ /**
114
+ * @hidden
115
+ */
116
+ onClick(event) {
117
+ const isInsidePopup = !!closest(event.target, (node) => node.classList && node.classList.contains('k-popup'));
118
+ let isAnchor = !!closest(event.target, (node) => node === this.hostEl.nativeElement);
119
+ if (isInsidePopup || (this.popupRef && isAnchor)) {
120
+ return;
121
+ }
122
+ if (isAnchor) {
123
+ // on opening
124
+ this.controlVisibility(this.hostEl.nativeElement, true);
125
+ }
126
+ else {
127
+ // on closing
128
+ this.controlVisibility(this.hostEl.nativeElement, false);
129
+ }
130
+ }
131
+ controlVisibility(anchor, show) {
132
+ if (this.isPrevented(anchor, show)) {
133
+ return;
134
+ }
135
+ show ? this.show() : this.hide();
136
+ }
137
+ }
138
+ PopoverAnchorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PopoverAnchorDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i1.PopupService }, { token: i0.Renderer2 }, { token: i2.PopoverService }], target: i0.ɵɵFactoryTarget.Directive });
139
+ PopoverAnchorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: PopoverAnchorDirective, selector: "[kendoPopoverAnchor]", providers: [PopoverService], exportAs: ["kendoPopoverAnchor"], usesInheritance: true, ngImport: i0 });
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PopoverAnchorDirective, decorators: [{
141
+ type: Directive,
142
+ args: [{
143
+ selector: '[kendoPopoverAnchor]',
144
+ exportAs: 'kendoPopoverAnchor',
145
+ providers: [PopoverService]
146
+ }]
147
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.PopupService }, { type: i0.Renderer2 }, { type: i2.PopoverService }]; } });
@@ -0,0 +1,172 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { Directive, Input } from "@angular/core";
6
+ import { closest } from "@progress/kendo-angular-common";
7
+ import { filter, take } from "rxjs/operators";
8
+ import { closestBySelector } from "../utils";
9
+ import { PopoverDirectivesBase } from './directives-base';
10
+ import { PopoverService } from "./popover.service";
11
+ import * as i0 from "@angular/core";
12
+ import * as i1 from "@progress/kendo-angular-popup";
13
+ import * as i2 from "./popover.service";
14
+ /**
15
+ * Represents the [`kendoPopoverContainer`]({% slug configuration_popover %}#toc-containerdirective) directive.
16
+ * It is used to filter and target multiple elements, which should display a popover on interaction.
17
+ *
18
+ * @example
19
+ * ```ts-no-run
20
+ * <div kendoPopoverContainer [popover]="myPopover" filter=".has-popover">
21
+ * <button class="has-popover">Show Popover</button>
22
+ * <button>Button Without Popover</button>
23
+ * <button class="has-popover">Show Popover</button>
24
+ * </div>
25
+ * ```
26
+ */
27
+ export class PopoverContainerDirective extends PopoverDirectivesBase {
28
+ constructor(wrapperEl, ngZone, popupService, renderer, popoverService) {
29
+ super(ngZone, popupService, renderer);
30
+ this.wrapperEl = wrapperEl;
31
+ this.ngZone = ngZone;
32
+ this.popupService = popupService;
33
+ this.renderer = renderer;
34
+ this.popoverService = popoverService;
35
+ this.mouseenterHandler = (anchor) => {
36
+ this.controlVisibility(anchor, true);
37
+ };
38
+ this.mouseleaveHandler = (args) => {
39
+ const anchor = args.anchor;
40
+ if (this.isPrevented(anchor, false)) {
41
+ return;
42
+ }
43
+ if (!this._hideSub) {
44
+ this._hideSub = this.popoverService.hidePopover.subscribe((val) => {
45
+ const [isPopoverHovered, , isOriginAnchor, currentAnchor] = val;
46
+ if (!isPopoverHovered && !isOriginAnchor) {
47
+ this.hide();
48
+ if (!isOriginAnchor && currentAnchor) {
49
+ this.show(currentAnchor);
50
+ }
51
+ }
52
+ });
53
+ }
54
+ };
55
+ this.focusHandler = (anchor) => {
56
+ this.controlVisibility(anchor, true);
57
+ };
58
+ this.blurHandler = (args) => {
59
+ const anchor = args.anchor;
60
+ const event = args.domEvent;
61
+ if (this.isPrevented(anchor, false)) {
62
+ return;
63
+ }
64
+ // from anchor to popup focus check
65
+ const isFocusInside = !!closest(event.relatedTarget, (node) => node.classList && node.classList.contains('k-popover'));
66
+ if (!isFocusInside) {
67
+ this.hide();
68
+ }
69
+ if (!this._focusInsideSub) {
70
+ // inside popup focus check
71
+ this._focusInsideSub = this.popoverService.isFocusInsidePopover.pipe(filter(v => v !== null)).subscribe((val) => {
72
+ if (!val && !isFocusInside) {
73
+ this.hide();
74
+ }
75
+ });
76
+ }
77
+ };
78
+ this._popoverService = this.popoverService;
79
+ }
80
+ /**
81
+ * Shows the Popover.
82
+ *
83
+ * @param anchor&mdash;Specifies the element that will be used as an anchor. The Popover opens relative to that element. [See example]({% slug programmaticcontrol_popover %})
84
+ */
85
+ show(anchor) {
86
+ if (this.popupRef) {
87
+ return;
88
+ }
89
+ this.ngZone.run(() => {
90
+ this.openPopup(anchor);
91
+ });
92
+ this.popupRef.popupAnchorViewportLeave
93
+ .pipe(take(1))
94
+ .subscribe(() => this.hide());
95
+ }
96
+ /**
97
+ * Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
98
+ *
99
+ * @param anchor&mdash;Specifies the element that will be used as an anchor. The Popover opens relative to that element.
100
+ */
101
+ toggle(anchor) {
102
+ const previousAnchor = this.popupRef && this.popupRef.content.instance.anchor;
103
+ if (this.popupRef) {
104
+ this.hide();
105
+ if (previousAnchor !== anchor) {
106
+ this.show(anchor);
107
+ }
108
+ }
109
+ else {
110
+ this.show(anchor);
111
+ }
112
+ }
113
+ subscribeClick() {
114
+ if (this.disposeClickListener) {
115
+ this.disposeClickListener();
116
+ }
117
+ this.disposeClickListener = this.renderer.listen(document, 'click', (e) => {
118
+ const filterElement = closestBySelector(e.target, this.filter);
119
+ this.clickHandler(filterElement, e);
120
+ });
121
+ }
122
+ subscribeToEvents(arr) {
123
+ const filteredElements = Array.from(document.querySelectorAll(this.filter));
124
+ filteredElements.forEach((el) => {
125
+ this.subs.add(this.renderer.listen(el, arr[0].name, () => {
126
+ this.popoverService.emitAnchorState(true, el);
127
+ arr[0].handler(el);
128
+ }));
129
+ this.subs.add(this.renderer.listen(el, arr[1].name, (e) => {
130
+ this.popoverService.emitAnchorState(false, null);
131
+ arr[1].handler({ anchor: el, domEvent: e });
132
+ }));
133
+ });
134
+ }
135
+ clickHandler(anchor, event) {
136
+ const isInsidePopup = !!closest(event.target, (node) => node.classList && node.classList.contains('k-popup'));
137
+ const popupRefAnchor = this.popupRef && this.popupRef.content.instance.anchor;
138
+ let isOriginAnchor = !!closest(event.target, (node) => node === (popupRefAnchor ? popupRefAnchor : anchor));
139
+ if (this.showOn !== 'click' || isInsidePopup || (this.popupRef && isOriginAnchor)) {
140
+ return;
141
+ }
142
+ if (!anchor && this.popupRef) {
143
+ this.controlVisibility(anchor, false);
144
+ return;
145
+ }
146
+ if (isOriginAnchor) {
147
+ this.controlVisibility(anchor, true);
148
+ }
149
+ else if (this.popupRef) {
150
+ this.controlVisibility(anchor, false);
151
+ this.controlVisibility(anchor, true);
152
+ }
153
+ }
154
+ controlVisibility(anchor, show) {
155
+ if (this.isPrevented(anchor, show)) {
156
+ return;
157
+ }
158
+ show ? this.show(anchor) : this.hide();
159
+ }
160
+ }
161
+ PopoverContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PopoverContainerDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i1.PopupService }, { token: i0.Renderer2 }, { token: i2.PopoverService }], target: i0.ɵɵFactoryTarget.Directive });
162
+ PopoverContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: PopoverContainerDirective, selector: "[kendoPopoverContainer]", inputs: { filter: "filter" }, providers: [PopoverService], exportAs: ["kendoPopoverContainer"], usesInheritance: true, ngImport: i0 });
163
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PopoverContainerDirective, decorators: [{
164
+ type: Directive,
165
+ args: [{
166
+ selector: '[kendoPopoverContainer]',
167
+ exportAs: 'kendoPopoverContainer',
168
+ providers: [PopoverService]
169
+ }]
170
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.PopupService }, { type: i0.Renderer2 }, { type: i2.PopoverService }]; }, propDecorators: { filter: [{
171
+ type: Input
172
+ }] } });