survey-analytics 2.0.1 → 2.0.2
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.js +1 -1
- package/fesm/survey.analytics.js +71 -43
- package/fesm/survey.analytics.js.map +1 -1
- package/fesm/survey.analytics.tabulator.js +1 -1
- package/package.json +2 -2
- package/survey-analytics.types/plotly/selectBase.d.ts +2 -0
- package/survey-analytics.types/visualizationPanel.d.ts +1 -0
- package/survey-analytics.types/visualizerBase.d.ts +5 -0
- package/survey.analytics.css +1 -1
- package/survey.analytics.js +88 -46
- 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 +1 -1
- package/survey.analytics.tabulator.min.css +1 -1
- package/survey.analytics.tabulator.min.js.LICENSE.txt +1 -1
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"lint": "eslint ./src --quiet",
|
|
18
18
|
"pre-push-check": "npm run lint && npm run test"
|
|
19
19
|
},
|
|
20
|
-
"version": "2.0.
|
|
20
|
+
"version": "2.0.2",
|
|
21
21
|
"name": "survey-analytics",
|
|
22
22
|
"description": "SurveyJS analytics Library.",
|
|
23
23
|
"main": "survey.analytics.js",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"@types/plotly.js-dist-min": "^2.3.0",
|
|
90
90
|
"@types/tabulator-tables": "^6.2.3",
|
|
91
|
-
"survey-core": "2.0.
|
|
91
|
+
"survey-core": "2.0.2"
|
|
92
92
|
},
|
|
93
93
|
"husky": {
|
|
94
94
|
"hooks": {
|
|
@@ -7,6 +7,7 @@ export declare class PlotlyChartAdapter {
|
|
|
7
7
|
protected patchConfigParameters(chartNode: object, traces: Array<object>, layout: object, config: object): void;
|
|
8
8
|
get chart(): Promise<Plotly.PlotlyHTMLElement>;
|
|
9
9
|
create(chartNode: HTMLElement): Promise<any>;
|
|
10
|
+
update(chartNode: HTMLElement): Promise<any>;
|
|
10
11
|
destroy(node: HTMLElement): void;
|
|
11
12
|
}
|
|
12
13
|
export declare class SelectBasePlotly extends SelectBase {
|
|
@@ -20,5 +21,6 @@ export declare class SelectBasePlotly extends SelectBase {
|
|
|
20
21
|
}, name?: string);
|
|
21
22
|
protected destroyContent(container: HTMLElement): void;
|
|
22
23
|
protected renderContentAsync(container: HTMLElement): Promise<HTMLElement>;
|
|
24
|
+
updateContent(): void;
|
|
23
25
|
protected getCalculatedValuesCore(): Array<any>;
|
|
24
26
|
}
|
|
@@ -271,6 +271,7 @@ export declare class VisualizationPanel extends VisualizerBase {
|
|
|
271
271
|
**/
|
|
272
272
|
onAlternativeVisualizerChanged: Event<(sender: AlternativeVisualizersWrapper, options: any) => any, AlternativeVisualizersWrapper, any>;
|
|
273
273
|
private onAlternativeVisualizerChangedCallback;
|
|
274
|
+
protected onDataChanged(): void;
|
|
274
275
|
protected showElementCore(element: IVisualizerPanelRenderedElement, elementIndex?: number): void;
|
|
275
276
|
showElement(elementName: string): void;
|
|
276
277
|
protected hideElementCore(element: IVisualizerPanelRenderedElement): void;
|
|
@@ -10,6 +10,10 @@ export interface IDataInfo {
|
|
|
10
10
|
getSeriesValues(): Array<string>;
|
|
11
11
|
getSeriesLabels(): Array<string>;
|
|
12
12
|
}
|
|
13
|
+
export declare class PostponeHelper {
|
|
14
|
+
static postponeFunction: (fn: () => void, timeout?: number) => any;
|
|
15
|
+
static postpone(fn: () => void, timeout?: number): any;
|
|
16
|
+
}
|
|
13
17
|
/**
|
|
14
18
|
* A base object for all visualizers. Use it to implement a custom visualizer.
|
|
15
19
|
*
|
|
@@ -249,6 +253,7 @@ export declare class VisualizerBase implements IDataInfo {
|
|
|
249
253
|
* @param targetElement An `HTMLElement` or an `id` of a page element in which you want to render the visualizer.
|
|
250
254
|
*/
|
|
251
255
|
render(targetElement: HTMLElement | string): void;
|
|
256
|
+
updateContent(): void;
|
|
252
257
|
/**
|
|
253
258
|
* Re-renders the visualizer and its content.
|
|
254
259
|
*/
|
package/survey.analytics.css
CHANGED
package/survey.analytics.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.0.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.0.2
|
|
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
|
*/
|
|
@@ -10335,48 +10335,13 @@ var PlotlyChartAdapter = /** @class */ (function () {
|
|
|
10335
10335
|
});
|
|
10336
10336
|
PlotlyChartAdapter.prototype.create = function (chartNode) {
|
|
10337
10337
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
10338
|
-
var
|
|
10338
|
+
var _a, plot, plotlyOptions, getDragLayer;
|
|
10339
10339
|
var _this = this;
|
|
10340
|
-
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (
|
|
10341
|
-
switch (
|
|
10342
|
-
case 0: return [4 /*yield*/, this.
|
|
10340
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) {
|
|
10341
|
+
switch (_b.label) {
|
|
10342
|
+
case 0: return [4 /*yield*/, this.update(chartNode)];
|
|
10343
10343
|
case 1:
|
|
10344
|
-
|
|
10345
|
-
plotlyOptions = _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.setup(this.model.chartType, this.model, answersData);
|
|
10346
|
-
config = {
|
|
10347
|
-
displaylogo: false,
|
|
10348
|
-
responsive: true,
|
|
10349
|
-
locale: _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.currentLocale,
|
|
10350
|
-
modeBarButtonsToRemove: ["toImage"],
|
|
10351
|
-
modeBarButtonsToAdd: [
|
|
10352
|
-
{
|
|
10353
|
-
name: "toImageSjs",
|
|
10354
|
-
title: _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.getString("saveDiagramAsPNG"),
|
|
10355
|
-
icon: (plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().Icons).camera,
|
|
10356
|
-
click: function (gd) {
|
|
10357
|
-
var options = {
|
|
10358
|
-
format: _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.imageExportFormat,
|
|
10359
|
-
// width: 800,
|
|
10360
|
-
// height: 600,
|
|
10361
|
-
filename: _this.model.question.name,
|
|
10362
|
-
};
|
|
10363
|
-
_setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.onImageSaving.fire(_this.model, options);
|
|
10364
|
-
plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().downloadImage(gd, options);
|
|
10365
|
-
},
|
|
10366
|
-
},
|
|
10367
|
-
],
|
|
10368
|
-
};
|
|
10369
|
-
if (SelectBasePlotly.displayModeBar !== undefined) {
|
|
10370
|
-
config.displayModeBar = SelectBasePlotly.displayModeBar;
|
|
10371
|
-
}
|
|
10372
|
-
this.patchConfigParameters(chartNode, plotlyOptions.traces, plotlyOptions.layout, config);
|
|
10373
|
-
options = {
|
|
10374
|
-
traces: plotlyOptions.traces,
|
|
10375
|
-
layout: plotlyOptions.layout,
|
|
10376
|
-
config: config,
|
|
10377
|
-
};
|
|
10378
|
-
_setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.onPlotCreating.fire(this.model, options);
|
|
10379
|
-
plot = plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().newPlot(chartNode, options.traces, options.layout, options.config);
|
|
10344
|
+
_a = _b.sent(), plot = _a[0], plotlyOptions = _a[1];
|
|
10380
10345
|
chartNode["on"]("plotly_click", function (data) {
|
|
10381
10346
|
var _a;
|
|
10382
10347
|
if (data.points.length > 0) {
|
|
@@ -10425,6 +10390,55 @@ var PlotlyChartAdapter = /** @class */ (function () {
|
|
|
10425
10390
|
});
|
|
10426
10391
|
});
|
|
10427
10392
|
};
|
|
10393
|
+
PlotlyChartAdapter.prototype.update = function (chartNode) {
|
|
10394
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
|
|
10395
|
+
var answersData, plotlyOptions, config, options, plot;
|
|
10396
|
+
var _this = this;
|
|
10397
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
|
|
10398
|
+
switch (_a.label) {
|
|
10399
|
+
case 0: return [4 /*yield*/, this.model.getAnswersData()];
|
|
10400
|
+
case 1:
|
|
10401
|
+
answersData = _a.sent();
|
|
10402
|
+
plotlyOptions = _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.setup(this.model.chartType, this.model, answersData);
|
|
10403
|
+
config = {
|
|
10404
|
+
displaylogo: false,
|
|
10405
|
+
responsive: true,
|
|
10406
|
+
locale: _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.currentLocale,
|
|
10407
|
+
modeBarButtonsToRemove: ["toImage"],
|
|
10408
|
+
modeBarButtonsToAdd: [
|
|
10409
|
+
{
|
|
10410
|
+
name: "toImageSjs",
|
|
10411
|
+
title: _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.getString("saveDiagramAsPNG"),
|
|
10412
|
+
icon: (plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().Icons).camera,
|
|
10413
|
+
click: function (gd) {
|
|
10414
|
+
var options = {
|
|
10415
|
+
format: _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.imageExportFormat,
|
|
10416
|
+
// width: 800,
|
|
10417
|
+
// height: 600,
|
|
10418
|
+
filename: _this.model.question.name,
|
|
10419
|
+
};
|
|
10420
|
+
_setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.onImageSaving.fire(_this.model, options);
|
|
10421
|
+
plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().downloadImage(gd, options);
|
|
10422
|
+
},
|
|
10423
|
+
},
|
|
10424
|
+
],
|
|
10425
|
+
};
|
|
10426
|
+
if (SelectBasePlotly.displayModeBar !== undefined) {
|
|
10427
|
+
config.displayModeBar = SelectBasePlotly.displayModeBar;
|
|
10428
|
+
}
|
|
10429
|
+
this.patchConfigParameters(chartNode, plotlyOptions.traces, plotlyOptions.layout, config);
|
|
10430
|
+
options = {
|
|
10431
|
+
traces: plotlyOptions.traces,
|
|
10432
|
+
layout: plotlyOptions.layout,
|
|
10433
|
+
config: config,
|
|
10434
|
+
};
|
|
10435
|
+
_setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.onPlotCreating.fire(this.model, options);
|
|
10436
|
+
plot = plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().react(chartNode, options.traces, options.layout, options.config);
|
|
10437
|
+
return [2 /*return*/, [plot, plotlyOptions]];
|
|
10438
|
+
}
|
|
10439
|
+
});
|
|
10440
|
+
});
|
|
10441
|
+
};
|
|
10428
10442
|
PlotlyChartAdapter.prototype.destroy = function (node) {
|
|
10429
10443
|
if (!!node) {
|
|
10430
10444
|
plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().purge(node);
|
|
@@ -10474,6 +10488,13 @@ var SelectBasePlotly = /** @class */ (function (_super) {
|
|
|
10474
10488
|
});
|
|
10475
10489
|
});
|
|
10476
10490
|
};
|
|
10491
|
+
SelectBasePlotly.prototype.updateContent = function () {
|
|
10492
|
+
var _a;
|
|
10493
|
+
var chartNode = (_a = this.contentContainer) === null || _a === void 0 ? void 0 : _a.children[0];
|
|
10494
|
+
if (chartNode) {
|
|
10495
|
+
this._chartAdapter.update(chartNode);
|
|
10496
|
+
}
|
|
10497
|
+
};
|
|
10477
10498
|
SelectBasePlotly.prototype.getCalculatedValuesCore = function () {
|
|
10478
10499
|
var statistics = _super.prototype.getCalculatedValuesCore.call(this);
|
|
10479
10500
|
var series = this.getSeriesValues();
|
|
@@ -12817,6 +12838,8 @@ var VisualizationPanel = /** @class */ (function (_super) {
|
|
|
12817
12838
|
this._elements = newElements;
|
|
12818
12839
|
this.visibleElementsChanged(undefined, "REORDERED");
|
|
12819
12840
|
};
|
|
12841
|
+
VisualizationPanel.prototype.onDataChanged = function () {
|
|
12842
|
+
};
|
|
12820
12843
|
VisualizationPanel.prototype.showElementCore = function (element, elementIndex) {
|
|
12821
12844
|
if (elementIndex === void 0) { elementIndex = -1; }
|
|
12822
12845
|
element.isVisible = true;
|
|
@@ -13423,6 +13446,7 @@ _visualizationManager__WEBPACK_IMPORTED_MODULE_2__.VisualizationManager.register
|
|
|
13423
13446
|
"use strict";
|
|
13424
13447
|
__webpack_require__.r(__webpack_exports__);
|
|
13425
13448
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13449
|
+
/* harmony export */ PostponeHelper: () => (/* binding */ PostponeHelper),
|
|
13426
13450
|
/* harmony export */ VisualizerBase: () => (/* binding */ VisualizerBase),
|
|
13427
13451
|
/* harmony export */ defaultStatisticsCalculator: () => (/* binding */ defaultStatisticsCalculator)
|
|
13428
13452
|
/* harmony export */ });
|
|
@@ -13442,6 +13466,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13442
13466
|
|
|
13443
13467
|
|
|
13444
13468
|
|
|
13469
|
+
var PostponeHelper = /** @class */ (function () {
|
|
13470
|
+
function PostponeHelper() {
|
|
13471
|
+
}
|
|
13472
|
+
PostponeHelper.postpone = function (fn, timeout) {
|
|
13473
|
+
if (PostponeHelper.postponeFunction) {
|
|
13474
|
+
return PostponeHelper.postponeFunction(fn, timeout);
|
|
13475
|
+
}
|
|
13476
|
+
else {
|
|
13477
|
+
return setTimeout(fn, timeout);
|
|
13478
|
+
}
|
|
13479
|
+
};
|
|
13480
|
+
return PostponeHelper;
|
|
13481
|
+
}());
|
|
13482
|
+
|
|
13445
13483
|
/**
|
|
13446
13484
|
* A base object for all visualizers. Use it to implement a custom visualizer.
|
|
13447
13485
|
*
|
|
@@ -13951,27 +13989,30 @@ var VisualizerBase = /** @class */ (function () {
|
|
|
13951
13989
|
targetElement.appendChild(this.footerContainer);
|
|
13952
13990
|
this.renderFooter(this.footerContainer);
|
|
13953
13991
|
};
|
|
13992
|
+
VisualizerBase.prototype.updateContent = function () {
|
|
13993
|
+
this.destroyContent(this.contentContainer);
|
|
13994
|
+
this.renderContent(this.contentContainer);
|
|
13995
|
+
};
|
|
13954
13996
|
/**
|
|
13955
13997
|
* Re-renders the visualizer and its content.
|
|
13956
13998
|
*/
|
|
13957
13999
|
VisualizerBase.prototype.refresh = function () {
|
|
13958
14000
|
var _this = this;
|
|
13959
14001
|
if (!!this.headerContainer) {
|
|
13960
|
-
|
|
14002
|
+
PostponeHelper.postpone(function () {
|
|
13961
14003
|
_this.destroyHeader(_this.headerContainer);
|
|
13962
14004
|
_this.renderHeader(_this.headerContainer);
|
|
13963
14005
|
_this.invokeOnUpdate();
|
|
13964
14006
|
});
|
|
13965
14007
|
}
|
|
13966
14008
|
if (!!this.contentContainer) {
|
|
13967
|
-
|
|
13968
|
-
_this.
|
|
13969
|
-
_this.renderContent(_this.contentContainer);
|
|
14009
|
+
PostponeHelper.postpone(function () {
|
|
14010
|
+
_this.updateContent();
|
|
13970
14011
|
_this.invokeOnUpdate();
|
|
13971
14012
|
});
|
|
13972
14013
|
}
|
|
13973
14014
|
if (!!this.footerContainer) {
|
|
13974
|
-
|
|
14015
|
+
PostponeHelper.postpone(function () {
|
|
13975
14016
|
_this.destroyFooter(_this.footerContainer);
|
|
13976
14017
|
_this.renderFooter(_this.footerContainer);
|
|
13977
14018
|
_this.invokeOnUpdate();
|
|
@@ -16264,6 +16305,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
16264
16305
|
/* harmony export */ PlotlyChartAdapter: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_27__.PlotlyChartAdapter),
|
|
16265
16306
|
/* harmony export */ PlotlyGaugeAdapter: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_27__.PlotlyGaugeAdapter),
|
|
16266
16307
|
/* harmony export */ PlotlySetup: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_27__.PlotlySetup),
|
|
16308
|
+
/* harmony export */ PostponeHelper: () => (/* reexport safe */ _visualizerBase__WEBPACK_IMPORTED_MODULE_20__.PostponeHelper),
|
|
16267
16309
|
/* harmony export */ RankingPlotly: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_27__.RankingPlotly),
|
|
16268
16310
|
/* harmony export */ SelectBase: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_16__.SelectBase),
|
|
16269
16311
|
/* harmony export */ SelectBasePlotly: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_27__.SelectBasePlotly),
|