survey-analytics 2.2.1 → 2.2.3

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 (48) hide show
  1. package/fesm/shared.mjs +195 -187
  2. package/fesm/shared.mjs.map +1 -1
  3. package/fesm/shared2.mjs +12326 -0
  4. package/fesm/shared2.mjs.map +1 -0
  5. package/fesm/survey.analytics.core.mjs +10 -0
  6. package/fesm/survey.analytics.core.mjs.map +1 -0
  7. package/fesm/survey.analytics.mjs +149 -12063
  8. package/fesm/survey.analytics.mjs.map +1 -1
  9. package/fesm/survey.analytics.tabulator.mjs +3 -3
  10. package/package.json +17 -11
  11. package/survey-analytics-tabulator.types/analytics-localization/english.d.ts +2 -0
  12. package/survey-analytics-tabulator.types/localizationManager.d.ts +2 -0
  13. package/survey-analytics-tabulator.types/utils/index.d.ts +1 -1
  14. package/survey-analytics.types/alternativeVizualizersWrapper.d.ts +2 -0
  15. package/survey-analytics.types/analytics-localization/english.d.ts +2 -0
  16. package/survey-analytics.types/entries/summary.core.d.ts +35 -0
  17. package/survey-analytics.types/entries/summary.d.ts +1 -34
  18. package/survey-analytics.types/localizationManager.d.ts +2 -0
  19. package/survey-analytics.types/matrix.d.ts +0 -1
  20. package/survey-analytics.types/pivot.d.ts +62 -0
  21. package/survey-analytics.types/plotly/histogram.d.ts +0 -1
  22. package/survey-analytics.types/plotly/index.d.ts +1 -0
  23. package/survey-analytics.types/plotly/pivot.d.ts +12 -0
  24. package/survey-analytics.types/plotly/selectBase.d.ts +0 -1
  25. package/survey-analytics.types/selectBase.d.ts +1 -1
  26. package/survey-analytics.types/utils/index.d.ts +1 -1
  27. package/survey-analytics.types/visualizationManager.d.ts +3 -0
  28. package/survey-analytics.types/visualizerBase.d.ts +3 -1
  29. package/survey.analytics.core.css +430 -0
  30. package/survey.analytics.core.css.map +1 -0
  31. package/survey.analytics.core.js +15689 -0
  32. package/survey.analytics.core.js.map +1 -0
  33. package/survey.analytics.core.min.css +10 -0
  34. package/survey.analytics.core.min.js +2 -0
  35. package/survey.analytics.core.min.js.LICENSE.txt +22 -0
  36. package/survey.analytics.css +7 -1
  37. package/survey.analytics.css.map +1 -1
  38. package/survey.analytics.js +875 -316
  39. package/survey.analytics.js.map +1 -1
  40. package/survey.analytics.min.css +2 -2
  41. package/survey.analytics.min.js +1 -1
  42. package/survey.analytics.min.js.LICENSE.txt +1 -1
  43. package/survey.analytics.tabulator.css +1 -1
  44. package/survey.analytics.tabulator.js +10 -2
  45. package/survey.analytics.tabulator.js.map +1 -1
  46. package/survey.analytics.tabulator.min.css +1 -1
  47. package/survey.analytics.tabulator.min.js +1 -1
  48. package/survey.analytics.tabulator.min.js.LICENSE.txt +1 -1
package/fesm/shared.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * surveyjs - SurveyJS Dashboard library v2.2.1
2
+ * surveyjs - SurveyJS Dashboard library v2.2.3
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
  */
@@ -80,6 +80,8 @@ var englishStrings = {
80
80
  npsPromoters: "Promoters",
81
81
  npsPassives: "Passives",
82
82
  npsDetractors: "Detractors",
83
+ axisXSelectorTitle: "X axis:",
84
+ axisYSelectorTitle: "Y axis:"
83
85
  };
84
86
  // Uncomment the lines below if you create a custom dictionary.
85
87
  // Replace "en" with a custom locale code (for example, "fr" or "de"),
@@ -140,6 +142,197 @@ var surveyStrings = englishStrings;
140
142
  localization.locales["en"] = englishStrings;
141
143
  localization.localeNames["en"] = "English";
142
144
 
145
+ class DocumentHelper {
146
+ static createSelector(options, isSelected, handler, title) {
147
+ const selectWrapper = document.createElement("div");
148
+ selectWrapper.className = "sa-question__select-wrapper";
149
+ if (title) {
150
+ const titleElement = DocumentHelper.createElement("span", "sa-question__select-title", {
151
+ innerText: title,
152
+ });
153
+ selectWrapper.appendChild(titleElement);
154
+ }
155
+ const select = document.createElement("select");
156
+ select.className = "sa-question__select";
157
+ options.forEach((option) => {
158
+ let optionElement = DocumentHelper.createElement("option", "", {
159
+ value: option.value,
160
+ text: option.text,
161
+ selected: isSelected(option),
162
+ });
163
+ select.appendChild(optionElement);
164
+ });
165
+ select.onchange = handler;
166
+ selectWrapper.appendChild(select);
167
+ return selectWrapper;
168
+ }
169
+ static createButton(handler, text = "", className = "sa-toolbar__button") {
170
+ const button = DocumentHelper.createElement("span", className, {
171
+ innerText: text,
172
+ onclick: handler,
173
+ });
174
+ return button;
175
+ }
176
+ static createElement(tagName, className = "", attrs) {
177
+ var el = document.createElement(tagName);
178
+ el.className = className;
179
+ if (!!attrs) {
180
+ Object.keys(attrs).forEach(function (key) {
181
+ el[key] = attrs[key];
182
+ });
183
+ }
184
+ return el;
185
+ }
186
+ static createSvgElement(path) {
187
+ const svgElem = document.createElementNS("http://www.w3.org/2000/svg", "svg");
188
+ const useElem = document.createElementNS("http://www.w3.org/2000/svg", "use");
189
+ useElem.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#sa-svg-" + path);
190
+ svgElem.appendChild(useElem);
191
+ return svgElem;
192
+ }
193
+ static createSvgButton(path) {
194
+ const btn = (DocumentHelper.createElement("button", "sa-table__svg-button"));
195
+ btn.appendChild(DocumentHelper.createSvgElement(path));
196
+ return btn;
197
+ }
198
+ static createSvgToggleButton(svgPath1, svPpath2, text1, text2, handler1, handler2, state = "first", className = "sa-toolbar__button sa-toolbar__svg-button") {
199
+ const svg1 = DocumentHelper.createSvgElement(svgPath1);
200
+ const svg2 = DocumentHelper.createSvgElement(svPpath2);
201
+ const button = DocumentHelper.createElement("button", className);
202
+ const toggle = (e) => {
203
+ if (state === "first") {
204
+ state = "second";
205
+ button.title = text2;
206
+ button.removeChild(svg1);
207
+ button.appendChild(svg2);
208
+ handler2(e);
209
+ }
210
+ else if (state === "second") {
211
+ state = "first";
212
+ button.title = text1;
213
+ button.removeChild(svg2);
214
+ button.appendChild(svg1);
215
+ handler1(e);
216
+ }
217
+ };
218
+ if (state === "first") {
219
+ button.title = text1;
220
+ button.appendChild(svg1);
221
+ }
222
+ else if ((state = "second")) {
223
+ button.title = text2;
224
+ button.appendChild(svg2);
225
+ }
226
+ button.onclick = toggle;
227
+ return button;
228
+ }
229
+ static createInput(className, placeholder = "", defaultValue = "") {
230
+ var el = DocumentHelper.createElement("input", className, {
231
+ placeholder: placeholder,
232
+ defaultValue: defaultValue,
233
+ });
234
+ return el;
235
+ }
236
+ }
237
+ function createCommercialLicenseLink() {
238
+ const container = DocumentHelper.createElement("div", "sa-commercial");
239
+ const link = DocumentHelper.createElement("a", "sa-commercial__text", {
240
+ href: "https://www.surveyjs.io/Buy",
241
+ target: "_blank",
242
+ });
243
+ const containerSpan = DocumentHelper.createElement("span", "");
244
+ const icon = DocumentHelper.createSvgElement("noncommercial");
245
+ const textSpan = DocumentHelper.createElement("span", "sa-commercial__product", {
246
+ innerText: "Please purchase a SurveyJS Analytics developer license to use it in your app.",
247
+ });
248
+ container.appendChild(link).appendChild(containerSpan);
249
+ containerSpan.appendChild(icon);
250
+ containerSpan.appendChild(textSpan);
251
+ return container;
252
+ }
253
+ function createLoadingIndicator() {
254
+ const container = DocumentHelper.createElement("div", "sa-data-loading-indicator-panel");
255
+ const loadingIndicator = DocumentHelper.createElement("div", "sa-data-loading-indicator");
256
+ loadingIndicator.innerHTML = `
257
+ <svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
258
+ <g clip-path="url(#clip0_17928_11482)">
259
+ <path d="M32 64C14.36 64 0 49.65 0 32C0 14.35 14.36 0 32 0C49.64 0 64 14.35 64 32C64 49.65 49.64 64 32 64ZM32 4C16.56 4 4 16.56 4 32C4 47.44 16.56 60 32 60C47.44 60 60 47.44 60 32C60 16.56 47.44 4 32 4Z" fill="#E5E5E5"></path>
260
+ <path d="M53.2101 55.2104C52.7001 55.2104 52.1901 55.0104 51.8001 54.6204C51.0201 53.8404 51.0201 52.5704 51.8001 51.7904C57.0901 46.5004 60.0001 39.4704 60.0001 31.9904C60.0001 24.5104 57.0901 17.4804 51.8001 12.1904C51.0201 11.4104 51.0201 10.1404 51.8001 9.36039C52.5801 8.58039 53.8501 8.58039 54.6301 9.36039C60.6701 15.4004 64.0001 23.4404 64.0001 31.9904C64.0001 40.5404 60.6701 48.5704 54.6301 54.6204C54.2401 55.0104 53.7301 55.2104 53.2201 55.2104H53.2101Z" fill="#19B394"></path>
261
+ </g>
262
+ <defs>
263
+ <clipPath id="clip0_17928_11482">
264
+ <rect width="64" height="64" fill="white"></rect>
265
+ </clipPath>
266
+ </defs>
267
+ </svg>
268
+ `;
269
+ container.appendChild(loadingIndicator);
270
+ return container;
271
+ }
272
+ class DataHelper {
273
+ static zipArrays(...arrays) {
274
+ let zipArray = [];
275
+ for (let i = 0; i < arrays[0].length; i++) {
276
+ zipArray[i] = [];
277
+ arrays.forEach((arr) => {
278
+ zipArray[i].push(arr[i]);
279
+ });
280
+ }
281
+ return zipArray;
282
+ }
283
+ static unzipArrays(zipArray) {
284
+ let arrays = [];
285
+ zipArray.forEach((value, i) => {
286
+ value.forEach((val, j) => {
287
+ if (!arrays[j])
288
+ arrays[j] = [];
289
+ arrays[j][i] = val;
290
+ });
291
+ });
292
+ return arrays;
293
+ }
294
+ static sortDictionary(keys, values, desc) {
295
+ let dictionary = this.zipArrays(keys, values);
296
+ let comparator = (a, b, asc = true) => {
297
+ let result = a[1] < b[1] ? 1 : a[1] == b[1] ? 0 : -1;
298
+ return asc ? result : result * -1;
299
+ };
300
+ dictionary.sort((a, b) => {
301
+ return desc ? comparator(a, b, false) : comparator(a, b);
302
+ });
303
+ let keysAndValues = this.unzipArrays(dictionary);
304
+ return { keys: keysAndValues[0], values: keysAndValues[1] };
305
+ }
306
+ static toPercentage(value, maxValue) {
307
+ return (value / maxValue) * 100;
308
+ }
309
+ }
310
+ function createLinksContainer(links) {
311
+ const linksContainer = DocumentHelper.createElement("div");
312
+ links.forEach((link) => {
313
+ linksContainer.appendChild(DocumentHelper.createElement("a", "", {
314
+ innerText: link.name,
315
+ download: link.name,
316
+ href: link.content,
317
+ }));
318
+ });
319
+ return linksContainer;
320
+ }
321
+ function createImagesContainer(links) {
322
+ const linksContainer = DocumentHelper.createElement("div");
323
+ links.forEach((link) => {
324
+ linksContainer.appendChild(DocumentHelper.createElement("img", "", {
325
+ alt: link.name,
326
+ src: link.content,
327
+ }));
328
+ });
329
+ return linksContainer;
330
+ }
331
+ function toPrecision(value, precision = 2) {
332
+ const base = Math.pow(10, precision);
333
+ return Math.round(base * value) / base;
334
+ }
335
+
143
336
  // This dictionary contains 1 untranslated or inherited localization strings.
144
337
  // These strings are commented out. Uncomment and edit them if you want to add your translations.
145
338
  var farsiStrings = {
@@ -1226,191 +1419,6 @@ var finnishStrings = {
1226
1419
  localization.locales["fi"] = finnishStrings;
1227
1420
  localization.localeNames["fi"] = "Suomi";
1228
1421
 
1229
- class DocumentHelper {
1230
- static createSelector(options, isSelected, handler) {
1231
- const selectWrapper = document.createElement("div");
1232
- selectWrapper.className = "sa-question__select-wrapper";
1233
- const select = document.createElement("select");
1234
- select.className = "sa-question__select";
1235
- options.forEach((option) => {
1236
- let optionElement = DocumentHelper.createElement("option", "", {
1237
- value: option.value,
1238
- text: option.text,
1239
- selected: isSelected(option),
1240
- });
1241
- select.appendChild(optionElement);
1242
- });
1243
- select.onchange = handler;
1244
- selectWrapper.appendChild(select);
1245
- return selectWrapper;
1246
- }
1247
- static createButton(handler, text = "", className = "sa-toolbar__button") {
1248
- const button = DocumentHelper.createElement("span", className, {
1249
- innerText: text,
1250
- onclick: handler,
1251
- });
1252
- return button;
1253
- }
1254
- static createElement(tagName, className = "", attrs) {
1255
- var el = document.createElement(tagName);
1256
- el.className = className;
1257
- if (!!attrs) {
1258
- Object.keys(attrs).forEach(function (key) {
1259
- el[key] = attrs[key];
1260
- });
1261
- }
1262
- return el;
1263
- }
1264
- static createSvgElement(path) {
1265
- const svgElem = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1266
- const useElem = document.createElementNS("http://www.w3.org/2000/svg", "use");
1267
- useElem.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#sa-svg-" + path);
1268
- svgElem.appendChild(useElem);
1269
- return svgElem;
1270
- }
1271
- static createSvgButton(path) {
1272
- const btn = (DocumentHelper.createElement("button", "sa-table__svg-button"));
1273
- btn.appendChild(DocumentHelper.createSvgElement(path));
1274
- return btn;
1275
- }
1276
- static createSvgToggleButton(svgPath1, svPpath2, text1, text2, handler1, handler2, state = "first", className = "sa-toolbar__button sa-toolbar__svg-button") {
1277
- const svg1 = DocumentHelper.createSvgElement(svgPath1);
1278
- const svg2 = DocumentHelper.createSvgElement(svPpath2);
1279
- const button = DocumentHelper.createElement("button", className);
1280
- const toggle = (e) => {
1281
- if (state === "first") {
1282
- state = "second";
1283
- button.title = text2;
1284
- button.removeChild(svg1);
1285
- button.appendChild(svg2);
1286
- handler2(e);
1287
- }
1288
- else if (state === "second") {
1289
- state = "first";
1290
- button.title = text1;
1291
- button.removeChild(svg2);
1292
- button.appendChild(svg1);
1293
- handler1(e);
1294
- }
1295
- };
1296
- if (state === "first") {
1297
- button.title = text1;
1298
- button.appendChild(svg1);
1299
- }
1300
- else if ((state = "second")) {
1301
- button.title = text2;
1302
- button.appendChild(svg2);
1303
- }
1304
- button.onclick = toggle;
1305
- return button;
1306
- }
1307
- static createInput(className, placeholder = "", defaultValue = "") {
1308
- var el = DocumentHelper.createElement("input", className, {
1309
- placeholder: placeholder,
1310
- defaultValue: defaultValue,
1311
- });
1312
- return el;
1313
- }
1314
- }
1315
- function createCommercialLicenseLink() {
1316
- const container = DocumentHelper.createElement("div", "sa-commercial");
1317
- const link = DocumentHelper.createElement("a", "sa-commercial__text", {
1318
- href: "https://www.surveyjs.io/Buy",
1319
- target: "_blank",
1320
- });
1321
- const containerSpan = DocumentHelper.createElement("span", "");
1322
- const icon = DocumentHelper.createSvgElement("noncommercial");
1323
- const textSpan = DocumentHelper.createElement("span", "sa-commercial__product", {
1324
- innerText: "Please purchase a SurveyJS Analytics developer license to use it in your app.",
1325
- });
1326
- container.appendChild(link).appendChild(containerSpan);
1327
- containerSpan.appendChild(icon);
1328
- containerSpan.appendChild(textSpan);
1329
- return container;
1330
- }
1331
- function createLoadingIndicator() {
1332
- const container = DocumentHelper.createElement("div", "sa-data-loading-indicator-panel");
1333
- const loadingIndicator = DocumentHelper.createElement("div", "sa-data-loading-indicator");
1334
- loadingIndicator.innerHTML = `
1335
- <svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
1336
- <g clip-path="url(#clip0_17928_11482)">
1337
- <path d="M32 64C14.36 64 0 49.65 0 32C0 14.35 14.36 0 32 0C49.64 0 64 14.35 64 32C64 49.65 49.64 64 32 64ZM32 4C16.56 4 4 16.56 4 32C4 47.44 16.56 60 32 60C47.44 60 60 47.44 60 32C60 16.56 47.44 4 32 4Z" fill="#E5E5E5"></path>
1338
- <path d="M53.2101 55.2104C52.7001 55.2104 52.1901 55.0104 51.8001 54.6204C51.0201 53.8404 51.0201 52.5704 51.8001 51.7904C57.0901 46.5004 60.0001 39.4704 60.0001 31.9904C60.0001 24.5104 57.0901 17.4804 51.8001 12.1904C51.0201 11.4104 51.0201 10.1404 51.8001 9.36039C52.5801 8.58039 53.8501 8.58039 54.6301 9.36039C60.6701 15.4004 64.0001 23.4404 64.0001 31.9904C64.0001 40.5404 60.6701 48.5704 54.6301 54.6204C54.2401 55.0104 53.7301 55.2104 53.2201 55.2104H53.2101Z" fill="#19B394"></path>
1339
- </g>
1340
- <defs>
1341
- <clipPath id="clip0_17928_11482">
1342
- <rect width="64" height="64" fill="white"></rect>
1343
- </clipPath>
1344
- </defs>
1345
- </svg>
1346
- `;
1347
- container.appendChild(loadingIndicator);
1348
- return container;
1349
- }
1350
- class DataHelper {
1351
- static zipArrays(...arrays) {
1352
- let zipArray = [];
1353
- for (let i = 0; i < arrays[0].length; i++) {
1354
- zipArray[i] = [];
1355
- arrays.forEach((arr) => {
1356
- zipArray[i].push(arr[i]);
1357
- });
1358
- }
1359
- return zipArray;
1360
- }
1361
- static unzipArrays(zipArray) {
1362
- let arrays = [];
1363
- zipArray.forEach((value, i) => {
1364
- value.forEach((val, j) => {
1365
- if (!arrays[j])
1366
- arrays[j] = [];
1367
- arrays[j][i] = val;
1368
- });
1369
- });
1370
- return arrays;
1371
- }
1372
- static sortDictionary(keys, values, desc) {
1373
- let dictionary = this.zipArrays(keys, values);
1374
- let comparator = (a, b, asc = true) => {
1375
- let result = a[1] < b[1] ? 1 : a[1] == b[1] ? 0 : -1;
1376
- return asc ? result : result * -1;
1377
- };
1378
- dictionary.sort((a, b) => {
1379
- return desc ? comparator(a, b, false) : comparator(a, b);
1380
- });
1381
- let keysAndValues = this.unzipArrays(dictionary);
1382
- return { keys: keysAndValues[0], values: keysAndValues[1] };
1383
- }
1384
- static toPercentage(value, maxValue) {
1385
- return (value / maxValue) * 100;
1386
- }
1387
- }
1388
- function createLinksContainer(links) {
1389
- const linksContainer = DocumentHelper.createElement("div");
1390
- links.forEach((link) => {
1391
- linksContainer.appendChild(DocumentHelper.createElement("a", "", {
1392
- innerText: link.name,
1393
- download: link.name,
1394
- href: link.content,
1395
- }));
1396
- });
1397
- return linksContainer;
1398
- }
1399
- function createImagesContainer(links) {
1400
- const linksContainer = DocumentHelper.createElement("div");
1401
- links.forEach((link) => {
1402
- linksContainer.appendChild(DocumentHelper.createElement("img", "", {
1403
- alt: link.name,
1404
- src: link.content,
1405
- }));
1406
- });
1407
- return linksContainer;
1408
- }
1409
- function toPrecision(value, precision = 2) {
1410
- const base = Math.pow(10, precision);
1411
- return Math.round(base * value) / base;
1412
- }
1413
-
1414
1422
  var iconsData = {
1415
1423
  "detail": "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><g><circle cx=\"1.5\" cy=\"8.5\" r=\"1.5\"></circle><circle cx=\"7.5\" cy=\"8.5\" r=\"1.5\"></circle><circle cx=\"13.5\" cy=\"8.5\" r=\"1.5\"></circle></g></svg>",
1416
1424
  "drag": "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><g><polygon points=\"13,5 12,6 13,7 9,7 9,3 10,4 11,3 8,0 5,3 6,4 7,3 7,7 3,7 4,6 3,5 0,8 3,11 4,10 3,9 7,9 7,13 6,12 5,13 8,16 11,13 10,12 9,13 9,9 13,9 12,10 13,11 16,8 \"></polygon></g></svg>",
@@ -1441,5 +1449,5 @@ function getIconSymbolTemplate(iconId, iconSvg) {
1441
1449
  const iconsHtml = Object.keys(iconsData).map(iconId => getIconSymbolTemplate(iconId, iconsData[iconId]));
1442
1450
  const svgTemplate = `<svg style="display:none;">${iconsHtml}<svg>`;
1443
1451
 
1444
- export { DocumentHelper as D, DataHelper as a, createCommercialLicenseLink as b, createLoadingIndicator as c, surveyStrings as d, createImagesContainer as e, createLinksContainer as f, localization as l, svgTemplate as s, toPrecision as t };
1452
+ export { DocumentHelper as D, DataHelper as a, createLinksContainer as b, createImagesContainer as c, createCommercialLicenseLink as d, svgTemplate as e, createLoadingIndicator as f, localization as l, surveyStrings as s, toPrecision as t };
1445
1453
  //# sourceMappingURL=shared.mjs.map