@acorex-platform/module-assessment-management-client 0.0.58 → 0.0.59
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-DxRFMK3k.mjs → acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-sm_OxV_k.mjs} +63 -63
- package/fesm2022/{acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs.map → acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-sm_OxV_k.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-DGYCwZ7v.mjs → acorex-platform-module-assessment-management-client-assessment-voice.commands-6Hw6NQgS.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-DGYCwZ7v.mjs.map → acorex-platform-module-assessment-management-client-assessment-voice.commands-6Hw6NQgS.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-DY_9qPYh.mjs → acorex-platform-module-assessment-management-client-fill-assessment-session.command-BOzXBvS2.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-DY_9qPYh.mjs.map → acorex-platform-module-assessment-management-client-fill-assessment-session.command-BOzXBvS2.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-CeLpGSGc.mjs → acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-BU6YLe8q.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-CeLpGSGc.mjs.map → acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-BU6YLe8q.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer.service-DoO7ZQmw.mjs → acorex-platform-module-assessment-management-client-form-template-viewer.service-CZre8wPB.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer.service-DoO7ZQmw.mjs.map → acorex-platform-module-assessment-management-client-form-template-viewer.service-CZre8wPB.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-index-er5gI6QK.mjs → acorex-platform-module-assessment-management-client-index-BmODQqQ4.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-index-er5gI6QK.mjs.map → acorex-platform-module-assessment-management-client-index-BmODQqQ4.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-open-form-template.command-Cz23Vkyv.mjs → acorex-platform-module-assessment-management-client-open-form-template.command-C9BMiyDb.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-open-form-template.command-Cz23Vkyv.mjs.map → acorex-platform-module-assessment-management-client-open-form-template.command-C9BMiyDb.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-form-template.command-DDQOvVpt.mjs → acorex-platform-module-assessment-management-client-preview-form-template.command-L5NxVqdE.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-form-template.command-DDQOvVpt.mjs.map → acorex-platform-module-assessment-management-client-preview-form-template.command-L5NxVqdE.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-D4YlqMUf.mjs → acorex-platform-module-assessment-management-client-preview-question.command-7GuqlVX4.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-D4YlqMUf.mjs.map → acorex-platform-module-assessment-management-client-preview-question.command-7GuqlVX4.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-BYh-3EP9.mjs → acorex-platform-module-assessment-management-client-preview-questionnaire.command-ChtB6q9D.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-BYh-3EP9.mjs.map → acorex-platform-module-assessment-management-client-preview-questionnaire.command-ChtB6q9D.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-DARYq7ZJ.mjs → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-Iwdbc86Q.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-DARYq7ZJ.mjs.map → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-Iwdbc86Q.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-DIktPLmP.mjs → acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-Q6Wu81xW.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-DIktPLmP.mjs.map → acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-Q6Wu81xW.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-BAoqjZ7K.mjs → acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-CaKML07K.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-BAoqjZ7K.mjs.map → acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-CaKML07K.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-O-d2f3fv.mjs → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-xDX86cTn.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-O-d2f3fv.mjs.map → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-xDX86cTn.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-D0Rkeywu.mjs → acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-CiMERtrE.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-D0Rkeywu.mjs.map → acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-CiMERtrE.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-CHeyD-AC.mjs → acorex-platform-module-assessment-management-client-review-assessment-session.command-CfqUtmMt.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-CHeyD-AC.mjs.map → acorex-platform-module-assessment-management-client-review-assessment-session.command-CfqUtmMt.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-DlpkbJCZ.mjs → acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-BZxwRr8J.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-DlpkbJCZ.mjs.map → acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-BZxwRr8J.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-t67ngnrD.mjs → acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-hrtJQmvG.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-t67ngnrD.mjs.map → acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-hrtJQmvG.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command-DHgNcZ60.mjs → acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command-CMUmrNac.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command-DHgNcZ60.mjs.map → acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command-CMUmrNac.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-template-widget-edit.component-3DZovs7s.mjs → acorex-platform-module-assessment-management-client-template-widget-edit.component-BhW_Wn7N.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-template-widget-edit.component-3DZovs7s.mjs.map → acorex-platform-module-assessment-management-client-template-widget-edit.component-BhW_Wn7N.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-DRFfLOCE.mjs → acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-Dkaw3T8R.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-DRFfLOCE.mjs.map → acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-Dkaw3T8R.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-grid.component-DENxbikr.mjs → acorex-platform-module-assessment-management-client-test-sheet-grid.component-BCRIENMA.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-grid.component-DENxbikr.mjs.map → acorex-platform-module-assessment-management-client-test-sheet-grid.component-BCRIENMA.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-Bcvp2Dx5.mjs → acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-CFu_CQ91.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-Bcvp2Dx5.mjs.map → acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-CFu_CQ91.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component-CrvzEcSh.mjs → acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component-DdC83GV8.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component-CrvzEcSh.mjs.map → acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component-DdC83GV8.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-sSky9nAq.mjs → acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-OQZIzcjG.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-sSky9nAq.mjs.map → acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-OQZIzcjG.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet.util-T-kPrzoj.mjs → acorex-platform-module-assessment-management-client-test-sheet.util-CPbgWk5E.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-test-sheet.util-T-kPrzoj.mjs.map → acorex-platform-module-assessment-management-client-test-sheet.util-CPbgWk5E.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-CxZirYRJ.mjs → acorex-platform-module-assessment-management-client-view-session-answers.command-YoUUyJ4j.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-CxZirYRJ.mjs.map → acorex-platform-module-assessment-management-client-view-session-answers.command-YoUUyJ4j.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client.mjs +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-question.command-D4YlqMUf.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-question.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementQuestionBankItemEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { QuestionnaireBuilderValue } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * Input for PreviewQuestion command.\n * Pass id to load the question bank item (title and structure come from the item).\n * Or pass pre-built structure (e.g. from builder) with optional title.\n */\nexport interface PreviewQuestionCommandInput {\n /** Question bank item id. */\n id?: string;\n /** Pre-built structure; when set, id is not required. */\n structure?: QuestionnaireBuilderValue;\n /** Dialog title when using pre-built structure. */\n title?: string;\n data?: Record<string, unknown>;\n options?: Record<string, unknown>;\n}\n\n//#endregion\n\n//#region ---- Preview Question Command ----\n\n/**\n * Command that opens a preview of a single question in a dialog.\n * Used from the questionnaire builder per-question primary action.\n */\n@Injectable()\nexport class PreviewQuestionCommand implements AXPCommand<PreviewQuestionCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n private resolveId(input: PreviewQuestionCommandInput): string | undefined {\n const record = input as Record<string, unknown>;\n const ctxData = input.data as Record<string, unknown> | undefined;\n const ctxOptions = input.options as Record<string, unknown> | undefined;\n const asString = (v: unknown): string | undefined => (typeof v === 'string' && v.length > 0 ? v : undefined);\n return (\n asString(input.id) ??\n asString(record['questionBankItemId']) ??\n asString(ctxOptions?.['questionBankItemId']) ??\n asString(ctxData?.['id']) ??\n asString(record['id'])\n );\n }\n\n async execute(input: PreviewQuestionCommandInput): AXPCommandExecuteResultPromise<void> {\n try {\n const id = this.resolveId(input);\n let structure: QuestionnaireBuilderValue | undefined = input.structure;\n let title = input.title;\n\n if (id) {\n const item = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionBankItem.name)\n .data<string, AXMAssessmentManagementQuestionBankItemEntityModel>()\n .byKey(id);\n if (!item) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.not-found' },\n };\n }\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n const resolvedListTitle = resolveMultiLanguageString(item.title, locale);\n structure = {\n sections: [\n {\n name: `preview-section-${item.id}`,\n title: resolvedListTitle || 'Question',\n description: undefined,\n order: 0,\n items: [\n {\n name: String(item.id),\n questionBankItemId: item.id,\n order: 0,\n isRequired: false,\n interfaceOverride: item.interface,\n } as QuestionnaireBuilderValue['sections'][0]['items'][0],\n ],\n },\n ],\n displaySettings: {\n viewMode: 'single-page',\n showProgressBar: false,\n showQuestionNumbers: false,\n },\n };\n title = resolvedListTitle || undefined;\n }\n\n if (!structure?.sections?.length) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.no-structure' },\n };\n }\n\n const totalQuestions =\n structure.sections?.reduce((s: number, sec: { items?: unknown[] }) => s + (sec.items?.length ?? 0), 0) ?? 0;\n if (totalQuestions === 0) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.no-question' },\n };\n }\n\n const previewTitleKey = '@assessment-management:question-bank.entities.question-bank-item.actions.preview.title';\n const defaultTitle = (await this.translationService.translateAsync(previewTitleKey)) || 'Preview';\n const dialogTitle = title?.trim() || defaultTitle;\n\n await this.questionnaireViewerService.open({\n title: dialogTitle,\n structure,\n config: { previewMode: true },\n });\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n message: { text: '' },\n metadata: { 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-question.errors.failed',\n { params: { message } },\n ),\n },\n };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAiCA;AAEA;AAEA;;;AAGG;MAEU,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,0BAA0B,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EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CACxB;AACF,iBAAA;aACF;QACH;IACF;8GAvHW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAtB,sBAAsB,EAAA,CAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-question.command-7GuqlVX4.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-question.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementQuestionBankItemEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { QuestionnaireBuilderValue } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * Input for PreviewQuestion command.\n * Pass id to load the question bank item (title and structure come from the item).\n * Or pass pre-built structure (e.g. from builder) with optional title.\n */\nexport interface PreviewQuestionCommandInput {\n /** Question bank item id. */\n id?: string;\n /** Pre-built structure; when set, id is not required. */\n structure?: QuestionnaireBuilderValue;\n /** Dialog title when using pre-built structure. */\n title?: string;\n data?: Record<string, unknown>;\n options?: Record<string, unknown>;\n}\n\n//#endregion\n\n//#region ---- Preview Question Command ----\n\n/**\n * Command that opens a preview of a single question in a dialog.\n * Used from the questionnaire builder per-question primary action.\n */\n@Injectable()\nexport class PreviewQuestionCommand implements AXPCommand<PreviewQuestionCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n private resolveId(input: PreviewQuestionCommandInput): string | undefined {\n const record = input as Record<string, unknown>;\n const ctxData = input.data as Record<string, unknown> | undefined;\n const ctxOptions = input.options as Record<string, unknown> | undefined;\n const asString = (v: unknown): string | undefined => (typeof v === 'string' && v.length > 0 ? v : undefined);\n return (\n asString(input.id) ??\n asString(record['questionBankItemId']) ??\n asString(ctxOptions?.['questionBankItemId']) ??\n asString(ctxData?.['id']) ??\n asString(record['id'])\n );\n }\n\n async execute(input: PreviewQuestionCommandInput): AXPCommandExecuteResultPromise<void> {\n try {\n const id = this.resolveId(input);\n let structure: QuestionnaireBuilderValue | undefined = input.structure;\n let title = input.title;\n\n if (id) {\n const item = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionBankItem.name)\n .data<string, AXMAssessmentManagementQuestionBankItemEntityModel>()\n .byKey(id);\n if (!item) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.not-found' },\n };\n }\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n const resolvedListTitle = resolveMultiLanguageString(item.title, locale);\n structure = {\n sections: [\n {\n name: `preview-section-${item.id}`,\n title: resolvedListTitle || 'Question',\n description: undefined,\n order: 0,\n items: [\n {\n name: String(item.id),\n questionBankItemId: item.id,\n order: 0,\n isRequired: false,\n interfaceOverride: item.interface,\n } as QuestionnaireBuilderValue['sections'][0]['items'][0],\n ],\n },\n ],\n displaySettings: {\n viewMode: 'single-page',\n showProgressBar: false,\n showQuestionNumbers: false,\n },\n };\n title = resolvedListTitle || undefined;\n }\n\n if (!structure?.sections?.length) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.no-structure' },\n };\n }\n\n const totalQuestions =\n structure.sections?.reduce((s: number, sec: { items?: unknown[] }) => s + (sec.items?.length ?? 0), 0) ?? 0;\n if (totalQuestions === 0) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.no-question' },\n };\n }\n\n const previewTitleKey = '@assessment-management:question-bank.entities.question-bank-item.actions.preview.title';\n const defaultTitle = (await this.translationService.translateAsync(previewTitleKey)) || 'Preview';\n const dialogTitle = title?.trim() || defaultTitle;\n\n await this.questionnaireViewerService.open({\n title: dialogTitle,\n structure,\n config: { previewMode: true },\n });\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n message: { text: '' },\n metadata: { 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-question.errors.failed',\n { params: { message } },\n ),\n },\n };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAiCA;AAEA;AAEA;;;AAGG;MAEU,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAqHnE,IAAA;;;AA/GS,IAAA,SAAS,CAAC,KAAkC,EAAA;QAClD,MAAM,MAAM,GAAG,KAAgC;AAC/C,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,IAA2C;AACjE,QAAA,MAAM,UAAU,GAAG,KAAK,CAAC,OAA8C;QACvE,MAAM,QAAQ,GAAG,CAAC,CAAU,MAA0B,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG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AAE,IAAI,EAAE,IAAI,YAAY;AAEjD,YAAA,MAAM,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC;AACzC,gBAAA,KAAK,EAAE,WAAW;gBAClB,SAAS;AACT,gBAAA,MAAM,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;AAC9B,aAAA,CAAC;YAEF,OAAO;AACL,gBAAA,OAAO,EAAE,IAAI;AACb,gBAAA,IAAI,EAAE,QAAQ;AACd,gBAAA,IAAI,EAAE,SAAS;AACf,gBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;AACrB,gBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;aAC7B;QACH;QAAE,OAAO,KAAc,EAAE;YACvB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAC3D,6CAA6C,CAC9C;AACD,YAAA,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,QAAQ;YACjE,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;AACP,oBAAA,IAAI,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAChD,gEAAgE,EAChE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CACxB;AACF,iBAAA;aACF;QACH;IACF;8GAvHW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAtB,sBAAsB,EAAA,CAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC;;;"}
|
|
@@ -2,7 +2,7 @@ import { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/t
|
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, Injectable } from '@angular/core';
|
|
4
4
|
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
5
|
-
import { h as AXMQuestionnaireViewerService, g as formatQuestionnairePreviewDialogTitle } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-
|
|
5
|
+
import { h as AXMQuestionnaireViewerService, g as formatQuestionnairePreviewDialogTitle } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-sm_OxV_k.mjs';
|
|
6
6
|
import { RootConfig, toPrePostConfig, toDisplaySettings, toPrintSettings } from '@acorex-platform/module-assessment-management-client/contracts';
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
@@ -160,4 +160,4 @@ function asEntityId(value) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
export { AXPPreviewQuestionnaireCommand };
|
|
163
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-questionnaire.command-
|
|
163
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-questionnaire.command-ChtB6q9D.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-questionnaire.command-BYh-3EP9.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 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;AA0JnE,IAAA;;;AApJC;;AAEG;AACK,IAAA,cAAc,CAAC,KAA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AA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA9B,8BAA8B,EAAA,CAAA,CAAA;;2FAA9B,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C;;AAkKD,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-ChtB6q9D.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 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;AA0JnE,IAAA;;;AApJC;;AAEG;AACK,IAAA,cAAc,CAAC,KAA+C,EAAA;AACpE,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO;AAC7B,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI;QAE1B,MAAM,gBAAg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A;kBAD1C;;AAkKD,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-sm_OxV_k.mjs';
|
|
16
16
|
import * as i2 from '@acorex/components/decorators';
|
|
17
17
|
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
18
18
|
|
|
@@ -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-Iwdbc86Q.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-DARYq7ZJ.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,EAAE,KAAK,EAAE;AACjD;AAEA;AAEA;AAyGM,MAAO,iDAAkD,SAAQ,uBAAiE,CAAA;AAvGxI,IAAA,WAAA,GAAA;;AAwGmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;;AAGxC,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACxC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;QAC9B,IAAA,CAAA,yBAAyB,GAAG,IAAI,CAAC;AAC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A,YAAA,EAAA,UAAA,EAAA,qBAAA,EAAA,aAAA,CAAA,EAAA,OAAA,EAAA,CAAA,cAAA,EAAA,2BAAA,EAAA,mBAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACnC,+BAA+B,0LAC/B,iBAAiB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,wBAAA,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,MAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EACjB,mBAAmB,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,IAAA,EAAA,WAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EACnB,SAAS,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,eAAA,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-Iwdbc86Q.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,EAAE,KAAK,EAAE;AACjD;AAEA;AAEA;AAyGM,MAAO,iDAAkD,SAAQ,uBAAiE,CAAA;AAvGxI,IAAA,WAAA,GAAA;;AAwGmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;;AAGxC,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACxC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;QAC9B,IAAA,CAAA,yBAAyB,GAAG,IAAI,CAAC;AAC/C,aAAA,UAAU,CACTA,UAAwB,CAAC,MAAM,CAAC,IAAI,EACpCA,UAAwB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI;AAE1D,aAAA,IAAI,EAAY;;;AAMT,QAAA,IAAA,CAAA,QAAQ,GAAG,QAAQ,CAC3B,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAY;qFAC5C;AACS,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAS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,EAAA,MAAA,EAAA,CAAA,MAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EACjB,mBAAmB,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,IAAA,EAAA,WAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EACnB,SAAS,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,eAAA,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;;;"}
|
|
@@ -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-sm_OxV_k.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-Q6Wu81xW.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-Q6Wu81xW.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,CAAmC,MAAK;AAChF,YAAA,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE;AAC7B,YAAA,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAG,IAAI;QAClE,CAAC;yFAAC;AAMiB,QAAA,IAAA,CAAA,aAAa,GAAG,QAAQ,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;0FAAC;AAElE,QAAA,IAAA,CAAA,eAAe,GAAG,QAAQ,CAAC,MAAM,iBAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;4FAAC;AAEtE,QAAA,IAAA,CAAA,aAAa,GAAG,QAAQ,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;0FAAC;AAElE,QAAA,IAAA,CAAA,qBAAqB,GAAG,QAAQ,CAAC,MAClD,wBAAwB,CAAC,IAAI,CAAC,UAAU,EAA6B,CAAC;kGACvE;AAEkB,QAAA,IAAA,CAAA,kBAAkB,GAAG,QAAQ,CAAC,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,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-sm_OxV_k.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-CaKML07K.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-CaKML07K.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,YA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,7 @@ import * as i0 from '@angular/core';
|
|
|
15
15
|
import { inject, input, computed, signal, viewChild, effect, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
16
16
|
import { first } from 'lodash';
|
|
17
17
|
import { RootConfig, resolvePrintSettings, AXM_ASSESSMENT_SESSION_PREVIEW_PDF_CLIENT_COMMAND_KEY } from '@acorex-platform/module-assessment-management-client/contracts';
|
|
18
|
-
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-
|
|
18
|
+
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-sm_OxV_k.mjs';
|
|
19
19
|
|
|
20
20
|
//#region ---- Imports ----
|
|
21
21
|
//#endregion
|
|
@@ -608,4 +608,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
608
608
|
}], 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 }] }] } });
|
|
609
609
|
|
|
610
610
|
export { AXMQuestionnaireViewerPopupComponent };
|
|
611
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-
|
|
611
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-xDX86cTn.mjs.map
|