survey-analytics 2.5.16 → 3.0.0-beta.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.
- package/fesm/shared.mjs +759 -3180
- package/fesm/shared.mjs.map +1 -1
- package/fesm/shared2.mjs +10561 -8296
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/shared3.mjs +4844 -0
- package/fesm/shared3.mjs.map +1 -0
- package/fesm/shared4.mjs +42 -0
- package/fesm/shared4.mjs.map +1 -0
- package/fesm/survey.analytics.apexcharts.mjs +1082 -0
- package/fesm/survey.analytics.apexcharts.mjs.map +1 -0
- package/fesm/survey.analytics.core.mjs +3 -3
- package/fesm/survey.analytics.mjs +7 -755
- package/fesm/survey.analytics.mjs.map +1 -1
- package/fesm/survey.analytics.mongo.mjs +1 -1
- package/fesm/survey.analytics.plotly.mjs +13 -0
- package/fesm/survey.analytics.plotly.mjs.map +1 -0
- package/fesm/survey.analytics.tabulator.mjs +341 -193
- package/fesm/survey.analytics.tabulator.mjs.map +1 -1
- package/fesm/themes/index.mjs +1942 -0
- package/fesm/themes/index.mjs.map +1 -0
- package/package.json +39 -10
- package/survey-analytics-plotly.types/alternativeVizualizersWrapper.d.ts +73 -0
- package/survey-analytics-plotly.types/analytics-localization/arabic.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/dutch.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/english.d.ts +142 -0
- package/survey-analytics-plotly.types/analytics-localization/farsi.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/finnish.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/french.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/german.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/italian.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/japanese.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/norwegian.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/polish.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/portuguese.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/russian.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/spanish.d.ts +100 -0
- package/survey-analytics-plotly.types/analytics-localization/swedish.d.ts +100 -0
- package/survey-analytics-plotly.types/axisDescription.d.ts +6 -0
- package/survey-analytics-plotly.types/boolean.d.ts +15 -0
- package/survey-analytics-plotly.types/card.d.ts +29 -0
- package/survey-analytics-plotly.types/chartConfig.d.ts +9 -0
- package/survey-analytics-plotly.types/config.d.ts +35 -0
- package/survey-analytics-plotly.types/dashboard.d.ts +51 -0
- package/survey-analytics-plotly.types/dataProvider.d.ts +69 -0
- package/survey-analytics-plotly.types/entries/plotly.d.ts +2 -0
- package/survey-analytics-plotly.types/entries/summary.core.d.ts +46 -0
- package/survey-analytics-plotly.types/filterInfo.d.ts +11 -0
- package/survey-analytics-plotly.types/histogram.d.ts +102 -0
- package/{survey-analytics.types/layoutEngine.d.ts → survey-analytics-plotly.types/layout-engine.d.ts} +0 -12
- package/survey-analytics-plotly.types/localizationManager.d.ts +164 -0
- package/survey-analytics-plotly.types/matrix.d.ts +17 -0
- package/survey-analytics-plotly.types/matrixDropdownGrouped.d.ts +15 -0
- package/survey-analytics-plotly.types/muuri-layout-engine.d.ts +13 -0
- package/survey-analytics-plotly.types/nps.d.ts +37 -0
- package/survey-analytics-plotly.types/number.d.ts +27 -0
- package/survey-analytics-plotly.types/pivot.d.ts +71 -0
- package/{survey-analytics.types → survey-analytics-plotly.types}/plotly/chart-adapter.d.ts +11 -2
- package/survey-analytics-plotly.types/plotly/setup.d.ts +150 -0
- package/survey-analytics-plotly.types/ranking.d.ts +12 -0
- package/survey-analytics-plotly.types/selectBase.d.ts +117 -0
- package/survey-analytics-plotly.types/sideBarItemCreators.d.ts +7 -0
- package/survey-analytics-plotly.types/statisticCalculators.d.ts +9 -0
- package/survey-analytics-plotly.types/statistics-table.d.ts +28 -0
- package/survey-analytics-plotly.types/svgbundle.d.ts +2 -0
- package/survey-analytics-plotly.types/text.d.ts +25 -0
- package/survey-analytics-plotly.types/theme.d.ts +51 -0
- package/survey-analytics-plotly.types/themes/default-light.d.ts +965 -0
- package/survey-analytics-plotly.types/utils/calculationDateRanges.d.ts +35 -0
- package/survey-analytics-plotly.types/utils/dateRangeModel.d.ts +32 -0
- package/survey-analytics-plotly.types/utils/dateRangeWidget.d.ts +38 -0
- package/survey-analytics-plotly.types/utils/documentHelper.d.ts +28 -0
- package/survey-analytics-plotly.types/utils/dropdownActionWidget.d.ts +34 -0
- package/survey-analytics-plotly.types/utils/dropdownBase.d.ts +48 -0
- package/survey-analytics-plotly.types/utils/dropdownWidget.d.ts +46 -0
- package/survey-analytics-plotly.types/utils/editableSeriesListWidget.d.ts +34 -0
- package/survey-analytics-plotly.types/utils/elementVisibilityAction.d.ts +22 -0
- package/survey-analytics-plotly.types/utils/index.d.ts +25 -0
- package/survey-analytics-plotly.types/utils/sidebarWidget.d.ts +48 -0
- package/survey-analytics-plotly.types/utils/toggle.d.ts +17 -0
- package/survey-analytics-plotly.types/utils/utils.d.ts +9 -0
- package/survey-analytics-plotly.types/visualizationComposite.d.ts +8 -0
- package/survey-analytics-plotly.types/visualizationManager.d.ts +61 -0
- package/survey-analytics-plotly.types/visualizationMatrixDropdown.d.ts +23 -0
- package/survey-analytics-plotly.types/visualizationMatrixDynamic.d.ts +8 -0
- package/survey-analytics-plotly.types/visualizationPanel.d.ts +464 -0
- package/survey-analytics-plotly.types/visualizationPanelDynamic.d.ts +20 -0
- package/survey-analytics-plotly.types/visualizer-interfaces.d.ts +25 -0
- package/survey-analytics-plotly.types/visualizerBase.d.ts +435 -0
- package/survey-analytics-plotly.types/visualizerDescription.d.ts +4 -0
- package/survey-analytics-plotly.types/visualizerFactory.d.ts +41 -0
- package/survey-analytics-plotly.types/wordcloud/stopwords/dutch.d.ts +1 -0
- package/survey-analytics-plotly.types/wordcloud/stopwords/english.d.ts +1 -0
- package/survey-analytics-plotly.types/wordcloud/stopwords/index.d.ts +3 -0
- package/survey-analytics-plotly.types/wordcloud/stopwords/norwegian.d.ts +1 -0
- package/survey-analytics-plotly.types/wordcloud/stopwords/spanish.d.ts +1 -0
- package/survey-analytics-plotly.types/wordcloud/widget.d.ts +38 -0
- package/survey-analytics-plotly.types/wordcloud/wordcloud.d.ts +28 -0
- package/survey-analytics-tabulator.types/analytics-localization/english.d.ts +40 -0
- package/survey-analytics-tabulator.types/entries/tabulator.d.ts +2 -25
- package/survey-analytics-tabulator.types/entries/tabulator.fontless.d.ts +26 -0
- package/survey-analytics-tabulator.types/localizationManager.d.ts +40 -0
- package/survey-analytics-tabulator.types/tables/columnbuilder.d.ts +16 -16
- package/survey-analytics-tabulator.types/tables/columns.d.ts +18 -18
- package/survey-analytics-tabulator.types/tables/config.d.ts +2 -2
- package/survey-analytics-tabulator.types/tables/extensions/footerextensions.d.ts +1 -0
- package/survey-analytics-tabulator.types/tables/extensions/tableextensions.d.ts +2 -1
- package/survey-analytics-tabulator.types/tables/table-interfaces.d.ts +56 -0
- package/survey-analytics-tabulator.types/tables/table.d.ts +4 -48
- package/survey-analytics-tabulator.types/tables/tabulator.d.ts +9 -1
- package/survey-analytics-tabulator.types/theme.d.ts +51 -0
- package/survey-analytics-tabulator.types/themes/default-light.d.ts +965 -0
- package/survey-analytics-tabulator.types/utils/documentHelper.d.ts +28 -0
- package/survey-analytics-tabulator.types/utils/dropdownActionWidget.d.ts +34 -0
- package/survey-analytics-tabulator.types/utils/dropdownBase.d.ts +48 -0
- package/survey-analytics-tabulator.types/utils/index.d.ts +1 -15
- package/survey-analytics.types/alternativeVizualizersWrapper.d.ts +9 -4
- package/survey-analytics.types/analytics-localization/english.d.ts +40 -0
- package/survey-analytics.types/apexcharts/chart-adapter.d.ts +29 -0
- package/survey-analytics.types/apexcharts/index.d.ts +2 -0
- package/survey-analytics.types/apexcharts/setup.d.ts +200 -0
- package/survey-analytics.types/axisDescription.d.ts +6 -0
- package/survey-analytics.types/boolean.d.ts +1 -1
- package/survey-analytics.types/card.d.ts +29 -0
- package/survey-analytics.types/chartConfig.d.ts +9 -0
- package/survey-analytics.types/config.d.ts +1 -33
- package/survey-analytics.types/dashboard.d.ts +51 -0
- package/survey-analytics.types/dataProvider.d.ts +17 -0
- package/survey-analytics.types/entries/apexcharts.d.ts +2 -0
- package/survey-analytics.types/entries/apexcharts.fontless.d.ts +2 -0
- package/survey-analytics.types/entries/summary.core.d.ts +9 -1
- package/survey-analytics.types/histogram.d.ts +29 -13
- package/survey-analytics.types/layout-engine.d.ts +29 -0
- package/survey-analytics.types/localizationManager.d.ts +40 -0
- package/survey-analytics.types/matrix.d.ts +3 -2
- package/survey-analytics.types/matrixDropdownGrouped.d.ts +3 -2
- package/survey-analytics.types/muuri-layout-engine.d.ts +13 -0
- package/survey-analytics.types/nps.d.ts +5 -10
- package/survey-analytics.types/number.d.ts +8 -7
- package/survey-analytics.types/pivot.d.ts +42 -40
- package/survey-analytics.types/ranking.d.ts +3 -2
- package/survey-analytics.types/selectBase.d.ts +13 -15
- package/survey-analytics.types/sideBarItemCreators.d.ts +7 -0
- package/survey-analytics.types/statisticCalculators.d.ts +8 -13
- package/survey-analytics.types/statistics-table.d.ts +2 -2
- package/survey-analytics.types/text.d.ts +4 -3
- package/survey-analytics.types/theme.d.ts +51 -0
- package/survey-analytics.types/themes/default-light.d.ts +965 -0
- package/survey-analytics.types/utils/calculationDateRanges.d.ts +35 -0
- package/survey-analytics.types/utils/dateRangeModel.d.ts +32 -0
- package/survey-analytics.types/utils/dateRangeWidget.d.ts +38 -0
- package/survey-analytics.types/utils/documentHelper.d.ts +28 -0
- package/survey-analytics.types/utils/dropdownActionWidget.d.ts +34 -0
- package/survey-analytics.types/utils/dropdownBase.d.ts +48 -0
- package/survey-analytics.types/utils/dropdownWidget.d.ts +46 -0
- package/survey-analytics.types/utils/editableSeriesListWidget.d.ts +34 -0
- package/survey-analytics.types/utils/elementVisibilityAction.d.ts +22 -0
- package/survey-analytics.types/utils/index.d.ts +1 -15
- package/survey-analytics.types/utils/sidebarWidget.d.ts +48 -0
- package/survey-analytics.types/utils/toggle.d.ts +17 -0
- package/survey-analytics.types/utils/utils.d.ts +9 -0
- package/survey-analytics.types/visualizationComposite.d.ts +1 -1
- package/survey-analytics.types/visualizationManager.d.ts +6 -5
- package/survey-analytics.types/visualizationMatrixDropdown.d.ts +2 -1
- package/survey-analytics.types/visualizationMatrixDynamic.d.ts +1 -1
- package/survey-analytics.types/visualizationPanel.d.ts +20 -3
- package/survey-analytics.types/visualizationPanelDynamic.d.ts +4 -3
- package/survey-analytics.types/visualizer-interfaces.d.ts +25 -0
- package/survey-analytics.types/visualizerBase.d.ts +80 -12
- package/survey-analytics.types/visualizerDescription.d.ts +4 -0
- package/survey-analytics.types/visualizerFactory.d.ts +11 -2
- package/survey-analytics.types/wordcloud/wordcloud.d.ts +6 -4
- package/survey.analytics.core.css +1534 -122
- package/survey.analytics.core.css.map +1 -1
- package/survey.analytics.core.d.ts +1 -0
- package/survey.analytics.core.js +6118 -1229
- package/survey.analytics.core.js.map +1 -1
- package/survey.analytics.core.min.css +11 -6
- package/survey.analytics.core.min.js +1 -1
- package/survey.analytics.core.min.js.LICENSE.txt +1 -1
- package/survey.analytics.css +1900 -129
- package/survey.analytics.css.map +1 -1
- package/survey.analytics.d.ts +2 -2
- package/survey.analytics.fontless.css +2009 -0
- package/survey.analytics.fontless.css.map +1 -0
- package/survey.analytics.fontless.min.css +16 -0
- package/survey.analytics.js +9764 -4539
- package/survey.analytics.js.map +1 -1
- package/survey.analytics.min.css +13 -6
- package/survey.analytics.min.js +1 -1
- package/survey.analytics.min.js.LICENSE.txt +1 -1
- package/survey.analytics.mongo.d.ts +1 -0
- package/survey.analytics.mongo.js +2 -2
- package/survey.analytics.mongo.js.map +1 -1
- package/survey.analytics.mongo.min.js +1 -1
- package/survey.analytics.mongo.min.js.LICENSE.txt +1 -1
- package/survey.analytics.plotly.css +2094 -0
- package/survey.analytics.plotly.css.map +1 -0
- package/survey.analytics.plotly.d.ts +2 -0
- package/survey.analytics.plotly.fontless.css +1872 -0
- package/survey.analytics.plotly.fontless.css.map +1 -0
- package/survey.analytics.plotly.fontless.min.css +15 -0
- package/survey.analytics.plotly.js +24673 -0
- package/survey.analytics.plotly.js.map +1 -0
- package/survey.analytics.plotly.min.css +16 -0
- package/survey.analytics.plotly.min.js +2 -0
- package/survey.analytics.plotly.min.js.LICENSE.txt +22 -0
- package/survey.analytics.tabulator.css +1005 -132
- package/survey.analytics.tabulator.css.map +1 -1
- package/survey.analytics.tabulator.d.ts +1 -0
- package/survey.analytics.tabulator.fontless.css +1134 -0
- package/survey.analytics.tabulator.fontless.css.map +1 -0
- package/survey.analytics.tabulator.fontless.min.css +6 -0
- package/survey.analytics.tabulator.js +2719 -476
- package/survey.analytics.tabulator.js.map +1 -1
- package/survey.analytics.tabulator.min.css +3 -2
- package/survey.analytics.tabulator.min.js +1 -1
- package/survey.analytics.tabulator.min.js.LICENSE.txt +1 -1
- package/themes/default-dark.js +1032 -0
- package/themes/default-dark.js.map +1 -0
- package/themes/default-dark.min.js +2 -0
- package/themes/default-dark.min.js.LICENSE.txt +5 -0
- package/themes/default-light.js +1032 -0
- package/themes/default-light.js.map +1 -0
- package/themes/default-light.min.js +2 -0
- package/themes/default-light.min.js.LICENSE.txt +5 -0
- package/themes/index.js +2063 -0
- package/themes/index.js.map +1 -0
- package/themes/index.min.js +2 -0
- package/themes/index.min.js.LICENSE.txt +5 -0
- package/themes/themes/default-dark.d.ts +965 -0
- package/themes/themes/default-light.d.ts +965 -0
- package/themes/themes/index.d.ts +1934 -0
- package/themes/utils/helpers.d.ts +8 -0
- package/survey-analytics.types/plotly/setup.d.ts +0 -32
- /package/{survey-analytics.types/entries/summary.d.ts → survey-analytics-plotly.types/entries/plotly.fontless.d.ts} +0 -0
- /package/{survey-analytics.types → survey-analytics-plotly.types}/plotly/index.d.ts +0 -0
- /package/{survey-analytics.types → survey-analytics-plotly.types}/plotly/legacy.d.ts +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v3.0.0-beta.1
|
|
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
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
export { s as setupLocale,
|
|
7
|
+
import { a as DocumentHelper, l as localization, c as createActionDropdown, e as createImagesContainer, f as createLinksContainer, g as createCommercialLicenseLink, h as svgTemplate, D as DashboardTheme } from './shared3.mjs';
|
|
8
|
+
export { s as setupLocale, b as surveyStrings } from './shared3.mjs';
|
|
9
9
|
import { ItemValue, settings, Serializer, surveyLocalization, hasLicense, EventBase, Event } from 'survey-core';
|
|
10
10
|
import { TabulatorFull } from 'tabulator-tables';
|
|
11
11
|
|
|
@@ -19,16 +19,19 @@ class TableExtensions {
|
|
|
19
19
|
if (!!extensions) {
|
|
20
20
|
extensions = this.sortExtensions(extensions);
|
|
21
21
|
extensions.forEach((extension) => {
|
|
22
|
-
|
|
23
|
-
var action = extension.render(this.table, options);
|
|
24
|
-
if (!!action) {
|
|
25
|
-
targetNode.appendChild(action);
|
|
26
|
-
this.renderedExtensions.push(extension);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
22
|
+
this.renderExtension(extension, targetNode, options);
|
|
29
23
|
});
|
|
30
24
|
}
|
|
31
25
|
}
|
|
26
|
+
renderExtension(extension, targetNode, options) {
|
|
27
|
+
if (!!extension.render && this.table.allowExtension(extension)) {
|
|
28
|
+
var action = extension.render(this.table, options);
|
|
29
|
+
if (!!action) {
|
|
30
|
+
targetNode.appendChild(action);
|
|
31
|
+
this.renderedExtensions.push(extension);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
32
35
|
destroy() {
|
|
33
36
|
this.renderedExtensions.forEach((extension) => {
|
|
34
37
|
if (!!extension.destroy)
|
|
@@ -93,8 +96,7 @@ TableExtensions.registerExtension({
|
|
|
93
96
|
name: "details",
|
|
94
97
|
visibleIndex: 0,
|
|
95
98
|
render: (_table, options) => {
|
|
96
|
-
const btn = DocumentHelper.createSvgButton("
|
|
97
|
-
btn.title = localization.getString("showMinorColumns");
|
|
99
|
+
const btn = DocumentHelper.createSvgButton("more-24x24", localization.getString("showMinorColumns"));
|
|
98
100
|
btn.className += " sa-table__row-extension";
|
|
99
101
|
btn.onclick = () => {
|
|
100
102
|
options.row.toggleDetails();
|
|
@@ -107,121 +109,95 @@ TableExtensions.registerExtension({
|
|
|
107
109
|
name: "select",
|
|
108
110
|
visibleIndex: -1,
|
|
109
111
|
render: function (_table, opt) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
checkbox.checked = row.getIsSelected();
|
|
115
|
-
checkbox.onchange = function () {
|
|
112
|
+
const itemClassSelected = "sa-checkbox--checked";
|
|
113
|
+
const row = opt.row;
|
|
114
|
+
const iconContainer = DocumentHelper.createSvgButton("check-24x24");
|
|
115
|
+
iconContainer.onclick = () => {
|
|
116
116
|
row.toggleSelect();
|
|
117
|
+
if (row.getIsSelected()) {
|
|
118
|
+
iconContainer.classList.add(itemClassSelected);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
iconContainer.classList.remove(itemClassSelected);
|
|
122
|
+
}
|
|
117
123
|
};
|
|
118
|
-
|
|
124
|
+
iconContainer.className = "sa-checkbox sa-table__row-extension";
|
|
125
|
+
if (row.getIsSelected()) {
|
|
126
|
+
iconContainer.classList.add(itemClassSelected);
|
|
127
|
+
}
|
|
128
|
+
// var checkbox = <HTMLInputElement>DocumentHelper.createElement(
|
|
129
|
+
// "input",
|
|
130
|
+
// "sa-table__row-extension",
|
|
131
|
+
// {
|
|
132
|
+
// type: "checkbox",
|
|
133
|
+
// }
|
|
134
|
+
// );
|
|
135
|
+
// checkbox.checked = row.getIsSelected();
|
|
136
|
+
// checkbox.onchange = function () {
|
|
137
|
+
// row.toggleSelect();
|
|
138
|
+
// };
|
|
139
|
+
return iconContainer;
|
|
119
140
|
},
|
|
120
141
|
});
|
|
121
142
|
|
|
122
143
|
TableExtensions.registerExtension({
|
|
123
144
|
location: "header",
|
|
124
145
|
name: "filter",
|
|
125
|
-
visibleIndex:
|
|
146
|
+
visibleIndex: 1,
|
|
126
147
|
render: function (table) {
|
|
127
|
-
const input = DocumentHelper.createInput(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
148
|
+
// const input = DocumentHelper.createInput(
|
|
149
|
+
// "sa-table__global-filter sa-table__header-extension",
|
|
150
|
+
// localization.getString("filterPlaceholder")
|
|
151
|
+
// );
|
|
152
|
+
// input.onchange = (event: any) => {
|
|
153
|
+
// table.applyFilter(event.target.value);
|
|
154
|
+
// };
|
|
155
|
+
const el = DocumentHelper.createTextEditor({
|
|
156
|
+
onchange: (val) => { table.applyFilter(val); }
|
|
157
|
+
});
|
|
158
|
+
return el;
|
|
132
159
|
},
|
|
133
160
|
});
|
|
134
161
|
TableExtensions.registerExtension({
|
|
135
162
|
location: "header",
|
|
136
163
|
name: "showcolumn",
|
|
137
|
-
visibleIndex:
|
|
138
|
-
destroy: function () {
|
|
139
|
-
this.onDestroy();
|
|
140
|
-
},
|
|
164
|
+
visibleIndex: 20,
|
|
141
165
|
render: function (table) {
|
|
142
|
-
const dropdown = DocumentHelper.createElement(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
166
|
+
// const dropdown = DocumentHelper.createElement(
|
|
167
|
+
// "select",
|
|
168
|
+
// "sa-table__show-column sa-table__header-extension"
|
|
169
|
+
// );
|
|
170
|
+
const allColumns = table.columns.map((column) => {
|
|
171
|
+
var text = column.displayName || column.name;
|
|
172
|
+
if (!!text && text.length > 20) {
|
|
173
|
+
text = text.substring(0, 20) + "...";
|
|
148
174
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
selected: true,
|
|
155
|
-
});
|
|
156
|
-
dropdown.appendChild(option);
|
|
157
|
-
hiddenColumns.forEach((column) => {
|
|
158
|
-
var text = column.displayName || column.name;
|
|
159
|
-
if (!!text && text.length > 20) {
|
|
160
|
-
text = text.substring(0, 20) + "...";
|
|
161
|
-
}
|
|
162
|
-
var option = DocumentHelper.createElement("option", "", {
|
|
163
|
-
text: text,
|
|
164
|
-
title: column.displayName,
|
|
165
|
-
value: column.name,
|
|
166
|
-
});
|
|
167
|
-
dropdown.appendChild(option);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
dropdown.onchange = (e) => {
|
|
171
|
-
const val = e.target.value;
|
|
172
|
-
e.stopPropagation();
|
|
173
|
-
if (!val)
|
|
174
|
-
return;
|
|
175
|
-
table.setColumnVisibility(val, true);
|
|
176
|
-
};
|
|
177
|
-
update();
|
|
178
|
-
var onVisibilityChangedCallback = () => {
|
|
179
|
-
update();
|
|
180
|
-
};
|
|
181
|
-
table.onColumnsVisibilityChanged.add(onVisibilityChangedCallback);
|
|
182
|
-
this.onDestroy = () => {
|
|
183
|
-
table.onColumnsVisibilityChanged.remove(onVisibilityChangedCallback);
|
|
184
|
-
};
|
|
185
|
-
return dropdown;
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
TableExtensions.registerExtension({
|
|
189
|
-
location: "header",
|
|
190
|
-
name: "showentries",
|
|
191
|
-
visibleIndex: 3,
|
|
192
|
-
render: function (table) {
|
|
193
|
-
if (table.options.paginationEnabled === false) {
|
|
194
|
-
return DocumentHelper.createElement("div");
|
|
195
|
-
}
|
|
196
|
-
function getEntriesDropdown(table) {
|
|
197
|
-
const el = DocumentHelper.createElement("select");
|
|
198
|
-
var optionsValues = table.paginationSizeSelector || ["1", "5", "10", "25", "50", "75", "100"];
|
|
199
|
-
optionsValues.forEach(function (val) {
|
|
200
|
-
var option = DocumentHelper.createElement("option", "", {
|
|
201
|
-
value: val,
|
|
202
|
-
text: val,
|
|
203
|
-
});
|
|
204
|
-
el.appendChild(option);
|
|
205
|
-
});
|
|
206
|
-
el.value = String(table.getPageSize());
|
|
207
|
-
el.onchange = () => {
|
|
208
|
-
table.setPageSize(Number(el.value));
|
|
175
|
+
return {
|
|
176
|
+
value: column.name,
|
|
177
|
+
text: text,
|
|
178
|
+
title: column.displayName || column.name,
|
|
179
|
+
icon: "check-24x24"
|
|
209
180
|
};
|
|
210
|
-
return el;
|
|
211
|
-
}
|
|
212
|
-
const selectorContainer = DocumentHelper.createElement("div", "sa-table__entries");
|
|
213
|
-
const spaceSpan = DocumentHelper.createElement("span", "sa-table__header-space");
|
|
214
|
-
const showSpan = DocumentHelper.createElement("span", "sa-table__entries-label sa-table__entries-label--right", {
|
|
215
|
-
innerText: localization.getString("showLabel"),
|
|
216
181
|
});
|
|
217
|
-
const
|
|
218
|
-
|
|
182
|
+
const dropdown = createActionDropdown({
|
|
183
|
+
options: allColumns,
|
|
184
|
+
isSelected: (option) => {
|
|
185
|
+
const hiddenColumns = table.columns.filter((column) => !column.isVisible);
|
|
186
|
+
return hiddenColumns.length === 0 || hiddenColumns.filter(el => el.name === option.value).length === 0;
|
|
187
|
+
},
|
|
188
|
+
handler: (e) => {
|
|
189
|
+
if (!!e) {
|
|
190
|
+
if (!e)
|
|
191
|
+
return;
|
|
192
|
+
const column = table.columns.filter((column) => column.name === e)[0];
|
|
193
|
+
table.setColumnVisibility(e, !column.isVisible);
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
title: localization.getString("columns")
|
|
219
198
|
});
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
selectorContainer.appendChild(getEntriesDropdown(table));
|
|
223
|
-
selectorContainer.appendChild(entriesSpan);
|
|
224
|
-
return selectorContainer;
|
|
199
|
+
dropdown.className += " sa-table__show-column sa-table__header-extension";
|
|
200
|
+
return dropdown;
|
|
225
201
|
},
|
|
226
202
|
});
|
|
227
203
|
TableExtensions.registerExtension({
|
|
@@ -229,41 +205,126 @@ TableExtensions.registerExtension({
|
|
|
229
205
|
name: "removerows",
|
|
230
206
|
visibleIndex: -1,
|
|
231
207
|
render: function (table) {
|
|
232
|
-
|
|
233
|
-
btn.onclick = function () {
|
|
208
|
+
const btn = DocumentHelper.createButton((e) => {
|
|
234
209
|
table.getCreatedRows().forEach(function (row) {
|
|
235
210
|
if (row.getIsSelected()) {
|
|
236
211
|
row.remove();
|
|
237
212
|
}
|
|
238
213
|
});
|
|
239
|
-
};
|
|
214
|
+
}, localization.getString("removeRows"), "sa-button");
|
|
215
|
+
btn.className += " sa-table__header-extension sa-button-brand-tertiary";
|
|
240
216
|
return btn;
|
|
217
|
+
// var btn = DocumentHelper.createElement(
|
|
218
|
+
// "button",
|
|
219
|
+
// "sa-table__btn sa-table__header-extension ",
|
|
220
|
+
// { innerText: localization.getString("removeRows") }
|
|
221
|
+
// );
|
|
222
|
+
// btn.onclick = function () {
|
|
223
|
+
// table.getCreatedRows().forEach(function (row) {
|
|
224
|
+
// if (row.getIsSelected()) {
|
|
225
|
+
// row.remove();
|
|
226
|
+
// }
|
|
227
|
+
// });
|
|
228
|
+
// };
|
|
229
|
+
// return btn;
|
|
241
230
|
},
|
|
242
231
|
});
|
|
243
232
|
TableExtensions.registerExtension({
|
|
244
233
|
location: "header",
|
|
245
234
|
name: "changelocale",
|
|
246
|
-
visibleIndex:
|
|
235
|
+
visibleIndex: 40,
|
|
247
236
|
render: function (table) {
|
|
248
237
|
var locales = table.getLocales();
|
|
249
238
|
if (table.options.disableLocaleSwitch || locales.length < 2)
|
|
250
239
|
return null;
|
|
251
|
-
|
|
240
|
+
/*
|
|
241
|
+
const el = <HTMLSelectElement>(
|
|
242
|
+
DocumentHelper.createElement("select", "sa-table__header-extension", {})
|
|
243
|
+
);
|
|
252
244
|
var optionsValues = [localization.getString("changeLocale")].concat(locales);
|
|
253
245
|
optionsValues.forEach(function (val) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
246
|
+
var option = DocumentHelper.createElement("option", "", {
|
|
247
|
+
value: val,
|
|
248
|
+
text: localization.localeNames[val] || localization.getString(val) || val,
|
|
249
|
+
});
|
|
250
|
+
el.appendChild(option);
|
|
259
251
|
});
|
|
260
252
|
el.onchange = () => {
|
|
261
|
-
|
|
253
|
+
table.locale = el.value;
|
|
262
254
|
};
|
|
255
|
+
*/
|
|
256
|
+
const optionsValues = locales.map(val => { return { value: val, text: localization.localeNames[val] || localization.getString(val) || val }; });
|
|
257
|
+
const el = createActionDropdown({
|
|
258
|
+
options: optionsValues,
|
|
259
|
+
isSelected: (option) => false,
|
|
260
|
+
handler: (e) => {
|
|
261
|
+
if (!!e) {
|
|
262
|
+
table.locale = e;
|
|
263
|
+
}
|
|
264
|
+
return true;
|
|
265
|
+
},
|
|
266
|
+
title: () => localization.getString("changeLocale"),
|
|
267
|
+
});
|
|
268
|
+
el.className += " sa-table__header-extension";
|
|
263
269
|
return el;
|
|
264
270
|
},
|
|
265
271
|
});
|
|
266
272
|
|
|
273
|
+
TableExtensions.registerExtension({
|
|
274
|
+
location: "footer",
|
|
275
|
+
name: "showentries",
|
|
276
|
+
visibleIndex: 30,
|
|
277
|
+
render: function (table) {
|
|
278
|
+
if (table.options.paginationEnabled === false) {
|
|
279
|
+
return DocumentHelper.createElement("div");
|
|
280
|
+
}
|
|
281
|
+
function getEntriesDropdown(table) {
|
|
282
|
+
/*
|
|
283
|
+
const el = <HTMLSelectElement>DocumentHelper.createElement("select");
|
|
284
|
+
var optionsValues = table.paginationSizeSelector || ["1", "5", "10", "25", "50", "75", "100"];
|
|
285
|
+
optionsValues.forEach(function (val) {
|
|
286
|
+
var option = DocumentHelper.createElement("option", "", {
|
|
287
|
+
value: val,
|
|
288
|
+
text: val,
|
|
289
|
+
});
|
|
290
|
+
el.appendChild(option);
|
|
291
|
+
});
|
|
292
|
+
el.value = String(table.getPageSize());
|
|
293
|
+
|
|
294
|
+
el.onchange = () => {
|
|
295
|
+
table.setPageSize(Number(el.value));
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
return el;
|
|
299
|
+
*/
|
|
300
|
+
const optionsValues = table.paginationSizeSelector || ["1", "5", "10", "25", "50", "75", "100"];
|
|
301
|
+
const el = createActionDropdown({
|
|
302
|
+
options: optionsValues.map(val => { return { value: val, text: val }; }),
|
|
303
|
+
isSelected: (option) => {
|
|
304
|
+
return option.value === table.getPageSize();
|
|
305
|
+
},
|
|
306
|
+
handler: (e) => {
|
|
307
|
+
if (e !== undefined && e !== null) {
|
|
308
|
+
table.setPageSize(Number(e));
|
|
309
|
+
}
|
|
310
|
+
return true;
|
|
311
|
+
},
|
|
312
|
+
title: () => { return String(table.getPageSize()); },
|
|
313
|
+
direction: "up"
|
|
314
|
+
});
|
|
315
|
+
el.className += " sa-table__entries-value";
|
|
316
|
+
return el;
|
|
317
|
+
}
|
|
318
|
+
const selectorContainer = DocumentHelper.createElement("div", "sa-table__entries");
|
|
319
|
+
const showSpan = DocumentHelper.createElement("span", "sa-table__entries-label sa-table__entries-label--right", {
|
|
320
|
+
innerText: localization.getString("entriesOnPageLabel"),
|
|
321
|
+
});
|
|
322
|
+
selectorContainer.appendChild(showSpan);
|
|
323
|
+
selectorContainer.appendChild(getEntriesDropdown(table));
|
|
324
|
+
return selectorContainer;
|
|
325
|
+
},
|
|
326
|
+
});
|
|
327
|
+
|
|
267
328
|
var QuestionLocation;
|
|
268
329
|
(function (QuestionLocation) {
|
|
269
330
|
QuestionLocation[QuestionLocation["Column"] = 0] = "Column";
|
|
@@ -279,10 +340,16 @@ var ColumnDataType;
|
|
|
279
340
|
TableExtensions.registerExtension({
|
|
280
341
|
location: "column",
|
|
281
342
|
name: "drag",
|
|
282
|
-
visibleIndex:
|
|
343
|
+
visibleIndex: 10,
|
|
283
344
|
render: function (table, options) {
|
|
284
|
-
const btn = DocumentHelper.
|
|
285
|
-
btn.
|
|
345
|
+
const btn = DocumentHelper.createSvgButton("drag-24x24");
|
|
346
|
+
btn.className = "sa-table__svg-button sa-table__drag-button";
|
|
347
|
+
btn.title = localization.getString("columnReorder");
|
|
348
|
+
// const btn = DocumentHelper.createElement(
|
|
349
|
+
// "button",
|
|
350
|
+
// "sa-table__svg-button sa-table__drag-button"
|
|
351
|
+
// );
|
|
352
|
+
// btn.appendChild(DocumentHelper.createSvgElement("drag-24x24"));
|
|
286
353
|
btn.addEventListener("mousedown", () => {
|
|
287
354
|
table.enableColumnReorder();
|
|
288
355
|
document.body.addEventListener("mouseup", () => {
|
|
@@ -295,12 +362,12 @@ TableExtensions.registerExtension({
|
|
|
295
362
|
TableExtensions.registerExtension({
|
|
296
363
|
location: "column",
|
|
297
364
|
name: "sort",
|
|
298
|
-
visibleIndex:
|
|
365
|
+
visibleIndex: 20,
|
|
299
366
|
render: function (table, options) {
|
|
300
367
|
const descTitle = localization.getString("descOrder");
|
|
301
368
|
const ascTitle = localization.getString("ascOrder");
|
|
302
|
-
var btn = DocumentHelper.createSvgButton("
|
|
303
|
-
btn.title = "";
|
|
369
|
+
var btn = DocumentHelper.createSvgButton("reorder-24x24");
|
|
370
|
+
btn.title = localization.getString("defaultOrder");
|
|
304
371
|
var direction = "asc";
|
|
305
372
|
btn.onclick = () => {
|
|
306
373
|
if (direction == "asc") {
|
|
@@ -322,10 +389,9 @@ TableExtensions.registerExtension({
|
|
|
322
389
|
TableExtensions.registerExtension({
|
|
323
390
|
location: "column",
|
|
324
391
|
name: "hide",
|
|
325
|
-
visibleIndex:
|
|
392
|
+
visibleIndex: 30,
|
|
326
393
|
render: function (table, options) {
|
|
327
|
-
var btn = DocumentHelper.createSvgButton("
|
|
328
|
-
btn.title = localization.getString("hideColumn");
|
|
394
|
+
var btn = DocumentHelper.createSvgButton("invisible-24x24", localization.getString("hideColumn"));
|
|
329
395
|
btn.onclick = () => {
|
|
330
396
|
table.setColumnVisibility(options.columnName, false);
|
|
331
397
|
};
|
|
@@ -335,10 +401,9 @@ TableExtensions.registerExtension({
|
|
|
335
401
|
TableExtensions.registerExtension({
|
|
336
402
|
location: "column",
|
|
337
403
|
name: "movetodetails",
|
|
338
|
-
visibleIndex:
|
|
404
|
+
visibleIndex: 10,
|
|
339
405
|
render: function (table, options) {
|
|
340
|
-
const button = DocumentHelper.createSvgButton("
|
|
341
|
-
button.title = localization.getString("moveToDetail");
|
|
406
|
+
const button = DocumentHelper.createSvgButton("movetohorizontal-24x24", localization.getString("moveToDetail"));
|
|
342
407
|
button.onclick = (e) => {
|
|
343
408
|
e.stopPropagation();
|
|
344
409
|
table.setColumnLocation(options.columnName, QuestionLocation.Row);
|
|
@@ -347,15 +412,23 @@ TableExtensions.registerExtension({
|
|
|
347
412
|
},
|
|
348
413
|
});
|
|
349
414
|
TableExtensions.registerExtension({
|
|
350
|
-
location: "
|
|
415
|
+
location: "columnfilter",
|
|
351
416
|
name: "filter",
|
|
352
|
-
visibleIndex:
|
|
417
|
+
visibleIndex: 10,
|
|
353
418
|
render: function (table, options) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
419
|
+
const el = DocumentHelper.createTextEditor({
|
|
420
|
+
showIcon: false,
|
|
421
|
+
onchange: (val) => {
|
|
422
|
+
table.applyColumnFilter(options.columnName, val);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
// "sa-table__filter",
|
|
426
|
+
// localization.getString("filterPlaceholder")
|
|
427
|
+
);
|
|
428
|
+
// el.onclick = (e) => e.stopPropagation();
|
|
429
|
+
// el.onchange = (e) => {
|
|
430
|
+
// table.applyColumnFilter(options.columnName, el.value);
|
|
431
|
+
// };
|
|
359
432
|
return el;
|
|
360
433
|
},
|
|
361
434
|
});
|
|
@@ -403,8 +476,9 @@ class Details {
|
|
|
403
476
|
this.targetNode = targetNode;
|
|
404
477
|
this.location = "details";
|
|
405
478
|
this.createShowAsColumnButton = (columnName) => {
|
|
406
|
-
const button = DocumentHelper.
|
|
407
|
-
button
|
|
479
|
+
const button = DocumentHelper.createSvgButton("movetovertical-24x24", localization.getString("showAsColumn"));
|
|
480
|
+
// "button",
|
|
481
|
+
// "sa-table__btn sa-table__btn--gray"
|
|
408
482
|
button.onclick = (e) => {
|
|
409
483
|
e.stopPropagation();
|
|
410
484
|
this.table.setColumnLocation(columnName, QuestionLocation.Column);
|
|
@@ -428,16 +502,20 @@ class Details {
|
|
|
428
502
|
var td2 = DocumentHelper.createElement("td");
|
|
429
503
|
td2.textContent = this.row.getRowData()[column.name];
|
|
430
504
|
if (column.dataType === ColumnDataType.Image) {
|
|
431
|
-
|
|
505
|
+
const imageElement = DocumentHelper.createElement("img", "", {
|
|
506
|
+
src: td2.textContent
|
|
507
|
+
});
|
|
508
|
+
td2.innerHTML = "";
|
|
509
|
+
td2.appendChild(imageElement);
|
|
432
510
|
}
|
|
433
511
|
var td3 = DocumentHelper.createElement("td");
|
|
434
512
|
td3.appendChild(this.createShowAsColumnButton(column.name));
|
|
513
|
+
row.appendChild(td3);
|
|
435
514
|
row.appendChild(td1);
|
|
436
515
|
row.appendChild(td2);
|
|
437
|
-
row.appendChild(td3);
|
|
438
516
|
rows.push(row);
|
|
439
517
|
});
|
|
440
|
-
var row = DocumentHelper.createElement("tr", "sa-table__detail");
|
|
518
|
+
var row = DocumentHelper.createElement("tr", "sa-table__detail sa-table-detail__actions");
|
|
441
519
|
var td = DocumentHelper.createElement("td", "", { colSpan: 3 });
|
|
442
520
|
var extensions = new TableExtensions(this.table);
|
|
443
521
|
extensions.render(td, "details", { row: this.row });
|
|
@@ -468,11 +546,9 @@ class BaseColumn {
|
|
|
468
546
|
this.updateWhenQuestionIsReady(question, table);
|
|
469
547
|
}
|
|
470
548
|
updateWhenQuestionIsReady(question, table) {
|
|
471
|
-
if (!question
|
|
549
|
+
if (!question)
|
|
472
550
|
return;
|
|
473
551
|
question.waitForQuestionIsReady().then(() => {
|
|
474
|
-
if (!table.isInitialized)
|
|
475
|
-
return;
|
|
476
552
|
try {
|
|
477
553
|
table.lockStateChanged();
|
|
478
554
|
table.refresh(!table.isInitTableDataProcessing);
|
|
@@ -668,7 +744,7 @@ class FileColumn extends BaseColumn {
|
|
|
668
744
|
getDisplayValue(data, table, options) {
|
|
669
745
|
let displayValue = this.getDisplayValueCore(data);
|
|
670
746
|
if (Array.isArray(displayValue)) {
|
|
671
|
-
displayValue =
|
|
747
|
+
displayValue = table.getShowFilesAsImages() ? createImagesContainer(displayValue).outerHTML : createLinksContainer(displayValue).outerHTML;
|
|
672
748
|
}
|
|
673
749
|
return displayValue;
|
|
674
750
|
}
|
|
@@ -803,15 +879,10 @@ ColumnsBuilderFactory.Instance.registerBuilderColumn("file", new FileColumnsBuil
|
|
|
803
879
|
class MatrixDropdownColumnBuilder extends DefaultColumnsBuilder {
|
|
804
880
|
buildColumns(questionBase, table) {
|
|
805
881
|
const question = questionBase;
|
|
806
|
-
const isDetailRowLocation = question.rows.length > 5;
|
|
807
882
|
const columns = [];
|
|
808
883
|
question.rows.forEach(row => {
|
|
809
884
|
question.columns.forEach(col => {
|
|
810
|
-
|
|
811
|
-
if (isDetailRowLocation) {
|
|
812
|
-
column.location = QuestionLocation.Row;
|
|
813
|
-
}
|
|
814
|
-
columns.push(column);
|
|
885
|
+
columns.push(new MatrixDropdownColumn(question, row, col, table));
|
|
815
886
|
});
|
|
816
887
|
});
|
|
817
888
|
return columns;
|
|
@@ -860,6 +931,9 @@ ColumnsBuilderFactory.Instance.registerBuilderColumn("composite", new CompositeC
|
|
|
860
931
|
class TableEvent extends EventBase {
|
|
861
932
|
}
|
|
862
933
|
class Table {
|
|
934
|
+
getShowFilesAsImages() {
|
|
935
|
+
return Table.showFilesAsImages;
|
|
936
|
+
}
|
|
863
937
|
constructor(_survey, data, _options = {}, _columnsData = []) {
|
|
864
938
|
this._survey = _survey;
|
|
865
939
|
this.data = data;
|
|
@@ -868,7 +942,6 @@ class Table {
|
|
|
868
942
|
this.haveCommercialLicense = false;
|
|
869
943
|
this.currentPageSize = 5;
|
|
870
944
|
this._rows = [];
|
|
871
|
-
this.isInitialized = false;
|
|
872
945
|
/**
|
|
873
946
|
* Sets pagination selector content.
|
|
874
947
|
*/
|
|
@@ -905,7 +978,6 @@ class Table {
|
|
|
905
978
|
: false));
|
|
906
979
|
}
|
|
907
980
|
initialize() {
|
|
908
|
-
this.isInitialized = false;
|
|
909
981
|
this.currentPageSize = this.options.pageSize || 5;
|
|
910
982
|
this.currentPageNumber = 1;
|
|
911
983
|
this._columns = this.buildColumns(this._survey);
|
|
@@ -914,7 +986,6 @@ class Table {
|
|
|
914
986
|
if (this._columnsData.length !== 0) {
|
|
915
987
|
this.updateColumnsFromData(this._columnsData);
|
|
916
988
|
}
|
|
917
|
-
this.isInitialized = true;
|
|
918
989
|
}
|
|
919
990
|
getTableData() {
|
|
920
991
|
return [].concat(this.tableData || []);
|
|
@@ -1294,8 +1365,8 @@ const defaultDownloadOptions = {
|
|
|
1294
1365
|
};
|
|
1295
1366
|
const defaultOptions = {
|
|
1296
1367
|
tabulatorOptions: {},
|
|
1297
|
-
actionsColumnWidth:
|
|
1298
|
-
columnMinWidth:
|
|
1368
|
+
actionsColumnWidth: 56,
|
|
1369
|
+
columnMinWidth: 384,
|
|
1299
1370
|
downloadHiddenColumns: false,
|
|
1300
1371
|
downloadButtons: ["csv"],
|
|
1301
1372
|
downloadOptions: defaultDownloadOptions,
|
|
@@ -1333,6 +1404,7 @@ class Tabulator extends Table {
|
|
|
1333
1404
|
}
|
|
1334
1405
|
constructor(survey, data, options, _columnsData = []) {
|
|
1335
1406
|
super(survey, data, options, _columnsData);
|
|
1407
|
+
this._theme = new DashboardTheme();
|
|
1336
1408
|
this.onAfterRender = new Event();
|
|
1337
1409
|
this.COLUMN_MIN_WIDTH = 155;
|
|
1338
1410
|
this.tabulatorTables = null;
|
|
@@ -1344,7 +1416,8 @@ class Tabulator extends Table {
|
|
|
1344
1416
|
};
|
|
1345
1417
|
this.columnMovedCallback = (column, columns) => {
|
|
1346
1418
|
var from = this._columns.indexOf(this.getColumnByName(column.getField()));
|
|
1347
|
-
|
|
1419
|
+
const rowExtensions = TableExtensions.getExtensions("row").filter(e => e.visibleIndex >= 0);
|
|
1420
|
+
var to = columns.indexOf(column) - rowExtensions.length;
|
|
1348
1421
|
this.moveColumn(from, to);
|
|
1349
1422
|
this.disableColumnReorder();
|
|
1350
1423
|
};
|
|
@@ -1404,13 +1477,25 @@ class Tabulator extends Table {
|
|
|
1404
1477
|
targetNode = document.getElementById(targetNode);
|
|
1405
1478
|
}
|
|
1406
1479
|
targetNode.className += " sa-table sa-tabulator";
|
|
1480
|
+
if (!this._appliedTheme) {
|
|
1481
|
+
this._appliedTheme = this.theme;
|
|
1482
|
+
}
|
|
1483
|
+
if (this._appliedTheme) {
|
|
1484
|
+
this._appliedTheme.applyThemeToElement(targetNode);
|
|
1485
|
+
}
|
|
1407
1486
|
const columns = this.getColumns();
|
|
1408
1487
|
const data = this.tableData;
|
|
1488
|
+
var wrapper = DocumentHelper.createElement("div", "sa-tabulator__wrapper");
|
|
1489
|
+
var container = DocumentHelper.createElement("div", "sa-tabulator__container");
|
|
1409
1490
|
var header = DocumentHelper.createElement("div", "sa-tabulator__header");
|
|
1491
|
+
var footer = DocumentHelper.createElement("div", "sa-tabulator__footer");
|
|
1410
1492
|
var paginationElement = DocumentHelper.createElement("div", "sa-tabulator__pagination-container");
|
|
1411
|
-
this.tableContainer = DocumentHelper.createElement("div");
|
|
1412
|
-
|
|
1413
|
-
|
|
1493
|
+
this.tableContainer = DocumentHelper.createElement("div", "sa-tabulator__table-container");
|
|
1494
|
+
container.appendChild(header);
|
|
1495
|
+
container.appendChild(this.tableContainer);
|
|
1496
|
+
container.appendChild(footer);
|
|
1497
|
+
wrapper.appendChild(container);
|
|
1498
|
+
targetNode.appendChild(wrapper);
|
|
1414
1499
|
var config = {};
|
|
1415
1500
|
Object.assign(config, {
|
|
1416
1501
|
data,
|
|
@@ -1419,7 +1504,7 @@ class Tabulator extends Table {
|
|
|
1419
1504
|
paginationMode: "local",
|
|
1420
1505
|
paginationSize: this.currentPageSize,
|
|
1421
1506
|
movableColumns: true,
|
|
1422
|
-
|
|
1507
|
+
maxHeight: "50vw",
|
|
1423
1508
|
columns,
|
|
1424
1509
|
rowFormatter: this.rowFormatter,
|
|
1425
1510
|
paginationElement: paginationElement,
|
|
@@ -1481,37 +1566,73 @@ class Tabulator extends Table {
|
|
|
1481
1566
|
this.renderResult = targetNode;
|
|
1482
1567
|
this.afterRender(targetNode);
|
|
1483
1568
|
});
|
|
1484
|
-
DocumentHelper.createElement("div", "sa-table__header-extensions");
|
|
1569
|
+
const extensionsContainer = DocumentHelper.createElement("div", "sa-table__header-extensions");
|
|
1570
|
+
this.extensions.render(extensionsContainer, "header");
|
|
1571
|
+
header.appendChild(extensionsContainer);
|
|
1485
1572
|
header.appendChild(this.createDownloadsBar());
|
|
1486
|
-
this.extensions.render(
|
|
1487
|
-
|
|
1488
|
-
|
|
1573
|
+
this.extensions.render(footer, "footer");
|
|
1574
|
+
footer.appendChild(paginationElement);
|
|
1575
|
+
this.renderResult = targetNode;
|
|
1489
1576
|
}
|
|
1490
1577
|
createDownloadsBar() {
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1578
|
+
/*
|
|
1579
|
+
var createDownloadButton = (type: DownloadType, caption: string): HTMLElement => {
|
|
1580
|
+
const btn = DocumentHelper.createElement(
|
|
1581
|
+
"button",
|
|
1582
|
+
"sa-table__btn sa-table__btn--small sa-table__btn--gray",
|
|
1583
|
+
{
|
|
1584
|
+
innerText: caption,
|
|
1585
|
+
onclick: () => {
|
|
1586
|
+
this.download(type);
|
|
1587
|
+
},
|
|
1588
|
+
}
|
|
1589
|
+
);
|
|
1590
|
+
return btn;
|
|
1499
1591
|
};
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1592
|
+
|
|
1593
|
+
var container = DocumentHelper.createElement(
|
|
1594
|
+
"div",
|
|
1595
|
+
"sa-tabulator__downloads-bar"
|
|
1596
|
+
);
|
|
1597
|
+
|
|
1598
|
+
this._options.downloadButtons.forEach((type: DownloadType) => {
|
|
1599
|
+
container.appendChild(
|
|
1600
|
+
createDownloadButton(
|
|
1601
|
+
type,
|
|
1602
|
+
localization.getString(`${type}DownloadCaption`)
|
|
1603
|
+
)
|
|
1604
|
+
);
|
|
1503
1605
|
});
|
|
1504
1606
|
return container;
|
|
1607
|
+
*/
|
|
1608
|
+
const values = this._options.downloadButtons.map(val => { return { value: val, text: localization.getString(`${val}DownloadCaption`) }; });
|
|
1609
|
+
const exportAsAction = createActionDropdown({
|
|
1610
|
+
options: values,
|
|
1611
|
+
isSelected: (option) => false,
|
|
1612
|
+
handler: (e) => {
|
|
1613
|
+
if (!!e) {
|
|
1614
|
+
this.download(e);
|
|
1615
|
+
}
|
|
1616
|
+
return true;
|
|
1617
|
+
},
|
|
1618
|
+
title: localization.getString("exportAs"),
|
|
1619
|
+
showArrow: false
|
|
1620
|
+
});
|
|
1621
|
+
exportAsAction.className += " sa-tabulator__downloads-bar sa-button-brand-secondary";
|
|
1622
|
+
return exportAsAction;
|
|
1505
1623
|
}
|
|
1506
1624
|
getTitleFormatter(cell, formatterParams, onRendered, columnName) {
|
|
1507
|
-
var container = DocumentHelper.createElement("div");
|
|
1508
|
-
var title = DocumentHelper.createElement("span", "", {
|
|
1625
|
+
var container = DocumentHelper.createElement("div", "sa-tabulator-column-header");
|
|
1626
|
+
var title = DocumentHelper.createElement("span", "sa-tabulator-column-title-text", {
|
|
1509
1627
|
innerText: cell.getValue(),
|
|
1510
1628
|
});
|
|
1511
|
-
|
|
1512
|
-
|
|
1629
|
+
const actionContainer = this.getHeaderActions(columnName);
|
|
1630
|
+
const containerFilter = DocumentHelper.createElement("div", "sa-table__filter-container");
|
|
1631
|
+
this.extensions.render(containerFilter, "columnfilter", { columnName: columnName });
|
|
1632
|
+
container.appendChild(actionContainer);
|
|
1513
1633
|
container.appendChild(title);
|
|
1514
|
-
|
|
1634
|
+
container.appendChild(containerFilter);
|
|
1635
|
+
["mousemove", "mousedown"].forEach(eventName => actionContainer.addEventListener(eventName, (event) => {
|
|
1515
1636
|
if (!this.isColumnReorderEnabled) {
|
|
1516
1637
|
event.stopPropagation();
|
|
1517
1638
|
}
|
|
@@ -1550,20 +1671,22 @@ class Tabulator extends Table {
|
|
|
1550
1671
|
},
|
|
1551
1672
|
};
|
|
1552
1673
|
});
|
|
1553
|
-
|
|
1674
|
+
const rowExtensions = TableExtensions.getExtensions("row").filter(e => e.visibleIndex >= 0);
|
|
1554
1675
|
// const detailsExtension = TableExtensions.getExtensions("details").filter(e => e.visibleIndex >= 0);
|
|
1555
1676
|
// const hasRowColumns = this.columns.some(c => c.location === QuestionLocation.Row);
|
|
1556
1677
|
// if(rowExtensions.length > 1 || detailsExtension.length > 0
|
|
1557
1678
|
// || rowExtensions.length == 1 && (rowExtensions[0].name == "details" && hasRowColumns || rowExtensions[0].name != "details")) {
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1679
|
+
rowExtensions.forEach(ext => {
|
|
1680
|
+
columns.unshift({
|
|
1681
|
+
download: false,
|
|
1682
|
+
resizable: false,
|
|
1683
|
+
headerSort: false,
|
|
1684
|
+
minWidth: this._options.actionsColumnWidth,
|
|
1685
|
+
width: this._options.actionsColumnWidth,
|
|
1686
|
+
tooltip: (_, cell) => {
|
|
1687
|
+
return undefined;
|
|
1688
|
+
}
|
|
1689
|
+
});
|
|
1567
1690
|
});
|
|
1568
1691
|
// }
|
|
1569
1692
|
return columns;
|
|
@@ -1661,6 +1784,20 @@ class Tabulator extends Table {
|
|
|
1661
1784
|
dataItem["surveyOriginalData"] = item;
|
|
1662
1785
|
return dataItem;
|
|
1663
1786
|
}
|
|
1787
|
+
get theme() {
|
|
1788
|
+
return this._theme;
|
|
1789
|
+
}
|
|
1790
|
+
set theme(theme) {
|
|
1791
|
+
this._theme = theme;
|
|
1792
|
+
this._appliedTheme = undefined;
|
|
1793
|
+
}
|
|
1794
|
+
applyTheme(theme) {
|
|
1795
|
+
this.theme.setTheme(theme);
|
|
1796
|
+
this._appliedTheme = this.theme;
|
|
1797
|
+
if (this.renderResult) {
|
|
1798
|
+
this._appliedTheme.applyThemeToElement(this.renderResult);
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1664
1801
|
}
|
|
1665
1802
|
class TabulatorRow extends TableRow {
|
|
1666
1803
|
constructor(table, extensionsContainer, detailsContainer, innerRow) {
|
|
@@ -1683,6 +1820,17 @@ class TabulatorRow extends TableRow {
|
|
|
1683
1820
|
}
|
|
1684
1821
|
return null;
|
|
1685
1822
|
}
|
|
1823
|
+
render() {
|
|
1824
|
+
let rowExtensions = TableExtensions.getExtensions("row").filter(e => e.visibleIndex >= 0);
|
|
1825
|
+
rowExtensions = this.extensions.sortExtensions(rowExtensions);
|
|
1826
|
+
rowExtensions.forEach((rowExt, index) => {
|
|
1827
|
+
const cellAction = this.innerRow.getCells()[index].getElement();
|
|
1828
|
+
cellAction.innerHTML = "";
|
|
1829
|
+
this.extensions.renderExtension(rowExt, cellAction, { row: this });
|
|
1830
|
+
cellAction.classList.add("sa-tabulator-cell__action");
|
|
1831
|
+
cellAction.classList.add("sa-tabulator-cell__action-" + rowExt.name.toLowerCase());
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1686
1834
|
remove() {
|
|
1687
1835
|
this.innerRow.delete();
|
|
1688
1836
|
super.remove();
|