@iobroker/adapter-react-v5 2.1.7 → 2.1.11
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/404.js +17 -25
- package/Components/404.js.map +1 -1
- package/Components/ColorPicker.js +25 -35
- package/Components/ColorPicker.js.map +1 -1
- package/Components/ComplexCron.js +29 -37
- package/Components/ComplexCron.js.map +1 -1
- package/Components/FileBrowser.js +281 -276
- package/Components/FileBrowser.js.map +1 -1
- package/Components/FileViewer.js +230 -96
- package/Components/FileViewer.js.map +1 -1
- package/Components/Icon.js +15 -25
- package/Components/Icon.js.map +1 -1
- package/Components/IconPicker.js +6 -6
- package/Components/IconPicker.js.map +1 -1
- package/Components/IconSelector.js +25 -31
- package/Components/IconSelector.js.map +1 -1
- package/Components/Image.js +15 -25
- package/Components/Image.js.map +1 -1
- package/Components/Loader.js +14 -24
- package/Components/Loader.js.map +1 -1
- package/Components/Loaders/PT.js +13 -23
- package/Components/Loaders/PT.js.map +1 -1
- package/Components/Loaders/Vendor.js +14 -24
- package/Components/Loaders/Vendor.js.map +1 -1
- package/Components/Logo.js +15 -25
- package/Components/Logo.js.map +1 -1
- package/Components/MDUtils.js +14 -11
- package/Components/MDUtils.js.map +1 -1
- package/Components/ObjectBrowser.js +127 -210
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/Router.js +13 -21
- package/Components/Router.js.map +1 -1
- package/Components/SaveCloseButtons.js +15 -25
- package/Components/SaveCloseButtons.js.map +1 -1
- package/Components/Schedule.js +23 -37
- package/Components/Schedule.js.map +1 -1
- package/Components/SelectWithIcon.js +17 -25
- package/Components/SelectWithIcon.js.map +1 -1
- package/Components/SimpleCron/cronText.js +2 -2
- package/Components/SimpleCron/cronText.js.map +1 -1
- package/Components/SimpleCron/index.js +24 -34
- package/Components/SimpleCron/index.js.map +1 -1
- package/Components/TabContainer.js +18 -28
- package/Components/TabContainer.js.map +1 -1
- package/Components/TabContent.js +17 -27
- package/Components/TabContent.js.map +1 -1
- package/Components/TabHeader.js +13 -23
- package/Components/TabHeader.js.map +1 -1
- package/Components/TextWithIcon.js +5 -5
- package/Components/TextWithIcon.js.map +1 -1
- package/Components/ToggleThemeMenu.js +2 -2
- package/Components/ToggleThemeMenu.js.map +1 -1
- package/Components/TreeTable.js +21 -42
- package/Components/TreeTable.js.map +1 -1
- package/Components/Utils.js +56 -42
- package/Components/Utils.js.map +1 -1
- package/Components/withWidth.js +42 -0
- package/Components/withWidth.js.map +1 -0
- package/Connection.js +15 -22
- package/Connection.js.map +1 -1
- package/Dialogs/ComplexCron.js +15 -25
- package/Dialogs/ComplexCron.js.map +1 -1
- package/Dialogs/Confirm.js +15 -25
- package/Dialogs/Confirm.js.map +1 -1
- package/Dialogs/Cron.js +19 -27
- package/Dialogs/Cron.js.map +1 -1
- package/Dialogs/Error.js +15 -25
- package/Dialogs/Error.js.map +1 -1
- package/Dialogs/Message.js +15 -25
- package/Dialogs/Message.js.map +1 -1
- package/Dialogs/SelectID.js +19 -27
- package/Dialogs/SelectID.js.map +1 -1
- package/Dialogs/SimpleCron.js +15 -25
- package/Dialogs/SimpleCron.js.map +1 -1
- package/Dialogs/TextInput.js +18 -28
- package/Dialogs/TextInput.js.map +1 -1
- package/GenericApp.js +37 -49
- package/GenericApp.js.map +1 -1
- package/README.md +12 -1
- package/Theme.js +2 -2
- package/Theme.js.map +1 -1
- package/i18n.js +10 -14
- package/i18n.js.map +1 -1
- package/icons/IconAdapter.js +2 -2
- package/icons/IconAdapter.js.map +1 -1
- package/icons/IconAlias.js +2 -2
- package/icons/IconAlias.js.map +1 -1
- package/icons/IconChannel.js +2 -2
- package/icons/IconChannel.js.map +1 -1
- package/icons/IconClearFilter.js +2 -2
- package/icons/IconClearFilter.js.map +1 -1
- package/icons/IconClosed.js +2 -2
- package/icons/IconClosed.js.map +1 -1
- package/icons/IconCopy.js +2 -2
- package/icons/IconCopy.js.map +1 -1
- package/icons/IconDevice.js +2 -2
- package/icons/IconDevice.js.map +1 -1
- package/icons/IconDocument.js +2 -2
- package/icons/IconDocument.js.map +1 -1
- package/icons/IconExpert.js +2 -2
- package/icons/IconExpert.js.map +1 -1
- package/icons/IconFx.js +2 -2
- package/icons/IconFx.js.map +1 -1
- package/icons/IconInstance.js +2 -2
- package/icons/IconInstance.js.map +1 -1
- package/icons/IconLogout.js +2 -2
- package/icons/IconLogout.js.map +1 -1
- package/icons/IconOpen.js +2 -2
- package/icons/IconOpen.js.map +1 -1
- package/icons/IconState.js +6 -6
- package/icons/IconState.js.map +1 -1
- package/package.json +10 -10
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
3
7
|
Object.defineProperty(exports, "__esModule", {
|
|
4
8
|
value: true
|
|
5
9
|
});
|
|
6
10
|
exports["default"] = void 0;
|
|
7
11
|
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
|
|
14
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
+
|
|
16
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
|
+
|
|
18
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
+
|
|
20
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
+
|
|
22
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
23
|
+
|
|
24
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
25
|
+
|
|
26
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
+
|
|
28
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
+
|
|
30
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
|
+
|
|
32
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
33
|
+
|
|
8
34
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
35
|
|
|
10
36
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -13,10 +39,6 @@ var _copyToClipboard = _interopRequireDefault(require("./copy-to-clipboard"));
|
|
|
13
39
|
|
|
14
40
|
var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
|
|
15
41
|
|
|
16
|
-
var _styles = require("@mui/material/styles");
|
|
17
|
-
|
|
18
|
-
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
|
19
|
-
|
|
20
42
|
var _reactInlinesvg = _interopRequireDefault(require("react-inlinesvg"));
|
|
21
43
|
|
|
22
44
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
@@ -161,82 +183,20 @@ var _TabContent = _interopRequireDefault(require("./TabContent"));
|
|
|
161
183
|
|
|
162
184
|
var _TabHeader = _interopRequireDefault(require("./TabHeader"));
|
|
163
185
|
|
|
164
|
-
|
|
186
|
+
var _withWidth = _interopRequireDefault(require("./withWidth"));
|
|
165
187
|
|
|
166
188
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
167
189
|
|
|
168
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
190
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
169
191
|
|
|
170
192
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
171
193
|
|
|
172
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
173
|
-
|
|
174
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
175
|
-
|
|
176
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
177
|
-
|
|
178
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
179
|
-
|
|
180
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
181
|
-
|
|
182
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
183
|
-
|
|
184
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
185
|
-
|
|
186
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
194
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
187
195
|
|
|
188
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super =
|
|
189
|
-
|
|
190
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
191
|
-
|
|
192
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
196
|
+
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); }; }
|
|
193
197
|
|
|
194
198
|
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; } }
|
|
195
199
|
|
|
196
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
197
|
-
|
|
198
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
199
|
-
|
|
200
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
201
|
-
|
|
202
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
203
|
-
|
|
204
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
205
|
-
|
|
206
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
207
|
-
|
|
208
|
-
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); }
|
|
209
|
-
|
|
210
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
211
|
-
|
|
212
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
213
|
-
|
|
214
|
-
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; }
|
|
215
|
-
|
|
216
|
-
function useWidth() {
|
|
217
|
-
var theme = (0, _styles.useTheme)();
|
|
218
|
-
|
|
219
|
-
var keys = _toConsumableArray(theme.breakpoints.keys).reverse();
|
|
220
|
-
|
|
221
|
-
return keys.reduce(function (output, key) {
|
|
222
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
223
|
-
var matches = (0, _useMediaQuery["default"])(theme.breakpoints.up(key));
|
|
224
|
-
return !output && matches ? key : output;
|
|
225
|
-
}, null) || 'xs';
|
|
226
|
-
} // FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
var withWidth = function withWidth() {
|
|
230
|
-
return function (WrappedComponent) {
|
|
231
|
-
return function (props) {
|
|
232
|
-
var width = useWidth();
|
|
233
|
-
return /*#__PURE__*/_react["default"].createElement(WrappedComponent, _extends({}, props, {
|
|
234
|
-
width: width
|
|
235
|
-
}));
|
|
236
|
-
};
|
|
237
|
-
};
|
|
238
|
-
};
|
|
239
|
-
|
|
240
200
|
var ICON_SIZE = 24;
|
|
241
201
|
var ROW_HEIGHT = 32;
|
|
242
202
|
var ITEM_LEVEL = 16;
|
|
@@ -345,7 +305,7 @@ var styles = function styles(theme) {
|
|
|
345
305
|
paddingTop: 0,
|
|
346
306
|
//theme.spacing(1),
|
|
347
307
|
paddingLeft: 0,
|
|
348
|
-
width: "calc(100% - ".concat(theme.spacing(1), "
|
|
308
|
+
width: "calc(100% - ".concat(theme.spacing(1), ")"),
|
|
349
309
|
height: "calc(100% - 38px)",
|
|
350
310
|
overflow: 'auto'
|
|
351
311
|
},
|
|
@@ -625,6 +585,7 @@ var styles = function styles(theme) {
|
|
|
625
585
|
opacity: 1
|
|
626
586
|
},
|
|
627
587
|
paddingTop: 0,
|
|
588
|
+
paddingLeft: 0,
|
|
628
589
|
marginTop: -2
|
|
629
590
|
},
|
|
630
591
|
cellButtonsEmptyButton: {
|
|
@@ -658,7 +619,7 @@ var styles = function styles(theme) {
|
|
|
658
619
|
cursor: 'pointer'
|
|
659
620
|
},
|
|
660
621
|
cellButtonsValueButtonEdit: {
|
|
661
|
-
right: SMALL_BUTTON_SIZE / 2 + theme.spacing(2)
|
|
622
|
+
right: SMALL_BUTTON_SIZE / 2 + parseInt(theme.spacing(2), 10)
|
|
662
623
|
},
|
|
663
624
|
filteredOut: {
|
|
664
625
|
opacity: 0.5
|
|
@@ -864,7 +825,8 @@ function binarySearch(list, find, _start, _end) {
|
|
|
864
825
|
}
|
|
865
826
|
}
|
|
866
827
|
|
|
867
|
-
function applyFilter(item, filters, lang, objects, context, counter, customFilter, selectedTypes) {
|
|
828
|
+
function applyFilter(item, filters, lang, objects, context, counter, customFilter, selectedTypes, _depth) {
|
|
829
|
+
_depth = _depth || 0;
|
|
868
830
|
var filteredOut = false;
|
|
869
831
|
|
|
870
832
|
if (!context) {
|
|
@@ -980,9 +942,9 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
980
942
|
data.visible = !filteredOut;
|
|
981
943
|
data.hasVisibleChildren = false;
|
|
982
944
|
|
|
983
|
-
if (item.children) {
|
|
945
|
+
if (item.children && _depth < 20) {
|
|
984
946
|
item.children.forEach(function (_item) {
|
|
985
|
-
var visible = applyFilter(_item, filters, lang, objects, context, counter, customFilter, selectedTypes);
|
|
947
|
+
var visible = applyFilter(_item, filters, lang, objects, context, counter, customFilter, selectedTypes, _depth + 1);
|
|
986
948
|
|
|
987
949
|
if (visible) {
|
|
988
950
|
data.hasVisibleChildren = true;
|
|
@@ -1318,7 +1280,7 @@ function findNode(root, id, _parts, _path, _level) {
|
|
|
1318
1280
|
}
|
|
1319
1281
|
|
|
1320
1282
|
function getName(name, lang) {
|
|
1321
|
-
if (name &&
|
|
1283
|
+
if (name && (0, _typeof2["default"])(name) === 'object') {
|
|
1322
1284
|
return (name[lang] || name.en || '').toString();
|
|
1323
1285
|
} else {
|
|
1324
1286
|
return (name || '').toString();
|
|
@@ -1457,49 +1419,18 @@ function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
|
|
|
1457
1419
|
var isCommon = obj.common;
|
|
1458
1420
|
var valText = {};
|
|
1459
1421
|
var v = isCommon && isCommon.type === 'file' ? '[file]' : !state || state.val === null ? '(null)' : state.val === undefined ? '[undef]' : state.val;
|
|
1460
|
-
|
|
1461
|
-
var type = _typeof(v);
|
|
1422
|
+
var type = (0, _typeof2["default"])(v);
|
|
1462
1423
|
|
|
1463
1424
|
if (isCommon && isCommon.role && typeof isCommon.role === 'string' && isCommon.role.match(/^value\.time|^date/)) {
|
|
1464
1425
|
if (v && typeof v === 'string') {
|
|
1465
1426
|
if (v.length === 13) {
|
|
1466
1427
|
// (length of "1647597254924") warning, this solution only works till Nov 20 2286 18:46:39CET
|
|
1467
1428
|
v = new Date(parseInt(v, 10)).toString();
|
|
1468
|
-
} else
|
|
1469
|
-
// YYYY.MM.DD
|
|
1470
|
-
var parts = v.split(/[-.]/);
|
|
1471
|
-
|
|
1472
|
-
if (parts.length === 3) {
|
|
1473
|
-
if (parts[0].length === 4) {
|
|
1474
|
-
// YYYY.MM.DD
|
|
1475
|
-
v = new Date(parseInt(parts[0], 10), parseInt(parts[1], 10) + 1, parseInt(parts[2], 10));
|
|
1476
|
-
} else if (parts[0].length === 4) {
|
|
1477
|
-
// DD.MM.YYYY
|
|
1478
|
-
v = new Date(parseInt(parts[2], 10), parseInt(parts[1], 10) + 1, parseInt(parts[0], 10));
|
|
1479
|
-
}
|
|
1480
|
-
} else {
|
|
1481
|
-
v = new Date(v).toString(); // Let the browser convert it somehow
|
|
1482
|
-
}
|
|
1483
|
-
} else if (v.length === 8) {
|
|
1484
|
-
// YY.MM.DD
|
|
1485
|
-
var _parts2 = v.split(/[-.]/);
|
|
1486
|
-
|
|
1487
|
-
if (_parts2.length === 3) {
|
|
1488
|
-
v = new Date(parseInt(_parts2[0], 10), parseInt(_parts2[1], 10) + 1, parseInt(_parts2[2], 10));
|
|
1489
|
-
} else {
|
|
1490
|
-
v = new Date(v).toString(); // Let the browser convert it somehow
|
|
1491
|
-
}
|
|
1492
|
-
} else {
|
|
1493
|
-
v = new Date(v).toString(); // Let the browser convert it somehow
|
|
1429
|
+
} else {// we don't know what is that, so leave it as it is
|
|
1494
1430
|
}
|
|
1495
1431
|
} else {
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
} else if (v === undefined) {
|
|
1499
|
-
v = 'undefined';
|
|
1500
|
-
} else {
|
|
1501
|
-
v = v ? new Date(v).toString() : v;
|
|
1502
|
-
}
|
|
1432
|
+
// null and undefined could not be here. See `let v = (isCommon && isCommon.type === 'file') ....` above
|
|
1433
|
+
v = v ? new Date(v).toString() : v;
|
|
1503
1434
|
}
|
|
1504
1435
|
} else {
|
|
1505
1436
|
if (type === 'number') {
|
|
@@ -1517,11 +1448,12 @@ function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
|
|
|
1517
1448
|
if (typeof v !== 'string') {
|
|
1518
1449
|
v = v.toString();
|
|
1519
1450
|
}
|
|
1520
|
-
}
|
|
1451
|
+
} // try to replace number with "common.states"
|
|
1452
|
+
|
|
1521
1453
|
|
|
1522
1454
|
if (states && states[v] !== undefined) {
|
|
1523
1455
|
valText.s = v;
|
|
1524
|
-
v = states[
|
|
1456
|
+
v = states[v];
|
|
1525
1457
|
}
|
|
1526
1458
|
|
|
1527
1459
|
var valFull;
|
|
@@ -1536,7 +1468,7 @@ function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
|
|
|
1536
1468
|
}];
|
|
1537
1469
|
|
|
1538
1470
|
if (state) {
|
|
1539
|
-
if (state.ack !== undefined) {
|
|
1471
|
+
if (state.ack !== undefined && state.ack !== null) {
|
|
1540
1472
|
valFull.push({
|
|
1541
1473
|
t: texts.ack,
|
|
1542
1474
|
v: state.ack.toString()
|
|
@@ -1868,7 +1800,7 @@ var objectsAlreadyLoaded = false;
|
|
|
1868
1800
|
*/
|
|
1869
1801
|
|
|
1870
1802
|
var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
1871
|
-
|
|
1803
|
+
(0, _inherits2["default"])(ObjectBrowser, _Component);
|
|
1872
1804
|
|
|
1873
1805
|
var _super = _createSuper(ObjectBrowser);
|
|
1874
1806
|
|
|
@@ -1878,11 +1810,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
1878
1810
|
function ObjectBrowser(props) {
|
|
1879
1811
|
var _this;
|
|
1880
1812
|
|
|
1881
|
-
|
|
1882
|
-
|
|
1813
|
+
(0, _classCallCheck2["default"])(this, ObjectBrowser);
|
|
1883
1814
|
_this = _super.call(this, props);
|
|
1884
|
-
|
|
1885
|
-
_defineProperty(_assertThisInitialized(_this), "onStateChange", function (id, state) {
|
|
1815
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onStateChange", function (id, state) {
|
|
1886
1816
|
console.log('> stateChange ' + id);
|
|
1887
1817
|
|
|
1888
1818
|
if (_this.states[id]) {
|
|
@@ -1910,8 +1840,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
1910
1840
|
}
|
|
1911
1841
|
}
|
|
1912
1842
|
});
|
|
1913
|
-
|
|
1914
|
-
_defineProperty(_assertThisInitialized(_this), "onObjectChange", function (id, obj, oldObj) {
|
|
1843
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onObjectChange", function (id, obj, oldObj) {
|
|
1915
1844
|
var newState;
|
|
1916
1845
|
|
|
1917
1846
|
if (Array.isArray(id)) {
|
|
@@ -1954,8 +1883,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
1954
1883
|
return;
|
|
1955
1884
|
}
|
|
1956
1885
|
|
|
1957
|
-
;
|
|
1958
|
-
|
|
1959
1886
|
if (id.startsWith('system.adapter.') && obj && obj.type === 'adapter') {
|
|
1960
1887
|
var columnsForAdmin = JSON.parse(JSON.stringify(_this.state.columnsForAdmin));
|
|
1961
1888
|
|
|
@@ -2000,8 +1927,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2000
1927
|
}, 500);
|
|
2001
1928
|
}
|
|
2002
1929
|
});
|
|
2003
|
-
|
|
2004
|
-
_defineProperty(_assertThisInitialized(_this), "getEnumsForId", function (id) {
|
|
1930
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getEnumsForId", function (id) {
|
|
2005
1931
|
var result = [];
|
|
2006
1932
|
|
|
2007
1933
|
_this.info.enums.forEach(function (_id) {
|
|
@@ -2027,12 +1953,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2027
1953
|
|
|
2028
1954
|
return result.length ? result : undefined;
|
|
2029
1955
|
});
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(enums, objId) {
|
|
1956
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_createAllEnums", /*#__PURE__*/function () {
|
|
1957
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(enums, objId) {
|
|
2033
1958
|
var e, _enObj$common, _enObj$common$members, id, _enObj, enObj;
|
|
2034
1959
|
|
|
2035
|
-
return
|
|
1960
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
2036
1961
|
while (1) {
|
|
2037
1962
|
switch (_context.prev = _context.next) {
|
|
2038
1963
|
case 0:
|
|
@@ -2047,7 +1972,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2047
1972
|
id = enums[e];
|
|
2048
1973
|
_enObj = void 0;
|
|
2049
1974
|
|
|
2050
|
-
if (
|
|
1975
|
+
if ((0, _typeof2["default"])(id) === 'object') {
|
|
2051
1976
|
_enObj = id;
|
|
2052
1977
|
id = id._id;
|
|
2053
1978
|
}
|
|
@@ -2107,11 +2032,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2107
2032
|
return _ref.apply(this, arguments);
|
|
2108
2033
|
};
|
|
2109
2034
|
}());
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(objs) {
|
|
2035
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "loadObjects", /*#__PURE__*/function () {
|
|
2036
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(objs) {
|
|
2113
2037
|
var id, obj, enums, state;
|
|
2114
|
-
return
|
|
2038
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
2115
2039
|
while (1) {
|
|
2116
2040
|
switch (_context2.prev = _context2.next) {
|
|
2117
2041
|
case 0:
|
|
@@ -2120,7 +2044,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2120
2044
|
break;
|
|
2121
2045
|
}
|
|
2122
2046
|
|
|
2123
|
-
_context2.t0 =
|
|
2047
|
+
_context2.t0 = _regenerator["default"].keys(objs);
|
|
2124
2048
|
|
|
2125
2049
|
case 2:
|
|
2126
2050
|
if ((_context2.t1 = _context2.t0()).done) {
|
|
@@ -2228,17 +2152,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2228
2152
|
return _ref2.apply(this, arguments);
|
|
2229
2153
|
};
|
|
2230
2154
|
}());
|
|
2231
|
-
|
|
2232
|
-
_defineProperty(_assertThisInitialized(_this), "handleJsonUpload", function (evt) {
|
|
2155
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleJsonUpload", function (evt) {
|
|
2233
2156
|
var f = evt.target.files[0];
|
|
2234
2157
|
|
|
2235
2158
|
if (f) {
|
|
2236
2159
|
var r = new FileReader();
|
|
2237
2160
|
|
|
2238
2161
|
r.onload = /*#__PURE__*/function () {
|
|
2239
|
-
var _ref3 =
|
|
2162
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(e) {
|
|
2240
2163
|
var contents, json, len, id, enums, state;
|
|
2241
|
-
return
|
|
2164
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
2242
2165
|
while (1) {
|
|
2243
2166
|
switch (_context3.prev = _context3.next) {
|
|
2244
2167
|
case 0:
|
|
@@ -2346,8 +2269,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2346
2269
|
window.alert(_this.props.t('ra_Failed to open JSON File'));
|
|
2347
2270
|
}
|
|
2348
2271
|
});
|
|
2349
|
-
|
|
2350
|
-
_defineProperty(_assertThisInitialized(_this), "toolTipObjectCreating", function () {
|
|
2272
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toolTipObjectCreating", function () {
|
|
2351
2273
|
var _this$objects$id2;
|
|
2352
2274
|
|
|
2353
2275
|
var t = _this.props.t;
|
|
@@ -2380,7 +2302,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2380
2302
|
var id = _this.state.selected[0] || _this.state.selectedNonObject;
|
|
2381
2303
|
|
|
2382
2304
|
if (id.split('.').length < 2 || _this.objects[id] && ((_this$objects$id = _this.objects[id]) === null || _this$objects$id === void 0 ? void 0 : _this$objects$id.type) === 'state') {} else {
|
|
2383
|
-
if (_this.
|
|
2305
|
+
if (_this.state.filter.expertMode) {
|
|
2384
2306
|
switch ((_this$objects$id2 = _this.objects[id]) === null || _this$objects$id2 === void 0 ? void 0 : _this$objects$id2.type) {
|
|
2385
2307
|
case 'device':
|
|
2386
2308
|
value = [/*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -2427,8 +2349,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2427
2349
|
|
|
2428
2350
|
return value.length ? value : t('ra_Add new child object to selected parent');
|
|
2429
2351
|
});
|
|
2430
|
-
|
|
2431
|
-
_defineProperty(_assertThisInitialized(_this), "renderTooltipAccessControl", function (acl) {
|
|
2352
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderTooltipAccessControl", function (acl) {
|
|
2432
2353
|
// acl ={object,state,owner,ownerGroup}
|
|
2433
2354
|
if (!acl) {
|
|
2434
2355
|
return null;
|
|
@@ -2499,25 +2420,22 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2499
2420
|
return el;
|
|
2500
2421
|
})) : '';
|
|
2501
2422
|
});
|
|
2502
|
-
|
|
2503
|
-
_defineProperty(_assertThisInitialized(_this), "extendObject", function (id, data) {
|
|
2423
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "extendObject", function (id, data) {
|
|
2504
2424
|
return _this.props.socket.extendObject(id, data)["catch"](function (error) {
|
|
2505
2425
|
return window.alert(error);
|
|
2506
2426
|
});
|
|
2507
2427
|
});
|
|
2508
|
-
|
|
2509
|
-
_defineProperty(_assertThisInitialized(_this), "setObject", function (id, data) {
|
|
2428
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setObject", function (id, data) {
|
|
2510
2429
|
return _this.props.socket.setObject(id, data)["catch"](function (error) {
|
|
2511
2430
|
return window.alert(error);
|
|
2512
2431
|
});
|
|
2513
2432
|
});
|
|
2514
|
-
|
|
2515
2433
|
_this.lastSelectedItems = window.localStorage.getItem("".concat(props.dialogName || 'App', ".objectSelected")) || '[]';
|
|
2516
2434
|
|
|
2517
2435
|
try {
|
|
2518
2436
|
_this.lastSelectedItems = JSON.parse(_this.lastSelectedItems);
|
|
2519
2437
|
|
|
2520
|
-
if (
|
|
2438
|
+
if ((0, _typeof2["default"])(_this.lastSelectedItems) !== 'object') {
|
|
2521
2439
|
_this.lastSelectedItems = [_this.lastSelectedItems];
|
|
2522
2440
|
}
|
|
2523
2441
|
|
|
@@ -2581,7 +2499,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2581
2499
|
|
|
2582
2500
|
var selected = props.selected || '';
|
|
2583
2501
|
|
|
2584
|
-
if (
|
|
2502
|
+
if ((0, _typeof2["default"])(selected) !== 'object') {
|
|
2585
2503
|
selected = [selected];
|
|
2586
2504
|
}
|
|
2587
2505
|
|
|
@@ -2707,7 +2625,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2707
2625
|
return _this;
|
|
2708
2626
|
}
|
|
2709
2627
|
|
|
2710
|
-
|
|
2628
|
+
(0, _createClass2["default"])(ObjectBrowser, [{
|
|
2711
2629
|
key: "loadAllObjects",
|
|
2712
2630
|
value: function loadAllObjects(update) {
|
|
2713
2631
|
var _this2 = this;
|
|
@@ -2827,8 +2745,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2827
2745
|
}, {
|
|
2828
2746
|
key: "expandAllSelected",
|
|
2829
2747
|
value: function expandAllSelected(cb) {
|
|
2830
|
-
var expanded =
|
|
2831
|
-
|
|
2748
|
+
var expanded = (0, _toConsumableArray2["default"])(this.state.expanded);
|
|
2832
2749
|
var changed = false;
|
|
2833
2750
|
this.state.selected.forEach(function (id) {
|
|
2834
2751
|
var parts = id.split('.');
|
|
@@ -2864,7 +2781,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2864
2781
|
value: function onAfterSelect(isDouble) {
|
|
2865
2782
|
var _this3 = this;
|
|
2866
2783
|
|
|
2867
|
-
this.lastSelectedItems =
|
|
2784
|
+
this.lastSelectedItems = (0, _toConsumableArray2["default"])(this.state.selected);
|
|
2868
2785
|
|
|
2869
2786
|
if (this.state.selected && this.state.selected.length) {
|
|
2870
2787
|
window.localStorage.setItem("".concat(this.props.dialogName || 'App', ".objectSelected"), JSON.stringify(this.lastSelectedItems));
|
|
@@ -3001,7 +2918,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3001
2918
|
key: "showError",
|
|
3002
2919
|
value: function showError(error) {
|
|
3003
2920
|
this.setState({
|
|
3004
|
-
error:
|
|
2921
|
+
error: (0, _typeof2["default"])(error) === 'object' ? error && typeof error.toString === 'function' ? error.toString() : JSON.stringify(error) : error
|
|
3005
2922
|
});
|
|
3006
2923
|
}
|
|
3007
2924
|
/**
|
|
@@ -3041,9 +2958,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3041
2958
|
} else {
|
|
3042
2959
|
if (this.objects[toggleItem] && (!this.props.types || this.props.types.includes(this.objects[toggleItem].type))) {
|
|
3043
2960
|
window.localStorage.removeItem("".concat(this.props.dialogName || 'App', ".selectedNonObject"));
|
|
3044
|
-
|
|
3045
|
-
var selected = _toConsumableArray(this.state.selected);
|
|
3046
|
-
|
|
2961
|
+
var selected = (0, _toConsumableArray2["default"])(this.state.selected);
|
|
3047
2962
|
var pos = selected.indexOf(toggleItem);
|
|
3048
2963
|
|
|
3049
2964
|
if (pos === -1) {
|
|
@@ -3072,8 +2987,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3072
2987
|
value: function _renderDefinedList(isLast) {
|
|
3073
2988
|
var _this9 = this;
|
|
3074
2989
|
|
|
3075
|
-
var cols =
|
|
3076
|
-
|
|
2990
|
+
var cols = (0, _toConsumableArray2["default"])(this.possibleCols);
|
|
3077
2991
|
cols.unshift('id');
|
|
3078
2992
|
|
|
3079
2993
|
if (this.props.columns && !this.props.columns.includes('buttons')) {
|
|
@@ -3087,11 +3001,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3087
3001
|
return cols.filter(function (id) {
|
|
3088
3002
|
return isLast && (id === 'val' || id === 'buttons') || !isLast && id !== 'val' && id !== 'buttons';
|
|
3089
3003
|
}).map(function (id) {
|
|
3090
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
3091
|
-
button: true,
|
|
3004
|
+
return /*#__PURE__*/_react["default"].createElement(ListItemButton, {
|
|
3092
3005
|
onClick: function onClick() {
|
|
3093
3006
|
if (!_this9.state.columnsAuto && id !== 'id') {
|
|
3094
|
-
var columns =
|
|
3007
|
+
var columns = (0, _toConsumableArray2["default"])(_this9.state.columns || []);
|
|
3095
3008
|
|
|
3096
3009
|
var _pos = columns.indexOf(id);
|
|
3097
3010
|
|
|
@@ -3190,11 +3103,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3190
3103
|
});
|
|
3191
3104
|
} else {
|
|
3192
3105
|
if (!_this10.state.columns) {
|
|
3193
|
-
_this10.calculateColumnsVisibility(false,
|
|
3106
|
+
_this10.calculateColumnsVisibility(false, (0, _toConsumableArray2["default"])(_this10.visibleCols));
|
|
3194
3107
|
|
|
3195
3108
|
_this10.setState({
|
|
3196
3109
|
columnsAuto: false,
|
|
3197
|
-
columns:
|
|
3110
|
+
columns: (0, _toConsumableArray2["default"])(_this10.visibleCols)
|
|
3198
3111
|
});
|
|
3199
3112
|
} else {
|
|
3200
3113
|
_this10.calculateColumnsVisibility(false);
|
|
@@ -3252,12 +3165,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3252
3165
|
}
|
|
3253
3166
|
}), /*#__PURE__*/_react["default"].createElement(_List["default"], null, this._renderDefinedList(false), this.state.columnsForAdmin && Object.keys(this.state.columnsForAdmin).sort().map(function (adapter) {
|
|
3254
3167
|
return _this10.state.columnsForAdmin[adapter].map(function (column) {
|
|
3255
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
3256
|
-
button: true,
|
|
3168
|
+
return /*#__PURE__*/_react["default"].createElement(ListItemButton, {
|
|
3257
3169
|
onClick: function onClick() {
|
|
3258
3170
|
if (!_this10.state.columnsAuto) {
|
|
3259
|
-
var columns =
|
|
3260
|
-
|
|
3171
|
+
var columns = (0, _toConsumableArray2["default"])(_this10.state.columns || []);
|
|
3261
3172
|
var id = '_' + adapter + '_' + column.path;
|
|
3262
3173
|
var pos = columns.indexOf(id);
|
|
3263
3174
|
|
|
@@ -3418,12 +3329,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3418
3329
|
if (obj.common && obj.common.adminColumns && obj.common.name) {
|
|
3419
3330
|
var columns = obj.common.adminColumns;
|
|
3420
3331
|
|
|
3421
|
-
if (
|
|
3332
|
+
if ((0, _typeof2["default"])(columns) !== 'object') {
|
|
3422
3333
|
columns = [columns];
|
|
3423
3334
|
}
|
|
3424
3335
|
|
|
3425
3336
|
columns = columns.map(function (item) {
|
|
3426
|
-
if (
|
|
3337
|
+
if ((0, _typeof2["default"])(item) !== 'object') {
|
|
3427
3338
|
return {
|
|
3428
3339
|
path: item,
|
|
3429
3340
|
name: item.split('.').pop()
|
|
@@ -3431,7 +3342,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3431
3342
|
} // string => array
|
|
3432
3343
|
|
|
3433
3344
|
|
|
3434
|
-
if (item.objTypes &&
|
|
3345
|
+
if (item.objTypes && (0, _typeof2["default"])(item.objTypes) !== 'object') {
|
|
3435
3346
|
item.objTypes = [item.objTypes];
|
|
3436
3347
|
} else if (!item.objTypes) {
|
|
3437
3348
|
item.objTypes = null;
|
|
@@ -3448,7 +3359,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3448
3359
|
};
|
|
3449
3360
|
}
|
|
3450
3361
|
|
|
3451
|
-
if (
|
|
3362
|
+
if ((0, _typeof2["default"])(item.name) !== 'object' && item.path) {
|
|
3452
3363
|
return {
|
|
3453
3364
|
path: item.path,
|
|
3454
3365
|
name: item.name,
|
|
@@ -3733,7 +3644,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3733
3644
|
var name;
|
|
3734
3645
|
var icon;
|
|
3735
3646
|
|
|
3736
|
-
if (
|
|
3647
|
+
if ((0, _typeof2["default"])(item) === 'object') {
|
|
3737
3648
|
id = item.value;
|
|
3738
3649
|
name = item.name;
|
|
3739
3650
|
icon = item.icon;
|
|
@@ -3960,9 +3871,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3960
3871
|
value: function onExpandVisible() {
|
|
3961
3872
|
if (this.state.depth < 9) {
|
|
3962
3873
|
var depth = this.state.depth + 1;
|
|
3963
|
-
|
|
3964
|
-
var expanded = _toConsumableArray(this.state.expanded);
|
|
3965
|
-
|
|
3874
|
+
var expanded = (0, _toConsumableArray2["default"])(this.state.expanded);
|
|
3966
3875
|
this.expandDepth(this.root, depth, expanded);
|
|
3967
3876
|
window.localStorage.setItem((this.props.dialogName || 'App') + '.objectExpanded', JSON.stringify(expanded));
|
|
3968
3877
|
this.setState({
|
|
@@ -4083,9 +3992,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4083
3992
|
});
|
|
4084
3993
|
}
|
|
4085
3994
|
}, this.props.t('ra_All objects')), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
3995
|
+
color: "primary",
|
|
4086
3996
|
variant: "contained",
|
|
4087
3997
|
autoFocus: true,
|
|
4088
|
-
color: "primary",
|
|
4089
3998
|
onClick: function onClick() {
|
|
4090
3999
|
return _this25.setState({
|
|
4091
4000
|
showExportDialog: false
|
|
@@ -4128,7 +4037,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4128
4037
|
if (id.split('.').length < 2 || this.objects[id] && this.objects[id].type === 'state') {
|
|
4129
4038
|
allowObjectCreation = false;
|
|
4130
4039
|
} else {
|
|
4131
|
-
if (this.
|
|
4040
|
+
if (this.state.filter.expertMode) {
|
|
4132
4041
|
allowObjectCreation = true;
|
|
4133
4042
|
} else if (id.startsWith('alias.0') || id.startsWith('0_userdata')) {
|
|
4134
4043
|
allowObjectCreation = true;
|
|
@@ -4359,7 +4268,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4359
4268
|
if (!item.data.obj) {
|
|
4360
4269
|
return this.props.onObjectDelete || this.props.objectEditOfAccessControl ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
4361
4270
|
className: classes.buttonDiv
|
|
4362
|
-
}, this.
|
|
4271
|
+
}, this.state.filter.expertMode && this.props.objectEditOfAccessControl ? /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
4363
4272
|
className: _Utils["default"].clsx(classes.cellButtonsButton, classes.cellButtonsEmptyButton, classes.cellButtonMinWidth),
|
|
4364
4273
|
onClick: function onClick() {
|
|
4365
4274
|
return _this27.setState({
|
|
@@ -4385,7 +4294,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4385
4294
|
item.data.aclTooltip = item.data.aclTooltip || this.renderTooltipAccessControl(item.data.obj.acl);
|
|
4386
4295
|
var acl = item.data.obj.acl ? item.data.obj.type === 'state' ? item.data.obj.acl.state : item.data.obj.acl.object : 0;
|
|
4387
4296
|
var aclSystemConfig = item.data.obj.acl && (item.data.obj.type === 'state' ? this.systemConfig.common.defaultNewAcl.state : this.systemConfig.common.defaultNewAcl.object);
|
|
4388
|
-
return [this.
|
|
4297
|
+
return [this.state.filter.expertMode && this.props.objectEditOfAccessControl ? /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
4389
4298
|
key: "acl",
|
|
4390
4299
|
title: item.data.aclTooltip
|
|
4391
4300
|
}, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
@@ -4589,13 +4498,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4589
4498
|
info.val = copyText;
|
|
4590
4499
|
info.valText = [/*#__PURE__*/_react["default"].createElement("span", {
|
|
4591
4500
|
className: classes.newValue || classes.newValue,
|
|
4592
|
-
key: "
|
|
4501
|
+
key: "valText"
|
|
4593
4502
|
}, info.valText.v.toString()), info.valText.u ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
4594
4503
|
className: _Utils["default"].clsx(classes.cellValueTextUnit, classes.newValue),
|
|
4595
|
-
key: "
|
|
4504
|
+
key: "unit"
|
|
4596
4505
|
}, info.valText.u) : null, info.valText.s !== undefined ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
4597
4506
|
className: _Utils["default"].clsx(classes.cellValueTextState, classes.newValue),
|
|
4598
|
-
key: "
|
|
4507
|
+
key: "states"
|
|
4599
4508
|
}, "(", info.valText.s, ")") : null, /*#__PURE__*/_react["default"].createElement(_IconCopy["default"], {
|
|
4600
4509
|
className: _Utils["default"].clsx(classes.cellButtonsValueButton, 'copyButton', classes.cellButtonsValueButtonCopy),
|
|
4601
4510
|
onClick: function onClick(e) {
|
|
@@ -4608,7 +4517,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4608
4517
|
|
|
4609
4518
|
var val = info.valText;
|
|
4610
4519
|
|
|
4611
|
-
if (!this.
|
|
4520
|
+
if (!this.state.filter.expertMode && item.data.button) {
|
|
4612
4521
|
val = /*#__PURE__*/_react["default"].createElement(_RoomService["default"], {
|
|
4613
4522
|
className: _Utils["default"].clsx(this.props.classes.cellValueButton, !this.states[id] || !this.states[id].val ? this.props.classes.cellValueButtonFalse : '')
|
|
4614
4523
|
});
|
|
@@ -4701,8 +4610,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4701
4610
|
value: function syncEnum(id, enumName, newArray) {
|
|
4702
4611
|
var _this31 = this;
|
|
4703
4612
|
|
|
4704
|
-
var toCheck =
|
|
4705
|
-
|
|
4613
|
+
var toCheck = (0, _toConsumableArray2["default"])(this.info[enumName === 'func' ? 'funcEnums' : 'roomEnums']);
|
|
4706
4614
|
return new Promise(function (resolve) {
|
|
4707
4615
|
return _this31._syncEnum(id, toCheck, newArray, function (error) {
|
|
4708
4616
|
error && _this31.showError(error); // force update of object
|
|
@@ -4778,7 +4686,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4778
4686
|
var name;
|
|
4779
4687
|
var icon;
|
|
4780
4688
|
|
|
4781
|
-
if (
|
|
4689
|
+
if ((0, _typeof2["default"])(item) === 'object') {
|
|
4782
4690
|
id = item.value;
|
|
4783
4691
|
name = item.name;
|
|
4784
4692
|
icon = item.icon;
|
|
@@ -4911,7 +4819,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4911
4819
|
if (!this.customColumnDialog) {
|
|
4912
4820
|
var value = this.getCustomValue(this.state.columnsEditCustomDialog.obj, this.state.columnsEditCustomDialog.it);
|
|
4913
4821
|
this.customColumnDialog = {
|
|
4914
|
-
type: this.state.columnsEditCustomDialog.it.type ||
|
|
4822
|
+
type: this.state.columnsEditCustomDialog.it.type || (0, _typeof2["default"])(value),
|
|
4915
4823
|
initValue: (value === null || value === undefined ? '' : value).toString(),
|
|
4916
4824
|
value: (value === null || value === undefined ? '' : value).toString()
|
|
4917
4825
|
};
|
|
@@ -5000,18 +4908,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5000
4908
|
var p = it.path;
|
|
5001
4909
|
var value;
|
|
5002
4910
|
|
|
5003
|
-
if (obj[p[0]] &&
|
|
4911
|
+
if (obj[p[0]] && (0, _typeof2["default"])(obj[p[0]]) === 'object') {
|
|
5004
4912
|
if (p.length === 2) {
|
|
5005
4913
|
// most common case
|
|
5006
4914
|
value = obj[p[0]][p[1]];
|
|
5007
4915
|
} else if (p.length === 3) {
|
|
5008
|
-
value = obj[p[0]][p[1]] &&
|
|
4916
|
+
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' ? obj[p[0]][p[1]][p[2]] : null;
|
|
5009
4917
|
} else if (p.length === 4) {
|
|
5010
|
-
value = obj[p[0]][p[1]] &&
|
|
4918
|
+
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] ? obj[p[0]][p[1]][p[2]][p[3]] : null;
|
|
5011
4919
|
} else if (p.length === 5) {
|
|
5012
|
-
value = obj[p[0]][p[1]] &&
|
|
4920
|
+
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && obj[p[0]][p[1]][p[2]][p[3]] ? obj[p[0]][p[1]][p[2]][p[3]][p[4]] : null;
|
|
5013
4921
|
} else if (p.length === 6) {
|
|
5014
|
-
value = obj[p[0]][p[1]] &&
|
|
4922
|
+
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && obj[p[0]][p[1]][p[2]][p[3]] && obj[p[0]][p[1]][p[2]][p[3]][p[4]] ? obj[p[0]][p[1]][p[2]][p[3]][p[4]][p[5]] : null;
|
|
5015
4923
|
}
|
|
5016
4924
|
|
|
5017
4925
|
if (value === undefined || value === null) {
|
|
@@ -5037,28 +4945,28 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5037
4945
|
if (obj && obj._id && obj._id.startsWith(it.adapter + '.') && it.path.length > 1) {
|
|
5038
4946
|
var p = it.path;
|
|
5039
4947
|
|
|
5040
|
-
if (obj[p[0]] &&
|
|
4948
|
+
if (obj[p[0]] && (0, _typeof2["default"])(obj[p[0]]) === 'object') {
|
|
5041
4949
|
if (p.length === 2) {
|
|
5042
4950
|
// most common case
|
|
5043
4951
|
obj[p[0]][p[1]] = value;
|
|
5044
4952
|
return true;
|
|
5045
4953
|
} else if (p.length === 3) {
|
|
5046
|
-
if (obj[p[0]][p[1]] &&
|
|
4954
|
+
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object') {
|
|
5047
4955
|
obj[p[0]][p[1]][p[2]] = value;
|
|
5048
4956
|
return true;
|
|
5049
4957
|
}
|
|
5050
4958
|
} else if (p.length === 4) {
|
|
5051
|
-
if (obj[p[0]][p[1]] &&
|
|
4959
|
+
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]]) === 'object') {
|
|
5052
4960
|
obj[p[0]][p[1]][p[2]][p[3]] = value;
|
|
5053
4961
|
return true;
|
|
5054
4962
|
}
|
|
5055
4963
|
} else if (p.length === 5) {
|
|
5056
|
-
if (obj[p[0]][p[1]] &&
|
|
4964
|
+
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]]) === 'object' && obj[p[0]][p[1]][p[2]][p[3]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]][p[3]]) === 'object') {
|
|
5057
4965
|
obj[p[0]][p[1]][p[2]][p[3]][p[4]] = value;
|
|
5058
4966
|
return true;
|
|
5059
4967
|
}
|
|
5060
4968
|
} else if (p.length === 6) {
|
|
5061
|
-
if (obj[p[0]][p[1]] &&
|
|
4969
|
+
if (obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]]) === 'object' && obj[p[0]][p[1]][p[2]][p[3]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]][p[3]]) === 'object' && obj[p[0]][p[1]][p[2]][p[3]][p[4]] && (0, _typeof2["default"])(obj[p[0]][p[1]][p[2]][p[3]][p[4]]) === 'object') {
|
|
5062
4970
|
obj[p[0]][p[1]][p[2]][p[3]][p[4]][p[5]] = value;
|
|
5063
4971
|
return true;
|
|
5064
4972
|
}
|
|
@@ -5204,13 +5112,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5204
5112
|
className: classes.checkBox,
|
|
5205
5113
|
checked: this.state.selected.includes(id)
|
|
5206
5114
|
}) : null;
|
|
5207
|
-
var valueEditable = !this.props.notEditable && itemType === 'state' && (this.
|
|
5115
|
+
var valueEditable = !this.props.notEditable && itemType === 'state' && (this.state.filter.expertMode || (common === null || common === void 0 ? void 0 : common.write) !== false);
|
|
5208
5116
|
|
|
5209
5117
|
if (this.props.objectBrowserViewFile && (common === null || common === void 0 ? void 0 : common.type) === 'file') {
|
|
5210
5118
|
valueEditable = true;
|
|
5211
5119
|
}
|
|
5212
5120
|
|
|
5213
|
-
var enumEditable = !this.props.notEditable && this.objects[id] && (this.
|
|
5121
|
+
var enumEditable = !this.props.notEditable && this.objects[id] && (this.state.filter.expertMode || itemType === 'state' || itemType === 'channel' || itemType === 'device');
|
|
5214
5122
|
var checkVisibleObjectType = this.state.statesView && (itemType === 'state' || itemType === 'channel' || itemType === 'device');
|
|
5215
5123
|
var newValue = '';
|
|
5216
5124
|
var newValueTitle = [];
|
|
@@ -5240,7 +5148,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5240
5148
|
obj.ts && newValueTitle.push(this.texts.objectChangedByUser + ' ' + _Utils["default"].formatDate(new Date(obj.ts), this.props.dateFormat));
|
|
5241
5149
|
}
|
|
5242
5150
|
|
|
5243
|
-
var readWriteAlias =
|
|
5151
|
+
var readWriteAlias = (0, _typeof2["default"])(common === null || common === void 0 ? void 0 : (_common$alias = common.alias) === null || _common$alias === void 0 ? void 0 : _common$alias.id) === 'object';
|
|
5244
5152
|
var alias = id.startsWith('alias.') && common !== null && common !== void 0 && (_common$alias2 = common.alias) !== null && _common$alias2 !== void 0 && _common$alias2.id ? readWriteAlias ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5245
5153
|
className: classes.cellIdAliasReadWriteDiv
|
|
5246
5154
|
}, common.alias.id.read ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -5487,9 +5395,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5487
5395
|
className: classes.cellRole,
|
|
5488
5396
|
style: {
|
|
5489
5397
|
width: this.columnsVisibility.role,
|
|
5490
|
-
cursor: this.
|
|
5398
|
+
cursor: this.state.filter.expertMode && enumEditable && this.props.objectBrowserEditRole ? 'text' : 'default'
|
|
5491
5399
|
},
|
|
5492
|
-
onClick: this.
|
|
5400
|
+
onClick: this.state.filter.expertMode && enumEditable && this.props.objectBrowserEditRole ? function () {
|
|
5493
5401
|
return _this37.setState({
|
|
5494
5402
|
roleDialog: item.data.id
|
|
5495
5403
|
});
|
|
@@ -5579,7 +5487,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5579
5487
|
} // in non-expert mode control button directly
|
|
5580
5488
|
|
|
5581
5489
|
|
|
5582
|
-
if (!_this37.
|
|
5490
|
+
if (!_this37.state.filter.expertMode && item.data.button) {
|
|
5583
5491
|
return _this37.props.socket.setState(id, true)["catch"](function (e) {
|
|
5584
5492
|
return window.alert("Cannot write state \"".concat(id, "\": ").concat(e));
|
|
5585
5493
|
});
|
|
@@ -6037,7 +5945,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6037
5945
|
var ObjectCustomDialog = this.props.objectCustomDialog;
|
|
6038
5946
|
return /*#__PURE__*/_react["default"].createElement(ObjectCustomDialog, {
|
|
6039
5947
|
reportChangedIds: function reportChangedIds(changedIds) {
|
|
6040
|
-
return _this43.changedIds =
|
|
5948
|
+
return _this43.changedIds = (0, _toConsumableArray2["default"])(changedIds);
|
|
6041
5949
|
},
|
|
6042
5950
|
objectIDs: this.state.customDialog,
|
|
6043
5951
|
expertMode: this.state.filter.expertMode,
|
|
@@ -6185,7 +6093,17 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6185
6093
|
return null;
|
|
6186
6094
|
}
|
|
6187
6095
|
|
|
6188
|
-
|
|
6096
|
+
if (!this.edit.id) {
|
|
6097
|
+
console.error('Invalid ID for edit: ' + JSON.stringify(this.edit));
|
|
6098
|
+
return null;
|
|
6099
|
+
}
|
|
6100
|
+
|
|
6101
|
+
if (!this.objects[this.edit.id]) {
|
|
6102
|
+
console.error("Something went wrong. Possibly the object ".concat(this.edit.id, " was deleted."));
|
|
6103
|
+
return null;
|
|
6104
|
+
}
|
|
6105
|
+
|
|
6106
|
+
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);
|
|
6189
6107
|
var ObjectBrowserValue = this.props.objectBrowserValue;
|
|
6190
6108
|
return /*#__PURE__*/_react["default"].createElement(ObjectBrowserValue, {
|
|
6191
6109
|
t: this.props.t,
|
|
@@ -6282,7 +6200,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6282
6200
|
return changed ? newState : null;
|
|
6283
6201
|
}
|
|
6284
6202
|
}]);
|
|
6285
|
-
|
|
6286
6203
|
return ObjectBrowser;
|
|
6287
6204
|
}(_react.Component);
|
|
6288
6205
|
|
|
@@ -6362,7 +6279,7 @@ ObjectBrowser.propTypes = {
|
|
|
6362
6279
|
};
|
|
6363
6280
|
/** @type {typeof ObjectBrowser} */
|
|
6364
6281
|
|
|
6365
|
-
var _export =
|
|
6282
|
+
var _export = (0, _withWidth["default"])()((0, _withStyles["default"])(styles)(ObjectBrowser));
|
|
6366
6283
|
|
|
6367
6284
|
var _default = _export;
|
|
6368
6285
|
exports["default"] = _default;
|