mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
#726 people widget validator and bug fixes
- people widget validator (Required) - fixes #744 - fixes #745
This commit is contained in:
@@ -32,7 +32,8 @@ export class RequiredFieldValidator implements FormFieldValidator {
|
||||
FormFieldTypes.MULTILINE_TEXT,
|
||||
FormFieldTypes.NUMBER,
|
||||
FormFieldTypes.TYPEAHEAD,
|
||||
FormFieldTypes.DROPDOWN
|
||||
FormFieldTypes.DROPDOWN,
|
||||
FormFieldTypes.PEOPLE
|
||||
];
|
||||
|
||||
isSupported(field: FormFieldModel): boolean {
|
||||
|
@@ -27,3 +27,19 @@
|
||||
.people-widget--autocomplete > ul > li {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.people-widget__invalid .mdl-textfield__input {
|
||||
border-color: #d50000;
|
||||
}
|
||||
|
||||
.people-widget__invalid .mdl-textfield__label {
|
||||
color: #d50000;
|
||||
}
|
||||
|
||||
.people-widget__invalid .mdl-textfield__label:after {
|
||||
background-color: #d50000;
|
||||
}
|
||||
|
||||
.people-widget__invalid .mdl-textfield__error {
|
||||
visibility: visible !important;
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label people-widget">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label people-widget"
|
||||
[class.people-widget__invalid]="!field.isValid">
|
||||
<input class="mdl-textfield__input"
|
||||
type="text"
|
||||
[attr.id]="field.id"
|
||||
@@ -8,8 +9,8 @@
|
||||
(blur)="onBlur()"
|
||||
[disabled]="field.readOnly">
|
||||
<label class="mdl-textfield__label" [attr.for]="field.id">{{field.name}}</label>
|
||||
<span *ngIf="field.validationSummary" class="mdl-textfield__error">{{field.validationSummary}}</span>
|
||||
</div>
|
||||
|
||||
<div class="people-widget--autocomplete mdl-shadow--2dp" *ngIf="popupVisible && users.length > 0">
|
||||
<ul>
|
||||
<li *ngFor="let item of users"
|
||||
|
@@ -55,6 +55,14 @@ export class PeopleWidget extends WidgetComponent implements OnInit {
|
||||
let restrictWithGroup = <GroupModel> params['restrictWithGroup'];
|
||||
this.groupId = restrictWithGroup.id;
|
||||
}
|
||||
|
||||
// Load auto-completion for previously saved value
|
||||
if (this.value) {
|
||||
this.formService.getWorkflowUsers(this.value, this.groupId)
|
||||
.subscribe((result: GroupUserModel[]) => {
|
||||
this.users = result || [];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +105,7 @@ export class PeopleWidget extends WidgetComponent implements OnInit {
|
||||
|
||||
getDisplayName(model: GroupUserModel) {
|
||||
if (model) {
|
||||
let displayName = `${model.firstName} ${model.lastName}`;
|
||||
let displayName = `${model.firstName || ''} ${model.lastName || ''}`;
|
||||
return displayName.trim();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user