survey-analytics 2.2.4 → 2.2.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 +2 -1
- package/fesm/shared.mjs.map +1 -1
- package/fesm/shared2.mjs +108 -102
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/survey.analytics.core.mjs +2 -2
- package/fesm/survey.analytics.mjs +16 -26
- package/fesm/survey.analytics.mjs.map +1 -1
- package/fesm/survey.analytics.tabulator.mjs +16 -4
- package/fesm/survey.analytics.tabulator.mjs.map +1 -1
- package/package.json +6 -5
- package/survey-analytics-tabulator.types/analytics-localization/english.d.ts +1 -0
- package/survey-analytics-tabulator.types/localizationManager.d.ts +1 -0
- package/survey-analytics-tabulator.types/tables/extensions/tableextensions.d.ts +1 -0
- package/survey-analytics.types/analytics-localization/english.d.ts +1 -0
- package/survey-analytics.types/localizationManager.d.ts +1 -0
- package/survey-analytics.types/plotly/chart-adapter.d.ts +9 -0
- package/survey-analytics.types/statisticCalculators.d.ts +4 -0
- package/survey-analytics.types/visualizationManager.d.ts +1 -0
- package/survey-analytics.types/visualizerBase.d.ts +1 -3
- package/survey.analytics.core.css +1 -1
- package/survey.analytics.core.js +179 -130
- 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 +198 -157
- 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 +1 -1
- package/survey.analytics.tabulator.js +39 -5
- package/survey.analytics.tabulator.js.map +1 -1
- package/survey.analytics.tabulator.min.css +1 -1
- package/survey.analytics.tabulator.min.js +1 -1
- package/survey.analytics.tabulator.min.js.LICENSE.txt +1 -1
package/package.json
CHANGED
|
@@ -15,9 +15,10 @@
|
|
|
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
17
|
"lint": "eslint ./src --quiet",
|
|
18
|
-
"pre-push-check": "npm run lint && npm run test"
|
|
18
|
+
"pre-push-check": "npm run lint && npm run test",
|
|
19
|
+
"postinstall": "playwright install chromium"
|
|
19
20
|
},
|
|
20
|
-
"version": "2.2.
|
|
21
|
+
"version": "2.2.5",
|
|
21
22
|
"name": "survey-analytics",
|
|
22
23
|
"description": "SurveyJS analytics Library.",
|
|
23
24
|
"main": "survey.analytics.js",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"tabulator-tables": "^6.2.5"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@playwright/test": "
|
|
49
|
+
"@playwright/test": "1.53.1",
|
|
49
50
|
"@rollup/plugin-commonjs": "^28.0.2",
|
|
50
51
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
51
52
|
"@rollup/plugin-replace": "^6.0.2",
|
|
@@ -67,7 +68,7 @@
|
|
|
67
68
|
"jest-junit": "^16.0.0",
|
|
68
69
|
"mini-css-extract-plugin": "^2.9.0",
|
|
69
70
|
"node-uuid": "1.4.7",
|
|
70
|
-
"playwright": "
|
|
71
|
+
"playwright": "1.53.1",
|
|
71
72
|
"puppeteer": "22.13.1",
|
|
72
73
|
"replace-in-file": "^6.3.2",
|
|
73
74
|
"rollup": "^4.34.8",
|
|
@@ -89,7 +90,7 @@
|
|
|
89
90
|
"peerDependencies": {
|
|
90
91
|
"@types/plotly.js-dist-min": "^2.3.0",
|
|
91
92
|
"@types/tabulator-tables": "^6.2.3",
|
|
92
|
-
"survey-core": "2.2.
|
|
93
|
+
"survey-core": "2.2.5"
|
|
93
94
|
},
|
|
94
95
|
"husky": {
|
|
95
96
|
"hooks": {
|
|
@@ -17,5 +17,6 @@ export declare class TableExtensions {
|
|
|
17
17
|
private static removeExtension;
|
|
18
18
|
static unregisterExtension(location: string, actionName: string): void;
|
|
19
19
|
static findExtension(location: string, actionName: string): ITableExtension;
|
|
20
|
+
static getExtensions(location: string): Array<ITableExtension>;
|
|
20
21
|
private sortExtensions;
|
|
21
22
|
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { SelectBase } from "../selectBase";
|
|
2
2
|
import { VisualizerBase, IChartAdapter } from "../visualizerBase";
|
|
3
|
+
export declare const plotlyChartTypes: {
|
|
4
|
+
boolean: string[];
|
|
5
|
+
number: string[];
|
|
6
|
+
selectBase: string[];
|
|
7
|
+
histogram: string[];
|
|
8
|
+
matrix: string[];
|
|
9
|
+
matrixDropdownGrouped: string[];
|
|
10
|
+
pivot: string[];
|
|
11
|
+
};
|
|
3
12
|
export declare class PlotlyChartAdapter implements IChartAdapter {
|
|
4
13
|
protected model: SelectBase | VisualizerBase;
|
|
5
14
|
private _chart;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IDataInfo } from "./visualizerBase";
|
|
2
|
+
export declare function defaultStatisticsCalculator(data: Array<any>, dataInfo: IDataInfo): Array<any>;
|
|
3
|
+
export declare function histogramStatisticsCalculator(data: any, intervals: any, seriesValues: Array<string>): Array<any>;
|
|
4
|
+
export declare function mathStatisticsCalculator(data: Array<any>, dataName: string): number[];
|
|
@@ -8,6 +8,7 @@ declare type VisualizerConstructor = new (question: Question, data: Array<{
|
|
|
8
8
|
* [View Demo](https://surveyjs.io/dashboard/examples/custom-survey-data-visualizer/ (linkStyle))
|
|
9
9
|
*/
|
|
10
10
|
export declare class VisualizationManager {
|
|
11
|
+
static defaultVisualizer: any;
|
|
11
12
|
static alternativesVisualizer: any;
|
|
12
13
|
static pivotVisualizer: any;
|
|
13
14
|
static vizualizers: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Question } from "survey-core";
|
|
1
|
+
import { Question, Event } from "survey-core";
|
|
2
2
|
import { DataProvider, GetDataFn } from "./dataProvider";
|
|
3
|
-
import { Event } from "survey-core";
|
|
4
3
|
import "./visualizerBase.scss";
|
|
5
4
|
export interface IChartAdapter {
|
|
6
5
|
getChartTypes(): string[];
|
|
@@ -336,4 +335,3 @@ export declare class VisualizerBase implements IDataInfo {
|
|
|
336
335
|
set locale(newLocale: string);
|
|
337
336
|
protected setLocale(newLocale: string): void;
|
|
338
337
|
}
|
|
339
|
-
export declare function defaultStatisticsCalculator(data: Array<any>, dataInfo: IDataInfo): Array<any>;
|
package/survey.analytics.core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.2.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.2.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
|
*/
|
|
@@ -7289,6 +7289,7 @@ var englishStrings = {
|
|
|
7289
7289
|
ascOrder: "Ascending",
|
|
7290
7290
|
descOrder: "Descending",
|
|
7291
7291
|
showMinorColumns: "Show minor columns",
|
|
7292
|
+
actionsColumn: "Actions",
|
|
7292
7293
|
otherCommentTitle: "Other items and comments",
|
|
7293
7294
|
showPercentages: "Show percentages",
|
|
7294
7295
|
hidePercentages: "Hide percentages",
|
|
@@ -8728,6 +8729,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8728
8729
|
/* harmony import */ var _dataProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dataProvider */ "./src/dataProvider.ts");
|
|
8729
8730
|
/* harmony import */ var _selectBase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectBase */ "./src/selectBase.ts");
|
|
8730
8731
|
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
8732
|
+
/* harmony import */ var _statisticCalculators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./statisticCalculators */ "./src/statisticCalculators.ts");
|
|
8733
|
+
|
|
8731
8734
|
|
|
8732
8735
|
|
|
8733
8736
|
|
|
@@ -8901,24 +8904,7 @@ var HistogramModel = /** @class */ (function (_super) {
|
|
|
8901
8904
|
};
|
|
8902
8905
|
HistogramModel.prototype.getCalculatedValuesCore = function () {
|
|
8903
8906
|
var continiousValues = this.getContiniousValues();
|
|
8904
|
-
|
|
8905
|
-
var statistics = [];
|
|
8906
|
-
var series = this.getSeriesValues();
|
|
8907
|
-
if (series.length === 0) {
|
|
8908
|
-
series.push("");
|
|
8909
|
-
}
|
|
8910
|
-
for (var i = 0; i < series.length; ++i) {
|
|
8911
|
-
statistics.push(intervals.map(function (i) { return 0; }));
|
|
8912
|
-
this._continiousData[series[i]].forEach(function (dataValue) {
|
|
8913
|
-
for (var j = 0; j < intervals.length; ++j) {
|
|
8914
|
-
if (intervals[j].start <= dataValue && (dataValue < intervals[j].end || j == intervals.length - 1)) {
|
|
8915
|
-
statistics[i][j]++;
|
|
8916
|
-
break;
|
|
8917
|
-
}
|
|
8918
|
-
}
|
|
8919
|
-
});
|
|
8920
|
-
}
|
|
8921
|
-
return statistics;
|
|
8907
|
+
return (0,_statisticCalculators__WEBPACK_IMPORTED_MODULE_5__.histogramStatisticsCalculator)(this._continiousData, this.intervals, this.getSeriesValues());
|
|
8922
8908
|
};
|
|
8923
8909
|
HistogramModel.prototype.getValueType = function () {
|
|
8924
8910
|
return this.valueType;
|
|
@@ -9617,6 +9603,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9617
9603
|
/* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./localizationManager */ "./src/localizationManager.ts");
|
|
9618
9604
|
/* harmony import */ var _utils_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/index */ "./src/utils/index.ts");
|
|
9619
9605
|
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
9606
|
+
/* harmony import */ var _statisticCalculators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./statisticCalculators */ "./src/statisticCalculators.ts");
|
|
9607
|
+
|
|
9620
9608
|
|
|
9621
9609
|
|
|
9622
9610
|
|
|
@@ -9716,31 +9704,11 @@ var NumberModel = /** @class */ (function (_super) {
|
|
|
9716
9704
|
return [externalCalculatedData.value || 0, externalCalculatedData.minValue || 0, externalCalculatedData.maxValue || 0];
|
|
9717
9705
|
};
|
|
9718
9706
|
NumberModel.prototype.getCalculatedValuesCore = function () {
|
|
9719
|
-
var
|
|
9707
|
+
var _a;
|
|
9720
9708
|
if (this._resultAverage === undefined ||
|
|
9721
9709
|
this._resultMin === undefined ||
|
|
9722
9710
|
this._resultMax === undefined) {
|
|
9723
|
-
this._resultMin =
|
|
9724
|
-
this._resultMax = -Number.MAX_VALUE;
|
|
9725
|
-
this._resultAverage = 0;
|
|
9726
|
-
var actualAnswerCount_1 = 0;
|
|
9727
|
-
this.data.forEach(function (rowData) {
|
|
9728
|
-
if (rowData[_this.question.name] !== undefined) {
|
|
9729
|
-
var questionValue = +rowData[_this.question.name];
|
|
9730
|
-
actualAnswerCount_1++;
|
|
9731
|
-
_this._resultAverage += questionValue;
|
|
9732
|
-
if (_this._resultMin > questionValue) {
|
|
9733
|
-
_this._resultMin = questionValue;
|
|
9734
|
-
}
|
|
9735
|
-
if (_this._resultMax < questionValue) {
|
|
9736
|
-
_this._resultMax = questionValue;
|
|
9737
|
-
}
|
|
9738
|
-
}
|
|
9739
|
-
});
|
|
9740
|
-
if (actualAnswerCount_1 > 0) {
|
|
9741
|
-
this._resultAverage = this._resultAverage / actualAnswerCount_1;
|
|
9742
|
-
}
|
|
9743
|
-
this._resultAverage = Math.ceil(this._resultAverage * 100) / 100;
|
|
9711
|
+
_a = (0,_statisticCalculators__WEBPACK_IMPORTED_MODULE_5__.mathStatisticsCalculator)(this.surveyData, this.dataNames[0]), this._resultAverage = _a[0], this._resultMin = _a[1], this._resultMax = _a[2];
|
|
9744
9712
|
}
|
|
9745
9713
|
return [this._resultAverage, this._resultMin, this._resultMax];
|
|
9746
9714
|
};
|
|
@@ -10939,6 +10907,122 @@ _visualizationManager__WEBPACK_IMPORTED_MODULE_5__.VisualizationManager.register
|
|
|
10939
10907
|
_visualizationManager__WEBPACK_IMPORTED_MODULE_5__.VisualizationManager.registerVisualizer("tagbox", SelectBase);
|
|
10940
10908
|
|
|
10941
10909
|
|
|
10910
|
+
/***/ }),
|
|
10911
|
+
|
|
10912
|
+
/***/ "./src/statisticCalculators.ts":
|
|
10913
|
+
/*!*************************************!*\
|
|
10914
|
+
!*** ./src/statisticCalculators.ts ***!
|
|
10915
|
+
\*************************************/
|
|
10916
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
10917
|
+
|
|
10918
|
+
"use strict";
|
|
10919
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10920
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10921
|
+
/* harmony export */ defaultStatisticsCalculator: () => (/* binding */ defaultStatisticsCalculator),
|
|
10922
|
+
/* harmony export */ histogramStatisticsCalculator: () => (/* binding */ histogramStatisticsCalculator),
|
|
10923
|
+
/* harmony export */ mathStatisticsCalculator: () => (/* binding */ mathStatisticsCalculator)
|
|
10924
|
+
/* harmony export */ });
|
|
10925
|
+
/* harmony import */ var _dataProvider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dataProvider */ "./src/dataProvider.ts");
|
|
10926
|
+
|
|
10927
|
+
function defaultStatisticsCalculator(data, dataInfo) {
|
|
10928
|
+
var dataNames = dataInfo.dataNames;
|
|
10929
|
+
var statistics = [];
|
|
10930
|
+
var values = dataInfo.getValues();
|
|
10931
|
+
var valuesIndex = {};
|
|
10932
|
+
values.forEach(function (val, index) {
|
|
10933
|
+
valuesIndex[val] = index;
|
|
10934
|
+
});
|
|
10935
|
+
var processMissingAnswers = values.indexOf(undefined) !== -1;
|
|
10936
|
+
var series = dataInfo.getSeriesValues();
|
|
10937
|
+
var seriesIndex = {};
|
|
10938
|
+
series.forEach(function (val, index) {
|
|
10939
|
+
seriesIndex[val] = index;
|
|
10940
|
+
});
|
|
10941
|
+
var seriesLength = series.length || 1;
|
|
10942
|
+
for (var i = 0; i < dataNames.length; ++i) {
|
|
10943
|
+
var dataNameStatistics = new Array();
|
|
10944
|
+
for (var j = 0; j < seriesLength; ++j) {
|
|
10945
|
+
dataNameStatistics.push(new Array(values.length).fill(0));
|
|
10946
|
+
}
|
|
10947
|
+
statistics.push(dataNameStatistics);
|
|
10948
|
+
}
|
|
10949
|
+
data.forEach(function (row) {
|
|
10950
|
+
dataNames.forEach(function (dataName, index) {
|
|
10951
|
+
var rowValue = row[dataName];
|
|
10952
|
+
if (rowValue !== undefined || processMissingAnswers) {
|
|
10953
|
+
var rowValues = Array.isArray(rowValue) ? rowValue : [rowValue];
|
|
10954
|
+
if (series.length > 0) {
|
|
10955
|
+
if (row[_dataProvider__WEBPACK_IMPORTED_MODULE_0__.DataProvider.seriesMarkerKey] !== undefined) {
|
|
10956
|
+
// Series are labelled by seriesMarkerKey in row data
|
|
10957
|
+
var seriesNo_1 = seriesIndex[row[_dataProvider__WEBPACK_IMPORTED_MODULE_0__.DataProvider.seriesMarkerKey]] || 0;
|
|
10958
|
+
rowValues.forEach(function (val) {
|
|
10959
|
+
statistics[index][seriesNo_1][valuesIndex[val]]++;
|
|
10960
|
+
});
|
|
10961
|
+
}
|
|
10962
|
+
else {
|
|
10963
|
+
// Series are the keys in question value (matrix question)
|
|
10964
|
+
// TODO: think about the de-normalization and combine with the previous case
|
|
10965
|
+
rowValues.forEach(function (val) {
|
|
10966
|
+
series.forEach(function (seriesName) {
|
|
10967
|
+
if (val[seriesName] !== undefined) {
|
|
10968
|
+
var seriesNo = seriesIndex[seriesName] || 0;
|
|
10969
|
+
statistics[index][seriesNo][valuesIndex[val[seriesName]]]++;
|
|
10970
|
+
}
|
|
10971
|
+
});
|
|
10972
|
+
});
|
|
10973
|
+
}
|
|
10974
|
+
}
|
|
10975
|
+
else {
|
|
10976
|
+
// No series
|
|
10977
|
+
rowValues.forEach(function (val) { return statistics[0][0][valuesIndex[val]]++; });
|
|
10978
|
+
}
|
|
10979
|
+
}
|
|
10980
|
+
});
|
|
10981
|
+
});
|
|
10982
|
+
return dataInfo.dataNames.length > 1 ? statistics : statistics[0];
|
|
10983
|
+
}
|
|
10984
|
+
function histogramStatisticsCalculator(data, intervals, seriesValues) {
|
|
10985
|
+
var statistics = [];
|
|
10986
|
+
if (seriesValues.length === 0) {
|
|
10987
|
+
seriesValues.push("");
|
|
10988
|
+
}
|
|
10989
|
+
for (var i = 0; i < seriesValues.length; ++i) {
|
|
10990
|
+
statistics.push(intervals.map(function (i) { return 0; }));
|
|
10991
|
+
data[seriesValues[i]].forEach(function (dataValue) {
|
|
10992
|
+
for (var j = 0; j < intervals.length; ++j) {
|
|
10993
|
+
if (intervals[j].start <= dataValue && (dataValue < intervals[j].end || j == intervals.length - 1)) {
|
|
10994
|
+
statistics[i][j]++;
|
|
10995
|
+
break;
|
|
10996
|
+
}
|
|
10997
|
+
}
|
|
10998
|
+
});
|
|
10999
|
+
}
|
|
11000
|
+
return statistics;
|
|
11001
|
+
}
|
|
11002
|
+
function mathStatisticsCalculator(data, dataName) {
|
|
11003
|
+
var resultMin = Number.MAX_VALUE, resultMax = -Number.MAX_VALUE, resultAverage = 0;
|
|
11004
|
+
var actualAnswerCount = 0;
|
|
11005
|
+
data.forEach(function (rowData) {
|
|
11006
|
+
if (rowData[dataName] !== undefined) {
|
|
11007
|
+
var questionValue = +rowData[dataName];
|
|
11008
|
+
actualAnswerCount++;
|
|
11009
|
+
resultAverage += questionValue;
|
|
11010
|
+
if (resultMin > questionValue) {
|
|
11011
|
+
resultMin = questionValue;
|
|
11012
|
+
}
|
|
11013
|
+
if (resultMax < questionValue) {
|
|
11014
|
+
resultMax = questionValue;
|
|
11015
|
+
}
|
|
11016
|
+
}
|
|
11017
|
+
});
|
|
11018
|
+
if (actualAnswerCount > 0) {
|
|
11019
|
+
resultAverage = resultAverage / actualAnswerCount;
|
|
11020
|
+
}
|
|
11021
|
+
resultAverage = Math.ceil(resultAverage * 100) / 100;
|
|
11022
|
+
return [resultAverage, resultMin, resultMax];
|
|
11023
|
+
}
|
|
11024
|
+
|
|
11025
|
+
|
|
10942
11026
|
/***/ }),
|
|
10943
11027
|
|
|
10944
11028
|
/***/ "./src/statistics-table.scss":
|
|
@@ -11329,7 +11413,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11329
11413
|
/* harmony export */ __decorate: () => (/* binding */ __decorate),
|
|
11330
11414
|
/* harmony export */ __extends: () => (/* binding */ __extends),
|
|
11331
11415
|
/* harmony export */ __generator: () => (/* binding */ __generator),
|
|
11332
|
-
/* harmony export */ __rest: () => (/* binding */ __rest)
|
|
11416
|
+
/* harmony export */ __rest: () => (/* binding */ __rest),
|
|
11417
|
+
/* harmony export */ __spreadArray: () => (/* binding */ __spreadArray),
|
|
11418
|
+
/* harmony export */ __spreadArrays: () => (/* binding */ __spreadArrays)
|
|
11333
11419
|
/* harmony export */ });
|
|
11334
11420
|
var __assign = Object["assign"] ||
|
|
11335
11421
|
function (target) {
|
|
@@ -11468,6 +11554,25 @@ function __generator(thisArg, body) {
|
|
|
11468
11554
|
return { value: op[0] ? op[1] : void 0, done: true };
|
|
11469
11555
|
}
|
|
11470
11556
|
}
|
|
11557
|
+
var __spreadArrays = function () {
|
|
11558
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
11559
|
+
s += arguments[i].length;
|
|
11560
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
11561
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
11562
|
+
r[k] = a[j];
|
|
11563
|
+
return r;
|
|
11564
|
+
};
|
|
11565
|
+
function __spreadArray(to, from, pack) {
|
|
11566
|
+
if (pack || arguments.length === 2)
|
|
11567
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
11568
|
+
if (ar || !(i in from)) {
|
|
11569
|
+
if (!ar)
|
|
11570
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
11571
|
+
ar[i] = from[i];
|
|
11572
|
+
}
|
|
11573
|
+
}
|
|
11574
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
11575
|
+
}
|
|
11471
11576
|
|
|
11472
11577
|
|
|
11473
11578
|
/***/ }),
|
|
@@ -11714,8 +11819,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11714
11819
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11715
11820
|
/* harmony export */ VisualizationManager: () => (/* binding */ VisualizationManager)
|
|
11716
11821
|
/* harmony export */ });
|
|
11717
|
-
/* harmony import */ var _visualizerBase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./visualizerBase */ "./src/visualizerBase.ts");
|
|
11718
|
-
|
|
11719
11822
|
/**
|
|
11720
11823
|
* An object with methods used to register and unregister visualizers for individual question types.
|
|
11721
11824
|
*
|
|
@@ -11785,10 +11888,10 @@ var VisualizationManager = /** @class */ (function () {
|
|
|
11785
11888
|
VisualizationManager.getVisualizersByType = function (questionType) {
|
|
11786
11889
|
var vDescrs = VisualizationManager.vizualizers[questionType];
|
|
11787
11890
|
if (!vDescrs) {
|
|
11788
|
-
if (
|
|
11891
|
+
if (VisualizationManager.defaultVisualizer.suppressVisualizerStubRendering) {
|
|
11789
11892
|
return [];
|
|
11790
11893
|
}
|
|
11791
|
-
return [
|
|
11894
|
+
return [VisualizationManager.defaultVisualizer];
|
|
11792
11895
|
}
|
|
11793
11896
|
vDescrs = [].concat(vDescrs);
|
|
11794
11897
|
vDescrs.sort(function (v1, v2) { return v1.index - v2.index; });
|
|
@@ -11799,7 +11902,7 @@ var VisualizationManager = /** @class */ (function () {
|
|
|
11799
11902
|
* @see registerAltVisualizerSelector
|
|
11800
11903
|
*/
|
|
11801
11904
|
VisualizationManager.getAltVisualizerSelector = function () {
|
|
11802
|
-
return VisualizationManager.alternativesVisualizer ||
|
|
11905
|
+
return VisualizationManager.alternativesVisualizer || VisualizationManager.defaultVisualizer;
|
|
11803
11906
|
};
|
|
11804
11907
|
/**
|
|
11805
11908
|
* Registers an alternative visualizer selector.
|
|
@@ -11809,11 +11912,12 @@ var VisualizationManager = /** @class */ (function () {
|
|
|
11809
11912
|
VisualizationManager.alternativesVisualizer = constructor;
|
|
11810
11913
|
};
|
|
11811
11914
|
VisualizationManager.getPivotVisualizerConstructor = function () {
|
|
11812
|
-
return VisualizationManager.pivotVisualizer ||
|
|
11915
|
+
return VisualizationManager.pivotVisualizer || VisualizationManager.defaultVisualizer;
|
|
11813
11916
|
};
|
|
11814
11917
|
VisualizationManager.registerPivotVisualizer = function (constructor) {
|
|
11815
11918
|
VisualizationManager.pivotVisualizer = constructor;
|
|
11816
11919
|
};
|
|
11920
|
+
VisualizationManager.defaultVisualizer = undefined;
|
|
11817
11921
|
VisualizationManager.alternativesVisualizer = undefined;
|
|
11818
11922
|
VisualizationManager.pivotVisualizer = undefined;
|
|
11819
11923
|
VisualizationManager.vizualizers = {};
|
|
@@ -12887,17 +12991,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12887
12991
|
__webpack_require__.r(__webpack_exports__);
|
|
12888
12992
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12889
12993
|
/* harmony export */ PostponeHelper: () => (/* binding */ PostponeHelper),
|
|
12890
|
-
/* harmony export */ VisualizerBase: () => (/* binding */ VisualizerBase)
|
|
12891
|
-
/* harmony export */ defaultStatisticsCalculator: () => (/* binding */ defaultStatisticsCalculator)
|
|
12994
|
+
/* harmony export */ VisualizerBase: () => (/* binding */ VisualizerBase)
|
|
12892
12995
|
/* harmony export */ });
|
|
12893
12996
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./src/utils/helpers.ts");
|
|
12894
12997
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "survey-core");
|
|
12895
12998
|
/* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(survey_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
12896
12999
|
/* harmony import */ var _dataProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dataProvider */ "./src/dataProvider.ts");
|
|
12897
13000
|
/* harmony import */ var _visualizerFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./visualizerFactory */ "./src/visualizerFactory.ts");
|
|
12898
|
-
/* harmony import */ var
|
|
12899
|
-
/* harmony import */ var
|
|
12900
|
-
/* harmony import */ var
|
|
13001
|
+
/* harmony import */ var _visualizationManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./visualizationManager */ "./src/visualizationManager.ts");
|
|
13002
|
+
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils */ "./src/utils/index.ts");
|
|
13003
|
+
/* harmony import */ var _localizationManager__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./localizationManager */ "./src/localizationManager.ts");
|
|
13004
|
+
/* harmony import */ var _statisticCalculators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./statisticCalculators */ "./src/statisticCalculators.ts");
|
|
13005
|
+
/* harmony import */ var _visualizerBase_scss__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./visualizerBase.scss */ "./src/visualizerBase.scss");
|
|
13006
|
+
|
|
12901
13007
|
|
|
12902
13008
|
|
|
12903
13009
|
|
|
@@ -13321,7 +13427,7 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13321
13427
|
};
|
|
13322
13428
|
VisualizerBase.prototype.renderToolbar = function (container) {
|
|
13323
13429
|
if (this.showToolbar) {
|
|
13324
|
-
var toolbar_1 = (
|
|
13430
|
+
var toolbar_1 = (_utils__WEBPACK_IMPORTED_MODULE_5__.DocumentHelper.createElement("div", "sa-toolbar"));
|
|
13325
13431
|
this.createToolbarItems(toolbar_1);
|
|
13326
13432
|
container.appendChild(toolbar_1);
|
|
13327
13433
|
}
|
|
@@ -13348,8 +13454,8 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13348
13454
|
this.options.renderHeader(container, this);
|
|
13349
13455
|
}
|
|
13350
13456
|
else {
|
|
13351
|
-
var correctAnswerElement =
|
|
13352
|
-
correctAnswerElement.innerText =
|
|
13457
|
+
var correctAnswerElement = _utils__WEBPACK_IMPORTED_MODULE_5__.DocumentHelper.createElement("div", "sa-visualizer__correct-answer");
|
|
13458
|
+
correctAnswerElement.innerText = _localizationManager__WEBPACK_IMPORTED_MODULE_6__.localization.getString("correctAnswer") + this.getCorrectAnswerText();
|
|
13353
13459
|
container.appendChild(correctAnswerElement);
|
|
13354
13460
|
}
|
|
13355
13461
|
};
|
|
@@ -13360,7 +13466,7 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13360
13466
|
switch (_a.label) {
|
|
13361
13467
|
case 0:
|
|
13362
13468
|
if (!this._chartAdapter) return [3 /*break*/, 2];
|
|
13363
|
-
chartNode =
|
|
13469
|
+
chartNode = _utils__WEBPACK_IMPORTED_MODULE_5__.DocumentHelper.createElement("div");
|
|
13364
13470
|
container.innerHTML = "";
|
|
13365
13471
|
container.appendChild(chartNode);
|
|
13366
13472
|
return [4 /*yield*/, this._chartAdapter.create(chartNode)];
|
|
@@ -13368,7 +13474,7 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13368
13474
|
_a.sent();
|
|
13369
13475
|
return [3 /*break*/, 3];
|
|
13370
13476
|
case 2:
|
|
13371
|
-
container.innerText =
|
|
13477
|
+
container.innerText = _localizationManager__WEBPACK_IMPORTED_MODULE_6__.localization.getString("noVisualizerForQuestion");
|
|
13372
13478
|
_a.label = 3;
|
|
13373
13479
|
case 3: return [2 /*return*/, container];
|
|
13374
13480
|
}
|
|
@@ -13408,23 +13514,23 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13408
13514
|
var _this = this;
|
|
13409
13515
|
container.innerHTML = "";
|
|
13410
13516
|
if (this.hasFooter) {
|
|
13411
|
-
var footerTitleElement =
|
|
13517
|
+
var footerTitleElement = _utils__WEBPACK_IMPORTED_MODULE_5__.DocumentHelper.createElement("h4", "sa-visualizer__footer-title", { innerText: _localizationManager__WEBPACK_IMPORTED_MODULE_6__.localization.getString("otherCommentTitle") });
|
|
13412
13518
|
container.appendChild(footerTitleElement);
|
|
13413
|
-
var footerContentElement_1 =
|
|
13519
|
+
var footerContentElement_1 = _utils__WEBPACK_IMPORTED_MODULE_5__.DocumentHelper.createElement("div", "sa-visualizer__footer-content");
|
|
13414
13520
|
footerContentElement_1.style.display = VisualizerBase.otherCommentCollapsed
|
|
13415
13521
|
? "none"
|
|
13416
13522
|
: "block";
|
|
13417
|
-
var visibilityButton_1 =
|
|
13523
|
+
var visibilityButton_1 = _utils__WEBPACK_IMPORTED_MODULE_5__.DocumentHelper.createButton(function () {
|
|
13418
13524
|
if (footerContentElement_1.style.display === "none") {
|
|
13419
13525
|
footerContentElement_1.style.display = "block";
|
|
13420
|
-
visibilityButton_1.innerText =
|
|
13526
|
+
visibilityButton_1.innerText = _localizationManager__WEBPACK_IMPORTED_MODULE_6__.localization.getString("hideButton");
|
|
13421
13527
|
}
|
|
13422
13528
|
else {
|
|
13423
13529
|
footerContentElement_1.style.display = "none";
|
|
13424
|
-
visibilityButton_1.innerText =
|
|
13530
|
+
visibilityButton_1.innerText = _localizationManager__WEBPACK_IMPORTED_MODULE_6__.localization.getString(VisualizerBase.otherCommentCollapsed ? "showButton" : "hideButton");
|
|
13425
13531
|
}
|
|
13426
13532
|
_this.footerVisualizer.invokeOnUpdate();
|
|
13427
|
-
},
|
|
13533
|
+
}, _localizationManager__WEBPACK_IMPORTED_MODULE_6__.localization.getString("showButton") /*, "sa-toolbar__button--right"*/);
|
|
13428
13534
|
container.appendChild(visibilityButton_1);
|
|
13429
13535
|
container.appendChild(footerContentElement_1);
|
|
13430
13536
|
this.footerVisualizer.render(footerContentElement_1);
|
|
@@ -13439,18 +13545,18 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13439
13545
|
targetElement = document.getElementById(targetElement);
|
|
13440
13546
|
}
|
|
13441
13547
|
this.renderResult = targetElement;
|
|
13442
|
-
this.toolbarContainer =
|
|
13548
|
+
this.toolbarContainer = _utils__WEBPACK_IMPORTED_MODULE_5__.DocumentHelper.createElement("div", "sa-visualizer__toolbar");
|
|
13443
13549
|
targetElement.appendChild(this.toolbarContainer);
|
|
13444
13550
|
this.renderToolbar(this.toolbarContainer);
|
|
13445
13551
|
if (this.hasHeader) {
|
|
13446
|
-
this.headerContainer =
|
|
13552
|
+
this.headerContainer = _utils__WEBPACK_IMPORTED_MODULE_5__.DocumentHelper.createElement("div", "sa-visualizer__header");
|
|
13447
13553
|
targetElement.appendChild(this.headerContainer);
|
|
13448
13554
|
this.renderHeader(this.headerContainer);
|
|
13449
13555
|
}
|
|
13450
|
-
this.contentContainer =
|
|
13556
|
+
this.contentContainer = _utils__WEBPACK_IMPORTED_MODULE_5__.DocumentHelper.createElement("div", "sa-visualizer__content");
|
|
13451
13557
|
targetElement.appendChild(this.contentContainer);
|
|
13452
13558
|
this.renderContent(this.contentContainer);
|
|
13453
|
-
this.footerContainer =
|
|
13559
|
+
this.footerContainer = _utils__WEBPACK_IMPORTED_MODULE_5__.DocumentHelper.createElement("div", "sa-visualizer__footer");
|
|
13454
13560
|
targetElement.appendChild(this.footerContainer);
|
|
13455
13561
|
this.renderFooter(this.footerContainer);
|
|
13456
13562
|
};
|
|
@@ -13575,10 +13681,10 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13575
13681
|
if (!!this._getDataCore) {
|
|
13576
13682
|
return this._getDataCore(this);
|
|
13577
13683
|
}
|
|
13578
|
-
return defaultStatisticsCalculator(this.surveyData, this);
|
|
13684
|
+
return (0,_statisticCalculators__WEBPACK_IMPORTED_MODULE_7__.defaultStatisticsCalculator)(this.surveyData, this);
|
|
13579
13685
|
};
|
|
13580
13686
|
VisualizerBase.prototype.renderLoadingIndicator = function (contentContainer) {
|
|
13581
|
-
contentContainer.appendChild((0,
|
|
13687
|
+
contentContainer.appendChild((0,_utils__WEBPACK_IMPORTED_MODULE_5__.createLoadingIndicator)());
|
|
13582
13688
|
};
|
|
13583
13689
|
VisualizerBase.prototype.convertFromExternalData = function (externalCalculatedData) {
|
|
13584
13690
|
return externalCalculatedData;
|
|
@@ -13666,7 +13772,7 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13666
13772
|
if (!!survey) {
|
|
13667
13773
|
return survey.locale;
|
|
13668
13774
|
}
|
|
13669
|
-
return
|
|
13775
|
+
return _localizationManager__WEBPACK_IMPORTED_MODULE_6__.localization.currentLocale;
|
|
13670
13776
|
},
|
|
13671
13777
|
set: function (newLocale) {
|
|
13672
13778
|
this.setLocale(newLocale);
|
|
@@ -13677,7 +13783,7 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13677
13783
|
configurable: true
|
|
13678
13784
|
});
|
|
13679
13785
|
VisualizerBase.prototype.setLocale = function (newLocale) {
|
|
13680
|
-
|
|
13786
|
+
_localizationManager__WEBPACK_IMPORTED_MODULE_6__.localization.currentLocale = newLocale;
|
|
13681
13787
|
var survey = this.options.survey;
|
|
13682
13788
|
if (!!survey && survey.locale !== newLocale) {
|
|
13683
13789
|
survey.locale = newLocale;
|
|
@@ -13703,63 +13809,7 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13703
13809
|
return VisualizerBase;
|
|
13704
13810
|
}());
|
|
13705
13811
|
|
|
13706
|
-
|
|
13707
|
-
var dataNames = dataInfo.dataNames;
|
|
13708
|
-
var statistics = [];
|
|
13709
|
-
var values = dataInfo.getValues();
|
|
13710
|
-
var valuesIndex = {};
|
|
13711
|
-
values.forEach(function (val, index) {
|
|
13712
|
-
valuesIndex[val] = index;
|
|
13713
|
-
});
|
|
13714
|
-
var processMissingAnswers = values.indexOf(undefined) !== -1;
|
|
13715
|
-
var series = dataInfo.getSeriesValues();
|
|
13716
|
-
var seriesIndex = {};
|
|
13717
|
-
series.forEach(function (val, index) {
|
|
13718
|
-
seriesIndex[val] = index;
|
|
13719
|
-
});
|
|
13720
|
-
var seriesLength = series.length || 1;
|
|
13721
|
-
for (var i = 0; i < dataNames.length; ++i) {
|
|
13722
|
-
var dataNameStatistics = new Array();
|
|
13723
|
-
for (var j = 0; j < seriesLength; ++j) {
|
|
13724
|
-
dataNameStatistics.push(new Array(values.length).fill(0));
|
|
13725
|
-
}
|
|
13726
|
-
statistics.push(dataNameStatistics);
|
|
13727
|
-
}
|
|
13728
|
-
data.forEach(function (row) {
|
|
13729
|
-
dataNames.forEach(function (dataName, index) {
|
|
13730
|
-
var rowValue = row[dataName];
|
|
13731
|
-
if (rowValue !== undefined || processMissingAnswers) {
|
|
13732
|
-
var rowValues = Array.isArray(rowValue) ? rowValue : [rowValue];
|
|
13733
|
-
if (series.length > 0) {
|
|
13734
|
-
if (row[_dataProvider__WEBPACK_IMPORTED_MODULE_2__.DataProvider.seriesMarkerKey] !== undefined) {
|
|
13735
|
-
// Series are labelled by seriesMarkerKey in row data
|
|
13736
|
-
var seriesNo_1 = seriesIndex[row[_dataProvider__WEBPACK_IMPORTED_MODULE_2__.DataProvider.seriesMarkerKey]] || 0;
|
|
13737
|
-
rowValues.forEach(function (val) {
|
|
13738
|
-
statistics[index][seriesNo_1][valuesIndex[val]]++;
|
|
13739
|
-
});
|
|
13740
|
-
}
|
|
13741
|
-
else {
|
|
13742
|
-
// Series are the keys in question value (matrix question)
|
|
13743
|
-
// TODO: think about the de-normalization and combine with the previous case
|
|
13744
|
-
rowValues.forEach(function (val) {
|
|
13745
|
-
series.forEach(function (seriesName) {
|
|
13746
|
-
if (val[seriesName] !== undefined) {
|
|
13747
|
-
var seriesNo = seriesIndex[seriesName] || 0;
|
|
13748
|
-
statistics[index][seriesNo][valuesIndex[val[seriesName]]]++;
|
|
13749
|
-
}
|
|
13750
|
-
});
|
|
13751
|
-
});
|
|
13752
|
-
}
|
|
13753
|
-
}
|
|
13754
|
-
else {
|
|
13755
|
-
// No series
|
|
13756
|
-
rowValues.forEach(function (val) { return statistics[0][0][valuesIndex[val]]++; });
|
|
13757
|
-
}
|
|
13758
|
-
}
|
|
13759
|
-
});
|
|
13760
|
-
});
|
|
13761
|
-
return dataInfo.dataNames.length > 1 ? statistics : statistics[0];
|
|
13762
|
-
}
|
|
13812
|
+
_visualizationManager__WEBPACK_IMPORTED_MODULE_4__.VisualizationManager.defaultVisualizer = VisualizerBase;
|
|
13763
13813
|
|
|
13764
13814
|
|
|
13765
13815
|
/***/ }),
|
|
@@ -15755,7 +15805,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
15755
15805
|
/* harmony export */ VisualizerFactory: () => (/* reexport safe */ _visualizerFactory__WEBPACK_IMPORTED_MODULE_15__.VisualizerFactory),
|
|
15756
15806
|
/* harmony export */ WordCloud: () => (/* reexport safe */ _wordcloud_wordcloud__WEBPACK_IMPORTED_MODULE_28__.WordCloud),
|
|
15757
15807
|
/* harmony export */ WordCloudAdapter: () => (/* reexport safe */ _wordcloud_wordcloud__WEBPACK_IMPORTED_MODULE_28__.WordCloudAdapter),
|
|
15758
|
-
/* harmony export */ defaultStatisticsCalculator: () => (/* reexport safe */ _visualizerBase__WEBPACK_IMPORTED_MODULE_21__.defaultStatisticsCalculator),
|
|
15759
15808
|
/* harmony export */ hideEmptyAnswersInData: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_16__.hideEmptyAnswersInData),
|
|
15760
15809
|
/* harmony export */ localization: () => (/* reexport safe */ _localizationManager__WEBPACK_IMPORTED_MODULE_0__.localization),
|
|
15761
15810
|
/* harmony export */ surveyStrings: () => (/* reexport safe */ _localizationManager__WEBPACK_IMPORTED_MODULE_0__.surveyStrings),
|