@iobroker/adapter-react-v5 6.1.3 → 6.1.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 +6 -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
- package/assets/devices/list.json +0 -994
- package/assets/devices/names.txt +0 -63
- package/assets/devices/parseNames.d.ts +0 -0
- package/assets/devices/parseNames.js +0 -34
- package/assets/rooms/list.json +0 -946
- package/assets/rooms/names.txt +0 -60
- package/assets/rooms/parseNames.d.ts +0 -0
- package/assets/rooms/parseNames.js +0 -34
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Dialog, DialogActions, DialogContent,
|
|
5
|
+
DialogTitle, IconButton, TextField, Button,
|
|
6
|
+
} from '@mui/material';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
Check as CheckIcon,
|
|
10
|
+
Close as CloseIcon,
|
|
11
|
+
Language as LanguageIcon,
|
|
12
|
+
} from '@mui/icons-material';
|
|
13
|
+
|
|
14
|
+
import I18n from '../i18n';
|
|
15
|
+
import { IobTheme } from '../types';
|
|
16
|
+
import Utils from './Utils';
|
|
17
|
+
|
|
18
|
+
const styles: Record<string, any> = {
|
|
19
|
+
modalDialog: {
|
|
20
|
+
minWidth: 400,
|
|
21
|
+
maxWidth: 800,
|
|
22
|
+
},
|
|
23
|
+
overflowHidden: {
|
|
24
|
+
display: 'flex',
|
|
25
|
+
overflow: 'hidden',
|
|
26
|
+
},
|
|
27
|
+
titleIcon: {
|
|
28
|
+
marginRight: 5,
|
|
29
|
+
},
|
|
30
|
+
content: {
|
|
31
|
+
fontSize: 16,
|
|
32
|
+
},
|
|
33
|
+
languageButton: {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
right: 8,
|
|
36
|
+
top: 8,
|
|
37
|
+
},
|
|
38
|
+
languageButtonActive: (theme: IobTheme) => ({
|
|
39
|
+
color: theme.palette.primary.main,
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
interface CustomModalProps {
|
|
44
|
+
icon?: any;
|
|
45
|
+
open: boolean;
|
|
46
|
+
onClose: () => void;
|
|
47
|
+
children: React.JSX.Element | null;
|
|
48
|
+
titleButtonClose?: string;
|
|
49
|
+
titleButtonApply?: string;
|
|
50
|
+
onApply: (result: string) => void;
|
|
51
|
+
fullWidth?: boolean;
|
|
52
|
+
maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
53
|
+
applyButton?: boolean;
|
|
54
|
+
applyDisabled?: boolean;
|
|
55
|
+
overflowHidden?: boolean;
|
|
56
|
+
help?: string;
|
|
57
|
+
noTranslation?: boolean;
|
|
58
|
+
toggleTranslation?: () => void;
|
|
59
|
+
title?: string;
|
|
60
|
+
progress?: boolean;
|
|
61
|
+
textInput?: boolean;
|
|
62
|
+
defaultValue?: string;
|
|
63
|
+
theme: IobTheme;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const CustomModal = (props: CustomModalProps) => {
|
|
67
|
+
const {
|
|
68
|
+
open,
|
|
69
|
+
toggleTranslation,
|
|
70
|
+
noTranslation,
|
|
71
|
+
title,
|
|
72
|
+
fullWidth,
|
|
73
|
+
help,
|
|
74
|
+
maxWidth,
|
|
75
|
+
progress,
|
|
76
|
+
icon,
|
|
77
|
+
applyDisabled,
|
|
78
|
+
applyButton,
|
|
79
|
+
onClose,
|
|
80
|
+
children,
|
|
81
|
+
titleButtonApply,
|
|
82
|
+
titleButtonClose,
|
|
83
|
+
onApply,
|
|
84
|
+
textInput,
|
|
85
|
+
defaultValue,
|
|
86
|
+
overflowHidden,
|
|
87
|
+
} = props;
|
|
88
|
+
|
|
89
|
+
const [value, setValue] = useState<string>(defaultValue || '');
|
|
90
|
+
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
setValue(defaultValue || '');
|
|
93
|
+
}, [defaultValue]);
|
|
94
|
+
|
|
95
|
+
let Icon = null;
|
|
96
|
+
|
|
97
|
+
if (icon) {
|
|
98
|
+
Icon = icon;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return <Dialog
|
|
102
|
+
open={open}
|
|
103
|
+
maxWidth={maxWidth || 'md'}
|
|
104
|
+
fullWidth={!!fullWidth}
|
|
105
|
+
disableEscapeKeyDown={false}
|
|
106
|
+
onClose={onClose}
|
|
107
|
+
sx={{ '& .MuiDialog-paper': styles.modalDialog }}
|
|
108
|
+
>
|
|
109
|
+
{title && <DialogTitle>
|
|
110
|
+
{icon ? <Icon style={styles.titleIcon} /> : null}
|
|
111
|
+
{title}
|
|
112
|
+
{I18n.getLanguage() !== 'en' && toggleTranslation ? <IconButton
|
|
113
|
+
size="large"
|
|
114
|
+
sx={Utils.getStyle(props.theme, styles.languageButton, noTranslation && styles.languageButtonActive)}
|
|
115
|
+
onClick={() => toggleTranslation()}
|
|
116
|
+
title={I18n.t('Disable/Enable translation')}
|
|
117
|
+
>
|
|
118
|
+
<LanguageIcon />
|
|
119
|
+
</IconButton> : null}
|
|
120
|
+
</DialogTitle>}
|
|
121
|
+
<DialogContent
|
|
122
|
+
style={{ ...styles.content, ...(overflowHidden ? styles.overflowHidden : undefined), paddingTop: 8 }}
|
|
123
|
+
>
|
|
124
|
+
{textInput && <TextField
|
|
125
|
+
// className={className}
|
|
126
|
+
autoComplete="off"
|
|
127
|
+
fullWidth
|
|
128
|
+
autoFocus
|
|
129
|
+
variant="outlined"
|
|
130
|
+
size="medium"
|
|
131
|
+
// rows={10}
|
|
132
|
+
multiline
|
|
133
|
+
value={value}
|
|
134
|
+
onChange={e => setValue(e.target.value)}
|
|
135
|
+
// customValue
|
|
136
|
+
/>}
|
|
137
|
+
{children}
|
|
138
|
+
{help ? <div>{help}</div> : null}
|
|
139
|
+
</DialogContent>
|
|
140
|
+
<DialogActions>
|
|
141
|
+
{applyButton !== false && <Button
|
|
142
|
+
startIcon={<CheckIcon />}
|
|
143
|
+
disabled={progress || (applyDisabled && defaultValue === value)}
|
|
144
|
+
onClick={() => onApply(textInput ? value : '')}
|
|
145
|
+
variant="contained"
|
|
146
|
+
color="primary"
|
|
147
|
+
>
|
|
148
|
+
{I18n.t(titleButtonApply || 'ra_Ok')}
|
|
149
|
+
</Button>}
|
|
150
|
+
<Button
|
|
151
|
+
color="grey"
|
|
152
|
+
onClick={onClose}
|
|
153
|
+
disabled={progress}
|
|
154
|
+
variant="contained"
|
|
155
|
+
startIcon={<CloseIcon />}
|
|
156
|
+
>
|
|
157
|
+
{I18n.t(titleButtonClose || 'ra_Cancel')}
|
|
158
|
+
</Button>
|
|
159
|
+
</DialogActions>
|
|
160
|
+
</Dialog>;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export default CustomModal;
|