mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3562] People Widget reactive form (#3805)
* [ADF-3562] People Widget reactive form * [ADF-3382] Removed comment
This commit is contained in:
committed by
Eugenio Romano
parent
7e4c30a274
commit
bd4ac1b71d
@@ -10,7 +10,6 @@
|
|||||||
data-automation-id="adf-people-search-input"
|
data-automation-id="adf-people-search-input"
|
||||||
type="text"
|
type="text"
|
||||||
[id]="field.id"
|
[id]="field.id"
|
||||||
[(ngModel)]="value"
|
|
||||||
[formControl]="searchTerm"
|
[formControl]="searchTerm"
|
||||||
placeholder="{{field.placeholder}}"
|
placeholder="{{field.placeholder}}"
|
||||||
[matAutocomplete]="auto">
|
[matAutocomplete]="auto">
|
||||||
|
@@ -70,7 +70,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
map((list: UserProcessModel[]) => {
|
map((list: UserProcessModel[]) => {
|
||||||
let value = (this.input.nativeElement as HTMLInputElement).value;
|
let value = this.searchTerm.value;
|
||||||
this.checkUserAndValidateForm(list, value);
|
this.checkUserAndValidateForm(list, value);
|
||||||
return list;
|
return list;
|
||||||
})
|
})
|
||||||
@@ -83,7 +83,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.field) {
|
if (this.field) {
|
||||||
this.value = this.getDisplayName(this.field.value);
|
this.searchTerm.setValue(this.getDisplayName(this.field.value));
|
||||||
if (this.field.readOnly) {
|
if (this.field.readOnly) {
|
||||||
this.searchTerm.disable();
|
this.searchTerm.disable();
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
|
|
||||||
checkUserAndValidateForm(list, value) {
|
checkUserAndValidateForm(list, value) {
|
||||||
const isValidUser = this.isValidUser(list, value);
|
const isValidUser = this.isValidUser(list, value);
|
||||||
if (isValidUser) {
|
if (isValidUser || value === '') {
|
||||||
this.field.validationSummary.message = '';
|
this.field.validationSummary.message = '';
|
||||||
this.field.validate();
|
this.field.validate();
|
||||||
this.field.form.validateForm();
|
this.field.form.validateForm();
|
||||||
@@ -131,7 +131,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
onItemSelect(item) {
|
onItemSelect(item) {
|
||||||
if (item) {
|
if (item) {
|
||||||
this.field.value = item;
|
this.field.value = item;
|
||||||
this.value = item;
|
this.searchTerm.setValue(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user