@acorex-platform/module-common-client 0.0.18 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{acorex-platform-module-common-client-acorex-platform-module-common-client-rqWzT7RI.mjs → acorex-platform-module-common-client-acorex-platform-module-common-client-CkeshVWo.mjs} +765 -417
- package/fesm2022/acorex-platform-module-common-client-acorex-platform-module-common-client-CkeshVWo.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-common-client-archive-entity.command-CKENj9Od.mjs → acorex-platform-module-common-client-archive-entity.command-BZgNdxFS.mjs} +9 -13
- package/fesm2022/acorex-platform-module-common-client-archive-entity.command-BZgNdxFS.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-common-client-archive-entity.command.util-BZrXDNGP.mjs → acorex-platform-module-common-client-archive-entity.command.util-BVrK8ZGy.mjs} +52 -40
- package/fesm2022/acorex-platform-module-common-client-archive-entity.command.util-BVrK8ZGy.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-common-client-audit-info-column.component-DuZUwD31.mjs → acorex-platform-module-common-client-audit-info-column.component-CsqKKwwF.mjs} +27 -16
- package/fesm2022/acorex-platform-module-common-client-audit-info-column.component-CsqKKwwF.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-common-client-audit-info-edit.component-CSsCG6Dz.mjs → acorex-platform-module-common-client-audit-info-edit.component-COMMBgsX.mjs} +20 -18
- package/fesm2022/acorex-platform-module-common-client-audit-info-edit.component-COMMBgsX.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-common-client-audit-info-view.component-WYXsZcLg.mjs → acorex-platform-module-common-client-audit-info-view.component-UOTT-ir_.mjs} +20 -18
- package/fesm2022/acorex-platform-module-common-client-audit-info-view.component-UOTT-ir_.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-common-client-bulk-archive-entity.command-EIlMyuII.mjs +66 -0
- package/fesm2022/acorex-platform-module-common-client-bulk-archive-entity.command-EIlMyuII.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-common-client-bulk-disable-entity.command-DgoZVXQA.mjs +65 -0
- package/fesm2022/acorex-platform-module-common-client-bulk-disable-entity.command-DgoZVXQA.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-common-client-bulk-enable-entity.command-C6fba__g.mjs +65 -0
- package/fesm2022/acorex-platform-module-common-client-bulk-enable-entity.command-C6fba__g.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-common-client-bulk-restore-archive-entity.command-C8T0gUAH.mjs +65 -0
- package/fesm2022/acorex-platform-module-common-client-bulk-restore-archive-entity.command-C8T0gUAH.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-common-client-clone-entity.command-DFgIeWxX.mjs → acorex-platform-module-common-client-clone-entity.command-rTasIhWx.mjs} +26 -27
- package/fesm2022/acorex-platform-module-common-client-clone-entity.command-rTasIhWx.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-common-client-contracts.mjs +420 -8
- package/fesm2022/acorex-platform-module-common-client-contracts.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-common-client-disable-entity.command-DWyqAAwo.mjs → acorex-platform-module-common-client-disable-entity.command-Bc1uH38V.mjs} +8 -13
- package/fesm2022/acorex-platform-module-common-client-disable-entity.command-Bc1uH38V.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-common-client-disable-entity.command.util-BBwY9Q30.mjs → acorex-platform-module-common-client-disable-entity.command.util-DQl6u2nj.mjs} +49 -44
- package/fesm2022/acorex-platform-module-common-client-disable-entity.command.util-DQl6u2nj.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-common-client-enable-entity.command-BP30gOku.mjs → acorex-platform-module-common-client-enable-entity.command-DeTumWIj.mjs} +8 -13
- package/fesm2022/acorex-platform-module-common-client-enable-entity.command-DeTumWIj.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-common-client-get-current-time.command-B7hJTMzT.mjs → acorex-platform-module-common-client-get-current-time.command-Ck_SC5Bu.mjs} +6 -8
- package/fesm2022/acorex-platform-module-common-client-get-current-time.command-Ck_SC5Bu.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-common-client-restore-archive-entity.command-B0JFf8ms.mjs → acorex-platform-module-common-client-restore-archive-entity.command-Dr1GcC8a.mjs} +8 -13
- package/fesm2022/acorex-platform-module-common-client-restore-archive-entity.command-Dr1GcC8a.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-common-client-search-popup.component-DH0OQYoQ.mjs +139 -0
- package/fesm2022/acorex-platform-module-common-client-search-popup.component-DH0OQYoQ.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-common-client-timeline-version-history-popup.component-BqTLeGtG.mjs +63 -0
- package/fesm2022/acorex-platform-module-common-client-timeline-version-history-popup.component-BqTLeGtG.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-common-client.mjs +1 -1
- package/package.json +3 -3
- package/types/acorex-platform-module-common-client-contracts.d.ts +207 -3
- package/types/acorex-platform-module-common-client.d.ts +9 -13
- package/fesm2022/acorex-platform-module-common-client-acorex-platform-module-common-client-rqWzT7RI.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-archive-entity.command-CKENj9Od.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-archive-entity.command.util-BZrXDNGP.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-audit-info-column.component-DuZUwD31.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-audit-info-edit.component-CSsCG6Dz.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-audit-info-view.component-WYXsZcLg.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-bulk-archive-entity.command-CPqLp9Ci.mjs +0 -75
- package/fesm2022/acorex-platform-module-common-client-bulk-archive-entity.command-CPqLp9Ci.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-bulk-disable-entity.command-0J4vgsFL.mjs +0 -75
- package/fesm2022/acorex-platform-module-common-client-bulk-disable-entity.command-0J4vgsFL.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-bulk-enable-entity.command-DsVuaInC.mjs +0 -75
- package/fesm2022/acorex-platform-module-common-client-bulk-enable-entity.command-DsVuaInC.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-bulk-restore-archive-entity.command-D2y8h15u.mjs +0 -75
- package/fesm2022/acorex-platform-module-common-client-bulk-restore-archive-entity.command-D2y8h15u.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-clone-entity.command-DFgIeWxX.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-disable-entity.command-DWyqAAwo.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-disable-entity.command.util-BBwY9Q30.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-enable-entity.command-BP30gOku.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-get-current-time.command-B7hJTMzT.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-restore-archive-entity.command-B0JFf8ms.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-search-popup.component-BjGrZHnB.mjs +0 -136
- package/fesm2022/acorex-platform-module-common-client-search-popup.component-BjGrZHnB.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-timeline-version-history-popup.component-BwGLuNhW.mjs +0 -59
- package/fesm2022/acorex-platform-module-common-client-timeline-version-history-popup.component-BwGLuNhW.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AXTranslationService } from '@acorex/core/translation';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, Injectable } from '@angular/core';
|
|
4
|
-
import { A as AXPArchiveEntityCommandHelper, n as normalizeArchiveSingleInput, b as buildArchivePatch, a as buildArchiveRefreshMeta } from './acorex-platform-module-common-client-archive-entity.command.util-
|
|
4
|
+
import { A as AXPArchiveEntityCommandHelper, n as normalizeArchiveSingleInput, b as buildArchivePatch, a as buildArchiveRefreshMeta } from './acorex-platform-module-common-client-archive-entity.command.util-BVrK8ZGy.mjs';
|
|
5
5
|
|
|
6
6
|
class AXPArchiveEntityCommand {
|
|
7
7
|
constructor() {
|
|
@@ -30,28 +30,24 @@ class AXPArchiveEntityCommand {
|
|
|
30
30
|
const meta = buildArchiveRefreshMeta(entityDefinition, context.rowData);
|
|
31
31
|
this.helper.dispatchArchived(context.refType, context.refId, meta);
|
|
32
32
|
await this.helper.showSuccessToast('@general:workflow.entity-archived', '@general:workflow.entity-archived-body');
|
|
33
|
-
return { success: true };
|
|
33
|
+
return { success: true, kind: 'object', data: undefined };
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
message: {
|
|
40
|
-
text: error instanceof Error ? error.message : 'Archive operation failed',
|
|
41
|
-
},
|
|
42
|
-
};
|
|
36
|
+
await this.helper.showErrorToastFor(error, '@general:messages.generic.error.description');
|
|
37
|
+
// Omit message so toast middleware does not double-fire after showErrorToastFor.
|
|
38
|
+
return { success: false };
|
|
43
39
|
}
|
|
44
40
|
finally {
|
|
45
41
|
loadingDialog.close();
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
49
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
44
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPArchiveEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
45
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPArchiveEntityCommand, providedIn: 'root' }); }
|
|
50
46
|
}
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPArchiveEntityCommand, decorators: [{
|
|
52
48
|
type: Injectable,
|
|
53
49
|
args: [{ providedIn: 'root' }]
|
|
54
50
|
}] });
|
|
55
51
|
|
|
56
52
|
export { AXPArchiveEntityCommand };
|
|
57
|
-
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command-
|
|
53
|
+
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command-BZgNdxFS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-archive-entity.command-BZgNdxFS.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/archive-entity.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPRuntimeCommandResult, type AXPContextData } from '@acorex-platform/framework-shared/core';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPArchiveEntityCommandHelper } from './archive-entity.command.helper';\nimport { buildArchivePatch, buildArchiveRefreshMeta, normalizeArchiveSingleInput } from './archive-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPArchiveEntityCommand implements AXPCommand<AXPContextData, void> {\n private readonly helper = inject(AXPArchiveEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(input: AXPContextData): AXPCommandExecuteResultPromise<void> {\n const context = normalizeArchiveSingleInput(input);\n if (!context) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n const confirmed = await this.helper.confirm(\n '@general:actions.archive.confirm.title',\n '@general:actions.archive.confirm.message',\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const loadingDialog = this.helper.showLoading(\n await this.translationService.translateAsync('@general:actions.archive.confirm.processing'),\n 'Archiving...',\n );\n\n try {\n const entityDefinition = await this.helper.resolveEntity(context.refType);\n const patch = buildArchivePatch(true);\n await this.helper.applyPatch(context.refType, context.refId, patch);\n\n const meta = buildArchiveRefreshMeta(entityDefinition, context.rowData);\n this.helper.dispatchArchived(context.refType, context.refId, meta);\n await this.helper.showSuccessToast(\n '@general:workflow.entity-archived',\n '@general:workflow.entity-archived-body',\n );\n\n return { success: true, kind: 'object', data: undefined };\n } catch (error) {\n await this.helper.showErrorToastFor(error, '@general:messages.generic.error.description');\n // Omit message so toast middleware does not double-fire after showErrorToastFor.\n return { success: false };\n } finally {\n loadingDialog.close();\n }\n }\n}\n"],"names":[],"mappings":";;;;;MASa,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA+CnE,IAAA;IA7CC,MAAM,OAAO,CAAC,KAAqB,EAAA;AACjC,QAAA,MAAM,OAAO,GAAG,2BAA2B,CAAC,KAAK,CAAC;QAClD,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,uCAAuC,CAAC;AAC5F,iBAAA;aACF;QACH;AAEA,QAAA,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACzC,wCAAwC,EACxC,0CAA0C,CAC3C;QACD,IAAI,CAAC,SAAS,EAAE;AACd,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3B;QAEA,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAC3C,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,6CAA6C,CAAC,EAC3F,cAAc,CACf;AAED,QAAA,IAAI;AACF,YAAA,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC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|
2
2
|
import { AXLoadingDialogService } from '@acorex/components/loading-dialog';
|
|
3
3
|
import { AXToastService } from '@acorex/components/toast';
|
|
4
4
|
import { AXTranslationService } from '@acorex/core/translation';
|
|
5
|
-
import { AXPSettingsService, AXPCommonSettings,
|
|
5
|
+
import { AXPSettingsService, throwIfCommandFailed, AXPCommonSettings, extractRequestErrorInfo, platformErrorI18nKey } from '@acorex-platform/framework-client/common';
|
|
6
|
+
import { AXPEntityBroadcastService } from '@acorex-platform/framework-client/core';
|
|
6
7
|
import { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';
|
|
7
|
-
import { createWorkFlowEvent, AXPWorkflowEventService } from '@acorex-platform/framework-client/workflow';
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
9
|
import { inject, Injectable } from '@angular/core';
|
|
10
|
-
import { A as AXP_ENTITY_ARCHIVE_OVERRIDES } from './acorex-platform-module-common-client-acorex-platform-module-common-client-
|
|
11
|
-
|
|
12
|
-
const AXPEntityArchivedEvent = createWorkFlowEvent('[Entity] Archived');
|
|
13
|
-
const AXPEntityUnarchivedEvent = createWorkFlowEvent('[Entity] Unarchived');
|
|
14
|
-
const AXPEntityBulkArchivedEvent = createWorkFlowEvent('[Entity] Bulk Archived');
|
|
15
|
-
const AXPEntityBulkUnarchivedEvent = createWorkFlowEvent('[Entity] Bulk Unarchived');
|
|
10
|
+
import { A as AXP_ENTITY_ARCHIVE_OVERRIDES } from './acorex-platform-module-common-client-acorex-platform-module-common-client-CkeshVWo.mjs';
|
|
11
|
+
import { resolveEntityActionRef, resolveEntityActionBulkRef } from '@acorex-platform/framework-shared/runtime';
|
|
16
12
|
|
|
17
13
|
/**
|
|
18
14
|
* Injectable helper for archive commands: confirmation UI, persistence, toasts, and refresh events.
|
|
@@ -26,7 +22,7 @@ class AXPArchiveEntityCommandHelper {
|
|
|
26
22
|
this.translationService = inject(AXTranslationService);
|
|
27
23
|
this.toastService = inject(AXToastService);
|
|
28
24
|
this.settingsService = inject(AXPSettingsService);
|
|
29
|
-
this.
|
|
25
|
+
this.entityEvents = inject(AXPEntityBroadcastService);
|
|
30
26
|
this.archiveOverrides = inject(AXP_ENTITY_ARCHIVE_OVERRIDES, { optional: true }) ?? [];
|
|
31
27
|
}
|
|
32
28
|
async resolveEntity(refType) {
|
|
@@ -50,7 +46,8 @@ class AXPArchiveEntityCommandHelper {
|
|
|
50
46
|
if (!updateExec) {
|
|
51
47
|
throw new Error('Entity does not support update operation');
|
|
52
48
|
}
|
|
53
|
-
await updateExec({ id: refId, ...patch });
|
|
49
|
+
const result = await updateExec({ id: refId, ...patch });
|
|
50
|
+
throwIfCommandFailed(result);
|
|
54
51
|
}
|
|
55
52
|
async confirm(titleKey, messageKey, messageParams) {
|
|
56
53
|
const dialogResult = await this.dialogService.confirm(await this.translationService.translateAsync(titleKey), await this.translationService.translateAsync(messageKey, { params: messageParams }), 'warning', 'horizontal', false, 'cancel');
|
|
@@ -74,26 +71,45 @@ class AXPArchiveEntityCommandHelper {
|
|
|
74
71
|
content: contentKey ? await this.translationService.translateAsync(contentKey) : undefined,
|
|
75
72
|
});
|
|
76
73
|
}
|
|
74
|
+
async showErrorToastFor(error, fallbackKey) {
|
|
75
|
+
const enabled = await this.settingsService.get(AXPCommonSettings.EnableOperationToasts);
|
|
76
|
+
if (!enabled) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const info = extractRequestErrorInfo(error);
|
|
80
|
+
const contentKey = platformErrorI18nKey(info?.code) ??
|
|
81
|
+
(typeof info?.message === 'string' && info.message.startsWith('@')
|
|
82
|
+
? info.message
|
|
83
|
+
: null) ??
|
|
84
|
+
fallbackKey;
|
|
85
|
+
const content = contentKey.startsWith('@')
|
|
86
|
+
? await this.translationService.translateAsync(contentKey)
|
|
87
|
+
: contentKey;
|
|
88
|
+
this.toastService.show({
|
|
89
|
+
color: 'danger',
|
|
90
|
+
title: await this.translationService.translateAsync('@general:messages.generic.error.title'),
|
|
91
|
+
content,
|
|
92
|
+
closeButton: true,
|
|
93
|
+
timeOut: 6000,
|
|
94
|
+
timeOutProgress: true,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
77
97
|
dispatchArchived(refType, id, meta) {
|
|
78
|
-
this.
|
|
79
|
-
this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta }));
|
|
98
|
+
this.entityEvents.publishLayoutRefresh(refType, meta);
|
|
80
99
|
}
|
|
81
100
|
dispatchUnarchived(refType, id, meta) {
|
|
82
|
-
this.
|
|
83
|
-
this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta }));
|
|
101
|
+
this.entityEvents.publishLayoutRefresh(refType, meta);
|
|
84
102
|
}
|
|
85
103
|
dispatchBulkArchived(refType, ids, meta) {
|
|
86
|
-
this.
|
|
87
|
-
this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta: { refreshType: 'bulk-archive', ...meta } }));
|
|
104
|
+
this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-archive', ...(meta ?? {}) });
|
|
88
105
|
}
|
|
89
106
|
dispatchBulkUnarchived(refType, ids, meta) {
|
|
90
|
-
this.
|
|
91
|
-
this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta: { refreshType: 'bulk-unarchive', ...meta } }));
|
|
107
|
+
this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-unarchive', ...(meta ?? {}) });
|
|
92
108
|
}
|
|
93
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
94
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
109
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPArchiveEntityCommandHelper, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
110
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPArchiveEntityCommandHelper, providedIn: 'root' }); }
|
|
95
111
|
}
|
|
96
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPArchiveEntityCommandHelper, decorators: [{
|
|
97
113
|
type: Injectable,
|
|
98
114
|
args: [{ providedIn: 'root' }]
|
|
99
115
|
}] });
|
|
@@ -101,30 +117,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
101
117
|
const DEFAULT_ARCHIVE_FIELD = 'isArchived';
|
|
102
118
|
const ARCHIVE_TIMESTAMP_FIELD = 'archivedAt';
|
|
103
119
|
function normalizeArchiveSingleInput(input) {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const data = ctx?.['data'] ?? input;
|
|
107
|
-
const rowData = Array.isArray(data)
|
|
108
|
-
? data[0]
|
|
109
|
-
: data;
|
|
110
|
-
const refType = String(options['refType'] ?? ctx?.['entity'] ?? ctx?.['entityInfo']?.['source'] ?? '');
|
|
111
|
-
const rawId = options['refId'] ?? rowData?.['id'] ?? rowData?.['_id'] ?? input['refId'];
|
|
112
|
-
if (!refType || rawId == null || rawId === '') {
|
|
120
|
+
const resolved = resolveEntityActionRef(input);
|
|
121
|
+
if (!resolved) {
|
|
113
122
|
return null;
|
|
114
123
|
}
|
|
115
|
-
return {
|
|
124
|
+
return {
|
|
125
|
+
refId: resolved.refId,
|
|
126
|
+
refType: resolved.refType,
|
|
127
|
+
rowData: resolved.rowData,
|
|
128
|
+
};
|
|
116
129
|
}
|
|
117
130
|
function normalizeArchiveBulkInput(input) {
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
const data = ctx?.['data'] ?? input['data'] ?? input;
|
|
121
|
-
const rows = (Array.isArray(data) ? data : data ? [data] : []);
|
|
122
|
-
const refType = String(options['refType'] ?? ctx?.['entity'] ?? ctx?.['entityInfo']?.['source'] ?? '');
|
|
123
|
-
const ids = rows.map((row) => row?.['id']).filter((id) => id != null && id !== '');
|
|
124
|
-
if (!refType || ids.length === 0) {
|
|
131
|
+
const resolved = resolveEntityActionBulkRef(input);
|
|
132
|
+
if (!resolved) {
|
|
125
133
|
return null;
|
|
126
134
|
}
|
|
127
|
-
return {
|
|
135
|
+
return {
|
|
136
|
+
refType: resolved.refType,
|
|
137
|
+
ids: resolved.ids,
|
|
138
|
+
rows: resolved.rows,
|
|
139
|
+
};
|
|
128
140
|
}
|
|
129
141
|
function buildArchivePatch(archived) {
|
|
130
142
|
if (archived) {
|
|
@@ -141,4 +153,4 @@ function buildArchiveRefreshMeta(entityDefinition, rowData) {
|
|
|
141
153
|
}
|
|
142
154
|
|
|
143
155
|
export { AXPArchiveEntityCommandHelper as A, buildArchiveRefreshMeta as a, buildArchivePatch as b, normalizeArchiveBulkInput as c, normalizeArchiveSingleInput as n };
|
|
144
|
-
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command.util-
|
|
156
|
+
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command.util-BVrK8ZGy.mjs.map
|
package/fesm2022/acorex-platform-module-common-client-archive-entity.command.util-BVrK8ZGy.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-archive-entity.command.util-BVrK8ZGy.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/archive-entity.command.helper.ts","../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/archive-entity.command.util.ts"],"sourcesContent":["import { AXDialogService } from '@acorex/components/dialog';\nimport { AXLoadingDialogService } from '@acorex/components/loading-dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport type { AXPContextData } from '@acorex-platform/framework-shared/core';\nimport {\n AXPCommonSettings,\n AXPSettingsService,\n extractRequestErrorInfo,\n platformErrorI18nKey,\n throwIfCommandFailed,\n} from '@acorex-platform/framework-client/common';\nimport { AXPEntityBroadcastService } from '@acorex-platform/framework-client/core';\nimport { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXP_ENTITY_ARCHIVE_OVERRIDES } from '../archive-entity.override';\n\n/**\n * Injectable helper for archive commands: confirmation UI, persistence, toasts, and refresh events.\n * Pure input/patch logic lives in {@link archive-entity.command.util}.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPArchiveEntityCommandHelper {\n private readonly entityRegistry = inject(AXPEntityDefinitionRegistryService);\n private readonly dialogService = inject(AXDialogService);\n private readonly loadingDialog = inject(AXLoadingDialogService);\n private readonly translationService = inject(AXTranslationService);\n private readonly toastService = inject(AXToastService);\n private readonly settingsService = inject(AXPSettingsService);\n private readonly entityEvents = inject(AXPEntityBroadcastService);\n private readonly archiveOverrides = inject(AXP_ENTITY_ARCHIVE_OVERRIDES, { optional: true }) ?? [];\n\n async resolveEntity(refType: string): Promise<AXPEntity> {\n const [moduleName, entityName] = refType.split('.');\n return this.entityRegistry.resolve(moduleName, entityName);\n }\n\n async applyPatch(refType: string, refId: string, patch: AXPContextData): Promise<void> {\n const override = this.archiveOverrides.find((entry) => entry.refType === refType);\n if (override) {\n const archived = patch['isArchived'] === true;\n if (archived) {\n await override.archive(refId);\n } else {\n await override.restore(refId);\n }\n return;\n }\n\n const entityDefinition = await this.resolveEntity(refType);\n const updateExec = entityDefinition.commands?.update?.execute as\n | ((payload: AXPContextData) => Promise<unknown>)\n | undefined;\n\n if (!updateExec) {\n throw new Error('Entity does not support update operation');\n }\n\n const result = await updateExec({ id: refId, ...patch });\n throwIfCommandFailed(result);\n }\n\n async confirm(titleKey: string, messageKey: string, messageParams?: AXPContextData): Promise<boolean> {\n const dialogResult = await this.dialogService.confirm(\n await this.translationService.translateAsync(titleKey),\n await this.translationService.translateAsync(messageKey, { params: messageParams }),\n 'warning',\n 'horizontal',\n false,\n 'cancel',\n );\n return dialogResult.result === true;\n }\n\n showLoading(title: string, status: string) {\n return this.loadingDialog.show({\n title,\n mode: 'indeterminate',\n status,\n });\n }\n\n async showSuccessToast(titleKey: string, contentKey?: string): Promise<void> {\n const enabled = await this.settingsService.get<boolean>(AXPCommonSettings.EnableOperationToasts);\n if (!enabled) {\n return;\n }\n\n this.toastService.show({\n color: 'success',\n title: await this.translationService.translateAsync(titleKey),\n content: contentKey ? await this.translationService.translateAsync(contentKey) : undefined,\n });\n }\n\n async showErrorToastFor(error: unknown, fallbackKey: string): Promise<void> {\n const enabled = await this.settingsService.get<boolean>(AXPCommonSettings.EnableOperationToasts);\n if (!enabled) {\n return;\n }\n\n const info = extractRequestErrorInfo(error);\n const contentKey =\n platformErrorI18nKey(info?.code) ??\n (typeof info?.message === 'string' && info.message.startsWith('@')\n ? info.message\n : null) ??\n fallbackKey;\n const content = contentKey.startsWith('@')\n ? await this.translationService.translateAsync(contentKey)\n : contentKey;\n\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content,\n closeButton: true,\n timeOut: 6000,\n timeOutProgress: true,\n });\n }\n\n dispatchArchived(refType: string, id: string, meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, meta as Record<string, unknown> | undefined);\n }\n\n dispatchUnarchived(refType: string, id: string, meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, meta as Record<string, unknown> | undefined);\n }\n\n dispatchBulkArchived(refType: string, ids: string[], meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-archive', ...(meta ?? {}) });\n }\n\n dispatchBulkUnarchived(refType: string, ids: string[], meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-unarchive', ...(meta ?? {}) });\n }\n}\n","import type { AXPContextData } from '@acorex-platform/framework-shared/core';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { resolveEntityActionBulkRef, resolveEntityActionRef } from '@acorex-platform/framework-shared/runtime';\n\nexport const DEFAULT_ARCHIVE_FIELD = 'isArchived';\nexport const ARCHIVE_TIMESTAMP_FIELD = 'archivedAt';\n\nexport interface AXPArchiveCommandContext {\n refId: string;\n refType: string;\n rowData?: AXPContextData;\n}\n\nexport interface AXPBulkArchiveCommandContext {\n refType: string;\n ids: string[];\n rows: AXPContextData[];\n}\n\nexport function normalizeArchiveSingleInput(input: AXPContextData): AXPArchiveCommandContext | null {\n const resolved = resolveEntityActionRef(input);\n if (!resolved) {\n return null;\n }\n\n return {\n refId: resolved.refId,\n refType: resolved.refType,\n rowData: resolved.rowData as AXPContextData | undefined,\n };\n}\n\nexport function normalizeArchiveBulkInput(input: AXPContextData): AXPBulkArchiveCommandContext | null {\n const resolved = resolveEntityActionBulkRef(input);\n if (!resolved) {\n return null;\n }\n\n return {\n refType: resolved.refType,\n ids: resolved.ids,\n rows: resolved.rows as AXPContextData[],\n };\n}\n\nexport function buildArchivePatch(archived: boolean): AXPContextData {\n if (archived) {\n return { [DEFAULT_ARCHIVE_FIELD]: true, [ARCHIVE_TIMESTAMP_FIELD]: new Date() };\n }\n return { [DEFAULT_ARCHIVE_FIELD]: false, [ARCHIVE_TIMESTAMP_FIELD]: null };\n}\n\nexport function buildArchiveRefreshMeta(\n entityDefinition: AXPEntity,\n rowData?: AXPContextData,\n): AXPContextData {\n const meta: AXPContextData = {};\n if (entityDefinition.parentKey && rowData?.[entityDefinition.parentKey] != null) {\n meta['refreshTargetId'] = rowData[entityDefinition.parentKey];\n }\n return meta;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAmBA;;;AAGG;MAEU,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,kCAAkC,CAAC;AAC3D,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA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B,CAAC,KAAK,CAAC;IAClD,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,OAAO,IAAI;IACb;IAEA,OAAO;QACL,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,IAAI,EAAE,QAAQ,CAAC,IAAwB;KACxC;AACH;AAEM,SAAU,iBAAiB,CAAC,QAAiB,EAAA;IACjD,IAAI,QAAQ,EAAE;AACZ,QAAA,OAAO,EAAE,CAAC,qBAAqB,GAAG,IAAI,EAAE,CAAC,uBAAuB,GAAG,IAAI,IAAI,EAAE,EAAE;IACjF;AACA,IAAA,OAAO,EAAE,CAAC,qBAAqB,GAAG,KAAK,EAAE,CAAC,uBAAuB,GAAG,IAAI,EAAE;AAC5E;AAEM,SAAU,uBAAuB,CACrC,gBAA2B,EAC3B,OAAwB,EAAA;IAExB,MAAM,IAAI,GAAmB,EAAE;AAC/B,IAAA,IAAI,gBAAgB,CAAC,SAAS,IAAI,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE;QAC/E,IAAI,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC;IAC/D;AACA,IAAA,OAAO,IAAI;AACb;;;;"}
|
|
@@ -22,18 +22,22 @@ class AXPAuditInfoColumnComponent extends AXPColumnWidgetComponent {
|
|
|
22
22
|
this.commandService = inject(AXPCommandService);
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region ---- View Children ----
|
|
25
|
-
this.infoButton = viewChild('infoButton',
|
|
26
|
-
|
|
25
|
+
this.infoButton = viewChild('infoButton', /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "infoButton" }] : /* istanbul ignore next */ []));
|
|
27
|
+
this.infoPopover = viewChild('infoPopover', /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "infoPopover" }] : /* istanbul ignore next */ []));
|
|
27
29
|
//#endregion
|
|
28
30
|
//#region ---- Properties ----
|
|
29
31
|
this.host = inject(ElementRef);
|
|
30
|
-
this.isPopoverOpen = signal(false,
|
|
32
|
+
this.isPopoverOpen = signal(false, /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "isPopoverOpen" }] : /* istanbul ignore next */ []));
|
|
31
34
|
//#endregion
|
|
32
35
|
//#region ---- Computed Properties ----
|
|
33
36
|
this.auditInfo = computed(() => {
|
|
34
37
|
const value = this.rawValue;
|
|
35
38
|
return value && typeof value === 'object' ? value : null;
|
|
36
|
-
},
|
|
39
|
+
}, /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "auditInfo" }] : /* istanbul ignore next */ []));
|
|
37
41
|
this.displayText = computed(() => {
|
|
38
42
|
const info = this.auditInfo();
|
|
39
43
|
if (!info) {
|
|
@@ -46,7 +50,8 @@ class AXPAuditInfoColumnComponent extends AXPColumnWidgetComponent {
|
|
|
46
50
|
return this.formatAuditEvent(info.created, 'created');
|
|
47
51
|
}
|
|
48
52
|
return '---';
|
|
49
|
-
},
|
|
53
|
+
}, /* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "displayText" }] : /* istanbul ignore next */ []));
|
|
50
55
|
this.displayDate = computed(() => {
|
|
51
56
|
const info = this.auditInfo();
|
|
52
57
|
if (!info) {
|
|
@@ -59,24 +64,30 @@ class AXPAuditInfoColumnComponent extends AXPColumnWidgetComponent {
|
|
|
59
64
|
return this.formatDate(info.created.at);
|
|
60
65
|
}
|
|
61
66
|
return '';
|
|
62
|
-
},
|
|
67
|
+
}, /* @ts-ignore */
|
|
68
|
+
...(ngDevMode ? [{ debugName: "displayDate" }] : /* istanbul ignore next */ []));
|
|
63
69
|
this.hasAuditInfo = computed(() => {
|
|
64
70
|
const info = this.auditInfo();
|
|
65
71
|
return !!(info?.created || info?.updated || info?.deleted);
|
|
66
|
-
},
|
|
72
|
+
}, /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "hasAuditInfo" }] : /* istanbul ignore next */ []));
|
|
67
74
|
this.createdEvent = computed(() => {
|
|
68
75
|
return this.auditInfo()?.created ?? null;
|
|
69
|
-
},
|
|
76
|
+
}, /* @ts-ignore */
|
|
77
|
+
...(ngDevMode ? [{ debugName: "createdEvent" }] : /* istanbul ignore next */ []));
|
|
70
78
|
this.updatedEvent = computed(() => {
|
|
71
79
|
return this.auditInfo()?.updated ?? null;
|
|
72
|
-
},
|
|
80
|
+
}, /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "updatedEvent" }] : /* istanbul ignore next */ []));
|
|
73
82
|
this.deletedEvent = computed(() => {
|
|
74
83
|
return this.auditInfo()?.deleted ?? null;
|
|
75
|
-
},
|
|
84
|
+
}, /* @ts-ignore */
|
|
85
|
+
...(ngDevMode ? [{ debugName: "deletedEvent" }] : /* istanbul ignore next */ []));
|
|
76
86
|
this.hasHistoryPlugin = computed(() => {
|
|
77
87
|
const hasHistoryPlugin = this.options?.hasHistoryPlugin ?? false;
|
|
78
88
|
return hasHistoryPlugin && this.commandService.exists(SHOW_VERSION_HISTORY_POPUP_COMMAND);
|
|
79
|
-
},
|
|
89
|
+
}, /* @ts-ignore */
|
|
90
|
+
...(ngDevMode ? [{ debugName: "hasHistoryPlugin" }] : /* istanbul ignore next */ []));
|
|
80
91
|
}
|
|
81
92
|
//#endregion
|
|
82
93
|
//#region ---- Public Methods ----
|
|
@@ -146,13 +157,13 @@ class AXPAuditInfoColumnComponent extends AXPColumnWidgetComponent {
|
|
|
146
157
|
},
|
|
147
158
|
});
|
|
148
159
|
}
|
|
149
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
150
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
160
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuditInfoColumnComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
161
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXPAuditInfoColumnComponent, isStandalone: true, selector: "axp-audit-info-column", inputs: { rawValue: "rawValue", rowData: "rowData" }, viewQueries: [{ propertyName: "infoButton", first: true, predicate: ["infoButton"], descendants: true, isSignal: true }, { propertyName: "infoPopover", first: true, predicate: ["infoPopover"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"flex items-center gap-1.5\">\n @if (hasAuditInfo()) {\n <div class=\"flex items-center gap-1.5 cursor-pointer hover:opacity-80 transition-opacity\"\n (click)=\"showInfo()\" [title]=\"displayText()\" #infoButton>\n <i class=\"fa-light fa-calendar-circle-exclamation\"></i>\n <span class=\"text-xs\" [dir]=\"'ltr'\">{{ displayDate() }}</span>\n </div>\n } @else {\n <span class=\"text-muted\">---</span>\n }\n</div>\n\n<!-- Audit Info Popover -->\n<ax-popover [openOn]=\"'manual'\" #infoPopover (openChange)=\"onPopoverOpenChange($event)\" [adaptivityEnabled]=\"true\">\n <div class=\"lightest-surface border rounded-lg shadow-lg p-3 min-w-[280px]\">\n <div class=\"mb-3 pb-2 border-b\">\n <h3 class=\"text-sm font-semibold\">\n {{ '@general:terms.audit.section-title' | translate | async }}\n </h3>\n </div>\n <div class=\"space-y-2.5\">\n <!-- Created -->\n @if (createdEvent()) {\n <div>\n <div class=\"text-xs mb-1 font-semibold\">\n {{ '@general:terms.audit.created' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (createdEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(createdEvent()?.at)) }}</span>\n @if (createdEvent()?.by) {\n <span class=\"text-muted\"> \u2022 {{ formatUser($safeNavigationMigration(createdEvent()?.by)) }}</span>\n }\n </div>\n }\n @if (createdEvent()?.reason) {\n <div class=\"text-muted\">{{ createdEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n\n <!-- Updated -->\n @if (updatedEvent()) {\n <div>\n <div class=\"text-xs mb-1 font-semibold\">\n {{ '@general:terms.audit.updated' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (updatedEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(updatedEvent()?.at)) }}</span>\n @if (updatedEvent()?.by) {\n <span class=\"text-muted\"> \u2022 {{ formatUser($safeNavigationMigration(updatedEvent()?.by)) }}</span>\n }\n </div>\n }\n @if (updatedEvent()?.reason) {\n <div class=\"text-muted\">{{ updatedEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n\n <!-- Deleted -->\n @if (deletedEvent()) {\n <div>\n <div class=\"text-xs text-muted mb-1 font-semibold\">\n {{ '@general:terms.audit.deleted' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (deletedEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(deletedEvent()?.at)) }}</span>\n @if (deletedEvent()?.by) {\n <span class=\"text-muted\"> \u2022 {{ formatUser($safeNavigationMigration(deletedEvent()?.by)) }}</span>\n }\n </div>\n }\n @if (deletedEvent()?.reason) {\n <div class=\"text-muted\">{{ deletedEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n </div>\n @if (hasHistoryPlugin()) {\n <div class=\"mt-3 pt-3 border-t ax-sm\">\n <ax-button [text]=\"'@general:terms.audit.history' | translate | async\" (click)=\"showHistory()\" class=\"w-full\">\n </ax-button>\n </div>\n }\n </div>\n</ax-popover>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXBadgeModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXPopoverModule }, { kind: "component", type: i2$1.AXPopoverComponent, selector: "ax-popover", inputs: ["width", "disablePanelClass", "visualContextScope", "disabled", "offsetX", "offsetY", "target", "placement", "content", "openOn", "closeOn", "hasBackdrop", "openAfter", "closeAfter", "closeOnScroll", "backdropClass", "panelClass", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
151
162
|
}
|
|
152
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuditInfoColumnComponent, decorators: [{
|
|
153
164
|
type: Component,
|
|
154
|
-
args: [{ selector: 'axp-audit-info-column', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, AXBadgeModule, AXButtonModule, AXPopoverModule, AXTranslationModule], inputs: ['rawValue', 'rowData'], template: "<div class=\"flex items-center gap-1.5\">\n @if (hasAuditInfo()) {\n <div class=\"flex items-center gap-1.5 cursor-pointer hover:opacity-80 transition-opacity\"\n (click)=\"showInfo()\" [title]=\"displayText()\" #infoButton>\n <i class=\"fa-light fa-calendar-circle-exclamation\"></i>\n <span class=\"text-xs\" [dir]=\"'ltr'\">{{ displayDate() }}</span>\n </div>\n } @else {\n <span class=\"text-muted\">---</span>\n }\n</div>\n\n<!-- Audit Info Popover -->\n<ax-popover [openOn]=\"'manual'\" #infoPopover (openChange)=\"onPopoverOpenChange($event)\" [adaptivityEnabled]=\"true\">\n <div class=\"lightest-surface border rounded-lg shadow-lg p-3 min-w-[280px]\">\n <div class=\"mb-3 pb-2 border-b\">\n <h3 class=\"text-sm font-semibold\">\n {{ '@general:terms.audit.section-title' | translate | async }}\n </h3>\n </div>\n <div class=\"space-y-2.5\">\n <!-- Created -->\n @if (createdEvent()) {\n <div>\n <div class=\"text-xs mb-1 font-semibold\">\n {{ '@general:terms.audit.created' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (createdEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate(createdEvent()?.at) }}</span>\n @if (createdEvent()?.by) {\n <span class=\"text-muted\"> \u2022 {{ formatUser(createdEvent()?.by) }}</span>\n }\n </div>\n }\n @if (createdEvent()?.reason) {\n <div class=\"text-muted\">{{ createdEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n\n <!-- Updated -->\n @if (updatedEvent()) {\n <div>\n <div class=\"text-xs mb-1 font-semibold\">\n {{ '@general:terms.audit.updated' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (updatedEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate(updatedEvent()?.at) }}</span>\n @if (updatedEvent()?.by) {\n <span class=\"text-muted\"> \u2022 {{ formatUser(updatedEvent()?.by) }}</span>\n }\n </div>\n }\n @if (updatedEvent()?.reason) {\n <div class=\"text-muted\">{{ updatedEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n\n <!-- Deleted -->\n @if (deletedEvent()) {\n <div>\n <div class=\"text-xs text-muted mb-1 font-semibold\">\n {{ '@general:terms.audit.deleted' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (deletedEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate(deletedEvent()?.at) }}</span>\n @if (deletedEvent()?.by) {\n <span class=\"text-muted\"> \u2022 {{ formatUser(deletedEvent()?.by) }}</span>\n }\n </div>\n }\n @if (deletedEvent()?.reason) {\n <div class=\"text-muted\">{{ deletedEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n </div>\n @if (hasHistoryPlugin()) {\n <div class=\"mt-3 pt-3 border-t ax-sm\">\n <ax-button [text]=\"'@general:terms.audit.history' | translate | async\" (click)=\"showHistory()\" class=\"w-full\">\n </ax-button>\n </div>\n }\n </div>\n</ax-popover>\n" }]
|
|
165
|
+
args: [{ selector: 'axp-audit-info-column', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, AXBadgeModule, AXButtonModule, AXPopoverModule, AXTranslationModule], inputs: ['rawValue', 'rowData'], template: "<div class=\"flex items-center gap-1.5\">\n @if (hasAuditInfo()) {\n <div class=\"flex items-center gap-1.5 cursor-pointer hover:opacity-80 transition-opacity\"\n (click)=\"showInfo()\" [title]=\"displayText()\" #infoButton>\n <i class=\"fa-light fa-calendar-circle-exclamation\"></i>\n <span class=\"text-xs\" [dir]=\"'ltr'\">{{ displayDate() }}</span>\n </div>\n } @else {\n <span class=\"text-muted\">---</span>\n }\n</div>\n\n<!-- Audit Info Popover -->\n<ax-popover [openOn]=\"'manual'\" #infoPopover (openChange)=\"onPopoverOpenChange($event)\" [adaptivityEnabled]=\"true\">\n <div class=\"lightest-surface border rounded-lg shadow-lg p-3 min-w-[280px]\">\n <div class=\"mb-3 pb-2 border-b\">\n <h3 class=\"text-sm font-semibold\">\n {{ '@general:terms.audit.section-title' | translate | async }}\n </h3>\n </div>\n <div class=\"space-y-2.5\">\n <!-- Created -->\n @if (createdEvent()) {\n <div>\n <div class=\"text-xs mb-1 font-semibold\">\n {{ '@general:terms.audit.created' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (createdEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(createdEvent()?.at)) }}</span>\n @if (createdEvent()?.by) {\n <span class=\"text-muted\"> \u2022 {{ formatUser($safeNavigationMigration(createdEvent()?.by)) }}</span>\n }\n </div>\n }\n @if (createdEvent()?.reason) {\n <div class=\"text-muted\">{{ createdEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n\n <!-- Updated -->\n @if (updatedEvent()) {\n <div>\n <div class=\"text-xs mb-1 font-semibold\">\n {{ '@general:terms.audit.updated' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (updatedEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(updatedEvent()?.at)) }}</span>\n @if (updatedEvent()?.by) {\n <span class=\"text-muted\"> \u2022 {{ formatUser($safeNavigationMigration(updatedEvent()?.by)) }}</span>\n }\n </div>\n }\n @if (updatedEvent()?.reason) {\n <div class=\"text-muted\">{{ updatedEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n\n <!-- Deleted -->\n @if (deletedEvent()) {\n <div>\n <div class=\"text-xs text-muted mb-1 font-semibold\">\n {{ '@general:terms.audit.deleted' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (deletedEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(deletedEvent()?.at)) }}</span>\n @if (deletedEvent()?.by) {\n <span class=\"text-muted\"> \u2022 {{ formatUser($safeNavigationMigration(deletedEvent()?.by)) }}</span>\n }\n </div>\n }\n @if (deletedEvent()?.reason) {\n <div class=\"text-muted\">{{ deletedEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n </div>\n @if (hasHistoryPlugin()) {\n <div class=\"mt-3 pt-3 border-t ax-sm\">\n <ax-button [text]=\"'@general:terms.audit.history' | translate | async\" (click)=\"showHistory()\" class=\"w-full\">\n </ax-button>\n </div>\n }\n </div>\n</ax-popover>\n" }]
|
|
155
166
|
}], propDecorators: { infoButton: [{ type: i0.ViewChild, args: ['infoButton', { isSignal: true }] }], infoPopover: [{ type: i0.ViewChild, args: ['infoPopover', { isSignal: true }] }] } });
|
|
156
167
|
|
|
157
168
|
export { AXPAuditInfoColumnComponent };
|
|
158
|
-
//# sourceMappingURL=acorex-platform-module-common-client-audit-info-column.component-
|
|
169
|
+
//# sourceMappingURL=acorex-platform-module-common-client-audit-info-column.component-CsqKKwwF.mjs.map
|
package/fesm2022/acorex-platform-module-common-client-audit-info-column.component-CsqKKwwF.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-audit-info-column.component-CsqKKwwF.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/history-plugin/components/audit-info-column.component.ts","../../../../libs/modules/common/client/src/lib/features/history-plugin/components/audit-info-column.component.html"],"sourcesContent":["import { AXPAuditEvent, AXPRecordAuditInfo } from '@acorex-platform/framework-shared/entity';\nimport { AXBadgeModule } from '@acorex/components/badge';\nimport { AXPColumnWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';\nimport { AXButtonModule } from '@acorex/components/button';\nimport { AXPopoverComponent, AXPopoverModule } from '@acorex/components/popover';\nimport { AXFormatService } from '@acorex/core/format';\n\nimport { ChangeDetectionStrategy, Component, computed, ElementRef, inject, signal, viewChild } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\n\nconst SHOW_VERSION_HISTORY_POPUP_COMMAND = 'show-version-history-popup';\n\n@Component({\n selector: 'axp-audit-info-column',\n templateUrl: './audit-info-column.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CommonModule, AXBadgeModule, AXButtonModule, AXPopoverModule, AXTranslationModule],\n inputs: ['rawValue', 'rowData'],\n})\nexport class AXPAuditInfoColumnComponent extends AXPColumnWidgetComponent<AXPRecordAuditInfo> {\n //#region ---- Dependencies ----\n\n private readonly formatService = inject(AXFormatService);\n private readonly commandService = inject(AXPCommandService);\n\n //#endregion\n\n //#region ---- View Children ----\n\n protected infoButton = viewChild<ElementRef>('infoButton');\n protected infoPopover = viewChild<AXPopoverComponent>('infoPopover');\n\n //#endregion\n\n //#region ---- Properties ----\n\n protected host = inject(ElementRef);\n protected isPopoverOpen = signal(false);\n\n //#endregion\n\n //#region ---- Computed Properties ----\n\n protected auditInfo = computed<AXPRecordAuditInfo | null>(() => {\n const value = this.rawValue;\n return value && typeof value === 'object' ? (value as AXPRecordAuditInfo) : null;\n });\n\n protected displayText = computed<string>(() => {\n const info = this.auditInfo();\n if (!info) {\n return '---';\n }\n\n if (info.updated?.at) {\n return this.formatAuditEvent(info.updated, 'updated');\n } else if (info.created?.at) {\n return this.formatAuditEvent(info.created, 'created');\n }\n\n return '---';\n });\n\n protected displayDate = computed<string>(() => {\n const info = this.auditInfo();\n if (!info) {\n return '';\n }\n\n if (info.updated?.at) {\n return this.formatDate(info.updated.at);\n } else if (info.created?.at) {\n return this.formatDate(info.created.at);\n }\n\n return '';\n });\n\n protected hasAuditInfo = computed<boolean>(() => {\n const info = this.auditInfo();\n return !!(info?.created || info?.updated || info?.deleted);\n });\n\n protected createdEvent = computed<AXPAuditEvent | null>(() => {\n return this.auditInfo()?.created ?? null;\n });\n\n protected updatedEvent = computed<AXPAuditEvent | null>(() => {\n return this.auditInfo()?.updated ?? null;\n });\n\n protected deletedEvent = computed<AXPAuditEvent | null>(() => {\n return this.auditInfo()?.deleted ?? null;\n });\n\n //#endregion\n\n //#region ---- Public Methods ----\n\n protected showInfo(): void {\n this.openPopover();\n }\n\n protected onPopoverOpenChange(event: any): void {\n this.isPopoverOpen.set(event);\n }\n\n protected formatDate(date: Date | string | undefined): string {\n if (!date) {\n return '---';\n }\n\n try {\n const dateObj = typeof date === 'string' ? new Date(date) : date;\n return this.formatService.format(dateObj, 'datetime', {\n format: 'short',\n });\n } catch {\n return '---';\n }\n }\n\n protected formatUser(user: any): string {\n if (!user) {\n return '---';\n }\n\n return user.fullName || user.username || user.id || '---';\n }\n\n protected formatAuditEvent(event: AXPAuditEvent, type: 'created' | 'updated' | 'deleted'): string {\n if (!event?.at) {\n return '---';\n }\n\n const dateStr = this.formatDate(event.at);\n const userStr = this.formatUser(event.by);\n return `${dateStr}${userStr !== '---' ? ` by ${userStr}` : ''}`;\n }\n\n //#endregion\n\n //#region ---- Private Methods ----\n\n private openPopover(): void {\n if (this.infoPopover() && this.infoButton()) {\n this.infoPopover()!.target = this.infoButton()!.nativeElement;\n this.infoPopover()!.open();\n this.isPopoverOpen.set(true);\n }\n }\n\n protected hasHistoryPlugin = computed<boolean>(() => {\n const hasHistoryPlugin = (this.options as any)?.hasHistoryPlugin ?? false;\n return hasHistoryPlugin && this.commandService.exists(SHOW_VERSION_HISTORY_POPUP_COMMAND);\n });\n\n protected async showHistory(): Promise<void> {\n if (!this.hasHistoryPlugin()) {\n return;\n }\n\n const rowData = this.rowData as Record<string, any>;\n const entityId = rowData?.['id'];\n\n if (!entityId) {\n return;\n }\n\n const entityInfo = (this.options as any)?.entityInfo || rowData?.['__entityInfo'];\n const refType = entityInfo?.source || entityInfo?.refType;\n\n if (!refType) {\n return;\n }\n\n const fieldTitles = entityInfo?.fieldTitles || {};\n\n await this.commandService.execute(SHOW_VERSION_HISTORY_POPUP_COMMAND, {\n options: {\n refId: entityId,\n refType,\n fieldTitles,\n },\n });\n }\n\n //#endregion\n}\n","<div class=\"flex items-center gap-1.5\">\n @if (hasAuditInfo()) {\n <div class=\"flex items-center gap-1.5 cursor-pointer hover:opacity-80 transition-opacity\"\n (click)=\"showInfo()\" [title]=\"displayText()\" #infoButton>\n <i class=\"fa-light fa-calendar-circle-exclamation\"></i>\n <span class=\"text-xs\" [dir]=\"'ltr'\">{{ displayDate() }}</span>\n </div>\n } @else {\n <span class=\"text-muted\">---</span>\n }\n</div>\n\n<!-- Audit Info Popover -->\n<ax-popover [openOn]=\"'manual'\" #infoPopover (openChange)=\"onPopoverOpenChange($event)\" [adaptivityEnabled]=\"true\">\n <div class=\"lightest-surface border rounded-lg shadow-lg p-3 min-w-[280px]\">\n <div class=\"mb-3 pb-2 border-b\">\n <h3 class=\"text-sm font-semibold\">\n {{ '@general:terms.audit.section-title' | translate | async }}\n </h3>\n </div>\n <div class=\"space-y-2.5\">\n <!-- Created -->\n @if (createdEvent()) {\n <div>\n <div class=\"text-xs mb-1 font-semibold\">\n {{ '@general:terms.audit.created' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (createdEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(createdEvent()?.at)) }}</span>\n @if (createdEvent()?.by) {\n <span class=\"text-muted\"> • {{ formatUser($safeNavigationMigration(createdEvent()?.by)) }}</span>\n }\n </div>\n }\n @if (createdEvent()?.reason) {\n <div class=\"text-muted\">{{ createdEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n\n <!-- Updated -->\n @if (updatedEvent()) {\n <div>\n <div class=\"text-xs mb-1 font-semibold\">\n {{ '@general:terms.audit.updated' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (updatedEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(updatedEvent()?.at)) }}</span>\n @if (updatedEvent()?.by) {\n <span class=\"text-muted\"> • {{ formatUser($safeNavigationMigration(updatedEvent()?.by)) }}</span>\n }\n </div>\n }\n @if (updatedEvent()?.reason) {\n <div class=\"text-muted\">{{ updatedEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n\n <!-- Deleted -->\n @if (deletedEvent()) {\n <div>\n <div class=\"text-xs text-muted mb-1 font-semibold\">\n {{ '@general:terms.audit.deleted' | translate | async }}\n </div>\n <div class=\"text-xs space-y-0.5\">\n @if (deletedEvent()?.at) {\n <div>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(deletedEvent()?.at)) }}</span>\n @if (deletedEvent()?.by) {\n <span class=\"text-muted\"> • {{ formatUser($safeNavigationMigration(deletedEvent()?.by)) }}</span>\n }\n </div>\n }\n @if (deletedEvent()?.reason) {\n <div class=\"text-muted\">{{ deletedEvent()?.reason }}</div>\n }\n </div>\n </div>\n }\n </div>\n @if (hasHistoryPlugin()) {\n <div class=\"mt-3 pt-3 border-t ax-sm\">\n <ax-button [text]=\"'@general:terms.audit.history' | translate | async\" (click)=\"showHistory()\" class=\"w-full\">\n </ax-button>\n </div>\n }\n </div>\n</ax-popover>\n"],"names":["i1","i2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...(ngDevMode ? [{ debugName: "auditInfo" }] : /* istanbul ignore next */ []));
|
|
24
25
|
this.hasAnyAuditInfo = computed(() => {
|
|
25
26
|
const info = this.auditInfo();
|
|
26
27
|
return !!(info?.created || info?.updated || info?.deleted);
|
|
27
|
-
},
|
|
28
|
+
}, /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "hasAnyAuditInfo" }] : /* istanbul ignore next */ []));
|
|
28
30
|
}
|
|
29
31
|
formatDate(date) {
|
|
30
32
|
if (!date) {
|
|
@@ -46,34 +48,34 @@ class AXPAuditInfoEditComponent extends AXPValueWidgetComponent {
|
|
|
46
48
|
}
|
|
47
49
|
return user.fullName || user.username || user.id || '---';
|
|
48
50
|
}
|
|
49
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
50
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
51
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuditInfoEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
52
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXPAuditInfoEditComponent, isStandalone: true, selector: "axp-audit-info-edit", usesInheritance: true, ngImport: i0, template: `
|
|
51
53
|
@if (auditInfo() && hasAnyAuditInfo()) {
|
|
52
54
|
<div class="text-xs space-y-1">
|
|
53
55
|
@if (auditInfo()?.created) {
|
|
54
56
|
<div>
|
|
55
57
|
<span class="text-muted">{{ '@general:terms.audit.created' | translate | async }}: </span>
|
|
56
|
-
<span [dir]="'ltr'">{{ formatDate(auditInfo()?.created?.at) }}</span>
|
|
58
|
+
<span [dir]="'ltr'">{{ formatDate($safeNavigationMigration(auditInfo()?.created?.at)) }}</span>
|
|
57
59
|
@if (auditInfo()?.created?.by) {
|
|
58
|
-
<span class="text-muted"> • {{ formatUser(auditInfo()?.created?.by) }}</span>
|
|
60
|
+
<span class="text-muted"> • {{ formatUser($safeNavigationMigration(auditInfo()?.created?.by)) }}</span>
|
|
59
61
|
}
|
|
60
62
|
</div>
|
|
61
63
|
}
|
|
62
64
|
@if (auditInfo()?.updated) {
|
|
63
65
|
<div>
|
|
64
66
|
<span class="text-muted">{{ '@general:terms.audit.updated' | translate | async }}: </span>
|
|
65
|
-
<span [dir]="'ltr'">{{ formatDate(auditInfo()?.updated?.at) }}</span>
|
|
67
|
+
<span [dir]="'ltr'">{{ formatDate($safeNavigationMigration(auditInfo()?.updated?.at)) }}</span>
|
|
66
68
|
@if (auditInfo()?.updated?.by) {
|
|
67
|
-
<span class="text-muted"> • {{ formatUser(auditInfo()?.updated?.by) }}</span>
|
|
69
|
+
<span class="text-muted"> • {{ formatUser($safeNavigationMigration(auditInfo()?.updated?.by)) }}</span>
|
|
68
70
|
}
|
|
69
71
|
</div>
|
|
70
72
|
}
|
|
71
73
|
@if (auditInfo()?.deleted) {
|
|
72
74
|
<div>
|
|
73
75
|
<span class="text-muted">{{ '@general:terms.audit.deleted' | translate | async }}: </span>
|
|
74
|
-
<span [dir]="'ltr'">{{ formatDate(auditInfo()?.deleted?.at) }}</span>
|
|
76
|
+
<span [dir]="'ltr'">{{ formatDate($safeNavigationMigration(auditInfo()?.deleted?.at)) }}</span>
|
|
75
77
|
@if (auditInfo()?.deleted?.by) {
|
|
76
|
-
<span class="text-muted"> • {{ formatUser(auditInfo()?.deleted?.by) }}</span>
|
|
78
|
+
<span class="text-muted"> • {{ formatUser($safeNavigationMigration(auditInfo()?.deleted?.by)) }}</span>
|
|
77
79
|
}
|
|
78
80
|
</div>
|
|
79
81
|
}
|
|
@@ -81,7 +83,7 @@ class AXPAuditInfoEditComponent extends AXPValueWidgetComponent {
|
|
|
81
83
|
}
|
|
82
84
|
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
83
85
|
}
|
|
84
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
86
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPAuditInfoEditComponent, decorators: [{
|
|
85
87
|
type: Component,
|
|
86
88
|
args: [{
|
|
87
89
|
selector: 'axp-audit-info-edit',
|
|
@@ -91,27 +93,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
91
93
|
@if (auditInfo()?.created) {
|
|
92
94
|
<div>
|
|
93
95
|
<span class="text-muted">{{ '@general:terms.audit.created' | translate | async }}: </span>
|
|
94
|
-
<span [dir]="'ltr'">{{ formatDate(auditInfo()?.created?.at) }}</span>
|
|
96
|
+
<span [dir]="'ltr'">{{ formatDate($safeNavigationMigration(auditInfo()?.created?.at)) }}</span>
|
|
95
97
|
@if (auditInfo()?.created?.by) {
|
|
96
|
-
<span class="text-muted"> • {{ formatUser(auditInfo()?.created?.by) }}</span>
|
|
98
|
+
<span class="text-muted"> • {{ formatUser($safeNavigationMigration(auditInfo()?.created?.by)) }}</span>
|
|
97
99
|
}
|
|
98
100
|
</div>
|
|
99
101
|
}
|
|
100
102
|
@if (auditInfo()?.updated) {
|
|
101
103
|
<div>
|
|
102
104
|
<span class="text-muted">{{ '@general:terms.audit.updated' | translate | async }}: </span>
|
|
103
|
-
<span [dir]="'ltr'">{{ formatDate(auditInfo()?.updated?.at) }}</span>
|
|
105
|
+
<span [dir]="'ltr'">{{ formatDate($safeNavigationMigration(auditInfo()?.updated?.at)) }}</span>
|
|
104
106
|
@if (auditInfo()?.updated?.by) {
|
|
105
|
-
<span class="text-muted"> • {{ formatUser(auditInfo()?.updated?.by) }}</span>
|
|
107
|
+
<span class="text-muted"> • {{ formatUser($safeNavigationMigration(auditInfo()?.updated?.by)) }}</span>
|
|
106
108
|
}
|
|
107
109
|
</div>
|
|
108
110
|
}
|
|
109
111
|
@if (auditInfo()?.deleted) {
|
|
110
112
|
<div>
|
|
111
113
|
<span class="text-muted">{{ '@general:terms.audit.deleted' | translate | async }}: </span>
|
|
112
|
-
<span [dir]="'ltr'">{{ formatDate(auditInfo()?.deleted?.at) }}</span>
|
|
114
|
+
<span [dir]="'ltr'">{{ formatDate($safeNavigationMigration(auditInfo()?.deleted?.at)) }}</span>
|
|
113
115
|
@if (auditInfo()?.deleted?.by) {
|
|
114
|
-
<span class="text-muted"> • {{ formatUser(auditInfo()?.deleted?.by) }}</span>
|
|
116
|
+
<span class="text-muted"> • {{ formatUser($safeNavigationMigration(auditInfo()?.deleted?.by)) }}</span>
|
|
115
117
|
}
|
|
116
118
|
</div>
|
|
117
119
|
}
|
|
@@ -124,4 +126,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
124
126
|
}] });
|
|
125
127
|
|
|
126
128
|
export { AXPAuditInfoEditComponent };
|
|
127
|
-
//# sourceMappingURL=acorex-platform-module-common-client-audit-info-edit.component-
|
|
129
|
+
//# sourceMappingURL=acorex-platform-module-common-client-audit-info-edit.component-COMMBgsX.mjs.map
|
package/fesm2022/acorex-platform-module-common-client-audit-info-edit.component-COMMBgsX.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-audit-info-edit.component-COMMBgsX.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/history-plugin/components/audit-info-edit.component.ts"],"sourcesContent":["import { AXPRecordAuditInfo } from '@acorex-platform/framework-shared/entity';\nimport { AXFormatService } from '@acorex/core/format';\nimport { AXPValueWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';\n\nimport { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { CommonModule } from '@angular/common';\n\n@Component({\n selector: 'axp-audit-info-edit',\n template: `\n @if (auditInfo() && hasAnyAuditInfo()) {\n <div class=\"text-xs space-y-1\">\n @if (auditInfo()?.created) {\n <div>\n <span class=\"text-muted\">{{ '@general:terms.audit.created' | translate | async }}: </span>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(auditInfo()?.created?.at)) }}</span>\n @if (auditInfo()?.created?.by) {\n <span class=\"text-muted\"> • {{ formatUser($safeNavigationMigration(auditInfo()?.created?.by)) }}</span>\n }\n </div>\n }\n @if (auditInfo()?.updated) {\n <div>\n <span class=\"text-muted\">{{ '@general:terms.audit.updated' | translate | async }}: </span>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(auditInfo()?.updated?.at)) }}</span>\n @if (auditInfo()?.updated?.by) {\n <span class=\"text-muted\"> • {{ formatUser($safeNavigationMigration(auditInfo()?.updated?.by)) }}</span>\n }\n </div>\n }\n @if (auditInfo()?.deleted) {\n <div>\n <span class=\"text-muted\">{{ '@general:terms.audit.deleted' | translate | async }}: </span>\n <span [dir]=\"'ltr'\">{{ formatDate($safeNavigationMigration(auditInfo()?.deleted?.at)) }}</span>\n @if (auditInfo()?.deleted?.by) {\n <span class=\"text-muted\"> • {{ formatUser($safeNavigationMigration(auditInfo()?.deleted?.by)) }}</span>\n }\n </div>\n }\n </div>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CommonModule, AXTranslationModule],\n})\nexport class AXPAuditInfoEditComponent extends AXPValueWidgetComponent<AXPRecordAuditInfo> {\n private readonly formatService = inject(AXFormatService);\n\n protected auditInfo = computed<AXPRecordAuditInfo | null>(() => {\n let value = this.getValue();\n\n if (!value) {\n const contextData = this.contextService.data() as Record<string, any>;\n if (contextData && 'auditInfo' in contextData) {\n value = contextData['auditInfo'];\n }\n }\n\n return value && typeof value === 'object' ? (value as AXPRecordAuditInfo) : null;\n });\n\n protected hasAnyAuditInfo = computed<boolean>(() => {\n const info = this.auditInfo();\n return !!(info?.created || info?.updated || info?.deleted);\n });\n\n protected formatDate(date: Date | string | undefined): string {\n if (!date) {\n return '---';\n }\n\n try {\n const dateObj = typeof date === 'string' ? new Date(date) : date;\n return this.formatService.format(dateObj, 'datetime', {\n format: 'short',\n });\n } catch {\n return '---';\n }\n }\n\n protected formatUser(user: any): string {\n if (!user) {\n return '---';\n }\n\n return user.fullName || user.username || user.id || '---';\n }\n}\n"],"names":["i2"],"mappings":";;;;;;;;;AA8CM,MAAO,yBAA0B,SAAQ,uBAA2C,CAAA;AAtC1F,IAAA,WAAA,GAAA;;AAuCmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AAE9C,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAA4B,MAAK;AAC7D,YAAA,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE;YAE3B,IAAI,CAAC,KAAK,EAAE;gBACV,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAyB;AACrE,gBAAA,IAAI,WAAW,IAAI,WAAW,IAAI,WAAW,EAAE;AAC7C,oBAAA,KAAK,GAAG,WAAW,CAAC,WAAW,CAAC;gBAClC;YACF;AAEA,YAAA,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,GAAI,KAA4B,GAAG,IAAI;QAClF,CAAC;sFAAC;AAEQ,QAAA,IAAA,CAAA,eAAe,GAAG,QAAQ,CAAU,MAAK;AACjD,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAC7B,YAAA,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,IAAI,IAAI,EAAE,OAAO,IAAI,IAAI,EAAE,OAAO,CAAC;QAC5D,CAAC;4FAAC;AAwBH,IAAA;AAtBW,IAAA,UAAU,CAAC,IAA+B,EAAA;QAClD,IAAI,CAAC,IAAI,EAAE;AACT,YAAA,OAAO,KAAK;QACd;AAEA,QAAA,IAAI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