@anglr/common 11.2.0-beta.20220301111415 → 11.3.0-beta.20220302063757
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/changelog.md +37 -0
- package/es2015/src/index.js +1 -0
- package/es2015/src/index.js.map +1 -1
- package/es2015/src/modules/tooltip/components/index.js +2 -0
- package/es2015/src/modules/tooltip/components/index.js.map +1 -0
- package/es2015/src/modules/tooltip/components/tooltip/tooltip.component.js +102 -0
- package/es2015/src/modules/tooltip/components/tooltip/tooltip.component.js.map +1 -0
- package/es2015/src/modules/tooltip/directives/index.js +3 -0
- package/es2015/src/modules/tooltip/directives/index.js.map +1 -0
- package/es2015/src/modules/tooltip/directives/tooltip/tooltip.directive.js +248 -0
- package/es2015/src/modules/tooltip/directives/tooltip/tooltip.directive.js.map +1 -0
- package/es2015/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js +20 -0
- package/es2015/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js.map +1 -0
- package/es2015/src/modules/tooltip/index.js +6 -0
- package/es2015/src/modules/tooltip/index.js.map +1 -0
- package/es2015/src/modules/tooltip/misc/tokens.js +6 -0
- package/es2015/src/modules/tooltip/misc/tokens.js.map +1 -0
- package/es2015/src/modules/tooltip/misc/tooltip.interface.js +2 -0
- package/es2015/src/modules/tooltip/misc/tooltip.interface.js.map +1 -0
- package/es2015/src/modules/tooltip/modules/index.js +2 -0
- package/es2015/src/modules/tooltip/modules/index.js.map +1 -0
- package/es2015/src/modules/tooltip/modules/tooltip.module.js +36 -0
- package/es2015/src/modules/tooltip/modules/tooltip.module.js.map +1 -0
- package/es2020/src/index.js +1 -0
- package/es2020/src/index.js.map +1 -1
- package/es2020/src/modules/tooltip/components/index.js +2 -0
- package/es2020/src/modules/tooltip/components/index.js.map +1 -0
- package/es2020/src/modules/tooltip/components/tooltip/tooltip.component.js +102 -0
- package/es2020/src/modules/tooltip/components/tooltip/tooltip.component.js.map +1 -0
- package/es2020/src/modules/tooltip/directives/index.js +3 -0
- package/es2020/src/modules/tooltip/directives/index.js.map +1 -0
- package/es2020/src/modules/tooltip/directives/tooltip/tooltip.directive.js +247 -0
- package/es2020/src/modules/tooltip/directives/tooltip/tooltip.directive.js.map +1 -0
- package/es2020/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js +20 -0
- package/es2020/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js.map +1 -0
- package/es2020/src/modules/tooltip/index.js +6 -0
- package/es2020/src/modules/tooltip/index.js.map +1 -0
- package/es2020/src/modules/tooltip/misc/tokens.js +6 -0
- package/es2020/src/modules/tooltip/misc/tokens.js.map +1 -0
- package/es2020/src/modules/tooltip/misc/tooltip.interface.js +2 -0
- package/es2020/src/modules/tooltip/misc/tooltip.interface.js.map +1 -0
- package/es2020/src/modules/tooltip/modules/index.js +2 -0
- package/es2020/src/modules/tooltip/modules/index.js.map +1 -0
- package/es2020/src/modules/tooltip/modules/tooltip.module.js +36 -0
- package/es2020/src/modules/tooltip/modules/tooltip.module.js.map +1 -0
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.d.ts.map +1 -1
- package/src/modules/tooltip/components/index.d.ts +2 -0
- package/src/modules/tooltip/components/index.d.ts.map +1 -0
- package/src/modules/tooltip/components/tooltip/tooltip.component.css +10 -0
- package/src/modules/tooltip/components/tooltip/tooltip.component.d.ts +63 -0
- package/src/modules/tooltip/components/tooltip/tooltip.component.d.ts.map +1 -0
- package/src/modules/tooltip/components/tooltip/tooltip.component.html +6 -0
- package/src/modules/tooltip/directives/index.d.ts +3 -0
- package/src/modules/tooltip/directives/index.d.ts.map +1 -0
- package/src/modules/tooltip/directives/tooltip/tooltip.directive.d.ts +113 -0
- package/src/modules/tooltip/directives/tooltip/tooltip.directive.d.ts.map +1 -0
- package/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.d.ts +12 -0
- package/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.d.ts.map +1 -0
- package/src/modules/tooltip/index.d.ts +6 -0
- package/src/modules/tooltip/index.d.ts.map +1 -0
- package/src/modules/tooltip/misc/tokens.d.ts +7 -0
- package/src/modules/tooltip/misc/tokens.d.ts.map +1 -0
- package/src/modules/tooltip/misc/tooltip.interface.d.ts +63 -0
- package/src/modules/tooltip/misc/tooltip.interface.d.ts.map +1 -0
- package/src/modules/tooltip/modules/index.d.ts +2 -0
- package/src/modules/tooltip/modules/index.d.ts.map +1 -0
- package/src/modules/tooltip/modules/tooltip.module.d.ts +14 -0
- package/src/modules/tooltip/modules/tooltip.module.d.ts.map +1 -0
- package/version.bak +1 -1
package/changelog.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Version 11.3.0 (2022-03-02)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- new **Tooltip** module (based on `Position` service)
|
|
8
|
+
- new `TooltipModule` module for rendering tooltips
|
|
9
|
+
- **exports**
|
|
10
|
+
- `TooltipDirective` directive
|
|
11
|
+
- `TooltipTemplateDirective` directive
|
|
12
|
+
- new `TooltipDirective` directive used for rendering tooltip
|
|
13
|
+
- **inputs**
|
|
14
|
+
- `tooltip` tooltip text that is displayed, or any data that could be passed to template
|
|
15
|
+
- `allowHtml` indication whether are html tags allowed in tooltip text
|
|
16
|
+
- `tooltipTemplate` instance of tooltip template that is used for rendering
|
|
17
|
+
- `tooltipOptions` options used for displaying tooltip
|
|
18
|
+
- `tooltipVisible` gets or sets indication whether is tooltip visible, if has boolean value, mouse events cant override this
|
|
19
|
+
- **content**
|
|
20
|
+
- child `TooltipTemplateDirective` instance of template from element content, used for rendering
|
|
21
|
+
- new `TooltipTemplateDirective` directive used for obtaining custom tooltip template
|
|
22
|
+
- new `TooltipComponent` component used for displaying tooltip content
|
|
23
|
+
- implementation of `TooltipRenderer`
|
|
24
|
+
- new `TOOLTIP_OPTIONS` injection token used for injecting tooltip options
|
|
25
|
+
- new `TooltipRenderer` interface, that represents component that is used for rendering tooltip
|
|
26
|
+
- property `data` data that are rendered in tooltip
|
|
27
|
+
- property `template` template used for rendering tooltip
|
|
28
|
+
- property `allowHtml` indication whether are html tags allowed in tooltip text
|
|
29
|
+
- property `cssClass` css class that is applied to tooltip renderer component
|
|
30
|
+
- method `registerHoverEvents` registers handlers that allows reaction to entering or leaving tooltip
|
|
31
|
+
- method `invalidateVisuals` explicitly runs invalidation of content (change detection)
|
|
32
|
+
- new `TooltipOptions` interface, that represents options used for tooltip directive
|
|
33
|
+
- property `delay` delay for displaying of tooltip on hover
|
|
34
|
+
- property `position` position where should tooltip appear relative to its parent
|
|
35
|
+
- property `allowSelection` allows selection of text in tooltip
|
|
36
|
+
- property `tooltipCssClass` css class that is applied to tooltip renderer component
|
|
37
|
+
- property `stopPropagation` indication whether stop propagation of "hover" event
|
|
38
|
+
- property `tooltipRenderer` type of tooltip renderer that is used for rendering tooltip
|
|
39
|
+
|
|
3
40
|
## Version 11.2.0 (2022-03-01)
|
|
4
41
|
|
|
5
42
|
### Bug Fixes
|
package/es2015/src/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export { MultiButtonModule } from './modules/multiButton/modules/multiButton.mod
|
|
|
18
18
|
export * from './modules/goBack';
|
|
19
19
|
export * from './modules/position';
|
|
20
20
|
export * from './modules/castPipes';
|
|
21
|
+
export * from './modules/tooltip';
|
|
21
22
|
export * from './types/tokens';
|
|
22
23
|
export * from './utils';
|
|
23
24
|
export * from './pipes';
|
package/es2015/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC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AM,gEAAgE,CAAC;AACnG,OAAO,EAAC,UAAU,EAAE,uBAAuB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAC;AACjF,OAAO,EAAC,6BAA6B,EAAE,mBAAmB,EAAC,MAAM,8DAA8D,CAAC;AAChI,OAAO,EAAC,qBAAqB,EAAE,2BAA2B,EAAE,YAAY,EAAE,oBAAoB,EAAiB,oBAAoB,EAAuF,MAAM,0BAA0B,CAAC;AAC3P,cAAc,qBAAqB,CAAC;AAEpC,sBAAsB;AACtB,0BAA0B","sourcesContent":["export {GlobalizationService} from './services/globalization/globalization.service';\nexport {CommonDynamicModule} from './modules/commonDynamic.module';\nexport {CommonLocalizeModule} from './modules/commonLocalize.module';\nexport {CommonUtilsModule} from './modules/commonUtils.module';\nexport {ProgressIndicatorOptions} from './modules/progressIndicator/services/progressIndicatorOptions';\nexport {ProgressIndicatorComponent} from './modules/progressIndicator/components/progressIndicator/progressIndicator.component';\nexport {ProgressIndicatorModule} from './modules/progressIndicator/modules/progressIndicator.module';\nexport {ProgressIndicatorService} from './modules/progressIndicator/services/progressIndicator.service';\nexport {PROGRESS_INDICATOR_GROUP_NAME} from './modules/progressIndicator/misc/tokens';\nexport {DebugDataModule} from './modules/debugData/modules/debugData.module';\nexport {DebugDataComponent} from './modules/debugData/components/debugData/debugData.component';\nexport {DebugDataEnabledService} from './modules/debugData/services/debugDataEnabled/debugDataEnabled.service';\nexport {ClickOutsideDirective} from './modules/clickOutside/directives/clickOutside/clickOutside.directive';\nexport {ClickOutsideModule} from './modules/clickOutside/modules/clickOutside.module';\nexport {MultiButtonComponent} from './modules/multiButton/components/multiButton/multiButton.component';\nexport {MultiButtonCssClasses} from './modules/multiButton/components/multiButton/multiButton.interface';\nexport {MULTI_BUTTON_CSS_CLASSES} from './modules/multiButton/misc/tokens';\nexport {MultiButtonModule} from './modules/multiButton/modules/multiButton.module';\nexport * from './modules/goBack';\nexport * from './modules/position';\nexport * from './modules/castPipes';\nexport * from './types/tokens';\nexport * from './utils';\nexport * from './pipes';\nexport * from './decorators';\nexport {CookieService} from './services/cookies/cookies.service';\nexport {StatusCodeService} from './services/statusCode/statusCode.service';\nexport {CookiePermanentStorageService, PermanentStorage} from './services/permanentStorage';\nexport {MemoryTemporaryStorageService, TemporaryStorage} from './services/temporaryStorage';\nexport {NoStringLocalizationService, StringLocalization} from './services/stringLocalization';\nexport {Logger} from './services/logger';\nexport {NgComponentOutletEx} from './directives/ngComponentOutletEx/ngComponentOutletEx.directive';\nexport {APP_STABLE, extractAppStableResolve, runWhenModuleStable} from './utils';\nexport {PROGRESS_INTERCEPTOR_PROVIDER, ProgressInterceptor} from './modules/progressIndicator/interceptors/progressInterceptor';\nexport {DEFAULT_NOTIFICATIONS, DefaultNotificationsService, Notification, NotificationSeverity, Notifications, NotificationsOptions, NotificationsProvider, NotificationsScopeProvider, NotificationsScopeProviderFactory} from './services/notifications';\nexport * from './services/position';\n\n//TODO: any to unknown\n//TODO: strict null checks"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,+DAA+D,CAAC;AACvG,OAAO,EAAC,0BAA0B,EAAC,MAAM,sFAAsF,CAAC;AAChI,OAAO,EAAC,uBAAuB,EAAC,MAAM,8DAA8D,CAAC;AACrG,OAAO,EAAC,wBAAwB,EAAC,MAAM,gEAAgE,CAAC;AACxG,OAAO,EAAC,6BAA6B,EAAC,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAC,eAAe,EAAC,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAC,kBAAkB,EAAC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ommonDynamicModule} from './modules/commonDynamic.module';\nexport {CommonLocalizeModule} from './modules/commonLocalize.module';\nexport {CommonUtilsModule} from './modules/commonUtils.module';\nexport {ProgressIndicatorOptions} from './modules/progressIndicator/services/progressIndicatorOptions';\nexport {ProgressIndicatorComponent} from './modules/progressIndicator/components/progressIndicator/progressIndicator.component';\nexport {ProgressIndicatorModule} from './modules/progressIndicator/modules/progressIndicator.module';\nexport {ProgressIndicatorService} from './modules/progressIndicator/services/progressIndicator.service';\nexport {PROGRESS_INDICATOR_GROUP_NAME} from './modules/progressIndicator/misc/tokens';\nexport {DebugDataModule} from './modules/debugData/modules/debugData.module';\nexport {DebugDataComponent} from './modules/debugData/components/debugData/debugData.component';\nexport {DebugDataEnabledService} from './modules/debugData/services/debugDataEnabled/debugDataEnabled.service';\nexport {ClickOutsideDirective} from './modules/clickOutside/directives/clickOutside/clickOutside.directive';\nexport {ClickOutsideModule} from './modules/clickOutside/modules/clickOutside.module';\nexport {MultiButtonComponent} from './modules/multiButton/components/multiButton/multiButton.component';\nexport {MultiButtonCssClasses} from './modules/multiButton/components/multiButton/multiButton.interface';\nexport {MULTI_BUTTON_CSS_CLASSES} from './modules/multiButton/misc/tokens';\nexport {MultiButtonModule} from './modules/multiButton/modules/multiButton.module';\nexport * from './modules/goBack';\nexport * from './modules/position';\nexport * from './modules/castPipes';\nexport * from './modules/tooltip';\nexport * from './types/tokens';\nexport * from './utils';\nexport * from './pipes';\nexport * from './decorators';\nexport {CookieService} from './services/cookies/cookies.service';\nexport {StatusCodeService} from './services/statusCode/statusCode.service';\nexport {CookiePermanentStorageService, PermanentStorage} from './services/permanentStorage';\nexport {MemoryTemporaryStorageService, TemporaryStorage} from './services/temporaryStorage';\nexport {NoStringLocalizationService, StringLocalization} from './services/stringLocalization';\nexport {Logger} from './services/logger';\nexport {NgComponentOutletEx} from './directives/ngComponentOutletEx/ngComponentOutletEx.directive';\nexport {APP_STABLE, extractAppStableResolve, runWhenModuleStable} from './utils';\nexport {PROGRESS_INTERCEPTOR_PROVIDER, ProgressInterceptor} from './modules/progressIndicator/interceptors/progressInterceptor';\nexport {DEFAULT_NOTIFICATIONS, DefaultNotificationsService, Notification, NotificationSeverity, Notifications, NotificationsOptions, NotificationsProvider, NotificationsScopeProvider, NotificationsScopeProviderFactory} from './services/notifications';\nexport * from './services/position';\n\n//TODO: any to unknown\n//TODO: strict null checks"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/tooltip/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './tooltip/tooltip.component';\n"]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding, ElementRef, HostListener } from '@angular/core';
|
|
2
|
+
import { transition, trigger, useAnimation } from '@angular/animations';
|
|
3
|
+
import { fadeInAnimation, fadeOutAnimation } from '@anglr/animations';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@angular/common";
|
|
6
|
+
/**
|
|
7
|
+
* Component used for displaying tooltip content
|
|
8
|
+
*/
|
|
9
|
+
export class TooltipComponent {
|
|
10
|
+
//######################### constructor #########################
|
|
11
|
+
constructor(_changeDetector, _element) {
|
|
12
|
+
this._changeDetector = _changeDetector;
|
|
13
|
+
this._element = _element;
|
|
14
|
+
//######################### protected fields #########################
|
|
15
|
+
/**
|
|
16
|
+
* Called when mouse enter tooltip component, hover
|
|
17
|
+
*/
|
|
18
|
+
this._enterFn = () => null;
|
|
19
|
+
/**
|
|
20
|
+
* Called when mouse leaves tooltip component
|
|
21
|
+
*/
|
|
22
|
+
this._leaveFn = () => null;
|
|
23
|
+
/**
|
|
24
|
+
* Indication whether are html tags allowed in tooltip text
|
|
25
|
+
*/
|
|
26
|
+
this.allowHtml = false;
|
|
27
|
+
//######################### public properties - host #########################
|
|
28
|
+
/**
|
|
29
|
+
* Attach fade in/out animation to element
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
this.animation = true;
|
|
33
|
+
}
|
|
34
|
+
//######################### public methods - implementation of TooltipRenderer #########################
|
|
35
|
+
/**
|
|
36
|
+
* Registers handlers that allows reaction to entering or leaving tooltip
|
|
37
|
+
* @param enter - Called when mouse enter tooltip component, hover
|
|
38
|
+
* @param leave - Called when mouse leaves tooltip component
|
|
39
|
+
*/
|
|
40
|
+
registerHoverEvents(enter, leave) {
|
|
41
|
+
this._enterFn = enter;
|
|
42
|
+
this._leaveFn = leave;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Explicitly runs invalidation of content (change detection)
|
|
46
|
+
*/
|
|
47
|
+
invalidateVisuals() {
|
|
48
|
+
if (this.cssClass) {
|
|
49
|
+
this._element.nativeElement.classList.add(this.cssClass);
|
|
50
|
+
}
|
|
51
|
+
this._changeDetector.detectChanges();
|
|
52
|
+
}
|
|
53
|
+
//######################### public methods - host #########################
|
|
54
|
+
/**
|
|
55
|
+
* Handles mouse enter event over tooltip
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
mouseEnter() {
|
|
59
|
+
this._enterFn();
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Handles mouse leave event over tooltip
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
mouseLeave() {
|
|
66
|
+
this._leaveFn();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TooltipComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
70
|
+
TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: TooltipComponent, selector: "tooltip-popup", host: { listeners: { "mouseenter": "mouseEnter()", "mouseleave": "mouseLeave()" }, properties: { "@fadeInOut": "this.animation" } }, ngImport: i0, template: "<div *ngIf=\"!template && !allowHtml\">{{data}}</div>\r\n<div *ngIf=\"!template && allowHtml\" [innerHTML]=\"data\"></div>\r\n\r\n<ng-template [ngIf]=\"template\">\r\n <ng-container *ngTemplateOutlet=\"template; context: {$implicit: data}\"></ng-container>\r\n</ng-template>", styles: [":host\r\n{\r\n display: block;\r\n position: absolute;\r\n padding: 2px 4px;\r\n border-radius: 3px;\r\n font-size: 0.9em;\r\n max-width: 300px;\r\n user-select: text;\r\n}"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], animations: [
|
|
71
|
+
trigger('fadeInOut', [
|
|
72
|
+
transition(':enter', [
|
|
73
|
+
useAnimation(fadeInAnimation, { params: { duration: '260ms' } })
|
|
74
|
+
]),
|
|
75
|
+
transition(':leave', [
|
|
76
|
+
useAnimation(fadeOutAnimation, { params: { duration: '260ms' } })
|
|
77
|
+
])
|
|
78
|
+
])
|
|
79
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
80
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
81
|
+
type: Component,
|
|
82
|
+
args: [{ selector: 'tooltip-popup', animations: [
|
|
83
|
+
trigger('fadeInOut', [
|
|
84
|
+
transition(':enter', [
|
|
85
|
+
useAnimation(fadeInAnimation, { params: { duration: '260ms' } })
|
|
86
|
+
]),
|
|
87
|
+
transition(':leave', [
|
|
88
|
+
useAnimation(fadeOutAnimation, { params: { duration: '260ms' } })
|
|
89
|
+
])
|
|
90
|
+
])
|
|
91
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"!template && !allowHtml\">{{data}}</div>\r\n<div *ngIf=\"!template && allowHtml\" [innerHTML]=\"data\"></div>\r\n\r\n<ng-template [ngIf]=\"template\">\r\n <ng-container *ngTemplateOutlet=\"template; context: {$implicit: data}\"></ng-container>\r\n</ng-template>", styles: [":host\r\n{\r\n display: block;\r\n position: absolute;\r\n padding: 2px 4px;\r\n border-radius: 3px;\r\n font-size: 0.9em;\r\n max-width: 300px;\r\n user-select: text;\r\n}"] }]
|
|
92
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { animation: [{
|
|
93
|
+
type: HostBinding,
|
|
94
|
+
args: ['@fadeInOut']
|
|
95
|
+
}], mouseEnter: [{
|
|
96
|
+
type: HostListener,
|
|
97
|
+
args: ['mouseenter']
|
|
98
|
+
}], mouseLeave: [{
|
|
99
|
+
type: HostListener,
|
|
100
|
+
args: ['mouseleave']
|
|
101
|
+
}] } });
|
|
102
|
+
//# sourceMappingURL=tooltip.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.component.js","sourceRoot":"","sources":["../../../../../../src/modules/tooltip/components/tooltip/tooltip.component.ts","../../../../../../src/modules/tooltip/components/tooltip/tooltip.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAe,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACxI,OAAO,EAAC,UAAU,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;;;AAIpE;;GAEG;AAsBH,MAAM,OAAO,gBAAgB;IA6CzB,iEAAiE;IACjE,YAAsB,eAAkC,EAClC,QAAiC;QADjC,oBAAe,GAAf,eAAe,CAAmB;QAClC,aAAQ,GAAR,QAAQ,CAAyB;QA7CvD,sEAAsE;QAEtE;;WAEG;QACO,aAAQ,GAAe,GAAG,EAAE,CAAC,IAAI,CAAC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CACI,YAAY,CAAC,eAAe,EAAE,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAC,CAAC;6BAC/D,CAAC;4BACF,UAAU,CAAC,QAAQ,EACnB;gCACI,YAAY,CAAC,gBAAgB,EAAE,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAC,EAAC,CAAC;6BAChE,CAAC;yBACL,CAAC;qBACL,mBACgB,uBAAuB,CAAC,MAAM;iIA6CxC,SAAS;sBADf,WAAW;uBAAC,YAAY;gBA0ClB,UAAU;sBADhB,YAAY;uBAAC,YAAY;gBAWnB,UAAU;sBADhB,YAAY;uBAAC,YAAY","sourcesContent":["import {Component, ChangeDetectionStrategy, TemplateRef, ChangeDetectorRef, HostBinding, ElementRef, HostListener} from '@angular/core';\nimport {transition, trigger, useAnimation} from '@angular/animations';\nimport {fadeInAnimation, fadeOutAnimation} from '@anglr/animations';\n\nimport {TooltipRenderer} from '../../misc/tooltip.interface';\n\n/**\n * Component used for displaying tooltip content\n */\n@Component(\n{\n selector: 'tooltip-popup',\n templateUrl: 'tooltip.component.html',\n styleUrls: ['tooltip.component.css'],\n animations:\n [\n trigger('fadeInOut',\n [\n transition(':enter', \n [\n useAnimation(fadeInAnimation, {params: {duration: '260ms'}})\n ]),\n transition(':leave', \n [\n useAnimation(fadeOutAnimation, {params: {duration: '260ms'}})\n ])\n ])\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class TooltipComponent<TData = any> implements TooltipRenderer<TData>\n{\n //######################### protected fields #########################\n\n /**\n * Called when mouse enter tooltip component, hover\n */\n protected _enterFn: () => void = () => null;\n\n /**\n * Called when mouse leaves tooltip component\n */\n protected _leaveFn: () => void = () => null;\n\n //######################### public properties - implementation of TooltipRenderer #########################\n\n /**\n * Data that are rendered in tooltip\n */\n public data: TData|null|undefined;\n\n /**\n * Template used for rendering tooltip\n */\n public template: TemplateRef<TData>|null|undefined;\n\n /**\n * Indication whether are html tags allowed in tooltip text\n */\n public allowHtml: boolean = false;\n\n /**\n * Css class that is applied to tooltip renderer component\n */\n public cssClass: string|null|undefined;\n\n //######################### public properties - host #########################\n\n /**\n * Attach fade in/out animation to element\n * @internal\n */\n @HostBinding('@fadeInOut')\n public animation: boolean = true;\n\n //######################### constructor #########################\n constructor(protected _changeDetector: ChangeDetectorRef,\n protected _element: ElementRef<HTMLElement>)\n {\n }\n\n //######################### public methods - implementation of TooltipRenderer #########################\n\n /**\n * Registers handlers that allows reaction to entering or leaving tooltip\n * @param enter - Called when mouse enter tooltip component, hover\n * @param leave - Called when mouse leaves tooltip component\n */\n public registerHoverEvents(enter: () => void, leave: () => void): void\n {\n this._enterFn = enter;\n this._leaveFn = leave;\n }\n\n /**\n * Explicitly runs invalidation of content (change detection)\n */\n public invalidateVisuals(): void\n {\n if(this.cssClass)\n {\n this._element.nativeElement.classList.add(this.cssClass);\n }\n\n this._changeDetector.detectChanges();\n }\n\n //######################### public methods - host #########################\n\n /**\n * Handles mouse enter event over tooltip\n * @internal\n */\n @HostListener('mouseenter')\n public mouseEnter(): void\n {\n this._enterFn();\n }\n\n /**\n * Handles mouse leave event over tooltip\n * @internal\n */\n @HostListener('mouseleave')\n public mouseLeave(): void\n {\n this._leaveFn();\n }\n}","<div *ngIf=\"!template && !allowHtml\">{{data}}</div>\r\n<div *ngIf=\"!template && allowHtml\" [innerHTML]=\"data\"></div>\r\n\r\n<ng-template [ngIf]=\"template\">\r\n <ng-container *ngTemplateOutlet=\"template; context: {$implicit: data}\"></ng-container>\r\n</ng-template>"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/tooltip/directives/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6CAA6C,CAAC","sourcesContent":["export * from './tooltip/tooltip.directive';\nexport * from './tooltipTemplate/tooltipTemplate.directive';\n"]}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { ContentChild, Directive, ElementRef, HostListener, Inject, Injector, Input, Optional, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { DOCUMENT } from '@angular/common';
|
|
3
|
+
import { extend, isBlank, isPresent, nameof } from '@jscrpt/common';
|
|
4
|
+
import { TooltipComponent } from '../../components/tooltip/tooltip.component';
|
|
5
|
+
import { TOOLTIP_OPTIONS } from '../../misc/tokens';
|
|
6
|
+
import { applyPositionResult, PositionOffset, PositionPlacement } from '../../../../services/position';
|
|
7
|
+
import { TooltipTemplateDirective } from '../tooltipTemplate/tooltipTemplate.directive';
|
|
8
|
+
import { POSITION } from '../../../../types/tokens';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
/**
|
|
11
|
+
* Default options for tooltip
|
|
12
|
+
*/
|
|
13
|
+
const defaultOptions = {
|
|
14
|
+
delay: 200,
|
|
15
|
+
position: {
|
|
16
|
+
offset: PositionOffset.MouseEnter,
|
|
17
|
+
placement: PositionPlacement.TopStart
|
|
18
|
+
},
|
|
19
|
+
allowSelection: false,
|
|
20
|
+
tooltipRenderer: TooltipComponent,
|
|
21
|
+
tooltipCssClass: null,
|
|
22
|
+
stopPropagation: false
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Directive used for rendering tooltip
|
|
26
|
+
*/
|
|
27
|
+
export class TooltipDirective {
|
|
28
|
+
//######################### constructor #########################
|
|
29
|
+
constructor(_viewContainerRef, _injector, _element, _document, _position, options) {
|
|
30
|
+
this._viewContainerRef = _viewContainerRef;
|
|
31
|
+
this._injector = _injector;
|
|
32
|
+
this._element = _element;
|
|
33
|
+
this._document = _document;
|
|
34
|
+
this._position = _position;
|
|
35
|
+
/**
|
|
36
|
+
* Indication whether there is active show tooltip request
|
|
37
|
+
*/
|
|
38
|
+
this._showRequest = false;
|
|
39
|
+
/**
|
|
40
|
+
* Indication whether keep open tooltip component
|
|
41
|
+
*/
|
|
42
|
+
this._keepOpen = false;
|
|
43
|
+
/**
|
|
44
|
+
* Timeout that is used for handling mouse move
|
|
45
|
+
*/
|
|
46
|
+
this._timeout = null;
|
|
47
|
+
/**
|
|
48
|
+
* Indication whether are html tags allowed in tooltip text
|
|
49
|
+
*/
|
|
50
|
+
this.allowHtml = false;
|
|
51
|
+
this._options = extend(true, {}, defaultOptions, options);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Options used for displaying tooltip
|
|
55
|
+
*/
|
|
56
|
+
get tooltipOptions() {
|
|
57
|
+
return this._options;
|
|
58
|
+
}
|
|
59
|
+
set tooltipOptions(value) {
|
|
60
|
+
this._options = extend(true, {}, this._options, value);
|
|
61
|
+
}
|
|
62
|
+
//######################### public methods - implementation of OnChanges #########################
|
|
63
|
+
/**
|
|
64
|
+
* Called when input value changes
|
|
65
|
+
*/
|
|
66
|
+
ngOnChanges(changes) {
|
|
67
|
+
if (nameof('tooltipVisible') in changes) {
|
|
68
|
+
if (this.tooltipVisible) {
|
|
69
|
+
this._showTooltip();
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this._hideTooltip();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//######################### public methods - implementation of OnDestroy #########################
|
|
77
|
+
/**
|
|
78
|
+
* Called when component is destroyed
|
|
79
|
+
*/
|
|
80
|
+
ngOnDestroy() {
|
|
81
|
+
this._destroyTooltip();
|
|
82
|
+
}
|
|
83
|
+
//######################### public methods - host #########################
|
|
84
|
+
/**
|
|
85
|
+
* Handles mouse leave event, hover ends
|
|
86
|
+
* @param event - Mouse event that occured
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
mouseLeave(event) {
|
|
90
|
+
if (this._options.stopPropagation) {
|
|
91
|
+
event.stopPropagation();
|
|
92
|
+
}
|
|
93
|
+
if (isBlank(this.tooltipVisible)) {
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
if (!this._keepOpen) {
|
|
96
|
+
this._showRequest = false;
|
|
97
|
+
this._hideTooltip();
|
|
98
|
+
}
|
|
99
|
+
}, 10);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Handles mouse move event, displaying tooltip
|
|
104
|
+
* @param event - Mouse event that occured
|
|
105
|
+
* @internal
|
|
106
|
+
*/
|
|
107
|
+
mouseMove(event) {
|
|
108
|
+
if (this._options.stopPropagation) {
|
|
109
|
+
event.stopPropagation();
|
|
110
|
+
}
|
|
111
|
+
this._showRequest = true;
|
|
112
|
+
//do nothing if tooltip is visible
|
|
113
|
+
if (this._tooltipComponent || isPresent(this.tooltipVisible)) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (isPresent(this._timeout)) {
|
|
117
|
+
clearTimeout(this._timeout);
|
|
118
|
+
}
|
|
119
|
+
this._timeout = setTimeout(() => {
|
|
120
|
+
this._timeout = null;
|
|
121
|
+
if (this._showRequest) {
|
|
122
|
+
this._showTooltip(event);
|
|
123
|
+
this._showRequest = false;
|
|
124
|
+
}
|
|
125
|
+
}, this._options.delay);
|
|
126
|
+
}
|
|
127
|
+
//######################### protected methods #########################
|
|
128
|
+
/**
|
|
129
|
+
* Shows tooltip
|
|
130
|
+
* @param event - Mouse event
|
|
131
|
+
*/
|
|
132
|
+
_showTooltip(event) {
|
|
133
|
+
this._createTooltip();
|
|
134
|
+
//if element was not created do nothing
|
|
135
|
+
if (!this._tooltipElement) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
this._showData();
|
|
139
|
+
this._position.placeElement(this._tooltipElement, this._element.nativeElement, {
|
|
140
|
+
placement: this._options.position.placement,
|
|
141
|
+
offset: this._options.position.offset,
|
|
142
|
+
flip: true,
|
|
143
|
+
mouseEvent: event,
|
|
144
|
+
autoUpdate: false
|
|
145
|
+
})
|
|
146
|
+
.toPromise()
|
|
147
|
+
.then(result => applyPositionResult(result));
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Hides tooltip
|
|
151
|
+
*/
|
|
152
|
+
_hideTooltip() {
|
|
153
|
+
this._destroyTooltip();
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Destroys tooltip component
|
|
157
|
+
*/
|
|
158
|
+
_destroyTooltip() {
|
|
159
|
+
if (this._tooltipComponent) {
|
|
160
|
+
this._tooltipComponent.destroy();
|
|
161
|
+
this._tooltipComponent = undefined;
|
|
162
|
+
this._tooltipElement = undefined;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Creates tooltip renderer component
|
|
167
|
+
*/
|
|
168
|
+
_createTooltip() {
|
|
169
|
+
// 0. Destroys tooltip if it exists
|
|
170
|
+
this._destroyTooltip();
|
|
171
|
+
// 1. Create a component reference from the component
|
|
172
|
+
this._tooltipComponent = this._viewContainerRef
|
|
173
|
+
.createComponent(this._options.tooltipRenderer, {
|
|
174
|
+
injector: this._injector
|
|
175
|
+
});
|
|
176
|
+
// 3. Get DOM element from component
|
|
177
|
+
this._tooltipElement = this._tooltipComponent.hostView
|
|
178
|
+
.rootNodes[0];
|
|
179
|
+
// 4. Append DOM element to the body
|
|
180
|
+
this._document.body.appendChild(this._tooltipElement);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Sets data to tooltip component and shows them
|
|
184
|
+
*/
|
|
185
|
+
_showData() {
|
|
186
|
+
var _a, _b;
|
|
187
|
+
if (this._tooltipComponent) {
|
|
188
|
+
this._tooltipComponent.instance.allowHtml = this.allowHtml;
|
|
189
|
+
this._tooltipComponent.instance.data = this.tooltip;
|
|
190
|
+
this._tooltipComponent.instance.template = (_a = this.tooltipTemplate) !== null && _a !== void 0 ? _a : (_b = this.tooltipTemplateChild) === null || _b === void 0 ? void 0 : _b.template;
|
|
191
|
+
this._tooltipComponent.instance.cssClass = this._options.tooltipCssClass;
|
|
192
|
+
this._tooltipComponent.instance.registerHoverEvents(() => {
|
|
193
|
+
if (this._options.allowSelection) {
|
|
194
|
+
this._keepOpen = true;
|
|
195
|
+
this._showRequest = false;
|
|
196
|
+
}
|
|
197
|
+
}, () => {
|
|
198
|
+
setTimeout(() => {
|
|
199
|
+
this._keepOpen = false;
|
|
200
|
+
if (!this._showRequest) {
|
|
201
|
+
this._hideTooltip();
|
|
202
|
+
}
|
|
203
|
+
this._showRequest = false;
|
|
204
|
+
}, 5);
|
|
205
|
+
});
|
|
206
|
+
this._tooltipComponent.instance.invalidateVisuals();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
TooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TooltipDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Injector }, { token: i0.ElementRef }, { token: DOCUMENT }, { token: POSITION }, { token: TOOLTIP_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
211
|
+
TooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.2", type: TooltipDirective, selector: "[tooltip]", inputs: { tooltip: "tooltip", allowHtml: "allowHtml", tooltipTemplate: "tooltipTemplate", tooltipOptions: "tooltipOptions", tooltipVisible: "tooltipVisible" }, host: { listeners: { "mouseleave": "mouseLeave($event)", "mousemove": "mouseMove($event)" } }, queries: [{ propertyName: "tooltipTemplateChild", first: true, predicate: TooltipTemplateDirective, descendants: true }], usesOnChanges: true, ngImport: i0 });
|
|
212
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TooltipDirective, decorators: [{
|
|
213
|
+
type: Directive,
|
|
214
|
+
args: [{
|
|
215
|
+
selector: '[tooltip]'
|
|
216
|
+
}]
|
|
217
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Injector }, { type: i0.ElementRef }, { type: Document, decorators: [{
|
|
218
|
+
type: Inject,
|
|
219
|
+
args: [DOCUMENT]
|
|
220
|
+
}] }, { type: undefined, decorators: [{
|
|
221
|
+
type: Inject,
|
|
222
|
+
args: [POSITION]
|
|
223
|
+
}] }, { type: undefined, decorators: [{
|
|
224
|
+
type: Optional
|
|
225
|
+
}, {
|
|
226
|
+
type: Inject,
|
|
227
|
+
args: [TOOLTIP_OPTIONS]
|
|
228
|
+
}] }]; }, propDecorators: { tooltip: [{
|
|
229
|
+
type: Input
|
|
230
|
+
}], allowHtml: [{
|
|
231
|
+
type: Input
|
|
232
|
+
}], tooltipTemplate: [{
|
|
233
|
+
type: Input
|
|
234
|
+
}], tooltipOptions: [{
|
|
235
|
+
type: Input
|
|
236
|
+
}], tooltipVisible: [{
|
|
237
|
+
type: Input
|
|
238
|
+
}], tooltipTemplateChild: [{
|
|
239
|
+
type: ContentChild,
|
|
240
|
+
args: [TooltipTemplateDirective]
|
|
241
|
+
}], mouseLeave: [{
|
|
242
|
+
type: HostListener,
|
|
243
|
+
args: ['mouseleave', ['$event']]
|
|
244
|
+
}], mouseMove: [{
|
|
245
|
+
type: HostListener,
|
|
246
|
+
args: ['mousemove', ['$event']]
|
|
247
|
+
}] } });
|
|
248
|
+
//# sourceMappingURL=tooltip.directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/tooltip/directives/tooltip/tooltip.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAE,SAAS,EAAE,UAAU,EAAmB,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAwB,QAAQ,EAAiB,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACtN,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAE5E,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AA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IAAI,CAAC,YAAY,EACrB;wBACI,IAAI,CAAC,YAAY,EAAE,CAAC;qBACvB;oBAED,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;gBAC9B,CAAC,EAAE,CAAC,CAAC,CAAC;YACV,CAAC,CAAC,CAAC;YAEvD,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;SACvD;IACL,CAAC;;6GA7SQ,gBAAgB,oGAqFL,QAAQ,aACR,QAAQ,aACI,eAAe;iGAvFtC,gBAAgB,kWA8EX,wBAAwB;2FA9E7B,gBAAgB;kBAJ5B,SAAS;mBACV;oBACI,QAAQ,EAAE,WAAW;iBACxB;yIAsFsD,QAAQ;0BAA9C,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,QAAQ;;0BACf,QAAQ;;0BAAI,MAAM;2BAAC,eAAe;4CA/CxC,OAAO;sBADb,KAAK;gBAOC,SAAS;sBADf,KAAK;gBAOC,eAAe;sBADrB,KAAK;gBAOK,cAAc;sBADxB,KAAK;gBAcC,cAAc;sBADpB,KAAK;gBASC,oBAAoB;sBAD1B,YAAY;uBAAC,wBAAwB;gBAoD/B,UAAU;sBADhB,YAAY;uBAAC,YAAY,EAAE,CAAC,QAAQ,CAAC;gBA2B/B,SAAS;sBADf,YAAY;uBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC","sourcesContent":["import {ComponentRef, ContentChild, Directive, ElementRef, EmbeddedViewRef, HostListener, Inject, Injector, Input, OnChanges, OnDestroy, Optional, SimpleChanges, TemplateRef, ViewContainerRef} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {extend, isBlank, isPresent, nameof} from '@jscrpt/common';\n\nimport {TooltipComponent} from '../../components/tooltip/tooltip.component';\nimport {TooltipOptions, TooltipRenderer} from '../../misc/tooltip.interface';\nimport {TOOLTIP_OPTIONS} from '../../misc/tokens';\nimport {applyPositionResult, Position, PositionOffset, PositionPlacement} from '../../../../services/position';\nimport {TooltipTemplateDirective} from '../tooltipTemplate/tooltipTemplate.directive';\nimport {POSITION} from '../../../../types/tokens';\n\n/**\n * Default options for tooltip\n */\nconst defaultOptions: TooltipOptions =\n{\n delay: 200,\n position:\n {\n offset: PositionOffset.MouseEnter,\n placement: PositionPlacement.TopStart\n },\n allowSelection: false,\n tooltipRenderer: TooltipComponent,\n tooltipCssClass: null,\n stopPropagation: false\n};\n\n/**\n * Directive used for rendering tooltip\n */\n@Directive(\n{\n selector: '[tooltip]'\n})\nexport class TooltipDirective<TData = any> implements OnChanges, OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Instance of component used for rendering tooltip\n */\n protected _tooltipComponent?: ComponentRef<TooltipRenderer<TData>>;\n\n /**\n * Instance of HTML element for tooltip renderer\n */\n protected _tooltipElement?: HTMLElement;\n\n /**\n * Instance of options provided for this tooltip\n */\n protected _options: TooltipOptions;\n\n /**\n * Indication whether there is active show tooltip request\n */\n protected _showRequest: boolean = false;\n\n /**\n * Indication whether keep open tooltip component\n */\n protected _keepOpen: boolean = false;\n\n /**\n * Timeout that is used for handling mouse move\n */\n protected _timeout: number|null = null;\n\n //######################### public properties - inputs #########################\n\n /**\n * Tooltip text that is displayed, or any data that could be passed to template\n */\n @Input()\n public tooltip?: TData;\n\n /**\n * Indication whether are html tags allowed in tooltip text\n */\n @Input()\n public allowHtml: boolean = false;\n\n /**\n * Instance of tooltip template that is used for rendering\n */\n @Input()\n public tooltipTemplate?: TemplateRef<TData>;\n\n /**\n * Options used for displaying tooltip\n */\n @Input()\n public get tooltipOptions(): Partial<TooltipOptions>\n {\n return this._options;\n }\n public set tooltipOptions(value: Partial<TooltipOptions>)\n {\n this._options = extend(true, {}, this._options, value);\n }\n\n /**\n * Gets or sets indication whether is tooltip visible, if has boolean value, mouse events cant override this\n */\n @Input()\n public tooltipVisible?: boolean;\n\n //######################### public properties - children #########################\n\n /**\n * Instance of template from element content, used for rendering\n */\n @ContentChild(TooltipTemplateDirective)\n public tooltipTemplateChild?: TooltipTemplateDirective;\n\n //######################### constructor #########################\n constructor(protected _viewContainerRef: ViewContainerRef,\n protected _injector: Injector,\n protected _element: ElementRef<HTMLElement>,\n @Inject(DOCUMENT) protected _document: Document,\n @Inject(POSITION) protected _position: Position,\n @Optional() @Inject(TOOLTIP_OPTIONS) options?: Partial<TooltipOptions>)\n {\n this._options = extend(true, {}, defaultOptions, options);\n }\n\n //######################### public methods - implementation of OnChanges #########################\n\n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<TooltipDirective>('tooltipVisible') in changes)\n {\n if(this.tooltipVisible)\n {\n this._showTooltip();\n }\n else\n {\n this._hideTooltip();\n }\n }\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this._destroyTooltip();\n }\n\n //######################### public methods - host #########################\n\n /**\n * Handles mouse leave event, hover ends\n * @param event - Mouse event that occured\n * @internal\n */\n @HostListener('mouseleave', ['$event'])\n public mouseLeave(event: MouseEvent): void\n {\n if(this._options.stopPropagation)\n {\n event.stopPropagation();\n }\n\n if(isBlank(this.tooltipVisible))\n {\n setTimeout(() =>\n {\n if(!this._keepOpen)\n {\n this._showRequest = false;\n this._hideTooltip();\n }\n }, 10);\n }\n }\n\n /**\n * Handles mouse move event, displaying tooltip\n * @param event - Mouse event that occured\n * @internal\n */\n @HostListener('mousemove', ['$event'])\n public mouseMove(event: MouseEvent): void\n {\n if(this._options.stopPropagation)\n {\n event.stopPropagation();\n }\n\n this._showRequest = true;\n\n //do nothing if tooltip is visible\n if(this._tooltipComponent || isPresent(this.tooltipVisible))\n {\n return;\n }\n\n if(isPresent(this._timeout))\n {\n clearTimeout(this._timeout);\n }\n\n this._timeout = setTimeout(() =>\n {\n this._timeout = null;\n\n if(this._showRequest)\n {\n this._showTooltip(event);\n\n this._showRequest = false;\n }\n }, this._options.delay) as any;\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows tooltip\n * @param event - Mouse event\n */\n protected _showTooltip(event?: MouseEvent): void\n {\n this._createTooltip();\n\n //if element was not created do nothing\n if(!this._tooltipElement)\n {\n return;\n }\n\n this._showData();\n\n this._position.placeElement(this._tooltipElement,\n this._element.nativeElement,\n {\n placement: this._options.position.placement,\n offset: this._options.position.offset,\n flip: true,\n mouseEvent: event,\n autoUpdate: false\n })\n .toPromise()\n .then(result => applyPositionResult(result));\n }\n\n /**\n * Hides tooltip\n */\n protected _hideTooltip(): void\n {\n this._destroyTooltip();\n }\n\n /**\n * Destroys tooltip component\n */\n protected _destroyTooltip(): void\n {\n if(this._tooltipComponent)\n {\n this._tooltipComponent.destroy();\n this._tooltipComponent = undefined;\n this._tooltipElement = undefined;\n }\n }\n\n /**\n * Creates tooltip renderer component\n */\n protected _createTooltip(): void\n {\n // 0. Destroys tooltip if it exists\n this._destroyTooltip();\n\n // 1. Create a component reference from the component\n this._tooltipComponent = this._viewContainerRef\n .createComponent(this._options.tooltipRenderer,\n {\n injector: this._injector\n });\n\n // 3. Get DOM element from component\n this._tooltipElement = (this._tooltipComponent.hostView as EmbeddedViewRef<any>)\n .rootNodes[0] as HTMLElement;\n\n // 4. Append DOM element to the body\n this._document.body.appendChild(this._tooltipElement);\n }\n\n /**\n * Sets data to tooltip component and shows them\n */\n protected _showData(): void\n {\n if(this._tooltipComponent)\n {\n this._tooltipComponent.instance.allowHtml = this.allowHtml;\n this._tooltipComponent.instance.data = this.tooltip;\n this._tooltipComponent.instance.template = this.tooltipTemplate ?? this.tooltipTemplateChild?.template;\n this._tooltipComponent.instance.cssClass = this._options.tooltipCssClass;\n\n this._tooltipComponent.instance.registerHoverEvents(() =>\n {\n if(this._options.allowSelection)\n {\n this._keepOpen = true;\n this._showRequest = false;\n }\n },\n () =>\n {\n setTimeout(() =>\n {\n this._keepOpen = false;\n\n if(!this._showRequest)\n {\n this._hideTooltip();\n }\n\n this._showRequest = false;\n }, 5);\n });\n\n this._tooltipComponent.instance.invalidateVisuals();\n }\n }\n\n //######################### ng language server #########################\n \n /**\n * Custom input type for `tooltip` input\n */\n public static ngAcceptInputType_tooltip: any;\n}"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Directive, TemplateRef } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Directive used for obtaining custom tooltip template
|
|
5
|
+
*/
|
|
6
|
+
export class TooltipTemplateDirective {
|
|
7
|
+
//######################### constructor #########################
|
|
8
|
+
constructor(template) {
|
|
9
|
+
this.template = template;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
TooltipTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TooltipTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
13
|
+
TooltipTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.2", type: TooltipTemplateDirective, selector: "[tooltipTemplate]", ngImport: i0 });
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TooltipTemplateDirective, decorators: [{
|
|
15
|
+
type: Directive,
|
|
16
|
+
args: [{
|
|
17
|
+
selector: '[tooltipTemplate]'
|
|
18
|
+
}]
|
|
19
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
20
|
+
//# sourceMappingURL=tooltipTemplate.directive.js.map
|
package/es2015/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltipTemplate.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;;AAErD;;GAEG;AAKH,MAAM,OAAO,wBAAwB;IAEjC,iEAAiE;IACjE,YAAmB,QAA4B;QAA5B,aAAQ,GAAR,QAAQ,CAAoB;IAE/C,CAAC;;qHALQ,wBAAwB;yGAAxB,wBAAwB;2FAAxB,wBAAwB;kBAJpC,SAAS;mBACV;oBACI,QAAQ,EAAE,mBAAmB;iBAChC","sourcesContent":["import {Directive, TemplateRef} from '@angular/core';\n\n/**\n * Directive used for obtaining custom tooltip template\n */\n@Directive(\n{\n selector: '[tooltipTemplate]'\n})\nexport class TooltipTemplateDirective<TData = any>\n{\n //######################### constructor #########################\n constructor(public template: TemplateRef<TData>)\n {\n }\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/tooltip/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './components';\nexport * from './directives';\nexport * from './modules';\nexport * from './misc/tokens';\nexport * from './misc/tooltip.interface';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../../src/modules/tooltip/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAI7C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA4C,IAAI,cAAc,CAA0B,iBAAiB,CAAC,CAAC","sourcesContent":["import {InjectionToken} from '@angular/core';\n\nimport {TooltipOptions} from './tooltip.interface';\n\n/**\n * Injection token used for injecting tooltip options\n */\nexport const TOOLTIP_OPTIONS: InjectionToken<Partial<TooltipOptions>> = new InjectionToken<Partial<TooltipOptions>>('TOOLTIP_OPTIONS');\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.interface.js","sourceRoot":"","sources":["../../../../../src/modules/tooltip/misc/tooltip.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {TemplateRef, Type} from '@angular/core';\n\nimport {PositionOptions} from '../../../services/position';\n\n/**\n * Represents component that is used for rendering tooltip\n */\nexport interface TooltipRenderer<TData = any>\n{\n //######################### properties #########################\n\n /**\n * Data that are rendered in tooltip\n */\n data: TData|null|undefined;\n\n /**\n * Template used for rendering tooltip\n */\n template: TemplateRef<TData>|null|undefined;\n\n /**\n * Indication whether are html tags allowed in tooltip text\n */\n allowHtml: boolean;\n\n /**\n * Css class that is applied to tooltip renderer component\n */\n cssClass: string|null|undefined;\n\n //######################### methods #########################\n\n /**\n * Registers handlers that allows reaction to entering or leaving tooltip\n * @param enter - Called when mouse enter tooltip component, hover\n * @param leave - Called when mouse leaves tooltip component\n */\n registerHoverEvents(enter: () => void, leave: () => void): void;\n\n /**\n * Explicitly runs invalidation of content (change detection)\n */\n invalidateVisuals(): void;\n}\n\n/**\n * Options used for tooltip directive\n */\nexport interface TooltipOptions\n{\n /**\n * Delay for displaying of tooltip on hover\n */\n delay: number;\n\n /**\n * Position where should tooltip appear relative to its parent\n */\n position: Pick<PositionOptions, 'placement'|'offset'>;\n\n /**\n * Allows selection of text in tooltip\n */\n allowSelection: boolean|null;\n\n /**\n * Css class that is applied to tooltip renderer component\n */\n tooltipCssClass: string|null;\n\n /**\n * Indication whether stop propagation of \"hover\" event\n */\n stopPropagation: boolean|null;\n\n /**\n * Type of tooltip renderer that is used for rendering tooltip\n */\n tooltipRenderer: Type<TooltipRenderer>;\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/tooltip/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './tooltip.module';\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { TooltipDirective, TooltipTemplateDirective } from '../directives';
|
|
4
|
+
import { TooltipComponent } from '../components';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* Module for rendering tooltips
|
|
8
|
+
*/
|
|
9
|
+
export class TooltipModule {
|
|
10
|
+
}
|
|
11
|
+
TooltipModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TooltipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
12
|
+
TooltipModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TooltipModule, declarations: [TooltipDirective,
|
|
13
|
+
TooltipTemplateDirective,
|
|
14
|
+
TooltipComponent], imports: [CommonModule], exports: [TooltipDirective,
|
|
15
|
+
TooltipTemplateDirective] });
|
|
16
|
+
TooltipModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TooltipModule, imports: [[
|
|
17
|
+
CommonModule
|
|
18
|
+
]] });
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TooltipModule, decorators: [{
|
|
20
|
+
type: NgModule,
|
|
21
|
+
args: [{
|
|
22
|
+
imports: [
|
|
23
|
+
CommonModule
|
|
24
|
+
],
|
|
25
|
+
declarations: [
|
|
26
|
+
TooltipDirective,
|
|
27
|
+
TooltipTemplateDirective,
|
|
28
|
+
TooltipComponent,
|
|
29
|
+
],
|
|
30
|
+
exports: [
|
|
31
|
+
TooltipDirective,
|
|
32
|
+
TooltipTemplateDirective,
|
|
33
|
+
]
|
|
34
|
+
}]
|
|
35
|
+
}] });
|
|
36
|
+
//# sourceMappingURL=tooltip.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.module.js","sourceRoot":"","sources":["../../../../../src/modules/tooltip/modules/tooltip.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAC,gBAAgB,EAAE,wBAAwB,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;;AAE/C;;GAEG;AAmBH,MAAM,OAAO,aAAa;;0GAAb,aAAa;2GAAb,aAAa,iBAVlB,gBAAgB;QAChB,wBAAwB;QACxB,gBAAgB,aANhB,YAAY,aAUZ,gBAAgB;QAChB,wBAAwB;2GAGnB,aAAa,YAftB;YACI,YAAY;SACf;2FAaQ,aAAa;kBAlBzB,QAAQ;mBACT;oBACI,OAAO,EACP;wBACI,YAAY;qBACf;oBACD,YAAY,EACZ;wBACI,gBAAgB;wBAChB,wBAAwB;wBACxB,gBAAgB;qBACnB;oBACD,OAAO,EACP;wBACI,gBAAgB;wBAChB,wBAAwB;qBAC3B;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\nimport {CommonModule} from '@angular/common';\n\nimport {TooltipDirective, TooltipTemplateDirective} from '../directives';\nimport {TooltipComponent} from '../components';\n\n/**\n * Module for rendering tooltips\n */\n@NgModule(\n{\n imports:\n [\n CommonModule\n ],\n declarations:\n [\n TooltipDirective,\n TooltipTemplateDirective,\n TooltipComponent,\n ],\n exports:\n [\n TooltipDirective,\n TooltipTemplateDirective,\n ]\n})\nexport class TooltipModule\n{\n}\n"]}
|
package/es2020/src/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export { MultiButtonModule } from './modules/multiButton/modules/multiButton.mod
|
|
|
18
18
|
export * from './modules/goBack';
|
|
19
19
|
export * from './modules/position';
|
|
20
20
|
export * from './modules/castPipes';
|
|
21
|
+
export * from './modules/tooltip';
|
|
21
22
|
export * from './types/tokens';
|
|
22
23
|
export * from './utils';
|
|
23
24
|
export * from './pipes';
|