Dataset profile editor. Fix: final preview in step does not affect individual previews in step 2.

This commit is contained in:
Kristian Ntavidi 2021-04-05 12:06:14 +03:00
parent 9cab64b65e
commit 450dbb519f
6 changed files with 47 additions and 7 deletions

View File

@ -53,6 +53,7 @@ import {DragulaModule} from 'ng2-dragula';
//matrial
import {MatBadgeModule} from '@angular/material/badge';
import { DatasetProfileEditorSectionFieldSetComponent } from './editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component';
import { FinalPreviewComponent } from './editor/components/final-preview/final-preview.component';
@NgModule({
imports: [
@ -106,12 +107,12 @@ import { DatasetProfileEditorSectionFieldSetComponent } from './editor/component
DatasetProfileEditorValidatorFieldComponent,
DatasetProfileTableOfContents,
DatasetProfileTableOfContentsInternalSection,
DatasetProfileEditorSectionFieldSetComponent
DatasetProfileEditorSectionFieldSetComponent,
FinalPreviewComponent
],
entryComponents: [
DialogConfirmationUploadDatasetProfiles
],
providers:[VisibilityRulesService]
]
})
export class DatasetProfileModule { }

View File

@ -0,0 +1,3 @@
<app-dataset-description [form]="formGroup" [visibilityRules]="visibilityRules" *ngIf="formGroup">
</app-dataset-description>

View File

@ -0,0 +1,28 @@
import { Component, Input, OnInit} from '@angular/core';
import { Rule } from '@app/core/model/dataset-profile-definition/rule';
import { VisibilityRulesService } from '@app/ui/misc/dataset-description-form/visibility-rules/visibility-rules.service';
@Component({
selector: 'app-final-preview-component',
templateUrl: './final-preview.component.html',
styleUrls: ['./final-preview.component.scss'],
providers:[VisibilityRulesService]
})
export class FinalPreviewComponent implements OnInit {
@Input() formGroup = null;
@Input() visibilityRules:Rule[] = [];
constructor(private visibilityRulesService: VisibilityRulesService){
}
ngOnInit(): void {
this.visibilityRulesService.buildVisibilityRules(this.visibilityRules, this.formGroup);
}
}

View File

@ -395,9 +395,16 @@
<!-- {{'DATASET-PROFILE-EDITOR.ACTIONS.PREVIEW-AND-FINALIZE' | translate}} -->
<!-- <button (click)="generatePreviewForm()">foo</button> -->
<ng-container *ngIf="formGroup">
<app-final-preview-component [formGroup]="formGroup" [visibilityRules]="visibilityRules">
</app-final-preview-component>
<!--
<app-dataset-description [form]="formGroup" [visibilityRules]="visibilityRules" *ngIf="formGroup">
</app-dataset-description>
</app-dataset-description> -->
</ng-container>
</mat-step>

View File

@ -53,7 +53,8 @@ const skipDisable: any[] = require('../../../../../assets/resources/skipDisable.
selector: 'app-dataset-profile-editor-component',
templateUrl: './dataset-profile-editor.component.html',
styleUrls: ['./dataset-profile-editor.component.scss'],
animations:[...STEPPER_ANIMATIONS]
animations:[...STEPPER_ANIMATIONS],
providers:[VisibilityRulesService]
})
export class DatasetProfileEditorComponent extends BaseComponent implements OnInit {
@ -200,7 +201,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
}
// this.addSection();
// this.addPage();
// this.visibilityRulesService.buildVisibilityRules([],this.form);
this.visibilityRulesService.buildVisibilityRules([],this.form);
setTimeout(() => {
this.steps = this.stepper.steps;
});
@ -227,7 +228,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
prepareForm() {
// this.visibilityRulesService.buildVisibilityRules([],this.form);
this.visibilityRulesService.buildVisibilityRules([],this.form);
// this.form.setValidators([EditorCustomValidators.atLeastOneElementListValidator('pages'),EditorCustomValidators.pagesHaveAtLeastOneSection('pages', 'sections')]);
// this.form.updateValueAndValidity();
this.form.valueChanges