hide annotations for new descriptions and description template previews

This commit is contained in:
Sofia Papacharalampous 2024-04-30 11:52:50 +03:00
parent bb206125a6
commit 683552707f
11 changed files with 17 additions and 21 deletions

View File

@ -8,7 +8,7 @@
<mat-progress-bar color="primary" mode="indeterminate"></mat-progress-bar> <mat-progress-bar color="primary" mode="indeterminate"></mat-progress-bar>
</div> </div>
<div mat-dialog-content class="definition-content"> <div mat-dialog-content class="definition-content">
<app-description-form *ngIf="formGroup && formGroup.get('properties')" [propertiesFormGroup]="previewPropertiesFormGroup" [descriptionId]="descriptionId" [descriptionTemplate]="descriptionTemplate" [visibilityRulesService]="visibilityRulesService"></app-description-form> <app-description-form *ngIf="formGroup && formGroup.get('properties')" [propertiesFormGroup]="previewPropertiesFormGroup" [descriptionId]="descriptionId" [descriptionTemplate]="descriptionTemplate" [visibilityRulesService]="visibilityRulesService" [isNew]="true"></app-description-form>
</div> </div>
<div mat-mat-dialog-actions *ngIf="formGroup"> <div mat-mat-dialog-actions *ngIf="formGroup">
<div class="col-auto d-flex pb-4 pt-2"> <div class="col-auto d-flex pb-4 pt-2">

View File

@ -104,7 +104,7 @@
</div> </div>
<div [id]="'preview_container'+ form.get('id').value" class="row"> <div [id]="'preview_container'+ form.get('id').value" class="row">
<div *ngIf="previewFieldSet && showPreview && firstField?.get('data')?.get('fieldType')?.value" class="col-12" [@fade-in-fast]> <div *ngIf="previewFieldSet && showPreview && firstField?.get('data')?.get('fieldType')?.value" class="col-12" [@fade-in-fast]>
<app-description-form-field-set class="w-100" [propertiesFormGroup]="previewPropertiesFormGroup" [fieldSet]="previewFieldSet" [visibilityRulesService]="visibilityRulesService"></app-description-form-field-set> <app-description-form-field-set class="w-100" [propertiesFormGroup]="previewPropertiesFormGroup" [fieldSet]="previewFieldSet" [visibilityRulesService]="visibilityRulesService" [hideAnnotations]="true"></app-description-form-field-set>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1 +1 @@
<app-description-form *ngIf="previewPropertiesFormGroup" [propertiesFormGroup]="previewPropertiesFormGroup" [descriptionTemplate]="descriptionTemplate" [visibilityRulesService]="visibilityRulesService"></app-description-form> <app-description-form *ngIf="previewPropertiesFormGroup" [propertiesFormGroup]="previewPropertiesFormGroup" [descriptionTemplate]="descriptionTemplate" [visibilityRulesService]="visibilityRulesService" [isNew]="true"></app-description-form>

View File

@ -65,7 +65,8 @@
[hasFocus]="fieldset.get('id').value === selectedFieldSetId" [hasFocus]="fieldset.get('id').value === selectedFieldSetId"
[datasetProfileId]="datasetProfileId" [datasetProfileId]="datasetProfileId"
[validationErrorModel]="validationErrorModel" [validationErrorModel]="validationErrorModel"
[validationRootPath]="validationRootPath + '.fieldSets[' + i + ']'"> [validationRootPath]="validationRootPath + '.fieldSets[' + i + ']'"
>
</app-description-template-editor-composite-field-component> </app-description-template-editor-composite-field-component>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>

View File

@ -149,7 +149,9 @@
[hidden]="this.step === 0" [hidden]="this.step === 0"
[linkToScroll]="linkToScroll" [linkToScroll]="linkToScroll"
[validationErrorModel]="editorModel.validationErrorModel" [validationErrorModel]="editorModel.validationErrorModel"
(fieldsetFocusChange)="fieldsetIdWithFocus = $event"></app-description-form> [isNew]="isNew"
(fieldsetFocusChange)="fieldsetIdWithFocus = $event"
></app-description-form>
</div> </div>
</div> </div>
</form> </form>

View File

@ -5,7 +5,7 @@
<div class="col"> <div class="col">
<app-description-form-field-set-title class="row" [fieldSet]="fieldSet" [path]="path" [isChild]="isChild"></app-description-form-field-set-title> <app-description-form-field-set-title class="row" [fieldSet]="fieldSet" [path]="path" [isChild]="isChild"></app-description-form-field-set-title>
</div> </div>
<div class="col-auto"> <div *ngIf="!hideAnnotations" class="col-auto">
<button mat-icon-button class="col-auto annotation-icon" (click)="showAnnotations(fieldSet.id)" [disabled]="propertiesFormGroup.disabled"> <button mat-icon-button class="col-auto annotation-icon" (click)="showAnnotations(fieldSet.id)" [disabled]="propertiesFormGroup.disabled">
<mat-icon matTooltip="{{'DATASET-EDITOR.QUESTION.EXTENDED-DESCRIPTION.ANNOTATIONS' | translate}}" [matBadge]="annotationsCount" [matBadgeHidden]="annotationsCount <= 0" matBadgeColor="warn">comment</mat-icon> <mat-icon matTooltip="{{'DATASET-EDITOR.QUESTION.EXTENDED-DESCRIPTION.ANNOTATIONS' | translate}}" [matBadge]="annotationsCount" [matBadgeHidden]="annotationsCount <= 0" matBadgeColor="warn">comment</mat-icon>
</button> </button>

View File

@ -27,6 +27,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
@Input() fieldSet: DescriptionTemplateFieldSet; @Input() fieldSet: DescriptionTemplateFieldSet;
@Input() propertiesFormGroup: UntypedFormGroup; @Input() propertiesFormGroup: UntypedFormGroup;
@Input() descriptionId: Guid; @Input() descriptionId: Guid;
@Input() hideAnnotations: boolean = false;
get isMultiplicityEnabled() { get isMultiplicityEnabled() {
return this.fieldSet.hasMultiplicity && this.fieldSet.multiplicity != null; return this.fieldSet.hasMultiplicity && this.fieldSet.multiplicity != null;

View File

@ -21,7 +21,9 @@
[path]="path + '.' + (i+1)" [path]="path + '.' + (i+1)"
[visibilityRulesService]="visibilityRulesService" [visibilityRulesService]="visibilityRulesService"
[validationErrorModel]="validationErrorModel" [validationErrorModel]="validationErrorModel"
[isChild]="false"></app-description-form-field-set> [isChild]="false"
[hideAnnotations]="isNew"
></app-description-form-field-set>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,14 +1,4 @@
import { import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
EventEmitter,
Input,
OnChanges,
OnInit,
Output,
SimpleChanges
} from '@angular/core';
import { UntypedFormGroup } from '@angular/forms'; import { UntypedFormGroup } from '@angular/forms';
import { DescriptionTemplateSection } from '@app/core/model/description-template/description-template'; import { DescriptionTemplateSection } from '@app/core/model/description-template/description-template';
import { BaseComponent } from '@common/base/base.component'; import { BaseComponent } from '@common/base/base.component';
@ -28,6 +18,7 @@ import { Guid } from '@common/types/guid';
}) })
export class DescriptionFormSectionComponent extends BaseComponent implements OnInit, OnChanges { export class DescriptionFormSectionComponent extends BaseComponent implements OnInit, OnChanges {
@Input() isNew: boolean = false;
@Input() section: DescriptionTemplateSection; @Input() section: DescriptionTemplateSection;
@Input() propertiesFormGroup: UntypedFormGroup; @Input() propertiesFormGroup: UntypedFormGroup;
@Input() visibilityRulesService: VisibilityRulesService; @Input() visibilityRulesService: VisibilityRulesService;

View File

@ -15,7 +15,7 @@
</mat-expansion-panel-header> </mat-expansion-panel-header>
<ng-container *ngFor="let section of page.sections; let i = index;"> <ng-container *ngFor="let section of page.sections; let i = index;">
<div class="row" *ngIf="visibilityRulesService.isVisibleMap[section.id]"> <div class="row" *ngIf="visibilityRulesService.isVisibleMap[section.id]">
<app-description-form-section class="col-12" [section]="section" [path]="(z+1)+'.'+(i+1)" [pathName]="'pages.'+z+'.sections.'+i" [propertiesFormGroup]="propertiesFormGroup" [descriptionId]="descriptionId" [visibilityRulesService]="visibilityRulesService" (askedToScroll)="onAskedToScroll(expansionPanel, $event)" [linkToScroll]="linkToScroll" [validationErrorModel]="validationErrorModel"></app-description-form-section> <app-description-form-section class="col-12" [section]="section" [path]="(z+1)+'.'+(i+1)" [pathName]="'pages.'+z+'.sections.'+i" [propertiesFormGroup]="propertiesFormGroup" [descriptionId]="descriptionId" [visibilityRulesService]="visibilityRulesService" (askedToScroll)="onAskedToScroll(expansionPanel, $event)" [linkToScroll]="linkToScroll" [validationErrorModel]="validationErrorModel" [isNew]="isNew"></app-description-form-section>
</div> </div>
</ng-container> </ng-container>
</mat-expansion-panel> </mat-expansion-panel>

View File

@ -20,8 +20,7 @@ export class DescriptionFormComponent extends BaseComponent implements OnInit, A
@Input() descriptionTemplate: DescriptionTemplate; @Input() descriptionTemplate: DescriptionTemplate;
@Input() visibilityRulesService: VisibilityRulesService; @Input() visibilityRulesService: VisibilityRulesService;
@Input() descriptionId: Guid; @Input() descriptionId: Guid;
@Input() isNew: boolean = false;
// @ViewChild('stepper', { static: false }) stepper: MatStepper; // @ViewChild('stepper', { static: false }) stepper: MatStepper;
@Input() path: string; @Input() path: string;