@citolab/qti-components 10.0.0-next.7 → 10.0.0-next.9

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
@@ -4151,6 +4152,16 @@ var __decorate23 = function(decorators, target, key, desc) {
4151
4152
  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;
4152
4153
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4153
4154
  };
4155
+ var formatVariableValue = (value) => {
4156
+ if (value === null || value === void 0)
4157
+ return "";
4158
+ if (Array.isArray(value))
4159
+ return value.map(formatVariableValue).join(", ");
4160
+ if (isRecordValue(value)) {
4161
+ return Object.entries(value).map(([field, fieldValue]) => `${field}: ${formatVariableValue(fieldValue)}`).join(", ");
4162
+ }
4163
+ return String(value);
4164
+ };
4154
4165
  var TestPrintVariables = class extends LitElement21 {
4155
4166
  static {
4156
4167
  this.styles = css13`
@@ -4196,13 +4207,13 @@ var TestPrintVariables = class extends LitElement21 {
4196
4207
  </thead>
4197
4208
  <tbody>
4198
4209
  ${variables.map((v) => {
4199
- const correctResponse = v.correctResponse ? Array.isArray(v.correctResponse) ? v.correctResponse.join(", ") : v.correctResponse : "";
4210
+ const correctResponse = formatVariableValue(v.correctResponse);
4200
4211
  const mapEntries = v.mapping?.mapEntries?.map((m) => `${m.mapKey}=${m.mappedValue}pt`).join(", ") || "";
4201
4212
  const areaMapEntries = v.areaMapping?.areaMapEntries?.map((m) => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(", ") || "";
4202
4213
  return html20`
4203
4214
  <tr>
4204
4215
  <td>${v.identifier}</td>
4205
- <td>${Array.isArray(v.value) ? v.value.join(", ") : v.value}</td>
4216
+ <td>${formatVariableValue(v.value)}</td>
4206
4217
  <td>${v.cardinality}</td>
4207
4218
  <td>${v.baseType}</td>
4208
4219
  <td>${correctResponse || mapEntries || areaMapEntries}</td>
@@ -5455,4 +5466,4 @@ export {
5455
5466
  * Portions Copyright (c) 2013, the Dart project authors.
5456
5467
  *)
5457
5468
  */
5458
- //# sourceMappingURL=chunk-6PCCBSPB.js.map
5469
+ //# sourceMappingURL=chunk-BIU7J6B7.js.map