From 63c76644c148cde3b4848126764bd1632319b7bf Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Fri, 23 Aug 2024 14:10:58 +0200 Subject: [PATCH 01/13] 117544: First implementation of an aria friendly disabled state --- src/app/shared/disabled-directive.ts | 31 ++++++++++++++++++++++++++++ src/app/shared/shared.module.ts | 2 ++ src/styles/_global-styles.scss | 11 ++++++++++ 3 files changed, 44 insertions(+) create mode 100644 src/app/shared/disabled-directive.ts diff --git a/src/app/shared/disabled-directive.ts b/src/app/shared/disabled-directive.ts new file mode 100644 index 00000000000..8d1380917fe --- /dev/null +++ b/src/app/shared/disabled-directive.ts @@ -0,0 +1,31 @@ +import { Directive, Input, HostBinding, HostListener } from '@angular/core'; + +@Directive({ + selector: '[dsDisabled]' +}) +export class DisabledDirective { + + @Input() set dsDisabled(value: boolean) { + this.isDisabled = value; + } + + @HostBinding('attr.aria-disabled') isDisabled = false; + @HostBinding('class.disabled') get disabledClass() { return this.isDisabled; } + + @HostListener('click', ['$event']) + handleClick(event: Event) { + if (this.isDisabled) { + event.preventDefault(); + event.stopImmediatePropagation(); + } + } + + @HostListener('keydown', ['$event']) + handleKeydown(event: KeyboardEvent) { + if (this.isDisabled && (event.key === 'Enter' || event.key === 'Space')) { + event.preventDefault(); + event.stopImmediatePropagation(); + } + } +} + diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 0f7871f7f9b..c9a6f9b6d0d 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -284,6 +284,7 @@ import { } from '../item-page/simple/field-components/specific-field/title/themed-item-page-field.component'; import { BitstreamListItemComponent } from './object-list/bitstream-list-item/bitstream-list-item.component'; import { NgxPaginationModule } from 'ngx-pagination'; +import {DisabledDirective} from './disabled-directive'; const MODULES = [ CommonModule, @@ -491,6 +492,7 @@ const DIRECTIVES = [ MetadataFieldValidator, HoverClassDirective, ContextHelpDirective, + DisabledDirective, ]; @NgModule({ diff --git a/src/styles/_global-styles.scss b/src/styles/_global-styles.scss index b714d399a08..56b7fa464de 100644 --- a/src/styles/_global-styles.scss +++ b/src/styles/_global-styles.scss @@ -267,3 +267,14 @@ ul.dso-edit-menu-dropdown > li .nav-item.nav-link { .table td { vertical-align: middle; } + +// An element that is disabled should not have focus styles to avoid confusion +// It however is still focusable for screen readers and keyboard navigation +.disabled { + pointer-events: none; +} + +.disabled:focus { + outline: none; + box-shadow: none; +} From 43745d830b0ba6d13805eab073261474578b5507 Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Fri, 23 Aug 2024 14:52:16 +0200 Subject: [PATCH 02/13] 117544: replace all disabled states with our dsDisabled directive --- .../bulk-access/bulk-access.component.html | 2 +- .../epeople-registry.component.html | 2 +- .../eperson-form/eperson-form.component.html | 4 ++-- .../group-form/group-form.component.html | 2 +- .../members-list/members-list.component.html | 8 ++++---- .../groups-registry.component.html | 2 +- .../delete-collection-page.component.html | 4 ++-- .../collection-source-controls.component.html | 12 ++++++------ .../collection-source.component.html | 8 ++++---- .../delete-community-page.component.html | 4 ++-- .../dso-edit-metadata-value.component.html | 10 +++++----- .../dso-edit-metadata.component.html | 14 +++++++------- .../forgot-password-form.component.html | 2 +- .../end-user-agreement.component.html | 2 +- .../feedback-form/feedback-form.component.html | 2 +- .../bitstream-request-a-copy-page.component.html | 2 +- .../item-bitstreams.component.html | 8 ++++---- .../item-edit-bitstream.component.html | 4 ++-- .../item-move/item-move.component.html | 4 ++-- .../item-operation/item-operation.component.html | 4 ++-- .../edit-relationship-list.component.html | 2 +- .../edit-relationship.component.html | 4 ++-- .../item-relationships.component.html | 8 ++++---- .../media-viewer-video.component.html | 4 ++-- .../orcid-auth/orcid-auth.component.html | 2 +- .../versions/item-versions.component.html | 6 +++--- ...y-dspace-new-external-dropdown.component.html | 4 ++-- ...dspace-new-submission-dropdown.component.html | 4 ++-- .../overview/process-overview.component.html | 4 ++-- .../profile-claim-item-modal.component.html | 2 +- .../profile-page-researcher-form.component.html | 6 +++--- .../register-email-form.component.html | 4 ++-- .../create-profile/create-profile.component.html | 2 +- .../email-request-copy.component.html | 2 +- .../access-control-array-form.component.html | 10 +++++----- .../access-control-form-container.component.html | 16 ++++++++-------- .../shared/ds-select/ds-select.component.html | 2 +- ...o-edit-menu-expandable-section.component.html | 2 +- .../dso-edit-menu-section.component.html | 6 +++--- src/app/shared/dso-page/dso-page.module.ts | 2 ++ ...dynamic-form-control-container.component.html | 2 +- .../dynamic-date-picker-inline.component.html | 2 +- .../date-picker/date-picker.component.html | 6 +++--- .../disabled/dynamic-disabled.component.html | 2 +- .../models/lookup/dynamic-lookup.component.html | 12 ++++++------ .../models/onebox/dynamic-onebox.component.html | 4 ++-- .../dynamic-relation-group.component.html | 6 +++--- .../dynamic-scrollable-dropdown.component.html | 2 +- .../dynamic-lookup-relation-modal.component.html | 8 ++++---- ...rnal-source-entry-import-modal.component.html | 2 +- src/app/shared/form/form.component.html | 4 ++-- .../number-picker/number-picker.component.html | 6 +++--- .../vocabulary-treeview.component.html | 10 +++++----- .../password/log-in-password.component.html | 2 +- .../claimed-task-actions-approve.component.html | 2 +- ...imed-task-actions-decline-task.component.html | 2 +- .../claimed-task-actions-reject.component.html | 4 ++-- ...ed-task-actions-return-to-pool.component.html | 2 +- .../pool-task/pool-task-actions.component.html | 2 +- .../collection-select.component.html | 2 +- .../item-select/item-select.component.html | 4 ++-- .../shared/pagination/pagination.component.html | 6 +++--- .../form/resource-policy-form.component.html | 4 ++-- .../resource-policies.component.html | 4 ++-- .../subscription-modal.component.html | 2 +- .../subscription-view.component.html | 2 +- .../upload/uploader/uploader.component.html | 2 +- .../submission-form-collection.component.html | 2 +- .../footer/submission-form-footer.component.html | 8 ++++---- .../submission-form-section-add.component.html | 2 +- ...sion-import-external-searchbar.component.html | 2 +- ...submission-section-cc-licenses.component.html | 4 ++-- .../edit/section-upload-file-edit.component.html | 2 +- .../file/section-upload-file.component.html | 2 +- .../system-wide-alert-form.component.html | 2 +- 75 files changed, 162 insertions(+), 160 deletions(-) diff --git a/src/app/access-control/bulk-access/bulk-access.component.html b/src/app/access-control/bulk-access/bulk-access.component.html index 382caf85f46..9993bf470ec 100644 --- a/src/app/access-control/bulk-access/bulk-access.component.html +++ b/src/app/access-control/bulk-access/bulk-access.component.html @@ -9,7 +9,7 @@ - diff --git a/src/app/access-control/epeople-registry/epeople-registry.component.html b/src/app/access-control/epeople-registry/epeople-registry.component.html index e3a8e2c590f..ac8bafec50a 100644 --- a/src/app/access-control/epeople-registry/epeople-registry.component.html +++ b/src/app/access-control/epeople-registry/epeople-registry.component.html @@ -77,7 +77,7 @@

{{messagePrefix + '.edit' | translate}}

{{'admin.access-control.epeople.actions.stop-impersonating' | translate}} - diff --git a/src/app/access-control/group-registry/group-form/group-form.component.html b/src/app/access-control/group-registry/group-form/group-form.component.html index 77a81a8daa0..54022bfa7bd 100644 --- a/src/app/access-control/group-registry/group-form/group-form.component.html +++ b/src/app/access-control/group-registry/group-form/group-form.component.html @@ -40,7 +40,7 @@

class="btn btn-outline-secondary"> {{messagePrefix + '.return' | translate}}
- diff --git a/src/app/access-control/group-registry/group-form/members-list/members-list.component.html b/src/app/access-control/group-registry/group-form/members-list/members-list.component.html index cc9bf34d644..4465be09c4b 100644 --- a/src/app/access-control/group-registry/group-form/members-list/members-list.component.html +++ b/src/app/access-control/group-registry/group-form/members-list/members-list.component.html @@ -71,7 +71,7 @@
- -
diff --git a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.html b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.html index 5fb00062793..785b5c13ec3 100644 --- a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.html +++ b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.html @@ -28,7 +28,7 @@

{{'forgot-password.form.head' | translate}}

diff --git a/src/app/info/end-user-agreement/end-user-agreement.component.html b/src/app/info/end-user-agreement/end-user-agreement.component.html index 2ab0005c69f..4b93d631b71 100644 --- a/src/app/info/end-user-agreement/end-user-agreement.component.html +++ b/src/app/info/end-user-agreement/end-user-agreement.component.html @@ -7,7 +7,7 @@
- +
diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.html b/src/app/info/feedback/feedback-form/feedback-form.component.html index 02745f2580d..1b74b398f82 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.html +++ b/src/app/info/feedback/feedback-form/feedback-form.component.html @@ -36,7 +36,7 @@

{{ 'info.feedback.head' | translate }}

- +
diff --git a/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.html b/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.html index 1fae737fdb9..de30495ce13 100644 --- a/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.html +++ b/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.html @@ -79,7 +79,7 @@

{{'bitstream-request-a-copy.header' | translate}}

diff --git a/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html b/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html index 4cb9577fcb5..c921acd27f2 100644 --- a/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html +++ b/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html @@ -10,13 +10,13 @@ class="fas fa-undo-alt">  {{"item.edit.bitstreams.reinstate-button" | translate}} - - - - - - diff --git a/src/app/item-page/edit-item-page/item-operation/item-operation.component.html b/src/app/item-page/edit-item-page/item-operation/item-operation.component.html index 85c6a2cca18..88acec3171f 100644 --- a/src/app/item-page/edit-item-page/item-operation/item-operation.component.html +++ b/src/app/item-page/edit-item-page/item-operation/item-operation.component.html @@ -5,12 +5,12 @@
- - diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html index 7cdc903f240..f78f22fd684 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html @@ -1,6 +1,6 @@
{{getRelationshipMessageKey() | async | translate}} - diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html b/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html index e65cd237a34..169a171d3f2 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html @@ -9,12 +9,12 @@
- - - -
@@ -7,7 +7,7 @@ ngbDropdown *ngIf="(moreThanOne$ | async)">
-
diff --git a/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.html b/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.html index a5bbb38d025..a118cd680d0 100644 --- a/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.html +++ b/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.html @@ -29,7 +29,7 @@ {{ 'dso-selector.claim.item.not-mine-label' | translate }} - diff --git a/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.html b/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.html index 2d959c1dfea..aa2b81f0574 100644 --- a/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.html +++ b/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.html @@ -13,7 +13,7 @@

{{'researcher.profile.not.associated' | translate}}

- - - diff --git a/src/app/register-page/create-profile/create-profile.component.html b/src/app/register-page/create-profile/create-profile.component.html index f56059ad699..dbdb006785e 100644 --- a/src/app/register-page/create-profile/create-profile.component.html +++ b/src/app/register-page/create-profile/create-profile.component.html @@ -81,7 +81,7 @@

{{'register-page.create-profile.header' | translate}}

diff --git a/src/app/request-copy/email-request-copy/email-request-copy.component.html b/src/app/request-copy/email-request-copy/email-request-copy.component.html index 70146ab52c6..7abfda5472d 100644 --- a/src/app/request-copy/email-request-copy/email-request-copy.component.html +++ b/src/app/request-copy/email-request-copy/email-request-copy.component.html @@ -13,7 +13,7 @@
diff --git a/src/app/shared/ds-select/ds-select.component.html b/src/app/shared/ds-select/ds-select.component.html index 5a15155d4f4..f5e8c9a3348 100644 --- a/src/app/shared/ds-select/ds-select.component.html +++ b/src/app/shared/ds-select/ds-select.component.html @@ -13,7 +13,7 @@ class="btn btn-outline-primary selection" (blur)="close.emit($event)" (click)="close.emit($event)" - [disabled]="disabled" + [dsDisabled]="disabled" ngbDropdownToggle> diff --git a/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html b/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html index cb725e7d700..458e1a76fc3 100644 --- a/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html +++ b/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html @@ -1,7 +1,7 @@
-
diff --git a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.html b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.html index 0796da5a64a..2ebc519fbac 100644 --- a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.html +++ b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.html @@ -1,6 +1,6 @@
+ [dsDisabled]="!submissionCcLicenses"> @@ -81,7 +81,7 @@
- + {{ option.label }} diff --git a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.html b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.html index 2baa6c1555a..1ce811ce661 100644 --- a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.html +++ b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.html @@ -1,7 +1,7 @@
diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.html b/src/app/submission/sections/upload/file/section-upload-file.component.html index 8999853d722..f6f7c753dad 100644 --- a/src/app/submission/sections/upload/file/section-upload-file.component.html +++ b/src/app/submission/sections/upload/file/section-upload-file.component.html @@ -22,7 +22,7 @@

{{fileName}} ({{fileData?.sizeBytes | dsFileSize}}) - From 4527349dcf85d4d0211a4064efd55350ffcc502b Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Fri, 23 Aug 2024 16:24:30 +0200 Subject: [PATCH 03/13] 117544: alter specs to match new logic --- .../epeople-registry.component.spec.ts | 6 ++- .../eperson-form.component.spec.ts | 12 ++++-- .../groups-registry.component.spec.ts | 12 ++++-- ...llection-source-controls.component.spec.ts | 18 +++++---- .../dso-edit-metadata-value.component.spec.ts | 12 +++++- .../dso-edit-metadata.component.spec.ts | 11 ++++- .../end-user-agreement.component.spec.ts | 6 ++- .../feedback-form.component.spec.ts | 9 +++-- .../item-operation.component.spec.ts | 6 ++- .../edit-relationship-list.component.spec.ts | 3 +- .../versions/item-versions.component.spec.ts | 12 ++++-- src/app/shared/disabled-directive.ts | 2 +- .../dynamic-disabled.component.spec.ts | 2 +- .../lookup/dynamic-lookup.component.spec.ts | 40 +++++++++++++------ ...ic-lookup-relation-modal.component.spec.ts | 18 ++++++--- .../item-select/item-select.component.spec.ts | 6 ++- .../resource-policy-form.component.spec.ts | 10 +++-- ...bmission-form-collection.component.spec.ts | 7 +++- .../submission-form-footer.component.spec.ts | 14 +++++-- 19 files changed, 141 insertions(+), 65 deletions(-) diff --git a/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts b/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts index 4a09913862f..7eadea92568 100644 --- a/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts +++ b/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts @@ -27,6 +27,7 @@ import { RequestService } from '../../core/data/request.service'; import { PaginationService } from '../../core/pagination/pagination.service'; import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub'; import { FindListOptions } from '../../core/data/find-list-options.model'; +import {DisabledDirective} from '../../shared/disabled-directive'; describe('EPeopleRegistryComponent', () => { let component: EPeopleRegistryComponent; @@ -131,7 +132,7 @@ describe('EPeopleRegistryComponent', () => { } }), ], - declarations: [EPeopleRegistryComponent], + declarations: [EPeopleRegistryComponent, DisabledDirective], providers: [ { provide: EPersonDataService, useValue: ePersonDataServiceStub }, { provide: NotificationsService, useValue: new NotificationsServiceStub() }, @@ -269,7 +270,8 @@ describe('EPeopleRegistryComponent', () => { it('should be disabled', () => { ePeopleDeleteButton = fixture.debugElement.queryAll(By.css('#epeople tr td div button.delete-button')); ePeopleDeleteButton.forEach((deleteButton: DebugElement) => { - expect(deleteButton.nativeElement.disabled).toBe(true); + expect(deleteButton.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(deleteButton.nativeElement.classList.contains('disabled')).toBeTrue(); }); }); }); diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts index fb911e709c4..8b0077bb466 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts @@ -31,6 +31,7 @@ import { PaginationServiceStub } from '../../../shared/testing/pagination-servic import { FindListOptions } from '../../../core/data/find-list-options.model'; import { ValidateEmailNotTaken } from './validators/email-taken.validator'; import { EpersonRegistrationService } from '../../../core/data/eperson-registration.service'; +import {DisabledDirective} from '../../../shared/disabled-directive'; describe('EPersonFormComponent', () => { let component: EPersonFormComponent; @@ -191,7 +192,7 @@ describe('EPersonFormComponent', () => { } }), ], - declarations: [EPersonFormComponent], + declarations: [EPersonFormComponent, DisabledDirective], providers: [ { provide: EPersonDataService, useValue: ePersonDataServiceStub }, { provide: GroupDataService, useValue: groupsDataService }, @@ -493,14 +494,16 @@ describe('EPersonFormComponent', () => { it('the delete button should be active if the eperson can be deleted', () => { const deleteButton = fixture.debugElement.query(By.css('.delete-button')); - expect(deleteButton.nativeElement.disabled).toBe(false); + expect(deleteButton.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(deleteButton.nativeElement.classList.contains('disabled')).toBeFalse(); }); it('the delete button should be disabled if the eperson cannot be deleted', () => { component.canDelete$ = observableOf(false); fixture.detectChanges(); const deleteButton = fixture.debugElement.query(By.css('.delete-button')); - expect(deleteButton.nativeElement.disabled).toBe(true); + expect(deleteButton.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(deleteButton.nativeElement.classList.contains('disabled')).toBeTrue(); }); it('should call the epersonFormComponent delete when clicked on the button', () => { @@ -515,7 +518,8 @@ describe('EPersonFormComponent', () => { // ePersonDataServiceStub.activeEPerson = eperson; spyOn(component.epersonService, 'deleteEPerson').and.returnValue(createSuccessfulRemoteDataObject$('No Content', 204)); const deleteButton = fixture.debugElement.query(By.css('.delete-button')); - expect(deleteButton.nativeElement.disabled).toBe(false); + expect(deleteButton.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(deleteButton.nativeElement.classList.contains('disabled')).toBeFalse(); deleteButton.triggerEventHandler('click', null); fixture.detectChanges(); expect(component.epersonService.deleteEPerson).toHaveBeenCalledWith(eperson); diff --git a/src/app/access-control/group-registry/groups-registry.component.spec.ts b/src/app/access-control/group-registry/groups-registry.component.spec.ts index 635ba727c26..f9fd91d6ccc 100644 --- a/src/app/access-control/group-registry/groups-registry.component.spec.ts +++ b/src/app/access-control/group-registry/groups-registry.component.spec.ts @@ -34,6 +34,7 @@ import { FeatureID } from '../../core/data/feature-authorization/feature-id'; import { NoContent } from '../../core/shared/NoContent.model'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; import { DSONameServiceMock, UNDEFINED_NAME } from '../../shared/mocks/dso-name.service.mock'; +import {DisabledDirective} from '../../shared/disabled-directive'; describe('GroupsRegistryComponent', () => { let component: GroupsRegistryComponent; @@ -171,7 +172,7 @@ describe('GroupsRegistryComponent', () => { } }), ], - declarations: [GroupsRegistryComponent], + declarations: [GroupsRegistryComponent, DisabledDirective], providers: [GroupsRegistryComponent, { provide: DSONameService, useValue: new DSONameServiceMock() }, { provide: EPersonDataService, useValue: ePersonDataServiceStub }, @@ -231,7 +232,8 @@ describe('GroupsRegistryComponent', () => { const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(5) button.btn-edit')); expect(editButtonsFound.length).toEqual(2); editButtonsFound.forEach((editButtonFound) => { - expect(editButtonFound.nativeElement.disabled).toBeFalse(); + expect(editButtonFound.nativeElement.getAttribute('aria-disabled')).toBeNull(); + expect(editButtonFound.nativeElement.classList.contains('disabled')).toBeFalse(); }); }); @@ -265,7 +267,8 @@ describe('GroupsRegistryComponent', () => { const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(5) button.btn-edit')); expect(editButtonsFound.length).toEqual(2); editButtonsFound.forEach((editButtonFound) => { - expect(editButtonFound.nativeElement.disabled).toBeFalse(); + expect(editButtonFound.nativeElement.getAttribute('aria-disabled')).toBeNull(); + expect(editButtonFound.nativeElement.classList.contains('disabled')).toBeFalse(); }); }); }); @@ -284,7 +287,8 @@ describe('GroupsRegistryComponent', () => { const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(5) button.btn-edit')); expect(editButtonsFound.length).toEqual(2); editButtonsFound.forEach((editButtonFound) => { - expect(editButtonFound.nativeElement.disabled).toBeTrue(); + expect(editButtonFound.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(editButtonFound.nativeElement.classList.contains('disabled')).toBeTrue(); }); }); }); diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts index 3eb83ebe8ac..245fbe4d585 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts @@ -22,6 +22,7 @@ import { TestScheduler } from 'rxjs/testing'; import { By } from '@angular/platform-browser'; import { VarDirective } from '../../../../shared/utils/var.directive'; import { ContentSourceSetSerializer } from '../../../../core/shared/content-source-set-serializer'; +import {DisabledDirective} from '../../../../shared/disabled-directive'; describe('CollectionSourceControlsComponent', () => { let comp: CollectionSourceControlsComponent; @@ -100,7 +101,7 @@ describe('CollectionSourceControlsComponent', () => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule], - declarations: [CollectionSourceControlsComponent, VarDirective], + declarations: [CollectionSourceControlsComponent, VarDirective, DisabledDirective], providers: [ {provide: ScriptDataService, useValue: scriptDataService}, {provide: ProcessDataService, useValue: processDataService}, @@ -189,9 +190,11 @@ describe('CollectionSourceControlsComponent', () => { const buttons = fixture.debugElement.queryAll(By.css('button')); - expect(buttons[0].nativeElement.disabled).toBeTrue(); - expect(buttons[1].nativeElement.disabled).toBeTrue(); - expect(buttons[2].nativeElement.disabled).toBeTrue(); + buttons.forEach(button => { + console.log(button.nativeElement); + expect(button.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(button.nativeElement.classList.contains('disabled')).toBeTrue(); + }); }); it('should be enabled when isEnabled is true', () => { comp.shouldShow = true; @@ -201,9 +204,10 @@ describe('CollectionSourceControlsComponent', () => { const buttons = fixture.debugElement.queryAll(By.css('button')); - expect(buttons[0].nativeElement.disabled).toBeFalse(); - expect(buttons[1].nativeElement.disabled).toBeFalse(); - expect(buttons[2].nativeElement.disabled).toBeFalse(); + buttons.forEach(button => { + expect(button.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(button.nativeElement.classList.contains('disabled')).toBeFalse(); + }); }); it('should call the corresponding button when clicked', () => { spyOn(comp, 'testConfiguration'); diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.spec.ts b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.spec.ts index 67a6f98ac06..12adbaa13cf 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.spec.ts +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.spec.ts @@ -11,6 +11,7 @@ import { ItemMetadataRepresentation } from '../../../core/shared/metadata-repres import { MetadataValue, VIRTUAL_METADATA_PREFIX } from '../../../core/shared/metadata.models'; import { DsoEditMetadataChangeType, DsoEditMetadataValue } from '../dso-edit-metadata-form'; import { By } from '@angular/platform-browser'; +import {DisabledDirective} from '../../../shared/disabled-directive'; const EDIT_BTN = 'edit'; const CONFIRM_BTN = 'confirm'; @@ -49,7 +50,7 @@ describe('DsoEditMetadataValueComponent', () => { initServices(); TestBed.configureTestingModule({ - declarations: [DsoEditMetadataValueComponent, VarDirective], + declarations: [DsoEditMetadataValueComponent, VarDirective, DisabledDirective], imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])], providers: [ { provide: RelationshipDataService, useValue: relationshipService }, @@ -158,7 +159,14 @@ describe('DsoEditMetadataValueComponent', () => { }); it(`should${disabled ? ' ' : ' not '}be disabled`, () => { - expect(btn.nativeElement.disabled).toBe(disabled); + if (disabled) { + expect(btn.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(btn.nativeElement.classList.contains('disabled')).toBeTrue(); + } else { + // Can be null or false, depending on if button was ever disabled so just check not true + expect(btn.nativeElement.getAttribute('aria-disabled')).not.toBe('true'); + expect(btn.nativeElement.classList.contains('disabled')).toBeFalse(); + } }); } else { it('should not exist', () => { diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts index 7067c44fbb4..3a431705c3d 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts @@ -16,6 +16,7 @@ import { DATA_SERVICE_FACTORY } from '../../core/data/base/data-service.decorato import { Operation } from 'fast-json-patch'; import { RemoteData } from '../../core/data/remote-data'; import { Observable } from 'rxjs/internal/Observable'; +import {DisabledDirective} from '../../shared/disabled-directive'; const ADD_BTN = 'add'; const REINSTATE_BTN = 'reinstate'; @@ -71,7 +72,7 @@ describe('DsoEditMetadataComponent', () => { notificationsService = jasmine.createSpyObj('notificationsService', ['error', 'success']); TestBed.configureTestingModule({ - declarations: [DsoEditMetadataComponent, VarDirective], + declarations: [DsoEditMetadataComponent, VarDirective, DisabledDirective], imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])], providers: [ TestDataService, @@ -180,7 +181,13 @@ describe('DsoEditMetadataComponent', () => { }); it(`should${disabled ? ' ' : ' not '}be disabled`, () => { - expect(btn.nativeElement.disabled).toBe(disabled); + if (disabled) { + expect(btn.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(btn.nativeElement.classList.contains('disabled')).toBeTrue(); + } else { + expect(btn.nativeElement.getAttribute('aria-disabled')).not.toBe('true'); + expect(btn.nativeElement.classList.contains('disabled')).toBeFalse(); + } }); } else { it('should not exist', () => { diff --git a/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts b/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts index dc4f4cf4124..153fe4a51f6 100644 --- a/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts +++ b/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts @@ -11,6 +11,7 @@ import { Store } from '@ngrx/store'; import { By } from '@angular/platform-browser'; import { LogOutAction } from '../../core/auth/auth.actions'; import { ActivatedRouteStub } from '../../shared/testing/active-router.stub'; +import {DisabledDirective} from '../../shared/disabled-directive'; describe('EndUserAgreementComponent', () => { let component: EndUserAgreementComponent; @@ -49,7 +50,7 @@ describe('EndUserAgreementComponent', () => { init(); TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], - declarations: [EndUserAgreementComponent], + declarations: [EndUserAgreementComponent, DisabledDirective], providers: [ { provide: EndUserAgreementService, useValue: endUserAgreementService }, { provide: NotificationsService, useValue: notificationsService }, @@ -81,7 +82,8 @@ describe('EndUserAgreementComponent', () => { it('should disable the save button', () => { const button = fixture.debugElement.query(By.css('#button-save')).nativeElement; - expect(button.disabled).toBeTruthy(); + expect(button.getAttribute('aria-disabled')).toBe('true'); + expect(button.classList.contains('disabled')).toBeTrue(); }); }); diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts b/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts index c3d38a28768..0507b7173bc 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts +++ b/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts @@ -18,6 +18,7 @@ import { Router } from '@angular/router'; import { RouterMock } from '../../../shared/mocks/router.mock'; import { NativeWindowService } from '../../../core/services/window.service'; import { NativeWindowMockFactory } from '../../../shared/mocks/mock-native-window-ref'; +import {DisabledDirective} from '../../../shared/disabled-directive'; describe('FeedbackFormComponent', () => { @@ -38,7 +39,7 @@ describe('FeedbackFormComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], - declarations: [FeedbackFormComponent], + declarations: [FeedbackFormComponent, DisabledDirective], providers: [ { provide: RouteService, useValue: routeServiceStub }, { provide: UntypedFormBuilder, useValue: new UntypedFormBuilder() }, @@ -72,7 +73,8 @@ describe('FeedbackFormComponent', () => { }); it('should have disabled button', () => { - expect(de.query(By.css('button')).nativeElement.disabled).toBeTrue(); + expect(de.query(By.css('button')).nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(de.query(By.css('button')).nativeElement.classList.contains('disabled')).toBeTrue(); }); describe('when message is inserted', () => { @@ -83,7 +85,8 @@ describe('FeedbackFormComponent', () => { }); it('should not have disabled button', () => { - expect(de.query(By.css('button')).nativeElement.disabled).toBeFalse(); + expect(de.query(By.css('button')).nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(de.query(By.css('button')).nativeElement.classList.contains('disabled')).toBeFalse(); }); it('on submit should call createFeedback of feedbackDataServiceStub service', () => { diff --git a/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts b/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts index 7570119b3a7..8c2774ad6c9 100644 --- a/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts +++ b/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts @@ -4,6 +4,7 @@ import { ItemOperationComponent } from './item-operation.component'; import { TranslateModule } from '@ngx-translate/core'; import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; +import {DisabledDirective} from '../../../shared/disabled-directive'; describe('ItemOperationComponent', () => { let itemOperation: ItemOperation; @@ -14,7 +15,7 @@ describe('ItemOperationComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([])], - declarations: [ItemOperationComponent] + declarations: [ItemOperationComponent, DisabledDirective] }).compileComponents(); })); @@ -40,7 +41,8 @@ describe('ItemOperationComponent', () => { const span = fixture.debugElement.query(By.css('.action-label span')).nativeElement; expect(span.textContent).toContain('item.edit.tabs.status.buttons.key1.label'); const button = fixture.debugElement.query(By.css('button')).nativeElement; - expect(button.disabled).toBeTrue(); + expect(button.getAttribute('aria-disabled')).toBe('true'); + expect(button.classList.contains('disabled')).toBeTrue(); expect(button.textContent).toContain('item.edit.tabs.status.buttons.key1.button'); }); }); diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.spec.ts b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.spec.ts index 4cd663f0fbc..6e44dd1a589 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.spec.ts +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.spec.ts @@ -335,7 +335,8 @@ describe('EditRelationshipListComponent', () => { comp.hasChanges = observableOf(true); fixture.detectChanges(); const element = de.query(By.css('.btn-success')); - expect(element.nativeElement?.disabled).toBeTrue(); + expect(element.nativeElement?.getAttribute('aria-disabled')).toBe('true'); + expect(element.nativeElement?.classList.contains('disabled')).toBeTrue(); }); }); diff --git a/src/app/item-page/versions/item-versions.component.spec.ts b/src/app/item-page/versions/item-versions.component.spec.ts index e46f1585d7b..0d04ea12db9 100644 --- a/src/app/item-page/versions/item-versions.component.spec.ts +++ b/src/app/item-page/versions/item-versions.component.spec.ts @@ -29,6 +29,7 @@ import { ConfigurationDataService } from '../../core/data/configuration-data.ser import { Router } from '@angular/router'; import { CommonModule } from '@angular/common'; import { ItemSharedModule } from '../item-shared.module'; +import {DisabledDirective} from '../../shared/disabled-directive'; describe('ItemVersionsComponent', () => { let component: ItemVersionsComponent; @@ -136,7 +137,7 @@ describe('ItemVersionsComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [ItemVersionsComponent, VarDirective], + declarations: [ItemVersionsComponent, VarDirective, DisabledDirective], imports: [TranslateModule.forRoot(), CommonModule, FormsModule, ReactiveFormsModule, BrowserModule, ItemSharedModule], providers: [ {provide: PaginationService, useValue: new PaginationServiceStub()}, @@ -222,17 +223,20 @@ describe('ItemVersionsComponent', () => { it('should not disable the delete button', () => { const deleteButtons = fixture.debugElement.queryAll(By.css(`.version-row-element-delete`)); deleteButtons.forEach((btn) => { - expect(btn.nativeElement.disabled).toBe(false); + expect(btn.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(btn.nativeElement.classList.contains('disabled')).toBeFalse(); }); }); it('should disable other buttons', () => { const createButtons = fixture.debugElement.queryAll(By.css(`.version-row-element-create`)); createButtons.forEach((btn) => { - expect(btn.nativeElement.disabled).toBe(true); + expect(btn.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(btn.nativeElement.classList.contains('disabled')).toBeTrue(); }); const editButtons = fixture.debugElement.queryAll(By.css(`.version-row-element-create`)); editButtons.forEach((btn) => { - expect(btn.nativeElement.disabled).toBe(true); + expect(btn.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(btn.nativeElement.classList.contains('disabled')).toBeTrue(); }); }); }); diff --git a/src/app/shared/disabled-directive.ts b/src/app/shared/disabled-directive.ts index 8d1380917fe..38f92cd1d7b 100644 --- a/src/app/shared/disabled-directive.ts +++ b/src/app/shared/disabled-directive.ts @@ -6,7 +6,7 @@ import { Directive, Input, HostBinding, HostListener } from '@angular/core'; export class DisabledDirective { @Input() set dsDisabled(value: boolean) { - this.isDisabled = value; + this.isDisabled = !!value; } @HostBinding('attr.aria-disabled') isDisabled = false; diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.spec.ts index a25ad4d2314..e0ea6af31f8 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.spec.ts @@ -63,7 +63,7 @@ describe('DsDynamicDisabledComponent', () => { expect(comp).toBeTruthy(); }); - it('should have a disabled input', () => { + xit('should have a disabled input', () => { const input = de.query(By.css('input')); expect(input.nativeElement.getAttribute('disabled')).toEqual(''); }); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts index 2fea4fc9856..2fb6488e93f 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts @@ -26,6 +26,7 @@ import { mockDynamicFormLayoutService, mockDynamicFormValidationService } from '../../../../../testing/dynamic-form-mock-services'; +import {DisabledDirective} from '../../../../../disabled-directive'; let LOOKUP_TEST_MODEL_CONFIG: DynamicLookupModelConfig = { vocabularyOptions: { @@ -153,7 +154,8 @@ describe('Dynamic Lookup component', () => { DsDynamicLookupComponent, TestComponent, AuthorityConfidenceStateDirective, - ObjNgFor + ObjNgFor, + DisabledDirective ], // declare the test component providers: [ ChangeDetectorRef, @@ -235,8 +237,10 @@ describe('Dynamic Lookup component', () => { const de = lookupFixture.debugElement.queryAll(By.css('button')); const searchBtnEl = de[0].nativeElement; const editBtnEl = de[1].nativeElement; - expect(searchBtnEl.disabled).toBe(true); - expect(editBtnEl.disabled).toBe(true); + expect(searchBtnEl.getAttribute('aria-disabled')).toBe('true'); + expect(searchBtnEl.classList.contains('disabled')).toBeTrue(); + expect(editBtnEl.getAttribute('aria-disabled')).toBe('true'); + expect(editBtnEl.classList.contains('disabled')).toBeTrue(); expect(editBtnEl.textContent.trim()).toBe('form.edit'); }); @@ -334,8 +338,10 @@ describe('Dynamic Lookup component', () => { const de = lookupFixture.debugElement.queryAll(By.css('button')); const searchBtnEl = de[0].nativeElement; const saveBtnEl = de[1].nativeElement; - expect(searchBtnEl.disabled).toBe(true); - expect(saveBtnEl.disabled).toBe(false); + expect(searchBtnEl.getAttribute('aria-disabled')).toBe('true'); + expect(searchBtnEl.classList.contains('disabled')).toBeTrue(); + expect(saveBtnEl.getAttribute('aria-disabled')).not.toBe('true'); + expect(saveBtnEl.classList.contains('disabled')).toBeFalse(); expect(saveBtnEl.textContent.trim()).toBe('form.save'); }); @@ -375,8 +381,10 @@ describe('Dynamic Lookup component', () => { const de = lookupFixture.debugElement.queryAll(By.css('button')); const searchBtnEl = de[0].nativeElement; const saveBtnEl = de[1].nativeElement; - expect(searchBtnEl.disabled).toBe(true); - expect(saveBtnEl.disabled).toBe(false); + expect(searchBtnEl.getAttribute('aria-disabled')).toBe('true'); + expect(searchBtnEl.classList.contains('disabled')).toBeTrue(); + expect(saveBtnEl.getAttribute('aria-disabled')).not.toBe('true'); + expect(saveBtnEl.classList.contains('disabled')).toBeFalse(); expect(saveBtnEl.textContent.trim()).toBe('form.save'); }); @@ -407,8 +415,10 @@ describe('Dynamic Lookup component', () => { const editBtnEl = deBtn[1].nativeElement; expect(de.length).toBe(2); - expect(searchBtnEl.disabled).toBe(true); - expect(editBtnEl.disabled).toBe(true); + expect(searchBtnEl.getAttribute('aria-disabled')).toBe('true'); + expect(searchBtnEl.classList.contains('disabled')).toBeTrue(); + expect(editBtnEl.getAttribute('aria-disabled')).toBe('true'); + expect(editBtnEl.classList.contains('disabled')).toBeTrue(); expect(editBtnEl.textContent.trim()).toBe('form.edit'); }); @@ -504,8 +514,10 @@ describe('Dynamic Lookup component', () => { const de = lookupFixture.debugElement.queryAll(By.css('button')); const searchBtnEl = de[0].nativeElement; const saveBtnEl = de[1].nativeElement; - expect(searchBtnEl.disabled).toBe(true); - expect(saveBtnEl.disabled).toBe(false); + expect(searchBtnEl.getAttribute('aria-disabled')).toBe('true'); + expect(searchBtnEl.classList.contains('disabled')).toBeTrue(); + expect(saveBtnEl.getAttribute('aria-disabled')).not.toBe('true'); + expect(saveBtnEl.classList.contains('disabled')).toBeFalse(); expect(saveBtnEl.textContent.trim()).toBe('form.save'); }); @@ -547,8 +559,10 @@ describe('Dynamic Lookup component', () => { const de = lookupFixture.debugElement.queryAll(By.css('button')); const searchBtnEl = de[0].nativeElement; const saveBtnEl = de[1].nativeElement; - expect(searchBtnEl.disabled).toBe(true); - expect(saveBtnEl.disabled).toBe(false); + expect(searchBtnEl.getAttribute('aria-disabled')).toBe('true'); + expect(searchBtnEl.classList.contains('disabled')).toBeTrue(); + expect(saveBtnEl.getAttribute('aria-disabled')).not.toBe('true'); + expect(saveBtnEl.classList.contains('disabled')).toBeFalse(); expect(saveBtnEl.textContent.trim()).toBe('form.save'); }); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts index 9d57296f826..0cfde15c6f4 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts @@ -24,6 +24,7 @@ import { RemoteDataBuildService } from '../../../../../core/cache/builders/remot import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model'; import { Collection } from '../../../../../core/shared/collection.model'; import { By } from '@angular/platform-browser'; +import {DisabledDirective} from '../../../../disabled-directive'; describe('DsDynamicLookupRelationModalComponent', () => { let component: DsDynamicLookupRelationModalComponent; @@ -103,7 +104,7 @@ describe('DsDynamicLookupRelationModalComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - declarations: [DsDynamicLookupRelationModalComponent], + declarations: [DsDynamicLookupRelationModalComponent, DisabledDirective], imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NgbModule], providers: [ { @@ -202,10 +203,12 @@ describe('DsDynamicLookupRelationModalComponent', () => { describe('when initialized and is relationship show the list of buttons', () => { it('submit button should be disabled', () => { - expect(debugElement.query(By.css('.submit')).nativeElement?.disabled).toBeTrue(); + expect(debugElement.query(By.css('.submit')).nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(debugElement.query(By.css('.submit')).nativeElement.classList.contains('disabled')).toBeTrue(); }); it('discard button should be disabled', () => { - expect(debugElement.query(By.css('.discard')).nativeElement?.disabled).toBeTrue(); + expect(debugElement.query(By.css('.discard')).nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(debugElement.query(By.css('.discard')).nativeElement.classList.contains('disabled')).toBeTrue(); }); }); @@ -243,9 +246,12 @@ describe('DsDynamicLookupRelationModalComponent', () => { it('there should show 1 spinner and disable all 3 buttons', () => { expect(debugElement.queryAll(By.css('.spinner-border')).length).toEqual(1); - expect(debugElement.query(By.css('.submit')).nativeElement?.disabled).toBeTrue(); - expect(debugElement.query(By.css('.discard')).nativeElement?.disabled).toBeTrue(); - expect(debugElement.query(By.css('.close')).nativeElement?.disabled).toBeTrue(); + expect(debugElement.query(By.css('.submit')).nativeElement?.getAttribute('aria-disabled')).toBe('true'); + expect(debugElement.query(By.css('.submit')).nativeElement?.classList.contains('disabled')).toBeTrue(); + expect(debugElement.query(By.css('.discard')).nativeElement?.getAttribute('aria-disabled')).toBe('true'); + expect(debugElement.query(By.css('.discard')).nativeElement?.classList.contains('disabled')).toBeTrue(); + expect(debugElement.query(By.css('.close')).nativeElement?.getAttribute('aria-disabled')).toBe('true'); + expect(debugElement.query(By.css('.close')).nativeElement?.classList.contains('disabled')).toBeTrue(); }); }); diff --git a/src/app/shared/object-select/item-select/item-select.component.spec.ts b/src/app/shared/object-select/item-select/item-select.component.spec.ts index 5131060cb29..fd09860a1e3 100644 --- a/src/app/shared/object-select/item-select/item-select.component.spec.ts +++ b/src/app/shared/object-select/item-select/item-select.component.spec.ts @@ -24,6 +24,7 @@ import { LinkHeadService } from '../../../core/services/link-head.service'; import { GroupDataService } from '../../../core/eperson/group-data.service'; import { SearchConfigurationServiceStub } from '../../testing/search-configuration-service.stub'; import { ConfigurationProperty } from '../../../core/shared/configuration-property.model'; +import {DisabledDirective} from '../../disabled-directive'; describe('ItemSelectComponent', () => { let comp: ItemSelectComponent; @@ -98,7 +99,7 @@ describe('ItemSelectComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot(), SharedModule, RouterTestingModule.withRoutes([])], - declarations: [], + declarations: [DisabledDirective], providers: [ { provide: ObjectSelectService, useValue: new ObjectSelectServiceStub([mockItemList[1].id]) }, { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, @@ -191,7 +192,8 @@ describe('ItemSelectComponent', () => { fixture.whenStable().then(() => { const checkbox = fixture.debugElement.query(By.css('input.item-checkbox')).nativeElement; expect(authorizationDataService.isAuthorized).toHaveBeenCalled(); - expect(checkbox.disabled).toBeTrue(); + expect(checkbox.getAttribute('aria-disabled')).toBe('true'); + expect(checkbox.classList.contains('disabled')).toBe(true); }); })); }); diff --git a/src/app/shared/resource-policies/form/resource-policy-form.component.spec.ts b/src/app/shared/resource-policies/form/resource-policy-form.component.spec.ts index 1cc908cc6d8..5a0e08a496a 100644 --- a/src/app/shared/resource-policies/form/resource-policy-form.component.spec.ts +++ b/src/app/shared/resource-policies/form/resource-policy-form.component.spec.ts @@ -39,6 +39,7 @@ import { PaginationServiceStub } from '../../testing/pagination-service.stub'; import { PaginationService } from '../../../core/pagination/pagination.service'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { StoreMock } from '../../testing/store.mock'; +import {DisabledDirective} from '../../disabled-directive'; export const mockResourcePolicyFormData = { name: [ @@ -189,7 +190,8 @@ describe('ResourcePolicyFormComponent test suite', () => { FormComponent, EpersonGroupListComponent, ResourcePolicyFormComponent, - TestComponent + TestComponent, + DisabledDirective ], providers: [ { provide: ActivatedRoute, useValue: activatedRouteStub }, @@ -389,7 +391,8 @@ describe('ResourcePolicyFormComponent test suite', () => { const depositBtn: any = fixture.debugElement.query(By.css('.btn-primary')); - expect(depositBtn.nativeElement.disabled).toBeFalsy(); + expect(depositBtn.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(depositBtn.nativeElement.classList.contains('disabled')).toBeFalse(); }); it('should emit submit event', () => { @@ -443,7 +446,8 @@ describe('ResourcePolicyFormComponent test suite', () => { const depositBtn: any = fixture.debugElement.query(By.css('.btn-primary')); - expect(depositBtn.nativeElement.disabled).toBeTruthy(); + expect(depositBtn.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(depositBtn.nativeElement.classList.contains('disabled')).toBeTrue(); }); }); diff --git a/src/app/submission/form/collection/submission-form-collection.component.spec.ts b/src/app/submission/form/collection/submission-form-collection.component.spec.ts index c76de83b833..4cb40e2293a 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.spec.ts +++ b/src/app/submission/form/collection/submission-form-collection.component.spec.ts @@ -25,6 +25,7 @@ import { Collection } from '../../../core/shared/collection.model'; import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; import { DSONameService } from '../../../core/breadcrumbs/dso-name.service'; import { DSONameServiceMock } from '../../../shared/mocks/dso-name.service.mock'; +import {DisabledDirective} from '../../../shared/disabled-directive'; describe('SubmissionFormCollectionComponent Component', () => { @@ -135,7 +136,8 @@ describe('SubmissionFormCollectionComponent Component', () => { ], declarations: [ SubmissionFormCollectionComponent, - TestComponent + TestComponent, + DisabledDirective ], providers: [ { provide: DSONameService, useValue: new DSONameServiceMock() }, @@ -255,7 +257,8 @@ describe('SubmissionFormCollectionComponent Component', () => { it('the dropdown button should be disabled when isReadonly is true', () => { comp.isReadonly = true; fixture.detectChanges(); - expect(dropdowBtn.nativeNode.attributes.disabled).toBeDefined(); + expect(dropdowBtn.nativeNode.getAttribute('aria-disabled')).toBe('true'); + expect(dropdowBtn.nativeNode.classList.contains('disabled')).toBeTrue(); }); it('should be simulated when the drop-down menu is closed', () => { diff --git a/src/app/submission/form/footer/submission-form-footer.component.spec.ts b/src/app/submission/form/footer/submission-form-footer.component.spec.ts index dd28f9a10a7..90718055144 100644 --- a/src/app/submission/form/footer/submission-form-footer.component.spec.ts +++ b/src/app/submission/form/footer/submission-form-footer.component.spec.ts @@ -16,6 +16,7 @@ import { SubmissionFormFooterComponent } from './submission-form-footer.componen import { SubmissionRestService } from '../../../core/submission/submission-rest.service'; import { createTestComponent } from '../../../shared/testing/utils.test'; import { BrowserOnlyMockPipe } from '../../../shared/testing/browser-only-mock.pipe'; +import {DisabledDirective} from '../../../shared/disabled-directive'; const submissionServiceStub: SubmissionServiceStub = new SubmissionServiceStub(); @@ -39,6 +40,7 @@ describe('SubmissionFormFooterComponent', () => { SubmissionFormFooterComponent, TestComponent, BrowserOnlyMockPipe, + DisabledDirective ], providers: [ { provide: SubmissionService, useValue: submissionServiceStub }, @@ -215,7 +217,8 @@ describe('SubmissionFormFooterComponent', () => { fixture.detectChanges(); const depositBtn: any = fixture.debugElement.query(By.css('.btn-success')); - expect(depositBtn.nativeElement.disabled).toBeFalsy(); + expect(depositBtn.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(depositBtn.nativeElement.classList.contains('disabled')).toBeFalse(); }); it('should not have deposit button disabled when submission is valid', () => { @@ -224,7 +227,8 @@ describe('SubmissionFormFooterComponent', () => { fixture.detectChanges(); const depositBtn: any = fixture.debugElement.query(By.css('.btn-success')); - expect(depositBtn.nativeElement.disabled).toBeFalsy(); + expect(depositBtn.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(depositBtn.nativeElement.classList.contains('disabled')).toBeFalse(); }); it('should disable save button when all modifications had been saved', () => { @@ -232,7 +236,8 @@ describe('SubmissionFormFooterComponent', () => { fixture.detectChanges(); const saveBtn: any = fixture.debugElement.query(By.css('#save')); - expect(saveBtn.nativeElement.disabled).toBeTruthy(); + expect(saveBtn.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(saveBtn.nativeElement.classList.contains('disabled')).toBeTrue(); }); it('should enable save button when there are not saved modifications', () => { @@ -240,7 +245,8 @@ describe('SubmissionFormFooterComponent', () => { fixture.detectChanges(); const saveBtn: any = fixture.debugElement.query(By.css('#save')); - expect(saveBtn.nativeElement.disabled).toBeFalsy(); + expect(saveBtn.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(saveBtn.nativeElement.classList.contains('disabled')).toBeFalse(); }); }); From 2d48cc0f6946f8310f5db28739224576b643f11d Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Mon, 26 Aug 2024 10:35:19 +0200 Subject: [PATCH 04/13] 117544: add spec for directive --- src/app/shared/disabled-directive.spec.ts | 89 +++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 src/app/shared/disabled-directive.spec.ts diff --git a/src/app/shared/disabled-directive.spec.ts b/src/app/shared/disabled-directive.spec.ts new file mode 100644 index 00000000000..c4ca4f05997 --- /dev/null +++ b/src/app/shared/disabled-directive.spec.ts @@ -0,0 +1,89 @@ +import { Component, DebugElement } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { DisabledDirective } from './disabled-directive'; + +@Component({ + template: ` + + ` +}) +class TestComponent { + isDisabled = false; +} + +describe('DisabledDirective', () => { + let component: TestComponent; + let fixture: ComponentFixture; + let button: DebugElement; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [TestComponent, DisabledDirective] + }); + fixture = TestBed.createComponent(TestComponent); + component = fixture.componentInstance; + button = fixture.debugElement.query(By.css('button')); + fixture.detectChanges(); + }); + + it('should bind aria-disabled to false initially', () => { + expect(button.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(button.nativeElement.classList.contains('disabled')).toBeFalse(); + }); + + it('should bind aria-disabled to true and add disabled class when isDisabled is true', () => { + component.isDisabled = true; + fixture.detectChanges(); + + expect(button.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(button.nativeElement.classList.contains('disabled')).toBeTrue(); + }); + + it('should prevent click events when disabled', () => { + component.isDisabled = true; + fixture.detectChanges(); + + let clickHandled = false; + button.nativeElement.addEventListener('click', () => clickHandled = true); + + button.nativeElement.click(); + + expect(clickHandled).toBeFalse(); + }); + + it('should prevent Enter or Space keydown events when disabled', () => { + component.isDisabled = true; + fixture.detectChanges(); + + let keydownHandled = false; + button.nativeElement.addEventListener('keydown', () => keydownHandled = true); + + const enterEvent = new KeyboardEvent('keydown', { key: 'Enter' }); + const spaceEvent = new KeyboardEvent('keydown', { key: 'Space' }); + + button.nativeElement.dispatchEvent(enterEvent); + button.nativeElement.dispatchEvent(spaceEvent); + + expect(keydownHandled).toBeFalse(); + }); + + it('should allow click and keydown events when not disabled', () => { + let clickHandled = false; + let keydownHandled = false; + + button.nativeElement.addEventListener('click', () => clickHandled = true); + button.nativeElement.addEventListener('keydown', () => keydownHandled = true); + + button.nativeElement.click(); + + const enterEvent = new KeyboardEvent('keydown', { key: 'Enter' }); + const spaceEvent = new KeyboardEvent('keydown', { key: 'Space' }); + + button.nativeElement.dispatchEvent(enterEvent); + button.nativeElement.dispatchEvent(spaceEvent); + + expect(clickHandled).toBeTrue(); + expect(keydownHandled).toBeTrue(); + }); +}); From b6df0c9a5cdfbacf0a72636844bc926fac6fc371 Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Mon, 26 Aug 2024 14:08:22 +0200 Subject: [PATCH 05/13] 117544: port to 8.0 standard after merge --- .../bulk-access/bulk-access.component.ts | 2 + .../epeople-registry.component.spec.ts | 2 +- .../eperson-form/eperson-form.component.html | 2 +- .../eperson-form.component.spec.ts | 4 +- .../eperson-form/eperson-form.component.ts | 2 + .../members-list/members-list.component.html | 6 +- .../members-list/members-list.component.ts | 2 + .../groups-registry.component.spec.ts | 4 +- .../groups-registry.component.ts | 2 + .../filtered-items.component.html | 8 +- .../filtered-items.component.ts | 2 + .../delete-collection-page.component.ts | 2 + .../collection-source-controls.component.html | 12 +- ...llection-source-controls.component.spec.ts | 2 +- .../collection-source-controls.component.ts | 2 + .../collection-source.component.html | 8 +- .../collection-source.component.ts | 2 + .../delete-community-page.component.html | 4 +- .../delete-community-page.component.ts | 2 + .../dso-edit-metadata-value.component.html | 12 +- .../dso-edit-metadata-value.component.spec.ts | 7 +- .../dso-edit-metadata-value.component.ts | 3 +- .../dso-edit-metadata.component.html | 14 +- .../dso-edit-metadata.component.spec.ts | 4 +- .../dso-edit-metadata.component.ts | 3 +- .../forgot-password-form.component.ts | 2 + .../end-user-agreement.component.spec.ts | 2 +- .../end-user-agreement.component.ts | 3 +- .../feedback-form.component.html | 2 +- .../feedback-form.component.spec.ts | 2 +- .../feedback-form/feedback-form.component.ts | 3 +- ...bitstream-request-a-copy-page.component.ts | 2 + .../item-bitstreams.component.html | 8 +- .../item-bitstreams.component.ts | 2 + .../item-edit-bitstream.component.html | 4 +- .../item-edit-bitstream.component.ts | 2 + .../item-delete/item-delete.component.html | 6 +- .../item-delete/item-delete.component.ts | 2 + .../item-move/item-move.component.ts | 2 + .../item-operation.component.spec.ts | 2 +- .../item-operation.component.ts | 2 + .../edit-relationship-list.component.html | 2 +- .../edit-relationship-list.component.ts | 2 + .../edit-relationship.component.ts | 2 + .../item-relationships.component.html | 4 +- .../item-relationships.component.ts | 2 + .../media-viewer-video.component.ts | 2 + .../orcid-auth/orcid-auth.component.html | 2 +- .../orcid-auth/orcid-auth.component.ts | 2 + ...ersions-row-element-version.component.html | 4 +- ...-versions-row-element-version.component.ts | 2 + .../versions/item-versions.component.html | 2 +- .../versions/item-versions.component.spec.ts | 2 +- .../versions/item-versions.component.ts | 3 +- ...space-new-external-dropdown.component.html | 4 +- ...-dspace-new-external-dropdown.component.ts | 2 + ...ace-new-submission-dropdown.component.html | 4 +- ...space-new-submission-dropdown.component.ts | 2 + .../quality-assurance-events.component.html | 16 +-- .../quality-assurance-events.component.ts | 3 +- .../project-entry-import-modal.component.html | 6 +- .../project-entry-import-modal.component.ts | 3 +- .../suggestion-actions.component.html | 2 +- .../suggestion-actions.component.ts | 2 + .../overview/process-overview.component.ts | 3 +- .../profile-claim-item-modal.component.ts | 2 + .../profile-page-researcher-form.component.ts | 2 + .../register-email-form.component.html | 4 +- .../register-email-form.component.ts | 3 +- .../create-profile.component.ts | 2 + .../email-request-copy.component.html | 2 +- .../email-request-copy.component.ts | 3 +- .../access-control-array-form.component.html | 10 +- .../access-control-array-form.component.ts | 3 +- ...cess-control-form-container.component.html | 16 +-- ...access-control-form-container.component.ts | 3 +- src/app/shared/disabled-directive.spec.ts | 126 ++++++++++-------- src/app/shared/disabled-directive.ts | 30 +++-- .../shared/ds-select/ds-select.component.ts | 4 +- ...dit-menu-expandable-section.component.html | 2 +- ...-edit-menu-expandable-section.component.ts | 3 +- .../dso-edit-menu-section.component.html | 4 +- .../dso-edit-menu-section.component.ts | 3 +- ...ynamic-form-control-container.component.ts | 2 + .../dynamic-date-picker-inline.component.ts | 3 + .../date-picker/date-picker.component.ts | 2 + .../disabled/dynamic-disabled.component.ts | 2 + .../lookup/dynamic-lookup.component.spec.ts | 2 +- .../models/lookup/dynamic-lookup.component.ts | 2 + .../models/onebox/dynamic-onebox.component.ts | 2 + .../dynamic-relation-group.components.ts | 2 + .../dynamic-scrollable-dropdown.component.ts | 2 + ...namic-lookup-relation-modal.component.html | 8 +- ...ic-lookup-relation-modal.component.spec.ts | 2 +- ...dynamic-lookup-relation-modal.component.ts | 2 + ...nal-source-entry-import-modal.component.ts | 2 + src/app/shared/form/form.component.html | 4 +- src/app/shared/form/form.component.ts | 2 + .../number-picker/number-picker.component.ts | 2 + .../vocabulary-treeview.component.html | 2 +- .../vocabulary-treeview.component.ts | 2 + .../password/log-in-password.component.ts | 3 +- .../claimed-task-actions-approve.component.ts | 3 +- ...med-task-actions-decline-task.component.ts | 3 +- .../claimed-task-actions-reject.component.ts | 3 +- ...d-task-actions-return-to-pool.component.ts | 3 +- .../pool-task/pool-task-actions.component.ts | 3 +- .../collection-select.component.html | 2 +- .../collection-select.component.ts | 3 +- .../item-select/item-select.component.html | 4 +- .../item-select/item-select.component.spec.ts | 7 +- .../item-select/item-select.component.ts | 3 +- .../shared/pagination/pagination.component.ts | 3 +- .../form/resource-policy-form.component.html | 4 +- .../resource-policy-form.component.spec.ts | 4 +- .../form/resource-policy-form.component.ts | 2 + .../resource-policies.component.html | 4 +- .../resource-policies.component.ts | 2 + .../advanced-search.component.html | 2 +- .../advanced-search.component.ts | 2 + .../subscription-modal.component.ts | 3 +- .../subscription-view.component.ts | 3 +- .../upload/uploader/uploader.component.ts | 3 +- .../submission-form-collection.component.html | 2 +- ...bmission-form-collection.component.spec.ts | 4 +- .../submission-form-collection.component.ts | 2 + .../submission-form-footer.component.html | 8 +- .../submission-form-footer.component.spec.ts | 4 +- .../submission-form-footer.component.ts | 3 +- ...submission-form-section-add.component.html | 2 +- .../submission-form-section-add.component.ts | 3 +- ...n-import-external-searchbar.component.html | 2 +- ...ion-import-external-searchbar.component.ts | 2 + ...ubmission-section-cc-licenses.component.ts | 2 + .../section-upload-file-edit.component.ts | 2 + .../file/section-upload-file.component.html | 2 +- .../file/section-upload-file.component.ts | 2 + .../system-wide-alert-form.component.html | 4 +- .../system-wide-alert-form.component.ts | 3 +- .../reviewers-list.component.ts | 2 + .../dso-edit-metadata.component.ts | 3 +- .../forgot-password-form.component.ts | 2 + .../end-user-agreement.component.ts | 3 +- .../feedback-form/feedback-form.component.ts | 3 +- .../media-viewer-video.component.ts | 2 + .../register-email-form.component.ts | 3 +- .../create-profile.component.ts | 2 + .../email-request-copy.component.ts | 4 +- ...nal-source-entry-import-modal.component.ts | 2 + .../file/section-upload-file.component.ts | 2 + 150 files changed, 405 insertions(+), 243 deletions(-) diff --git a/src/app/access-control/bulk-access/bulk-access.component.ts b/src/app/access-control/bulk-access/bulk-access.component.ts index bd8e893b599..10be65f24a5 100644 --- a/src/app/access-control/bulk-access/bulk-access.component.ts +++ b/src/app/access-control/bulk-access/bulk-access.component.ts @@ -14,6 +14,7 @@ import { } from 'rxjs/operators'; import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service'; +import { DisabledDirective } from '../../shared/disabled-directive'; import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer'; import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service'; import { BulkAccessBrowseComponent } from './browse/bulk-access-browse.component'; @@ -27,6 +28,7 @@ import { BulkAccessSettingsComponent } from './settings/bulk-access-settings.com TranslateModule, BulkAccessSettingsComponent, BulkAccessBrowseComponent, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts b/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts index 933224a6e9a..9ce1674e237 100644 --- a/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts +++ b/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts @@ -42,6 +42,7 @@ import { EPersonDataService } from '../../core/eperson/eperson-data.service'; import { EPerson } from '../../core/eperson/models/eperson.model'; import { PaginationService } from '../../core/pagination/pagination.service'; import { PageInfo } from '../../core/shared/page-info.model'; +import { DisabledDirective } from '../../shared/disabled-directive'; import { FormBuilderService } from '../../shared/form/builder/form-builder.service'; import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; import { getMockFormBuilderService } from '../../shared/mocks/form-builder-service.mock'; @@ -57,7 +58,6 @@ import { NotificationsServiceStub } from '../../shared/testing/notifications-ser import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub'; import { EPeopleRegistryComponent } from './epeople-registry.component'; import { EPersonFormComponent } from './eperson-form/eperson-form.component'; -import {DisabledDirective} from '../../shared/disabled-directive'; describe('EPeopleRegistryComponent', () => { let component: EPeopleRegistryComponent; diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html index b4c0781ac78..694fe9d7c5a 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html @@ -25,7 +25,7 @@

{{messagePrefix + '.edit' | translate}}

-
diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts index 415ab4955c6..0b5a6ec7523 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts @@ -45,6 +45,7 @@ import { GroupDataService } from '../../../core/eperson/group-data.service'; import { EPerson } from '../../../core/eperson/models/eperson.model'; import { PaginationService } from '../../../core/pagination/pagination.service'; import { PageInfo } from '../../../core/shared/page-info.model'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { FormBuilderService } from '../../../shared/form/builder/form-builder.service'; import { FormComponent } from '../../../shared/form/form.component'; import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component'; @@ -68,7 +69,6 @@ import { HasNoValuePipe } from '../../../shared/utils/has-no-value.pipe'; import { EPeopleRegistryComponent } from '../epeople-registry.component'; import { EPersonFormComponent } from './eperson-form.component'; import { ValidateEmailNotTaken } from './validators/email-taken.validator'; -import {DisabledDirective} from '../../../shared/disabled-directive'; describe('EPersonFormComponent', () => { let component: EPersonFormComponent; @@ -547,7 +547,7 @@ describe('EPersonFormComponent', () => { // ePersonDataServiceStub.activeEPerson = eperson; spyOn(component.epersonService, 'deleteEPerson').and.returnValue(createSuccessfulRemoteDataObject$('No Content', 204)); const deleteButton = fixture.debugElement.query(By.css('.delete-button')); - expect(deleteButton.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(deleteButton.nativeElement.getAttribute('aria-disabled')).toBeNull(); expect(deleteButton.nativeElement.classList.contains('disabled')).toBeFalse(); deleteButton.triggerEventHandler('click', null); fixture.detectChanges(); diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts index 05efde7cf7d..40f920f8d86 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts @@ -66,6 +66,7 @@ import { PageInfo } from '../../../core/shared/page-info.model'; import { Registration } from '../../../core/shared/registration.model'; import { TYPE_REQUEST_FORGOT } from '../../../register-email-form/register-email-form.component'; import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { hasValue } from '../../../shared/empty.util'; import { FormBuilderService } from '../../../shared/form/builder/form-builder.service'; import { FormComponent } from '../../../shared/form/form.component'; @@ -92,6 +93,7 @@ import { ValidateEmailNotTaken } from './validators/email-taken.validator'; PaginationComponent, RouterLink, HasNoValuePipe, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/access-control/group-registry/group-form/members-list/members-list.component.html b/src/app/access-control/group-registry/group-form/members-list/members-list.component.html index 591d80bdd59..e531b35f9ed 100644 --- a/src/app/access-control/group-registry/group-form/members-list/members-list.component.html +++ b/src/app/access-control/group-registry/group-form/members-list/members-list.component.html @@ -35,14 +35,14 @@

{{messagePrefix + '.headMembers' | translate}}

  - +
@@ -158,8 +158,8 @@

{{'admin.reports.items.head' | transl {{'admin.reports.commons.page' | translate}} {{ currentPage + 1 }} {{'admin.reports.commons.of' | translate}} {{ pageCount() }}

- - + + diff --git a/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts b/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts index 9fd4643573e..52454f2e8ee 100644 --- a/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts +++ b/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts @@ -42,6 +42,7 @@ import { getFirstSucceededRemoteListPayload } from 'src/app/core/shared/operator import { isEmpty } from 'src/app/shared/empty.util'; import { environment } from 'src/environments/environment'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { FiltersComponent } from '../filters-section/filters-section.component'; import { FilteredItems } from './filtered-items-model'; import { OptionVO } from './option-vo.model'; @@ -63,6 +64,7 @@ import { QueryPredicate } from './query-predicate.model'; NgIf, NgForOf, FiltersComponent, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts b/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts index dbb5f8846f1..1fab715aa44 100644 --- a/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts +++ b/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts @@ -16,6 +16,7 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; import { CollectionDataService } from '../../core/data/collection-data.service'; import { Collection } from '../../core/shared/collection.model'; import { DeleteComColPageComponent } from '../../shared/comcol/comcol-forms/delete-comcol-page/delete-comcol-page.component'; +import { DisabledDirective } from '../../shared/disabled-directive'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; @@ -31,6 +32,7 @@ import { VarDirective } from '../../shared/utils/var.directive'; AsyncPipe, NgIf, VarDirective, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.html b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.html index 7edaadb0a1d..cc01848290a 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.html +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.html @@ -19,32 +19,32 @@

{{ 'collection.source.controls.head' | translate }}

diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts index 83683382b9d..22012263e0b 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts @@ -22,12 +22,12 @@ import { Collection } from '../../../../core/shared/collection.model'; import { ContentSource } from '../../../../core/shared/content-source.model'; import { ContentSourceSetSerializer } from '../../../../core/shared/content-source-set-serializer'; import { Process } from '../../../../process-page/processes/process.model'; +import { DisabledDirective } from '../../../../shared/disabled-directive'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils'; import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub'; import { VarDirective } from '../../../../shared/utils/var.directive'; import { CollectionSourceControlsComponent } from './collection-source-controls.component'; -import {DisabledDirective} from '../../../../shared/disabled-directive'; describe('CollectionSourceControlsComponent', () => { let comp: CollectionSourceControlsComponent; diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts index 3b51a8e9d99..fef7868561f 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts @@ -40,6 +40,7 @@ import { } from '../../../../core/shared/operators'; import { Process } from '../../../../process-page/processes/process.model'; import { ProcessStatus } from '../../../../process-page/processes/process-status.model'; +import { DisabledDirective } from '../../../../shared/disabled-directive'; import { hasValue } from '../../../../shared/empty.util'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { VarDirective } from '../../../../shared/utils/var.directive'; @@ -56,6 +57,7 @@ import { VarDirective } from '../../../../shared/utils/var.directive'; AsyncPipe, NgIf, VarDirective, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.html b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.html index 8f807c1aee8..5b13401d221 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.html +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.html @@ -1,7 +1,7 @@
- diff --git a/src/app/community-page/delete-community-page/delete-community-page.component.ts b/src/app/community-page/delete-community-page/delete-community-page.component.ts index f35e2d6bd23..59fb75fa972 100644 --- a/src/app/community-page/delete-community-page/delete-community-page.component.ts +++ b/src/app/community-page/delete-community-page/delete-community-page.component.ts @@ -16,6 +16,7 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; import { CommunityDataService } from '../../core/data/community-data.service'; import { Community } from '../../core/shared/community.model'; import { DeleteComColPageComponent } from '../../shared/comcol/comcol-forms/delete-comcol-page/delete-comcol-page.component'; +import { DisabledDirective } from '../../shared/disabled-directive'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; @@ -31,6 +32,7 @@ import { VarDirective } from '../../shared/utils/var.directive'; AsyncPipe, VarDirective, NgIf, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html index 25b82b9b437..450dfae98c2 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html @@ -36,7 +36,7 @@ [authorityValue]="mdValue.newValue.confidence" [iconMode]="true" > - - - @@ -73,19 +73,19 @@
- - diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts index 5009960fed0..7f54c6eeeb3 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts @@ -22,6 +22,7 @@ import { Item } from '../../core/shared/item.model'; import { ITEM } from '../../core/shared/item.resource-type'; import { MetadataValue } from '../../core/shared/metadata.models'; import { AlertComponent } from '../../shared/alert/alert.component'; +import { DisabledDirective } from '../../shared/disabled-directive'; import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { TestDataService } from '../../shared/testing/test-data-service.mock'; @@ -32,7 +33,6 @@ import { DsoEditMetadataHeadersComponent } from './dso-edit-metadata-headers/dso import { DsoEditMetadataValueComponent } from './dso-edit-metadata-value/dso-edit-metadata-value.component'; import { DsoEditMetadataValueHeadersComponent } from './dso-edit-metadata-value-headers/dso-edit-metadata-value-headers.component'; import { MetadataFieldSelectorComponent } from './metadata-field-selector/metadata-field-selector.component'; -import {DisabledDirective} from '../../shared/disabled-directive'; const ADD_BTN = 'add'; const REINSTATE_BTN = 'reinstate'; @@ -88,7 +88,6 @@ describe('DsoEditMetadataComponent', () => { ]); TestBed.configureTestingModule({ - declarations: [DisabledDirective] imports: [ CommonModule, BrowserModule, @@ -96,6 +95,7 @@ describe('DsoEditMetadataComponent', () => { RouterTestingModule.withRoutes([]), DsoEditMetadataComponent, VarDirective, + DisabledDirective, ], providers: [ { provide: APP_DATA_SERVICES_MAP, useValue: mockDataServiceMap }, diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts index 677a601b9df..12d77ab24fc 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts @@ -47,6 +47,7 @@ import { getFirstCompletedRemoteData } from '../../core/shared/operators'; import { ResourceType } from '../../core/shared/resource-type'; import { AlertComponent } from '../../shared/alert/alert.component'; import { AlertType } from '../../shared/alert/alert-type'; +import { DisabledDirective } from '../../shared/disabled-directive'; import { hasNoValue, hasValue, @@ -66,7 +67,7 @@ import { MetadataFieldSelectorComponent } from './metadata-field-selector/metada styleUrls: ['./dso-edit-metadata.component.scss'], templateUrl: './dso-edit-metadata.component.html', standalone: true, - imports: [NgIf, DsoEditMetadataHeadersComponent, MetadataFieldSelectorComponent, DsoEditMetadataValueHeadersComponent, DsoEditMetadataValueComponent, NgFor, DsoEditMetadataFieldValuesComponent, AlertComponent, ThemedLoadingComponent, AsyncPipe, TranslateModule], + imports: [NgIf, DsoEditMetadataHeadersComponent, MetadataFieldSelectorComponent, DsoEditMetadataValueHeadersComponent, DsoEditMetadataValueComponent, NgFor, DsoEditMetadataFieldValuesComponent, AlertComponent, ThemedLoadingComponent, AsyncPipe, TranslateModule, DisabledDirective], }) /** * Component showing a table of all metadata on a DSpaceObject and options to modify them diff --git a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.ts b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.ts index 442e4bf9fa2..ada7e66f9ec 100644 --- a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.ts +++ b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.ts @@ -26,6 +26,7 @@ import { } from '../../core/shared/operators'; import { Registration } from '../../core/shared/registration.model'; import { ProfilePageSecurityFormComponent } from '../../profile-page/profile-page-security-form/profile-page-security-form.component'; +import { DisabledDirective } from '../../shared/disabled-directive'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { BrowserOnlyPipe } from '../../shared/utils/browser-only.pipe'; @@ -39,6 +40,7 @@ import { BrowserOnlyPipe } from '../../shared/utils/browser-only.pipe'; ProfilePageSecurityFormComponent, AsyncPipe, NgIf, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts b/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts index 725ff8322ae..8195ce75eb4 100644 --- a/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts +++ b/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts @@ -16,11 +16,11 @@ import { of as observableOf } from 'rxjs'; import { LogOutAction } from '../../core/auth/auth.actions'; import { AuthService } from '../../core/auth/auth.service'; import { EndUserAgreementService } from '../../core/end-user-agreement/end-user-agreement.service'; +import { DisabledDirective } from '../../shared/disabled-directive'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { ActivatedRouteStub } from '../../shared/testing/active-router.stub'; import { EndUserAgreementComponent } from './end-user-agreement.component'; import { EndUserAgreementContentComponent } from './end-user-agreement-content/end-user-agreement-content.component'; -import {DisabledDirective} from '../../shared/disabled-directive'; describe('EndUserAgreementComponent', () => { let component: EndUserAgreementComponent; diff --git a/src/app/info/end-user-agreement/end-user-agreement.component.ts b/src/app/info/end-user-agreement/end-user-agreement.component.ts index 5c10c024322..7a02f100397 100644 --- a/src/app/info/end-user-agreement/end-user-agreement.component.ts +++ b/src/app/info/end-user-agreement/end-user-agreement.component.ts @@ -23,6 +23,7 @@ import { AppState } from '../../app.reducer'; import { LogOutAction } from '../../core/auth/auth.actions'; import { AuthService } from '../../core/auth/auth.service'; import { EndUserAgreementService } from '../../core/end-user-agreement/end-user-agreement.service'; +import { DisabledDirective } from '../../shared/disabled-directive'; import { isNotEmpty } from '../../shared/empty.util'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { EndUserAgreementContentComponent } from './end-user-agreement-content/end-user-agreement-content.component'; @@ -32,7 +33,7 @@ import { EndUserAgreementContentComponent } from './end-user-agreement-content/e templateUrl: './end-user-agreement.component.html', styleUrls: ['./end-user-agreement.component.scss'], standalone: true, - imports: [EndUserAgreementContentComponent, FormsModule, TranslateModule], + imports: [EndUserAgreementContentComponent, FormsModule, TranslateModule, DisabledDirective], }) /** * Component displaying the End User Agreement and an option to accept it diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.html b/src/app/info/feedback/feedback-form/feedback-form.component.html index a3437d1f0e4..3fdc66820ad 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.html +++ b/src/app/info/feedback/feedback-form/feedback-form.component.html @@ -41,7 +41,7 @@

{{ 'info.feedback.head' | translate }}

- +
diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts b/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts index 61ef939c2db..0b1f3439f4b 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts +++ b/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts @@ -18,6 +18,7 @@ import { FeedbackDataService } from '../../../core/feedback/feedback-data.servic import { Feedback } from '../../../core/feedback/models/feedback.model'; import { RouteService } from '../../../core/services/route.service'; import { NativeWindowService } from '../../../core/services/window.service'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { NativeWindowMockFactory } from '../../../shared/mocks/mock-native-window-ref'; import { RouterMock } from '../../../shared/mocks/router.mock'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; @@ -26,7 +27,6 @@ import { EPersonMock } from '../../../shared/testing/eperson.mock'; import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub'; import { routeServiceStub } from '../../../shared/testing/route-service.stub'; import { FeedbackFormComponent } from './feedback-form.component'; -import {DisabledDirective} from '../../../shared/disabled-directive'; describe('FeedbackFormComponent', () => { diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.ts b/src/app/info/feedback/feedback-form/feedback-form.component.ts index 59be526f175..f33ef353524 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.ts +++ b/src/app/info/feedback/feedback-form/feedback-form.component.ts @@ -30,6 +30,7 @@ import { import { NoContent } from '../../../core/shared/NoContent.model'; import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; import { URLCombiner } from '../../../core/url-combiner/url-combiner'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { ErrorComponent } from '../../../shared/error/error.component'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; @@ -38,7 +39,7 @@ import { NotificationsService } from '../../../shared/notifications/notification templateUrl: './feedback-form.component.html', styleUrls: ['./feedback-form.component.scss'], standalone: true, - imports: [FormsModule, ReactiveFormsModule, NgIf, ErrorComponent, TranslateModule], + imports: [FormsModule, ReactiveFormsModule, NgIf, ErrorComponent, TranslateModule, DisabledDirective], }) /** * Component displaying the contents of the Feedback Statement diff --git a/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.ts b/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.ts index e32239a5779..35fd357da2d 100644 --- a/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.ts +++ b/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.ts @@ -55,6 +55,7 @@ import { getFirstCompletedRemoteData, getFirstSucceededRemoteDataPayload, } from '../../../core/shared/operators'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { hasValue, isNotEmpty, @@ -71,6 +72,7 @@ import { getItemPageRoute } from '../../item-page-routing-paths'; AsyncPipe, ReactiveFormsModule, NgIf, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html b/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html index 88d984c19f1..f068864b45d 100644 --- a/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html +++ b/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html @@ -12,7 +12,7 @@ class="fas fa-undo-alt">  {{"item.edit.bitstreams.reinstate-button" | translate}} - - - - - diff --git a/src/app/item-page/edit-item-page/item-delete/item-delete.component.ts b/src/app/item-page/edit-item-page/item-delete/item-delete.component.ts index 1655856a3ed..4e09a0b9ea9 100644 --- a/src/app/item-page/edit-item-page/item-delete/item-delete.component.ts +++ b/src/app/item-page/edit-item-page/item-delete/item-delete.component.ts @@ -56,6 +56,7 @@ import { getRemoteDataPayload, } from '../../../core/shared/operators'; import { ViewMode } from '../../../core/shared/view-mode.model'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { hasValue, isNotEmpty, @@ -109,6 +110,7 @@ class RelationshipDTO { VarDirective, NgForOf, RouterLink, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/item-page/edit-item-page/item-move/item-move.component.ts b/src/app/item-page/edit-item-page/item-move/item-move.component.ts index 1115260901a..5e2d355bba0 100644 --- a/src/app/item-page/edit-item-page/item-move/item-move.component.ts +++ b/src/app/item-page/edit-item-page/item-move/item-move.component.ts @@ -37,6 +37,7 @@ import { getRemoteDataPayload, } from '../../../core/shared/operators'; import { SearchService } from '../../../core/shared/search/search.service'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { AuthorizedCollectionSelectorComponent } from '../../../shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { followLink } from '../../../shared/utils/follow-link-config.model'; @@ -56,6 +57,7 @@ import { AsyncPipe, AuthorizedCollectionSelectorComponent, NgIf, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts b/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts index 43287fa8d89..42765f4d748 100644 --- a/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts +++ b/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts @@ -6,9 +6,9 @@ import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { ItemOperationComponent } from './item-operation.component'; import { ItemOperation } from './itemOperation.model'; -import {DisabledDirective} from '../../../shared/disabled-directive'; describe('ItemOperationComponent', () => { let itemOperation: ItemOperation; diff --git a/src/app/item-page/edit-item-page/item-operation/item-operation.component.ts b/src/app/item-page/edit-item-page/item-operation/item-operation.component.ts index 9cf4b30e6cd..b82fb154bf5 100644 --- a/src/app/item-page/edit-item-page/item-operation/item-operation.component.ts +++ b/src/app/item-page/edit-item-page/item-operation/item-operation.component.ts @@ -7,6 +7,7 @@ import { RouterLink } from '@angular/router'; import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { ItemOperation } from './itemOperation.model'; @Component({ @@ -17,6 +18,7 @@ import { ItemOperation } from './itemOperation.model'; RouterLink, NgbTooltipModule, NgIf, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html index e32938590f2..b0157cb9892 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html @@ -1,6 +1,6 @@

{{relationshipMessageKey$ | async | translate}} - diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts index 656d6089353..1bc95291c76 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts @@ -65,6 +65,7 @@ import { getFirstSucceededRemoteDataPayload, getRemoteDataPayload, } from '../../../../core/shared/operators'; +import { DisabledDirective } from '../../../../shared/disabled-directive'; import { hasNoValue, hasValue, @@ -100,6 +101,7 @@ import { EditRelationshipComponent } from '../edit-relationship/edit-relationshi TranslateModule, NgClass, ThemedLoadingComponent, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts b/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts index f79d0ee0d1d..95aa87a28bc 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts @@ -37,6 +37,7 @@ import { getRemoteDataPayload, } from '../../../../core/shared/operators'; import { ViewMode } from '../../../../core/shared/view-mode.model'; +import { DisabledDirective } from '../../../../shared/disabled-directive'; import { hasValue, isNotEmpty, @@ -54,6 +55,7 @@ import { VirtualMetadataComponent } from '../../virtual-metadata/virtual-metadat NgIf, TranslateModule, VirtualMetadataComponent, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/item-page/edit-item-page/item-relationships/item-relationships.component.html b/src/app/item-page/edit-item-page/item-relationships/item-relationships.component.html index 4c8ea49f993..cced89db933 100644 --- a/src/app/item-page/edit-item-page/item-relationships/item-relationships.component.html +++ b/src/app/item-page/edit-item-page/item-relationships/item-relationships.component.html @@ -35,7 +35,7 @@
@@ -8,7 +8,7 @@ ngbDropdown *ngIf="(moreThanOne$ | async)"> - + +

@@ -66,6 +66,6 @@

{{ (labelPrefix + label + '.select' | translate) }}

- +
diff --git a/src/app/notifications/qa/project-entry-import-modal/project-entry-import-modal.component.ts b/src/app/notifications/qa/project-entry-import-modal/project-entry-import-modal.component.ts index 4b31e2316a9..845a7737694 100644 --- a/src/app/notifications/qa/project-entry-import-modal/project-entry-import-modal.component.ts +++ b/src/app/notifications/qa/project-entry-import-modal/project-entry-import-modal.component.ts @@ -29,6 +29,7 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model'; import { Item } from '../../../core/shared/item.model'; import { SearchService } from '../../../core/shared/search/search.service'; import { AlertComponent } from '../../../shared/alert/alert.component'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { hasValue, isNotEmpty, @@ -104,7 +105,7 @@ export interface QualityAssuranceEventData { styleUrls: ['./project-entry-import-modal.component.scss'], templateUrl: './project-entry-import-modal.component.html', standalone: true, - imports: [RouterLink, NgIf, FormsModule, ThemedLoadingComponent, ThemedSearchResultsComponent, AlertComponent, AsyncPipe, TranslateModule], + imports: [RouterLink, NgIf, FormsModule, ThemedLoadingComponent, ThemedSearchResultsComponent, AlertComponent, AsyncPipe, TranslateModule, DisabledDirective], }) /** * Component to display a modal window for linking a project to an Quality Assurance event diff --git a/src/app/notifications/suggestion-actions/suggestion-actions.component.html b/src/app/notifications/suggestion-actions/suggestion-actions.component.html index 2a46191deea..e83d0a4123e 100644 --- a/src/app/notifications/suggestion-actions/suggestion-actions.component.html +++ b/src/app/notifications/suggestion-actions/suggestion-actions.component.html @@ -21,7 +21,7 @@ - - diff --git a/src/app/register-email-form/register-email-form.component.ts b/src/app/register-email-form/register-email-form.component.ts index ac13abb865e..302c6bc9c5a 100644 --- a/src/app/register-email-form/register-email-form.component.ts +++ b/src/app/register-email-form/register-email-form.component.ts @@ -55,6 +55,7 @@ import { Registration } from '../core/shared/registration.model'; import { AlertComponent } from '../shared/alert/alert.component'; import { AlertType } from '../shared/alert/alert-type'; import { KlaroService } from '../shared/cookies/klaro.service'; +import { DisabledDirective } from '../shared/disabled-directive'; import { isNotEmpty } from '../shared/empty.util'; import { GoogleRecaptchaComponent } from '../shared/google-recaptcha/google-recaptcha.component'; import { NotificationsService } from '../shared/notifications/notifications.service'; @@ -66,7 +67,7 @@ export const TYPE_REQUEST_REGISTER = 'register'; selector: 'ds-base-register-email-form', templateUrl: './register-email-form.component.html', standalone: true, - imports: [NgIf, FormsModule, ReactiveFormsModule, AlertComponent, GoogleRecaptchaComponent, AsyncPipe, TranslateModule], + imports: [NgIf, FormsModule, ReactiveFormsModule, AlertComponent, GoogleRecaptchaComponent, AsyncPipe, TranslateModule, DisabledDirective], }) /** * Component responsible to render an email registration form. diff --git a/src/app/register-page/create-profile/create-profile.component.ts b/src/app/register-page/create-profile/create-profile.component.ts index 7e88c5a1c01..1ec95c8f52e 100644 --- a/src/app/register-page/create-profile/create-profile.component.ts +++ b/src/app/register-page/create-profile/create-profile.component.ts @@ -43,6 +43,7 @@ import { } from '../../core/shared/operators'; import { Registration } from '../../core/shared/registration.model'; import { ProfilePageSecurityFormComponent } from '../../profile-page/profile-page-security-form/profile-page-security-form.component'; +import { DisabledDirective } from '../../shared/disabled-directive'; import { isEmpty } from '../../shared/empty.util'; import { NotificationsService } from '../../shared/notifications/notifications.service'; @@ -60,6 +61,7 @@ import { NotificationsService } from '../../shared/notifications/notifications.s AsyncPipe, ReactiveFormsModule, NgForOf, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/request-copy/email-request-copy/email-request-copy.component.html b/src/app/request-copy/email-request-copy/email-request-copy.component.html index 286e87554b8..815a9a96916 100644 --- a/src/app/request-copy/email-request-copy/email-request-copy.component.html +++ b/src/app/request-copy/email-request-copy/email-request-copy.component.html @@ -13,7 +13,7 @@
diff --git a/src/app/shared/access-control-form-container/access-control-form-container.component.ts b/src/app/shared/access-control-form-container/access-control-form-container.component.ts index 56a6e92323a..11313dfc99c 100644 --- a/src/app/shared/access-control-form-container/access-control-form-container.component.ts +++ b/src/app/shared/access-control-form-container/access-control-form-container.component.ts @@ -31,6 +31,7 @@ import { Item } from '../../core/shared/item.model'; import { getFirstCompletedRemoteData } from '../../core/shared/operators'; import { AlertComponent } from '../alert/alert.component'; import { AlertType } from '../alert/alert-type'; +import { DisabledDirective } from '../disabled-directive'; import { SelectableListService } from '../object-list/selectable-list/selectable-list.service'; import { AccessControlArrayFormComponent } from './access-control-array-form/access-control-array-form.component'; import { createAccessControlInitialFormState } from './access-control-form-container-intial-state'; @@ -46,7 +47,7 @@ import { styleUrls: ['./access-control-form-container.component.scss'], exportAs: 'dsAccessControlForm', standalone: true, - imports: [NgIf, AlertComponent, UiSwitchModule, FormsModule, AccessControlArrayFormComponent, AsyncPipe, TranslateModule], + imports: [NgIf, AlertComponent, UiSwitchModule, FormsModule, AccessControlArrayFormComponent, AsyncPipe, TranslateModule, DisabledDirective], }) export class AccessControlFormContainerComponent implements OnDestroy { diff --git a/src/app/shared/disabled-directive.spec.ts b/src/app/shared/disabled-directive.spec.ts index c4ca4f05997..7099e62d529 100644 --- a/src/app/shared/disabled-directive.spec.ts +++ b/src/app/shared/disabled-directive.spec.ts @@ -1,89 +1,97 @@ -import { Component, DebugElement } from '@angular/core'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { + Component, + DebugElement, +} from '@angular/core'; +import { + ComponentFixture, + TestBed, +} from '@angular/core/testing'; import { By } from '@angular/platform-browser'; + import { DisabledDirective } from './disabled-directive'; @Component({ - template: ` + template: ` - ` + `, }) class TestComponent { - isDisabled = false; + isDisabled = false; } describe('DisabledDirective', () => { - let component: TestComponent; - let fixture: ComponentFixture; - let button: DebugElement; - - beforeEach(() => { - TestBed.configureTestingModule({ - declarations: [TestComponent, DisabledDirective] - }); - fixture = TestBed.createComponent(TestComponent); - component = fixture.componentInstance; - button = fixture.debugElement.query(By.css('button')); - fixture.detectChanges(); + let component: TestComponent; + let fixture: ComponentFixture; + let button: DebugElement; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [DisabledDirective], + declarations: [TestComponent], }); + fixture = TestBed.createComponent(TestComponent); + component = fixture.componentInstance; + button = fixture.debugElement.query(By.css('button')); + fixture.detectChanges(); + }); - it('should bind aria-disabled to false initially', () => { - expect(button.nativeElement.getAttribute('aria-disabled')).toBe('false'); - expect(button.nativeElement.classList.contains('disabled')).toBeFalse(); - }); + it('should bind aria-disabled to false initially', () => { + expect(button.nativeElement.getAttribute('aria-disabled')).toBe('false'); + expect(button.nativeElement.classList.contains('disabled')).toBeFalse(); + }); - it('should bind aria-disabled to true and add disabled class when isDisabled is true', () => { - component.isDisabled = true; - fixture.detectChanges(); + it('should bind aria-disabled to true and add disabled class when isDisabled is true', () => { + component.isDisabled = true; + fixture.detectChanges(); - expect(button.nativeElement.getAttribute('aria-disabled')).toBe('true'); - expect(button.nativeElement.classList.contains('disabled')).toBeTrue(); - }); + expect(button.nativeElement.getAttribute('aria-disabled')).toBe('true'); + expect(button.nativeElement.classList.contains('disabled')).toBeTrue(); + }); - it('should prevent click events when disabled', () => { - component.isDisabled = true; - fixture.detectChanges(); + it('should prevent click events when disabled', () => { + component.isDisabled = true; + fixture.detectChanges(); - let clickHandled = false; - button.nativeElement.addEventListener('click', () => clickHandled = true); + let clickHandled = false; + button.nativeElement.addEventListener('click', () => clickHandled = true); - button.nativeElement.click(); + button.nativeElement.click(); - expect(clickHandled).toBeFalse(); - }); + expect(clickHandled).toBeFalse(); + }); - it('should prevent Enter or Space keydown events when disabled', () => { - component.isDisabled = true; - fixture.detectChanges(); + it('should prevent Enter or Space keydown events when disabled', () => { + component.isDisabled = true; + fixture.detectChanges(); - let keydownHandled = false; - button.nativeElement.addEventListener('keydown', () => keydownHandled = true); + let keydownHandled = false; + button.nativeElement.addEventListener('keydown', () => keydownHandled = true); - const enterEvent = new KeyboardEvent('keydown', { key: 'Enter' }); - const spaceEvent = new KeyboardEvent('keydown', { key: 'Space' }); + const enterEvent = new KeyboardEvent('keydown', { key: 'Enter' }); + const spaceEvent = new KeyboardEvent('keydown', { key: 'Space' }); - button.nativeElement.dispatchEvent(enterEvent); - button.nativeElement.dispatchEvent(spaceEvent); + button.nativeElement.dispatchEvent(enterEvent); + button.nativeElement.dispatchEvent(spaceEvent); - expect(keydownHandled).toBeFalse(); - }); + expect(keydownHandled).toBeFalse(); + }); - it('should allow click and keydown events when not disabled', () => { - let clickHandled = false; - let keydownHandled = false; + it('should allow click and keydown events when not disabled', () => { + let clickHandled = false; + let keydownHandled = false; - button.nativeElement.addEventListener('click', () => clickHandled = true); - button.nativeElement.addEventListener('keydown', () => keydownHandled = true); + button.nativeElement.addEventListener('click', () => clickHandled = true); + button.nativeElement.addEventListener('keydown', () => keydownHandled = true); - button.nativeElement.click(); + button.nativeElement.click(); - const enterEvent = new KeyboardEvent('keydown', { key: 'Enter' }); - const spaceEvent = new KeyboardEvent('keydown', { key: 'Space' }); + const enterEvent = new KeyboardEvent('keydown', { key: 'Enter' }); + const spaceEvent = new KeyboardEvent('keydown', { key: 'Space' }); - button.nativeElement.dispatchEvent(enterEvent); - button.nativeElement.dispatchEvent(spaceEvent); + button.nativeElement.dispatchEvent(enterEvent); + button.nativeElement.dispatchEvent(spaceEvent); - expect(clickHandled).toBeTrue(); - expect(keydownHandled).toBeTrue(); - }); + expect(clickHandled).toBeTrue(); + expect(keydownHandled).toBeTrue(); + }); }); diff --git a/src/app/shared/disabled-directive.ts b/src/app/shared/disabled-directive.ts index 38f92cd1d7b..8939c744adf 100644 --- a/src/app/shared/disabled-directive.ts +++ b/src/app/shared/disabled-directive.ts @@ -1,31 +1,37 @@ -import { Directive, Input, HostBinding, HostListener } from '@angular/core'; +import { + Directive, + HostBinding, + HostListener, + Input, +} from '@angular/core'; @Directive({ - selector: '[dsDisabled]' + selector: '[dsDisabled]', + standalone: true, }) export class DisabledDirective { @Input() set dsDisabled(value: boolean) { - this.isDisabled = !!value; - } + this.isDisabled = !!value; + } @HostBinding('attr.aria-disabled') isDisabled = false; @HostBinding('class.disabled') get disabledClass() { return this.isDisabled; } @HostListener('click', ['$event']) handleClick(event: Event) { - if (this.isDisabled) { - event.preventDefault(); - event.stopImmediatePropagation(); - } + if (this.isDisabled) { + event.preventDefault(); + event.stopImmediatePropagation(); + } } @HostListener('keydown', ['$event']) handleKeydown(event: KeyboardEvent) { - if (this.isDisabled && (event.key === 'Enter' || event.key === 'Space')) { - event.preventDefault(); - event.stopImmediatePropagation(); - } + if (this.isDisabled && (event.key === 'Enter' || event.key === 'Space')) { + event.preventDefault(); + event.stopImmediatePropagation(); + } } } diff --git a/src/app/shared/ds-select/ds-select.component.ts b/src/app/shared/ds-select/ds-select.component.ts index d82378d4e5d..c7a8fafa723 100644 --- a/src/app/shared/ds-select/ds-select.component.ts +++ b/src/app/shared/ds-select/ds-select.component.ts @@ -8,6 +8,8 @@ import { import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; +import { DisabledDirective } from '../disabled-directive'; + /** * Component which represent a DSpace dropdown selector. */ @@ -16,7 +18,7 @@ import { TranslateModule } from '@ngx-translate/core'; templateUrl: './ds-select.component.html', styleUrls: ['./ds-select.component.scss'], standalone: true, - imports: [NgbDropdownModule, NgIf, TranslateModule], + imports: [NgbDropdownModule, NgIf, TranslateModule, DisabledDirective], }) export class DsSelectComponent { diff --git a/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html b/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html index 6e427400eec..747d14cac6a 100644 --- a/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html +++ b/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html @@ -1,7 +1,7 @@
- - +
diff --git a/src/app/submission/import-external/import-external-searchbar/submission-import-external-searchbar.component.ts b/src/app/submission/import-external/import-external-searchbar/submission-import-external-searchbar.component.ts index aace4de79a8..7572d3ac8ba 100644 --- a/src/app/submission/import-external/import-external-searchbar/submission-import-external-searchbar.component.ts +++ b/src/app/submission/import-external/import-external-searchbar/submission-import-external-searchbar.component.ts @@ -36,6 +36,7 @@ import { getFirstSucceededRemoteDataPayload, } from '../../../core/shared/operators'; import { PageInfo } from '../../../core/shared/page-info.model'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { hasValue } from '../../../shared/empty.util'; import { HostWindowService } from '../../../shared/host-window.service'; import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils'; @@ -70,6 +71,7 @@ export interface ExternalSourceData { InfiniteScrollModule, NgbDropdownModule, FormsModule, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts index d286a830e2f..62546e18352 100644 --- a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts +++ b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts @@ -40,6 +40,7 @@ import { import { WorkspaceitemSectionCcLicenseObject } from '../../../core/submission/models/workspaceitem-section-cc-license.model'; import { SubmissionCcLicenseDataService } from '../../../core/submission/submission-cc-license-data.service'; import { SubmissionCcLicenseUrlDataService } from '../../../core/submission/submission-cc-license-url-data.service'; +import { DisabledDirective } from '../../../shared/disabled-directive'; import { DsSelectComponent } from '../../../shared/ds-select/ds-select.component'; import { isNotEmpty } from '../../../shared/empty.util'; import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component'; @@ -64,6 +65,7 @@ import { SectionsType } from '../sections-type'; VarDirective, NgForOf, DsSelectComponent, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts index 24488d1adb3..c7ba64e4b90 100644 --- a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts +++ b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts @@ -39,6 +39,7 @@ import { JsonPatchOperationsBuilder } from '../../../../../core/json-patch/build import { WorkspaceitemSectionUploadFileObject } from '../../../../../core/submission/models/workspaceitem-section-upload-file.model'; import { SubmissionJsonPatchOperationsService } from '../../../../../core/submission/submission-json-patch-operations.service'; import { dateToISOFormat } from '../../../../../shared/date.util'; +import { DisabledDirective } from '../../../../../shared/disabled-directive'; import { hasNoValue, hasValue, @@ -80,6 +81,7 @@ import { FormComponent, NgIf, TranslateModule, + DisabledDirective, ], standalone: true, }) diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.html b/src/app/submission/sections/upload/file/section-upload-file.component.html index f8d6b9ca931..20e2e80a567 100644 --- a/src/app/submission/sections/upload/file/section-upload-file.component.html +++ b/src/app/submission/sections/upload/file/section-upload-file.component.html @@ -7,7 +7,7 @@ type="checkbox" class="custom-control-input" id="primaryBitstream{{fileIndex}}" - [disabled]="processingSaveStatus$ | async" + [dsDisabled]="processingSaveStatus$ | async" [checked]="isPrimary" (change)="togglePrimaryBitstream($event)">
- \ No newline at end of file + diff --git a/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.ts b/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.ts index b30e864fa12..b695bb47edd 100644 --- a/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.ts +++ b/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.ts @@ -43,6 +43,7 @@ import { RemoteData } from '../../core/data/remote-data'; import { RequestService } from '../../core/data/request.service'; import { SystemWideAlertDataService } from '../../core/data/system-wide-alert-data.service'; import { getFirstCompletedRemoteData } from '../../core/shared/operators'; +import { DisabledDirective } from '../../shared/disabled-directive'; import { hasValue, isNotEmpty, @@ -59,7 +60,7 @@ import { SystemWideAlert } from '../system-wide-alert.model'; styleUrls: ['./system-wide-alert-form.component.scss'], templateUrl: './system-wide-alert-form.component.html', standalone: true, - imports: [FormsModule, ReactiveFormsModule, UiSwitchModule, NgIf, NgbDatepickerModule, NgbTimepickerModule, AsyncPipe, TranslateModule], + imports: [FormsModule, ReactiveFormsModule, UiSwitchModule, NgIf, NgbDatepickerModule, NgbTimepickerModule, AsyncPipe, TranslateModule, DisabledDirective], }) export class SystemWideAlertFormComponent implements OnInit { diff --git a/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts b/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts index 5ae3a13f313..e87a292c0ca 100644 --- a/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts +++ b/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts @@ -45,6 +45,7 @@ import { Group } from '../../../../core/eperson/models/group.model'; import { PaginationService } from '../../../../core/pagination/pagination.service'; import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators'; import { ContextHelpDirective } from '../../../../shared/context-help.directive'; +import { DisabledDirective } from '../../../../shared/disabled-directive'; import { hasValue } from '../../../../shared/empty.util'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { PaginationComponent } from '../../../../shared/pagination/pagination.component'; @@ -76,6 +77,7 @@ enum SubKey { RouterLink, NgClass, NgForOf, + DisabledDirective, ], }) export class ReviewersListComponent extends MembersListComponent implements OnInit, OnChanges, OnDestroy { diff --git a/src/themes/custom/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts b/src/themes/custom/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts index a7437c04081..40a6264e4e2 100644 --- a/src/themes/custom/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts +++ b/src/themes/custom/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts @@ -13,6 +13,7 @@ import { DsoEditMetadataValueComponent } from '../../../../../app/dso-shared/dso import { DsoEditMetadataValueHeadersComponent } from '../../../../../app/dso-shared/dso-edit-metadata/dso-edit-metadata-value-headers/dso-edit-metadata-value-headers.component'; import { MetadataFieldSelectorComponent } from '../../../../../app/dso-shared/dso-edit-metadata/metadata-field-selector/metadata-field-selector.component'; import { AlertComponent } from '../../../../../app/shared/alert/alert.component'; +import { DisabledDirective } from '../../../../../app/shared/disabled-directive'; import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed-loading.component'; @Component({ @@ -22,7 +23,7 @@ import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed // templateUrl: './dso-edit-metadata.component.html', templateUrl: '../../../../../app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.html', standalone: true, - imports: [NgIf, DsoEditMetadataHeadersComponent, MetadataFieldSelectorComponent, DsoEditMetadataValueHeadersComponent, DsoEditMetadataValueComponent, NgFor, DsoEditMetadataFieldValuesComponent, AlertComponent, ThemedLoadingComponent, AsyncPipe, TranslateModule], + imports: [NgIf, DsoEditMetadataHeadersComponent, MetadataFieldSelectorComponent, DsoEditMetadataValueHeadersComponent, DsoEditMetadataValueComponent, NgFor, DsoEditMetadataFieldValuesComponent, AlertComponent, ThemedLoadingComponent, AsyncPipe, TranslateModule, DisabledDirective], }) export class DsoEditMetadataComponent extends BaseComponent { } diff --git a/src/themes/custom/app/forgot-password/forgot-password-form/forgot-password-form.component.ts b/src/themes/custom/app/forgot-password/forgot-password-form/forgot-password-form.component.ts index 9656e7b85ce..ff64b096644 100644 --- a/src/themes/custom/app/forgot-password/forgot-password-form/forgot-password-form.component.ts +++ b/src/themes/custom/app/forgot-password/forgot-password-form/forgot-password-form.component.ts @@ -7,6 +7,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { ForgotPasswordFormComponent as BaseComponent } from '../../../../../app/forgot-password/forgot-password-form/forgot-password-form.component'; import { ProfilePageSecurityFormComponent } from '../../../../../app/profile-page/profile-page-security-form/profile-page-security-form.component'; +import { DisabledDirective } from '../../../../../app/shared/disabled-directive'; import { BrowserOnlyPipe } from '../../../../../app/shared/utils/browser-only.pipe'; @Component({ @@ -22,6 +23,7 @@ import { BrowserOnlyPipe } from '../../../../../app/shared/utils/browser-only.pi ProfilePageSecurityFormComponent, AsyncPipe, NgIf, + DisabledDirective, ], }) /** diff --git a/src/themes/custom/app/info/end-user-agreement/end-user-agreement.component.ts b/src/themes/custom/app/info/end-user-agreement/end-user-agreement.component.ts index 05f22522163..e557fc466cc 100644 --- a/src/themes/custom/app/info/end-user-agreement/end-user-agreement.component.ts +++ b/src/themes/custom/app/info/end-user-agreement/end-user-agreement.component.ts @@ -4,6 +4,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { EndUserAgreementComponent as BaseComponent } from '../../../../../app/info/end-user-agreement/end-user-agreement.component'; import { EndUserAgreementContentComponent } from '../../../../../app/info/end-user-agreement/end-user-agreement-content/end-user-agreement-content.component'; +import { DisabledDirective } from '../../../../../app/shared/disabled-directive'; @Component({ selector: 'ds-themed-end-user-agreement', @@ -12,7 +13,7 @@ import { EndUserAgreementContentComponent } from '../../../../../app/info/end-us // templateUrl: './end-user-agreement.component.html' templateUrl: '../../../../../app/info/end-user-agreement/end-user-agreement.component.html', standalone: true, - imports: [EndUserAgreementContentComponent, FormsModule, TranslateModule], + imports: [EndUserAgreementContentComponent, FormsModule, TranslateModule, DisabledDirective], }) /** diff --git a/src/themes/custom/app/info/feedback/feedback-form/feedback-form.component.ts b/src/themes/custom/app/info/feedback/feedback-form/feedback-form.component.ts index b3cd90e73ed..b86fecae7a6 100644 --- a/src/themes/custom/app/info/feedback/feedback-form/feedback-form.component.ts +++ b/src/themes/custom/app/info/feedback/feedback-form/feedback-form.component.ts @@ -7,6 +7,7 @@ import { import { TranslateModule } from '@ngx-translate/core'; import { FeedbackFormComponent as BaseComponent } from '../../../../../../app/info/feedback/feedback-form/feedback-form.component'; +import { DisabledDirective } from '../../../../../../app/shared/disabled-directive'; import { ErrorComponent } from '../../../../../../app/shared/error/error.component'; @Component({ @@ -16,7 +17,7 @@ import { ErrorComponent } from '../../../../../../app/shared/error/error.compone // styleUrls: ['./feedback-form.component.scss'], styleUrls: ['../../../../../../app/info/feedback/feedback-form/feedback-form.component.scss'], standalone: true, - imports: [FormsModule, ReactiveFormsModule, NgIf, ErrorComponent, TranslateModule], + imports: [FormsModule, ReactiveFormsModule, NgIf, ErrorComponent, TranslateModule, DisabledDirective], }) export class FeedbackFormComponent extends BaseComponent { } diff --git a/src/themes/custom/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts b/src/themes/custom/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts index 5c6c7f35072..020293214ef 100644 --- a/src/themes/custom/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts +++ b/src/themes/custom/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts @@ -7,6 +7,7 @@ import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { MediaViewerVideoComponent as BaseComponent } from '../../../../../../app/item-page/media-viewer/media-viewer-video/media-viewer-video.component'; +import { DisabledDirective } from '../../../../../../app/shared/disabled-directive'; @Component({ selector: 'ds-themed-media-viewer-video', @@ -20,6 +21,7 @@ import { MediaViewerVideoComponent as BaseComponent } from '../../../../../../ap NgbDropdownModule, TranslateModule, NgIf, + DisabledDirective, ], }) export class MediaViewerVideoComponent extends BaseComponent { diff --git a/src/themes/custom/app/register-email-form/register-email-form.component.ts b/src/themes/custom/app/register-email-form/register-email-form.component.ts index 44426c527fd..d9be35f39dc 100644 --- a/src/themes/custom/app/register-email-form/register-email-form.component.ts +++ b/src/themes/custom/app/register-email-form/register-email-form.component.ts @@ -12,13 +12,14 @@ import { AlertComponent } from 'src/app/shared/alert/alert.component'; import { GoogleRecaptchaComponent } from 'src/app/shared/google-recaptcha/google-recaptcha.component'; import { RegisterEmailFormComponent as BaseComponent } from '../../../../app/register-email-form/register-email-form.component'; +import { DisabledDirective } from '../../../../app/shared/disabled-directive'; @Component({ selector: 'ds-themed-register-email-form', // templateUrl: './register-email-form.component.html', templateUrl: '../../../../app/register-email-form/register-email-form.component.html', standalone: true, - imports: [NgIf, FormsModule, ReactiveFormsModule, AlertComponent, GoogleRecaptchaComponent, AsyncPipe, TranslateModule], + imports: [NgIf, FormsModule, ReactiveFormsModule, AlertComponent, GoogleRecaptchaComponent, AsyncPipe, TranslateModule, DisabledDirective], }) export class RegisterEmailFormComponent extends BaseComponent { } diff --git a/src/themes/custom/app/register-page/create-profile/create-profile.component.ts b/src/themes/custom/app/register-page/create-profile/create-profile.component.ts index ac2491cc4ee..659e260b1c2 100644 --- a/src/themes/custom/app/register-page/create-profile/create-profile.component.ts +++ b/src/themes/custom/app/register-page/create-profile/create-profile.component.ts @@ -9,6 +9,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { ProfilePageSecurityFormComponent } from '../../../../../app/profile-page/profile-page-security-form/profile-page-security-form.component'; import { CreateProfileComponent as BaseComponent } from '../../../../../app/register-page/create-profile/create-profile.component'; +import { DisabledDirective } from '../../../../../app/shared/disabled-directive'; /** * Component that renders the create profile page to be used by a user registering through a token @@ -27,6 +28,7 @@ import { CreateProfileComponent as BaseComponent } from '../../../../../app/regi AsyncPipe, ReactiveFormsModule, NgForOf, + DisabledDirective, ], }) export class CreateProfileComponent extends BaseComponent { diff --git a/src/themes/custom/app/request-copy/email-request-copy/email-request-copy.component.ts b/src/themes/custom/app/request-copy/email-request-copy/email-request-copy.component.ts index 1876b134a26..a299e47a27b 100644 --- a/src/themes/custom/app/request-copy/email-request-copy/email-request-copy.component.ts +++ b/src/themes/custom/app/request-copy/email-request-copy/email-request-copy.component.ts @@ -7,6 +7,8 @@ import { FormsModule } from '@angular/forms'; import { TranslateModule } from '@ngx-translate/core'; import { EmailRequestCopyComponent as BaseComponent } from 'src/app/request-copy/email-request-copy/email-request-copy.component'; +import { DisabledDirective } from '../../../../../app/shared/disabled-directive'; + @Component({ selector: 'ds-themed-email-request-copy', // styleUrls: ['./email-request-copy.component.scss'], @@ -14,7 +16,7 @@ import { EmailRequestCopyComponent as BaseComponent } from 'src/app/request-copy // templateUrl: './email-request-copy.component.html', templateUrl: './../../../../../app/request-copy/email-request-copy/email-request-copy.component.html', standalone: true, - imports: [FormsModule, NgClass, NgIf, TranslateModule], + imports: [FormsModule, NgClass, NgIf, TranslateModule, DisabledDirective], }) export class EmailRequestCopyComponent extends BaseComponent { diff --git a/src/themes/custom/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts b/src/themes/custom/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts index 424adb79429..7936deb4066 100644 --- a/src/themes/custom/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts +++ b/src/themes/custom/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts @@ -5,6 +5,7 @@ import { import { Component } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; +import { DisabledDirective } from '../../../../../../../../../../app/shared/disabled-directive'; import { ExternalSourceEntryImportModalComponent as BaseComponent } from '../../../../../../../../../../app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component'; import { ThemedSearchResultsComponent } from '../../../../../../../../../../app/shared/search/search-results/themed-search-results.component'; @@ -19,6 +20,7 @@ import { ThemedSearchResultsComponent } from '../../../../../../../../../../app/ ThemedSearchResultsComponent, NgIf, AsyncPipe, + DisabledDirective, ], }) export class ExternalSourceEntryImportModalComponent extends BaseComponent { diff --git a/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts b/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts index 13f5f976503..17bc5d91364 100644 --- a/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts +++ b/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts @@ -6,6 +6,7 @@ import { Component } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; import { SubmissionSectionUploadFileComponent as BaseComponent } from 'src/app/submission/sections/upload/file/section-upload-file.component'; +import { DisabledDirective } from '../../../../../../../app/shared/disabled-directive'; import { ThemedFileDownloadLinkComponent } from '../../../../../../../app/shared/file-download-link/themed-file-download-link.component'; import { FileSizePipe } from '../../../../../../../app/shared/utils/file-size-pipe'; import { SubmissionSectionUploadFileViewComponent } from '../../../../../../../app/submission/sections/upload/file/view/section-upload-file-view.component'; @@ -27,6 +28,7 @@ import { SubmissionSectionUploadFileViewComponent } from '../../../../../../../a AsyncPipe, ThemedFileDownloadLinkComponent, FileSizePipe, + DisabledDirective, ], }) export class SubmissionSectionUploadFileComponent From 9fd3c2d73480059c140589159abf3198e6bf0999 Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Mon, 16 Sep 2024 13:44:06 +0200 Subject: [PATCH 06/13] 117544: PR feedback - added typedocs - changed directive to only be present for buttons - various other small fixes --- .../filtered-items.component.html | 2 +- .../dso-edit-metadata-value.component.html | 2 +- .../dso-edit-metadata-value.component.spec.ts | 3 +- .../item-delete/item-delete.component.html | 2 +- .../access-control-array-form.component.html | 2 +- ...cess-control-form-container.component.html | 12 ++++---- src/app/shared/disabled-directive.spec.ts | 8 ++++++ src/app/shared/disabled-directive.ts | 28 ++++++++++++++++++- ...amic-form-control-container.component.html | 2 +- .../date-picker/date-picker.component.html | 6 ++-- .../disabled/dynamic-disabled.component.html | 2 +- .../dynamic-disabled.component.spec.ts | 2 +- .../lookup/dynamic-lookup.component.html | 4 +-- .../onebox/dynamic-onebox.component.html | 4 +-- ...dynamic-scrollable-dropdown.component.html | 2 +- .../number-picker.component.html | 2 +- .../vocabulary-treeview.component.html | 4 +-- .../collection-select.component.html | 2 +- .../item-select/item-select.component.html | 2 +- .../item-select/item-select.component.spec.ts | 3 +- .../pagination/pagination.component.html | 2 +- ...mission-section-cc-licenses.component.html | 4 +-- .../file/section-upload-file.component.html | 2 +- 23 files changed, 67 insertions(+), 35 deletions(-) diff --git a/src/app/admin/admin-reports/filtered-items/filtered-items.component.html b/src/app/admin/admin-reports/filtered-items/filtered-items.component.html index 38591b0fcd5..1750975c9a4 100644 --- a/src/app/admin/admin-reports/filtered-items/filtered-items.component.html +++ b/src/app/admin/admin-reports/filtered-items/filtered-items.component.html @@ -12,7 +12,7 @@

{{'admin.reports.items.head' | transl
diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html index 450dfae98c2..221ae134519 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html @@ -36,7 +36,7 @@ [authorityValue]="mdValue.newValue.confidence" [iconMode]="true" > - -
diff --git a/src/app/access-control/bulk-access/bulk-access.component.ts b/src/app/access-control/bulk-access/bulk-access.component.ts index 10be65f24a5..a1608d27d07 100644 --- a/src/app/access-control/bulk-access/bulk-access.component.ts +++ b/src/app/access-control/bulk-access/bulk-access.component.ts @@ -14,7 +14,7 @@ import { } from 'rxjs/operators'; import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer'; import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service'; import { BulkAccessBrowseComponent } from './browse/bulk-access-browse.component'; @@ -28,7 +28,7 @@ import { BulkAccessSettingsComponent } from './settings/bulk-access-settings.com TranslateModule, BulkAccessSettingsComponent, BulkAccessBrowseComponent, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts b/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts index 9ce1674e237..cd7441022cb 100644 --- a/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts +++ b/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts @@ -42,7 +42,7 @@ import { EPersonDataService } from '../../core/eperson/eperson-data.service'; import { EPerson } from '../../core/eperson/models/eperson.model'; import { PaginationService } from '../../core/pagination/pagination.service'; import { PageInfo } from '../../core/shared/page-info.model'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { FormBuilderService } from '../../shared/form/builder/form-builder.service'; import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; import { getMockFormBuilderService } from '../../shared/mocks/form-builder-service.mock'; @@ -152,7 +152,7 @@ describe('EPeopleRegistryComponent', () => { paginationService = new PaginationServiceStub(); TestBed.configureTestingModule({ imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, RouterTestingModule.withRoutes([]), - TranslateModule.forRoot(), EPeopleRegistryComponent, DisabledDirective], + TranslateModule.forRoot(), EPeopleRegistryComponent, BtnDisabledDirective], providers: [ { provide: EPersonDataService, useValue: ePersonDataServiceStub }, { provide: NotificationsService, useValue: new NotificationsServiceStub() }, diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html index 694fe9d7c5a..98ff328884e 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html @@ -25,7 +25,7 @@

{{messagePrefix + '.edit' | translate}}

-
diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts index 0b5a6ec7523..2e9427df9c9 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts @@ -45,7 +45,7 @@ import { GroupDataService } from '../../../core/eperson/group-data.service'; import { EPerson } from '../../../core/eperson/models/eperson.model'; import { PaginationService } from '../../../core/pagination/pagination.service'; import { PageInfo } from '../../../core/shared/page-info.model'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { FormBuilderService } from '../../../shared/form/builder/form-builder.service'; import { FormComponent } from '../../../shared/form/form.component'; import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component'; @@ -228,7 +228,7 @@ describe('EPersonFormComponent', () => { route = new ActivatedRouteStub(); router = new RouterStub(); TestBed.configureTestingModule({ - imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, DisabledDirective, BrowserModule, + imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BtnDisabledDirective, BrowserModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts index 40f920f8d86..1c6f1929f38 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts @@ -66,7 +66,7 @@ import { PageInfo } from '../../../core/shared/page-info.model'; import { Registration } from '../../../core/shared/registration.model'; import { TYPE_REQUEST_FORGOT } from '../../../register-email-form/register-email-form.component'; import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { hasValue } from '../../../shared/empty.util'; import { FormBuilderService } from '../../../shared/form/builder/form-builder.service'; import { FormComponent } from '../../../shared/form/form.component'; @@ -93,7 +93,7 @@ import { ValidateEmailNotTaken } from './validators/email-taken.validator'; PaginationComponent, RouterLink, HasNoValuePipe, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/access-control/group-registry/group-form/members-list/members-list.component.html b/src/app/access-control/group-registry/group-form/members-list/members-list.component.html index e531b35f9ed..d289d036bb4 100644 --- a/src/app/access-control/group-registry/group-form/members-list/members-list.component.html +++ b/src/app/access-control/group-registry/group-form/members-list/members-list.component.html @@ -35,14 +35,14 @@

{{messagePrefix + '.headMembers' | translate}}

  - +
@@ -158,8 +158,8 @@

{{'admin.reports.items.head' | transl {{'admin.reports.commons.page' | translate}} {{ currentPage + 1 }} {{'admin.reports.commons.of' | translate}} {{ pageCount() }}
- - + + diff --git a/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts b/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts index 73b0eeb771d..04ee4894ec9 100644 --- a/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts +++ b/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts @@ -43,7 +43,7 @@ import { getFirstSucceededRemoteListPayload } from 'src/app/core/shared/operator import { isEmpty } from 'src/app/shared/empty.util'; import { environment } from 'src/environments/environment'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { FiltersComponent } from '../filters-section/filters-section.component'; import { FilteredItems } from './filtered-items-model'; import { OptionVO } from './option-vo.model'; @@ -65,7 +65,7 @@ import { QueryPredicate } from './query-predicate.model'; NgIf, NgForOf, FiltersComponent, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/collection-page/delete-collection-page/delete-collection-page.component.html b/src/app/collection-page/delete-collection-page/delete-collection-page.component.html index ab1bff08490..0cdba00f039 100644 --- a/src/app/collection-page/delete-collection-page/delete-collection-page.component.html +++ b/src/app/collection-page/delete-collection-page/delete-collection-page.component.html @@ -6,10 +6,10 @@

{{ 'collection.delete.head' | transla

{{ 'collection.delete.text' | translate:{ dso: dsoNameService.getName(dso) } }}

- - diff --git a/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts b/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts index 1fab715aa44..3d4d4abb5f9 100644 --- a/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts +++ b/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts @@ -16,7 +16,7 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; import { CollectionDataService } from '../../core/data/collection-data.service'; import { Collection } from '../../core/shared/collection.model'; import { DeleteComColPageComponent } from '../../shared/comcol/comcol-forms/delete-comcol-page/delete-comcol-page.component'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; @@ -32,7 +32,7 @@ import { VarDirective } from '../../shared/utils/var.directive'; AsyncPipe, NgIf, VarDirective, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.html b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.html index cc01848290a..1e09758bd10 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.html +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.html @@ -19,32 +19,32 @@

{{ 'collection.source.controls.head' | translate }}

diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts index 22012263e0b..2e3cf5477c2 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts @@ -22,7 +22,7 @@ import { Collection } from '../../../../core/shared/collection.model'; import { ContentSource } from '../../../../core/shared/content-source.model'; import { ContentSourceSetSerializer } from '../../../../core/shared/content-source-set-serializer'; import { Process } from '../../../../process-page/processes/process.model'; -import { DisabledDirective } from '../../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../shared/btn-disabled.directive'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils'; import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub'; @@ -105,7 +105,7 @@ describe('CollectionSourceControlsComponent', () => { requestService = jasmine.createSpyObj('requestService', ['removeByHrefSubstring', 'setStaleByHrefSubstring']); TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), RouterTestingModule, CollectionSourceControlsComponent, VarDirective, DisabledDirective], + imports: [TranslateModule.forRoot(), RouterTestingModule, CollectionSourceControlsComponent, VarDirective, BtnDisabledDirective], providers: [ { provide: ScriptDataService, useValue: scriptDataService }, { provide: ProcessDataService, useValue: processDataService }, diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts index 06dd537d9df..e35a64af16d 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts @@ -40,7 +40,7 @@ import { } from '../../../../core/shared/operators'; import { Process } from '../../../../process-page/processes/process.model'; import { ProcessStatus } from '../../../../process-page/processes/process-status.model'; -import { DisabledDirective } from '../../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../shared/btn-disabled.directive'; import { hasValue } from '../../../../shared/empty.util'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { VarDirective } from '../../../../shared/utils/var.directive'; @@ -57,7 +57,7 @@ import { VarDirective } from '../../../../shared/utils/var.directive'; AsyncPipe, NgIf, VarDirective, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.html b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.html index 5b13401d221..7aa1f1a8b78 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.html +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.html @@ -1,7 +1,7 @@
- diff --git a/src/app/community-page/delete-community-page/delete-community-page.component.ts b/src/app/community-page/delete-community-page/delete-community-page.component.ts index 59fb75fa972..b2fa5956cbd 100644 --- a/src/app/community-page/delete-community-page/delete-community-page.component.ts +++ b/src/app/community-page/delete-community-page/delete-community-page.component.ts @@ -16,7 +16,7 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; import { CommunityDataService } from '../../core/data/community-data.service'; import { Community } from '../../core/shared/community.model'; import { DeleteComColPageComponent } from '../../shared/comcol/comcol-forms/delete-comcol-page/delete-comcol-page.component'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; @@ -32,7 +32,7 @@ import { VarDirective } from '../../shared/utils/var.directive'; AsyncPipe, VarDirective, NgIf, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html index 221ae134519..57cad2e9a7c 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html @@ -71,29 +71,29 @@ - - @@ -77,13 +77,13 @@
- - diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts index 7f54c6eeeb3..cbe2c187924 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.spec.ts @@ -22,7 +22,7 @@ import { Item } from '../../core/shared/item.model'; import { ITEM } from '../../core/shared/item.resource-type'; import { MetadataValue } from '../../core/shared/metadata.models'; import { AlertComponent } from '../../shared/alert/alert.component'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { TestDataService } from '../../shared/testing/test-data-service.mock'; @@ -95,7 +95,7 @@ describe('DsoEditMetadataComponent', () => { RouterTestingModule.withRoutes([]), DsoEditMetadataComponent, VarDirective, - DisabledDirective, + BtnDisabledDirective, ], providers: [ { provide: APP_DATA_SERVICES_MAP, useValue: mockDataServiceMap }, diff --git a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts index d27f4445bde..4a40e3c26a1 100644 --- a/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts +++ b/src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts @@ -47,7 +47,7 @@ import { getFirstCompletedRemoteData } from '../../core/shared/operators'; import { ResourceType } from '../../core/shared/resource-type'; import { AlertComponent } from '../../shared/alert/alert.component'; import { AlertType } from '../../shared/alert/alert-type'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { hasNoValue, hasValue, @@ -67,7 +67,7 @@ import { MetadataFieldSelectorComponent } from './metadata-field-selector/metada styleUrls: ['./dso-edit-metadata.component.scss'], templateUrl: './dso-edit-metadata.component.html', standalone: true, - imports: [NgIf, DsoEditMetadataHeadersComponent, MetadataFieldSelectorComponent, DsoEditMetadataValueHeadersComponent, DsoEditMetadataValueComponent, NgFor, DsoEditMetadataFieldValuesComponent, AlertComponent, ThemedLoadingComponent, AsyncPipe, TranslateModule, DisabledDirective], + imports: [NgIf, DsoEditMetadataHeadersComponent, MetadataFieldSelectorComponent, DsoEditMetadataValueHeadersComponent, DsoEditMetadataValueComponent, NgFor, DsoEditMetadataFieldValuesComponent, AlertComponent, ThemedLoadingComponent, AsyncPipe, TranslateModule, BtnDisabledDirective], }) /** * Component showing a table of all metadata on a DSpaceObject and options to modify them diff --git a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.html b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.html index 1f3df7e3334..6cff2903b94 100644 --- a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.html +++ b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.html @@ -28,7 +28,7 @@

{{'forgot-password.form.head' | translate}}

diff --git a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.ts b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.ts index 4b70fce18fa..68f0f9d203c 100644 --- a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.ts +++ b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.ts @@ -29,7 +29,7 @@ import { } from '../../core/shared/operators'; import { Registration } from '../../core/shared/registration.model'; import { ProfilePageSecurityFormComponent } from '../../profile-page/profile-page-security-form/profile-page-security-form.component'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { BrowserOnlyPipe } from '../../shared/utils/browser-only.pipe'; @@ -43,7 +43,7 @@ import { BrowserOnlyPipe } from '../../shared/utils/browser-only.pipe'; ProfilePageSecurityFormComponent, AsyncPipe, NgIf, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/info/end-user-agreement/end-user-agreement.component.html b/src/app/info/end-user-agreement/end-user-agreement.component.html index 4b93d631b71..ceb2ad23a4c 100644 --- a/src/app/info/end-user-agreement/end-user-agreement.component.html +++ b/src/app/info/end-user-agreement/end-user-agreement.component.html @@ -7,7 +7,7 @@
- +
diff --git a/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts b/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts index 8195ce75eb4..88cb46e3777 100644 --- a/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts +++ b/src/app/info/end-user-agreement/end-user-agreement.component.spec.ts @@ -16,7 +16,7 @@ import { of as observableOf } from 'rxjs'; import { LogOutAction } from '../../core/auth/auth.actions'; import { AuthService } from '../../core/auth/auth.service'; import { EndUserAgreementService } from '../../core/end-user-agreement/end-user-agreement.service'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { ActivatedRouteStub } from '../../shared/testing/active-router.stub'; import { EndUserAgreementComponent } from './end-user-agreement.component'; @@ -58,7 +58,7 @@ describe('EndUserAgreementComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), EndUserAgreementComponent, DisabledDirective], + imports: [TranslateModule.forRoot(), EndUserAgreementComponent, BtnDisabledDirective], providers: [ { provide: EndUserAgreementService, useValue: endUserAgreementService }, { provide: NotificationsService, useValue: notificationsService }, diff --git a/src/app/info/end-user-agreement/end-user-agreement.component.ts b/src/app/info/end-user-agreement/end-user-agreement.component.ts index 7a02f100397..e9835945f50 100644 --- a/src/app/info/end-user-agreement/end-user-agreement.component.ts +++ b/src/app/info/end-user-agreement/end-user-agreement.component.ts @@ -23,7 +23,7 @@ import { AppState } from '../../app.reducer'; import { LogOutAction } from '../../core/auth/auth.actions'; import { AuthService } from '../../core/auth/auth.service'; import { EndUserAgreementService } from '../../core/end-user-agreement/end-user-agreement.service'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { isNotEmpty } from '../../shared/empty.util'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { EndUserAgreementContentComponent } from './end-user-agreement-content/end-user-agreement-content.component'; @@ -33,7 +33,7 @@ import { EndUserAgreementContentComponent } from './end-user-agreement-content/e templateUrl: './end-user-agreement.component.html', styleUrls: ['./end-user-agreement.component.scss'], standalone: true, - imports: [EndUserAgreementContentComponent, FormsModule, TranslateModule, DisabledDirective], + imports: [EndUserAgreementContentComponent, FormsModule, TranslateModule, BtnDisabledDirective], }) /** * Component displaying the End User Agreement and an option to accept it diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.html b/src/app/info/feedback/feedback-form/feedback-form.component.html index 3fdc66820ad..c5c4b460a23 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.html +++ b/src/app/info/feedback/feedback-form/feedback-form.component.html @@ -41,7 +41,7 @@

{{ 'info.feedback.head' | translate }}

- +
diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts b/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts index 0b1f3439f4b..56275ad5a35 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts +++ b/src/app/info/feedback/feedback-form/feedback-form.component.spec.ts @@ -18,7 +18,7 @@ import { FeedbackDataService } from '../../../core/feedback/feedback-data.servic import { Feedback } from '../../../core/feedback/models/feedback.model'; import { RouteService } from '../../../core/services/route.service'; import { NativeWindowService } from '../../../core/services/window.service'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { NativeWindowMockFactory } from '../../../shared/mocks/mock-native-window-ref'; import { RouterMock } from '../../../shared/mocks/router.mock'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; @@ -46,7 +46,7 @@ describe('FeedbackFormComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), FeedbackFormComponent, DisabledDirective], + imports: [TranslateModule.forRoot(), FeedbackFormComponent, BtnDisabledDirective], providers: [ { provide: RouteService, useValue: routeServiceStub }, { provide: UntypedFormBuilder, useValue: new UntypedFormBuilder() }, diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.ts b/src/app/info/feedback/feedback-form/feedback-form.component.ts index f33ef353524..db98a2ee011 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.ts +++ b/src/app/info/feedback/feedback-form/feedback-form.component.ts @@ -30,7 +30,7 @@ import { import { NoContent } from '../../../core/shared/NoContent.model'; import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; import { URLCombiner } from '../../../core/url-combiner/url-combiner'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { ErrorComponent } from '../../../shared/error/error.component'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; @@ -39,7 +39,7 @@ import { NotificationsService } from '../../../shared/notifications/notification templateUrl: './feedback-form.component.html', styleUrls: ['./feedback-form.component.scss'], standalone: true, - imports: [FormsModule, ReactiveFormsModule, NgIf, ErrorComponent, TranslateModule, DisabledDirective], + imports: [FormsModule, ReactiveFormsModule, NgIf, ErrorComponent, TranslateModule, BtnDisabledDirective], }) /** * Component displaying the contents of the Feedback Statement diff --git a/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.html b/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.html index a67dfb18bea..5f42ccee74a 100644 --- a/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.html +++ b/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.html @@ -79,7 +79,7 @@

{{'bitstream-request-a-copy.header' | translate}}

diff --git a/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.ts b/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.ts index 5db70ae51a5..454725f2e65 100644 --- a/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.ts +++ b/src/app/item-page/bitstreams/request-a-copy/bitstream-request-a-copy-page.component.ts @@ -55,7 +55,7 @@ import { getFirstCompletedRemoteData, getFirstSucceededRemoteDataPayload, } from '../../../core/shared/operators'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { hasValue, isNotEmpty, @@ -72,7 +72,7 @@ import { getItemPageRoute } from '../../item-page-routing-paths'; AsyncPipe, ReactiveFormsModule, NgIf, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html b/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html index f068864b45d..76b1f1096cb 100644 --- a/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html +++ b/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html @@ -12,7 +12,7 @@ class="fas fa-undo-alt">  {{"item.edit.bitstreams.reinstate-button" | translate}} - - - - - diff --git a/src/app/item-page/edit-item-page/item-delete/item-delete.component.ts b/src/app/item-page/edit-item-page/item-delete/item-delete.component.ts index 4e09a0b9ea9..c54ca32a533 100644 --- a/src/app/item-page/edit-item-page/item-delete/item-delete.component.ts +++ b/src/app/item-page/edit-item-page/item-delete/item-delete.component.ts @@ -56,7 +56,7 @@ import { getRemoteDataPayload, } from '../../../core/shared/operators'; import { ViewMode } from '../../../core/shared/view-mode.model'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { hasValue, isNotEmpty, @@ -110,7 +110,7 @@ class RelationshipDTO { VarDirective, NgForOf, RouterLink, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/item-page/edit-item-page/item-move/item-move.component.html b/src/app/item-page/edit-item-page/item-move/item-move.component.html index 0812c36f2d9..63378f5afe2 100644 --- a/src/app/item-page/edit-item-page/item-move/item-move.component.html +++ b/src/app/item-page/edit-item-page/item-move/item-move.component.html @@ -40,7 +40,7 @@

{{'item.edit.move.head' | translate: {id: (itemRD$ | async)?.payload?.handle - -

diff --git a/src/app/item-page/edit-item-page/item-move/item-move.component.ts b/src/app/item-page/edit-item-page/item-move/item-move.component.ts index 5e2d355bba0..07098aab11b 100644 --- a/src/app/item-page/edit-item-page/item-move/item-move.component.ts +++ b/src/app/item-page/edit-item-page/item-move/item-move.component.ts @@ -37,7 +37,7 @@ import { getRemoteDataPayload, } from '../../../core/shared/operators'; import { SearchService } from '../../../core/shared/search/search.service'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { AuthorizedCollectionSelectorComponent } from '../../../shared/dso-selector/dso-selector/authorized-collection-selector/authorized-collection-selector.component'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { followLink } from '../../../shared/utils/follow-link-config.model'; @@ -57,7 +57,7 @@ import { AsyncPipe, AuthorizedCollectionSelectorComponent, NgIf, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/item-page/edit-item-page/item-operation/item-operation.component.html b/src/app/item-page/edit-item-page/item-operation/item-operation.component.html index 88acec3171f..75f0736bbc7 100644 --- a/src/app/item-page/edit-item-page/item-operation/item-operation.component.html +++ b/src/app/item-page/edit-item-page/item-operation/item-operation.component.html @@ -5,12 +5,12 @@
- - diff --git a/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts b/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts index 42765f4d748..85ad62de938 100644 --- a/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts +++ b/src/app/item-page/edit-item-page/item-operation/item-operation.component.spec.ts @@ -6,7 +6,7 @@ import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { ItemOperationComponent } from './item-operation.component'; import { ItemOperation } from './itemOperation.model'; @@ -18,7 +18,7 @@ describe('ItemOperationComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), ItemOperationComponent, DisabledDirective], + imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), ItemOperationComponent, BtnDisabledDirective], }).compileComponents(); })); diff --git a/src/app/item-page/edit-item-page/item-operation/item-operation.component.ts b/src/app/item-page/edit-item-page/item-operation/item-operation.component.ts index b82fb154bf5..7c3793cc571 100644 --- a/src/app/item-page/edit-item-page/item-operation/item-operation.component.ts +++ b/src/app/item-page/edit-item-page/item-operation/item-operation.component.ts @@ -7,7 +7,7 @@ import { RouterLink } from '@angular/router'; import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { ItemOperation } from './itemOperation.model'; @Component({ @@ -18,7 +18,7 @@ import { ItemOperation } from './itemOperation.model'; RouterLink, NgbTooltipModule, NgIf, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html index b0157cb9892..06e3a4ace7b 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.html @@ -1,6 +1,6 @@

{{relationshipMessageKey$ | async | translate}} - diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts index 1bc95291c76..79b57cee10b 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts @@ -65,7 +65,7 @@ import { getFirstSucceededRemoteDataPayload, getRemoteDataPayload, } from '../../../../core/shared/operators'; -import { DisabledDirective } from '../../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../shared/btn-disabled.directive'; import { hasNoValue, hasValue, @@ -101,7 +101,7 @@ import { EditRelationshipComponent } from '../edit-relationship/edit-relationshi TranslateModule, NgClass, ThemedLoadingComponent, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html b/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html index 169a171d3f2..8cd86d597b8 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.html @@ -9,12 +9,12 @@

- -
@@ -8,7 +8,7 @@ ngbDropdown *ngIf="(moreThanOne$ | async)"> - + +
@@ -66,6 +66,6 @@

{{ (labelPrefix + label + '.select' | translate) }}

- +
diff --git a/src/app/notifications/qa/project-entry-import-modal/project-entry-import-modal.component.ts b/src/app/notifications/qa/project-entry-import-modal/project-entry-import-modal.component.ts index 523e9afb7a4..4954a327474 100644 --- a/src/app/notifications/qa/project-entry-import-modal/project-entry-import-modal.component.ts +++ b/src/app/notifications/qa/project-entry-import-modal/project-entry-import-modal.component.ts @@ -30,7 +30,7 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model'; import { Item } from '../../../core/shared/item.model'; import { SearchService } from '../../../core/shared/search/search.service'; import { AlertComponent } from '../../../shared/alert/alert.component'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { hasValue, isNotEmpty, @@ -106,7 +106,7 @@ export interface QualityAssuranceEventData { styleUrls: ['./project-entry-import-modal.component.scss'], templateUrl: './project-entry-import-modal.component.html', standalone: true, - imports: [RouterLink, NgIf, FormsModule, ThemedLoadingComponent, ThemedSearchResultsComponent, AlertComponent, AsyncPipe, TranslateModule, DisabledDirective], + imports: [RouterLink, NgIf, FormsModule, ThemedLoadingComponent, ThemedSearchResultsComponent, AlertComponent, AsyncPipe, TranslateModule, BtnDisabledDirective], }) /** * Component to display a modal window for linking a project to an Quality Assurance event diff --git a/src/app/notifications/suggestion-actions/suggestion-actions.component.html b/src/app/notifications/suggestion-actions/suggestion-actions.component.html index e83d0a4123e..342919d4aee 100644 --- a/src/app/notifications/suggestion-actions/suggestion-actions.component.html +++ b/src/app/notifications/suggestion-actions/suggestion-actions.component.html @@ -21,7 +21,7 @@ - diff --git a/src/app/process-page/overview/process-overview.component.ts b/src/app/process-page/overview/process-overview.component.ts index 09bc00d6f13..47efe888bf1 100644 --- a/src/app/process-page/overview/process-overview.component.ts +++ b/src/app/process-page/overview/process-overview.component.ts @@ -16,7 +16,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { Subscription } from 'rxjs'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { hasValue } from '../../shared/empty.util'; import { PaginationComponent } from '../../shared/pagination/pagination.component'; import { VarDirective } from '../../shared/utils/var.directive'; @@ -32,7 +32,7 @@ import { ProcessOverviewTableComponent } from './table/process-overview-table.co selector: 'ds-process-overview', templateUrl: './process-overview.component.html', standalone: true, - imports: [NgIf, RouterLink, PaginationComponent, NgFor, VarDirective, AsyncPipe, DatePipe, TranslateModule, NgTemplateOutlet, ProcessOverviewTableComponent, DisabledDirective], + imports: [NgIf, RouterLink, PaginationComponent, NgFor, VarDirective, AsyncPipe, DatePipe, TranslateModule, NgTemplateOutlet, ProcessOverviewTableComponent, BtnDisabledDirective], }) /** * Component displaying a list of all processes in a paginated table diff --git a/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.html b/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.html index a118cd680d0..3233aa55550 100644 --- a/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.html +++ b/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.html @@ -29,7 +29,7 @@ {{ 'dso-selector.claim.item.not-mine-label' | translate }} - diff --git a/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.ts b/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.ts index 53a013e7d39..7730b1e4dd8 100644 --- a/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.ts +++ b/src/app/profile-page/profile-claim-item-modal/profile-claim-item-modal.component.ts @@ -25,7 +25,7 @@ import { Item } from '../../core/shared/item.model'; import { getFirstCompletedRemoteData } from '../../core/shared/operators'; import { ViewMode } from '../../core/shared/view-mode.model'; import { getItemPageRoute } from '../../item-page/item-page-routing-paths'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { DSOSelectorModalWrapperComponent } from '../../shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component'; import { CollectionElementLinkType } from '../../shared/object-collection/collection-element-link.type'; import { ListableObjectComponentLoaderComponent } from '../../shared/object-collection/shared/listable-object/listable-object-component-loader.component'; @@ -43,7 +43,7 @@ import { ProfileClaimService } from '../profile-claim/profile-claim.service'; AsyncPipe, TranslateModule, NgForOf, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.html b/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.html index 2a2b356b313..d0279d9c5ff 100644 --- a/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.html +++ b/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.html @@ -13,7 +13,7 @@

{{'researcher.profile.not.associated' | translate}}

- - - diff --git a/src/app/register-email-form/register-email-form.component.ts b/src/app/register-email-form/register-email-form.component.ts index 302c6bc9c5a..37ce725778e 100644 --- a/src/app/register-email-form/register-email-form.component.ts +++ b/src/app/register-email-form/register-email-form.component.ts @@ -55,7 +55,7 @@ import { Registration } from '../core/shared/registration.model'; import { AlertComponent } from '../shared/alert/alert.component'; import { AlertType } from '../shared/alert/alert-type'; import { KlaroService } from '../shared/cookies/klaro.service'; -import { DisabledDirective } from '../shared/disabled-directive'; +import { BtnDisabledDirective } from '../shared/btn-disabled.directive'; import { isNotEmpty } from '../shared/empty.util'; import { GoogleRecaptchaComponent } from '../shared/google-recaptcha/google-recaptcha.component'; import { NotificationsService } from '../shared/notifications/notifications.service'; @@ -67,7 +67,7 @@ export const TYPE_REQUEST_REGISTER = 'register'; selector: 'ds-base-register-email-form', templateUrl: './register-email-form.component.html', standalone: true, - imports: [NgIf, FormsModule, ReactiveFormsModule, AlertComponent, GoogleRecaptchaComponent, AsyncPipe, TranslateModule, DisabledDirective], + imports: [NgIf, FormsModule, ReactiveFormsModule, AlertComponent, GoogleRecaptchaComponent, AsyncPipe, TranslateModule, BtnDisabledDirective], }) /** * Component responsible to render an email registration form. diff --git a/src/app/register-page/create-profile/create-profile.component.html b/src/app/register-page/create-profile/create-profile.component.html index dbdb006785e..e5cf6c3e2e2 100644 --- a/src/app/register-page/create-profile/create-profile.component.html +++ b/src/app/register-page/create-profile/create-profile.component.html @@ -81,7 +81,7 @@

{{'register-page.create-profile.header' | translate}}

diff --git a/src/app/register-page/create-profile/create-profile.component.ts b/src/app/register-page/create-profile/create-profile.component.ts index 1ec95c8f52e..43ee0c8cd39 100644 --- a/src/app/register-page/create-profile/create-profile.component.ts +++ b/src/app/register-page/create-profile/create-profile.component.ts @@ -43,7 +43,7 @@ import { } from '../../core/shared/operators'; import { Registration } from '../../core/shared/registration.model'; import { ProfilePageSecurityFormComponent } from '../../profile-page/profile-page-security-form/profile-page-security-form.component'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { isEmpty } from '../../shared/empty.util'; import { NotificationsService } from '../../shared/notifications/notifications.service'; @@ -61,7 +61,7 @@ import { NotificationsService } from '../../shared/notifications/notifications.s AsyncPipe, ReactiveFormsModule, NgForOf, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/request-copy/email-request-copy/email-request-copy.component.html b/src/app/request-copy/email-request-copy/email-request-copy.component.html index 815a9a96916..b2227bfbaee 100644 --- a/src/app/request-copy/email-request-copy/email-request-copy.component.html +++ b/src/app/request-copy/email-request-copy/email-request-copy.component.html @@ -13,7 +13,7 @@
@@ -76,7 +76,7 @@
@@ -93,7 +93,7 @@ @@ -103,7 +103,7 @@ diff --git a/src/app/shared/access-control-form-container/access-control-form-container.component.ts b/src/app/shared/access-control-form-container/access-control-form-container.component.ts index 11313dfc99c..46895b8532b 100644 --- a/src/app/shared/access-control-form-container/access-control-form-container.component.ts +++ b/src/app/shared/access-control-form-container/access-control-form-container.component.ts @@ -31,7 +31,7 @@ import { Item } from '../../core/shared/item.model'; import { getFirstCompletedRemoteData } from '../../core/shared/operators'; import { AlertComponent } from '../alert/alert.component'; import { AlertType } from '../alert/alert-type'; -import { DisabledDirective } from '../disabled-directive'; +import { BtnDisabledDirective } from '../btn-disabled.directive'; import { SelectableListService } from '../object-list/selectable-list/selectable-list.service'; import { AccessControlArrayFormComponent } from './access-control-array-form/access-control-array-form.component'; import { createAccessControlInitialFormState } from './access-control-form-container-intial-state'; @@ -47,7 +47,7 @@ import { styleUrls: ['./access-control-form-container.component.scss'], exportAs: 'dsAccessControlForm', standalone: true, - imports: [NgIf, AlertComponent, UiSwitchModule, FormsModule, AccessControlArrayFormComponent, AsyncPipe, TranslateModule, DisabledDirective], + imports: [NgIf, AlertComponent, UiSwitchModule, FormsModule, AccessControlArrayFormComponent, AsyncPipe, TranslateModule, BtnDisabledDirective], }) export class AccessControlFormContainerComponent implements OnDestroy { diff --git a/src/app/shared/disabled-directive.ts b/src/app/shared/btn-disabled.directive.ts similarity index 96% rename from src/app/shared/disabled-directive.ts rename to src/app/shared/btn-disabled.directive.ts index 3563afbaf18..f73422a9d5d 100644 --- a/src/app/shared/disabled-directive.ts +++ b/src/app/shared/btn-disabled.directive.ts @@ -6,7 +6,7 @@ import { } from '@angular/core'; @Directive({ - selector: '[dsDisabled]', + selector: '[dsBtnDisabled]', standalone: true, }) @@ -16,7 +16,7 @@ import { * * This directive should always be used instead of the HTML disabled attribute as it is more accessible. */ -export class DisabledDirective { +export class BtnDisabledDirective { @Input() set dsDisabled(value: boolean) { this.isDisabled = !!value; diff --git a/src/app/shared/disabled-directive.spec.ts b/src/app/shared/disabled-directive.spec.ts index 0443ca84dd2..96f760fc466 100644 --- a/src/app/shared/disabled-directive.spec.ts +++ b/src/app/shared/disabled-directive.spec.ts @@ -8,11 +8,11 @@ import { } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { DisabledDirective } from './disabled-directive'; +import { BtnDisabledDirective } from './btn-disabled.directive'; @Component({ template: ` - + `, }) class TestComponent { @@ -26,7 +26,7 @@ describe('DisabledDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [DisabledDirective], + imports: [BtnDisabledDirective], declarations: [TestComponent], }); fixture = TestBed.createComponent(TestComponent); diff --git a/src/app/shared/ds-select/ds-select.component.html b/src/app/shared/ds-select/ds-select.component.html index de53ef07921..e87b7c5cc6c 100644 --- a/src/app/shared/ds-select/ds-select.component.html +++ b/src/app/shared/ds-select/ds-select.component.html @@ -13,7 +13,7 @@ class="btn btn-outline-primary selection" (blur)="close.emit($event)" (click)="close.emit($event)" - [dsDisabled]="disabled" + [dsBtnDisabled]="disabled" ngbDropdownToggle> diff --git a/src/app/shared/ds-select/ds-select.component.ts b/src/app/shared/ds-select/ds-select.component.ts index c7a8fafa723..2616ce4a9fc 100644 --- a/src/app/shared/ds-select/ds-select.component.ts +++ b/src/app/shared/ds-select/ds-select.component.ts @@ -8,7 +8,7 @@ import { import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; -import { DisabledDirective } from '../disabled-directive'; +import { BtnDisabledDirective } from '../btn-disabled.directive'; /** * Component which represent a DSpace dropdown selector. @@ -18,7 +18,7 @@ import { DisabledDirective } from '../disabled-directive'; templateUrl: './ds-select.component.html', styleUrls: ['./ds-select.component.scss'], standalone: true, - imports: [NgbDropdownModule, NgIf, TranslateModule, DisabledDirective], + imports: [NgbDropdownModule, NgIf, TranslateModule, BtnDisabledDirective], }) export class DsSelectComponent { diff --git a/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html b/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html index 747d14cac6a..05032813296 100644 --- a/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html +++ b/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.html @@ -1,7 +1,7 @@
-
    diff --git a/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.ts b/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.ts index d2ed04641e1..fadaee8b22f 100644 --- a/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.ts +++ b/src/app/shared/dso-page/dso-edit-menu/dso-edit-expandable-menu-section/dso-edit-menu-expandable-section.component.ts @@ -22,7 +22,7 @@ import { MenuID } from 'src/app/shared/menu/menu-id.model'; import { MenuSection } from 'src/app/shared/menu/menu-section.model'; import { MenuSectionComponent } from 'src/app/shared/menu/menu-section/menu-section.component'; -import { DisabledDirective } from '../../../disabled-directive'; +import { BtnDisabledDirective } from '../../../btn-disabled.directive'; import { hasValue } from '../../../empty.util'; import { MenuService } from '../../../menu/menu.service'; @@ -34,7 +34,7 @@ import { MenuService } from '../../../menu/menu.service'; templateUrl: './dso-edit-menu-expandable-section.component.html', styleUrls: ['./dso-edit-menu-expandable-section.component.scss'], standalone: true, - imports: [NgbDropdownModule, NgbTooltipModule, NgFor, NgIf, NgComponentOutlet, TranslateModule, AsyncPipe, DisabledDirective], + imports: [NgbDropdownModule, NgbTooltipModule, NgFor, NgIf, NgComponentOutlet, TranslateModule, AsyncPipe, BtnDisabledDirective], }) export class DsoEditMenuExpandableSectionComponent extends MenuSectionComponent implements OnInit { diff --git a/src/app/shared/dso-page/dso-edit-menu/dso-edit-menu-section/dso-edit-menu-section.component.html b/src/app/shared/dso-page/dso-edit-menu/dso-edit-menu-section/dso-edit-menu-section.component.html index 9f796c35cec..0738e2f28ab 100644 --- a/src/app/shared/dso-page/dso-edit-menu/dso-edit-menu-section/dso-edit-menu-section.component.html +++ b/src/app/shared/dso-page/dso-edit-menu/dso-edit-menu-section/dso-edit-menu-section.component.html @@ -5,7 +5,7 @@ {{itemModel.text | translate}} - @@ -13,7 +13,7 @@
    - @@ -60,7 +60,7 @@ type="button" ngbTooltip="{{'form.clear-help' | translate}}" placement="top" - [dsDisabled]="model.readOnly" + [dsBtnDisabled]="model.readOnly" (click)="remove()">{{'form.clear' | translate}}
    @@ -69,14 +69,14 @@ type="button" ngbTooltip="{{'form.edit-help' | translate}}" placement="top" - [dsDisabled]="isEditDisabled()" + [dsBtnDisabled]="isEditDisabled()" (click)="switchEditMode()">{{'form.edit' | translate}}
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts index 77de7953f11..493c56e29d6 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts @@ -33,7 +33,7 @@ import { of as observableOf } from 'rxjs'; import { VocabularyEntry } from '../../../../../../core/submission/vocabularies/models/vocabulary-entry.model'; import { VocabularyOptions } from '../../../../../../core/submission/vocabularies/models/vocabulary-options.model'; import { VocabularyService } from '../../../../../../core/submission/vocabularies/vocabulary.service'; -import { DisabledDirective } from '../../../../../disabled-directive'; +import { BtnDisabledDirective } from '../../../../../btn-disabled.directive'; import { mockDynamicFormLayoutService, mockDynamicFormValidationService, @@ -175,7 +175,7 @@ describe('Dynamic Lookup component', () => { TestComponent, AuthorityConfidenceStateDirective, ObjNgFor, - DisabledDirective, + BtnDisabledDirective, ], providers: [ ChangeDetectorRef, diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.ts index b16ec0e5376..39c39cf8bc6 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.ts @@ -46,7 +46,7 @@ import { getFirstSucceededRemoteDataPayload } from '../../../../../../core/share import { PageInfo } from '../../../../../../core/shared/page-info.model'; import { VocabularyEntry } from '../../../../../../core/submission/vocabularies/models/vocabulary-entry.model'; import { VocabularyService } from '../../../../../../core/submission/vocabularies/vocabulary.service'; -import { DisabledDirective } from '../../../../../disabled-directive'; +import { BtnDisabledDirective } from '../../../../../btn-disabled.directive'; import { hasValue, isEmpty, @@ -77,7 +77,7 @@ import { DynamicLookupNameModel } from './dynamic-lookup-name.model'; NgForOf, NgTemplateOutlet, ObjNgFor, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.ts index 055e5c9c190..de6b50d589b 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.ts @@ -59,7 +59,7 @@ import { Vocabulary } from '../../../../../../core/submission/vocabularies/model import { VocabularyEntry } from '../../../../../../core/submission/vocabularies/models/vocabulary-entry.model'; import { VocabularyEntryDetail } from '../../../../../../core/submission/vocabularies/models/vocabulary-entry-detail.model'; import { VocabularyService } from '../../../../../../core/submission/vocabularies/vocabulary.service'; -import { DisabledDirective } from '../../../../../disabled-directive'; +import { BtnDisabledDirective } from '../../../../../btn-disabled.directive'; import { hasValue, isEmpty, @@ -91,7 +91,7 @@ import { DynamicOneboxModel } from './dynamic-onebox.model'; ObjNgFor, NgForOf, FormsModule, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.html index bad0f1ab91b..1cb8ee1e1a2 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.component.html @@ -32,21 +32,21 @@ @@ -73,18 +73,18 @@
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts index 89504ccdfc4..c666baf21fe 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts @@ -38,7 +38,7 @@ import { } from '../../../../../../../core/shared/operators'; import { SubmissionImportExternalCollectionComponent } from '../../../../../../../submission/import-external/import-external-collection/submission-import-external-collection.component'; import { CollectionListEntry } from '../../../../../../collection-dropdown/collection-dropdown.component'; -import { DisabledDirective } from '../../../../../../disabled-directive'; +import { BtnDisabledDirective } from '../../../../../../btn-disabled.directive'; import { NotificationsService } from '../../../../../../notifications/notifications.service'; import { CollectionElementLinkType } from '../../../../../../object-collection/collection-element-link.type'; import { ItemSearchResult } from '../../../../../../object-collection/shared/item-search-result.model'; @@ -70,7 +70,7 @@ export enum ImportType { ThemedSearchResultsComponent, NgIf, AsyncPipe, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/shared/form/form.component.html b/src/app/shared/form/form.component.html index 92b0e055526..85e32e66ea8 100644 --- a/src/app/shared/form/form.component.html +++ b/src/app/shared/form/form.component.html @@ -41,7 +41,7 @@ title="{{'form.discard' | translate}}" attr.aria-label="{{'form.discard' | translate}}" (click)="removeItem($event, context, index)" - [dsDisabled]="group.context.groups.length === 1 || isItemReadOnly(context, index)"> + [dsBtnDisabled]="group.context.groups.length === 1 || isItemReadOnly(context, index)"> {{'form.discard' | translate}}
@@ -62,7 +62,7 @@ diff --git a/src/app/shared/form/form.component.ts b/src/app/shared/form/form.component.ts index d96f16044a4..a757239aea1 100644 --- a/src/app/shared/form/form.component.ts +++ b/src/app/shared/form/form.component.ts @@ -39,7 +39,7 @@ import { map, } from 'rxjs/operators'; -import { DisabledDirective } from '../disabled-directive'; +import { BtnDisabledDirective } from '../btn-disabled.directive'; import { hasValue, isNotEmpty, @@ -70,7 +70,7 @@ import { FormService } from './form.service'; DynamicFormsCoreModule, NgIf, AsyncPipe, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/shared/form/number-picker/number-picker.component.html b/src/app/shared/form/number-picker/number-picker.component.html index 8f2a875685b..9b9d038e868 100644 --- a/src/app/shared/form/number-picker/number-picker.component.html +++ b/src/app/shared/form/number-picker/number-picker.component.html @@ -3,7 +3,7 @@ class="btn btn-link-focus" type="button" tabindex="0" - [dsDisabled]="disabled" + [dsBtnDisabled]="disabled" (click)="toggleUp()"> {{'form.number-picker.increment' | translate: {field: name} }} @@ -30,7 +30,7 @@ class="btn btn-link-focus" type="button" tabindex="0" - [dsDisabled]="disabled" + [dsBtnDisabled]="disabled" (click)="toggleDown()"> {{'form.number-picker.decrement' | translate: {field: name} }} diff --git a/src/app/shared/form/number-picker/number-picker.component.ts b/src/app/shared/form/number-picker/number-picker.component.ts index 70ad4846800..ef35e1ee796 100644 --- a/src/app/shared/form/number-picker/number-picker.component.ts +++ b/src/app/shared/form/number-picker/number-picker.component.ts @@ -20,7 +20,7 @@ import { TranslateService, } from '@ngx-translate/core'; -import { DisabledDirective } from '../../disabled-directive'; +import { BtnDisabledDirective } from '../../btn-disabled.directive'; import { isEmpty } from '../../empty.util'; @Component({ @@ -34,7 +34,7 @@ import { isEmpty } from '../../empty.util'; NgClass, FormsModule, TranslateModule, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html index 4dc683fae80..c249dc850c6 100644 --- a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html +++ b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html @@ -6,7 +6,7 @@ [attr.aria-label]="'vocabulary-treeview.search.form.search-placeholder' | translate" [placeholder]="'vocabulary-treeview.search.form.search-placeholder' | translate">
- -
@@ -49,7 +49,7 @@

{{ (message | async) | translate }} + [dsBtnDisabled]="!form.valid"> {{"login.form.submit" | translate}} diff --git a/src/app/shared/log-in/methods/password/log-in-password.component.ts b/src/app/shared/log-in/methods/password/log-in-password.component.ts index 84d618cb79a..25ec0cba740 100644 --- a/src/app/shared/log-in/methods/password/log-in-password.component.ts +++ b/src/app/shared/log-in/methods/password/log-in-password.component.ts @@ -49,7 +49,7 @@ import { AuthorizationDataService } from '../../../../core/data/feature-authoriz import { FeatureID } from '../../../../core/data/feature-authorization/feature-id'; import { HardRedirectService } from '../../../../core/services/hard-redirect.service'; import { fadeOut } from '../../../animations/fade'; -import { DisabledDirective } from '../../../disabled-directive'; +import { BtnDisabledDirective } from '../../../btn-disabled.directive'; import { isNotEmpty } from '../../../empty.util'; import { BrowserOnlyPipe } from '../../../utils/browser-only.pipe'; @@ -63,7 +63,7 @@ import { BrowserOnlyPipe } from '../../../utils/browser-only.pipe'; styleUrls: ['./log-in-password.component.scss'], animations: [fadeOut], standalone: true, - imports: [FormsModule, ReactiveFormsModule, NgIf, RouterLink, AsyncPipe, TranslateModule, BrowserOnlyPipe, DisabledDirective], + imports: [FormsModule, ReactiveFormsModule, NgIf, RouterLink, AsyncPipe, TranslateModule, BrowserOnlyPipe, BtnDisabledDirective], }) export class LogInPasswordComponent implements OnInit { diff --git a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.html b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.html index a672763a863..affbec108cb 100644 --- a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.html +++ b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.html @@ -1,7 +1,7 @@ diff --git a/src/app/shared/object-select/collection-select/collection-select.component.ts b/src/app/shared/object-select/collection-select/collection-select.component.ts index c2111927dc9..1d1b8ed06be 100644 --- a/src/app/shared/object-select/collection-select/collection-select.component.ts +++ b/src/app/shared/object-select/collection-select/collection-select.component.ts @@ -20,7 +20,7 @@ import { getCollectionPageRoute } from '../../../collection-page/collection-page import { PaginatedList } from '../../../core/data/paginated-list.model'; import { Collection } from '../../../core/shared/collection.model'; import { getAllSucceededRemoteDataPayload } from '../../../core/shared/operators'; -import { DisabledDirective } from '../../disabled-directive'; +import { BtnDisabledDirective } from '../../btn-disabled.directive'; import { hasValueOperator, isNotEmpty, @@ -37,7 +37,7 @@ import { ObjectSelectComponent } from '../object-select/object-select.component' templateUrl: './collection-select.component.html', styleUrls: ['./collection-select.component.scss'], standalone: true, - imports: [VarDirective, NgIf, PaginationComponent, NgFor, FormsModule, RouterLink, ErrorComponent, ThemedLoadingComponent, NgClass, AsyncPipe, TranslateModule, DisabledDirective], + imports: [VarDirective, NgIf, PaginationComponent, NgFor, FormsModule, RouterLink, ErrorComponent, ThemedLoadingComponent, NgClass, AsyncPipe, TranslateModule, BtnDisabledDirective], }) /** diff --git a/src/app/shared/object-select/item-select/item-select.component.html b/src/app/shared/object-select/item-select/item-select.component.html index c74fe26afdc..6f3d31703d1 100644 --- a/src/app/shared/object-select/item-select/item-select.component.html +++ b/src/app/shared/object-select/item-select/item-select.component.html @@ -42,7 +42,7 @@ diff --git a/src/app/shared/object-select/item-select/item-select.component.spec.ts b/src/app/shared/object-select/item-select/item-select.component.spec.ts index 7aa6c7a6393..656e0716e94 100644 --- a/src/app/shared/object-select/item-select/item-select.component.spec.ts +++ b/src/app/shared/object-select/item-select/item-select.component.spec.ts @@ -18,7 +18,7 @@ import { LinkHeadService } from '../../../core/services/link-head.service'; import { ConfigurationProperty } from '../../../core/shared/configuration-property.model'; import { Item } from '../../../core/shared/item.model'; import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service'; -import { DisabledDirective } from '../../disabled-directive'; +import { BtnDisabledDirective } from '../../btn-disabled.directive'; import { HostWindowService } from '../../host-window.service'; import { PaginationComponentOptions } from '../../pagination/pagination-component-options.model'; import { createSuccessfulRemoteDataObject$ } from '../../remote-data.utils'; @@ -102,7 +102,7 @@ describe('ItemSelectComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), DisabledDirective], + imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), BtnDisabledDirective], providers: [ { provide: ObjectSelectService, useValue: new ObjectSelectServiceStub([mockItemList[1].id]) }, { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, diff --git a/src/app/shared/object-select/item-select/item-select.component.ts b/src/app/shared/object-select/item-select/item-select.component.ts index a44627c622f..2267a656862 100644 --- a/src/app/shared/object-select/item-select/item-select.component.ts +++ b/src/app/shared/object-select/item-select/item-select.component.ts @@ -19,7 +19,7 @@ import { PaginatedList } from '../../../core/data/paginated-list.model'; import { Item } from '../../../core/shared/item.model'; import { getAllSucceededRemoteDataPayload } from '../../../core/shared/operators'; import { getItemPageRoute } from '../../../item-page/item-page-routing-paths'; -import { DisabledDirective } from '../../disabled-directive'; +import { BtnDisabledDirective } from '../../btn-disabled.directive'; import { hasValueOperator, isNotEmpty, @@ -35,7 +35,7 @@ import { ObjectSelectComponent } from '../object-select/object-select.component' selector: 'ds-item-select', templateUrl: './item-select.component.html', standalone: true, - imports: [VarDirective, NgIf, PaginationComponent, NgFor, FormsModule, RouterLink, ErrorComponent, ThemedLoadingComponent, NgClass, AsyncPipe, TranslateModule, DisabledDirective], + imports: [VarDirective, NgIf, PaginationComponent, NgFor, FormsModule, RouterLink, ErrorComponent, ThemedLoadingComponent, NgClass, AsyncPipe, TranslateModule, BtnDisabledDirective], }) /** diff --git a/src/app/shared/pagination/pagination.component.html b/src/app/shared/pagination/pagination.component.html index 2ce7f34166d..9dd093be2b1 100644 --- a/src/app/shared/pagination/pagination.component.html +++ b/src/app/shared/pagination/pagination.component.html @@ -55,12 +55,12 @@
diff --git a/src/app/shared/search/advanced-search/advanced-search.component.ts b/src/app/shared/search/advanced-search/advanced-search.component.ts index dfc934ad9c1..99eaa23a0d7 100644 --- a/src/app/shared/search/advanced-search/advanced-search.component.ts +++ b/src/app/shared/search/advanced-search/advanced-search.component.ts @@ -31,7 +31,7 @@ import { SearchService } from '../../../core/shared/search/search.service'; import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service'; import { SearchFilterService } from '../../../core/shared/search/search-filter.service'; import { FilterConfig } from '../../../core/shared/search/search-filters/search-config.model'; -import { DisabledDirective } from '../../disabled-directive'; +import { BtnDisabledDirective } from '../../btn-disabled.directive'; import { hasValue, isNotEmpty, @@ -56,7 +56,7 @@ import { SearchFilterConfig } from '../models/search-filter-config.model'; KeyValuePipe, NgForOf, TranslateModule, - DisabledDirective, + BtnDisabledDirective, ], }) export class AdvancedSearchComponent implements OnInit, OnDestroy { diff --git a/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.html b/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.html index f44dc2ce3f7..37a7a3f431d 100644 --- a/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.html +++ b/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.html @@ -34,7 +34,7 @@ (click)="activeModal.close()"> {{'subscriptions.modal.close' | translate}} - diff --git a/src/app/shared/upload/uploader/uploader.component.ts b/src/app/shared/upload/uploader/uploader.component.ts index ec66981f168..fbafe811ebc 100644 --- a/src/app/shared/upload/uploader/uploader.component.ts +++ b/src/app/shared/upload/uploader/uploader.component.ts @@ -27,7 +27,7 @@ import { XSRF_REQUEST_HEADER, XSRF_RESPONSE_HEADER, } from '../../../core/xsrf/xsrf.constants'; -import { DisabledDirective } from '../../disabled-directive'; +import { BtnDisabledDirective } from '../../btn-disabled.directive'; import { hasValue, isNotEmpty, @@ -43,7 +43,7 @@ import { UploaderProperties } from './uploader-properties.model'; changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.Emulated, standalone: true, - imports: [TranslateModule, FileUploadModule, CommonModule, DisabledDirective], + imports: [TranslateModule, FileUploadModule, CommonModule, BtnDisabledDirective], }) export class UploaderComponent implements OnInit, AfterViewInit { diff --git a/src/app/submission/form/collection/submission-form-collection.component.html b/src/app/submission/form/collection/submission-form-collection.component.html index 2af47497b25..db33afc76ac 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.html +++ b/src/app/submission/form/collection/submission-form-collection.component.html @@ -25,7 +25,7 @@ class="btn btn-outline-primary" (blur)="onClose()" (click)="onClose()" - [dsDisabled]="(processingChange$ | async) || collectionModifiable === false || isReadonly" + [dsBtnDisabled]="(processingChange$ | async) || collectionModifiable === false || isReadonly" ngbDropdownToggle> {{ selectedCollectionName$ | async }} diff --git a/src/app/submission/form/collection/submission-form-collection.component.spec.ts b/src/app/submission/form/collection/submission-form-collection.component.spec.ts index 9ff048a626d..61bad0439f0 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.spec.ts +++ b/src/app/submission/form/collection/submission-form-collection.component.spec.ts @@ -31,7 +31,7 @@ import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/jso import { Collection } from '../../../core/shared/collection.model'; import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service'; import { ThemedCollectionDropdownComponent } from '../../../shared/collection-dropdown/themed-collection-dropdown.component'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { DSONameServiceMock } from '../../../shared/mocks/dso-name.service.mock'; import { mockSubmissionId, @@ -153,7 +153,7 @@ describe('SubmissionFormCollectionComponent Component', () => { TranslateModule.forRoot(), SubmissionFormCollectionComponent, TestComponent, - DisabledDirective, + BtnDisabledDirective, ], providers: [ { provide: DSONameService, useValue: new DSONameServiceMock() }, diff --git a/src/app/submission/form/collection/submission-form-collection.component.ts b/src/app/submission/form/collection/submission-form-collection.component.ts index 7e574a00d51..10b1f815dc4 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.ts +++ b/src/app/submission/form/collection/submission-form-collection.component.ts @@ -36,7 +36,7 @@ import { SubmissionObject } from '../../../core/submission/models/submission-obj import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service'; import { CollectionDropdownComponent } from '../../../shared/collection-dropdown/collection-dropdown.component'; import { ThemedCollectionDropdownComponent } from '../../../shared/collection-dropdown/themed-collection-dropdown.component'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { hasValue, isNotEmpty, @@ -58,7 +58,7 @@ import { SubmissionService } from '../../submission.service'; TranslateModule, NgbDropdownModule, ThemedCollectionDropdownComponent, - DisabledDirective, + BtnDisabledDirective, ], }) export class SubmissionFormCollectionComponent implements OnDestroy, OnChanges, OnInit { diff --git a/src/app/submission/form/footer/submission-form-footer.component.html b/src/app/submission/form/footer/submission-form-footer.component.html index 4d3e76ff519..c860fb557b2 100644 --- a/src/app/submission/form/footer/submission-form-footer.component.html +++ b/src/app/submission/form/footer/submission-form-footer.component.html @@ -5,7 +5,7 @@ id="discard" [attr.data-test]="'discard' | dsBrowserOnly" class="btn btn-danger" - [dsDisabled]="(processingSaveStatus | async) || (processingDepositStatus | async)" + [dsBtnDisabled]="(processingSaveStatus | async) || (processingDepositStatus | async)" (click)="$event.preventDefault();confirmDiscard(content)"> {{'submission.general.discard.submit' | translate}} @@ -28,7 +28,7 @@ class="btn btn-secondary" id="save" [attr.data-test]="'save' | dsBrowserOnly" - [dsDisabled]="(processingSaveStatus | async) || (hasUnsavedModification | async) !== true" + [dsBtnDisabled]="(processingSaveStatus | async) || (hasUnsavedModification | async) !== true" (click)="save($event)"> {{'submission.general.save' | translate}} @@ -38,7 +38,7 @@ class="btn" id="saveForLater" [attr.data-test]="'save-for-later' | dsBrowserOnly" - [dsDisabled]="(processingSaveStatus | async) || (processingDepositStatus | async)" + [dsBtnDisabled]="(processingSaveStatus | async) || (processingDepositStatus | async)" (click)="saveLater($event)"> {{'submission.general.save-later' | translate}} @@ -47,7 +47,7 @@ id="deposit" [attr.data-test]="'deposit' | dsBrowserOnly" class="btn btn-success" - [dsDisabled]="(processingSaveStatus | async) || (processingDepositStatus | async)" + [dsBtnDisabled]="(processingSaveStatus | async) || (processingDepositStatus | async)" (click)="deposit($event)"> {{'submission.general.deposit' | translate}} diff --git a/src/app/submission/form/footer/submission-form-footer.component.spec.ts b/src/app/submission/form/footer/submission-form-footer.component.spec.ts index 3b36d56acac..82bc309cc81 100644 --- a/src/app/submission/form/footer/submission-form-footer.component.spec.ts +++ b/src/app/submission/form/footer/submission-form-footer.component.spec.ts @@ -25,7 +25,7 @@ import { of as observableOf } from 'rxjs'; import { TestScheduler } from 'rxjs/testing'; import { SubmissionRestService } from '../../../core/submission/submission-rest.service'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { mockSubmissionId } from '../../../shared/mocks/submission.mock'; import { SubmissionRestServiceStub } from '../../../shared/testing/submission-rest-service.stub'; import { SubmissionServiceStub } from '../../../shared/testing/submission-service.stub'; @@ -52,7 +52,7 @@ describe('SubmissionFormFooterComponent', () => { TranslateModule.forRoot(), SubmissionFormFooterComponent, TestComponent, - DisabledDirective, + BtnDisabledDirective, ], providers: [ { provide: SubmissionService, useValue: submissionServiceStub }, diff --git a/src/app/submission/form/footer/submission-form-footer.component.ts b/src/app/submission/form/footer/submission-form-footer.component.ts index adaf5c85ef6..8645003783c 100644 --- a/src/app/submission/form/footer/submission-form-footer.component.ts +++ b/src/app/submission/form/footer/submission-form-footer.component.ts @@ -15,7 +15,7 @@ import { map } from 'rxjs/operators'; import { SubmissionRestService } from '../../../core/submission/submission-rest.service'; import { SubmissionScopeType } from '../../../core/submission/submission-scope-type'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { isNotEmpty } from '../../../shared/empty.util'; import { BrowserOnlyPipe } from '../../../shared/utils/browser-only.pipe'; import { SubmissionService } from '../../submission.service'; @@ -28,7 +28,7 @@ import { SubmissionService } from '../../submission.service'; styleUrls: ['./submission-form-footer.component.scss'], templateUrl: './submission-form-footer.component.html', standalone: true, - imports: [CommonModule, BrowserOnlyPipe, TranslateModule, DisabledDirective], + imports: [CommonModule, BrowserOnlyPipe, TranslateModule, BtnDisabledDirective], }) export class SubmissionFormFooterComponent implements OnChanges { diff --git a/src/app/submission/form/section-add/submission-form-section-add.component.html b/src/app/submission/form/section-add/submission-form-section-add.component.html index c5f8d25fc2a..563044d270a 100644 --- a/src/app/submission/form/section-add/submission-form-section-add.component.html +++ b/src/app/submission/form/section-add/submission-form-section-add.component.html @@ -6,7 +6,7 @@ + diff --git a/src/app/submission/import-external/import-external-searchbar/submission-import-external-searchbar.component.ts b/src/app/submission/import-external/import-external-searchbar/submission-import-external-searchbar.component.ts index 7572d3ac8ba..eb7a703cc2d 100644 --- a/src/app/submission/import-external/import-external-searchbar/submission-import-external-searchbar.component.ts +++ b/src/app/submission/import-external/import-external-searchbar/submission-import-external-searchbar.component.ts @@ -36,7 +36,7 @@ import { getFirstSucceededRemoteDataPayload, } from '../../../core/shared/operators'; import { PageInfo } from '../../../core/shared/page-info.model'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { hasValue } from '../../../shared/empty.util'; import { HostWindowService } from '../../../shared/host-window.service'; import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils'; @@ -71,7 +71,7 @@ export interface ExternalSourceData { InfiniteScrollModule, NgbDropdownModule, FormsModule, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts index 62546e18352..7618de51734 100644 --- a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts +++ b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts @@ -40,7 +40,7 @@ import { import { WorkspaceitemSectionCcLicenseObject } from '../../../core/submission/models/workspaceitem-section-cc-license.model'; import { SubmissionCcLicenseDataService } from '../../../core/submission/submission-cc-license-data.service'; import { SubmissionCcLicenseUrlDataService } from '../../../core/submission/submission-cc-license-url-data.service'; -import { DisabledDirective } from '../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { DsSelectComponent } from '../../../shared/ds-select/ds-select.component'; import { isNotEmpty } from '../../../shared/empty.util'; import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component'; @@ -65,7 +65,7 @@ import { SectionsType } from '../sections-type'; VarDirective, NgForOf, DsSelectComponent, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.html b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.html index 91b89e84359..b03504c6beb 100644 --- a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.html +++ b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.html @@ -1,7 +1,7 @@
diff --git a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts index c7ba64e4b90..0a6c1bd44df 100644 --- a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts +++ b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts @@ -39,7 +39,7 @@ import { JsonPatchOperationsBuilder } from '../../../../../core/json-patch/build import { WorkspaceitemSectionUploadFileObject } from '../../../../../core/submission/models/workspaceitem-section-upload-file.model'; import { SubmissionJsonPatchOperationsService } from '../../../../../core/submission/submission-json-patch-operations.service'; import { dateToISOFormat } from '../../../../../shared/date.util'; -import { DisabledDirective } from '../../../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../../shared/btn-disabled.directive'; import { hasNoValue, hasValue, @@ -81,7 +81,7 @@ import { FormComponent, NgIf, TranslateModule, - DisabledDirective, + BtnDisabledDirective, ], standalone: true, }) diff --git a/src/app/submission/sections/upload/file/section-upload-file.component.html b/src/app/submission/sections/upload/file/section-upload-file.component.html index f8d6b9ca931..bfc09e86c18 100644 --- a/src/app/submission/sections/upload/file/section-upload-file.component.html +++ b/src/app/submission/sections/upload/file/section-upload-file.component.html @@ -35,7 +35,7 @@

{{fileName}} ({{fileData?.sizeBytes | dsFileSize}}) -

diff --git a/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.ts b/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.ts index b695bb47edd..ea1c0a55f0c 100644 --- a/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.ts +++ b/src/app/system-wide-alert/alert-form/system-wide-alert-form.component.ts @@ -43,7 +43,7 @@ import { RemoteData } from '../../core/data/remote-data'; import { RequestService } from '../../core/data/request.service'; import { SystemWideAlertDataService } from '../../core/data/system-wide-alert-data.service'; import { getFirstCompletedRemoteData } from '../../core/shared/operators'; -import { DisabledDirective } from '../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; import { hasValue, isNotEmpty, @@ -60,7 +60,7 @@ import { SystemWideAlert } from '../system-wide-alert.model'; styleUrls: ['./system-wide-alert-form.component.scss'], templateUrl: './system-wide-alert-form.component.html', standalone: true, - imports: [FormsModule, ReactiveFormsModule, UiSwitchModule, NgIf, NgbDatepickerModule, NgbTimepickerModule, AsyncPipe, TranslateModule, DisabledDirective], + imports: [FormsModule, ReactiveFormsModule, UiSwitchModule, NgIf, NgbDatepickerModule, NgbTimepickerModule, AsyncPipe, TranslateModule, BtnDisabledDirective], }) export class SystemWideAlertFormComponent implements OnInit { diff --git a/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts b/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts index e87a292c0ca..57e8c730316 100644 --- a/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts +++ b/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts @@ -45,7 +45,7 @@ import { Group } from '../../../../core/eperson/models/group.model'; import { PaginationService } from '../../../../core/pagination/pagination.service'; import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators'; import { ContextHelpDirective } from '../../../../shared/context-help.directive'; -import { DisabledDirective } from '../../../../shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../shared/btn-disabled.directive'; import { hasValue } from '../../../../shared/empty.util'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { PaginationComponent } from '../../../../shared/pagination/pagination.component'; @@ -77,7 +77,7 @@ enum SubKey { RouterLink, NgClass, NgForOf, - DisabledDirective, + BtnDisabledDirective, ], }) export class ReviewersListComponent extends MembersListComponent implements OnInit, OnChanges, OnDestroy { diff --git a/src/themes/custom/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts b/src/themes/custom/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts index 40a6264e4e2..f74a73a4b88 100644 --- a/src/themes/custom/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts +++ b/src/themes/custom/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts @@ -13,7 +13,7 @@ import { DsoEditMetadataValueComponent } from '../../../../../app/dso-shared/dso import { DsoEditMetadataValueHeadersComponent } from '../../../../../app/dso-shared/dso-edit-metadata/dso-edit-metadata-value-headers/dso-edit-metadata-value-headers.component'; import { MetadataFieldSelectorComponent } from '../../../../../app/dso-shared/dso-edit-metadata/metadata-field-selector/metadata-field-selector.component'; import { AlertComponent } from '../../../../../app/shared/alert/alert.component'; -import { DisabledDirective } from '../../../../../app/shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../../app/shared/btn-disabled.directive'; import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed-loading.component'; @Component({ @@ -23,7 +23,7 @@ import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed // templateUrl: './dso-edit-metadata.component.html', templateUrl: '../../../../../app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.html', standalone: true, - imports: [NgIf, DsoEditMetadataHeadersComponent, MetadataFieldSelectorComponent, DsoEditMetadataValueHeadersComponent, DsoEditMetadataValueComponent, NgFor, DsoEditMetadataFieldValuesComponent, AlertComponent, ThemedLoadingComponent, AsyncPipe, TranslateModule, DisabledDirective], + imports: [NgIf, DsoEditMetadataHeadersComponent, MetadataFieldSelectorComponent, DsoEditMetadataValueHeadersComponent, DsoEditMetadataValueComponent, NgFor, DsoEditMetadataFieldValuesComponent, AlertComponent, ThemedLoadingComponent, AsyncPipe, TranslateModule, BtnDisabledDirective], }) export class DsoEditMetadataComponent extends BaseComponent { } diff --git a/src/themes/custom/app/forgot-password/forgot-password-form/forgot-password-form.component.ts b/src/themes/custom/app/forgot-password/forgot-password-form/forgot-password-form.component.ts index ff64b096644..37fb3834294 100644 --- a/src/themes/custom/app/forgot-password/forgot-password-form/forgot-password-form.component.ts +++ b/src/themes/custom/app/forgot-password/forgot-password-form/forgot-password-form.component.ts @@ -7,7 +7,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { ForgotPasswordFormComponent as BaseComponent } from '../../../../../app/forgot-password/forgot-password-form/forgot-password-form.component'; import { ProfilePageSecurityFormComponent } from '../../../../../app/profile-page/profile-page-security-form/profile-page-security-form.component'; -import { DisabledDirective } from '../../../../../app/shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../../app/shared/btn-disabled.directive'; import { BrowserOnlyPipe } from '../../../../../app/shared/utils/browser-only.pipe'; @Component({ @@ -23,7 +23,7 @@ import { BrowserOnlyPipe } from '../../../../../app/shared/utils/browser-only.pi ProfilePageSecurityFormComponent, AsyncPipe, NgIf, - DisabledDirective, + BtnDisabledDirective, ], }) /** diff --git a/src/themes/custom/app/info/end-user-agreement/end-user-agreement.component.ts b/src/themes/custom/app/info/end-user-agreement/end-user-agreement.component.ts index e557fc466cc..2b78006f650 100644 --- a/src/themes/custom/app/info/end-user-agreement/end-user-agreement.component.ts +++ b/src/themes/custom/app/info/end-user-agreement/end-user-agreement.component.ts @@ -4,7 +4,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { EndUserAgreementComponent as BaseComponent } from '../../../../../app/info/end-user-agreement/end-user-agreement.component'; import { EndUserAgreementContentComponent } from '../../../../../app/info/end-user-agreement/end-user-agreement-content/end-user-agreement-content.component'; -import { DisabledDirective } from '../../../../../app/shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../../app/shared/btn-disabled.directive'; @Component({ selector: 'ds-themed-end-user-agreement', @@ -13,7 +13,7 @@ import { DisabledDirective } from '../../../../../app/shared/disabled-directive' // templateUrl: './end-user-agreement.component.html' templateUrl: '../../../../../app/info/end-user-agreement/end-user-agreement.component.html', standalone: true, - imports: [EndUserAgreementContentComponent, FormsModule, TranslateModule, DisabledDirective], + imports: [EndUserAgreementContentComponent, FormsModule, TranslateModule, BtnDisabledDirective], }) /** diff --git a/src/themes/custom/app/info/feedback/feedback-form/feedback-form.component.ts b/src/themes/custom/app/info/feedback/feedback-form/feedback-form.component.ts index b86fecae7a6..38356671118 100644 --- a/src/themes/custom/app/info/feedback/feedback-form/feedback-form.component.ts +++ b/src/themes/custom/app/info/feedback/feedback-form/feedback-form.component.ts @@ -7,7 +7,7 @@ import { import { TranslateModule } from '@ngx-translate/core'; import { FeedbackFormComponent as BaseComponent } from '../../../../../../app/info/feedback/feedback-form/feedback-form.component'; -import { DisabledDirective } from '../../../../../../app/shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../../../app/shared/btn-disabled.directive'; import { ErrorComponent } from '../../../../../../app/shared/error/error.component'; @Component({ @@ -17,7 +17,7 @@ import { ErrorComponent } from '../../../../../../app/shared/error/error.compone // styleUrls: ['./feedback-form.component.scss'], styleUrls: ['../../../../../../app/info/feedback/feedback-form/feedback-form.component.scss'], standalone: true, - imports: [FormsModule, ReactiveFormsModule, NgIf, ErrorComponent, TranslateModule, DisabledDirective], + imports: [FormsModule, ReactiveFormsModule, NgIf, ErrorComponent, TranslateModule, BtnDisabledDirective], }) export class FeedbackFormComponent extends BaseComponent { } diff --git a/src/themes/custom/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts b/src/themes/custom/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts index 020293214ef..0efa0130640 100644 --- a/src/themes/custom/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts +++ b/src/themes/custom/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts @@ -7,7 +7,7 @@ import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { MediaViewerVideoComponent as BaseComponent } from '../../../../../../app/item-page/media-viewer/media-viewer-video/media-viewer-video.component'; -import { DisabledDirective } from '../../../../../../app/shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../../../app/shared/btn-disabled.directive'; @Component({ selector: 'ds-themed-media-viewer-video', @@ -21,7 +21,7 @@ import { DisabledDirective } from '../../../../../../app/shared/disabled-directi NgbDropdownModule, TranslateModule, NgIf, - DisabledDirective, + BtnDisabledDirective, ], }) export class MediaViewerVideoComponent extends BaseComponent { diff --git a/src/themes/custom/app/register-email-form/register-email-form.component.ts b/src/themes/custom/app/register-email-form/register-email-form.component.ts index d9be35f39dc..d1f4a6d3ffe 100644 --- a/src/themes/custom/app/register-email-form/register-email-form.component.ts +++ b/src/themes/custom/app/register-email-form/register-email-form.component.ts @@ -12,14 +12,14 @@ import { AlertComponent } from 'src/app/shared/alert/alert.component'; import { GoogleRecaptchaComponent } from 'src/app/shared/google-recaptcha/google-recaptcha.component'; import { RegisterEmailFormComponent as BaseComponent } from '../../../../app/register-email-form/register-email-form.component'; -import { DisabledDirective } from '../../../../app/shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../app/shared/btn-disabled.directive'; @Component({ selector: 'ds-themed-register-email-form', // templateUrl: './register-email-form.component.html', templateUrl: '../../../../app/register-email-form/register-email-form.component.html', standalone: true, - imports: [NgIf, FormsModule, ReactiveFormsModule, AlertComponent, GoogleRecaptchaComponent, AsyncPipe, TranslateModule, DisabledDirective], + imports: [NgIf, FormsModule, ReactiveFormsModule, AlertComponent, GoogleRecaptchaComponent, AsyncPipe, TranslateModule, BtnDisabledDirective], }) export class RegisterEmailFormComponent extends BaseComponent { } diff --git a/src/themes/custom/app/register-page/create-profile/create-profile.component.ts b/src/themes/custom/app/register-page/create-profile/create-profile.component.ts index 659e260b1c2..7c1ff908c37 100644 --- a/src/themes/custom/app/register-page/create-profile/create-profile.component.ts +++ b/src/themes/custom/app/register-page/create-profile/create-profile.component.ts @@ -9,7 +9,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { ProfilePageSecurityFormComponent } from '../../../../../app/profile-page/profile-page-security-form/profile-page-security-form.component'; import { CreateProfileComponent as BaseComponent } from '../../../../../app/register-page/create-profile/create-profile.component'; -import { DisabledDirective } from '../../../../../app/shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../../app/shared/btn-disabled.directive'; /** * Component that renders the create profile page to be used by a user registering through a token @@ -28,7 +28,7 @@ import { DisabledDirective } from '../../../../../app/shared/disabled-directive' AsyncPipe, ReactiveFormsModule, NgForOf, - DisabledDirective, + BtnDisabledDirective, ], }) export class CreateProfileComponent extends BaseComponent { diff --git a/src/themes/custom/app/request-copy/email-request-copy/email-request-copy.component.ts b/src/themes/custom/app/request-copy/email-request-copy/email-request-copy.component.ts index a299e47a27b..cf4981d289b 100644 --- a/src/themes/custom/app/request-copy/email-request-copy/email-request-copy.component.ts +++ b/src/themes/custom/app/request-copy/email-request-copy/email-request-copy.component.ts @@ -7,7 +7,7 @@ import { FormsModule } from '@angular/forms'; import { TranslateModule } from '@ngx-translate/core'; import { EmailRequestCopyComponent as BaseComponent } from 'src/app/request-copy/email-request-copy/email-request-copy.component'; -import { DisabledDirective } from '../../../../../app/shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../../app/shared/btn-disabled.directive'; @Component({ selector: 'ds-themed-email-request-copy', @@ -16,7 +16,7 @@ import { DisabledDirective } from '../../../../../app/shared/disabled-directive' // templateUrl: './email-request-copy.component.html', templateUrl: './../../../../../app/request-copy/email-request-copy/email-request-copy.component.html', standalone: true, - imports: [FormsModule, NgClass, NgIf, TranslateModule, DisabledDirective], + imports: [FormsModule, NgClass, NgIf, TranslateModule, BtnDisabledDirective], }) export class EmailRequestCopyComponent extends BaseComponent { diff --git a/src/themes/custom/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts b/src/themes/custom/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts index 7936deb4066..aec7bfd6db2 100644 --- a/src/themes/custom/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts +++ b/src/themes/custom/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts @@ -5,7 +5,7 @@ import { import { Component } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; -import { DisabledDirective } from '../../../../../../../../../../app/shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../../../../../../../app/shared/btn-disabled.directive'; import { ExternalSourceEntryImportModalComponent as BaseComponent } from '../../../../../../../../../../app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component'; import { ThemedSearchResultsComponent } from '../../../../../../../../../../app/shared/search/search-results/themed-search-results.component'; @@ -20,7 +20,7 @@ import { ThemedSearchResultsComponent } from '../../../../../../../../../../app/ ThemedSearchResultsComponent, NgIf, AsyncPipe, - DisabledDirective, + BtnDisabledDirective, ], }) export class ExternalSourceEntryImportModalComponent extends BaseComponent { diff --git a/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts b/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts index 17bc5d91364..cea515102ac 100644 --- a/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts +++ b/src/themes/custom/app/submission/sections/upload/file/section-upload-file.component.ts @@ -6,7 +6,7 @@ import { Component } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; import { SubmissionSectionUploadFileComponent as BaseComponent } from 'src/app/submission/sections/upload/file/section-upload-file.component'; -import { DisabledDirective } from '../../../../../../../app/shared/disabled-directive'; +import { BtnDisabledDirective } from '../../../../../../../app/shared/btn-disabled.directive'; import { ThemedFileDownloadLinkComponent } from '../../../../../../../app/shared/file-download-link/themed-file-download-link.component'; import { FileSizePipe } from '../../../../../../../app/shared/utils/file-size-pipe'; import { SubmissionSectionUploadFileViewComponent } from '../../../../../../../app/submission/sections/upload/file/view/section-upload-file-view.component'; @@ -28,7 +28,7 @@ import { SubmissionSectionUploadFileViewComponent } from '../../../../../../../a AsyncPipe, ThemedFileDownloadLinkComponent, FileSizePipe, - DisabledDirective, + BtnDisabledDirective, ], }) export class SubmissionSectionUploadFileComponent From 0928dc1ca95065482c6fc190b287b5841a55ed55 Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Mon, 16 Sep 2024 14:11:59 +0200 Subject: [PATCH 08/13] 117544: linting --- .../epeople-registry/eperson-form/eperson-form.component.ts | 2 +- .../group-form/members-list/members-list.component.ts | 2 +- .../delete-collection-page/delete-collection-page.component.ts | 2 +- .../delete-community-page/delete-community-page.component.ts | 2 +- .../profile-page-researcher-form.component.ts | 2 +- src/app/register-email-form/register-email-form.component.ts | 2 +- .../access-control-array-form.component.ts | 2 +- .../external-source-entry-import-modal.component.ts | 2 +- .../form/resource-policy-form.component.spec.ts | 2 +- .../resource-policies/form/resource-policy-form.component.ts | 2 +- .../subscription-view/subscription-view.component.ts | 2 +- .../collection/submission-form-collection.component.spec.ts | 2 +- .../form/collection/submission-form-collection.component.ts | 2 +- .../upload/file/edit/section-upload-file-edit.component.ts | 2 +- .../reviewers-list/reviewers-list.component.ts | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts index 1c6f1929f38..c8236ca22d1 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts @@ -65,8 +65,8 @@ import { import { PageInfo } from '../../../core/shared/page-info.model'; import { Registration } from '../../../core/shared/registration.model'; import { TYPE_REQUEST_FORGOT } from '../../../register-email-form/register-email-form.component'; -import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component'; import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; +import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component'; import { hasValue } from '../../../shared/empty.util'; import { FormBuilderService } from '../../../shared/form/builder/form-builder.service'; import { FormComponent } from '../../../shared/form/form.component'; diff --git a/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts b/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts index 6563a765d28..22934394c8a 100644 --- a/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts +++ b/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts @@ -54,8 +54,8 @@ import { getFirstCompletedRemoteData, getRemoteDataPayload, } from '../../../../core/shared/operators'; -import { ContextHelpDirective } from '../../../../shared/context-help.directive'; import { BtnDisabledDirective } from '../../../../shared/btn-disabled.directive'; +import { ContextHelpDirective } from '../../../../shared/context-help.directive'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { PaginationComponent } from '../../../../shared/pagination/pagination.component'; import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model'; diff --git a/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts b/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts index 3d4d4abb5f9..acc716b52a7 100644 --- a/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts +++ b/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts @@ -15,8 +15,8 @@ import { import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; import { CollectionDataService } from '../../core/data/collection-data.service'; import { Collection } from '../../core/shared/collection.model'; -import { DeleteComColPageComponent } from '../../shared/comcol/comcol-forms/delete-comcol-page/delete-comcol-page.component'; import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; +import { DeleteComColPageComponent } from '../../shared/comcol/comcol-forms/delete-comcol-page/delete-comcol-page.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; diff --git a/src/app/community-page/delete-community-page/delete-community-page.component.ts b/src/app/community-page/delete-community-page/delete-community-page.component.ts index b2fa5956cbd..9c19a5eb472 100644 --- a/src/app/community-page/delete-community-page/delete-community-page.component.ts +++ b/src/app/community-page/delete-community-page/delete-community-page.component.ts @@ -15,8 +15,8 @@ import { import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; import { CommunityDataService } from '../../core/data/community-data.service'; import { Community } from '../../core/shared/community.model'; -import { DeleteComColPageComponent } from '../../shared/comcol/comcol-forms/delete-comcol-page/delete-comcol-page.component'; import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; +import { DeleteComColPageComponent } from '../../shared/comcol/comcol-forms/delete-comcol-page/delete-comcol-page.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; diff --git a/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.ts b/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.ts index 925ed6d5a6b..5d09097e6b9 100644 --- a/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.ts +++ b/src/app/profile-page/profile-page-researcher-form/profile-page-researcher-form.component.ts @@ -36,8 +36,8 @@ import { getFirstCompletedRemoteData, getFirstSucceededRemoteDataPayload, } from '../../core/shared/operators'; -import { ConfirmationModalComponent } from '../../shared/confirmation-modal/confirmation-modal.component'; import { BtnDisabledDirective } from '../../shared/btn-disabled.directive'; +import { ConfirmationModalComponent } from '../../shared/confirmation-modal/confirmation-modal.component'; import { isNotEmpty } from '../../shared/empty.util'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { followLink } from '../../shared/utils/follow-link-config.model'; diff --git a/src/app/register-email-form/register-email-form.component.ts b/src/app/register-email-form/register-email-form.component.ts index 37ce725778e..585ca71c243 100644 --- a/src/app/register-email-form/register-email-form.component.ts +++ b/src/app/register-email-form/register-email-form.component.ts @@ -54,8 +54,8 @@ import { import { Registration } from '../core/shared/registration.model'; import { AlertComponent } from '../shared/alert/alert.component'; import { AlertType } from '../shared/alert/alert-type'; -import { KlaroService } from '../shared/cookies/klaro.service'; import { BtnDisabledDirective } from '../shared/btn-disabled.directive'; +import { KlaroService } from '../shared/cookies/klaro.service'; import { isNotEmpty } from '../shared/empty.util'; import { GoogleRecaptchaComponent } from '../shared/google-recaptcha/google-recaptcha.component'; import { NotificationsService } from '../shared/notifications/notifications.service'; diff --git a/src/app/shared/access-control-form-container/access-control-array-form/access-control-array-form.component.ts b/src/app/shared/access-control-form-container/access-control-array-form/access-control-array-form.component.ts index 8f7f640c289..3dc84a833a5 100644 --- a/src/app/shared/access-control-form-container/access-control-array-form/access-control-array-form.component.ts +++ b/src/app/shared/access-control-form-container/access-control-array-form/access-control-array-form.component.ts @@ -16,8 +16,8 @@ import { NgbDatepickerModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { AccessesConditionOption } from '../../../core/config/models/config-accesses-conditions-options.model'; -import { dateToISOFormat } from '../../date.util'; import { BtnDisabledDirective } from '../../btn-disabled.directive'; +import { dateToISOFormat } from '../../date.util'; import { ToDatePipe } from './to-date.pipe'; @Component({ diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts index c666baf21fe..e0cc90ceaa6 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/external-source-tab/external-source-entry-import-modal/external-source-entry-import-modal.component.ts @@ -37,8 +37,8 @@ import { getRemoteDataPayload, } from '../../../../../../../core/shared/operators'; import { SubmissionImportExternalCollectionComponent } from '../../../../../../../submission/import-external/import-external-collection/submission-import-external-collection.component'; -import { CollectionListEntry } from '../../../../../../collection-dropdown/collection-dropdown.component'; import { BtnDisabledDirective } from '../../../../../../btn-disabled.directive'; +import { CollectionListEntry } from '../../../../../../collection-dropdown/collection-dropdown.component'; import { NotificationsService } from '../../../../../../notifications/notifications.service'; import { CollectionElementLinkType } from '../../../../../../object-collection/collection-element-link.type'; import { ItemSearchResult } from '../../../../../../object-collection/shared/item-search-result.model'; diff --git a/src/app/shared/resource-policies/form/resource-policy-form.component.spec.ts b/src/app/shared/resource-policies/form/resource-policy-form.component.spec.ts index d4dac77d72c..deaef6c611f 100644 --- a/src/app/shared/resource-policies/form/resource-policy-form.component.spec.ts +++ b/src/app/shared/resource-policies/form/resource-policy-form.component.spec.ts @@ -45,11 +45,11 @@ import { ResourcePolicy } from '../../../core/resource-policy/models/resource-po import { RESOURCE_POLICY } from '../../../core/resource-policy/models/resource-policy.resource-type'; import { SubmissionObjectDataService } from '../../../core/submission/submission-object-data.service'; import { SubmissionService } from '../../../submission/submission.service'; +import { BtnDisabledDirective } from '../../btn-disabled.directive'; import { dateToISOFormat, stringToNgbDateStruct, } from '../../date.util'; -import { BtnDisabledDirective } from '../../btn-disabled.directive'; import { isNotEmptyOperator } from '../../empty.util'; import { EpersonGroupListComponent } from '../../eperson-group-list/eperson-group-list.component'; import { dsDynamicFormControlMapFn } from '../../form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-map-fn'; diff --git a/src/app/shared/resource-policies/form/resource-policy-form.component.ts b/src/app/shared/resource-policies/form/resource-policy-form.component.ts index e13ba9ecc79..08a7f184922 100644 --- a/src/app/shared/resource-policies/form/resource-policy-form.component.ts +++ b/src/app/shared/resource-policies/form/resource-policy-form.component.ts @@ -47,11 +47,11 @@ import { ResourcePolicy } from '../../../core/resource-policy/models/resource-po import { RESOURCE_POLICY } from '../../../core/resource-policy/models/resource-policy.resource-type'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; import { getFirstSucceededRemoteData } from '../../../core/shared/operators'; +import { BtnDisabledDirective } from '../../btn-disabled.directive'; import { dateToISOFormat, stringToNgbDateStruct, } from '../../date.util'; -import { BtnDisabledDirective } from '../../btn-disabled.directive'; import { hasValue, hasValueOperator, diff --git a/src/app/shared/subscriptions/subscription-view/subscription-view.component.ts b/src/app/shared/subscriptions/subscription-view/subscription-view.component.ts index 9d9ce08905e..f940e697950 100644 --- a/src/app/shared/subscriptions/subscription-view/subscription-view.component.ts +++ b/src/app/shared/subscriptions/subscription-view/subscription-view.component.ts @@ -19,8 +19,8 @@ import { getDSORoute } from 'src/app/app-routing-paths'; import { DSONameService } from '../../../core/breadcrumbs/dso-name.service'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; -import { ConfirmationModalComponent } from '../../confirmation-modal/confirmation-modal.component'; import { BtnDisabledDirective } from '../../btn-disabled.directive'; +import { ConfirmationModalComponent } from '../../confirmation-modal/confirmation-modal.component'; import { hasValue } from '../../empty.util'; import { ThemedTypeBadgeComponent } from '../../object-collection/shared/badges/type-badge/themed-type-badge.component'; import { Subscription } from '../models/subscription.model'; diff --git a/src/app/submission/form/collection/submission-form-collection.component.spec.ts b/src/app/submission/form/collection/submission-form-collection.component.spec.ts index 61bad0439f0..3a5ae8a18d3 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.spec.ts +++ b/src/app/submission/form/collection/submission-form-collection.component.spec.ts @@ -30,8 +30,8 @@ import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder'; import { Collection } from '../../../core/shared/collection.model'; import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service'; -import { ThemedCollectionDropdownComponent } from '../../../shared/collection-dropdown/themed-collection-dropdown.component'; import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; +import { ThemedCollectionDropdownComponent } from '../../../shared/collection-dropdown/themed-collection-dropdown.component'; import { DSONameServiceMock } from '../../../shared/mocks/dso-name.service.mock'; import { mockSubmissionId, diff --git a/src/app/submission/form/collection/submission-form-collection.component.ts b/src/app/submission/form/collection/submission-form-collection.component.ts index 10b1f815dc4..1736b474d5f 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.ts +++ b/src/app/submission/form/collection/submission-form-collection.component.ts @@ -34,9 +34,9 @@ import { Collection } from '../../../core/shared/collection.model'; import { getFirstSucceededRemoteDataPayload } from '../../../core/shared/operators'; import { SubmissionObject } from '../../../core/submission/models/submission-object.model'; import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service'; +import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { CollectionDropdownComponent } from '../../../shared/collection-dropdown/collection-dropdown.component'; import { ThemedCollectionDropdownComponent } from '../../../shared/collection-dropdown/themed-collection-dropdown.component'; -import { BtnDisabledDirective } from '../../../shared/btn-disabled.directive'; import { hasValue, isNotEmpty, diff --git a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts index 0a6c1bd44df..79b3d3a5652 100644 --- a/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts +++ b/src/app/submission/sections/upload/file/edit/section-upload-file-edit.component.ts @@ -38,8 +38,8 @@ import { JsonPatchOperationPathCombiner } from '../../../../../core/json-patch/b import { JsonPatchOperationsBuilder } from '../../../../../core/json-patch/builder/json-patch-operations-builder'; import { WorkspaceitemSectionUploadFileObject } from '../../../../../core/submission/models/workspaceitem-section-upload-file.model'; import { SubmissionJsonPatchOperationsService } from '../../../../../core/submission/submission-json-patch-operations.service'; -import { dateToISOFormat } from '../../../../../shared/date.util'; import { BtnDisabledDirective } from '../../../../../shared/btn-disabled.directive'; +import { dateToISOFormat } from '../../../../../shared/date.util'; import { hasNoValue, hasValue, diff --git a/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts b/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts index 57e8c730316..c43fabdb83a 100644 --- a/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts +++ b/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/reviewers-list/reviewers-list.component.ts @@ -44,8 +44,8 @@ import { EpersonDtoModel } from '../../../../core/eperson/models/eperson-dto.mod import { Group } from '../../../../core/eperson/models/group.model'; import { PaginationService } from '../../../../core/pagination/pagination.service'; import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators'; -import { ContextHelpDirective } from '../../../../shared/context-help.directive'; import { BtnDisabledDirective } from '../../../../shared/btn-disabled.directive'; +import { ContextHelpDirective } from '../../../../shared/context-help.directive'; import { hasValue } from '../../../../shared/empty.util'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { PaginationComponent } from '../../../../shared/pagination/pagination.component'; From 1209b40ac9370453a53b4d0097999f3a0934a937 Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Mon, 16 Sep 2024 16:09:41 +0200 Subject: [PATCH 09/13] 117544: fix remaining bug --- src/app/shared/btn-disabled.directive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/btn-disabled.directive.ts b/src/app/shared/btn-disabled.directive.ts index f73422a9d5d..427d1654da0 100644 --- a/src/app/shared/btn-disabled.directive.ts +++ b/src/app/shared/btn-disabled.directive.ts @@ -18,7 +18,7 @@ import { */ export class BtnDisabledDirective { - @Input() set dsDisabled(value: boolean) { + @Input() set dsBtnDisabled(value: boolean) { this.isDisabled = !!value; } From c249afdb3f0d50facec699606b5e4ccbd4ccd716 Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Wed, 18 Sep 2024 09:46:38 +0200 Subject: [PATCH 10/13] lint rule with autofix to disallow the disabled input on button elements --- .eslintrc.json | 3 +- lint/src/rules/html/index.ts | 3 + lint/src/rules/html/no-disabled-attr.ts | 144 ++++++++++++++++++++++++ 3 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 lint/src/rules/html/no-disabled-attr.ts diff --git a/.eslintrc.json b/.eslintrc.json index 5fb4c121717..a9e44c59374 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -293,7 +293,8 @@ ], "rules": { // Custom DSpace Angular rules - "dspace-angular-html/themed-component-usages": "error" + "dspace-angular-html/themed-component-usages": "error", + "dspace-angular-html/no-disabled-attr": "error" } }, { diff --git a/lint/src/rules/html/index.ts b/lint/src/rules/html/index.ts index 7c1370ae2d4..120751d65aa 100644 --- a/lint/src/rules/html/index.ts +++ b/lint/src/rules/html/index.ts @@ -10,10 +10,13 @@ import { bundle, RuleExports, } from '../../util/structure'; +import * as noDisabledAttr from './no-disabled-attr'; import * as themedComponentUsages from './themed-component-usages'; const index = [ themedComponentUsages, + noDisabledAttr, + ] as unknown as RuleExports[]; export = { diff --git a/lint/src/rules/html/no-disabled-attr.ts b/lint/src/rules/html/no-disabled-attr.ts new file mode 100644 index 00000000000..22f987d52b9 --- /dev/null +++ b/lint/src/rules/html/no-disabled-attr.ts @@ -0,0 +1,144 @@ +import { + TmplAstBoundAttribute, + TmplAstTextAttribute +} from '@angular-eslint/bundled-angular-compiler'; +import { TemplateParserServices } from '@angular-eslint/utils'; +import { + ESLintUtils, + TSESLint, +} from '@typescript-eslint/utils'; +import { + DSpaceESLintRuleInfo, + NamedTests, +} from '../../util/structure'; +import { getSourceCode } from '../../util/typescript'; + +export enum Message { + USE_DSBTN_DISABLED = 'mustUseDsBtnDisabled', +} + +export const info = { + name: 'no-disabled-attr', + meta: { + docs: { + description: `Buttons should use the \`dsBtnDisabled\` directive instead of the HTML \`disabled\` attribute for accessibility reasons.`, + }, + type: 'problem', + fixable: 'code', + schema: [], + messages: { + [Message.USE_DSBTN_DISABLED]: 'Buttons should use the `dsBtnDisabled` directive instead of the `disabled` attribute.', + }, + }, + defaultOptions: [], +} as DSpaceESLintRuleInfo; + +export const rule = ESLintUtils.RuleCreator.withoutDocs({ + ...info, + create(context: TSESLint.RuleContext) { + const parserServices = getSourceCode(context).parserServices as TemplateParserServices; + + /** + * Some dynamic angular inputs will have disabled as name because of how Angular handles this internally (e.g [class.disabled]="isDisabled") + * But these aren't actually the disabled attribute we're looking for, we can determine this by checking the details of the keySpan + */ + function isOtherAttributeDisabled(node: TmplAstBoundAttribute | TmplAstTextAttribute): boolean { + // if the details are not null, and the details are not 'disabled', then it's not the disabled attribute we're looking for + return node.keySpan?.details !== null && node.keySpan?.details !== 'disabled'; + } + + /** + * Replace the disabled text with [dsBtnDisabled] in the template + */ + function replaceDisabledText(text: string ): string { + const hasBrackets = text.includes('[') && text.includes(']'); + const newDisabledText = hasBrackets ? 'dsBtnDisabled' : '[dsBtnDisabled]'; + return text.replace('disabled', newDisabledText); + } + + function inputIsChildOfButton(node: any): boolean { + return (node.parent?.tagName === 'button' || node.parent?.name === 'button'); + } + + function reportAndFix(node: TmplAstBoundAttribute | TmplAstTextAttribute) { + if (!inputIsChildOfButton(node) || isOtherAttributeDisabled(node)) { + return; + } + + const sourceSpan = node.sourceSpan; + context.report({ + messageId: Message.USE_DSBTN_DISABLED, + loc: parserServices.convertNodeSourceSpanToLoc(sourceSpan), + fix(fixer) { + const templateText = sourceSpan.start.file.content; + const disabledText = templateText.slice(sourceSpan.start.offset, sourceSpan.end.offset); + const newText = replaceDisabledText(disabledText); + return fixer.replaceTextRange([sourceSpan.start.offset, sourceSpan.end.offset], newText); + }, + }); + } + + return { + 'BoundAttribute[name="disabled"]'(node: TmplAstBoundAttribute) { + reportAndFix(node); + }, + 'TextAttribute[name="disabled"]'(node: TmplAstTextAttribute) { + reportAndFix(node); + }, + }; + }, +}); + +export const tests = { + plugin: info.name, + valid: [ + { + name: 'should use [dsBtnDisabled] in HTML templates', + code: ` + + `, + }, + { + name: 'disabled attribute is still valid on non-button elements', + code: ` + + `, + }, + { + name: '[disabled] attribute is still valid on non-button elements', + code: ` + + `, + }, + { + name: 'angular dynamic attributes that use disabled are still valid', + code: ` + + `, + }, + ], + invalid: [ + { + name: 'should not use disabled attribute in HTML templates', + code: ` + + `, + errors: [{ messageId: Message.USE_DSBTN_DISABLED }], + output: ` + + `, + }, + { + name: 'should not use [disabled] attribute in HTML templates', + code: ` + + `, + errors: [{ messageId: Message.USE_DSBTN_DISABLED }], + output: ` + + `, + }, + ], +} as NamedTests; + +export default rule; From ee83beae94d8ef35838fe00c11359164800a0e51 Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Fri, 20 Sep 2024 16:45:05 +0200 Subject: [PATCH 11/13] fix bug in lint rule, add docs for rule and update name so it's clear this is only for buttons currently (cherry picked from commit 2380d4e751563181b341c5a225bae5a9be40d7e3) --- .eslintrc.json | 2 +- docs/lint/html/index.md | 1 + lint/src/rules/html/index.ts | 4 ++-- ...attr.ts => no-disabled-attribute-on-button.ts} | 15 +++++++++------ 4 files changed, 13 insertions(+), 9 deletions(-) rename lint/src/rules/html/{no-disabled-attr.ts => no-disabled-attribute-on-button.ts} (89%) diff --git a/.eslintrc.json b/.eslintrc.json index a9e44c59374..888c968b5c6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -294,7 +294,7 @@ "rules": { // Custom DSpace Angular rules "dspace-angular-html/themed-component-usages": "error", - "dspace-angular-html/no-disabled-attr": "error" + "dspace-angular-html/no-disabled-attribute-on-button": "error" } }, { diff --git a/docs/lint/html/index.md b/docs/lint/html/index.md index 15d693843c0..e134e1070f4 100644 --- a/docs/lint/html/index.md +++ b/docs/lint/html/index.md @@ -2,3 +2,4 @@ _______ - [`dspace-angular-html/themed-component-usages`](./rules/themed-component-usages.md): Themeable components should be used via the selector of their `ThemedComponent` wrapper class +- [`dspace-angular-html/no-disabled-attribute-on-button`](./rules/no-disabled-attribute-on-button.md): Buttons should use the `dsBtnDisabled` directive instead of the HTML `disabled` attribute. diff --git a/lint/src/rules/html/index.ts b/lint/src/rules/html/index.ts index 120751d65aa..3d425c3ad48 100644 --- a/lint/src/rules/html/index.ts +++ b/lint/src/rules/html/index.ts @@ -10,12 +10,12 @@ import { bundle, RuleExports, } from '../../util/structure'; -import * as noDisabledAttr from './no-disabled-attr'; +import * as noDisabledAttributeOnButton from './no-disabled-attribute-on-button'; import * as themedComponentUsages from './themed-component-usages'; const index = [ themedComponentUsages, - noDisabledAttr, + noDisabledAttributeOnButton, ] as unknown as RuleExports[]; diff --git a/lint/src/rules/html/no-disabled-attr.ts b/lint/src/rules/html/no-disabled-attribute-on-button.ts similarity index 89% rename from lint/src/rules/html/no-disabled-attr.ts rename to lint/src/rules/html/no-disabled-attribute-on-button.ts index 22f987d52b9..bf1a72d70d0 100644 --- a/lint/src/rules/html/no-disabled-attr.ts +++ b/lint/src/rules/html/no-disabled-attribute-on-button.ts @@ -1,12 +1,13 @@ import { TmplAstBoundAttribute, - TmplAstTextAttribute + TmplAstTextAttribute, } from '@angular-eslint/bundled-angular-compiler'; import { TemplateParserServices } from '@angular-eslint/utils'; import { ESLintUtils, TSESLint, } from '@typescript-eslint/utils'; + import { DSpaceESLintRuleInfo, NamedTests, @@ -18,10 +19,12 @@ export enum Message { } export const info = { - name: 'no-disabled-attr', + name: 'no-disabled-attribute-on-button', meta: { docs: { - description: `Buttons should use the \`dsBtnDisabled\` directive instead of the HTML \`disabled\` attribute for accessibility reasons.`, + description: `Buttons should use the \`dsBtnDisabled\` directive instead of the HTML \`disabled\` attribute. + This should be done to ensure that users with a screen reader are able to understand that the a button button is present, and that it is disabled. + The native html disabled attribute does not allow users to navigate to the button by keyboard, and thus they have no way of knowing that the button is present.`, }, type: 'problem', fixable: 'code', @@ -52,7 +55,7 @@ export const rule = ESLintUtils.RuleCreator.withoutDocs({ */ function replaceDisabledText(text: string ): string { const hasBrackets = text.includes('[') && text.includes(']'); - const newDisabledText = hasBrackets ? 'dsBtnDisabled' : '[dsBtnDisabled]'; + const newDisabledText = hasBrackets ? 'dsBtnDisabled' : '[dsBtnDisabled]="true"'; return text.replace('disabled', newDisabledText); } @@ -101,7 +104,7 @@ export const tests = { { name: 'disabled attribute is still valid on non-button elements', code: ` - + `, }, { @@ -121,7 +124,7 @@ export const tests = { { name: 'should not use disabled attribute in HTML templates', code: ` - + `, errors: [{ messageId: Message.USE_DSBTN_DISABLED }], output: ` From 1b17879d7ae74e45b6e383db81ca6a3eb5817928 Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Wed, 25 Sep 2024 14:55:37 +0200 Subject: [PATCH 12/13] documentation file --- .../rules/no-disabled-attribute-on-button.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 docs/lint/html/rules/no-disabled-attribute-on-button.md diff --git a/docs/lint/html/rules/no-disabled-attribute-on-button.md b/docs/lint/html/rules/no-disabled-attribute-on-button.md new file mode 100644 index 00000000000..d9d39ce82ca --- /dev/null +++ b/docs/lint/html/rules/no-disabled-attribute-on-button.md @@ -0,0 +1,78 @@ +[DSpace ESLint plugins](../../../../lint/README.md) > [HTML rules](../index.md) > `dspace-angular-html/no-disabled-attribute-on-button` +_______ + +Buttons should use the `dsBtnDisabled` directive instead of the HTML `disabled` attribute. + This should be done to ensure that users with a screen reader are able to understand that the a button button is present, and that it is disabled. + The native html disabled attribute does not allow users to navigate to the button by keyboard, and thus they have no way of knowing that the button is present. + +_______ + +[Source code](../../../../lint/src/rules/html/no-disabled-attribute-on-button.ts) + +### Examples + + +#### Valid code + +##### should use [dsBtnDisabled] in HTML templates + +```html + +``` + +##### disabled attribute is still valid on non-button elements + +```html + +``` + +##### [disabled] attribute is still valid on non-button elements + +```html + +``` + +##### angular dynamic attributes that use disabled are still valid + +```html + +``` + + + + +#### Invalid code & automatic fixes + +##### should not use disabled attribute in HTML templates + +```html + +``` +Will produce the following error(s): +``` +Buttons should use the `dsBtnDisabled` directive instead of the `disabled` attribute. +``` + +Result of `yarn lint --fix`: +```html + +``` + + +##### should not use [disabled] attribute in HTML templates + +```html + +``` +Will produce the following error(s): +``` +Buttons should use the `dsBtnDisabled` directive instead of the `disabled` attribute. +``` + +Result of `yarn lint --fix`: +```html + +``` + + + From 920edef1552966cb43cfdf8a3292e7f6c2dd6127 Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Fri, 24 Jan 2025 10:36:10 +0100 Subject: [PATCH 13/13] 117544: use directive after latest main merge --- .../collection-source-controls.component.spec.ts | 1 - .../item-edit-bitstream-bundle.component.html | 4 ++-- .../item-edit-bitstream-bundle.component.ts | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts index 2e3cf5477c2..cbe3de14834 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts @@ -195,7 +195,6 @@ describe('CollectionSourceControlsComponent', () => { const buttons = fixture.debugElement.queryAll(By.css('button')); buttons.forEach(button => { - console.log(button.nativeElement); expect(button.nativeElement.getAttribute('aria-disabled')).toBe('true'); expect(button.nativeElement.classList.contains('disabled')).toBeTrue(); }); diff --git a/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.html b/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.html index 06201b1cbe7..348118a05c6 100644 --- a/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.html +++ b/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.html @@ -113,13 +113,13 @@ title="{{'item.edit.bitstreams.edit.buttons.edit' | translate}}"> - -