survey-analytics 2.5.17 → 2.5.19
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/LICENSE +1 -1
- package/fesm/shared.mjs +96 -68
- package/fesm/shared.mjs.map +1 -1
- package/fesm/shared2.mjs +69 -40
- 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 +283 -5
- package/fesm/survey.analytics.tabulator.mjs.map +1 -1
- package/package.json +2 -2
- package/survey-analytics-tabulator.types/analytics-localization/arabic.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/dutch.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/farsi.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/finnish.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/french.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/german.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/italian.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/japanese.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/norwegian.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/polish.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/portuguese.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/russian.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/spanish.d.ts +1 -0
- package/survey-analytics-tabulator.types/analytics-localization/swedish.d.ts +1 -0
- package/survey-analytics-tabulator.types/tables/columnbuilder.d.ts +9 -2
- package/survey-analytics-tabulator.types/tables/columns.d.ts +20 -1
- package/survey-analytics-tabulator.types/tables/config.d.ts +3 -1
- package/survey-analytics-tabulator.types/tables/table.d.ts +28 -0
- package/survey-analytics-tabulator.types/tables/tabulator.d.ts +3 -0
- package/survey-analytics.types/analytics-localization/arabic.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/dutch.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/farsi.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/finnish.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/french.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/german.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/italian.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/japanese.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/norwegian.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/polish.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/portuguese.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/russian.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/spanish.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/swedish.d.ts +1 -0
- package/survey-analytics.types/boolean.d.ts +1 -0
- package/survey-analytics.types/selectBase.d.ts +5 -1
- package/survey.analytics.core.css +1 -1
- package/survey.analytics.core.js +154 -95
- 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 +154 -95
- 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 +39 -1
- package/survey.analytics.tabulator.css.map +1 -1
- package/survey.analytics.tabulator.js +424 -74
- package/survey.analytics.tabulator.js.map +1 -1
- package/survey.analytics.tabulator.min.css +2 -2
- 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.19
|
|
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
|
*/
|
|
@@ -274,6 +274,8 @@ var ColumnDataType;
|
|
|
274
274
|
ColumnDataType[ColumnDataType["Text"] = 0] = "Text";
|
|
275
275
|
ColumnDataType[ColumnDataType["FileLink"] = 1] = "FileLink";
|
|
276
276
|
ColumnDataType[ColumnDataType["Image"] = 2] = "Image";
|
|
277
|
+
ColumnDataType[ColumnDataType["NestedTable"] = 3] = "NestedTable";
|
|
278
|
+
ColumnDataType[ColumnDataType["Html"] = 4] = "Html";
|
|
277
279
|
})(ColumnDataType || (ColumnDataType = {}));
|
|
278
280
|
|
|
279
281
|
TableExtensions.registerExtension({
|
|
@@ -583,6 +585,40 @@ class CheckboxColumn extends SelectBaseColumn {
|
|
|
583
585
|
return super.getDisplayValue(data, table, options);
|
|
584
586
|
}
|
|
585
587
|
}
|
|
588
|
+
class FlattenedCheckboxColumn extends BaseColumn {
|
|
589
|
+
constructor(question, choiceValue, choiceText, table) {
|
|
590
|
+
super(question, table);
|
|
591
|
+
this.choiceValue = choiceValue;
|
|
592
|
+
this.choiceText = choiceText;
|
|
593
|
+
}
|
|
594
|
+
getDataType() {
|
|
595
|
+
return ColumnDataType.Html;
|
|
596
|
+
}
|
|
597
|
+
getName() {
|
|
598
|
+
return `${this.question.name}.${this.choiceValue}`;
|
|
599
|
+
}
|
|
600
|
+
getDisplayName() {
|
|
601
|
+
var _a;
|
|
602
|
+
const questionDisplayName = this.table.useNamesAsTitles
|
|
603
|
+
? this.question.name
|
|
604
|
+
: (((_a = this.question.locTitle) === null || _a === void 0 ? void 0 : _a.renderedHtml) || this.question.title || "").trim() || this.question.name;
|
|
605
|
+
const choiceDisplayText = this.table.useNamesAsTitles ? this.choiceValue : this.choiceText;
|
|
606
|
+
return `${questionDisplayName} - ${choiceDisplayText}`;
|
|
607
|
+
}
|
|
608
|
+
getDisplayValue(data, table, options) {
|
|
609
|
+
const questionValue = data[this.question.name];
|
|
610
|
+
if (!Array.isArray(questionValue)) {
|
|
611
|
+
return "";
|
|
612
|
+
}
|
|
613
|
+
const index = questionValue.indexOf(this.choiceValue);
|
|
614
|
+
if (index < 0) {
|
|
615
|
+
return "";
|
|
616
|
+
}
|
|
617
|
+
// Default to checkmark if not specified
|
|
618
|
+
const displayMode = options.multiSelectColumnValueFormat || "checkmark";
|
|
619
|
+
return displayMode === "checkmark" ? "✔" : (index + 1).toString();
|
|
620
|
+
}
|
|
621
|
+
}
|
|
586
622
|
class SingleChoiceColumn extends SelectBaseColumn {
|
|
587
623
|
getDisplayValue(data, table, options) {
|
|
588
624
|
if (this.isOtherInSeparateColumn) {
|
|
@@ -723,6 +759,42 @@ class CompositeQuestionColumn extends BaseColumn {
|
|
|
723
759
|
});
|
|
724
760
|
}
|
|
725
761
|
}
|
|
762
|
+
class MatrixDynamicColumn extends BaseColumn {
|
|
763
|
+
getDataType() {
|
|
764
|
+
return this.table.options.useNestedTables ? ColumnDataType.NestedTable : ColumnDataType.Text;
|
|
765
|
+
}
|
|
766
|
+
getDisplayValue(data, table, options) {
|
|
767
|
+
if (table.options.useNestedTables) {
|
|
768
|
+
return this.getDisplayValueCore(data);
|
|
769
|
+
}
|
|
770
|
+
return super.getDisplayValue(data, table, options);
|
|
771
|
+
}
|
|
772
|
+
getCellData(table, data) {
|
|
773
|
+
const displayValue = this.getDisplayValue(data, table, table.options);
|
|
774
|
+
const formattedValue = table.options.useNestedTables && Array.isArray(displayValue)
|
|
775
|
+
? displayValue
|
|
776
|
+
: (typeof displayValue === "string" ? displayValue : JSON.stringify(displayValue) || "");
|
|
777
|
+
return { question: this.question, displayValue: formattedValue };
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
class PanelDynamicColumn extends BaseColumn {
|
|
781
|
+
getDataType() {
|
|
782
|
+
return this.table.options.useNestedTables ? ColumnDataType.NestedTable : ColumnDataType.Text;
|
|
783
|
+
}
|
|
784
|
+
getDisplayValue(data, table, options) {
|
|
785
|
+
if (table.options.useNestedTables) {
|
|
786
|
+
return this.getDisplayValueCore(data);
|
|
787
|
+
}
|
|
788
|
+
return super.getDisplayValue(data, table, options);
|
|
789
|
+
}
|
|
790
|
+
getCellData(table, data) {
|
|
791
|
+
const displayValue = this.getDisplayValue(data, table, table.options);
|
|
792
|
+
const formattedValue = table.options.useNestedTables && Array.isArray(displayValue)
|
|
793
|
+
? displayValue
|
|
794
|
+
: (typeof displayValue === "string" ? displayValue : JSON.stringify(displayValue) || "");
|
|
795
|
+
return { question: this.question, displayValue: formattedValue };
|
|
796
|
+
}
|
|
797
|
+
}
|
|
726
798
|
|
|
727
799
|
class DefaultColumnsBuilder {
|
|
728
800
|
createColumn(question, table) {
|
|
@@ -767,6 +839,16 @@ class CheckboxColumnsBuilder extends SelectBaseColumnsBuilder {
|
|
|
767
839
|
createColumn(question, table) {
|
|
768
840
|
return new CheckboxColumn(question, table);
|
|
769
841
|
}
|
|
842
|
+
buildColumnsCore(question, table) {
|
|
843
|
+
if (table.options.splitMultiSelectIntoColumns) {
|
|
844
|
+
const columns = [];
|
|
845
|
+
question.visibleChoices.forEach(choice => {
|
|
846
|
+
columns.push(new FlattenedCheckboxColumn(question, choice.value, choice.text, table));
|
|
847
|
+
});
|
|
848
|
+
return columns;
|
|
849
|
+
}
|
|
850
|
+
return super.buildColumnsCore(question, table);
|
|
851
|
+
}
|
|
770
852
|
}
|
|
771
853
|
ColumnsBuilderFactory.Instance.registerBuilderColumn("checkbox", new CheckboxColumnsBuilder());
|
|
772
854
|
ColumnsBuilderFactory.Instance.registerBuilderColumn("tagbox", new CheckboxColumnsBuilder());
|
|
@@ -855,6 +937,18 @@ class CompositeColumnsBuilder extends DefaultColumnsBuilder {
|
|
|
855
937
|
}
|
|
856
938
|
CompositeColumnsBuilder.ShowAsSeparateColumns = true;
|
|
857
939
|
ColumnsBuilderFactory.Instance.registerBuilderColumn("composite", new CompositeColumnsBuilder());
|
|
940
|
+
class MatrixDynamicColumnsBuilder extends DefaultColumnsBuilder {
|
|
941
|
+
createColumn(question, table) {
|
|
942
|
+
return new MatrixDynamicColumn(question, table);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
ColumnsBuilderFactory.Instance.registerBuilderColumn("matrixdynamic", new MatrixDynamicColumnsBuilder());
|
|
946
|
+
class PanelDynamicColumnsBuilder extends DefaultColumnsBuilder {
|
|
947
|
+
createColumn(question, table) {
|
|
948
|
+
return new PanelDynamicColumn(question, table);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
ColumnsBuilderFactory.Instance.registerBuilderColumn("paneldynamic", new PanelDynamicColumnsBuilder());
|
|
858
952
|
|
|
859
953
|
// export type GetDataFn = (params: { filter?: any, limit?: number, offset?: number, callback?: (response: { data: Array<Object>, total: number, error?: any }) => void }) => Promise<{ data: Array<Object>, total: number, error?: any }> | void;
|
|
860
954
|
class TableEvent extends EventBase {
|
|
@@ -894,6 +988,9 @@ class Table {
|
|
|
894
988
|
if (!this._options) {
|
|
895
989
|
this._options = {};
|
|
896
990
|
}
|
|
991
|
+
if (typeof this._options.useNestedTables === "undefined") {
|
|
992
|
+
this._options.useNestedTables = true;
|
|
993
|
+
}
|
|
897
994
|
this.initialize();
|
|
898
995
|
this.extensions = new TableExtensions(this);
|
|
899
996
|
const f = hasLicense;
|
|
@@ -1321,6 +1418,35 @@ const escapeCellFormula = (field) => {
|
|
|
1321
1418
|
return field;
|
|
1322
1419
|
}
|
|
1323
1420
|
};
|
|
1421
|
+
const decodeHtmlEntities = (text) => {
|
|
1422
|
+
if (typeof text !== "string")
|
|
1423
|
+
return text;
|
|
1424
|
+
const entityMap = {
|
|
1425
|
+
// eslint-disable-next-line surveyjs/eslint-plugin-i18n/only-english-or-code
|
|
1426
|
+
"✔": "+",
|
|
1427
|
+
// eslint-disable-next-line surveyjs/eslint-plugin-i18n/only-english-or-code
|
|
1428
|
+
"✓": "✓",
|
|
1429
|
+
// eslint-disable-next-line surveyjs/eslint-plugin-i18n/only-english-or-code
|
|
1430
|
+
"✓": "✓",
|
|
1431
|
+
// eslint-disable-next-line surveyjs/eslint-plugin-i18n/only-english-or-code
|
|
1432
|
+
"✓": "✓",
|
|
1433
|
+
// eslint-disable-next-line surveyjs/eslint-plugin-i18n/only-english-or-code
|
|
1434
|
+
"☑": "☑",
|
|
1435
|
+
// eslint-disable-next-line surveyjs/eslint-plugin-i18n/only-english-or-code
|
|
1436
|
+
"☑": "☑",
|
|
1437
|
+
"&": "&",
|
|
1438
|
+
"<": "<",
|
|
1439
|
+
">": ">",
|
|
1440
|
+
""": '"',
|
|
1441
|
+
"'": "'",
|
|
1442
|
+
"'": "'"
|
|
1443
|
+
};
|
|
1444
|
+
let decoded = text;
|
|
1445
|
+
for (const entity in entityMap) {
|
|
1446
|
+
decoded = decoded.replace(new RegExp(entity, "g"), entityMap[entity]);
|
|
1447
|
+
}
|
|
1448
|
+
return decoded;
|
|
1449
|
+
};
|
|
1324
1450
|
class Tabulator extends Table {
|
|
1325
1451
|
static initTabulatorConstructor(tabulatorTablesConstructor) {
|
|
1326
1452
|
this.tabulatorTablesConstructor = tabulatorTablesConstructor;
|
|
@@ -1375,6 +1501,12 @@ class Tabulator extends Table {
|
|
|
1375
1501
|
if (column.dataType === ColumnDataType.FileLink && Array.isArray(dataCell)) {
|
|
1376
1502
|
return (dataCell || []).map(f => f.name).join(", ");
|
|
1377
1503
|
}
|
|
1504
|
+
if (column.dataType === ColumnDataType.Html) {
|
|
1505
|
+
return decodeHtmlEntities(cellData);
|
|
1506
|
+
}
|
|
1507
|
+
if (column.dataType === ColumnDataType.NestedTable && Array.isArray(cellData)) {
|
|
1508
|
+
return this.formatNestedDataForExport(cellData, column);
|
|
1509
|
+
}
|
|
1378
1510
|
}
|
|
1379
1511
|
}
|
|
1380
1512
|
if (this.currentDownloadType === "csv" || this.currentDownloadType === "xlsx") {
|
|
@@ -1388,7 +1520,7 @@ class Tabulator extends Table {
|
|
|
1388
1520
|
if (((options && options.jspdf) || (!!window && window["jspdf"] !== undefined)) && defaultOptions.downloadButtons.indexOf("pdf") === -1) {
|
|
1389
1521
|
defaultOptions.downloadButtons.unshift("pdf");
|
|
1390
1522
|
}
|
|
1391
|
-
this._options = Object.assign({}, defaultOptions,
|
|
1523
|
+
this._options = Object.assign({}, defaultOptions, this._options);
|
|
1392
1524
|
}
|
|
1393
1525
|
supportSoftRefresh() {
|
|
1394
1526
|
return true;
|
|
@@ -1503,6 +1635,141 @@ class Tabulator extends Table {
|
|
|
1503
1635
|
});
|
|
1504
1636
|
return container;
|
|
1505
1637
|
}
|
|
1638
|
+
createNestedTable(nestedTableColumns, cellData) {
|
|
1639
|
+
const container = document.createElement("div");
|
|
1640
|
+
container.className = "sa-nested-table-container";
|
|
1641
|
+
const table = document.createElement("table");
|
|
1642
|
+
table.className = "sa-nested-table";
|
|
1643
|
+
const thead = document.createElement("thead");
|
|
1644
|
+
const headerRow = document.createElement("tr");
|
|
1645
|
+
nestedTableColumns.forEach((col) => {
|
|
1646
|
+
const th = document.createElement("th");
|
|
1647
|
+
th.textContent = col.title;
|
|
1648
|
+
headerRow.appendChild(th);
|
|
1649
|
+
});
|
|
1650
|
+
thead.appendChild(headerRow);
|
|
1651
|
+
table.appendChild(thead);
|
|
1652
|
+
const tbody = document.createElement("tbody");
|
|
1653
|
+
cellData.forEach((row) => {
|
|
1654
|
+
const tr = document.createElement("tr");
|
|
1655
|
+
nestedTableColumns.forEach((col) => {
|
|
1656
|
+
const td = document.createElement("td");
|
|
1657
|
+
const value = row[col.field];
|
|
1658
|
+
td.textContent = value !== undefined && value !== null ? String(value) : "";
|
|
1659
|
+
tr.appendChild(td);
|
|
1660
|
+
});
|
|
1661
|
+
tbody.appendChild(tr);
|
|
1662
|
+
});
|
|
1663
|
+
table.appendChild(tbody);
|
|
1664
|
+
container.appendChild(table);
|
|
1665
|
+
return container;
|
|
1666
|
+
}
|
|
1667
|
+
createNestedTableFormatter(column) {
|
|
1668
|
+
return (cell, formatterParams, onRendered) => {
|
|
1669
|
+
const cellData = cell.getValue();
|
|
1670
|
+
if (!Array.isArray(cellData) || cellData.length === 0) {
|
|
1671
|
+
return "<span>No data</span>";
|
|
1672
|
+
}
|
|
1673
|
+
const question = this._survey.getQuestionByName(column.name);
|
|
1674
|
+
if (!question) {
|
|
1675
|
+
return "<span>Error: Question not found</span>";
|
|
1676
|
+
}
|
|
1677
|
+
let nestedTableColumns = [];
|
|
1678
|
+
if (question.getType() === "matrixdynamic") {
|
|
1679
|
+
const matrixQuestion = question;
|
|
1680
|
+
nestedTableColumns = matrixQuestion.columns.map((col) => ({
|
|
1681
|
+
title: col.title || col.name,
|
|
1682
|
+
field: col.name,
|
|
1683
|
+
}));
|
|
1684
|
+
}
|
|
1685
|
+
else if (question.getType() === "paneldynamic") {
|
|
1686
|
+
const panelQuestion = question;
|
|
1687
|
+
const templateQuestions = panelQuestion.template.questions;
|
|
1688
|
+
nestedTableColumns = templateQuestions.map((q) => ({
|
|
1689
|
+
title: q.title || q.name,
|
|
1690
|
+
field: q.name,
|
|
1691
|
+
}));
|
|
1692
|
+
}
|
|
1693
|
+
if (this.options.useNestedTables === true) {
|
|
1694
|
+
return this.createNestedTable(nestedTableColumns, cellData);
|
|
1695
|
+
}
|
|
1696
|
+
const tableEl = document.createElement("div");
|
|
1697
|
+
tableEl.classList.add("sa-nested-table");
|
|
1698
|
+
// Defer nested Tabulator initialization to onRendered so that it
|
|
1699
|
+
// runs once per cell and can be properly cleaned up.
|
|
1700
|
+
onRendered(() => {
|
|
1701
|
+
const el = tableEl;
|
|
1702
|
+
// Avoid creating multiple nested tables for the same cell element.
|
|
1703
|
+
if (el._nestedTabulator) {
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
const nestedTable = new Tabulator.tabulatorTablesConstructor(tableEl, {
|
|
1707
|
+
// layout: "fitDataFill",
|
|
1708
|
+
data: cellData,
|
|
1709
|
+
columns: nestedTableColumns,
|
|
1710
|
+
pagination: false,
|
|
1711
|
+
});
|
|
1712
|
+
// Cache instance on the element for reuse / potential future teardown.
|
|
1713
|
+
el._nestedTabulator = nestedTable;
|
|
1714
|
+
nestedTable.on("tableBuilt", () => {
|
|
1715
|
+
// cell.getRow().normalizeHeight();
|
|
1716
|
+
this.layout(false);
|
|
1717
|
+
});
|
|
1718
|
+
// Ensure nested table is destroyed when the parent row is deleted.
|
|
1719
|
+
try {
|
|
1720
|
+
const row = cell.getRow && cell.getRow();
|
|
1721
|
+
const parentTable = row && row.getTable && row.getTable();
|
|
1722
|
+
if (parentTable && parentTable.on) {
|
|
1723
|
+
parentTable.on("rowDeleted", (deletedRow) => {
|
|
1724
|
+
if (deletedRow === row && el._nestedTabulator) {
|
|
1725
|
+
// Destroy nested Tabulator and clear cache.
|
|
1726
|
+
el._nestedTabulator.destroy();
|
|
1727
|
+
el._nestedTabulator = null;
|
|
1728
|
+
}
|
|
1729
|
+
});
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
catch (e) {
|
|
1733
|
+
// Fail-safe: if lifecycle hooks are unavailable, we still avoid
|
|
1734
|
+
// multiple instances per cell via the cached _nestedTabulator.
|
|
1735
|
+
}
|
|
1736
|
+
});
|
|
1737
|
+
return tableEl;
|
|
1738
|
+
};
|
|
1739
|
+
}
|
|
1740
|
+
formatNestedDataForExport(nestedData, column) {
|
|
1741
|
+
if (!Array.isArray(nestedData) || nestedData.length === 0) {
|
|
1742
|
+
return "";
|
|
1743
|
+
}
|
|
1744
|
+
const question = this._survey.getQuestionByName(column.name);
|
|
1745
|
+
if (!question) {
|
|
1746
|
+
return "";
|
|
1747
|
+
}
|
|
1748
|
+
let nestedColumns = [];
|
|
1749
|
+
if (question.getType() === "matrixdynamic") {
|
|
1750
|
+
const matrixQuestion = question;
|
|
1751
|
+
nestedColumns = matrixQuestion.columns.map((col) => ({
|
|
1752
|
+
title: col.title || col.name,
|
|
1753
|
+
field: col.name,
|
|
1754
|
+
}));
|
|
1755
|
+
}
|
|
1756
|
+
else if (question.getType() === "paneldynamic") {
|
|
1757
|
+
const panelQuestion = question;
|
|
1758
|
+
const templateQuestions = panelQuestion.template.questions;
|
|
1759
|
+
nestedColumns = templateQuestions.map((q) => ({
|
|
1760
|
+
title: q.title || q.name,
|
|
1761
|
+
field: q.name,
|
|
1762
|
+
}));
|
|
1763
|
+
}
|
|
1764
|
+
const header = nestedColumns.map(col => col.title).join(" | ");
|
|
1765
|
+
const rows = nestedData.map(rowData => {
|
|
1766
|
+
return nestedColumns.map(col => {
|
|
1767
|
+
const value = rowData[col.field];
|
|
1768
|
+
return value !== undefined && value !== null ? String(value) : "";
|
|
1769
|
+
}).join(" | ");
|
|
1770
|
+
});
|
|
1771
|
+
return `[${header}]\n${rows.join("\n")}`;
|
|
1772
|
+
}
|
|
1506
1773
|
getTitleFormatter(cell, formatterParams, onRendered, columnName) {
|
|
1507
1774
|
var container = DocumentHelper.createElement("div");
|
|
1508
1775
|
var title = DocumentHelper.createElement("span", "", {
|
|
@@ -1526,13 +1793,13 @@ class Tabulator extends Table {
|
|
|
1526
1793
|
getColumns() {
|
|
1527
1794
|
const columns = this.columns.map((column, index) => {
|
|
1528
1795
|
let formatter = "plaintext";
|
|
1529
|
-
if (column.dataType == ColumnDataType.FileLink) {
|
|
1796
|
+
if (column.dataType == ColumnDataType.FileLink || column.dataType == ColumnDataType.Html) {
|
|
1530
1797
|
formatter = "html";
|
|
1531
1798
|
}
|
|
1532
1799
|
if (column.dataType == ColumnDataType.Image) {
|
|
1533
1800
|
formatter = "image";
|
|
1534
1801
|
}
|
|
1535
|
-
|
|
1802
|
+
const columnDef = {
|
|
1536
1803
|
field: column.name,
|
|
1537
1804
|
title: column.displayName || column.name,
|
|
1538
1805
|
width: column.width,
|
|
@@ -1549,6 +1816,17 @@ class Tabulator extends Table {
|
|
|
1549
1816
|
return this.getTitleFormatter(cell, formatterParams, onRendered, column.name);
|
|
1550
1817
|
},
|
|
1551
1818
|
};
|
|
1819
|
+
if (column.dataType == ColumnDataType.NestedTable) {
|
|
1820
|
+
columnDef.formatter = this.createNestedTableFormatter(column);
|
|
1821
|
+
columnDef.tooltip = (_, cell) => {
|
|
1822
|
+
const cellData = cell.getValue();
|
|
1823
|
+
if (Array.isArray(cellData) && cellData.length > 0) {
|
|
1824
|
+
return this.formatNestedDataForExport(cellData, column);
|
|
1825
|
+
}
|
|
1826
|
+
return "";
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1829
|
+
return columnDef;
|
|
1552
1830
|
});
|
|
1553
1831
|
// const rowExtensions = TableExtensions.getExtensions("row").filter(e => e.visibleIndex >= 0);
|
|
1554
1832
|
// const detailsExtension = TableExtensions.getExtensions("details").filter(e => e.visibleIndex >= 0);
|
|
@@ -1691,5 +1969,5 @@ class TabulatorRow extends TableRow {
|
|
|
1691
1969
|
|
|
1692
1970
|
Tabulator.initTabulatorConstructor(TabulatorFull);
|
|
1693
1971
|
|
|
1694
|
-
export { BaseColumn, CheckboxColumn, CheckboxColumnsBuilder, ColumnsBuilderFactory, CommentColumn, CompositeColumnsBuilder, CompositeQuestionColumn, CustomColumnsBuilder, CustomQuestionColumn, DefaultColumn, DefaultColumnsBuilder, DocumentHelper, FileColumn, FileColumnsBuilder, ImageColumn, ImageColumnsBuilder, MatrixColumn, MatrixColumnsBuilder, MatrixDropdownColumn, MatrixDropdownColumnBuilder, OtherColumn, SelectBaseColumn, SelectBaseColumnsBuilder, SingleChoiceColumn, SingleChoiceColumnsBuilder, Table, TableEvent, TableExtensions, TableRow, Tabulator, TabulatorRow, defaultDownloadOptions, defaultOptions, localization };
|
|
1972
|
+
export { BaseColumn, CheckboxColumn, CheckboxColumnsBuilder, ColumnsBuilderFactory, CommentColumn, CompositeColumnsBuilder, CompositeQuestionColumn, CustomColumnsBuilder, CustomQuestionColumn, DefaultColumn, DefaultColumnsBuilder, DocumentHelper, FileColumn, FileColumnsBuilder, FlattenedCheckboxColumn, ImageColumn, ImageColumnsBuilder, MatrixColumn, MatrixColumnsBuilder, MatrixDropdownColumn, MatrixDropdownColumnBuilder, MatrixDynamicColumn, MatrixDynamicColumnsBuilder, OtherColumn, PanelDynamicColumn, PanelDynamicColumnsBuilder, SelectBaseColumn, SelectBaseColumnsBuilder, SingleChoiceColumn, SingleChoiceColumnsBuilder, Table, TableEvent, TableExtensions, TableRow, Tabulator, TabulatorRow, defaultDownloadOptions, defaultOptions, localization };
|
|
1695
1973
|
//# sourceMappingURL=survey.analytics.tabulator.mjs.map
|