@iobroker/adapter-react-v5 3.2.2 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Components/ColorPicker.d.ts +1 -1
- package/Components/ColorPicker.js +77 -53
- package/Components/ColorPicker.js.map +1 -1
- package/Components/ObjectBrowser.d.ts +21 -24
- package/Components/ObjectBrowser.js +624 -655
- package/Components/ObjectBrowser.js.map +1 -1
- package/README.md +3 -0
- package/package.json +1 -1
|
@@ -114,7 +114,7 @@ var COLOR_NAME_DISCONNECTED_LIGHT = '#6c5008';
|
|
|
114
114
|
var styles = function styles(theme) {
|
|
115
115
|
return {
|
|
116
116
|
toolbar: {
|
|
117
|
-
minHeight: 38 //Theme.toolbar.height,
|
|
117
|
+
minHeight: 38 // Theme.toolbar.height,
|
|
118
118
|
// boxShadow: '0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12)'
|
|
119
119
|
},
|
|
120
120
|
|
|
@@ -205,16 +205,16 @@ var styles = function styles(theme) {
|
|
|
205
205
|
},
|
|
206
206
|
tableDiv: {
|
|
207
207
|
paddingTop: 0,
|
|
208
|
-
//theme.spacing(1),
|
|
208
|
+
// theme.spacing(1),
|
|
209
209
|
paddingLeft: 0,
|
|
210
210
|
width: "calc(100% - ".concat(theme.spacing(1), ")"),
|
|
211
|
-
height:
|
|
211
|
+
height: 'calc(100% - 38px)',
|
|
212
212
|
overflow: 'auto'
|
|
213
213
|
},
|
|
214
214
|
tableRow: {
|
|
215
215
|
paddingLeft: theme.spacing(1),
|
|
216
216
|
height: ROW_HEIGHT,
|
|
217
|
-
lineHeight: ROW_HEIGHT
|
|
217
|
+
lineHeight: "".concat(ROW_HEIGHT, "px"),
|
|
218
218
|
verticalAlign: 'top',
|
|
219
219
|
userSelect: 'none',
|
|
220
220
|
width: '100%',
|
|
@@ -248,8 +248,8 @@ var styles = function styles(theme) {
|
|
|
248
248
|
fontSize: '1rem',
|
|
249
249
|
overflow: 'hidden',
|
|
250
250
|
textOverflow: 'ellipsis',
|
|
251
|
-
//verticalAlign: 'top',
|
|
252
|
-
//position: 'relative',
|
|
251
|
+
// verticalAlign: 'top',
|
|
252
|
+
// position: 'relative',
|
|
253
253
|
'& .copyButton': {
|
|
254
254
|
display: 'none'
|
|
255
255
|
},
|
|
@@ -274,8 +274,8 @@ var styles = function styles(theme) {
|
|
|
274
274
|
overflow: 'hidden',
|
|
275
275
|
textOverflow: 'ellipsis',
|
|
276
276
|
whiteSpace: 'nowrap'
|
|
277
|
-
//display: 'inline-block',
|
|
278
|
-
//verticalAlign: 'top',
|
|
277
|
+
// display: 'inline-block',
|
|
278
|
+
// verticalAlign: 'top',
|
|
279
279
|
},
|
|
280
280
|
|
|
281
281
|
cellIdIconFolder: {
|
|
@@ -434,7 +434,7 @@ var styles = function styles(theme) {
|
|
|
434
434
|
cellValueTooltipValue: {
|
|
435
435
|
width: 120,
|
|
436
436
|
display: 'inline-block',
|
|
437
|
-
//overflow: 'hidden',
|
|
437
|
+
// overflow: 'hidden',
|
|
438
438
|
whiteSpace: 'nowrap',
|
|
439
439
|
textOverflow: 'ellipsis'
|
|
440
440
|
},
|
|
@@ -727,7 +727,7 @@ var styles = function styles(theme) {
|
|
|
727
727
|
};
|
|
728
728
|
function generateFile(filename, obj) {
|
|
729
729
|
var el = document.createElement('a');
|
|
730
|
-
el.setAttribute('href',
|
|
730
|
+
el.setAttribute('href', "data:application/json;charset=utf-8,".concat(encodeURIComponent(JSON.stringify(obj, null, 2))));
|
|
731
731
|
el.setAttribute('download', filename);
|
|
732
732
|
el.style.display = 'none';
|
|
733
733
|
document.body.appendChild(el);
|
|
@@ -757,6 +757,86 @@ function binarySearch(list, find, _start, _end) {
|
|
|
757
757
|
if (find < list[middle]) {
|
|
758
758
|
return binarySearch(list, find, _start, middle);
|
|
759
759
|
}
|
|
760
|
+
return false;
|
|
761
|
+
}
|
|
762
|
+
function getName(name, lang) {
|
|
763
|
+
if (name && (0, _typeof2["default"])(name) === 'object') {
|
|
764
|
+
return (name[lang] || name.en || '').toString();
|
|
765
|
+
}
|
|
766
|
+
return (name || '').toString();
|
|
767
|
+
}
|
|
768
|
+
function getSelectIdIcon(objects, id, imagePrefix) {
|
|
769
|
+
imagePrefix = imagePrefix || '.'; // http://localhost:8081';
|
|
770
|
+
var src = '';
|
|
771
|
+
var _id_ = "system.adapter.".concat(id);
|
|
772
|
+
var aIcon = id && objects[_id_] && objects[_id_].common && objects[_id_].common.icon;
|
|
773
|
+
if (aIcon) {
|
|
774
|
+
// if not BASE64
|
|
775
|
+
if (!aIcon.startsWith('data:image/')) {
|
|
776
|
+
if (aIcon.includes('.')) {
|
|
777
|
+
src = "".concat(imagePrefix, "/adapter/").concat(objects[_id_].common.name, "/").concat(aIcon);
|
|
778
|
+
} else if (aIcon && aIcon.length < 3) {
|
|
779
|
+
return aIcon; // utf-8
|
|
780
|
+
} else {
|
|
781
|
+
return null; // '<i class="material-icons iob-list-icon">' + objects[_id_].common.icon + '</i>';
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
if (aIcon.startsWith('data:image/svg')) {
|
|
786
|
+
src = /*#__PURE__*/_react["default"].createElement(_reactInlinesvg["default"], {
|
|
787
|
+
src: aIcon,
|
|
788
|
+
width: 28,
|
|
789
|
+
height: 28
|
|
790
|
+
});
|
|
791
|
+
} else {
|
|
792
|
+
src = aIcon;
|
|
793
|
+
}
|
|
794
|
+
} else {
|
|
795
|
+
var common = objects[id] && objects[id].common;
|
|
796
|
+
if (common) {
|
|
797
|
+
var cIcon = common.icon;
|
|
798
|
+
if (cIcon) {
|
|
799
|
+
if (!cIcon.startsWith('data:image/')) {
|
|
800
|
+
if (cIcon.includes('.')) {
|
|
801
|
+
var instance;
|
|
802
|
+
if (objects[id].type === 'instance' || objects[id].type === 'adapter') {
|
|
803
|
+
src = "".concat(imagePrefix, "/adapter/").concat(common.name, "/").concat(cIcon);
|
|
804
|
+
} else if (id && id.startsWith('system.adapter.')) {
|
|
805
|
+
instance = id.split('.', 3);
|
|
806
|
+
if (cIcon[0] === '/') {
|
|
807
|
+
instance[2] += cIcon;
|
|
808
|
+
} else {
|
|
809
|
+
instance[2] += "/".concat(cIcon);
|
|
810
|
+
}
|
|
811
|
+
src = "".concat(imagePrefix, "/adapter/").concat(instance[2]);
|
|
812
|
+
} else {
|
|
813
|
+
instance = id.split('.', 2);
|
|
814
|
+
if (cIcon[0] === '/') {
|
|
815
|
+
instance[0] += cIcon;
|
|
816
|
+
} else {
|
|
817
|
+
instance[0] += "/".concat(cIcon);
|
|
818
|
+
}
|
|
819
|
+
src = "".concat(imagePrefix, "/adapter/").concat(instance[0]);
|
|
820
|
+
}
|
|
821
|
+
} else if (aIcon && aIcon.length < 3) {
|
|
822
|
+
return aIcon; // utf-8
|
|
823
|
+
} else {
|
|
824
|
+
return null;
|
|
825
|
+
}
|
|
826
|
+
} else if (cIcon.startsWith('data:image/svg')) {
|
|
827
|
+
// if base 64 image
|
|
828
|
+
src = /*#__PURE__*/_react["default"].createElement(_reactInlinesvg["default"], {
|
|
829
|
+
src: cIcon,
|
|
830
|
+
width: 28,
|
|
831
|
+
height: 28
|
|
832
|
+
});
|
|
833
|
+
} else {
|
|
834
|
+
src = cIcon;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
return src || null;
|
|
760
840
|
}
|
|
761
841
|
function applyFilter(item, filters, lang, objects, context, counter, customFilter, selectedTypes, _depth) {
|
|
762
842
|
_depth = _depth || 0;
|
|
@@ -878,12 +958,12 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
878
958
|
}
|
|
879
959
|
if (!filteredOut && context.room) {
|
|
880
960
|
filteredOut = !context.room.find(function (id) {
|
|
881
|
-
return id === data.id || data.id.startsWith(id
|
|
961
|
+
return id === data.id || data.id.startsWith("".concat(id, "."));
|
|
882
962
|
});
|
|
883
963
|
}
|
|
884
964
|
if (!filteredOut && context.func) {
|
|
885
965
|
filteredOut = !context.func.find(function (id) {
|
|
886
|
-
return id === data.id || data.id.startsWith(id
|
|
966
|
+
return id === data.id || data.id.startsWith("".concat(id, "."));
|
|
887
967
|
});
|
|
888
968
|
}
|
|
889
969
|
if (!filteredOut && context.type) {
|
|
@@ -983,8 +1063,8 @@ function getSystemIcon(objects, id, k, imagePrefix) {
|
|
|
983
1063
|
});
|
|
984
1064
|
} else if (k < 2) {
|
|
985
1065
|
// detect "cloud.0"
|
|
986
|
-
if (objects[
|
|
987
|
-
icon = getSelectIdIcon(objects,
|
|
1066
|
+
if (objects["system.adapter.".concat(id)]) {
|
|
1067
|
+
icon = getSelectIdIcon(objects, "system.adapter.".concat(id), imagePrefix);
|
|
988
1068
|
}
|
|
989
1069
|
}
|
|
990
1070
|
return icon || null;
|
|
@@ -1060,8 +1140,8 @@ function buildTree(objects, options) {
|
|
|
1060
1140
|
do {
|
|
1061
1141
|
repeat = false;
|
|
1062
1142
|
|
|
1063
|
-
// If current level is still OK and we can add ID to children
|
|
1064
|
-
if (!currentPath || id.startsWith(currentPath
|
|
1143
|
+
// If current level is still OK, and we can add ID to children
|
|
1144
|
+
if (!currentPath || id.startsWith("".concat(currentPath, "."))) {
|
|
1065
1145
|
var _obj$common, _obj$common2, _obj$common3;
|
|
1066
1146
|
// if more than one level added
|
|
1067
1147
|
if (parts.length - currentPathLen > 1) {
|
|
@@ -1150,11 +1230,11 @@ function buildTree(objects, options) {
|
|
|
1150
1230
|
var bName = getName(((_objects$b = objects[b]) === null || _objects$b === void 0 ? void 0 : (_objects$b$common = _objects$b.common) === null || _objects$b$common === void 0 ? void 0 : _objects$b$common.name) || b.split('.').pop());
|
|
1151
1231
|
if (aName > bName) {
|
|
1152
1232
|
return 1;
|
|
1153
|
-
}
|
|
1233
|
+
}
|
|
1234
|
+
if (aName < bName) {
|
|
1154
1235
|
return -1;
|
|
1155
|
-
} else {
|
|
1156
|
-
return 0;
|
|
1157
1236
|
}
|
|
1237
|
+
return 0;
|
|
1158
1238
|
});
|
|
1159
1239
|
info.funcEnums.sort(function (a, b) {
|
|
1160
1240
|
var _objects$a2, _objects$a2$common, _objects$b2, _objects$b2$common;
|
|
@@ -1162,11 +1242,11 @@ function buildTree(objects, options) {
|
|
|
1162
1242
|
var bName = getName(((_objects$b2 = objects[b]) === null || _objects$b2 === void 0 ? void 0 : (_objects$b2$common = _objects$b2.common) === null || _objects$b2$common === void 0 ? void 0 : _objects$b2$common.name) || b.split('.').pop());
|
|
1163
1243
|
if (aName > bName) {
|
|
1164
1244
|
return 1;
|
|
1165
|
-
}
|
|
1245
|
+
}
|
|
1246
|
+
if (aName < bName) {
|
|
1166
1247
|
return -1;
|
|
1167
|
-
} else {
|
|
1168
|
-
return 0;
|
|
1169
1248
|
}
|
|
1249
|
+
return 0;
|
|
1170
1250
|
});
|
|
1171
1251
|
info.roles.sort();
|
|
1172
1252
|
info.types.sort();
|
|
@@ -1186,30 +1266,21 @@ function findNode(root, id, _parts, _path, _level) {
|
|
|
1186
1266
|
}
|
|
1187
1267
|
if (!root.children && root.data.id !== id) {
|
|
1188
1268
|
return null;
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
if (found) {
|
|
1201
|
-
return findNode(found, id, _parts, _path + '.' + _parts[_level + 1], _level + 1);
|
|
1202
|
-
} else {
|
|
1203
|
-
return null;
|
|
1269
|
+
}
|
|
1270
|
+
var found;
|
|
1271
|
+
for (var i = 0; i < root.children.length; i++) {
|
|
1272
|
+
var _id = root.children[i].data.id;
|
|
1273
|
+
if (_id === _path) {
|
|
1274
|
+
found = root.children[i];
|
|
1275
|
+
break;
|
|
1276
|
+
} else if (_id > _path) {
|
|
1277
|
+
break;
|
|
1204
1278
|
}
|
|
1205
1279
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
if (name && (0, _typeof2["default"])(name) === 'object') {
|
|
1209
|
-
return (name[lang] || name.en || '').toString();
|
|
1210
|
-
} else {
|
|
1211
|
-
return (name || '').toString();
|
|
1280
|
+
if (found) {
|
|
1281
|
+
return findNode(found, id, _parts, "".concat(_path, ".").concat(_parts[_level + 1]), _level + 1);
|
|
1212
1282
|
}
|
|
1283
|
+
return null;
|
|
1213
1284
|
}
|
|
1214
1285
|
function findRoomsForObject(data, id, lang, withParentInfo, rooms) {
|
|
1215
1286
|
if (!id) {
|
|
@@ -1304,7 +1375,8 @@ function findFunctionsForObject(data, id, lang, withParentInfo, funcs) {
|
|
|
1304
1375
|
};
|
|
1305
1376
|
}
|
|
1306
1377
|
|
|
1307
|
-
/*
|
|
1378
|
+
/*
|
|
1379
|
+
function quality2text(q) {
|
|
1308
1380
|
if (!q) {
|
|
1309
1381
|
return 'ok';
|
|
1310
1382
|
}
|
|
@@ -1317,7 +1389,8 @@ function findFunctionsForObject(data, id, lang, withParentInfo, funcs) {
|
|
|
1317
1389
|
if (q & 0x04) text += ' error';
|
|
1318
1390
|
|
|
1319
1391
|
return text + (custom ? '|0x' + (custom >> 16).toString(16).toUpperCase() : '') + ' [0x' + q.toString(16).toUpperCase() + ']';
|
|
1320
|
-
}
|
|
1392
|
+
}
|
|
1393
|
+
*/
|
|
1321
1394
|
|
|
1322
1395
|
function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
|
|
1323
1396
|
var states = _Utils["default"].getStates(obj);
|
|
@@ -1360,11 +1433,10 @@ function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
|
|
|
1360
1433
|
v = states[v];
|
|
1361
1434
|
}
|
|
1362
1435
|
}
|
|
1363
|
-
var valFull;
|
|
1364
1436
|
if (isCommon && isCommon.unit) {
|
|
1365
1437
|
valText.u = isCommon.unit;
|
|
1366
1438
|
}
|
|
1367
|
-
valFull = [{
|
|
1439
|
+
var valFull = [{
|
|
1368
1440
|
t: texts.value,
|
|
1369
1441
|
v: v
|
|
1370
1442
|
}];
|
|
@@ -1428,81 +1500,6 @@ function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
|
|
|
1428
1500
|
}
|
|
1429
1501
|
};
|
|
1430
1502
|
}
|
|
1431
|
-
function getSelectIdIcon(objects, id, imagePrefix) {
|
|
1432
|
-
imagePrefix = imagePrefix || '.'; //http://localhost:8081';
|
|
1433
|
-
var src = '';
|
|
1434
|
-
var _id_ = 'system.adapter.' + id;
|
|
1435
|
-
var aIcon = id && objects[_id_] && objects[_id_].common && objects[_id_].common.icon;
|
|
1436
|
-
if (aIcon) {
|
|
1437
|
-
// if not BASE64
|
|
1438
|
-
if (!aIcon.startsWith('data:image/')) {
|
|
1439
|
-
if (aIcon.includes('.')) {
|
|
1440
|
-
src = "".concat(imagePrefix, "/adapter/").concat(objects[_id_].common.name, "/").concat(aIcon);
|
|
1441
|
-
} else if (aIcon && aIcon.length < 3) {
|
|
1442
|
-
return aIcon; // utf-8
|
|
1443
|
-
} else {
|
|
1444
|
-
return null; //'<i class="material-icons iob-list-icon">' + objects[_id_].common.icon + '</i>';
|
|
1445
|
-
}
|
|
1446
|
-
} else {
|
|
1447
|
-
if (aIcon.startsWith('data:image/svg')) {
|
|
1448
|
-
src = /*#__PURE__*/_react["default"].createElement(_reactInlinesvg["default"], {
|
|
1449
|
-
src: aIcon,
|
|
1450
|
-
width: 28,
|
|
1451
|
-
height: 28
|
|
1452
|
-
});
|
|
1453
|
-
} else {
|
|
1454
|
-
src = aIcon;
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
} else {
|
|
1458
|
-
var common = objects[id] && objects[id].common;
|
|
1459
|
-
if (common) {
|
|
1460
|
-
var cIcon = common.icon;
|
|
1461
|
-
if (cIcon) {
|
|
1462
|
-
if (!cIcon.startsWith('data:image/')) {
|
|
1463
|
-
if (cIcon.includes('.')) {
|
|
1464
|
-
var instance;
|
|
1465
|
-
if (objects[id].type === 'instance' || objects[id].type === 'adapter') {
|
|
1466
|
-
src = "".concat(imagePrefix, "/adapter/").concat(common.name, "/").concat(cIcon);
|
|
1467
|
-
} else if (id && id.startsWith('system.adapter.')) {
|
|
1468
|
-
instance = id.split('.', 3);
|
|
1469
|
-
if (cIcon[0] === '/') {
|
|
1470
|
-
instance[2] += cIcon;
|
|
1471
|
-
} else {
|
|
1472
|
-
instance[2] += '/' + cIcon;
|
|
1473
|
-
}
|
|
1474
|
-
src = "".concat(imagePrefix, "/adapter/").concat(instance[2]);
|
|
1475
|
-
} else {
|
|
1476
|
-
instance = id.split('.', 2);
|
|
1477
|
-
if (cIcon[0] === '/') {
|
|
1478
|
-
instance[0] += cIcon;
|
|
1479
|
-
} else {
|
|
1480
|
-
instance[0] += '/' + cIcon;
|
|
1481
|
-
}
|
|
1482
|
-
src = "".concat(imagePrefix, "/adapter/").concat(instance[0]);
|
|
1483
|
-
}
|
|
1484
|
-
} else if (aIcon && aIcon.length < 3) {
|
|
1485
|
-
return aIcon; // utf-8
|
|
1486
|
-
} else {
|
|
1487
|
-
return null;
|
|
1488
|
-
}
|
|
1489
|
-
} else {
|
|
1490
|
-
// base 64 image
|
|
1491
|
-
if (cIcon.startsWith('data:image/svg')) {
|
|
1492
|
-
src = /*#__PURE__*/_react["default"].createElement(_reactInlinesvg["default"], {
|
|
1493
|
-
src: cIcon,
|
|
1494
|
-
width: 28,
|
|
1495
|
-
height: 28
|
|
1496
|
-
});
|
|
1497
|
-
} else {
|
|
1498
|
-
src = cIcon;
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
return src || null;
|
|
1505
|
-
}
|
|
1506
1503
|
function prepareSparkData(values, from) {
|
|
1507
1504
|
// set every hour one point
|
|
1508
1505
|
var time = from;
|
|
@@ -1652,7 +1649,7 @@ var SCREEN_WIDTHS = {
|
|
|
1652
1649
|
lastChange: 165
|
|
1653
1650
|
}
|
|
1654
1651
|
},
|
|
1655
|
-
|
|
1652
|
+
// /////////////
|
|
1656
1653
|
// extra-large: 1920px
|
|
1657
1654
|
xl: {
|
|
1658
1655
|
idWidth: 550,
|
|
@@ -1688,7 +1685,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
1688
1685
|
(0, _classCallCheck2["default"])(this, ObjectBrowser);
|
|
1689
1686
|
_this = _super.call(this, props);
|
|
1690
1687
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onStateChange", function (id, state) {
|
|
1691
|
-
console.log(
|
|
1688
|
+
console.log("> stateChange ".concat(id));
|
|
1692
1689
|
if (_this.states[id]) {
|
|
1693
1690
|
var item = _this.findItem(id);
|
|
1694
1691
|
if (item && item.data.state) {
|
|
@@ -1703,18 +1700,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
1703
1700
|
_this.forceUpdate();
|
|
1704
1701
|
}, 300);
|
|
1705
1702
|
}
|
|
1706
|
-
} else {
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
_this.statesUpdateTimer = null;
|
|
1710
|
-
}
|
|
1703
|
+
} else if (_this.statesUpdateTimer) {
|
|
1704
|
+
clearTimeout(_this.statesUpdateTimer);
|
|
1705
|
+
_this.statesUpdateTimer = null;
|
|
1711
1706
|
}
|
|
1712
1707
|
});
|
|
1713
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onObjectChange", function (id, obj, oldObj) {
|
|
1708
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onObjectChange", function (id, obj /* , oldObj */) {
|
|
1714
1709
|
var newState;
|
|
1715
1710
|
if (Array.isArray(id)) {
|
|
1716
1711
|
id.forEach(function (event) {
|
|
1717
|
-
console.log(
|
|
1712
|
+
console.log("> objectChange ".concat(event.id));
|
|
1718
1713
|
if (event.obj && typeof _this.props.filterFunc === 'function' && !_this.props.filterFunc(event.obj)) {
|
|
1719
1714
|
return;
|
|
1720
1715
|
}
|
|
@@ -1734,12 +1729,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
1734
1729
|
} else {
|
|
1735
1730
|
delete _this.objects[event.id];
|
|
1736
1731
|
}
|
|
1737
|
-
} else if (_this.objects[event.id]) {
|
|
1738
|
-
delete _this.objects[event.id];
|
|
1739
1732
|
}
|
|
1740
1733
|
});
|
|
1741
1734
|
} else {
|
|
1742
|
-
console.log(
|
|
1735
|
+
console.log("> objectChange ".concat(id));
|
|
1743
1736
|
_this.objects = _this.objects || [];
|
|
1744
1737
|
if (obj && typeof _this.props.filterFunc === 'function' && !_this.props.filterFunc(obj)) {
|
|
1745
1738
|
return;
|
|
@@ -1759,8 +1752,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
1759
1752
|
} else {
|
|
1760
1753
|
delete _this.objects[id];
|
|
1761
1754
|
}
|
|
1762
|
-
} else if (_this.objects[id]) {
|
|
1763
|
-
delete _this.objects[id];
|
|
1764
1755
|
}
|
|
1765
1756
|
}
|
|
1766
1757
|
newState && _this.setState(newState);
|
|
@@ -1886,7 +1877,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
1886
1877
|
break;
|
|
1887
1878
|
}
|
|
1888
1879
|
id = _context2.t1.value;
|
|
1889
|
-
if (!(!
|
|
1880
|
+
if (!(!Object.hasOwn(objs, id) || !objs[id])) {
|
|
1890
1881
|
_context2.next = 6;
|
|
1891
1882
|
break;
|
|
1892
1883
|
}
|
|
@@ -2041,6 +2032,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2041
2032
|
_context3.t1 = _context3["catch"](1);
|
|
2042
2033
|
window.alert(_context3.t1);
|
|
2043
2034
|
case 38:
|
|
2035
|
+
return _context3.abrupt("return", null);
|
|
2036
|
+
case 39:
|
|
2044
2037
|
case "end":
|
|
2045
2038
|
return _context3.stop();
|
|
2046
2039
|
}
|
|
@@ -2086,88 +2079,86 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2086
2079
|
var id = _this.state.selected[0] || _this.state.selectedNonObject;
|
|
2087
2080
|
if (id.split('.').length < 2 || _this.objects[id] && ((_this$objects$id = _this.objects[id]) === null || _this$objects$id === void 0 ? void 0 : _this$objects$id.type) === 'state') {
|
|
2088
2081
|
// show default tooltip
|
|
2089
|
-
} else {
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
break;
|
|
2146
|
-
}
|
|
2147
|
-
} else if (id.startsWith('alias.0') || id.startsWith('0_userdata')) {
|
|
2148
|
-
value = [/*#__PURE__*/_react["default"].createElement("div", {
|
|
2149
|
-
key: 1
|
|
2150
|
-
}, t('ra_Only following structures of objects are available:')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2151
|
-
key: 2
|
|
2152
|
-
}, t('ra_Folder → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2153
|
-
key: 3
|
|
2154
|
-
}, t('ra_Folder → Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2155
|
-
key: 4
|
|
2156
|
-
}, t('ra_Folder → Device → Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2157
|
-
key: 5
|
|
2158
|
-
}, t('ra_Device → Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2159
|
-
key: 6
|
|
2160
|
-
}, t('ra_Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2161
|
-
key: 7,
|
|
2162
|
-
style: {
|
|
2163
|
-
height: 10
|
|
2164
|
-
}
|
|
2165
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2166
|
-
key: 7
|
|
2167
|
-
}, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2168
|
-
key: 8
|
|
2169
|
-
}, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];
|
|
2082
|
+
} else if (_this.state.filter.expertMode) {
|
|
2083
|
+
switch ((_this$objects$id2 = _this.objects[id]) === null || _this$objects$id2 === void 0 ? void 0 : _this$objects$id2.type) {
|
|
2084
|
+
case 'device':
|
|
2085
|
+
value = [/*#__PURE__*/_react["default"].createElement("div", {
|
|
2086
|
+
key: 1
|
|
2087
|
+
}, t('ra_Only following structures of objects are available:')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2088
|
+
key: 5
|
|
2089
|
+
}, t('ra_Device → Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2090
|
+
key: 7,
|
|
2091
|
+
style: {
|
|
2092
|
+
height: 10
|
|
2093
|
+
}
|
|
2094
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2095
|
+
key: 8
|
|
2096
|
+
}, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2097
|
+
key: 9
|
|
2098
|
+
}, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];
|
|
2099
|
+
break;
|
|
2100
|
+
case 'folder':
|
|
2101
|
+
value = [/*#__PURE__*/_react["default"].createElement("div", {
|
|
2102
|
+
key: 1
|
|
2103
|
+
}, t('ra_Only following structures of objects are available:')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2104
|
+
key: 2
|
|
2105
|
+
}, t('ra_Folder → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2106
|
+
key: 3
|
|
2107
|
+
}, t('ra_Folder → Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2108
|
+
key: 4
|
|
2109
|
+
}, t('ra_Folder → Device → Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2110
|
+
key: 7,
|
|
2111
|
+
style: {
|
|
2112
|
+
height: 10
|
|
2113
|
+
}
|
|
2114
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2115
|
+
key: 8
|
|
2116
|
+
}, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2117
|
+
key: 9
|
|
2118
|
+
}, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];
|
|
2119
|
+
break;
|
|
2120
|
+
case 'channel':
|
|
2121
|
+
value = [/*#__PURE__*/_react["default"].createElement("div", {
|
|
2122
|
+
key: 1
|
|
2123
|
+
}, t('ra_Only following structures of objects are available:')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2124
|
+
key: 1
|
|
2125
|
+
}, t('ra_Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2126
|
+
key: 7,
|
|
2127
|
+
style: {
|
|
2128
|
+
height: 10
|
|
2129
|
+
}
|
|
2130
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2131
|
+
key: 8
|
|
2132
|
+
}, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2133
|
+
key: 9
|
|
2134
|
+
}, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];
|
|
2135
|
+
break;
|
|
2136
|
+
default:
|
|
2137
|
+
break;
|
|
2170
2138
|
}
|
|
2139
|
+
} else if (id.startsWith('alias.0') || id.startsWith('0_userdata')) {
|
|
2140
|
+
value = [/*#__PURE__*/_react["default"].createElement("div", {
|
|
2141
|
+
key: 1
|
|
2142
|
+
}, t('ra_Only following structures of objects are available:')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2143
|
+
key: 2
|
|
2144
|
+
}, t('ra_Folder → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2145
|
+
key: 3
|
|
2146
|
+
}, t('ra_Folder → Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2147
|
+
key: 4
|
|
2148
|
+
}, t('ra_Folder → Device → Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2149
|
+
key: 5
|
|
2150
|
+
}, t('ra_Device → Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2151
|
+
key: 6
|
|
2152
|
+
}, t('ra_Channel → State')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2153
|
+
key: 7,
|
|
2154
|
+
style: {
|
|
2155
|
+
height: 10
|
|
2156
|
+
}
|
|
2157
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2158
|
+
key: 7
|
|
2159
|
+
}, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2160
|
+
key: 8
|
|
2161
|
+
}, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];
|
|
2171
2162
|
}
|
|
2172
2163
|
}
|
|
2173
2164
|
return value.length ? value : t('ra_Add new child object to selected parent');
|
|
@@ -2213,10 +2204,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2213
2204
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'object';
|
|
2214
2205
|
var rights = acl[value];
|
|
2215
2206
|
check.forEach(function (el, i) {
|
|
2207
|
+
// eslint-disable-next-line no-bitwise
|
|
2216
2208
|
if (rights & el.valueNum) {
|
|
2217
2209
|
arrayTooltipText.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
2218
2210
|
key: value + i
|
|
2219
|
-
}, _this.texts[
|
|
2211
|
+
}, _this.texts["acl".concat(el.group, "_").concat(el.title, "_").concat(value)], ",", /*#__PURE__*/_react["default"].createElement("span", {
|
|
2220
2212
|
className: value === 'object' ? _this.props.classes.rightsObject : _this.props.classes.rightsState
|
|
2221
2213
|
}, el.value)));
|
|
2222
2214
|
}
|
|
@@ -2224,10 +2216,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2224
2216
|
};
|
|
2225
2217
|
arrayTooltipText.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
2226
2218
|
key: "group"
|
|
2227
|
-
}, _this.texts.ownerGroup
|
|
2219
|
+
}, "".concat(_this.texts.ownerGroup, ": ").concat((acl.ownerGroup || '').replace('system.group.', ''))));
|
|
2228
2220
|
arrayTooltipText.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
2229
2221
|
key: "owner"
|
|
2230
|
-
}, _this.texts.ownerUser
|
|
2222
|
+
}, "".concat(_this.texts.ownerUser, ": ").concat((acl.owner || '').replace('system.user.', ''))));
|
|
2231
2223
|
funcRenderStateObject();
|
|
2232
2224
|
if (acl.state) {
|
|
2233
2225
|
funcRenderStateObject('state');
|
|
@@ -2252,16 +2244,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2252
2244
|
if ((!_this.resizerMin || width > _this.resizerMin) && (!_this.resizerNextMin || widthNext > _this.resizerNextMin)) {
|
|
2253
2245
|
_this.resizerCurrentWidths[_this.resizerActiveName] = width;
|
|
2254
2246
|
_this.resizerCurrentWidths[_this.resizerNextName] = widthNext;
|
|
2255
|
-
_this.resizerActiveDiv.style.width = width
|
|
2256
|
-
_this.resizerNextDiv.style.width = widthNext
|
|
2247
|
+
_this.resizerActiveDiv.style.width = "".concat(width, "px");
|
|
2248
|
+
_this.resizerNextDiv.style.width = "".concat(widthNext, "px");
|
|
2257
2249
|
_this.columnsVisibility[_this.resizerActiveName] = width;
|
|
2258
2250
|
_this.columnsVisibility[_this.resizerNextName] = widthNext;
|
|
2259
2251
|
if (_this.resizerNextName === 'nameHeader') {
|
|
2260
|
-
_this.columnsVisibility
|
|
2261
|
-
_this.resizerCurrentWidths
|
|
2252
|
+
_this.columnsVisibility.name = widthNext - _this.state.scrollBarWidth;
|
|
2253
|
+
_this.resizerCurrentWidths.name = widthNext - _this.state.scrollBarWidth;
|
|
2262
2254
|
} else if (_this.resizerActiveName === 'nameHeader') {
|
|
2263
|
-
_this.columnsVisibility
|
|
2264
|
-
_this.resizerCurrentWidths
|
|
2255
|
+
_this.columnsVisibility.name = width - _this.state.scrollBarWidth;
|
|
2256
|
+
_this.resizerCurrentWidths.name = width - _this.state.scrollBarWidth;
|
|
2265
2257
|
}
|
|
2266
2258
|
_this.customWidth = true;
|
|
2267
2259
|
_this.resizeTimeout && clearTimeout(_this.resizeTimeout);
|
|
@@ -2293,10 +2285,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2293
2285
|
if (e.target.dataset.left === 'true') {
|
|
2294
2286
|
_this.resizeLeft = true;
|
|
2295
2287
|
_this.resizerNextDiv = _this.resizerActiveDiv.previousElementSibling;
|
|
2296
|
-
var handle = _this.resizerNextDiv.querySelector(
|
|
2288
|
+
var handle = _this.resizerNextDiv.querySelector(".".concat(_this.props.classes.resizeHandle));
|
|
2297
2289
|
while (_this.resizerNextDiv && !handle && i < 10) {
|
|
2298
2290
|
_this.resizerNextDiv = _this.resizerNextDiv.previousElementSibling;
|
|
2299
|
-
handle = _this.resizerNextDiv.querySelector(
|
|
2291
|
+
handle = _this.resizerNextDiv.querySelector(".".concat(_this.props.classes.resizeHandle));
|
|
2300
2292
|
i++;
|
|
2301
2293
|
}
|
|
2302
2294
|
if (handle && handle.dataset.left !== 'true') {
|
|
@@ -2305,10 +2297,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2305
2297
|
} else {
|
|
2306
2298
|
_this.resizeLeft = false;
|
|
2307
2299
|
_this.resizerNextDiv = _this.resizerActiveDiv.nextElementSibling;
|
|
2308
|
-
/*while (this.resizerNextDiv && !this.resizerNextDiv.querySelector('.' + this.props.classes.resizeHandle) && i < 10) {
|
|
2300
|
+
/* while (this.resizerNextDiv && !this.resizerNextDiv.querySelector('.' + this.props.classes.resizeHandle) && i < 10) {
|
|
2309
2301
|
this.resizerNextDiv = this.resizerNextDiv.nextElementSibling;
|
|
2310
2302
|
i++;
|
|
2311
|
-
}*/
|
|
2303
|
+
} */
|
|
2312
2304
|
}
|
|
2313
2305
|
|
|
2314
2306
|
_this.resizerNextName = _this.resizerNextDiv.dataset.name;
|
|
@@ -2349,19 +2341,21 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2349
2341
|
_this.lastSelectedItems = _this.lastSelectedItems.filter(function (id) {
|
|
2350
2342
|
return id;
|
|
2351
2343
|
});
|
|
2352
|
-
} catch (e) {
|
|
2344
|
+
} catch (e) {
|
|
2345
|
+
// ignore
|
|
2346
|
+
}
|
|
2353
2347
|
var expanded = (window._localStorage || window.localStorage).getItem("".concat(props.dialogName || 'App', ".objectExpanded")) || '[]';
|
|
2354
2348
|
try {
|
|
2355
2349
|
expanded = JSON.parse(expanded);
|
|
2356
2350
|
} catch (e) {
|
|
2357
2351
|
expanded = [];
|
|
2358
2352
|
}
|
|
2359
|
-
var filter = props.defaultFilters || (window._localStorage || window.localStorage).getItem("".concat(props.dialogName || 'App', ".objectFilter")) ||
|
|
2353
|
+
var filter = props.defaultFilters || (window._localStorage || window.localStorage).getItem("".concat(props.dialogName || 'App', ".objectFilter")) || _objectSpread({}, DEFAULT_FILTER);
|
|
2360
2354
|
if (typeof filter === 'string') {
|
|
2361
2355
|
try {
|
|
2362
2356
|
filter = JSON.parse(filter);
|
|
2363
2357
|
} catch (e) {
|
|
2364
|
-
filter =
|
|
2358
|
+
filter = _objectSpread({}, DEFAULT_FILTER);
|
|
2365
2359
|
}
|
|
2366
2360
|
}
|
|
2367
2361
|
filter.expertMode = props.expertMode !== undefined ? props.expertMode : (window._sessionStorage || window.sessionStorage).getItem('App.expertMode') === 'true';
|
|
@@ -2384,7 +2378,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2384
2378
|
var pos = _this.visibleCols.indexOf('type');
|
|
2385
2379
|
pos !== -1 && _this.visibleCols.splice(pos, 1);
|
|
2386
2380
|
}
|
|
2387
|
-
|
|
2381
|
+
|
|
2382
|
+
// this.possibleCols = SCREEN_WIDTHS.xl.fields;
|
|
2383
|
+
|
|
2388
2384
|
var customDialog = null;
|
|
2389
2385
|
if (props.router) {
|
|
2390
2386
|
var location = props.router.getLocation();
|
|
@@ -2415,7 +2411,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2415
2411
|
columnsWidths = {};
|
|
2416
2412
|
}
|
|
2417
2413
|
_this.imagePrefix = props.imagePrefix || '.';
|
|
2418
|
-
var foldersFirst = (window._localStorage || window.localStorage).getItem((props.dialogName || 'App'
|
|
2414
|
+
var foldersFirst = (window._localStorage || window.localStorage).getItem("".concat(props.dialogName || 'App', ".foldersFirst"));
|
|
2419
2415
|
if (foldersFirst === 'false') {
|
|
2420
2416
|
foldersFirst = false;
|
|
2421
2417
|
} else if (foldersFirst === 'true') {
|
|
@@ -2425,7 +2421,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2425
2421
|
}
|
|
2426
2422
|
var statesView = false;
|
|
2427
2423
|
try {
|
|
2428
|
-
statesView = _this.props.objectStatesView ? JSON.parse((window._localStorage || window.localStorage).getItem((props.dialogName || 'App'
|
|
2424
|
+
statesView = _this.props.objectStatesView ? JSON.parse((window._localStorage || window.localStorage).getItem("".concat(props.dialogName || 'App', ".objectStatesView"))) || false : false;
|
|
2429
2425
|
} catch (error) {
|
|
2430
2426
|
// ignore
|
|
2431
2427
|
}
|
|
@@ -2447,7 +2443,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2447
2443
|
viewFileDialog: '',
|
|
2448
2444
|
enumDialog: null,
|
|
2449
2445
|
roleDialog: null,
|
|
2450
|
-
modalEmptyId: null,
|
|
2451
2446
|
statesView: statesView,
|
|
2452
2447
|
columns: columns,
|
|
2453
2448
|
columnsForAdmin: null,
|
|
@@ -2523,7 +2518,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2523
2518
|
if (id === 'id') {
|
|
2524
2519
|
SCREEN_WIDTHS[_this.props.width].idWidth = resizerCurrentWidths.id;
|
|
2525
2520
|
} else if (id === 'nameHeader') {
|
|
2526
|
-
SCREEN_WIDTHS[_this.props.width].widths
|
|
2521
|
+
SCREEN_WIDTHS[_this.props.width].widths.name = resizerCurrentWidths[id];
|
|
2527
2522
|
} else if (SCREEN_WIDTHS[_this.props.width].widths[id] !== undefined) {
|
|
2528
2523
|
SCREEN_WIDTHS[_this.props.width].widths[id] = resizerCurrentWidths[id];
|
|
2529
2524
|
}
|
|
@@ -2543,7 +2538,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2543
2538
|
var props = this.props;
|
|
2544
2539
|
var objects;
|
|
2545
2540
|
return new Promise(function (resolve) {
|
|
2546
|
-
|
|
2541
|
+
_this2.setState({
|
|
2547
2542
|
updating: true
|
|
2548
2543
|
}, function () {
|
|
2549
2544
|
return resolve();
|
|
@@ -2557,13 +2552,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2557
2552
|
console.error('more than one type does not supported! Use filterFunc instead');
|
|
2558
2553
|
}
|
|
2559
2554
|
return props.socket.getObjectView(null, null, props.types[0]);
|
|
2560
|
-
} else {
|
|
2561
|
-
return !objects['system.config'] ? props.socket.getObject('system.config').then(function (obj) {
|
|
2562
|
-
return {
|
|
2563
|
-
'system.config': obj
|
|
2564
|
-
};
|
|
2565
|
-
}) : Promise.resolve(null);
|
|
2566
2555
|
}
|
|
2556
|
+
return !objects['system.config'] ? props.socket.getObject('system.config').then(function (obj) {
|
|
2557
|
+
return {
|
|
2558
|
+
'system.config': obj
|
|
2559
|
+
};
|
|
2560
|
+
}) : Promise.resolve(null);
|
|
2567
2561
|
}).then(function (moreObjects) {
|
|
2568
2562
|
_this2.systemConfig = objects['system.config'] || moreObjects['system.config'] || {};
|
|
2569
2563
|
if (moreObjects) {
|
|
@@ -2616,7 +2610,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2616
2610
|
_this2.defaultHistory = '';
|
|
2617
2611
|
}
|
|
2618
2612
|
})["catch"](function (e) {
|
|
2619
|
-
return window.alert(
|
|
2613
|
+
return window.alert("Cannot get state: ".concat(e));
|
|
2620
2614
|
});
|
|
2621
2615
|
}
|
|
2622
2616
|
return _this2.getAdditionalColumns();
|
|
@@ -2636,7 +2630,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2636
2630
|
if (node && !applyFilter(node, _this2.state.filter, _this2.state.lang, _this2.objects, null, null, props.customFilter, props.types)) {
|
|
2637
2631
|
// reset filter
|
|
2638
2632
|
_this2.setState({
|
|
2639
|
-
filter:
|
|
2633
|
+
filter: _objectSpread({}, DEFAULT_FILTER),
|
|
2640
2634
|
columnsForAdmin: columnsForAdmin
|
|
2641
2635
|
}, function () {
|
|
2642
2636
|
_this2.setState({
|
|
@@ -2764,7 +2758,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2764
2758
|
|
|
2765
2759
|
// remove all subscribes
|
|
2766
2760
|
this.subscribes.forEach(function (pattern) {
|
|
2767
|
-
console.log(
|
|
2761
|
+
console.log("- unsubscribe ".concat(pattern));
|
|
2768
2762
|
_this5.props.socket.unsubscribeState(pattern, _this5.onStateChange);
|
|
2769
2763
|
});
|
|
2770
2764
|
this.subscribes = [];
|
|
@@ -2780,7 +2774,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2780
2774
|
var _this6 = this;
|
|
2781
2775
|
// remove all subscribes
|
|
2782
2776
|
this.subscribes.forEach(function (pattern) {
|
|
2783
|
-
console.log(
|
|
2777
|
+
console.log("- unsubscribe ".concat(pattern));
|
|
2784
2778
|
_this6.props.socket.unsubscribeState(pattern, _this6.onStateChange);
|
|
2785
2779
|
});
|
|
2786
2780
|
this.subscribes = [];
|
|
@@ -2798,7 +2792,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2798
2792
|
value: function renderErrorDialog() {
|
|
2799
2793
|
var _this7 = this;
|
|
2800
2794
|
return this.state.error ? /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
2801
|
-
open:
|
|
2795
|
+
open: !0,
|
|
2802
2796
|
maxWidth: "sm",
|
|
2803
2797
|
fullWidth: true,
|
|
2804
2798
|
onClose: function onClose() {
|
|
@@ -2868,24 +2862,22 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2868
2862
|
return _this8.onAfterSelect();
|
|
2869
2863
|
});
|
|
2870
2864
|
}
|
|
2871
|
-
} else {
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
selected.splice(pos, 1);
|
|
2881
|
-
}
|
|
2882
|
-
this.setState({
|
|
2883
|
-
selected: selected,
|
|
2884
|
-
selectedNonObject: ''
|
|
2885
|
-
}, function () {
|
|
2886
|
-
return _this8.onAfterSelect(isDouble);
|
|
2887
|
-
});
|
|
2865
|
+
} else if (this.objects[toggleItem] && (!this.props.types || this.props.types.includes(this.objects[toggleItem].type))) {
|
|
2866
|
+
(window._localStorage || window.localStorage).removeItem("".concat(this.props.dialogName || 'App', ".selectedNonObject"));
|
|
2867
|
+
var selected = (0, _toConsumableArray2["default"])(this.state.selected);
|
|
2868
|
+
var pos = selected.indexOf(toggleItem);
|
|
2869
|
+
if (pos === -1) {
|
|
2870
|
+
selected.push(toggleItem);
|
|
2871
|
+
selected.sort();
|
|
2872
|
+
} else if (!isDouble) {
|
|
2873
|
+
selected.splice(pos, 1);
|
|
2888
2874
|
}
|
|
2875
|
+
this.setState({
|
|
2876
|
+
selected: selected,
|
|
2877
|
+
selectedNonObject: ''
|
|
2878
|
+
}, function () {
|
|
2879
|
+
return _this8.onAfterSelect(isDouble);
|
|
2880
|
+
});
|
|
2889
2881
|
}
|
|
2890
2882
|
}
|
|
2891
2883
|
|
|
@@ -2965,56 +2957,55 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2965
2957
|
var _this9 = this;
|
|
2966
2958
|
if (!this.state.columnsSelectorShow) {
|
|
2967
2959
|
return null;
|
|
2968
|
-
}
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2960
|
+
}
|
|
2961
|
+
return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
2962
|
+
onClose: function onClose() {
|
|
2963
|
+
return _this9.setState({
|
|
2964
|
+
columnsSelectorShow: false
|
|
2965
|
+
});
|
|
2966
|
+
},
|
|
2967
|
+
open: !0,
|
|
2968
|
+
classes: {
|
|
2969
|
+
root: _Utils["default"].clsx(this.props.classes.dialogColumns, this.props.classes["transparent_".concat(this.state.columnsDialogTransparent)])
|
|
2970
|
+
}
|
|
2971
|
+
}, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
|
|
2972
|
+
className: this.props.classes.fontSizeTitle
|
|
2973
|
+
}, this.props.t('ra_Configure')), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], {
|
|
2974
|
+
className: this.props.classes.fontSizeTitle
|
|
2975
|
+
}, /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
|
|
2976
|
+
className: this.props.classes.switchColumnAuto,
|
|
2977
|
+
control: /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
2978
|
+
checked: this.state.foldersFirst,
|
|
2979
|
+
onChange: function onChange() {
|
|
2980
|
+
(window._localStorage || window.localStorage).setItem("".concat(_this9.props.dialogName || 'App', ".foldersFirst"), _this9.state.foldersFirst ? 'false' : 'true');
|
|
2981
|
+
_this9.setState({
|
|
2982
|
+
foldersFirst: !_this9.state.foldersFirst
|
|
2973
2983
|
});
|
|
2974
|
-
},
|
|
2975
|
-
open: true,
|
|
2976
|
-
classes: {
|
|
2977
|
-
root: _Utils["default"].clsx(this.props.classes.dialogColumns, this.props.classes['transparent_' + this.state.columnsDialogTransparent])
|
|
2978
2984
|
}
|
|
2979
|
-
},
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
_this9.setState({
|
|
2990
|
-
foldersFirst: !_this9.state.foldersFirst
|
|
2991
|
-
});
|
|
2992
|
-
}
|
|
2993
|
-
}),
|
|
2994
|
-
label: this.props.t('ra_Folders always first')
|
|
2995
|
-
}), /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
|
|
2996
|
-
className: this.props.classes.switchColumnAuto,
|
|
2997
|
-
control: /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
2998
|
-
checked: this.state.linesEnabled,
|
|
2999
|
-
onChange: function onChange() {
|
|
3000
|
-
(window._localStorage || window.localStorage).setItem((_this9.props.dialogName || 'App') + '.lines', _this9.state.linesEnabled ? 'false' : 'true');
|
|
3001
|
-
_this9.setState({
|
|
3002
|
-
linesEnabled: !_this9.state.linesEnabled
|
|
3003
|
-
});
|
|
3004
|
-
}
|
|
3005
|
-
}),
|
|
3006
|
-
label: this.props.t('ra_Show lines between rows')
|
|
3007
|
-
})), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
3008
|
-
variant: "contained",
|
|
3009
|
-
onClick: function onClick() {
|
|
3010
|
-
return _this9.setState({
|
|
3011
|
-
columnsSelectorShow: false
|
|
2985
|
+
}),
|
|
2986
|
+
label: this.props.t('ra_Folders always first')
|
|
2987
|
+
}), /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
|
|
2988
|
+
className: this.props.classes.switchColumnAuto,
|
|
2989
|
+
control: /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
2990
|
+
checked: this.state.linesEnabled,
|
|
2991
|
+
onChange: function onChange() {
|
|
2992
|
+
(window._localStorage || window.localStorage).setItem("".concat(_this9.props.dialogName || 'App', ".lines"), _this9.state.linesEnabled ? 'false' : 'true');
|
|
2993
|
+
_this9.setState({
|
|
2994
|
+
linesEnabled: !_this9.state.linesEnabled
|
|
3012
2995
|
});
|
|
3013
|
-
}
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
2996
|
+
}
|
|
2997
|
+
}),
|
|
2998
|
+
label: this.props.t('ra_Show lines between rows')
|
|
2999
|
+
})), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
3000
|
+
variant: "contained",
|
|
3001
|
+
onClick: function onClick() {
|
|
3002
|
+
return _this9.setState({
|
|
3003
|
+
columnsSelectorShow: false
|
|
3004
|
+
});
|
|
3005
|
+
},
|
|
3006
|
+
color: "primary",
|
|
3007
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_Close["default"], null)
|
|
3008
|
+
}, this.texts.close)));
|
|
3018
3009
|
}
|
|
3019
3010
|
|
|
3020
3011
|
/**
|
|
@@ -3031,7 +3022,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3031
3022
|
return columnsForAdmin = _this10.parseObjectForAdmins(columnsForAdmin, obj);
|
|
3032
3023
|
});
|
|
3033
3024
|
return columnsForAdmin;
|
|
3034
|
-
})["catch"](function (
|
|
3025
|
+
})["catch"](function () {
|
|
3035
3026
|
// window.alert('Cannot get adapters: ' + e);
|
|
3036
3027
|
// Object browser in Web has no additional columns
|
|
3037
3028
|
});
|
|
@@ -3066,7 +3057,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3066
3057
|
if (!_root || !_parts.length) {
|
|
3067
3058
|
return null;
|
|
3068
3059
|
}
|
|
3069
|
-
_partyId = (_partyId ? _partyId
|
|
3060
|
+
_partyId = (_partyId ? "".concat(_partyId, ".") : '') + _parts.shift();
|
|
3070
3061
|
if (_root.children) {
|
|
3071
3062
|
var item = _root.children.find(function (i) {
|
|
3072
3063
|
return i.data.id === _partyId;
|
|
@@ -3074,15 +3065,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3074
3065
|
if (item) {
|
|
3075
3066
|
if (item.data.id === id) {
|
|
3076
3067
|
return item;
|
|
3077
|
-
}
|
|
3068
|
+
}
|
|
3069
|
+
if (_parts.length) {
|
|
3078
3070
|
return this.findItem(id, _parts, item, _partyId);
|
|
3079
3071
|
}
|
|
3080
3072
|
} else {
|
|
3081
3073
|
return null;
|
|
3082
3074
|
}
|
|
3083
|
-
} else {
|
|
3084
|
-
return null;
|
|
3085
3075
|
}
|
|
3076
|
+
return null;
|
|
3086
3077
|
}
|
|
3087
3078
|
|
|
3088
3079
|
/**
|
|
@@ -3142,16 +3133,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3142
3133
|
if (!item.path) {
|
|
3143
3134
|
console.warn("Admin columns for ".concat(obj._id, " ignored, because path not found"));
|
|
3144
3135
|
return null;
|
|
3145
|
-
} else {
|
|
3146
|
-
return {
|
|
3147
|
-
path: item.path,
|
|
3148
|
-
name: item.name[_this11.props.lang] || item.name.en,
|
|
3149
|
-
width: item.width,
|
|
3150
|
-
edit: !!item.edit,
|
|
3151
|
-
type: item.type,
|
|
3152
|
-
objTypes: item.objTypes
|
|
3153
|
-
};
|
|
3154
3136
|
}
|
|
3137
|
+
return {
|
|
3138
|
+
path: item.path,
|
|
3139
|
+
name: item.name[_this11.props.lang] || item.name.en,
|
|
3140
|
+
width: item.width,
|
|
3141
|
+
edit: !!item.edit,
|
|
3142
|
+
type: item.type,
|
|
3143
|
+
objTypes: item.objTypes
|
|
3144
|
+
};
|
|
3155
3145
|
}).filter(function (item) {
|
|
3156
3146
|
return item;
|
|
3157
3147
|
});
|
|
@@ -3170,7 +3160,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3170
3160
|
/**
|
|
3171
3161
|
* @param {string} id
|
|
3172
3162
|
* @param {ioBroker.Object} obj
|
|
3173
|
-
* @param {import('./types').OldObject} oldObj
|
|
3174
3163
|
*/
|
|
3175
3164
|
}, {
|
|
3176
3165
|
key: "subscribe",
|
|
@@ -3239,12 +3228,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3239
3228
|
value: function onFilter(name, value) {
|
|
3240
3229
|
var _this13 = this;
|
|
3241
3230
|
this.filterTimer = null;
|
|
3242
|
-
var filter = {};
|
|
3243
|
-
Object.keys(this.filterRefs).forEach(function (
|
|
3244
|
-
if (_this13.filterRefs[
|
|
3245
|
-
for (var i = 0; i < _this13.filterRefs[
|
|
3246
|
-
if (_this13.filterRefs[
|
|
3247
|
-
filter[
|
|
3231
|
+
var filter = _objectSpread({}, this.state.filter);
|
|
3232
|
+
Object.keys(this.filterRefs).forEach(function (_name) {
|
|
3233
|
+
if (_this13.filterRefs[_name] && _this13.filterRefs[_name].current) {
|
|
3234
|
+
for (var i = 0; i < _this13.filterRefs[_name].current.children.length; i++) {
|
|
3235
|
+
if (_this13.filterRefs[_name].current.children[i].tagName === 'INPUT') {
|
|
3236
|
+
filter[_name] = _this13.filterRefs[_name].current.children[i].value;
|
|
3248
3237
|
break;
|
|
3249
3238
|
}
|
|
3250
3239
|
}
|
|
@@ -3256,9 +3245,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3256
3245
|
(window._sessionStorage || window.sessionStorage).setItem('App.expertMode', value ? 'true' : 'false');
|
|
3257
3246
|
}
|
|
3258
3247
|
}
|
|
3259
|
-
filter = Object.assign({}, this.state.filter, filter);
|
|
3260
3248
|
if (JSON.stringify(this.state.filter) !== JSON.stringify(filter)) {
|
|
3261
|
-
(window._localStorage || window.localStorage).setItem((this.props.dialogName || 'App'
|
|
3249
|
+
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectFilter"), JSON.stringify(filter));
|
|
3262
3250
|
this.setState({
|
|
3263
3251
|
filter: filter
|
|
3264
3252
|
}, function () {
|
|
@@ -3270,7 +3258,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3270
3258
|
key: "clearFilter",
|
|
3271
3259
|
value: function clearFilter() {
|
|
3272
3260
|
var _this14 = this;
|
|
3273
|
-
var filter = {};
|
|
3261
|
+
var filter = _objectSpread({}, this.state.filter);
|
|
3274
3262
|
Object.keys(this.filterRefs).forEach(function (name) {
|
|
3275
3263
|
if (_this14.filterRefs[name] && _this14.filterRefs[name].current) {
|
|
3276
3264
|
for (var i = 0; i < _this14.filterRefs[name].current.childNodes.length; i++) {
|
|
@@ -3283,9 +3271,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3283
3271
|
}
|
|
3284
3272
|
}
|
|
3285
3273
|
});
|
|
3286
|
-
filter = Object.assign({}, this.state.filter, filter);
|
|
3287
3274
|
if (JSON.stringify(this.state.filter) !== JSON.stringify(filter)) {
|
|
3288
|
-
(window._localStorage || window.localStorage).setItem((this.props.dialogName || 'App'
|
|
3275
|
+
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectFilter"), JSON.stringify(filter));
|
|
3289
3276
|
this.setState({
|
|
3290
3277
|
filter: filter,
|
|
3291
3278
|
filterKey: this.state.filterKey + 1
|
|
@@ -3316,8 +3303,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3316
3303
|
_this$filterRefs$name2;
|
|
3317
3304
|
return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
|
|
3318
3305
|
className: _Utils["default"].clsx(this.props.classes.headerCellInput, this.props.classes.filterInput),
|
|
3319
|
-
key: name
|
|
3320
|
-
//style={{ marginTop: 0, marginBottom: 0 }}
|
|
3306
|
+
key: "".concat(name, "_").concat(this.state.filterKey)
|
|
3307
|
+
// style={{ marginTop: 0, marginBottom: 0 }}
|
|
3321
3308
|
,
|
|
3322
3309
|
margin: "dense"
|
|
3323
3310
|
}, /*#__PURE__*/_react["default"].createElement(_Input["default"], {
|
|
@@ -3326,7 +3313,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3326
3313
|
underline: 'no-underline'
|
|
3327
3314
|
},
|
|
3328
3315
|
id: name,
|
|
3329
|
-
placeholder: this.texts[
|
|
3316
|
+
placeholder: this.texts["filter_".concat(name)],
|
|
3330
3317
|
defaultValue: this.state.filter[name],
|
|
3331
3318
|
onChange: function onChange() {
|
|
3332
3319
|
_this16.filterTimer && clearTimeout(_this16.filterTimer);
|
|
@@ -3370,9 +3357,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3370
3357
|
}
|
|
3371
3358
|
}, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
3372
3359
|
variant: "standard",
|
|
3373
|
-
key: name
|
|
3360
|
+
key: "".concat(name, "_").concat(this.state.filterKey),
|
|
3374
3361
|
ref: this.filterRefs[name],
|
|
3375
|
-
className: this.props.classes.headerCellInput
|
|
3362
|
+
className: "".concat(this.props.classes.headerCellInput, " no-underline"),
|
|
3376
3363
|
onChange: function onChange() {
|
|
3377
3364
|
_this17.filterTimer && clearTimeout(_this17.filterTimer);
|
|
3378
3365
|
_this17.filterTimer = setTimeout(function () {
|
|
@@ -3390,25 +3377,25 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3390
3377
|
value: ""
|
|
3391
3378
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
3392
3379
|
className: this.props.classes.selectNone
|
|
3393
|
-
}, this.texts[
|
|
3380
|
+
}, this.texts["filter_".concat(name)])), values.map(function (item) {
|
|
3394
3381
|
var id;
|
|
3395
|
-
var
|
|
3382
|
+
var _name;
|
|
3396
3383
|
var icon;
|
|
3397
3384
|
if ((0, _typeof2["default"])(item) === 'object') {
|
|
3398
3385
|
id = item.value;
|
|
3399
|
-
|
|
3386
|
+
_name = item.name;
|
|
3400
3387
|
icon = item.icon;
|
|
3401
3388
|
} else {
|
|
3402
3389
|
id = item;
|
|
3403
|
-
|
|
3390
|
+
_name = item;
|
|
3404
3391
|
}
|
|
3405
3392
|
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
3406
3393
|
className: _this17.props.classes.headerCellSelectItem,
|
|
3407
3394
|
key: id,
|
|
3408
3395
|
value: id
|
|
3409
|
-
}, icon
|
|
3396
|
+
}, icon || (hasIcons ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
3410
3397
|
className: "itemIcon"
|
|
3411
|
-
}) : null,
|
|
3398
|
+
}) : null), _name);
|
|
3412
3399
|
})), (_this$filterRefs$name3 = this.filterRefs[name]) !== null && _this$filterRefs$name3 !== void 0 && (_this$filterRefs$name4 = _this$filterRefs$name3.current) !== null && _this$filterRefs$name4 !== void 0 && (_this$filterRefs$name5 = _this$filterRefs$name4.childNodes[1]) !== null && _this$filterRefs$name5 !== void 0 && _this$filterRefs$name5.value ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
3413
3400
|
className: _Utils["default"].clsx(this.props.classes.selectClearButton)
|
|
3414
3401
|
}, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
@@ -3417,7 +3404,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3417
3404
|
var newFilter = _objectSpread({}, _this17.state.filter);
|
|
3418
3405
|
newFilter[name] = '';
|
|
3419
3406
|
_this17.filterRefs[name].current.childNodes[1].value = '';
|
|
3420
|
-
(window._localStorage || window.localStorage).setItem((_this17.props.dialogName || 'App'
|
|
3407
|
+
(window._localStorage || window.localStorage).setItem("".concat(_this17.props.dialogName || 'App', ".objectFilter"), JSON.stringify(newFilter));
|
|
3421
3408
|
_this17.setState({
|
|
3422
3409
|
filter: newFilter,
|
|
3423
3410
|
filterKey: _this17.state.filterKey + 1
|
|
@@ -3514,9 +3501,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3514
3501
|
};
|
|
3515
3502
|
});
|
|
3516
3503
|
return this.getFilterSelect('custom', customs);
|
|
3517
|
-
} else {
|
|
3518
|
-
return null;
|
|
3519
3504
|
}
|
|
3505
|
+
return null;
|
|
3520
3506
|
}
|
|
3521
3507
|
|
|
3522
3508
|
/**
|
|
@@ -3538,7 +3524,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3538
3524
|
});
|
|
3539
3525
|
if (root === this.root) {
|
|
3540
3526
|
expanded.sort();
|
|
3541
|
-
(window._localStorage || window.localStorage).setItem((this.props.dialogName || 'App'
|
|
3527
|
+
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectExpanded"), JSON.stringify(expanded));
|
|
3542
3528
|
this.setState({
|
|
3543
3529
|
expanded: expanded
|
|
3544
3530
|
});
|
|
@@ -3597,24 +3583,17 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3597
3583
|
* @param {any[]} expanded
|
|
3598
3584
|
*/
|
|
3599
3585
|
}, {
|
|
3600
|
-
key: "
|
|
3601
|
-
value:
|
|
3602
|
-
return expanded.filter(function (id) {
|
|
3603
|
-
return id.split('.').length <= depth;
|
|
3604
|
-
});
|
|
3605
|
-
}
|
|
3606
|
-
|
|
3586
|
+
key: "onExpandVisible",
|
|
3587
|
+
value:
|
|
3607
3588
|
/**
|
|
3608
3589
|
* @private
|
|
3609
3590
|
*/
|
|
3610
|
-
|
|
3611
|
-
key: "onExpandVisible",
|
|
3612
|
-
value: function onExpandVisible() {
|
|
3591
|
+
function onExpandVisible() {
|
|
3613
3592
|
if (this.state.depth < 9) {
|
|
3614
3593
|
var depth = this.state.depth + 1;
|
|
3615
3594
|
var expanded = (0, _toConsumableArray2["default"])(this.state.expanded);
|
|
3616
3595
|
this.expandDepth(this.root, depth, expanded);
|
|
3617
|
-
(window._localStorage || window.localStorage).setItem((this.props.dialogName || 'App'
|
|
3596
|
+
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectExpanded"), JSON.stringify(expanded));
|
|
3618
3597
|
this.setState({
|
|
3619
3598
|
depth: depth,
|
|
3620
3599
|
expanded: expanded
|
|
@@ -3629,7 +3608,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3629
3608
|
key: "onStatesViewVisible",
|
|
3630
3609
|
value: function onStatesViewVisible() {
|
|
3631
3610
|
var statesView = !this.state.statesView;
|
|
3632
|
-
(window._localStorage || window.localStorage).setItem((this.props.dialogName || 'App'
|
|
3611
|
+
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectStatesView"), JSON.stringify(statesView));
|
|
3633
3612
|
this.setState({
|
|
3634
3613
|
statesView: statesView
|
|
3635
3614
|
});
|
|
@@ -3643,8 +3622,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3643
3622
|
value: function onCollapseVisible() {
|
|
3644
3623
|
if (this.state.depth > 0) {
|
|
3645
3624
|
var depth = this.state.depth - 1;
|
|
3646
|
-
var expanded =
|
|
3647
|
-
(window._localStorage || window.localStorage).setItem((this.props.dialogName || 'App'
|
|
3625
|
+
var expanded = ObjectBrowser.collapseDepth(depth, this.state.expanded);
|
|
3626
|
+
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectExpanded"), JSON.stringify(expanded));
|
|
3648
3627
|
this.setState({
|
|
3649
3628
|
depth: depth,
|
|
3650
3629
|
expanded: expanded
|
|
@@ -3664,7 +3643,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3664
3643
|
var keys = Object.keys(this.objects);
|
|
3665
3644
|
keys.sort();
|
|
3666
3645
|
var id = this.state.selected[0] || this.state.selectedNonObject;
|
|
3667
|
-
var idDot = id
|
|
3646
|
+
var idDot = "".concat(id, ".");
|
|
3668
3647
|
var idLen = idDot.length;
|
|
3669
3648
|
for (var k = 0; k < keys.length; k++) {
|
|
3670
3649
|
var key = keys[k];
|
|
@@ -3676,9 +3655,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3676
3655
|
}
|
|
3677
3656
|
}
|
|
3678
3657
|
return result;
|
|
3679
|
-
} else {
|
|
3680
|
-
return [];
|
|
3681
3658
|
}
|
|
3659
|
+
return [];
|
|
3682
3660
|
}
|
|
3683
3661
|
}, {
|
|
3684
3662
|
key: "_exportObjects",
|
|
@@ -3699,7 +3677,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3699
3677
|
}
|
|
3700
3678
|
}
|
|
3701
3679
|
});
|
|
3702
|
-
generateFile(id
|
|
3680
|
+
generateFile("".concat(id, ".json"), result);
|
|
3703
3681
|
} else {
|
|
3704
3682
|
window.alert(this.props.t('ra_Save of objects-tree is not possible'));
|
|
3705
3683
|
}
|
|
@@ -3710,41 +3688,40 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3710
3688
|
var _this25 = this;
|
|
3711
3689
|
if (this.state.showExportDialog === false) {
|
|
3712
3690
|
return null;
|
|
3713
|
-
} else {
|
|
3714
|
-
return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
3715
|
-
open: true
|
|
3716
|
-
}, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], null, this.props.t('Select type of export')), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], null, this.props.t('You can export all objects or just the selected branch.'), /*#__PURE__*/_react["default"].createElement("br", null), this.props.t('Selected %s object(s)', this.state.showExportDialog))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
3717
|
-
color: "grey",
|
|
3718
|
-
variant: "outlined",
|
|
3719
|
-
onClick: function onClick() {
|
|
3720
|
-
return _this25.setState({
|
|
3721
|
-
showExportDialog: false
|
|
3722
|
-
}, function () {
|
|
3723
|
-
return _this25._exportObjects(true);
|
|
3724
|
-
});
|
|
3725
|
-
}
|
|
3726
|
-
}, this.props.t('ra_All objects')), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
3727
|
-
color: "primary",
|
|
3728
|
-
variant: "contained",
|
|
3729
|
-
autoFocus: true,
|
|
3730
|
-
onClick: function onClick() {
|
|
3731
|
-
return _this25.setState({
|
|
3732
|
-
showExportDialog: false
|
|
3733
|
-
}, function () {
|
|
3734
|
-
return _this25._exportObjects(false);
|
|
3735
|
-
});
|
|
3736
|
-
}
|
|
3737
|
-
}, this.props.t('ra_Only selected')), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
3738
|
-
color: "grey",
|
|
3739
|
-
variant: "contained",
|
|
3740
|
-
onClick: function onClick() {
|
|
3741
|
-
return _this25.setState({
|
|
3742
|
-
showExportDialog: false
|
|
3743
|
-
});
|
|
3744
|
-
},
|
|
3745
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(_Close["default"], null)
|
|
3746
|
-
}, this.props.t('ra_Cancel'))));
|
|
3747
3691
|
}
|
|
3692
|
+
return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
3693
|
+
open: !0
|
|
3694
|
+
}, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], null, this.props.t('Select type of export')), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], null, this.props.t('You can export all objects or just the selected branch.'), /*#__PURE__*/_react["default"].createElement("br", null), this.props.t('Selected %s object(s)', this.state.showExportDialog))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
3695
|
+
color: "grey",
|
|
3696
|
+
variant: "outlined",
|
|
3697
|
+
onClick: function onClick() {
|
|
3698
|
+
return _this25.setState({
|
|
3699
|
+
showExportDialog: false
|
|
3700
|
+
}, function () {
|
|
3701
|
+
return _this25._exportObjects(true);
|
|
3702
|
+
});
|
|
3703
|
+
}
|
|
3704
|
+
}, this.props.t('ra_All objects')), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
3705
|
+
color: "primary",
|
|
3706
|
+
variant: "contained",
|
|
3707
|
+
autoFocus: true,
|
|
3708
|
+
onClick: function onClick() {
|
|
3709
|
+
return _this25.setState({
|
|
3710
|
+
showExportDialog: false
|
|
3711
|
+
}, function () {
|
|
3712
|
+
return _this25._exportObjects(false);
|
|
3713
|
+
});
|
|
3714
|
+
}
|
|
3715
|
+
}, this.props.t('ra_Only selected')), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
3716
|
+
color: "grey",
|
|
3717
|
+
variant: "contained",
|
|
3718
|
+
onClick: function onClick() {
|
|
3719
|
+
return _this25.setState({
|
|
3720
|
+
showExportDialog: false
|
|
3721
|
+
});
|
|
3722
|
+
},
|
|
3723
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_Close["default"], null)
|
|
3724
|
+
}, this.props.t('ra_Cancel'))));
|
|
3748
3725
|
}
|
|
3749
3726
|
|
|
3750
3727
|
/**
|
|
@@ -3765,12 +3742,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3765
3742
|
var id = this.state.selected[0] || this.state.selectedNonObject;
|
|
3766
3743
|
if (id.split('.').length < 2 || this.objects[id] && this.objects[id].type === 'state') {
|
|
3767
3744
|
allowObjectCreation = false;
|
|
3768
|
-
} else {
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
allowObjectCreation = true;
|
|
3773
|
-
}
|
|
3745
|
+
} else if (this.state.filter.expertMode) {
|
|
3746
|
+
allowObjectCreation = true;
|
|
3747
|
+
} else if (id.startsWith('alias.0') || id.startsWith('0_userdata')) {
|
|
3748
|
+
allowObjectCreation = true;
|
|
3774
3749
|
}
|
|
3775
3750
|
}
|
|
3776
3751
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -3916,7 +3891,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3916
3891
|
if (ids.length) {
|
|
3917
3892
|
_this26.pauseSubscribe(true);
|
|
3918
3893
|
if (ids.length === 1) {
|
|
3919
|
-
(window._localStorage || window.localStorage).setItem((_this26.props.dialogName || 'App'
|
|
3894
|
+
(window._localStorage || window.localStorage).setItem("".concat(_this26.props.dialogName || 'App', ".objectSelected"), _this26.state.selected[0]);
|
|
3920
3895
|
_this26.props.router && _this26.props.router.doNavigate(null, 'custom', _this26.state.selected[0]);
|
|
3921
3896
|
}
|
|
3922
3897
|
_this26.setState({
|
|
@@ -3947,7 +3922,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3947
3922
|
} else {
|
|
3948
3923
|
expanded.splice(pos, 1);
|
|
3949
3924
|
}
|
|
3950
|
-
(window._localStorage || window.localStorage).setItem((this.props.dialogName || 'App'
|
|
3925
|
+
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectExpanded"), JSON.stringify(expanded));
|
|
3951
3926
|
this.setState({
|
|
3952
3927
|
expanded: expanded
|
|
3953
3928
|
});
|
|
@@ -3963,7 +3938,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3963
3938
|
value: function onCopy(e, text) {
|
|
3964
3939
|
e.stopPropagation();
|
|
3965
3940
|
e.preventDefault();
|
|
3966
|
-
(0, _copyToClipboard["default"])(text);
|
|
3941
|
+
(0, _copyToClipboard["default"])(text, null);
|
|
3967
3942
|
if (text.length < 50) {
|
|
3968
3943
|
this.setState({
|
|
3969
3944
|
toast: this.props.t('ra_Copied %s', text)
|
|
@@ -3995,7 +3970,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3995
3970
|
onClick: function onClick() {
|
|
3996
3971
|
return _this27.setState({
|
|
3997
3972
|
modalEditOfAccess: true,
|
|
3998
|
-
modalEmptyId: id,
|
|
3999
3973
|
modalEditOfAccessObjData: item.data
|
|
4000
3974
|
});
|
|
4001
3975
|
},
|
|
@@ -4029,7 +4003,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4029
4003
|
size: "large"
|
|
4030
4004
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
4031
4005
|
className: classes.aclText
|
|
4032
|
-
}, isNaN(Number(acl).toString(16)) ? Number(aclSystemConfig).toString(16) : Number(acl).toString(16)))) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
4006
|
+
}, Number.isNaN(Number(acl).toString(16)) ? Number(aclSystemConfig).toString(16) : Number(acl).toString(16)))) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
4033
4007
|
key: "aclEmpty",
|
|
4034
4008
|
className: classes.cellButtonMinWidth
|
|
4035
4009
|
}), /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
@@ -4065,7 +4039,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4065
4039
|
"aria-label": "config",
|
|
4066
4040
|
title: this.texts.customConfig,
|
|
4067
4041
|
onClick: function onClick() {
|
|
4068
|
-
(window._localStorage || window.localStorage).setItem((_this27.props.dialogName || 'App'
|
|
4042
|
+
(window._localStorage || window.localStorage).setItem("".concat(_this27.props.dialogName || 'App', ".objectSelected"), id);
|
|
4069
4043
|
_this27.pauseSubscribe(true);
|
|
4070
4044
|
_this27.props.router && _this27.props.router.doNavigate(null, 'customs', id);
|
|
4071
4045
|
_this27.setState({
|
|
@@ -4084,7 +4058,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4084
4058
|
}, {
|
|
4085
4059
|
key: "readHistory",
|
|
4086
4060
|
value: function readHistory(id) {
|
|
4087
|
-
/*interface GetHistoryOptions {
|
|
4061
|
+
/* interface GetHistoryOptions {
|
|
4088
4062
|
instance?: string;
|
|
4089
4063
|
start?: number;
|
|
4090
4064
|
end?: number;
|
|
@@ -4098,7 +4072,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4098
4072
|
ignoreNull?: boolean;
|
|
4099
4073
|
sessionId?: any;
|
|
4100
4074
|
aggregate?: 'minmax' | 'min' | 'max' | 'average' | 'total' | 'count' | 'none';
|
|
4101
|
-
}*/
|
|
4075
|
+
} */
|
|
4102
4076
|
if (window.sparkline && this.defaultHistory && this.objects[id] && this.objects[id].common && this.objects[id].common.custom && this.objects[id].common.custom[this.defaultHistory]) {
|
|
4103
4077
|
var now = new Date();
|
|
4104
4078
|
now.setHours(now.getHours() - 24);
|
|
@@ -4126,7 +4100,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4126
4100
|
}
|
|
4127
4101
|
}
|
|
4128
4102
|
})["catch"](function (e) {
|
|
4129
|
-
return console.warn(
|
|
4103
|
+
return console.warn("Cannot read history: ".concat(e));
|
|
4130
4104
|
});
|
|
4131
4105
|
}
|
|
4132
4106
|
}
|
|
@@ -4151,7 +4125,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4151
4125
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
4152
4126
|
className: _Utils["default"].clsx(classes.cellValueText, classes.cellValueFile)
|
|
4153
4127
|
}, "[file]");
|
|
4154
|
-
}
|
|
4128
|
+
}
|
|
4129
|
+
if (!this.states[id]) {
|
|
4155
4130
|
if (obj.type === 'state') {
|
|
4156
4131
|
!this.recordStates.includes(id) && this.recordStates.push(id);
|
|
4157
4132
|
this.states[id] = {
|
|
@@ -4160,34 +4135,33 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4160
4135
|
this.subscribe(id);
|
|
4161
4136
|
}
|
|
4162
4137
|
return null;
|
|
4163
|
-
} else {
|
|
4164
|
-
!this.recordStates.includes(id) && this.recordStates.push(id);
|
|
4165
4138
|
}
|
|
4139
|
+
!this.recordStates.includes(id) && this.recordStates.push(id);
|
|
4166
4140
|
var state = this.states[id];
|
|
4167
4141
|
var info = item.data.state;
|
|
4168
4142
|
if (!info) {
|
|
4169
|
-
|
|
4170
|
-
info
|
|
4171
|
-
|
|
4143
|
+
item.data.state = item.data.state || formatValue(id, state, obj, this.texts, this.props.dateFormat, this.props.isFloatComma);
|
|
4144
|
+
info = item.data.state;
|
|
4145
|
+
info.valFull = info.valFull.map(function (_item) {
|
|
4146
|
+
if (_item.t === _this28.texts.quality && state.q) {
|
|
4172
4147
|
return [/*#__PURE__*/_react["default"].createElement("div", {
|
|
4173
4148
|
className: classes.cellValueTooltipBoth,
|
|
4174
|
-
key:
|
|
4175
|
-
},
|
|
4176
|
-
|
|
4177
|
-
!
|
|
4178
|
-
key:
|
|
4179
|
-
}) : null];
|
|
4180
|
-
} else {
|
|
4181
|
-
return [/*#__PURE__*/_react["default"].createElement("div", {
|
|
4182
|
-
className: classes.cellValueTooltipTitle,
|
|
4183
|
-
key: item.t
|
|
4184
|
-
}, item.t, ":"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
4185
|
-
className: classes.cellValueTooltipValue,
|
|
4186
|
-
key: item.t + '_v'
|
|
4187
|
-
}, item.v), !item.nbr ? /*#__PURE__*/_react["default"].createElement("br", {
|
|
4188
|
-
key: item.t + '_br'
|
|
4149
|
+
key: _item.t
|
|
4150
|
+
}, _item.t, ":\xA0", _item.v),
|
|
4151
|
+
// <div className={classes.cellValueTooltipValue} key={item.t + '_v'}>{item.v}</div>,
|
|
4152
|
+
!_item.nbr ? /*#__PURE__*/_react["default"].createElement("br", {
|
|
4153
|
+
key: "".concat(_item.t, "_br")
|
|
4189
4154
|
}) : null];
|
|
4190
4155
|
}
|
|
4156
|
+
return [/*#__PURE__*/_react["default"].createElement("div", {
|
|
4157
|
+
className: classes.cellValueTooltipTitle,
|
|
4158
|
+
key: _item.t
|
|
4159
|
+
}, _item.t, ":\xA0"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
4160
|
+
className: classes.cellValueTooltipValue,
|
|
4161
|
+
key: "".concat(_item.t, "_v")
|
|
4162
|
+
}, _item.v), !_item.nbr ? /*#__PURE__*/_react["default"].createElement("br", {
|
|
4163
|
+
key: "".concat(_item.t, "_br")
|
|
4164
|
+
}) : null];
|
|
4191
4165
|
});
|
|
4192
4166
|
if (this.defaultHistory && this.objects[id] && this.objects[id].common && this.objects[id].common.custom && this.objects[id].common.custom[this.defaultHistory]) {
|
|
4193
4167
|
info.valFull.push( /*#__PURE__*/_react["default"].createElement("svg", {
|
|
@@ -4220,7 +4194,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4220
4194
|
},
|
|
4221
4195
|
key: "cc"
|
|
4222
4196
|
})
|
|
4223
|
-
|
|
4197
|
+
// <IconEdit className={ Utils.clsx(classes.cellButtonsValueButton, 'copyButton', classes.cellButtonsValueButtonEdit) } key="ce" />
|
|
4224
4198
|
];
|
|
4225
4199
|
}
|
|
4226
4200
|
|
|
@@ -4253,49 +4227,49 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4253
4227
|
}, {
|
|
4254
4228
|
key: "_syncEnum",
|
|
4255
4229
|
value: function _syncEnum(id, enumIds, newArray, cb) {
|
|
4256
|
-
var
|
|
4230
|
+
var _this$info$objects$en,
|
|
4231
|
+
_this29 = this;
|
|
4257
4232
|
if (!enumIds || !enumIds.length) {
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
})["catch"](function (e) {
|
|
4274
|
-
return _this29.showError(e);
|
|
4275
|
-
}));
|
|
4276
|
-
}
|
|
4277
|
-
}
|
|
4278
|
-
|
|
4279
|
-
// add to it
|
|
4280
|
-
if (newArray.includes(enumId) && !((_this$info$objects$en3 = this.info.objects[enumId].common.members) !== null && _this$info$objects$en3 !== void 0 && _this$info$objects$en3.includes(id))) {
|
|
4281
|
-
// add to object
|
|
4282
|
-
var _obj = JSON.parse(JSON.stringify(this.info.objects[enumId]));
|
|
4283
|
-
_obj.common.members = _obj.common.members || [];
|
|
4284
|
-
_obj.common.members.push(id);
|
|
4285
|
-
_obj.common.members.sort();
|
|
4286
|
-
promises.push(this.props.socket.setObject(enumId, _obj).then(function () {
|
|
4287
|
-
return _this29.info.objects[enumId] = _obj;
|
|
4233
|
+
cb && cb();
|
|
4234
|
+
return;
|
|
4235
|
+
}
|
|
4236
|
+
var enumId = enumIds.pop();
|
|
4237
|
+
var promises = [];
|
|
4238
|
+
if ((_this$info$objects$en = this.info.objects[enumId]) !== null && _this$info$objects$en !== void 0 && _this$info$objects$en.common) {
|
|
4239
|
+
var _this$info$objects$en2, _this$info$objects$en3;
|
|
4240
|
+
if ((_this$info$objects$en2 = this.info.objects[enumId].common.members) !== null && _this$info$objects$en2 !== void 0 && _this$info$objects$en2.length) {
|
|
4241
|
+
var pos = this.info.objects[enumId].common.members.indexOf(id);
|
|
4242
|
+
if (pos !== -1 && !newArray.includes(enumId)) {
|
|
4243
|
+
// delete from members
|
|
4244
|
+
var obj = JSON.parse(JSON.stringify(this.info.objects[enumId]));
|
|
4245
|
+
obj.common.members.splice(pos, 1);
|
|
4246
|
+
promises.push(this.props.socket.setObject(enumId, obj).then(function () {
|
|
4247
|
+
return _this29.info.objects[enumId] = obj;
|
|
4288
4248
|
})["catch"](function (e) {
|
|
4289
4249
|
return _this29.showError(e);
|
|
4290
4250
|
}));
|
|
4291
4251
|
}
|
|
4292
4252
|
}
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4253
|
+
|
|
4254
|
+
// add to it
|
|
4255
|
+
if (newArray.includes(enumId) && !((_this$info$objects$en3 = this.info.objects[enumId].common.members) !== null && _this$info$objects$en3 !== void 0 && _this$info$objects$en3.includes(id))) {
|
|
4256
|
+
// add to object
|
|
4257
|
+
var _obj = JSON.parse(JSON.stringify(this.info.objects[enumId]));
|
|
4258
|
+
_obj.common.members = _obj.common.members || [];
|
|
4259
|
+
_obj.common.members.push(id);
|
|
4260
|
+
_obj.common.members.sort();
|
|
4261
|
+
promises.push(this.props.socket.setObject(enumId, _obj).then(function () {
|
|
4262
|
+
return _this29.info.objects[enumId] = _obj;
|
|
4263
|
+
})["catch"](function (e) {
|
|
4264
|
+
return _this29.showError(e);
|
|
4265
|
+
}));
|
|
4266
|
+
}
|
|
4298
4267
|
}
|
|
4268
|
+
Promise.all(promises).then(function () {
|
|
4269
|
+
return setTimeout(function () {
|
|
4270
|
+
return _this29._syncEnum(id, enumIds, newArray, cb);
|
|
4271
|
+
}, 0);
|
|
4272
|
+
});
|
|
4299
4273
|
}
|
|
4300
4274
|
|
|
4301
4275
|
/**
|
|
@@ -4308,7 +4282,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4308
4282
|
var _this30 = this;
|
|
4309
4283
|
var toCheck = (0, _toConsumableArray2["default"])(this.info[enumName === 'func' ? 'funcEnums' : 'roomEnums']);
|
|
4310
4284
|
return new Promise(function (resolve) {
|
|
4311
|
-
|
|
4285
|
+
_this30._syncEnum(id, toCheck, newArray, function (error) {
|
|
4312
4286
|
error && _this30.showError(error);
|
|
4313
4287
|
// force update of object
|
|
4314
4288
|
resolve();
|
|
@@ -4336,14 +4310,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4336
4310
|
icon: getSelectIdIcon(_this31.objects, id, _this31.imagePrefix)
|
|
4337
4311
|
};
|
|
4338
4312
|
});
|
|
4339
|
-
enums.forEach(function (
|
|
4340
|
-
if (
|
|
4341
|
-
|
|
4313
|
+
enums.forEach(function (_item) {
|
|
4314
|
+
if (_item.icon && typeof _item.icon === 'string') {
|
|
4315
|
+
_item.icon = /*#__PURE__*/_react["default"].createElement("div", {
|
|
4342
4316
|
className: _this31.props.classes.enumIconDiv
|
|
4343
4317
|
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
4344
|
-
src:
|
|
4318
|
+
src: _item.icon,
|
|
4345
4319
|
className: _this31.props.classes.enumIcon,
|
|
4346
|
-
alt:
|
|
4320
|
+
alt: _item.name
|
|
4347
4321
|
}));
|
|
4348
4322
|
}
|
|
4349
4323
|
});
|
|
@@ -4378,17 +4352,17 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4378
4352
|
classes: {
|
|
4379
4353
|
root: this.props.classes.enumList
|
|
4380
4354
|
}
|
|
4381
|
-
}, enums.map(function (
|
|
4355
|
+
}, enums.map(function (_item) {
|
|
4382
4356
|
var id;
|
|
4383
4357
|
var name;
|
|
4384
4358
|
var icon;
|
|
4385
|
-
if ((0, _typeof2["default"])(
|
|
4386
|
-
id =
|
|
4387
|
-
name =
|
|
4388
|
-
icon =
|
|
4359
|
+
if ((0, _typeof2["default"])(_item) === 'object') {
|
|
4360
|
+
id = _item.value;
|
|
4361
|
+
name = _item.name;
|
|
4362
|
+
icon = _item.icon;
|
|
4389
4363
|
} else {
|
|
4390
|
-
id =
|
|
4391
|
-
name =
|
|
4364
|
+
id = _item;
|
|
4365
|
+
name = _item;
|
|
4392
4366
|
}
|
|
4393
4367
|
var labelId = "checkbox-list-label-".concat(id);
|
|
4394
4368
|
return /*#__PURE__*/_react["default"].createElement(_ListItem["default"], {
|
|
@@ -4423,9 +4397,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4423
4397
|
id: labelId
|
|
4424
4398
|
}, name), icon ? /*#__PURE__*/_react["default"].createElement(_ListItemSecondaryAction["default"], null, icon) : null);
|
|
4425
4399
|
})));
|
|
4426
|
-
} else {
|
|
4427
|
-
return null;
|
|
4428
4400
|
}
|
|
4401
|
+
return null;
|
|
4429
4402
|
}
|
|
4430
4403
|
|
|
4431
4404
|
/**
|
|
@@ -4453,9 +4426,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4453
4426
|
});
|
|
4454
4427
|
}
|
|
4455
4428
|
});
|
|
4456
|
-
} else {
|
|
4457
|
-
return null;
|
|
4458
4429
|
}
|
|
4430
|
+
return null;
|
|
4459
4431
|
}
|
|
4460
4432
|
|
|
4461
4433
|
/**
|
|
@@ -4475,11 +4447,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4475
4447
|
}
|
|
4476
4448
|
this.customColumnDialog = null;
|
|
4477
4449
|
this.props.socket.getObject(this.state.columnsEditCustomDialog.obj._id).then(function (obj) {
|
|
4478
|
-
if (
|
|
4450
|
+
if (ObjectBrowser.setCustomValue(obj, _this33.state.columnsEditCustomDialog.it, value)) {
|
|
4479
4451
|
return _this33.props.socket.setObject(obj._id, obj);
|
|
4480
|
-
} else {
|
|
4481
|
-
throw new Error(_this33.props.t('ra_Cannot update attribute, because not found in the object'));
|
|
4482
4452
|
}
|
|
4453
|
+
throw new Error(_this33.props.t('ra_Cannot update attribute, because not found in the object'));
|
|
4483
4454
|
}).then(function () {
|
|
4484
4455
|
return _this33.setState({
|
|
4485
4456
|
columnsEditCustomDialog: null
|
|
@@ -4504,7 +4475,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4504
4475
|
var _this34 = this;
|
|
4505
4476
|
if (this.state.columnsEditCustomDialog) {
|
|
4506
4477
|
if (!this.customColumnDialog) {
|
|
4507
|
-
var value =
|
|
4478
|
+
var value = ObjectBrowser.getCustomValue(this.state.columnsEditCustomDialog.obj, this.state.columnsEditCustomDialog.it);
|
|
4508
4479
|
this.customColumnDialog = {
|
|
4509
4480
|
type: this.state.columnsEditCustomDialog.it.type || (0, _typeof2["default"])(value),
|
|
4510
4481
|
initValue: (value === null || value === undefined ? '' : value).toString(),
|
|
@@ -4519,10 +4490,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4519
4490
|
},
|
|
4520
4491
|
maxWidth: "md",
|
|
4521
4492
|
"aria-labelledby": "custom-dialog-title",
|
|
4522
|
-
open:
|
|
4493
|
+
open: !0
|
|
4523
4494
|
}, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
|
|
4524
4495
|
id: "custom-dialog-title"
|
|
4525
|
-
}, this.props.t('ra_Edit object field')
|
|
4496
|
+
}, "".concat(this.props.t('ra_Edit object field'), ": ").concat(this.state.columnsEditCustomDialog.obj._id)), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
|
|
4526
4497
|
id: "alert-dialog-description"
|
|
4527
4498
|
}, this.customColumnDialog.type === 'boolean' ? /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
|
|
4528
4499
|
control: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
@@ -4540,7 +4511,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4540
4511
|
}
|
|
4541
4512
|
}
|
|
4542
4513
|
}),
|
|
4543
|
-
label: this.state.columnsEditCustomDialog.it.name
|
|
4514
|
+
label: "".concat(this.state.columnsEditCustomDialog.it.name, " (").concat(this.state.columnsEditCustomDialog.it.pathText, ")")
|
|
4544
4515
|
}) : /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
4545
4516
|
variant: "standard",
|
|
4546
4517
|
defaultValue: this.customColumnDialog.value,
|
|
@@ -4575,88 +4546,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4575
4546
|
},
|
|
4576
4547
|
startIcon: /*#__PURE__*/_react["default"].createElement(_Close["default"], null)
|
|
4577
4548
|
}, this.props.t('ra_Cancel'))));
|
|
4578
|
-
} else {
|
|
4579
|
-
return null;
|
|
4580
|
-
}
|
|
4581
|
-
}
|
|
4582
|
-
|
|
4583
|
-
/**
|
|
4584
|
-
* @private
|
|
4585
|
-
* @param {any} obj
|
|
4586
|
-
* @param {any} it
|
|
4587
|
-
*/
|
|
4588
|
-
}, {
|
|
4589
|
-
key: "getCustomValue",
|
|
4590
|
-
value: function getCustomValue(obj, it) {
|
|
4591
|
-
if (obj && obj._id && obj._id.startsWith(it.adapter + '.') && it.path.length > 1) {
|
|
4592
|
-
var p = it.path;
|
|
4593
|
-
var value;
|
|
4594
|
-
if (obj[p[0]] && (0, _typeof2["default"])(obj[p[0]]) === 'object') {
|
|
4595
|
-
if (p.length === 2) {
|
|
4596
|
-
// most common case
|
|
4597
|
-
value = obj[p[0]][p[1]];
|
|
4598
|
-
} else if (p.length === 3) {
|
|
4599
|
-
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' ? obj[p[0]][p[1]][p[2]] : null;
|
|
4600
|
-
} else if (p.length === 4) {
|
|
4601
|
-
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] ? obj[p[0]][p[1]][p[2]][p[3]] : null;
|
|
4602
|
-
} else if (p.length === 5) {
|
|
4603
|
-
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && obj[p[0]][p[1]][p[2]][p[3]] ? obj[p[0]][p[1]][p[2]][p[3]][p[4]] : null;
|
|
4604
|
-
} else if (p.length === 6) {
|
|
4605
|
-
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && obj[p[0]][p[1]][p[2]][p[3]] && obj[p[0]][p[1]][p[2]][p[3]][p[4]] ? obj[p[0]][p[1]][p[2]][p[3]][p[4]][p[5]] : null;
|
|
4606
|
-
}
|
|
4607
|
-
if (value === undefined || value === null) {
|
|
4608
|
-
return null;
|
|
4609
|
-
} else {
|
|
4610
|
-
return value;
|
|
4611
|
-
}
|
|
4612
|
-
}
|
|
4613
|
-
} else {
|
|
4614
|
-
return null;
|
|
4615
4549
|
}
|
|
4550
|
+
return null;
|
|
4616
4551
|
}
|
|
4617
4552
|
|
|
4618
4553
|
/**
|
|
4619
4554
|
* @private
|
|
4620
4555
|
* @param {any} obj
|
|
4621
4556
|
* @param {any} it
|
|
4622
|
-
* @param {any} value
|
|
4623
4557
|
*/
|
|
4624
4558
|
}, {
|
|
4625
|
-
key: "
|
|
4626
|
-
value:
|
|
4627
|
-
if (obj && obj._id && obj._id.startsWith(it.adapter + '.') && it.path.length > 1) {
|
|
4628
|
-
var p = it.path;
|
|
4629
|
-
if (obj[p[0]] && (0, _typeof2["default"])(obj[p[0]]) === 'object') {
|
|
4630
|
-
if (p.length === 2) {
|
|
4631
|
-
// most common case
|
|
4632
|
-
obj[p[0]][p[1]] = value;
|
|
4633
|
-
return true;
|
|
4634
|
-
} else if (p.length === 3) {
|
|
4635
|
-
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object') {
|
|
4636
|
-
obj[p[0]][p[1]][p[2]] = value;
|
|
4637
|
-
return true;
|
|
4638
|
-
}
|
|
4639
|
-
} else if (p.length === 4) {
|
|
4640
|
-
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]]) === 'object') {
|
|
4641
|
-
obj[p[0]][p[1]][p[2]][p[3]] = value;
|
|
4642
|
-
return true;
|
|
4643
|
-
}
|
|
4644
|
-
} else if (p.length === 5) {
|
|
4645
|
-
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]]) === 'object' && obj[p[0]][p[1]][p[2]][p[3]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]][p[3]]) === 'object') {
|
|
4646
|
-
obj[p[0]][p[1]][p[2]][p[3]][p[4]] = value;
|
|
4647
|
-
return true;
|
|
4648
|
-
}
|
|
4649
|
-
} else if (p.length === 6) {
|
|
4650
|
-
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]]) === 'object' && obj[p[0]][p[1]][p[2]][p[3]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]][p[3]]) === 'object' && obj[p[0]][p[1]][p[2]][p[3]][p[4]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]][p[3]][p[4]]) === 'object') {
|
|
4651
|
-
obj[p[0]][p[1]][p[2]][p[3]][p[4]][p[5]] = value;
|
|
4652
|
-
return true;
|
|
4653
|
-
}
|
|
4654
|
-
}
|
|
4655
|
-
}
|
|
4656
|
-
}
|
|
4657
|
-
return false;
|
|
4658
|
-
}
|
|
4659
|
-
|
|
4559
|
+
key: "renderCustomValue",
|
|
4560
|
+
value:
|
|
4660
4561
|
/**
|
|
4661
4562
|
* Renders a custom value.
|
|
4662
4563
|
* @param {any} obj
|
|
@@ -4664,15 +4565,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4664
4565
|
* @param {any} item
|
|
4665
4566
|
* @returns {JSX.Element | null}
|
|
4666
4567
|
*/
|
|
4667
|
-
|
|
4668
|
-
key: "renderCustomValue",
|
|
4669
|
-
value: function renderCustomValue(obj, it, item) {
|
|
4568
|
+
function renderCustomValue(obj, it, item) {
|
|
4670
4569
|
var _this35 = this;
|
|
4671
|
-
var text =
|
|
4570
|
+
var text = ObjectBrowser.getCustomValue(obj, it);
|
|
4672
4571
|
if (text !== null && text !== undefined) {
|
|
4673
4572
|
if (it.edit && !this.props.notEditable && (!it.objTypes || it.objTypes.includes(obj.type))) {
|
|
4674
4573
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
4675
|
-
className: _Utils["default"].clsx(this.props.classes.columnCustom, this.props.classes.columnCustomEditable, this.props.classes[
|
|
4574
|
+
className: _Utils["default"].clsx(this.props.classes.columnCustom, this.props.classes.columnCustomEditable, this.props.classes["columnCustom_".concat(it.align)]),
|
|
4676
4575
|
onClick: function onClick() {
|
|
4677
4576
|
return _this35.setState({
|
|
4678
4577
|
columnsEditCustomDialog: {
|
|
@@ -4684,14 +4583,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4684
4583
|
});
|
|
4685
4584
|
}
|
|
4686
4585
|
}, text);
|
|
4687
|
-
} else {
|
|
4688
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
4689
|
-
className: _Utils["default"].clsx(this.props.classes.columnCustom, this.props.classes['columnCustom_' + it.align])
|
|
4690
|
-
}, text);
|
|
4691
4586
|
}
|
|
4692
|
-
|
|
4693
|
-
|
|
4587
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
4588
|
+
className: _Utils["default"].clsx(this.props.classes.columnCustom, this.props.classes["columnCustom_".concat(it.align)])
|
|
4589
|
+
}, text);
|
|
4694
4590
|
}
|
|
4591
|
+
return null;
|
|
4695
4592
|
}
|
|
4696
4593
|
|
|
4697
4594
|
/**
|
|
@@ -4734,16 +4631,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4734
4631
|
return _this36.toggleExpanded(id);
|
|
4735
4632
|
}
|
|
4736
4633
|
});
|
|
4634
|
+
} else if (obj.common && obj.common.write === false && obj.type === 'state') {
|
|
4635
|
+
iconFolder = /*#__PURE__*/_react["default"].createElement(_IconDocumentReadOnly["default"], {
|
|
4636
|
+
className: classes.cellIdIconDocument
|
|
4637
|
+
});
|
|
4737
4638
|
} else {
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
});
|
|
4742
|
-
} else {
|
|
4743
|
-
iconFolder = /*#__PURE__*/_react["default"].createElement(_IconDocument["default"], {
|
|
4744
|
-
className: classes.cellIdIconDocument
|
|
4745
|
-
});
|
|
4746
|
-
}
|
|
4639
|
+
iconFolder = /*#__PURE__*/_react["default"].createElement(_IconDocument["default"], {
|
|
4640
|
+
className: classes.cellIdIconDocument
|
|
4641
|
+
});
|
|
4747
4642
|
}
|
|
4748
4643
|
var iconItem = null;
|
|
4749
4644
|
if (item.data.icon) {
|
|
@@ -4809,9 +4704,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4809
4704
|
}
|
|
4810
4705
|
}
|
|
4811
4706
|
if (obj) {
|
|
4812
|
-
obj.from && newValueTitle.push(this.texts.objectChangedFrom
|
|
4813
|
-
obj.user && newValueTitle.push(this.texts.objectChangedBy
|
|
4814
|
-
obj.ts && newValueTitle.push(this.texts.objectChangedByUser
|
|
4707
|
+
obj.from && newValueTitle.push("".concat(this.texts.objectChangedFrom, " ").concat(obj.from.replace(/^system\.adapter\.|^system\./, '')));
|
|
4708
|
+
obj.user && newValueTitle.push("".concat(this.texts.objectChangedBy, " ").concat(obj.user.replace(/^system\.user\./, '')));
|
|
4709
|
+
obj.ts && newValueTitle.push("".concat(this.texts.objectChangedByUser, " ").concat(_Utils["default"].formatDate(new Date(obj.ts), this.props.dateFormat)));
|
|
4815
4710
|
}
|
|
4816
4711
|
var readWriteAlias = (0, _typeof2["default"])(common === null || common === void 0 ? void 0 : (_common$alias = common.alias) === null || _common$alias === void 0 ? void 0 : _common$alias.id) === 'object';
|
|
4817
4712
|
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", {
|
|
@@ -4867,7 +4762,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4867
4762
|
Object.keys(common.statusStates).forEach(function (name) {
|
|
4868
4763
|
var _id = common.statusStates[name];
|
|
4869
4764
|
if (_id.split('.').length < 3) {
|
|
4870
|
-
_id = id
|
|
4765
|
+
_id = "".concat(id, ".").concat(_id);
|
|
4871
4766
|
}
|
|
4872
4767
|
ids[name] = _id;
|
|
4873
4768
|
if (!_this36.states[_id]) {
|
|
@@ -5038,7 +4933,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5038
4933
|
style: {
|
|
5039
4934
|
width: this.columnsVisibility.type
|
|
5040
4935
|
}
|
|
5041
|
-
}, typeImg, "
|
|
4936
|
+
}, typeImg, "\xA0", obj && obj.type) : null, this.columnsVisibility.role ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5042
4937
|
className: classes.cellRole,
|
|
5043
4938
|
style: {
|
|
5044
4939
|
width: this.columnsVisibility.role,
|
|
@@ -5112,7 +5007,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5112
5007
|
width: _this36.columnsVisibility[it.id]
|
|
5113
5008
|
},
|
|
5114
5009
|
key: it.id,
|
|
5115
|
-
title: it.adapter
|
|
5010
|
+
title: "".concat(it.adapter, " => ").concat(it.pathText)
|
|
5116
5011
|
}, _this36.renderCustomValue(obj, it, item));
|
|
5117
5012
|
}), this.columnsVisibility.val ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5118
5013
|
className: classes.cellValue,
|
|
@@ -5122,29 +5017,28 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5122
5017
|
},
|
|
5123
5018
|
onClick: valueEditable ? function () {
|
|
5124
5019
|
if (!obj || !_this36.states) {
|
|
5125
|
-
return
|
|
5126
|
-
}
|
|
5127
|
-
|
|
5128
|
-
return _this36.setState({
|
|
5020
|
+
// return;
|
|
5021
|
+
} else if ((common === null || common === void 0 ? void 0 : common.type) === 'file') {
|
|
5022
|
+
_this36.setState({
|
|
5129
5023
|
viewFileDialog: id
|
|
5130
5024
|
});
|
|
5131
|
-
}
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
}
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5025
|
+
} else
|
|
5026
|
+
// in non-expert mode control button directly
|
|
5027
|
+
if (!_this36.state.filter.expertMode && item.data.button) {
|
|
5028
|
+
_this36.props.socket.setState(id, true)["catch"](function (e) {
|
|
5029
|
+
return window.alert("Cannot write state \"".concat(id, "\": ").concat(e));
|
|
5030
|
+
});
|
|
5031
|
+
} else {
|
|
5032
|
+
_this36.edit = {
|
|
5033
|
+
val: _this36.states[id] ? _this36.states[id].val : '',
|
|
5034
|
+
q: _this36.states[id] ? _this36.states[id].q || 0 : 0,
|
|
5035
|
+
ack: false,
|
|
5036
|
+
id: id
|
|
5037
|
+
};
|
|
5038
|
+
_this36.setState({
|
|
5039
|
+
updateOpened: true
|
|
5040
|
+
});
|
|
5041
|
+
}
|
|
5148
5042
|
} : undefined
|
|
5149
5043
|
}, this.renderColumnValue(id, item, classes)) : null, this.columnsVisibility.buttons ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5150
5044
|
className: classes.cellButtons,
|
|
@@ -5323,12 +5217,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5323
5217
|
if (columnsForAdmin && columns) {
|
|
5324
5218
|
Object.keys(columnsForAdmin).sort().forEach(function (adapter) {
|
|
5325
5219
|
return columnsForAdmin[adapter].forEach(function (column) {
|
|
5326
|
-
var id =
|
|
5220
|
+
var id = "_".concat(adapter, "_").concat(column.path);
|
|
5327
5221
|
_this38.columnsVisibility[id] = columns.includes(id);
|
|
5328
5222
|
if (columns.includes(id)) {
|
|
5329
5223
|
var item = {
|
|
5330
5224
|
adapter: adapter,
|
|
5331
|
-
id:
|
|
5225
|
+
id: "_".concat(adapter, "_").concat(column.path),
|
|
5332
5226
|
name: column.name,
|
|
5333
5227
|
path: column.path.split('.'),
|
|
5334
5228
|
pathText: column.path
|
|
@@ -5369,9 +5263,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5369
5263
|
var newWidth = Object.keys(this.columnsVisibility).reduce(function (accumulator, name) {
|
|
5370
5264
|
if (name === 'id' || typeof _this38.columnsVisibility[name] === 'string' || !_this38.columnsVisibility[name]) {
|
|
5371
5265
|
return accumulator;
|
|
5372
|
-
} else {
|
|
5373
|
-
return accumulator + _this38.columnsVisibility[name];
|
|
5374
5266
|
}
|
|
5267
|
+
return accumulator + _this38.columnsVisibility[name];
|
|
5375
5268
|
}, 0);
|
|
5376
5269
|
this.columnsVisibility.id = "calc(100% - ".concat(newWidth, "px)");
|
|
5377
5270
|
}
|
|
@@ -5411,7 +5304,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5411
5304
|
"data-min": 240,
|
|
5412
5305
|
"data-name": "id"
|
|
5413
5306
|
}, this.getFilterInput('id'), /*#__PURE__*/_react["default"].createElement("div", {
|
|
5414
|
-
className: this.props.classes.resizeHandle
|
|
5307
|
+
className: "".concat(this.props.classes.resizeHandle, " ").concat(this.props.classes.resizeHandleRight),
|
|
5415
5308
|
onMouseDown: this.resizerMouseDown,
|
|
5416
5309
|
onDoubleClick: this.resizerReset,
|
|
5417
5310
|
title: this.props.t('ra_Double click to reset table layout')
|
|
@@ -5498,7 +5391,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5498
5391
|
"data-min": 120,
|
|
5499
5392
|
"data-name": "val"
|
|
5500
5393
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
5501
|
-
className: this.props.classes.resizeHandle
|
|
5394
|
+
className: "".concat(this.props.classes.resizeHandle, " ").concat(this.props.classes.resizeHandleLeft),
|
|
5502
5395
|
"data-left": "true",
|
|
5503
5396
|
onMouseDown: this.resizerMouseDown,
|
|
5504
5397
|
onDoubleClick: this.resizerReset,
|
|
@@ -5508,7 +5401,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5508
5401
|
style: {
|
|
5509
5402
|
width: this.columnsVisibility.buttons
|
|
5510
5403
|
}
|
|
5511
|
-
},
|
|
5404
|
+
}, ' ', this.getFilterSelectCustoms()) : null);
|
|
5512
5405
|
}
|
|
5513
5406
|
|
|
5514
5407
|
/**
|
|
@@ -5533,7 +5426,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5533
5426
|
});
|
|
5534
5427
|
},
|
|
5535
5428
|
message: this.state.toast,
|
|
5536
|
-
action: /*#__PURE__*/_react["default"].createElement(
|
|
5429
|
+
action: /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
5537
5430
|
size: "small",
|
|
5538
5431
|
"aria-label": "close",
|
|
5539
5432
|
color: "inherit",
|
|
@@ -5544,7 +5437,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5544
5437
|
}
|
|
5545
5438
|
}, /*#__PURE__*/_react["default"].createElement(_Close["default"], {
|
|
5546
5439
|
fontSize: "small"
|
|
5547
|
-
}))
|
|
5440
|
+
}))
|
|
5548
5441
|
});
|
|
5549
5442
|
}
|
|
5550
5443
|
|
|
@@ -5563,10 +5456,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5563
5456
|
scrollBarWidth: scrollBarWidth
|
|
5564
5457
|
});
|
|
5565
5458
|
}, 100);
|
|
5566
|
-
} else {
|
|
5567
|
-
|
|
5568
|
-
this.scrollToItem(this.state.selected && this.state.selected[0] || this.lastSelectedItems);
|
|
5569
|
-
}
|
|
5459
|
+
} else if (!this.selectedFound && (this.state.selected && this.state.selected[0] || this.lastSelectedItems)) {
|
|
5460
|
+
this.scrollToItem(this.state.selected && this.state.selected[0] || this.lastSelectedItems);
|
|
5570
5461
|
}
|
|
5571
5462
|
}
|
|
5572
5463
|
}
|
|
@@ -5620,9 +5511,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5620
5511
|
_this42.props.router && _this42.props.router.doNavigate('tab-objects');
|
|
5621
5512
|
}
|
|
5622
5513
|
});
|
|
5623
|
-
} else {
|
|
5624
|
-
return null;
|
|
5625
5514
|
}
|
|
5515
|
+
return null;
|
|
5626
5516
|
}
|
|
5627
5517
|
|
|
5628
5518
|
/**
|
|
@@ -5639,7 +5529,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5639
5529
|
q: valAck.q || 0,
|
|
5640
5530
|
expire: valAck.expire || undefined
|
|
5641
5531
|
})["catch"](function (e) {
|
|
5642
|
-
return _this43.showError(
|
|
5532
|
+
return _this43.showError("Cannot write value: ".concat(e));
|
|
5643
5533
|
});
|
|
5644
5534
|
}
|
|
5645
5535
|
|
|
@@ -5746,7 +5636,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5746
5636
|
return null;
|
|
5747
5637
|
}
|
|
5748
5638
|
if (!this.edit.id) {
|
|
5749
|
-
console.error(
|
|
5639
|
+
console.error("Invalid ID for edit: ".concat(JSON.stringify(this.edit)));
|
|
5750
5640
|
return null;
|
|
5751
5641
|
}
|
|
5752
5642
|
if (!this.objects[this.edit.id]) {
|
|
@@ -5815,18 +5705,20 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5815
5705
|
}, 200);
|
|
5816
5706
|
if (!this.state.loaded) {
|
|
5817
5707
|
return /*#__PURE__*/_react["default"].createElement(_CircularProgress["default"], {
|
|
5818
|
-
key: this.props.dialogName
|
|
5708
|
+
key: "".concat(this.props.dialogName, "_c")
|
|
5819
5709
|
});
|
|
5820
|
-
} else {
|
|
5821
|
-
var classes = this.props.classes;
|
|
5822
|
-
var items = this.renderItem(this.root, undefined, classes);
|
|
5823
|
-
return /*#__PURE__*/_react["default"].createElement(_TabContainer["default"], {
|
|
5824
|
-
key: this.props.dialogName
|
|
5825
|
-
}, /*#__PURE__*/_react["default"].createElement(_TabHeader["default"], null, this.getToolbar()), /*#__PURE__*/_react["default"].createElement(_TabContent["default"], null, this.renderHeader(), /*#__PURE__*/_react["default"].createElement("div", {
|
|
5826
|
-
className: this.props.classes.tableDiv,
|
|
5827
|
-
ref: this.tableRef
|
|
5828
|
-
}, 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));
|
|
5829
5710
|
}
|
|
5711
|
+
var classes = this.props.classes;
|
|
5712
|
+
var items = this.renderItem(this.root, undefined, classes);
|
|
5713
|
+
return /*#__PURE__*/_react["default"].createElement(_TabContainer["default"], {
|
|
5714
|
+
key: this.props.dialogName,
|
|
5715
|
+
classes: {}
|
|
5716
|
+
}, /*#__PURE__*/_react["default"].createElement(_TabHeader["default"], null, this.getToolbar()), /*#__PURE__*/_react["default"].createElement(_TabContent["default"], {
|
|
5717
|
+
classes: {}
|
|
5718
|
+
}, this.renderHeader(), /*#__PURE__*/_react["default"].createElement("div", {
|
|
5719
|
+
className: this.props.classes.tableDiv,
|
|
5720
|
+
ref: this.tableRef
|
|
5721
|
+
}, 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));
|
|
5830
5722
|
}
|
|
5831
5723
|
}], [{
|
|
5832
5724
|
key: "getDerivedStateFromProps",
|
|
@@ -5835,11 +5727,88 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5835
5727
|
var changed = false;
|
|
5836
5728
|
if (props.expertMode !== undefined && props.expertMode !== state.filter.expertMode) {
|
|
5837
5729
|
changed = true;
|
|
5838
|
-
newState.filter =
|
|
5730
|
+
newState.filter = _objectSpread({}, state.filter);
|
|
5839
5731
|
newState.filter.expertMode = props.expertMode;
|
|
5840
5732
|
}
|
|
5841
5733
|
return changed ? newState : null;
|
|
5842
5734
|
}
|
|
5735
|
+
}, {
|
|
5736
|
+
key: "collapseDepth",
|
|
5737
|
+
value: function collapseDepth(depth, expanded) {
|
|
5738
|
+
return expanded.filter(function (id) {
|
|
5739
|
+
return id.split('.').length <= depth;
|
|
5740
|
+
});
|
|
5741
|
+
}
|
|
5742
|
+
}, {
|
|
5743
|
+
key: "getCustomValue",
|
|
5744
|
+
value: function getCustomValue(obj, it) {
|
|
5745
|
+
if (obj && obj._id && obj._id.startsWith("".concat(it.adapter, ".")) && it.path.length > 1) {
|
|
5746
|
+
var p = it.path;
|
|
5747
|
+
var value;
|
|
5748
|
+
if (obj[p[0]] && (0, _typeof2["default"])(obj[p[0]]) === 'object') {
|
|
5749
|
+
if (p.length === 2) {
|
|
5750
|
+
// most common case
|
|
5751
|
+
value = obj[p[0]][p[1]];
|
|
5752
|
+
} else if (p.length === 3) {
|
|
5753
|
+
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' ? obj[p[0]][p[1]][p[2]] : null;
|
|
5754
|
+
} else if (p.length === 4) {
|
|
5755
|
+
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] ? obj[p[0]][p[1]][p[2]][p[3]] : null;
|
|
5756
|
+
} else if (p.length === 5) {
|
|
5757
|
+
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && obj[p[0]][p[1]][p[2]][p[3]] ? obj[p[0]][p[1]][p[2]][p[3]][p[4]] : null;
|
|
5758
|
+
} else if (p.length === 6) {
|
|
5759
|
+
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && obj[p[0]][p[1]][p[2]][p[3]] && obj[p[0]][p[1]][p[2]][p[3]][p[4]] ? obj[p[0]][p[1]][p[2]][p[3]][p[4]][p[5]] : null;
|
|
5760
|
+
}
|
|
5761
|
+
if (value === undefined || value === null) {
|
|
5762
|
+
return null;
|
|
5763
|
+
}
|
|
5764
|
+
return value;
|
|
5765
|
+
}
|
|
5766
|
+
}
|
|
5767
|
+
return null;
|
|
5768
|
+
}
|
|
5769
|
+
|
|
5770
|
+
/**
|
|
5771
|
+
* @private
|
|
5772
|
+
* @param {any} obj
|
|
5773
|
+
* @param {any} it
|
|
5774
|
+
* @param {any} value
|
|
5775
|
+
*/
|
|
5776
|
+
}, {
|
|
5777
|
+
key: "setCustomValue",
|
|
5778
|
+
value: function setCustomValue(obj, it, value) {
|
|
5779
|
+
if (obj && obj._id && obj._id.startsWith("".concat(it.adapter, ".")) && it.path.length > 1) {
|
|
5780
|
+
var p = it.path;
|
|
5781
|
+
if (obj[p[0]] && (0, _typeof2["default"])(obj[p[0]]) === 'object') {
|
|
5782
|
+
if (p.length === 2) {
|
|
5783
|
+
// most common case
|
|
5784
|
+
obj[p[0]][p[1]] = value;
|
|
5785
|
+
return true;
|
|
5786
|
+
}
|
|
5787
|
+
if (p.length === 3) {
|
|
5788
|
+
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object') {
|
|
5789
|
+
obj[p[0]][p[1]][p[2]] = value;
|
|
5790
|
+
return true;
|
|
5791
|
+
}
|
|
5792
|
+
} else if (p.length === 4) {
|
|
5793
|
+
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]]) === 'object') {
|
|
5794
|
+
obj[p[0]][p[1]][p[2]][p[3]] = value;
|
|
5795
|
+
return true;
|
|
5796
|
+
}
|
|
5797
|
+
} else if (p.length === 5) {
|
|
5798
|
+
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]]) === 'object' && obj[p[0]][p[1]][p[2]][p[3]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]][p[3]]) === 'object') {
|
|
5799
|
+
obj[p[0]][p[1]][p[2]][p[3]][p[4]] = value;
|
|
5800
|
+
return true;
|
|
5801
|
+
}
|
|
5802
|
+
} else if (p.length === 6) {
|
|
5803
|
+
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]]) === 'object' && obj[p[0]][p[1]][p[2]][p[3]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]][p[3]]) === 'object' && obj[p[0]][p[1]][p[2]][p[3]][p[4]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]][p[3]][p[4]]) === 'object') {
|
|
5804
|
+
obj[p[0]][p[1]][p[2]][p[3]][p[4]][p[5]] = value;
|
|
5805
|
+
return true;
|
|
5806
|
+
}
|
|
5807
|
+
}
|
|
5808
|
+
}
|
|
5809
|
+
}
|
|
5810
|
+
return false;
|
|
5811
|
+
}
|
|
5843
5812
|
}]);
|
|
5844
5813
|
return ObjectBrowser;
|
|
5845
5814
|
}(_react.Component);
|
|
@@ -5887,11 +5856,11 @@ ObjectBrowser.propTypes = {
|
|
|
5887
5856
|
objectImportExport: _propTypes["default"].bool,
|
|
5888
5857
|
// optional toolbar button
|
|
5889
5858
|
objectEditOfAccessControl: _propTypes["default"].bool,
|
|
5890
|
-
//Access Control
|
|
5859
|
+
// Access Control
|
|
5891
5860
|
modalNewObject: _propTypes["default"].func,
|
|
5892
5861
|
// modal add object
|
|
5893
5862
|
modalEditOfAccessControl: _propTypes["default"].func,
|
|
5894
|
-
//modal Edit Of Access Control
|
|
5863
|
+
// modal Edit Of Access Control
|
|
5895
5864
|
onObjectDelete: _propTypes["default"].func,
|
|
5896
5865
|
// optional function (id, hasChildren, objectExists) { }
|
|
5897
5866
|
customFilter: _propTypes["default"].object,
|