@ascentgl/ads-ui 21.112.0 → 21.113.0

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.
@@ -6302,6 +6302,8 @@ class AdsDatepickerComponent extends AdsDatetimepickerComponent {
6302
6302
  this.inputModifiedByKeyHandler = false;
6303
6303
  /** @ignore */
6304
6304
  this.elementRef = inject(ElementRef);
6305
+ /** @ignore */
6306
+ this.overlayContainerRef = inject(OverlayContainer);
6305
6307
  }
6306
6308
  /** @ignore */
6307
6309
  ngOnInit() {
@@ -6314,6 +6316,7 @@ class AdsDatepickerComponent extends AdsDatetimepickerComponent {
6314
6316
  ngOnDestroy() {
6315
6317
  super.ngOnDestroy();
6316
6318
  this.intersectionObserver?.disconnect();
6319
+ this.teardownBackdropScrollPassthrough();
6317
6320
  }
6318
6321
  /** @ignore */
6319
6322
  setupIntersectionObserver() {
@@ -6330,6 +6333,69 @@ class AdsDatepickerComponent extends AdsDatetimepickerComponent {
6330
6333
  });
6331
6334
  this.intersectionObserver.observe(this.elementRef.nativeElement);
6332
6335
  }
6336
+ /**
6337
+ * @ignore
6338
+ * When the calendar overlay opens, the CDK backdrop (pointer-events: auto)
6339
+ * covers the entire viewport and intercepts wheel events, preventing scroll
6340
+ * on underlying containers. Forward those events to the nearest scrollable ancestor.
6341
+ */
6342
+ onOpened() {
6343
+ super.onOpened();
6344
+ this.setupBackdropScrollPassthrough();
6345
+ }
6346
+ /** @ignore */
6347
+ onClosed() {
6348
+ this.teardownBackdropScrollPassthrough();
6349
+ super.onClosed();
6350
+ }
6351
+ /** @ignore */
6352
+ setupBackdropScrollPassthrough() {
6353
+ this.teardownBackdropScrollPassthrough();
6354
+ const container = this.overlayContainerRef.getContainerElement();
6355
+ const backdrop = container.querySelector('.cdk-overlay-backdrop');
6356
+ if (!backdrop)
6357
+ return;
6358
+ const scrollTarget = this.findScrollableAncestor(this.elementRef.nativeElement);
6359
+ if (!scrollTarget)
6360
+ return;
6361
+ const cleanupFns = [];
6362
+ // Forward wheel events from the backdrop to the scrollable ancestor
6363
+ // so that the page can still be scrolled while the calendar is open.
6364
+ const onWheel = (event) => {
6365
+ scrollTarget.scrollTop += event.deltaY;
6366
+ scrollTarget.scrollLeft += event.deltaX;
6367
+ };
6368
+ backdrop.addEventListener('wheel', onWheel, { passive: true });
6369
+ cleanupFns.push(() => backdrop.removeEventListener('wheel', onWheel));
6370
+ // Reposition the calendar overlay when the scroll container scrolls,
6371
+ // keeping the popup attached to the input (same behaviour as ads-dropdown).
6372
+ // CDK ScrollDispatcher only detects window scroll and CdkScrollable directives,
6373
+ // not arbitrary overflow containers, so we trigger the update manually.
6374
+ const onScroll = () => {
6375
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6376
+ this.picker?._popupRef?.updatePosition();
6377
+ };
6378
+ scrollTarget.addEventListener('scroll', onScroll, { passive: true });
6379
+ cleanupFns.push(() => scrollTarget.removeEventListener('scroll', onScroll));
6380
+ this.backdropWheelCleanup = () => cleanupFns.forEach((fn) => fn());
6381
+ }
6382
+ /** @ignore */
6383
+ teardownBackdropScrollPassthrough() {
6384
+ this.backdropWheelCleanup?.();
6385
+ this.backdropWheelCleanup = undefined;
6386
+ }
6387
+ /** @ignore - Walk up the DOM to find the first ancestor with overflow-y: auto|scroll */
6388
+ findScrollableAncestor(node) {
6389
+ let current = node.parentElement;
6390
+ while (current) {
6391
+ const { overflowY } = getComputedStyle(current);
6392
+ if (overflowY === 'auto' || overflowY === 'scroll') {
6393
+ return current;
6394
+ }
6395
+ current = current.parentElement;
6396
+ }
6397
+ return null;
6398
+ }
6333
6399
  /** @ignore - Override to dispatch change event on blur when input was modified programmatically */
6334
6400
  touchControls() {
6335
6401
  // Mark controls as touched BEFORE dispatching the change event.