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

Method _getCalculatedZIndex

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

* Calculate what the z-index should be for the element, depending on what directions (top, * bottom, left, right) have been set. It should be true that elements with a top direction * should have the highest index since these are elements like a table header. If any of those * elements are

(element: HTMLElement)

Source from the content-addressed store, hash-verified

411 * elements.
412 */
413 _getCalculatedZIndex(element: HTMLElement): string {
414 const zIndexIncrements = {
415 top: 100,
416 bottom: 10,
417 left: 1,
418 right: 1,
419 };
420
421 let zIndex = 0;
422 // Use `Iterable` instead of `Array` because TypeScript, as of 3.6.3,
423 // loses the array generic type in the `for of`. But we *also* have to use `Array` because
424 // typescript won't iterate over an `Iterable` unless you compile with `--downlevelIteration`
425 for (const dir of STICKY_DIRECTIONS as Iterable<StickyDirection> & StickyDirection[]) {
426 if (element.style[dir]) {
427 zIndex += zIndexIncrements[dir];
428 }
429 }
430
431 return zIndex ? `${zIndex}` : '';
432 }
433
434 /** Gets the widths for each cell in the provided row. */
435 _getCellWidths(row: HTMLElement, recalculateCellWidths = true): number[] {

Callers 2

_removeStickyStyleMethod · 0.95
_addStickyStyleMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected