diff --git a/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.html b/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.html index 5eba245c4..bd924121f 100644 --- a/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.html +++ b/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.html @@ -1,4 +1,4 @@ -
+

{{group.title}}

@@ -6,4 +6,4 @@
- \ No newline at end of file + \ No newline at end of file diff --git a/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.ts b/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.ts index cb2737c43..2cd8885e6 100644 --- a/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.ts +++ b/dmp-frontend/src/app/form/dynamic-form-group/dynamic-form-group.component.ts @@ -1,6 +1,6 @@ import { DataModel } from '../../entities/DataModel'; import { GroupBase } from './group-base'; -import { Component,Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { FormGroup, Validators } from '@angular/forms'; import { NgForm } from '@angular/forms'; @@ -15,20 +15,31 @@ export class DynamicFormGroupComponent implements OnInit { @Input() dataModel: DataModel; @Input() group: GroupBase; @Input() form: FormGroup; - + @Input() customStyle: {}; + @Input() classFromJson: string ; + constructor() { } - - - - ngOnInit() { - - - - - - } + let st = this.group.style == "any" ? "" : this.group.style; + this.classFromJson = this.group.class == "" ? "" : this.group.class; + + this.customStyle = {}; + if (st != "") { + st.replace(/"/g, '\\"'); + + var attributes = st.split(';'); + for (var i = 0; i < attributes.length; i++) { + var entry = attributes[i].split(':'); + entry[1].replace(/["]/g, " "); + //this.customStyle[entry[0]] = '2px solid #c1baba'; + var a = entry[0]; + this.customStyle[a] = entry[1]; + } + } + + +} } diff --git a/dmp-frontend/src/app/form/dynamic-form-group/group-base.ts b/dmp-frontend/src/app/form/dynamic-form-group/group-base.ts index 750184084..9253017a5 100644 --- a/dmp-frontend/src/app/form/dynamic-form-group/group-base.ts +++ b/dmp-frontend/src/app/form/dynamic-form-group/group-base.ts @@ -10,7 +10,9 @@ export class GroupBase{ order:number; controlType:string; section:string; - + style:string; + class: string; + constructor(options: { value?: T, key?: string, @@ -20,7 +22,9 @@ export class GroupBase{ visible?: boolean, order?: number, controlType?: string - section?: string + section?: string, + style?:string + class?:string } = {}) { this.value = options.value; this.key = options.key || ''; @@ -31,5 +35,7 @@ export class GroupBase{ this.order = options.order === undefined ? 1 : options.order; this.controlType = options.controlType || ''; this.section = options.section || ''; + this.style = options.style || ''; + this.class = options.class || ''; } } diff --git a/dmp-frontend/src/app/form/fields/dynamic-form-field.component.ts b/dmp-frontend/src/app/form/fields/dynamic-form-field.component.ts index 420d56b56..58d0537ff 100644 --- a/dmp-frontend/src/app/form/fields/dynamic-form-field.component.ts +++ b/dmp-frontend/src/app/form/fields/dynamic-form-field.component.ts @@ -128,7 +128,9 @@ export class DynamicFormFieldComponent { } }); - this.form.controls[field].setValidators(arrayVal); + this.form.controls[field].setValidators(arrayVal); //Multiple Validators, Usage of array because setValidator override any validators that are provided during initialistaion + + } } diff --git a/dmp-frontend/src/app/services/dataModelBuilder.service.ts b/dmp-frontend/src/app/services/dataModelBuilder.service.ts index 80d3e7fed..c0cd6b277 100644 --- a/dmp-frontend/src/app/services/dataModelBuilder.service.ts +++ b/dmp-frontend/src/app/services/dataModelBuilder.service.ts @@ -135,6 +135,8 @@ export class dataModelBuilder { newfldGroup.title = fieldGroup.title.__cdata; newfldGroup.key = fieldGroup._id; newfldGroup.section = fieldGroup._section; + newfldGroup.style = fieldGroup.visible._style; + newfldGroup.class = fieldGroup.visible._cssclass; groups.push(newfldGroup) }); } diff --git a/dmp-frontend/src/styles.css b/dmp-frontend/src/styles.css index 7fd6f15ea..6fcf8c78c 100644 --- a/dmp-frontend/src/styles.css +++ b/dmp-frontend/src/styles.css @@ -61,4 +61,8 @@ body { .form-control.ng-invalid { border-left: 5px solid #a94442; /* red */ } + + .form-groupCustom { + border: 2px solid #A11515; + } \ No newline at end of file