All files / element-ng/tree-view si-tree-view.component.html

92.98% Statements 53/57
93.75% Branches 15/16
66.66% Functions 4/6
100% Lines 38/38

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73653x 3x       10x   2x   10x 3x 3x     10x   1x   10x 3x     653x 13x       31x 31x 13x   13x 31x 7x     16x 16x 7x   7x 16x   13x   115x               653x       653x 608x   653x 115x 115x 653x 96x   115x   653x 608x   115x  
@if (!flatTree() && expandCollapseAll()) {
  <div class="si-tree-view-expand-collapse-container p-4">
    <button
      class="btn btn-icon btn-tertiary"
      type="button"
      [title]="expandAllTooltip() | translate"
      [attr.aria-label]="expandAllTooltip() | translate"
      (click)="expandAll()"
    >
      <si-icon [icon]="svgIcons.elementExpandAll" />
    </button>
    <button
      class="btn btn-icon btn-tertiary ms-4"
      type="button"
      [title]="collapseAllTooltip() | translate"
      [attr.aria-label]="collapseAllTooltip() | translate"
      (click)="collapseAll()"
    >
      <si-icon [icon]="svgIcons.elementCollapseAll" />
    </button>
  </div>
}
@if (flatTree()) {
  <div class="si-tree-view-header">
    <span
      class="si-tree-view-header-btn si-tree-view-header-root"
      tabindex="0"
      [class]="computedIcons().headerHome"
      [class.disabled]="headerShowsRoot"
      (click)="onFlatTreeNavigateHome()"
      (keydown.enter)="onFlatTreeNavigateHome()"
    ></span>
    @if (lastBreadCrumbItem) {
      <span
        class="si-tree-view-header-btn"
        tabindex="0"
        [class]="computedIcons().headerArrow"
        [class.disabled]="headerShowsRoot"
        (click)="onFlatTreeNavigateUp()"
        (keydown.enter)="onFlatTreeNavigateUp()"
      ></span>
      <span class="text-center text-truncate">{{ lastBreadCrumbItem.label | translate }}</span>
    }
  </div>
}
<div
  #treeViewInner
  cdkScrollable
  class="si-tree-view focus-inside"
  role="tree"
  [attr.aria-multiselectable]="!singleSelectMode()"
  [attr.aria-label]="ariaLabel() ? (ariaLabel() | translate) : undefined"
  [attr.aria-labelledby]="ariaLabelledBy()"
  [class.si-tree-horizontal-scroll]="horizontalScrolling()"
  [class.si-tree-view-flat]="flatTree()"
  [class.si-tree-expand-collapse]="!flatTree() && expandCollapseAll()"
>
  @if (isVirtualized()) {
    <div [class.w-100]="horizontalScrolling()" [style.height]="heightBefore"></div>
  }
  @if (itemsVirtualized) {
    <div class="si-tree-view-root-ul">
      <ng-content select="[cdkDropList], [siTreeViewItem]" />
      @if (!treeItemContentTemplate()) {
        <si-tree-view-item *siTreeViewItem="let index = index; let treeItem = treeItem" />
      }
    </div>
  }
  @if (isVirtualized()) {
    <div [class.w-100]="horizontalScrolling()" [style.height]="heightAfter"></div>
  }
</div>