@progress/kendo-angular-tooltip 3.0.3 → 3.1.1-dev.202201191851
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/LICENSE.md +1 -1
- package/NOTICE.txt +119 -79
- package/README.md +1 -1
- package/dist/cdn/js/kendo-angular-tooltip.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/constants.d.ts +12 -0
- package/dist/es/constants.js +12 -0
- package/dist/es/index.d.ts +4 -2
- package/dist/es/index.js +2 -0
- package/dist/es/index.metadata.json +1 -1
- package/dist/es/main.d.ts +16 -2
- package/dist/es/main.js +12 -1
- package/dist/es/models/animation.model.d.ts +9 -0
- package/dist/es/models/animation.model.js +4 -0
- package/dist/es/models/events.d.ts +78 -0
- package/dist/es/models/events.js +78 -0
- package/dist/es/models/functions.model.d.ts +17 -0
- package/dist/es/models/functions.model.js +4 -0
- package/dist/es/models/popover-show-option.type.d.ts +8 -0
- package/dist/es/models/popover-show-option.type.js +4 -0
- package/dist/es/models/position.type.d.ts +1 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/popover/anchor.directive.d.ts +44 -0
- package/dist/es/popover/anchor.directive.js +150 -0
- package/dist/es/popover/container.directive.d.ts +56 -0
- package/dist/es/popover/container.directive.js +176 -0
- package/dist/es/popover/directives-base.d.ts +87 -0
- package/dist/es/popover/directives-base.js +274 -0
- package/dist/es/popover/popover.component.d.ts +166 -0
- package/dist/es/popover/popover.component.js +300 -0
- package/dist/es/popover/popover.service.d.ts +30 -0
- package/dist/es/popover/popover.service.js +88 -0
- package/dist/es/popover/template-directives/actions-template.directive.d.ts +15 -0
- package/dist/es/popover/template-directives/actions-template.directive.js +26 -0
- package/dist/es/popover/template-directives/body-template.directive.d.ts +15 -0
- package/dist/es/popover/template-directives/body-template.directive.js +26 -0
- package/dist/es/popover/template-directives/title-template.directive.d.ts +15 -0
- package/dist/es/popover/template-directives/title-template.directive.js +26 -0
- package/dist/es/popover.module.d.ts +31 -0
- package/dist/es/popover.module.js +65 -0
- package/dist/es/tooltip/tooltip.directive.js +4 -4
- package/dist/es/tooltips.module.d.ts +32 -0
- package/dist/es/tooltips.module.js +45 -0
- package/dist/es/utils.d.ts +1 -1
- package/dist/es/utils.js +1 -1
- package/dist/es2015/constants.d.ts +12 -0
- package/dist/es2015/constants.js +12 -0
- package/dist/es2015/index.d.ts +2 -0
- package/dist/es2015/index.js +2 -0
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/main.d.ts +16 -2
- package/dist/es2015/main.js +12 -1
- package/dist/es2015/models/animation.model.d.ts +9 -0
- package/dist/es2015/models/animation.model.js +4 -0
- package/dist/es2015/models/events.d.ts +78 -0
- package/dist/es2015/models/events.js +65 -0
- package/dist/es2015/models/functions.model.d.ts +17 -0
- package/dist/es2015/models/functions.model.js +4 -0
- package/dist/es2015/models/popover-show-option.type.d.ts +8 -0
- package/dist/es2015/models/popover-show-option.type.js +4 -0
- package/dist/es2015/models/position.type.d.ts +1 -1
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/popover/anchor.directive.d.ts +44 -0
- package/dist/es2015/popover/anchor.directive.js +144 -0
- package/dist/es2015/popover/container.directive.d.ts +56 -0
- package/dist/es2015/popover/container.directive.js +171 -0
- package/dist/es2015/popover/directives-base.d.ts +87 -0
- package/dist/es2015/popover/directives-base.js +259 -0
- package/dist/es2015/popover/popover.component.d.ts +166 -0
- package/dist/es2015/popover/popover.component.js +304 -0
- package/dist/es2015/popover/popover.service.d.ts +30 -0
- package/dist/es2015/popover/popover.service.js +67 -0
- package/dist/es2015/popover/template-directives/actions-template.directive.d.ts +15 -0
- package/dist/es2015/popover/template-directives/actions-template.directive.js +25 -0
- package/dist/es2015/popover/template-directives/body-template.directive.d.ts +15 -0
- package/dist/es2015/popover/template-directives/body-template.directive.js +25 -0
- package/dist/es2015/popover/template-directives/title-template.directive.d.ts +15 -0
- package/dist/es2015/popover/template-directives/title-template.directive.js +25 -0
- package/dist/es2015/popover.module.d.ts +31 -0
- package/dist/es2015/popover.module.js +63 -0
- package/dist/es2015/tooltip/tooltip.directive.js +4 -4
- package/dist/es2015/tooltips.module.d.ts +32 -0
- package/dist/es2015/tooltips.module.js +42 -0
- package/dist/es2015/utils.d.ts +1 -1
- package/dist/es2015/utils.js +1 -1
- package/dist/fesm2015/index.js +1110 -9
- package/dist/fesm5/index.js +1168 -9
- package/dist/npm/constants.js +14 -0
- package/dist/npm/index.js +4 -0
- package/dist/npm/main.js +25 -2
- package/dist/npm/models/animation.model.js +6 -0
- package/dist/npm/models/events.js +80 -0
- package/dist/npm/models/functions.model.js +6 -0
- package/dist/npm/models/popover-show-option.type.js +6 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/popover/anchor.directive.js +152 -0
- package/dist/npm/popover/container.directive.js +178 -0
- package/dist/npm/popover/directives-base.js +276 -0
- package/dist/npm/popover/popover.component.js +302 -0
- package/dist/npm/popover/popover.service.js +90 -0
- package/dist/npm/popover/template-directives/actions-template.directive.js +28 -0
- package/dist/npm/popover/template-directives/body-template.directive.js +28 -0
- package/dist/npm/popover/template-directives/title-template.directive.js +28 -0
- package/dist/npm/popover.module.js +67 -0
- package/dist/npm/tooltip/tooltip.directive.js +3 -3
- package/dist/npm/tooltips.module.js +47 -0
- package/dist/npm/utils.js +2 -2
- package/dist/systemjs/kendo-angular-tooltip.js +1 -1
- package/package.json +21 -17
- package/schematics/ngAdd/index.js +1 -2
- package/schematics/ngAdd/index.js.map +1 -1
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { Component, ContentChild, EventEmitter, HostBinding, Input, isDevMode, Output } from '@angular/core';
|
|
7
|
+
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
8
|
+
import { Subscription } from 'rxjs';
|
|
9
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
|
+
import { packageMetadata } from '../package-metadata';
|
|
11
|
+
import { ERRORS } from '../constants';
|
|
12
|
+
import { PopoverTitleTemplateDirective } from './template-directives/title-template.directive';
|
|
13
|
+
import { PopoverBodyTemplateDirective } from './template-directives/body-template.directive';
|
|
14
|
+
import { PopoverActionsTemplateDirective } from './template-directives/actions-template.directive';
|
|
15
|
+
/**
|
|
16
|
+
* Represents the [Kendo UI Popover component for Angular]({% slug overview_popover %}).
|
|
17
|
+
* Used to display additional information that is related to a target element.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts-no-run
|
|
21
|
+
* <kendo-popover>
|
|
22
|
+
* <ng-template kendoPopoverTitleTemplate>Foo Title</ng-template>
|
|
23
|
+
* <ng-template kendoPopoverBodyTemplate>Foo Body</ng-template>
|
|
24
|
+
* <ng-template kendoPopoverActionsTemplate>Foo Actions</ng-template>
|
|
25
|
+
* </kendo-popover>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
let PopoverComponent = class PopoverComponent {
|
|
29
|
+
constructor(localization) {
|
|
30
|
+
this.localization = localization;
|
|
31
|
+
/**
|
|
32
|
+
* Specifies the position of the Popover in relation to its anchor element. [See example]({% slug positioning_popover %})
|
|
33
|
+
*
|
|
34
|
+
* The possible options are:
|
|
35
|
+
* `top`
|
|
36
|
+
* `bottom`
|
|
37
|
+
* `right` (Default)
|
|
38
|
+
* `left`
|
|
39
|
+
*/
|
|
40
|
+
this.position = 'right';
|
|
41
|
+
/**
|
|
42
|
+
* Determines whether a callout will be rendered along the Popover. [See example]({% slug callout_popover %})
|
|
43
|
+
*
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
this.callout = true;
|
|
47
|
+
/**
|
|
48
|
+
* Enables and configures the Popover animation. [See example]({% slug animations_popover %})
|
|
49
|
+
*
|
|
50
|
+
* The possible options are:
|
|
51
|
+
*
|
|
52
|
+
* * `boolean`—Enables the default animation
|
|
53
|
+
* * `PopoverAnimation`—A configuration object which allows setting the `direction`, `duration` and `type` of the animation.
|
|
54
|
+
*
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
this.animation = false;
|
|
58
|
+
/**
|
|
59
|
+
* @hidden
|
|
60
|
+
* Determines the visibility of the Popover.
|
|
61
|
+
*/
|
|
62
|
+
this.visible = false;
|
|
63
|
+
/**
|
|
64
|
+
* Fires before the Popover is about to be shown ([see example]({% slug events_popover %})).
|
|
65
|
+
* The event is preventable. If canceled, the Popover will not be displayed. [See example]({% slug events_popover %})
|
|
66
|
+
*/
|
|
67
|
+
this.show = new EventEmitter();
|
|
68
|
+
/**
|
|
69
|
+
* Fires after the Popover has been shown and the animation has ended. [See example]({% slug events_popover %})
|
|
70
|
+
*/
|
|
71
|
+
this.shown = new EventEmitter();
|
|
72
|
+
/**
|
|
73
|
+
* Fires when the Popover is about to be hidden ([see example]({% slug events_popover %})).
|
|
74
|
+
* The event is preventable. If canceled, the Popover will remain visible.
|
|
75
|
+
*/
|
|
76
|
+
this.hide = new EventEmitter();
|
|
77
|
+
/**
|
|
78
|
+
* Fires after the Popover has been hidden and the animation has ended. [See example]({% slug events_popover %})
|
|
79
|
+
*/
|
|
80
|
+
this.hidden = new EventEmitter();
|
|
81
|
+
this._offset = 6;
|
|
82
|
+
this._width = 'auto';
|
|
83
|
+
this._height = 'auto';
|
|
84
|
+
this.subs = new Subscription();
|
|
85
|
+
/**
|
|
86
|
+
* @hidden
|
|
87
|
+
*/
|
|
88
|
+
this._templateData = () => null;
|
|
89
|
+
validatePackage(packageMetadata);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Specifies the distance from the Popover to its anchor element in pixels.
|
|
93
|
+
*
|
|
94
|
+
* @default `6`
|
|
95
|
+
*/
|
|
96
|
+
set offset(value) {
|
|
97
|
+
this._offset = value;
|
|
98
|
+
}
|
|
99
|
+
get offset() {
|
|
100
|
+
const calloutBuffer = 14;
|
|
101
|
+
return this.callout
|
|
102
|
+
? calloutBuffer + this._offset
|
|
103
|
+
: this._offset;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Determines the width of the popover. Numeric values are treated as pixels.
|
|
107
|
+
* @default 'auto'
|
|
108
|
+
*/
|
|
109
|
+
set width(value) {
|
|
110
|
+
this._width = typeof value === 'number' ? `${value}px` : value;
|
|
111
|
+
}
|
|
112
|
+
get width() {
|
|
113
|
+
return this._width;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Determines the height of the popover. Numeric values are treated as pixels.
|
|
117
|
+
* @default 'auto'
|
|
118
|
+
*/
|
|
119
|
+
set height(value) {
|
|
120
|
+
this._height = typeof value === 'number' ? `${value}px` : value;
|
|
121
|
+
}
|
|
122
|
+
get height() {
|
|
123
|
+
return this._height;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Defines a callback function which returns custom data passed to the Popover templates.
|
|
127
|
+
* It exposes the current anchor element as an argument. [See example]({% slug templates_popover %}#toc-popoverdatacallback)
|
|
128
|
+
*/
|
|
129
|
+
set templateData(fn) {
|
|
130
|
+
if (isDevMode && typeof fn !== 'function') {
|
|
131
|
+
throw new Error(`${ERRORS.templateData} ${JSON.stringify(fn)}.`);
|
|
132
|
+
}
|
|
133
|
+
this._templateData = fn;
|
|
134
|
+
}
|
|
135
|
+
get templateData() {
|
|
136
|
+
return this._templateData;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @hidden
|
|
140
|
+
*/
|
|
141
|
+
get isHidden() {
|
|
142
|
+
return !this.visible;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @hidden
|
|
146
|
+
*/
|
|
147
|
+
get hasAttributeHidden() {
|
|
148
|
+
return !this.visible;
|
|
149
|
+
}
|
|
150
|
+
ngOnInit() {
|
|
151
|
+
this.subs.add(this.localization.changes.subscribe(({ rtl }) => {
|
|
152
|
+
this.direction = rtl ? 'rtl' : 'ltr';
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
ngOnDestroy() {
|
|
156
|
+
this.subs.unsubscribe();
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* @hidden
|
|
160
|
+
*/
|
|
161
|
+
getCalloutPosition() {
|
|
162
|
+
switch (this.position) {
|
|
163
|
+
case 'top': return { 'k-callout-s': true };
|
|
164
|
+
case 'bottom': return { 'k-callout-n': true };
|
|
165
|
+
case 'left': return { 'k-callout-e': true };
|
|
166
|
+
case 'right': return { 'k-callout-w': true };
|
|
167
|
+
default: return { 'k-callout-s': true };
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
tslib_1.__decorate([
|
|
172
|
+
Input(),
|
|
173
|
+
tslib_1.__metadata("design:type", String)
|
|
174
|
+
], PopoverComponent.prototype, "position", void 0);
|
|
175
|
+
tslib_1.__decorate([
|
|
176
|
+
Input(),
|
|
177
|
+
tslib_1.__metadata("design:type", Number),
|
|
178
|
+
tslib_1.__metadata("design:paramtypes", [Number])
|
|
179
|
+
], PopoverComponent.prototype, "offset", null);
|
|
180
|
+
tslib_1.__decorate([
|
|
181
|
+
HostBinding('style.width'),
|
|
182
|
+
Input(),
|
|
183
|
+
tslib_1.__metadata("design:type", Object),
|
|
184
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
185
|
+
], PopoverComponent.prototype, "width", null);
|
|
186
|
+
tslib_1.__decorate([
|
|
187
|
+
HostBinding('style.height'),
|
|
188
|
+
Input(),
|
|
189
|
+
tslib_1.__metadata("design:type", Object),
|
|
190
|
+
tslib_1.__metadata("design:paramtypes", [Object])
|
|
191
|
+
], PopoverComponent.prototype, "height", null);
|
|
192
|
+
tslib_1.__decorate([
|
|
193
|
+
HostBinding('attr.dir'),
|
|
194
|
+
tslib_1.__metadata("design:type", String)
|
|
195
|
+
], PopoverComponent.prototype, "direction", void 0);
|
|
196
|
+
tslib_1.__decorate([
|
|
197
|
+
Input(),
|
|
198
|
+
tslib_1.__metadata("design:type", String)
|
|
199
|
+
], PopoverComponent.prototype, "title", void 0);
|
|
200
|
+
tslib_1.__decorate([
|
|
201
|
+
Input(),
|
|
202
|
+
tslib_1.__metadata("design:type", String)
|
|
203
|
+
], PopoverComponent.prototype, "subtitle", void 0);
|
|
204
|
+
tslib_1.__decorate([
|
|
205
|
+
Input(),
|
|
206
|
+
tslib_1.__metadata("design:type", String)
|
|
207
|
+
], PopoverComponent.prototype, "body", void 0);
|
|
208
|
+
tslib_1.__decorate([
|
|
209
|
+
Input(),
|
|
210
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
211
|
+
], PopoverComponent.prototype, "callout", void 0);
|
|
212
|
+
tslib_1.__decorate([
|
|
213
|
+
Input(),
|
|
214
|
+
tslib_1.__metadata("design:type", Object)
|
|
215
|
+
], PopoverComponent.prototype, "animation", void 0);
|
|
216
|
+
tslib_1.__decorate([
|
|
217
|
+
Input(),
|
|
218
|
+
tslib_1.__metadata("design:type", Function),
|
|
219
|
+
tslib_1.__metadata("design:paramtypes", [Function])
|
|
220
|
+
], PopoverComponent.prototype, "templateData", null);
|
|
221
|
+
tslib_1.__decorate([
|
|
222
|
+
HostBinding('class.k-hidden'),
|
|
223
|
+
tslib_1.__metadata("design:type", Boolean),
|
|
224
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
225
|
+
], PopoverComponent.prototype, "isHidden", null);
|
|
226
|
+
tslib_1.__decorate([
|
|
227
|
+
HostBinding('attr.aria-hidden'),
|
|
228
|
+
tslib_1.__metadata("design:type", Boolean),
|
|
229
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
230
|
+
], PopoverComponent.prototype, "hasAttributeHidden", null);
|
|
231
|
+
tslib_1.__decorate([
|
|
232
|
+
Output(),
|
|
233
|
+
tslib_1.__metadata("design:type", EventEmitter)
|
|
234
|
+
], PopoverComponent.prototype, "show", void 0);
|
|
235
|
+
tslib_1.__decorate([
|
|
236
|
+
Output(),
|
|
237
|
+
tslib_1.__metadata("design:type", EventEmitter)
|
|
238
|
+
], PopoverComponent.prototype, "shown", void 0);
|
|
239
|
+
tslib_1.__decorate([
|
|
240
|
+
Output(),
|
|
241
|
+
tslib_1.__metadata("design:type", EventEmitter)
|
|
242
|
+
], PopoverComponent.prototype, "hide", void 0);
|
|
243
|
+
tslib_1.__decorate([
|
|
244
|
+
Output(),
|
|
245
|
+
tslib_1.__metadata("design:type", EventEmitter)
|
|
246
|
+
], PopoverComponent.prototype, "hidden", void 0);
|
|
247
|
+
tslib_1.__decorate([
|
|
248
|
+
ContentChild(PopoverTitleTemplateDirective, { static: false }),
|
|
249
|
+
tslib_1.__metadata("design:type", PopoverTitleTemplateDirective)
|
|
250
|
+
], PopoverComponent.prototype, "titleTemplate", void 0);
|
|
251
|
+
tslib_1.__decorate([
|
|
252
|
+
ContentChild(PopoverBodyTemplateDirective, { static: false }),
|
|
253
|
+
tslib_1.__metadata("design:type", PopoverBodyTemplateDirective)
|
|
254
|
+
], PopoverComponent.prototype, "bodyTemplate", void 0);
|
|
255
|
+
tslib_1.__decorate([
|
|
256
|
+
ContentChild(PopoverActionsTemplateDirective, { static: false }),
|
|
257
|
+
tslib_1.__metadata("design:type", PopoverActionsTemplateDirective)
|
|
258
|
+
], PopoverComponent.prototype, "actionsTemplate", void 0);
|
|
259
|
+
PopoverComponent = tslib_1.__decorate([
|
|
260
|
+
Component({
|
|
261
|
+
selector: 'kendo-popover',
|
|
262
|
+
providers: [
|
|
263
|
+
LocalizationService,
|
|
264
|
+
{
|
|
265
|
+
provide: L10N_PREFIX,
|
|
266
|
+
useValue: 'kendo.popover'
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
template: `
|
|
270
|
+
<div *ngIf="visible" role="tooltip" class="k-popover" [ngStyle]="{'width.px': width, 'height.px': height}">
|
|
271
|
+
<div class="k-popover-callout" [ngClass]="getCalloutPosition()" *ngIf="callout"></div>
|
|
272
|
+
|
|
273
|
+
<div *ngIf="titleTemplate || title" class="k-popover-header">
|
|
274
|
+
<ng-template *ngIf="titleTemplate"
|
|
275
|
+
[ngTemplateOutlet]="titleTemplate?.templateRef"
|
|
276
|
+
[ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
|
|
277
|
+
</ng-template>
|
|
278
|
+
<ng-container *ngIf="title && !titleTemplate">
|
|
279
|
+
{{ title }}
|
|
280
|
+
</ng-container>
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
<div *ngIf="bodyTemplate || body" class="k-popover-body">
|
|
284
|
+
<ng-template *ngIf="bodyTemplate"
|
|
285
|
+
[ngTemplateOutlet]="bodyTemplate?.templateRef"
|
|
286
|
+
[ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
|
|
287
|
+
</ng-template>
|
|
288
|
+
<ng-container *ngIf="body && !bodyTemplate">
|
|
289
|
+
{{ body }}
|
|
290
|
+
</ng-container>
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
<div *ngIf="actionsTemplate" class="k-popover-actions k-actions k-hstack k-justify-content-between">
|
|
294
|
+
<ng-template *ngIf="actionsTemplate"
|
|
295
|
+
[ngTemplateOutlet]="actionsTemplate?.templateRef"
|
|
296
|
+
[ngTemplateOutletContext]="{ $implicit: anchor, data: contextData }">
|
|
297
|
+
</ng-template>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
`
|
|
301
|
+
}),
|
|
302
|
+
tslib_1.__metadata("design:paramtypes", [LocalizationService])
|
|
303
|
+
], PopoverComponent);
|
|
304
|
+
export { PopoverComponent };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { NgZone, OnDestroy } from '@angular/core';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export declare class PopoverService implements OnDestroy {
|
|
11
|
+
private ngZone;
|
|
12
|
+
private _pointerOverPopup;
|
|
13
|
+
private _pointerOverAnchor;
|
|
14
|
+
private _focusInsidePopover;
|
|
15
|
+
private _hidePopover;
|
|
16
|
+
private _isOrigin;
|
|
17
|
+
private originAnchor;
|
|
18
|
+
private currentAnchor;
|
|
19
|
+
private subs;
|
|
20
|
+
constructor(ngZone: NgZone);
|
|
21
|
+
ngOnDestroy(): void;
|
|
22
|
+
readonly isPopoverHovered: Observable<any>;
|
|
23
|
+
emitPopoverState(isHovered: boolean): void;
|
|
24
|
+
readonly isAnchorHovered: Observable<any>;
|
|
25
|
+
emitAnchorState(isHovered: boolean, anchor: any): void;
|
|
26
|
+
readonly isFocusInsidePopover: Observable<any>;
|
|
27
|
+
emitFocusInsidePopover(isFocused: boolean): void;
|
|
28
|
+
readonly hidePopover: Observable<any>;
|
|
29
|
+
monitor(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { Injectable, NgZone } from '@angular/core';
|
|
7
|
+
import { BehaviorSubject, combineLatest, Subject, Subscription } from 'rxjs';
|
|
8
|
+
import { auditTime } from 'rxjs/operators';
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
let PopoverService = class PopoverService {
|
|
13
|
+
constructor(ngZone) {
|
|
14
|
+
this.ngZone = ngZone;
|
|
15
|
+
this._pointerOverPopup = new BehaviorSubject(null);
|
|
16
|
+
this._pointerOverAnchor = new BehaviorSubject(null);
|
|
17
|
+
this._focusInsidePopover = new BehaviorSubject(null);
|
|
18
|
+
this._hidePopover = new Subject();
|
|
19
|
+
this.subs = new Subscription();
|
|
20
|
+
this.monitor();
|
|
21
|
+
}
|
|
22
|
+
ngOnDestroy() {
|
|
23
|
+
this.subs.unsubscribe();
|
|
24
|
+
}
|
|
25
|
+
get isPopoverHovered() {
|
|
26
|
+
return this._pointerOverPopup.asObservable();
|
|
27
|
+
}
|
|
28
|
+
emitPopoverState(isHovered) {
|
|
29
|
+
this.ngZone.run(_ => this._pointerOverPopup.next(isHovered));
|
|
30
|
+
}
|
|
31
|
+
get isAnchorHovered() {
|
|
32
|
+
return this._pointerOverAnchor.asObservable();
|
|
33
|
+
}
|
|
34
|
+
emitAnchorState(isHovered, anchor) {
|
|
35
|
+
this._isOrigin = this.originAnchor === anchor;
|
|
36
|
+
this.currentAnchor = anchor;
|
|
37
|
+
if (isHovered) {
|
|
38
|
+
this.originAnchor = anchor;
|
|
39
|
+
}
|
|
40
|
+
this.ngZone.run(_ => this._pointerOverAnchor.next(isHovered));
|
|
41
|
+
}
|
|
42
|
+
get isFocusInsidePopover() {
|
|
43
|
+
return this._focusInsidePopover.asObservable();
|
|
44
|
+
}
|
|
45
|
+
emitFocusInsidePopover(isFocused) {
|
|
46
|
+
this.ngZone.run(_ => this._focusInsidePopover.next(isFocused));
|
|
47
|
+
this._focusInsidePopover.next(null);
|
|
48
|
+
}
|
|
49
|
+
get hidePopover() {
|
|
50
|
+
return this._hidePopover.asObservable();
|
|
51
|
+
}
|
|
52
|
+
monitor() {
|
|
53
|
+
this.subs.add(combineLatest(this.isPopoverHovered, this.isAnchorHovered).pipe(
|
|
54
|
+
// `auditTime` is used because the `mouseleave` event is emitted before `mouseenter`
|
|
55
|
+
// 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)
|
|
56
|
+
// resulting in both observables emitting `false`
|
|
57
|
+
auditTime(20)).subscribe(val => {
|
|
58
|
+
const [isPopoverHovered, isAnchorHovered] = val;
|
|
59
|
+
this._hidePopover.next([isPopoverHovered, isAnchorHovered, this._isOrigin, this.currentAnchor]);
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
PopoverService = tslib_1.__decorate([
|
|
64
|
+
Injectable(),
|
|
65
|
+
tslib_1.__metadata("design:paramtypes", [NgZone])
|
|
66
|
+
], PopoverService);
|
|
67
|
+
export { PopoverService };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { TemplateRef } from '@angular/core';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a template that defines the content of the Popover actions.
|
|
8
|
+
*
|
|
9
|
+
* To define the template, nest an `<ng-template>` tag
|
|
10
|
+
* with the `kendoPopoverActionsTemplate` directive inside the `<kendo-popover>` tag.
|
|
11
|
+
*/
|
|
12
|
+
export declare class PopoverActionsTemplateDirective {
|
|
13
|
+
templateRef: TemplateRef<any>;
|
|
14
|
+
constructor(templateRef: TemplateRef<any>);
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { Directive, Optional, TemplateRef } from '@angular/core';
|
|
7
|
+
/**
|
|
8
|
+
* Represents a template that defines the content of the Popover actions.
|
|
9
|
+
*
|
|
10
|
+
* To define the template, nest an `<ng-template>` tag
|
|
11
|
+
* with the `kendoPopoverActionsTemplate` directive inside the `<kendo-popover>` tag.
|
|
12
|
+
*/
|
|
13
|
+
let PopoverActionsTemplateDirective = class PopoverActionsTemplateDirective {
|
|
14
|
+
constructor(templateRef) {
|
|
15
|
+
this.templateRef = templateRef;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
PopoverActionsTemplateDirective = tslib_1.__decorate([
|
|
19
|
+
Directive({
|
|
20
|
+
selector: '[kendoPopoverActionsTemplate]'
|
|
21
|
+
}),
|
|
22
|
+
tslib_1.__param(0, Optional()),
|
|
23
|
+
tslib_1.__metadata("design:paramtypes", [TemplateRef])
|
|
24
|
+
], PopoverActionsTemplateDirective);
|
|
25
|
+
export { PopoverActionsTemplateDirective };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { TemplateRef } from '@angular/core';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a template that defines the content of the Popover body.
|
|
8
|
+
*
|
|
9
|
+
* To define the template, nest an `<ng-template>` tag
|
|
10
|
+
* with the `kendoPopoverBodyTemplate` directive inside the `<kendo-popover>` tag.
|
|
11
|
+
*/
|
|
12
|
+
export declare class PopoverBodyTemplateDirective {
|
|
13
|
+
templateRef: TemplateRef<any>;
|
|
14
|
+
constructor(templateRef: TemplateRef<any>);
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { Directive, Optional, TemplateRef } from '@angular/core';
|
|
7
|
+
/**
|
|
8
|
+
* Represents a template that defines the content of the Popover body.
|
|
9
|
+
*
|
|
10
|
+
* To define the template, nest an `<ng-template>` tag
|
|
11
|
+
* with the `kendoPopoverBodyTemplate` directive inside the `<kendo-popover>` tag.
|
|
12
|
+
*/
|
|
13
|
+
let PopoverBodyTemplateDirective = class PopoverBodyTemplateDirective {
|
|
14
|
+
constructor(templateRef) {
|
|
15
|
+
this.templateRef = templateRef;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
PopoverBodyTemplateDirective = tslib_1.__decorate([
|
|
19
|
+
Directive({
|
|
20
|
+
selector: '[kendoPopoverBodyTemplate]'
|
|
21
|
+
}),
|
|
22
|
+
tslib_1.__param(0, Optional()),
|
|
23
|
+
tslib_1.__metadata("design:paramtypes", [TemplateRef])
|
|
24
|
+
], PopoverBodyTemplateDirective);
|
|
25
|
+
export { PopoverBodyTemplateDirective };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { TemplateRef } from '@angular/core';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a template that defines the content of the Popover title.
|
|
8
|
+
*
|
|
9
|
+
* To define the template, nest an `<ng-template>` tag
|
|
10
|
+
* with the `kendoPopoverTitleTemplate` directive inside the `<kendo-popover>` tag.
|
|
11
|
+
*/
|
|
12
|
+
export declare class PopoverTitleTemplateDirective {
|
|
13
|
+
templateRef: TemplateRef<any>;
|
|
14
|
+
constructor(templateRef: TemplateRef<any>);
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { Directive, Optional, TemplateRef } from '@angular/core';
|
|
7
|
+
/**
|
|
8
|
+
* Represents a template that defines the content of the Popover title.
|
|
9
|
+
*
|
|
10
|
+
* To define the template, nest an `<ng-template>` tag
|
|
11
|
+
* with the `kendoPopoverTitleTemplate` directive inside the `<kendo-popover>` tag.
|
|
12
|
+
*/
|
|
13
|
+
let PopoverTitleTemplateDirective = class PopoverTitleTemplateDirective {
|
|
14
|
+
constructor(templateRef) {
|
|
15
|
+
this.templateRef = templateRef;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
PopoverTitleTemplateDirective = tslib_1.__decorate([
|
|
19
|
+
Directive({
|
|
20
|
+
selector: '[kendoPopoverTitleTemplate]'
|
|
21
|
+
}),
|
|
22
|
+
tslib_1.__param(0, Optional()),
|
|
23
|
+
tslib_1.__metadata("design:paramtypes", [TemplateRef])
|
|
24
|
+
], PopoverTitleTemplateDirective);
|
|
25
|
+
export { PopoverTitleTemplateDirective };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
|
|
7
|
+
* definition for the Popover component.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```ts-no-run
|
|
12
|
+
* import { PopoverModule } from '@progress/kendo-angular-tooltip';
|
|
13
|
+
*
|
|
14
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
15
|
+
* import { NgModule } from '@angular/core';
|
|
16
|
+
*
|
|
17
|
+
* import { AppComponent } from './app.component';
|
|
18
|
+
*
|
|
19
|
+
* _@NgModule({
|
|
20
|
+
* declarations: [AppComponent],
|
|
21
|
+
* imports: [BrowserModule, PopoverModule],
|
|
22
|
+
* bootstrap: [AppComponent]
|
|
23
|
+
* })
|
|
24
|
+
* export class AppModule {}
|
|
25
|
+
*
|
|
26
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
27
|
+
*
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class PopoverModule {
|
|
31
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as tslib_1 from "tslib";
|
|
6
|
+
import { CommonModule } from "@angular/common";
|
|
7
|
+
import { NgModule } from "@angular/core";
|
|
8
|
+
import { PopupModule } from "@progress/kendo-angular-popup";
|
|
9
|
+
import { PopoverAnchorDirective } from "./popover/anchor.directive";
|
|
10
|
+
import { PopoverContainerDirective } from "./popover/container.directive";
|
|
11
|
+
import { PopoverComponent } from "./popover/popover.component";
|
|
12
|
+
import { PopoverTitleTemplateDirective } from './popover/template-directives/title-template.directive';
|
|
13
|
+
import { PopoverBodyTemplateDirective } from './popover/template-directives/body-template.directive';
|
|
14
|
+
import { PopoverActionsTemplateDirective } from './popover/template-directives/actions-template.directive';
|
|
15
|
+
const DIRECTIVES = [
|
|
16
|
+
PopoverActionsTemplateDirective,
|
|
17
|
+
PopoverBodyTemplateDirective,
|
|
18
|
+
PopoverTitleTemplateDirective,
|
|
19
|
+
PopoverAnchorDirective,
|
|
20
|
+
PopoverContainerDirective
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
|
|
24
|
+
* definition for the Popover component.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
*
|
|
28
|
+
* ```ts-no-run
|
|
29
|
+
* import { PopoverModule } from '@progress/kendo-angular-tooltip';
|
|
30
|
+
*
|
|
31
|
+
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
32
|
+
* import { NgModule } from '@angular/core';
|
|
33
|
+
*
|
|
34
|
+
* import { AppComponent } from './app.component';
|
|
35
|
+
*
|
|
36
|
+
* _@NgModule({
|
|
37
|
+
* declarations: [AppComponent],
|
|
38
|
+
* imports: [BrowserModule, PopoverModule],
|
|
39
|
+
* bootstrap: [AppComponent]
|
|
40
|
+
* })
|
|
41
|
+
* export class AppModule {}
|
|
42
|
+
*
|
|
43
|
+
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
44
|
+
*
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
let PopoverModule = class PopoverModule {
|
|
48
|
+
};
|
|
49
|
+
PopoverModule = tslib_1.__decorate([
|
|
50
|
+
NgModule({
|
|
51
|
+
declarations: [
|
|
52
|
+
...DIRECTIVES,
|
|
53
|
+
PopoverComponent
|
|
54
|
+
],
|
|
55
|
+
entryComponents: [PopoverComponent],
|
|
56
|
+
exports: [...DIRECTIVES, PopoverComponent],
|
|
57
|
+
imports: [
|
|
58
|
+
CommonModule,
|
|
59
|
+
PopupModule
|
|
60
|
+
]
|
|
61
|
+
})
|
|
62
|
+
], PopoverModule);
|
|
63
|
+
export { PopoverModule };
|
|
@@ -11,7 +11,7 @@ import { validatePackage } from '@progress/kendo-licensing';
|
|
|
11
11
|
import { packageMetadata } from '../package-metadata';
|
|
12
12
|
import { TooltipSettings, TOOLTIP_SETTINGS } from './tooltip.settings';
|
|
13
13
|
import { TooltipContentComponent } from '../tooltip/tooltip.content.component';
|
|
14
|
-
import { align,
|
|
14
|
+
import { align, closestBySelector, contains, containsItem, collision, hasParent } from '../utils';
|
|
15
15
|
/**
|
|
16
16
|
* Represents the [Kendo UI Tooltip directive for Angular]({% slug overview_tooltip %}).
|
|
17
17
|
* Used to display additional information that is related to an element.
|
|
@@ -84,7 +84,7 @@ let TooltipDirective = class TooltipDirective {
|
|
|
84
84
|
this.anchorTitleSubscription = fromEvent(wrapper, 'mouseover')
|
|
85
85
|
.pipe(filter(() => this.filter !== ''))
|
|
86
86
|
.subscribe((e) => {
|
|
87
|
-
const filterElement =
|
|
87
|
+
const filterElement = closestBySelector(e.target, this.filter);
|
|
88
88
|
if (filterElement) {
|
|
89
89
|
this.hideElementTitle({ nativeElement: filterElement });
|
|
90
90
|
}
|
|
@@ -311,7 +311,7 @@ let TooltipDirective = class TooltipDirective {
|
|
|
311
311
|
}
|
|
312
312
|
onMouseClick(e, wrapper) {
|
|
313
313
|
const target = e.target;
|
|
314
|
-
const filterElement =
|
|
314
|
+
const filterElement = closestBySelector(target, this.filter);
|
|
315
315
|
const popup = this.popupRef && this.popupRef.popupElement;
|
|
316
316
|
if (popup) {
|
|
317
317
|
if (popup.contains(target)) {
|
|
@@ -329,7 +329,7 @@ let TooltipDirective = class TooltipDirective {
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
onMouseOver(e) {
|
|
332
|
-
const filterElement =
|
|
332
|
+
const filterElement = closestBySelector(e.target, this.filter);
|
|
333
333
|
if (this.showOn !== 'hover') {
|
|
334
334
|
return;
|
|
335
335
|
}
|