@coreui/angular 4.2.1 → 4.2.2

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.
@@ -8780,11 +8780,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
8780
8780
  }] } });
8781
8781
 
8782
8782
  class TooltipDirective {
8783
- constructor(document, renderer, hostElement, componentFactoryResolver, viewContainerRef, listenersService) {
8783
+ constructor(document, renderer, hostElement, viewContainerRef, listenersService) {
8784
8784
  this.document = document;
8785
8785
  this.renderer = renderer;
8786
8786
  this.hostElement = hostElement;
8787
- this.componentFactoryResolver = componentFactoryResolver;
8788
8787
  this.viewContainerRef = viewContainerRef;
8789
8788
  this.listenersService = listenersService;
8790
8789
  /**
@@ -8879,9 +8878,7 @@ class TooltipDirective {
8879
8878
  }
8880
8879
  createTooltipElement() {
8881
8880
  if (!this.tooltipRef) {
8882
- const tooltipComponent = this.componentFactoryResolver.resolveComponentFactory(TooltipComponent);
8883
- this.tooltipRef = tooltipComponent.create(this.viewContainerRef.injector);
8884
- // this.tooltipRef = this.viewContainerRef.createComponent<TooltipComponent>(TooltipComponent);
8881
+ this.tooltipRef = this.viewContainerRef.createComponent(TooltipComponent);
8885
8882
  // this.viewContainerRef.detach();
8886
8883
  }
8887
8884
  }
@@ -8891,8 +8888,8 @@ class TooltipDirective {
8891
8888
  // @ts-ignore
8892
8889
  this.tooltipRef = undefined;
8893
8890
  this.popperInstance?.destroy();
8894
- this.viewContainerRef.detach();
8895
- this.viewContainerRef.clear();
8891
+ this.viewContainerRef?.detach();
8892
+ this.viewContainerRef?.clear();
8896
8893
  }
8897
8894
  addTooltipElement() {
8898
8895
  if (!this.tooltipRef) {
@@ -8900,34 +8897,43 @@ class TooltipDirective {
8900
8897
  }
8901
8898
  this.tooltipRef.instance.content = this.content;
8902
8899
  this.tooltip = this.tooltipRef.location.nativeElement;
8900
+ this.renderer.addClass(this.tooltip, 'd-none');
8903
8901
  this.renderer.addClass(this.tooltip, 'fade');
8902
+ this.popperInstance?.destroy();
8904
8903
  setTimeout(() => {
8905
8904
  this.popperInstance = createPopper(this.hostElement.nativeElement, this.tooltip, { ...this.popperOptions });
8906
8905
  this.viewContainerRef.insert(this.tooltipRef.hostView);
8906
+ this.renderer.appendChild(this.document.body, this.tooltip);
8907
+ if (!this.visible) {
8908
+ this.removeTooltipElement();
8909
+ return;
8910
+ }
8907
8911
  setTimeout(() => {
8908
8912
  this.tooltipId = this.getUID('tooltip');
8909
8913
  this.tooltipRef.instance.id = this.tooltipId;
8914
+ if (!this.visible) {
8915
+ this.removeTooltipElement();
8916
+ return;
8917
+ }
8918
+ this.renderer.removeClass(this.tooltip, 'd-none');
8910
8919
  this.tooltipRef.instance.visible = this.visible;
8911
- this.renderer.appendChild(this.document.body, this.tooltip);
8912
8920
  this.popperInstance.forceUpdate();
8913
- // this.tooltipRef.changeDetectorRef.markForCheck();
8914
8921
  }, 100);
8915
8922
  });
8916
8923
  }
8917
8924
  removeTooltipElement() {
8925
+ this.tooltipId = '';
8918
8926
  if (!this.tooltipRef) {
8919
8927
  return;
8920
8928
  }
8921
8929
  this.tooltipRef.instance.visible = this.visible;
8922
8930
  this.tooltipRef.instance.id = undefined;
8923
8931
  setTimeout(() => {
8924
- this.viewContainerRef.detach();
8925
- this.popperInstance?.destroy();
8926
- this.tooltipId = '';
8932
+ this.viewContainerRef?.detach();
8927
8933
  }, 300);
8928
8934
  }
8929
8935
  }
8930
- TooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TooltipDirective, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ComponentFactoryResolver }, { token: i0.ViewContainerRef }, { token: ListenersService }], target: i0.ɵɵFactoryTarget.Directive });
8936
+ TooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TooltipDirective, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: ListenersService }], target: i0.ɵɵFactoryTarget.Directive });
8931
8937
  TooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: TooltipDirective, selector: "[cTooltip]", inputs: { content: ["cTooltip", "content"], popperOptions: ["cTooltipOptions", "popperOptions"], placement: ["cTooltipPlacement", "placement"], trigger: ["cTooltipTrigger", "trigger"], visible: ["cTooltipVisible", "visible"] }, host: { properties: { "attr.aria-describedby": "this.ariaDescribedBy" } }, providers: [ListenersService], exportAs: ["cTooltip"], usesOnChanges: true, ngImport: i0 });
8932
8938
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TooltipDirective, decorators: [{
8933
8939
  type: Directive,
@@ -8936,10 +8942,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
8936
8942
  exportAs: 'cTooltip',
8937
8943
  providers: [ListenersService]
8938
8944
  }]
8939
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
8945
+ }], ctorParameters: function () { return [{ type: Document, decorators: [{
8940
8946
  type: Inject,
8941
8947
  args: [DOCUMENT]
8942
- }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: ListenersService }]; }, propDecorators: { content: [{
8948
+ }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: ListenersService }]; }, propDecorators: { content: [{
8943
8949
  type: Input,
8944
8950
  args: ['cTooltip']
8945
8951
  }], popperOptions: [{