@iobroker/adapter-react-v5 4.2.1 → 4.3.0

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 (61) hide show
  1. package/Components/ComplexCron.js +20 -28
  2. package/Components/ComplexCron.js.map +1 -1
  3. package/Components/CustomModal.js +8 -12
  4. package/Components/CustomModal.js.map +1 -1
  5. package/Components/FileViewer.js +10 -18
  6. package/Components/FileViewer.js.map +1 -1
  7. package/Components/Icon.js +10 -17
  8. package/Components/Icon.js.map +1 -1
  9. package/Components/IconPicker.js +6 -8
  10. package/Components/IconPicker.js.map +1 -1
  11. package/Components/IconSelector.js +13 -22
  12. package/Components/IconSelector.js.map +1 -1
  13. package/Components/JsonConfigComponent/ConfigTable.js +357 -38
  14. package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
  15. package/Components/Loader.js +1 -1
  16. package/Components/Loader.js.map +1 -1
  17. package/Components/Logo.js +11 -13
  18. package/Components/Logo.js.map +1 -1
  19. package/Components/MDUtils.js +1 -1
  20. package/Components/MDUtils.js.map +1 -1
  21. package/Components/ObjectBrowser.d.ts +13 -1
  22. package/Components/ObjectBrowser.js +568 -568
  23. package/Components/ObjectBrowser.js.map +1 -1
  24. package/Components/Router.d.ts +1 -1
  25. package/Components/Router.js +6 -6
  26. package/Components/Router.js.map +1 -1
  27. package/Components/SaveCloseButtons.js +11 -13
  28. package/Components/SaveCloseButtons.js.map +1 -1
  29. package/Components/Schedule.js +135 -129
  30. package/Components/Schedule.js.map +1 -1
  31. package/Components/SelectWithIcon.js.map +1 -1
  32. package/Components/TabContainer.js +3 -4
  33. package/Components/TabContainer.js.map +1 -1
  34. package/Components/TabContent.js +2 -2
  35. package/Components/TabContent.js.map +1 -1
  36. package/Components/TabHeader.js +2 -2
  37. package/Components/TabHeader.js.map +1 -1
  38. package/Components/TableResize.js +6 -6
  39. package/Components/TableResize.js.map +1 -1
  40. package/Components/ToggleThemeMenu.js +5 -8
  41. package/Components/ToggleThemeMenu.js.map +1 -1
  42. package/Components/TreeTable.js +44 -64
  43. package/Components/TreeTable.js.map +1 -1
  44. package/Components/UploadImage.js +11 -12
  45. package/Components/UploadImage.js.map +1 -1
  46. package/Components/Utils.d.ts +13 -6
  47. package/Components/Utils.js +61 -41
  48. package/Components/Utils.js.map +1 -1
  49. package/README.md +6 -0
  50. package/i18n/de.json +9 -1
  51. package/i18n/en.json +9 -1
  52. package/i18n/es.json +9 -1
  53. package/i18n/fr.json +9 -1
  54. package/i18n/it.json +9 -1
  55. package/i18n/nl.json +9 -1
  56. package/i18n/pl.json +9 -1
  57. package/i18n/pt.json +9 -1
  58. package/i18n/ru.json +9 -1
  59. package/i18n/uk.json +9 -1
  60. package/i18n/zh-cn.json +9 -1
  61. package/package.json +3 -3
@@ -220,13 +220,13 @@ declare class Utils {
220
220
  */
221
221
  static formatBytes(bytes: number): string;
222
222
  /**
223
- * Invert the given color according to theme type to get the inverted text color for background
224
- * @param {string} color Color in the format '#rrggbb' or '#rgb' (or without hash)
223
+ * Invert the given color according to a theme type to get the inverted text color for background
224
+ * @param {string} color Color in the format '#rrggbb' or '#rgb' (or without a hash)
225
225
  * @param {string} themeType theme type
226
226
  * @param {string} invert dark theme has light color in control or light theme has light color in control
227
- * @returns {string}
227
+ * @returns {string | undefined}
228
228
  */
229
- static getInvertedColor(color: string, themeType: string, invert: string): string;
229
+ static getInvertedColor(color: string, themeType: string, invert: string): string | undefined;
230
230
  /**
231
231
  * Invert the given color
232
232
  * @param {string} hex Color in the format '#rrggbb' or '#rgb' (or without hash)
@@ -324,7 +324,7 @@ declare class Utils {
324
324
  /**
325
325
  * Convert quality code into text
326
326
  * @param {number} quality code
327
- * @returns {array<string>} lines that decode qulity
327
+ * @returns {array<string>} lines that decode quality
328
328
  */
329
329
  static quality2text(quality: number): array<string>;
330
330
  /**
@@ -346,9 +346,16 @@ declare class Utils {
346
346
  */
347
347
  static getSvg(url: string): object;
348
348
  /**
349
- * Detect file xtension by its content
349
+ * Detect file extension by its content
350
350
  * @param {string} base64 Base64 encoded binary file
351
351
  * @returns {string} Detected extension, like 'jpg'
352
352
  */
353
353
  static detectMimeType(base64: string): string;
354
+ /**
355
+ * Check if configured repository is the stable repository
356
+ *
357
+ * @param {string | string[]} activeRepo current configured repository or multi repository
358
+ * @return {boolean}
359
+ */
360
+ static isStableRepository(activeRepo: string | string[]): boolean;
354
361
  }
@@ -76,17 +76,17 @@ var Utils = /*#__PURE__*/function () {
76
76
  seconds %= 3600 * 24;
77
77
  var hours = Math.floor(seconds / 3600);
78
78
  if (hours < 10) {
79
- hours = '0' + hours;
79
+ hours = "0".concat(hours);
80
80
  }
81
81
  seconds %= 3600;
82
82
  var minutes = Math.floor(seconds / 60);
83
83
  if (minutes < 10) {
84
- minutes = '0' + minutes;
84
+ minutes = "0".concat(minutes);
85
85
  }
86
86
  seconds %= 60;
87
87
  seconds = Math.floor(seconds);
88
88
  if (seconds < 10) {
89
- seconds = '0' + seconds;
89
+ seconds = "0".concat(seconds);
90
90
  }
91
91
  var text = '';
92
92
  if (days) {
@@ -387,7 +387,7 @@ var Utils = /*#__PURE__*/function () {
387
387
  style: style || {}
388
388
  });
389
389
  } else {
390
- // may be later some changes for second type
390
+ // maybe later some changes for a second type
391
391
  return /*#__PURE__*/_react["default"].createElement("img", {
392
392
  alt: settings.name,
393
393
  src: (settings.prefix || '') + settings.icon,
@@ -544,12 +544,18 @@ var Utils = /*#__PURE__*/function () {
544
544
  var minutes = Math.floor(seconds % 3600 / 60);
545
545
  var secs = seconds % 60;
546
546
  if (hours) {
547
- if (minutes < 10) minutes = '0' + minutes;
548
- if (secs < 10) secs = '0' + secs;
549
- return hours + ':' + minutes + ':' + secs;
547
+ if (minutes < 10) {
548
+ minutes = "0".concat(minutes);
549
+ }
550
+ if (secs < 10) {
551
+ secs = "0".concat(secs);
552
+ }
553
+ return "".concat(hours, ":").concat(minutes, ":").concat(secs);
550
554
  } else {
551
- if (secs < 10) secs = '0' + secs;
552
- return minutes + ':' + secs;
555
+ if (secs < 10) {
556
+ secs = "0".concat(secs);
557
+ }
558
+ return "".concat(minutes, ":").concat(secs);
553
559
  }
554
560
  }
555
561
 
@@ -607,12 +613,12 @@ var Utils = /*#__PURE__*/function () {
607
613
  value: function padding(num) {
608
614
  if (typeof num === 'string') {
609
615
  if (num.length < 2) {
610
- return '0' + num;
616
+ return "0".concat(num);
611
617
  } else {
612
618
  return num;
613
619
  }
614
620
  } else if (num < 10) {
615
- return '0' + num;
621
+ return "0".concat(num);
616
622
  } else {
617
623
  return num;
618
624
  }
@@ -644,7 +650,7 @@ var Utils = /*#__PURE__*/function () {
644
650
  if (!now) return '';
645
651
  // only letters
646
652
  if (now.match(/^[\w\s]+$/)) {
647
- // Day of week
653
+ // Day of the week
648
654
  return now;
649
655
  }
650
656
  var m = now.match(/(\d{1,4})[-./](\d{1,2})[-./](\d{1,4})/);
@@ -684,8 +690,8 @@ var Utils = /*#__PURE__*/function () {
684
690
  } else {
685
691
  now = new Date(now);
686
692
  }
687
- var date = _i18n["default"].t('ra_dow_' + days[now.getDay()]).replace('ra_dow_', '');
688
- date += '. ' + now.getDate() + ' ' + _i18n["default"].t('ra_month_' + months[now.getMonth()]).replace('ra_month_', '');
693
+ var date = _i18n["default"].t("ra_dow_".concat(days[now.getDay()])).replace('ra_dow_', '');
694
+ date += ". ".concat(now.getDate(), " ").concat(_i18n["default"].t("ra_month_".concat(months[now.getMonth()])).replace('ra_month_', ''));
689
695
  return date;
690
696
  }
691
697
 
@@ -739,7 +745,7 @@ var Utils = /*#__PURE__*/function () {
739
745
  m = text && text.match(/<a [^<]+<\/a>|<br\/?>|<b>[^<]+<\/b>|<i>[^<]+<\/i>/);
740
746
  if (!m) {
741
747
  text && result.push( /*#__PURE__*/_react["default"].createElement("span", {
742
- key: 'a' + key++
748
+ key: "a".concat(key++)
743
749
  }, text));
744
750
  }
745
751
  } while (m);
@@ -1032,7 +1038,7 @@ var Utils = /*#__PURE__*/function () {
1032
1038
  key: "formatBytes",
1033
1039
  value: function formatBytes(bytes) {
1034
1040
  if (Math.abs(bytes) < 1024) {
1035
- return bytes + ' B';
1041
+ return "".concat(bytes, " B");
1036
1042
  }
1037
1043
  var units = ['KB', 'MB', 'GB'];
1038
1044
  //const units = ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
@@ -1041,15 +1047,15 @@ var Utils = /*#__PURE__*/function () {
1041
1047
  bytes /= 1024;
1042
1048
  ++u;
1043
1049
  } while (Math.abs(bytes) >= 1024 && u < units.length - 1);
1044
- return bytes.toFixed(1) + ' ' + units[u];
1050
+ return "".concat(bytes.toFixed(1), " ").concat(units[u]);
1045
1051
  }
1046
1052
 
1047
1053
  /**
1048
- * Invert the given color according to theme type to get the inverted text color for background
1049
- * @param {string} color Color in the format '#rrggbb' or '#rgb' (or without hash)
1054
+ * Invert the given color according to a theme type to get the inverted text color for background
1055
+ * @param {string} color Color in the format '#rrggbb' or '#rgb' (or without a hash)
1050
1056
  * @param {string} themeType theme type
1051
1057
  * @param {string} invert dark theme has light color in control or light theme has light color in control
1052
- * @returns {string}
1058
+ * @returns {string | undefined}
1053
1059
  */
1054
1060
  }, {
1055
1061
  key: "getInvertedColor",
@@ -1103,7 +1109,7 @@ var Utils = /*#__PURE__*/function () {
1103
1109
  alfa = hex.substring(6, 8);
1104
1110
  hex = hex.substring(0, 6);
1105
1111
  } else if (hex.length !== 6) {
1106
- console.warn('Cannot invert color: ' + hex);
1112
+ console.warn("Cannot invert color: ".concat(hex));
1107
1113
  return hex;
1108
1114
  }
1109
1115
  var r = parseInt(hex.slice(0, 2), 16);
@@ -1421,44 +1427,44 @@ var Utils = /*#__PURE__*/function () {
1421
1427
  var text;
1422
1428
  var mm = dateObj.getMonth() + 1;
1423
1429
  if (mm < 10) {
1424
- mm = '0' + mm;
1430
+ mm = "0".concat(mm);
1425
1431
  }
1426
1432
  var dd = dateObj.getDate();
1427
1433
  if (dd < 10) {
1428
- dd = '0' + dd;
1434
+ dd = "0".concat(dd);
1429
1435
  }
1430
1436
  if (dateFormat === 'MM/DD/YYYY') {
1431
- text = mm + '/' + dd + '/' + dateObj.getFullYear();
1437
+ text = "".concat(mm, "/").concat(dd, "/").concat(dateObj.getFullYear());
1432
1438
  } else {
1433
- text = dateObj.getFullYear() + '-' + mm + '-' + dd;
1439
+ text = "".concat(dateObj.getFullYear(), "-").concat(mm, "-").concat(dd);
1434
1440
  }
1435
1441
 
1436
1442
  // time
1437
1443
  var v = dateObj.getHours();
1438
1444
  if (v < 10) {
1439
- text += ' 0' + v;
1445
+ text += " 0".concat(v);
1440
1446
  } else {
1441
- text += ' ' + v;
1447
+ text += " ".concat(v);
1442
1448
  }
1443
1449
  v = dateObj.getMinutes();
1444
1450
  if (v < 10) {
1445
- text += ':0' + v;
1451
+ text += ":0".concat(v);
1446
1452
  } else {
1447
- text += ':' + v;
1453
+ text += ":".concat(v);
1448
1454
  }
1449
1455
  v = dateObj.getSeconds();
1450
1456
  if (v < 10) {
1451
- text += ':0' + v;
1457
+ text += ":0".concat(v);
1452
1458
  } else {
1453
- text += ':' + v;
1459
+ text += ":".concat(v);
1454
1460
  }
1455
1461
  v = dateObj.getMilliseconds();
1456
1462
  if (v < 10) {
1457
- text += '.00' + v;
1463
+ text += ".00".concat(v);
1458
1464
  } else if (v < 100) {
1459
- text += '.0' + v;
1465
+ text += ".0".concat(v);
1460
1466
  } else {
1461
- text += '.' + v;
1467
+ text += ".".concat(v);
1462
1468
  }
1463
1469
  return text;
1464
1470
  }
@@ -1581,7 +1587,7 @@ var Utils = /*#__PURE__*/function () {
1581
1587
  key: "generateFile",
1582
1588
  value: function generateFile(filename, json) {
1583
1589
  var el = document.createElement('a');
1584
- el.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(json, null, 2)));
1590
+ el.setAttribute('href', "data:application/json;charset=utf-8,".concat(encodeURIComponent(JSON.stringify(json, null, 2))));
1585
1591
  el.setAttribute('download', filename);
1586
1592
  el.style.display = 'none';
1587
1593
  document.body.appendChild(el);
@@ -1592,7 +1598,7 @@ var Utils = /*#__PURE__*/function () {
1592
1598
  /**
1593
1599
  * Convert quality code into text
1594
1600
  * @param {number} quality code
1595
- * @returns {array<string>} lines that decode qulity
1601
+ * @returns {array<string>} lines that decode quality
1596
1602
  */
1597
1603
  }, {
1598
1604
  key: "quality2text",
@@ -1603,14 +1609,14 @@ var Utils = /*#__PURE__*/function () {
1603
1609
  if (text) {
1604
1610
  result = [text];
1605
1611
  } else if (quality & 0x01) {
1606
- result = [QUALITY_BITS[0x01], '0x' + (quality & (0xFFFF & ~1)).toString(16)];
1612
+ result = [QUALITY_BITS[0x01], "0x".concat((quality & (0xFFFF & ~1)).toString(16))];
1607
1613
  } else if (quality & 0x02) {
1608
- result = [QUALITY_BITS[0x02], '0x' + (quality & (0xFFFF & ~2)).toString(16)];
1614
+ result = [QUALITY_BITS[0x02], "0x".concat((quality & (0xFFFF & ~2)).toString(16))];
1609
1615
  } else {
1610
- result = ['0x' + quality.toString(16)];
1616
+ result = ["0x".concat(quality.toString(16))];
1611
1617
  }
1612
1618
  if (custom) {
1613
- result.push('0x' + (custom >> 16).toString(16).toUpperCase());
1619
+ result.push("0x".concat((custom >> 16).toString(16).toUpperCase()));
1614
1620
  }
1615
1621
  return result;
1616
1622
  }
@@ -1696,7 +1702,7 @@ var Utils = /*#__PURE__*/function () {
1696
1702
  }
1697
1703
 
1698
1704
  /**
1699
- * Detect file xtension by its content
1705
+ * Detect file extension by its content
1700
1706
  * @param {string} base64 Base64 encoded binary file
1701
1707
  * @returns {string} Detected extension, like 'jpg'
1702
1708
  */
@@ -1708,6 +1714,20 @@ var Utils = /*#__PURE__*/function () {
1708
1714
  });
1709
1715
  return signature ? SIGNATURES[signature] : null;
1710
1716
  }
1717
+
1718
+ /**
1719
+ * Check if configured repository is the stable repository
1720
+ *
1721
+ * @param {string | string[]} activeRepo current configured repository or multi repository
1722
+ * @return {boolean}
1723
+ */
1724
+ }, {
1725
+ key: "isStableRepository",
1726
+ value: function isStableRepository(activeRepo) {
1727
+ return !!(typeof activeRepo === 'string' && activeRepo.toLowerCase().startsWith('stable') || activeRepo && typeof activeRepo !== 'string' && activeRepo.find(function (r) {
1728
+ return r.toLowerCase().startsWith('stable');
1729
+ }));
1730
+ }
1711
1731
  }]);
1712
1732
  return Utils;
1713
1733
  }();