@iobroker/adapter-react-v5 4.9.1 → 4.9.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/Components/CopyToClipboard.d.ts +6 -0
- package/Components/CopyToClipboard.js +158 -0
- package/Components/Image.d.ts +17 -57
- package/Components/Image.js +125 -162
- package/Components/MDUtils.d.ts +9 -9
- package/Components/MDUtils.js +82 -109
- package/Components/ObjectBrowser.d.ts +1 -1
- package/Components/TextWithIcon.d.ts +1 -1
- package/Components/Utils.d.ts +123 -187
- package/Components/Utils.js +1300 -1502
- package/LegacyConnection.d.ts +3 -3
- package/Prompt.d.ts +1 -1
- package/Prompt.js +14 -12
- package/README.md +3 -0
- package/i18n.d.ts +6 -6
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/package.json +2 -2
- package/Components/Image.js.map +0 -1
- package/Components/MDUtils.js.map +0 -1
- package/Components/Utils.js.map +0 -1
- package/Components/copy-to-clipboard.d.ts +0 -2
- package/Components/copy-to-clipboard.js +0 -161
- package/Components/copy-to-clipboard.js.map +0 -1
- package/Prompt.js.map +0 -1
package/Components/MDUtils.js
CHANGED
|
@@ -1,119 +1,92 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
* MIT License
|
|
16
|
-
*
|
|
17
|
-
**/
|
|
18
|
-
var MDUtils = /*#__PURE__*/function () {
|
|
19
|
-
function MDUtils() {
|
|
20
|
-
(0, _classCallCheck2["default"])(this, MDUtils);
|
|
21
|
-
}
|
|
22
|
-
(0, _createClass2["default"])(MDUtils, null, [{
|
|
23
|
-
key: "text2link",
|
|
24
|
-
value: function text2link(text) {
|
|
25
|
-
var m = text.match(/\d+\.\)\s/);
|
|
26
|
-
if (m) {
|
|
27
|
-
text = text.replace(m[0], m[0].replace(/\s/, ' '));
|
|
28
|
-
}
|
|
29
|
-
return text.replace(/[^a-zA-Zа-яА-Я0-9]/g, '').trim().replace(/\s/g, '').toLowerCase();
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "openLink",
|
|
33
|
-
value: function openLink(url, target) {
|
|
34
|
-
if (target === 'this') {
|
|
35
|
-
window.location = url;
|
|
36
|
-
} else {
|
|
37
|
-
window.open(url, target || '_blank');
|
|
38
|
-
}
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const CopyToClipboard_1 = __importDefault(require("./CopyToClipboard"));
|
|
7
|
+
class MDUtils {
|
|
8
|
+
static text2link(text) {
|
|
9
|
+
const m = text.match(/\d+\.\)\s/);
|
|
10
|
+
if (m) {
|
|
11
|
+
text = text.replace(m[0], m[0].replace(/\s/, ' '));
|
|
12
|
+
}
|
|
13
|
+
return text.replace(/[^a-zA-Zа-яА-Я0-9]/g, '').trim().replace(/\s/g, '').toLowerCase();
|
|
39
14
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (!header.title) {
|
|
47
|
-
// remove {docsify-bla}
|
|
48
|
-
body = body.replace(/{[^}]*}/g, '');
|
|
49
|
-
body = body.trim();
|
|
50
|
-
var lines = body.replace(/\r/g, '').split('\n');
|
|
51
|
-
for (var i = 0; i < lines.length; i++) {
|
|
52
|
-
if (lines[i].startsWith('# ')) {
|
|
53
|
-
return lines[i].substring(2).trim();
|
|
54
|
-
}
|
|
15
|
+
static openLink(url, target) {
|
|
16
|
+
if (target === 'this') {
|
|
17
|
+
window.location.href = url;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
window.open(url, target || '_blank');
|
|
55
21
|
}
|
|
56
|
-
return '';
|
|
57
|
-
}
|
|
58
|
-
return header.title;
|
|
59
22
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
23
|
+
static getTitle(text) {
|
|
24
|
+
const result = MDUtils.extractHeader(text);
|
|
25
|
+
let body = result.body;
|
|
26
|
+
const header = result.header;
|
|
27
|
+
if (!header.title) {
|
|
28
|
+
// remove {docsify-bla}
|
|
29
|
+
body = body.replace(/{[^}]*}/g, '');
|
|
30
|
+
body = body.trim();
|
|
31
|
+
const lines = body.replace(/\r/g, '').split('\n');
|
|
32
|
+
for (let i = 0; i < lines.length; i++) {
|
|
33
|
+
if (lines[i].startsWith('# ')) {
|
|
34
|
+
return lines[i].substring(2).trim();
|
|
35
|
+
}
|
|
72
36
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
return header.title;
|
|
40
|
+
}
|
|
41
|
+
static extractHeader(text) {
|
|
42
|
+
const attrs = {};
|
|
43
|
+
if (text.substring(0, 3) === '---') {
|
|
44
|
+
const pos = text.substring(3).indexOf('\n---');
|
|
45
|
+
if (pos !== -1) {
|
|
46
|
+
const _header = text.substring(3, pos + 3);
|
|
47
|
+
const lines = _header.replace(/\r/g, '').split('\n');
|
|
48
|
+
lines.forEach(line => {
|
|
49
|
+
if (!line.trim()) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const pos_ = line.indexOf(':');
|
|
53
|
+
if (pos_ !== -1) {
|
|
54
|
+
const attr = line.substring(0, pos_).trim();
|
|
55
|
+
let val = line.substring(pos_ + 1).trim();
|
|
56
|
+
val = val.replace(/^['"]|['"]$/g, '');
|
|
57
|
+
if (val === 'true') {
|
|
58
|
+
attrs[attr] = true;
|
|
59
|
+
}
|
|
60
|
+
else if (val === 'false') {
|
|
61
|
+
attrs[attr] = false;
|
|
62
|
+
}
|
|
63
|
+
else if (parseFloat(val).toString() === val) {
|
|
64
|
+
attrs[attr] = parseFloat(val);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
attrs[attr] = val;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
attrs[line.trim()] = true;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
text = text.substring(pos + 7);
|
|
87
75
|
}
|
|
88
|
-
});
|
|
89
|
-
text = text.substring(pos + 7);
|
|
90
76
|
}
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
header: attrs,
|
|
94
|
-
body: text
|
|
95
|
-
};
|
|
77
|
+
return { header: attrs, body: text };
|
|
96
78
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return text = text.replace(doc, '');
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return text;
|
|
79
|
+
static removeDocsify(text) {
|
|
80
|
+
const m = text.match(/{docsify-[^}]*}/g);
|
|
81
|
+
if (m) {
|
|
82
|
+
m.forEach(doc => text = text.replace(doc, ''));
|
|
83
|
+
}
|
|
84
|
+
return text;
|
|
107
85
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
e && e.stopPropagation();
|
|
113
|
-
e && e.preventDefault();
|
|
86
|
+
static onCopy(e, text) {
|
|
87
|
+
(0, CopyToClipboard_1.default)(text);
|
|
88
|
+
e && e.stopPropagation();
|
|
89
|
+
e && e.preventDefault();
|
|
114
90
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}();
|
|
118
|
-
var _default = exports["default"] = MDUtils;
|
|
119
|
-
//# sourceMappingURL=MDUtils.js.map
|
|
91
|
+
}
|
|
92
|
+
exports.default = MDUtils;
|
|
@@ -436,7 +436,7 @@ declare class ObjectBrowser extends React.Component<import("./types").ObjectBrow
|
|
|
436
436
|
* @param {string} text
|
|
437
437
|
*/
|
|
438
438
|
private onCopy;
|
|
439
|
-
renderTooltipAccessControl: (acl: any) => React.JSX.Element
|
|
439
|
+
renderTooltipAccessControl: (acl: any) => "" | React.JSX.Element;
|
|
440
440
|
/**
|
|
441
441
|
* @param {string} id
|
|
442
442
|
* @param {{ data: { obj: { type: string; }; hasCustoms: any; }; }} item
|
|
@@ -11,7 +11,7 @@ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
|
11
11
|
moreClasses: PropTypes.Requireable<object>;
|
|
12
12
|
icon: PropTypes.Requireable<string>;
|
|
13
13
|
color: PropTypes.Requireable<string>;
|
|
14
|
-
}>, "classes"> & import("@mui/styles").StyledComponentProps<"
|
|
14
|
+
}>, "classes"> & import("@mui/styles").StyledComponentProps<"div" | "text" | "icon"> & object>;
|
|
15
15
|
export default _default;
|
|
16
16
|
import PropTypes from 'prop-types';
|
|
17
17
|
import React from 'react';
|