@Input('dataTypeMap') dataTypeMap$: Observable<Map<string, DataTypeModel>>;
@Input('isView') isView: boolean;
@Input() existingInputNames: Array<string> = [];
+ @Input('defaultType') defaultType: string;
@Output('onAddInput') onAddInputEvent: EventEmitter<InputOperationParameter>;
dataTypeMap: Map<string, DataTypeModel>;
input.schema.property = new SchemaProperty();
input.schema.property.type = schemaForm.value;
}
- input.inputId = this.generateUniqueId();
this.onAddInputEvent.emit(input);
this.hideAddInput();
this.resetForm();
}
showAddInput() {
+ if (this.defaultType) {
+ this.onChangeInputType(this.defaultType);
+ }
this.showForm = true;
this.showAddLink = false;
}
this.resetForm();
}
- private generateUniqueId(): string {
- let result = '';
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- const charactersLength = characters.length;
- for (let i = 0; i < 36; i++ ) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- return result;
- }
-
private resetForm() {
this.inputForm.reset();
this.showInputSchema = false;