@progress/kendo-angular-tooltip 11.1.0-develop.8 → 11.1.0

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.
@@ -3,18 +3,18 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as i0 from '@angular/core';
6
- import { InjectionToken, Injectable, forwardRef, Directive, Input, EventEmitter, Component, HostBinding, Output, isDevMode, Optional, Inject, ContentChild, ElementRef, NgModule } from '@angular/core';
6
+ import { InjectionToken, Injectable, forwardRef, Directive, Input, EventEmitter, Component, HostBinding, Output, isDevMode, Optional, Inject, ViewChild, ContentChild, ElementRef, NgModule } from '@angular/core';
7
7
  import { filter, take, auditTime } from 'rxjs/operators';
8
8
  import { Subscription, fromEvent, BehaviorSubject, Subject, combineLatest } from 'rxjs';
9
9
  import { validatePackage } from '@progress/kendo-licensing';
10
10
  import * as i1 from '@progress/kendo-angular-l10n';
11
11
  import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
12
+ import { focusableSelector, isDocumentAvailable, Keys, PreventableEvent, closest, hasObservers } from '@progress/kendo-angular-common';
12
13
  import { xIcon } from '@progress/kendo-svg-icons';
13
14
  import * as i2 from '@progress/kendo-angular-icons';
14
15
  import { IconsModule } from '@progress/kendo-angular-icons';
15
16
  import * as i2$1 from '@angular/common';
16
17
  import { CommonModule } from '@angular/common';
17
- import { isDocumentAvailable, Keys, PreventableEvent, closest, hasObservers } from '@progress/kendo-angular-common';
18
18
  import * as i1$1 from '@progress/kendo-angular-popup';
19
19
  import { PopupModule } from '@progress/kendo-angular-popup';
20
20
 
@@ -25,8 +25,8 @@ const packageMetadata = {
25
25
  name: '@progress/kendo-angular-tooltip',
26
26
  productName: 'Kendo UI for Angular',
27
27
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
28
- publishDate: 1674850457,
29
- version: '11.1.0-develop.8',
28
+ publishDate: 1675250300,
29
+ version: '11.1.0',
30
30
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
31
31
  };
32
32
 
@@ -81,8 +81,23 @@ let idx = 0;
81
81
  /**
82
82
  * @hidden
83
83
  */
84
- const getId = (prefix) => {
85
- return `${prefix}-${++idx}`;
84
+ let popoverTitleIdx = 0;
85
+ /**
86
+ * @hidden
87
+ */
88
+ let popoverBodyIdx = 0;
89
+ /**
90
+ * @hidden
91
+ */
92
+ const getId = (prefix, idSource) => {
93
+ switch (idSource) {
94
+ case 'popoverTitle':
95
+ return `${prefix}-${++popoverTitleIdx}`;
96
+ case 'popoverBody':
97
+ return `${prefix}-${++popoverBodyIdx}`;
98
+ default:
99
+ return `${prefix}-${++idx}`;
100
+ }
86
101
  };
87
102
  /**
88
103
  * @hidden
@@ -192,6 +207,21 @@ function getCenterOffset(item, dir, size) {
192
207
  function containsItem(collection, item) {
193
208
  return collection.indexOf(item) !== -1;
194
209
  }
210
+ /**
211
+ * @hidden
212
+ */
213
+ function getAllFocusableChildren(parent) {
214
+ return parent.querySelectorAll(focusableSelector);
215
+ }
216
+ /**
217
+ * @hidden
218
+ */
219
+ function getFirstAndLastFocusable(parent) {
220
+ const all = getAllFocusableChildren(parent);
221
+ const firstFocusable = all.length > 0 ? all[0] : parent;
222
+ const lastFocusable = all.length > 0 ? all[all.length - 1] : parent;
223
+ return [firstFocusable, lastFocusable];
224
+ }
195
225
 
196
226
  /**
197
227
  * @hidden
@@ -976,6 +1006,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
976
1006
  }] }];
977
1007
  } });
978
1008
 
1009
+ /* eslint-disable @typescript-eslint/no-explicit-any */
979
1010
  /**
980
1011
  * Represents the [Kendo UI Popover component for Angular]({% slug overview_popover %}).
981
1012
  * Used to display additional information that is related to a target element.
@@ -990,8 +1021,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
990
1021
  * ```
991
1022
  */
992
1023
  class PopoverComponent {
993
- constructor(localization) {
1024
+ constructor(localization, renderer, element, zone) {
994
1025
  this.localization = localization;
1026
+ this.renderer = renderer;
1027
+ this.element = element;
1028
+ this.zone = zone;
995
1029
  /**
996
1030
  * Specifies the position of the Popover in relation to its anchor element. [See example]({% slug positioning_popover %})
997
1031
  *
@@ -1042,6 +1076,10 @@ class PopoverComponent {
1042
1076
  * Fires after the Popover has been hidden and the animation has ended. [See example]({% slug events_popover %})
1043
1077
  */
1044
1078
  this.hidden = new EventEmitter();
1079
+ /**
1080
+ * @hidden
1081
+ */
1082
+ this.closeOnKeyDown = new EventEmitter();
1045
1083
  /**
1046
1084
  * @hidden
1047
1085
  */
@@ -1050,11 +1088,12 @@ class PopoverComponent {
1050
1088
  * @hidden
1051
1089
  */
1052
1090
  this._height = 'auto';
1053
- this._offset = 6;
1054
- this.subs = new Subscription();
1055
1091
  /**
1056
1092
  * @hidden
1057
1093
  */
1094
+ this.popoverId = '';
1095
+ this._offset = 6;
1096
+ this.subs = new Subscription();
1058
1097
  this._templateData = () => null;
1059
1098
  validatePackage(packageMetadata);
1060
1099
  }
@@ -1118,9 +1157,21 @@ class PopoverComponent {
1118
1157
  return !this.visible;
1119
1158
  }
1120
1159
  ngOnInit() {
1121
- this.subs.add(this.localization.changes.subscribe(({ rtl }) => {
1122
- this.direction = rtl ? 'rtl' : 'ltr';
1123
- }));
1160
+ this.popoverId = getId('k-popover');
1161
+ this.subs.add(this.localization.changes.subscribe(({ rtl }) => { this.direction = rtl ? 'rtl' : 'ltr'; }));
1162
+ this.subs.add(this.renderer.listen(this.element.nativeElement, 'keydown', event => this.onKeyDown(event)));
1163
+ }
1164
+ ngAfterViewInit() {
1165
+ this.zone.onStable.pipe(take(1)).subscribe(() => {
1166
+ if (this.visible) {
1167
+ const wrapper = this.popoverWrapper.nativeElement;
1168
+ const focusablePopoverChildren = getAllFocusableChildren(wrapper);
1169
+ if (focusablePopoverChildren.length > 0) {
1170
+ focusablePopoverChildren[0].focus();
1171
+ }
1172
+ this.setAriaAttributes(wrapper, focusablePopoverChildren);
1173
+ }
1174
+ });
1124
1175
  }
1125
1176
  ngOnDestroy() {
1126
1177
  this.subs.unsubscribe();
@@ -1137,16 +1188,65 @@ class PopoverComponent {
1137
1188
  default: return { 'k-callout-s': true };
1138
1189
  }
1139
1190
  }
1191
+ /**
1192
+ * @hidden
1193
+ */
1194
+ onKeyDown(event) {
1195
+ const keyCode = event.keyCode;
1196
+ const target = event.target;
1197
+ if (keyCode === Keys.Tab) {
1198
+ this.keepFocusWithinComponent(target, event);
1199
+ }
1200
+ if (keyCode === Keys.Escape) {
1201
+ this.closeOnKeyDown.emit();
1202
+ }
1203
+ }
1204
+ keepFocusWithinComponent(target, event) {
1205
+ const wrapper = this.popoverWrapper.nativeElement;
1206
+ const [firstFocusable, lastFocusable] = getFirstAndLastFocusable(wrapper);
1207
+ const tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
1208
+ const shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
1209
+ if (tabAfterLastFocusable) {
1210
+ event.preventDefault();
1211
+ firstFocusable.focus();
1212
+ }
1213
+ if (shiftTabAfterFirstFocusable) {
1214
+ event.preventDefault();
1215
+ lastFocusable.focus();
1216
+ }
1217
+ }
1218
+ setAriaAttributes(wrapper, focusablePopoverChildren) {
1219
+ if (this.titleTemplate) {
1220
+ const titleRef = this.titleTemplateWrapper.nativeElement;
1221
+ const focusableHeaderChildren = getAllFocusableChildren(titleRef).length > 0;
1222
+ if (focusableHeaderChildren) {
1223
+ const headerId = getId('k-popover-header', 'popoverTitle');
1224
+ this.renderer.setAttribute(titleRef, 'id', headerId);
1225
+ this.renderer.setAttribute(wrapper, 'aria-labelledby', headerId);
1226
+ }
1227
+ }
1228
+ if (this.bodyTemplate) {
1229
+ const bodyRef = this.bodyTemplateWrapper.nativeElement;
1230
+ const focusableBodyChildren = getAllFocusableChildren(bodyRef).length > 0;
1231
+ if (focusableBodyChildren) {
1232
+ const bodyId = getId('k-popover-body', 'popoverBody');
1233
+ this.renderer.setAttribute(bodyRef, 'id', bodyId);
1234
+ this.renderer.setAttribute(wrapper, 'aria-describedby', bodyId);
1235
+ }
1236
+ }
1237
+ this.renderer.setAttribute(wrapper, 'id', this.popoverId);
1238
+ this.renderer.setAttribute(wrapper, 'role', focusablePopoverChildren.length > 0 ? 'dialog' : 'tooltip');
1239
+ }
1140
1240
  }
1141
- PopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PopoverComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
1142
- PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: PopoverComponent, selector: "kendo-popover", inputs: { position: "position", offset: "offset", width: "width", height: "height", title: "title", subtitle: "subtitle", body: "body", callout: "callout", animation: "animation", templateData: "templateData" }, outputs: { show: "show", shown: "shown", hide: "hide", hidden: "hidden" }, host: { properties: { "attr.dir": "this.direction", "class.k-hidden": "this.isHidden", "attr.aria-hidden": "this.hasAttributeHidden", "style.width": "this._width", "style.height": "this._height" } }, providers: [
1241
+ PopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PopoverComponent, deps: [{ token: i1.LocalizationService }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1242
+ PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: PopoverComponent, selector: "kendo-popover", inputs: { position: "position", offset: "offset", width: "width", height: "height", title: "title", subtitle: "subtitle", body: "body", callout: "callout", animation: "animation", templateData: "templateData" }, outputs: { show: "show", shown: "shown", hide: "hide", hidden: "hidden", closeOnKeyDown: "closeOnKeyDown" }, host: { properties: { "attr.dir": "this.direction", "class.k-hidden": "this.isHidden", "attr.aria-hidden": "this.hasAttributeHidden", "style.width": "this._width", "style.height": "this._height" } }, providers: [
1143
1243
  LocalizationService,
1144
1244
  {
1145
1245
  provide: L10N_PREFIX,
1146
1246
  useValue: 'kendo.popover'
1147
1247
  }
1148
- ], queries: [{ propertyName: "titleTemplate", first: true, predicate: PopoverTitleTemplateDirective, descendants: true }, { propertyName: "bodyTemplate", first: true, predicate: PopoverBodyTemplateDirective, descendants: true }, { propertyName: "actionsTemplate", first: true, predicate: PopoverActionsTemplateDirective, descendants: true }], ngImport: i0, template: `
1149
- <div *ngIf="visible" role="tooltip" class="k-popover" [ngStyle]="{'width': width, 'height': height}">
1248
+ ], queries: [{ propertyName: "titleTemplate", first: true, predicate: PopoverTitleTemplateDirective, descendants: true }, { propertyName: "bodyTemplate", first: true, predicate: PopoverBodyTemplateDirective, descendants: true }, { propertyName: "actionsTemplate", first: true, predicate: PopoverActionsTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "popoverWrapper", first: true, predicate: ["popoverWrapper"], descendants: true }, { propertyName: "titleTemplateWrapper", first: true, predicate: ["titleTemplateWrapper"], descendants: true }, { propertyName: "bodyTemplateWrapper", first: true, predicate: ["bodyTemplateWrapper"], descendants: true }], ngImport: i0, template: `
1249
+ <div #popoverWrapper *ngIf="visible" class="k-popover" [ngStyle]="{'width': width, 'height': height}">
1150
1250
  <div class="k-popover-callout" [ngClass]="getCalloutPosition()" *ngIf="callout"></div>
1151
1251
 
1152
1252
  <div class="k-popover-inner" *ngIf="callout; else noCallout">
@@ -1154,7 +1254,7 @@ PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
1154
1254
  </div>
1155
1255
 
1156
1256
  <ng-template #noCallout>
1157
- <div *ngIf="titleTemplate || title" class="k-popover-header">
1257
+ <div #titleTemplateWrapper *ngIf="titleTemplate || title" class="k-popover-header">
1158
1258
  <ng-template *ngIf="titleTemplate"
1159
1259
  [ngTemplateOutlet]="titleTemplate?.templateRef"
1160
1260
  [ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
@@ -1164,7 +1264,7 @@ PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
1164
1264
  </ng-container>
1165
1265
  </div>
1166
1266
 
1167
- <div *ngIf="bodyTemplate || body" class="k-popover-body">
1267
+ <div #bodyTemplateWrapper *ngIf="bodyTemplate || body" class="k-popover-body">
1168
1268
  <ng-template *ngIf="bodyTemplate"
1169
1269
  [ngTemplateOutlet]="bodyTemplate?.templateRef"
1170
1270
  [ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
@@ -1195,7 +1295,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1195
1295
  }
1196
1296
  ],
1197
1297
  template: `
1198
- <div *ngIf="visible" role="tooltip" class="k-popover" [ngStyle]="{'width': width, 'height': height}">
1298
+ <div #popoverWrapper *ngIf="visible" class="k-popover" [ngStyle]="{'width': width, 'height': height}">
1199
1299
  <div class="k-popover-callout" [ngClass]="getCalloutPosition()" *ngIf="callout"></div>
1200
1300
 
1201
1301
  <div class="k-popover-inner" *ngIf="callout; else noCallout">
@@ -1203,7 +1303,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1203
1303
  </div>
1204
1304
 
1205
1305
  <ng-template #noCallout>
1206
- <div *ngIf="titleTemplate || title" class="k-popover-header">
1306
+ <div #titleTemplateWrapper *ngIf="titleTemplate || title" class="k-popover-header">
1207
1307
  <ng-template *ngIf="titleTemplate"
1208
1308
  [ngTemplateOutlet]="titleTemplate?.templateRef"
1209
1309
  [ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
@@ -1213,7 +1313,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1213
1313
  </ng-container>
1214
1314
  </div>
1215
1315
 
1216
- <div *ngIf="bodyTemplate || body" class="k-popover-body">
1316
+ <div #bodyTemplateWrapper *ngIf="bodyTemplate || body" class="k-popover-body">
1217
1317
  <ng-template *ngIf="bodyTemplate"
1218
1318
  [ngTemplateOutlet]="bodyTemplate?.templateRef"
1219
1319
  [ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
@@ -1233,7 +1333,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1233
1333
  </div>
1234
1334
  `
1235
1335
  }]
1236
- }], ctorParameters: function () { return [{ type: i1.LocalizationService }]; }, propDecorators: { position: [{
1336
+ }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { position: [{
1237
1337
  type: Input
1238
1338
  }], offset: [{
1239
1339
  type: Input
@@ -1270,6 +1370,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1270
1370
  type: Output
1271
1371
  }], hidden: [{
1272
1372
  type: Output
1373
+ }], closeOnKeyDown: [{
1374
+ type: Output
1375
+ }], popoverWrapper: [{
1376
+ type: ViewChild,
1377
+ args: ['popoverWrapper']
1378
+ }], titleTemplateWrapper: [{
1379
+ type: ViewChild,
1380
+ args: ['titleTemplateWrapper']
1381
+ }], bodyTemplateWrapper: [{
1382
+ type: ViewChild,
1383
+ args: ['bodyTemplateWrapper']
1273
1384
  }], titleTemplate: [{
1274
1385
  type: ContentChild,
1275
1386
  args: [PopoverTitleTemplateDirective, { static: false }]
@@ -1348,6 +1459,7 @@ class PopoverHiddenEvent {
1348
1459
  }
1349
1460
  }
1350
1461
 
1462
+ /* eslint-disable @typescript-eslint/no-unused-vars */
1351
1463
  const validShowOptions = ['hover', 'click', 'none', 'focus'];
1352
1464
  /**
1353
1465
  * @hidden
@@ -1357,6 +1469,10 @@ class PopoverDirectivesBase {
1357
1469
  this.ngZone = ngZone;
1358
1470
  this.popupService = popupService;
1359
1471
  this.renderer = renderer;
1472
+ /**
1473
+ * @hidden
1474
+ */
1475
+ this.anchor = null;
1360
1476
  this.subs = new Subscription();
1361
1477
  this._showOn = 'click';
1362
1478
  }
@@ -1406,14 +1522,14 @@ class PopoverDirectivesBase {
1406
1522
  this.ngZone.runOutsideAngular(() => {
1407
1523
  switch (this.showOn) {
1408
1524
  case 'hover':
1409
- this.subscribeToEvents([{
1525
+ this.subscribeToShowEvents([{
1410
1526
  name: 'mouseenter', handler: this.mouseenterHandler
1411
1527
  }, {
1412
1528
  name: 'mouseleave', handler: this.mouseleaveHandler
1413
1529
  }]);
1414
1530
  break;
1415
1531
  case 'focus':
1416
- this.subscribeToEvents([{
1532
+ this.subscribeToShowEvents([{
1417
1533
  name: 'focus', handler: this.focusHandler
1418
1534
  }, {
1419
1535
  name: 'blur', handler: this.blurHandler
@@ -1429,6 +1545,7 @@ class PopoverDirectivesBase {
1429
1545
  }
1430
1546
  ngOnDestroy() {
1431
1547
  this.closePopup();
1548
+ this.subs.unsubscribe();
1432
1549
  if (this.disposeHoverOverListener) {
1433
1550
  this.disposeHoverOverListener();
1434
1551
  }
@@ -1444,9 +1561,6 @@ class PopoverDirectivesBase {
1444
1561
  if (this._hideSub) {
1445
1562
  this._hideSub.unsubscribe();
1446
1563
  }
1447
- if (this.subs) {
1448
- this.subs.unsubscribe();
1449
- }
1450
1564
  if (this._popupOpenSub) {
1451
1565
  this._popupOpenSub.unsubscribe();
1452
1566
  }
@@ -1465,6 +1579,9 @@ class PopoverDirectivesBase {
1465
1579
  */
1466
1580
  closePopup() {
1467
1581
  if (this.popupRef) {
1582
+ if (this.anchor) {
1583
+ this.renderer.removeAttribute(this.anchor, 'aria-describedby');
1584
+ }
1468
1585
  this.popupRef.close();
1469
1586
  this.popupRef = null;
1470
1587
  if (this.disposePopupHoverOutListener) {
@@ -1482,15 +1599,15 @@ class PopoverDirectivesBase {
1482
1599
  * @hidden
1483
1600
  */
1484
1601
  openPopup(anchor) {
1485
- const _anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;
1486
- const popoverComp = this.popover instanceof PopoverComponent ? this.popover : this.popover(_anchor);
1602
+ this.anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;
1603
+ const popoverComp = this.popover instanceof PopoverComponent ? this.popover : this.popover(this.anchor);
1487
1604
  const alignSettings = align(popoverComp.position, popoverComp.offset);
1488
1605
  const anchorAlign = alignSettings.anchorAlign;
1489
1606
  const popupAlign = alignSettings.popupAlign;
1490
1607
  const popupMargin = alignSettings.popupMargin;
1491
1608
  const _animation = popoverComp.animation;
1492
1609
  this.popupRef = this.popupService.open({
1493
- anchor: { nativeElement: _anchor },
1610
+ anchor: { nativeElement: this.anchor },
1494
1611
  animate: _animation,
1495
1612
  content: PopoverComponent,
1496
1613
  popupAlign,
@@ -1499,9 +1616,18 @@ class PopoverDirectivesBase {
1499
1616
  popupClass: 'k-popup-transparent',
1500
1617
  collision: { horizontal: 'fit', vertical: 'fit' }
1501
1618
  });
1502
- this.applySettings(this.popupRef.content, popoverComp, anchor);
1619
+ const popupInstance = this.popupRef.content.instance;
1620
+ if (anchor) {
1621
+ this.subs.add(this.renderer.listen(this.anchor, 'keydown', event => this.onKeyDown(event)));
1622
+ this.renderer.setAttribute(this.anchor, 'aria-describedby', popupInstance.popoverId);
1623
+ }
1624
+ this.subs.add(popupInstance.closeOnKeyDown.subscribe(() => {
1625
+ this.anchor.focus();
1626
+ this.hide();
1627
+ }));
1628
+ this.applySettings(this.popupRef.content, popoverComp);
1503
1629
  this.monitorPopup();
1504
- this.initializeCompletionEvents(popoverComp, _anchor);
1630
+ this.initializeCompletionEvents(popoverComp, this.anchor);
1505
1631
  }
1506
1632
  /**
1507
1633
  * @hidden
@@ -1540,11 +1666,10 @@ class PopoverDirectivesBase {
1540
1666
  });
1541
1667
  }
1542
1668
  }
1543
- applySettings(contentComponent, popover, anchor) {
1669
+ applySettings(contentComponent, popover) {
1544
1670
  const content = contentComponent.instance;
1545
- const _anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;
1546
1671
  content.visible = true;
1547
- content.anchor = _anchor;
1672
+ content.anchor = this.anchor;
1548
1673
  content.position = popover.position;
1549
1674
  content.offset = popover.offset;
1550
1675
  content.width = popover.width;
@@ -1553,7 +1678,7 @@ class PopoverDirectivesBase {
1553
1678
  content.body = popover.body;
1554
1679
  content.callout = popover.callout;
1555
1680
  content.animation = popover.animation;
1556
- content.contextData = popover.templateData(_anchor);
1681
+ content.contextData = popover.templateData(this.anchor);
1557
1682
  content.titleTemplate = popover.titleTemplate;
1558
1683
  content.bodyTemplate = popover.bodyTemplate;
1559
1684
  content.actionsTemplate = popover.actionsTemplate;
@@ -1577,6 +1702,12 @@ class PopoverDirectivesBase {
1577
1702
  }
1578
1703
  return eventArgs;
1579
1704
  }
1705
+ onKeyDown(event) {
1706
+ const keyCode = event.keyCode;
1707
+ if (keyCode === Keys.Escape) {
1708
+ this.hide();
1709
+ }
1710
+ }
1580
1711
  initializeCompletionEvents(popoverComp, _anchor) {
1581
1712
  if (this.shouldEmitCompletionEvents('shown', popoverComp)) {
1582
1713
  this.popupRef.popupOpen.subscribe(() => {
@@ -1679,6 +1810,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1679
1810
  type: Injectable
1680
1811
  }], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
1681
1812
 
1813
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1682
1814
  /**
1683
1815
  * Represents the [`kendoPopoverContainer`]({% slug configuration_popover %}#toc-containerdirective) directive.
1684
1816
  * It is used to filter and target multiple elements, which should display a popover on interaction.
@@ -1787,7 +1919,7 @@ class PopoverContainerDirective extends PopoverDirectivesBase {
1787
1919
  this.clickHandler(filterElement, e);
1788
1920
  });
1789
1921
  }
1790
- subscribeToEvents(arr) {
1922
+ subscribeToShowEvents(arr) {
1791
1923
  const filteredElements = Array.from(document.querySelectorAll(this.filter));
1792
1924
  filteredElements.forEach((el) => {
1793
1925
  this.subs.add(this.renderer.listen(el, arr[0].name, () => {
@@ -1844,6 +1976,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
1844
1976
  type: Input
1845
1977
  }] } });
1846
1978
 
1979
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1847
1980
  /**
1848
1981
  * Represents the [`kendoPopoverAnchor`]({% slug configuration_popover %}#toc-anchordirective) directive.
1849
1982
  * It is used to target an element, which should display a popover on interaction.
@@ -1926,12 +2059,13 @@ class PopoverAnchorDirective extends PopoverDirectivesBase {
1926
2059
  this.show();
1927
2060
  }
1928
2061
  }
1929
- subscribeToEvents(arr) {
1930
- this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[0].name, () => {
1931
- this.popoverService.emitAnchorState(true, this.hostEl.nativeElement);
2062
+ subscribeToShowEvents(arr) {
2063
+ const hostEl = this.hostEl.nativeElement;
2064
+ this.subs.add(this.renderer.listen(hostEl, arr[0].name, () => {
2065
+ this.popoverService.emitAnchorState(true, hostEl);
1932
2066
  arr[0].handler();
1933
2067
  }));
1934
- this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[1].name, (e) => {
2068
+ this.subs.add(this.renderer.listen(hostEl, arr[1].name, (e) => {
1935
2069
  this.popoverService.emitAnchorState(false, null);
1936
2070
  arr[1].handler({ domEvent: e });
1937
2071
  }));