survey-analytics 1.12.51 → 1.12.53

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.
Files changed (33) hide show
  1. package/fesm/shared.mjs +59 -1
  2. package/fesm/shared.mjs.map +1 -1
  3. package/fesm/shared2.mjs +190 -81
  4. package/fesm/shared2.mjs.map +1 -1
  5. package/fesm/survey.analytics.core.mjs +2 -2
  6. package/fesm/survey.analytics.mjs +12 -5
  7. package/fesm/survey.analytics.mjs.map +1 -1
  8. package/fesm/survey.analytics.tabulator.mjs +25 -12
  9. package/fesm/survey.analytics.tabulator.mjs.map +1 -1
  10. package/package.json +2 -2
  11. package/survey-analytics-tabulator.types/analytics-localization/finnish.d.ts +2 -0
  12. package/survey-analytics-tabulator.types/analytics-localization/swedish.d.ts +2 -0
  13. package/survey-analytics.types/analytics-localization/finnish.d.ts +2 -0
  14. package/survey-analytics.types/analytics-localization/swedish.d.ts +2 -0
  15. package/survey-analytics.types/pivot.d.ts +3 -1
  16. package/survey.analytics.core.css +1 -1
  17. package/survey.analytics.core.js +280 -91
  18. package/survey.analytics.core.js.map +1 -1
  19. package/survey.analytics.core.min.css +1 -1
  20. package/survey.analytics.core.min.js +1 -1
  21. package/survey.analytics.core.min.js.LICENSE.txt +1 -1
  22. package/survey.analytics.css +1 -1
  23. package/survey.analytics.datatables.css +1 -1
  24. package/survey.analytics.datatables.js +1 -1
  25. package/survey.analytics.datatables.min.css +1 -1
  26. package/survey.analytics.datatables.min.js.LICENSE.txt +1 -1
  27. package/survey.analytics.js +1 -1
  28. package/survey.analytics.min.css +1 -1
  29. package/survey.analytics.min.js.LICENSE.txt +1 -1
  30. package/survey.analytics.tabulator.css +1 -1
  31. package/survey.analytics.tabulator.js +1 -1
  32. package/survey.analytics.tabulator.min.css +1 -1
  33. 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.3
2
+ * surveyjs - SurveyJS Dashboard library v2.3.6
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, f as svgTemplate, e as createCommercialLicenseLink, t as toPrecision } from './shared.mjs';
8
- import { Event, QuestionCommentModel, settings, ItemValue, hasLicense, surveyLocalization, IsTouch } from 'survey-core';
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 || v.ctor.isPrototypeOf(constructor))[0];
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) {
@@ -212,10 +212,13 @@ class VisualizationManager {
212
212
  }
213
213
  /**
214
214
  * Returns all visualizer constructors for a specified question type.
215
- * @param questionType A question [type](https://surveyjs.io/form-library/documentation/api-reference/question#getType).
215
+ * @param visualizerType A question [type](https://surveyjs.io/form-library/documentation/api-reference/question#getType).
216
216
  */
217
- static getVisualizersByType(questionType) {
218
- let vDescrs = VisualizationManager.vizualizers[questionType];
217
+ static getVisualizersByType(visualizerType, fallbackVisualizerType) {
218
+ let vDescrs = VisualizationManager.vizualizers[visualizerType];
219
+ if (!!fallbackVisualizerType && (!vDescrs || vDescrs.length == 0)) {
220
+ vDescrs = VisualizationManager.vizualizers[fallbackVisualizerType];
221
+ }
219
222
  if (!vDescrs) {
220
223
  if (VisualizationManager.defaultVisualizer.suppressVisualizerStubRendering) {
221
224
  return [];
@@ -277,14 +280,14 @@ class VisualizerFactory {
277
280
  * @param options An object with any custom properties you need within the visualizer.
278
281
  */
279
282
  static createVisualizer(question, data, options) {
280
- let type;
281
- if (question.getType() === "text" && question.inputType) {
282
- type = question.inputType;
283
+ let type = question.getType();
284
+ let creators = [];
285
+ if (type === "text" && question.inputType) {
286
+ creators = VisualizationManager.getVisualizersByType(question.inputType, type);
283
287
  }
284
288
  else {
285
- type = question.getType();
289
+ creators = VisualizationManager.getVisualizersByType(type);
286
290
  }
287
- var creators = VisualizationManager.getVisualizersByType(type);
288
291
  var visualizers = creators.map((creator) => new creator(question, data, options));
289
292
  if (visualizers.length > 1) {
290
293
  const alternativesVisualizerConstructor = VisualizationManager.getAltVisualizerSelector();
@@ -466,6 +469,7 @@ class VisualizerBase {
466
469
  this._dataProvider = undefined;
467
470
  this._getDataCore = undefined;
468
471
  this.labelTruncateLength = 27;
472
+ this.haveCommercialLicense = false;
469
473
  this.renderResult = undefined;
470
474
  this.toolbarContainer = undefined;
471
475
  this.headerContainer = undefined;
@@ -473,6 +477,7 @@ class VisualizerBase {
473
477
  this.footerContainer = undefined;
474
478
  this._supportSelection = false;
475
479
  this._chartAdapter = undefined;
480
+ this._footerIsCollapsed = undefined;
476
481
  /**
477
482
  * An event that is raised after the visualizer's content is rendered.
478
483
  *
@@ -528,6 +533,10 @@ class VisualizerBase {
528
533
  this._calculationsCache = undefined;
529
534
  this.loadingData = false;
530
535
  this._settingState = false;
536
+ const f = hasLicense;
537
+ this.haveCommercialLicense = (!!f && f(4)) ||
538
+ VisualizerBase.haveCommercialLicense ||
539
+ (typeof options.haveCommercialLicense !== "undefined" ? options.haveCommercialLicense : false);
531
540
  this._getDataCore = (_a = this.questionOptions) === null || _a === void 0 ? void 0 : _a.getDataCore;
532
541
  this._dataProvider = options.dataProvider || new DataProvider(data);
533
542
  this._dataProvider.onDataChanged.add(() => this.onDataChanged());
@@ -602,9 +611,9 @@ class VisualizerBase {
602
611
  * 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
612
  */
604
613
  get supportSelection() {
605
- return ((this.options.allowSelection === undefined ||
614
+ return (this.options.allowSelection === undefined ||
606
615
  this.options.allowSelection) &&
607
- this._supportSelection);
616
+ this._supportSelection;
608
617
  }
609
618
  getSeriesValues() {
610
619
  return this.options.seriesValues || [];
@@ -850,26 +859,36 @@ class VisualizerBase {
850
859
  destroyFooter(container) {
851
860
  container.innerHTML = "";
852
861
  }
862
+ get isFooterCollapsed() {
863
+ if (this._footerIsCollapsed === undefined) {
864
+ this._footerIsCollapsed = VisualizerBase.otherCommentCollapsed;
865
+ }
866
+ return this._footerIsCollapsed;
867
+ }
868
+ set isFooterCollapsed(newVal) {
869
+ this._footerIsCollapsed = newVal;
870
+ }
853
871
  renderFooter(container) {
854
872
  container.innerHTML = "";
855
873
  if (this.hasFooter) {
856
874
  const footerTitleElement = DocumentHelper.createElement("h4", "sa-visualizer__footer-title", { innerText: localization.getString("otherCommentTitle") });
857
875
  container.appendChild(footerTitleElement);
858
876
  const footerContentElement = DocumentHelper.createElement("div", "sa-visualizer__footer-content");
859
- footerContentElement.style.display = VisualizerBase.otherCommentCollapsed
860
- ? "none"
861
- : "block";
877
+ footerContentElement.style.display = this.isFooterCollapsed ? "none" : "block";
878
+ const visibilityButtonText = localization.getString(this.isFooterCollapsed ? "showButton" : "hideButton");
862
879
  const visibilityButton = DocumentHelper.createButton(() => {
863
880
  if (footerContentElement.style.display === "none") {
864
881
  footerContentElement.style.display = "block";
865
882
  visibilityButton.innerText = localization.getString("hideButton");
883
+ this._footerIsCollapsed = false;
866
884
  }
867
885
  else {
868
886
  footerContentElement.style.display = "none";
869
- visibilityButton.innerText = localization.getString(VisualizerBase.otherCommentCollapsed ? "showButton" : "hideButton");
887
+ visibilityButton.innerText = localization.getString("showButton");
888
+ this._footerIsCollapsed = true;
870
889
  }
871
890
  this.footerVisualizer.invokeOnUpdate();
872
- }, localization.getString("showButton") /*, "sa-toolbar__button--right"*/);
891
+ }, visibilityButtonText /*, "sa-toolbar__button--right"*/);
873
892
  container.appendChild(visibilityButton);
874
893
  container.appendChild(footerContentElement);
875
894
  this.footerVisualizer.render(footerContentElement);
@@ -1067,6 +1086,7 @@ class VisualizerBase {
1067
1086
  *
1068
1087
  * > This method is overriden in classes descendant from `VisualizerBase`.
1069
1088
  * @see setState
1089
+ * @see resetState
1070
1090
  * @see onStateChanged
1071
1091
  */
1072
1092
  getState() {
@@ -1079,10 +1099,21 @@ class VisualizerBase {
1079
1099
  *
1080
1100
  * > This method is overriden in classes descendant from `VisualizerBase`.
1081
1101
  * @see getState
1102
+ * @see resetState
1082
1103
  * @see onStateChanged
1083
1104
  */
1084
1105
  setState(state) {
1085
1106
  }
1107
+ /**
1108
+ * Resets the visualizer's state.
1109
+ *
1110
+ * > This method is overriden in classes descendant from `VisualizerBase`.
1111
+ * @see getState
1112
+ * @see setState
1113
+ * @see onStateChanged
1114
+ */
1115
+ resetState() {
1116
+ }
1086
1117
  /**
1087
1118
  * Gets or sets the current locale.
1088
1119
  *
@@ -1113,6 +1144,7 @@ class VisualizerBase {
1113
1144
  }
1114
1145
  }
1115
1146
  }
1147
+ VisualizerBase.haveCommercialLicense = false;
1116
1148
  VisualizerBase.suppressVisualizerStubRendering = false;
1117
1149
  VisualizerBase.chartAdapterType = undefined;
1118
1150
  // public static otherCommentQuestionType = "comment"; // TODO: make it configureable - allow choose what kind of question/visualizer will be used for comments/others
@@ -1306,11 +1338,9 @@ class SelectBase extends VisualizerBase {
1306
1338
  this.emptyAnswersBtn = undefined;
1307
1339
  this.transposeDataBtn = undefined;
1308
1340
  this.topNSelector = undefined;
1309
- this._showPercentages = false;
1310
1341
  this._showOnlyPercentages = false;
1311
- this._percentagePrecision = 0;
1342
+ this._percentagePrecision = 2;
1312
1343
  this._answersOrder = "default";
1313
- this._supportSelection = true;
1314
1344
  this._hideEmptyAnswers = false;
1315
1345
  this._topN = -1;
1316
1346
  this.topNValues = [].concat(SelectBase.topNValuesDefaults);
@@ -1330,7 +1360,7 @@ class SelectBase extends VisualizerBase {
1330
1360
  this.dataProvider.raiseDataChanged();
1331
1361
  };
1332
1362
  }
1333
- this._showPercentages = this.options.showPercentages === true;
1363
+ this._supportSelection = true;
1334
1364
  this._showOnlyPercentages = this.options.showOnlyPercentages === true;
1335
1365
  if (this.options.percentagePrecision) {
1336
1366
  this._percentagePrecision = this.options.percentagePrecision;
@@ -1573,11 +1603,22 @@ class SelectBase extends VisualizerBase {
1573
1603
  this.refreshContent();
1574
1604
  this.stateChanged("showOnlyPercentages", val);
1575
1605
  }
1606
+ getShowPercentagesDefault() {
1607
+ if (this.options.showPercentages === undefined) {
1608
+ return ["pie", "doughnut"].indexOf(this.chartType) !== -1;
1609
+ }
1610
+ return this.options.showPercentages === true;
1611
+ }
1576
1612
  /**
1577
1613
  * Gets and sets whether chart should show values and percentages.
1578
1614
  */
1579
1615
  get showPercentages() {
1580
- return this._showPercentages;
1616
+ if (this._showPercentages !== undefined) {
1617
+ return this._showPercentages;
1618
+ }
1619
+ else {
1620
+ return this.getShowPercentagesDefault();
1621
+ }
1581
1622
  }
1582
1623
  set showPercentages(val) {
1583
1624
  this._showPercentages = val;
@@ -1709,12 +1750,10 @@ class SelectBase extends VisualizerBase {
1709
1750
  var percentages = [];
1710
1751
  var percentagePrecision = this._percentagePrecision;
1711
1752
  if (data.length < 2) {
1712
- data.forEach((res, index) => {
1713
- var sum = res.reduce((sum, val) => sum + val, 0);
1714
- percentages[index] = res.map((val) => {
1715
- var value = percentagePrecision ? +(val / sum).toFixed(percentagePrecision) : Math.round((val / sum) * 10000);
1716
- return sum && (value / 100);
1717
- });
1753
+ var sum = data[0].reduce((sum, val) => sum + val, 0);
1754
+ percentages[0] = data[0].map((val) => {
1755
+ var value = percentagePrecision ? +(val / sum * 100).toFixed(percentagePrecision) : Math.round(val / sum * 100);
1756
+ return sum && value;
1718
1757
  });
1719
1758
  }
1720
1759
  else {
@@ -1726,7 +1765,7 @@ class SelectBase extends VisualizerBase {
1726
1765
  for (var j = 0; j < data.length; j++) {
1727
1766
  if (!Array.isArray(percentages[j]))
1728
1767
  percentages[j] = [];
1729
- var value = percentagePrecision ? +((data[j][i] / sum) * 100).toFixed(percentagePrecision) : Math.round((data[j][i] / sum) * 100);
1768
+ var value = percentagePrecision ? +(data[j][i] / sum * 100).toFixed(percentagePrecision) : Math.round(data[j][i] / sum * 100);
1730
1769
  percentages[j][i] = sum && value;
1731
1770
  }
1732
1771
  }
@@ -1758,14 +1797,13 @@ class SelectBase extends VisualizerBase {
1758
1797
  let datasets = (yield this.getCalculatedValues());
1759
1798
  let labels = this.getLabels();
1760
1799
  let colors = this.getColors();
1761
- var texts = this.showPercentages ? this.getPercentages(datasets) : datasets;
1762
1800
  if (this.transposeData) {
1763
1801
  datasets = this.transpose(datasets);
1764
- texts = this.transpose(texts);
1765
1802
  const temp = seriesLabels;
1766
1803
  seriesLabels = labels;
1767
1804
  labels = temp;
1768
1805
  }
1806
+ var texts = this.showPercentages ? this.getPercentages(datasets) : datasets;
1769
1807
  if (this.answersOrder == "asc" || this.answersOrder == "desc") {
1770
1808
  var zippedArray = this.showPercentages
1771
1809
  ? DataHelper.zipArrays(labels, colors, texts[0])
@@ -1847,6 +1885,18 @@ class SelectBase extends VisualizerBase {
1847
1885
  const selectedItem = ItemValue.getItemByValue(this.question.visibleChoices, state.filter);
1848
1886
  this.setSelection(selectedItem !== null && selectedItem !== void 0 ? selectedItem : undefined);
1849
1887
  }
1888
+ resetState() {
1889
+ super.resetState();
1890
+ // this._showPercentages = this.options.showPercentages === true;
1891
+ // this._showOnlyPercentages = this.options.showOnlyPercentages === true;
1892
+ // this._showMissingAnswers = this.isSupportMissingAnswers() && this.options.showMissingAnswers === true;
1893
+ // this._transposeData = this.options.transposeData || false;
1894
+ this._hideEmptyAnswers = this.options.hideEmptyAnswers === true;
1895
+ this._answersOrder = this.options.answersOrder || "default";
1896
+ this._topN = -1;
1897
+ this.chartType = this.chartTypes[0];
1898
+ this.setSelection(undefined);
1899
+ }
1850
1900
  }
1851
1901
  SelectBase.topNValuesDefaults = [-1, 5, 10, 20];
1852
1902
  SelectBase._stateProperties = ["chartType", "answersOrder", "hideEmptyAnswers", "topN"];
@@ -1855,6 +1905,7 @@ VisualizationManager.registerVisualizer("radiogroup", SelectBase);
1855
1905
  VisualizationManager.registerVisualizer("dropdown", SelectBase);
1856
1906
  VisualizationManager.registerVisualizer("imagepicker", SelectBase);
1857
1907
  VisualizationManager.registerVisualizer("tagbox", SelectBase);
1908
+ VisualizationManager.registerVisualizer("rating", SelectBase, 100);
1858
1909
 
1859
1910
  class BooleanModel extends SelectBase {
1860
1911
  constructor(question, data, options, name) {
@@ -2073,7 +2124,7 @@ HistogramModel.IntervalsCount = 10;
2073
2124
  HistogramModel.UseIntervalsFrom = 10;
2074
2125
  VisualizationManager.registerVisualizer("date", HistogramModel);
2075
2126
  VisualizationManager.registerVisualizer("number", HistogramModel, 100);
2076
- VisualizationManager.registerVisualizer("rating", HistogramModel, 100);
2127
+ VisualizationManager.registerVisualizer("rating", HistogramModel, 300);
2077
2128
 
2078
2129
  class Matrix extends SelectBase {
2079
2130
  constructor(question, data, options, name) {
@@ -2158,9 +2209,10 @@ class Matrix extends SelectBase {
2158
2209
  VisualizationManager.registerVisualizer("matrix", Matrix);
2159
2210
 
2160
2211
  class PivotModel extends SelectBase {
2161
- constructor(questions, data, options, name) {
2212
+ constructor(questions, data, options, name, isRoot = true) {
2162
2213
  super(null, data, options, name || "pivot");
2163
2214
  this.questions = questions;
2215
+ this.isRoot = isRoot;
2164
2216
  this.valueType = "enum";
2165
2217
  this._cachedValues = undefined;
2166
2218
  this._continuousData = undefined;
@@ -2556,6 +2608,14 @@ class PivotModel extends SelectBase {
2556
2608
  isSupportSoftUpdateContent() {
2557
2609
  return false;
2558
2610
  }
2611
+ renderToolbar(container) {
2612
+ if (!this.haveCommercialLicense && this.isRoot) {
2613
+ const banner = createCommercialLicenseLink();
2614
+ container.appendChild(banner);
2615
+ }
2616
+ container.className += " sa-pivot__header";
2617
+ super.renderToolbar(container);
2618
+ }
2559
2619
  }
2560
2620
  PivotModel.IntervalsCount = 10;
2561
2621
  PivotModel.UseIntervalsFrom = 10;
@@ -2657,12 +2717,15 @@ class AlternativeVisualizersWrapper extends VisualizerBase {
2657
2717
  setVisualizer(type, quiet = false) {
2658
2718
  const visualizerCandidate = this.visualizers.filter((v) => v.type === type)[0];
2659
2719
  if (!!visualizerCandidate && visualizerCandidate !== this.visualizer) {
2720
+ let isFooterCollapsed;
2660
2721
  if (!!this.visualizer) {
2722
+ isFooterCollapsed = this.visualizer.isFooterCollapsed;
2661
2723
  this.visualizer.onStateChanged.remove(this.onVisualizerStateChangedCallback);
2662
2724
  this.visualizer.onAfterRender.remove(this.onAfterVisualizerRenderCallback);
2663
2725
  this.visualizer.destroy();
2664
2726
  }
2665
2727
  this.visualizer = visualizerCandidate;
2728
+ this.visualizer.isFooterCollapsed = isFooterCollapsed;
2666
2729
  this.refresh();
2667
2730
  this.visualizer.onAfterRender.add(this.onAfterVisualizerRenderCallback);
2668
2731
  this.visualizer.onStateChanged.add(this.onVisualizerStateChangedCallback);
@@ -2708,6 +2771,7 @@ class AlternativeVisualizersWrapper extends VisualizerBase {
2708
2771
  *
2709
2772
  * > This method is overriden in descendant classes.
2710
2773
  * @see setState
2774
+ * @see resetState
2711
2775
  */
2712
2776
  getState() {
2713
2777
  const currentVisualizerState = this.visualizer.getState();
@@ -2722,8 +2786,8 @@ class AlternativeVisualizersWrapper extends VisualizerBase {
2722
2786
  /**
2723
2787
  * Sets the visualizer's state.
2724
2788
  *
2725
- * > This method is overriden in descendant classes.
2726
2789
  * @see getState
2790
+ * @see resetState
2727
2791
  */
2728
2792
  setState(state) {
2729
2793
  if (!!state.visualizer) {
@@ -2733,6 +2797,17 @@ class AlternativeVisualizersWrapper extends VisualizerBase {
2733
2797
  this.visualizer.setState(state.state);
2734
2798
  }
2735
2799
  }
2800
+ /**
2801
+ * Resets the visualizer's state.
2802
+ *
2803
+ * @see getState
2804
+ * @see setState
2805
+ */
2806
+ resetState() {
2807
+ super.resetState();
2808
+ this.visualizers.forEach(visualizer => visualizer.resetState());
2809
+ this.setVisualizer(this.visualizers[0].type, true);
2810
+ }
2736
2811
  getValues() {
2737
2812
  return this.visualizer.getValues();
2738
2813
  }
@@ -9723,12 +9798,12 @@ if (!!document) {
9723
9798
  * [View Demo](https://surveyjs.io/dashboard/examples/interactive-survey-data-dashboard/ (linkStyle))
9724
9799
  */
9725
9800
  class VisualizationPanel extends VisualizerBase {
9726
- constructor(questions, data, options = {}, _elements = undefined) {
9801
+ constructor(questions, data, options = {}, _elements = undefined, isRoot = true) {
9727
9802
  super(null, data, options, "panel");
9728
9803
  this.questions = questions;
9729
9804
  this._elements = _elements;
9805
+ this.isRoot = isRoot;
9730
9806
  this.visualizers = [];
9731
- this.haveCommercialLicense = false;
9732
9807
  this.renderedQuestionsCount = 0;
9733
9808
  this.onAfterRenderQuestionCallback = (sender, options) => {
9734
9809
  this.renderedQuestionsCount++;
@@ -9807,12 +9882,6 @@ class VisualizationPanel extends VisualizerBase {
9807
9882
  */
9808
9883
  this.onElementMoved = new Event();
9809
9884
  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
9885
  this._layoutEngine =
9817
9886
  options.layoutEngine ||
9818
9887
  new MuuriLayoutEngine(this.allowDynamicLayout, "." + questionLayoutedElementClassName, this.allowDragDrop);
@@ -9825,53 +9894,57 @@ class VisualizationPanel extends VisualizerBase {
9825
9894
  this._elements = this.buildElements(questions);
9826
9895
  }
9827
9896
  this.buildVisualizers(questions);
9828
- if (!this.haveCommercialLicense) {
9897
+ if (!this.haveCommercialLicense && this.isRoot) {
9829
9898
  this.registerToolbarItem("commercialLicense", () => {
9830
9899
  return createCommercialLicenseLink();
9831
9900
  });
9832
9901
  }
9833
- this.registerToolbarItem("resetFilter", () => {
9834
- return DocumentHelper.createButton(() => {
9835
- this.visualizers.forEach((visualizer) => {
9836
- if (visualizer instanceof SelectBase || visualizer instanceof AlternativeVisualizersWrapper) {
9837
- visualizer.setSelection(undefined);
9838
- }
9839
- });
9840
- }, localization.getString("resetFilter"));
9841
- }, 900);
9902
+ this._supportSelection = true;
9903
+ if (this.supportSelection !== false) {
9904
+ this.registerToolbarItem("resetFilter", () => {
9905
+ return DocumentHelper.createButton(() => {
9906
+ this.visualizers.forEach((visualizer) => {
9907
+ if (visualizer instanceof SelectBase || visualizer instanceof AlternativeVisualizersWrapper) {
9908
+ visualizer.setSelection(undefined);
9909
+ }
9910
+ });
9911
+ }, localization.getString("resetFilter"));
9912
+ }, 900);
9913
+ }
9842
9914
  this.registerToolbarItem("addElement", (toolbar) => {
9843
9915
  if (this.allowHideQuestions) {
9844
9916
  let addElementSelector = undefined;
9845
9917
  const addElementSelectorUpdater = (panel, options) => {
9846
9918
  const hiddenElements = this.hiddenElements;
9919
+ const selectWrapper = DocumentHelper.createSelector([
9920
+ {
9921
+ name: undefined,
9922
+ displayName: localization.getString("addElement"),
9923
+ },
9924
+ ]
9925
+ .concat(hiddenElements)
9926
+ .map((element) => {
9927
+ return {
9928
+ value: element.name,
9929
+ text: element.displayName,
9930
+ };
9931
+ }), (option) => false, (e) => {
9932
+ this.showElement(e.target.value);
9933
+ });
9934
+ if (addElementSelector) {
9935
+ toolbar.replaceChild(selectWrapper, addElementSelector);
9936
+ }
9937
+ addElementSelector = selectWrapper;
9847
9938
  if (hiddenElements.length > 0) {
9848
- const selectWrapper = DocumentHelper.createSelector([
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;
9939
+ addElementSelector.style.display = undefined;
9867
9940
  }
9868
- else {
9869
- addElementSelector && toolbar.removeChild(addElementSelector);
9870
- addElementSelector = undefined;
9941
+ else if (addElementSelector) {
9942
+ addElementSelector.style.display = "none";
9871
9943
  }
9872
9944
  };
9873
9945
  addElementSelectorUpdater();
9874
9946
  this.onVisibleElementsChanged.add(addElementSelectorUpdater);
9947
+ return addElementSelector;
9875
9948
  }
9876
9949
  return undefined;
9877
9950
  });
@@ -9998,7 +10071,7 @@ class VisualizationPanel extends VisualizerBase {
9998
10071
  let visualizerData = this.surveyData;
9999
10072
  let visualizer;
10000
10073
  if (Array.isArray(question)) {
10001
- visualizer = new (VisualizationManager.getPivotVisualizerConstructor())(question, visualizerData, visualizerOptions);
10074
+ visualizer = new (VisualizationManager.getPivotVisualizerConstructor())(question, visualizerData, visualizerOptions, undefined, false);
10002
10075
  }
10003
10076
  else {
10004
10077
  visualizer = this.createVisualizer(question, visualizerOptions, visualizerData);
@@ -10334,6 +10407,18 @@ class VisualizationPanel extends VisualizerBase {
10334
10407
  }
10335
10408
  this.refresh();
10336
10409
  }
10410
+ resetState() {
10411
+ this._settingState = true;
10412
+ super.resetState();
10413
+ try {
10414
+ this.visualizers.forEach(visualizer => visualizer.resetState());
10415
+ this.locale = surveyLocalization.defaultLocale;
10416
+ }
10417
+ finally {
10418
+ this._settingState = false;
10419
+ }
10420
+ this.refresh();
10421
+ }
10337
10422
  get permissions() {
10338
10423
  return this._elements.map((element) => {
10339
10424
  return {
@@ -10363,7 +10448,6 @@ class VisualizationPanel extends VisualizerBase {
10363
10448
  this.destroyVisualizers();
10364
10449
  }
10365
10450
  }
10366
- VisualizationPanel.haveCommercialLicense = false;
10367
10451
 
10368
10452
  class VisualizationPanelDynamic extends VisualizerBase {
10369
10453
  constructor(question, data, options = {}, name) {
@@ -10376,7 +10460,7 @@ class VisualizationPanelDynamic extends VisualizerBase {
10376
10460
  var options = Object.assign({}, options);
10377
10461
  options.allowDynamicLayout = false;
10378
10462
  options.dataProvider = undefined;
10379
- this._panelVisualizer = new VisualizationPanel(this.getQuestions(), [], options);
10463
+ this._panelVisualizer = new VisualizationPanel(this.getQuestions(), [], options, undefined, false);
10380
10464
  this._panelVisualizer.onAfterRender.add(this.onAfterRenderPanelCallback);
10381
10465
  this.updateData(data);
10382
10466
  }
@@ -10471,7 +10555,7 @@ class VisualizationMatrixDropdown extends VisualizerBase {
10471
10555
  }
10472
10556
  else {
10473
10557
  const innerQuestions = this.getQuestions();
10474
- this._matrixDropdownVisualizer = new VisualizationPanel(innerQuestions, [], this._childOptions);
10558
+ this._matrixDropdownVisualizer = new VisualizationPanel(innerQuestions, [], this._childOptions, undefined, false);
10475
10559
  }
10476
10560
  this._matrixDropdownVisualizer.onAfterRender.add(this.onPanelAfterRenderCallback);
10477
10561
  this.updateData(data);
@@ -12387,9 +12471,34 @@ class StatisticsTable extends SelectBase {
12387
12471
  super.destroy();
12388
12472
  }
12389
12473
  }
12474
+ class StatisticsTableBoolean extends BooleanModel {
12475
+ constructor(question, data, options, name) {
12476
+ super(question, data, options, name || "options");
12477
+ this._statisticsTableAdapter = new StatisticsTableAdapter(this);
12478
+ this.showPercentages = true;
12479
+ }
12480
+ destroyContent(container) {
12481
+ this._statisticsTableAdapter.destroy(container);
12482
+ super.destroyContent(container);
12483
+ }
12484
+ renderContentAsync(container) {
12485
+ return __awaiter(this, void 0, void 0, function* () {
12486
+ const tableNode = DocumentHelper.createElement("div");
12487
+ yield this._statisticsTableAdapter.create(tableNode);
12488
+ container.innerHTML = "";
12489
+ container.appendChild(tableNode);
12490
+ return container;
12491
+ });
12492
+ }
12493
+ destroy() {
12494
+ this._statisticsTableAdapter.destroy(this.contentContainer);
12495
+ super.destroy();
12496
+ }
12497
+ }
12390
12498
  VisualizationManager.registerVisualizer("radiogroup", StatisticsTable);
12391
12499
  VisualizationManager.registerVisualizer("dropdown", StatisticsTable);
12392
12500
  VisualizationManager.registerVisualizer("checkbox", StatisticsTable);
12501
+ VisualizationManager.registerVisualizer("boolean", StatisticsTableBoolean);
12393
12502
 
12394
12503
  class NpsVisualizerWidget {
12395
12504
  constructor(_model, _data) {
@@ -12518,5 +12627,5 @@ NpsVisualizer.DetractorScore = 6;
12518
12627
  NpsVisualizer.PromoterScore = 9;
12519
12628
  // VisualizationManager.registerVisualizer("rating", NpsVisualizer);
12520
12629
 
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, NpsVisualizerWidget as l, NpsAdapter as m, NpsVisualizer as n, PivotModel as o, defaultStatisticsCalculator as p, textHelper as t };
12630
+ 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
12631
  //# sourceMappingURL=shared2.mjs.map