@iobroker/adapter-react-v5 6.1.3 → 6.1.5
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/README.md +3 -0
- package/craco-module-federation.js +1 -1
- package/package.json +1 -1
- package/src/AdminConnection.tsx +3 -0
- package/src/Components/404.tsx +121 -0
- package/src/Components/ColorPicker.tsx +315 -0
- package/src/Components/ComplexCron.tsx +507 -0
- package/src/Components/CopyToClipboard.tsx +165 -0
- package/src/Components/CustomModal.tsx +163 -0
- package/src/Components/FileBrowser.tsx +2394 -0
- package/src/Components/FileViewer.tsx +384 -0
- package/src/Components/Icon.tsx +210 -0
- package/src/Components/IconPicker.tsx +149 -0
- package/src/Components/IconSelector.tsx +2202 -0
- package/src/Components/Image.tsx +176 -0
- package/src/Components/Loader.tsx +304 -0
- package/src/Components/Logo.tsx +166 -0
- package/src/Components/MDUtils.tsx +100 -0
- package/src/Components/ObjectBrowser.tsx +7915 -0
- package/src/Components/Router.tsx +90 -0
- package/src/Components/SaveCloseButtons.tsx +113 -0
- package/src/Components/Schedule.tsx +1724 -0
- package/src/Components/SelectWithIcon.tsx +197 -0
- package/src/Components/TabContainer.tsx +55 -0
- package/src/Components/TabContent.tsx +37 -0
- package/src/Components/TabHeader.tsx +19 -0
- package/src/Components/TableResize.tsx +259 -0
- package/src/Components/TextWithIcon.tsx +148 -0
- package/src/Components/ToggleThemeMenu.tsx +34 -0
- package/src/Components/TreeTable.tsx +919 -0
- package/src/Components/UploadImage.tsx +599 -0
- package/src/Components/Utils.tsx +1794 -0
- package/src/Components/loader.css +222 -0
- package/src/Components/withWidth.tsx +21 -0
- package/src/Connection.tsx +7 -0
- package/src/Dialogs/ComplexCron.tsx +129 -0
- package/src/Dialogs/Confirm.tsx +162 -0
- package/src/Dialogs/Cron.tsx +182 -0
- package/src/Dialogs/Error.tsx +72 -0
- package/src/Dialogs/Message.tsx +71 -0
- package/src/Dialogs/SelectFile.tsx +270 -0
- package/src/Dialogs/SelectID.tsx +298 -0
- package/src/Dialogs/SimpleCron.tsx +100 -0
- package/src/Dialogs/TextInput.tsx +107 -0
- package/src/GenericApp.tsx +976 -0
- package/src/LegacyConnection.tsx +3589 -0
- package/src/Prompt.tsx +20 -0
- package/src/Theme.tsx +479 -0
- package/src/icons/IconAdapter.tsx +20 -0
- package/src/icons/IconAlias.tsx +20 -0
- package/src/icons/IconChannel.tsx +21 -0
- package/src/icons/IconClearFilter.tsx +22 -0
- package/src/icons/IconClosed.tsx +17 -0
- package/src/icons/IconCopy.tsx +16 -0
- package/src/icons/IconDevice.tsx +27 -0
- package/src/icons/IconDocument.tsx +17 -0
- package/src/icons/IconDocumentReadOnly.tsx +18 -0
- package/src/icons/IconExpert.tsx +18 -0
- package/src/icons/IconFx.tsx +36 -0
- package/src/icons/IconInstance.tsx +20 -0
- package/src/icons/IconLogout.tsx +30 -0
- package/src/icons/IconNoIcon.tsx +19 -0
- package/src/icons/IconOpen.tsx +17 -0
- package/src/icons/IconProps.tsx +15 -0
- package/src/icons/IconState.tsx +17 -0
- package/src/index.css +55 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* */
|
|
7
|
+
import copy from './CopyToClipboard';
|
|
8
|
+
|
|
9
|
+
class MDUtils {
|
|
10
|
+
static text2link(text: string): string {
|
|
11
|
+
const m = text.match(/\d+\.\)\s/);
|
|
12
|
+
if (m) {
|
|
13
|
+
text = text.replace(m[0], m[0].replace(/\s/, ' '));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return text.replace(/[^a-zA-Zа-яА-Я0-9]/g, '').trim().replace(/\s/g, '').toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static openLink(url: string, target?: string) {
|
|
20
|
+
// replace IPv6 Address with [ipv6]:port
|
|
21
|
+
url = url.replace(/\/\/([0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*)(:\d+)?\//i, '//[$1]$2/');
|
|
22
|
+
|
|
23
|
+
if (target === 'this') {
|
|
24
|
+
window.location.href = url;
|
|
25
|
+
} else {
|
|
26
|
+
window.open(url, target || '_blank');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static getTitle(text: string) {
|
|
31
|
+
const result = MDUtils.extractHeader(text);
|
|
32
|
+
let body = result.body;
|
|
33
|
+
const header = result.header;
|
|
34
|
+
if (!header.title) {
|
|
35
|
+
// remove {docsify-bla}
|
|
36
|
+
body = body.replace(/{[^}]*}/g, '');
|
|
37
|
+
body = body.trim();
|
|
38
|
+
const lines = body.replace(/\r/g, '').split('\n');
|
|
39
|
+
for (let i = 0; i < lines.length; i++) {
|
|
40
|
+
if (lines[i].startsWith('# ')) {
|
|
41
|
+
return lines[i].substring(2).trim();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return header.title;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static extractHeader(text: string): { header: Record<string, string | boolean | number>; body: string } {
|
|
51
|
+
const attrs: Record<string, string | boolean | number> = {};
|
|
52
|
+
if (text.substring(0, 3) === '---') {
|
|
53
|
+
const pos = text.substring(3).indexOf('\n---');
|
|
54
|
+
if (pos !== -1) {
|
|
55
|
+
const _header = text.substring(3, pos + 3);
|
|
56
|
+
const lines = _header.replace(/\r/g, '').split('\n');
|
|
57
|
+
lines.forEach(line => {
|
|
58
|
+
if (!line.trim()) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const pos_ = line.indexOf(':');
|
|
62
|
+
if (pos_ !== -1) {
|
|
63
|
+
const attr = line.substring(0, pos_).trim();
|
|
64
|
+
let val: string = line.substring(pos_ + 1).trim();
|
|
65
|
+
val = val.replace(/^['"]|['"]$/g, '');
|
|
66
|
+
if (val === 'true') {
|
|
67
|
+
attrs[attr] = true;
|
|
68
|
+
} else if (val === 'false') {
|
|
69
|
+
attrs[attr] = false;
|
|
70
|
+
} else if (parseFloat(val).toString() === val) {
|
|
71
|
+
attrs[attr] = parseFloat(val);
|
|
72
|
+
} else {
|
|
73
|
+
attrs[attr] = val;
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
attrs[line.trim()] = true;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
text = text.substring(pos + 7);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return { header: attrs, body: text };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static removeDocsify(text: string): string {
|
|
86
|
+
const m = text.match(/{docsify-[^}]*}/g);
|
|
87
|
+
if (m) {
|
|
88
|
+
m.forEach(doc => text = text.replace(doc, ''));
|
|
89
|
+
}
|
|
90
|
+
return text;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static onCopy(e: Event | null, text: string): void {
|
|
94
|
+
copy(text);
|
|
95
|
+
e && e.stopPropagation();
|
|
96
|
+
e && e.preventDefault();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default MDUtils;
|