@angular/material 14.2.5 → 14.2.6

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.
package/fesm2015/tabs.mjs CHANGED
@@ -11,7 +11,7 @@ import { InjectionToken, Directive, Inject, Optional, TemplateRef, Component, Ch
11
11
  import * as i4 from '@angular/material/core';
12
12
  import { mixinDisabled, mixinColor, mixinDisableRipple, mixinTabIndex, MAT_RIPPLE_GLOBAL_OPTIONS, RippleRenderer, MatCommonModule, MatRippleModule } from '@angular/material/core';
13
13
  import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
14
- import { take, startWith, distinctUntilChanged, takeUntil, switchMap, skip } from 'rxjs/operators';
14
+ import { take, startWith, distinctUntilChanged, takeUntil, switchMap, skip, filter } from 'rxjs/operators';
15
15
  import { Subject, Subscription, fromEvent, of, merge, EMPTY, Observable, timer } from 'rxjs';
16
16
  import { trigger, state, style, transition, animate } from '@angular/animations';
17
17
  import * as i1 from '@angular/cdk/bidi';
@@ -761,19 +761,18 @@ class MatPaginatedTabHeader {
761
761
  return EMPTY;
762
762
  }
763
763
  return this._items.changes.pipe(startWith(this._items), switchMap((tabItems) => new Observable((observer) => this._ngZone.runOutsideAngular(() => {
764
- const resizeObserver = new ResizeObserver(() => {
765
- observer.next();
766
- });
767
- tabItems.forEach(item => {
768
- resizeObserver.observe(item.elementRef.nativeElement);
769
- });
764
+ const resizeObserver = new ResizeObserver(entries => observer.next(entries));
765
+ tabItems.forEach(item => resizeObserver.observe(item.elementRef.nativeElement));
770
766
  return () => {
771
767
  resizeObserver.disconnect();
772
768
  };
773
769
  }))),
774
770
  // Skip the first emit since the resize observer emits when an item
775
771
  // is observed for new items when the tab is already inserted
776
- skip(1));
772
+ skip(1),
773
+ // Skip emissions where all the elements are invisible since we don't want
774
+ // the header to try and re-render with invalid measurements. See #25574.
775
+ filter(entries => entries.some(e => e.contentRect.width > 0 && e.contentRect.height > 0)));
777
776
  }
778
777
  ngAfterContentChecked() {
779
778
  // If the number of tab labels have changed, check if scrolling should be enabled