@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
@@ -3,12 +3,13 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { __decorate, __metadata, __param, __extends } from 'tslib';
6
- import { InjectionToken, Injectable, HostBinding, Output, EventEmitter, Input, TemplateRef, ElementRef, Component, isDevMode, Directive, Optional, Inject, NgZone, Renderer2, forwardRef, NgModule } from '@angular/core';
7
- import { take, filter, debounceTime } from 'rxjs/operators';
8
- import { fromEvent } from 'rxjs';
6
+ import { InjectionToken, Injectable, HostBinding, Output, EventEmitter, Input, TemplateRef, ElementRef, Component, isDevMode, Directive, Optional, Inject, NgZone, Renderer2, ContentChild, forwardRef, NgModule } from '@angular/core';
7
+ import { take, filter, debounceTime, auditTime } from 'rxjs/operators';
8
+ import { fromEvent, Subscription, combineLatest, BehaviorSubject, Subject } from 'rxjs';
9
9
  import { PopupService, PopupModule } from '@progress/kendo-angular-popup';
10
10
  import { validatePackage } from '@progress/kendo-licensing';
11
11
  import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
12
+ import { PreventableEvent, closest } from '@progress/kendo-angular-common';
12
13
  import { CommonModule } from '@angular/common';
13
14
 
14
15
  /**
@@ -18,7 +19,7 @@ var packageMetadata = {
18
19
  name: '@progress/kendo-angular-tooltip',
19
20
  productName: 'Kendo UI for Angular',
20
21
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
21
- publishDate: 1635939563,
22
+ publishDate: 1642537195,
22
23
  version: '',
23
24
  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'
24
25
  };
@@ -117,7 +118,7 @@ function isDocumentNode(container) {
117
118
  /**
118
119
  * @hidden
119
120
  */
120
- function closest(element, selector) {
121
+ function closestBySelector(element, selector) {
121
122
  if (element.closest) {
122
123
  return element.closest(selector);
123
124
  }
@@ -430,7 +431,7 @@ var TooltipDirective = /** @class */ (function () {
430
431
  _this.anchorTitleSubscription = fromEvent(wrapper, 'mouseover')
431
432
  .pipe(filter(function () { return _this.filter !== ''; }))
432
433
  .subscribe(function (e) {
433
- var filterElement = closest(e.target, _this.filter);
434
+ var filterElement = closestBySelector(e.target, _this.filter);
434
435
  if (filterElement) {
435
436
  _this.hideElementTitle({ nativeElement: filterElement });
436
437
  }
@@ -667,7 +668,7 @@ var TooltipDirective = /** @class */ (function () {
667
668
  };
668
669
  TooltipDirective.prototype.onMouseClick = function (e, wrapper) {
669
670
  var target = e.target;
670
- var filterElement = closest(target, this.filter);
671
+ var filterElement = closestBySelector(target, this.filter);
671
672
  var popup = this.popupRef && this.popupRef.popupElement;
672
673
  if (popup) {
673
674
  if (popup.contains(target)) {
@@ -685,7 +686,7 @@ var TooltipDirective = /** @class */ (function () {
685
686
  }
686
687
  };
687
688
  TooltipDirective.prototype.onMouseOver = function (e) {
688
- var filterElement = closest(e.target, this.filter);
689
+ var filterElement = closestBySelector(e.target, this.filter);
689
690
  if (this.showOn !== 'hover') {
690
691
  return;
691
692
  }
@@ -795,6 +796,1074 @@ var TooltipDirective = /** @class */ (function () {
795
796
  return TooltipDirective;
796
797
  }());
797
798
 
799
+ /**
800
+ * @hidden
801
+ */
802
+ var ERRORS = {
803
+ popover: "Invalid value provided for the 'popover' property. The accepted data types are 'PopoverComponent' or 'PopoverFn'.",
804
+ templateData: "templateData must be a function, but received",
805
+ showOn: "Invalid value provided for the 'showOn' property. The available options are 'click', 'hover', 'focus' or 'none'."
806
+ };
807
+
808
+ /**
809
+ * Represents a template that defines the content of the Popover title.
810
+ *
811
+ * To define the template, nest an `<ng-template>` tag
812
+ * with the `kendoPopoverTitleTemplate` directive inside the `<kendo-popover>` tag.
813
+ */
814
+ var PopoverTitleTemplateDirective = /** @class */ (function () {
815
+ function PopoverTitleTemplateDirective(templateRef) {
816
+ this.templateRef = templateRef;
817
+ }
818
+ PopoverTitleTemplateDirective = __decorate([
819
+ Directive({
820
+ selector: '[kendoPopoverTitleTemplate]'
821
+ }),
822
+ __param(0, Optional()),
823
+ __metadata("design:paramtypes", [TemplateRef])
824
+ ], PopoverTitleTemplateDirective);
825
+ return PopoverTitleTemplateDirective;
826
+ }());
827
+
828
+ /**
829
+ * Represents a template that defines the content of the Popover body.
830
+ *
831
+ * To define the template, nest an `<ng-template>` tag
832
+ * with the `kendoPopoverBodyTemplate` directive inside the `<kendo-popover>` tag.
833
+ */
834
+ var PopoverBodyTemplateDirective = /** @class */ (function () {
835
+ function PopoverBodyTemplateDirective(templateRef) {
836
+ this.templateRef = templateRef;
837
+ }
838
+ PopoverBodyTemplateDirective = __decorate([
839
+ Directive({
840
+ selector: '[kendoPopoverBodyTemplate]'
841
+ }),
842
+ __param(0, Optional()),
843
+ __metadata("design:paramtypes", [TemplateRef])
844
+ ], PopoverBodyTemplateDirective);
845
+ return PopoverBodyTemplateDirective;
846
+ }());
847
+
848
+ /**
849
+ * Represents a template that defines the content of the Popover actions.
850
+ *
851
+ * To define the template, nest an `<ng-template>` tag
852
+ * with the `kendoPopoverActionsTemplate` directive inside the `<kendo-popover>` tag.
853
+ */
854
+ var PopoverActionsTemplateDirective = /** @class */ (function () {
855
+ function PopoverActionsTemplateDirective(templateRef) {
856
+ this.templateRef = templateRef;
857
+ }
858
+ PopoverActionsTemplateDirective = __decorate([
859
+ Directive({
860
+ selector: '[kendoPopoverActionsTemplate]'
861
+ }),
862
+ __param(0, Optional()),
863
+ __metadata("design:paramtypes", [TemplateRef])
864
+ ], PopoverActionsTemplateDirective);
865
+ return PopoverActionsTemplateDirective;
866
+ }());
867
+
868
+ /**
869
+ * Represents the [Kendo UI Popover component for Angular]({% slug overview_popover %}).
870
+ * Used to display additional information that is related to a target element.
871
+ *
872
+ * @example
873
+ * ```ts-no-run
874
+ * <kendo-popover>
875
+ * <ng-template kendoPopoverTitleTemplate>Foo Title</ng-template>
876
+ * <ng-template kendoPopoverBodyTemplate>Foo Body</ng-template>
877
+ * <ng-template kendoPopoverActionsTemplate>Foo Actions</ng-template>
878
+ * </kendo-popover>
879
+ * ```
880
+ */
881
+ var PopoverComponent = /** @class */ (function () {
882
+ function PopoverComponent(localization) {
883
+ this.localization = localization;
884
+ /**
885
+ * Specifies the position of the Popover in relation to its anchor element. [See example]({% slug positioning_popover %})
886
+ *
887
+ * The possible options are:
888
+ * `top`
889
+ * `bottom`
890
+ * `right` (Default)
891
+ * `left`
892
+ */
893
+ this.position = 'right';
894
+ /**
895
+ * Determines whether a callout will be rendered along the Popover. [See example]({% slug callout_popover %})
896
+ *
897
+ * @default true
898
+ */
899
+ this.callout = true;
900
+ /**
901
+ * Enables and configures the Popover animation. [See example]({% slug animations_popover %})
902
+ *
903
+ * The possible options are:
904
+ *
905
+ * * `boolean`&mdash;Enables the default animation
906
+ * * `PopoverAnimation`&mdash;A configuration object which allows setting the `direction`, `duration` and `type` of the animation.
907
+ *
908
+ * @default false
909
+ */
910
+ this.animation = false;
911
+ /**
912
+ * @hidden
913
+ * Determines the visibility of the Popover.
914
+ */
915
+ this.visible = false;
916
+ /**
917
+ * Fires before the Popover is about to be shown ([see example]({% slug events_popover %})).
918
+ * The event is preventable. If canceled, the Popover will not be displayed. [See example]({% slug events_popover %})
919
+ */
920
+ this.show = new EventEmitter();
921
+ /**
922
+ * Fires after the Popover has been shown and the animation has ended. [See example]({% slug events_popover %})
923
+ */
924
+ this.shown = new EventEmitter();
925
+ /**
926
+ * Fires when the Popover is about to be hidden ([see example]({% slug events_popover %})).
927
+ * The event is preventable. If canceled, the Popover will remain visible.
928
+ */
929
+ this.hide = new EventEmitter();
930
+ /**
931
+ * Fires after the Popover has been hidden and the animation has ended. [See example]({% slug events_popover %})
932
+ */
933
+ this.hidden = new EventEmitter();
934
+ this._offset = 6;
935
+ this._width = 'auto';
936
+ this._height = 'auto';
937
+ this.subs = new Subscription();
938
+ /**
939
+ * @hidden
940
+ */
941
+ this._templateData = function () { return null; };
942
+ validatePackage(packageMetadata);
943
+ }
944
+ Object.defineProperty(PopoverComponent.prototype, "offset", {
945
+ get: function () {
946
+ var calloutBuffer = 14;
947
+ return this.callout
948
+ ? calloutBuffer + this._offset
949
+ : this._offset;
950
+ },
951
+ /**
952
+ * Specifies the distance from the Popover to its anchor element in pixels.
953
+ *
954
+ * @default `6`
955
+ */
956
+ set: function (value) {
957
+ this._offset = value;
958
+ },
959
+ enumerable: true,
960
+ configurable: true
961
+ });
962
+ Object.defineProperty(PopoverComponent.prototype, "width", {
963
+ get: function () {
964
+ return this._width;
965
+ },
966
+ /**
967
+ * Determines the width of the popover. Numeric values are treated as pixels.
968
+ * @default 'auto'
969
+ */
970
+ set: function (value) {
971
+ this._width = typeof value === 'number' ? value + "px" : value;
972
+ },
973
+ enumerable: true,
974
+ configurable: true
975
+ });
976
+ Object.defineProperty(PopoverComponent.prototype, "height", {
977
+ get: function () {
978
+ return this._height;
979
+ },
980
+ /**
981
+ * Determines the height of the popover. Numeric values are treated as pixels.
982
+ * @default 'auto'
983
+ */
984
+ set: function (value) {
985
+ this._height = typeof value === 'number' ? value + "px" : value;
986
+ },
987
+ enumerable: true,
988
+ configurable: true
989
+ });
990
+ Object.defineProperty(PopoverComponent.prototype, "templateData", {
991
+ get: function () {
992
+ return this._templateData;
993
+ },
994
+ /**
995
+ * Defines a callback function which returns custom data passed to the Popover templates.
996
+ * It exposes the current anchor element as an argument. [See example]({% slug templates_popover %}#toc-popoverdatacallback)
997
+ */
998
+ set: function (fn) {
999
+ if (isDevMode && typeof fn !== 'function') {
1000
+ throw new Error(ERRORS.templateData + " " + JSON.stringify(fn) + ".");
1001
+ }
1002
+ this._templateData = fn;
1003
+ },
1004
+ enumerable: true,
1005
+ configurable: true
1006
+ });
1007
+ Object.defineProperty(PopoverComponent.prototype, "isHidden", {
1008
+ /**
1009
+ * @hidden
1010
+ */
1011
+ get: function () {
1012
+ return !this.visible;
1013
+ },
1014
+ enumerable: true,
1015
+ configurable: true
1016
+ });
1017
+ Object.defineProperty(PopoverComponent.prototype, "hasAttributeHidden", {
1018
+ /**
1019
+ * @hidden
1020
+ */
1021
+ get: function () {
1022
+ return !this.visible;
1023
+ },
1024
+ enumerable: true,
1025
+ configurable: true
1026
+ });
1027
+ PopoverComponent.prototype.ngOnInit = function () {
1028
+ var _this = this;
1029
+ this.subs.add(this.localization.changes.subscribe(function (_a) {
1030
+ var rtl = _a.rtl;
1031
+ _this.direction = rtl ? 'rtl' : 'ltr';
1032
+ }));
1033
+ };
1034
+ PopoverComponent.prototype.ngOnDestroy = function () {
1035
+ this.subs.unsubscribe();
1036
+ };
1037
+ /**
1038
+ * @hidden
1039
+ */
1040
+ PopoverComponent.prototype.getCalloutPosition = function () {
1041
+ switch (this.position) {
1042
+ case 'top': return { 'k-callout-s': true };
1043
+ case 'bottom': return { 'k-callout-n': true };
1044
+ case 'left': return { 'k-callout-e': true };
1045
+ case 'right': return { 'k-callout-w': true };
1046
+ default: return { 'k-callout-s': true };
1047
+ }
1048
+ };
1049
+ __decorate([
1050
+ Input(),
1051
+ __metadata("design:type", String)
1052
+ ], PopoverComponent.prototype, "position", void 0);
1053
+ __decorate([
1054
+ Input(),
1055
+ __metadata("design:type", Number),
1056
+ __metadata("design:paramtypes", [Number])
1057
+ ], PopoverComponent.prototype, "offset", null);
1058
+ __decorate([
1059
+ HostBinding('style.width'),
1060
+ Input(),
1061
+ __metadata("design:type", Object),
1062
+ __metadata("design:paramtypes", [Object])
1063
+ ], PopoverComponent.prototype, "width", null);
1064
+ __decorate([
1065
+ HostBinding('style.height'),
1066
+ Input(),
1067
+ __metadata("design:type", Object),
1068
+ __metadata("design:paramtypes", [Object])
1069
+ ], PopoverComponent.prototype, "height", null);
1070
+ __decorate([
1071
+ HostBinding('attr.dir'),
1072
+ __metadata("design:type", String)
1073
+ ], PopoverComponent.prototype, "direction", void 0);
1074
+ __decorate([
1075
+ Input(),
1076
+ __metadata("design:type", String)
1077
+ ], PopoverComponent.prototype, "title", void 0);
1078
+ __decorate([
1079
+ Input(),
1080
+ __metadata("design:type", String)
1081
+ ], PopoverComponent.prototype, "subtitle", void 0);
1082
+ __decorate([
1083
+ Input(),
1084
+ __metadata("design:type", String)
1085
+ ], PopoverComponent.prototype, "body", void 0);
1086
+ __decorate([
1087
+ Input(),
1088
+ __metadata("design:type", Boolean)
1089
+ ], PopoverComponent.prototype, "callout", void 0);
1090
+ __decorate([
1091
+ Input(),
1092
+ __metadata("design:type", Object)
1093
+ ], PopoverComponent.prototype, "animation", void 0);
1094
+ __decorate([
1095
+ Input(),
1096
+ __metadata("design:type", Function),
1097
+ __metadata("design:paramtypes", [Function])
1098
+ ], PopoverComponent.prototype, "templateData", null);
1099
+ __decorate([
1100
+ HostBinding('class.k-hidden'),
1101
+ __metadata("design:type", Boolean),
1102
+ __metadata("design:paramtypes", [])
1103
+ ], PopoverComponent.prototype, "isHidden", null);
1104
+ __decorate([
1105
+ HostBinding('attr.aria-hidden'),
1106
+ __metadata("design:type", Boolean),
1107
+ __metadata("design:paramtypes", [])
1108
+ ], PopoverComponent.prototype, "hasAttributeHidden", null);
1109
+ __decorate([
1110
+ Output(),
1111
+ __metadata("design:type", EventEmitter)
1112
+ ], PopoverComponent.prototype, "show", void 0);
1113
+ __decorate([
1114
+ Output(),
1115
+ __metadata("design:type", EventEmitter)
1116
+ ], PopoverComponent.prototype, "shown", void 0);
1117
+ __decorate([
1118
+ Output(),
1119
+ __metadata("design:type", EventEmitter)
1120
+ ], PopoverComponent.prototype, "hide", void 0);
1121
+ __decorate([
1122
+ Output(),
1123
+ __metadata("design:type", EventEmitter)
1124
+ ], PopoverComponent.prototype, "hidden", void 0);
1125
+ __decorate([
1126
+ ContentChild(PopoverTitleTemplateDirective, { static: false }),
1127
+ __metadata("design:type", PopoverTitleTemplateDirective)
1128
+ ], PopoverComponent.prototype, "titleTemplate", void 0);
1129
+ __decorate([
1130
+ ContentChild(PopoverBodyTemplateDirective, { static: false }),
1131
+ __metadata("design:type", PopoverBodyTemplateDirective)
1132
+ ], PopoverComponent.prototype, "bodyTemplate", void 0);
1133
+ __decorate([
1134
+ ContentChild(PopoverActionsTemplateDirective, { static: false }),
1135
+ __metadata("design:type", PopoverActionsTemplateDirective)
1136
+ ], PopoverComponent.prototype, "actionsTemplate", void 0);
1137
+ PopoverComponent = __decorate([
1138
+ Component({
1139
+ selector: 'kendo-popover',
1140
+ providers: [
1141
+ LocalizationService,
1142
+ {
1143
+ provide: L10N_PREFIX,
1144
+ useValue: 'kendo.popover'
1145
+ }
1146
+ ],
1147
+ 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 "
1148
+ }),
1149
+ __metadata("design:paramtypes", [LocalizationService])
1150
+ ], PopoverComponent);
1151
+ return PopoverComponent;
1152
+ }());
1153
+
1154
+ /**
1155
+ * Arguments for the `show` event. The `show` event fires when a popover is about
1156
+ * to be opened. If you cancel the event, the opening is prevented.
1157
+ */
1158
+ var PopoverShowEvent = /** @class */ (function (_super) {
1159
+ __extends(PopoverShowEvent, _super);
1160
+ /**
1161
+ * @hidden
1162
+ * Constructs the event arguments for the `show` event.
1163
+ * @param anchor - The host element related to the popover.
1164
+ */
1165
+ function PopoverShowEvent(anchor) {
1166
+ var _this = _super.call(this) || this;
1167
+ _this.anchor = anchor;
1168
+ return _this;
1169
+ }
1170
+ return PopoverShowEvent;
1171
+ }(PreventableEvent));
1172
+ /**
1173
+ * Arguments for the `hide` event. The `hide` event fires when a popover is about
1174
+ * to be closed. If you cancel the event, the popover stays open.
1175
+ */
1176
+ var PopoverHideEvent = /** @class */ (function (_super) {
1177
+ __extends(PopoverHideEvent, _super);
1178
+ /**
1179
+ * @hidden
1180
+ * Constructs the event arguments for the `hide` event.
1181
+ * @param anchor - The host element related to the popover.
1182
+ * @param popover - The popover element.
1183
+ */
1184
+ function PopoverHideEvent(anchor, popover) {
1185
+ var _this = _super.call(this) || this;
1186
+ _this.anchor = anchor;
1187
+ _this.popover = popover;
1188
+ return _this;
1189
+ }
1190
+ return PopoverHideEvent;
1191
+ }(PreventableEvent));
1192
+ /**
1193
+ * Arguments for the `shown` event. The `shown` event fires after the popover has opened and its opening animation has finished.
1194
+ */
1195
+ var PopoverShownEvent = /** @class */ (function () {
1196
+ /**
1197
+ * @hidden
1198
+ * Constructs the event arguments for the `shown` event.
1199
+ * @param anchor - The host element related to the popover.
1200
+ * @param popover - The popover element.
1201
+ */
1202
+ function PopoverShownEvent(anchor, popover) {
1203
+ this.anchor = anchor;
1204
+ this.popover = popover;
1205
+ }
1206
+ return PopoverShownEvent;
1207
+ }());
1208
+ /**
1209
+ * Arguments for the `hidden` event. The `hidden` event fires after the popover has closed and its closing animation has finished.
1210
+ */
1211
+ var PopoverHiddenEvent = /** @class */ (function () {
1212
+ /**
1213
+ * @hidden
1214
+ * Constructs the event arguments for the `hidden` event.
1215
+ * @param anchor - The host element related to the popover.
1216
+ */
1217
+ function PopoverHiddenEvent(anchor) {
1218
+ this.anchor = anchor;
1219
+ }
1220
+ return PopoverHiddenEvent;
1221
+ }());
1222
+
1223
+ var validShowOptions = ['hover', 'click', 'none', 'focus'];
1224
+ /**
1225
+ * @hidden
1226
+ */
1227
+ var PopoverDirectivesBase = /** @class */ (function () {
1228
+ function PopoverDirectivesBase(ngZone, popupService, renderer) {
1229
+ this.ngZone = ngZone;
1230
+ this.popupService = popupService;
1231
+ this.renderer = renderer;
1232
+ this.subs = new Subscription();
1233
+ this._showOn = 'click';
1234
+ }
1235
+ Object.defineProperty(PopoverDirectivesBase.prototype, "popover", {
1236
+ get: function () {
1237
+ return this._popover;
1238
+ },
1239
+ /**
1240
+ * Specifies the popover instance that will be rendered.
1241
+ * Accepts a [`PopoverComponent`]({% slug api_tooltip_popovercomponent %}) instance or
1242
+ * a [`PopoverFn`]({% slug api_tooltip_popoverfn %}) callback which returns a [`PopoverComponent`]({% slug api_tooltip_popovercomponent %}) instance
1243
+ * depending on the current anchor element.
1244
+ *
1245
+ * [See example]({% slug templates_popover %}#toc-popovercallback)
1246
+ */
1247
+ set: function (value) {
1248
+ if (value instanceof PopoverComponent || typeof value === "function") {
1249
+ this._popover = value;
1250
+ }
1251
+ else {
1252
+ if (isDevMode) {
1253
+ throw new Error(ERRORS.popover);
1254
+ }
1255
+ }
1256
+ },
1257
+ enumerable: true,
1258
+ configurable: true
1259
+ });
1260
+ Object.defineProperty(PopoverDirectivesBase.prototype, "showOn", {
1261
+ get: function () {
1262
+ return this._showOn;
1263
+ },
1264
+ /**
1265
+ * The event on which the Popover will be shown
1266
+ *
1267
+ * The supported values are:
1268
+ * - `click` (default) &mdash;The Popover will be shown when its `anchor` element is clicked.
1269
+ * - `hover`&mdash;The Popover will be shown when its `anchor` element is hovered.
1270
+ * - `focus`&mdash;The Popover will be shown when its `anchor` element is focused.
1271
+ * - `none`&mdash;The Popover will not be shown on user interaction. It could be rendered via the Popover API methods.
1272
+ */
1273
+ set: function (value) {
1274
+ if (isDevMode && !containsItem(validShowOptions, value)) {
1275
+ throw new Error(ERRORS.showOn);
1276
+ }
1277
+ this._showOn = value;
1278
+ },
1279
+ enumerable: true,
1280
+ configurable: true
1281
+ });
1282
+ PopoverDirectivesBase.prototype.ngAfterViewInit = function () {
1283
+ var _this = this;
1284
+ this.ngZone.runOutsideAngular(function () {
1285
+ switch (_this.showOn) {
1286
+ case 'hover':
1287
+ _this.subscribeToEvents([{
1288
+ name: 'mouseenter', handler: _this.mouseenterHandler
1289
+ }, {
1290
+ name: 'mouseleave', handler: _this.mouseleaveHandler
1291
+ }]);
1292
+ break;
1293
+ case 'focus':
1294
+ _this.subscribeToEvents([{
1295
+ name: 'focus', handler: _this.focusHandler
1296
+ }, {
1297
+ name: 'blur', handler: _this.blurHandler
1298
+ }]);
1299
+ break;
1300
+ case 'click':
1301
+ _this.subscribeClick();
1302
+ break;
1303
+ default: /**/
1304
+ }
1305
+ });
1306
+ };
1307
+ PopoverDirectivesBase.prototype.ngOnDestroy = function () {
1308
+ this.closePopup();
1309
+ if (this.disposeHoverOverListener) {
1310
+ this.disposeHoverOverListener();
1311
+ }
1312
+ if (this.disposeHoverOutListener) {
1313
+ this.disposeHoverOutListener();
1314
+ }
1315
+ if (this.disposeClickListener) {
1316
+ this.disposeClickListener();
1317
+ }
1318
+ if (this._focusInsideSub) {
1319
+ this._focusInsideSub.unsubscribe();
1320
+ }
1321
+ if (this._hideSub) {
1322
+ this._hideSub.unsubscribe();
1323
+ }
1324
+ if (this.subs) {
1325
+ this.subs.unsubscribe();
1326
+ }
1327
+ if (this._popupOpenSub) {
1328
+ this._popupOpenSub.unsubscribe();
1329
+ }
1330
+ if (this._popupCloseSub) {
1331
+ this._popupCloseSub.unsubscribe();
1332
+ }
1333
+ };
1334
+ /**
1335
+ * Hides the Popover ([See example]({% slug programmaticcontrol_popover %})).
1336
+ */
1337
+ PopoverDirectivesBase.prototype.hide = function () {
1338
+ this.closePopup();
1339
+ };
1340
+ /**
1341
+ * @hidden
1342
+ */
1343
+ PopoverDirectivesBase.prototype.closePopup = function () {
1344
+ if (this.popupRef) {
1345
+ this.popupRef.close();
1346
+ this.popupRef = null;
1347
+ if (this.disposePopupHoverOutListener) {
1348
+ this.disposePopupHoverOutListener();
1349
+ }
1350
+ if (this.disposePopupHoverInListener) {
1351
+ this.disposePopupHoverInListener();
1352
+ }
1353
+ if (this.disposePopupFocusOutListener) {
1354
+ this.disposePopupFocusOutListener();
1355
+ }
1356
+ }
1357
+ };
1358
+ /**
1359
+ * @hidden
1360
+ */
1361
+ PopoverDirectivesBase.prototype.openPopup = function (anchor) {
1362
+ var _this = this;
1363
+ var _anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;
1364
+ var popoverComp = this.popover instanceof PopoverComponent ? this.popover : this.popover(_anchor);
1365
+ var alignSettings = align(popoverComp.position, popoverComp.offset);
1366
+ var anchorAlign = alignSettings.anchorAlign;
1367
+ var popupAlign = alignSettings.popupAlign;
1368
+ var popupMargin = alignSettings.popupMargin;
1369
+ var _animation = popoverComp.animation;
1370
+ this.ngZone.run(function () {
1371
+ _this.popupRef = _this.popupService.open({
1372
+ anchor: { nativeElement: _anchor },
1373
+ animate: _animation,
1374
+ content: PopoverComponent,
1375
+ popupAlign: popupAlign,
1376
+ anchorAlign: anchorAlign,
1377
+ margin: popupMargin,
1378
+ popupClass: 'k-popup-transparent',
1379
+ collision: { horizontal: 'fit', vertical: 'fit' }
1380
+ });
1381
+ var popoverInstance = _this.popupRef.content.instance;
1382
+ Object.assign(popoverInstance, popoverComp);
1383
+ popoverInstance.anchor = anchor;
1384
+ popoverInstance.contextData = popoverInstance.templateData(anchor);
1385
+ popoverInstance.visible = true;
1386
+ _this.popupRef.content.changeDetectorRef.detectChanges();
1387
+ _this.monitorPopup();
1388
+ _this.initializeFinishingEvents(popoverComp, _anchor);
1389
+ });
1390
+ this.popupRef.popupAnchorViewportLeave
1391
+ .pipe(take(1))
1392
+ .subscribe(function () { return _this.hide(); });
1393
+ };
1394
+ /**
1395
+ * @hidden
1396
+ */
1397
+ PopoverDirectivesBase.prototype.isPrevented = function (anchorElement, show) {
1398
+ var popoverComp = this.popover instanceof PopoverComponent ? this.popover : this.popover(anchorElement);
1399
+ var eventArgs;
1400
+ eventArgs = this.initializeEvents(popoverComp, eventArgs, show, anchorElement);
1401
+ return eventArgs.isDefaultPrevented();
1402
+ };
1403
+ /**
1404
+ * @hidden
1405
+ */
1406
+ PopoverDirectivesBase.prototype.monitorPopup = function () {
1407
+ var _this = this;
1408
+ if (this.showOn === 'hover') {
1409
+ this.ngZone.runOutsideAngular(function () {
1410
+ var popup = _this.popupRef.popupElement;
1411
+ _this.disposePopupHoverInListener = _this.renderer.listen(popup, 'mouseenter', function (_) {
1412
+ _this.ngZone.run(function (_) { return _this._popoverService.emitPopoverState(true); });
1413
+ });
1414
+ _this.disposePopupHoverOutListener = _this.renderer.listen(popup, 'mouseleave', function (_) {
1415
+ _this.ngZone.run(function (_) { return _this._popoverService.emitPopoverState(false); });
1416
+ });
1417
+ });
1418
+ }
1419
+ if (this.showOn === 'focus') {
1420
+ this.ngZone.runOutsideAngular(function () {
1421
+ var popup = _this.popupRef.popupElement;
1422
+ _this.disposePopupFocusOutListener = _this.renderer.listen(popup, 'focusout', function (e) {
1423
+ var isInsidePopover = closest(e.relatedTarget, function (node) { return node.classList && node.classList.contains('k-popover'); });
1424
+ if (!isInsidePopover) {
1425
+ _this.ngZone.run(function (_) { return _this._popoverService.emitFocusInsidePopover(false); });
1426
+ }
1427
+ });
1428
+ });
1429
+ }
1430
+ };
1431
+ /**
1432
+ * @hidden
1433
+ */
1434
+ PopoverDirectivesBase.prototype.initializeEvents = function (popoverComp, eventArgs, show, anchorElement) {
1435
+ var _this = this;
1436
+ if (show) {
1437
+ this.ngZone.run(function (_) {
1438
+ eventArgs = new PopoverShowEvent(anchorElement);
1439
+ if (!_this.popupRef) {
1440
+ popoverComp.show.emit(eventArgs);
1441
+ }
1442
+ });
1443
+ }
1444
+ else {
1445
+ this.ngZone.run(function (_) {
1446
+ eventArgs = new PopoverHideEvent(anchorElement, _this.popupRef);
1447
+ if (_this.popupRef) {
1448
+ popoverComp.hide.emit(eventArgs);
1449
+ }
1450
+ });
1451
+ }
1452
+ return eventArgs;
1453
+ };
1454
+ PopoverDirectivesBase.prototype.initializeFinishingEvents = function (popoverComp, _anchor) {
1455
+ var _this = this;
1456
+ if (!this._popupOpenSub) {
1457
+ this.popupRef.popupOpen.subscribe(function () {
1458
+ var eventArgs = new PopoverShownEvent(_anchor, _this.popupRef);
1459
+ popoverComp.shown.emit(eventArgs);
1460
+ });
1461
+ }
1462
+ if (!this._popupCloseSub) {
1463
+ this.popupRef.popupClose.subscribe(function () {
1464
+ _this.ngZone.run(function (_) {
1465
+ var eventArgs = new PopoverHiddenEvent(_anchor);
1466
+ popoverComp.hidden.emit(eventArgs);
1467
+ });
1468
+ });
1469
+ }
1470
+ };
1471
+ __decorate([
1472
+ Input(),
1473
+ __metadata("design:type", Object),
1474
+ __metadata("design:paramtypes", [Object])
1475
+ ], PopoverDirectivesBase.prototype, "popover", null);
1476
+ __decorate([
1477
+ Input(),
1478
+ __metadata("design:type", String),
1479
+ __metadata("design:paramtypes", [String])
1480
+ ], PopoverDirectivesBase.prototype, "showOn", null);
1481
+ return PopoverDirectivesBase;
1482
+ }());
1483
+
1484
+ /**
1485
+ * @hidden
1486
+ */
1487
+ var PopoverService = /** @class */ (function () {
1488
+ function PopoverService(ngZone) {
1489
+ this.ngZone = ngZone;
1490
+ this._pointerOverPopup = new BehaviorSubject(null);
1491
+ this._pointerOverAnchor = new BehaviorSubject(null);
1492
+ this._focusInsidePopover = new BehaviorSubject(null);
1493
+ this._hidePopover = new Subject();
1494
+ this.subs = new Subscription();
1495
+ this.monitor();
1496
+ }
1497
+ PopoverService.prototype.ngOnDestroy = function () {
1498
+ this.subs.unsubscribe();
1499
+ };
1500
+ Object.defineProperty(PopoverService.prototype, "isPopoverHovered", {
1501
+ get: function () {
1502
+ return this._pointerOverPopup.asObservable();
1503
+ },
1504
+ enumerable: true,
1505
+ configurable: true
1506
+ });
1507
+ PopoverService.prototype.emitPopoverState = function (isHovered) {
1508
+ var _this = this;
1509
+ this.ngZone.run(function (_) { return _this._pointerOverPopup.next(isHovered); });
1510
+ };
1511
+ Object.defineProperty(PopoverService.prototype, "isAnchorHovered", {
1512
+ get: function () {
1513
+ return this._pointerOverAnchor.asObservable();
1514
+ },
1515
+ enumerable: true,
1516
+ configurable: true
1517
+ });
1518
+ PopoverService.prototype.emitAnchorState = function (isHovered, anchor) {
1519
+ var _this = this;
1520
+ this._isOrigin = this.originAnchor === anchor;
1521
+ this.currentAnchor = anchor;
1522
+ if (isHovered) {
1523
+ this.originAnchor = anchor;
1524
+ }
1525
+ this.ngZone.run(function (_) { return _this._pointerOverAnchor.next(isHovered); });
1526
+ };
1527
+ Object.defineProperty(PopoverService.prototype, "isFocusInsidePopover", {
1528
+ get: function () {
1529
+ return this._focusInsidePopover.asObservable();
1530
+ },
1531
+ enumerable: true,
1532
+ configurable: true
1533
+ });
1534
+ PopoverService.prototype.emitFocusInsidePopover = function (isFocused) {
1535
+ var _this = this;
1536
+ this.ngZone.run(function (_) { return _this._focusInsidePopover.next(isFocused); });
1537
+ this._focusInsidePopover.next(null);
1538
+ };
1539
+ Object.defineProperty(PopoverService.prototype, "hidePopover", {
1540
+ get: function () {
1541
+ return this._hidePopover.asObservable();
1542
+ },
1543
+ enumerable: true,
1544
+ configurable: true
1545
+ });
1546
+ PopoverService.prototype.monitor = function () {
1547
+ var _this = this;
1548
+ this.subs.add(combineLatest(this.isPopoverHovered, this.isAnchorHovered).pipe(
1549
+ // `auditTime` is used because the `mouseleave` event is emitted before `mouseenter`
1550
+ // 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)
1551
+ // resulting in both observables emitting `false`
1552
+ auditTime(20)).subscribe(function (val) {
1553
+ var isPopoverHovered = val[0], isAnchorHovered = val[1];
1554
+ _this._hidePopover.next([isPopoverHovered, isAnchorHovered, _this._isOrigin, _this.currentAnchor]);
1555
+ }));
1556
+ };
1557
+ PopoverService = __decorate([
1558
+ Injectable(),
1559
+ __metadata("design:paramtypes", [NgZone])
1560
+ ], PopoverService);
1561
+ return PopoverService;
1562
+ }());
1563
+
1564
+ /**
1565
+ * Represents the [`kendoPopoverContainer`]({% slug configuration_popover %}#toc-containerdirective) directive.
1566
+ * It is used to filter and target multiple elements, which should display a popover on interaction.
1567
+ *
1568
+ * @example
1569
+ * ```ts-no-run
1570
+ * <div kendoPopoverContainer [popover]="myPopover" filter=".has-popover">
1571
+ * <button class="has-popover">Show Popover</button>
1572
+ * <button>Button Without Popover</button>
1573
+ * <button class="has-popover">Show Popover</button>
1574
+ * </div>
1575
+ * ```
1576
+ */
1577
+ var PopoverContainerDirective = /** @class */ (function (_super) {
1578
+ __extends(PopoverContainerDirective, _super);
1579
+ function PopoverContainerDirective(wrapperEl, ngZone, popupService, renderer, popoverService) {
1580
+ var _this = _super.call(this, ngZone, popupService, renderer) || this;
1581
+ _this.wrapperEl = wrapperEl;
1582
+ _this.ngZone = ngZone;
1583
+ _this.popupService = popupService;
1584
+ _this.renderer = renderer;
1585
+ _this.popoverService = popoverService;
1586
+ _this.mouseenterHandler = function (anchor) {
1587
+ _this.controlVisibility(anchor, true);
1588
+ };
1589
+ _this.mouseleaveHandler = function (args) {
1590
+ var anchor = args.anchor;
1591
+ if (_this.isPrevented(anchor, false)) {
1592
+ return;
1593
+ }
1594
+ if (!_this._hideSub) {
1595
+ _this._hideSub = _this.popoverService.hidePopover.subscribe(function (val) {
1596
+ var isPopoverHovered = val[0], isOriginAnchor = val[2], currentAnchor = val[3];
1597
+ if (!isPopoverHovered && !isOriginAnchor) {
1598
+ _this.hide();
1599
+ if (!isOriginAnchor && currentAnchor) {
1600
+ _this.show(currentAnchor);
1601
+ }
1602
+ }
1603
+ });
1604
+ }
1605
+ };
1606
+ _this.focusHandler = function (anchor) {
1607
+ _this.controlVisibility(anchor, true);
1608
+ };
1609
+ _this.blurHandler = function (args) {
1610
+ var anchor = args.anchor;
1611
+ var event = args.domEvent;
1612
+ if (_this.isPrevented(anchor, false)) {
1613
+ return;
1614
+ }
1615
+ // from anchor to popup focus check
1616
+ var isFocusInside = !!closest(event.relatedTarget, function (node) { return node.classList && node.classList.contains('k-popover'); });
1617
+ if (!isFocusInside) {
1618
+ _this.hide();
1619
+ }
1620
+ if (!_this._focusInsideSub) {
1621
+ // inside popup focus check
1622
+ _this._focusInsideSub = _this.popoverService.isFocusInsidePopover.pipe(filter(function (v) { return v !== null; })).subscribe(function (val) {
1623
+ if (!val && !isFocusInside) {
1624
+ _this.hide();
1625
+ }
1626
+ });
1627
+ }
1628
+ };
1629
+ _this._popoverService = _this.popoverService;
1630
+ return _this;
1631
+ }
1632
+ /**
1633
+ * Shows the Popover.
1634
+ *
1635
+ * @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 %})
1636
+ */
1637
+ PopoverContainerDirective.prototype.show = function (anchor) {
1638
+ if (this.popupRef) {
1639
+ return;
1640
+ }
1641
+ this.openPopup(anchor);
1642
+ };
1643
+ /**
1644
+ * Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
1645
+ *
1646
+ * @param anchor&mdash;Specifies the element that will be used as an anchor. The Popover opens relative to that element.
1647
+ */
1648
+ PopoverContainerDirective.prototype.toggle = function (anchor) {
1649
+ var previousAnchor = this.popupRef && this.popupRef.content.instance.anchor;
1650
+ if (this.popupRef) {
1651
+ this.hide();
1652
+ if (previousAnchor !== anchor) {
1653
+ this.show(anchor);
1654
+ }
1655
+ }
1656
+ else {
1657
+ this.show(anchor);
1658
+ }
1659
+ };
1660
+ PopoverContainerDirective.prototype.subscribeClick = function () {
1661
+ var _this = this;
1662
+ if (this.disposeClickListener) {
1663
+ this.disposeClickListener();
1664
+ }
1665
+ this.disposeClickListener = this.renderer.listen(document, 'click', function (e) {
1666
+ var filterElement = closestBySelector(e.target, _this.filter);
1667
+ _this.clickHandler(filterElement, e);
1668
+ });
1669
+ };
1670
+ PopoverContainerDirective.prototype.subscribeToEvents = function (arr) {
1671
+ var _this = this;
1672
+ var filteredElements = Array.from(document.querySelectorAll(this.filter));
1673
+ filteredElements.forEach(function (el) {
1674
+ _this.subs.add(_this.renderer.listen(el, arr[0].name, function () {
1675
+ _this.popoverService.emitAnchorState(true, el);
1676
+ arr[0].handler(el);
1677
+ }));
1678
+ _this.subs.add(_this.renderer.listen(el, arr[1].name, function (e) {
1679
+ _this.popoverService.emitAnchorState(false, null);
1680
+ arr[1].handler({ anchor: el, domEvent: e });
1681
+ }));
1682
+ });
1683
+ };
1684
+ PopoverContainerDirective.prototype.clickHandler = function (anchor, event) {
1685
+ var isInsidePopup = !!closest(event.target, function (node) { return node.classList && node.classList.contains('k-popup'); });
1686
+ var popupRefAnchor = this.popupRef && this.popupRef.content.instance.anchor;
1687
+ var isOriginAnchor = !!closest(event.target, function (node) { return node === (popupRefAnchor ? popupRefAnchor : anchor); });
1688
+ if (this.showOn !== 'click' || isInsidePopup || (this.popupRef && isOriginAnchor)) {
1689
+ return;
1690
+ }
1691
+ if (!anchor && this.popupRef) {
1692
+ this.controlVisibility(anchor, false);
1693
+ return;
1694
+ }
1695
+ if (isOriginAnchor) {
1696
+ this.controlVisibility(anchor, true);
1697
+ }
1698
+ else if (this.popupRef) {
1699
+ this.controlVisibility(anchor, false);
1700
+ this.controlVisibility(anchor, true);
1701
+ }
1702
+ };
1703
+ PopoverContainerDirective.prototype.controlVisibility = function (anchor, show) {
1704
+ if (this.isPrevented(anchor, show)) {
1705
+ return;
1706
+ }
1707
+ show ? this.show(anchor) : this.hide();
1708
+ };
1709
+ __decorate([
1710
+ Input(),
1711
+ __metadata("design:type", String)
1712
+ ], PopoverContainerDirective.prototype, "filter", void 0);
1713
+ PopoverContainerDirective = __decorate([
1714
+ Directive({
1715
+ selector: '[kendoPopoverContainer]',
1716
+ exportAs: 'kendoPopoverContainer',
1717
+ providers: [PopoverService]
1718
+ }),
1719
+ __metadata("design:paramtypes", [ElementRef,
1720
+ NgZone,
1721
+ PopupService,
1722
+ Renderer2,
1723
+ PopoverService])
1724
+ ], PopoverContainerDirective);
1725
+ return PopoverContainerDirective;
1726
+ }(PopoverDirectivesBase));
1727
+
1728
+ /**
1729
+ * Represents the [`kendoPopoverAnchor`]({% slug configuration_popover %}#toc-anchordirective) directive.
1730
+ * It is used to target an element, which should display a popover on interaction.
1731
+ *
1732
+ * @example
1733
+ * ```ts-no-run
1734
+ * <button kendoPopoverAnchor [popover]="myPopover">Show Popover</button>
1735
+ * ```
1736
+ */
1737
+ var PopoverAnchorDirective = /** @class */ (function (_super) {
1738
+ __extends(PopoverAnchorDirective, _super);
1739
+ function PopoverAnchorDirective(hostEl, ngZone, popupService, renderer, popoverService) {
1740
+ var _this = _super.call(this, ngZone, popupService, renderer) || this;
1741
+ _this.hostEl = hostEl;
1742
+ _this.ngZone = ngZone;
1743
+ _this.popupService = popupService;
1744
+ _this.renderer = renderer;
1745
+ _this.popoverService = popoverService;
1746
+ _this.mouseenterHandler = function () {
1747
+ _this.controlVisibility(_this.hostEl.nativeElement, true);
1748
+ };
1749
+ _this.mouseleaveHandler = function () {
1750
+ if (_this.isPrevented(_this.hostEl.nativeElement, false)) {
1751
+ return;
1752
+ }
1753
+ if (!_this._hideSub) {
1754
+ _this._hideSub = _this.popoverService.hidePopover.subscribe(function (val) {
1755
+ var isPopoverHovered = val[0], isAnchorHovered = val[1];
1756
+ if (!isPopoverHovered && !isAnchorHovered) {
1757
+ _this.hide();
1758
+ }
1759
+ });
1760
+ }
1761
+ };
1762
+ _this.focusHandler = function () {
1763
+ _this.controlVisibility(_this.hostEl.nativeElement, true);
1764
+ };
1765
+ _this.blurHandler = function (args) {
1766
+ var event = args.domEvent;
1767
+ if (_this.isPrevented(_this.hostEl.nativeElement, false)) {
1768
+ return;
1769
+ }
1770
+ // from anchor to popup focus check
1771
+ var isFocusInside = !!closest(event.relatedTarget, function (node) { return node.classList && node.classList.contains('k-popover'); });
1772
+ if (!isFocusInside) {
1773
+ _this.hide();
1774
+ }
1775
+ if (!_this._focusInsideSub) {
1776
+ // inside popup focus check
1777
+ _this._focusInsideSub = _this.popoverService.isFocusInsidePopover.pipe(filter(function (v) { return v !== null; })).subscribe(function (val) {
1778
+ if (!val) {
1779
+ _this.hide();
1780
+ }
1781
+ });
1782
+ }
1783
+ };
1784
+ _this._popoverService = _this.popoverService;
1785
+ return _this;
1786
+ }
1787
+ /**
1788
+ * Shows the Popover. [See example]({% slug programmaticcontrol_popover %})
1789
+ */
1790
+ PopoverAnchorDirective.prototype.show = function () {
1791
+ if (this.popupRef) {
1792
+ return;
1793
+ }
1794
+ this.openPopup(this.hostEl.nativeElement);
1795
+ };
1796
+ /**
1797
+ * Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
1798
+ */
1799
+ PopoverAnchorDirective.prototype.toggle = function () {
1800
+ if (this.popupRef) {
1801
+ this.hide();
1802
+ }
1803
+ else {
1804
+ this.show();
1805
+ }
1806
+ };
1807
+ PopoverAnchorDirective.prototype.subscribeToEvents = function (arr) {
1808
+ var _this = this;
1809
+ this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[0].name, function () {
1810
+ _this.popoverService.emitAnchorState(true, _this.hostEl.nativeElement);
1811
+ arr[0].handler();
1812
+ }));
1813
+ this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[1].name, function (e) {
1814
+ _this.popoverService.emitAnchorState(false, null);
1815
+ arr[1].handler({ domEvent: e });
1816
+ }));
1817
+ };
1818
+ PopoverAnchorDirective.prototype.subscribeClick = function () {
1819
+ var _this = this;
1820
+ if (this.disposeClickListener) {
1821
+ this.disposeClickListener();
1822
+ }
1823
+ this.disposeClickListener = this.renderer.listen(document, 'click', function (e) {
1824
+ _this.onClick(e);
1825
+ });
1826
+ };
1827
+ /**
1828
+ * @hidden
1829
+ */
1830
+ PopoverAnchorDirective.prototype.onClick = function (event) {
1831
+ var _this = this;
1832
+ var isInsidePopup = !!closest(event.target, function (node) { return node.classList && node.classList.contains('k-popup'); });
1833
+ var isAnchor = !!closest(event.target, function (node) { return node === _this.hostEl.nativeElement; });
1834
+ if (isInsidePopup || (this.popupRef && isAnchor)) {
1835
+ return;
1836
+ }
1837
+ if (isAnchor) {
1838
+ // on opening
1839
+ this.controlVisibility(this.hostEl.nativeElement, true);
1840
+ }
1841
+ else {
1842
+ // on closing
1843
+ this.controlVisibility(this.hostEl.nativeElement, false);
1844
+ }
1845
+ };
1846
+ PopoverAnchorDirective.prototype.controlVisibility = function (anchor, show) {
1847
+ if (this.isPrevented(anchor, show)) {
1848
+ return;
1849
+ }
1850
+ show ? this.show() : this.hide();
1851
+ };
1852
+ PopoverAnchorDirective = __decorate([
1853
+ Directive({
1854
+ selector: '[kendoPopoverAnchor]',
1855
+ exportAs: 'kendoPopoverAnchor',
1856
+ providers: [PopoverService]
1857
+ }),
1858
+ __metadata("design:paramtypes", [ElementRef,
1859
+ NgZone,
1860
+ PopupService,
1861
+ Renderer2,
1862
+ PopoverService])
1863
+ ], PopoverAnchorDirective);
1864
+ return PopoverAnchorDirective;
1865
+ }(PopoverDirectivesBase));
1866
+
798
1867
  /**
799
1868
  * @hidden
800
1869
  */
@@ -872,8 +1941,98 @@ var TooltipModule = /** @class */ (function () {
872
1941
  return TooltipModule;
873
1942
  }());
874
1943
 
1944
+ var DIRECTIVES = [
1945
+ PopoverActionsTemplateDirective,
1946
+ PopoverBodyTemplateDirective,
1947
+ PopoverTitleTemplateDirective,
1948
+ PopoverAnchorDirective,
1949
+ PopoverContainerDirective
1950
+ ];
1951
+ /**
1952
+ * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
1953
+ * definition for the Popover component.
1954
+ *
1955
+ * @example
1956
+ *
1957
+ * ```ts-no-run
1958
+ * import { PopoverModule } from '@progress/kendo-angular-tooltip';
1959
+ *
1960
+ * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
1961
+ * import { NgModule } from '@angular/core';
1962
+ *
1963
+ * import { AppComponent } from './app.component';
1964
+ *
1965
+ * _@NgModule({
1966
+ * declarations: [AppComponent],
1967
+ * imports: [BrowserModule, PopoverModule],
1968
+ * bootstrap: [AppComponent]
1969
+ * })
1970
+ * export class AppModule {}
1971
+ *
1972
+ * platformBrowserDynamic().bootstrapModule(AppModule);
1973
+ *
1974
+ * ```
1975
+ */
1976
+ var PopoverModule = /** @class */ (function () {
1977
+ function PopoverModule() {
1978
+ }
1979
+ PopoverModule = __decorate([
1980
+ NgModule({
1981
+ declarations: DIRECTIVES.concat([
1982
+ PopoverComponent
1983
+ ]),
1984
+ entryComponents: [PopoverComponent],
1985
+ exports: DIRECTIVES.concat([PopoverComponent]),
1986
+ imports: [
1987
+ CommonModule,
1988
+ PopupModule
1989
+ ]
1990
+ })
1991
+ ], PopoverModule);
1992
+ return PopoverModule;
1993
+ }());
1994
+
1995
+ /**
1996
+ * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
1997
+ * definition for the Tooltips components.
1998
+ *
1999
+ * @example
2000
+ *
2001
+ * ```ts-no-run
2002
+ * import { TooltipsModule } from '@progress/kendo-angular-tooltip';
2003
+ *
2004
+ * // The browser platform with a compiler
2005
+ * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2006
+ *
2007
+ * import { NgModule } from '@angular/core';
2008
+ *
2009
+ * // Import the app component
2010
+ * _@NgModule{{
2011
+ * declarations: [AppComponent], // declare app component
2012
+ * imports: [BrowserModule, TooltipsModule], // import TooltipsModule module
2013
+ * bootstrap: [AppComponent]
2014
+ * }}
2015
+ * export class AppModule {}
2016
+ *
2017
+ * // Compile and launch the module
2018
+ * platformBrowserDynamic().bootstrapModule(AppModule);
2019
+ * ```
2020
+ */
2021
+ var TooltipsModule = /** @class */ (function () {
2022
+ function TooltipsModule() {
2023
+ }
2024
+ TooltipsModule = __decorate([
2025
+ NgModule({
2026
+ exports: [TooltipModule, PopoverModule]
2027
+ })
2028
+ ], TooltipsModule);
2029
+ return TooltipsModule;
2030
+ }());
2031
+
2032
+ // Tooltip
2033
+
875
2034
  /**
876
2035
  * Generated bundle index. Do not edit.
877
2036
  */
878
2037
 
879
- export { LocalizedMessagesDirective, TooltipContentComponent, TooltipDirective, TooltipModule, TooltipSettings, TOOLTIP_SETTINGS };
2038
+ export { LocalizedMessagesDirective, PopoverDirectivesBase, PopoverService, TooltipContentComponent, TooltipDirective, TooltipSettings, TOOLTIP_SETTINGS, PopoverComponent, PopoverContainerDirective, PopoverAnchorDirective, PopoverTitleTemplateDirective, PopoverBodyTemplateDirective, PopoverActionsTemplateDirective, PopoverShowEvent, PopoverShownEvent, PopoverHideEvent, PopoverHiddenEvent, TooltipModule, PopoverModule, TooltipsModule };