@iobroker/adapter-react-v5 4.3.2 → 4.4.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.
Files changed (120) hide show
  1. package/Components/JsonConfigComponent/ChipInput.d.ts +3 -4
  2. package/Components/JsonConfigComponent/ChipInput.js +57 -67
  3. package/Components/JsonConfigComponent/ChipInput.js.map +1 -1
  4. package/Components/JsonConfigComponent/ConfigAccordion.js +14 -17
  5. package/Components/JsonConfigComponent/ConfigAccordion.js.map +1 -1
  6. package/Components/JsonConfigComponent/ConfigAlive.js +4 -4
  7. package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -1
  8. package/Components/JsonConfigComponent/ConfigAutocomplete.js +5 -5
  9. package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
  10. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +61 -64
  11. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
  12. package/Components/JsonConfigComponent/ConfigCRON.js +8 -8
  13. package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -1
  14. package/Components/JsonConfigComponent/ConfigCertCollection.js +1 -1
  15. package/Components/JsonConfigComponent/ConfigCertCollection.js.map +1 -1
  16. package/Components/JsonConfigComponent/ConfigCertificateSelect.js +18 -22
  17. package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
  18. package/Components/JsonConfigComponent/ConfigCertificates.js +20 -23
  19. package/Components/JsonConfigComponent/ConfigCertificates.js.map +1 -1
  20. package/Components/JsonConfigComponent/ConfigCheckLicense.js +224 -126
  21. package/Components/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
  22. package/Components/JsonConfigComponent/ConfigCheckbox.js +7 -10
  23. package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
  24. package/Components/JsonConfigComponent/ConfigChip.js +7 -8
  25. package/Components/JsonConfigComponent/ConfigChip.js.map +1 -1
  26. package/Components/JsonConfigComponent/ConfigColor.d.ts +20 -13
  27. package/Components/JsonConfigComponent/ConfigColor.js +12 -16
  28. package/Components/JsonConfigComponent/ConfigColor.js.map +1 -1
  29. package/Components/JsonConfigComponent/ConfigCoordinates.js +13 -17
  30. package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
  31. package/Components/JsonConfigComponent/ConfigCustom.js +48 -45
  32. package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
  33. package/Components/JsonConfigComponent/ConfigDatePicker.js +2 -2
  34. package/Components/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
  35. package/Components/JsonConfigComponent/ConfigFile.js +39 -36
  36. package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
  37. package/Components/JsonConfigComponent/ConfigFileSelector.js +96 -94
  38. package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
  39. package/Components/JsonConfigComponent/ConfigFunc.js +10 -10
  40. package/Components/JsonConfigComponent/ConfigFunc.js.map +1 -1
  41. package/Components/JsonConfigComponent/ConfigGeneric.d.ts +2 -2
  42. package/Components/JsonConfigComponent/ConfigGeneric.js +240 -243
  43. package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
  44. package/Components/JsonConfigComponent/ConfigIP.js +6 -6
  45. package/Components/JsonConfigComponent/ConfigIP.js.map +1 -1
  46. package/Components/JsonConfigComponent/ConfigImageSendTo.js +2 -1
  47. package/Components/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
  48. package/Components/JsonConfigComponent/ConfigImageUpload.js +5 -5
  49. package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
  50. package/Components/JsonConfigComponent/ConfigInstanceSelect.js +14 -14
  51. package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
  52. package/Components/JsonConfigComponent/ConfigJsonEditor.js +3 -3
  53. package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
  54. package/Components/JsonConfigComponent/ConfigLanguage.js +7 -7
  55. package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
  56. package/Components/JsonConfigComponent/ConfigLicense.d.ts +1 -1
  57. package/Components/JsonConfigComponent/ConfigLicense.js +2 -1
  58. package/Components/JsonConfigComponent/ConfigLicense.js.map +1 -1
  59. package/Components/JsonConfigComponent/ConfigNumber.js +55 -56
  60. package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
  61. package/Components/JsonConfigComponent/ConfigObjectId.js +7 -7
  62. package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
  63. package/Components/JsonConfigComponent/ConfigPanel.js +72 -69
  64. package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
  65. package/Components/JsonConfigComponent/ConfigPassword.js +8 -5
  66. package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -1
  67. package/Components/JsonConfigComponent/ConfigPattern.js +1 -1
  68. package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
  69. package/Components/JsonConfigComponent/ConfigPort.js +6 -7
  70. package/Components/JsonConfigComponent/ConfigPort.js.map +1 -1
  71. package/Components/JsonConfigComponent/ConfigRoom.js +10 -10
  72. package/Components/JsonConfigComponent/ConfigRoom.js.map +1 -1
  73. package/Components/JsonConfigComponent/ConfigSelect.js +12 -12
  74. package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
  75. package/Components/JsonConfigComponent/ConfigSelectSendTo.js +95 -106
  76. package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
  77. package/Components/JsonConfigComponent/ConfigSendto.js +26 -19
  78. package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
  79. package/Components/JsonConfigComponent/ConfigSetState.js +13 -31
  80. package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
  81. package/Components/JsonConfigComponent/ConfigSlider.js +2 -3
  82. package/Components/JsonConfigComponent/ConfigSlider.js.map +1 -1
  83. package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
  84. package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
  85. package/Components/JsonConfigComponent/ConfigStaticImage.js +5 -3
  86. package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
  87. package/Components/JsonConfigComponent/ConfigStaticText.js +12 -13
  88. package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -1
  89. package/Components/JsonConfigComponent/ConfigTable.js +24 -25
  90. package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
  91. package/Components/JsonConfigComponent/ConfigTabs.js +3 -3
  92. package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -1
  93. package/Components/JsonConfigComponent/ConfigText.js +61 -64
  94. package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
  95. package/Components/JsonConfigComponent/ConfigTextSendTo.js +5 -5
  96. package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
  97. package/Components/JsonConfigComponent/ConfigTimePicker.js +3 -3
  98. package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
  99. package/Components/JsonConfigComponent/ConfigTopic.js +3 -3
  100. package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -1
  101. package/Components/JsonConfigComponent/ConfigUUID.js +3 -1
  102. package/Components/JsonConfigComponent/ConfigUUID.js.map +1 -1
  103. package/Components/JsonConfigComponent/ConfigUser.js +1 -1
  104. package/Components/JsonConfigComponent/ConfigUser.js.map +1 -1
  105. package/Components/JsonConfigComponent/index.d.ts +0 -2
  106. package/Components/JsonConfigComponent/index.js +39 -45
  107. package/Components/JsonConfigComponent/index.js.map +1 -1
  108. package/README.md +4 -1
  109. package/i18n/de.json +7 -1
  110. package/i18n/en.json +7 -1
  111. package/i18n/es.json +7 -1
  112. package/i18n/fr.json +7 -1
  113. package/i18n/it.json +7 -1
  114. package/i18n/nl.json +7 -1
  115. package/i18n/pl.json +7 -1
  116. package/i18n/pt.json +7 -1
  117. package/i18n/ru.json +7 -1
  118. package/i18n/uk.json +7 -1
  119. package/i18n/zh-cn.json +7 -1
  120. package/package.json +4 -4
@@ -27,6 +27,8 @@ var _Utils = _interopRequireDefault(require("./wrapper/Components/Utils"));
27
27
  var _Confirm = _interopRequireDefault(require("./wrapper/Dialogs/Confirm"));
28
28
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
29
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
30
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
30
32
  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); }; }
31
33
  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; } }
32
34
  var ConfigGeneric = /*#__PURE__*/function (_Component) {
@@ -80,7 +82,7 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
80
82
  return _this2.props.forceUpdate([_this2.props.attr], _this2.props.data);
81
83
  }, 100);
82
84
  });
83
- //this.onChange(this.props.attr, this.defaultValue);
85
+ // this.onChange(this.props.attr, this.defaultValue);
84
86
  } else {
85
87
  ConfigGeneric.setValue(_this2.props.data, _this2.props.attr, _this2.defaultValue);
86
88
  _this2.props.onChange(_this2.props.data, undefined, function () {
@@ -105,7 +107,7 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
105
107
  try {
106
108
  data = JSON.parse(data);
107
109
  } catch (e) {
108
- console.error('Cannot parse json data: ' + data);
110
+ console.error("Cannot parse json data: ".concat(data));
109
111
  }
110
112
  } else {
111
113
  data = {
@@ -122,7 +124,7 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
122
124
  _this3.props.onChange(_this3.props.attr, value, function () {
123
125
  return _this3.props.forceUpdate([_this3.props.attr], _this3.props.data);
124
126
  });
125
- //this.onChange(this.props.attr, this.defaultValue);
127
+ // this.onChange(this.props.attr, this.defaultValue);
126
128
  } else {
127
129
  ConfigGeneric.setValue(_this3.props.data, _this3.props.attr, value);
128
130
  _this3.props.onChange(_this3.props.data, undefined, function () {
@@ -156,21 +158,20 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
156
158
  text = noTranslation ? text : _i18n["default"].t(text);
157
159
  if (text.includes('${')) {
158
160
  return this.getPattern(text);
159
- } else {
160
- return text;
161
161
  }
162
- } else if (text && (0, _typeof2["default"])(text) === 'object') {
162
+ return text;
163
+ }
164
+ if (text && (0, _typeof2["default"])(text) === 'object') {
163
165
  if (text.func) {
164
166
  // calculate pattern
165
167
  if ((0, _typeof2["default"])(text.func) === 'object') {
166
168
  return this.getPattern(text.func[this.lang] || text.func.en || '');
167
- } else {
168
- this.getPattern(text.func);
169
169
  }
170
- } else {
171
- return text[this.lang] || text.en || '';
170
+ return this.getPattern(text.func);
172
171
  }
172
+ return text[this.lang] || text.en || '';
173
173
  }
174
+ return text.toString();
174
175
  }
175
176
  }, {
176
177
  key: "renderConfirmDialog",
@@ -210,6 +211,7 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
210
211
  confirmDepNewValue: null,
211
212
  confirmNewValue: null,
212
213
  confirmAttr: null,
214
+ // eslint-disable-next-line react/no-unused-state
213
215
  confirmOldValue: null,
214
216
  confirmData: null
215
217
  }, function () {
@@ -222,6 +224,7 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
222
224
  confirmDepNewValue: null,
223
225
  confirmNewValue: null,
224
226
  confirmAttr: null,
227
+ // eslint-disable-next-line react/no-unused-state
225
228
  confirmOldValue: null,
226
229
  confirmData: null
227
230
  });
@@ -239,6 +242,7 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
239
242
  * @param {(() => void)?} cb optional callback function, else returns a Promise
240
243
  * @return {Promise<void>}
241
244
  */
245
+ // eslint-disable-next-line react/no-unused-class-component-methods
242
246
  }, {
243
247
  key: "onChange",
244
248
  value: function onChange(attr, newValue, cb) {
@@ -260,100 +264,100 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
260
264
  }
261
265
  });
262
266
  });
263
- } else {
264
- // find any inputs with confirmation
265
- if (this.props.schema.confirmDependsOn) {
266
- var _loop = function _loop() {
267
- var dep = _this5.props.schema.confirmDependsOn[z];
268
- if (dep.confirm) {
269
- var val = ConfigGeneric.getValue(data, dep.attr);
270
- if (_this5.execute(dep.confirm.condition, false, data, _this5.props.arrayIndex, _this5.props.globalData)) {
271
- return {
272
- v: new Promise(function (resolve) {
273
- _this5.setState({
274
- confirmDialog: true,
275
- confirmNewValue: newValue,
276
- confirmAttr: attr,
277
- confirmDepNewValue: val,
278
- confirmDepAttr: dep.attr,
279
- confirmData: dep.confirm
280
- }, function () {
281
- if (typeof cb === 'function') {
282
- cb();
283
- } else {
284
- resolve();
285
- }
286
- });
287
- })
288
- };
289
- }
267
+ }
268
+ // find any inputs with confirmation
269
+ if (this.props.schema.confirmDependsOn) {
270
+ var _loop = function _loop() {
271
+ var dep = _this5.props.schema.confirmDependsOn[z];
272
+ if (dep.confirm) {
273
+ var val = ConfigGeneric.getValue(data, dep.attr);
274
+ if (_this5.execute(dep.confirm.condition, false, data, _this5.props.arrayIndex, _this5.props.globalData)) {
275
+ return {
276
+ v: new Promise(function (resolve) {
277
+ _this5.setState({
278
+ confirmDialog: true,
279
+ confirmNewValue: newValue,
280
+ confirmAttr: attr,
281
+ confirmDepNewValue: val,
282
+ confirmDepAttr: dep.attr,
283
+ confirmData: dep.confirm
284
+ }, function () {
285
+ if (typeof cb === 'function') {
286
+ cb();
287
+ } else {
288
+ resolve();
289
+ }
290
+ });
291
+ })
292
+ };
290
293
  }
291
- };
292
- for (var z = 0; z < this.props.schema.confirmDependsOn.length; z++) {
293
- var _ret = _loop();
294
- if ((0, _typeof2["default"])(_ret) === "object") return _ret.v;
295
294
  }
295
+ };
296
+ for (var z = 0; z < this.props.schema.confirmDependsOn.length; z++) {
297
+ var _ret = _loop();
298
+ if ((0, _typeof2["default"])(_ret) === "object") return _ret.v;
296
299
  }
297
- var changed = [];
298
- if (this.props.schema.onChangeDependsOn) {
299
- for (var _z = 0; _z < this.props.schema.onChangeDependsOn.length; _z++) {
300
- var dep = this.props.schema.onChangeDependsOn[_z];
301
- if (dep.onChange) {
302
- var val = ConfigGeneric.getValue(data, dep.attr);
303
- var _newValue = void 0;
304
- if (this.props.custom) {
305
- _newValue = this.executeCustom(dep.onChange.calculateFunc, data, this.props.customObj, this.props.instanceObj, this.props.arrayIndex, this.props.globalData);
306
- } else {
307
- _newValue = this.execute(dep.onChange.calculateFunc, val, data, this.props.arrayIndex, this.props.globalData);
308
- }
309
- if (_newValue !== val) {
310
- ConfigGeneric.setValue(data, dep.attr, _newValue);
311
- changed.push(dep.attr);
312
- }
300
+ }
301
+ var changed = [];
302
+ if (this.props.schema.onChangeDependsOn) {
303
+ for (var _z = 0; _z < this.props.schema.onChangeDependsOn.length; _z++) {
304
+ var dep = this.props.schema.onChangeDependsOn[_z];
305
+ if (dep.onChange) {
306
+ var val = ConfigGeneric.getValue(data, dep.attr);
307
+ var _newValue = void 0;
308
+ if (this.props.custom) {
309
+ _newValue = this.executeCustom(dep.onChange.calculateFunc, data, this.props.customObj, this.props.instanceObj, this.props.arrayIndex, this.props.globalData);
310
+ } else {
311
+ _newValue = this.execute(dep.onChange.calculateFunc, val, data, this.props.arrayIndex, this.props.globalData);
312
+ }
313
+ if (_newValue !== val) {
314
+ ConfigGeneric.setValue(data, dep.attr, _newValue);
315
+ changed.push(dep.attr);
313
316
  }
314
317
  }
315
318
  }
316
- if (this.props.schema.hiddenDependsOn) {
317
- for (var _z2 = 0; _z2 < this.props.schema.hiddenDependsOn.length; _z2++) {
318
- var _dep = this.props.schema.hiddenDependsOn[_z2];
319
- _dep.hidden && changed.push(_dep.attr);
320
- }
321
- }
322
- if (this.props.schema.labelDependsOn) {
323
- for (var _z3 = 0; _z3 < this.props.schema.labelDependsOn.length; _z3++) {
324
- var _dep2 = this.props.schema.labelDependsOn[_z3];
325
- _dep2.hidden && changed.push(_dep2.attr);
326
- }
319
+ }
320
+ if (this.props.schema.hiddenDependsOn) {
321
+ for (var _z2 = 0; _z2 < this.props.schema.hiddenDependsOn.length; _z2++) {
322
+ var _dep = this.props.schema.hiddenDependsOn[_z2];
323
+ _dep.hidden && changed.push(_dep.attr);
327
324
  }
328
- if (this.props.schema.helpDependsOn) {
329
- for (var _z4 = 0; _z4 < this.props.schema.helpDependsOn.length; _z4++) {
330
- var _dep3 = this.props.schema.helpDependsOn[_z4];
331
- _dep3.hidden && changed.push(_dep3.attr);
332
- }
325
+ }
326
+ if (this.props.schema.labelDependsOn) {
327
+ for (var _z3 = 0; _z3 < this.props.schema.labelDependsOn.length; _z3++) {
328
+ var _dep2 = this.props.schema.labelDependsOn[_z3];
329
+ _dep2.hidden && changed.push(_dep2.attr);
333
330
  }
334
- if (this.props.schema.onChange && !this.props.schema.onChange.ignoreOwnChanges) {
335
- var _val = ConfigGeneric.getValue(data, this.props.attr);
336
- var _newValue2 = this.props.custom ? this.executeCustom(this.props.schema.onChange.calculateFunc, data, this.props.customObj, this.props.instanceObj, this.props.arrayIndex, this.props.globalData) : this.execute(this.props.schema.onChange.calculateFunc, _val, data, this.props.arrayIndex, this.props.globalData);
337
- if (_newValue2 !== _val) {
338
- ConfigGeneric.setValue(data, this.props.attr, _newValue2);
339
- }
331
+ }
332
+ if (this.props.schema.helpDependsOn) {
333
+ for (var _z4 = 0; _z4 < this.props.schema.helpDependsOn.length; _z4++) {
334
+ var _dep3 = this.props.schema.helpDependsOn[_z4];
335
+ _dep3.hidden && changed.push(_dep3.attr);
340
336
  }
341
- if (this.props.custom) {
342
- this.props.onChange(attr, newValue, function () {
343
- return cb && cb();
344
- });
345
- changed && changed.length && changed.forEach(function (_attr, i) {
346
- return setTimeout(function () {
347
- return _this5.props.onChange(_attr, ConfigGeneric.getValue(data, _attr));
348
- }, i * 50);
349
- });
350
- } else {
351
- this.props.onChange(data, undefined, function () {
352
- changed.length && _this5.props.forceUpdate(changed, data);
353
- cb && cb();
354
- });
337
+ }
338
+ if (this.props.schema.onChange && !this.props.schema.onChange.ignoreOwnChanges) {
339
+ var _val = ConfigGeneric.getValue(data, this.props.attr);
340
+ var newValue_ = this.props.custom ? this.executeCustom(this.props.schema.onChange.calculateFunc, data, this.props.customObj, this.props.instanceObj, this.props.arrayIndex, this.props.globalData) : this.execute(this.props.schema.onChange.calculateFunc, _val, data, this.props.arrayIndex, this.props.globalData);
341
+ if (newValue_ !== _val) {
342
+ ConfigGeneric.setValue(data, this.props.attr, newValue_);
355
343
  }
356
344
  }
345
+ if (this.props.custom) {
346
+ this.props.onChange(attr, newValue, function () {
347
+ return cb && cb();
348
+ });
349
+ changed && changed.length && changed.forEach(function (_attr, i) {
350
+ return setTimeout(function () {
351
+ return _this5.props.onChange(_attr, ConfigGeneric.getValue(data, _attr));
352
+ }, i * 50);
353
+ });
354
+ } else {
355
+ this.props.onChange(data, undefined, function () {
356
+ changed.length && _this5.props.forceUpdate(changed, data);
357
+ cb && cb();
358
+ });
359
+ }
360
+ return Promise.resolve();
357
361
  }
358
362
  }, {
359
363
  key: "execute",
@@ -363,16 +367,14 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
363
367
  }
364
368
  if (!func) {
365
369
  return defaultValue;
366
- } else {
367
- try {
368
- // eslint-disable-next-line no-new-func
369
- var f = new Function('data', 'originalData', '_system', '_alive', '_common', '_socket', '_instance', 'arrayIndex', 'globalData', func.includes('return') ? func : 'return ' + func);
370
- var result = f(data || this.props.data, this.props.originalData, this.props.systemConfig, this.props.alive, this.props.common, this.props.socket, this.props.instance, arrayIndex, globalData);
371
- return result;
372
- } catch (e) {
373
- console.error("Cannot execute ".concat(func, ": ").concat(e));
374
- return defaultValue;
375
- }
370
+ }
371
+ try {
372
+ // eslint-disable-next-line no-new-func
373
+ var f = new Function('data', 'originalData', '_system', '_alive', '_common', '_socket', '_instance', 'arrayIndex', 'globalData', func.includes('return') ? func : "return ".concat(func));
374
+ return f(data || this.props.data, this.props.originalData, this.props.systemConfig, this.props.alive, this.props.common, this.props.socket, this.props.instance, arrayIndex, globalData);
375
+ } catch (e) {
376
+ console.error("Cannot execute ".concat(func, ": ").concat(e));
377
+ return defaultValue;
376
378
  }
377
379
  }
378
380
  }, {
@@ -383,16 +385,14 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
383
385
  }
384
386
  if (!func) {
385
387
  return null;
386
- } else {
387
- try {
388
- // eslint-disable-next-line no-new-func
389
- var f = new Function('data', 'originalData', '_system', 'instanceObj', 'customObj', '_socket', 'arrayIndex', 'globalData', func.includes('return') ? func : 'return ' + func);
390
- var result = f(data || this.props.data, this.props.originalData, this.props.systemConfig, instanceObj, customObj, this.props.socket, arrayIndex, globalData);
391
- return result;
392
- } catch (e) {
393
- console.error("Cannot execute ".concat(func, ": ").concat(e));
394
- return null;
395
- }
388
+ }
389
+ try {
390
+ // eslint-disable-next-line no-new-func
391
+ var f = new Function('data', 'originalData', '_system', 'instanceObj', 'customObj', '_socket', 'arrayIndex', 'globalData', func.includes('return') ? func : "return ".concat(func));
392
+ return f(data || this.props.data, this.props.originalData, this.props.systemConfig, instanceObj, customObj, this.props.socket, arrayIndex, globalData);
393
+ } catch (e) {
394
+ console.error("Cannot execute ".concat(func, ": ").concat(e));
395
+ return null;
396
396
  }
397
397
  }
398
398
  }, {
@@ -432,9 +432,12 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
432
432
  }
433
433
  }, {
434
434
  key: "renderItem",
435
- value: function renderItem(error, disabled, defaultValue) {
435
+ value: function renderItem( /* error, disabled, defaultValue */
436
+ ) {
436
437
  return this.getText(this.props.schema.label) || this.getText(this.props.schema.text);
437
438
  }
439
+
440
+ // eslint-disable-next-line react/no-unused-class-component-methods
438
441
  }, {
439
442
  key: "renderHelp",
440
443
  value: function renderHelp(text, link, noTranslation) {
@@ -442,20 +445,18 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
442
445
  text = this.getText(text, noTranslation) || '';
443
446
  if (text && (text.includes('<a ') || text.includes('<br') || text.includes('<b>') || text.includes('<i>'))) {
444
447
  return _Utils["default"].renderTextWithA(text);
445
- } else {
446
- return text;
447
448
  }
448
- } else {
449
- return /*#__PURE__*/_react["default"].createElement("a", {
450
- href: link,
451
- target: "_blank",
452
- rel: "noreferrer",
453
- style: {
454
- color: this.props.themeType === 'dark' ? '#a147ff' : '#5b238f',
455
- textDecoration: 'underline'
456
- }
457
- }, this.getText(text, noTranslation));
449
+ return text;
458
450
  }
451
+ return /*#__PURE__*/_react["default"].createElement("a", {
452
+ href: link,
453
+ target: "_blank",
454
+ rel: "noreferrer",
455
+ style: {
456
+ color: this.props.themeType === 'dark' ? '#a147ff' : '#5b238f',
457
+ textDecoration: 'underline'
458
+ }
459
+ }, this.getText(text, noTranslation));
459
460
  }
460
461
  }, {
461
462
  key: "getPattern",
@@ -463,29 +464,27 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
463
464
  data = data || this.props.data;
464
465
  if (!pattern) {
465
466
  return '';
466
- } else {
467
- if ((0, _typeof2["default"])(pattern) === 'object') {
468
- if (pattern.func) {
469
- pattern = pattern.func;
470
- } else {
471
- console.log("Object must be stringified: ".concat(JSON.stringify(pattern)));
472
- pattern = JSON.stringify(pattern);
473
- }
467
+ }
468
+ if ((0, _typeof2["default"])(pattern) === 'object') {
469
+ if (pattern.func) {
470
+ pattern = pattern.func;
471
+ } else {
472
+ console.log("Object must be stringified: ".concat(JSON.stringify(pattern)));
473
+ pattern = JSON.stringify(pattern);
474
474
  }
475
- try {
476
- if (this.props.custom) {
477
- // eslint-disable-next-line no-new-func
478
- var f = new Function('data', 'originalData', 'arrayIndex', 'globalData', '_system', 'instanceObj', 'customObj', '_socket', 'return `' + pattern.replace(/`/g, '\\`') + '`');
479
- return f(data, this.props.originalData, this.props.arrayIndex, this.props.globalData, this.props.systemConfig, this.props.instanceObj, this.props.customObj, this.props.socket, this.props.arrayIndex, this.props.globalData);
480
- } else {
481
- // eslint-disable-next-line no-new-func
482
- var _f = new Function('data', 'originalData', 'arrayIndex', 'globalData', '_system', '_alive', '_common', '_socket', 'return `' + pattern.replace(/`/g, '\\`') + '`');
483
- return _f(data, this.props.originalData, this.props.arrayIndex, this.props.globalData, this.props.systemConfig, this.props.alive, this.props.common, this.props.socket);
484
- }
485
- } catch (e) {
486
- console.error("Cannot execute ".concat(pattern, ": ").concat(e));
487
- return pattern;
475
+ }
476
+ try {
477
+ if (this.props.custom) {
478
+ // eslint-disable-next-line no-new-func
479
+ var _f = new Function('data', 'originalData', 'arrayIndex', 'globalData', '_system', 'instanceObj', 'customObj', '_socket', "return `".concat(pattern.replace(/`/g, '\\`'), "`"));
480
+ return _f(data, this.props.originalData, this.props.arrayIndex, this.props.globalData, this.props.systemConfig, this.props.instanceObj, this.props.customObj, this.props.socket, this.props.arrayIndex, this.props.globalData);
488
481
  }
482
+ // eslint-disable-next-line no-new-func
483
+ var f = new Function('data', 'originalData', 'arrayIndex', 'globalData', '_system', '_alive', '_common', '_socket', "return `".concat(pattern.replace(/`/g, '\\`'), "`"));
484
+ return f(data, this.props.originalData, this.props.arrayIndex, this.props.globalData, this.props.systemConfig, this.props.alive, this.props.common, this.props.socket);
485
+ } catch (e) {
486
+ console.error("Cannot execute ".concat(pattern, ": ").concat(e));
487
+ return pattern;
489
488
  }
490
489
  }
491
490
  }, {
@@ -518,16 +517,17 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
518
517
  this.isError = {};
519
518
  }
520
519
  if (schema.hideOnlyControl) {
521
- var item = /*#__PURE__*/_react["default"].createElement(_material.Grid, {
520
+ var _item = /*#__PURE__*/_react["default"].createElement(_material.Grid, {
522
521
  item: true,
523
522
  xs: schema.xs || undefined,
524
523
  lg: schema.lg || undefined,
525
524
  md: schema.md || undefined,
526
525
  sm: schema.sm || undefined,
527
- style: Object.assign({}, {
526
+ style: _objectSpread(_objectSpread({
528
527
  marginBottom: 0,
529
- /*marginRight: 8, */textAlign: 'left'
530
- }, schema.style, this.props.themeType === 'dark' ? schema.darkStyle : {})
528
+ /* marginRight: 8, */
529
+ textAlign: 'left'
530
+ }, schema.style), this.props.themeType === 'dark' ? schema.darkStyle : {})
531
531
  });
532
532
  if (schema.newLine) {
533
533
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
@@ -535,81 +535,76 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
535
535
  flexBasis: '100%',
536
536
  height: 0
537
537
  }
538
- }), item);
539
- } else {
540
- return item;
538
+ }), _item);
541
539
  }
542
- } else {
543
- return null;
540
+ return _item;
544
541
  }
545
- } else {
546
- // Add error
547
- if (schema.validatorNoSaveOnError) {
548
- if (error && !Object.keys(this.isError).length) {
549
- this.isError = (0, _defineProperty2["default"])({}, this.props.attr, schema.validatorErrorText ? _i18n["default"].t(schema.validatorErrorText) : true);
550
- setTimeout(function (isError) {
551
- return Object.keys(isError).forEach(function (attr) {
552
- return _this6.props.onError(attr, isError[attr]);
553
- });
554
- }, 100, JSON.parse(JSON.stringify(this.isError)));
555
- } else if (!error && Object.keys(this.isError).length) {
556
- setTimeout(function (isError) {
557
- return Object.keys(isError).forEach(function (attr) {
558
- return _this6.props.onError(attr);
559
- });
560
- }, 100, JSON.parse(JSON.stringify(this.isError)));
561
- this.isError = {};
562
- }
542
+ return null;
543
+ }
544
+ // Add error
545
+ if (schema.validatorNoSaveOnError) {
546
+ if (error && !Object.keys(this.isError).length) {
547
+ this.isError = (0, _defineProperty2["default"])({}, this.props.attr, schema.validatorErrorText ? _i18n["default"].t(schema.validatorErrorText) : true);
548
+ setTimeout(function (isError) {
549
+ return Object.keys(isError).forEach(function (attr) {
550
+ return _this6.props.onError(attr, isError[attr]);
551
+ });
552
+ }, 100, JSON.parse(JSON.stringify(this.isError)));
553
+ } else if (!error && Object.keys(this.isError).length) {
554
+ setTimeout(function (isError) {
555
+ return Object.keys(isError).forEach(function (attr) {
556
+ return _this6.props.onError(attr);
557
+ });
558
+ }, 100, JSON.parse(JSON.stringify(this.isError)));
559
+ this.isError = {};
563
560
  }
564
- var renderedItem = this.renderItem(error, disabled || this.props.commandRunning || this.props.disabled, defaultValue);
565
- if (this.noPlaceRequired) {
566
- return renderedItem;
561
+ }
562
+ var renderedItem = this.renderItem(error, disabled || this.props.commandRunning || this.props.disabled, defaultValue);
563
+ if (this.noPlaceRequired) {
564
+ return renderedItem;
565
+ }
566
+ var item = /*#__PURE__*/_react["default"].createElement(_material.Grid, {
567
+ item: true,
568
+ title: this.getText(schema.tooltip),
569
+ xs: schema.xs || undefined,
570
+ lg: schema.lg || undefined,
571
+ md: schema.md || undefined,
572
+ sm: schema.sm || undefined,
573
+ style: _objectSpread(_objectSpread({
574
+ marginBottom: 0,
575
+ // marginRight: 8,
576
+ textAlign: 'left',
577
+ width: schema.type === 'divider' || schema.type === 'header' ? schema.width || '100%' : undefined
578
+ }, schema.style), this.props.themeType === 'dark' ? schema.darkStyle : {})
579
+ }, this.props.schema.defaultSendTo && this.props.schema.button ? /*#__PURE__*/_react["default"].createElement(_material.Grid, {
580
+ container: true,
581
+ style: {
582
+ width: '100%'
567
583
  }
568
- var _item = /*#__PURE__*/_react["default"].createElement(_material.Grid, {
569
- item: true,
570
- title: this.getText(schema.tooltip),
571
- xs: schema.xs || undefined,
572
- lg: schema.lg || undefined,
573
- md: schema.md || undefined,
574
- sm: schema.sm || undefined,
575
- style: Object.assign({}, {
576
- marginBottom: 0,
577
- // marginRight: 8,
578
- textAlign: 'left',
579
- width: schema.type === 'divider' || schema.type === 'header' ? schema.width || '100%' : undefined
580
- }, schema.style, this.props.themeType === 'dark' ? schema.darkStyle : {})
581
- }, this.props.schema.defaultSendTo && this.props.schema.button ? /*#__PURE__*/_react["default"].createElement(_material.Grid, {
582
- container: true,
584
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
585
+ item: true,
586
+ flex: 1
587
+ }, renderedItem), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
588
+ item: true
589
+ }, /*#__PURE__*/_react["default"].createElement(_material.Button, {
590
+ variant: "outlined",
591
+ onClick: function onClick() {
592
+ return _this6.sendTo();
593
+ },
594
+ title: this.props.schema.buttonTooltip ? this.getText(this.props.schema.buttonTooltip, this.props.schema.buttonTooltipNoTranslation) : _i18n["default"].t('ra_Request data by instance')
595
+ }, this.getText(this.props.schema.button)))) : renderedItem);
596
+ if (schema.newLine) {
597
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
583
598
  style: {
584
- width: '100%'
599
+ flexBasis: '100%',
600
+ height: 0
585
601
  }
586
- }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
587
- item: true,
588
- flex: 1
589
- }, renderedItem), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
590
- item: true
591
- }, /*#__PURE__*/_react["default"].createElement(_material.Button, {
592
- variant: "outlined",
593
- onClick: function onClick() {
594
- return _this6.sendTo();
595
- },
596
- title: this.props.schema.buttonTooltip ? this.getText(this.props.schema.buttonTooltip, this.props.schema.buttonTooltipNoTranslation) : _i18n["default"].t('ra_Request data by instance')
597
- }, this.getText(this.props.schema.button)))) : renderedItem);
598
- if (schema.newLine) {
599
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
600
- style: {
601
- flexBasis: '100%',
602
- height: 0
603
- }
604
- }), this.renderConfirmDialog(), _item);
605
- } else {
606
- if (this.state.confirmDialog) {
607
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.renderConfirmDialog(), _item);
608
- } else {
609
- return _item;
610
- }
611
- }
602
+ }), this.renderConfirmDialog(), item);
603
+ }
604
+ if (this.state.confirmDialog) {
605
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.renderConfirmDialog(), item);
612
606
  }
607
+ return item;
613
608
  }
614
609
  }], [{
615
610
  key: "getValue",
@@ -624,38 +619,35 @@ var ConfigGeneric = /*#__PURE__*/function (_Component) {
624
619
  function getValue(data, attr) {
625
620
  if (typeof attr === 'string') {
626
621
  return ConfigGeneric.getValue(data, attr.split('.'));
627
- } else {
628
- if (attr.length === 1) {
629
- return data[attr[0]];
630
- } else {
631
- var part = attr.shift();
632
- if ((0, _typeof2["default"])(data[part]) === 'object') {
633
- return ConfigGeneric.getValue(data[part], attr);
634
- } else {
635
- return null;
636
- }
637
- }
638
622
  }
623
+ if (attr.length === 1) {
624
+ return data[attr[0]];
625
+ }
626
+ var part = attr.shift();
627
+ if ((0, _typeof2["default"])(data[part]) === 'object') {
628
+ return ConfigGeneric.getValue(data[part], attr);
629
+ }
630
+ return null;
639
631
  }
640
632
  }, {
641
633
  key: "setValue",
642
634
  value: function setValue(data, attr, value) {
643
635
  if (typeof attr === 'string') {
644
- return ConfigGeneric.setValue(data, attr.split('.'), value);
645
- } else {
646
- if (attr.length === 1) {
647
- if (value === null) {
648
- delete data[attr[0]];
649
- } else {
650
- data[attr[0]] = value;
651
- }
636
+ ConfigGeneric.setValue(data, attr.split('.'), value);
637
+ return;
638
+ }
639
+ if (attr.length === 1) {
640
+ if (value === null) {
641
+ delete data[attr[0]];
652
642
  } else {
653
- var part = attr.shift();
654
- if (!data[part] || (0, _typeof2["default"])(data[part]) === 'object') {
655
- data[part] = data[part] || {};
656
- }
657
- return ConfigGeneric.setValue(data[part], attr, value);
643
+ data[attr[0]] = value;
644
+ }
645
+ } else {
646
+ var part = attr.shift();
647
+ if (!data[part] || (0, _typeof2["default"])(data[part]) === 'object') {
648
+ data[part] = data[part] || {};
658
649
  }
650
+ ConfigGeneric.setValue(data[part], attr, value);
659
651
  }
660
652
  }
661
653
  }]);
@@ -680,11 +672,14 @@ ConfigGeneric.propTypes = {
680
672
  originalData: _propTypes["default"].object,
681
673
  schema: _propTypes["default"].object,
682
674
  attr: _propTypes["default"].string,
675
+ // eslint-disable-next-line react/no-unused-prop-types
683
676
  value: _propTypes["default"].any,
677
+ // eslint-disable-next-line react/no-unused-prop-types
684
678
  themeName: _propTypes["default"].string,
685
679
  style: _propTypes["default"].object,
686
680
  onError: _propTypes["default"].func,
687
681
  onChange: _propTypes["default"].func,
682
+ // eslint-disable-next-line react/no-unused-prop-types
688
683
  customs: _propTypes["default"].object,
689
684
  forceUpdate: _propTypes["default"].func.isRequired,
690
685
  disabled: _propTypes["default"].bool,
@@ -693,7 +688,9 @@ ConfigGeneric.propTypes = {
693
688
  common: _propTypes["default"].object,
694
689
  adapterName: _propTypes["default"].string,
695
690
  instance: _propTypes["default"].number,
691
+ // eslint-disable-next-line react/no-unused-prop-types
696
692
  dateFormat: _propTypes["default"].string,
693
+ // eslint-disable-next-line react/no-unused-prop-types
697
694
  isFloatComma: _propTypes["default"].bool,
698
695
  customObj: _propTypes["default"].object,
699
696
  instanceObj: _propTypes["default"].object,