@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-disable-entity.command-Bc1uH38V.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/disable-plugin/commands/disable-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 { AXPDisableEntityCommandHelper } from './disable-entity.command.helper';\nimport { buildDisablePatch, buildDisableRefreshMeta, normalizeDisableSingleInput } from './disable-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPDisableEntityCommand implements AXPCommand<AXPContextData, void> {\n private readonly helper = inject(AXPDisableEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(input: AXPContextData): AXPCommandExecuteResultPromise<void> {\n const context = normalizeDisableSingleInput(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.disable.confirm.title',\n '@general:actions.disable.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.disable.confirm.processing'),\n 'Disabling...',\n );\n\n try {\n const entityDefinition = await this.helper.resolveEntity(context.refType);\n const patch = buildDisablePatch(true);\n await this.helper.applyPatch(context.refType, context.refId, patch);\n\n const meta = buildDisableRefreshMeta(entityDefinition, context.rowData);\n this.helper.dispatchDisabled(context.refType, context.refId, meta);\n await this.helper.showSuccessToast(\n '@general:workflow.entity-disabled',\n '@general:workflow.entity-disabled-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 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;AA8CnE,IAAA;IA5CC,MAAM,OAAO,CAAC,KAAqB,EAAA;AACjC,QAAA,MAAM,OAAO,GAAG,2BAA2B,CAAC,KAAK,CAAC;QAClD,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;AACL,gBAA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YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3B;gBAAU;YACR,aAAa,CAAC,KAAK,EAAE;QACvB;IACF;8GA/CW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,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,uBAAuB,cADV,MAAM,EAAA,CAAA,CAAA;;2FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -2,16 +2,12 @@ import { AXDialogService } from '@acorex/components/dialog';
|
|
|
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
|
-
|
|
11
|
-
const AXPEntityDisabledEvent = createWorkFlowEvent('[Entity] Disabled');
|
|
12
|
-
const AXPEntityEnabledEvent = createWorkFlowEvent('[Entity] Enabled');
|
|
13
|
-
const AXPEntityBulkDisabledEvent = createWorkFlowEvent('[Entity] Bulk Disabled');
|
|
14
|
-
const AXPEntityBulkEnabledEvent = createWorkFlowEvent('[Entity] Bulk Enabled');
|
|
10
|
+
import { resolveEntityActionRef, resolveEntityActionBulkRef } from '@acorex-platform/framework-shared/runtime';
|
|
15
11
|
|
|
16
12
|
class AXPDisableEntityCommandHelper {
|
|
17
13
|
constructor() {
|
|
@@ -21,7 +17,7 @@ class AXPDisableEntityCommandHelper {
|
|
|
21
17
|
this.translationService = inject(AXTranslationService);
|
|
22
18
|
this.toastService = inject(AXToastService);
|
|
23
19
|
this.settingsService = inject(AXPSettingsService);
|
|
24
|
-
this.
|
|
20
|
+
this.entityEvents = inject(AXPEntityBroadcastService);
|
|
25
21
|
}
|
|
26
22
|
async resolveEntity(refType) {
|
|
27
23
|
const [moduleName, entityName] = refType.split('.');
|
|
@@ -33,7 +29,8 @@ class AXPDisableEntityCommandHelper {
|
|
|
33
29
|
if (!updateExec) {
|
|
34
30
|
throw new Error('Entity does not support update operation');
|
|
35
31
|
}
|
|
36
|
-
await updateExec({ id: refId, ...patch });
|
|
32
|
+
const result = await updateExec({ id: refId, ...patch });
|
|
33
|
+
throwIfCommandFailed(result);
|
|
37
34
|
}
|
|
38
35
|
async confirm(titleKey, messageKey, messageParams, color = 'warning') {
|
|
39
36
|
const dialogResult = await this.dialogService.confirm(await this.translationService.translateAsync(titleKey), await this.translationService.translateAsync(messageKey, { params: messageParams }), color, 'horizontal', false, 'cancel');
|
|
@@ -64,33 +61,45 @@ class AXPDisableEntityCommandHelper {
|
|
|
64
61
|
}
|
|
65
62
|
this.toastService.show({
|
|
66
63
|
color: 'danger',
|
|
67
|
-
title: await this.translationService.translateAsync('@general:
|
|
64
|
+
title: await this.translationService.translateAsync('@general:messages.generic.error.title'),
|
|
68
65
|
content: message,
|
|
69
66
|
closeButton: true,
|
|
70
67
|
timeOut: 6000,
|
|
71
68
|
timeOutProgress: true,
|
|
72
69
|
});
|
|
73
70
|
}
|
|
74
|
-
|
|
75
|
-
this.
|
|
76
|
-
|
|
71
|
+
async showErrorToastFor(error, fallbackKey) {
|
|
72
|
+
const enabled = await this.settingsService.get(AXPCommonSettings.EnableOperationToasts);
|
|
73
|
+
if (!enabled) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const info = extractRequestErrorInfo(error);
|
|
77
|
+
const contentKey = platformErrorI18nKey(info?.code) ??
|
|
78
|
+
(typeof info?.message === 'string' && info.message.startsWith('@')
|
|
79
|
+
? info.message
|
|
80
|
+
: null) ??
|
|
81
|
+
fallbackKey;
|
|
82
|
+
const content = contentKey.startsWith('@')
|
|
83
|
+
? await this.translationService.translateAsync(contentKey)
|
|
84
|
+
: contentKey;
|
|
85
|
+
await this.showErrorToast(content);
|
|
86
|
+
}
|
|
87
|
+
dispatchDisabled(refType, _id, meta) {
|
|
88
|
+
this.entityEvents.publishLayoutRefresh(refType, meta);
|
|
77
89
|
}
|
|
78
|
-
dispatchEnabled(refType,
|
|
79
|
-
this.
|
|
80
|
-
this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta }));
|
|
90
|
+
dispatchEnabled(refType, _id, meta) {
|
|
91
|
+
this.entityEvents.publishLayoutRefresh(refType, meta);
|
|
81
92
|
}
|
|
82
|
-
dispatchBulkDisabled(refType,
|
|
83
|
-
this.
|
|
84
|
-
this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta: { refreshType: 'bulk-disable', ...meta } }));
|
|
93
|
+
dispatchBulkDisabled(refType, _ids, meta) {
|
|
94
|
+
this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-disable', ...(meta ?? {}) });
|
|
85
95
|
}
|
|
86
|
-
dispatchBulkEnabled(refType,
|
|
87
|
-
this.
|
|
88
|
-
this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta: { refreshType: 'bulk-enable', ...meta } }));
|
|
96
|
+
dispatchBulkEnabled(refType, _ids, meta) {
|
|
97
|
+
this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-enable', ...(meta ?? {}) });
|
|
89
98
|
}
|
|
90
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
91
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
99
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPDisableEntityCommandHelper, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
100
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPDisableEntityCommandHelper, providedIn: 'root' }); }
|
|
92
101
|
}
|
|
93
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPDisableEntityCommandHelper, decorators: [{
|
|
94
103
|
type: Injectable,
|
|
95
104
|
args: [{ providedIn: 'root' }]
|
|
96
105
|
}] });
|
|
@@ -99,30 +108,26 @@ const DEFAULT_DISABLE_FIELD = 'isDisabled';
|
|
|
99
108
|
const DISABLE_TIMESTAMP_FIELD = 'disabledAt';
|
|
100
109
|
const ENABLE_TIMESTAMP_FIELD = 'enabledAt';
|
|
101
110
|
function normalizeDisableSingleInput(input) {
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
const data = ctx?.['data'] ?? input;
|
|
105
|
-
const rowData = Array.isArray(data)
|
|
106
|
-
? data[0]
|
|
107
|
-
: data;
|
|
108
|
-
const refType = String(options['refType'] ?? ctx?.['entity'] ?? ctx?.['entityInfo']?.['source'] ?? '');
|
|
109
|
-
const rawId = options['refId'] ?? rowData?.['id'] ?? rowData?.['_id'] ?? input['refId'];
|
|
110
|
-
if (!refType || rawId == null || rawId === '') {
|
|
111
|
+
const resolved = resolveEntityActionRef(input);
|
|
112
|
+
if (!resolved) {
|
|
111
113
|
return null;
|
|
112
114
|
}
|
|
113
|
-
return {
|
|
115
|
+
return {
|
|
116
|
+
refId: resolved.refId,
|
|
117
|
+
refType: resolved.refType,
|
|
118
|
+
rowData: resolved.rowData,
|
|
119
|
+
};
|
|
114
120
|
}
|
|
115
121
|
function normalizeDisableBulkInput(input) {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
const data = ctx?.['data'] ?? input['data'] ?? input;
|
|
119
|
-
const rows = (Array.isArray(data) ? data : data ? [data] : []);
|
|
120
|
-
const refType = String(options['refType'] ?? ctx?.['entity'] ?? ctx?.['entityInfo']?.['source'] ?? '');
|
|
121
|
-
const ids = rows.map((row) => row?.['id']).filter((id) => id != null && id !== '');
|
|
122
|
-
if (!refType || ids.length === 0) {
|
|
122
|
+
const resolved = resolveEntityActionBulkRef(input);
|
|
123
|
+
if (!resolved) {
|
|
123
124
|
return null;
|
|
124
125
|
}
|
|
125
|
-
return {
|
|
126
|
+
return {
|
|
127
|
+
refType: resolved.refType,
|
|
128
|
+
ids: resolved.ids,
|
|
129
|
+
rows: resolved.rows,
|
|
130
|
+
};
|
|
126
131
|
}
|
|
127
132
|
function buildDisablePatch(disabled) {
|
|
128
133
|
if (disabled) {
|
|
@@ -143,4 +148,4 @@ function buildDisableRefreshMeta(entityDefinition, rowData) {
|
|
|
143
148
|
}
|
|
144
149
|
|
|
145
150
|
export { AXPDisableEntityCommandHelper as A, buildDisableRefreshMeta as a, buildDisablePatch as b, normalizeDisableBulkInput as c, normalizeDisableSingleInput as n };
|
|
146
|
-
//# sourceMappingURL=acorex-platform-module-common-client-disable-entity.command.util-
|
|
151
|
+
//# sourceMappingURL=acorex-platform-module-common-client-disable-entity.command.util-DQl6u2nj.mjs.map
|
package/fesm2022/acorex-platform-module-common-client-disable-entity.command.util-DQl6u2nj.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-disable-entity.command.util-DQl6u2nj.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/disable-plugin/commands/disable-entity.command.helper.ts","../../../../libs/modules/common/client/src/lib/features/disable-plugin/commands/disable-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 { AXStyleColorType } from '@acorex/cdk/common';\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\n@Injectable({ providedIn: 'root' })\nexport class AXPDisableEntityCommandHelper {\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 applyPatch(refType: string, refId: string, patch: AXPContextData): Promise<void> {\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(\n titleKey: string,\n messageKey: string,\n messageParams?: AXPContextData,\n color: AXStyleColorType = 'warning',\n ): Promise<boolean> {\n const dialogResult = await this.dialogService.confirm(\n await this.translationService.translateAsync(titleKey),\n await this.translationService.translateAsync(messageKey, { params: messageParams }),\n color,\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 showErrorToast(message: string): Promise<void> {\n const enabled = await this.settingsService.get<boolean>(AXPCommonSettings.EnableOperationToasts);\n if (!enabled || !message.trim()) {\n return;\n }\n\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content: message,\n closeButton: true,\n timeOut: 6000,\n timeOutProgress: true,\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 await this.showErrorToast(content);\n }\n\n dispatchDisabled(refType: string, _id: string, meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, meta as Record<string, unknown> | undefined);\n }\n\n dispatchEnabled(refType: string, _id: string, meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, meta as Record<string, unknown> | undefined);\n }\n\n dispatchBulkDisabled(refType: string, _ids: string[], meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-disable', ...(meta ?? {}) });\n }\n\n dispatchBulkEnabled(refType: string, _ids: string[], meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-enable', ...(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_DISABLE_FIELD = 'isDisabled';\nexport const DISABLE_TIMESTAMP_FIELD = 'disabledAt';\nexport const ENABLE_TIMESTAMP_FIELD = 'enabledAt';\n\nexport interface AXPDisableCommandContext {\n refId: string;\n refType: string;\n rowData?: AXPContextData;\n}\n\nexport interface AXPBulkDisableCommandContext {\n refType: string;\n ids: string[];\n rows: AXPContextData[];\n}\n\nexport function normalizeDisableSingleInput(input: AXPContextData): AXPDisableCommandContext | 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 normalizeDisableBulkInput(input: AXPContextData): AXPBulkDisableCommandContext | 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 buildDisablePatch(disabled: boolean): AXPContextData {\n if (disabled) {\n return { [DEFAULT_DISABLE_FIELD]: true, [DISABLE_TIMESTAMP_FIELD]: new Date() };\n }\n return {\n [DEFAULT_DISABLE_FIELD]: false,\n [DISABLE_TIMESTAMP_FIELD]: null,\n [ENABLE_TIMESTAMP_FIELD]: new Date(),\n };\n}\n\nexport function buildDisableRefreshMeta(\n entityDefinition: AXPEntity,\n rowData?: AXPContextData,\n): AXPContextData {\n const meta: AXPContextData = {};\n if (entityDefinition.parentKey && rowData?.[entityDefinition.parentKey] != null)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E,QAAQ,CAAC,OAAqC;KACxD;AACH;AAEM,SAAU,yBAAyB,CAAC,KAAqB,EAAA;AAC7D,IAAA,MAAM,QAAQ,GAAG,0BAA0B,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;IACA,OAAO;QACL,CAAC,qBAAqB,GAAG,KAAK;QAC9B,CAAC,uBAAuB,GAAG,IAAI;AAC/B,QAAA,CAAC,sBAAsB,GAAG,IAAI,IAAI,EAAE;KACrC;AACH;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;;;;"}
|
|
@@ -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 AXPDisableEntityCommandHelper, n as normalizeDisableSingleInput, b as buildDisablePatch, a as buildDisableRefreshMeta } from './acorex-platform-module-common-client-disable-entity.command.util-
|
|
4
|
+
import { A as AXPDisableEntityCommandHelper, n as normalizeDisableSingleInput, b as buildDisablePatch, a as buildDisableRefreshMeta } from './acorex-platform-module-common-client-disable-entity.command.util-DQl6u2nj.mjs';
|
|
5
5
|
|
|
6
6
|
class AXPEnableEntityCommand {
|
|
7
7
|
constructor() {
|
|
@@ -30,28 +30,23 @@ class AXPEnableEntityCommand {
|
|
|
30
30
|
const meta = buildDisableRefreshMeta(entityDefinition, context.rowData);
|
|
31
31
|
this.helper.dispatchEnabled(context.refType, context.refId, meta);
|
|
32
32
|
await this.helper.showSuccessToast('@general:workflow.entity-enabled', '@general:workflow.entity-enabled-body');
|
|
33
|
-
return { success: true };
|
|
33
|
+
return { success: true, kind: 'object', data: undefined };
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
await this.helper.showErrorToast(message);
|
|
39
|
-
return {
|
|
40
|
-
success: false,
|
|
41
|
-
message: { text: message },
|
|
42
|
-
};
|
|
36
|
+
await this.helper.showErrorToastFor(error, '@general:messages.generic.error.description');
|
|
37
|
+
return { success: false };
|
|
43
38
|
}
|
|
44
39
|
finally {
|
|
45
40
|
loadingDialog.close();
|
|
46
41
|
}
|
|
47
42
|
}
|
|
48
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
49
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
43
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPEnableEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
44
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPEnableEntityCommand, providedIn: 'root' }); }
|
|
50
45
|
}
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPEnableEntityCommand, decorators: [{
|
|
52
47
|
type: Injectable,
|
|
53
48
|
args: [{ providedIn: 'root' }]
|
|
54
49
|
}] });
|
|
55
50
|
|
|
56
51
|
export { AXPEnableEntityCommand };
|
|
57
|
-
//# sourceMappingURL=acorex-platform-module-common-client-enable-entity.command-
|
|
52
|
+
//# sourceMappingURL=acorex-platform-module-common-client-enable-entity.command-DeTumWIj.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-enable-entity.command-DeTumWIj.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/disable-plugin/commands/enable-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 { AXPDisableEntityCommandHelper } from './disable-entity.command.helper';\nimport { buildDisablePatch, buildDisableRefreshMeta, normalizeDisableSingleInput } from './disable-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPEnableEntityCommand implements AXPCommand<AXPContextData, void> {\n private readonly helper = inject(AXPDisableEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(input: AXPContextData): AXPCommandExecuteResultPromise<void> {\n const context = normalizeDisableSingleInput(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.enable.confirm.title',\n '@general:actions.enable.confirm.message',\n undefined,\n 'success',\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const loadingDialog = this.helper.showLoading(\n await this.translationService.translateAsync('@general:actions.enable.confirm.processing'),\n 'Enabling...',\n );\n\n try {\n const entityDefinition = await this.helper.resolveEntity(context.refType);\n const patch = buildDisablePatch(false);\n await this.helper.applyPatch(context.refType, context.refId, patch);\n\n const meta = buildDisableRefreshMeta(entityDefinition, context.rowData);\n this.helper.dispatchEnabled(context.refType, context.refId, meta);\n await this.helper.showSuccessToast(\n '@general:workflow.entity-enabled',\n '@general:workflow.entity-enabled-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 return { success: false };\n } finally {\n loadingDialog.close();\n }\n }\n}\n"],"names":[],"mappings":";;;;;MASa,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAgDnE,IAAA;IA9CC,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,uCAAuC,EACvC,yCAAyC,EACzC,SAAS,EACT,SAAS,CACV;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,4CAA4C,CAAC,EAC1F,aAAa,CACd;AAED,QAAA,IAAI;AACF,YAAA,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa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35
|
const now = new Date();
|
|
36
36
|
const rawTz = input.timezone?.trim() ?? '';
|
|
37
37
|
if (!rawTz) {
|
|
38
|
-
return {
|
|
39
|
-
success: true,
|
|
38
|
+
return { success: true, kind: 'object',
|
|
40
39
|
data: now.toISOString(),
|
|
41
40
|
};
|
|
42
41
|
}
|
|
@@ -44,8 +43,7 @@ class CommonGetCurrentTimeCommand {
|
|
|
44
43
|
let lastMessage = '';
|
|
45
44
|
for (const tz of candidates) {
|
|
46
45
|
try {
|
|
47
|
-
return {
|
|
48
|
-
success: true,
|
|
46
|
+
return { success: true, kind: 'object',
|
|
49
47
|
data: formatWithTimeZone(now, tz),
|
|
50
48
|
};
|
|
51
49
|
}
|
|
@@ -60,13 +58,13 @@ class CommonGetCurrentTimeCommand {
|
|
|
60
58
|
},
|
|
61
59
|
};
|
|
62
60
|
}
|
|
63
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
64
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
61
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CommonGetCurrentTimeCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
62
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CommonGetCurrentTimeCommand, providedIn: 'root' }); }
|
|
65
63
|
}
|
|
66
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: CommonGetCurrentTimeCommand, decorators: [{
|
|
67
65
|
type: Injectable,
|
|
68
66
|
args: [{ providedIn: 'root' }]
|
|
69
67
|
}] });
|
|
70
68
|
|
|
71
69
|
export { CommonGetCurrentTimeCommand };
|
|
72
|
-
//# sourceMappingURL=acorex-platform-module-common-client-get-current-time.command-
|
|
70
|
+
//# sourceMappingURL=acorex-platform-module-common-client-get-current-time.command-Ck_SC5Bu.mjs.map
|
package/fesm2022/acorex-platform-module-common-client-get-current-time.command-Ck_SC5Bu.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-get-current-time.command-Ck_SC5Bu.mjs","sources":["../../../../libs/modules/common/client/src/lib/tools/get-current-time.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { Injectable } from '@angular/core';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface CommonGetCurrentTimeInput {\n timezone?: string;\n}\n\n//#endregion\n\n//#region ---- Timezone helpers ----\n\n/**\n * Non-standard or deprecated labels models sometimes pass; map to a canonical IANA id accepted by `Intl`.\n */\nconst COMMON_TIMEZONE_ALIASES: Readonly<Record<string, string>> = {\n 'Asia/Ankara': 'Europe/Istanbul',\n};\n\nfunction buildTimezoneCandidates(raw: string): string[] {\n const trimmed = raw.trim();\n if (!trimmed) {\n return [];\n }\n const alias = COMMON_TIMEZONE_ALIASES[trimmed];\n const set = new Set<string>([trimmed]);\n if (alias) {\n set.add(alias);\n }\n return [...set];\n}\n\nfunction formatWithTimeZone(now: Date, timeZone: string): string {\n return now.toLocaleString('sv-SE', { timeZone });\n}\n\n//#endregion\n\n//#region ---- Command ----\n\n/**\n * Returns the current time as ISO string, or sv-SE locale string when {@link CommonGetCurrentTimeInput.timezone} is set.\n * Catalog key: `common.get_current_time`.\n */\n@Injectable({ providedIn: 'root' })\nexport class CommonGetCurrentTimeCommand implements AXPCommand<CommonGetCurrentTimeInput, string> {\n async execute(input: CommonGetCurrentTimeInput): AXPCommandExecuteResultPromise<string> {\n const now = new Date();\n const rawTz = input.timezone?.trim() ?? '';\n\n if (!rawTz) {\n return { success: true, kind: 'object',\n data: now.toISOString(),\n };\n }\n\n const candidates = buildTimezoneCandidates(rawTz);\n let lastMessage = '';\n\n for (const tz of candidates) {\n try {\n return { success: true, kind: 'object',\n data: formatWithTimeZone(now, tz),\n };\n } catch (e) {\n lastMessage = e instanceof Error ? e.message : String(e);\n }\n }\n\n return {\n success: false,\n message: {\n text: `Invalid or unsupported IANA time zone: \"${rawTz}\". ${lastMessage ? `${lastMessage} ` : ''}Use a valid IANA name (e.g. Europe/Istanbul for Turkey).`,\n },\n };\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;AAeA;AAEA;AAEA;;AAEG;AACH,MAAM,uBAAuB,GAAqC;AAChE,IAAA,aAAa,EAAE,iBAAiB;CACjC;AAED,SAAS,uBAAuB,CAAC,GAAW,EAAA;AAC1C,IAAA,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE;IAC1B,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,OAAO,EAAE;IACX;AACA,IAAA,MAAM,KAAK,GAAG,uBAAuB,CAAC,OAAO,CAAC;IAC9C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAS,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,KAAK,EAAE;AACT,QAAA,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC;IAChB;AACA,IAAA,OAAO,CAAC,GAAG,GAAG,CAAC;AACjB;AAEA,SAAS,kBAAkB,CAAC,GAAS,EAAE,QAAgB,EAAA;IACrD,OAAO,GAAG,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC;AAClD;AAEA;AAEA;AAEA;;;AAGG;MAEU,2BAA2B,CAAA;IACtC,MAAM,OAAO,CAAC,KAAgC,EAAA;AAC5C,QAAA,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE;QACtB,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE;QAE1C,IAAI,CAAC,KAAK,EAAE;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|
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 AXPRestoreArchiveEntityCommand {
|
|
7
7
|
constructor() {
|
|
@@ -30,28 +30,23 @@ class AXPRestoreArchiveEntityCommand {
|
|
|
30
30
|
const meta = buildArchiveRefreshMeta(entityDefinition, context.rowData);
|
|
31
31
|
this.helper.dispatchUnarchived(context.refType, context.refId, meta);
|
|
32
32
|
await this.helper.showSuccessToast('@general:workflow.entity-unarchived', '@general:workflow.entity-unarchived-body');
|
|
33
|
-
return { success: true };
|
|
33
|
+
return { success: true, kind: 'object', data: undefined };
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
success: false,
|
|
39
|
-
message: {
|
|
40
|
-
text: error instanceof Error ? error.message : 'Unarchive operation failed',
|
|
41
|
-
},
|
|
42
|
-
};
|
|
36
|
+
await this.helper.showErrorToastFor(error, '@general:messages.generic.error.description');
|
|
37
|
+
return { success: false };
|
|
43
38
|
}
|
|
44
39
|
finally {
|
|
45
40
|
loadingDialog.close();
|
|
46
41
|
}
|
|
47
42
|
}
|
|
48
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
49
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
43
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPRestoreArchiveEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
44
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPRestoreArchiveEntityCommand, providedIn: 'root' }); }
|
|
50
45
|
}
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPRestoreArchiveEntityCommand, decorators: [{
|
|
52
47
|
type: Injectable,
|
|
53
48
|
args: [{ providedIn: 'root' }]
|
|
54
49
|
}] });
|
|
55
50
|
|
|
56
51
|
export { AXPRestoreArchiveEntityCommand };
|
|
57
|
-
//# sourceMappingURL=acorex-platform-module-common-client-restore-archive-entity.command-
|
|
52
|
+
//# sourceMappingURL=acorex-platform-module-common-client-restore-archive-entity.command-Dr1GcC8a.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-restore-archive-entity.command-Dr1GcC8a.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/restore-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 AXPRestoreArchiveEntityCommand 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.restore-archive.confirm.title',\n '@general:actions.restore-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.restore-archive.confirm.processing'),\n 'Unarchiving...',\n );\n\n try {\n const entityDefinition = await this.helper.resolveEntity(context.refType);\n const patch = buildArchivePatch(false);\n await this.helper.applyPatch(context.refType, context.refId, patch);\n\n const meta = buildArchiveRefreshMeta(entityDefinition, context.rowData);\n this.helper.dispatchUnarchived(context.refType, context.refId, meta);\n await this.helper.showSuccessToast(\n '@general:workflow.entity-unarchived',\n '@general:workflow.entity-unarchived-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 return { success: false };\n } finally {\n loadingDialog.close();\n }\n }\n}\n"],"names":[],"mappings":";;;;;MASa,8BAA8B,CAAA;AAD3C,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA8CnE,IAAA;IA5CC,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,gDAAgD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IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,8BAA8B,cADjB,MAAM,EAAA,CAAA,CAAA;;2FACnB,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as i6 from '@acorex/cdk/list-navigation';
|
|
2
|
+
import { AXListNavigationDirective, AXListNavigationItemDirective, AXListNavigationModule } from '@acorex/cdk/list-navigation';
|
|
3
|
+
import * as i2$1 from '@acorex/components/button';
|
|
4
|
+
import { AXButtonModule } from '@acorex/components/button';
|
|
5
|
+
import { AXChipsModule } from '@acorex/components/chips';
|
|
6
|
+
import * as i4 from '@acorex/cdk/common';
|
|
7
|
+
import { AXCommonModule } from '@acorex/cdk/common';
|
|
8
|
+
import * as i1$1 from '@acorex/components/decorators';
|
|
9
|
+
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
10
|
+
import { AXBasePageComponent } from '@acorex/components/page';
|
|
11
|
+
import * as i3 from '@acorex/components/search-box';
|
|
12
|
+
import { AXSearchBoxComponent, AXSearchBoxModule } from '@acorex/components/search-box';
|
|
13
|
+
import * as i8 from '@acorex/components/skeleton';
|
|
14
|
+
import { AXSkeletonModule } from '@acorex/components/skeleton';
|
|
15
|
+
import * as i4$1 from '@acorex/core/translation';
|
|
16
|
+
import { AXTranslationModule } from '@acorex/core/translation';
|
|
17
|
+
import { AXPThemeLayoutBlockComponent, AXPThemeLayoutListComponent, AXPThemeLayoutListItemComponent, AXPThemeLayoutListItemsGroupComponent, AXPThemeLayoutHeaderComponent, AXPStateMessageComponent } from '@acorex-platform/framework-client/layout/components';
|
|
18
|
+
import * as i1 from '@angular/common';
|
|
19
|
+
import { CommonModule } from '@angular/common';
|
|
20
|
+
import * as i0 from '@angular/core';
|
|
21
|
+
import { inject, viewChild, viewChildren, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
22
|
+
import * as i2 from '@angular/forms';
|
|
23
|
+
import { FormsModule } from '@angular/forms';
|
|
24
|
+
import { first } from 'rxjs';
|
|
25
|
+
import { a as AXPGlobalSearchViewModel } from './acorex-platform-module-common-client-acorex-platform-module-common-client-CkeshVWo.mjs';
|
|
26
|
+
|
|
27
|
+
class AXPGlobalSearchPopupComponent extends AXBasePageComponent {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.i18nScope = 'global-search';
|
|
31
|
+
this.vm = inject(AXPGlobalSearchViewModel);
|
|
32
|
+
this.text = null;
|
|
33
|
+
this.list = viewChild(AXListNavigationDirective, /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []));
|
|
35
|
+
this.searchBox = viewChild(AXSearchBoxComponent, /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "searchBox" }] : /* istanbul ignore next */ []));
|
|
37
|
+
this.items = viewChildren(AXListNavigationItemDirective, /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
39
|
+
}
|
|
40
|
+
async handleTextChanged(e) {
|
|
41
|
+
if (e.isUserInteraction) {
|
|
42
|
+
await this.vm.search(e.value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
ngOnInit() {
|
|
46
|
+
super.ngOnInit();
|
|
47
|
+
//
|
|
48
|
+
this.vm.onItemSelected.pipe(first()).subscribe((item) => {
|
|
49
|
+
this.close(item);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
handleSearchKeyDown(e) {
|
|
53
|
+
const event = e.nativeEvent;
|
|
54
|
+
switch (event.code) {
|
|
55
|
+
case 'ArrowDown':
|
|
56
|
+
const item = this.items()[0];
|
|
57
|
+
if (item && this.list()) {
|
|
58
|
+
this.list()?.navigateTo(item);
|
|
59
|
+
}
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
event.stopPropagation();
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
handleClearClick($event) {
|
|
66
|
+
this.vm.clearRecentItems();
|
|
67
|
+
}
|
|
68
|
+
handleListKeyDown(e) {
|
|
69
|
+
switch (e.code) {
|
|
70
|
+
case 'ArrowUp': {
|
|
71
|
+
const item = this.items()[0];
|
|
72
|
+
if (item && this.list() && item.isActive()) {
|
|
73
|
+
this.searchBox()?.focus();
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case 'Escape': {
|
|
78
|
+
this.searchBox()?.focus();
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
e.stopPropagation();
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
handleItemKeyDown(e, item) {
|
|
86
|
+
switch (e.code) {
|
|
87
|
+
case 'Enter':
|
|
88
|
+
case 'Space': {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
this.vm.execute(item);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
handlePinClick(e, item) {
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
this.vm.togglePin(item);
|
|
99
|
+
}
|
|
100
|
+
searchListItemIcon(item) {
|
|
101
|
+
const icon = item.icon?.trim();
|
|
102
|
+
if (!icon) {
|
|
103
|
+
return 'fa-light fa-circle';
|
|
104
|
+
}
|
|
105
|
+
return icon.includes(' ') ? icon : `fa-light ${icon}`;
|
|
106
|
+
}
|
|
107
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPGlobalSearchPopupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
108
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXPGlobalSearchPopupComponent, isStandalone: true, selector: "ng-component", providers: [AXPGlobalSearchViewModel], viewQueries: [{ propertyName: "list", first: true, predicate: AXListNavigationDirective, descendants: true, isSignal: true }, { propertyName: "searchBox", first: true, predicate: AXSearchBoxComponent, descendants: true, isSignal: true }, { propertyName: "items", predicate: AXListNavigationItemDirective, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<axp-layout-content>\n <axp-layout-header class=\"ax-lg\">\n <axp-layout-prefix class=\"min-w-0 flex-1\">\n <ax-search-box\n class=\"__search-box w-full\"\n [axAutoFocus]\n [axAutoFocusTime]=\"500\"\n [look]=\"'none'\"\n [ngModel]=\"vm.text()\"\n (onValueChanged)=\"handleTextChanged($event)\"\n [placeholder]=\"'@global-search:terms.search-anything' | translate | async\"\n (onKeyDown)=\"handleSearchKeyDown($event)\"\n >\n <ax-clear-button class=\"__clear-button\"></ax-clear-button>\n </ax-search-box>\n </axp-layout-prefix>\n <axp-layout-suffix class=\"__close-button\">\n <ax-button [look]=\"'solid'\" class=\"ax-sm\" (onClick)=\"close()\">\n <ax-icon icon=\"fa-light fa-xmark leading-[0]!\"></ax-icon>\n </ax-button>\n </axp-layout-suffix>\n </axp-layout-header>\n\n <!-- Results Area -->\n <axp-layout-body>\n @if (vm.isBusy()) {\n <ng-container *ngTemplateOutlet=\"skeleton\"></ng-container>\n } @else if (vm.isEmpty()) {\n <ng-container *ngTemplateOutlet=\"empty\"></ng-container>\n } @else if (vm.isWelcome()) {\n <ng-container *ngTemplateOutlet=\"welcome\"></ng-container>\n } @else if (vm.isStart()) {\n <ng-container *ngTemplateOutlet=\"start\"></ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"result\"></ng-container>\n }\n </axp-layout-body>\n\n <!-- Skeleton Template -->\n <ng-template #skeleton>\n <div class=\"flex flex-col gap-10 p-8\">\n @for (item of [1, 2, 3, 4, 5]; track $index) {\n <div class=\"flex items-center gap-4\">\n <ax-skeleton [animated]=\"true\" class=\"w-4 h-4 rounded-full\"></ax-skeleton>\n <div class=\"flex flex-col gap-2 flex-1\">\n <ax-skeleton [animated]=\"true\" class=\"w-1/4 h-2 rounded\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"w-1/2 h-2 rounded\"></ax-skeleton>\n </div>\n </div>\n }\n </div>\n </ng-template>\n\n <!-- Empty Template -->\n <ng-template #empty>\n <axp-state-message icon=\"fa-light fa-search\" [title]=\"'@global-search:components.search-box.empty-states.no-result.title'\" [description]=\"'@global-search:components.search-box.empty-states.no-result.description'\"></axp-state-message>\n </ng-template>\n\n <!-- Welcome Template -->\n <ng-template #welcome>\n <axp-state-message icon=\"fa-light fa-search\" [title]=\"'@global-search:components.search-box.empty-states.start.title'\" [description]=\"'@global-search:components.search-box.empty-states.start.description'\"></axp-state-message>\n </ng-template>\n\n <!-- Start Template -->\n <ng-template #start>\n <!-- Pinned Items -->\n <axp-layout-list class=\"p-4 divide-none\" (keydown)=\"handleListKeyDown($event)\" axListNavigation #list=\"axListNavigation\">\n @if (vm.pinnedItems().length > 0) {\n <axp-layout-list-group>\n <axp-layout-title>{{ '@global-search:terms.pinned' | translate | async }}</axp-layout-title>\n @for (item of vm.pinnedItems(); track $index) {\n <axp-layout-list-item (click)=\"vm.execute(item)\" (keydown)=\"handleItemKeyDown($event, item)\" class=\"group\" axListNavigationItem #i=\"axListNavigationItem\" [class.axp-state-focused]=\"i.isActive()\">\n <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n </axp-layout-list-item>\n }\n </axp-layout-list-group>\n }\n <!-- Recent Items -->\n @if (vm.recentItems().length > 0) {\n <axp-layout-list-group>\n <axp-layout-header>\n <axp-layout-prefix>\n <axp-layout-title>{{ '@global-search:terms.recent' | translate | async }}</axp-layout-title>\n </axp-layout-prefix>\n <axp-layout-prefix class=\"ax-sm\">\n <ax-button [text]=\"'@global-search:terms.clear' | translate | async\" look=\"blank\" [color]=\"'default'\" (onClick)=\"handleClearClick($event)\"></ax-button>\n </axp-layout-prefix>\n </axp-layout-header>\n @for (item of vm.recentItems(); track $index) {\n <axp-layout-list-item (click)=\"vm.execute(item)\" (keydown)=\"handleItemKeyDown($event, item)\" class=\"group\" axListNavigationItem #i=\"axListNavigationItem\" [class.axp-state-focused]=\"i.isActive()\">\n <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n </axp-layout-list-item>\n }\n </axp-layout-list-group>\n }\n </axp-layout-list>\n </ng-template>\n\n <!-- Result Template -->\n <ng-template #result>\n <axp-layout-list class=\"p-4 divide-none\" (keydown)=\"handleListKeyDown($event)\" axListNavigation #list=\"axListNavigation\">\n @for (group of vm.results(); track $index) {\n <axp-layout-list-group>\n <axp-layout-title>{{ group.title | translate | async }}</axp-layout-title>\n @for (item of group.children; track $index) {\n <axp-layout-list-item (click)=\"vm.execute(item)\" (keydown)=\"handleItemKeyDown($event, item)\" class=\"group\" axListNavigationItem #i=\"axListNavigationItem\" [class.axp-state-focused]=\"i.isActive()\">\n <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n </axp-layout-list-item>\n }\n </axp-layout-list-group>\n }\n </axp-layout-list>\n </ng-template>\n\n <ng-template #listItem let-item=\"item\">\n <axp-layout-prefix>\n <ax-icon [icon]=\"searchListItemIcon(item)\"></ax-icon>\n </axp-layout-prefix>\n <axp-layout-content>\n <axp-layout-title class=\"group\">\n <span>{{ item.title | translate | async }}</span>\n <span class=\"ms-3\" (click)=\"handlePinClick($event, item)\">\n <i [class.invisible]=\"!vm.isPinned(item)\" class=\"fa-light fa-thumbtack rotate-45 group-hover:!visible\" [class.fa-solid]=\"vm.isPinned(item)\"></i>\n </span>\n </axp-layout-title>\n @if (item.parent) {\n <axp-layout-description>\n {{ item.parent.title | translate | async }}\n </axp-layout-description>\n } @else if (item.description) {\n <axp-layout-description>\n {{ item.description | translate | async }}\n </axp-layout-description>\n }\n </axp-layout-content>\n <axp-layout-suffix>\n <i class=\"far fa-chevron-right rtl:rotate-180\"></i>\n </axp-layout-suffix>\n </ng-template>\n</axp-layout-content>\n", styles: ["@layer properties;:host .editor-container:focus-within{outline-style:none}:host>axp-layout-content{display:flex;width:90vw;max-width:var(--container-xl, 36rem);flex-direction:column;background-color:var(--color-lightest);color:var(--color-on-lightest);border-color:var(--color-border-lightest)}@media(width>=40rem){:host>axp-layout-content{width:80vw}}@media(width>=48rem){:host>axp-layout-content{width:60vw}}@media(width>=64rem){:host>axp-layout-content{width:40vw}}@media(width>=80rem){:host>axp-layout-content{width:30vw}}:host>axp-layout-content>axp-layout-header{flex-wrap:nowrap;align-items:center;gap:calc(var(--spacing, .25rem) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;background-color:var(--color-lighter);color:var(--color-on-lighter);border-color:var(--color-border-lighter)}:host>axp-layout-content>axp-layout-header>axp-layout-prefix{display:flex;min-width:0px;flex:1;align-items:center}:host>axp-layout-content>axp-layout-header>.__close-button{margin-inline-end:calc(var(--spacing, .25rem) * 4);flex-shrink:0}:host>axp-layout-content>axp-layout-header .__search-box{width:100%;align-items:center;padding-inline-end:0!important}:host>axp-layout-content>axp-layout-header .__search-box .__clear-button{color:var(--color-neutral-400, oklch(70.8% 0 none))}:host>axp-layout-content>axp-layout-body{display:flex;max-height:50vh;min-height:30vh;flex-direction:column;overflow-y:auto;border-radius:var(--radius-md, .375rem)}:where(:host>axp-layout-content axp-layout-body>:not(:last-child)){--tw-divide-y-reverse: 0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{max-height:60vh}}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{max-height:70vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{min-height:50vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{max-height:80vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}:host>axp-layout-content>axp-layout-body .axp-search-recent{display:flex;flex-direction:column;padding:calc(var(--spacing, .25rem) * 4)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-header{margin-bottom:calc(var(--spacing, .25rem) * 2);display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-font-weight: var(--font-weight-semibold, 600);font-weight:var(--font-weight-semibold, 600)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-body{display:flex;flex-direction:row;flex-wrap:wrap;gap:calc(var(--spacing, .25rem) * 2);border-radius:var(--radius-md, .375rem)}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon{display:flex;height:calc(var(--spacing, .25rem) * 9);width:calc(var(--spacing, .25rem) * 9);align-items:center;justify-content:center;border-radius:var(--radius-md, .375rem);background-color:var(--color-dark);color:var(--color-on-dark);border-color:var(--color-border-dark);font-size:1rem}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon:where(.ax-dark,.ax-dark *):not(:where(.ax-light,.ax-light *)){background-color:var(--color-darker);color:var(--color-on-darker);border-color:var(--color-border-darker)}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-divide-y-reverse{syntax: \"*\"; inherits: false; initial-value: 0;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-divide-y-reverse: 0;--tw-font-weight: initial}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type:
|
|
109
|
+
//
|
|
110
|
+
AXSearchBoxModule }, { kind: "component", type: i3.AXSearchBoxComponent, selector: "ax-search-box", inputs: ["disabled", "readonly", "tabIndex", "placeholder", "value", "state", "name", "id", "look", "class", "delayTime", "type", "autoSearch"], outputs: ["valueChange", "stateChange", "onValueChanged", "onBlur", "onFocus", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress"] }, { kind: "ngmodule", type: AXCommonModule }, { kind: "directive", type: i4.AXAutoFocusDirective, selector: "[axAutoFocus]", inputs: ["axAutoFocus", "axAutoFocusTime"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1$1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i1$1.AXDecoratorClearButtonComponent, selector: "ax-clear-button", inputs: ["icon"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "ngmodule", type: AXListNavigationModule }, { kind: "directive", type: i6.AXListNavigationDirective, selector: "[axListNavigation]", inputs: ["orientation"], outputs: ["onNavigationChanged", "onKeypress"], exportAs: ["axListNavigation"] }, { kind: "directive", type: i6.AXListNavigationItemDirective, selector: "[axListNavigationItem]", outputs: ["onKeypress"], exportAs: ["axListNavigationItem"] }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2$1.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:
|
|
111
|
+
//
|
|
112
|
+
AXSkeletonModule }, { kind: "component", type: i8.AXSkeletonComponent, selector: "ax-skeleton", inputs: ["animated"] }, { kind: "ngmodule", type: AXChipsModule }, { kind: "component", type: AXPThemeLayoutBlockComponent, selector: " axp-page-content, axp-page-footer-container, axp-page-footer, axp-page-header, axp-page-header-container, axp-page-toolbar, axp-layout-content, axp-layout-page-content, axp-layout-sections, axp-layout-body, axp-layout-page-body, axp-layout-prefix, axp-layout-suffix, axp-layout-title-bar, axp-layout-title, axp-layout-title-actions, axp-layout-nav-button, axp-layout-description, axp-layout-breadcrumbs, axp-layout-list-action, " }, { kind: "component", type: AXPThemeLayoutListComponent, selector: "axp-layout-list" }, { kind: "component", type: AXPThemeLayoutListItemComponent, selector: "axp-layout-list-item" }, { kind: "component", type: AXPThemeLayoutListItemsGroupComponent, selector: "axp-layout-list-group" }, { kind: "component", type: AXPThemeLayoutHeaderComponent, selector: "axp-layout-header" }, { kind: "component", type: AXPStateMessageComponent, selector: "axp-state-message", inputs: ["mode", "icon", "title", "description", "titleParams", "descriptionParams", "look"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4$1.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
113
|
+
}
|
|
114
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPGlobalSearchPopupComponent, decorators: [{
|
|
115
|
+
type: Component,
|
|
116
|
+
args: [{ imports: [
|
|
117
|
+
CommonModule,
|
|
118
|
+
FormsModule,
|
|
119
|
+
//
|
|
120
|
+
AXSearchBoxModule,
|
|
121
|
+
AXCommonModule,
|
|
122
|
+
AXDecoratorModule,
|
|
123
|
+
AXTranslationModule,
|
|
124
|
+
AXListNavigationModule,
|
|
125
|
+
AXButtonModule,
|
|
126
|
+
//
|
|
127
|
+
AXSkeletonModule,
|
|
128
|
+
AXChipsModule,
|
|
129
|
+
AXPThemeLayoutBlockComponent,
|
|
130
|
+
AXPThemeLayoutListComponent,
|
|
131
|
+
AXPThemeLayoutListItemComponent,
|
|
132
|
+
AXPThemeLayoutListItemsGroupComponent,
|
|
133
|
+
AXPThemeLayoutHeaderComponent,
|
|
134
|
+
AXPStateMessageComponent,
|
|
135
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, providers: [AXPGlobalSearchViewModel], template: "<axp-layout-content>\n <axp-layout-header class=\"ax-lg\">\n <axp-layout-prefix class=\"min-w-0 flex-1\">\n <ax-search-box\n class=\"__search-box w-full\"\n [axAutoFocus]\n [axAutoFocusTime]=\"500\"\n [look]=\"'none'\"\n [ngModel]=\"vm.text()\"\n (onValueChanged)=\"handleTextChanged($event)\"\n [placeholder]=\"'@global-search:terms.search-anything' | translate | async\"\n (onKeyDown)=\"handleSearchKeyDown($event)\"\n >\n <ax-clear-button class=\"__clear-button\"></ax-clear-button>\n </ax-search-box>\n </axp-layout-prefix>\n <axp-layout-suffix class=\"__close-button\">\n <ax-button [look]=\"'solid'\" class=\"ax-sm\" (onClick)=\"close()\">\n <ax-icon icon=\"fa-light fa-xmark leading-[0]!\"></ax-icon>\n </ax-button>\n </axp-layout-suffix>\n </axp-layout-header>\n\n <!-- Results Area -->\n <axp-layout-body>\n @if (vm.isBusy()) {\n <ng-container *ngTemplateOutlet=\"skeleton\"></ng-container>\n } @else if (vm.isEmpty()) {\n <ng-container *ngTemplateOutlet=\"empty\"></ng-container>\n } @else if (vm.isWelcome()) {\n <ng-container *ngTemplateOutlet=\"welcome\"></ng-container>\n } @else if (vm.isStart()) {\n <ng-container *ngTemplateOutlet=\"start\"></ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"result\"></ng-container>\n }\n </axp-layout-body>\n\n <!-- Skeleton Template -->\n <ng-template #skeleton>\n <div class=\"flex flex-col gap-10 p-8\">\n @for (item of [1, 2, 3, 4, 5]; track $index) {\n <div class=\"flex items-center gap-4\">\n <ax-skeleton [animated]=\"true\" class=\"w-4 h-4 rounded-full\"></ax-skeleton>\n <div class=\"flex flex-col gap-2 flex-1\">\n <ax-skeleton [animated]=\"true\" class=\"w-1/4 h-2 rounded\"></ax-skeleton>\n <ax-skeleton [animated]=\"true\" class=\"w-1/2 h-2 rounded\"></ax-skeleton>\n </div>\n </div>\n }\n </div>\n </ng-template>\n\n <!-- Empty Template -->\n <ng-template #empty>\n <axp-state-message icon=\"fa-light fa-search\" [title]=\"'@global-search:components.search-box.empty-states.no-result.title'\" [description]=\"'@global-search:components.search-box.empty-states.no-result.description'\"></axp-state-message>\n </ng-template>\n\n <!-- Welcome Template -->\n <ng-template #welcome>\n <axp-state-message icon=\"fa-light fa-search\" [title]=\"'@global-search:components.search-box.empty-states.start.title'\" [description]=\"'@global-search:components.search-box.empty-states.start.description'\"></axp-state-message>\n </ng-template>\n\n <!-- Start Template -->\n <ng-template #start>\n <!-- Pinned Items -->\n <axp-layout-list class=\"p-4 divide-none\" (keydown)=\"handleListKeyDown($event)\" axListNavigation #list=\"axListNavigation\">\n @if (vm.pinnedItems().length > 0) {\n <axp-layout-list-group>\n <axp-layout-title>{{ '@global-search:terms.pinned' | translate | async }}</axp-layout-title>\n @for (item of vm.pinnedItems(); track $index) {\n <axp-layout-list-item (click)=\"vm.execute(item)\" (keydown)=\"handleItemKeyDown($event, item)\" class=\"group\" axListNavigationItem #i=\"axListNavigationItem\" [class.axp-state-focused]=\"i.isActive()\">\n <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n </axp-layout-list-item>\n }\n </axp-layout-list-group>\n }\n <!-- Recent Items -->\n @if (vm.recentItems().length > 0) {\n <axp-layout-list-group>\n <axp-layout-header>\n <axp-layout-prefix>\n <axp-layout-title>{{ '@global-search:terms.recent' | translate | async }}</axp-layout-title>\n </axp-layout-prefix>\n <axp-layout-prefix class=\"ax-sm\">\n <ax-button [text]=\"'@global-search:terms.clear' | translate | async\" look=\"blank\" [color]=\"'default'\" (onClick)=\"handleClearClick($event)\"></ax-button>\n </axp-layout-prefix>\n </axp-layout-header>\n @for (item of vm.recentItems(); track $index) {\n <axp-layout-list-item (click)=\"vm.execute(item)\" (keydown)=\"handleItemKeyDown($event, item)\" class=\"group\" axListNavigationItem #i=\"axListNavigationItem\" [class.axp-state-focused]=\"i.isActive()\">\n <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n </axp-layout-list-item>\n }\n </axp-layout-list-group>\n }\n </axp-layout-list>\n </ng-template>\n\n <!-- Result Template -->\n <ng-template #result>\n <axp-layout-list class=\"p-4 divide-none\" (keydown)=\"handleListKeyDown($event)\" axListNavigation #list=\"axListNavigation\">\n @for (group of vm.results(); track $index) {\n <axp-layout-list-group>\n <axp-layout-title>{{ group.title | translate | async }}</axp-layout-title>\n @for (item of group.children; track $index) {\n <axp-layout-list-item (click)=\"vm.execute(item)\" (keydown)=\"handleItemKeyDown($event, item)\" class=\"group\" axListNavigationItem #i=\"axListNavigationItem\" [class.axp-state-focused]=\"i.isActive()\">\n <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n </axp-layout-list-item>\n }\n </axp-layout-list-group>\n }\n </axp-layout-list>\n </ng-template>\n\n <ng-template #listItem let-item=\"item\">\n <axp-layout-prefix>\n <ax-icon [icon]=\"searchListItemIcon(item)\"></ax-icon>\n </axp-layout-prefix>\n <axp-layout-content>\n <axp-layout-title class=\"group\">\n <span>{{ item.title | translate | async }}</span>\n <span class=\"ms-3\" (click)=\"handlePinClick($event, item)\">\n <i [class.invisible]=\"!vm.isPinned(item)\" class=\"fa-light fa-thumbtack rotate-45 group-hover:!visible\" [class.fa-solid]=\"vm.isPinned(item)\"></i>\n </span>\n </axp-layout-title>\n @if (item.parent) {\n <axp-layout-description>\n {{ item.parent.title | translate | async }}\n </axp-layout-description>\n } @else if (item.description) {\n <axp-layout-description>\n {{ item.description | translate | async }}\n </axp-layout-description>\n }\n </axp-layout-content>\n <axp-layout-suffix>\n <i class=\"far fa-chevron-right rtl:rotate-180\"></i>\n </axp-layout-suffix>\n </ng-template>\n</axp-layout-content>\n", styles: ["@layer properties;:host .editor-container:focus-within{outline-style:none}:host>axp-layout-content{display:flex;width:90vw;max-width:var(--container-xl, 36rem);flex-direction:column;background-color:var(--color-lightest);color:var(--color-on-lightest);border-color:var(--color-border-lightest)}@media(width>=40rem){:host>axp-layout-content{width:80vw}}@media(width>=48rem){:host>axp-layout-content{width:60vw}}@media(width>=64rem){:host>axp-layout-content{width:40vw}}@media(width>=80rem){:host>axp-layout-content{width:30vw}}:host>axp-layout-content>axp-layout-header{flex-wrap:nowrap;align-items:center;gap:calc(var(--spacing, .25rem) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;background-color:var(--color-lighter);color:var(--color-on-lighter);border-color:var(--color-border-lighter)}:host>axp-layout-content>axp-layout-header>axp-layout-prefix{display:flex;min-width:0px;flex:1;align-items:center}:host>axp-layout-content>axp-layout-header>.__close-button{margin-inline-end:calc(var(--spacing, .25rem) * 4);flex-shrink:0}:host>axp-layout-content>axp-layout-header .__search-box{width:100%;align-items:center;padding-inline-end:0!important}:host>axp-layout-content>axp-layout-header .__search-box .__clear-button{color:var(--color-neutral-400, oklch(70.8% 0 none))}:host>axp-layout-content>axp-layout-body{display:flex;max-height:50vh;min-height:30vh;flex-direction:column;overflow-y:auto;border-radius:var(--radius-md, .375rem)}:where(:host>axp-layout-content axp-layout-body>:not(:last-child)){--tw-divide-y-reverse: 0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{max-height:60vh}}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{max-height:70vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{min-height:50vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{max-height:80vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}:host>axp-layout-content>axp-layout-body .axp-search-recent{display:flex;flex-direction:column;padding:calc(var(--spacing, .25rem) * 4)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-header{margin-bottom:calc(var(--spacing, .25rem) * 2);display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-font-weight: var(--font-weight-semibold, 600);font-weight:var(--font-weight-semibold, 600)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-body{display:flex;flex-direction:row;flex-wrap:wrap;gap:calc(var(--spacing, .25rem) * 2);border-radius:var(--radius-md, .375rem)}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon{display:flex;height:calc(var(--spacing, .25rem) * 9);width:calc(var(--spacing, .25rem) * 9);align-items:center;justify-content:center;border-radius:var(--radius-md, .375rem);background-color:var(--color-dark);color:var(--color-on-dark);border-color:var(--color-border-dark);font-size:1rem}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon:where(.ax-dark,.ax-dark *):not(:where(.ax-light,.ax-light *)){background-color:var(--color-darker);color:var(--color-on-darker);border-color:var(--color-border-darker)}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-divide-y-reverse{syntax: \"*\"; inherits: false; initial-value: 0;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-divide-y-reverse: 0;--tw-font-weight: initial}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
|
|
136
|
+
}], propDecorators: { list: [{ type: i0.ViewChild, args: [i0.forwardRef(() => AXListNavigationDirective), { isSignal: true }] }], searchBox: [{ type: i0.ViewChild, args: [i0.forwardRef(() => AXSearchBoxComponent), { isSignal: true }] }], items: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => AXListNavigationItemDirective), { isSignal: true }] }] } });
|
|
137
|
+
|
|
138
|
+
export { AXPGlobalSearchPopupComponent };
|
|
139
|
+
//# sourceMappingURL=acorex-platform-module-common-client-search-popup.component-DH0OQYoQ.mjs.map
|