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.
- package/fesm/shared.mjs +1 -1
- package/fesm/shared2.mjs +9 -3
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/survey.analytics.core.mjs +1 -1
- package/fesm/survey.analytics.mjs +1 -1
- package/fesm/survey.analytics.mongo.mjs +1 -1
- package/fesm/survey.analytics.tabulator.mjs +50 -8
- package/fesm/survey.analytics.tabulator.mjs.map +1 -1
- package/package.json +2 -2
- package/survey-analytics-tabulator.types/tables/tabulator.d.ts +1 -0
- package/survey.analytics.core.css +1 -1
- package/survey.analytics.core.js +9 -3
- package/survey.analytics.core.js.map +1 -1
- package/survey.analytics.core.min.css +1 -1
- package/survey.analytics.core.min.js +1 -1
- package/survey.analytics.core.min.js.LICENSE.txt +1 -1
- package/survey.analytics.css +1 -1
- package/survey.analytics.js +9 -3
- package/survey.analytics.js.map +1 -1
- package/survey.analytics.min.css +1 -1
- package/survey.analytics.min.js +1 -1
- package/survey.analytics.min.js.LICENSE.txt +1 -1
- package/survey.analytics.mongo.js +1 -1
- package/survey.analytics.mongo.min.js.LICENSE.txt +1 -1
- package/survey.analytics.tabulator.css +1 -1
- package/survey.analytics.tabulator.js +52 -8
- package/survey.analytics.tabulator.js.map +1 -1
- package/survey.analytics.tabulator.min.css +1 -1
- package/survey.analytics.tabulator.min.js +1 -1
- package/survey.analytics.tabulator.min.js.LICENSE.txt +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.5.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.5.23
|
|
3
3
|
* Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
@@ -1635,7 +1635,40 @@ class Tabulator extends Table {
|
|
|
1635
1635
|
});
|
|
1636
1636
|
return container;
|
|
1637
1637
|
}
|
|
1638
|
-
|
|
1638
|
+
getNestedCellDisplayValue(question, field, value) {
|
|
1639
|
+
if (value === undefined || value === null)
|
|
1640
|
+
return value;
|
|
1641
|
+
let choices;
|
|
1642
|
+
const questionType = question.getType();
|
|
1643
|
+
if (questionType === "paneldynamic") {
|
|
1644
|
+
const panelQuestion = question;
|
|
1645
|
+
const templateQuestion = panelQuestion.template.questions.find((q) => q.name === field);
|
|
1646
|
+
if (templateQuestion) {
|
|
1647
|
+
choices = templateQuestion.choices;
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
else if (questionType === "matrixdynamic" || questionType === "matrixdropdown") {
|
|
1651
|
+
const matrixQuestion = question;
|
|
1652
|
+
const column = matrixQuestion.columns.find((col) => col.name === field);
|
|
1653
|
+
if (column) {
|
|
1654
|
+
choices = column.choices;
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
if (choices && choices.length > 0) {
|
|
1658
|
+
if (Array.isArray(value)) {
|
|
1659
|
+
return value.map((v) => {
|
|
1660
|
+
const item = ItemValue.getItemByValue(choices, v);
|
|
1661
|
+
return item ? item.locText.textOrHtml : v;
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
const item = ItemValue.getItemByValue(choices, value);
|
|
1665
|
+
if (item) {
|
|
1666
|
+
return item.locText.textOrHtml;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
return value;
|
|
1670
|
+
}
|
|
1671
|
+
createNestedTable(nestedTableColumns, cellData, question) {
|
|
1639
1672
|
const container = document.createElement("div");
|
|
1640
1673
|
container.className = "sa-nested-table-container";
|
|
1641
1674
|
const table = document.createElement("table");
|
|
@@ -1654,8 +1687,9 @@ class Tabulator extends Table {
|
|
|
1654
1687
|
const tr = document.createElement("tr");
|
|
1655
1688
|
nestedTableColumns.forEach((col) => {
|
|
1656
1689
|
const td = document.createElement("td");
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1690
|
+
const rawValue = row[col.field];
|
|
1691
|
+
const value = question ? this.getNestedCellDisplayValue(question, col.field, rawValue) : rawValue;
|
|
1692
|
+
td.textContent = value !== undefined && value !== null ? (typeof value === "object" ? JSON.stringify(value) : String(value)) : "";
|
|
1659
1693
|
tr.appendChild(td);
|
|
1660
1694
|
});
|
|
1661
1695
|
tbody.appendChild(tr);
|
|
@@ -1691,7 +1725,7 @@ class Tabulator extends Table {
|
|
|
1691
1725
|
}));
|
|
1692
1726
|
}
|
|
1693
1727
|
if (this.options.useNestedTables === true) {
|
|
1694
|
-
return this.createNestedTable(nestedTableColumns, cellData);
|
|
1728
|
+
return this.createNestedTable(nestedTableColumns, cellData, question);
|
|
1695
1729
|
}
|
|
1696
1730
|
const tableEl = document.createElement("div");
|
|
1697
1731
|
tableEl.classList.add("sa-nested-table");
|
|
@@ -1703,9 +1737,16 @@ class Tabulator extends Table {
|
|
|
1703
1737
|
if (el._nestedTabulator) {
|
|
1704
1738
|
return;
|
|
1705
1739
|
}
|
|
1740
|
+
const displayData = cellData.map((row) => {
|
|
1741
|
+
const transformedRow = {};
|
|
1742
|
+
nestedTableColumns.forEach((col) => {
|
|
1743
|
+
transformedRow[col.field] = this.getNestedCellDisplayValue(question, col.field, row[col.field]);
|
|
1744
|
+
});
|
|
1745
|
+
return transformedRow;
|
|
1746
|
+
});
|
|
1706
1747
|
const nestedTable = new Tabulator.tabulatorTablesConstructor(tableEl, {
|
|
1707
1748
|
// layout: "fitDataFill",
|
|
1708
|
-
data:
|
|
1749
|
+
data: displayData,
|
|
1709
1750
|
columns: nestedTableColumns,
|
|
1710
1751
|
pagination: false,
|
|
1711
1752
|
});
|
|
@@ -1764,8 +1805,9 @@ class Tabulator extends Table {
|
|
|
1764
1805
|
const header = nestedColumns.map(col => col.title).join(" | ");
|
|
1765
1806
|
const rows = nestedData.map(rowData => {
|
|
1766
1807
|
return nestedColumns.map(col => {
|
|
1767
|
-
const
|
|
1768
|
-
|
|
1808
|
+
const rawValue = rowData[col.field];
|
|
1809
|
+
const value = this.getNestedCellDisplayValue(question, col.field, rawValue);
|
|
1810
|
+
return value !== undefined && value !== null ? (typeof value === "object" ? JSON.stringify(value) : String(value)) : "";
|
|
1769
1811
|
}).join(" | ");
|
|
1770
1812
|
});
|
|
1771
1813
|
return `[${header}]\n${rows.join("\n")}`;
|