@iobroker/adapter-react-v5 4.6.12 → 4.7.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/FileViewer.js +1 -1
- package/Components/FileViewer.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigColor.d.ts +2 -1
- package/Components/JsonConfigComponent/ConfigFile.js +1 -1
- package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.js +4 -4
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigGeneric.d.ts +68 -67
- package/Components/JsonConfigComponent/ConfigGeneric.js +600 -665
- package/Components/JsonConfigComponent/ConfigInterface.d.ts +14 -0
- package/Components/JsonConfigComponent/ConfigInterface.js +146 -0
- package/Components/JsonConfigComponent/ConfigInterface.js.map +1 -0
- package/Components/JsonConfigComponent/ConfigJsonEditor.d.ts +0 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +6 -11
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLicense.d.ts +2 -1
- package/Components/JsonConfigComponent/ConfigNumber.d.ts +16 -2
- package/Components/JsonConfigComponent/ConfigNumber.js +105 -201
- package/Components/JsonConfigComponent/ConfigPattern.d.ts +2 -1
- package/Components/JsonConfigComponent/ConfigPort.d.ts +1 -1
- package/Components/JsonConfigComponent/ConfigPort.js +159 -210
- package/Components/JsonConfigComponent/ConfigUUID.d.ts +2 -1
- package/Components/JsonConfigComponent/wrapper/AdminConnection.d.ts +2 -0
- package/Components/JsonConfigComponent/wrapper/AdminConnection.js +7 -0
- package/Components/MDUtils.js +3 -3
- package/Components/MDUtils.js.map +1 -1
- package/Components/SimpleCron/cron2text.js +31 -36
- package/Components/SimpleCron/cron2text.js.map +1 -1
- package/Components/SimpleCron/index.js +10 -10
- package/Components/SimpleCron/index.js.map +1 -1
- package/LegacyConnection.js.map +1 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/Components/JsonConfigComponent/ConfigGeneric.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigNumber.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPort.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
2
|
+
socket: PropTypes.Validator<object>;
|
|
3
|
+
themeType: PropTypes.Requireable<string>;
|
|
4
|
+
themeName: PropTypes.Requireable<string>;
|
|
5
|
+
style: PropTypes.Requireable<object>;
|
|
6
|
+
className: PropTypes.Requireable<string>;
|
|
7
|
+
data: PropTypes.Validator<object>;
|
|
8
|
+
schema: PropTypes.Requireable<object>;
|
|
9
|
+
onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
+
}>, "classes"> & import("@mui/styles").StyledComponentProps<"address" | "fullWidth"> & object>;
|
|
12
|
+
export default _default;
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import React from 'react';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
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 _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
|
+
var _styles = require("@mui/styles");
|
|
17
|
+
var _material = require("@mui/material");
|
|
18
|
+
var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
|
|
19
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
20
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
|
+
var styles = function styles() {
|
|
22
|
+
return {
|
|
23
|
+
fullWidth: {
|
|
24
|
+
width: '100%'
|
|
25
|
+
},
|
|
26
|
+
address: {
|
|
27
|
+
fontSize: 'smaller',
|
|
28
|
+
opacity: 0.5,
|
|
29
|
+
marginLeft: 8
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
var ConfigInterface = /*#__PURE__*/function (_ConfigGeneric) {
|
|
34
|
+
(0, _inherits2["default"])(ConfigInterface, _ConfigGeneric);
|
|
35
|
+
var _super = _createSuper(ConfigInterface);
|
|
36
|
+
function ConfigInterface() {
|
|
37
|
+
(0, _classCallCheck2["default"])(this, ConfigInterface);
|
|
38
|
+
return _super.apply(this, arguments);
|
|
39
|
+
}
|
|
40
|
+
(0, _createClass2["default"])(ConfigInterface, [{
|
|
41
|
+
key: "componentDidMount",
|
|
42
|
+
value: function componentDidMount() {
|
|
43
|
+
var _this = this;
|
|
44
|
+
(0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigInterface.prototype), "componentDidMount", this).call(this);
|
|
45
|
+
this.props.socket.getObject("system.host.".concat(this.props.common.host)).then(function (obj) {
|
|
46
|
+
var _obj$native;
|
|
47
|
+
var interfaces = [];
|
|
48
|
+
if (obj !== null && obj !== void 0 && (_obj$native = obj["native"]) !== null && _obj$native !== void 0 && (_obj$native = _obj$native.hardware) !== null && _obj$native !== void 0 && _obj$native.networkInterfaces) {
|
|
49
|
+
var list = obj["native"].hardware.networkInterfaces;
|
|
50
|
+
Object.keys(list).forEach(function (inter) {
|
|
51
|
+
if (_this.props.schema.ignoreInternal && !list[inter].find(function (_ip) {
|
|
52
|
+
return !_ip.internal;
|
|
53
|
+
})) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (_this.props.schema.ignoreLoopback && list[inter].find(function (_ip) {
|
|
57
|
+
return ip.address === '127.0.0.1' || ip.address === '::1';
|
|
58
|
+
})) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// find ipv4 address
|
|
63
|
+
var ip = list[inter].find(function (_ip) {
|
|
64
|
+
return _ip.family === 'IPv4';
|
|
65
|
+
});
|
|
66
|
+
ip = ip || list[inter].find(function (_ip) {
|
|
67
|
+
return _ip.family === 'IPv6';
|
|
68
|
+
});
|
|
69
|
+
interfaces.push({
|
|
70
|
+
value: inter,
|
|
71
|
+
address: ip.address
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
_this.setState({
|
|
76
|
+
interfaces: interfaces
|
|
77
|
+
});
|
|
78
|
+
})["catch"](function (e) {
|
|
79
|
+
return window.alert("Cannot read interfaces: ".concat(e));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
key: "renderItem",
|
|
84
|
+
value: function renderItem(error, disabled /* , defaultValue */) {
|
|
85
|
+
var _this$state$interface,
|
|
86
|
+
_this$state$interface2,
|
|
87
|
+
_this$state$interface3,
|
|
88
|
+
_this2 = this;
|
|
89
|
+
var value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr);
|
|
90
|
+
var item = (_this$state$interface = this.state.interfaces) === null || _this$state$interface === void 0 ? void 0 : _this$state$interface.find(function (it) {
|
|
91
|
+
return it.value === value;
|
|
92
|
+
});
|
|
93
|
+
return /*#__PURE__*/_react["default"].createElement(_material.FormControl, {
|
|
94
|
+
className: this.props.classes.fullWidth,
|
|
95
|
+
variant: "standard"
|
|
96
|
+
}, (_this$state$interface2 = this.state.interfaces) !== null && _this$state$interface2 !== void 0 && _this$state$interface2.length && this.props.schema.label ? /*#__PURE__*/_react["default"].createElement(_material.InputLabel, null, this.getText(this.props.schema.label)) : null, !((_this$state$interface3 = this.state.interfaces) !== null && _this$state$interface3 !== void 0 && _this$state$interface3.length) ? /*#__PURE__*/_react["default"].createElement(_material.TextField, {
|
|
97
|
+
fullWidth: true,
|
|
98
|
+
variant: "standard",
|
|
99
|
+
error: !!error,
|
|
100
|
+
disabled: !!disabled,
|
|
101
|
+
value: value,
|
|
102
|
+
onChange: function onChange(e) {
|
|
103
|
+
return _this2.onChange(_this2.props.attr, e.target.value);
|
|
104
|
+
},
|
|
105
|
+
label: this.getText(this.props.schema.label)
|
|
106
|
+
}) : /*#__PURE__*/_react["default"].createElement(_material.Select, {
|
|
107
|
+
variant: "standard",
|
|
108
|
+
error: !!error,
|
|
109
|
+
disabled: !!disabled,
|
|
110
|
+
value: value,
|
|
111
|
+
renderValue: function renderValue(val) {
|
|
112
|
+
if (item) {
|
|
113
|
+
return /*#__PURE__*/_react["default"].createElement("span", null, item.value, /*#__PURE__*/_react["default"].createElement("span", {
|
|
114
|
+
className: _this2.props.classes.address
|
|
115
|
+
}, item.address));
|
|
116
|
+
}
|
|
117
|
+
return val;
|
|
118
|
+
},
|
|
119
|
+
onChange: function onChange(e) {
|
|
120
|
+
return _this2.onChange(_this2.props.attr, e.target.value);
|
|
121
|
+
}
|
|
122
|
+
}, this.state.interfaces.map(function (it, i) {
|
|
123
|
+
return /*#__PURE__*/_react["default"].createElement(_material.MenuItem, {
|
|
124
|
+
key: i,
|
|
125
|
+
value: it.value
|
|
126
|
+
}, /*#__PURE__*/_react["default"].createElement("span", null, it.value, /*#__PURE__*/_react["default"].createElement("span", {
|
|
127
|
+
className: _this2.props.classes.address
|
|
128
|
+
}, it.address)));
|
|
129
|
+
})), this.props.schema.help ? /*#__PURE__*/_react["default"].createElement(_material.FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
|
|
130
|
+
}
|
|
131
|
+
}]);
|
|
132
|
+
return ConfigInterface;
|
|
133
|
+
}(_ConfigGeneric2["default"]);
|
|
134
|
+
ConfigInterface.propTypes = {
|
|
135
|
+
socket: _propTypes["default"].object.isRequired,
|
|
136
|
+
themeType: _propTypes["default"].string,
|
|
137
|
+
themeName: _propTypes["default"].string,
|
|
138
|
+
style: _propTypes["default"].object,
|
|
139
|
+
className: _propTypes["default"].string,
|
|
140
|
+
data: _propTypes["default"].object.isRequired,
|
|
141
|
+
schema: _propTypes["default"].object,
|
|
142
|
+
onError: _propTypes["default"].func,
|
|
143
|
+
onChange: _propTypes["default"].func
|
|
144
|
+
};
|
|
145
|
+
var _default = exports["default"] = (0, _styles.withStyles)(styles)(ConfigInterface);
|
|
146
|
+
//# sourceMappingURL=ConfigInterface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigInterface.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","_ConfigGeneric2","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","styles","fullWidth","width","address","fontSize","opacity","marginLeft","ConfigInterface","_ConfigGeneric","_inherits2","_super","_classCallCheck2","_createClass2","key","value","componentDidMount","_this","_get2","props","socket","getObject","concat","common","host","then","obj","_obj$native","interfaces","hardware","networkInterfaces","list","Object","keys","forEach","inter","schema","ignoreInternal","find","_ip","internal","ignoreLoopback","ip","family","push","setState","window","alert","renderItem","error","disabled","_this$state$interface","_this$state$interface2","_this$state$interface3","_this2","ConfigGeneric","getValue","data","attr","item","state","it","createElement","FormControl","className","classes","variant","length","label","InputLabel","getText","TextField","onChange","target","Select","renderValue","val","map","i","MenuItem","help","FormHelperText","renderHelp","helpLink","noTranslation","propTypes","PropTypes","object","isRequired","themeType","string","themeName","style","onError","func","_default","exports","withStyles"],"sources":["JsonConfigComponent/ConfigInterface.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport {\n InputLabel,\n TextField,\n FormHelperText,\n MenuItem,\n FormControl,\n Select,\n} from '@mui/material';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = () => ({\n fullWidth: {\n width: '100%',\n },\n address: {\n fontSize: 'smaller',\n opacity: 0.5,\n marginLeft: 8,\n },\n});\n\nclass ConfigInterface extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n this.props.socket.getObject(`system.host.${this.props.common.host}`)\n .then(obj => {\n const interfaces = [];\n if (obj?.native?.hardware?.networkInterfaces) {\n const list = obj.native.hardware.networkInterfaces;\n Object.keys(list).forEach(inter => {\n if (this.props.schema.ignoreInternal && !list[inter].find(_ip => !_ip.internal)) {\n return;\n }\n if (this.props.schema.ignoreLoopback && list[inter].find(_ip => ip.address === '127.0.0.1' || ip.address === '::1')) {\n return;\n }\n\n // find ipv4 address\n let ip = list[inter].find(_ip => _ip.family === 'IPv4');\n ip = ip || list[inter].find(_ip => _ip.family === 'IPv6');\n interfaces.push({ value: inter, address: ip.address });\n });\n }\n\n this.setState({ interfaces });\n })\n .catch(e => window.alert(`Cannot read interfaces: ${e}`));\n }\n\n renderItem(error, disabled /* , defaultValue */) {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const item = this.state.interfaces?.find(it => it.value === value);\n\n return <FormControl className={this.props.classes.fullWidth} variant=\"standard\">\n {this.state.interfaces?.length && this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n {!this.state.interfaces?.length ?\n <TextField\n fullWidth\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={value}\n onChange={e => this.onChange(this.props.attr, e.target.value)}\n label={this.getText(this.props.schema.label)}\n /> :\n <Select\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={value}\n renderValue={val => {\n if (item) {\n return <span>\n {item.value}\n <span className={this.props.classes.address}>{item.address}</span>\n </span>;\n }\n return val;\n }}\n onChange={e => this.onChange(this.props.attr, e.target.value)}\n >\n {this.state.interfaces.map((it, i) =>\n <MenuItem key={i} value={it.value}>\n <span>\n {it.value}\n <span className={this.props.classes.address}>{it.address}</span>\n </span>\n </MenuItem>)}\n </Select>}\n {this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}\n </FormControl>;\n }\n}\n\nConfigInterface.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigInterface);\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AASA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAA4C,SAAAK,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,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,IAAI;EACvBtB,QAAQ,EAAEc,qBAAS,CAACQ;AACxB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEa,IAAAC,kBAAU,EAAChG,MAAM,CAAC,CAACO,eAAe,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
2
2
|
socket: PropTypes.Validator<object>;
|
|
3
3
|
themeType: PropTypes.Requireable<string>;
|
|
4
|
-
themeName: PropTypes.Requireable<string>;
|
|
5
4
|
style: PropTypes.Requireable<object>;
|
|
6
5
|
className: PropTypes.Requireable<string>;
|
|
7
6
|
data: PropTypes.Validator<object>;
|
|
@@ -16,19 +16,14 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
18
|
var _styles = require("@mui/styles");
|
|
19
|
-
var _FormHelperText = _interopRequireDefault(require("@mui/material/FormHelperText"));
|
|
20
|
-
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
21
19
|
var _material = require("@mui/material");
|
|
22
20
|
var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
|
|
23
21
|
var _i18n = _interopRequireDefault(require("./wrapper/i18n"));
|
|
24
22
|
var _CustomModal = _interopRequireDefault(require("../CustomModal"));
|
|
25
23
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
26
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
27
|
-
// import '
|
|
28
|
-
|
|
29
|
-
// import 'ace-builds/src-min-noconflict/theme-clouds_midnight';
|
|
30
|
-
// import 'ace-builds/src-min-noconflict/theme-chrome';
|
|
31
|
-
// import 'ace-builds/src-min-noconflict/ext-language_tools';
|
|
24
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
25
|
+
// import Editor from '../Editor';
|
|
26
|
+
|
|
32
27
|
var styles = function styles() {
|
|
33
28
|
return {
|
|
34
29
|
fullWidth: {
|
|
@@ -97,7 +92,7 @@ var ConfigJsonEditor = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
97
92
|
var _this$state = this.state,
|
|
98
93
|
value = _this$state.value,
|
|
99
94
|
showSelectId = _this$state.showSelectId;
|
|
100
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
95
|
+
return /*#__PURE__*/_react["default"].createElement(_material.FormControl, {
|
|
101
96
|
className: classes.fullWidth,
|
|
102
97
|
variant: "standard"
|
|
103
98
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -131,7 +126,7 @@ var ConfigJsonEditor = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
131
126
|
}
|
|
132
127
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
133
128
|
className: classes.wrapper
|
|
134
|
-
}, /*#__PURE__*/_react["default"].createElement("div", null, "NOT SUPPORTED"))) : null, schema.help ? /*#__PURE__*/_react["default"].createElement(
|
|
129
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, "NOT SUPPORTED"))) : null, schema.help ? /*#__PURE__*/_react["default"].createElement(_material.FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
|
|
135
130
|
}
|
|
136
131
|
}]);
|
|
137
132
|
return ConfigJsonEditor;
|
|
@@ -139,7 +134,7 @@ var ConfigJsonEditor = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
139
134
|
ConfigJsonEditor.propTypes = {
|
|
140
135
|
socket: _propTypes["default"].object.isRequired,
|
|
141
136
|
themeType: _propTypes["default"].string,
|
|
142
|
-
themeName:
|
|
137
|
+
// themeName: PropTypes.string,
|
|
143
138
|
style: _propTypes["default"].object,
|
|
144
139
|
className: _propTypes["default"].string,
|
|
145
140
|
data: _propTypes["default"].object.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigJsonEditor.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_FormHelperText","_FormControl","_material","_ConfigGeneric2","_i18n","_CustomModal","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","styles","fullWidth","width","flex","display","button","height","minWidth","wrapper","ConfigJsonEditor","_ConfigGeneric","_inherits2","_super","_classCallCheck2","_createClass2","key","value","_componentDidMount","_asyncToGenerator2","_regenerator","mark","_callee","_this$props","data","attr","wrap","_callee$","_context","prev","next","_get2","props","ConfigGeneric","getValue","setState","initialized","stop","componentDidMount","renderItem","_this","state","_this$props2","classes","schema","_this$state","showSelectId","createElement","className","variant","Button","color","size","onClick","I18n","t","title","getText","label","open","overflowHidden","onClose","onApply","onChange","help","renderHelp","helpLink","noTranslation","propTypes","socket","PropTypes","object","isRequired","themeType","string","themeName","style","onError","func","_default","exports","withStyles"],"sources":["JsonConfigComponent/ConfigJsonEditor.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormControl from '@mui/material/FormControl';\nimport { Button } from '@mui/material';\n\n// import AceEditor from 'react-ace';\nimport ConfigGeneric from './ConfigGeneric';\nimport I18n from './wrapper/i18n';\nimport CustomModal from '../CustomModal';\n\n// import 'ace-builds/src-min-noconflict/mode-json';\n// import 'ace-builds/src-min-noconflict/worker-json';\n// import 'ace-builds/src-min-noconflict/theme-clouds_midnight';\n// import 'ace-builds/src-min-noconflict/theme-chrome';\n// import 'ace-builds/src-min-noconflict/ext-language_tools';\n\nconst styles = () => ({\n fullWidth: {\n width: '100%',\n },\n flex: {\n display: 'flex',\n },\n button: {\n height: 48,\n // marginLeft: 4,\n minWidth: 48,\n },\n wrapper: {\n width: 'calc(100vw - 40px)',\n height: 'calc(100vh - 188px)',\n },\n});\n\nclass ConfigJsonEditor extends ConfigGeneric {\n async componentDidMount() {\n super.componentDidMount();\n const { data, attr } = this.props;\n const value = ConfigGeneric.getValue(data, attr) || {};\n this.setState({ value, initialized: true });\n }\n\n renderItem(/* error, disabled, defaultValue */) {\n if (!this.state.initialized) {\n return null;\n }\n\n const {\n classes, schema, data, attr,\n } = this.props;\n const { value, showSelectId } = this.state;\n\n return <FormControl className={classes.fullWidth} variant=\"standard\">\n <div className={classes.flex}>\n <Button\n color=\"grey\"\n className={classes.button}\n size=\"small\"\n variant=\"outlined\"\n onClick={() => this.setState({ showSelectId: true })}\n >\n {I18n.t('ra_JSON editor')}\n </Button>\n </div>\n {showSelectId ? <CustomModal\n title={this.getText(schema.label)}\n open={showSelectId}\n overflowHidden\n onClose={() =>\n this.setState({ showSelectId: false, value: ConfigGeneric.getValue(data, attr) || {} })}\n onApply={() => this.setState({ showSelectId: false }, () => this.onChange(attr, value))}\n >\n <div className={classes.wrapper}>\n {/*<AceEditor\n mode=\"json\"\n theme={this.props.themeName === 'dark' ? 'clouds_midnight' : 'chrome'}\n value={typeof value === 'object' ? JSON.stringify(value) : value}\n width=\"100%\"\n height=\"100%\"\n onChange={newValue => this.setState({ value: newValue })}\n name=\"ConfigJsonEditor\"\n fontSize={14}\n setOptions={{\n enableBasicAutocompletion: true,\n enableLiveAutocompletion: true,\n enableSnippets: true,\n }}\n editorProps={{ $blockScrolling: true }}\n />*/}\n <div>NOT SUPPORTED</div>\n </div>\n </CustomModal> : null}\n {schema.help ? <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText> : null}\n </FormControl>;\n }\n}\n\nConfigJsonEditor.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigJsonEditor);"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAGA,IAAAM,eAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,KAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,YAAA,GAAAT,sBAAA,CAAAC,OAAA;AAAyC,SAAAS,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,aAAAL,OAAA,GAAAM,MAAA,MAAAL,yBAAA,QAAAM,SAAA,OAAAF,gBAAA,mBAAAG,WAAA,EAAAF,MAAA,GAAAG,OAAA,CAAAC,SAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAJ,SAAA,YAAAD,MAAA,GAAAF,KAAA,CAAAQ,KAAA,OAAAD,SAAA,g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CAAChC,KAAK,CAACY,MAAM,CAACsB,QAAQ,EAC1B,IAAI,CAAClC,KAAK,CAACY,MAAM,CAACuB,aACtB,CACY,CAAC,GAAG,IACX,CAAC;IAClB;EAAC;EAAA,OAAAzD,gBAAA;AAAA,EAlE0BuB,0BAAa;AAqE5CvB,gBAAgB,CAAC0D,SAAS,GAAG;EACzBC,MAAM,EAAEC,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnCC,SAAS,EAAEH,qBAAS,CAACI,MAAM;EAC3BC,SAAS,EAAEL,qBAAS,CAACI,MAAM;EAC3BE,KAAK,EAAEN,qBAAS,CAACC,MAAM;EACvBvB,SAAS,EAAEsB,qBAAS,CAACI,MAAM;EAC3BlD,IAAI,EAAE8C,qBAAS,CAACC,MAAM,CAACC,UAAU;EACjC5B,MAAM,EAAE0B,qBAAS,CAACC,MAAM;EACxBM,OAAO,EAAEP,qBAAS,CAACQ,IAAI;EACvBf,QAAQ,EAAEO,qBAAS,CAACQ;AACxB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEa,IAAAC,kBAAU,EAAChF,MAAM,CAAC,CAACS,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"ConfigJsonEditor.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","_ConfigGeneric2","_i18n","_CustomModal","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","styles","fullWidth","width","flex","display","button","height","minWidth","wrapper","ConfigJsonEditor","_ConfigGeneric","_inherits2","_super","_classCallCheck2","_createClass2","key","value","_componentDidMount","_asyncToGenerator2","_regenerator","mark","_callee","_this$props","data","attr","wrap","_callee$","_context","prev","next","_get2","props","ConfigGeneric","getValue","setState","initialized","stop","componentDidMount","renderItem","_this","state","_this$props2","classes","schema","_this$state","showSelectId","createElement","FormControl","className","variant","Button","color","size","onClick","I18n","t","title","getText","label","open","overflowHidden","onClose","onApply","onChange","help","FormHelperText","renderHelp","helpLink","noTranslation","propTypes","socket","PropTypes","object","isRequired","themeType","string","style","onError","func","_default","exports","withStyles"],"sources":["JsonConfigComponent/ConfigJsonEditor.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport {\n FormHelperText,\n FormControl,\n Button,\n} from '@mui/material';\n\nimport ConfigGeneric from './ConfigGeneric';\nimport I18n from './wrapper/i18n';\nimport CustomModal from '../CustomModal';\n// import Editor from '../Editor';\n\nconst styles = () => ({\n fullWidth: {\n width: '100%',\n },\n flex: {\n display: 'flex',\n },\n button: {\n height: 48,\n // marginLeft: 4,\n minWidth: 48,\n },\n wrapper: {\n width: 'calc(100vw - 40px)',\n height: 'calc(100vh - 188px)',\n },\n});\n\nclass ConfigJsonEditor extends ConfigGeneric {\n async componentDidMount() {\n super.componentDidMount();\n const { data, attr } = this.props;\n const value = ConfigGeneric.getValue(data, attr) || {};\n this.setState({ value, initialized: true });\n }\n\n renderItem(/* error, disabled, defaultValue */) {\n if (!this.state.initialized) {\n return null;\n }\n\n const {\n classes, schema, data, attr,\n } = this.props;\n const { value, showSelectId } = this.state;\n\n return <FormControl className={classes.fullWidth} variant=\"standard\">\n <div className={classes.flex}>\n <Button\n color=\"grey\"\n className={classes.button}\n size=\"small\"\n variant=\"outlined\"\n onClick={() => this.setState({ showSelectId: true })}\n >\n {I18n.t('ra_JSON editor')}\n </Button>\n </div>\n {showSelectId ? <CustomModal\n title={this.getText(schema.label)}\n open={showSelectId}\n overflowHidden\n onClose={() =>\n this.setState({ showSelectId: false, value: ConfigGeneric.getValue(data, attr) || {} })}\n onApply={() => this.setState({ showSelectId: false }, () => this.onChange(attr, value))}\n >\n <div className={classes.wrapper}>\n {/*<Editor\n value={typeof value === 'object' ? JSON.stringify(value) : value}\n onChange={newValue => this.setState({ value: newValue })}\n name=\"ConfigJsonEditor\"\n themeType={this.props.themeType}\n />*/}\n <div>NOT SUPPORTED</div>\n </div>\n </CustomModal> : null}\n {schema.help ? <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText> : null}\n </FormControl>;\n }\n}\n\nConfigJsonEditor.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n// themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigJsonEditor);"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AAMA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,YAAA,GAAAP,sBAAA,CAAAC,OAAA;AAAyC,SAAAO,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,aAAAL,OAAA,GAAAM,MAAA,MAAAL,yBAAA,QAAAM,SAAA,OAAAF,gBAAA,mBAAAG,WAAA,EAAAF,MAAA,GAAAG,OAAA,CAAAC,SAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAJ,SAAA,YAAAD,MAAA,GAAAF,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,mBAAAP,MAAA;AAAA,SAAAJ,0BAAA,eAAAO,OAAA,qBAAAA,OAAA,CAAAC,SAAA,oBAAAD,OAAA,CAAAC,SAAA,CAAAI,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAA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SAAS,GAAG;EACzBC,MAAM,EAAEC,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnCC,SAAS,EAAEH,qBAAS,CAACI,MAAM;EAC/B;EACIC,KAAK,EAAEL,qBAAS,CAACC,MAAM;EACvBxB,SAAS,EAAEuB,qBAAS,CAACI,MAAM;EAC3BpD,IAAI,EAAEgD,qBAAS,CAACC,MAAM,CAACC,UAAU;EACjC9B,MAAM,EAAE4B,qBAAS,CAACC,MAAM;EACxBK,OAAO,EAAEN,qBAAS,CAACO,IAAI;EACvBf,QAAQ,EAAEQ,qBAAS,CAACO;AACxB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEa,IAAAC,kBAAU,EAACjF,MAAM,CAAC,CAACS,gBAAgB,CAAC"}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<any>;
|
|
2
|
-
export default _default;
|
|
3
1
|
import React from 'react';
|
|
2
|
+
import type AdminConnection from './wrapper/AdminConnection';
|
|
3
|
+
import { ConfigGenericProps } from './ConfigGeneric';
|
|
4
|
+
interface ConfigNumberProps extends ConfigGenericProps {
|
|
5
|
+
socket: AdminConnection;
|
|
6
|
+
themeType: string;
|
|
7
|
+
themeName: string;
|
|
8
|
+
style: Record<string, any>;
|
|
9
|
+
className: string;
|
|
10
|
+
data: Record<string, any>;
|
|
11
|
+
schema: Record<string, any>;
|
|
12
|
+
onError: () => void;
|
|
13
|
+
onChange: () => void;
|
|
14
|
+
classes: Record<string, any>;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: React.JSXElementConstructor<Omit<ConfigNumberProps, "classes"> & import("@mui/styles").StyledComponentProps<"indeterminate" | "control"> & object>;
|
|
17
|
+
export default _default;
|