@arsedizioni/ars-utils 21.2.200 → 21.2.202

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.
@@ -2045,7 +2045,11 @@ class ClipperSearchResultManager extends ClipperDocumentManager {
2045
2045
  }
2046
2046
  return this.clipperService.updateState({ documentIds: documentIds, isRead: value })
2047
2047
  .subscribe(r => {
2048
- if (r.success) {
2048
+ if (!r.success) {
2049
+ // soft error
2050
+ this.dialogService.toast(r.message);
2051
+ }
2052
+ else {
2049
2053
  if (item) {
2050
2054
  if (item.isRead !== value) {
2051
2055
  item.isRead = value;
@@ -2837,10 +2841,16 @@ class ClipperPropertyBadgeComponent {
2837
2841
  this.closePopup();
2838
2842
  const popupWidth = 320;
2839
2843
  const fitsRight = event.clientX + popupWidth <= window.innerWidth;
2840
- const position = this.overlay.position().global().top(`${event.clientY}px`);
2841
- const positionStrategy = fitsRight ? position.left(`${event.clientX}px`) : position.centerHorizontally();
2844
+ const buildPositionBelow = () => {
2845
+ const s = this.overlay.position().global().top(`${event.clientY}px`);
2846
+ return fitsRight ? s.left(`${event.clientX}px`) : s.centerHorizontally();
2847
+ };
2848
+ const buildPositionAbove = () => {
2849
+ const s = this.overlay.position().global().bottom(`${window.innerHeight - event.clientY}px`);
2850
+ return fitsRight ? s.left(`${event.clientX}px`) : s.centerHorizontally();
2851
+ };
2842
2852
  const ref = this.overlay.create({
2843
- positionStrategy,
2853
+ positionStrategy: buildPositionBelow(),
2844
2854
  hasBackdrop: true,
2845
2855
  backdropClass: 'cdk-overlay-transparent-backdrop',
2846
2856
  scrollStrategy: this.overlay.scrollStrategies.close(),
@@ -2850,6 +2860,15 @@ class ClipperPropertyBadgeComponent {
2850
2860
  this.closePopup(); });
2851
2861
  ref.backdropClick().pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.closePopup());
2852
2862
  ref.attach(new TemplatePortal(this.popupTpl(), this.viewContainerRef));
2863
+ // After rendering, check if the popup overflows the bottom of the viewport and reposition upward
2864
+ setTimeout(() => {
2865
+ if (!this.overlayRef)
2866
+ return;
2867
+ const rect = ref.overlayElement.getBoundingClientRect();
2868
+ if (rect.bottom > window.innerHeight) {
2869
+ ref.updatePositionStrategy(buildPositionAbove());
2870
+ }
2871
+ });
2853
2872
  this.overlayRef = ref;
2854
2873
  }
2855
2874
  /**