survey-analytics 2.3.7 → 2.3.8

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/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "pre-push-check": "npm run lint && npm run test",
19
19
  "pwinst": "playwright install chromium"
20
20
  },
21
- "version": "2.3.7",
21
+ "version": "2.3.8",
22
22
  "name": "survey-analytics",
23
23
  "description": "SurveyJS analytics Library.",
24
24
  "main": "survey.analytics.js",
@@ -59,7 +59,7 @@
59
59
  "concurrently": "^5.3.0",
60
60
  "css-loader": "^7.1.2",
61
61
  "eslint": "^7.32.0",
62
- "eslint-plugin-i18n": "^2.4.0",
62
+ "eslint-plugin-surveyjs": "git+https://github.com/surveyjs/eslint-surveyjs.git",
63
63
  "html-loader": "^5.0.0",
64
64
  "http-server": "^14.1.1",
65
65
  "husky": "^8.0.3",
@@ -91,7 +91,7 @@
91
91
  "peerDependencies": {
92
92
  "@types/plotly.js-dist-min": "^2.3.0",
93
93
  "@types/tabulator-tables": "^6.2.3",
94
- "survey-core": "2.3.7"
94
+ "survey-core": "2.3.8"
95
95
  },
96
96
  "husky": {
97
97
  "hooks": {
@@ -236,6 +236,12 @@ export interface IVisualizationPanelOptions {
236
236
  * Default value: `true`
237
237
  */
238
238
  stripHtmlFromTitles?: boolean;
239
+ /**
240
+ * Allows users to switch between different visualizer types.
241
+ *
242
+ * Default value: `true`
243
+ */
244
+ allowChangeVisualizerType?: boolean;
239
245
  }
240
246
  /**
241
247
  * An object that visualizes survey results and allows users to analyze them.
@@ -218,6 +218,11 @@ export declare class VisualizerBase implements IDataInfo {
218
218
  * @see registerToolbarItem
219
219
  */
220
220
  unregisterToolbarItem(name: string): (toolbar?: HTMLDivElement) => HTMLElement;
221
+ /**
222
+ * Returns the visualizer's title.
223
+ */
224
+ get title(): string;
225
+ protected getTitle(question: Question): string;
221
226
  /**
222
227
  * Returns the visualizer's type.
223
228
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v2.3.7
2
+ * surveyjs - SurveyJS Dashboard library v2.3.8
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
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v2.3.7
2
+ * surveyjs - SurveyJS Dashboard library v2.3.8
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
  */
@@ -6885,14 +6885,16 @@ var AlternativeVisualizersWrapper = /** @class */ (function (_super) {
6885
6885
  _this.visualizersWithSelection.push(visualizer);
6886
6886
  }
6887
6887
  });
6888
- _this.registerToolbarItem("changeVisualizer", function () {
6889
- return _this.visualizerSelector = _utils_index__WEBPACK_IMPORTED_MODULE_3__.DocumentHelper.createSelector(_this.visualizers.map(function (visualizer) {
6890
- return {
6891
- value: visualizer.type,
6892
- text: _localizationManager__WEBPACK_IMPORTED_MODULE_2__.localization.getString("visualizer_" + visualizer.type),
6893
- };
6894
- }), function (option) { return _this.visualizer.type === option.value; }, function (e) { return _this.setVisualizer(e.target.value); });
6895
- }, 0);
6888
+ if (_this.options.allowChangeVisualizerType !== false) {
6889
+ _this.registerToolbarItem("changeVisualizer", function () {
6890
+ return _this.visualizerSelector = _utils_index__WEBPACK_IMPORTED_MODULE_3__.DocumentHelper.createSelector(_this.visualizers.map(function (visualizer) {
6891
+ return {
6892
+ value: visualizer.type,
6893
+ text: _localizationManager__WEBPACK_IMPORTED_MODULE_2__.localization.getString("visualizer_" + visualizer.type),
6894
+ };
6895
+ }), function (option) { return _this.visualizer.type === option.value; }, function (e) { return _this.setVisualizer(e.target.value); });
6896
+ }, 0);
6897
+ }
6896
6898
  _this.visualizer = visualizers[0];
6897
6899
  _this.visualizer.onAfterRender.add(_this.onAfterVisualizerRenderCallback);
6898
6900
  _this.visualizer.onStateChanged.add(_this.onVisualizerStateChangedCallback);
@@ -10944,19 +10946,21 @@ var NumberModel = /** @class */ (function (_super) {
10944
10946
  _this.chartTypes = _this._chartAdapter.getChartTypes();
10945
10947
  _this.chartType = _this.chartTypes[0];
10946
10948
  }
10947
- _this.registerToolbarItem("changeChartType", function () {
10948
- if (_this.chartTypes.length > 1) {
10949
- return _utils_index__WEBPACK_IMPORTED_MODULE_3__.DocumentHelper.createSelector(_this.chartTypes.map(function (chartType) {
10950
- return {
10951
- value: chartType,
10952
- text: _localizationManager__WEBPACK_IMPORTED_MODULE_2__.localization.getString("chartType_" + chartType),
10953
- };
10954
- }), function (option) { return _this.chartType === option.value; }, function (e) {
10955
- _this.setChartType(e.target.value);
10956
- });
10957
- }
10958
- return null;
10959
- });
10949
+ if (_this.options.allowChangeVisualizerType !== false) {
10950
+ _this.registerToolbarItem("changeChartType", function () {
10951
+ if (_this.chartTypes.length > 1) {
10952
+ return _utils_index__WEBPACK_IMPORTED_MODULE_3__.DocumentHelper.createSelector(_this.chartTypes.map(function (chartType) {
10953
+ return {
10954
+ value: chartType,
10955
+ text: _localizationManager__WEBPACK_IMPORTED_MODULE_2__.localization.getString("chartType_" + chartType),
10956
+ };
10957
+ }), function (option) { return _this.chartType === option.value; }, function (e) {
10958
+ _this.setChartType(e.target.value);
10959
+ });
10960
+ }
10961
+ return null;
10962
+ });
10963
+ }
10960
10964
  return _this;
10961
10965
  }
10962
10966
  NumberModel.prototype.onDataChanged = function () {
@@ -11723,19 +11727,21 @@ var SelectBase = /** @class */ (function (_super) {
11723
11727
  _this._chartType = _this.options.defaultChartType;
11724
11728
  }
11725
11729
  }
11726
- _this.registerToolbarItem("changeChartType", function () {
11727
- if (_this.chartTypes.length > 1) {
11728
- return _utils_index__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createSelector(_this.chartTypes.map(function (chartType) {
11729
- return {
11730
- value: chartType,
11731
- text: _localizationManager__WEBPACK_IMPORTED_MODULE_3__.localization.getString("chartType_" + chartType),
11732
- };
11733
- }), function (option) { return _this.chartType === option.value; }, function (e) {
11734
- _this.setChartType(e.target.value);
11735
- });
11736
- }
11737
- return null;
11738
- });
11730
+ if (_this.options.allowChangeVisualizerType !== false) {
11731
+ _this.registerToolbarItem("changeChartType", function () {
11732
+ if (_this.chartTypes.length > 1) {
11733
+ return _utils_index__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createSelector(_this.chartTypes.map(function (chartType) {
11734
+ return {
11735
+ value: chartType,
11736
+ text: _localizationManager__WEBPACK_IMPORTED_MODULE_3__.localization.getString("chartType_" + chartType),
11737
+ };
11738
+ }), function (option) { return _this.chartType === option.value; }, function (e) {
11739
+ _this.setChartType(e.target.value);
11740
+ });
11741
+ }
11742
+ return null;
11743
+ });
11744
+ }
11739
11745
  _this.registerToolbarItem("changeAnswersOrder", function () {
11740
11746
  if (_this.isSupportAnswersOrder()) {
11741
11747
  _this.choicesOrderSelector = _utils_index__WEBPACK_IMPORTED_MODULE_4__.DocumentHelper.createSelector([
@@ -14050,7 +14056,7 @@ var VisualizationPanel = /** @class */ (function (_super) {
14050
14056
  question = Array.isArray(question) ? question[0] : question;
14051
14057
  var element = _this.getElement(question.name);
14052
14058
  if (!!element) {
14053
- element.displayName = _this.processText(question.title);
14059
+ element.displayName = _this.getTitle(question);
14054
14060
  }
14055
14061
  });
14056
14062
  this.visualizers.forEach(function (v) {
@@ -14118,7 +14124,7 @@ var VisualizationPanel = /** @class */ (function (_super) {
14118
14124
  question = Array.isArray(question) ? question[0] : question;
14119
14125
  return {
14120
14126
  name: question.name,
14121
- displayName: _this.processText(question.title),
14127
+ displayName: _this.getTitle(question),
14122
14128
  isVisible: true,
14123
14129
  isPublic: true,
14124
14130
  };
@@ -14851,6 +14857,22 @@ var VisualizerBase = /** @class */ (function () {
14851
14857
  }
14852
14858
  return undefined;
14853
14859
  };
14860
+ Object.defineProperty(VisualizerBase.prototype, "title", {
14861
+ /**
14862
+ * Returns the visualizer's title.
14863
+ */
14864
+ get: function () {
14865
+ return this.getTitle(this.question);
14866
+ },
14867
+ enumerable: false,
14868
+ configurable: true
14869
+ });
14870
+ VisualizerBase.prototype.getTitle = function (question) {
14871
+ var _a;
14872
+ if (question === undefined)
14873
+ return "";
14874
+ return this.processText(((_a = question.locTitle) === null || _a === void 0 ? void 0 : _a.renderedHtml) ? question.locTitle.renderedHtml : question.title);
14875
+ };
14854
14876
  Object.defineProperty(VisualizerBase.prototype, "type", {
14855
14877
  /**
14856
14878
  * Returns the visualizer's type.