@progress/kendo-angular-tooltip 11.1.0-develop.7 → 11.1.0-develop.9
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.
- package/esm2020/package-metadata.mjs +2 -2
- package/esm2020/popover/anchor.directive.mjs +6 -4
- package/esm2020/popover/container.directive.mjs +2 -1
- package/esm2020/popover/directives-base.mjs +36 -15
- package/esm2020/popover/popover.component.mjs +101 -17
- package/esm2020/utils.mjs +33 -2
- package/fesm2015/progress-kendo-angular-tooltip.mjs +175 -41
- package/fesm2020/progress-kendo-angular-tooltip.mjs +175 -41
- package/package.json +6 -6
- package/popover/anchor.directive.d.ts +1 -1
- package/popover/container.directive.d.ts +1 -1
- package/popover/directives-base.d.ts +7 -2
- package/popover/popover.component.d.ts +31 -4
- package/utils.d.ts +9 -1
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-tooltip',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
13
|
-
version: '11.1.0-develop.
|
|
12
|
+
publishDate: 1675155152,
|
|
13
|
+
version: '11.1.0-develop.9',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
15
15
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright © 2023 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
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
6
|
import { Directive, ElementRef, NgZone, Renderer2 } from "@angular/core";
|
|
6
7
|
import { closest } from "@progress/kendo-angular-common";
|
|
7
8
|
import { PopupService } from "@progress/kendo-angular-popup";
|
|
@@ -93,12 +94,13 @@ export class PopoverAnchorDirective extends PopoverDirectivesBase {
|
|
|
93
94
|
this.show();
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
-
this.
|
|
98
|
-
|
|
97
|
+
subscribeToShowEvents(arr) {
|
|
98
|
+
const hostEl = this.hostEl.nativeElement;
|
|
99
|
+
this.subs.add(this.renderer.listen(hostEl, arr[0].name, () => {
|
|
100
|
+
this.popoverService.emitAnchorState(true, hostEl);
|
|
99
101
|
arr[0].handler();
|
|
100
102
|
}));
|
|
101
|
-
this.subs.add(this.renderer.listen(
|
|
103
|
+
this.subs.add(this.renderer.listen(hostEl, arr[1].name, (e) => {
|
|
102
104
|
this.popoverService.emitAnchorState(false, null);
|
|
103
105
|
arr[1].handler({ domEvent: e });
|
|
104
106
|
}));
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright © 2023 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
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
6
|
import { Directive, ElementRef, Input, NgZone, Renderer2 } from "@angular/core";
|
|
6
7
|
import { closest } from "@progress/kendo-angular-common";
|
|
7
8
|
import { PopupService } from "@progress/kendo-angular-popup";
|
|
@@ -120,7 +121,7 @@ export class PopoverContainerDirective extends PopoverDirectivesBase {
|
|
|
120
121
|
this.clickHandler(filterElement, e);
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
|
-
|
|
124
|
+
subscribeToShowEvents(arr) {
|
|
124
125
|
const filteredElements = Array.from(document.querySelectorAll(this.filter));
|
|
125
126
|
filteredElements.forEach((el) => {
|
|
126
127
|
this.subs.add(this.renderer.listen(el, arr[0].name, () => {
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* Copyright © 2023 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
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
7
|
import { Directive, ElementRef, Input, isDevMode, NgZone, Renderer2 } from "@angular/core";
|
|
6
8
|
import { PopupService } from "@progress/kendo-angular-popup";
|
|
7
|
-
import { closest, hasObservers, isDocumentAvailable } from "@progress/kendo-angular-common";
|
|
9
|
+
import { closest, hasObservers, isDocumentAvailable, Keys } from "@progress/kendo-angular-common";
|
|
8
10
|
import { ERRORS } from '../constants';
|
|
9
11
|
import { PopoverHideEvent, PopoverShowEvent, PopoverShownEvent, PopoverHiddenEvent } from "../models/events";
|
|
10
12
|
import { align, containsItem } from "../utils";
|
|
@@ -21,6 +23,10 @@ export class PopoverDirectivesBase {
|
|
|
21
23
|
this.ngZone = ngZone;
|
|
22
24
|
this.popupService = popupService;
|
|
23
25
|
this.renderer = renderer;
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
*/
|
|
29
|
+
this.anchor = null;
|
|
24
30
|
this.subs = new Subscription();
|
|
25
31
|
this._showOn = 'click';
|
|
26
32
|
}
|
|
@@ -70,14 +76,14 @@ export class PopoverDirectivesBase {
|
|
|
70
76
|
this.ngZone.runOutsideAngular(() => {
|
|
71
77
|
switch (this.showOn) {
|
|
72
78
|
case 'hover':
|
|
73
|
-
this.
|
|
79
|
+
this.subscribeToShowEvents([{
|
|
74
80
|
name: 'mouseenter', handler: this.mouseenterHandler
|
|
75
81
|
}, {
|
|
76
82
|
name: 'mouseleave', handler: this.mouseleaveHandler
|
|
77
83
|
}]);
|
|
78
84
|
break;
|
|
79
85
|
case 'focus':
|
|
80
|
-
this.
|
|
86
|
+
this.subscribeToShowEvents([{
|
|
81
87
|
name: 'focus', handler: this.focusHandler
|
|
82
88
|
}, {
|
|
83
89
|
name: 'blur', handler: this.blurHandler
|
|
@@ -93,6 +99,7 @@ export class PopoverDirectivesBase {
|
|
|
93
99
|
}
|
|
94
100
|
ngOnDestroy() {
|
|
95
101
|
this.closePopup();
|
|
102
|
+
this.subs.unsubscribe();
|
|
96
103
|
if (this.disposeHoverOverListener) {
|
|
97
104
|
this.disposeHoverOverListener();
|
|
98
105
|
}
|
|
@@ -108,9 +115,6 @@ export class PopoverDirectivesBase {
|
|
|
108
115
|
if (this._hideSub) {
|
|
109
116
|
this._hideSub.unsubscribe();
|
|
110
117
|
}
|
|
111
|
-
if (this.subs) {
|
|
112
|
-
this.subs.unsubscribe();
|
|
113
|
-
}
|
|
114
118
|
if (this._popupOpenSub) {
|
|
115
119
|
this._popupOpenSub.unsubscribe();
|
|
116
120
|
}
|
|
@@ -129,6 +133,9 @@ export class PopoverDirectivesBase {
|
|
|
129
133
|
*/
|
|
130
134
|
closePopup() {
|
|
131
135
|
if (this.popupRef) {
|
|
136
|
+
if (this.anchor) {
|
|
137
|
+
this.renderer.removeAttribute(this.anchor, 'aria-describedby');
|
|
138
|
+
}
|
|
132
139
|
this.popupRef.close();
|
|
133
140
|
this.popupRef = null;
|
|
134
141
|
if (this.disposePopupHoverOutListener) {
|
|
@@ -146,15 +153,15 @@ export class PopoverDirectivesBase {
|
|
|
146
153
|
* @hidden
|
|
147
154
|
*/
|
|
148
155
|
openPopup(anchor) {
|
|
149
|
-
|
|
150
|
-
const popoverComp = this.popover instanceof PopoverComponent ? this.popover : this.popover(
|
|
156
|
+
this.anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;
|
|
157
|
+
const popoverComp = this.popover instanceof PopoverComponent ? this.popover : this.popover(this.anchor);
|
|
151
158
|
const alignSettings = align(popoverComp.position, popoverComp.offset);
|
|
152
159
|
const anchorAlign = alignSettings.anchorAlign;
|
|
153
160
|
const popupAlign = alignSettings.popupAlign;
|
|
154
161
|
const popupMargin = alignSettings.popupMargin;
|
|
155
162
|
const _animation = popoverComp.animation;
|
|
156
163
|
this.popupRef = this.popupService.open({
|
|
157
|
-
anchor: { nativeElement:
|
|
164
|
+
anchor: { nativeElement: this.anchor },
|
|
158
165
|
animate: _animation,
|
|
159
166
|
content: PopoverComponent,
|
|
160
167
|
popupAlign,
|
|
@@ -163,9 +170,18 @@ export class PopoverDirectivesBase {
|
|
|
163
170
|
popupClass: 'k-popup-transparent',
|
|
164
171
|
collision: { horizontal: 'fit', vertical: 'fit' }
|
|
165
172
|
});
|
|
166
|
-
this.
|
|
173
|
+
const popupInstance = this.popupRef.content.instance;
|
|
174
|
+
if (anchor) {
|
|
175
|
+
this.subs.add(this.renderer.listen(this.anchor, 'keydown', event => this.onKeyDown(event)));
|
|
176
|
+
this.renderer.setAttribute(this.anchor, 'aria-describedby', popupInstance.popoverId);
|
|
177
|
+
}
|
|
178
|
+
this.subs.add(popupInstance.closeOnKeyDown.subscribe(() => {
|
|
179
|
+
this.anchor.focus();
|
|
180
|
+
this.hide();
|
|
181
|
+
}));
|
|
182
|
+
this.applySettings(this.popupRef.content, popoverComp);
|
|
167
183
|
this.monitorPopup();
|
|
168
|
-
this.initializeCompletionEvents(popoverComp,
|
|
184
|
+
this.initializeCompletionEvents(popoverComp, this.anchor);
|
|
169
185
|
}
|
|
170
186
|
/**
|
|
171
187
|
* @hidden
|
|
@@ -204,11 +220,10 @@ export class PopoverDirectivesBase {
|
|
|
204
220
|
});
|
|
205
221
|
}
|
|
206
222
|
}
|
|
207
|
-
applySettings(contentComponent, popover
|
|
223
|
+
applySettings(contentComponent, popover) {
|
|
208
224
|
const content = contentComponent.instance;
|
|
209
|
-
const _anchor = anchor instanceof ElementRef ? anchor.nativeElement : anchor;
|
|
210
225
|
content.visible = true;
|
|
211
|
-
content.anchor =
|
|
226
|
+
content.anchor = this.anchor;
|
|
212
227
|
content.position = popover.position;
|
|
213
228
|
content.offset = popover.offset;
|
|
214
229
|
content.width = popover.width;
|
|
@@ -217,7 +232,7 @@ export class PopoverDirectivesBase {
|
|
|
217
232
|
content.body = popover.body;
|
|
218
233
|
content.callout = popover.callout;
|
|
219
234
|
content.animation = popover.animation;
|
|
220
|
-
content.contextData = popover.templateData(
|
|
235
|
+
content.contextData = popover.templateData(this.anchor);
|
|
221
236
|
content.titleTemplate = popover.titleTemplate;
|
|
222
237
|
content.bodyTemplate = popover.bodyTemplate;
|
|
223
238
|
content.actionsTemplate = popover.actionsTemplate;
|
|
@@ -241,6 +256,12 @@ export class PopoverDirectivesBase {
|
|
|
241
256
|
}
|
|
242
257
|
return eventArgs;
|
|
243
258
|
}
|
|
259
|
+
onKeyDown(event) {
|
|
260
|
+
const keyCode = event.keyCode;
|
|
261
|
+
if (keyCode === Keys.Escape) {
|
|
262
|
+
this.hide();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
244
265
|
initializeCompletionEvents(popoverComp, _anchor) {
|
|
245
266
|
if (this.shouldEmitCompletionEvents('shown', popoverComp)) {
|
|
246
267
|
this.popupRef.popupOpen.subscribe(() => {
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Copyright © 2023 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
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
+
import { Component, ContentChild, ElementRef, EventEmitter, HostBinding, Input, isDevMode, NgZone, Output, Renderer2, ViewChild } from '@angular/core';
|
|
6
7
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
7
8
|
import { Subscription } from 'rxjs';
|
|
8
9
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
@@ -11,6 +12,9 @@ import { ERRORS } from '../constants';
|
|
|
11
12
|
import { PopoverTitleTemplateDirective } from './template-directives/title-template.directive';
|
|
12
13
|
import { PopoverBodyTemplateDirective } from './template-directives/body-template.directive';
|
|
13
14
|
import { PopoverActionsTemplateDirective } from './template-directives/actions-template.directive';
|
|
15
|
+
import { Keys } from '@progress/kendo-angular-common';
|
|
16
|
+
import { take } from 'rxjs/operators';
|
|
17
|
+
import { getAllFocusableChildren, getFirstAndLastFocusable, getId } from '../utils';
|
|
14
18
|
import * as i0 from "@angular/core";
|
|
15
19
|
import * as i1 from "@progress/kendo-angular-l10n";
|
|
16
20
|
import * as i2 from "@angular/common";
|
|
@@ -28,8 +32,11 @@ import * as i2 from "@angular/common";
|
|
|
28
32
|
* ```
|
|
29
33
|
*/
|
|
30
34
|
export class PopoverComponent {
|
|
31
|
-
constructor(localization) {
|
|
35
|
+
constructor(localization, renderer, element, zone) {
|
|
32
36
|
this.localization = localization;
|
|
37
|
+
this.renderer = renderer;
|
|
38
|
+
this.element = element;
|
|
39
|
+
this.zone = zone;
|
|
33
40
|
/**
|
|
34
41
|
* Specifies the position of the Popover in relation to its anchor element. [See example]({% slug positioning_popover %})
|
|
35
42
|
*
|
|
@@ -80,6 +87,10 @@ export class PopoverComponent {
|
|
|
80
87
|
* Fires after the Popover has been hidden and the animation has ended. [See example]({% slug events_popover %})
|
|
81
88
|
*/
|
|
82
89
|
this.hidden = new EventEmitter();
|
|
90
|
+
/**
|
|
91
|
+
* @hidden
|
|
92
|
+
*/
|
|
93
|
+
this.closeOnKeyDown = new EventEmitter();
|
|
83
94
|
/**
|
|
84
95
|
* @hidden
|
|
85
96
|
*/
|
|
@@ -88,11 +99,12 @@ export class PopoverComponent {
|
|
|
88
99
|
* @hidden
|
|
89
100
|
*/
|
|
90
101
|
this._height = 'auto';
|
|
91
|
-
this._offset = 6;
|
|
92
|
-
this.subs = new Subscription();
|
|
93
102
|
/**
|
|
94
103
|
* @hidden
|
|
95
104
|
*/
|
|
105
|
+
this.popoverId = '';
|
|
106
|
+
this._offset = 6;
|
|
107
|
+
this.subs = new Subscription();
|
|
96
108
|
this._templateData = () => null;
|
|
97
109
|
validatePackage(packageMetadata);
|
|
98
110
|
}
|
|
@@ -156,9 +168,21 @@ export class PopoverComponent {
|
|
|
156
168
|
return !this.visible;
|
|
157
169
|
}
|
|
158
170
|
ngOnInit() {
|
|
159
|
-
this.
|
|
160
|
-
|
|
161
|
-
|
|
171
|
+
this.popoverId = getId('k-popover');
|
|
172
|
+
this.subs.add(this.localization.changes.subscribe(({ rtl }) => { this.direction = rtl ? 'rtl' : 'ltr'; }));
|
|
173
|
+
this.subs.add(this.renderer.listen(this.element.nativeElement, 'keydown', event => this.onKeyDown(event)));
|
|
174
|
+
}
|
|
175
|
+
ngAfterViewInit() {
|
|
176
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
177
|
+
if (this.visible) {
|
|
178
|
+
const wrapper = this.popoverWrapper.nativeElement;
|
|
179
|
+
const focusablePopoverChildren = getAllFocusableChildren(wrapper);
|
|
180
|
+
if (focusablePopoverChildren.length > 0) {
|
|
181
|
+
focusablePopoverChildren[0].focus();
|
|
182
|
+
}
|
|
183
|
+
this.setAriaAttributes(wrapper, focusablePopoverChildren);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
162
186
|
}
|
|
163
187
|
ngOnDestroy() {
|
|
164
188
|
this.subs.unsubscribe();
|
|
@@ -175,16 +199,65 @@ export class PopoverComponent {
|
|
|
175
199
|
default: return { 'k-callout-s': true };
|
|
176
200
|
}
|
|
177
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* @hidden
|
|
204
|
+
*/
|
|
205
|
+
onKeyDown(event) {
|
|
206
|
+
const keyCode = event.keyCode;
|
|
207
|
+
const target = event.target;
|
|
208
|
+
if (keyCode === Keys.Tab) {
|
|
209
|
+
this.keepFocusWithinComponent(target, event);
|
|
210
|
+
}
|
|
211
|
+
if (keyCode === Keys.Escape) {
|
|
212
|
+
this.closeOnKeyDown.emit();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
keepFocusWithinComponent(target, event) {
|
|
216
|
+
const wrapper = this.popoverWrapper.nativeElement;
|
|
217
|
+
const [firstFocusable, lastFocusable] = getFirstAndLastFocusable(wrapper);
|
|
218
|
+
const tabAfterLastFocusable = !event.shiftKey && target === lastFocusable;
|
|
219
|
+
const shiftTabAfterFirstFocusable = event.shiftKey && target === firstFocusable;
|
|
220
|
+
if (tabAfterLastFocusable) {
|
|
221
|
+
event.preventDefault();
|
|
222
|
+
firstFocusable.focus();
|
|
223
|
+
}
|
|
224
|
+
if (shiftTabAfterFirstFocusable) {
|
|
225
|
+
event.preventDefault();
|
|
226
|
+
lastFocusable.focus();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
setAriaAttributes(wrapper, focusablePopoverChildren) {
|
|
230
|
+
if (this.titleTemplate) {
|
|
231
|
+
const titleRef = this.titleTemplateWrapper.nativeElement;
|
|
232
|
+
const focusableHeaderChildren = getAllFocusableChildren(titleRef).length > 0;
|
|
233
|
+
if (focusableHeaderChildren) {
|
|
234
|
+
const headerId = getId('k-popover-header', 'popoverTitle');
|
|
235
|
+
this.renderer.setAttribute(titleRef, 'id', headerId);
|
|
236
|
+
this.renderer.setAttribute(wrapper, 'aria-labelledby', headerId);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (this.bodyTemplate) {
|
|
240
|
+
const bodyRef = this.bodyTemplateWrapper.nativeElement;
|
|
241
|
+
const focusableBodyChildren = getAllFocusableChildren(bodyRef).length > 0;
|
|
242
|
+
if (focusableBodyChildren) {
|
|
243
|
+
const bodyId = getId('k-popover-body', 'popoverBody');
|
|
244
|
+
this.renderer.setAttribute(bodyRef, 'id', bodyId);
|
|
245
|
+
this.renderer.setAttribute(wrapper, 'aria-describedby', bodyId);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
this.renderer.setAttribute(wrapper, 'id', this.popoverId);
|
|
249
|
+
this.renderer.setAttribute(wrapper, 'role', focusablePopoverChildren.length > 0 ? 'dialog' : 'tooltip');
|
|
250
|
+
}
|
|
178
251
|
}
|
|
179
|
-
PopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PopoverComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
180
|
-
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: [
|
|
252
|
+
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 });
|
|
253
|
+
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: [
|
|
181
254
|
LocalizationService,
|
|
182
255
|
{
|
|
183
256
|
provide: L10N_PREFIX,
|
|
184
257
|
useValue: 'kendo.popover'
|
|
185
258
|
}
|
|
186
|
-
], 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: `
|
|
187
|
-
<div *ngIf="visible"
|
|
259
|
+
], 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: `
|
|
260
|
+
<div #popoverWrapper *ngIf="visible" class="k-popover" [ngStyle]="{'width': width, 'height': height}">
|
|
188
261
|
<div class="k-popover-callout" [ngClass]="getCalloutPosition()" *ngIf="callout"></div>
|
|
189
262
|
|
|
190
263
|
<div class="k-popover-inner" *ngIf="callout; else noCallout">
|
|
@@ -192,7 +265,7 @@ PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
|
|
|
192
265
|
</div>
|
|
193
266
|
|
|
194
267
|
<ng-template #noCallout>
|
|
195
|
-
<div *ngIf="titleTemplate || title" class="k-popover-header">
|
|
268
|
+
<div #titleTemplateWrapper *ngIf="titleTemplate || title" class="k-popover-header">
|
|
196
269
|
<ng-template *ngIf="titleTemplate"
|
|
197
270
|
[ngTemplateOutlet]="titleTemplate?.templateRef"
|
|
198
271
|
[ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
|
|
@@ -202,7 +275,7 @@ PopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
|
|
|
202
275
|
</ng-container>
|
|
203
276
|
</div>
|
|
204
277
|
|
|
205
|
-
<div *ngIf="bodyTemplate || body" class="k-popover-body">
|
|
278
|
+
<div #bodyTemplateWrapper *ngIf="bodyTemplate || body" class="k-popover-body">
|
|
206
279
|
<ng-template *ngIf="bodyTemplate"
|
|
207
280
|
[ngTemplateOutlet]="bodyTemplate?.templateRef"
|
|
208
281
|
[ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
|
|
@@ -233,7 +306,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
233
306
|
}
|
|
234
307
|
],
|
|
235
308
|
template: `
|
|
236
|
-
<div *ngIf="visible"
|
|
309
|
+
<div #popoverWrapper *ngIf="visible" class="k-popover" [ngStyle]="{'width': width, 'height': height}">
|
|
237
310
|
<div class="k-popover-callout" [ngClass]="getCalloutPosition()" *ngIf="callout"></div>
|
|
238
311
|
|
|
239
312
|
<div class="k-popover-inner" *ngIf="callout; else noCallout">
|
|
@@ -241,7 +314,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
241
314
|
</div>
|
|
242
315
|
|
|
243
316
|
<ng-template #noCallout>
|
|
244
|
-
<div *ngIf="titleTemplate || title" class="k-popover-header">
|
|
317
|
+
<div #titleTemplateWrapper *ngIf="titleTemplate || title" class="k-popover-header">
|
|
245
318
|
<ng-template *ngIf="titleTemplate"
|
|
246
319
|
[ngTemplateOutlet]="titleTemplate?.templateRef"
|
|
247
320
|
[ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
|
|
@@ -251,7 +324,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
251
324
|
</ng-container>
|
|
252
325
|
</div>
|
|
253
326
|
|
|
254
|
-
<div *ngIf="bodyTemplate || body" class="k-popover-body">
|
|
327
|
+
<div #bodyTemplateWrapper *ngIf="bodyTemplate || body" class="k-popover-body">
|
|
255
328
|
<ng-template *ngIf="bodyTemplate"
|
|
256
329
|
[ngTemplateOutlet]="bodyTemplate?.templateRef"
|
|
257
330
|
[ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
|
|
@@ -271,7 +344,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
271
344
|
</div>
|
|
272
345
|
`
|
|
273
346
|
}]
|
|
274
|
-
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; }, propDecorators: { position: [{
|
|
347
|
+
}], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { position: [{
|
|
275
348
|
type: Input
|
|
276
349
|
}], offset: [{
|
|
277
350
|
type: Input
|
|
@@ -308,6 +381,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
|
|
|
308
381
|
type: Output
|
|
309
382
|
}], hidden: [{
|
|
310
383
|
type: Output
|
|
384
|
+
}], closeOnKeyDown: [{
|
|
385
|
+
type: Output
|
|
386
|
+
}], popoverWrapper: [{
|
|
387
|
+
type: ViewChild,
|
|
388
|
+
args: ['popoverWrapper']
|
|
389
|
+
}], titleTemplateWrapper: [{
|
|
390
|
+
type: ViewChild,
|
|
391
|
+
args: ['titleTemplateWrapper']
|
|
392
|
+
}], bodyTemplateWrapper: [{
|
|
393
|
+
type: ViewChild,
|
|
394
|
+
args: ['bodyTemplateWrapper']
|
|
311
395
|
}], titleTemplate: [{
|
|
312
396
|
type: ContentChild,
|
|
313
397
|
args: [PopoverTitleTemplateDirective, { static: false }]
|
package/esm2020/utils.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright © 2023 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
|
+
import { focusableSelector } from '@progress/kendo-angular-common';
|
|
5
6
|
/**
|
|
6
7
|
* @hidden
|
|
7
8
|
*/
|
|
@@ -9,8 +10,23 @@ let idx = 0;
|
|
|
9
10
|
/**
|
|
10
11
|
* @hidden
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
let popoverTitleIdx = 0;
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
let popoverBodyIdx = 0;
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export const getId = (prefix, idSource) => {
|
|
22
|
+
switch (idSource) {
|
|
23
|
+
case 'popoverTitle':
|
|
24
|
+
return `${prefix}-${++popoverTitleIdx}`;
|
|
25
|
+
case 'popoverBody':
|
|
26
|
+
return `${prefix}-${++popoverBodyIdx}`;
|
|
27
|
+
default:
|
|
28
|
+
return `${prefix}-${++idx}`;
|
|
29
|
+
}
|
|
14
30
|
};
|
|
15
31
|
/**
|
|
16
32
|
* @hidden
|
|
@@ -120,3 +136,18 @@ export function getCenterOffset(item, dir, size) {
|
|
|
120
136
|
export function containsItem(collection, item) {
|
|
121
137
|
return collection.indexOf(item) !== -1;
|
|
122
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* @hidden
|
|
141
|
+
*/
|
|
142
|
+
export function getAllFocusableChildren(parent) {
|
|
143
|
+
return parent.querySelectorAll(focusableSelector);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* @hidden
|
|
147
|
+
*/
|
|
148
|
+
export function getFirstAndLastFocusable(parent) {
|
|
149
|
+
const all = getAllFocusableChildren(parent);
|
|
150
|
+
const firstFocusable = all.length > 0 ? all[0] : parent;
|
|
151
|
+
const lastFocusable = all.length > 0 ? all[all.length - 1] : parent;
|
|
152
|
+
return [firstFocusable, lastFocusable];
|
|
153
|
+
}
|