* Checks if there has been a change in sticky states since last check and applies the correct * sticky styles. Since checking resets the "dirty" state, this should only be performed once * during a change detection and after the inputs are settled (after content check).
()
| 1440 | * during a change detection and after the inputs are settled (after content check). |
| 1441 | */ |
| 1442 | private _checkStickyStates() { |
| 1443 | const stickyCheckReducer = ( |
| 1444 | acc: boolean, |
| 1445 | d: CdkHeaderRowDef | CdkFooterRowDef | CdkColumnDef, |
| 1446 | ) => { |
| 1447 | return acc || d.hasStickyChanged(); |
| 1448 | }; |
| 1449 | |
| 1450 | // Note that the check needs to occur for every definition since it notifies the definition |
| 1451 | // that it can reset its dirty state. Using another operator like `some` may short-circuit |
| 1452 | // remaining definitions and leave them in an unchecked state. |
| 1453 | |
| 1454 | if (this._headerRowDefs.reduce(stickyCheckReducer, false)) { |
| 1455 | this.updateStickyHeaderRowStyles(); |
| 1456 | } |
| 1457 | |
| 1458 | if (this._footerRowDefs.reduce(stickyCheckReducer, false)) { |
| 1459 | this.updateStickyFooterRowStyles(); |
| 1460 | } |
| 1461 | |
| 1462 | if (Array.from(this._columnDefsByName.values()).reduce(stickyCheckReducer, false)) { |
| 1463 | this._stickyColumnStylesNeedReset = true; |
| 1464 | this.updateStickyColumnStyles(); |
| 1465 | } |
| 1466 | } |
| 1467 | |
| 1468 | /** |
| 1469 | * Creates the sticky styler that will be used for sticky rows and columns. Listens |
no test coverage detected