@agorapulse/ui-components 13.1.9 → 13.1.10

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.
@@ -47,7 +47,7 @@ import { NgxDaterangepickerMd } from 'ngx-daterangepicker-material';
47
47
  import * as i1$3 from '@angular/animations';
48
48
  import { animate, style, trigger, transition } from '@angular/animations';
49
49
  import { ComponentPortal, PortalInjector } from '@angular/cdk/portal';
50
- import { Subject, merge, of, fromEvent, BehaviorSubject } from 'rxjs';
50
+ import { Subject, of, fromEvent, BehaviorSubject } from 'rxjs';
51
51
  import { switchMap, delay, takeUntil, debounceTime, distinctUntilChanged, tap, catchError, map } from 'rxjs/operators';
52
52
  import * as i2$3 from '@angular/cdk/scrolling';
53
53
  import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
@@ -1067,7 +1067,7 @@ const tooltipNeoPositions = {
1067
1067
 
1068
1068
  class TooltipNeoService {
1069
1069
  constructor() {
1070
- this.clickOutside$ = new Subject();
1070
+ this.dispose$ = new Subject();
1071
1071
  }
1072
1072
  }
1073
1073
  /** @nocollapse */ /** @nocollapse */ TooltipNeoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TooltipNeoService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -1080,9 +1080,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
1080
1080
  }] });
1081
1081
 
1082
1082
  class TooltipNeoComponent {
1083
- constructor(_elementRef, _tooltipNeoService) {
1084
- this._elementRef = _elementRef;
1085
- this._tooltipNeoService = _tooltipNeoService;
1083
+ constructor(elementRef, tooltipNeoService) {
1084
+ this.elementRef = elementRef;
1085
+ this.tooltipNeoService = tooltipNeoService;
1086
1086
  }
1087
1087
  ngOnInit() {
1088
1088
  this.params.borderColor
@@ -1090,8 +1090,8 @@ class TooltipNeoComponent {
1090
1090
  : this.border = undefined;
1091
1091
  }
1092
1092
  onClickOutside(event) {
1093
- if (!this._elementRef.nativeElement.contains(event.target)) {
1094
- this._tooltipNeoService.clickOutside$.next();
1093
+ if (!this.elementRef.nativeElement.contains(event.target)) {
1094
+ this.tooltipNeoService.dispose$.next();
1095
1095
  }
1096
1096
  }
1097
1097
  }
@@ -1130,24 +1130,35 @@ class TooltipNeoDirective {
1130
1130
  this.overlayPositionBuilder = overlayPositionBuilder;
1131
1131
  this.tooltipNeoService = tooltipNeoService;
1132
1132
  this.destroy$ = new Subject();
1133
- this.hide$ = new Subject();
1133
+ this.display$ = new Subject();
1134
1134
  this.mouseEntered = false;
1135
- this.show$ = new Subject();
1136
1135
  }
1137
1136
  static enableTooltip(content, contentType, display) {
1138
1137
  return !!content && !!contentType && !!display;
1139
1138
  }
1139
+ /**
1140
+ * To fix issue on inbox virtual scroller, it's a manual cleaner at DOM level
1141
+ * @private
1142
+ */
1143
+ static cleanUpPersistentTooltip() {
1144
+ const tooltips = document.getElementsByTagName('ap-tooltip-neo');
1145
+ if (tooltips) {
1146
+ Array.from(tooltips).forEach(tooltip => {
1147
+ tooltip.parentElement.parentElement.remove();
1148
+ });
1149
+ }
1150
+ }
1140
1151
  ngOnChanges(changes) {
1141
1152
  if ((changes?.apTooltipNeo?.currentValue?.display || changes?.apTooltipNeo?.currentValue?.position) && this.mouseEntered) {
1142
1153
  this.setSettings();
1143
- this.allowDisplay ? this.show$.next(true) : this.hide$.next(false);
1154
+ this.display$.next(this.allowDisplay);
1144
1155
  }
1145
1156
  }
1146
1157
  ngOnInit() {
1147
1158
  this.initiateTooltip();
1148
1159
  }
1149
1160
  ngOnDestroy() {
1150
- this.detach();
1161
+ this.dispose();
1151
1162
  this.destroy$.next();
1152
1163
  this.destroy$.complete();
1153
1164
  }
@@ -1167,12 +1178,12 @@ class TooltipNeoDirective {
1167
1178
  const maxWidth = 'full';
1168
1179
  const position = 'top';
1169
1180
  const title = '';
1170
- this.params = { content, backgroundColor, borderColor, contentType, position, display, displayArrow, title, maxWidth };
1181
+ this.params = { content, backgroundColor, borderColor, contentType, display, displayArrow, maxWidth, position, title };
1171
1182
  this.allowDisplay = TooltipNeoDirective.enableTooltip(content, contentType, display);
1172
1183
  }
1173
1184
  }
1174
1185
  initiateTooltip() {
1175
- merge(this.hide$, this.show$)
1186
+ this.display$
1176
1187
  .pipe(switchMap(bool => {
1177
1188
  if (!bool) {
1178
1189
  return of(bool);
@@ -1182,7 +1193,8 @@ class TooltipNeoDirective {
1182
1193
  .subscribe(bool => {
1183
1194
  if (bool) {
1184
1195
  this.elementRefMouseLeave$ = fromEvent(this.elementRef.nativeElement, 'mouseleave')
1185
- .subscribe(() => this.detach());
1196
+ .subscribe(() => this.dispose());
1197
+ TooltipNeoDirective.cleanUpPersistentTooltip();
1186
1198
  const positionStrategy = this.overlayPositionBuilder
1187
1199
  .flexibleConnectedTo(this.elementRef)
1188
1200
  .withPositions([tooltipNeoPositions[this.params.position]]);
@@ -1192,29 +1204,40 @@ class TooltipNeoDirective {
1192
1204
  tooltipRef.instance.params = this.params;
1193
1205
  }
1194
1206
  else {
1195
- this.detach();
1207
+ this.dispose();
1196
1208
  }
1197
1209
  });
1198
- this.tooltipNeoService.clickOutside$
1210
+ this.tooltipNeoService.dispose$
1199
1211
  .pipe(takeUntil(this.destroy$))
1200
- .subscribe(() => this.hide$.next(false));
1212
+ .subscribe(() => {
1213
+ this.display$.next(false);
1214
+ });
1201
1215
  }
1202
- detach() {
1203
- this.overlayRef && this.overlayRef.hasAttached() && this.overlayRef.detach();
1204
- this.elementRefMouseLeave$ && this.elementRefMouseLeave$.unsubscribe();
1216
+ dispose() {
1217
+ if (this.overlayRef) {
1218
+ this.overlayRef.dispose();
1219
+ }
1220
+ if (this.elementRefMouseLeave$) {
1221
+ this.elementRefMouseLeave$.unsubscribe();
1222
+ }
1205
1223
  }
1206
1224
  onMouseEnter() {
1207
1225
  this.setSettings();
1208
1226
  this.mouseEntered = true;
1209
- this.allowDisplay && this.params && this.show$.next(true);
1227
+ if (this.allowDisplay && this.params) {
1228
+ this.display$.next(true);
1229
+ }
1210
1230
  }
1211
1231
  onMouseLeave() {
1212
1232
  this.mouseEntered = false;
1213
- this.hide$.next(false);
1233
+ this.display$.next(false);
1234
+ }
1235
+ onClick() {
1236
+ this.display$.next(false);
1214
1237
  }
1215
1238
  }
1216
1239
  /** @nocollapse */ /** @nocollapse */ TooltipNeoDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TooltipNeoDirective, deps: [{ token: i0.ElementRef }, { token: i1$4.Overlay }, { token: i1$4.OverlayPositionBuilder }, { token: TooltipNeoService }], target: i0.ɵɵFactoryTarget.Directive });
1217
- /** @nocollapse */ /** @nocollapse */ TooltipNeoDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: TooltipNeoDirective, selector: "[apTooltipNeo]", inputs: { apTooltipNeo: "apTooltipNeo" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" } }, usesOnChanges: true, ngImport: i0 });
1240
+ /** @nocollapse */ /** @nocollapse */ TooltipNeoDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: TooltipNeoDirective, selector: "[apTooltipNeo]", inputs: { apTooltipNeo: "apTooltipNeo" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
1218
1241
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TooltipNeoDirective, decorators: [{
1219
1242
  type: Directive,
1220
1243
  args: [{ selector: '[apTooltipNeo]' }]
@@ -1226,6 +1249,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
1226
1249
  }], onMouseLeave: [{
1227
1250
  type: HostListener,
1228
1251
  args: ['mouseleave']
1252
+ }], onClick: [{
1253
+ type: HostListener,
1254
+ args: ['click']
1229
1255
  }] } });
1230
1256
 
1231
1257
  class LabelComponent {