survey-analytics 2.0.0 → 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/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.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.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
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v2.0.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
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v2.0.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
  */
@@ -7277,14 +7277,14 @@ __webpack_require__.r(__webpack_exports__);
7277
7277
  // These strings are commented out. Uncomment and edit them if you want to add your translations.
7278
7278
 
7279
7279
  var dutchStrings = {
7280
- groupButton: "Groep door mij",
7281
- ungroupButton: "Degroeperen bij mij",
7280
+ groupButton: "Groeperen op",
7281
+ ungroupButton: "Groepering verwijderen",
7282
7282
  selectButton: "Selecteer mij",
7283
7283
  hideColumn: "Kolom verbergen",
7284
7284
  showColumn: "Toon kolom",
7285
7285
  makePrivateColumn: "Kolom privé maken",
7286
- makePublicColumn: "Maak de kolom openbaar",
7287
- moveToDetail: "Ga naar Detail",
7286
+ makePublicColumn: "Maak kolom openbaar",
7287
+ moveToDetail: "Ga naar detail",
7288
7288
  showAsColumn: "Weergeven als kolom",
7289
7289
  filterPlaceholder: "Zoeken...",
7290
7290
  removeRows: "Verwijder rijen",
@@ -7294,17 +7294,17 @@ var dutchStrings = {
7294
7294
  visualizer_wordcloud: "Wordcloud",
7295
7295
  visualizer_histogram: "Histogram",
7296
7296
  visualizer_number: "Gemiddeld",
7297
- visualizer_choices: "Tafel",
7298
- visualizer_selectBase: "Zeekaart",
7297
+ visualizer_choices: "Tabel",
7298
+ visualizer_selectBase: "Grafiek",
7299
7299
  // visualizer_matrix: "Chart",
7300
- chartType_bar: "Bar",
7301
- chartType_vbar: "Verticale balk",
7302
- chartType_stackedbar: "Gestapelde Bar",
7300
+ chartType_bar: "Staafdiagram (liggend)",
7301
+ chartType_vbar: "Staafdiagram",
7302
+ chartType_stackedbar: "Staafdiagram (gestapeld)",
7303
7303
  chartType_doughnut: "Donut",
7304
- chartType_pie: "Taart",
7305
- chartType_scatter: "Verstrooien",
7306
- chartType_gauge: "Meter",
7307
- chartType_bullet: "Kogel",
7304
+ chartType_pie: "Cirkeldiagram",
7305
+ chartType_scatter: "Spreidingsdiagram",
7306
+ chartType_gauge: "Meterdiagram",
7307
+ chartType_bullet: "Kogelgrafiek",
7308
7308
  hideButton: "Verbergen",
7309
7309
  makePrivateButton: "Maak prive",
7310
7310
  makePublicButton: "Openbaar maken",
@@ -7312,7 +7312,7 @@ var dutchStrings = {
7312
7312
  filter: "Filter",
7313
7313
  resetFilter: "Filter resetten",
7314
7314
  changeLocale: "Wijzig de landinstelling",
7315
- clearButton: "Doorzichtig",
7315
+ clearButton: "Wissen",
7316
7316
  addElement: "Kies een vraag om weer te geven ...",
7317
7317
  defaultOrder: "Standaardvolgorde",
7318
7318
  ascOrder: "Oplopend",
@@ -7324,7 +7324,7 @@ var dutchStrings = {
7324
7324
  pdfDownloadCaption: "PDF",
7325
7325
  xlsxDownloadCaption: "Excel",
7326
7326
  csvDownloadCaption: "CSV",
7327
- saveDiagramAsPNG: "Download plot als een png",
7327
+ saveDiagramAsPNG: "Download plot als PNG",
7328
7328
  hideEmptyAnswers: "Verberg lege antwoorden",
7329
7329
  showEmptyAnswers: "Toon lege antwoorden",
7330
7330
  "topNValueText-1": "Alle antwoorden",
@@ -7350,9 +7350,6 @@ _localizationManager__WEBPACK_IMPORTED_MODULE_0__.localization.localeNames["nl"]
7350
7350
  // Remove those strings that you have corrected manually
7351
7351
  // undefined.visualizer_histogram: "Histogram" => "Histogram"
7352
7352
  // undefined.visualizer_number: "Average" => "Gemiddeld"
7353
- // undefined.visualizer_choices: "Table" => "Tafel"
7354
- // undefined.visualizer_selectBase: "Chart" => "Zeekaart"
7355
- // undefined.chartType_vbar: "Vertical Bar" => "Verticale balk"
7356
7353
  // undefined.filter: "Filter" => "Filter"
7357
7354
  // undefined.hideMissingAnswers: "Hide missing answers" => "Ontbrekende antwoorden verbergen"
7358
7355
  // undefined.showMissingAnswers: "Show missing answers" => "Ontbrekende antwoorden weergeven"
@@ -10338,48 +10335,13 @@ var PlotlyChartAdapter = /** @class */ (function () {
10338
10335
  });
10339
10336
  PlotlyChartAdapter.prototype.create = function (chartNode) {
10340
10337
  return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () {
10341
- var answersData, plotlyOptions, config, options, plot, getDragLayer;
10338
+ var _a, plot, plotlyOptions, getDragLayer;
10342
10339
  var _this = this;
10343
- return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) {
10344
- switch (_a.label) {
10345
- case 0: return [4 /*yield*/, this.model.getAnswersData()];
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)];
10346
10343
  case 1:
10347
- answersData = _a.sent();
10348
- plotlyOptions = _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.setup(this.model.chartType, this.model, answersData);
10349
- config = {
10350
- displaylogo: false,
10351
- responsive: true,
10352
- locale: _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.currentLocale,
10353
- modeBarButtonsToRemove: ["toImage"],
10354
- modeBarButtonsToAdd: [
10355
- {
10356
- name: "toImageSjs",
10357
- title: _localizationManager__WEBPACK_IMPORTED_MODULE_5__.localization.getString("saveDiagramAsPNG"),
10358
- icon: (plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().Icons).camera,
10359
- click: function (gd) {
10360
- var options = {
10361
- format: _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.imageExportFormat,
10362
- // width: 800,
10363
- // height: 600,
10364
- filename: _this.model.question.name,
10365
- };
10366
- _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.onImageSaving.fire(_this.model, options);
10367
- plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().downloadImage(gd, options);
10368
- },
10369
- },
10370
- ],
10371
- };
10372
- if (SelectBasePlotly.displayModeBar !== undefined) {
10373
- config.displayModeBar = SelectBasePlotly.displayModeBar;
10374
- }
10375
- this.patchConfigParameters(chartNode, plotlyOptions.traces, plotlyOptions.layout, config);
10376
- options = {
10377
- traces: plotlyOptions.traces,
10378
- layout: plotlyOptions.layout,
10379
- config: config,
10380
- };
10381
- _setup__WEBPACK_IMPORTED_MODULE_7__.PlotlySetup.onPlotCreating.fire(this.model, options);
10382
- 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];
10383
10345
  chartNode["on"]("plotly_click", function (data) {
10384
10346
  var _a;
10385
10347
  if (data.points.length > 0) {
@@ -10428,6 +10390,55 @@ var PlotlyChartAdapter = /** @class */ (function () {
10428
10390
  });
10429
10391
  });
10430
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
+ };
10431
10442
  PlotlyChartAdapter.prototype.destroy = function (node) {
10432
10443
  if (!!node) {
10433
10444
  plotly_js_dist_min__WEBPACK_IMPORTED_MODULE_6___default().purge(node);
@@ -10477,6 +10488,13 @@ var SelectBasePlotly = /** @class */ (function (_super) {
10477
10488
  });
10478
10489
  });
10479
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
+ };
10480
10498
  SelectBasePlotly.prototype.getCalculatedValuesCore = function () {
10481
10499
  var statistics = _super.prototype.getCalculatedValuesCore.call(this);
10482
10500
  var series = this.getSeriesValues();
@@ -12820,6 +12838,8 @@ var VisualizationPanel = /** @class */ (function (_super) {
12820
12838
  this._elements = newElements;
12821
12839
  this.visibleElementsChanged(undefined, "REORDERED");
12822
12840
  };
12841
+ VisualizationPanel.prototype.onDataChanged = function () {
12842
+ };
12823
12843
  VisualizationPanel.prototype.showElementCore = function (element, elementIndex) {
12824
12844
  if (elementIndex === void 0) { elementIndex = -1; }
12825
12845
  element.isVisible = true;
@@ -13426,6 +13446,7 @@ _visualizationManager__WEBPACK_IMPORTED_MODULE_2__.VisualizationManager.register
13426
13446
  "use strict";
13427
13447
  __webpack_require__.r(__webpack_exports__);
13428
13448
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13449
+ /* harmony export */ PostponeHelper: () => (/* binding */ PostponeHelper),
13429
13450
  /* harmony export */ VisualizerBase: () => (/* binding */ VisualizerBase),
13430
13451
  /* harmony export */ defaultStatisticsCalculator: () => (/* binding */ defaultStatisticsCalculator)
13431
13452
  /* harmony export */ });
@@ -13445,6 +13466,20 @@ __webpack_require__.r(__webpack_exports__);
13445
13466
 
13446
13467
 
13447
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
+
13448
13483
  /**
13449
13484
  * A base object for all visualizers. Use it to implement a custom visualizer.
13450
13485
  *
@@ -13954,27 +13989,30 @@ var VisualizerBase = /** @class */ (function () {
13954
13989
  targetElement.appendChild(this.footerContainer);
13955
13990
  this.renderFooter(this.footerContainer);
13956
13991
  };
13992
+ VisualizerBase.prototype.updateContent = function () {
13993
+ this.destroyContent(this.contentContainer);
13994
+ this.renderContent(this.contentContainer);
13995
+ };
13957
13996
  /**
13958
13997
  * Re-renders the visualizer and its content.
13959
13998
  */
13960
13999
  VisualizerBase.prototype.refresh = function () {
13961
14000
  var _this = this;
13962
14001
  if (!!this.headerContainer) {
13963
- setTimeout(function () {
14002
+ PostponeHelper.postpone(function () {
13964
14003
  _this.destroyHeader(_this.headerContainer);
13965
14004
  _this.renderHeader(_this.headerContainer);
13966
14005
  _this.invokeOnUpdate();
13967
14006
  });
13968
14007
  }
13969
14008
  if (!!this.contentContainer) {
13970
- setTimeout(function () {
13971
- _this.destroyContent(_this.contentContainer);
13972
- _this.renderContent(_this.contentContainer);
14009
+ PostponeHelper.postpone(function () {
14010
+ _this.updateContent();
13973
14011
  _this.invokeOnUpdate();
13974
14012
  });
13975
14013
  }
13976
14014
  if (!!this.footerContainer) {
13977
- setTimeout(function () {
14015
+ PostponeHelper.postpone(function () {
13978
14016
  _this.destroyFooter(_this.footerContainer);
13979
14017
  _this.renderFooter(_this.footerContainer);
13980
14018
  _this.invokeOnUpdate();
@@ -16267,6 +16305,7 @@ __webpack_require__.r(__webpack_exports__);
16267
16305
  /* harmony export */ PlotlyChartAdapter: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_27__.PlotlyChartAdapter),
16268
16306
  /* harmony export */ PlotlyGaugeAdapter: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_27__.PlotlyGaugeAdapter),
16269
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),
16270
16309
  /* harmony export */ RankingPlotly: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_27__.RankingPlotly),
16271
16310
  /* harmony export */ SelectBase: () => (/* reexport safe */ _selectBase__WEBPACK_IMPORTED_MODULE_16__.SelectBase),
16272
16311
  /* harmony export */ SelectBasePlotly: () => (/* reexport safe */ _plotly_index__WEBPACK_IMPORTED_MODULE_27__.SelectBasePlotly),