@acorex-platform/module-assessment-management-client 0.0.33 → 0.0.37
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-YfOwCCLz.mjs → acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-BcpbQ8TJ.mjs} +41 -41
- package/fesm2022/acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-BcpbQ8TJ.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-assessment-case-status.provider-i48XDX-I.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-assessment-session-answers-view.util-42ZcOY2C.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-assessment-session-status.provider-Bk9hHj5V.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-CZjFuIsF.mjs → acorex-platform-module-assessment-management-client-assessment-voice.commands-DEcHphg8.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-CZjFuIsF.mjs.map → acorex-platform-module-assessment-management-client-assessment-voice.commands-DEcHphg8.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-assessment-case.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-assessment-session.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-question-bank-item.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-questionnaire.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-B8PJe3IJ.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-DcRzvfKO.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-Y0FU8X-e.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-CT913OrX.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-C4hxiPTX.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-DUo0Jy0W.mjs → acorex-platform-module-assessment-management-client-fill-assessment-session.command-lHYKxCXo.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-DUo0Jy0W.mjs.map → acorex-platform-module-assessment-management-client-fill-assessment-session.command-lHYKxCXo.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-list-question-difficulty-options.query-h3xT-MNd.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-local-entities.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-BR3YNIEg.mjs → acorex-platform-module-assessment-management-client-preview-question.command-Db64SCn6.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-BR3YNIEg.mjs.map → acorex-platform-module-assessment-management-client-preview-question.command-Db64SCn6.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-D9Y57_r2.mjs → acorex-platform-module-assessment-management-client-preview-questionnaire.command-yOfBbOMK.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-D9Y57_r2.mjs.map → acorex-platform-module-assessment-management-client-preview-questionnaire.command-yOfBbOMK.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-preview-session-pdf.command-BsiJU6ep.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-BqIo3Zhp.mjs → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B9iRaSSF.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-BqIo3Zhp.mjs.map → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B9iRaSSF.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-EEBL0x9K.mjs → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-B4JMc6ew.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-EEBL0x9K.mjs.map → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-B4JMc6ew.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-Bobavgnt.mjs → acorex-platform-module-assessment-management-client-review-assessment-session.command-si6-7hpg.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-Bobavgnt.mjs.map → acorex-platform-module-assessment-management-client-review-assessment-session.command-si6-7hpg.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-DPfg8ioy.mjs → acorex-platform-module-assessment-management-client-view-session-answers.command-BUMtj_L6.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-DPfg8ioy.mjs.map → acorex-platform-module-assessment-management-client-view-session-answers.command-BUMtj_L6.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client.mjs +1 -1
- package/package.json +3 -3
- package/fesm2022/acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-YfOwCCLz.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-fill-assessment-session.command-DUo0Jy0W.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/fill-assessment-session.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, type AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPDebugService } from '@acorex-platform/framework-client/core';\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, first, get, isString } from 'lodash';\nimport { Router } from '@angular/router';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\nimport type { AXMAssessmentManagementAssessmentCaseEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementAssessmentSessionEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementQuestionnaireEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport {\n normalizeCompletionMode,\n toDisplaySettings,\n toPrePostConfig,\n toPrintSettings,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport {\n RootConfig,\n type QuestionnaireCompletionMode,\n type QuestionnaireBuilderValue,\n} from '@acorex-platform/module-assessment-management-client/contracts';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * How to show the questionnaire viewer when filling an assessment session.\n */\nexport type FillAssessmentSessionShowAs = 'popup' | 'page' | 'standalone';\n\nexport type FillAssessmentSessionOutcome = 'Submitted' | 'Saved' | 'Cancelled';\n\n/**\n * Input for FillAssessmentSession command.\n */\nexport interface FillAssessmentSessionCommandInput {\n caseId: string;\n sessionId?: string;\n /** Popup viewer title; falls back to assessment case title when omitted. */\n title?: AXPMultiLanguageString;\n showAs?: FillAssessmentSessionShowAs;\n responderId?: string;\n role?: 'responder' | 'supervisor' | 'reviewer';\n /** Overrides questionnaire display.completionMode when set. */\n completionMode?: QuestionnaireCompletionMode;\n /** Question answer keys that must stay readonly (e.g. asset prefill on work-order checklists). */\n readonlyAnswerKeys?: string[];\n}\n\n//#endregion\n\n//#region ---- Fill Assessment Session Command ----\n\n/**\n * Opens questionnaire viewer for filling/editing assessment session with draft save and workflow outcomes.\n */\n@Injectable()\nexport class FillAssessmentSessionCommand implements AXPCommand<FillAssessmentSessionCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly sessionService = inject(AXPSessionService);\n private readonly router = inject(Router);\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n private readonly debug = inject(AXPDebugService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: FillAssessmentSessionCommandInput): AXPCommandExecuteResultPromise<void> {\n try {\n const assessmentCase = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentCase.name)\n .data<string, AXMAssessmentManagementAssessmentCaseEntityModel>()\n .byKey(input.caseId);\n if (!assessmentCase) {\n return {\n success: false,\n message: { text: `Assessment case with ID ${input.caseId} not found` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const questionnaire = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionnaire.name)\n .data<string, AXMAssessmentManagementQuestionnaireEntityModel>()\n .byKey(assessmentCase.questionnaireId);\n if (!questionnaire) {\n return {\n success: false,\n message: { text: `Questionnaire with ID ${assessmentCase.questionnaireId} not found` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const questions = questionnaire.questions ?? { sections: [] };\n const structure: QuestionnaireBuilderValue = {\n ...questions,\n sections: questions.sections ?? [],\n displaySettings: toDisplaySettings(questionnaire) ?? undefined,\n printSettings: toPrintSettings(questionnaire) ?? undefined,\n };\n if (!structure.sections.length) {\n return {\n success: false,\n message: { text: 'Questionnaire has no questions to display' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const currentUser = this.sessionService.user;\n const responderId = input.responderId || currentUser?.id;\n if (!responderId) {\n return {\n success: false,\n message: { text: 'No responder ID provided and no current user found' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const role = input.role || 'responder';\n const displaySettings = toDisplaySettings(questionnaire);\n const completionMode: QuestionnaireCompletionMode =\n input.completionMode ?? normalizeCompletionMode(displaySettings?.completionMode);\n\n let existingSession: AXMAssessmentManagementAssessmentSessionEntityModel | null = null;\n let sessionId = input.sessionId ?? null;\n let initialAnswers: Record<string, unknown> = {};\n\n if (sessionId) {\n existingSession = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .byKey(sessionId);\n if (existingSession) {\n initialAnswers = (existingSession.answers as Record<string, unknown>) || {};\n }\n }\n\n const sessionSubmitted = existingSession?.statusId === 'submitted';\n\n const showAs = input.showAs ?? 'popup';\n const appName = this.sessionService.application?.name ?? 'demo';\n const moduleRoute = (RootConfig.module as { route?: string }).route ?? 'assessment-management';\n\n if (showAs === 'page') {\n const path = `/${appName}/${moduleRoute}/questionnaire/fill/${input.caseId}`;\n const url = sessionId ? `${path}?sessionId=${encodeURIComponent(sessionId)}` : path;\n this.router.navigateByUrl(url);\n return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'Cancelled' } };\n }\n\n if (showAs === 'standalone') {\n let sessionIdToOpen = sessionId;\n if (!sessionIdToOpen) {\n const now = new Date();\n sessionIdToOpen = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .create({\n caseId: input.caseId,\n responderId,\n role,\n answers: {},\n progressPercentage: 0,\n answeredQuestionsCount: 0,\n lastSavedAt: now,\n startedAt: now,\n statusId: 'not-started',\n } as Omit<AXMAssessmentManagementAssessmentSessionEntityModel, 'id'>);\n }\n if (sessionIdToOpen) {\n this.router.navigateByUrl(`/assessment/fill/${sessionIdToOpen}`);\n }\n return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'Cancelled' } };\n }\n\n const viewerTitle = await this.resolveViewerTitle(input.title, assessmentCase.title);\n\n const viewerConfig = {\n readonly: sessionSubmitted,\n completionMode,\n validationStrategy: displaySettings?.validationStrategy,\n viewMode: displaySettings?.viewMode,\n showProgressBar: displaySettings?.showProgressBar,\n timer: { showTimer: displaySettings?.showTimer ?? false },\n showQuestionNumbers: displaySettings?.showQuestionNumbers,\n readonlyAnswerKeys: input.readonlyAnswerKeys,\n };\n\n const result = await this.questionnaireViewerService.open({\n title: viewerTitle,\n structure,\n prePostConfig: toPrePostConfig(questionnaire),\n config: viewerConfig,\n initialAnswers,\n questionnaireId: questionnaire.id,\n assessmentFillContext: sessionSubmitted\n ? undefined\n : {\n caseId: input.caseId,\n sessionId: sessionId ?? null,\n responderId,\n role,\n },\n });\n\n const outcome = await this.resolveFillOutcome(input.caseId, input.sessionId ?? sessionId, result);\n this.debug.trace(\n 'assessment-management',\n 'fill-assessment-session',\n 'Resolved fill workflow outcome',\n () => ({\n caseId: input.caseId,\n sessionId: input.sessionId ?? sessionId,\n popupResult: {\n saved: result?.saved === true,\n submitted: result?.submitted === true,\n hasPayload: result != null,\n },\n outcome,\n }),\n );\n return { success: true, kind: 'object', data: undefined, metadata: { outcome },\n };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error('Error filling assessment session:', error);\n return {\n success: false,\n message: { text: `Error filling assessment session: ${message}` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n /**\n * Resolves popup title: explicit input, then case title, then translated default.\n */\n private async resolveViewerTitle(\n inputTitle: AXPMultiLanguageString | undefined,\n caseTitle: string | undefined,\n ): Promise<string> {\n const explicit = this.normalizeTitle(inputTitle);\n if (explicit) {\n return explicit;\n }\n\n const fromCase = this.normalizeTitle(caseTitle);\n if (fromCase) {\n return fromCase;\n }\n\n const fillTitleKey = '@assessment-management:cases.actions.fill-assessment.title';\n const fillTitleBase = await this.translationService.translateAsync(fillTitleKey);\n return fillTitleBase || 'Fill Assessment';\n }\n\n /** Resolves a multi-language or plain string title for the active locale. */\n private normalizeTitle(value: AXPMultiLanguageString | string | undefined | null | false): string {\n if (value == null || value === false) {\n return '';\n }\n if (typeof value === 'string') {\n return value.trim();\n }\n const locale = this.translationService.getActiveLang();\n return resolveMultiLanguageString(value, locale).trim();\n }\n\n /**\n * Resolves workflow outcome from popup result, falling back to persisted session status only\n * when the popup is dismissed without an explicit close payload.\n * After submit the viewer may show a summary step; closing via X without \"Done\" still leaves\n * the session submitted and must advance the workflow. Save-as-draft always sends an explicit\n * payload ({ saved: true }); inferring Submitted from the DB when a payload exists can wrongly\n * advance the workflow if flags are missing or a stale submitted session is resolved.\n */\n private async resolveFillOutcome(\n caseId: string,\n sessionId: string | null | undefined,\n result: { submitted?: boolean; saved?: boolean } | null | undefined,\n ): Promise<FillAssessmentSessionOutcome> {\n if (result?.saved) {\n return 'Saved';\n }\n if (result?.submitted) {\n return 'Submitted';\n }\n\n if (result != null) {\n return 'Cancelled';\n }\n\n const sessionSubmitted = await this.isAssessmentSessionSubmitted(caseId, sessionId);\n if (sessionSubmitted) {\n return 'Submitted';\n }\n\n return 'Cancelled';\n }\n\n private async isAssessmentSessionSubmitted(\n caseId: string,\n sessionId: string | null | undefined,\n ): Promise<boolean> {\n const resolvedSessionId = this.resolveText(sessionId) || (await this.findLatestSessionIdForCase(caseId));\n if (!resolvedSessionId) {\n return false;\n }\n\n const session = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .byKey(resolvedSessionId);\n\n return get(session, 'statusId') === 'submitted';\n }\n\n private async findLatestSessionIdForCase(caseId: string): Promise<string> {\n const page = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .query({\n skip: 0,\n take: 1,\n sort: [{ field: 'lastSavedAt', direction: 'desc' }],\n filter: {\n logic: 'and',\n filters: [{ field: 'caseId', operator: { type: 'equal' }, value: caseId }],\n },\n } as never);\n\n const session = first(defaultTo(get(page, 'items'), []));\n return this.resolveText(get(session, 'id'));\n }\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;AAwDA;AAEA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC;AA8RjD,IAAA;;;IAxRC,MAAM,OAAO,CAAC,KAAwC,EAAA;AACpD,QAAA,IAAI;AACF,YAAA,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC;AAC/B,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI;AAC1E,iBAAA,IAAI;AACJ,iBAAA,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;YACtB,IAAI,CAAC,cAAc,EAAE;gBACnB,OAAO;AACL,oBAAA,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,EAAE,IAAI,EAAE,2BAA2B,KAAK,CAAC,MAAM,CAAA,UAAA,CAAY,EAAE;AACtE,oBAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;iBACnC;YACH;A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{"version":3,"file":"acorex-platform-module-assessment-management-client-fill-assessment-session.command-lHYKxCXo.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/fill-assessment-session.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult, type AXPMultiLanguageString } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPDebugService } from '@acorex-platform/framework-client/core';\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, first, get, isString } from 'lodash';\nimport { Router } from '@angular/router';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\nimport type { AXMAssessmentManagementAssessmentCaseEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementAssessmentSessionEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementQuestionnaireEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport {\n normalizeCompletionMode,\n toDisplaySettings,\n toPrePostConfig,\n toPrintSettings,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport {\n RootConfig,\n type QuestionnaireCompletionMode,\n type QuestionnaireBuilderValue,\n} from '@acorex-platform/module-assessment-management-client/contracts';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * How to show the questionnaire viewer when filling an assessment session.\n */\nexport type FillAssessmentSessionShowAs = 'popup' | 'page' | 'standalone';\n\nexport type FillAssessmentSessionOutcome = 'Submitted' | 'Saved' | 'Cancelled';\n\n/**\n * Input for FillAssessmentSession command.\n */\nexport interface FillAssessmentSessionCommandInput {\n caseId: string;\n sessionId?: string;\n /** Popup viewer title; falls back to assessment case title when omitted. */\n title?: AXPMultiLanguageString;\n showAs?: FillAssessmentSessionShowAs;\n responderId?: string;\n role?: 'responder' | 'supervisor' | 'reviewer';\n /** Overrides questionnaire display.completionMode when set. */\n completionMode?: QuestionnaireCompletionMode;\n /** Question answer keys that must stay readonly (e.g. asset prefill on work-order checklists). */\n readonlyAnswerKeys?: string[];\n}\n\n//#endregion\n\n//#region ---- Fill Assessment Session Command ----\n\n/**\n * Opens questionnaire viewer for filling/editing assessment session with draft save and workflow outcomes.\n */\n@Injectable()\nexport class FillAssessmentSessionCommand implements AXPCommand<FillAssessmentSessionCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly sessionService = inject(AXPSessionService);\n private readonly router = inject(Router);\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n private readonly debug = inject(AXPDebugService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: FillAssessmentSessionCommandInput): AXPCommandExecuteResultPromise<void> {\n try {\n const assessmentCase = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentCase.name)\n .data<string, AXMAssessmentManagementAssessmentCaseEntityModel>()\n .byKey(input.caseId);\n if (!assessmentCase) {\n return {\n success: false,\n message: { text: `Assessment case with ID ${input.caseId} not found` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const questionnaire = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionnaire.name)\n .data<string, AXMAssessmentManagementQuestionnaireEntityModel>()\n .byKey(assessmentCase.questionnaireId);\n if (!questionnaire) {\n return {\n success: false,\n message: { text: `Questionnaire with ID ${assessmentCase.questionnaireId} not found` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const questions = questionnaire.questions ?? { sections: [] };\n const structure: QuestionnaireBuilderValue = {\n ...questions,\n sections: questions.sections ?? [],\n displaySettings: toDisplaySettings(questionnaire) ?? undefined,\n printSettings: toPrintSettings(questionnaire) ?? undefined,\n };\n if (!structure.sections.length) {\n return {\n success: false,\n message: { text: 'Questionnaire has no questions to display' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const currentUser = this.sessionService.user;\n const responderId = input.responderId || currentUser?.id;\n if (!responderId) {\n return {\n success: false,\n message: { text: 'No responder ID provided and no current user found' },\n metadata: { outcome: 'Cancelled' },\n };\n }\n\n const role = input.role || 'responder';\n const displaySettings = toDisplaySettings(questionnaire);\n const completionMode: QuestionnaireCompletionMode =\n input.completionMode ?? normalizeCompletionMode(displaySettings?.completionMode);\n\n let existingSession: AXMAssessmentManagementAssessmentSessionEntityModel | null = null;\n let sessionId = input.sessionId ?? null;\n let initialAnswers: Record<string, unknown> = {};\n\n if (sessionId) {\n existingSession = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .byKey(sessionId);\n if (existingSession) {\n initialAnswers = (existingSession.answers as Record<string, unknown>) || {};\n }\n }\n\n const sessionSubmitted = existingSession?.statusId === 'submitted';\n\n const showAs = input.showAs ?? 'popup';\n const appName = this.sessionService.application?.name ?? 'demo';\n const moduleRoute = (RootConfig.module as { route?: string }).route ?? 'assessment-management';\n\n if (showAs === 'page') {\n const path = `/${appName}/${moduleRoute}/questionnaire/fill/${input.caseId}`;\n const url = sessionId ? `${path}?sessionId=${encodeURIComponent(sessionId)}` : path;\n this.router.navigateByUrl(url);\n return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'Cancelled' } };\n }\n\n if (showAs === 'standalone') {\n let sessionIdToOpen = sessionId;\n if (!sessionIdToOpen) {\n const now = new Date();\n sessionIdToOpen = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .create({\n caseId: input.caseId,\n responderId,\n role,\n answers: {},\n progressPercentage: 0,\n answeredQuestionsCount: 0,\n lastSavedAt: now,\n startedAt: now,\n statusId: 'not-started',\n } as Omit<AXMAssessmentManagementAssessmentSessionEntityModel, 'id'>);\n }\n if (sessionIdToOpen) {\n this.router.navigateByUrl(`/assessment/fill/${sessionIdToOpen}`);\n }\n return { success: true, kind: 'object', data: undefined, metadata: { outcome: 'Cancelled' } };\n }\n\n const viewerTitle = await this.resolveViewerTitle(input.title, assessmentCase.title);\n\n const viewerConfig = {\n readonly: sessionSubmitted,\n completionMode,\n validationStrategy: displaySettings?.validationStrategy,\n viewMode: displaySettings?.viewMode,\n showProgressBar: displaySettings?.showProgressBar,\n timer: { showTimer: displaySettings?.showTimer ?? false },\n showQuestionNumbers: displaySettings?.showQuestionNumbers,\n readonlyAnswerKeys: input.readonlyAnswerKeys,\n };\n\n const result = await this.questionnaireViewerService.open({\n title: viewerTitle,\n structure,\n prePostConfig: toPrePostConfig(questionnaire),\n config: viewerConfig,\n initialAnswers,\n questionnaireId: questionnaire.id,\n assessmentFillContext: sessionSubmitted\n ? undefined\n : {\n caseId: input.caseId,\n sessionId: sessionId ?? null,\n responderId,\n role,\n },\n });\n\n const outcome = await this.resolveFillOutcome(input.caseId, input.sessionId ?? sessionId, result);\n this.debug.trace(\n 'assessment-management',\n 'fill-assessment-session',\n 'Resolved fill workflow outcome',\n () => ({\n caseId: input.caseId,\n sessionId: input.sessionId ?? sessionId,\n popupResult: {\n saved: result?.saved === true,\n submitted: result?.submitted === true,\n hasPayload: result != null,\n },\n outcome,\n }),\n );\n return { success: true, kind: 'object', data: undefined, metadata: { outcome },\n };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error('Error filling assessment session:', error);\n return {\n success: false,\n message: { text: `Error filling assessment session: ${message}` },\n metadata: { outcome: 'Cancelled' },\n };\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n /**\n * Resolves popup title: explicit input, then case title, then translated default.\n */\n private async resolveViewerTitle(\n inputTitle: AXPMultiLanguageString | undefined,\n caseTitle: string | undefined,\n ): Promise<string> {\n const explicit = this.normalizeTitle(inputTitle);\n if (explicit) {\n return explicit;\n }\n\n const fromCase = this.normalizeTitle(caseTitle);\n if (fromCase) {\n return fromCase;\n }\n\n const fillTitleKey = '@assessment-management:cases.actions.fill-assessment.title';\n const fillTitleBase = await this.translationService.translateAsync(fillTitleKey);\n return fillTitleBase || 'Fill Assessment';\n }\n\n /** Resolves a multi-language or plain string title for the active locale. */\n private normalizeTitle(value: AXPMultiLanguageString | string | undefined | null | false): string {\n if (value == null || value === false) {\n return '';\n }\n if (typeof value === 'string') {\n return value.trim();\n }\n const locale = this.translationService.getActiveLang();\n return resolveMultiLanguageString(value, locale).trim();\n }\n\n /**\n * Resolves workflow outcome from popup result, falling back to persisted session status only\n * when the popup is dismissed without an explicit close payload.\n * After submit the viewer may show a summary step; closing via X without \"Done\" still leaves\n * the session submitted and must advance the workflow. Save-as-draft always sends an explicit\n * payload ({ saved: true }); inferring Submitted from the DB when a payload exists can wrongly\n * advance the workflow if flags are missing or a stale submitted session is resolved.\n */\n private async resolveFillOutcome(\n caseId: string,\n sessionId: string | null | undefined,\n result: { submitted?: boolean; saved?: boolean } | null | undefined,\n ): Promise<FillAssessmentSessionOutcome> {\n if (result?.saved) {\n return 'Saved';\n }\n if (result?.submitted) {\n return 'Submitted';\n }\n\n if (result != null) {\n return 'Cancelled';\n }\n\n const sessionSubmitted = await this.isAssessmentSessionSubmitted(caseId, sessionId);\n if (sessionSubmitted) {\n return 'Submitted';\n }\n\n return 'Cancelled';\n }\n\n private async isAssessmentSessionSubmitted(\n caseId: string,\n sessionId: string | null | undefined,\n ): Promise<boolean> {\n const resolvedSessionId = this.resolveText(sessionId) || (await this.findLatestSessionIdForCase(caseId));\n if (!resolvedSessionId) {\n return false;\n }\n\n const session = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .byKey(resolvedSessionId);\n\n return get(session, 'statusId') === 'submitted';\n }\n\n private async findLatestSessionIdForCase(caseId: string): Promise<string> {\n const page = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.assessmentSession.name)\n .data<string, AXMAssessmentManagementAssessmentSessionEntityModel>()\n .query({\n skip: 0,\n take: 1,\n sort: [{ field: 'lastSavedAt', direction: 'desc' }],\n filter: {\n logic: 'and',\n filters: [{ field: 'caseId', operator: { type: 'equal' }, value: caseId }],\n },\n } as never);\n\n const session = first(defaultTo(get(page, 'items'), []));\n return this.resolveText(get(session, 'id'));\n }\n\n private resolveText(value: unknown): string {\n if (!isString(value)) {\n return '';\n }\n return value.trim();\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;AAwDA;AAEA;AAEA;;AAEG;MAEU,4BAA4B,CAAA;AADzC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AACjD,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,eAAe,CAAC;AA8RjD,IAAA;;;IAxRC,MAAM,OAAO,CAAC,KAAwC,EAAA;AACpD,QAAA,IAAI;AACF,YAAA,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC;AAC/B,iBAAA,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI;AAC1E,iBAAA,IAAI;AACJ,iBAAA,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;YACtB,IAAI,CAAC,cAAc,EAAE;gBACnB,OAAO;AACL,oBAAA,OAAO,EAAE,KAAK;oBACd,OAA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CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA5B,4BAA4B,EAAA,CAAA,CAAA;;2FAA5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-list-question-difficulty-options.query-h3xT-MNd.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/queries/list-question-difficulty-options.query.ts"],"sourcesContent":["import {\n resolveCollectionSkip,\n resolveCollectionTake,\n type AXPCollectionQuery,\n type AXPCollectionQueryInput,\n type AXPQueryCollectionFetchResultPromise,\n} from '@acorex-platform/framework-shared/runtime';\nimport {\n runtimeQueryFailure,\n runtimeQuerySuccessCollection,\n} from '@acorex-platform/framework-shared/core';\nimport { applyFilterArray, applySortArray } from '@acorex-platform/framework-client/core';\n\nimport { Injectable } from '@angular/core';\n\n//#region ---- Types ----\n\nexport type AXMListQuestionDifficultyOptionsQueryInput = AXPCollectionQueryInput;\n\nexport interface AXMListQuestionDifficultyOptionsQueryItem {\n /** Stored difficulty code. */\n id: string;\n /** Display title (i18n key). */\n title: string;\n}\n\n//#endregion\n\n//#region ---- Constants ----\n\n/** Same rows as the former `question-difficulty-options` registry data source. */\nconst QUESTION_DIFFICULTY_OPTIONS: AXMListQuestionDifficultyOptionsQueryItem[] = [\n {\n id: 'easy',\n title: '@assessment-management:question-bank.entities.question-bank-item.fields.difficulty.options.easy',\n },\n {\n id: 'medium',\n title: '@assessment-management:question-bank.entities.question-bank-item.fields.difficulty.options.medium',\n },\n {\n id: 'hard',\n title: '@assessment-management:question-bank.entities.question-bank-item.fields.difficulty.options.hard',\n },\n];\n\n//#endregion\n\n//#region ---- Query ----\n\n/**\n * Static question difficulty catalog — replaces the `question-difficulty-options` DI data source.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMListQuestionDifficultyOptionsQuery\n implements\n AXPCollectionQuery<\n AXMListQuestionDifficultyOptionsQueryInput,\n AXMListQuestionDifficultyOptionsQueryItem\n >\n{\n //#region ---- Query Execution ----\n\n async fetch(\n input?: AXMListQuestionDifficultyOptionsQueryInput | null,\n ): AXPQueryCollectionFetchResultPromise<AXMListQuestionDifficultyOptionsQueryItem> {\n try {\n let items = [...QUESTION_DIFFICULTY_OPTIONS];\n\n if (input?.filter) {\n items = applyFilterArray(items, [input.filter]);\n }\n\n const rawSort = Array.isArray(input?.sort) ? input.sort : input?.sort ? [input.sort] : [];\n const sortOpt = rawSort.length > 0 ? rawSort : [{ field: 'id' as const, dir: 'asc' as const }];\n items = applySortArray(items, sortOpt);\n\n const skip = resolveCollectionSkip(input?.skip);\n const take = resolveCollectionTake(input?.take);\n const total = items.length;\n const page = items.slice(skip, skip + take);\n\n return runtimeQuerySuccessCollection({ items: page, total });\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Unknown error occurred',\n );\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;AA0BA;AAEA;AAEA;AACA,MAAM,2BAA2B,GAAgD;AAC/E,IAAA;AACE,QAAA,EAAE,EAAE,MAAM;AACV,QAAA,KAAK,EAAE,iGAAiG;AACzG,KAAA;AACD,IAAA;AACE,QAAA,EAAE,EAAE,QAAQ;AACZ,QAAA,KAAK,EAAE,mGAAmG;AAC3G,KAAA;AACD,IAAA;AACE,QAAA,EAAE,EAAE,MAAM;AACV,QAAA,KAAK,EAAE,iGAAiG;AACzG,KAAA;CACF;AAED;AAEA;AAEA;;AAEG;MAEU,qCAAqC,CAAA;;IAShD,MAAM,KAAK,CACT,KAAyD,EAAA;AAEzD,QAAA,IAAI;AACF,YAAA,IAAI,KAAK,GAAG,CAAC,GAAG,2BAA2B,CAAC;AAE5C,YAAA,IAAI,KAAK,EAAE,MAAM,EAAE;gBACjB,KAAK,GAAG,gBAAgB,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACjD;AAEA,YAAA,MAAM,OAAO,GAAG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"version":3,"file":"acorex-platform-module-assessment-management-client-list-question-difficulty-options.query-h3xT-MNd.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/queries/list-question-difficulty-options.query.ts"],"sourcesContent":["import {\n resolveCollectionSkip,\n resolveCollectionTake,\n type AXPCollectionQuery,\n type AXPCollectionQueryInput,\n type AXPQueryCollectionFetchResultPromise,\n} from '@acorex-platform/framework-shared/runtime';\nimport {\n runtimeQueryFailure,\n runtimeQuerySuccessCollection,\n} from '@acorex-platform/framework-shared/core';\nimport { applyFilterArray, applySortArray } from '@acorex-platform/framework-client/core';\n\nimport { Injectable } from '@angular/core';\n\n//#region ---- Types ----\n\nexport type AXMListQuestionDifficultyOptionsQueryInput = AXPCollectionQueryInput;\n\nexport interface AXMListQuestionDifficultyOptionsQueryItem {\n /** Stored difficulty code. */\n id: string;\n /** Display title (i18n key). */\n title: string;\n}\n\n//#endregion\n\n//#region ---- Constants ----\n\n/** Same rows as the former `question-difficulty-options` registry data source. */\nconst QUESTION_DIFFICULTY_OPTIONS: AXMListQuestionDifficultyOptionsQueryItem[] = [\n {\n id: 'easy',\n title: '@assessment-management:question-bank.entities.question-bank-item.fields.difficulty.options.easy',\n },\n {\n id: 'medium',\n title: '@assessment-management:question-bank.entities.question-bank-item.fields.difficulty.options.medium',\n },\n {\n id: 'hard',\n title: '@assessment-management:question-bank.entities.question-bank-item.fields.difficulty.options.hard',\n },\n];\n\n//#endregion\n\n//#region ---- Query ----\n\n/**\n * Static question difficulty catalog — replaces the `question-difficulty-options` DI data source.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMListQuestionDifficultyOptionsQuery\n implements\n AXPCollectionQuery<\n AXMListQuestionDifficultyOptionsQueryInput,\n AXMListQuestionDifficultyOptionsQueryItem\n >\n{\n //#region ---- Query Execution ----\n\n async fetch(\n input?: AXMListQuestionDifficultyOptionsQueryInput | null,\n ): AXPQueryCollectionFetchResultPromise<AXMListQuestionDifficultyOptionsQueryItem> {\n try {\n let items = [...QUESTION_DIFFICULTY_OPTIONS];\n\n if (input?.filter) {\n items = applyFilterArray(items, [input.filter]);\n }\n\n const rawSort = Array.isArray(input?.sort) ? input.sort : input?.sort ? [input.sort] : [];\n const sortOpt = rawSort.length > 0 ? rawSort : [{ field: 'id' as const, dir: 'asc' as const }];\n items = applySortArray(items, sortOpt);\n\n const skip = resolveCollectionSkip(input?.skip);\n const take = resolveCollectionTake(input?.take);\n const total = items.length;\n const page = items.slice(skip, skip + take);\n\n return runtimeQuerySuccessCollection({ items: page, total });\n } catch (error) {\n return runtimeQueryFailure(\n error instanceof Error ? error.message : 'Unknown error occurred',\n );\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;AA0BA;AAEA;AAEA;AACA,MAAM,2BAA2B,GAAgD;AAC/E,IAAA;AACE,QAAA,EAAE,EAAE,MAAM;AACV,QAAA,KAAK,EAAE,iGAAiG;AACzG,KAAA;AACD,IAAA;AACE,QAAA,EAAE,EAAE,QAAQ;AACZ,QAAA,KAAK,EAAE,mGAAmG;AAC3G,KAAA;AACD,IAAA;AACE,QAAA,EAAE,EAAE,MAAM;AACV,QAAA,KAAK,EAAE,iGAAiG;AACzG,KAAA;CACF;AAED;AAEA;AAEA;;AAEG;MAEU,qCAAqC,CAAA;;IAShD,MAAM,KAAK,CACT,KAAyD,EAAA;AAEzD,QAAA,IAAI;AACF,YAAA,IAAI,KAAK,GAAG,CAAC,GAAG,2BAA2B,CAAC;AAE5C,YAAA,IAAI,KAAK,EAAE,MAAM,EAAE;gBACjB,KAAK,GAAG,gBAAgB,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACjD;AAEA,YAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACzF,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,KAAK,EAAE,IAAa,EAAE,GAAG,EAAE,KAAc,EAAE,CAAC;AAC9F,YAAA,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC;YAEtC,MAAM,IAAI,GAAG,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC;YAC/C,MAAM,IAAI,GAAG,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC;AAC/C,YAAA,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM;AAC1B,YAAA,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;YAE3C,OAAO,6BAA6B,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC9D;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,OAAO,mBAAmB,CACxB,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,wBAAwB,CAClE;QACH;IACF;8GAlCW,qCAAqC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAArC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qCAAqC,cADxB,MAAM,EAAA,CAAA,CAAA;;2FACnB,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBADjD,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-local-entities.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/provide-local-entities.ts","../../../../libs/modules/assessment-management/client/src/lib/acorex-platform-module-assessment-management-client-local-entities.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { provideLocalEntityCatalog } from '@acorex-platform/framework-client/layout/entity';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\n\n//#endregion\n\n//#region ----- Provide local entities -----\n\n/**\n * Registers assessment-management layouts on the client from packaged factories.\n * Each `import()` targets a secondary entry so unused entities stay out of the\n * bundle. Do not add this to the demo app; demo continues to load layouts via\n * `Domain:GetEntityLayout`.\n */\nexport function provideAssessmentManagementLocalEntities() {\n return provideLocalEntityCatalog({\n moduleName: RootConfig.module.name,\n loaders: {\n [RootConfig.entities.assessmentCase.name]: () =>\n import('@acorex-platform/module-assessment-management-client/contracts/entities/assessment-case').then((m) => m.factoryAssessmentCase()),\n [RootConfig.entities.assessmentSession.name]: () =>\n import('@acorex-platform/module-assessment-management-client/contracts/entities/assessment-session').then((m) => m.factoryAssessmentSession()),\n [RootConfig.entities.questionBankItem.name]: () =>\n import('@acorex-platform/module-assessment-management-client/contracts/entities/question-bank-item').then((m) => m.factoryQuestionBankItem()),\n [RootConfig.entities.questionnaire.name]: () =>\n import('@acorex-platform/module-assessment-management-client/contracts/entities/questionnaire').then((m) => m.factoryQuestionnaire()),\n },\n });\n}\n\nexport { assessmentManagementLocalEntityCatalog } from '@acorex-platform/module-assessment-management-client/contracts/entity-catalog';\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './provide-local-entities';\n"],"names":[],"mappings":";;;;AAAA;AAKA;AAEA;AAEA;;;;;AAKG;SACa,wCAAwC,GAAA;AACtD,IAAA,OAAO,yBAAyB,CAAC;AAC/B,QAAA,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI;AAClC,QAAA,OAAO,EAAE;AACP,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,GAAG,MACzC,OAAO,yFAAyF,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAE,CAAC;AAC1I,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,GAAG,MAC5C,OAAO,4FAA4F,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,wBAAwB,EAAE,CAAC;AAChJ,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,GAAG,MAC3C,OAAO,4FAA4F,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,uBAAuB,EAAE,CAAC;AAC/I,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,GAAG,MACxC,OAAO,uFAAuF,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,oBAAoB,EAAE,CAAC;AACxI,SAAA;AACF,KAAA,CAAC;AACJ;AAIA;;ACjCA;;AAEG
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-local-entities.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/provide-local-entities.ts","../../../../libs/modules/assessment-management/client/src/lib/acorex-platform-module-assessment-management-client-local-entities.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { provideLocalEntityCatalog } from '@acorex-platform/framework-client/layout/entity';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\n\n//#endregion\n\n//#region ----- Provide local entities -----\n\n/**\n * Registers assessment-management layouts on the client from packaged factories.\n * Each `import()` targets a secondary entry so unused entities stay out of the\n * bundle. Do not add this to the demo app; demo continues to load layouts via\n * `Domain:GetEntityLayout`.\n */\nexport function provideAssessmentManagementLocalEntities() {\n return provideLocalEntityCatalog({\n moduleName: RootConfig.module.name,\n loaders: {\n [RootConfig.entities.assessmentCase.name]: () =>\n import('@acorex-platform/module-assessment-management-client/contracts/entities/assessment-case').then((m) => m.factoryAssessmentCase()),\n [RootConfig.entities.assessmentSession.name]: () =>\n import('@acorex-platform/module-assessment-management-client/contracts/entities/assessment-session').then((m) => m.factoryAssessmentSession()),\n [RootConfig.entities.questionBankItem.name]: () =>\n import('@acorex-platform/module-assessment-management-client/contracts/entities/question-bank-item').then((m) => m.factoryQuestionBankItem()),\n [RootConfig.entities.questionnaire.name]: () =>\n import('@acorex-platform/module-assessment-management-client/contracts/entities/questionnaire').then((m) => m.factoryQuestionnaire()),\n },\n });\n}\n\nexport { assessmentManagementLocalEntityCatalog } from '@acorex-platform/module-assessment-management-client/contracts/entity-catalog';\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './provide-local-entities';\n"],"names":[],"mappings":";;;;AAAA;AAKA;AAEA;AAEA;;;;;AAKG;SACa,wCAAwC,GAAA;AACtD,IAAA,OAAO,yBAAyB,CAAC;AAC/B,QAAA,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI;AAClC,QAAA,OAAO,EAAE;AACP,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,GAAG,MACzC,OAAO,yFAAyF,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,qBAAqB,EAAE,CAAC;AAC1I,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,GAAG,MAC5C,OAAO,4FAA4F,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,wBAAwB,EAAE,CAAC;AAChJ,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,GAAG,MAC3C,OAAO,4FAA4F,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,uBAAuB,EAAE,CAAC;AAC/I,YAAA,CAAC,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,GAAG,MACxC,OAAO,uFAAuF,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,oBAAoB,EAAE,CAAC;AACxI,SAAA;AACF,KAAA,CAAC;AACJ;AAIA;;ACjCA;;AAEG;;"}
|
|
@@ -3,7 +3,7 @@ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entit
|
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { inject, Injectable } from '@angular/core';
|
|
5
5
|
import { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';
|
|
6
|
-
import { A as AXMQuestionnaireViewerService } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-
|
|
6
|
+
import { A as AXMQuestionnaireViewerService } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-BcpbQ8TJ.mjs';
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region ---- Preview Question Command ----
|
|
@@ -120,4 +120,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
120
120
|
}] });
|
|
121
121
|
|
|
122
122
|
export { PreviewQuestionCommand };
|
|
123
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-question.command-
|
|
123
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-question.command-Db64SCn6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-question.command-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-question.command-Db64SCn6.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: 'Question 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: 'No question structure to preview' },\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: 'No question to preview' },\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 message = error instanceof Error ? error.message : 'Unknown error';\n return {\n success: false,\n message: { text: `Error previewing question: ${message}` },\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,gB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AAA;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 { A as AXMQuestionnaireViewerService, g as formatQuestionnairePreviewDialogTitle } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-
|
|
5
|
+
import { A as AXMQuestionnaireViewerService, g as formatQuestionnairePreviewDialogTitle } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-BcpbQ8TJ.mjs';
|
|
6
6
|
import { RootConfig, toPrePostConfig, toDisplaySettings, toPrintSettings } from '@acorex-platform/module-assessment-management-client/contracts';
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
@@ -162,4 +162,4 @@ function asEntityId(value) {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
export { AXPPreviewQuestionnaireCommand };
|
|
165
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-questionnaire.command-
|
|
165
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-questionnaire.command-yOfBbOMK.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-questionnaire.command-D9Y57_r2.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: {\n text: 'Questionnaire id is missing (could not resolve from command context).',\n },\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: `Questionnaire with ID ${questionnaireId} not found`,\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: {\n text: 'Questionnaire has no questions to preview',\n },\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: any) {\n return {\n success: false,\n message: {\n text: `Error previewing questionnaire: ${error.message || 'Unknown error'}`,\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;AAoJnE,IAA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,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-yOfBbOMK.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: {\n text: 'Questionnaire id is missing (could not resolve from command context).',\n },\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: `Questionnaire with ID ${questionnaireId} not found`,\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: {\n text: 'Questionnaire has no questions to preview',\n },\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: any) {\n return {\n success: false,\n message: {\n text: `Error previewing questionnaire: ${error.message || 'Unknown error'}`,\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;AAoJnE,IAAA;;;AA9IC;;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,gBAAgB,GAAG,CAAC,CAAU,KAClC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS;AAEvD,QAAA,MAAM,cAAc,GAAG,CAAC,CAAU,KAAwB;AACxD,YAAA,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC;AAC7B,YAAA,IAAI,CAAC;AAAE,gBAAA,OAAO,CAAC;AACf,YAAA,IAAI,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;gBAC9B,MAAM,CAAC,GAAG,CAA4B;AACtC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AO,EAAE,KAAK,EAAE;iBACnD;YACH;YACA,OAAO;AACL,gBAAA,OAAO,EAAE,IAAI;AACb,gBAAA,IAAI,EAAE,QAAQ;AACd,gBAAA,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE;aACnD;QACH;QAAE,OAAO,KAAU,EAAE;YACnB,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;AACP,oBAAA,IAAI,EAAE,CAAA,gCAAA,EAAmC,KAAK,CAAC,OAAO,IAAI,eAAe,CAAA,CAAE;AAC5E,iBAAA;aACF;QACH;IACF;8GAtJW,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA9B,8BAA8B,EAAA,CAAA,CAAA;;2FAA9B,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C;;AA4JD,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-session-pdf.command-BsiJU6ep.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-session-pdf.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { get, isEmpty, isString, toString } from 'lodash';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport {\n AXM_ASSESSMENT_SESSION_PREVIEW_PDF_COMMAND_KEY,\n type AXMAssessmentSessionPreviewPdfRequest,\n type AXMAssessmentSessionPreviewPdfResult,\n} from '@acorex-platform/module-assessment-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface PreviewSessionPdfCommandInput {\n caseId?: string;\n sessionId?: string;\n questionnaireId?: string;\n locale?: string;\n printHtmlGzip?: string;\n title?: string;\n printTemplateId?: string;\n paperSize?: 'A4' | 'Letter' | 'Legal';\n orientation?: 'portrait' | 'landscape';\n watermark?: string;\n}\n\ntype PreviewSessionPdfCommandInvocation = PreviewSessionPdfCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<PreviewSessionPdfCommandInput>;\n /** Reserved tab from the click handler so popup blockers do not hide the PDF. */\n previewWindow?: Window | null;\n};\n\n//#endregion\n\n//#region ---- Preview session PDF command ----\n\n@Injectable()\nexport class PreviewSessionPdfCommand implements AXPCommand<PreviewSessionPdfCommandInput, void> {\n private readonly commandService = inject(AXPCommandService);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(input: PreviewSessionPdfCommandInvocation): AXPCommandExecuteResultPromise<void> {\n const previewWindow = input.previewWindow ?? this.openPreviewWindow();\n this.writePreviewPlaceholder(previewWindow);\n try {\n const printHtmlGzip = this.asNonEmptyString(input.printHtmlGzip);\n const sessionId = this.resolveSessionId(input);\n const caseId = this.resolveCaseId(input);\n const questionnaireId = this.asEntityId(input.questionnaireId);\n const printTemplateId = this.asEntityId(input.printTemplateId);\n if (!printHtmlGzip && !sessionId && !caseId) {\n this.closePreviewWindow(previewWindow);\n return {\n success: false,\n message: { text: 'Assessment case ID, session ID, or print HTML is required' },\n };\n }\n\n const locale =\n this.asNonEmptyString(input.locale) ??\n this.asNonEmptyString(this.translationService.getActiveLang()) ??\n 'en-US';\n const documentTitle = this.asNonEmptyString(input.title);\n\n const result = await this.commandService.executeRemote<\n AXMAssessmentSessionPreviewPdfRequest,\n AXMAssessmentSessionPreviewPdfResult\n >(AXM_ASSESSMENT_SESSION_PREVIEW_PDF_COMMAND_KEY, {\n ...(printHtmlGzip ? { printHtmlGzip } : {}),\n ...(documentTitle ? { title: documentTitle } : {}),\n ...(sessionId ? { sessionId } : {}),\n ...(caseId ? { caseId } : {}),\n ...(questionnaireId ? { questionnaireId } : {}),\n ...(printTemplateId ? { printTemplateId } : {}),\n ...(this.asNonEmptyString(input.paperSize) ? { paperSize: input.paperSize } : {}),\n ...(this.asNonEmptyString(input.orientation) ? { orientation: input.orientation } : {}),\n ...(input.watermark != null ? { watermark: input.watermark } : {}),\n locale,\n });\n\n const pdf = runtimeCommandPayloadData(result);\n if (!pdf?.base64) {\n this.closePreviewWindow(previewWindow);\n const message =\n (typeof result?.message?.text === 'string' && result.message.text.trim()) ||\n (await this.translationService.translateAsync(\n '@assessment-management:sessions.actions.preview-pdf.failed',\n )) ||\n 'Failed to preview assessment session PDF.';\n return { success: false, message: { text: message } };\n }\n\n this.showPdfInBrowser(previewWindow, pdf.base64, pdf.filename || 'questionnaire.pdf');\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n this.closePreviewWindow(previewWindow);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Failed to preview assessment session PDF.',\n },\n };\n }\n }\n\n private openPreviewWindow(): Window | null {\n if (typeof window === 'undefined') {\n return null;\n }\n const preview = window.open('about:blank', '_blank');\n this.writePreviewPlaceholder(preview);\n window.focus();\n return preview;\n }\n\n private writePreviewPlaceholder(preview: Window | null): void {\n if (!preview || preview.closed) {\n return;\n }\n try {\n preview.document.title = 'Preview PDF';\n preview.document.body.innerHTML =\n '<p style=\"font-family:sans-serif;padding:24px;color:#64748b\">Generating PDF…</p>';\n } catch {\n // about:blank can be briefly cross-origin in some browsers\n }\n }\n\n private showPdfInBrowser(preview: Window | null, base64: string, filename: string): void {\n const bytes = Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));\n const blob = new Blob([bytes], { type: 'application/pdf' });\n const url = URL.createObjectURL(blob);\n if (preview && !preview.closed) {\n preview.location.replace(url);\n try {\n preview.focus();\n } catch {\n // some browsers block focus from a backgrounded opener\n }\n window.setTimeout(() => URL.revokeObjectURL(url), 60_000);\n return;\n }\n const opened = window.open(url, '_blank', 'noopener');\n if (opened) {\n window.setTimeout(() => URL.revokeObjectURL(url), 60_000);\n return;\n }\n const link = document.createElement('a');\n link.href = url;\n link.download = filename;\n link.rel = 'noopener';\n link.click();\n window.setTimeout(() => URL.revokeObjectURL(url), 60_000);\n }\n\n private closePreviewWindow(preview: Window | null): void {\n if (preview && !preview.closed) {\n preview.close();\n }\n }\n\n private resolveSessionId(input: PreviewSessionPdfCommandInvocation): string | undefined {\n const candidates = [get(input, 'sessionId'), get(input, 'options.sessionId')];\n for (const candidate of candidates) {\n const resolved = this.asNonEmptyString(candidate);\n if (resolved) {\n return resolved;\n }\n }\n const row = get(input, 'data') as Record<string, unknown> | undefined;\n if (row && this.asNonEmptyString(get(row, 'caseId'))) {\n return this.asNonEmptyString(get(row, 'id'));\n }\n return undefined;\n }\n\n private resolveCaseId(input: PreviewSessionPdfCommandInvocation): string | undefined {\n const candidates = [get(input, 'caseId'), get(input, 'options.caseId')];\n for (const candidate of candidates) {\n const resolved = this.asNonEmptyString(candidate);\n if (resolved) {\n return resolved;\n }\n }\n const row = get(input, 'data') as Record<string, unknown> | undefined;\n if (row && !this.asNonEmptyString(get(row, 'caseId'))) {\n return this.asNonEmptyString(get(row, 'id'));\n }\n return undefined;\n }\n\n private asEntityId(value: unknown): string | undefined {\n if (isString(value) && !isEmpty(value.trim())) {\n return value.trim();\n }\n if (value && typeof value === 'object' && 'id' in value) {\n return this.asEntityId((value as { id: unknown }).id);\n }\n return undefined;\n }\n\n private asNonEmptyString(value: unknown): string | undefined {\n if (isString(value) && !isEmpty(value)) {\n return value;\n }\n if (value != null && !isString(value)) {\n const normalized = toString(value).trim();\n return isEmpty(normalized) ? undefined : normalized;\n }\n return undefined;\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;AAsCA;AAEA;MAGa,wBAAwB,CAAA;AADrC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA4KnE,IAAA;IA1KC,MAAM,OAAO,CAAC,KAAyC,EAAA;QACrD,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,iBAAiB,EAAE;AACrE,QAAA,IAAI,CAAC,uBAAuB,CAAC,aAAa,CAAC;AAC3C,QAAA,IAAI;YACF,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,aAAa,CAAC;YAChE,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;YAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YACxC,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC;YAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC;YAC9D,IAAI,CAAC,aAAa,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,EAAE;AAC3C,gBAAA,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC;gBACtC,OAAO;AACL,oBAAA,OAAO,EAAE,KAAK;AACd,oBAAA,OAAO,EAAE,EAAE,IAAI,EAAE,2DAA2D,EAAE;iBAC/E;YACH;YAEA,MAAM,MAAM,GACV,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC;gBACnC,IAAI,CAAC,gBAAgB,CAAC,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|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-session-pdf.command-BsiJU6ep.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-session-pdf.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { get, isEmpty, isString, toString } from 'lodash';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport {\n AXM_ASSESSMENT_SESSION_PREVIEW_PDF_COMMAND_KEY,\n type AXMAssessmentSessionPreviewPdfRequest,\n type AXMAssessmentSessionPreviewPdfResult,\n} from '@acorex-platform/module-assessment-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface PreviewSessionPdfCommandInput {\n caseId?: string;\n sessionId?: string;\n questionnaireId?: string;\n locale?: string;\n printHtmlGzip?: string;\n title?: string;\n printTemplateId?: string;\n paperSize?: 'A4' | 'Letter' | 'Legal';\n orientation?: 'portrait' | 'landscape';\n watermark?: string;\n}\n\ntype PreviewSessionPdfCommandInvocation = PreviewSessionPdfCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<PreviewSessionPdfCommandInput>;\n /** Reserved tab from the click handler so popup blockers do not hide the PDF. */\n previewWindow?: Window | null;\n};\n\n//#endregion\n\n//#region ---- Preview session PDF command ----\n\n@Injectable()\nexport class PreviewSessionPdfCommand implements AXPCommand<PreviewSessionPdfCommandInput, void> {\n private readonly commandService = inject(AXPCommandService);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(input: PreviewSessionPdfCommandInvocation): AXPCommandExecuteResultPromise<void> {\n const previewWindow = input.previewWindow ?? this.openPreviewWindow();\n this.writePreviewPlaceholder(previewWindow);\n try {\n const printHtmlGzip = this.asNonEmptyString(input.printHtmlGzip);\n const sessionId = this.resolveSessionId(input);\n const caseId = this.resolveCaseId(input);\n const questionnaireId = this.asEntityId(input.questionnaireId);\n const printTemplateId = this.asEntityId(input.printTemplateId);\n if (!printHtmlGzip && !sessionId && !caseId) {\n this.closePreviewWindow(previewWindow);\n return {\n success: false,\n message: { text: 'Assessment case ID, session ID, or print HTML is required' },\n };\n }\n\n const locale =\n this.asNonEmptyString(input.locale) ??\n this.asNonEmptyString(this.translationService.getActiveLang()) ??\n 'en-US';\n const documentTitle = this.asNonEmptyString(input.title);\n\n const result = await this.commandService.executeRemote<\n AXMAssessmentSessionPreviewPdfRequest,\n AXMAssessmentSessionPreviewPdfResult\n >(AXM_ASSESSMENT_SESSION_PREVIEW_PDF_COMMAND_KEY, {\n ...(printHtmlGzip ? { printHtmlGzip } : {}),\n ...(documentTitle ? { title: documentTitle } : {}),\n ...(sessionId ? { sessionId } : {}),\n ...(caseId ? { caseId } : {}),\n ...(questionnaireId ? { questionnaireId } : {}),\n ...(printTemplateId ? { printTemplateId } : {}),\n ...(this.asNonEmptyString(input.paperSize) ? { paperSize: input.paperSize } : {}),\n ...(this.asNonEmptyString(input.orientation) ? { orientation: input.orientation } : {}),\n ...(input.watermark != null ? { watermark: input.watermark } : {}),\n locale,\n });\n\n const pdf = runtimeCommandPayloadData(result);\n if (!pdf?.base64) {\n this.closePreviewWindow(previewWindow);\n const message =\n (typeof result?.message?.text === 'string' && result.message.text.trim()) ||\n (await this.translationService.translateAsync(\n '@assessment-management:sessions.actions.preview-pdf.failed',\n )) ||\n 'Failed to preview assessment session PDF.';\n return { success: false, message: { text: message } };\n }\n\n this.showPdfInBrowser(previewWindow, pdf.base64, pdf.filename || 'questionnaire.pdf');\n return { success: true, kind: 'object', data: undefined };\n } catch (error: unknown) {\n this.closePreviewWindow(previewWindow);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Failed to preview assessment session PDF.',\n },\n };\n }\n }\n\n private openPreviewWindow(): Window | null {\n if (typeof window === 'undefined') {\n return null;\n }\n const preview = window.open('about:blank', '_blank');\n this.writePreviewPlaceholder(preview);\n window.focus();\n return preview;\n }\n\n private writePreviewPlaceholder(preview: Window | null): void {\n if (!preview || preview.closed) {\n return;\n }\n try {\n preview.document.title = 'Preview PDF';\n preview.document.body.innerHTML =\n '<p style=\"font-family:sans-serif;padding:24px;color:#64748b\">Generating PDF…</p>';\n } catch {\n // about:blank can be briefly cross-origin in some browsers\n }\n }\n\n private showPdfInBrowser(preview: Window | null, base64: string, filename: string): void {\n const bytes = Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));\n const blob = new Blob([bytes], { type: 'application/pdf' });\n const url = URL.createObjectURL(blob);\n if (preview && !preview.closed) {\n preview.location.replace(url);\n try {\n preview.focus();\n } catch {\n // some browsers block focus from a backgrounded opener\n }\n window.setTimeout(() => URL.revokeObjectURL(url), 60_000);\n return;\n }\n const opened = window.open(url, '_blank', 'noopener');\n if (opened) {\n window.setTimeout(() => URL.revokeObjectURL(url), 60_000);\n return;\n }\n const link = document.createElement('a');\n link.href = url;\n link.download = filename;\n link.rel = 'noopener';\n link.click();\n window.setTimeout(() => URL.revokeObjectURL(url), 60_000);\n }\n\n private closePreviewWindow(preview: Window | null): void {\n if (preview && !preview.closed) {\n preview.close();\n }\n }\n\n private resolveSessionId(input: PreviewSessionPdfCommandInvocation): string | undefined {\n const candidates = [get(input, 'sessionId'), get(input, 'options.sessionId')];\n for (const candidate of candidates) {\n const resolved = this.asNonEmptyString(candidate);\n if (resolved) {\n return resolved;\n }\n }\n const row = get(input, 'data') as Record<string, unknown> | undefined;\n if (row && this.asNonEmptyString(get(row, 'caseId'))) {\n return this.asNonEmptyString(get(row, 'id'));\n }\n return undefined;\n }\n\n private resolveCaseId(input: PreviewSessionPdfCommandInvocation): string | undefined {\n const candidates = [get(input, 'caseId'), get(input, 'options.caseId')];\n for (const candidate of candidates) {\n const resolved = this.asNonEmptyString(candidate);\n if (resolved) {\n return resolved;\n }\n }\n const row = get(input, 'data') as Record<string, unknown> | undefined;\n if (row && !this.asNonEmptyString(get(row, 'caseId'))) {\n return this.asNonEmptyString(get(row, 'id'));\n }\n return undefined;\n }\n\n private asEntityId(value: unknown): string | undefined {\n if (isString(value) && !isEmpty(value.trim())) {\n return value.trim();\n }\n if (value && typeof value === 'object' && 'id' in value) {\n return this.asEntityId((value as { id: unknown }).id);\n }\n return undefined;\n }\n\n private asNonEmptyString(value: unknown): string | undefined {\n if (isString(value) && !isEmpty(value)) {\n return value;\n }\n if (value != null && !isString(value)) {\n const normalized = toString(value).trim();\n return isEmpty(normalized) ? undefined : normalized;\n }\n return undefined;\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;AAsCA;AAEA;MAGa,wBAAwB,CAAA;AADrC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA4KnE,IAAA;IA1KC,MAAM,OAAO,CAAC,KAAyC,EAAA;QACrD,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,iBAAiB,EAAE;AACrE,QAAA,IAAI,CAAC,uBAAuB,CAAC,aAAa,CAAC;AAC3C,QAAA,IAAI;YACF,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,aAAa,CAAC;YAChE,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;YAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YACxC,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC;YAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC;YAC9D,IAAI,CAAC,aAAa,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,EAAE;AAC3C,gBAAA,IAAI,CA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G,UAAU;QACrD;AACA,QAAA,OAAO,SAAS;IAClB;8GA7KW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAxB,wBAAwB,EAAA,CAAA,CAAA;;2FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC;;;"}
|
|
@@ -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 { s as stripQuestionBankInterfaceMetadata, r as resolveWidgetNodeFromMetaDataDefinitionInterface } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-
|
|
15
|
+
import { s as stripQuestionBankInterfaceMetadata, r as resolveWidgetNodeFromMetaDataDefinitionInterface } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-BcpbQ8TJ.mjs';
|
|
16
16
|
import * as i2 from '@acorex/components/decorators';
|
|
17
17
|
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
18
18
|
|
|
@@ -376,7 +376,7 @@ class AXMQuestionBankInterfaceEditorWidgetEditComponent extends AXPValueWidgetCo
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
</div>
|
|
379
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "
|
|
379
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXPWidgetFieldConfiguratorComponent, selector: "axp-widget-field-configurator", inputs: ["widget", "label", "fieldName", "fieldTitle", "readonly", "selectedItemIdModel", "valuesModel"], outputs: ["widgetChange", "selectedItemIdModelChange", "valuesModelChange"] }, { kind: "component", type: AXMetaDataConfiguratorComponent, selector: "axm-meta-data-configurator", inputs: ["items", "label", "definitionId", "fieldName", "fieldTitle", "readonly"], outputs: ["definitionIdChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i4.AXTranslatorPipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
380
380
|
}
|
|
381
381
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMQuestionBankInterfaceEditorWidgetEditComponent, decorators: [{
|
|
382
382
|
type: Component,
|
|
@@ -486,4 +486,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
486
486
|
}], propDecorators: { definitionIdModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "definitionIdModel", required: false }] }, { type: i0.Output, args: ["definitionIdModelChange"] }], widgetConfigModel: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgetConfigModel", required: false }] }, { type: i0.Output, args: ["widgetConfigModelChange"] }] } });
|
|
487
487
|
|
|
488
488
|
export { AXMQuestionBankInterfaceEditorWidgetEditComponent };
|
|
489
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-
|
|
489
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B9iRaSSF.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-BqIo3Zhp.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","i3"],"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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A,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,EAAAC,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-B9iRaSSF.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","i3"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA;AAEA;AAEA,SAAS,qBAAqB,CAC5B,CAA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