mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#726 required validator for group picker widget
This commit is contained in:
@@ -33,7 +33,8 @@ export class RequiredFieldValidator implements FormFieldValidator {
|
||||
FormFieldTypes.NUMBER,
|
||||
FormFieldTypes.TYPEAHEAD,
|
||||
FormFieldTypes.DROPDOWN,
|
||||
FormFieldTypes.PEOPLE
|
||||
FormFieldTypes.PEOPLE,
|
||||
FormFieldTypes.FUNCTIONAL_GROUP
|
||||
];
|
||||
|
||||
isSupported(field: FormFieldModel): boolean {
|
||||
|
@@ -27,3 +27,23 @@
|
||||
.functional-group-widget--autocomplete > ul > li {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.people-widget--autocomplete > ul > li {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.functional-group-widget__invalid .mdl-textfield__input {
|
||||
border-color: #d50000;
|
||||
}
|
||||
|
||||
.functional-group-widget__invalid .mdl-textfield__label {
|
||||
color: #d50000;
|
||||
}
|
||||
|
||||
.functional-group-widget__invalid .mdl-textfield__label:after {
|
||||
background-color: #d50000;
|
||||
}
|
||||
|
||||
.functional-group-widget__invalid .mdl-textfield__error {
|
||||
visibility: visible !important;
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label functional-group-widget">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label functional-group-widget"
|
||||
[class.functional-group-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="functional-group-widget--autocomplete mdl-shadow--2dp" *ngIf="popupVisible && groups.length > 0">
|
||||
<ul>
|
||||
<li *ngFor="let item of groups"
|
||||
|
@@ -54,6 +54,13 @@ export class FunctionalGroupWidget 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
|
||||
.getWorkflowGroups(this.value, this.groupId)
|
||||
.subscribe((result: GroupModel[]) => this.groups = result || []);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -58,10 +58,9 @@ export class PeopleWidget extends WidgetComponent implements OnInit {
|
||||
|
||||
// Load auto-completion for previously saved value
|
||||
if (this.value) {
|
||||
this.formService.getWorkflowUsers(this.value, this.groupId)
|
||||
.subscribe((result: GroupUserModel[]) => {
|
||||
this.users = result || [];
|
||||
});
|
||||
this.formService
|
||||
.getWorkflowUsers(this.value, this.groupId)
|
||||
.subscribe((result: GroupUserModel[]) => this.users = result || []);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user