Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

2.8 KB
Raw Blame
<div class="op-scrollable-tabs" [ngClass]="classes">
  <div
    #scrollContainer
    class="op-scrollable-tabs--tab-container"
    >
    <ul
      #scrollPane
      class="op-tab-row"
      (scroll)="onScroll()"
      >
      @for (tab of tabs; track tab.id) {
        <li
          class="op-tab-row--tab"
          (dragenter)="startDebouncedTabActivation(tab)"
          (dragleave)="cancelDebouncedTabActivation()"
          [attr.data-tab-id]="tab.id"
          [attr.data-qa-tab-id]="tab.id"
          [attr.data-qa-tab-selected]="tab.id === currentTabId || undefined"
          [attr.data-qa-tab-disabled]="tab.disable || undefined"
          >
          @if (!tab.route) {
            <a
              [href]="tab.path"
              class="op-tab-row--link"
              role="tab"
              [class.op-tab-row--link_selected]="tab.id === currentTabId"
              [class.op-tab-row--link_disabled]="tab.disable !== undefined"
              [attr.aria-selected]="tab.id === currentTabId"
              (click)="clickTab(tab, $event)"
              [attr.title]="tabTitle(tab)"
              [textContent]="tab.name"
              >
            </a>
          }
          @if (tab.route) {
            <a
              [uiSref]="tab.route"
              [uiParams]="tab.routeParams"
              [attr.aria-selected]="tab.id === currentTabId"
              role="tab"
              class="op-tab-row--link"
              uiSrefActive="op-tab-row--link_selected"
              (click)="clickTab(tab, $event)"
              [attr.title]="tabTitle(tab)"
              [class.op-tab-row--link_disabled]="tab.disable !== undefined"
              href=""
              >
              <span [textContent]="tab.name"></span>
              @if (counter(tab) | async; as tabCounter) {
                @if (tab.showCountAsBubble) {
                  <op-tab-count [count]="tabCounter"
                    [attr.data-test-selector]="'tab-counter-' + tab.name"
                   />
                }
                @if (tabCounter > 0 && !tab.showCountAsBubble) {
                  <span
                    data-test-selector="tab-count"
                  > ({{ tabCounter }})</span>
                }
              }
            </a>
          }
        </li>
      }
    </ul>
    <div
      #scrollLeftBtn [hidden]="hideLeftButton"
      class="op-scrollable-tabs--button op-scrollable-tabs--button_left"
      (click)="scrollLeft()"
      >
      <span class="icon-arrow-left2"></span>
    </div>
    <div
      #scrollRightBtn [hidden]="hideRightButton"
      class="op-scrollable-tabs--button op-scrollable-tabs--button_right"
      (click)="scrollRight()"
      >
      <span class="icon-arrow-right2"></span>
    </div>
  </div>
  <ul class="op-scrollable-tabs--actions">
    <ng-content select="[slot=actions]" />
  </ul>
</div>