@iobroker/adapter-react-v5 2.1.10 → 3.0.1

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 (86) hide show
  1. package/Components/FileBrowser.js +248 -222
  2. package/Components/FileBrowser.js.map +1 -1
  3. package/Components/FileViewer.js +219 -75
  4. package/Components/FileViewer.js.map +1 -1
  5. package/Components/JsonConfigComponent/ChipInput.js +926 -0
  6. package/Components/JsonConfigComponent/ChipInput.js.map +1 -0
  7. package/Components/JsonConfigComponent/ConfigAlive.js +135 -0
  8. package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -0
  9. package/Components/JsonConfigComponent/ConfigAutocomplete.js +204 -0
  10. package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -0
  11. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +311 -0
  12. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -0
  13. package/Components/JsonConfigComponent/ConfigCRON.js +195 -0
  14. package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -0
  15. package/Components/JsonConfigComponent/ConfigCertificateSelect.js +178 -0
  16. package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -0
  17. package/Components/JsonConfigComponent/ConfigCheckbox.js +112 -0
  18. package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -0
  19. package/Components/JsonConfigComponent/ConfigChip.js +149 -0
  20. package/Components/JsonConfigComponent/ConfigChip.js.map +1 -0
  21. package/Components/JsonConfigComponent/ConfigColor.js +156 -0
  22. package/Components/JsonConfigComponent/ConfigColor.js.map +1 -0
  23. package/Components/JsonConfigComponent/ConfigCoordinates.js +165 -0
  24. package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -0
  25. package/Components/JsonConfigComponent/ConfigCustomEasyAccess.js +180 -0
  26. package/Components/JsonConfigComponent/ConfigCustomEasyAccess.js.map +1 -0
  27. package/Components/JsonConfigComponent/ConfigDatePicker.js +117 -0
  28. package/Components/JsonConfigComponent/ConfigDatePicker.js.map +1 -0
  29. package/Components/JsonConfigComponent/ConfigGeneric.js +660 -0
  30. package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -0
  31. package/Components/JsonConfigComponent/ConfigIP.js +151 -0
  32. package/Components/JsonConfigComponent/ConfigIP.js.map +1 -0
  33. package/Components/JsonConfigComponent/ConfigImageUpload.js +215 -0
  34. package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -0
  35. package/Components/JsonConfigComponent/ConfigInstanceSelect.js +197 -0
  36. package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -0
  37. package/Components/JsonConfigComponent/ConfigJsonEditor.js +211 -0
  38. package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -0
  39. package/Components/JsonConfigComponent/ConfigLanguage.js +175 -0
  40. package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -0
  41. package/Components/JsonConfigComponent/ConfigNumber.js +194 -0
  42. package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -0
  43. package/Components/JsonConfigComponent/ConfigObjectId.js +201 -0
  44. package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -0
  45. package/Components/JsonConfigComponent/ConfigPanel.js +421 -0
  46. package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -0
  47. package/Components/JsonConfigComponent/ConfigPassword.js +236 -0
  48. package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -0
  49. package/Components/JsonConfigComponent/ConfigPattern.js +94 -0
  50. package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -0
  51. package/Components/JsonConfigComponent/ConfigSelect.js +163 -0
  52. package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -0
  53. package/Components/JsonConfigComponent/ConfigSelectSendTo.js +258 -0
  54. package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -0
  55. package/Components/JsonConfigComponent/ConfigSendto.js +282 -0
  56. package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -0
  57. package/Components/JsonConfigComponent/ConfigSetState.js +266 -0
  58. package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -0
  59. package/Components/JsonConfigComponent/ConfigStaticDivider.js +88 -0
  60. package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -0
  61. package/Components/JsonConfigComponent/ConfigStaticHeader.js +81 -0
  62. package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -0
  63. package/Components/JsonConfigComponent/ConfigStaticImage.js +88 -0
  64. package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -0
  65. package/Components/JsonConfigComponent/ConfigStaticText.js +104 -0
  66. package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -0
  67. package/Components/JsonConfigComponent/ConfigTable.js +651 -0
  68. package/Components/JsonConfigComponent/ConfigTable.js.map +1 -0
  69. package/Components/JsonConfigComponent/ConfigTabs.js +166 -0
  70. package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -0
  71. package/Components/JsonConfigComponent/ConfigText.js +170 -0
  72. package/Components/JsonConfigComponent/ConfigText.js.map +1 -0
  73. package/Components/JsonConfigComponent/ConfigTextSendTo.js +168 -0
  74. package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -0
  75. package/Components/JsonConfigComponent/ConfigTimePicker.js +111 -0
  76. package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -0
  77. package/Components/JsonConfigComponent/ConfigTopic.js +140 -0
  78. package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -0
  79. package/Components/JsonConfigComponent/ConfigUser.js +176 -0
  80. package/Components/JsonConfigComponent/ConfigUser.js.map +1 -0
  81. package/Components/JsonConfigComponent/index.js +511 -0
  82. package/Components/JsonConfigComponent/index.js.map +1 -0
  83. package/Components/Utils.js +25 -0
  84. package/Components/Utils.js.map +1 -1
  85. package/README.md +7 -1
  86. package/package.json +1 -1
@@ -0,0 +1,311 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
+
14
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
15
+
16
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
+
18
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
+
20
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
21
+
22
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
+
24
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
25
+
26
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
27
+
28
+ var _react = _interopRequireDefault(require("react"));
29
+
30
+ var _propTypes = _interopRequireDefault(require("prop-types"));
31
+
32
+ var _styles = require("@mui/styles");
33
+
34
+ var _material = require("@mui/material");
35
+
36
+ var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
37
+
38
+ 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); }; }
39
+
40
+ 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; } }
41
+
42
+ var styles = function styles(theme) {
43
+ return {
44
+ fullWidth: {
45
+ width: '100%'
46
+ }
47
+ };
48
+ };
49
+
50
+ var ConfigAutocompleteSendTo = /*#__PURE__*/function (_ConfigGeneric) {
51
+ (0, _inherits2["default"])(ConfigAutocompleteSendTo, _ConfigGeneric);
52
+
53
+ var _super = _createSuper(ConfigAutocompleteSendTo);
54
+
55
+ function ConfigAutocompleteSendTo() {
56
+ (0, _classCallCheck2["default"])(this, ConfigAutocompleteSendTo);
57
+ return _super.apply(this, arguments);
58
+ }
59
+
60
+ (0, _createClass2["default"])(ConfigAutocompleteSendTo, [{
61
+ key: "componentDidMount",
62
+ value: function componentDidMount() {
63
+ (0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigAutocompleteSendTo.prototype), "componentDidMount", this).call(this);
64
+ this.askInstance();
65
+ }
66
+ }, {
67
+ key: "askInstance",
68
+ value: function askInstance() {
69
+ var _this = this;
70
+
71
+ var value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr);
72
+
73
+ var selectOptions = this.props.schema.options ? this.props.schema.options.map(function (item) {
74
+ return typeof item === 'string' ? {
75
+ label: item,
76
+ value: item
77
+ } : JSON.parse(JSON.stringify(item));
78
+ }) : [];
79
+
80
+ if (this.props.alive) {
81
+ var data = this.props.schema.data;
82
+
83
+ if (data === undefined && this.props.schema.jsonData) {
84
+ data = this.getPattern(this.props.schema.jsonData);
85
+
86
+ try {
87
+ data = JSON.parse(data);
88
+ } catch (e) {
89
+ console.error('Cannot parse json data: ' + data);
90
+ }
91
+ }
92
+
93
+ if (data === undefined) {
94
+ data = null;
95
+ }
96
+
97
+ this.props.socket.sendTo(this.props.adapterName + '.' + this.props.instance, this.props.schema.command || 'send', data).then(function (list) {
98
+ if (list && Array.isArray(list)) {
99
+ list.forEach(function (item) {
100
+ return selectOptions.push(typeof item === 'string' ? {
101
+ label: item,
102
+ value: item
103
+ } : JSON.parse(JSON.stringify(item)));
104
+ });
105
+ } // if __different
106
+
107
+
108
+ if (Array.isArray(value)) {
109
+ selectOptions.unshift({
110
+ label: _ConfigGeneric2["default"].DIFFERENT_LABEL,
111
+ value: _ConfigGeneric2["default"].DIFFERENT_VALUE
112
+ });
113
+
114
+ _this.setState({
115
+ value: _ConfigGeneric2["default"].DIFFERENT_VALUE,
116
+ selectOptions: selectOptions,
117
+ context: _this.getContext()
118
+ });
119
+ } else {
120
+ _this.setState({
121
+ value: value,
122
+ selectOptions: selectOptions,
123
+ context: _this.getContext()
124
+ });
125
+ }
126
+ });
127
+ } else {
128
+ // if __different
129
+ if (Array.isArray(value)) {
130
+ selectOptions.unshift({
131
+ label: _ConfigGeneric2["default"].DIFFERENT_LABEL,
132
+ value: _ConfigGeneric2["default"].DIFFERENT_VALUE
133
+ });
134
+ this.setState({
135
+ value: _ConfigGeneric2["default"].DIFFERENT_VALUE,
136
+ selectOptions: selectOptions
137
+ });
138
+ } else {
139
+ this.setState({
140
+ value: value,
141
+ selectOptions: selectOptions
142
+ });
143
+ }
144
+ }
145
+ }
146
+ }, {
147
+ key: "getContext",
148
+ value: function getContext() {
149
+ var _this2 = this;
150
+
151
+ var context = {};
152
+
153
+ if (Array.isArray(this.props.schema.alsoDependsOn)) {
154
+ this.props.schema.alsoDependsOn.forEach(function (attr) {
155
+ return context[attr] = _ConfigGeneric2["default"].getValue(_this2.props.data, attr);
156
+ });
157
+ }
158
+
159
+ return JSON.stringify(context);
160
+ }
161
+ }, {
162
+ key: "renderItem",
163
+ value: function renderItem(error, disabled, defaultValue) {
164
+ var _this3 = this;
165
+
166
+ if (!this.state.selectOptions) {
167
+ return null;
168
+ }
169
+
170
+ if (this.props.alive) {
171
+ var context = this.getContext();
172
+
173
+ if (context !== this.state.context) {
174
+ setTimeout(function () {
175
+ return _this3.askInstance();
176
+ }, 300);
177
+ }
178
+ }
179
+
180
+ var item;
181
+ var options = JSON.parse(JSON.stringify(this.state.selectOptions));
182
+
183
+ var isIndeterminate = Array.isArray(this.state.value) || this.state.value === _ConfigGeneric2["default"].DIFFERENT_LABEL;
184
+
185
+ if (isIndeterminate) {
186
+ (0, _toConsumableArray2["default"])(this.state.value).filter(function (val) {
187
+ return !options.find(function (it) {
188
+ return it.value === val;
189
+ });
190
+ }).forEach(function (item) {
191
+ return options.push({
192
+ label: item.toString(),
193
+ value: item
194
+ });
195
+ });
196
+ item = {
197
+ label: _ConfigGeneric2["default"].DIFFERENT_LABEL,
198
+ value: _ConfigGeneric2["default"].DIFFERENT_VALUE
199
+ };
200
+ options.unshift(item);
201
+ } else {
202
+ item = this.state.value !== null && this.state.value !== undefined && //eslint-disable-next-line
203
+ options.find(function (item) {
204
+ return item.value == _this3.state.value;
205
+ }); // let "==" be and not ===
206
+
207
+ if (this.state.value !== null && this.state.value !== undefined && !item) {
208
+ item = {
209
+ value: this.state.value,
210
+ label: this.state.value
211
+ };
212
+ options.push(item);
213
+ }
214
+
215
+ item = item || null;
216
+ }
217
+
218
+ if (!options.length) {
219
+ return /*#__PURE__*/_react["default"].createElement(_material.TextField, {
220
+ variant: "standard",
221
+ fullWidth: true,
222
+ value: this.state.value === null || this.state.value === undefined ? '' : this.state.value,
223
+ error: !!error,
224
+ disabled: !!disabled,
225
+ inputProps: {
226
+ maxLength: this.props.schema.maxLength || this.props.schema.max || undefined
227
+ },
228
+ onChange: function onChange(e) {
229
+ var value = e.target.value;
230
+
231
+ _this3.setState({
232
+ value: value
233
+ }, function () {
234
+ return _this3.onChange(_this3.props.attr, (value || '').trim());
235
+ });
236
+ },
237
+ placeholder: this.getText(this.props.schema.placeholder),
238
+ label: this.getText(this.props.schema.label),
239
+ helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)
240
+ });
241
+ } else {
242
+ return /*#__PURE__*/_react["default"].createElement(_material.Autocomplete, {
243
+ value: item,
244
+ fullWidth: true,
245
+ freeSolo: !!this.props.schema.freeSolo,
246
+ options: options // autoComplete
247
+ ,
248
+ getOptionLabel: function getOptionLabel(option) {
249
+ return option && option.label || '';
250
+ },
251
+ className: this.props.classes.indeterminate,
252
+ onInputChange: function onInputChange(e) {
253
+ if (e) {
254
+ var val = e.target.value;
255
+
256
+ if (val !== _this3.state.value) {
257
+ _this3.setState({
258
+ value: val
259
+ }, function () {
260
+ return _this3.onChange(_this3.props.attr, val);
261
+ });
262
+ }
263
+ }
264
+ },
265
+ onChange: function onChange(_, value) {
266
+ var val = (0, _typeof2["default"])(value) === 'object' ? value ? value.value : '' : value;
267
+
268
+ if (val !== _this3.state.value) {
269
+ _this3.setState({
270
+ value: val
271
+ }, function () {
272
+ return _this3.onChange(_this3.props.attr, val);
273
+ });
274
+ }
275
+ },
276
+ renderInput: function renderInput(params) {
277
+ return /*#__PURE__*/_react["default"].createElement(_material.TextField, (0, _extends2["default"])({
278
+ variant: "standard"
279
+ }, params, {
280
+ // inputProps are important and will be given in params
281
+ // inputProps={{maxLength: this.props.schema.maxLength || this.props.schema.max || undefined}}
282
+ error: !!error,
283
+ placeholder: _this3.getText(_this3.props.schema.placeholder),
284
+ label: _this3.getText(_this3.props.schema.label),
285
+ helperText: _this3.renderHelp(_this3.props.schema.help, _this3.props.schema.helpLink, _this3.props.schema.noTranslation),
286
+ disabled: !!disabled
287
+ }));
288
+ }
289
+ });
290
+ }
291
+ }
292
+ }]);
293
+ return ConfigAutocompleteSendTo;
294
+ }(_ConfigGeneric2["default"]);
295
+
296
+ ConfigAutocompleteSendTo.propTypes = {
297
+ socket: _propTypes["default"].object.isRequired,
298
+ themeType: _propTypes["default"].string,
299
+ themeName: _propTypes["default"].string,
300
+ style: _propTypes["default"].object,
301
+ className: _propTypes["default"].string,
302
+ data: _propTypes["default"].object.isRequired,
303
+ schema: _propTypes["default"].object,
304
+ onError: _propTypes["default"].func,
305
+ onChange: _propTypes["default"].func
306
+ };
307
+
308
+ var _default = (0, _styles.withStyles)(styles)(ConfigAutocompleteSendTo);
309
+
310
+ exports["default"] = _default;
311
+ //# sourceMappingURL=ConfigAutocompleteSendTo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigAutocompleteSendTo.js","names":["styles","theme","fullWidth","width","ConfigAutocompleteSendTo","askInstance","value","ConfigGeneric","getValue","props","data","attr","selectOptions","schema","options","map","item","label","JSON","parse","stringify","alive","undefined","jsonData","getPattern","e","console","error","socket","sendTo","adapterName","instance","command","then","list","Array","isArray","forEach","push","unshift","DIFFERENT_LABEL","DIFFERENT_VALUE","setState","context","getContext","alsoDependsOn","disabled","defaultValue","state","setTimeout","isIndeterminate","filter","val","find","it","toString","length","maxLength","max","target","onChange","trim","getText","placeholder","renderHelp","help","helpLink","noTranslation","freeSolo","option","classes","indeterminate","_","params","propTypes","PropTypes","object","isRequired","themeType","string","themeName","style","className","onError","func","withStyles"],"sources":["JsonConfigComponent/ConfigAutocompleteSendTo.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport { Autocomplete, TextField } from '@mui/material';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = theme => ({\n fullWidth: {\n width: '100%'\n }\n});\n\nclass ConfigAutocompleteSendTo extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n\n this.askInstance();\n }\n\n askInstance() {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const selectOptions = this.props.schema.options ?\n this.props.schema.options.map(item => typeof item === 'string' ? {label: item, value: item} : JSON.parse(JSON.stringify(item)))\n :\n [];\n\n if (this.props.alive) {\n let data = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n data = this.getPattern(this.props.schema.jsonData);\n try {\n data = JSON.parse(data);\n } catch (e) {\n console.error('Cannot parse json data: ' + data);\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n\n this.props.socket.sendTo(this.props.adapterName + '.' + this.props.instance, this.props.schema.command || 'send', data)\n .then(list => {\n if (list && Array.isArray(list)) {\n list.forEach(item =>\n selectOptions.push(typeof item === 'string' ? {label: item, value: item} : JSON.parse(JSON.stringify(item))));\n }\n\n // if __different\n if (Array.isArray(value)) {\n selectOptions.unshift({label: ConfigGeneric.DIFFERENT_LABEL, value: ConfigGeneric.DIFFERENT_VALUE});\n this.setState({value: ConfigGeneric.DIFFERENT_VALUE, selectOptions, context: this.getContext()});\n } else {\n this.setState({value, selectOptions, context: this.getContext()});\n }\n });\n } else {\n // if __different\n if (Array.isArray(value)) {\n selectOptions.unshift({label: ConfigGeneric.DIFFERENT_LABEL, value: ConfigGeneric.DIFFERENT_VALUE});\n this.setState({value: ConfigGeneric.DIFFERENT_VALUE, selectOptions});\n } else {\n this.setState({value, selectOptions});\n }\n }\n }\n\n getContext() {\n const context = {};\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(attr =>\n context[attr] = ConfigGeneric.getValue(this.props.data, attr));\n }\n return JSON.stringify(context);\n }\n\n renderItem(error, disabled, defaultValue) {\n if (!this.state.selectOptions) {\n return null;\n }\n\n if (this.props.alive) {\n const context = this.getContext();\n if (context !== this.state.context) {\n setTimeout(() => this.askInstance(), 300);\n }\n }\n\n let item;\n let options = JSON.parse(JSON.stringify(this.state.selectOptions));\n let isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric.DIFFERENT_LABEL;\n\n if (isIndeterminate) {\n [...this.state.value]\n .filter(val => !options.find(it => it.value === val))\n .forEach(item => options.push({label: item.toString(), value: item}));\n\n item = {label: ConfigGeneric.DIFFERENT_LABEL, value: ConfigGeneric.DIFFERENT_VALUE};\n options.unshift(item);\n } else {\n item = this.state.value !== null && this.state.value !== undefined &&\n //eslint-disable-next-line\n options.find(item => item.value == this.state.value); // let \"==\" be and not ===\n\n if (this.state.value !== null && this.state.value !== undefined && !item) {\n item = {value: this.state.value, label: this.state.value};\n options.push(item);\n }\n item = item || null;\n }\n\n if (!options.length) {\n return <TextField\n variant=\"standard\"\n fullWidth\n value={this.state.value === null || this.state.value === undefined ? '' : this.state.value}\n error={!!error}\n disabled={!!disabled}\n inputProps={{maxLength: this.props.schema.maxLength || this.props.schema.max || undefined}}\n onChange={e => {\n const value = e.target.value;\n this.setState({value}, () =>\n this.onChange(this.props.attr, (value || '').trim()));\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}\n />;\n } else {\n return <Autocomplete\n value={item}\n fullWidth\n freeSolo={!!this.props.schema.freeSolo}\n options={options}\n // autoComplete\n getOptionLabel={option => (option && option.label) || ''}\n className={this.props.classes.indeterminate}\n onInputChange={e => {\n if (e) {\n const val = e.target.value;\n if (val !== this.state.value) {\n this.setState({value: val}, () => this.onChange(this.props.attr, val));\n }\n }\n }}\n onChange={(_, value) => {\n const val = typeof value === 'object' ? (value ? value.value : '') : value;\n if (val !== this.state.value) {\n this.setState({value: val}, () => this.onChange(this.props.attr, val));\n }\n }}\n renderInput={(params) =>\n <TextField\n variant=\"standard\"\n {...params}\n // inputProps are important and will be given in params\n // inputProps={{maxLength: this.props.schema.maxLength || this.props.schema.max || undefined}}\n error={!!error}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}\n disabled={!!disabled}\n />}\n />;\n }\n }\n}\n\nConfigAutocompleteSendTo.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)(ConfigAutocompleteSendTo);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAEA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,SAAS,EAAE;MACPC,KAAK,EAAE;IADA;EADU,CAAL;AAAA,CAApB;;IAMMC,wB;;;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ault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
+
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
18
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
19
+
20
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
+
22
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
+
24
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
+
26
+ var _react = _interopRequireDefault(require("react"));
27
+
28
+ var _propTypes = _interopRequireDefault(require("prop-types"));
29
+
30
+ var _styles = require("@mui/styles");
31
+
32
+ var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
33
+
34
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
35
+
36
+ var _material = require("@mui/material");
37
+
38
+ var _Cron = _interopRequireDefault(require("@iobroker/adapter-react-v5/Dialogs/Cron"));
39
+
40
+ var _i18n = _interopRequireDefault(require("@iobroker/adapter-react-v5/i18n"));
41
+
42
+ var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
43
+
44
+ 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); }; }
45
+
46
+ 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; } }
47
+
48
+ var styles = function styles(theme) {
49
+ return {
50
+ fullWidth: {
51
+ width: '100%'
52
+ },
53
+ flex: {
54
+ display: 'flex'
55
+ },
56
+ button: {
57
+ height: 48,
58
+ marginLeft: 4,
59
+ minWidth: 48
60
+ }
61
+ };
62
+ };
63
+
64
+ var ConfigCRON = /*#__PURE__*/function (_ConfigGeneric) {
65
+ (0, _inherits2["default"])(ConfigCRON, _ConfigGeneric);
66
+
67
+ var _super = _createSuper(ConfigCRON);
68
+
69
+ function ConfigCRON() {
70
+ (0, _classCallCheck2["default"])(this, ConfigCRON);
71
+ return _super.apply(this, arguments);
72
+ }
73
+
74
+ (0, _createClass2["default"])(ConfigCRON, [{
75
+ key: "componentDidMount",
76
+ value: function () {
77
+ var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
78
+ var _this$props, data, attr, value;
79
+
80
+ return _regenerator["default"].wrap(function _callee$(_context) {
81
+ while (1) {
82
+ switch (_context.prev = _context.next) {
83
+ case 0:
84
+ (0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigCRON.prototype), "componentDidMount", this).call(this);
85
+ _this$props = this.props, data = _this$props.data, attr = _this$props.attr;
86
+ value = _ConfigGeneric2["default"].getValue(data, attr) || '';
87
+ this.setState({
88
+ value: value
89
+ });
90
+
91
+ case 4:
92
+ case "end":
93
+ return _context.stop();
94
+ }
95
+ }
96
+ }, _callee, this);
97
+ }));
98
+
99
+ function componentDidMount() {
100
+ return _componentDidMount.apply(this, arguments);
101
+ }
102
+
103
+ return componentDidMount;
104
+ }()
105
+ }, {
106
+ key: "renderItem",
107
+ value: function renderItem(error, disabled, defaultValue) {
108
+ var _this = this;
109
+
110
+ var _this$props2 = this.props,
111
+ classes = _this$props2.classes,
112
+ schema = _this$props2.schema,
113
+ attr = _this$props2.attr;
114
+ var _this$state = this.state,
115
+ value = _this$state.value,
116
+ showDialog = _this$state.showDialog;
117
+ return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
118
+ className: classes.fullWidth,
119
+ variant: "standard"
120
+ }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
121
+ shrink: true
122
+ }, this.getText(schema.label)), /*#__PURE__*/_react["default"].createElement("div", {
123
+ className: classes.flex
124
+ }, /*#__PURE__*/_react["default"].createElement(_material.TextField, {
125
+ variant: "standard",
126
+ fullWidth: true,
127
+ value: value,
128
+ error: !!error,
129
+ disabled: disabled,
130
+ placeholder: this.getText(schema.placeholder),
131
+ label: this.getText(schema.label),
132
+ helperText: this.renderHelp(schema.help, schema.helpLink, schema.noTranslation),
133
+ onChange: function onChange(e) {
134
+ var value = e.target.value;
135
+
136
+ _this.setState({
137
+ value: value
138
+ }, function () {
139
+ return _this.onChange(attr, value);
140
+ });
141
+ }
142
+ }), /*#__PURE__*/_react["default"].createElement(_material.Button, {
143
+ color: "grey",
144
+ className: this.props.classes.button,
145
+ size: "small",
146
+ variant: "outlined",
147
+ onClick: function onClick() {
148
+ return _this.setState({
149
+ showDialog: true
150
+ });
151
+ }
152
+ }, "...")), showDialog ? /*#__PURE__*/_react["default"].createElement(_Cron["default"], {
153
+ title: _i18n["default"].t('Define schedule'),
154
+ simple: schema.simple,
155
+ complex: schema.complex,
156
+ cron: value,
157
+ language: _i18n["default"].getLanguage(),
158
+ onClose: function onClose() {
159
+ return _this.setState({
160
+ showDialog: false
161
+ });
162
+ },
163
+ cancel: _i18n["default"].t('Cancel'),
164
+ ok: _i18n["default"].t('Ok'),
165
+ onOk: function onOk(value) {
166
+ return _this.setState({
167
+ showDialog: false,
168
+ value: value
169
+ }, function () {
170
+ return _this.onChange(attr, value);
171
+ });
172
+ }
173
+ }) : null);
174
+ }
175
+ }]);
176
+ return ConfigCRON;
177
+ }(_ConfigGeneric2["default"]);
178
+
179
+ ConfigCRON.propTypes = {
180
+ themeType: _propTypes["default"].string,
181
+ themeName: _propTypes["default"].string,
182
+ style: _propTypes["default"].object,
183
+ className: _propTypes["default"].string,
184
+ data: _propTypes["default"].object.isRequired,
185
+ schema: _propTypes["default"].object,
186
+ onError: _propTypes["default"].func,
187
+ onChange: _propTypes["default"].func,
188
+ dateFormat: _propTypes["default"].string,
189
+ isFloatComma: _propTypes["default"].bool
190
+ };
191
+
192
+ var _default = (0, _styles.withStyles)(styles)(ConfigCRON);
193
+
194
+ exports["default"] = _default;
195
+ //# sourceMappingURL=ConfigCRON.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigCRON.js","names":["styles","theme","fullWidth","width","flex","display","button","height","marginLeft","minWidth","ConfigCRON","props","data","attr","value","ConfigGeneric","getValue","setState","error","disabled","defaultValue","classes","schema","state","showDialog","getText","label","placeholder","renderHelp","help","helpLink","noTranslation","e","target","onChange","I18n","t","simple","complex","getLanguage","propTypes","themeType","PropTypes","string","themeName","style","object","className","isRequired","onError","func","dateFormat","isFloatComma","bool","withStyles"],"sources":["JsonConfigComponent/ConfigCRON.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport InputLabel from '@mui/material/InputLabel';\nimport FormControl from '@mui/material/FormControl';\nimport { Button, TextField } from '@mui/material';\n\nimport DialogCron from '@iobroker/adapter-react-v5/Dialogs/Cron';\nimport I18n from '@iobroker/adapter-react-v5/i18n';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = theme => ({\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});\n\nclass ConfigCRON 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});\n }\n\n renderItem(error, disabled, defaultValue) {\n const { classes, schema, attr } = this.props;\n const { value, showDialog } = this.state;\n\n return <FormControl className={classes.fullWidth} variant=\"standard\">\n <InputLabel shrink>{this.getText(schema.label)}</InputLabel>\n <div className={classes.flex}>\n <TextField\n variant=\"standard\"\n fullWidth\n value={value}\n error={!!error}\n disabled={disabled}\n placeholder={this.getText(schema.placeholder)}\n label={this.getText(schema.label)}\n helperText={this.renderHelp(schema.help, schema.helpLink, schema.noTranslation)}\n onChange={e => {\n const value = e.target.value;\n this.setState({ value }, () =>\n this.onChange(attr, value))\n }}\n />\n <Button\n color=\"grey\"\n className={this.props.classes.button}\n size=\"small\"\n variant=\"outlined\"\n onClick={() => this.setState({ showDialog: true })}\n >...</Button>\n </div>\n {showDialog ? <DialogCron\n title={I18n.t('Define schedule')}\n simple={schema.simple}\n complex={schema.complex}\n cron={value}\n language={I18n.getLanguage()}\n onClose={() => this.setState({ showDialog: false })}\n cancel={I18n.t('Cancel')}\n ok={I18n.t('Ok')}\n onOk={value =>\n this.setState({ showDialog: false, value }, () =>\n this.onChange(attr, value))}\n /> : null}\n </FormControl>;\n }\n}\n\nConfigCRON.propTypes = {\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 dateFormat: PropTypes.string,\n isFloatComma: PropTypes.bool,\n};\n\nexport default withStyles(styles)(ConfigCRON);"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,SAAS,EAAE;MACPC,KAAK,EAAE;IADA,CADU;IAIrBC,IAAI,EAAE;MACFC,OAAO,EAAE;IADP,CAJe;IAOrBC,MAAM,EAAE;MACJC,MAAM,EAAE,EADJ;MAEJC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