UNPKG

@pepperi/components

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.1.

167 lines (157 loc) 8.98 kB
<ng-container [ngSwitch]="type"> <ng-container *ngSwitchCase="'reference'"> <ng-container *ngIf="layoutType === LAYOUT_TYPE.PepperiForm; then formBlock; else notFormBlock"></ng-container> <ng-template #formBlock> <div class="pepperi-button-container reference-button"> <pepperi-field-title [label]="label" [required]="required" [disabled]="disabled" [xAlignment]="xAlignment" [showTitle]="showTitle"></pepperi-field-title> <ng-container *ngIf="createNewReference; then newBlock; else existingBlock"></ng-container> <ng-template #newBlock> <button [id]="key" title="{{ formattedValue }}" mat-button class="pepperi-button md regular" (click)="onButtonClicked($event)" [ngClass]="{ disabled: disabled, 'pull-left': xAlignment == '1' || xAlignment == '0', 'pull-right': xAlignment == '2', 'center-alignment': xAlignment == '3' }" > <span class="pull-left flip">{{ 'ReferenceTSA_CreateNew' | translate }}</span> <mat-icon class="pull-right flip" pepperiRtlClass> <svg class="svg-icon"> <use attr.xlink:href="{{ sessionService.svgIcons }}number-plus" (click)="onButtonClicked($event)"></use> </svg> </mat-icon> </button> </ng-template> <ng-template #existingBlock> <!-- <button [id]="key" title="{{ formattedValue }}" mat-button class="pepperi-button md regular" (click)="hrefFunction($event)" [disabled]="disabled" [ngClass]="{ disabled: disabled, 'pull-left': xAlignment == '1' || xAlignment == '0', 'pull-right': xAlignment == '2', 'center-alignment': xAlignment == '3' }"> {{ formattedValue != '' ? formattedValue : label }} </button> <button *ngIf="value" mat-button class="pepperi-button md regular caution" (click)="remove($event)"> <mat-icon> <svg class="svg-icon"> <use attr.xlink:href="{{ sessionService.svgIcons }}system-bin" (click)="onButtonClicked($event)"></use> </svg> </mat-icon> </button> --> <pepperi-group-buttons [buttons]="referenceButtons" [buttonsClass]="'md regular'" [buttonsDisabled]="false" [viewType]="GROUP_BUTTONS_VIEW_TYPE.Split"> </pepperi-group-buttons> </ng-template> </div> </ng-template> <ng-template #notFormBlock> <ng-container *ngTemplateOutlet="linkTemplate"></ng-container> </ng-template> </ng-container> <ng-container *ngSwitchCase="'listofobjects'"> <ng-container *ngIf="layoutType === LAYOUT_TYPE.PepperiForm; then formBlock; else notFormBlock"></ng-container> <ng-template #formBlock> <ng-container *ngTemplateOutlet="buttonTemplate; context: {internal: true}"></ng-container> </ng-template> <ng-template #notFormBlock> <ng-container *ngTemplateOutlet="linkTemplate"></ng-container> </ng-template> </ng-container> <ng-container *ngSwitchCase="'button'"> <ng-container [ngSwitch]="key"> <ng-container *ngSwitchCase="'ObjectMenu'"> <span (click)="onButtonClicked($event)" title="{{ key }}"> <mat-icon> <svg *ngIf="key == 'ObjectMenu'" class="svg-icon"> <use attr.xlink:href="{{ sessionService.svgIcons }}system-menu"></use> </svg> </mat-icon> </span> </ng-container> <ng-container *ngSwitchCase="'Agents' || 'ContactPersons' || 'Buyers'"> <ng-container *ngIf="layoutType === LAYOUT_TYPE.PepperiTable; then tableBlock; else nonTableBlock"></ng-container> <ng-template #nonTableBlock> <ng-container *ngTemplateOutlet="buttonTemplate; context: {internal: true}"></ng-container> </ng-template> <ng-template #tableBlock> <span [id]="key" title="{{ formattedValue }}" class="pepperi-report-input readonly body-sm">{{ formattedValue }}</span> </ng-template> </ng-container> <ng-container *ngSwitchDefault> <ng-container *ngIf="layoutType === LAYOUT_TYPE.PepperiForm; then buttonBlock; else linkBlock"></ng-container> <ng-template #buttonBlock> <ng-container *ngTemplateOutlet="buttonTemplate; context: {internal: false}"></ng-container> </ng-template> <ng-template #linkBlock> <ng-container *ngTemplateOutlet="linkTemplate"></ng-container> </ng-template> </ng-container> </ng-container> </ng-container> </ng-container> <ng-template #buttonTemplate let-internal="internal"> <div class="pepperi-button-container"> <pepperi-field-title [label]="label" [required]="required" [disabled]="disabled" [xAlignment]="xAlignment" [showTitle]="showTitle"></pepperi-field-title> <ng-container *ngIf="internal; then internalButtonTemplate; else regularButtonTemplate"></ng-container> <ng-template #regularButtonTemplate> <button [id]="key" title="{{ formattedValue }}" mat-button class="pepperi-button md regular" dir="{{ xAlignment == '2' ? 'rtl' : 'ltr' }}" (click)="onButtonClicked($event)" [disabled]="disabled" [ngClass]="{disabled: disabled, 'pull-left': xAlignment == '1' || xAlignment == '0', 'pull-right': xAlignment == '2', 'center-alignment': xAlignment == '3'}" > {{ formattedValue }} </button> </ng-template> <ng-template #internalButtonTemplate> <button [id]="key" title="{{ formattedValue }}" mat-button class="pepperi-button md regular" dir="{{ xAlignment == '2' ? 'rtl' : 'ltr' }}" (click)="openReferenceObjectInternal($event)" [disabled]="disabled" [ngClass]="{disabled: disabled, 'pull-left': xAlignment == '1' || xAlignment == '0', 'pull-right': xAlignment == '2', 'center-alignment': xAlignment == '3'}" > <ng-container *ngIf="formattedValue == '0' || formattedValue == ''; then newBlock; else existingBlock"></ng-container> <ng-template #newBlock> <span class="pull-left flip">{{ 'Select' | translate }}&nbsp;</span> <mat-icon> <svg class="svg-icon"> <use attr.xlink:href="{{ sessionService.svgIcons }}number-plus"></use> </svg> </mat-icon> </ng-template> <ng-template #existingBlock> <span class="pull-left flip">{{ formattedValue }}&nbsp;{{ 'Selected' | translate }}&nbsp;</span> <mat-icon> <svg class="svg-icon"> <use attr.xlink:href="{{ sessionService.svgIcons }}system-edit"></use> </svg> </mat-icon> </ng-template> </button> </ng-template> </div> </ng-template> <ng-template #linkTemplate> <ng-container *ngIf="formattedValue?.length > 0; then notEmptyBlock; else emptyBlock"></ng-container> <ng-template #notEmptyBlock> <a href="{{ value }}" (mousedown)="hrefFunction($event)" class="color-link"> <span *ngIf="layoutType === LAYOUT_TYPE.PepperiTable" [id]="key" title="{{ formattedValue }}" class="body-sm pepperi-report-input readonly"> {{ formattedValue }} </span> <span *ngIf="layoutType !== LAYOUT_TYPE.PepperiTable" [id]="key" title="{{ formattedValue }}" class="body-sm pepperi-card-input" style="display: block;"> {{ formattedValue }} </span> </a> </ng-template> <ng-template #emptyBlock> <span>&nbsp;</span> </ng-template> </ng-template>