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.MULTILINE_TEXT,
|
||||||
FormFieldTypes.NUMBER,
|
FormFieldTypes.NUMBER,
|
||||||
FormFieldTypes.TYPEAHEAD,
|
FormFieldTypes.TYPEAHEAD,
|
||||||
FormFieldTypes.DROPDOWN
|
FormFieldTypes.DROPDOWN,
|
||||||
|
FormFieldTypes.PEOPLE
|
||||||
];
|
];
|
||||||
|
|
||||||
isSupported(field: FormFieldModel): boolean {
|
isSupported(field: FormFieldModel): boolean {
|
||||||
|
@@ -27,3 +27,19 @@
|
|||||||
.people-widget--autocomplete > ul > li {
|
.people-widget--autocomplete > ul > li {
|
||||||
opacity: 1;
|
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"
|
<input class="mdl-textfield__input"
|
||||||
type="text"
|
type="text"
|
||||||
[attr.id]="field.id"
|
[attr.id]="field.id"
|
||||||
@@ -8,8 +9,8 @@
|
|||||||
(blur)="onBlur()"
|
(blur)="onBlur()"
|
||||||
[disabled]="field.readOnly">
|
[disabled]="field.readOnly">
|
||||||
<label class="mdl-textfield__label" [attr.for]="field.id">{{field.name}}</label>
|
<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>
|
||||||
|
|
||||||
<div class="people-widget--autocomplete mdl-shadow--2dp" *ngIf="popupVisible && users.length > 0">
|
<div class="people-widget--autocomplete mdl-shadow--2dp" *ngIf="popupVisible && users.length > 0">
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="let item of users"
|
<li *ngFor="let item of users"
|
||||||
|
@@ -55,6 +55,14 @@ export class PeopleWidget extends WidgetComponent implements OnInit {
|
|||||||
let restrictWithGroup = <GroupModel> params['restrictWithGroup'];
|
let restrictWithGroup = <GroupModel> params['restrictWithGroup'];
|
||||||
this.groupId = restrictWithGroup.id;
|
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) {
|
getDisplayName(model: GroupUserModel) {
|
||||||
if (model) {
|
if (model) {
|
||||||
let displayName = `${model.firstName} ${model.lastName}`;
|
let displayName = `${model.firstName || ''} ${model.lastName || ''}`;
|
||||||
return displayName.trim();
|
return displayName.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user