fixed table view placeholder on reference type field

This commit is contained in:
Sofia Papacharalampous 2024-06-21 13:42:35 +03:00
parent 53287b196c
commit 368ee12b51
2 changed files with 12 additions and 6 deletions

View File

@ -40,17 +40,21 @@
<mat-icon>add_circle</mat-icon>
</button>
<span class="mt-1" *ngIf="fieldSet?.multiplicity?.placeholder">{{fieldSet.multiplicity.placeholder}}</span>
<span class="mt-1" *ngIf="!fieldSet?.multiplicity?.placeholder && !fieldSet.multiplicity?.tableView else addTableView">{{'DESCRIPTION-EDITOR.ACTIONS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}</span>
<ng-template #addTableView>
<span class="mt-1">{{'DESCRIPTION-EDITOR.ACTIONS.MULTIPLICITY-ADD-ONE-FIELD-TABLEVIEW' | translate}}</span>
</ng-template>
<span class="mt-1" *ngIf="!fieldSet?.multiplicity?.placeholder">{{'DESCRIPTION-EDITOR.ACTIONS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}</span>
</span>
</div>
</div>
<div *ngIf="fieldSet.hasMultiplicity && fieldSet?.multiplicity?.tableView" class="col-12">
<table class="table table-bordered" style="table-layout: fixed">
<tr>
<th *ngFor="let field of fieldSet.fields; let i = index;" class="text-truncated">{{field.data?.label}}</th>
<th *ngFor="let field of fieldSet.fields; let i = index;" class="text-truncated">
<ng-container *ngIf="field?.data?.fieldType !== descriptionTemplateFieldType.REFERENCE_TYPES else referenceTypeLabel">
{{field.data?.label}}
</ng-container>
<ng-template #referenceTypeLabel>
{{field.data?.label != null && field.data?.label != '' ? field.data?.label: field.data?.referenceType?.name }}
</ng-template>
</th>
<th class="actions"></th>
</tr>
<ng-container *ngFor="let fieldSetItemPropertiesControl of propertiesFormGroup?.get('items')?.controls; let j = index">
@ -82,7 +86,7 @@
<mat-icon>add_circle</mat-icon>
</button>
<span class="mt-1" *ngIf="fieldSet.multiplicity.placeholder">{{fieldSet.multiplicity.placeholder}}</span>
<span class="mt-1" *ngIf="!fieldSet.multiplicity.placeholder">{{('DESCRIPTION-EDITOR.ACTIONS.MULTIPLICITY-ADD-ONE-FIELD' + (fieldSet.multiplicity.tableView?'-TABLEVIEW':'')) | translate}}</span>
<span class="mt-1" *ngIf="!fieldSet.multiplicity.placeholder">{{'DESCRIPTION-EDITOR.ACTIONS.MULTIPLICITY-ADD-ONE-FIELD-TABLEVIEW' | translate}}</span>
</span>
</td>
</tr>

View File

@ -16,6 +16,7 @@ import { AnnotationEntityType } from '@app/core/common/enum/annotation-entity-ty
import { DescriptionFormAnnotationService } from '../../description-form-annotation.service';
import { DescriptionPropertyDefinitionFieldSet } from '@app/core/model/description/description';
import { DescriptionFormService } from '../services/description-form.service';
import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type';
@Component({
selector: 'app-description-form-field-set',
@ -49,6 +50,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
@Input() validationErrorModel: ValidationErrorModel;
annotationsCount: number = 0;
descriptionTemplateFieldType = DescriptionTemplateFieldType;
constructor(
private dialog: MatDialog,