All files / app/form/ext ext.component.html

51.32% Statements 136/265
53.19% Branches 25/47
11.76% Functions 2/17
62.09% Lines 77/124

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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 18951x     51x 12x 51x 51x 2x   12x   51x 51x   51x 51x   2x 2x   2x             51x 2x 1x     2x   2x 2x 4x   1x 2x 2x 4x   4x 8x   2x 4x 2x   2x   2x     1x   51x 26x 7x     26x   7x 26x 96x   7x 26x 9x   32x 1x 32x 10x   32x 144x   9x 32x 18x   9x   32x 14x 4x 4x   10x       10x     2x   4x       9x   7x   51x             51x 2x           51x 2x     2x           2x                 51x   2x     2x           2x                         2x   2x   2x                                      
<ng-container [formGroup]="group"
              cdkDropListGroup>
 
  <label [for]="id + '-tag'" i18n>Tag:</label>
  <div class="form-array">
    <input [id]="id + '-tag'" name="tag" type="text" formControlName="tag">
    @if (showClear) {
      <button type="button" (click)="clear.next()" i18n-title title="New Ext" i18n>🆑️</button>
    }
  </div>
 
  <label [for]="id + '-name'" i18n>Name:</label>
  <input [id]="id + '-name'" name="name" type="text" formControlName="name">
 
  <ng-container [formGroup]="config">
    @if (userTheme && userThemeValues.length) {
      <!-- TODO: replace empty themes with instructions -->
      <label [for]="id + '-userTheme'" i18n>User Theme:</label>
      <div i18n-title title="This theme will be used on every page. Tag page themes will be ignored.">
        <select [id]="id + '-userTheme'" formControlName="userTheme">
          <option [ngValue]="undefined" i18n>default</option>
          @for (t of userThemeValues; track t) {
            <option [ngValue]="t">{{ t }}</option>
          }
        </select>
      </div>
    }
    @if (defaultSort && !user) {
      <label [for]="id + '-defaultSort'" i18n>Default Sort:</label>
      <div class="default-sort bubble">
        <select #defaultSortCreate
                class="default-sort-create"
                [id]="id + '-defaultSort'"
                (input)="addSort($any($event.target).value, defaultSortCreate)">
          <option i18n>+ Add sort</option>
          @for (opt of allSorts; track opt) {
            <option [value]="opt.value">{{ opt.label || opt.value }}</option>
          }
        </select>
        @for (sort of defaultSort.value; track $index; let i = $index) {
          <span class="controls default-sort-row">
            <select [id]="id + '-defaultSort-' + i"
                    (input)="setSortCol(i, $any($event.target).value)">
              @for (opt of allSorts; track opt) {
                <option [value]="opt.value" [selected]="opt.value === sortCol(sort)">{{ opt.label || opt.value }}</option>
              }
            </select>
            @if (sortDir(sort) === "DESC") {
              <button type="button" (click)="setSortDir(i, 'ASC')" i18n-title title="Descending" i18n>🔽️</button>
            } @else {
              <button type="button" (click)="setSortDir(i, 'DESC')" i18n-title title="Ascending" i18n>🔼️</button>
            }
            <button type="button" (click)="removeSort(i)" i18n>&ndash;</button>
          </span>
        }
      </div>
    }
    @if (defaultFilter && !user) {
      <label [for]="id + '-defaultFilter'" i18n>Default Filter:</label>
      <div class="default-filter bubble">
        <select #defaultFilterCreate
                class="default-filter-create"
                [id]="id + '-defaultFilter'"
                (input)="addFilter($any($event.target).value, defaultFilterCreate)">
          <option i18n>+ Add filter</option>
          @for (opt of allFilters; track opt) {
            <option [value]="opt.filter">{{ opt.label || opt.filter }}</option>
          }
        </select>
        @for (filter of defaultFilter.value; track $index; let i = $index) {
          <div class="default-filter-row">
            <span class="controls">
              <select [id]="id + '-defaultFilter-' + i"
                      (input)="setFilter(i, $any($event.target).value)">
                @if (!hasFilterOption(filter)) {
                  <option [value]="filter" selected>{{ filterOptionLabel(filter) }}</option>
                }
                @for (opt of allFilters; track opt) {
                  <option [value]="opt.filter" [selected]="opt.filter === filterOption(filter)">{{ opt.label || opt.filter }}</option>
                }
              </select>
              @if (negatable(filter)) {
                <button class="default-filter-negate" type="button" (click)="toggleFilter(i)">{{ store.account.querySymbol('!') }}</button>
              }
              <button type="button" (click)="removeFilter(i)" i18n>&ndash;</button>
            </span>
            @if (filterIsDate(filter)) {
              @if (store.hotkey || filterSpecialDate(filter)) {
                <span class="default-filter-date-range">
                  <input type="range"
                         min="0"
                         [max]="datePresets.length - 1"
                         step="1"
                         [value]="filterDatePreset(filter)"
                         (input)="setFilterDatePreset(i, filter, $any($event.target).value)">
                  <output>{{ filterDateLabel(filter) }}</output>
                </span>
              } @else {
                <input type="datetime-local"
                       step="60"
                       [value]="filterDate(filter)"
                       (change)="setFilterDate(i, filter, $any($event.target).value)">
              }
            }
          </div>
        }
      </div>
    }
    @if (form) {
      <formly-form #mainFormlyForm
                   class="nested-form"
                   [form]="config"
                   [fields]="form"
                   [options]="options"></formly-form>
    }
    @if (modmail && inbox && !user) {
      <label [for]="id + '-modmail'" i18n>Enable Modmail:</label>
      <div>
        <input [id]="id + '-modmail'" type="checkbox" [formControl]="modmail">
        <a class="tag" [routerLink]="['/tag', inbox]">{{ inbox }}</a>
      </div>
    }
    @if (themes) {
      <label [for]="id + '-theme'" i18n>Tag Page Theme:</label>
      <div>
        <select [id]="id + '-theme'" formControlName="theme">
          <option [ngValue]="undefined" i18n>default</option>
          @for (t of themeValues; track t) {
            <option [ngValue]="t">{{ t }}</option>
          }
        </select>
        <details class="advanced mini">
          <summary i18n-title title="Custom Themes"><span><span class="summary-open" i18n>Custom Themes</span></span></summary>
          <app-themes id="themes"
                      [group]="config"
                      fieldName="themes"></app-themes>
        </details>
      </div>
    }
  </ng-container>
 
  @if (advancedForm?.length) {
    <details class="advanced">
      <summary><span i18n>Advanced</span></summary>
      <div class="form">
        @if (defaultSort && user) {
          <label [for]="id + '-defaultSortAdvanced'" i18n>Default Sort:</label>
          <div class="default-sort bubble">
            <select #defaultSortAdvancedCreate
                    class="default-sort-create"
                    [id]="id + '-defaultSortAdvanced'"
                    (input)="addSort($any($event.target).value, defaultSortAdvancedCreate)">
              <option i18n>+ Add sort</option>
              @for (opt of allSorts; track opt) {
                <option [value]="opt.value">{{ opt.label || opt.value }}</option>
              }
            </select>
            @for (sort of defaultSort.value; track $index; let i = $index) {
              <span class="controls default-sort-row">
                <select (input)="setSortCol(i, $any($event.target).value)">
                  @for (opt of allSorts; track opt) {
                    <option [value]="opt.value" [selected]="opt.value === sortCol(sort)">{{ opt.label || opt.value }}</option>
                  }
                </select>
                @if (sortDir(sort) === "DESC") {
                  <button type="button" (click)="setSortDir(i, 'ASC')" i18n-title title="Descending" i18n>🔽️</button>
                } @else {
                  <button type="button" (click)="setSortDir(i, 'DESC')" i18n-title title="Ascending" i18n>🔼️</button>
                }
                <button type="button" (click)="removeSort(i)" i18n>&ndash;</button>
              </span>
            }
          </div>
        }
        <formly-form #advancedFormlyForm
                     class="nested-form"
                     [form]="config"
                     [fields]="advancedForm!"
                     [options]="options"></formly-form>
      </div>
      @if (defaults) {
        <app-ref class="bubble" [ref]="defaults"></app-ref>
      } @else if (loadingDefaults) {
        <app-loading></app-loading>
      }
    </details>
  }
</ng-container>