@agorapulse/ui-components 13.0.0 → 13.0.1

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.
@@ -762,85 +762,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
762
762
  }] } });
763
763
 
764
764
  class TooltipNeoDirective {
765
- constructor(_elementRef, _overlay, _overlayPositionBuilder, _tooltipNeoService) {
766
- this._elementRef = _elementRef;
767
- this._overlay = _overlay;
768
- this._overlayPositionBuilder = _overlayPositionBuilder;
769
- this._tooltipNeoService = _tooltipNeoService;
770
- this._destroy$ = new Subject();
771
- this._hide$ = new Subject();
772
- this._mouseEntered = false;
773
- this._show$ = new Subject();
765
+ constructor(elementRef, overlay, overlayPositionBuilder, tooltipNeoService) {
766
+ this.elementRef = elementRef;
767
+ this.overlay = overlay;
768
+ this.overlayPositionBuilder = overlayPositionBuilder;
769
+ this.tooltipNeoService = tooltipNeoService;
770
+ this.destroy$ = new Subject();
771
+ this.hide$ = new Subject();
772
+ this.mouseEntered = false;
773
+ this.show$ = new Subject();
774
774
  }
775
775
  static enableTooltip(content, contentType, display) {
776
776
  return !!content && !!contentType && !!display;
777
777
  }
778
778
  ngOnChanges(changes) {
779
- if ((changes?.apTooltipNeo?.currentValue?.display || changes?.apTooltipNeo?.currentValue?.position) && this._mouseEntered) {
780
- this._setSettings();
781
- this._allowDisplay ? this._show$.next(true) : this._hide$.next(false);
779
+ if ((changes?.apTooltipNeo?.currentValue?.display || changes?.apTooltipNeo?.currentValue?.position) && this.mouseEntered) {
780
+ this.setSettings();
781
+ this.allowDisplay ? this.show$.next(true) : this.hide$.next(false);
782
782
  }
783
783
  }
784
784
  ngOnInit() {
785
- this._initiateTooltip();
785
+ this.initiateTooltip();
786
786
  }
787
787
  ngOnDestroy() {
788
- this._detach();
789
- this._destroy$.next();
790
- this._destroy$.complete();
788
+ this.detach();
789
+ this.destroy$.next();
790
+ this.destroy$.complete();
791
791
  }
792
- _setSettings() {
792
+ setSettings() {
793
793
  if (typeof this.apTooltipNeo === 'object') {
794
- const { content = undefined, backgroundColor = '#ffffff', borderColor = undefined, contentType = 'text', display = true, displayArrow = true, maxWidth = 'full', position = 'top', title = '' } = this.apTooltipNeo;
795
- this._params = { content, backgroundColor, borderColor, contentType, display, displayArrow, maxWidth, position, title };
796
- this._allowDisplay = TooltipNeoDirective.enableTooltip(content, contentType, display);
794
+ const { content, backgroundColor = '#ffffff', borderColor, contentType = 'text', display = true, displayArrow = true, maxWidth = 'full', position = 'top', title = '' } = this.apTooltipNeo;
795
+ this.params = { content, backgroundColor, borderColor, contentType, display, displayArrow, maxWidth, position, title };
796
+ this.allowDisplay = TooltipNeoDirective.enableTooltip(content, contentType, display);
797
797
  }
798
798
  if (typeof this.apTooltipNeo === 'string') {
799
- const content = this.apTooltipNeo, backgroundColor = '#ffffff', borderColor = undefined, contentType = 'text', display = true, displayArrow = true, maxWidth = 'full', position = 'top', title = '';
800
- this._params = { content, backgroundColor, borderColor, contentType, position, display, displayArrow, title, maxWidth };
801
- this._allowDisplay = TooltipNeoDirective.enableTooltip(content, contentType, display);
802
- }
803
- }
804
- _initiateTooltip() {
805
- merge(this._hide$, this._show$)
799
+ const content = this.apTooltipNeo;
800
+ const backgroundColor = '#ffffff';
801
+ const borderColor = undefined;
802
+ const contentType = 'text';
803
+ const display = true;
804
+ const displayArrow = true;
805
+ const maxWidth = 'full';
806
+ const position = 'top';
807
+ const title = '';
808
+ this.params = { content, backgroundColor, borderColor, contentType, position, display, displayArrow, title, maxWidth };
809
+ this.allowDisplay = TooltipNeoDirective.enableTooltip(content, contentType, display);
810
+ }
811
+ }
812
+ initiateTooltip() {
813
+ merge(this.hide$, this.show$)
806
814
  .pipe(switchMap(bool => {
807
815
  if (!bool) {
808
816
  return of(bool);
809
817
  }
810
818
  return of(bool).pipe(delay(200));
811
- }), takeUntil(this._destroy$))
819
+ }), takeUntil(this.destroy$))
812
820
  .subscribe(bool => {
813
821
  if (bool) {
814
- this._elementRefMouseLeave$ = fromEvent(this._elementRef.nativeElement, 'mouseleave')
815
- .subscribe(() => this._detach());
816
- const positionStrategy = this._overlayPositionBuilder
817
- .flexibleConnectedTo(this._elementRef)
818
- .withPositions([tooltipNeoPositions[this._params.position]]);
819
- const scrollStrategy = this._overlay.scrollStrategies.close();
820
- this._overlayRef = this._overlay.create({ positionStrategy, scrollStrategy });
821
- const tooltipRef = this._overlayRef.attach(new ComponentPortal(TooltipNeoComponent));
822
- tooltipRef.instance.params = this._params;
822
+ this.elementRefMouseLeave$ = fromEvent(this.elementRef.nativeElement, 'mouseleave')
823
+ .subscribe(() => this.detach());
824
+ const positionStrategy = this.overlayPositionBuilder
825
+ .flexibleConnectedTo(this.elementRef)
826
+ .withPositions([tooltipNeoPositions[this.params.position]]);
827
+ const scrollStrategy = this.overlay.scrollStrategies.close();
828
+ this.overlayRef = this.overlay.create({ positionStrategy, scrollStrategy });
829
+ const tooltipRef = this.overlayRef.attach(new ComponentPortal(TooltipNeoComponent));
830
+ tooltipRef.instance.params = this.params;
823
831
  }
824
832
  else {
825
- this._detach();
833
+ this.detach();
826
834
  }
827
835
  });
828
- this._tooltipNeoService.clickOutside$
829
- .pipe(takeUntil(this._destroy$))
830
- .subscribe(() => this._hide$.next(true));
836
+ this.tooltipNeoService.clickOutside$
837
+ .pipe(takeUntil(this.destroy$))
838
+ .subscribe(() => this.hide$.next(false));
831
839
  }
832
- _detach() {
833
- this._overlayRef && this._overlayRef.hasAttached() && this._overlayRef.detach();
834
- this._elementRefMouseLeave$ && this._elementRefMouseLeave$.unsubscribe();
840
+ detach() {
841
+ this.overlayRef && this.overlayRef.hasAttached() && this.overlayRef.detach();
842
+ this.elementRefMouseLeave$ && this.elementRefMouseLeave$.unsubscribe();
835
843
  }
836
844
  onMouseEnter() {
837
- this._setSettings();
838
- this._mouseEntered = true;
839
- this._allowDisplay && this._params && this._show$.next(true);
845
+ this.setSettings();
846
+ this.mouseEntered = true;
847
+ this.allowDisplay && this.params && this.show$.next(true);
840
848
  }
841
849
  onMouseLeave() {
842
- this._mouseEntered = false;
843
- this._hide$.next(false);
850
+ this.mouseEntered = false;
851
+ this.hide$.next(false);
844
852
  }
845
853
  }
846
854
  /** @nocollapse */ /** @nocollapse */ TooltipNeoDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: TooltipNeoDirective, deps: [{ token: i0.ElementRef }, { token: i1$3.Overlay }, { token: i1$3.OverlayPositionBuilder }, { token: TooltipNeoService }], target: i0.ɵɵFactoryTarget.Directive });