@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/fesm2020/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 * as i1 from '@angular/cdk/bidi';
17
17
  import { trigger, state, style, transition, animate } from '@angular/animations';
@@ -749,19 +749,18 @@ class MatPaginatedTabHeader {
749
749
  return EMPTY;
750
750
  }
751
751
  return this._items.changes.pipe(startWith(this._items), switchMap((tabItems) => new Observable((observer) => this._ngZone.runOutsideAngular(() => {
752
- const resizeObserver = new ResizeObserver(() => {
753
- observer.next();
754
- });
755
- tabItems.forEach(item => {
756
- resizeObserver.observe(item.elementRef.nativeElement);
757
- });
752
+ const resizeObserver = new ResizeObserver(entries => observer.next(entries));
753
+ tabItems.forEach(item => resizeObserver.observe(item.elementRef.nativeElement));
758
754
  return () => {
759
755
  resizeObserver.disconnect();
760
756
  };
761
757
  }))),
762
758
  // Skip the first emit since the resize observer emits when an item
763
759
  // is observed for new items when the tab is already inserted
764
- skip(1));
760
+ skip(1),
761
+ // Skip emissions where all the elements are invisible since we don't want
762
+ // the header to try and re-render with invalid measurements. See #25574.
763
+ filter(entries => entries.some(e => e.contentRect.width > 0 && e.contentRect.height > 0)));
765
764
  }
766
765
  ngAfterContentChecked() {
767
766
  // If the number of tab labels have changed, check if scrolling should be enabled