Skip to content
Snippets Groups Projects
dialog-edit-pab.component.html 2.31 KiB
Newer Older
<h1 mat-dialog-title [innerHTML]="uitextEditPabTitle"></h1>

<form>

  <div mat-dialog-content>

    <!-- récap selection -->

    <!-- champ à modifier -->
    <mat-form-field class="select-form-field">
      <mat-select [placeholder]="uitextVariable" [(value)]="variable">
          <mat-option *ngFor="let v of availableVariables" [value]="v.value">
              {{ v.label }}
          </mat-option>
      </mat-select>
    </mat-form-field>

    <!-- ngDefaultControl : see https://github.com/angular/components/issues/8267 -->
    <mat-radio-group ngDefaultControl [(ngModel)]="varAction" name="varAction">

      <div class="radio-button-and-input-wrapper rbaiw-set-value">
        <mat-radio-button value="set-value">
          {{ uitextSetValue }}
        </mat-radio-button>
        <mat-form-field class="input-form-field">
          <input matInput [(ngModel)]="valueToSet" name="valueToSet" #valueToSetRef="ngModel"
            (keydown.enter)="onEnterPressed($event)" required pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$">
        </mat-form-field>
        <mat-error *ngIf="varAction === 'set-value' && valueToSetRef.invalid">
            {{ uitextMustBeANumber }}
        </mat-error>
      </div>

      <div class="radio-button-and-input-wrapper rbaiw-delta">
        <mat-radio-button value="delta">
          {{ uitextDelta }}
        </mat-radio-button>
        <mat-form-field class="input-form-field">
          <input matInput [(ngModel)]="delta" name="delta" #deltaRef="ngModel"
            (keydown.enter)="onEnterPressed($event)" required pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$">
        </mat-form-field>
        <mat-error *ngIf="varAction === 'delta' && deltaRef.invalid">
            {{ uitextMustBeANumber }}
        </mat-error>
      </div>

      <div class="radio-button-and-input-wrapper">
        <mat-radio-button value="interpolate">
          {{ uitextInterpolate }}
        </mat-radio-button>
      </div>

    </mat-radio-group>

  </div>

  <div mat-dialog-actions [attr.align]="'end'">
    <button mat-raised-button color="primary" [mat-dialog-close]="false" cdkFocusInitial>
      {{ uitextCancel }}
    </button>
    <button mat-raised-button type="submit" color="warn" (click)="applyValues()"
      [disabled]="buttonDisabled(valueToSetRef, deltaRef)">

      {{ uitextSave }}
    </button>
  </div>

</form>