MCPcopy Create free account
hub / github.com/angular/components / _updateCachedSizes

Method _updateCachedSizes

src/cdk/table/sticky-styler.ts:536–582  ·  view source on GitHub ↗

Update _elemSizeCache with the observed sizes.

(entries: ResizeObserverEntry[])

Source from the content-addressed store, hash-verified

534
535 /** Update _elemSizeCache with the observed sizes. */
536 private _updateCachedSizes(entries: ResizeObserverEntry[]) {
537 let needsColumnUpdate = false;
538 for (const entry of entries) {
539 const newEntry = entry.borderBoxSize?.length
540 ? {
541 width: entry.borderBoxSize[0].inlineSize,
542 height: entry.borderBoxSize[0].blockSize,
543 }
544 : {
545 width: entry.contentRect.width,
546 height: entry.contentRect.height,
547 };
548
549 if (
550 newEntry.width !== this._elemSizeCache.get(entry.target as HTMLElement)?.width &&
551 isCell(entry.target)
552 ) {
553 needsColumnUpdate = true;
554 }
555
556 this._elemSizeCache.set(entry.target as HTMLElement, newEntry);
557 }
558
559 if (needsColumnUpdate && this._updatedStickyColumnsParamsToReplay.length) {
560 if (this._stickyColumnsReplayTimeout) {
561 clearTimeout(this._stickyColumnsReplayTimeout);
562 }
563
564 this._stickyColumnsReplayTimeout = setTimeout(() => {
565 if (this._destroyed) {
566 return;
567 }
568
569 for (const update of this._updatedStickyColumnsParamsToReplay) {
570 this.updateStickyColumns(
571 update.rows,
572 update.stickyStartStates,
573 update.stickyEndStates,
574 true,
575 false,
576 );
577 }
578 this._updatedStickyColumnsParamsToReplay = [];
579 this._stickyColumnsReplayTimeout = null;
580 }, 0);
581 }
582 }
583}
584
585function isCell(element: Element) {

Callers 2

StickyStylerClass · 0.95
resize-strategy.tsFile · 0.80

Calls 4

updateStickyColumnsMethod · 0.95
isCellFunction · 0.85
setMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected