From 6ca7b792e7811fbb61cc84e74fce7653fe43780b Mon Sep 17 00:00:00 2001 From: Sofia Papacharalampous Date: Thu, 21 Mar 2024 18:01:17 +0200 Subject: [PATCH] 1. renamed user-field->dmp-user-field, 2. fixed sorting issue, 3. styling changes --- .../dmp-editor.component.html | 2 +- .../dmp-editor-blueprint/dmp-editor.module.ts | 4 +- .../dmp-user-field.component.html | 90 +++++++++++++++++++ .../dmp-user-field.component.scss} | 14 ++- .../dmp-user-field.component.ts} | 31 ++++++- .../dmp-user-field.module.ts} | 12 ++- .../dmp-invitation-dialog.component.html | 2 +- .../dialog/dmp-invitation-dialog.module.ts | 4 +- .../dmp/user-field/user-field.component.html | 82 ----------------- 9 files changed, 142 insertions(+), 99 deletions(-) create mode 100644 dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.html rename dmp-frontend/src/app/ui/dmp/{user-field/user-field.component.scss => dmp-user-field/dmp-user-field.component.scss} (58%) rename dmp-frontend/src/app/ui/dmp/{user-field/user-field.component.ts => dmp-user-field/dmp-user-field.component.ts} (83%) rename dmp-frontend/src/app/ui/dmp/{user-field/user-field.module.ts => dmp-user-field/dmp-user-field.module.ts} (61%) delete mode 100644 dmp-frontend/src/app/ui/dmp/user-field/user-field.component.html diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html index 97269a61e..05862add9 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.component.html @@ -244,7 +244,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.module.ts b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.module.ts index b9d78b31e..7a0957885 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.module.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.module.ts @@ -9,7 +9,7 @@ import { DmpEditorRoutingModule } from './dmp-editor.routing'; import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module'; import { ReferenceFieldModule } from '@app/ui/reference/reference-field/reference-field.module'; import { DragDropModule } from '@angular/cdk/drag-drop'; -import { UserFieldModule } from '../user-field/user-field.module'; +import { DmpUserFieldModule } from '../dmp-user-field/dmp-user-field.module'; @NgModule({ imports: [ @@ -22,7 +22,7 @@ import { UserFieldModule } from '../user-field/user-field.module'; AutoCompleteModule, ReferenceFieldModule, DragDropModule, - UserFieldModule + DmpUserFieldModule ], declarations: [ DmpEditorComponent, diff --git a/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.html b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.html new file mode 100644 index 000000000..8ce4a05d5 --- /dev/null +++ b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.html @@ -0,0 +1,90 @@ +
+ +
+
+
+ +
+
+
+ + +
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+ + + + +
+ {{userIndex + 1}} + drag_indicator +
+
+ +
+ {{enumUtils.toDmpUserTypeString(userType)}} +
+
+
+
+ + {{'DMP-EDITOR.FIELDS1.USER' | translate}}* + + {{user.get('user').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+ + {{'DMP-EDITOR.FIELDS1.EMAIL' | translate}}* + + {{user.get('email').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+ + {{'DMP-EDITOR.FIELDS1.USER-ROLE' | translate}} + + {{enumUtils.toDmpUserRoleString(userRole)}} + + {{user.get('role').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}} + +
+
+ + {{'DMP-EDITOR.FIELDS1.SECTION' | translate}} + + + {{ section.label }} + + + {{user.get('sectionId').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' |translate}} + +
+
+ +
+ + {{'DMP-EDITOR.USERS-REQUIRED' | translate}} + {{form.get('users').getError('backendError').message}} +
diff --git a/dmp-frontend/src/app/ui/dmp/user-field/user-field.component.scss b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.scss similarity index 58% rename from dmp-frontend/src/app/ui/dmp/user-field/user-field.component.scss rename to dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.scss index 909b9e9ce..9d8a2e18c 100644 --- a/dmp-frontend/src/app/ui/dmp/user-field/user-field.component.scss +++ b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.scss @@ -1,4 +1,4 @@ -.invite-users-dialog-wrapper { +.invite-users-wrapper { display: flex; flex-direction: column; align-items: baseline; @@ -14,6 +14,14 @@ color: rgba(0, 0, 0, 0.38);; } -.user-fields-wrapper { + +@media (max-width:1400px) { -} + .user-fields { + flex-direction: column; + } + + .user-field { + align-self: flex-start; + } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/dmp/user-field/user-field.component.ts b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.ts similarity index 83% rename from dmp-frontend/src/app/ui/dmp/user-field/user-field.component.ts rename to dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.ts index 0df0b0e9b..298f18318 100644 --- a/dmp-frontend/src/app/ui/dmp/user-field/user-field.component.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.component.ts @@ -12,11 +12,11 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid import { DmpEditorModel, DmpUserEditorModel } from '../dmp-editor-blueprint/dmp-editor.model'; @Component({ - selector: 'app-user-field-component', - templateUrl: 'user-field.component.html', - styleUrls: ['./user-field.component.scss'] + selector: 'app-dmp-user-field-component', + templateUrl: 'dmp-user-field.component.html', + styleUrls: ['./dmp-user-field.component.scss'] }) -export class UserFieldComponent extends BaseComponent implements OnInit { +export class DmpUserFieldComponent extends BaseComponent implements OnInit { @Input() form; @Input() validationErrorModel: ValidationErrorModel; @@ -25,7 +25,9 @@ export class UserFieldComponent extends BaseComponent implements OnInit { @Input() placeholder: string; @Input() sections: DmpBlueprintDefinitionSection[] = null; @Input() initializeUsers: boolean = false; + @Input() enableSorting: boolean = true; + hoveredUser:number = -1; dmpUserTypeEnum = DmpUserType; dmpUserTypeEnumValues = this.enumUtils.getEnumValues(DmpUserType); @@ -33,6 +35,7 @@ export class UserFieldComponent extends BaseComponent implements OnInit { multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration; + constructor( public enumUtils: EnumUtils, public userService: UserService @@ -63,6 +66,12 @@ export class UserFieldComponent extends BaseComponent implements OnInit { this.form.get('users').markAsDirty(); } + // + // + // Users + // + // + dropUsers(event: CdkDragDrop) { const usersFormArray = (this.form.get('users') as FormArray); @@ -77,4 +86,18 @@ export class UserFieldComponent extends BaseComponent implements OnInit { ); this.form.get('users').markAsDirty(); } + + isUserSelected(userId: number): boolean { + return this.hoveredUser === userId; + } + + onUserHover(userIndex: number): void { + if (this.enableSorting === false) return; + + this.hoveredUser = userIndex; + } + + clearHoveredUser(): void { + this.hoveredUser = -1; + } } diff --git a/dmp-frontend/src/app/ui/dmp/user-field/user-field.module.ts b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.module.ts similarity index 61% rename from dmp-frontend/src/app/ui/dmp/user-field/user-field.module.ts rename to dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.module.ts index 9365117fa..65d024af3 100644 --- a/dmp-frontend/src/app/ui/dmp/user-field/user-field.module.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp-user-field/dmp-user-field.module.ts @@ -3,20 +3,24 @@ import { FormattingModule } from '@app/core/formatting.module'; import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module'; import { CommonFormsModule } from '@common/forms/common-forms.module'; import { CommonUiModule } from '@common/ui/common-ui.module'; -import { UserFieldComponent } from './user-field.component'; +import { DragDropModule } from '@angular/cdk/drag-drop'; +import { NgxDropzoneModule } from "ngx-dropzone"; +import { DmpUserFieldComponent } from './dmp-user-field.component'; @NgModule({ imports: [ CommonUiModule, CommonFormsModule, FormattingModule, + NgxDropzoneModule, + DragDropModule, AutoCompleteModule ], declarations: [ - UserFieldComponent + DmpUserFieldComponent ], exports: [ - UserFieldComponent + DmpUserFieldComponent ] }) -export class UserFieldModule { } +export class DmpUserFieldModule { } diff --git a/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component.html b/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component.html index 475d3e46b..d969e2a63 100644 --- a/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component.html +++ b/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.component.html @@ -9,7 +9,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.module.ts b/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.module.ts index b8cf4ee3d..0a708ae42 100644 --- a/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.module.ts +++ b/dmp-frontend/src/app/ui/dmp/invitation/dialog/dmp-invitation-dialog.module.ts @@ -4,10 +4,10 @@ import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.mod import { RichTextEditorModule } from "@app/library/rich-text-editor/rich-text-editor.module"; import { CommonUiModule } from '@common/ui/common-ui.module'; import { DmpInvitationDialogComponent } from './dmp-invitation-dialog.component'; -import { UserFieldModule } from '../../user-field/user-field.module'; +import { DmpUserFieldModule } from '../../dmp-user-field/dmp-user-field.module'; @NgModule({ - imports: [CommonUiModule, FormsModule, ReactiveFormsModule, AutoCompleteModule, RichTextEditorModule, UserFieldModule], + imports: [CommonUiModule, FormsModule, ReactiveFormsModule, AutoCompleteModule, RichTextEditorModule, DmpUserFieldModule], declarations: [DmpInvitationDialogComponent], exports: [DmpInvitationDialogComponent] }) diff --git a/dmp-frontend/src/app/ui/dmp/user-field/user-field.component.html b/dmp-frontend/src/app/ui/dmp/user-field/user-field.component.html deleted file mode 100644 index 80ffb7718..000000000 --- a/dmp-frontend/src/app/ui/dmp/user-field/user-field.component.html +++ /dev/null @@ -1,82 +0,0 @@ -
-
- -
- - - - - -
-
- -
-
-
- - -
- -
- {{userIndex + 1}} -
-
drag_indicator
-
- -
- {{enumUtils.toDmpUserTypeString(userType)}} -
-
-
-
- - {{'DMP-EDITOR.FIELDS1.USER' | translate}}* - - {{user.get('user').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
-
- - {{'DMP-EDITOR.FIELDS1.EMAIL' | translate}}* - - {{user.get('email').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
-
- - {{'DMP-EDITOR.FIELDS1.USER-ROLE' | translate}} - - {{enumUtils.toDmpUserRoleString(userRole)}} - - {{user.get('role').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - -
-
- - {{'DMP-EDITOR.FIELDS1.SECTION' | translate}} - - - {{ section.label }} - - - {{user.get('sectionId').getError('backendError').message}} - {{'GENERAL.VALIDATION.REQUIRED' |translate}} - -
-
- -
-
- - {{'DMP-EDITOR.USERS-REQUIRED' | translate}} - {{form.get('users').getError('backendError').message}} -