All files / src/components/widget-catalog si-widget-catalog.component.html

100% Statements 81/81
95.83% Branches 23/24
100% Functions 5/5
100% Lines 60/60

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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 11372x 334x 68x     68x   300x       68x   68x 300x 69x 274x 69x 69x         274x   10x   274x 521x 521x 116x   521x   521x   521x 28x           126x       116x   521x 521x   521x 521x 27x   76x 76x     521x 36x   116x   69x     7x 7x   26x     7x   68x     72x 72x   72x 334x   72x 334x 30x   13x   334x 22x     52x   52x 9x 52x     334x 64x     282x 9x 282x     72x  
<div class="si-layout-fixed-height mb-8 mx-0 overflow-auto px-2 pt-2">
  @if (view() === 'list') {
    <div class="si-layout-fixed-height">
      <div class="mx-0 d-flex">
        <si-search-bar class="w-100" colorVariant="base-1" showIcon="true">
          <input
            siSearchBarInput
            [formField]="searchField"
            [placeholder]="searchPlaceholder() | translate"
            [attr.aria-label]="searchPlaceholder() | translate"
          />
        </si-search-bar>
      </div>
      <div class="si-layout-fixed-height text-pre-wrap text-break mt-6">
        @if (filteredWidgetCatalog.length > 0) {
          <span id="widget-catalog-list-description" class="visually-hidden">
            {{ labelWidgetCatalogList | translate }}
          </span>
          <div class="card overflow-auto">
            <ul
              class="list list-divider"
              aria-labelledby="widget-catalog-list-description"
              cdkListbox
              [cdkListboxValue]="selectedWidgets()"
              [cdkListboxMultiple]="multiSelect()"
              (cdkListboxValueChange)="selectWidgets($event.value)"
            >
              @for (widget of filteredWidgetCatalog; track $index) {
                @let widgetState = widgetStates().get(widget.id);
                @let isSelected = selectedWidgets().includes(widget);
                <li
                  class="list-item list-item-action"
                  [cdkOption]="widget"
                  [cdkOptionDisabled]="widgetState?.disabled ?? false"
                  [class.active]="isSelected"
                >
                  @if (multiSelect()) {
                    <input
                      type="checkbox"
                      class="form-check-input list-item-check"
                      aria-hidden="true"
                      tabindex="-1"
                      inert
                      [checked]="isSelected"
                      [disabled]="widgetState?.disabled"
                    />
                  }
                  <si-icon
                    class="list-item-indicator icon"
                    [class.text-disabled]="widgetState?.disabled"
                    [icon]="widget.iconClass || icons.elementSpecialObject"
                  />
                  <span class="list-item-title text-truncate">{{ widget.name | translate }}</span>
                  @if (widgetState?.badge; as badge) {
                    <si-badge
                      class="list-item-primary-action"
                      [type]="widgetState?.added ? 'default' : 'info'"
                      >{{ badge | translate }}</si-badge
                    >
                  }
                  @if (widget.description?.trim(); as description) {
                    <p class="list-item-description">{{ description | translate }}</p>
                  }
                </li>
              }
            </ul>
          </div>
        } @else {
          <div>
            <si-empty-state
              icon="element-search"
              [heading]="labelEmpty"
              [content]="searchTerm ? labelEmptyMessage : undefined"
            />
          </div>
        }
      </div>
    </div>
  }
  <ng-container #editorHost />
</div>
 
<div class="catalog-footer pb-4 px-2">
  <button type="button" class="btn btn-secondary" (click)="onCancel()">{{
    labelCancel | translate
  }}</button>
  @if (showPreviousButton()) {
    <button type="button" class="btn btn-secondary" (click)="onPrevious()">{{
      labelPrevious | translate
    }}</button>
  }
  @if (showNextButton()) {
    <button
      type="button"
      class="btn"
      [class.btn-primary]="view() === 'list'"
      [class.btn-secondary]="view() !== 'list'"
      [disabled]="disableNextButton()"
      (click)="onNext()"
      >{{ labelNext | translate }}</button
    >
  }
  @if (showAddButton()) {
    <button
      type="button"
      class="btn btn-primary"
      [disabled]="disableAddButton()"
      (click)="onAddWidget()"
      >{{ labelAdd | translate }}</button
    >
  }
</div>