@acorex-platform/module-common-client 0.0.15 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{acorex-platform-module-common-client-acorex-platform-module-common-client-IHaYrZeE.mjs → acorex-platform-module-common-client-acorex-platform-module-common-client-rqWzT7RI.mjs} +16 -16
- package/fesm2022/{acorex-platform-module-common-client-acorex-platform-module-common-client-IHaYrZeE.mjs.map → acorex-platform-module-common-client-acorex-platform-module-common-client-rqWzT7RI.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-archive-entity.command-Dgsmx1_A.mjs → acorex-platform-module-common-client-archive-entity.command-CKENj9Od.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-archive-entity.command-Dgsmx1_A.mjs.map → acorex-platform-module-common-client-archive-entity.command-CKENj9Od.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-archive-entity.command.util-CEvlTSlo.mjs → acorex-platform-module-common-client-archive-entity.command.util-BZrXDNGP.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-archive-entity.command.util-CEvlTSlo.mjs.map → acorex-platform-module-common-client-archive-entity.command.util-BZrXDNGP.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-bulk-archive-entity.command-DZ6VL4oy.mjs → acorex-platform-module-common-client-bulk-archive-entity.command-CPqLp9Ci.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-bulk-archive-entity.command-DZ6VL4oy.mjs.map → acorex-platform-module-common-client-bulk-archive-entity.command-CPqLp9Ci.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-bulk-restore-archive-entity.command-C-ptvYRp.mjs → acorex-platform-module-common-client-bulk-restore-archive-entity.command-D2y8h15u.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-bulk-restore-archive-entity.command-C-ptvYRp.mjs.map → acorex-platform-module-common-client-bulk-restore-archive-entity.command-D2y8h15u.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-clone-entity.command-CyIAr8bc.mjs → acorex-platform-module-common-client-clone-entity.command-DFgIeWxX.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-clone-entity.command-CyIAr8bc.mjs.map → acorex-platform-module-common-client-clone-entity.command-DFgIeWxX.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-restore-archive-entity.command-D6ms054j.mjs → acorex-platform-module-common-client-restore-archive-entity.command-B0JFf8ms.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-restore-archive-entity.command-D6ms054j.mjs.map → acorex-platform-module-common-client-restore-archive-entity.command-B0JFf8ms.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-search-popup.component-upSRWTIO.mjs → acorex-platform-module-common-client-search-popup.component-BjGrZHnB.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-common-client-search-popup.component-upSRWTIO.mjs.map → acorex-platform-module-common-client-search-popup.component-BjGrZHnB.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-common-client-timeline-version-history-popup.component-D4lLwLpx.mjs → acorex-platform-module-common-client-timeline-version-history-popup.component-BwGLuNhW.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-common-client-timeline-version-history-popup.component-D4lLwLpx.mjs.map → acorex-platform-module-common-client-timeline-version-history-popup.component-BwGLuNhW.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-common-client.mjs +1 -1
- package/package.json +1 -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-BZrXDNGP.mjs';
|
|
5
5
|
|
|
6
6
|
class AXPArchiveEntityCommand {
|
|
7
7
|
constructor() {
|
|
@@ -54,4 +54,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
54
54
|
}] });
|
|
55
55
|
|
|
56
56
|
export { AXPArchiveEntityCommand };
|
|
57
|
-
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command-
|
|
57
|
+
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command-CKENj9Od.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-CKENj9Od.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/archive-entity.command.ts"],"sourcesContent":["import { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult, 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): Promise<AXPExecuteCommandResult<void>> {\n const context = normalizeArchiveSingleInput(input);\n if (!context) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n const confirmed = await this.helper.confirm(\n '@general:actions.archive.confirm.title',\n '@general:actions.archive.confirm.message',\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const loadingDialog = this.helper.showLoading(\n await this.translationService.translateAsync('@general:actions.archive.confirm.processing'),\n 'Archiving...',\n );\n\n try {\n const entityDefinition = await this.helper.resolveEntity(context.refType);\n const patch = buildArchivePatch(true);\n await this.helper.applyPatch(context.refType, context.refId, patch);\n\n const meta = buildArchiveRefreshMeta(entityDefinition, context.rowData);\n this.helper.dispatchArchived(context.refType, context.refId, meta);\n await this.helper.showSuccessToast('@general:workflow.entity-archived', '@general:workflow.entity-archived-body');\n\n return { success: true };\n } catch (error) {\n console.error('Archive operation failed:', error);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Archive operation failed',\n },\n };\n } finally {\n loadingDialog.close();\n }\n }\n}\n"],"names":[],"mappings":";;;;;MASa,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAgDnE,IAAA;IA9CC,MAAM,OAAO,CAAC,KAAqB,EAAA;AACjC,QAAA,MAAM,OAAO,GAAG,2BAA2B,CAAC,KAAK,CAAC;QAClD,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,uCAAuC,CAAC;AAC5F,iBAAA;aACF;QACH;AAEA,QAAA,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACzC,wCAAwC,EACxC,0CAA0C,CAC3C;QACD,IAAI,CAAC,SAAS,EAAE;AACd,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3B;QAEA,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAC3C,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,6CAA6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AAA,CAAA;;2FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -7,7 +7,7 @@ import { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-c
|
|
|
7
7
|
import { createWorkFlowEvent, AXPWorkflowEventService } from '@acorex-platform/framework-client/workflow';
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
9
|
import { inject, Injectable } from '@angular/core';
|
|
10
|
-
import { A as AXP_ENTITY_ARCHIVE_OVERRIDES } from './acorex-platform-module-common-client-acorex-platform-module-common-client-
|
|
10
|
+
import { A as AXP_ENTITY_ARCHIVE_OVERRIDES } from './acorex-platform-module-common-client-acorex-platform-module-common-client-rqWzT7RI.mjs';
|
|
11
11
|
|
|
12
12
|
const AXPEntityArchivedEvent = createWorkFlowEvent('[Entity] Archived');
|
|
13
13
|
const AXPEntityUnarchivedEvent = createWorkFlowEvent('[Entity] Unarchived');
|
|
@@ -141,4 +141,4 @@ function buildArchiveRefreshMeta(entityDefinition, rowData) {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
export { AXPArchiveEntityCommandHelper as A, buildArchiveRefreshMeta as a, buildArchivePatch as b, normalizeArchiveBulkInput as c, normalizeArchiveSingleInput as n };
|
|
144
|
-
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command.util-
|
|
144
|
+
//# sourceMappingURL=acorex-platform-module-common-client-archive-entity.command.util-BZrXDNGP.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-common-client-archive-entity.command.util-CEvlTSlo.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/archive-entity.events.ts","../../../../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 { createWorkFlowEvent } from '@acorex-platform/framework-client/workflow';\n\nexport const AXPEntityArchivedEvent = createWorkFlowEvent<{ entity: string; id: string; meta?: unknown }>(\n '[Entity] Archived',\n);\n\nexport const AXPEntityUnarchivedEvent = createWorkFlowEvent<{ entity: string; id: string; meta?: unknown }>(\n '[Entity] Unarchived',\n);\n\nexport const AXPEntityBulkArchivedEvent = createWorkFlowEvent<{\n entity: string;\n ids: string[];\n meta?: unknown;\n}>('[Entity] Bulk Archived');\n\nexport const AXPEntityBulkUnarchivedEvent = createWorkFlowEvent<{\n entity: string;\n ids: string[];\n meta?: unknown;\n}>('[Entity] Bulk Unarchived');\n","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, AXPRefreshEvent, AXPSettingsService } from '@acorex-platform/framework-client/common';\nimport { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPWorkflowEventService } from '@acorex-platform/framework-client/workflow';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { inject, Injectable } from '@angular/core';\n\nimport {\n AXPEntityArchivedEvent,\n AXPEntityBulkArchivedEvent,\n AXPEntityBulkUnarchivedEvent,\n AXPEntityUnarchivedEvent,\n} from '../archive-entity.events';\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 workflowEventService = inject(AXPWorkflowEventService);\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 await updateExec({ id: refId, ...patch });\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 dispatchArchived(refType: string, id: string, meta?: AXPContextData): void {\n this.workflowEventService.dispatch(AXPEntityArchivedEvent({ entity: refType, id, meta }));\n this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta }));\n }\n\n dispatchUnarchived(refType: string, id: string, meta?: AXPContextData): void {\n this.workflowEventService.dispatch(AXPEntityUnarchivedEvent({ entity: refType, id, meta }));\n this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta }));\n }\n\n dispatchBulkArchived(refType: string, ids: string[], meta?: AXPContextData): void {\n this.workflowEventService.dispatch(AXPEntityBulkArchivedEvent({ entity: refType, ids, meta }));\n this.workflowEventService.dispatch(\n AXPRefreshEvent({ entity: refType, meta: { refreshType: 'bulk-archive', ...meta } }),\n );\n }\n\n dispatchBulkUnarchived(refType: string, ids: string[], meta?: AXPContextData): void {\n this.workflowEventService.dispatch(AXPEntityBulkUnarchivedEvent({ entity: refType, ids, meta }));\n this.workflowEventService.dispatch(\n AXPRefreshEvent({ entity: refType, meta: { refreshType: 'bulk-unarchive', ...meta } }),\n );\n }\n}\n","import type { AXPContextData } from '@acorex-platform/framework-shared/core';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\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 ctx = input['__context__'] as AXPContextData | undefined;\n const options = (input['options'] ?? ctx?.['options'] ?? input) as AXPContextData;\n const data = ctx?.['data'] ?? input;\n const rowData = Array.isArray(data)\n ? (data[0] as AXPContextData | undefined)\n : (data as AXPContextData | undefined);\n\n const refType = String(\n options['refType'] ?? ctx?.['entity'] ?? (ctx?.['entityInfo'] as AXPContextData | undefined)?.['source'] ?? '',\n );\n const rawId = options['refId'] ?? rowData?.['id'] ?? rowData?.['_id'] ?? input['refId'];\n\n if (!refType || rawId == null || rawId === '') {\n return null;\n }\n\n return { refId: String(rawId), refType, rowData };\n}\n\nexport function normalizeArchiveBulkInput(input: AXPContextData): AXPBulkArchiveCommandContext | null {\n const ctx = input['__context__'] as AXPContextData | undefined;\n const options = (input['options'] ?? ctx?.['options'] ?? input) as AXPContextData;\n const data = ctx?.['data'] ?? input['data'] ?? input;\n const rows = (Array.isArray(data) ? data : data ? [data] : []) as AXPContextData[];\n\n const refType = String(\n options['refType'] ?? ctx?.['entity'] ?? (ctx?.['entityInfo'] as AXPContextData | undefined)?.['source'] ?? '',\n );\n const ids = rows.map((row) => row?.['id']).filter((id): id is string => id != null && id !== '');\n\n if (!refType || ids.length === 0) {\n return null;\n }\n\n return { refType, ids, rows };\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":";;;;;;;;;;;AAEO,MAAM,sBAAsB,GAAG,mBAAmB,CACvD,mBAAmB,CACpB;AAEM,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,qBAAqB,CACtB;AAEM,MAAM,0BAA0B,GAAG,mBAAmB,CAI1D,wBAAwB,CAAC;AAErB,MAAM,4BAA4B,GAAG,mBAAmB,CAI5D,0BAA0B,CAAC;;ACD9B;;;AAGG;MAEU,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,kCAAkC,CAAC;AAC3D,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,sBAAsB,CAAC;AAC9C,QAAA,IAAA,CAAA,kB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AAE,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-BZrXDNGP.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/archive-entity.events.ts","../../../../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 { createWorkFlowEvent } from '@acorex-platform/framework-client/workflow';\n\nexport const AXPEntityArchivedEvent = createWorkFlowEvent<{ entity: string; id: string; meta?: unknown }>(\n '[Entity] Archived',\n);\n\nexport const AXPEntityUnarchivedEvent = createWorkFlowEvent<{ entity: string; id: string; meta?: unknown }>(\n '[Entity] Unarchived',\n);\n\nexport const AXPEntityBulkArchivedEvent = createWorkFlowEvent<{\n entity: string;\n ids: string[];\n meta?: unknown;\n}>('[Entity] Bulk Archived');\n\nexport const AXPEntityBulkUnarchivedEvent = createWorkFlowEvent<{\n entity: string;\n ids: string[];\n meta?: unknown;\n}>('[Entity] Bulk Unarchived');\n","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, AXPRefreshEvent, AXPSettingsService } from '@acorex-platform/framework-client/common';\nimport { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPWorkflowEventService } from '@acorex-platform/framework-client/workflow';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { inject, Injectable } from '@angular/core';\n\nimport {\n AXPEntityArchivedEvent,\n AXPEntityBulkArchivedEvent,\n AXPEntityBulkUnarchivedEvent,\n AXPEntityUnarchivedEvent,\n} from '../archive-entity.events';\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 workflowEventService = inject(AXPWorkflowEventService);\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 await updateExec({ id: refId, ...patch });\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 dispatchArchived(refType: string, id: string, meta?: AXPContextData): void {\n this.workflowEventService.dispatch(AXPEntityArchivedEvent({ entity: refType, id, meta }));\n this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta }));\n }\n\n dispatchUnarchived(refType: string, id: string, meta?: AXPContextData): void {\n this.workflowEventService.dispatch(AXPEntityUnarchivedEvent({ entity: refType, id, meta }));\n this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta }));\n }\n\n dispatchBulkArchived(refType: string, ids: string[], meta?: AXPContextData): void {\n this.workflowEventService.dispatch(AXPEntityBulkArchivedEvent({ entity: refType, ids, meta }));\n this.workflowEventService.dispatch(\n AXPRefreshEvent({ entity: refType, meta: { refreshType: 'bulk-archive', ...meta } }),\n );\n }\n\n dispatchBulkUnarchived(refType: string, ids: string[], meta?: AXPContextData): void {\n this.workflowEventService.dispatch(AXPEntityBulkUnarchivedEvent({ entity: refType, ids, meta }));\n this.workflowEventService.dispatch(\n AXPRefreshEvent({ entity: refType, meta: { refreshType: 'bulk-unarchive', ...meta } }),\n );\n }\n}\n","import type { AXPContextData } from '@acorex-platform/framework-shared/core';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\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 ctx = input['__context__'] as AXPContextData | undefined;\n const options = (input['options'] ?? ctx?.['options'] ?? input) as AXPContextData;\n const data = ctx?.['data'] ?? input;\n const rowData = Array.isArray(data)\n ? (data[0] as AXPContextData | undefined)\n : (data as AXPContextData | undefined);\n\n const refType = String(\n options['refType'] ?? ctx?.['entity'] ?? (ctx?.['entityInfo'] as AXPContextData | undefined)?.['source'] ?? '',\n );\n const rawId = options['refId'] ?? rowData?.['id'] ?? rowData?.['_id'] ?? input['refId'];\n\n if (!refType || rawId == null || rawId === '') {\n return null;\n }\n\n return { refId: String(rawId), refType, rowData };\n}\n\nexport function normalizeArchiveBulkInput(input: AXPContextData): AXPBulkArchiveCommandContext | null {\n const ctx = input['__context__'] as AXPContextData | undefined;\n const options = (input['options'] ?? ctx?.['options'] ?? input) as AXPContextData;\n const data = ctx?.['data'] ?? input['data'] ?? input;\n const rows = (Array.isArray(data) ? data : data ? [data] : []) as AXPContextData[];\n\n const refType = String(\n options['refType'] ?? ctx?.['entity'] ?? (ctx?.['entityInfo'] as AXPContextData | undefined)?.['source'] ?? '',\n );\n const ids = rows.map((row) => row?.['id']).filter((id): id is string => id != null && id !== '');\n\n if (!refType || ids.length === 0) {\n return null;\n }\n\n return { refType, ids, rows };\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":";;;;;;;;;;;AAEO,MAAM,sBAAsB,GAAG,mBAAmB,CACvD,mBAAmB,CACpB;AAEM,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,qBAAqB,CACtB;AAEM,MAAM,0BAA0B,GAAG,mBAAmB,CAI1D,wBAAwB,CAAC;AAErB,MAAM,4BAA4B,GAAG,mBAAmB,CAI5D,0BAA0B,CAAC;;ACD9B;;;AAGG;MAEU,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,kCAAkC,CAAC;AAC3D,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,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,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,CAAC;AACtD,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,4BAA4B,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE;AAuFnG,IAAA;IArFC,MAAM,aAAa,CAAC,OAAe,EAAA;AACjC,QAAA,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;QACnD,OAAO,IAAI,C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XTranslationService } 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, c as normalizeArchiveBulkInput, b as buildArchivePatch } from './acorex-platform-module-common-client-archive-entity.command.util-
|
|
4
|
+
import { A as AXPArchiveEntityCommandHelper, c as normalizeArchiveBulkInput, b as buildArchivePatch } from './acorex-platform-module-common-client-archive-entity.command.util-BZrXDNGP.mjs';
|
|
5
5
|
|
|
6
6
|
class AXPBulkArchiveEntityCommand {
|
|
7
7
|
constructor() {
|
|
@@ -72,4 +72,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
72
72
|
}] });
|
|
73
73
|
|
|
74
74
|
export { AXPBulkArchiveEntityCommand };
|
|
75
|
-
//# sourceMappingURL=acorex-platform-module-common-client-bulk-archive-entity.command-
|
|
75
|
+
//# sourceMappingURL=acorex-platform-module-common-client-bulk-archive-entity.command-CPqLp9Ci.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-CPqLp9Ci.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/bulk-archive-entity.command.ts"],"sourcesContent":["import { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult, type AXPContextData } from '@acorex-platform/framework-shared/core';\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, { processedIds: string[]; failedIds: string[] }>\n{\n private readonly helper = inject(AXPArchiveEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(\n input: AXPContextData,\n ): Promise<AXPExecuteCommandResult<{ processedIds: string[]; failedIds: string[] }>> {\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 loadingDialog = this.helper.showLoading(\n await this.translationService.translateAsync('@general:actions.bulk-archive.confirm.processing'),\n `Archiving ${context.ids.length} items...`,\n );\n\n const processedIds: string[] = [];\n const failedIds: string[] = [];\n const patch = buildArchivePatch(true);\n\n try {\n for (const id of context.ids) {\n try {\n await this.helper.applyPatch(context.refType, id, patch);\n processedIds.push(id);\n } catch (error) {\n console.error(`Failed to archive entity ${id}:`, error);\n failedIds.push(id);\n }\n }\n\n if (processedIds.length > 0) {\n this.helper.dispatchBulkArchived(context.refType, processedIds, {\n failedIds,\n totalProcessed: processedIds.length,\n totalFailed: failedIds.length,\n });\n await this.helper.showSuccessToast(\n '@general:workflow.entity-bulk-archived',\n '@general:workflow.entity-bulk-archived-body',\n );\n }\n\n return {\n success: processedIds.length > 0,\n data: { processedIds, failedIds },\n };\n } catch (error) {\n console.error('Bulk archive operation failed:', error);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Bulk archive operation failed',\n },\n };\n } finally {\n loadingDialog.close();\n }\n }\n}\n"],"names":[],"mappings":";;;;;MASa,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAwEnE,IAAA;IAtEC,MAAM,OAAO,CACX,KAAqB,EAAA;AAErB,QA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orex/core/translation';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, Injectable } from '@angular/core';
|
|
4
|
-
import { A as AXPArchiveEntityCommandHelper, c as normalizeArchiveBulkInput, b as buildArchivePatch } from './acorex-platform-module-common-client-archive-entity.command.util-
|
|
4
|
+
import { A as AXPArchiveEntityCommandHelper, c as normalizeArchiveBulkInput, b as buildArchivePatch } from './acorex-platform-module-common-client-archive-entity.command.util-BZrXDNGP.mjs';
|
|
5
5
|
|
|
6
6
|
class AXPBulkRestoreArchiveEntityCommand {
|
|
7
7
|
constructor() {
|
|
@@ -72,4 +72,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
72
72
|
}] });
|
|
73
73
|
|
|
74
74
|
export { AXPBulkRestoreArchiveEntityCommand };
|
|
75
|
-
//# sourceMappingURL=acorex-platform-module-common-client-bulk-restore-archive-entity.command-
|
|
75
|
+
//# sourceMappingURL=acorex-platform-module-common-client-bulk-restore-archive-entity.command-D2y8h15u.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-D2y8h15u.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/bulk-restore-archive-entity.command.ts"],"sourcesContent":["import { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult, type AXPContextData } from '@acorex-platform/framework-shared/core';\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, { processedIds: string[]; failedIds: string[] }>\n{\n private readonly helper = inject(AXPArchiveEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(\n input: AXPContextData,\n ): Promise<AXPExecuteCommandResult<{ processedIds: string[]; failedIds: string[] }>> {\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 loadingDialog = this.helper.showLoading(\n await this.translationService.translateAsync('@general:actions.bulk-restore-archive.confirm.processing'),\n `Unarchiving ${context.ids.length} items...`,\n );\n\n const processedIds: string[] = [];\n const failedIds: string[] = [];\n const patch = buildArchivePatch(false);\n\n try {\n for (const id of context.ids) {\n try {\n await this.helper.applyPatch(context.refType, id, patch);\n processedIds.push(id);\n } catch (error) {\n console.error(`Failed to unarchive entity ${id}:`, error);\n failedIds.push(id);\n }\n }\n\n if (processedIds.length > 0) {\n this.helper.dispatchBulkUnarchived(context.refType, processedIds, {\n failedIds,\n totalProcessed: processedIds.length,\n totalFailed: failedIds.length,\n });\n await this.helper.showSuccessToast(\n '@general:workflow.entity-bulk-unarchived',\n '@general:workflow.entity-bulk-unarchived-body',\n );\n }\n\n return {\n success: processedIds.length > 0,\n data: { processedIds, failedIds },\n };\n } catch (error) {\n console.error('Bulk unarchive operation failed:', error);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Bulk unarchive operation failed',\n },\n };\n } finally {\n loadingDialog.close();\n }\n }\n}\n"],"names":[],"mappings":";;;;;MASa,kCAAkC,CAAA;AAD/C,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAwEnE,IAAA;IA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 +7,7 @@ import { AXToastService } from '@acorex/components/toast';
|
|
|
7
7
|
import { AXPSettingsService, AXPCommonSettings, AXPRefreshEvent } from '@acorex-platform/framework-client/common';
|
|
8
8
|
import { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';
|
|
9
9
|
import { createWorkFlowEvent, AXPWorkflowEventService } from '@acorex-platform/framework-client/workflow';
|
|
10
|
-
import { t as toVariableName, i as isValidVariableName } from './acorex-platform-module-common-client-acorex-platform-module-common-client-
|
|
10
|
+
import { t as toVariableName, i as isValidVariableName } from './acorex-platform-module-common-client-acorex-platform-module-common-client-rqWzT7RI.mjs';
|
|
11
11
|
|
|
12
12
|
const AXPEntityClonedEvent = createWorkFlowEvent('[Entity] Cloned');
|
|
13
13
|
|
|
@@ -224,4 +224,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
224
224
|
}] });
|
|
225
225
|
|
|
226
226
|
export { AXPCloneEntityCommand };
|
|
227
|
-
//# sourceMappingURL=acorex-platform-module-common-client-clone-entity.command-
|
|
227
|
+
//# sourceMappingURL=acorex-platform-module-common-client-clone-entity.command-DFgIeWxX.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-common-client-clone-entity.command-CyIAr8bc.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/clone-plugin/clone-entity.events.ts","../../../../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 { createWorkFlowEvent } from '@acorex-platform/framework-client/workflow';\n\nexport const AXPEntityClonedEvent = createWorkFlowEvent<{\n entity: string;\n originalId: string;\n newId: string;\n meta?: unknown;\n}>('[Entity] Cloned');\n","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, AXPRefreshEvent, AXPSettingsService } from '@acorex-platform/framework-client/common';\nimport { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPWorkflowEventService } from '@acorex-platform/framework-client/workflow';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPEntityClonedEvent } from '../clone-entity.events';\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 workflowEventService = inject(AXPWorkflowEventService);\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.workflowEventService.dispatch(\n AXPEntityClonedEvent({ entity: refType, originalId, newId, meta }),\n );\n this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta }));\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';\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 ctx = input['__context__'] as AXPContextData | undefined;\n const options = (input['options'] ?? ctx?.['options'] ?? input) as AXPContextData;\n const data = ctx?.['data'] ?? input;\n const rowData = Array.isArray(data)\n ? (data[0] as AXPContextData | undefined)\n : (data as AXPContextData | undefined);\n\n const refType = String(\n options['refType'] ?? ctx?.['entity'] ?? (ctx?.['entityInfo'] as AXPContextData | undefined)?.['source'] ?? '',\n );\n const rawId = options['refId'] ?? rowData?.['id'] ?? rowData?.['_id'] ?? input['refId'];\n\n if (!refType || rawId == null || rawId === '') {\n return null;\n }\n\n return { refId: String(rawId), refType, rowData };\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 } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult, 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): Promise<AXPExecuteCommandResult<{ 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, 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":";;;;;;;;;;;AAEO,MAAM,oBAAoB,GAAG,mBAAmB,CAKpD,iBAAiB,CAAC;;MCOR,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,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,CAAC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,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-DFgIeWxX.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/clone-plugin/clone-entity.events.ts","../../../../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 { createWorkFlowEvent } from '@acorex-platform/framework-client/workflow';\n\nexport const AXPEntityClonedEvent = createWorkFlowEvent<{\n entity: string;\n originalId: string;\n newId: string;\n meta?: unknown;\n}>('[Entity] Cloned');\n","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, AXPRefreshEvent, AXPSettingsService } from '@acorex-platform/framework-client/common';\nimport { AXPEntityDefinitionRegistryService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPWorkflowEventService } from '@acorex-platform/framework-client/workflow';\nimport type { AXPEntity } from '@acorex-platform/framework-shared/entity';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPEntityClonedEvent } from '../clone-entity.events';\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 workflowEventService = inject(AXPWorkflowEventService);\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.workflowEventService.dispatch(\n AXPEntityClonedEvent({ entity: refType, originalId, newId, meta }),\n );\n this.workflowEventService.dispatch(AXPRefreshEvent({ entity: refType, meta }));\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';\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 ctx = input['__context__'] as AXPContextData | undefined;\n const options = (input['options'] ?? ctx?.['options'] ?? input) as AXPContextData;\n const data = ctx?.['data'] ?? input;\n const rowData = Array.isArray(data)\n ? (data[0] as AXPContextData | undefined)\n : (data as AXPContextData | undefined);\n\n const refType = String(\n options['refType'] ?? ctx?.['entity'] ?? (ctx?.['entityInfo'] as AXPContextData | undefined)?.['source'] ?? '',\n );\n const rawId = options['refId'] ?? rowData?.['id'] ?? rowData?.['_id'] ?? input['refId'];\n\n if (!refType || rawId == null || rawId === '') {\n return null;\n }\n\n return { refId: String(rawId), refType, rowData };\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 } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult, 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): Promise<AXPExecuteCommandResult<{ 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, 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":";;;;;;;;;;;AAEO,MAAM,oBAAoB,GAAG,mBAAmB,CAKpD,iBAAiB,CAAC;;MCOR,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,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,CAAC;AA6ExE,IAAA;IA3EC,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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AAE;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-BZrXDNGP.mjs';
|
|
5
5
|
|
|
6
6
|
class AXPRestoreArchiveEntityCommand {
|
|
7
7
|
constructor() {
|
|
@@ -54,4 +54,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
54
54
|
}] });
|
|
55
55
|
|
|
56
56
|
export { AXPRestoreArchiveEntityCommand };
|
|
57
|
-
//# sourceMappingURL=acorex-platform-module-common-client-restore-archive-entity.command-
|
|
57
|
+
//# sourceMappingURL=acorex-platform-module-common-client-restore-archive-entity.command-B0JFf8ms.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-B0JFf8ms.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/restore-archive-entity.command.ts"],"sourcesContent":["import { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult, 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): Promise<AXPExecuteCommandResult<void>> {\n const context = normalizeArchiveSingleInput(input);\n if (!context) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n const confirmed = await this.helper.confirm(\n '@general:actions.restore-archive.confirm.title',\n '@general:actions.restore-archive.confirm.message',\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const loadingDialog = this.helper.showLoading(\n await this.translationService.translateAsync('@general:actions.restore-archive.confirm.processing'),\n 'Unarchiving...',\n );\n\n try {\n const entityDefinition = await this.helper.resolveEntity(context.refType);\n const patch = buildArchivePatch(false);\n await this.helper.applyPatch(context.refType, context.refId, patch);\n\n const meta = buildArchiveRefreshMeta(entityDefinition, context.rowData);\n this.helper.dispatchUnarchived(context.refType, context.refId, meta);\n await this.helper.showSuccessToast('@general:workflow.entity-unarchived', '@general:workflow.entity-unarchived-body');\n\n return { success: true };\n } catch (error) {\n console.error('Unarchive operation failed:', error);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Unarchive operation failed',\n },\n };\n } finally {\n loadingDialog.close();\n }\n }\n}\n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B,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;YACpE,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,qCAAqC,EAAE,0CAA0C,CAAC;AAErH,YAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;QAC1B;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC;YACnD,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;AACP,oBAAA,IAAI,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,4BAA4B;AAC5E,iBAAA;aACF;QACH;gBAAU;YACR,aAAa,CAAC,KAAK,EAAE;QACvB;IACF;8GAjDW,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-rqWzT7RI.mjs';
|
|
26
26
|
|
|
27
27
|
class AXPGlobalSearchPopupComponent extends AXBasePageComponent {
|
|
28
28
|
constructor() {
|
|
@@ -102,7 +102,7 @@ class AXPGlobalSearchPopupComponent extends AXBasePageComponent {
|
|
|
102
102
|
return icon.includes(' ') ? icon : `fa-light ${icon}`;
|
|
103
103
|
}
|
|
104
104
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPGlobalSearchPopupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
105
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPGlobalSearchPopupComponent, isStandalone: true, selector: "ng-component", providers: [AXPGlobalSearchViewModel], viewQueries: [{ propertyName: "list", first: true, predicate: AXListNavigationDirective, descendants: true, isSignal: true }, { propertyName: "searchBox", first: true, predicate: AXSearchBoxComponent, descendants: true, isSignal: true }, { propertyName: "items", predicate: AXListNavigationItemDirective, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<axp-layout-content>\n <axp-layout-header class=\"ax-lg\">\n <axp-layout-prefix class=\"min-w-0 flex-1\">\n <ax-search-box\n class=\"__search-box w-full\"\n [axAutoFocus]\n [axAutoFocusTime]=\"500\"\n [look]=\"'none'\"\n [ngModel]=\"vm.text()\"\n (onValueChanged)=\"handleTextChanged($event)\"\n [placeholder]=\"\n '@global-search:terms.search-anything' | translate | async\n \"\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=\"rounded-lg ax-sm\" (onClick)=\"close()\">\n <ax-icon icon=\"fa-light fa-xmark fa-sm ax-sm\"></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\n [animated]=\"true\"\n class=\"w-4 h-4 rounded-full\"\n ></ax-skeleton>\n <div class=\"flex flex-col gap-2 flex-1\">\n <ax-skeleton\n [animated]=\"true\"\n class=\"w-1/4 h-2 rounded\"\n ></ax-skeleton>\n <ax-skeleton\n [animated]=\"true\"\n class=\"w-1/2 h-2 rounded\"\n ></ax-skeleton>\n </div>\n </div>\n }\n </div>\n </ng-template>\n\n <!-- Empty Template -->\n <ng-template #empty>\n <axp-state-message\n icon=\"fa-light fa-search\"\n [title]=\"\n '@global-search:components.search-box.empty-states.no-result.title'\n \"\n [description]=\"\n '@global-search:components.search-box.empty-states.no-result.description'\n \"\n >\n </axp-state-message>\n </ng-template>\n\n <!-- Welcome Template -->\n <ng-template #welcome>\n <axp-state-message\n icon=\"fa-light fa-search\"\n [title]=\"'@global-search:components.search-box.empty-states.start.title'\"\n [description]=\"\n '@global-search:components.search-box.empty-states.start.description'\n \"\n >\n </axp-state-message>\n </ng-template>\n\n <!-- Start Template -->\n <ng-template #start>\n <!-- Pinned Items -->\n <axp-layout-list\n class=\"p-4 divide-none\"\n (keydown)=\"handleListKeyDown($event)\"\n axListNavigation\n #list=\"axListNavigation\"\n >\n @if (vm.pinnedItems().length > 0) {\n <axp-layout-list-group>\n <axp-layout-title>{{\n '@global-search:terms.pinned' | translate | async\n }}</axp-layout-title>\n @for (item of vm.pinnedItems(); track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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>{{\n '@global-search:terms.recent' | translate | async\n }}</axp-layout-title>\n </axp-layout-prefix>\n <axp-layout-prefix class=\"ax-sm\">\n <ax-button\n [text]=\"'@global-search:terms.clear' | translate | async\"\n look=\"blank\"\n [color]=\"'default'\"\n (onClick)=\"handleClearClick($event)\"\n ></ax-button>\n </axp-layout-prefix>\n </axp-layout-header>\n @for (item of vm.recentItems(); track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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\n class=\"p-4 divide-none\"\n (keydown)=\"handleListKeyDown($event)\"\n axListNavigation\n #list=\"axListNavigation\"\n >\n @for (group of vm.results(); track $index) {\n <axp-layout-list-group>\n <axp-layout-title>{{\n group.title | translate | async\n }}</axp-layout-title>\n @for (item of group.children; track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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\n [class.invisible]=\"!vm.isPinned(item)\"\n class=\"fa-light fa-thumbtack rotate-45 group-hover:!visible\"\n [class.fa-solid]=\"vm.isPinned(item)\"\n ></i>\n </span>\n </axp-layout-title>\n @if (item.parent) {\n <axp-layout-description>\n {{ item.parent.title | translate | async }}\n </axp-layout-description>\n } @else if (item.description) {\n <axp-layout-description>\n {{ item.description | translate | async }}\n </axp-layout-description>\n }\n </axp-layout-content>\n <axp-layout-suffix>\n <i class=\"far fa-chevron-right rtl:rotate-180\"></i>\n </axp-layout-suffix>\n </ng-template>\n</axp-layout-content>\n", styles: ["@layer properties;:host .editor-container:focus-within{outline-style:none}:host>axp-layout-content{display:flex;flex-direction:column;background-color:var(--color-lightest);color:var(--color-on-lightest);border-color:var(--color-border-lightest);width:90vw;max-width:var(--container-xl, 36rem)}@media(width>=40rem){:host>axp-layout-content{width:80vw}}@media(width>=48rem){:host>axp-layout-content{width:60vw}}@media(width>=64rem){:host>axp-layout-content{width:40vw}}@media(width>=80rem){:host>axp-layout-content{width:30vw}}:host>axp-layout-content>axp-layout-header{flex-wrap:nowrap;align-items:center;gap:calc(var(--spacing, .25rem) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;background-color:var(--color-lighter);color:var(--color-on-lighter);border-color:var(--color-border-lighter)}:host>axp-layout-content>axp-layout-header>axp-layout-prefix{display:flex;min-width:0;flex:1;align-items:center}:host>axp-layout-content>axp-layout-header>.__close-button{margin-inline-end:calc(var(--spacing, .25rem) * 4);flex-shrink:0}:host>axp-layout-content>axp-layout-header .__search-box{width:100%;align-items:center;padding-inline-end:0!important}:host>axp-layout-content>axp-layout-header .__search-box .__clear-button{color:var(--color-neutral-400, oklch(70.8% 0 0))}:host>axp-layout-content>axp-layout-body{display:flex;flex-direction:column;overflow-y:auto;border-radius:var(--radius-md, .375rem);max-height:50vh;min-height:30vh}:where(:host>axp-layout-content axp-layout-body>:not(:last-child)){--tw-divide-y-reverse: 0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{max-height:60vh}}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{max-height:70vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{min-height:50vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{max-height:80vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}:host>axp-layout-content>axp-layout-body .axp-search-recent{display:flex;flex-direction:column;padding:calc(var(--spacing, .25rem) * 4)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-header{margin-bottom:calc(var(--spacing, .25rem) * 2);display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-font-weight: var(--font-weight-semibold, 600);font-weight:var(--font-weight-semibold, 600)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-body{display:flex;flex-direction:row;flex-wrap:wrap;gap:calc(var(--spacing, .25rem) * 2);border-radius:var(--radius-md, .375rem)}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon{display:flex;height:calc(var(--spacing, .25rem) * 9);width:calc(var(--spacing, .25rem) * 9);align-items:center;justify-content:center;border-radius:var(--radius-md, .375rem);background-color:var(--color-dark);color:var(--color-on-dark);border-color:var(--color-border-dark);font-size:1rem}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon:where(.ax-dark,.ax-dark *):not(:where(.ax-light,.ax-light *)){background-color:var(--color-darker);color:var(--color-on-darker);border-color:var(--color-border-darker)}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-divide-y-reverse{syntax: \"*\"; inherits: false; initial-value: 0;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-divide-y-reverse: 0;--tw-font-weight: initial}}}\n/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type:
|
|
105
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPGlobalSearchPopupComponent, isStandalone: true, selector: "ng-component", providers: [AXPGlobalSearchViewModel], viewQueries: [{ propertyName: "list", first: true, predicate: AXListNavigationDirective, descendants: true, isSignal: true }, { propertyName: "searchBox", first: true, predicate: AXSearchBoxComponent, descendants: true, isSignal: true }, { propertyName: "items", predicate: AXListNavigationItemDirective, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<axp-layout-content>\n <axp-layout-header class=\"ax-lg\">\n <axp-layout-prefix class=\"min-w-0 flex-1\">\n <ax-search-box\n class=\"__search-box w-full\"\n [axAutoFocus]\n [axAutoFocusTime]=\"500\"\n [look]=\"'none'\"\n [ngModel]=\"vm.text()\"\n (onValueChanged)=\"handleTextChanged($event)\"\n [placeholder]=\"\n '@global-search:terms.search-anything' | translate | async\n \"\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=\"rounded-lg ax-sm\" (onClick)=\"close()\">\n <ax-icon icon=\"fa-light fa-xmark fa-sm ax-sm\"></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\n [animated]=\"true\"\n class=\"w-4 h-4 rounded-full\"\n ></ax-skeleton>\n <div class=\"flex flex-col gap-2 flex-1\">\n <ax-skeleton\n [animated]=\"true\"\n class=\"w-1/4 h-2 rounded\"\n ></ax-skeleton>\n <ax-skeleton\n [animated]=\"true\"\n class=\"w-1/2 h-2 rounded\"\n ></ax-skeleton>\n </div>\n </div>\n }\n </div>\n </ng-template>\n\n <!-- Empty Template -->\n <ng-template #empty>\n <axp-state-message\n icon=\"fa-light fa-search\"\n [title]=\"\n '@global-search:components.search-box.empty-states.no-result.title'\n \"\n [description]=\"\n '@global-search:components.search-box.empty-states.no-result.description'\n \"\n >\n </axp-state-message>\n </ng-template>\n\n <!-- Welcome Template -->\n <ng-template #welcome>\n <axp-state-message\n icon=\"fa-light fa-search\"\n [title]=\"'@global-search:components.search-box.empty-states.start.title'\"\n [description]=\"\n '@global-search:components.search-box.empty-states.start.description'\n \"\n >\n </axp-state-message>\n </ng-template>\n\n <!-- Start Template -->\n <ng-template #start>\n <!-- Pinned Items -->\n <axp-layout-list\n class=\"p-4 divide-none\"\n (keydown)=\"handleListKeyDown($event)\"\n axListNavigation\n #list=\"axListNavigation\"\n >\n @if (vm.pinnedItems().length > 0) {\n <axp-layout-list-group>\n <axp-layout-title>{{\n '@global-search:terms.pinned' | translate | async\n }}</axp-layout-title>\n @for (item of vm.pinnedItems(); track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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>{{\n '@global-search:terms.recent' | translate | async\n }}</axp-layout-title>\n </axp-layout-prefix>\n <axp-layout-prefix class=\"ax-sm\">\n <ax-button\n [text]=\"'@global-search:terms.clear' | translate | async\"\n look=\"blank\"\n [color]=\"'default'\"\n (onClick)=\"handleClearClick($event)\"\n ></ax-button>\n </axp-layout-prefix>\n </axp-layout-header>\n @for (item of vm.recentItems(); track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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\n class=\"p-4 divide-none\"\n (keydown)=\"handleListKeyDown($event)\"\n axListNavigation\n #list=\"axListNavigation\"\n >\n @for (group of vm.results(); track $index) {\n <axp-layout-list-group>\n <axp-layout-title>{{\n group.title | translate | async\n }}</axp-layout-title>\n @for (item of group.children; track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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\n [class.invisible]=\"!vm.isPinned(item)\"\n class=\"fa-light fa-thumbtack rotate-45 group-hover:!visible\"\n [class.fa-solid]=\"vm.isPinned(item)\"\n ></i>\n </span>\n </axp-layout-title>\n @if (item.parent) {\n <axp-layout-description>\n {{ item.parent.title | translate | async }}\n </axp-layout-description>\n } @else if (item.description) {\n <axp-layout-description>\n {{ item.description | translate | async }}\n </axp-layout-description>\n }\n </axp-layout-content>\n <axp-layout-suffix>\n <i class=\"far fa-chevron-right rtl:rotate-180\"></i>\n </axp-layout-suffix>\n </ng-template>\n</axp-layout-content>\n", styles: ["@layer properties;:host .editor-container:focus-within{outline-style:none}:host>axp-layout-content{display:flex;width:90vw;max-width:var(--container-xl, 36rem);flex-direction:column;background-color:var(--color-lightest);color:var(--color-on-lightest);border-color:var(--color-border-lightest)}@media(width>=40rem){:host>axp-layout-content{width:80vw}}@media(width>=48rem){:host>axp-layout-content{width:60vw}}@media(width>=64rem){:host>axp-layout-content{width:40vw}}@media(width>=80rem){:host>axp-layout-content{width:30vw}}:host>axp-layout-content>axp-layout-header{flex-wrap:nowrap;align-items:center;gap:calc(var(--spacing, .25rem) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;background-color:var(--color-lighter);color:var(--color-on-lighter);border-color:var(--color-border-lighter)}:host>axp-layout-content>axp-layout-header>axp-layout-prefix{display:flex;min-width:0;flex:1;align-items:center}:host>axp-layout-content>axp-layout-header>.__close-button{margin-inline-end:calc(var(--spacing, .25rem) * 4);flex-shrink:0}:host>axp-layout-content>axp-layout-header .__search-box{width:100%;align-items:center;padding-inline-end:0!important}:host>axp-layout-content>axp-layout-header .__search-box .__clear-button{color:var(--color-neutral-400, oklch(70.8% 0 0))}:host>axp-layout-content>axp-layout-body{display:flex;max-height:50vh;min-height:30vh;flex-direction:column;overflow-y:auto;border-radius:var(--radius-md, .375rem)}:where(:host>axp-layout-content axp-layout-body>:not(:last-child)){--tw-divide-y-reverse: 0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{max-height:60vh}}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{max-height:70vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{min-height:50vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{max-height:80vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}:host>axp-layout-content>axp-layout-body .axp-search-recent{display:flex;flex-direction:column;padding:calc(var(--spacing, .25rem) * 4)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-header{margin-bottom:calc(var(--spacing, .25rem) * 2);display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-font-weight: var(--font-weight-semibold, 600);font-weight:var(--font-weight-semibold, 600)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-body{display:flex;flex-direction:row;flex-wrap:wrap;gap:calc(var(--spacing, .25rem) * 2);border-radius:var(--radius-md, .375rem)}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon{display:flex;height:calc(var(--spacing, .25rem) * 9);width:calc(var(--spacing, .25rem) * 9);align-items:center;justify-content:center;border-radius:var(--radius-md, .375rem);background-color:var(--color-dark);color:var(--color-on-dark);border-color:var(--color-border-dark);font-size:1rem}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon:where(.ax-dark,.ax-dark *):not(:where(.ax-light,.ax-light *)){background-color:var(--color-darker);color:var(--color-on-darker);border-color:var(--color-border-darker)}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-divide-y-reverse{syntax: \"*\"; inherits: false; initial-value: 0;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-divide-y-reverse: 0;--tw-font-weight: initial}}}\n/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type:
|
|
106
106
|
//
|
|
107
107
|
AXSearchBoxModule }, { kind: "component", type: i3.AXSearchBoxComponent, selector: "ax-search-box", inputs: ["disabled", "readonly", "tabIndex", "placeholder", "value", "state", "name", "id", "look", "class", "delayTime", "type", "autoSearch"], outputs: ["valueChange", "stateChange", "onValueChanged", "onBlur", "onFocus", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress"] }, { kind: "ngmodule", type: AXCommonModule }, { kind: "directive", type: i4.AXAutoFocusDirective, selector: "[axAutoFocus]", inputs: ["axAutoFocus", "axAutoFocusTime"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1$1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i1$1.AXDecoratorClearButtonComponent, selector: "ax-clear-button", inputs: ["icon"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "ngmodule", type: AXListNavigationModule }, { kind: "directive", type: i6.AXListNavigationDirective, selector: "[axListNavigation]", inputs: ["orientation"], outputs: ["onNavigationChanged", "onKeypress"], exportAs: ["axListNavigation"] }, { kind: "directive", type: i6.AXListNavigationItemDirective, selector: "[axListNavigationItem]", outputs: ["onKeypress"], exportAs: ["axListNavigationItem"] }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type:
|
|
108
108
|
//
|
|
@@ -129,8 +129,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
129
129
|
AXPThemeLayoutListItemsGroupComponent,
|
|
130
130
|
AXPThemeLayoutHeaderComponent,
|
|
131
131
|
AXPStateMessageComponent,
|
|
132
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, providers: [AXPGlobalSearchViewModel], template: "<axp-layout-content>\n <axp-layout-header class=\"ax-lg\">\n <axp-layout-prefix class=\"min-w-0 flex-1\">\n <ax-search-box\n class=\"__search-box w-full\"\n [axAutoFocus]\n [axAutoFocusTime]=\"500\"\n [look]=\"'none'\"\n [ngModel]=\"vm.text()\"\n (onValueChanged)=\"handleTextChanged($event)\"\n [placeholder]=\"\n '@global-search:terms.search-anything' | translate | async\n \"\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=\"rounded-lg ax-sm\" (onClick)=\"close()\">\n <ax-icon icon=\"fa-light fa-xmark fa-sm ax-sm\"></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\n [animated]=\"true\"\n class=\"w-4 h-4 rounded-full\"\n ></ax-skeleton>\n <div class=\"flex flex-col gap-2 flex-1\">\n <ax-skeleton\n [animated]=\"true\"\n class=\"w-1/4 h-2 rounded\"\n ></ax-skeleton>\n <ax-skeleton\n [animated]=\"true\"\n class=\"w-1/2 h-2 rounded\"\n ></ax-skeleton>\n </div>\n </div>\n }\n </div>\n </ng-template>\n\n <!-- Empty Template -->\n <ng-template #empty>\n <axp-state-message\n icon=\"fa-light fa-search\"\n [title]=\"\n '@global-search:components.search-box.empty-states.no-result.title'\n \"\n [description]=\"\n '@global-search:components.search-box.empty-states.no-result.description'\n \"\n >\n </axp-state-message>\n </ng-template>\n\n <!-- Welcome Template -->\n <ng-template #welcome>\n <axp-state-message\n icon=\"fa-light fa-search\"\n [title]=\"'@global-search:components.search-box.empty-states.start.title'\"\n [description]=\"\n '@global-search:components.search-box.empty-states.start.description'\n \"\n >\n </axp-state-message>\n </ng-template>\n\n <!-- Start Template -->\n <ng-template #start>\n <!-- Pinned Items -->\n <axp-layout-list\n class=\"p-4 divide-none\"\n (keydown)=\"handleListKeyDown($event)\"\n axListNavigation\n #list=\"axListNavigation\"\n >\n @if (vm.pinnedItems().length > 0) {\n <axp-layout-list-group>\n <axp-layout-title>{{\n '@global-search:terms.pinned' | translate | async\n }}</axp-layout-title>\n @for (item of vm.pinnedItems(); track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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>{{\n '@global-search:terms.recent' | translate | async\n }}</axp-layout-title>\n </axp-layout-prefix>\n <axp-layout-prefix class=\"ax-sm\">\n <ax-button\n [text]=\"'@global-search:terms.clear' | translate | async\"\n look=\"blank\"\n [color]=\"'default'\"\n (onClick)=\"handleClearClick($event)\"\n ></ax-button>\n </axp-layout-prefix>\n </axp-layout-header>\n @for (item of vm.recentItems(); track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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\n class=\"p-4 divide-none\"\n (keydown)=\"handleListKeyDown($event)\"\n axListNavigation\n #list=\"axListNavigation\"\n >\n @for (group of vm.results(); track $index) {\n <axp-layout-list-group>\n <axp-layout-title>{{\n group.title | translate | async\n }}</axp-layout-title>\n @for (item of group.children; track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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\n [class.invisible]=\"!vm.isPinned(item)\"\n class=\"fa-light fa-thumbtack rotate-45 group-hover:!visible\"\n [class.fa-solid]=\"vm.isPinned(item)\"\n ></i>\n </span>\n </axp-layout-title>\n @if (item.parent) {\n <axp-layout-description>\n {{ item.parent.title | translate | async }}\n </axp-layout-description>\n } @else if (item.description) {\n <axp-layout-description>\n {{ item.description | translate | async }}\n </axp-layout-description>\n }\n </axp-layout-content>\n <axp-layout-suffix>\n <i class=\"far fa-chevron-right rtl:rotate-180\"></i>\n </axp-layout-suffix>\n </ng-template>\n</axp-layout-content>\n", styles: ["@layer properties;:host .editor-container:focus-within{outline-style:none}:host>axp-layout-content{display:flex;flex-direction:column;background-color:var(--color-lightest);color:var(--color-on-lightest);border-color:var(--color-border-lightest);width:90vw;max-width:var(--container-xl, 36rem)}@media(width>=40rem){:host>axp-layout-content{width:80vw}}@media(width>=48rem){:host>axp-layout-content{width:60vw}}@media(width>=64rem){:host>axp-layout-content{width:40vw}}@media(width>=80rem){:host>axp-layout-content{width:30vw}}:host>axp-layout-content>axp-layout-header{flex-wrap:nowrap;align-items:center;gap:calc(var(--spacing, .25rem) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;background-color:var(--color-lighter);color:var(--color-on-lighter);border-color:var(--color-border-lighter)}:host>axp-layout-content>axp-layout-header>axp-layout-prefix{display:flex;min-width:0;flex:1;align-items:center}:host>axp-layout-content>axp-layout-header>.__close-button{margin-inline-end:calc(var(--spacing, .25rem) * 4);flex-shrink:0}:host>axp-layout-content>axp-layout-header .__search-box{width:100%;align-items:center;padding-inline-end:0!important}:host>axp-layout-content>axp-layout-header .__search-box .__clear-button{color:var(--color-neutral-400, oklch(70.8% 0 0))}:host>axp-layout-content>axp-layout-body{display:flex;flex-direction:column;overflow-y:auto;border-radius:var(--radius-md, .375rem);max-height:50vh;min-height:30vh}:where(:host>axp-layout-content axp-layout-body>:not(:last-child)){--tw-divide-y-reverse: 0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{max-height:60vh}}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{max-height:70vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{min-height:50vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{max-height:80vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}:host>axp-layout-content>axp-layout-body .axp-search-recent{display:flex;flex-direction:column;padding:calc(var(--spacing, .25rem) * 4)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-header{margin-bottom:calc(var(--spacing, .25rem) * 2);display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-font-weight: var(--font-weight-semibold, 600);font-weight:var(--font-weight-semibold, 600)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-body{display:flex;flex-direction:row;flex-wrap:wrap;gap:calc(var(--spacing, .25rem) * 2);border-radius:var(--radius-md, .375rem)}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon{display:flex;height:calc(var(--spacing, .25rem) * 9);width:calc(var(--spacing, .25rem) * 9);align-items:center;justify-content:center;border-radius:var(--radius-md, .375rem);background-color:var(--color-dark);color:var(--color-on-dark);border-color:var(--color-border-dark);font-size:1rem}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon:where(.ax-dark,.ax-dark *):not(:where(.ax-light,.ax-light *)){background-color:var(--color-darker);color:var(--color-on-darker);border-color:var(--color-border-darker)}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-divide-y-reverse{syntax: \"*\"; inherits: false; initial-value: 0;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-divide-y-reverse: 0;--tw-font-weight: initial}}}\n/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */\n"] }]
|
|
132
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, providers: [AXPGlobalSearchViewModel], template: "<axp-layout-content>\n <axp-layout-header class=\"ax-lg\">\n <axp-layout-prefix class=\"min-w-0 flex-1\">\n <ax-search-box\n class=\"__search-box w-full\"\n [axAutoFocus]\n [axAutoFocusTime]=\"500\"\n [look]=\"'none'\"\n [ngModel]=\"vm.text()\"\n (onValueChanged)=\"handleTextChanged($event)\"\n [placeholder]=\"\n '@global-search:terms.search-anything' | translate | async\n \"\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=\"rounded-lg ax-sm\" (onClick)=\"close()\">\n <ax-icon icon=\"fa-light fa-xmark fa-sm ax-sm\"></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\n [animated]=\"true\"\n class=\"w-4 h-4 rounded-full\"\n ></ax-skeleton>\n <div class=\"flex flex-col gap-2 flex-1\">\n <ax-skeleton\n [animated]=\"true\"\n class=\"w-1/4 h-2 rounded\"\n ></ax-skeleton>\n <ax-skeleton\n [animated]=\"true\"\n class=\"w-1/2 h-2 rounded\"\n ></ax-skeleton>\n </div>\n </div>\n }\n </div>\n </ng-template>\n\n <!-- Empty Template -->\n <ng-template #empty>\n <axp-state-message\n icon=\"fa-light fa-search\"\n [title]=\"\n '@global-search:components.search-box.empty-states.no-result.title'\n \"\n [description]=\"\n '@global-search:components.search-box.empty-states.no-result.description'\n \"\n >\n </axp-state-message>\n </ng-template>\n\n <!-- Welcome Template -->\n <ng-template #welcome>\n <axp-state-message\n icon=\"fa-light fa-search\"\n [title]=\"'@global-search:components.search-box.empty-states.start.title'\"\n [description]=\"\n '@global-search:components.search-box.empty-states.start.description'\n \"\n >\n </axp-state-message>\n </ng-template>\n\n <!-- Start Template -->\n <ng-template #start>\n <!-- Pinned Items -->\n <axp-layout-list\n class=\"p-4 divide-none\"\n (keydown)=\"handleListKeyDown($event)\"\n axListNavigation\n #list=\"axListNavigation\"\n >\n @if (vm.pinnedItems().length > 0) {\n <axp-layout-list-group>\n <axp-layout-title>{{\n '@global-search:terms.pinned' | translate | async\n }}</axp-layout-title>\n @for (item of vm.pinnedItems(); track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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>{{\n '@global-search:terms.recent' | translate | async\n }}</axp-layout-title>\n </axp-layout-prefix>\n <axp-layout-prefix class=\"ax-sm\">\n <ax-button\n [text]=\"'@global-search:terms.clear' | translate | async\"\n look=\"blank\"\n [color]=\"'default'\"\n (onClick)=\"handleClearClick($event)\"\n ></ax-button>\n </axp-layout-prefix>\n </axp-layout-header>\n @for (item of vm.recentItems(); track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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\n class=\"p-4 divide-none\"\n (keydown)=\"handleListKeyDown($event)\"\n axListNavigation\n #list=\"axListNavigation\"\n >\n @for (group of vm.results(); track $index) {\n <axp-layout-list-group>\n <axp-layout-title>{{\n group.title | translate | async\n }}</axp-layout-title>\n @for (item of group.children; track $index) {\n <axp-layout-list-item\n (click)=\"vm.execute(item)\"\n (keydown)=\"handleItemKeyDown($event, item)\"\n class=\"group\"\n axListNavigationItem\n #i=\"axListNavigationItem\"\n [class.axp-state-focused]=\"i.isActive()\"\n >\n <ng-container\n [ngTemplateOutlet]=\"listItem\"\n [ngTemplateOutletContext]=\"{ item }\"\n ></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\n [class.invisible]=\"!vm.isPinned(item)\"\n class=\"fa-light fa-thumbtack rotate-45 group-hover:!visible\"\n [class.fa-solid]=\"vm.isPinned(item)\"\n ></i>\n </span>\n </axp-layout-title>\n @if (item.parent) {\n <axp-layout-description>\n {{ item.parent.title | translate | async }}\n </axp-layout-description>\n } @else if (item.description) {\n <axp-layout-description>\n {{ item.description | translate | async }}\n </axp-layout-description>\n }\n </axp-layout-content>\n <axp-layout-suffix>\n <i class=\"far fa-chevron-right rtl:rotate-180\"></i>\n </axp-layout-suffix>\n </ng-template>\n</axp-layout-content>\n", styles: ["@layer properties;:host .editor-container:focus-within{outline-style:none}:host>axp-layout-content{display:flex;width:90vw;max-width:var(--container-xl, 36rem);flex-direction:column;background-color:var(--color-lightest);color:var(--color-on-lightest);border-color:var(--color-border-lightest)}@media(width>=40rem){:host>axp-layout-content{width:80vw}}@media(width>=48rem){:host>axp-layout-content{width:60vw}}@media(width>=64rem){:host>axp-layout-content{width:40vw}}@media(width>=80rem){:host>axp-layout-content{width:30vw}}:host>axp-layout-content>axp-layout-header{flex-wrap:nowrap;align-items:center;gap:calc(var(--spacing, .25rem) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;background-color:var(--color-lighter);color:var(--color-on-lighter);border-color:var(--color-border-lighter)}:host>axp-layout-content>axp-layout-header>axp-layout-prefix{display:flex;min-width:0;flex:1;align-items:center}:host>axp-layout-content>axp-layout-header>.__close-button{margin-inline-end:calc(var(--spacing, .25rem) * 4);flex-shrink:0}:host>axp-layout-content>axp-layout-header .__search-box{width:100%;align-items:center;padding-inline-end:0!important}:host>axp-layout-content>axp-layout-header .__search-box .__clear-button{color:var(--color-neutral-400, oklch(70.8% 0 0))}:host>axp-layout-content>axp-layout-body{display:flex;max-height:50vh;min-height:30vh;flex-direction:column;overflow-y:auto;border-radius:var(--radius-md, .375rem)}:where(:host>axp-layout-content axp-layout-body>:not(:last-child)){--tw-divide-y-reverse: 0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{max-height:60vh}}@media(width>=40rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{max-height:70vh}}@media(width>=48rem){:host>axp-layout-content>axp-layout-body{min-height:50vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{max-height:80vh}}@media(width>=64rem){:host>axp-layout-content>axp-layout-body{min-height:40vh}}:host>axp-layout-content>axp-layout-body .axp-search-recent{display:flex;flex-direction:column;padding:calc(var(--spacing, .25rem) * 4)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-header{margin-bottom:calc(var(--spacing, .25rem) * 2);display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));--tw-font-weight: var(--font-weight-semibold, 600);font-weight:var(--font-weight-semibold, 600)}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-body{display:flex;flex-direction:row;flex-wrap:wrap;gap:calc(var(--spacing, .25rem) * 2);border-radius:var(--radius-md, .375rem)}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon{display:flex;height:calc(var(--spacing, .25rem) * 9);width:calc(var(--spacing, .25rem) * 9);align-items:center;justify-content:center;border-radius:var(--radius-md, .375rem);background-color:var(--color-dark);color:var(--color-on-dark);border-color:var(--color-border-dark);font-size:1rem}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon:where(.ax-dark,.ax-dark *):not(:where(.ax-light,.ax-light *)){background-color:var(--color-darker);color:var(--color-on-darker);border-color:var(--color-border-darker)}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-divide-y-reverse{syntax: \"*\"; inherits: false; initial-value: 0;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-divide-y-reverse: 0;--tw-font-weight: initial}}}\n/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */\n"] }]
|
|
133
133
|
}], 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 }] }] } });
|
|
134
134
|
|
|
135
135
|
export { AXPGlobalSearchPopupComponent };
|
|
136
|
-
//# sourceMappingURL=acorex-platform-module-common-client-search-popup.component-
|
|
136
|
+
//# sourceMappingURL=acorex-platform-module-common-client-search-popup.component-BjGrZHnB.mjs.map
|