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 40c5935..a3fc0fc 100644 --- a/src/main/webapp/app/facet-composer/facet-composer.component.html +++ b/src/main/webapp/app/facet-composer/facet-composer.component.html @@ -1,6 +1,8 @@

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

+ + @@ -12,41 +14,53 @@

{{typeSpec.description}}

- -
- - - - - - - - {{fct.name}} - - -

{{fct.description}}

-
- formGroup per la facet {{ind}}:
- -
- - -
-
-
-
+ +
+
+ +
+ + + + + + + + {{typeSpec.facetSpecs[ind].name}} + + +

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

+ + +

group {{ind}}

+
+
+
+

control {{i}} - + +

+
+
+
+ + +
+
+
+ + + + + + + + +
+ + - -
- - + \ 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 2760bb4..5448217 100644 --- a/src/main/webapp/app/facet-composer/facet-composer.component.ts +++ b/src/main/webapp/app/facet-composer/facet-composer.component.ts @@ -12,7 +12,6 @@ import { MatFormFieldModule } from '@angular/material/form-field'; import { MatButtonModule } from '@angular/material/button'; import { MatInputModule } from '@angular/material/input'; import { MatExpansionModule } from '@angular/material/expansion'; -import { IFacetProp } from 'app/services/i-facet'; @@ -32,22 +31,10 @@ export class FacetComposerComponent implements OnInit { titleType: string; titlePath: string; - facetListForm: FormGroup | any ; //form complessiva + myForm: FormGroup ; //form complessiva + typeSpec: ITypeSpecification; - //primo indice: facetSpecs, secondo: guiProps (in facetSpecs) - facetItemsList2D: IFacetGui[][] = []; - facetPropsControls: FormGroup[][] =[]; //form per le props di una singola facet -/* - defaultFacetGui = { - name: '', - description: '', - mandatory:false, - notnull:false, - regexp:'', - propertyType:'' - }; - */ - + // eslint-disable-next-line @typescript-eslint/member-ordering constructor(private guiService: FacetComposerService, private fb: FormBuilder, @@ -56,123 +43,52 @@ export class FacetComposerComponent implements OnInit { this.titleType = data.type.name; this.titlePath = data.context.path; this.typeSpec = {} as ITypeSpecification; - } - - ngOnInit(): void { - this.guiService.getFormStructure(this.titlePath,this.titleType).subscribe(res => { - this.typeSpec = res; - this.buildFacetItemsList(this.typeSpec); - this.displayItems(); - }); - //TODO:GUARDA QUA - this.facetListForm = this.fb.group({ - items: this.fb.array([]), + + this.myForm = this.fb.group({ + facets: this.fb.array([]), }); - - } - - //TODO: CI VUOLE UN ARRAY DI FORMARRAY - get facetItemsArray() { - return this.facetListForm.get('items'); - } - - buildFacetItemsList(globalDesc:ITypeSpecification):void{ - for (let i=0; ithis.toDoListForm.get('facetItems'); - }*/ - - //TODO: vedi qua - //https://copyprogramming.com/howto/typescript-angular-9-programmatically-add-control-to-form - /* - { - "type": "text", - "label": "Unit", - "name": "unit", - "value": "", - "validations": [ - { - "name": "pattern", - "validator": "pattern", - "message": "Wrong field format, required is: ^(Byte|kB|MB|GB|TB|PB|EB|ZB|YB)$" - } - ], - "pattern": null, - "propDescription": "" - } - */ - - /* - //chiude e passa i dati al component chiamante - doAction():void { - this.dialogRef.close({event:'add',data:this.composerForm.value}); - } + + ngOnInit(): void { + this.guiService.getFormStructure(this.titlePath,this.titleType).subscribe(res => { + this.typeSpec = res; + }); - - onSubmit():void { - console.log(this.composerForm.value); - } - */ - + for (let ind = 0; ind < this.typeSpec.facetSpecs.length; ind++) { + const fGroup: FormGroup = new FormGroup({}); + let ctrl: FormControl|undefined; + for(let j=0; j