@iobroker/adapter-react-v5 4.4.8 → 4.5.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.
- package/Components/CustomModal.js +6 -3
- package/Components/CustomModal.js.map +1 -1
- package/Components/FileBrowser.js +4 -2
- package/Components/FileBrowser.js.map +1 -1
- package/Components/FileViewer.d.ts +5 -0
- package/Components/FileViewer.js +34 -7
- package/Components/FileViewer.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAccordion.d.ts +1 -0
- package/Components/JsonConfigComponent/ConfigAccordion.js +3 -1
- package/Components/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCRON.js +2 -4
- package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCheckLicense.js +29 -12
- package/Components/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCustom.js +4 -5
- package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFile.js +9 -14
- package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigGeneric.d.ts +1 -0
- package/Components/JsonConfigComponent/ConfigGeneric.js +9 -8
- package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigIP.js +5 -0
- package/Components/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigNumber.js +42 -31
- package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPanel.js +2 -0
- package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPort.js +44 -29
- package/Components/JsonConfigComponent/ConfigPort.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelect.js +29 -12
- package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js +11 -21
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSendto.js +16 -20
- package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSetState.js +18 -19
- package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticText.js +14 -23
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTable.js +12 -8
- package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTabs.d.ts +1 -0
- package/Components/JsonConfigComponent/ConfigTabs.js +5 -4
- package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigText.js +3 -7
- package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.js +3 -4
- package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigUUID.js +5 -6
- package/Components/JsonConfigComponent/ConfigUUID.js.map +1 -1
- package/Components/JsonConfigComponent/index.js +2 -0
- package/Components/JsonConfigComponent/index.js.map +1 -1
- package/Components/ObjectBrowser.d.ts +23 -1
- package/Components/ObjectBrowser.js +460 -50
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/TabContainer.d.ts +3 -0
- package/Components/TabContainer.js +7 -2
- package/Components/TabContainer.js.map +1 -1
- package/Components/TabContent.d.ts +1 -0
- package/Components/TabContent.js +7 -0
- package/Components/TabContent.js.map +1 -1
- package/Components/TableResize.js +7 -4
- package/Components/TableResize.js.map +1 -1
- package/Components/ToggleThemeMenu.js +5 -5
- package/Components/ToggleThemeMenu.js.map +1 -1
- package/Components/UploadImage.js +10 -7
- package/Components/UploadImage.js.map +1 -1
- package/Components/Utils.d.ts +2 -1
- package/Components/Utils.js +105 -98
- package/Components/Utils.js.map +1 -1
- package/README.md +3 -0
- package/i18n/de.json +4 -2
- package/i18n/en.json +3 -1
- package/i18n/es.json +4 -2
- package/i18n/fr.json +3 -1
- package/i18n/it.json +3 -1
- package/i18n/nl.json +4 -2
- package/i18n/pl.json +3 -1
- package/i18n/pt.json +4 -2
- package/i18n/ru.json +5 -3
- package/i18n/uk.json +4 -2
- package/i18n/zh-cn.json +4 -2
- package/package.json +1 -1
package/Components/Utils.js
CHANGED
|
@@ -14,7 +14,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
14
14
|
var _copyToClipboard = _interopRequireDefault(require("./copy-to-clipboard"));
|
|
15
15
|
var _i18n = _interopRequireDefault(require("../i18n"));
|
|
16
16
|
/**
|
|
17
|
-
* Copyright 2018-2023
|
|
17
|
+
* Copyright 2018-2023 Denis Haev <dogafox@gmail.com>
|
|
18
18
|
*
|
|
19
19
|
* MIT License
|
|
20
20
|
*
|
|
@@ -72,7 +72,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
72
72
|
}, {
|
|
73
73
|
key: "formatSeconds",
|
|
74
74
|
value: function formatSeconds(seconds) {
|
|
75
|
-
var
|
|
75
|
+
var days_ = Math.floor(seconds / (3600 * 24));
|
|
76
76
|
seconds %= 3600 * 24;
|
|
77
77
|
var hours = Math.floor(seconds / 3600);
|
|
78
78
|
if (hours < 10) {
|
|
@@ -89,8 +89,8 @@ var Utils = /*#__PURE__*/function () {
|
|
|
89
89
|
seconds = "0".concat(seconds);
|
|
90
90
|
}
|
|
91
91
|
var text = '';
|
|
92
|
-
if (
|
|
93
|
-
text += "".concat(
|
|
92
|
+
if (days_) {
|
|
93
|
+
text += "".concat(days_, " ").concat(_i18n["default"].t('ra_daysShortText'), " ");
|
|
94
94
|
}
|
|
95
95
|
text += "".concat(hours, ":").concat(minutes, ":").concat(seconds);
|
|
96
96
|
return text;
|
|
@@ -109,7 +109,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
109
109
|
key: "getObjectName",
|
|
110
110
|
value: function getObjectName(objects, id, settings, options, isDesc) {
|
|
111
111
|
var item = objects[id];
|
|
112
|
-
var text
|
|
112
|
+
var text;
|
|
113
113
|
var attr = isDesc ? 'desc' : 'name';
|
|
114
114
|
if (typeof settings === 'string' && !options) {
|
|
115
115
|
options = {
|
|
@@ -198,7 +198,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
198
198
|
}, {
|
|
199
199
|
key: "getSettingsOrder",
|
|
200
200
|
value: function getSettingsOrder(obj, forEnumId, options) {
|
|
201
|
-
if (obj &&
|
|
201
|
+
if (obj && Object.prototype.hasOwnProperty.call(obj, 'common')) {
|
|
202
202
|
obj = obj.common;
|
|
203
203
|
}
|
|
204
204
|
var settings;
|
|
@@ -226,7 +226,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
226
226
|
}, {
|
|
227
227
|
key: "getSettingsCustomURLs",
|
|
228
228
|
value: function getSettingsCustomURLs(obj, forEnumId, options) {
|
|
229
|
-
if (obj &&
|
|
229
|
+
if (obj && Object.prototype.hasOwnProperty.call(obj, 'common')) {
|
|
230
230
|
obj = obj.common;
|
|
231
231
|
}
|
|
232
232
|
var settings;
|
|
@@ -271,13 +271,14 @@ var Utils = /*#__PURE__*/function () {
|
|
|
271
271
|
}, {
|
|
272
272
|
key: "getSettings",
|
|
273
273
|
value: function getSettings(obj, options, defaultEnabling) {
|
|
274
|
+
var _obj;
|
|
274
275
|
var settings;
|
|
275
276
|
var id = obj && obj._id || options && options.id;
|
|
276
|
-
if (obj &&
|
|
277
|
+
if (obj && Object.prototype.hasOwnProperty.call(obj, 'common')) {
|
|
277
278
|
obj = obj.common;
|
|
278
279
|
}
|
|
279
|
-
if (obj &&
|
|
280
|
-
settings = obj.custom
|
|
280
|
+
if ((_obj = obj) !== null && _obj !== void 0 && _obj.custom) {
|
|
281
|
+
settings = obj.custom;
|
|
281
282
|
settings = settings[NAMESPACE] && settings[NAMESPACE][options.user || 'admin'] ? JSON.parse(JSON.stringify(settings[NAMESPACE][options.user || 'admin'])) : {
|
|
282
283
|
enabled: true
|
|
283
284
|
};
|
|
@@ -287,31 +288,27 @@ var Utils = /*#__PURE__*/function () {
|
|
|
287
288
|
useCustom: false
|
|
288
289
|
};
|
|
289
290
|
}
|
|
290
|
-
if (!
|
|
291
|
+
if (!Object.prototype.hasOwnProperty.call(settings, 'enabled')) {
|
|
291
292
|
settings.enabled = defaultEnabling === undefined ? true : defaultEnabling;
|
|
292
293
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
if (
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
if (obj) {
|
|
310
|
-
if (!settings.color && obj.color) settings.color = obj.color;
|
|
311
|
-
if (!settings.icon && obj.icon) settings.icon = obj.icon;
|
|
312
|
-
if (!settings.name && obj.name) settings.name = obj.name;
|
|
313
|
-
}
|
|
294
|
+
|
|
295
|
+
// if (false && settings.useCommon) {
|
|
296
|
+
// if (obj.color) settings.color = obj.color;
|
|
297
|
+
// if (obj.icon) settings.icon = obj.icon;
|
|
298
|
+
// if (obj.name) settings.name = obj.name;
|
|
299
|
+
// } else {
|
|
300
|
+
if (options) {
|
|
301
|
+
if (!settings.name && options.name) settings.name = options.name;
|
|
302
|
+
if (!settings.icon && options.icon) settings.icon = options.icon;
|
|
303
|
+
if (!settings.color && options.color) settings.color = options.color;
|
|
304
|
+
}
|
|
305
|
+
if (obj) {
|
|
306
|
+
if (!settings.color && obj.color) settings.color = obj.color;
|
|
307
|
+
if (!settings.icon && obj.icon) settings.icon = obj.icon;
|
|
308
|
+
if (!settings.name && obj.name) settings.name = obj.name;
|
|
314
309
|
}
|
|
310
|
+
// }
|
|
311
|
+
|
|
315
312
|
if ((0, _typeof2["default"])(settings.name) === 'object') {
|
|
316
313
|
settings.name = settings.name[options.language] || settings.name.en;
|
|
317
314
|
settings.name = (settings.name || '').toString().replace(/_/g, ' ');
|
|
@@ -448,38 +445,39 @@ var Utils = /*#__PURE__*/function () {
|
|
|
448
445
|
}, {
|
|
449
446
|
key: "splitCamelCase",
|
|
450
447
|
value: function splitCamelCase(text) {
|
|
451
|
-
if (false && text !== text.toUpperCase()) {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
}
|
|
448
|
+
// if (false && text !== text.toUpperCase()) {
|
|
449
|
+
// const words = text.split(/\s+/);
|
|
450
|
+
// for (let i = 0; i < words.length; i++) {
|
|
451
|
+
// const word = words[i];
|
|
452
|
+
// if (word.toLowerCase() !== word && word.toUpperCase() !== word) {
|
|
453
|
+
// let z = 0;
|
|
454
|
+
// const ww = [];
|
|
455
|
+
// let start = 0;
|
|
456
|
+
// while (z < word.length) {
|
|
457
|
+
// if (word[z].match(/[A-ZÜÄÖА-Я]/)) {
|
|
458
|
+
// ww.push(word.substring(start, z));
|
|
459
|
+
// start = z;
|
|
460
|
+
// }
|
|
461
|
+
// z++;
|
|
462
|
+
// }
|
|
463
|
+
// if (start !== z) {
|
|
464
|
+
// ww.push(word.substring(start, z));
|
|
465
|
+
// }
|
|
466
|
+
// for (let k = 0; k < ww.length; k++) {
|
|
467
|
+
// words.splice(i + k, 0, ww[k]);
|
|
468
|
+
// }
|
|
469
|
+
// i += ww.length;
|
|
470
|
+
// }
|
|
471
|
+
// }
|
|
472
|
+
//
|
|
473
|
+
// return words.map(w => {
|
|
474
|
+
// w = w.trim();
|
|
475
|
+
// if (w) {
|
|
476
|
+
// return w[0].toUpperCase() + w.substring(1).toLowerCase();
|
|
477
|
+
// }
|
|
478
|
+
// return '';
|
|
479
|
+
// }).join(' ');
|
|
480
|
+
// }
|
|
483
481
|
return Utils.CapitalWords(text);
|
|
484
482
|
}
|
|
485
483
|
|
|
@@ -672,28 +670,26 @@ var Utils = /*#__PURE__*/function () {
|
|
|
672
670
|
return y > 31;
|
|
673
671
|
});
|
|
674
672
|
a.splice(a.indexOf(year), 1);
|
|
675
|
-
var day = a.find(function (
|
|
676
|
-
return
|
|
673
|
+
var day = a.find(function (mm) {
|
|
674
|
+
return mm > 12;
|
|
677
675
|
});
|
|
678
676
|
if (day) {
|
|
679
677
|
a.splice(a.indexOf(day), 1);
|
|
680
678
|
now = new Date(year, a[0] - 1, day);
|
|
681
|
-
} else {
|
|
679
|
+
} else if (Utils.dateFormat[0][0] === 'M' && Utils.dateFormat[1][0] === 'D') {
|
|
682
680
|
// MM DD
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
if (Math.abs(now.getTime - Date.now()) > 3600000 * 24 * 10) {
|
|
686
|
-
now = new Date(year, a[1] - 1, a[0]);
|
|
687
|
-
}
|
|
688
|
-
} else if (Utils.dateFormat[0][0] === 'D' && Utils.dateFormat[1][0] === 'M') {
|
|
689
|
-
// DD MM
|
|
681
|
+
now = new Date(year, a[0] - 1, a[1]);
|
|
682
|
+
if (Math.abs(now.getTime - Date.now()) > 3600000 * 24 * 10) {
|
|
690
683
|
now = new Date(year, a[1] - 1, a[0]);
|
|
691
|
-
if (Math.abs(now.getTime - Date.now()) > 3600000 * 24 * 10) {
|
|
692
|
-
now = new Date(year, a[0] - 1, a[1]);
|
|
693
|
-
}
|
|
694
|
-
} else {
|
|
695
|
-
now = new Date(now);
|
|
696
684
|
}
|
|
685
|
+
} else if (Utils.dateFormat[0][0] === 'D' && Utils.dateFormat[1][0] === 'M') {
|
|
686
|
+
// DD MM
|
|
687
|
+
now = new Date(year, a[1] - 1, a[0]);
|
|
688
|
+
if (Math.abs(now.getTime - Date.now()) > 3600000 * 24 * 10) {
|
|
689
|
+
now = new Date(year, a[0] - 1, a[1]);
|
|
690
|
+
}
|
|
691
|
+
} else {
|
|
692
|
+
now = new Date(now);
|
|
697
693
|
}
|
|
698
694
|
} else {
|
|
699
695
|
now = new Date(now);
|
|
@@ -775,7 +771,9 @@ var Utils = /*#__PURE__*/function () {
|
|
|
775
771
|
}, {
|
|
776
772
|
key: "getSmartName",
|
|
777
773
|
value: function getSmartName(states, id, instanceId, noCommon) {
|
|
774
|
+
var _states$id$common;
|
|
778
775
|
if (!id) {
|
|
776
|
+
var _states$common;
|
|
779
777
|
if (!noCommon) {
|
|
780
778
|
if (!states.common) {
|
|
781
779
|
return states.smartName;
|
|
@@ -788,12 +786,12 @@ var Utils = /*#__PURE__*/function () {
|
|
|
788
786
|
if (states && !states.common) {
|
|
789
787
|
return states.smartName;
|
|
790
788
|
}
|
|
791
|
-
return states && states
|
|
789
|
+
return states !== null && states !== void 0 && (_states$common = states.common) !== null && _states$common !== void 0 && _states$common.custom && states.common.custom[instanceId] ? states.common.custom[instanceId].smartName : undefined;
|
|
792
790
|
}
|
|
793
791
|
if (!noCommon) {
|
|
794
792
|
return states[id].common.smartName;
|
|
795
793
|
}
|
|
796
|
-
return states[id] && states[id].common &&
|
|
794
|
+
return states[id] && (_states$id$common = states[id].common) !== null && _states$id$common !== void 0 && _states$id$common.custom && states[id].common.custom[instanceId] ? states[id].common.custom[instanceId].smartName || null : null;
|
|
797
795
|
}
|
|
798
796
|
|
|
799
797
|
/**
|
|
@@ -805,6 +803,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
805
803
|
}, {
|
|
806
804
|
key: "getSmartNameFromObj",
|
|
807
805
|
value: function getSmartNameFromObj(obj, instanceId, noCommon) {
|
|
806
|
+
var _obj$common;
|
|
808
807
|
if (!noCommon) {
|
|
809
808
|
if (!obj.common) {
|
|
810
809
|
return obj.smartName;
|
|
@@ -817,7 +816,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
817
816
|
if (obj && !obj.common) {
|
|
818
817
|
return obj.smartName;
|
|
819
818
|
}
|
|
820
|
-
return obj && obj
|
|
819
|
+
return obj !== null && obj !== void 0 && (_obj$common = obj.common) !== null && _obj$common !== void 0 && _obj$common.custom && obj.common.custom[instanceId] ? obj.common.custom[instanceId].smartName : undefined;
|
|
821
820
|
}
|
|
822
821
|
|
|
823
822
|
/**
|
|
@@ -938,7 +937,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
938
937
|
var empty = true;
|
|
939
938
|
// Check if the structure has any definitions
|
|
940
939
|
for (var key in smartName) {
|
|
941
|
-
if (
|
|
940
|
+
if (Object.prototype.hasOwnProperty.call(smartName, key)) {
|
|
942
941
|
empty = false;
|
|
943
942
|
break;
|
|
944
943
|
}
|
|
@@ -1115,14 +1114,14 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1115
1114
|
var b = parseInt(hex.slice(4, 6), 16);
|
|
1116
1115
|
if (bw) {
|
|
1117
1116
|
// http://stackoverflow.com/a/3943023/112731
|
|
1118
|
-
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? "#000000".concat(alfa
|
|
1117
|
+
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? "#000000".concat(alfa || '') : "#FFFFFF".concat(alfa || '');
|
|
1119
1118
|
}
|
|
1120
1119
|
// invert color components
|
|
1121
1120
|
r = (255 - r).toString(16);
|
|
1122
1121
|
g = (255 - g).toString(16);
|
|
1123
1122
|
b = (255 - b).toString(16);
|
|
1124
1123
|
// pad each with zeros and return
|
|
1125
|
-
return "#".concat(r.padStart(2, '0')).concat(g.padStart(2, '0')).concat(b.padStart(2, '0')).concat(alfa
|
|
1124
|
+
return "#".concat(r.padStart(2, '0')).concat(g.padStart(2, '0')).concat(b.padStart(2, '0')).concat(alfa || '');
|
|
1126
1125
|
}
|
|
1127
1126
|
|
|
1128
1127
|
/**
|
|
@@ -1141,7 +1140,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1141
1140
|
if (m) {
|
|
1142
1141
|
hex = parseInt(m[1], 10).toString(16).padStart(2, '0') + parseInt(m[2], 10).toString(16).padStart(2, '0') + parseInt(m[2], 10).toString(16).padStart(2, '0');
|
|
1143
1142
|
}
|
|
1144
|
-
} else if (hex.startsWith('
|
|
1143
|
+
} else if (hex.startsWith('rgb')) {
|
|
1145
1144
|
var _m2 = hex.match(/rgb?\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
1146
1145
|
if (_m2) {
|
|
1147
1146
|
hex = parseInt(_m2[1], 10).toString(16).padStart(2, '0') + parseInt(_m2[2], 10).toString(16).padStart(2, '0') + parseInt(_m2[2], 10).toString(16).padStart(2, '0');
|
|
@@ -1267,6 +1266,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1267
1266
|
var x;
|
|
1268
1267
|
var str = '';
|
|
1269
1268
|
while (i < arguments.length) {
|
|
1269
|
+
// eslint-disable-next-line prefer-rest-params
|
|
1270
1270
|
tmp = arguments[i++];
|
|
1271
1271
|
if (tmp) {
|
|
1272
1272
|
x = Utils._toVal(tmp);
|
|
@@ -1291,7 +1291,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1291
1291
|
if (window.vendorPrefix && window.vendorPrefix !== '@@vendorPrefix@@') {
|
|
1292
1292
|
return window.vendorPrefix;
|
|
1293
1293
|
}
|
|
1294
|
-
return themeName
|
|
1294
|
+
return themeName || ((window._localStorage || window.localStorage).getItem('App.themeName') ? (window._localStorage || window.localStorage).getItem('App.themeName') : window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'colored');
|
|
1295
1295
|
}
|
|
1296
1296
|
|
|
1297
1297
|
/**
|
|
@@ -1483,9 +1483,8 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1483
1483
|
return "".concat(h, ":").concat(m.toString().padStart(2, '0'), ":").concat(s.toString().padStart(2, '0'));
|
|
1484
1484
|
}
|
|
1485
1485
|
return "0:".concat(m.toString().padStart(2, '0'), ":").concat(s.toString().padStart(2, '0'));
|
|
1486
|
-
} else {
|
|
1487
|
-
return '0:00:00';
|
|
1488
1486
|
}
|
|
1487
|
+
return '0:00:00';
|
|
1489
1488
|
}
|
|
1490
1489
|
}, {
|
|
1491
1490
|
key: "MDtext2link",
|
|
@@ -1510,9 +1509,9 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1510
1509
|
}, {
|
|
1511
1510
|
key: "MDgetTitle",
|
|
1512
1511
|
value: function MDgetTitle(text) {
|
|
1513
|
-
var
|
|
1514
|
-
|
|
1515
|
-
|
|
1512
|
+
var result = Utils.extractHeader(text);
|
|
1513
|
+
var header = result.header;
|
|
1514
|
+
var body = result.body;
|
|
1516
1515
|
if (!header.title) {
|
|
1517
1516
|
// remove {docsify-bla}
|
|
1518
1517
|
body = body.replace(/{[^}]*}/g, '');
|
|
@@ -1540,10 +1539,10 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1540
1539
|
if (!line.trim()) {
|
|
1541
1540
|
return;
|
|
1542
1541
|
}
|
|
1543
|
-
var
|
|
1544
|
-
if (
|
|
1545
|
-
var attr = line.substring(0,
|
|
1546
|
-
attrs[attr] = line.substring(
|
|
1542
|
+
var pos_ = line.indexOf(':');
|
|
1543
|
+
if (pos_ !== -1) {
|
|
1544
|
+
var attr = line.substring(0, pos_).trim();
|
|
1545
|
+
attrs[attr] = line.substring(pos_ + 1).trim();
|
|
1547
1546
|
attrs[attr] = attrs[attr].replace(/^['"]|['"]$/g, '');
|
|
1548
1547
|
if (attrs[attr] === 'true') {
|
|
1549
1548
|
attrs[attr] = true;
|
|
@@ -1579,6 +1578,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1579
1578
|
/**
|
|
1580
1579
|
* Generate the json file on the file for download.
|
|
1581
1580
|
* @param {string} filename file name
|
|
1581
|
+
* @param {string} json file data
|
|
1582
1582
|
* @returns {object} json structure (not stringified)
|
|
1583
1583
|
*/
|
|
1584
1584
|
}, {
|
|
@@ -1601,19 +1601,25 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1601
1601
|
}, {
|
|
1602
1602
|
key: "quality2text",
|
|
1603
1603
|
value: function quality2text(quality) {
|
|
1604
|
+
// eslint-disable-next-line no-bitwise
|
|
1604
1605
|
var custom = quality & 0xFFFF0000;
|
|
1605
1606
|
var text = QUALITY_BITS[quality];
|
|
1606
1607
|
var result;
|
|
1607
1608
|
if (text) {
|
|
1608
1609
|
result = [text];
|
|
1610
|
+
// eslint-disable-next-line no-bitwise
|
|
1609
1611
|
} else if (quality & 0x01) {
|
|
1612
|
+
// eslint-disable-next-line no-bitwise
|
|
1610
1613
|
result = [QUALITY_BITS[0x01], "0x".concat((quality & (0xFFFF & ~1)).toString(16))];
|
|
1614
|
+
// eslint-disable-next-line no-bitwise
|
|
1611
1615
|
} else if (quality & 0x02) {
|
|
1616
|
+
// eslint-disable-next-line no-bitwise
|
|
1612
1617
|
result = [QUALITY_BITS[0x02], "0x".concat((quality & (0xFFFF & ~2)).toString(16))];
|
|
1613
1618
|
} else {
|
|
1614
1619
|
result = ["0x".concat(quality.toString(16))];
|
|
1615
1620
|
}
|
|
1616
1621
|
if (custom) {
|
|
1622
|
+
// eslint-disable-next-line no-bitwise
|
|
1617
1623
|
result.push("0x".concat((custom >> 16).toString(16).toUpperCase()));
|
|
1618
1624
|
}
|
|
1619
1625
|
return result;
|
|
@@ -1638,8 +1644,8 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1638
1644
|
}, {
|
|
1639
1645
|
key: "getStates",
|
|
1640
1646
|
value: function getStates(obj) {
|
|
1641
|
-
var _obj$
|
|
1642
|
-
var states = obj === null || obj === void 0 || (_obj$
|
|
1647
|
+
var _obj$common2;
|
|
1648
|
+
var states = obj === null || obj === void 0 || (_obj$common2 = obj.common) === null || _obj$common2 === void 0 ? void 0 : _obj$common2.states;
|
|
1643
1649
|
if (states) {
|
|
1644
1650
|
if (typeof states === 'string' && states[0] === '{') {
|
|
1645
1651
|
try {
|
|
@@ -1689,6 +1695,7 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1689
1695
|
}).then(function (blob) {
|
|
1690
1696
|
return new Promise(function (resolve) {
|
|
1691
1697
|
var reader = new FileReader();
|
|
1698
|
+
// eslint-disable-next-line func-names
|
|
1692
1699
|
reader.onload = function () {
|
|
1693
1700
|
// do not optimize this function. "this" is important.
|
|
1694
1701
|
resolve(this.result);
|