DMP wizard improvement. (Issue #170)
This commit is contained in:
parent
446717da97
commit
94550ce0c4
|
@ -9,7 +9,7 @@
|
||||||
<mat-step [stepControl]="sectionFormGroup">
|
<mat-step [stepControl]="sectionFormGroup">
|
||||||
<ng-template matStepLabel>{{pageFormGroup.get('title').value}}</ng-template>
|
<ng-template matStepLabel>{{pageFormGroup.get('title').value}}</ng-template>
|
||||||
<!-- <div *ngIf="stepper.selectedIndex == z" class="row"> -->
|
<!-- <div *ngIf="stepper.selectedIndex == z" class="row"> -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<app-form-section class="col-12" [form]="sectionFormGroup" [path]="z+1" [pathName]="'pages.'+z+'.sections.'+i" [datasetProfileId]="datasetProfileId"></app-form-section>
|
<app-form-section class="col-12" [form]="sectionFormGroup" [path]="z+1" [pathName]="'pages.'+z+'.sections.'+i" [datasetProfileId]="datasetProfileId"></app-form-section>
|
||||||
</div>
|
</div>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
|
|
|
@ -1,16 +1,9 @@
|
||||||
import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core';
|
import { AfterViewInit, Component, Input, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
import { MatStepper } from '@angular/material/stepper';
|
import { MatHorizontalStepper } from '@angular/material/stepper';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
|
||||||
import { takeUntil } from 'rxjs/operators';
|
|
||||||
import { Pair } from '../../../common/types/pair';
|
|
||||||
import { BaseComponent } from '../../../core/common/base/base.component';
|
import { BaseComponent } from '../../../core/common/base/base.component';
|
||||||
import { CompositeField } from '../../../core/model/dataset-profile-definition/composite-field';
|
|
||||||
import { DatasetProfileDefinitionModel } from '../../../core/model/dataset-profile-definition/dataset-profile-definition';
|
|
||||||
import { Rule } from '../../../core/model/dataset-profile-definition/rule';
|
import { Rule } from '../../../core/model/dataset-profile-definition/rule';
|
||||||
import { Section } from '../../../core/model/dataset-profile-definition/section';
|
|
||||||
import { DatasetDescriptionFormEditorModel } from './dataset-description-form.model';
|
|
||||||
import { FormFocusService } from './form-focus/form-focus.service';
|
import { FormFocusService } from './form-focus/form-focus.service';
|
||||||
import { VisibilityRulesService } from './visibility-rules/visibility-rules.service';
|
import { VisibilityRulesService } from './visibility-rules/visibility-rules.service';
|
||||||
|
|
||||||
|
@ -19,7 +12,7 @@ import { VisibilityRulesService } from './visibility-rules/visibility-rules.serv
|
||||||
templateUrl: './dataset-description-form.component.html',
|
templateUrl: './dataset-description-form.component.html',
|
||||||
styleUrls: ['./dataset-description-form.component.scss']
|
styleUrls: ['./dataset-description-form.component.scss']
|
||||||
})
|
})
|
||||||
export class DatasetDescriptionFormComponent extends BaseComponent implements OnInit, AfterViewInit {
|
export class DatasetDescriptionFormComponent extends BaseComponent implements OnInit, AfterViewInit, OnChanges {
|
||||||
|
|
||||||
// pathName: string;
|
// pathName: string;
|
||||||
// pages: Array<number>;
|
// pages: Array<number>;
|
||||||
|
@ -27,7 +20,7 @@ export class DatasetDescriptionFormComponent extends BaseComponent implements On
|
||||||
// visibleSidebar = false;
|
// visibleSidebar = false;
|
||||||
// datasetProfileDefinitionModel: DatasetDescriptionFormEditorModel;
|
// datasetProfileDefinitionModel: DatasetDescriptionFormEditorModel;
|
||||||
// private currentPageIndex = 0;
|
// private currentPageIndex = 0;
|
||||||
// @ViewChild('stepper') stepper: MatStepper;
|
@ViewChild('stepper', { static: false }) stepper: MatHorizontalStepper;
|
||||||
|
|
||||||
// //@Input() dataModel: DatasetProfileDefinitionModel;
|
// //@Input() dataModel: DatasetProfileDefinitionModel;
|
||||||
@Input() path: string;
|
@Input() path: string;
|
||||||
|
@ -78,6 +71,14 @@ export class DatasetDescriptionFormComponent extends BaseComponent implements On
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
|
||||||
|
// When the form is changed set stepper index to 0.
|
||||||
|
if (changes['form'] && !changes['form'].isFirstChange()) {
|
||||||
|
this.stepper.selectedIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
//this.visibilityRulesService.triggerVisibilityEvaluation();
|
//this.visibilityRulesService.triggerVisibilityEvaluation();
|
||||||
// this.route.queryParams
|
// this.route.queryParams
|
||||||
|
|
|
@ -88,7 +88,7 @@ export class DatasetEditorWizardComponent extends BaseComponent implements OnIni
|
||||||
let dataset = new QuickWizardDatasetDescriptionModel().fromModel(this.datasetProfileDefinition);
|
let dataset = new QuickWizardDatasetDescriptionModel().fromModel(this.datasetProfileDefinition);
|
||||||
let formGroup = dataset.buildForm();
|
let formGroup = dataset.buildForm();
|
||||||
|
|
||||||
if(isFirst) {
|
if (isFirst) {
|
||||||
formGroup.get('datasetLabel').setValue(
|
formGroup.get('datasetLabel').setValue(
|
||||||
this.datasetProfile.value["label"] + " " +
|
this.datasetProfile.value["label"] + " " +
|
||||||
this.language.instant('GENERAL.NAMES.DATASET')
|
this.language.instant('GENERAL.NAMES.DATASET')
|
||||||
|
@ -106,9 +106,17 @@ export class DatasetEditorWizardComponent extends BaseComponent implements OnIni
|
||||||
formArray.push(formGroup);
|
formArray.push(formGroup);
|
||||||
this.lastIndexOfDataset = formArray.length - 1;
|
this.lastIndexOfDataset = formArray.length - 1;
|
||||||
this.editedDataset = true;
|
this.editedDataset = true;
|
||||||
|
this.scrollToTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
listingMode() {
|
listingMode() {
|
||||||
if (this.toggleButton === 0) return true;
|
if (this.toggleButton === 0) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scrollToTop() {
|
||||||
|
var currentScroll = document.documentElement.scrollTop || document.body.scrollTop;
|
||||||
|
if (currentScroll > 0) {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue