survey-analytics 2.5.21 → 2.5.23

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v2.5.21
2
+ * surveyjs - SurveyJS Dashboard library v2.5.23
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: SEE LICENSE IN LICENSE
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v2.5.21
2
+ * surveyjs - SurveyJS Dashboard library v2.5.23
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: SEE LICENSE IN LICENSE
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v2.5.21
2
+ * surveyjs - SurveyJS Dashboard library v2.5.23
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: SEE LICENSE IN LICENSE
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v2.5.21
2
+ * surveyjs - SurveyJS Dashboard library v2.5.23
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: SEE LICENSE IN LICENSE
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v2.5.21
2
+ * surveyjs - SurveyJS Dashboard library v2.5.23
3
3
  * Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
4
4
  * License: SEE LICENSE IN LICENSE
5
5
  */
@@ -5687,7 +5687,41 @@ var Tabulator = /** @class */ (function (_super) {
5687
5687
  });
5688
5688
  return container;
5689
5689
  };
5690
- Tabulator.prototype.createNestedTable = function (nestedTableColumns, cellData) {
5690
+ Tabulator.prototype.getNestedCellDisplayValue = function (question, field, value) {
5691
+ if (value === undefined || value === null)
5692
+ return value;
5693
+ var choices;
5694
+ var questionType = question.getType();
5695
+ if (questionType === "paneldynamic") {
5696
+ var panelQuestion = question;
5697
+ var templateQuestion = panelQuestion.template.questions.find(function (q) { return q.name === field; });
5698
+ if (templateQuestion) {
5699
+ choices = templateQuestion.choices;
5700
+ }
5701
+ }
5702
+ else if (questionType === "matrixdynamic" || questionType === "matrixdropdown") {
5703
+ var matrixQuestion = question;
5704
+ var column = matrixQuestion.columns.find(function (col) { return col.name === field; });
5705
+ if (column) {
5706
+ choices = column.choices;
5707
+ }
5708
+ }
5709
+ if (choices && choices.length > 0) {
5710
+ if (Array.isArray(value)) {
5711
+ return value.map(function (v) {
5712
+ var item = survey_core__WEBPACK_IMPORTED_MODULE_2__.ItemValue.getItemByValue(choices, v);
5713
+ return item ? item.locText.textOrHtml : v;
5714
+ });
5715
+ }
5716
+ var item = survey_core__WEBPACK_IMPORTED_MODULE_2__.ItemValue.getItemByValue(choices, value);
5717
+ if (item) {
5718
+ return item.locText.textOrHtml;
5719
+ }
5720
+ }
5721
+ return value;
5722
+ };
5723
+ Tabulator.prototype.createNestedTable = function (nestedTableColumns, cellData, question) {
5724
+ var _this = this;
5691
5725
  var container = document.createElement("div");
5692
5726
  container.className = "sa-nested-table-container";
5693
5727
  var table = document.createElement("table");
@@ -5706,8 +5740,9 @@ var Tabulator = /** @class */ (function (_super) {
5706
5740
  var tr = document.createElement("tr");
5707
5741
  nestedTableColumns.forEach(function (col) {
5708
5742
  var td = document.createElement("td");
5709
- var value = row[col.field];
5710
- td.textContent = value !== undefined && value !== null ? String(value) : "";
5743
+ var rawValue = row[col.field];
5744
+ var value = question ? _this.getNestedCellDisplayValue(question, col.field, rawValue) : rawValue;
5745
+ td.textContent = value !== undefined && value !== null ? (typeof value === "object" ? JSON.stringify(value) : String(value)) : "";
5711
5746
  tr.appendChild(td);
5712
5747
  });
5713
5748
  tbody.appendChild(tr);
@@ -5744,7 +5779,7 @@ var Tabulator = /** @class */ (function (_super) {
5744
5779
  }); });
5745
5780
  }
5746
5781
  if (_this.options.useNestedTables === true) {
5747
- return _this.createNestedTable(nestedTableColumns, cellData);
5782
+ return _this.createNestedTable(nestedTableColumns, cellData, question);
5748
5783
  }
5749
5784
  var tableEl = document.createElement("div");
5750
5785
  tableEl.classList.add("sa-nested-table");
@@ -5756,9 +5791,16 @@ var Tabulator = /** @class */ (function (_super) {
5756
5791
  if (el._nestedTabulator) {
5757
5792
  return;
5758
5793
  }
5794
+ var displayData = cellData.map(function (row) {
5795
+ var transformedRow = {};
5796
+ nestedTableColumns.forEach(function (col) {
5797
+ transformedRow[col.field] = _this.getNestedCellDisplayValue(question, col.field, row[col.field]);
5798
+ });
5799
+ return transformedRow;
5800
+ });
5759
5801
  var nestedTable = new Tabulator.tabulatorTablesConstructor(tableEl, {
5760
5802
  // layout: "fitDataFill",
5761
- data: cellData,
5803
+ data: displayData,
5762
5804
  columns: nestedTableColumns,
5763
5805
  pagination: false,
5764
5806
  });
@@ -5791,6 +5833,7 @@ var Tabulator = /** @class */ (function (_super) {
5791
5833
  };
5792
5834
  };
5793
5835
  Tabulator.prototype.formatNestedDataForExport = function (nestedData, column) {
5836
+ var _this = this;
5794
5837
  if (!Array.isArray(nestedData) || nestedData.length === 0) {
5795
5838
  return "";
5796
5839
  }
@@ -5817,8 +5860,9 @@ var Tabulator = /** @class */ (function (_super) {
5817
5860
  var header = nestedColumns.map(function (col) { return col.title; }).join(" | ");
5818
5861
  var rows = nestedData.map(function (rowData) {
5819
5862
  return nestedColumns.map(function (col) {
5820
- var value = rowData[col.field];
5821
- return value !== undefined && value !== null ? String(value) : "";
5863
+ var rawValue = rowData[col.field];
5864
+ var value = _this.getNestedCellDisplayValue(question, col.field, rawValue);
5865
+ return value !== undefined && value !== null ? (typeof value === "object" ? JSON.stringify(value) : String(value)) : "";
5822
5866
  }).join(" | ");
5823
5867
  });
5824
5868
  return "[".concat(header, "]\n").concat(rows.join("\n"));