@acorex-platform/module-common-client 0.0.15 → 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-IHaYrZeE.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-Dgsmx1_A.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-CEvlTSlo.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-CyIAr8bc.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-D6ms054j.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-IHaYrZeE.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-archive-entity.command-Dgsmx1_A.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-archive-entity.command.util-CEvlTSlo.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-DZ6VL4oy.mjs +0 -75
- package/fesm2022/acorex-platform-module-common-client-bulk-archive-entity.command-DZ6VL4oy.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-C-ptvYRp.mjs +0 -75
- package/fesm2022/acorex-platform-module-common-client-bulk-restore-archive-entity.command-C-ptvYRp.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-clone-entity.command-CyIAr8bc.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-D6ms054j.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-search-popup.component-upSRWTIO.mjs +0 -136
- package/fesm2022/acorex-platform-module-common-client-search-popup.component-upSRWTIO.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-common-client-timeline-version-history-popup.component-D4lLwLpx.mjs +0 -59
- package/fesm2022/acorex-platform-module-common-client-timeline-version-history-popup.component-D4lLwLpx.mjs.map +0 -1
|
@@ -20,11 +20,13 @@ class AXPAuditInfoViewComponent extends AXPValueWidgetComponent {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
return value && typeof value === 'object' ? value : null;
|
|
23
|
-
},
|
|
23
|
+
}, /* @ts-ignore */
|
|
24
|
+
...(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 AXPAuditInfoViewComponent 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: AXPAuditInfoViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
52
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXPAuditInfoViewComponent, isStandalone: true, selector: "axp-audit-info-view", 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 AXPAuditInfoViewComponent 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: AXPAuditInfoViewComponent, decorators: [{
|
|
85
87
|
type: Component,
|
|
86
88
|
args: [{
|
|
87
89
|
selector: 'axp-audit-info-view',
|
|
@@ -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 { AXPAuditInfoViewComponent };
|
|
127
|
-
//# sourceMappingURL=acorex-platform-module-common-client-audit-info-view.component-
|
|
129
|
+
//# sourceMappingURL=acorex-platform-module-common-client-audit-info-view.component-UOTT-ir_.mjs.map
|
package/fesm2022/acorex-platform-module-common-client-audit-info-view.component-UOTT-ir_.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-audit-info-view.component-UOTT-ir_.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/history-plugin/components/audit-info-view.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-view',\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 AXPAuditInfoViewComponent 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;AACF,YAAA,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI;YAChE,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE;AACpD,g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QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCT,EAAA,CAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,mBAAmB,CAAC;AAC7C,iBAAA;;;;;"}
|
package/fesm2022/acorex-platform-module-common-client-bulk-archive-entity.command-EIlMyuII.mjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
3
|
+
import { AXPEntityBulkPatchPerformService } from '@acorex-platform/framework-client/layout/entity';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { inject, Injectable } from '@angular/core';
|
|
6
|
+
import { A as AXPArchiveEntityCommandHelper, c as normalizeArchiveBulkInput, b as buildArchivePatch } from './acorex-platform-module-common-client-archive-entity.command.util-BVrK8ZGy.mjs';
|
|
7
|
+
|
|
8
|
+
class AXPBulkArchiveEntityCommand {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.helper = inject(AXPArchiveEntityCommandHelper);
|
|
11
|
+
this.translationService = inject(AXTranslationService);
|
|
12
|
+
this.bulkPatch = inject(AXPEntityBulkPatchPerformService);
|
|
13
|
+
}
|
|
14
|
+
async execute(input) {
|
|
15
|
+
const context = normalizeArchiveBulkInput(input);
|
|
16
|
+
if (!context) {
|
|
17
|
+
return {
|
|
18
|
+
success: false,
|
|
19
|
+
message: {
|
|
20
|
+
text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const confirmed = await this.helper.confirm('@general:actions.bulk-archive.confirm.title', '@general:actions.bulk-archive.confirm.message', { count: context.ids.length });
|
|
25
|
+
if (!confirmed) {
|
|
26
|
+
return { success: false };
|
|
27
|
+
}
|
|
28
|
+
const result = await this.bulkPatch.perform({
|
|
29
|
+
entity: context.refType,
|
|
30
|
+
ids: context.ids,
|
|
31
|
+
patch: buildArchivePatch(true),
|
|
32
|
+
loadingTitleKey: '@general:actions.bulk-archive.confirm.processing',
|
|
33
|
+
successTitleKey: '@general:workflow.entity-bulk-archived',
|
|
34
|
+
successBodyKey: '@general:workflow.entity-bulk-archived-body',
|
|
35
|
+
partialTitleKey: '@general:workflow.bulk.partial-title',
|
|
36
|
+
partialBodyKey: '@general:workflow.bulk.partial-body',
|
|
37
|
+
partialBodyWithReasonKey: '@general:workflow.bulk.partial-body-with-reason',
|
|
38
|
+
failTitleKey: '@general:workflow.bulk.fail-title',
|
|
39
|
+
failBodyKey: '@general:workflow.bulk.fail-body',
|
|
40
|
+
failBodyWithReasonKey: '@general:workflow.bulk.fail-body-with-reason',
|
|
41
|
+
});
|
|
42
|
+
const data = runtimeCommandPayloadData(result);
|
|
43
|
+
if ((data?.succeeded ?? 0) > 0) {
|
|
44
|
+
this.helper.dispatchBulkArchived(context.refType, context.ids, {
|
|
45
|
+
failedIds: (data?.results ?? [])
|
|
46
|
+
.filter((item) => !item.success)
|
|
47
|
+
.map((item) => item.id),
|
|
48
|
+
totalProcessed: data?.succeeded,
|
|
49
|
+
totalFailed: data?.failed,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Dialog already presented — omit message to avoid toast middleware double-fire.
|
|
53
|
+
return result.success
|
|
54
|
+
? { success: true, kind: 'object', data: data }
|
|
55
|
+
: { success: false, message: result.message };
|
|
56
|
+
}
|
|
57
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkArchiveEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
58
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkArchiveEntityCommand, providedIn: 'root' }); }
|
|
59
|
+
}
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkArchiveEntityCommand, decorators: [{
|
|
61
|
+
type: Injectable,
|
|
62
|
+
args: [{ providedIn: 'root' }]
|
|
63
|
+
}] });
|
|
64
|
+
|
|
65
|
+
export { AXPBulkArchiveEntityCommand };
|
|
66
|
+
//# sourceMappingURL=acorex-platform-module-common-client-bulk-archive-entity.command-EIlMyuII.mjs.map
|
package/fesm2022/acorex-platform-module-common-client-bulk-archive-entity.command-EIlMyuII.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-bulk-archive-entity.command-EIlMyuII.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/bulk-archive-entity.command.ts"],"sourcesContent":["import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport { 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 { AXPEntityBulkPatchPerformService } from '@acorex-platform/framework-client/layout/entity';\nimport type { AXPBulkCommandResultData } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPArchiveEntityCommandHelper } from './archive-entity.command.helper';\nimport { buildArchivePatch, normalizeArchiveBulkInput } from './archive-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPBulkArchiveEntityCommand\n implements AXPCommand<AXPContextData, AXPBulkCommandResultData>\n{\n private readonly helper = inject(AXPArchiveEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n private readonly bulkPatch = inject(AXPEntityBulkPatchPerformService);\n\n async execute(\n input: AXPContextData,\n ): AXPCommandExecuteResultPromise<AXPBulkCommandResultData> {\n const context = normalizeArchiveBulkInput(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.bulk-archive.confirm.title',\n '@general:actions.bulk-archive.confirm.message',\n { count: context.ids.length },\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const result = await this.bulkPatch.perform({\n entity: context.refType,\n ids: context.ids,\n patch: buildArchivePatch(true),\n loadingTitleKey: '@general:actions.bulk-archive.confirm.processing',\n successTitleKey: '@general:workflow.entity-bulk-archived',\n successBodyKey: '@general:workflow.entity-bulk-archived-body',\n partialTitleKey: '@general:workflow.bulk.partial-title',\n partialBodyKey: '@general:workflow.bulk.partial-body',\n partialBodyWithReasonKey: '@general:workflow.bulk.partial-body-with-reason',\n failTitleKey: '@general:workflow.bulk.fail-title',\n failBodyKey: '@general:workflow.bulk.fail-body',\n failBodyWithReasonKey: '@general:workflow.bulk.fail-body-with-reason',\n });\n\n const data = runtimeCommandPayloadData(result);\n if ((data?.succeeded ?? 0) > 0) {\n this.helper.dispatchBulkArchived(context.refType, context.ids, {\n failedIds: (data?.results ?? [])\n .filter((item: { success: boolean; id: string }) => !item.success)\n .map((item: { success: boolean; id: string }) => item.id),\n totalProcessed: data?.succeeded,\n totalFailed: data?.failed,\n });\n }\n\n // Dialog already presented — omit message to avoid toast middleware double-fire.\n return result.success\n ? { success: true, kind: 'object' as const, data: data! }\n : { success: false, message: result.message };\n }\n}\n"],"names":[],"mappings":";;;;;;;MAYa,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,gCAAgC,CAAC;AAuDtE,IAAA;IArDC,MAAM,OAAO,CACX,KAAqB,EAAA;AAErB,QAAA,MAAM,OAAO,GAAG,yBAAyB,CAAC,KAAK,CAAC;QAChD,IAAI,CAAC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,CAAC,CAAC,IAAsC,KAAK,CAAC,IAAI,CAAC,OAAO;qBAChE,GAAG,CAAC,CAAC,IAAsC,KAAK,IAAI,CAAC,EAAE,CAAC;gBAC3D,cAAc,EAAE,IAAI,EAAE,SAAS;gBAC/B,WAAW,EAAE,IAAI,EAAE,MAAM;AAC1B,aAAA,CAAC;QACJ;;QAGA,OAAO,MAAM,CAAC;AACZ,cAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAiB,EAAE,IAAI,EAAE,IAAK;AACvD,cAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;IACjD;8GA3DW,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA3B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cADd,MAAM,EAAA,CAAA,CAAA;;2FACnB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
package/fesm2022/acorex-platform-module-common-client-bulk-disable-entity.command-DgoZVXQA.mjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
3
|
+
import { AXPEntityBulkPatchPerformService } from '@acorex-platform/framework-client/layout/entity';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { inject, Injectable } from '@angular/core';
|
|
6
|
+
import { A as AXPDisableEntityCommandHelper, c as normalizeDisableBulkInput, b as buildDisablePatch } from './acorex-platform-module-common-client-disable-entity.command.util-DQl6u2nj.mjs';
|
|
7
|
+
|
|
8
|
+
class AXPBulkDisableEntityCommand {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.helper = inject(AXPDisableEntityCommandHelper);
|
|
11
|
+
this.translationService = inject(AXTranslationService);
|
|
12
|
+
this.bulkPatch = inject(AXPEntityBulkPatchPerformService);
|
|
13
|
+
}
|
|
14
|
+
async execute(input) {
|
|
15
|
+
const context = normalizeDisableBulkInput(input);
|
|
16
|
+
if (!context) {
|
|
17
|
+
return {
|
|
18
|
+
success: false,
|
|
19
|
+
message: {
|
|
20
|
+
text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const confirmed = await this.helper.confirm('@general:actions.bulk-disable.confirm.title', '@general:actions.bulk-disable.confirm.message', { count: context.ids.length });
|
|
25
|
+
if (!confirmed) {
|
|
26
|
+
return { success: false };
|
|
27
|
+
}
|
|
28
|
+
const result = await this.bulkPatch.perform({
|
|
29
|
+
entity: context.refType,
|
|
30
|
+
ids: context.ids,
|
|
31
|
+
patch: buildDisablePatch(true),
|
|
32
|
+
loadingTitleKey: '@general:actions.bulk-disable.confirm.processing',
|
|
33
|
+
successTitleKey: '@general:workflow.entity-bulk-disabled',
|
|
34
|
+
successBodyKey: '@general:workflow.entity-bulk-disabled-body',
|
|
35
|
+
partialTitleKey: '@general:workflow.bulk.partial-title',
|
|
36
|
+
partialBodyKey: '@general:workflow.bulk.partial-body',
|
|
37
|
+
partialBodyWithReasonKey: '@general:workflow.bulk.partial-body-with-reason',
|
|
38
|
+
failTitleKey: '@general:workflow.bulk.fail-title',
|
|
39
|
+
failBodyKey: '@general:workflow.bulk.fail-body',
|
|
40
|
+
failBodyWithReasonKey: '@general:workflow.bulk.fail-body-with-reason',
|
|
41
|
+
});
|
|
42
|
+
const data = runtimeCommandPayloadData(result);
|
|
43
|
+
if ((data?.succeeded ?? 0) > 0) {
|
|
44
|
+
this.helper.dispatchBulkDisabled(context.refType, context.ids, {
|
|
45
|
+
failedIds: (data?.results ?? [])
|
|
46
|
+
.filter((item) => !item.success)
|
|
47
|
+
.map((item) => item.id),
|
|
48
|
+
totalProcessed: data?.succeeded,
|
|
49
|
+
totalFailed: data?.failed,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return result.success
|
|
53
|
+
? { success: true, kind: 'object', data: data }
|
|
54
|
+
: { success: false, message: result.message };
|
|
55
|
+
}
|
|
56
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkDisableEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
57
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkDisableEntityCommand, providedIn: 'root' }); }
|
|
58
|
+
}
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkDisableEntityCommand, decorators: [{
|
|
60
|
+
type: Injectable,
|
|
61
|
+
args: [{ providedIn: 'root' }]
|
|
62
|
+
}] });
|
|
63
|
+
|
|
64
|
+
export { AXPBulkDisableEntityCommand };
|
|
65
|
+
//# sourceMappingURL=acorex-platform-module-common-client-bulk-disable-entity.command-DgoZVXQA.mjs.map
|
package/fesm2022/acorex-platform-module-common-client-bulk-disable-entity.command-DgoZVXQA.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-bulk-disable-entity.command-DgoZVXQA.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/disable-plugin/commands/bulk-disable-entity.command.ts"],"sourcesContent":["import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport { 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 { AXPEntityBulkPatchPerformService } from '@acorex-platform/framework-client/layout/entity';\nimport type { AXPBulkCommandResultData } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPDisableEntityCommandHelper } from './disable-entity.command.helper';\nimport { buildDisablePatch, normalizeDisableBulkInput } from './disable-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPBulkDisableEntityCommand\n implements AXPCommand<AXPContextData, AXPBulkCommandResultData>\n{\n private readonly helper = inject(AXPDisableEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n private readonly bulkPatch = inject(AXPEntityBulkPatchPerformService);\n\n async execute(\n input: AXPContextData,\n ): AXPCommandExecuteResultPromise<AXPBulkCommandResultData> {\n const context = normalizeDisableBulkInput(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.bulk-disable.confirm.title',\n '@general:actions.bulk-disable.confirm.message',\n { count: context.ids.length },\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const result = await this.bulkPatch.perform({\n entity: context.refType,\n ids: context.ids,\n patch: buildDisablePatch(true),\n loadingTitleKey: '@general:actions.bulk-disable.confirm.processing',\n successTitleKey: '@general:workflow.entity-bulk-disabled',\n successBodyKey: '@general:workflow.entity-bulk-disabled-body',\n partialTitleKey: '@general:workflow.bulk.partial-title',\n partialBodyKey: '@general:workflow.bulk.partial-body',\n partialBodyWithReasonKey: '@general:workflow.bulk.partial-body-with-reason',\n failTitleKey: '@general:workflow.bulk.fail-title',\n failBodyKey: '@general:workflow.bulk.fail-body',\n failBodyWithReasonKey: '@general:workflow.bulk.fail-body-with-reason',\n });\n\n const data = runtimeCommandPayloadData(result);\n if ((data?.succeeded ?? 0) > 0) {\n this.helper.dispatchBulkDisabled(context.refType, context.ids, {\n failedIds: (data?.results ?? [])\n .filter((item: { success: boolean; id: string }) => !item.success)\n .map((item: { success: boolean; id: string }) => item.id),\n totalProcessed: data?.succeeded,\n totalFailed: data?.failed,\n });\n }\n\n return result.success\n ? { success: true, kind: 'object' as const, data: data! }\n : { success: false, message: result.message };\n }\n}\n"],"names":[],"mappings":";;;;;;;MAYa,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,gCAAgC,CAAC;AAsDtE,IAAA;IApDC,MAAM,OAAO,CACX,KAAqB,EAAA;AAErB,QAAA,MAAM,OAAO,GAAG,yBAAyB,CAAC,KAAK,CAAC;QAChD,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;QAEA,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACzC,6CAA6C,EAC7C,+CAA+C,EAC/C,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAC9B;QACD,IAAI,CAAC,SAAS,EAAE;AACd,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3B;QAEA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC1C,MAAM,EAAE,OAAO,CAAC,OAAO;YACvB,GAAG,EAAE,OAAO,CAAC,GAAG;AAChB,YAAA,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC;AAC9B,YAAA,eAAe,EAAE,kDAAkD;AACnE,YAAA,eAAe,EAAE,wCAAwC;AACzD,YAAA,cA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,EAAA,CAAA,CAAA;;2FACnB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
3
|
+
import { AXPEntityBulkPatchPerformService } from '@acorex-platform/framework-client/layout/entity';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { inject, Injectable } from '@angular/core';
|
|
6
|
+
import { A as AXPDisableEntityCommandHelper, c as normalizeDisableBulkInput, b as buildDisablePatch } from './acorex-platform-module-common-client-disable-entity.command.util-DQl6u2nj.mjs';
|
|
7
|
+
|
|
8
|
+
class AXPBulkEnableEntityCommand {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.helper = inject(AXPDisableEntityCommandHelper);
|
|
11
|
+
this.translationService = inject(AXTranslationService);
|
|
12
|
+
this.bulkPatch = inject(AXPEntityBulkPatchPerformService);
|
|
13
|
+
}
|
|
14
|
+
async execute(input) {
|
|
15
|
+
const context = normalizeDisableBulkInput(input);
|
|
16
|
+
if (!context) {
|
|
17
|
+
return {
|
|
18
|
+
success: false,
|
|
19
|
+
message: {
|
|
20
|
+
text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const confirmed = await this.helper.confirm('@general:actions.bulk-enable.confirm.title', '@general:actions.bulk-enable.confirm.message', { count: context.ids.length }, 'success');
|
|
25
|
+
if (!confirmed) {
|
|
26
|
+
return { success: false };
|
|
27
|
+
}
|
|
28
|
+
const result = await this.bulkPatch.perform({
|
|
29
|
+
entity: context.refType,
|
|
30
|
+
ids: context.ids,
|
|
31
|
+
patch: buildDisablePatch(false),
|
|
32
|
+
loadingTitleKey: '@general:actions.bulk-enable.confirm.processing',
|
|
33
|
+
successTitleKey: '@general:workflow.entity-bulk-enabled',
|
|
34
|
+
successBodyKey: '@general:workflow.entity-bulk-enabled-body',
|
|
35
|
+
partialTitleKey: '@general:workflow.bulk.partial-title',
|
|
36
|
+
partialBodyKey: '@general:workflow.bulk.partial-body',
|
|
37
|
+
partialBodyWithReasonKey: '@general:workflow.bulk.partial-body-with-reason',
|
|
38
|
+
failTitleKey: '@general:workflow.bulk.fail-title',
|
|
39
|
+
failBodyKey: '@general:workflow.bulk.fail-body',
|
|
40
|
+
failBodyWithReasonKey: '@general:workflow.bulk.fail-body-with-reason',
|
|
41
|
+
});
|
|
42
|
+
const data = runtimeCommandPayloadData(result);
|
|
43
|
+
if ((data?.succeeded ?? 0) > 0) {
|
|
44
|
+
this.helper.dispatchBulkEnabled(context.refType, context.ids, {
|
|
45
|
+
failedIds: (data?.results ?? [])
|
|
46
|
+
.filter((item) => !item.success)
|
|
47
|
+
.map((item) => item.id),
|
|
48
|
+
totalProcessed: data?.succeeded,
|
|
49
|
+
totalFailed: data?.failed,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return result.success
|
|
53
|
+
? { success: true, kind: 'object', data: data }
|
|
54
|
+
: { success: false, message: result.message };
|
|
55
|
+
}
|
|
56
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkEnableEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
57
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkEnableEntityCommand, providedIn: 'root' }); }
|
|
58
|
+
}
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkEnableEntityCommand, decorators: [{
|
|
60
|
+
type: Injectable,
|
|
61
|
+
args: [{ providedIn: 'root' }]
|
|
62
|
+
}] });
|
|
63
|
+
|
|
64
|
+
export { AXPBulkEnableEntityCommand };
|
|
65
|
+
//# sourceMappingURL=acorex-platform-module-common-client-bulk-enable-entity.command-C6fba__g.mjs.map
|
package/fesm2022/acorex-platform-module-common-client-bulk-enable-entity.command-C6fba__g.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-bulk-enable-entity.command-C6fba__g.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/disable-plugin/commands/bulk-enable-entity.command.ts"],"sourcesContent":["import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport { 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 { AXPEntityBulkPatchPerformService } from '@acorex-platform/framework-client/layout/entity';\nimport type { AXPBulkCommandResultData } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPDisableEntityCommandHelper } from './disable-entity.command.helper';\nimport { buildDisablePatch, normalizeDisableBulkInput } from './disable-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPBulkEnableEntityCommand\n implements AXPCommand<AXPContextData, AXPBulkCommandResultData>\n{\n private readonly helper = inject(AXPDisableEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n private readonly bulkPatch = inject(AXPEntityBulkPatchPerformService);\n\n async execute(\n input: AXPContextData,\n ): AXPCommandExecuteResultPromise<AXPBulkCommandResultData> {\n const context = normalizeDisableBulkInput(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.bulk-enable.confirm.title',\n '@general:actions.bulk-enable.confirm.message',\n { count: context.ids.length },\n 'success',\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const result = await this.bulkPatch.perform({\n entity: context.refType,\n ids: context.ids,\n patch: buildDisablePatch(false),\n loadingTitleKey: '@general:actions.bulk-enable.confirm.processing',\n successTitleKey: '@general:workflow.entity-bulk-enabled',\n successBodyKey: '@general:workflow.entity-bulk-enabled-body',\n partialTitleKey: '@general:workflow.bulk.partial-title',\n partialBodyKey: '@general:workflow.bulk.partial-body',\n partialBodyWithReasonKey: '@general:workflow.bulk.partial-body-with-reason',\n failTitleKey: '@general:workflow.bulk.fail-title',\n failBodyKey: '@general:workflow.bulk.fail-body',\n failBodyWithReasonKey: '@general:workflow.bulk.fail-body-with-reason',\n });\n\n const data = runtimeCommandPayloadData(result);\n if ((data?.succeeded ?? 0) > 0) {\n this.helper.dispatchBulkEnabled(context.refType, context.ids, {\n failedIds: (data?.results ?? [])\n .filter((item: { success: boolean; id: string }) => !item.success)\n .map((item: { success: boolean; id: string }) => item.id),\n totalProcessed: data?.succeeded,\n totalFailed: data?.failed,\n });\n }\n\n return result.success\n ? { success: true, kind: 'object' as const, data: data! }\n : { success: false, message: result.message };\n }\n}"],"names":[],"mappings":";;;;;;;MAYa,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,gCAAgC,CAAC;AAuDtE,IAAA;IArDC,MAAM,OAAO,CACX,KAAqB,EAAA;AAErB,QAAA,MAAM,OAAO,GAAG,yBAAyB,CAAC,KAAK,CAAC;QAChD,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;QAEA,MAAM,SAAS,GAAG,MAAM,IA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,CAAC;QACJ;QAEA,OAAO,MAAM,CAAC;AACZ,cAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAiB,EAAE,IAAI,EAAE,IAAK;AACvD,cAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;IACjD;8GA3DW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,0BAA0B,cADb,MAAM,EAAA,CAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXTranslationService } from '@acorex/core/translation';
|
|
3
|
+
import { AXPEntityBulkPatchPerformService } from '@acorex-platform/framework-client/layout/entity';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { inject, Injectable } from '@angular/core';
|
|
6
|
+
import { A as AXPArchiveEntityCommandHelper, c as normalizeArchiveBulkInput, b as buildArchivePatch } from './acorex-platform-module-common-client-archive-entity.command.util-BVrK8ZGy.mjs';
|
|
7
|
+
|
|
8
|
+
class AXPBulkRestoreArchiveEntityCommand {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.helper = inject(AXPArchiveEntityCommandHelper);
|
|
11
|
+
this.translationService = inject(AXTranslationService);
|
|
12
|
+
this.bulkPatch = inject(AXPEntityBulkPatchPerformService);
|
|
13
|
+
}
|
|
14
|
+
async execute(input) {
|
|
15
|
+
const context = normalizeArchiveBulkInput(input);
|
|
16
|
+
if (!context) {
|
|
17
|
+
return {
|
|
18
|
+
success: false,
|
|
19
|
+
message: {
|
|
20
|
+
text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const confirmed = await this.helper.confirm('@general:actions.bulk-restore-archive.confirm.title', '@general:actions.bulk-restore-archive.confirm.message', { count: context.ids.length });
|
|
25
|
+
if (!confirmed) {
|
|
26
|
+
return { success: false };
|
|
27
|
+
}
|
|
28
|
+
const result = await this.bulkPatch.perform({
|
|
29
|
+
entity: context.refType,
|
|
30
|
+
ids: context.ids,
|
|
31
|
+
patch: buildArchivePatch(false),
|
|
32
|
+
loadingTitleKey: '@general:actions.bulk-restore-archive.confirm.processing',
|
|
33
|
+
successTitleKey: '@general:workflow.entity-bulk-unarchived',
|
|
34
|
+
successBodyKey: '@general:workflow.entity-bulk-unarchived-body',
|
|
35
|
+
partialTitleKey: '@general:workflow.bulk.partial-title',
|
|
36
|
+
partialBodyKey: '@general:workflow.bulk.partial-body',
|
|
37
|
+
partialBodyWithReasonKey: '@general:workflow.bulk.partial-body-with-reason',
|
|
38
|
+
failTitleKey: '@general:workflow.bulk.fail-title',
|
|
39
|
+
failBodyKey: '@general:workflow.bulk.fail-body',
|
|
40
|
+
failBodyWithReasonKey: '@general:workflow.bulk.fail-body-with-reason',
|
|
41
|
+
});
|
|
42
|
+
const data = runtimeCommandPayloadData(result);
|
|
43
|
+
if ((data?.succeeded ?? 0) > 0) {
|
|
44
|
+
this.helper.dispatchBulkUnarchived(context.refType, context.ids, {
|
|
45
|
+
failedIds: (data?.results ?? [])
|
|
46
|
+
.filter((item) => !item.success)
|
|
47
|
+
.map((item) => item.id),
|
|
48
|
+
totalProcessed: data?.succeeded,
|
|
49
|
+
totalFailed: data?.failed,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return result.success
|
|
53
|
+
? { success: true, kind: 'object', data: data }
|
|
54
|
+
: { success: false, message: result.message };
|
|
55
|
+
}
|
|
56
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkRestoreArchiveEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
57
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkRestoreArchiveEntityCommand, providedIn: 'root' }); }
|
|
58
|
+
}
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPBulkRestoreArchiveEntityCommand, decorators: [{
|
|
60
|
+
type: Injectable,
|
|
61
|
+
args: [{ providedIn: 'root' }]
|
|
62
|
+
}] });
|
|
63
|
+
|
|
64
|
+
export { AXPBulkRestoreArchiveEntityCommand };
|
|
65
|
+
//# sourceMappingURL=acorex-platform-module-common-client-bulk-restore-archive-entity.command-C8T0gUAH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-bulk-restore-archive-entity.command-C8T0gUAH.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/bulk-restore-archive-entity.command.ts"],"sourcesContent":["import { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport { 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 { AXPEntityBulkPatchPerformService } from '@acorex-platform/framework-client/layout/entity';\nimport type { AXPBulkCommandResultData } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPArchiveEntityCommandHelper } from './archive-entity.command.helper';\nimport { buildArchivePatch, normalizeArchiveBulkInput } from './archive-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPBulkRestoreArchiveEntityCommand\n implements AXPCommand<AXPContextData, AXPBulkCommandResultData>\n{\n private readonly helper = inject(AXPArchiveEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n private readonly bulkPatch = inject(AXPEntityBulkPatchPerformService);\n\n async execute(\n input: AXPContextData,\n ): AXPCommandExecuteResultPromise<AXPBulkCommandResultData> {\n const context = normalizeArchiveBulkInput(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.bulk-restore-archive.confirm.title',\n '@general:actions.bulk-restore-archive.confirm.message',\n { count: context.ids.length },\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const result = await this.bulkPatch.perform({\n entity: context.refType,\n ids: context.ids,\n patch: buildArchivePatch(false),\n loadingTitleKey: '@general:actions.bulk-restore-archive.confirm.processing',\n successTitleKey: '@general:workflow.entity-bulk-unarchived',\n successBodyKey: '@general:workflow.entity-bulk-unarchived-body',\n partialTitleKey: '@general:workflow.bulk.partial-title',\n partialBodyKey: '@general:workflow.bulk.partial-body',\n partialBodyWithReasonKey: '@general:workflow.bulk.partial-body-with-reason',\n failTitleKey: '@general:workflow.bulk.fail-title',\n failBodyKey: '@general:workflow.bulk.fail-body',\n failBodyWithReasonKey: '@general:workflow.bulk.fail-body-with-reason',\n });\n\n const data = runtimeCommandPayloadData(result);\n if ((data?.succeeded ?? 0) > 0) {\n this.helper.dispatchBulkUnarchived(context.refType, context.ids, {\n failedIds: (data?.results ?? [])\n .filter((item: { success: boolean; id: string }) => !item.success)\n .map((item: { success: boolean; id: string }) => item.id),\n totalProcessed: data?.succeeded,\n totalFailed: data?.failed,\n });\n }\n\n return result.success\n ? { success: true, kind: 'object' as const, data: data! }\n : { success: false, message: result.message };\n }\n}"],"names":[],"mappings":";;;;;;;MAYa,kCAAkC,CAAA;AAD/C,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,C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F,QAAA,MAAM,IAAI,GAAG,yBAAyB,CAAC,MAAM,CAAC;QAC9C,IAAI,CAAC,IAAI,EAAE,SAAS,IAAI,CAAC,IAAI,CAAC,EAAE;AAC9B,YAAA,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE;AAC/D,gBAAA,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;qBAC5B,MAAM,CAAC,CAAC,IAAsC,KAAK,CAAC,IAAI,CAAC,OAAO;qBAChE,GAAG,CAAC,CAAC,IAAsC,KAAK,IAAI,CAAC,EAAE,CAAC;gBAC3D,cAAc,EAAE,IAAI,EAAE,SAAS;gBAC/B,WAAW,EAAE,IAAI,EAAE,MAAM;AAC1B,aAAA,CAAC;QACJ;QAEA,OAAO,MAAM,CAAC;AACZ,cAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAiB,EAAE,IAAI,EAAE,IAAK;AACvD,cAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE;IACjD;8GA1DW,kCAAkC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kCAAkC,cADrB,MAAM,EAAA,CAAA,CAAA;;2FACnB,kCAAkC,EAAA,UAAA,EAAA,CAAA;kBAD9C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -4,12 +4,11 @@ import { inject, Injectable } from '@angular/core';
|
|
|
4
4
|
import { AXDialogService } from '@acorex/components/dialog';
|
|
5
5
|
import { AXLoadingDialogService } from '@acorex/components/loading-dialog';
|
|
6
6
|
import { AXToastService } from '@acorex/components/toast';
|
|
7
|
-
import { AXPSettingsService, AXPCommonSettings
|
|
7
|
+
import { AXPSettingsService, AXPCommonSettings } from '@acorex-platform/framework-client/common';
|
|
8
|
+
import { AXPEntityBroadcastService } from '@acorex-platform/framework-client/core';
|
|
8
9
|
import { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';
|
|
9
|
-
import {
|
|
10
|
-
import { t as toVariableName, i as isValidVariableName } from './acorex-platform-module-common-client-acorex-platform-module-common-client-
|
|
11
|
-
|
|
12
|
-
const AXPEntityClonedEvent = createWorkFlowEvent('[Entity] Cloned');
|
|
10
|
+
import { resolveEntityActionRef } from '@acorex-platform/framework-shared/runtime';
|
|
11
|
+
import { t as toVariableName, i as isValidVariableName } from './acorex-platform-module-common-client-acorex-platform-module-common-client-CkeshVWo.mjs';
|
|
13
12
|
|
|
14
13
|
class AXPCloneEntityCommandHelper {
|
|
15
14
|
constructor() {
|
|
@@ -19,7 +18,7 @@ class AXPCloneEntityCommandHelper {
|
|
|
19
18
|
this.translationService = inject(AXTranslationService);
|
|
20
19
|
this.toastService = inject(AXToastService);
|
|
21
20
|
this.settingsService = inject(AXPSettingsService);
|
|
22
|
-
this.
|
|
21
|
+
this.entityEvents = inject(AXPEntityBroadcastService);
|
|
23
22
|
}
|
|
24
23
|
async resolveEntity(refType) {
|
|
25
24
|
const [moduleName, entityName] = refType.split('.');
|
|
@@ -66,14 +65,17 @@ class AXPCloneEntityCommandHelper {
|
|
|
66
65
|
content: contentKey ? await this.translationService.translateAsync(contentKey) : undefined,
|
|
67
66
|
});
|
|
68
67
|
}
|
|
69
|
-
dispatchCloned(refType,
|
|
70
|
-
this.
|
|
71
|
-
|
|
68
|
+
dispatchCloned(refType, _originalId, newId, meta) {
|
|
69
|
+
this.entityEvents.publishLayoutRefresh(refType, {
|
|
70
|
+
...meta,
|
|
71
|
+
highlightRowId: newId,
|
|
72
|
+
resetPagination: true,
|
|
73
|
+
});
|
|
72
74
|
}
|
|
73
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
74
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
75
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPCloneEntityCommandHelper, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
76
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPCloneEntityCommandHelper, providedIn: 'root' }); }
|
|
75
77
|
}
|
|
76
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPCloneEntityCommandHelper, decorators: [{
|
|
77
79
|
type: Injectable,
|
|
78
80
|
args: [{ providedIn: 'root' }]
|
|
79
81
|
}] });
|
|
@@ -130,18 +132,15 @@ function resolveClonedName(clonedData, derivedName, hasVariableNameValidation) {
|
|
|
130
132
|
//#endregion
|
|
131
133
|
|
|
132
134
|
function normalizeCloneInput(input) {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
const data = ctx?.['data'] ?? input;
|
|
136
|
-
const rowData = Array.isArray(data)
|
|
137
|
-
? data[0]
|
|
138
|
-
: data;
|
|
139
|
-
const refType = String(options['refType'] ?? ctx?.['entity'] ?? ctx?.['entityInfo']?.['source'] ?? '');
|
|
140
|
-
const rawId = options['refId'] ?? rowData?.['id'] ?? rowData?.['_id'] ?? input['refId'];
|
|
141
|
-
if (!refType || rawId == null || rawId === '') {
|
|
135
|
+
const resolved = resolveEntityActionRef(input);
|
|
136
|
+
if (!resolved) {
|
|
142
137
|
return null;
|
|
143
138
|
}
|
|
144
|
-
return {
|
|
139
|
+
return {
|
|
140
|
+
refId: resolved.refId,
|
|
141
|
+
refType: resolved.refType,
|
|
142
|
+
rowData: resolved.rowData,
|
|
143
|
+
};
|
|
145
144
|
}
|
|
146
145
|
function prepareClonedData(originalData, entityDefinition) {
|
|
147
146
|
const clonedData = { ...originalData };
|
|
@@ -200,7 +199,7 @@ class AXPCloneEntityCommand {
|
|
|
200
199
|
const meta = buildCloneRefreshMeta(entityDefinition, clonedData);
|
|
201
200
|
this.helper.dispatchCloned(context.refType, context.refId, newId, meta);
|
|
202
201
|
await this.helper.showSuccessToast('@general:workflow.entity-cloned', '@general:workflow.entity-cloned-body');
|
|
203
|
-
return { success: true, data: { newId } };
|
|
202
|
+
return { success: true, kind: 'object', data: { newId } };
|
|
204
203
|
}
|
|
205
204
|
catch (error) {
|
|
206
205
|
console.error('Clone operation failed:', error);
|
|
@@ -215,13 +214,13 @@ class AXPCloneEntityCommand {
|
|
|
215
214
|
loadingDialog.close();
|
|
216
215
|
}
|
|
217
216
|
}
|
|
218
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
219
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
217
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPCloneEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
218
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPCloneEntityCommand, providedIn: 'root' }); }
|
|
220
219
|
}
|
|
221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
220
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPCloneEntityCommand, decorators: [{
|
|
222
221
|
type: Injectable,
|
|
223
222
|
args: [{ providedIn: 'root' }]
|
|
224
223
|
}] });
|
|
225
224
|
|
|
226
225
|
export { AXPCloneEntityCommand };
|
|
227
|
-
//# sourceMappingURL=acorex-platform-module-common-client-clone-entity.command-
|
|
226
|
+
//# sourceMappingURL=acorex-platform-module-common-client-clone-entity.command-rTasIhWx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-clone-entity.command-rTasIhWx.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/clone-plugin/commands/clone-entity.command.helper.ts","../../../../libs/modules/common/client/src/lib/features/clone-plugin/clone-identifier-fields.util.ts","../../../../libs/modules/common/client/src/lib/features/clone-plugin/commands/clone-entity.command.util.ts","../../../../libs/modules/common/client/src/lib/features/clone-plugin/commands/clone-entity.command.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 { AXPCommonSettings, AXPSettingsService } 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\n@Injectable({ providedIn: 'root' })\nexport class AXPCloneEntityCommandHelper {\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\n async resolveEntity(refType: string): Promise<AXPEntity> {\n const [moduleName, entityName] = refType.split('.');\n return this.entityRegistry.resolve(moduleName, entityName);\n }\n\n async fetchEntityData(refType: string, refId: string): Promise<AXPContextData> {\n const entityDefinition = await this.resolveEntity(refType);\n\n if (entityDefinition.queries?.byKey) {\n const queryExec = entityDefinition.queries.byKey.execute as\n | ((id: string) => Promise<AXPContextData>)\n | undefined;\n\n if (!queryExec) {\n throw new Error('Entity byKey query is not executable');\n }\n\n return queryExec(refId);\n }\n\n return { id: refId };\n }\n\n async createEntity(refType: string, data: AXPContextData): Promise<string> {\n const entityDefinition = await this.resolveEntity(refType);\n const createExec = entityDefinition.commands?.create?.execute as\n | ((payload: AXPContextData) => Promise<string>)\n | undefined;\n\n if (!createExec) {\n throw new Error('Entity does not support create operation');\n }\n\n return createExec(data);\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 dispatchCloned(refType: string, _originalId: string, newId: string, meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, {\n ...(meta as Record<string, unknown> | undefined),\n highlightRowId: newId,\n resetPagination: true,\n });\n }\n}\n","import type { AXPContextData } from '@acorex-platform/framework-shared/core';\nimport { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { isValidVariableName, toVariableName } from '../../validations/utils/variable-name.util';\nimport { AXPDerivedNameExtension } from '../derived-name-plugin/derived-name.plugin';\n\n//#region ---- Constants ----\n\nexport const CLONE_TITLE_SUFFIX = ' (Copy)';\nexport const CLONE_CODE_SUFFIX = '_copy';\n\n//#endregion\n\n//#region ---- Clone Identifier Field Preparation ----\n\n/**\n * Adjusts common identifier fields after cloning.\n * Uses entity metadata (derived-name plugin, variable-name validation) to pick a safe strategy.\n */\nexport function prepareCloneIdentifierFields(\n clonedData: AXPContextData,\n entityDefinition: AXPEntity,\n): void {\n const derivedName = (entityDefinition as { extensions?: { derivedName?: AXPDerivedNameExtension } }).extensions\n ?.derivedName;\n const properties = entityDefinition.properties ?? [];\n\n const propertyHasVariableNameRule = (fieldName: string): boolean =>\n properties.some(\n (prop) =>\n prop.name === fieldName && prop.validations?.some((validation) => validation.rule === 'variable-name'),\n );\n\n const title = clonedData['title'];\n if (typeof title === 'string' && title.trim()) {\n clonedData['title'] = `${title.trim()}${CLONE_TITLE_SUFFIX}`;\n }\n\n if (Object.prototype.hasOwnProperty.call(clonedData, 'name')) {\n clonedData['name'] = resolveClonedName(clonedData, derivedName, propertyHasVariableNameRule('name'));\n }\n\n const code = clonedData['code'];\n if (typeof code === 'string' && code.trim()) {\n clonedData['code'] = `${code.trim()}${CLONE_CODE_SUFFIX}`;\n }\n}\n\nfunction resolveClonedName(\n clonedData: AXPContextData,\n derivedName: AXPDerivedNameExtension | undefined,\n hasVariableNameValidation: boolean,\n): string {\n const sourceField = derivedName?.sourceField ?? 'title';\n const sourceValue = clonedData[sourceField];\n\n if (derivedName || hasVariableNameValidation) {\n const fromSource = toVariableName(sourceValue);\n if (fromSource) {\n return fromSource;\n }\n }\n\n const currentName = clonedData['name'];\n if (typeof currentName === 'string' && currentName.trim()) {\n const suffixed = `${currentName.trim()}${CLONE_CODE_SUFFIX}`;\n if (isValidVariableName(suffixed)) {\n return suffixed;\n }\n\n const fromTitle = toVariableName(clonedData['title']);\n if (fromTitle) {\n return fromTitle;\n }\n\n return toVariableName(currentName, 'clone');\n }\n\n return toVariableName(clonedData['title'], 'clone');\n}\n\n//#endregion\n","import type { AXPContextData } from '@acorex-platform/framework-shared/core';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { resolveEntityActionRef } from '@acorex-platform/framework-shared/runtime';\n\nimport { prepareCloneIdentifierFields } from '../clone-identifier-fields.util';\n\nexport interface AXPCloneCommandContext {\n refId: string;\n refType: string;\n rowData?: AXPContextData;\n}\n\nexport function normalizeCloneInput(input: AXPContextData): AXPCloneCommandContext | 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 prepareClonedData(originalData: AXPContextData, entityDefinition: AXPEntity): AXPContextData {\n const clonedData = { ...originalData };\n\n delete clonedData['id'];\n delete clonedData['createdAt'];\n delete clonedData['updatedAt'];\n delete clonedData['createdBy'];\n delete clonedData['updatedBy'];\n delete clonedData['version'];\n delete clonedData['isArchived'];\n delete clonedData['archivedAt'];\n delete clonedData['isDisabled'];\n delete clonedData['disabledAt'];\n\n prepareCloneIdentifierFields(clonedData, entityDefinition);\n\n if (clonedData['isActive'] !== undefined) {\n clonedData['isActive'] = true;\n }\n if (clonedData['status'] !== undefined) {\n clonedData['status'] = 'draft';\n }\n\n return clonedData;\n}\n\nexport function buildCloneRefreshMeta(\n entityDefinition: AXPEntity,\n clonedData: AXPContextData,\n): AXPContextData {\n const meta: AXPContextData = {};\n if (entityDefinition.parentKey && clonedData[entityDefinition.parentKey] != null) {\n meta['refreshTargetId'] = clonedData[entityDefinition.parentKey];\n }\n return meta;\n}\n","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 { AXPCloneEntityCommandHelper } from './clone-entity.command.helper';\nimport {\n buildCloneRefreshMeta,\n normalizeCloneInput,\n prepareClonedData,\n} from './clone-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPCloneEntityCommand implements AXPCommand<AXPContextData, { newId: string }> {\n private readonly helper = inject(AXPCloneEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(input: AXPContextData): AXPCommandExecuteResultPromise<{ newId: string }> {\n const context = normalizeCloneInput(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.clone.confirm.title',\n '@general:actions.clone.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.clone.confirm.processing'),\n 'Cloning...',\n );\n\n try {\n const entityDefinition = await this.helper.resolveEntity(context.refType);\n const originalData = await this.helper.fetchEntityData(context.refType, context.refId);\n const clonedData = prepareClonedData(originalData, entityDefinition);\n const newId = await this.helper.createEntity(context.refType, clonedData);\n\n const meta = buildCloneRefreshMeta(entityDefinition, clonedData);\n this.helper.dispatchCloned(context.refType, context.refId, newId, meta);\n await this.helper.showSuccessToast('@general:workflow.entity-cloned', '@general:workflow.entity-cloned-body');\n\n return { success: true, kind: 'object', data: { newId } };\n } catch (error) {\n console.error('Clone operation failed:', error);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Clone operation failed',\n },\n };\n } finally {\n loadingDialog.close();\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;MAYa,2BAA2B,CAAA;AADxC,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,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,sBAAsB,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,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