Adds basic edit on finalized Dataset profiles. (Ticket #72)
This commit is contained in:
parent
7ca5568437
commit
0da7fd8441
|
@ -12,11 +12,10 @@ export class DefaultValueEditorModel extends BaseFormModel {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
type: [this.type],
|
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('DefaultValueEditorModel.type')) }],
|
||||||
value: [this.value]
|
value: [{ value: this.value, disabled: (disabled && !skipDisable.includes('DefaultValueEditorModel.value')) }]
|
||||||
|
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,15 +13,15 @@ export class AutoCompleteFieldDataEditorModel extends FieldDataEditorModel<AutoC
|
||||||
public autoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
|
public autoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
|
||||||
//public multiAutoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
|
//public multiAutoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label: [this.label],
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('AutoCompleteFieldDataEditorModel.label')) }],
|
||||||
type: [this.type],
|
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('AutoCompleteFieldDataEditorModel.type')) }],
|
||||||
url: [this.url],
|
url: [{ value: this.url, disabled: (disabled && !skipDisable.includes('AutoCompleteFieldDataEditorModel.url')) }],
|
||||||
optionsRoot: [this.optionsRoot],
|
optionsRoot: [{ value: this.optionsRoot, disabled: (disabled && !skipDisable.includes('AutoCompleteFieldDataEditorModel.optionsRoot')) }],
|
||||||
multiAutoComplete: [this.multiAutoComplete]
|
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('AutoCompleteFieldDataEditorModel.multiAutoComplete')) }]
|
||||||
});
|
});
|
||||||
formGroup.addControl('autoCompleteOptions', this.autoCompleteOptions.buildForm());
|
formGroup.addControl('autoCompleteOptions', this.autoCompleteOptions.buildForm(disabled, skipDisable));
|
||||||
|
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import { FieldDataEditorModel } from './field-data-editor-model';
|
||||||
|
|
||||||
export class BooleanDecisionFieldDataEditorModel extends FieldDataEditorModel<BooleanDecisionFieldDataEditorModel> {
|
export class BooleanDecisionFieldDataEditorModel extends FieldDataEditorModel<BooleanDecisionFieldDataEditorModel> {
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label: this.label
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('BooleanDecisionFieldDataEditorModel.label')) }]
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import { FieldDataEditorModel } from './field-data-editor-model';
|
||||||
|
|
||||||
export class CheckBoxFieldDataEditorModel extends FieldDataEditorModel<CheckBoxFieldDataEditorModel> {
|
export class CheckBoxFieldDataEditorModel extends FieldDataEditorModel<CheckBoxFieldDataEditorModel> {
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label: this.label
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('CheckBoxFieldDataEditorModel.label')) }]
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,11 @@ import { FieldDataEditorModel } from './field-data-editor-model';
|
||||||
import { DatePickerFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
|
import { DatePickerFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
|
||||||
|
|
||||||
export class DatePickerDataEditorModel extends FieldDataEditorModel<DatePickerDataEditorModel> {
|
export class DatePickerDataEditorModel extends FieldDataEditorModel<DatePickerDataEditorModel> {
|
||||||
public label: string;
|
public label: string;
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label: [this.label]
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DatePickerDataEditorModel.label')) }]
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,11 @@ export abstract class FieldDataEditorModel<T> extends BaseFormModel {
|
||||||
|
|
||||||
public label: string;
|
public label: string;
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
throw new Error('Build Form Is not not correctly overriden');
|
throw new Error('Build Form Is not not correctly overriden');
|
||||||
}
|
}
|
||||||
|
|
||||||
fromJSONObject(item: any): T {
|
fromJSONObject(item: any): T {
|
||||||
throw new Error('From Json Object is not correctly overriden');
|
throw new Error('From Json Object is not correctly overriden');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,10 @@ export class FieldDataOptionEditorModel extends FieldDataEditorModel<FieldDataOp
|
||||||
public label: string;
|
public label: string;
|
||||||
public value: string;
|
public value: string;
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
return new FormBuilder().group({
|
return new FormBuilder().group({
|
||||||
label: [this.label],
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('FieldDataOptionEditorModel.label')) }],
|
||||||
value: [this.value]
|
value: [{ value: this.value, disabled: (disabled && !skipDisable.includes('FieldDataOptionEditorModel.value')) }]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ import { FieldDataEditorModel } from './field-data-editor-model';
|
||||||
|
|
||||||
export class FreeTextFieldDataEditorModel extends FieldDataEditorModel<FreeTextFieldDataEditorModel> {
|
export class FreeTextFieldDataEditorModel extends FieldDataEditorModel<FreeTextFieldDataEditorModel> {
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label: this.label
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('FreeTextFieldDataEditorModel.label')) }]
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,14 @@ export class RadioBoxFieldDataEditorModel extends FieldDataEditorModel<RadioBoxF
|
||||||
|
|
||||||
public options: Array<FieldDataOptionEditorModel> = [];
|
public options: Array<FieldDataOptionEditorModel> = [];
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label: [this.label]
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('RadioBoxFieldDataEditorModel.label')) }]
|
||||||
});
|
});
|
||||||
const optionsFormArray = new Array<FormGroup>();
|
const optionsFormArray = new Array<FormGroup>();
|
||||||
if (this.options) {
|
if (this.options) {
|
||||||
this.options.forEach(item => {
|
this.options.forEach(item => {
|
||||||
const form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm(disabled, skipDisable);
|
||||||
optionsFormArray.push(form);
|
optionsFormArray.push(form);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ import { FieldDataEditorModel } from './field-data-editor-model';
|
||||||
|
|
||||||
export class TextAreaFieldDataEditorModel extends FieldDataEditorModel<TextAreaFieldDataEditorModel> {
|
export class TextAreaFieldDataEditorModel extends FieldDataEditorModel<TextAreaFieldDataEditorModel> {
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
label: this.label
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('TextAreaFieldDataEditorModel.label')) }]
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,15 @@ export class WordListFieldDataEditorModel extends FieldDataEditorModel<WordListF
|
||||||
public type: DatasetProfileComboBoxType = DatasetProfileComboBoxType.WordList;
|
public type: DatasetProfileComboBoxType = DatasetProfileComboBoxType.WordList;
|
||||||
public options: Array<FieldDataOptionEditorModel>;
|
public options: Array<FieldDataOptionEditorModel>;
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
type: [this.type],
|
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('WordListFieldDataEditorModel.type')) }],
|
||||||
label: [this.label]
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('WordListFieldDataEditorModel.label')) }]
|
||||||
});
|
});
|
||||||
const optionsFormArray = new Array<FormGroup>();
|
const optionsFormArray = new Array<FormGroup>();
|
||||||
if (this.options) {
|
if (this.options) {
|
||||||
this.options.forEach(item => {
|
this.options.forEach(item => {
|
||||||
const form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm(disabled, skipDisable);
|
||||||
optionsFormArray.push(form);
|
optionsFormArray.push(form);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,22 +53,20 @@ export class FieldEditorModel extends BaseFormModel {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
id:[this.id,[Validators.required,Validators.pattern('^[^<_>]+$')]],
|
id: [{ value: this.id, disabled: (disabled && !skipDisable.includes('FieldEditorModel.id')) }, [Validators.required, Validators.pattern('^[^<_>]+$')]],
|
||||||
// title: [this.title],
|
// title: [this.title],
|
||||||
page: [this.page],
|
page: [{ value: this.page, disabled: (disabled && !skipDisable.includes('FieldEditorModel.page')) }],
|
||||||
ordinal: [this.ordinal]
|
ordinal: [{ value: this.ordinal, disabled: (disabled && !skipDisable.includes('FieldEditorModel.ordinal')) }],
|
||||||
|
validations: [{ value: this.validations, disabled: (disabled && !skipDisable.includes('FieldEditorModel.validations')) }]
|
||||||
});
|
});
|
||||||
|
|
||||||
// formGroup.addControl("multiplicity", this.multiplicity.buildForm());
|
formGroup.addControl('defaultValue', this.defaultValue.buildForm(disabled, skipDisable));
|
||||||
formGroup.addControl('validations', new FormControl(this.validations));
|
formGroup.addControl('viewStyle', this.viewStyle.buildForm(disabled, skipDisable));
|
||||||
formGroup.addControl('defaultValue', this.defaultValue.buildForm());
|
formGroup.addControl('visible', this.visible.buildForm(disabled, skipDisable));
|
||||||
formGroup.addControl('viewStyle', this.viewStyle.buildForm());
|
if (this.data) { formGroup.addControl('data', this.data.buildForm(disabled, skipDisable)); }
|
||||||
formGroup.addControl('visible', this.visible.buildForm());
|
else { formGroup.addControl('data', new WordListFieldDataEditorModel().buildForm(disabled, skipDisable)); }
|
||||||
//formGroup.addControl("data",this.data? this.data.buildForm():this.formBuilder.group({}));
|
|
||||||
if (this.data) { formGroup.addControl('data', this.data.buildForm()); }
|
|
||||||
else { formGroup.addControl('data', new WordListFieldDataEditorModel().buildForm()); }
|
|
||||||
|
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ export class FieldSetEditorModel extends BaseFormModel {
|
||||||
public title: string;
|
public title: string;
|
||||||
public description: string;
|
public description: string;
|
||||||
public extendedDescription: string;
|
public extendedDescription: string;
|
||||||
public additionalInformation:string;
|
public additionalInformation: string;
|
||||||
public hasCommentField: boolean;
|
public hasCommentField: boolean;
|
||||||
|
|
||||||
fromModel(item: FieldSet): FieldSetEditorModel {
|
fromModel(item: FieldSet): FieldSetEditorModel {
|
||||||
|
@ -26,28 +26,28 @@ export class FieldSetEditorModel extends BaseFormModel {
|
||||||
this.title = item.title;
|
this.title = item.title;
|
||||||
this.description = item.description;
|
this.description = item.description;
|
||||||
this.extendedDescription = item.extendedDescription;
|
this.extendedDescription = item.extendedDescription;
|
||||||
this.additionalInformation=item.additionalInformation;
|
this.additionalInformation = item.additionalInformation;
|
||||||
this.hasCommentField = item.hasCommentField;
|
this.hasCommentField = item.hasCommentField;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
id:[this.id,[Validators.required,Validators.pattern('^[^<_>]+$')]],
|
id: [{ value: this.id, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.id')) }, [Validators.required, Validators.pattern('^[^<_>]+$')]],
|
||||||
ordinal: [this.ordinal],
|
ordinal: [{ value: this.ordinal, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.ordinal')) }],
|
||||||
title: [this.title],
|
title: [{ value: this.title, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.title')) }],
|
||||||
description: [this.description],
|
description: [{ value: this.description, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.description')) }],
|
||||||
extendedDescription: [this.extendedDescription],
|
extendedDescription: [{ value: this.extendedDescription, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.extendedDescription')) }],
|
||||||
additionalInformation:[this.additionalInformation],
|
additionalInformation: [{ value: this.additionalInformation, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.additionalInformation')) }],
|
||||||
hasCommentField: [this.hasCommentField]
|
hasCommentField: [{ value: this.hasCommentField, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.hasCommentField')) }]
|
||||||
});
|
});
|
||||||
const fieldsFormArray = new Array<FormGroup>();
|
const fieldsFormArray = new Array<FormGroup>();
|
||||||
this.fields.forEach(item => {
|
this.fields.forEach(item => {
|
||||||
const form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm(disabled, skipDisable);
|
||||||
fieldsFormArray.push(form);
|
fieldsFormArray.push(form);
|
||||||
});
|
});
|
||||||
formGroup.addControl('fields', this.formBuilder.array(fieldsFormArray));
|
formGroup.addControl('fields', this.formBuilder.array(fieldsFormArray));
|
||||||
formGroup.addControl('multiplicity', this.multiplicity.buildForm());
|
formGroup.addControl('multiplicity', this.multiplicity.buildForm(disabled, skipDisable));
|
||||||
|
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,10 @@ export class MultiplicityEditorModel extends BaseFormModel {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
min: [this.min],
|
min: [{ value: this.min, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.min')) }],
|
||||||
max: [this.max]
|
max: [{ value: this.max, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.max')) }]
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,11 @@ export class PageEditorModel extends BaseFormModel {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
title: [this.title, [Validators.required]],
|
title: [{ value: this.title, disabled: (disabled && !skipDisable.includes('PageEditorModel.title')) }, [Validators.required]],
|
||||||
id: [this.id, [Validators.required]],
|
id: [{ value: this.id, disabled: (disabled && !skipDisable.includes('PageEditorModel.id')) }, [Validators.required]],
|
||||||
ordinal: [this.ordinal]
|
ordinal: [{ value: this.ordinal, disabled: (disabled && !skipDisable.includes('PageEditorModel.ordinal')) }]
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,14 @@ export class RuleEditorModel extends BaseFormModel {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
// sourceField: [this.sourceField],
|
// sourceField: [this.sourceField],
|
||||||
target: [this.target],
|
target: [{ value: this.target, disabled: (disabled && !skipDisable.includes('RuleEditorModel.target')) }],
|
||||||
ruleStyle: [this.ruleStyle],
|
ruleStyle: [{ value: this.ruleStyle, disabled: (disabled && !skipDisable.includes('RuleEditorModel.ruleStyle')) }],
|
||||||
value: [this.value],
|
value: [{ value: this.value, disabled: (disabled && !skipDisable.includes('RuleEditorModel.value')) }],
|
||||||
ruleType: [this.ruleType],
|
ruleType: [{ value: this.ruleType, disabled: (disabled && !skipDisable.includes('RuleEditorModel.ruleType')) }],
|
||||||
valueType: [this.valueType]
|
valueType: [{ value: this.valueType, disabled: (disabled && !skipDisable.includes('RuleEditorModel.valueType')) }]
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,31 +25,31 @@ export class SectionEditorModel extends BaseFormModel {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup: FormGroup = new FormBuilder().group({});
|
const formGroup: FormGroup = new FormBuilder().group({
|
||||||
|
id: [{ value: this.id, disabled: (disabled && !skipDisable.includes('SectionEditorModel.id')) }, [Validators.required, Validators.pattern('^[^<_>]+$')]],
|
||||||
|
page: [{ value: this.page, disabled: (disabled && !skipDisable.includes('SectionEditorModel.page')) }, [Validators.required]],
|
||||||
|
title: [{ value: this.title, disabled: (disabled && !skipDisable.includes('SectionEditorModel.title')) }],
|
||||||
|
description: [{ value: this.description, disabled: (disabled && !skipDisable.includes('SectionEditorModel.description')) }],
|
||||||
|
ordinal: [{ value: this.ordinal, disabled: (disabled && !skipDisable.includes('SectionEditorModel.ordinal')) }],
|
||||||
|
defaultVisibility: [{ value: this.defaultVisibility, disabled: (disabled && !skipDisable.includes('SectionEditorModel.defaultVisibility')) }]
|
||||||
|
});
|
||||||
const sectionsFormArray = new Array<FormGroup>();
|
const sectionsFormArray = new Array<FormGroup>();
|
||||||
if (this.sections) {
|
if (this.sections) {
|
||||||
this.sections.forEach(item => {
|
this.sections.forEach(item => {
|
||||||
const form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm(disabled, skipDisable);
|
||||||
sectionsFormArray.push(form);
|
sectionsFormArray.push(form);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const compositeFieldsFormArray = new Array<FormGroup>();
|
const compositeFieldsFormArray = new Array<FormGroup>();
|
||||||
if (this.fieldSets) {
|
if (this.fieldSets) {
|
||||||
this.fieldSets.forEach(item => {
|
this.fieldSets.forEach(item => {
|
||||||
const form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm(disabled, skipDisable);
|
||||||
compositeFieldsFormArray.push(form);
|
compositeFieldsFormArray.push(form);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
|
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
|
||||||
formGroup.addControl('fieldSets', this.formBuilder.array(compositeFieldsFormArray));
|
formGroup.addControl('fieldSets', this.formBuilder.array(compositeFieldsFormArray));
|
||||||
formGroup.addControl('defaultVisibility', new FormControl(this.defaultVisibility));
|
|
||||||
formGroup.addControl('page', new FormControl(this.page, [Validators.required]));
|
|
||||||
formGroup.addControl('id', new FormControl(this.id, [Validators.required,Validators.pattern('^[^<_>]+$')]));
|
|
||||||
formGroup.addControl('title', new FormControl(this.title));
|
|
||||||
formGroup.addControl('description', new FormControl(this.description));
|
|
||||||
formGroup.addControl('ordinal', new FormControl(this.ordinal));
|
|
||||||
|
|
||||||
if (!formGroup.controls['defaultVisibility'].value) { formGroup.controls['defaultVisibility'].setValue(true); }
|
if (!formGroup.controls['defaultVisibility'].value) { formGroup.controls['defaultVisibility'].setValue(true); }
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,10 @@ export class ViewStyleEditorModel extends BaseFormModel {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
cssClass: [this.cssClass],
|
cssClass: [{ value: this.cssClass, disabled: (disabled && !skipDisable.includes('ViewStyleEditorModel.cssClass')) }],
|
||||||
renderStyle: [this.renderStyle]
|
renderStyle: [{ value: this.renderStyle, disabled: (disabled && !skipDisable.includes('ViewStyleEditorModel.renderStyle')) }]
|
||||||
|
|
||||||
});
|
});
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,15 +15,15 @@ export class VisibilityEditorModel extends BaseFormModel {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup = this.formBuilder.group({
|
const formGroup = this.formBuilder.group({
|
||||||
style: [this.style]
|
style: [{ value: this.style, disabled: (disabled && !skipDisable.includes('VisibilityEditorModel.style')) }]
|
||||||
});
|
});
|
||||||
|
|
||||||
const rulesFormArray = new Array<FormGroup>();
|
const rulesFormArray = new Array<FormGroup>();
|
||||||
if (this.rules) {
|
if (this.rules) {
|
||||||
this.rules.forEach(rule => {
|
this.rules.forEach(rule => {
|
||||||
const form: FormGroup = rule.buildForm();
|
const form: FormGroup = rule.buildForm(disabled, skipDisable);
|
||||||
rulesFormArray.push(form);
|
rulesFormArray.push(form);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,25 +22,26 @@ export class DatasetProfileEditorModel extends BaseFormModel {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildForm(): FormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
|
||||||
const formGroup: FormGroup = new FormBuilder().group({});
|
const formGroup: FormGroup = new FormBuilder().group({
|
||||||
|
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.label')) }, [Validators.required]],
|
||||||
|
status: [{ value: this.status, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.status')) }],
|
||||||
|
version: [{ value: this.version, disabled: (disabled && !skipDisable.includes('DatasetProfileEditorModel.version')) }]
|
||||||
|
});
|
||||||
|
|
||||||
const sectionsFormArray = new Array<FormGroup>();
|
const sectionsFormArray = new Array<FormGroup>();
|
||||||
this.sections.forEach(item => {
|
this.sections.forEach(item => {
|
||||||
const form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm(disabled, skipDisable);
|
||||||
sectionsFormArray.push(form);
|
sectionsFormArray.push(form);
|
||||||
});
|
});
|
||||||
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
|
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
|
||||||
|
|
||||||
const pagesFormArray = new Array<FormGroup>();
|
const pagesFormArray = new Array<FormGroup>();
|
||||||
this.pages.forEach(item => {
|
this.pages.forEach(item => {
|
||||||
const form: FormGroup = item.buildForm();
|
const form: FormGroup = item.buildForm(disabled, skipDisable);
|
||||||
pagesFormArray.push(form);
|
pagesFormArray.push(form);
|
||||||
});
|
});
|
||||||
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
|
formGroup.addControl('pages', this.formBuilder.array(pagesFormArray));
|
||||||
formGroup.addControl('label', new FormControl(this.label, Validators.required));
|
|
||||||
formGroup.addControl('status', new FormControl(this.status));
|
|
||||||
formGroup.addControl('version', new FormControl(this.version));
|
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,9 @@ import { DatasetProfileEditorModel } from './dataset-profile-editor-model';
|
||||||
import { ConfirmationDialogComponent } from '../../../../library/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '../../../../library/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { DatasetProfileEnum } from '../../../../core/common/enum/dataset-profile';
|
import { DatasetProfileEnum } from '../../../../core/common/enum/dataset-profile';
|
||||||
import * as FileSaver from 'file-saver';
|
import * as FileSaver from 'file-saver';
|
||||||
|
//import * as data from 'src/assets/resources/skipDisable.json';
|
||||||
|
|
||||||
|
const skipDisable: any[] = require('../../../../../assets/resources/skipDisable.json');
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dataset-profile-editor-component',
|
selector: 'app-dataset-profile-editor-component',
|
||||||
|
@ -65,10 +68,11 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
try {
|
try {
|
||||||
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
|
this.dataModel = new DatasetProfileEditorModel().fromModel(data);
|
||||||
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
|
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
|
||||||
this.form = this.dataModel.buildForm();
|
|
||||||
if (this.dataModel.status === DatasetProfileEnum.FINALIZED) {
|
if (this.dataModel.status === DatasetProfileEnum.FINALIZED) {
|
||||||
this.form.disable();
|
this.form = this.dataModel.buildForm(true, skipDisable);
|
||||||
this.viewOnly = true;
|
this.viewOnly = true;
|
||||||
|
} else {
|
||||||
|
this.form = this.dataModel.buildForm();
|
||||||
}
|
}
|
||||||
this.prepareForm();
|
this.prepareForm();
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -287,8 +291,4 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
||||||
}
|
}
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
[
|
||||||
|
"DatasetProfileEditorModel.label",
|
||||||
|
"SectionEditorModel.title",
|
||||||
|
"SectionEditorModel.description",
|
||||||
|
"FieldSetEditorModel.title",
|
||||||
|
"FieldSetEditorModel.description",
|
||||||
|
"FieldSetEditorModel.extendedDescription",
|
||||||
|
"FieldSetEditorModel.additionalInformation",
|
||||||
|
"TextAreaFieldDataEditorModel.label",
|
||||||
|
"FreeTextFieldDataEditorModel.label",
|
||||||
|
"WordListFieldDataEditorModel.label",
|
||||||
|
"FieldDataOptionEditorModel.label"
|
||||||
|
]
|
Loading…
Reference in New Issue