@progress/kendo-angular-tooltip 3.0.2-dev.202105121258 → 3.1.0-dev.202201182021

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 (141) hide show
  1. package/LICENSE.md +1 -1
  2. package/NOTICE.txt +119 -79
  3. package/README.md +1 -1
  4. package/dist/cdn/js/kendo-angular-tooltip.js +3 -3
  5. package/dist/cdn/main.js +2 -2
  6. package/dist/es/constants.d.ts +12 -0
  7. package/dist/es/constants.js +12 -0
  8. package/dist/es/index.d.ts +5 -3
  9. package/dist/es/index.js +3 -1
  10. package/dist/es/index.metadata.json +1 -1
  11. package/dist/es/localization/localized-messages.directive.d.ts +1 -1
  12. package/dist/es/localization/localized-messages.directive.js +1 -1
  13. package/dist/es/main.d.ts +17 -3
  14. package/dist/es/main.js +13 -2
  15. package/dist/es/models/animation.model.d.ts +9 -0
  16. package/dist/es/models/animation.model.js +4 -0
  17. package/dist/es/models/events.d.ts +78 -0
  18. package/dist/es/models/events.js +78 -0
  19. package/dist/es/models/functions.model.d.ts +17 -0
  20. package/dist/es/models/functions.model.js +4 -0
  21. package/dist/es/models/popover-show-option.type.d.ts +8 -0
  22. package/dist/es/models/popover-show-option.type.js +4 -0
  23. package/dist/es/models/position.type.d.ts +2 -2
  24. package/dist/es/models/position.type.js +1 -1
  25. package/dist/es/models/show.option.type.d.ts +1 -1
  26. package/dist/es/models/show.option.type.js +1 -1
  27. package/dist/es/package-metadata.d.ts +1 -1
  28. package/dist/es/package-metadata.js +2 -2
  29. package/dist/es/popover/anchor.directive.d.ts +44 -0
  30. package/dist/es/popover/anchor.directive.js +150 -0
  31. package/dist/es/popover/container.directive.d.ts +56 -0
  32. package/dist/es/popover/container.directive.js +176 -0
  33. package/dist/es/popover/directives-base.d.ts +87 -0
  34. package/dist/es/popover/directives-base.js +274 -0
  35. package/dist/es/popover/popover.component.d.ts +166 -0
  36. package/dist/es/popover/popover.component.js +300 -0
  37. package/dist/es/popover/popover.service.d.ts +30 -0
  38. package/dist/es/popover/popover.service.js +88 -0
  39. package/dist/es/popover/template-directives/actions-template.directive.d.ts +15 -0
  40. package/dist/es/popover/template-directives/actions-template.directive.js +26 -0
  41. package/dist/es/popover/template-directives/body-template.directive.d.ts +15 -0
  42. package/dist/es/popover/template-directives/body-template.directive.js +26 -0
  43. package/dist/es/popover/template-directives/title-template.directive.d.ts +15 -0
  44. package/dist/es/popover/template-directives/title-template.directive.js +26 -0
  45. package/dist/es/popover.module.d.ts +31 -0
  46. package/dist/es/popover.module.js +65 -0
  47. package/dist/es/tooltip/tooltip.content.component.d.ts +1 -1
  48. package/dist/es/tooltip/tooltip.content.component.js +1 -1
  49. package/dist/es/tooltip/tooltip.directive.d.ts +1 -1
  50. package/dist/es/tooltip/tooltip.directive.js +5 -5
  51. package/dist/es/tooltip/tooltip.settings.d.ts +1 -1
  52. package/dist/es/tooltip/tooltip.settings.js +1 -1
  53. package/dist/es/tooltip.module.d.ts +1 -1
  54. package/dist/es/tooltip.module.js +1 -1
  55. package/dist/es/tooltips.module.d.ts +32 -0
  56. package/dist/es/tooltips.module.js +45 -0
  57. package/dist/es/utils.d.ts +2 -2
  58. package/dist/es/utils.js +2 -2
  59. package/dist/es2015/constants.d.ts +12 -0
  60. package/dist/es2015/constants.js +12 -0
  61. package/dist/es2015/index.d.ts +3 -1
  62. package/dist/es2015/index.js +3 -1
  63. package/dist/es2015/index.metadata.json +1 -1
  64. package/dist/es2015/localization/localized-messages.directive.d.ts +1 -1
  65. package/dist/es2015/localization/localized-messages.directive.js +1 -1
  66. package/dist/es2015/main.d.ts +17 -3
  67. package/dist/es2015/main.js +13 -2
  68. package/dist/es2015/models/animation.model.d.ts +9 -0
  69. package/dist/es2015/models/animation.model.js +4 -0
  70. package/dist/es2015/models/events.d.ts +78 -0
  71. package/dist/es2015/models/events.js +65 -0
  72. package/dist/es2015/models/functions.model.d.ts +17 -0
  73. package/dist/es2015/models/functions.model.js +4 -0
  74. package/dist/es2015/models/popover-show-option.type.d.ts +8 -0
  75. package/dist/es2015/models/popover-show-option.type.js +4 -0
  76. package/dist/es2015/models/position.type.d.ts +2 -2
  77. package/dist/es2015/models/position.type.js +1 -1
  78. package/dist/es2015/models/show.option.type.d.ts +1 -1
  79. package/dist/es2015/models/show.option.type.js +1 -1
  80. package/dist/es2015/package-metadata.d.ts +1 -1
  81. package/dist/es2015/package-metadata.js +2 -2
  82. package/dist/es2015/popover/anchor.directive.d.ts +44 -0
  83. package/dist/es2015/popover/anchor.directive.js +144 -0
  84. package/dist/es2015/popover/container.directive.d.ts +56 -0
  85. package/dist/es2015/popover/container.directive.js +171 -0
  86. package/dist/es2015/popover/directives-base.d.ts +87 -0
  87. package/dist/es2015/popover/directives-base.js +259 -0
  88. package/dist/es2015/popover/popover.component.d.ts +166 -0
  89. package/dist/es2015/popover/popover.component.js +304 -0
  90. package/dist/es2015/popover/popover.service.d.ts +30 -0
  91. package/dist/es2015/popover/popover.service.js +67 -0
  92. package/dist/es2015/popover/template-directives/actions-template.directive.d.ts +15 -0
  93. package/dist/es2015/popover/template-directives/actions-template.directive.js +25 -0
  94. package/dist/es2015/popover/template-directives/body-template.directive.d.ts +15 -0
  95. package/dist/es2015/popover/template-directives/body-template.directive.js +25 -0
  96. package/dist/es2015/popover/template-directives/title-template.directive.d.ts +15 -0
  97. package/dist/es2015/popover/template-directives/title-template.directive.js +25 -0
  98. package/dist/es2015/popover.module.d.ts +31 -0
  99. package/dist/es2015/popover.module.js +63 -0
  100. package/dist/es2015/tooltip/tooltip.content.component.d.ts +1 -1
  101. package/dist/es2015/tooltip/tooltip.content.component.js +1 -1
  102. package/dist/es2015/tooltip/tooltip.directive.d.ts +1 -1
  103. package/dist/es2015/tooltip/tooltip.directive.js +5 -5
  104. package/dist/es2015/tooltip/tooltip.settings.d.ts +1 -1
  105. package/dist/es2015/tooltip/tooltip.settings.js +1 -1
  106. package/dist/es2015/tooltip.module.d.ts +1 -1
  107. package/dist/es2015/tooltip.module.js +1 -1
  108. package/dist/es2015/tooltips.module.d.ts +32 -0
  109. package/dist/es2015/tooltips.module.js +42 -0
  110. package/dist/es2015/utils.d.ts +2 -2
  111. package/dist/es2015/utils.js +2 -2
  112. package/dist/fesm2015/index.js +1111 -10
  113. package/dist/fesm5/index.js +1169 -10
  114. package/dist/npm/constants.js +14 -0
  115. package/dist/npm/index.js +5 -1
  116. package/dist/npm/localization/localized-messages.directive.js +1 -1
  117. package/dist/npm/main.js +26 -3
  118. package/dist/npm/models/animation.model.js +6 -0
  119. package/dist/npm/models/events.js +80 -0
  120. package/dist/npm/models/functions.model.js +6 -0
  121. package/dist/npm/models/popover-show-option.type.js +6 -0
  122. package/dist/npm/models/position.type.js +1 -1
  123. package/dist/npm/models/show.option.type.js +1 -1
  124. package/dist/npm/package-metadata.js +2 -2
  125. package/dist/npm/popover/anchor.directive.js +152 -0
  126. package/dist/npm/popover/container.directive.js +178 -0
  127. package/dist/npm/popover/directives-base.js +276 -0
  128. package/dist/npm/popover/popover.component.js +302 -0
  129. package/dist/npm/popover/popover.service.js +90 -0
  130. package/dist/npm/popover/template-directives/actions-template.directive.js +28 -0
  131. package/dist/npm/popover/template-directives/body-template.directive.js +28 -0
  132. package/dist/npm/popover/template-directives/title-template.directive.js +28 -0
  133. package/dist/npm/popover.module.js +67 -0
  134. package/dist/npm/tooltip/tooltip.content.component.js +1 -1
  135. package/dist/npm/tooltip/tooltip.directive.js +4 -4
  136. package/dist/npm/tooltip/tooltip.settings.js +1 -1
  137. package/dist/npm/tooltip.module.js +1 -1
  138. package/dist/npm/tooltips.module.js +47 -0
  139. package/dist/npm/utils.js +3 -3
  140. package/dist/systemjs/kendo-angular-tooltip.js +2 -2
  141. package/package.json +23 -19
@@ -0,0 +1,78 @@
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 * as tslib_1 from "tslib";
6
+ import { PreventableEvent } from "@progress/kendo-angular-common";
7
+ /**
8
+ * Arguments for the `show` event. The `show` event fires when a popover is about
9
+ * to be opened. If you cancel the event, the opening is prevented.
10
+ */
11
+ var PopoverShowEvent = /** @class */ (function (_super) {
12
+ tslib_1.__extends(PopoverShowEvent, _super);
13
+ /**
14
+ * @hidden
15
+ * Constructs the event arguments for the `show` event.
16
+ * @param anchor - The host element related to the popover.
17
+ */
18
+ function PopoverShowEvent(anchor) {
19
+ var _this = _super.call(this) || this;
20
+ _this.anchor = anchor;
21
+ return _this;
22
+ }
23
+ return PopoverShowEvent;
24
+ }(PreventableEvent));
25
+ export { PopoverShowEvent };
26
+ /**
27
+ * Arguments for the `hide` event. The `hide` event fires when a popover is about
28
+ * to be closed. If you cancel the event, the popover stays open.
29
+ */
30
+ var PopoverHideEvent = /** @class */ (function (_super) {
31
+ tslib_1.__extends(PopoverHideEvent, _super);
32
+ /**
33
+ * @hidden
34
+ * Constructs the event arguments for the `hide` event.
35
+ * @param anchor - The host element related to the popover.
36
+ * @param popover - The popover element.
37
+ */
38
+ function PopoverHideEvent(anchor, popover) {
39
+ var _this = _super.call(this) || this;
40
+ _this.anchor = anchor;
41
+ _this.popover = popover;
42
+ return _this;
43
+ }
44
+ return PopoverHideEvent;
45
+ }(PreventableEvent));
46
+ export { PopoverHideEvent };
47
+ /**
48
+ * Arguments for the `shown` event. The `shown` event fires after the popover has opened and its opening animation has finished.
49
+ */
50
+ var PopoverShownEvent = /** @class */ (function () {
51
+ /**
52
+ * @hidden
53
+ * Constructs the event arguments for the `shown` event.
54
+ * @param anchor - The host element related to the popover.
55
+ * @param popover - The popover element.
56
+ */
57
+ function PopoverShownEvent(anchor, popover) {
58
+ this.anchor = anchor;
59
+ this.popover = popover;
60
+ }
61
+ return PopoverShownEvent;
62
+ }());
63
+ export { PopoverShownEvent };
64
+ /**
65
+ * Arguments for the `hidden` event. The `hidden` event fires after the popover has closed and its closing animation has finished.
66
+ */
67
+ var PopoverHiddenEvent = /** @class */ (function () {
68
+ /**
69
+ * @hidden
70
+ * Constructs the event arguments for the `hidden` event.
71
+ * @param anchor - The host element related to the popover.
72
+ */
73
+ function PopoverHiddenEvent(anchor) {
74
+ this.anchor = anchor;
75
+ }
76
+ return PopoverHiddenEvent;
77
+ }());
78
+ export { PopoverHiddenEvent };
@@ -0,0 +1,17 @@
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 { PopoverComponent } from "../popover/popover.component";
6
+ /**
7
+ * Represents a callback that is used by the [popover]({% slug api_tooltip_popoveranchordirective %}#toc-popover) property.
8
+ * It returns the popover instance to be displayed.
9
+ * ([see example]({% slug callbacks_popover %}#toc-popoverfn))
10
+ */
11
+ export declare type PopoverFn = (anchor: Element) => PopoverComponent;
12
+ /**
13
+ * Represents the callback that is used by the [`templateData`]({% slug api_popovercomponent %}#toc-templateData) property.
14
+ * It returns the custom data that will be passed to the popover templates.
15
+ * ([see example]({% slug callbacks_popover %}#toc-popoverdatafn))
16
+ */
17
+ export declare type PopoverDataFn = (anchor: Element) => any;
@@ -0,0 +1,4 @@
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
+ *-------------------------------------------------------------------------------------------*/
@@ -0,0 +1,8 @@
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
+ /**
6
+ * Specifies the possible events on which the Popover could be shown.
7
+ */
8
+ export declare type PopoverShowOption = 'hover' | 'click' | 'none' | 'focus';
@@ -0,0 +1,4 @@
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
+ *-------------------------------------------------------------------------------------------*/
@@ -1,9 +1,9 @@
1
1
  /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2020 Progress Software Corporation. All rights reserved.
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  /**
6
- * Specifies the position of the Tooltip in relation to the anchor element.
6
+ * Specifies the position of the Tooltip or Popover in relation to the anchor element.
7
7
  *
8
8
  * The available options are:
9
9
  * - `top` (default)—Aligns the tooltip above the `anchor` element.
@@ -1,4 +1,4 @@
1
1
  /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2020 Progress Software Corporation. All rights reserved.
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
@@ -1,5 +1,5 @@
1
1
  /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2020 Progress Software Corporation. All rights reserved.
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  /**
@@ -1,4 +1,4 @@
1
1
  /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2020 Progress Software Corporation. All rights reserved.
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
@@ -1,5 +1,5 @@
1
1
  /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2020 Progress Software Corporation. All rights reserved.
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { PackageMetadata } from '@progress/kendo-licensing';
@@ -1,5 +1,5 @@
1
1
  /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2020 Progress Software Corporation. All rights reserved.
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  /**
@@ -9,7 +9,7 @@ export var packageMetadata = {
9
9
  name: '@progress/kendo-angular-tooltip',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1620824286,
12
+ publishDate: 1642537195,
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,44 @@
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 { ElementRef, NgZone, Renderer2 } from "@angular/core";
6
+ import { PopupService } from "@progress/kendo-angular-popup";
7
+ import { PopoverDirectivesBase } from "./directives-base";
8
+ import { PopoverService } from "./popover.service";
9
+ /**
10
+ * Represents the [`kendoPopoverAnchor`]({% slug configuration_popover %}#toc-anchordirective) directive.
11
+ * It is used to target an element, which should display a popover on interaction.
12
+ *
13
+ * @example
14
+ * ```ts-no-run
15
+ * <button kendoPopoverAnchor [popover]="myPopover">Show Popover</button>
16
+ * ```
17
+ */
18
+ export declare class PopoverAnchorDirective extends PopoverDirectivesBase {
19
+ protected hostEl: ElementRef;
20
+ protected ngZone: NgZone;
21
+ protected popupService: PopupService;
22
+ protected renderer: Renderer2;
23
+ protected popoverService: PopoverService;
24
+ constructor(hostEl: ElementRef, ngZone: NgZone, popupService: PopupService, renderer: Renderer2, popoverService: PopoverService);
25
+ /**
26
+ * Shows the Popover. [See example]({% slug programmaticcontrol_popover %})
27
+ */
28
+ show(): void;
29
+ /**
30
+ * Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
31
+ */
32
+ toggle(): void;
33
+ protected subscribeToEvents(arr: any[]): void;
34
+ protected subscribeClick(): void;
35
+ protected mouseenterHandler: () => void;
36
+ protected mouseleaveHandler: () => void;
37
+ protected focusHandler: () => void;
38
+ protected blurHandler: (args: any) => void;
39
+ /**
40
+ * @hidden
41
+ */
42
+ private onClick;
43
+ private controlVisibility;
44
+ }
@@ -0,0 +1,150 @@
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 * as tslib_1 from "tslib";
6
+ import { Directive, ElementRef, NgZone, Renderer2 } from "@angular/core";
7
+ import { closest } from "@progress/kendo-angular-common";
8
+ import { PopupService } from "@progress/kendo-angular-popup";
9
+ import { filter } from "rxjs/operators";
10
+ import { PopoverDirectivesBase } from "./directives-base";
11
+ import { PopoverService } from "./popover.service";
12
+ /**
13
+ * Represents the [`kendoPopoverAnchor`]({% slug configuration_popover %}#toc-anchordirective) directive.
14
+ * It is used to target an element, which should display a popover on interaction.
15
+ *
16
+ * @example
17
+ * ```ts-no-run
18
+ * <button kendoPopoverAnchor [popover]="myPopover">Show Popover</button>
19
+ * ```
20
+ */
21
+ var PopoverAnchorDirective = /** @class */ (function (_super) {
22
+ tslib_1.__extends(PopoverAnchorDirective, _super);
23
+ function PopoverAnchorDirective(hostEl, ngZone, popupService, renderer, popoverService) {
24
+ var _this = _super.call(this, ngZone, popupService, renderer) || this;
25
+ _this.hostEl = hostEl;
26
+ _this.ngZone = ngZone;
27
+ _this.popupService = popupService;
28
+ _this.renderer = renderer;
29
+ _this.popoverService = popoverService;
30
+ _this.mouseenterHandler = function () {
31
+ _this.controlVisibility(_this.hostEl.nativeElement, true);
32
+ };
33
+ _this.mouseleaveHandler = function () {
34
+ if (_this.isPrevented(_this.hostEl.nativeElement, false)) {
35
+ return;
36
+ }
37
+ if (!_this._hideSub) {
38
+ _this._hideSub = _this.popoverService.hidePopover.subscribe(function (val) {
39
+ var isPopoverHovered = val[0], isAnchorHovered = val[1];
40
+ if (!isPopoverHovered && !isAnchorHovered) {
41
+ _this.hide();
42
+ }
43
+ });
44
+ }
45
+ };
46
+ _this.focusHandler = function () {
47
+ _this.controlVisibility(_this.hostEl.nativeElement, true);
48
+ };
49
+ _this.blurHandler = function (args) {
50
+ var event = args.domEvent;
51
+ if (_this.isPrevented(_this.hostEl.nativeElement, false)) {
52
+ return;
53
+ }
54
+ // from anchor to popup focus check
55
+ var isFocusInside = !!closest(event.relatedTarget, function (node) { return 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(function (v) { return v !== null; })).subscribe(function (val) {
62
+ if (!val) {
63
+ _this.hide();
64
+ }
65
+ });
66
+ }
67
+ };
68
+ _this._popoverService = _this.popoverService;
69
+ return _this;
70
+ }
71
+ /**
72
+ * Shows the Popover. [See example]({% slug programmaticcontrol_popover %})
73
+ */
74
+ PopoverAnchorDirective.prototype.show = function () {
75
+ if (this.popupRef) {
76
+ return;
77
+ }
78
+ this.openPopup(this.hostEl.nativeElement);
79
+ };
80
+ /**
81
+ * Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
82
+ */
83
+ PopoverAnchorDirective.prototype.toggle = function () {
84
+ if (this.popupRef) {
85
+ this.hide();
86
+ }
87
+ else {
88
+ this.show();
89
+ }
90
+ };
91
+ PopoverAnchorDirective.prototype.subscribeToEvents = function (arr) {
92
+ var _this = this;
93
+ this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[0].name, function () {
94
+ _this.popoverService.emitAnchorState(true, _this.hostEl.nativeElement);
95
+ arr[0].handler();
96
+ }));
97
+ this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[1].name, function (e) {
98
+ _this.popoverService.emitAnchorState(false, null);
99
+ arr[1].handler({ domEvent: e });
100
+ }));
101
+ };
102
+ PopoverAnchorDirective.prototype.subscribeClick = function () {
103
+ var _this = this;
104
+ if (this.disposeClickListener) {
105
+ this.disposeClickListener();
106
+ }
107
+ this.disposeClickListener = this.renderer.listen(document, 'click', function (e) {
108
+ _this.onClick(e);
109
+ });
110
+ };
111
+ /**
112
+ * @hidden
113
+ */
114
+ PopoverAnchorDirective.prototype.onClick = function (event) {
115
+ var _this = this;
116
+ var isInsidePopup = !!closest(event.target, function (node) { return node.classList && node.classList.contains('k-popup'); });
117
+ var isAnchor = !!closest(event.target, function (node) { return node === _this.hostEl.nativeElement; });
118
+ if (isInsidePopup || (this.popupRef && isAnchor)) {
119
+ return;
120
+ }
121
+ if (isAnchor) {
122
+ // on opening
123
+ this.controlVisibility(this.hostEl.nativeElement, true);
124
+ }
125
+ else {
126
+ // on closing
127
+ this.controlVisibility(this.hostEl.nativeElement, false);
128
+ }
129
+ };
130
+ PopoverAnchorDirective.prototype.controlVisibility = function (anchor, show) {
131
+ if (this.isPrevented(anchor, show)) {
132
+ return;
133
+ }
134
+ show ? this.show() : this.hide();
135
+ };
136
+ PopoverAnchorDirective = tslib_1.__decorate([
137
+ Directive({
138
+ selector: '[kendoPopoverAnchor]',
139
+ exportAs: 'kendoPopoverAnchor',
140
+ providers: [PopoverService]
141
+ }),
142
+ tslib_1.__metadata("design:paramtypes", [ElementRef,
143
+ NgZone,
144
+ PopupService,
145
+ Renderer2,
146
+ PopoverService])
147
+ ], PopoverAnchorDirective);
148
+ return PopoverAnchorDirective;
149
+ }(PopoverDirectivesBase));
150
+ export { PopoverAnchorDirective };
@@ -0,0 +1,56 @@
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 { ElementRef, NgZone, Renderer2 } from "@angular/core";
6
+ import { PopupService } from "@progress/kendo-angular-popup";
7
+ import { PopoverDirectivesBase } from './directives-base';
8
+ import { PopoverService } from "./popover.service";
9
+ /**
10
+ * Represents the [`kendoPopoverContainer`]({% slug configuration_popover %}#toc-containerdirective) directive.
11
+ * It is used to filter and target multiple elements, which should display a popover on interaction.
12
+ *
13
+ * @example
14
+ * ```ts-no-run
15
+ * <div kendoPopoverContainer [popover]="myPopover" filter=".has-popover">
16
+ * <button class="has-popover">Show Popover</button>
17
+ * <button>Button Without Popover</button>
18
+ * <button class="has-popover">Show Popover</button>
19
+ * </div>
20
+ * ```
21
+ */
22
+ export declare class PopoverContainerDirective extends PopoverDirectivesBase {
23
+ wrapperEl: ElementRef;
24
+ protected ngZone: NgZone;
25
+ protected popupService: PopupService;
26
+ protected renderer: Renderer2;
27
+ protected popoverService: PopoverService;
28
+ /**
29
+ * Specifies a selector for the elements that should display a popover.
30
+ *
31
+ * The possible values include any valid query selector.
32
+ * [See example]({% slug configuration_popover %}#toc-containerdirective)
33
+ */
34
+ filter: string;
35
+ constructor(wrapperEl: ElementRef, ngZone: NgZone, popupService: PopupService, renderer: Renderer2, popoverService: PopoverService);
36
+ /**
37
+ * Shows the Popover.
38
+ *
39
+ * @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 %})
40
+ */
41
+ show(anchor: Element | ElementRef): void;
42
+ /**
43
+ * Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
44
+ *
45
+ * @param anchor&mdash;Specifies the element that will be used as an anchor. The Popover opens relative to that element.
46
+ */
47
+ toggle(anchor: Element | ElementRef): void;
48
+ protected subscribeClick(): void;
49
+ protected mouseenterHandler: (anchor: Element) => void;
50
+ protected mouseleaveHandler: (args: any) => void;
51
+ protected focusHandler: (anchor: Element) => void;
52
+ protected blurHandler: (args: any) => void;
53
+ protected subscribeToEvents(arr: any[]): void;
54
+ private clickHandler;
55
+ private controlVisibility;
56
+ }
@@ -0,0 +1,176 @@
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 * as tslib_1 from "tslib";
6
+ import { Directive, ElementRef, Input, NgZone, Renderer2 } from "@angular/core";
7
+ import { closest } from "@progress/kendo-angular-common";
8
+ import { PopupService } from "@progress/kendo-angular-popup";
9
+ import { filter } from "rxjs/operators";
10
+ import { closestBySelector } from "../utils";
11
+ import { PopoverDirectivesBase } from './directives-base';
12
+ import { PopoverService } from "./popover.service";
13
+ /**
14
+ * Represents the [`kendoPopoverContainer`]({% slug configuration_popover %}#toc-containerdirective) directive.
15
+ * It is used to filter and target multiple elements, which should display a popover on interaction.
16
+ *
17
+ * @example
18
+ * ```ts-no-run
19
+ * <div kendoPopoverContainer [popover]="myPopover" filter=".has-popover">
20
+ * <button class="has-popover">Show Popover</button>
21
+ * <button>Button Without Popover</button>
22
+ * <button class="has-popover">Show Popover</button>
23
+ * </div>
24
+ * ```
25
+ */
26
+ var PopoverContainerDirective = /** @class */ (function (_super) {
27
+ tslib_1.__extends(PopoverContainerDirective, _super);
28
+ function PopoverContainerDirective(wrapperEl, ngZone, popupService, renderer, popoverService) {
29
+ var _this = _super.call(this, ngZone, popupService, renderer) || this;
30
+ _this.wrapperEl = wrapperEl;
31
+ _this.ngZone = ngZone;
32
+ _this.popupService = popupService;
33
+ _this.renderer = renderer;
34
+ _this.popoverService = popoverService;
35
+ _this.mouseenterHandler = function (anchor) {
36
+ _this.controlVisibility(anchor, true);
37
+ };
38
+ _this.mouseleaveHandler = function (args) {
39
+ var anchor = args.anchor;
40
+ if (_this.isPrevented(anchor, false)) {
41
+ return;
42
+ }
43
+ if (!_this._hideSub) {
44
+ _this._hideSub = _this.popoverService.hidePopover.subscribe(function (val) {
45
+ var isPopoverHovered = val[0], isOriginAnchor = val[2], currentAnchor = val[3];
46
+ if (!isPopoverHovered && !isOriginAnchor) {
47
+ _this.hide();
48
+ if (!isOriginAnchor && currentAnchor) {
49
+ _this.show(currentAnchor);
50
+ }
51
+ }
52
+ });
53
+ }
54
+ };
55
+ _this.focusHandler = function (anchor) {
56
+ _this.controlVisibility(anchor, true);
57
+ };
58
+ _this.blurHandler = function (args) {
59
+ var anchor = args.anchor;
60
+ var event = args.domEvent;
61
+ if (_this.isPrevented(anchor, false)) {
62
+ return;
63
+ }
64
+ // from anchor to popup focus check
65
+ var isFocusInside = !!closest(event.relatedTarget, function (node) { return 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(function (v) { return v !== null; })).subscribe(function (val) {
72
+ if (!val && !isFocusInside) {
73
+ _this.hide();
74
+ }
75
+ });
76
+ }
77
+ };
78
+ _this._popoverService = _this.popoverService;
79
+ return _this;
80
+ }
81
+ /**
82
+ * Shows the Popover.
83
+ *
84
+ * @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 %})
85
+ */
86
+ PopoverContainerDirective.prototype.show = function (anchor) {
87
+ if (this.popupRef) {
88
+ return;
89
+ }
90
+ this.openPopup(anchor);
91
+ };
92
+ /**
93
+ * Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
94
+ *
95
+ * @param anchor&mdash;Specifies the element that will be used as an anchor. The Popover opens relative to that element.
96
+ */
97
+ PopoverContainerDirective.prototype.toggle = function (anchor) {
98
+ var previousAnchor = this.popupRef && this.popupRef.content.instance.anchor;
99
+ if (this.popupRef) {
100
+ this.hide();
101
+ if (previousAnchor !== anchor) {
102
+ this.show(anchor);
103
+ }
104
+ }
105
+ else {
106
+ this.show(anchor);
107
+ }
108
+ };
109
+ PopoverContainerDirective.prototype.subscribeClick = function () {
110
+ var _this = this;
111
+ if (this.disposeClickListener) {
112
+ this.disposeClickListener();
113
+ }
114
+ this.disposeClickListener = this.renderer.listen(document, 'click', function (e) {
115
+ var filterElement = closestBySelector(e.target, _this.filter);
116
+ _this.clickHandler(filterElement, e);
117
+ });
118
+ };
119
+ PopoverContainerDirective.prototype.subscribeToEvents = function (arr) {
120
+ var _this = this;
121
+ var filteredElements = Array.from(document.querySelectorAll(this.filter));
122
+ filteredElements.forEach(function (el) {
123
+ _this.subs.add(_this.renderer.listen(el, arr[0].name, function () {
124
+ _this.popoverService.emitAnchorState(true, el);
125
+ arr[0].handler(el);
126
+ }));
127
+ _this.subs.add(_this.renderer.listen(el, arr[1].name, function (e) {
128
+ _this.popoverService.emitAnchorState(false, null);
129
+ arr[1].handler({ anchor: el, domEvent: e });
130
+ }));
131
+ });
132
+ };
133
+ PopoverContainerDirective.prototype.clickHandler = function (anchor, event) {
134
+ var isInsidePopup = !!closest(event.target, function (node) { return node.classList && node.classList.contains('k-popup'); });
135
+ var popupRefAnchor = this.popupRef && this.popupRef.content.instance.anchor;
136
+ var isOriginAnchor = !!closest(event.target, function (node) { return node === (popupRefAnchor ? popupRefAnchor : anchor); });
137
+ if (this.showOn !== 'click' || isInsidePopup || (this.popupRef && isOriginAnchor)) {
138
+ return;
139
+ }
140
+ if (!anchor && this.popupRef) {
141
+ this.controlVisibility(anchor, false);
142
+ return;
143
+ }
144
+ if (isOriginAnchor) {
145
+ this.controlVisibility(anchor, true);
146
+ }
147
+ else if (this.popupRef) {
148
+ this.controlVisibility(anchor, false);
149
+ this.controlVisibility(anchor, true);
150
+ }
151
+ };
152
+ PopoverContainerDirective.prototype.controlVisibility = function (anchor, show) {
153
+ if (this.isPrevented(anchor, show)) {
154
+ return;
155
+ }
156
+ show ? this.show(anchor) : this.hide();
157
+ };
158
+ tslib_1.__decorate([
159
+ Input(),
160
+ tslib_1.__metadata("design:type", String)
161
+ ], PopoverContainerDirective.prototype, "filter", void 0);
162
+ PopoverContainerDirective = tslib_1.__decorate([
163
+ Directive({
164
+ selector: '[kendoPopoverContainer]',
165
+ exportAs: 'kendoPopoverContainer',
166
+ providers: [PopoverService]
167
+ }),
168
+ tslib_1.__metadata("design:paramtypes", [ElementRef,
169
+ NgZone,
170
+ PopupService,
171
+ Renderer2,
172
+ PopoverService])
173
+ ], PopoverContainerDirective);
174
+ return PopoverContainerDirective;
175
+ }(PopoverDirectivesBase));
176
+ export { PopoverContainerDirective };