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

Method clearStickyPositioning

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

* Clears the sticky positioning styles from the row and its cells by resetting the `position` * style, setting the zIndex to 0, and unsetting each provided sticky direction. * @param rows The list of rows that should be cleared from sticking in the provided directions * @param stickyDirecti

(rows: HTMLElement[], stickyDirections: StickyDirection[])

Source from the content-addressed store, hash-verified

82 * @param stickyDirections The directions that should no longer be set as sticky on the rows.
83 */
84 clearStickyPositioning(rows: HTMLElement[], stickyDirections: StickyDirection[]) {
85 if (stickyDirections.includes('left') || stickyDirections.includes('right')) {
86 this._removeFromStickyColumnReplayQueue(rows);
87 }
88
89 const elementsToClear: HTMLElement[] = [];
90 for (const row of rows) {
91 // If the row isn't an element (e.g. if it's an `ng-container`),
92 // it won't have inline styles or `children` so we skip it.
93 if (row.nodeType !== row.ELEMENT_NODE) {
94 continue;
95 }
96
97 elementsToClear.push(row, ...(Array.from(row.children) as HTMLElement[]));
98 }
99
100 // Coalesce with sticky row/column updates (and potentially other changes like column resize).
101 afterNextRender(
102 {
103 write: () => {
104 for (const element of elementsToClear) {
105 this._removeStickyStyle(element, stickyDirections);
106 }
107 },
108 },
109 {
110 injector: this._tableInjector,
111 },
112 );
113 }
114
115 /**
116 * Applies sticky left and right positions to the cells of each row according to the sticky

Calls 3

_removeStickyStyleMethod · 0.95
pushMethod · 0.65

Tested by

no test coverage detected