@iobroker/adapter-react-v5 4.10.2 → 4.11.0
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/ComplexCron.d.ts +1 -1
- package/Components/CustomModal.d.ts +24 -2
- package/Components/CustomModal.js +77 -145
- package/Components/FileBrowser.d.ts +3 -3
- package/Components/IconSelector.d.ts +28 -22
- package/Components/IconSelector.js +2122 -2073
- package/Components/Loader.d.ts +8 -3
- package/Components/Loader.js +4 -2
- package/Components/Loaders/MV.d.ts +6 -1
- package/Components/Loaders/MV.js +24 -21
- package/Components/Loaders/PT.d.ts +7 -2
- package/Components/Loaders/PT.js +7 -1
- package/Components/Loaders/Vendor.d.ts +7 -2
- package/Components/Loaders/Vendor.js +5 -0
- package/Components/Router.d.ts +11 -22
- package/Components/Router.js +65 -105
- package/Components/SelectWithIcon.d.ts +23 -20
- package/Components/SelectWithIcon.js +143 -204
- package/Components/SimpleCron/index.d.ts +1 -1
- package/Components/TabContainer.d.ts +1 -1
- package/Components/Utils.d.ts +7 -9
- package/Components/Utils.js +2 -5
- package/Components/types.d.ts +0 -53
- package/GenericApp.d.ts +151 -116
- package/GenericApp.js +667 -914
- package/LegacyConnection.d.ts +3 -3
- package/README.md +6 -3
- package/package.json +3 -3
- package/types.d.ts +9 -7
- package/Components/CustomModal.js.map +0 -1
- package/Components/IconSelector.js.map +0 -1
- package/Components/Router.js.map +0 -1
- package/Components/SelectWithIcon.js.map +0 -1
- package/GenericApp.js.map +0 -1
|
@@ -2,7 +2,7 @@ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
|
2
2
|
cronExpression: PropTypes.Requireable<string>;
|
|
3
3
|
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
4
4
|
language: PropTypes.Requireable<string>;
|
|
5
|
-
}>, "classes"> & import("@mui/styles").StyledComponentProps<"
|
|
5
|
+
}>, "classes"> & import("@mui/styles").StyledComponentProps<"mainDiv" | "periodSelect" | "slider" | "tabContent" | "numberButton" | "numberButtonBreak" | "appBar"> & object>;
|
|
6
6
|
export default _default;
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<any>;
|
|
2
|
-
export default _default;
|
|
3
1
|
import React from 'react';
|
|
2
|
+
interface CustomModalProps {
|
|
3
|
+
icon?: any;
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
children: React.JSX.Element | null;
|
|
7
|
+
titleButtonClose?: string;
|
|
8
|
+
titleButtonApply?: string;
|
|
9
|
+
onApply: (result: string) => void;
|
|
10
|
+
fullWidth?: boolean;
|
|
11
|
+
maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
applyButton?: boolean;
|
|
13
|
+
applyDisabled?: boolean;
|
|
14
|
+
overflowHidden?: boolean;
|
|
15
|
+
help?: string;
|
|
16
|
+
noTranslation?: boolean;
|
|
17
|
+
toggleTranslation?: () => void;
|
|
18
|
+
title?: string;
|
|
19
|
+
progress?: boolean;
|
|
20
|
+
classes: Record<string, string>;
|
|
21
|
+
textInput?: boolean;
|
|
22
|
+
defaultValue?: string;
|
|
23
|
+
}
|
|
24
|
+
declare const _default: React.JSXElementConstructor<Omit<CustomModalProps, "classes"> & import("@mui/styles").StyledComponentProps<string> & object>;
|
|
25
|
+
export default _default;
|
|
@@ -1,161 +1,93 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
7
17
|
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const styles_1 = require("@mui/styles");
|
|
31
|
+
const material_1 = require("@mui/material");
|
|
32
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
33
|
+
const Utils_1 = __importDefault(require("./Utils"));
|
|
34
|
+
const i18n_1 = __importDefault(require("../i18n"));
|
|
35
|
+
const styles = (theme) => ({
|
|
21
36
|
modalDialog: {
|
|
22
|
-
|
|
23
|
-
|
|
37
|
+
minWidth: 400,
|
|
38
|
+
maxWidth: 800,
|
|
24
39
|
},
|
|
25
40
|
overflowHidden: {
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
display: 'flex',
|
|
42
|
+
overflow: 'hidden',
|
|
28
43
|
},
|
|
29
44
|
titleIcon: {
|
|
30
|
-
|
|
45
|
+
marginRight: 5,
|
|
31
46
|
},
|
|
32
47
|
content: {
|
|
33
|
-
|
|
48
|
+
fontSize: 16,
|
|
34
49
|
},
|
|
35
50
|
languageButton: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
right: theme.spacing(1),
|
|
53
|
+
top: theme.spacing(1),
|
|
39
54
|
},
|
|
40
55
|
languageButtonActive: {
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
var CustomModal = function CustomModal(_ref) {
|
|
46
|
-
var open = _ref.open,
|
|
47
|
-
toggleTranslation = _ref.toggleTranslation,
|
|
48
|
-
noTranslation = _ref.noTranslation,
|
|
49
|
-
title = _ref.title,
|
|
50
|
-
fullWidth = _ref.fullWidth,
|
|
51
|
-
help = _ref.help,
|
|
52
|
-
maxWidth = _ref.maxWidth,
|
|
53
|
-
progress = _ref.progress,
|
|
54
|
-
icon = _ref.icon,
|
|
55
|
-
applyDisabled = _ref.applyDisabled,
|
|
56
|
-
applyButton = _ref.applyButton,
|
|
57
|
-
classes = _ref.classes,
|
|
58
|
-
onClose = _ref.onClose,
|
|
59
|
-
children = _ref.children,
|
|
60
|
-
titleButtonApply = _ref.titleButtonApply,
|
|
61
|
-
titleButtonClose = _ref.titleButtonClose,
|
|
62
|
-
onApply = _ref.onApply,
|
|
63
|
-
textInput = _ref.textInput,
|
|
64
|
-
defaultValue = _ref.defaultValue,
|
|
65
|
-
overflowHidden = _ref.overflowHidden;
|
|
66
|
-
var _useState = (0, _react.useState)(defaultValue),
|
|
67
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
68
|
-
value = _useState2[0],
|
|
69
|
-
setValue = _useState2[1];
|
|
70
|
-
(0, _react.useEffect)(function () {
|
|
71
|
-
setValue(defaultValue);
|
|
72
|
-
}, [defaultValue]);
|
|
73
|
-
var Icon = null;
|
|
74
|
-
if (icon) {
|
|
75
|
-
Icon = icon;
|
|
76
|
-
}
|
|
77
|
-
return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
|
|
78
|
-
open: open,
|
|
79
|
-
maxWidth: maxWidth || 'md',
|
|
80
|
-
fullWidth: !!fullWidth,
|
|
81
|
-
disableEscapeKeyDown: false,
|
|
82
|
-
onClose: onClose,
|
|
83
|
-
classes: {
|
|
84
|
-
paper: classes.modalDialog /* paper: classes.background */
|
|
85
|
-
}
|
|
86
|
-
}, title && /*#__PURE__*/_react["default"].createElement(_material.DialogTitle, null, icon ? /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
87
|
-
className: classes.titleIcon
|
|
88
|
-
}) : null, title, _i18n["default"].getLanguage() !== 'en' && toggleTranslation ? /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
89
|
-
size: "large",
|
|
90
|
-
className: _Utils["default"].clsx(classes.languageButton, noTranslation && classes.languageButtonActive),
|
|
91
|
-
onClick: function onClick() {
|
|
92
|
-
return toggleTranslation();
|
|
56
|
+
color: theme.palette.primary.main,
|
|
93
57
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
fullWidth: true,
|
|
105
|
-
autoFocus: true,
|
|
106
|
-
variant: "outlined",
|
|
107
|
-
size: "medium"
|
|
108
|
-
// rows={10}
|
|
109
|
-
,
|
|
110
|
-
multiline: true,
|
|
111
|
-
value: value,
|
|
112
|
-
onChange: function onChange(e) {
|
|
113
|
-
return setValue(e.target.value);
|
|
58
|
+
});
|
|
59
|
+
const CustomModal = (props) => {
|
|
60
|
+
const { open, toggleTranslation, noTranslation, title, fullWidth, help, maxWidth, progress, icon, applyDisabled, applyButton, classes, onClose, children, titleButtonApply, titleButtonClose, onApply, textInput, defaultValue, overflowHidden, } = props;
|
|
61
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue || '');
|
|
62
|
+
(0, react_1.useEffect)(() => {
|
|
63
|
+
setValue(defaultValue || '');
|
|
64
|
+
}, [defaultValue]);
|
|
65
|
+
let Icon = null;
|
|
66
|
+
if (icon) {
|
|
67
|
+
Icon = icon;
|
|
114
68
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
titleButtonClose: 'Cancel',
|
|
139
|
-
titleButtonApply: 'Ok',
|
|
140
|
-
overflowHidden: false,
|
|
141
|
-
help: ''
|
|
142
|
-
};
|
|
143
|
-
CustomModal.propTypes = {
|
|
144
|
-
icon: _propTypes["default"].object,
|
|
145
|
-
open: _propTypes["default"].bool,
|
|
146
|
-
onClose: _propTypes["default"].func,
|
|
147
|
-
children: _propTypes["default"].any,
|
|
148
|
-
titleButtonClose: _propTypes["default"].string,
|
|
149
|
-
titleButtonApply: _propTypes["default"].string,
|
|
150
|
-
onApply: _propTypes["default"].func,
|
|
151
|
-
fullWidth: _propTypes["default"].bool,
|
|
152
|
-
maxWidth: _propTypes["default"].string,
|
|
153
|
-
applyButton: _propTypes["default"].bool,
|
|
154
|
-
applyDisabled: _propTypes["default"].bool,
|
|
155
|
-
overflowHidden: _propTypes["default"].bool,
|
|
156
|
-
help: _propTypes["default"].string,
|
|
157
|
-
noTranslation: _propTypes["default"].bool,
|
|
158
|
-
toggleTranslation: _propTypes["default"].func
|
|
69
|
+
return react_1.default.createElement(material_1.Dialog, { open: open, maxWidth: maxWidth || 'md', fullWidth: !!fullWidth, disableEscapeKeyDown: false, onClose: onClose, classes: { paper: classes.modalDialog /* paper: classes.background */ } },
|
|
70
|
+
title && react_1.default.createElement(material_1.DialogTitle, null,
|
|
71
|
+
icon ? react_1.default.createElement(Icon, { className: classes.titleIcon }) : null,
|
|
72
|
+
title,
|
|
73
|
+
i18n_1.default.getLanguage() !== 'en' && toggleTranslation ? react_1.default.createElement(material_1.IconButton, { size: "large", className: Utils_1.default.clsx(classes.languageButton, noTranslation && classes.languageButtonActive), onClick: () => toggleTranslation(), title: i18n_1.default.t('Disable/Enable translation') },
|
|
74
|
+
react_1.default.createElement(icons_material_1.Language, null)) : null),
|
|
75
|
+
react_1.default.createElement(material_1.DialogContent, { className: Utils_1.default.clsx(overflowHidden ? classes.overflowHidden : null, classes.content), style: { paddingTop: 8 } },
|
|
76
|
+
textInput && react_1.default.createElement(material_1.TextField
|
|
77
|
+
// className={className}
|
|
78
|
+
, {
|
|
79
|
+
// className={className}
|
|
80
|
+
autoComplete: "off", fullWidth: true, autoFocus: true, variant: "outlined", size: "medium",
|
|
81
|
+
// rows={10}
|
|
82
|
+
multiline: true, value: value, onChange: e => setValue(e.target.value) }),
|
|
83
|
+
children,
|
|
84
|
+
help ? react_1.default.createElement("div", null, help) : null),
|
|
85
|
+
react_1.default.createElement(material_1.DialogActions, null,
|
|
86
|
+
applyButton !== false && react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(icons_material_1.Check, null), disabled: progress || (applyDisabled && defaultValue === value), onClick: () => onApply(textInput ? value : ''), variant: "contained", color: "primary" }, i18n_1.default.t(titleButtonApply || 'ra_Ok')),
|
|
87
|
+
react_1.default.createElement(material_1.Button
|
|
88
|
+
// @ts-expect-error grey is valid color
|
|
89
|
+
, {
|
|
90
|
+
// @ts-expect-error grey is valid color
|
|
91
|
+
color: "grey", onClick: onClose, disabled: progress, variant: "contained", startIcon: react_1.default.createElement(icons_material_1.Close, null) }, i18n_1.default.t(titleButtonClose || 'ra_Cancel'))));
|
|
159
92
|
};
|
|
160
|
-
|
|
161
|
-
//# sourceMappingURL=CustomModal.js.map
|
|
93
|
+
exports.default = (0, styles_1.withStyles)(styles)(CustomModal);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* */
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import type { Connection } from '@iobroker/socket-client';
|
|
9
|
-
import { Translator } from '../types';
|
|
9
|
+
import { ThemeName, ThemeType, Translator } from '../types';
|
|
10
10
|
export interface FileBrowserProps {
|
|
11
11
|
/** The key to identify this component. */
|
|
12
12
|
key?: string;
|
|
@@ -55,9 +55,9 @@ export interface FileBrowserProps {
|
|
|
55
55
|
/** Callback for file selection. */
|
|
56
56
|
onSelect?: (id: string | string[], isDoubleClick?: boolean, isFolder?: boolean) => void;
|
|
57
57
|
/** Theme name */
|
|
58
|
-
themeName?:
|
|
58
|
+
themeName?: ThemeName;
|
|
59
59
|
/** Theme type. */
|
|
60
|
-
themeType?:
|
|
60
|
+
themeType?: ThemeType;
|
|
61
61
|
/** Padding in pixels for folder levels */
|
|
62
62
|
levelPadding?: number;
|
|
63
63
|
restrictToFolder?: string;
|
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { Translator } from '../types';
|
|
3
|
+
interface IconSelectorProps {
|
|
4
|
+
icons: {
|
|
5
|
+
icon?: string;
|
|
6
|
+
src?: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
name?: ioBroker.StringOrTranslated;
|
|
9
|
+
_id?: string;
|
|
10
|
+
}[];
|
|
11
|
+
onlyRooms?: boolean;
|
|
12
|
+
onlyDevices?: boolean;
|
|
13
|
+
onSelect?: (icon: string) => void;
|
|
14
|
+
onChange?: (icon: string) => void;
|
|
15
|
+
t: Translator;
|
|
16
|
+
lang: ioBroker.Languages;
|
|
17
|
+
}
|
|
18
|
+
interface IconSelectorState {
|
|
19
|
+
opened: boolean;
|
|
20
|
+
names: string[];
|
|
21
|
+
filter: string;
|
|
22
|
+
icons: string[] | null;
|
|
23
|
+
loading: boolean;
|
|
24
|
+
isAnyName: boolean;
|
|
25
|
+
}
|
|
26
|
+
declare class IconSelector extends Component<IconSelectorProps, IconSelectorState> {
|
|
27
|
+
constructor(props: IconSelectorProps);
|
|
10
28
|
loadAllIcons(): void;
|
|
11
29
|
render(): React.JSX.Element;
|
|
12
30
|
}
|
|
13
|
-
|
|
14
|
-
namespace propTypes {
|
|
15
|
-
let icons: PropTypes.Requireable<any[]>;
|
|
16
|
-
let onlyRooms: PropTypes.Requireable<boolean>;
|
|
17
|
-
let onlyDevices: PropTypes.Requireable<boolean>;
|
|
18
|
-
let onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
-
let onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
-
let t: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
-
let lang: PropTypes.Validator<string>;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
import React from 'react';
|
|
25
|
-
import PropTypes from 'prop-types';
|
|
31
|
+
export default IconSelector;
|