building DOM for new added facet forms
This commit is contained in:
parent
3f93e339fe
commit
c148bb73c9
|
@ -59,19 +59,20 @@ public class FacetSpecDTO {
|
|||
public void setRelation(String relation) {
|
||||
this.relation = relation;
|
||||
}
|
||||
public Integer getMin() {
|
||||
|
||||
public String getMin() {
|
||||
return min;
|
||||
}
|
||||
public void setMin(Integer min) {
|
||||
public void setMin(String min) {
|
||||
this.min = min;
|
||||
}
|
||||
public Integer getMax() {
|
||||
public String getMax() {
|
||||
return max;
|
||||
}
|
||||
public void setMax(Integer max) {
|
||||
public void setMax(String max) {
|
||||
this.max = max;
|
||||
}
|
||||
private Integer min;
|
||||
private Integer max;
|
||||
private String min;
|
||||
private String max;
|
||||
|
||||
}
|
|
@ -13,20 +13,34 @@ public class FacetTypeDTO {
|
|||
this.target = target;
|
||||
this.description = description;
|
||||
this.relation = relation;
|
||||
this.min = min;
|
||||
this.min = min.toString();
|
||||
if(max==null) {
|
||||
//prefer to avoid null in a field (MEANS MAX>1)
|
||||
max=-1;
|
||||
this.max="many";
|
||||
}else {
|
||||
this.max = max.toString();
|
||||
}
|
||||
this.max = max;
|
||||
|
||||
}
|
||||
private static final Logger log = LoggerFactory.getLogger(FacetTypeDTO.class);
|
||||
//TODO: vedi se a regime può servire ID
|
||||
private String relation;
|
||||
private String target; //il nome della facet
|
||||
private String description;
|
||||
private Integer min;
|
||||
private Integer max;
|
||||
public String getMin() {
|
||||
return min;
|
||||
}
|
||||
public void setMin(String min) {
|
||||
this.min = min;
|
||||
}
|
||||
public String getMax() {
|
||||
return max;
|
||||
}
|
||||
public void setMax(String max) {
|
||||
this.max = max;
|
||||
}
|
||||
private String min;
|
||||
private String max;
|
||||
|
||||
private String[] relationOptions;
|
||||
|
||||
|
@ -55,18 +69,7 @@ public class FacetTypeDTO {
|
|||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public Integer getMin() {
|
||||
return min;
|
||||
}
|
||||
public void setMin(Integer min) {
|
||||
this.min = min;
|
||||
}
|
||||
public Integer getMax() {
|
||||
return max;
|
||||
}
|
||||
public void setMax(Integer max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,14 @@
|
|||
<mat-form-field appearance="outline" >
|
||||
<input matInput formControlName="name" id="{{typeSpec.facetSpecs[ind].name}}" type="text" [readonly]="true" style="font-size: larger; font-weight: 700;" />
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label for="relation" >occurr. min</mat-label>
|
||||
<input matInput formControlName="min" id="min" type="text" readonly="true"/>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label for="relation" >occurr. max</mat-label>
|
||||
<input matInput formControlName="max" id="max" type="text" readonly="true"/>
|
||||
</mat-form-field>
|
||||
<!--TODO: vedi quando si possono rendere editabili le relazioni-->
|
||||
<!-- </mat-panel-title>
|
||||
</mat-expansion-panel-header> -->
|
||||
|
@ -60,8 +68,13 @@
|
|||
<!-- </mat-expansion-panel>-->
|
||||
<div style="padding-top: 20px; padding-bottom: 8px; margin: 5px;">
|
||||
<!--TODO: AGGIUNGI NUOVA SOLO SE IN ULTIMA POSIZIONE -->
|
||||
<button mat-icon-button color="primary" (click)="addFacet(ind)" matTooltip="add new {{typeSpec.facetSpecs[ind].name}}" matTooltipClass="tableTooltip" matTooltipPosition="above"><mat-icon>add</mat-icon></button>
|
||||
<button mat-icon-button color="primary" (click)="removeFacet(ind)" matTooltip="remove {{typeSpec.facetSpecs[ind].name}}" matTooltipClass="tableTooltip" matTooltipPosition="above"><mat-icon>delete_outline</mat-icon></button>
|
||||
<button mat-icon-button color="primary" [disabled]="typeSpec.facetSpecs[ind].max==='1'"
|
||||
(click)="addFacet(ind)" matTooltip="add new" matTooltipClass="tableTooltip"
|
||||
matTooltipPosition="above"><mat-icon>add</mat-icon></button>
|
||||
|
||||
<button mat-icon-button color="primary" [disabled]="typeSpec.facetSpecs[ind].min==='1'"
|
||||
(click)="removeFacet(ind)" matTooltip="remove" matTooltipClass="tableTooltip"
|
||||
matTooltipPosition="above"><mat-icon>delete_outline</mat-icon></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -98,8 +98,15 @@ export class FacetComposerComponent implements OnInit {
|
|||
this.guiService.getFormStructure(this.titlePath,this.titleType).subscribe(res => {
|
||||
this.typeSpec = res;
|
||||
this.facetData = res.facetSpecs;
|
||||
|
||||
//TODO: MAPPARE SUL NAME DELLA FACET TUTTO IN MODO DA USARE LA MAPPA INVECE DELL'ARRAY NELL'HTML
|
||||
const mapRelazioni = new Map(res.facetSpecs.map((obj) => [obj.name, obj.relationOptions]));
|
||||
|
||||
|
||||
this.createForm(res);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,6 +169,12 @@ export class FacetComposerComponent implements OnInit {
|
|||
const nameFc = this.fb.control(item.name);
|
||||
facetFg.addControl('name', nameFc);
|
||||
|
||||
const maxFc = this.fb.control(item.max);
|
||||
facetFg.addControl('max', maxFc);
|
||||
|
||||
const minFc = this.fb.control(item.min);
|
||||
facetFg.addControl('min', minFc);
|
||||
|
||||
const descriptionFc = this.fb.control(item.description);
|
||||
facetFg.addControl('description', descriptionFc);
|
||||
|
||||
|
@ -220,12 +233,19 @@ export class FacetComposerComponent implements OnInit {
|
|||
addFacet(ind:number): void {
|
||||
// this.facetArray.push(this.addFacetGroup());
|
||||
//this.createFacetGroup(this.facetData[ind]);
|
||||
|
||||
const icf: IFacetComposer = this.facetData[ind];
|
||||
|
||||
const facetFg: FormGroup = this.fb.group({});
|
||||
const nameFc = this.fb.control(icf.name);
|
||||
facetFg.addControl('name', nameFc);
|
||||
|
||||
const maxFc = this.fb.control(icf.max);
|
||||
facetFg.addControl('max', maxFc);
|
||||
|
||||
const minFc = this.fb.control(icf.min);
|
||||
facetFg.addControl('min', minFc);
|
||||
|
||||
const descriptionFc = this.fb.control(icf.description);
|
||||
facetFg.addControl('description', descriptionFc);
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ name:string //facet name (name)
|
|||
description:string //facet description (textarea)
|
||||
relation:string
|
||||
relationOptions: string[]
|
||||
min:number
|
||||
max:number
|
||||
min:string
|
||||
max:string
|
||||
guiProps:IFacetProps[]
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<button (click)="addNewItem()">Add New Item</button>
|
||||
<button (click)="addNewItem()" enab>Add New Item</button>
|
||||
<button (click)="deleteAll()">Delete All</button>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -20,9 +20,8 @@
|
|||
<button mat-raised-button color="primary" routerLink="/addResource">New Resource</button>
|
||||
<button mat-raised-button color="primary" routerLink="/facetComposer">Facet Composer</button>
|
||||
<button mat-raised-button color="primary" routerLink="/dynamicFormComponent">Form Dinamica</button>
|
||||
<button mat-raised-button color="primary" routerLink="/formComposer">Form Composer</button>
|
||||
-->
|
||||
<button mat-raised-button color="primary" routerLink="/formComposer">Form Composer</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue