@anglr/common 16.0.0-beta.20230208083032 → 16.0.0-beta.20230208085018

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 16.0.0 (2023-10-26)
4
+
5
+ ### Bug Fixes
6
+
7
+ - fixed `BodyRenderSADirective` now correctly works rendering into container element
8
+
9
+ ### Features
10
+
11
+ - updated `TooltipDirective` directive
12
+ - now supports rendering into container
13
+ - new **inputs**
14
+ - `containerElement` string that defines element in which should be tooltip rendered, if not specified, body is used
15
+ - updated `TooltipOptions` interface
16
+ - new **properties**
17
+ - `containerElement` string that defines element in which should be tooltip rendered, if not specified, body is used
18
+
19
+ ### BREAKING CHANGES
20
+
21
+ - minimal supported version of `@jscrpt/common` is `3.4.0`
3
22
 
4
23
  ## Version 15.0.1 (2022-10-26)
5
24
 
@@ -1,5 +1,6 @@
1
1
  import { Directive, Inject, Input, TemplateRef, ViewContainerRef } from '@angular/core';
2
2
  import { DOCUMENT } from '@angular/common';
3
+ import { renderToBody } from '@jscrpt/common';
3
4
  import * as i0 from "@angular/core";
4
5
  /**
5
6
  * Renders element into body directly at the end
@@ -19,22 +20,7 @@ export class BodyRenderSADirective {
19
20
  this.view = this.viewContainer
20
21
  .createEmbeddedView(this.template);
21
22
  this.element = this.view.rootNodes[0];
22
- //render to specified target element
23
- if (this.targetElement) {
24
- let element = this.document.querySelector(`body${this.targetElement}`);
25
- if (!element) {
26
- const [name, css] = this.targetElement.split('.');
27
- element = this.document.createElement(name);
28
- if (css) {
29
- element.classList.add(css);
30
- }
31
- }
32
- element.appendChild(this.element);
33
- }
34
- //render directly to body
35
- else {
36
- this.document.body.appendChild(this.element);
37
- }
23
+ renderToBody(this.document, this.element, this.targetElement);
38
24
  }
39
25
  //######################### public methods - implementation of OnDestroy #########################
40
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"bodyRender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AAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAChD;IACL,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;;QAEd,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;;kHAhFQ,qBAAqB,6EA2BV,QAAQ;sGA3BnB,qBAAqB;2FAArB,qBAAqB;kBALjC,SAAS;mBACV;oBACI,QAAQ,EAAE,cAAc;oBACxB,UAAU,EAAE,IAAI;iBACnB;;0BA4BgB,MAAM;2BAAC,QAAQ;4CALrB,aAAa;sBADnB,KAAK;uBAAC,YAAY","sourcesContent":["import {Directive, EmbeddedViewRef, Inject, Input, OnDestroy, OnInit, TemplateRef, ViewContainerRef} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\n\n/**\n * Renders element into body directly at the end\n */\n@Directive(\n{\n selector: '[bodyRender]',\n standalone: true\n})\nexport class BodyRenderSADirective implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Instance of created embedded view\n */\n protected view: EmbeddedViewRef<void>|undefined|null;\n\n /**\n * Instance of created element\n */\n protected element: HTMLElement|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * String that defines element in which should be template rendered, if not specified, body is used\n * \n * Allows also css class to be specified (div.body-box)\n */\n @Input('bodyRender')\n public targetElement: string|undefined|null;\n\n //######################### constructor #########################\n constructor(protected template: TemplateRef<void>,\n protected viewContainer: ViewContainerRef,\n @Inject(DOCUMENT) protected document: Document,)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.view = this.viewContainer\n .createEmbeddedView(this.template);\n\n this.element = this.view.rootNodes[0] as HTMLElement;\n\n //render to specified target element\n if(this.targetElement)\n {\n let element = this.document.querySelector(`body${this.targetElement}`);\n\n if(!element)\n {\n const [name, css] = this.targetElement.split('.');\n\n element = this.document.createElement(name);\n\n if(css)\n {\n element.classList.add(css);\n }\n }\n\n element.appendChild(this.element);\n }\n //render directly to body\n else\n {\n this.document.body.appendChild(this.element);\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.element?.remove();\n this.element = null;\n this.view?.destroy();\n this.view = null;\n }\n}"]}
1
+ {"version":3,"file":"bodyRender.directive.js","sourceRoot":"","sources":["../../../../src/directives/bodyRender/bodyRender.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAmB,MAAM,EAAE,KAAK,EAAqB,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC1H,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;;AAE5C;;GAEG;AAMH,MAAM,OAAO,qBAAqB;IAwB9B,iEAAiE;IACjE,YAAsB,QAA2B,EAC3B,aAA+B,EACb,QAAkB;QAFpC,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,kBAAa,GAAb,aAAa,CAAkB;QACb,aAAQ,GAAR,QAAQ,CAAU;IAE1D,CAAC;IAED,+FAA+F;IAE/F;;OAEG;IACI,QAAQ;QAEX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,aAAa;aACzB,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEvC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAgB,CAAC;QAErD,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAClE,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;;QAEd,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;;kHAzDQ,qBAAqB,6EA2BV,QAAQ;sGA3BnB,qBAAqB;2FAArB,qBAAqB;kBALjC,SAAS;mBACV;oBACI,QAAQ,EAAE,cAAc;oBACxB,UAAU,EAAE,IAAI;iBACnB;;0BA4BgB,MAAM;2BAAC,QAAQ;4CALrB,aAAa;sBADnB,KAAK;uBAAC,YAAY","sourcesContent":["import {Directive, EmbeddedViewRef, Inject, Input, OnDestroy, OnInit, TemplateRef, ViewContainerRef} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {renderToBody} from '@jscrpt/common';\n\n/**\n * Renders element into body directly at the end\n */\n@Directive(\n{\n selector: '[bodyRender]',\n standalone: true\n})\nexport class BodyRenderSADirective implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Instance of created embedded view\n */\n protected view: EmbeddedViewRef<void>|undefined|null;\n\n /**\n * Instance of created element\n */\n protected element: HTMLElement|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * String that defines element in which should be template rendered, if not specified, body is used\n * \n * Allows also css class to be specified (div.body-box)\n */\n @Input('bodyRender')\n public targetElement: string|undefined|null;\n\n //######################### constructor #########################\n constructor(protected template: TemplateRef<void>,\n protected viewContainer: ViewContainerRef,\n @Inject(DOCUMENT) protected document: Document,)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.view = this.viewContainer\n .createEmbeddedView(this.template);\n\n this.element = this.view.rootNodes[0] as HTMLElement;\n\n renderToBody(this.document, this.element, this.targetElement);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.element?.remove();\n this.element = null;\n this.view?.destroy();\n this.view = null;\n }\n}"]}
@@ -2,7 +2,7 @@ import { ContentChild, Directive, ElementRef, HostListener, Inject, Injector, In
2
2
  import { AnimationBuilder } from '@angular/animations';
3
3
  import { DOCUMENT } from '@angular/common';
4
4
  import { fadeInAnimation, fadeOutAnimation } from '@anglr/animations';
5
- import { extend, isBlank, isPresent, nameof } from '@jscrpt/common';
5
+ import { extend, isBlank, isPresent, nameof, renderToBody } from '@jscrpt/common';
6
6
  import { lastValueFrom } from 'rxjs';
7
7
  import { TooltipComponent } from '../../components/tooltip/tooltip.component';
8
8
  import { TOOLTIP_OPTIONS } from '../../misc/tokens';
@@ -26,6 +26,7 @@ const defaultOptions = {
26
26
  stopPropagation: false,
27
27
  enterAnimation: fadeInAnimation,
28
28
  exitAnimation: fadeOutAnimation,
29
+ containerElement: undefined,
29
30
  };
30
31
  /**
31
32
  * Directive used for rendering tooltip
@@ -58,6 +59,9 @@ export class TooltipDirective {
58
59
  this._options = extend(true, {}, defaultOptions, options);
59
60
  this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);
60
61
  this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);
62
+ if (this._options.containerElement) {
63
+ this.containerElement = this._options.containerElement;
64
+ }
61
65
  }
62
66
  /**
63
67
  * Options used for displaying tooltip
@@ -69,6 +73,9 @@ export class TooltipDirective {
69
73
  this._options = extend(true, {}, this._options, value);
70
74
  this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);
71
75
  this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);
76
+ if (this._options.containerElement && !this.containerElement) {
77
+ this.containerElement = this._options.containerElement;
78
+ }
72
79
  }
73
80
  //######################### public methods - implementation of OnChanges #########################
74
81
  /**
@@ -197,7 +204,7 @@ export class TooltipDirective {
197
204
  this._tooltipElement = this._tooltipComponent.hostView
198
205
  .rootNodes[0];
199
206
  // 4. Append DOM element to the body
200
- this._document.body.appendChild(this._tooltipElement);
207
+ renderToBody(this._document, this._tooltipElement, this.containerElement);
201
208
  this._enterAnimation.create(this._tooltipElement).play();
202
209
  }
203
210
  /**
@@ -229,7 +236,7 @@ export class TooltipDirective {
229
236
  }
230
237
  }
231
238
  TooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: TooltipDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Injector }, { token: i0.ElementRef }, { token: i1.AnimationBuilder }, { token: DOCUMENT }, { token: POSITION }, { token: TOOLTIP_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
232
- TooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: TooltipDirective, selector: "[tooltip]", inputs: { tooltip: "tooltip", allowHtml: "allowHtml", template: "template", 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 });
239
+ TooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: TooltipDirective, selector: "[tooltip]", inputs: { tooltip: "tooltip", allowHtml: "allowHtml", template: "template", tooltipOptions: "tooltipOptions", tooltipVisible: "tooltipVisible", containerElement: "containerElement" }, host: { listeners: { "mouseleave": "mouseLeave($event)", "mousemove": "mouseMove($event)" } }, queries: [{ propertyName: "tooltipTemplateChild", first: true, predicate: TooltipTemplateDirective, descendants: true }], usesOnChanges: true, ngImport: i0 });
233
240
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: TooltipDirective, decorators: [{
234
241
  type: Directive,
235
242
  args: [{
@@ -256,6 +263,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImpor
256
263
  type: Input
257
264
  }], tooltipVisible: [{
258
265
  type: Input
266
+ }], containerElement: [{
267
+ type: Input
259
268
  }], tooltipTemplateChild: [{
260
269
  type: ContentChild,
261
270
  args: [TooltipTemplateDirective]
@@ -1 +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,gBAAgB,EAAmB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAC,aAAa,EAAC,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAE5E,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,mBAAmB,EAAkD,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AACrI,OAAO,EAAC,wBAAwB,EAAC,MAAM,8CAA8C,CAAC;AAEtF,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;;;AAElD;;GAEG;AACH,MAAM,cAAc,GACpB;IACI,KAAK,EAAE,GAAG;IACV,QAAQ,EACR;QACI,MAAM,EAAE,MAAM,CAAwB,YAAY,CAAyB;QAC3E,SAAS,EAAE,iBAAiB,CAAC,QAAQ;KACxC;IACD,cAAc,EAAE,KAAK;IACrB,eAAe,EAAE,gBAA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;gBAOC,QAAQ;sBADd,KAAK;gBAOK,cAAc;sBADxB,KAAK;gBAiBC,cAAc;sBADpB,KAAK;gBASC,oBAAoB;sBAD1B,YAAY;uBAAC,wBAAwB;gBA6D/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 {AnimationBuilder, AnimationFactory} from '@angular/animations';\nimport {DOCUMENT} from '@angular/common';\nimport {fadeInAnimation, fadeOutAnimation} from '@anglr/animations';\nimport {extend, isBlank, isPresent, nameof} from '@jscrpt/common';\nimport {lastValueFrom} from 'rxjs';\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, PositionOffsetString, PositionPlacement} from '../../../../services/position';\nimport {TooltipTemplateDirective} from '../tooltipTemplate/tooltipTemplate.directive';\nimport {TooltipTemplateContext} from '../tooltipTemplate/tooltipTemplate.context';\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: nameof<typeof PositionOffset>('MouseEnter') as PositionOffsetString,\n placement: PositionPlacement.TopStart,\n },\n allowSelection: false,\n tooltipRenderer: TooltipComponent,\n tooltipCssClass: null,\n stopPropagation: false,\n enterAnimation: fadeInAnimation,\n exitAnimation: fadeOutAnimation,\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 * Animation factory used for enter animation of tooltip\n */\n protected _enterAnimation: AnimationFactory;\n\n /**\n * Animation factory used for exit animation of tooltip\n */\n protected _exitAnimation: AnimationFactory;\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 template?: TemplateRef<TooltipTemplateContext<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 this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);\n this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);\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 protected _animationsPlayer: AnimationBuilder,\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 this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);\n this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);\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 if(this._timeout)\n {\n clearTimeout(this._timeout);\n }\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 lastValueFrom(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 .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 const component = this._tooltipComponent;\n const element = this._tooltipElement;\n\n const exitAnimation = this._exitAnimation.create(element);\n\n exitAnimation.onDone(() =>\n {\n component.destroy();\n exitAnimation.destroy();\n });\n \n this._tooltipComponent = undefined;\n this._tooltipElement = undefined;\n\n exitAnimation.play();\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 this._enterAnimation.create(this._tooltipElement).play();\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.template ?? 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}"]}
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,gBAAgB,EAAmB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAC,aAAa,EAAC,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAE5E,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,mBAAmB,EAAkD,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AACrI,OAAO,EAAC,wBAAwB,EAAC,MAAM,8CAA8C,CAAC;AAEtF,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;;;AAElD;;GAEG;AACH,MAAM,cAAc,GACpB;IACI,KAAK,EAAE,GAAG;IACV,QAAQ,EACR;QACI,MAAM,EAAE,MAAM,CAAwB,YAAY,CAAyB;QAC3E,SAAS,EAAE,iBAAiB,CAAC,QAAQ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I,CAAC,iBAAiB,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;SACvD;IACL,CAAC;;6GAjWQ,gBAAgB,oIAgHL,QAAQ,aACR,QAAQ,aACI,eAAe;iGAlHtC,gBAAgB,0XAwGX,wBAAwB;2FAxG7B,gBAAgB;kBAJ5B,SAAS;mBACV;oBACI,QAAQ,EAAE,WAAW;iBACxB;;0BAiHgB,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,QAAQ;;0BACf,QAAQ;;0BAAI,MAAM;2BAAC,eAAe;4CAhExC,OAAO;sBADb,KAAK;gBAOC,SAAS;sBADf,KAAK;gBAOC,QAAQ;sBADd,KAAK;gBAOK,cAAc;sBADxB,KAAK;gBAsBC,cAAc;sBADpB,KAAK;gBASC,gBAAgB;sBADtB,KAAK;gBASC,oBAAoB;sBAD1B,YAAY;uBAAC,wBAAwB;gBAkE/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 {AnimationBuilder, AnimationFactory} from '@angular/animations';\nimport {DOCUMENT} from '@angular/common';\nimport {fadeInAnimation, fadeOutAnimation} from '@anglr/animations';\nimport {extend, isBlank, isPresent, nameof, renderToBody} from '@jscrpt/common';\nimport {lastValueFrom} from 'rxjs';\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, PositionOffsetString, PositionPlacement} from '../../../../services/position';\nimport {TooltipTemplateDirective} from '../tooltipTemplate/tooltipTemplate.directive';\nimport {TooltipTemplateContext} from '../tooltipTemplate/tooltipTemplate.context';\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: nameof<typeof PositionOffset>('MouseEnter') as PositionOffsetString,\n placement: PositionPlacement.TopStart,\n },\n allowSelection: false,\n tooltipRenderer: TooltipComponent,\n tooltipCssClass: null,\n stopPropagation: false,\n enterAnimation: fadeInAnimation,\n exitAnimation: fadeOutAnimation,\n containerElement: undefined,\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 * Animation factory used for enter animation of tooltip\n */\n protected _enterAnimation: AnimationFactory;\n\n /**\n * Animation factory used for exit animation of tooltip\n */\n protected _exitAnimation: AnimationFactory;\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 template?: TemplateRef<TooltipTemplateContext<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 this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);\n this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);\n\n if(this._options.containerElement && !this.containerElement)\n {\n this.containerElement = this._options.containerElement;\n }\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 /**\n * String that defines element in which should be tooltip rendered, if not specified, body is used\n * \n * Allows also css classes to be specified (div.body-box)\n */\n @Input()\n public containerElement: string|undefined|null;\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 protected _animationsPlayer: AnimationBuilder,\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 this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);\n this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);\n\n if(this._options.containerElement)\n {\n this.containerElement = this._options.containerElement;\n }\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 if(this._timeout)\n {\n clearTimeout(this._timeout);\n }\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 lastValueFrom(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 .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 const component = this._tooltipComponent;\n const element = this._tooltipElement;\n\n const exitAnimation = this._exitAnimation.create(element);\n\n exitAnimation.onDone(() =>\n {\n component.destroy();\n exitAnimation.destroy();\n });\n \n this._tooltipComponent = undefined;\n this._tooltipElement = undefined;\n\n exitAnimation.play();\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 renderToBody(this._document, this._tooltipElement, this.containerElement);\n this._enterAnimation.create(this._tooltipElement).play();\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.template ?? 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}"]}
@@ -1 +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';\nimport {AnimationMetadata} from '@angular/animations';\n\nimport {PositionOptions} from '../../../services/position';\nimport {TooltipTemplateContext} from '../directives';\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<TooltipTemplateContext<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\n /**\n * Animation used to tooltip component when it is displayed\n */\n enterAnimation: AnimationMetadata;\n\n /**\n * Animation used to tooltip component when it is hidden\n */\n exitAnimation: AnimationMetadata;\n}"]}
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';\nimport {AnimationMetadata} from '@angular/animations';\n\nimport {PositionOptions} from '../../../services/position';\nimport {TooltipTemplateContext} from '../directives';\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<TooltipTemplateContext<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\n /**\n * Animation used to tooltip component when it is displayed\n */\n enterAnimation: AnimationMetadata;\n\n /**\n * Animation used to tooltip component when it is hidden\n */\n exitAnimation: AnimationMetadata;\n\n /**\n * String that defines element in which should be tooltip rendered, if not specified, body is used\n * \n * Allows also css classes to be specified (div.body-box)\n */\n containerElement: string|undefined|null;\n}"]}
@@ -1,5 +1,6 @@
1
1
  import { Directive, Inject, Input, TemplateRef, ViewContainerRef } from '@angular/core';
2
2
  import { DOCUMENT } from '@angular/common';
3
+ import { renderToBody } from '@jscrpt/common';
3
4
  import * as i0 from "@angular/core";
4
5
  /**
5
6
  * Renders element into body directly at the end
@@ -19,22 +20,7 @@ export class BodyRenderSADirective {
19
20
  this.view = this.viewContainer
20
21
  .createEmbeddedView(this.template);
21
22
  this.element = this.view.rootNodes[0];
22
- //render to specified target element
23
- if (this.targetElement) {
24
- let element = this.document.querySelector(`body${this.targetElement}`);
25
- if (!element) {
26
- const [name, css] = this.targetElement.split('.');
27
- element = this.document.createElement(name);
28
- if (css) {
29
- element.classList.add(css);
30
- }
31
- }
32
- element.appendChild(this.element);
33
- }
34
- //render directly to body
35
- else {
36
- this.document.body.appendChild(this.element);
37
- }
23
+ renderToBody(this.document, this.element, this.targetElement);
38
24
  }
39
25
  //######################### public methods - implementation of OnDestroy #########################
40
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"bodyRender.directive.js","sourceRoot":"","sources":["../../../../src/directives/bodyRender/bodyRender.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAmB,MAAM,EAAE,KAAK,EAAqB,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC1H,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;;AAEzC;;GAEG;AAMH,MAAM,OAAO,qBAAqB;IAwB9B,iEAAiE;IACjE,YAAsB,QAA2B,EAC3B,aAA+B,EACb,QAAkB;QAFpC,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,kBAAa,GAAb,aAAa,CAAkB;QACb,aAAQ,GAAR,QAAQ,CAAU;IAE1D,CAAC;IAED,+FAA+F;IAE/F;;OAEG;IACI,QAAQ;QAEX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,aAAa;aACzB,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEvC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAgB,CAAC;QAErD,oCAAoC;QACpC,IAAG,IAAI,CAAC,aAAa,EACrB;YACI,IAAI,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;YAEvE,IAAG,CAAC,OAAO,EACX;gBACI,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAElD,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;gBAE5C,IAAG,GAAG,EACN;oBACI,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;iBAC9B;aACJ;YAED,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACrC;QACD,yBAAyB;aAEzB;YACI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAChD;IACL,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;QAEd,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;;kHAhFQ,qBAAqB,6EA2BV,QAAQ;sGA3BnB,qBAAqB;2FAArB,qBAAqB;kBALjC,SAAS;mBACV;oBACI,QAAQ,EAAE,cAAc;oBACxB,UAAU,EAAE,IAAI;iBACnB;;0BA4BgB,MAAM;2BAAC,QAAQ;4CALrB,aAAa;sBADnB,KAAK;uBAAC,YAAY","sourcesContent":["import {Directive, EmbeddedViewRef, Inject, Input, OnDestroy, OnInit, TemplateRef, ViewContainerRef} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\n\n/**\n * Renders element into body directly at the end\n */\n@Directive(\n{\n selector: '[bodyRender]',\n standalone: true\n})\nexport class BodyRenderSADirective implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Instance of created embedded view\n */\n protected view: EmbeddedViewRef<void>|undefined|null;\n\n /**\n * Instance of created element\n */\n protected element: HTMLElement|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * String that defines element in which should be template rendered, if not specified, body is used\n * \n * Allows also css class to be specified (div.body-box)\n */\n @Input('bodyRender')\n public targetElement: string|undefined|null;\n\n //######################### constructor #########################\n constructor(protected template: TemplateRef<void>,\n protected viewContainer: ViewContainerRef,\n @Inject(DOCUMENT) protected document: Document,)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.view = this.viewContainer\n .createEmbeddedView(this.template);\n\n this.element = this.view.rootNodes[0] as HTMLElement;\n\n //render to specified target element\n if(this.targetElement)\n {\n let element = this.document.querySelector(`body${this.targetElement}`);\n\n if(!element)\n {\n const [name, css] = this.targetElement.split('.');\n\n element = this.document.createElement(name);\n\n if(css)\n {\n element.classList.add(css);\n }\n }\n\n element.appendChild(this.element);\n }\n //render directly to body\n else\n {\n this.document.body.appendChild(this.element);\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.element?.remove();\n this.element = null;\n this.view?.destroy();\n this.view = null;\n }\n}"]}
1
+ {"version":3,"file":"bodyRender.directive.js","sourceRoot":"","sources":["../../../../src/directives/bodyRender/bodyRender.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAmB,MAAM,EAAE,KAAK,EAAqB,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC1H,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;;AAE5C;;GAEG;AAMH,MAAM,OAAO,qBAAqB;IAwB9B,iEAAiE;IACjE,YAAsB,QAA2B,EAC3B,aAA+B,EACb,QAAkB;QAFpC,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,kBAAa,GAAb,aAAa,CAAkB;QACb,aAAQ,GAAR,QAAQ,CAAU;IAE1D,CAAC;IAED,+FAA+F;IAE/F;;OAEG;IACI,QAAQ;QAEX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,aAAa;aACzB,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEvC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAgB,CAAC;QAErD,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAClE,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;QAEd,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;;kHAzDQ,qBAAqB,6EA2BV,QAAQ;sGA3BnB,qBAAqB;2FAArB,qBAAqB;kBALjC,SAAS;mBACV;oBACI,QAAQ,EAAE,cAAc;oBACxB,UAAU,EAAE,IAAI;iBACnB;;0BA4BgB,MAAM;2BAAC,QAAQ;4CALrB,aAAa;sBADnB,KAAK;uBAAC,YAAY","sourcesContent":["import {Directive, EmbeddedViewRef, Inject, Input, OnDestroy, OnInit, TemplateRef, ViewContainerRef} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {renderToBody} from '@jscrpt/common';\n\n/**\n * Renders element into body directly at the end\n */\n@Directive(\n{\n selector: '[bodyRender]',\n standalone: true\n})\nexport class BodyRenderSADirective implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Instance of created embedded view\n */\n protected view: EmbeddedViewRef<void>|undefined|null;\n\n /**\n * Instance of created element\n */\n protected element: HTMLElement|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * String that defines element in which should be template rendered, if not specified, body is used\n * \n * Allows also css class to be specified (div.body-box)\n */\n @Input('bodyRender')\n public targetElement: string|undefined|null;\n\n //######################### constructor #########################\n constructor(protected template: TemplateRef<void>,\n protected viewContainer: ViewContainerRef,\n @Inject(DOCUMENT) protected document: Document,)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.view = this.viewContainer\n .createEmbeddedView(this.template);\n\n this.element = this.view.rootNodes[0] as HTMLElement;\n\n renderToBody(this.document, this.element, this.targetElement);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.element?.remove();\n this.element = null;\n this.view?.destroy();\n this.view = null;\n }\n}"]}
@@ -2,7 +2,7 @@ import { ContentChild, Directive, ElementRef, HostListener, Inject, Injector, In
2
2
  import { AnimationBuilder } from '@angular/animations';
3
3
  import { DOCUMENT } from '@angular/common';
4
4
  import { fadeInAnimation, fadeOutAnimation } from '@anglr/animations';
5
- import { extend, isBlank, isPresent, nameof } from '@jscrpt/common';
5
+ import { extend, isBlank, isPresent, nameof, renderToBody } from '@jscrpt/common';
6
6
  import { lastValueFrom } from 'rxjs';
7
7
  import { TooltipComponent } from '../../components/tooltip/tooltip.component';
8
8
  import { TOOLTIP_OPTIONS } from '../../misc/tokens';
@@ -26,6 +26,7 @@ const defaultOptions = {
26
26
  stopPropagation: false,
27
27
  enterAnimation: fadeInAnimation,
28
28
  exitAnimation: fadeOutAnimation,
29
+ containerElement: undefined,
29
30
  };
30
31
  /**
31
32
  * Directive used for rendering tooltip
@@ -58,6 +59,9 @@ export class TooltipDirective {
58
59
  this._options = extend(true, {}, defaultOptions, options);
59
60
  this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);
60
61
  this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);
62
+ if (this._options.containerElement) {
63
+ this.containerElement = this._options.containerElement;
64
+ }
61
65
  }
62
66
  /**
63
67
  * Options used for displaying tooltip
@@ -69,6 +73,9 @@ export class TooltipDirective {
69
73
  this._options = extend(true, {}, this._options, value);
70
74
  this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);
71
75
  this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);
76
+ if (this._options.containerElement && !this.containerElement) {
77
+ this.containerElement = this._options.containerElement;
78
+ }
72
79
  }
73
80
  //######################### public methods - implementation of OnChanges #########################
74
81
  /**
@@ -197,7 +204,7 @@ export class TooltipDirective {
197
204
  this._tooltipElement = this._tooltipComponent.hostView
198
205
  .rootNodes[0];
199
206
  // 4. Append DOM element to the body
200
- this._document.body.appendChild(this._tooltipElement);
207
+ renderToBody(this._document, this._tooltipElement, this.containerElement);
201
208
  this._enterAnimation.create(this._tooltipElement).play();
202
209
  }
203
210
  /**
@@ -228,7 +235,7 @@ export class TooltipDirective {
228
235
  }
229
236
  }
230
237
  TooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: TooltipDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Injector }, { token: i0.ElementRef }, { token: i1.AnimationBuilder }, { token: DOCUMENT }, { token: POSITION }, { token: TOOLTIP_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
231
- TooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: TooltipDirective, selector: "[tooltip]", inputs: { tooltip: "tooltip", allowHtml: "allowHtml", template: "template", 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 });
238
+ TooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.7", type: TooltipDirective, selector: "[tooltip]", inputs: { tooltip: "tooltip", allowHtml: "allowHtml", template: "template", tooltipOptions: "tooltipOptions", tooltipVisible: "tooltipVisible", containerElement: "containerElement" }, host: { listeners: { "mouseleave": "mouseLeave($event)", "mousemove": "mouseMove($event)" } }, queries: [{ propertyName: "tooltipTemplateChild", first: true, predicate: TooltipTemplateDirective, descendants: true }], usesOnChanges: true, ngImport: i0 });
232
239
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImport: i0, type: TooltipDirective, decorators: [{
233
240
  type: Directive,
234
241
  args: [{
@@ -255,6 +262,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.7", ngImpor
255
262
  type: Input
256
263
  }], tooltipVisible: [{
257
264
  type: Input
265
+ }], containerElement: [{
266
+ type: Input
258
267
  }], tooltipTemplateChild: [{
259
268
  type: ContentChild,
260
269
  args: [TooltipTemplateDirective]
@@ -1 +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,gBAAgB,EAAmB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAC,aAAa,EAAC,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAE5E,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,mBAAmB,EAAkD,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AACrI,OAAO,EAAC,wBAAwB,EAAC,MAAM,8CAA8C,CAAC;AAEtF,OAAO,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2FX,wBAAwB;2FA3F7B,gBAAgB;kBAJ5B,SAAS;mBACV;oBACI,QAAQ,EAAE,WAAW;iBACxB;;0BAoGgB,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,QAAQ;;0BACf,QAAQ;;0BAAI,MAAM;2BAAC,eAAe;4CAnDxC,OAAO;sBADb,KAAK;gBAOC,SAAS;sBADf,KAAK;gBAOC,QAAQ;sBADd,KAAK;gBAOK,cAAc;sBADxB,KAAK;gBAiBC,cAAc;sBADpB,KAAK;gBASC,oBAAoB;sBAD1B,YAAY;uBAAC,wBAAwB;gBA6D/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 {AnimationBuilder, AnimationFactory} from '@angular/animations';\nimport {DOCUMENT} from '@angular/common';\nimport {fadeInAnimation, fadeOutAnimation} from '@anglr/animations';\nimport {extend, isBlank, isPresent, nameof} from '@jscrpt/common';\nimport {lastValueFrom} from 'rxjs';\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, PositionOffsetString, PositionPlacement} from '../../../../services/position';\nimport {TooltipTemplateDirective} from '../tooltipTemplate/tooltipTemplate.directive';\nimport {TooltipTemplateContext} from '../tooltipTemplate/tooltipTemplate.context';\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: nameof<typeof PositionOffset>('MouseEnter') as PositionOffsetString,\n placement: PositionPlacement.TopStart,\n },\n allowSelection: false,\n tooltipRenderer: TooltipComponent,\n tooltipCssClass: null,\n stopPropagation: false,\n enterAnimation: fadeInAnimation,\n exitAnimation: fadeOutAnimation,\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 * Animation factory used for enter animation of tooltip\n */\n protected _enterAnimation: AnimationFactory;\n\n /**\n * Animation factory used for exit animation of tooltip\n */\n protected _exitAnimation: AnimationFactory;\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 template?: TemplateRef<TooltipTemplateContext<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 this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);\n this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);\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 protected _animationsPlayer: AnimationBuilder,\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 this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);\n this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);\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 if(this._timeout)\n {\n clearTimeout(this._timeout);\n }\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 lastValueFrom(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 .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 const component = this._tooltipComponent;\n const element = this._tooltipElement;\n\n const exitAnimation = this._exitAnimation.create(element);\n\n exitAnimation.onDone(() =>\n {\n component.destroy();\n exitAnimation.destroy();\n });\n \n this._tooltipComponent = undefined;\n this._tooltipElement = undefined;\n\n exitAnimation.play();\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 this._enterAnimation.create(this._tooltipElement).play();\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.template ?? 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}"]}
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,gBAAgB,EAAmB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAC,aAAa,EAAC,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAE5E,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,mBAAmB,EAAkD,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AACrI,OAAO,EAAC,wBAAwB,EA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S,GAAG,KAAK,CAAC;oBAEvB,IAAG,CAAC,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;;6GAjWQ,gBAAgB,oIAgHL,QAAQ,aACR,QAAQ,aACI,eAAe;iGAlHtC,gBAAgB,0XAwGX,wBAAwB;2FAxG7B,gBAAgB;kBAJ5B,SAAS;mBACV;oBACI,QAAQ,EAAE,WAAW;iBACxB;;0BAiHgB,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,QAAQ;;0BACf,QAAQ;;0BAAI,MAAM;2BAAC,eAAe;4CAhExC,OAAO;sBADb,KAAK;gBAOC,SAAS;sBADf,KAAK;gBAOC,QAAQ;sBADd,KAAK;gBAOK,cAAc;sBADxB,KAAK;gBAsBC,cAAc;sBADpB,KAAK;gBASC,gBAAgB;sBADtB,KAAK;gBASC,oBAAoB;sBAD1B,YAAY;uBAAC,wBAAwB;gBAkE/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 {AnimationBuilder, AnimationFactory} from '@angular/animations';\nimport {DOCUMENT} from '@angular/common';\nimport {fadeInAnimation, fadeOutAnimation} from '@anglr/animations';\nimport {extend, isBlank, isPresent, nameof, renderToBody} from '@jscrpt/common';\nimport {lastValueFrom} from 'rxjs';\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, PositionOffsetString, PositionPlacement} from '../../../../services/position';\nimport {TooltipTemplateDirective} from '../tooltipTemplate/tooltipTemplate.directive';\nimport {TooltipTemplateContext} from '../tooltipTemplate/tooltipTemplate.context';\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: nameof<typeof PositionOffset>('MouseEnter') as PositionOffsetString,\n placement: PositionPlacement.TopStart,\n },\n allowSelection: false,\n tooltipRenderer: TooltipComponent,\n tooltipCssClass: null,\n stopPropagation: false,\n enterAnimation: fadeInAnimation,\n exitAnimation: fadeOutAnimation,\n containerElement: undefined,\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 * Animation factory used for enter animation of tooltip\n */\n protected _enterAnimation: AnimationFactory;\n\n /**\n * Animation factory used for exit animation of tooltip\n */\n protected _exitAnimation: AnimationFactory;\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 template?: TemplateRef<TooltipTemplateContext<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 this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);\n this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);\n\n if(this._options.containerElement && !this.containerElement)\n {\n this.containerElement = this._options.containerElement;\n }\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 /**\n * String that defines element in which should be tooltip rendered, if not specified, body is used\n * \n * Allows also css classes to be specified (div.body-box)\n */\n @Input()\n public containerElement: string|undefined|null;\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 protected _animationsPlayer: AnimationBuilder,\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 this._enterAnimation = this._animationsPlayer.build(this._options.enterAnimation);\n this._exitAnimation = this._animationsPlayer.build(this._options.exitAnimation);\n\n if(this._options.containerElement)\n {\n this.containerElement = this._options.containerElement;\n }\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 if(this._timeout)\n {\n clearTimeout(this._timeout);\n }\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 lastValueFrom(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 .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 const component = this._tooltipComponent;\n const element = this._tooltipElement;\n\n const exitAnimation = this._exitAnimation.create(element);\n\n exitAnimation.onDone(() =>\n {\n component.destroy();\n exitAnimation.destroy();\n });\n \n this._tooltipComponent = undefined;\n this._tooltipElement = undefined;\n\n exitAnimation.play();\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 renderToBody(this._document, this._tooltipElement, this.containerElement);\n this._enterAnimation.create(this._tooltipElement).play();\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.template ?? 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}"]}
@@ -1 +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';\nimport {AnimationMetadata} from '@angular/animations';\n\nimport {PositionOptions} from '../../../services/position';\nimport {TooltipTemplateContext} from '../directives';\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<TooltipTemplateContext<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\n /**\n * Animation used to tooltip component when it is displayed\n */\n enterAnimation: AnimationMetadata;\n\n /**\n * Animation used to tooltip component when it is hidden\n */\n exitAnimation: AnimationMetadata;\n}"]}
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';\nimport {AnimationMetadata} from '@angular/animations';\n\nimport {PositionOptions} from '../../../services/position';\nimport {TooltipTemplateContext} from '../directives';\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<TooltipTemplateContext<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\n /**\n * Animation used to tooltip component when it is displayed\n */\n enterAnimation: AnimationMetadata;\n\n /**\n * Animation used to tooltip component when it is hidden\n */\n exitAnimation: AnimationMetadata;\n\n /**\n * String that defines element in which should be tooltip rendered, if not specified, body is used\n * \n * Allows also css classes to be specified (div.body-box)\n */\n containerElement: string|undefined|null;\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anglr/common",
3
- "version": "16.0.0-beta.20230208083032",
3
+ "version": "16.0.0-beta.20230208085018",
4
4
  "description": "Angular module for common angular stuff",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -104,7 +104,7 @@
104
104
  "@angular/material": ">=14.2.0",
105
105
  "@anglr/animations": ">=9.1.0",
106
106
  "rxjs": ">=7.5.7",
107
- "@jscrpt/common": ">=3.2.0",
107
+ "@jscrpt/common": ">=3.4.0",
108
108
  "numeral": "^2.0.6",
109
109
  "angular2-hotkeys": "^13.1.0",
110
110
  "store": "^2.0.12",
@@ -126,7 +126,7 @@
126
126
  "@angular/material": "^14.2.0",
127
127
  "@anglr/animations": "^9.1.0",
128
128
  "rxjs": "^7.5.7",
129
- "@jscrpt/common": "^3.2.0",
129
+ "@jscrpt/common": "^3.4.0",
130
130
  "angular2-hotkeys": "^13.1.0",
131
131
  "store": "^2.0.12",
132
132
  "structured-log": "^0.2.0",
@@ -1 +1 @@
1
- {"version":3,"file":"bodyRender.directive.d.ts","sourceRoot":"","sources":["bodyRender.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,eAAe,EAAiB,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;;AAG1H;;GAEG;AACH,qBAKa,qBAAsB,YAAW,MAAM,EAAE,SAAS;IAyB/C,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC;IACrC,SAAS,CAAC,aAAa,EAAE,gBAAgB;IACvB,SAAS,CAAC,QAAQ,EAAE,QAAQ;IAvB1D;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,GAAC,SAAS,GAAC,IAAI,CAAC;IAErD;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,WAAW,GAAC,SAAS,GAAC,IAAI,CAAC;IAI9C;;;;OAIG;IAEI,aAAa,EAAE,MAAM,GAAC,SAAS,GAAC,IAAI,CAAC;gBAGtB,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,EAC3B,aAAa,EAAE,gBAAgB,EACb,QAAQ,EAAE,QAAQ;IAM1D;;OAEG;IACI,QAAQ,IAAI,IAAI;IAmCvB;;OAEG;IACI,WAAW,IAAI,IAAI;yCA1EjB,qBAAqB;2CAArB,qBAAqB;CAiFjC"}
1
+ {"version":3,"file":"bodyRender.directive.d.ts","sourceRoot":"","sources":["bodyRender.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,eAAe,EAAiB,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;;AAI1H;;GAEG;AACH,qBAKa,qBAAsB,YAAW,MAAM,EAAE,SAAS;IAyB/C,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC;IACrC,SAAS,CAAC,aAAa,EAAE,gBAAgB;IACvB,SAAS,CAAC,QAAQ,EAAE,QAAQ;IAvB1D;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,GAAC,SAAS,GAAC,IAAI,CAAC;IAErD;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,WAAW,GAAC,SAAS,GAAC,IAAI,CAAC;IAI9C;;;;OAIG;IAEI,aAAa,EAAE,MAAM,GAAC,SAAS,GAAC,IAAI,CAAC;gBAGtB,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,EAC3B,aAAa,EAAE,gBAAgB,EACb,QAAQ,EAAE,QAAQ;IAM1D;;OAEG;IACI,QAAQ,IAAI,IAAI;IAYvB;;OAEG;IACI,WAAW,IAAI,IAAI;yCAnDjB,qBAAqB;2CAArB,qBAAqB;CA0DjC"}
@@ -68,6 +68,12 @@ export declare class TooltipDirective<TData = any> implements OnChanges, OnDestr
68
68
  * Gets or sets indication whether is tooltip visible, if has boolean value, mouse events cant override this
69
69
  */
70
70
  tooltipVisible?: boolean;
71
+ /**
72
+ * String that defines element in which should be tooltip rendered, if not specified, body is used
73
+ *
74
+ * Allows also css classes to be specified (div.body-box)
75
+ */
76
+ containerElement: string | undefined | null;
71
77
  /**
72
78
  * Instance of template from element content, used for rendering
73
79
  */
@@ -119,6 +125,6 @@ export declare class TooltipDirective<TData = any> implements OnChanges, OnDestr
119
125
  */
120
126
  static ngAcceptInputType_tooltip: any;
121
127
  static ɵfac: i0.ɵɵFactoryDeclaration<TooltipDirective<any>, [null, null, null, null, null, null, { optional: true; }]>;
122
- static ɵdir: i0.ɵɵDirectiveDeclaration<TooltipDirective<any>, "[tooltip]", never, { "tooltip": "tooltip"; "allowHtml": "allowHtml"; "template": "template"; "tooltipOptions": "tooltipOptions"; "tooltipVisible": "tooltipVisible"; }, {}, ["tooltipTemplateChild"], never, false>;
128
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TooltipDirective<any>, "[tooltip]", never, { "tooltip": "tooltip"; "allowHtml": "allowHtml"; "template": "template"; "tooltipOptions": "tooltipOptions"; "tooltipVisible": "tooltipVisible"; "containerElement": "containerElement"; }, {}, ["tooltipTemplateChild"], never, false>;
123
129
  }
124
130
  //# sourceMappingURL=tooltip.directive.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.directive.d.ts","sourceRoot":"","sources":["tooltip.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAA2B,UAAU,EAAyC,QAAQ,EAAS,SAAS,EAAE,SAAS,EAAY,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACtN,OAAO,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAOvE,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EAAsB,QAAQ,EAA0D,MAAM,+BAA+B,CAAC;AACrI,OAAO,EAAC,wBAAwB,EAAC,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAC,sBAAsB,EAAC,MAAM,4CAA4C,CAAC;;AAsBlF;;GAEG;AACH,qBAIa,gBAAgB,CAAC,KAAK,GAAG,GAAG,CAAE,YAAW,SAAS,EAAE,SAAS;IA+F1D,S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EAWvD;IAED;;OAEG;IAEI,cAAc,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;OAIG;IAEI,gBAAgB,EAAE,MAAM,GAAC,SAAS,GAAC,IAAI,CAAC;IAI/C;;OAEG;IAEI,oBAAoB,CAAC,EAAE,wBAAwB,CAAC;gBAGjC,iBAAiB,EAAE,gBAAgB,EACnC,SAAS,EAAE,QAAQ,EACnB,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,EACjC,iBAAiB,EAAE,gBAAgB,EACjB,SAAS,EAAE,QAAQ,EACnB,SAAS,EAAE,QAAQ,EACV,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAelF;;OAEG;IACI,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAiBhD;;OAEG;IACI,WAAW,IAAI,IAAI;IAY1B;;;;OAIG;IAEI,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAoB1C;;;;OAIG;IAEI,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAmCzC;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI;IAwBhD;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;IAK9B;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,IAAI;IAsBjC;;OAEG;IACH,SAAS,CAAC,cAAc,IAAI,IAAI;IAqBhC;;OAEG;IACH,SAAS,CAAC,SAAS,IAAI,IAAI;IAsC3B;;OAEG;IACH,OAAc,yBAAyB,EAAE,GAAG,CAAC;yCAxWpC,gBAAgB;2CAAhB,gBAAgB;CAyW5B"}
@@ -69,5 +69,11 @@ export interface TooltipOptions {
69
69
  * Animation used to tooltip component when it is hidden
70
70
  */
71
71
  exitAnimation: AnimationMetadata;
72
+ /**
73
+ * String that defines element in which should be tooltip rendered, if not specified, body is used
74
+ *
75
+ * Allows also css classes to be specified (div.body-box)
76
+ */
77
+ containerElement: string | undefined | null;
72
78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