@iobroker/adapter-react-v5 4.9.11 → 4.10.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/404.d.ts +5 -2
- package/Components/404.js +83 -105
- package/Components/ColorPicker.js.map +1 -1
- package/Components/FileViewer.d.ts +0 -1
- package/Components/FileViewer.js +1 -2
- package/Components/FileViewer.js.map +1 -1
- package/Components/Icon.d.ts +10 -17
- package/Components/Icon.js +104 -161
- package/Components/IconPicker.d.ts +16 -61
- package/Components/IconPicker.js +100 -158
- package/Components/Loader.d.ts +22 -33
- package/Components/Loader.js +276 -102
- package/Components/TabContainer.d.ts +1 -1
- package/Components/TextWithIcon.d.ts +21 -16
- package/Components/TextWithIcon.js +104 -125
- package/Components/UploadImage.d.ts +13 -1
- package/Components/UploadImage.js +499 -292
- package/Dialogs/TextInput.d.ts +2 -86
- package/Dialogs/TextInput.js +37 -130
- package/LegacyConnection.d.ts +3 -3
- package/README.md +6 -3
- package/Theme.d.ts +3 -4
- package/Theme.js +389 -382
- package/i18n.d.ts +38 -55
- package/i18n.js +164 -189
- package/package.json +1 -1
- package/types.d.ts +4 -2
- package/Components/404.js.map +0 -1
- package/Components/Icon.js.map +0 -1
- package/Components/IconPicker.js.map +0 -1
- package/Components/Loader.js.map +0 -1
- package/Components/TextWithIcon.js.map +0 -1
- package/Components/UploadImage.js.map +0 -1
- package/Dialogs/TextInput.js.map +0 -1
- package/Theme.js.map +0 -1
- package/i18n.js.map +0 -1
package/Dialogs/TextInput.d.ts
CHANGED
|
@@ -1,87 +1,3 @@
|
|
|
1
|
-
export default _export;
|
|
2
|
-
export type TextInputProps = {
|
|
3
|
-
/**
|
|
4
|
-
* The dialog close callback.
|
|
5
|
-
*/
|
|
6
|
-
onClose: (text: string | null) => void;
|
|
7
|
-
/**
|
|
8
|
-
* The title text.
|
|
9
|
-
*/
|
|
10
|
-
titleText: string;
|
|
11
|
-
/**
|
|
12
|
-
* Prompt text (default: empty).
|
|
13
|
-
*/
|
|
14
|
-
promptText?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Label text (default: empty).
|
|
17
|
-
*/
|
|
18
|
-
labelText?: string;
|
|
19
|
-
/**
|
|
20
|
-
* The text of the cancel button.
|
|
21
|
-
*/
|
|
22
|
-
cancelText: string;
|
|
23
|
-
/**
|
|
24
|
-
* The text of the apply button.
|
|
25
|
-
*/
|
|
26
|
-
applyText: string;
|
|
27
|
-
/**
|
|
28
|
-
* The verification callback. Return a non-empty string if there was an error.
|
|
29
|
-
*/
|
|
30
|
-
verify?: (text: string) => string;
|
|
31
|
-
/**
|
|
32
|
-
* The text replacement callback.
|
|
33
|
-
*/
|
|
34
|
-
rule?: (text: string) => string;
|
|
35
|
-
/**
|
|
36
|
-
* The type of the textbox (default: text).
|
|
37
|
-
*/
|
|
38
|
-
type?: 'text' | 'number' | 'password' | 'email';
|
|
39
|
-
/**
|
|
40
|
-
* The input when opening the dialog.
|
|
41
|
-
*/
|
|
42
|
-
input?: string;
|
|
43
|
-
};
|
|
44
|
-
/** @type {typeof TextInput} */
|
|
45
|
-
declare const _export: typeof TextInput;
|
|
46
|
-
/**
|
|
47
|
-
* @typedef {object} TextInputProps
|
|
48
|
-
* @property {(text: string | null) => void} onClose The dialog close callback.
|
|
49
|
-
* @property {string} titleText The title text.
|
|
50
|
-
* @property {string} [promptText] Prompt text (default: empty).
|
|
51
|
-
* @property {string} [labelText] Label text (default: empty).
|
|
52
|
-
* @property {string} cancelText The text of the cancel button.
|
|
53
|
-
* @property {string} applyText The text of the apply button.
|
|
54
|
-
* @property {(text: string) => string} [verify] The verification callback. Return a non-empty string if there was an error.
|
|
55
|
-
* @property {(text: string) => string} [rule] The text replacement callback.
|
|
56
|
-
* @property {'text' | 'number' | 'password' | 'email'} [type] The type of the textbox (default: text).
|
|
57
|
-
* @property {string} [input] The input when opening the dialog.
|
|
58
|
-
*
|
|
59
|
-
* @extends {React.Component<TextInputProps>}
|
|
60
|
-
*/
|
|
61
|
-
declare class TextInput extends React.Component<TextInputProps, any, any> {
|
|
62
|
-
/**
|
|
63
|
-
* @param {Readonly<TextInputProps>} props
|
|
64
|
-
*/
|
|
65
|
-
constructor(props: Readonly<TextInputProps>);
|
|
66
|
-
state: {
|
|
67
|
-
text: any;
|
|
68
|
-
error: string;
|
|
69
|
-
};
|
|
70
|
-
render(): React.JSX.Element;
|
|
71
|
-
}
|
|
72
|
-
declare namespace TextInput {
|
|
73
|
-
namespace propTypes {
|
|
74
|
-
let fullWidth: PropTypes.Requireable<boolean>;
|
|
75
|
-
let onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
76
|
-
let titleText: PropTypes.Validator<string>;
|
|
77
|
-
let promptText: PropTypes.Requireable<string>;
|
|
78
|
-
let labelText: PropTypes.Requireable<string>;
|
|
79
|
-
let cancelText: PropTypes.Requireable<string>;
|
|
80
|
-
let applyText: PropTypes.Requireable<string>;
|
|
81
|
-
let verify: PropTypes.Requireable<(...args: any[]) => any>;
|
|
82
|
-
let type: PropTypes.Requireable<string>;
|
|
83
|
-
let value: PropTypes.Requireable<string>;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
1
|
import React from 'react';
|
|
87
|
-
|
|
2
|
+
declare const _default: (props: any) => React.JSX.Element;
|
|
3
|
+
export default _default;
|
package/Dialogs/TextInput.js
CHANGED
|
@@ -1,132 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
11
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
var _react = _interopRequireDefault(require("react"));
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
var _material = require("@mui/material");
|
|
16
|
-
var _iconsMaterial = require("@mui/icons-material");
|
|
17
|
-
var _i18n = _interopRequireDefault(require("../i18n"));
|
|
18
|
-
var _withWidth = _interopRequireDefault(require("../Components/withWidth"));
|
|
19
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
20
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
-
/**
|
|
22
|
-
* @typedef {object} TextInputProps
|
|
23
|
-
* @property {(text: string | null) => void} onClose The dialog close callback.
|
|
24
|
-
* @property {string} titleText The title text.
|
|
25
|
-
* @property {string} [promptText] Prompt text (default: empty).
|
|
26
|
-
* @property {string} [labelText] Label text (default: empty).
|
|
27
|
-
* @property {string} cancelText The text of the cancel button.
|
|
28
|
-
* @property {string} applyText The text of the apply button.
|
|
29
|
-
* @property {(text: string) => string} [verify] The verification callback. Return a non-empty string if there was an error.
|
|
30
|
-
* @property {(text: string) => string} [rule] The text replacement callback.
|
|
31
|
-
* @property {'text' | 'number' | 'password' | 'email'} [type] The type of the textbox (default: text).
|
|
32
|
-
* @property {string} [input] The input when opening the dialog.
|
|
33
|
-
*
|
|
34
|
-
* @extends {React.Component<TextInputProps>}
|
|
35
|
-
*/
|
|
36
|
-
var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
37
|
-
(0, _inherits2["default"])(TextInput, _React$Component);
|
|
38
|
-
/**
|
|
39
|
-
* @param {Readonly<TextInputProps>} props
|
|
40
|
-
*/
|
|
41
|
-
function TextInput(props) {
|
|
42
|
-
var _this;
|
|
43
|
-
(0, _classCallCheck2["default"])(this, TextInput);
|
|
44
|
-
_this = _callSuper(this, TextInput, [props]);
|
|
45
|
-
_this.state = {
|
|
46
|
-
text: _this.props.input || _this.props.value || '',
|
|
47
|
-
// input is deprecated
|
|
48
|
-
error: ''
|
|
49
|
-
};
|
|
50
|
-
return _this;
|
|
51
|
-
}
|
|
52
|
-
(0, _createClass2["default"])(TextInput, [{
|
|
53
|
-
key: "render",
|
|
54
|
-
value: function render() {
|
|
55
|
-
var _this2 = this;
|
|
56
|
-
return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
|
|
57
|
-
open: !0,
|
|
58
|
-
onClose: function onClose() {
|
|
59
|
-
return _this2.props.onClose(null);
|
|
60
|
-
},
|
|
61
|
-
"aria-labelledby": "form-dialog-title",
|
|
62
|
-
fullWidth: this.props.fullWidth !== undefined ? this.props.fullWidth : false
|
|
63
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.DialogTitle, {
|
|
64
|
-
id: "form-dialog-title"
|
|
65
|
-
}, this.props.titleText), /*#__PURE__*/_react["default"].createElement(_material.DialogContent, null, /*#__PURE__*/_react["default"].createElement(_material.DialogContentText, null, this.props.promptText), /*#__PURE__*/_react["default"].createElement(_material.TextField, {
|
|
66
|
-
variant: "standard",
|
|
67
|
-
autoFocus: true,
|
|
68
|
-
margin: "dense",
|
|
69
|
-
error: !!this.state.error,
|
|
70
|
-
title: this.state.error,
|
|
71
|
-
value: this.state.text,
|
|
72
|
-
label: this.props.labelText || '',
|
|
73
|
-
type: this.props.type || 'text',
|
|
74
|
-
onKeyPress: function onKeyPress(e) {
|
|
75
|
-
return e.charCode === 13 && _this2.state.text && _this2.props.onClose(_this2.state.text);
|
|
76
|
-
},
|
|
77
|
-
onChange: function onChange(e) {
|
|
78
|
-
var error = '';
|
|
79
|
-
if (_this2.props.verify) {
|
|
80
|
-
error = !_this2.props.verify(e.target.value);
|
|
81
|
-
}
|
|
82
|
-
if (_this2.props.rule) {
|
|
83
|
-
_this2.setState({
|
|
84
|
-
text: _this2.props.rule(e.target.value),
|
|
85
|
-
error: error
|
|
86
|
-
});
|
|
87
|
-
} else {
|
|
88
|
-
_this2.setState({
|
|
89
|
-
text: e.target.value,
|
|
90
|
-
error: error
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
fullWidth: true
|
|
95
|
-
})), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
96
|
-
variant: "contained",
|
|
97
|
-
disabled: !this.state.text || this.state.error,
|
|
98
|
-
onClick: function onClick() {
|
|
99
|
-
return _this2.props.onClose(_this2.state.text);
|
|
100
|
-
},
|
|
101
|
-
color: "primary",
|
|
102
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Check, null)
|
|
103
|
-
}, this.props.applyText || _i18n["default"].t('ra_Ok')), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
104
|
-
color: "grey",
|
|
105
|
-
variant: "contained",
|
|
106
|
-
onClick: function onClick() {
|
|
107
|
-
return _this2.props.onClose(null);
|
|
108
|
-
},
|
|
109
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Close, null)
|
|
110
|
-
}, this.props.cancelText || _i18n["default"].t('ra_Cancel'))));
|
|
111
|
-
}
|
|
112
|
-
}]);
|
|
113
|
-
return TextInput;
|
|
114
|
-
}(_react["default"].Component);
|
|
115
|
-
TextInput.propTypes = {
|
|
116
|
-
fullWidth: _propTypes["default"].bool,
|
|
117
|
-
onClose: _propTypes["default"].func.isRequired,
|
|
118
|
-
titleText: _propTypes["default"].string.isRequired,
|
|
119
|
-
promptText: _propTypes["default"].string,
|
|
120
|
-
labelText: _propTypes["default"].string,
|
|
121
|
-
cancelText: _propTypes["default"].string,
|
|
122
|
-
applyText: _propTypes["default"].string,
|
|
123
|
-
verify: _propTypes["default"].func,
|
|
124
|
-
type: _propTypes["default"].string,
|
|
125
|
-
// text, number, password, email
|
|
126
|
-
value: _propTypes["default"].string
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
127
4
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
9
|
+
const i18n_1 = __importDefault(require("../i18n"));
|
|
10
|
+
const withWidth_1 = __importDefault(require("../Components/withWidth"));
|
|
11
|
+
function TextInput(props) {
|
|
12
|
+
const [text, setText] = react_1.default.useState(props.input || props.value || '');
|
|
13
|
+
const [error, setError] = react_1.default.useState('');
|
|
14
|
+
return react_1.default.createElement(material_1.Dialog, { open: !0, onClose: () => props.onClose(null), "aria-labelledby": "form-dialog-title", fullWidth: props.fullWidth !== undefined ? props.fullWidth : false },
|
|
15
|
+
react_1.default.createElement(material_1.DialogTitle, { id: "form-dialog-title" }, props.titleText),
|
|
16
|
+
react_1.default.createElement(material_1.DialogContent, null,
|
|
17
|
+
react_1.default.createElement(material_1.DialogContentText, null, props.promptText),
|
|
18
|
+
react_1.default.createElement(material_1.TextField, { variant: "standard", autoFocus: true, margin: "dense", error: !!error, helperText: error === true || !error ? '' : error, value: text, label: props.labelText || '', type: props.type || 'text', onKeyUp: e => e.charCode === 13 && text && props.onClose(text), onChange: e => {
|
|
19
|
+
let _error = '';
|
|
20
|
+
if (props.verify) {
|
|
21
|
+
_error = !props.verify(e.target.value);
|
|
22
|
+
}
|
|
23
|
+
if (props.rule) {
|
|
24
|
+
setText(props.rule(e.target.value));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
setText(e.target.value);
|
|
28
|
+
}
|
|
29
|
+
setError(_error);
|
|
30
|
+
}, fullWidth: true })),
|
|
31
|
+
react_1.default.createElement(material_1.DialogActions, null,
|
|
32
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", disabled: !text || !!error, onClick: () => props.onClose(text), color: "primary", startIcon: react_1.default.createElement(icons_material_1.Check, null) }, props.applyText || i18n_1.default.t('ra_Ok')),
|
|
33
|
+
react_1.default.createElement(material_1.Button
|
|
34
|
+
// @ts-expect-error grey is valid color
|
|
35
|
+
, {
|
|
36
|
+
// @ts-expect-error grey is valid color
|
|
37
|
+
color: "grey", variant: "contained", onClick: () => props.onClose(null), startIcon: react_1.default.createElement(icons_material_1.Close, null) }, props.cancelText || i18n_1.default.t('ra_Cancel'))));
|
|
38
|
+
}
|
|
39
|
+
exports.default = (0, withWidth_1.default)()(TextInput);
|
package/LegacyConnection.d.ts
CHANGED
|
@@ -331,15 +331,15 @@ declare class Connection {
|
|
|
331
331
|
* @param {string | { [lang in ioBroker.Languages]?: string; }} newName The new name.
|
|
332
332
|
*/
|
|
333
333
|
renameGroup(id: string, newId: string, newName: string | {
|
|
334
|
+
pt?: string;
|
|
335
|
+
pl?: string;
|
|
336
|
+
fr?: string;
|
|
334
337
|
en?: string;
|
|
335
338
|
de?: string;
|
|
336
339
|
ru?: string;
|
|
337
|
-
pt?: string;
|
|
338
340
|
nl?: string;
|
|
339
|
-
fr?: string;
|
|
340
341
|
it?: string;
|
|
341
342
|
es?: string;
|
|
342
|
-
pl?: string;
|
|
343
343
|
uk?: string;
|
|
344
344
|
"zh-cn"?: string;
|
|
345
345
|
}): Promise<void>;
|
package/README.md
CHANGED
|
@@ -185,9 +185,9 @@ This is a non-react class to provide the communication for socket connection wit
|
|
|
185
185
|
|
|
186
186
|
### GenericApp.js
|
|
187
187
|
|
|
188
|
-
### i18n.
|
|
188
|
+
### i18n.ts
|
|
189
189
|
|
|
190
|
-
### Theme.
|
|
190
|
+
### Theme.tsx
|
|
191
191
|
|
|
192
192
|
### Dialogs
|
|
193
193
|
Some dialogs are predefined and could be used out of the box.
|
|
@@ -342,7 +342,7 @@ return (<img src={icon}/>);
|
|
|
342
342
|
|
|
343
343
|
Usage: `
|
|
344
344
|
|
|
345
|
-
#### Loader.
|
|
345
|
+
#### Loader.tsx
|
|
346
346
|

|
|
347
347
|
|
|
348
348
|
```
|
|
@@ -670,6 +670,9 @@ socket.getObjectViewCustom('custom', 'state', 'startKey', 'endKey')
|
|
|
670
670
|
-->
|
|
671
671
|
|
|
672
672
|
## Changelog
|
|
673
|
+
### 4.10.0 (2024-03-11)
|
|
674
|
+
* (bluefox) Migrated some components to typescript
|
|
675
|
+
|
|
673
676
|
### 4.9.11 (2024-03-08)
|
|
674
677
|
* (foxriver76) type GenericApp socket correctly
|
|
675
678
|
|
package/Theme.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { type Theme, type ThemeName } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* The theme creation factory function.
|
|
4
|
-
* @param {string} type
|
|
5
|
-
* @returns {import('./types').Theme}
|
|
6
4
|
*/
|
|
7
|
-
declare
|
|
5
|
+
declare const CustomTheme: (type: ThemeName) => Theme;
|
|
6
|
+
export default CustomTheme;
|