set Correct Value to Composite Profile editor value
fix Dmp Version Editor To Disable Name
This commit is contained in:
parent
61d8fa1181
commit
533fcd9587
|
@ -4,9 +4,11 @@
|
|||
<mat-select [formControl]="form" [placeholder]="placeHolder" [required]="required">
|
||||
<mat-option [value]="null">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.NONE' |
|
||||
translate}}</mat-option>
|
||||
<mat-option [value]="true">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.YES' |
|
||||
<mat-option [value]="'true'">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.YES'
|
||||
|
|
||||
translate}}</mat-option>
|
||||
<mat-option [value]="false">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.NO' |
|
||||
<mat-option [value]="'false'">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.NO'
|
||||
|
|
||||
translate}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
|
@ -15,9 +17,10 @@
|
|||
<!-- CheckBox -->
|
||||
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.CheckBox">
|
||||
<mat-select [formControl]="form" [placeholder]="placeHolder" [required]="required">
|
||||
<mat-option [value]="true">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.CHECK-BOX.CHECKED' |
|
||||
<mat-option [value]="'true'">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.CHECK-BOX.CHECKED' |
|
||||
translate}}</mat-option>
|
||||
<mat-option [value]="false">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.CHECK-BOX.UNCHECKED' |
|
||||
<mat-option [value]="'false'">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.CHECK-BOX.UNCHECKED'
|
||||
|
|
||||
translate}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
|
@ -25,7 +28,7 @@
|
|||
|
||||
<!-- ComboBox -->
|
||||
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.ComboBox && comboBoxType === comboBoxTypeEnum.Autocomplete">
|
||||
<input matInput type=" text" [placeholder]="placeHolder" [formControl]="form" [required]="required">
|
||||
<input matInput type="text" [placeholder]="placeHolder" [formControl]="form" [required]="required">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.ComboBox && comboBoxType === comboBoxTypeEnum.WordList">
|
||||
<mat-select [formControl]="form" [placeholder]="placeHolder" [required]="required">
|
||||
|
@ -38,7 +41,7 @@
|
|||
|
||||
<!-- FreeText -->
|
||||
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.FreeText">
|
||||
<input matInput type=" text" [placeholder]="placeHolder" [formControl]="form" [required]="required">
|
||||
<input matInput type="text" [placeholder]="placeHolder" [formControl]="form" [required]="required">
|
||||
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
|
@ -53,7 +56,7 @@
|
|||
|
||||
<!-- TextArea -->
|
||||
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.TextArea">
|
||||
<input matInput type=" text" [placeholder]="placeHolder" [formControl]="form" [required]="required">
|
||||
<input matInput type="text" [placeholder]="placeHolder" [formControl]="form" [required]="required">
|
||||
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
|
|
|
@ -2,25 +2,35 @@
|
|||
<h3 *ngIf="isNew">{{ 'DATASET-WIZARD.TITLE.NEW' | translate }}</h3>
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<h3 *ngIf="!isNew">{{datasetWizardModel?.label}} {{ 'GENERAL.NAMES.DATASET' | translate }}<span *ngIf="this.formGroup && this.formGroup.dirty"> - {{ 'GENERAL.STATUSES.EDIT' | translate }}</span></h3>
|
||||
<h3 *ngIf="this.formGroup && this.formGroup.get('status').value == DatasetStatus.Finalized && viewOnly">{{'GENERAL.STATUSES.FINALISED' | translate }}</h3>
|
||||
<h3 *ngIf="!isNew">{{datasetWizardModel?.label}} {{ 'GENERAL.NAMES.DATASET' | translate }}<span *ngIf="this.formGroup && this.formGroup.dirty">
|
||||
- {{ 'GENERAL.STATUSES.EDIT' | translate }}</span></h3>
|
||||
<h3 *ngIf="this.formGroup && this.formGroup.get('status').value == DatasetStatus.Finalized && viewOnly">{{'GENERAL.STATUSES.FINALISED'
|
||||
| translate }}</h3>
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
<button *ngIf="!editMode && !viewOnly" class="col-auto" mat-icon-button (click)="enableForm()">
|
||||
<mat-icon class="mat-24">edit</mat-icon>
|
||||
</button>
|
||||
<button *ngIf="editMode && !viewOnly" class="col-auto" mat-icon-button (click)="disableForm()">
|
||||
<mat-icon class="mat-24">lock</mat-icon>
|
||||
</button>
|
||||
<!-- <div class="col"></div>
|
||||
<div class="col-auto" *ngIf=" !viewOnly">
|
||||
<button *ngIf="!editMode" class="col-auto" mat-icon-button (click)="enableForm()">
|
||||
<mat-icon class="mat-24">edit</mat-icon>
|
||||
</button>
|
||||
<button *ngIf="editMode" class="col-auto" mat-icon-button (click)="disableForm()">
|
||||
<mat-icon class="mat-24">lock</mat-icon>
|
||||
</button>
|
||||
</div> -->
|
||||
</div>
|
||||
<div *ngIf="this.datasetProfileDefinitionModel || this.datasetWizardModel?.datasetProfileDefinition">
|
||||
<button mat-raised-button color="primary" *ngIf="!isNew && !viewOnly" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="openConfirm(formGroup.get('label').value, formGroup.get('id').value)" type="button">{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}</button>
|
||||
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1 && !viewOnly" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="save();" type="button">{{
|
||||
<button mat-raised-button color="primary" *ngIf="!isNew && !viewOnly" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
|
||||
(click)="openConfirm(formGroup.get('label').value, formGroup.get('id').value)" type="button">{{
|
||||
'DATASET-WIZARD.ACTIONS.DELETE' | translate }}</button>
|
||||
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1 && !viewOnly"
|
||||
style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="save();" type="button">{{
|
||||
'DATASET-WIZARD.ACTIONS.SAVE' | translate }}</button>
|
||||
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1 && !viewOnly" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="saveFinalize();" type="button">{{
|
||||
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status != 1 && !viewOnly"
|
||||
style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="saveFinalize();" type="button">{{
|
||||
'DATASET-WIZARD.ACTIONS.SAVE-AND-FINALISE' | translate }}</button>
|
||||
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="downloadPDF();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-PDF' | translate }}</button>
|
||||
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;" (click)="downloadXML();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-XML' | translate }}</button>
|
||||
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
|
||||
(click)="downloadPDF();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-PDF' | translate }}</button>
|
||||
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
|
||||
(click)="downloadXML();" type="button">{{ 'DATASET-WIZARD.ACTIONS.DOWNLOAD-XML' | translate }}</button>
|
||||
<div class="fill-space"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -30,7 +40,8 @@
|
|||
<form *ngIf="formGroup" [formGroup]="formGroup">
|
||||
<div *ngIf="this.isActiveStep(0)" class="row">
|
||||
<mat-form-field class="col-md-6">
|
||||
<app-single-auto-complete [required]="true" [formControl]="formGroup.get('dmp')" placeholder="{{'DATASET-EDITOR.FIELDS.DMP' | translate}}" [configuration]="dmpAutoCompleteConfiguration">
|
||||
<app-single-auto-complete [required]="true" [formControl]="formGroup.get('dmp')" placeholder="{{'DATASET-EDITOR.FIELDS.DMP' | translate}}"
|
||||
[configuration]="dmpAutoCompleteConfiguration">
|
||||
</app-single-auto-complete>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-6">
|
||||
|
@ -45,7 +56,8 @@
|
|||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col"></div>
|
||||
<div class="col-auto"><button matStepperNext mat-raised-button color="primary" (click)="getDefinition()">{{'DATASET-WIZARD.ACTIONS.NEXT' | translate}}</button></div>
|
||||
<div class="col-auto"><button matStepperNext mat-raised-button color="primary" (click)="getDefinition()">{{'DATASET-WIZARD.ACTIONS.NEXT'
|
||||
| translate}}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -59,7 +71,8 @@
|
|||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col"></div>
|
||||
<div class="col-auto"><button matStepperNext mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.NEXT' | translate}}</button></div>
|
||||
<div class="col-auto"><button matStepperNext mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.NEXT'
|
||||
| translate}}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -68,10 +81,13 @@
|
|||
<mat-step class="step-container">
|
||||
<ng-template matStepLabel>{{'DATASET-WIZARD.THIRD-STEP.TITLE' | translate}}</ng-template>
|
||||
<div *ngIf="this.isActiveStep(2)" class="row">
|
||||
<app-dataset-description-form class="col-12" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition" [form]="this.formGroup.get('datasetProfileDefinition')" [visibilityRules]="datasetWizardModel.datasetProfileDefinition.rules" [datasetProfileId]="formGroup.get('profile').value"></app-dataset-description-form>
|
||||
<app-dataset-description-form class="col-12" *ngIf="formGroup && datasetWizardModel && datasetWizardModel.datasetProfileDefinition"
|
||||
[form]="this.formGroup.get('datasetProfileDefinition')" [visibilityRules]="datasetWizardModel.datasetProfileDefinition.rules"
|
||||
[datasetProfileId]="formGroup.get('profile').value"></app-dataset-description-form>
|
||||
<div class="col-12 description-action-row">
|
||||
<div class="row">
|
||||
<div class="col-auto"><button matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK' | translate}}</button></div>
|
||||
<div class="col-auto"><button matStepperPrevious mat-raised-button color="primary">{{'DATASET-WIZARD.ACTIONS.BACK'
|
||||
| translate}}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -88,4 +104,4 @@
|
|||
</mat-step> -->
|
||||
</mat-horizontal-stepper>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -382,7 +382,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
|
||||
public disableForm() {
|
||||
this.editMode = false;
|
||||
this.viewOnly = true;
|
||||
//this.viewOnly = true;
|
||||
this.formGroup.disable();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<mat-card-content>
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-6">
|
||||
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label" required [attr.disabled]="labelDisabled">
|
||||
<input matInput placeholder="{{'DMP-EDITOR.FIELDS.NAME' | translate}}" type="text" name="label" formControlName="label" required>
|
||||
<mat-error *ngIf="formGroup.get('label').hasError('backendError')">{{formGroup.get('label').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
|
|
@ -56,7 +56,7 @@ export class DmpWizardEditorComponent extends BaseComponent implements OnInit {
|
|||
public language: TranslateService,
|
||||
private _service: DmpService,
|
||||
private languageResolverService: LanguageResolverService,
|
||||
private uiNotificationService:UiNotificationService
|
||||
private uiNotificationService: UiNotificationService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -101,6 +101,8 @@ export class DmpWizardEditorComponent extends BaseComponent implements OnInit {
|
|||
.subscribe(value => {
|
||||
if (value.clone === false && this.formGroup.get('label').value) {
|
||||
this.labelDisabled = true;
|
||||
this.formGroup.controls['label'].disable();
|
||||
this.formGroup.controls['project'].disable();
|
||||
}
|
||||
this.formGroup.controls['version'].disable();
|
||||
});
|
||||
|
@ -138,7 +140,7 @@ export class DmpWizardEditorComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
onCallbackError(error: any) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { FormArray, FormGroup } from '@angular/forms';
|
||||
import { FormArray, FormGroup, AbstractControl } from '@angular/forms';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { BaseComponent } from '../../../../../core/common/base/base.component';
|
||||
import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.service';
|
||||
import { FooterRowOutlet } from '@angular/cdk/table';
|
||||
|
||||
@Component({
|
||||
selector: 'app-form-progress-indication',
|
||||
|
@ -10,7 +11,7 @@ import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.
|
|||
})
|
||||
export class FormProgressIndicationComponent extends BaseComponent implements OnInit {
|
||||
@Input() formGroup: FormGroup;
|
||||
@Input() public progressValueAccuracy = 1;
|
||||
@Input() public progressValueAccuracy = 2;
|
||||
determinateProgressValue: number;
|
||||
|
||||
constructor(private visibilityRulesService: VisibilityRulesService) { super(); }
|
||||
|
@ -27,52 +28,161 @@ export class FormProgressIndicationComponent extends BaseComponent implements On
|
|||
}
|
||||
|
||||
calculateValueForProgressbar() {
|
||||
const progressSoFar = this.countFormControlsWithValue(this.formGroup);
|
||||
const total = this.getFormControlDepthLength(this.formGroup);
|
||||
const progressSoFar = this.countFormControlsWithValueForProgress(this.formGroup);
|
||||
const total = this.CountFormControlDepthLengthFotTotal(this.formGroup);
|
||||
const perc = (progressSoFar / total) * 100;
|
||||
// const perc = ((progressSoFar-this.StandarValues) / total) * 100;
|
||||
this.value = Number.parseFloat(perc.toPrecision(this.progressValueAccuracy));
|
||||
}
|
||||
|
||||
countFormControlsWithValue(form: FormGroup): number {
|
||||
let value = 0;
|
||||
Object.keys(form.controls).forEach(key => {
|
||||
const control = form.controls[key];
|
||||
if (control instanceof FormGroup) {
|
||||
value += this.countFormControlsWithValue(control);
|
||||
} else if (control instanceof FormArray) {
|
||||
const formArray = (<FormArray>control);
|
||||
for (let i = 0; i < formArray.length; i++) {
|
||||
value += this.countFormControlsWithValue(<FormGroup>formArray.get('' + i));
|
||||
}
|
||||
} else if (key === 'value' && control.value != null && control.value !== '' && this.visibilityRulesService.checkElementVisibility(form.controls['id'].value)) {
|
||||
value++;
|
||||
// countFormControlsWithValue(form: FormGroup): number {
|
||||
// let valueCurent = 0;
|
||||
// Object.keys(form.controls).forEach(key => {
|
||||
// const control = form.controls[key];
|
||||
// if (control instanceof FormGroup && this.visibilityRulesService.checkElementVisibility(control.value.id)) {
|
||||
// valueCurent += this.countFormControlsWithValue(control);
|
||||
// } else if (control instanceof FormArray) {
|
||||
// const formArray = (<FormArray>control);
|
||||
// for (let i = 0; i < formArray.length; i++) {
|
||||
// if (this.visibilityRulesService.checkElementVisibility(formArray.get('' + i).value.id))
|
||||
// valueCurent += this.countFormControlsWithValue(<FormGroup>formArray.get('' + i));
|
||||
// }
|
||||
// } else if (key === 'value' && control.value != null && control.value !== '' && this.visibilityRulesService.checkElementVisibility(form.controls['id'].value)) {
|
||||
// valueCurent++;
|
||||
// }
|
||||
// });
|
||||
// return valueCurent;
|
||||
// }
|
||||
//
|
||||
countFormControlsWithValueForProgress(formControl: AbstractControl): number {
|
||||
let valueCurent = 0;
|
||||
if (formControl instanceof FormGroup) {
|
||||
if (this.checkFormsIfIsFieldsAndVisible(formControl)) {
|
||||
if (this.haseValue(formControl))
|
||||
valueCurent++;
|
||||
}
|
||||
});
|
||||
return value;
|
||||
if (this.chechFieldIfIsFieldSetAndVisible((formControl as FormGroup))) {
|
||||
valueCurent = valueCurent + this.compositeFieldsGetChildsForProgress(formControl);
|
||||
} else {
|
||||
Object.keys(formControl.controls).forEach(item => {
|
||||
const control = formControl.get(item);
|
||||
valueCurent = valueCurent + this.countFormControlsWithValueForProgress(control);
|
||||
});
|
||||
}
|
||||
} else if (formControl instanceof FormArray) {
|
||||
formControl.controls.forEach(item => {
|
||||
valueCurent = valueCurent + this.countFormControlsWithValueForProgress(item);
|
||||
});
|
||||
}
|
||||
|
||||
return valueCurent;
|
||||
}
|
||||
private haseValue(formGroup: FormGroup): boolean {
|
||||
if (formGroup.get('value').value != null && formGroup.get('value').value !== '' && this.visibilityRulesService.checkElementVisibility(formGroup.get('id').value)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private compositeFieldsGetChildsForProgress(formGroup: FormGroup): number {
|
||||
let valueCurent = 0;
|
||||
if (this.visibilityRulesService.checkElementVisibility(formGroup.get('id').value)) {
|
||||
(formGroup.get('fields') as FormArray).controls.forEach((element: FormGroup) => {
|
||||
valueCurent = valueCurent + this.countFormControlsWithValueForProgress(element);
|
||||
});
|
||||
|
||||
(formGroup.get('multiplicityItems') as FormArray).controls.forEach((element: FormGroup) => {
|
||||
valueCurent = valueCurent + this.countFormControlsWithValueForProgress(element);
|
||||
});
|
||||
}
|
||||
return valueCurent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
getFormControlDepthLength(form: FormGroup): number {
|
||||
let value = 0;
|
||||
Object.keys(form.controls).forEach(key => {
|
||||
const control = form.controls[key];
|
||||
if (control instanceof FormGroup) {
|
||||
value += this.getFormControlDepthLength(control);
|
||||
} else if (control instanceof FormArray) {
|
||||
const formArray = (<FormArray>control);
|
||||
for (let i = 0; i < formArray.length; i++) {
|
||||
if (<FormGroup>formArray.get('' + i).value && this.visibilityRulesService.checkElementVisibility(formArray.get('' + i).value.id)) {
|
||||
value += this.getFormControlDepthLength(<FormGroup>formArray.get('' + i));
|
||||
}
|
||||
}
|
||||
} else if (key === 'value' && this.visibilityRulesService.checkElementVisibility(form.controls['id'].value)) {
|
||||
value++;
|
||||
}
|
||||
});
|
||||
return value;
|
||||
private checkFormsIfIsFieldsAndVisible(formControl: FormGroup): boolean {
|
||||
if (formControl.contains('id') && formControl.contains('value')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private chechFieldIfIsFieldSetAndVisible(formControl: FormGroup): boolean {
|
||||
if (formControl.contains('id') && formControl.contains('fields')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// getFormControlDepthLength(form: FormGroup): number {
|
||||
// let value = 0;
|
||||
// Object.keys(form.controls).forEach(key => {
|
||||
// const control = form.controls[key];
|
||||
// if (control instanceof FormGroup && this.visibilityRulesService.checkElementVisibility(control.value.id)) {
|
||||
// value += this.getFormControlDepthLength(control);
|
||||
// } else if (control instanceof FormArray) {
|
||||
// const formArray = (<FormArray>control);
|
||||
// for (let i = 0; i < formArray.length; i++) {
|
||||
// if (<FormGroup>formArray.get('' + i).value && this.visibilityRulesService.checkElementVisibility(formArray.get('' + i).value.id)) {
|
||||
// value += this.getFormControlDepthLength(<FormGroup>formArray.get('' + i));
|
||||
// }
|
||||
// }
|
||||
// } else if (key === 'value' && this.visibilityRulesService.checkElementVisibility(form.controls['id'].value)) {
|
||||
// value++;
|
||||
// }
|
||||
// });
|
||||
// return value;
|
||||
// }
|
||||
CountFormControlDepthLengthFotTotal(formControl: AbstractControl): number {
|
||||
let valueCurent = 0;
|
||||
if (formControl instanceof FormArray) {
|
||||
formControl.controls.forEach(item => {
|
||||
valueCurent = valueCurent + this.CountFormControlDepthLengthFotTotal(item);
|
||||
});
|
||||
} else if (formControl instanceof FormGroup) {
|
||||
if ((formControl as FormGroup).contains('id') && (formControl as FormGroup).contains('value') && (this.visibilityRulesService.checkElementVisibility((formControl as FormGroup).get('id').value))) {
|
||||
valueCurent++;
|
||||
} else if ((formControl as FormGroup).contains('id') && (formControl as FormGroup).contains('fields')) {
|
||||
valueCurent = valueCurent + this.compositeFieldsGetChildsForTotal(formControl);
|
||||
} else {
|
||||
Object.keys(formControl.controls).forEach(item => {
|
||||
const control = formControl.get(item);
|
||||
valueCurent = valueCurent + this.CountFormControlDepthLengthFotTotal(control);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return valueCurent;
|
||||
}
|
||||
|
||||
// CountFormControlDepthLengthFotTotal(formControl: AbstractControl): number {
|
||||
// let valueCurent = 0;
|
||||
// if (formControl instanceof FormArray) {
|
||||
// return formControl.controls.map(item => this.CountFormControlDepthLengthFotTotal(item));
|
||||
// } else if (formControl instanceof FormGroup) {
|
||||
// if ((formControl as FormGroup).contains('id') && (formControl as FormGroup).contains('value') && (this.visibilityRulesService.checkElementVisibility((formControl as FormGroup).get('id').value))) {
|
||||
// return 1;
|
||||
// } else if ((formControl as FormGroup).contains('id') && (formControl as FormGroup).contains('fields') && (this.visibilityRulesService.checkElementVisibility((formControl as FormGroup).get('id').value))) {
|
||||
// return this.CountFormControlDepthLengthFotTotal(formControl);
|
||||
// } else {
|
||||
// return formControl.controls.map(item => this.CountFormControlDepthLengthFotTotal(item));
|
||||
// }
|
||||
// }
|
||||
|
||||
// return valueCurent;
|
||||
// }
|
||||
|
||||
private compositeFieldsGetChildsForTotal(formGroup: FormGroup): number {
|
||||
let valueCurent = 0;
|
||||
if (this.visibilityRulesService.checkElementVisibility(formGroup.get('id').value)) {
|
||||
(formGroup.get('fields') as FormArray).controls.forEach((element: FormGroup) => {
|
||||
valueCurent = valueCurent + this.CountFormControlDepthLengthFotTotal(element);
|
||||
});
|
||||
|
||||
(formGroup.get('multiplicityItems') as FormArray).controls.forEach((element: FormGroup) => {
|
||||
valueCurent = valueCurent + this.CountFormControlDepthLengthFotTotal(element);
|
||||
});
|
||||
}
|
||||
return valueCurent;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
<div *ngFor="let sectionFormGroup of pageFormGroup.get('sections')['controls']; let i = index;">
|
||||
<mat-step [stepControl]="sectionFormGroup">
|
||||
<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">
|
||||
<app-form-section class="col-12" [form]="sectionFormGroup" [path]="z+1" [pathName]="'pages.'+z+'.sections.'+i" [datasetProfileId]="datasetProfileId"></app-form-section>
|
||||
</div>
|
||||
</mat-step>
|
||||
|
|
Loading…
Reference in New Issue