@iobroker/adapter-react-v5 6.1.9 → 7.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 (210) hide show
  1. package/Components/404.js +13 -13
  2. package/Components/FileBrowser.js +24 -19
  3. package/Components/FileViewer.js +14 -5
  4. package/Components/Loader.js +223 -223
  5. package/Components/Loaders/PT.css +108 -108
  6. package/Components/Loaders/PT.js +103 -103
  7. package/Components/Loaders/Vendor.css +13 -13
  8. package/Components/Loaders/Vendor.js +7 -7
  9. package/Components/ObjectBrowser.d.ts +2 -0
  10. package/Components/ObjectBrowser.js +214 -115
  11. package/Components/UploadImage.js +305 -305
  12. package/Components/loader.css +221 -221
  13. package/Components/types.d.ts +82 -82
  14. package/GenericApp.js +49 -49
  15. package/LICENSE +22 -22
  16. package/Prompt.js +7 -7
  17. package/README.md +1004 -1008
  18. package/Theme.js +8 -7
  19. package/assets/devices/Alarm Systems.svg +18 -18
  20. package/assets/devices/Amplifier.svg +21 -21
  21. package/assets/devices/Awnings.svg +4 -4
  22. package/assets/devices/Battery Status.svg +4 -4
  23. package/assets/devices/Ceiling Spotlights.svg +15 -15
  24. package/assets/devices/Chandelier.svg +6 -6
  25. package/assets/devices/Climate.svg +11 -11
  26. package/assets/devices/Coffee Makers.svg +5 -5
  27. package/assets/devices/Cold Water.svg +31 -31
  28. package/assets/devices/Computer.svg +21 -21
  29. package/assets/devices/Consumption.svg +7 -7
  30. package/assets/devices/Curtains.svg +43 -43
  31. package/assets/devices/Dishwashers.svg +11 -11
  32. package/assets/devices/Doors.svg +5 -5
  33. package/assets/devices/Doorstep.svg +35 -35
  34. package/assets/devices/Dryer.svg +13 -13
  35. package/assets/devices/Fan.svg +20 -20
  36. package/assets/devices/Floor Lamps.svg +4 -4
  37. package/assets/devices/Garage Doors.svg +9 -9
  38. package/assets/devices/Gates.svg +32 -32
  39. package/assets/devices/Hairdryer.svg +23 -23
  40. package/assets/devices/Handle.svg +6 -6
  41. package/assets/devices/Hanging Lamps.svg +8 -8
  42. package/assets/devices/Heater.svg +44 -44
  43. package/assets/devices/Hoods.svg +11 -11
  44. package/assets/devices/Hot Water.svg +9 -9
  45. package/assets/devices/Humidity.svg +41 -41
  46. package/assets/devices/Iron.svg +4 -4
  47. package/assets/devices/Irrigation.svg +22 -22
  48. package/assets/devices/Led Strip.svg +30 -30
  49. package/assets/devices/Light.svg +29 -29
  50. package/assets/devices/Lightings.svg +46 -46
  51. package/assets/devices/Lock.svg +19 -19
  52. package/assets/devices/Louvre.svg +6 -6
  53. package/assets/devices/Mowing Machine.svg +8 -8
  54. package/assets/devices/Music.svg +12 -12
  55. package/assets/devices/Outdoor Blinds.svg +6 -6
  56. package/assets/devices/People.svg +19 -19
  57. package/assets/devices/Pool.svg +7 -7
  58. package/assets/devices/Power Consumption.svg +12 -12
  59. package/assets/devices/Printer.svg +9 -9
  60. package/assets/devices/Pump.svg +9 -9
  61. package/assets/devices/Receiver.svg +18 -18
  62. package/assets/devices/Sconces.svg +9 -9
  63. package/assets/devices/Security.svg +34 -34
  64. package/assets/devices/Shading.svg +4 -4
  65. package/assets/devices/Shutters.svg +10 -10
  66. package/assets/devices/SmokeDetector.svg +12 -12
  67. package/assets/devices/Sockets.svg +13 -13
  68. package/assets/devices/Speaker.svg +35 -35
  69. package/assets/devices/Stove.svg +11 -11
  70. package/assets/devices/Table Lamps.svg +11 -11
  71. package/assets/devices/Temperature Sensors.svg +28 -28
  72. package/assets/devices/Tv.svg +7 -7
  73. package/assets/devices/Vacuum Cleaner.svg +15 -15
  74. package/assets/devices/Ventilation.svg +12 -12
  75. package/assets/devices/Washing Machines.svg +15 -15
  76. package/assets/devices/Water Consumption.svg +5 -5
  77. package/assets/devices/Water Heater.svg +8 -8
  78. package/assets/devices/Water.svg +40 -40
  79. package/assets/devices/Weather.svg +28 -28
  80. package/assets/devices/Window.svg +7 -7
  81. package/assets/lamp_ceiling.svg +8 -8
  82. package/assets/lamp_table.svg +7 -7
  83. package/assets/no_icon.svg +9 -9
  84. package/assets/rooms/Anteroom.svg +52 -52
  85. package/assets/rooms/Attic.svg +21 -21
  86. package/assets/rooms/Balcony.svg +12 -12
  87. package/assets/rooms/Barn.svg +5 -5
  88. package/assets/rooms/Basement.svg +4 -4
  89. package/assets/rooms/Bathroom.svg +38 -38
  90. package/assets/rooms/Bedroom.svg +5 -5
  91. package/assets/rooms/Boiler Room.svg +12 -12
  92. package/assets/rooms/Carport.svg +17 -17
  93. package/assets/rooms/Cellar.svg +89 -89
  94. package/assets/rooms/Chamber.svg +9 -9
  95. package/assets/rooms/Corridor.svg +52 -52
  96. package/assets/rooms/Dining Area.svg +37 -37
  97. package/assets/rooms/Dining Room.svg +37 -37
  98. package/assets/rooms/Dining.svg +37 -37
  99. package/assets/rooms/Dressing Room.svg +4 -4
  100. package/assets/rooms/Driveway.svg +14 -14
  101. package/assets/rooms/Entrance.svg +44 -44
  102. package/assets/rooms/Equipment Room.svg +14 -14
  103. package/assets/rooms/Front Yard.svg +64 -64
  104. package/assets/rooms/Gallery.svg +13 -13
  105. package/assets/rooms/Garage.svg +20 -20
  106. package/assets/rooms/Garden.svg +12 -12
  107. package/assets/rooms/Ground Floor.svg +95 -95
  108. package/assets/rooms/Guest Bathroom.svg +32 -32
  109. package/assets/rooms/Guest Room.svg +5 -5
  110. package/assets/rooms/Gym.svg +4 -4
  111. package/assets/rooms/Hall.svg +19 -19
  112. package/assets/rooms/Home Theater.svg +7 -7
  113. package/assets/rooms/Kitchen.svg +17 -17
  114. package/assets/rooms/Laundry Room.svg +11 -11
  115. package/assets/rooms/Living Area.svg +10 -10
  116. package/assets/rooms/Living Room.svg +10 -10
  117. package/assets/rooms/Locker Room.svg +16 -16
  118. package/assets/rooms/Nursery.svg +4 -4
  119. package/assets/rooms/Office.svg +8 -8
  120. package/assets/rooms/Outdoors.svg +7 -7
  121. package/assets/rooms/Playroom.svg +5 -5
  122. package/assets/rooms/Pool.svg +7 -7
  123. package/assets/rooms/Rear Wall.svg +30 -30
  124. package/assets/rooms/Second Floor.svg +95 -95
  125. package/assets/rooms/Shed.svg +16 -16
  126. package/assets/rooms/Sleeping Area.svg +22 -22
  127. package/assets/rooms/Stairway.svg +4 -4
  128. package/assets/rooms/Stairwell.svg +15 -15
  129. package/assets/rooms/Storeroom.svg +4 -4
  130. package/assets/rooms/Summer House.svg +27 -27
  131. package/assets/rooms/Swimming Pool.svg +21 -21
  132. package/assets/rooms/Terrace.svg +6 -6
  133. package/assets/rooms/Toilet.svg +10 -10
  134. package/assets/rooms/Upstairs.svg +5 -5
  135. package/assets/rooms/Wardrobe.svg +60 -60
  136. package/assets/rooms/Washroom.svg +19 -19
  137. package/assets/rooms/Wc.svg +10 -10
  138. package/assets/rooms/Windscreen.svg +60 -60
  139. package/assets/rooms/Workshop.svg +22 -22
  140. package/assets/rooms/Workspace.svg +8 -8
  141. package/craco-module-federation.js +71 -71
  142. package/icons/IconFx.js +1 -1
  143. package/icons/IconLogout.js +1 -1
  144. package/index.css +54 -54
  145. package/modulefederation.admin.config.js +31 -31
  146. package/package.json +9 -9
  147. package/src/AdminConnection.tsx +3 -3
  148. package/src/Components/404.tsx +121 -121
  149. package/src/Components/ColorPicker.tsx +315 -315
  150. package/src/Components/ComplexCron.tsx +507 -507
  151. package/src/Components/CopyToClipboard.tsx +165 -165
  152. package/src/Components/CustomModal.tsx +163 -163
  153. package/src/Components/FileBrowser.tsx +2414 -2394
  154. package/src/Components/FileViewer.tsx +393 -384
  155. package/src/Components/Icon.tsx +210 -210
  156. package/src/Components/IconPicker.tsx +149 -149
  157. package/src/Components/IconSelector.tsx +2202 -2202
  158. package/src/Components/Image.tsx +176 -176
  159. package/src/Components/Loader.tsx +304 -304
  160. package/src/Components/Logo.tsx +166 -166
  161. package/src/Components/MDUtils.tsx +100 -100
  162. package/src/Components/ObjectBrowser.tsx +8032 -7915
  163. package/src/Components/Router.tsx +90 -90
  164. package/src/Components/SaveCloseButtons.tsx +113 -113
  165. package/src/Components/Schedule.tsx +1724 -1724
  166. package/src/Components/SelectWithIcon.tsx +197 -197
  167. package/src/Components/TabContainer.tsx +55 -55
  168. package/src/Components/TabContent.tsx +37 -37
  169. package/src/Components/TabHeader.tsx +19 -19
  170. package/src/Components/TableResize.tsx +259 -259
  171. package/src/Components/TextWithIcon.tsx +148 -148
  172. package/src/Components/ToggleThemeMenu.tsx +34 -34
  173. package/src/Components/TreeTable.tsx +919 -919
  174. package/src/Components/UploadImage.tsx +599 -599
  175. package/src/Components/Utils.tsx +1794 -1794
  176. package/src/Components/loader.css +221 -221
  177. package/src/Components/withWidth.tsx +21 -21
  178. package/src/Connection.tsx +7 -7
  179. package/src/Dialogs/ComplexCron.tsx +129 -129
  180. package/src/Dialogs/Confirm.tsx +162 -162
  181. package/src/Dialogs/Cron.tsx +182 -182
  182. package/src/Dialogs/Error.tsx +72 -72
  183. package/src/Dialogs/Message.tsx +71 -71
  184. package/src/Dialogs/SelectFile.tsx +270 -270
  185. package/src/Dialogs/SelectID.tsx +298 -298
  186. package/src/Dialogs/SimpleCron.tsx +100 -100
  187. package/src/Dialogs/TextInput.tsx +107 -107
  188. package/src/GenericApp.tsx +976 -976
  189. package/src/LegacyConnection.tsx +3589 -3589
  190. package/src/Prompt.tsx +20 -20
  191. package/src/Theme.tsx +479 -479
  192. package/src/icons/IconAdapter.tsx +20 -20
  193. package/src/icons/IconAlias.tsx +20 -20
  194. package/src/icons/IconChannel.tsx +21 -21
  195. package/src/icons/IconClearFilter.tsx +22 -22
  196. package/src/icons/IconClosed.tsx +17 -17
  197. package/src/icons/IconCopy.tsx +16 -16
  198. package/src/icons/IconDevice.tsx +27 -27
  199. package/src/icons/IconDocument.tsx +17 -17
  200. package/src/icons/IconDocumentReadOnly.tsx +18 -18
  201. package/src/icons/IconExpert.tsx +18 -18
  202. package/src/icons/IconFx.tsx +36 -36
  203. package/src/icons/IconInstance.tsx +20 -20
  204. package/src/icons/IconLogout.tsx +30 -30
  205. package/src/icons/IconNoIcon.tsx +19 -19
  206. package/src/icons/IconOpen.tsx +17 -17
  207. package/src/icons/IconProps.tsx +15 -15
  208. package/src/icons/IconState.tsx +17 -17
  209. package/src/index.css +54 -54
  210. package/types.d.ts +134 -134
@@ -251,7 +251,7 @@ const styles = {
251
251
  // display: 'inline-block',
252
252
  // verticalAlign: 'top',
253
253
  },
254
- // this style is used for simple div. Do not migrate it to "secondary.main"
254
+ // This style is used for simple div. Do not migrate it to "secondary.main"
255
255
  cellIdIconFolder: (theme) => ({
256
256
  marginRight: 8,
257
257
  width: ROW_HEIGHT - 4,
@@ -390,9 +390,6 @@ const styles = {
390
390
  },
391
391
  cellValueButton: {
392
392
  marginTop: 5,
393
- '&:active': {
394
- transform: 'scale(0.8)',
395
- },
396
393
  },
397
394
  cellValueButtonFalse: {
398
395
  opacity: 0.3,
@@ -408,7 +405,7 @@ const styles = {
408
405
  width: '100%',
409
406
  height: ROW_HEIGHT,
410
407
  fontSize: 16,
411
- display: 'inline-block',
408
+ display: 'flex',
412
409
  overflow: 'hidden',
413
410
  textOverflow: 'ellipsis',
414
411
  position: 'relative',
@@ -455,6 +452,7 @@ const styles = {
455
452
  cellValueTextUnit: {
456
453
  marginLeft: 4,
457
454
  opacity: 0.8,
455
+ display: 'inline-block',
458
456
  },
459
457
  cellValueTextState: {
460
458
  opacity: 0.7,
@@ -529,7 +527,7 @@ const styles = {
529
527
  cellDetailsName: {
530
528
  fontWeight: 'bold',
531
529
  marginRight: 8,
532
- minWidth: 100,
530
+ minWidth: 80,
533
531
  },
534
532
  filteredOut: {
535
533
  opacity: 0.5,
@@ -750,6 +748,12 @@ const styles = {
750
748
  display: 'flex',
751
749
  },
752
750
  };
751
+ function ButtonIcon(props) {
752
+ return react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 436 436", style: props === null || props === void 0 ? void 0 : props.style, width: "24", height: "24", className: "admin-button" },
753
+ react_1.default.createElement("g", { fill: "currentColor" },
754
+ react_1.default.createElement("path", { d: "m195.23077,24.30769c-36,3 -67,12 -96,26c-49,24 -82,61 -93,104l-3,11l-1,50c0,46 0,49 2,59l5,20c21,58 84,103 165,116c16,3 53,4 70,2c60,-6 111,-28 147,-64c21,-21 36,-49 40,-74a866,866 0 0 0 1,-104c-3,-18 -6,-28 -13,-43c-26,-52 -87,-90 -162,-101c-16,-2 -48,-3 -63,-2l1,0zm60,23c36,5 70,18 95,35c31,20 51,47 59,77c2,7 2,11 2,25c1,15 0,18 -2,26c-19,69 -104,117 -200,114c-47,-2 -90,-15 -124,-38c-31,-20 -51,-47 -59,-77c-3,-11 -4,-32 -2,-43c8,-42 41,-78 91,-101a260,260 0 0 1 140,-19l0,1zm-221,222c21,26 57,49 95,62c81,27 174,14 239,-32c14,-10 31,-27 41,-41c2,-2 2,-2 2,7c-1,23 -16,50 -38,72c-78,74 -233,74 -311,-1a121,121 0 0 1 -39,-76l0,-6l3,4l8,11z" }),
755
+ react_1.default.createElement("path", { d: "m201.23077,47.30769c-40,3 -79,19 -104,44c-55,55 -38,133 37,171c52,26 122,24 172,-5c30,-17 51,-42 58,-71c3,-11 3,-34 0,-45c-6,-23 -21,-44 -40,-60l-27,-16a184,184 0 0 0 -96,-18zm30,21c56,5 100,35 112,75c4,11 4,30 0,41c-8,25 -26,45 -54,59a166,166 0 0 1 -160,-8a98,98 0 0 1 -41,-53c-5,-18 -2,-39 8,-57c23,-39 79,-62 135,-57z" })));
756
+ }
753
757
  /**
754
758
  * Function that walks through all keys of an object or array and applies a function to each key.
755
759
  */
@@ -1136,7 +1140,9 @@ function getVisibleItems(item, type, objects, _result) {
1136
1140
  _result = _result || [];
1137
1141
  const data = item.data;
1138
1142
  if (data.sumVisibility) {
1139
- data.id && objects[data.id] && (!type || objects[data.id].type === type) && _result.push(data.id);
1143
+ if (data.id && objects[data.id] && (!type || objects[data.id].type === type)) {
1144
+ _result.push(data.id);
1145
+ }
1140
1146
  (_b = item.children) === null || _b === void 0 ? void 0 : _b.forEach(_item => getVisibleItems(_item, type, objects, _result));
1141
1147
  }
1142
1148
  return _result;
@@ -1197,7 +1203,7 @@ function getIdFieldTooltip(data, lang) {
1197
1203
  return react_1.default.createElement("span", { style: styles.cellIdTooltip }, tooltip || data.id || '');
1198
1204
  }
1199
1205
  function buildTree(objects, options) {
1200
- var _b, _c, _d, _e, _f;
1206
+ var _b, _c, _d, _e, _f, _g, _h, _j;
1201
1207
  const imagePrefix = options.imagePrefix || '.';
1202
1208
  let ids = Object.keys(objects);
1203
1209
  ids.sort((a, b) => {
@@ -1322,6 +1328,8 @@ function buildTree(objects, options) {
1322
1328
  typeof obj.common.role === 'string' &&
1323
1329
  obj.common.role.startsWith('button') &&
1324
1330
  ((_f = obj.common) === null || _f === void 0 ? void 0 : _f.write) !== false,
1331
+ switch: obj.type === 'state' && ((_g = obj.common) === null || _g === void 0 ? void 0 : _g.type) === 'boolean' &&
1332
+ ((_h = obj.common) === null || _h === void 0 ? void 0 : _h.write) !== false && ((_j = obj.common) === null || _j === void 0 ? void 0 : _j.read) !== false,
1325
1333
  },
1326
1334
  };
1327
1335
  cRoot.children = cRoot.children || [];
@@ -1625,7 +1633,7 @@ function formatValue(options) {
1625
1633
  };
1626
1634
  }
1627
1635
  /**
1628
- * Get css style for given state value
1636
+ * Get CSS style for given state value
1629
1637
  */
1630
1638
  function getValueStyle(options) {
1631
1639
  const { state, isExpertMode, isButton } = options;
@@ -1876,7 +1884,9 @@ class ObjectBrowserClass extends react_1.Component {
1876
1884
  newState = newInnerState;
1877
1885
  }
1878
1886
  });
1879
- newState && this.setState(newState);
1887
+ if (newState) {
1888
+ this.setState(newState);
1889
+ }
1880
1890
  this.afterObjectUpdated();
1881
1891
  }
1882
1892
  };
@@ -1885,7 +1895,9 @@ class ObjectBrowserClass extends react_1.Component {
1885
1895
  if (filtered) {
1886
1896
  return;
1887
1897
  }
1888
- newInnerState && this.setState(newInnerState);
1898
+ if (newInnerState) {
1899
+ this.setState(newInnerState);
1900
+ }
1889
1901
  this.afterObjectUpdated();
1890
1902
  };
1891
1903
  this.getEnumsForId = (id) => {
@@ -2121,7 +2133,9 @@ class ObjectBrowserClass extends react_1.Component {
2121
2133
  this.resizerCurrentWidths.name = width - this.state.scrollBarWidth;
2122
2134
  }
2123
2135
  this.customWidth = true;
2124
- this.resizeTimeout && clearTimeout(this.resizeTimeout);
2136
+ if (this.resizeTimeout) {
2137
+ clearTimeout(this.resizeTimeout);
2138
+ }
2125
2139
  this.resizeTimeout = setTimeout(() => {
2126
2140
  this.resizeTimeout = null;
2127
2141
  this.forceUpdate();
@@ -2193,7 +2207,7 @@ class ObjectBrowserClass extends react_1.Component {
2193
2207
  const lastSelectedItems = JSON.parse(lastSelectedItemStr);
2194
2208
  this.selectFirst = lastSelectedItems[0] || '';
2195
2209
  }
2196
- catch (e) {
2210
+ catch (_b) {
2197
2211
  // ignore
2198
2212
  }
2199
2213
  }
@@ -2205,7 +2219,7 @@ class ObjectBrowserClass extends react_1.Component {
2205
2219
  try {
2206
2220
  expanded = JSON.parse(expandedStr);
2207
2221
  }
2208
- catch (e) {
2222
+ catch (_c) {
2209
2223
  expanded = [];
2210
2224
  }
2211
2225
  let filter;
@@ -2216,7 +2230,7 @@ class ObjectBrowserClass extends react_1.Component {
2216
2230
  try {
2217
2231
  filter = JSON.parse(filterStr);
2218
2232
  }
2219
- catch (e) {
2233
+ catch (_d) {
2220
2234
  filter = Object.assign({}, DEFAULT_FILTER);
2221
2235
  }
2222
2236
  }
@@ -2237,7 +2251,9 @@ class ObjectBrowserClass extends react_1.Component {
2237
2251
  // remove type column if only one type must be selected
2238
2252
  if (props.types && props.types.length === 1) {
2239
2253
  const pos = this.visibleCols.indexOf('type');
2240
- pos !== -1 && this.visibleCols.splice(pos, 1);
2254
+ if (pos !== -1) {
2255
+ this.visibleCols.splice(pos, 1);
2256
+ }
2241
2257
  }
2242
2258
  this.possibleCols = SCREEN_WIDTHS.xl.fields;
2243
2259
  let customDialog = null;
@@ -2262,14 +2278,14 @@ class ObjectBrowserClass extends react_1.Component {
2262
2278
  try {
2263
2279
  columns = columnsStr ? JSON.parse(columnsStr) : null;
2264
2280
  }
2265
- catch (e) {
2281
+ catch (_e) {
2266
2282
  columns = null;
2267
2283
  }
2268
2284
  let columnsWidths = null; // this.localStorage.getItem(`${props.dialogName || 'App'}.columnsWidths`);
2269
2285
  try {
2270
2286
  columnsWidths = columnsWidths ? JSON.parse(columnsWidths) : {};
2271
2287
  }
2272
- catch (e) {
2288
+ catch (_f) {
2273
2289
  columnsWidths = {};
2274
2290
  }
2275
2291
  this.imagePrefix = props.imagePrefix || '.';
@@ -2290,7 +2306,7 @@ class ObjectBrowserClass extends react_1.Component {
2290
2306
  ? JSON.parse(this.localStorage.getItem(`${props.dialogName || 'App'}.objectStatesView`) || '') || false
2291
2307
  : false;
2292
2308
  }
2293
- catch (error) {
2309
+ catch (_g) {
2294
2310
  // ignore
2295
2311
  }
2296
2312
  this.state = {
@@ -2410,7 +2426,7 @@ class ObjectBrowserClass extends react_1.Component {
2410
2426
  });
2411
2427
  this.customWidth = true;
2412
2428
  }
2413
- catch (e) {
2429
+ catch (_h) {
2414
2430
  // ignore
2415
2431
  }
2416
2432
  }
@@ -2510,7 +2526,9 @@ class ObjectBrowserClass extends react_1.Component {
2510
2526
  else {
2511
2527
  this.objects = objects;
2512
2528
  }
2513
- props.setObjectsReference && props.setObjectsReference(this.objects);
2529
+ if (props.setObjectsReference) {
2530
+ props.setObjectsReference(this.objects);
2531
+ }
2514
2532
  // read default history
2515
2533
  this.defaultHistory = this.systemConfig.common.defaultHistory;
2516
2534
  if (this.defaultHistory) {
@@ -2579,8 +2597,8 @@ class ObjectBrowserClass extends react_1.Component {
2579
2597
  this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectExpanded`, JSON.stringify(expanded));
2580
2598
  this.setState({ expanded }, cb);
2581
2599
  }
2582
- else {
2583
- cb && cb();
2600
+ else if (cb) {
2601
+ cb();
2584
2602
  }
2585
2603
  }
2586
2604
  /**
@@ -2596,7 +2614,9 @@ class ObjectBrowserClass extends react_1.Component {
2596
2614
  }
2597
2615
  if (this.state.selected.length === 1 && this.objects[this.state.selected[0]]) {
2598
2616
  const name = Utils_1.default.getObjectName(this.objects, this.state.selected[0], null, { language: this.props.lang });
2599
- this.props.onSelect && this.props.onSelect(this.state.selected, name, isDouble);
2617
+ if (this.props.onSelect) {
2618
+ this.props.onSelect(this.state.selected, name, isDouble);
2619
+ }
2600
2620
  }
2601
2621
  }
2602
2622
  else {
@@ -2604,8 +2624,8 @@ class ObjectBrowserClass extends react_1.Component {
2604
2624
  if (this.state.selected.length) {
2605
2625
  this.setState({ selected: [] }, () => this.props.onSelect && this.props.onSelect([], ''));
2606
2626
  }
2607
- else {
2608
- this.props.onSelect && this.props.onSelect([], '');
2627
+ else if (this.props.onSelect) {
2628
+ this.props.onSelect([], '');
2609
2629
  }
2610
2630
  }
2611
2631
  }
@@ -2637,8 +2657,10 @@ class ObjectBrowserClass extends react_1.Component {
2637
2657
  * Called when component is unmounted.
2638
2658
  */
2639
2659
  componentWillUnmount() {
2640
- this.filterTimer && clearTimeout(this.filterTimer);
2641
- this.filterTimer = null;
2660
+ if (this.filterTimer) {
2661
+ clearTimeout(this.filterTimer);
2662
+ this.filterTimer = null;
2663
+ }
2642
2664
  window.removeEventListener('contextmenu', this.onContextMenu, true);
2643
2665
  if (this.props.objectsWorker) {
2644
2666
  this.props.objectsWorker.unregisterHandler(this.onObjectChangeFromWorker, true);
@@ -2673,7 +2695,9 @@ class ObjectBrowserClass extends react_1.Component {
2673
2695
  break;
2674
2696
  }
2675
2697
  }
2676
- this.props.onObjectDelete && this.props.onObjectDelete(id, !!((_b = item.children) === null || _b === void 0 ? void 0 : _b.length), !((_c = obj.common) === null || _c === void 0 ? void 0 : _c.dontDelete), count + 1);
2698
+ if (this.props.onObjectDelete) {
2699
+ this.props.onObjectDelete(id, !!((_b = item.children) === null || _b === void 0 ? void 0 : _b.length), !((_c = obj.common) === null || _c === void 0 ? void 0 : _c.dontDelete), count + 1);
2700
+ }
2677
2701
  }
2678
2702
  /**
2679
2703
  * Called when component is mounted.
@@ -2722,7 +2746,9 @@ class ObjectBrowserClass extends react_1.Component {
2722
2746
  if (this.state.selected[0] !== toggleItem) {
2723
2747
  this.setState({ selected: [toggleItem], selectedNonObject: '', focused: toggleItem }, () => {
2724
2748
  this.onAfterSelect(isDouble);
2725
- cb && cb();
2749
+ if (cb) {
2750
+ cb();
2751
+ }
2726
2752
  });
2727
2753
  }
2728
2754
  else if (isDouble && this.props.onSelect) {
@@ -2733,7 +2759,9 @@ class ObjectBrowserClass extends react_1.Component {
2733
2759
  this.localStorage.setItem(`${this.props.dialogName || 'App'}.selectedNonObject`, toggleItem);
2734
2760
  this.setState({ selected: [], selectedNonObject: toggleItem, focused: toggleItem }, () => {
2735
2761
  this.onAfterSelect();
2736
- cb && cb();
2762
+ if (cb) {
2763
+ cb();
2764
+ }
2737
2765
  });
2738
2766
  }
2739
2767
  }
@@ -2751,7 +2779,9 @@ class ObjectBrowserClass extends react_1.Component {
2751
2779
  }
2752
2780
  this.setState({ selected, selectedNonObject: '', focused: toggleItem }, () => {
2753
2781
  this.onAfterSelect(isDouble);
2754
- cb && cb();
2782
+ if (cb) {
2783
+ cb();
2784
+ }
2755
2785
  });
2756
2786
  }
2757
2787
  }
@@ -2878,7 +2908,9 @@ class ObjectBrowserClass extends react_1.Component {
2878
2908
  checkUnsubscribes() {
2879
2909
  // Remove unused subscriptions
2880
2910
  for (let i = this.subscribes.length - 1; i >= 0; i--) {
2881
- !this.recordStates.includes(this.subscribes[i]) && this.unsubscribe(this.subscribes[i]);
2911
+ if (!this.recordStates.includes(this.subscribes[i])) {
2912
+ this.unsubscribe(this.subscribes[i]);
2913
+ }
2882
2914
  }
2883
2915
  this.recordStates = [];
2884
2916
  }
@@ -3029,7 +3061,9 @@ class ObjectBrowserClass extends react_1.Component {
3029
3061
  if (!this.subscribes.includes(id)) {
3030
3062
  this.subscribes.push(id);
3031
3063
  console.log(`+ subscribe ${id}`);
3032
- !this.pausedSubscribes && this.props.socket.subscribeState(id, this.onStateChange);
3064
+ if (!this.pausedSubscribes) {
3065
+ this.props.socket.subscribeState(id, this.onStateChange);
3066
+ }
3033
3067
  }
3034
3068
  }
3035
3069
  unsubscribe(id) {
@@ -3112,7 +3146,9 @@ class ObjectBrowserClass extends react_1.Component {
3112
3146
  // style={{ marginTop: 0, marginBottom: 0 }}
3113
3147
  margin: "dense" },
3114
3148
  react_1.default.createElement(material_1.Input, { ref: this.filterRefs[filterName], classes: { underline: 'no-underline' }, id: filterName, placeholder: this.texts[`filter_${filterName}`], defaultValue: this.state.filter[filterName] || '', onChange: () => {
3115
- this.filterTimer && clearTimeout(this.filterTimer);
3149
+ if (this.filterTimer) {
3150
+ clearTimeout(this.filterTimer);
3151
+ }
3116
3152
  this.filterTimer = setTimeout(() => this.onFilter(), 400);
3117
3153
  }, autoComplete: "off" }),
3118
3154
  ((_d = (_c = (_b = this.filterRefs[filterName]) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.firstChild) === null || _d === void 0 ? void 0 : _d.value) ? react_1.default.createElement("div", { style: {
@@ -3131,7 +3167,9 @@ class ObjectBrowserClass extends react_1.Component {
3131
3167
  const hasIcons = !!(values === null || values === void 0 ? void 0 : values.find(item => item.icon));
3132
3168
  return react_1.default.createElement("div", { style: { position: 'relative' } },
3133
3169
  react_1.default.createElement(material_1.Select, { variant: "standard", key: `${name}_${this.state.filterKey}`, ref: this.filterRefs[name], sx: styles.headerCellInput, className: "no-underline", onChange: () => {
3134
- this.filterTimer && clearTimeout(this.filterTimer);
3170
+ if (this.filterTimer) {
3171
+ clearTimeout(this.filterTimer);
3172
+ }
3135
3173
  this.filterTimer = setTimeout(() => this.onFilter(), 400);
3136
3174
  }, defaultValue: this.state.filter[name] || '', inputProps: { name, id: name }, displayEmpty: true },
3137
3175
  react_1.default.createElement(material_1.MenuItem, { key: "empty", value: "" },
@@ -3253,7 +3291,9 @@ class ObjectBrowserClass extends react_1.Component {
3253
3291
  if (this.state.depth < 9) {
3254
3292
  const depth = this.state.depth + 1;
3255
3293
  const expanded = [...this.state.expanded];
3256
- this.root && this.expandDepth(this.root, depth, expanded);
3294
+ if (this.root) {
3295
+ this.expandDepth(this.root, depth, expanded);
3296
+ }
3257
3297
  this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectExpanded`, JSON.stringify(expanded));
3258
3298
  this.setState({ depth, expanded });
3259
3299
  }
@@ -3298,7 +3338,9 @@ class ObjectBrowserClass extends react_1.Component {
3298
3338
  }
3299
3339
  try {
3300
3340
  await this.props.socket.setObject(id, obj);
3301
- enums && (await this._createAllEnums(enums, obj._id));
3341
+ if (enums) {
3342
+ await this._createAllEnums(enums, obj._id);
3343
+ }
3302
3344
  if (obj.type === 'state') {
3303
3345
  if (val !== undefined && val !== null) {
3304
3346
  try {
@@ -3678,7 +3720,9 @@ class ObjectBrowserClass extends react_1.Component {
3678
3720
  break;
3679
3721
  }
3680
3722
  }
3681
- this.props.onObjectDelete && this.props.onObjectDelete(id, !!((_b = item.children) === null || _b === void 0 ? void 0 : _b.length), false, count + 1);
3723
+ if (this.props.onObjectDelete) {
3724
+ this.props.onObjectDelete(id, !!((_b = item.children) === null || _b === void 0 ? void 0 : _b.length), false, count + 1);
3725
+ }
3682
3726
  } },
3683
3727
  react_1.default.createElement(icons_material_1.Delete, { style: styles.cellButtonsButtonIcon })) : null) : null;
3684
3728
  }
@@ -3720,7 +3764,9 @@ class ObjectBrowserClass extends react_1.Component {
3720
3764
  break;
3721
3765
  }
3722
3766
  }
3723
- this.props.onObjectDelete && this.props.onObjectDelete(id, !!((_b = item.children) === null || _b === void 0 ? void 0 : _b.length), !((_d = (_c = item.data.obj) === null || _c === void 0 ? void 0 : _c.common) === null || _d === void 0 ? void 0 : _d.dontDelete), count);
3767
+ if (this.props.onObjectDelete) {
3768
+ this.props.onObjectDelete(id, !!((_b = item.children) === null || _b === void 0 ? void 0 : _b.length), !((_d = (_c = item.data.obj) === null || _c === void 0 ? void 0 : _c.common) === null || _d === void 0 ? void 0 : _d.dontDelete), count);
3769
+ }
3724
3770
  }, title: this.texts.deleteObject },
3725
3771
  react_1.default.createElement(icons_material_1.Delete, { style: styles.cellButtonsButtonIcon })) : null,
3726
3772
  this.props.objectCustomDialog &&
@@ -3811,14 +3857,18 @@ class ObjectBrowserClass extends react_1.Component {
3811
3857
  ":\u00A0",
3812
3858
  _item.v));
3813
3859
  // <div style={styles.cellValueTooltipValue} key={item.t + '_v'}>{item.v}</div>,
3814
- !_item.nbr && valFullRx.push(react_1.default.createElement("br", { key: `${_item.t}_br` }));
3860
+ if (!_item.nbr) {
3861
+ valFullRx.push(react_1.default.createElement("br", { key: `${_item.t}_br` }));
3862
+ }
3815
3863
  }
3816
3864
  else {
3817
3865
  valFullRx.push(react_1.default.createElement("div", { style: styles.cellValueTooltipTitle, key: _item.t },
3818
3866
  _item.t,
3819
3867
  ":\u00A0"));
3820
3868
  valFullRx.push(react_1.default.createElement("div", { style: styles.cellValueTooltipValue, key: `${_item.t}_v` }, _item.v));
3821
- !_item.nbr && valFullRx.push(react_1.default.createElement("br", { key: `${_item.t}_br` }));
3869
+ if (!_item.nbr) {
3870
+ valFullRx.push(react_1.default.createElement("br", { key: `${_item.t}_br` }));
3871
+ }
3822
3872
  }
3823
3873
  });
3824
3874
  if (fileViewer === 'image') {
@@ -3843,13 +3893,17 @@ class ObjectBrowserClass extends react_1.Component {
3843
3893
  if (!this.states[id]) {
3844
3894
  if (obj.type === 'state') {
3845
3895
  // we are waiting for state
3846
- !this.recordStates.includes(id) && this.recordStates.push(id);
3896
+ if (!this.recordStates.includes(id)) {
3897
+ this.recordStates.push(id);
3898
+ }
3847
3899
  this.states[id] = { val: null };
3848
3900
  this.subscribe(id);
3849
3901
  }
3850
3902
  return null;
3851
3903
  }
3852
- !this.recordStates.includes(id) && this.recordStates.push(id);
3904
+ if (!this.recordStates.includes(id)) {
3905
+ this.recordStates.push(id);
3906
+ }
3853
3907
  const state = this.states[id];
3854
3908
  let info = item.data.state;
3855
3909
  if (!info) {
@@ -3863,31 +3917,55 @@ class ObjectBrowserClass extends react_1.Component {
3863
3917
  const valTextRx = [];
3864
3918
  item.data.state = { valTextRx };
3865
3919
  const copyText = valText.v || '';
3866
- valTextRx.push(react_1.default.createElement("span", { className: `newValueBrowser-${this.props.themeType || 'light'}`, key: `${valText.v.toString()}valText` }, valText.v.toString()));
3867
- valText.u && valTextRx.push(react_1.default.createElement("span", { className: `newValueBrowser-${this.props.themeType || 'light'}`, style: styles.cellValueTextUnit, key: `${valText.v.toString()}unit` }, valText.u));
3868
- valText.s !== undefined && valTextRx.push(react_1.default.createElement("span", { style: styles.cellValueTextState, className: `newValueBrowser-${this.props.themeType || 'light'}`, key: `${valText.v.toString()}states` },
3869
- "(",
3870
- valText.s,
3871
- ")"));
3872
- !narrowStyleWithDetails && valTextRx.push(react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: this.styles.iconCopy, onClick: e => this.onCopy(e, copyText), key: "cc" }));
3920
+ valTextRx.push(react_1.default.createElement("span", { className: `newValueBrowser-${this.props.themeType || 'light'}`, key: `${valText.v.toString()}valText`, style: {
3921
+ whiteSpace: 'nowrap',
3922
+ display: 'inline-block',
3923
+ overflow: 'hidden',
3924
+ textOverflow: 'ellipsis',
3925
+ } }, valText.v.toString()));
3926
+ if (valText.u) {
3927
+ valTextRx.push(react_1.default.createElement("span", { className: `newValueBrowser-${this.props.themeType || 'light'}`, style: styles.cellValueTextUnit, key: `${valText.v.toString()}unit` }, valText.u));
3928
+ }
3929
+ if (valText.s !== undefined) {
3930
+ valTextRx.push(react_1.default.createElement("span", { style: styles.cellValueTextState, className: `newValueBrowser-${this.props.themeType || 'light'}`, key: `${valText.v.toString()}states` },
3931
+ "(",
3932
+ valText.s,
3933
+ ")"));
3934
+ }
3935
+ if (!narrowStyleWithDetails) {
3936
+ valTextRx.push(react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: this.styles.iconCopy, onClick: e => this.onCopy(e, copyText), key: "cc" }));
3937
+ }
3873
3938
  // <IconEdit className="copyButton" style={{{ ...styles.cellButtonsValueButton, styles.cellButtonsValueButtonEdit)} key="ce" />
3874
3939
  info = item.data.state;
3875
3940
  }
3876
3941
  info.style = getValueStyle({ state, isExpertMode: this.state.filter.expertMode, isButton: item.data.button });
3877
3942
  let val = info.valTextRx;
3878
- if (!this.state.filter.expertMode && item.data.button) {
3879
- val = [react_1.default.createElement(icons_material_1.RoomService, { style: styles.cellValueButton })];
3943
+ if (!this.state.filter.expertMode) {
3944
+ if (item.data.button) {
3945
+ val = [react_1.default.createElement(ButtonIcon, { key: "button", style: Object.assign({ color: info.style.color }, styles.cellValueButton) })];
3946
+ }
3947
+ else if (item.data.switch) {
3948
+ val = [react_1.default.createElement(material_1.Switch, { key: "switch", sx: {
3949
+ '& .MuiSwitch-thumb': { color: info.style.color },
3950
+ '& .MuiSwitch-track': !!this.states[id].val && this.state.selected.includes(id) ?
3951
+ { backgroundColor: this.props.themeType === 'dark' ? '#FFF !important' : '#111 !important' } : undefined,
3952
+ }, checked: !!this.states[id].val })];
3953
+ }
3880
3954
  }
3881
3955
  return react_1.default.createElement(material_1.Tooltip, { key: "value", title: (_c = this.state.tooltipInfo) === null || _c === void 0 ? void 0 : _c.el, componentsProps: {
3882
3956
  popper: { sx: styles.cellValueTooltipBox },
3883
3957
  tooltip: { sx: styles.cellValueTooltip },
3884
3958
  }, onOpen: () => this.getTooltipInfo(id, () => this.readHistory(id)), onClose: () => { var _b; return ((_b = this.state.tooltipInfo) === null || _b === void 0 ? void 0 : _b.id) === id && this.setState({ tooltipInfo: null }); } },
3885
- react_1.default.createElement(material_1.Box, { component: "div", style: info.style, sx: Object.assign(Object.assign({}, styles.cellValueText), { height: narrowStyleWithDetails ? undefined : ROW_HEIGHT }) }, val));
3959
+ react_1.default.createElement(material_1.Box, { component: "div", style: info.style, sx: Object.assign(Object.assign({}, styles.cellValueText), { height: narrowStyleWithDetails ? undefined : ROW_HEIGHT, '& .admin-button:active': {
3960
+ transform: 'translate(0, 2px)',
3961
+ } }) }, val));
3886
3962
  }
3887
3963
  _syncEnum(id, enumIds, newArray, cb) {
3888
3964
  var _b, _c, _d;
3889
3965
  if (!enumIds || !enumIds.length) {
3890
- cb && cb();
3966
+ if (cb) {
3967
+ cb();
3968
+ }
3891
3969
  return;
3892
3970
  }
3893
3971
  const enumId = enumIds.pop() || '';
@@ -3896,7 +3974,7 @@ class ObjectBrowserClass extends react_1.Component {
3896
3974
  if ((_c = this.info.objects[enumId].common.members) === null || _c === void 0 ? void 0 : _c.length) {
3897
3975
  const pos = this.info.objects[enumId].common.members.indexOf(id);
3898
3976
  if (pos !== -1 && !newArray.includes(enumId)) {
3899
- // delete from members
3977
+ // delete it from members
3900
3978
  const obj = JSON.parse(JSON.stringify(this.info.objects[enumId]));
3901
3979
  obj.common.members.splice(pos, 1);
3902
3980
  promises.push(this.props.socket
@@ -4276,11 +4354,15 @@ class ObjectBrowserClass extends react_1.Component {
4276
4354
  }
4277
4355
  }
4278
4356
  if (obj) {
4279
- obj.from &&
4357
+ if (obj.from) {
4280
4358
  newValueTitle.push(`${this.texts.objectChangedFrom} ${obj.from.replace(/^system\.adapter\.|^system\./, '')}`);
4281
- obj.user && newValueTitle.push(`${this.texts.objectChangedBy} ${obj.user.replace(/^system\.user\./, '')}`);
4282
- obj.ts &&
4359
+ }
4360
+ if (obj.user) {
4361
+ newValueTitle.push(`${this.texts.objectChangedBy} ${obj.user.replace(/^system\.user\./, '')}`);
4362
+ }
4363
+ if (obj.ts) {
4283
4364
  newValueTitle.push(`${this.texts.objectChangedByUser} ${Utils_1.default.formatDate(new Date(obj.ts), this.props.dateFormat || this.systemConfig.common.dateFormat)}`);
4365
+ }
4284
4366
  }
4285
4367
  const readWriteAlias = typeof ((_c = common === null || common === void 0 ? void 0 : common.alias) === null || _c === void 0 ? void 0 : _c.id) === 'object';
4286
4368
  const alias = id.startsWith('alias.') && ((_d = common === null || common === void 0 ? void 0 : common.alias) === null || _d === void 0 ? void 0 : _d.id) ? (readWriteAlias ?
@@ -4355,13 +4437,15 @@ class ObjectBrowserClass extends react_1.Component {
4355
4437
  ids[name] = _id;
4356
4438
  if (!this.states[_id]) {
4357
4439
  if (((_b = this.objects[_id]) === null || _b === void 0 ? void 0 : _b.type) === 'state') {
4358
- !this.recordStates.includes(_id) && this.recordStates.push(_id);
4440
+ if (!this.recordStates.includes(_id)) {
4441
+ this.recordStates.push(_id);
4442
+ }
4359
4443
  this.states[_id] = { val: null };
4360
4444
  this.subscribe(_id);
4361
4445
  }
4362
4446
  }
4363
- else {
4364
- !this.recordStates.includes(_id) && this.recordStates.push(_id);
4447
+ else if (!this.recordStates.includes(_id)) {
4448
+ this.recordStates.push(_id);
4365
4449
  }
4366
4450
  });
4367
4451
  // calculate color
@@ -4566,7 +4650,7 @@ class ObjectBrowserClass extends react_1.Component {
4566
4650
  }
4567
4651
  let colCustom = ((_p = this.adapterColumns) === null || _p === void 0 ? void 0 : _p.map(it => react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellAdapter), { width: this.props.width !== 'xs' ? this.columnsVisibility[it.id] : undefined }), key: it.id, title: `${it.adapter} => ${it.pathText}` }, obj ? this.renderCustomValue(obj, it, item) : null))) || null;
4568
4652
  const columnValue = narrowStyleWithDetails || this.columnsVisibility.val ? this.renderColumnValue(id, item, narrowStyleWithDetails) : null;
4569
- let colValue = (narrowStyleWithDetails && columnValue) || this.columnsVisibility.val ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellValue), { width: this.props.width !== 'xs' ? this.columnsVisibility.val : undefined, cursor: valueEditable ? ((common === null || common === void 0 ? void 0 : common.type) === 'file' ? 'zoom-in' : (item.data.button ? 'grab' : 'text')) : 'default' }), onClick: valueEditable ? () => {
4653
+ let colValue = (narrowStyleWithDetails && columnValue) || this.columnsVisibility.val ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellValue), { width: this.props.width !== 'xs' ? this.columnsVisibility.val : 'calc(100% - 100px)', cursor: valueEditable ? ((common === null || common === void 0 ? void 0 : common.type) === 'file' ? 'zoom-in' : (item.data.button ? 'grab' : 'text')) : 'default' }), onClick: valueEditable ? () => {
4570
4654
  if (!obj || !this.states) {
4571
4655
  // return;
4572
4656
  }
@@ -4580,6 +4664,12 @@ class ObjectBrowserClass extends react_1.Component {
4580
4664
  .setState(id, true)
4581
4665
  .catch(e => window.alert(`Cannot write state "${id}": ${e}`));
4582
4666
  }
4667
+ else if (!this.state.filter.expertMode && item.data.switch) {
4668
+ // in non-expert mode control switch directly
4669
+ this.props.socket
4670
+ .setState(id, !this.states[id].val)
4671
+ .catch(e => window.alert(`Cannot write state "${id}": ${e}`));
4672
+ }
4583
4673
  else {
4584
4674
  this.edit = {
4585
4675
  val: this.states[id] ? this.states[id].val : '',
@@ -4712,26 +4802,30 @@ class ObjectBrowserClass extends react_1.Component {
4712
4802
  else {
4713
4803
  leaf = result.row;
4714
4804
  }
4715
- root.data.id && leaf && items.push(leaf);
4805
+ if (root.data.id && leaf) {
4806
+ items.push(leaf);
4807
+ }
4716
4808
  if (result.details) {
4717
4809
  items.push(result.details);
4718
4810
  }
4719
4811
  isExpanded = isExpanded === undefined ? binarySearch(this.state.expanded, root.data.id) : isExpanded;
4720
4812
  if (!root.data.id || isExpanded) {
4721
4813
  if (!this.state.foldersFirst) {
4722
- root.children && items.push(root.children.map(item => {
4723
- // do not render too many items in column editor mode
4724
- if (!this.state.columnsSelectorShow || counter.count < 15) {
4725
- if (item.data.sumVisibility) {
4726
- return this.renderItem(item, undefined, counter);
4814
+ if (root.children) {
4815
+ items.push(root.children.map(item => {
4816
+ // do not render too many items in column editor mode
4817
+ if (!this.state.columnsSelectorShow || counter.count < 15) {
4818
+ if (item.data.sumVisibility) {
4819
+ return this.renderItem(item, undefined, counter);
4820
+ }
4727
4821
  }
4728
- }
4729
- return null;
4730
- }));
4822
+ return null;
4823
+ }));
4824
+ }
4731
4825
  }
4732
- else {
4826
+ else if (root.children) {
4733
4827
  // first only folder
4734
- root.children && items.push(root.children.map(item => {
4828
+ items.push(root.children.map(item => {
4735
4829
  if (item.children) {
4736
4830
  // do not render too many items in column editor mode
4737
4831
  if (!this.state.columnsSelectorShow || counter.count < 15) {
@@ -4743,7 +4837,7 @@ class ObjectBrowserClass extends react_1.Component {
4743
4837
  return null;
4744
4838
  }));
4745
4839
  // then items
4746
- root.children && items.push(root.children.map(item => {
4840
+ items.push(root.children.map(item => {
4747
4841
  if (!item.children) {
4748
4842
  // do not render too many items in column editor mode
4749
4843
  if (!this.state.columnsSelectorShow || counter.count < 15) {
@@ -5053,12 +5147,11 @@ class ObjectBrowserClass extends react_1.Component {
5053
5147
  scrollToItem(id) {
5054
5148
  this.selectFirst = '';
5055
5149
  const node = window.document.getElementById(id);
5056
- node &&
5057
- node.scrollIntoView({
5058
- behavior: 'auto',
5059
- block: 'center',
5060
- inline: 'center',
5061
- });
5150
+ node === null || node === void 0 ? void 0 : node.scrollIntoView({
5151
+ behavior: 'auto',
5152
+ block: 'center',
5153
+ inline: 'center',
5154
+ });
5062
5155
  }
5063
5156
  renderCustomDialog() {
5064
5157
  if (this.state.customDialog && this.props.objectCustomDialog) {
@@ -5421,7 +5514,9 @@ class ObjectBrowserClass extends react_1.Component {
5421
5514
  react_1.default.createElement(icons_material_1.ArrowRight, null))));
5422
5515
  if (((_b = this.state.showContextMenu) === null || _b === void 0 ? void 0 : _b.subItem) === key) {
5423
5516
  items.push(react_1.default.createElement(material_1.Menu, { key: "subContextMenu", open: !0, anchorEl: this.state.showContextMenu.subAnchor, onClose: () => {
5424
- this.state.showContextMenu && this.setState({ showContextMenu: { item: this.state.showContextMenu.item } });
5517
+ if (this.state.showContextMenu) {
5518
+ this.setState({ showContextMenu: { item: this.state.showContextMenu.item } });
5519
+ }
5425
5520
  this.contextMenu = null;
5426
5521
  } }, (_c = ITEMS[key].subMenu) === null || _c === void 0 ? void 0 : _c.map(subItem => (subItem.visibility ? react_1.default.createElement(material_1.MenuItem, { key: subItem.label, onClick: subItem.onClick, style: subItem.style },
5427
5522
  react_1.default.createElement(material_1.ListItemIcon, { style: Object.assign(Object.assign({}, subItem.iconStyle), (subItem.listItemIconStyle || undefined)) }, subItem.icon),
@@ -5445,8 +5540,8 @@ class ObjectBrowserClass extends react_1.Component {
5445
5540
  e.preventDefault();
5446
5541
  if (e.altKey) {
5447
5542
  Object.keys(ITEMS).forEach(key => {
5448
- if (e.key === ITEMS[key].key) {
5449
- ITEMS[key].onClick && ITEMS[key].onClick();
5543
+ if (e.key === ITEMS[key].key && ITEMS[key].onClick) {
5544
+ ITEMS[key].onClick();
5450
5545
  }
5451
5546
  });
5452
5547
  }
@@ -5475,7 +5570,9 @@ class ObjectBrowserClass extends react_1.Component {
5475
5570
  const ObjectBrowserValue = this.props.objectBrowserValue;
5476
5571
  return react_1.default.createElement(ObjectBrowserValue, { t: this.props.t, lang: this.props.lang, type: type, role: role || '', states: Utils_1.default.getStates(this.objects[this.edit.id]), themeType: this.props.themeType, theme: this.props.theme, expertMode: !!this.state.filter.expertMode, value: this.edit.val, socket: this.props.socket, object: this.objects[this.edit.id], defaultHistory: this.defaultHistory, dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat, isFloatComma: this.props.isFloatComma === undefined ? this.systemConfig.common.isFloatComma : this.props.isFloatComma, onClose: (res) => {
5477
5572
  this.setState({ updateOpened: false });
5478
- res && this.onUpdate(res);
5573
+ if (res) {
5574
+ this.onUpdate(res);
5575
+ }
5479
5576
  }, width: this.props.width });
5480
5577
  }
5481
5578
  /**
@@ -5483,7 +5580,9 @@ class ObjectBrowserClass extends react_1.Component {
5483
5580
  */
5484
5581
  render() {
5485
5582
  this.recordStates = [];
5486
- this.unsubscribeTimer && clearTimeout(this.unsubscribeTimer);
5583
+ if (this.unsubscribeTimer) {
5584
+ clearTimeout(this.unsubscribeTimer);
5585
+ }
5487
5586
  if (this.styleTheme !== this.props.themeType) {
5488
5587
  this.styles = {
5489
5588
  cellIdIconFolder: Utils_1.default.getStyle(this.props.theme, styles.cellIdIconFolder),
@@ -5531,35 +5630,35 @@ class ObjectBrowserClass extends react_1.Component {
5531
5630
  }
5532
5631
  const items = this.root ? this.renderItem(this.root, undefined) : null;
5533
5632
  return react_1.default.createElement(TabContainer_1.default, { key: this.props.dialogName },
5534
- react_1.default.createElement("style", null, `
5535
- @keyframes newValueAnimation-light {
5536
- 0% {
5537
- color: #00f900;
5538
- }
5539
- 80% {
5540
- color: #008000;
5541
- }
5542
- 100% {
5543
- color: #000;
5544
- }
5545
- }
5546
- @keyframes newValueAnimation-dark {
5547
- 0% {
5548
- color: #00f900;
5549
- }
5550
- 80% {
5551
- color: #008000;
5552
- }
5553
- 100% {
5554
- color: #fff;
5555
- }
5556
- }
5557
- .newValueBrowser-dark {
5558
- animation: newValueAnimation-dark 2s ease-in-out;
5559
- }
5560
- .newValueBrowser-light {
5561
- animation: newValueAnimation-light 2s ease-in-out;
5562
- }
5633
+ react_1.default.createElement("style", null, `
5634
+ @keyframes newValueAnimation-light {
5635
+ 0% {
5636
+ color: #00f900;
5637
+ }
5638
+ 80% {
5639
+ color: #008000;
5640
+ }
5641
+ 100% {
5642
+ color: #000;
5643
+ }
5644
+ }
5645
+ @keyframes newValueAnimation-dark {
5646
+ 0% {
5647
+ color: #00f900;
5648
+ }
5649
+ 80% {
5650
+ color: #008000;
5651
+ }
5652
+ 100% {
5653
+ color: #fff;
5654
+ }
5655
+ }
5656
+ .newValueBrowser-dark {
5657
+ animation: newValueAnimation-dark 2s ease-in-out;
5658
+ }
5659
+ .newValueBrowser-light {
5660
+ animation: newValueAnimation-light 2s ease-in-out;
5661
+ }
5563
5662
  `),
5564
5663
  react_1.default.createElement(TabHeader_1.default, null, this.getToolbar()),
5565
5664
  react_1.default.createElement(TabContent_1.default, null,