@iobroker/adapter-react-v5 4.6.2 → 4.6.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/ObjectBrowser.d.ts +40 -3
- package/Components/ObjectBrowser.js +677 -404
- package/Components/ObjectBrowser.js.map +1 -1
- package/README.md +7 -0
- package/i18n/de.json +5 -1
- package/i18n/en.json +5 -1
- package/i18n/es.json +5 -1
- package/i18n/fr.json +5 -1
- package/i18n/it.json +5 -1
- package/i18n/nl.json +5 -1
- package/i18n/pl.json +5 -1
- package/i18n/pt.json +5 -1
- package/i18n/ru.json +5 -1
- package/i18n/uk.json +5 -1
- package/i18n/zh-cn.json +5 -1
- package/index.d.ts +4 -0
- package/index.js +6 -0
- package/package.json +7 -7
|
@@ -16,6 +16,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
16
16
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
17
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
18
18
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
+
var _classPrivateFieldGet2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldGet"));
|
|
19
20
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
20
21
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
22
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -47,12 +48,17 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
47
48
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
48
49
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
49
50
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
50
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
52
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
53
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
54
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
55
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
56
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /**
|
|
57
|
+
* Copyright 2020-2023, Denis Haev <dogafox@gmail.com>
|
|
58
|
+
*
|
|
59
|
+
* MIT License
|
|
60
|
+
*
|
|
61
|
+
**/ // Icons
|
|
56
62
|
// own
|
|
57
63
|
var ICON_SIZE = 24;
|
|
58
64
|
var ROW_HEIGHT = 32;
|
|
@@ -1230,7 +1236,7 @@ function buildTree(objects, options) {
|
|
|
1230
1236
|
|
|
1231
1237
|
// If current level is still OK, and we can add ID to children
|
|
1232
1238
|
if (!currentPath || id.startsWith("".concat(currentPath, "."))) {
|
|
1233
|
-
var _obj$common, _obj$common2, _obj$common3;
|
|
1239
|
+
var _obj$common, _obj$common2, _obj$common3, _obj$common4;
|
|
1234
1240
|
// if more than one level added
|
|
1235
1241
|
if (parts.length - currentPathLen > 1) {
|
|
1236
1242
|
var curPath = currentPath;
|
|
@@ -1267,15 +1273,15 @@ function buildTree(objects, options) {
|
|
|
1267
1273
|
var _croot = {
|
|
1268
1274
|
data: {
|
|
1269
1275
|
name: parts[parts.length - 1],
|
|
1270
|
-
title: getName(obj
|
|
1276
|
+
title: getName(obj === null || obj === void 0 || (_obj$common = obj.common) === null || _obj$common === void 0 ? void 0 : _obj$common.name, options.lang),
|
|
1271
1277
|
obj: obj,
|
|
1272
1278
|
parent: croot,
|
|
1273
1279
|
icon: getSelectIdIcon(objects, id, imagePrefix) || getSystemIcon(objects, id, 0, imagePrefix),
|
|
1274
1280
|
id: id,
|
|
1275
|
-
hasCustoms: ((_obj$
|
|
1281
|
+
hasCustoms: ((_obj$common2 = obj.common) === null || _obj$common2 === void 0 ? void 0 : _obj$common2.custom) && Object.keys(obj.common.custom).length,
|
|
1276
1282
|
level: parts.length - 1,
|
|
1277
1283
|
generated: false,
|
|
1278
|
-
button: obj.type === 'state' && ((_obj$
|
|
1284
|
+
button: obj.type === 'state' && ((_obj$common3 = obj.common) === null || _obj$common3 === void 0 ? void 0 : _obj$common3.role) && typeof obj.common.role === 'string' && obj.common.role.startsWith('button') && ((_obj$common4 = obj.common) === null || _obj$common4 === void 0 ? void 0 : _obj$common4.write) !== false
|
|
1279
1285
|
}
|
|
1280
1286
|
};
|
|
1281
1287
|
croot.children = croot.children || [];
|
|
@@ -1377,20 +1383,32 @@ function findRoomsForObject(data, id, lang, withParentInfo, rooms) {
|
|
|
1377
1383
|
};
|
|
1378
1384
|
}
|
|
1379
1385
|
rooms = rooms || [];
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1386
|
+
var _iterator = _createForOfIteratorHelper(data.roomEnums),
|
|
1387
|
+
_step;
|
|
1388
|
+
try {
|
|
1389
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1390
|
+
var _data$objects$room, _common$members;
|
|
1391
|
+
var room = _step.value;
|
|
1392
|
+
var common = (_data$objects$room = data.objects[room]) === null || _data$objects$room === void 0 ? void 0 : _data$objects$room.common;
|
|
1393
|
+
if (!common) {
|
|
1394
|
+
continue;
|
|
1395
|
+
}
|
|
1396
|
+
var name = getName(common.name, lang);
|
|
1397
|
+
if ((_common$members = common.members) !== null && _common$members !== void 0 && _common$members.includes(id) && !rooms.includes(name)) {
|
|
1398
|
+
if (!withParentInfo) {
|
|
1399
|
+
rooms.push(name);
|
|
1400
|
+
} else {
|
|
1401
|
+
rooms.push({
|
|
1402
|
+
name: name,
|
|
1403
|
+
origin: id
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1392
1406
|
}
|
|
1393
1407
|
}
|
|
1408
|
+
} catch (err) {
|
|
1409
|
+
_iterator.e(err);
|
|
1410
|
+
} finally {
|
|
1411
|
+
_iterator.f();
|
|
1394
1412
|
}
|
|
1395
1413
|
var ownEnums;
|
|
1396
1414
|
|
|
@@ -1434,8 +1452,11 @@ function findFunctionsForObject(data, id, lang, withParentInfo, funcs) {
|
|
|
1434
1452
|
for (var i = 0; i < data.funcEnums.length; i++) {
|
|
1435
1453
|
var _data$objects$data$fu, _common$members3;
|
|
1436
1454
|
var common = (_data$objects$data$fu = data.objects[data.funcEnums[i]]) === null || _data$objects$data$fu === void 0 ? void 0 : _data$objects$data$fu.common;
|
|
1455
|
+
if (!common) {
|
|
1456
|
+
continue;
|
|
1457
|
+
}
|
|
1437
1458
|
var name = getName(common.name, lang);
|
|
1438
|
-
if (
|
|
1459
|
+
if ((_common$members3 = common.members) !== null && _common$members3 !== void 0 && _common$members3.includes(id) && !funcs.includes(name)) {
|
|
1439
1460
|
if (!withParentInfo) {
|
|
1440
1461
|
funcs.push(name);
|
|
1441
1462
|
} else {
|
|
@@ -1500,16 +1521,24 @@ function formatValue(options) {
|
|
|
1500
1521
|
var type = (0, _typeof2["default"])(v);
|
|
1501
1522
|
if (isCommon !== null && isCommon !== void 0 && isCommon.role && typeof isCommon.role === 'string' && isCommon.role.match(/^value\.time|^date/)) {
|
|
1502
1523
|
if (v && typeof v === 'string') {
|
|
1503
|
-
if (v
|
|
1504
|
-
//
|
|
1524
|
+
if (_Utils["default"].isStringInteger(v)) {
|
|
1525
|
+
// we assume a unix ts
|
|
1505
1526
|
v = new Date(parseInt(v, 10)).toString();
|
|
1506
1527
|
} else {
|
|
1507
|
-
//
|
|
1528
|
+
// check if parsable by new date
|
|
1529
|
+
try {
|
|
1530
|
+
var parsedDate = new Date(v);
|
|
1531
|
+
if (_Utils["default"].isValidDate(parsedDate)) {
|
|
1532
|
+
v = parsedDate.toString();
|
|
1533
|
+
}
|
|
1534
|
+
} catch (_unused) {
|
|
1535
|
+
// ignore
|
|
1536
|
+
}
|
|
1508
1537
|
}
|
|
1509
1538
|
} else {
|
|
1510
1539
|
if (v > 946681200 && v < 946681200000) {
|
|
1511
1540
|
// '2000-01-01T00:00:00' => 946681200000
|
|
1512
|
-
v *= 1000; //
|
|
1541
|
+
v *= 1000; // maybe the time is in seconds (UNIX time)
|
|
1513
1542
|
}
|
|
1514
1543
|
// null and undefined could not be here. See `let v = (isCommon && isCommon.type === 'file') ....` above
|
|
1515
1544
|
v = v ? new Date(v).toString() : v;
|
|
@@ -1796,6 +1825,7 @@ var objectsAlreadyLoaded = false;
|
|
|
1796
1825
|
/**
|
|
1797
1826
|
* @extends {React.Component<import('./types').ObjectBrowserProps>}
|
|
1798
1827
|
*/
|
|
1828
|
+
var _NON_EXPERT_NAMESPACES = /*#__PURE__*/new WeakMap();
|
|
1799
1829
|
var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
1800
1830
|
(0, _inherits2["default"])(ObjectBrowser, _Component);
|
|
1801
1831
|
var _super = _createSuper(ObjectBrowser);
|
|
@@ -1806,6 +1836,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
1806
1836
|
var _this;
|
|
1807
1837
|
(0, _classCallCheck2["default"])(this, ObjectBrowser);
|
|
1808
1838
|
_this = _super.call(this, props);
|
|
1839
|
+
/**
|
|
1840
|
+
* Namespaces which are allowed to be edited by non-expert users
|
|
1841
|
+
* @type {string[]}
|
|
1842
|
+
*/
|
|
1843
|
+
_classPrivateFieldInitSpec((0, _assertThisInitialized2["default"])(_this), _NON_EXPERT_NAMESPACES, {
|
|
1844
|
+
writable: true,
|
|
1845
|
+
value: ['0_userdata.0.', 'alias.0.']
|
|
1846
|
+
});
|
|
1809
1847
|
/**
|
|
1810
1848
|
* Context menu handler.
|
|
1811
1849
|
*/
|
|
@@ -2020,18 +2058,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2020
2058
|
*/
|
|
2021
2059
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "loadObjects", /*#__PURE__*/function () {
|
|
2022
2060
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(objs) {
|
|
2023
|
-
var id, obj, enums, state;
|
|
2061
|
+
var id, obj, enums, val, ack, state;
|
|
2024
2062
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
2025
2063
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2026
2064
|
case 0:
|
|
2027
2065
|
if (!objs) {
|
|
2028
|
-
_context2.next =
|
|
2066
|
+
_context2.next = 57;
|
|
2029
2067
|
break;
|
|
2030
2068
|
}
|
|
2031
2069
|
_context2.t0 = _regenerator["default"].keys(objs);
|
|
2032
2070
|
case 2:
|
|
2033
2071
|
if ((_context2.t1 = _context2.t0()).done) {
|
|
2034
|
-
_context2.next =
|
|
2072
|
+
_context2.next = 57;
|
|
2035
2073
|
break;
|
|
2036
2074
|
}
|
|
2037
2075
|
id = _context2.t1.value;
|
|
@@ -2043,69 +2081,103 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2043
2081
|
case 6:
|
|
2044
2082
|
obj = objs[id];
|
|
2045
2083
|
enums = null;
|
|
2084
|
+
val = void 0;
|
|
2085
|
+
ack = void 0;
|
|
2046
2086
|
if (obj && obj.common && obj.common.enums) {
|
|
2047
2087
|
enums = obj.common.enums;
|
|
2048
2088
|
delete obj.common.enums;
|
|
2049
2089
|
} else {
|
|
2050
2090
|
enums = null;
|
|
2051
2091
|
}
|
|
2052
|
-
|
|
2053
|
-
|
|
2092
|
+
if (obj.val) {
|
|
2093
|
+
val = obj.val;
|
|
2094
|
+
try {
|
|
2095
|
+
val = JSON.parse(val);
|
|
2096
|
+
} catch (e) {
|
|
2097
|
+
console.log("Cannot parse value: ".concat(e));
|
|
2098
|
+
val = null;
|
|
2099
|
+
}
|
|
2100
|
+
delete obj.val;
|
|
2101
|
+
}
|
|
2102
|
+
if (obj.ack !== undefined) {
|
|
2103
|
+
ack = obj.ack;
|
|
2104
|
+
delete obj.ack;
|
|
2105
|
+
}
|
|
2106
|
+
_context2.prev = 13;
|
|
2107
|
+
_context2.next = 16;
|
|
2054
2108
|
return _this.props.socket.setObject(id, obj);
|
|
2055
|
-
case
|
|
2109
|
+
case 16:
|
|
2056
2110
|
_context2.t2 = enums;
|
|
2057
2111
|
if (!_context2.t2) {
|
|
2058
|
-
_context2.next =
|
|
2112
|
+
_context2.next = 20;
|
|
2059
2113
|
break;
|
|
2060
2114
|
}
|
|
2061
|
-
_context2.next =
|
|
2115
|
+
_context2.next = 20;
|
|
2062
2116
|
return _this._createAllEnums(enums, obj._id);
|
|
2063
|
-
case
|
|
2117
|
+
case 20:
|
|
2064
2118
|
if (!(obj.type === 'state')) {
|
|
2065
|
-
_context2.next =
|
|
2119
|
+
_context2.next = 50;
|
|
2066
2120
|
break;
|
|
2067
2121
|
}
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
return _this.props.socket.getState(obj._id);
|
|
2071
|
-
case 20:
|
|
2072
|
-
state = _context2.sent;
|
|
2073
|
-
if (!(!state || state.val === null)) {
|
|
2074
|
-
_context2.next = 30;
|
|
2122
|
+
if (!(val !== undefined && val !== null)) {
|
|
2123
|
+
_context2.next = 32;
|
|
2075
2124
|
break;
|
|
2076
2125
|
}
|
|
2077
2126
|
_context2.prev = 22;
|
|
2078
2127
|
_context2.next = 25;
|
|
2079
|
-
return _this.props.socket.setState(obj._id,
|
|
2128
|
+
return _this.props.socket.setState(obj._id, val, ack !== undefined ? ack : true);
|
|
2080
2129
|
case 25:
|
|
2081
2130
|
_context2.next = 30;
|
|
2082
2131
|
break;
|
|
2083
2132
|
case 27:
|
|
2084
2133
|
_context2.prev = 27;
|
|
2085
2134
|
_context2.t3 = _context2["catch"](22);
|
|
2086
|
-
window.alert("Cannot set state \"".concat(obj._id, "\": ").concat(_context2.t3));
|
|
2135
|
+
window.alert("Cannot set state \"".concat(obj._id, " with ").concat(val, "\": ").concat(_context2.t3));
|
|
2087
2136
|
case 30:
|
|
2088
|
-
_context2.next =
|
|
2137
|
+
_context2.next = 50;
|
|
2089
2138
|
break;
|
|
2090
2139
|
case 32:
|
|
2091
2140
|
_context2.prev = 32;
|
|
2092
|
-
_context2.
|
|
2093
|
-
|
|
2141
|
+
_context2.next = 35;
|
|
2142
|
+
return _this.props.socket.getState(obj._id);
|
|
2094
2143
|
case 35:
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2144
|
+
state = _context2.sent;
|
|
2145
|
+
if (!(!state || state.val === null)) {
|
|
2146
|
+
_context2.next = 45;
|
|
2147
|
+
break;
|
|
2148
|
+
}
|
|
2098
2149
|
_context2.prev = 37;
|
|
2099
|
-
_context2.
|
|
2100
|
-
|
|
2150
|
+
_context2.next = 40;
|
|
2151
|
+
return _this.props.socket.setState(obj._id, !obj.common || obj.common.def === undefined ? null : obj.common.def, true);
|
|
2101
2152
|
case 40:
|
|
2102
|
-
_context2.next =
|
|
2153
|
+
_context2.next = 45;
|
|
2103
2154
|
break;
|
|
2104
2155
|
case 42:
|
|
2156
|
+
_context2.prev = 42;
|
|
2157
|
+
_context2.t4 = _context2["catch"](37);
|
|
2158
|
+
window.alert("Cannot set state \"".concat(obj._id, "\": ").concat(_context2.t4));
|
|
2159
|
+
case 45:
|
|
2160
|
+
_context2.next = 50;
|
|
2161
|
+
break;
|
|
2162
|
+
case 47:
|
|
2163
|
+
_context2.prev = 47;
|
|
2164
|
+
_context2.t5 = _context2["catch"](32);
|
|
2165
|
+
window.alert("Cannot read state \"".concat(obj._id, "\": ").concat(_context2.t5));
|
|
2166
|
+
case 50:
|
|
2167
|
+
_context2.next = 55;
|
|
2168
|
+
break;
|
|
2169
|
+
case 52:
|
|
2170
|
+
_context2.prev = 52;
|
|
2171
|
+
_context2.t6 = _context2["catch"](13);
|
|
2172
|
+
window.alert(_context2.t6);
|
|
2173
|
+
case 55:
|
|
2174
|
+
_context2.next = 2;
|
|
2175
|
+
break;
|
|
2176
|
+
case 57:
|
|
2105
2177
|
case "end":
|
|
2106
2178
|
return _context2.stop();
|
|
2107
2179
|
}
|
|
2108
|
-
}, _callee2, null, [[
|
|
2180
|
+
}, _callee2, null, [[13, 52], [22, 27], [32, 47], [37, 42]]);
|
|
2109
2181
|
}));
|
|
2110
2182
|
return function (_x3) {
|
|
2111
2183
|
return _ref2.apply(this, arguments);
|
|
@@ -2121,7 +2193,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2121
2193
|
var r = new FileReader();
|
|
2122
2194
|
r.onload = /*#__PURE__*/function () {
|
|
2123
2195
|
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(e) {
|
|
2124
|
-
var contents, json, len, id, enums, state;
|
|
2196
|
+
var contents, json, len, id, enums, val, ack, state;
|
|
2125
2197
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
2126
2198
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2127
2199
|
case 0:
|
|
@@ -2138,7 +2210,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2138
2210
|
return _this.loadObjects(json);
|
|
2139
2211
|
case 8:
|
|
2140
2212
|
window.alert(_this.props.t('ra_%s object(s) processed', len));
|
|
2141
|
-
_context3.next =
|
|
2213
|
+
_context3.next = 40;
|
|
2142
2214
|
break;
|
|
2143
2215
|
case 11:
|
|
2144
2216
|
if (id) {
|
|
@@ -2152,52 +2224,76 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2152
2224
|
enums = json.common.enums;
|
|
2153
2225
|
delete json.common.enums;
|
|
2154
2226
|
}
|
|
2155
|
-
|
|
2227
|
+
if (json.val) {
|
|
2228
|
+
val = json.val;
|
|
2229
|
+
try {
|
|
2230
|
+
val = JSON.parse(val);
|
|
2231
|
+
} catch (e) {
|
|
2232
|
+
console.log("Cannot parse value: ".concat(e));
|
|
2233
|
+
val = null;
|
|
2234
|
+
}
|
|
2235
|
+
delete json.val;
|
|
2236
|
+
}
|
|
2237
|
+
if (json.ack !== undefined) {
|
|
2238
|
+
ack = json.ack;
|
|
2239
|
+
delete json.ack;
|
|
2240
|
+
}
|
|
2241
|
+
_context3.next = 19;
|
|
2156
2242
|
return _this.props.socket.setObject(json._id, json);
|
|
2157
|
-
case
|
|
2243
|
+
case 19:
|
|
2158
2244
|
if (!(json.type === 'state')) {
|
|
2159
|
-
_context3.next =
|
|
2245
|
+
_context3.next = 31;
|
|
2246
|
+
break;
|
|
2247
|
+
}
|
|
2248
|
+
if (!(val !== undefined && val !== null)) {
|
|
2249
|
+
_context3.next = 25;
|
|
2160
2250
|
break;
|
|
2161
2251
|
}
|
|
2162
|
-
_context3.next =
|
|
2252
|
+
_context3.next = 23;
|
|
2253
|
+
return _this.props.socket.setState(json._id, val, ack === undefined ? true : ack);
|
|
2254
|
+
case 23:
|
|
2255
|
+
_context3.next = 31;
|
|
2256
|
+
break;
|
|
2257
|
+
case 25:
|
|
2258
|
+
_context3.next = 27;
|
|
2163
2259
|
return _this.props.socket.getState(json._id);
|
|
2164
|
-
case
|
|
2260
|
+
case 27:
|
|
2165
2261
|
state = _context3.sent;
|
|
2166
2262
|
if (!(!state || state.val === null || state.val === undefined)) {
|
|
2167
|
-
_context3.next =
|
|
2263
|
+
_context3.next = 31;
|
|
2168
2264
|
break;
|
|
2169
2265
|
}
|
|
2170
|
-
_context3.next =
|
|
2171
|
-
return _this.props.socket.
|
|
2172
|
-
case
|
|
2266
|
+
_context3.next = 31;
|
|
2267
|
+
return _this.props.socket.setState(json._id, json.common.def === undefined ? null : json.common.def, true);
|
|
2268
|
+
case 31:
|
|
2173
2269
|
if (!enums) {
|
|
2174
|
-
_context3.next =
|
|
2270
|
+
_context3.next = 34;
|
|
2175
2271
|
break;
|
|
2176
2272
|
}
|
|
2177
|
-
_context3.next =
|
|
2273
|
+
_context3.next = 34;
|
|
2178
2274
|
return _this._createAllEnums(enums, json._id);
|
|
2179
|
-
case
|
|
2275
|
+
case 34:
|
|
2180
2276
|
window.alert(_this.props.t('ra_%s was imported', json._id));
|
|
2181
|
-
_context3.next =
|
|
2277
|
+
_context3.next = 40;
|
|
2182
2278
|
break;
|
|
2183
|
-
case
|
|
2184
|
-
_context3.prev =
|
|
2279
|
+
case 37:
|
|
2280
|
+
_context3.prev = 37;
|
|
2185
2281
|
_context3.t0 = _context3["catch"](13);
|
|
2186
2282
|
window.alert(_context3.t0);
|
|
2187
|
-
case
|
|
2188
|
-
_context3.next =
|
|
2283
|
+
case 40:
|
|
2284
|
+
_context3.next = 45;
|
|
2189
2285
|
break;
|
|
2190
|
-
case
|
|
2191
|
-
_context3.prev =
|
|
2286
|
+
case 42:
|
|
2287
|
+
_context3.prev = 42;
|
|
2192
2288
|
_context3.t1 = _context3["catch"](1);
|
|
2193
2289
|
window.alert(_context3.t1);
|
|
2194
|
-
case
|
|
2290
|
+
case 45:
|
|
2195
2291
|
return _context3.abrupt("return", null);
|
|
2196
|
-
case
|
|
2292
|
+
case 46:
|
|
2197
2293
|
case "end":
|
|
2198
2294
|
return _context3.stop();
|
|
2199
2295
|
}
|
|
2200
|
-
}, _callee3, null, [[1,
|
|
2296
|
+
}, _callee3, null, [[1, 42], [13, 37]]);
|
|
2201
2297
|
}));
|
|
2202
2298
|
return function (_x4) {
|
|
2203
2299
|
return _ref3.apply(this, arguments);
|
|
@@ -2604,7 +2700,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2604
2700
|
showExportDialog: false,
|
|
2605
2701
|
linesEnabled: (window._localStorage || window.localStorage).getItem("".concat(props.dialogName || 'App', ".lines")) === 'true',
|
|
2606
2702
|
showDescription: (window._localStorage || window.localStorage).getItem("".concat(props.dialogName || 'App', ".desc")) !== 'false',
|
|
2607
|
-
showContextMenu: null
|
|
2703
|
+
showContextMenu: null,
|
|
2704
|
+
noStatesByExportImport: false
|
|
2608
2705
|
};
|
|
2609
2706
|
_this.edit = {};
|
|
2610
2707
|
_this.texts = {
|
|
@@ -2810,6 +2907,20 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2810
2907
|
});
|
|
2811
2908
|
}
|
|
2812
2909
|
|
|
2910
|
+
/**
|
|
2911
|
+
* Check if it is a non-expert id
|
|
2912
|
+
*
|
|
2913
|
+
* @param id id to test
|
|
2914
|
+
* @return {boolean}
|
|
2915
|
+
*/
|
|
2916
|
+
}, {
|
|
2917
|
+
key: "isNonExpertId",
|
|
2918
|
+
value: function isNonExpertId(id) {
|
|
2919
|
+
return !!(0, _classPrivateFieldGet2["default"])(this, _NON_EXPERT_NAMESPACES).find(function (saveNamespace) {
|
|
2920
|
+
return id.startsWith(saveNamespace);
|
|
2921
|
+
});
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2813
2924
|
/**
|
|
2814
2925
|
* @private
|
|
2815
2926
|
* @param {ioBroker.EmptyCallback?} cb
|
|
@@ -2931,6 +3042,36 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2931
3042
|
this.subscribes = [];
|
|
2932
3043
|
this.objects = {};
|
|
2933
3044
|
}
|
|
3045
|
+
|
|
3046
|
+
/** @typedef {{ id: string, obj: ioBroker.Object, item: any }} ShowDeleteDialogOptions */
|
|
3047
|
+
|
|
3048
|
+
/**
|
|
3049
|
+
* Show the delete dialog for a given object
|
|
3050
|
+
*
|
|
3051
|
+
* @param {ShowDeleteDialogOptions} options
|
|
3052
|
+
*/
|
|
3053
|
+
}, {
|
|
3054
|
+
key: "showDeleteDialog",
|
|
3055
|
+
value: function showDeleteDialog(options) {
|
|
3056
|
+
var _item$children2, _obj$common5;
|
|
3057
|
+
var id = options.id,
|
|
3058
|
+
obj = options.obj,
|
|
3059
|
+
item = options.item;
|
|
3060
|
+
|
|
3061
|
+
// calculate the number of children
|
|
3062
|
+
var keys = Object.keys(this.objects);
|
|
3063
|
+
keys.sort();
|
|
3064
|
+
var count = 0;
|
|
3065
|
+
var start = "".concat(id, ".");
|
|
3066
|
+
for (var i = 0; i < keys.length; i++) {
|
|
3067
|
+
if (keys[i].startsWith(start)) {
|
|
3068
|
+
count++;
|
|
3069
|
+
} else if (keys[i] > start) {
|
|
3070
|
+
break;
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
this.props.onObjectDelete(id, !!((_item$children2 = item.children) !== null && _item$children2 !== void 0 && _item$children2.length), !((_obj$common5 = obj.common) !== null && _obj$common5 !== void 0 && _obj$common5.dontDelete), count + 1);
|
|
3074
|
+
}
|
|
2934
3075
|
}, {
|
|
2935
3076
|
key: "refreshComponent",
|
|
2936
3077
|
value:
|
|
@@ -3649,12 +3790,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3649
3790
|
value: function getFilterSelectFunction() {
|
|
3650
3791
|
var _this19 = this;
|
|
3651
3792
|
var func = this.info.funcEnums.map(function (id) {
|
|
3652
|
-
var _this19$objects$id;
|
|
3793
|
+
var _this19$objects$id, _this19$objects$id2;
|
|
3653
3794
|
return {
|
|
3654
|
-
name: getName(_this19.objects[id]
|
|
3795
|
+
name: getName(((_this19$objects$id = _this19.objects[id]) === null || _this19$objects$id === void 0 || (_this19$objects$id = _this19$objects$id.common) === null || _this19$objects$id === void 0 ? void 0 : _this19$objects$id.name) || id.split('.').pop()),
|
|
3655
3796
|
value: id,
|
|
3656
3797
|
icon: /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
3657
|
-
src: ((_this19$objects$
|
|
3798
|
+
src: ((_this19$objects$id2 = _this19.objects[id]) === null || _this19$objects$id2 === void 0 || (_this19$objects$id2 = _this19$objects$id2.common) === null || _this19$objects$id2 === void 0 ? void 0 : _this19$objects$id2.icon) || '',
|
|
3658
3799
|
className: _this19.props.classes.selectIcon
|
|
3659
3800
|
})
|
|
3660
3801
|
};
|
|
@@ -3851,45 +3992,105 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3851
3992
|
}
|
|
3852
3993
|
}, {
|
|
3853
3994
|
key: "_exportObjects",
|
|
3854
|
-
value: function
|
|
3855
|
-
var
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3995
|
+
value: function () {
|
|
3996
|
+
var _exportObjects2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(isAll, noStatesByExportImport) {
|
|
3997
|
+
var result, id, ids, i, _result$key, key, state, enums;
|
|
3998
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
3999
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
4000
|
+
case 0:
|
|
4001
|
+
if (!isAll) {
|
|
4002
|
+
_context5.next = 4;
|
|
4003
|
+
break;
|
|
4004
|
+
}
|
|
4005
|
+
generateFile('allObjects.json', this.objects);
|
|
4006
|
+
_context5.next = 25;
|
|
4007
|
+
break;
|
|
4008
|
+
case 4:
|
|
4009
|
+
if (!(this.state.selected.length || this.state.selectedNonObject)) {
|
|
4010
|
+
_context5.next = 24;
|
|
4011
|
+
break;
|
|
4012
|
+
}
|
|
4013
|
+
result = {};
|
|
4014
|
+
id = this.state.selected[0] || this.state.selectedNonObject;
|
|
4015
|
+
ids = this._getSelectedIdsForExport();
|
|
4016
|
+
i = 0;
|
|
4017
|
+
case 9:
|
|
4018
|
+
if (!(i < ids.length)) {
|
|
4019
|
+
_context5.next = 21;
|
|
4020
|
+
break;
|
|
4021
|
+
}
|
|
4022
|
+
key = ids[i];
|
|
4023
|
+
result[key] = JSON.parse(JSON.stringify(this.objects[key]));
|
|
4024
|
+
|
|
4025
|
+
// read states values
|
|
4026
|
+
if (!(((_result$key = result[key]) === null || _result$key === void 0 ? void 0 : _result$key.type) === 'state' && !noStatesByExportImport)) {
|
|
4027
|
+
_context5.next = 17;
|
|
4028
|
+
break;
|
|
4029
|
+
}
|
|
4030
|
+
_context5.next = 15;
|
|
4031
|
+
return this.props.socket.getState(key);
|
|
4032
|
+
case 15:
|
|
4033
|
+
state = _context5.sent;
|
|
4034
|
+
if (state) {
|
|
4035
|
+
result[key].val = state.val;
|
|
4036
|
+
result[key].ack = state.ack;
|
|
4037
|
+
}
|
|
4038
|
+
case 17:
|
|
4039
|
+
// add enum information
|
|
4040
|
+
if (result[key].common) {
|
|
4041
|
+
enums = this.getEnumsForId(key);
|
|
4042
|
+
if (enums) {
|
|
4043
|
+
result[key].common.enums = enums;
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
case 18:
|
|
4047
|
+
i++;
|
|
4048
|
+
_context5.next = 9;
|
|
4049
|
+
break;
|
|
4050
|
+
case 21:
|
|
4051
|
+
generateFile("".concat(id, ".json"), result, noStatesByExportImport);
|
|
4052
|
+
_context5.next = 25;
|
|
4053
|
+
break;
|
|
4054
|
+
case 24:
|
|
4055
|
+
window.alert(this.props.t('ra_Save of objects-tree is not possible'));
|
|
4056
|
+
case 25:
|
|
4057
|
+
case "end":
|
|
4058
|
+
return _context5.stop();
|
|
3869
4059
|
}
|
|
3870
|
-
});
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
4060
|
+
}, _callee5, this);
|
|
4061
|
+
}));
|
|
4062
|
+
function _exportObjects(_x5, _x6) {
|
|
4063
|
+
return _exportObjects2.apply(this, arguments);
|
|
3874
4064
|
}
|
|
3875
|
-
|
|
4065
|
+
return _exportObjects;
|
|
4066
|
+
}()
|
|
3876
4067
|
}, {
|
|
3877
4068
|
key: "renderExportDialog",
|
|
3878
4069
|
value: function renderExportDialog() {
|
|
3879
|
-
var
|
|
4070
|
+
var _this24 = this;
|
|
3880
4071
|
if (this.state.showExportDialog === false) {
|
|
3881
4072
|
return null;
|
|
3882
4073
|
}
|
|
3883
4074
|
return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
|
|
3884
4075
|
open: !0
|
|
3885
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.DialogTitle, null, this.props.t('Select type of export')), /*#__PURE__*/_react["default"].createElement(_material.DialogContent, null, /*#__PURE__*/_react["default"].createElement(_material.DialogContentText, 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)
|
|
4076
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.DialogTitle, null, this.props.t('Select type of export')), /*#__PURE__*/_react["default"].createElement(_material.DialogContent, null, /*#__PURE__*/_react["default"].createElement(_material.DialogContentText, 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("br", null), /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
4077
|
+
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
4078
|
+
checked: this.state.noStatesByExportImport,
|
|
4079
|
+
onChange: function onChange(e) {
|
|
4080
|
+
return _this24.setState({
|
|
4081
|
+
noStatesByExportImport: e.target.checked
|
|
4082
|
+
});
|
|
4083
|
+
}
|
|
4084
|
+
}),
|
|
4085
|
+
label: this.props.t('ra_Do not export values of states')
|
|
4086
|
+
}))), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
3886
4087
|
color: "grey",
|
|
3887
4088
|
variant: "outlined",
|
|
3888
4089
|
onClick: function onClick() {
|
|
3889
|
-
return
|
|
4090
|
+
return _this24.setState({
|
|
3890
4091
|
showExportDialog: false
|
|
3891
4092
|
}, function () {
|
|
3892
|
-
return
|
|
4093
|
+
return _this24._exportObjects(true, _this24.state.noStatesByExportImport);
|
|
3893
4094
|
});
|
|
3894
4095
|
}
|
|
3895
4096
|
}, this.props.t('ra_All objects'), ' ', "(", Object.keys(this.objects).length, ")"), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
@@ -3897,17 +4098,17 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3897
4098
|
variant: "contained",
|
|
3898
4099
|
autoFocus: true,
|
|
3899
4100
|
onClick: function onClick() {
|
|
3900
|
-
return
|
|
4101
|
+
return _this24.setState({
|
|
3901
4102
|
showExportDialog: false
|
|
3902
4103
|
}, function () {
|
|
3903
|
-
return
|
|
4104
|
+
return _this24._exportObjects(false, _this24.state.noStatesByExportImport);
|
|
3904
4105
|
});
|
|
3905
4106
|
}
|
|
3906
4107
|
}, this.props.t('ra_Only selected'), ' ', "(", this.state.showExportDialog, ")"), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
3907
4108
|
color: "grey",
|
|
3908
4109
|
variant: "contained",
|
|
3909
4110
|
onClick: function onClick() {
|
|
3910
|
-
return
|
|
4111
|
+
return _this24.setState({
|
|
3911
4112
|
showExportDialog: false
|
|
3912
4113
|
});
|
|
3913
4114
|
},
|
|
@@ -3922,7 +4123,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3922
4123
|
* @returns {JSX.Element}
|
|
3923
4124
|
*/
|
|
3924
4125
|
function getToolbar() {
|
|
3925
|
-
var
|
|
4126
|
+
var _this25 = this;
|
|
3926
4127
|
var allowObjectCreation = false;
|
|
3927
4128
|
if (this.state.selected.length || this.state.selectedNonObject) {
|
|
3928
4129
|
var id = this.state.selected[0] || this.state.selectedNonObject;
|
|
@@ -3953,7 +4154,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3953
4154
|
}
|
|
3954
4155
|
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
3955
4156
|
onClick: function onClick() {
|
|
3956
|
-
return
|
|
4157
|
+
return _this25.refreshComponent();
|
|
3957
4158
|
},
|
|
3958
4159
|
disabled: this.state.updating,
|
|
3959
4160
|
size: "large"
|
|
@@ -3966,7 +4167,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3966
4167
|
key: "expertMode",
|
|
3967
4168
|
color: this.state.filter.expertMode ? 'secondary' : 'default',
|
|
3968
4169
|
onClick: function onClick() {
|
|
3969
|
-
return
|
|
4170
|
+
return _this25.onFilter('expertMode', !_this25.state.filter.expertMode);
|
|
3970
4171
|
},
|
|
3971
4172
|
size: "large"
|
|
3972
4173
|
}, /*#__PURE__*/_react["default"].createElement(_IconExpert["default"], null))), !this.props.disableColumnSelector && /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
@@ -3978,7 +4179,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3978
4179
|
key: "columnSelector",
|
|
3979
4180
|
color: this.state.columnsAuto ? 'primary' : 'default',
|
|
3980
4181
|
onClick: function onClick() {
|
|
3981
|
-
return
|
|
4182
|
+
return _this25.setState({
|
|
3982
4183
|
columnsSelectorShow: true
|
|
3983
4184
|
});
|
|
3984
4185
|
},
|
|
@@ -3991,7 +4192,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3991
4192
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
3992
4193
|
key: "expandAll",
|
|
3993
4194
|
onClick: function onClick() {
|
|
3994
|
-
return
|
|
4195
|
+
return _this25.onExpandAll();
|
|
3995
4196
|
},
|
|
3996
4197
|
size: "large"
|
|
3997
4198
|
}, /*#__PURE__*/_react["default"].createElement(_IconOpen["default"], null))), /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
@@ -4002,7 +4203,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4002
4203
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
4003
4204
|
key: "collapseAll",
|
|
4004
4205
|
onClick: function onClick() {
|
|
4005
|
-
return
|
|
4206
|
+
return _this25.onCollapseAll();
|
|
4006
4207
|
},
|
|
4007
4208
|
size: "large"
|
|
4008
4209
|
}, /*#__PURE__*/_react["default"].createElement(_IconClosed["default"], null))), /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
@@ -4014,7 +4215,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4014
4215
|
key: "expandVisible",
|
|
4015
4216
|
color: "primary",
|
|
4016
4217
|
onClick: function onClick() {
|
|
4017
|
-
return
|
|
4218
|
+
return _this25.onExpandVisible();
|
|
4018
4219
|
},
|
|
4019
4220
|
size: "large"
|
|
4020
4221
|
}, /*#__PURE__*/_react["default"].createElement(StyledBadge, {
|
|
@@ -4029,7 +4230,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4029
4230
|
key: "collapseVisible",
|
|
4030
4231
|
color: "primary",
|
|
4031
4232
|
onClick: function onClick() {
|
|
4032
|
-
return
|
|
4233
|
+
return _this25.onCollapseVisible();
|
|
4033
4234
|
},
|
|
4034
4235
|
size: "large"
|
|
4035
4236
|
}, /*#__PURE__*/_react["default"].createElement(StyledBadge, {
|
|
@@ -4042,7 +4243,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4042
4243
|
}
|
|
4043
4244
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
4044
4245
|
onClick: function onClick() {
|
|
4045
|
-
return
|
|
4246
|
+
return _this25.onStatesViewVisible();
|
|
4046
4247
|
},
|
|
4047
4248
|
size: "large"
|
|
4048
4249
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.LooksOne, {
|
|
@@ -4054,9 +4255,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4054
4255
|
}
|
|
4055
4256
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
4056
4257
|
onClick: function onClick() {
|
|
4057
|
-
(window._localStorage || window.localStorage).setItem("".concat(
|
|
4058
|
-
|
|
4059
|
-
showDescription: !
|
|
4258
|
+
(window._localStorage || window.localStorage).setItem("".concat(_this25.props.dialogName || 'App', ".desc"), _this25.state.showDescription ? 'false' : 'true');
|
|
4259
|
+
_this25.setState({
|
|
4260
|
+
showDescription: !_this25.state.showDescription
|
|
4060
4261
|
});
|
|
4061
4262
|
},
|
|
4062
4263
|
size: "large"
|
|
@@ -4070,7 +4271,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4070
4271
|
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
4071
4272
|
disabled: !allowObjectCreation,
|
|
4072
4273
|
onClick: function onClick() {
|
|
4073
|
-
return
|
|
4274
|
+
return _this25.setState({
|
|
4074
4275
|
modalNewObj: true
|
|
4075
4276
|
});
|
|
4076
4277
|
},
|
|
@@ -4087,7 +4288,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4087
4288
|
input.setAttribute('id', 'files');
|
|
4088
4289
|
input.setAttribute('opacity', 0);
|
|
4089
4290
|
input.addEventListener('change', function (e) {
|
|
4090
|
-
return
|
|
4291
|
+
return _this25.handleJsonUpload(e);
|
|
4091
4292
|
}, false);
|
|
4092
4293
|
input.click();
|
|
4093
4294
|
},
|
|
@@ -4099,8 +4300,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4099
4300
|
}
|
|
4100
4301
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
4101
4302
|
onClick: function onClick() {
|
|
4102
|
-
return
|
|
4103
|
-
showExportDialog:
|
|
4303
|
+
return _this25.setState({
|
|
4304
|
+
showExportDialog: _this25._getSelectedIdsForExport().length
|
|
4104
4305
|
});
|
|
4105
4306
|
},
|
|
4106
4307
|
size: "large"
|
|
@@ -4114,7 +4315,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4114
4315
|
whiteSpace: 'nowrap'
|
|
4115
4316
|
}
|
|
4116
4317
|
}, "".concat(this.props.t('ra_Objects'), ": ").concat(Object.keys(this.info.objects).length, ", ").concat(this.props.t('ra_States'), ": ").concat(Object.keys(this.info.objects).filter(function (el) {
|
|
4117
|
-
return
|
|
4318
|
+
return _this25.info.objects[el].type === 'state';
|
|
4118
4319
|
}).length)), this.props.objectEditBoolean && /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
4119
4320
|
title: this.props.t('ra_Edit custom config'),
|
|
4120
4321
|
classes: {
|
|
@@ -4123,19 +4324,19 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4123
4324
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
4124
4325
|
onClick: function onClick() {
|
|
4125
4326
|
// get all visible states
|
|
4126
|
-
var ids = getVisibleItems(
|
|
4327
|
+
var ids = getVisibleItems(_this25.root, 'state', _this25.objects);
|
|
4127
4328
|
if (ids.length) {
|
|
4128
|
-
|
|
4329
|
+
_this25.pauseSubscribe(true);
|
|
4129
4330
|
if (ids.length === 1) {
|
|
4130
|
-
(window._localStorage || window.localStorage).setItem("".concat(
|
|
4131
|
-
|
|
4331
|
+
(window._localStorage || window.localStorage).setItem("".concat(_this25.props.dialogName || 'App', ".objectSelected"), _this25.state.selected[0]);
|
|
4332
|
+
_this25.props.router && _this25.props.router.doNavigate(null, 'custom', _this25.state.selected[0]);
|
|
4132
4333
|
}
|
|
4133
|
-
|
|
4334
|
+
_this25.setState({
|
|
4134
4335
|
customDialog: ids
|
|
4135
4336
|
});
|
|
4136
4337
|
} else {
|
|
4137
|
-
|
|
4138
|
-
toast:
|
|
4338
|
+
_this25.setState({
|
|
4339
|
+
toast: _this25.props.t('ra_please select object')
|
|
4139
4340
|
});
|
|
4140
4341
|
}
|
|
4141
4342
|
},
|
|
@@ -4194,8 +4395,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4194
4395
|
* @param {{ cellButtonsButton: string | undefined; cellButtonsButtonAlone: any; cellButtonsButtonIcon: string | undefined; cellButtonsButtonWithCustoms: any; }} classes
|
|
4195
4396
|
*/
|
|
4196
4397
|
function renderColumnButtons(id, item, classes) {
|
|
4197
|
-
var
|
|
4198
|
-
_item$
|
|
4398
|
+
var _this26 = this,
|
|
4399
|
+
_item$children4,
|
|
4199
4400
|
_item$data$obj$common,
|
|
4200
4401
|
_item$data$obj$common3;
|
|
4201
4402
|
if (!item.data.obj) {
|
|
@@ -4204,7 +4405,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4204
4405
|
}, this.state.filter.expertMode && this.props.objectEditOfAccessControl ? /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
4205
4406
|
className: _Utils["default"].clsx(classes.cellButtonsButton, classes.cellButtonsEmptyButton, classes.cellButtonMinWidth),
|
|
4206
4407
|
onClick: function onClick() {
|
|
4207
|
-
return
|
|
4408
|
+
return _this26.setState({
|
|
4208
4409
|
modalEditOfAccess: true,
|
|
4209
4410
|
modalEditOfAccessObjData: item.data
|
|
4210
4411
|
});
|
|
@@ -4216,9 +4417,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4216
4417
|
"aria-label": "delete",
|
|
4217
4418
|
title: this.texts.deleteObject,
|
|
4218
4419
|
onClick: function onClick() {
|
|
4219
|
-
var _item$
|
|
4420
|
+
var _item$children3;
|
|
4220
4421
|
// calculate number of children
|
|
4221
|
-
var keys = Object.keys(
|
|
4422
|
+
var keys = Object.keys(_this26.objects);
|
|
4222
4423
|
keys.sort();
|
|
4223
4424
|
var count = 0;
|
|
4224
4425
|
var start = "".concat(id, ".");
|
|
@@ -4229,7 +4430,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4229
4430
|
break;
|
|
4230
4431
|
}
|
|
4231
4432
|
}
|
|
4232
|
-
|
|
4433
|
+
_this26.props.onObjectDelete(id, !!((_item$children3 = item.children) !== null && _item$children3 !== void 0 && _item$children3.length), false, count + 1);
|
|
4233
4434
|
}
|
|
4234
4435
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Delete, {
|
|
4235
4436
|
className: classes.cellButtonsButtonIcon
|
|
@@ -4238,6 +4439,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4238
4439
|
item.data.aclTooltip = item.data.aclTooltip || this.renderTooltipAccessControl(item.data.obj.acl);
|
|
4239
4440
|
var acl = item.data.obj.acl ? item.data.obj.type === 'state' ? item.data.obj.acl.state : item.data.obj.acl.object : 0;
|
|
4240
4441
|
var aclSystemConfig = item.data.obj.acl && (item.data.obj.type === 'state' ? this.systemConfig.common.defaultNewAcl.state : this.systemConfig.common.defaultNewAcl.object);
|
|
4442
|
+
var showEdit = this.state.filter.expertMode || this.isNonExpertId(item.data.id);
|
|
4241
4443
|
return [this.state.filter.expertMode && this.props.objectEditOfAccessControl ? /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
4242
4444
|
key: "acl",
|
|
4243
4445
|
title: item.data.aclTooltip,
|
|
@@ -4247,7 +4449,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4247
4449
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
4248
4450
|
className: classes.cellButtonMinWidth,
|
|
4249
4451
|
onClick: function onClick() {
|
|
4250
|
-
return
|
|
4452
|
+
return _this26.setState({
|
|
4251
4453
|
modalEditOfAccess: true,
|
|
4252
4454
|
modalEditOfAccessObjData: item.data
|
|
4253
4455
|
});
|
|
@@ -4258,29 +4460,32 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4258
4460
|
}, Number.isNaN(Number(acl)) ? Number(aclSystemConfig).toString(16) : Number(acl).toString(16)))) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
4259
4461
|
key: "aclEmpty",
|
|
4260
4462
|
className: classes.cellButtonMinWidth
|
|
4261
|
-
}), /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
4463
|
+
}), showEdit ? /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
4262
4464
|
key: "edit",
|
|
4263
4465
|
className: classes.cellButtonsButton,
|
|
4264
4466
|
size: "small",
|
|
4265
4467
|
"aria-label": "edit",
|
|
4266
4468
|
title: this.texts.editObject,
|
|
4267
4469
|
onClick: function onClick() {
|
|
4268
|
-
(window._localStorage || window.localStorage).setItem("".concat(
|
|
4269
|
-
|
|
4470
|
+
(window._localStorage || window.localStorage).setItem("".concat(_this26.props.dialogName || 'App', ".objectSelected"), id);
|
|
4471
|
+
_this26.setState({
|
|
4270
4472
|
editObjectDialog: id,
|
|
4271
4473
|
editObjectAlias: false
|
|
4272
4474
|
});
|
|
4273
4475
|
}
|
|
4274
4476
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Edit, {
|
|
4275
4477
|
className: classes.cellButtonsButtonIcon
|
|
4276
|
-
}))
|
|
4478
|
+
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
4479
|
+
key: "editDisabled",
|
|
4480
|
+
className: classes.cellButtonsButton
|
|
4481
|
+
}), this.props.onObjectDelete && ((_item$children4 = item.children) !== null && _item$children4 !== void 0 && _item$children4.length || !((_item$data$obj$common = item.data.obj.common) !== null && _item$data$obj$common !== void 0 && _item$data$obj$common.dontDelete)) ? /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
4277
4482
|
key: "delete",
|
|
4278
4483
|
className: classes.cellButtonsButton,
|
|
4279
4484
|
size: "small",
|
|
4280
4485
|
"aria-label": "delete",
|
|
4281
4486
|
onClick: function onClick() {
|
|
4282
|
-
var _item$
|
|
4283
|
-
var keys = Object.keys(
|
|
4487
|
+
var _item$children5, _item$data$obj$common2;
|
|
4488
|
+
var keys = Object.keys(_this26.objects);
|
|
4284
4489
|
keys.sort();
|
|
4285
4490
|
var count = 0;
|
|
4286
4491
|
var start = "".concat(id, ".");
|
|
@@ -4291,7 +4496,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4291
4496
|
break;
|
|
4292
4497
|
}
|
|
4293
4498
|
}
|
|
4294
|
-
|
|
4499
|
+
_this26.props.onObjectDelete(id, !!((_item$children5 = item.children) !== null && _item$children5 !== void 0 && _item$children5.length), !((_item$data$obj$common2 = item.data.obj.common) !== null && _item$data$obj$common2 !== void 0 && _item$data$obj$common2.dontDelete), count);
|
|
4295
4500
|
},
|
|
4296
4501
|
title: this.texts.deleteObject
|
|
4297
4502
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Delete, {
|
|
@@ -4303,10 +4508,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4303
4508
|
"aria-label": "config",
|
|
4304
4509
|
title: this.texts.customConfig,
|
|
4305
4510
|
onClick: function onClick() {
|
|
4306
|
-
(window._localStorage || window.localStorage).setItem("".concat(
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4511
|
+
(window._localStorage || window.localStorage).setItem("".concat(_this26.props.dialogName || 'App', ".objectSelected"), id);
|
|
4512
|
+
_this26.pauseSubscribe(true);
|
|
4513
|
+
_this26.props.router && _this26.props.router.doNavigate(null, 'customs', id);
|
|
4514
|
+
_this26.setState({
|
|
4310
4515
|
customDialog: [id]
|
|
4311
4516
|
});
|
|
4312
4517
|
}
|
|
@@ -4379,13 +4584,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4379
4584
|
}, {
|
|
4380
4585
|
key: "renderColumnValue",
|
|
4381
4586
|
value: function renderColumnValue(id, item, classes) {
|
|
4382
|
-
var _obj$
|
|
4383
|
-
|
|
4587
|
+
var _obj$common6,
|
|
4588
|
+
_this27 = this;
|
|
4384
4589
|
var obj = item.data.obj;
|
|
4385
4590
|
if (!obj || !this.states) {
|
|
4386
4591
|
return null;
|
|
4387
4592
|
}
|
|
4388
|
-
if (((_obj$
|
|
4593
|
+
if (((_obj$common6 = obj.common) === null || _obj$common6 === void 0 ? void 0 : _obj$common6.type) === 'file') {
|
|
4389
4594
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
4390
4595
|
className: _Utils["default"].clsx(classes.cellValueText, classes.cellValueFile)
|
|
4391
4596
|
}, "[file]");
|
|
@@ -4413,7 +4618,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4413
4618
|
});
|
|
4414
4619
|
info = item.data.state;
|
|
4415
4620
|
info.valFull = info.valFull.map(function (_item) {
|
|
4416
|
-
if (_item.t ===
|
|
4621
|
+
if (_item.t === _this27.texts.quality && state.q) {
|
|
4417
4622
|
return [/*#__PURE__*/_react["default"].createElement("div", {
|
|
4418
4623
|
className: classes.cellValueTooltipBoth,
|
|
4419
4624
|
key: _item.t
|
|
@@ -4460,7 +4665,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4460
4665
|
}, "(", info.valText.s, ")") : null, /*#__PURE__*/_react["default"].createElement(_IconCopy["default"], {
|
|
4461
4666
|
className: _Utils["default"].clsx(classes.cellButtonsValueButton, 'copyButton', classes.cellButtonsValueButtonCopy),
|
|
4462
4667
|
onClick: function onClick(e) {
|
|
4463
|
-
return
|
|
4668
|
+
return _this27.onCopy(e, copyText);
|
|
4464
4669
|
},
|
|
4465
4670
|
key: "cc"
|
|
4466
4671
|
})
|
|
@@ -4487,7 +4692,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4487
4692
|
popper: this.props.classes.cellValueTooltipBox
|
|
4488
4693
|
},
|
|
4489
4694
|
onOpen: function onOpen() {
|
|
4490
|
-
return
|
|
4695
|
+
return _this27.readHistory(id);
|
|
4491
4696
|
}
|
|
4492
4697
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
4493
4698
|
style: info.style,
|
|
@@ -4503,7 +4708,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4503
4708
|
key: "_syncEnum",
|
|
4504
4709
|
value: function _syncEnum(id, enumIds, newArray, cb) {
|
|
4505
4710
|
var _this$info$objects$en,
|
|
4506
|
-
|
|
4711
|
+
_this28 = this;
|
|
4507
4712
|
if (!enumIds || !enumIds.length) {
|
|
4508
4713
|
cb && cb();
|
|
4509
4714
|
return;
|
|
@@ -4519,9 +4724,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4519
4724
|
var obj = JSON.parse(JSON.stringify(this.info.objects[enumId]));
|
|
4520
4725
|
obj.common.members.splice(pos, 1);
|
|
4521
4726
|
promises.push(this.props.socket.setObject(enumId, obj).then(function () {
|
|
4522
|
-
return
|
|
4727
|
+
return _this28.info.objects[enumId] = obj;
|
|
4523
4728
|
})["catch"](function (e) {
|
|
4524
|
-
return
|
|
4729
|
+
return _this28.showError(e);
|
|
4525
4730
|
}));
|
|
4526
4731
|
}
|
|
4527
4732
|
}
|
|
@@ -4534,15 +4739,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4534
4739
|
_obj.common.members.push(id);
|
|
4535
4740
|
_obj.common.members.sort();
|
|
4536
4741
|
promises.push(this.props.socket.setObject(enumId, _obj).then(function () {
|
|
4537
|
-
return
|
|
4742
|
+
return _this28.info.objects[enumId] = _obj;
|
|
4538
4743
|
})["catch"](function (e) {
|
|
4539
|
-
return
|
|
4744
|
+
return _this28.showError(e);
|
|
4540
4745
|
}));
|
|
4541
4746
|
}
|
|
4542
4747
|
}
|
|
4543
4748
|
Promise.all(promises).then(function () {
|
|
4544
4749
|
return setTimeout(function () {
|
|
4545
|
-
return
|
|
4750
|
+
return _this28._syncEnum(id, enumIds, newArray, cb);
|
|
4546
4751
|
}, 0);
|
|
4547
4752
|
});
|
|
4548
4753
|
}
|
|
@@ -4554,11 +4759,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4554
4759
|
}, {
|
|
4555
4760
|
key: "syncEnum",
|
|
4556
4761
|
value: function syncEnum(id, enumName, newArray) {
|
|
4557
|
-
var
|
|
4762
|
+
var _this29 = this;
|
|
4558
4763
|
var toCheck = (0, _toConsumableArray2["default"])(this.info[enumName === 'func' ? 'funcEnums' : 'roomEnums']);
|
|
4559
4764
|
return new Promise(function (resolve) {
|
|
4560
|
-
|
|
4561
|
-
error &&
|
|
4765
|
+
_this29._syncEnum(id, toCheck, newArray, function (error) {
|
|
4766
|
+
error && _this29.showError(error);
|
|
4562
4767
|
// force update of object
|
|
4563
4768
|
resolve();
|
|
4564
4769
|
});
|
|
@@ -4572,17 +4777,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4572
4777
|
}, {
|
|
4573
4778
|
key: "renderEnumDialog",
|
|
4574
4779
|
value: function renderEnumDialog() {
|
|
4575
|
-
var
|
|
4780
|
+
var _this30 = this;
|
|
4576
4781
|
if (this.state.enumDialog) {
|
|
4577
4782
|
var type = this.state.enumDialog.type;
|
|
4578
4783
|
var item = this.state.enumDialog.item;
|
|
4579
4784
|
var itemEnums = this.state.enumDialogEnums;
|
|
4580
4785
|
var enumsOriginal = this.state.enumDialog.enumsOriginal;
|
|
4581
4786
|
var enums = (type === 'room' ? this.info.roomEnums : this.info.funcEnums).map(function (id) {
|
|
4787
|
+
var _this30$objects$id;
|
|
4582
4788
|
return {
|
|
4583
|
-
name: getName(
|
|
4789
|
+
name: getName(((_this30$objects$id = _this30.objects[id]) === null || _this30$objects$id === void 0 || (_this30$objects$id = _this30$objects$id.common) === null || _this30$objects$id === void 0 ? void 0 : _this30$objects$id.name) || id.split('.').pop(), _this30.props.lang),
|
|
4584
4790
|
value: id,
|
|
4585
|
-
icon: getSelectIdIcon(
|
|
4791
|
+
icon: getSelectIdIcon(_this30.objects, id, _this30.imagePrefix)
|
|
4586
4792
|
};
|
|
4587
4793
|
}).sort(function (a, b) {
|
|
4588
4794
|
return a.name > b.name ? 1 : -1;
|
|
@@ -4590,10 +4796,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4590
4796
|
enums.forEach(function (_item) {
|
|
4591
4797
|
if (_item.icon && typeof _item.icon === 'string') {
|
|
4592
4798
|
_item.icon = /*#__PURE__*/_react["default"].createElement("div", {
|
|
4593
|
-
className:
|
|
4799
|
+
className: _this30.props.classes.enumIconDiv
|
|
4594
4800
|
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
4595
4801
|
src: _item.icon,
|
|
4596
|
-
className:
|
|
4802
|
+
className: _this30.props.classes.enumIcon,
|
|
4597
4803
|
alt: _item.name
|
|
4598
4804
|
}));
|
|
4599
4805
|
}
|
|
@@ -4604,7 +4810,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4604
4810
|
return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
|
|
4605
4811
|
className: this.props.classes.enumDialog,
|
|
4606
4812
|
onClose: function onClose() {
|
|
4607
|
-
return
|
|
4813
|
+
return _this30.setState({
|
|
4608
4814
|
enumDialog: null
|
|
4609
4815
|
});
|
|
4610
4816
|
},
|
|
@@ -4618,8 +4824,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4618
4824
|
disabled: JSON.stringify(enumsOriginal) === JSON.stringify(itemEnums),
|
|
4619
4825
|
size: "small",
|
|
4620
4826
|
onClick: function onClick() {
|
|
4621
|
-
return
|
|
4622
|
-
return
|
|
4827
|
+
return _this30.syncEnum(item.data.id, type, itemEnums).then(function () {
|
|
4828
|
+
return _this30.setState({
|
|
4623
4829
|
enumDialog: null,
|
|
4624
4830
|
enumDialogEnums: null
|
|
4625
4831
|
});
|
|
@@ -4643,24 +4849,24 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4643
4849
|
}
|
|
4644
4850
|
var labelId = "checkbox-list-label-".concat(id);
|
|
4645
4851
|
return /*#__PURE__*/_react["default"].createElement(_material.ListItem, {
|
|
4646
|
-
className:
|
|
4852
|
+
className: _this30.props.classes.headerCellSelectItem,
|
|
4647
4853
|
key: id,
|
|
4648
4854
|
onClick: function onClick() {
|
|
4649
4855
|
var pos = itemEnums.indexOf(id);
|
|
4650
|
-
var enumDialogEnums = JSON.parse(JSON.stringify(
|
|
4856
|
+
var enumDialogEnums = JSON.parse(JSON.stringify(_this30.state.enumDialogEnums));
|
|
4651
4857
|
if (pos === -1) {
|
|
4652
4858
|
enumDialogEnums.push(id);
|
|
4653
4859
|
enumDialogEnums.sort();
|
|
4654
4860
|
} else {
|
|
4655
4861
|
enumDialogEnums.splice(pos, 1);
|
|
4656
4862
|
}
|
|
4657
|
-
|
|
4863
|
+
_this30.setState({
|
|
4658
4864
|
enumDialogEnums: enumDialogEnums
|
|
4659
4865
|
});
|
|
4660
4866
|
}
|
|
4661
4867
|
}, /*#__PURE__*/_react["default"].createElement(_material.ListItemIcon, {
|
|
4662
4868
|
classes: {
|
|
4663
|
-
root:
|
|
4869
|
+
root: _this30.props.classes.enumCheckbox
|
|
4664
4870
|
}
|
|
4665
4871
|
}, /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
4666
4872
|
edge: "start",
|
|
@@ -4685,7 +4891,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4685
4891
|
}, {
|
|
4686
4892
|
key: "renderEditRoleDialog",
|
|
4687
4893
|
value: function renderEditRoleDialog() {
|
|
4688
|
-
var
|
|
4894
|
+
var _this31 = this;
|
|
4689
4895
|
if (this.state.roleDialog && this.props.objectBrowserEditRole) {
|
|
4690
4896
|
var ObjectBrowserEditRole = this.props.objectBrowserEditRole;
|
|
4691
4897
|
return /*#__PURE__*/_react["default"].createElement(ObjectBrowserEditRole, {
|
|
@@ -4696,9 +4902,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4696
4902
|
roles: this.info.roles,
|
|
4697
4903
|
onClose: function onClose(obj) {
|
|
4698
4904
|
if (obj) {
|
|
4699
|
-
|
|
4905
|
+
_this31.info.objects[_this31.state.roleDialog] = obj;
|
|
4700
4906
|
}
|
|
4701
|
-
|
|
4907
|
+
_this31.setState({
|
|
4702
4908
|
roleDialog: false
|
|
4703
4909
|
});
|
|
4704
4910
|
}
|
|
@@ -4714,7 +4920,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4714
4920
|
}, {
|
|
4715
4921
|
key: "onColumnsEditCustomDialogClose",
|
|
4716
4922
|
value: function onColumnsEditCustomDialogClose(isSave) {
|
|
4717
|
-
var
|
|
4923
|
+
var _this32 = this;
|
|
4718
4924
|
if (isSave) {
|
|
4719
4925
|
var value = this.customColumnDialog.value;
|
|
4720
4926
|
if (this.customColumnDialog.type === 'boolean') {
|
|
@@ -4724,16 +4930,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4724
4930
|
}
|
|
4725
4931
|
this.customColumnDialog = null;
|
|
4726
4932
|
this.props.socket.getObject(this.state.columnsEditCustomDialog.obj._id).then(function (obj) {
|
|
4727
|
-
if (ObjectBrowser.setCustomValue(obj,
|
|
4728
|
-
return
|
|
4933
|
+
if (ObjectBrowser.setCustomValue(obj, _this32.state.columnsEditCustomDialog.it, value)) {
|
|
4934
|
+
return _this32.props.socket.setObject(obj._id, obj);
|
|
4729
4935
|
}
|
|
4730
|
-
throw new Error(
|
|
4936
|
+
throw new Error(_this32.props.t('ra_Cannot update attribute, because not found in the object'));
|
|
4731
4937
|
}).then(function () {
|
|
4732
|
-
return
|
|
4938
|
+
return _this32.setState({
|
|
4733
4939
|
columnsEditCustomDialog: null
|
|
4734
4940
|
});
|
|
4735
4941
|
})["catch"](function (e) {
|
|
4736
|
-
return
|
|
4942
|
+
return _this32.showError(e);
|
|
4737
4943
|
});
|
|
4738
4944
|
} else {
|
|
4739
4945
|
this.customColumnDialog = null;
|
|
@@ -4749,7 +4955,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4749
4955
|
}, {
|
|
4750
4956
|
key: "renderColumnsEditCustomDialog",
|
|
4751
4957
|
value: function renderColumnsEditCustomDialog() {
|
|
4752
|
-
var
|
|
4958
|
+
var _this33 = this;
|
|
4753
4959
|
if (this.state.columnsEditCustomDialog) {
|
|
4754
4960
|
if (!this.customColumnDialog) {
|
|
4755
4961
|
var value = ObjectBrowser.getCustomValue(this.state.columnsEditCustomDialog.obj, this.state.columnsEditCustomDialog.it);
|
|
@@ -4761,7 +4967,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4761
4967
|
}
|
|
4762
4968
|
return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
|
|
4763
4969
|
onClose: function onClose() {
|
|
4764
|
-
return
|
|
4970
|
+
return _this33.setState({
|
|
4765
4971
|
columnsEditCustomDialog: null
|
|
4766
4972
|
});
|
|
4767
4973
|
},
|
|
@@ -4775,14 +4981,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4775
4981
|
}, this.customColumnDialog.type === 'boolean' ? /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
4776
4982
|
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
4777
4983
|
onKeyUp: function onKeyUp(e) {
|
|
4778
|
-
return e.keyCode === 13 &&
|
|
4984
|
+
return e.keyCode === 13 && _this33.onColumnsEditCustomDialogClose(true);
|
|
4779
4985
|
},
|
|
4780
4986
|
defaultChecked: this.customColumnDialog.value === 'true',
|
|
4781
4987
|
onChange: function onChange(e) {
|
|
4782
|
-
|
|
4783
|
-
var changed =
|
|
4784
|
-
if (changed === !
|
|
4785
|
-
|
|
4988
|
+
_this33.customColumnDialog.value = e.target.checked.toString();
|
|
4989
|
+
var changed = _this33.customColumnDialog.value !== _this33.customColumnDialog.initValue;
|
|
4990
|
+
if (changed === !_this33.state.customColumnDialogValueChanged) {
|
|
4991
|
+
_this33.setState({
|
|
4786
4992
|
customColumnDialogValueChanged: changed
|
|
4787
4993
|
});
|
|
4788
4994
|
}
|
|
@@ -4794,14 +5000,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4794
5000
|
defaultValue: this.customColumnDialog.value,
|
|
4795
5001
|
fullWidth: true,
|
|
4796
5002
|
onKeyUp: function onKeyUp(e) {
|
|
4797
|
-
return e.keyCode === 13 &&
|
|
5003
|
+
return e.keyCode === 13 && _this33.onColumnsEditCustomDialogClose(true);
|
|
4798
5004
|
},
|
|
4799
5005
|
label: "".concat(this.state.columnsEditCustomDialog.it.name, " (").concat(this.state.columnsEditCustomDialog.it.pathText, ")"),
|
|
4800
5006
|
onChange: function onChange(e) {
|
|
4801
|
-
|
|
4802
|
-
var changed =
|
|
4803
|
-
if (changed === !
|
|
4804
|
-
|
|
5007
|
+
_this33.customColumnDialog.value = e.target.value;
|
|
5008
|
+
var changed = _this33.customColumnDialog.value !== _this33.customColumnDialog.initValue;
|
|
5009
|
+
if (changed === !_this33.state.customColumnDialogValueChanged) {
|
|
5010
|
+
_this33.setState({
|
|
4805
5011
|
customColumnDialogValueChanged: changed
|
|
4806
5012
|
});
|
|
4807
5013
|
}
|
|
@@ -4810,7 +5016,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4810
5016
|
}))), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
4811
5017
|
variant: "contained",
|
|
4812
5018
|
onClick: function onClick() {
|
|
4813
|
-
return
|
|
5019
|
+
return _this33.onColumnsEditCustomDialogClose(true);
|
|
4814
5020
|
},
|
|
4815
5021
|
disabled: !this.state.customColumnDialogValueChanged,
|
|
4816
5022
|
color: "primary",
|
|
@@ -4819,7 +5025,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4819
5025
|
color: "grey",
|
|
4820
5026
|
variant: "contained",
|
|
4821
5027
|
onClick: function onClick() {
|
|
4822
|
-
return
|
|
5028
|
+
return _this33.onColumnsEditCustomDialogClose();
|
|
4823
5029
|
},
|
|
4824
5030
|
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Close, null)
|
|
4825
5031
|
}, this.props.t('ra_Cancel'))));
|
|
@@ -4843,14 +5049,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4843
5049
|
* @returns {JSX.Element | null}
|
|
4844
5050
|
*/
|
|
4845
5051
|
function renderCustomValue(obj, it, item) {
|
|
4846
|
-
var
|
|
5052
|
+
var _this34 = this;
|
|
4847
5053
|
var text = ObjectBrowser.getCustomValue(obj, it);
|
|
4848
5054
|
if (text !== null && text !== undefined) {
|
|
4849
5055
|
if (it.edit && !this.props.notEditable && (!it.objTypes || it.objTypes.includes(obj.type))) {
|
|
4850
5056
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
4851
5057
|
className: _Utils["default"].clsx(this.props.classes.columnCustom, this.props.classes.columnCustomEditable, this.props.classes["columnCustom_".concat(it.align)]),
|
|
4852
5058
|
onClick: function onClick() {
|
|
4853
|
-
return
|
|
5059
|
+
return _this34.setState({
|
|
4854
5060
|
columnsEditCustomDialog: {
|
|
4855
5061
|
item: item,
|
|
4856
5062
|
it: it,
|
|
@@ -4879,7 +5085,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4879
5085
|
}, {
|
|
4880
5086
|
key: "renderLeaf",
|
|
4881
5087
|
value: function renderLeaf(item, isExpanded, classes, counter) {
|
|
4882
|
-
var
|
|
5088
|
+
var _this35 = this,
|
|
4883
5089
|
_common$alias,
|
|
4884
5090
|
_common$alias2,
|
|
4885
5091
|
_this$states$id2,
|
|
@@ -4900,12 +5106,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4900
5106
|
iconFolder = isExpanded ? /*#__PURE__*/_react["default"].createElement(_IconOpen["default"], {
|
|
4901
5107
|
className: classes.cellIdIconFolder,
|
|
4902
5108
|
onClick: function onClick() {
|
|
4903
|
-
return
|
|
5109
|
+
return _this35.toggleExpanded(id);
|
|
4904
5110
|
}
|
|
4905
5111
|
}) : /*#__PURE__*/_react["default"].createElement(_IconClosed["default"], {
|
|
4906
5112
|
className: classes.cellIdIconFolder,
|
|
4907
5113
|
onClick: function onClick() {
|
|
4908
|
-
return
|
|
5114
|
+
return _this35.toggleExpanded(id);
|
|
4909
5115
|
}
|
|
4910
5116
|
});
|
|
4911
5117
|
} else if (obj.common && obj.common.write === false && obj.type === 'state') {
|
|
@@ -4992,10 +5198,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4992
5198
|
onClick: function onClick(e) {
|
|
4993
5199
|
e.stopPropagation();
|
|
4994
5200
|
e.preventDefault();
|
|
4995
|
-
|
|
5201
|
+
_this35.onSelect(common.alias.id.read);
|
|
4996
5202
|
setTimeout(function () {
|
|
4997
|
-
return
|
|
4998
|
-
return
|
|
5203
|
+
return _this35.expandAllSelected(function () {
|
|
5204
|
+
return _this35.scrollToItem(common.alias.id.read);
|
|
4999
5205
|
});
|
|
5000
5206
|
}, 100);
|
|
5001
5207
|
},
|
|
@@ -5004,10 +5210,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5004
5210
|
onClick: function onClick(e) {
|
|
5005
5211
|
e.stopPropagation();
|
|
5006
5212
|
e.preventDefault();
|
|
5007
|
-
|
|
5213
|
+
_this35.onSelect(common.alias.id.write);
|
|
5008
5214
|
setTimeout(function () {
|
|
5009
|
-
return
|
|
5010
|
-
return
|
|
5215
|
+
return _this35.expandAllSelected(function () {
|
|
5216
|
+
return _this35.scrollToItem(common.alias.id.write);
|
|
5011
5217
|
});
|
|
5012
5218
|
}, 100);
|
|
5013
5219
|
},
|
|
@@ -5016,10 +5222,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5016
5222
|
onClick: function onClick(e) {
|
|
5017
5223
|
e.stopPropagation();
|
|
5018
5224
|
e.preventDefault();
|
|
5019
|
-
|
|
5225
|
+
_this35.onSelect(common.alias.id);
|
|
5020
5226
|
setTimeout(function () {
|
|
5021
|
-
return
|
|
5022
|
-
return
|
|
5227
|
+
return _this35.expandAllSelected(function () {
|
|
5228
|
+
return _this35.scrollToItem(common.alias.id);
|
|
5023
5229
|
});
|
|
5024
5230
|
}, 100);
|
|
5025
5231
|
},
|
|
@@ -5051,17 +5257,17 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5051
5257
|
_id = "".concat(id, ".").concat(_id);
|
|
5052
5258
|
}
|
|
5053
5259
|
ids[name] = _id;
|
|
5054
|
-
if (!
|
|
5055
|
-
var
|
|
5056
|
-
if (((
|
|
5057
|
-
!
|
|
5058
|
-
|
|
5260
|
+
if (!_this35.states[_id]) {
|
|
5261
|
+
var _this35$objects$_id;
|
|
5262
|
+
if (((_this35$objects$_id = _this35.objects[_id]) === null || _this35$objects$_id === void 0 ? void 0 : _this35$objects$_id.type) === 'state') {
|
|
5263
|
+
!_this35.recordStates.includes(_id) && _this35.recordStates.push(_id);
|
|
5264
|
+
_this35.states[_id] = {
|
|
5059
5265
|
val: null
|
|
5060
5266
|
};
|
|
5061
|
-
|
|
5267
|
+
_this35.subscribe(_id);
|
|
5062
5268
|
}
|
|
5063
5269
|
} else {
|
|
5064
|
-
!
|
|
5270
|
+
!_this35.recordStates.includes(_id) && _this35.recordStates.push(_id);
|
|
5065
5271
|
}
|
|
5066
5272
|
});
|
|
5067
5273
|
// calculate color
|
|
@@ -5162,8 +5368,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5162
5368
|
key: id,
|
|
5163
5369
|
id: id,
|
|
5164
5370
|
onMouseDown: function onMouseDown(e) {
|
|
5165
|
-
|
|
5166
|
-
_this36.onSelect(id);
|
|
5371
|
+
_this35.onSelect(id);
|
|
5167
5372
|
var isRightMB;
|
|
5168
5373
|
if ('which' in e) {
|
|
5169
5374
|
// Gecko (Firefox), WebKit (Safari/Chrome) & Opera
|
|
@@ -5173,19 +5378,19 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5173
5378
|
isRightMB = e.button === 2;
|
|
5174
5379
|
}
|
|
5175
5380
|
if (isRightMB) {
|
|
5176
|
-
|
|
5381
|
+
_this35.contextMenu = {
|
|
5177
5382
|
item: item,
|
|
5178
5383
|
ts: Date.now()
|
|
5179
5384
|
};
|
|
5180
5385
|
} else {
|
|
5181
|
-
|
|
5386
|
+
_this35.contextMenu = null;
|
|
5182
5387
|
}
|
|
5183
5388
|
},
|
|
5184
5389
|
onDoubleClick: function onDoubleClick() {
|
|
5185
5390
|
if (!item.children) {
|
|
5186
|
-
|
|
5391
|
+
_this35.onSelect(id, true);
|
|
5187
5392
|
} else {
|
|
5188
|
-
|
|
5393
|
+
_this35.toggleExpanded(id);
|
|
5189
5394
|
}
|
|
5190
5395
|
}
|
|
5191
5396
|
}, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
@@ -5221,7 +5426,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5221
5426
|
}, iconItem), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_IconCopy["default"], {
|
|
5222
5427
|
className: _Utils["default"].clsx(classes.cellCopyButton, 'copyButton'),
|
|
5223
5428
|
onClick: function onClick(e) {
|
|
5224
|
-
return
|
|
5429
|
+
return _this35.onCopy(e, id);
|
|
5225
5430
|
}
|
|
5226
5431
|
}))), this.columnsVisibility.name ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5227
5432
|
className: _Utils["default"].clsx(classes.cellName, useDesc && classes.cellNameWithDesc),
|
|
@@ -5235,7 +5440,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5235
5440
|
}, /*#__PURE__*/_react["default"].createElement(_IconCopy["default"], {
|
|
5236
5441
|
className: _Utils["default"].clsx(classes.cellCopyButton, 'copyButton'),
|
|
5237
5442
|
onClick: function onClick(e) {
|
|
5238
|
-
return
|
|
5443
|
+
return _this35.onCopy(e, item.data.title);
|
|
5239
5444
|
}
|
|
5240
5445
|
})) : null) : null, !this.state.statesView ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.columnsVisibility.type ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5241
5446
|
className: classes.cellType,
|
|
@@ -5249,7 +5454,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5249
5454
|
cursor: this.state.filter.expertMode && enumEditable && this.props.objectBrowserEditRole ? 'text' : 'default'
|
|
5250
5455
|
},
|
|
5251
5456
|
onClick: this.state.filter.expertMode && enumEditable && this.props.objectBrowserEditRole ? function () {
|
|
5252
|
-
return
|
|
5457
|
+
return _this35.setState({
|
|
5253
5458
|
roleDialog: item.data.id
|
|
5254
5459
|
});
|
|
5255
5460
|
} : undefined
|
|
@@ -5260,8 +5465,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5260
5465
|
cursor: enumEditable ? 'text' : 'default'
|
|
5261
5466
|
},
|
|
5262
5467
|
onClick: enumEditable ? function () {
|
|
5263
|
-
var enums = findEnumsForObjectAsIds(
|
|
5264
|
-
|
|
5468
|
+
var enums = findEnumsForObjectAsIds(_this35.info, item.data.id, 'roomEnums');
|
|
5469
|
+
_this35.setState({
|
|
5265
5470
|
enumDialogEnums: enums,
|
|
5266
5471
|
enumDialog: {
|
|
5267
5472
|
item: item,
|
|
@@ -5277,8 +5482,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5277
5482
|
cursor: enumEditable ? 'text' : 'default'
|
|
5278
5483
|
},
|
|
5279
5484
|
onClick: enumEditable ? function () {
|
|
5280
|
-
var enums = findEnumsForObjectAsIds(
|
|
5281
|
-
|
|
5485
|
+
var enums = findEnumsForObjectAsIds(_this35.info, item.data.id, 'funcEnums');
|
|
5486
|
+
_this35.setState({
|
|
5282
5487
|
enumDialogEnums: enums,
|
|
5283
5488
|
enumDialog: {
|
|
5284
5489
|
item: item,
|
|
@@ -5313,11 +5518,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5313
5518
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
5314
5519
|
className: classes.cellAdapter,
|
|
5315
5520
|
style: {
|
|
5316
|
-
width:
|
|
5521
|
+
width: _this35.columnsVisibility[it.id]
|
|
5317
5522
|
},
|
|
5318
5523
|
key: it.id,
|
|
5319
5524
|
title: "".concat(it.adapter, " => ").concat(it.pathText)
|
|
5320
|
-
},
|
|
5525
|
+
}, _this35.renderCustomValue(obj, it, item));
|
|
5321
5526
|
}), this.columnsVisibility.val ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5322
5527
|
className: classes.cellValue,
|
|
5323
5528
|
style: {
|
|
@@ -5325,26 +5530,26 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5325
5530
|
cursor: valueEditable ? (common === null || common === void 0 ? void 0 : common.type) === 'file' ? 'zoom-in' : item.data.button ? 'grab' : 'text' : 'default'
|
|
5326
5531
|
},
|
|
5327
5532
|
onClick: valueEditable ? function () {
|
|
5328
|
-
if (!obj || !
|
|
5533
|
+
if (!obj || !_this35.states) {
|
|
5329
5534
|
// return;
|
|
5330
5535
|
} else if ((common === null || common === void 0 ? void 0 : common.type) === 'file') {
|
|
5331
|
-
|
|
5536
|
+
_this35.setState({
|
|
5332
5537
|
viewFileDialog: id
|
|
5333
5538
|
});
|
|
5334
5539
|
// eslint-disable-next-line brace-style
|
|
5335
|
-
} else if (!
|
|
5540
|
+
} else if (!_this35.state.filter.expertMode && item.data.button) {
|
|
5336
5541
|
// in non-expert mode control button directly
|
|
5337
|
-
|
|
5542
|
+
_this35.props.socket.setState(id, true)["catch"](function (e) {
|
|
5338
5543
|
return window.alert("Cannot write state \"".concat(id, "\": ").concat(e));
|
|
5339
5544
|
});
|
|
5340
5545
|
} else {
|
|
5341
|
-
|
|
5342
|
-
val:
|
|
5343
|
-
q:
|
|
5546
|
+
_this35.edit = {
|
|
5547
|
+
val: _this35.states[id] ? _this35.states[id].val : '',
|
|
5548
|
+
q: _this35.states[id] ? _this35.states[id].q || 0 : 0,
|
|
5344
5549
|
ack: false,
|
|
5345
5550
|
id: id
|
|
5346
5551
|
};
|
|
5347
|
-
|
|
5552
|
+
_this35.setState({
|
|
5348
5553
|
updateOpened: true
|
|
5349
5554
|
});
|
|
5350
5555
|
}
|
|
@@ -5368,7 +5573,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5368
5573
|
}, {
|
|
5369
5574
|
key: "renderItem",
|
|
5370
5575
|
value: function renderItem(root, isExpanded, classes, counter) {
|
|
5371
|
-
var
|
|
5576
|
+
var _this36 = this;
|
|
5372
5577
|
var items = [];
|
|
5373
5578
|
counter = counter || {
|
|
5374
5579
|
count: 0
|
|
@@ -5396,9 +5601,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5396
5601
|
if (!this.state.foldersFirst) {
|
|
5397
5602
|
root.children && items.push(root.children.map(function (item) {
|
|
5398
5603
|
// do not render too many items in column editor mode
|
|
5399
|
-
if (!
|
|
5604
|
+
if (!_this36.state.columnsSelectorShow || counter.count < 15) {
|
|
5400
5605
|
if (item.data.sumVisibility) {
|
|
5401
|
-
return
|
|
5606
|
+
return _this36.renderItem(item, undefined, classes, counter);
|
|
5402
5607
|
}
|
|
5403
5608
|
}
|
|
5404
5609
|
return null;
|
|
@@ -5408,9 +5613,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5408
5613
|
root.children && items.push(root.children.map(function (item) {
|
|
5409
5614
|
if (item.children) {
|
|
5410
5615
|
// do not render too many items in column editor mode
|
|
5411
|
-
if (!
|
|
5616
|
+
if (!_this36.state.columnsSelectorShow || counter.count < 15) {
|
|
5412
5617
|
if (item.data.sumVisibility) {
|
|
5413
|
-
return
|
|
5618
|
+
return _this36.renderItem(item, undefined, classes, counter);
|
|
5414
5619
|
}
|
|
5415
5620
|
}
|
|
5416
5621
|
}
|
|
@@ -5420,9 +5625,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5420
5625
|
root.children && items.push(root.children.map(function (item) {
|
|
5421
5626
|
if (!item.children) {
|
|
5422
5627
|
// do not render too many items in column editor mode
|
|
5423
|
-
if (!
|
|
5628
|
+
if (!_this36.state.columnsSelectorShow || counter.count < 15) {
|
|
5424
5629
|
if (item.data.sumVisibility) {
|
|
5425
|
-
return
|
|
5630
|
+
return _this36.renderItem(item, undefined, classes, counter);
|
|
5426
5631
|
}
|
|
5427
5632
|
}
|
|
5428
5633
|
}
|
|
@@ -5443,7 +5648,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5443
5648
|
}, {
|
|
5444
5649
|
key: "calculateColumnsVisibility",
|
|
5445
5650
|
value: function calculateColumnsVisibility(columnsAuto, columns, columnsForAdmin, columnsWidths) {
|
|
5446
|
-
var
|
|
5651
|
+
var _this37 = this;
|
|
5447
5652
|
columnsWidths = columnsWidths || this.state.columnsWidths;
|
|
5448
5653
|
columnsForAdmin = columnsForAdmin || this.state.columnsForAdmin;
|
|
5449
5654
|
columns = columns || this.state.columns || [];
|
|
@@ -5527,7 +5732,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5527
5732
|
Object.keys(columnsForAdmin).sort().forEach(function (adapter) {
|
|
5528
5733
|
return columnsForAdmin[adapter].forEach(function (column) {
|
|
5529
5734
|
var id = "_".concat(adapter, "_").concat(column.path);
|
|
5530
|
-
|
|
5735
|
+
_this37.columnsVisibility[id] = columns.includes(id);
|
|
5531
5736
|
if (columns.includes(id)) {
|
|
5532
5737
|
var item = {
|
|
5533
5738
|
adapter: adapter,
|
|
@@ -5545,11 +5750,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5545
5750
|
item.objTypes = column.objTypes;
|
|
5546
5751
|
}
|
|
5547
5752
|
}
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
_widthSum2 +=
|
|
5753
|
+
_this37.adapterColumns.push(item);
|
|
5754
|
+
_this37.columnsVisibility[id] = columnsWidths[item.id] || column.width || SCREEN_WIDTHS[_this37.props.width].widths.func || SCREEN_WIDTHS.xl.widths.func;
|
|
5755
|
+
_widthSum2 += _this37.columnsVisibility[id];
|
|
5551
5756
|
} else {
|
|
5552
|
-
|
|
5757
|
+
_this37.columnsVisibility[id] = 0;
|
|
5553
5758
|
}
|
|
5554
5759
|
});
|
|
5555
5760
|
});
|
|
@@ -5570,10 +5775,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5570
5775
|
this.columnsVisibility.nameHeader = "calc(100% - ".concat(_widthSum2 + 5 + this.state.scrollBarWidth, "px)");
|
|
5571
5776
|
} else {
|
|
5572
5777
|
var newWidth = Object.keys(this.columnsVisibility).reduce(function (accumulator, name) {
|
|
5573
|
-
if (name === 'id' || typeof
|
|
5778
|
+
if (name === 'id' || typeof _this37.columnsVisibility[name] === 'string' || !_this37.columnsVisibility[name]) {
|
|
5574
5779
|
return accumulator;
|
|
5575
5780
|
}
|
|
5576
|
-
return accumulator +
|
|
5781
|
+
return accumulator + _this37.columnsVisibility[name];
|
|
5577
5782
|
}, 0);
|
|
5578
5783
|
this.columnsVisibility.id = "calc(100% - ".concat(newWidth, "px)");
|
|
5579
5784
|
}
|
|
@@ -5607,22 +5812,81 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5607
5812
|
if (event.code === 'ArrowRight' || event.code === 'ArrowLeft') {
|
|
5608
5813
|
this.toggleExpanded(selectedId);
|
|
5609
5814
|
}
|
|
5815
|
+
if (event.code === 'Delete') {
|
|
5816
|
+
var _obj$common7;
|
|
5817
|
+
var item = this.getItemFromRoot(this.root, selectedId);
|
|
5818
|
+
var obj = item.data.obj;
|
|
5819
|
+
if (obj && !((_obj$common7 = obj.common) !== null && _obj$common7 !== void 0 && _obj$common7.dontDelete)) {
|
|
5820
|
+
this.showDeleteDialog({
|
|
5821
|
+
id: selectedId,
|
|
5822
|
+
obj: obj,
|
|
5823
|
+
item: item
|
|
5824
|
+
});
|
|
5825
|
+
}
|
|
5826
|
+
}
|
|
5610
5827
|
}
|
|
5828
|
+
|
|
5829
|
+
/**
|
|
5830
|
+
* Find the id from the root
|
|
5831
|
+
*
|
|
5832
|
+
* @param {Record<string, any>} root The current root
|
|
5833
|
+
* @param {string} id the object id
|
|
5834
|
+
*
|
|
5835
|
+
* @returns {any}
|
|
5836
|
+
*/
|
|
5611
5837
|
}, {
|
|
5612
|
-
key: "
|
|
5838
|
+
key: "getItemFromRoot",
|
|
5839
|
+
value: function getItemFromRoot(root, id) {
|
|
5840
|
+
var idArr = id.split('.');
|
|
5841
|
+
var currId = '';
|
|
5842
|
+
var _iterator2 = _createForOfIteratorHelper(idArr),
|
|
5843
|
+
_step2;
|
|
5844
|
+
try {
|
|
5845
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
5846
|
+
var idEntry = _step2.value;
|
|
5847
|
+
currId = currId ? "".concat(currId, ".").concat(idEntry) : idEntry;
|
|
5848
|
+
root = root.children.find(function (item) {
|
|
5849
|
+
return item.data.id === currId;
|
|
5850
|
+
});
|
|
5851
|
+
}
|
|
5852
|
+
} catch (err) {
|
|
5853
|
+
_iterator2.e(err);
|
|
5854
|
+
} finally {
|
|
5855
|
+
_iterator2.f();
|
|
5856
|
+
}
|
|
5857
|
+
return root;
|
|
5858
|
+
}
|
|
5859
|
+
}, {
|
|
5860
|
+
key: "renderHandleRight",
|
|
5613
5861
|
value:
|
|
5862
|
+
/**
|
|
5863
|
+
* Render a right handle for resizing
|
|
5864
|
+
*
|
|
5865
|
+
* @return {JSX.Element}
|
|
5866
|
+
*/
|
|
5867
|
+
function renderHandleRight() {
|
|
5868
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
5869
|
+
className: "".concat(this.props.classes.resizeHandle, " ").concat(this.props.classes.resizeHandleRight),
|
|
5870
|
+
onMouseDown: this.resizerMouseDown,
|
|
5871
|
+
onDoubleClick: this.resizerReset,
|
|
5872
|
+
title: this.props.t('ra_Double click to reset table layout')
|
|
5873
|
+
});
|
|
5874
|
+
}
|
|
5875
|
+
|
|
5614
5876
|
/**
|
|
5615
5877
|
* @private
|
|
5616
5878
|
* @returns {JSX.Element}
|
|
5617
5879
|
*/
|
|
5618
|
-
|
|
5619
|
-
|
|
5880
|
+
}, {
|
|
5881
|
+
key: "renderHeader",
|
|
5882
|
+
value: function renderHeader() {
|
|
5883
|
+
var _this38 = this;
|
|
5620
5884
|
var classes = this.props.classes;
|
|
5621
5885
|
var filterClearInValue = null;
|
|
5622
5886
|
if (!this.columnsVisibility.buttons && !this.isFilterEmpty()) {
|
|
5623
5887
|
filterClearInValue = /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
5624
5888
|
onClick: function onClick() {
|
|
5625
|
-
return
|
|
5889
|
+
return _this38.clearFilter();
|
|
5626
5890
|
},
|
|
5627
5891
|
className: classes.buttonClearFilter,
|
|
5628
5892
|
title: this.props.t('ra_Clear filter'),
|
|
@@ -5641,79 +5905,83 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5641
5905
|
},
|
|
5642
5906
|
"data-min": 240,
|
|
5643
5907
|
"data-name": "id"
|
|
5644
|
-
}, this.getFilterInput('id'), /*#__PURE__*/_react["default"].createElement("div", {
|
|
5645
|
-
className: "".concat(this.props.classes.resizeHandle, " ").concat(this.props.classes.resizeHandleRight),
|
|
5646
|
-
onMouseDown: this.resizerMouseDown,
|
|
5647
|
-
onDoubleClick: this.resizerReset,
|
|
5648
|
-
title: this.props.t('ra_Double click to reset table layout')
|
|
5649
|
-
})), this.columnsVisibility.name ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5908
|
+
}, this.getFilterInput('id'), this.renderHandleRight()), this.columnsVisibility.name ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5650
5909
|
className: classes.headerCell,
|
|
5651
5910
|
style: {
|
|
5652
|
-
width: this.columnsVisibility.nameHeader
|
|
5911
|
+
width: this.columnsVisibility.nameHeader,
|
|
5912
|
+
position: 'relative'
|
|
5653
5913
|
},
|
|
5654
5914
|
"data-min": 100,
|
|
5655
5915
|
"data-name": "nameHeader"
|
|
5656
|
-
}, this.getFilterInput('name')) : null, !this.state.statesView && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.columnsVisibility.type ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5916
|
+
}, this.getFilterInput('name'), this.renderHandleRight()) : null, !this.state.statesView && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.columnsVisibility.type ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5657
5917
|
className: classes.headerCell,
|
|
5658
5918
|
style: {
|
|
5659
|
-
width: this.columnsVisibility.type
|
|
5919
|
+
width: this.columnsVisibility.type,
|
|
5920
|
+
position: 'relative'
|
|
5660
5921
|
},
|
|
5661
5922
|
"data-min": 100,
|
|
5662
5923
|
"data-name": "type"
|
|
5663
|
-
}, this.getFilterSelectType()) : null, this.columnsVisibility.role ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5924
|
+
}, this.getFilterSelectType(), this.renderHandleRight()) : null, this.columnsVisibility.role ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5664
5925
|
className: classes.headerCell,
|
|
5665
5926
|
style: {
|
|
5666
|
-
width: this.columnsVisibility.role
|
|
5927
|
+
width: this.columnsVisibility.role,
|
|
5928
|
+
position: 'relative'
|
|
5667
5929
|
},
|
|
5668
5930
|
"data-min": 100,
|
|
5669
5931
|
"data-name": "role"
|
|
5670
|
-
}, this.getFilterSelectRole()) : null, this.columnsVisibility.room ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5932
|
+
}, this.getFilterSelectRole(), this.renderHandleRight()) : null, this.columnsVisibility.room ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5671
5933
|
className: classes.headerCell,
|
|
5672
5934
|
style: {
|
|
5673
|
-
width: this.columnsVisibility.room
|
|
5935
|
+
width: this.columnsVisibility.room,
|
|
5936
|
+
position: 'relative'
|
|
5674
5937
|
},
|
|
5675
5938
|
"data-min": 100,
|
|
5676
5939
|
"data-name": "room"
|
|
5677
|
-
}, this.getFilterSelectRoom()) : null, this.columnsVisibility.func ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5940
|
+
}, this.getFilterSelectRoom(), this.renderHandleRight()) : null, this.columnsVisibility.func ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5678
5941
|
className: classes.headerCell,
|
|
5679
5942
|
style: {
|
|
5680
|
-
width: this.columnsVisibility.func
|
|
5943
|
+
width: this.columnsVisibility.func,
|
|
5944
|
+
position: 'relative'
|
|
5681
5945
|
},
|
|
5682
5946
|
"data-min": 100,
|
|
5683
5947
|
"data-name": "func"
|
|
5684
|
-
}, this.getFilterSelectFunction()) : null), this.state.statesView && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
5948
|
+
}, this.getFilterSelectFunction(), this.renderHandleRight()) : null), this.state.statesView && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
5685
5949
|
className: _Utils["default"].clsx(classes.headerCell, classes.headerCellValue),
|
|
5686
5950
|
style: {
|
|
5687
|
-
width: this.columnsVisibility.changedFrom
|
|
5951
|
+
width: this.columnsVisibility.changedFrom,
|
|
5952
|
+
position: 'relative'
|
|
5688
5953
|
},
|
|
5689
5954
|
"data-min": 100,
|
|
5690
5955
|
"data-name": "changedFrom"
|
|
5691
|
-
}, this.props.t('ra_Changed from')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
5956
|
+
}, this.props.t('ra_Changed from'), this.renderHandleRight()), /*#__PURE__*/_react["default"].createElement("div", {
|
|
5692
5957
|
className: _Utils["default"].clsx(classes.headerCell, classes.headerCellValue),
|
|
5693
5958
|
style: {
|
|
5694
|
-
width: this.columnsVisibility.qualityCode
|
|
5959
|
+
width: this.columnsVisibility.qualityCode,
|
|
5960
|
+
position: 'relative'
|
|
5695
5961
|
},
|
|
5696
5962
|
"data-min": 100,
|
|
5697
5963
|
"data-name": "qualityCode"
|
|
5698
|
-
}, this.props.t('ra_Quality code')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
5964
|
+
}, this.props.t('ra_Quality code'), this.renderHandleRight()), /*#__PURE__*/_react["default"].createElement("div", {
|
|
5699
5965
|
className: _Utils["default"].clsx(classes.headerCell, classes.headerCellValue),
|
|
5700
5966
|
style: {
|
|
5701
|
-
width: this.columnsVisibility.timestamp
|
|
5967
|
+
width: this.columnsVisibility.timestamp,
|
|
5968
|
+
position: 'relative'
|
|
5702
5969
|
},
|
|
5703
5970
|
"data-min": 100,
|
|
5704
5971
|
"data-name": "timestamp"
|
|
5705
|
-
}, this.props.t('ra_Timestamp')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
5972
|
+
}, this.props.t('ra_Timestamp'), this.renderHandleRight()), /*#__PURE__*/_react["default"].createElement("div", {
|
|
5706
5973
|
className: _Utils["default"].clsx(classes.headerCell, classes.headerCellValue),
|
|
5707
5974
|
style: {
|
|
5708
|
-
width: this.columnsVisibility.lastChange
|
|
5975
|
+
width: this.columnsVisibility.lastChange,
|
|
5976
|
+
position: 'relative'
|
|
5709
5977
|
},
|
|
5710
5978
|
"data-min": 100,
|
|
5711
5979
|
"data-name": "lastChange"
|
|
5712
|
-
}, this.props.t('ra_Last change'))), this.adapterColumns.map(function (item) {
|
|
5980
|
+
}, this.props.t('ra_Last change'), this.renderHandleRight())), this.adapterColumns.map(function (item) {
|
|
5713
5981
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
5714
5982
|
className: _Utils["default"].clsx(classes.headerCell, classes.headerCellValue),
|
|
5715
5983
|
style: {
|
|
5716
|
-
width:
|
|
5984
|
+
width: _this38.columnsVisibility[item.id]
|
|
5717
5985
|
},
|
|
5718
5986
|
title: item.adapter,
|
|
5719
5987
|
key: item.id,
|
|
@@ -5749,17 +6017,17 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5749
6017
|
}, {
|
|
5750
6018
|
key: "renderToast",
|
|
5751
6019
|
value: function renderToast() {
|
|
5752
|
-
var
|
|
6020
|
+
var _this39 = this;
|
|
5753
6021
|
return /*#__PURE__*/_react["default"].createElement(_material.Snackbar, {
|
|
5754
6022
|
open: !!this.state.toast,
|
|
5755
6023
|
autoHideDuration: 3000,
|
|
5756
6024
|
onClick: function onClick() {
|
|
5757
|
-
return
|
|
6025
|
+
return _this39.setState({
|
|
5758
6026
|
toast: ''
|
|
5759
6027
|
});
|
|
5760
6028
|
},
|
|
5761
6029
|
onClose: function onClose() {
|
|
5762
|
-
return
|
|
6030
|
+
return _this39.setState({
|
|
5763
6031
|
toast: ''
|
|
5764
6032
|
});
|
|
5765
6033
|
},
|
|
@@ -5769,7 +6037,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5769
6037
|
"aria-label": "close",
|
|
5770
6038
|
color: "inherit",
|
|
5771
6039
|
onClick: function onClick() {
|
|
5772
|
-
return
|
|
6040
|
+
return _this39.setState({
|
|
5773
6041
|
toast: ''
|
|
5774
6042
|
});
|
|
5775
6043
|
}
|
|
@@ -5785,12 +6053,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5785
6053
|
}, {
|
|
5786
6054
|
key: "componentDidUpdate",
|
|
5787
6055
|
value: function componentDidUpdate() {
|
|
5788
|
-
var
|
|
6056
|
+
var _this40 = this;
|
|
5789
6057
|
if (this.tableRef.current) {
|
|
5790
6058
|
var scrollBarWidth = this.tableRef.current.offsetWidth - this.tableRef.current.clientWidth;
|
|
5791
6059
|
if (this.state.scrollBarWidth !== scrollBarWidth) {
|
|
5792
6060
|
setTimeout(function () {
|
|
5793
|
-
return
|
|
6061
|
+
return _this40.setState({
|
|
5794
6062
|
scrollBarWidth: scrollBarWidth
|
|
5795
6063
|
});
|
|
5796
6064
|
}, 100);
|
|
@@ -5818,12 +6086,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5818
6086
|
}, {
|
|
5819
6087
|
key: "renderCustomDialog",
|
|
5820
6088
|
value: function renderCustomDialog() {
|
|
5821
|
-
var
|
|
6089
|
+
var _this41 = this;
|
|
5822
6090
|
if (this.state.customDialog && this.props.objectCustomDialog) {
|
|
5823
6091
|
var ObjectCustomDialog = this.props.objectCustomDialog;
|
|
5824
6092
|
return /*#__PURE__*/_react["default"].createElement(ObjectCustomDialog, {
|
|
5825
6093
|
reportChangedIds: function reportChangedIds(changedIds) {
|
|
5826
|
-
return
|
|
6094
|
+
return _this41.changedIds = (0, _toConsumableArray2["default"])(changedIds);
|
|
5827
6095
|
},
|
|
5828
6096
|
objectIDs: this.state.customDialog,
|
|
5829
6097
|
expertMode: this.state.filter.expertMode,
|
|
@@ -5837,16 +6105,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5837
6105
|
objects: this.objects,
|
|
5838
6106
|
customsInstances: this.info.customs,
|
|
5839
6107
|
onClose: function onClose() {
|
|
5840
|
-
|
|
5841
|
-
|
|
6108
|
+
_this41.pauseSubscribe(false);
|
|
6109
|
+
_this41.setState({
|
|
5842
6110
|
customDialog: null
|
|
5843
6111
|
});
|
|
5844
|
-
if (
|
|
5845
|
-
|
|
6112
|
+
if (_this41.changedIds) {
|
|
6113
|
+
_this41.changedIds = null;
|
|
5846
6114
|
// update all changed IDs
|
|
5847
|
-
|
|
6115
|
+
_this41.forceUpdate();
|
|
5848
6116
|
}
|
|
5849
|
-
|
|
6117
|
+
_this41.props.router && _this41.props.router.doNavigate('tab-objects');
|
|
5850
6118
|
}
|
|
5851
6119
|
});
|
|
5852
6120
|
}
|
|
@@ -5860,14 +6128,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5860
6128
|
}, {
|
|
5861
6129
|
key: "onUpdate",
|
|
5862
6130
|
value: function onUpdate(valAck) {
|
|
5863
|
-
var
|
|
6131
|
+
var _this42 = this;
|
|
5864
6132
|
this.props.socket.setState(this.edit.id, {
|
|
5865
6133
|
val: valAck.val,
|
|
5866
6134
|
ack: valAck.ack,
|
|
5867
6135
|
q: valAck.q || 0,
|
|
5868
6136
|
expire: valAck.expire || undefined
|
|
5869
6137
|
})["catch"](function (e) {
|
|
5870
|
-
return
|
|
6138
|
+
return _this42.showError("Cannot write value: ".concat(e));
|
|
5871
6139
|
});
|
|
5872
6140
|
}
|
|
5873
6141
|
|
|
@@ -5878,7 +6146,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5878
6146
|
}, {
|
|
5879
6147
|
key: "renderEditObjectDialog",
|
|
5880
6148
|
value: function renderEditObjectDialog() {
|
|
5881
|
-
var
|
|
6149
|
+
var _this43 = this;
|
|
5882
6150
|
if (!this.state.editObjectDialog || !this.props.objectBrowserEditObject) {
|
|
5883
6151
|
return null;
|
|
5884
6152
|
}
|
|
@@ -5890,45 +6158,45 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5890
6158
|
objects: this.objects,
|
|
5891
6159
|
dateFormat: this.props.dateFormat,
|
|
5892
6160
|
isFloatComma: this.props.isFloatComma,
|
|
5893
|
-
|
|
6161
|
+
themeType: this.props.themeType,
|
|
5894
6162
|
socket: this.props.socket,
|
|
5895
6163
|
dialogName: this.props.dialogName,
|
|
5896
6164
|
aliasTab: this.state.editObjectAlias,
|
|
5897
6165
|
t: this.props.t,
|
|
5898
6166
|
expertMode: this.state.filter.expertMode,
|
|
5899
6167
|
onNewObject: function onNewObject(obj) {
|
|
5900
|
-
return
|
|
5901
|
-
return
|
|
6168
|
+
return _this43.props.socket.setObject(obj._id, obj).then(function () {
|
|
6169
|
+
return _this43.setState({
|
|
5902
6170
|
editObjectDialog: obj._id,
|
|
5903
6171
|
editObjectAlias: false
|
|
5904
6172
|
}, function () {
|
|
5905
|
-
return
|
|
6173
|
+
return _this43.onSelect(obj._id);
|
|
5906
6174
|
});
|
|
5907
6175
|
})["catch"](function (e) {
|
|
5908
|
-
return
|
|
6176
|
+
return _this43.showError("Cannot write object: ".concat(e));
|
|
5909
6177
|
});
|
|
5910
6178
|
},
|
|
5911
6179
|
onClose: function onClose(obj) {
|
|
5912
6180
|
if (obj) {
|
|
5913
6181
|
var updateAlias;
|
|
5914
|
-
if (
|
|
5915
|
-
var
|
|
5916
|
-
if (JSON.stringify((
|
|
5917
|
-
updateAlias =
|
|
6182
|
+
if (_this43.state.editObjectDialog.startsWith('alias.')) {
|
|
6183
|
+
var _this43$objects$_this, _obj$common8;
|
|
6184
|
+
if (JSON.stringify((_this43$objects$_this = _this43.objects[_this43.state.editObjectDialog].common) === null || _this43$objects$_this === void 0 ? void 0 : _this43$objects$_this.alias) !== JSON.stringify((_obj$common8 = obj.common) === null || _obj$common8 === void 0 ? void 0 : _obj$common8.alias)) {
|
|
6185
|
+
updateAlias = _this43.state.editObjectDialog;
|
|
5918
6186
|
}
|
|
5919
6187
|
}
|
|
5920
|
-
|
|
5921
|
-
if (updateAlias &&
|
|
5922
|
-
|
|
6188
|
+
_this43.props.socket.setObject(obj._id, obj).then(function () {
|
|
6189
|
+
if (updateAlias && _this43.subscribes.includes(updateAlias)) {
|
|
6190
|
+
_this43.unsubscribe(updateAlias);
|
|
5923
6191
|
setTimeout(function () {
|
|
5924
|
-
return
|
|
6192
|
+
return _this43.subscribe(updateAlias);
|
|
5925
6193
|
}, 100);
|
|
5926
6194
|
}
|
|
5927
6195
|
})["catch"](function (e) {
|
|
5928
|
-
return
|
|
6196
|
+
return _this43.showError("Cannot write object: ".concat(e));
|
|
5929
6197
|
});
|
|
5930
6198
|
}
|
|
5931
|
-
|
|
6199
|
+
_this43.setState({
|
|
5932
6200
|
editObjectDialog: '',
|
|
5933
6201
|
editObjectAlias: false
|
|
5934
6202
|
});
|
|
@@ -5943,7 +6211,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5943
6211
|
}, {
|
|
5944
6212
|
key: "renderViewObjectFileDialog",
|
|
5945
6213
|
value: function renderViewObjectFileDialog() {
|
|
5946
|
-
var
|
|
6214
|
+
var _this44 = this;
|
|
5947
6215
|
if (!this.state.viewFileDialog || !this.props.objectBrowserViewFile) {
|
|
5948
6216
|
return null;
|
|
5949
6217
|
}
|
|
@@ -5957,7 +6225,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5957
6225
|
t: this.props.t,
|
|
5958
6226
|
expertMode: this.state.filter.expertMode,
|
|
5959
6227
|
onClose: function onClose() {
|
|
5960
|
-
return
|
|
6228
|
+
return _this44.setState({
|
|
5961
6229
|
viewFileDialog: ''
|
|
5962
6230
|
});
|
|
5963
6231
|
}
|
|
@@ -5971,7 +6239,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5971
6239
|
}, {
|
|
5972
6240
|
key: "renderAliasEditorDialog",
|
|
5973
6241
|
value: function renderAliasEditorDialog() {
|
|
5974
|
-
var
|
|
6242
|
+
var _this45 = this;
|
|
5975
6243
|
if (!this.props.objectBrowserAliasEditor || !this.state.showAliasEditor) {
|
|
5976
6244
|
return null;
|
|
5977
6245
|
}
|
|
@@ -5986,35 +6254,46 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5986
6254
|
t: this.props.t,
|
|
5987
6255
|
expertMode: this.state.filter.expertMode,
|
|
5988
6256
|
onClose: function onClose() {
|
|
5989
|
-
return
|
|
6257
|
+
return _this45.setState({
|
|
5990
6258
|
showAliasEditor: ''
|
|
5991
6259
|
});
|
|
5992
6260
|
},
|
|
5993
|
-
onRedirect: function onRedirect(id) {
|
|
5994
|
-
return
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
6261
|
+
onRedirect: function onRedirect(id, timeout) {
|
|
6262
|
+
return setTimeout(function () {
|
|
6263
|
+
return _this45.onSelect(id, false, function () {
|
|
6264
|
+
return _this45.expandAllSelected(function () {
|
|
6265
|
+
_this45.scrollToItem(id);
|
|
6266
|
+
setTimeout(function () {
|
|
6267
|
+
return _this45.setState({
|
|
6268
|
+
editObjectDialog: id,
|
|
6269
|
+
showAliasEditor: false,
|
|
6270
|
+
editObjectAlias: true
|
|
6271
|
+
});
|
|
6272
|
+
}, 300);
|
|
6273
|
+
});
|
|
6274
|
+
});
|
|
6275
|
+
}, timeout || 0);
|
|
5999
6276
|
}
|
|
6000
6277
|
});
|
|
6001
6278
|
}
|
|
6002
6279
|
|
|
6003
6280
|
/**
|
|
6281
|
+
* Renders the right mouse button context menu
|
|
6282
|
+
*
|
|
6004
6283
|
* @private
|
|
6005
6284
|
* @returns {JSX.Element | null}
|
|
6006
6285
|
*/
|
|
6007
6286
|
}, {
|
|
6008
6287
|
key: "renderContextMenu",
|
|
6009
6288
|
value: function renderContextMenu() {
|
|
6010
|
-
var
|
|
6011
|
-
_obj$common6,
|
|
6012
|
-
_obj$common7,
|
|
6013
|
-
_obj$common8,
|
|
6289
|
+
var _this46 = this,
|
|
6014
6290
|
_obj$common9,
|
|
6015
6291
|
_obj$common10,
|
|
6016
|
-
|
|
6017
|
-
_obj$common12
|
|
6292
|
+
_obj$common11,
|
|
6293
|
+
_obj$common12,
|
|
6294
|
+
_obj$common13,
|
|
6295
|
+
_item$children6,
|
|
6296
|
+
_obj$common15;
|
|
6018
6297
|
if (!this.state.showContextMenu) {
|
|
6019
6298
|
return null;
|
|
6020
6299
|
}
|
|
@@ -6038,14 +6317,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6038
6317
|
var ITEMS = {
|
|
6039
6318
|
EDIT: {
|
|
6040
6319
|
key: '0',
|
|
6041
|
-
visibility: this.props.objectBrowserEditObject && obj,
|
|
6320
|
+
visibility: this.props.objectBrowserEditObject && obj && (this.state.filter.expertMode || this.isNonExpertId(id)),
|
|
6042
6321
|
icon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Edit, {
|
|
6043
6322
|
fontSize: "small",
|
|
6044
6323
|
className: this.props.classes.contextMenuEdit
|
|
6045
6324
|
}),
|
|
6046
6325
|
label: this.texts.editObject,
|
|
6047
6326
|
onClick: function onClick() {
|
|
6048
|
-
return
|
|
6327
|
+
return _this46.setState({
|
|
6049
6328
|
editObjectDialog: item.data.id,
|
|
6050
6329
|
showContextMenu: null,
|
|
6051
6330
|
editObjectAlias: false
|
|
@@ -6054,27 +6333,27 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6054
6333
|
},
|
|
6055
6334
|
EDIT_VALUE: {
|
|
6056
6335
|
key: '1',
|
|
6057
|
-
visibility: this.states && !this.props.notEditable && obj && obj.type === 'state' && ((_obj$
|
|
6336
|
+
visibility: this.states && !this.props.notEditable && obj && obj.type === 'state' && ((_obj$common9 = obj.common) === null || _obj$common9 === void 0 ? void 0 : _obj$common9.type) !== 'file' && (this.state.filter.expertMode || obj.common.write !== false),
|
|
6058
6337
|
icon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.FormatItalic, {
|
|
6059
6338
|
fontSize: "small",
|
|
6060
6339
|
className: this.props.classes.contextMenuEditValue
|
|
6061
6340
|
}),
|
|
6062
6341
|
label: this.props.t('ra_Edit value'),
|
|
6063
6342
|
onClick: function onClick() {
|
|
6064
|
-
|
|
6065
|
-
val:
|
|
6066
|
-
q:
|
|
6343
|
+
_this46.edit = {
|
|
6344
|
+
val: _this46.states[id] ? _this46.states[id].val : '',
|
|
6345
|
+
q: _this46.states[id] ? _this46.states[id].q || 0 : 0,
|
|
6067
6346
|
ack: false,
|
|
6068
6347
|
id: id
|
|
6069
6348
|
};
|
|
6070
|
-
|
|
6349
|
+
_this46.setState({
|
|
6071
6350
|
updateOpened: true,
|
|
6072
6351
|
showContextMenu: null
|
|
6073
6352
|
});
|
|
6074
6353
|
}
|
|
6075
6354
|
},
|
|
6076
6355
|
VIEW: {
|
|
6077
|
-
visibility: this.props.objectBrowserViewFile && obj && obj.type === 'state' && ((_obj$
|
|
6356
|
+
visibility: this.props.objectBrowserViewFile && obj && obj.type === 'state' && ((_obj$common10 = obj.common) === null || _obj$common10 === void 0 ? void 0 : _obj$common10.type) === 'file',
|
|
6078
6357
|
icon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.FindInPage, {
|
|
6079
6358
|
fontSize: "small",
|
|
6080
6359
|
className: this.props.classes.contextMenuView
|
|
@@ -6082,7 +6361,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6082
6361
|
className: '',
|
|
6083
6362
|
label: this.props.t('ra_View file'),
|
|
6084
6363
|
onClick: function onClick() {
|
|
6085
|
-
return
|
|
6364
|
+
return _this46.setState({
|
|
6086
6365
|
viewFileDialog: obj._id,
|
|
6087
6366
|
showContextMenu: null
|
|
6088
6367
|
});
|
|
@@ -6090,7 +6369,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6090
6369
|
},
|
|
6091
6370
|
CUSTOM: {
|
|
6092
6371
|
key: '2',
|
|
6093
|
-
visibility: this.props.objectCustomDialog && this.info.hasSomeCustoms && obj && obj.type === 'state' && ((_obj$
|
|
6372
|
+
visibility: this.props.objectCustomDialog && this.info.hasSomeCustoms && obj && obj.type === 'state' && ((_obj$common11 = obj.common) === null || _obj$common11 === void 0 ? void 0 : _obj$common11.type) !== 'file',
|
|
6094
6373
|
icon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Settings, {
|
|
6095
6374
|
fontSize: "small",
|
|
6096
6375
|
className: item.data.hasCustoms ? this.props.classes.cellButtonsButtonWithCustoms : this.props.classes.cellButtonsButtonWithoutCustoms
|
|
@@ -6098,9 +6377,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6098
6377
|
className: this.props.classes.contextMenuCustom,
|
|
6099
6378
|
label: this.texts.customConfig,
|
|
6100
6379
|
onClick: function onClick() {
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6380
|
+
_this46.pauseSubscribe(true);
|
|
6381
|
+
_this46.props.router && _this46.props.router.doNavigate(null, 'customs', id);
|
|
6382
|
+
_this46.setState({
|
|
6104
6383
|
customDialog: [id],
|
|
6105
6384
|
showContextMenu: null
|
|
6106
6385
|
});
|
|
@@ -6117,7 +6396,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6117
6396
|
className: this.props.classes.contextMenuACL,
|
|
6118
6397
|
label: this.props.t('ra_Edit ACL'),
|
|
6119
6398
|
onClick: function onClick() {
|
|
6120
|
-
return
|
|
6399
|
+
return _this46.setState({
|
|
6121
6400
|
showContextMenu: null,
|
|
6122
6401
|
modalEditOfAccess: true,
|
|
6123
6402
|
modalEditOfAccessObjData: item.data
|
|
@@ -6134,7 +6413,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6134
6413
|
className: '',
|
|
6135
6414
|
label: this.props.t('ra_Edit role'),
|
|
6136
6415
|
onClick: function onClick() {
|
|
6137
|
-
return
|
|
6416
|
+
return _this46.setState({
|
|
6138
6417
|
roleDialog: item.data.id,
|
|
6139
6418
|
showContextMenu: null
|
|
6140
6419
|
});
|
|
@@ -6150,8 +6429,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6150
6429
|
className: '',
|
|
6151
6430
|
label: this.props.t('ra_Edit function'),
|
|
6152
6431
|
onClick: function onClick() {
|
|
6153
|
-
var enums = findEnumsForObjectAsIds(
|
|
6154
|
-
|
|
6432
|
+
var enums = findEnumsForObjectAsIds(_this46.info, item.data.id, 'funcEnums');
|
|
6433
|
+
_this46.setState({
|
|
6155
6434
|
enumDialogEnums: enums,
|
|
6156
6435
|
enumDialog: {
|
|
6157
6436
|
item: item,
|
|
@@ -6172,8 +6451,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6172
6451
|
className: '',
|
|
6173
6452
|
label: this.props.t('ra_Edit room'),
|
|
6174
6453
|
onClick: function onClick() {
|
|
6175
|
-
var enums = findEnumsForObjectAsIds(
|
|
6176
|
-
|
|
6454
|
+
var enums = findEnumsForObjectAsIds(_this46.info, item.data.id, 'roomEnums');
|
|
6455
|
+
_this46.setState({
|
|
6177
6456
|
enumDialogEnums: enums,
|
|
6178
6457
|
enumDialog: {
|
|
6179
6458
|
item: item,
|
|
@@ -6186,22 +6465,22 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6186
6465
|
},
|
|
6187
6466
|
ALIAS: {
|
|
6188
6467
|
key: '7',
|
|
6189
|
-
visibility: !this.props.notEditable && this.props.objectBrowserAliasEditor && this.props.objectBrowserEditObject && this.state.filter.expertMode && obj && obj.type === 'state' && ((_obj$
|
|
6468
|
+
visibility: !this.props.notEditable && this.props.objectBrowserAliasEditor && this.props.objectBrowserEditObject && this.state.filter.expertMode && obj && obj.type === 'state' && ((_obj$common12 = obj.common) === null || _obj$common12 === void 0 ? void 0 : _obj$common12.type) !== 'file',
|
|
6190
6469
|
icon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Link, {
|
|
6191
|
-
className: obj !== null && obj !== void 0 && (_obj$
|
|
6470
|
+
className: obj !== null && obj !== void 0 && (_obj$common13 = obj.common) !== null && _obj$common13 !== void 0 && _obj$common13.alias ? this.props.classes.cellButtonsButtonWithCustoms : this.props.classes.cellButtonsButtonWithoutCustoms
|
|
6192
6471
|
}),
|
|
6193
6472
|
className: '',
|
|
6194
6473
|
label: this.props.t('ra_Edit alias'),
|
|
6195
6474
|
onClick: function onClick() {
|
|
6196
|
-
var _obj$
|
|
6197
|
-
if ((_obj$
|
|
6198
|
-
|
|
6475
|
+
var _obj$common14;
|
|
6476
|
+
if ((_obj$common14 = obj.common) !== null && _obj$common14 !== void 0 && _obj$common14.alias) {
|
|
6477
|
+
_this46.setState({
|
|
6199
6478
|
editObjectDialog: item.data.id,
|
|
6200
6479
|
showContextMenu: null,
|
|
6201
6480
|
editObjectAlias: true
|
|
6202
6481
|
});
|
|
6203
6482
|
} else {
|
|
6204
|
-
|
|
6483
|
+
_this46.setState({
|
|
6205
6484
|
showContextMenu: null,
|
|
6206
6485
|
showAliasEditor: item.data.id
|
|
6207
6486
|
});
|
|
@@ -6210,7 +6489,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6210
6489
|
},
|
|
6211
6490
|
DELETE: {
|
|
6212
6491
|
key: 'Delete',
|
|
6213
|
-
visibility: this.props.onObjectDelete && (((_item$
|
|
6492
|
+
visibility: this.props.onObjectDelete && (((_item$children6 = item.children) === null || _item$children6 === void 0 ? void 0 : _item$children6.length) || obj && !((_obj$common15 = obj.common) !== null && _obj$common15 !== void 0 && _obj$common15.dontDelete)),
|
|
6214
6493
|
icon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Delete, {
|
|
6215
6494
|
fontSize: "small",
|
|
6216
6495
|
className: this.props.classes.contextMenuDelete
|
|
@@ -6218,23 +6497,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6218
6497
|
className: this.props.classes.contextMenuDelete,
|
|
6219
6498
|
label: this.texts.deleteObject,
|
|
6220
6499
|
onClick: function onClick() {
|
|
6221
|
-
|
|
6500
|
+
return _this46.setState({
|
|
6222
6501
|
showContextMenu: null
|
|
6223
6502
|
}, function () {
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
var start = "".concat(id, ".");
|
|
6230
|
-
for (var i = 0; i < keys.length; i++) {
|
|
6231
|
-
if (keys[i].startsWith(start)) {
|
|
6232
|
-
count++;
|
|
6233
|
-
} else if (keys[i] > start) {
|
|
6234
|
-
break;
|
|
6235
|
-
}
|
|
6236
|
-
}
|
|
6237
|
-
_this47.props.onObjectDelete(id, !!((_item$children6 = item.children) !== null && _item$children6 !== void 0 && _item$children6.length), !((_obj$common13 = obj.common) !== null && _obj$common13 !== void 0 && _obj$common13.dontDelete), count + 1);
|
|
6503
|
+
return _this46.showDeleteDialog({
|
|
6504
|
+
id: id,
|
|
6505
|
+
obj: obj || {},
|
|
6506
|
+
item: item
|
|
6507
|
+
});
|
|
6238
6508
|
});
|
|
6239
6509
|
}
|
|
6240
6510
|
}
|
|
@@ -6249,13 +6519,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6249
6519
|
style: ITEMS[key].iconStyle,
|
|
6250
6520
|
className: ITEMS[key].listItemIconClass
|
|
6251
6521
|
}, ITEMS[key].icon), /*#__PURE__*/_react["default"].createElement(_material.ListItemText, null, ITEMS[key].label), ITEMS[key].key ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
6252
|
-
className:
|
|
6253
|
-
}, "Alt+".concat(ITEMS[key].key === 'Delete' ?
|
|
6522
|
+
className: _this46.props.classes.contextMenuKeys
|
|
6523
|
+
}, "Alt+".concat(ITEMS[key].key === 'Delete' ? _this46.props.t('ra_Del') : ITEMS[key].key)) : null));
|
|
6254
6524
|
}
|
|
6255
6525
|
});
|
|
6256
6526
|
if (!items.length) {
|
|
6257
6527
|
setTimeout(function () {
|
|
6258
|
-
return
|
|
6528
|
+
return _this46.setState({
|
|
6259
6529
|
showContextMenu: null
|
|
6260
6530
|
});
|
|
6261
6531
|
}, 100);
|
|
@@ -6277,10 +6547,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6277
6547
|
},
|
|
6278
6548
|
anchorEl: el,
|
|
6279
6549
|
onClose: function onClose() {
|
|
6280
|
-
|
|
6550
|
+
_this46.setState({
|
|
6281
6551
|
showContextMenu: null
|
|
6282
6552
|
});
|
|
6283
|
-
|
|
6553
|
+
_this46.contextMenu = null;
|
|
6284
6554
|
}
|
|
6285
6555
|
}, items);
|
|
6286
6556
|
}
|
|
@@ -6293,7 +6563,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6293
6563
|
key: "renderEditValueDialog",
|
|
6294
6564
|
value: function renderEditValueDialog() {
|
|
6295
6565
|
var _this$objects$this$ed,
|
|
6296
|
-
|
|
6566
|
+
_this47 = this;
|
|
6297
6567
|
if (!this.state.updateOpened || !this.props.objectBrowserValue) {
|
|
6298
6568
|
return null;
|
|
6299
6569
|
}
|
|
@@ -6306,11 +6576,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6306
6576
|
return null;
|
|
6307
6577
|
}
|
|
6308
6578
|
var type = (_this$objects$this$ed = this.objects[this.edit.id].common) !== null && _this$objects$this$ed !== void 0 && _this$objects$this$ed.type ? this.objects[this.edit.id].common.type : (0, _typeof2["default"])(this.edit.val);
|
|
6579
|
+
var role = this.objects[this.edit.id].common.role;
|
|
6309
6580
|
var ObjectBrowserValue = this.props.objectBrowserValue;
|
|
6310
6581
|
return /*#__PURE__*/_react["default"].createElement(ObjectBrowserValue, {
|
|
6311
6582
|
t: this.props.t,
|
|
6312
6583
|
lang: this.props.lang,
|
|
6313
6584
|
type: type,
|
|
6585
|
+
role: role,
|
|
6314
6586
|
states: _Utils["default"].getStates(this.objects[this.edit.id]),
|
|
6315
6587
|
themeType: this.props.themeType,
|
|
6316
6588
|
expertMode: this.state.filter.expertMode,
|
|
@@ -6320,10 +6592,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6320
6592
|
defaultHistory: this.defaultHistory,
|
|
6321
6593
|
dateFormat: this.props.dateFormat,
|
|
6322
6594
|
onClose: function onClose(res) {
|
|
6323
|
-
|
|
6595
|
+
_this47.setState({
|
|
6324
6596
|
updateOpened: false
|
|
6325
6597
|
});
|
|
6326
|
-
res &&
|
|
6598
|
+
res && _this47.onUpdate(res);
|
|
6327
6599
|
}
|
|
6328
6600
|
});
|
|
6329
6601
|
}
|
|
@@ -6335,7 +6607,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6335
6607
|
}, {
|
|
6336
6608
|
key: "render",
|
|
6337
6609
|
value: function render() {
|
|
6338
|
-
var
|
|
6610
|
+
var _this48 = this;
|
|
6339
6611
|
this.recordStates = [];
|
|
6340
6612
|
this.unsubscribeTimer && clearTimeout(this.unsubscribeTimer);
|
|
6341
6613
|
|
|
@@ -6348,13 +6620,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6348
6620
|
applyFilter(this.root, this.state.filter, this.props.lang, this.objects, null, counter, this.props.customFilter, this.props.types);
|
|
6349
6621
|
if (counter.count < 500 && !this.state.expandAllVisible) {
|
|
6350
6622
|
setTimeout(function () {
|
|
6351
|
-
return
|
|
6623
|
+
return _this48.setState({
|
|
6352
6624
|
expandAllVisible: true
|
|
6353
6625
|
});
|
|
6354
6626
|
});
|
|
6355
6627
|
} else if (counter.count >= 500 && this.state.expandAllVisible) {
|
|
6356
6628
|
setTimeout(function () {
|
|
6357
|
-
return
|
|
6629
|
+
return _this48.setState({
|
|
6358
6630
|
expandAllVisible: false
|
|
6359
6631
|
});
|
|
6360
6632
|
});
|
|
@@ -6362,8 +6634,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6362
6634
|
this.lastAppliedFilter = jsonFilter;
|
|
6363
6635
|
}
|
|
6364
6636
|
this.unsubscribeTimer = setTimeout(function () {
|
|
6365
|
-
|
|
6366
|
-
|
|
6637
|
+
_this48.unsubscribeTimer = null;
|
|
6638
|
+
_this48.checkUnsubscribes();
|
|
6367
6639
|
}, 200);
|
|
6368
6640
|
if (!this.state.loaded) {
|
|
6369
6641
|
return /*#__PURE__*/_react["default"].createElement(_material.CircularProgress, {
|
|
@@ -6373,17 +6645,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6373
6645
|
var classes = this.props.classes;
|
|
6374
6646
|
var items = this.renderItem(this.root, undefined, classes);
|
|
6375
6647
|
return /*#__PURE__*/_react["default"].createElement(_TabContainer["default"], {
|
|
6376
|
-
key: this.props.dialogName
|
|
6377
|
-
|
|
6648
|
+
key: this.props.dialogName
|
|
6649
|
+
}, /*#__PURE__*/_react["default"].createElement(_TabHeader["default"], null, this.getToolbar()), /*#__PURE__*/_react["default"].createElement(_TabContent["default"], null, this.renderHeader(), /*#__PURE__*/_react["default"].createElement("div", {
|
|
6650
|
+
className: this.props.classes.tableDiv,
|
|
6651
|
+
ref: this.tableRef,
|
|
6378
6652
|
onKeyDown: function onKeyDown(event) {
|
|
6379
|
-
return
|
|
6653
|
+
return _this48.navigateKeyPress(event);
|
|
6380
6654
|
},
|
|
6381
6655
|
tabIndex: 0
|
|
6382
|
-
}, /*#__PURE__*/_react["default"].createElement(_TabHeader["default"], null, this.getToolbar()), /*#__PURE__*/_react["default"].createElement(_TabContent["default"], {
|
|
6383
|
-
classes: {}
|
|
6384
|
-
}, this.renderHeader(), /*#__PURE__*/_react["default"].createElement("div", {
|
|
6385
|
-
className: this.props.classes.tableDiv,
|
|
6386
|
-
ref: this.tableRef
|
|
6387
6656
|
}, items)), this.renderContextMenu(), this.renderToast(), this.renderColumnsEditCustomDialog(), this.renderColumnsSelectorDialog(), this.renderCustomDialog(), this.renderEditValueDialog(), this.renderEditObjectDialog(), this.renderViewObjectFileDialog(), this.renderAliasEditorDialog(), 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));
|
|
6388
6657
|
}
|
|
6389
6658
|
}], [{
|
|
@@ -6484,8 +6753,12 @@ ObjectBrowser.defaultProps = {
|
|
|
6484
6753
|
objectStatesView: false,
|
|
6485
6754
|
objectImportExport: false,
|
|
6486
6755
|
objectEditOfAccessControl: false,
|
|
6487
|
-
modalNewObject: function modalNewObject() {
|
|
6488
|
-
|
|
6756
|
+
modalNewObject: function modalNewObject() {
|
|
6757
|
+
return undefined;
|
|
6758
|
+
},
|
|
6759
|
+
modalEditOfAccessControl: function modalEditOfAccessControl() {
|
|
6760
|
+
return undefined;
|
|
6761
|
+
}
|
|
6489
6762
|
};
|
|
6490
6763
|
ObjectBrowser.propTypes = {
|
|
6491
6764
|
dialogName: _propTypes["default"].string,
|
|
@@ -6556,7 +6829,7 @@ ObjectBrowser.propTypes = {
|
|
|
6556
6829
|
// optional ['name', 'type', 'role', 'room', 'func', 'val', 'buttons']
|
|
6557
6830
|
// eslint-disable-next-line react/no-unused-prop-types
|
|
6558
6831
|
root: _propTypes["default"].string,
|
|
6559
|
-
// optional
|
|
6832
|
+
// optional. Shows only elements of this root
|
|
6560
6833
|
|
|
6561
6834
|
objectsWorker: _propTypes["default"].object,
|
|
6562
6835
|
// optional cache of objects
|