diff --git a/apps/red-ui/src/app/app.module.ts b/apps/red-ui/src/app/app.module.ts index c23ea1f9a..347ef2b86 100644 --- a/apps/red-ui/src/app/app.module.ts +++ b/apps/red-ui/src/app/app.module.ts @@ -25,6 +25,7 @@ import { SERVER_ERROR_SKIP_PATHS, ServerErrorInterceptor, SkeletonComponent, + StopPropagationDirective, ToastComponent, } from '@iqser/common-ui'; import { ToastrModule } from 'ngx-toastr'; @@ -161,6 +162,7 @@ export const appModuleFactory = (config: AppConfig) => { SkeletonComponent, LogoComponent, HiddenActionDirective, + StopPropagationDirective, ], providers: [ { diff --git a/apps/red-ui/src/app/components/notifications/notifications.component.html b/apps/red-ui/src/app/components/notifications/notifications.component.html index 89da01870..517a15f89 100644 --- a/apps/red-ui/src/app/components/notifications/notifications.component.html +++ b/apps/red-ui/src/app/components/notifications/notifications.component.html @@ -1,7 +1,7 @@ @@ -19,22 +19,24 @@
{{ group.date }}
{{ 'notifications.mark-all-as-read' | translate }}
@@ -42,12 +44,14 @@
{{ notification.creationDate | date : 'exactDate' }}
+
diff --git a/apps/red-ui/src/app/components/notifications/notifications.component.ts b/apps/red-ui/src/app/components/notifications/notifications.component.ts index 8320e4193..90b6f15fb 100644 --- a/apps/red-ui/src/app/components/notifications/notifications.component.ts +++ b/apps/red-ui/src/app/components/notifications/notifications.component.ts @@ -48,9 +48,7 @@ export class NotificationsComponent { ); } - async markRead($event, notifications: Notification[] = this._notificationsService.all, isRead = true): Promise { - $event.stopPropagation(); - + async markRead(notifications: Notification[] = this._notificationsService.all, isRead = true): Promise { if (!notifications.find(notification => !!notification.readDate !== isRead)) { // If no notification changes status after the request, abort return; diff --git a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.ts b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.ts index 8d4bd718e..3307196e9 100644 --- a/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.ts +++ b/apps/red-ui/src/app/modules/account/screens/user-profile/user-profile-screen/user-profile-screen.component.ts @@ -86,7 +86,7 @@ export class UserProfileScreenComponent extends BaseFormComponent implements OnI const value = this.form.getRawValue() as IProfile; if (this.emailChanged) { - const dialogRef = this._dialogService.openDialog('confirmPassword', null, null); + const dialogRef = this._dialogService.openDialog('confirmPassword'); const password = await firstValueFrom(dialogRef.afterClosed()); if (!password) { return; diff --git a/apps/red-ui/src/app/modules/admin/base-entity-screen/base-entity-screen.component.ts b/apps/red-ui/src/app/modules/admin/base-entity-screen/base-entity-screen.component.ts index adcd8e171..a2b3a7af4 100644 --- a/apps/red-ui/src/app/modules/admin/base-entity-screen/base-entity-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/base-entity-screen/base-entity-screen.component.ts @@ -17,8 +17,8 @@ import { PermissionsService } from '@services/permissions.service'; export class BaseEntityScreenComponent { readonly disabledItems$: Observable; readonly canDeleteEntity$: Observable; - readonly #dossierTemplateId: string = getParam(DOSSIER_TEMPLATE_ID); - readonly #entityType: string = getParam(ENTITY_TYPE); + readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID); + readonly #entityType = getParam(ENTITY_TYPE); constructor( private readonly _router: Router, @@ -37,7 +37,7 @@ export class BaseEntityScreenComponent { } openDeleteDictionariesDialog() { - this._dialogService.openDialog('confirm', null, null, async () => { + this._dialogService.openDialog('confirm', null, async () => { this._loadingService.start(); const dossierTemplate = this._dossierTemplatesService.find(this.#dossierTemplateId); await firstValueFrom(this._dictionaryService.deleteDictionaries([this.#entityType], this.#dossierTemplateId)); diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts index b57e13cdf..8950b2780 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-user-dialog/user-details/user-details.component.ts @@ -103,7 +103,7 @@ export class UserDetailsComponent extends BaseFormComponent implements OnChanges } delete() { - this._dialogService.deleteUsers([this.user.id], null, () => this.closeDialog.emit(true)); + this._dialogService.deleteUsers([this.user.id], () => this.closeDialog.emit(true)); } setRolesRequirements(checked: boolean, role: string): void { diff --git a/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html index fd39ef1e3..dc0f6fe5c 100644 --- a/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html @@ -99,7 +99,7 @@
implements OnI } } + openAuditDetails(log: Audit) { + this._dialogService.openDialog('auditInfo', { auditEntry: log }); + } + private _getForm(): UntypedFormGroup { return this._formBuilder.group({ category: [this.ALL_CATEGORIES], @@ -136,8 +140,4 @@ export class AuditScreenComponent extends ListingComponent implements OnI } this._loadingService.stop(); } - - openAuditDetails($event: MouseEvent, log: Audit) { - this._dialogService.openDialog('auditInfo', $event, { auditEntry: log }); - } } diff --git a/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.html index da6885c67..533f1ec38 100644 --- a/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.html @@ -38,7 +38,7 @@
{ ); } - openEditColorDialog($event: MouseEvent, color: ListItem) { - this._dialogService.openDialog('editColor', $event, { colorKey: color.key, dossierTemplateId: this.#dossierTemplateId }); + openEditColorDialog(color: ListItem) { + this._dialogService.openDialog('editColor', { colorKey: color.key, dossierTemplateId: this.#dossierTemplateId }); } } diff --git a/apps/red-ui/src/app/modules/admin/screens/digital-signature/digital-signature-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/digital-signature/digital-signature-screen.component.ts index 98d10be79..f53c497d4 100644 --- a/apps/red-ui/src/app/modules/admin/screens/digital-signature/digital-signature-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/digital-signature/digital-signature-screen.component.ts @@ -81,7 +81,7 @@ export class DigitalSignatureScreenComponent implements OnInit { } openConfigureCertificate(): void { - const dialogRef = this._dialogService.openDialog('configureCertificate', null, null); + const dialogRef = this._dialogService.openDialog('configureCertificate'); firstValueFrom(dialogRef.afterClosed()).then(async res => { if (res) { await this.loadDigitalSignature(); diff --git a/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.html index 3ae58c130..e72e17e99 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.html @@ -21,7 +21,7 @@
@@ -91,7 +91,7 @@
{ - this._loadingService.start(); - const ids = attributes.map(a => a.id); - await firstValueFrom(this._dossierAttributesService.delete(ids, this.#dossierTemplateId)); - await this._loadData(); - }, - ); + await this._dialogService.deleteAttributes(attributes, this.#dossierTemplateId, this.impactedTemplatesRef, 'dossier', async () => { + this._loadingService.start(); + const ids = attributes.map(a => a.id); + await firstValueFrom(this._dossierAttributesService.delete(ids, this.#dossierTemplateId)); + await this._loadData(); + }); } - openAddEditAttributeDialog($event: MouseEvent, dossierAttribute?: IDossierAttributeConfig) { + openAddEditAttributeDialog(dossierAttribute?: IDossierAttributeConfig) { const dossierTemplateId = this.#dossierTemplateId; - this._dialogService.openDialog('addEditDossierAttribute', $event, { dossierAttribute, dossierTemplateId }, async () => - this._loadData(), - ); + this._dialogService.openDialog('addEditDossierAttribute', { dossierAttribute, dossierTemplateId }, async () => this._loadData()); } private async _loadData() { diff --git a/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen/dossier-states-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen/dossier-states-listing-screen.component.html index dd0ed0200..92bc9e700 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen/dossier-states-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen/dossier-states-listing-screen.component.html @@ -52,7 +52,7 @@ > (AddEditDossierStateDialogComponent, { ...defaultDialogConfig, data: { diff --git a/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-table-item/dossier-states-table-item.component.html b/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-table-item/dossier-states-table-item.component.html index 61c99bb63..570097587 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-table-item/dossier-states-table-item.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-table-item/dossier-states-table-item.component.html @@ -17,14 +17,14 @@
s.id !== dossierState.id), @@ -43,9 +41,7 @@ export class DossierStatesTableItemComponent { ); } - openEditStateDialog($event: MouseEvent, dossierState: IDossierState) { - $event.stopPropagation(); - + openEditStateDialog(dossierState: IDossierState) { this.#dialog.open(AddEditDossierStateDialogComponent, { ...defaultDialogConfig, data: { diff --git a/apps/red-ui/src/app/modules/admin/screens/dossier-templates-listing/dossier-templates-listing-screen/dossier-templates-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/dossier-templates-listing/dossier-templates-listing-screen/dossier-templates-listing-screen.component.html index dfb60f821..b0339acaf 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dossier-templates-listing/dossier-templates-listing-screen/dossier-templates-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/dossier-templates-listing/dossier-templates-listing-screen/dossier-templates-listing-screen.component.html @@ -18,21 +18,21 @@
{ + openBulkDeleteTemplatesDialog() { + return this._dialogService.openDialog('confirm', null, () => { this._loadingService.loadWhile(this._deleteTemplates()); }); } openAddDossierTemplateDialog() { - this._dialogService.openDialog('addEditCloneDossierTemplate', null, null); + this._dialogService.openDialog('addEditCloneDossierTemplate'); } private async _deleteTemplates(templateIds = this.listingService.selected.map(d => d.dossierTemplateId)) { diff --git a/apps/red-ui/src/app/modules/admin/screens/entities-listing/entities-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/entities-listing/entities-listing-screen.component.html index 2d4e399da..6e8758ba7 100644 --- a/apps/red-ui/src/app/modules/admin/screens/entities-listing/entities-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/entities-listing/entities-listing-screen.component.html @@ -39,7 +39,7 @@ @@ -101,7 +101,7 @@
this.templateStats$ = this._dossierTemplateStatsService.watch$(this.#dossierTemplateId).pipe(tap(() => this._loadDictionaryData())); } - openDeleteEntitiesDialog($event?: MouseEvent, types = this.listingService.selected) { - this._dialogService.openDialog('confirm', $event, null, async () => { + openDeleteEntitiesDialog(types = this.listingService.selected) { + this._dialogService.openDialog('confirm', null, async () => { this._loadingService.start(); await firstValueFrom( this._dictionaryService.deleteDictionaries( @@ -62,8 +62,8 @@ export class EntitiesListingScreenComponent extends ListingComponent }); } - openAddEntityDialog($event?: MouseEvent) { - this._dialogService.openDialog('addEntity', $event, { dossierTemplateId: this.#dossierTemplateId }); + openAddEntityDialog() { + this._dialogService.openDialog('addEntity', { dossierTemplateId: this.#dossierTemplateId }); } private _loadDictionaryData(): void { diff --git a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.html index 5b12e3b78..f1f991fc8 100644 --- a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.html @@ -45,7 +45,7 @@
+ { + this._dialogService.openDialog('addEditFileAttribute', data, (newValue: IFileAttributeConfig) => { this._loadingService.loadWhile(this.#createNewFileAttributeAndRefreshView(newValue)); }); } - async openConfirmDeleteAttributeDialog( - $event: MouseEvent, - attributes: FileAttributeConfig[] = this.listingService.selected, - ): Promise { - await this._dialogService.deleteAttributes( - attributes, - this.#dossierTemplateId, - this._impactedTemplatesRef, - 'file', - $event, - async () => { - this._loadingService.start(); - const ids = attributes.map(a => a.id); - await firstValueFrom(this._fileAttributesService.deleteFileAttributes(ids, this.#dossierTemplateId)); - await firstValueFrom(this._dossierTemplatesService.refreshDossierTemplate(this.#dossierTemplateId)); - await this.#loadData(); - }, - ); + async openConfirmDeleteAttributeDialog(attributes: FileAttributeConfig[] = this.listingService.selected): Promise { + await this._dialogService.deleteAttributes(attributes, this.#dossierTemplateId, this._impactedTemplatesRef, 'file', async () => { + this._loadingService.start(); + const ids = attributes.map(a => a.id); + await firstValueFrom(this._fileAttributesService.deleteFileAttributes(ids, this.#dossierTemplateId)); + await firstValueFrom(this._dossierTemplatesService.refreshDossierTemplate(this.#dossierTemplateId)); + await this.#loadData(); + }); } importCSV(files: FileList | File[]) { @@ -114,7 +104,6 @@ export class FileAttributesListingScreenComponent extends ListingComponent { + this._dialogService.openDialog('smtpAuthConfig', this.form.getRawValue(), null, authConfig => { if (authConfig) { this.form.patchValue(authConfig); } else if (!skipDisableOnCancel) { diff --git a/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-dialog.service.ts b/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-dialog.service.ts index 668de1d80..36563c498 100644 --- a/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-dialog.service.ts +++ b/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-dialog.service.ts @@ -48,7 +48,8 @@ export class JustificationsDialogService extends DialogService { justificationName: justifications[0].name, }, }); - this.openDialog('confirm', null, data, async () => { + + this.openDialog('confirm', data, async () => { this._loadingService.start(); const justificationIds = justifications.map(j => j.id); await firstValueFrom(this._justificationService.delete(justificationIds, dossierTemplateId)); diff --git a/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.ts index 7a31b9ff1..59e11f857 100644 --- a/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/justifications/justifications-screen/justifications-screen.component.ts @@ -60,7 +60,7 @@ export class JustificationsScreenComponent extends ListingComponent { + this._dialogService.openDialog('confirm', null, () => { this._loadingService.loadWhile(this._deleteTemplate(template)); }); } @@ -90,7 +90,7 @@ export class ReportsScreenComponent implements OnInit { fileName: file.name, }, }); - this._dialogService.openDialog('confirm', null, data, null, async result => { + this._dialogService.openDialog('confirm', data, null, async result => { if (result) { const multiFileReport = result > 1; if ( @@ -129,7 +129,7 @@ export class ReportsScreenComponent implements OnInit { }, }); - this._dialogService.openDialog('confirm', null, data, null, async result => { + this._dialogService.openDialog('confirm', data, null, async result => { if (result) { await this._uploadTemplateForm(file, multiFileReport); } diff --git a/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.html index 62caae326..f6cd676c9 100644 --- a/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/user-listing/user-listing-screen.component.html @@ -1,5 +1,4 @@
@@ -28,7 +28,6 @@ @@ -53,10 +53,10 @@
@@ -71,14 +71,14 @@
implement await this.#loadData(); } - openAddEditUserDialog(event?: MouseEvent, user?: User) { - this._dialogService.openDialog('addEditUser', event, user, async () => { + openAddEditUserDialog(user?: User) { + this._dialogService.openDialog('addEditUser', user, async () => { await this.#loadData(); }); } - openDeleteUsersDialog(userIds: string[], $event?: MouseEvent) { - this._dialogService.deleteUsers(userIds, $event, async () => { + openDeleteUsersDialog(userIds: string[]) { + this._dialogService.deleteUsers(userIds, async () => { await this.#loadData(); }); } diff --git a/apps/red-ui/src/app/modules/admin/screens/watermark/watermarks-listing/watermarks-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/watermark/watermarks-listing/watermarks-listing-screen.component.html index 92e1acfd9..a6083442b 100644 --- a/apps/red-ui/src/app/modules/admin/screens/watermark/watermarks-listing/watermarks-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/watermark/watermarks-listing/watermarks-listing-screen.component.html @@ -14,8 +14,8 @@ { + this._dialogService.openDialog('confirm', data, async () => { await this._deleteWatermark(watermark); }); } diff --git a/apps/red-ui/src/app/modules/admin/services/admin-dialog.service.ts b/apps/red-ui/src/app/modules/admin/services/admin-dialog.service.ts index dfab4ec29..91c7017d3 100644 --- a/apps/red-ui/src/app/modules/admin/services/admin-dialog.service.ts +++ b/apps/red-ui/src/app/modules/admin/services/admin-dialog.service.ts @@ -108,7 +108,7 @@ export class AdminDialogService extends DialogService { super(_dialog); } - deleteUsers(userIds: string[], $event?: MouseEvent, cb?: () => Promise | void): void { + deleteUsers(userIds: string[], cb?: () => Promise | void): void { const data = new ConfirmationDialogInput({ title: _('confirm-delete-users.title'), question: _('confirm-delete-users.warning'), @@ -123,7 +123,7 @@ export class AdminDialogService extends DialogService { toastMessage: _('confirm-delete-users.toast-error'), }); - this.openDialog('confirm', $event, data, async result => { + this.openDialog('confirm', data, async result => { if (result === ConfirmOptions.CONFIRM) { this._loadingService.start(); await firstValueFrom(this._userService.delete(userIds)); @@ -138,7 +138,6 @@ export class AdminDialogService extends DialogService { dossierTemplateId: string, impactedTemplatesRef: TemplateRef, type: 'dossier' | 'file', - $event: MouseEvent, cb: () => Promise | void, ): Promise { this._loadingService.start(); @@ -175,6 +174,7 @@ export class AdminDialogService extends DialogService { toastMessage: _('confirm-delete-attribute.toast-error'), translateParams: { reportsCount: uniqueTemplates.length, count: attributes.length, name: attributes[0].label }, }); + if (templates.length) { data.checkboxes.push({ value: false, @@ -183,7 +183,8 @@ export class AdminDialogService extends DialogService { extraContentData: { templates: uniqueTemplates }, }); } - this.openDialog('confirm', $event, data, async () => { + + this.openDialog('confirm', data, async () => { await cb(); }); } diff --git a/apps/red-ui/src/app/modules/admin/shared/components/dossier-template-actions/dossier-template-actions.component.html b/apps/red-ui/src/app/modules/admin/shared/components/dossier-template-actions/dossier-template-actions.component.html index a707dd9ed..3e96c6552 100644 --- a/apps/red-ui/src/app/modules/admin/shared/components/dossier-template-actions/dossier-template-actions.component.html +++ b/apps/red-ui/src/app/modules/admin/shared/components/dossier-template-actions/dossier-template-actions.component.html @@ -1,27 +1,27 @@ -
+
diff --git a/apps/red-ui/src/app/modules/admin/shared/components/dossier-template-actions/dossier-template-actions.component.ts b/apps/red-ui/src/app/modules/admin/shared/components/dossier-template-actions/dossier-template-actions.component.ts index fb5f63cca..2d2232f3d 100644 --- a/apps/red-ui/src/app/modules/admin/shared/components/dossier-template-actions/dossier-template-actions.component.ts +++ b/apps/red-ui/src/app/modules/admin/shared/components/dossier-template-actions/dossier-template-actions.component.ts @@ -33,12 +33,12 @@ export class DossierTemplateActionsComponent implements OnInit { this.dossierTemplateId ??= this._route.snapshot.paramMap.get(DOSSIER_TEMPLATE_ID); } - openEditCloneDossierTemplateDialog($event: MouseEvent, clone: boolean = false) { - this._dialogService.openDialog('addEditCloneDossierTemplate', $event, { dossierTemplateId: this.dossierTemplateId, clone }); + openEditCloneDossierTemplateDialog(clone: boolean = false) { + this._dialogService.openDialog('addEditCloneDossierTemplate', { dossierTemplateId: this.dossierTemplateId, clone }); } - openDeleteDossierTemplateDialog($event?: MouseEvent) { - this._dialogService.openDialog('confirm', $event, null, async () => { + openDeleteDossierTemplateDialog() { + this._dialogService.openDialog('confirm', null, async () => { this._loadingService.start(); const success = await firstValueFrom(this._dossierTemplatesService.delete([this.dossierTemplateId])); diff --git a/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.ts b/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.ts index b111418ab..bb83e1846 100644 --- a/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.ts +++ b/apps/red-ui/src/app/modules/dashboard/components/template-stats/template-stats.component.ts @@ -24,6 +24,6 @@ export class TemplateStatsComponent { ) {} newDossier(): void { - this._dialogService.openDialog('addDossier', null, { dossierTemplateId: this.stats.dossierTemplateId }); + this._dialogService.openDialog('addDossier', { dossierTemplateId: this.stats.dossierTemplateId }); } } diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.ts b/apps/red-ui/src/app/modules/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.ts index 767368052..cde04f782 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.ts +++ b/apps/red-ui/src/app/modules/dossier-overview/components/dossier-details-stats/dossier-details-stats.component.ts @@ -33,7 +33,7 @@ export class DossierDetailsStatsComponent implements OnInit { openEditDossierDialog(section: string): void { const data = { dossierId: this.dossier.id, section }; - this._dialogService.openDialog('editDossier', null, data, async () => { + this._dialogService.openDialog('editDossier', data, async () => { await firstValueFrom(this._filesService.loadAll(this.dossier.id)); }); } diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.html b/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.html index 33c2410ec..34220fd87 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.html +++ b/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.html @@ -7,7 +7,7 @@
+ -
+
- + > - + - +
diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.ts b/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.ts index c22ab777c..799e2e426 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.ts +++ b/apps/red-ui/src/app/modules/dossier-overview/components/table-item/file-attribute/file-attribute.component.ts @@ -50,15 +50,6 @@ export class FileAttributeComponent extends BaseFormComponent implements OnInit ); } - ngOnInit(): void { - if (this.#noFileAttributes) { - this.#initFileAttributes(); - } - - this.form = this.#getForm(); - this.initialFormValue = this.form.getRawValue(); - } - get isDate(): boolean { return this.fileAttribute.type === FileAttributeConfigTypes.DATE; } @@ -71,28 +62,20 @@ export class FileAttributeComponent extends BaseFormComponent implements OnInit return JSON.stringify(this.file.fileAttributes.attributeIdToValue) === '{}'; } - #initFileAttributes() { - const configs = this._fileAttributesService.getFileAttributeConfig(this.file.dossierTemplateId).fileAttributeConfigs; - configs.forEach(config => (this.file.fileAttributes.attributeIdToValue[config.id] = null)); + ngOnInit(): void { + if (this.#noFileAttributes) { + this.#initFileAttributes(); + } + + this.form = this.#getForm(); + this.initialFormValue = this.form.getRawValue(); } - async editFileAttribute($event: MouseEvent): Promise { - $event?.stopPropagation(); + async editFileAttribute(): Promise { this.#toggleEdit(); } - #getForm(): UntypedFormGroup { - const config = {}; - const fileAttributes = this.file.fileAttributes.attributeIdToValue; - Object.keys(fileAttributes).forEach(key => { - const attrValue = fileAttributes[key]; - config[key] = [dayjs(attrValue, 'YYYY-MM-DD', true).isValid() ? dayjs(attrValue).toDate() : attrValue]; - }); - return this._formBuilder.group(config); - } - - async save($event?: MouseEvent): Promise { - $event?.stopPropagation(); + async save() { const rawFormValue = this.form.getRawValue(); const fileAttrValue = rawFormValue[this.fileAttribute.id]; const attributeIdToValue = { @@ -113,14 +96,35 @@ export class FileAttributeComponent extends BaseFormComponent implements OnInit this.#toggleEdit(); } - close($event?: MouseEvent): void { - $event?.stopPropagation(); + close(): void { if (this.isInEditMode) { this.form = this.#getForm(); this.#toggleEdit(); } } + @HostListener('document:click') + clickOutside() { + if (this.isInEditMode && this.closedDatepicker) { + this.close(); + } + } + + #initFileAttributes() { + const configs = this._fileAttributesService.getFileAttributeConfig(this.file.dossierTemplateId).fileAttributeConfigs; + configs.forEach(config => (this.file.fileAttributes.attributeIdToValue[config.id] = null)); + } + + #getForm(): UntypedFormGroup { + const config = {}; + const fileAttributes = this.file.fileAttributes.attributeIdToValue; + Object.keys(fileAttributes).forEach(key => { + const attrValue = fileAttributes[key]; + config[key] = [dayjs(attrValue, 'YYYY-MM-DD', true).isValid() ? dayjs(attrValue).toDate() : attrValue]; + }); + return this._formBuilder.group(config); + } + #formatAttributeValue(attrValue) { return this.isDate ? attrValue && dayjs(attrValue).format('YYYY-MM-DD') : attrValue; } @@ -140,11 +144,4 @@ export class FileAttributeComponent extends BaseFormComponent implements OnInit input.focus(); }, 100); } - - @HostListener('document:click') - clickOutside() { - if (this.isInEditMode && this.closedDatepicker) { - this.close(); - } - } } diff --git a/apps/red-ui/src/app/modules/dossier-overview/config.service.ts b/apps/red-ui/src/app/modules/dossier-overview/config.service.ts index 94ccb7e61..2df621d66 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/config.service.ts +++ b/apps/red-ui/src/app/modules/dossier-overview/config.service.ts @@ -157,7 +157,7 @@ export class ConfigService { { id: 'editDossier', label: this._translateService.instant('dossier-overview.header-actions.edit'), - action: $event => this._openEditDossierDialog($event, dossierId), + action: () => this._openEditDossierDialog(dossierId), icon: 'iqser:edit', hide: !this.currentUser.isManager && !this._iqserPermissionsService.has(ROLES.dossiers.edit), helpModeKey: 'edit_dossier_in_dossier', @@ -449,8 +449,8 @@ export class ConfigService { ].map(filter => new NestedFilter(filter)); } - private _openEditDossierDialog($event: MouseEvent, dossierId: string) { - this._dialogService.openDialog('editDossier', $event, { dossierId }); + private _openEditDossierDialog(dossierId: string) { + this._dialogService.openDialog('editDossier', { dossierId }); } private _sortByName(ids: string[]) { diff --git a/apps/red-ui/src/app/modules/dossier-overview/dossier-overview.module.ts b/apps/red-ui/src/app/modules/dossier-overview/dossier-overview.module.ts index 4f3239d04..1be5feb5f 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/dossier-overview.module.ts +++ b/apps/red-ui/src/app/modules/dossier-overview/dossier-overview.module.ts @@ -11,6 +11,7 @@ import { IqserScrollbarModule, IqserUsersModule, StatusBarComponent, + StopPropagationDirective, } from '@iqser/common-ui'; import { TranslateModule } from '@ngx-translate/core'; import { DossierOverviewScreenComponent } from './screen/dossier-overview-screen.component'; @@ -65,6 +66,7 @@ const routes: Routes = [ SharedModule, CircleButtonComponent, StatusBarComponent, + StopPropagationDirective, ], }) export class DossierOverviewModule {} diff --git a/apps/red-ui/src/app/modules/dossier-overview/services/bulk-actions.service.ts b/apps/red-ui/src/app/modules/dossier-overview/services/bulk-actions.service.ts index 6ba3e94ff..53903e51b 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/services/bulk-actions.service.ts +++ b/apps/red-ui/src/app/modules/dossier-overview/services/bulk-actions.service.ts @@ -47,7 +47,6 @@ export class BulkActionsService { delete(files: File[]) { this._dialogService.openDialog( 'confirm', - null, new ConfirmationDialogInput({ title: _('confirmation-dialog.delete-file.title'), question: _('confirmation-dialog.delete-file.question'), @@ -98,7 +97,6 @@ export class BulkActionsService { if (foundAnalysisRequiredFile || foundUpdatedFile) { this._dialogService.openDialog( 'confirm', - null, new ConfirmationDialogInput({ title: foundAnalysisRequiredFile ? _('confirmation-dialog.approve-multiple-files-without-analysis.title') @@ -133,6 +131,6 @@ export class BulkActionsService { } private _assignFiles(files: File[], targetStatus: WorkflowFileStatus, ignoreChanged = false, withUnassignedOption = false): void { - this._dialogService.openDialog('assignFile', null, { targetStatus, files, ignoreChanged, withUnassignedOption }); + this._dialogService.openDialog('assignFile', { targetStatus, files, ignoreChanged, withUnassignedOption }); } } diff --git a/apps/red-ui/src/app/modules/dossiers-listing/config.service.ts b/apps/red-ui/src/app/modules/dossiers-listing/config.service.ts index e50a6e8ef..987a131a5 100644 --- a/apps/red-ui/src/app/modules/dossiers-listing/config.service.ts +++ b/apps/red-ui/src/app/modules/dossiers-listing/config.service.ts @@ -217,7 +217,7 @@ export class ConfigService { } private _openAddDossierDialog(dossierTemplateId: string): void { - this._dialogService.openDialog('addDossier', null, { dossierTemplateId }); + this._dialogService.openDialog('addDossier', { dossierTemplateId }); } private _quickFilters(entities: Dossier[]): NestedFilter[] { diff --git a/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.ts b/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.ts index 9ab4b00e5..1ca7f7ddf 100644 --- a/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossiers-listing/screen/dossiers-listing-screen.component.ts @@ -47,7 +47,7 @@ export class DossiersListingScreenComponent extends ListingComponent im } openAddDossierDialog(): void { - this._dialogService.openDialog('addDossier', null, { dossierTemplateId: this.dossierTemplate.id }); + this._dialogService.openDialog('addDossier', { dossierTemplateId: this.dossierTemplate.id }); } async ngOnInit(): Promise { diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html index 7ac04139c..7702ff635 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html @@ -6,7 +6,7 @@ this._annotations.reduce((acc, annotation) => !hidden.has(annotation.id) && acc, true)), - shareLast(), - ); - constructor( readonly viewModeService: ViewModeService, readonly helpModeService: HelpModeService, @@ -53,6 +48,11 @@ export class AnnotationActionsComponent implements OnChanges { private _annotations: AnnotationWrapper[]; + readonly isVisible$ = this._annotationManager.hidden$.pipe( + map(hidden => this._annotations.reduce((acc, annotation) => !hidden.has(annotation.id) && acc, true)), + shareLast(), + ); + get annotations(): AnnotationWrapper[] { return this._annotations; } @@ -75,43 +75,40 @@ export class AnnotationActionsComponent implements OnChanges { this._setPermissions(); } - removeOrSuggestRemoveAnnotation($event: MouseEvent, removeFromDict: boolean) { - $event.stopPropagation(); - this.annotationActionsService.removeOrSuggestRemoveAnnotation($event, this.annotations, removeFromDict); + removeOrSuggestRemoveAnnotation(removeFromDict: boolean) { + this.annotationActionsService.removeOrSuggestRemoveAnnotation(this.annotations, removeFromDict); } - markAsFalsePositive($event: MouseEvent) { - this.annotationActionsService.markAsFalsePositive($event, this.annotations); + markAsFalsePositive() { + this.annotationActionsService.markAsFalsePositive(this.annotations); } - acceptRecommendation($event: MouseEvent) { - this.annotationActionsService.convertRecommendationToAnnotation($event, this.annotations); + acceptRecommendation() { + this.annotationActionsService.convertRecommendationToAnnotation(this.annotations); } - hideAnnotation($event: MouseEvent) { - $event.stopPropagation(); + hideAnnotation() { this._annotationManager.hide(this.viewerAnnotations); this._annotationManager.deselect(); this._annotationManager.addToHidden(this.viewerAnnotations[0].Id); } - showAnnotation($event: MouseEvent) { - $event.stopPropagation(); + showAnnotation() { this._annotationManager.show(this.viewerAnnotations); this._annotationManager.deselect(); this._annotationManager.removeFromHidden(this.viewerAnnotations[0].Id); } - resize($event: MouseEvent) { - return this.annotationActionsService.resize($event, this.annotations[0]); + resize() { + return this.annotationActionsService.resize(this.annotations[0]); } - acceptResize($event: MouseEvent) { - return this.annotationActionsService.acceptResize($event, this.annotations[0]); + acceptResize() { + return this.annotationActionsService.acceptResize(this.annotations[0]); } - cancelResize($event: MouseEvent) { - return this.annotationActionsService.cancelResize($event, this.annotations[0]); + cancelResize() { + return this.annotationActionsService.cancelResize(this.annotations[0]); } private _setPermissions() { diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.html index 51e8453d4..b4c5a02da 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-wrapper/annotation-wrapper.component.html @@ -10,10 +10,11 @@
{{ annotation.comments.length }} diff --git a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html index 7d566fc69..36f9b2e3e 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.html @@ -8,12 +8,13 @@
@@ -30,5 +31,10 @@ width="full" > -
+
diff --git a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts index 22c1e3e67..2af8ee215 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/comments/comments.component.ts @@ -71,13 +71,11 @@ export class CommentsComponent extends ContextComponent impleme this._loadingService.stop(); } - toggleExpandComments($event?: MouseEvent): void { - $event?.stopPropagation(); + toggleExpandComments(): void { this._commentingService.toggle(this.annotation.id); } - async deleteComment($event: MouseEvent, comment: IComment): Promise { - $event.stopPropagation(); + async deleteComment(comment: IComment): Promise { this._loadingService.start(); const { dossierId, fileId } = this._stateService; await this._manualRedactionService.deleteComment(comment.id, this.annotation.id, dossierId, fileId); diff --git a/apps/red-ui/src/app/modules/file-preview/components/document-info/document-info.component.ts b/apps/red-ui/src/app/modules/file-preview/components/document-info/document-info.component.ts index 9ff04473f..9328d3a55 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/document-info/document-info.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/document-info/document-info.component.ts @@ -56,7 +56,7 @@ export class DocumentInfoComponent extends ContextComponent { } edit(file: File) { - this._dialogService.openDialog('documentInfo', null, file); + this._dialogService.openDialog('documentInfo', file); } isDate(attribute: FileAttribute) { diff --git a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html index 992bf5aa0..eb3cbb197 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/file-workload/file-workload.component.html @@ -214,9 +214,10 @@ diff --git a/apps/red-ui/src/app/modules/file-preview/components/highlights-separator/highlights-separator.component.ts b/apps/red-ui/src/app/modules/file-preview/components/highlights-separator/highlights-separator.component.ts index 0ace5b714..531e7ec32 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/highlights-separator/highlights-separator.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/highlights-separator/highlights-separator.component.ts @@ -31,12 +31,12 @@ export class HighlightsSeparatorComponent { convertHighlights(highlightGroup: EarmarkGroup): void { const data = this._getActionData(highlightGroup, EarmarkOperation.CONVERT); - this._dialogService.openDialog('highlightAction', null, data); + this._dialogService.openDialog('highlightAction', data); } removeHighlights(highlightGroup: EarmarkGroup): void { const data = this._getActionData(highlightGroup, EarmarkOperation.REMOVE); - this._dialogService.openDialog('highlightAction', null, data); + this._dialogService.openDialog('highlightAction', data); } private _getActionData(highlightGroup: EarmarkGroup, operation: EarmarkOperation) { diff --git a/apps/red-ui/src/app/modules/file-preview/components/view-switch/view-switch.component.ts b/apps/red-ui/src/app/modules/file-preview/components/view-switch/view-switch.component.ts index 95c8c4f8a..027169d21 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/view-switch/view-switch.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/view-switch/view-switch.component.ts @@ -80,7 +80,7 @@ export class ViewSwitchComponent { checkboxesValidation: false, }); - return this._dialogService.openDialog('confirm', null, data, result => { + return this._dialogService.openDialog('confirm', data, result => { if (!result) { return; } diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index 73fb3e88f..26becd816 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -320,7 +320,6 @@ export class FilePreviewScreenComponent this.state.dialogRef = this._dialogService.openDialog( 'manualAnnotation', - null, { manualRedactionEntryWrapper, dossierId: this.dossierId, file }, (result: { annotations: ManualRedactionEntryWrapper[]; dictionary?: Dictionary }) => { const selectedAnnotations = this._annotationManager.selected; @@ -422,7 +421,7 @@ export class FilePreviewScreenComponent } openRSSView(file: File) { - this._dialogService.openDialog('rss', null, { file }); + this._dialogService.openDialog('rss', { file }); } loadAnnotations() { @@ -663,7 +662,7 @@ export class FilePreviewScreenComponent }, }); - const ref = this._dialogService.openDialog('confirm', null, data); + const ref = this._dialogService.openDialog('confirm', data); return ref.afterClosed().pipe( switchMap(async (result: ConfirmOptions) => { const doNotShowWarningAgain = result === ConfirmOptions.SECOND_CONFIRM; diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts b/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts index 4b2817e9a..61bc007a8 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview.module.ts @@ -12,7 +12,9 @@ import { IqserScrollbarModule, IqserUploadFileModule, IqserUsersModule, + PreventDefaultDirective, StatusBarComponent, + StopPropagationDirective, } from '@iqser/common-ui'; import { TranslateModule } from '@ngx-translate/core'; import { RouterModule, Routes } from '@angular/router'; @@ -124,6 +126,8 @@ const components = [ IconButtonComponent, EmptyStateComponent, StatusBarComponent, + StopPropagationDirective, + PreventDefaultDirective, ], providers: [FilePreviewDialogService, ManualRedactionService, DocumentUnloadedGuard, SuggestionsService], }) diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index 134622ea8..1d4c5b12a 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -6,7 +6,6 @@ import { getFirstRelevantTextPart } from '../../../utils'; import { Core } from '@pdftron/webviewer'; import { DictionaryEntryTypes, - Dossier, EarmarkOperation, IAddRedactionRequest, ILegalBasisChangeRequest, @@ -16,7 +15,6 @@ import { } from '@red/domain'; import { toPosition } from '../utils/pdf-calculation.utils'; import { AnnotationDrawService } from '../../pdf-viewer/services/annotation-draw.service'; -import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service'; import { AcceptRecommendationData, AcceptRecommendationDialogComponent, @@ -43,18 +41,12 @@ export class AnnotationActionsService { private readonly _documentViewer: REDDocumentViewer, private readonly _annotationManager: REDAnnotationManager, private readonly _annotationDrawService: AnnotationDrawService, - private readonly _activeDossiersService: ActiveDossiersService, private readonly _state: FilePreviewStateService, private readonly _fileDataService: FileDataService, private readonly _skippedService: SkippedService, ) {} - private get _dossier(): Dossier { - return this._activeDossiersService.find(this._state.dossierId); - } - - acceptSuggestion($event: MouseEvent, annotations: AnnotationWrapper[]) { - $event?.stopPropagation(); + acceptSuggestion(annotations: AnnotationWrapper[]) { const { dossierId, fileId } = this._state; const ids = annotations.map(a => a.id); const request = this._manualRedactionService.approve(ids, dossierId, fileId); @@ -63,16 +55,15 @@ export class AnnotationActionsService { removeHighlights(highlights: AnnotationWrapper[]): void { const data = this.#getHighlightOperationData(EarmarkOperation.REMOVE, highlights); - this._dialogService.openDialog('highlightAction', null, data); + this._dialogService.openDialog('highlightAction', data); } convertHighlights(highlights: AnnotationWrapper[]): void { const data = this.#getHighlightOperationData(EarmarkOperation.CONVERT, highlights); - this._dialogService.openDialog('highlightAction', null, data); + this._dialogService.openDialog('highlightAction', data); } - rejectSuggestion($event: MouseEvent, annotations: AnnotationWrapper[]) { - $event?.stopPropagation(); + rejectSuggestion(annotations: AnnotationWrapper[]) { const { dossierId, fileId } = this._state; this.#processObsAndEmit( this._manualRedactionService.declineOrRemove( @@ -84,10 +75,10 @@ export class AnnotationActionsService { ); } - forceAnnotation($event: MouseEvent, annotations: AnnotationWrapper[], hint: boolean = false) { + forceAnnotation(annotations: AnnotationWrapper[], hint: boolean = false) { const { dossierId, fileId } = this._state; - const data = { dossier: this._dossier, annotations, hint }; - this._dialogService.openDialog('forceAnnotation', $event, data, (request: ILegalBasisChangeRequest) => { + const data = { dossier: this._state.dossier, annotations, hint }; + this._dialogService.openDialog('forceAnnotation', data, (request: ILegalBasisChangeRequest) => { this.#processObsAndEmit( this._manualRedactionService.bulkForce( annotations.map(a => ({ ...request, annotationId: a.id })), @@ -99,12 +90,11 @@ export class AnnotationActionsService { }); } - changeLegalBasis($event: MouseEvent, annotations: AnnotationWrapper[]) { + changeLegalBasis(annotations: AnnotationWrapper[]) { const { dossierId, fileId } = this._state; this._dialogService.openDialog( 'changeLegalBasis', - $event, - { annotations, dossier: this._dossier }, + { annotations, dossier: this._state.dossier }, (data: { comment: string; legalBasis: string; section: string; value: string }) => { const body = annotations.map(annotation => ({ annotationId: annotation.id, @@ -119,15 +109,15 @@ export class AnnotationActionsService { ); } - removeOrSuggestRemoveAnnotation($event: MouseEvent, annotations: AnnotationWrapper[], removeFromDictionary: boolean) { + removeOrSuggestRemoveAnnotation(annotations: AnnotationWrapper[], removeFromDictionary: boolean) { const data = { annotationsToRemove: annotations, removeFromDictionary, - dossier: this._dossier, + dossier: this._state.dossier, hint: annotations[0].hintDictionary, }; const { dossierId, fileId } = this._state; - this._dialogService.openDialog('removeAnnotations', $event, data, (result: { comment: string }) => { + this._dialogService.openDialog('removeAnnotations', data, (result: { comment: string }) => { const body = annotations.map(annotation => ({ annotationId: annotation.id, removeFromDictionary, @@ -139,10 +129,10 @@ export class AnnotationActionsService { }); } - recategorizeImages($event: MouseEvent, annotations: AnnotationWrapper[]) { - const data = { annotations, dossier: this._dossier }; + recategorizeImages(annotations: AnnotationWrapper[]) { + const data = { annotations, dossier: this._state.dossier }; const { dossierId, fileId } = this._state; - this._dialogService.openDialog('recategorizeImage', $event, data, ({ comment, type }: { type: string; comment: string }) => { + this._dialogService.openDialog('recategorizeImage', data, ({ comment, type }: { type: string; comment: string }) => { const body: List = annotations.map(({ annotationId }) => ({ annotationId, type, @@ -152,9 +142,7 @@ export class AnnotationActionsService { }); } - undoDirectAction($event: MouseEvent, annotations: AnnotationWrapper[]) { - $event?.stopPropagation(); - + undoDirectAction(annotations: AnnotationWrapper[]) { const { dossierId, fileId } = this._state; const modifyDictionary = annotations[0].isModifyDictionary; this.#processObsAndEmit( @@ -167,9 +155,7 @@ export class AnnotationActionsService { ); } - convertRecommendationToAnnotation($event: any, recommendations: AnnotationWrapper[]) { - $event?.stopPropagation(); - + convertRecommendationToAnnotation(recommendations: AnnotationWrapper[]) { const { dossierId, fileId } = this._state; const dialogRef = this._dialog.open( AcceptRecommendationDialogComponent, @@ -179,19 +165,16 @@ export class AnnotationActionsService { const dialogClosed = dialogRef.afterClosed().pipe(filter(value => !!value && !!value.annotations)); dialogClosed.subscribe(({ annotations, comment: commentText }) => { if (isJustOne(annotations) && this._annotationManager.resizingAnnotationId === annotations[0].id) { - this.cancelResize(null, annotations[0]).then(); + this.cancelResize(annotations[0]).then(); } const comment = commentText ? { text: commentText } : undefined; this.#processObsAndEmit(this._manualRedactionService.addRecommendation(annotations, dossierId, fileId, comment)); }); } - async resize($event: MouseEvent, annotationWrapper: AnnotationWrapper) { - $event?.stopPropagation(); - + async resize(annotationWrapper: AnnotationWrapper) { this._annotationManager.resizingAnnotationId = annotationWrapper.id; - const viewerAnnotation = this._annotationManager.get(annotationWrapper); if (annotationWrapper.rectangle || annotationWrapper.imported || annotationWrapper.isImage) { this._annotationManager.delete(annotationWrapper); const rectangleAnnotation = this.#generateRectangle(annotationWrapper); @@ -199,6 +182,7 @@ export class AnnotationActionsService { return; } + const viewerAnnotation = this._annotationManager.get(annotationWrapper); viewerAnnotation.ReadOnly = false; viewerAnnotation.Hidden = false; viewerAnnotation.disableRotationControl(); @@ -206,7 +190,7 @@ export class AnnotationActionsService { this._annotationManager.select(viewerAnnotation); } - async acceptResize($event: MouseEvent, annotation: AnnotationWrapper): Promise { + async acceptResize(annotation: AnnotationWrapper): Promise { const textAndPositions = await this.#extractTextAndPositions(annotation.id); if (annotation.isRecommendation) { const recommendation = { @@ -214,14 +198,14 @@ export class AnnotationActionsService { value: textAndPositions.text, positions: textAndPositions.positions, } as AnnotationWrapper; - return this.convertRecommendationToAnnotation($event, [recommendation]); + return this.convertRecommendationToAnnotation([recommendation]); } const isImageText = annotation.isImage ? 'Image' : textAndPositions.text; const text = annotation.rectangle ? annotation.value : isImageText; const data = { annotation, text }; - this._dialogService.openDialog('resizeAnnotation', $event, data, (result: { comment: string; updateDictionary: boolean }) => { + this._dialogService.openDialog('resizeAnnotation', data, (result: { comment: string; updateDictionary: boolean }) => { const resizeRequest: IResizeRequest = { annotationId: annotation.id, comment: result.comment, @@ -230,7 +214,7 @@ export class AnnotationActionsService { updateDictionary: result.updateDictionary, }; - this.cancelResize(null, annotation).then(); + this.cancelResize(annotation).then(); const { fileId, dossierId } = this._state; const request = this._manualRedactionService.resizeOrSuggestResize([resizeRequest], dossierId, fileId); @@ -238,20 +222,15 @@ export class AnnotationActionsService { }); } - async cancelResize($event: MouseEvent, annotationWrapper: AnnotationWrapper) { - $event?.stopPropagation(); - + async cancelResize(annotationWrapper: AnnotationWrapper) { this._annotationManager.resizingAnnotationId = undefined; - this._annotationManager.delete(annotationWrapper); await this._annotationDrawService.draw([annotationWrapper], this._skippedService.hideSkipped, this._state.dossierTemplateId); this._annotationManager.deselect(); await this._fileDataService.annotationsChanged(); } - markAsFalsePositive($event: MouseEvent, annotations: AnnotationWrapper[]) { - $event?.stopPropagation(); - + markAsFalsePositive(annotations: AnnotationWrapper[]) { const requests: List = annotations.map(annotation => ({ sourceId: annotation.id, value: this._getFalsePositiveText(annotation), @@ -301,6 +280,7 @@ export class AnnotationActionsService { } #processObsAndEmit(obs: Observable) { + // TODO: remove observables and use promises instead obs.subscribe({ next: () => this._fileDataService.annotationsChanged(), error: () => this._fileDataService.annotationsChanged(), diff --git a/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts index f1bc826ef..9feac270f 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts @@ -1,7 +1,7 @@ import { inject, Injectable, NgZone } from '@angular/core'; -import { AnnotationWrapper } from '../../../models/file/annotation.wrapper'; -import { AnnotationPermissions } from '../../../models/file/annotation.permissions'; -import { PermissionsService } from '../../../services/permissions.service'; +import { AnnotationWrapper } from '@models/file/annotation.wrapper'; +import { AnnotationPermissions } from '@models/file/annotation.permissions'; +import { PermissionsService } from '@services/permissions.service'; import { FilePreviewStateService } from './file-preview-state.service'; import { TranslateService } from '@ngx-translate/core'; import { AnnotationActionsService } from './annotation-actions.service'; @@ -32,17 +32,17 @@ export class PdfAnnotationActionsService { // if we already entered resize-mode previously if (firstAnnotation.id === this.#annotationManager.resizingAnnotationId) { const acceptResizeButton = this.#getButton('check', _('annotation-actions.resize-accept.label'), () => - this.#annotationActionsService.acceptResize(null, firstAnnotation), + this.#annotationActionsService.acceptResize(firstAnnotation), ); const cancelResizeButton = this.#getButton('close', _('annotation-actions.resize-cancel.label'), () => - this.#annotationActionsService.cancelResize(null, firstAnnotation), + this.#annotationActionsService.cancelResize(firstAnnotation), ); return [acceptResizeButton, cancelResizeButton]; } const resizeButton = this.#getButton('resize', _('annotation-actions.resize.label'), () => - this.#annotationActionsService.resize(null, firstAnnotation), + this.#annotationActionsService.resize(firstAnnotation), ); availableActions.push(resizeButton); @@ -50,14 +50,14 @@ export class PdfAnnotationActionsService { if (permissions.canChangeLegalBasis) { const editButton = this.#getButton('edit', _('annotation-actions.edit-reason.label'), () => - this.#annotationActionsService.changeLegalBasis(null, annotations), + this.#annotationActionsService.changeLegalBasis(annotations), ); availableActions.push(editButton); } if (permissions.canRecategorizeImage) { const recategorizeButton = this.#getButton('thumb-down', _('annotation-actions.recategorize-image'), () => - this.#annotationActionsService.recategorizeImages(null, annotations), + this.#annotationActionsService.recategorizeImages(annotations), ); availableActions.push(recategorizeButton); } @@ -66,56 +66,56 @@ export class PdfAnnotationActionsService { const removeFromDictButton = this.#getButton( 'remove-from-dict', _('annotation-actions.remove-annotation.remove-from-dict'), - () => this.#annotationActionsService.removeOrSuggestRemoveAnnotation(null, annotations, true), + () => this.#annotationActionsService.removeOrSuggestRemoveAnnotation(annotations, true), ); availableActions.push(removeFromDictButton); } if (permissions.canAcceptRecommendation) { const acceptRecommendationButton = this.#getButton('check', _('annotation-actions.accept-recommendation.label'), () => - this.#annotationActionsService.convertRecommendationToAnnotation(null, annotations), + this.#annotationActionsService.convertRecommendationToAnnotation(annotations), ); availableActions.push(acceptRecommendationButton); } if (permissions.canAcceptSuggestion) { const acceptSuggestionButton = this.#getButton('check', _('annotation-actions.accept-suggestion.label'), () => - this.#annotationActionsService.acceptSuggestion(null, annotations), + this.#annotationActionsService.acceptSuggestion(annotations), ); availableActions.push(acceptSuggestionButton); } if (permissions.canUndo) { const undoButton = this.#getButton('undo', _('annotation-actions.undo'), () => - this.#annotationActionsService.undoDirectAction(null, annotations), + this.#annotationActionsService.undoDirectAction(annotations), ); availableActions.push(undoButton); } if (permissions.canMarkAsFalsePositive) { const markAsFalsePositiveButton = this.#getButton('thumb-down', _('annotation-actions.remove-annotation.false-positive'), () => - this.#annotationActionsService.markAsFalsePositive(null, annotations), + this.#annotationActionsService.markAsFalsePositive(annotations), ); availableActions.push(markAsFalsePositiveButton); } if (permissions.canForceRedaction) { const forceRedactionButton = this.#getButton('thumb-up', _('annotation-actions.force-redaction.label'), () => - this.#annotationActionsService.forceAnnotation(null, annotations), + this.#annotationActionsService.forceAnnotation(annotations), ); availableActions.push(forceRedactionButton); } if (permissions.canForceHint) { const forceHintButton = this.#getButton('thumb-up', _('annotation-actions.force-hint.label'), () => - this.#annotationActionsService.forceAnnotation(null, annotations, true), + this.#annotationActionsService.forceAnnotation(annotations, true), ); availableActions.push(forceHintButton); } if (permissions.canRejectSuggestion) { const rejectSuggestionButton = this.#getButton('close', _('annotation-actions.reject-suggestion'), () => - this.#annotationActionsService.rejectSuggestion(null, annotations), + this.#annotationActionsService.rejectSuggestion(annotations), ); availableActions.push(rejectSuggestionButton); } @@ -124,7 +124,7 @@ export class PdfAnnotationActionsService { const removeOrSuggestToRemoveOnlyHereButton = this.#getButton( 'trash', _('annotation-actions.remove-annotation.only-here'), - () => this.#annotationActionsService.removeOrSuggestRemoveAnnotation(null, annotations, false), + () => this.#annotationActionsService.removeOrSuggestRemoveAnnotation(annotations, false), ); availableActions.push(removeOrSuggestToRemoveOnlyHereButton); } diff --git a/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts b/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts index b283a4e07..e3c3c2045 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/pdf-proxy.service.ts @@ -191,7 +191,7 @@ export class PdfProxyService { return; } - this._annotationsActionsService.cancelResize(null, wrapper).then(); + this._annotationsActionsService.cancelResize(wrapper).then(); } #configureAnnotationSpecificActions(viewerAnnotations: Annotation[]) { diff --git a/apps/red-ui/src/app/modules/file-preview/services/skipped.service.ts b/apps/red-ui/src/app/modules/file-preview/services/skipped.service.ts index fa6e81fde..a59e962c9 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/skipped.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/skipped.service.ts @@ -21,9 +21,7 @@ export class SkippedService { return this.#hideSkipped$.value; } - toggleSkipped($event): void { - $event.stopPropagation(); - $event.preventDefault(); + toggleSkipped(): void { this.#hideSkipped$.next(!this.hideSkipped); } diff --git a/apps/red-ui/src/app/modules/pdf-viewer/components/compare-file-input/compare-file-input.component.ts b/apps/red-ui/src/app/modules/pdf-viewer/components/compare-file-input/compare-file-input.component.ts index aaa5c0ad2..1ec58135e 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/components/compare-file-input/compare-file-input.component.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/components/compare-file-input/compare-file-input.component.ts @@ -83,7 +83,6 @@ export class CompareFileInputComponent { #askForConfirmation(fileName: string, currentDocumentPageCount: number, compareDocumentPageCount: number) { const ref: MatDialogRef = this._dialogService.openDialog( 'confirm', - null, new ConfirmationDialogInput({ title: _('confirmation-dialog.compare-file.title'), question: _('confirmation-dialog.compare-file.question'), diff --git a/apps/red-ui/src/app/modules/search/search-item-template/search-item-template.component.html b/apps/red-ui/src/app/modules/search/search-item-template/search-item-template.component.html index d4e9ea51f..8c52a91f4 100644 --- a/apps/red-ui/src/app/modules/search/search-item-template/search-item-template.component.html +++ b/apps/red-ui/src/app/modules/search/search-item-template/search-item-template.component.html @@ -22,7 +22,7 @@ {{ 'search-screen.missing' | translate }}: {{ term }}. {{ 'search-screen.must-contain' | translate }}: -  {{ term }} diff --git a/apps/red-ui/src/app/modules/search/search.module.ts b/apps/red-ui/src/app/modules/search/search.module.ts index 94862be23..160d2a5bb 100644 --- a/apps/red-ui/src/app/modules/search/search.module.ts +++ b/apps/red-ui/src/app/modules/search/search.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { SearchScreenComponent } from './search-screen/search-screen.component'; import { RouterModule } from '@angular/router'; -import { IqserListingModule, IqserUsersModule, StatusBarComponent } from '@iqser/common-ui'; +import { IqserListingModule, IqserUsersModule, StatusBarComponent, StopPropagationDirective } from '@iqser/common-ui'; import { SharedModule } from '@shared/shared.module'; import { TranslateModule } from '@ngx-translate/core'; import { SearchItemTemplateComponent } from './search-item-template/search-item-template.component'; @@ -19,6 +19,7 @@ const routes = [{ path: '', component: SearchScreenComponent }]; TranslateModule, IqserListingModule, StatusBarComponent, + StopPropagationDirective, ], }) export class SearchModule {} diff --git a/apps/red-ui/src/app/modules/shared-dossiers/components/dossiers-listing-actions/dossiers-listing-actions.component.html b/apps/red-ui/src/app/modules/shared-dossiers/components/dossiers-listing-actions/dossiers-listing-actions.component.html index 6661fb648..dd634a0c5 100644 --- a/apps/red-ui/src/app/modules/shared-dossiers/components/dossiers-listing-actions/dossiers-listing-actions.component.html +++ b/apps/red-ui/src/app/modules/shared-dossiers/components/dossiers-listing-actions/dossiers-listing-actions.component.html @@ -1,6 +1,6 @@
{ - $event.stopPropagation(); + async reanalyseDossier(dossier: Dossier): Promise { await this._reanalysisService.reanalyzeDossier(dossier); } } diff --git a/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.ts b/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.ts index e693b56d4..17ac0c541 100644 --- a/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.ts +++ b/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.ts @@ -125,7 +125,7 @@ export class FileActionsComponent implements OnChanges { { id: 'delete-file-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._openDeleteFileDialog($event), + action: () => this._openDeleteFileDialog(), tooltip: _('dossier-overview.delete.action'), icon: 'iqser:trash', show: this.showDelete, @@ -133,7 +133,7 @@ export class FileActionsComponent implements OnChanges { { id: 'assign-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._assign($event), + action: () => this._assign(), tooltip: this.assignTooltip, icon: 'red:assign', show: this.showAssign, @@ -141,7 +141,7 @@ export class FileActionsComponent implements OnChanges { { id: 'assign-to-me-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._assignToMe($event), + action: () => this._assignToMe(), tooltip: _('dossier-overview.assign-me'), icon: 'red:assign-me', show: this.showAssignToSelf, @@ -149,7 +149,7 @@ export class FileActionsComponent implements OnChanges { { id: 'open-import-redactions-dialog-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._openImportRedactionsDialog($event), + action: () => this._openImportRedactionsDialog(), tooltip: _('dossier-overview.import-redactions'), icon: 'red:import_redactions', show: this.showImportRedactions && !this._iqserPermissionsService.has(ROLES.getRss), @@ -188,7 +188,7 @@ export class FileActionsComponent implements OnChanges { { id: 'set-file-to-new-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this.#setToNew($event), + action: () => this.#setToNew(), tooltip: _('dossier-overview.back-to-new'), icon: 'red:undo', show: this.showSetToNew, @@ -196,7 +196,7 @@ export class FileActionsComponent implements OnChanges { { id: 'set-file-under-approval-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._setFileUnderApproval($event), + action: () => this._setFileUnderApproval(), tooltip: _('dossier-overview.under-approval'), icon: 'red:ready-for-approval', show: this.showUnderApproval, @@ -204,7 +204,7 @@ export class FileActionsComponent implements OnChanges { { id: 'set-file-under-review-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._setFileUnderReview($event), + action: () => this._setFileUnderReview(), tooltip: _('dossier-overview.under-review'), icon: 'red:undo', show: this.showUnderReview, @@ -212,7 +212,7 @@ export class FileActionsComponent implements OnChanges { { id: 'set-file-approved-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this.setFileApproved($event), + action: () => this.setFileApproved(), tooltip: this.file.canBeApproved ? _('dossier-overview.approve') : _('dossier-overview.approve-disabled'), icon: 'red:approved', disabled: !this.file.canBeApproved, @@ -221,7 +221,7 @@ export class FileActionsComponent implements OnChanges { { id: 'toggle-automatic-analysis-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._toggleAutomaticAnalysis($event), + action: () => this._toggleAutomaticAnalysis(), tooltip: _('dossier-overview.stop-auto-analysis'), icon: 'red:disable-analysis', show: this.canDisableAutoAnalysis, @@ -229,7 +229,7 @@ export class FileActionsComponent implements OnChanges { { id: 'reanalyse-file-preview-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._reanalyseFile($event), + action: () => this._reanalyseFile(), tooltip: _('file-preview.reanalyse-notification'), tooltipClass: 'small', icon: 'iqser:refresh', @@ -239,7 +239,7 @@ export class FileActionsComponent implements OnChanges { { id: 'toggle-automatic-analysis-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._toggleAutomaticAnalysis($event), + action: () => this._toggleAutomaticAnalysis(), tooltip: _('dossier-overview.start-auto-analysis'), buttonType: this.isFilePreview ? CircleButtonTypes.warn : CircleButtonTypes.default, icon: 'red:enable-analysis', @@ -248,7 +248,7 @@ export class FileActionsComponent implements OnChanges { { id: 'set-under-approval-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._setFileUnderApproval($event), + action: () => this._setFileUnderApproval(), tooltip: _('dossier-overview.under-approval'), icon: 'red:undo', show: this.showUndoApproval, @@ -256,7 +256,7 @@ export class FileActionsComponent implements OnChanges { { id: 'ocr-file-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._ocrFile($event), + action: () => this._ocrFile(), tooltip: _('dossier-overview.ocr-file'), icon: 'iqser:ocr', show: this.showOCR, @@ -264,7 +264,7 @@ export class FileActionsComponent implements OnChanges { { id: 'reanalyse-file-btn-' + fileId, type: ActionTypes.circleBtn, - action: ($event: MouseEvent) => this._reanalyseFile($event), + action: () => this._reanalyseFile(), tooltip: _('dossier-overview.reanalyse.action'), icon: 'iqser:refresh', show: this.showReanalyseDossierOverview, @@ -292,8 +292,7 @@ export class FileActionsComponent implements OnChanges { } } - async setFileApproved($event: MouseEvent) { - $event.stopPropagation(); + async setFileApproved() { if (!this.file.analysisRequired && !this.file.hasUpdates) { await this.#setFileApproved(); return; @@ -301,7 +300,6 @@ export class FileActionsComponent implements OnChanges { this._dialogService.openDialog( 'confirm', - $event, new ConfirmationDialogInput({ title: this.file.analysisRequired ? _('confirmation-dialog.approve-file-without-analysis.title') @@ -330,18 +328,17 @@ export class FileActionsComponent implements OnChanges { denyText: _('ocr.confirmation-dialog.cancel'), }); - const ref = this._dialogService.openDialog('confirm', null, data); + const ref = this._dialogService.openDialog('confirm', data); return ref.afterClosed(); } - private _openImportRedactionsDialog($event: MouseEvent) { - this._dialogService.openDialog('importRedactions', $event, { dossierId: this.file.dossierId, fileId: this.file.fileId }); + private _openImportRedactionsDialog() { + this._dialogService.openDialog('importRedactions', { dossierId: this.file.dossierId, fileId: this.file.fileId }); } - private _openDeleteFileDialog($event: MouseEvent) { + private _openDeleteFileDialog() { this._dialogService.openDialog( 'confirm', - $event, new ConfirmationDialogInput({ title: _('confirmation-dialog.delete-file.title'), question: _('confirmation-dialog.delete-file.question'), @@ -360,21 +357,19 @@ export class FileActionsComponent implements OnChanges { ); } - private _assign($event: MouseEvent) { + private _assign() { const files = [this.file]; const targetStatus = this.file.workflowStatus; const withCurrentUserAsDefault = true; const withUnassignedOption = true; - this._dialogService.openDialog('assignFile', $event, { targetStatus, files, withCurrentUserAsDefault, withUnassignedOption }); + this._dialogService.openDialog('assignFile', { targetStatus, files, withCurrentUserAsDefault, withUnassignedOption }); } - private async _assignToMe($event: MouseEvent) { - $event.stopPropagation(); + private async _assignToMe() { await this._fileAssignService.assignToMe([this.file]); } - private async _reanalyseFile($event?: MouseEvent) { - $event?.stopPropagation(); + private async _reanalyseFile() { const params: ReanalyzeQueryParams = { force: true, triggeredByUser: true, @@ -382,20 +377,17 @@ export class FileActionsComponent implements OnChanges { await firstValueFrom(this._reanalysisService.reanalyzeFilesForDossier([this.file], this.file.dossierId, params)); } - private async _toggleAutomaticAnalysis($event: MouseEvent) { - $event.stopPropagation(); + private async _toggleAutomaticAnalysis() { this._loadingService.start(); await firstValueFrom(this._reanalysisService.toggleAutomaticAnalysis(this.file.dossierId, [this.file])); this._loadingService.stop(); } - private async _setFileUnderApproval($event: MouseEvent) { - $event.stopPropagation(); - await this._fileAssignService.assignApprover($event, this.file, true); + private async _setFileUnderApproval() { + await this._fileAssignService.assignApprover(this.file, true); } - private async _ocrFile($event: MouseEvent) { - $event.stopPropagation(); + private async _ocrFile() { if (this.file.lastManualChangeDate) { const confirm = await firstValueFrom(this.#showOCRConfirmationDialog()); if (!confirm) { @@ -413,8 +405,8 @@ export class FileActionsComponent implements OnChanges { this._loadingService.stop(); } - private async _setFileUnderReview($event: MouseEvent) { - await this._fileAssignService.assignReviewer($event, this.file, true); + private async _setFileUnderReview() { + await this._fileAssignService.assignReviewer(this.file, true); } private async _toggleAnalysis() { @@ -475,8 +467,7 @@ export class FileActionsComponent implements OnChanges { this._loadingService.stop(); } - async #setToNew($event: MouseEvent) { - $event.stopPropagation(); + async #setToNew() { this._loadingService.start(); await this._filesService.setToNew(this.file); this._loadingService.stop(); diff --git a/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/dictionary/edit-dossier-dictionary.component.ts b/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/dictionary/edit-dossier-dictionary.component.ts index 63a7e45e7..32660e26c 100644 --- a/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/dictionary/edit-dossier-dictionary.component.ts +++ b/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/dictionary/edit-dossier-dictionary.component.ts @@ -74,7 +74,7 @@ export class EditDossierDictionaryComponent implements EditDossierSectionInterfa openEditDetailsDialog(): void { const data = { dictionary: this.dossierDictionary, dossierId: this.dossier.id, readOnly: !this.canEdit }; - this._dialogService.openDialog('editDictionaryDetails', null, data, async () => { + this._dialogService.openDialog('editDictionaryDetails', data, async () => { await this._updateDossierDictionary(); }); } diff --git a/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.html b/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.html index b4d769083..2ed9ecb93 100644 --- a/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.html +++ b/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dossier-dialog/edit-dossier-team/edit-dossier-team.component.html @@ -62,9 +62,10 @@
{ + this._dialogService.openDialog('confirm', data, async () => { this._loadingService.start(); await firstValueFrom(this._trashService.deleteDossier(this.dossier)); this._editDossierDialogRef.close(); @@ -165,7 +165,7 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti checkboxes: [{ value: false, label: _('confirm-archive-dossier.checkbox.documents') }], toastMessage: _('confirm-archive-dossier.toast-error'), }); - this._dialogService.openDialog('confirm', null, data, async result => { + this._dialogService.openDialog('confirm', data, async result => { if (result === ConfirmOptions.CONFIRM) { this._loadingService.start(); await firstValueFrom(this._archivedDossiersService.archive([this.dossier])); diff --git a/apps/red-ui/src/app/modules/shared-dossiers/services/file-assign.service.ts b/apps/red-ui/src/app/modules/shared-dossiers/services/file-assign.service.ts index c378a33a0..c08092eae 100644 --- a/apps/red-ui/src/app/modules/shared-dossiers/services/file-assign.service.ts +++ b/apps/red-ui/src/app/modules/shared-dossiers/services/file-assign.service.ts @@ -40,24 +40,22 @@ export class FileAssignService { ? _('confirmation-dialog.assign-file-to-me.question.single') : _('confirmation-dialog.assign-file-to-me.question.multiple'), }); - const ref = this._dialogService.openDialog('confirm', null, dialogInput, assignReq); + const ref = this._dialogService.openDialog('confirm', dialogInput, assignReq); return firstValueFrom(ref.afterClosed()); } return assignReq(); } - async assignReviewer($event: MouseEvent, file: File, ignoreChanged = false): Promise { - await this._assignFile(WorkflowFileStatuses.UNDER_REVIEW, $event, file, ignoreChanged); + async assignReviewer(file: File, ignoreChanged = false): Promise { + await this._assignFile(WorkflowFileStatuses.UNDER_REVIEW, file, ignoreChanged); } - async assignApprover($event: MouseEvent, file: File, ignoreChanged = false): Promise { - await this._assignFile(WorkflowFileStatuses.UNDER_APPROVAL, $event, file, ignoreChanged); + async assignApprover(file: File, ignoreChanged = false): Promise { + await this._assignFile(WorkflowFileStatuses.UNDER_APPROVAL, file, ignoreChanged); } - private async _assignFile(targetStatus: WorkflowFileStatus, $event: MouseEvent, file: File, ignoreChanged = false): Promise { - $event?.stopPropagation(); - + private async _assignFile(targetStatus: WorkflowFileStatus, file: File, ignoreChanged = false): Promise { const currentUserId = this.currentUser.id; const currentDossier = this._activeDossiersService.find(file.dossierId); const eligibleUsersIds = this._getUserIds(targetStatus, currentDossier); @@ -71,14 +69,14 @@ export class FileAssignService { await this._makeAssignFileRequest(eligibleUsersIds[0], targetStatus, [file]); } else { const data = { targetStatus, files: [file], ignoreChanged }; - this._dialogService.openDialog('assignFile', null, data); + this._dialogService.openDialog('assignFile', data); } } else { if (eligibleUsersIds.length === 1) { await this._makeAssignFileRequest(eligibleUsersIds[0], targetStatus, [file]); } else { const data = { targetStatus, files: [file], ignoreChanged, withCurrentUserAsDefault: true }; - this._dialogService.openDialog('assignFile', null, data); + this._dialogService.openDialog('assignFile', data); } } } diff --git a/apps/red-ui/src/app/modules/shared-dossiers/shared-dossiers.module.ts b/apps/red-ui/src/app/modules/shared-dossiers/shared-dossiers.module.ts index e4538aff3..4d588cdd8 100644 --- a/apps/red-ui/src/app/modules/shared-dossiers/shared-dossiers.module.ts +++ b/apps/red-ui/src/app/modules/shared-dossiers/shared-dossiers.module.ts @@ -24,6 +24,7 @@ import { SideNavComponent, SmallChipComponent, StatusBarComponent, + StopPropagationDirective, } from '@iqser/common-ui'; import { TranslateModule } from '@ngx-translate/core'; import { DossiersListingActionsComponent } from './components/dossiers-listing-actions/dossiers-listing-actions.component'; @@ -61,6 +62,7 @@ const services = [FileAssignService]; SmallChipComponent, StatusBarComponent, SideNavComponent, + StopPropagationDirective, ], }) export class SharedDossiersModule {} diff --git a/apps/red-ui/src/app/modules/shared/components/buttons/file-download-btn/file-download-btn.component.html b/apps/red-ui/src/app/modules/shared/components/buttons/file-download-btn/file-download-btn.component.html index ffeba8738..2df56956c 100644 --- a/apps/red-ui/src/app/modules/shared/components/buttons/file-download-btn/file-download-btn.component.html +++ b/apps/red-ui/src/app/modules/shared/components/buttons/file-download-btn/file-download-btn.component.html @@ -1,5 +1,5 @@ (DownloadDialogComponent, { ...defaultDialogConfig, data: { dossier: this.dossier, files: this.files }, diff --git a/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.html b/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.html index 39f50ccd1..65c3a6068 100644 --- a/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.html +++ b/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.html @@ -29,7 +29,6 @@
diff --git a/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.ts b/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.ts index 62f6e255f..abf7722c2 100644 --- a/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/expandable-file-actions/expandable-file-actions.component.ts @@ -70,7 +70,7 @@ export class ExpandableFileActionsComponent implements OnChanges { // Patch download button const downloadBtn = this.actions.find(btn => btn.type === ActionTypes.downloadBtn); if (downloadBtn) { - downloadBtn.action = ($event: MouseEvent) => this._downloadFiles($event, downloadBtn.files, downloadBtn.dossier); + downloadBtn.action = () => this._downloadFiles(downloadBtn.files, downloadBtn.dossier); downloadBtn.disabled = !this._permissionsService.canDownloadFiles(downloadBtn.files, downloadBtn.dossier); } } @@ -81,8 +81,8 @@ export class ExpandableFileActionsComponent implements OnChanges { this.matMenu.closeMenu(); } - private async _downloadFiles($event: MouseEvent, files: File[], dossier: Dossier) { - $event.stopPropagation(); + // TODO: this doesn't look like its called + private async _downloadFiles(files: File[], dossier: Dossier) { const ref = this._dialog.open(DownloadDialogComponent, { ...defaultDialogConfig, data: { dossier, files }, diff --git a/apps/red-ui/src/app/modules/shared/components/select/select.component.html b/apps/red-ui/src/app/modules/shared/components/select/select.component.html index fc01a781b..ebdd68eaf 100644 --- a/apps/red-ui/src/app/modules/shared/components/select/select.component.html +++ b/apps/red-ui/src/app/modules/shared/components/select/select.component.html @@ -1,11 +1,18 @@
{{ label }}
-
+
diff --git a/apps/red-ui/src/app/modules/shared/components/select/select.component.ts b/apps/red-ui/src/app/modules/shared/components/select/select.component.ts index 89a498516..58c32dd71 100644 --- a/apps/red-ui/src/app/modules/shared/components/select/select.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/select/select.component.ts @@ -85,8 +85,7 @@ export class SelectComponent implements AfterViewInit, ControlValueAccessor { this.disabled = isDisabled; } - selectAll($event) { - $event.stopPropagation(); + selectAll() { this.chipList._chips.forEach(chip => { if (!chip.selected) { chip.toggleSelected(true); @@ -94,8 +93,7 @@ export class SelectComponent implements AfterViewInit, ControlValueAccessor { }); } - deselectAll($event?) { - $event?.stopPropagation(); + deselectAll() { this.chipList._chips.forEach(chip => { if (chip.selected) { chip.toggleSelected(true); diff --git a/apps/red-ui/src/app/modules/shared/components/team-members/team-members.component.ts b/apps/red-ui/src/app/modules/shared/components/team-members/team-members.component.ts index f558da526..0cb3ffa41 100644 --- a/apps/red-ui/src/app/modules/shared/components/team-members/team-members.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/team-members/team-members.component.ts @@ -51,6 +51,6 @@ export class TeamMembersComponent { openEditDossierDialog(): void { const data = { dossierId: this.dossierId, section: 'members' }; - this._dialogService.openDialog('editDossier', null, data); + this._dialogService.openDialog('editDossier', data); } } diff --git a/apps/red-ui/src/app/modules/shared/dialogs/add-dossier-dialog/add-dossier-dialog.component.ts b/apps/red-ui/src/app/modules/shared/dialogs/add-dossier-dialog/add-dossier-dialog.component.ts index 9ef2c57f5..fb048bf13 100644 --- a/apps/red-ui/src/app/modules/shared/dialogs/add-dossier-dialog/add-dossier-dialog.component.ts +++ b/apps/red-ui/src/app/modules/shared/dialogs/add-dossier-dialog/add-dossier-dialog.component.ts @@ -84,7 +84,7 @@ export class AddDossierDialogComponent extends BaseDialogComponent implements On if (savedDossier) { await this._router.navigate([savedDossier.routerLink]); if (options?.addMembers) { - this._dialogService.openDialog('editDossier', null, { + this._dialogService.openDialog('editDossier', { dossierId: savedDossier.id, section: 'members', }); diff --git a/apps/red-ui/src/app/modules/shared/shared.module.ts b/apps/red-ui/src/app/modules/shared/shared.module.ts index c423823d2..c36db9458 100644 --- a/apps/red-ui/src/app/modules/shared/shared.module.ts +++ b/apps/red-ui/src/app/modules/shared/shared.module.ts @@ -16,6 +16,7 @@ import { IqserScrollbarModule, IqserUsersModule, SmallChipComponent, + StopPropagationDirective, } from '@iqser/common-ui'; import { SelectComponent } from './components/select/select.component'; import { NavigateLastDossiersScreenDirective } from './directives/navigate-last-dossiers-screen.directive'; @@ -95,6 +96,7 @@ const deleteThisWhenAllComponentsAreStandalone = [DonutChartComponent]; CircleButtonComponent, IconButtonComponent, SmallChipComponent, + StopPropagationDirective, ], exports: [...modules, ...components, ...utils, ...deleteThisWhenAllComponentsAreStandalone], providers: [ diff --git a/apps/red-ui/src/app/modules/trash/services/trash-dialog.service.ts b/apps/red-ui/src/app/modules/trash/services/trash-dialog.service.ts index 9ef73d9d6..f325f5636 100644 --- a/apps/red-ui/src/app/modules/trash/services/trash-dialog.service.ts +++ b/apps/red-ui/src/app/modules/trash/services/trash-dialog.service.ts @@ -41,7 +41,8 @@ export class TrashDialogService extends DialogService { itemsCount: items.length, }, }); - this.openDialog('confirm', null, data, async () => { + + this.openDialog('confirm', data, async () => { this._loadingService.start(); await firstValueFrom(this._trashService.hardDelete(items)); this._loadingService.stop(); diff --git a/libs/common-ui b/libs/common-ui index 655874989..a2e40583e 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 655874989bafa3b7017ceb94e1088c7f9fddd0a5 +Subproject commit a2e40583e3b3f731cee202bd621545994a87ff7f