survey-analytics 2.5.29 → 2.5.31
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 +211 -211
- package/fesm/shared.mjs.map +1 -1
- package/fesm/shared2.mjs +1160 -1160
- package/fesm/shared2.mjs.map +1 -1
- package/fesm/survey.analytics.core.mjs +1 -1
- package/fesm/survey.analytics.mjs +1 -1
- package/fesm/survey.analytics.mongo.mjs +1 -1
- package/fesm/survey.analytics.tabulator.mjs +1 -1
- package/package.json +2 -2
- package/survey-analytics.types/plotly/chart-adapter.d.ts +1 -0
- package/survey.analytics.core.css.map +1 -1
- package/survey.analytics.core.js +1 -1
- package/survey.analytics.core.min.js +1 -1
- package/survey.analytics.css.map +1 -1
- package/survey.analytics.d.ts +0 -1
- package/survey.analytics.js +1 -1
- package/survey.analytics.min.js +1 -1
- package/survey.analytics.mongo.js +1 -1
- package/survey.analytics.mongo.min.js +1 -1
- package/survey.analytics.tabulator.css.map +1 -1
- package/survey.analytics.tabulator.d.ts +0 -1
- package/survey.analytics.tabulator.js +1 -1
- package/survey.analytics.tabulator.min.js +1 -1
package/fesm/shared.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* surveyjs - SurveyJS Dashboard library v2.5.
|
|
2
|
+
* surveyjs - SurveyJS Dashboard library v2.5.31
|
|
3
3
|
* Copyright (c) 2015-2026 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
4
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
5
5
|
*/
|
|
@@ -181,216 +181,6 @@ function setupLocale(localeConfig) {
|
|
|
181
181
|
}
|
|
182
182
|
setupLocale({ localeCode: "en", strings: englishStrings, nativeName: "English" });
|
|
183
183
|
|
|
184
|
-
class DocumentHelper {
|
|
185
|
-
static createSelector(options, isSelected, handler, title) {
|
|
186
|
-
const selectWrapper = document.createElement("div");
|
|
187
|
-
selectWrapper.className = "sa-question__select-wrapper";
|
|
188
|
-
const titleElement = DocumentHelper.createElement("span", "sa-question__select-title");
|
|
189
|
-
const select = document.createElement("select");
|
|
190
|
-
select.className = "sa-question__select";
|
|
191
|
-
const updateTitle = () => {
|
|
192
|
-
const titleText = !!title && (typeof title == "string" ? title : title());
|
|
193
|
-
titleElement.innerText = titleText;
|
|
194
|
-
if (!!titleText) {
|
|
195
|
-
selectWrapper.insertBefore(titleElement, select);
|
|
196
|
-
}
|
|
197
|
-
else if (titleElement.parentElement === selectWrapper) {
|
|
198
|
-
selectWrapper.removeChild(titleElement);
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
select.onchange = handler;
|
|
202
|
-
selectWrapper.appendChild(select);
|
|
203
|
-
const updateOptions = () => {
|
|
204
|
-
select.innerHTML = "";
|
|
205
|
-
const optionsSource = options || [];
|
|
206
|
-
const optionItems = Array.isArray(optionsSource) ? optionsSource : optionsSource();
|
|
207
|
-
optionItems.forEach((option) => {
|
|
208
|
-
let optionElement = DocumentHelper.createElement("option", "", {
|
|
209
|
-
value: option.value,
|
|
210
|
-
text: option.text,
|
|
211
|
-
selected: isSelected(option),
|
|
212
|
-
});
|
|
213
|
-
select.appendChild(optionElement);
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
selectWrapper["__updateSelect"] = () => {
|
|
217
|
-
updateTitle();
|
|
218
|
-
updateOptions();
|
|
219
|
-
};
|
|
220
|
-
selectWrapper["__updateSelect"]();
|
|
221
|
-
return selectWrapper;
|
|
222
|
-
}
|
|
223
|
-
static createButton(handler, text = "", className = "sa-toolbar__button") {
|
|
224
|
-
const button = DocumentHelper.createElement("span", className, {
|
|
225
|
-
innerText: text,
|
|
226
|
-
onclick: handler,
|
|
227
|
-
});
|
|
228
|
-
return button;
|
|
229
|
-
}
|
|
230
|
-
static createElement(tagName, className = "", attrs) {
|
|
231
|
-
var el = document.createElement(tagName);
|
|
232
|
-
if (!!className) {
|
|
233
|
-
el.className = className;
|
|
234
|
-
}
|
|
235
|
-
if (!!attrs) {
|
|
236
|
-
Object.keys(attrs).forEach(function (key) {
|
|
237
|
-
el[key] = attrs[key];
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
return el;
|
|
241
|
-
}
|
|
242
|
-
static createSvgElement(path) {
|
|
243
|
-
const svgElem = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
244
|
-
const useElem = document.createElementNS("http://www.w3.org/2000/svg", "use");
|
|
245
|
-
useElem.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#sa-svg-" + path);
|
|
246
|
-
svgElem.appendChild(useElem);
|
|
247
|
-
return svgElem;
|
|
248
|
-
}
|
|
249
|
-
static createSvgButton(path) {
|
|
250
|
-
const btn = (DocumentHelper.createElement("button", "sa-table__svg-button"));
|
|
251
|
-
btn.appendChild(DocumentHelper.createSvgElement(path));
|
|
252
|
-
return btn;
|
|
253
|
-
}
|
|
254
|
-
static createSvgToggleButton(svgPath1, svPpath2, text1, text2, handler1, handler2, state = "first", className = "sa-toolbar__button sa-toolbar__svg-button") {
|
|
255
|
-
const svg1 = DocumentHelper.createSvgElement(svgPath1);
|
|
256
|
-
const svg2 = DocumentHelper.createSvgElement(svPpath2);
|
|
257
|
-
const button = DocumentHelper.createElement("button", className);
|
|
258
|
-
const toggle = (e) => {
|
|
259
|
-
if (state === "first") {
|
|
260
|
-
state = "second";
|
|
261
|
-
button.title = text2;
|
|
262
|
-
button.removeChild(svg1);
|
|
263
|
-
button.appendChild(svg2);
|
|
264
|
-
handler2(e);
|
|
265
|
-
}
|
|
266
|
-
else if (state === "second") {
|
|
267
|
-
state = "first";
|
|
268
|
-
button.title = text1;
|
|
269
|
-
button.removeChild(svg2);
|
|
270
|
-
button.appendChild(svg1);
|
|
271
|
-
handler1(e);
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
if (state === "first") {
|
|
275
|
-
button.title = text1;
|
|
276
|
-
button.appendChild(svg1);
|
|
277
|
-
}
|
|
278
|
-
else if ((state = "second")) {
|
|
279
|
-
button.title = text2;
|
|
280
|
-
button.appendChild(svg2);
|
|
281
|
-
}
|
|
282
|
-
button.onclick = toggle;
|
|
283
|
-
return button;
|
|
284
|
-
}
|
|
285
|
-
static createInput(className, placeholder = "", defaultValue = "") {
|
|
286
|
-
var el = DocumentHelper.createElement("input", className, {
|
|
287
|
-
placeholder: placeholder,
|
|
288
|
-
defaultValue: defaultValue,
|
|
289
|
-
});
|
|
290
|
-
return el;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
function getLicenseText() {
|
|
294
|
-
const d = !!glc ? glc(1) : false;
|
|
295
|
-
if (!!d && d.toLocaleDateString)
|
|
296
|
-
return localization.getString("license2").replace("{date}", d.toLocaleDateString());
|
|
297
|
-
return localization.getString("license");
|
|
298
|
-
}
|
|
299
|
-
function createCommercialLicenseLink() {
|
|
300
|
-
const container = DocumentHelper.createElement("div", "sa-commercial");
|
|
301
|
-
const link = DocumentHelper.createElement("div", "sa-commercial__text");
|
|
302
|
-
const containerSpan = DocumentHelper.createElement("span", "");
|
|
303
|
-
const textSpan = DocumentHelper.createElement("span", "sa-commercial__product", { innerHTML: getLicenseText() });
|
|
304
|
-
container.appendChild(link).appendChild(containerSpan);
|
|
305
|
-
containerSpan.appendChild(textSpan);
|
|
306
|
-
return container;
|
|
307
|
-
}
|
|
308
|
-
function createLoadingIndicator() {
|
|
309
|
-
const container = DocumentHelper.createElement("div", "sa-data-loading-indicator-panel");
|
|
310
|
-
const loadingIndicator = DocumentHelper.createElement("div", "sa-data-loading-indicator");
|
|
311
|
-
loadingIndicator.innerHTML = `
|
|
312
|
-
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
313
|
-
<g clip-path="url(#clip0_17928_11482)">
|
|
314
|
-
<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>
|
|
315
|
-
<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>
|
|
316
|
-
</g>
|
|
317
|
-
<defs>
|
|
318
|
-
<clipPath id="clip0_17928_11482">
|
|
319
|
-
<rect width="64" height="64" fill="white"></rect>
|
|
320
|
-
</clipPath>
|
|
321
|
-
</defs>
|
|
322
|
-
</svg>
|
|
323
|
-
`;
|
|
324
|
-
container.appendChild(loadingIndicator);
|
|
325
|
-
return container;
|
|
326
|
-
}
|
|
327
|
-
class DataHelper {
|
|
328
|
-
static zipArrays(...arrays) {
|
|
329
|
-
let zipArray = [];
|
|
330
|
-
for (let i = 0; i < arrays[0].length; i++) {
|
|
331
|
-
zipArray[i] = [];
|
|
332
|
-
arrays.forEach((arr) => {
|
|
333
|
-
zipArray[i].push(arr[i]);
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
return zipArray;
|
|
337
|
-
}
|
|
338
|
-
static unzipArrays(zipArray) {
|
|
339
|
-
let arrays = [];
|
|
340
|
-
zipArray.forEach((value, i) => {
|
|
341
|
-
value.forEach((val, j) => {
|
|
342
|
-
if (!arrays[j])
|
|
343
|
-
arrays[j] = [];
|
|
344
|
-
arrays[j][i] = val;
|
|
345
|
-
});
|
|
346
|
-
});
|
|
347
|
-
return arrays;
|
|
348
|
-
}
|
|
349
|
-
static sortDictionary(keys, values, desc) {
|
|
350
|
-
let dictionary = this.zipArrays(keys, values);
|
|
351
|
-
let comparator = (a, b, asc = true) => {
|
|
352
|
-
let result = a[1] < b[1] ? 1 : a[1] == b[1] ? 0 : -1;
|
|
353
|
-
return asc ? result : result * -1;
|
|
354
|
-
};
|
|
355
|
-
dictionary.sort((a, b) => {
|
|
356
|
-
return desc ? comparator(a, b, false) : comparator(a, b);
|
|
357
|
-
});
|
|
358
|
-
let keysAndValues = this.unzipArrays(dictionary);
|
|
359
|
-
return { keys: keysAndValues[0], values: keysAndValues[1] };
|
|
360
|
-
}
|
|
361
|
-
static toPercentage(value, maxValue) {
|
|
362
|
-
return (value / maxValue) * 100;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
function createLinksContainer(links) {
|
|
366
|
-
const linksContainer = DocumentHelper.createElement("div");
|
|
367
|
-
links.forEach((link, index) => {
|
|
368
|
-
linksContainer.appendChild(DocumentHelper.createElement("a", "", {
|
|
369
|
-
innerText: link.name,
|
|
370
|
-
download: link.name,
|
|
371
|
-
href: link.content,
|
|
372
|
-
}));
|
|
373
|
-
if (index < links.length - 1) {
|
|
374
|
-
linksContainer.appendChild(DocumentHelper.createElement("br"));
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
return linksContainer;
|
|
378
|
-
}
|
|
379
|
-
function createImagesContainer(links) {
|
|
380
|
-
const linksContainer = DocumentHelper.createElement("div");
|
|
381
|
-
links.forEach((link) => {
|
|
382
|
-
linksContainer.appendChild(DocumentHelper.createElement("img", "", {
|
|
383
|
-
alt: link.name,
|
|
384
|
-
src: link.content,
|
|
385
|
-
}));
|
|
386
|
-
});
|
|
387
|
-
return linksContainer;
|
|
388
|
-
}
|
|
389
|
-
function toPrecision(value, precision = 2) {
|
|
390
|
-
const base = Math.pow(10, precision);
|
|
391
|
-
return Math.round(base * value) / base;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
184
|
var farsiStrings = {
|
|
395
185
|
// "Group By Me"
|
|
396
186
|
groupButton: "گروه بندی با",
|
|
@@ -3191,6 +2981,216 @@ var swedishStrings = {
|
|
|
3191
2981
|
};
|
|
3192
2982
|
setupLocale({ localeCode: "sv", strings: swedishStrings, nativeName: "Svenska" });
|
|
3193
2983
|
|
|
2984
|
+
class DocumentHelper {
|
|
2985
|
+
static createSelector(options, isSelected, handler, title) {
|
|
2986
|
+
const selectWrapper = document.createElement("div");
|
|
2987
|
+
selectWrapper.className = "sa-question__select-wrapper";
|
|
2988
|
+
const titleElement = DocumentHelper.createElement("span", "sa-question__select-title");
|
|
2989
|
+
const select = document.createElement("select");
|
|
2990
|
+
select.className = "sa-question__select";
|
|
2991
|
+
const updateTitle = () => {
|
|
2992
|
+
const titleText = !!title && (typeof title == "string" ? title : title());
|
|
2993
|
+
titleElement.innerText = titleText;
|
|
2994
|
+
if (!!titleText) {
|
|
2995
|
+
selectWrapper.insertBefore(titleElement, select);
|
|
2996
|
+
}
|
|
2997
|
+
else if (titleElement.parentElement === selectWrapper) {
|
|
2998
|
+
selectWrapper.removeChild(titleElement);
|
|
2999
|
+
}
|
|
3000
|
+
};
|
|
3001
|
+
select.onchange = handler;
|
|
3002
|
+
selectWrapper.appendChild(select);
|
|
3003
|
+
const updateOptions = () => {
|
|
3004
|
+
select.innerHTML = "";
|
|
3005
|
+
const optionsSource = options || [];
|
|
3006
|
+
const optionItems = Array.isArray(optionsSource) ? optionsSource : optionsSource();
|
|
3007
|
+
optionItems.forEach((option) => {
|
|
3008
|
+
let optionElement = DocumentHelper.createElement("option", "", {
|
|
3009
|
+
value: option.value,
|
|
3010
|
+
text: option.text,
|
|
3011
|
+
selected: isSelected(option),
|
|
3012
|
+
});
|
|
3013
|
+
select.appendChild(optionElement);
|
|
3014
|
+
});
|
|
3015
|
+
};
|
|
3016
|
+
selectWrapper["__updateSelect"] = () => {
|
|
3017
|
+
updateTitle();
|
|
3018
|
+
updateOptions();
|
|
3019
|
+
};
|
|
3020
|
+
selectWrapper["__updateSelect"]();
|
|
3021
|
+
return selectWrapper;
|
|
3022
|
+
}
|
|
3023
|
+
static createButton(handler, text = "", className = "sa-toolbar__button") {
|
|
3024
|
+
const button = DocumentHelper.createElement("span", className, {
|
|
3025
|
+
innerText: text,
|
|
3026
|
+
onclick: handler,
|
|
3027
|
+
});
|
|
3028
|
+
return button;
|
|
3029
|
+
}
|
|
3030
|
+
static createElement(tagName, className = "", attrs) {
|
|
3031
|
+
var el = document.createElement(tagName);
|
|
3032
|
+
if (!!className) {
|
|
3033
|
+
el.className = className;
|
|
3034
|
+
}
|
|
3035
|
+
if (!!attrs) {
|
|
3036
|
+
Object.keys(attrs).forEach(function (key) {
|
|
3037
|
+
el[key] = attrs[key];
|
|
3038
|
+
});
|
|
3039
|
+
}
|
|
3040
|
+
return el;
|
|
3041
|
+
}
|
|
3042
|
+
static createSvgElement(path) {
|
|
3043
|
+
const svgElem = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3044
|
+
const useElem = document.createElementNS("http://www.w3.org/2000/svg", "use");
|
|
3045
|
+
useElem.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#sa-svg-" + path);
|
|
3046
|
+
svgElem.appendChild(useElem);
|
|
3047
|
+
return svgElem;
|
|
3048
|
+
}
|
|
3049
|
+
static createSvgButton(path) {
|
|
3050
|
+
const btn = (DocumentHelper.createElement("button", "sa-table__svg-button"));
|
|
3051
|
+
btn.appendChild(DocumentHelper.createSvgElement(path));
|
|
3052
|
+
return btn;
|
|
3053
|
+
}
|
|
3054
|
+
static createSvgToggleButton(svgPath1, svPpath2, text1, text2, handler1, handler2, state = "first", className = "sa-toolbar__button sa-toolbar__svg-button") {
|
|
3055
|
+
const svg1 = DocumentHelper.createSvgElement(svgPath1);
|
|
3056
|
+
const svg2 = DocumentHelper.createSvgElement(svPpath2);
|
|
3057
|
+
const button = DocumentHelper.createElement("button", className);
|
|
3058
|
+
const toggle = (e) => {
|
|
3059
|
+
if (state === "first") {
|
|
3060
|
+
state = "second";
|
|
3061
|
+
button.title = text2;
|
|
3062
|
+
button.removeChild(svg1);
|
|
3063
|
+
button.appendChild(svg2);
|
|
3064
|
+
handler2(e);
|
|
3065
|
+
}
|
|
3066
|
+
else if (state === "second") {
|
|
3067
|
+
state = "first";
|
|
3068
|
+
button.title = text1;
|
|
3069
|
+
button.removeChild(svg2);
|
|
3070
|
+
button.appendChild(svg1);
|
|
3071
|
+
handler1(e);
|
|
3072
|
+
}
|
|
3073
|
+
};
|
|
3074
|
+
if (state === "first") {
|
|
3075
|
+
button.title = text1;
|
|
3076
|
+
button.appendChild(svg1);
|
|
3077
|
+
}
|
|
3078
|
+
else if ((state = "second")) {
|
|
3079
|
+
button.title = text2;
|
|
3080
|
+
button.appendChild(svg2);
|
|
3081
|
+
}
|
|
3082
|
+
button.onclick = toggle;
|
|
3083
|
+
return button;
|
|
3084
|
+
}
|
|
3085
|
+
static createInput(className, placeholder = "", defaultValue = "") {
|
|
3086
|
+
var el = DocumentHelper.createElement("input", className, {
|
|
3087
|
+
placeholder: placeholder,
|
|
3088
|
+
defaultValue: defaultValue,
|
|
3089
|
+
});
|
|
3090
|
+
return el;
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
function getLicenseText() {
|
|
3094
|
+
const d = !!glc ? glc(1) : false;
|
|
3095
|
+
if (!!d && d.toLocaleDateString)
|
|
3096
|
+
return localization.getString("license2").replace("{date}", d.toLocaleDateString());
|
|
3097
|
+
return localization.getString("license");
|
|
3098
|
+
}
|
|
3099
|
+
function createCommercialLicenseLink() {
|
|
3100
|
+
const container = DocumentHelper.createElement("div", "sa-commercial");
|
|
3101
|
+
const link = DocumentHelper.createElement("div", "sa-commercial__text");
|
|
3102
|
+
const containerSpan = DocumentHelper.createElement("span", "");
|
|
3103
|
+
const textSpan = DocumentHelper.createElement("span", "sa-commercial__product", { innerHTML: getLicenseText() });
|
|
3104
|
+
container.appendChild(link).appendChild(containerSpan);
|
|
3105
|
+
containerSpan.appendChild(textSpan);
|
|
3106
|
+
return container;
|
|
3107
|
+
}
|
|
3108
|
+
function createLoadingIndicator() {
|
|
3109
|
+
const container = DocumentHelper.createElement("div", "sa-data-loading-indicator-panel");
|
|
3110
|
+
const loadingIndicator = DocumentHelper.createElement("div", "sa-data-loading-indicator");
|
|
3111
|
+
loadingIndicator.innerHTML = `
|
|
3112
|
+
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3113
|
+
<g clip-path="url(#clip0_17928_11482)">
|
|
3114
|
+
<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>
|
|
3115
|
+
<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>
|
|
3116
|
+
</g>
|
|
3117
|
+
<defs>
|
|
3118
|
+
<clipPath id="clip0_17928_11482">
|
|
3119
|
+
<rect width="64" height="64" fill="white"></rect>
|
|
3120
|
+
</clipPath>
|
|
3121
|
+
</defs>
|
|
3122
|
+
</svg>
|
|
3123
|
+
`;
|
|
3124
|
+
container.appendChild(loadingIndicator);
|
|
3125
|
+
return container;
|
|
3126
|
+
}
|
|
3127
|
+
class DataHelper {
|
|
3128
|
+
static zipArrays(...arrays) {
|
|
3129
|
+
let zipArray = [];
|
|
3130
|
+
for (let i = 0; i < arrays[0].length; i++) {
|
|
3131
|
+
zipArray[i] = [];
|
|
3132
|
+
arrays.forEach((arr) => {
|
|
3133
|
+
zipArray[i].push(arr[i]);
|
|
3134
|
+
});
|
|
3135
|
+
}
|
|
3136
|
+
return zipArray;
|
|
3137
|
+
}
|
|
3138
|
+
static unzipArrays(zipArray) {
|
|
3139
|
+
let arrays = [];
|
|
3140
|
+
zipArray.forEach((value, i) => {
|
|
3141
|
+
value.forEach((val, j) => {
|
|
3142
|
+
if (!arrays[j])
|
|
3143
|
+
arrays[j] = [];
|
|
3144
|
+
arrays[j][i] = val;
|
|
3145
|
+
});
|
|
3146
|
+
});
|
|
3147
|
+
return arrays;
|
|
3148
|
+
}
|
|
3149
|
+
static sortDictionary(keys, values, desc) {
|
|
3150
|
+
let dictionary = this.zipArrays(keys, values);
|
|
3151
|
+
let comparator = (a, b, asc = true) => {
|
|
3152
|
+
let result = a[1] < b[1] ? 1 : a[1] == b[1] ? 0 : -1;
|
|
3153
|
+
return asc ? result : result * -1;
|
|
3154
|
+
};
|
|
3155
|
+
dictionary.sort((a, b) => {
|
|
3156
|
+
return desc ? comparator(a, b, false) : comparator(a, b);
|
|
3157
|
+
});
|
|
3158
|
+
let keysAndValues = this.unzipArrays(dictionary);
|
|
3159
|
+
return { keys: keysAndValues[0], values: keysAndValues[1] };
|
|
3160
|
+
}
|
|
3161
|
+
static toPercentage(value, maxValue) {
|
|
3162
|
+
return (value / maxValue) * 100;
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
function createLinksContainer(links) {
|
|
3166
|
+
const linksContainer = DocumentHelper.createElement("div");
|
|
3167
|
+
links.forEach((link, index) => {
|
|
3168
|
+
linksContainer.appendChild(DocumentHelper.createElement("a", "", {
|
|
3169
|
+
innerText: link.name,
|
|
3170
|
+
download: link.name,
|
|
3171
|
+
href: link.content,
|
|
3172
|
+
}));
|
|
3173
|
+
if (index < links.length - 1) {
|
|
3174
|
+
linksContainer.appendChild(DocumentHelper.createElement("br"));
|
|
3175
|
+
}
|
|
3176
|
+
});
|
|
3177
|
+
return linksContainer;
|
|
3178
|
+
}
|
|
3179
|
+
function createImagesContainer(links) {
|
|
3180
|
+
const linksContainer = DocumentHelper.createElement("div");
|
|
3181
|
+
links.forEach((link) => {
|
|
3182
|
+
linksContainer.appendChild(DocumentHelper.createElement("img", "", {
|
|
3183
|
+
alt: link.name,
|
|
3184
|
+
src: link.content,
|
|
3185
|
+
}));
|
|
3186
|
+
});
|
|
3187
|
+
return linksContainer;
|
|
3188
|
+
}
|
|
3189
|
+
function toPrecision(value, precision = 2) {
|
|
3190
|
+
const base = Math.pow(10, precision);
|
|
3191
|
+
return Math.round(base * value) / base;
|
|
3192
|
+
}
|
|
3193
|
+
|
|
3194
3194
|
var iconsData = {
|
|
3195
3195
|
"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>",
|
|
3196
3196
|
"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>",
|