@qti-components/test 1.5.3 → 1.6.0
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/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/qti-assessment-section/qti-assessment-section.d.ts +2 -0
- package/dist/components/qti-assessment-section/qti-assessment-section.js +6 -0
- package/dist/components/qti-assessment-section/qti-assessment-section.js.map +1 -1
- package/dist/components/qti-item-session-control/qti-item-session-control.d.ts +21 -0
- package/dist/components/qti-item-session-control/qti-item-session-control.js +67 -0
- package/dist/components/qti-item-session-control/qti-item-session-control.js.map +1 -0
- package/dist/components/qti-test/qti-test.d.ts +1 -1
- package/dist/components/test-container/test-container.d.ts +3 -3
- package/dist/components/test-container/test-container.js +20 -3
- package/dist/components/test-container/test-container.js.map +1 -1
- package/dist/components/test-end-attempt/test-end-attempt.d.ts +6 -0
- package/dist/components/test-end-attempt/test-end-attempt.js +67 -1
- package/dist/components/test-end-attempt/test-end-attempt.js.map +1 -1
- package/dist/components/test-navigation/test-navigation.d.ts +10 -1
- package/dist/components/test-navigation/test-navigation.js +226 -10
- package/dist/components/test-navigation/test-navigation.js.map +1 -1
- package/dist/components/test-next/test-next.js +18 -2
- package/dist/components/test-next/test-next.js.map +1 -1
- package/dist/components/test-prev/test-prev.js +6 -2
- package/dist/components/test-prev/test-prev.js.map +1 -1
- package/dist/elements.d.ts +5 -1
- package/dist/elements.js +3 -1
- package/dist/elements.js.map +1 -1
- package/dist/mixins/test-base.js +17 -6
- package/dist/mixins/test-base.js.map +1 -1
- package/dist/mixins/test-navigation.mixin.d.ts +29 -2
- package/dist/mixins/test-navigation.mixin.js +35 -0
- package/dist/mixins/test-navigation.mixin.js.map +1 -1
- package/dist/types/iqti-test.d.ts +2 -10
- package/dist/types/iqti-test.js.map +1 -1
- package/package.json +7 -7
|
@@ -14,6 +14,14 @@ import { sessionContext } from '@qti-components/base';
|
|
|
14
14
|
import { qtiContext } from '@qti-components/base';
|
|
15
15
|
export class TestNavigation extends LitElement {
|
|
16
16
|
#testElement;
|
|
17
|
+
/**
|
|
18
|
+
* Whether each item's last *ended attempt* reached the optimal outcome, keyed
|
|
19
|
+
* by item-ref id. Written from #handleItemContextUpdated when processResponse
|
|
20
|
+
* ends an attempt — never on a plain selection. Mirrors how inline feedback
|
|
21
|
+
* only re-evaluates when an attempt is processed, so a freshly-picked answer
|
|
22
|
+
* doesn't flip `done` until the candidate ends the attempt.
|
|
23
|
+
*/
|
|
24
|
+
#optimality;
|
|
17
25
|
constructor() {
|
|
18
26
|
super();
|
|
19
27
|
this.identifier = undefined;
|
|
@@ -27,12 +35,61 @@ export class TestNavigation extends LitElement {
|
|
|
27
35
|
};
|
|
28
36
|
this.configContext = {};
|
|
29
37
|
this.autoScoreItems = false;
|
|
38
|
+
/**
|
|
39
|
+
* Whether each item's last *ended attempt* reached the optimal outcome, keyed
|
|
40
|
+
* by item-ref id. Written from #handleItemContextUpdated when processResponse
|
|
41
|
+
* ends an attempt — never on a plain selection. Mirrors how inline feedback
|
|
42
|
+
* only re-evaluates when an attempt is processed, so a freshly-picked answer
|
|
43
|
+
* doesn't flip `done` until the candidate ends the attempt.
|
|
44
|
+
*/
|
|
45
|
+
this.#optimality = new Map();
|
|
30
46
|
this.addEventListener('qti-assessment-test-connected', this.#handleTestConnected.bind(this));
|
|
31
47
|
this.addEventListener('qti-assessment-item-connected', this.#handleItemConnected.bind(this));
|
|
32
48
|
this.addEventListener('qti-interaction-changed', this.#handleInteractionChanged.bind(this));
|
|
49
|
+
this.addEventListener('qti-item-context-updated', this.#handleItemContextUpdated.bind(this));
|
|
33
50
|
this.addEventListener('test-end-attempt', this.#handleTestEndAttempt.bind(this));
|
|
34
51
|
this.addEventListener('test-update-outcome-variable', this.#handleTestUpdateOutcomeVariable.bind(this));
|
|
35
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Latch whether an item reached its optimal outcome whenever it has just ended
|
|
55
|
+
* an attempt. processResponse — fired by test-end-attempt, autoscore, or an
|
|
56
|
+
* in-item end-attempt interaction — flags its context update with
|
|
57
|
+
* `responseProcessed`; a plain selection updates the context without it, so
|
|
58
|
+
* `done` can't flip until the candidate actually ends the attempt.
|
|
59
|
+
*/
|
|
60
|
+
#handleItemContextUpdated(event) {
|
|
61
|
+
if (!event.detail?.responseProcessed)
|
|
62
|
+
return;
|
|
63
|
+
const itemContext = event.detail.itemContext;
|
|
64
|
+
if (!itemContext?.identifier)
|
|
65
|
+
return;
|
|
66
|
+
const optimality = this.#assessOptimality(itemContext);
|
|
67
|
+
this.#optimality.set(itemContext.identifier, optimality);
|
|
68
|
+
const computedItem = this.computedItemFor(itemContext.identifier);
|
|
69
|
+
const numAttempts = Number(itemContext.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;
|
|
70
|
+
this.afterAttemptEnded(event.composedPath()[0]?.closest('qti-assessment-item'), computedItem, this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Extension point for presentation packages reacting to an ended attempt.
|
|
74
|
+
* `done` is settled here — from the freshly latched optimality and the
|
|
75
|
+
* session-control cascade — because the computed context only catches up on
|
|
76
|
+
* the next update, after this event has finished bubbling.
|
|
77
|
+
*/
|
|
78
|
+
afterAttemptEnded(_assessmentItem, _computedItem, _done) { }
|
|
79
|
+
/** The computed-context entry for an item, from the session-control cascade. */
|
|
80
|
+
computedItemFor(identifier) {
|
|
81
|
+
return this.computedContext?.testParts
|
|
82
|
+
?.flatMap(part => part.sections)
|
|
83
|
+
.flatMap(section => section.items)
|
|
84
|
+
.find(i => i.identifier === identifier);
|
|
85
|
+
}
|
|
86
|
+
/** The assessment item for an item-ref id, if it has been rendered. */
|
|
87
|
+
#assessmentItemFor(identifier) {
|
|
88
|
+
if (!identifier)
|
|
89
|
+
return undefined;
|
|
90
|
+
const itemRef = this.#testElement?.querySelector(`qti-assessment-item-ref[identifier="${identifier}"]`);
|
|
91
|
+
return itemRef?.assessmentItem ?? undefined;
|
|
92
|
+
}
|
|
36
93
|
/** The currently active assessment item, exposed for optional presentation extensions. */
|
|
37
94
|
get activeAssessmentItem() {
|
|
38
95
|
if (!this.#testElement || !this._sessionContext?.navItemRefId)
|
|
@@ -75,6 +132,8 @@ export class TestNavigation extends LitElement {
|
|
|
75
132
|
/* PK: on test connected we can build the computed context */
|
|
76
133
|
#handleTestConnected(event) {
|
|
77
134
|
this.#testElement = event.detail;
|
|
135
|
+
// A fresh test invalidates the per-test optimality latches.
|
|
136
|
+
this.#optimality.clear();
|
|
78
137
|
// Set the testIdentifier in qtiContext if not already set
|
|
79
138
|
if (!this.qtiContext.QTI_CONTEXT?.testIdentifier) {
|
|
80
139
|
const currentContext = this.qtiContext.QTI_CONTEXT || {
|
|
@@ -111,25 +170,52 @@ export class TestNavigation extends LitElement {
|
|
|
111
170
|
view: this._sessionContext?.view,
|
|
112
171
|
testParts: testPartElements.map(testPart => {
|
|
113
172
|
const sectionElements = [...testPart.querySelectorAll(`qti-assessment-section`)];
|
|
173
|
+
const testPartSessionControl = testPart.querySelector(':scope > qti-item-session-control');
|
|
174
|
+
const partAllowSkipping = testPartSessionControl ? testPartSessionControl.allowSkipping : true;
|
|
175
|
+
const partMaxAttempts = testPartSessionControl ? testPartSessionControl.maxAttempts : 1;
|
|
176
|
+
const partShowFeedback = testPartSessionControl ? testPartSessionControl.showFeedback : false;
|
|
177
|
+
const partShowSolution = testPartSessionControl ? testPartSessionControl.showSolution : false;
|
|
114
178
|
return {
|
|
115
179
|
active: false,
|
|
116
180
|
identifier: testPart.identifier,
|
|
117
181
|
navigationMode: testPart.navigationMode,
|
|
118
182
|
submissionMode: testPart.submissionMode,
|
|
183
|
+
allowSkipping: partAllowSkipping,
|
|
119
184
|
sections: sectionElements.map(section => {
|
|
120
185
|
const itemElements = [...section.querySelectorAll(`qti-assessment-item-ref`)];
|
|
186
|
+
const sectionSessionControl = section.querySelector(':scope > qti-item-session-control');
|
|
187
|
+
const sectionAllowSkipping = sectionSessionControl
|
|
188
|
+
? sectionSessionControl.allowSkipping
|
|
189
|
+
: partAllowSkipping;
|
|
190
|
+
const sectionMaxAttempts = sectionSessionControl ? sectionSessionControl.maxAttempts : partMaxAttempts;
|
|
191
|
+
const sectionShowFeedback = sectionSessionControl ? sectionSessionControl.showFeedback : partShowFeedback;
|
|
192
|
+
const sectionShowSolution = sectionSessionControl ? sectionSessionControl.showSolution : partShowSolution;
|
|
121
193
|
return {
|
|
122
194
|
active: false,
|
|
123
195
|
identifier: section.identifier,
|
|
124
196
|
title: section.title,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
197
|
+
navigationMode: section.navigationMode,
|
|
198
|
+
submissionMode: section.submissionMode,
|
|
199
|
+
allowSkipping: sectionAllowSkipping,
|
|
200
|
+
items: itemElements.map(item => {
|
|
201
|
+
const itemSessionControl = item.querySelector(':scope > qti-item-session-control');
|
|
202
|
+
const itemAllowSkipping = itemSessionControl ? itemSessionControl.allowSkipping : sectionAllowSkipping;
|
|
203
|
+
const itemMaxAttempts = itemSessionControl ? itemSessionControl.maxAttempts : sectionMaxAttempts;
|
|
204
|
+
const itemShowFeedback = itemSessionControl ? itemSessionControl.showFeedback : sectionShowFeedback;
|
|
205
|
+
const itemShowSolution = itemSessionControl ? itemSessionControl.showSolution : sectionShowSolution;
|
|
206
|
+
return {
|
|
207
|
+
...this.initContext?.find(i => i.identifier === item.identifier),
|
|
208
|
+
active: false,
|
|
209
|
+
identifier: item.identifier,
|
|
210
|
+
categories: item.category ? item.category?.split(' ') : [],
|
|
211
|
+
href: item.href,
|
|
212
|
+
variables: [],
|
|
213
|
+
allowSkipping: itemAllowSkipping,
|
|
214
|
+
maxAttempts: itemMaxAttempts,
|
|
215
|
+
showFeedback: itemShowFeedback,
|
|
216
|
+
showSolution: itemShowSolution
|
|
217
|
+
};
|
|
218
|
+
})
|
|
133
219
|
};
|
|
134
220
|
})
|
|
135
221
|
};
|
|
@@ -252,8 +338,40 @@ export class TestNavigation extends LitElement {
|
|
|
252
338
|
const completionStatus = computedItem.variables?.find(v => v.identifier === 'completionStatus')
|
|
253
339
|
?.value;
|
|
254
340
|
const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';
|
|
255
|
-
const numAttempts = computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value || 0;
|
|
341
|
+
const numAttempts = Number(computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;
|
|
256
342
|
const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;
|
|
343
|
+
const valid = this.#assessmentItemFor(computedItem.identifier)?.validate(false) ?? true;
|
|
344
|
+
const responseVars = itemContext?.variables?.filter(v => v.type === 'response') || [];
|
|
345
|
+
const isDefaultResponse = responseVars.every(v => {
|
|
346
|
+
if (v.value === undefined || v.value === null) {
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
let fallbackValue;
|
|
350
|
+
switch (v.baseType) {
|
|
351
|
+
case 'integer':
|
|
352
|
+
case 'float':
|
|
353
|
+
case 'duration':
|
|
354
|
+
fallbackValue = '0';
|
|
355
|
+
break;
|
|
356
|
+
case 'boolean':
|
|
357
|
+
fallbackValue = 'false';
|
|
358
|
+
break;
|
|
359
|
+
case 'string':
|
|
360
|
+
case 'directedPair':
|
|
361
|
+
case 'identifier':
|
|
362
|
+
case 'pair':
|
|
363
|
+
case 'record':
|
|
364
|
+
default:
|
|
365
|
+
fallbackValue = '';
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
const defaultValue = v.defaultValue ?? fallbackValue;
|
|
369
|
+
if (Array.isArray(v.value)) {
|
|
370
|
+
const dv = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
371
|
+
return v.value.length === dv.length && v.value.every((val, i) => val === dv[i]);
|
|
372
|
+
}
|
|
373
|
+
return v.value === defaultValue;
|
|
374
|
+
});
|
|
257
375
|
// Computed and opiniated
|
|
258
376
|
// const type = item.categories.includes(this.configContext?.infoItemCategory) ? 'info' : 'regular';
|
|
259
377
|
// const correct = (type == 'regular' && score !== undefined && !isNaN(score) && score > 0) || false;
|
|
@@ -262,6 +380,18 @@ export class TestNavigation extends LitElement {
|
|
|
262
380
|
const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;
|
|
263
381
|
const rawMaxScore = item.variables?.find(vr => vr.identifier == 'MAXSCORE')?.value;
|
|
264
382
|
const maxScore = rawMaxScore === undefined || rawMaxScore === null ? null : parseFloat(rawMaxScore?.toString());
|
|
383
|
+
// Optimality comes from the last *ended attempt* (#optimality),
|
|
384
|
+
// latched in #handleItemContextUpdated — never from a live
|
|
385
|
+
// mid-attempt selection. On a restored session no attempt is ended
|
|
386
|
+
// this run, so seed it once from the persisted context, which still
|
|
387
|
+
// holds the submitted response.
|
|
388
|
+
let optimality = this.#optimality.get(computedItem.identifier);
|
|
389
|
+
if (optimality === undefined) {
|
|
390
|
+
optimality = itemContext ? this.#assessOptimality(itemContext) : 'unscored';
|
|
391
|
+
if (numAttempts > 0)
|
|
392
|
+
this.#optimality.set(computedItem.identifier, optimality);
|
|
393
|
+
}
|
|
394
|
+
const done = this.#isItemDone(numAttempts, optimality, computedItem.maxAttempts);
|
|
265
395
|
return {
|
|
266
396
|
...computedItem,
|
|
267
397
|
completionStatus,
|
|
@@ -270,7 +400,16 @@ export class TestNavigation extends LitElement {
|
|
|
270
400
|
response,
|
|
271
401
|
index,
|
|
272
402
|
active,
|
|
273
|
-
|
|
403
|
+
valid,
|
|
404
|
+
isDefaultResponse,
|
|
405
|
+
maxScore,
|
|
406
|
+
done,
|
|
407
|
+
// Reflects the last *ended* attempt only. Read the latch directly
|
|
408
|
+
// (not the `optimality` local) — the latch is written solely on
|
|
409
|
+
// responseProcessed / restore-seed (line above, guarded by
|
|
410
|
+
// numAttempts > 0), so a freshly-picked mid-attempt selection
|
|
411
|
+
// computed live is never stored and never counts as optimal.
|
|
412
|
+
optimal: this.#optimality.get(computedItem.identifier) === 'optimal'
|
|
274
413
|
// type,
|
|
275
414
|
// correct,
|
|
276
415
|
// incorrect,
|
|
@@ -287,6 +426,83 @@ export class TestNavigation extends LitElement {
|
|
|
287
426
|
bubbles: true
|
|
288
427
|
}));
|
|
289
428
|
}
|
|
429
|
+
/**
|
|
430
|
+
* Decide whether an item should be treated as "the candidate is done with it"
|
|
431
|
+
* for the purpose of gating forward navigation and further attempts.
|
|
432
|
+
*
|
|
433
|
+
* - The candidate must have actually ended an attempt (numAttempts > 0).
|
|
434
|
+
* - Once attempted, the item is done if they reached the optimal outcome
|
|
435
|
+
* ('optimal'), or there's nothing to improve on ('unscored'). It is only *not*
|
|
436
|
+
* done while a better attempt is still possible ('suboptimal') and attempts
|
|
437
|
+
* remain — see #assessOptimality for how "optimal" is determined.
|
|
438
|
+
*
|
|
439
|
+
* `optimality` reflects the last *ended attempt* (see #optimality), not the
|
|
440
|
+
* live selection — so a freshly-picked optimal answer doesn't count as done
|
|
441
|
+
* until test-end-attempt evaluates it.
|
|
442
|
+
*/
|
|
443
|
+
#isItemDone(numAttempts, optimality, maxAttempts) {
|
|
444
|
+
if (numAttempts === 0)
|
|
445
|
+
return false;
|
|
446
|
+
if (optimality !== 'suboptimal')
|
|
447
|
+
return true;
|
|
448
|
+
const max = maxAttempts ?? 1;
|
|
449
|
+
return max > 0 && numAttempts >= max;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Decide whether an item's submission is as good as it can get — i.e. the
|
|
453
|
+
* candidate reached the *optimal* outcome, so there's no reason to make them
|
|
454
|
+
* try again. 'optimal' means best achievable, 'suboptimal' means a better
|
|
455
|
+
* attempt is still possible, 'unscored' means there's nothing to judge against.
|
|
456
|
+
* ("optimal" is the spec's own word — a qti-correct-response is defined as
|
|
457
|
+
* "the (or an) optimal value".)
|
|
458
|
+
*
|
|
459
|
+
* Two signals, in order of authority:
|
|
460
|
+
* 1. The scored outcome: optimal ⟺ SCORE has reached its maximum (MAXSCORE).
|
|
461
|
+
* This correctly handles partial-credit / qti-mapping items, where an exact
|
|
462
|
+
* response match would under- or over-judge.
|
|
463
|
+
* 2. The declared qti-correct-response, for items that aren't scored (no
|
|
464
|
+
* SCORE/MAXSCORE) — an exact match is the best available proxy. Bookkeeping
|
|
465
|
+
* variables like numAttempts can be typed 'response' but never declare a
|
|
466
|
+
* correctResponse, so we filter on a declared correctResponse.
|
|
467
|
+
*
|
|
468
|
+
* Items with neither a comparable score nor a correctResponse (essays, info
|
|
469
|
+
* items, etc.) are 'unscored' — there's no optimal value to require, so one
|
|
470
|
+
* attempt is enough.
|
|
471
|
+
*/
|
|
472
|
+
#assessOptimality(item) {
|
|
473
|
+
const variables = item.variables ?? [];
|
|
474
|
+
const score = this.#numericVariable(variables, 'SCORE');
|
|
475
|
+
const maxScore = this.#numericVariable(variables, 'MAXSCORE');
|
|
476
|
+
if (score !== null && maxScore !== null) {
|
|
477
|
+
return score >= maxScore ? 'optimal' : 'suboptimal';
|
|
478
|
+
}
|
|
479
|
+
const responseVars = variables.filter((v) => v.type === 'response' &&
|
|
480
|
+
v.correctResponse !== undefined &&
|
|
481
|
+
v.correctResponse !== null);
|
|
482
|
+
if (responseVars.length === 0)
|
|
483
|
+
return 'unscored';
|
|
484
|
+
const allMatch = responseVars.every(v => {
|
|
485
|
+
const expected = v.correctResponse;
|
|
486
|
+
const actual = v.value;
|
|
487
|
+
if (actual === undefined || actual === null)
|
|
488
|
+
return false;
|
|
489
|
+
if (Array.isArray(expected) && Array.isArray(actual)) {
|
|
490
|
+
return expected.length === actual.length && expected.every(e => actual.includes(e));
|
|
491
|
+
}
|
|
492
|
+
if (Array.isArray(expected) || Array.isArray(actual))
|
|
493
|
+
return false;
|
|
494
|
+
return expected === actual;
|
|
495
|
+
});
|
|
496
|
+
return allMatch ? 'optimal' : 'suboptimal';
|
|
497
|
+
}
|
|
498
|
+
/** Read a single numeric outcome value, or null when absent / non-numeric. */
|
|
499
|
+
#numericVariable(variables, identifier) {
|
|
500
|
+
const raw = variables?.find(v => v.identifier === identifier)?.value;
|
|
501
|
+
if (raw === undefined || raw === null || Array.isArray(raw))
|
|
502
|
+
return null;
|
|
503
|
+
const parsed = parseFloat(raw.toString());
|
|
504
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
505
|
+
}
|
|
290
506
|
}
|
|
291
507
|
__decorate([
|
|
292
508
|
property({ type: String })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-navigation.js","sourceRoot":"","sources":["../../../src/components/test-navigation/test-navigation.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAuBlD,MAAM,OAAO,cAAe,SAAQ,UAAU;IAkC5C,YAAY,CAAoB;IAEhC;QACE,KAAK,EAAE,CAAC;QApCkB,eAAU,GAAuB,SAAS,CAAC;QAGhE,gBAAW,GAAiD,EAAE,CAAC;QAI/D,eAAU,GAAe;YAC9B,WAAW,EAAE;gBACX,cAAc,EAAE,EAAE;gBAClB,mBAAmB,EAAE,EAAE;gBACvB,qBAAqB,EAAE,SAAS;aACjC;SACF,CAAC;QAIK,kBAAa,GAAkB,EAAE,CAAC;QAcmB,mBAAc,GAAG,KAAK,CAAC;QAMjF,IAAI,CAAC,gBAAg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AAI,WAAW,CAAC,8BAA8B,EAAE;YAC9C,MAAM,EAAE,IAAI,CAAC,eAAe;YAC5B,OAAO,EAAE,IAAI;SACd,CAAC,CACH,CAAC;IACJ,CAAC;CACF;AA/V6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA4C;AAGhE;IADN,KAAK,EAAE;mDAC8D;AAI/D;IAFN,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;kDAO/B;AAIK;IAFN,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;qDACZ;AAI/B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;oDACd;AAI3B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;uDACX;AAIjC;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;uDACK;AAEiB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;sDAAwB","sourcesContent":["import { consume, provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { computedContext } from '@qti-components/base';\nimport { configContext } from '@qti-components/base';\nimport { testContext } from '@qti-components/base';\nimport { sessionContext } from '@qti-components/base';\nimport { qtiContext } from '@qti-components/base';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiContext } from '@qti-components/base';\nimport type { OutcomeVariable } from '@qti-components/base';\nimport type { ComputedContext } from '@qti-components/base';\nimport type { PropertyValues } from 'lit';\nimport type { QtiAssessmentItemRef } from '../qti-assessment-item-ref/qti-assessment-item-ref';\nimport type { QtiAssessmentSection } from '../qti-assessment-section/qti-assessment-section';\nimport type { QtiAssessmentTest } from '../qti-assessment-test/qti-assessment-test';\nimport type { QtiTestPart } from '../qti-test-part/qti-test-part';\nimport type { ConfigContext } from '@qti-components/base';\nimport type { SessionContext } from '@qti-components/base';\nimport type { TestContext } from '@qti-components/base';\n\ntype CustomEventMap = {\n 'test-end-attempt': CustomEvent;\n};\n\ndeclare global {\n interface GlobalEventHandlersEventMap extends CustomEventMap {}\n}\n\nexport class TestNavigation extends LitElement {\n @property({ type: String }) identifier: string | undefined = undefined;\n\n @state()\n public initContext: { identifier: string; [key: string]: any }[] = [];\n\n @state()\n @provide({ context: qtiContext })\n public qtiContext: QtiContext = {\n QTI_CONTEXT: {\n testIdentifier: '',\n candidateIdentifier: '',\n environmentIdentifier: 'default'\n }\n };\n\n @state()\n @consume({ context: configContext, subscribe: true })\n public configContext: ConfigContext = {};\n\n @state()\n @consume({ context: testContext, subscribe: true })\n protected _testContext?: TestContext;\n\n @state()\n @consume({ context: sessionContext, subscribe: true })\n protected _sessionContext?: SessionContext;\n\n @state()\n @provide({ context: computedContext })\n protected computedContext: ComputedContext;\n\n @property({ type: Boolean, attribute: 'auto-score-items' }) autoScoreItems = false;\n\n #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-update-outcome-variable', this.#handleTestUpdateOutcomeVariable.bind(this));\n }\n\n /** The currently active assessment item, exposed for optional presentation extensions. */\n protected get activeAssessmentItem(): QtiAssessmentItem | undefined {\n if (!this.#testElement || !this._sessionContext?.navItemRefId) return undefined;\n return this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n )?.assessmentItem;\n }\n\n /**\n * Handles the 'test-end-attempt' event.\n * @private\n * @listens TestNavigation#test-end-attempt\n * @param {CustomEvent} event - The custom event object.\n */\n #handleTestEndAttempt(_event: CustomEvent) {\n const qtiItemEl = this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);\n }\n\n #handleTestUpdateOutcomeVariable(event: CustomEvent) {\n const qtiItemEl = this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${event.detail.assessmentItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);\n }\n\n #handleInteractionChanged(_event: CustomEvent) {\n if (this.autoScoreItems) {\n const assessmentItem = (_event.composedPath()[0] as HTMLElement).closest<QtiAssessmentItem>(\n 'qti-assessment-item'\n );\n const scoreOutcomeIdentifier = assessmentItem.variables.find(v => v.identifier === 'SCORE') as OutcomeVariable;\n if (\n scoreOutcomeIdentifier &&\n scoreOutcomeIdentifier.externalScored === null &&\n assessmentItem.adaptive === 'false'\n ) {\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n assessmentItem.processResponse(true, reportValidityAfterScoring);\n }\n }\n }\n\n override render() {\n // return this.myTemplate ? this.myTemplate(this.stampContext) : nothing;\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 // Set the testIdentifier in qtiContext if not already set\n if (!this.qtiContext.QTI_CONTEXT?.testIdentifier) {\n const currentContext = this.qtiContext.QTI_CONTEXT || {\n testIdentifier: '',\n candidateIdentifier: 'not set',\n environmentIdentifier: 'default'\n };\n this.qtiContext = {\n QTI_CONTEXT: {\n ...currentContext,\n testIdentifier: this.#testElement.identifier,\n environmentIdentifier: currentContext.environmentIdentifier || 'default'\n }\n };\n }\n\n // Process qti-context-declaration elements to get default values\n const contextDeclarations = this.#testElement.querySelectorAll('qti-context-declaration[identifier=\"QTI_CONTEXT\"]');\n\n contextDeclarations.forEach(declaration => {\n const defaultValues = this.#extractDefaultValues(declaration);\n if (Object.keys(defaultValues).length > 0) {\n // Merge default values with current context, but don't override existing runtime values\n this.qtiContext = {\n QTI_CONTEXT: {\n ...defaultValues, // Default values first\n ...this.qtiContext.QTI_CONTEXT // Runtime values override defaults\n }\n };\n }\n });\n\n const testPartElements = Array.from(this.#testElement?.querySelectorAll<QtiTestPart>(`qti-test-part`) || []);\n this.computedContext = {\n identifier: this.#testElement.identifier,\n title: this.#testElement.title,\n view: this._sessionContext?.view,\n testParts: testPartElements.map(testPart => {\n const sectionElements = [...testPart.querySelectorAll<QtiAssessmentSection>(`qti-assessment-section`)];\n return {\n active: false,\n identifier: testPart.identifier,\n navigationMode: testPart.navigationMode,\n submissionMode: testPart.submissionMode,\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 ...this.initContext?.find(i => i.identifier === item.identifier),\n active: false,\n identifier: item.identifier,\n categories: item.category ? item.category?.split(' ') : [],\n href: item.href,\n variables: [] as OutcomeVariable[]\n }))\n };\n })\n };\n })\n };\n }\n\n /**\n * Extract default values from a qti-context-declaration element\n */\n #extractDefaultValues(declaration: Element): Record<string, any> {\n const defaultValues: Record<string, any> = {};\n\n const defaultValueElement = declaration.querySelector('qti-default-value');\n if (!defaultValueElement) {\n return defaultValues;\n }\n\n const valueElements = defaultValueElement.querySelectorAll('qti-value[field-identifier]');\n valueElements.forEach(valueElement => {\n const fieldIdentifier = valueElement.getAttribute('field-identifier');\n const baseType = valueElement.getAttribute('base-type') || 'string';\n const textContent = valueElement.textContent?.trim() || '';\n\n if (fieldIdentifier) {\n // Convert value based on base-type\n let value: any = textContent;\n switch (baseType) {\n case 'integer':\n value = parseInt(textContent, 10);\n break;\n case 'float':\n case 'duration':\n value = parseFloat(textContent);\n break;\n case 'boolean':\n value = textContent.toLowerCase() === 'true';\n break;\n case 'string':\n default:\n value = textContent;\n break;\n }\n\n defaultValues[fieldIdentifier] = value;\n }\n });\n\n return defaultValues;\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\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 if (item.identifier !== itemElement.parentElement.getAttribute('identifier')) {\n return item;\n }\n\n const scoreOutcome = itemElement.querySelector<HTMLElement>(\n \"qti-outcome-declaration[identifier='SCORE']\"\n );\n // const scoreOutcome = item.variables.find(vr => vr.identifier == 'SCORE') as OutcomeVariable;\n const externalScored = scoreOutcome?.getAttribute('externalScored');\n\n const responseDeclarations = itemElement.querySelectorAll<HTMLElement>('qti-response-declaration');\n const containsCorrectResponse = Array.from(responseDeclarations).some((r: HTMLElement) =>\n r.querySelector('qti-correct-response')\n );\n // check if every responseDeclaration has a correctResponse\n const containsMapping = Array.from(responseDeclarations).some((r: HTMLElement) => {\n const mapping = r.querySelector('qti-mapping');\n const areaMapping = r.querySelector('qti-area-mapping');\n return mapping?.querySelector('qti-map-entry') || areaMapping?.querySelector('qti-area-map-entry');\n });\n\n const hasCorrectResponse = containsCorrectResponse || containsMapping;\n\n const hasResponseProcessing = itemElement.querySelector('qti-response-processing') ? true : false;\n\n return {\n ...item,\n assessmentItemIdentifier: itemElement.getAttribute('identifier'),\n label: itemElement.getAttribute('label'),\n title: itemElement.title,\n externalScored,\n adaptive: itemElement.adaptive == 'true' || false,\n timeDependent: itemElement.timeDependent == 'true' || false,\n variables: itemElement.variables,\n hasCorrectResponse,\n hasResponseProcessing\n };\n })\n };\n })\n };\n })\n };\n }\n\n /* PK: on every change of the candidate we will recomputed the computedContext */\n protected override willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) return;\n\n let itemIndex = 1;\n this.computedContext = {\n ...this.computedContext,\n view: this._sessionContext?.view,\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 const computedItem = {\n ...item,\n ...itemContext,\n ...this.initContext?.find(i => i.identifier === item.identifier)\n };\n\n const rawscore = computedItem.variables?.find(vr => vr.identifier == 'SCORE')?.value;\n\n const score = rawscore === undefined || rawscore === null ? null : parseFloat(rawscore?.toString());\n\n const completionStatus = computedItem.variables?.find(v => v.identifier === 'completionStatus')\n ?.value as string;\n\n const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';\n const numAttempts = computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value || 0;\n\n const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;\n\n // Computed and opiniated\n // const type = item.categories.includes(this.configContext?.infoItemCategory) ? 'info' : 'regular';\n // const correct = (type == 'regular' && score !== undefined && !isNaN(score) && score > 0) || false;\n // const incorrect = (type == 'regular' && score !== undefined && !isNaN(score) && score <= 0) || false;\n // const completed = completionStatus === 'completed';\n\n const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;\n const rawMaxScore = item.variables?.find(vr => vr.identifier == 'MAXSCORE')?.value;\n const maxScore =\n rawMaxScore === undefined || rawMaxScore === null ? null : parseFloat(rawMaxScore?.toString());\n\n return {\n ...computedItem,\n completionStatus,\n numAttempts,\n score,\n response,\n index,\n active,\n maxScore\n // type,\n // correct,\n // incorrect,\n // completed\n };\n })\n };\n })\n };\n })\n };\n\n this.dispatchEvent(\n new CustomEvent('qti-computed-context-updated', {\n detail: this.computedContext,\n bubbles: true\n })\n );\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-navigation': TestNavigation;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"test-navigation.js","sourceRoot":"","sources":["../../../src/components/test-navigation/test-navigation.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAiClD,MAAM,OAAO,cAAe,SAAQ,UAAU;IAkC5C,YAAY,CAAoB;IAEhC;;;;;;OAMG;IACH,WAAW,CAAqC;IAEhD;QACE,KAAK,EAAE,CAAC;QA7CkB,eAAU,GAAuB,SAAS,CAAC;QAGhE,gBAAW,GAAiD,EAAE,CAAC;QAI/D,eAAU,GAAe;YAC9B,WAAW,EAAE;gBACX,cAAc,EAAE,EAAE;gBAClB,mBAAmB,EAAE,EAAE;gBACvB,qBAAqB,EAAE,SAAS;aACjC;SACF,CAAC;QAIK,kBAAa,GAAkB,EAAE,CAAC;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AAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;uDACX;AAIjC;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;uDACK;AAEiB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;sDAAwB","sourcesContent":["import { consume, provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { computedContext } from '@qti-components/base';\nimport { configContext } from '@qti-components/base';\nimport { testContext } from '@qti-components/base';\nimport { sessionContext } from '@qti-components/base';\nimport { qtiContext } from '@qti-components/base';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiContext } from '@qti-components/base';\nimport type { OutcomeVariable } from '@qti-components/base';\nimport type { ComputedContext, ComputedItem } from '@qti-components/base';\nimport type { PropertyValues } from 'lit';\nimport type { QtiAssessmentItemRef } from '../qti-assessment-item-ref/qti-assessment-item-ref';\nimport type { QtiAssessmentSection } from '../qti-assessment-section/qti-assessment-section';\nimport type { QtiAssessmentTest } from '../qti-assessment-test/qti-assessment-test';\nimport type { QtiTestPart } from '../qti-test-part/qti-test-part';\nimport type { QtiItemSessionControl } from '../qti-item-session-control/qti-item-session-control';\nimport type { ConfigContext } from '@qti-components/base';\nimport type { SessionContext } from '@qti-components/base';\nimport type { TestContext } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\nimport type { ResponseVariable } from '@qti-components/base';\n\ntype CustomEventMap = {\n 'test-end-attempt': CustomEvent;\n};\n\ndeclare global {\n interface GlobalEventHandlersEventMap extends CustomEventMap {}\n}\n\n/**\n * Whether an item's ended attempt reached the best achievable outcome:\n * 'optimal' (nothing to improve), 'suboptimal' (a better attempt is possible),\n * or 'unscored' (no machine-judgeable optimal value — see #assessOptimality).\n */\ntype ItemOptimality = 'optimal' | 'suboptimal' | 'unscored';\n\nexport class TestNavigation extends LitElement {\n @property({ type: String }) identifier: string | undefined = undefined;\n\n @state()\n public initContext: { identifier: string; [key: string]: any }[] = [];\n\n @state()\n @provide({ context: qtiContext })\n public qtiContext: QtiContext = {\n QTI_CONTEXT: {\n testIdentifier: '',\n candidateIdentifier: '',\n environmentIdentifier: 'default'\n }\n };\n\n @state()\n @consume({ context: configContext, subscribe: true })\n public configContext: ConfigContext = {};\n\n @state()\n @consume({ context: testContext, subscribe: true })\n protected _testContext?: TestContext;\n\n @state()\n @consume({ context: sessionContext, subscribe: true })\n protected _sessionContext?: SessionContext;\n\n @state()\n @provide({ context: computedContext })\n protected computedContext: ComputedContext;\n\n @property({ type: Boolean, attribute: 'auto-score-items' }) autoScoreItems = false;\n\n #testElement: QtiAssessmentTest;\n\n /**\n * Whether each item's last *ended attempt* reached the optimal outcome, keyed\n * by item-ref id. Written from #handleItemContextUpdated when processResponse\n * ends an attempt — never on a plain selection. Mirrors how inline feedback\n * only re-evaluates when an attempt is processed, so a freshly-picked answer\n * doesn't flip `done` until the candidate ends the attempt.\n */\n #optimality = new Map<string, ItemOptimality>();\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 this.addEventListener('qti-item-context-updated', this.#handleItemContextUpdated.bind(this));\n\n this.addEventListener('test-end-attempt', this.#handleTestEndAttempt.bind(this));\n this.addEventListener('test-update-outcome-variable', this.#handleTestUpdateOutcomeVariable.bind(this));\n }\n\n /**\n * Latch whether an item reached its optimal outcome whenever it has just ended\n * an attempt. processResponse — fired by test-end-attempt, autoscore, or an\n * in-item end-attempt interaction — flags its context update with\n * `responseProcessed`; a plain selection updates the context without it, so\n * `done` can't flip until the candidate actually ends the attempt.\n */\n #handleItemContextUpdated(event: CustomEvent<{ itemContext: ItemContext; responseProcessed?: boolean }>) {\n if (!event.detail?.responseProcessed) return;\n const itemContext = event.detail.itemContext;\n if (!itemContext?.identifier) return;\n const optimality = this.#assessOptimality(itemContext);\n this.#optimality.set(itemContext.identifier, optimality);\n\n const computedItem = this.computedItemFor(itemContext.identifier);\n const numAttempts = Number(itemContext.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;\n this.afterAttemptEnded(\n (event.composedPath()[0] as HTMLElement)?.closest<QtiAssessmentItem>('qti-assessment-item'),\n computedItem,\n this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts)\n );\n }\n\n /**\n * Extension point for presentation packages reacting to an ended attempt.\n * `done` is settled here — from the freshly latched optimality and the\n * session-control cascade — because the computed context only catches up on\n * the next update, after this event has finished bubbling.\n */\n protected afterAttemptEnded(\n _assessmentItem: QtiAssessmentItem | undefined,\n _computedItem: ComputedItem | undefined,\n _done: boolean\n ): void {}\n\n /** The computed-context entry for an item, from the session-control cascade. */\n protected computedItemFor(identifier: string): ComputedItem | undefined {\n return this.computedContext?.testParts\n ?.flatMap(part => part.sections)\n .flatMap(section => section.items)\n .find(i => i.identifier === identifier);\n }\n\n /** The assessment item for an item-ref id, if it has been rendered. */\n #assessmentItemFor(identifier: string | undefined): QtiAssessmentItem | undefined {\n if (!identifier) return undefined;\n const itemRef = this.#testElement?.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${identifier}\"]`\n );\n return itemRef?.assessmentItem ?? undefined;\n }\n\n /** The currently active assessment item, exposed for optional presentation extensions. */\n protected get activeAssessmentItem(): QtiAssessmentItem | undefined {\n if (!this.#testElement || !this._sessionContext?.navItemRefId) return undefined;\n return this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n )?.assessmentItem;\n }\n\n /**\n * Handles the 'test-end-attempt' event.\n * @private\n * @listens TestNavigation#test-end-attempt\n * @param {CustomEvent} event - The custom event object.\n */\n #handleTestEndAttempt(_event: CustomEvent) {\n const qtiItemEl = this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);\n }\n\n #handleTestUpdateOutcomeVariable(event: CustomEvent) {\n const qtiItemEl = this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${event.detail.assessmentItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);\n }\n\n #handleInteractionChanged(_event: CustomEvent) {\n if (this.autoScoreItems) {\n const assessmentItem = (_event.composedPath()[0] as HTMLElement).closest<QtiAssessmentItem>(\n 'qti-assessment-item'\n );\n const scoreOutcomeIdentifier = assessmentItem.variables.find(v => v.identifier === 'SCORE') as OutcomeVariable;\n if (\n scoreOutcomeIdentifier &&\n scoreOutcomeIdentifier.externalScored === null &&\n assessmentItem.adaptive === 'false'\n ) {\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n assessmentItem.processResponse(true, reportValidityAfterScoring);\n }\n }\n }\n\n override render() {\n // return this.myTemplate ? this.myTemplate(this.stampContext) : nothing;\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 // A fresh test invalidates the per-test optimality latches.\n this.#optimality.clear();\n // Set the testIdentifier in qtiContext if not already set\n if (!this.qtiContext.QTI_CONTEXT?.testIdentifier) {\n const currentContext = this.qtiContext.QTI_CONTEXT || {\n testIdentifier: '',\n candidateIdentifier: 'not set',\n environmentIdentifier: 'default'\n };\n this.qtiContext = {\n QTI_CONTEXT: {\n ...currentContext,\n testIdentifier: this.#testElement.identifier,\n environmentIdentifier: currentContext.environmentIdentifier || 'default'\n }\n };\n }\n\n // Process qti-context-declaration elements to get default values\n const contextDeclarations = this.#testElement.querySelectorAll('qti-context-declaration[identifier=\"QTI_CONTEXT\"]');\n\n contextDeclarations.forEach(declaration => {\n const defaultValues = this.#extractDefaultValues(declaration);\n if (Object.keys(defaultValues).length > 0) {\n // Merge default values with current context, but don't override existing runtime values\n this.qtiContext = {\n QTI_CONTEXT: {\n ...defaultValues, // Default values first\n ...this.qtiContext.QTI_CONTEXT // Runtime values override defaults\n }\n };\n }\n });\n\n const testPartElements = Array.from(this.#testElement?.querySelectorAll<QtiTestPart>(`qti-test-part`) || []);\n this.computedContext = {\n identifier: this.#testElement.identifier,\n title: this.#testElement.title,\n view: this._sessionContext?.view,\n testParts: testPartElements.map(testPart => {\n const sectionElements = [...testPart.querySelectorAll<QtiAssessmentSection>(`qti-assessment-section`)];\n const testPartSessionControl = testPart.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const partAllowSkipping = testPartSessionControl ? testPartSessionControl.allowSkipping : true;\n const partMaxAttempts = testPartSessionControl ? testPartSessionControl.maxAttempts : 1;\n const partShowFeedback = testPartSessionControl ? testPartSessionControl.showFeedback : false;\n const partShowSolution = testPartSessionControl ? testPartSessionControl.showSolution : false;\n return {\n active: false,\n identifier: testPart.identifier,\n navigationMode: testPart.navigationMode,\n submissionMode: testPart.submissionMode,\n allowSkipping: partAllowSkipping,\n sections: sectionElements.map(section => {\n const itemElements = [...section.querySelectorAll<QtiAssessmentItemRef>(`qti-assessment-item-ref`)];\n const sectionSessionControl = section.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const sectionAllowSkipping = sectionSessionControl\n ? sectionSessionControl.allowSkipping\n : partAllowSkipping;\n const sectionMaxAttempts = sectionSessionControl ? sectionSessionControl.maxAttempts : partMaxAttempts;\n const sectionShowFeedback = sectionSessionControl ? sectionSessionControl.showFeedback : partShowFeedback;\n const sectionShowSolution = sectionSessionControl ? sectionSessionControl.showSolution : partShowSolution;\n return {\n active: false,\n identifier: section.identifier,\n title: section.title,\n navigationMode: section.navigationMode,\n submissionMode: section.submissionMode,\n allowSkipping: sectionAllowSkipping,\n items: itemElements.map(item => {\n const itemSessionControl = item.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const itemAllowSkipping = itemSessionControl ? itemSessionControl.allowSkipping : sectionAllowSkipping;\n const itemMaxAttempts = itemSessionControl ? itemSessionControl.maxAttempts : sectionMaxAttempts;\n const itemShowFeedback = itemSessionControl ? itemSessionControl.showFeedback : sectionShowFeedback;\n const itemShowSolution = itemSessionControl ? itemSessionControl.showSolution : sectionShowSolution;\n return {\n ...this.initContext?.find(i => i.identifier === item.identifier),\n active: false,\n identifier: item.identifier,\n categories: item.category ? item.category?.split(' ') : [],\n href: item.href,\n variables: [] as OutcomeVariable[],\n allowSkipping: itemAllowSkipping,\n maxAttempts: itemMaxAttempts,\n showFeedback: itemShowFeedback,\n showSolution: itemShowSolution\n };\n })\n };\n })\n };\n })\n };\n }\n\n /**\n * Extract default values from a qti-context-declaration element\n */\n #extractDefaultValues(declaration: Element): Record<string, any> {\n const defaultValues: Record<string, any> = {};\n\n const defaultValueElement = declaration.querySelector('qti-default-value');\n if (!defaultValueElement) {\n return defaultValues;\n }\n\n const valueElements = defaultValueElement.querySelectorAll('qti-value[field-identifier]');\n valueElements.forEach(valueElement => {\n const fieldIdentifier = valueElement.getAttribute('field-identifier');\n const baseType = valueElement.getAttribute('base-type') || 'string';\n const textContent = valueElement.textContent?.trim() || '';\n\n if (fieldIdentifier) {\n // Convert value based on base-type\n let value: any = textContent;\n switch (baseType) {\n case 'integer':\n value = parseInt(textContent, 10);\n break;\n case 'float':\n case 'duration':\n value = parseFloat(textContent);\n break;\n case 'boolean':\n value = textContent.toLowerCase() === 'true';\n break;\n case 'string':\n default:\n value = textContent;\n break;\n }\n\n defaultValues[fieldIdentifier] = value;\n }\n });\n\n return defaultValues;\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\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 if (item.identifier !== itemElement.parentElement.getAttribute('identifier')) {\n return item;\n }\n\n const scoreOutcome = itemElement.querySelector<HTMLElement>(\n \"qti-outcome-declaration[identifier='SCORE']\"\n );\n // const scoreOutcome = item.variables.find(vr => vr.identifier == 'SCORE') as OutcomeVariable;\n const externalScored = scoreOutcome?.getAttribute('externalScored');\n\n const responseDeclarations = itemElement.querySelectorAll<HTMLElement>('qti-response-declaration');\n const containsCorrectResponse = Array.from(responseDeclarations).some((r: HTMLElement) =>\n r.querySelector('qti-correct-response')\n );\n // check if every responseDeclaration has a correctResponse\n const containsMapping = Array.from(responseDeclarations).some((r: HTMLElement) => {\n const mapping = r.querySelector('qti-mapping');\n const areaMapping = r.querySelector('qti-area-mapping');\n return mapping?.querySelector('qti-map-entry') || areaMapping?.querySelector('qti-area-map-entry');\n });\n\n const hasCorrectResponse = containsCorrectResponse || containsMapping;\n\n const hasResponseProcessing = itemElement.querySelector('qti-response-processing') ? true : false;\n\n return {\n ...item,\n assessmentItemIdentifier: itemElement.getAttribute('identifier'),\n label: itemElement.getAttribute('label'),\n title: itemElement.title,\n externalScored,\n adaptive: itemElement.adaptive == 'true' || false,\n timeDependent: itemElement.timeDependent == 'true' || false,\n variables: itemElement.variables,\n hasCorrectResponse,\n hasResponseProcessing\n };\n })\n };\n })\n };\n })\n };\n }\n\n /* PK: on every change of the candidate we will recomputed the computedContext */\n protected override willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) return;\n\n let itemIndex = 1;\n this.computedContext = {\n ...this.computedContext,\n view: this._sessionContext?.view,\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 const computedItem = {\n ...item,\n ...itemContext,\n ...this.initContext?.find(i => i.identifier === item.identifier)\n };\n\n const rawscore = computedItem.variables?.find(vr => vr.identifier == 'SCORE')?.value;\n\n const score = rawscore === undefined || rawscore === null ? null : parseFloat(rawscore?.toString());\n\n const completionStatus = computedItem.variables?.find(v => v.identifier === 'completionStatus')\n ?.value as string;\n\n const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';\n const numAttempts =\n Number(computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;\n\n const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;\n\n const valid = this.#assessmentItemFor(computedItem.identifier)?.validate(false) ?? true;\n\n const responseVars = itemContext?.variables?.filter(v => v.type === 'response') || [];\n\n const isDefaultResponse = responseVars.every(v => {\n if (v.value === undefined || v.value === null) {\n return true;\n }\n let fallbackValue: string;\n switch (v.baseType) {\n case 'integer':\n case 'float':\n case 'duration':\n fallbackValue = '0';\n break;\n case 'boolean':\n fallbackValue = 'false';\n break;\n case 'string':\n case 'directedPair':\n case 'identifier':\n case 'pair':\n case 'record':\n default:\n fallbackValue = '';\n break;\n }\n\n const defaultValue = v.defaultValue ?? fallbackValue;\n\n if (Array.isArray(v.value)) {\n const dv = Array.isArray(defaultValue) ? defaultValue : [defaultValue];\n return v.value.length === dv.length && v.value.every((val, i) => val === dv[i]);\n }\n\n return v.value === defaultValue;\n });\n\n // Computed and opiniated\n // const type = item.categories.includes(this.configContext?.infoItemCategory) ? 'info' : 'regular';\n // const correct = (type == 'regular' && score !== undefined && !isNaN(score) && score > 0) || false;\n // const incorrect = (type == 'regular' && score !== undefined && !isNaN(score) && score <= 0) || false;\n // const completed = completionStatus === 'completed';\n\n const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;\n const rawMaxScore = item.variables?.find(vr => vr.identifier == 'MAXSCORE')?.value;\n const maxScore =\n rawMaxScore === undefined || rawMaxScore === null ? null : parseFloat(rawMaxScore?.toString());\n\n // Optimality comes from the last *ended attempt* (#optimality),\n // latched in #handleItemContextUpdated — never from a live\n // mid-attempt selection. On a restored session no attempt is ended\n // this run, so seed it once from the persisted context, which still\n // holds the submitted response.\n let optimality = this.#optimality.get(computedItem.identifier);\n if (optimality === undefined) {\n optimality = itemContext ? this.#assessOptimality(itemContext) : 'unscored';\n if (numAttempts > 0) this.#optimality.set(computedItem.identifier, optimality);\n }\n\n const done = this.#isItemDone(numAttempts, optimality, computedItem.maxAttempts);\n\n return {\n ...computedItem,\n completionStatus,\n numAttempts,\n score,\n response,\n index,\n active,\n valid,\n isDefaultResponse,\n maxScore,\n done,\n // Reflects the last *ended* attempt only. Read the latch directly\n // (not the `optimality` local) — the latch is written solely on\n // responseProcessed / restore-seed (line above, guarded by\n // numAttempts > 0), so a freshly-picked mid-attempt selection\n // computed live is never stored and never counts as optimal.\n optimal: this.#optimality.get(computedItem.identifier) === 'optimal'\n // type,\n // correct,\n // incorrect,\n // completed\n };\n })\n };\n })\n };\n })\n };\n\n this.dispatchEvent(\n new CustomEvent('qti-computed-context-updated', {\n detail: this.computedContext,\n bubbles: true\n })\n );\n }\n\n /**\n * Decide whether an item should be treated as \"the candidate is done with it\"\n * for the purpose of gating forward navigation and further attempts.\n *\n * - The candidate must have actually ended an attempt (numAttempts > 0).\n * - Once attempted, the item is done if they reached the optimal outcome\n * ('optimal'), or there's nothing to improve on ('unscored'). It is only *not*\n * done while a better attempt is still possible ('suboptimal') and attempts\n * remain — see #assessOptimality for how \"optimal\" is determined.\n *\n * `optimality` reflects the last *ended attempt* (see #optimality), not the\n * live selection — so a freshly-picked optimal answer doesn't count as done\n * until test-end-attempt evaluates it.\n */\n #isItemDone(numAttempts: number, optimality: ItemOptimality, maxAttempts: number | undefined): boolean {\n if (numAttempts === 0) return false;\n if (optimality !== 'suboptimal') return true;\n const max = maxAttempts ?? 1;\n return max > 0 && numAttempts >= max;\n }\n\n /**\n * Decide whether an item's submission is as good as it can get — i.e. the\n * candidate reached the *optimal* outcome, so there's no reason to make them\n * try again. 'optimal' means best achievable, 'suboptimal' means a better\n * attempt is still possible, 'unscored' means there's nothing to judge against.\n * (\"optimal\" is the spec's own word — a qti-correct-response is defined as\n * \"the (or an) optimal value\".)\n *\n * Two signals, in order of authority:\n * 1. The scored outcome: optimal ⟺ SCORE has reached its maximum (MAXSCORE).\n * This correctly handles partial-credit / qti-mapping items, where an exact\n * response match would under- or over-judge.\n * 2. The declared qti-correct-response, for items that aren't scored (no\n * SCORE/MAXSCORE) — an exact match is the best available proxy. Bookkeeping\n * variables like numAttempts can be typed 'response' but never declare a\n * correctResponse, so we filter on a declared correctResponse.\n *\n * Items with neither a comparable score nor a correctResponse (essays, info\n * items, etc.) are 'unscored' — there's no optimal value to require, so one\n * attempt is enough.\n */\n #assessOptimality(item: ItemContext): ItemOptimality {\n const variables = item.variables ?? [];\n\n const score = this.#numericVariable(variables, 'SCORE');\n const maxScore = this.#numericVariable(variables, 'MAXSCORE');\n if (score !== null && maxScore !== null) {\n return score >= maxScore ? 'optimal' : 'suboptimal';\n }\n\n const responseVars = variables.filter(\n (v): v is ResponseVariable =>\n v.type === 'response' &&\n (v as ResponseVariable).correctResponse !== undefined &&\n (v as ResponseVariable).correctResponse !== null\n );\n if (responseVars.length === 0) return 'unscored';\n const allMatch = responseVars.every(v => {\n const expected = v.correctResponse;\n const actual = v.value;\n if (actual === undefined || actual === null) return false;\n if (Array.isArray(expected) && Array.isArray(actual)) {\n return expected.length === actual.length && expected.every(e => actual.includes(e));\n }\n if (Array.isArray(expected) || Array.isArray(actual)) return false;\n return expected === actual;\n });\n return allMatch ? 'optimal' : 'suboptimal';\n }\n\n /** Read a single numeric outcome value, or null when absent / non-numeric. */\n #numericVariable(variables: ItemContext['variables'], identifier: string): number | null {\n const raw = variables?.find(v => v.identifier === identifier)?.value;\n if (raw === undefined || raw === null || Array.isArray(raw)) return null;\n const parsed = parseFloat(raw.toString());\n return Number.isNaN(parsed) ? null : parsed;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-navigation': TestNavigation;\n }\n}\n"]}
|
|
@@ -24,7 +24,7 @@ import * as styles from '../styles';
|
|
|
24
24
|
export class TestNext extends LitElement {
|
|
25
25
|
_handleTestElementChange(_oldValue, newValue) {
|
|
26
26
|
if (newValue) {
|
|
27
|
-
this.
|
|
27
|
+
this.requestUpdate();
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
static { this.styles = css `
|
|
@@ -63,8 +63,24 @@ export class TestNext extends LitElement {
|
|
|
63
63
|
this.checkDisabled();
|
|
64
64
|
}
|
|
65
65
|
checkDisabled() {
|
|
66
|
+
const testPart = this.computedContext?.testParts.find(testPart => testPart.active);
|
|
67
|
+
if (!testPart)
|
|
68
|
+
return;
|
|
69
|
+
const activeSection = testPart.sections.find(s => s.active);
|
|
70
|
+
const navigationMode = activeSection?.navigationMode || testPart.navigationMode;
|
|
71
|
+
const submissionMode = activeSection?.submissionMode || testPart.submissionMode;
|
|
72
|
+
const activeItem = this.sectionItems[this.itemIndex];
|
|
73
|
+
const isLinearIndividual = navigationMode === 'linear' && submissionMode === 'individual';
|
|
74
|
+
// In linear individual mode the candidate may only advance once they are
|
|
75
|
+
// "done" with the active item: they reached the optimal outcome (best score),
|
|
76
|
+
// exhausted maxAttempts, or the item has no judgeable optimal value. `done` is
|
|
77
|
+
// computed centrally in test-navigation (#isItemDone), so this Next gate
|
|
78
|
+
// matches the exact rule that decides an item is resolved.
|
|
66
79
|
this._internalDisabled =
|
|
67
|
-
!this.computedContext ||
|
|
80
|
+
!this.computedContext ||
|
|
81
|
+
this.itemIndex < 0 ||
|
|
82
|
+
this.itemIndex >= (this.sectionItems?.length ?? 0) - 1 ||
|
|
83
|
+
(isLinearIndividual && !activeItem?.done);
|
|
68
84
|
}
|
|
69
85
|
_requestItem(identifier) {
|
|
70
86
|
this.dispatchEvent(new CustomEvent('qti-request-navigation', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-next.js","sourceRoot":"","sources":["../../../src/components/test-next/test-next.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AAIpC;;;;;;;;;;GAUG;AAEH,MAAM,OAAO,QAAS,SAAQ,UAAU;IAWtC,wBAAwB,CAAC,SAA0B,EAAE,QAAyB;QAC5E,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"test-next.js","sourceRoot":"","sources":["../../../src/components/test-next/test-next.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AAIpC;;;;;;;;;;GAUG;AAEH,MAAM,OAAO,QAAS,SAAQ,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EAAE,IAAI;YACd,OAAO,EAAE,IAAI;YACb,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM;gBACZ,EAAE,EAAE,UAAU;aACf;SACF,CAAC,CACH,CAAC;IACJ,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAzFM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;mDAClC;AAGtB;IADT,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;iDACZ;AAM3C;IADC,KAAK,CAAC,iBAAiB,CAAC;wDAKxB","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { watch } from '@qti-components/utilities';\nimport { computedContext } from '@qti-components/base';\n\nimport * as styles from '../styles';\n\nimport type { ComputedContext, ComputedItem } from '@qti-components/base';\n\n/**\n * Represents a custom element for navigating to the next test item.\n *\n * @remarks\n * This element provides functionality for navigating to the next test item.\n *\n * @example\n * ```html\n * <test-next></test-next>\n * ```\n */\n\nexport class TestNext extends LitElement {\n @property({ type: Boolean, reflect: true, attribute: 'disabled' })\n public _internalDisabled = true;\n\n @consume({ context: computedContext, subscribe: true })\n protected computedContext: ComputedContext;\n\n sectionItems: ComputedItem[];\n itemIndex: number;\n\n @watch('computedContext')\n _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n if (newValue) {\n this.requestUpdate();\n }\n }\n\n static override styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n #internals: ElementInternals;\n\n constructor() {\n super();\n\n this.#internals = this.attachInternals();\n this.#internals.role = 'button';\n this.#internals.ariaLabel = 'Next item';\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);\n });\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.checkDisabled();\n }\n\n override willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n if (!this.computedContext) return;\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n this.sectionItems = testPart.sections.flatMap(section => section.items);\n this.itemIndex = this.sectionItems.findIndex(item => item.active);\n this.checkDisabled();\n }\n\n checkDisabled() {\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n const activeSection = testPart.sections.find(s => s.active);\n const navigationMode = activeSection?.navigationMode || testPart.navigationMode;\n const submissionMode = activeSection?.submissionMode || testPart.submissionMode;\n const activeItem = this.sectionItems[this.itemIndex];\n\n const isLinearIndividual = navigationMode === 'linear' && submissionMode === 'individual';\n\n // In linear individual mode the candidate may only advance once they are\n // \"done\" with the active item: they reached the optimal outcome (best score),\n // exhausted maxAttempts, or the item has no judgeable optimal value. `done` is\n // computed centrally in test-navigation (#isItemDone), so this Next gate\n // matches the exact rule that decides an item is resolved.\n this._internalDisabled =\n !this.computedContext ||\n this.itemIndex < 0 ||\n this.itemIndex >= (this.sectionItems?.length ?? 0) - 1 ||\n (isLinearIndividual && !activeItem?.done);\n }\n\n protected _requestItem(identifier: string): void {\n this.dispatchEvent(\n new CustomEvent('qti-request-navigation', {\n composed: true,\n bubbles: true,\n detail: {\n type: 'item',\n id: identifier\n }\n })\n );\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-next': TestNext;\n }\n}\n"]}
|
|
@@ -24,7 +24,7 @@ import * as styles from '../styles';
|
|
|
24
24
|
export class TestPrev extends LitElement {
|
|
25
25
|
_handleTestElementChange(_oldValue, newValue) {
|
|
26
26
|
if (newValue) {
|
|
27
|
-
this.
|
|
27
|
+
this.requestUpdate();
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
static { this.styles = css `
|
|
@@ -55,7 +55,11 @@ export class TestPrev extends LitElement {
|
|
|
55
55
|
this.checkDisabled();
|
|
56
56
|
}
|
|
57
57
|
checkDisabled() {
|
|
58
|
-
|
|
58
|
+
const testPart = this.computedContext?.testParts.find(testPart => testPart.active);
|
|
59
|
+
const activeSection = testPart?.sections.find(s => s.active);
|
|
60
|
+
const navigationMode = activeSection?.navigationMode || testPart?.navigationMode || 'nonlinear';
|
|
61
|
+
this._internalDisabled =
|
|
62
|
+
navigationMode === 'linear' || !this.computedContext || this.itemIndex === 0 || this.itemIndex === -1;
|
|
59
63
|
}
|
|
60
64
|
_requestItem(identifier) {
|
|
61
65
|
this.dispatchEvent(new CustomEvent('qti-request-navigation', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-prev.js","sourceRoot":"","sources":["../../../src/components/test-prev/test-prev.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AAIpC;;;;;;;;;;GAUG;AAEH,MAAM,OAAO,QAAS,SAAQ,UAAU;IAWtC,wBAAwB,CAAC,SAA0B,EAAE,QAAyB;QAC5E,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"test-prev.js","sourceRoot":"","sources":["../../../src/components/test-prev/test-prev.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7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["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { watch } from '@qti-components/utilities';\nimport { computedContext } from '@qti-components/base';\n\nimport * as styles from '../styles';\n\nimport type { ComputedContext, ComputedItem } from '@qti-components/base';\n\n/**\n * Represents a custom element for navigating to the previous test item.\n *\n * @remarks\n * This element provides functionality for navigating to the previous test item.\n *\n * @example\n * ```html\n * <test-prev></test-prev>\n * ```\n */\n\nexport class TestPrev extends LitElement {\n @property({ type: Boolean, reflect: true, attribute: 'disabled' })\n public _internalDisabled = true;\n\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n sectionItems: ComputedItem[];\n itemIndex: number;\n\n @watch('computedContext')\n _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n if (newValue) {\n this.requestUpdate();\n }\n }\n\n static override styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n constructor() {\n super();\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);\n });\n }\n\n override willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n if (!this.computedContext) return;\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n this.sectionItems = testPart.sections.flatMap(section => section.items);\n this.itemIndex = this.sectionItems.findIndex(item => item.active);\n this.checkDisabled();\n }\n\n checkDisabled() {\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n const activeSection = testPart?.sections.find(s => s.active);\n const navigationMode = activeSection?.navigationMode || testPart?.navigationMode || 'nonlinear';\n\n this._internalDisabled =\n navigationMode === 'linear' || !this.computedContext || this.itemIndex === 0 || this.itemIndex === -1;\n }\n\n protected _requestItem(identifier: string): void {\n this.dispatchEvent(\n new CustomEvent('qti-request-navigation', {\n composed: true,\n bubbles: true,\n detail: {\n type: 'item',\n id: identifier\n }\n })\n );\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-prev': TestPrev;\n }\n}\n"]}
|