@acorex-platform/module-assessment-management-client 2.0.0-next.20 → 2.0.0-next.22
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-assessment-management-client-acorex-platform-module-assessment-management-client-clUYFK16.mjs → acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-5ECR73Eo.mjs} +326 -138
- package/fesm2022/acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-5ECR73Eo.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-oKEAM8zA.mjs → acorex-platform-module-assessment-management-client-assessment-voice.commands-DGcCkudt.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-oKEAM8zA.mjs.map → acorex-platform-module-assessment-management-client-assessment-voice.commands-DGcCkudt.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-question-bank-item.mjs +58 -7
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-question-bank-item.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-questionnaire.mjs +137 -8
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-questionnaire.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-CgUoWW8B.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-3F4p6ljC.mjs} +6 -6
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-CgUoWW8B.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-3F4p6ljC.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-GDJX71dY.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-CyWqUVBO.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-GDJX71dY.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-CyWqUVBO.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-tP9SU7u8.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-CnfnDCou.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-tP9SU7u8.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-CnfnDCou.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-BSXs6_z8.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-DTAhcFz1.mjs} +60 -9
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-DTAhcFz1.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-a63MvFoX.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-mSpjIACS.mjs} +139 -10
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-mSpjIACS.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-DWRFJCah.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-DqChTI6T.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-DWRFJCah.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-DqChTI6T.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog.mjs +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts.mjs +44 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-DRi6bK2i.mjs → acorex-platform-module-assessment-management-client-fill-assessment-session.command-DPoL2WXF.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-DRi6bK2i.mjs.map → acorex-platform-module-assessment-management-client-fill-assessment-session.command-DPoL2WXF.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-ByHoX67r.mjs → acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-DzLMXy9Y.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-ByHoX67r.mjs.map → acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-DzLMXy9Y.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer.service-BXa0_2G9.mjs → acorex-platform-module-assessment-management-client-form-template-viewer.service-0Fhk3cd6.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer.service-BXa0_2G9.mjs.map → acorex-platform-module-assessment-management-client-form-template-viewer.service-0Fhk3cd6.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-index-BMB2Htf1.mjs → acorex-platform-module-assessment-management-client-index-xC4NiE8P.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-index-BMB2Htf1.mjs.map → acorex-platform-module-assessment-management-client-index-xC4NiE8P.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-open-form-template.command-Cd2K2-GM.mjs → acorex-platform-module-assessment-management-client-open-form-template.command-xaDs3wr5.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-open-form-template.command-Cd2K2-GM.mjs.map → acorex-platform-module-assessment-management-client-open-form-template.command-xaDs3wr5.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-form-template.command-BJk6_haJ.mjs → acorex-platform-module-assessment-management-client-preview-form-template.command-CO_Z0X5u.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-form-template.command-BJk6_haJ.mjs.map → acorex-platform-module-assessment-management-client-preview-form-template.command-CO_Z0X5u.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-DWH4Nvo-.mjs → acorex-platform-module-assessment-management-client-preview-question.command-aNpcP2j-.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-DWH4Nvo-.mjs.map → acorex-platform-module-assessment-management-client-preview-question.command-aNpcP2j-.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-ZblqNQzw.mjs → acorex-platform-module-assessment-management-client-preview-questionnaire.command-CqAlLD06.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-ZblqNQzw.mjs.map → acorex-platform-module-assessment-management-client-preview-questionnaire.command-CqAlLD06.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-3eHfj_1n.mjs → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-j_TDGlON.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-3eHfj_1n.mjs.map → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-j_TDGlON.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-CctbSOfG.mjs → acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-LKydg7hM.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-CctbSOfG.mjs.map → acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-LKydg7hM.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-DD431Nru.mjs → acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-BKBBMXN9.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-DD431Nru.mjs.map → acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-BKBBMXN9.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-CjMCIExs.mjs → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-BLUdC219.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-CjMCIExs.mjs.map → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-BLUdC219.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-CebpEyUN.mjs → acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-CbmBo7Ve.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-CebpEyUN.mjs.map → acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-CbmBo7Ve.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-CGaUOa7I.mjs → acorex-platform-module-assessment-management-client-review-assessment-session.command-D2MyU3wd.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-CGaUOa7I.mjs.map → acorex-platform-module-assessment-management-client-review-assessment-session.command-D2MyU3wd.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-B58iMbgj.mjs → acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-CJ2EIOfz.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-B58iMbgj.mjs.map → acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-CJ2EIOfz.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-PG2CAV-I.mjs → acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-BVzSq-rX.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-PG2CAV-I.mjs.map → acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-BVzSq-rX.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command--e1ACDbF.mjs → acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command-CEjI6ebC.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command--e1ACDbF.mjs.map → acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command-CEjI6ebC.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-template-widget-edit.component-D7zOnGwK.mjs → acorex-platform-module-assessment-management-client-template-widget-edit.component-BSg5lWIS.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-template-widget-edit.component-D7zOnGwK.mjs.map → acorex-platform-module-assessment-management-client-template-widget-edit.component-BSg5lWIS.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-CzT6Iw5l.mjs → acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-BKdMZDZd.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-CzT6Iw5l.mjs.map → acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-BKdMZDZd.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-grid.component-BqKikmM8.mjs → acorex-platform-module-assessment-management-client-test-sheet-grid.component-BaBbL32O.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-grid.component-BqKikmM8.mjs.map → acorex-platform-module-assessment-management-client-test-sheet-grid.component-BaBbL32O.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-10mrzzqk.mjs → acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-C9B-HU4h.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-10mrzzqk.mjs.map → acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-C9B-HU4h.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component--4ywmLk9.mjs → acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component-DwB4tgSZ.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component--4ywmLk9.mjs.map → acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component-DwB4tgSZ.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-j-ClIxCR.mjs → acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-CbbpEr9W.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-j-ClIxCR.mjs.map → acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-CbbpEr9W.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet.util-DuWQlwcz.mjs → acorex-platform-module-assessment-management-client-test-sheet.util-DP8KRA3M.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet.util-DuWQlwcz.mjs.map → acorex-platform-module-assessment-management-client-test-sheet.util-DP8KRA3M.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-EAfaZgB8.mjs → acorex-platform-module-assessment-management-client-view-session-answers.command-BCmla5AS.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-EAfaZgB8.mjs.map → acorex-platform-module-assessment-management-client-view-session-answers.command-BCmla5AS.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client.mjs +1 -1
- package/i18n/en-AU/assessment-management.json +20 -1
- package/i18n/en-US/assessment-management.json +20 -1
- package/i18n/fa-IR/assessment-management.json +20 -1
- package/package.json +3 -3
- package/types/acorex-platform-module-assessment-management-client-contracts.d.ts +31 -3
- package/types/acorex-platform-module-assessment-management-client.d.ts +8 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-clUYFK16.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-BSXs6_z8.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-a63MvFoX.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-questionnaire.command-ZblqNQzw.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-questionnaire.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXMQuestionnaireViewerService } from '../../../features/questionnaire-viewer/questionnaire-viewer.service';\nimport {\n type AXMAssessmentManagementQuestionnaireEntityModel,\n toDisplaySettings,\n toPrePostConfig,\n toPrintSettings,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { formatQuestionnairePreviewDialogTitle } from '../utils/questionnaire-preview-title.util';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * Input for PreviewQuestionnaire command.\n */\nexport interface AXPPreviewQuestionnaireCommandInput {\n /**\n * Questionnaire ID to preview.\n */\n questionnaireId: string;\n\n /**\n * Questionnaire title (for display).\n */\n questionnaireTitle?: string;\n}\n\n/** Entity list passes evaluated action options on `options` (see entity-master-list view model). */\ntype AXPPreviewQuestionnaireCommandInvocation = AXPPreviewQuestionnaireCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<AXPPreviewQuestionnaireCommandInput> & Record<string, unknown>;\n};\n\n//#endregion\n\n//#region ---- Preview Questionnaire Command ----\n\n/**\n * Command that opens a preview of a questionnaire in a dialog.\n */\n@Injectable()\nexport class AXPPreviewQuestionnaireCommand implements AXPCommand<AXPPreviewQuestionnaireCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n /**\n * Resolves questionnaire id/title from root input or from entity action payload (`options` / row `data`).\n */\n private resolvePayload(input: AXPPreviewQuestionnaireCommandInvocation): AXPPreviewQuestionnaireCommandInput | null {\n const ctxOpts = input.options;\n const ctxData = input.data;\n\n const asNonEmptyString = (v: unknown): string | undefined =>\n typeof v === 'string' && v.length > 0 ? v : undefined;\n\n const asDisplayTitle = (v: unknown): string | undefined => {\n const s = asNonEmptyString(v);\n if (s) return s;\n if (v && typeof v === 'object') {\n const o = v as Record<string, unknown>;\n const fromTitle = o['title'];\n if (typeof fromTitle === 'string' && fromTitle.trim()) return fromTitle.trim();\n const fromName = o['name'];\n if (typeof fromName === 'string' && fromName.trim()) return fromName.trim();\n }\n return undefined;\n };\n\n const questionnaireId =\n asNonEmptyString(input.questionnaireId) ??\n asNonEmptyString(ctxOpts?.questionnaireId) ??\n (ctxData?.['id'] != null ? String(ctxData['id']) : undefined);\n\n if (!questionnaireId) {\n return null;\n }\n\n const questionnaireTitle =\n asDisplayTitle(input.questionnaireTitle) ??\n asDisplayTitle(ctxOpts?.questionnaireTitle) ??\n asDisplayTitle(ctxData?.['title']) ??\n asDisplayTitle(ctxData?.['name']);\n\n return { questionnaireId, questionnaireTitle };\n }\n\n async execute(input: AXPPreviewQuestionnaireCommandInvocation): AXPCommandExecuteResultPromise<void> {\n try {\n const resolved = this.resolvePayload(input);\n if (!resolved) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-questionnaire.errors.missing-id' },\n };\n }\n\n const { questionnaireId, questionnaireTitle } = resolved;\n\n // Get questionnaire data\n const questionnaire = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionnaire.name)\n .data<string, AXMAssessmentManagementQuestionnaireEntityModel>()\n .byKey(questionnaireId);\n\n if (!questionnaire) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-questionnaire.errors.not-found',\n { params: { questionnaireId } },\n ),\n },\n };\n }\n\n // Check if questionnaire has questions\n if (!questionnaire.questions || !questionnaire.questions.sections || questionnaire.questions.sections.length === 0) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-questionnaire.errors.no-questions' },\n };\n }\n\n // Get preview title\n const previewTitleKey = '@assessment-management:questionnaires.entities.questionnaire.actions.preview.title';\n const previewTitleBase = (await this.translationService.translateAsync(previewTitleKey)) || 'Preview';\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n const entityTitle = resolveMultiLanguageString(questionnaire.title, locale).trim();\n const displayTitle = questionnaireTitle?.trim() || entityTitle || undefined;\n const previewTitle = formatQuestionnairePreviewDialogTitle(previewTitleBase, displayTitle);\n\n const cfg = toPrePostConfig(questionnaire);\n const displaySettings = toDisplaySettings(questionnaire);\n const questions = questionnaire.questions;\n const structure = {\n sections: questions?.sections ?? [],\n displaySettings: displaySettings ?? undefined,\n printSettings: toPrintSettings(questionnaire) ?? undefined,\n };\n const result = await this.questionnaireViewerService.open({\n title: previewTitle,\n structure,\n prePostConfig: cfg,\n config: {\n previewMode: true,\n pdfPreview: true,\n completionMode: 'submit-only',\n viewMode: displaySettings?.viewMode,\n showProgressBar: displaySettings?.showProgressBar,\n timer: { showTimer: displaySettings?.showTimer ?? false },\n showQuestionNumbers: displaySettings?.showQuestionNumbers,\n validationStrategy: displaySettings?.validationStrategy,\n },\n questionnaireId,\n printTemplateId: asEntityId(questionnaire.printTemplateId),\n submitHandler: async (answers: Record<string, any>) =>\n this.questionnaireViewerService.buildSummaryPlaceholderValues(structure, answers, {\n questionnaireId,\n }),\n });\n\n if (result?.submitted && result.answers) {\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: 'Previewed', refresh: false },\n };\n }\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: 'Cancelled', refresh: false },\n };\n } catch (error: unknown) {\n const fallback = await this.translationService.translateAsync(\n '@general:messages.generic.error.description',\n );\n const message = error instanceof Error ? error.message : fallback;\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-questionnaire.errors.failed',\n { params: { message } },\n ),\n },\n };\n }\n }\n\n //#endregion\n}\n\nfunction asEntityId(value: unknown): string | undefined {\n if (typeof value === 'string' && value.trim()) {\n return value.trim();\n }\n if (value && typeof value === 'object' && 'id' in value) {\n return asEntityId((value as { id: unknown }).id);\n }\n return undefined;\n}\n\n//#endregion\n\n"],"names":[],"mappings":";;;;;;;AA2CA;AAEA;AAEA;;AAEG;MAEU,8BAA8B,CAAA;AAD3C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA2JnE,IAAA;;;AArJC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;QACH;IACF;8GA7JW,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA9B,8BAA8B,EAAA,CAAA,CAAA;;2FAA9B,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C;;AAmKD,SAAS,UAAU,CAAC,KAAc,EAAA;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE;AAC7C,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;IACA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,IAAI,KAAK,EAAE;AACvD,QAAA,OAAO,UAAU,CAAE,KAAyB,CAAC,EAAE,CAAC;IAClD;AACA,IAAA,OAAO,SAAS;AAClB;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-questionnaire.command-CqAlLD06.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-questionnaire.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXMQuestionnaireViewerService } from '../../../features/questionnaire-viewer/questionnaire-viewer.service';\nimport {\n type AXMAssessmentManagementQuestionnaireEntityModel,\n toDisplaySettings,\n toPrePostConfig,\n toPrintSettings,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { formatQuestionnairePreviewDialogTitle } from '../utils/questionnaire-preview-title.util';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * Input for PreviewQuestionnaire command.\n */\nexport interface AXPPreviewQuestionnaireCommandInput {\n /**\n * Questionnaire ID to preview.\n */\n questionnaireId: string;\n\n /**\n * Questionnaire title (for display).\n */\n questionnaireTitle?: string;\n}\n\n/** Entity list passes evaluated action options on `options` (see entity-master-list view model). */\ntype AXPPreviewQuestionnaireCommandInvocation = AXPPreviewQuestionnaireCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<AXPPreviewQuestionnaireCommandInput> & Record<string, unknown>;\n};\n\n//#endregion\n\n//#region ---- Preview Questionnaire Command ----\n\n/**\n * Command that opens a preview of a questionnaire in a dialog.\n */\n@Injectable()\nexport class AXPPreviewQuestionnaireCommand implements AXPCommand<AXPPreviewQuestionnaireCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n /**\n * Resolves questionnaire id/title from root input or from entity action payload (`options` / row `data`).\n */\n private resolvePayload(input: AXPPreviewQuestionnaireCommandInvocation): AXPPreviewQuestionnaireCommandInput | null {\n const ctxOpts = input.options;\n const ctxData = input.data;\n\n const asNonEmptyString = (v: unknown): string | undefined =>\n typeof v === 'string' && v.length > 0 ? v : undefined;\n\n const asDisplayTitle = (v: unknown): string | undefined => {\n const s = asNonEmptyString(v);\n if (s) return s;\n if (v && typeof v === 'object') {\n const o = v as Record<string, unknown>;\n const fromTitle = o['title'];\n if (typeof fromTitle === 'string' && fromTitle.trim()) return fromTitle.trim();\n const fromName = o['name'];\n if (typeof fromName === 'string' && fromName.trim()) return fromName.trim();\n }\n return undefined;\n };\n\n const questionnaireId =\n asNonEmptyString(input.questionnaireId) ??\n asNonEmptyString(ctxOpts?.questionnaireId) ??\n (ctxData?.['id'] != null ? String(ctxData['id']) : undefined);\n\n if (!questionnaireId) {\n return null;\n }\n\n const questionnaireTitle =\n asDisplayTitle(input.questionnaireTitle) ??\n asDisplayTitle(ctxOpts?.questionnaireTitle) ??\n asDisplayTitle(ctxData?.['title']) ??\n asDisplayTitle(ctxData?.['name']);\n\n return { questionnaireId, questionnaireTitle };\n }\n\n async execute(input: AXPPreviewQuestionnaireCommandInvocation): AXPCommandExecuteResultPromise<void> {\n try {\n const resolved = this.resolvePayload(input);\n if (!resolved) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-questionnaire.errors.missing-id' },\n };\n }\n\n const { questionnaireId, questionnaireTitle } = resolved;\n\n // Get questionnaire data\n const questionnaire = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionnaire.name)\n .data<string, AXMAssessmentManagementQuestionnaireEntityModel>()\n .byKey(questionnaireId);\n\n if (!questionnaire) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-questionnaire.errors.not-found',\n { params: { questionnaireId } },\n ),\n },\n };\n }\n\n // Check if questionnaire has questions\n if (!questionnaire.questions || !questionnaire.questions.sections || questionnaire.questions.sections.length === 0) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-questionnaire.errors.no-questions' },\n };\n }\n\n // Get preview title\n const previewTitleKey = '@assessment-management:questionnaires.entities.questionnaire.actions.preview.title';\n const previewTitleBase = (await this.translationService.translateAsync(previewTitleKey)) || 'Preview';\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n const entityTitle = resolveMultiLanguageString(questionnaire.title, locale).trim();\n const displayTitle = questionnaireTitle?.trim() || entityTitle || undefined;\n const previewTitle = formatQuestionnairePreviewDialogTitle(previewTitleBase, displayTitle);\n\n const cfg = toPrePostConfig(questionnaire);\n const displaySettings = toDisplaySettings(questionnaire);\n const questions = questionnaire.questions;\n const structure = {\n sections: questions?.sections ?? [],\n displaySettings: displaySettings ?? undefined,\n printSettings: toPrintSettings(questionnaire) ?? undefined,\n };\n const result = await this.questionnaireViewerService.open({\n title: previewTitle,\n structure,\n prePostConfig: cfg,\n config: {\n previewMode: true,\n pdfPreview: true,\n completionMode: 'submit-only',\n viewMode: displaySettings?.viewMode,\n showProgressBar: displaySettings?.showProgressBar,\n timer: { showTimer: displaySettings?.showTimer ?? false },\n showQuestionNumbers: displaySettings?.showQuestionNumbers,\n validationStrategy: displaySettings?.validationStrategy,\n },\n questionnaireId,\n printTemplateId: asEntityId(questionnaire.printTemplateId),\n submitHandler: async (answers: Record<string, any>) =>\n this.questionnaireViewerService.buildSummaryPlaceholderValues(structure, answers, {\n questionnaireId,\n }),\n });\n\n if (result?.submitted && result.answers) {\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: 'Previewed', refresh: false },\n };\n }\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: 'Cancelled', refresh: false },\n };\n } catch (error: unknown) {\n const fallback = await this.translationService.translateAsync(\n '@general:messages.generic.error.description',\n );\n const message = error instanceof Error ? error.message : fallback;\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-questionnaire.errors.failed',\n { params: { message } },\n ),\n },\n };\n }\n }\n\n //#endregion\n}\n\nfunction asEntityId(value: unknown): string | undefined {\n if (typeof value === 'string' && value.trim()) {\n return value.trim();\n }\n if (value && typeof value === 'object' && 'id' in value) {\n return asEntityId((value as { id: unknown }).id);\n }\n return undefined;\n}\n\n//#endregion\n\n"],"names":[],"mappings":";;;;;;;AA2CA;AAEA;AAEA;;AAEG;MAEU,8BAA8B,CAAA;AAD3C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA2JnE,IAAA;;;AArJC;;AAEG;AACK,IAAA,cAAc,CAAC,KAA+C,EAAA;AACpE,QAAA,MAAM,OAAO,GAAG,KAAK,CA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AAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA9B,8BAA8B,EAAA,CAAA,CAAA;;2FAA9B,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C;;AAmKD,SAAS,UAAU,CAAC,KAAc,EAAA;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE;AAC7C,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;IACA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,IAAI,KAAK,EAAE;AACvD,QAAA,OAAO,UAAU,CAAE,KAAyB,CAAC,EAAE,CAAC;IAClD;AACA,IAAA,OAAO,SAAS;AAClB;;"}
|
|
@@ -12,7 +12,7 @@ import { AsyncPipe } from '@angular/common';
|
|
|
12
12
|
import * as i0 from '@angular/core';
|
|
13
13
|
import { inject, computed, signal, model, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
14
14
|
import { isEqual } from 'lodash';
|
|
15
|
-
import { v as stripQuestionBankInterfaceMetadata, w as resolveWidgetNodeFromMetaDataDefinitionInterface } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-
|
|
15
|
+
import { v as stripQuestionBankInterfaceMetadata, w as resolveWidgetNodeFromMetaDataDefinitionInterface } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-5ECR73Eo.mjs';
|
|
16
16
|
import * as i2 from '@acorex/components/decorators';
|
|
17
17
|
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
18
18
|
|
|
@@ -376,7 +376,7 @@ class AXMQuestionBankInterfaceEditorWidgetEditComponent extends AXPValueWidgetCo
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
</div>
|
|
379
|
-
`, isInline: true, dependencies: [{ 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: "component", type: AXPWidgetFieldConfiguratorComponent, selector: "axp-widget-field-configurator", inputs: ["widget", "label", "fieldName", "fieldTitle", "readonly", "selectedItemIdModel", "valuesModel"], outputs: ["widgetChange", "selectedItemIdModelChange", "valuesModelChange"] }, { kind: "component", type: AXMetaDataConfiguratorComponent, selector: "axm-meta-data-configurator", inputs: ["items", "label", "definitionId", "fieldName", "fieldTitle", "readonly"], outputs: ["definitionIdChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i3.AXTranslatorPipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
379
|
+
`, isInline: true, dependencies: [{ 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: "component", type: AXPWidgetFieldConfiguratorComponent, selector: "axp-widget-field-configurator", inputs: ["widget", "label", "fieldName", "fieldTitle", "readonly", "selectedItemIdModel", "valuesModel", "nodeFieldsModel"], outputs: ["widgetChange", "selectedItemIdModelChange", "valuesModelChange", "nodeFieldsModelChange"] }, { kind: "component", type: AXMetaDataConfiguratorComponent, selector: "axm-meta-data-configurator", inputs: ["items", "label", "definitionId", "fieldName", "fieldTitle", "readonly"], outputs: ["definitionIdChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i3.AXTranslatorPipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
380
380
|
}
|
|
381
381
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMQuestionBankInterfaceEditorWidgetEditComponent, decorators: [{
|
|
382
382
|
type: Component,
|
|
@@ -486,4 +486,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
486
486
|
}], propDecorators: { definitionIdModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "definitionIdModel", required: false }] }, { type: i0.Output, args: ["definitionIdModelChange"] }], widgetConfigModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetConfigModel", required: false }] }, { type: i0.Output, args: ["widgetConfigModelChange"] }] } });
|
|
487
487
|
|
|
488
488
|
export { AXMQuestionBankInterfaceEditorWidgetEditComponent };
|
|
489
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-
|
|
489
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-j_TDGlON.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-3eHfj_1n.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-builder/questions/widgets/question-bank-interface-editor-widget/question-bank-interface-editor-widget-edit.component.ts"],"sourcesContent":["import { RootConfig as DataManagementRootConfig } from '@acorex-platform/module-data-management-client/contracts';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n//#region ---- Imports ----\n\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXButtonModule } from '@acorex/components/button';\nimport {\n AXTranslationModule,\n AXTranslationService,\n} from '@acorex/core/translation';\nimport { AXMetaDataConfiguratorComponent } from '@acorex-platform/module-data-management-client';\nimport { type AXMMetaDataDefinitionEntityModel } from '@acorex-platform/module-data-management-client/contracts';\nimport {\n AXPMultiLanguageString,\n type AXPWidgetNode,\n} from '@acorex-platform/framework-shared/core';\nimport { AXPWidgetFieldConfiguratorComponent } from '@acorex-platform/framework-client/layout/components';\nimport { AXPValueWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';\nimport { AsyncPipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n model,\n signal,\n untracked,\n} from '@angular/core';\nimport { isEqual } from 'lodash';\nimport {\n resolveWidgetNodeFromMetaDataDefinitionInterface,\n stripQuestionBankInterfaceMetadata,\n} from '../../../../entities/question-bank-item/question-bank-interface.utils';\nimport type {\n AXMQuestionBankItemInterfaceMetadata,\n AXMQuestionBankItemInterfaceValue,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\n//#endregion\n\n//#region ---- Helpers ----\n\nfunction hasMetadataProvenance(\n v: AXMQuestionBankItemInterfaceValue | null | undefined,\n): boolean {\n const id = v?.metadata?.id;\n return id != null && String(id).trim() !== '';\n}\n\nfunction hasConfiguredWidget(\n v: AXMQuestionBankItemInterfaceValue | null | undefined,\n): boolean {\n const w = stripQuestionBankInterfaceMetadata(v ?? undefined);\n const t = w?.type;\n return typeof t === 'string' && t.trim() !== '';\n}\n\n//#endregion\n\n//#region ---- Component ----\n\n@Component({\n selector: 'axm-question-bank-interface-editor-widget-edit',\n template: `\n <div class=\"flex flex-col gap-1\">\n @if (isInitialized()) {\n @if (showSourceChoice()) {\n <div class=\"flex flex-col gap-3\">\n <p class=\"text-sm text-neutral-700\">\n {{\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.empty-source.prompt'\n | translate\n | async\n }}\n </p>\n <div class=\"flex w-full gap-2\">\n <ax-button\n class=\"flex-1\"\n type=\"button\"\n look=\"twotone\"\n color=\"primary\"\n [disabled]=\"readonly()\"\n [text]=\"\n ('@assessment-management:question-bank.entities.question-bank-item.fields.interface.editor-mode-widget'\n | translate\n | async)!\n \"\n (onClick)=\"chooseWidgetSource()\"\n >\n <ax-icon icon=\"fa-solid fa-puzzle-piece\"></ax-icon>\n </ax-button>\n <ax-button\n class=\"flex-1\"\n type=\"button\"\n look=\"twotone\"\n color=\"secondary\"\n [disabled]=\"readonly()\"\n [text]=\"\n ('@assessment-management:question-bank.entities.question-bank-item.fields.interface.editor-mode-meta-data'\n | translate\n | async)!\n \"\n (onClick)=\"chooseMetadataSource()\"\n >\n <ax-icon icon=\"fa-light fa-database\"></ax-icon>\n </ax-button>\n </div>\n </div>\n } @else if (showReadonlyEmpty()) {\n <p class=\"text-sm text-neutral-600\">\n {{\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.empty-source.readonly'\n | translate\n | async\n }}\n </p>\n }\n @if (showWidgetEditor() || showMetaDataEditor()) {\n @if (showMetaDataEditor()) {\n <axm-meta-data-configurator\n [(definitionId)]=\"definitionIdModel\"\n [fieldName]=\"fieldName()\"\n [fieldTitle]=\"fieldTitle()\"\n [label]=\"metaDataConfiguratorLabel()\"\n [readonly]=\"readonly()\"\n ></axm-meta-data-configurator>\n } @else if (showWidgetEditor()) {\n <axp-widget-field-configurator\n [(widget)]=\"widgetConfigModel\"\n [fieldName]=\"fieldName()\"\n [fieldTitle]=\"fieldTitle()\"\n [label]=\"label()\"\n [readonly]=\"readonly()\"\n ></axp-widget-field-configurator>\n }\n <div class=\"flex justify-end ax-sm\">\n <ax-button\n look=\"twotone\"\n color=\"danger\"\n [disabled]=\"readonly()\"\n [text]=\"\n ('@assessment-management:question-bank.entities.question-bank-item.fields.interface.switch-source'\n | translate\n | async)!\n \"\n (onClick)=\"clearInterfaceConfiguration()\"\n >\n <ax-icon icon=\"fa-light fa-link-slash\"></ax-icon>\n </ax-button>\n </div>\n }\n }\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n AXButtonModule,\n AXPWidgetFieldConfiguratorComponent,\n AXMetaDataConfiguratorComponent,\n AXDecoratorModule,\n AXTranslationModule,\n AsyncPipe,\n ],\n})\nexport class AXMQuestionBankInterfaceEditorWidgetEditComponent extends AXPValueWidgetComponent<AXMQuestionBankItemInterfaceValue | null> {\n private readonly entityService = inject(AXPEntityService);\n //#region ---- Services ----\n\n private readonly translate = inject(AXTranslationService);\n private readonly toast = inject(AXToastService);\n private readonly metaDataDefinitionService = this.entityService\n .withEntity(\n DataManagementRootConfig.module.name,\n DataManagementRootConfig.entities.metaDataDefinition.name,\n )\n .data<any, any>();\n\n //#endregion\n\n //#region ---- Computed ----\n\n protected readonly = computed<boolean>(\n () => this.options()['readonly'] as boolean,\n );\n protected fieldName = computed<string>(() => {\n const fieldNameValue = this.options()['fieldName'];\n if (fieldNameValue !== undefined && fieldNameValue !== null) {\n const stringValue = String(fieldNameValue).trim();\n return stringValue || 'field';\n }\n return 'field';\n });\n protected fieldTitle = computed<AXPMultiLanguageString>(() => {\n const fieldTitleValue = this.options()['fieldTitle'];\n if (fieldTitleValue === undefined || fieldTitleValue === null) {\n return '';\n }\n if (\n typeof fieldTitleValue === 'object' &&\n !Array.isArray(fieldTitleValue)\n ) {\n return fieldTitleValue as Record<string, string>;\n }\n const stringValue = String(fieldTitleValue).trim();\n return stringValue;\n });\n protected label = computed<string>(\n () => (this.options()['label'] as string) || 'Widget Type',\n );\n protected metaDataConfiguratorLabel = computed(\n () =>\n (this.options()['metaDataConfiguratorLabel'] as string) ||\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.meta-data-configurator-label',\n );\n\n /** No widget type and no metadata definition binding — user must pick a configuration path. */\n protected interfaceIsUnset = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n return !hasMetadataProvenance(v) && !hasConfiguredWidget(v);\n });\n\n /** Widget-only path after save, or after the user chose “Widget” on an empty interface. */\n protected showWidgetEditor = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n if (hasMetadataProvenance(v)) {\n return false;\n }\n if (hasConfiguredWidget(v)) {\n return true;\n }\n return this.emptyFlowChoice() === 'widget';\n });\n\n /** Meta-data definition path after save, or after the user chose “MetaData definition” on an empty interface. */\n protected showMetaDataEditor = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n if (hasMetadataProvenance(v)) {\n return true;\n }\n if (!this.interfaceIsUnset()) {\n return false;\n }\n return this.emptyFlowChoice() === 'metadata';\n });\n\n protected showSourceChoice = computed<boolean>(\n () =>\n this.interfaceIsUnset() &&\n this.emptyFlowChoice() === null &&\n !this.readonly(),\n );\n\n protected showReadonlyEmpty = computed<boolean>(\n () =>\n this.interfaceIsUnset() &&\n this.emptyFlowChoice() === null &&\n this.readonly(),\n );\n\n //#endregion\n\n //#region ---- State ----\n\n protected isInitialized = signal(false);\n /** Set only while {@link interfaceIsUnset}; cleared once the value has a widget or metadata. */\n protected emptyFlowChoice = signal<'widget' | 'metadata' | null>(null);\n protected definitionIdModel = model<string>('');\n protected widgetConfigModel = model<AXPWidgetNode>({ type: '', options: {} });\n\n //#endregion\n\n //#region ---- Empty flow ----\n\n protected chooseWidgetSource(): void {\n if (this.readonly()) {\n return;\n }\n this.emptyFlowChoice.set('widget');\n }\n\n protected chooseMetadataSource(): void {\n if (this.readonly()) {\n return;\n }\n this.emptyFlowChoice.set('metadata');\n }\n\n /** Clears both widget config and metadata provenance, then returns to source chooser. */\n protected clearInterfaceConfiguration(): void {\n if (this.readonly()) {\n return;\n }\n untracked(() => {\n this.widgetConfigModel.set({ type: '', options: {} });\n this.definitionIdModel.set('');\n this.emptyFlowChoice.set(null);\n this.setValue(null);\n });\n }\n\n //#endregion\n\n //#region ---- Sync value ↔ configurator (preserve sibling metadata) ----\n\n private syncValueToConfigurator = effect(() => {\n const value = this.getValue();\n const widgetOnly = stripQuestionBankInterfaceMetadata(value ?? undefined);\n\n if (widgetOnly && widgetOnly.type) {\n const currentModel = untracked(() => this.widgetConfigModel());\n if (!isEqual(widgetOnly, currentModel)) {\n untracked(() => {\n this.widgetConfigModel.set(widgetOnly);\n this.isInitialized.set(true);\n });\n }\n } else {\n untracked(() => {\n if (!this.isInitialized()) {\n this.isInitialized.set(true);\n }\n });\n }\n });\n\n private clearEmptyFlowWhenConfigured = effect(() => {\n if (untracked(() => this.interfaceIsUnset())) {\n return;\n }\n untracked(() => {\n if (this.emptyFlowChoice() !== null) {\n this.emptyFlowChoice.set(null);\n }\n });\n });\n\n private syncConfiguratorToValue = effect(() => {\n const modelValue = this.widgetConfigModel();\n\n if (!untracked(() => this.isInitialized())) {\n return;\n }\n\n if (!modelValue || !modelValue.type) {\n return;\n }\n\n const full = untracked(() => this.getValue());\n const metadata =\n (full &&\n typeof full === 'object' &&\n (full as AXMQuestionBankItemInterfaceValue).metadata) ||\n undefined;\n\n const next: AXMQuestionBankItemInterfaceValue = metadata\n ? { ...modelValue, metadata }\n : (modelValue as AXMQuestionBankItemInterfaceValue);\n\n const currentFlat = untracked(() => this.getValue());\n if (!isEqual(next, currentFlat)) {\n untracked(() => {\n this.setValue(next);\n });\n }\n });\n\n private syncDefinitionIdFromValue = effect(() => {\n const value = this.getValue();\n const metaId = value?.metadata?.id;\n if (metaId != null && String(metaId) !== '') {\n const sid = String(metaId);\n if (untracked(() => this.definitionIdModel()) !== sid) {\n untracked(() => this.definitionIdModel.set(sid));\n }\n }\n });\n\n //#endregion\n\n //#region ---- Meta-data definition selection ----\n\n /** True while the meta-data configurator should be active (saved provenance or empty-flow metadata path). */\n private metadataFlowActive = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n if (hasMetadataProvenance(v)) {\n return true;\n }\n if (!this.interfaceIsUnset()) {\n return false;\n }\n return this.emptyFlowChoice() === 'metadata';\n });\n\n private applyMetadataDefinitionSelection = effect(() => {\n if (!this.metadataFlowActive()) {\n return;\n }\n if (!untracked(() => this.isInitialized())) {\n return;\n }\n const id = this.definitionIdModel();\n if (!id?.trim()) {\n return;\n }\n\n const current = untracked(() => this.getValue());\n if (current?.metadata?.id === id) {\n const stripped = stripQuestionBankInterfaceMetadata(current);\n if (stripped?.type) {\n return;\n }\n }\n\n if (this.readonly()) {\n return;\n }\n\n void this.loadAndApplyMetadataDefinition(id);\n });\n\n private async loadAndApplyMetadataDefinition(id: string): Promise<void> {\n try {\n const row = await this.metaDataDefinitionService.byKey(id);\n const resolved = await resolveWidgetNodeFromMetaDataDefinitionInterface(\n row.interface as AXMMetaDataDefinitionEntityModel['interface'],\n );\n if (!resolved?.type) {\n this.toast.danger(\n (await this.translate.translateAsync(\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.load-from-metadata-invalid',\n )) ??\n 'The selected metadata definition has no valid widget interface.',\n );\n return;\n }\n\n const titleRaw = row.title;\n const metadata: AXMQuestionBankItemInterfaceMetadata = {\n id: String(row.id ?? ''),\n name: String(row.name ?? ''),\n title: (typeof titleRaw === 'object' && titleRaw !== null\n ? titleRaw\n : String(titleRaw ?? '')) as AXPMultiLanguageString | string,\n version: 0,\n };\n\n const next: AXMQuestionBankItemInterfaceValue = {\n ...resolved,\n metadata,\n };\n\n untracked(() => {\n this.setValue(next);\n this.widgetConfigModel.set(resolved);\n });\n } catch (err) {\n console.error(\n '[QuestionBankInterfaceEditor] metadata definition load failed',\n err,\n );\n this.toast.danger(\n (await this.translate.translateAsync(\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.load-from-metadata-failed',\n )) ?? 'Could not load metadata definitions.',\n );\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["DataManagementRootConfig"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA;AAEA;AAEA,SAAS,qBAAqB,CAC5B,CAAuD,EAAA;AAEvD,IAAA,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE;AAC1B,IAAA,OAAO,EAAE,IA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A,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAGA,iDAAiD,EAAA,UAAA,EAAA,CAAA;kBAvG7D,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gDAAgD;AAC1D,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FT,EAAA,CAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,OAAO,EAAE;wBACP,cAAc;wBACd,mCAAmC;wBACnC,+BAA+B;wBAC/B,iBAAiB;wBACjB,mBAAmB;wBACnB,SAAS;AACV,qBAAA;AACF,iBAAA;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-j_TDGlON.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-builder/questions/widgets/question-bank-interface-editor-widget/question-bank-interface-editor-widget-edit.component.ts"],"sourcesContent":["import { RootConfig as DataManagementRootConfig } from '@acorex-platform/module-data-management-client/contracts';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n//#region ---- Imports ----\n\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXButtonModule } from '@acorex/components/button';\nimport {\n AXTranslationModule,\n AXTranslationService,\n} from '@acorex/core/translation';\nimport { AXMetaDataConfiguratorComponent } from '@acorex-platform/module-data-management-client';\nimport { type AXMMetaDataDefinitionEntityModel } from '@acorex-platform/module-data-management-client/contracts';\nimport {\n AXPMultiLanguageString,\n type AXPWidgetNode,\n} from '@acorex-platform/framework-shared/core';\nimport { AXPWidgetFieldConfiguratorComponent } from '@acorex-platform/framework-client/layout/components';\nimport { AXPValueWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';\nimport { AsyncPipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n model,\n signal,\n untracked,\n} from '@angular/core';\nimport { isEqual } from 'lodash';\nimport {\n resolveWidgetNodeFromMetaDataDefinitionInterface,\n stripQuestionBankInterfaceMetadata,\n} from '../../../../entities/question-bank-item/question-bank-interface.utils';\nimport type {\n AXMQuestionBankItemInterfaceMetadata,\n AXMQuestionBankItemInterfaceValue,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\n//#endregion\n\n//#region ---- Helpers ----\n\nfunction hasMetadataProvenance(\n v: AXMQuestionBankItemInterfaceValue | null | undefined,\n): boolean {\n const id = v?.metadata?.id;\n return id != null && String(id).trim() !== '';\n}\n\nfunction hasConfiguredWidget(\n v: AXMQuestionBankItemInterfaceValue | null | undefined,\n): boolean {\n const w = stripQuestionBankInterfaceMetadata(v ?? undefined);\n const t = w?.type;\n return typeof t === 'string' && t.trim() !== '';\n}\n\n//#endregion\n\n//#region ---- Component ----\n\n@Component({\n selector: 'axm-question-bank-interface-editor-widget-edit',\n template: `\n <div class=\"flex flex-col gap-1\">\n @if (isInitialized()) {\n @if (showSourceChoice()) {\n <div class=\"flex flex-col gap-3\">\n <p class=\"text-sm text-neutral-700\">\n {{\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.empty-source.prompt'\n | translate\n | async\n }}\n </p>\n <div class=\"flex w-full gap-2\">\n <ax-button\n class=\"flex-1\"\n type=\"button\"\n look=\"twotone\"\n color=\"primary\"\n [disabled]=\"readonly()\"\n [text]=\"\n ('@assessment-management:question-bank.entities.question-bank-item.fields.interface.editor-mode-widget'\n | translate\n | async)!\n \"\n (onClick)=\"chooseWidgetSource()\"\n >\n <ax-icon icon=\"fa-solid fa-puzzle-piece\"></ax-icon>\n </ax-button>\n <ax-button\n class=\"flex-1\"\n type=\"button\"\n look=\"twotone\"\n color=\"secondary\"\n [disabled]=\"readonly()\"\n [text]=\"\n ('@assessment-management:question-bank.entities.question-bank-item.fields.interface.editor-mode-meta-data'\n | translate\n | async)!\n \"\n (onClick)=\"chooseMetadataSource()\"\n >\n <ax-icon icon=\"fa-light fa-database\"></ax-icon>\n </ax-button>\n </div>\n </div>\n } @else if (showReadonlyEmpty()) {\n <p class=\"text-sm text-neutral-600\">\n {{\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.empty-source.readonly'\n | translate\n | async\n }}\n </p>\n }\n @if (showWidgetEditor() || showMetaDataEditor()) {\n @if (showMetaDataEditor()) {\n <axm-meta-data-configurator\n [(definitionId)]=\"definitionIdModel\"\n [fieldName]=\"fieldName()\"\n [fieldTitle]=\"fieldTitle()\"\n [label]=\"metaDataConfiguratorLabel()\"\n [readonly]=\"readonly()\"\n ></axm-meta-data-configurator>\n } @else if (showWidgetEditor()) {\n <axp-widget-field-configurator\n [(widget)]=\"widgetConfigModel\"\n [fieldName]=\"fieldName()\"\n [fieldTitle]=\"fieldTitle()\"\n [label]=\"label()\"\n [readonly]=\"readonly()\"\n ></axp-widget-field-configurator>\n }\n <div class=\"flex justify-end ax-sm\">\n <ax-button\n look=\"twotone\"\n color=\"danger\"\n [disabled]=\"readonly()\"\n [text]=\"\n ('@assessment-management:question-bank.entities.question-bank-item.fields.interface.switch-source'\n | translate\n | async)!\n \"\n (onClick)=\"clearInterfaceConfiguration()\"\n >\n <ax-icon icon=\"fa-light fa-link-slash\"></ax-icon>\n </ax-button>\n </div>\n }\n }\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n AXButtonModule,\n AXPWidgetFieldConfiguratorComponent,\n AXMetaDataConfiguratorComponent,\n AXDecoratorModule,\n AXTranslationModule,\n AsyncPipe,\n ],\n})\nexport class AXMQuestionBankInterfaceEditorWidgetEditComponent extends AXPValueWidgetComponent<AXMQuestionBankItemInterfaceValue | null> {\n private readonly entityService = inject(AXPEntityService);\n //#region ---- Services ----\n\n private readonly translate = inject(AXTranslationService);\n private readonly toast = inject(AXToastService);\n private readonly metaDataDefinitionService = this.entityService\n .withEntity(\n DataManagementRootConfig.module.name,\n DataManagementRootConfig.entities.metaDataDefinition.name,\n )\n .data<any, any>();\n\n //#endregion\n\n //#region ---- Computed ----\n\n protected readonly = computed<boolean>(\n () => this.options()['readonly'] as boolean,\n );\n protected fieldName = computed<string>(() => {\n const fieldNameValue = this.options()['fieldName'];\n if (fieldNameValue !== undefined && fieldNameValue !== null) {\n const stringValue = String(fieldNameValue).trim();\n return stringValue || 'field';\n }\n return 'field';\n });\n protected fieldTitle = computed<AXPMultiLanguageString>(() => {\n const fieldTitleValue = this.options()['fieldTitle'];\n if (fieldTitleValue === undefined || fieldTitleValue === null) {\n return '';\n }\n if (\n typeof fieldTitleValue === 'object' &&\n !Array.isArray(fieldTitleValue)\n ) {\n return fieldTitleValue as Record<string, string>;\n }\n const stringValue = String(fieldTitleValue).trim();\n return stringValue;\n });\n protected label = computed<string>(\n () => (this.options()['label'] as string) || 'Widget Type',\n );\n protected metaDataConfiguratorLabel = computed(\n () =>\n (this.options()['metaDataConfiguratorLabel'] as string) ||\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.meta-data-configurator-label',\n );\n\n /** No widget type and no metadata definition binding — user must pick a configuration path. */\n protected interfaceIsUnset = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n return !hasMetadataProvenance(v) && !hasConfiguredWidget(v);\n });\n\n /** Widget-only path after save, or after the user chose “Widget” on an empty interface. */\n protected showWidgetEditor = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n if (hasMetadataProvenance(v)) {\n return false;\n }\n if (hasConfiguredWidget(v)) {\n return true;\n }\n return this.emptyFlowChoice() === 'widget';\n });\n\n /** Meta-data definition path after save, or after the user chose “MetaData definition” on an empty interface. */\n protected showMetaDataEditor = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n if (hasMetadataProvenance(v)) {\n return true;\n }\n if (!this.interfaceIsUnset()) {\n return false;\n }\n return this.emptyFlowChoice() === 'metadata';\n });\n\n protected showSourceChoice = computed<boolean>(\n () =>\n this.interfaceIsUnset() &&\n this.emptyFlowChoice() === null &&\n !this.readonly(),\n );\n\n protected showReadonlyEmpty = computed<boolean>(\n () =>\n this.interfaceIsUnset() &&\n this.emptyFlowChoice() === null &&\n this.readonly(),\n );\n\n //#endregion\n\n //#region ---- State ----\n\n protected isInitialized = signal(false);\n /** Set only while {@link interfaceIsUnset}; cleared once the value has a widget or metadata. */\n protected emptyFlowChoice = signal<'widget' | 'metadata' | null>(null);\n protected definitionIdModel = model<string>('');\n protected widgetConfigModel = model<AXPWidgetNode>({ type: '', options: {} });\n\n //#endregion\n\n //#region ---- Empty flow ----\n\n protected chooseWidgetSource(): void {\n if (this.readonly()) {\n return;\n }\n this.emptyFlowChoice.set('widget');\n }\n\n protected chooseMetadataSource(): void {\n if (this.readonly()) {\n return;\n }\n this.emptyFlowChoice.set('metadata');\n }\n\n /** Clears both widget config and metadata provenance, then returns to source chooser. */\n protected clearInterfaceConfiguration(): void {\n if (this.readonly()) {\n return;\n }\n untracked(() => {\n this.widgetConfigModel.set({ type: '', options: {} });\n this.definitionIdModel.set('');\n this.emptyFlowChoice.set(null);\n this.setValue(null);\n });\n }\n\n //#endregion\n\n //#region ---- Sync value ↔ configurator (preserve sibling metadata) ----\n\n private syncValueToConfigurator = effect(() => {\n const value = this.getValue();\n const widgetOnly = stripQuestionBankInterfaceMetadata(value ?? undefined);\n\n if (widgetOnly && widgetOnly.type) {\n const currentModel = untracked(() => this.widgetConfigModel());\n if (!isEqual(widgetOnly, currentModel)) {\n untracked(() => {\n this.widgetConfigModel.set(widgetOnly);\n this.isInitialized.set(true);\n });\n }\n } else {\n untracked(() => {\n if (!this.isInitialized()) {\n this.isInitialized.set(true);\n }\n });\n }\n });\n\n private clearEmptyFlowWhenConfigured = effect(() => {\n if (untracked(() => this.interfaceIsUnset())) {\n return;\n }\n untracked(() => {\n if (this.emptyFlowChoice() !== null) {\n this.emptyFlowChoice.set(null);\n }\n });\n });\n\n private syncConfiguratorToValue = effect(() => {\n const modelValue = this.widgetConfigModel();\n\n if (!untracked(() => this.isInitialized())) {\n return;\n }\n\n if (!modelValue || !modelValue.type) {\n return;\n }\n\n const full = untracked(() => this.getValue());\n const metadata =\n (full &&\n typeof full === 'object' &&\n (full as AXMQuestionBankItemInterfaceValue).metadata) ||\n undefined;\n\n const next: AXMQuestionBankItemInterfaceValue = metadata\n ? { ...modelValue, metadata }\n : (modelValue as AXMQuestionBankItemInterfaceValue);\n\n const currentFlat = untracked(() => this.getValue());\n if (!isEqual(next, currentFlat)) {\n untracked(() => {\n this.setValue(next);\n });\n }\n });\n\n private syncDefinitionIdFromValue = effect(() => {\n const value = this.getValue();\n const metaId = value?.metadata?.id;\n if (metaId != null && String(metaId) !== '') {\n const sid = String(metaId);\n if (untracked(() => this.definitionIdModel()) !== sid) {\n untracked(() => this.definitionIdModel.set(sid));\n }\n }\n });\n\n //#endregion\n\n //#region ---- Meta-data definition selection ----\n\n /** True while the meta-data configurator should be active (saved provenance or empty-flow metadata path). */\n private metadataFlowActive = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n if (hasMetadataProvenance(v)) {\n return true;\n }\n if (!this.interfaceIsUnset()) {\n return false;\n }\n return this.emptyFlowChoice() === 'metadata';\n });\n\n private applyMetadataDefinitionSelection = effect(() => {\n if (!this.metadataFlowActive()) {\n return;\n }\n if (!untracked(() => this.isInitialized())) {\n return;\n }\n const id = this.definitionIdModel();\n if (!id?.trim()) {\n return;\n }\n\n const current = untracked(() => this.getValue());\n if (current?.metadata?.id === id) {\n const stripped = stripQuestionBankInterfaceMetadata(current);\n if (stripped?.type) {\n return;\n }\n }\n\n if (this.readonly()) {\n return;\n }\n\n void this.loadAndApplyMetadataDefinition(id);\n });\n\n private async loadAndApplyMetadataDefinition(id: string): Promise<void> {\n try {\n const row = await this.metaDataDefinitionService.byKey(id);\n const resolved = await resolveWidgetNodeFromMetaDataDefinitionInterface(\n row.interface as AXMMetaDataDefinitionEntityModel['interface'],\n );\n if (!resolved?.type) {\n this.toast.danger(\n (await this.translate.translateAsync(\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.load-from-metadata-invalid',\n )) ??\n 'The selected metadata definition has no valid widget interface.',\n );\n return;\n }\n\n const titleRaw = row.title;\n const metadata: AXMQuestionBankItemInterfaceMetadata = {\n id: String(row.id ?? ''),\n name: String(row.name ?? ''),\n title: (typeof titleRaw === 'object' && titleRaw !== null\n ? titleRaw\n : String(titleRaw ?? '')) as AXPMultiLanguageString | string,\n version: 0,\n };\n\n const next: AXMQuestionBankItemInterfaceValue = {\n ...resolved,\n metadata,\n };\n\n untracked(() => {\n this.setValue(next);\n this.widgetConfigModel.set(resolved);\n });\n } catch (err) {\n console.error(\n '[QuestionBankInterfaceEditor] metadata definition load failed',\n err,\n );\n this.toast.danger(\n (await this.translate.translateAsync(\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.load-from-metadata-failed',\n )) ?? 'Could not load metadata definitions.',\n );\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["DataManagementRootConfig"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA;AAEA;AAEA,SAAS,qBAAqB,CAC5B,CAAuD,EAAA;AAEvD,IAAA,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE;AAC1B,IAAA,OAAO,EAAE,IAAI,IAAI,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE;AAC/C;AAEA,SAAS,mBAAmB,CAC1B,CAAuD,EAAA;IAEvD,MAAM,CAAC,GAAG,kCAAkC,CAAC,CAAC,IAAI,SAAS,CAAC;AAC5D,IAAA,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI;IACjB,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FT,EAAA,CAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,OAAO,EAAE;wBACP,cAAc;wBACd,mCAAmC;wBACnC,+BAA+B;wBAC/B,iBAAiB;wBACjB,mBAAmB;wBACnB,SAAS;AACV,qBAAA;AACF,iBAAA;;;"}
|
|
@@ -4,7 +4,7 @@ import { toPrePostConfig, toDisplaySettings, toPrintSettings } from '@acorex-pla
|
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
5
|
import { inject, signal, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
6
6
|
import { isEqual } from 'lodash';
|
|
7
|
-
import { r as resolvePersistedEntityId, t as AXMQuestionnaireQuestionsBuilderComponent } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-
|
|
7
|
+
import { r as resolvePersistedEntityId, t as AXMQuestionnaireQuestionsBuilderComponent } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-5ECR73Eo.mjs';
|
|
8
8
|
|
|
9
9
|
//#region ----- Component -----
|
|
10
10
|
class AXMQuestionnaireQuestionsEditorEditComponent extends AXPValueWidgetComponent {
|
|
@@ -66,4 +66,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
66
66
|
}] });
|
|
67
67
|
|
|
68
68
|
export { AXMQuestionnaireQuestionsEditorEditComponent };
|
|
69
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-
|
|
69
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-LKydg7hM.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-LKydg7hM.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/content-display/questionnaire/questionnaire-questions-editor-edit.component.ts","../../../../libs/modules/assessment-management/client/src/lib/features/content-display/questionnaire/questionnaire-questions-editor-edit.component.html"],"sourcesContent":["import { resolveMultiLanguageString, AXTranslationService } from '@acorex/core/translation';\nimport { AXPValueWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';\nimport type { AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\nimport {\n toDisplaySettings,\n toPrePostConfig,\n toPrintSettings,\n type AXMAssessmentManagementQuestionnaireEntityModel,\n type QuestionnaireBuilderValue,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { isEqual } from 'lodash';\nimport { AXMQuestionnaireQuestionsBuilderComponent } from '../../questionnaire-builder/questions/builder/questionnaire-questions-builder.component';\nimport { resolvePersistedEntityId } from '../../questionnaire-builder/resolve-persisted-entity-id.util';\n\n//#region ----- Component -----\n\n@Component({\n selector: 'axm-questionnaire-questions-editor',\n templateUrl: './questionnaire-questions-editor-edit.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [AXMQuestionnaireQuestionsBuilderComponent],\n})\nexport class AXMQuestionnaireQuestionsEditorEditComponent extends AXPValueWidgetComponent<QuestionnaireBuilderValue | null> {\n //#region ----- Services & Dependencies -----\n\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ----- State Signals -----\n\n /** The builder emits a normalized value on init; that emission is not a user edit. */\n private readonly skipInitialEmit = signal(true);\n\n //#endregion\n\n //#region ----- Computed Properties -----\n\n protected readonly hostRecord = computed(\n () => this.contextService.snapshot() as Partial<AXMAssessmentManagementQuestionnaireEntityModel>,\n );\n\n protected readonly builderValue = computed<QuestionnaireBuilderValue | null>(() => {\n const value = this.getValue();\n return value != null && typeof value === 'object' ? value : null;\n });\n\n protected isReadonly(): boolean {\n return this.mode === 'view';\n }\n\n protected readonly prePostConfig = computed(() => toPrePostConfig(this.hostRecord()));\n\n protected readonly displaySettings = computed(() => toDisplaySettings(this.hostRecord()));\n\n protected readonly printSettings = computed(() => toPrintSettings(this.hostRecord()));\n\n protected readonly questionnaireEntityId = computed(() =>\n resolvePersistedEntityId(this.hostRecord() as Record<string, unknown>),\n );\n\n protected readonly questionnaireTitle = computed(() => {\n const title = this.hostRecord()['title'] as AXPMultiLanguageString | string | undefined;\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n const resolved = resolveMultiLanguageString(title, locale).trim();\n return resolved || undefined;\n });\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n protected onValueChange(value: QuestionnaireBuilderValue): void {\n if (this.skipInitialEmit()) {\n this.skipInitialEmit.set(false);\n return;\n }\n if (isEqual(this.getValue() ?? null, value ?? null)) {\n return;\n }\n this.setValue(value);\n }\n\n //#endregion\n}\n\n//#endregion\n","<!-- ----- Questions builder bound to the host record field ----- -->\n<axm-questionnaire-questions-builder\n [value]=\"builderValue()\"\n [readonly]=\"isReadonly()\"\n [prePostConfig]=\"prePostConfig()\"\n [displaySettingsInput]=\"displaySettings()\"\n [printSettingsInput]=\"printSettings()\"\n [questionnaireEntityId]=\"questionnaireEntityId()\"\n [questionnaireTitle]=\"questionnaireTitle()\"\n [showHeader]=\"true\"\n (valueChange)=\"onValueChange($event)\"\n>\n</axm-questionnaire-questions-builder>\n"],"names":[],"mappings":";;;;;;;;AAeA;AAQM,MAAO,4CAA6C,SAAQ,uBAAyD,CAAA;AAN3H,IAAA,WAAA,GAAA;;;AASmB,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;;;;QAOjD,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,IAAI;4FAAC;;;QAM5B,IAAA,CAAA,UAAU,GAAG,QAAQ,CACtC,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,EAA8D;uFACjG;AAEkB,QAAA,IAAA,CAAA,YAAY,GAAG,QAAQ,CAAm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AQ,EAAE,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,CAAC,EAAE;YACnD;QACF;AACA,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;IACtB;8GA3DW,4CAA4C,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA5C,4CAA4C,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,oCAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECvBzD,sgBAaA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDQY,yCAAyC,EAAA,QAAA,EAAA,qCAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,UAAA,EAAA,eAAA,EAAA,YAAA,EAAA,sBAAA,EAAA,oBAAA,EAAA,uBAAA,EAAA,oBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,aAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAExC,4CAA4C,EAAA,UAAA,EAAA,CAAA;kBANxD,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,oCAAoC,mBAE7B,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC,CAAC,yCAAyC,CAAC,EAAA,QAAA,EAAA,sgBAAA,EAAA;;;"}
|
|
@@ -3,7 +3,7 @@ import { AXPValueWidgetComponent } from '@acorex-platform/framework-client/layou
|
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { signal, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
5
|
import { isEqual, isPlainObject } from 'lodash-es';
|
|
6
|
-
import { m as AXMQuestionnaireViewerComponent } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-
|
|
6
|
+
import { m as AXMQuestionnaireViewerComponent } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-5ECR73Eo.mjs';
|
|
7
7
|
|
|
8
8
|
//#region ----- Component -----
|
|
9
9
|
class AXMQuestionnaireViewerEditComponent extends AXPValueWidgetComponent {
|
|
@@ -75,4 +75,4 @@ function parseQuestionnaireStructure(value) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export { AXMQuestionnaireViewerEditComponent };
|
|
78
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-
|
|
78
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-BKBBMXN9.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-BKBBMXN9.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/content-display/questionnaire-viewer/questionnaire-viewer-edit.component.ts","../../../../libs/modules/assessment-management/client/src/lib/features/content-display/questionnaire-viewer/questionnaire-viewer-edit.component.html"],"sourcesContent":["import { AXPStateMessageComponent } from '@acorex-platform/framework-client/layout/components';\nimport { AXPValueWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';\nimport type { QuestionnaireBuilderValue } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { ChangeDetectionStrategy, Component, effect, OnInit, signal, untracked } from '@angular/core';\nimport { isEqual, isPlainObject } from 'lodash-es';\nimport { AXMQuestionnaireViewerComponent } from '../../questionnaire-viewer/components/viewer-container';\nimport type { QuestionnaireViewerConfig } from '../../questionnaire-viewer/questionnaire-viewer.types';\n\n//#region ----- Component -----\n\n@Component({\n selector: 'axm-related-questionnaire-viewer',\n templateUrl: './questionnaire-viewer-edit.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [AXMQuestionnaireViewerComponent, AXPStateMessageComponent],\n})\nexport class AXMQuestionnaireViewerEditComponent\n extends AXPValueWidgetComponent<Record<string, unknown> | null>\n implements OnInit\n{\n //#region ----- State Signals -----\n\n protected readonly structure = signal<QuestionnaireBuilderValue | null>(null);\n protected readonly initialAnswers = signal<Record<string, any>>({});\n protected readonly viewerConfig = signal<QuestionnaireViewerConfig>({ readonly: false });\n private readonly userEdited = signal(false);\n\n //#endregion\n\n //#region ----- Lifecycle -----\n\n constructor() {\n super();\n effect(() => {\n const next = parseQuestionnaireStructure(this.options()['structure']);\n const value = this.getValue();\n untracked(() => {\n const structureChanged = !isEqual(next, this.structure());\n if (structureChanged) {\n this.structure.set(next);\n this.userEdited.set(false);\n }\n if (!this.userEdited() && next) {\n const answers = isPlainObject(value) ? { ...value } : {};\n if (!isEqual(answers, this.initialAnswers())) {\n this.initialAnswers.set(answers);\n }\n }\n });\n });\n }\n\n override ngOnInit(): void {\n super.ngOnInit();\n this.viewerConfig.set({ readonly: this.mode === 'view' });\n }\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n protected handleAnswers(answers: Record<string, any>): void {\n if (this.mode === 'view') {\n return;\n }\n if (isEqual(answers, this.initialAnswers()) || isEqual(answers, this.getValue())) {\n return;\n }\n this.userEdited.set(true);\n this.setValue(answers);\n }\n\n //#endregion\n}\n\n//#endregion\n\n//#region ----- Helpers -----\n\nfunction parseQuestionnaireStructure(value: unknown): QuestionnaireBuilderValue | null {\n if (!value || typeof value !== 'object') {\n return null;\n }\n const sections = (value as QuestionnaireBuilderValue).sections;\n if (!Array.isArray(sections) || sections.length === 0) {\n return null;\n }\n return value as QuestionnaireBuilderValue;\n}\n\n//#endregion\n","@if (structure(); as structure) {\n <!-- ----- Related questionnaire, answers stored on this record ----- -->\n <axm-questionnaire-viewer\n [structure]=\"structure\"\n [config]=\"viewerConfig()\"\n [initialAnswers]=\"initialAnswers()\"\n (answersChanged)=\"handleAnswers($event)\"\n ></axm-questionnaire-viewer>\n}\n<!-- ----- Empty state when the related record has no questions ----- -->\n@else {\n <axp-state-message\n icon=\"fa-light fa-list-check\"\n [title]=\"'@assessment-management:questionnaires.components.questionnaire-viewer.empty.title'\"\n [description]=\"'@assessment-management:questionnaires.components.questionnaire-viewer.empty.description'\"\n ></axp-state-message>\n}\n"],"names":[],"mappings":";;;;;;;AAQA;AAQM,MAAO,mCACX,SAAQ,uBAAuD,CAAA;;;AAc/D,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;;QAVU,IAAA,CAAA,SAAS,GAAG,MAAM,CAAmC,IAAI;sFAAC;QAC1D,IAAA,CAAA,cAAc,GAAG,MAAM,CAAsB,EAAE;2FAAC;AAChD,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAA4B,EAAE,QAAQ,EAAE,KAAK,EAAE;yFAAC;QACvE,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,KAAK;uFAAC;QAQzC,MAAM,CAAC,MAAK;AACV,YAAA,MAAM,IAAI,GAAG,2BAA2B,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,CAAC;AACrE,YAAA,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE;YAC7B,SAAS,CAAC,MAAK;AACb,gBAAA,MAAM,gBAAgB,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;gBACzD,IAAI,gBAAgB,EAAE;AACpB,oBAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;AACxB,oBAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC;gBAC5B;gBACA,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,IAAI,EAAE;AAC9B,oBAAA,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE;oBACxD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,EAAE;AAC5C,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EAAA,MAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAExD,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAN/C,SAAS;+BACE,kCAAkC,EAAA,eAAA,EAE3B,uBAAuB,CAAC,MAAM,WACtC,CAAC,+BAA+B,EAAE,wBAAwB,CAAC,EAAA,QAAA,EAAA,8sBAAA,EAAA;;AA6DtE;AAEA;AAEA,SAAS,2BAA2B,CAAC,KAAc,EAAA;IACjD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACvC,QAAA,OAAO,IAAI;IACb;AACA,IAAA,MAAM,QAAQ,GAAI,KAAmC,CAAC,QAAQ;AAC9D,IAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACrD,QAAA,OAAO,IAAI;IACb;AACA,IAAA,OAAO,KAAkC;AAC3C;;"}
|
|
@@ -16,7 +16,7 @@ import * as i0 from '@angular/core';
|
|
|
16
16
|
import { inject, input, computed, signal, viewChild, effect, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
17
17
|
import { first } from 'lodash';
|
|
18
18
|
import { AXMAssessmentManagementFeatureKeys, RootConfig, resolvePrintSettings, AXM_ASSESSMENT_SESSION_PREVIEW_PDF_CLIENT_COMMAND_KEY } from '@acorex-platform/module-assessment-management-client/contracts';
|
|
19
|
-
import { h as AXMQuestionnaireViewerService, k as AXMQuestionnairePrintSnapshotService, l as AXMQuestionnairePrintHostComponent, p as persistAssessmentSession, m as AXMQuestionnaireViewerComponent, n as AXMQuestionnaireViewerQuestionnaireAttachmentsFooterComponent, o as AXMPreQuestionnaireContentComponent, q as AXMPostQuestionnaireContentComponent } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-
|
|
19
|
+
import { h as AXMQuestionnaireViewerService, k as AXMQuestionnairePrintSnapshotService, l as AXMQuestionnairePrintHostComponent, p as persistAssessmentSession, m as AXMQuestionnaireViewerComponent, n as AXMQuestionnaireViewerQuestionnaireAttachmentsFooterComponent, o as AXMPreQuestionnaireContentComponent, q as AXMPostQuestionnaireContentComponent } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-5ECR73Eo.mjs';
|
|
20
20
|
|
|
21
21
|
//#region ---- Imports ----
|
|
22
22
|
//#endregion
|
|
@@ -611,4 +611,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
611
611
|
}], ctorParameters: () => [], propDecorators: { structure: [{ type: i0.Input, args: [{ isSignal: true, alias: "structure", required: true }] }], prePostConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "prePostConfig", required: false }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }], initialAnswers: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialAnswers", required: false }] }], submitHandler: [{ type: i0.Input, args: [{ isSignal: true, alias: "submitHandler", required: false }] }], saveHandler: [{ type: i0.Input, args: [{ isSignal: true, alias: "saveHandler", required: false }] }], assessmentFillContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "assessmentFillContext", required: false }] }], questionnaireId: [{ type: i0.Input, args: [{ isSignal: true, alias: "questionnaireId", required: false }] }], printTemplateId: [{ type: i0.Input, args: [{ isSignal: true, alias: "printTemplateId", required: false }] }], outcomeRules: [{ type: i0.Input, args: [{ isSignal: true, alias: "outcomeRules", required: false }] }], storedOutcomeResults: [{ type: i0.Input, args: [{ isSignal: true, alias: "storedOutcomeResults", required: false }] }], printTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "printTitle", required: false }] }], viewer: [{ type: i0.ViewChild, args: ['viewer', { isSignal: true }] }], printHost: [{ type: i0.ViewChild, args: [i0.forwardRef(() => AXMQuestionnairePrintHostComponent), { isSignal: true }] }] } });
|
|
612
612
|
|
|
613
613
|
export { AXMQuestionnaireViewerPopupComponent };
|
|
614
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-
|
|
614
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-BLUdC219.mjs.map
|