Merge remote-tracking branch 'origin/Development' into Development
This commit is contained in:
commit
8e2fea2ea0
|
@ -1,4 +1,4 @@
|
|||
FROM maven:3-jdk-8-alpine AS MAVEN_BUILD
|
||||
FROM maven:3-openjdk-11 AS MAVEN_BUILD
|
||||
|
||||
COPY pom.xml /build/
|
||||
COPY data /build/data/
|
||||
|
@ -9,7 +9,7 @@ COPY web /build/web/
|
|||
WORKDIR /build/
|
||||
RUN mvn package
|
||||
|
||||
FROM openjdk:8-jre-alpine
|
||||
FROM adoptopenjdk/openjdk11:alpine-jre
|
||||
WORKDIR /app
|
||||
COPY --from=MAVEN_BUILD /build/web/target/web-1.0-SNAPSHOT.jar /app/app.jar
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROF}", "-Dspring.config.location=/files/config/", "-jar","/app/app.jar"]
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROF}", "-Dspring.config.additional-location=/files/config/", "-jar","/app/app.jar"]
|
||||
|
|
|
@ -53,26 +53,27 @@ import { DatasetProfileTableOfContents } from './table-of-contents/table-of-cont
|
|||
import { DatasetProfileTableOfContentsInternalSection } from './table-of-contents/table-of-contents-internal-section/table-of-contents-internal-section';
|
||||
import {HttpClientModule} from "@angular/common/http";
|
||||
import {AngularEditorModule} from "@kolkov/angular-editor";
|
||||
import {TransitionGroupModule} from "@app/ui/transition-group/transition-group.module";
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonUiModule,
|
||||
CommonFormsModule,
|
||||
FormattingModule,
|
||||
DatasetProfileRoutingModule,
|
||||
ConfirmationDialogModule,
|
||||
NgxDropzoneModule,
|
||||
FormProgressIndicationModule,
|
||||
DatasetModule,
|
||||
AngularStickyThingsModule,
|
||||
DragDropModule,
|
||||
MatBadgeModule,
|
||||
DragulaModule,
|
||||
AutoCompleteModule,
|
||||
HttpClientModule, AngularEditorModule,
|
||||
],
|
||||
imports: [
|
||||
CommonUiModule,
|
||||
CommonFormsModule,
|
||||
FormattingModule,
|
||||
DatasetProfileRoutingModule,
|
||||
ConfirmationDialogModule,
|
||||
NgxDropzoneModule,
|
||||
FormProgressIndicationModule,
|
||||
DatasetModule,
|
||||
AngularStickyThingsModule,
|
||||
DragDropModule,
|
||||
MatBadgeModule,
|
||||
DragulaModule,
|
||||
AutoCompleteModule,
|
||||
HttpClientModule, AngularEditorModule, TransitionGroupModule,
|
||||
],
|
||||
declarations: [
|
||||
DatasetProfileListingComponent,
|
||||
DatasetProfileCriteriaComponent,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
<!-- TO LINK -->
|
||||
<!-- <div class="row">
|
||||
<h4 *ngIf="isComposite" class="col-auto titleStile">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.TITLE' | translate}}</h4>
|
||||
|
@ -11,7 +10,7 @@
|
|||
|
||||
<!-- TO LINK -->
|
||||
|
||||
<!--
|
||||
<!--
|
||||
<div class="row">
|
||||
<mat-form-field *ngIf="isComposite" class="col">
|
||||
<input matInput type="string" placeholder="Id" [formControl]="form.get('id')" required>
|
||||
|
@ -119,31 +118,37 @@
|
|||
<div class="row">
|
||||
|
||||
<!-- FIELDS -->
|
||||
<div class="col-12" *ngIf="hasFocus" [@fade-in] >
|
||||
|
||||
<ng-container *ngFor="let field of form.get('fields')['controls']; let i=index" >
|
||||
<div class="row bg-white" style="position: relative;" (click)="setTargetField(field)"
|
||||
>
|
||||
<!-- field-container -->
|
||||
<!-- [ngClass]="{'field-container-active': (field.get('id').value === targetField?.get('id').value) && hasFocus}" -->
|
||||
<!-- <div class="field-id-container">
|
||||
{{form.get('fields').get(''+i).get('id').value}} -->
|
||||
<!-- <button mat-mini-fab class="field-id-container-icon" (click)="DeleteField(i)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button> -->
|
||||
<!-- </div> -->
|
||||
<!-- *ngIf="!isComposite" -->
|
||||
<app-dataset-profile-editor-field-component class="col-12"
|
||||
[form]="form.get('fields').get(''+i)" [showOrdinal]="false"
|
||||
[indexPath]="indexPath + 'f' + i" [viewOnly]="viewOnly"
|
||||
[expandView]="hasFocus"
|
||||
[canBeDeleted]="form.get('fields')['controls'].length !=1"
|
||||
(delete)="deleteField(i)">
|
||||
</app-dataset-profile-editor-field-component>
|
||||
</div>
|
||||
<div #inputs transition-group class="col-12" *ngIf="hasFocus" [@fade-in]>
|
||||
<div *ngFor="let field of fieldsArray.controls; let i=index;" class="row bg-white field-input mt-3" (click)="setTargetField(field)" transition-group-item>
|
||||
<!-- field-container -->
|
||||
<!-- [ngClass]="{'field-container-active': (field.get('id').value === targetField?.get('id').value) && hasFocus}" -->
|
||||
<!-- <div class="field-id-container">
|
||||
{{form.get('fields').get(''+i).get('id').value}} -->
|
||||
<!-- <button mat-mini-fab class="field-id-container-icon" (click)="DeleteField(i)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button> -->
|
||||
<!-- </div> -->
|
||||
<!-- *ngIf="!isComposite" -->
|
||||
<app-dataset-profile-editor-field-component class="col-12"
|
||||
[form]="field" [showOrdinal]="false"
|
||||
[indexPath]="indexPath + 'f' + i" [viewOnly]="viewOnly"
|
||||
[expandView]="hasFocus"
|
||||
[canBeDeleted]="fieldsArray.length !=1"
|
||||
(delete)="deleteField(i)">
|
||||
<div class="arrows mt-2">
|
||||
<ul class="list-unstyled list-inline d-flex align-items-center">
|
||||
<li *ngIf="canGoUp(i)" class="text-muted">
|
||||
<mat-icon style="cursor: pointer;" (click)="move(i)" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.MOVE-UP' | translate">keyboard_arrow_up</mat-icon>
|
||||
</li>
|
||||
<li *ngIf="canGoDown(i)" class="text-muted">
|
||||
<mat-icon style="cursor: pointer;" (click)="move(i, 'down')" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.MOVE-DOWN' | translate">keyboard_arrow_down</mat-icon>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</app-dataset-profile-editor-field-component>
|
||||
<hr>
|
||||
</ng-container>
|
||||
<!--
|
||||
</div>
|
||||
<!--
|
||||
<div *ngIf="isComposite" class="row">
|
||||
<h4 class="col-12 titleStile">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.SUB-FIELDS-TITLE' | translate}}
|
||||
</h4>
|
||||
|
@ -191,13 +196,13 @@
|
|||
</app-form-section-inner>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="w-100" *ngIf="!firstField?.get('viewStyle').get('renderStyle').value">
|
||||
<em>
|
||||
{{'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.NOT-INITIALIZED' | translate}}
|
||||
</em>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<hr *ngIf="hasFocus">
|
||||
|
@ -212,7 +217,7 @@
|
|||
<!-- <li class="list-inline-item" (click)="addNewField()"><mat-icon>folder</mat-icon> <small>Add input</small></li> -->
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="list-inline-item" *ngIf="!viewOnly">
|
||||
|
||||
<span [matMenuTriggerFor]="inputmenu" class="inputMenuTrigger">
|
||||
|
@ -221,7 +226,7 @@
|
|||
</span>
|
||||
<!-- <mat-icon [matMenuTriggerFor]="inputmenu" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.ADD-INPUT' | translate">folder</mat-icon> -->
|
||||
<mat-menu #inputmenu="matMenu" [class]="'add_input_menu'">
|
||||
|
||||
|
||||
<!-- <button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.TextArea)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.TextArea)}}</button>
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.FreeText)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.FreeText)}}</button>
|
||||
<mat-divider></mat-divider>
|
||||
|
@ -229,14 +234,14 @@
|
|||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.RadioBox)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.RadioBox)}}</button>
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Select)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Select)}}</button>
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.CheckBox)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.CheckBox)}}</button>
|
||||
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.DatePicker)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.DatePicker)}}</button>
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Currency)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Currency)}}</button>
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
|
||||
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Registries)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Registries)}}</button>
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Services)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Services)}}</button>
|
||||
|
@ -246,21 +251,21 @@
|
|||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.DataRepositories)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.DataRepositories)}}</button>
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Other)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Other)}}</button>
|
||||
|
||||
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.InternalDmpEntities)">Internal DMPs</button>
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Tags)">Tags</button>
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.DatasetIdentifier)">Dataset Identifier</button>
|
||||
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Validation)">Validation</button>
|
||||
-->
|
||||
|
||||
|
||||
<mat-action-list>
|
||||
|
||||
<button mat-list-item (click)="addNewInput(viewTypeEnum.TextArea)">
|
||||
|
||||
|
||||
<img src="/assets/images/editor/icons/text_area.svg" class="input_icon" alt="Text Area icon">
|
||||
|
||||
|
||||
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.TextArea)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(viewTypeEnum.FreeText)">
|
||||
|
@ -286,9 +291,9 @@
|
|||
<img src="/assets/images/editor/icons/checkbox.svg" class="input_icon" alt="CheckBox Icon">
|
||||
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.CheckBox)}}
|
||||
</button>
|
||||
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
|
||||
<button mat-list-item (click)="addNewInput(viewTypeEnum.DatePicker)">
|
||||
<img src="/assets/images/editor/icons/date_picker.svg" class="input_icon" alt="DatePicker Icon">
|
||||
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.DatePicker)}}
|
||||
|
@ -299,7 +304,7 @@
|
|||
</button>
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
|
||||
<button mat-list-item (click)="$event.stopPropagation();" style="font-style: italic;">
|
||||
<img src="/assets/images/editor/icons/api.svg" class="input_icon" alt="APIs icon">
|
||||
|
||||
|
@ -335,7 +340,7 @@
|
|||
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Other)}}
|
||||
</button>
|
||||
</mat-action-list>
|
||||
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
<button mat-list-item (click)="$event.stopPropagation();" style="font-style: italic;">
|
||||
<img src="/assets/images/editor/icons/argos_entities.svg" class="input_icon" alt="Argos Entities icon">
|
||||
|
@ -359,10 +364,10 @@
|
|||
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Validation)}}
|
||||
</button>
|
||||
</mat-action-list>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mat-action-list>
|
||||
|
||||
</mat-menu>
|
||||
|
@ -383,9 +388,9 @@
|
|||
<mat-icon [matMenuTriggerFor]="menu" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.MORE' | translate" style="transform: translateY(-1px);">more_vert</mat-icon>
|
||||
<mat-menu #menu="matMenu">
|
||||
<!-- TODO to check -->
|
||||
<mat-checkbox class="mat-menu-item" (click)="$event.stopPropagation()" [(ngModel)]="showDescription">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION' | translate}}</mat-checkbox>
|
||||
<mat-checkbox class="mat-menu-item" (click)="$event.stopPropagation()" [(ngModel)]="showExtendedDescription">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION' | translate}}</mat-checkbox>
|
||||
<mat-checkbox class="mat-menu-item" (click)="$event.stopPropagation()" [(ngModel)]="showAdditionalInfo">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.ADDITIONAL-INFORMATION' | translate}}</mat-checkbox>
|
||||
<mat-checkbox class="mat-menu-item" (click)="$event.stopPropagation()" [(ngModel)]="showDescription">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION' | translate}}</mat-checkbox>
|
||||
<mat-checkbox class="mat-menu-item" (click)="$event.stopPropagation()" [(ngModel)]="showExtendedDescription">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION' | translate}}</mat-checkbox>
|
||||
<mat-checkbox class="mat-menu-item" (click)="$event.stopPropagation()" [(ngModel)]="showAdditionalInfo">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.ADDITIONAL-INFORMATION' | translate}}</mat-checkbox>
|
||||
</mat-menu>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -393,21 +398,21 @@
|
|||
</div>
|
||||
</ng-container>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!--
|
||||
<!--
|
||||
<span>Preview</span>
|
||||
<app-form-composite-field [form]="previewForm" *ngIf="previewForm">
|
||||
|
||||
</app-form-composite-field> -->
|
||||
<!--
|
||||
<!--
|
||||
Current FORM: {{this.form.value |json}}
|
||||
<br>
|
||||
Target: {{this.targetField?.value |json}} -->
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<!--
|
||||
<button (click)="generatePreview()">Generate preview</button>
|
||||
|
||||
-->
|
||||
|
|
|
@ -53,7 +53,7 @@ $blue-color-light: #5cf7f2;
|
|||
.field-id-container-icon{
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ $blue-color-light: #5cf7f2;
|
|||
.fielset-header{
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
|
||||
|
||||
// .numbering{
|
||||
// padding: 0.5em 0em;
|
||||
// }
|
||||
|
@ -84,7 +84,7 @@ $blue-color-light: #5cf7f2;
|
|||
color: #212121;
|
||||
}
|
||||
|
||||
:host ::ng-deep .fieldset-checkbox-action-dataset-profile-editor
|
||||
:host ::ng-deep .fieldset-checkbox-action-dataset-profile-editor
|
||||
{
|
||||
.mat-checkbox-label{
|
||||
font-size: 0.8em;
|
||||
|
@ -134,6 +134,13 @@ $blue-color-light: #5cf7f2;
|
|||
font-style: italic;
|
||||
}
|
||||
|
||||
// ::ng-deep .underline-line-field .mat-form-field-appearance-legacy .mat-form-field-wapper{
|
||||
// padding-bottom: 1.25em !important;
|
||||
// }
|
||||
.field-input {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.field-input .arrows {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
|
|
@ -1,30 +1,56 @@
|
|||
import { Component, Input, OnChanges, OnInit } from '@angular/core';
|
||||
import { FormArray, FormControl, FormGroup} from '@angular/forms';
|
||||
import { FieldEditorModel } from '../../../admin/field-editor-model';
|
||||
import { Guid } from '@common/types/guid';
|
||||
import { RuleEditorModel } from '../../../admin/rule-editor-model';
|
||||
import { ValidationType } from '@app/core/common/enum/validation-type';
|
||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import { DatasetDescriptionCompositeFieldEditorModel, DatasetDescriptionFieldEditorModel, DatasetDescriptionFormEditorModel, DatasetDescriptionSectionEditorModel } from '@app/ui/misc/dataset-description-form/dataset-description-form.model';
|
||||
import { DatasetProfileFieldViewStyle } from '@app/core/common/enum/dataset-profile-field-view-style';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { ViewStyleType } from '../field/view-style-enum';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { DatasetProfileService } from '@app/core/services/dataset-profile/dataset-profile.service';
|
||||
import { EditorCustomValidators } from '../../custom-validators/editor-custom-validators';
|
||||
import { Field, FieldSet } from '@app/core/model/admin/dataset-profile/dataset-profile';
|
||||
import { DatasetProfileComboBoxType } from '@app/core/common/enum/dataset-profile-combo-box-type';
|
||||
import { DatasetProfileInternalDmpEntitiesType } from '@app/core/common/enum/dataset-profile-internal-dmp-entities-type';
|
||||
import { AutoCompleteFieldData, BooleanDecisionFieldData, CheckBoxFieldData, CurrencyFieldData, DataRepositoriesFieldData, DatasetIdentifierFieldData, DatePickerFieldData, DmpsAutoCompleteFieldData, ExternalDatasetsFieldData, FieldDataOption, FreeTextFieldData, OrganizationsFieldData, RadioBoxFieldData, RegistriesFieldData, ResearchersAutoCompleteFieldData, ServicesFieldData, TagsFieldData, TextAreaFieldData, ValidationFieldData, WordListFieldData } from '@app/core/model/dataset-profile-definition/field-data/field-data';
|
||||
import { CompositeField } from '@app/core/model/dataset-profile-definition/composite-field';
|
||||
import {Component, Input, OnChanges, OnInit, ViewChild} from '@angular/core';
|
||||
import {AbstractControl, FormArray, FormControl, FormGroup} from '@angular/forms';
|
||||
import {FieldEditorModel} from '../../../admin/field-editor-model';
|
||||
import {Guid} from '@common/types/guid';
|
||||
import {RuleEditorModel} from '../../../admin/rule-editor-model';
|
||||
import {ValidationType} from '@app/core/common/enum/validation-type';
|
||||
import {MatCheckboxChange} from '@angular/material/checkbox';
|
||||
import {
|
||||
DatasetDescriptionCompositeFieldEditorModel,
|
||||
DatasetDescriptionFieldEditorModel,
|
||||
DatasetDescriptionSectionEditorModel
|
||||
} from '@app/ui/misc/dataset-description-form/dataset-description-form.model';
|
||||
import {DatasetProfileFieldViewStyle} from '@app/core/common/enum/dataset-profile-field-view-style';
|
||||
import {MatDialog} from '@angular/material/dialog';
|
||||
import {ConfirmationDialogComponent} from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||
import {TranslateService} from '@ngx-translate/core';
|
||||
import {ViewStyleType} from '../field/view-style-enum';
|
||||
import {EnumUtils} from '@app/core/services/utilities/enum-utils.service';
|
||||
import {DatasetProfileService} from '@app/core/services/dataset-profile/dataset-profile.service';
|
||||
import {EditorCustomValidators} from '../../custom-validators/editor-custom-validators';
|
||||
import {Field, FieldSet} from '@app/core/model/admin/dataset-profile/dataset-profile';
|
||||
import {DatasetProfileComboBoxType} from '@app/core/common/enum/dataset-profile-combo-box-type';
|
||||
import {DatasetProfileInternalDmpEntitiesType} from '@app/core/common/enum/dataset-profile-internal-dmp-entities-type';
|
||||
import {
|
||||
AutoCompleteFieldData,
|
||||
BooleanDecisionFieldData,
|
||||
CheckBoxFieldData,
|
||||
CurrencyFieldData,
|
||||
DataRepositoriesFieldData,
|
||||
DatasetIdentifierFieldData,
|
||||
DatePickerFieldData,
|
||||
DmpsAutoCompleteFieldData,
|
||||
ExternalDatasetsFieldData,
|
||||
FieldDataOption,
|
||||
FreeTextFieldData,
|
||||
OrganizationsFieldData,
|
||||
RadioBoxFieldData,
|
||||
RegistriesFieldData,
|
||||
ResearchersAutoCompleteFieldData,
|
||||
ServicesFieldData,
|
||||
TagsFieldData,
|
||||
TextAreaFieldData,
|
||||
ValidationFieldData,
|
||||
WordListFieldData
|
||||
} from '@app/core/model/dataset-profile-definition/field-data/field-data';
|
||||
import {CompositeField} from '@app/core/model/dataset-profile-definition/composite-field';
|
||||
import {Field as FieldDefinition} from '@app/core/model/dataset-profile-definition/field';
|
||||
import { Subject } from 'rxjs';
|
||||
import { debounceTime, delay, map, takeUntil, tap } from 'rxjs/operators';
|
||||
import { GENERAL_ANIMATIONS } from '../../animations/animations';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import {Subject} from 'rxjs';
|
||||
import {debounceTime, delay, map, takeUntil, tap} from 'rxjs/operators';
|
||||
import {GENERAL_ANIMATIONS} from '../../animations/animations';
|
||||
import {BaseComponent} from '@common/base/base.component';
|
||||
import {AngularEditorConfig} from "@kolkov/angular-editor";
|
||||
import {TransitionGroupComponent} from "@app/ui/transition-group/transition-group.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-dataset-profile-editor-composite-field-component',
|
||||
|
@ -73,7 +99,8 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
|
||||
@Input() numbering: string;
|
||||
@Input() hasFocus: boolean = false;
|
||||
|
||||
@ViewChild("inputs") inputs: TransitionGroupComponent;
|
||||
|
||||
showPreview: boolean = true;
|
||||
previewDirty: boolean = false;
|
||||
|
||||
|
@ -96,7 +123,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
private language: TranslateService,
|
||||
public enumUtils: EnumUtils,
|
||||
public datasetProfileService: DatasetProfileService
|
||||
) {
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -104,6 +131,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
// this.setTargetField(null);
|
||||
// this.showExtendedDescription = !!this.form.get('extendedDescription').value;
|
||||
// this.showAdditionalInfo = !!this.form.get('additionalInformation').value;
|
||||
console.log(this.form.get('fields')['controls'])
|
||||
}
|
||||
|
||||
get firstField(){
|
||||
|
@ -153,7 +181,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
// this.previewForm = null;
|
||||
this.previewDirty = true;
|
||||
this.generatePreviewForm();
|
||||
|
||||
|
||||
});
|
||||
this.previewSubject$
|
||||
.pipe(debounceTime(600))
|
||||
|
@ -191,7 +219,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
if(previewContainer){
|
||||
previewContainer.style.height = 'auto';
|
||||
}
|
||||
|
||||
|
||||
// const updatedForm = model.buildForm();
|
||||
// this.reloadPreview(updatedForm)
|
||||
});
|
||||
|
@ -207,7 +235,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
private reloadPreview(updatedForm: FormGroup){
|
||||
setTimeout(() => {
|
||||
|
||||
|
||||
const previewContainer = document.getElementById('preview_container'+ this.form.get('id').value);
|
||||
// let clientHeight = -1;
|
||||
if(previewContainer){
|
||||
|
@ -227,7 +255,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
|
||||
setTimeout(() => {
|
||||
|
||||
|
||||
|
||||
this.showPreview = true;
|
||||
this.previewDirty = false;
|
||||
|
||||
|
@ -238,7 +266,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -247,7 +275,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
private generatePreviewForm(){
|
||||
const formValue:FieldSet = this.form.getRawValue();
|
||||
const fields:FieldDefinition[] = formValue.fields.map(editorField=>this._fieldToFieldDefinition(editorField));
|
||||
|
||||
|
||||
|
||||
const compositeField: CompositeField = {
|
||||
id: formValue.id,
|
||||
|
@ -268,7 +296,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
return model;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const section = new DatasetDescriptionSectionEditorModel();
|
||||
|
@ -314,7 +342,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
|
||||
// (this.form.get('fields') as FormArray).controls.forEach(field=>{
|
||||
// const fieldEditorModel = new DatasetDescriptionFieldEditorModel();
|
||||
|
||||
|
||||
// fieldEditorModel.viewStyle= {
|
||||
// renderStyle: field.get('viewStyle').get('renderStyle').value,
|
||||
// cssClass: null
|
||||
|
@ -322,15 +350,15 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
// fieldEditorModel.defaultValue = field.get('defaultValue').value;
|
||||
// switch (field.get('viewStyle').get('renderStyle').value) {
|
||||
// case DatasetProfileFieldViewStyle.TextArea:
|
||||
// fieldEditorModel.data = {
|
||||
// fieldEditorModel.data = {
|
||||
// label: field.get('data').get('label').value
|
||||
// };
|
||||
// break;
|
||||
|
||||
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// editorModel.fields.push(fieldEditorModel);
|
||||
// });
|
||||
|
@ -369,7 +397,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
|
||||
minControl.updateValueAndValidity();
|
||||
maxControl.updateValueAndValidity();
|
||||
|
||||
|
||||
}
|
||||
|
||||
addNewField() {
|
||||
|
@ -380,11 +408,11 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
|
||||
const fieldForm = field.buildForm();
|
||||
// fieldForm.setValidators(this.customFieldValidator());
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValidators(Validators.required);
|
||||
|
||||
(<FormArray>this.form.get('fields')).push(fieldForm);
|
||||
|
||||
|
||||
this.setTargetField(fieldForm);
|
||||
fieldForm.updateValueAndValidity();
|
||||
}
|
||||
|
@ -393,7 +421,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
|
||||
const fieldsForm = <FormArray>this.form.get('fields');
|
||||
fieldsForm.removeAt(index);
|
||||
|
||||
this.inputs.init();
|
||||
// calculate ordinals
|
||||
fieldsForm.controls.forEach((field, idx)=>{
|
||||
field.get('ordinal').setValue(idx);
|
||||
|
@ -417,7 +445,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
(<FormArray>targetField.get('visible').get('rules')).push(rule.buildForm());
|
||||
}
|
||||
toggleRequired(targetField: FormGroup, event:MatCheckboxChange){
|
||||
|
||||
|
||||
let validationsControl = targetField.get('validations') as FormControl;
|
||||
let validations: Array<ValidationType> = validationsControl.value;
|
||||
|
||||
|
@ -433,12 +461,12 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
validationsControl.setValue(validations.filter(validator=> validator != ValidationType.Required));
|
||||
validationsControl.updateValueAndValidity();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// if(validations.includes(ValidationType.Required)){//IS ALREADY REQUIRED
|
||||
// validationsControl.setValue(validations.filter(validator=> validator != ValidationType.Required));
|
||||
// validationsControl.updateValueAndValidity();
|
||||
// }else{
|
||||
// }else{
|
||||
// //SET REQUIRED VALIDATOR
|
||||
// console.log('setting required validator');
|
||||
// validations.push(ValidationType.Required);
|
||||
|
@ -446,17 +474,13 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
// validationsControl.updateValueAndValidity();
|
||||
// }
|
||||
}
|
||||
setTargetField(field:FormGroup){
|
||||
this.targetField = field;
|
||||
setTargetField(field:AbstractControl){
|
||||
this.targetField = <FormGroup>field;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
deleteTargetField(){
|
||||
|
||||
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
|
@ -471,7 +495,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
this._deleteTargetField();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -498,7 +522,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
|
||||
deleteField(index: number){
|
||||
|
||||
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
|
@ -513,21 +537,21 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
this.DeleteField(index);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
addNewInput(type: ViewStyleType){
|
||||
|
||||
|
||||
const fieldsArray = this.form.get('fields') as FormArray;
|
||||
|
||||
|
||||
let targetOrdinal = fieldsArray.length;
|
||||
try{
|
||||
targetOrdinal = fieldsArray.controls.map(control=> control.get('ordinal').value).reduce((a,b)=>Math.max(a,b)) +1;
|
||||
}catch{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -550,8 +574,8 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
// const fieldForm = field.buildForm();
|
||||
// fieldForm.setValidators(this.customFieldValidator());
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValidators(Validators.required);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if (fieldForm.get('data')) {
|
||||
// fieldForm.removeControl('data');
|
||||
|
@ -573,7 +597,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.CheckBox:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.CheckBox)
|
||||
// fieldForm.addControl('data', new CheckBoxFieldDataEditorModel().buildForm());
|
||||
const data: CheckBoxFieldData = {
|
||||
|
@ -582,12 +606,12 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
|
||||
field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.CheckBox;
|
||||
field.data = data;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case this.viewTypeEnum.Select:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.ComboBox)
|
||||
// fieldForm.addControl('data', new WordListFieldDataEditorModel().buildForm());
|
||||
|
||||
|
@ -610,7 +634,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.Other:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.ComboBox)
|
||||
// fieldForm.addControl('data', new AutoCompleteFieldDataEditorModel().buildForm()); //TODO SEE
|
||||
|
||||
|
@ -630,10 +654,10 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
break;
|
||||
}case this.viewTypeEnum.InternalDmpEntities:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.InternalDmpEntities)
|
||||
// fieldForm.addControl('data', new ResearchersAutoCompleteFieldDataEditorModel().buildForm());//TODO TO SEE
|
||||
|
||||
|
||||
const data: DmpsAutoCompleteFieldData = {
|
||||
label:'',
|
||||
multiAutoComplete: false,
|
||||
|
@ -648,7 +672,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.FreeText:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.FreeText)
|
||||
// fieldForm.addControl('data', new FreeTextFieldDataEditorModel().buildForm());
|
||||
|
||||
|
@ -662,7 +686,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.RadioBox:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.RadioBox)
|
||||
// fieldForm.addControl('data', new RadioBoxFieldDataEditorModel().buildForm());
|
||||
// fieldForm.get('data').setValidators(EditorCustomValidators.atLeastOneElementListValidator('options'));
|
||||
|
@ -679,7 +703,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.TextArea:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.TextArea)
|
||||
// fieldForm.addControl('data', new TextAreaFieldDataEditorModel().buildForm());
|
||||
|
||||
|
@ -694,7 +718,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.DatePicker:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.DatePicker)
|
||||
// fieldForm.addControl('data', new DatePickerDataEditorModel().buildForm());
|
||||
const data: DatePickerFieldData = {
|
||||
|
@ -707,7 +731,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.ExternalDatasets:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.ExternalDatasets)
|
||||
// fieldForm.addControl('data', new ExternalDatasetsDataEditorModel().buildForm());
|
||||
const data: ExternalDatasetsFieldData = {
|
||||
|
@ -721,7 +745,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.DataRepositories:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.DataRepositories)
|
||||
// fieldForm.addControl('data', new DataRepositoriesDataEditorModel().buildForm());
|
||||
|
||||
|
@ -737,10 +761,10 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.Registries:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.Registries)
|
||||
// fieldForm.addControl('data', new RegistriesDataEditorModel().buildForm());
|
||||
|
||||
|
||||
const data:RegistriesFieldData = {
|
||||
label: '',
|
||||
multiAutoComplete: false
|
||||
|
@ -753,7 +777,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.Services:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.Services)
|
||||
// fieldForm.addControl('data', new ServicesDataEditorModel().buildForm());
|
||||
|
||||
|
@ -769,7 +793,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.Tags:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.Tags)
|
||||
// fieldForm.addControl('data', new TagsDataEditorModel().buildForm());
|
||||
|
||||
|
@ -783,7 +807,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.Researchers:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.Researchers)
|
||||
// this.form.addControl('data', new ResearchersDataEditorModel().buildForm()); //TODO TO ASK
|
||||
// fieldForm.addControl('data', new ResearchersAutoCompleteFieldDataEditorModel().buildForm());
|
||||
|
@ -798,10 +822,10 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
|
||||
// field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.InternalDmpEntities;
|
||||
// field.data = {label:''}
|
||||
|
||||
|
||||
field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.Researchers;
|
||||
field.data = data;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -809,7 +833,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.Organizations:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.Organizations)
|
||||
// fieldForm.addControl('data', new OrganizationsDataEditorModel().buildForm());
|
||||
// this.form.addControl('data', new OrganizationsDataEditorModel().buildForm())
|
||||
|
@ -819,8 +843,8 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
autoCompleteSingleDataList:[],
|
||||
label:'',
|
||||
multiAutoComplete: false,
|
||||
|
||||
} as OrganizationsFieldData; //TODO
|
||||
|
||||
} as OrganizationsFieldData; //TODO
|
||||
|
||||
field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.Organizations;
|
||||
field.data = data;
|
||||
|
@ -829,7 +853,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.DatasetIdentifier:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.DatasetIdentifier)
|
||||
// fieldForm.addControl('data', new DatasetIdentifierDataEditorModel().buildForm());
|
||||
|
||||
|
@ -839,12 +863,12 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
|
||||
field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.DatasetIdentifier;
|
||||
field.data = data;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case this.viewTypeEnum.Currency:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.Currency)
|
||||
// fieldForm.addControl('data', new CurrencyDataEditorModel().buildForm());
|
||||
|
||||
|
@ -858,7 +882,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
case this.viewTypeEnum.Validation:{
|
||||
|
||||
|
||||
|
||||
// fieldForm.get('viewStyle').get('renderStyle').setValue(DatasetProfileFieldViewStyle.Validation)
|
||||
// fieldForm.addControl('data', new ValidationDataEditorModel().buildForm());
|
||||
|
||||
|
@ -874,9 +898,10 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
}
|
||||
|
||||
(<FormArray>this.form.get('fields')).push(new FieldEditorModel().fromModel(field).buildForm());
|
||||
this.inputs.init();
|
||||
// fieldForm.get('viewStyle').get('renderStyle').updateValueAndValidity();
|
||||
// fieldForm.get('data').updateValueAndValidity();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -930,7 +955,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
|
||||
// private _atLeastOneElementListValidator(arrayToCheck): ValidatorFn{
|
||||
// return (control: AbstractControl): ValidationErrors | null=>{
|
||||
|
||||
|
||||
// const fa = control.get(arrayToCheck) as FormArray;
|
||||
|
||||
// if(fa.length === 0){
|
||||
|
@ -948,6 +973,37 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
|
|||
|
||||
return {'width':width+'em'}
|
||||
}
|
||||
|
||||
get fieldsArray(): FormArray {
|
||||
if(this.form && this.form.get('fields')) {
|
||||
return this.form.get('fields') as FormArray;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
move(index, direction: "up" | "down" = "up") {
|
||||
this.inputs.init();
|
||||
if (direction === "up" && this.canGoUp(index)) {
|
||||
let temp = this.fieldsArray.at(index);
|
||||
this.fieldsArray.removeAt(index);
|
||||
this.fieldsArray.insert(index-1, temp);
|
||||
} else if (direction === "down" && this.canGoDown(index)) {
|
||||
let temp = this.fieldsArray.at(index+1);
|
||||
this.fieldsArray.removeAt(index+1);
|
||||
this.fieldsArray.insert(index, temp);
|
||||
}
|
||||
this.fieldsArray.controls.forEach((field, index) => {
|
||||
field.get('ordinal').setValue(index);
|
||||
});
|
||||
}
|
||||
|
||||
canGoUp(index: number): boolean {
|
||||
return index > 0;
|
||||
}
|
||||
|
||||
canGoDown(index: number): boolean {
|
||||
return index < (this.fieldsArray.length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<ng-container *ngIf="expandView">
|
||||
|
||||
<!-- ACTIONS PER FIELD -->
|
||||
<div class="row justify-content-end mb-1 mt-3">
|
||||
<div class="col-auto mr-2">
|
||||
<div class="row justify-content-end mb-1 mr-2">
|
||||
<ng-content></ng-content>
|
||||
<div class="col-auto">
|
||||
<ul class="list-unstyled list-inline d-flex align-items-center">
|
||||
<li class="list-inline-item" >
|
||||
<mat-slide-toggle class="field-toggler" [checked]="isRequired" (change)="toggleRequired($event)" labelPosition="before" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.MAKE-IT-REQUIRED' | translate" [disabled]="!viewType">
|
||||
|
@ -12,7 +13,7 @@
|
|||
<!-- <li class="list-inline-item" *ngIf="!viewOnly && viewType && canApplyVisibility">
|
||||
<mat-icon style="cursor: pointer;" (click)="addNewRule()" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.ADD-VISIBILITY-RULE' | translate">visibility</mat-icon>
|
||||
</li> -->
|
||||
<li class="list-inline-item" *ngIf="!viewOnly && viewType && canBeDeleted" class="text-muted">
|
||||
<li class="text-muted" *ngIf="!viewOnly && viewType && canBeDeleted">
|
||||
<mat-icon style="cursor: pointer; opacity: 0.7; transform:translateY(2px) translateX(10px) ;" (click)="onDelete()" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.DELETE-INPUT' | translate">delete</mat-icon>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -274,7 +274,7 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
|
|||
|
||||
|
||||
private _formChangesSubscription:Subscription;
|
||||
private _showPreview: boolean = false;;
|
||||
private _showPreview: boolean = false;
|
||||
|
||||
// get showPreview(): boolean{
|
||||
|
||||
|
@ -801,12 +801,7 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
|
|||
get isRequired(){
|
||||
let validationsControl = this.form.get('validations') as FormControl;
|
||||
let validations: Array<ValidationType> = validationsControl.value;
|
||||
|
||||
if(validations.includes(ValidationType.Required)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
return validations.includes(ValidationType.Required);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -311,14 +311,14 @@ export class DatasetProfileEditorComponent extends CheckDeactivateBaseComponent
|
|||
}, 400);
|
||||
// this._initializeFormValidity(tocentries);
|
||||
|
||||
//Checking invalid visibilty RULES
|
||||
//Checking invalid visibilty RULES
|
||||
const fieldsetEntries = this._getAllFieldSets(this.toCEntries);
|
||||
const fieldSetHavingInvalidVisibilityRules:ToCEntry[] = fieldsetEntries
|
||||
.filter(entry=>{
|
||||
const fieldsFormGroup = entry.form.get('fields');
|
||||
const invalid = (fieldsFormGroup as FormArray).controls.filter(field=>{
|
||||
return this.hasInvalidVisibilityRule(field as FormGroup);
|
||||
|
||||
|
||||
});
|
||||
if(invalid && invalid.length){
|
||||
return true;
|
||||
|
@ -342,7 +342,7 @@ export class DatasetProfileEditorComponent extends CheckDeactivateBaseComponent
|
|||
if(confirm){
|
||||
this.removeFieldSetVisibilityRules(fieldSetHavingInvalidVisibilityRules);
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-PROFILE-EDITOR.ERRORS.INVALID-VISIBILITY-RULES.REMOVE-SUCCESS'), SnackBarNotificationLevel.Success);
|
||||
|
||||
|
||||
}else{
|
||||
console.log('User not confirmed');
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ export class DatasetProfileEditorComponent extends CheckDeactivateBaseComponent
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
}catch{
|
||||
return false;
|
||||
}
|
||||
|
@ -1227,7 +1227,7 @@ export class DatasetProfileEditorComponent extends CheckDeactivateBaseComponent
|
|||
//in case selectedtocentrhy is child of the removed element
|
||||
|
||||
// this.refreshToCEntries();
|
||||
this.onDataNeedsRefresh();
|
||||
this.onDataNeedsRefresh();
|
||||
this.form.updateValueAndValidity();
|
||||
|
||||
}
|
||||
|
|
|
@ -14,13 +14,12 @@
|
|||
|
||||
<h6 *ngIf="form.get('description').value && !isChild" class="col-12" [innerHTML]="form.get('description').value"></h6>
|
||||
|
||||
<div class="col-12 mt-3 mb-3">
|
||||
<div *ngIf="form.get('extendedDescription').value && !isChild" class="col-12 mt-3 mb-3">
|
||||
<div *ngIf="!showExtendedDescription" (click)="showExtendedDescription = !showExtendedDescription">
|
||||
<span class="more d-flex justify-content-center">{{'DATASET-EDITOR.QUESTION.EXTENDED-DESCRIPTION.VIEW-MORE' | translate}}</span>
|
||||
</div>
|
||||
<div *ngIf="showExtendedDescription">
|
||||
<h6 *ngIf="form.get('extendedDescription').value && !isChild" [innerHTML]="form.get('extendedDescription').value">
|
||||
</h6>
|
||||
<h6 [innerHTML]="form.get('extendedDescription').value"></h6>
|
||||
<span class="more d-flex justify-content-center" (click)="showExtendedDescription = !showExtendedDescription">
|
||||
{{'DATASET-EDITOR.QUESTION.EXTENDED-DESCRIPTION.VIEW-LESS' | translate}}
|
||||
</span>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import {Directive, ElementRef} from "@angular/core";
|
||||
|
||||
@Directive({
|
||||
selector: '[transition-group-item]'
|
||||
})
|
||||
export class TransitionGroupItemDirective {
|
||||
prevPos: any;
|
||||
newPos: any;
|
||||
el: HTMLElement;
|
||||
moved: boolean;
|
||||
moveCallback: any;
|
||||
|
||||
constructor(elRef: ElementRef) {
|
||||
this.el = elRef.nativeElement;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
import {TransitionGroupItemDirective} from "./transition-group-item.directive";
|
||||
import {AfterViewInit, Component, ContentChildren, Input, OnDestroy, QueryList} from "@angular/core";
|
||||
import {Subscription} from "rxjs";
|
||||
import Timeout = NodeJS.Timeout;
|
||||
|
||||
@Component({
|
||||
selector: '[transition-group]',
|
||||
template: '<ng-content></ng-content>'
|
||||
})
|
||||
export class TransitionGroupComponent implements AfterViewInit, OnDestroy {
|
||||
@ContentChildren(TransitionGroupItemDirective) items: QueryList<TransitionGroupItemDirective>;
|
||||
private subscription: Subscription;
|
||||
private timeout: Timeout;
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.init();
|
||||
this.subscription = this.items.changes.subscribe(items => {
|
||||
items.forEach(item => item.prevPos = item.newPos || item.prevPos);
|
||||
items.forEach(this.runCallback);
|
||||
this.refreshPosition('newPos');
|
||||
items.forEach(item => item.prevPos = item.prevPos || item.newPos); // for new items
|
||||
|
||||
const animate = () => {
|
||||
items.forEach(this.applyTranslation);
|
||||
this['_forceReflow'] = document.body.offsetHeight; // force reflow to put everything in position
|
||||
this.items.forEach(this.runTransition.bind(this));
|
||||
}
|
||||
|
||||
const willMoveSome = items.some((item) => {
|
||||
const dx = item.prevPos.left - item.newPos.left;
|
||||
const dy = item.prevPos.top - item.newPos.top;
|
||||
return dx || dy;
|
||||
});
|
||||
|
||||
if (willMoveSome) {
|
||||
animate();
|
||||
} else {
|
||||
setTimeout(() => { // for removed items
|
||||
this.refreshPosition('newPos');
|
||||
animate();
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.clear();
|
||||
if (this.subscription) {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
clear() {
|
||||
if (this.timeout) {
|
||||
clearTimeout(this.timeout);
|
||||
}
|
||||
}
|
||||
|
||||
init() {
|
||||
this.clear();
|
||||
this.refreshPosition('prevPos');
|
||||
this.refreshPosition('newPos');
|
||||
}
|
||||
|
||||
runCallback(item: TransitionGroupItemDirective) {
|
||||
if (item.moveCallback) {
|
||||
item.moveCallback();
|
||||
}
|
||||
}
|
||||
|
||||
runTransition(item: TransitionGroupItemDirective) {
|
||||
if (!item.moved) {
|
||||
return;
|
||||
}
|
||||
const cssClass = 'list-move';
|
||||
let el = item.el;
|
||||
let style: any = el.style;
|
||||
el.classList.add(cssClass);
|
||||
style.transform = style.WebkitTransform = style.transitionDuration = '';
|
||||
el.addEventListener('transitionend', item.moveCallback = (e: any) => {
|
||||
if (!e || /transform$/.test(e.propertyName)) {
|
||||
el.removeEventListener('transitionend', item.moveCallback);
|
||||
item.moveCallback = null;
|
||||
el.classList.remove(cssClass);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
refreshPosition(prop: string) {
|
||||
this.items.forEach(item => {
|
||||
item[prop] = item.el.getBoundingClientRect();
|
||||
});
|
||||
}
|
||||
|
||||
applyTranslation(item: TransitionGroupItemDirective) {
|
||||
item.moved = false;
|
||||
const dx = item.prevPos.left - item.newPos.left;
|
||||
const dy = item.prevPos.top - item.newPos.top;
|
||||
if (dx || dy) {
|
||||
item.moved = true;
|
||||
let style: any = item.el.style;
|
||||
style.transform = style.WebkitTransform = 'translate(' + dx + 'px,' + dy + 'px)';
|
||||
style.transitionDuration = '0s';
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
import {NgModule} from "@angular/core";
|
||||
import {CommonModule} from "@angular/common";
|
||||
import {TransitionGroupItemDirective} from "./transition-group-item.directive";
|
||||
import {TransitionGroupComponent} from "./transition-group.component";
|
||||
|
||||
@NgModule({
|
||||
declarations: [TransitionGroupItemDirective, TransitionGroupComponent],
|
||||
imports: [CommonModule],
|
||||
exports: [TransitionGroupItemDirective, TransitionGroupComponent]
|
||||
})
|
||||
export class TransitionGroupModule {
|
||||
|
||||
}
|
|
@ -533,7 +533,9 @@
|
|||
"ADD-VISIBILITY-RULE": "Add Conditional Question",
|
||||
"DELETE-INPUT": "Delete this input",
|
||||
"PREVIEW": "Preview",
|
||||
"NOT-INITIALIZED": "Not initialized yet"
|
||||
"NOT-INITIALIZED": "Not initialized yet",
|
||||
"MOVE-UP": "Move this input above",
|
||||
"MOVE-DOWN": "Move this input below"
|
||||
},
|
||||
"FIELDSET": {
|
||||
"ADD-INPUT": "Add input",
|
||||
|
|
|
@ -533,7 +533,9 @@
|
|||
"ADD-VISIBILITY-RULE": "Make Conditional Question",
|
||||
"DELETE-INPUT": "Delete this input",
|
||||
"PREVIEW": "Preview",
|
||||
"NOT-INITIALIZED": "Not initialized yet"
|
||||
"NOT-INITIALIZED": "Not initialized yet",
|
||||
"MOVE-UP": "Move this input above",
|
||||
"MOVE-DOWN": "Move this input below"
|
||||
},
|
||||
"FIELDSET": {
|
||||
"ADD-INPUT": "Add input",
|
||||
|
|
|
@ -533,7 +533,9 @@
|
|||
"ADD-VISIBILITY-RULE": "Add Conditional Question",
|
||||
"DELETE-INPUT": "Delete this input",
|
||||
"PREVIEW": "Preview",
|
||||
"NOT-INITIALIZED": "Not initialized yet"
|
||||
"NOT-INITIALIZED": "Not initialized yet",
|
||||
"MOVE-UP": "Move this input above",
|
||||
"MOVE-DOWN": "Move this input below"
|
||||
},
|
||||
"FIELDSET": {
|
||||
"ADD-INPUT": "Add input",
|
||||
|
|
|
@ -533,7 +533,9 @@
|
|||
"ADD-VISIBILITY-RULE": "Add Conditional Question",
|
||||
"DELETE-INPUT": "Delete this input",
|
||||
"PREVIEW": "Preview",
|
||||
"NOT-INITIALIZED": "Not initialized yet"
|
||||
"NOT-INITIALIZED": "Not initialized yet",
|
||||
"MOVE-UP": "Move this input above",
|
||||
"MOVE-DOWN": "Move this input below"
|
||||
},
|
||||
"FIELDSET": {
|
||||
"ADD-INPUT": "Add input",
|
||||
|
|
|
@ -533,7 +533,9 @@
|
|||
"ADD-VISIBILITY-RULE": "Adione Questão Condicionada",
|
||||
"DELETE-INPUT": "Eliminar este input",
|
||||
"PREVIEW": "Pré-visualização",
|
||||
"NOT-INITIALIZED": "Ainda não iniciado"
|
||||
"NOT-INITIALIZED": "Ainda não iniciado",
|
||||
"MOVE-UP": "Move this input above",
|
||||
"MOVE-DOWN": "Move this input below"
|
||||
},
|
||||
"FIELDSET": {
|
||||
"ADD-INPUT": "Adicionar novo input",
|
||||
|
|
|
@ -533,7 +533,9 @@
|
|||
"ADD-VISIBILITY-RULE": "Add Conditional Question",
|
||||
"DELETE-INPUT": "Delete this input",
|
||||
"PREVIEW": "Preview",
|
||||
"NOT-INITIALIZED": "Not initialized yet"
|
||||
"NOT-INITIALIZED": "Not initialized yet",
|
||||
"MOVE-UP": "Move this input above",
|
||||
"MOVE-DOWN": "Move this input below"
|
||||
},
|
||||
"FIELDSET": {
|
||||
"ADD-INPUT": "Add input",
|
||||
|
|
|
@ -533,7 +533,9 @@
|
|||
"ADD-VISIBILITY-RULE": "Add Conditional Question",
|
||||
"DELETE-INPUT": "Delete this input",
|
||||
"PREVIEW": "Preview",
|
||||
"NOT-INITIALIZED": "Not initialized yet"
|
||||
"NOT-INITIALIZED": "Not initialized yet",
|
||||
"MOVE-UP": "Move this input above",
|
||||
"MOVE-DOWN": "Move this input below"
|
||||
},
|
||||
"FIELDSET": {
|
||||
"ADD-INPUT": "Add input",
|
||||
|
|
|
@ -533,7 +533,9 @@
|
|||
"ADD-VISIBILITY-RULE": "Add Conditional Question",
|
||||
"DELETE-INPUT": "Delete this input",
|
||||
"PREVIEW": "Preview",
|
||||
"NOT-INITIALIZED": "Not initialized yet"
|
||||
"NOT-INITIALIZED": "Not initialized yet",
|
||||
"MOVE-UP": "Move this input above",
|
||||
"MOVE-DOWN": "Move this input below"
|
||||
},
|
||||
"FIELDSET": {
|
||||
"ADD-INPUT": "Add input",
|
||||
|
|
|
@ -296,3 +296,8 @@
|
|||
border: 1px solid #f44336 !important;
|
||||
}
|
||||
// end of CSS for <angular-editor> (@kolkov/angular-editor)
|
||||
|
||||
/* Transition Group */
|
||||
.list-move {
|
||||
transition: transform 1s;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue