@iobroker/adapter-react-v5 0.0.3 → 1.0.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 (48) hide show
  1. package/Components/ColorPicker.js +6 -2
  2. package/Components/ColorPicker.js.map +1 -1
  3. package/Components/ComplexCron.js +1 -1
  4. package/Components/ComplexCron.js.map +1 -1
  5. package/Components/FileBrowser.js +6 -6
  6. package/Components/FileBrowser.js.map +1 -1
  7. package/Components/FileViewer.js +12 -20
  8. package/Components/FileViewer.js.map +1 -1
  9. package/Components/Icon.js +1 -1
  10. package/Components/Icon.js.map +1 -1
  11. package/Components/IconPicker.js +1 -2
  12. package/Components/IconPicker.js.map +1 -1
  13. package/Components/IconSelector.js.map +1 -1
  14. package/Components/Image.js +2 -1
  15. package/Components/Image.js.map +1 -1
  16. package/Components/Loader.js +8 -14
  17. package/Components/Loader.js.map +1 -1
  18. package/Components/Logo.js +8 -8
  19. package/Components/Logo.js.map +1 -1
  20. package/Components/MDUtils.js.map +1 -1
  21. package/Components/ObjectBrowser.js +307 -68
  22. package/Components/ObjectBrowser.js.map +1 -1
  23. package/Components/Schedule.js +1 -2
  24. package/Components/Schedule.js.map +1 -1
  25. package/Components/SelectWithIcon.js +40 -4
  26. package/Components/SelectWithIcon.js.map +1 -1
  27. package/Components/TextWithIcon.js +5 -3
  28. package/Components/TextWithIcon.js.map +1 -1
  29. package/Dialogs/ComplexCron.js +1 -1
  30. package/Dialogs/ComplexCron.js.map +1 -1
  31. package/Dialogs/Confirm.js +1 -1
  32. package/Dialogs/Confirm.js.map +1 -1
  33. package/Dialogs/Cron.js +1 -1
  34. package/Dialogs/Cron.js.map +1 -1
  35. package/Dialogs/Error.js +1 -1
  36. package/Dialogs/Error.js.map +1 -1
  37. package/Dialogs/Message.js +1 -1
  38. package/Dialogs/Message.js.map +1 -1
  39. package/Dialogs/SelectID.js +1 -1
  40. package/Dialogs/SelectID.js.map +1 -1
  41. package/Dialogs/SimpleCron.js +1 -1
  42. package/Dialogs/SimpleCron.js.map +1 -1
  43. package/Dialogs/TextInput.js +11 -11
  44. package/Dialogs/TextInput.js.map +1 -1
  45. package/GenericApp.js +7 -4
  46. package/GenericApp.js.map +1 -1
  47. package/README.md +31 -0
  48. package/package.json +4 -4
@@ -123,6 +123,10 @@ var _LooksOne = _interopRequireDefault(require("@mui/icons-material/LooksOne"));
123
123
 
124
124
  var _RoomService = _interopRequireDefault(require("@mui/icons-material/RoomService"));
125
125
 
126
+ var _Error = _interopRequireDefault(require("@mui/icons-material/Error"));
127
+
128
+ var _WifiOff = _interopRequireDefault(require("@mui/icons-material/WifiOff"));
129
+
126
130
  var _IconExpert = _interopRequireDefault(require("../icons/IconExpert"));
127
131
 
128
132
  var _IconAdapter = _interopRequireDefault(require("../icons/IconAdapter"));
@@ -239,6 +243,12 @@ var ITEM_LEVEL = 16;
239
243
  var SMALL_BUTTON_SIZE = 20;
240
244
  var COLOR_NAME_SYSTEM = '#ff6d69';
241
245
  var COLOR_NAME_SYSTEM_ADAPTER = '#5773ff';
246
+ var COLOR_NAME_ERROR_DARK = '#ff413c';
247
+ var COLOR_NAME_ERROR_LIGHT = '#86211f';
248
+ var COLOR_NAME_CONNECTED_DARK = '#57ff45';
249
+ var COLOR_NAME_CONNECTED_LIGHT = '#098c04';
250
+ var COLOR_NAME_DISCONNECTED_DARK = '#f3ad11';
251
+ var COLOR_NAME_DISCONNECTED_LIGHT = '#6c5008';
242
252
 
243
253
  var styles = function styles(theme) {
244
254
  return {
@@ -335,7 +345,7 @@ var styles = function styles(theme) {
335
345
  paddingTop: 0,
336
346
  //theme.spacing(1),
337
347
  paddingLeft: 0,
338
- width: "calc(100% - ".concat(theme.spacing(1), ")"),
348
+ width: "calc(100% - ".concat(theme.spacing(1), "px)"),
339
349
  height: "calc(100% - 38px)",
340
350
  overflow: 'auto'
341
351
  },
@@ -347,7 +357,7 @@ var styles = function styles(theme) {
347
357
  userSelect: 'none',
348
358
  width: '100%',
349
359
  '&:hover': {
350
- background: "".concat(theme.palette.primary.main, " !important"),
360
+ background: "".concat(theme.palette.mode === 'dark' ? theme.palette.primary.dark : theme.palette.primary.light, " !important"),
351
361
  color: _Utils["default"].invertColor(theme.palette.primary.main, true)
352
362
  },
353
363
  whiteSpace: 'nowrap',
@@ -448,7 +458,14 @@ var styles = function styles(theme) {
448
458
  fontSize: 14,
449
459
  marginLeft: 5,
450
460
  overflow: 'hidden',
451
- textOverflow: 'ellipsis'
461
+ textOverflow: 'ellipsis',
462
+ position: 'relative',
463
+ '& .copyButton': {
464
+ display: 'none'
465
+ },
466
+ '&:hover .copyButton': {
467
+ display: 'block'
468
+ }
452
469
  },
453
470
  cellIdAlias: {
454
471
  fontStyle: 'italic',
@@ -540,6 +557,9 @@ var styles = function styles(theme) {
540
557
  display: 'block'
541
558
  }
542
559
  },
560
+ cellValueFile: {
561
+ color: '#2837b9'
562
+ },
543
563
  cellValueTooltipTitle: {
544
564
  fontStyle: 'italic',
545
565
  width: 100,
@@ -659,7 +679,7 @@ var styles = function styles(theme) {
659
679
  opacity: 0.5
660
680
  },
661
681
  itemSelected: {
662
- background: "".concat(theme.palette.mode === 'dark' ? theme.palette.primary.light : theme.palette.primary.dark, " !important"),
682
+ background: "".concat(theme.palette.primary.main, " !important"),
663
683
  color: "".concat(_Utils["default"].invertColor(theme.palette.primary.main, true), " !important")
664
684
  },
665
685
  header: {
@@ -676,6 +696,7 @@ var styles = function styles(theme) {
676
696
  },
677
697
  headerCellInput: {
678
698
  width: 'calc(100% - 5px)',
699
+ height: ROW_HEIGHT,
679
700
  paddingTop: 3,
680
701
  '& .itemIcon': {
681
702
  verticalAlign: 'middle',
@@ -774,6 +795,30 @@ var styles = function styles(theme) {
774
795
  right: 0,
775
796
  borderRadius: 20,
776
797
  backgroundColor: theme.palette.background["default"]
798
+ },
799
+ iconDeviceConnected: {
800
+ color: theme.palette.mode === 'dark' ? COLOR_NAME_CONNECTED_DARK : COLOR_NAME_CONNECTED_LIGHT,
801
+ opacity: 0.8,
802
+ position: 'absolute',
803
+ top: 4,
804
+ right: 32,
805
+ width: 20
806
+ },
807
+ iconDeviceDisconnected: {
808
+ color: theme.palette.mode === 'dark' ? COLOR_NAME_DISCONNECTED_DARK : COLOR_NAME_DISCONNECTED_LIGHT,
809
+ opacity: 0.8,
810
+ position: 'absolute',
811
+ top: 4,
812
+ right: 32,
813
+ width: 20
814
+ },
815
+ iconDeviceError: {
816
+ color: theme.palette.mode === 'dark' ? COLOR_NAME_ERROR_DARK : COLOR_NAME_ERROR_LIGHT,
817
+ opacity: 0.8,
818
+ position: 'absolute',
819
+ top: 4,
820
+ right: 50,
821
+ width: 20
777
822
  }
778
823
  };
779
824
  };
@@ -1411,17 +1456,51 @@ function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
1411
1456
 
1412
1457
  var isCommon = obj.common;
1413
1458
  var valText = {};
1414
- var v = !state || state.val === null ? '(null)' : state.val === undefined ? '[undef]' : state.val;
1459
+ var v = isCommon && isCommon.type === 'file' ? '[file]' : !state || state.val === null ? '(null)' : state.val === undefined ? '[undef]' : state.val;
1415
1460
 
1416
1461
  var type = _typeof(v);
1417
1462
 
1418
1463
  if (isCommon && isCommon.role && typeof isCommon.role === 'string' && isCommon.role.match(/^value\.time|^date/)) {
1419
- if (typeof v === 'string' && v.length === 13) {
1420
- // warning, this solution only works till Nov 20 2286 18:46:39CET
1421
- v = parseInt(v, 10);
1422
- }
1464
+ if (v && typeof v === 'string') {
1465
+ if (v.length === 13) {
1466
+ // (length of "1647597254924") warning, this solution only works till Nov 20 2286 18:46:39CET
1467
+ v = new Date(parseInt(v, 10)).toString();
1468
+ } else if (v.length === 10) {
1469
+ // YYYY.MM.DD
1470
+ var parts = v.split(/[-.]/);
1471
+
1472
+ if (parts.length === 3) {
1473
+ if (parts[0].length === 4) {
1474
+ // YYYY.MM.DD
1475
+ v = new Date(parseInt(parts[0], 10), parseInt(parts[1], 10) + 1, parseInt(parts[2], 10));
1476
+ } else if (parts[0].length === 4) {
1477
+ // DD.MM.YYYY
1478
+ v = new Date(parseInt(parts[2], 10), parseInt(parts[1], 10) + 1, parseInt(parts[0], 10));
1479
+ }
1480
+ } else {
1481
+ v = new Date(v).toString(); // Let the browser convert it somehow
1482
+ }
1483
+ } else if (v.length === 8) {
1484
+ // YY.MM.DD
1485
+ var _parts2 = v.split(/[-.]/);
1423
1486
 
1424
- v = v ? new Date(v).toString() : v;
1487
+ if (_parts2.length === 3) {
1488
+ v = new Date(parseInt(_parts2[0], 10), parseInt(_parts2[1], 10) + 1, parseInt(_parts2[2], 10));
1489
+ } else {
1490
+ v = new Date(v).toString(); // Let the browser convert it somehow
1491
+ }
1492
+ } else {
1493
+ v = new Date(v).toString(); // Let the browser convert it somehow
1494
+ }
1495
+ } else {
1496
+ if (v === null || v === 'null') {
1497
+ v = 'null';
1498
+ } else if (v === undefined) {
1499
+ v = 'undefined';
1500
+ } else {
1501
+ v = v ? new Date(v).toString() : v;
1502
+ }
1503
+ }
1425
1504
  } else {
1426
1505
  if (type === 'number') {
1427
1506
  v = Math.round(v * 100000000) / 100000000; // remove 4.00000000000000001
@@ -1534,7 +1613,7 @@ function getSelectIdIcon(objects, id, imagePrefix) {
1534
1613
  // if not BASE64
1535
1614
  if (!aIcon.startsWith('data:image/')) {
1536
1615
  if (aIcon.includes('.')) {
1537
- src = imagePrefix + '/adapter/' + objects[_id_].common.name + '/' + aIcon;
1616
+ src = "".concat(imagePrefix, "/adapter/").concat(objects[_id_].common.name, "/").concat(aIcon);
1538
1617
  } else if (aIcon && aIcon.length < 3) {
1539
1618
  return aIcon; // utf-8
1540
1619
  } else {
@@ -1563,7 +1642,7 @@ function getSelectIdIcon(objects, id, imagePrefix) {
1563
1642
  var instance;
1564
1643
 
1565
1644
  if (objects[id].type === 'instance' || objects[id].type === 'adapter') {
1566
- src = imagePrefix + '/adapter/' + common.name + '/' + cIcon;
1645
+ src = "".concat(imagePrefix, "/adapter/").concat(common.name, "/").concat(cIcon);
1567
1646
  } else if (id && id.startsWith('system.adapter.')) {
1568
1647
  instance = id.split('.', 3);
1569
1648
 
@@ -1573,7 +1652,7 @@ function getSelectIdIcon(objects, id, imagePrefix) {
1573
1652
  instance[2] += '/' + cIcon;
1574
1653
  }
1575
1654
 
1576
- src = imagePrefix + '/adapter/' + instance[2];
1655
+ src = "".concat(imagePrefix, "/adapter/").concat(instance[2]);
1577
1656
  } else {
1578
1657
  instance = id.split('.', 2);
1579
1658
 
@@ -1583,7 +1662,7 @@ function getSelectIdIcon(objects, id, imagePrefix) {
1583
1662
  instance[0] += '/' + cIcon;
1584
1663
  }
1585
1664
 
1586
- src = imagePrefix + '/adapter/' + instance[0];
1665
+ src = "".concat(imagePrefix, "/adapter/").concat(instance[0]);
1587
1666
  }
1588
1667
  } else if (aIcon && aIcon.length < 3) {
1589
1668
  return aIcon; // utf-8
@@ -1843,8 +1922,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
1843
1922
  return;
1844
1923
  }
1845
1924
 
1846
- ;
1847
-
1848
1925
  if (event.id.startsWith('system.adapter.') && event.obj && event.obj.type === 'adapter') {
1849
1926
  var columnsForAdmin = JSON.parse(JSON.stringify(_this.state.columnsForAdmin));
1850
1927
 
@@ -2556,6 +2633,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
2556
2633
  scrollBarWidth: 16,
2557
2634
  customDialog: customDialog,
2558
2635
  editObjectDialog: '',
2636
+ viewFileDialog: '',
2559
2637
  enumDialog: null,
2560
2638
  roleDialog: null,
2561
2639
  modalEmptyId: null,
@@ -2606,6 +2684,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
2606
2684
  // State changed from
2607
2685
  ownerGroup: props.t('ra_Owner group'),
2608
2686
  ownerUser: props.t('ra_Owner user'),
2687
+ deviceError: props.t('ra_Error'),
2688
+ deviceDisconnected: props.t('ra_Disconnected'),
2689
+ deviceConnected: props.t('ra_Connected'),
2609
2690
  aclOwner_read_object: props.t('ra_aclOwner_read_object'),
2610
2691
  aclOwner_read_state: props.t('ra_aclOwner_read_state'),
2611
2692
  aclOwner_write_object: props.t('ra_aclOwner_write_object'),
@@ -3273,7 +3354,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
3273
3354
  }, {
3274
3355
  key: "checkUnsubscribes",
3275
3356
  value: function checkUnsubscribes() {
3276
- // Remove unused subscribed
3357
+ // Remove unused subscriptions
3277
3358
  for (var i = this.subscribes.length - 1; i >= 0; i--) {
3278
3359
  !this.recordStates.includes(this.subscribes[i]) && this.unsubscribe(this.subscribes[i]);
3279
3360
  }
@@ -4274,7 +4355,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
4274
4355
  function renderColumnButtons(id, item, classes) {
4275
4356
  var _this27 = this,
4276
4357
  _item$children2,
4277
- _item$data$obj$common;
4358
+ _item$data$obj$common,
4359
+ _item$data$obj$common3;
4278
4360
 
4279
4361
  if (!item.data.obj) {
4280
4362
  return this.props.onObjectDelete || this.props.objectEditOfAccessControl ? /*#__PURE__*/_react["default"].createElement("div", {
@@ -4350,7 +4432,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
4350
4432
  title: this.texts.deleteObject
4351
4433
  }, /*#__PURE__*/_react["default"].createElement(_Delete["default"], {
4352
4434
  className: classes.cellButtonsButtonIcon
4353
- })) : null, this.props.objectCustomDialog && this.info.hasSomeCustoms && item.data.obj.type === 'state' ? /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
4435
+ })) : null, this.props.objectCustomDialog && this.info.hasSomeCustoms && item.data.obj.type === 'state' && ((_item$data$obj$common3 = item.data.obj.common) === null || _item$data$obj$common3 === void 0 ? void 0 : _item$data$obj$common3.type) !== 'file' ? /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
4354
4436
  className: _Utils["default"].clsx(classes.cellButtonsButton, item.data.hasCustoms && classes.cellButtonsButtonWithCustoms),
4355
4437
  key: "custom",
4356
4438
  size: "small",
@@ -4439,15 +4521,20 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
4439
4521
  }, {
4440
4522
  key: "renderColumnValue",
4441
4523
  value: function renderColumnValue(id, item, classes) {
4442
- var _this29 = this;
4524
+ var _item$data$obj$common4,
4525
+ _this29 = this;
4443
4526
 
4444
4527
  if (!item.data.obj || !this.states) {
4445
4528
  return null;
4446
4529
  }
4447
4530
 
4448
- if (!this.states[id]) {
4531
+ if (((_item$data$obj$common4 = item.data.obj.common) === null || _item$data$obj$common4 === void 0 ? void 0 : _item$data$obj$common4.type) === 'file') {
4532
+ return /*#__PURE__*/_react["default"].createElement("div", {
4533
+ className: _Utils["default"].clsx(classes.cellValueText, classes.cellValueFile)
4534
+ }, "[file]");
4535
+ } else if (!this.states[id]) {
4449
4536
  if (item.data.obj.type === 'state') {
4450
- this.recordStates.push(id);
4537
+ !this.recordStates.includes(id) && this.recordStates.push(id);
4451
4538
  this.states[id] = {
4452
4539
  val: null
4453
4540
  };
@@ -4456,7 +4543,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
4456
4543
 
4457
4544
  return null;
4458
4545
  } else {
4459
- this.recordStates.push(id);
4546
+ !this.recordStates.includes(id) && this.recordStates.push(id);
4460
4547
  }
4461
4548
 
4462
4549
  var state = this.states[id];
@@ -5036,22 +5123,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5036
5123
  value: function renderLeaf(item, isExpanded, classes, counter) {
5037
5124
  var _item$data$obj,
5038
5125
  _this37 = this,
5039
- _item$data$obj2,
5040
- _item$data$obj2$commo,
5041
- _item$data$obj3,
5042
- _item$data$obj4,
5043
- _item$data$obj5,
5044
- _item$data$obj6,
5045
- _item$data$obj6$commo,
5046
- _item$data$obj6$commo2,
5047
- _item$data$obj7,
5048
- _item$data$obj7$commo,
5049
- _item$data$obj7$commo2,
5126
+ _common$alias,
5127
+ _common$alias2,
5050
5128
  _item$data,
5051
- _item$data$obj8,
5052
- _item$data$obj8$commo,
5129
+ _item$data$common,
5053
5130
  _this$states$id2,
5054
5131
  _item$data2,
5132
+ _item$data3,
5055
5133
  _this$states$id3,
5056
5134
  _this$states$id4,
5057
5135
  _this$states$id5;
@@ -5102,6 +5180,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5102
5180
  }
5103
5181
 
5104
5182
  var obj = item.data.obj;
5183
+ var common = obj === null || obj === void 0 ? void 0 : obj.common;
5105
5184
 
5106
5185
  var typeImg = obj && obj.type && ITEM_IMAGES[obj.type] || /*#__PURE__*/_react["default"].createElement("div", {
5107
5186
  className: "itemIcon"
@@ -5130,7 +5209,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5130
5209
  className: classes.checkBox,
5131
5210
  checked: this.state.selected.includes(id)
5132
5211
  }) : null;
5133
- var valueEditable = !this.props.notEditable && itemType === 'state' && (this.props.expertMode || ((_item$data$obj2 = item.data.obj) === null || _item$data$obj2 === void 0 ? void 0 : (_item$data$obj2$commo = _item$data$obj2.common) === null || _item$data$obj2$commo === void 0 ? void 0 : _item$data$obj2$commo.write) !== false);
5212
+ var valueEditable = !this.props.notEditable && itemType === 'state' && (this.props.expertMode || (common === null || common === void 0 ? void 0 : common.write) !== false);
5213
+
5214
+ if (this.props.objectBrowserViewFile && (common === null || common === void 0 ? void 0 : common.type) === 'file') {
5215
+ valueEditable = true;
5216
+ }
5217
+
5134
5218
  var enumEditable = !this.props.notEditable && this.objects[id] && (this.props.expertMode || itemType === 'state' || itemType === 'channel' || itemType === 'device');
5135
5219
  var checkVisibleObjectType = this.state.statesView && (itemType === 'state' || itemType === 'channel' || itemType === 'device');
5136
5220
  var newValue = '';
@@ -5155,56 +5239,59 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5155
5239
  }
5156
5240
  }
5157
5241
 
5158
- ((_item$data$obj3 = item.data.obj) === null || _item$data$obj3 === void 0 ? void 0 : _item$data$obj3.from) && newValueTitle.push(this.texts.objectChangedFrom + ' ' + item.data.obj.from.replace(/^system\.adapter\.|^system\./, ''));
5159
- ((_item$data$obj4 = item.data.obj) === null || _item$data$obj4 === void 0 ? void 0 : _item$data$obj4.user) && newValueTitle.push(this.texts.objectChangedBy + ' ' + item.data.obj.user.replace(/^system\.user\./, ''));
5160
- ((_item$data$obj5 = item.data.obj) === null || _item$data$obj5 === void 0 ? void 0 : _item$data$obj5.ts) && newValueTitle.push(this.texts.objectChangedByUser + ' ' + _Utils["default"].formatDate(new Date(item.data.obj.ts), this.props.dateFormat));
5161
- var readWriteAlias = _typeof((_item$data$obj6 = item.data.obj) === null || _item$data$obj6 === void 0 ? void 0 : (_item$data$obj6$commo = _item$data$obj6.common) === null || _item$data$obj6$commo === void 0 ? void 0 : (_item$data$obj6$commo2 = _item$data$obj6$commo.alias) === null || _item$data$obj6$commo2 === void 0 ? void 0 : _item$data$obj6$commo2.id) === 'object';
5162
- var alias = id.startsWith('alias.') && (_item$data$obj7 = item.data.obj) !== null && _item$data$obj7 !== void 0 && (_item$data$obj7$commo = _item$data$obj7.common) !== null && _item$data$obj7$commo !== void 0 && (_item$data$obj7$commo2 = _item$data$obj7$commo.alias) !== null && _item$data$obj7$commo2 !== void 0 && _item$data$obj7$commo2.id ? readWriteAlias ? /*#__PURE__*/_react["default"].createElement("div", {
5242
+ if (obj) {
5243
+ obj.from && newValueTitle.push(this.texts.objectChangedFrom + ' ' + obj.from.replace(/^system\.adapter\.|^system\./, ''));
5244
+ obj.user && newValueTitle.push(this.texts.objectChangedBy + ' ' + obj.user.replace(/^system\.user\./, ''));
5245
+ obj.ts && newValueTitle.push(this.texts.objectChangedByUser + ' ' + _Utils["default"].formatDate(new Date(obj.ts), this.props.dateFormat));
5246
+ }
5247
+
5248
+ var readWriteAlias = _typeof(common === null || common === void 0 ? void 0 : (_common$alias = common.alias) === null || _common$alias === void 0 ? void 0 : _common$alias.id) === 'object';
5249
+ var alias = id.startsWith('alias.') && common !== null && common !== void 0 && (_common$alias2 = common.alias) !== null && _common$alias2 !== void 0 && _common$alias2.id ? readWriteAlias ? /*#__PURE__*/_react["default"].createElement("div", {
5163
5250
  className: classes.cellIdAliasReadWriteDiv
5164
- }, item.data.obj.common.alias.id.read ? /*#__PURE__*/_react["default"].createElement("div", {
5251
+ }, obj.common.alias.id.read ? /*#__PURE__*/_react["default"].createElement("div", {
5165
5252
  onClick: function onClick(e) {
5166
5253
  e.stopPropagation();
5167
5254
  e.preventDefault();
5168
5255
 
5169
- _this37.onSelect(item.data.obj.common.alias.id.read);
5256
+ _this37.onSelect(obj.common.alias.id.read);
5170
5257
 
5171
5258
  setTimeout(function () {
5172
5259
  _this37.expandAllSelected(function () {
5173
- return _this37.scrollToItem(item.data.obj.common.alias.id.read);
5260
+ return _this37.scrollToItem(obj.common.alias.id.read);
5174
5261
  });
5175
5262
  }, 100);
5176
5263
  },
5177
5264
  className: _Utils["default"].clsx(classes.cellIdAlias, classes.cellIdAliasReadWrite)
5178
- }, "\u2190", item.data.obj.common.alias.id.read) : null, item.data.obj.common.alias.id.write ? /*#__PURE__*/_react["default"].createElement("div", {
5265
+ }, "\u2190", obj.common.alias.id.read) : null, obj.common.alias.id.write ? /*#__PURE__*/_react["default"].createElement("div", {
5179
5266
  onClick: function onClick(e) {
5180
5267
  e.stopPropagation();
5181
5268
  e.preventDefault();
5182
5269
 
5183
- _this37.onSelect(item.data.obj.common.alias.id.write);
5270
+ _this37.onSelect(obj.common.alias.id.write);
5184
5271
 
5185
5272
  setTimeout(function () {
5186
5273
  _this37.expandAllSelected(function () {
5187
- return _this37.scrollToItem(item.data.obj.common.alias.id.write);
5274
+ return _this37.scrollToItem(obj.common.alias.id.write);
5188
5275
  });
5189
5276
  }, 100);
5190
5277
  },
5191
5278
  className: _Utils["default"].clsx(classes.cellIdAlias, classes.cellIdAliasReadWrite)
5192
- }, "\u2192", item.data.obj.common.alias.id.write) : null) : /*#__PURE__*/_react["default"].createElement("div", {
5279
+ }, "\u2192", obj.common.alias.id.write) : null) : /*#__PURE__*/_react["default"].createElement("div", {
5193
5280
  onClick: function onClick(e) {
5194
5281
  e.stopPropagation();
5195
5282
  e.preventDefault();
5196
5283
 
5197
- _this37.onSelect(item.data.obj.common.alias.id);
5284
+ _this37.onSelect(obj.common.alias.id);
5198
5285
 
5199
5286
  setTimeout(function () {
5200
5287
  _this37.expandAllSelected(function () {
5201
- return _this37.scrollToItem(item.data.obj.common.alias.id);
5288
+ return _this37.scrollToItem(obj.common.alias.id);
5202
5289
  });
5203
5290
  }, 100);
5204
5291
  },
5205
5292
  className: _Utils["default"].clsx(classes.cellIdAlias, classes.cellIdAliasAlone)
5206
- }, "\u2192", item.data.obj.common.alias.id) : null;
5207
- var checkColor = (_item$data = item.data) === null || _item$data === void 0 ? void 0 : (_item$data$obj8 = _item$data.obj) === null || _item$data$obj8 === void 0 ? void 0 : (_item$data$obj8$commo = _item$data$obj8.common) === null || _item$data$obj8$commo === void 0 ? void 0 : _item$data$obj8$commo.color;
5293
+ }, "\u2192", obj.common.alias.id) : null;
5294
+ var checkColor = (_item$data = item.data) === null || _item$data === void 0 ? void 0 : (_item$data$common = _item$data.common) === null || _item$data$common === void 0 ? void 0 : _item$data$common.color;
5208
5295
  var invertBackground = 'none';
5209
5296
 
5210
5297
  if (checkColor && !this.state.selected.includes(id)) {
@@ -5215,6 +5302,111 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5215
5302
  checkColor = 'inherit';
5216
5303
  }
5217
5304
 
5305
+ var icons = [];
5306
+
5307
+ if (common !== null && common !== void 0 && common.statusStates) {
5308
+ var ids = {};
5309
+ Object.keys(common.statusStates).forEach(function (name) {
5310
+ var _id = common.statusStates[name];
5311
+
5312
+ if (_id.split('.').length < 3) {
5313
+ _id = id + '.' + _id;
5314
+ }
5315
+
5316
+ ids[name] = _id;
5317
+
5318
+ if (!_this37.states[_id]) {
5319
+ var _this37$objects$_id;
5320
+
5321
+ if (((_this37$objects$_id = _this37.objects[_id]) === null || _this37$objects$_id === void 0 ? void 0 : _this37$objects$_id.type) === 'state') {
5322
+ !_this37.recordStates.includes(_id) && _this37.recordStates.push(_id);
5323
+ _this37.states[_id] = {
5324
+ val: null
5325
+ };
5326
+
5327
+ _this37.subscribe(_id);
5328
+ }
5329
+ } else {
5330
+ !_this37.recordStates.includes(_id) && _this37.recordStates.push(_id);
5331
+ }
5332
+ }); // calculate color
5333
+ // errorId has priority
5334
+
5335
+ var colorSet = false;
5336
+
5337
+ if (common.statusStates.errorId && this.states[ids.errorId] && this.states[ids.errorId].val) {
5338
+ checkColor = this.props.themeType === 'dark' ? COLOR_NAME_ERROR_DARK : COLOR_NAME_ERROR_LIGHT;
5339
+ colorSet = true;
5340
+ icons.push( /*#__PURE__*/_react["default"].createElement(_Error["default"], {
5341
+ key: "error",
5342
+ title: this.texts.deviceError,
5343
+ className: this.props.classes.iconDeviceError
5344
+ }));
5345
+ }
5346
+
5347
+ if (ids.onlineId && this.states[ids.onlineId] && this.states[ids.onlineId].val !== null) {
5348
+ if (!colorSet) {
5349
+ if (this.states[ids.onlineId].val) {
5350
+ checkColor = this.props.themeType === 'dark' ? COLOR_NAME_CONNECTED_DARK : COLOR_NAME_CONNECTED_LIGHT;
5351
+ icons.push( /*#__PURE__*/_react["default"].createElement(_Wifi["default"], {
5352
+ key: "conn",
5353
+ title: this.texts.deviceError,
5354
+ className: this.props.classes.iconDeviceConnected
5355
+ }));
5356
+ } else {
5357
+ checkColor = this.props.themeType === 'dark' ? COLOR_NAME_DISCONNECTED_DARK : COLOR_NAME_DISCONNECTED_LIGHT;
5358
+ icons.push( /*#__PURE__*/_react["default"].createElement(_WifiOff["default"], {
5359
+ key: "disc",
5360
+ title: this.texts.deviceError,
5361
+ className: this.props.classes.iconDeviceDisconnected
5362
+ }));
5363
+ }
5364
+ } else if (this.states[ids.onlineId].val) {
5365
+ icons.push( /*#__PURE__*/_react["default"].createElement(_Wifi["default"], {
5366
+ key: "conn",
5367
+ title: this.texts.deviceError,
5368
+ className: this.props.classes.iconDeviceConnected
5369
+ }));
5370
+ } else {
5371
+ icons.push( /*#__PURE__*/_react["default"].createElement(_WifiOff["default"], {
5372
+ key: "disc",
5373
+ title: this.texts.deviceError,
5374
+ className: this.props.classes.iconDeviceDisconnected
5375
+ }));
5376
+ }
5377
+ } else if (ids.offlineId && this.states[ids.offlineId] && this.states[ids.offlineId].val !== null) {
5378
+ if (!colorSet) {
5379
+ if (this.states[ids.offlineId].val) {
5380
+ checkColor = this.props.themeType === 'dark' ? COLOR_NAME_DISCONNECTED_DARK : COLOR_NAME_DISCONNECTED_LIGHT;
5381
+ icons.push( /*#__PURE__*/_react["default"].createElement(_WifiOff["default"], {
5382
+ key: "disc",
5383
+ title: this.texts.deviceError,
5384
+ className: this.props.classes.iconDeviceDisconnected
5385
+ }));
5386
+ } else {
5387
+ checkColor = this.props.themeType === 'dark' ? COLOR_NAME_CONNECTED_DARK : COLOR_NAME_CONNECTED_LIGHT;
5388
+ icons.push( /*#__PURE__*/_react["default"].createElement(_Wifi["default"], {
5389
+ key: "conn",
5390
+ title: this.texts.deviceError,
5391
+ className: this.props.classes.iconDeviceConnected
5392
+ }));
5393
+ }
5394
+ } else if (this.states[ids.offlineId].val) {
5395
+ icons.push( /*#__PURE__*/_react["default"].createElement(_WifiOff["default"], {
5396
+ key: "disc",
5397
+ title: this.texts.deviceError,
5398
+ className: this.props.classes.iconDeviceDisconnected
5399
+ }));
5400
+ } else {
5401
+ icons.push( /*#__PURE__*/_react["default"].createElement(_Wifi["default"], {
5402
+ key: "conn",
5403
+ title: this.texts.deviceError,
5404
+ className: this.props.classes.iconDeviceConnected
5405
+ }));
5406
+ }
5407
+ }
5408
+ }
5409
+
5218
5410
  var q = checkVisibleObjectType ? _Utils["default"].quality2text(((_this$states$id2 = this.states[id]) === null || _this$states$id2 === void 0 ? void 0 : _this$states$id2.q) || 0).join(', ') : null;
5219
5411
  return /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
5220
5412
  container: true,
@@ -5258,7 +5450,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5258
5450
  background: invertBackground,
5259
5451
  color: id === 'system' ? COLOR_NAME_SYSTEM : id === 'system.adapter' ? COLOR_NAME_SYSTEM_ADAPTER : checkColor
5260
5452
  }
5261
- }, item.data.name, alias), /*#__PURE__*/_react["default"].createElement("div", {
5453
+ }, item.data.name, alias, icons), /*#__PURE__*/_react["default"].createElement("div", {
5262
5454
  style: {
5263
5455
  color: checkColor,
5264
5456
  background: invertBackground
@@ -5282,7 +5474,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5282
5474
  style: {
5283
5475
  width: this.columnsVisibility.name
5284
5476
  }
5285
- }, ((_item$data2 = item.data) === null || _item$data2 === void 0 ? void 0 : _item$data2.title) || '') : null, !this.state.statesView ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.columnsVisibility.type ? /*#__PURE__*/_react["default"].createElement("div", {
5477
+ }, ((_item$data2 = item.data) === null || _item$data2 === void 0 ? void 0 : _item$data2.title) || '', (_item$data3 = item.data) !== null && _item$data3 !== void 0 && _item$data3.title ? /*#__PURE__*/_react["default"].createElement("div", {
5478
+ style: {
5479
+ color: checkColor
5480
+ }
5481
+ }, /*#__PURE__*/_react["default"].createElement(_IconCopy["default"], {
5482
+ className: _Utils["default"].clsx(classes.cellCopyButton, 'copyButton'),
5483
+ onClick: function onClick(e) {
5484
+ return _this37.onCopy(e, item.data.title);
5485
+ }
5486
+ })) : null) : null, !this.state.statesView ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.columnsVisibility.type ? /*#__PURE__*/_react["default"].createElement("div", {
5286
5487
  className: classes.cellType,
5287
5488
  style: {
5288
5489
  width: this.columnsVisibility.type
@@ -5369,12 +5570,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5369
5570
  className: classes.cellValue,
5370
5571
  style: {
5371
5572
  width: this.columnsVisibility.val,
5372
- cursor: valueEditable ? item.data.button ? 'grab' : 'text' : 'default'
5573
+ cursor: valueEditable ? (common === null || common === void 0 ? void 0 : common.type) === 'file' ? 'zoom-in' : item.data.button ? 'grab' : 'text' : 'default'
5373
5574
  },
5374
5575
  onClick: valueEditable ? function () {
5375
- if (!item.data.obj || !_this37.states) {
5576
+ if (!obj || !_this37.states) {
5376
5577
  return null;
5377
- } // in non expert mode control button directly
5578
+ }
5579
+
5580
+ if ((common === null || common === void 0 ? void 0 : common.type) === 'file') {
5581
+ return _this37.setState({
5582
+ viewFileDialog: id
5583
+ });
5584
+ } // in non-expert mode control button directly
5378
5585
 
5379
5586
 
5380
5587
  if (!_this37.props.expertMode && item.data.button) {
@@ -5943,11 +6150,41 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5943
6150
  * @returns {JSX.Element | null}
5944
6151
  */
5945
6152
 
6153
+ }, {
6154
+ key: "renderViewObjectFileDialog",
6155
+ value: function renderViewObjectFileDialog() {
6156
+ var _this46 = this;
6157
+
6158
+ if (!this.state.viewFileDialog || !this.props.objectBrowserViewFile) {
6159
+ return null;
6160
+ }
6161
+
6162
+ var ObjectBrowserViewFile = this.props.objectBrowserViewFile;
6163
+ return /*#__PURE__*/_react["default"].createElement(ObjectBrowserViewFile, {
6164
+ key: "viewFile",
6165
+ obj: this.objects[this.state.viewFileDialog],
6166
+ themeType: this.props.themeType,
6167
+ socket: this.props.socket,
6168
+ dialogName: this.props.dialogName,
6169
+ t: this.props.t,
6170
+ expertMode: this.state.filter.expertMode,
6171
+ onClose: function onClose() {
6172
+ return _this46.setState({
6173
+ viewFileDialog: ''
6174
+ });
6175
+ }
6176
+ });
6177
+ }
6178
+ /**
6179
+ * @private
6180
+ * @returns {JSX.Element | null}
6181
+ */
6182
+
5946
6183
  }, {
5947
6184
  key: "renderEditValueDialog",
5948
6185
  value: function renderEditValueDialog() {
5949
6186
  var _this$objects$this$ed,
5950
- _this46 = this;
6187
+ _this47 = this;
5951
6188
 
5952
6189
  if (!this.state.updateOpened || !this.props.objectBrowserValue) {
5953
6190
  return null;
@@ -5968,11 +6205,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5968
6205
  defaultHistory: this.defaultHistory,
5969
6206
  dateFormat: this.props.dateFormat,
5970
6207
  onClose: function onClose(res) {
5971
- _this46.setState({
6208
+ _this47.setState({
5972
6209
  updateOpened: false
5973
6210
  });
5974
6211
 
5975
- res && _this46.onUpdate(res);
6212
+ res && _this47.onUpdate(res);
5976
6213
  }
5977
6214
  });
5978
6215
  }
@@ -5984,7 +6221,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5984
6221
  * @returns {JSX.Element}
5985
6222
  */
5986
6223
  function render() {
5987
- var _this47 = this;
6224
+ var _this48 = this;
5988
6225
 
5989
6226
  this.recordStates = [];
5990
6227
  this.unsubscribeTimer && clearTimeout(this.unsubscribeTimer); // apply filter if changed
@@ -5999,13 +6236,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
5999
6236
 
6000
6237
  if (counter.count < 500 && !this.state.expandAllVisible) {
6001
6238
  setTimeout(function () {
6002
- return _this47.setState({
6239
+ return _this48.setState({
6003
6240
  expandAllVisible: true
6004
6241
  });
6005
6242
  });
6006
6243
  } else if (counter.count >= 500 && this.state.expandAllVisible) {
6007
6244
  setTimeout(function () {
6008
- return _this47.setState({
6245
+ return _this48.setState({
6009
6246
  expandAllVisible: false
6010
6247
  });
6011
6248
  });
@@ -6015,9 +6252,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
6015
6252
  }
6016
6253
 
6017
6254
  this.unsubscribeTimer = setTimeout(function () {
6018
- _this47.unsubscribeTimer = null;
6255
+ _this48.unsubscribeTimer = null;
6019
6256
 
6020
- _this47.checkUnsubscribes();
6257
+ _this48.checkUnsubscribes();
6021
6258
  }, 200);
6022
6259
 
6023
6260
  if (!this.state.loaded) {
@@ -6032,7 +6269,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
6032
6269
  }, /*#__PURE__*/_react["default"].createElement(_TabHeader["default"], null, this.getToolbar()), /*#__PURE__*/_react["default"].createElement(_TabContent["default"], null, this.renderHeader(), /*#__PURE__*/_react["default"].createElement("div", {
6033
6270
  className: this.props.classes.tableDiv,
6034
6271
  ref: this.tableRef
6035
- }, items)), this.renderToast(), this.renderColumnsEditCustomDialog(), this.renderColumnsSelectorDialog(), this.renderCustomDialog(), this.renderEditValueDialog(), this.renderEditObjectDialog(), this.renderEditRoleDialog(), this.renderEnumDialog(), this.renderErrorDialog(), this.renderExportDialog(), this.state.modalNewObj && this.props.modalNewObject && this.props.modalNewObject(this), this.state.modalEditOfAccess && this.props.modalEditOfAccessControl && this.props.modalEditOfAccessControl(this, this.state.modalEditOfAccessObjData));
6272
+ }, items)), this.renderToast(), this.renderColumnsEditCustomDialog(), this.renderColumnsSelectorDialog(), this.renderCustomDialog(), this.renderEditValueDialog(), this.renderEditObjectDialog(), this.renderViewObjectFileDialog(), this.renderEditRoleDialog(), this.renderEnumDialog(), this.renderErrorDialog(), this.renderExportDialog(), this.state.modalNewObj && this.props.modalNewObject && this.props.modalNewObject(this), this.state.modalEditOfAccess && this.props.modalEditOfAccessControl && this.props.modalEditOfAccessControl(this, this.state.modalEditOfAccessObjData));
6036
6273
  }
6037
6274
  }
6038
6275
  }], [{
@@ -6111,6 +6348,8 @@ ObjectBrowser.propTypes = {
6111
6348
  objectBrowserEditObject: _propTypes["default"].object,
6112
6349
  objectBrowserEditRole: _propTypes["default"].object,
6113
6350
  // on Edit role
6351
+ objectBrowserViewFile: _propTypes["default"].func,
6352
+ // on view file state
6114
6353
  router: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].func]),
6115
6354
  types: _propTypes["default"].array,
6116
6355
  // optional ['state', 'instance', 'channel']
@@ -6119,7 +6358,7 @@ ObjectBrowser.propTypes = {
6119
6358
  objectsWorker: _propTypes["default"].object,
6120
6359
  // optional cache of objects
6121
6360
  filterFunc: _propTypes["default"].func,
6122
- // function to filter out all unneccessary objects. It cannot be used together with "types"
6361
+ // function to filter out all unnecessary objects. It cannot be used together with "types"
6123
6362
  // Example for function: `obj => obj.common && obj.common.type === 'boolean'` to show only boolean states
6124
6363
  dragSettings: _propTypes["default"].object,
6125
6364
  DragWrapper: _propTypes["default"].func,