Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

1.9 KB
Raw Blame
<div [class.mb-3]="!compact">
  <div [class.row]="!compact">
    @if (!horizontal && !compact) {
      <div class="d-flex align-items-center position-relative hidden-button-container col-md-3">
        <label class="form-label" [for]="inputId" [ngbTooltip]="showUnsetNote && isUnset ? tipContent: null" placement="end">
          {{title}}
          @if (showUnsetNote && isUnset) {
            <pngx-bs-icon width="0.9em" height="0.9em" name="exclamation-triangle"></pngx-bs-icon>
          }
        </label>
        @if (removable) {
          <button type="button" class="btn btn-sm btn-danger position-absolute left-0" (click)="removed.emit(this)">
            <pngx-bs-icon  name="x" class="me-1"></pngx-bs-icon><ng-container i18n>Remove</ng-container>
          </button>
        }
      </div>
    }
    <div [ngClass]="{'align-items-center': horizontal, 'd-flex': horizontal}">
      <div class="form-check form-switch">
        <input #inputField type="checkbox" class="form-check-input" [id]="inputId" [(ngModel)]="value" [ngModelOptions]="{standalone: true}" (change)="onChange(value)" (blur)="onTouched()" [disabled]="disabled" [attr.aria-label]="compact ? title : null">
        @if (horizontal && !compact) {
          <label class="form-check-label" [class.text-muted]="showUnsetNote && isUnset" [for]="inputId" [ngbTooltip]="showUnsetNote && isUnset ? tipContent: null" placement="end">
            {{title}}
            @if (showUnsetNote && isUnset) {
              <pngx-bs-icon class="ms-1" width="0.9em" height="0.9em" name="exclamation-triangle"></pngx-bs-icon>
            }
          </label>
        }
        @if (hint) {
          <div class="form-text text-muted">{{hint}}</div>
        }
      </div>
    </div>
  </div>
</div>


<ng-template #tipContent>
  <span class="text-light fst-italic" i18n>Note: value has not yet been set and will not apply until explicitly changed</span>
</ng-template>