@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.
Files changed (74) hide show
  1. package/README.md +6 -0
  2. package/craco-module-federation.js +1 -1
  3. package/package.json +1 -1
  4. package/src/AdminConnection.tsx +3 -0
  5. package/src/Components/404.tsx +121 -0
  6. package/src/Components/ColorPicker.tsx +315 -0
  7. package/src/Components/ComplexCron.tsx +507 -0
  8. package/src/Components/CopyToClipboard.tsx +165 -0
  9. package/src/Components/CustomModal.tsx +163 -0
  10. package/src/Components/FileBrowser.tsx +2394 -0
  11. package/src/Components/FileViewer.tsx +384 -0
  12. package/src/Components/Icon.tsx +210 -0
  13. package/src/Components/IconPicker.tsx +149 -0
  14. package/src/Components/IconSelector.tsx +2202 -0
  15. package/src/Components/Image.tsx +176 -0
  16. package/src/Components/Loader.tsx +304 -0
  17. package/src/Components/Logo.tsx +166 -0
  18. package/src/Components/MDUtils.tsx +100 -0
  19. package/src/Components/ObjectBrowser.tsx +7915 -0
  20. package/src/Components/Router.tsx +90 -0
  21. package/src/Components/SaveCloseButtons.tsx +113 -0
  22. package/src/Components/Schedule.tsx +1724 -0
  23. package/src/Components/SelectWithIcon.tsx +197 -0
  24. package/src/Components/TabContainer.tsx +55 -0
  25. package/src/Components/TabContent.tsx +37 -0
  26. package/src/Components/TabHeader.tsx +19 -0
  27. package/src/Components/TableResize.tsx +259 -0
  28. package/src/Components/TextWithIcon.tsx +148 -0
  29. package/src/Components/ToggleThemeMenu.tsx +34 -0
  30. package/src/Components/TreeTable.tsx +919 -0
  31. package/src/Components/UploadImage.tsx +599 -0
  32. package/src/Components/Utils.tsx +1794 -0
  33. package/src/Components/loader.css +222 -0
  34. package/src/Components/withWidth.tsx +21 -0
  35. package/src/Connection.tsx +7 -0
  36. package/src/Dialogs/ComplexCron.tsx +129 -0
  37. package/src/Dialogs/Confirm.tsx +162 -0
  38. package/src/Dialogs/Cron.tsx +182 -0
  39. package/src/Dialogs/Error.tsx +72 -0
  40. package/src/Dialogs/Message.tsx +71 -0
  41. package/src/Dialogs/SelectFile.tsx +270 -0
  42. package/src/Dialogs/SelectID.tsx +298 -0
  43. package/src/Dialogs/SimpleCron.tsx +100 -0
  44. package/src/Dialogs/TextInput.tsx +107 -0
  45. package/src/GenericApp.tsx +976 -0
  46. package/src/LegacyConnection.tsx +3589 -0
  47. package/src/Prompt.tsx +20 -0
  48. package/src/Theme.tsx +479 -0
  49. package/src/icons/IconAdapter.tsx +20 -0
  50. package/src/icons/IconAlias.tsx +20 -0
  51. package/src/icons/IconChannel.tsx +21 -0
  52. package/src/icons/IconClearFilter.tsx +22 -0
  53. package/src/icons/IconClosed.tsx +17 -0
  54. package/src/icons/IconCopy.tsx +16 -0
  55. package/src/icons/IconDevice.tsx +27 -0
  56. package/src/icons/IconDocument.tsx +17 -0
  57. package/src/icons/IconDocumentReadOnly.tsx +18 -0
  58. package/src/icons/IconExpert.tsx +18 -0
  59. package/src/icons/IconFx.tsx +36 -0
  60. package/src/icons/IconInstance.tsx +20 -0
  61. package/src/icons/IconLogout.tsx +30 -0
  62. package/src/icons/IconNoIcon.tsx +19 -0
  63. package/src/icons/IconOpen.tsx +17 -0
  64. package/src/icons/IconProps.tsx +15 -0
  65. package/src/icons/IconState.tsx +17 -0
  66. package/src/index.css +55 -0
  67. package/assets/devices/list.json +0 -994
  68. package/assets/devices/names.txt +0 -63
  69. package/assets/devices/parseNames.d.ts +0 -0
  70. package/assets/devices/parseNames.js +0 -34
  71. package/assets/rooms/list.json +0 -946
  72. package/assets/rooms/names.txt +0 -60
  73. package/assets/rooms/parseNames.d.ts +0 -0
  74. 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;