@progress/kendo-angular-tooltip 3.1.7-dev.202203280924 → 4.0.0-dev.202204131841
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/bundles/kendo-angular-tooltip.umd.js +5 -0
- package/{dist/es/constants.d.ts → constants.d.ts} +0 -0
- package/{dist/es2015 → esm2015}/constants.js +0 -0
- package/{dist/es/models/functions.model.js → esm2015/kendo-angular-tooltip.js} +4 -0
- package/esm2015/localization/localized-messages.directive.js +38 -0
- package/{dist/es → esm2015}/main.js +2 -0
- package/{dist/es2015 → esm2015}/models/animation.model.js +1 -0
- package/{dist/es2015 → esm2015}/models/events.js +0 -0
- package/{dist/es2015 → esm2015}/models/functions.model.js +1 -0
- package/{dist/es → esm2015}/models/popover-show-option.type.js +1 -0
- package/{dist/es2015 → esm2015}/models/position.type.js +1 -0
- package/{dist/es → esm2015}/models/show.option.type.js +1 -0
- package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
- package/{dist/es2015 → esm2015}/popover/anchor.directive.js +22 -19
- package/{dist/es2015 → esm2015}/popover/container.directive.js +24 -23
- package/{dist/es2015 → esm2015}/popover/directives-base.js +13 -12
- package/{dist/es2015 → esm2015}/popover/popover.component.js +110 -112
- package/{dist/es2015 → esm2015}/popover/popover.service.js +9 -9
- package/esm2015/popover/template-directives/actions-template.directive.js +27 -0
- package/esm2015/popover/template-directives/body-template.directive.js +27 -0
- package/esm2015/popover/template-directives/title-template.directive.js +27 -0
- package/{dist/es2015 → esm2015}/popover.module.js +31 -16
- package/{dist/es2015 → esm2015}/tooltip/tooltip.content.component.js +95 -73
- package/{dist/es2015 → esm2015}/tooltip/tooltip.directive.js +57 -80
- package/{dist/es2015 → esm2015}/tooltip/tooltip.settings.js +12 -7
- package/{dist/es2015 → esm2015}/tooltip.module.js +15 -12
- package/{dist/es2015 → esm2015}/tooltips.module.js +12 -9
- package/{dist/es2015 → esm2015}/utils.js +0 -1
- package/{dist/fesm2015/index.js → fesm2015/kendo-angular-tooltip.js} +448 -403
- package/{dist/es2015/constants.d.ts → kendo-angular-tooltip.d.ts} +3 -6
- package/{dist/es2015/localization → localization}/localized-messages.directive.d.ts +3 -0
- package/{dist/es/main.d.ts → main.d.ts} +3 -0
- package/{dist/es/models → models}/animation.model.d.ts +0 -0
- package/{dist/es/models → models}/events.d.ts +0 -0
- package/{dist/es/models → models}/functions.model.d.ts +0 -0
- package/{dist/es/models → models}/popover-show-option.type.d.ts +0 -0
- package/{dist/es/models → models}/position.type.d.ts +0 -0
- package/{dist/es/models → models}/show.option.type.d.ts +0 -0
- package/{dist/es/package-metadata.d.ts → package-metadata.d.ts} +0 -0
- package/package.json +34 -113
- package/{dist/es2015/popover → popover}/anchor.directive.d.ts +3 -0
- package/{dist/es/popover → popover}/container.directive.d.ts +3 -0
- package/{dist/es2015/popover → popover}/directives-base.d.ts +9 -4
- package/{dist/es2015/popover → popover}/popover.component.d.ts +13 -6
- package/{dist/es/popover → popover}/popover.service.d.ts +7 -4
- package/{dist/es2015/popover → popover}/template-directives/actions-template.directive.d.ts +3 -0
- package/{dist/es2015/popover → popover}/template-directives/body-template.directive.d.ts +3 -0
- package/{dist/es2015/popover → popover}/template-directives/title-template.directive.d.ts +3 -0
- package/popover.module.d.ts +43 -0
- package/schematics/ngAdd/index.js +5 -2
- package/schematics/ngAdd/index.js.map +1 -1
- package/{dist/es/tooltip → tooltip}/tooltip.content.component.d.ts +7 -4
- package/{dist/es/tooltip → tooltip}/tooltip.directive.d.ts +5 -1
- package/{dist/es/tooltip → tooltip}/tooltip.settings.d.ts +7 -0
- package/{dist/es2015/tooltip.module.d.ts → tooltip.module.d.ts} +9 -0
- package/{dist/es2015/tooltips.module.d.ts → tooltips.module.d.ts} +6 -0
- package/{dist/es/utils.d.ts → utils.d.ts} +0 -0
- package/dist/cdn/js/kendo-angular-tooltip.js +0 -20
- package/dist/cdn/main.js +0 -5
- package/dist/es/constants.js +0 -12
- package/dist/es/index.d.ts +0 -12
- package/dist/es/index.js +0 -12
- package/dist/es/index.metadata.json +0 -1
- package/dist/es/localization/localized-messages.directive.d.ts +0 -16
- package/dist/es/localization/localized-messages.directive.js +0 -38
- package/dist/es/models/animation.model.js +0 -4
- package/dist/es/models/events.js +0 -78
- package/dist/es/models/position.type.js +0 -4
- package/dist/es/package-metadata.js +0 -15
- package/dist/es/popover/anchor.directive.d.ts +0 -44
- package/dist/es/popover/anchor.directive.js +0 -156
- package/dist/es/popover/container.directive.js +0 -182
- package/dist/es/popover/directives-base.d.ts +0 -90
- package/dist/es/popover/directives-base.js +0 -294
- package/dist/es/popover/popover.component.d.ts +0 -172
- package/dist/es/popover/popover.component.js +0 -312
- package/dist/es/popover/popover.service.js +0 -88
- package/dist/es/popover/template-directives/actions-template.directive.d.ts +0 -15
- package/dist/es/popover/template-directives/actions-template.directive.js +0 -26
- package/dist/es/popover/template-directives/body-template.directive.d.ts +0 -15
- package/dist/es/popover/template-directives/body-template.directive.js +0 -26
- package/dist/es/popover/template-directives/title-template.directive.d.ts +0 -15
- package/dist/es/popover/template-directives/title-template.directive.js +0 -26
- package/dist/es/popover.module.d.ts +0 -31
- package/dist/es/popover.module.js +0 -65
- package/dist/es/tooltip/tooltip.content.component.js +0 -192
- package/dist/es/tooltip/tooltip.directive.js +0 -452
- package/dist/es/tooltip/tooltip.settings.js +0 -46
- package/dist/es/tooltip.module.d.ts +0 -36
- package/dist/es/tooltip.module.js +0 -57
- package/dist/es/tooltips.module.d.ts +0 -32
- package/dist/es/tooltips.module.js +0 -45
- package/dist/es/utils.js +0 -113
- package/dist/es2015/index.d.ts +0 -12
- package/dist/es2015/index.js +0 -12
- package/dist/es2015/index.metadata.json +0 -1
- package/dist/es2015/localization/localized-messages.directive.js +0 -34
- package/dist/es2015/main.d.ts +0 -22
- package/dist/es2015/main.js +0 -18
- package/dist/es2015/models/animation.model.d.ts +0 -9
- package/dist/es2015/models/events.d.ts +0 -78
- package/dist/es2015/models/functions.model.d.ts +0 -17
- package/dist/es2015/models/popover-show-option.type.d.ts +0 -8
- package/dist/es2015/models/popover-show-option.type.js +0 -4
- package/dist/es2015/models/position.type.d.ts +0 -14
- package/dist/es2015/models/show.option.type.d.ts +0 -13
- package/dist/es2015/models/show.option.type.js +0 -4
- package/dist/es2015/package-metadata.d.ts +0 -9
- package/dist/es2015/popover/container.directive.d.ts +0 -56
- package/dist/es2015/popover/popover.service.d.ts +0 -30
- package/dist/es2015/popover/template-directives/actions-template.directive.js +0 -25
- package/dist/es2015/popover/template-directives/body-template.directive.js +0 -25
- package/dist/es2015/popover/template-directives/title-template.directive.js +0 -25
- package/dist/es2015/popover.module.d.ts +0 -31
- package/dist/es2015/tooltip/tooltip.content.component.d.ts +0 -41
- package/dist/es2015/tooltip/tooltip.directive.d.ts +0 -156
- package/dist/es2015/tooltip/tooltip.settings.d.ts +0 -72
- package/dist/es2015/utils.d.ts +0 -34
- package/dist/fesm5/index.js +0 -2083
- package/dist/npm/constants.js +0 -14
- package/dist/npm/index.js +0 -19
- package/dist/npm/localization/localized-messages.directive.js +0 -40
- package/dist/npm/main.js +0 -36
- package/dist/npm/models/animation.model.js +0 -6
- package/dist/npm/models/events.js +0 -80
- package/dist/npm/models/functions.model.js +0 -6
- package/dist/npm/models/popover-show-option.type.js +0 -6
- package/dist/npm/models/position.type.js +0 -6
- package/dist/npm/models/show.option.type.js +0 -6
- package/dist/npm/package-metadata.js +0 -17
- package/dist/npm/popover/anchor.directive.js +0 -158
- package/dist/npm/popover/container.directive.js +0 -184
- package/dist/npm/popover/directives-base.js +0 -296
- package/dist/npm/popover/popover.component.js +0 -314
- package/dist/npm/popover/popover.service.js +0 -90
- package/dist/npm/popover/template-directives/actions-template.directive.js +0 -28
- package/dist/npm/popover/template-directives/body-template.directive.js +0 -28
- package/dist/npm/popover/template-directives/title-template.directive.js +0 -28
- package/dist/npm/popover.module.js +0 -67
- package/dist/npm/tooltip/tooltip.content.component.js +0 -194
- package/dist/npm/tooltip/tooltip.directive.js +0 -454
- package/dist/npm/tooltip/tooltip.settings.js +0 -48
- package/dist/npm/tooltip.module.js +0 -59
- package/dist/npm/tooltips.module.js +0 -47
- package/dist/npm/utils.js +0 -121
- package/dist/systemjs/kendo-angular-tooltip.js +0 -5
|
@@ -1,44 +0,0 @@
|
|
|
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 { ElementRef, NgZone, Renderer2 } from "@angular/core";
|
|
6
|
-
import { PopupService } from "@progress/kendo-angular-popup";
|
|
7
|
-
import { PopoverDirectivesBase } from "./directives-base";
|
|
8
|
-
import { PopoverService } from "./popover.service";
|
|
9
|
-
/**
|
|
10
|
-
* Represents the [`kendoPopoverAnchor`]({% slug configuration_popover %}#toc-anchordirective) directive.
|
|
11
|
-
* It is used to target an element, which should display a popover on interaction.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts-no-run
|
|
15
|
-
* <button kendoPopoverAnchor [popover]="myPopover">Show Popover</button>
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class PopoverAnchorDirective extends PopoverDirectivesBase {
|
|
19
|
-
protected hostEl: ElementRef;
|
|
20
|
-
protected ngZone: NgZone;
|
|
21
|
-
protected popupService: PopupService;
|
|
22
|
-
protected renderer: Renderer2;
|
|
23
|
-
protected popoverService: PopoverService;
|
|
24
|
-
constructor(hostEl: ElementRef, ngZone: NgZone, popupService: PopupService, renderer: Renderer2, popoverService: PopoverService);
|
|
25
|
-
/**
|
|
26
|
-
* Shows the Popover. [See example]({% slug programmaticcontrol_popover %})
|
|
27
|
-
*/
|
|
28
|
-
show(): void;
|
|
29
|
-
/**
|
|
30
|
-
* Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
|
|
31
|
-
*/
|
|
32
|
-
toggle(): void;
|
|
33
|
-
protected subscribeToEvents(arr: any[]): void;
|
|
34
|
-
protected subscribeClick(): void;
|
|
35
|
-
protected mouseenterHandler: () => void;
|
|
36
|
-
protected mouseleaveHandler: () => void;
|
|
37
|
-
protected focusHandler: () => void;
|
|
38
|
-
protected blurHandler: (args: any) => void;
|
|
39
|
-
/**
|
|
40
|
-
* @hidden
|
|
41
|
-
*/
|
|
42
|
-
private onClick;
|
|
43
|
-
private controlVisibility;
|
|
44
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
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, ElementRef, NgZone, Renderer2 } from "@angular/core";
|
|
7
|
-
import { closest } from "@progress/kendo-angular-common";
|
|
8
|
-
import { PopupService } from "@progress/kendo-angular-popup";
|
|
9
|
-
import { filter, take } from "rxjs/operators";
|
|
10
|
-
import { PopoverDirectivesBase } from "./directives-base";
|
|
11
|
-
import { PopoverService } from "./popover.service";
|
|
12
|
-
/**
|
|
13
|
-
* Represents the [`kendoPopoverAnchor`]({% slug configuration_popover %}#toc-anchordirective) directive.
|
|
14
|
-
* It is used to target an element, which should display a popover on interaction.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts-no-run
|
|
18
|
-
* <button kendoPopoverAnchor [popover]="myPopover">Show Popover</button>
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
var PopoverAnchorDirective = /** @class */ (function (_super) {
|
|
22
|
-
tslib_1.__extends(PopoverAnchorDirective, _super);
|
|
23
|
-
function PopoverAnchorDirective(hostEl, ngZone, popupService, renderer, popoverService) {
|
|
24
|
-
var _this = _super.call(this, ngZone, popupService, renderer) || this;
|
|
25
|
-
_this.hostEl = hostEl;
|
|
26
|
-
_this.ngZone = ngZone;
|
|
27
|
-
_this.popupService = popupService;
|
|
28
|
-
_this.renderer = renderer;
|
|
29
|
-
_this.popoverService = popoverService;
|
|
30
|
-
_this.mouseenterHandler = function () {
|
|
31
|
-
_this.controlVisibility(_this.hostEl.nativeElement, true);
|
|
32
|
-
};
|
|
33
|
-
_this.mouseleaveHandler = function () {
|
|
34
|
-
if (_this.isPrevented(_this.hostEl.nativeElement, false)) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (!_this._hideSub) {
|
|
38
|
-
_this._hideSub = _this.popoverService.hidePopover.subscribe(function (val) {
|
|
39
|
-
var isPopoverHovered = val[0], isAnchorHovered = val[1];
|
|
40
|
-
if (!isPopoverHovered && !isAnchorHovered) {
|
|
41
|
-
_this.hide();
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
_this.focusHandler = function () {
|
|
47
|
-
_this.controlVisibility(_this.hostEl.nativeElement, true);
|
|
48
|
-
};
|
|
49
|
-
_this.blurHandler = function (args) {
|
|
50
|
-
var event = args.domEvent;
|
|
51
|
-
if (_this.isPrevented(_this.hostEl.nativeElement, false)) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
// from anchor to popup focus check
|
|
55
|
-
var isFocusInside = !!closest(event.relatedTarget, function (node) { return node.classList && node.classList.contains('k-popover'); });
|
|
56
|
-
if (!isFocusInside) {
|
|
57
|
-
_this.hide();
|
|
58
|
-
}
|
|
59
|
-
if (!_this._focusInsideSub) {
|
|
60
|
-
// inside popup focus check
|
|
61
|
-
_this._focusInsideSub = _this.popoverService.isFocusInsidePopover.pipe(filter(function (v) { return v !== null; })).subscribe(function (val) {
|
|
62
|
-
if (!val) {
|
|
63
|
-
_this.hide();
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
_this._popoverService = _this.popoverService;
|
|
69
|
-
return _this;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Shows the Popover. [See example]({% slug programmaticcontrol_popover %})
|
|
73
|
-
*/
|
|
74
|
-
PopoverAnchorDirective.prototype.show = function () {
|
|
75
|
-
var _this = this;
|
|
76
|
-
if (this.popupRef) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
this.ngZone.run(function () {
|
|
80
|
-
_this.openPopup(_this.hostEl);
|
|
81
|
-
});
|
|
82
|
-
this.popupRef.popupAnchorViewportLeave
|
|
83
|
-
.pipe(take(1))
|
|
84
|
-
.subscribe(function () { return _this.hide(); });
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
|
|
88
|
-
*/
|
|
89
|
-
PopoverAnchorDirective.prototype.toggle = function () {
|
|
90
|
-
if (this.popupRef) {
|
|
91
|
-
this.hide();
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
this.show();
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
PopoverAnchorDirective.prototype.subscribeToEvents = function (arr) {
|
|
98
|
-
var _this = this;
|
|
99
|
-
this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[0].name, function () {
|
|
100
|
-
_this.popoverService.emitAnchorState(true, _this.hostEl.nativeElement);
|
|
101
|
-
arr[0].handler();
|
|
102
|
-
}));
|
|
103
|
-
this.subs.add(this.renderer.listen(this.hostEl.nativeElement, arr[1].name, function (e) {
|
|
104
|
-
_this.popoverService.emitAnchorState(false, null);
|
|
105
|
-
arr[1].handler({ domEvent: e });
|
|
106
|
-
}));
|
|
107
|
-
};
|
|
108
|
-
PopoverAnchorDirective.prototype.subscribeClick = function () {
|
|
109
|
-
var _this = this;
|
|
110
|
-
if (this.disposeClickListener) {
|
|
111
|
-
this.disposeClickListener();
|
|
112
|
-
}
|
|
113
|
-
this.disposeClickListener = this.renderer.listen(document, 'click', function (e) {
|
|
114
|
-
_this.onClick(e);
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* @hidden
|
|
119
|
-
*/
|
|
120
|
-
PopoverAnchorDirective.prototype.onClick = function (event) {
|
|
121
|
-
var _this = this;
|
|
122
|
-
var isInsidePopup = !!closest(event.target, function (node) { return node.classList && node.classList.contains('k-popup'); });
|
|
123
|
-
var isAnchor = !!closest(event.target, function (node) { return node === _this.hostEl.nativeElement; });
|
|
124
|
-
if (isInsidePopup || (this.popupRef && isAnchor)) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (isAnchor) {
|
|
128
|
-
// on opening
|
|
129
|
-
this.controlVisibility(this.hostEl.nativeElement, true);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
// on closing
|
|
133
|
-
this.controlVisibility(this.hostEl.nativeElement, false);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
PopoverAnchorDirective.prototype.controlVisibility = function (anchor, show) {
|
|
137
|
-
if (this.isPrevented(anchor, show)) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
show ? this.show() : this.hide();
|
|
141
|
-
};
|
|
142
|
-
PopoverAnchorDirective = tslib_1.__decorate([
|
|
143
|
-
Directive({
|
|
144
|
-
selector: '[kendoPopoverAnchor]',
|
|
145
|
-
exportAs: 'kendoPopoverAnchor',
|
|
146
|
-
providers: [PopoverService]
|
|
147
|
-
}),
|
|
148
|
-
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
149
|
-
NgZone,
|
|
150
|
-
PopupService,
|
|
151
|
-
Renderer2,
|
|
152
|
-
PopoverService])
|
|
153
|
-
], PopoverAnchorDirective);
|
|
154
|
-
return PopoverAnchorDirective;
|
|
155
|
-
}(PopoverDirectivesBase));
|
|
156
|
-
export { PopoverAnchorDirective };
|
|
@@ -1,182 +0,0 @@
|
|
|
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, ElementRef, Input, NgZone, Renderer2 } from "@angular/core";
|
|
7
|
-
import { closest } from "@progress/kendo-angular-common";
|
|
8
|
-
import { PopupService } from "@progress/kendo-angular-popup";
|
|
9
|
-
import { filter, take } from "rxjs/operators";
|
|
10
|
-
import { closestBySelector } from "../utils";
|
|
11
|
-
import { PopoverDirectivesBase } from './directives-base';
|
|
12
|
-
import { PopoverService } from "./popover.service";
|
|
13
|
-
/**
|
|
14
|
-
* Represents the [`kendoPopoverContainer`]({% slug configuration_popover %}#toc-containerdirective) directive.
|
|
15
|
-
* It is used to filter and target multiple elements, which should display a popover on interaction.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts-no-run
|
|
19
|
-
* <div kendoPopoverContainer [popover]="myPopover" filter=".has-popover">
|
|
20
|
-
* <button class="has-popover">Show Popover</button>
|
|
21
|
-
* <button>Button Without Popover</button>
|
|
22
|
-
* <button class="has-popover">Show Popover</button>
|
|
23
|
-
* </div>
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
var PopoverContainerDirective = /** @class */ (function (_super) {
|
|
27
|
-
tslib_1.__extends(PopoverContainerDirective, _super);
|
|
28
|
-
function PopoverContainerDirective(wrapperEl, ngZone, popupService, renderer, popoverService) {
|
|
29
|
-
var _this = _super.call(this, ngZone, popupService, renderer) || this;
|
|
30
|
-
_this.wrapperEl = wrapperEl;
|
|
31
|
-
_this.ngZone = ngZone;
|
|
32
|
-
_this.popupService = popupService;
|
|
33
|
-
_this.renderer = renderer;
|
|
34
|
-
_this.popoverService = popoverService;
|
|
35
|
-
_this.mouseenterHandler = function (anchor) {
|
|
36
|
-
_this.controlVisibility(anchor, true);
|
|
37
|
-
};
|
|
38
|
-
_this.mouseleaveHandler = function (args) {
|
|
39
|
-
var anchor = args.anchor;
|
|
40
|
-
if (_this.isPrevented(anchor, false)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (!_this._hideSub) {
|
|
44
|
-
_this._hideSub = _this.popoverService.hidePopover.subscribe(function (val) {
|
|
45
|
-
var isPopoverHovered = val[0], isOriginAnchor = val[2], currentAnchor = val[3];
|
|
46
|
-
if (!isPopoverHovered && !isOriginAnchor) {
|
|
47
|
-
_this.hide();
|
|
48
|
-
if (!isOriginAnchor && currentAnchor) {
|
|
49
|
-
_this.show(currentAnchor);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
_this.focusHandler = function (anchor) {
|
|
56
|
-
_this.controlVisibility(anchor, true);
|
|
57
|
-
};
|
|
58
|
-
_this.blurHandler = function (args) {
|
|
59
|
-
var anchor = args.anchor;
|
|
60
|
-
var event = args.domEvent;
|
|
61
|
-
if (_this.isPrevented(anchor, false)) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
// from anchor to popup focus check
|
|
65
|
-
var isFocusInside = !!closest(event.relatedTarget, function (node) { return node.classList && node.classList.contains('k-popover'); });
|
|
66
|
-
if (!isFocusInside) {
|
|
67
|
-
_this.hide();
|
|
68
|
-
}
|
|
69
|
-
if (!_this._focusInsideSub) {
|
|
70
|
-
// inside popup focus check
|
|
71
|
-
_this._focusInsideSub = _this.popoverService.isFocusInsidePopover.pipe(filter(function (v) { return v !== null; })).subscribe(function (val) {
|
|
72
|
-
if (!val && !isFocusInside) {
|
|
73
|
-
_this.hide();
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
_this._popoverService = _this.popoverService;
|
|
79
|
-
return _this;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Shows the Popover.
|
|
83
|
-
*
|
|
84
|
-
* @param anchor—Specifies the element that will be used as an anchor. The Popover opens relative to that element. [See example]({% slug programmaticcontrol_popover %})
|
|
85
|
-
*/
|
|
86
|
-
PopoverContainerDirective.prototype.show = function (anchor) {
|
|
87
|
-
var _this = this;
|
|
88
|
-
if (this.popupRef) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
this.ngZone.run(function () {
|
|
92
|
-
_this.openPopup(anchor);
|
|
93
|
-
});
|
|
94
|
-
this.popupRef.popupAnchorViewportLeave
|
|
95
|
-
.pipe(take(1))
|
|
96
|
-
.subscribe(function () { return _this.hide(); });
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Toggles the visibility of the Popover. [See example]({% slug programmaticcontrol_popover %})
|
|
100
|
-
*
|
|
101
|
-
* @param anchor—Specifies the element that will be used as an anchor. The Popover opens relative to that element.
|
|
102
|
-
*/
|
|
103
|
-
PopoverContainerDirective.prototype.toggle = function (anchor) {
|
|
104
|
-
var previousAnchor = this.popupRef && this.popupRef.content.instance.anchor;
|
|
105
|
-
if (this.popupRef) {
|
|
106
|
-
this.hide();
|
|
107
|
-
if (previousAnchor !== anchor) {
|
|
108
|
-
this.show(anchor);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
this.show(anchor);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
PopoverContainerDirective.prototype.subscribeClick = function () {
|
|
116
|
-
var _this = this;
|
|
117
|
-
if (this.disposeClickListener) {
|
|
118
|
-
this.disposeClickListener();
|
|
119
|
-
}
|
|
120
|
-
this.disposeClickListener = this.renderer.listen(document, 'click', function (e) {
|
|
121
|
-
var filterElement = closestBySelector(e.target, _this.filter);
|
|
122
|
-
_this.clickHandler(filterElement, e);
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
PopoverContainerDirective.prototype.subscribeToEvents = function (arr) {
|
|
126
|
-
var _this = this;
|
|
127
|
-
var filteredElements = Array.from(document.querySelectorAll(this.filter));
|
|
128
|
-
filteredElements.forEach(function (el) {
|
|
129
|
-
_this.subs.add(_this.renderer.listen(el, arr[0].name, function () {
|
|
130
|
-
_this.popoverService.emitAnchorState(true, el);
|
|
131
|
-
arr[0].handler(el);
|
|
132
|
-
}));
|
|
133
|
-
_this.subs.add(_this.renderer.listen(el, arr[1].name, function (e) {
|
|
134
|
-
_this.popoverService.emitAnchorState(false, null);
|
|
135
|
-
arr[1].handler({ anchor: el, domEvent: e });
|
|
136
|
-
}));
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
PopoverContainerDirective.prototype.clickHandler = function (anchor, event) {
|
|
140
|
-
var isInsidePopup = !!closest(event.target, function (node) { return node.classList && node.classList.contains('k-popup'); });
|
|
141
|
-
var popupRefAnchor = this.popupRef && this.popupRef.content.instance.anchor;
|
|
142
|
-
var isOriginAnchor = !!closest(event.target, function (node) { return node === (popupRefAnchor ? popupRefAnchor : anchor); });
|
|
143
|
-
if (this.showOn !== 'click' || isInsidePopup || (this.popupRef && isOriginAnchor)) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (!anchor && this.popupRef) {
|
|
147
|
-
this.controlVisibility(anchor, false);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (isOriginAnchor) {
|
|
151
|
-
this.controlVisibility(anchor, true);
|
|
152
|
-
}
|
|
153
|
-
else if (this.popupRef) {
|
|
154
|
-
this.controlVisibility(anchor, false);
|
|
155
|
-
this.controlVisibility(anchor, true);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
PopoverContainerDirective.prototype.controlVisibility = function (anchor, show) {
|
|
159
|
-
if (this.isPrevented(anchor, show)) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
show ? this.show(anchor) : this.hide();
|
|
163
|
-
};
|
|
164
|
-
tslib_1.__decorate([
|
|
165
|
-
Input(),
|
|
166
|
-
tslib_1.__metadata("design:type", String)
|
|
167
|
-
], PopoverContainerDirective.prototype, "filter", void 0);
|
|
168
|
-
PopoverContainerDirective = tslib_1.__decorate([
|
|
169
|
-
Directive({
|
|
170
|
-
selector: '[kendoPopoverContainer]',
|
|
171
|
-
exportAs: 'kendoPopoverContainer',
|
|
172
|
-
providers: [PopoverService]
|
|
173
|
-
}),
|
|
174
|
-
tslib_1.__metadata("design:paramtypes", [ElementRef,
|
|
175
|
-
NgZone,
|
|
176
|
-
PopupService,
|
|
177
|
-
Renderer2,
|
|
178
|
-
PopoverService])
|
|
179
|
-
], PopoverContainerDirective);
|
|
180
|
-
return PopoverContainerDirective;
|
|
181
|
-
}(PopoverDirectivesBase));
|
|
182
|
-
export { PopoverContainerDirective };
|
|
@@ -1,90 +0,0 @@
|
|
|
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 { ComponentRef, ElementRef, NgZone, OnDestroy, Renderer2 } from "@angular/core";
|
|
6
|
-
import { PopupRef, PopupService } from "@progress/kendo-angular-popup";
|
|
7
|
-
import { PopoverFn } from "../models/functions.model";
|
|
8
|
-
import { PopoverShowOption } from "../models/popover-show-option.type";
|
|
9
|
-
import { PopoverComponent } from "./popover.component";
|
|
10
|
-
import { PopoverService } from "./popover.service";
|
|
11
|
-
import { Subscription } from "rxjs";
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
*/
|
|
15
|
-
export declare abstract class PopoverDirectivesBase implements OnDestroy {
|
|
16
|
-
protected ngZone: NgZone;
|
|
17
|
-
protected popupService: PopupService;
|
|
18
|
-
protected renderer: Renderer2;
|
|
19
|
-
/**
|
|
20
|
-
* Specifies the popover instance that will be rendered.
|
|
21
|
-
* Accepts a [`PopoverComponent`]({% slug api_tooltip_popovercomponent %}) instance or
|
|
22
|
-
* a [`PopoverFn`]({% slug api_tooltip_popoverfn %}) callback which returns a [`PopoverComponent`]({% slug api_tooltip_popovercomponent %}) instance
|
|
23
|
-
* depending on the current anchor element.
|
|
24
|
-
*
|
|
25
|
-
* [See example]({% slug templates_popover %}#toc-popovercallback)
|
|
26
|
-
*/
|
|
27
|
-
popover: PopoverComponent | PopoverFn;
|
|
28
|
-
/**
|
|
29
|
-
* The event on which the Popover will be shown
|
|
30
|
-
*
|
|
31
|
-
* The supported values are:
|
|
32
|
-
* - `click` (default) —The Popover will be shown when its `anchor` element is clicked.
|
|
33
|
-
* - `hover`—The Popover will be shown when its `anchor` element is hovered.
|
|
34
|
-
* - `focus`—The Popover will be shown when its `anchor` element is focused.
|
|
35
|
-
* - `none`—The Popover will not be shown on user interaction. It could be rendered via the Popover API methods.
|
|
36
|
-
*/
|
|
37
|
-
showOn: PopoverShowOption;
|
|
38
|
-
popupRef: PopupRef;
|
|
39
|
-
protected disposeHoverOverListener: () => void;
|
|
40
|
-
protected disposeHoverOutListener: () => void;
|
|
41
|
-
protected disposeClickListener: () => void;
|
|
42
|
-
protected disposePopupHoverOutListener: () => void;
|
|
43
|
-
protected disposePopupHoverInListener: () => void;
|
|
44
|
-
protected disposePopupFocusOutListener: () => void;
|
|
45
|
-
protected subs: Subscription;
|
|
46
|
-
protected _popoverService: PopoverService;
|
|
47
|
-
protected _hideSub: Subscription;
|
|
48
|
-
protected _focusInsideSub: Subscription;
|
|
49
|
-
private _popover;
|
|
50
|
-
private _showOn;
|
|
51
|
-
private _popupOpenSub;
|
|
52
|
-
private _popupCloseSub;
|
|
53
|
-
constructor(ngZone: NgZone, popupService: PopupService, renderer: Renderer2);
|
|
54
|
-
ngAfterViewInit(): void;
|
|
55
|
-
ngOnDestroy(): void;
|
|
56
|
-
/**
|
|
57
|
-
* Hides the Popover ([See example]({% slug programmaticcontrol_popover %})).
|
|
58
|
-
*/
|
|
59
|
-
hide(): void;
|
|
60
|
-
/**
|
|
61
|
-
* @hidden
|
|
62
|
-
*/
|
|
63
|
-
protected closePopup(): void;
|
|
64
|
-
/**
|
|
65
|
-
* @hidden
|
|
66
|
-
*/
|
|
67
|
-
protected openPopup(anchor: Element | ElementRef): void;
|
|
68
|
-
/**
|
|
69
|
-
* @hidden
|
|
70
|
-
*/
|
|
71
|
-
protected isPrevented(anchorElement: Element, show: boolean): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* @hidden
|
|
74
|
-
*/
|
|
75
|
-
protected monitorPopup(): void;
|
|
76
|
-
protected applySettings(contentComponent: ComponentRef<PopoverComponent>, popover: PopoverComponent, anchor: Element | ElementRef): void;
|
|
77
|
-
protected abstract subscribeToEvents(args?: any): void;
|
|
78
|
-
protected abstract subscribeClick(): void;
|
|
79
|
-
protected abstract mouseenterHandler(args?: any): void;
|
|
80
|
-
protected abstract mouseleaveHandler(args?: any): void;
|
|
81
|
-
protected abstract focusHandler(args?: any): void;
|
|
82
|
-
protected abstract blurHandler(args?: any): void;
|
|
83
|
-
/**
|
|
84
|
-
* @hidden
|
|
85
|
-
*/
|
|
86
|
-
private initializeEvents;
|
|
87
|
-
private initializeCompletionEvents;
|
|
88
|
-
private shouldEmitEvent;
|
|
89
|
-
private shouldEmitCompletionEvents;
|
|
90
|
-
}
|