survey-analytics 2.3.3 → 2.3.5
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 +59 -1
- package/fesm/shared.mjs.map +1 -1
- package/fesm/shared2.mjs +169 -64
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/survey.analytics.core.mjs +2 -2
- package/fesm/survey.analytics.mjs +4 -4
- package/fesm/survey.analytics.mjs.map +1 -1
- package/fesm/survey.analytics.tabulator.mjs +25 -12
- package/fesm/survey.analytics.tabulator.mjs.map +1 -1
- package/package.json +3 -2
- package/survey-analytics-tabulator.types/analytics-localization/arabic.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/dutch.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/english.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/farsi.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/finnish.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/french.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/german.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/italian.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/japanese.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/norwegian.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/polish.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/portuguese.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/russian.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/spanish.d.ts +2 -0
- package/survey-analytics-tabulator.types/analytics-localization/swedish.d.ts +2 -0
- package/survey-analytics-tabulator.types/localizationManager.d.ts +2 -0
- package/survey-analytics-tabulator.types/tables/table.d.ts +6 -2
- package/survey-analytics.types/alternativeVizualizersWrapper.d.ts +9 -1
- package/survey-analytics.types/analytics-localization/arabic.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/dutch.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/english.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/farsi.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/finnish.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/french.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/german.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/italian.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/japanese.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/norwegian.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/polish.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/portuguese.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/russian.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/spanish.d.ts +2 -0
- package/survey-analytics.types/analytics-localization/swedish.d.ts +2 -0
- package/survey-analytics.types/localizationManager.d.ts +2 -0
- package/survey-analytics.types/pivot.d.ts +3 -1
- package/survey-analytics.types/selectBase.d.ts +1 -1
- package/survey-analytics.types/statistics-table.d.ts +11 -1
- package/survey-analytics.types/visualizationPanel.d.ts +3 -3
- package/survey-analytics.types/visualizerBase.d.ts +16 -0
- package/survey.analytics.core.css +1 -1
- package/survey.analytics.core.js +258 -73
- 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 +260 -74
- 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.tabulator.css +5 -1
- package/survey.analytics.tabulator.css.map +1 -1
- package/survey.analytics.tabulator.js +82 -11
- 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
package/fesm/shared2.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.3.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.3.5
|
|
3
3
|
* Copyright (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { D as DocumentHelper, l as localization, g as createLoadingIndicator, b as DataHelper,
|
|
8
|
-
import { Event, QuestionCommentModel, settings, ItemValue,
|
|
7
|
+
import { D as DocumentHelper, l as localization, g as createLoadingIndicator, b as DataHelper, e as createCommercialLicenseLink, f as svgTemplate, t as toPrecision } from './shared.mjs';
|
|
8
|
+
import { Event, hasLicense, QuestionCommentModel, settings, ItemValue, surveyLocalization, IsTouch } from 'survey-core';
|
|
9
9
|
|
|
10
10
|
/******************************************************************************
|
|
11
11
|
Copyright (c) Microsoft Corporation.
|
|
@@ -189,7 +189,7 @@ class VisualizationManager {
|
|
|
189
189
|
if (constructor) {
|
|
190
190
|
let visualizers = VisualizationManager.vizualizers[qType];
|
|
191
191
|
if (!!visualizers) {
|
|
192
|
-
const vDescr = visualizers.filter(v => v.ctor === constructor
|
|
192
|
+
const vDescr = visualizers.filter(v => v.ctor === constructor)[0];
|
|
193
193
|
if (!!vDescr) {
|
|
194
194
|
let index = visualizers.indexOf(vDescr);
|
|
195
195
|
if (index !== -1) {
|
|
@@ -277,14 +277,19 @@ class VisualizerFactory {
|
|
|
277
277
|
* @param options An object with any custom properties you need within the visualizer.
|
|
278
278
|
*/
|
|
279
279
|
static createVisualizer(question, data, options) {
|
|
280
|
-
let type;
|
|
281
|
-
|
|
280
|
+
let type = question.getType();
|
|
281
|
+
let creators = [];
|
|
282
|
+
if (type === "text" && question.inputType) {
|
|
282
283
|
type = question.inputType;
|
|
284
|
+
creators = VisualizationManager.getVisualizersByType(type);
|
|
285
|
+
if (creators === undefined || creators.length == 0) {
|
|
286
|
+
type = "text";
|
|
287
|
+
creators = VisualizationManager.getVisualizersByType(type);
|
|
288
|
+
}
|
|
283
289
|
}
|
|
284
290
|
else {
|
|
285
|
-
|
|
291
|
+
creators = VisualizationManager.getVisualizersByType(type);
|
|
286
292
|
}
|
|
287
|
-
var creators = VisualizationManager.getVisualizersByType(type);
|
|
288
293
|
var visualizers = creators.map((creator) => new creator(question, data, options));
|
|
289
294
|
if (visualizers.length > 1) {
|
|
290
295
|
const alternativesVisualizerConstructor = VisualizationManager.getAltVisualizerSelector();
|
|
@@ -466,6 +471,7 @@ class VisualizerBase {
|
|
|
466
471
|
this._dataProvider = undefined;
|
|
467
472
|
this._getDataCore = undefined;
|
|
468
473
|
this.labelTruncateLength = 27;
|
|
474
|
+
this.haveCommercialLicense = false;
|
|
469
475
|
this.renderResult = undefined;
|
|
470
476
|
this.toolbarContainer = undefined;
|
|
471
477
|
this.headerContainer = undefined;
|
|
@@ -473,6 +479,7 @@ class VisualizerBase {
|
|
|
473
479
|
this.footerContainer = undefined;
|
|
474
480
|
this._supportSelection = false;
|
|
475
481
|
this._chartAdapter = undefined;
|
|
482
|
+
this._footerIsCollapsed = undefined;
|
|
476
483
|
/**
|
|
477
484
|
* An event that is raised after the visualizer's content is rendered.
|
|
478
485
|
*
|
|
@@ -528,6 +535,10 @@ class VisualizerBase {
|
|
|
528
535
|
this._calculationsCache = undefined;
|
|
529
536
|
this.loadingData = false;
|
|
530
537
|
this._settingState = false;
|
|
538
|
+
const f = hasLicense;
|
|
539
|
+
this.haveCommercialLicense = (!!f && f(4)) ||
|
|
540
|
+
VisualizerBase.haveCommercialLicense ||
|
|
541
|
+
(typeof options.haveCommercialLicense !== "undefined" ? options.haveCommercialLicense : false);
|
|
531
542
|
this._getDataCore = (_a = this.questionOptions) === null || _a === void 0 ? void 0 : _a.getDataCore;
|
|
532
543
|
this._dataProvider = options.dataProvider || new DataProvider(data);
|
|
533
544
|
this._dataProvider.onDataChanged.add(() => this.onDataChanged());
|
|
@@ -602,9 +613,9 @@ class VisualizerBase {
|
|
|
602
613
|
* Indicates whether users can select series points to cross-filter charts. To allow or disallow selection, set the [`allowSelection`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizationpaneloptions#allowSelection) property of the `IVisualizationPanelOptions` object in the [`VisualizationPanel`](https://surveyjs.io/dashboard/documentation/api-reference/visualizationpanel) constructor.
|
|
603
614
|
*/
|
|
604
615
|
get supportSelection() {
|
|
605
|
-
return (
|
|
616
|
+
return (this.options.allowSelection === undefined ||
|
|
606
617
|
this.options.allowSelection) &&
|
|
607
|
-
this._supportSelection
|
|
618
|
+
this._supportSelection;
|
|
608
619
|
}
|
|
609
620
|
getSeriesValues() {
|
|
610
621
|
return this.options.seriesValues || [];
|
|
@@ -850,26 +861,36 @@ class VisualizerBase {
|
|
|
850
861
|
destroyFooter(container) {
|
|
851
862
|
container.innerHTML = "";
|
|
852
863
|
}
|
|
864
|
+
get isFooterCollapsed() {
|
|
865
|
+
if (this._footerIsCollapsed === undefined) {
|
|
866
|
+
this._footerIsCollapsed = VisualizerBase.otherCommentCollapsed;
|
|
867
|
+
}
|
|
868
|
+
return this._footerIsCollapsed;
|
|
869
|
+
}
|
|
870
|
+
set isFooterCollapsed(newVal) {
|
|
871
|
+
this._footerIsCollapsed = newVal;
|
|
872
|
+
}
|
|
853
873
|
renderFooter(container) {
|
|
854
874
|
container.innerHTML = "";
|
|
855
875
|
if (this.hasFooter) {
|
|
856
876
|
const footerTitleElement = DocumentHelper.createElement("h4", "sa-visualizer__footer-title", { innerText: localization.getString("otherCommentTitle") });
|
|
857
877
|
container.appendChild(footerTitleElement);
|
|
858
878
|
const footerContentElement = DocumentHelper.createElement("div", "sa-visualizer__footer-content");
|
|
859
|
-
footerContentElement.style.display =
|
|
860
|
-
|
|
861
|
-
: "block";
|
|
879
|
+
footerContentElement.style.display = this.isFooterCollapsed ? "none" : "block";
|
|
880
|
+
const visibilityButtonText = localization.getString(this.isFooterCollapsed ? "showButton" : "hideButton");
|
|
862
881
|
const visibilityButton = DocumentHelper.createButton(() => {
|
|
863
882
|
if (footerContentElement.style.display === "none") {
|
|
864
883
|
footerContentElement.style.display = "block";
|
|
865
884
|
visibilityButton.innerText = localization.getString("hideButton");
|
|
885
|
+
this._footerIsCollapsed = false;
|
|
866
886
|
}
|
|
867
887
|
else {
|
|
868
888
|
footerContentElement.style.display = "none";
|
|
869
|
-
visibilityButton.innerText = localization.getString(
|
|
889
|
+
visibilityButton.innerText = localization.getString("showButton");
|
|
890
|
+
this._footerIsCollapsed = true;
|
|
870
891
|
}
|
|
871
892
|
this.footerVisualizer.invokeOnUpdate();
|
|
872
|
-
},
|
|
893
|
+
}, visibilityButtonText /*, "sa-toolbar__button--right"*/);
|
|
873
894
|
container.appendChild(visibilityButton);
|
|
874
895
|
container.appendChild(footerContentElement);
|
|
875
896
|
this.footerVisualizer.render(footerContentElement);
|
|
@@ -1067,6 +1088,7 @@ class VisualizerBase {
|
|
|
1067
1088
|
*
|
|
1068
1089
|
* > This method is overriden in classes descendant from `VisualizerBase`.
|
|
1069
1090
|
* @see setState
|
|
1091
|
+
* @see resetState
|
|
1070
1092
|
* @see onStateChanged
|
|
1071
1093
|
*/
|
|
1072
1094
|
getState() {
|
|
@@ -1079,10 +1101,21 @@ class VisualizerBase {
|
|
|
1079
1101
|
*
|
|
1080
1102
|
* > This method is overriden in classes descendant from `VisualizerBase`.
|
|
1081
1103
|
* @see getState
|
|
1104
|
+
* @see resetState
|
|
1082
1105
|
* @see onStateChanged
|
|
1083
1106
|
*/
|
|
1084
1107
|
setState(state) {
|
|
1085
1108
|
}
|
|
1109
|
+
/**
|
|
1110
|
+
* Resets the visualizer's state.
|
|
1111
|
+
*
|
|
1112
|
+
* > This method is overriden in classes descendant from `VisualizerBase`.
|
|
1113
|
+
* @see getState
|
|
1114
|
+
* @see setState
|
|
1115
|
+
* @see onStateChanged
|
|
1116
|
+
*/
|
|
1117
|
+
resetState() {
|
|
1118
|
+
}
|
|
1086
1119
|
/**
|
|
1087
1120
|
* Gets or sets the current locale.
|
|
1088
1121
|
*
|
|
@@ -1113,6 +1146,7 @@ class VisualizerBase {
|
|
|
1113
1146
|
}
|
|
1114
1147
|
}
|
|
1115
1148
|
}
|
|
1149
|
+
VisualizerBase.haveCommercialLicense = false;
|
|
1116
1150
|
VisualizerBase.suppressVisualizerStubRendering = false;
|
|
1117
1151
|
VisualizerBase.chartAdapterType = undefined;
|
|
1118
1152
|
// public static otherCommentQuestionType = "comment"; // TODO: make it configureable - allow choose what kind of question/visualizer will be used for comments/others
|
|
@@ -1310,7 +1344,6 @@ class SelectBase extends VisualizerBase {
|
|
|
1310
1344
|
this._showOnlyPercentages = false;
|
|
1311
1345
|
this._percentagePrecision = 0;
|
|
1312
1346
|
this._answersOrder = "default";
|
|
1313
|
-
this._supportSelection = true;
|
|
1314
1347
|
this._hideEmptyAnswers = false;
|
|
1315
1348
|
this._topN = -1;
|
|
1316
1349
|
this.topNValues = [].concat(SelectBase.topNValuesDefaults);
|
|
@@ -1330,6 +1363,7 @@ class SelectBase extends VisualizerBase {
|
|
|
1330
1363
|
this.dataProvider.raiseDataChanged();
|
|
1331
1364
|
};
|
|
1332
1365
|
}
|
|
1366
|
+
this._supportSelection = true;
|
|
1333
1367
|
this._showPercentages = this.options.showPercentages === true;
|
|
1334
1368
|
this._showOnlyPercentages = this.options.showOnlyPercentages === true;
|
|
1335
1369
|
if (this.options.percentagePrecision) {
|
|
@@ -1847,6 +1881,18 @@ class SelectBase extends VisualizerBase {
|
|
|
1847
1881
|
const selectedItem = ItemValue.getItemByValue(this.question.visibleChoices, state.filter);
|
|
1848
1882
|
this.setSelection(selectedItem !== null && selectedItem !== void 0 ? selectedItem : undefined);
|
|
1849
1883
|
}
|
|
1884
|
+
resetState() {
|
|
1885
|
+
super.resetState();
|
|
1886
|
+
// this._showPercentages = this.options.showPercentages === true;
|
|
1887
|
+
// this._showOnlyPercentages = this.options.showOnlyPercentages === true;
|
|
1888
|
+
// this._showMissingAnswers = this.isSupportMissingAnswers() && this.options.showMissingAnswers === true;
|
|
1889
|
+
// this._transposeData = this.options.transposeData || false;
|
|
1890
|
+
this._hideEmptyAnswers = this.options.hideEmptyAnswers === true;
|
|
1891
|
+
this._answersOrder = this.options.answersOrder || "default";
|
|
1892
|
+
this._topN = -1;
|
|
1893
|
+
this.chartType = this.chartTypes[0];
|
|
1894
|
+
this.setSelection(undefined);
|
|
1895
|
+
}
|
|
1850
1896
|
}
|
|
1851
1897
|
SelectBase.topNValuesDefaults = [-1, 5, 10, 20];
|
|
1852
1898
|
SelectBase._stateProperties = ["chartType", "answersOrder", "hideEmptyAnswers", "topN"];
|
|
@@ -1855,6 +1901,7 @@ VisualizationManager.registerVisualizer("radiogroup", SelectBase);
|
|
|
1855
1901
|
VisualizationManager.registerVisualizer("dropdown", SelectBase);
|
|
1856
1902
|
VisualizationManager.registerVisualizer("imagepicker", SelectBase);
|
|
1857
1903
|
VisualizationManager.registerVisualizer("tagbox", SelectBase);
|
|
1904
|
+
VisualizationManager.registerVisualizer("rating", SelectBase, 100);
|
|
1858
1905
|
|
|
1859
1906
|
class BooleanModel extends SelectBase {
|
|
1860
1907
|
constructor(question, data, options, name) {
|
|
@@ -2073,7 +2120,7 @@ HistogramModel.IntervalsCount = 10;
|
|
|
2073
2120
|
HistogramModel.UseIntervalsFrom = 10;
|
|
2074
2121
|
VisualizationManager.registerVisualizer("date", HistogramModel);
|
|
2075
2122
|
VisualizationManager.registerVisualizer("number", HistogramModel, 100);
|
|
2076
|
-
VisualizationManager.registerVisualizer("rating", HistogramModel,
|
|
2123
|
+
VisualizationManager.registerVisualizer("rating", HistogramModel, 300);
|
|
2077
2124
|
|
|
2078
2125
|
class Matrix extends SelectBase {
|
|
2079
2126
|
constructor(question, data, options, name) {
|
|
@@ -2158,9 +2205,10 @@ class Matrix extends SelectBase {
|
|
|
2158
2205
|
VisualizationManager.registerVisualizer("matrix", Matrix);
|
|
2159
2206
|
|
|
2160
2207
|
class PivotModel extends SelectBase {
|
|
2161
|
-
constructor(questions, data, options, name) {
|
|
2208
|
+
constructor(questions, data, options, name, isRoot = true) {
|
|
2162
2209
|
super(null, data, options, name || "pivot");
|
|
2163
2210
|
this.questions = questions;
|
|
2211
|
+
this.isRoot = isRoot;
|
|
2164
2212
|
this.valueType = "enum";
|
|
2165
2213
|
this._cachedValues = undefined;
|
|
2166
2214
|
this._continuousData = undefined;
|
|
@@ -2556,6 +2604,14 @@ class PivotModel extends SelectBase {
|
|
|
2556
2604
|
isSupportSoftUpdateContent() {
|
|
2557
2605
|
return false;
|
|
2558
2606
|
}
|
|
2607
|
+
renderToolbar(container) {
|
|
2608
|
+
if (!this.haveCommercialLicense && this.isRoot) {
|
|
2609
|
+
const banner = createCommercialLicenseLink();
|
|
2610
|
+
container.appendChild(banner);
|
|
2611
|
+
}
|
|
2612
|
+
container.className += " sa-pivot__header";
|
|
2613
|
+
super.renderToolbar(container);
|
|
2614
|
+
}
|
|
2559
2615
|
}
|
|
2560
2616
|
PivotModel.IntervalsCount = 10;
|
|
2561
2617
|
PivotModel.UseIntervalsFrom = 10;
|
|
@@ -2657,12 +2713,15 @@ class AlternativeVisualizersWrapper extends VisualizerBase {
|
|
|
2657
2713
|
setVisualizer(type, quiet = false) {
|
|
2658
2714
|
const visualizerCandidate = this.visualizers.filter((v) => v.type === type)[0];
|
|
2659
2715
|
if (!!visualizerCandidate && visualizerCandidate !== this.visualizer) {
|
|
2716
|
+
let isFooterCollapsed;
|
|
2660
2717
|
if (!!this.visualizer) {
|
|
2718
|
+
isFooterCollapsed = this.visualizer.isFooterCollapsed;
|
|
2661
2719
|
this.visualizer.onStateChanged.remove(this.onVisualizerStateChangedCallback);
|
|
2662
2720
|
this.visualizer.onAfterRender.remove(this.onAfterVisualizerRenderCallback);
|
|
2663
2721
|
this.visualizer.destroy();
|
|
2664
2722
|
}
|
|
2665
2723
|
this.visualizer = visualizerCandidate;
|
|
2724
|
+
this.visualizer.isFooterCollapsed = isFooterCollapsed;
|
|
2666
2725
|
this.refresh();
|
|
2667
2726
|
this.visualizer.onAfterRender.add(this.onAfterVisualizerRenderCallback);
|
|
2668
2727
|
this.visualizer.onStateChanged.add(this.onVisualizerStateChangedCallback);
|
|
@@ -2708,6 +2767,7 @@ class AlternativeVisualizersWrapper extends VisualizerBase {
|
|
|
2708
2767
|
*
|
|
2709
2768
|
* > This method is overriden in descendant classes.
|
|
2710
2769
|
* @see setState
|
|
2770
|
+
* @see resetState
|
|
2711
2771
|
*/
|
|
2712
2772
|
getState() {
|
|
2713
2773
|
const currentVisualizerState = this.visualizer.getState();
|
|
@@ -2722,8 +2782,8 @@ class AlternativeVisualizersWrapper extends VisualizerBase {
|
|
|
2722
2782
|
/**
|
|
2723
2783
|
* Sets the visualizer's state.
|
|
2724
2784
|
*
|
|
2725
|
-
* > This method is overriden in descendant classes.
|
|
2726
2785
|
* @see getState
|
|
2786
|
+
* @see resetState
|
|
2727
2787
|
*/
|
|
2728
2788
|
setState(state) {
|
|
2729
2789
|
if (!!state.visualizer) {
|
|
@@ -2733,6 +2793,17 @@ class AlternativeVisualizersWrapper extends VisualizerBase {
|
|
|
2733
2793
|
this.visualizer.setState(state.state);
|
|
2734
2794
|
}
|
|
2735
2795
|
}
|
|
2796
|
+
/**
|
|
2797
|
+
* Resets the visualizer's state.
|
|
2798
|
+
*
|
|
2799
|
+
* @see getState
|
|
2800
|
+
* @see setState
|
|
2801
|
+
*/
|
|
2802
|
+
resetState() {
|
|
2803
|
+
super.resetState();
|
|
2804
|
+
this.visualizers.forEach(visualizer => visualizer.resetState());
|
|
2805
|
+
this.setVisualizer(this.visualizers[0].type, true);
|
|
2806
|
+
}
|
|
2736
2807
|
getValues() {
|
|
2737
2808
|
return this.visualizer.getValues();
|
|
2738
2809
|
}
|
|
@@ -9723,12 +9794,12 @@ if (!!document) {
|
|
|
9723
9794
|
* [View Demo](https://surveyjs.io/dashboard/examples/interactive-survey-data-dashboard/ (linkStyle))
|
|
9724
9795
|
*/
|
|
9725
9796
|
class VisualizationPanel extends VisualizerBase {
|
|
9726
|
-
constructor(questions, data, options = {}, _elements = undefined) {
|
|
9797
|
+
constructor(questions, data, options = {}, _elements = undefined, isRoot = true) {
|
|
9727
9798
|
super(null, data, options, "panel");
|
|
9728
9799
|
this.questions = questions;
|
|
9729
9800
|
this._elements = _elements;
|
|
9801
|
+
this.isRoot = isRoot;
|
|
9730
9802
|
this.visualizers = [];
|
|
9731
|
-
this.haveCommercialLicense = false;
|
|
9732
9803
|
this.renderedQuestionsCount = 0;
|
|
9733
9804
|
this.onAfterRenderQuestionCallback = (sender, options) => {
|
|
9734
9805
|
this.renderedQuestionsCount++;
|
|
@@ -9807,12 +9878,6 @@ class VisualizationPanel extends VisualizerBase {
|
|
|
9807
9878
|
*/
|
|
9808
9879
|
this.onElementMoved = new Event();
|
|
9809
9880
|
this.loadingData = false;
|
|
9810
|
-
const f = hasLicense;
|
|
9811
|
-
this.haveCommercialLicense = (!!f && f(4)) ||
|
|
9812
|
-
VisualizationPanel.haveCommercialLicense ||
|
|
9813
|
-
(typeof options.haveCommercialLicense !== "undefined"
|
|
9814
|
-
? options.haveCommercialLicense
|
|
9815
|
-
: false);
|
|
9816
9881
|
this._layoutEngine =
|
|
9817
9882
|
options.layoutEngine ||
|
|
9818
9883
|
new MuuriLayoutEngine(this.allowDynamicLayout, "." + questionLayoutedElementClassName, this.allowDragDrop);
|
|
@@ -9825,53 +9890,57 @@ class VisualizationPanel extends VisualizerBase {
|
|
|
9825
9890
|
this._elements = this.buildElements(questions);
|
|
9826
9891
|
}
|
|
9827
9892
|
this.buildVisualizers(questions);
|
|
9828
|
-
if (!this.haveCommercialLicense) {
|
|
9893
|
+
if (!this.haveCommercialLicense && this.isRoot) {
|
|
9829
9894
|
this.registerToolbarItem("commercialLicense", () => {
|
|
9830
9895
|
return createCommercialLicenseLink();
|
|
9831
9896
|
});
|
|
9832
9897
|
}
|
|
9833
|
-
this.
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9898
|
+
this._supportSelection = true;
|
|
9899
|
+
if (this.supportSelection !== false) {
|
|
9900
|
+
this.registerToolbarItem("resetFilter", () => {
|
|
9901
|
+
return DocumentHelper.createButton(() => {
|
|
9902
|
+
this.visualizers.forEach((visualizer) => {
|
|
9903
|
+
if (visualizer instanceof SelectBase || visualizer instanceof AlternativeVisualizersWrapper) {
|
|
9904
|
+
visualizer.setSelection(undefined);
|
|
9905
|
+
}
|
|
9906
|
+
});
|
|
9907
|
+
}, localization.getString("resetFilter"));
|
|
9908
|
+
}, 900);
|
|
9909
|
+
}
|
|
9842
9910
|
this.registerToolbarItem("addElement", (toolbar) => {
|
|
9843
9911
|
if (this.allowHideQuestions) {
|
|
9844
9912
|
let addElementSelector = undefined;
|
|
9845
9913
|
const addElementSelectorUpdater = (panel, options) => {
|
|
9846
9914
|
const hiddenElements = this.hiddenElements;
|
|
9915
|
+
const selectWrapper = DocumentHelper.createSelector([
|
|
9916
|
+
{
|
|
9917
|
+
name: undefined,
|
|
9918
|
+
displayName: localization.getString("addElement"),
|
|
9919
|
+
},
|
|
9920
|
+
]
|
|
9921
|
+
.concat(hiddenElements)
|
|
9922
|
+
.map((element) => {
|
|
9923
|
+
return {
|
|
9924
|
+
value: element.name,
|
|
9925
|
+
text: element.displayName,
|
|
9926
|
+
};
|
|
9927
|
+
}), (option) => false, (e) => {
|
|
9928
|
+
this.showElement(e.target.value);
|
|
9929
|
+
});
|
|
9930
|
+
if (addElementSelector) {
|
|
9931
|
+
toolbar.replaceChild(selectWrapper, addElementSelector);
|
|
9932
|
+
}
|
|
9933
|
+
addElementSelector = selectWrapper;
|
|
9847
9934
|
if (hiddenElements.length > 0) {
|
|
9848
|
-
|
|
9849
|
-
{
|
|
9850
|
-
name: undefined,
|
|
9851
|
-
displayName: localization.getString("addElement"),
|
|
9852
|
-
},
|
|
9853
|
-
]
|
|
9854
|
-
.concat(hiddenElements)
|
|
9855
|
-
.map((element) => {
|
|
9856
|
-
return {
|
|
9857
|
-
value: element.name,
|
|
9858
|
-
text: element.displayName,
|
|
9859
|
-
};
|
|
9860
|
-
}), (option) => false, (e) => {
|
|
9861
|
-
this.showElement(e.target.value);
|
|
9862
|
-
});
|
|
9863
|
-
(addElementSelector &&
|
|
9864
|
-
toolbar.replaceChild(selectWrapper, addElementSelector)) ||
|
|
9865
|
-
toolbar.appendChild(selectWrapper);
|
|
9866
|
-
addElementSelector = selectWrapper;
|
|
9935
|
+
addElementSelector.style.display = undefined;
|
|
9867
9936
|
}
|
|
9868
|
-
else {
|
|
9869
|
-
addElementSelector
|
|
9870
|
-
addElementSelector = undefined;
|
|
9937
|
+
else if (addElementSelector) {
|
|
9938
|
+
addElementSelector.style.display = "none";
|
|
9871
9939
|
}
|
|
9872
9940
|
};
|
|
9873
9941
|
addElementSelectorUpdater();
|
|
9874
9942
|
this.onVisibleElementsChanged.add(addElementSelectorUpdater);
|
|
9943
|
+
return addElementSelector;
|
|
9875
9944
|
}
|
|
9876
9945
|
return undefined;
|
|
9877
9946
|
});
|
|
@@ -9998,7 +10067,7 @@ class VisualizationPanel extends VisualizerBase {
|
|
|
9998
10067
|
let visualizerData = this.surveyData;
|
|
9999
10068
|
let visualizer;
|
|
10000
10069
|
if (Array.isArray(question)) {
|
|
10001
|
-
visualizer = new (VisualizationManager.getPivotVisualizerConstructor())(question, visualizerData, visualizerOptions);
|
|
10070
|
+
visualizer = new (VisualizationManager.getPivotVisualizerConstructor())(question, visualizerData, visualizerOptions, undefined, false);
|
|
10002
10071
|
}
|
|
10003
10072
|
else {
|
|
10004
10073
|
visualizer = this.createVisualizer(question, visualizerOptions, visualizerData);
|
|
@@ -10334,6 +10403,18 @@ class VisualizationPanel extends VisualizerBase {
|
|
|
10334
10403
|
}
|
|
10335
10404
|
this.refresh();
|
|
10336
10405
|
}
|
|
10406
|
+
resetState() {
|
|
10407
|
+
this._settingState = true;
|
|
10408
|
+
super.resetState();
|
|
10409
|
+
try {
|
|
10410
|
+
this.visualizers.forEach(visualizer => visualizer.resetState());
|
|
10411
|
+
this.locale = surveyLocalization.defaultLocale;
|
|
10412
|
+
}
|
|
10413
|
+
finally {
|
|
10414
|
+
this._settingState = false;
|
|
10415
|
+
}
|
|
10416
|
+
this.refresh();
|
|
10417
|
+
}
|
|
10337
10418
|
get permissions() {
|
|
10338
10419
|
return this._elements.map((element) => {
|
|
10339
10420
|
return {
|
|
@@ -10363,7 +10444,6 @@ class VisualizationPanel extends VisualizerBase {
|
|
|
10363
10444
|
this.destroyVisualizers();
|
|
10364
10445
|
}
|
|
10365
10446
|
}
|
|
10366
|
-
VisualizationPanel.haveCommercialLicense = false;
|
|
10367
10447
|
|
|
10368
10448
|
class VisualizationPanelDynamic extends VisualizerBase {
|
|
10369
10449
|
constructor(question, data, options = {}, name) {
|
|
@@ -10376,7 +10456,7 @@ class VisualizationPanelDynamic extends VisualizerBase {
|
|
|
10376
10456
|
var options = Object.assign({}, options);
|
|
10377
10457
|
options.allowDynamicLayout = false;
|
|
10378
10458
|
options.dataProvider = undefined;
|
|
10379
|
-
this._panelVisualizer = new VisualizationPanel(this.getQuestions(), [], options);
|
|
10459
|
+
this._panelVisualizer = new VisualizationPanel(this.getQuestions(), [], options, undefined, false);
|
|
10380
10460
|
this._panelVisualizer.onAfterRender.add(this.onAfterRenderPanelCallback);
|
|
10381
10461
|
this.updateData(data);
|
|
10382
10462
|
}
|
|
@@ -10471,7 +10551,7 @@ class VisualizationMatrixDropdown extends VisualizerBase {
|
|
|
10471
10551
|
}
|
|
10472
10552
|
else {
|
|
10473
10553
|
const innerQuestions = this.getQuestions();
|
|
10474
|
-
this._matrixDropdownVisualizer = new VisualizationPanel(innerQuestions, [], this._childOptions);
|
|
10554
|
+
this._matrixDropdownVisualizer = new VisualizationPanel(innerQuestions, [], this._childOptions, undefined, false);
|
|
10475
10555
|
}
|
|
10476
10556
|
this._matrixDropdownVisualizer.onAfterRender.add(this.onPanelAfterRenderCallback);
|
|
10477
10557
|
this.updateData(data);
|
|
@@ -12387,9 +12467,34 @@ class StatisticsTable extends SelectBase {
|
|
|
12387
12467
|
super.destroy();
|
|
12388
12468
|
}
|
|
12389
12469
|
}
|
|
12470
|
+
class StatisticsTableBoolean extends BooleanModel {
|
|
12471
|
+
constructor(question, data, options, name) {
|
|
12472
|
+
super(question, data, options, name || "options");
|
|
12473
|
+
this._statisticsTableAdapter = new StatisticsTableAdapter(this);
|
|
12474
|
+
this.showPercentages = true;
|
|
12475
|
+
}
|
|
12476
|
+
destroyContent(container) {
|
|
12477
|
+
this._statisticsTableAdapter.destroy(container);
|
|
12478
|
+
super.destroyContent(container);
|
|
12479
|
+
}
|
|
12480
|
+
renderContentAsync(container) {
|
|
12481
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
12482
|
+
const tableNode = DocumentHelper.createElement("div");
|
|
12483
|
+
yield this._statisticsTableAdapter.create(tableNode);
|
|
12484
|
+
container.innerHTML = "";
|
|
12485
|
+
container.appendChild(tableNode);
|
|
12486
|
+
return container;
|
|
12487
|
+
});
|
|
12488
|
+
}
|
|
12489
|
+
destroy() {
|
|
12490
|
+
this._statisticsTableAdapter.destroy(this.contentContainer);
|
|
12491
|
+
super.destroy();
|
|
12492
|
+
}
|
|
12493
|
+
}
|
|
12390
12494
|
VisualizationManager.registerVisualizer("radiogroup", StatisticsTable);
|
|
12391
12495
|
VisualizationManager.registerVisualizer("dropdown", StatisticsTable);
|
|
12392
12496
|
VisualizationManager.registerVisualizer("checkbox", StatisticsTable);
|
|
12497
|
+
VisualizationManager.registerVisualizer("boolean", StatisticsTableBoolean);
|
|
12393
12498
|
|
|
12394
12499
|
class NpsVisualizerWidget {
|
|
12395
12500
|
constructor(_model, _data) {
|
|
@@ -12518,5 +12623,5 @@ NpsVisualizer.DetractorScore = 6;
|
|
|
12518
12623
|
NpsVisualizer.PromoterScore = 9;
|
|
12519
12624
|
// VisualizationManager.registerVisualizer("rating", NpsVisualizer);
|
|
12520
12625
|
|
|
12521
|
-
export { AlternativeVisualizersWrapper as A, BooleanModel as B, DataProvider as D, HistogramModel as H, Matrix as M, NumberModel as N, PostponeHelper as P, RankingModel as R, SelectBase as S, TextTableAdapter as T, VisualizerFactory as V, WordCloudAdapter as W, __awaiter as _, VisualizerBase as a, VisualizationManager as b, VisualizationPanel as c, VisualizationPanelDynamic as d, VisualizationMatrixDynamic as e, VisualizationMatrixDropdown as f, WordCloud as g, hideEmptyAnswersInData as h, Text as i, StatisticsTableAdapter as j, StatisticsTable as k,
|
|
12626
|
+
export { AlternativeVisualizersWrapper as A, BooleanModel as B, DataProvider as D, HistogramModel as H, Matrix as M, NumberModel as N, PostponeHelper as P, RankingModel as R, SelectBase as S, TextTableAdapter as T, VisualizerFactory as V, WordCloudAdapter as W, __awaiter as _, VisualizerBase as a, VisualizationManager as b, VisualizationPanel as c, VisualizationPanelDynamic as d, VisualizationMatrixDynamic as e, VisualizationMatrixDropdown as f, WordCloud as g, hideEmptyAnswersInData as h, Text as i, StatisticsTableAdapter as j, StatisticsTable as k, StatisticsTableBoolean as l, NpsVisualizerWidget as m, NpsAdapter as n, NpsVisualizer as o, PivotModel as p, defaultStatisticsCalculator as q, textHelper as t };
|
|
12522
12627
|
//# sourceMappingURL=shared2.mjs.map
|