@citolab/qti-components 9.6.0 → 9.6.1

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.
@@ -21,6 +21,7 @@ import {
21
21
  QtiExpression,
22
22
  computedContext,
23
23
  configContext,
24
+ isRecordValue,
24
25
  qtiContext,
25
26
  sessionContext,
26
27
  testContext
@@ -4825,6 +4826,16 @@ var __decorate23 = function(decorators, target, key, desc) {
4825
4826
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4826
4827
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4827
4828
  };
4829
+ var formatVariableValue = (value) => {
4830
+ if (value === null || value === void 0)
4831
+ return "";
4832
+ if (Array.isArray(value))
4833
+ return value.map(formatVariableValue).join(", ");
4834
+ if (isRecordValue(value)) {
4835
+ return Object.entries(value).map(([field, fieldValue]) => `${field}: ${formatVariableValue(fieldValue)}`).join(", ");
4836
+ }
4837
+ return String(value);
4838
+ };
4828
4839
  var TestPrintVariables = class extends LitElement21 {
4829
4840
  static {
4830
4841
  this.styles = css12`
@@ -4870,13 +4881,13 @@ var TestPrintVariables = class extends LitElement21 {
4870
4881
  </thead>
4871
4882
  <tbody>
4872
4883
  ${variables.map((v) => {
4873
- const correctResponse = v.correctResponse ? Array.isArray(v.correctResponse) ? v.correctResponse.join(", ") : v.correctResponse : "";
4884
+ const correctResponse = formatVariableValue(v.correctResponse);
4874
4885
  const mapEntries = v.mapping?.mapEntries?.map((m) => `${m.mapKey}=${m.mappedValue}pt`).join(", ") || "";
4875
4886
  const areaMapEntries = v.areaMapping?.areaMapEntries?.map((m) => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(", ") || "";
4876
4887
  return html20`
4877
4888
  <tr>
4878
4889
  <td>${v.identifier}</td>
4879
- <td>${Array.isArray(v.value) ? v.value.join(", ") : v.value}</td>
4890
+ <td>${formatVariableValue(v.value)}</td>
4880
4891
  <td>${v.cardinality}</td>
4881
4892
  <td>${v.baseType}</td>
4882
4893
  <td>${correctResponse || mapEntries || areaMapEntries}</td>
@@ -5372,6 +5383,7 @@ export {
5372
5383
  TestPagingButtonsStamp,
5373
5384
  TestPrev,
5374
5385
  TestPrintContext,
5386
+ formatVariableValue,
5375
5387
  TestPrintVariables,
5376
5388
  TestScoringButtons,
5377
5389
  TestScoringFeedback,
@@ -5394,4 +5406,4 @@ export {
5394
5406
  * Portions Copyright (c) 2013, the Dart project authors.
5395
5407
  *)
5396
5408
  */
5397
- //# sourceMappingURL=chunk-EAQOUBXA.js.map
5409
+ //# sourceMappingURL=chunk-RGBQ65Y2.js.map