[AAE-7765] Improved display mandatory form fields (#7531)

* [MNT-22765] Improved display mandatory form fields

* [MNT-22765] added unit tests

* [MNT-22765] fixed test with error icon on rest fail

* Trigger travis

* [MNT-22765] removed underscore from var name

* [AAE-7765] removed underscore from unit test

* [AAE-7765] fixed css lint

* [AAE-7765] fixed e2e error message css class

* [AAE-7765] fixed storybook e2e
This commit is contained in:
Tomasz Gnyp
2022-03-07 19:29:12 +01:00
committed by GitHub
parent e877cd822b
commit 3dc9f7cdfd
67 changed files with 915 additions and 219 deletions

View File

@@ -83,6 +83,11 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
@Input()
readOnly = false;
/** Mark this field as required
*/
@Input()
required = false;
/** FormControl to list of group */
@Input()
groupChipsCtrl = new FormControl({ value: '', disabled: false });
@@ -121,9 +126,10 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
invalidGroups: IdentityGroupModel[] = [];
searchGroups$ = new BehaviorSubject<IdentityGroupModel[]>(this.searchGroups);
_subscriptAnimationState = 'enter';
subscriptAnimationState: string = 'enter';
clientId: string;
isFocused: boolean;
touched: boolean = false;
validateGroupsMessage: string;
searchedValue = '';
@@ -472,6 +478,22 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
return this.isValidationEnabled() && this.validationLoading;
}
markAsTouched(): void {
this.touched = true;
}
isTouched(): boolean {
return this.touched;
}
isSelected(): boolean {
return this.selectedGroups && !!this.selectedGroups.length;
}
isDirty(): boolean {
return this.isTouched() && !this.isSelected();
}
setFocus(isFocused: boolean) {
this.isFocused = isFocused;
}