+
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 36dbe9f..69f254a 100644
--- a/src/main/webapp/app/facet-composer/facet-composer.component.ts
+++ b/src/main/webapp/app/facet-composer/facet-composer.component.ts
@@ -1,3 +1,4 @@
+/* eslint-disable @typescript-eslint/member-ordering */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
/* eslint-disable no-console */
import { CommonModule } from '@angular/common';
@@ -32,6 +33,7 @@ export class FacetComposerComponent implements OnInit {
titlePath: string;
myForm: FormGroup ; //form complessiva
+ propertyGroup: FormGroup; //form complessiva
typeSpec: ITypeSpecification;
@@ -42,76 +44,80 @@ export class FacetComposerComponent implements OnInit {
this.titleType = data.type.name;
this.titlePath = data.context.path;
this.typeSpec = {} as ITypeSpecification;
-
- this.myForm = this.fb.group({
- 'facetBlocks': this.fb.array([
- this.fb.group({
- 'relation':'',
- 'facetPropsBlock':this.fb.array([]),
- //TODO: PROVA-> 'facetPropsBlock':this.fb.array([this.fb.group({}]),
- })
- ]),
-
- });
+ this.myForm = this.fb.group({
+ facetArray: this.fb.array([this.addFacetGroup()])
+ });
+ this.propertyGroup = this.fb.group({
+ propertyGroup: [],
+ });
}
- get facetBlocks() {
- return this.myForm.get('facetBlocks') as FormArray;
- }
-
-
- get facetPropsBlock(): FormArray {
- return this.myForm.get('facetPropsBlock') as FormArray;
+ private addFacetGroup(): FormGroup {
+ return this.fb.group({
+ relation: [],
+ propertyArray: this.fb.array([])
+ });
}
- /*
- addFacetBlocks() {
- const fc = {} as IFacetComposer;
- this.facetBlocks.push(this.fb.group(fc));
- }
- addFacetProps() {
- const fp = {} as IFacetProps;
- this.facetPropsBlock.push(this.fb.control(fp));
- }
- */
+ addFacet(): void {
+ this.facetArray.push(this.addFacetGroup());
+ }
+
+
+ removeFacet(index: number): void {
+ this.facetArray.removeAt(index);
+ }
+ get facetArray(): FormArray {
+ return
this.myForm.get('facetArray');
+ }
+
+
+ addProperty(index:number): void {
+ ((this.facetArray.controls[index]).controls.propertyArray).push(this.propertyGroup);
+ }
+
+
+
+
ngOnInit(): void {
- alert("facetPropsBlock");
- alert(this.facetPropsBlock);
-
this.guiService.getFormStructure(this.titlePath,this.titleType).subscribe(res => {
this.typeSpec = res;
this.prepareControls(res);
});
}
+
+
prepareControls(spec:ITypeSpecification){
for (let i=0; i