@ibragim-dev-org/ui-forge-library 1.4.69 → 1.4.71

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.
@@ -1,6 +1,6 @@
1
1
  import * as i2 from '@angular/router';
2
2
  import { NavigationEnd, NavigationStart, ActivationEnd } from '@angular/router';
3
- import { BehaviorSubject, filter, take, scheduled, fromEvent, asyncScheduler, mergeAll, tap, debounceTime, Subject, Subscription, timer, switchMap, interval, takeWhile, finalize, takeUntil as takeUntil$1 } from 'rxjs';
3
+ import { BehaviorSubject, filter, take, scheduled, fromEvent, asyncScheduler, mergeAll, tap, debounceTime, Subject, Subscription, timer, switchMap, interval, takeWhile, finalize, ReplaySubject, takeUntil as takeUntil$1 } from 'rxjs';
4
4
  import * as i0 from '@angular/core';
5
5
  import { model, effect, Directive, Injectable, output, Input, input, PLATFORM_ID, Inject, EventEmitter, Output, signal, inject, Pipe, Attribute, ChangeDetectionStrategy, Component, computed, viewChild, untracked, Injector, afterRenderEffect, contentChildren, contentChild, ViewChildren } from '@angular/core';
6
6
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -637,11 +637,27 @@ class StickyObserverDirective {
637
637
  this.renderer.setStyle(this.sentinel, 'opacity', '0');
638
638
  const parent = stickyEl.parentElement;
639
639
  parent.insertBefore(this.sentinel, stickyEl);
640
- this.observer = new IntersectionObserver(([entry]) => {
641
- this.$isStuck.set(entry.boundingClientRect.top < 0);
642
- }, { threshold: [1] });
640
+ const root = this.findScrollParent(stickyEl);
641
+ const stickyTop = parseFloat(getComputedStyle(stickyEl).top) || 0;
642
+ // The sentinel is "stuck" once it leaves the scroll root through the sticky offset line.
643
+ this.observer = new IntersectionObserver((entries) => {
644
+ const entry = entries[entries.length - 1];
645
+ const rootTop = entry.rootBounds?.top ?? 0;
646
+ this.$isStuck.set(!entry.isIntersecting && entry.boundingClientRect.top < rootTop);
647
+ }, { root, rootMargin: `-${Math.ceil(stickyTop)}px 0px 0px 0px`, threshold: [0, 1] });
643
648
  this.observer.observe(this.sentinel);
644
649
  }
650
+ findScrollParent(el) {
651
+ let node = el.parentElement;
652
+ while (node) {
653
+ const overflowY = getComputedStyle(node).overflowY;
654
+ if (overflowY === 'auto' || overflowY === 'scroll') {
655
+ return node;
656
+ }
657
+ node = node.parentElement;
658
+ }
659
+ return null;
660
+ }
645
661
  ngOnDestroy() {
646
662
  this.observer?.disconnect();
647
663
  this.sentinel?.remove();
@@ -2317,8 +2333,9 @@ class UiPopupInstance {
2317
2333
  triggerPulse$ = new Subject();
2318
2334
  isHide$ = new Subject();
2319
2335
  closed = new Subject();
2320
- shouldClose = new Subject();
2321
- isClosing = false;
2336
+ // Replayed so a container that subscribes after close() (before its first change detection) still closes.
2337
+ shouldClose = new ReplaySubject(1);
2338
+ closing = false;
2322
2339
  constructor(overlayRef, destroyRef, onClose = () => { }, options = {
2323
2340
  startOrigin: 'center center',
2324
2341
  endOrigin: 'center center',
@@ -2342,11 +2359,14 @@ class UiPopupInstance {
2342
2359
  }), takeUntilDestroyed(this.destroyRef))
2343
2360
  .subscribe();
2344
2361
  }
2362
+ get isClosing() {
2363
+ return this.closing;
2364
+ }
2345
2365
  close() {
2346
- if (this.isClosing) {
2366
+ if (this.closing) {
2347
2367
  return;
2348
2368
  }
2349
- this.isClosing = true;
2369
+ this.closing = true;
2350
2370
  this.onClose();
2351
2371
  this.shouldClose.next();
2352
2372
  this.shouldClose.complete();
@@ -2577,7 +2597,9 @@ class UiPopupContainerDirective {
2577
2597
  topStart: animationParams.topStart,
2578
2598
  topEnd: animationParams.topEnd,
2579
2599
  });
2580
- this.$isShow.set(true);
2600
+ if (!this.popupInstance.isClosing) {
2601
+ this.$isShow.set(true);
2602
+ }
2581
2603
  }), takeUntil$1(this.destroyAnimationOrigin$), takeUntilDestroyed(this.destroyRef))
2582
2604
  .subscribe();
2583
2605
  if (isBrowser()) {
@@ -3520,7 +3542,10 @@ class HoverTipDirective {
3520
3542
  $offsetX = input(0, { ...(ngDevMode ? { debugName: "$offsetX" } : {}), alias: 'appHoverTipOffsetX' });
3521
3543
  $offsetY = input(0, { ...(ngDevMode ? { debugName: "$offsetY" } : {}), alias: 'appHoverTipOffsetY' });
3522
3544
  tipId = `hover-tip-${HoverTipDirective.instanceCounter++}`;
3523
- isOpen = false;
3545
+ // Derived from the service: the tip can also be closed externally (Escape, closeAll on scroll/navigation).
3546
+ get isOpen() {
3547
+ return this.uiDropdownService.instances.some((instance) => instance.id === this.tipId);
3548
+ }
3524
3549
  constructor(hostRef, uiDropdownService, destroyRef) {
3525
3550
  this.hostRef = hostRef;
3526
3551
  this.uiDropdownService = uiDropdownService;
@@ -3556,14 +3581,12 @@ class HoverTipDirective {
3556
3581
  return;
3557
3582
  }
3558
3583
  this.uiDropdownService.openTip(text, this.hostRef.nativeElement, this.tipId, this.$position(), this.$offsetY(), this.$offsetX());
3559
- this.isOpen = true;
3560
3584
  }
3561
3585
  closeTip() {
3562
3586
  if (!this.isOpen) {
3563
3587
  return;
3564
3588
  }
3565
3589
  this.uiDropdownService.closeById(this.tipId);
3566
- this.isOpen = false;
3567
3590
  }
3568
3591
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: HoverTipDirective, deps: [{ token: i0.ElementRef }, { token: UiDropdownService }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Directive });
3569
3592
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.1", type: HoverTipDirective, isStandalone: true, selector: "[appHoverTip]", inputs: { $text: { classPropertyName: "$text", publicName: "appHoverTip", isSignal: true, isRequired: true, transformFunction: null }, $debounceTime: { classPropertyName: "$debounceTime", publicName: "$debounceTime", isSignal: true, isRequired: false, transformFunction: null }, $position: { classPropertyName: "$position", publicName: "appHoverTipPosition", isSignal: true, isRequired: false, transformFunction: null }, $offsetX: { classPropertyName: "$offsetX", publicName: "appHoverTipOffsetX", isSignal: true, isRequired: false, transformFunction: null }, $offsetY: { classPropertyName: "$offsetY", publicName: "appHoverTipOffsetY", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });