@progress/kendo-angular-tooltip 3.0.3 → 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 (109) 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 +2 -2
  5. package/dist/cdn/main.js +1 -1
  6. package/dist/es/constants.d.ts +12 -0
  7. package/dist/es/constants.js +12 -0
  8. package/dist/es/index.d.ts +4 -2
  9. package/dist/es/index.js +2 -0
  10. package/dist/es/index.metadata.json +1 -1
  11. package/dist/es/main.d.ts +16 -2
  12. package/dist/es/main.js +12 -1
  13. package/dist/es/models/animation.model.d.ts +9 -0
  14. package/dist/es/models/animation.model.js +4 -0
  15. package/dist/es/models/events.d.ts +78 -0
  16. package/dist/es/models/events.js +78 -0
  17. package/dist/es/models/functions.model.d.ts +17 -0
  18. package/dist/es/models/functions.model.js +4 -0
  19. package/dist/es/models/popover-show-option.type.d.ts +8 -0
  20. package/dist/es/models/popover-show-option.type.js +4 -0
  21. package/dist/es/models/position.type.d.ts +1 -1
  22. package/dist/es/package-metadata.js +1 -1
  23. package/dist/es/popover/anchor.directive.d.ts +44 -0
  24. package/dist/es/popover/anchor.directive.js +150 -0
  25. package/dist/es/popover/container.directive.d.ts +56 -0
  26. package/dist/es/popover/container.directive.js +176 -0
  27. package/dist/es/popover/directives-base.d.ts +87 -0
  28. package/dist/es/popover/directives-base.js +274 -0
  29. package/dist/es/popover/popover.component.d.ts +166 -0
  30. package/dist/es/popover/popover.component.js +300 -0
  31. package/dist/es/popover/popover.service.d.ts +30 -0
  32. package/dist/es/popover/popover.service.js +88 -0
  33. package/dist/es/popover/template-directives/actions-template.directive.d.ts +15 -0
  34. package/dist/es/popover/template-directives/actions-template.directive.js +26 -0
  35. package/dist/es/popover/template-directives/body-template.directive.d.ts +15 -0
  36. package/dist/es/popover/template-directives/body-template.directive.js +26 -0
  37. package/dist/es/popover/template-directives/title-template.directive.d.ts +15 -0
  38. package/dist/es/popover/template-directives/title-template.directive.js +26 -0
  39. package/dist/es/popover.module.d.ts +31 -0
  40. package/dist/es/popover.module.js +65 -0
  41. package/dist/es/tooltip/tooltip.directive.js +4 -4
  42. package/dist/es/tooltips.module.d.ts +32 -0
  43. package/dist/es/tooltips.module.js +45 -0
  44. package/dist/es/utils.d.ts +1 -1
  45. package/dist/es/utils.js +1 -1
  46. package/dist/es2015/constants.d.ts +12 -0
  47. package/dist/es2015/constants.js +12 -0
  48. package/dist/es2015/index.d.ts +2 -0
  49. package/dist/es2015/index.js +2 -0
  50. package/dist/es2015/index.metadata.json +1 -1
  51. package/dist/es2015/main.d.ts +16 -2
  52. package/dist/es2015/main.js +12 -1
  53. package/dist/es2015/models/animation.model.d.ts +9 -0
  54. package/dist/es2015/models/animation.model.js +4 -0
  55. package/dist/es2015/models/events.d.ts +78 -0
  56. package/dist/es2015/models/events.js +65 -0
  57. package/dist/es2015/models/functions.model.d.ts +17 -0
  58. package/dist/es2015/models/functions.model.js +4 -0
  59. package/dist/es2015/models/popover-show-option.type.d.ts +8 -0
  60. package/dist/es2015/models/popover-show-option.type.js +4 -0
  61. package/dist/es2015/models/position.type.d.ts +1 -1
  62. package/dist/es2015/package-metadata.js +1 -1
  63. package/dist/es2015/popover/anchor.directive.d.ts +44 -0
  64. package/dist/es2015/popover/anchor.directive.js +144 -0
  65. package/dist/es2015/popover/container.directive.d.ts +56 -0
  66. package/dist/es2015/popover/container.directive.js +171 -0
  67. package/dist/es2015/popover/directives-base.d.ts +87 -0
  68. package/dist/es2015/popover/directives-base.js +259 -0
  69. package/dist/es2015/popover/popover.component.d.ts +166 -0
  70. package/dist/es2015/popover/popover.component.js +304 -0
  71. package/dist/es2015/popover/popover.service.d.ts +30 -0
  72. package/dist/es2015/popover/popover.service.js +67 -0
  73. package/dist/es2015/popover/template-directives/actions-template.directive.d.ts +15 -0
  74. package/dist/es2015/popover/template-directives/actions-template.directive.js +25 -0
  75. package/dist/es2015/popover/template-directives/body-template.directive.d.ts +15 -0
  76. package/dist/es2015/popover/template-directives/body-template.directive.js +25 -0
  77. package/dist/es2015/popover/template-directives/title-template.directive.d.ts +15 -0
  78. package/dist/es2015/popover/template-directives/title-template.directive.js +25 -0
  79. package/dist/es2015/popover.module.d.ts +31 -0
  80. package/dist/es2015/popover.module.js +63 -0
  81. package/dist/es2015/tooltip/tooltip.directive.js +4 -4
  82. package/dist/es2015/tooltips.module.d.ts +32 -0
  83. package/dist/es2015/tooltips.module.js +42 -0
  84. package/dist/es2015/utils.d.ts +1 -1
  85. package/dist/es2015/utils.js +1 -1
  86. package/dist/fesm2015/index.js +1110 -9
  87. package/dist/fesm5/index.js +1168 -9
  88. package/dist/npm/constants.js +14 -0
  89. package/dist/npm/index.js +4 -0
  90. package/dist/npm/main.js +25 -2
  91. package/dist/npm/models/animation.model.js +6 -0
  92. package/dist/npm/models/events.js +80 -0
  93. package/dist/npm/models/functions.model.js +6 -0
  94. package/dist/npm/models/popover-show-option.type.js +6 -0
  95. package/dist/npm/package-metadata.js +1 -1
  96. package/dist/npm/popover/anchor.directive.js +152 -0
  97. package/dist/npm/popover/container.directive.js +178 -0
  98. package/dist/npm/popover/directives-base.js +276 -0
  99. package/dist/npm/popover/popover.component.js +302 -0
  100. package/dist/npm/popover/popover.service.js +90 -0
  101. package/dist/npm/popover/template-directives/actions-template.directive.js +28 -0
  102. package/dist/npm/popover/template-directives/body-template.directive.js +28 -0
  103. package/dist/npm/popover/template-directives/title-template.directive.js +28 -0
  104. package/dist/npm/popover.module.js +67 -0
  105. package/dist/npm/tooltip/tooltip.directive.js +3 -3
  106. package/dist/npm/tooltips.module.js +47 -0
  107. package/dist/npm/utils.js +2 -2
  108. package/dist/systemjs/kendo-angular-tooltip.js +1 -1
  109. package/package.json +20 -16
@@ -0,0 +1,276 @@
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
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ var operators_1 = require("rxjs/operators");
10
+ var kendo_angular_common_1 = require("@progress/kendo-angular-common");
11
+ var constants_1 = require("../constants");
12
+ var events_1 = require("../models/events");
13
+ var utils_1 = require("../utils");
14
+ var popover_component_1 = require("./popover.component");
15
+ var rxjs_1 = require("rxjs");
16
+ var validShowOptions = ['hover', 'click', 'none', 'focus'];
17
+ /**
18
+ * @hidden
19
+ */
20
+ var PopoverDirectivesBase = /** @class */ (function () {
21
+ function PopoverDirectivesBase(ngZone, popupService, renderer) {
22
+ this.ngZone = ngZone;
23
+ this.popupService = popupService;
24
+ this.renderer = renderer;
25
+ this.subs = new rxjs_1.Subscription();
26
+ this._showOn = 'click';
27
+ }
28
+ Object.defineProperty(PopoverDirectivesBase.prototype, "popover", {
29
+ get: function () {
30
+ return this._popover;
31
+ },
32
+ /**
33
+ * Specifies the popover instance that will be rendered.
34
+ * Accepts a [`PopoverComponent`]({% slug api_tooltip_popovercomponent %}) instance or
35
+ * a [`PopoverFn`]({% slug api_tooltip_popoverfn %}) callback which returns a [`PopoverComponent`]({% slug api_tooltip_popovercomponent %}) instance
36
+ * depending on the current anchor element.
37
+ *
38
+ * [See example]({% slug templates_popover %}#toc-popovercallback)
39
+ */
40
+ set: function (value) {
41
+ if (value instanceof popover_component_1.PopoverComponent || typeof value === "function") {
42
+ this._popover = value;
43
+ }
44
+ else {
45
+ if (core_1.isDevMode) {
46
+ throw new Error(constants_1.ERRORS.popover);
47
+ }
48
+ }
49
+ },
50
+ enumerable: true,
51
+ configurable: true
52
+ });
53
+ Object.defineProperty(PopoverDirectivesBase.prototype, "showOn", {
54
+ get: function () {
55
+ return this._showOn;
56
+ },
57
+ /**
58
+ * The event on which the Popover will be shown
59
+ *
60
+ * The supported values are:
61
+ * - `click` (default) —The Popover will be shown when its `anchor` element is clicked.
62
+ * - `hover`—The Popover will be shown when its `anchor` element is hovered.
63
+ * - `focus`—The Popover will be shown when its `anchor` element is focused.
64
+ * - `none`—The Popover will not be shown on user interaction. It could be rendered via the Popover API methods.
65
+ */
66
+ set: function (value) {
67
+ if (core_1.isDevMode && !utils_1.containsItem(validShowOptions, value)) {
68
+ throw new Error(constants_1.ERRORS.showOn);
69
+ }
70
+ this._showOn = value;
71
+ },
72
+ enumerable: true,
73
+ configurable: true
74
+ });
75
+ PopoverDirectivesBase.prototype.ngAfterViewInit = function () {
76
+ var _this = this;
77
+ this.ngZone.runOutsideAngular(function () {
78
+ switch (_this.showOn) {
79
+ case 'hover':
80
+ _this.subscribeToEvents([{
81
+ name: 'mouseenter', handler: _this.mouseenterHandler
82
+ }, {
83
+ name: 'mouseleave', handler: _this.mouseleaveHandler
84
+ }]);
85
+ break;
86
+ case 'focus':
87
+ _this.subscribeToEvents([{
88
+ name: 'focus', handler: _this.focusHandler
89
+ }, {
90
+ name: 'blur', handler: _this.blurHandler
91
+ }]);
92
+ break;
93
+ case 'click':
94
+ _this.subscribeClick();
95
+ break;
96
+ default: /**/
97
+ }
98
+ });
99
+ };
100
+ PopoverDirectivesBase.prototype.ngOnDestroy = function () {
101
+ this.closePopup();
102
+ if (this.disposeHoverOverListener) {
103
+ this.disposeHoverOverListener();
104
+ }
105
+ if (this.disposeHoverOutListener) {
106
+ this.disposeHoverOutListener();
107
+ }
108
+ if (this.disposeClickListener) {
109
+ this.disposeClickListener();
110
+ }
111
+ if (this._focusInsideSub) {
112
+ this._focusInsideSub.unsubscribe();
113
+ }
114
+ if (this._hideSub) {
115
+ this._hideSub.unsubscribe();
116
+ }
117
+ if (this.subs) {
118
+ this.subs.unsubscribe();
119
+ }
120
+ if (this._popupOpenSub) {
121
+ this._popupOpenSub.unsubscribe();
122
+ }
123
+ if (this._popupCloseSub) {
124
+ this._popupCloseSub.unsubscribe();
125
+ }
126
+ };
127
+ /**
128
+ * Hides the Popover ([See example]({% slug programmaticcontrol_popover %})).
129
+ */
130
+ PopoverDirectivesBase.prototype.hide = function () {
131
+ this.closePopup();
132
+ };
133
+ /**
134
+ * @hidden
135
+ */
136
+ PopoverDirectivesBase.prototype.closePopup = function () {
137
+ if (this.popupRef) {
138
+ this.popupRef.close();
139
+ this.popupRef = null;
140
+ if (this.disposePopupHoverOutListener) {
141
+ this.disposePopupHoverOutListener();
142
+ }
143
+ if (this.disposePopupHoverInListener) {
144
+ this.disposePopupHoverInListener();
145
+ }
146
+ if (this.disposePopupFocusOutListener) {
147
+ this.disposePopupFocusOutListener();
148
+ }
149
+ }
150
+ };
151
+ /**
152
+ * @hidden
153
+ */
154
+ PopoverDirectivesBase.prototype.openPopup = function (anchor) {
155
+ var _this = this;
156
+ var _anchor = anchor instanceof core_1.ElementRef ? anchor.nativeElement : anchor;
157
+ var popoverComp = this.popover instanceof popover_component_1.PopoverComponent ? this.popover : this.popover(_anchor);
158
+ var alignSettings = utils_1.align(popoverComp.position, popoverComp.offset);
159
+ var anchorAlign = alignSettings.anchorAlign;
160
+ var popupAlign = alignSettings.popupAlign;
161
+ var popupMargin = alignSettings.popupMargin;
162
+ var _animation = popoverComp.animation;
163
+ this.ngZone.run(function () {
164
+ _this.popupRef = _this.popupService.open({
165
+ anchor: { nativeElement: _anchor },
166
+ animate: _animation,
167
+ content: popover_component_1.PopoverComponent,
168
+ popupAlign: popupAlign,
169
+ anchorAlign: anchorAlign,
170
+ margin: popupMargin,
171
+ popupClass: 'k-popup-transparent',
172
+ collision: { horizontal: 'fit', vertical: 'fit' }
173
+ });
174
+ var popoverInstance = _this.popupRef.content.instance;
175
+ Object.assign(popoverInstance, popoverComp);
176
+ popoverInstance.anchor = anchor;
177
+ popoverInstance.contextData = popoverInstance.templateData(anchor);
178
+ popoverInstance.visible = true;
179
+ _this.popupRef.content.changeDetectorRef.detectChanges();
180
+ _this.monitorPopup();
181
+ _this.initializeFinishingEvents(popoverComp, _anchor);
182
+ });
183
+ this.popupRef.popupAnchorViewportLeave
184
+ .pipe(operators_1.take(1))
185
+ .subscribe(function () { return _this.hide(); });
186
+ };
187
+ /**
188
+ * @hidden
189
+ */
190
+ PopoverDirectivesBase.prototype.isPrevented = function (anchorElement, show) {
191
+ var popoverComp = this.popover instanceof popover_component_1.PopoverComponent ? this.popover : this.popover(anchorElement);
192
+ var eventArgs;
193
+ eventArgs = this.initializeEvents(popoverComp, eventArgs, show, anchorElement);
194
+ return eventArgs.isDefaultPrevented();
195
+ };
196
+ /**
197
+ * @hidden
198
+ */
199
+ PopoverDirectivesBase.prototype.monitorPopup = function () {
200
+ var _this = this;
201
+ if (this.showOn === 'hover') {
202
+ this.ngZone.runOutsideAngular(function () {
203
+ var popup = _this.popupRef.popupElement;
204
+ _this.disposePopupHoverInListener = _this.renderer.listen(popup, 'mouseenter', function (_) {
205
+ _this.ngZone.run(function (_) { return _this._popoverService.emitPopoverState(true); });
206
+ });
207
+ _this.disposePopupHoverOutListener = _this.renderer.listen(popup, 'mouseleave', function (_) {
208
+ _this.ngZone.run(function (_) { return _this._popoverService.emitPopoverState(false); });
209
+ });
210
+ });
211
+ }
212
+ if (this.showOn === 'focus') {
213
+ this.ngZone.runOutsideAngular(function () {
214
+ var popup = _this.popupRef.popupElement;
215
+ _this.disposePopupFocusOutListener = _this.renderer.listen(popup, 'focusout', function (e) {
216
+ var isInsidePopover = kendo_angular_common_1.closest(e.relatedTarget, function (node) { return node.classList && node.classList.contains('k-popover'); });
217
+ if (!isInsidePopover) {
218
+ _this.ngZone.run(function (_) { return _this._popoverService.emitFocusInsidePopover(false); });
219
+ }
220
+ });
221
+ });
222
+ }
223
+ };
224
+ /**
225
+ * @hidden
226
+ */
227
+ PopoverDirectivesBase.prototype.initializeEvents = function (popoverComp, eventArgs, show, anchorElement) {
228
+ var _this = this;
229
+ if (show) {
230
+ this.ngZone.run(function (_) {
231
+ eventArgs = new events_1.PopoverShowEvent(anchorElement);
232
+ if (!_this.popupRef) {
233
+ popoverComp.show.emit(eventArgs);
234
+ }
235
+ });
236
+ }
237
+ else {
238
+ this.ngZone.run(function (_) {
239
+ eventArgs = new events_1.PopoverHideEvent(anchorElement, _this.popupRef);
240
+ if (_this.popupRef) {
241
+ popoverComp.hide.emit(eventArgs);
242
+ }
243
+ });
244
+ }
245
+ return eventArgs;
246
+ };
247
+ PopoverDirectivesBase.prototype.initializeFinishingEvents = function (popoverComp, _anchor) {
248
+ var _this = this;
249
+ if (!this._popupOpenSub) {
250
+ this.popupRef.popupOpen.subscribe(function () {
251
+ var eventArgs = new events_1.PopoverShownEvent(_anchor, _this.popupRef);
252
+ popoverComp.shown.emit(eventArgs);
253
+ });
254
+ }
255
+ if (!this._popupCloseSub) {
256
+ this.popupRef.popupClose.subscribe(function () {
257
+ _this.ngZone.run(function (_) {
258
+ var eventArgs = new events_1.PopoverHiddenEvent(_anchor);
259
+ popoverComp.hidden.emit(eventArgs);
260
+ });
261
+ });
262
+ }
263
+ };
264
+ tslib_1.__decorate([
265
+ core_1.Input(),
266
+ tslib_1.__metadata("design:type", Object),
267
+ tslib_1.__metadata("design:paramtypes", [Object])
268
+ ], PopoverDirectivesBase.prototype, "popover", null);
269
+ tslib_1.__decorate([
270
+ core_1.Input(),
271
+ tslib_1.__metadata("design:type", String),
272
+ tslib_1.__metadata("design:paramtypes", [String])
273
+ ], PopoverDirectivesBase.prototype, "showOn", null);
274
+ return PopoverDirectivesBase;
275
+ }());
276
+ exports.PopoverDirectivesBase = PopoverDirectivesBase;
@@ -0,0 +1,302 @@
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
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
10
+ var rxjs_1 = require("rxjs");
11
+ var kendo_licensing_1 = require("@progress/kendo-licensing");
12
+ var package_metadata_1 = require("../package-metadata");
13
+ var constants_1 = require("../constants");
14
+ var title_template_directive_1 = require("./template-directives/title-template.directive");
15
+ var body_template_directive_1 = require("./template-directives/body-template.directive");
16
+ var actions_template_directive_1 = require("./template-directives/actions-template.directive");
17
+ /**
18
+ * Represents the [Kendo UI Popover component for Angular]({% slug overview_popover %}).
19
+ * Used to display additional information that is related to a target element.
20
+ *
21
+ * @example
22
+ * ```ts-no-run
23
+ * <kendo-popover>
24
+ * <ng-template kendoPopoverTitleTemplate>Foo Title</ng-template>
25
+ * <ng-template kendoPopoverBodyTemplate>Foo Body</ng-template>
26
+ * <ng-template kendoPopoverActionsTemplate>Foo Actions</ng-template>
27
+ * </kendo-popover>
28
+ * ```
29
+ */
30
+ var PopoverComponent = /** @class */ (function () {
31
+ function PopoverComponent(localization) {
32
+ this.localization = localization;
33
+ /**
34
+ * Specifies the position of the Popover in relation to its anchor element. [See example]({% slug positioning_popover %})
35
+ *
36
+ * The possible options are:
37
+ * `top`
38
+ * `bottom`
39
+ * `right` (Default)
40
+ * `left`
41
+ */
42
+ this.position = 'right';
43
+ /**
44
+ * Determines whether a callout will be rendered along the Popover. [See example]({% slug callout_popover %})
45
+ *
46
+ * @default true
47
+ */
48
+ this.callout = true;
49
+ /**
50
+ * Enables and configures the Popover animation. [See example]({% slug animations_popover %})
51
+ *
52
+ * The possible options are:
53
+ *
54
+ * * `boolean`&mdash;Enables the default animation
55
+ * * `PopoverAnimation`&mdash;A configuration object which allows setting the `direction`, `duration` and `type` of the animation.
56
+ *
57
+ * @default false
58
+ */
59
+ this.animation = false;
60
+ /**
61
+ * @hidden
62
+ * Determines the visibility of the Popover.
63
+ */
64
+ this.visible = false;
65
+ /**
66
+ * Fires before the Popover is about to be shown ([see example]({% slug events_popover %})).
67
+ * The event is preventable. If canceled, the Popover will not be displayed. [See example]({% slug events_popover %})
68
+ */
69
+ this.show = new core_1.EventEmitter();
70
+ /**
71
+ * Fires after the Popover has been shown and the animation has ended. [See example]({% slug events_popover %})
72
+ */
73
+ this.shown = new core_1.EventEmitter();
74
+ /**
75
+ * Fires when the Popover is about to be hidden ([see example]({% slug events_popover %})).
76
+ * The event is preventable. If canceled, the Popover will remain visible.
77
+ */
78
+ this.hide = new core_1.EventEmitter();
79
+ /**
80
+ * Fires after the Popover has been hidden and the animation has ended. [See example]({% slug events_popover %})
81
+ */
82
+ this.hidden = new core_1.EventEmitter();
83
+ this._offset = 6;
84
+ this._width = 'auto';
85
+ this._height = 'auto';
86
+ this.subs = new rxjs_1.Subscription();
87
+ /**
88
+ * @hidden
89
+ */
90
+ this._templateData = function () { return null; };
91
+ kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
92
+ }
93
+ Object.defineProperty(PopoverComponent.prototype, "offset", {
94
+ get: function () {
95
+ var calloutBuffer = 14;
96
+ return this.callout
97
+ ? calloutBuffer + this._offset
98
+ : this._offset;
99
+ },
100
+ /**
101
+ * Specifies the distance from the Popover to its anchor element in pixels.
102
+ *
103
+ * @default `6`
104
+ */
105
+ set: function (value) {
106
+ this._offset = value;
107
+ },
108
+ enumerable: true,
109
+ configurable: true
110
+ });
111
+ Object.defineProperty(PopoverComponent.prototype, "width", {
112
+ get: function () {
113
+ return this._width;
114
+ },
115
+ /**
116
+ * Determines the width of the popover. Numeric values are treated as pixels.
117
+ * @default 'auto'
118
+ */
119
+ set: function (value) {
120
+ this._width = typeof value === 'number' ? value + "px" : value;
121
+ },
122
+ enumerable: true,
123
+ configurable: true
124
+ });
125
+ Object.defineProperty(PopoverComponent.prototype, "height", {
126
+ get: function () {
127
+ return this._height;
128
+ },
129
+ /**
130
+ * Determines the height of the popover. Numeric values are treated as pixels.
131
+ * @default 'auto'
132
+ */
133
+ set: function (value) {
134
+ this._height = typeof value === 'number' ? value + "px" : value;
135
+ },
136
+ enumerable: true,
137
+ configurable: true
138
+ });
139
+ Object.defineProperty(PopoverComponent.prototype, "templateData", {
140
+ get: function () {
141
+ return this._templateData;
142
+ },
143
+ /**
144
+ * Defines a callback function which returns custom data passed to the Popover templates.
145
+ * It exposes the current anchor element as an argument. [See example]({% slug templates_popover %}#toc-popoverdatacallback)
146
+ */
147
+ set: function (fn) {
148
+ if (core_1.isDevMode && typeof fn !== 'function') {
149
+ throw new Error(constants_1.ERRORS.templateData + " " + JSON.stringify(fn) + ".");
150
+ }
151
+ this._templateData = fn;
152
+ },
153
+ enumerable: true,
154
+ configurable: true
155
+ });
156
+ Object.defineProperty(PopoverComponent.prototype, "isHidden", {
157
+ /**
158
+ * @hidden
159
+ */
160
+ get: function () {
161
+ return !this.visible;
162
+ },
163
+ enumerable: true,
164
+ configurable: true
165
+ });
166
+ Object.defineProperty(PopoverComponent.prototype, "hasAttributeHidden", {
167
+ /**
168
+ * @hidden
169
+ */
170
+ get: function () {
171
+ return !this.visible;
172
+ },
173
+ enumerable: true,
174
+ configurable: true
175
+ });
176
+ PopoverComponent.prototype.ngOnInit = function () {
177
+ var _this = this;
178
+ this.subs.add(this.localization.changes.subscribe(function (_a) {
179
+ var rtl = _a.rtl;
180
+ _this.direction = rtl ? 'rtl' : 'ltr';
181
+ }));
182
+ };
183
+ PopoverComponent.prototype.ngOnDestroy = function () {
184
+ this.subs.unsubscribe();
185
+ };
186
+ /**
187
+ * @hidden
188
+ */
189
+ PopoverComponent.prototype.getCalloutPosition = function () {
190
+ switch (this.position) {
191
+ case 'top': return { 'k-callout-s': true };
192
+ case 'bottom': return { 'k-callout-n': true };
193
+ case 'left': return { 'k-callout-e': true };
194
+ case 'right': return { 'k-callout-w': true };
195
+ default: return { 'k-callout-s': true };
196
+ }
197
+ };
198
+ tslib_1.__decorate([
199
+ core_1.Input(),
200
+ tslib_1.__metadata("design:type", String)
201
+ ], PopoverComponent.prototype, "position", void 0);
202
+ tslib_1.__decorate([
203
+ core_1.Input(),
204
+ tslib_1.__metadata("design:type", Number),
205
+ tslib_1.__metadata("design:paramtypes", [Number])
206
+ ], PopoverComponent.prototype, "offset", null);
207
+ tslib_1.__decorate([
208
+ core_1.HostBinding('style.width'),
209
+ core_1.Input(),
210
+ tslib_1.__metadata("design:type", Object),
211
+ tslib_1.__metadata("design:paramtypes", [Object])
212
+ ], PopoverComponent.prototype, "width", null);
213
+ tslib_1.__decorate([
214
+ core_1.HostBinding('style.height'),
215
+ core_1.Input(),
216
+ tslib_1.__metadata("design:type", Object),
217
+ tslib_1.__metadata("design:paramtypes", [Object])
218
+ ], PopoverComponent.prototype, "height", null);
219
+ tslib_1.__decorate([
220
+ core_1.HostBinding('attr.dir'),
221
+ tslib_1.__metadata("design:type", String)
222
+ ], PopoverComponent.prototype, "direction", void 0);
223
+ tslib_1.__decorate([
224
+ core_1.Input(),
225
+ tslib_1.__metadata("design:type", String)
226
+ ], PopoverComponent.prototype, "title", void 0);
227
+ tslib_1.__decorate([
228
+ core_1.Input(),
229
+ tslib_1.__metadata("design:type", String)
230
+ ], PopoverComponent.prototype, "subtitle", void 0);
231
+ tslib_1.__decorate([
232
+ core_1.Input(),
233
+ tslib_1.__metadata("design:type", String)
234
+ ], PopoverComponent.prototype, "body", void 0);
235
+ tslib_1.__decorate([
236
+ core_1.Input(),
237
+ tslib_1.__metadata("design:type", Boolean)
238
+ ], PopoverComponent.prototype, "callout", void 0);
239
+ tslib_1.__decorate([
240
+ core_1.Input(),
241
+ tslib_1.__metadata("design:type", Object)
242
+ ], PopoverComponent.prototype, "animation", void 0);
243
+ tslib_1.__decorate([
244
+ core_1.Input(),
245
+ tslib_1.__metadata("design:type", Function),
246
+ tslib_1.__metadata("design:paramtypes", [Function])
247
+ ], PopoverComponent.prototype, "templateData", null);
248
+ tslib_1.__decorate([
249
+ core_1.HostBinding('class.k-hidden'),
250
+ tslib_1.__metadata("design:type", Boolean),
251
+ tslib_1.__metadata("design:paramtypes", [])
252
+ ], PopoverComponent.prototype, "isHidden", null);
253
+ tslib_1.__decorate([
254
+ core_1.HostBinding('attr.aria-hidden'),
255
+ tslib_1.__metadata("design:type", Boolean),
256
+ tslib_1.__metadata("design:paramtypes", [])
257
+ ], PopoverComponent.prototype, "hasAttributeHidden", null);
258
+ tslib_1.__decorate([
259
+ core_1.Output(),
260
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
261
+ ], PopoverComponent.prototype, "show", void 0);
262
+ tslib_1.__decorate([
263
+ core_1.Output(),
264
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
265
+ ], PopoverComponent.prototype, "shown", void 0);
266
+ tslib_1.__decorate([
267
+ core_1.Output(),
268
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
269
+ ], PopoverComponent.prototype, "hide", void 0);
270
+ tslib_1.__decorate([
271
+ core_1.Output(),
272
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
273
+ ], PopoverComponent.prototype, "hidden", void 0);
274
+ tslib_1.__decorate([
275
+ core_1.ContentChild(title_template_directive_1.PopoverTitleTemplateDirective, { static: false }),
276
+ tslib_1.__metadata("design:type", title_template_directive_1.PopoverTitleTemplateDirective)
277
+ ], PopoverComponent.prototype, "titleTemplate", void 0);
278
+ tslib_1.__decorate([
279
+ core_1.ContentChild(body_template_directive_1.PopoverBodyTemplateDirective, { static: false }),
280
+ tslib_1.__metadata("design:type", body_template_directive_1.PopoverBodyTemplateDirective)
281
+ ], PopoverComponent.prototype, "bodyTemplate", void 0);
282
+ tslib_1.__decorate([
283
+ core_1.ContentChild(actions_template_directive_1.PopoverActionsTemplateDirective, { static: false }),
284
+ tslib_1.__metadata("design:type", actions_template_directive_1.PopoverActionsTemplateDirective)
285
+ ], PopoverComponent.prototype, "actionsTemplate", void 0);
286
+ PopoverComponent = tslib_1.__decorate([
287
+ core_1.Component({
288
+ selector: 'kendo-popover',
289
+ providers: [
290
+ kendo_angular_l10n_1.LocalizationService,
291
+ {
292
+ provide: kendo_angular_l10n_1.L10N_PREFIX,
293
+ useValue: 'kendo.popover'
294
+ }
295
+ ],
296
+ template: "\n <div *ngIf=\"visible\" role=\"tooltip\" class=\"k-popover\" [ngStyle]=\"{'width.px': width, 'height.px': height}\">\n <div class=\"k-popover-callout\" [ngClass]=\"getCalloutPosition()\" *ngIf=\"callout\"></div>\n\n <div *ngIf=\"titleTemplate || title\" class=\"k-popover-header\">\n <ng-template *ngIf=\"titleTemplate\"\n [ngTemplateOutlet]=\"titleTemplate?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: anchor, data: contextData }\">\n </ng-template>\n <ng-container *ngIf=\"title && !titleTemplate\">\n {{ title }}\n </ng-container>\n </div>\n\n <div *ngIf=\"bodyTemplate || body\" class=\"k-popover-body\">\n <ng-template *ngIf=\"bodyTemplate\"\n [ngTemplateOutlet]=\"bodyTemplate?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: anchor, data: contextData }\">\n </ng-template>\n <ng-container *ngIf=\"body && !bodyTemplate\">\n {{ body }}\n </ng-container>\n </div>\n\n <div *ngIf=\"actionsTemplate\" class=\"k-popover-actions k-actions k-hstack k-justify-content-between\">\n <ng-template *ngIf=\"actionsTemplate\"\n [ngTemplateOutlet]=\"actionsTemplate?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: anchor, data: contextData }\">\n </ng-template>\n </div>\n </div>\n "
297
+ }),
298
+ tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService])
299
+ ], PopoverComponent);
300
+ return PopoverComponent;
301
+ }());
302
+ exports.PopoverComponent = PopoverComponent;
@@ -0,0 +1,90 @@
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
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ var rxjs_1 = require("rxjs");
10
+ var operators_1 = require("rxjs/operators");
11
+ /**
12
+ * @hidden
13
+ */
14
+ var PopoverService = /** @class */ (function () {
15
+ function PopoverService(ngZone) {
16
+ this.ngZone = ngZone;
17
+ this._pointerOverPopup = new rxjs_1.BehaviorSubject(null);
18
+ this._pointerOverAnchor = new rxjs_1.BehaviorSubject(null);
19
+ this._focusInsidePopover = new rxjs_1.BehaviorSubject(null);
20
+ this._hidePopover = new rxjs_1.Subject();
21
+ this.subs = new rxjs_1.Subscription();
22
+ this.monitor();
23
+ }
24
+ PopoverService.prototype.ngOnDestroy = function () {
25
+ this.subs.unsubscribe();
26
+ };
27
+ Object.defineProperty(PopoverService.prototype, "isPopoverHovered", {
28
+ get: function () {
29
+ return this._pointerOverPopup.asObservable();
30
+ },
31
+ enumerable: true,
32
+ configurable: true
33
+ });
34
+ PopoverService.prototype.emitPopoverState = function (isHovered) {
35
+ var _this = this;
36
+ this.ngZone.run(function (_) { return _this._pointerOverPopup.next(isHovered); });
37
+ };
38
+ Object.defineProperty(PopoverService.prototype, "isAnchorHovered", {
39
+ get: function () {
40
+ return this._pointerOverAnchor.asObservable();
41
+ },
42
+ enumerable: true,
43
+ configurable: true
44
+ });
45
+ PopoverService.prototype.emitAnchorState = function (isHovered, anchor) {
46
+ var _this = this;
47
+ this._isOrigin = this.originAnchor === anchor;
48
+ this.currentAnchor = anchor;
49
+ if (isHovered) {
50
+ this.originAnchor = anchor;
51
+ }
52
+ this.ngZone.run(function (_) { return _this._pointerOverAnchor.next(isHovered); });
53
+ };
54
+ Object.defineProperty(PopoverService.prototype, "isFocusInsidePopover", {
55
+ get: function () {
56
+ return this._focusInsidePopover.asObservable();
57
+ },
58
+ enumerable: true,
59
+ configurable: true
60
+ });
61
+ PopoverService.prototype.emitFocusInsidePopover = function (isFocused) {
62
+ var _this = this;
63
+ this.ngZone.run(function (_) { return _this._focusInsidePopover.next(isFocused); });
64
+ this._focusInsidePopover.next(null);
65
+ };
66
+ Object.defineProperty(PopoverService.prototype, "hidePopover", {
67
+ get: function () {
68
+ return this._hidePopover.asObservable();
69
+ },
70
+ enumerable: true,
71
+ configurable: true
72
+ });
73
+ PopoverService.prototype.monitor = function () {
74
+ var _this = this;
75
+ this.subs.add(rxjs_1.combineLatest(this.isPopoverHovered, this.isAnchorHovered).pipe(
76
+ // `auditTime` is used because the `mouseleave` event is emitted before `mouseenter`
77
+ // i.e. there is a millisecond in which the pointer leaves the first target (e.g. anchor) and hasn't reached the second one (e.g. popup)
78
+ // resulting in both observables emitting `false`
79
+ operators_1.auditTime(20)).subscribe(function (val) {
80
+ var isPopoverHovered = val[0], isAnchorHovered = val[1];
81
+ _this._hidePopover.next([isPopoverHovered, isAnchorHovered, _this._isOrigin, _this.currentAnchor]);
82
+ }));
83
+ };
84
+ PopoverService = tslib_1.__decorate([
85
+ core_1.Injectable(),
86
+ tslib_1.__metadata("design:paramtypes", [core_1.NgZone])
87
+ ], PopoverService);
88
+ return PopoverService;
89
+ }());
90
+ exports.PopoverService = PopoverService;