survey-analytics 2.3.6 → 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/fesm/shared.mjs +1 -1
- package/fesm/shared2.mjs +110 -63
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/survey.analytics.core.mjs +2 -2
- package/fesm/survey.analytics.mjs +3 -3
- package/fesm/survey.analytics.tabulator.mjs +6 -3
- package/fesm/survey.analytics.tabulator.mjs.map +1 -1
- package/package.json +3 -3
- package/survey-analytics-tabulator.types/tables/table.d.ts +18 -5
- package/survey-analytics.types/entries/summary.core.d.ts +1 -0
- package/survey-analytics.types/visualizationComposite.d.ts +8 -0
- package/survey-analytics.types/visualizationMatrixDynamic.d.ts +1 -2
- package/survey-analytics.types/visualizationPanel.d.ts +6 -0
- package/survey-analytics.types/visualizationPanelDynamic.d.ts +1 -2
- package/survey-analytics.types/visualizerBase.d.ts +6 -1
- package/survey.analytics.core.css +1 -1
- package/survey.analytics.core.js +173 -98
- 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 +174 -98
- 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 +11 -4
- 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/fesm/shared.mjs
CHANGED
package/fesm/shared2.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.3.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.3.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
|
*/
|
|
6
6
|
|
|
7
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';
|
|
8
|
+
import { Event, QuestionCustomModel, QuestionCompositeModel, hasLicense, QuestionCommentModel, settings, ItemValue, surveyLocalization, IsTouch } from 'survey-core';
|
|
9
9
|
|
|
10
10
|
/******************************************************************************
|
|
11
11
|
Copyright (c) Microsoft Corporation.
|
|
@@ -282,16 +282,26 @@ class VisualizerFactory {
|
|
|
282
282
|
static createVisualizer(question, data, options) {
|
|
283
283
|
let type = question.getType();
|
|
284
284
|
let creators = [];
|
|
285
|
+
let questionForCreator = question;
|
|
286
|
+
let optionsForCreator = Object.assign({}, options);
|
|
285
287
|
if (type === "text" && question.inputType) {
|
|
286
288
|
creators = VisualizationManager.getVisualizersByType(question.inputType, type);
|
|
287
289
|
}
|
|
288
290
|
else {
|
|
289
|
-
|
|
291
|
+
let fallbackType = undefined;
|
|
292
|
+
if (question instanceof QuestionCustomModel) {
|
|
293
|
+
fallbackType = question.getDynamicType();
|
|
294
|
+
// questionForCreator = question.contentQuestion;
|
|
295
|
+
}
|
|
296
|
+
else if (question instanceof QuestionCompositeModel) {
|
|
297
|
+
fallbackType = "composite";
|
|
298
|
+
}
|
|
299
|
+
creators = VisualizationManager.getVisualizersByType(type, fallbackType);
|
|
290
300
|
}
|
|
291
|
-
var visualizers = creators.map((creator) => new creator(
|
|
301
|
+
var visualizers = creators.map((creator) => new creator(questionForCreator, data, optionsForCreator));
|
|
292
302
|
if (visualizers.length > 1) {
|
|
293
303
|
const alternativesVisualizerConstructor = VisualizationManager.getAltVisualizerSelector();
|
|
294
|
-
let visualizer = new alternativesVisualizerConstructor(visualizers,
|
|
304
|
+
let visualizer = new alternativesVisualizerConstructor(visualizers, questionForCreator, data, optionsForCreator);
|
|
295
305
|
return visualizer;
|
|
296
306
|
}
|
|
297
307
|
return visualizers[0];
|
|
@@ -689,6 +699,18 @@ class VisualizerBase {
|
|
|
689
699
|
}
|
|
690
700
|
return undefined;
|
|
691
701
|
}
|
|
702
|
+
/**
|
|
703
|
+
* Returns the visualizer's title.
|
|
704
|
+
*/
|
|
705
|
+
get title() {
|
|
706
|
+
return this.getTitle(this.question);
|
|
707
|
+
}
|
|
708
|
+
getTitle(question) {
|
|
709
|
+
var _a;
|
|
710
|
+
if (question === undefined)
|
|
711
|
+
return "";
|
|
712
|
+
return this.processText(((_a = question.locTitle) === null || _a === void 0 ? void 0 : _a.renderedHtml) ? question.locTitle.renderedHtml : question.title);
|
|
713
|
+
}
|
|
692
714
|
/**
|
|
693
715
|
* Returns the visualizer's type.
|
|
694
716
|
*/
|
|
@@ -717,11 +739,26 @@ class VisualizerBase {
|
|
|
717
739
|
* @param data A data array with survey results to be visualized.
|
|
718
740
|
*/
|
|
719
741
|
updateData(data) {
|
|
742
|
+
const dataPath = this.options.dataPath;
|
|
743
|
+
let dataToAssign = data;
|
|
744
|
+
if (!!dataPath && Array.isArray(data)) {
|
|
745
|
+
dataToAssign = [];
|
|
746
|
+
data.forEach(dataItem => {
|
|
747
|
+
if (!!dataItem && dataItem[dataPath] !== undefined) {
|
|
748
|
+
if (Array.isArray(dataItem[dataPath])) {
|
|
749
|
+
dataToAssign = dataToAssign.concat(dataItem[dataPath]);
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
dataToAssign.push(dataItem[dataPath]);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
}
|
|
720
757
|
if (!this.options.dataProvider) {
|
|
721
|
-
this.dataProvider.data =
|
|
758
|
+
this.dataProvider.data = dataToAssign;
|
|
722
759
|
}
|
|
723
760
|
if (this.hasFooter) {
|
|
724
|
-
this.footerVisualizer.updateData(
|
|
761
|
+
this.footerVisualizer.updateData(dataToAssign);
|
|
725
762
|
}
|
|
726
763
|
}
|
|
727
764
|
invokeOnUpdate() {
|
|
@@ -1172,19 +1209,21 @@ class NumberModel extends VisualizerBase {
|
|
|
1172
1209
|
this.chartTypes = this._chartAdapter.getChartTypes();
|
|
1173
1210
|
this.chartType = this.chartTypes[0];
|
|
1174
1211
|
}
|
|
1175
|
-
this.
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
return {
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
this.
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1212
|
+
if (this.options.allowChangeVisualizerType !== false) {
|
|
1213
|
+
this.registerToolbarItem("changeChartType", () => {
|
|
1214
|
+
if (this.chartTypes.length > 1) {
|
|
1215
|
+
return DocumentHelper.createSelector(this.chartTypes.map((chartType) => {
|
|
1216
|
+
return {
|
|
1217
|
+
value: chartType,
|
|
1218
|
+
text: localization.getString("chartType_" + chartType),
|
|
1219
|
+
};
|
|
1220
|
+
}), (option) => this.chartType === option.value, (e) => {
|
|
1221
|
+
this.setChartType(e.target.value);
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
return null;
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1188
1227
|
}
|
|
1189
1228
|
onDataChanged() {
|
|
1190
1229
|
this._resultAverage = undefined;
|
|
@@ -1383,19 +1422,21 @@ class SelectBase extends VisualizerBase {
|
|
|
1383
1422
|
this._chartType = this.options.defaultChartType;
|
|
1384
1423
|
}
|
|
1385
1424
|
}
|
|
1386
|
-
this.
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
return {
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
this.
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1425
|
+
if (this.options.allowChangeVisualizerType !== false) {
|
|
1426
|
+
this.registerToolbarItem("changeChartType", () => {
|
|
1427
|
+
if (this.chartTypes.length > 1) {
|
|
1428
|
+
return DocumentHelper.createSelector(this.chartTypes.map((chartType) => {
|
|
1429
|
+
return {
|
|
1430
|
+
value: chartType,
|
|
1431
|
+
text: localization.getString("chartType_" + chartType),
|
|
1432
|
+
};
|
|
1433
|
+
}), (option) => this.chartType === option.value, (e) => {
|
|
1434
|
+
this.setChartType(e.target.value);
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
return null;
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1399
1440
|
this.registerToolbarItem("changeAnswersOrder", () => {
|
|
1400
1441
|
if (this.isSupportAnswersOrder()) {
|
|
1401
1442
|
this.choicesOrderSelector = DocumentHelper.createSelector([
|
|
@@ -2664,7 +2705,7 @@ class AlternativeVisualizersWrapper extends VisualizerBase {
|
|
|
2664
2705
|
}
|
|
2665
2706
|
}
|
|
2666
2707
|
constructor(visualizers, question, data, options) {
|
|
2667
|
-
super(question, data, options);
|
|
2708
|
+
super(question, data, options, "alternative");
|
|
2668
2709
|
this.visualizers = visualizers;
|
|
2669
2710
|
this.visualizersWithSelection = [];
|
|
2670
2711
|
this.onAfterVisualizerRenderCallback = () => {
|
|
@@ -2690,12 +2731,14 @@ class AlternativeVisualizersWrapper extends VisualizerBase {
|
|
|
2690
2731
|
this.visualizersWithSelection.push(visualizer);
|
|
2691
2732
|
}
|
|
2692
2733
|
});
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2734
|
+
if (this.options.allowChangeVisualizerType !== false) {
|
|
2735
|
+
this.registerToolbarItem("changeVisualizer", () => this.visualizerSelector = DocumentHelper.createSelector(this.visualizers.map((visualizer) => {
|
|
2736
|
+
return {
|
|
2737
|
+
value: visualizer.type,
|
|
2738
|
+
text: localization.getString("visualizer_" + visualizer.type),
|
|
2739
|
+
};
|
|
2740
|
+
}), (option) => this.visualizer.type === option.value, (e) => this.setVisualizer(e.target.value)), 0);
|
|
2741
|
+
}
|
|
2699
2742
|
this.visualizer = visualizers[0];
|
|
2700
2743
|
this.visualizer.onAfterRender.add(this.onAfterVisualizerRenderCallback);
|
|
2701
2744
|
this.visualizer.onStateChanged.add(this.onVisualizerStateChangedCallback);
|
|
@@ -9886,7 +9929,7 @@ class VisualizationPanel extends VisualizerBase {
|
|
|
9886
9929
|
options.layoutEngine ||
|
|
9887
9930
|
new MuuriLayoutEngine(this.allowDynamicLayout, "." + questionLayoutedElementClassName, this.allowDragDrop);
|
|
9888
9931
|
this._layoutEngine.onMoveCallback = (order) => this.reorderVisibleElements(order);
|
|
9889
|
-
this.showToolbar =
|
|
9932
|
+
this.showToolbar = isRoot;
|
|
9890
9933
|
if (this.options.survey) {
|
|
9891
9934
|
localization.currentLocale = this.options.survey.locale;
|
|
9892
9935
|
}
|
|
@@ -9894,6 +9937,7 @@ class VisualizationPanel extends VisualizerBase {
|
|
|
9894
9937
|
this._elements = this.buildElements(questions);
|
|
9895
9938
|
}
|
|
9896
9939
|
this.buildVisualizers(questions);
|
|
9940
|
+
this.updateData(this.surveyData);
|
|
9897
9941
|
if (!this.haveCommercialLicense && this.isRoot) {
|
|
9898
9942
|
this.registerToolbarItem("commercialLicense", () => {
|
|
9899
9943
|
return createCommercialLicenseLink();
|
|
@@ -10145,7 +10189,7 @@ class VisualizationPanel extends VisualizerBase {
|
|
|
10145
10189
|
question = Array.isArray(question) ? question[0] : question;
|
|
10146
10190
|
const element = this.getElement(question.name);
|
|
10147
10191
|
if (!!element) {
|
|
10148
|
-
element.displayName = this.
|
|
10192
|
+
element.displayName = this.getTitle(question);
|
|
10149
10193
|
}
|
|
10150
10194
|
});
|
|
10151
10195
|
this.visualizers.forEach(v => {
|
|
@@ -10192,7 +10236,7 @@ class VisualizationPanel extends VisualizerBase {
|
|
|
10192
10236
|
question = Array.isArray(question) ? question[0] : question;
|
|
10193
10237
|
return {
|
|
10194
10238
|
name: question.name,
|
|
10195
|
-
displayName: this.
|
|
10239
|
+
displayName: this.getTitle(question),
|
|
10196
10240
|
isVisible: true,
|
|
10197
10241
|
isPublic: true,
|
|
10198
10242
|
};
|
|
@@ -10458,34 +10502,27 @@ class VisualizationPanelDynamic extends VisualizerBase {
|
|
|
10458
10502
|
};
|
|
10459
10503
|
this.loadingData = false;
|
|
10460
10504
|
var options = Object.assign({}, options);
|
|
10505
|
+
options.allowHideQuestions = false;
|
|
10461
10506
|
options.allowDynamicLayout = false;
|
|
10462
10507
|
options.dataProvider = undefined;
|
|
10508
|
+
options.dataPath = this.dataNames[0];
|
|
10463
10509
|
this._panelVisualizer = new VisualizationPanel(this.getQuestions(), [], options, undefined, false);
|
|
10464
10510
|
this._panelVisualizer.onAfterRender.add(this.onAfterRenderPanelCallback);
|
|
10465
10511
|
this.updateData(data);
|
|
10466
10512
|
}
|
|
10513
|
+
get contentVisualizer() {
|
|
10514
|
+
return this._panelVisualizer;
|
|
10515
|
+
}
|
|
10467
10516
|
setLocale(newLocale) {
|
|
10468
10517
|
super.setLocale(newLocale);
|
|
10469
10518
|
this._panelVisualizer.locale = newLocale;
|
|
10470
10519
|
}
|
|
10471
|
-
get type() {
|
|
10472
|
-
return "panelDynamic";
|
|
10473
|
-
}
|
|
10474
|
-
updatePanelVisualizerData() {
|
|
10475
|
-
let panelData = [];
|
|
10476
|
-
this.data.forEach((dataItem) => {
|
|
10477
|
-
if (dataItem[this.question.name] !== undefined) {
|
|
10478
|
-
panelData = panelData.concat(dataItem[this.question.name]);
|
|
10479
|
-
}
|
|
10480
|
-
});
|
|
10481
|
-
this._panelVisualizer.updateData(panelData);
|
|
10482
|
-
}
|
|
10483
10520
|
updateData(data) {
|
|
10484
10521
|
super.updateData(data);
|
|
10485
|
-
this.
|
|
10522
|
+
this._panelVisualizer.updateData(data);
|
|
10486
10523
|
}
|
|
10487
10524
|
onDataChanged() {
|
|
10488
|
-
this.
|
|
10525
|
+
this._panelVisualizer.updateData(this.dataProvider.filteredData);
|
|
10489
10526
|
super.onDataChanged();
|
|
10490
10527
|
}
|
|
10491
10528
|
getQuestions() {
|
|
@@ -10507,11 +10544,8 @@ class VisualizationPanelDynamic extends VisualizerBase {
|
|
|
10507
10544
|
VisualizationManager.registerVisualizer("paneldynamic", VisualizationPanelDynamic);
|
|
10508
10545
|
|
|
10509
10546
|
class VisualizationMatrixDynamic extends VisualizationPanelDynamic {
|
|
10510
|
-
constructor(question, data, options) {
|
|
10511
|
-
super(question, data, options);
|
|
10512
|
-
}
|
|
10513
|
-
get type() {
|
|
10514
|
-
return "matrixDynamic";
|
|
10547
|
+
constructor(question, data, options, name) {
|
|
10548
|
+
super(question, data, options, name || "matrixDynamic");
|
|
10515
10549
|
}
|
|
10516
10550
|
getQuestions() {
|
|
10517
10551
|
const matrixdynamic = this.question;
|
|
@@ -10619,6 +10653,19 @@ class VisualizationMatrixDropdown extends VisualizerBase {
|
|
|
10619
10653
|
}
|
|
10620
10654
|
VisualizationManager.registerVisualizer("matrixdropdown", VisualizationMatrixDropdown);
|
|
10621
10655
|
|
|
10656
|
+
class VisualizationComposite extends VisualizationPanelDynamic {
|
|
10657
|
+
constructor(question, data, options, name) {
|
|
10658
|
+
super(question, data, options, name || "composite");
|
|
10659
|
+
}
|
|
10660
|
+
getQuestions() {
|
|
10661
|
+
const matrixdynamic = this.question;
|
|
10662
|
+
const innerQuestions = [];
|
|
10663
|
+
matrixdynamic.contentPanel.addQuestionsToList(innerQuestions);
|
|
10664
|
+
return innerQuestions;
|
|
10665
|
+
}
|
|
10666
|
+
}
|
|
10667
|
+
VisualizationManager.registerVisualizer("composite", VisualizationComposite);
|
|
10668
|
+
|
|
10622
10669
|
var stopWords$3 = [
|
|
10623
10670
|
"...",
|
|
10624
10671
|
"a",
|
|
@@ -12627,5 +12674,5 @@ NpsVisualizer.DetractorScore = 6;
|
|
|
12627
12674
|
NpsVisualizer.PromoterScore = 9;
|
|
12628
12675
|
// VisualizationManager.registerVisualizer("rating", NpsVisualizer);
|
|
12629
12676
|
|
|
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,
|
|
12677
|
+
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, VisualizationComposite as g, hideEmptyAnswersInData as h, WordCloud as i, Text as j, StatisticsTableAdapter as k, StatisticsTable as l, StatisticsTableBoolean as m, NpsVisualizerWidget as n, NpsAdapter as o, NpsVisualizer as p, PivotModel as q, defaultStatisticsCalculator as r, textHelper as t };
|
|
12631
12678
|
//# sourceMappingURL=shared2.mjs.map
|