@citolab/qti-components 7.0.11 → 7.0.12
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/cdn/chunks/chunk-34HKCUN3.js +1 -0
- package/cdn/chunks/chunk-4HUJGZW6.js +1 -0
- package/cdn/chunks/chunk-7HFMTJAH.js +1 -0
- package/cdn/chunks/chunk-ARBRHQDY.js +951 -0
- package/cdn/chunks/chunk-BGM3IB5N.js +8 -0
- package/cdn/chunks/chunk-CIN2QCYB.js +3537 -0
- package/cdn/chunks/chunk-DJM7EUKM.js +1 -0
- package/cdn/chunks/chunk-F7RWORNK.js +951 -0
- package/cdn/chunks/chunk-HD7EMR2A.js +1 -0
- package/cdn/chunks/chunk-HEKMMOBI.js +1 -0
- package/cdn/chunks/chunk-I76GONMP.js +951 -0
- package/cdn/chunks/chunk-KVCXK3CQ.js +8 -0
- package/cdn/chunks/chunk-LICVWYUY.js +3537 -0
- package/cdn/chunks/chunk-LWN3NRJE.js +3560 -0
- package/cdn/chunks/chunk-MBWNNFLY.js +951 -0
- package/cdn/chunks/chunk-MCTQZZG4.js +1 -0
- package/cdn/chunks/chunk-NGC3MISE.js +1 -0
- package/cdn/chunks/chunk-NP3JIBVS.js +1 -0
- package/cdn/chunks/chunk-NTR5PVWP.js +3560 -0
- package/cdn/chunks/chunk-P2YEZLMB.js +951 -0
- package/cdn/chunks/chunk-QWJABXM7.js +951 -0
- package/cdn/chunks/chunk-TCHROQU3.js +1 -0
- package/cdn/chunks/chunk-TSTGSXP2.js +951 -0
- package/cdn/chunks/chunk-V6G6L6I3.js +3537 -0
- package/cdn/exports/computed-item.context.js +1 -0
- package/cdn/exports/qti-condition-expression.js +1 -1
- package/cdn/exports/qti-expression.js +1 -1
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +1 -1
- package/cdn/qti-components/index.js +1 -1
- package/cdn/qti-item/core/index.js +1 -1
- package/cdn/qti-test/components/index.js +1 -1
- package/cdn/qti-test/components/test-navigation.js +1 -1
- package/cdn/qti-test/components/test-next.js +1 -1
- package/cdn/qti-test/components/test-paging-buttons-stamp.js +1 -1
- package/cdn/qti-test/components/test-prev.js +1 -1
- package/cdn/qti-test/components/test-print-item-variables.js +1 -1
- package/cdn/qti-test/components/test-section-buttons-stamp.js +1 -1
- package/cdn/qti-test/components/test-view.js +1 -1
- package/cdn/qti-test/core/index.js +1 -1
- package/dist/chunks/chunk-4QYZHR36.js +6541 -0
- package/dist/chunks/chunk-4QYZHR36.js.map +1 -0
- package/dist/chunks/chunk-5QYVCPUS.js +3775 -0
- package/dist/chunks/chunk-5QYVCPUS.js.map +1 -0
- package/dist/chunks/chunk-6Z5YR5U2.js +8 -0
- package/dist/chunks/chunk-6Z5YR5U2.js.map +1 -0
- package/dist/chunks/chunk-7YUCREDM.js +3783 -0
- package/dist/chunks/chunk-7YUCREDM.js.map +1 -0
- package/dist/chunks/chunk-BIQNE2L4.js +6558 -0
- package/dist/chunks/chunk-BIQNE2L4.js.map +1 -0
- package/dist/chunks/chunk-CBSVVXVJ.js +6558 -0
- package/dist/chunks/chunk-CBSVVXVJ.js.map +1 -0
- package/dist/chunks/chunk-D4QP2AIX.js +222 -0
- package/dist/chunks/chunk-D4QP2AIX.js.map +1 -0
- package/dist/chunks/chunk-DACJEGD7.js +95 -0
- package/dist/chunks/chunk-DACJEGD7.js.map +1 -0
- package/dist/chunks/chunk-EFTOJP3Z.js +99 -0
- package/dist/chunks/chunk-EFTOJP3Z.js.map +1 -0
- package/dist/chunks/chunk-FSIQI3KQ.js +6541 -0
- package/dist/chunks/chunk-FSIQI3KQ.js.map +1 -0
- package/dist/chunks/chunk-KOQLAE5C.js +211 -0
- package/dist/chunks/chunk-KOQLAE5C.js.map +1 -0
- package/dist/chunks/chunk-KX5XK2I2.js +636 -0
- package/dist/chunks/chunk-KX5XK2I2.js.map +1 -0
- package/dist/chunks/chunk-LUJE2OUT.js +637 -0
- package/dist/chunks/chunk-LUJE2OUT.js.map +1 -0
- package/dist/chunks/chunk-M3ODN2LD.js +30 -0
- package/dist/chunks/chunk-M3ODN2LD.js.map +1 -0
- package/dist/chunks/chunk-O233FYKS.js +45 -0
- package/dist/chunks/chunk-O233FYKS.js.map +1 -0
- package/dist/chunks/chunk-STT3B34J.js +43 -0
- package/dist/chunks/chunk-STT3B34J.js.map +1 -0
- package/dist/chunks/chunk-TYV2BDMU.js +8 -0
- package/dist/chunks/chunk-TYV2BDMU.js.map +1 -0
- package/dist/chunks/chunk-UDUW5VX5.js +6545 -0
- package/dist/chunks/chunk-UDUW5VX5.js.map +1 -0
- package/dist/chunks/chunk-UIVMRBML.js +230 -0
- package/dist/chunks/chunk-UIVMRBML.js.map +1 -0
- package/dist/chunks/chunk-VYXSKCOZ.js +3706 -0
- package/dist/chunks/chunk-VYXSKCOZ.js.map +1 -0
- package/dist/chunks/chunk-X4BXOQJA.js +6558 -0
- package/dist/chunks/chunk-X4BXOQJA.js.map +1 -0
- package/dist/exports/computed-item.context.d.ts +16 -0
- package/dist/exports/computed-item.context.js +8 -0
- package/dist/exports/computed-item.context.js.map +1 -0
- package/dist/exports/computed.context.d.ts +4 -11
- package/dist/exports/computed.context.js +1 -1
- package/dist/exports/session.context.d.ts +2 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +21 -16
- package/dist/qti-components/index.d.ts +2 -2
- package/dist/qti-components/index.js +2 -2
- package/dist/qti-components-jsx.d.ts +27 -1
- package/dist/qti-item/core/index.d.ts +35 -1
- package/dist/qti-item/core/index.js +6 -1
- package/dist/qti-loader/index.d.ts +2 -2
- package/dist/qti-response-declaration-CBb7rZqd.d.ts +1054 -0
- package/dist/qti-response-declaration-CgrlodE6.d.ts +1052 -0
- package/dist/qti-response-declaration-DZzGH8xM.d.ts +1057 -0
- package/dist/qti-response-declaration-DbMCe0zZ.d.ts +1052 -0
- package/dist/qti-test/components/index.d.ts +3 -2
- package/dist/qti-test/components/index.js +12 -12
- package/dist/qti-test/components/test-navigation.d.ts +4 -3
- package/dist/qti-test/components/test-navigation.js +2 -2
- package/dist/qti-test/components/test-next.d.ts +1 -0
- package/dist/qti-test/components/test-next.js +2 -2
- package/dist/qti-test/components/test-paging-buttons-stamp.js +2 -2
- package/dist/qti-test/components/test-prev.d.ts +1 -0
- package/dist/qti-test/components/test-prev.js +2 -2
- package/dist/qti-test/components/test-print-item-variables.d.ts +1 -0
- package/dist/qti-test/components/test-print-item-variables.js +2 -2
- package/dist/qti-test/components/test-section-buttons-stamp.js +2 -2
- package/dist/qti-test/core/index.d.ts +4 -4
- package/dist/qti-test/core/index.js +1 -1
- package/dist/qti-test-part-B8Dq08t9.d.ts +85 -0
- package/dist/qti-test-part-BYdORfcD.d.ts +85 -0
- package/dist/qti-test-part-CQycFqJC.d.ts +85 -0
- package/dist/qti-test-part-a-IuoG8-.d.ts +85 -0
- package/dist/vscode.html-custom-data.json +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sessionContext
|
|
3
|
+
} from "./chunk-QTH3WLGY.js";
|
|
4
|
+
import {
|
|
5
|
+
testContext
|
|
6
|
+
} from "./chunk-ODLYMQOS.js";
|
|
7
|
+
import {
|
|
8
|
+
computedContext
|
|
9
|
+
} from "./chunk-6Z5YR5U2.js";
|
|
10
|
+
import {
|
|
11
|
+
__decorateClass
|
|
12
|
+
} from "./chunk-H2JE6IVU.js";
|
|
13
|
+
|
|
14
|
+
// src/lib/qti-test/components/test-navigation.ts
|
|
15
|
+
import { consume, provide } from "@lit/context";
|
|
16
|
+
import { html, LitElement } from "lit";
|
|
17
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
18
|
+
var TestNavigation = class extends LitElement {
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
this.identifier = void 0;
|
|
22
|
+
this.initContext = [];
|
|
23
|
+
this.configContext = {};
|
|
24
|
+
this.autoScoreItems = false;
|
|
25
|
+
this.addEventListener("qti-assessment-test-connected", this._handleTestConnected.bind(this));
|
|
26
|
+
this.addEventListener("qti-assessment-item-connected", this._handleItemConnected.bind(this));
|
|
27
|
+
this.addEventListener("qti-interaction-changed", this._handleInteractionChanged.bind(this));
|
|
28
|
+
this.addEventListener("test-end-attempt", this._handleTestEndAttempt.bind(this));
|
|
29
|
+
this.addEventListener("test-show-correct-response", this._handleTestShowCorrectResponse.bind(this));
|
|
30
|
+
}
|
|
31
|
+
_handleTestEndAttempt(_event) {
|
|
32
|
+
const qtiItemEl = this._testElement.querySelector(
|
|
33
|
+
`qti-assessment-item-ref[identifier="${this._sessionContext.navItemId}"]`
|
|
34
|
+
);
|
|
35
|
+
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
36
|
+
const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
|
|
37
|
+
qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);
|
|
38
|
+
}
|
|
39
|
+
_handleTestShowCorrectResponse(event) {
|
|
40
|
+
const qtiItemEl = this._testElement.querySelector(
|
|
41
|
+
`qti-assessment-item-ref[identifier="${this._sessionContext.navItemId}"]`
|
|
42
|
+
);
|
|
43
|
+
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
44
|
+
qtiAssessmentItemEl.showCorrectResponse(event.detail);
|
|
45
|
+
}
|
|
46
|
+
_handleInteractionChanged(_event) {
|
|
47
|
+
if (this.autoScoreItems) {
|
|
48
|
+
const assessmentItem = _event.composedPath()[0].closest("qti-assessment-item");
|
|
49
|
+
const scoreOutcomeIdentifier = assessmentItem.variables.find((v) => v.identifier === "SCORE");
|
|
50
|
+
if (scoreOutcomeIdentifier.externalScored === null && assessmentItem.adaptive === "false") {
|
|
51
|
+
assessmentItem.processResponse();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return html`<slot></slot>`;
|
|
57
|
+
}
|
|
58
|
+
/* PK: on test connected we can build the computed context */
|
|
59
|
+
_handleTestConnected(event) {
|
|
60
|
+
this._testElement = event.detail;
|
|
61
|
+
const testPartElements = Array.from(this._testElement?.querySelectorAll(`qti-test-part`) || []);
|
|
62
|
+
this.computedContext = {
|
|
63
|
+
testParts: testPartElements.map((testPart) => {
|
|
64
|
+
const sectionElements = [...testPart.querySelectorAll(`qti-assessment-section`)];
|
|
65
|
+
return {
|
|
66
|
+
active: false,
|
|
67
|
+
identifier: testPart.identifier,
|
|
68
|
+
sections: sectionElements.map((section) => {
|
|
69
|
+
const itemElements = [...section.querySelectorAll(`qti-assessment-item-ref`)];
|
|
70
|
+
return {
|
|
71
|
+
active: false,
|
|
72
|
+
identifier: section.identifier,
|
|
73
|
+
title: section.title,
|
|
74
|
+
items: itemElements.map((item) => {
|
|
75
|
+
return {
|
|
76
|
+
active: false,
|
|
77
|
+
identifier: item.identifier,
|
|
78
|
+
href: item.href
|
|
79
|
+
};
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
})
|
|
83
|
+
};
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/* PK: on item connected we can add item only properties in the xml */
|
|
88
|
+
_handleItemConnected(event) {
|
|
89
|
+
const itemElement = event.detail;
|
|
90
|
+
this.computedContext = {
|
|
91
|
+
...this.computedContext,
|
|
92
|
+
testParts: this.computedContext.testParts.map((testPart) => {
|
|
93
|
+
return {
|
|
94
|
+
...testPart,
|
|
95
|
+
sections: testPart.sections.map((section) => {
|
|
96
|
+
return {
|
|
97
|
+
...section,
|
|
98
|
+
items: section.items.map(
|
|
99
|
+
(item) => item.identifier === itemElement.identifier ? {
|
|
100
|
+
...item,
|
|
101
|
+
title: itemElement.title,
|
|
102
|
+
adaptive: itemElement.adaptive == "true" || false,
|
|
103
|
+
timeDependent: itemElement.timeDependent == "true" || false
|
|
104
|
+
} : item
|
|
105
|
+
)
|
|
106
|
+
};
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
})
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/* PK: on every change of the candidate we will recomputed the computedContext */
|
|
113
|
+
willUpdate(_changedProperties) {
|
|
114
|
+
if (!this.computedContext) return;
|
|
115
|
+
let itemIndex = 1;
|
|
116
|
+
this.computedContext = {
|
|
117
|
+
...this.computedContext,
|
|
118
|
+
testParts: this.computedContext.testParts.map((testPart) => {
|
|
119
|
+
return {
|
|
120
|
+
...testPart,
|
|
121
|
+
active: this._sessionContext?.navPartId === testPart.identifier || false,
|
|
122
|
+
sections: testPart.sections.map((section) => {
|
|
123
|
+
return {
|
|
124
|
+
...section,
|
|
125
|
+
active: this._sessionContext?.navSectionId === section.identifier || false,
|
|
126
|
+
completed: section.items.every(
|
|
127
|
+
(item) => this._testContext.items.find((i) => i.identifier === item.identifier)?.variables.find((v) => v.identifier === "completionStatus").value === "completed"
|
|
128
|
+
),
|
|
129
|
+
items: section.items.map((item) => {
|
|
130
|
+
const itemContext = this._testContext?.items.find((i) => i.identifier === item.identifier);
|
|
131
|
+
let computedItem;
|
|
132
|
+
if (this.initContext) {
|
|
133
|
+
const initContext = this.initContext.find((i) => i.identifier === item.identifier);
|
|
134
|
+
computedItem = { ...item, ...itemContext, ...initContext };
|
|
135
|
+
} else {
|
|
136
|
+
computedItem = { ...item, ...itemContext };
|
|
137
|
+
}
|
|
138
|
+
const rawscore = computedItem.variables?.find((vr) => vr.identifier == "SCORE")?.value;
|
|
139
|
+
const score = parseInt(rawscore?.toString());
|
|
140
|
+
const completionStatus = computedItem.variables?.find((v) => v.identifier === "completionStatus")?.value;
|
|
141
|
+
const categories = computedItem.category ? computedItem.category?.split(" ") : [];
|
|
142
|
+
const type = categories.includes(this.configContext?.infoItemCategory) ? "info" : "regular";
|
|
143
|
+
const active = this._sessionContext?.navItemId === computedItem.identifier || false;
|
|
144
|
+
const correct = (
|
|
145
|
+
// this._testContext.view === 'scorer' &&
|
|
146
|
+
type == "regular" && score !== void 0 && !isNaN(score) && score > 0 || false
|
|
147
|
+
);
|
|
148
|
+
const incorrect = (
|
|
149
|
+
// this._testContext.view === 'scorer' &&
|
|
150
|
+
type == "regular" && score !== void 0 && !isNaN(score) && score <= 0 || false
|
|
151
|
+
);
|
|
152
|
+
const completed = (
|
|
153
|
+
// this._testContext.view === 'candidate' &&
|
|
154
|
+
completionStatus === "completed"
|
|
155
|
+
);
|
|
156
|
+
const response = computedItem.variables?.find((v) => v.identifier === "RESPONSE")?.value || "";
|
|
157
|
+
const index = categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;
|
|
158
|
+
return {
|
|
159
|
+
...computedItem,
|
|
160
|
+
// rawscore, // not necessary for outside world
|
|
161
|
+
// score, // not necessary for outside world
|
|
162
|
+
// completionStatus, // not necessary for outside world
|
|
163
|
+
// categories, // not necessary for outside world
|
|
164
|
+
type,
|
|
165
|
+
active,
|
|
166
|
+
correct,
|
|
167
|
+
incorrect,
|
|
168
|
+
completed,
|
|
169
|
+
index,
|
|
170
|
+
response
|
|
171
|
+
};
|
|
172
|
+
})
|
|
173
|
+
};
|
|
174
|
+
})
|
|
175
|
+
};
|
|
176
|
+
})
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
__decorateClass([
|
|
181
|
+
property({ type: String })
|
|
182
|
+
], TestNavigation.prototype, "identifier", 2);
|
|
183
|
+
__decorateClass([
|
|
184
|
+
state()
|
|
185
|
+
], TestNavigation.prototype, "initContext", 2);
|
|
186
|
+
__decorateClass([
|
|
187
|
+
state(),
|
|
188
|
+
consume({ context: testContext, subscribe: true })
|
|
189
|
+
], TestNavigation.prototype, "_testContext", 2);
|
|
190
|
+
__decorateClass([
|
|
191
|
+
state(),
|
|
192
|
+
consume({ context: sessionContext, subscribe: true })
|
|
193
|
+
], TestNavigation.prototype, "_sessionContext", 2);
|
|
194
|
+
__decorateClass([
|
|
195
|
+
state()
|
|
196
|
+
], TestNavigation.prototype, "configContext", 2);
|
|
197
|
+
__decorateClass([
|
|
198
|
+
state(),
|
|
199
|
+
provide({ context: computedContext })
|
|
200
|
+
], TestNavigation.prototype, "computedContext", 2);
|
|
201
|
+
__decorateClass([
|
|
202
|
+
property({ type: Boolean, attribute: "auto-score-items" })
|
|
203
|
+
], TestNavigation.prototype, "autoScoreItems", 2);
|
|
204
|
+
TestNavigation = __decorateClass([
|
|
205
|
+
customElement("test-navigation")
|
|
206
|
+
], TestNavigation);
|
|
207
|
+
|
|
208
|
+
export {
|
|
209
|
+
TestNavigation
|
|
210
|
+
};
|
|
211
|
+
//# sourceMappingURL=chunk-KOQLAE5C.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-navigation.ts"],"sourcesContent":["import { consume, provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\nimport { testContext } from '../../exports/test.context';\nimport { sessionContext } from '../../exports/session.context';\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { QtiAssessmentItem } from '../../qti-components';\nimport type { OutcomeVariable } from '../../exports/variables';\nimport type { ComputedContext } from '../../exports/computed.context';\nimport type { PropertyValues } from 'lit';\nimport type { QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiTestPart } from '../core';\nimport type { ConfigContext } from '../../exports/config.context';\nimport type { SessionContext } from '../../exports/session.context';\nimport type { TestContext } from '../../exports/test.context';\n\ntype CustomEventMap = {\n 'test-end-attempt': CustomEvent;\n 'test-show-correct-response': CustomEvent<{ value: boolean }>;\n};\n\ndeclare global {\n interface GlobalEventHandlersEventMap extends CustomEventMap {}\n}\n\n@customElement('test-navigation')\nexport class TestNavigation extends LitElement {\n @property({ type: String }) identifier = undefined;\n\n @state()\n public initContext: { identifier: string; [key: string]: any }[] = [];\n\n @state()\n @consume({ context: testContext, subscribe: true })\n public _testContext?: TestContext;\n\n @state()\n @consume({ context: sessionContext, subscribe: true })\n public _sessionContext?: SessionContext;\n\n @state()\n public configContext: ConfigContext = {};\n\n @state()\n @provide({ context: computedContext })\n public computedContext: ComputedContext;\n\n @property({ type: Boolean, attribute: 'auto-score-items' }) autoScoreItems = false;\n\n private _testElement: QtiAssessmentTest;\n\n constructor() {\n super();\n this.addEventListener('qti-assessment-test-connected', this._handleTestConnected.bind(this));\n this.addEventListener('qti-assessment-item-connected', this._handleItemConnected.bind(this));\n\n this.addEventListener('qti-interaction-changed', this._handleInteractionChanged.bind(this));\n\n this.addEventListener('test-end-attempt', this._handleTestEndAttempt.bind(this));\n this.addEventListener('test-show-correct-response', this._handleTestShowCorrectResponse.bind(this));\n }\n\n private _handleTestEndAttempt(_event: CustomEvent) {\n const qtiItemEl = this._testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);\n }\n\n private _handleTestShowCorrectResponse(event: CustomEvent) {\n const qtiItemEl = this._testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n qtiAssessmentItemEl.showCorrectResponse(event.detail);\n }\n\n private _handleInteractionChanged(_event: CustomEvent) {\n if (this.autoScoreItems) {\n const assessmentItem = (_event.composedPath()[0] as HTMLElement).closest('qti-assessment-item');\n const scoreOutcomeIdentifier = assessmentItem.variables.find(v => v.identifier === 'SCORE') as OutcomeVariable;\n if (scoreOutcomeIdentifier.externalScored === null && assessmentItem.adaptive === 'false') {\n assessmentItem.processResponse();\n }\n }\n }\n\n render() {\n return html`<slot></slot>`;\n }\n\n /* PK: on test connected we can build the computed context */\n _handleTestConnected(event: CustomEvent) {\n this._testElement = event.detail as QtiAssessmentTest;\n const testPartElements = Array.from(this._testElement?.querySelectorAll<QtiTestPart>(`qti-test-part`) || []);\n this.computedContext = {\n testParts: testPartElements.map(testPart => {\n const sectionElements = [...testPart.querySelectorAll<QtiAssessmentSection>(`qti-assessment-section`)];\n return {\n active: false,\n identifier: testPart.identifier,\n sections: sectionElements.map(section => {\n const itemElements = [...section.querySelectorAll<QtiAssessmentItemRef>(`qti-assessment-item-ref`)];\n return {\n active: false,\n identifier: section.identifier,\n title: section.title,\n items: itemElements.map(item => {\n return {\n active: false,\n identifier: item.identifier,\n href: item.href\n };\n })\n };\n })\n };\n })\n };\n\n // const sections = this.computedContext?.testParts.flatMap(testPart => testPart.sections);\n\n // let id;\n // if (this.navigate === 'section') {\n // id = sections.find(section => section.active).identifier;\n // }\n // if (this.navigate === 'item') {\n // id = sections.flatMap(section => section.items).find(item => item.active).identifier;\n // }\n\n // if (id) {\n // this.dispatchEvent(\n // new CustomEvent('qti-request-navigation', {\n // detail: { type: this.navigate, id },\n // bubbles: true,\n // composed: true\n // })\n // );\n // }\n }\n\n /* PK: on item connected we can add item only properties in the xml */\n _handleItemConnected(event: CustomEvent) {\n const itemElement = event.detail as QtiAssessmentItem;\n this.computedContext = {\n ...this.computedContext,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n items: section.items.map(item =>\n item.identifier === itemElement.identifier\n ? {\n ...item,\n title: itemElement.title,\n adaptive: itemElement.adaptive == 'true' || false,\n timeDependent: itemElement.timeDependent == 'true' || false\n }\n : item\n )\n };\n })\n };\n })\n };\n }\n\n /* PK: on every change of the candidate we will recomputed the computedContext */\n protected willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) return;\n\n let itemIndex = 1;\n this.computedContext = {\n ...this.computedContext,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n active: this._sessionContext?.navPartId === testPart.identifier || false,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n active: this._sessionContext?.navSectionId === section.identifier || false,\n completed: section.items.every(\n item =>\n this._testContext.items\n .find(i => i.identifier === item.identifier)\n ?.variables.find(v => v.identifier === 'completionStatus').value === 'completed'\n ),\n\n items: section.items.map(item => {\n const itemContext = this._testContext?.items.find(i => i.identifier === item.identifier);\n let computedItem;\n\n if (this.initContext) {\n const initContext = this.initContext.find(i => i.identifier === item.identifier);\n computedItem = { ...item, ...itemContext, ...initContext };\n } else {\n computedItem = { ...item, ...itemContext };\n }\n\n const rawscore = computedItem.variables?.find(vr => vr.identifier == 'SCORE')?.value;\n const score = parseInt(rawscore?.toString());\n const completionStatus = computedItem.variables?.find(v => v.identifier === 'completionStatus')?.value;\n const categories = computedItem.category ? computedItem.category?.split(' ') : [];\n\n const type = categories.includes(this.configContext?.infoItemCategory) ? 'info' : 'regular'; // rounded-full\n const active = this._sessionContext?.navItemId === computedItem.identifier || false; // !border-sky-600\n\n const correct =\n // this._testContext.view === 'scorer' &&\n (type == 'regular' && score !== undefined && !isNaN(score) && score > 0) || false; // bg-green-100 border-green-400\n const incorrect =\n // this._testContext.view === 'scorer' &&\n (type == 'regular' && score !== undefined && !isNaN(score) && score <= 0) || false; // bg-red-100 border-red-400\n const completed =\n // this._testContext.view === 'candidate' &&\n completionStatus === 'completed';\n // || item.category === this.host._configContext?.infoItemCategory || false\n const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';\n\n const index = categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;\n\n return {\n ...computedItem,\n // rawscore, // not necessary for outside world\n // score, // not necessary for outside world\n // completionStatus, // not necessary for outside world\n // categories, // not necessary for outside world\n type,\n active,\n correct,\n incorrect,\n completed,\n index,\n response\n };\n })\n };\n })\n };\n })\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,SAAS,eAAe;AACjC,SAAS,MAAM,kBAAkB;AACjC,SAAS,eAAe,UAAU,aAAa;AAyBxC,IAAM,iBAAN,cAA6B,WAAW;AAAA,EAyB7C,cAAc;AACZ,UAAM;AAzBoB,sBAAa;AAGzC,SAAO,cAA4D,CAAC;AAWpE,SAAO,gBAA+B,CAAC;AA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