survey-analytics 2.3.7 → 2.3.9

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 (37) hide show
  1. package/fesm/shared.mjs +1 -1
  2. package/fesm/shared2.mjs +61 -38
  3. package/fesm/shared2.mjs.map +1 -1
  4. package/fesm/survey.analytics.core.mjs +1 -1
  5. package/fesm/survey.analytics.mjs +1 -1
  6. package/fesm/survey.analytics.mongo.mjs +221 -0
  7. package/fesm/survey.analytics.mongo.mjs.map +1 -0
  8. package/fesm/survey.analytics.tabulator.mjs +37 -2
  9. package/fesm/survey.analytics.tabulator.mjs.map +1 -1
  10. package/package.json +12 -3
  11. package/survey-analytics-tabulator.types/entries/tabulator.d.ts +2 -0
  12. package/survey-analytics-tabulator.types/tables/columnbuilder.d.ts +3 -0
  13. package/survey-analytics.types/visualizationComposite.d.ts +1 -1
  14. package/survey-analytics.types/visualizationPanel.d.ts +6 -0
  15. package/survey-analytics.types/visualizerBase.d.ts +5 -0
  16. package/survey.analytics.core.css +1 -1
  17. package/survey.analytics.core.js +66 -39
  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.js +66 -39
  24. package/survey.analytics.js.map +1 -1
  25. package/survey.analytics.min.css +1 -1
  26. package/survey.analytics.min.js +1 -1
  27. package/survey.analytics.min.js.LICENSE.txt +1 -1
  28. package/survey.analytics.mongo.js +359 -0
  29. package/survey.analytics.mongo.js.map +1 -0
  30. package/survey.analytics.mongo.min.js +2 -0
  31. package/survey.analytics.mongo.min.js.LICENSE.txt +5 -0
  32. package/survey.analytics.tabulator.css +1 -1
  33. package/survey.analytics.tabulator.js +80 -5
  34. package/survey.analytics.tabulator.js.map +1 -1
  35. package/survey.analytics.tabulator.min.css +1 -1
  36. package/survey.analytics.tabulator.min.js +1 -1
  37. package/survey.analytics.tabulator.min.js.LICENSE.txt +1 -1
package/package.json CHANGED
@@ -14,11 +14,12 @@
14
14
  "build:types:core": "tsc --p tsconfig.summary.core.json && echo \"export * from './survey-analytics.types/entries/summary.core';\" >> build/survey.analytics.core.d.ts",
15
15
  "build:types:summary": "tsc --p tsconfig.summary.json && echo \"export * from './survey-analytics.types/entries/summary';\" >> build/survey.analytics.d.ts",
16
16
  "build:types:tabulator": "tsc --p tsconfig.tabulator.json && echo \"export * from './survey-analytics-tabulator.types/entries/tabulator';\" >> build/survey.analytics.tabulator.d.ts",
17
+ "build:types:mongo": "tsc --p tsconfig.types.mongo.json && echo \"export * from './survey-analytics.types/entries/mongo';\" >> build/survey.analytics.mongo.d.ts",
17
18
  "lint": "eslint ./src --quiet",
18
19
  "pre-push-check": "npm run lint && npm run test",
19
20
  "pwinst": "playwright install chromium"
20
21
  },
21
- "version": "2.3.7",
22
+ "version": "2.3.9",
22
23
  "name": "survey-analytics",
23
24
  "description": "SurveyJS analytics Library.",
24
25
  "main": "survey.analytics.js",
@@ -41,6 +42,7 @@
41
42
  "homepage": "https://surveyjs.io/",
42
43
  "license": "SEE LICENSE IN LICENSE",
43
44
  "dependencies": {
45
+ "mongodb": "^6.20.0",
44
46
  "muuri": "^0.8.0",
45
47
  "plotly.js-dist-min": "^2.28.0",
46
48
  "tabulator-tables": "^6.2.5"
@@ -59,7 +61,7 @@
59
61
  "concurrently": "^5.3.0",
60
62
  "css-loader": "^7.1.2",
61
63
  "eslint": "^7.32.0",
62
- "eslint-plugin-i18n": "^2.4.0",
64
+ "eslint-plugin-surveyjs": "git+https://github.com/surveyjs/eslint-surveyjs.git",
63
65
  "html-loader": "^5.0.0",
64
66
  "http-server": "^14.1.1",
65
67
  "husky": "^8.0.3",
@@ -68,6 +70,7 @@
68
70
  "jest-environment-jsdom": "^29.7.0",
69
71
  "jest-junit": "^16.0.0",
70
72
  "mini-css-extract-plugin": "^2.9.0",
73
+ "mongodb-memory-server": "^10.2.1",
71
74
  "node-uuid": "1.4.7",
72
75
  "playwright": "1.53.1",
73
76
  "puppeteer": "22.13.1",
@@ -89,9 +92,10 @@
89
92
  "webpack-merge": "^5.8.0"
90
93
  },
91
94
  "peerDependencies": {
95
+ "@types/mongodb": "^4.0.6",
92
96
  "@types/plotly.js-dist-min": "^2.3.0",
93
97
  "@types/tabulator-tables": "^6.2.3",
94
- "survey-core": "2.3.7"
98
+ "survey-core": "2.3.9"
95
99
  },
96
100
  "husky": {
97
101
  "hooks": {
@@ -109,6 +113,11 @@
109
113
  "import": "./fesm/survey.analytics.core.mjs",
110
114
  "require": "./survey.analytics.core.js"
111
115
  },
116
+ "./survey.analytics.mongo": {
117
+ "types": "./survey.analytics.mongo.d.ts",
118
+ "import": "./fesm/survey.analytics.mongo.mjs",
119
+ "require": "./survey.analytics.mongo.js"
120
+ },
112
121
  "./*.css": "./*.css",
113
122
  "./survey.analytics.tabulator": {
114
123
  "types": "./survey.analytics.tabulator.d.ts",
@@ -19,5 +19,7 @@ import "../tables/extensions/columnextensions";
19
19
  import "../tables/extensions/detailsextensions";
20
20
  export * from "../tables/table";
21
21
  export * from "../tables/tabulator";
22
+ export * from "../tables/columnbuilder";
23
+ export * from "../tables/columns";
22
24
  export { TableExtensions } from "../tables/extensions/tableextensions";
23
25
  export { DocumentHelper } from "../utils/index";
@@ -40,5 +40,8 @@ export declare class CustomColumnsBuilder extends DefaultColumnsBuilder<Question
40
40
  protected createColumn(question: QuestionCustomModel, table: Table): CustomQuestionColumn;
41
41
  }
42
42
  export declare class CompositeColumnsBuilder extends DefaultColumnsBuilder<QuestionCompositeModel> {
43
+ static ShowAsSeparateColumns: boolean;
44
+ protected getDisplayName(question: QuestionCompositeModel, table: Table): string;
45
+ protected buildColumnsCore(question: QuestionCompositeModel, table: Table): Array<IColumn>;
43
46
  protected createColumn(question: QuestionCompositeModel, table: Table): CompositeQuestionColumn;
44
47
  }
@@ -4,5 +4,5 @@ export declare class VisualizationComposite extends VisualizationPanelDynamic {
4
4
  constructor(question: Question, data: Array<{
5
5
  [index: string]: any;
6
6
  }>, options?: Object, name?: string);
7
- getQuestions(): any[];
7
+ getQuestions(): Array<Question>;
8
8
  }
@@ -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.9
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.9
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([
@@ -11916,6 +11922,11 @@ var SelectBase = /** @class */ (function (_super) {
11916
11922
  }
11917
11923
  };
11918
11924
  SelectBase.prototype.getSelectedItemByText = function (itemText) {
11925
+ var _a;
11926
+ if (this.question instanceof survey_core__WEBPACK_IMPORTED_MODULE_1__.QuestionRatingModel) {
11927
+ var rateValues = this.question.rateValues;
11928
+ return (_a = rateValues === null || rateValues === void 0 ? void 0 : rateValues.filter(function (choice) { return choice.text === itemText; })[0]) !== null && _a !== void 0 ? _a : new survey_core__WEBPACK_IMPORTED_MODULE_1__.ItemValue(parseFloat(itemText), itemText);
11929
+ }
11919
11930
  var selBase = this.question;
11920
11931
  if (this.question.hasOther && itemText == selBase.otherText) {
11921
11932
  return selBase.otherItem;
@@ -13301,9 +13312,9 @@ var VisualizationComposite = /** @class */ (function (_super) {
13301
13312
  return _super.call(this, question, data, options, name || "composite") || this;
13302
13313
  }
13303
13314
  VisualizationComposite.prototype.getQuestions = function () {
13304
- var matrixdynamic = this.question;
13315
+ var questionComposite = this.question;
13305
13316
  var innerQuestions = [];
13306
- matrixdynamic.contentPanel.addQuestionsToList(innerQuestions);
13317
+ questionComposite.contentPanel.addQuestionsToList(innerQuestions);
13307
13318
  return innerQuestions;
13308
13319
  };
13309
13320
  return VisualizationComposite;
@@ -14050,7 +14061,7 @@ var VisualizationPanel = /** @class */ (function (_super) {
14050
14061
  question = Array.isArray(question) ? question[0] : question;
14051
14062
  var element = _this.getElement(question.name);
14052
14063
  if (!!element) {
14053
- element.displayName = _this.processText(question.title);
14064
+ element.displayName = _this.getTitle(question);
14054
14065
  }
14055
14066
  });
14056
14067
  this.visualizers.forEach(function (v) {
@@ -14118,7 +14129,7 @@ var VisualizationPanel = /** @class */ (function (_super) {
14118
14129
  question = Array.isArray(question) ? question[0] : question;
14119
14130
  return {
14120
14131
  name: question.name,
14121
- displayName: _this.processText(question.title),
14132
+ displayName: _this.getTitle(question),
14122
14133
  isVisible: true,
14123
14134
  isPublic: true,
14124
14135
  };
@@ -14851,6 +14862,22 @@ var VisualizerBase = /** @class */ (function () {
14851
14862
  }
14852
14863
  return undefined;
14853
14864
  };
14865
+ Object.defineProperty(VisualizerBase.prototype, "title", {
14866
+ /**
14867
+ * Returns the visualizer's title.
14868
+ */
14869
+ get: function () {
14870
+ return this.getTitle(this.question);
14871
+ },
14872
+ enumerable: false,
14873
+ configurable: true
14874
+ });
14875
+ VisualizerBase.prototype.getTitle = function (question) {
14876
+ var _a;
14877
+ if (question === undefined)
14878
+ return "";
14879
+ return this.processText(((_a = question.locTitle) === null || _a === void 0 ? void 0 : _a.renderedHtml) ? question.locTitle.renderedHtml : question.title);
14880
+ };
14854
14881
  Object.defineProperty(VisualizerBase.prototype, "type", {
14855
14882
  /**
14856
14883
  * Returns the visualizer's type.