@acorex-platform/module-assessment-management-client 0.0.37 → 0.0.46

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.
Files changed (76) hide show
  1. package/fesm2022/{acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-BcpbQ8TJ.mjs → acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-rrUYWHvI.mjs} +787 -91
  2. package/fesm2022/acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-rrUYWHvI.mjs.map +1 -0
  3. package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-DEcHphg8.mjs → acorex-platform-module-assessment-management-client-assessment-voice.commands-BjWPb92M.mjs} +2 -2
  4. package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-DEcHphg8.mjs.map → acorex-platform-module-assessment-management-client-assessment-voice.commands-BjWPb92M.mjs.map} +1 -1
  5. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-assessment-case.mjs +20 -0
  6. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-assessment-case.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-assessment-session.mjs +20 -0
  8. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-assessment-session.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-question-bank-item.mjs +20 -0
  10. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-question-bank-item.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-questionnaire.mjs +243 -212
  12. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-questionnaire.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-template.mjs +774 -0
  14. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-template.mjs.map +1 -0
  15. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-B8PJe3IJ.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-Pa8mdKRV.mjs} +12 -5
  16. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-Pa8mdKRV.mjs.map +1 -0
  17. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-DcRzvfKO.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-DJeaqilT.mjs} +16 -2
  18. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-DJeaqilT.mjs.map +1 -0
  19. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-pre-post.properties-DX_nB0QM.mjs +229 -0
  20. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-pre-post.properties-DX_nB0QM.mjs.map +1 -0
  21. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-Y0FU8X-e.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-BSP4UQ47.mjs} +16 -2
  22. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-BSP4UQ47.mjs.map +1 -0
  23. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-CT913OrX.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-CVgepxbX.mjs} +16 -2
  24. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-CVgepxbX.mjs.map +1 -0
  25. package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-C4hxiPTX.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-8Dqdbm6i.mjs} +18 -217
  26. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-8Dqdbm6i.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-BTDJAnF1.mjs +493 -0
  28. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-BTDJAnF1.mjs.map +1 -0
  29. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog.mjs +1 -1
  30. package/fesm2022/acorex-platform-module-assessment-management-client-contracts.mjs +105 -13
  31. package/fesm2022/acorex-platform-module-assessment-management-client-contracts.mjs.map +1 -1
  32. package/fesm2022/acorex-platform-module-assessment-management-client-create-form-template.command-DLC7aazI.mjs +44 -0
  33. package/fesm2022/acorex-platform-module-assessment-management-client-create-form-template.command-DLC7aazI.mjs.map +1 -0
  34. package/fesm2022/acorex-platform-module-assessment-management-client-design-form-template.command-Cgc9Inlz.mjs +97 -0
  35. package/fesm2022/acorex-platform-module-assessment-management-client-design-form-template.command-Cgc9Inlz.mjs.map +1 -0
  36. package/fesm2022/acorex-platform-module-assessment-management-client-designer.page-COXTLIgc.mjs +45 -0
  37. package/fesm2022/acorex-platform-module-assessment-management-client-designer.page-COXTLIgc.mjs.map +1 -0
  38. package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-lHYKxCXo.mjs → acorex-platform-module-assessment-management-client-fill-assessment-session.command-DNDkEL7L.mjs} +2 -2
  39. package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-lHYKxCXo.mjs.map → acorex-platform-module-assessment-management-client-fill-assessment-session.command-DNDkEL7L.mjs.map} +1 -1
  40. package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-Cuq6_FfC.mjs +238 -0
  41. package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-Cuq6_FfC.mjs.map +1 -0
  42. package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer.service-BTmeEOAJ.mjs +93 -0
  43. package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer.service-BTmeEOAJ.mjs.map +1 -0
  44. package/fesm2022/acorex-platform-module-assessment-management-client-local-entities.mjs +1 -0
  45. package/fesm2022/acorex-platform-module-assessment-management-client-local-entities.mjs.map +1 -1
  46. package/fesm2022/acorex-platform-module-assessment-management-client-open-form-template.command-Cg2Cnp1-.mjs +55 -0
  47. package/fesm2022/acorex-platform-module-assessment-management-client-open-form-template.command-Cg2Cnp1-.mjs.map +1 -0
  48. package/fesm2022/acorex-platform-module-assessment-management-client-preview-form-template.command-CaCFGmlA.mjs +90 -0
  49. package/fesm2022/acorex-platform-module-assessment-management-client-preview-form-template.command-CaCFGmlA.mjs.map +1 -0
  50. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-Db64SCn6.mjs → acorex-platform-module-assessment-management-client-preview-question.command-DIRJDBFM.mjs} +2 -2
  51. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-Db64SCn6.mjs.map → acorex-platform-module-assessment-management-client-preview-question.command-DIRJDBFM.mjs.map} +1 -1
  52. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-yOfBbOMK.mjs → acorex-platform-module-assessment-management-client-preview-questionnaire.command-fcYcY10l.mjs} +2 -2
  53. package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-yOfBbOMK.mjs.map → acorex-platform-module-assessment-management-client-preview-questionnaire.command-fcYcY10l.mjs.map} +1 -1
  54. package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B9iRaSSF.mjs → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-DVQZ1A-Q.mjs} +2 -2
  55. package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B9iRaSSF.mjs.map → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-DVQZ1A-Q.mjs.map} +1 -1
  56. package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-B4JMc6ew.mjs → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-BAA879UA.mjs} +2 -2
  57. package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-B4JMc6ew.mjs.map → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-BAA879UA.mjs.map} +1 -1
  58. package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-si6-7hpg.mjs → acorex-platform-module-assessment-management-client-review-assessment-session.command-Dm3i0_Oj.mjs} +2 -2
  59. package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-si6-7hpg.mjs.map → acorex-platform-module-assessment-management-client-review-assessment-session.command-Dm3i0_Oj.mjs.map} +1 -1
  60. package/fesm2022/acorex-platform-module-assessment-management-client-template-picker.component-RFv42PnE.mjs +260 -0
  61. package/fesm2022/acorex-platform-module-assessment-management-client-template-picker.component-RFv42PnE.mjs.map +1 -0
  62. package/fesm2022/acorex-platform-module-assessment-management-client-template-widget-edit.component-DpndNC_y.mjs +107 -0
  63. package/fesm2022/acorex-platform-module-assessment-management-client-template-widget-edit.component-DpndNC_y.mjs.map +1 -0
  64. package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-BUMtj_L6.mjs → acorex-platform-module-assessment-management-client-view-session-answers.command-4Y3C8W4k.mjs} +2 -2
  65. package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-BUMtj_L6.mjs.map → acorex-platform-module-assessment-management-client-view-session-answers.command-4Y3C8W4k.mjs.map} +1 -1
  66. package/fesm2022/acorex-platform-module-assessment-management-client.mjs +1 -1
  67. package/package.json +7 -3
  68. package/types/acorex-platform-module-assessment-management-client-contracts-entities-template.d.ts +5 -0
  69. package/types/acorex-platform-module-assessment-management-client-contracts.d.ts +139 -13
  70. package/types/acorex-platform-module-assessment-management-client.d.ts +3 -2
  71. package/fesm2022/acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-BcpbQ8TJ.mjs.map +0 -1
  72. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-B8PJe3IJ.mjs.map +0 -1
  73. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-DcRzvfKO.mjs.map +0 -1
  74. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-Y0FU8X-e.mjs.map +0 -1
  75. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-CT913OrX.mjs.map +0 -1
  76. package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-C4hxiPTX.mjs.map +0 -1
@@ -0,0 +1,44 @@
1
+ import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
2
+ import { resolveEntityActionCommandInput } from '@acorex-platform/framework-shared/runtime';
3
+ import { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';
4
+ import * as i0 from '@angular/core';
5
+ import { inject, Injectable } from '@angular/core';
6
+
7
+ //#endregion
8
+ //#region ---- Create form template command ----
9
+ class AXMCreateFormTemplateCommand {
10
+ constructor() {
11
+ this.commandService = inject(AXPCommandService);
12
+ }
13
+ async execute(input = {}) {
14
+ const entityKey = `${RootConfig.module.name}.${RootConfig.entities.template.name}`;
15
+ const context = resolveEntityActionCommandInput(input);
16
+ const result = await this.commandService.execute('Entity:Create', {
17
+ entity: entityKey,
18
+ entityInfo: {
19
+ name: RootConfig.entities.template.name,
20
+ module: RootConfig.module.name,
21
+ title: RootConfig.entities.template.title,
22
+ source: entityKey,
23
+ },
24
+ data: context.data ?? {},
25
+ options: {
26
+ process: {
27
+ redirect: false,
28
+ },
29
+ ...(context.options ?? {}),
30
+ },
31
+ metadata: context.metadata,
32
+ });
33
+ return result ?? { success: false };
34
+ }
35
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMCreateFormTemplateCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
36
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMCreateFormTemplateCommand, providedIn: 'root' }); }
37
+ }
38
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMCreateFormTemplateCommand, decorators: [{
39
+ type: Injectable,
40
+ args: [{ providedIn: 'root' }]
41
+ }] });
42
+
43
+ export { AXMCreateFormTemplateCommand };
44
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-create-form-template.command-DLC7aazI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-create-form-template.command-DLC7aazI.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/commands/create-form-template.command.ts"],"sourcesContent":["import { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport {\n AXPCommand,\n resolveEntityActionCommandInput,\n type AXPCommandExecuteResultPromise,\n type AXPEntityActionCommandInput,\n} from '@acorex-platform/framework-shared/runtime';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\n//#region ---- Types ----\n\nexport type AXMCreateFormTemplateCommandInput = AXPEntityActionCommandInput;\n\n//#endregion\n\n//#region ---- Create form template command ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMCreateFormTemplateCommand implements AXPCommand<AXMCreateFormTemplateCommandInput> {\n private readonly commandService = inject(AXPCommandService);\n\n async execute(input: AXMCreateFormTemplateCommandInput = {}): AXPCommandExecuteResultPromise {\n const entityKey = `${RootConfig.module.name}.${RootConfig.entities.template.name}`;\n const context = resolveEntityActionCommandInput(input);\n\n const result = await this.commandService.execute('Entity:Create', {\n entity: entityKey,\n entityInfo: {\n name: RootConfig.entities.template.name,\n module: RootConfig.module.name,\n title: RootConfig.entities.template.title,\n source: entityKey,\n },\n data: context.data ?? {},\n options: {\n process: {\n redirect: false,\n },\n ...(context.options ?? {}),\n },\n metadata: context.metadata,\n });\n\n return result ?? { success: false };\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;AAcA;AAEA;MAGa,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AA0B5D,IAAA;AAxBC,IAAA,MAAM,OAAO,CAAC,KAAA,GAA2C,EAAE,EAAA;AACzD,QAAA,MAAM,SAAS,GAAG,CAAA,EAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA,CAAA,EAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE;AAClF,QAAA,MAAM,OAAO,GAAG,+BAA+B,CAAC,KAAK,CAAC;QAEtD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,eAAe,EAAE;AAChE,YAAA,MAAM,EAAE,SAAS;AACjB,YAAA,UAAU,EAAE;AACV,gBAAA,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI;AACvC,gBAAA,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI;AAC9B,gBAAA,KAAK,EAAE,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK;AACzC,gBAAA,MAAM,EAAE,SAAS;AAClB,aAAA;AACD,YAAA,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE;AACxB,YAAA,OAAO,EAAE;AACP,gBAAA,OAAO,EAAE;AACP,oBAAA,QAAQ,EAAE,KAAK;AAChB,iBAAA;AACD,gBAAA,IAAI,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;AAC3B,aAAA;YACD,QAAQ,EAAE,OAAO,CAAC,QAAQ;AAC3B,SAAA,CAAC;AAEF,QAAA,OAAO,MAAM,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;IACrC;8GA1BW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA5B,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,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -0,0 +1,97 @@
1
+ import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
2
+ import { AXPDataGenerator, AXPBroadcastEventService } from '@acorex-platform/framework-client/core';
3
+ import { AXPDesignerMessageKeys } from '@acorex-platform/framework-client/layout/designer';
4
+ import * as i0 from '@angular/core';
5
+ import { inject, Injectable } from '@angular/core';
6
+ import { firstValueFrom } from 'rxjs';
7
+ import { filter, take } from 'rxjs/operators';
8
+
9
+ //#endregion
10
+ //#region ---- Helpers ----
11
+ function resolveDesignFormTemplateInput(input = {}) {
12
+ const data = input.data ?? {};
13
+ const embedded = input.embedded ?? data.embedded ?? false;
14
+ const id = input.id ?? data.id ?? AXPDataGenerator.uuid();
15
+ const content = input.content ?? data.content ?? null;
16
+ return {
17
+ embedded: !!embedded,
18
+ id: String(id),
19
+ content: content == null ? null : String(content),
20
+ };
21
+ }
22
+ //#endregion
23
+ //#region ---- Design form template command ----
24
+ /**
25
+ * Opens the form template designer (standalone tab or embedded broadcast flow).
26
+ * Replaces the former `design-form-template` workflow and its four inline actions.
27
+ */
28
+ class AXMDesignFormTemplateCommand {
29
+ constructor() {
30
+ this.commandService = inject(AXPCommandService);
31
+ this.broadcastService = inject(AXPBroadcastEventService);
32
+ }
33
+ async execute(input = {}) {
34
+ try {
35
+ const { embedded, id, content } = resolveDesignFormTemplateInput(input);
36
+ if (embedded) {
37
+ const savedContent = await this.runEmbeddedDesignFlow(id, content);
38
+ if (savedContent == null) {
39
+ return { success: false };
40
+ }
41
+ return { success: true, kind: 'object',
42
+ data: { content: savedContent },
43
+ };
44
+ }
45
+ await this.openDesignerTab(id, false);
46
+ return { success: true, kind: 'object', data: { id } };
47
+ }
48
+ catch (error) {
49
+ const text = error instanceof Error ? error.message : 'Failed to open form template designer.';
50
+ return {
51
+ success: false,
52
+ message: { text },
53
+ };
54
+ }
55
+ }
56
+ async openDesignerTab(formId, broadcast) {
57
+ const path = broadcast
58
+ ? `forms/designer?id=${formId}&strategy=Broadcast`
59
+ : `forms/designer?id=${formId}`;
60
+ await this.commandService.execute('navigate', {
61
+ path,
62
+ options: { extras: { target: 'blank' } },
63
+ });
64
+ }
65
+ async runEmbeddedDesignFlow(formId, content) {
66
+ await this.openDesignerTab(formId, true);
67
+ const contentHandled = await this.respondToFormContentRequest(formId, content);
68
+ if (!contentHandled) {
69
+ return null;
70
+ }
71
+ return this.waitForSaveForm();
72
+ }
73
+ async respondToFormContentRequest(formId, content) {
74
+ const event = await firstValueFrom(this.broadcastService.listen(AXPDesignerMessageKeys.RequestFormContent).pipe(filter((e) => !!e.requestId && e.data.formId === formId), take(1)));
75
+ this.broadcastService.respondToRequest(event.requestId, content);
76
+ return true;
77
+ }
78
+ async waitForSaveForm() {
79
+ const event = await firstValueFrom(this.broadcastService.listen(AXPDesignerMessageKeys.SaveForm).pipe(take(1)));
80
+ if (event.data.success) {
81
+ if (event.requestId) {
82
+ this.broadcastService.respondToRequest(event.requestId, { success: true });
83
+ }
84
+ return event.data.content ?? null;
85
+ }
86
+ return null;
87
+ }
88
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMDesignFormTemplateCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
89
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMDesignFormTemplateCommand, providedIn: 'root' }); }
90
+ }
91
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMDesignFormTemplateCommand, decorators: [{
92
+ type: Injectable,
93
+ args: [{ providedIn: 'root' }]
94
+ }] });
95
+
96
+ export { AXMDesignFormTemplateCommand };
97
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-design-form-template.command-Cgc9Inlz.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-design-form-template.command-Cgc9Inlz.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/commands/design-form-template.command.ts"],"sourcesContent":["import { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPDataGenerator } from '@acorex-platform/framework-client/core';\nimport { AXPBroadcastEventService } from '@acorex-platform/framework-client/core';\nimport {\n AXPDesignerMessageKeys,\n AXPDesignerSaveFormMessage,\n} from '@acorex-platform/framework-client/layout/designer';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { Injectable, inject } from '@angular/core';\nimport { firstValueFrom } from 'rxjs';\nimport { filter, take } from 'rxjs/operators';\n\n//#region ---- Types ----\n\nexport interface AXMDesignFormTemplateCommandInput {\n embedded?: boolean;\n id?: string;\n content?: string | null;\n data?: {\n id?: string;\n embedded?: boolean;\n content?: string | null;\n [key: string]: unknown;\n };\n}\n\n//#endregion\n\n//#region ---- Helpers ----\n\nfunction resolveDesignFormTemplateInput(input: AXMDesignFormTemplateCommandInput = {}) {\n const data = input.data ?? {};\n\n const embedded = input.embedded ?? data.embedded ?? false;\n const id = input.id ?? data.id ?? AXPDataGenerator.uuid();\n const content = input.content ?? data.content ?? null;\n\n return {\n embedded: !!embedded,\n id: String(id),\n content: content == null ? null : String(content),\n };\n}\n\n//#endregion\n\n//#region ---- Design form template command ----\n\n/**\n * Opens the form template designer (standalone tab or embedded broadcast flow).\n * Replaces the former `design-form-template` workflow and its four inline actions.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMDesignFormTemplateCommand\n implements AXPCommand<AXMDesignFormTemplateCommandInput>\n{\n private readonly commandService = inject(AXPCommandService);\n private readonly broadcastService = inject(AXPBroadcastEventService);\n\n async execute(input: AXMDesignFormTemplateCommandInput = {}): AXPCommandExecuteResultPromise {\n try {\n const { embedded, id, content } = resolveDesignFormTemplateInput(input);\n\n if (embedded) {\n const savedContent = await this.runEmbeddedDesignFlow(id, content);\n if (savedContent == null) {\n return { success: false };\n }\n\n return { success: true, kind: 'object',\n data: { content: savedContent },\n };\n }\n\n await this.openDesignerTab(id, false);\n return { success: true, kind: 'object', data: { id } };\n } catch (error: unknown) {\n const text = error instanceof Error ? error.message : 'Failed to open form template designer.';\n return {\n success: false,\n message: { text },\n };\n }\n }\n\n private async openDesignerTab(formId: string, broadcast: boolean): Promise<void> {\n const path = broadcast\n ? `forms/designer?id=${formId}&strategy=Broadcast`\n : `forms/designer?id=${formId}`;\n\n await this.commandService.execute('navigate', {\n path,\n options: { extras: { target: 'blank' } },\n });\n }\n\n private async runEmbeddedDesignFlow(formId: string, content: string | null): Promise<string | null> {\n await this.openDesignerTab(formId, true);\n\n const contentHandled = await this.respondToFormContentRequest(formId, content);\n if (!contentHandled) {\n return null;\n }\n\n return this.waitForSaveForm();\n }\n\n private async respondToFormContentRequest(formId: string, content: string | null): Promise<boolean> {\n const event = await firstValueFrom(\n this.broadcastService.listen<{ formId: string }>(AXPDesignerMessageKeys.RequestFormContent).pipe(\n filter((e) => !!e.requestId && e.data.formId === formId),\n take(1),\n ),\n );\n\n this.broadcastService.respondToRequest(event.requestId!, content);\n return true;\n }\n\n private async waitForSaveForm(): Promise<string | null> {\n const event = await firstValueFrom(\n this.broadcastService.listen<AXPDesignerSaveFormMessage>(AXPDesignerMessageKeys.SaveForm).pipe(take(1)),\n );\n\n if (event.data.success) {\n if (event.requestId) {\n this.broadcastService.respondToRequest(event.requestId, { success: true });\n }\n return event.data.content ?? null;\n }\n\n return null;\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;AA2BA;AAEA;AAEA,SAAS,8BAA8B,CAAC,KAAA,GAA2C,EAAE,EAAA;AACnF,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE;IAE7B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK;AACzD,IAAA,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,IAAI,gBAAgB,CAAC,IAAI,EAAE;IACzD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI;IAErD,OAAO;QACL,QAAQ,EAAE,CAAC,CAAC,QAAQ;AACpB,QAAA,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;AACd,QAAA,OAAO,EAAE,OAAO,IAAI,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC;KAClD;AACH;AAEA;AAEA;AAEA;;;AAGG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,wBAAwB,CAAC;AA4ErE,IAAA;AA1EC,IAAA,MAAM,OAAO,CAAC,KAAA,GAA2C,EAAE,EAAA;AACzD,QAAA,IAAI;AACF,YAAA,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,8BAA8B,CAAC,KAAK,CAAC;YAEvE,IAAI,QAAQ,EAAE;gBACZ,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,EAAE,EAAE,OAAO,CAAC;AAClE,gBAAA,IAAI,Y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,EAAA,EAAA,IAAA,EAAA,4BAA4B,cADf,MAAM,EAAA,CAAA,CAAA;;2FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -0,0 +1,45 @@
1
+ import { AXButtonModule } from '@acorex/components/button';
2
+ import { AXDecoratorModule } from '@acorex/components/decorators';
3
+ import { AXPWidgetCoreModule } from '@acorex-platform/framework-client/layout/widget-core';
4
+ import { AXP_FORM_DESIGNER_SURFACE_PROFILE, AXPLayoutDesignerComponent } from '@acorex-platform/framework-client/layout/designer';
5
+ import { AXPWidgetsModule } from '@acorex-platform/framework-client/layout/widgets';
6
+ import * as i0 from '@angular/core';
7
+ import { inject, signal, ChangeDetectionStrategy, Component } from '@angular/core';
8
+ import { ActivatedRoute } from '@angular/router';
9
+
10
+ //#region ----- Imports -----
11
+ //#endregion
12
+ //#region ----- Component -----
13
+ class AXMFormTemplateManagementModuleDesignerPage {
14
+ constructor() {
15
+ //#region ----- Services & Dependencies -----
16
+ this.router = inject(ActivatedRoute);
17
+ //#endregion
18
+ //#region ----- State Signals -----
19
+ this.formSurfaceProfile = AXP_FORM_DESIGNER_SURFACE_PROFILE;
20
+ this.templateId = signal(this.router.snapshot.queryParams['id'], /* @ts-ignore */
21
+ ...(ngDevMode ? [{ debugName: "templateId" }] : /* istanbul ignore next */ []));
22
+ this.strategy = signal(this.router.snapshot.queryParams['strategy'], /* @ts-ignore */
23
+ ...(ngDevMode ? [{ debugName: "strategy" }] : /* istanbul ignore next */ []));
24
+ }
25
+ //#endregion
26
+ //#region ----- Lifecycle -----
27
+ ngAfterViewInit() {
28
+ document.querySelector('html')?.classList.remove('ax-dark');
29
+ }
30
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMFormTemplateManagementModuleDesignerPage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
31
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: AXMFormTemplateManagementModuleDesignerPage, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<axp-layout-designer\n [id]=\"templateId()\"\n [strategy]=\"strategy()\"\n [profile]=\"formSurfaceProfile\"\n>\n</axp-layout-designer>", dependencies: [{ kind: "ngmodule", type: AXDecoratorModule }, { kind: "ngmodule", type: AXPWidgetsModule }, { kind: "ngmodule", type: AXPWidgetCoreModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: AXPLayoutDesignerComponent, selector: "axp-layout-designer", inputs: ["id", "strategy", "profile"] }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
32
+ }
33
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMFormTemplateManagementModuleDesignerPage, decorators: [{
34
+ type: Component,
35
+ args: [{ changeDetection: ChangeDetectionStrategy.Eager, imports: [
36
+ AXDecoratorModule,
37
+ AXPWidgetsModule,
38
+ AXPWidgetCoreModule,
39
+ AXButtonModule,
40
+ AXPLayoutDesignerComponent
41
+ ], template: "<axp-layout-designer\n [id]=\"templateId()\"\n [strategy]=\"strategy()\"\n [profile]=\"formSurfaceProfile\"\n>\n</axp-layout-designer>" }]
42
+ }] });
43
+
44
+ export { AXMFormTemplateManagementModuleDesignerPage };
45
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-designer.page-COXTLIgc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-designer.page-COXTLIgc.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/designer/designer.page.ts","../../../../libs/modules/assessment-management/client/src/lib/features/form-template/designer/designer.page.html"],"sourcesContent":["//#region ----- Imports -----\nimport { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXPWidgetCoreModule } from '@acorex-platform/framework-client/layout/widget-core';\nimport { AXP_FORM_DESIGNER_SURFACE_PROFILE, AXPLayoutDesignerComponent } from '@acorex-platform/framework-client/layout/designer';\nimport { AXPWidgetsModule } from '@acorex-platform/framework-client/layout/widgets';\n\nimport { Component, inject, signal, ChangeDetectionStrategy } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\n//#endregion\n\n//#region ----- Component -----\n@Component({\n templateUrl: 'designer.page.html',\n changeDetection: ChangeDetectionStrategy.Eager,\n imports: [\n AXDecoratorModule,\n AXPWidgetsModule,\n AXPWidgetCoreModule,\n AXButtonModule,\n AXPLayoutDesignerComponent\n]\n})\nexport class AXMFormTemplateManagementModuleDesignerPage {\n //#region ----- Services & Dependencies -----\n private router = inject(ActivatedRoute);\n //#endregion\n\n //#region ----- State Signals -----\n protected readonly formSurfaceProfile = AXP_FORM_DESIGNER_SURFACE_PROFILE;\n protected templateId = signal<string | null>(this.router.snapshot.queryParams['id']);\n protected strategy = signal<string | null>(this.router.snapshot.queryParams['strategy']);\n //#endregion\n\n //#region ----- Lifecycle -----\n ngAfterViewInit(): void {\n document.querySelector('html')?.classList.remove('ax-dark');\n }\n //#endregion\n}\n//#endregion\n","<axp-layout-designer\n [id]=\"templateId()\"\n [strategy]=\"strategy()\"\n [profile]=\"formSurfaceProfile\"\n>\n</axp-layout-designer>"],"names":[],"mappings":";;;;;;;;;AAAA;AASA;AAEA;MAYa,2CAA2C,CAAA;AAXxD,IAAA,WAAA,GAAA;;AAaU,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC;;;QAIpB,IAAA,CAAA,kBAAkB,GAAG,iCAAiC;AAC/D,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAgB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC;uFAAC;AAC1E,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAgB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC;qFAAC;AAQzF,IAAA;;;IAJC,eAAe,GAAA;AACb,QAAA,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC;IAC7D;8GAdW,2CAA2C,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA3C,2CAA2C,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECvBxD,2IAKsB,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EDWlB,iBAAiB,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EACjB,gBAAgB,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAChB,mBAAmB,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EACnB,cAAc,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACd,0BAA0B,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,CAAA,IAAA,EAAA,UAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,KAAA,EAAA,CAAA,CAAA;;2FAGjB,2CAA2C,EAAA,UAAA,EAAA,CAAA;kBAXvD,SAAS;sCAES,uBAAuB,CAAC,KAAK,EAAA,OAAA,EACrC;wBACP,iBAAiB;wBACjB,gBAAgB;wBAChB,mBAAmB;wBACnB,cAAc;wBACd;AACH,qBAAA,EAAA,QAAA,EAAA,2IAAA,EAAA;;;"}
@@ -6,7 +6,7 @@ import { inject, Injectable } from '@angular/core';
6
6
  import { get, first, defaultTo, isString } from 'lodash';
7
7
  import { Router } from '@angular/router';
8
8
  import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
9
- import { A as AXMQuestionnaireViewerService } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-BcpbQ8TJ.mjs';
9
+ import { a as AXMQuestionnaireViewerService } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-rrUYWHvI.mjs';
10
10
  import { RootConfig, toPrintSettings, toDisplaySettings, normalizeCompletionMode, toPrePostConfig } from '@acorex-platform/module-assessment-management-client/contracts';
11
11
 
12
12
  //#endregion
@@ -267,4 +267,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
267
267
  }] });
268
268
 
269
269
  export { FillAssessmentSessionCommand };
270
- //# sourceMappingURL=acorex-platform-module-assessment-management-client-fill-assessment-session.command-lHYKxCXo.mjs.map
270
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-fill-assessment-session.command-DNDkEL7L.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-assessment-management-client-fill-assessment-session.command-lHYKxCXo.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/fill-assessment-session.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, type AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPDebugService } from '@acorex-platform/framework-client/core';\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, first, get, isString } from 'lodash';\nimport { Router } from '@angular/router';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\nimport type { AXMAssessmentManagementAssessmentCaseEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementAssessmentSessionEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementQuestionnaireEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport {\n normalizeCompletionMode,\n toDisplaySettings,\n toPrePostConfig,\n toPrintSettings,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport {\n RootConfig,\n type QuestionnaireCompletionMode,\n type QuestionnaireBuilderValue,\n} from '@acorex-platform/module-assessment-management-client/contracts';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * How to show the questionnaire viewer when filling an assessment session.\n */\nexport type FillAssessmentSessionShowAs = 'popup' | 'page' | 'standalone';\n\nexport type FillAssessmentSessionOutcome = 'Submitted' | 'Saved' | 'Cancelled';\n\n/**\n * Input for FillAssessmentSession command.\n */\nexport interface FillAssessmentSessionCommandInput {\n caseId: string;\n sessionId?: string;\n /** Popup viewer title; falls back to assessment case title when omitted. */\n title?: AXPMultiLanguageString;\n showAs?: FillAssessmentSessionShowAs;\n responderId?: string;\n role?: 'responder' | 'supervisor' | 'reviewer';\n /** Overrides questionnaire display.completionMode when set. */\n completionMode?: QuestionnaireCompletionMode;\n /** Question answer keys that must stay readonly (e.g. asset prefill on work-order checklists). */\n readonlyAnswerKeys?: string[];\n}\n\n//#endregion\n\n//#region ---- Fill Assessment Session Command ----\n\n/**\n * Opens questionnaire viewer for filling/editing assessment session with draft save and workflow outcomes.\n */\n@Injectable()\nexport class FillAssessmentSessionCommand implements AXPCommand<FillAssessmentSessionCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly sessionService = inject(AXPSessionService);\n private readonly router = inject(Router);\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n private readonly debug = inject(AXPDebugService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: FillAssessmentSessionCommandInput): AXPCommandExecuteResultPromise<void> {\n try {\n const assessmentCase = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentCase.name)\n .data<string, AXMAssessmentManagementAssessmentCaseEntityModel>()\n .byKey(input.caseId);\n if (!assessmentCase) {\n return {\n success: false,\n message: { text: `Assessment case with ID ${input.caseId} not found` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const questionnaire = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionnaire.name)\n .data<string, AXMAssessmentManagementQuestionnaireEntityModel>()\n .byKey(assessmentCase.questionnaireId);\n if (!questionnaire) {\n return {\n success: false,\n message: { text: `Questionnaire with ID ${assessmentCase.questionnaireId} not found` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const questions = questionnaire.questions ?? { sections: [] };\n const structure: QuestionnaireBuilderValue = {\n ...questions,\n sections: questions.sections ?? [],\n displaySettings: toDisplaySettings(questionnaire) ?? undefined,\n printSettings: toPrintSettings(questionnaire) ?? undefined,\n };\n if (!structure.sections.length) {\n return {\n success: false,\n message: { text: 'Questionnaire has no questions to display' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const currentUser = this.sessionService.user;\n const responderId = input.responderId || currentUser?.id;\n if (!responderId) {\n return {\n success: false,\n message: { text: 'No responder ID provided and no current user found' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const role = input.role || 'responder';\n const displaySettings = toDisplaySettings(questionnaire);\n const completionMode: QuestionnaireCompletionMode =\n input.completionMode ?? normalizeCompletionMode(displaySettings?.completionMode);\n\n let existingSession: AXMAssessmentManagementAssessmentSessionEntityModel | null = null;\n let sessionId = input.sessionId ?? null;\n let initialAnswers: Record<string, unknown> = {};\n\n if (sessionId) {\n existingSession = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .byKey(sessionId);\n if (existingSession) {\n initialAnswers = (existingSession.answers as Record<string, unknown>) || {};\n }\n }\n\n const sessionSubmitted = existingSession?.statusId === 'submitted';\n\n const showAs = input.showAs ?? 'popup';\n const appName = this.sessionService.application?.name ?? 'demo';\n const moduleRoute = (RootConfig.module as { route?: string }).route ?? 'assessment-management';\n\n if (showAs === 'page') {\n const path = `/${appName}/${moduleRoute}/questionnaire/fill/${input.caseId}`;\n const url = sessionId ? `${path}?sessionId=${encodeURIComponent(sessionId)}` : path;\n this.router.navigateByUrl(url);\n return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'Cancelled' } };\n }\n\n if (showAs === 'standalone') {\n let sessionIdToOpen = sessionId;\n if (!sessionIdToOpen) {\n const now = new Date();\n sessionIdToOpen = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .create({\n caseId: input.caseId,\n responderId,\n role,\n answers: {},\n progressPercentage: 0,\n answeredQuestionsCount: 0,\n lastSavedAt: now,\n startedAt: now,\n statusId: 'not-started',\n } as Omit<AXMAssessmentManagementAssessmentSessionEntityModel, 'id'>);\n }\n if (sessionIdToOpen) {\n this.router.navigateByUrl(`/assessment/fill/${sessionIdToOpen}`);\n }\n return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'Cancelled' } };\n }\n\n const viewerTitle = await this.resolveViewerTitle(input.title, assessmentCase.title);\n\n const viewerConfig = {\n readonly: sessionSubmitted,\n completionMode,\n validationStrategy: displaySettings?.validationStrategy,\n viewMode: displaySettings?.viewMode,\n showProgressBar: displaySettings?.showProgressBar,\n timer: { showTimer: displaySettings?.showTimer ?? false },\n showQuestionNumbers: displaySettings?.showQuestionNumbers,\n readonlyAnswerKeys: input.readonlyAnswerKeys,\n };\n\n const result = await this.questionnaireViewerService.open({\n title: viewerTitle,\n structure,\n prePostConfig: toPrePostConfig(questionnaire),\n config: viewerConfig,\n initialAnswers,\n questionnaireId: questionnaire.id,\n assessmentFillContext: sessionSubmitted\n ? undefined\n : {\n caseId: input.caseId,\n sessionId: sessionId ?? null,\n responderId,\n role,\n },\n });\n\n const outcome = await this.resolveFillOutcome(input.caseId, input.sessionId ?? sessionId, result);\n this.debug.trace(\n 'assessment-management',\n 'fill-assessment-session',\n 'Resolved fill workflow outcome',\n () => ({\n caseId: input.caseId,\n sessionId: input.sessionId ?? sessionId,\n popupResult: {\n saved: result?.saved === true,\n submitted: result?.submitted === true,\n hasPayload: result != null,\n },\n outcome,\n }),\n );\n return { success: true, kind: 'object', data: undefined, metadata: { outcome },\n };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error('Error filling assessment session:', error);\n return {\n success: false,\n message: { text: `Error filling assessment session: ${message}` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n /**\n * Resolves popup title: explicit input, then case title, then translated default.\n */\n private async resolveViewerTitle(\n inputTitle: AXPMultiLanguageString | undefined,\n caseTitle: string | undefined,\n ): Promise<string> {\n const explicit = this.normalizeTitle(inputTitle);\n if (explicit) {\n return explicit;\n }\n\n const fromCase = this.normalizeTitle(caseTitle);\n if (fromCase) {\n return fromCase;\n }\n\n const fillTitleKey = '@assessment-management:cases.actions.fill-assessment.title';\n const fillTitleBase = await this.translationService.translateAsync(fillTitleKey);\n return fillTitleBase || 'Fill Assessment';\n }\n\n /** Resolves a multi-language or plain string title for the active locale. */\n private normalizeTitle(value: AXPMultiLanguageString | string | undefined | null | false): string {\n if (value == null || value === false) {\n return '';\n }\n if (typeof value === 'string') {\n return value.trim();\n }\n const locale = this.translationService.getActiveLang();\n return resolveMultiLanguageString(value, locale).trim();\n }\n\n /**\n * Resolves workflow outcome from popup result, falling back to persisted session status only\n * when the popup is dismissed without an explicit close payload.\n * After submit the viewer may show a summary step; closing via X without \"Done\" still leaves\n * the session submitted and must advance the workflow. Save-as-draft always sends an explicit\n * payload ({ saved: true }); inferring Submitted from the DB when a payload exists can wrongly\n * advance the workflow if flags are missing or a stale submitted session is resolved.\n */\n private async resolveFillOutcome(\n caseId: string,\n sessionId: string | null | undefined,\n result: { submitted?: boolean; saved?: boolean } | null | undefined,\n ): Promise<FillAssessmentSessionOutcome> {\n if (result?.saved) {\n return 'Saved';\n }\n if (result?.submitted) {\n return 'Submitted';\n }\n\n if (result != null) {\n return 'Cancelled';\n }\n\n const sessionSubmitted = await this.isAssessmentSessionSubmitted(caseId, sessionId);\n if (sessionSubmitted) {\n return 'Submitted';\n }\n\n return 'Cancelled';\n }\n\n private async isAssessmentSessionSubmitted(\n caseId: string,\n sessionId: string | null | undefined,\n ): Promise<boolean> {\n const resolvedSessionId = this.resolveText(sessionId) || (await this.findLatestSessionIdForCase(caseId));\n if (!resolvedSessionId) {\n return false;\n }\n\n const session = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .byKey(resolvedSessionId);\n\n return get(session, 'statusId') === 'submitted';\n }\n\n private async findLatestSessionIdForCase(caseId: string): Promise<string> {\n const page = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .query({\n skip: 0,\n take: 1,\n sort: [{ field: 'lastSavedAt', direction: 'desc' }],\n filter: {\n logic: 'and',\n filters: [{ field: 'caseId', operator: { type: 'equal' }, value: caseId }],\n },\n } as never);\n\n const session = first(defaultTo(get(page, 'items'), []));\n return this.resolveText(get(session, 'id'));\n }\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;AAwDA;AAEA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,0BAA0B,GAAG,MA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AAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3E,aAAA;AACO,SAAA,CAAC;AAEb,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7C;AAEQ,IAAA,WAAW,CAAC,KAAc,EAAA;AAChC,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GAnSW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA5B,4BAA4B,EAAA,CAAA,CAAA;;2FAA5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC;;;"}
1
+ {"version":3,"file":"acorex-platform-module-assessment-management-client-fill-assessment-session.command-DNDkEL7L.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/fill-assessment-session.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, type AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPDebugService } from '@acorex-platform/framework-client/core';\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, first, get, isString } from 'lodash';\nimport { Router } from '@angular/router';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\nimport type { AXMAssessmentManagementAssessmentCaseEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementAssessmentSessionEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementQuestionnaireEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport {\n normalizeCompletionMode,\n toDisplaySettings,\n toPrePostConfig,\n toPrintSettings,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport {\n RootConfig,\n type QuestionnaireCompletionMode,\n type QuestionnaireBuilderValue,\n} from '@acorex-platform/module-assessment-management-client/contracts';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * How to show the questionnaire viewer when filling an assessment session.\n */\nexport type FillAssessmentSessionShowAs = 'popup' | 'page' | 'standalone';\n\nexport type FillAssessmentSessionOutcome = 'Submitted' | 'Saved' | 'Cancelled';\n\n/**\n * Input for FillAssessmentSession command.\n */\nexport interface FillAssessmentSessionCommandInput {\n caseId: string;\n sessionId?: string;\n /** Popup viewer title; falls back to assessment case title when omitted. */\n title?: AXPMultiLanguageString;\n showAs?: FillAssessmentSessionShowAs;\n responderId?: string;\n role?: 'responder' | 'supervisor' | 'reviewer';\n /** Overrides questionnaire display.completionMode when set. */\n completionMode?: QuestionnaireCompletionMode;\n /** Question answer keys that must stay readonly (e.g. asset prefill on work-order checklists). */\n readonlyAnswerKeys?: string[];\n}\n\n//#endregion\n\n//#region ---- Fill Assessment Session Command ----\n\n/**\n * Opens questionnaire viewer for filling/editing assessment session with draft save and workflow outcomes.\n */\n@Injectable()\nexport class FillAssessmentSessionCommand implements AXPCommand<FillAssessmentSessionCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly sessionService = inject(AXPSessionService);\n private readonly router = inject(Router);\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n private readonly debug = inject(AXPDebugService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: FillAssessmentSessionCommandInput): AXPCommandExecuteResultPromise<void> {\n try {\n const assessmentCase = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentCase.name)\n .data<string, AXMAssessmentManagementAssessmentCaseEntityModel>()\n .byKey(input.caseId);\n if (!assessmentCase) {\n return {\n success: false,\n message: { text: `Assessment case with ID ${input.caseId} not found` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const questionnaire = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionnaire.name)\n .data<string, AXMAssessmentManagementQuestionnaireEntityModel>()\n .byKey(assessmentCase.questionnaireId);\n if (!questionnaire) {\n return {\n success: false,\n message: { text: `Questionnaire with ID ${assessmentCase.questionnaireId} not found` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const questions = questionnaire.questions ?? { sections: [] };\n const structure: QuestionnaireBuilderValue = {\n ...questions,\n sections: questions.sections ?? [],\n displaySettings: toDisplaySettings(questionnaire) ?? undefined,\n printSettings: toPrintSettings(questionnaire) ?? undefined,\n };\n if (!structure.sections.length) {\n return {\n success: false,\n message: { text: 'Questionnaire has no questions to display' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const currentUser = this.sessionService.user;\n const responderId = input.responderId || currentUser?.id;\n if (!responderId) {\n return {\n success: false,\n message: { text: 'No responder ID provided and no current user found' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const role = input.role || 'responder';\n const displaySettings = toDisplaySettings(questionnaire);\n const completionMode: QuestionnaireCompletionMode =\n input.completionMode ?? normalizeCompletionMode(displaySettings?.completionMode);\n\n let existingSession: AXMAssessmentManagementAssessmentSessionEntityModel | null = null;\n let sessionId = input.sessionId ?? null;\n let initialAnswers: Record<string, unknown> = {};\n\n if (sessionId) {\n existingSession = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .byKey(sessionId);\n if (existingSession) {\n initialAnswers = (existingSession.answers as Record<string, unknown>) || {};\n }\n }\n\n const sessionSubmitted = existingSession?.statusId === 'submitted';\n\n const showAs = input.showAs ?? 'popup';\n const appName = this.sessionService.application?.name ?? 'demo';\n const moduleRoute = (RootConfig.module as { route?: string }).route ?? 'assessment-management';\n\n if (showAs === 'page') {\n const path = `/${appName}/${moduleRoute}/questionnaire/fill/${input.caseId}`;\n const url = sessionId ? `${path}?sessionId=${encodeURIComponent(sessionId)}` : path;\n this.router.navigateByUrl(url);\n return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'Cancelled' } };\n }\n\n if (showAs === 'standalone') {\n let sessionIdToOpen = sessionId;\n if (!sessionIdToOpen) {\n const now = new Date();\n sessionIdToOpen = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .create({\n caseId: input.caseId,\n responderId,\n role,\n answers: {},\n progressPercentage: 0,\n answeredQuestionsCount: 0,\n lastSavedAt: now,\n startedAt: now,\n statusId: 'not-started',\n } as Omit<AXMAssessmentManagementAssessmentSessionEntityModel, 'id'>);\n }\n if (sessionIdToOpen) {\n this.router.navigateByUrl(`/assessment/fill/${sessionIdToOpen}`);\n }\n return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'Cancelled' } };\n }\n\n const viewerTitle = await this.resolveViewerTitle(input.title, assessmentCase.title);\n\n const viewerConfig = {\n readonly: sessionSubmitted,\n completionMode,\n validationStrategy: displaySettings?.validationStrategy,\n viewMode: displaySettings?.viewMode,\n showProgressBar: displaySettings?.showProgressBar,\n timer: { showTimer: displaySettings?.showTimer ?? false },\n showQuestionNumbers: displaySettings?.showQuestionNumbers,\n readonlyAnswerKeys: input.readonlyAnswerKeys,\n };\n\n const result = await this.questionnaireViewerService.open({\n title: viewerTitle,\n structure,\n prePostConfig: toPrePostConfig(questionnaire),\n config: viewerConfig,\n initialAnswers,\n questionnaireId: questionnaire.id,\n assessmentFillContext: sessionSubmitted\n ? undefined\n : {\n caseId: input.caseId,\n sessionId: sessionId ?? null,\n responderId,\n role,\n },\n });\n\n const outcome = await this.resolveFillOutcome(input.caseId, input.sessionId ?? sessionId, result);\n this.debug.trace(\n 'assessment-management',\n 'fill-assessment-session',\n 'Resolved fill workflow outcome',\n () => ({\n caseId: input.caseId,\n sessionId: input.sessionId ?? sessionId,\n popupResult: {\n saved: result?.saved === true,\n submitted: result?.submitted === true,\n hasPayload: result != null,\n },\n outcome,\n }),\n );\n return { success: true, kind: 'object', data: undefined, metadata: { outcome },\n };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error('Error filling assessment session:', error);\n return {\n success: false,\n message: { text: `Error filling assessment session: ${message}` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n /**\n * Resolves popup title: explicit input, then case title, then translated default.\n */\n private async resolveViewerTitle(\n inputTitle: AXPMultiLanguageString | undefined,\n caseTitle: string | undefined,\n ): Promise<string> {\n const explicit = this.normalizeTitle(inputTitle);\n if (explicit) {\n return explicit;\n }\n\n const fromCase = this.normalizeTitle(caseTitle);\n if (fromCase) {\n return fromCase;\n }\n\n const fillTitleKey = '@assessment-management:cases.actions.fill-assessment.title';\n const fillTitleBase = await this.translationService.translateAsync(fillTitleKey);\n return fillTitleBase || 'Fill Assessment';\n }\n\n /** Resolves a multi-language or plain string title for the active locale. */\n private normalizeTitle(value: AXPMultiLanguageString | string | undefined | null | false): string {\n if (value == null || value === false) {\n return '';\n }\n if (typeof value === 'string') {\n return value.trim();\n }\n const locale = this.translationService.getActiveLang();\n return resolveMultiLanguageString(value, locale).trim();\n }\n\n /**\n * Resolves workflow outcome from popup result, falling back to persisted session status only\n * when the popup is dismissed without an explicit close payload.\n * After submit the viewer may show a summary step; closing via X without \"Done\" still leaves\n * the session submitted and must advance the workflow. Save-as-draft always sends an explicit\n * payload ({ saved: true }); inferring Submitted from the DB when a payload exists can wrongly\n * advance the workflow if flags are missing or a stale submitted session is resolved.\n */\n private async resolveFillOutcome(\n caseId: string,\n sessionId: string | null | undefined,\n result: { submitted?: boolean; saved?: boolean } | null | undefined,\n ): Promise<FillAssessmentSessionOutcome> {\n if (result?.saved) {\n return 'Saved';\n }\n if (result?.submitted) {\n return 'Submitted';\n }\n\n if (result != null) {\n return 'Cancelled';\n }\n\n const sessionSubmitted = await this.isAssessmentSessionSubmitted(caseId, sessionId);\n if (sessionSubmitted) {\n return 'Submitted';\n }\n\n return 'Cancelled';\n }\n\n private async isAssessmentSessionSubmitted(\n caseId: string,\n sessionId: string | null | undefined,\n ): Promise<boolean> {\n const resolvedSessionId = this.resolveText(sessionId) || (await this.findLatestSessionIdForCase(caseId));\n if (!resolvedSessionId) {\n return false;\n }\n\n const session = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .byKey(resolvedSessionId);\n\n return get(session, 'statusId') === 'submitted';\n }\n\n private async findLatestSessionIdForCase(caseId: string): Promise<string> {\n const page = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .query({\n skip: 0,\n take: 1,\n sort: [{ field: 'lastSavedAt', direction: 'desc' }],\n filter: {\n logic: 'and',\n filters: [{ field: 'caseId', operator: { type: 'equal' }, value: caseId }],\n },\n } as never);\n\n const session = first(defaultTo(get(page, 'items'), []));\n return this.resolveText(get(session, 'id'));\n }\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;AAwDA;AAEA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,MA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CAAC;AACnD,YAAA,MAAM,EAAE;AACN,gBAAA,KAAK,EAAE,KAAK;AACZ,gBAAA,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3E,aAAA;AACO,SAAA,CAAC;AAEb,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7C;AAEQ,IAAA,WAAW,CAAC,KAAc,EAAA;AAChC,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACpB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;8GAnSW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA5B,4BAA4B,EAAA,CAAA,CAAA;;2FAA5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC;;;"}
@@ -0,0 +1,238 @@
1
+ import * as i1 from '@acorex/components/button';
2
+ import { AXButtonModule } from '@acorex/components/button';
3
+ import * as i2 from '@acorex/components/decorators';
4
+ import { AXDecoratorModule } from '@acorex/components/decorators';
5
+ import * as i1$1 from '@acorex/components/form';
6
+ import { AXFormModule } from '@acorex/components/form';
7
+ import { AXBasePageComponent } from '@acorex/components/page';
8
+ import * as i4 from '@acorex/core/translation';
9
+ import { AXTranslationService, resolveMultiLanguageString, AXTranslationModule } from '@acorex/core/translation';
10
+ import { DomSanitizer } from '@angular/platform-browser';
11
+ import * as i1$2 from '@acorex-platform/framework-client/layout/widget-core';
12
+ import { readLocalDataSourcesFromNode, AXPWidgetCoreModule, AXP_LOCAL_DATA_SOURCE_STORE, createReadonlyLocalDataSourceStore } from '@acorex-platform/framework-client/layout/widget-core';
13
+ import { AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';
14
+ import * as i3 from '@angular/common';
15
+ import { CommonModule } from '@angular/common';
16
+ import * as i0 from '@angular/core';
17
+ import { inject, viewChild, signal, computed, effect, Input, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
18
+ import { a as AXMQuestionnaireViewerService, k as resolveSummaryPlaceholders, g as AXMPreQuestionnaireContentComponent, h as AXMPostQuestionnaireContentComponent } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-rrUYWHvI.mjs';
19
+
20
+ //#region ----- Imports -----
21
+ const EMPTY_OUTCOME_STRUCTURE = { sections: [] };
22
+ //#endregion
23
+ //#region ----- Component -----
24
+ class AXMFormTemplateViewerPopupComponent extends AXBasePageComponent {
25
+ //#endregion
26
+ //#region ----- Inputs -----
27
+ set config(value) {
28
+ this._config.set(value);
29
+ }
30
+ //#endregion
31
+ //#region ----- Lifecycle -----
32
+ constructor() {
33
+ super();
34
+ //#region ----- Services & Dependencies -----
35
+ this.questionnaireViewerService = inject(AXMQuestionnaireViewerService);
36
+ this.translationService = inject(AXTranslationService);
37
+ this.sanitizer = inject(DomSanitizer);
38
+ this.formRef = viewChild('form', /* @ts-ignore */
39
+ ...(ngDevMode ? [{ debugName: "formRef" }] : /* istanbul ignore next */ []));
40
+ //#endregion
41
+ //#region ----- State Signals -----
42
+ this._config = signal(undefined, /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "_config" }] : /* istanbul ignore next */ []));
44
+ this.flowStep = signal('form', /* @ts-ignore */
45
+ ...(ngDevMode ? [{ debugName: "flowStep" }] : /* istanbul ignore next */ []));
46
+ this.submitResult = signal(null, /* @ts-ignore */
47
+ ...(ngDevMode ? [{ debugName: "submitResult" }] : /* istanbul ignore next */ []));
48
+ this.isSubmitting = signal(false, /* @ts-ignore */
49
+ ...(ngDevMode ? [{ debugName: "isSubmitting" }] : /* istanbul ignore next */ []));
50
+ this.document = signal({ type: AXPWidgetsCatalog.document }, /* @ts-ignore */
51
+ ...(ngDevMode ? [{ debugName: "document" }] : /* istanbul ignore next */ []));
52
+ this.currentPageIndex = signal(0, /* @ts-ignore */
53
+ ...(ngDevMode ? [{ debugName: "currentPageIndex" }] : /* istanbul ignore next */ []));
54
+ this.initialFlowApplied = signal(false, /* @ts-ignore */
55
+ ...(ngDevMode ? [{ debugName: "initialFlowApplied" }] : /* istanbul ignore next */ []));
56
+ this.templateLoaded = signal(false, /* @ts-ignore */
57
+ ...(ngDevMode ? [{ debugName: "templateLoaded" }] : /* istanbul ignore next */ []));
58
+ this.context = {};
59
+ this.sources = computed(() => readLocalDataSourcesFromNode(this.document()), /* @ts-ignore */
60
+ ...(ngDevMode ? [{ debugName: "sources" }] : /* istanbul ignore next */ []));
61
+ this.currentPage = computed(() => this.document().children?.[this.currentPageIndex()] ?? { type: AXPWidgetsCatalog.pageLayout }, /* @ts-ignore */
62
+ ...(ngDevMode ? [{ debugName: "currentPage" }] : /* istanbul ignore next */ []));
63
+ this.prePostConfig = computed(() => this._config()?.prePostConfig ?? null, /* @ts-ignore */
64
+ ...(ngDevMode ? [{ debugName: "prePostConfig" }] : /* istanbul ignore next */ []));
65
+ this.widgetMode = computed(() => this._config()?.readOnly || this.flowStep() === 'review' ? 'view' : 'edit', /* @ts-ignore */
66
+ ...(ngDevMode ? [{ debugName: "widgetMode" }] : /* istanbul ignore next */ []));
67
+ this.showReviewButton = computed(() => this.flowStep() === 'form' && !this._config()?.readOnly && this.prePostConfig()?.post?.reviewEnabled === true, /* @ts-ignore */
68
+ ...(ngDevMode ? [{ debugName: "showReviewButton" }] : /* istanbul ignore next */ []));
69
+ this.showSubmitButton = computed(() => this.flowStep() === 'form' && !this._config()?.readOnly && !this.showReviewButton(), /* @ts-ignore */
70
+ ...(ngDevMode ? [{ debugName: "showSubmitButton" }] : /* istanbul ignore next */ []));
71
+ this.isPreviewMode = computed(() => this._config()?.previewMode === true, /* @ts-ignore */
72
+ ...(ngDevMode ? [{ debugName: "isPreviewMode" }] : /* istanbul ignore next */ []));
73
+ this.submitActionLabel = computed(() => this.isPreviewMode()
74
+ ? '@form-template-management:templates.viewer.preview.finish.title'
75
+ : '@general:actions.submit.title', /* @ts-ignore */
76
+ ...(ngDevMode ? [{ debugName: "submitActionLabel" }] : /* istanbul ignore next */ []));
77
+ /** Summary rich text with outcome placeholders. Empty author content stays blank. */
78
+ this.summaryHtml = computed(() => {
79
+ const content = this.prePostConfig()?.post?.summaryContent;
80
+ const locale = this.translationService.getActiveLang?.() ?? 'en-US';
81
+ let resolved = resolveMultiLanguageString(content, locale);
82
+ const values = this.submitResult();
83
+ if (resolved && values) {
84
+ resolved = resolveSummaryPlaceholders(resolved, values);
85
+ }
86
+ return resolved ? this.sanitizer.bypassSecurityTrustHtml(resolved) : '';
87
+ }, /* @ts-ignore */
88
+ ...(ngDevMode ? [{ debugName: "summaryHtml" }] : /* istanbul ignore next */ []));
89
+ effect(() => {
90
+ const cfg = this._config();
91
+ if (!cfg) {
92
+ return;
93
+ }
94
+ if (!this.templateLoaded()) {
95
+ this.loadTemplate(cfg);
96
+ this.templateLoaded.set(true);
97
+ }
98
+ if (!this.initialFlowApplied()) {
99
+ this.flowStep.set(cfg.prePostConfig?.pre?.enabled === true ? 'pre' : 'form');
100
+ this.initialFlowApplied.set(true);
101
+ }
102
+ });
103
+ }
104
+ //#endregion
105
+ //#region ----- Event Handlers -----
106
+ handleContextChanged(event) {
107
+ this.context = event.data ?? {};
108
+ }
109
+ handleCancel() {
110
+ this.finish(true);
111
+ }
112
+ handleStart() {
113
+ this.flowStep.set('form');
114
+ }
115
+ handleEdit() {
116
+ this.flowStep.set('form');
117
+ }
118
+ async handleReviewClick() {
119
+ if (!(await this.validateForm())) {
120
+ return;
121
+ }
122
+ this.flowStep.set('review');
123
+ }
124
+ async handleSubmitClick() {
125
+ if (this.flowStep() === 'form' && !(await this.validateForm())) {
126
+ return;
127
+ }
128
+ await this.advanceAfterSubmit();
129
+ }
130
+ handleResultsNext() {
131
+ if (this.prePostConfig()?.post?.summaryEnabled) {
132
+ this.flowStep.set('summary');
133
+ return;
134
+ }
135
+ this.finish(false);
136
+ }
137
+ handleDone() {
138
+ this.finish(false);
139
+ }
140
+ //#endregion
141
+ //#region ----- Template Loading -----
142
+ loadTemplate(config) {
143
+ let templateData;
144
+ if (typeof config.template === 'string') {
145
+ try {
146
+ templateData = JSON.parse(config.template);
147
+ }
148
+ catch (error) {
149
+ console.error('Failed to parse form template JSON:', error);
150
+ return;
151
+ }
152
+ }
153
+ else {
154
+ templateData = config.template;
155
+ }
156
+ this.document.set(templateData);
157
+ if (config.context) {
158
+ this.context = { ...config.context };
159
+ }
160
+ }
161
+ //#endregion
162
+ //#region ----- Submit Flow -----
163
+ async validateForm() {
164
+ const form = this.formRef();
165
+ if (!form) {
166
+ return false;
167
+ }
168
+ const formResult = await form.validate();
169
+ return formResult.result === true;
170
+ }
171
+ async advanceAfterSubmit() {
172
+ if (this.isSubmitting()) {
173
+ return;
174
+ }
175
+ this.isSubmitting.set(true);
176
+ try {
177
+ const rules = this._config()?.outcomeRules ?? [];
178
+ const post = this.prePostConfig()?.post;
179
+ let placeholders = null;
180
+ if (rules.length > 0) {
181
+ placeholders = await this.questionnaireViewerService.buildSummaryPlaceholderValues(EMPTY_OUTCOME_STRUCTURE, this.context, { outcomeRules: rules });
182
+ }
183
+ this.submitResult.set(placeholders);
184
+ if (post?.showOutcomeResults) {
185
+ this.flowStep.set('results');
186
+ return;
187
+ }
188
+ if (post?.summaryEnabled) {
189
+ this.flowStep.set('summary');
190
+ return;
191
+ }
192
+ this.finish(false);
193
+ }
194
+ finally {
195
+ this.isSubmitting.set(false);
196
+ }
197
+ }
198
+ finish(cancelled) {
199
+ const result = {
200
+ context: this.context,
201
+ cancelled,
202
+ metadata: this._config()?.metadata,
203
+ };
204
+ this.close(result);
205
+ }
206
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMFormTemplateViewerPopupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
207
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXMFormTemplateViewerPopupComponent, isStandalone: true, selector: "axm-form-template-viewer-popup", inputs: { config: "config" }, providers: [
208
+ {
209
+ provide: AXP_LOCAL_DATA_SOURCE_STORE,
210
+ useFactory: (host) => createReadonlyLocalDataSourceStore(() => host.sources()),
211
+ deps: [AXMFormTemplateViewerPopupComponent],
212
+ },
213
+ ], viewQueries: [{ propertyName: "formRef", first: true, predicate: ["form"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"__content-area flex flex-1 min-h-0 flex-col\"\n [class.overflow-hidden]=\"flowStep() === 'form' || flowStep() === 'review'\"\n [class.overflow-y-auto]=\"flowStep() !== 'form' && flowStep() !== 'review'\"\n>\n <!-- ----- Welcome content before the form ----- -->\n @if (flowStep() === 'pre') {\n <axm-pre-questionnaire-content [content]=\"prePostConfig()?.pre?.content\"></axm-pre-questionnaire-content>\n }\n <!-- ----- Outcome results after submit ----- -->\n @else if (flowStep() === 'results') {\n <axm-post-questionnaire-content mode=\"results\" [placeholderValues]=\"submitResult()\"></axm-post-questionnaire-content>\n }\n <!-- ----- Summary content after submit ----- -->\n @else if (flowStep() === 'summary') {\n <div class=\"flex flex-col items-center justify-center p-8 min-h-[200px] text-on-surface\">\n <div class=\"max-w-2xl w-full prose text-on-surface\" [innerHTML]=\"summaryHtml()\"></div>\n </div>\n }\n <!-- ----- Form body, including readonly review ----- -->\n @else {\n <!-- ----- Review heading while the filled form is shown read-only ----- -->\n @if (flowStep() === 'review') {\n <div class=\"p-4 border-b border-surface\">\n <h2 class=\"text-lg font-semibold text-on-surface\">\n {{ '@form-template-management:templates.viewer.flow.review-title' | translate | async }}\n </h2>\n </div>\n }\n <div class=\"flex flex-1 min-h-0 flex-col overflow-y-auto overflow-x-hidden p-4\">\n <ax-form #form>\n <axp-widgets-container [context]=\"context\" (onContextChanged)=\"handleContextChanged($event)\">\n <ng-container axp-widget-renderer [node]=\"currentPage()\" [mode]=\"widgetMode()\"></ng-container>\n </axp-widgets-container>\n </ax-form>\n </div>\n }\n</div>\n\n<ax-footer class=\"__popup-footer flex-shrink-0 border-t px-4 py-3\">\n <ax-suffix>\n <!-- ----- Welcome step ----- -->\n @if (flowStep() === 'pre') {\n <ax-button\n [text]=\"'@general:actions.cancel.title' | translate | async\"\n (onClick)=\"handleCancel()\"\n ></ax-button>\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.start' | translate | async\"\n (onClick)=\"handleStart()\"\n ></ax-button>\n }\n <!-- ----- Fill step ----- -->\n @else if (flowStep() === 'form') {\n <ax-button\n [text]=\"'@general:actions.cancel.title' | translate | async\"\n (onClick)=\"handleCancel()\"\n ></ax-button>\n <!-- ----- Review before submit when post review is enabled ----- -->\n @if (showReviewButton()) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.review' | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleReviewClick()\"\n ></ax-button>\n }\n <!-- ----- Submit when review is off ----- -->\n @else if (showSubmitButton()) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"submitActionLabel() | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleSubmitClick()\"\n ></ax-button>\n }\n }\n <!-- ----- Review step ----- -->\n @else if (flowStep() === 'review') {\n <ax-button\n look=\"outline\"\n [text]=\"'@form-template-management:templates.viewer.flow.edit' | translate | async\"\n (onClick)=\"handleEdit()\"\n ></ax-button>\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"submitActionLabel() | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleSubmitClick()\"\n ></ax-button>\n }\n <!-- ----- Outcome results step ----- -->\n @else if (flowStep() === 'results') {\n <!-- ----- Continue to the summary when it is enabled ----- -->\n @if (prePostConfig()?.post?.summaryEnabled) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@general:actions.next.title' | translate | async\"\n (onClick)=\"handleResultsNext()\"\n ></ax-button>\n }\n <!-- ----- Close when there is no summary step ----- -->\n @else {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.done' | translate | async\"\n (onClick)=\"handleDone()\"\n ></ax-button>\n }\n }\n <!-- ----- Summary step ----- -->\n @else if (flowStep() === 'summary') {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.done' | translate | async\"\n (onClick)=\"handleDone()\"\n ></ax-button>\n }\n </ax-suffix>\n</ax-footer>\n", styles: ["axm-form-template-viewer-popup{display:flex;height:100%;max-height:90vh;min-height:0px;width:100%;flex:1;flex-direction:column;overflow:hidden}@media(width>=64rem){axm-form-template-viewer-popup{max-height:75vh}}axm-form-template-viewer-popup .__content-area{min-height:0px}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXFormModule }, { kind: "component", type: i1$1.AXFormComponent, selector: "ax-form", inputs: ["disabled", "readonly", "labelMode", "look", "messageStyle", "updateOn", "inUserInteractionActive"], outputs: ["onValidate", "updateOnChange"] }, { kind: "ngmodule", type: AXPWidgetCoreModule }, { kind: "component", type: i1$2.AXPWidgetContainerComponent, selector: "axp-widgets-container", inputs: ["context", "functions"], outputs: ["onContextChanged"] }, { kind: "directive", type: i1$2.AXPWidgetRendererDirective, selector: "[axp-widget-renderer]", inputs: ["parentNode", "index", "mode", "node"], outputs: ["onOptionsChanged", "onValueChanged", "onLoad"], exportAs: ["widgetRenderer"] }, { kind: "component", type: AXMPreQuestionnaireContentComponent, selector: "axm-pre-questionnaire-content", inputs: ["content"] }, { kind: "component", type: AXMPostQuestionnaireContentComponent, selector: "axm-post-questionnaire-content", inputs: ["mode", "questionsWithAnswers", "reviewContext", "summaryContent", "placeholderValues", "locale", "showQuestionNumbers"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
214
+ }
215
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMFormTemplateViewerPopupComponent, decorators: [{
216
+ type: Component,
217
+ args: [{ selector: 'axm-form-template-viewer-popup', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
218
+ CommonModule,
219
+ AXTranslationModule,
220
+ AXButtonModule,
221
+ AXDecoratorModule,
222
+ AXFormModule,
223
+ AXPWidgetCoreModule,
224
+ AXMPreQuestionnaireContentComponent,
225
+ AXMPostQuestionnaireContentComponent,
226
+ ], providers: [
227
+ {
228
+ provide: AXP_LOCAL_DATA_SOURCE_STORE,
229
+ useFactory: (host) => createReadonlyLocalDataSourceStore(() => host.sources()),
230
+ deps: [AXMFormTemplateViewerPopupComponent],
231
+ },
232
+ ], template: "<div\n class=\"__content-area flex flex-1 min-h-0 flex-col\"\n [class.overflow-hidden]=\"flowStep() === 'form' || flowStep() === 'review'\"\n [class.overflow-y-auto]=\"flowStep() !== 'form' && flowStep() !== 'review'\"\n>\n <!-- ----- Welcome content before the form ----- -->\n @if (flowStep() === 'pre') {\n <axm-pre-questionnaire-content [content]=\"prePostConfig()?.pre?.content\"></axm-pre-questionnaire-content>\n }\n <!-- ----- Outcome results after submit ----- -->\n @else if (flowStep() === 'results') {\n <axm-post-questionnaire-content mode=\"results\" [placeholderValues]=\"submitResult()\"></axm-post-questionnaire-content>\n }\n <!-- ----- Summary content after submit ----- -->\n @else if (flowStep() === 'summary') {\n <div class=\"flex flex-col items-center justify-center p-8 min-h-[200px] text-on-surface\">\n <div class=\"max-w-2xl w-full prose text-on-surface\" [innerHTML]=\"summaryHtml()\"></div>\n </div>\n }\n <!-- ----- Form body, including readonly review ----- -->\n @else {\n <!-- ----- Review heading while the filled form is shown read-only ----- -->\n @if (flowStep() === 'review') {\n <div class=\"p-4 border-b border-surface\">\n <h2 class=\"text-lg font-semibold text-on-surface\">\n {{ '@form-template-management:templates.viewer.flow.review-title' | translate | async }}\n </h2>\n </div>\n }\n <div class=\"flex flex-1 min-h-0 flex-col overflow-y-auto overflow-x-hidden p-4\">\n <ax-form #form>\n <axp-widgets-container [context]=\"context\" (onContextChanged)=\"handleContextChanged($event)\">\n <ng-container axp-widget-renderer [node]=\"currentPage()\" [mode]=\"widgetMode()\"></ng-container>\n </axp-widgets-container>\n </ax-form>\n </div>\n }\n</div>\n\n<ax-footer class=\"__popup-footer flex-shrink-0 border-t px-4 py-3\">\n <ax-suffix>\n <!-- ----- Welcome step ----- -->\n @if (flowStep() === 'pre') {\n <ax-button\n [text]=\"'@general:actions.cancel.title' | translate | async\"\n (onClick)=\"handleCancel()\"\n ></ax-button>\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.start' | translate | async\"\n (onClick)=\"handleStart()\"\n ></ax-button>\n }\n <!-- ----- Fill step ----- -->\n @else if (flowStep() === 'form') {\n <ax-button\n [text]=\"'@general:actions.cancel.title' | translate | async\"\n (onClick)=\"handleCancel()\"\n ></ax-button>\n <!-- ----- Review before submit when post review is enabled ----- -->\n @if (showReviewButton()) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.review' | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleReviewClick()\"\n ></ax-button>\n }\n <!-- ----- Submit when review is off ----- -->\n @else if (showSubmitButton()) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"submitActionLabel() | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleSubmitClick()\"\n ></ax-button>\n }\n }\n <!-- ----- Review step ----- -->\n @else if (flowStep() === 'review') {\n <ax-button\n look=\"outline\"\n [text]=\"'@form-template-management:templates.viewer.flow.edit' | translate | async\"\n (onClick)=\"handleEdit()\"\n ></ax-button>\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"submitActionLabel() | translate | async\"\n [disabled]=\"isSubmitting()\"\n (onClick)=\"handleSubmitClick()\"\n ></ax-button>\n }\n <!-- ----- Outcome results step ----- -->\n @else if (flowStep() === 'results') {\n <!-- ----- Continue to the summary when it is enabled ----- -->\n @if (prePostConfig()?.post?.summaryEnabled) {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@general:actions.next.title' | translate | async\"\n (onClick)=\"handleResultsNext()\"\n ></ax-button>\n }\n <!-- ----- Close when there is no summary step ----- -->\n @else {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.done' | translate | async\"\n (onClick)=\"handleDone()\"\n ></ax-button>\n }\n }\n <!-- ----- Summary step ----- -->\n @else if (flowStep() === 'summary') {\n <ax-button\n look=\"solid\"\n color=\"primary\"\n [text]=\"'@form-template-management:templates.viewer.flow.done' | translate | async\"\n (onClick)=\"handleDone()\"\n ></ax-button>\n }\n </ax-suffix>\n</ax-footer>\n", styles: ["axm-form-template-viewer-popup{display:flex;height:100%;max-height:90vh;min-height:0px;width:100%;flex:1;flex-direction:column;overflow:hidden}@media(width>=64rem){axm-form-template-viewer-popup{max-height:75vh}}axm-form-template-viewer-popup .__content-area{min-height:0px}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"] }]
233
+ }], ctorParameters: () => [], propDecorators: { formRef: [{ type: i0.ViewChild, args: ['form', { isSignal: true }] }], config: [{
234
+ type: Input
235
+ }] } });
236
+
237
+ export { AXMFormTemplateViewerPopupComponent };
238
+ //# sourceMappingURL=acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-Cuq6_FfC.mjs.map