@acorex-platform/module-assessment-management-client 0.0.56 → 0.0.58
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-juxXq2pM.mjs → acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs} +1472 -160
- package/fesm2022/acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-CaElbuNh.mjs → acorex-platform-module-assessment-management-client-assessment-voice.commands-DGYCwZ7v.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-assessment-voice.commands-CaElbuNh.mjs.map → acorex-platform-module-assessment-management-client-assessment-voice.commands-DGYCwZ7v.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-questionnaire.mjs +1 -11
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-questionnaire.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-template.mjs +1 -78
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entities-template.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-DYpWu3Vx.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-DDCy1T4t.mjs} +6 -6
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-DYpWu3Vx.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-acorex-platform-module-assessment-management-client-contracts-entity-catalog-DDCy1T4t.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-CUctZ-0K.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-DXJp2k3o.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-CUctZ-0K.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-case.entity-DXJp2k3o.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-C2JJw_JJ.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-Q7-5toSQ.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-C2JJw_JJ.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-assessment-session.entity-Q7-5toSQ.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-D3y_rWUI.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-CPEpSSlP.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-D3y_rWUI.mjs.map → acorex-platform-module-assessment-management-client-contracts-entity-catalog-question-bank-item.entity-CPEpSSlP.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-CVz5W0fF.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-DOG7yHv-.mjs} +3 -13
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-DOG7yHv-.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-C01AW5NW.mjs → acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-BeYGYRb7.mjs} +3 -80
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-BeYGYRb7.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog.mjs +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts.mjs +33 -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-CMIq-DDl.mjs → acorex-platform-module-assessment-management-client-fill-assessment-session.command-DY_9qPYh.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-fill-assessment-session.command-CMIq-DDl.mjs.map → acorex-platform-module-assessment-management-client-fill-assessment-session.command-DY_9qPYh.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer-edit.component-BlGBTznW.mjs +112 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer-edit.component-BlGBTznW.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-COZcUPEj.mjs → acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-CeLpGSGc.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-COZcUPEj.mjs.map → acorex-platform-module-assessment-management-client-form-template-viewer-popup.component-CeLpGSGc.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-form-template-viewer.service-CvSRpoos.mjs → acorex-platform-module-assessment-management-client-form-template-viewer.service-DoO7ZQmw.mjs} +15 -11
- package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer.service-DoO7ZQmw.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-index-er5gI6QK.mjs +68 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-index-er5gI6QK.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-assessment-management-client-open-form-template.command-CmR-xFHE.mjs → acorex-platform-module-assessment-management-client-open-form-template.command-Cz23Vkyv.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-open-form-template.command-CmR-xFHE.mjs.map → acorex-platform-module-assessment-management-client-open-form-template.command-Cz23Vkyv.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-form-template.command-BEzE0620.mjs → acorex-platform-module-assessment-management-client-preview-form-template.command-DDQOvVpt.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-form-template.command-BEzE0620.mjs.map → acorex-platform-module-assessment-management-client-preview-form-template.command-DDQOvVpt.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-BGT8qB1_.mjs → acorex-platform-module-assessment-management-client-preview-question.command-D4YlqMUf.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-question.command-BGT8qB1_.mjs.map → acorex-platform-module-assessment-management-client-preview-question.command-D4YlqMUf.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-duK7Tjjp.mjs → acorex-platform-module-assessment-management-client-preview-questionnaire.command-BYh-3EP9.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-preview-questionnaire.command-duK7Tjjp.mjs.map → acorex-platform-module-assessment-management-client-preview-questionnaire.command-BYh-3EP9.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B7_G_C5B.mjs → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-DARYq7ZJ.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B7_G_C5B.mjs.map → acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-DARYq7ZJ.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-DIktPLmP.mjs +69 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-DIktPLmP.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-BAoqjZ7K.mjs +78 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-questionnaire-viewer-edit.component-BAoqjZ7K.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-daQL4OD_.mjs → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-O-d2f3fv.mjs} +4 -4
- package/fesm2022/{acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-daQL4OD_.mjs.map → acorex-platform-module-assessment-management-client-questionnaire-viewer-popup.component-O-d2f3fv.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-D0Rkeywu.mjs +26 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-related-content-viewer-page-component.provider-D0Rkeywu.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-related-content-viewer-page.component-CI9AlM58.mjs +315 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-related-content-viewer-page.component-CI9AlM58.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-CPeFh1m7.mjs → acorex-platform-module-assessment-management-client-review-assessment-session.command-CHeyD-AC.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-review-assessment-session.command-CPeFh1m7.mjs.map → acorex-platform-module-assessment-management-client-review-assessment-session.command-CHeyD-AC.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-DlpkbJCZ.mjs +117 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-show-form-template-viewer-popup.command-DlpkbJCZ.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-t67ngnrD.mjs +129 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-show-questionnaire-questions-popup.command-t67ngnrD.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command-DHgNcZ60.mjs +120 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-show-questionnaire-viewer-popup.command-DHgNcZ60.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-assessment-management-client-template-picker.component-D_UCdFOH.mjs → acorex-platform-module-assessment-management-client-template-picker.component-DzboI7GV.mjs} +3 -3
- package/fesm2022/{acorex-platform-module-assessment-management-client-template-picker.component-D_UCdFOH.mjs.map → acorex-platform-module-assessment-management-client-template-picker.component-DzboI7GV.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-assessment-management-client-template-widget-edit.component-DERabYdH.mjs → acorex-platform-module-assessment-management-client-template-widget-edit.component-3DZovs7s.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-template-widget-edit.component-DERabYdH.mjs.map → acorex-platform-module-assessment-management-client-template-widget-edit.component-3DZovs7s.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-DRFfLOCE.mjs +90 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-cell-type-widget-edit.component-DRFfLOCE.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-grid.component-DENxbikr.mjs +77 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-grid.component-DENxbikr.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-Bcvp2Dx5.mjs +236 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-schema-widget-edit.component-Bcvp2Dx5.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-column.component-B3Lx7yuD.mjs +50 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-column.component-B3Lx7yuD.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component-CrvzEcSh.mjs +81 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-edit.component-CrvzEcSh.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-sSky9nAq.mjs +30 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet-widget-view.component-sSky9nAq.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet.util-T-kPrzoj.mjs +423 -0
- package/fesm2022/acorex-platform-module-assessment-management-client-test-sheet.util-T-kPrzoj.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-DjJajIkL.mjs → acorex-platform-module-assessment-management-client-view-session-answers.command-CxZirYRJ.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-assessment-management-client-view-session-answers.command-DjJajIkL.mjs.map → acorex-platform-module-assessment-management-client-view-session-answers.command-CxZirYRJ.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-assessment-management-client.mjs +1 -1
- package/i18n/en-AU/assessment-management.json +69 -0
- package/i18n/en-AU/form-template-management.json +8 -0
- package/i18n/en-US/assessment-management.json +69 -0
- package/i18n/en-US/form-template-management.json +8 -0
- package/i18n/fa-IR/assessment-management.json +69 -0
- package/i18n/fa-IR/form-template-management.json +8 -0
- package/package.json +3 -3
- package/types/acorex-platform-module-assessment-management-client-contracts.d.ts +23 -3
- package/types/acorex-platform-module-assessment-management-client.d.ts +10 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-juxXq2pM.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-questionnaire.entity-CVz5W0fF.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-contracts-entity-catalog-template.entity-C01AW5NW.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-assessment-management-client-form-template-viewer.service-CvSRpoos.mjs.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { AXP_FORM_DESIGNER_SURFACE_PROFILE, AXPLayoutDesignerComponent } from '@acorex-platform/framework-client/layout/designer';
|
|
2
|
+
import { AXPPageLayoutBaseComponent, AXPPageLayoutBase } from '@acorex-platform/framework-client/layout/views';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { input, computed, ChangeDetectionStrategy, Component, Injectable } from '@angular/core';
|
|
5
|
+
import { r as resolvePersistedEntityId, F as FORM_TEMPLATE_PAGE_COMPONENT_KEY } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs';
|
|
6
|
+
|
|
7
|
+
//#region ----- Component -----
|
|
8
|
+
/**
|
|
9
|
+
* Side-menu page that hosts the form layout designer.
|
|
10
|
+
* Used when the form-template plugin display includes `page`.
|
|
11
|
+
*/
|
|
12
|
+
class AXMFormTemplatePageComponent extends AXPPageLayoutBaseComponent {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
//#region ----- Inputs -----
|
|
16
|
+
this.rootContext = input({}, /* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [{ debugName: "rootContext" }] : /* istanbul ignore next */ []));
|
|
18
|
+
this.pageConfig = input(/* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [undefined, { debugName: "pageConfig" }] : /* istanbul ignore next */ []));
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region ----- Computed Properties -----
|
|
22
|
+
this.formSurfaceProfile = AXP_FORM_DESIGNER_SURFACE_PROFILE;
|
|
23
|
+
this.templateId = computed(() => resolvePersistedEntityId(this.rootContext()) ?? null, /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "templateId" }] : /* istanbul ignore next */ []));
|
|
25
|
+
}
|
|
26
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMFormTemplatePageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
27
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: AXMFormTemplatePageComponent, isStandalone: true, selector: "axm-form-template-page", inputs: { rootContext: { classPropertyName: "rootContext", publicName: "rootContext", isSignal: true, isRequired: false, transformFunction: null }, pageConfig: { classPropertyName: "pageConfig", publicName: "pageConfig", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.axp-page-layout-base": "true" } }, providers: [
|
|
28
|
+
{
|
|
29
|
+
provide: AXPPageLayoutBase,
|
|
30
|
+
useExisting: AXMFormTemplatePageComponent,
|
|
31
|
+
},
|
|
32
|
+
], usesInheritance: true, ngImport: i0, template: "@if (templateId(); as id) {\n <!-- ----- Layout designer for the saved form template ----- -->\n <axp-layout-designer [id]=\"id\" [profile]=\"formSurfaceProfile\"></axp-layout-designer>\n}\n", styles: [":host{display:block;height:100%;min-height:70vh}axp-layout-designer{display:block;height:100%;min-height:70vh}\n"], dependencies: [{ kind: "component", type: AXPLayoutDesignerComponent, selector: "axp-layout-designer", inputs: ["id", "strategy", "profile"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
33
|
+
}
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMFormTemplatePageComponent, decorators: [{
|
|
35
|
+
type: Component,
|
|
36
|
+
args: [{ selector: 'axm-form-template-page', standalone: true, imports: [AXPLayoutDesignerComponent], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
37
|
+
{
|
|
38
|
+
provide: AXPPageLayoutBase,
|
|
39
|
+
useExisting: AXMFormTemplatePageComponent,
|
|
40
|
+
},
|
|
41
|
+
], host: {
|
|
42
|
+
'[class.axp-page-layout-base]': 'true',
|
|
43
|
+
}, template: "@if (templateId(); as id) {\n <!-- ----- Layout designer for the saved form template ----- -->\n <axp-layout-designer [id]=\"id\" [profile]=\"formSurfaceProfile\"></axp-layout-designer>\n}\n", styles: [":host{display:block;height:100%;min-height:70vh}axp-layout-designer{display:block;height:100%;min-height:70vh}\n"] }]
|
|
44
|
+
}], propDecorators: { rootContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "rootContext", required: false }] }], pageConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageConfig", required: false }] }] } });
|
|
45
|
+
|
|
46
|
+
var formTemplatePage_component = /*#__PURE__*/Object.freeze({
|
|
47
|
+
__proto__: null,
|
|
48
|
+
AXMFormTemplatePageComponent: AXMFormTemplatePageComponent
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
class AXMFormTemplatePageComponentProvider {
|
|
52
|
+
async components() {
|
|
53
|
+
return [
|
|
54
|
+
{
|
|
55
|
+
key: FORM_TEMPLATE_PAGE_COMPONENT_KEY,
|
|
56
|
+
loader: () => Promise.resolve().then(function () { return formTemplatePage_component; }).then((module) => module.AXMFormTemplatePageComponent),
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMFormTemplatePageComponentProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
61
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMFormTemplatePageComponentProvider }); }
|
|
62
|
+
}
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMFormTemplatePageComponentProvider, decorators: [{
|
|
64
|
+
type: Injectable
|
|
65
|
+
}] });
|
|
66
|
+
|
|
67
|
+
export { AXMFormTemplatePageComponent, AXMFormTemplatePageComponentProvider };
|
|
68
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-index-er5gI6QK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-index-er5gI6QK.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/content-display/form-template/form-template-page/form-template-page.component.ts","../../../../libs/modules/assessment-management/client/src/lib/features/content-display/form-template/form-template-page/form-template-page.component.html","../../../../libs/modules/assessment-management/client/src/lib/features/content-display/form-template/form-template-page/form-template-page-component.provider.ts"],"sourcesContent":["import { AXP_FORM_DESIGNER_SURFACE_PROFILE, AXPLayoutDesignerComponent } from '@acorex-platform/framework-client/layout/designer';\nimport { AXPPageLayoutBase, AXPPageLayoutBaseComponent } from '@acorex-platform/framework-client/layout/views';\nimport { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { resolvePersistedEntityId } from '../../../questionnaire-builder/resolve-persisted-entity-id.util';\n\n//#region ----- Component -----\n\n/**\n * Side-menu page that hosts the form layout designer.\n * Used when the form-template plugin display includes `page`.\n */\n@Component({\n selector: 'axm-form-template-page',\n standalone: true,\n imports: [AXPLayoutDesignerComponent],\n templateUrl: './form-template-page.component.html',\n styleUrl: './form-template-page.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: AXPPageLayoutBase,\n useExisting: AXMFormTemplatePageComponent,\n },\n ],\n host: {\n '[class.axp-page-layout-base]': 'true',\n },\n})\nexport class AXMFormTemplatePageComponent extends AXPPageLayoutBaseComponent {\n //#region ----- Inputs -----\n\n rootContext = input<Record<string, unknown>>({});\n\n pageConfig = input<Record<string, unknown>>();\n\n //#endregion\n\n //#region ----- Computed Properties -----\n\n protected readonly formSurfaceProfile = AXP_FORM_DESIGNER_SURFACE_PROFILE;\n\n protected readonly templateId = computed(() => resolvePersistedEntityId(this.rootContext()) ?? null);\n\n //#endregion\n}\n\n//#endregion\n","@if (templateId(); as id) {\n <!-- ----- Layout designer for the saved form template ----- -->\n <axp-layout-designer [id]=\"id\" [profile]=\"formSurfaceProfile\"></axp-layout-designer>\n}\n","import {\n AXPPageComponentDefinition,\n AXPPageComponentProvider,\n} from '@acorex-platform/framework-client/layout/components';\nimport { Injectable } from '@angular/core';\nimport { FORM_TEMPLATE_PAGE_COMPONENT_KEY } from '../../content-display.constants';\n\n@Injectable()\nexport class AXMFormTemplatePageComponentProvider implements AXPPageComponentProvider {\n async components(): Promise<AXPPageComponentDefinition[]> {\n return [\n {\n key: FORM_TEMPLATE_PAGE_COMPONENT_KEY,\n loader: () => import('./form-template-page.component').then((module) => module.AXMFormTemplatePageComponent),\n },\n ];\n }\n}\n"],"names":[],"mappings":";;;;;;AAKA;AAEA;;;AAGG;AAkBG,MAAO,4BAA6B,SAAQ,0BAA0B,CAAA;AAjB5E,IAAA,WAAA,GAAA;;;QAoBE,IAAA,CAAA,WAAW,GAAG,KAAK,CAA0B,EAAE;wFAAC;AAEhD,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK;kGAA2B;;;QAM1B,IAAA,CAAA,kBAAkB,GAAG,iCAAiC;AAEtD,QAAA,IAAA,CAAA,UAAU,GAAG,QAAQ,CAAC,MAAM,wBAAwB,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,IAAI;uFAAC;AAGrG,IAAA;8GAhBY,4BAA4B,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAA5B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,4BAA4B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,wBAAA,EAAA,MAAA,EAAA,EAAA,WAAA,EAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,UAAA,EAAA,aAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,4BAAA,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AA;kBADhD;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable } from '@angular/core';
|
|
3
|
-
import { A as AXMFormTemplateViewerService } from './acorex-platform-module-assessment-management-client-form-template-viewer.service-
|
|
4
|
-
import { A as AXPFormTemplateViewerConnector } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-
|
|
3
|
+
import { A as AXMFormTemplateViewerService } from './acorex-platform-module-assessment-management-client-form-template-viewer.service-DoO7ZQmw.mjs';
|
|
4
|
+
import { A as AXPFormTemplateViewerConnector } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs';
|
|
5
5
|
|
|
6
6
|
const MISSING_TEMPLATE_KEY = '@form-template-management:templates.viewer.messages.missing-template';
|
|
7
7
|
const NOT_FOUND_KEY = '@form-template-management:templates.viewer.messages.not-found';
|
|
@@ -52,4 +52,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
52
52
|
}] });
|
|
53
53
|
|
|
54
54
|
export { AXMOpenFormTemplateCommand };
|
|
55
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-open-form-template.command-
|
|
55
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-open-form-template.command-Cz23Vkyv.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-open-form-template.command-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-open-form-template.command-Cz23Vkyv.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/commands/open-form-template.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport type { AXPMetaData } from '@acorex-platform/framework-shared/core';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXMFormTemplateViewerService } from '../form-template-viewer.service';\nimport { AXPFormTemplateViewerConnector } from '../viewer-connector.service';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport interface AXMOpenFormTemplateCommandInput {\n data?: {\n id?: string;\n template?: string;\n };\n metadata?: AXPMetaData;\n}\n\nconst MISSING_TEMPLATE_KEY = '@form-template-management:templates.viewer.messages.missing-template';\nconst NOT_FOUND_KEY = '@form-template-management:templates.viewer.messages.not-found';\nconst OPEN_FAILED_KEY = '@form-template-management:templates.viewer.messages.open-failed';\n\n//#endregion\n\n//#region ----- Open form template command -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMOpenFormTemplateCommand implements AXPCommand<AXMOpenFormTemplateCommandInput> {\n //#region ----- Services & Dependencies -----\n\n private readonly formViewer = inject(AXMFormTemplateViewerService);\n private readonly connector = inject(AXPFormTemplateViewerConnector);\n\n //#endregion\n\n //#region ----- Command Implementation -----\n\n async execute(input: AXMOpenFormTemplateCommandInput = {}): AXPCommandExecuteResultPromise {\n try {\n const data = input.data ?? {};\n const metadata = input.metadata;\n const { id, template } = data;\n\n if (!id && !template) {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n\n const result = await this.formViewer.open({ id, template, metadata });\n if (result === 'missing') {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n if (result === 'not-found') {\n return { success: false, message: { text: NOT_FOUND_KEY } };\n }\n if (result.cancelled) {\n return { success: false };\n }\n\n if (id) {\n await this.connector.submit(id, result.context, metadata);\n }\n\n return { success: true, kind: 'object', data: result.context };\n } catch {\n return { success: false, message: { text: OPEN_FAILED_KEY } };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,oBAAoB,GAAG,sEAAsE;AACnG,MAAM,aAAa,GAAG,+DAA+D;AACrF,MAAM,eAAe,GAAG,iEAAiE;AAEzF;AAEA;MAGa,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAA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I,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE;QAChE;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE;QAC/D;IACF;8GAvCW,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA1B,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,0BAA0B,cADb,MAAM,EAAA,CAAA,CAAA;;2FACnB,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable } from '@angular/core';
|
|
3
|
-
import { A as AXMFormTemplateViewerService } from './acorex-platform-module-assessment-management-client-form-template-viewer.service-
|
|
3
|
+
import { A as AXMFormTemplateViewerService } from './acorex-platform-module-assessment-management-client-form-template-viewer.service-DoO7ZQmw.mjs';
|
|
4
4
|
|
|
5
5
|
const MISSING_TEMPLATE_KEY = '@form-template-management:templates.viewer.messages.missing-template';
|
|
6
6
|
const NOT_FOUND_KEY = '@form-template-management:templates.viewer.messages.not-found';
|
|
@@ -87,4 +87,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
87
87
|
}] });
|
|
88
88
|
|
|
89
89
|
export { AXMPreviewFormTemplateCommand };
|
|
90
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-form-template.command-
|
|
90
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-form-template.command-DDQOvVpt.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-form-template.command-
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-form-template.command-DDQOvVpt.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/form-template/viewer/commands/preview-form-template.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXMFormTemplateViewerService } from '../form-template-viewer.service';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport interface AXMPreviewFormTemplateCommandInput {\n templateId?: string;\n templateTitle?: string;\n}\n\ntype AXMPreviewFormTemplateCommandInvocation = AXMPreviewFormTemplateCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<AXMPreviewFormTemplateCommandInput> & Record<string, unknown>;\n};\n\nconst MISSING_TEMPLATE_KEY = '@form-template-management:templates.viewer.messages.missing-template';\nconst NOT_FOUND_KEY = '@form-template-management:templates.viewer.messages.not-found';\nconst OPEN_FAILED_KEY = '@form-template-management:templates.viewer.messages.open-failed';\n\n//#endregion\n\n//#region ----- Preview form template command -----\n\n/**\n * Opens a form template preview. Answers are not saved.\n */\n@Injectable()\nexport class AXMPreviewFormTemplateCommand implements AXPCommand<AXMPreviewFormTemplateCommandInput, void> {\n //#region ----- Services & Dependencies -----\n\n private readonly formViewer = inject(AXMFormTemplateViewerService);\n\n //#endregion\n\n //#region ----- Command Implementation -----\n\n private resolvePayload(\n input: AXMPreviewFormTemplateCommandInvocation,\n ): AXMPreviewFormTemplateCommandInput | null {\n const ctxOpts = input.options;\n const ctxData = input.data;\n\n const asNonEmptyString = (value: unknown): string | undefined =>\n typeof value === 'string' && value.length > 0 ? value : undefined;\n\n const asDisplayTitle = (value: unknown): string | undefined => {\n const text = asNonEmptyString(value);\n if (text) {\n return text;\n }\n if (value && typeof value === 'object') {\n const record = value as Record<string, unknown>;\n const fromTitle = record['title'];\n if (typeof fromTitle === 'string' && fromTitle.trim()) {\n return fromTitle.trim();\n }\n const fromName = record['name'];\n if (typeof fromName === 'string' && fromName.trim()) {\n return fromName.trim();\n }\n }\n return undefined;\n };\n\n const templateId =\n asNonEmptyString(input.templateId) ??\n asNonEmptyString(ctxOpts?.templateId) ??\n (ctxData?.['id'] != null ? String(ctxData['id']) : undefined);\n\n if (!templateId) {\n return null;\n }\n\n const templateTitle =\n asDisplayTitle(input.templateTitle) ??\n asDisplayTitle(ctxOpts?.templateTitle) ??\n asDisplayTitle(ctxData?.['title']) ??\n asDisplayTitle(ctxData?.['name']);\n\n return { templateId, templateTitle };\n }\n\n async execute(input: AXMPreviewFormTemplateCommandInvocation): AXPCommandExecuteResultPromise<void> {\n try {\n const resolved = this.resolvePayload(input);\n if (!resolved?.templateId) {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n\n const result = await this.formViewer.open({\n id: resolved.templateId,\n title: resolved.templateTitle,\n previewMode: true,\n });\n\n if (result === 'missing') {\n return { success: false, message: { text: MISSING_TEMPLATE_KEY } };\n }\n if (result === 'not-found') {\n return { success: false, message: { text: NOT_FOUND_KEY } };\n }\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: result.cancelled ? 'Cancelled' : 'Previewed', refresh: false },\n };\n } catch {\n return { success: false, message: { text: OPEN_FAILED_KEY } };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;AAqBA,MAAM,oBAAoB,GAAG,sEAAsE;AACnG,MAAM,aAAa,GAAG,+DAA+D;AACrF,MAAM,eAAe,GAAG,iEAAiE;AAEzF;AAEA;AAEA;;AAEG;MAEU,6BAA6B,CAAA;AAD1C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,4BAA4B,CAAC;AAoFnE,IAAA;;;AA9ES,IAAA,cAAc,CACpB,KA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E,QAAA,MAAM;AACN,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE;QAC/D;IACF;8GApFW,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA7B,6BAA6B,EAAA,CAAA,CAAA;;2FAA7B,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBADzC;;;"}
|
|
@@ -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 {
|
|
6
|
+
import { h as AXMQuestionnaireViewerService } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs';
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region ---- Preview Question Command ----
|
|
@@ -123,4 +123,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
123
123
|
}] });
|
|
124
124
|
|
|
125
125
|
export { PreviewQuestionCommand };
|
|
126
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-question.command-
|
|
126
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-question.command-D4YlqMUf.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-question.command-BGT8qB1_.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-question.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementQuestionBankItemEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { QuestionnaireBuilderValue } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * Input for PreviewQuestion command.\n * Pass id to load the question bank item (title and structure come from the item).\n * Or pass pre-built structure (e.g. from builder) with optional title.\n */\nexport interface PreviewQuestionCommandInput {\n /** Question bank item id. */\n id?: string;\n /** Pre-built structure; when set, id is not required. */\n structure?: QuestionnaireBuilderValue;\n /** Dialog title when using pre-built structure. */\n title?: string;\n data?: Record<string, unknown>;\n options?: Record<string, unknown>;\n}\n\n//#endregion\n\n//#region ---- Preview Question Command ----\n\n/**\n * Command that opens a preview of a single question in a dialog.\n * Used from the questionnaire builder per-question primary action.\n */\n@Injectable()\nexport class PreviewQuestionCommand implements AXPCommand<PreviewQuestionCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n private resolveId(input: PreviewQuestionCommandInput): string | undefined {\n const record = input as Record<string, unknown>;\n const ctxData = input.data as Record<string, unknown> | undefined;\n const ctxOptions = input.options as Record<string, unknown> | undefined;\n const asString = (v: unknown): string | undefined => (typeof v === 'string' && v.length > 0 ? v : undefined);\n return (\n asString(input.id) ??\n asString(record['questionBankItemId']) ??\n asString(ctxOptions?.['questionBankItemId']) ??\n asString(ctxData?.['id']) ??\n asString(record['id'])\n );\n }\n\n async execute(input: PreviewQuestionCommandInput): AXPCommandExecuteResultPromise<void> {\n try {\n const id = this.resolveId(input);\n let structure: QuestionnaireBuilderValue | undefined = input.structure;\n let title = input.title;\n\n if (id) {\n const item = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionBankItem.name)\n .data<string, AXMAssessmentManagementQuestionBankItemEntityModel>()\n .byKey(id);\n if (!item) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.not-found' },\n };\n }\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n const resolvedListTitle = resolveMultiLanguageString(item.title, locale);\n structure = {\n sections: [\n {\n name: `preview-section-${item.id}`,\n title: resolvedListTitle || 'Question',\n description: undefined,\n order: 0,\n items: [\n {\n name: String(item.id),\n questionBankItemId: item.id,\n order: 0,\n isRequired: false,\n interfaceOverride: item.interface,\n } as QuestionnaireBuilderValue['sections'][0]['items'][0],\n ],\n },\n ],\n displaySettings: {\n viewMode: 'single-page',\n showProgressBar: false,\n showQuestionNumbers: false,\n },\n };\n title = resolvedListTitle || undefined;\n }\n\n if (!structure?.sections?.length) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.no-structure' },\n };\n }\n\n const totalQuestions =\n structure.sections?.reduce((s: number, sec: { items?: unknown[] }) => s + (sec.items?.length ?? 0), 0) ?? 0;\n if (totalQuestions === 0) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.no-question' },\n };\n }\n\n const previewTitleKey = '@assessment-management:question-bank.entities.question-bank-item.actions.preview.title';\n const defaultTitle = (await this.translationService.translateAsync(previewTitleKey)) || 'Preview';\n const dialogTitle = title?.trim() || defaultTitle;\n\n await this.questionnaireViewerService.open({\n title: dialogTitle,\n structure,\n config: { previewMode: true },\n });\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n message: { text: '' },\n metadata: { refresh: false },\n };\n } catch (error: unknown) {\n const fallback = await this.translationService.translateAsync(\n '@general:messages.generic.error.description',\n );\n const message = error instanceof Error ? error.message : fallback;\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-question.errors.failed',\n { params: { message } },\n ),\n },\n };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAiCA;AAEA;AAEA;;;AAGG;MAEU,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAqHnE,IAAA;;;AA/GS,IAAA,SAAS,CAAC,KAAkC,EAAA;QAClD,MAAM,MAAM,GAAG,KAAgC;AAC/C,QAAA,MAAM,OAAO,GAAG,KAAK,CAAC,IAA2C;AACjE,QAAA,MAAM,UAAU,GAAG,KAAK,CAAC,OAA8C;QACvE,MAAM,QAAQ,GAAG,CAAC,CAAU,MAA0B,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;AAC5G,QAAA,QACE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AAClB,YAAA,QAAQ,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACtC,YAAA,QAAQ,CAAC,UAAU,GAAG,oBAAoB,CAAC,CAAC;AAC5C,YAAA,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;AACzB,YAAA,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE1B;IAEA,MAAM,OAAO,CAAC,KAAkC,EAAA;AAC9C,QAAA,IAAI;YACF,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAChC,YAAA,IAAI,SAAS,GAA0C,KAAK,CAAC,SAAS;AACtE,YAAA,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK;YAEvB,IAAI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;AACD,YAAA,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,QAAQ;YACjE,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;AACP,oBAAA,IAAI,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAChD,gEAAgE,EAChE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CACxB;AACF,iBAAA;aACF;QACH;IACF;8GAvHW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAtB,sBAAsB,EAAA,CAAA,CAAA;;2FAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-question.command-D4YlqMUf.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-question.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n\nimport { Injectable, inject } from '@angular/core';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport type { AXMAssessmentManagementQuestionBankItemEntityModel } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { QuestionnaireBuilderValue } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { AXMQuestionnaireViewerService } from '../questionnaire-viewer.service';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * Input for PreviewQuestion command.\n * Pass id to load the question bank item (title and structure come from the item).\n * Or pass pre-built structure (e.g. from builder) with optional title.\n */\nexport interface PreviewQuestionCommandInput {\n /** Question bank item id. */\n id?: string;\n /** Pre-built structure; when set, id is not required. */\n structure?: QuestionnaireBuilderValue;\n /** Dialog title when using pre-built structure. */\n title?: string;\n data?: Record<string, unknown>;\n options?: Record<string, unknown>;\n}\n\n//#endregion\n\n//#region ---- Preview Question Command ----\n\n/**\n * Command that opens a preview of a single question in a dialog.\n * Used from the questionnaire builder per-question primary action.\n */\n@Injectable()\nexport class PreviewQuestionCommand implements AXPCommand<PreviewQuestionCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly entityService = inject(AXPEntityService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n private resolveId(input: PreviewQuestionCommandInput): string | undefined {\n const record = input as Record<string, unknown>;\n const ctxData = input.data as Record<string, unknown> | undefined;\n const ctxOptions = input.options as Record<string, unknown> | undefined;\n const asString = (v: unknown): string | undefined => (typeof v === 'string' && v.length > 0 ? v : undefined);\n return (\n asString(input.id) ??\n asString(record['questionBankItemId']) ??\n asString(ctxOptions?.['questionBankItemId']) ??\n asString(ctxData?.['id']) ??\n asString(record['id'])\n );\n }\n\n async execute(input: PreviewQuestionCommandInput): AXPCommandExecuteResultPromise<void> {\n try {\n const id = this.resolveId(input);\n let structure: QuestionnaireBuilderValue | undefined = input.structure;\n let title = input.title;\n\n if (id) {\n const item = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionBankItem.name)\n .data<string, AXMAssessmentManagementQuestionBankItemEntityModel>()\n .byKey(id);\n if (!item) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.not-found' },\n };\n }\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n const resolvedListTitle = resolveMultiLanguageString(item.title, locale);\n structure = {\n sections: [\n {\n name: `preview-section-${item.id}`,\n title: resolvedListTitle || 'Question',\n description: undefined,\n order: 0,\n items: [\n {\n name: String(item.id),\n questionBankItemId: item.id,\n order: 0,\n isRequired: false,\n interfaceOverride: item.interface,\n } as QuestionnaireBuilderValue['sections'][0]['items'][0],\n ],\n },\n ],\n displaySettings: {\n viewMode: 'single-page',\n showProgressBar: false,\n showQuestionNumbers: false,\n },\n };\n title = resolvedListTitle || undefined;\n }\n\n if (!structure?.sections?.length) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.no-structure' },\n };\n }\n\n const totalQuestions =\n structure.sections?.reduce((s: number, sec: { items?: unknown[] }) => s + (sec.items?.length ?? 0), 0) ?? 0;\n if (totalQuestions === 0) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-question.errors.no-question' },\n };\n }\n\n const previewTitleKey = '@assessment-management:question-bank.entities.question-bank-item.actions.preview.title';\n const defaultTitle = (await this.translationService.translateAsync(previewTitleKey)) || 'Preview';\n const dialogTitle = title?.trim() || defaultTitle;\n\n await this.questionnaireViewerService.open({\n title: dialogTitle,\n structure,\n config: { previewMode: true },\n });\n\n return {\n success: true,\n kind: 'object',\n data: undefined,\n message: { text: '' },\n metadata: { refresh: false },\n };\n } catch (error: unknown) {\n const fallback = await this.translationService.translateAsync(\n '@general:messages.generic.error.description',\n );\n const message = error instanceof Error ? error.message : fallback;\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-question.errors.failed',\n { params: { message } },\n ),\n },\n };\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAiCA;AAEA;AAEA;;;AAGG;MAEU,sBAAsB,CAAA;AADnC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAqHnE,IAAA;;;AA/GS,IAAA,SAAS,CAAC,KAAkC,EAAA;QAClD,M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tB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC;;;"}
|
|
@@ -2,7 +2,7 @@ import { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/t
|
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, Injectable } from '@angular/core';
|
|
4
4
|
import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
|
|
5
|
-
import {
|
|
5
|
+
import { h as AXMQuestionnaireViewerService, g as formatQuestionnairePreviewDialogTitle } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs';
|
|
6
6
|
import { RootConfig, toPrePostConfig, toDisplaySettings, toPrintSettings } from '@acorex-platform/module-assessment-management-client/contracts';
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
@@ -160,4 +160,4 @@ function asEntityId(value) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
export { AXPPreviewQuestionnaireCommand };
|
|
163
|
-
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-questionnaire.command-
|
|
163
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-preview-questionnaire.command-BYh-3EP9.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-questionnaire.command-duK7Tjjp.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-questionnaire.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXMQuestionnaireViewerService } from '../../../features/questionnaire-viewer/questionnaire-viewer.service';\nimport {\n type AXMAssessmentManagementQuestionnaireEntityModel,\n toDisplaySettings,\n toPrePostConfig,\n toPrintSettings,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { formatQuestionnairePreviewDialogTitle } from '../utils/questionnaire-preview-title.util';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * Input for PreviewQuestionnaire command.\n */\nexport interface AXPPreviewQuestionnaireCommandInput {\n /**\n * Questionnaire ID to preview.\n */\n questionnaireId: string;\n\n /**\n * Questionnaire title (for display).\n */\n questionnaireTitle?: string;\n}\n\n/** Entity list passes evaluated action options on `options` (see entity-master-list view model). */\ntype AXPPreviewQuestionnaireCommandInvocation = AXPPreviewQuestionnaireCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<AXPPreviewQuestionnaireCommandInput> & Record<string, unknown>;\n};\n\n//#endregion\n\n//#region ---- Preview Questionnaire Command ----\n\n/**\n * Command that opens a preview of a questionnaire in a dialog.\n */\n@Injectable()\nexport class AXPPreviewQuestionnaireCommand implements AXPCommand<AXPPreviewQuestionnaireCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n /**\n * Resolves questionnaire id/title from root input or from entity action payload (`options` / row `data`).\n */\n private resolvePayload(input: AXPPreviewQuestionnaireCommandInvocation): AXPPreviewQuestionnaireCommandInput | null {\n const ctxOpts = input.options;\n const ctxData = input.data;\n\n const asNonEmptyString = (v: unknown): string | undefined =>\n typeof v === 'string' && v.length > 0 ? v : undefined;\n\n const asDisplayTitle = (v: unknown): string | undefined => {\n const s = asNonEmptyString(v);\n if (s) return s;\n if (v && typeof v === 'object') {\n const o = v as Record<string, unknown>;\n const fromTitle = o['title'];\n if (typeof fromTitle === 'string' && fromTitle.trim()) return fromTitle.trim();\n const fromName = o['name'];\n if (typeof fromName === 'string' && fromName.trim()) return fromName.trim();\n }\n return undefined;\n };\n\n const questionnaireId =\n asNonEmptyString(input.questionnaireId) ??\n asNonEmptyString(ctxOpts?.questionnaireId) ??\n (ctxData?.['id'] != null ? String(ctxData['id']) : undefined);\n\n if (!questionnaireId) {\n return null;\n }\n\n const questionnaireTitle =\n asDisplayTitle(input.questionnaireTitle) ??\n asDisplayTitle(ctxOpts?.questionnaireTitle) ??\n asDisplayTitle(ctxData?.['title']) ??\n asDisplayTitle(ctxData?.['name']);\n\n return { questionnaireId, questionnaireTitle };\n }\n\n async execute(input: AXPPreviewQuestionnaireCommandInvocation): AXPCommandExecuteResultPromise<void> {\n try {\n const resolved = this.resolvePayload(input);\n if (!resolved) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-questionnaire.errors.missing-id' },\n };\n }\n\n const { questionnaireId, questionnaireTitle } = resolved;\n\n // Get questionnaire data\n const questionnaire = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionnaire.name)\n .data<string, AXMAssessmentManagementQuestionnaireEntityModel>()\n .byKey(questionnaireId);\n\n if (!questionnaire) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-questionnaire.errors.not-found',\n { params: { questionnaireId } },\n ),\n },\n };\n }\n\n // Check if questionnaire has questions\n if (!questionnaire.questions || !questionnaire.questions.sections || questionnaire.questions.sections.length === 0) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-questionnaire.errors.no-questions' },\n };\n }\n\n // Get preview title\n const previewTitleKey = '@assessment-management:questionnaires.entities.questionnaire.actions.preview.title';\n const previewTitleBase = (await this.translationService.translateAsync(previewTitleKey)) || 'Preview';\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n const entityTitle = resolveMultiLanguageString(questionnaire.title, locale).trim();\n const displayTitle = questionnaireTitle?.trim() || entityTitle || undefined;\n const previewTitle = formatQuestionnairePreviewDialogTitle(previewTitleBase, displayTitle);\n\n const cfg = toPrePostConfig(questionnaire);\n const displaySettings = toDisplaySettings(questionnaire);\n const questions = questionnaire.questions;\n const structure = {\n sections: questions?.sections ?? [],\n displaySettings: displaySettings ?? undefined,\n printSettings: toPrintSettings(questionnaire) ?? undefined,\n };\n const result = await this.questionnaireViewerService.open({\n title: previewTitle,\n structure,\n prePostConfig: cfg,\n config: {\n previewMode: true,\n completionMode: 'submit-only',\n viewMode: displaySettings?.viewMode,\n showProgressBar: displaySettings?.showProgressBar,\n timer: { showTimer: displaySettings?.showTimer ?? false },\n showQuestionNumbers: displaySettings?.showQuestionNumbers,\n validationStrategy: displaySettings?.validationStrategy,\n },\n questionnaireId,\n printTemplateId: asEntityId(questionnaire.printTemplateId),\n submitHandler: async (answers: Record<string, any>) =>\n this.questionnaireViewerService.buildSummaryPlaceholderValues(structure, answers, {\n questionnaireId,\n }),\n });\n\n if (result?.submitted && result.answers) {\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: 'Previewed', refresh: false },\n };\n }\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: 'Cancelled', refresh: false },\n };\n } catch (error: unknown) {\n const fallback = await this.translationService.translateAsync(\n '@general:messages.generic.error.description',\n );\n const message = error instanceof Error ? error.message : fallback;\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-questionnaire.errors.failed',\n { params: { message } },\n ),\n },\n };\n }\n }\n\n //#endregion\n}\n\nfunction asEntityId(value: unknown): string | undefined {\n if (typeof value === 'string' && value.trim()) {\n return value.trim();\n }\n if (value && typeof value === 'object' && 'id' in value) {\n return asEntityId((value as { id: unknown }).id);\n }\n return undefined;\n}\n\n//#endregion\n\n"],"names":[],"mappings":";;;;;;;AA2CA;AAEA;AAEA;;AAEG;MAEU,8BAA8B,CAAA;AAD3C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,0BAA0B,GAAG,MA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,qEAAqE,EACrE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CACxB;AACF,iBAAA;aACF;QACH;IACF;8GA5JW,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;;AAkKD,SAAS,UAAU,CAAC,KAAc,EAAA;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE;AAC7C,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;IACA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,IAAI,KAAK,EAAE;AACvD,QAAA,OAAO,UAAU,CAAE,KAAyB,CAAC,EAAE,CAAC;IAClD;AACA,IAAA,OAAO,SAAS;AAClB;;"}
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-assessment-management-client-preview-questionnaire.command-BYh-3EP9.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-viewer/commands/preview-questionnaire.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\n\nimport { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';\nimport { Injectable, inject } from '@angular/core';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXMQuestionnaireViewerService } from '../../../features/questionnaire-viewer/questionnaire-viewer.service';\nimport {\n type AXMAssessmentManagementQuestionnaireEntityModel,\n toDisplaySettings,\n toPrePostConfig,\n toPrintSettings,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { RootConfig } from '@acorex-platform/module-assessment-management-client/contracts';\nimport { formatQuestionnairePreviewDialogTitle } from '../utils/questionnaire-preview-title.util';\n\n//#endregion\n\n//#region ---- Command Input/Output Types ----\n\n/**\n * Input for PreviewQuestionnaire command.\n */\nexport interface AXPPreviewQuestionnaireCommandInput {\n /**\n * Questionnaire ID to preview.\n */\n questionnaireId: string;\n\n /**\n * Questionnaire title (for display).\n */\n questionnaireTitle?: string;\n}\n\n/** Entity list passes evaluated action options on `options` (see entity-master-list view model). */\ntype AXPPreviewQuestionnaireCommandInvocation = AXPPreviewQuestionnaireCommandInput & {\n data?: Record<string, unknown>;\n options?: Partial<AXPPreviewQuestionnaireCommandInput> & Record<string, unknown>;\n};\n\n//#endregion\n\n//#region ---- Preview Questionnaire Command ----\n\n/**\n * Command that opens a preview of a questionnaire in a dialog.\n */\n@Injectable()\nexport class AXPPreviewQuestionnaireCommand implements AXPCommand<AXPPreviewQuestionnaireCommandInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly entityService = inject(AXPEntityService);\n private readonly questionnaireViewerService = inject(AXMQuestionnaireViewerService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n /**\n * Resolves questionnaire id/title from root input or from entity action payload (`options` / row `data`).\n */\n private resolvePayload(input: AXPPreviewQuestionnaireCommandInvocation): AXPPreviewQuestionnaireCommandInput | null {\n const ctxOpts = input.options;\n const ctxData = input.data;\n\n const asNonEmptyString = (v: unknown): string | undefined =>\n typeof v === 'string' && v.length > 0 ? v : undefined;\n\n const asDisplayTitle = (v: unknown): string | undefined => {\n const s = asNonEmptyString(v);\n if (s) return s;\n if (v && typeof v === 'object') {\n const o = v as Record<string, unknown>;\n const fromTitle = o['title'];\n if (typeof fromTitle === 'string' && fromTitle.trim()) return fromTitle.trim();\n const fromName = o['name'];\n if (typeof fromName === 'string' && fromName.trim()) return fromName.trim();\n }\n return undefined;\n };\n\n const questionnaireId =\n asNonEmptyString(input.questionnaireId) ??\n asNonEmptyString(ctxOpts?.questionnaireId) ??\n (ctxData?.['id'] != null ? String(ctxData['id']) : undefined);\n\n if (!questionnaireId) {\n return null;\n }\n\n const questionnaireTitle =\n asDisplayTitle(input.questionnaireTitle) ??\n asDisplayTitle(ctxOpts?.questionnaireTitle) ??\n asDisplayTitle(ctxData?.['title']) ??\n asDisplayTitle(ctxData?.['name']);\n\n return { questionnaireId, questionnaireTitle };\n }\n\n async execute(input: AXPPreviewQuestionnaireCommandInvocation): AXPCommandExecuteResultPromise<void> {\n try {\n const resolved = this.resolvePayload(input);\n if (!resolved) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-questionnaire.errors.missing-id' },\n };\n }\n\n const { questionnaireId, questionnaireTitle } = resolved;\n\n // Get questionnaire data\n const questionnaire = await this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.questionnaire.name)\n .data<string, AXMAssessmentManagementQuestionnaireEntityModel>()\n .byKey(questionnaireId);\n\n if (!questionnaire) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-questionnaire.errors.not-found',\n { params: { questionnaireId } },\n ),\n },\n };\n }\n\n // Check if questionnaire has questions\n if (!questionnaire.questions || !questionnaire.questions.sections || questionnaire.questions.sections.length === 0) {\n return {\n success: false,\n message: { text: '@assessment-management:commands.preview-questionnaire.errors.no-questions' },\n };\n }\n\n // Get preview title\n const previewTitleKey = '@assessment-management:questionnaires.entities.questionnaire.actions.preview.title';\n const previewTitleBase = (await this.translationService.translateAsync(previewTitleKey)) || 'Preview';\n const locale = this.translationService.getActiveLang?.() ?? 'en-US';\n const entityTitle = resolveMultiLanguageString(questionnaire.title, locale).trim();\n const displayTitle = questionnaireTitle?.trim() || entityTitle || undefined;\n const previewTitle = formatQuestionnairePreviewDialogTitle(previewTitleBase, displayTitle);\n\n const cfg = toPrePostConfig(questionnaire);\n const displaySettings = toDisplaySettings(questionnaire);\n const questions = questionnaire.questions;\n const structure = {\n sections: questions?.sections ?? [],\n displaySettings: displaySettings ?? undefined,\n printSettings: toPrintSettings(questionnaire) ?? undefined,\n };\n const result = await this.questionnaireViewerService.open({\n title: previewTitle,\n structure,\n prePostConfig: cfg,\n config: {\n previewMode: true,\n completionMode: 'submit-only',\n viewMode: displaySettings?.viewMode,\n showProgressBar: displaySettings?.showProgressBar,\n timer: { showTimer: displaySettings?.showTimer ?? false },\n showQuestionNumbers: displaySettings?.showQuestionNumbers,\n validationStrategy: displaySettings?.validationStrategy,\n },\n questionnaireId,\n printTemplateId: asEntityId(questionnaire.printTemplateId),\n submitHandler: async (answers: Record<string, any>) =>\n this.questionnaireViewerService.buildSummaryPlaceholderValues(structure, answers, {\n questionnaireId,\n }),\n });\n\n if (result?.submitted && result.answers) {\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: 'Previewed', refresh: false },\n };\n }\n return {\n success: true,\n kind: 'object',\n data: undefined,\n metadata: { outcome: 'Cancelled', refresh: false },\n };\n } catch (error: unknown) {\n const fallback = await this.translationService.translateAsync(\n '@general:messages.generic.error.description',\n );\n const message = error instanceof Error ? error.message : fallback;\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync(\n '@assessment-management:commands.preview-questionnaire.errors.failed',\n { params: { message } },\n ),\n },\n };\n }\n }\n\n //#endregion\n}\n\nfunction asEntityId(value: unknown): string | undefined {\n if (typeof value === 'string' && value.trim()) {\n return value.trim();\n }\n if (value && typeof value === 'object' && 'id' in value) {\n return asEntityId((value as { id: unknown }).id);\n }\n return undefined;\n}\n\n//#endregion\n\n"],"names":[],"mappings":";;;;;;;AA2CA;AAEA;AAEA;;AAEG;MAEU,8BAA8B,CAAA;AAD3C,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,0BAA0B,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAClE,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA0JnE,IAAA;;;AApJC;;AAEG;AACK,IA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AAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA9B,8BAA8B,EAAA,CAAA,CAAA;;2FAA9B,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAD1C;;AAkKD,SAAS,UAAU,CAAC,KAAc,EAAA;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE;AAC7C,QAAA,OAAO,KAAK,CAAC,IAAI,EAAE;IACrB;IACA,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,IAAI,KAAK,EAAE;AACvD,QAAA,OAAO,UAAU,CAAE,KAAyB,CAAC,EAAE,CAAC;IAClD;AACA,IAAA,OAAO,SAAS;AAClB;;"}
|
|
@@ -3,7 +3,7 @@ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entit
|
|
|
3
3
|
import { AXToastService } from '@acorex/components/toast';
|
|
4
4
|
import * as i1 from '@acorex/components/button';
|
|
5
5
|
import { AXButtonModule } from '@acorex/components/button';
|
|
6
|
-
import * as
|
|
6
|
+
import * as i3 from '@acorex/core/translation';
|
|
7
7
|
import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
|
|
8
8
|
import { AXMetaDataConfiguratorComponent } from '@acorex-platform/module-data-management-client';
|
|
9
9
|
import { AXPWidgetFieldConfiguratorComponent } from '@acorex-platform/framework-client/layout/components';
|
|
@@ -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 {
|
|
15
|
+
import { v as stripQuestionBankInterfaceMetadata, w as resolveWidgetNodeFromMetaDataDefinitionInterface } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs';
|
|
16
16
|
import * as i2 from '@acorex/components/decorators';
|
|
17
17
|
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
18
18
|
|
|
@@ -376,7 +376,7 @@ class AXMQuestionBankInterfaceEditorWidgetEditComponent extends AXPValueWidgetCo
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
</div>
|
|
379
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXPWidgetFieldConfiguratorComponent, selector: "axp-widget-field-configurator", inputs: ["widget", "label", "fieldName", "fieldTitle", "readonly", "selectedItemIdModel", "valuesModel"], outputs: ["widgetChange", "selectedItemIdModelChange", "valuesModelChange"] }, { kind: "component", type: AXMetaDataConfiguratorComponent, selector: "axm-meta-data-configurator", inputs: ["items", "label", "definitionId", "fieldName", "fieldTitle", "readonly"], outputs: ["definitionIdChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type:
|
|
379
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: AXPWidgetFieldConfiguratorComponent, selector: "axp-widget-field-configurator", inputs: ["widget", "label", "fieldName", "fieldTitle", "readonly", "selectedItemIdModel", "valuesModel"], outputs: ["widgetChange", "selectedItemIdModelChange", "valuesModelChange"] }, { kind: "component", type: AXMetaDataConfiguratorComponent, selector: "axm-meta-data-configurator", inputs: ["items", "label", "definitionId", "fieldName", "fieldTitle", "readonly"], outputs: ["definitionIdChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i3.AXTranslatorPipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
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-DARYq7ZJ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-platform-module-assessment-management-client-question-bank-interface-editor-widget-edit.component-B7_G_C5B.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 //#end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ACjB,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-DARYq7ZJ.mjs","sources":["../../../../libs/modules/assessment-management/client/src/lib/features/questionnaire-builder/questions/widgets/question-bank-interface-editor-widget/question-bank-interface-editor-widget-edit.component.ts"],"sourcesContent":["import { RootConfig as DataManagementRootConfig } from '@acorex-platform/module-data-management-client/contracts';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\n//#region ---- Imports ----\n\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXButtonModule } from '@acorex/components/button';\nimport {\n AXTranslationModule,\n AXTranslationService,\n} from '@acorex/core/translation';\nimport { AXMetaDataConfiguratorComponent } from '@acorex-platform/module-data-management-client';\nimport { type AXMMetaDataDefinitionEntityModel } from '@acorex-platform/module-data-management-client/contracts';\nimport {\n AXPMultiLanguageString,\n type AXPWidgetNode,\n} from '@acorex-platform/framework-shared/core';\nimport { AXPWidgetFieldConfiguratorComponent } from '@acorex-platform/framework-client/layout/components';\nimport { AXPValueWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';\nimport { AsyncPipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n model,\n signal,\n untracked,\n} from '@angular/core';\nimport { isEqual } from 'lodash';\nimport {\n resolveWidgetNodeFromMetaDataDefinitionInterface,\n stripQuestionBankInterfaceMetadata,\n} from '../../../../entities/question-bank-item/question-bank-interface.utils';\nimport type {\n AXMQuestionBankItemInterfaceMetadata,\n AXMQuestionBankItemInterfaceValue,\n} from '@acorex-platform/module-assessment-management-client/contracts';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\n//#endregion\n\n//#region ---- Helpers ----\n\nfunction hasMetadataProvenance(\n v: AXMQuestionBankItemInterfaceValue | null | undefined,\n): boolean {\n const id = v?.metadata?.id;\n return id != null && String(id).trim() !== '';\n}\n\nfunction hasConfiguredWidget(\n v: AXMQuestionBankItemInterfaceValue | null | undefined,\n): boolean {\n const w = stripQuestionBankInterfaceMetadata(v ?? undefined);\n const t = w?.type;\n return typeof t === 'string' && t.trim() !== '';\n}\n\n//#endregion\n\n//#region ---- Component ----\n\n@Component({\n selector: 'axm-question-bank-interface-editor-widget-edit',\n template: `\n <div class=\"flex flex-col gap-1\">\n @if (isInitialized()) {\n @if (showSourceChoice()) {\n <div class=\"flex flex-col gap-3\">\n <p class=\"text-sm text-neutral-700\">\n {{\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.empty-source.prompt'\n | translate\n | async\n }}\n </p>\n <div class=\"flex w-full gap-2\">\n <ax-button\n class=\"flex-1\"\n type=\"button\"\n look=\"twotone\"\n color=\"primary\"\n [disabled]=\"readonly()\"\n [text]=\"\n ('@assessment-management:question-bank.entities.question-bank-item.fields.interface.editor-mode-widget'\n | translate\n | async)!\n \"\n (onClick)=\"chooseWidgetSource()\"\n >\n <ax-icon icon=\"fa-solid fa-puzzle-piece\"></ax-icon>\n </ax-button>\n <ax-button\n class=\"flex-1\"\n type=\"button\"\n look=\"twotone\"\n color=\"secondary\"\n [disabled]=\"readonly()\"\n [text]=\"\n ('@assessment-management:question-bank.entities.question-bank-item.fields.interface.editor-mode-meta-data'\n | translate\n | async)!\n \"\n (onClick)=\"chooseMetadataSource()\"\n >\n <ax-icon icon=\"fa-light fa-database\"></ax-icon>\n </ax-button>\n </div>\n </div>\n } @else if (showReadonlyEmpty()) {\n <p class=\"text-sm text-neutral-600\">\n {{\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.empty-source.readonly'\n | translate\n | async\n }}\n </p>\n }\n @if (showWidgetEditor() || showMetaDataEditor()) {\n @if (showMetaDataEditor()) {\n <axm-meta-data-configurator\n [(definitionId)]=\"definitionIdModel\"\n [fieldName]=\"fieldName()\"\n [fieldTitle]=\"fieldTitle()\"\n [label]=\"metaDataConfiguratorLabel()\"\n [readonly]=\"readonly()\"\n ></axm-meta-data-configurator>\n } @else if (showWidgetEditor()) {\n <axp-widget-field-configurator\n [(widget)]=\"widgetConfigModel\"\n [fieldName]=\"fieldName()\"\n [fieldTitle]=\"fieldTitle()\"\n [label]=\"label()\"\n [readonly]=\"readonly()\"\n ></axp-widget-field-configurator>\n }\n <div class=\"flex justify-end ax-sm\">\n <ax-button\n look=\"twotone\"\n color=\"danger\"\n [disabled]=\"readonly()\"\n [text]=\"\n ('@assessment-management:question-bank.entities.question-bank-item.fields.interface.switch-source'\n | translate\n | async)!\n \"\n (onClick)=\"clearInterfaceConfiguration()\"\n >\n <ax-icon icon=\"fa-light fa-link-slash\"></ax-icon>\n </ax-button>\n </div>\n }\n }\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n AXButtonModule,\n AXPWidgetFieldConfiguratorComponent,\n AXMetaDataConfiguratorComponent,\n AXDecoratorModule,\n AXTranslationModule,\n AsyncPipe,\n ],\n})\nexport class AXMQuestionBankInterfaceEditorWidgetEditComponent extends AXPValueWidgetComponent<AXMQuestionBankItemInterfaceValue | null> {\n private readonly entityService = inject(AXPEntityService);\n //#region ---- Services ----\n\n private readonly translate = inject(AXTranslationService);\n private readonly toast = inject(AXToastService);\n private readonly metaDataDefinitionService = this.entityService\n .withEntity(\n DataManagementRootConfig.module.name,\n DataManagementRootConfig.entities.metaDataDefinition.name,\n )\n .data<any, any>();\n\n //#endregion\n\n //#region ---- Computed ----\n\n protected readonly = computed<boolean>(\n () => this.options()['readonly'] as boolean,\n );\n protected fieldName = computed<string>(() => {\n const fieldNameValue = this.options()['fieldName'];\n if (fieldNameValue !== undefined && fieldNameValue !== null) {\n const stringValue = String(fieldNameValue).trim();\n return stringValue || 'field';\n }\n return 'field';\n });\n protected fieldTitle = computed<AXPMultiLanguageString>(() => {\n const fieldTitleValue = this.options()['fieldTitle'];\n if (fieldTitleValue === undefined || fieldTitleValue === null) {\n return '';\n }\n if (\n typeof fieldTitleValue === 'object' &&\n !Array.isArray(fieldTitleValue)\n ) {\n return fieldTitleValue as Record<string, string>;\n }\n const stringValue = String(fieldTitleValue).trim();\n return stringValue;\n });\n protected label = computed<string>(\n () => (this.options()['label'] as string) || 'Widget Type',\n );\n protected metaDataConfiguratorLabel = computed(\n () =>\n (this.options()['metaDataConfiguratorLabel'] as string) ||\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.meta-data-configurator-label',\n );\n\n /** No widget type and no metadata definition binding — user must pick a configuration path. */\n protected interfaceIsUnset = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n return !hasMetadataProvenance(v) && !hasConfiguredWidget(v);\n });\n\n /** Widget-only path after save, or after the user chose “Widget” on an empty interface. */\n protected showWidgetEditor = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n if (hasMetadataProvenance(v)) {\n return false;\n }\n if (hasConfiguredWidget(v)) {\n return true;\n }\n return this.emptyFlowChoice() === 'widget';\n });\n\n /** Meta-data definition path after save, or after the user chose “MetaData definition” on an empty interface. */\n protected showMetaDataEditor = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n if (hasMetadataProvenance(v)) {\n return true;\n }\n if (!this.interfaceIsUnset()) {\n return false;\n }\n return this.emptyFlowChoice() === 'metadata';\n });\n\n protected showSourceChoice = computed<boolean>(\n () =>\n this.interfaceIsUnset() &&\n this.emptyFlowChoice() === null &&\n !this.readonly(),\n );\n\n protected showReadonlyEmpty = computed<boolean>(\n () =>\n this.interfaceIsUnset() &&\n this.emptyFlowChoice() === null &&\n this.readonly(),\n );\n\n //#endregion\n\n //#region ---- State ----\n\n protected isInitialized = signal(false);\n /** Set only while {@link interfaceIsUnset}; cleared once the value has a widget or metadata. */\n protected emptyFlowChoice = signal<'widget' | 'metadata' | null>(null);\n protected definitionIdModel = model<string>('');\n protected widgetConfigModel = model<AXPWidgetNode>({ type: '', options: {} });\n\n //#endregion\n\n //#region ---- Empty flow ----\n\n protected chooseWidgetSource(): void {\n if (this.readonly()) {\n return;\n }\n this.emptyFlowChoice.set('widget');\n }\n\n protected chooseMetadataSource(): void {\n if (this.readonly()) {\n return;\n }\n this.emptyFlowChoice.set('metadata');\n }\n\n /** Clears both widget config and metadata provenance, then returns to source chooser. */\n protected clearInterfaceConfiguration(): void {\n if (this.readonly()) {\n return;\n }\n untracked(() => {\n this.widgetConfigModel.set({ type: '', options: {} });\n this.definitionIdModel.set('');\n this.emptyFlowChoice.set(null);\n this.setValue(null);\n });\n }\n\n //#endregion\n\n //#region ---- Sync value ↔ configurator (preserve sibling metadata) ----\n\n private syncValueToConfigurator = effect(() => {\n const value = this.getValue();\n const widgetOnly = stripQuestionBankInterfaceMetadata(value ?? undefined);\n\n if (widgetOnly && widgetOnly.type) {\n const currentModel = untracked(() => this.widgetConfigModel());\n if (!isEqual(widgetOnly, currentModel)) {\n untracked(() => {\n this.widgetConfigModel.set(widgetOnly);\n this.isInitialized.set(true);\n });\n }\n } else {\n untracked(() => {\n if (!this.isInitialized()) {\n this.isInitialized.set(true);\n }\n });\n }\n });\n\n private clearEmptyFlowWhenConfigured = effect(() => {\n if (untracked(() => this.interfaceIsUnset())) {\n return;\n }\n untracked(() => {\n if (this.emptyFlowChoice() !== null) {\n this.emptyFlowChoice.set(null);\n }\n });\n });\n\n private syncConfiguratorToValue = effect(() => {\n const modelValue = this.widgetConfigModel();\n\n if (!untracked(() => this.isInitialized())) {\n return;\n }\n\n if (!modelValue || !modelValue.type) {\n return;\n }\n\n const full = untracked(() => this.getValue());\n const metadata =\n (full &&\n typeof full === 'object' &&\n (full as AXMQuestionBankItemInterfaceValue).metadata) ||\n undefined;\n\n const next: AXMQuestionBankItemInterfaceValue = metadata\n ? { ...modelValue, metadata }\n : (modelValue as AXMQuestionBankItemInterfaceValue);\n\n const currentFlat = untracked(() => this.getValue());\n if (!isEqual(next, currentFlat)) {\n untracked(() => {\n this.setValue(next);\n });\n }\n });\n\n private syncDefinitionIdFromValue = effect(() => {\n const value = this.getValue();\n const metaId = value?.metadata?.id;\n if (metaId != null && String(metaId) !== '') {\n const sid = String(metaId);\n if (untracked(() => this.definitionIdModel()) !== sid) {\n untracked(() => this.definitionIdModel.set(sid));\n }\n }\n });\n\n //#endregion\n\n //#region ---- Meta-data definition selection ----\n\n /** True while the meta-data configurator should be active (saved provenance or empty-flow metadata path). */\n private metadataFlowActive = computed<boolean>(() => {\n const v = this.getValue() as\n | AXMQuestionBankItemInterfaceValue\n | null\n | undefined;\n if (hasMetadataProvenance(v)) {\n return true;\n }\n if (!this.interfaceIsUnset()) {\n return false;\n }\n return this.emptyFlowChoice() === 'metadata';\n });\n\n private applyMetadataDefinitionSelection = effect(() => {\n if (!this.metadataFlowActive()) {\n return;\n }\n if (!untracked(() => this.isInitialized())) {\n return;\n }\n const id = this.definitionIdModel();\n if (!id?.trim()) {\n return;\n }\n\n const current = untracked(() => this.getValue());\n if (current?.metadata?.id === id) {\n const stripped = stripQuestionBankInterfaceMetadata(current);\n if (stripped?.type) {\n return;\n }\n }\n\n if (this.readonly()) {\n return;\n }\n\n void this.loadAndApplyMetadataDefinition(id);\n });\n\n private async loadAndApplyMetadataDefinition(id: string): Promise<void> {\n try {\n const row = await this.metaDataDefinitionService.byKey(id);\n const resolved = await resolveWidgetNodeFromMetaDataDefinitionInterface(\n row.interface as AXMMetaDataDefinitionEntityModel['interface'],\n );\n if (!resolved?.type) {\n this.toast.danger(\n (await this.translate.translateAsync(\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.load-from-metadata-invalid',\n )) ??\n 'The selected metadata definition has no valid widget interface.',\n );\n return;\n }\n\n const titleRaw = row.title;\n const metadata: AXMQuestionBankItemInterfaceMetadata = {\n id: String(row.id ?? ''),\n name: String(row.name ?? ''),\n title: (typeof titleRaw === 'object' && titleRaw !== null\n ? titleRaw\n : String(titleRaw ?? '')) as AXPMultiLanguageString | string,\n version: 0,\n };\n\n const next: AXMQuestionBankItemInterfaceValue = {\n ...resolved,\n metadata,\n };\n\n untracked(() => {\n this.setValue(next);\n this.widgetConfigModel.set(resolved);\n });\n } catch (err) {\n console.error(\n '[QuestionBankInterfaceEditor] metadata definition load failed',\n err,\n );\n this.toast.danger(\n (await this.translate.translateAsync(\n '@assessment-management:question-bank.entities.question-bank-item.fields.interface.load-from-metadata-failed',\n )) ?? 'Could not load metadata definitions.',\n );\n }\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":["DataManagementRootConfig"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA;AAEA;AAEA,SAAS,qBAAqB,CAC5B,CAAuD,EAAA;AAEvD,IAAA,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE;AAC1B,IAAA,OAAO,EAAE,IAAI,IAAI,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE;AA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D,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;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';
|
|
2
|
+
import { AXPValueWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';
|
|
3
|
+
import { toPrePostConfig, toDisplaySettings, toPrintSettings } from '@acorex-platform/module-assessment-management-client/contracts';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { inject, signal, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
6
|
+
import { isEqual } from 'lodash';
|
|
7
|
+
import { r as resolvePersistedEntityId, t as AXMQuestionnaireQuestionsBuilderComponent } from './acorex-platform-module-assessment-management-client-acorex-platform-module-assessment-management-client-DxRFMK3k.mjs';
|
|
8
|
+
|
|
9
|
+
//#region ----- Component -----
|
|
10
|
+
class AXMQuestionnaireQuestionsEditorEditComponent extends AXPValueWidgetComponent {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
//#region ----- Services & Dependencies -----
|
|
14
|
+
this.translationService = inject(AXTranslationService);
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region ----- State Signals -----
|
|
17
|
+
/** The builder emits a normalized value on init; that emission is not a user edit. */
|
|
18
|
+
this.skipInitialEmit = signal(true, /* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "skipInitialEmit" }] : /* istanbul ignore next */ []));
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region ----- Computed Properties -----
|
|
22
|
+
this.hostRecord = computed(() => this.contextService.snapshot(), /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "hostRecord" }] : /* istanbul ignore next */ []));
|
|
24
|
+
this.builderValue = computed(() => {
|
|
25
|
+
const value = this.getValue();
|
|
26
|
+
return value != null && typeof value === 'object' ? value : null;
|
|
27
|
+
}, /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "builderValue" }] : /* istanbul ignore next */ []));
|
|
29
|
+
this.prePostConfig = computed(() => toPrePostConfig(this.hostRecord()), /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "prePostConfig" }] : /* istanbul ignore next */ []));
|
|
31
|
+
this.displaySettings = computed(() => toDisplaySettings(this.hostRecord()), /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "displaySettings" }] : /* istanbul ignore next */ []));
|
|
33
|
+
this.printSettings = computed(() => toPrintSettings(this.hostRecord()), /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "printSettings" }] : /* istanbul ignore next */ []));
|
|
35
|
+
this.questionnaireEntityId = computed(() => resolvePersistedEntityId(this.hostRecord()), /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "questionnaireEntityId" }] : /* istanbul ignore next */ []));
|
|
37
|
+
this.questionnaireTitle = computed(() => {
|
|
38
|
+
const title = this.hostRecord()['title'];
|
|
39
|
+
const locale = this.translationService.getActiveLang?.() ?? 'en-US';
|
|
40
|
+
const resolved = resolveMultiLanguageString(title, locale).trim();
|
|
41
|
+
return resolved || undefined;
|
|
42
|
+
}, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "questionnaireTitle" }] : /* istanbul ignore next */ []));
|
|
44
|
+
}
|
|
45
|
+
isReadonly() {
|
|
46
|
+
return this.mode === 'view';
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region ----- Event Handlers -----
|
|
50
|
+
onValueChange(value) {
|
|
51
|
+
if (this.skipInitialEmit()) {
|
|
52
|
+
this.skipInitialEmit.set(false);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (isEqual(this.getValue() ?? null, value ?? null)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.setValue(value);
|
|
59
|
+
}
|
|
60
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMQuestionnaireQuestionsEditorEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
61
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: AXMQuestionnaireQuestionsEditorEditComponent, isStandalone: true, selector: "axm-questionnaire-questions-editor", usesInheritance: true, ngImport: i0, template: "<!-- ----- Questions builder bound to the host record field ----- -->\n<axm-questionnaire-questions-builder\n [value]=\"builderValue()\"\n [readonly]=\"isReadonly()\"\n [prePostConfig]=\"prePostConfig()\"\n [displaySettingsInput]=\"displaySettings()\"\n [printSettingsInput]=\"printSettings()\"\n [questionnaireEntityId]=\"questionnaireEntityId()\"\n [questionnaireTitle]=\"questionnaireTitle()\"\n [showHeader]=\"true\"\n (valueChange)=\"onValueChange($event)\"\n>\n</axm-questionnaire-questions-builder>\n", dependencies: [{ kind: "component", type: AXMQuestionnaireQuestionsBuilderComponent, selector: "axm-questionnaire-questions-builder", inputs: ["value", "readonly", "prePostConfig", "showHeader", "displaySettingsInput", "printSettingsInput", "questionnaireEntityId", "questionnaireTitle"], outputs: ["valueChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
62
|
+
}
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMQuestionnaireQuestionsEditorEditComponent, decorators: [{
|
|
64
|
+
type: Component,
|
|
65
|
+
args: [{ selector: 'axm-questionnaire-questions-editor', changeDetection: ChangeDetectionStrategy.OnPush, imports: [AXMQuestionnaireQuestionsBuilderComponent], template: "<!-- ----- Questions builder bound to the host record field ----- -->\n<axm-questionnaire-questions-builder\n [value]=\"builderValue()\"\n [readonly]=\"isReadonly()\"\n [prePostConfig]=\"prePostConfig()\"\n [displaySettingsInput]=\"displaySettings()\"\n [printSettingsInput]=\"printSettings()\"\n [questionnaireEntityId]=\"questionnaireEntityId()\"\n [questionnaireTitle]=\"questionnaireTitle()\"\n [showHeader]=\"true\"\n (valueChange)=\"onValueChange($event)\"\n>\n</axm-questionnaire-questions-builder>\n" }]
|
|
66
|
+
}] });
|
|
67
|
+
|
|
68
|
+
export { AXMQuestionnaireQuestionsEditorEditComponent };
|
|
69
|
+
//# sourceMappingURL=acorex-platform-module-assessment-management-client-questionnaire-questions-editor-edit.component-DIktPLmP.mjs.map
|