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