[AAE-1152] Making sure the people and group widget is working fine as part of form (#5322)

* Making sure the people and group widget is working fine as part of the form

* Be able to save a form with people and group

* Fix tslint

* Fix html error

* Fix unit test
This commit is contained in:
Maurizio Vitale
2019-12-11 11:22:50 +00:00
committed by Eugenio Romano
parent d8b703b6ef
commit 88d89b4ca8
10 changed files with 98 additions and 55 deletions

View File

@@ -55,6 +55,7 @@ export class FormFieldModel extends FormWidgetModel {
regexPattern: string;
options: FormFieldOption[] = [];
restUrl: string;
roles: string[];
restResponsePath: string;
restIdProperty: string;
restLabelProperty: string;
@@ -79,11 +80,6 @@ export class FormFieldModel extends FormWidgetModel {
emptyOption: FormFieldOption;
validationSummary: ErrorMessageModel;
// People and Group Options
appName: string;
roles: string[];
mode: string;
get value(): any {
return this._value;
}
@@ -145,6 +141,8 @@ export class FormFieldModel extends FormWidgetModel {
this.id = json.id;
this.name = json.name;
this.type = json.type;
this.roles = json.roles;
this.optionType = json.optionType;
this._required = <boolean> json.required;
this._readOnly = <boolean> json.readOnly || json.type === 'readonly';
this.overrideId = <boolean> json.overrideId;
@@ -173,11 +171,6 @@ export class FormFieldModel extends FormWidgetModel {
this._value = this.parseValue(json);
this.validationSummary = new ErrorMessageModel();
// People and Group Options
this.appName = json.appName;
this.roles = json.roles;
this.mode = json.mode;
if (json.placeholder && json.placeholder !== '' && json.placeholder !== 'null') {
this.placeholder = json.placeholder;
}
@@ -403,6 +396,12 @@ export class FormFieldModel extends FormWidgetModel {
case FormFieldTypes.BOOLEAN:
this.form.values[this.id] = (this.value !== null && this.value !== undefined) ? this.value : false;
break;
case FormFieldTypes.PEOPLE:
this.form.values[this.id] = (this.value !== null && this.value !== undefined) ? this.value : [];
break;
case FormFieldTypes.FUNCTIONAL_GROUP:
this.form.values[this.id] = (this.value !== null && this.value !== undefined) ? this.value : [];
break;
default:
if (!FormFieldTypes.isReadOnlyType(this.type) && !this.isInvalidFieldType(this.type)) {
this.form.values[this.id] = this.value;