@iobroker/adapter-react-v5 7.2.3 → 7.2.6
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 -3
- package/build/AdminConnection.d.ts +1 -0
- package/build/AdminConnection.js +2 -0
- package/build/AdminConnection.js.map +1 -0
- package/{src/Components/404.tsx → build/Components/404.js} +14 -39
- package/build/Components/404.js.map +1 -0
- package/{Components → build/Components}/ColorPicker.d.ts +2 -2
- package/{Components → build/Components}/ColorPicker.js +50 -65
- package/build/Components/ColorPicker.js.map +1 -0
- package/{Components → build/Components}/ComplexCron.d.ts +2 -2
- package/{Components → build/Components}/ComplexCron.js +43 -71
- package/build/Components/ComplexCron.js.map +1 -0
- package/{Components → build/Components}/CopyToClipboard.d.ts +1 -2
- package/{src/Components/CopyToClipboard.tsx → build/Components/CopyToClipboard.js} +20 -38
- package/build/Components/CopyToClipboard.js.map +1 -0
- package/{Components → build/Components}/CustomModal.d.ts +3 -3
- package/build/Components/CustomModal.js +60 -0
- package/build/Components/CustomModal.js.map +1 -0
- package/{Components → build/Components}/FileBrowser.d.ts +21 -21
- package/{Components → build/Components}/FileBrowser.js +253 -248
- package/build/Components/FileBrowser.js.map +1 -0
- package/build/Components/FileViewer.d.ts +48 -0
- package/build/Components/FileViewer.js +277 -0
- package/build/Components/FileViewer.js.map +1 -0
- package/{Components → build/Components}/Icon.d.ts +1 -1
- package/build/Components/Icon.js +140 -0
- package/build/Components/Icon.js.map +1 -0
- package/{Components → build/Components}/IconPicker.d.ts +2 -2
- package/build/Components/IconPicker.js +73 -0
- package/build/Components/IconPicker.js.map +1 -0
- package/{Components → build/Components}/IconSelector.d.ts +3 -3
- package/{Components → build/Components}/IconSelector.js +29 -57
- package/build/Components/IconSelector.js.map +1 -0
- package/{Components → build/Components}/Image.d.ts +2 -2
- package/{Components → build/Components}/Image.js +16 -22
- package/build/Components/Image.js.map +1 -0
- package/{Components → build/Components}/Loader.d.ts +2 -2
- package/{Components → build/Components}/Loader.js +15 -40
- package/build/Components/Loader.js.map +1 -0
- package/{Components → build/Components}/Loaders/MV.d.ts +2 -2
- package/build/Components/Loaders/MV.js +61 -0
- package/build/Components/Loaders/MV.js.map +1 -0
- package/{Components → build/Components}/Loaders/PT.d.ts +2 -2
- package/{Components → build/Components}/Loaders/PT.js +10 -35
- package/build/Components/Loaders/PT.js.map +1 -0
- package/{Components → build/Components}/Loaders/Vendor.d.ts +2 -2
- package/build/Components/Loaders/Vendor.js +52 -0
- package/build/Components/Loaders/Vendor.js.map +1 -0
- package/{Components → build/Components}/Logo.d.ts +2 -2
- package/build/Components/Logo.js +108 -0
- package/build/Components/Logo.js.map +1 -0
- package/{Components → build/Components}/MDUtils.d.ts +1 -2
- package/{Components → build/Components}/MDUtils.js +4 -9
- package/build/Components/MDUtils.js.map +1 -0
- package/{Components → build/Components}/ObjectBrowser.d.ts +7 -4
- package/{Components → build/Components}/ObjectBrowser.js +1183 -1133
- package/build/Components/ObjectBrowser.js.map +1 -0
- package/{Components → build/Components}/Router.d.ts +1 -2
- package/{Components → build/Components}/Router.js +6 -7
- package/build/Components/Router.js.map +1 -0
- package/{Components → build/Components}/SaveCloseButtons.d.ts +2 -2
- package/build/Components/SaveCloseButtons.js +65 -0
- package/build/Components/SaveCloseButtons.js.map +1 -0
- package/{Components → build/Components}/Schedule.d.ts +3 -3
- package/{Components → build/Components}/Schedule.js +246 -261
- package/build/Components/Schedule.js.map +1 -0
- package/{Components → build/Components}/SelectWithIcon.d.ts +2 -2
- package/build/Components/SelectWithIcon.js +135 -0
- package/build/Components/SelectWithIcon.js.map +1 -0
- package/build/Components/SimpleCron/cronText.js +15 -0
- package/build/Components/SimpleCron/cronText.js.map +1 -0
- package/{Components → build/Components}/SimpleCron/index.d.ts +2 -2
- package/{Components → build/Components}/SimpleCron/index.js +55 -56
- package/build/Components/SimpleCron/index.js.map +1 -0
- package/{Components → build/Components}/TabContainer.d.ts +2 -2
- package/build/Components/TabContainer.js +23 -0
- package/build/Components/TabContainer.js.map +1 -0
- package/{Components → build/Components}/TabContent.d.ts +3 -2
- package/build/Components/TabContent.js +20 -0
- package/build/Components/TabContent.js.map +1 -0
- package/build/Components/TabHeader.d.ts +6 -0
- package/build/Components/TabHeader.js +6 -0
- package/build/Components/TabHeader.js.map +1 -0
- package/{Components → build/Components}/TableResize.d.ts +2 -2
- package/{src/Components/TableResize.tsx → build/Components/TableResize.js} +64 -134
- package/build/Components/TableResize.js.map +1 -0
- package/{Components → build/Components}/TextWithIcon.d.ts +2 -2
- package/{src/Components/TextWithIcon.tsx → build/Components/TextWithIcon.js} +30 -75
- package/build/Components/TextWithIcon.js.map +1 -0
- package/{Components → build/Components}/ToggleThemeMenu.d.ts +1 -1
- package/build/Components/ToggleThemeMenu.js +13 -0
- package/build/Components/ToggleThemeMenu.js.map +1 -0
- package/{Components → build/Components}/TreeTable.d.ts +3 -3
- package/{Components → build/Components}/TreeTable.js +87 -99
- package/build/Components/TreeTable.js.map +1 -0
- package/{Components → build/Components}/UploadImage.d.ts +2 -2
- package/{Components → build/Components}/UploadImage.js +46 -69
- package/build/Components/UploadImage.js.map +1 -0
- package/{Components → build/Components}/Utils.d.ts +2 -2
- package/{Components → build/Components}/Utils.js +47 -60
- package/build/Components/Utils.js.map +1 -0
- package/build/Components/withWidth.d.ts +2 -0
- package/build/Components/withWidth.js +22 -0
- package/build/Components/withWidth.js.map +1 -0
- package/build/Connection.d.ts +1 -0
- package/build/Connection.js +2 -0
- package/build/Connection.js.map +1 -0
- package/{Dialogs → build/Dialogs}/ComplexCron.d.ts +2 -2
- package/build/Dialogs/ComplexCron.js +85 -0
- package/build/Dialogs/ComplexCron.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Confirm.d.ts +2 -2
- package/build/Dialogs/Confirm.js +83 -0
- package/build/Dialogs/Confirm.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Cron.d.ts +2 -2
- package/build/Dialogs/Cron.js +72 -0
- package/build/Dialogs/Cron.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Error.d.ts +2 -2
- package/build/Dialogs/Error.js +27 -0
- package/build/Dialogs/Error.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Message.d.ts +2 -2
- package/build/Dialogs/Message.js +29 -0
- package/build/Dialogs/Message.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SelectFile.d.ts +2 -2
- package/build/Dialogs/SelectFile.js +116 -0
- package/build/Dialogs/SelectFile.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SelectID.d.ts +3 -3
- package/{Dialogs → build/Dialogs}/SelectID.js +28 -53
- package/build/Dialogs/SelectID.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SimpleCron.d.ts +2 -2
- package/build/Dialogs/SimpleCron.js +46 -0
- package/build/Dialogs/SimpleCron.js.map +1 -0
- package/build/Dialogs/TextInput.d.ts +2 -0
- package/build/Dialogs/TextInput.js +31 -0
- package/build/Dialogs/TextInput.js.map +1 -0
- package/{GenericApp.d.ts → build/GenericApp.d.ts} +2 -3
- package/{GenericApp.js → build/GenericApp.js} +162 -176
- package/build/GenericApp.js.map +1 -0
- package/{LegacyConnection.d.ts → build/LegacyConnection.d.ts} +69 -4
- package/{LegacyConnection.js → build/LegacyConnection.js} +106 -99
- package/build/LegacyConnection.js.map +1 -0
- package/{Prompt.d.ts → build/Prompt.d.ts} +1 -1
- package/{Prompt.js → build/Prompt.js} +3 -4
- package/build/Prompt.js.map +1 -0
- package/build/Theme.d.ts +5 -0
- package/{Theme.js → build/Theme.js} +37 -32
- package/build/Theme.js.map +1 -0
- package/build/assets/devices/parseNames.d.ts +0 -0
- package/build/assets/devices/parseNames.js +35 -0
- package/build/assets/devices/parseNames.js.map +1 -0
- package/build/assets/rooms/parseNames.d.ts +0 -0
- package/build/assets/rooms/parseNames.js +35 -0
- package/build/assets/rooms/parseNames.js.map +1 -0
- package/build/dictionary.d.ts +1 -0
- package/build/dictionary.js +25 -0
- package/build/dictionary.js.map +1 -0
- package/build/i18n/de.json +449 -0
- package/build/i18n/en.json +449 -0
- package/build/i18n/es.json +449 -0
- package/build/i18n/fr.json +449 -0
- package/build/i18n/it.json +449 -0
- package/build/i18n/nl.json +449 -0
- package/build/i18n/pl.json +449 -0
- package/build/i18n/pt.json +449 -0
- package/build/i18n/ru.json +449 -0
- package/build/i18n/uk.json +449 -0
- package/build/i18n/zh-cn.json +449 -0
- package/{i18n.d.ts → build/i18n.d.ts} +2 -2
- package/{i18n.js → build/i18n.js} +9 -11
- package/build/i18n.js.map +1 -0
- package/build/icons/IconAdapter.d.ts +3 -0
- package/build/icons/IconAdapter.js +6 -0
- package/build/icons/IconAdapter.js.map +1 -0
- package/build/icons/IconAlias.d.ts +3 -0
- package/build/icons/IconAlias.js +6 -0
- package/build/icons/IconAlias.js.map +1 -0
- package/build/icons/IconChannel.d.ts +3 -0
- package/build/icons/IconChannel.js +9 -0
- package/build/icons/IconChannel.js.map +1 -0
- package/build/icons/IconClearFilter.d.ts +3 -0
- package/build/icons/IconClearFilter.js +7 -0
- package/build/icons/IconClearFilter.js.map +1 -0
- package/build/icons/IconClosed.d.ts +3 -0
- package/build/icons/IconClosed.js +6 -0
- package/build/icons/IconClosed.js.map +1 -0
- package/build/icons/IconCopy.d.ts +3 -0
- package/build/icons/IconCopy.js +5 -0
- package/build/icons/IconCopy.js.map +1 -0
- package/build/icons/IconDevice.d.ts +3 -0
- package/build/icons/IconDevice.js +15 -0
- package/build/icons/IconDevice.js.map +1 -0
- package/build/icons/IconDocument.d.ts +3 -0
- package/build/icons/IconDocument.js +6 -0
- package/build/icons/IconDocument.js.map +1 -0
- package/build/icons/IconDocumentReadOnly.d.ts +3 -0
- package/build/icons/IconDocumentReadOnly.js +7 -0
- package/build/icons/IconDocumentReadOnly.js.map +1 -0
- package/build/icons/IconExpert.d.ts +3 -0
- package/build/icons/IconExpert.js +6 -0
- package/build/icons/IconExpert.js.map +1 -0
- package/build/icons/IconFx.d.ts +3 -0
- package/build/icons/IconFx.js +5 -0
- package/build/icons/IconFx.js.map +1 -0
- package/build/icons/IconInstance.d.ts +3 -0
- package/build/icons/IconInstance.js +6 -0
- package/build/icons/IconInstance.js.map +1 -0
- package/build/icons/IconLogout.d.ts +3 -0
- package/build/icons/IconLogout.js +6 -0
- package/build/icons/IconLogout.js.map +1 -0
- package/build/icons/IconNoIcon.d.ts +3 -0
- package/build/icons/IconNoIcon.js +5 -0
- package/build/icons/IconNoIcon.js.map +1 -0
- package/build/icons/IconOpen.d.ts +3 -0
- package/build/icons/IconOpen.js +6 -0
- package/build/icons/IconOpen.js.map +1 -0
- package/{icons → build/icons}/IconProps.d.ts +1 -1
- package/build/icons/IconProps.js +2 -0
- package/build/icons/IconProps.js.map +1 -0
- package/build/icons/IconState.d.ts +3 -0
- package/build/icons/IconState.js +6 -0
- package/build/icons/IconState.js.map +1 -0
- package/build/index.d.ts +67 -0
- package/build/index.js +67 -0
- package/build/index.js.map +1 -0
- package/{types.d.ts → build/types.d.ts} +1 -1
- package/package.json +84 -47
- package/AdminConnection.d.ts +0 -2
- package/AdminConnection.js +0 -4
- package/Components/404.js +0 -101
- package/Components/CopyToClipboard.js +0 -163
- package/Components/CustomModal.js +0 -88
- package/Components/FileViewer.d.ts +0 -10
- package/Components/FileViewer.js +0 -305
- package/Components/Icon.js +0 -148
- package/Components/IconPicker.js +0 -98
- package/Components/Loaders/MV.js +0 -66
- package/Components/Loaders/Vendor.js +0 -77
- package/Components/Logo.js +0 -117
- package/Components/SaveCloseButtons.js +0 -69
- package/Components/SelectWithIcon.js +0 -168
- package/Components/SimpleCron/cronText.js +0 -19
- package/Components/TabContainer.js +0 -25
- package/Components/TabContent.js +0 -21
- package/Components/TabHeader.d.ts +0 -6
- package/Components/TabHeader.js +0 -11
- package/Components/TableResize.js +0 -226
- package/Components/TextWithIcon.js +0 -119
- package/Components/ToggleThemeMenu.js +0 -18
- package/Components/withWidth.d.ts +0 -3
- package/Components/withWidth.js +0 -27
- package/Connection.d.ts +0 -3
- package/Connection.js +0 -8
- package/Dialogs/ComplexCron.js +0 -90
- package/Dialogs/Confirm.js +0 -111
- package/Dialogs/Cron.js +0 -100
- package/Dialogs/Error.js +0 -55
- package/Dialogs/Message.js +0 -57
- package/Dialogs/SelectFile.js +0 -119
- package/Dialogs/SimpleCron.js +0 -51
- package/Dialogs/TextInput.d.ts +0 -3
- package/Dialogs/TextInput.js +0 -35
- package/Theme.d.ts +0 -6
- package/i18n/de.json +0 -449
- package/i18n/en.json +0 -449
- package/i18n/es.json +0 -449
- package/i18n/fr.json +0 -449
- package/i18n/it.json +0 -449
- package/i18n/nl.json +0 -449
- package/i18n/pl.json +0 -449
- package/i18n/pt.json +0 -449
- package/i18n/ru.json +0 -449
- package/i18n/uk.json +0 -449
- package/i18n/zh-cn.json +0 -449
- package/icons/IconAdapter.d.ts +0 -4
- package/icons/IconAdapter.js +0 -10
- package/icons/IconAlias.d.ts +0 -4
- package/icons/IconAlias.js +0 -10
- package/icons/IconChannel.d.ts +0 -4
- package/icons/IconChannel.js +0 -13
- package/icons/IconClearFilter.d.ts +0 -4
- package/icons/IconClearFilter.js +0 -11
- package/icons/IconClosed.d.ts +0 -4
- package/icons/IconClosed.js +0 -10
- package/icons/IconCopy.d.ts +0 -4
- package/icons/IconCopy.js +0 -9
- package/icons/IconDevice.d.ts +0 -4
- package/icons/IconDevice.js +0 -19
- package/icons/IconDocument.d.ts +0 -4
- package/icons/IconDocument.js +0 -10
- package/icons/IconDocumentReadOnly.d.ts +0 -4
- package/icons/IconDocumentReadOnly.js +0 -11
- package/icons/IconExpert.d.ts +0 -4
- package/icons/IconExpert.js +0 -10
- package/icons/IconFx.d.ts +0 -4
- package/icons/IconFx.js +0 -9
- package/icons/IconInstance.d.ts +0 -4
- package/icons/IconInstance.js +0 -10
- package/icons/IconLogout.d.ts +0 -4
- package/icons/IconLogout.js +0 -10
- package/icons/IconNoIcon.d.ts +0 -4
- package/icons/IconNoIcon.js +0 -9
- package/icons/IconOpen.d.ts +0 -4
- package/icons/IconOpen.js +0 -10
- package/icons/IconProps.js +0 -2
- package/icons/IconState.d.ts +0 -4
- package/icons/IconState.js +0 -10
- package/index.d.ts +0 -128
- package/index.js +0 -215
- package/src/AdminConnection.tsx +0 -3
- package/src/Components/ColorPicker.tsx +0 -343
- package/src/Components/ComplexCron.tsx +0 -561
- package/src/Components/CustomModal.tsx +0 -170
- package/src/Components/FileBrowser.tsx +0 -2550
- package/src/Components/FileViewer.tsx +0 -412
- package/src/Components/Icon.tsx +0 -238
- package/src/Components/IconPicker.tsx +0 -165
- package/src/Components/IconSelector.tsx +0 -2220
- package/src/Components/Image.tsx +0 -193
- package/src/Components/Loader.tsx +0 -328
- package/src/Components/Logo.tsx +0 -176
- package/src/Components/MDUtils.tsx +0 -104
- package/src/Components/ObjectBrowser.tsx +0 -8935
- package/src/Components/Router.tsx +0 -90
- package/src/Components/SaveCloseButtons.tsx +0 -117
- package/src/Components/Schedule.tsx +0 -1995
- package/src/Components/SelectWithIcon.tsx +0 -239
- package/src/Components/TabContainer.tsx +0 -57
- package/src/Components/TabContent.tsx +0 -38
- package/src/Components/TabHeader.tsx +0 -20
- package/src/Components/ToggleThemeMenu.tsx +0 -52
- package/src/Components/TreeTable.tsx +0 -1002
- package/src/Components/UploadImage.tsx +0 -643
- package/src/Components/Utils.tsx +0 -1802
- package/src/Components/loader.css +0 -231
- package/src/Components/withWidth.tsx +0 -32
- package/src/Connection.tsx +0 -5
- package/src/Dialogs/ComplexCron.tsx +0 -163
- package/src/Dialogs/Confirm.tsx +0 -185
- package/src/Dialogs/Cron.tsx +0 -192
- package/src/Dialogs/Error.tsx +0 -67
- package/src/Dialogs/Message.tsx +0 -73
- package/src/Dialogs/SelectFile.tsx +0 -280
- package/src/Dialogs/SelectID.tsx +0 -310
- package/src/Dialogs/SimpleCron.tsx +0 -101
- package/src/Dialogs/TextInput.tsx +0 -99
- package/src/GenericApp.tsx +0 -1076
- package/src/LegacyConnection.tsx +0 -3720
- package/src/Prompt.tsx +0 -22
- package/src/Theme.tsx +0 -472
- package/src/icons/IconAdapter.tsx +0 -22
- package/src/icons/IconAlias.tsx +0 -22
- package/src/icons/IconChannel.tsx +0 -60
- package/src/icons/IconClearFilter.tsx +0 -24
- package/src/icons/IconClosed.tsx +0 -22
- package/src/icons/IconCopy.tsx +0 -21
- package/src/icons/IconDevice.tsx +0 -126
- package/src/icons/IconDocument.tsx +0 -22
- package/src/icons/IconDocumentReadOnly.tsx +0 -27
- package/src/icons/IconExpert.tsx +0 -26
- package/src/icons/IconFx.tsx +0 -38
- package/src/icons/IconInstance.tsx +0 -22
- package/src/icons/IconLogout.tsx +0 -32
- package/src/icons/IconNoIcon.tsx +0 -21
- package/src/icons/IconOpen.tsx +0 -22
- package/src/icons/IconProps.tsx +0 -16
- package/src/icons/IconState.tsx +0 -38
- package/src/index.css +0 -56
- /package/{Components → build/Components}/404.d.ts +0 -0
- /package/{Components → build/Components}/SimpleCron/cronText.d.ts +0 -0
- /package/{assets → build/assets}/devices.json +0 -0
- /package/{assets → build/assets}/lamp_ceiling.svg +0 -0
- /package/{assets → build/assets}/lamp_table.svg +0 -0
- /package/{assets → build/assets}/no_icon.svg +0 -0
- /package/{assets → build/assets}/rooms.json +0 -0
- /package/{index.css → build/index.css} +0 -0
- /package/{tasks.js → tasksExample.js} +0 -0
package/src/Components/Image.tsx
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import React, { type JSX } from 'react';
|
|
2
|
-
import { Component } from 'react';
|
|
3
|
-
|
|
4
|
-
import IconNoIcon from '../icons/IconNoIcon';
|
|
5
|
-
|
|
6
|
-
function getElementFromSource(src: string): HTMLElement | null {
|
|
7
|
-
const svgContainer = document.createElement('div');
|
|
8
|
-
svgContainer.innerHTML = src;
|
|
9
|
-
const svg: HTMLElement = svgContainer.firstElementChild as HTMLElement;
|
|
10
|
-
if (svg?.remove) {
|
|
11
|
-
svg.remove();
|
|
12
|
-
} else if (svg) {
|
|
13
|
-
svgContainer.removeChild(svg);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
svgContainer.remove();
|
|
17
|
-
return svg;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function serializeAttrs(map?: NamedNodeMap): Record<string, string> {
|
|
21
|
-
const ret: Record<string, string> = {};
|
|
22
|
-
if (!map) {
|
|
23
|
-
return ret;
|
|
24
|
-
}
|
|
25
|
-
for (let prop, i = 0; i < map.length; i++) {
|
|
26
|
-
const key = map[i].name;
|
|
27
|
-
if (key === 'class') {
|
|
28
|
-
prop = 'className';
|
|
29
|
-
} else if (!key.startsWith('data-')) {
|
|
30
|
-
prop = key.replace(/[-|:]([a-z])/g, g => g[1].toUpperCase());
|
|
31
|
-
} else {
|
|
32
|
-
prop = key;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
ret[prop] = map[i].value;
|
|
36
|
-
}
|
|
37
|
-
return ret;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
interface ImageProps {
|
|
41
|
-
/* The color */
|
|
42
|
-
color?: string;
|
|
43
|
-
/* The source of the image */
|
|
44
|
-
src?: string;
|
|
45
|
-
/* The image prefix (default: './files/') */
|
|
46
|
-
imagePrefix?: string;
|
|
47
|
-
/* The CSS class name */
|
|
48
|
-
className?: string;
|
|
49
|
-
/* Show image errors (or just show no image)? */
|
|
50
|
-
showError?: boolean;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface ImageState {
|
|
54
|
-
svg?: boolean;
|
|
55
|
-
created?: boolean;
|
|
56
|
-
color?: string;
|
|
57
|
-
src?: string;
|
|
58
|
-
imgError?: boolean;
|
|
59
|
-
showError?: boolean;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* A component for displaying an image.
|
|
64
|
-
*/
|
|
65
|
-
class Image extends Component<ImageProps, ImageState> {
|
|
66
|
-
private svg: JSX.Element | null;
|
|
67
|
-
|
|
68
|
-
static REMOTE_SERVER: boolean = window.location.hostname.includes('iobroker.in');
|
|
69
|
-
|
|
70
|
-
static REMOTE_PREFIX: string = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/') + 1);
|
|
71
|
-
|
|
72
|
-
constructor(props: ImageProps) {
|
|
73
|
-
super(props);
|
|
74
|
-
this.state = {
|
|
75
|
-
svg: !!this.props.src?.startsWith('data:'),
|
|
76
|
-
created: true,
|
|
77
|
-
color: this.props.color || '',
|
|
78
|
-
src: this.props.src || '',
|
|
79
|
-
imgError: false,
|
|
80
|
-
showError: !!this.props.showError,
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
this.svg = this.state.svg && this.state.src ? this.getSvgFromData(this.state.src) : null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
static getDerivedStateFromProps(props: ImageProps, state: ImageState): Partial<ImageState> | null {
|
|
87
|
-
const newState: ImageState = {};
|
|
88
|
-
let changed = false;
|
|
89
|
-
|
|
90
|
-
if (props && state && props.src !== state.src) {
|
|
91
|
-
newState.src = props.src;
|
|
92
|
-
newState.svg = props.src?.startsWith('data:');
|
|
93
|
-
newState.created = false;
|
|
94
|
-
changed = true;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (props && state && props.color !== state.color) {
|
|
98
|
-
newState.color = props.color;
|
|
99
|
-
newState.created = false;
|
|
100
|
-
changed = true;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (props && state && props.showError !== state.showError) {
|
|
104
|
-
newState.showError = props.showError;
|
|
105
|
-
changed = true;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return changed ? newState : null;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
getSvgFromData(src: string): JSX.Element | null {
|
|
112
|
-
const len = 'data:image/svg+xml;base64,';
|
|
113
|
-
if (!src.startsWith(len)) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
src = src.substring(len.length);
|
|
117
|
-
try {
|
|
118
|
-
src = atob(src);
|
|
119
|
-
const svg = getElementFromSource(src) as HTMLElement;
|
|
120
|
-
const inner = svg.innerHTML;
|
|
121
|
-
const svgProps = serializeAttrs(svg.attributes);
|
|
122
|
-
|
|
123
|
-
svg.remove();
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<svg
|
|
127
|
-
className={this.props.className}
|
|
128
|
-
style={this.state.color ? { color: this.state.color } : {}}
|
|
129
|
-
{...svgProps}
|
|
130
|
-
dangerouslySetInnerHTML={{ __html: inner }}
|
|
131
|
-
/>
|
|
132
|
-
);
|
|
133
|
-
} catch {
|
|
134
|
-
// ignore
|
|
135
|
-
}
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
render(): JSX.Element | null {
|
|
140
|
-
if (this.state.svg) {
|
|
141
|
-
if (!this.state.created) {
|
|
142
|
-
setTimeout(() => {
|
|
143
|
-
this.svg = this.state.src ? this.getSvgFromData(this.state.src) : null;
|
|
144
|
-
this.setState({ created: true });
|
|
145
|
-
}, 50);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return this.svg;
|
|
149
|
-
}
|
|
150
|
-
if (this.state.src) {
|
|
151
|
-
if (this.state.imgError || !this.state.src) {
|
|
152
|
-
return <IconNoIcon className={this.props.className} />;
|
|
153
|
-
}
|
|
154
|
-
if (
|
|
155
|
-
Image.REMOTE_SERVER &&
|
|
156
|
-
!this.state.src.startsWith('http://') &&
|
|
157
|
-
!this.state.src.startsWith('https://')
|
|
158
|
-
) {
|
|
159
|
-
let src = (this.props.imagePrefix || '') + this.state.src;
|
|
160
|
-
if (src.startsWith('./')) {
|
|
161
|
-
src = Image.REMOTE_PREFIX + src.substring(2);
|
|
162
|
-
} else if (!src.startsWith('/')) {
|
|
163
|
-
src = Image.REMOTE_PREFIX + src;
|
|
164
|
-
}
|
|
165
|
-
return (
|
|
166
|
-
<img
|
|
167
|
-
className={this.props.className}
|
|
168
|
-
src={`https://remote-files.iobroker.in${src}`}
|
|
169
|
-
alt=""
|
|
170
|
-
onError={() =>
|
|
171
|
-
this.props.showError ? this.setState({ imgError: true }) : this.setState({ src: '' })
|
|
172
|
-
}
|
|
173
|
-
/>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return (
|
|
178
|
-
<img
|
|
179
|
-
className={this.props.className}
|
|
180
|
-
src={(this.props.imagePrefix || '') + this.state.src}
|
|
181
|
-
alt=""
|
|
182
|
-
onError={() =>
|
|
183
|
-
this.props.showError ? this.setState({ imgError: true }) : this.setState({ src: '' })
|
|
184
|
-
}
|
|
185
|
-
/>
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export default Image;
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2018-2024 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
-
*
|
|
4
|
-
* MIT License
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
import React, { useEffect } from 'react';
|
|
8
|
-
import type { ThemeName, ThemeType } from '../types';
|
|
9
|
-
// import './loader.css'
|
|
10
|
-
|
|
11
|
-
declare global {
|
|
12
|
-
interface Window {
|
|
13
|
-
loadingBackgroundImage: undefined | string;
|
|
14
|
-
loadingBackgroundColor: undefined | string;
|
|
15
|
-
loadingHideLogo: undefined | 'true';
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const loaderStyles = `
|
|
20
|
-
/**
|
|
21
|
-
* Copyright 2018-2024 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
22
|
-
*
|
|
23
|
-
* MIT License
|
|
24
|
-
*
|
|
25
|
-
**/
|
|
26
|
-
|
|
27
|
-
.logo-background-light, .logo-background-colored {
|
|
28
|
-
background: white;
|
|
29
|
-
}
|
|
30
|
-
.logo-background-dark, .logo-background-blue {
|
|
31
|
-
background: black;
|
|
32
|
-
}
|
|
33
|
-
.logo-div {
|
|
34
|
-
position: absolute;
|
|
35
|
-
top: 50%;
|
|
36
|
-
left: 50%;
|
|
37
|
-
-ms-transform: translateX(-50%) translateY(-50%);
|
|
38
|
-
-webkit-transform: translate(-50%,-50%);
|
|
39
|
-
transform: translate(-50%,-50%);
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
border-radius: 50%;
|
|
42
|
-
z-index: 2;
|
|
43
|
-
}
|
|
44
|
-
.logo-border {
|
|
45
|
-
/*border-color: #164477;*/
|
|
46
|
-
border-top-color: #3399CC;
|
|
47
|
-
border-left-color: #164477;
|
|
48
|
-
border-bottom-color: #164477;
|
|
49
|
-
border-right-color: #164477;
|
|
50
|
-
border-radius: 50%;
|
|
51
|
-
border-style: solid;
|
|
52
|
-
box-sizing: border-box;
|
|
53
|
-
width: 100%;
|
|
54
|
-
height: 100%;
|
|
55
|
-
position: absolute;
|
|
56
|
-
}
|
|
57
|
-
.logo-top {
|
|
58
|
-
position: absolute;
|
|
59
|
-
width: 4.5%;
|
|
60
|
-
height: 16%;
|
|
61
|
-
top: 0;
|
|
62
|
-
z-index: 2;
|
|
63
|
-
}
|
|
64
|
-
.logo-i {
|
|
65
|
-
position: absolute;
|
|
66
|
-
width: 14.5%;
|
|
67
|
-
height: 60%;
|
|
68
|
-
top: 20%;
|
|
69
|
-
left: 42%;
|
|
70
|
-
background: #3399CC;
|
|
71
|
-
}
|
|
72
|
-
.logo-i-top {
|
|
73
|
-
position: absolute;
|
|
74
|
-
width: 14.5%;
|
|
75
|
-
height: 4%;
|
|
76
|
-
left: 42%;
|
|
77
|
-
background: #3399CC;
|
|
78
|
-
border-radius: 100%;
|
|
79
|
-
}
|
|
80
|
-
.logo-back {
|
|
81
|
-
width: 100%;
|
|
82
|
-
height: 100%;
|
|
83
|
-
z-index: 0;
|
|
84
|
-
overflow: hidden;
|
|
85
|
-
}
|
|
86
|
-
@keyframes logo-grow {
|
|
87
|
-
0% {
|
|
88
|
-
width: 230px;
|
|
89
|
-
height: 230px;
|
|
90
|
-
transform: translate(-50%,-50%) scale(1);
|
|
91
|
-
opacity: 1
|
|
92
|
-
}
|
|
93
|
-
99% {
|
|
94
|
-
width: 230px;
|
|
95
|
-
height: 230px;
|
|
96
|
-
transform: translate(-50%,-50%) scale(10);
|
|
97
|
-
opacity: 0;
|
|
98
|
-
}
|
|
99
|
-
100% {
|
|
100
|
-
width: 0;
|
|
101
|
-
height: 0;
|
|
102
|
-
opacity: 0;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
@keyframes logo-spin { 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }
|
|
106
|
-
@keyframes logo-color-inside-light {
|
|
107
|
-
0% {
|
|
108
|
-
background: #FEFEFE;
|
|
109
|
-
}
|
|
110
|
-
100% {
|
|
111
|
-
background: #3399CC;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
@keyframes logo-color-inside-dark {
|
|
115
|
-
0% {
|
|
116
|
-
background: #030303;
|
|
117
|
-
}
|
|
118
|
-
100% {
|
|
119
|
-
background: #3399CC;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
@keyframes logo-color-inside-colored {
|
|
123
|
-
0% {
|
|
124
|
-
background: #FEFEFE;
|
|
125
|
-
}
|
|
126
|
-
100% {
|
|
127
|
-
background: #3399CC;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
@keyframes logo-color-inside-blue {
|
|
131
|
-
0% {
|
|
132
|
-
background: #030303;
|
|
133
|
-
}
|
|
134
|
-
100% {
|
|
135
|
-
background: #3399CC;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
@keyframes logo-color-outside-light {
|
|
140
|
-
0% {
|
|
141
|
-
border-color: #FEFEFE;
|
|
142
|
-
}
|
|
143
|
-
100% {
|
|
144
|
-
border-top-color: #3399CC;
|
|
145
|
-
border-left-color: #164477;
|
|
146
|
-
border-bottom-color: #164477;
|
|
147
|
-
border-right-color: #164477;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
@keyframes logo-color-outside-dark {
|
|
151
|
-
0% {
|
|
152
|
-
border-color: #040404;
|
|
153
|
-
}
|
|
154
|
-
100% {
|
|
155
|
-
border-top-color: #3399CC;
|
|
156
|
-
border-left-color: #164477;
|
|
157
|
-
border-bottom-color: #164477;
|
|
158
|
-
border-right-color: #164477;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
@keyframes logo-color-outside-colored {
|
|
162
|
-
0% {
|
|
163
|
-
border-color: #FEFEFE;
|
|
164
|
-
}
|
|
165
|
-
100% {
|
|
166
|
-
border-top-color: #3399CC;
|
|
167
|
-
border-left-color: #164477;
|
|
168
|
-
border-bottom-color: #164477;
|
|
169
|
-
border-right-color: #164477;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
@keyframes logo-color-outside-blue {
|
|
173
|
-
0% {
|
|
174
|
-
border-color: #040404;
|
|
175
|
-
}
|
|
176
|
-
100% {
|
|
177
|
-
border-top-color: #3399CC;
|
|
178
|
-
border-left-color: #164477;
|
|
179
|
-
border-bottom-color: #164477;
|
|
180
|
-
border-right-color: #164477;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.logo-animate-wait {
|
|
185
|
-
animation: logo-color-outside 1.5s, logo-spin 1.5s linear infinite;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.logo-animate-grow-light {
|
|
189
|
-
background: #DDD;
|
|
190
|
-
}
|
|
191
|
-
.logo-animate-grow-dark {
|
|
192
|
-
background: #1d1d1d;
|
|
193
|
-
}
|
|
194
|
-
.logo-animate-grow-colored {
|
|
195
|
-
background: #DDD;
|
|
196
|
-
}
|
|
197
|
-
.logo-animate-grow-blue {
|
|
198
|
-
background: #1d1d1d;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.logo-animate-grow {
|
|
202
|
-
display: inline-block;
|
|
203
|
-
text-align: center;
|
|
204
|
-
z-index: 1;
|
|
205
|
-
top: 50%;
|
|
206
|
-
left: 50%;
|
|
207
|
-
-ms-transform: translateX(-50%) translateY(-50%);
|
|
208
|
-
-webkit-transform: translate(-50%,-50%);
|
|
209
|
-
transform: translate(-50%,-50%);
|
|
210
|
-
width: 245px;
|
|
211
|
-
height: 245px;
|
|
212
|
-
border-radius: 50%;
|
|
213
|
-
position: absolute;
|
|
214
|
-
animation: logo-grow 1s 1 ease forwards;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.logo-animate-color-inside-light {
|
|
218
|
-
animation: logo-color-inside-light 2.5s;
|
|
219
|
-
}
|
|
220
|
-
.logo-animate-color-inside-dark {
|
|
221
|
-
animation: logo-color-inside-dark 2.5s;
|
|
222
|
-
}
|
|
223
|
-
.logo-animate-color-inside-colored {
|
|
224
|
-
animation: logo-color-inside-colored 2.5s;
|
|
225
|
-
}
|
|
226
|
-
.logo-animate-color-inside-blue {
|
|
227
|
-
animation: logo-color-inside-blue 2.5s;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.logo-animate-color-outside-light {
|
|
231
|
-
animation: logo-color-outside-light 1.5s;
|
|
232
|
-
}
|
|
233
|
-
.logo-animate-color-outside-dark {
|
|
234
|
-
animation: logo-color-outside-dark 1.5s;
|
|
235
|
-
}
|
|
236
|
-
.logo-animate-color-outside-colored {
|
|
237
|
-
animation: logo-color-outside-colored 1.5s;
|
|
238
|
-
}
|
|
239
|
-
.logo-animate-color-outside-blue {
|
|
240
|
-
animation: logo-color-outside-blue 1.5s;
|
|
241
|
-
}
|
|
242
|
-
`;
|
|
243
|
-
|
|
244
|
-
interface LoaderProps {
|
|
245
|
-
/** The size in pixels of this loader. */
|
|
246
|
-
size?: number;
|
|
247
|
-
/** The chosen theme type. */
|
|
248
|
-
themeType?: ThemeType;
|
|
249
|
-
/** Theme name */
|
|
250
|
-
themeName?: ThemeName;
|
|
251
|
-
/** @deprecated Theme name. use themeName instead */
|
|
252
|
-
theme?: ThemeName;
|
|
253
|
-
/** Background color */
|
|
254
|
-
backgroundColor?: string;
|
|
255
|
-
/** Background image URL */
|
|
256
|
-
backgroundImage?: string;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function Loader(props: LoaderProps): React.JSX.Element {
|
|
260
|
-
useEffect(() => {
|
|
261
|
-
if (!window.document.getElementById('loader-iobroker-component')) {
|
|
262
|
-
const style = window.document.createElement('style');
|
|
263
|
-
style.setAttribute('id', 'loader-iobroker-component');
|
|
264
|
-
style.innerHTML = loaderStyles;
|
|
265
|
-
window.document.head.appendChild(style);
|
|
266
|
-
}
|
|
267
|
-
}, []);
|
|
268
|
-
|
|
269
|
-
const size = props.size || 234;
|
|
270
|
-
const theme = props.themeName || props.theme || props.themeType || 'light';
|
|
271
|
-
return (
|
|
272
|
-
<div
|
|
273
|
-
className={`logo-back logo-background-${theme}`}
|
|
274
|
-
style={{
|
|
275
|
-
backgroundImage:
|
|
276
|
-
props.backgroundImage && props.backgroundImage !== '@@loginBackgroundImage@@'
|
|
277
|
-
? props.backgroundImage
|
|
278
|
-
: window.loadingBackgroundImage && window.loadingBackgroundImage !== '@@loginBackgroundImage@@'
|
|
279
|
-
? `url(${window.loadingBackgroundImage})`
|
|
280
|
-
: undefined,
|
|
281
|
-
backgroundColor:
|
|
282
|
-
props.backgroundColor && props.backgroundColor !== '@@loginBackgroundColor@@'
|
|
283
|
-
? props.backgroundColor
|
|
284
|
-
: window.loadingBackgroundColor && window.loadingBackgroundColor !== '@@loginBackgroundColor@@'
|
|
285
|
-
? window.loadingBackgroundColor
|
|
286
|
-
: undefined,
|
|
287
|
-
backgroundSize: 'cover',
|
|
288
|
-
}}
|
|
289
|
-
>
|
|
290
|
-
{window.loadingHideLogo === 'true' ? null : (
|
|
291
|
-
<>
|
|
292
|
-
<div
|
|
293
|
-
className="logo-div"
|
|
294
|
-
style={{ width: size, height: size }}
|
|
295
|
-
>
|
|
296
|
-
<div
|
|
297
|
-
className={`logo-top logo-background-${theme}`}
|
|
298
|
-
style={{ left: '37%' }}
|
|
299
|
-
/>
|
|
300
|
-
<div
|
|
301
|
-
className={`logo-top logo-background-${theme}`}
|
|
302
|
-
style={{ left: '57%' }}
|
|
303
|
-
/>
|
|
304
|
-
<div
|
|
305
|
-
className={`logo-border logo-background-${theme} logo-animate-wait`}
|
|
306
|
-
style={{ borderWidth: size * 0.132 }}
|
|
307
|
-
/>
|
|
308
|
-
<div className={`logo-i logo-animate-color-inside-${theme}`} />
|
|
309
|
-
<div
|
|
310
|
-
className={`logo-i-top logo-animate-color-inside-${theme}`}
|
|
311
|
-
style={{ top: '18%' }}
|
|
312
|
-
/>
|
|
313
|
-
<div
|
|
314
|
-
className={`logo-i-top logo-animate-color-inside-${theme}`}
|
|
315
|
-
style={{ bottom: '18%' }}
|
|
316
|
-
/>
|
|
317
|
-
</div>
|
|
318
|
-
<div
|
|
319
|
-
className={`logo-animate-grow logo-animate-grow-${theme}`}
|
|
320
|
-
style={{ width: size + 11, height: size + 11 }}
|
|
321
|
-
/>
|
|
322
|
-
</>
|
|
323
|
-
)}
|
|
324
|
-
</div>
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
export default Loader;
|
package/src/Components/Logo.tsx
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Fab } from '@mui/material';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
Help as IconHelp,
|
|
6
|
-
VerticalAlignTop as IconUpload,
|
|
7
|
-
VerticalAlignBottom as IconDownload,
|
|
8
|
-
} from '@mui/icons-material';
|
|
9
|
-
|
|
10
|
-
import I18n from '../i18n';
|
|
11
|
-
import Icon from './Icon';
|
|
12
|
-
|
|
13
|
-
interface LogoProps {
|
|
14
|
-
/* Adapter common configuration from io-package.json */
|
|
15
|
-
common: any;
|
|
16
|
-
/* Adapter native data from io-package.json */
|
|
17
|
-
native: any;
|
|
18
|
-
/* Adapter instance number. */
|
|
19
|
-
instance: number;
|
|
20
|
-
/* on Load handler */
|
|
21
|
-
onLoad?: (contents: any) => void;
|
|
22
|
-
/* on Error handler */
|
|
23
|
-
onError?: (error: string) => void;
|
|
24
|
-
className?: string;
|
|
25
|
-
style?: Record<string, any>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
class Logo extends React.Component<LogoProps> {
|
|
29
|
-
static generateFile(fileName: string, obj: any): void {
|
|
30
|
-
const el = window.document.createElement('a');
|
|
31
|
-
el.setAttribute(
|
|
32
|
-
'href',
|
|
33
|
-
`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(obj, null, 2))}`,
|
|
34
|
-
);
|
|
35
|
-
el.setAttribute('download', fileName);
|
|
36
|
-
|
|
37
|
-
el.style.display = 'none';
|
|
38
|
-
window.document.body.appendChild(el);
|
|
39
|
-
|
|
40
|
-
el.click();
|
|
41
|
-
|
|
42
|
-
window.document.body.removeChild(el);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
handleFileSelect = (evt: Event): void => {
|
|
46
|
-
const target = evt.target as HTMLInputElement;
|
|
47
|
-
const files = target?.files;
|
|
48
|
-
if (!files || !files.length) {
|
|
49
|
-
console.error('No files found. Please report to developers');
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const f = files[0];
|
|
53
|
-
|
|
54
|
-
if (f) {
|
|
55
|
-
const r = new window.FileReader();
|
|
56
|
-
r.onload = () => {
|
|
57
|
-
const contents: string = r.result?.toString() || '';
|
|
58
|
-
try {
|
|
59
|
-
const json = JSON.parse(contents);
|
|
60
|
-
if (json.native && json.common) {
|
|
61
|
-
if (json.common.name !== this.props.common.name) {
|
|
62
|
-
this.props.onError && this.props.onError(I18n.t('ra_otherConfig', json.common.name));
|
|
63
|
-
} else {
|
|
64
|
-
this.props.onLoad && this.props.onLoad(json.native);
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
this.props.onError && this.props.onError(I18n.t('ra_invalidConfig'));
|
|
68
|
-
}
|
|
69
|
-
} catch (err: any) {
|
|
70
|
-
this.props.onError && this.props.onError(err?.toString());
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
r.readAsText(f);
|
|
74
|
-
} else {
|
|
75
|
-
alert('Failed to open JSON File');
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
download(): void {
|
|
80
|
-
const result = {
|
|
81
|
-
_id: `system.adapter.${this.props.common.name}.${this.props.instance}`,
|
|
82
|
-
common: JSON.parse(JSON.stringify(this.props.common)),
|
|
83
|
-
native: this.props.native,
|
|
84
|
-
};
|
|
85
|
-
// remove unimportant information
|
|
86
|
-
if (result.common.news) {
|
|
87
|
-
delete result.common.news;
|
|
88
|
-
}
|
|
89
|
-
if (result.common.titleLang) {
|
|
90
|
-
delete result.common.titleLang;
|
|
91
|
-
}
|
|
92
|
-
if (result.common.desc) {
|
|
93
|
-
delete result.common.desc;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// window.open('data:application/iobroker; content-disposition=attachment; filename=' + result._id + '.json,' + JSON.stringify(result, null, 2));
|
|
97
|
-
Logo.generateFile(`${result._id}.json`, result);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
upload(): void {
|
|
101
|
-
const input = window.document.createElement('input');
|
|
102
|
-
input.setAttribute('type', 'file');
|
|
103
|
-
input.setAttribute('id', 'files');
|
|
104
|
-
input.setAttribute('opacity', '0');
|
|
105
|
-
input.addEventListener('change', this.handleFileSelect, false);
|
|
106
|
-
input.click();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
render(): React.JSX.Element {
|
|
110
|
-
return (
|
|
111
|
-
<div
|
|
112
|
-
className={this.props.className}
|
|
113
|
-
style={this.props.style}
|
|
114
|
-
>
|
|
115
|
-
{this.props.common.icon ? (
|
|
116
|
-
<Icon
|
|
117
|
-
src={this.props.common.icon}
|
|
118
|
-
style={{
|
|
119
|
-
padding: 8,
|
|
120
|
-
width: 64,
|
|
121
|
-
}}
|
|
122
|
-
alt="logo"
|
|
123
|
-
/>
|
|
124
|
-
) : null}
|
|
125
|
-
{this.props.common.readme ? (
|
|
126
|
-
<Fab
|
|
127
|
-
size="small"
|
|
128
|
-
color="primary"
|
|
129
|
-
aria-label="Help"
|
|
130
|
-
style={{
|
|
131
|
-
marginRight: 5,
|
|
132
|
-
marginTop: 5,
|
|
133
|
-
float: 'right',
|
|
134
|
-
}}
|
|
135
|
-
onClick={() => {
|
|
136
|
-
const win = window.open(this.props.common.readme, '_blank');
|
|
137
|
-
win?.focus();
|
|
138
|
-
}}
|
|
139
|
-
>
|
|
140
|
-
<IconHelp />
|
|
141
|
-
</Fab>
|
|
142
|
-
) : null}
|
|
143
|
-
<Fab
|
|
144
|
-
size="small"
|
|
145
|
-
color="primary"
|
|
146
|
-
aria-label="Load config"
|
|
147
|
-
style={{
|
|
148
|
-
marginRight: 5,
|
|
149
|
-
marginTop: 5,
|
|
150
|
-
float: 'right',
|
|
151
|
-
}}
|
|
152
|
-
title={I18n.t('ra_Load configuration from file')}
|
|
153
|
-
onClick={() => this.upload()}
|
|
154
|
-
>
|
|
155
|
-
<IconUpload />
|
|
156
|
-
</Fab>
|
|
157
|
-
<Fab
|
|
158
|
-
size="small"
|
|
159
|
-
color="primary"
|
|
160
|
-
aria-label="Save config"
|
|
161
|
-
style={{
|
|
162
|
-
marginRight: 5,
|
|
163
|
-
marginTop: 5,
|
|
164
|
-
float: 'right',
|
|
165
|
-
}}
|
|
166
|
-
title={I18n.t('ra_Save configuration to file')}
|
|
167
|
-
onClick={() => this.download()}
|
|
168
|
-
>
|
|
169
|
-
<IconDownload />
|
|
170
|
-
</Fab>
|
|
171
|
-
</div>
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export default Logo;
|