various ui fixes

This commit is contained in:
Diamantis Tziotzios 2024-01-19 14:28:31 +02:00
parent 9356352e7d
commit c4dac0e7d0
27 changed files with 178 additions and 152 deletions

View File

@ -146,7 +146,7 @@ public class DmpDescriptionTemplateBuilder extends BaseBuilder<DmpDescriptionTem
}, },
DescriptionTemplate::getGroupId); DescriptionTemplate::getGroupId);
} else { } else {
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._id); FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._id, DescriptionTemplate._groupId);
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(this.authorize).versionStatuses(DescriptionTemplateVersionStatus.Current).groupIds(data.stream().map(DmpDescriptionTemplateEntity::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList())); DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(this.authorize).versionStatuses(DescriptionTemplateVersionStatus.Current).groupIds(data.stream().map(DmpDescriptionTemplateEntity::getDescriptionTemplateGroupId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DescriptionTemplate::getGroupId); itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(this.authorize).asForeignKey(q, clone, DescriptionTemplate::getGroupId);
} }

View File

@ -67,7 +67,7 @@ public class DefinitionPersist {
this.spec() this.spec()
.must(() -> !this.isNull(item.getSections())) .must(() -> !this.isNull(item.getSections()))
.failOn(DefinitionPersist._sections).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._sections}, LocaleContextHolder.getLocale())), .failOn(DefinitionPersist._sections).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._sections}, LocaleContextHolder.getLocale())),
this.refSpec() this.navSpec()
.iff(() -> !this.isNull(item.getSections())) .iff(() -> !this.isNull(item.getSections()))
.on(DefinitionPersist._sections) .on(DefinitionPersist._sections)
.over(item.getSections()) .over(item.getSections())
@ -75,7 +75,7 @@ public class DefinitionPersist {
this.spec() this.spec()
.must(() -> !this.isNull(item.getPages())) .must(() -> !this.isNull(item.getPages()))
.failOn(DefinitionPersist._pages).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._pages}, LocaleContextHolder.getLocale())), .failOn(DefinitionPersist._pages).failWith(messageSource.getMessage("Validation_Required", new Object[]{DefinitionPersist._pages}, LocaleContextHolder.getLocale())),
this.refSpec() this.navSpec()
.iff(() -> !this.isNull(item.getPages())) .iff(() -> !this.isNull(item.getPages()))
.on(DefinitionPersist._pages) .on(DefinitionPersist._pages)
.over(item.getPages()) .over(item.getPages())

View File

@ -1,6 +1,7 @@
import { LockTargetType } from '@app/core/common/enum/lock-target-type'; import { LockTargetType } from '@app/core/common/enum/lock-target-type';
import { Guid } from '@common/types/guid'; import { Guid } from '@common/types/guid';
import { User } from '../user/user'; import { User } from '../user/user';
import { BaseEntityPersist } from '@common/base/base-entity.model';
export interface Lock { export interface Lock {
id: Guid; id: Guid;
@ -14,10 +15,8 @@ export interface Lock {
// Persist // Persist
export interface LockPersist { export interface LockPersist extends BaseEntityPersist {
id: Guid;
target: Guid; target: Guid;
targetType: LockTargetType; targetType: LockTargetType;
lockedBy: User; lockedBy: Guid;
hash: String;
} }

View File

@ -242,7 +242,6 @@ export class AuthService extends BaseService {
scope: this.installationConfiguration.keycloak.scope, scope: this.installationConfiguration.keycloak.scope,
}) })
.then(() => { .then(() => {
console.log('Keycloak Login');
this.keycloakService.keycloakEvents$.subscribe({ this.keycloakService.keycloakEvents$.subscribe({
next: (e) => { next: (e) => {
if ( if (

View File

@ -1,15 +1,20 @@
import { ChangeDetectionStrategy, Component, Input } from "@angular/core"; import { ChangeDetectionStrategy, Component, Input } from "@angular/core";
import { FormControl } from "@angular/forms";
import { AngularEditorConfig } from "@kolkov/angular-editor"; import { AngularEditorConfig } from "@kolkov/angular-editor";
@Component({ @Component({
selector: 'rich-text-editor-component', selector: 'rich-text-editor-component',
template: ` template: `
<div class="editor-wrapper" [class]="wrapperClasses" [formGroup]="parentFormGroup"> <div class="editor-wrapper" [class]="wrapperClasses">
<angular-editor class="full-width editor" [ngClass]="editable ? '': 'disabled'" [id]="id" <!-- <angular-editor class="full-width editor" [ngClass]="editable ? '': 'disabled'" [id]="id"
[config]="editorConfig" [formControlName]="controlName" [config]="editorConfig" [formControl]="form"
placeholder="{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}" placeholder="{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}"
(paste)="pasteWithoutFormatting($event)"></angular-editor> (paste)="pasteWithoutFormatting($event)"></angular-editor>
<mat-icon *ngIf="parentFormGroup.get(controlName).value && editable" (click)="parentFormGroup.get(controlName).patchValue('')" class="clear">close</mat-icon> <mat-icon *ngIf="form.value && editable" (click)="parentFormGroup.get(controlName).patchValue('')" class="clear">close</mat-icon> -->
<mat-form-field class="full-width editor">
<mat-label>{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}</mat-label>
<textarea matInput [formControl]="form" rows="5" placeholder="{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}"></textarea>
</mat-form-field>
</div> </div>
`, `,
styleUrls: ['./rich-text-editor.component.scss'], styleUrls: ['./rich-text-editor.component.scss'],
@ -17,8 +22,7 @@ import { AngularEditorConfig } from "@kolkov/angular-editor";
changeDetection: ChangeDetectionStrategy.OnPush changeDetection: ChangeDetectionStrategy.OnPush
}) })
export class RichTextEditorComponent { export class RichTextEditorComponent {
@Input() parentFormGroup; @Input() form: FormControl;
@Input() controlName;
@Input() id: string = "editor1"; @Input() id: string = "editor1";
@Input() placeholder: string = "Enter text"; @Input() placeholder: string = "Enter text";
@Input() required: boolean = false; @Input() required: boolean = false;

View File

@ -14,12 +14,12 @@
<div style="position: relative;" class="col-12" *ngIf="hasFocus" [@fade-in]> <div style="position: relative;" class="col-12" *ngIf="hasFocus" [@fade-in]>
<div *ngIf="showDescription" class="mb-4"> <div *ngIf="showDescription" class="mb-4">
<h5 style="font-weight: bold" class="row">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION' | translate}}</h5> <h5 style="font-weight: bold" class="row">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION' | translate}}</h5>
<rich-text-editor-component [parentFormGroup]="form" [controlName]="'description'" [id]="'editor1'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION'" [wrapperClasses]="'row'"> <rich-text-editor-component [form]="form.get('description')" [id]="'editor1'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION'" [wrapperClasses]="'row'">
</rich-text-editor-component> </rich-text-editor-component>
</div> </div>
<div *ngIf="showExtendedDescription" class="mb-4"> <div *ngIf="showExtendedDescription" class="mb-4">
<h5 style="font-weight: bold" class="row">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION' | translate}}</h5> <h5 style="font-weight: bold" class="row">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION' | translate}}</h5>
<rich-text-editor-component [parentFormGroup]="form" [controlName]="'extendedDescription'" [id]="'editor2'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION'" [wrapperClasses]="'row'"> <rich-text-editor-component [form]="form.get('extendedDescription')" [id]="'editor2'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION'" [wrapperClasses]="'row'">
</rich-text-editor-component> </rich-text-editor-component>
</div> </div>
<div class="row" *ngIf="showAdditionalInfo"> <div class="row" *ngIf="showAdditionalInfo">

View File

@ -10,7 +10,7 @@
<div class="heading col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION-DESCRIPTION' | translate}} </div> <div class="heading col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION-DESCRIPTION' | translate}} </div>
<div class="hint col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION-DESCRIPTION-HINT' | translate}}</div> <div class="hint col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.SECTION-INFO.SECTION-DESCRIPTION-HINT' | translate}}</div>
<div class="col-12"> <div class="col-12">
<rich-text-editor-component [parentFormGroup]="form" [controlName]="'description'" <rich-text-editor-component [form]="form.get('description')"
[placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.SECTION.FIELDS.DESCRIPTION'"> [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.SECTION.FIELDS.DESCRIPTION'">
</rich-text-editor-component> </rich-text-editor-component>
</div> </div>

View File

@ -76,7 +76,7 @@
<!-- <div class="hint">{{'DMP-EDITOR.MAIN-INFO.HINT' | translate}}</div> --> <!-- <div class="hint">{{'DMP-EDITOR.MAIN-INFO.HINT' | translate}}</div> -->
<div class="hint">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-DESCRIPTION-HINT'| translate}}</div> <div class="hint">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-DESCRIPTION-HINT'| translate}}</div>
<div class="full-width basic-info-input"> <div class="full-width basic-info-input">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'"> <rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'">
</rich-text-editor-component> </rich-text-editor-component>
<div [class]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'visible' : 'invisible'" class="mat-form-field formGroup-field-subscript-wrapper"> <div [class]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'visible' : 'invisible'" class="mat-form-field formGroup-field-subscript-wrapper">
<mat-error> <mat-error>

View File

@ -31,8 +31,10 @@ export class DescriptionTemplateEditorModel extends BaseEditorModel implements D
if (item) { if (item) {
super.fromModel(item); super.fromModel(item);
this.label = item.label; this.label = item.label;
this.status = item.status;
this.description = item.description; this.description = item.description;
this.language = item.language;
this.type = item.type?.id;
this.status = item.status;
this.definition = new DescriptionTemplateDefinitionEditorModel().fromModel(item.definition); this.definition = new DescriptionTemplateDefinitionEditorModel().fromModel(item.definition);
if (item.users) { item.users.map(x => this.users.push(new UserDescriptionTemplateEditorModel().fromModel(x))); } if (item.users) { item.users.map(x => this.users.push(new UserDescriptionTemplateEditorModel().fromModel(x))); }
} }

View File

@ -1,5 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { DescriptionTemplateType } from '@app/core/model/description-template-type/description-template-type';
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection } from '@app/core/model/description-template/description-template'; import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection } from '@app/core/model/description-template/description-template';
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
@ -22,8 +23,12 @@ export class DescriptionTemplateEditorResolver extends BaseEditorResolver {
nameof<DescriptionTemplate>(x => x.label), nameof<DescriptionTemplate>(x => x.label),
nameof<DescriptionTemplate>(x => x.status), nameof<DescriptionTemplate>(x => x.status),
nameof<DescriptionTemplate>(x => x.description), nameof<DescriptionTemplate>(x => x.description),
nameof<DescriptionTemplate>(x => x.language),
nameof<DescriptionTemplate>(x => x.status), nameof<DescriptionTemplate>(x => x.status),
[nameof<DescriptionTemplate>(x => x.type), nameof<DescriptionTemplateType>(x => x.id)].join('.'),
[nameof<DescriptionTemplate>(x => x.type), nameof<DescriptionTemplateType>(x => x.name)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.id)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.id)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.ordinal)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.ordinal)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.title)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.title)].join('.'),

View File

@ -52,7 +52,7 @@
<div class="col-12"> <div class="col-12">
<h3>{{'REFERENCE-EDITOR.FIELDS.DESCRIPTION' | translate}}</h3> <h3>{{'REFERENCE-EDITOR.FIELDS.DESCRIPTION' | translate}}</h3>
<div class="col-12"> <div class="col-12">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'REFERENCE-EDITOR.FIELDS.DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'"> <rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'REFERENCE-EDITOR.FIELDS.DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'">
</rich-text-editor-component> </rich-text-editor-component>
<div [class]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'visible' : 'invisible'" class="mat-form-field formGroup-field-subscript-wrapper"> <div [class]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'visible' : 'invisible'" class="mat-form-field formGroup-field-subscript-wrapper">
<mat-error *ngIf="formGroup.get('description').hasError('backendError')">{{formGroup.get('description').getError('backendError').message}}</mat-error> <mat-error *ngIf="formGroup.get('description').hasError('backendError')">{{formGroup.get('description').getError('backendError').message}}</mat-error>

View File

@ -47,7 +47,7 @@
<div class="col-12"> <div class="col-12">
<h3>{{'TENANT-EDITOR.FIELDS.DESCRIPTION' | translate}}</h3> <h3>{{'TENANT-EDITOR.FIELDS.DESCRIPTION' | translate}}</h3>
<div class="col-12"> <div class="col-12">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'TENANT-EDITOR.FIELDS.DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'"> <rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'TENANT-EDITOR.FIELDS.DESCRIPTION-PLACEHOLDER'" [wrapperClasses]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'required' : ''" [editable]="formGroup.controls['description'].status !== 'DISABLED'">
</rich-text-editor-component> </rich-text-editor-component>
<div [class]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'visible' : 'invisible'" class="mat-form-field formGroup-field-subscript-wrapper"> <div [class]="(formGroup.get('description').touched && formGroup.get('description').hasError('required')) ? 'visible' : 'invisible'" class="mat-form-field formGroup-field-subscript-wrapper">
<mat-error *ngIf="formGroup.get('description').hasError('backendError')">{{formGroup.get('description').getError('backendError').message}}</mat-error> <mat-error *ngIf="formGroup.get('description').hasError('backendError')">{{formGroup.get('description').getError('backendError').message}}</mat-error>

View File

@ -49,10 +49,9 @@
<div class="profile-form"> <div class="profile-form">
<mat-form-field class="w-100"> <mat-form-field class="w-100">
<mat-select placeholder="{{'DESCRIPTION-EDITOR.BASE-INFO.FIELDS.DESCRIPTION-TEMPLATE-PLACEHOLDER'| translate}}" [required]="true" [compareWith]="compareWith" [formControl]="formGroup.get('descriptionTemplateId')"> <mat-select placeholder="{{'DESCRIPTION-EDITOR.BASE-INFO.FIELDS.DESCRIPTION-TEMPLATE-PLACEHOLDER'| translate}}" [required]="true" [compareWith]="compareWith" [formControl]="formGroup.get('descriptionTemplateId')">
<mat-option *ngFor="let descriptionTemplate of availableDescriptionTemplates" [value]="descriptionTemplate.id"> <mat-option *ngFor="let descriptionTemplate of availableDescriptionTemplates" [value]="descriptionTemplate.id" class="multiline-mat-option">
<div (click)="checkMinMax($event, descriptionTemplate)"> <div>{{descriptionTemplate.label}}</div>
{{descriptionTemplate.label}} <div>{{'DESCRIPTION-EDITOR.BASE-INFO.FIELDS.DESCRIPTION-TEMPLATE-VERSION'| translate}} {{descriptionTemplate.version}}</div>
</div>
</mat-option> </mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="formGroup.get('descriptionTemplateId').hasError('backendError')">{{formGroup.get('descriptionTemplateId').getError('backendError').message}}</mat-error> <mat-error *ngIf="formGroup.get('descriptionTemplateId').hasError('backendError')">{{formGroup.get('descriptionTemplateId').getError('backendError').message}}</mat-error>

View File

@ -1,117 +1,123 @@
.description-base-fields-editor { .description-base-fields-editor {
.intro {
text-align: left;
font-weight: 400;
letter-spacing: 0px;
color: #212121;
opacity: 1;
margin: 3rem 0rem 3rem 0rem;
}
.heading { .intro {
text-align: left; text-align: left;
font-weight: 700; font-weight: 400;
font-size: 18px; letter-spacing: 0px;
letter-spacing: 0px; color: #212121;
color: #212121; opacity: 1;
opacity: 0.81; margin: 3rem 0rem 3rem 0rem;
margin-top: 1.625rem; }
margin-bottom: 0.625rem;
}
.hint { .heading {
text-align: left; text-align: left;
font-weight: 400; font-weight: 700;
font-size: 16px; font-size: 18px;
letter-spacing: 0px; letter-spacing: 0px;
color: #212121; color: #212121;
opacity: 0.81; opacity: 0.81;
margin-bottom: 2.125rem; margin-top: 1.625rem;
} margin-bottom: 0.625rem;
}
.title-form, .hint {
.description-form, text-align: left;
.profile-form { font-weight: 400;
text-align: left; font-size: 16px;
font-weight: 400; letter-spacing: 0px;
font-size: 16px; color: #212121;
letter-spacing: 0.15px; opacity: 0.81;
color: #7d7d7d; margin-bottom: 2.125rem;
opacity: 1; }
margin-bottom: 1rem;
}
// textarea::placeholder { .title-form,
// font-style: oblique; .description-form,
// } .profile-form {
text-align: left;
font-weight: 400;
font-size: 16px;
letter-spacing: 0.15px;
color: #7d7d7d;
opacity: 1;
margin-bottom: 1rem;
}
.input-btn { // textarea::placeholder {
border: none; // font-style: oblique;
color: #aaaaaa; // }
background-color: #ffffff00;
cursor: pointer;
}
.input-btn :hover { .input-btn {
color: var(--primary-color-3) !important; border: none;
} color: #aaaaaa;
background-color: #ffffff00;
cursor: pointer;
}
.dmp-link { .input-btn :hover {
color: #3fafac; color: var(--primary-color-3) !important;
font-weight: 400; }
font-size: 16px;
cursor: pointer;
}
.dmp-link:hover { .dmp-link {
text-decoration: underline; color: #3fafac;
} font-weight: 400;
font-size: 16px;
cursor: pointer;
}
.dmp-link:hover {
text-decoration: underline;
}
}
.multiline-mat-option.mat-option {
white-space: normal;
line-height: normal;
} }
::ng-deep .title-form .mat-form-field-appearance-outline .mat-form-field-outline { ::ng-deep .title-form .mat-form-field-appearance-outline .mat-form-field-outline {
background: #fafafa !important; background: #fafafa !important;
} }
::ng-deep .description-form .mat-form-field-appearance-outline .mat-form-field-outline { ::ng-deep .description-form .mat-form-field-appearance-outline .mat-form-field-outline {
background: #fafafa !important; background: #fafafa !important;
} }
::ng-deep .uri-form .mat-form-field-appearance-outline .mat-form-field-outline { ::ng-deep .uri-form .mat-form-field-appearance-outline .mat-form-field-outline {
background: #fafafa !important; background: #fafafa !important;
} }
::ng-deep .tags-form .mat-form-field-appearance-outline .mat-form-field-outline { ::ng-deep .tags-form .mat-form-field-appearance-outline .mat-form-field-outline {
background: #fafafa !important; background: #fafafa !important;
} }
::ng-deep .profile-form .mat-form-field-appearance-outline .mat-form-field-outline { ::ng-deep .profile-form .mat-form-field-appearance-outline .mat-form-field-outline {
background: #fafafa !important; background: #fafafa !important;
} }
::ng-deep .title-form .mat-form-field-appearance-outline .mat-form-field-infix { ::ng-deep .title-form .mat-form-field-appearance-outline .mat-form-field-infix {
font-size: 1rem; font-size: 1rem;
padding: 0.6em 0 1em 0 !important; padding: 0.6em 0 1em 0 !important;
} }
::ng-deep .description-form .mat-form-field-appearance-outline .mat-form-field-infix { ::ng-deep .description-form .mat-form-field-appearance-outline .mat-form-field-infix {
// font-size: 1rem; // font-size: 1rem;
padding: 0.6em 0 1em 0 !important; padding: 0.6em 0 1em 0 !important;
} }
::ng-deep .uri-form .mat-form-field-appearance-outline .mat-form-field-infix { ::ng-deep .uri-form .mat-form-field-appearance-outline .mat-form-field-infix {
font-size: 1rem; font-size: 1rem;
padding: 0.6em 0 1em 0 !important; padding: 0.6em 0 1em 0 !important;
} }
::ng-deep .tags-form .mat-form-field-appearance-outline .mat-form-field-infix { ::ng-deep .tags-form .mat-form-field-appearance-outline .mat-form-field-infix {
font-size: 1rem; font-size: 1rem;
padding: 0.6em 0 1em 0 !important; padding: 0.6em 0 1em 0 !important;
} }
::ng-deep .profile-form .mat-form-field-appearance-outline .mat-form-field-infix { ::ng-deep .profile-form .mat-form-field-appearance-outline .mat-form-field-infix {
font-size: 1rem; font-size: 1rem;
padding: 0.6em 0 1em 0 !important; padding: 0.6em 0 1em 0 !important;
} }

View File

@ -3,7 +3,7 @@ import { UntypedFormGroup } from '@angular/forms';
import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
import { Description } from '@app/core/model/description/description'; import { Description } from '@app/core/model/description/description';
import { DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { Dmp } from '@app/core/model/dmp/dmp'; import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp';
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { DescriptionService } from '@app/core/services/description/description.service'; import { DescriptionService } from '@app/core/services/description/description.service';
import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service'; import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service';
@ -18,24 +18,21 @@ import { takeUntil } from 'rxjs/operators';
export class DescriptionBaseFieldsEditorComponent extends BaseComponent { export class DescriptionBaseFieldsEditorComponent extends BaseComponent {
@Input() formGroup: UntypedFormGroup; @Input() formGroup: UntypedFormGroup;
@Input() availableDescriptionTemplates: DescriptionTemplate[] = [];
@Input() description: Description; @Input() description: Description;
availableDescriptionTemplates: DescriptionTemplate[] = [];
viewOnly = false; //TODO: not used. viewOnly = false; //TODO: not used.
constructor( constructor(
private dmpBlueprintService: DmpBlueprintService,
private descriptionTemplateService: DescriptionTemplateService,
) { super(); } ) { super(); }
ngOnInit() { ngOnInit() {
const section: DmpBlueprintDefinitionSection = this.dmpBlueprintService.getSection(this.description.dmp.blueprint, this.description.dmpDescriptionTemplate.sectionId); const dmpDescriptionTemplates: DmpDescriptionTemplate[] = this.description.dmp.dmpDescriptionTemplates.filter(x => x.sectionId === this.description.dmpDescriptionTemplate.sectionId);
const descriptionTemplateIds = section ? section.descriptionTemplates.map(x => x.descriptionTemplateId) : []; const currentVersionsOfDescriptionTemplates = dmpDescriptionTemplates.map(x => x.currentDescriptionTemplate);
if (descriptionTemplateIds && descriptionTemplateIds.length > 0) { //Check if the used tempalte in included in the current list. If not add it.
this.descriptionTemplateService.query(this.descriptionTemplateService.buildAutocompleteLookup(null, null, descriptionTemplateIds)) if (currentVersionsOfDescriptionTemplates.find(x => x.id === this.description.descriptionTemplate.id) == null) {
.pipe(takeUntil(this._destroyed)).subscribe(queryResult => { this.availableDescriptionTemplates.push(this.description.descriptionTemplate)
this.availableDescriptionTemplates = queryResult.items;
});
} }
this.availableDescriptionTemplates.push(...currentVersionsOfDescriptionTemplates);
} }
public compareWith(object1: any, object2: any) { public compareWith(object1: any, object2: any) {

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection } from '@app/core/model/description-template/description-template'; import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateComboBoxOption, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateWordListData } from '@app/core/model/description-template/description-template';
import { Description, DescriptionField, DescriptionReference, DescriptionTag, PropertyDefinition } from '@app/core/model/description/description'; import { Description, DescriptionField, DescriptionReference, DescriptionTag, PropertyDefinition } from '@app/core/model/description/description';
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp'; import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp';
@ -43,10 +43,19 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.minMultiplicity)].join('.'), // [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.minMultiplicity)].join('.'),
// [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.maxMultiplicity)].join('.'), // [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(x => x.maxMultiplicity)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.descriptionTemplateGroupId)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.currentDescriptionTemplate), nameof<DescriptionTemplate>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.currentDescriptionTemplate), nameof<DescriptionTemplate>(x => x.label)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.currentDescriptionTemplate), nameof<DescriptionTemplate>(x => x.version)].join('.'),
[nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.id)].join('.'), [nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'), [nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.id)].join('.'), [nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.id)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.label)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.version)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.id)].join('.'), [nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.id)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.ordinal)].join('.'), [nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.ordinal)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.title)].join('.'), [nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.title)].join('.'),
@ -89,6 +98,10 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.visibilityRules), nameof<DescriptionTemplateRule>(x => x.value)].join('.'), [nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.visibilityRules), nameof<DescriptionTemplateRule>(x => x.value)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.label)].join('.'), [nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.label)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.fieldType)].join('.'), [nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.fieldType)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateWordListData>(x => x.options)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateWordListData>(x => x.options), nameof<DescriptionTemplateComboBoxOption>(x => x.label)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateWordListData>(x => x.options), nameof<DescriptionTemplateComboBoxOption>(x => x.value)].join('.'),
[nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateWordListData>(x => x.multiList)].join('.'),
[nameof<Description>(x => x.properties), nameof<PropertyDefinition>(x => x.fields), nameof<DescriptionField>(x => x.key)].join('.'), [nameof<Description>(x => x.properties), nameof<PropertyDefinition>(x => x.fields), nameof<DescriptionField>(x => x.key)].join('.'),

View File

@ -1,5 +1,7 @@
<div *ngIf="fieldSet && isVisibleByVisibilityService && !tableRow" class="dynamic-form-composite-field row"> <!-- <div *ngIf="fieldSet && isVisibleByVisibilityService && !tableRow" class="dynamic-form-composite-field row"> -->
<div *ngIf="fieldSet.fields.length === 1 && this.visibilityRulesService.isVisibleMap[fieldSet.fields.id] ?? true" class="col-12"> <div *ngIf="fieldSet && !tableRow" class="dynamic-form-composite-field row">
<!-- <div *ngIf="fieldSet.fields.length === 1 && this.visibilityRulesService.isVisibleMap[fieldSet.fields.id] ?? true" class="col-12"> -->
<div *ngIf="fieldSet.fields.length === 1" class="col-12">
<div class="row"> <div class="row">
<div *ngIf="showTitle" class="col-12"> <div *ngIf="showTitle" class="col-12">
<app-form-composite-title class="row" [fieldSet]="fieldSet" [path]="path" [isChild]="isChild"></app-form-composite-title> <app-form-composite-title class="row" [fieldSet]="fieldSet" [path]="path" [isChild]="isChild"></app-form-composite-title>
@ -23,7 +25,8 @@
</div> </div>
<div class="col align-self-center"> <div class="col align-self-center">
<div *ngFor="let field of fieldSet.fields; let i = index;" class="col-12 compositeField"> <div *ngFor="let field of fieldSet.fields; let i = index;" class="col-12 compositeField">
<ng-container *ngIf="this.visibilityRulesService.isVisibleMap[field.id] ?? true"> <!-- <ng-container *ngIf="this.visibilityRulesService.isVisibleMap[field.id] ?? true"> -->
<ng-container>
<div class="row"> <div class="row">
<h5 *ngIf="placeholderTitle" class="col-auto font-weight-bold">{{field.label}}</h5> <h5 *ngIf="placeholderTitle" class="col-auto font-weight-bold">{{field.label}}</h5>
</div> </div>
@ -38,6 +41,9 @@
</div> </div>
</div> </div>
</div> </div>
<div *ngIf="fieldSet.hasCommentField && propertiesFormGroup.get('commentFieldValue'+fieldSet.id)?.get('value')" class="col-12">
<rich-text-editor-component [form]="propertiesFormGroup.get('commentFieldValue'+fieldSet.id).get('value')" [id]="'editor1'" [placeholder]="'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate" [wrapperClasses]="'mb-2'" [editable]="!propertiesFormGroup.get('commentFieldValue'+fieldSet.id).disabled"></rich-text-editor-component>
</div>
</div> </div>
<ng-container *ngIf="fieldSet && isVisibleByVisibilityService && tableRow"> <ng-container *ngIf="fieldSet && isVisibleByVisibilityService && tableRow">
<ng-container *ngFor="let field of fieldSet.fields;"> <ng-container *ngFor="let field of fieldSet.fields;">

View File

@ -40,7 +40,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
ngOnInit() { ngOnInit() {
this.visibilityRulesService.getElementVisibilityMapObservable().pipe(takeUntil(this._destroyed)).subscribe(x => { this.visibilityRulesService.getElementVisibilityMapObservable().pipe(takeUntil(this._destroyed)).subscribe(x => {
console.log('getElementVisibilityMapObservable form field'); // console.log('getElementVisibilityMapObservable form field');
if (x[this.fieldSet.id]) { if (x[this.fieldSet.id]) {
this.isVisibleByVisibilityService = x[this.fieldSet.id]; this.isVisibleByVisibilityService = x[this.fieldSet.id];
// this.changeDetector.markForCheck(); // this.changeDetector.markForCheck();

View File

@ -1,5 +1,6 @@
<div *ngIf="field && visible" [id]="field.id" <div *ngIf="field && visible" [id]="field.id"
[ngSwitch]="this.field?.data?.fieldType" class="dynamic-form-field row"> [ngSwitch]="this.field?.data?.fieldType" class="dynamic-form-field row">
{{field.id | json}}
<!-- <h5 *ngIf="fieldSet.title && !isChild">{{fieldSet.title}}</h5> --> <!-- <h5 *ngIf="fieldSet.title && !isChild">{{fieldSet.title}}</h5> -->
<mat-icon *ngIf="fieldSet.additionalInformation && !isChild" matTooltip="{{fieldSet.additionalInformation}}">info</mat-icon> <mat-icon *ngIf="fieldSet.additionalInformation && !isChild" matTooltip="{{fieldSet.additionalInformation}}">info</mat-icon>

View File

@ -113,7 +113,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
ngOnInit() { ngOnInit() {
this.visibilityRulesService.getElementVisibilityMapObservable().pipe(takeUntil(this._destroyed)).subscribe(x => { this.visibilityRulesService.getElementVisibilityMapObservable().pipe(takeUntil(this._destroyed)).subscribe(x => {
console.log('getElementVisibilityMapObservable form field set'); // console.log('getElementVisibilityMapObservable form field set');
if (x[this.field.id]) { if (x[this.field.id]) {
this.visible = x[this.field.id]; this.visible = x[this.field.id];

View File

@ -72,7 +72,6 @@
</div> </div>
</div> </div>
</div> --> </div> -->
</div> </div>
</div> </div>

View File

@ -44,7 +44,7 @@ export class VisibilityRulesService {
} }
public checkElementVisibility(id: string): boolean { public checkElementVisibility(id: string): boolean {
console.log('checkElementVisibility: ' + id); //console.log('checkElementVisibility: ' + id);
return true; return true;
// if (this.visibilityRuleContext.rules.filter(item => item.targetControlId === id).length === 0) { return true; } // if (this.visibilityRuleContext.rules.filter(item => item.targetControlId === id).length === 0) { return true; }
// console.log(this.elementVisibilityMap.has(id) ? this.elementVisibilityMap.get(id) : false); // console.log(this.elementVisibilityMap.has(id) ? this.elementVisibilityMap.get(id) : false);
@ -59,7 +59,7 @@ export class VisibilityRulesService {
} }
public updateValueAndVisibility(id: string, value: any) { public updateValueAndVisibility(id: string, value: any) {
console.log('updateValueAndVisibility: ' + id + ' value: ' + value); //console.log('updateValueAndVisibility: ' + id + ' value: ' + value);
const visibilityRules = this.visibilityRuleContext.rules.filter(item => item.sourceVisibilityRules.filter(source => source.sourceControlId === id).length > 0); const visibilityRules = this.visibilityRuleContext.rules.filter(item => item.sourceVisibilityRules.filter(source => source.sourceControlId === id).length > 0);
if (visibilityRules.length > 0) { if (visibilityRules.length > 0) {
visibilityRules.forEach(item => this.evaluateVisibility(item, value, id)); visibilityRules.forEach(item => this.evaluateVisibility(item, value, id));
@ -68,7 +68,7 @@ export class VisibilityRulesService {
} }
private evaluateVisibility(visibilityRule: VisibilityRule, value: any, sourceId: string) {// source controlId is the same private evaluateVisibility(visibilityRule: VisibilityRule, value: any, sourceId: string) {// source controlId is the same
console.log('evaluateVisibility: ' + visibilityRule + ' value: ' + value + ' sourceId: ' + sourceId); //console.log('evaluateVisibility: ' + visibilityRule + ' value: ' + value + ' sourceId: ' + sourceId);
const targetId = visibilityRule.targetControlId; const targetId = visibilityRule.targetControlId;
const visibilityMap = this.elementComputationalMap.get(targetId) ? this.elementComputationalMap.get(targetId) : new Map<String, boolean>(); const visibilityMap = this.elementComputationalMap.get(targetId) ? this.elementComputationalMap.get(targetId) : new Map<String, boolean>();
@ -133,7 +133,7 @@ export class VisibilityRulesService {
private _computeVisibility(targetId: string): boolean { private _computeVisibility(targetId: string): boolean {
console.log('_computeVisibility: ' + targetId); //console.log('_computeVisibility: ' + targetId);
const visibilityMap = this.elementComputationalMap.get(targetId); const visibilityMap = this.elementComputationalMap.get(targetId);
const values = visibilityMap.values(); const values = visibilityMap.values();
@ -159,7 +159,7 @@ export class VisibilityRulesService {
} }
private resetVisibilityRules() { private resetVisibilityRules() {
console.log('resetVisibilityRules: '); //console.log('resetVisibilityRules: ');
this.isVisibleMap = {}; this.isVisibleMap = {};
this.elementComputationalMap.clear(); this.elementComputationalMap.clear();
@ -169,7 +169,7 @@ export class VisibilityRulesService {
} }
private _populateComputationMap(): void { private _populateComputationMap(): void {
console.log('_populateComputationMap: '); //console.log('_populateComputationMap: ');
// this.visibilityRuleContext.rules.forEach(rule => { // this.visibilityRuleContext.rules.forEach(rule => {
// const targetId = rule.targetControlId; // const targetId = rule.targetControlId;
// const visibilityMap = this.elementComputationalMap.get(targetId) ? this.elementComputationalMap.get(targetId) : new Map<String, boolean>(); // const visibilityMap = this.elementComputationalMap.get(targetId) ? this.elementComputationalMap.get(targetId) : new Map<String, boolean>();
@ -232,7 +232,7 @@ export class VisibilityRulesService {
} }
private resetControlWithId(formControl: AbstractControl, id: string) { private resetControlWithId(formControl: AbstractControl, id: string) {
console.log('resetControlWithId: ' + id); //'resetControlWithId: ' + id);
//TODO: implement this //TODO: implement this
// if (formControl instanceof UntypedFormGroup) { // if (formControl instanceof UntypedFormGroup) {
// if ((formControl as UntypedFormGroup).contains('id') && (formControl as UntypedFormGroup).contains('value') && (formControl as UntypedFormGroup).get('id').value === id) { // if ((formControl as UntypedFormGroup).contains('id') && (formControl as UntypedFormGroup).contains('value') && (formControl as UntypedFormGroup).get('id').value === id) {
@ -253,7 +253,7 @@ export class VisibilityRulesService {
} }
private resetFieldFormGroup(formGroup: UntypedFormGroup) { private resetFieldFormGroup(formGroup: UntypedFormGroup) {
console.log('resetFieldFormGroup: ' + formGroup); //console.log('resetFieldFormGroup: ' + formGroup);
//TODO: implement this //TODO: implement this
// const renderStyle = formGroup.getRawValue().viewStyle.renderStyle; // const renderStyle = formGroup.getRawValue().viewStyle.renderStyle;
// if (renderStyle === DatasetProfileFieldViewStyle.Validation || renderStyle === DatasetProfileFieldViewStyle.DatasetIdentifier) { // if (renderStyle === DatasetProfileFieldViewStyle.Validation || renderStyle === DatasetProfileFieldViewStyle.DatasetIdentifier) {
@ -265,7 +265,7 @@ export class VisibilityRulesService {
} }
private resetCompositeFieldFormGroup(formGroup: UntypedFormGroup) { private resetCompositeFieldFormGroup(formGroup: UntypedFormGroup) {
console.log('resetCompositeFieldFormGroup: ' + formGroup); //console.log('resetCompositeFieldFormGroup: ' + formGroup);
//TODO: implement this //TODO: implement this
// (formGroup.get('fields') as UntypedFormArray).controls.forEach((element: UntypedFormGroup) => { // (formGroup.get('fields') as UntypedFormArray).controls.forEach((element: UntypedFormGroup) => {
// this.resetFieldFormGroup(element); // this.resetFieldFormGroup(element);
@ -285,7 +285,7 @@ export class VisibilityRulesService {
return this._changeMade$.asObservable(); return this._changeMade$.asObservable();
} }
public getVisibilityDependency(targetId: string): VisibilityRuleSource[] | null { public getVisibilityDependency(targetId: string): VisibilityRuleSource[] | null {
console.log('getVisibilityDependency: ' + targetId); //console.log('getVisibilityDependency: ' + targetId);
return this.visibilityRuleContext.rules.reduce((hasDependency, rule) => { return this.visibilityRuleContext.rules.reduce((hasDependency, rule) => {
if (hasDependency) return hasDependency; if (hasDependency) return hasDependency;
@ -323,7 +323,7 @@ export class VisibilityRulesService {
//removes rule that has the specific id either as a source either as a target //removes rule that has the specific id either as a source either as a target
public removeAllIdReferences(id: string): void { public removeAllIdReferences(id: string): void {
console.log('removeAllIdReferences: ' + id); //console.log('removeAllIdReferences: ' + id);
// * Remove from visibility rues and visibility rules context // * Remove from visibility rues and visibility rules context
@ -376,7 +376,7 @@ export class VisibilityRulesService {
public addNewRule(rule: Rule, currentVisibility = this.DEFAULTVISIBILITY): void { public addNewRule(rule: Rule, currentVisibility = this.DEFAULTVISIBILITY): void {
console.log('addNewRule: ' + rule + ' currentVisibility: ' + currentVisibility); //console.log('addNewRule: ' + rule + ' currentVisibility: ' + currentVisibility);
const targetId = rule.targetField; const targetId = rule.targetField;
const sourceId = rule.sourceField; const sourceId = rule.sourceField;
@ -404,7 +404,7 @@ export class VisibilityRulesService {
* return true if no rule found * return true if no rule found
*/ */
public checkTargetVisibilityProvidedBySource(sourceId: string, targetId: string): boolean { public checkTargetVisibilityProvidedBySource(sourceId: string, targetId: string): boolean {
console.log('checkTargetVisibilityProvidedBySource: ' + sourceId + ' targetId: ' + targetId); //console.log('checkTargetVisibilityProvidedBySource: ' + sourceId + ' targetId: ' + targetId);
const computationalMap = this.elementComputationalMap.get(targetId); const computationalMap = this.elementComputationalMap.get(targetId);
if (computationalMap) { if (computationalMap) {
@ -415,13 +415,13 @@ export class VisibilityRulesService {
} }
public getVisibilityRulesFromDescriptionTempalte(descriptionTemplate: DescriptionTemplate): Rule[] { public getVisibilityRulesFromDescriptionTempalte(descriptionTemplate: DescriptionTemplate): Rule[] {
console.log('getVisibilityRulesFromDescriptionTempalte: ' + descriptionTemplate); //console.log('getVisibilityRulesFromDescriptionTempalte: ' + descriptionTemplate);
const result: Rule[] = this.getVisibilityRulesFromDescriptionTempalteSections(descriptionTemplate?.definition?.sections); const result: Rule[] = this.getVisibilityRulesFromDescriptionTempalteSections(descriptionTemplate?.definition?.sections);
return result; return result;
} }
public getVisibilityRulesFromDescriptionTempalteSections(sections: DescriptionTemplateSection[]): Rule[] { public getVisibilityRulesFromDescriptionTempalteSections(sections: DescriptionTemplateSection[]): Rule[] {
console.log('getVisibilityRulesFromDescriptionTempalteSections: ' + sections); //console.log('getVisibilityRulesFromDescriptionTempalteSections: ' + sections);
const result: Rule[] = []; const result: Rule[] = [];
sections.forEach(section => { sections.forEach(section => {
@ -444,7 +444,7 @@ export class VisibilityRulesService {
class MapWithDefault extends Map<string, boolean> { class MapWithDefault extends Map<string, boolean> {
get(key) { get(key) {
console.log('MapWithDefault'); //console.log('MapWithDefault');
if (!this.has(key)) { if (!this.has(key)) {
this.set(key, true); this.set(key, true);
} }

View File

@ -23,7 +23,7 @@
</div> </div>
<div class="col-12 hint">{{'DMP-CLONE-DIALOG.FIELDS.DESCRIPTION-HINT' | translate}}</div> <div class="col-12 hint">{{'DMP-CLONE-DIALOG.FIELDS.DESCRIPTION-HINT' | translate}}</div>
<div class="col-12 basic-info-input"> <div class="col-12 basic-info-input">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'DMP-CLONE-DIALOG.FIELDS.DESCRIPTION-PLACEHOLDER'"> <rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'DMP-CLONE-DIALOG.FIELDS.DESCRIPTION-PLACEHOLDER'">
</rich-text-editor-component> </rich-text-editor-component>
</div> </div>
</div> </div>

View File

@ -47,7 +47,7 @@
<div class="row"> <div class="row">
<div class="heading2 col-12">{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}} *</div> <div class="heading2 col-12">{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}} *</div>
<div class="col-12"> <div class="col-12">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" placeholder="{{'DMP-EDITOR.PLACEHOLDER.DESCRIPTION' | translate}}" [required]="true"> <rich-text-editor-component [form]="formGroup.get('description')" placeholder="{{'DMP-EDITOR.PLACEHOLDER.DESCRIPTION' | translate}}" [required]="true">
</rich-text-editor-component> </rich-text-editor-component>
</div> </div>
</div> </div>
@ -146,7 +146,7 @@
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.HTML_TEXT"> <div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.HTML_TEXT">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'DMP-EDITOR.PLACEHOLDER.DESCRIPTION'" [required]="field.required"> <rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'DMP-EDITOR.PLACEHOLDER.DESCRIPTION'" [required]="field.required">
</rich-text-editor-component> </rich-text-editor-component>
</div> </div>
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.RESEARCHERS"> <div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.RESEARCHERS">
@ -216,7 +216,7 @@
<ng-container *ngFor="let control of extraFieldsArray().controls; let extraFieldIndex = index;"> <ng-container *ngFor="let control of extraFieldsArray().controls; let extraFieldIndex = index;">
<ng-container [formGroupName]="extraFieldIndex"> <ng-container [formGroupName]="extraFieldIndex">
<ng-container *ngIf="control.get('id').value === field.id"> <ng-container *ngIf="control.get('id').value === field.id">
<rich-text-editor-component [parentFormGroup]="control" [controlName]="'value'" [placeholder]="field.placeholder" [required]="field.required"> <rich-text-editor-component [form]="control.get('value')" [placeholder]="field.placeholder" [required]="field.required">
</rich-text-editor-component> </rich-text-editor-component>
</ng-container> </ng-container>
</ng-container> </ng-container>

View File

@ -40,6 +40,8 @@ import { DmpAccessType } from '@app/core/common/enum/dmp-access-type';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { UntypedFormArray, UntypedFormGroup } from '@angular/forms'; import { UntypedFormArray, UntypedFormGroup } from '@angular/forms';
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { LockPersist } from '@app/core/model/lock/lock.model';
import { LockTargetType } from '@app/core/common/enum/lock-target-type';
@Component({ @Component({
selector: 'app-dmp-editor', selector: 'app-dmp-editor',
@ -126,7 +128,6 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
this.lockStatus = lockStatus; this.lockStatus = lockStatus;
if (this.item.status === DmpStatus.Finalized || lockStatus) { if (this.item.status === DmpStatus.Finalized || lockStatus) {
this.formGroup.disable(); this.formGroup.disable();
// this.viewOnly = true;
} }
if (lockStatus) { if (lockStatus) {
this.dialog.open(PopupNotificationDialogComponent, { this.dialog.open(PopupNotificationDialogComponent, {
@ -139,22 +140,16 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
if (!lockStatus && !isNullOrUndefined(this.authService.currentAccountIsAuthenticated())) { if (!lockStatus && !isNullOrUndefined(this.authService.currentAccountIsAuthenticated())) {
// TODO: lock it. // TODO: lock it.
// const lockedBy: UserInfoListingModel = { // const lockPersist: LockPersist = {
// email: this.authService.getUserProfileEmail(), // target: itemId,
// id: this.authService.userId()?.toString(), // targetType: LockTargetType.Dmp,
// name: this.authService.getPrincipalName(), // lockedBy: this.authService.userId()
// role: 0 //TODO
// //role: this.authService.getRoles()?.at(0)
// } // }
// this.lock = new LockModel(data.id, lockedBy); // this.lockService.persist(lockPersist).pipe(takeUntil(this._destroyed)).subscribe(async result => {
// this.lockService.createOrUpdate(this.lock).pipe(takeUntil(this._destroyed)).subscribe(async result => {
// this.lock.id = Guid.parse(result); // this.lock.id = Guid.parse(result);
// interval(this.configurationService.lockInterval).pipe(takeUntil(this._destroyed)).subscribe(() => this.pumpLock()); // interval(this.configurationService.lockInterval).pipe(takeUntil(this._destroyed)).subscribe(() => this.pumpLock());
// }); // });
} }
// this.loadDescriptionProfiles();
// this.registerFormListeners();
}); });
} }
}); });

View File

@ -23,7 +23,7 @@
</div> </div>
<div class="col-12 hint">{{'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTION-HINT' | translate}}</div> <div class="col-12 hint">{{'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTION-HINT' | translate}}</div>
<div class="col-12 basic-info-input"> <div class="col-12 basic-info-input">
<rich-text-editor-component [parentFormGroup]="formGroup" [controlName]="'description'" [placeholder]="'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTION-PLACEHOLDER'"> <rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTION-PLACEHOLDER'">
</rich-text-editor-component> </rich-text-editor-component>
</div> </div>
</div> </div>

View File

@ -1042,7 +1042,8 @@
"TAGS-PLACEHOLDER": "New Tag...", "TAGS-PLACEHOLDER": "New Tag...",
"DESCRIPTION-HINT": "Briefly describe the context and purpose of the Description", "DESCRIPTION-HINT": "Briefly describe the context and purpose of the Description",
"DESCRIPTION-TEMPLATE": "Template", "DESCRIPTION-TEMPLATE": "Template",
"DESCRIPTION-TEMPLATE-PLACEHOLDER": "Description Template" "DESCRIPTION-TEMPLATE-PLACEHOLDER": "Description Template",
"DESCRIPTION-TEMPLATE-VERSION": "Version"
} }
}, },
"ACTIONS": { "ACTIONS": {