added new types

This commit is contained in:
Maria Teresa Paratore 2024-05-27 18:34:07 +02:00
parent 51ed9e7ea0
commit a881508435
2 changed files with 73 additions and 24 deletions

View File

@ -71,22 +71,77 @@
<div formArrayName ="extraProps" style="border: 2px solid rgb(176, 206, 230); padding: 10px; margin: 5px;">
<span [style.width.px]="350" [style.font-weight]="900">Custom Properties</span>
<div [formGroupName] ="i" *ngFor="let x of getExtraPropsArray(facetTemplate.key,ind).controls; let i=index;">
<mat-form-field>
<mat-label for="deno">name</mat-label>
<input matInput formControlName="deno" type="text"/>
</mat-form-field>
<mat-form-field>
<mat-label for="val">value</mat-label>
<input matInput formControlName="val" type="text"/>
</mat-form-field>
<mat-form-field>
<mat-label for="tipo" >type</mat-label>
<mat-select formControlName="tipo" id="tipo">
<mat-select formControlName="tipo" id="tipo" [(ngModel)]="selectedType">
<mat-option *ngFor="let tp of optionTypes" [value]="tp.value" >
{{tp.value}}
</mat-option>
</mat-select>
</mat-form-field>
<div *ngIf="selectedType === 'String'">
<mat-form-field>
<mat-label for="deno">name</mat-label>
<input matInput formControlName="deno" type="text"/>
</mat-form-field>
<mat-form-field>
<mat-label for="val">value</mat-label>
<input matInput formControlName="val" type="text"/>
</mat-form-field>
</div>
<div *ngIf="selectedType === 'Integer'">
<mat-form-field>
<mat-label for="deno">name</mat-label>
<input matInput formControlName="deno" type="text"/>
</mat-form-field>
<mat-form-field>
<mat-label for="val">value</mat-label>
<input matInput formControlName="val" type="number"/>
</mat-form-field>
</div>
<div *ngIf="selectedType === 'Encrypted'">
<mat-form-field>
<mat-label for="deno">name</mat-label>
<input matInput formControlName="deno" type="text"/>
</mat-form-field>
<mat-form-field>
<mat-label for="val">value</mat-label>
<input matInput formControlName="val" type="password"/>
</mat-form-field>
</div>
<div *ngIf="selectedType === 'Float'">
<mat-form-field>
<mat-label for="deno">name</mat-label>
<input matInput formControlName="deno" type="text"/>
</mat-form-field>
<mat-form-field>
<mat-label for="val">value</mat-label>
<!-- TODO: MODIFICARE QUESTO -->
<input matInput formControlName="val" type="number"/>
</mat-form-field>
</div>
<div *ngIf="selectedType === 'Boolean'">
<mat-form-field>
<mat-label for="deno">name</mat-label>
<input matInput formControlName="deno" type="text"/>
</mat-form-field>
<mat-form-field>
<mat-label for="val">value</mat-label>
<!-- TODO: MODIFICARE QUESTO -->
<input matInput formControlName="val" type="radio"/>
</mat-form-field>
</div>
<div *ngIf="selectedType === 'Date'">
<mat-form-field>
<mat-label for="deno">name</mat-label>
<input matInput formControlName="deno" type="text"/>
</mat-form-field>
<mat-form-field>
<mat-label for="val">value</mat-label>
<!-- TODO: MODIFICARE QUESTO -->
<input matInput formControlName="val" type="date"/>
</mat-form-field>
</div>
<button mat-stroked-button color="primary" style="margin-left: 12px;"
(click)="removeExtraProp(facetTemplate.key,ind,i)" >

View File

@ -33,6 +33,7 @@ export class FacetComposerComponent implements OnInit {
titleType: string;
titlePath: string;
selectedOption: string;
selectedType: string;
myForm: FormGroup; //form complessiva
typeSpec: ITypeSpecification;
@ -47,6 +48,7 @@ export class FacetComposerComponent implements OnInit {
this.titleType = data.type.name;
this.titlePath = data.context.path;
this.selectedOption = '';
this.selectedType = '';
this.typeSpec = {} as ITypeSpecification;
this.fieldsMap = new Map<string,IFacetComposer>();
this.myForm = this.fb.group({});
@ -80,26 +82,18 @@ export class FacetComposerComponent implements OnInit {
*/
optionTypes = [
{ value: 'String'} //per ora solo tipo String
/*
{ value: 'Boolean'},
{ value: 'Integer'},
{ value: 'Short'},
{ value: 'Long'},
{ value: 'Float'},
{ value: 'Double'},
{ value: 'Password'},
{ value: 'Date'},
{ value: 'String'},
{ value: 'Binary'},
{ value: 'Byte'}
*/
{ value: 'Encrypted'},
{ value: 'Float'},
{ value: 'Integer'},
{ value: 'String'}
];
onOptionsSelected(value:string): void {
this.selectedOption = value;
//console.debug('******onOptionsSelected?...'+value);
onOptionTypeSelected(): void {
console.debug('******onOptionsSelected?...'+this.selectedType);
}
//TODO: NOTA BENE--> FormGroup->access by NAME, FormArray->access by INDEX!!