@acorex-platform/module-common-client 0.0.46 → 0.0.49
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-BzK6gnbq.mjs → acorex-platform-module-common-client-acorex-platform-module-common-client-Cd7vTe3G.mjs} +14 -17
- package/fesm2022/acorex-platform-module-common-client-acorex-platform-module-common-client-Cd7vTe3G.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-common-client-archive-entity.command-P-8WPEaC.mjs → acorex-platform-module-common-client-archive-entity.command-DiOJ6IkD.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-archive-entity.command-P-8WPEaC.mjs.map → acorex-platform-module-common-client-archive-entity.command-DiOJ6IkD.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-archive-entity.command.util-DgnEcrDL.mjs → acorex-platform-module-common-client-archive-entity.command.util-DhCNqo2R.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-archive-entity.command.util-DgnEcrDL.mjs.map → acorex-platform-module-common-client-archive-entity.command.util-DhCNqo2R.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-bulk-archive-entity.command-njV_WseD.mjs → acorex-platform-module-common-client-bulk-archive-entity.command-D01227SB.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-bulk-archive-entity.command-njV_WseD.mjs.map → acorex-platform-module-common-client-bulk-archive-entity.command-D01227SB.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-bulk-restore-archive-entity.command-t2AYXaLk.mjs → acorex-platform-module-common-client-bulk-restore-archive-entity.command-CaTT2Rqd.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-bulk-restore-archive-entity.command-t2AYXaLk.mjs.map → acorex-platform-module-common-client-bulk-restore-archive-entity.command-CaTT2Rqd.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-clone-entity.command-UyUOYAxp.mjs → acorex-platform-module-common-client-clone-entity.command-BxT9kdpw.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-clone-entity.command-UyUOYAxp.mjs.map → acorex-platform-module-common-client-clone-entity.command-BxT9kdpw.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-restore-archive-entity.command-Dyix1Ecm.mjs → acorex-platform-module-common-client-restore-archive-entity.command-BWF8iH1Z.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-restore-archive-entity.command-Dyix1Ecm.mjs.map → acorex-platform-module-common-client-restore-archive-entity.command-BWF8iH1Z.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-search-popup.component-j0h_8fec.mjs → acorex-platform-module-common-client-search-popup.component-B4LA5yh1.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-search-popup.component-j0h_8fec.mjs.map → acorex-platform-module-common-client-search-popup.component-B4LA5yh1.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-timeline-version-history-popup.component-ysTJlOCx.mjs → acorex-platform-module-common-client-timeline-version-history-popup.component-CPmN0kme.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-timeline-version-history-popup.component-ysTJlOCx.mjs.map → acorex-platform-module-common-client-timeline-version-history-popup.component-CPmN0kme.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-common-client.mjs +1 -1
- package/package.json +1 -1
- package/fesm2022/acorex-platform-module-common-client-acorex-platform-module-common-client-BzK6gnbq.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AXTranslationService } from '@acorex/core/translation';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, Injectable } from '@angular/core';
|
|
4
|
-
import { A as AXPArchiveEntityCommandHelper, n as normalizeArchiveSingleInput, b as buildArchivePatch, a as buildArchiveRefreshMeta } from './acorex-platform-module-common-client-archive-entity.command.util-
|
|
4
|
+
import { A as AXPArchiveEntityCommandHelper, n as normalizeArchiveSingleInput, b as buildArchivePatch, a as buildArchiveRefreshMeta } from './acorex-platform-module-common-client-archive-entity.command.util-DhCNqo2R.mjs';
|
|
5
5
|
|
|
6
6
|
class AXPArchiveEntityCommand {
|
|
7
7
|
constructor() {
|
|
@@ -48,4 +48,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
48
48
|
}] });
|
|
49
49
|
|
|
50
50
|
export { AXPArchiveEntityCommand };
|
|
51
|
-
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command-
|
|
51
|
+
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command-DiOJ6IkD.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-common-client-archive-entity.command-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-archive-entity.command-DiOJ6IkD.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/archive-entity.command.ts"],"sourcesContent":["import { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport type { AXPContextData } from '@acorex-platform/framework-shared/core';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPArchiveEntityCommandHelper } from './archive-entity.command.helper';\nimport { buildArchivePatch, buildArchiveRefreshMeta, normalizeArchiveSingleInput } from './archive-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPArchiveEntityCommand implements AXPCommand<AXPContextData, void> {\n private readonly helper = inject(AXPArchiveEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(input: AXPContextData): AXPCommandExecuteResultPromise<void> {\n const context = normalizeArchiveSingleInput(input);\n if (!context) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n const confirmed = await this.helper.confirm(\n '@general:actions.archive.confirm.title',\n '@general:actions.archive.confirm.message',\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const loadingDialog = this.helper.showLoading(\n await this.translationService.translateAsync('@general:actions.archive.confirm.processing'),\n 'Archiving...',\n );\n\n try {\n const entityDefinition = await this.helper.resolveEntity(context.refType);\n const patch = buildArchivePatch(true);\n await this.helper.applyPatch(context.refType, context.refId, patch);\n\n const meta = buildArchiveRefreshMeta(entityDefinition, context.rowData);\n this.helper.dispatchArchived(context.refType, context.refId, meta);\n loadingDialog.close();\n await this.helper.showSuccessToast(\n '@general:workflow.entity-archived',\n '@general:workflow.entity-archived-body',\n );\n\n return { success: true, kind: 'object', data: undefined, metadata: { refresh: false } };\n } catch (error) {\n loadingDialog.close();\n await this.helper.showErrorToastFor(error, '@general:messages.generic.error.description');\n return { success: false };\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,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,uCAAuC,CAAC;AAC5F,iBAAA;aACF;QACH;AAEA,QAAA,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACzC,wCAAwC,EACxC,0CAA0C,CAC3C;QACD,IAAI,CAAC,SAAS,EAAE;AACd,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3B;QAEA,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAC3C,MAAM,IAAI,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EAAA,IAAA,EAAA,uBAAuB,cADV,MAAM,EAAA,CAAA,CAAA;;2FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -7,7 +7,7 @@ import { AXPEntityBroadcastService } from '@acorex-platform/framework-client/cor
|
|
|
7
7
|
import { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
9
|
import { inject, Injectable } from '@angular/core';
|
|
10
|
-
import { A as AXP_ENTITY_ARCHIVE_OVERRIDES } from './acorex-platform-module-common-client-acorex-platform-module-common-client-
|
|
10
|
+
import { A as AXP_ENTITY_ARCHIVE_OVERRIDES } from './acorex-platform-module-common-client-acorex-platform-module-common-client-Cd7vTe3G.mjs';
|
|
11
11
|
import { resolveEntityActionRef, resolveEntityActionBulkRef } from '@acorex-platform/framework-shared/runtime';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -153,4 +153,4 @@ function buildArchiveRefreshMeta(entityDefinition, rowData) {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
export { AXPArchiveEntityCommandHelper as A, buildArchiveRefreshMeta as a, buildArchivePatch as b, normalizeArchiveBulkInput as c, normalizeArchiveSingleInput as n };
|
|
156
|
-
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command.util-
|
|
156
|
+
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command.util-DhCNqo2R.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-common-client-archive-entity.command.util-DgnEcrDL.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/archive-entity.command.helper.ts","../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/archive-entity.command.util.ts"],"sourcesContent":["import { AXDialogService } from '@acorex/components/dialog';\nimport { AXLoadingDialogService } from '@acorex/components/loading-dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport type { AXPContextData } from '@acorex-platform/framework-shared/core';\nimport {\n AXPCommonSettings,\n AXPSettingsService,\n extractRequestErrorInfo,\n platformErrorI18nKey,\n throwIfCommandFailed,\n} from '@acorex-platform/framework-client/common';\nimport { AXPEntityBroadcastService } from '@acorex-platform/framework-client/core';\nimport { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXP_ENTITY_ARCHIVE_OVERRIDES } from '../archive-entity.override';\n\n/**\n * Injectable helper for archive commands: confirmation UI, persistence, toasts, and refresh events.\n * Pure input/patch logic lives in {@link archive-entity.command.util}.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPArchiveEntityCommandHelper {\n private readonly entityRegistry = inject(AXPEntityDefinitionRegistryService);\n private readonly dialogService = inject(AXDialogService);\n private readonly loadingDialog = inject(AXLoadingDialogService);\n private readonly translationService = inject(AXTranslationService);\n private readonly toastService = inject(AXToastService);\n private readonly settingsService = inject(AXPSettingsService);\n private readonly entityEvents = inject(AXPEntityBroadcastService);\n private readonly archiveOverrides = inject(AXP_ENTITY_ARCHIVE_OVERRIDES, { optional: true }) ?? [];\n\n async resolveEntity(refType: string): Promise<AXPEntity> {\n const [moduleName, entityName] = refType.split('.');\n return this.entityRegistry.resolve(moduleName, entityName);\n }\n\n async applyPatch(refType: string, refId: string, patch: AXPContextData): Promise<void> {\n const override = this.archiveOverrides.find((entry) => entry.refType === refType);\n if (override) {\n const archived = patch['isArchived'] === true;\n if (archived) {\n await override.archive(refId);\n } else {\n await override.restore(refId);\n }\n return;\n }\n\n const entityDefinition = await this.resolveEntity(refType);\n const updateExec = entityDefinition.commands?.update?.execute as\n | ((payload: AXPContextData) => Promise<unknown>)\n | undefined;\n\n if (!updateExec) {\n throw new Error('Entity does not support update operation');\n }\n\n const result = await updateExec({ id: refId, ...patch });\n throwIfCommandFailed(result);\n }\n\n async confirm(titleKey: string, messageKey: string, messageParams?: AXPContextData): Promise<boolean> {\n const dialogResult = await this.dialogService.confirm(\n await this.translationService.translateAsync(titleKey),\n await this.translationService.translateAsync(messageKey, { params: messageParams }),\n 'warning',\n 'horizontal',\n false,\n 'cancel',\n );\n return dialogResult.result === true;\n }\n\n showLoading(title: string, status: string) {\n return this.loadingDialog.show({\n title,\n mode: 'indeterminate',\n status,\n });\n }\n\n async showSuccessToast(titleKey: string, contentKey?: string): Promise<void> {\n const enabled = await this.settingsService.get<boolean>(AXPCommonSettings.EnableOperationToasts);\n if (!enabled) {\n return;\n }\n\n this.toastService.show({\n color: 'success',\n title: await this.translationService.translateAsync(titleKey),\n content: contentKey ? await this.translationService.translateAsync(contentKey) : undefined,\n });\n }\n\n async showErrorToastFor(error: unknown, fallbackKey: string): Promise<void> {\n const enabled = await this.settingsService.get<boolean>(AXPCommonSettings.EnableOperationToasts);\n if (!enabled) {\n return;\n }\n\n const info = extractRequestErrorInfo(error);\n const contentKey =\n platformErrorI18nKey(info?.code) ??\n (typeof info?.message === 'string' && info.message.startsWith('@')\n ? info.message\n : null) ??\n fallbackKey;\n const content = contentKey.startsWith('@')\n ? await this.translationService.translateAsync(contentKey)\n : contentKey;\n\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content,\n closeButton: true,\n timeOut: 6000,\n timeOutProgress: true,\n });\n }\n\n dispatchArchived(refType: string, id: string, meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, meta as Record<string, unknown> | undefined);\n }\n\n dispatchUnarchived(refType: string, id: string, meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, meta as Record<string, unknown> | undefined);\n }\n\n dispatchBulkArchived(refType: string, ids: string[], meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-archive', ...(meta ?? {}) });\n }\n\n dispatchBulkUnarchived(refType: string, ids: string[], meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-unarchive', ...(meta ?? {}) });\n }\n}\n","import type { AXPContextData } from '@acorex-platform/framework-shared/core';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { resolveEntityActionBulkRef, resolveEntityActionRef } from '@acorex-platform/framework-shared/runtime';\n\nexport const DEFAULT_ARCHIVE_FIELD = 'isArchived';\nexport const ARCHIVE_TIMESTAMP_FIELD = 'archivedAt';\n\nexport interface AXPArchiveCommandContext {\n refId: string;\n refType: string;\n rowData?: AXPContextData;\n}\n\nexport interface AXPBulkArchiveCommandContext {\n refType: string;\n ids: string[];\n rows: AXPContextData[];\n}\n\nexport function normalizeArchiveSingleInput(input: AXPContextData): AXPArchiveCommandContext | null {\n const resolved = resolveEntityActionRef(input);\n if (!resolved) {\n return null;\n }\n\n return {\n refId: resolved.refId,\n refType: resolved.refType,\n rowData: resolved.rowData as AXPContextData | undefined,\n };\n}\n\nexport function normalizeArchiveBulkInput(input: AXPContextData): AXPBulkArchiveCommandContext | null {\n const resolved = resolveEntityActionBulkRef(input);\n if (!resolved) {\n return null;\n }\n\n return {\n refType: resolved.refType,\n ids: resolved.ids,\n rows: resolved.rows as AXPContextData[],\n };\n}\n\nexport function buildArchivePatch(archived: boolean): AXPContextData {\n if (archived) {\n return { [DEFAULT_ARCHIVE_FIELD]: true, [ARCHIVE_TIMESTAMP_FIELD]: new Date() };\n }\n return { [DEFAULT_ARCHIVE_FIELD]: false, [ARCHIVE_TIMESTAMP_FIELD]: null };\n}\n\nexport function buildArchiveRefreshMeta(\n entityDefinition: AXPEntity,\n rowData?: AXPContextData,\n): AXPContextData {\n const meta: AXPContextData = {};\n if (entityDefinition.parentKey && rowData?.[entityDefinition.parentKey] != null) {\n meta['refreshTargetId'] = rowData[entityDefinition.parentKey];\n }\n return meta;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAmBA;;;AAGG;MAEU,6BAA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KAAK;QACrB,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,OAAO,EAAE,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;AACA,IAAA,OAAO,EAAE,CAAC,qBAAqB,GAAG,KAAK,EAAE,CAAC,uBAAuB,GAAG,IAAI,EAAE;AAC5E;AAEM,SAAU,uBAAuB,CACrC,gBAA2B,EAC3B,OAAwB,EAAA;IAExB,MAAM,IAAI,GAAmB,EAAE;AAC/B,IAAA,IAAI,gBAAgB,CAAC,SAAS,IAAI,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE;QAC/E,IAAI,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC;IAC/D;AACA,IAAA,OAAO,IAAI;AACb;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-archive-entity.command.util-DhCNqo2R.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/archive-entity.command.helper.ts","../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/archive-entity.command.util.ts"],"sourcesContent":["import { AXDialogService } from '@acorex/components/dialog';\nimport { AXLoadingDialogService } from '@acorex/components/loading-dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport type { AXPContextData } from '@acorex-platform/framework-shared/core';\nimport {\n AXPCommonSettings,\n AXPSettingsService,\n extractRequestErrorInfo,\n platformErrorI18nKey,\n throwIfCommandFailed,\n} from '@acorex-platform/framework-client/common';\nimport { AXPEntityBroadcastService } from '@acorex-platform/framework-client/core';\nimport { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXP_ENTITY_ARCHIVE_OVERRIDES } from '../archive-entity.override';\n\n/**\n * Injectable helper for archive commands: confirmation UI, persistence, toasts, and refresh events.\n * Pure input/patch logic lives in {@link archive-entity.command.util}.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPArchiveEntityCommandHelper {\n private readonly entityRegistry = inject(AXPEntityDefinitionRegistryService);\n private readonly dialogService = inject(AXDialogService);\n private readonly loadingDialog = inject(AXLoadingDialogService);\n private readonly translationService = inject(AXTranslationService);\n private readonly toastService = inject(AXToastService);\n private readonly settingsService = inject(AXPSettingsService);\n private readonly entityEvents = inject(AXPEntityBroadcastService);\n private readonly archiveOverrides = inject(AXP_ENTITY_ARCHIVE_OVERRIDES, { optional: true }) ?? [];\n\n async resolveEntity(refType: string): Promise<AXPEntity> {\n const [moduleName, entityName] = refType.split('.');\n return this.entityRegistry.resolve(moduleName, entityName);\n }\n\n async applyPatch(refType: string, refId: string, patch: AXPContextData): Promise<void> {\n const override = this.archiveOverrides.find((entry) => entry.refType === refType);\n if (override) {\n const archived = patch['isArchived'] === true;\n if (archived) {\n await override.archive(refId);\n } else {\n await override.restore(refId);\n }\n return;\n }\n\n const entityDefinition = await this.resolveEntity(refType);\n const updateExec = entityDefinition.commands?.update?.execute as\n | ((payload: AXPContextData) => Promise<unknown>)\n | undefined;\n\n if (!updateExec) {\n throw new Error('Entity does not support update operation');\n }\n\n const result = await updateExec({ id: refId, ...patch });\n throwIfCommandFailed(result);\n }\n\n async confirm(titleKey: string, messageKey: string, messageParams?: AXPContextData): Promise<boolean> {\n const dialogResult = await this.dialogService.confirm(\n await this.translationService.translateAsync(titleKey),\n await this.translationService.translateAsync(messageKey, { params: messageParams }),\n 'warning',\n 'horizontal',\n false,\n 'cancel',\n );\n return dialogResult.result === true;\n }\n\n showLoading(title: string, status: string) {\n return this.loadingDialog.show({\n title,\n mode: 'indeterminate',\n status,\n });\n }\n\n async showSuccessToast(titleKey: string, contentKey?: string): Promise<void> {\n const enabled = await this.settingsService.get<boolean>(AXPCommonSettings.EnableOperationToasts);\n if (!enabled) {\n return;\n }\n\n this.toastService.show({\n color: 'success',\n title: await this.translationService.translateAsync(titleKey),\n content: contentKey ? await this.translationService.translateAsync(contentKey) : undefined,\n });\n }\n\n async showErrorToastFor(error: unknown, fallbackKey: string): Promise<void> {\n const enabled = await this.settingsService.get<boolean>(AXPCommonSettings.EnableOperationToasts);\n if (!enabled) {\n return;\n }\n\n const info = extractRequestErrorInfo(error);\n const contentKey =\n platformErrorI18nKey(info?.code) ??\n (typeof info?.message === 'string' && info.message.startsWith('@')\n ? info.message\n : null) ??\n fallbackKey;\n const content = contentKey.startsWith('@')\n ? await this.translationService.translateAsync(contentKey)\n : contentKey;\n\n this.toastService.show({\n color: 'danger',\n title: await this.translationService.translateAsync('@general:messages.generic.error.title'),\n content,\n closeButton: true,\n timeOut: 6000,\n timeOutProgress: true,\n });\n }\n\n dispatchArchived(refType: string, id: string, meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, meta as Record<string, unknown> | undefined);\n }\n\n dispatchUnarchived(refType: string, id: string, meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, meta as Record<string, unknown> | undefined);\n }\n\n dispatchBulkArchived(refType: string, ids: string[], meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-archive', ...(meta ?? {}) });\n }\n\n dispatchBulkUnarchived(refType: string, ids: string[], meta?: AXPContextData): void {\n this.entityEvents.publishLayoutRefresh(refType, { refreshType: 'bulk-unarchive', ...(meta ?? {}) });\n }\n}\n","import type { AXPContextData } from '@acorex-platform/framework-shared/core';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { resolveEntityActionBulkRef, resolveEntityActionRef } from '@acorex-platform/framework-shared/runtime';\n\nexport const DEFAULT_ARCHIVE_FIELD = 'isArchived';\nexport const ARCHIVE_TIMESTAMP_FIELD = 'archivedAt';\n\nexport interface AXPArchiveCommandContext {\n refId: string;\n refType: string;\n rowData?: AXPContextData;\n}\n\nexport interface AXPBulkArchiveCommandContext {\n refType: string;\n ids: string[];\n rows: AXPContextData[];\n}\n\nexport function normalizeArchiveSingleInput(input: AXPContextData): AXPArchiveCommandContext | null {\n const resolved = resolveEntityActionRef(input);\n if (!resolved) {\n return null;\n }\n\n return {\n refId: resolved.refId,\n refType: resolved.refType,\n rowData: resolved.rowData as AXPContextData | undefined,\n };\n}\n\nexport function normalizeArchiveBulkInput(input: AXPContextData): AXPBulkArchiveCommandContext | null {\n const resolved = resolveEntityActionBulkRef(input);\n if (!resolved) {\n return null;\n }\n\n return {\n refType: resolved.refType,\n ids: resolved.ids,\n rows: resolved.rows as AXPContextData[],\n };\n}\n\nexport function buildArchivePatch(archived: boolean): AXPContextData {\n if (archived) {\n return { [DEFAULT_ARCHIVE_FIELD]: true, [ARCHIVE_TIMESTAMP_FIELD]: new Date() };\n }\n return { [DEFAULT_ARCHIVE_FIELD]: false, [ARCHIVE_TIMESTAMP_FIELD]: null };\n}\n\nexport function buildArchiveRefreshMeta(\n entityDefinition: AXPEntity,\n rowData?: AXPContextData,\n): AXPContextData {\n const meta: AXPContextData = {};\n if (entityDefinition.parentKey && rowData?.[entityDefinition.parentKey] != null) {\n meta['refreshTargetId'] = rowData[entityDefinition.parentKey];\n }\n return meta;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAmBA;;;AAGG;MAEU,6BAA6B,CAAA;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B,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,OAAO,EAAE,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;AACA,IAAA,OAAO,EAAE,CAAC,qBAAqB,GAAG,KAAK,EAAE,CAAC,uBAAuB,GAAG,IAAI,EAAE;AAC5E;AAEM,SAAU,uBAAuB,CACrC,gBAA2B,EAC3B,OAAwB,EAAA;IAExB,MAAM,IAAI,GAAmB,EAAE;AAC/B,IAAA,IAAI,gBAAgB,CAAC,SAAS,IAAI,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE;QAC/E,IAAI,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC;IAC/D;AACA,IAAA,OAAO,IAAI;AACb;;"}
|
|
@@ -3,7 +3,7 @@ import { AXTranslationService } from '@acorex/core/translation';
|
|
|
3
3
|
import { AXPEntityBulkPatchPerformService } from '@acorex-platform/framework-client/layout/entity';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
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-
|
|
6
|
+
import { A as AXPArchiveEntityCommandHelper, c as normalizeArchiveBulkInput, b as buildArchivePatch } from './acorex-platform-module-common-client-archive-entity.command.util-DhCNqo2R.mjs';
|
|
7
7
|
|
|
8
8
|
class AXPBulkArchiveEntityCommand {
|
|
9
9
|
constructor() {
|
|
@@ -63,4 +63,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
63
63
|
}] });
|
|
64
64
|
|
|
65
65
|
export { AXPBulkArchiveEntityCommand };
|
|
66
|
-
//# sourceMappingURL=acorex-platform-module-common-client-bulk-archive-entity.command-
|
|
66
|
+
//# sourceMappingURL=acorex-platform-module-common-client-bulk-archive-entity.command-D01227SB.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-common-client-bulk-archive-entity.command-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-bulk-archive-entity.command-D01227SB.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!, metadata: { refresh: false } }\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,CA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I,CAAC,EAAE;AAC9B,YAAA,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE;AAC7D,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;;QAGA,OAAO,MAAM,CAAC;cACV,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAiB,EAAE,IAAI,EAAE,IAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;AACrF,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;;;"}
|
|
@@ -3,7 +3,7 @@ import { AXTranslationService } from '@acorex/core/translation';
|
|
|
3
3
|
import { AXPEntityBulkPatchPerformService } from '@acorex-platform/framework-client/layout/entity';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
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-
|
|
6
|
+
import { A as AXPArchiveEntityCommandHelper, c as normalizeArchiveBulkInput, b as buildArchivePatch } from './acorex-platform-module-common-client-archive-entity.command.util-DhCNqo2R.mjs';
|
|
7
7
|
|
|
8
8
|
class AXPBulkRestoreArchiveEntityCommand {
|
|
9
9
|
constructor() {
|
|
@@ -62,4 +62,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
62
62
|
}] });
|
|
63
63
|
|
|
64
64
|
export { AXPBulkRestoreArchiveEntityCommand };
|
|
65
|
-
//# sourceMappingURL=acorex-platform-module-common-client-bulk-restore-archive-entity.command-
|
|
65
|
+
//# sourceMappingURL=acorex-platform-module-common-client-bulk-restore-archive-entity.command-CaTT2Rqd.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-common-client-bulk-restore-archive-entity.command-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-bulk-restore-archive-entity.command-CaTT2Rqd.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!, metadata: { refresh: false } }\n : { success: false, message: result.message };\n }\n}"],"names":[],"mappings":";;;;;;;MAYa,kCAAkC,CAAA;AAD/C,IAAA,WAAA,GAAA;AAImB,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|
|
8
8
|
import { AXPEntityBroadcastService } from '@acorex-platform/framework-client/core';
|
|
9
9
|
import { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';
|
|
10
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-
|
|
11
|
+
import { t as toVariableName, i as isValidVariableName } from './acorex-platform-module-common-client-acorex-platform-module-common-client-Cd7vTe3G.mjs';
|
|
12
12
|
|
|
13
13
|
class AXPCloneEntityCommandHelper {
|
|
14
14
|
constructor() {
|
|
@@ -223,4 +223,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
223
223
|
}] });
|
|
224
224
|
|
|
225
225
|
export { AXPCloneEntityCommand };
|
|
226
|
-
//# sourceMappingURL=acorex-platform-module-common-client-clone-entity.command-
|
|
226
|
+
//# sourceMappingURL=acorex-platform-module-common-client-clone-entity.command-BxT9kdpw.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-common-client-clone-entity.command-UyUOYAxp.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,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAC5C,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,yBAAyB,CAAC;AA8ElE,IAAA;IA5EC,MAAM,aAAa,CAAC,OAAe,EAAA;AACjC,QAAA,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;QACnD,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC;IAC5D;AAEA,IAAA,MAAM,eAAe,CAAC,OAAe,EAAE,KAAa,EAAA;QAClD,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;AAE1D,QAAA,IAAI,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE;YACnC,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,OAEpC;YAEb,IAAI,CAAC,SAAS,EAAE;AACd,gBAAA,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC;YACzD;AAEA,YAAA,OAAO,SAAS,CA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ACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;AACP,oBAAA,IAAI,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,wBAAwB;AACxE,iBAAA;aACF;QACH;gBAAU;YACR,aAAa,CAAC,KAAK,EAAE;QACvB;IACF;8GAlDW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAArB,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,qBAAqB,cADR,MAAM,EAAA,CAAA,CAAA;;2FACnB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-clone-entity.command-BxT9kdpw.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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AE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,wBAAwB;AACxE,iBAAA;aACF;QACH;gBAAU;YACR,aAAa,CAAC,KAAK,EAAE;QACvB;IACF;8GAlDW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAArB,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,qBAAqB,cADR,MAAM,EAAA,CAAA,CAAA;;2FACnB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AXTranslationService } from '@acorex/core/translation';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, Injectable } from '@angular/core';
|
|
4
|
-
import { A as AXPArchiveEntityCommandHelper, n as normalizeArchiveSingleInput, b as buildArchivePatch, a as buildArchiveRefreshMeta } from './acorex-platform-module-common-client-archive-entity.command.util-
|
|
4
|
+
import { A as AXPArchiveEntityCommandHelper, n as normalizeArchiveSingleInput, b as buildArchivePatch, a as buildArchiveRefreshMeta } from './acorex-platform-module-common-client-archive-entity.command.util-DhCNqo2R.mjs';
|
|
5
5
|
|
|
6
6
|
class AXPRestoreArchiveEntityCommand {
|
|
7
7
|
constructor() {
|
|
@@ -48,4 +48,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
48
48
|
}] });
|
|
49
49
|
|
|
50
50
|
export { AXPRestoreArchiveEntityCommand };
|
|
51
|
-
//# sourceMappingURL=acorex-platform-module-common-client-restore-archive-entity.command-
|
|
51
|
+
//# sourceMappingURL=acorex-platform-module-common-client-restore-archive-entity.command-BWF8iH1Z.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-common-client-restore-archive-entity.command-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-restore-archive-entity.command-BWF8iH1Z.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 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 loadingDialog.close();\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, metadata: { refresh: false } };\n } catch (error) {\n loadingDialog.close();\n await this.helper.showErrorToastFor(error, '@general:messages.generic.error.description');\n return { success: false };\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,EAChD,kDAAkD,CACnD;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,qDAAqD,CAAC,EACnG,gBAAgB,CACjB;AAED,QAAA,IAAI;AACF,YAAA,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC;AACzE,YAAA,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC;AACtC,YAAA,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;YAEnE,MAAM,IAAI,GAAG,uBAAuB,CAAC,gBAAgB,EAAE,OAAO,CAAC,OAAO,CAAC;AACvE,YAAA,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;YACpE,aAAa,CAAC,KAAK,EAAE;YACrB,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAChC,qCAAqC,EACrC,0CAA0C,CAC3C;YAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QACzF;QAAE,OAAO,KAAK,EAAE;YACd,aAAa,CAAC,KAAK,EAAE;YACrB,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,6CAA6C,CAAC;AACzF,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3B;IACF;8GA/CW,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA9B,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,8BAA8B,cADjB,MAAM,EAAA,CAAA,CAAA;;2FACnB,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -22,7 +22,7 @@ import { inject, viewChild, viewChildren, ChangeDetectionStrategy, Component } f
|
|
|
22
22
|
import * as i2 from '@angular/forms';
|
|
23
23
|
import { FormsModule } from '@angular/forms';
|
|
24
24
|
import { first } from 'rxjs';
|
|
25
|
-
import { a as AXPGlobalSearchViewModel } from './acorex-platform-module-common-client-acorex-platform-module-common-client-
|
|
25
|
+
import { a as AXPGlobalSearchViewModel } from './acorex-platform-module-common-client-acorex-platform-module-common-client-Cd7vTe3G.mjs';
|
|
26
26
|
|
|
27
27
|
class AXPGlobalSearchPopupComponent extends AXBasePageComponent {
|
|
28
28
|
constructor() {
|
|
@@ -136,4 +136,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
136
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
137
|
|
|
138
138
|
export { AXPGlobalSearchPopupComponent };
|
|
139
|
-
//# sourceMappingURL=acorex-platform-module-common-client-search-popup.component-
|
|
139
|
+
//# sourceMappingURL=acorex-platform-module-common-client-search-popup.component-B4LA5yh1.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-common-client-search-popup.component-j0h_8fec.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/global-search/search-popup.component.ts","../../../../libs/modules/common/client/src/lib/features/global-search/search-popup.component.html"],"sourcesContent":["import {\n AXListNavigationDirective,\n AXListNavigationItemDirective,\n AXListNavigationModule,\n} from '@acorex/cdk/list-navigation';\nimport { AXButtonModule } from '@acorex/components/button';\nimport { AXChipsModule } from '@acorex/components/chips';\nimport { AXClickEvent, AXCommonModule, AXHtmlEvent, AXValueChangedEvent } from '@acorex/cdk/common';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXBasePageComponent } from '@acorex/components/page';\nimport { AXSearchBoxComponent, AXSearchBoxModule } from '@acorex/components/search-box';\nimport { AXSkeletonModule } from '@acorex/components/skeleton';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { AXPSearchDisplayResult } from '@acorex-platform/framework-client/common';\nimport {\n AXPThemeLayoutBlockComponent,\n AXPThemeLayoutHeaderComponent,\n AXPThemeLayoutListComponent,\n AXPThemeLayoutListItemComponent,\n AXPThemeLayoutListItemsGroupComponent,\n AXPStateMessageComponent,\n} from '@acorex-platform/framework-client/layout/components';\nimport { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, inject, viewChild, viewChildren } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { first } from 'rxjs';\nimport { AXPGlobalSearchViewModel } from './search.viewmodel';\n\n@Component({\n templateUrl: 'search-popup.component.html',\n styleUrl: 'search-popup.component.css',\n imports: [\n CommonModule,\n FormsModule,\n //\n AXSearchBoxModule,\n AXCommonModule,\n AXDecoratorModule,\n AXTranslationModule,\n AXListNavigationModule,\n AXButtonModule,\n //\n AXSkeletonModule,\n AXChipsModule,\n AXPThemeLayoutBlockComponent,\n AXPThemeLayoutListComponent,\n AXPThemeLayoutListItemComponent,\n AXPThemeLayoutListItemsGroupComponent,\n AXPThemeLayoutHeaderComponent,\n AXPStateMessageComponent,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [AXPGlobalSearchViewModel],\n})\nexport class AXPGlobalSearchPopupComponent extends AXBasePageComponent {\n protected i18nScope = 'global-search';\n\n protected vm = inject(AXPGlobalSearchViewModel);\n\n protected text: string | null = null;\n\n private list = viewChild(AXListNavigationDirective);\n private searchBox = viewChild(AXSearchBoxComponent);\n private items = viewChildren(AXListNavigationItemDirective);\n\n async handleTextChanged(e: AXValueChangedEvent<string>) {\n if (e.isUserInteraction) {\n await this.vm.search(e.value!);\n }\n }\n\n protected override ngOnInit() {\n super.ngOnInit();\n //\n this.vm.onItemSelected.pipe(first()).subscribe((item) => {\n this.close(item);\n });\n }\n\n protected handleSearchKeyDown(e: AXHtmlEvent<KeyboardEvent>) {\n const event = e.nativeEvent!;\n switch (event.code) {\n case 'ArrowDown':\n const item = this.items()[0];\n if (item && this.list()) {\n this.list()?.navigateTo(item);\n }\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n protected handleClearClick($event: AXClickEvent) {\n this.vm.clearRecentItems();\n }\n\n protected handleListKeyDown(e: KeyboardEvent) {\n switch (e.code) {\n case 'ArrowUp': {\n const item = this.items()[0];\n if (item && this.list() && item.isActive()) {\n this.searchBox()?.focus();\n }\n break;\n }\n case 'Escape': {\n this.searchBox()?.focus();\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n }\n }\n\n protected handleItemKeyDown(e: KeyboardEvent, item: AXPSearchDisplayResult) {\n switch (e.code) {\n case 'Enter':\n case 'Space': {\n e.preventDefault();\n e.stopPropagation();\n this.vm.execute(item);\n break;\n }\n }\n }\n\n protected handlePinClick(e: Event, item: any) {\n e.stopPropagation();\n this.vm.togglePin(item);\n }\n\n protected searchListItemIcon(item: AXPSearchDisplayResult): string {\n const icon = item.icon?.trim();\n if (!icon) {\n return 'fa-light fa-circle';\n }\n return icon.includes(' ') ? icon : `fa-light ${icon}`;\n }\n}\n","<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"],"names":["i7","i9"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsDM,MAAO,6BAA8B,SAAQ,mBAAmB,CAAA;AA1BtE,IAAA,WAAA,GAAA;;QA2BY,IAAA,CAAA,SAAS,GAAG,eAAe;AAE3B,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,CAAC,wBAAwB,CAAC;QAErC,IAAA,CAAA,IAAI,GAAkB,IAAI;QAE5B,IAAA,CAAA,IAAI,GAAG,SAAS,CAAC,yBAAyB;iFAAC;QAC3C,IAAA,CAAA,SAAS,GAAG,SAAS,CAAC,oBAAoB;sFAAC;QAC3C,IAAA,CAAA,KAAK,GAAG,YAAY,CAAC,6BAA6B;kFAAC;AA4E5D,IAAA;IA1EC,MAAM,iBAAiB,CAAC,CAA8B,EAAA;AACpD,QAAA,IAAI,CAAC,CAAC,iBAAiB,EAAE;YACvB,MAAM,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,KAAM,CAAC;QAChC;IACF;IAEmB,QAAQ,GAAA;QACzB,KAAK,CAAC,QAAQ,EAAE;;AAEhB,QAAA,IAAI,CAAC,EAAE,CAAC,c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;wBACrC,6BAA6B;wBAC7B,wBAAwB;AACzB,qBAAA,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EAAA,SAAA,EACpC,CAAC,wBAAwB,CAAC,EAAA,QAAA,EAAA,i+MAAA,EAAA,MAAA,EAAA,CAAA,2iIAAA,CAAA,EAAA;sFASZ,yBAAyB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MACpB,oBAAoB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,YAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MACrB,6BAA6B,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-search-popup.component-B4LA5yh1.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/global-search/search-popup.component.ts","../../../../libs/modules/common/client/src/lib/features/global-search/search-popup.component.html"],"sourcesContent":["import {\n AXListNavigationDirective,\n AXListNavigationItemDirective,\n AXListNavigationModule,\n} from '@acorex/cdk/list-navigation';\nimport { AXButtonModule } from '@acorex/components/button';\nimport { AXChipsModule } from '@acorex/components/chips';\nimport { AXClickEvent, AXCommonModule, AXHtmlEvent, AXValueChangedEvent } from '@acorex/cdk/common';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXBasePageComponent } from '@acorex/components/page';\nimport { AXSearchBoxComponent, AXSearchBoxModule } from '@acorex/components/search-box';\nimport { AXSkeletonModule } from '@acorex/components/skeleton';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { AXPSearchDisplayResult } from '@acorex-platform/framework-client/common';\nimport {\n AXPThemeLayoutBlockComponent,\n AXPThemeLayoutHeaderComponent,\n AXPThemeLayoutListComponent,\n AXPThemeLayoutListItemComponent,\n AXPThemeLayoutListItemsGroupComponent,\n AXPStateMessageComponent,\n} from '@acorex-platform/framework-client/layout/components';\nimport { CommonModule } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, inject, viewChild, viewChildren } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { first } from 'rxjs';\nimport { AXPGlobalSearchViewModel } from './search.viewmodel';\n\n@Component({\n templateUrl: 'search-popup.component.html',\n styleUrl: 'search-popup.component.css',\n imports: [\n CommonModule,\n FormsModule,\n //\n AXSearchBoxModule,\n AXCommonModule,\n AXDecoratorModule,\n AXTranslationModule,\n AXListNavigationModule,\n AXButtonModule,\n //\n AXSkeletonModule,\n AXChipsModule,\n AXPThemeLayoutBlockComponent,\n AXPThemeLayoutListComponent,\n AXPThemeLayoutListItemComponent,\n AXPThemeLayoutListItemsGroupComponent,\n AXPThemeLayoutHeaderComponent,\n AXPStateMessageComponent,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [AXPGlobalSearchViewModel],\n})\nexport class AXPGlobalSearchPopupComponent extends AXBasePageComponent {\n protected i18nScope = 'global-search';\n\n protected vm = inject(AXPGlobalSearchViewModel);\n\n protected text: string | null = null;\n\n private list = viewChild(AXListNavigationDirective);\n private searchBox = viewChild(AXSearchBoxComponent);\n private items = viewChildren(AXListNavigationItemDirective);\n\n async handleTextChanged(e: AXValueChangedEvent<string>) {\n if (e.isUserInteraction) {\n await this.vm.search(e.value!);\n }\n }\n\n protected override ngOnInit() {\n super.ngOnInit();\n //\n this.vm.onItemSelected.pipe(first()).subscribe((item) => {\n this.close(item);\n });\n }\n\n protected handleSearchKeyDown(e: AXHtmlEvent<KeyboardEvent>) {\n const event = e.nativeEvent!;\n switch (event.code) {\n case 'ArrowDown':\n const item = this.items()[0];\n if (item && this.list()) {\n this.list()?.navigateTo(item);\n }\n event.preventDefault();\n event.stopPropagation();\n break;\n }\n }\n\n protected handleClearClick($event: AXClickEvent) {\n this.vm.clearRecentItems();\n }\n\n protected handleListKeyDown(e: KeyboardEvent) {\n switch (e.code) {\n case 'ArrowUp': {\n const item = this.items()[0];\n if (item && this.list() && item.isActive()) {\n this.searchBox()?.focus();\n }\n break;\n }\n case 'Escape': {\n this.searchBox()?.focus();\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n }\n }\n\n protected handleItemKeyDown(e: KeyboardEvent, item: AXPSearchDisplayResult) {\n switch (e.code) {\n case 'Enter':\n case 'Space': {\n e.preventDefault();\n e.stopPropagation();\n this.vm.execute(item);\n break;\n }\n }\n }\n\n protected handlePinClick(e: Event, item: any) {\n e.stopPropagation();\n this.vm.togglePin(item);\n }\n\n protected searchListItemIcon(item: AXPSearchDisplayResult): string {\n const icon = item.icon?.trim();\n if (!icon) {\n return 'fa-light fa-circle';\n }\n return icon.includes(' ') ? icon : `fa-light ${icon}`;\n }\n}\n","<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"],"names":["i7","i9"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsDM,MAAO,6BAA8B,SAAQ,mBAAmB,CAAA;AA1BtE,IAAA,WAAA,GAAA;;QA2BY,IAAA,CAAA,SAAS,GAAG,eAAe;AAE3B,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,CAAC,wBAAwB,CAAC;QAErC,IAAA,CAAA,IAAI,GAAkB,IAAI;QAE5B,IAAA,CAAA,IAAI,GAAG,SAAS,CAAC,yBAAyB;iFAAC;QAC3C,IAAA,CAAA,SAAS,GAAG,SAAS,CAAC,oBAAoB;sFAAC;QAC3C,IAAA,CAAA,KAAK,GAAG,YAAY,CAAC,6BAA6B;kFAAC;AA4E5D,IAAA;IA1EC,MAAM,iBAAiB,CAAC,CAA8B,EAAA;AACpD,QAAA,IAAI,CAAC,CAAC,iBAAiB,EAAE;YACvB,MAAM,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,KAAM,CAAC;QAChC;IACF;IAEmB,QAAQ,GAAA;QACzB,KAAK,CAAC,QAAQ,EAAE;;AAEhB,QAAA,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAA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A,EAAA,eAAA,EACgB,uBAAuB,CAAC,MAAM,EAAA,SAAA,EACpC,CAAC,wBAAwB,CAAC,EAAA,QAAA,EAAA,i+MAAA,EAAA,MAAA,EAAA,CAAA,2iIAAA,CAAA,EAAA;sFASZ,yBAAyB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MACpB,oBAAoB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,YAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MACrB,6BAA6B,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;"}
|
|
@@ -11,7 +11,7 @@ import { AXPActivityLogComponent } from '@acorex-platform/framework-client/layou
|
|
|
11
11
|
import { AXPVersioningService } from '@acorex-platform/framework-client/common';
|
|
12
12
|
import * as i4 from '@acorex/core/translation';
|
|
13
13
|
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
|
|
14
|
-
import { v as versionEntriesToActivityLogs, o as openActivityLogVersionCompare } from './acorex-platform-module-common-client-acorex-platform-module-common-client-
|
|
14
|
+
import { v as versionEntriesToActivityLogs, o as openActivityLogVersionCompare } from './acorex-platform-module-common-client-acorex-platform-module-common-client-Cd7vTe3G.mjs';
|
|
15
15
|
|
|
16
16
|
class AXMTimelineVersionHistoryPopupComponent extends AXBasePageComponent {
|
|
17
17
|
constructor() {
|
|
@@ -60,4 +60,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
60
60
|
}] });
|
|
61
61
|
|
|
62
62
|
export { AXMTimelineVersionHistoryPopupComponent };
|
|
63
|
-
//# sourceMappingURL=acorex-platform-module-common-client-timeline-version-history-popup.component-
|
|
63
|
+
//# sourceMappingURL=acorex-platform-module-common-client-timeline-version-history-popup.component-CPmN0kme.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-common-client-timeline-version-history-popup.component-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-common-client-timeline-version-history-popup.component-CPmN0kme.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/history-plugin/components/timeline-version-history-popup/timeline-version-history-popup.component.ts","../../../../libs/modules/common/client/src/lib/features/history-plugin/components/timeline-version-history-popup/timeline-version-history-popup.component.html"],"sourcesContent":["import { Component, inject, Injector, signal, ViewEncapsulation, computed, ChangeDetectionStrategy } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { AXButtonModule } from '@acorex/components/button';\nimport { AXBasePageComponent } from '@acorex/components/page';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport {\n AXPActivityLogCompareRequest,\n AXPActivityLogComponent,\n} from '@acorex-platform/framework-client/layout/components';\nimport { AXPVersionEntry, AXPVersioningService } from '@acorex-platform/framework-client/common';\nimport { AXTranslationModule, AXTranslationService } from '@acorex/core/translation';\nimport { versionEntriesToActivityLogs } from '../../utils/version-history.utils';\nimport { openActivityLogVersionCompare } from '../../utils/open-activity-log-compare.util';\n\n@Component({\n selector: 'axp-timeline-version-history-popup',\n templateUrl: './timeline-version-history-popup.component.html',\n imports: [\n CommonModule,\n AXDecoratorModule,\n AXButtonModule,\n AXTranslationModule,\n AXPActivityLogComponent,\n ],\n changeDetection: ChangeDetectionStrategy.Eager,\n encapsulation: ViewEncapsulation.None,\n})\nexport class AXMTimelineVersionHistoryPopupComponent extends AXBasePageComponent {\n refId!: string;\n refType!: string;\n fieldTitles?: Record<string, string>;\n fromDate!: Date;\n toDate!: Date;\n limit!: number;\n offset!: number;\n\n protected isBusy = signal(false);\n\n protected versioning = inject(AXPVersioningService);\n private readonly injector = inject(Injector);\n private readonly translation = inject(AXTranslationService);\n protected versions = signal<AXPVersionEntry[]>([]);\n protected activities = computed(() =>\n versionEntriesToActivityLogs(\n this.versions(),\n this.refId,\n this.refType,\n this.fieldTitles,\n undefined,\n this.translation.getActiveLang?.() ?? 'en-US',\n )\n );\n\n override async ngOnInit(): Promise<void> {\n this.isBusy.set(true);\n super.ngOnInit();\n const streamId = await this.versioning.getStreamIdIfExists(this.refType, this.refId);\n if (streamId) {\n const entries = await this.versioning.listEntries(streamId, {\n limit: this.limit,\n offset: this.offset,\n });\n this.versions.set(entries);\n } else {\n this.versions.set([]);\n }\n this.isBusy.set(false);\n }\n\n protected async onCompareRequested(event: AXPActivityLogCompareRequest): Promise<void> {\n await openActivityLogVersionCompare(this.injector, event);\n }\n}\n","<ax-content>\n <div class=\"p-6 min-h-[30vh] overflow-y-auto\">\n <axp-activity-log\n [activities]=\"activities()\"\n [loading]=\"isBusy()\"\n [enableCompare]=\"true\"\n [showActionType]=\"false\"\n (compareRequested)=\"onCompareRequested($event)\"\n ></axp-activity-log>\n </div>\n</ax-content>\n<ax-footer>\n <ax-prefix></ax-prefix>\n <ax-suffix>\n <ax-button\n [text]=\"'@general:actions.close.title' | translate | async\"\n look=\"solid\"\n color=\"primary\"\n (onClick)=\"close()\"\n >\n </ax-button>\n </ax-suffix>\n</ax-footer>\n"],"names":["i3"],"mappings":";;;;;;;;;;;;;;;AA4BM,MAAO,uCAAwC,SAAQ,mBAAmB,CAAA;AAbhF,IAAA,WAAA,GAAA;;QAsBY,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,KAAK;mFAAC;AAEtB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAClC,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,oBAAoB,CAAC;QACjD,IAAA,CAAA,QAAQ,GAA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CAAA,uBAAA,CAAA,KAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;2FAKd,uCAAuC,EAAA,UAAA,EAAA,CAAA;kBAbnD,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,oCAAoC,EAAA,OAAA,EAErC;wBACP,YAAY;wBACZ,iBAAiB;wBACjB,cAAc;wBACd,mBAAmB;wBACnB,uBAAuB;AACxB,qBAAA,EAAA,eAAA,EACgB,uBAAuB,CAAC,KAAK,EAAA,aAAA,EAC/B,iBAAiB,CAAC,IAAI,EAAA,QAAA,EAAA,2lBAAA,EAAA;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { b as AXMCommonModule, c as AXMMenuProvider, d as AXMSettingProvider, e as AXMVersionHistoryPageComponent, f as AXPArchivePluginModule, g as AXPCommonFeatureDefinitionProvider, h as AXPDerivedNamePluginModule, j as AXPDisablePluginModule, k as AXPGlobalSearchModule, a as AXPGlobalSearchViewModel, l as AXPHistoryAuditInfoWidget, m as AXPHistoryModule, n as AXPLockEntityCommand, p as AXPResourceAppointmentPageComponent, q as AXPStatusPluginModule, r as AXPUniqueFieldsPluginModule, s as AXPUnlockEntityCommand, u as AXPValidationRulesModule, w as AXPVersioningPluginModule, A as AXP_ENTITY_ARCHIVE_OVERRIDES, x as AXP_GLOBAL_SEARCH_CONFIG_TOKEN, y as AXP_RESOURCE_APPOINTMENT_PAGE_CONFIG, z as ApprovalStatusProvider, B as AtLeastOneOfValidationRule, H as HISTORY_PAGE_COMPONENT_KEY, S as ShowVersionHistoryPopupCommand, C as StateStatusProvider, T as TaskStatusProvider, U as UniqueValidationRule, V as VARIABLE_NAME_VALIDATION_PATTERN, D as VariableNameValidationRule, E as aggregateVersionHistoryBarChartItems, F as archivePlugin, G as buildEntityFieldHistoryLineChartSeries, I as buildProductBasePriceHistoryLineChartSeries, J as derivedNamePlugin, K as disablePlugin, L as getActiveStatuses, M as getFinalStatuses, N as getInitialStatuses, O as getStatusByName, P as getTransitionsFromStatus, Q as getTransitionsToStatus, R as historyPlugin, W as humanizeChange, X as isValidTransition, i as isValidVariableName, Y as mapChangeType, Z as mapOpToAction, _ as resolvePathKey, $ as statusPlugin, t as toVariableName, a0 as uniqueFieldsPlugin, v as versionEntriesToActivityLogs, a1 as versioningPlugin } from './acorex-platform-module-common-client-acorex-platform-module-common-client-
|
|
1
|
+
export { b as AXMCommonModule, c as AXMMenuProvider, d as AXMSettingProvider, e as AXMVersionHistoryPageComponent, f as AXPArchivePluginModule, g as AXPCommonFeatureDefinitionProvider, h as AXPDerivedNamePluginModule, j as AXPDisablePluginModule, k as AXPGlobalSearchModule, a as AXPGlobalSearchViewModel, l as AXPHistoryAuditInfoWidget, m as AXPHistoryModule, n as AXPLockEntityCommand, p as AXPResourceAppointmentPageComponent, q as AXPStatusPluginModule, r as AXPUniqueFieldsPluginModule, s as AXPUnlockEntityCommand, u as AXPValidationRulesModule, w as AXPVersioningPluginModule, A as AXP_ENTITY_ARCHIVE_OVERRIDES, x as AXP_GLOBAL_SEARCH_CONFIG_TOKEN, y as AXP_RESOURCE_APPOINTMENT_PAGE_CONFIG, z as ApprovalStatusProvider, B as AtLeastOneOfValidationRule, H as HISTORY_PAGE_COMPONENT_KEY, S as ShowVersionHistoryPopupCommand, C as StateStatusProvider, T as TaskStatusProvider, U as UniqueValidationRule, V as VARIABLE_NAME_VALIDATION_PATTERN, D as VariableNameValidationRule, E as aggregateVersionHistoryBarChartItems, F as archivePlugin, G as buildEntityFieldHistoryLineChartSeries, I as buildProductBasePriceHistoryLineChartSeries, J as derivedNamePlugin, K as disablePlugin, L as getActiveStatuses, M as getFinalStatuses, N as getInitialStatuses, O as getStatusByName, P as getTransitionsFromStatus, Q as getTransitionsToStatus, R as historyPlugin, W as humanizeChange, X as isValidTransition, i as isValidVariableName, Y as mapChangeType, Z as mapOpToAction, _ as resolvePathKey, $ as statusPlugin, t as toVariableName, a0 as uniqueFieldsPlugin, v as versionEntriesToActivityLogs, a1 as versioningPlugin } from './acorex-platform-module-common-client-acorex-platform-module-common-client-Cd7vTe3G.mjs';
|
|
2
2
|
export { CommonManifest } from '@acorex-platform/module-common-client/contracts';
|
|
3
3
|
//# sourceMappingURL=acorex-platform-module-common-client.mjs.map
|