diff --git a/src/main/webapp/app/facet-composer/facet-composer.component.html b/src/main/webapp/app/facet-composer/facet-composer.component.html index 7538990..2f90da0 100644 --- a/src/main/webapp/app/facet-composer/facet-composer.component.html +++ b/src/main/webapp/app/facet-composer/facet-composer.component.html @@ -1,4 +1,4 @@ -

FacetComposer: New {{titleType}} ({{titlePath}})

+

FacetComposer: New {{titleType}} ({{titlePath}})

@@ -6,7 +6,7 @@ - {{typeSpec.name}} +

{{typeSpec.name}}

@@ -22,47 +22,39 @@ - {{typeSpec.facetSpecs[ind].name}} + {{typeSpec.facetSpecs[ind].name}}

{{typeSpec.facetSpecs[ind].description}}

- - - relation - - - + + relation + {{item}} - -
+
{{typeSpec.facetSpecs[ind].guiProps[i].label}} - +
+
+ + +
@@ -70,9 +62,15 @@ + + Form's Value: +{{ myForm.value | json }} +
+Form is Valid ? : +{{ myForm.valid }} +
- \ No newline at end of file diff --git a/src/main/webapp/app/facet-composer/facet-composer.component.ts b/src/main/webapp/app/facet-composer/facet-composer.component.ts index c95994b..705271d 100644 --- a/src/main/webapp/app/facet-composer/facet-composer.component.ts +++ b/src/main/webapp/app/facet-composer/facet-composer.component.ts @@ -38,6 +38,31 @@ export class FacetComposerComponent implements OnInit { typeSpec: ITypeSpecification; // relationOptions: string[]|undefined; + + defaultProperty = { + "type": "text", + "label": "Custom property", + "name": "customProperty", + "value": "", + "validations": [], + "pattern": null, + "propDescription": "A custom property" + } + + + defaultFacet = { + "relation": "ConsistsOf", + "properties": [ + { + "value": "simpleproperty" + }, + { + "name": "" + } + ] + } + + // eslint-disable-next-line @typescript-eslint/member-ordering constructor(private guiService: FacetComposerService, private fb: FormBuilder, @@ -89,11 +114,40 @@ export class FacetComposerComponent implements OnInit { } } + createPropertyArray2(prop: IFacetProps, propFa: FormArray):void{ + let fc; + //const propFa: FormArray = this.fb.array([]); + const fg: FormGroup = this.fb.group({}); + //const fc = new FormControl([prop.name]) + if(prop.type==="date"){ + fc = this.fb.control(new Date()) + } + if(prop.type==="number"){ + fc = this.fb.control(0) + } + if(prop.type==="boolean"){ + fc = this.fb.control(true) + } + else{ + fc = this.fb.control('') //text + } + if (prop.validations.length>0){ + for (let k=0; k(this.facetArray.controls[index]).controls.propertyArray).push(this.propertyGroup); + */ + } + + + addNewProperty(ind:number): void { + /* + const formGroup = this.createItem(this.defaultItem); + this.itemsArray.push(formGroup); + */ + //this.getPropertiesArray(ind).push(); + + alert('add prop!'); + /* + ((this.facetArray.controls[index]).controls.propertyArray).push(this.propertyGroup); + */ } - */ close():void { this.resetForm(); @@ -203,29 +277,4 @@ export class FacetComposerComponent implements OnInit { //chiude e basta } -/* -addNewCompany() { - this.companiesFormArr.push( - this.fb.group({ - company: [''], - projects: this.fb.array([]) - }) - ); -} - -deleteCompany(index: number) { - this.companiesFormArr.removeAt(index); -} - - addNewProject(control) { - control.push( - this.fb.group({ - projectName: [''] - })) -} - -deleteProject(control, index) { - control.removeAt(index) -} -*/