@iobroker/adapter-react-v5 7.2.4 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -15
- package/build/AdminConnection.d.ts +1 -0
- package/build/AdminConnection.js +2 -0
- package/build/AdminConnection.js.map +1 -0
- package/{src/Components/404.tsx → build/Components/404.js} +14 -39
- package/build/Components/404.js.map +1 -0
- package/{Components → build/Components}/ColorPicker.d.ts +2 -2
- package/{Components → build/Components}/ColorPicker.js +50 -65
- package/build/Components/ColorPicker.js.map +1 -0
- package/{Components → build/Components}/ComplexCron.d.ts +2 -2
- package/{Components → build/Components}/ComplexCron.js +43 -71
- package/build/Components/ComplexCron.js.map +1 -0
- package/{Components → build/Components}/CopyToClipboard.d.ts +1 -2
- package/{src/Components/CopyToClipboard.tsx → build/Components/CopyToClipboard.js} +20 -38
- package/build/Components/CopyToClipboard.js.map +1 -0
- package/{Components → build/Components}/CustomModal.d.ts +3 -3
- package/build/Components/CustomModal.js +60 -0
- package/build/Components/CustomModal.js.map +1 -0
- package/{Components → build/Components}/FileBrowser.d.ts +5 -3
- package/{Components → build/Components}/FileBrowser.js +230 -236
- package/build/Components/FileBrowser.js.map +1 -0
- package/build/Components/FileViewer.d.ts +49 -0
- package/build/Components/FileViewer.js +247 -0
- package/build/Components/FileViewer.js.map +1 -0
- package/{Components → build/Components}/Icon.d.ts +1 -1
- package/build/Components/Icon.js +140 -0
- package/build/Components/Icon.js.map +1 -0
- package/{Components → build/Components}/IconPicker.d.ts +2 -2
- package/build/Components/IconPicker.js +73 -0
- package/build/Components/IconPicker.js.map +1 -0
- package/{Components → build/Components}/IconSelector.d.ts +3 -3
- package/{Components → build/Components}/IconSelector.js +29 -57
- package/build/Components/IconSelector.js.map +1 -0
- package/{Components → build/Components}/Image.d.ts +2 -2
- package/{Components → build/Components}/Image.js +16 -22
- package/build/Components/Image.js.map +1 -0
- package/{Components → build/Components}/Loader.d.ts +2 -2
- package/{Components → build/Components}/Loader.js +15 -40
- package/build/Components/Loader.js.map +1 -0
- package/{Components → build/Components}/Loaders/MV.d.ts +2 -2
- package/build/Components/Loaders/MV.js +61 -0
- package/build/Components/Loaders/MV.js.map +1 -0
- package/{Components → build/Components}/Loaders/PT.d.ts +2 -2
- package/{Components → build/Components}/Loaders/PT.js +10 -35
- package/build/Components/Loaders/PT.js.map +1 -0
- package/{Components → build/Components}/Loaders/Vendor.d.ts +2 -2
- package/build/Components/Loaders/Vendor.js +52 -0
- package/build/Components/Loaders/Vendor.js.map +1 -0
- package/{Components → build/Components}/Logo.d.ts +2 -2
- package/build/Components/Logo.js +108 -0
- package/build/Components/Logo.js.map +1 -0
- package/{Components → build/Components}/MDUtils.d.ts +1 -2
- package/{Components → build/Components}/MDUtils.js +4 -9
- package/build/Components/MDUtils.js.map +1 -0
- package/{Components → build/Components}/ObjectBrowser.d.ts +4 -4
- package/{Components → build/Components}/ObjectBrowser.js +1159 -1122
- package/build/Components/ObjectBrowser.js.map +1 -0
- package/{Components → build/Components}/Router.d.ts +1 -2
- package/{Components → build/Components}/Router.js +6 -7
- package/build/Components/Router.js.map +1 -0
- package/{Components → build/Components}/SaveCloseButtons.d.ts +2 -2
- package/build/Components/SaveCloseButtons.js +65 -0
- package/build/Components/SaveCloseButtons.js.map +1 -0
- package/{Components → build/Components}/Schedule.d.ts +2 -2
- package/{Components → build/Components}/Schedule.js +242 -257
- package/build/Components/Schedule.js.map +1 -0
- package/{Components → build/Components}/SelectWithIcon.d.ts +2 -2
- package/build/Components/SelectWithIcon.js +135 -0
- package/build/Components/SelectWithIcon.js.map +1 -0
- package/build/Components/SimpleCron/cronText.js +15 -0
- package/build/Components/SimpleCron/cronText.js.map +1 -0
- package/{Components → build/Components}/SimpleCron/index.d.ts +2 -2
- package/{Components → build/Components}/SimpleCron/index.js +55 -58
- package/build/Components/SimpleCron/index.js.map +1 -0
- package/{Components → build/Components}/TabContainer.d.ts +2 -2
- package/build/Components/TabContainer.js +23 -0
- package/build/Components/TabContainer.js.map +1 -0
- package/{Components → build/Components}/TabContent.d.ts +3 -2
- package/build/Components/TabContent.js +20 -0
- package/build/Components/TabContent.js.map +1 -0
- package/build/Components/TabHeader.d.ts +6 -0
- package/build/Components/TabHeader.js +6 -0
- package/build/Components/TabHeader.js.map +1 -0
- package/{Components → build/Components}/TableResize.d.ts +2 -2
- package/{src/Components/TableResize.tsx → build/Components/TableResize.js} +64 -134
- package/build/Components/TableResize.js.map +1 -0
- package/{Components → build/Components}/TextWithIcon.d.ts +2 -2
- package/{src/Components/TextWithIcon.tsx → build/Components/TextWithIcon.js} +30 -75
- package/build/Components/TextWithIcon.js.map +1 -0
- package/{Components → build/Components}/ToggleThemeMenu.d.ts +1 -1
- package/build/Components/ToggleThemeMenu.js +13 -0
- package/build/Components/ToggleThemeMenu.js.map +1 -0
- package/{Components → build/Components}/TreeTable.d.ts +3 -3
- package/{Components → build/Components}/TreeTable.js +87 -99
- package/build/Components/TreeTable.js.map +1 -0
- package/{Components → build/Components}/UploadImage.d.ts +2 -2
- package/{Components → build/Components}/UploadImage.js +45 -69
- package/build/Components/UploadImage.js.map +1 -0
- package/{Components → build/Components}/Utils.d.ts +2 -2
- package/{Components → build/Components}/Utils.js +47 -60
- package/build/Components/Utils.js.map +1 -0
- package/build/Components/withWidth.d.ts +2 -0
- package/build/Components/withWidth.js +22 -0
- package/build/Components/withWidth.js.map +1 -0
- package/build/Connection.d.ts +1 -0
- package/build/Connection.js +2 -0
- package/build/Connection.js.map +1 -0
- package/{Dialogs → build/Dialogs}/ComplexCron.d.ts +2 -2
- package/build/Dialogs/ComplexCron.js +85 -0
- package/build/Dialogs/ComplexCron.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Confirm.d.ts +2 -2
- package/build/Dialogs/Confirm.js +83 -0
- package/build/Dialogs/Confirm.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Cron.d.ts +2 -2
- package/build/Dialogs/Cron.js +72 -0
- package/build/Dialogs/Cron.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Error.d.ts +2 -2
- package/build/Dialogs/Error.js +27 -0
- package/build/Dialogs/Error.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Message.d.ts +2 -2
- package/build/Dialogs/Message.js +29 -0
- package/build/Dialogs/Message.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SelectFile.d.ts +2 -2
- package/build/Dialogs/SelectFile.js +116 -0
- package/build/Dialogs/SelectFile.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SelectID.d.ts +3 -3
- package/{Dialogs → build/Dialogs}/SelectID.js +28 -53
- package/build/Dialogs/SelectID.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SimpleCron.d.ts +2 -2
- package/build/Dialogs/SimpleCron.js +46 -0
- package/build/Dialogs/SimpleCron.js.map +1 -0
- package/build/Dialogs/TextInput.d.ts +2 -0
- package/build/Dialogs/TextInput.js +31 -0
- package/build/Dialogs/TextInput.js.map +1 -0
- package/{GenericApp.d.ts → build/GenericApp.d.ts} +2 -3
- package/{GenericApp.js → build/GenericApp.js} +162 -176
- package/build/GenericApp.js.map +1 -0
- package/{LegacyConnection.d.ts → build/LegacyConnection.d.ts} +69 -4
- package/{LegacyConnection.js → build/LegacyConnection.js} +106 -99
- package/build/LegacyConnection.js.map +1 -0
- package/{Prompt.d.ts → build/Prompt.d.ts} +1 -1
- package/{Prompt.js → build/Prompt.js} +3 -4
- package/build/Prompt.js.map +1 -0
- package/build/Theme.d.ts +5 -0
- package/{Theme.js → build/Theme.js} +36 -32
- package/build/Theme.js.map +1 -0
- package/build/assets/devices/parseNames.d.ts +0 -0
- package/build/assets/devices/parseNames.js +35 -0
- package/build/assets/devices/parseNames.js.map +1 -0
- package/build/assets/rooms/parseNames.d.ts +0 -0
- package/build/assets/rooms/parseNames.js +35 -0
- package/build/assets/rooms/parseNames.js.map +1 -0
- package/build/dictionary.d.ts +1 -0
- package/build/dictionary.js +25 -0
- package/build/dictionary.js.map +1 -0
- package/build/i18n/de.json +449 -0
- package/build/i18n/en.json +449 -0
- package/build/i18n/es.json +449 -0
- package/build/i18n/fr.json +449 -0
- package/build/i18n/it.json +449 -0
- package/build/i18n/nl.json +449 -0
- package/build/i18n/pl.json +449 -0
- package/build/i18n/pt.json +449 -0
- package/build/i18n/ru.json +449 -0
- package/build/i18n/uk.json +449 -0
- package/build/i18n/zh-cn.json +449 -0
- package/{i18n.d.ts → build/i18n.d.ts} +2 -2
- package/{i18n.js → build/i18n.js} +9 -11
- package/build/i18n.js.map +1 -0
- package/build/icons/IconAdapter.d.ts +3 -0
- package/build/icons/IconAdapter.js +5 -0
- package/build/icons/IconAdapter.js.map +1 -0
- package/build/icons/IconAlias.d.ts +3 -0
- package/build/icons/IconAlias.js +5 -0
- package/build/icons/IconAlias.js.map +1 -0
- package/build/icons/IconChannel.d.ts +3 -0
- package/build/icons/IconChannel.js +8 -0
- package/build/icons/IconChannel.js.map +1 -0
- package/build/icons/IconClearFilter.d.ts +3 -0
- package/build/icons/IconClearFilter.js +6 -0
- package/build/icons/IconClearFilter.js.map +1 -0
- package/build/icons/IconClosed.d.ts +3 -0
- package/build/icons/IconClosed.js +5 -0
- package/build/icons/IconClosed.js.map +1 -0
- package/build/icons/IconCopy.d.ts +3 -0
- package/build/icons/IconCopy.js +4 -0
- package/build/icons/IconCopy.js.map +1 -0
- package/build/icons/IconDevice.d.ts +3 -0
- package/build/icons/IconDevice.js +14 -0
- package/build/icons/IconDevice.js.map +1 -0
- package/build/icons/IconDocument.d.ts +3 -0
- package/build/icons/IconDocument.js +5 -0
- package/build/icons/IconDocument.js.map +1 -0
- package/build/icons/IconDocumentReadOnly.d.ts +3 -0
- package/build/icons/IconDocumentReadOnly.js +6 -0
- package/build/icons/IconDocumentReadOnly.js.map +1 -0
- package/build/icons/IconExpert.d.ts +3 -0
- package/build/icons/IconExpert.js +5 -0
- package/build/icons/IconExpert.js.map +1 -0
- package/build/icons/IconFx.d.ts +3 -0
- package/build/icons/IconFx.js +4 -0
- package/build/icons/IconFx.js.map +1 -0
- package/build/icons/IconInstance.d.ts +3 -0
- package/build/icons/IconInstance.js +5 -0
- package/build/icons/IconInstance.js.map +1 -0
- package/build/icons/IconLogout.d.ts +3 -0
- package/build/icons/IconLogout.js +5 -0
- package/build/icons/IconLogout.js.map +1 -0
- package/build/icons/IconNoIcon.d.ts +3 -0
- package/build/icons/IconNoIcon.js +4 -0
- package/build/icons/IconNoIcon.js.map +1 -0
- package/build/icons/IconOpen.d.ts +3 -0
- package/build/icons/IconOpen.js +5 -0
- package/build/icons/IconOpen.js.map +1 -0
- package/{icons → build/icons}/IconProps.d.ts +1 -1
- package/build/icons/IconProps.js +2 -0
- package/build/icons/IconProps.js.map +1 -0
- package/build/icons/IconState.d.ts +3 -0
- package/build/icons/IconState.js +5 -0
- package/build/icons/IconState.js.map +1 -0
- package/build/index.d.ts +76 -0
- package/build/index.js +75 -0
- package/build/index.js.map +1 -0
- package/{types.d.ts → build/types.d.ts} +1 -1
- package/package.json +84 -48
- package/AdminConnection.d.ts +0 -2
- package/AdminConnection.js +0 -4
- package/Components/404.js +0 -101
- package/Components/CopyToClipboard.js +0 -163
- package/Components/CustomModal.js +0 -88
- package/Components/FileViewer.d.ts +0 -10
- package/Components/FileViewer.js +0 -305
- package/Components/Icon.js +0 -148
- package/Components/IconPicker.js +0 -98
- package/Components/Loaders/MV.js +0 -66
- package/Components/Loaders/Vendor.js +0 -77
- package/Components/Logo.js +0 -117
- package/Components/SaveCloseButtons.js +0 -69
- package/Components/SelectWithIcon.js +0 -168
- package/Components/SimpleCron/cronText.js +0 -19
- package/Components/TabContainer.js +0 -25
- package/Components/TabContent.js +0 -21
- package/Components/TabHeader.d.ts +0 -6
- package/Components/TabHeader.js +0 -11
- package/Components/TableResize.js +0 -226
- package/Components/TextWithIcon.js +0 -119
- package/Components/ToggleThemeMenu.js +0 -18
- package/Components/withWidth.d.ts +0 -3
- package/Components/withWidth.js +0 -27
- package/Connection.d.ts +0 -3
- package/Connection.js +0 -8
- package/Dialogs/ComplexCron.js +0 -90
- package/Dialogs/Confirm.js +0 -111
- package/Dialogs/Cron.js +0 -100
- package/Dialogs/Error.js +0 -55
- package/Dialogs/Message.js +0 -57
- package/Dialogs/SelectFile.js +0 -119
- package/Dialogs/SimpleCron.js +0 -51
- package/Dialogs/TextInput.d.ts +0 -3
- package/Dialogs/TextInput.js +0 -35
- package/Theme.d.ts +0 -6
- package/i18n/de.json +0 -449
- package/i18n/en.json +0 -449
- package/i18n/es.json +0 -449
- package/i18n/fr.json +0 -449
- package/i18n/it.json +0 -449
- package/i18n/nl.json +0 -449
- package/i18n/pl.json +0 -449
- package/i18n/pt.json +0 -449
- package/i18n/ru.json +0 -449
- package/i18n/uk.json +0 -449
- package/i18n/zh-cn.json +0 -449
- package/icons/IconAdapter.d.ts +0 -4
- package/icons/IconAdapter.js +0 -10
- package/icons/IconAlias.d.ts +0 -4
- package/icons/IconAlias.js +0 -10
- package/icons/IconChannel.d.ts +0 -4
- package/icons/IconChannel.js +0 -13
- package/icons/IconClearFilter.d.ts +0 -4
- package/icons/IconClearFilter.js +0 -11
- package/icons/IconClosed.d.ts +0 -4
- package/icons/IconClosed.js +0 -10
- package/icons/IconCopy.d.ts +0 -4
- package/icons/IconCopy.js +0 -9
- package/icons/IconDevice.d.ts +0 -4
- package/icons/IconDevice.js +0 -19
- package/icons/IconDocument.d.ts +0 -4
- package/icons/IconDocument.js +0 -10
- package/icons/IconDocumentReadOnly.d.ts +0 -4
- package/icons/IconDocumentReadOnly.js +0 -11
- package/icons/IconExpert.d.ts +0 -4
- package/icons/IconExpert.js +0 -10
- package/icons/IconFx.d.ts +0 -4
- package/icons/IconFx.js +0 -9
- package/icons/IconInstance.d.ts +0 -4
- package/icons/IconInstance.js +0 -10
- package/icons/IconLogout.d.ts +0 -4
- package/icons/IconLogout.js +0 -10
- package/icons/IconNoIcon.d.ts +0 -4
- package/icons/IconNoIcon.js +0 -9
- package/icons/IconOpen.d.ts +0 -4
- package/icons/IconOpen.js +0 -10
- package/icons/IconProps.js +0 -2
- package/icons/IconState.d.ts +0 -4
- package/icons/IconState.js +0 -10
- package/index.d.ts +0 -128
- package/index.js +0 -215
- package/src/AdminConnection.tsx +0 -3
- package/src/Components/ColorPicker.tsx +0 -343
- package/src/Components/ComplexCron.tsx +0 -561
- package/src/Components/CustomModal.tsx +0 -170
- package/src/Components/FileBrowser.tsx +0 -2560
- package/src/Components/FileViewer.tsx +0 -412
- package/src/Components/Icon.tsx +0 -238
- package/src/Components/IconPicker.tsx +0 -165
- package/src/Components/IconSelector.tsx +0 -2220
- package/src/Components/Image.tsx +0 -193
- package/src/Components/Loader.tsx +0 -328
- package/src/Components/Logo.tsx +0 -176
- package/src/Components/MDUtils.tsx +0 -104
- package/src/Components/ObjectBrowser.tsx +0 -8947
- package/src/Components/Router.tsx +0 -90
- package/src/Components/SaveCloseButtons.tsx +0 -117
- package/src/Components/Schedule.tsx +0 -1998
- package/src/Components/SelectWithIcon.tsx +0 -239
- package/src/Components/TabContainer.tsx +0 -57
- package/src/Components/TabContent.tsx +0 -38
- package/src/Components/TabHeader.tsx +0 -20
- package/src/Components/ToggleThemeMenu.tsx +0 -52
- package/src/Components/TreeTable.tsx +0 -1002
- package/src/Components/UploadImage.tsx +0 -643
- package/src/Components/Utils.tsx +0 -1802
- package/src/Components/loader.css +0 -231
- package/src/Components/withWidth.tsx +0 -32
- package/src/Connection.tsx +0 -5
- package/src/Dialogs/ComplexCron.tsx +0 -163
- package/src/Dialogs/Confirm.tsx +0 -185
- package/src/Dialogs/Cron.tsx +0 -192
- package/src/Dialogs/Error.tsx +0 -67
- package/src/Dialogs/Message.tsx +0 -73
- package/src/Dialogs/SelectFile.tsx +0 -280
- package/src/Dialogs/SelectID.tsx +0 -310
- package/src/Dialogs/SimpleCron.tsx +0 -101
- package/src/Dialogs/TextInput.tsx +0 -99
- package/src/GenericApp.tsx +0 -1076
- package/src/LegacyConnection.tsx +0 -3720
- package/src/Prompt.tsx +0 -22
- package/src/Theme.tsx +0 -472
- package/src/icons/IconAdapter.tsx +0 -22
- package/src/icons/IconAlias.tsx +0 -22
- package/src/icons/IconChannel.tsx +0 -60
- package/src/icons/IconClearFilter.tsx +0 -24
- package/src/icons/IconClosed.tsx +0 -22
- package/src/icons/IconCopy.tsx +0 -21
- package/src/icons/IconDevice.tsx +0 -126
- package/src/icons/IconDocument.tsx +0 -22
- package/src/icons/IconDocumentReadOnly.tsx +0 -27
- package/src/icons/IconExpert.tsx +0 -26
- package/src/icons/IconFx.tsx +0 -38
- package/src/icons/IconInstance.tsx +0 -22
- package/src/icons/IconLogout.tsx +0 -32
- package/src/icons/IconNoIcon.tsx +0 -21
- package/src/icons/IconOpen.tsx +0 -22
- package/src/icons/IconProps.tsx +0 -16
- package/src/icons/IconState.tsx +0 -38
- package/src/index.css +0 -56
- /package/{Components → build/Components}/404.d.ts +0 -0
- /package/{Components → build/Components}/SimpleCron/cronText.d.ts +0 -0
- /package/{assets → build/assets}/devices.json +0 -0
- /package/{assets → build/assets}/lamp_ceiling.svg +0 -0
- /package/{assets → build/assets}/lamp_table.svg +0 -0
- /package/{assets → build/assets}/no_icon.svg +0 -0
- /package/{assets → build/assets}/rooms.json +0 -0
- /package/{index.css → build/index.css} +0 -0
- /package/{tasks.js → tasksExample.js} +0 -0
|
@@ -1,69 +1,33 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
26
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
27
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
28
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
29
|
-
};
|
|
30
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
-
};
|
|
33
|
-
var _a, _ObjectBrowserClass_NON_EXPERT_NAMESPACES;
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.ObjectBrowserClass = exports.ITEM_IMAGES = void 0;
|
|
36
|
-
exports.getSelectIdIconFromObjects = getSelectIdIconFromObjects;
|
|
37
1
|
/**
|
|
38
2
|
* Copyright 2020-2024, Denis Haev <dogafox@gmail.com>
|
|
39
3
|
*
|
|
40
4
|
* MIT License
|
|
41
5
|
*
|
|
42
6
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
7
|
+
import React, { Component, createRef } from 'react';
|
|
8
|
+
import SVG from 'react-inlinesvg';
|
|
9
|
+
import { Badge, Box, Button, Checkbox, CircularProgress, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Fab, FormControl, FormControlLabel, Grid2, IconButton, Input, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Menu, MenuItem, Paper, Select, Snackbar, Switch, TextField, Tooltip, } from '@mui/material';
|
|
46
10
|
// Icons
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
11
|
+
import { Add as AddIcon, ArrowRight as ArrowRightIcon, BedroomParent, BorderColor, Build as BuildIcon, CalendarToday as IconSchedule, Check as IconCheck, Close as IconClose, Code as IconScript, Construction, CreateNewFolder as IconFolder, Delete as IconDelete, Description as IconMeta, Edit as IconEdit, Error as IconError, FindInPage, FormatItalic as IconValueEdit, Info as IconInfo, Link as IconLink, ListAlt as IconEnum, LooksOne as LooksOneIcon, PersonOutlined as IconUser, Publish as PublishIcon, Refresh as RefreshIcon, Router as IconHost, Settings as IconConfig, SettingsApplications as IconSystem, DataObject as IconData, ShowChart as IconChart, SupervisedUserCircle as IconGroup, TextFields as TextFieldsIcon, ViewColumn as IconColumns, Wifi as IconConnection, WifiOff as IconDisconnected, } from '@mui/icons-material';
|
|
12
|
+
import { IconExpert } from '../icons/IconExpert';
|
|
13
|
+
import { IconAdapter } from '../icons/IconAdapter';
|
|
14
|
+
import { IconChannel } from '../icons/IconChannel';
|
|
15
|
+
import { IconCopy } from '../icons/IconCopy';
|
|
16
|
+
import { IconDevice } from '../icons/IconDevice';
|
|
17
|
+
import { IconDocument } from '../icons/IconDocument';
|
|
18
|
+
import { IconDocumentReadOnly } from '../icons/IconDocumentReadOnly';
|
|
19
|
+
import { IconInstance } from '../icons/IconInstance';
|
|
20
|
+
import { IconState } from '../icons/IconState';
|
|
21
|
+
import { IconClosed } from '../icons/IconClosed';
|
|
22
|
+
import { IconOpen } from '../icons/IconOpen';
|
|
23
|
+
import { IconClearFilter } from '../icons/IconClearFilter';
|
|
24
|
+
import { Connection } from '../Connection';
|
|
25
|
+
import { Icon } from './Icon';
|
|
26
|
+
import { withWidth } from './withWidth';
|
|
27
|
+
import { Utils } from './Utils'; // @iobroker/adapter-react-v5/Components/Utils
|
|
28
|
+
import { TabContainer } from './TabContainer';
|
|
29
|
+
import { TabContent } from './TabContent';
|
|
30
|
+
import { TabHeader } from './TabHeader';
|
|
67
31
|
const ICON_SIZE = 24;
|
|
68
32
|
const ROW_HEIGHT = 32;
|
|
69
33
|
const ITEM_LEVEL = 16;
|
|
@@ -183,7 +147,7 @@ const styles = {
|
|
|
183
147
|
width: '100%',
|
|
184
148
|
'&:hover': {
|
|
185
149
|
background: `${theme.palette.mode === 'dark' ? theme.palette.primary.dark : theme.palette.primary.light} !important`,
|
|
186
|
-
color:
|
|
150
|
+
color: Utils.invertColor(theme.palette.primary.main, true),
|
|
187
151
|
},
|
|
188
152
|
whiteSpace: 'nowrap',
|
|
189
153
|
flexWrap: 'nowrap',
|
|
@@ -549,7 +513,7 @@ const styles = {
|
|
|
549
513
|
},
|
|
550
514
|
itemSelected: (theme) => ({
|
|
551
515
|
background: `${theme.palette.primary.main} !important`,
|
|
552
|
-
color: `${
|
|
516
|
+
color: `${Utils.invertColor(theme.palette.primary.main, true)} !important`,
|
|
553
517
|
}),
|
|
554
518
|
header: {
|
|
555
519
|
width: '100%',
|
|
@@ -749,10 +713,10 @@ const styles = {
|
|
|
749
713
|
},
|
|
750
714
|
};
|
|
751
715
|
function ButtonIcon(props) {
|
|
752
|
-
return (
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
716
|
+
return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 436 436", style: props?.style, width: "24", height: "24", className: "admin-button" },
|
|
717
|
+
React.createElement("g", { fill: "currentColor" },
|
|
718
|
+
React.createElement("path", { d: "m195.23077,24.30769c-36,3 -67,12 -96,26c-49,24 -82,61 -93,104l-3,11l-1,50c0,46 0,49 2,59l5,20c21,58 84,103 165,116c16,3 53,4 70,2c60,-6 111,-28 147,-64c21,-21 36,-49 40,-74a866,866 0 0 0 1,-104c-3,-18 -6,-28 -13,-43c-26,-52 -87,-90 -162,-101c-16,-2 -48,-3 -63,-2l1,0zm60,23c36,5 70,18 95,35c31,20 51,47 59,77c2,7 2,11 2,25c1,15 0,18 -2,26c-19,69 -104,117 -200,114c-47,-2 -90,-15 -124,-38c-31,-20 -51,-47 -59,-77c-3,-11 -4,-32 -2,-43c8,-42 41,-78 91,-101a260,260 0 0 1 140,-19l0,1zm-221,222c21,26 57,49 95,62c81,27 174,14 239,-32c14,-10 31,-27 41,-41c2,-2 2,-2 2,7c-1,23 -16,50 -38,72c-78,74 -233,74 -311,-1a121,121 0 0 1 -39,-76l0,-6l3,4l8,11z" }),
|
|
719
|
+
React.createElement("path", { d: "m201.23077,47.30769c-40,3 -79,19 -104,44c-55,55 -38,133 37,171c52,26 122,24 172,-5c30,-17 51,-42 58,-71c3,-11 3,-34 0,-45c-6,-23 -21,-44 -40,-60l-27,-16a184,184 0 0 0 -96,-18zm30,21c56,5 100,35 112,75c4,11 4,30 0,41c-8,25 -26,45 -54,59a166,166 0 0 1 -160,-8a98,98 0 0 1 -41,-53c-5,-18 -2,-39 8,-57c23,-39 79,-62 135,-57z" }))));
|
|
756
720
|
}
|
|
757
721
|
/**
|
|
758
722
|
* Function that walks through all keys of an object or array and applies a function to each key.
|
|
@@ -879,7 +843,7 @@ function getName(name, lang) {
|
|
|
879
843
|
}
|
|
880
844
|
return name ? name.toString() : '';
|
|
881
845
|
}
|
|
882
|
-
function getSelectIdIconFromObjects(objects, id, lang, imagePrefix) {
|
|
846
|
+
export function getSelectIdIconFromObjects(objects, id, lang, imagePrefix) {
|
|
883
847
|
// `admin` has prefix '.' and `web` has '../..'
|
|
884
848
|
imagePrefix = imagePrefix || '.'; // http://localhost:8081';
|
|
885
849
|
let src = '';
|
|
@@ -905,7 +869,7 @@ function getSelectIdIconFromObjects(objects, id, lang, imagePrefix) {
|
|
|
905
869
|
}
|
|
906
870
|
}
|
|
907
871
|
else if (aIcon.startsWith('data:image/svg')) {
|
|
908
|
-
src = (
|
|
872
|
+
src = (React.createElement(SVG, { className: "iconOwn", src: aIcon, width: 28, height: 28 }));
|
|
909
873
|
}
|
|
910
874
|
else {
|
|
911
875
|
src = aIcon;
|
|
@@ -957,7 +921,7 @@ function getSelectIdIconFromObjects(objects, id, lang, imagePrefix) {
|
|
|
957
921
|
}
|
|
958
922
|
else if (cIcon.startsWith('data:image/svg')) {
|
|
959
923
|
// if base 64 image
|
|
960
|
-
src = (
|
|
924
|
+
src = (React.createElement(SVG, { className: "iconOwn", src: cIcon, width: 28, height: 28 }));
|
|
961
925
|
}
|
|
962
926
|
else {
|
|
963
927
|
src = cIcon;
|
|
@@ -968,7 +932,6 @@ function getSelectIdIconFromObjects(objects, id, lang, imagePrefix) {
|
|
|
968
932
|
return src || null;
|
|
969
933
|
}
|
|
970
934
|
function applyFilter(item, filters, lang, objects, context, counter, customFilter, selectedTypes, _depth) {
|
|
971
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
972
935
|
_depth = _depth || 0;
|
|
973
936
|
let filteredOut = false;
|
|
974
937
|
if (!context) {
|
|
@@ -989,15 +952,15 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
989
952
|
context.role = filters.role.toLowerCase();
|
|
990
953
|
}
|
|
991
954
|
if (filters.room) {
|
|
992
|
-
context.room =
|
|
955
|
+
context.room = objects[filters.room]?.common?.members || [];
|
|
993
956
|
}
|
|
994
957
|
if (filters.func) {
|
|
995
|
-
context.func =
|
|
958
|
+
context.func = objects[filters.func]?.common?.members || [];
|
|
996
959
|
}
|
|
997
960
|
}
|
|
998
961
|
const data = item.data;
|
|
999
962
|
if (data && data.id) {
|
|
1000
|
-
const common =
|
|
963
|
+
const common = data.obj?.common;
|
|
1001
964
|
if (customFilter) {
|
|
1002
965
|
if (customFilter.type) {
|
|
1003
966
|
if (typeof customFilter.type === 'string') {
|
|
@@ -1011,8 +974,8 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1011
974
|
}
|
|
1012
975
|
}
|
|
1013
976
|
}
|
|
1014
|
-
if (!filteredOut &&
|
|
1015
|
-
if (!
|
|
977
|
+
if (!filteredOut && customFilter.common?.type) {
|
|
978
|
+
if (!common?.type) {
|
|
1016
979
|
filteredOut = true;
|
|
1017
980
|
}
|
|
1018
981
|
else if (typeof customFilter.common.type === 'string') {
|
|
@@ -1026,8 +989,8 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1026
989
|
}
|
|
1027
990
|
}
|
|
1028
991
|
}
|
|
1029
|
-
if (!filteredOut &&
|
|
1030
|
-
if (!
|
|
992
|
+
if (!filteredOut && customFilter.common?.role) {
|
|
993
|
+
if (!common?.role) {
|
|
1031
994
|
filteredOut = true;
|
|
1032
995
|
}
|
|
1033
996
|
else if (typeof customFilter.common.role === 'string') {
|
|
@@ -1041,12 +1004,12 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1041
1004
|
}
|
|
1042
1005
|
}
|
|
1043
1006
|
}
|
|
1044
|
-
if (!filteredOut &&
|
|
1007
|
+
if (!filteredOut && customFilter.common?.custom === '_' && common?.custom) {
|
|
1045
1008
|
filteredOut = true;
|
|
1046
1009
|
}
|
|
1047
|
-
else if (!filteredOut &&
|
|
1010
|
+
else if (!filteredOut && customFilter.common?.custom && customFilter.common?.custom !== '_') {
|
|
1048
1011
|
const filterOfCustom = customFilter.common.custom;
|
|
1049
|
-
if (!
|
|
1012
|
+
if (!common?.custom) {
|
|
1050
1013
|
filteredOut = true;
|
|
1051
1014
|
}
|
|
1052
1015
|
else if (filterOfCustom === '_dataSources') {
|
|
@@ -1077,7 +1040,7 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1077
1040
|
data.id.startsWith('enum.') ||
|
|
1078
1041
|
data.id.startsWith('_design/') ||
|
|
1079
1042
|
data.id.endsWith('.admin') ||
|
|
1080
|
-
!!
|
|
1043
|
+
!!common?.expert;
|
|
1081
1044
|
}
|
|
1082
1045
|
if (!filteredOut && context.id) {
|
|
1083
1046
|
if (data.fID === undefined) {
|
|
@@ -1153,14 +1116,13 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1153
1116
|
return data.visible || data.hasVisibleChildren;
|
|
1154
1117
|
}
|
|
1155
1118
|
function getVisibleItems(item, type, objects, _result) {
|
|
1156
|
-
var _b;
|
|
1157
1119
|
_result = _result || [];
|
|
1158
1120
|
const data = item.data;
|
|
1159
1121
|
if (data.sumVisibility) {
|
|
1160
1122
|
if (data.id && objects[data.id] && (!type || objects[data.id].type === type)) {
|
|
1161
1123
|
_result.push(data.id);
|
|
1162
1124
|
}
|
|
1163
|
-
|
|
1125
|
+
item.children?.forEach(_item => getVisibleItems(_item, type, objects, _result));
|
|
1164
1126
|
}
|
|
1165
1127
|
return _result;
|
|
1166
1128
|
}
|
|
@@ -1168,34 +1130,34 @@ function getSystemIcon(objects, id, level, themeType, lang, imagePrefix) {
|
|
|
1168
1130
|
let icon;
|
|
1169
1131
|
// system or design has special icons
|
|
1170
1132
|
if (id === 'alias' || id === 'alias.0') {
|
|
1171
|
-
icon = (
|
|
1133
|
+
icon = (React.createElement(IconLink, { className: "iconOwn", style: { color: COLOR_NAME_ALIAS(themeType) } }));
|
|
1172
1134
|
}
|
|
1173
1135
|
else if (id === '0_userdata' || id === '0_userdata.0') {
|
|
1174
|
-
icon = (
|
|
1136
|
+
icon = (React.createElement(IconData, { className: "iconOwn", style: { color: COLOR_NAME_USERDATA(themeType) } }));
|
|
1175
1137
|
}
|
|
1176
1138
|
else if (id.startsWith('_design/') || id === 'system') {
|
|
1177
|
-
icon = (
|
|
1139
|
+
icon = (React.createElement(IconSystem, { className: "iconOwn", style: { color: COLOR_NAME_SYSTEM(themeType) } }));
|
|
1178
1140
|
}
|
|
1179
1141
|
else if (id === 'system.adapter') {
|
|
1180
|
-
icon = (
|
|
1142
|
+
icon = (React.createElement(IconSystem, { className: "iconOwn", style: { color: COLOR_NAME_SYSTEM_ADAPTER(themeType) } }));
|
|
1181
1143
|
}
|
|
1182
1144
|
else if (id === 'system.group') {
|
|
1183
|
-
icon =
|
|
1145
|
+
icon = React.createElement(IconGroup, { className: "iconOwn" });
|
|
1184
1146
|
}
|
|
1185
1147
|
else if (id === 'system.user') {
|
|
1186
|
-
icon =
|
|
1148
|
+
icon = React.createElement(IconUser, { className: "iconOwn" });
|
|
1187
1149
|
}
|
|
1188
1150
|
else if (id === 'system.host') {
|
|
1189
|
-
icon =
|
|
1151
|
+
icon = React.createElement(IconHost, { className: "iconOwn" });
|
|
1190
1152
|
}
|
|
1191
1153
|
else if (id.endsWith('.connection') || id.endsWith('.connected')) {
|
|
1192
|
-
icon =
|
|
1154
|
+
icon = React.createElement(IconConnection, { className: "iconOwn" });
|
|
1193
1155
|
}
|
|
1194
1156
|
else if (id.endsWith('.info')) {
|
|
1195
|
-
icon =
|
|
1157
|
+
icon = React.createElement(IconInfo, { className: "iconOwn" });
|
|
1196
1158
|
}
|
|
1197
1159
|
else if (objects[id] && objects[id].type === 'meta') {
|
|
1198
|
-
icon =
|
|
1160
|
+
icon = React.createElement(IconMeta, { className: "iconOwn" });
|
|
1199
1161
|
}
|
|
1200
1162
|
else if (level < 2) {
|
|
1201
1163
|
// detect "cloud.0"
|
|
@@ -1206,21 +1168,19 @@ function getSystemIcon(objects, id, level, themeType, lang, imagePrefix) {
|
|
|
1206
1168
|
return icon || null;
|
|
1207
1169
|
}
|
|
1208
1170
|
function getObjectTooltip(data, lang) {
|
|
1209
|
-
|
|
1210
|
-
if ((_c = (_b = data === null || data === void 0 ? void 0 : data.obj) === null || _b === void 0 ? void 0 : _b.common) === null || _c === void 0 ? void 0 : _c.desc) {
|
|
1171
|
+
if (data?.obj?.common?.desc) {
|
|
1211
1172
|
return getName(data.obj.common.desc, lang) || null;
|
|
1212
1173
|
}
|
|
1213
1174
|
return null;
|
|
1214
1175
|
}
|
|
1215
1176
|
function getIdFieldTooltip(data, lang) {
|
|
1216
1177
|
const tooltip = getObjectTooltip(data, lang);
|
|
1217
|
-
if (tooltip
|
|
1218
|
-
return (
|
|
1178
|
+
if (tooltip?.startsWith('http')) {
|
|
1179
|
+
return (React.createElement(Box, { component: "a", sx: styles.cellIdTooltipLink, href: tooltip, target: "_blank", rel: "noreferrer" }, tooltip));
|
|
1219
1180
|
}
|
|
1220
|
-
return
|
|
1181
|
+
return React.createElement("span", { style: styles.cellIdTooltip }, tooltip || data.id || '');
|
|
1221
1182
|
}
|
|
1222
1183
|
function buildTree(objects, options) {
|
|
1223
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1224
1184
|
const imagePrefix = options.imagePrefix || '.';
|
|
1225
1185
|
let ids = Object.keys(objects);
|
|
1226
1186
|
ids.sort((a, b) => {
|
|
@@ -1288,12 +1248,12 @@ function buildTree(objects, options) {
|
|
|
1288
1248
|
else if (obj.type === 'enum') {
|
|
1289
1249
|
info.enums.push(id);
|
|
1290
1250
|
}
|
|
1291
|
-
else if (obj.type === 'instance' && common && (common.supportCustoms ||
|
|
1251
|
+
else if (obj.type === 'instance' && common && (common.supportCustoms || common.adminUI?.custom)) {
|
|
1292
1252
|
info.hasSomeCustoms = true;
|
|
1293
1253
|
info.customs.push(id.substring('system.adapter.'.length));
|
|
1294
1254
|
}
|
|
1295
1255
|
// Build a map of aliases
|
|
1296
|
-
if (id.startsWith('alias.') &&
|
|
1256
|
+
if (id.startsWith('alias.') && obj.common.alias?.id) {
|
|
1297
1257
|
if (typeof obj.common.alias.id === 'string') {
|
|
1298
1258
|
const usedId = obj.common.alias.id;
|
|
1299
1259
|
if (!info.aliasesMap[usedId]) {
|
|
@@ -1364,24 +1324,24 @@ function buildTree(objects, options) {
|
|
|
1364
1324
|
const _cRoot = {
|
|
1365
1325
|
data: {
|
|
1366
1326
|
name: parts[parts.length - 1],
|
|
1367
|
-
title: getName(
|
|
1327
|
+
title: getName(obj?.common?.name, options.lang),
|
|
1368
1328
|
obj,
|
|
1369
1329
|
parent: cRoot,
|
|
1370
1330
|
icon: getSelectIdIconFromObjects(objects, id, options.lang, imagePrefix) ||
|
|
1371
1331
|
getSystemIcon(objects, id, 0, options.themeType, options.lang, imagePrefix),
|
|
1372
1332
|
id,
|
|
1373
|
-
hasCustoms: !!(
|
|
1333
|
+
hasCustoms: !!(obj.common?.custom && Object.keys(obj.common.custom).length),
|
|
1374
1334
|
level: parts.length - 1,
|
|
1375
1335
|
generated: false,
|
|
1376
1336
|
button: obj.type === 'state' &&
|
|
1377
|
-
!!
|
|
1337
|
+
!!obj.common?.role &&
|
|
1378
1338
|
typeof obj.common.role === 'string' &&
|
|
1379
1339
|
obj.common.role.startsWith('button') &&
|
|
1380
|
-
|
|
1340
|
+
obj.common?.write !== false,
|
|
1381
1341
|
switch: obj.type === 'state' &&
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1342
|
+
obj.common?.type === 'boolean' &&
|
|
1343
|
+
obj.common?.write !== false &&
|
|
1344
|
+
obj.common?.read !== false,
|
|
1385
1345
|
},
|
|
1386
1346
|
};
|
|
1387
1347
|
cRoot.children = cRoot.children || [];
|
|
@@ -1422,9 +1382,8 @@ function buildTree(objects, options) {
|
|
|
1422
1382
|
} while (repeat);
|
|
1423
1383
|
}
|
|
1424
1384
|
info.roomEnums.sort((a, b) => {
|
|
1425
|
-
|
|
1426
|
-
const
|
|
1427
|
-
const bName = getName((_e = (_d = objects[b]) === null || _d === void 0 ? void 0 : _d.common) === null || _e === void 0 ? void 0 : _e.name, options.lang) || b.split('.').pop();
|
|
1385
|
+
const aName = getName(objects[a]?.common?.name, options.lang) || a.split('.').pop();
|
|
1386
|
+
const bName = getName(objects[b]?.common?.name, options.lang) || b.split('.').pop();
|
|
1428
1387
|
if (aName > bName) {
|
|
1429
1388
|
return 1;
|
|
1430
1389
|
}
|
|
@@ -1434,9 +1393,8 @@ function buildTree(objects, options) {
|
|
|
1434
1393
|
return 0;
|
|
1435
1394
|
});
|
|
1436
1395
|
info.funcEnums.sort((a, b) => {
|
|
1437
|
-
|
|
1438
|
-
const
|
|
1439
|
-
const bName = getName((_e = (_d = objects[b]) === null || _d === void 0 ? void 0 : _d.common) === null || _e === void 0 ? void 0 : _e.name, options.lang) || b.split('.').pop();
|
|
1396
|
+
const aName = getName(objects[a]?.common?.name, options.lang) || a.split('.').pop();
|
|
1397
|
+
const bName = getName(objects[b]?.common?.name, options.lang) || b.split('.').pop();
|
|
1440
1398
|
if (aName > bName) {
|
|
1441
1399
|
return 1;
|
|
1442
1400
|
}
|
|
@@ -1481,18 +1439,17 @@ function findNode(root, id, _parts, _path, _level) {
|
|
|
1481
1439
|
return null;
|
|
1482
1440
|
}
|
|
1483
1441
|
function findRoomsForObject(info, id, lang, rooms) {
|
|
1484
|
-
var _b, _c;
|
|
1485
1442
|
if (!id) {
|
|
1486
1443
|
return { rooms: [], per: false };
|
|
1487
1444
|
}
|
|
1488
1445
|
rooms = rooms || [];
|
|
1489
1446
|
for (const room of info.roomEnums) {
|
|
1490
|
-
const common =
|
|
1447
|
+
const common = info.objects[room]?.common;
|
|
1491
1448
|
if (!common) {
|
|
1492
1449
|
continue;
|
|
1493
1450
|
}
|
|
1494
1451
|
const name = getName(common.name, lang);
|
|
1495
|
-
if (
|
|
1452
|
+
if (common.members?.includes(id) && !rooms.includes(name)) {
|
|
1496
1453
|
rooms.push(name);
|
|
1497
1454
|
}
|
|
1498
1455
|
}
|
|
@@ -1508,14 +1465,13 @@ function findRoomsForObject(info, id, lang, rooms) {
|
|
|
1508
1465
|
return { rooms, per: !ownEnums }; // per is if the enums are from parent
|
|
1509
1466
|
}
|
|
1510
1467
|
function findEnumsForObjectAsIds(info, id, enumName, funcs) {
|
|
1511
|
-
var _b, _c;
|
|
1512
1468
|
if (!id) {
|
|
1513
1469
|
return [];
|
|
1514
1470
|
}
|
|
1515
1471
|
funcs = funcs || [];
|
|
1516
1472
|
for (let i = 0; i < info[enumName].length; i++) {
|
|
1517
|
-
const common =
|
|
1518
|
-
if (
|
|
1473
|
+
const common = info.objects[info[enumName][i]]?.common;
|
|
1474
|
+
if (common?.members?.includes(id) && !funcs.includes(info[enumName][i])) {
|
|
1519
1475
|
funcs.push(info[enumName][i]);
|
|
1520
1476
|
}
|
|
1521
1477
|
}
|
|
@@ -1523,18 +1479,17 @@ function findEnumsForObjectAsIds(info, id, enumName, funcs) {
|
|
|
1523
1479
|
return funcs;
|
|
1524
1480
|
}
|
|
1525
1481
|
function findFunctionsForObject(info, id, lang, funcs) {
|
|
1526
|
-
var _b, _c;
|
|
1527
1482
|
if (!id) {
|
|
1528
1483
|
return { funcs: [], pef: false };
|
|
1529
1484
|
}
|
|
1530
1485
|
funcs = funcs || [];
|
|
1531
1486
|
for (let i = 0; i < info.funcEnums.length; i++) {
|
|
1532
|
-
const common =
|
|
1487
|
+
const common = info.objects[info.funcEnums[i]]?.common;
|
|
1533
1488
|
if (!common) {
|
|
1534
1489
|
continue;
|
|
1535
1490
|
}
|
|
1536
1491
|
const name = getName(common.name, lang);
|
|
1537
|
-
if (
|
|
1492
|
+
if (common.members?.includes(id) && !funcs.includes(name)) {
|
|
1538
1493
|
funcs.push(name);
|
|
1539
1494
|
}
|
|
1540
1495
|
}
|
|
@@ -1570,12 +1525,12 @@ function quality2text(q) {
|
|
|
1570
1525
|
*/
|
|
1571
1526
|
function formatValue(options) {
|
|
1572
1527
|
const { dateFormat, state, isFloatComma, texts, obj } = options;
|
|
1573
|
-
const states =
|
|
1528
|
+
const states = Utils.getStates(obj);
|
|
1574
1529
|
const isCommon = obj.common;
|
|
1575
1530
|
let fileViewer;
|
|
1576
1531
|
let v =
|
|
1577
1532
|
// @ts-expect-error deprecated from js-controller 6
|
|
1578
|
-
|
|
1533
|
+
isCommon?.type === 'file'
|
|
1579
1534
|
? '[file]'
|
|
1580
1535
|
: !state || state.val === null
|
|
1581
1536
|
? '(null)'
|
|
@@ -1583,9 +1538,9 @@ function formatValue(options) {
|
|
|
1583
1538
|
? '[undef]'
|
|
1584
1539
|
: state.val;
|
|
1585
1540
|
const type = typeof v;
|
|
1586
|
-
if (
|
|
1541
|
+
if (isCommon?.role && typeof isCommon.role === 'string' && isCommon.role.match(/^value\.time|^date/)) {
|
|
1587
1542
|
if (v && typeof v === 'string') {
|
|
1588
|
-
if (
|
|
1543
|
+
if (Utils.isStringInteger(v)) {
|
|
1589
1544
|
// we assume a unix ts
|
|
1590
1545
|
v = new Date(parseInt(v, 10)).toString();
|
|
1591
1546
|
}
|
|
@@ -1593,11 +1548,11 @@ function formatValue(options) {
|
|
|
1593
1548
|
// check if parsable by new date
|
|
1594
1549
|
try {
|
|
1595
1550
|
const parsedDate = new Date(v);
|
|
1596
|
-
if (
|
|
1551
|
+
if (Utils.isValidDate(parsedDate)) {
|
|
1597
1552
|
v = parsedDate.toString();
|
|
1598
1553
|
}
|
|
1599
1554
|
}
|
|
1600
|
-
catch
|
|
1555
|
+
catch {
|
|
1601
1556
|
// ignore
|
|
1602
1557
|
}
|
|
1603
1558
|
}
|
|
@@ -1605,7 +1560,7 @@ function formatValue(options) {
|
|
|
1605
1560
|
else {
|
|
1606
1561
|
if (v > 946681200 && v < 946681200000) {
|
|
1607
1562
|
// '2000-01-01T00:00:00' => 946681200000
|
|
1608
|
-
v *=
|
|
1563
|
+
v *= 1_000; // maybe the time is in seconds (UNIX time)
|
|
1609
1564
|
}
|
|
1610
1565
|
// "null" and undefined could not be here. See `let v = (isCommon && isCommon.type === 'file') ....` above
|
|
1611
1566
|
v = v ? new Date(v).toString() : v;
|
|
@@ -1614,7 +1569,7 @@ function formatValue(options) {
|
|
|
1614
1569
|
else {
|
|
1615
1570
|
if (type === 'number') {
|
|
1616
1571
|
if (!Number.isInteger(v)) {
|
|
1617
|
-
v = Math.round(v *
|
|
1572
|
+
v = Math.round(v * 100_000_000) / 100_000_000; // remove 4.00000000000000001
|
|
1618
1573
|
if (isFloatComma) {
|
|
1619
1574
|
v = v.toString().replace('.', ',');
|
|
1620
1575
|
}
|
|
@@ -1642,7 +1597,7 @@ function formatValue(options) {
|
|
|
1642
1597
|
valText.v = v;
|
|
1643
1598
|
}
|
|
1644
1599
|
}
|
|
1645
|
-
if (isCommon
|
|
1600
|
+
if (isCommon?.unit) {
|
|
1646
1601
|
valText.u = isCommon.unit;
|
|
1647
1602
|
}
|
|
1648
1603
|
let valFull;
|
|
@@ -1653,10 +1608,10 @@ function formatValue(options) {
|
|
|
1653
1608
|
valFull.push({ t: texts.ack, v: state.ack.toString() });
|
|
1654
1609
|
}
|
|
1655
1610
|
if (state.ts) {
|
|
1656
|
-
valFull.push({ t: texts.ts, v: state.ts ?
|
|
1611
|
+
valFull.push({ t: texts.ts, v: state.ts ? Utils.formatDate(new Date(state.ts), dateFormat) : '' });
|
|
1657
1612
|
}
|
|
1658
1613
|
if (state.lc) {
|
|
1659
|
-
valFull.push({ t: texts.lc, v: state.lc ?
|
|
1614
|
+
valFull.push({ t: texts.lc, v: state.lc ? Utils.formatDate(new Date(state.lc), dateFormat) : '' });
|
|
1660
1615
|
}
|
|
1661
1616
|
if (state.from) {
|
|
1662
1617
|
let from = state.from.toString();
|
|
@@ -1675,7 +1630,7 @@ function formatValue(options) {
|
|
|
1675
1630
|
if (state.c) {
|
|
1676
1631
|
valFull.push({ t: texts.c, v: state.c });
|
|
1677
1632
|
}
|
|
1678
|
-
valFull.push({ t: texts.quality, v:
|
|
1633
|
+
valFull.push({ t: texts.quality, v: Utils.quality2text(state.q || 0).join(', '), nbr: true });
|
|
1679
1634
|
}
|
|
1680
1635
|
}
|
|
1681
1636
|
return {
|
|
@@ -1689,7 +1644,7 @@ function formatValue(options) {
|
|
|
1689
1644
|
*/
|
|
1690
1645
|
function getValueStyle(options) {
|
|
1691
1646
|
const { state /* , isExpertMode, isButton */ } = options;
|
|
1692
|
-
const color =
|
|
1647
|
+
const color = state?.ack ? (state.q ? '#ffa500' : '') : '#ff2222c9';
|
|
1693
1648
|
// do not show the color of the button in non-expert mode
|
|
1694
1649
|
// if (!isExpertMode && isButton) {
|
|
1695
1650
|
// color = '';
|
|
@@ -1729,22 +1684,22 @@ function prepareSparkData(values, from) {
|
|
|
1729
1684
|
}
|
|
1730
1685
|
return v;
|
|
1731
1686
|
}
|
|
1732
|
-
|
|
1733
|
-
state: (
|
|
1734
|
-
channel: (
|
|
1735
|
-
device: (
|
|
1736
|
-
adapter: (
|
|
1737
|
-
meta: (
|
|
1738
|
-
instance: (
|
|
1739
|
-
enum: (
|
|
1740
|
-
chart: (
|
|
1741
|
-
config: (
|
|
1742
|
-
group: (
|
|
1743
|
-
user: (
|
|
1744
|
-
host: (
|
|
1745
|
-
schedule: (
|
|
1746
|
-
script: (
|
|
1747
|
-
folder: (
|
|
1687
|
+
export const ITEM_IMAGES = {
|
|
1688
|
+
state: (React.createElement(IconState, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1689
|
+
channel: (React.createElement(IconChannel, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1690
|
+
device: (React.createElement(IconDevice, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1691
|
+
adapter: (React.createElement(IconAdapter, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1692
|
+
meta: (React.createElement(IconMeta, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1693
|
+
instance: (React.createElement(IconInstance, { className: "itemIcon", style: { color: '#7da7ff', verticalAlign: 'middle' } })),
|
|
1694
|
+
enum: (React.createElement(IconEnum, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1695
|
+
chart: (React.createElement(IconChart, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1696
|
+
config: (React.createElement(IconConfig, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1697
|
+
group: (React.createElement(IconGroup, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1698
|
+
user: (React.createElement(IconUser, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1699
|
+
host: (React.createElement(IconHost, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1700
|
+
schedule: (React.createElement(IconSchedule, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1701
|
+
script: (React.createElement(IconScript, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1702
|
+
folder: (React.createElement(IconClosed, { className: "itemIcon itemIconFolder", style: { verticalAlign: 'middle' } })),
|
|
1748
1703
|
};
|
|
1749
1704
|
const SCREEN_WIDTHS = {
|
|
1750
1705
|
// extra-small: 0px
|
|
@@ -1836,445 +1791,73 @@ const DEFAULT_FILTER = {
|
|
|
1836
1791
|
custom: '',
|
|
1837
1792
|
expertMode: false,
|
|
1838
1793
|
};
|
|
1839
|
-
class ObjectBrowserClass extends
|
|
1794
|
+
export class ObjectBrowserClass extends Component {
|
|
1795
|
+
// do not define the type as null to save the performance, so we must check it every time
|
|
1796
|
+
info = {
|
|
1797
|
+
funcEnums: [],
|
|
1798
|
+
roomEnums: [],
|
|
1799
|
+
roles: [],
|
|
1800
|
+
ids: [],
|
|
1801
|
+
types: [],
|
|
1802
|
+
objects: {},
|
|
1803
|
+
customs: [],
|
|
1804
|
+
enums: [],
|
|
1805
|
+
hasSomeCustoms: false,
|
|
1806
|
+
aliasesMap: {},
|
|
1807
|
+
};
|
|
1808
|
+
localStorage = window._localStorage || window.localStorage;
|
|
1809
|
+
lastAppliedFilter = null;
|
|
1810
|
+
tableRef;
|
|
1811
|
+
filterRefs;
|
|
1812
|
+
pausedSubscribes = false;
|
|
1813
|
+
selectFirst;
|
|
1814
|
+
root = null;
|
|
1815
|
+
states = {};
|
|
1816
|
+
subscribes = [];
|
|
1817
|
+
unsubscribeTimer = null;
|
|
1818
|
+
statesUpdateTimer = null;
|
|
1819
|
+
objectsUpdateTimer = null;
|
|
1820
|
+
filterTimer = null;
|
|
1821
|
+
visibleCols;
|
|
1822
|
+
texts;
|
|
1823
|
+
possibleCols;
|
|
1824
|
+
imagePrefix;
|
|
1825
|
+
adapterColumns = [];
|
|
1826
|
+
styleTheme = '';
|
|
1827
|
+
edit = {
|
|
1828
|
+
id: '',
|
|
1829
|
+
val: '',
|
|
1830
|
+
q: 0,
|
|
1831
|
+
ack: false,
|
|
1832
|
+
};
|
|
1833
|
+
levelPadding;
|
|
1834
|
+
customWidth = false;
|
|
1835
|
+
resizeTimeout = null;
|
|
1836
|
+
resizerNextName = null;
|
|
1837
|
+
resizerActiveName = null;
|
|
1838
|
+
resizerCurrentWidths = {};
|
|
1839
|
+
resizeLeft = false;
|
|
1840
|
+
resizerOldWidth = 0;
|
|
1841
|
+
resizerMin = 0;
|
|
1842
|
+
resizerNextMin = 0;
|
|
1843
|
+
resizerOldWidthNext = 0;
|
|
1844
|
+
resizerPosition = 0;
|
|
1845
|
+
resizerActiveDiv = null;
|
|
1846
|
+
resizerNextDiv = null;
|
|
1847
|
+
storedWidths = null;
|
|
1848
|
+
systemConfig;
|
|
1849
|
+
objects;
|
|
1850
|
+
defaultHistory = '';
|
|
1851
|
+
columnsVisibility = {};
|
|
1852
|
+
changedIds = null;
|
|
1853
|
+
contextMenu = null;
|
|
1854
|
+
recordStates = [];
|
|
1855
|
+
styles = {};
|
|
1856
|
+
customColumnDialog = null;
|
|
1857
|
+
/** Namespaces which are allowed to be edited by non-expert users */
|
|
1858
|
+
static #NON_EXPERT_NAMESPACES = ['0_userdata.0.', 'alias.0.'];
|
|
1840
1859
|
constructor(props) {
|
|
1841
1860
|
super(props);
|
|
1842
|
-
// do not define the type as null to save the performance, so we must check it every time
|
|
1843
|
-
this.info = {
|
|
1844
|
-
funcEnums: [],
|
|
1845
|
-
roomEnums: [],
|
|
1846
|
-
roles: [],
|
|
1847
|
-
ids: [],
|
|
1848
|
-
types: [],
|
|
1849
|
-
objects: {},
|
|
1850
|
-
customs: [],
|
|
1851
|
-
enums: [],
|
|
1852
|
-
hasSomeCustoms: false,
|
|
1853
|
-
aliasesMap: {},
|
|
1854
|
-
};
|
|
1855
|
-
this.localStorage = window._localStorage || window.localStorage;
|
|
1856
|
-
this.lastAppliedFilter = null;
|
|
1857
|
-
this.pausedSubscribes = false;
|
|
1858
|
-
this.root = null;
|
|
1859
|
-
this.states = {};
|
|
1860
|
-
this.subscribes = [];
|
|
1861
|
-
this.unsubscribeTimer = null;
|
|
1862
|
-
this.statesUpdateTimer = null;
|
|
1863
|
-
this.objectsUpdateTimer = null;
|
|
1864
|
-
this.filterTimer = null;
|
|
1865
|
-
this.adapterColumns = [];
|
|
1866
|
-
this.styleTheme = '';
|
|
1867
|
-
this.edit = {
|
|
1868
|
-
id: '',
|
|
1869
|
-
val: '',
|
|
1870
|
-
q: 0,
|
|
1871
|
-
ack: false,
|
|
1872
|
-
};
|
|
1873
|
-
this.customWidth = false;
|
|
1874
|
-
this.resizeTimeout = null;
|
|
1875
|
-
this.resizerNextName = null;
|
|
1876
|
-
this.resizerActiveName = null;
|
|
1877
|
-
this.resizerCurrentWidths = {};
|
|
1878
|
-
this.resizeLeft = false;
|
|
1879
|
-
this.resizerOldWidth = 0;
|
|
1880
|
-
this.resizerMin = 0;
|
|
1881
|
-
this.resizerNextMin = 0;
|
|
1882
|
-
this.resizerOldWidthNext = 0;
|
|
1883
|
-
this.resizerPosition = 0;
|
|
1884
|
-
this.resizerActiveDiv = null;
|
|
1885
|
-
this.resizerNextDiv = null;
|
|
1886
|
-
this.storedWidths = null;
|
|
1887
|
-
this.defaultHistory = '';
|
|
1888
|
-
this.columnsVisibility = {};
|
|
1889
|
-
this.changedIds = null;
|
|
1890
|
-
this.contextMenu = null;
|
|
1891
|
-
this.recordStates = [];
|
|
1892
|
-
this.styles = {};
|
|
1893
|
-
this.customColumnDialog = null;
|
|
1894
|
-
/**
|
|
1895
|
-
* Context menu handler.
|
|
1896
|
-
*/
|
|
1897
|
-
this.onContextMenu = (e) => {
|
|
1898
|
-
// console.log(`CONTEXT MENU: ${this.contextMenu ? Date.now() - this.contextMenu.ts : 'false'}`);
|
|
1899
|
-
if (this.contextMenu && Date.now() - this.contextMenu.ts < 2000) {
|
|
1900
|
-
e.preventDefault();
|
|
1901
|
-
this.setState({
|
|
1902
|
-
showContextMenu: {
|
|
1903
|
-
item: this.contextMenu.item,
|
|
1904
|
-
position: { left: e.clientX + 2, top: e.clientY - 6 },
|
|
1905
|
-
},
|
|
1906
|
-
});
|
|
1907
|
-
}
|
|
1908
|
-
else if (this.state.showContextMenu) {
|
|
1909
|
-
e.preventDefault();
|
|
1910
|
-
this.setState({ showContextMenu: null });
|
|
1911
|
-
}
|
|
1912
|
-
this.contextMenu = null;
|
|
1913
|
-
};
|
|
1914
|
-
/**
|
|
1915
|
-
* Called when a state changes.
|
|
1916
|
-
*/
|
|
1917
|
-
this.onStateChange = (id, state) => {
|
|
1918
|
-
console.log(`> stateChange ${id}`);
|
|
1919
|
-
if (this.states[id]) {
|
|
1920
|
-
const item = this.findItem(id);
|
|
1921
|
-
if (item === null || item === void 0 ? void 0 : item.data.state) {
|
|
1922
|
-
item.data.state = undefined;
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
if (state) {
|
|
1926
|
-
this.states[id] = state;
|
|
1927
|
-
}
|
|
1928
|
-
else {
|
|
1929
|
-
delete this.states[id];
|
|
1930
|
-
}
|
|
1931
|
-
if (!this.pausedSubscribes) {
|
|
1932
|
-
if (!this.statesUpdateTimer) {
|
|
1933
|
-
this.statesUpdateTimer = setTimeout(() => {
|
|
1934
|
-
this.statesUpdateTimer = null;
|
|
1935
|
-
this.forceUpdate();
|
|
1936
|
-
}, 300);
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
else if (this.statesUpdateTimer) {
|
|
1940
|
-
clearTimeout(this.statesUpdateTimer);
|
|
1941
|
-
this.statesUpdateTimer = null;
|
|
1942
|
-
}
|
|
1943
|
-
};
|
|
1944
|
-
this.onObjectChangeFromWorker = (events) => {
|
|
1945
|
-
if (Array.isArray(events)) {
|
|
1946
|
-
let newState = null;
|
|
1947
|
-
events.forEach(event => {
|
|
1948
|
-
const { newInnerState, filtered } = this.processOnObjectChangeElement(event.id, event.obj);
|
|
1949
|
-
if (filtered) {
|
|
1950
|
-
return;
|
|
1951
|
-
}
|
|
1952
|
-
if (newInnerState && newState) {
|
|
1953
|
-
Object.assign(newState, newInnerState);
|
|
1954
|
-
}
|
|
1955
|
-
else {
|
|
1956
|
-
newState = newInnerState;
|
|
1957
|
-
}
|
|
1958
|
-
});
|
|
1959
|
-
if (newState) {
|
|
1960
|
-
this.setState(newState);
|
|
1961
|
-
}
|
|
1962
|
-
this.afterObjectUpdated();
|
|
1963
|
-
}
|
|
1964
|
-
};
|
|
1965
|
-
this.onObjectChange = (id, obj) => {
|
|
1966
|
-
const { newInnerState, filtered } = this.processOnObjectChangeElement(id, obj);
|
|
1967
|
-
if (filtered) {
|
|
1968
|
-
return;
|
|
1969
|
-
}
|
|
1970
|
-
if (newInnerState) {
|
|
1971
|
-
this.setState(newInnerState);
|
|
1972
|
-
}
|
|
1973
|
-
this.afterObjectUpdated();
|
|
1974
|
-
};
|
|
1975
|
-
this.getEnumsForId = (id) => {
|
|
1976
|
-
const result = [];
|
|
1977
|
-
this.info.enums.forEach(_id => {
|
|
1978
|
-
var _b, _c, _d;
|
|
1979
|
-
if ((_d = (_c = (_b = this.objects[_id]) === null || _b === void 0 ? void 0 : _b.common) === null || _c === void 0 ? void 0 : _c.members) === null || _d === void 0 ? void 0 : _d.includes(id)) {
|
|
1980
|
-
const enumItem = {
|
|
1981
|
-
_id: this.objects[_id]._id,
|
|
1982
|
-
common: JSON.parse(JSON.stringify(this.objects[_id].common)),
|
|
1983
|
-
native: this.objects[_id].native,
|
|
1984
|
-
type: 'enum',
|
|
1985
|
-
};
|
|
1986
|
-
if (enumItem.common) {
|
|
1987
|
-
delete enumItem.common.members;
|
|
1988
|
-
delete enumItem.common.custom;
|
|
1989
|
-
// @ts-expect-error deprecated attribute
|
|
1990
|
-
delete enumItem.common.mobile;
|
|
1991
|
-
}
|
|
1992
|
-
result.push(enumItem);
|
|
1993
|
-
}
|
|
1994
|
-
});
|
|
1995
|
-
return result.length ? result : undefined;
|
|
1996
|
-
};
|
|
1997
|
-
this._createAllEnums = async (enums, objId) => {
|
|
1998
|
-
var _b, _c;
|
|
1999
|
-
for (let e = 0; e < enums.length; e++) {
|
|
2000
|
-
const item = enums[e];
|
|
2001
|
-
let id;
|
|
2002
|
-
let newObj;
|
|
2003
|
-
// some admin version delivered enums as string
|
|
2004
|
-
if (typeof item === 'object') {
|
|
2005
|
-
newObj = item;
|
|
2006
|
-
id = newObj._id;
|
|
2007
|
-
}
|
|
2008
|
-
else {
|
|
2009
|
-
id = item;
|
|
2010
|
-
}
|
|
2011
|
-
let oldObj = this.objects[id];
|
|
2012
|
-
// if enum does not exist
|
|
2013
|
-
if (!oldObj) {
|
|
2014
|
-
// create a new one
|
|
2015
|
-
oldObj =
|
|
2016
|
-
newObj ||
|
|
2017
|
-
{
|
|
2018
|
-
_id: id,
|
|
2019
|
-
common: {
|
|
2020
|
-
name: id.split('.').pop(),
|
|
2021
|
-
members: [],
|
|
2022
|
-
},
|
|
2023
|
-
native: {},
|
|
2024
|
-
type: 'enum',
|
|
2025
|
-
};
|
|
2026
|
-
oldObj.common = oldObj.common || {};
|
|
2027
|
-
oldObj.common.members = [objId];
|
|
2028
|
-
oldObj.type = 'enum';
|
|
2029
|
-
await this.props.socket.setObject(id, oldObj);
|
|
2030
|
-
}
|
|
2031
|
-
else if (!((_c = (_b = oldObj.common) === null || _b === void 0 ? void 0 : _b.members) === null || _c === void 0 ? void 0 : _c.includes(objId))) {
|
|
2032
|
-
oldObj.common = oldObj.common || {};
|
|
2033
|
-
oldObj.type = 'enum';
|
|
2034
|
-
oldObj.common.members = oldObj.common.members || [];
|
|
2035
|
-
// add the missing object
|
|
2036
|
-
oldObj.common.members.push(objId);
|
|
2037
|
-
oldObj.common.members.sort();
|
|
2038
|
-
await this.props.socket.setObject(id, oldObj);
|
|
2039
|
-
}
|
|
2040
|
-
}
|
|
2041
|
-
};
|
|
2042
|
-
this.toolTipObjectCreating = () => {
|
|
2043
|
-
var _b, _c;
|
|
2044
|
-
const { t } = this.props;
|
|
2045
|
-
let value = [
|
|
2046
|
-
react_1.default.createElement("div", { key: 1 }, t('ra_Only following structures of objects are available:')),
|
|
2047
|
-
react_1.default.createElement("div", { key: 2 }, t('ra_Folder → State')),
|
|
2048
|
-
react_1.default.createElement("div", { key: 3 }, t('ra_Folder → Channel → State')),
|
|
2049
|
-
react_1.default.createElement("div", { key: 4 }, t('ra_Folder → Device → Channel → State')),
|
|
2050
|
-
react_1.default.createElement("div", { key: 5 }, t('ra_Device → Channel → State')),
|
|
2051
|
-
react_1.default.createElement("div", { key: 6 }, t('ra_Channel → State')),
|
|
2052
|
-
react_1.default.createElement("div", { key: 7, style: { height: 10 } }),
|
|
2053
|
-
react_1.default.createElement("div", { key: 8 }, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),
|
|
2054
|
-
react_1.default.createElement("div", { key: 9 }, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").')),
|
|
2055
|
-
];
|
|
2056
|
-
if (this.state.selected.length || this.state.selectedNonObject) {
|
|
2057
|
-
const id = this.state.selected[0] || this.state.selectedNonObject;
|
|
2058
|
-
if (id.split('.').length < 2 || (this.objects[id] && ((_b = this.objects[id]) === null || _b === void 0 ? void 0 : _b.type) === 'state')) {
|
|
2059
|
-
// show default tooltip
|
|
2060
|
-
}
|
|
2061
|
-
else if (this.state.filter.expertMode) {
|
|
2062
|
-
switch ((_c = this.objects[id]) === null || _c === void 0 ? void 0 : _c.type) {
|
|
2063
|
-
case 'device':
|
|
2064
|
-
value = [
|
|
2065
|
-
react_1.default.createElement("div", { key: 1 }, t('ra_Only following structures of objects are available:')),
|
|
2066
|
-
react_1.default.createElement("div", { key: 5 }, t('ra_Device → Channel → State')),
|
|
2067
|
-
react_1.default.createElement("div", { key: 7, style: { height: 10 } }),
|
|
2068
|
-
react_1.default.createElement("div", { key: 8 }, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),
|
|
2069
|
-
react_1.default.createElement("div", { key: 9 }, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").')),
|
|
2070
|
-
];
|
|
2071
|
-
break;
|
|
2072
|
-
case 'folder':
|
|
2073
|
-
value = [
|
|
2074
|
-
react_1.default.createElement("div", { key: 1 }, t('ra_Only following structures of objects are available:')),
|
|
2075
|
-
react_1.default.createElement("div", { key: 2 }, t('ra_Folder → State')),
|
|
2076
|
-
react_1.default.createElement("div", { key: 3 }, t('ra_Folder → Channel → State')),
|
|
2077
|
-
react_1.default.createElement("div", { key: 4 }, t('ra_Folder → Device → Channel → State')),
|
|
2078
|
-
react_1.default.createElement("div", { key: 7, style: { height: 10 } }),
|
|
2079
|
-
react_1.default.createElement("div", { key: 8 }, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),
|
|
2080
|
-
react_1.default.createElement("div", { key: 9 }, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").')),
|
|
2081
|
-
];
|
|
2082
|
-
break;
|
|
2083
|
-
case 'channel':
|
|
2084
|
-
value = [
|
|
2085
|
-
react_1.default.createElement("div", { key: 1 }, t('ra_Only following structures of objects are available:')),
|
|
2086
|
-
react_1.default.createElement("div", { key: 1 }, t('ra_Channel → State')),
|
|
2087
|
-
react_1.default.createElement("div", { key: 7, style: { height: 10 } }),
|
|
2088
|
-
react_1.default.createElement("div", { key: 8 }, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),
|
|
2089
|
-
react_1.default.createElement("div", { key: 9 }, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").')),
|
|
2090
|
-
];
|
|
2091
|
-
break;
|
|
2092
|
-
default:
|
|
2093
|
-
break;
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
else if (id.startsWith('alias.0') || id.startsWith('0_userdata')) {
|
|
2097
|
-
value = [
|
|
2098
|
-
react_1.default.createElement("div", { key: 1 }, t('ra_Only following structures of objects are available:')),
|
|
2099
|
-
react_1.default.createElement("div", { key: 2 }, t('ra_Folder → State')),
|
|
2100
|
-
react_1.default.createElement("div", { key: 3 }, t('ra_Folder → Channel → State')),
|
|
2101
|
-
react_1.default.createElement("div", { key: 4 }, t('ra_Folder → Device → Channel → State')),
|
|
2102
|
-
react_1.default.createElement("div", { key: 5 }, t('ra_Device → Channel → State')),
|
|
2103
|
-
react_1.default.createElement("div", { key: 6 }, t('ra_Channel → State')),
|
|
2104
|
-
react_1.default.createElement("div", { key: 7, style: { height: 10 } }),
|
|
2105
|
-
react_1.default.createElement("div", { key: 7 }, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),
|
|
2106
|
-
react_1.default.createElement("div", { key: 8 }, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").')),
|
|
2107
|
-
];
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
return value.length ? value : t('ra_Add new child object to selected parent');
|
|
2111
|
-
};
|
|
2112
|
-
this.renderTooltipAccessControl = (acl) => {
|
|
2113
|
-
// acl ={object,state,owner,ownerGroup}
|
|
2114
|
-
if (!acl) {
|
|
2115
|
-
return null;
|
|
2116
|
-
}
|
|
2117
|
-
const check = [
|
|
2118
|
-
{
|
|
2119
|
-
value: '0x400',
|
|
2120
|
-
valueNum: 0x400,
|
|
2121
|
-
title: 'read',
|
|
2122
|
-
group: 'Owner',
|
|
2123
|
-
},
|
|
2124
|
-
{
|
|
2125
|
-
value: '0x200',
|
|
2126
|
-
valueNum: 0x200,
|
|
2127
|
-
title: 'write',
|
|
2128
|
-
group: 'Owner',
|
|
2129
|
-
},
|
|
2130
|
-
{
|
|
2131
|
-
value: '0x40',
|
|
2132
|
-
valueNum: 0x40,
|
|
2133
|
-
title: 'read',
|
|
2134
|
-
group: 'Group',
|
|
2135
|
-
},
|
|
2136
|
-
{
|
|
2137
|
-
value: '0x20',
|
|
2138
|
-
valueNum: 0x20,
|
|
2139
|
-
title: 'write',
|
|
2140
|
-
group: 'Group',
|
|
2141
|
-
},
|
|
2142
|
-
{
|
|
2143
|
-
value: '0x4',
|
|
2144
|
-
valueNum: 0x4,
|
|
2145
|
-
title: 'read',
|
|
2146
|
-
group: 'Everyone',
|
|
2147
|
-
},
|
|
2148
|
-
{
|
|
2149
|
-
value: '0x2',
|
|
2150
|
-
valueNum: 0x2,
|
|
2151
|
-
title: 'write',
|
|
2152
|
-
group: 'Everyone',
|
|
2153
|
-
},
|
|
2154
|
-
];
|
|
2155
|
-
const arrayTooltipText = [];
|
|
2156
|
-
const funcRenderStateObject = (value) => {
|
|
2157
|
-
const rights = acl[value];
|
|
2158
|
-
check.forEach((el, i) => {
|
|
2159
|
-
if (rights & el.valueNum) {
|
|
2160
|
-
arrayTooltipText.push(react_1.default.createElement("span", { key: value + i },
|
|
2161
|
-
this.texts[`acl${el.group}_${el.title}_${value}`],
|
|
2162
|
-
",",
|
|
2163
|
-
react_1.default.createElement("span", { style: value === 'object' ? styles.rightsObject : styles.rightsState }, el.value)));
|
|
2164
|
-
}
|
|
2165
|
-
});
|
|
2166
|
-
};
|
|
2167
|
-
arrayTooltipText.push(react_1.default.createElement("span", { key: "group" }, `${this.texts.ownerGroup}: ${(acl.ownerGroup || '').replace('system.group.', '')}`));
|
|
2168
|
-
arrayTooltipText.push(react_1.default.createElement("span", { key: "owner" }, `${this.texts.ownerUser}: ${(acl.owner || '').replace('system.user.', '')}`));
|
|
2169
|
-
funcRenderStateObject('object');
|
|
2170
|
-
if (acl.state) {
|
|
2171
|
-
funcRenderStateObject('state');
|
|
2172
|
-
}
|
|
2173
|
-
return arrayTooltipText.length ? (react_1.default.createElement("span", { style: styles.tooltipAccessControl }, arrayTooltipText.map(el => el))) : null;
|
|
2174
|
-
};
|
|
2175
|
-
this.resizerMouseMove = (e) => {
|
|
2176
|
-
if (this.resizerActiveDiv) {
|
|
2177
|
-
let width;
|
|
2178
|
-
let widthNext;
|
|
2179
|
-
if (this.resizeLeft) {
|
|
2180
|
-
width = this.resizerOldWidth - e.clientX + this.resizerPosition;
|
|
2181
|
-
widthNext = this.resizerOldWidthNext + e.clientX - this.resizerPosition;
|
|
2182
|
-
}
|
|
2183
|
-
else {
|
|
2184
|
-
width = this.resizerOldWidth + e.clientX - this.resizerPosition;
|
|
2185
|
-
widthNext = this.resizerOldWidthNext - e.clientX + this.resizerPosition;
|
|
2186
|
-
}
|
|
2187
|
-
if (this.resizerActiveName &&
|
|
2188
|
-
this.resizerNextName &&
|
|
2189
|
-
(!this.resizerMin || width > this.resizerMin) &&
|
|
2190
|
-
(!this.resizerNextMin || widthNext > this.resizerNextMin)) {
|
|
2191
|
-
this.resizerCurrentWidths[this.resizerActiveName] = width;
|
|
2192
|
-
this.resizerCurrentWidths[this.resizerNextName] = widthNext;
|
|
2193
|
-
this.resizerActiveDiv.style.width = `${width}px`;
|
|
2194
|
-
if (this.resizerNextDiv) {
|
|
2195
|
-
this.resizerNextDiv.style.width = `${widthNext}px`;
|
|
2196
|
-
}
|
|
2197
|
-
this.columnsVisibility[this.resizerActiveName] = width;
|
|
2198
|
-
this.columnsVisibility[this.resizerNextName] = widthNext;
|
|
2199
|
-
if (this.resizerNextName === 'nameHeader') {
|
|
2200
|
-
this.columnsVisibility.name = widthNext - this.state.scrollBarWidth;
|
|
2201
|
-
this.resizerCurrentWidths.name = widthNext - this.state.scrollBarWidth;
|
|
2202
|
-
}
|
|
2203
|
-
else if (this.resizerActiveName === 'nameHeader') {
|
|
2204
|
-
this.columnsVisibility.name = width - this.state.scrollBarWidth;
|
|
2205
|
-
this.resizerCurrentWidths.name = width - this.state.scrollBarWidth;
|
|
2206
|
-
}
|
|
2207
|
-
this.customWidth = true;
|
|
2208
|
-
if (this.resizeTimeout) {
|
|
2209
|
-
clearTimeout(this.resizeTimeout);
|
|
2210
|
-
}
|
|
2211
|
-
this.resizeTimeout = setTimeout(() => {
|
|
2212
|
-
this.resizeTimeout = null;
|
|
2213
|
-
this.forceUpdate();
|
|
2214
|
-
}, 200);
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
};
|
|
2218
|
-
this.resizerMouseUp = () => {
|
|
2219
|
-
this.localStorage.setItem(`${this.props.dialogName || 'App'}.table`, JSON.stringify(this.resizerCurrentWidths));
|
|
2220
|
-
this.resizerActiveName = null;
|
|
2221
|
-
this.resizerNextName = null;
|
|
2222
|
-
this.resizerActiveDiv = null;
|
|
2223
|
-
this.resizerNextDiv = null;
|
|
2224
|
-
window.removeEventListener('mousemove', this.resizerMouseMove);
|
|
2225
|
-
window.removeEventListener('mouseup', this.resizerMouseUp);
|
|
2226
|
-
};
|
|
2227
|
-
this.resizerMouseDown = (e) => {
|
|
2228
|
-
this.storedWidths =
|
|
2229
|
-
this.storedWidths ||
|
|
2230
|
-
JSON.parse(JSON.stringify(SCREEN_WIDTHS[this.props.width || 'lg']));
|
|
2231
|
-
this.resizerCurrentWidths = this.resizerCurrentWidths || {};
|
|
2232
|
-
this.resizerActiveDiv = e.target.parentNode;
|
|
2233
|
-
this.resizerActiveName = this.resizerActiveDiv.dataset.name || null;
|
|
2234
|
-
if (this.resizerActiveName) {
|
|
2235
|
-
let i = 0;
|
|
2236
|
-
if (e.target.dataset.left === 'true') {
|
|
2237
|
-
this.resizeLeft = true;
|
|
2238
|
-
this.resizerNextDiv = this.resizerActiveDiv.previousElementSibling;
|
|
2239
|
-
let handle = this.resizerNextDiv.querySelector('.iob-ob-resize-handler');
|
|
2240
|
-
while (this.resizerNextDiv && !handle && i < 10) {
|
|
2241
|
-
this.resizerNextDiv = this.resizerNextDiv.previousElementSibling;
|
|
2242
|
-
handle = this.resizerNextDiv.querySelector('.iob-ob-resize-handler');
|
|
2243
|
-
i++;
|
|
2244
|
-
}
|
|
2245
|
-
if ((handle === null || handle === void 0 ? void 0 : handle.dataset.left) !== 'true') {
|
|
2246
|
-
this.resizerNextDiv = this.resizerNextDiv.nextElementSibling;
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
else {
|
|
2250
|
-
this.resizeLeft = false;
|
|
2251
|
-
this.resizerNextDiv = this.resizerActiveDiv.nextElementSibling;
|
|
2252
|
-
/* while (this.resizerNextDiv && !this.resizerNextDiv.querySelector('.iob-ob-resize-handler') && i < 10) {
|
|
2253
|
-
this.resizerNextDiv = this.resizerNextDiv.nextElementSibling;
|
|
2254
|
-
i++;
|
|
2255
|
-
} */
|
|
2256
|
-
}
|
|
2257
|
-
this.resizerNextName = this.resizerNextDiv.dataset.name || null;
|
|
2258
|
-
this.resizerMin = parseInt(this.resizerActiveDiv.dataset.min, 10) || 0;
|
|
2259
|
-
this.resizerNextMin = parseInt(this.resizerNextDiv.dataset.min, 10) || 0;
|
|
2260
|
-
this.resizerPosition = e.clientX;
|
|
2261
|
-
this.resizerCurrentWidths[this.resizerActiveName] = this.resizerActiveDiv.offsetWidth;
|
|
2262
|
-
this.resizerOldWidth = this.resizerCurrentWidths[this.resizerActiveName];
|
|
2263
|
-
if (this.resizerNextName) {
|
|
2264
|
-
this.resizerCurrentWidths[this.resizerNextName] = this.resizerNextDiv.offsetWidth;
|
|
2265
|
-
this.resizerOldWidthNext = this.resizerCurrentWidths[this.resizerNextName];
|
|
2266
|
-
}
|
|
2267
|
-
window.addEventListener('mousemove', this.resizerMouseMove);
|
|
2268
|
-
window.addEventListener('mouseup', this.resizerMouseUp);
|
|
2269
|
-
}
|
|
2270
|
-
};
|
|
2271
|
-
this.resizerReset = () => {
|
|
2272
|
-
this.customWidth = false;
|
|
2273
|
-
SCREEN_WIDTHS[this.props.width || 'lg'] = JSON.parse(JSON.stringify(this.storedWidths));
|
|
2274
|
-
this.calculateColumnsVisibility();
|
|
2275
|
-
this.localStorage.removeItem(`${this.props.dialogName || 'App'}.table`);
|
|
2276
|
-
this.forceUpdate();
|
|
2277
|
-
};
|
|
2278
1861
|
const lastSelectedItemStr = this.localStorage.getItem(`${props.dialogName || 'App'}.objectSelected`) || '';
|
|
2279
1862
|
this.selectFirst = '';
|
|
2280
1863
|
if (lastSelectedItemStr.startsWith('[')) {
|
|
@@ -2282,7 +1865,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2282
1865
|
const lastSelectedItems = JSON.parse(lastSelectedItemStr);
|
|
2283
1866
|
this.selectFirst = lastSelectedItems[0] || '';
|
|
2284
1867
|
}
|
|
2285
|
-
catch
|
|
1868
|
+
catch {
|
|
2286
1869
|
// ignore
|
|
2287
1870
|
}
|
|
2288
1871
|
}
|
|
@@ -2294,7 +1877,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2294
1877
|
try {
|
|
2295
1878
|
expanded = JSON.parse(expandedStr);
|
|
2296
1879
|
}
|
|
2297
|
-
catch
|
|
1880
|
+
catch {
|
|
2298
1881
|
expanded = [];
|
|
2299
1882
|
}
|
|
2300
1883
|
let filter;
|
|
@@ -2305,24 +1888,24 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2305
1888
|
try {
|
|
2306
1889
|
filter = JSON.parse(filterStr);
|
|
2307
1890
|
}
|
|
2308
|
-
catch
|
|
2309
|
-
filter =
|
|
1891
|
+
catch {
|
|
1892
|
+
filter = { ...DEFAULT_FILTER };
|
|
2310
1893
|
}
|
|
2311
1894
|
}
|
|
2312
1895
|
else if (props.defaultFilters && typeof props.defaultFilters === 'object') {
|
|
2313
|
-
filter =
|
|
1896
|
+
filter = { ...props.defaultFilters };
|
|
2314
1897
|
}
|
|
2315
1898
|
else {
|
|
2316
|
-
filter =
|
|
1899
|
+
filter = { ...DEFAULT_FILTER };
|
|
2317
1900
|
}
|
|
2318
1901
|
filter.expertMode =
|
|
2319
1902
|
props.expertMode !== undefined
|
|
2320
1903
|
? props.expertMode
|
|
2321
1904
|
: (window._sessionStorage || window.sessionStorage).getItem('App.expertMode') ===
|
|
2322
1905
|
'true';
|
|
2323
|
-
this.tableRef =
|
|
1906
|
+
this.tableRef = createRef();
|
|
2324
1907
|
this.filterRefs = {};
|
|
2325
|
-
Object.keys(DEFAULT_FILTER).forEach(name => (this.filterRefs[name] =
|
|
1908
|
+
Object.keys(DEFAULT_FILTER).forEach(name => (this.filterRefs[name] = createRef()));
|
|
2326
1909
|
this.visibleCols = props.columns || SCREEN_WIDTHS[props.width || 'lg'].fields;
|
|
2327
1910
|
// remove type column if only one type must be selected
|
|
2328
1911
|
if (props.types && props.types.length === 1) {
|
|
@@ -2354,14 +1937,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2354
1937
|
try {
|
|
2355
1938
|
columns = columnsStr ? JSON.parse(columnsStr) : null;
|
|
2356
1939
|
}
|
|
2357
|
-
catch
|
|
1940
|
+
catch {
|
|
2358
1941
|
columns = null;
|
|
2359
1942
|
}
|
|
2360
1943
|
let columnsWidths = null; // this.localStorage.getItem(`${props.dialogName || 'App'}.columnsWidths`);
|
|
2361
1944
|
try {
|
|
2362
1945
|
columnsWidths = columnsWidths ? JSON.parse(columnsWidths) : {};
|
|
2363
1946
|
}
|
|
2364
|
-
catch
|
|
1947
|
+
catch {
|
|
2365
1948
|
columnsWidths = {};
|
|
2366
1949
|
}
|
|
2367
1950
|
this.imagePrefix = props.imagePrefix || '.';
|
|
@@ -2382,7 +1965,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2382
1965
|
? JSON.parse(this.localStorage.getItem(`${props.dialogName || 'App'}.objectStatesView`) || '') || false
|
|
2383
1966
|
: false;
|
|
2384
1967
|
}
|
|
2385
|
-
catch
|
|
1968
|
+
catch {
|
|
2386
1969
|
// ignore
|
|
2387
1970
|
}
|
|
2388
1971
|
this.state = {
|
|
@@ -2502,7 +2085,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2502
2085
|
});
|
|
2503
2086
|
this.customWidth = true;
|
|
2504
2087
|
}
|
|
2505
|
-
catch
|
|
2088
|
+
catch {
|
|
2506
2089
|
// ignore
|
|
2507
2090
|
}
|
|
2508
2091
|
}
|
|
@@ -2517,7 +2100,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2517
2100
|
const objects = (this.props.objectsWorker
|
|
2518
2101
|
? await this.props.objectsWorker.getObjects(update)
|
|
2519
2102
|
: await props.socket.getObjects(update, true)) || {};
|
|
2520
|
-
if (props.types &&
|
|
2103
|
+
if (props.types && Connection.isWeb()) {
|
|
2521
2104
|
for (let i = 0; i < props.types.length; i++) {
|
|
2522
2105
|
// admin has ALL objects
|
|
2523
2106
|
// web has only state, channel, device, enum, and system.config
|
|
@@ -2533,7 +2116,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2533
2116
|
}
|
|
2534
2117
|
this.systemConfig =
|
|
2535
2118
|
this.systemConfig ||
|
|
2536
|
-
|
|
2119
|
+
objects?.['system.config'] ||
|
|
2537
2120
|
(await props.socket.getObject('system.config'));
|
|
2538
2121
|
this.systemConfig.common = this.systemConfig.common || {};
|
|
2539
2122
|
this.systemConfig.common.defaultNewAcl = this.systemConfig.common.defaultNewAcl || {
|
|
@@ -2634,7 +2217,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2634
2217
|
if (node &&
|
|
2635
2218
|
!applyFilter(node, this.state.filter, this.props.lang, this.objects, undefined, undefined, props.customFilter, props.types)) {
|
|
2636
2219
|
// reset filter
|
|
2637
|
-
this.setState({ filter:
|
|
2220
|
+
this.setState({ filter: { ...DEFAULT_FILTER }, columnsForAdmin }, () => {
|
|
2638
2221
|
this.setState({ loaded: true, updating: false }, () => this.expandAllSelected(() => this.onAfterSelect()));
|
|
2639
2222
|
});
|
|
2640
2223
|
}
|
|
@@ -2652,7 +2235,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2652
2235
|
static isNonExpertId(
|
|
2653
2236
|
/** id to test */
|
|
2654
2237
|
id) {
|
|
2655
|
-
return !!
|
|
2238
|
+
return !!ObjectBrowserClass.#NON_EXPERT_NAMESPACES.find(saveNamespace => id.startsWith(saveNamespace));
|
|
2656
2239
|
}
|
|
2657
2240
|
expandAllSelected(cb) {
|
|
2658
2241
|
const expanded = [...this.state.expanded];
|
|
@@ -2681,15 +2264,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2681
2264
|
* @param isDouble is double click
|
|
2682
2265
|
*/
|
|
2683
2266
|
onAfterSelect(isDouble) {
|
|
2684
|
-
|
|
2685
|
-
if (((_b = this.state.selected) === null || _b === void 0 ? void 0 : _b.length) && this.state.selected[0]) {
|
|
2267
|
+
if (this.state.selected?.length && this.state.selected[0]) {
|
|
2686
2268
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`, this.state.selected[0]);
|
|
2687
2269
|
// remove a task to select the pre-selected item if now we want to see another object
|
|
2688
2270
|
if (this.selectFirst && this.selectFirst !== this.state.selected[0]) {
|
|
2689
2271
|
this.selectFirst = '';
|
|
2690
2272
|
}
|
|
2691
2273
|
if (this.state.selected.length === 1 && this.objects[this.state.selected[0]]) {
|
|
2692
|
-
const name =
|
|
2274
|
+
const name = Utils.getObjectName(this.objects, this.state.selected[0], null, {
|
|
2693
2275
|
language: this.props.lang,
|
|
2694
2276
|
});
|
|
2695
2277
|
if (this.props.onSelect) {
|
|
@@ -2712,7 +2294,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2712
2294
|
let changed = false;
|
|
2713
2295
|
if (props.expertMode !== undefined && props.expertMode !== state.filter.expertMode) {
|
|
2714
2296
|
changed = true;
|
|
2715
|
-
newState.filter =
|
|
2297
|
+
newState.filter = { ...state.filter };
|
|
2716
2298
|
newState.filter.expertMode = props.expertMode;
|
|
2717
2299
|
}
|
|
2718
2300
|
return changed ? newState : null;
|
|
@@ -2760,7 +2342,6 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2760
2342
|
* Show the deletion dialog for a given object
|
|
2761
2343
|
*/
|
|
2762
2344
|
showDeleteDialog(options) {
|
|
2763
|
-
var _b, _c;
|
|
2764
2345
|
const { id, obj, item } = options;
|
|
2765
2346
|
// calculate the number of children
|
|
2766
2347
|
const keys = Object.keys(this.objects);
|
|
@@ -2776,9 +2357,29 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2776
2357
|
}
|
|
2777
2358
|
}
|
|
2778
2359
|
if (this.props.onObjectDelete) {
|
|
2779
|
-
this.props.onObjectDelete(id, !!
|
|
2360
|
+
this.props.onObjectDelete(id, !!item.children?.length, !obj.common?.dontDelete, count + 1);
|
|
2780
2361
|
}
|
|
2781
2362
|
}
|
|
2363
|
+
/**
|
|
2364
|
+
* Context menu handler.
|
|
2365
|
+
*/
|
|
2366
|
+
onContextMenu = (e) => {
|
|
2367
|
+
// console.log(`CONTEXT MENU: ${this.contextMenu ? Date.now() - this.contextMenu.ts : 'false'}`);
|
|
2368
|
+
if (this.contextMenu && Date.now() - this.contextMenu.ts < 2000) {
|
|
2369
|
+
e.preventDefault();
|
|
2370
|
+
this.setState({
|
|
2371
|
+
showContextMenu: {
|
|
2372
|
+
item: this.contextMenu.item,
|
|
2373
|
+
position: { left: e.clientX + 2, top: e.clientY - 6 },
|
|
2374
|
+
},
|
|
2375
|
+
});
|
|
2376
|
+
}
|
|
2377
|
+
else if (this.state.showContextMenu) {
|
|
2378
|
+
e.preventDefault();
|
|
2379
|
+
this.setState({ showContextMenu: null });
|
|
2380
|
+
}
|
|
2381
|
+
this.contextMenu = null;
|
|
2382
|
+
};
|
|
2782
2383
|
/**
|
|
2783
2384
|
* Called when component is mounted.
|
|
2784
2385
|
*/
|
|
@@ -2797,12 +2398,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2797
2398
|
* Renders the error dialog.
|
|
2798
2399
|
*/
|
|
2799
2400
|
renderErrorDialog() {
|
|
2800
|
-
return this.state.error ? (
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2401
|
+
return this.state.error ? (React.createElement(Dialog, { open: !0, maxWidth: "sm", fullWidth: true, onClose: () => this.setState({ error: '' }), "aria-labelledby": "error-dialog-title", "aria-describedby": "error-dialog-description" },
|
|
2402
|
+
React.createElement(DialogTitle, { id: "alert-dialog-title" }, this.props.t('ra_Error')),
|
|
2403
|
+
React.createElement(DialogContent, null,
|
|
2404
|
+
React.createElement(DialogContentText, { id: "alert-dialog-description" }, this.state.error)),
|
|
2405
|
+
React.createElement(DialogActions, null,
|
|
2406
|
+
React.createElement(Button, { variant: "contained", onClick: () => this.setState({ error: '' }), color: "primary", autoFocus: true, startIcon: React.createElement(IconCheck, null) }, this.props.t('ra_Ok'))))) : null;
|
|
2806
2407
|
}
|
|
2807
2408
|
/**
|
|
2808
2409
|
* Show the error dialog.
|
|
@@ -2878,30 +2479,27 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2878
2479
|
}
|
|
2879
2480
|
return cols
|
|
2880
2481
|
.filter(id => (isLast && (id === 'val' || id === 'buttons')) || (!isLast && id !== 'val' && id !== 'buttons'))
|
|
2881
|
-
.map(id => {
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
columns.push(id);
|
|
2889
|
-
columns.sort();
|
|
2890
|
-
}
|
|
2891
|
-
else {
|
|
2892
|
-
columns.splice(pos, 1);
|
|
2893
|
-
}
|
|
2894
|
-
this.localStorage.setItem(`${this.props.dialogName || 'App'}.columns`, JSON.stringify(columns));
|
|
2895
|
-
this.calculateColumnsVisibility(null, columns);
|
|
2896
|
-
this.setState({ columns });
|
|
2482
|
+
.map(id => (React.createElement(ListItemButton, { onClick: () => {
|
|
2483
|
+
if (!this.state.columnsAuto && id !== 'id') {
|
|
2484
|
+
const columns = [...(this.state.columns || [])];
|
|
2485
|
+
const pos = columns.indexOf(id);
|
|
2486
|
+
if (pos === -1) {
|
|
2487
|
+
columns.push(id);
|
|
2488
|
+
columns.sort();
|
|
2897
2489
|
}
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2490
|
+
else {
|
|
2491
|
+
columns.splice(pos, 1);
|
|
2492
|
+
}
|
|
2493
|
+
this.localStorage.setItem(`${this.props.dialogName || 'App'}.columns`, JSON.stringify(columns));
|
|
2494
|
+
this.calculateColumnsVisibility(null, columns);
|
|
2495
|
+
this.setState({ columns });
|
|
2496
|
+
}
|
|
2497
|
+
}, key: id },
|
|
2498
|
+
React.createElement(Checkbox, { edge: "start", disabled: id === 'id' || this.state.columnsAuto, checked: id === 'id' ||
|
|
2499
|
+
!!(this.state.columnsAuto
|
|
2500
|
+
? this.visibleCols.includes(id)
|
|
2501
|
+
: this.state.columns?.includes(id)), disableRipple: true }),
|
|
2502
|
+
React.createElement(ListItemText, { primary: this.texts[`filter_${id}`] || this.props.t(`ra_${id}`) }))));
|
|
2905
2503
|
}
|
|
2906
2504
|
/**
|
|
2907
2505
|
* Renders the columns' selector.
|
|
@@ -2910,20 +2508,20 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2910
2508
|
if (!this.state.columnsSelectorShow) {
|
|
2911
2509
|
return null;
|
|
2912
2510
|
}
|
|
2913
|
-
return (
|
|
2914
|
-
'& .MuiPaper-root':
|
|
2511
|
+
return (React.createElement(Dialog, { onClose: () => this.setState({ columnsSelectorShow: false }), open: !0, sx: {
|
|
2512
|
+
'& .MuiPaper-root': Utils.getStyle(this.props.theme, styles.dialogColumns, styles[`transparent_${this.state.columnsDialogTransparent}`]),
|
|
2915
2513
|
} },
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2514
|
+
React.createElement(DialogTitle, { sx: styles.fontSizeTitle }, this.props.t('ra_Configure')),
|
|
2515
|
+
React.createElement(DialogContent, { sx: styles.fontSizeTitle },
|
|
2516
|
+
React.createElement(FormControlLabel, { style: styles.switchColumnAuto, control: React.createElement(Switch, { checked: this.state.foldersFirst, onChange: () => {
|
|
2919
2517
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.foldersFirst`, this.state.foldersFirst ? 'false' : 'true');
|
|
2920
2518
|
this.setState({ foldersFirst: !this.state.foldersFirst });
|
|
2921
2519
|
} }), label: this.props.t('ra_Folders always first') }),
|
|
2922
|
-
|
|
2520
|
+
React.createElement(FormControlLabel, { style: styles.switchColumnAuto, control: React.createElement(Switch, { checked: this.state.linesEnabled, onChange: () => {
|
|
2923
2521
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.lines`, this.state.linesEnabled ? 'false' : 'true');
|
|
2924
2522
|
this.setState({ linesEnabled: !this.state.linesEnabled });
|
|
2925
2523
|
} }), label: this.props.t('ra_Show lines between rows') }),
|
|
2926
|
-
|
|
2524
|
+
React.createElement(FormControlLabel, { style: styles.switchColumnAuto, control: React.createElement(Switch, { checked: this.state.columnsAuto, onChange: () => {
|
|
2927
2525
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.columnsAuto`, this.state.columnsAuto ? 'false' : 'true');
|
|
2928
2526
|
if (!this.state.columnsAuto) {
|
|
2929
2527
|
this.calculateColumnsVisibility(true);
|
|
@@ -2938,39 +2536,36 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2938
2536
|
this.setState({ columnsAuto: false });
|
|
2939
2537
|
}
|
|
2940
2538
|
} }), label: this.props.t('ra_Auto (no custom columns)') }),
|
|
2941
|
-
|
|
2539
|
+
React.createElement(List, null,
|
|
2942
2540
|
this._renderDefinedList(false),
|
|
2943
2541
|
this.state.columnsForAdmin &&
|
|
2944
2542
|
Object.keys(this.state.columnsForAdmin)
|
|
2945
2543
|
.sort()
|
|
2946
2544
|
.map(adapter => this.state.columnsForAdmin &&
|
|
2947
|
-
this.state.columnsForAdmin[adapter].map(column => {
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
columns.push(id);
|
|
2956
|
-
columns.sort();
|
|
2957
|
-
}
|
|
2958
|
-
else {
|
|
2959
|
-
columns.splice(pos, 1);
|
|
2960
|
-
}
|
|
2961
|
-
this.calculateColumnsVisibility(null, columns);
|
|
2962
|
-
this.localStorage.setItem(`${this.props.dialogName || 'App'}.columns`, JSON.stringify(columns));
|
|
2963
|
-
this.setState({ columns });
|
|
2545
|
+
this.state.columnsForAdmin[adapter].map(column => (React.createElement(ListItemButton, { onClick: () => {
|
|
2546
|
+
if (!this.state.columnsAuto) {
|
|
2547
|
+
const columns = [...(this.state.columns || [])];
|
|
2548
|
+
const id = `_${adapter}_${column.path}`;
|
|
2549
|
+
const pos = columns.indexOf(id);
|
|
2550
|
+
if (pos === -1) {
|
|
2551
|
+
columns.push(id);
|
|
2552
|
+
columns.sort();
|
|
2964
2553
|
}
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2554
|
+
else {
|
|
2555
|
+
columns.splice(pos, 1);
|
|
2556
|
+
}
|
|
2557
|
+
this.calculateColumnsVisibility(null, columns);
|
|
2558
|
+
this.localStorage.setItem(`${this.props.dialogName || 'App'}.columns`, JSON.stringify(columns));
|
|
2559
|
+
this.setState({ columns });
|
|
2560
|
+
}
|
|
2561
|
+
}, key: `${adapter}_${column.name}` },
|
|
2562
|
+
React.createElement(ListItemIcon, null,
|
|
2563
|
+
React.createElement(Checkbox, { disabled: this.state.columnsAuto, edge: "start", checked: !this.state.columnsAuto &&
|
|
2564
|
+
this.state.columns?.includes(`_${adapter}_${column.path}`), disableRipple: true })),
|
|
2565
|
+
React.createElement(ListItemText, { primary: `${column.name} (${adapter})` }))))),
|
|
2971
2566
|
this._renderDefinedList(true))),
|
|
2972
|
-
|
|
2973
|
-
|
|
2567
|
+
React.createElement(DialogActions, null,
|
|
2568
|
+
React.createElement(Button, { variant: "contained", onClick: () => this.setState({ columnsSelectorShow: false }), color: "primary", startIcon: React.createElement(IconClose, null) }, this.texts.close))));
|
|
2974
2569
|
}
|
|
2975
2570
|
async getAdditionalColumns() {
|
|
2976
2571
|
try {
|
|
@@ -3022,6 +2617,36 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3022
2617
|
}
|
|
3023
2618
|
return null;
|
|
3024
2619
|
}
|
|
2620
|
+
/**
|
|
2621
|
+
* Called when a state changes.
|
|
2622
|
+
*/
|
|
2623
|
+
onStateChange = (id, state) => {
|
|
2624
|
+
console.log(`> stateChange ${id}`);
|
|
2625
|
+
if (this.states[id]) {
|
|
2626
|
+
const item = this.findItem(id);
|
|
2627
|
+
if (item?.data.state) {
|
|
2628
|
+
item.data.state = undefined;
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
if (state) {
|
|
2632
|
+
this.states[id] = state;
|
|
2633
|
+
}
|
|
2634
|
+
else {
|
|
2635
|
+
delete this.states[id];
|
|
2636
|
+
}
|
|
2637
|
+
if (!this.pausedSubscribes) {
|
|
2638
|
+
if (!this.statesUpdateTimer) {
|
|
2639
|
+
this.statesUpdateTimer = setTimeout(() => {
|
|
2640
|
+
this.statesUpdateTimer = null;
|
|
2641
|
+
this.forceUpdate();
|
|
2642
|
+
}, 300);
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
else if (this.statesUpdateTimer) {
|
|
2646
|
+
clearTimeout(this.statesUpdateTimer);
|
|
2647
|
+
this.statesUpdateTimer = null;
|
|
2648
|
+
}
|
|
2649
|
+
};
|
|
3025
2650
|
parseObjectForAdmins(columnsForAdmin, obj) {
|
|
3026
2651
|
if (obj.common && obj.common.adminColumns && obj.common.name) {
|
|
3027
2652
|
const columns = obj.common.adminColumns;
|
|
@@ -3085,6 +2710,37 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3085
2710
|
}
|
|
3086
2711
|
return columnsForAdmin;
|
|
3087
2712
|
}
|
|
2713
|
+
onObjectChangeFromWorker = (events) => {
|
|
2714
|
+
if (Array.isArray(events)) {
|
|
2715
|
+
let newState = null;
|
|
2716
|
+
events.forEach(event => {
|
|
2717
|
+
const { newInnerState, filtered } = this.processOnObjectChangeElement(event.id, event.obj);
|
|
2718
|
+
if (filtered) {
|
|
2719
|
+
return;
|
|
2720
|
+
}
|
|
2721
|
+
if (newInnerState && newState) {
|
|
2722
|
+
Object.assign(newState, newInnerState);
|
|
2723
|
+
}
|
|
2724
|
+
else {
|
|
2725
|
+
newState = newInnerState;
|
|
2726
|
+
}
|
|
2727
|
+
});
|
|
2728
|
+
if (newState) {
|
|
2729
|
+
this.setState(newState);
|
|
2730
|
+
}
|
|
2731
|
+
this.afterObjectUpdated();
|
|
2732
|
+
}
|
|
2733
|
+
};
|
|
2734
|
+
onObjectChange = (id, obj) => {
|
|
2735
|
+
const { newInnerState, filtered } = this.processOnObjectChangeElement(id, obj);
|
|
2736
|
+
if (filtered) {
|
|
2737
|
+
return;
|
|
2738
|
+
}
|
|
2739
|
+
if (newInnerState) {
|
|
2740
|
+
this.setState(newInnerState);
|
|
2741
|
+
}
|
|
2742
|
+
this.afterObjectUpdated();
|
|
2743
|
+
};
|
|
3088
2744
|
afterObjectUpdated() {
|
|
3089
2745
|
if (!this.objectsUpdateTimer && this.objects) {
|
|
3090
2746
|
this.objectsUpdateTimer = setTimeout(() => {
|
|
@@ -3108,8 +2764,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3108
2764
|
// This function is called when the user changes the alias of an object.
|
|
3109
2765
|
// It updates the aliasMap and returns true if the aliasMap has changed.
|
|
3110
2766
|
updateAliases(aliasId) {
|
|
3111
|
-
|
|
3112
|
-
if (!this.objects || !((_b = this.info) === null || _b === void 0 ? void 0 : _b.aliasesMap) || !(aliasId === null || aliasId === void 0 ? void 0 : aliasId.startsWith('alias.'))) {
|
|
2767
|
+
if (!this.objects || !this.info?.aliasesMap || !aliasId?.startsWith('alias.')) {
|
|
3113
2768
|
return;
|
|
3114
2769
|
}
|
|
3115
2770
|
// Rebuild aliases map
|
|
@@ -3117,7 +2772,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3117
2772
|
this.info.aliasesMap = {};
|
|
3118
2773
|
for (const id of aliasesIds) {
|
|
3119
2774
|
const obj = this.objects[id];
|
|
3120
|
-
if (
|
|
2775
|
+
if (obj?.common?.alias?.id) {
|
|
3121
2776
|
if (typeof obj.common.alias.id === 'string') {
|
|
3122
2777
|
const usedId = obj.common.alias.id;
|
|
3123
2778
|
if (!this.info.aliasesMap[usedId]) {
|
|
@@ -3159,7 +2814,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3159
2814
|
*/
|
|
3160
2815
|
processOnObjectChangeElement(id, obj) {
|
|
3161
2816
|
console.log(`> objectChange ${id}`);
|
|
3162
|
-
const type = obj
|
|
2817
|
+
const type = obj?.type;
|
|
3163
2818
|
// If the object is filtered out, we don't need to update the React state
|
|
3164
2819
|
if (obj &&
|
|
3165
2820
|
typeof this.props.filterFunc === 'function' &&
|
|
@@ -3172,7 +2827,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3172
2827
|
return { newInnerState: null, filtered: true };
|
|
3173
2828
|
}
|
|
3174
2829
|
let newInnerState = null;
|
|
3175
|
-
if (id.startsWith('system.adapter.') &&
|
|
2830
|
+
if (id.startsWith('system.adapter.') && obj?.type === 'adapter') {
|
|
3176
2831
|
const columnsForAdmin = JSON.parse(JSON.stringify(this.state.columnsForAdmin));
|
|
3177
2832
|
this.parseObjectForAdmins(columnsForAdmin, obj);
|
|
3178
2833
|
if (JSON.stringify(this.state.columnsForAdmin) !== JSON.stringify(columnsForAdmin)) {
|
|
@@ -3226,7 +2881,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3226
2881
|
}
|
|
3227
2882
|
onFilter(name, value) {
|
|
3228
2883
|
this.filterTimer = null;
|
|
3229
|
-
const filter =
|
|
2884
|
+
const filter = { ...this.state.filter };
|
|
3230
2885
|
Object.keys(this.filterRefs).forEach(_name => {
|
|
3231
2886
|
if (this.filterRefs[_name] && this.filterRefs[_name].current) {
|
|
3232
2887
|
const filterRef = this.filterRefs[_name].current;
|
|
@@ -3250,7 +2905,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3250
2905
|
}
|
|
3251
2906
|
}
|
|
3252
2907
|
clearFilter() {
|
|
3253
|
-
const filter =
|
|
2908
|
+
const filter = { ...this.state.filter };
|
|
3254
2909
|
Object.keys(this.filterRefs).forEach(name => {
|
|
3255
2910
|
if (this.filterRefs[name] && this.filterRefs[name].current) {
|
|
3256
2911
|
const filterRef = this.filterRefs[name].current;
|
|
@@ -3274,40 +2929,37 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3274
2929
|
return !someNotEmpty;
|
|
3275
2930
|
}
|
|
3276
2931
|
getFilterInput(filterName) {
|
|
3277
|
-
|
|
3278
|
-
return (react_1.default.createElement(material_1.FormControl, { sx: this.styles.filterInput, key: `${filterName}_${this.state.filterKey}`,
|
|
2932
|
+
return (React.createElement(FormControl, { sx: this.styles.filterInput, key: `${filterName}_${this.state.filterKey}`,
|
|
3279
2933
|
// style={{ marginTop: 0, marginBottom: 0 }}
|
|
3280
2934
|
margin: "dense" },
|
|
3281
|
-
|
|
2935
|
+
React.createElement(Input, { ref: this.filterRefs[filterName], classes: { underline: 'no-underline' }, id: filterName, placeholder: this.texts[`filter_${filterName}`], defaultValue: this.state.filter[filterName] || '', onChange: () => {
|
|
3282
2936
|
if (this.filterTimer) {
|
|
3283
2937
|
clearTimeout(this.filterTimer);
|
|
3284
2938
|
}
|
|
3285
2939
|
this.filterTimer = setTimeout(() => this.onFilter(), 400);
|
|
3286
2940
|
}, autoComplete: "off" }),
|
|
3287
|
-
|
|
2941
|
+
this.filterRefs[filterName]?.current?.firstChild?.value ? (React.createElement("div", { style: {
|
|
3288
2942
|
position: 'absolute',
|
|
3289
2943
|
right: 0,
|
|
3290
2944
|
} },
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
((_b = this.filterRefs[filterName].current) === null || _b === void 0 ? void 0 : _b.firstChild).value = '';
|
|
2945
|
+
React.createElement(IconButton, { size: "small", onClick: () => {
|
|
2946
|
+
(this.filterRefs[filterName].current?.firstChild).value = '';
|
|
3294
2947
|
this.onFilter(filterName, '');
|
|
3295
2948
|
} },
|
|
3296
|
-
|
|
2949
|
+
React.createElement(IconClose, null)))) : null));
|
|
3297
2950
|
}
|
|
3298
2951
|
getFilterSelect(name, values) {
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
react_1.default.createElement(material_1.Select, { variant: "standard", key: `${name}_${this.state.filterKey}`, ref: this.filterRefs[name], sx: styles.headerCellInput, className: "no-underline", onChange: () => {
|
|
2952
|
+
const hasIcons = !!values?.find(item => item.icon);
|
|
2953
|
+
return (React.createElement("div", { style: { position: 'relative' } },
|
|
2954
|
+
React.createElement(Select, { variant: "standard", key: `${name}_${this.state.filterKey}`, ref: this.filterRefs[name], sx: styles.headerCellInput, className: "no-underline", onChange: () => {
|
|
3303
2955
|
if (this.filterTimer) {
|
|
3304
2956
|
clearTimeout(this.filterTimer);
|
|
3305
2957
|
}
|
|
3306
2958
|
this.filterTimer = setTimeout(() => this.onFilter(), 400);
|
|
3307
2959
|
}, defaultValue: this.state.filter[name] || '', inputProps: { name, id: name }, displayEmpty: true },
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
values
|
|
2960
|
+
React.createElement(MenuItem, { key: "empty", value: "" },
|
|
2961
|
+
React.createElement("span", { style: styles.selectNone }, this.texts[`filter_${name}`])),
|
|
2962
|
+
values?.map(item => {
|
|
3311
2963
|
let id;
|
|
3312
2964
|
let _name;
|
|
3313
2965
|
let icon;
|
|
@@ -3320,51 +2972,44 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3320
2972
|
id = item;
|
|
3321
2973
|
_name = item;
|
|
3322
2974
|
}
|
|
3323
|
-
return (
|
|
3324
|
-
icon || (hasIcons ?
|
|
2975
|
+
return (React.createElement(MenuItem, { sx: styles.headerCellSelectItem, key: id, value: id },
|
|
2976
|
+
icon || (hasIcons ? React.createElement("div", { className: "itemIcon" }) : null),
|
|
3325
2977
|
_name));
|
|
3326
2978
|
})),
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
const newFilter = Object.assign({}, this.state.filter);
|
|
2979
|
+
this.filterRefs[name]?.current?.childNodes[1]?.value ? (React.createElement(Box, { component: "div", sx: styles.selectClearButton },
|
|
2980
|
+
React.createElement(IconButton, { size: "small", onClick: () => {
|
|
2981
|
+
const newFilter = { ...this.state.filter };
|
|
3331
2982
|
newFilter[name] = '';
|
|
3332
|
-
(
|
|
2983
|
+
(this.filterRefs[name].current?.childNodes[1]).value = '';
|
|
3333
2984
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectFilter`, JSON.stringify(newFilter));
|
|
3334
2985
|
this.setState({ filter: newFilter, filterKey: this.state.filterKey + 1 }, () => this.props.onFilterChanged && this.props.onFilterChanged(newFilter));
|
|
3335
2986
|
} },
|
|
3336
|
-
|
|
2987
|
+
React.createElement(IconClose, null)))) : null));
|
|
3337
2988
|
}
|
|
3338
2989
|
getFilterSelectRole() {
|
|
3339
2990
|
return this.getFilterSelect('role', this.info.roles);
|
|
3340
2991
|
}
|
|
3341
2992
|
getFilterSelectRoom() {
|
|
3342
|
-
const rooms = this.info.roomEnums.map(id => {
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
icon: (react_1.default.createElement(Icon_1.default, { src: ((_e = (_d = this.objects[id]) === null || _d === void 0 ? void 0 : _d.common) === null || _e === void 0 ? void 0 : _e.icon) || '', style: styles.selectIcon })),
|
|
3348
|
-
});
|
|
3349
|
-
});
|
|
2993
|
+
const rooms = this.info.roomEnums.map(id => ({
|
|
2994
|
+
name: getName(this.objects[id]?.common?.name, this.props.lang) || id.split('.').pop(),
|
|
2995
|
+
value: id,
|
|
2996
|
+
icon: (React.createElement(Icon, { src: this.objects[id]?.common?.icon || '', style: styles.selectIcon })),
|
|
2997
|
+
}));
|
|
3350
2998
|
return this.getFilterSelect('room', rooms);
|
|
3351
2999
|
}
|
|
3352
3000
|
getFilterSelectFunction() {
|
|
3353
|
-
const func = this.info.funcEnums.map(id => {
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
icon: (react_1.default.createElement(Icon_1.default, { src: ((_e = (_d = this.objects[id]) === null || _d === void 0 ? void 0 : _d.common) === null || _e === void 0 ? void 0 : _e.icon) || '', style: styles.selectIcon })),
|
|
3359
|
-
});
|
|
3360
|
-
});
|
|
3001
|
+
const func = this.info.funcEnums.map(id => ({
|
|
3002
|
+
name: getName(this.objects[id]?.common?.name, this.props.lang) || id.split('.').pop(),
|
|
3003
|
+
value: id,
|
|
3004
|
+
icon: (React.createElement(Icon, { src: this.objects[id]?.common?.icon || '', style: styles.selectIcon })),
|
|
3005
|
+
}));
|
|
3361
3006
|
return this.getFilterSelect('func', func);
|
|
3362
3007
|
}
|
|
3363
3008
|
getFilterSelectType() {
|
|
3364
3009
|
const types = this.info.types.map(type => ({
|
|
3365
3010
|
name: type,
|
|
3366
3011
|
value: type,
|
|
3367
|
-
icon:
|
|
3012
|
+
icon: ITEM_IMAGES[type] || null,
|
|
3368
3013
|
}));
|
|
3369
3014
|
return this.getFilterSelect('type', types);
|
|
3370
3015
|
}
|
|
@@ -3373,17 +3018,16 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3373
3018
|
const customs = this.info.customs.map(id => ({
|
|
3374
3019
|
name: id === '_' ? this.texts.filterCustomsWithout : id,
|
|
3375
3020
|
value: id,
|
|
3376
|
-
icon: id === '_' ? null : (
|
|
3021
|
+
icon: id === '_' ? null : (React.createElement(Icon, { src: getSelectIdIconFromObjects(this.objects, id, this.props.lang, this.imagePrefix) || '', style: styles.selectIcon })),
|
|
3377
3022
|
}));
|
|
3378
3023
|
return this.getFilterSelect('custom', customs);
|
|
3379
3024
|
}
|
|
3380
3025
|
return null;
|
|
3381
3026
|
}
|
|
3382
3027
|
onExpandAll(root, expanded) {
|
|
3383
|
-
var _b;
|
|
3384
3028
|
const _root = root || this.root;
|
|
3385
3029
|
expanded = expanded || [];
|
|
3386
|
-
|
|
3030
|
+
_root?.children?.forEach((item) => {
|
|
3387
3031
|
if (item.data.sumVisibility) {
|
|
3388
3032
|
expanded.push(item.data.id);
|
|
3389
3033
|
this.onExpandAll(item, expanded);
|
|
@@ -3401,10 +3045,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3401
3045
|
this.setState({ expanded: [], depth: 0, selected: [] }, () => this.onAfterSelect());
|
|
3402
3046
|
}
|
|
3403
3047
|
expandDepth(root, depth, expanded) {
|
|
3404
|
-
var _b;
|
|
3405
3048
|
root = root || this.root;
|
|
3406
3049
|
if (depth > 0) {
|
|
3407
|
-
|
|
3050
|
+
root.children?.forEach(item => {
|
|
3408
3051
|
if (item.data.sumVisibility) {
|
|
3409
3052
|
if (!binarySearch(expanded, item.data.id)) {
|
|
3410
3053
|
expanded.push(item.data.id);
|
|
@@ -3439,11 +3082,76 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3439
3082
|
onCollapseVisible() {
|
|
3440
3083
|
if (this.state.depth > 0) {
|
|
3441
3084
|
const depth = this.state.depth - 1;
|
|
3442
|
-
const expanded =
|
|
3085
|
+
const expanded = ObjectBrowserClass.collapseDepth(depth, this.state.expanded);
|
|
3443
3086
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectExpanded`, JSON.stringify(expanded));
|
|
3444
3087
|
this.setState({ depth, expanded });
|
|
3445
3088
|
}
|
|
3446
3089
|
}
|
|
3090
|
+
getEnumsForId = (id) => {
|
|
3091
|
+
const result = [];
|
|
3092
|
+
this.info.enums.forEach(_id => {
|
|
3093
|
+
if (this.objects[_id]?.common?.members?.includes(id)) {
|
|
3094
|
+
const enumItem = {
|
|
3095
|
+
_id: this.objects[_id]._id,
|
|
3096
|
+
common: JSON.parse(JSON.stringify(this.objects[_id].common)),
|
|
3097
|
+
native: this.objects[_id].native,
|
|
3098
|
+
type: 'enum',
|
|
3099
|
+
};
|
|
3100
|
+
if (enumItem.common) {
|
|
3101
|
+
delete enumItem.common.members;
|
|
3102
|
+
delete enumItem.common.custom;
|
|
3103
|
+
// @ts-expect-error deprecated attribute
|
|
3104
|
+
delete enumItem.common.mobile;
|
|
3105
|
+
}
|
|
3106
|
+
result.push(enumItem);
|
|
3107
|
+
}
|
|
3108
|
+
});
|
|
3109
|
+
return result.length ? result : undefined;
|
|
3110
|
+
};
|
|
3111
|
+
_createAllEnums = async (enums, objId) => {
|
|
3112
|
+
for (let e = 0; e < enums.length; e++) {
|
|
3113
|
+
const item = enums[e];
|
|
3114
|
+
let id;
|
|
3115
|
+
let newObj;
|
|
3116
|
+
// some admin version delivered enums as string
|
|
3117
|
+
if (typeof item === 'object') {
|
|
3118
|
+
newObj = item;
|
|
3119
|
+
id = newObj._id;
|
|
3120
|
+
}
|
|
3121
|
+
else {
|
|
3122
|
+
id = item;
|
|
3123
|
+
}
|
|
3124
|
+
let oldObj = this.objects[id];
|
|
3125
|
+
// if enum does not exist
|
|
3126
|
+
if (!oldObj) {
|
|
3127
|
+
// create a new one
|
|
3128
|
+
oldObj =
|
|
3129
|
+
newObj ||
|
|
3130
|
+
{
|
|
3131
|
+
_id: id,
|
|
3132
|
+
common: {
|
|
3133
|
+
name: id.split('.').pop(),
|
|
3134
|
+
members: [],
|
|
3135
|
+
},
|
|
3136
|
+
native: {},
|
|
3137
|
+
type: 'enum',
|
|
3138
|
+
};
|
|
3139
|
+
oldObj.common = oldObj.common || {};
|
|
3140
|
+
oldObj.common.members = [objId];
|
|
3141
|
+
oldObj.type = 'enum';
|
|
3142
|
+
await this.props.socket.setObject(id, oldObj);
|
|
3143
|
+
}
|
|
3144
|
+
else if (!oldObj.common?.members?.includes(objId)) {
|
|
3145
|
+
oldObj.common = oldObj.common || {};
|
|
3146
|
+
oldObj.type = 'enum';
|
|
3147
|
+
oldObj.common.members = oldObj.common.members || [];
|
|
3148
|
+
// add the missing object
|
|
3149
|
+
oldObj.common.members.push(objId);
|
|
3150
|
+
oldObj.common.members.sort();
|
|
3151
|
+
await this.props.socket.setObject(id, oldObj);
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3154
|
+
};
|
|
3447
3155
|
async loadObjects(objs) {
|
|
3448
3156
|
if (objs) {
|
|
3449
3157
|
for (const id in objs) {
|
|
@@ -3534,7 +3242,6 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3534
3242
|
async _exportObjects(
|
|
3535
3243
|
/** Options to filter/reduce the output */
|
|
3536
3244
|
options) {
|
|
3537
|
-
var _b;
|
|
3538
3245
|
if (options.isAll) {
|
|
3539
3246
|
generateFile('allObjects.json', this.objects, options);
|
|
3540
3247
|
return;
|
|
@@ -3549,7 +3256,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3549
3256
|
for (const key of ids) {
|
|
3550
3257
|
result[key] = JSON.parse(JSON.stringify(this.objects[key]));
|
|
3551
3258
|
// read states values
|
|
3552
|
-
if (
|
|
3259
|
+
if (result[key]?.type === 'state' && !options.noStatesByExportImport) {
|
|
3553
3260
|
const state = await this.props.socket.getState(key);
|
|
3554
3261
|
if (state) {
|
|
3555
3262
|
result[key].val = state.val;
|
|
@@ -3570,55 +3277,53 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3570
3277
|
if (this.state.showExportDialog === false) {
|
|
3571
3278
|
return null;
|
|
3572
3279
|
}
|
|
3573
|
-
return (
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3280
|
+
return (React.createElement(Dialog, { open: !0, maxWidth: "lg" },
|
|
3281
|
+
React.createElement(DialogTitle, null, this.props.t('ra_Select type of export')),
|
|
3282
|
+
React.createElement(DialogContent, null,
|
|
3283
|
+
React.createElement(DialogContentText, null, this.state.filter.expertMode || this.state.showAllExportOptions ? (React.createElement(React.Fragment, null,
|
|
3577
3284
|
this.props.t('ra_You can export all objects or just the selected branch.'),
|
|
3578
|
-
|
|
3285
|
+
React.createElement("br", null),
|
|
3579
3286
|
this.props.t('ra_Selected %s object(s)', this.state.showExportDialog),
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3287
|
+
React.createElement("br", null),
|
|
3288
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: this.state.noStatesByExportImport, onChange: e => this.setState({ noStatesByExportImport: e.target.checked }) }), label: this.props.t('ra_Do not export values of states') }),
|
|
3289
|
+
React.createElement("br", null),
|
|
3583
3290
|
this.props.t('These options can reduce the size of the export file:'),
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
this.state.filter.expertMode || this.state.showAllExportOptions ? (
|
|
3291
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: this.state.beautifyJsonExport, onChange: e => this.setState({ beautifyJsonExport: e.target.checked }) }), label: this.props.t('Beautify JSON output') }),
|
|
3292
|
+
React.createElement("br", null),
|
|
3293
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: this.state.excludeSystemRepositoriesFromExport, onChange: e => this.setState({ excludeSystemRepositoriesFromExport: e.target.checked }) }), label: this.props.t('Exclude system repositories from export JSON') }),
|
|
3294
|
+
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: this.state.excludeTranslations, onChange: e => this.setState({ excludeTranslations: e.target.checked }) }), label: this.props.t('Exclude translations (except english) from export JSON') }))) : null)),
|
|
3295
|
+
React.createElement(DialogActions, null,
|
|
3296
|
+
this.state.filter.expertMode || this.state.showAllExportOptions ? (React.createElement(Button, { color: "grey", variant: "outlined", onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }, () => this._exportObjects({
|
|
3590
3297
|
isAll: true,
|
|
3591
3298
|
noStatesByExportImport: this.state.noStatesByExportImport,
|
|
3592
3299
|
beautify: this.state.beautifyJsonExport,
|
|
3593
3300
|
excludeSystemRepositories: this.state.excludeSystemRepositoriesFromExport,
|
|
3594
3301
|
excludeTranslations: this.state.excludeTranslations,
|
|
3595
3302
|
})) },
|
|
3596
|
-
|
|
3303
|
+
React.createElement("span", { style: { marginRight: 8 } }, this.props.t('ra_All objects')),
|
|
3597
3304
|
"(",
|
|
3598
3305
|
Object.keys(this.objects).length,
|
|
3599
|
-
")")) : (
|
|
3600
|
-
|
|
3306
|
+
")")) : (React.createElement(Button, { color: "grey", variant: "outlined", startIcon: React.createElement(IconExpert, null), onClick: () => this.setState({ showAllExportOptions: true }) }, this.props.t('ra_Advanced options'))),
|
|
3307
|
+
React.createElement(Button, { color: "primary", variant: "contained", autoFocus: true, onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }, () => this._exportObjects({
|
|
3601
3308
|
isAll: false,
|
|
3602
3309
|
noStatesByExportImport: this.state.noStatesByExportImport,
|
|
3603
3310
|
beautify: this.state.beautifyJsonExport,
|
|
3604
3311
|
excludeSystemRepositories: this.state.excludeSystemRepositoriesFromExport,
|
|
3605
3312
|
excludeTranslations: this.state.excludeTranslations,
|
|
3606
3313
|
})) },
|
|
3607
|
-
|
|
3314
|
+
React.createElement("span", { style: { marginRight: 8 } }, this.props.t('ra_Only selected')),
|
|
3608
3315
|
"(",
|
|
3609
3316
|
this.state.showExportDialog,
|
|
3610
3317
|
")"),
|
|
3611
|
-
|
|
3318
|
+
React.createElement(Button, { color: "grey", variant: "contained", onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }), startIcon: React.createElement(IconClose, null) }, this.props.t('ra_Cancel')))));
|
|
3612
3319
|
}
|
|
3613
3320
|
handleJsonUpload(evt) {
|
|
3614
|
-
var _b;
|
|
3615
3321
|
const target = evt.target;
|
|
3616
|
-
const f =
|
|
3322
|
+
const f = target.files?.length && target.files[0];
|
|
3617
3323
|
if (f) {
|
|
3618
3324
|
const r = new FileReader();
|
|
3619
3325
|
r.onload = async (e) => {
|
|
3620
|
-
|
|
3621
|
-
const contents = (_b = e.target) === null || _b === void 0 ? void 0 : _b.result;
|
|
3326
|
+
const contents = e.target?.result;
|
|
3622
3327
|
try {
|
|
3623
3328
|
const json = JSON.parse(contents);
|
|
3624
3329
|
const len = Object.keys(json).length;
|
|
@@ -3690,6 +3395,75 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3690
3395
|
window.alert(this.props.t('ra_Failed to open JSON File'));
|
|
3691
3396
|
}
|
|
3692
3397
|
}
|
|
3398
|
+
toolTipObjectCreating = () => {
|
|
3399
|
+
const { t } = this.props;
|
|
3400
|
+
let value = [
|
|
3401
|
+
React.createElement("div", { key: 1 }, t('ra_Only following structures of objects are available:')),
|
|
3402
|
+
React.createElement("div", { key: 2 }, t('ra_Folder → State')),
|
|
3403
|
+
React.createElement("div", { key: 3 }, t('ra_Folder → Channel → State')),
|
|
3404
|
+
React.createElement("div", { key: 4 }, t('ra_Folder → Device → Channel → State')),
|
|
3405
|
+
React.createElement("div", { key: 5 }, t('ra_Device → Channel → State')),
|
|
3406
|
+
React.createElement("div", { key: 6 }, t('ra_Channel → State')),
|
|
3407
|
+
React.createElement("div", { key: 7, style: { height: 10 } }),
|
|
3408
|
+
React.createElement("div", { key: 8 }, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),
|
|
3409
|
+
React.createElement("div", { key: 9 }, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").')),
|
|
3410
|
+
];
|
|
3411
|
+
if (this.state.selected.length || this.state.selectedNonObject) {
|
|
3412
|
+
const id = this.state.selected[0] || this.state.selectedNonObject;
|
|
3413
|
+
if (id.split('.').length < 2 || (this.objects[id] && this.objects[id]?.type === 'state')) {
|
|
3414
|
+
// show default tooltip
|
|
3415
|
+
}
|
|
3416
|
+
else if (this.state.filter.expertMode) {
|
|
3417
|
+
switch (this.objects[id]?.type) {
|
|
3418
|
+
case 'device':
|
|
3419
|
+
value = [
|
|
3420
|
+
React.createElement("div", { key: 1 }, t('ra_Only following structures of objects are available:')),
|
|
3421
|
+
React.createElement("div", { key: 5 }, t('ra_Device → Channel → State')),
|
|
3422
|
+
React.createElement("div", { key: 7, style: { height: 10 } }),
|
|
3423
|
+
React.createElement("div", { key: 8 }, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),
|
|
3424
|
+
React.createElement("div", { key: 9 }, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").')),
|
|
3425
|
+
];
|
|
3426
|
+
break;
|
|
3427
|
+
case 'folder':
|
|
3428
|
+
value = [
|
|
3429
|
+
React.createElement("div", { key: 1 }, t('ra_Only following structures of objects are available:')),
|
|
3430
|
+
React.createElement("div", { key: 2 }, t('ra_Folder → State')),
|
|
3431
|
+
React.createElement("div", { key: 3 }, t('ra_Folder → Channel → State')),
|
|
3432
|
+
React.createElement("div", { key: 4 }, t('ra_Folder → Device → Channel → State')),
|
|
3433
|
+
React.createElement("div", { key: 7, style: { height: 10 } }),
|
|
3434
|
+
React.createElement("div", { key: 8 }, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),
|
|
3435
|
+
React.createElement("div", { key: 9 }, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").')),
|
|
3436
|
+
];
|
|
3437
|
+
break;
|
|
3438
|
+
case 'channel':
|
|
3439
|
+
value = [
|
|
3440
|
+
React.createElement("div", { key: 1 }, t('ra_Only following structures of objects are available:')),
|
|
3441
|
+
React.createElement("div", { key: 1 }, t('ra_Channel → State')),
|
|
3442
|
+
React.createElement("div", { key: 7, style: { height: 10 } }),
|
|
3443
|
+
React.createElement("div", { key: 8 }, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),
|
|
3444
|
+
React.createElement("div", { key: 9 }, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").')),
|
|
3445
|
+
];
|
|
3446
|
+
break;
|
|
3447
|
+
default:
|
|
3448
|
+
break;
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3451
|
+
else if (id.startsWith('alias.0') || id.startsWith('0_userdata')) {
|
|
3452
|
+
value = [
|
|
3453
|
+
React.createElement("div", { key: 1 }, t('ra_Only following structures of objects are available:')),
|
|
3454
|
+
React.createElement("div", { key: 2 }, t('ra_Folder → State')),
|
|
3455
|
+
React.createElement("div", { key: 3 }, t('ra_Folder → Channel → State')),
|
|
3456
|
+
React.createElement("div", { key: 4 }, t('ra_Folder → Device → Channel → State')),
|
|
3457
|
+
React.createElement("div", { key: 5 }, t('ra_Device → Channel → State')),
|
|
3458
|
+
React.createElement("div", { key: 6 }, t('ra_Channel → State')),
|
|
3459
|
+
React.createElement("div", { key: 7, style: { height: 10 } }),
|
|
3460
|
+
React.createElement("div", { key: 7 }, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')),
|
|
3461
|
+
React.createElement("div", { key: 8 }, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").')),
|
|
3462
|
+
];
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
return value.length ? value : t('ra_Add new child object to selected parent');
|
|
3466
|
+
};
|
|
3693
3467
|
/**
|
|
3694
3468
|
* Renders the toolbar.
|
|
3695
3469
|
*/
|
|
@@ -3707,36 +3481,36 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3707
3481
|
allowObjectCreation = true;
|
|
3708
3482
|
}
|
|
3709
3483
|
}
|
|
3710
|
-
return (
|
|
3484
|
+
return (React.createElement("div", { style: {
|
|
3711
3485
|
display: 'flex',
|
|
3712
3486
|
width: '100%',
|
|
3713
3487
|
alignItems: 'center',
|
|
3714
3488
|
overflowX: 'auto',
|
|
3715
3489
|
} },
|
|
3716
|
-
|
|
3490
|
+
React.createElement("div", { style: {
|
|
3717
3491
|
display: 'flex',
|
|
3718
3492
|
width: '100%',
|
|
3719
3493
|
alignItems: 'center',
|
|
3720
3494
|
} },
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
this.props.showExpertButton && !this.props.expertMode && (
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
!this.props.disableColumnSelector && this.props.width !== 'xs' && (
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
this.props.width !== 'xs' && this.state.expandAllVisible && (
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
this.props.width !== 'xs' && (
|
|
3738
|
-
|
|
3739
|
-
|
|
3495
|
+
React.createElement(Tooltip, { title: this.props.t('ra_Refresh tree'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3496
|
+
React.createElement("div", null,
|
|
3497
|
+
React.createElement(IconButton, { onClick: () => this.refreshComponent(), disabled: this.state.updating, size: "large" },
|
|
3498
|
+
React.createElement(RefreshIcon, null)))),
|
|
3499
|
+
this.props.showExpertButton && !this.props.expertMode && (React.createElement(Tooltip, { title: this.props.t('ra_expertMode'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3500
|
+
React.createElement(IconButton, { key: "expertMode", color: this.state.filter.expertMode ? 'secondary' : 'default', onClick: () => this.onFilter('expertMode', !this.state.filter.expertMode), size: "large" },
|
|
3501
|
+
React.createElement(IconExpert, null)))),
|
|
3502
|
+
!this.props.disableColumnSelector && this.props.width !== 'xs' && (React.createElement(Tooltip, { title: this.props.t('ra_Configure'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3503
|
+
React.createElement(IconButton, { key: "columnSelector", color: this.state.columnsAuto ? 'primary' : 'default', onClick: () => this.setState({ columnsSelectorShow: true }), size: "large" },
|
|
3504
|
+
React.createElement(IconColumns, null)))),
|
|
3505
|
+
this.props.width !== 'xs' && this.state.expandAllVisible && (React.createElement(Tooltip, { title: this.props.t('ra_Expand all nodes'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3506
|
+
React.createElement(IconButton, { key: "expandAll", onClick: () => this.onExpandAll(), size: "large" },
|
|
3507
|
+
React.createElement(IconOpen, null)))),
|
|
3508
|
+
React.createElement(Tooltip, { title: this.props.t('ra_Collapse all nodes'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3509
|
+
React.createElement(IconButton, { key: "collapseAll", onClick: () => this.onCollapseAll(), size: "large" },
|
|
3510
|
+
React.createElement(IconClosed, null))),
|
|
3511
|
+
this.props.width !== 'xs' && (React.createElement(Tooltip, { title: this.props.t('ra_Expand one step node'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3512
|
+
React.createElement(IconButton, { key: "expandVisible", color: "primary", onClick: () => this.onExpandVisible(), size: "large" },
|
|
3513
|
+
React.createElement(Badge, { badgeContent: this.state.depth, color: "secondary", sx: (theme) => ({
|
|
3740
3514
|
badge: {
|
|
3741
3515
|
right: 3,
|
|
3742
3516
|
top: 3,
|
|
@@ -3744,10 +3518,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3744
3518
|
padding: '0 4px',
|
|
3745
3519
|
},
|
|
3746
3520
|
}) },
|
|
3747
|
-
|
|
3748
|
-
this.props.width !== 'xs' && (
|
|
3749
|
-
|
|
3750
|
-
|
|
3521
|
+
React.createElement(IconOpen, null))))),
|
|
3522
|
+
this.props.width !== 'xs' && (React.createElement(Tooltip, { title: this.props.t('ra_Collapse one step node'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3523
|
+
React.createElement(IconButton, { key: "collapseVisible", color: "primary", onClick: () => this.onCollapseVisible(), size: "large" },
|
|
3524
|
+
React.createElement(Badge, { sx: (theme) => ({
|
|
3751
3525
|
badge: {
|
|
3752
3526
|
right: 3,
|
|
3753
3527
|
top: 3,
|
|
@@ -3755,26 +3529,26 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3755
3529
|
padding: '0 4px',
|
|
3756
3530
|
},
|
|
3757
3531
|
}), badgeContent: this.state.depth, color: "secondary" },
|
|
3758
|
-
|
|
3759
|
-
this.props.objectStatesView && (
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3532
|
+
React.createElement(IconClosed, null))))),
|
|
3533
|
+
this.props.objectStatesView && (React.createElement(Tooltip, { title: this.props.t('ra_Toggle the states view'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3534
|
+
React.createElement(IconButton, { onClick: () => this.onStatesViewVisible(), size: "large" },
|
|
3535
|
+
React.createElement(LooksOneIcon, { color: this.state.statesView ? 'primary' : 'inherit' })))),
|
|
3536
|
+
React.createElement(Tooltip, { title: this.props.t('ra_Show/Hide object descriptions'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3537
|
+
React.createElement(IconButton, { onClick: () => {
|
|
3764
3538
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.desc`, this.state.showDescription ? 'false' : 'true');
|
|
3765
3539
|
this.setState({ showDescription: !this.state.showDescription });
|
|
3766
3540
|
}, size: "large" },
|
|
3767
|
-
|
|
3768
|
-
this.props.objectAddBoolean ? (
|
|
3769
|
-
|
|
3770
|
-
|
|
3541
|
+
React.createElement(TextFieldsIcon, { color: this.state.showDescription ? 'primary' : 'inherit' }))),
|
|
3542
|
+
this.props.objectAddBoolean ? (React.createElement(Tooltip, { title: this.toolTipObjectCreating(), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3543
|
+
React.createElement("div", null,
|
|
3544
|
+
React.createElement(IconButton, { disabled: !allowObjectCreation, onClick: () => this.setState({
|
|
3771
3545
|
modalNewObj: {
|
|
3772
3546
|
id: this.state.selected[0] || this.state.selectedNonObject,
|
|
3773
3547
|
},
|
|
3774
3548
|
}), size: "large" },
|
|
3775
|
-
|
|
3776
|
-
this.props.objectImportExport && (
|
|
3777
|
-
|
|
3549
|
+
React.createElement(AddIcon, null))))) : null,
|
|
3550
|
+
this.props.objectImportExport && (React.createElement(Tooltip, { title: this.props.t('ra_Add objects tree from JSON file'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3551
|
+
React.createElement(IconButton, { onClick: () => {
|
|
3778
3552
|
const input = document.createElement('input');
|
|
3779
3553
|
input.setAttribute('type', 'file');
|
|
3780
3554
|
input.setAttribute('id', 'files');
|
|
@@ -3782,22 +3556,21 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3782
3556
|
input.addEventListener('change', (e) => this.handleJsonUpload(e), false);
|
|
3783
3557
|
input.click();
|
|
3784
3558
|
}, size: "large" },
|
|
3785
|
-
|
|
3559
|
+
React.createElement(PublishIcon, null)))),
|
|
3786
3560
|
this.props.objectImportExport &&
|
|
3787
|
-
(!!this.state.selected.length || this.state.selectedNonObject) && (
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
!!this.props.objectBrowserEditObject && this.props.width !== 'xs' && (
|
|
3791
|
-
this.props.objectEditBoolean && (
|
|
3792
|
-
|
|
3793
|
-
var _b;
|
|
3561
|
+
(!!this.state.selected.length || this.state.selectedNonObject) && (React.createElement(Tooltip, { title: this.props.t('ra_Save objects tree as JSON file'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3562
|
+
React.createElement(IconButton, { onClick: () => this.setState({ showExportDialog: this._getSelectedIdsForExport().length }), size: "large" },
|
|
3563
|
+
React.createElement(PublishIcon, { style: { transform: 'rotate(180deg)' } }))))),
|
|
3564
|
+
!!this.props.objectBrowserEditObject && this.props.width !== 'xs' && (React.createElement("div", { style: { display: 'flex', whiteSpace: 'nowrap' } }, `${this.props.t('ra_Objects')}: ${Object.keys(this.info.objects).length}, ${this.props.t('ra_States')}: ${Object.keys(this.info.objects).filter(el => this.info.objects[el].type === 'state').length}`)),
|
|
3565
|
+
this.props.objectEditBoolean && (React.createElement(Tooltip, { title: this.props.t('ra_Edit custom config'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3566
|
+
React.createElement(IconButton, { onClick: () => {
|
|
3794
3567
|
// get all visible states
|
|
3795
3568
|
const ids = this.root ? getVisibleItems(this.root, 'state', this.objects) : [];
|
|
3796
3569
|
if (ids.length) {
|
|
3797
3570
|
this.pauseSubscribe(true);
|
|
3798
3571
|
if (ids.length === 1) {
|
|
3799
3572
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`, this.state.selected[0]);
|
|
3800
|
-
|
|
3573
|
+
this.props.router?.doNavigate(null, 'custom', this.state.selected[0]);
|
|
3801
3574
|
}
|
|
3802
3575
|
this.setState({ customDialog: ids, customDialogAll: true });
|
|
3803
3576
|
}
|
|
@@ -3805,7 +3578,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3805
3578
|
this.setState({ toast: this.props.t('ra_please select object') });
|
|
3806
3579
|
}
|
|
3807
3580
|
}, size: "large" },
|
|
3808
|
-
|
|
3581
|
+
React.createElement(BuildIcon, null))))));
|
|
3809
3582
|
}
|
|
3810
3583
|
toggleExpanded(id) {
|
|
3811
3584
|
const expanded = JSON.parse(JSON.stringify(this.state.expanded));
|
|
@@ -3823,22 +3596,92 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3823
3596
|
onCopy(e, text) {
|
|
3824
3597
|
e.stopPropagation();
|
|
3825
3598
|
e.preventDefault();
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3599
|
+
if (text) {
|
|
3600
|
+
Utils.copyToClipboard(text);
|
|
3601
|
+
if (text.length < 50) {
|
|
3602
|
+
this.setState({ toast: this.props.t('ra_Copied %s', text) });
|
|
3603
|
+
}
|
|
3604
|
+
else {
|
|
3605
|
+
this.setState({ toast: this.props.t('ra_Copied') });
|
|
3606
|
+
}
|
|
3832
3607
|
}
|
|
3833
3608
|
}
|
|
3609
|
+
renderTooltipAccessControl = (acl) => {
|
|
3610
|
+
// acl ={object,state,owner,ownerGroup}
|
|
3611
|
+
if (!acl) {
|
|
3612
|
+
return null;
|
|
3613
|
+
}
|
|
3614
|
+
const check = [
|
|
3615
|
+
{
|
|
3616
|
+
value: '0x400',
|
|
3617
|
+
valueNum: 0x400,
|
|
3618
|
+
title: 'read',
|
|
3619
|
+
group: 'Owner',
|
|
3620
|
+
},
|
|
3621
|
+
{
|
|
3622
|
+
value: '0x200',
|
|
3623
|
+
valueNum: 0x200,
|
|
3624
|
+
title: 'write',
|
|
3625
|
+
group: 'Owner',
|
|
3626
|
+
},
|
|
3627
|
+
{
|
|
3628
|
+
value: '0x40',
|
|
3629
|
+
valueNum: 0x40,
|
|
3630
|
+
title: 'read',
|
|
3631
|
+
group: 'Group',
|
|
3632
|
+
},
|
|
3633
|
+
{
|
|
3634
|
+
value: '0x20',
|
|
3635
|
+
valueNum: 0x20,
|
|
3636
|
+
title: 'write',
|
|
3637
|
+
group: 'Group',
|
|
3638
|
+
},
|
|
3639
|
+
{
|
|
3640
|
+
value: '0x4',
|
|
3641
|
+
valueNum: 0x4,
|
|
3642
|
+
title: 'read',
|
|
3643
|
+
group: 'Everyone',
|
|
3644
|
+
},
|
|
3645
|
+
{
|
|
3646
|
+
value: '0x2',
|
|
3647
|
+
valueNum: 0x2,
|
|
3648
|
+
title: 'write',
|
|
3649
|
+
group: 'Everyone',
|
|
3650
|
+
},
|
|
3651
|
+
];
|
|
3652
|
+
const arrayTooltipText = [];
|
|
3653
|
+
const funcRenderStateObject = (value) => {
|
|
3654
|
+
const rights = acl[value];
|
|
3655
|
+
check.forEach((el, i) => {
|
|
3656
|
+
if (rights & el.valueNum) {
|
|
3657
|
+
arrayTooltipText.push(React.createElement("span", { key: value + i },
|
|
3658
|
+
this.texts[`acl${el.group}_${el.title}_${value}`],
|
|
3659
|
+
",",
|
|
3660
|
+
React.createElement("span", { style: value === 'object' ? styles.rightsObject : styles.rightsState }, el.value)));
|
|
3661
|
+
}
|
|
3662
|
+
});
|
|
3663
|
+
};
|
|
3664
|
+
arrayTooltipText.push(React.createElement("span", { key: "group" }, `${this.texts.ownerGroup}: ${(acl.ownerGroup || '').replace('system.group.', '')}`));
|
|
3665
|
+
arrayTooltipText.push(React.createElement("span", { key: "owner" }, `${this.texts.ownerUser}: ${(acl.owner || '').replace('system.user.', '')}`));
|
|
3666
|
+
funcRenderStateObject('object');
|
|
3667
|
+
if (acl.state) {
|
|
3668
|
+
funcRenderStateObject('state');
|
|
3669
|
+
}
|
|
3670
|
+
return arrayTooltipText.length ? (React.createElement("span", { style: styles.tooltipAccessControl }, arrayTooltipText.map(el => el))) : null;
|
|
3671
|
+
};
|
|
3834
3672
|
renderColumnButtons(id, item) {
|
|
3835
|
-
var _b, _c, _d;
|
|
3836
3673
|
if (!item.data.obj) {
|
|
3837
|
-
return this.props.onObjectDelete || this.props.objectEditOfAccessControl ? (
|
|
3838
|
-
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? (
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3674
|
+
return this.props.onObjectDelete || this.props.objectEditOfAccessControl ? (React.createElement("div", { style: styles.buttonDiv },
|
|
3675
|
+
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? (React.createElement(IconButton, { sx: {
|
|
3676
|
+
...styles.cellButtonsButton,
|
|
3677
|
+
...styles.cellButtonsEmptyButton,
|
|
3678
|
+
...styles.cellButtonMinWidth,
|
|
3679
|
+
}, onClick: () => this.setState({ modalEditOfAccess: true, modalEditOfAccessObjData: item.data }), size: "large" },
|
|
3680
|
+
React.createElement("div", { style: { height: 15 } }, "---"))) : null,
|
|
3681
|
+
this.props.onObjectDelete && item.children && item.children.length ? (React.createElement(IconButton, { sx: {
|
|
3682
|
+
...styles.cellButtonsButton,
|
|
3683
|
+
...styles.cellButtonsButtonAlone,
|
|
3684
|
+
}, size: "small", "aria-label": "delete", title: this.texts.deleteObject, onClick: () => {
|
|
3842
3685
|
// calculate the number of children
|
|
3843
3686
|
const keys = Object.keys(this.objects);
|
|
3844
3687
|
keys.sort();
|
|
@@ -3853,10 +3696,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3853
3696
|
}
|
|
3854
3697
|
}
|
|
3855
3698
|
if (this.props.onObjectDelete) {
|
|
3856
|
-
this.props.onObjectDelete(id, !!
|
|
3699
|
+
this.props.onObjectDelete(id, !!item.children?.length, false, count + 1);
|
|
3857
3700
|
}
|
|
3858
3701
|
} },
|
|
3859
|
-
|
|
3702
|
+
React.createElement(IconDelete, { style: styles.cellButtonsButtonIcon }))) : null)) : null;
|
|
3860
3703
|
}
|
|
3861
3704
|
item.data.aclTooltip =
|
|
3862
3705
|
item.data.aclTooltip || this.renderTooltipAccessControl(item.data.obj.acl);
|
|
@@ -3869,20 +3712,26 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3869
3712
|
(item.data.obj.type === 'state'
|
|
3870
3713
|
? this.systemConfig.common.defaultNewAcl.state
|
|
3871
3714
|
: this.systemConfig.common.defaultNewAcl.object);
|
|
3872
|
-
const showEdit = this.state.filter.expertMode ||
|
|
3715
|
+
const showEdit = this.state.filter.expertMode || ObjectBrowserClass.isNonExpertId(item.data.id);
|
|
3873
3716
|
return [
|
|
3874
|
-
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? (
|
|
3875
|
-
|
|
3876
|
-
|
|
3717
|
+
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? (React.createElement(Tooltip, { key: "acl", title: item.data.aclTooltip, slotProps: { popper: { sx: styles.tooltip } } },
|
|
3718
|
+
React.createElement(IconButton, { sx: {
|
|
3719
|
+
...styles.cellButtonsButton,
|
|
3720
|
+
...styles.cellButtonMinWidth,
|
|
3721
|
+
opacity: 1,
|
|
3722
|
+
}, onClick: () => this.setState({ modalEditOfAccess: true, modalEditOfAccessObjData: item.data }), size: "large" },
|
|
3723
|
+
React.createElement("div", { style: styles.aclText }, Number.isNaN(Number(acl))
|
|
3877
3724
|
? Number(aclSystemConfig).toString(16)
|
|
3878
|
-
: Number(acl).toString(16))))) : (
|
|
3879
|
-
showEdit ? (
|
|
3725
|
+
: Number(acl).toString(16))))) : (React.createElement("div", { key: "aclEmpty", style: styles.cellButtonMinWidth })),
|
|
3726
|
+
showEdit ? (React.createElement(IconButton, { key: "edit", sx: {
|
|
3727
|
+
marginRight: '2px',
|
|
3728
|
+
...styles.cellButtonsButton,
|
|
3729
|
+
}, size: "small", "aria-label": "edit", title: this.texts.editObject, onClick: () => {
|
|
3880
3730
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`, id);
|
|
3881
3731
|
this.setState({ editObjectDialog: id, editObjectAlias: false });
|
|
3882
3732
|
} },
|
|
3883
|
-
|
|
3884
|
-
this.props.onObjectDelete && (
|
|
3885
|
-
var _b, _c, _d;
|
|
3733
|
+
React.createElement(IconEdit, { style: styles.cellButtonsButtonIcon }))) : (React.createElement(Box, { component: "div", key: "editDisabled", sx: styles.cellButtonsButton })),
|
|
3734
|
+
this.props.onObjectDelete && (item.children?.length || !item.data.obj.common?.dontDelete) ? (React.createElement(IconButton, { key: "delete", sx: styles.cellButtonsButton, size: "small", "aria-label": "delete", onClick: () => {
|
|
3886
3735
|
const keys = Object.keys(this.objects);
|
|
3887
3736
|
keys.sort();
|
|
3888
3737
|
let count = 0;
|
|
@@ -3896,28 +3745,29 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3896
3745
|
}
|
|
3897
3746
|
}
|
|
3898
3747
|
if (this.props.onObjectDelete) {
|
|
3899
|
-
this.props.onObjectDelete(id, !!
|
|
3748
|
+
this.props.onObjectDelete(id, !!item.children?.length, !item.data.obj?.common?.dontDelete, count);
|
|
3900
3749
|
}
|
|
3901
3750
|
}, title: this.texts.deleteObject },
|
|
3902
|
-
|
|
3751
|
+
React.createElement(IconDelete, { style: styles.cellButtonsButtonIcon }))) : null,
|
|
3903
3752
|
this.props.objectCustomDialog &&
|
|
3904
3753
|
this.info.hasSomeCustoms &&
|
|
3905
3754
|
item.data.obj.type === 'state' &&
|
|
3906
3755
|
// @ts-expect-error deprecated from js-controller 6
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3756
|
+
item.data.obj.common?.type !== 'file' ? (React.createElement(IconButton, { sx: {
|
|
3757
|
+
...styles.cellButtonsButton,
|
|
3758
|
+
...(item.data.hasCustoms
|
|
3759
|
+
? this.styles.cellButtonsButtonWithCustoms
|
|
3760
|
+
: styles.cellButtonsButtonWithoutCustoms),
|
|
3761
|
+
}, key: "custom", size: "small", "aria-label": "config", title: this.texts.customConfig, onClick: () => {
|
|
3911
3762
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`, id);
|
|
3912
3763
|
this.pauseSubscribe(true);
|
|
3913
|
-
|
|
3764
|
+
this.props.router?.doNavigate(null, 'customs', id);
|
|
3914
3765
|
this.setState({ customDialog: [id], customDialogAll: false });
|
|
3915
3766
|
} },
|
|
3916
|
-
|
|
3767
|
+
React.createElement(IconConfig, { style: styles.cellButtonsButtonIcon }))) : null,
|
|
3917
3768
|
];
|
|
3918
3769
|
}
|
|
3919
3770
|
readHistory(id) {
|
|
3920
|
-
var _b, _c;
|
|
3921
3771
|
/* interface GetHistoryOptions {
|
|
3922
3772
|
instance?: string;
|
|
3923
3773
|
start?: number;
|
|
@@ -3935,7 +3785,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3935
3785
|
} */
|
|
3936
3786
|
if (window.sparkline &&
|
|
3937
3787
|
this.defaultHistory &&
|
|
3938
|
-
|
|
3788
|
+
this.objects[id]?.common?.custom &&
|
|
3939
3789
|
this.objects[id].common.custom[this.defaultHistory]) {
|
|
3940
3790
|
const now = new Date();
|
|
3941
3791
|
now.setHours(now.getHours() - 24);
|
|
@@ -3969,7 +3819,6 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3969
3819
|
}
|
|
3970
3820
|
}
|
|
3971
3821
|
getTooltipInfo(id, cb) {
|
|
3972
|
-
var _b, _c;
|
|
3973
3822
|
const obj = this.objects[id];
|
|
3974
3823
|
const state = this.states[id];
|
|
3975
3824
|
const { valFull, fileViewer } = formatValue({
|
|
@@ -3981,45 +3830,44 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3981
3830
|
full: true,
|
|
3982
3831
|
});
|
|
3983
3832
|
const valFullRx = [];
|
|
3984
|
-
valFull
|
|
3833
|
+
valFull?.forEach(_item => {
|
|
3985
3834
|
if (_item.t === this.texts.quality && state.q) {
|
|
3986
|
-
valFullRx.push(
|
|
3835
|
+
valFullRx.push(React.createElement("div", { style: styles.cellValueTooltipBoth, key: _item.t },
|
|
3987
3836
|
_item.t,
|
|
3988
3837
|
":\u00A0",
|
|
3989
3838
|
_item.v));
|
|
3990
3839
|
// <div style={styles.cellValueTooltipValue} key={item.t + '_v'}>{item.v}</div>,
|
|
3991
3840
|
if (!_item.nbr) {
|
|
3992
|
-
valFullRx.push(
|
|
3841
|
+
valFullRx.push(React.createElement("br", { key: `${_item.t}_br` }));
|
|
3993
3842
|
}
|
|
3994
3843
|
}
|
|
3995
3844
|
else {
|
|
3996
|
-
valFullRx.push(
|
|
3845
|
+
valFullRx.push(React.createElement("div", { style: styles.cellValueTooltipTitle, key: _item.t },
|
|
3997
3846
|
_item.t,
|
|
3998
3847
|
":\u00A0"));
|
|
3999
|
-
valFullRx.push(
|
|
3848
|
+
valFullRx.push(React.createElement("div", { style: styles.cellValueTooltipValue, key: `${_item.t}_v` }, _item.v));
|
|
4000
3849
|
if (!_item.nbr) {
|
|
4001
|
-
valFullRx.push(
|
|
3850
|
+
valFullRx.push(React.createElement("br", { key: `${_item.t}_br` }));
|
|
4002
3851
|
}
|
|
4003
3852
|
}
|
|
4004
3853
|
});
|
|
4005
3854
|
if (fileViewer === 'image') {
|
|
4006
|
-
valFullRx.push(
|
|
3855
|
+
valFullRx.push(React.createElement("img", { style: styles.cellValueTooltipImage, src: state.val, alt: id }));
|
|
4007
3856
|
}
|
|
4008
3857
|
else if (this.defaultHistory &&
|
|
4009
|
-
|
|
3858
|
+
this.objects[id]?.common?.custom &&
|
|
4010
3859
|
this.objects[id].common.custom[this.defaultHistory]) {
|
|
4011
|
-
valFullRx.push(
|
|
3860
|
+
valFullRx.push(React.createElement("svg", { key: "sparkline", className: "sparkline", "data-id": id, style: { fill: '#3d85de' }, width: "200", height: "30", strokeWidth: "3" }));
|
|
4012
3861
|
}
|
|
4013
3862
|
this.setState({ tooltipInfo: { el: valFullRx, id } }, () => cb && cb());
|
|
4014
3863
|
}
|
|
4015
3864
|
renderColumnValue(id, item, narrowStyleWithDetails) {
|
|
4016
|
-
var _b, _c;
|
|
4017
3865
|
const obj = item.data.obj;
|
|
4018
3866
|
if (!obj || !this.states) {
|
|
4019
3867
|
return null;
|
|
4020
3868
|
}
|
|
4021
|
-
if (
|
|
4022
|
-
return (
|
|
3869
|
+
if (obj.common?.type === 'file') {
|
|
3870
|
+
return (React.createElement(Box, { component: "div", sx: { ...styles.cellValueText, ...styles.cellValueFile } }, "[file]"));
|
|
4023
3871
|
}
|
|
4024
3872
|
if (!this.states[id]) {
|
|
4025
3873
|
if (obj.type === 'state') {
|
|
@@ -4050,23 +3898,23 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4050
3898
|
const valTextRx = [];
|
|
4051
3899
|
item.data.state = { valTextRx };
|
|
4052
3900
|
const copyText = valText.v || '';
|
|
4053
|
-
valTextRx.push(
|
|
3901
|
+
valTextRx.push(React.createElement("span", { className: `newValueBrowser-${this.props.themeType || 'light'}`, key: `${valText.v.toString()}valText`, style: {
|
|
4054
3902
|
whiteSpace: 'nowrap',
|
|
4055
3903
|
display: 'inline-block',
|
|
4056
3904
|
overflow: 'hidden',
|
|
4057
3905
|
textOverflow: 'ellipsis',
|
|
4058
3906
|
} }, valText.v.toString()));
|
|
4059
3907
|
if (valText.u) {
|
|
4060
|
-
valTextRx.push(
|
|
3908
|
+
valTextRx.push(React.createElement("span", { className: `newValueBrowser-${this.props.themeType || 'light'}`, style: styles.cellValueTextUnit, key: `${valText.v.toString()}unit` }, valText.u));
|
|
4061
3909
|
}
|
|
4062
3910
|
if (valText.s !== undefined) {
|
|
4063
|
-
valTextRx.push(
|
|
3911
|
+
valTextRx.push(React.createElement("span", { style: styles.cellValueTextState, className: `newValueBrowser-${this.props.themeType || 'light'}`, key: `${valText.v.toString()}states` },
|
|
4064
3912
|
"(",
|
|
4065
3913
|
valText.s,
|
|
4066
3914
|
")"));
|
|
4067
3915
|
}
|
|
4068
3916
|
if (!narrowStyleWithDetails) {
|
|
4069
|
-
valTextRx.push(
|
|
3917
|
+
valTextRx.push(React.createElement(IconCopy, { className: "copyButton", style: this.styles.iconCopy, onClick: e => this.onCopy(e, copyText), key: "cc" }));
|
|
4070
3918
|
}
|
|
4071
3919
|
// <IconEdit className="copyButton" style={{{ ...styles.cellButtonsValueButton, styles.cellButtonsValueButtonEdit)} key="ce" />
|
|
4072
3920
|
info = item.data.state;
|
|
@@ -4076,12 +3924,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4076
3924
|
if (!this.state.filter.expertMode) {
|
|
4077
3925
|
if (item.data.button) {
|
|
4078
3926
|
val = [
|
|
4079
|
-
|
|
3927
|
+
React.createElement(ButtonIcon, { key: "button", style: { color: info.style.color, ...styles.cellValueButton } }),
|
|
4080
3928
|
];
|
|
4081
3929
|
}
|
|
4082
3930
|
else if (item.data.switch) {
|
|
4083
3931
|
val = [
|
|
4084
|
-
|
|
3932
|
+
React.createElement(Switch, { key: "switch", sx: {
|
|
4085
3933
|
'& .MuiSwitch-thumb': { color: info.style.color },
|
|
4086
3934
|
'& .MuiSwitch-track': {
|
|
4087
3935
|
backgroundColor: !!this.states[id].val && this.state.selected.includes(id)
|
|
@@ -4094,16 +3942,19 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4094
3942
|
];
|
|
4095
3943
|
}
|
|
4096
3944
|
}
|
|
4097
|
-
return (
|
|
3945
|
+
return (React.createElement(Tooltip, { key: "value", title: this.state.tooltipInfo?.el, slotProps: {
|
|
4098
3946
|
popper: { sx: styles.cellValueTooltipBox },
|
|
4099
3947
|
tooltip: { sx: styles.cellValueTooltip },
|
|
4100
|
-
}, onOpen: () => this.getTooltipInfo(id, () => this.readHistory(id)), onClose: () =>
|
|
4101
|
-
|
|
3948
|
+
}, onOpen: () => this.getTooltipInfo(id, () => this.readHistory(id)), onClose: () => this.state.tooltipInfo?.id === id && this.setState({ tooltipInfo: null }) },
|
|
3949
|
+
React.createElement(Box, { component: "div", style: info.style, sx: {
|
|
3950
|
+
...styles.cellValueText,
|
|
3951
|
+
height: narrowStyleWithDetails ? undefined : ROW_HEIGHT,
|
|
3952
|
+
'& .admin-button:active': {
|
|
4102
3953
|
transform: 'translate(0, 2px)',
|
|
4103
|
-
}
|
|
3954
|
+
},
|
|
3955
|
+
} }, val)));
|
|
4104
3956
|
}
|
|
4105
3957
|
_syncEnum(id, enumIds, newArray, cb) {
|
|
4106
|
-
var _b, _c, _d;
|
|
4107
3958
|
if (!enumIds || !enumIds.length) {
|
|
4108
3959
|
if (cb) {
|
|
4109
3960
|
cb();
|
|
@@ -4112,8 +3963,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4112
3963
|
}
|
|
4113
3964
|
const enumId = enumIds.pop() || '';
|
|
4114
3965
|
const promises = [];
|
|
4115
|
-
if (
|
|
4116
|
-
if (
|
|
3966
|
+
if (this.info.objects[enumId]?.common) {
|
|
3967
|
+
if (this.info.objects[enumId].common.members?.length) {
|
|
4117
3968
|
const pos = this.info.objects[enumId].common.members.indexOf(id);
|
|
4118
3969
|
if (pos !== -1 && !newArray.includes(enumId)) {
|
|
4119
3970
|
// delete it from members
|
|
@@ -4126,7 +3977,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4126
3977
|
}
|
|
4127
3978
|
}
|
|
4128
3979
|
// add to it
|
|
4129
|
-
if (newArray.includes(enumId) && !
|
|
3980
|
+
if (newArray.includes(enumId) && !this.info.objects[enumId].common.members?.includes(id)) {
|
|
4130
3981
|
// add to object
|
|
4131
3982
|
const obj = JSON.parse(JSON.stringify(this.info.objects[enumId]));
|
|
4132
3983
|
obj.common.members = obj.common.members || [];
|
|
@@ -4160,28 +4011,25 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4160
4011
|
const itemEnums = this.state.enumDialogEnums;
|
|
4161
4012
|
const enumsOriginal = this.state.enumDialog.enumsOriginal;
|
|
4162
4013
|
const enums = (type === 'room' ? this.info.roomEnums : this.info.funcEnums)
|
|
4163
|
-
.map(id => {
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
icon: getSelectIdIconFromObjects(this.objects, id, this.props.lang, this.imagePrefix),
|
|
4169
|
-
});
|
|
4170
|
-
})
|
|
4014
|
+
.map(id => ({
|
|
4015
|
+
name: getName(this.objects[id]?.common?.name || id.split('.').pop() || '', this.props.lang),
|
|
4016
|
+
value: id,
|
|
4017
|
+
icon: getSelectIdIconFromObjects(this.objects, id, this.props.lang, this.imagePrefix),
|
|
4018
|
+
}))
|
|
4171
4019
|
.sort((a, b) => (a.name > b.name ? 1 : -1));
|
|
4172
4020
|
enums.forEach(_item => {
|
|
4173
4021
|
if (_item.icon && typeof _item.icon === 'string') {
|
|
4174
|
-
_item.icon = (
|
|
4175
|
-
|
|
4022
|
+
_item.icon = (React.createElement(Box, { style: styles.enumIconDiv },
|
|
4023
|
+
React.createElement("img", { src: _item.icon, style: styles.enumIcon, alt: _item.name })));
|
|
4176
4024
|
}
|
|
4177
4025
|
});
|
|
4178
4026
|
// const hasIcons = !!enums.find(item => item.icon);
|
|
4179
|
-
return (
|
|
4180
|
-
|
|
4027
|
+
return (React.createElement(Dialog, { sx: { '& .MuiPaper-root': styles.enumDialog }, onClose: () => this.setState({ enumDialog: null }), "aria-labelledby": "enum-dialog-title", open: !0 },
|
|
4028
|
+
React.createElement(DialogTitle, { id: "enum-dialog-title" },
|
|
4181
4029
|
type === 'func' ? this.props.t('ra_Define functions') : this.props.t('ra_Define rooms'),
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4030
|
+
React.createElement(Fab, { sx: styles.enumButton, color: "primary", disabled: enumsOriginal === JSON.stringify(itemEnums), size: "small", onClick: () => this.syncEnum(item.data.id, type, itemEnums).then(() => this.setState({ enumDialog: null, enumDialogEnums: null })) },
|
|
4031
|
+
React.createElement(IconCheck, null))),
|
|
4032
|
+
React.createElement(List, { sx: { '&.MuiList-root': styles.enumList } }, enums.map(_item => {
|
|
4185
4033
|
let id;
|
|
4186
4034
|
let name;
|
|
4187
4035
|
let icon;
|
|
@@ -4195,7 +4043,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4195
4043
|
name = _item;
|
|
4196
4044
|
}
|
|
4197
4045
|
const labelId = `checkbox-list-label-${id}`;
|
|
4198
|
-
return (
|
|
4046
|
+
return (React.createElement(ListItem, { sx: styles.headerCellSelectItem, key: id, onClick: () => {
|
|
4199
4047
|
const pos = itemEnums.indexOf(id);
|
|
4200
4048
|
const enumDialogEnums = JSON.parse(JSON.stringify(this.state.enumDialogEnums));
|
|
4201
4049
|
if (pos === -1) {
|
|
@@ -4207,9 +4055,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4207
4055
|
}
|
|
4208
4056
|
this.setState({ enumDialogEnums });
|
|
4209
4057
|
}, secondaryAction: icon },
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4058
|
+
React.createElement(ListItemIcon, { sx: { '&.MuiListItemIcon-root': styles.enumCheckbox } },
|
|
4059
|
+
React.createElement(Checkbox, { edge: "start", checked: itemEnums.includes(id), tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': labelId } })),
|
|
4060
|
+
React.createElement(ListItemText, { id: labelId }, name)));
|
|
4213
4061
|
}))));
|
|
4214
4062
|
}
|
|
4215
4063
|
renderEditRoleDialog() {
|
|
@@ -4218,7 +4066,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4218
4066
|
}
|
|
4219
4067
|
if (this.state.roleDialog && this.props.objectBrowserEditRole) {
|
|
4220
4068
|
const ObjectBrowserEditRole = this.props.objectBrowserEditRole;
|
|
4221
|
-
return (
|
|
4069
|
+
return (React.createElement(ObjectBrowserEditRole, { key: "objectBrowserEditRole", id: this.state.roleDialog, socket: this.props.socket, t: this.props.t, roles: this.info.roles, onClose: (obj) => {
|
|
4222
4070
|
if (obj) {
|
|
4223
4071
|
this.info.objects[this.state.roleDialog] = obj;
|
|
4224
4072
|
}
|
|
@@ -4228,7 +4076,6 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4228
4076
|
return null;
|
|
4229
4077
|
}
|
|
4230
4078
|
onColumnsEditCustomDialogClose(isSave) {
|
|
4231
|
-
var _b, _c;
|
|
4232
4079
|
// cannot be null
|
|
4233
4080
|
const customColumnDialog = this.customColumnDialog;
|
|
4234
4081
|
if (isSave) {
|
|
@@ -4241,11 +4088,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4241
4088
|
}
|
|
4242
4089
|
this.customColumnDialog = null;
|
|
4243
4090
|
this.props.socket
|
|
4244
|
-
.getObject(
|
|
4091
|
+
.getObject(this.state.columnsEditCustomDialog?.obj?._id || '')
|
|
4245
4092
|
.then(obj => {
|
|
4246
|
-
|
|
4247
|
-
if (obj &&
|
|
4248
|
-
_a.setCustomValue(obj, (_b = this.state.columnsEditCustomDialog) === null || _b === void 0 ? void 0 : _b.it, value)) {
|
|
4093
|
+
if (obj && ObjectBrowserClass.setCustomValue(obj, this.state.columnsEditCustomDialog?.it, value)) {
|
|
4249
4094
|
return this.props.socket.setObject(obj._id, obj);
|
|
4250
4095
|
}
|
|
4251
4096
|
throw new Error(this.props.t('ra_Cannot update attribute, because not found in the object'));
|
|
@@ -4263,24 +4108,24 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4263
4108
|
return null;
|
|
4264
4109
|
}
|
|
4265
4110
|
if (!this.customColumnDialog) {
|
|
4266
|
-
const value =
|
|
4111
|
+
const value = ObjectBrowserClass.getCustomValue(this.state.columnsEditCustomDialog.obj, this.state.columnsEditCustomDialog.it);
|
|
4267
4112
|
this.customColumnDialog = {
|
|
4268
4113
|
type: (this.state.columnsEditCustomDialog.it.type || typeof value),
|
|
4269
4114
|
initValue: (value === null || value === undefined ? '' : value).toString(),
|
|
4270
4115
|
value: (value === null || value === undefined ? '' : value).toString(),
|
|
4271
4116
|
};
|
|
4272
4117
|
}
|
|
4273
|
-
return (
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4118
|
+
return (React.createElement(Dialog, { onClose: () => this.setState({ columnsEditCustomDialog: null }), maxWidth: "md", "aria-labelledby": "custom-dialog-title", open: !0 },
|
|
4119
|
+
React.createElement(DialogTitle, { id: "custom-dialog-title" }, `${this.props.t('ra_Edit object field')}: ${this.state.columnsEditCustomDialog.obj._id}`),
|
|
4120
|
+
React.createElement(DialogContent, null,
|
|
4121
|
+
React.createElement(DialogContentText, { id: "alert-dialog-description" }, this.customColumnDialog.type === 'boolean' ? (React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { onKeyUp: e => e.key === 'Enter' && this.onColumnsEditCustomDialogClose(true), defaultChecked: this.customColumnDialog.value === 'true', onChange: e => {
|
|
4277
4122
|
const customColumnDialog = this.customColumnDialog;
|
|
4278
4123
|
customColumnDialog.value = e.target.checked.toString();
|
|
4279
4124
|
const changed = customColumnDialog.value !== customColumnDialog.initValue;
|
|
4280
4125
|
if (changed === !this.state.customColumnDialogValueChanged) {
|
|
4281
4126
|
this.setState({ customColumnDialogValueChanged: changed });
|
|
4282
4127
|
}
|
|
4283
|
-
} }), label: `${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})` })) : (
|
|
4128
|
+
} }), label: `${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})` })) : (React.createElement(TextField, { variant: "standard", defaultValue: this.customColumnDialog.value, fullWidth: true, onKeyUp: e => e.key === 'Enter' && this.onColumnsEditCustomDialogClose(true), label: `${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`, onChange: e => {
|
|
4284
4129
|
const customColumnDialog = this.customColumnDialog;
|
|
4285
4130
|
customColumnDialog.value = e.target.value;
|
|
4286
4131
|
const changed = customColumnDialog.value !== customColumnDialog.initValue;
|
|
@@ -4288,13 +4133,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4288
4133
|
this.setState({ customColumnDialogValueChanged: changed });
|
|
4289
4134
|
}
|
|
4290
4135
|
}, autoFocus: true })))),
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4136
|
+
React.createElement(DialogActions, null,
|
|
4137
|
+
React.createElement(Button, { variant: "contained", onClick: () => this.onColumnsEditCustomDialogClose(true), disabled: !this.state.customColumnDialogValueChanged, color: "primary", startIcon: React.createElement(IconCheck, null) }, this.props.t('ra_Update')),
|
|
4138
|
+
React.createElement(Button, { color: "grey", variant: "contained", onClick: () => this.onColumnsEditCustomDialogClose(), startIcon: React.createElement(IconClose, null) }, this.props.t('ra_Cancel')))));
|
|
4294
4139
|
}
|
|
4295
4140
|
static getCustomValue(obj, it) {
|
|
4296
|
-
|
|
4297
|
-
if (((_b = obj === null || obj === void 0 ? void 0 : obj._id) === null || _b === void 0 ? void 0 : _b.startsWith(`${it.adapter}.`)) && it.path.length > 1) {
|
|
4141
|
+
if (obj?._id?.startsWith(`${it.adapter}.`) && it.path.length > 1) {
|
|
4298
4142
|
const p = it.path;
|
|
4299
4143
|
let value;
|
|
4300
4144
|
const anyObj = obj;
|
|
@@ -4341,8 +4185,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4341
4185
|
return null;
|
|
4342
4186
|
}
|
|
4343
4187
|
static setCustomValue(obj, it, value) {
|
|
4344
|
-
|
|
4345
|
-
if (((_b = obj === null || obj === void 0 ? void 0 : obj._id) === null || _b === void 0 ? void 0 : _b.startsWith(`${it.adapter}.`)) && it.path.length > 1) {
|
|
4188
|
+
if (obj?._id?.startsWith(`${it.adapter}.`) && it.path.length > 1) {
|
|
4346
4189
|
const p = it.path;
|
|
4347
4190
|
const anyObj = obj;
|
|
4348
4191
|
if (anyObj[p[0]] && typeof anyObj[p[0]] === 'object') {
|
|
@@ -4398,15 +4241,22 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4398
4241
|
* Renders a custom value.
|
|
4399
4242
|
*/
|
|
4400
4243
|
renderCustomValue(obj, it, item) {
|
|
4401
|
-
const text =
|
|
4244
|
+
const text = ObjectBrowserClass.getCustomValue(obj, it);
|
|
4402
4245
|
if (text !== null && text !== undefined) {
|
|
4403
4246
|
if (it.edit && !this.props.notEditable && (!it.objTypes || it.objTypes.includes(obj.type))) {
|
|
4404
|
-
return (
|
|
4247
|
+
return (React.createElement(Box, { component: "div", style: {
|
|
4248
|
+
...styles.columnCustom,
|
|
4249
|
+
...styles.columnCustomEditable,
|
|
4250
|
+
...styles[`columnCustom_${it.align}`],
|
|
4251
|
+
}, onClick: () => this.setState({
|
|
4405
4252
|
columnsEditCustomDialog: { item, it, obj },
|
|
4406
4253
|
customColumnDialogValueChanged: false,
|
|
4407
4254
|
}) }, text));
|
|
4408
4255
|
}
|
|
4409
|
-
return (
|
|
4256
|
+
return (React.createElement(Box, { component: "div", style: {
|
|
4257
|
+
...styles.columnCustom,
|
|
4258
|
+
...styles[`columnCustom_${it.align}`],
|
|
4259
|
+
} }, text));
|
|
4410
4260
|
}
|
|
4411
4261
|
return null;
|
|
4412
4262
|
}
|
|
@@ -4415,7 +4265,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4415
4265
|
// read the type of operation
|
|
4416
4266
|
const aliasObj = this.objects[this.info.aliasesMap[id][_index]].common.alias.id;
|
|
4417
4267
|
if (aliasObj) {
|
|
4418
|
-
return (
|
|
4268
|
+
return (React.createElement(Box, { component: "div", onClick: e => {
|
|
4419
4269
|
e.stopPropagation();
|
|
4420
4270
|
e.preventDefault();
|
|
4421
4271
|
const aliasId = this.info.aliasesMap[id][_index];
|
|
@@ -4426,7 +4276,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4426
4276
|
this.onSelect(aliasId);
|
|
4427
4277
|
setTimeout(() => this.expandAllSelected(() => this.scrollToItem(aliasId)), 100);
|
|
4428
4278
|
}, sx: customStyle || this.styles.aliasAlone },
|
|
4429
|
-
|
|
4279
|
+
React.createElement("span", { className: "admin-browser-arrow" }, typeof aliasObj === 'string' || (aliasObj.read === id && aliasObj.write === id)
|
|
4430
4280
|
? '↔'
|
|
4431
4281
|
: aliasObj.read === id
|
|
4432
4282
|
? '→'
|
|
@@ -4439,43 +4289,42 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4439
4289
|
* Renders a leaf.
|
|
4440
4290
|
*/
|
|
4441
4291
|
renderLeaf(item, isExpanded, counter) {
|
|
4442
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
4443
4292
|
const id = item.data.id;
|
|
4444
4293
|
counter.count++;
|
|
4445
4294
|
isExpanded = isExpanded === undefined ? this.state.expanded.includes(id) : isExpanded;
|
|
4446
4295
|
// icon
|
|
4447
4296
|
let iconFolder;
|
|
4448
4297
|
const obj = item.data.obj;
|
|
4449
|
-
const itemType = obj
|
|
4298
|
+
const itemType = obj?.type;
|
|
4450
4299
|
if (item.children ||
|
|
4451
4300
|
itemType === 'folder' ||
|
|
4452
4301
|
itemType === 'device' ||
|
|
4453
4302
|
itemType === 'channel' ||
|
|
4454
4303
|
itemType === 'meta') {
|
|
4455
|
-
iconFolder = isExpanded ? (
|
|
4304
|
+
iconFolder = isExpanded ? (React.createElement(IconOpen, { style: this.styles.cellIdIconFolder, onClick: () => this.toggleExpanded(id) })) : (React.createElement(IconClosed, { style: this.styles.cellIdIconFolder, onClick: () => this.toggleExpanded(id) }));
|
|
4456
4305
|
}
|
|
4457
4306
|
else if (obj && obj.common && obj.common.write === false && obj.type === 'state') {
|
|
4458
|
-
iconFolder =
|
|
4307
|
+
iconFolder = React.createElement(IconDocumentReadOnly, { style: this.styles.cellIdIconDocument });
|
|
4459
4308
|
}
|
|
4460
4309
|
else {
|
|
4461
|
-
iconFolder =
|
|
4310
|
+
iconFolder = React.createElement(IconDocument, { style: this.styles.cellIdIconDocument });
|
|
4462
4311
|
}
|
|
4463
4312
|
let iconItem = null;
|
|
4464
4313
|
if (item.data.icon) {
|
|
4465
4314
|
if (typeof item.data.icon === 'string') {
|
|
4466
4315
|
if (item.data.icon.length < 3) {
|
|
4467
|
-
iconItem = (
|
|
4316
|
+
iconItem = (React.createElement("span", { className: "iconOwn", style: styles.cellIdIconOwn }, item.data.icon)); // utf-8 char
|
|
4468
4317
|
}
|
|
4469
4318
|
else {
|
|
4470
|
-
iconItem = (
|
|
4319
|
+
iconItem = (React.createElement(Icon, { style: styles.cellIdIconOwn, className: "iconOwn", src: item.data.icon, alt: "" }));
|
|
4471
4320
|
}
|
|
4472
4321
|
}
|
|
4473
4322
|
else {
|
|
4474
4323
|
iconItem = item.data.icon;
|
|
4475
4324
|
}
|
|
4476
4325
|
}
|
|
4477
|
-
const common = obj
|
|
4478
|
-
const typeImg = (
|
|
4326
|
+
const common = obj?.common;
|
|
4327
|
+
const typeImg = (obj?.type && ITEM_IMAGES[obj.type]) || React.createElement("div", { className: "itemIcon" });
|
|
4479
4328
|
const paddingLeft = this.levelPadding * (item.data.level || 0);
|
|
4480
4329
|
// recalculate rooms and function names if the language changed
|
|
4481
4330
|
if (item.data.lang !== this.props.lang) {
|
|
@@ -4489,11 +4338,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4489
4338
|
}
|
|
4490
4339
|
const checkbox = this.props.multiSelect &&
|
|
4491
4340
|
this.objects[id] &&
|
|
4492
|
-
(!this.props.types || this.props.types.includes(this.objects[id].type)) ? (
|
|
4341
|
+
(!this.props.types || this.props.types.includes(this.objects[id].type)) ? (React.createElement(Checkbox, { style: styles.checkBox, checked: this.state.selected.includes(id) })) : null;
|
|
4493
4342
|
let valueEditable = !this.props.notEditable &&
|
|
4494
4343
|
itemType === 'state' &&
|
|
4495
|
-
(this.state.filter.expertMode ||
|
|
4496
|
-
if (this.props.objectBrowserViewFile &&
|
|
4344
|
+
(this.state.filter.expertMode || common?.write !== false);
|
|
4345
|
+
if (this.props.objectBrowserViewFile && common?.type === 'file') {
|
|
4497
4346
|
valueEditable = true;
|
|
4498
4347
|
}
|
|
4499
4348
|
const enumEditable = !this.props.notEditable &&
|
|
@@ -4503,7 +4352,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4503
4352
|
let newValue = '';
|
|
4504
4353
|
const newValueTitle = [];
|
|
4505
4354
|
if (checkVisibleObjectType) {
|
|
4506
|
-
newValue =
|
|
4355
|
+
newValue = this.states[id]?.from;
|
|
4507
4356
|
if (newValue === undefined) {
|
|
4508
4357
|
newValue = ' ';
|
|
4509
4358
|
}
|
|
@@ -4511,7 +4360,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4511
4360
|
newValue = newValue ? newValue.replace(/^system\.adapter\.|^system\./, '') : '';
|
|
4512
4361
|
newValueTitle.push(`${this.texts.stateChangedFrom} ${newValue}`);
|
|
4513
4362
|
}
|
|
4514
|
-
if (obj
|
|
4363
|
+
if (obj?.user) {
|
|
4515
4364
|
const user = obj.user.replace('system.user.', '');
|
|
4516
4365
|
newValue += `/${user}`;
|
|
4517
4366
|
newValueTitle.push(`${this.texts.stateChangedBy} ${user}`);
|
|
@@ -4525,16 +4374,16 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4525
4374
|
newValueTitle.push(`${this.texts.objectChangedBy} ${obj.user.replace(/^system\.user\./, '')}`);
|
|
4526
4375
|
}
|
|
4527
4376
|
if (obj.ts) {
|
|
4528
|
-
newValueTitle.push(`${this.texts.objectChangedByUser} ${
|
|
4377
|
+
newValueTitle.push(`${this.texts.objectChangedByUser} ${Utils.formatDate(new Date(obj.ts), this.props.dateFormat || this.systemConfig.common.dateFormat)}`);
|
|
4529
4378
|
}
|
|
4530
4379
|
}
|
|
4531
4380
|
let readWriteAlias = false;
|
|
4532
4381
|
let alias = null;
|
|
4533
|
-
if (id.startsWith('alias.') &&
|
|
4382
|
+
if (id.startsWith('alias.') && common?.alias?.id) {
|
|
4534
4383
|
readWriteAlias = typeof common.alias.id === 'object';
|
|
4535
4384
|
if (readWriteAlias) {
|
|
4536
|
-
alias = (
|
|
4537
|
-
common.alias.id.read ? (
|
|
4385
|
+
alias = (React.createElement("div", { style: styles.cellIdAliasReadWriteDiv },
|
|
4386
|
+
common.alias.id.read ? (React.createElement(Box, { component: "div", onClick: e => {
|
|
4538
4387
|
e.stopPropagation();
|
|
4539
4388
|
e.preventDefault();
|
|
4540
4389
|
this.onSelect(common.alias.id.read);
|
|
@@ -4542,7 +4391,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4542
4391
|
}, sx: this.styles.aliasReadWrite },
|
|
4543
4392
|
"\u2190",
|
|
4544
4393
|
common.alias.id.read)) : null,
|
|
4545
|
-
common.alias.id.write ? (
|
|
4394
|
+
common.alias.id.write ? (React.createElement(Box, { component: "div", onClick: e => {
|
|
4546
4395
|
e.stopPropagation();
|
|
4547
4396
|
e.preventDefault();
|
|
4548
4397
|
this.onSelect(common.alias.id.write);
|
|
@@ -4552,7 +4401,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4552
4401
|
common.alias.id.write)) : null));
|
|
4553
4402
|
}
|
|
4554
4403
|
else {
|
|
4555
|
-
alias = (
|
|
4404
|
+
alias = (React.createElement(Box, { component: "div", onClick: e => {
|
|
4556
4405
|
e.stopPropagation();
|
|
4557
4406
|
e.preventDefault();
|
|
4558
4407
|
this.onSelect(common.alias.id);
|
|
@@ -4566,7 +4415,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4566
4415
|
// Some alias points to this object. It can be more than one
|
|
4567
4416
|
if (this.info.aliasesMap[id].length > 1) {
|
|
4568
4417
|
// Show number of aliases and open a menu by click
|
|
4569
|
-
alias = (
|
|
4418
|
+
alias = (React.createElement(Box, { component: "div", id: `alias_${id}`, onClick: e => {
|
|
4570
4419
|
e.stopPropagation();
|
|
4571
4420
|
e.preventDefault();
|
|
4572
4421
|
this.setState({ aliasMenu: id });
|
|
@@ -4577,11 +4426,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4577
4426
|
alias = this.renderAliasLink(id, 0);
|
|
4578
4427
|
}
|
|
4579
4428
|
}
|
|
4580
|
-
let checkColor = common
|
|
4429
|
+
let checkColor = common?.color;
|
|
4581
4430
|
let invertBackground;
|
|
4582
4431
|
if (checkColor && !this.state.selected.includes(id)) {
|
|
4583
4432
|
const background = this.props.themeName === 'dark' ? '#1f1f1f' : this.props.themeName === 'blue' ? '#222a2e' : '#FFFFFF';
|
|
4584
|
-
const distance =
|
|
4433
|
+
const distance = Utils.colorDistance(checkColor, background);
|
|
4585
4434
|
// console.log(`Distance: ${checkColor} - ${background} = ${distance}`);
|
|
4586
4435
|
if (distance < 1000) {
|
|
4587
4436
|
invertBackground = this.props.themeType === 'dark' ? '#9a9a9a' : '#565656';
|
|
@@ -4611,17 +4460,16 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4611
4460
|
checkColor = 'inherit';
|
|
4612
4461
|
}
|
|
4613
4462
|
const icons = [];
|
|
4614
|
-
if (common
|
|
4463
|
+
if (common?.statusStates) {
|
|
4615
4464
|
const ids = {};
|
|
4616
4465
|
Object.keys(common.statusStates).forEach(name => {
|
|
4617
|
-
var _b;
|
|
4618
4466
|
let _id = common.statusStates[name];
|
|
4619
4467
|
if (_id.split('.').length < 3) {
|
|
4620
4468
|
_id = `${id}.${_id}`;
|
|
4621
4469
|
}
|
|
4622
4470
|
ids[name] = _id;
|
|
4623
4471
|
if (!this.states[_id]) {
|
|
4624
|
-
if (
|
|
4472
|
+
if (this.objects[_id]?.type === 'state') {
|
|
4625
4473
|
if (!this.recordStates.includes(_id)) {
|
|
4626
4474
|
this.recordStates.push(_id);
|
|
4627
4475
|
}
|
|
@@ -4639,7 +4487,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4639
4487
|
if (common.statusStates.errorId && this.states[ids.errorId] && this.states[ids.errorId].val) {
|
|
4640
4488
|
checkColor = this.props.themeType === 'dark' ? COLOR_NAME_ERROR_DARK : COLOR_NAME_ERROR_LIGHT;
|
|
4641
4489
|
colorSet = true;
|
|
4642
|
-
icons.push(
|
|
4490
|
+
icons.push(React.createElement(IconError, { key: "error",
|
|
4643
4491
|
// title={this.texts.deviceError}
|
|
4644
4492
|
style: this.styles.iconDeviceError }));
|
|
4645
4493
|
}
|
|
@@ -4648,7 +4496,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4648
4496
|
if (this.states[ids.onlineId].val) {
|
|
4649
4497
|
checkColor =
|
|
4650
4498
|
this.props.themeType === 'dark' ? COLOR_NAME_CONNECTED_DARK : COLOR_NAME_CONNECTED_LIGHT;
|
|
4651
|
-
icons.push(
|
|
4499
|
+
icons.push(React.createElement(IconConnection, { key: "conn",
|
|
4652
4500
|
// title={this.texts.deviceError}
|
|
4653
4501
|
style: this.styles.iconDeviceConnected }));
|
|
4654
4502
|
}
|
|
@@ -4657,18 +4505,18 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4657
4505
|
this.props.themeType === 'dark'
|
|
4658
4506
|
? COLOR_NAME_DISCONNECTED_DARK
|
|
4659
4507
|
: COLOR_NAME_DISCONNECTED_LIGHT;
|
|
4660
|
-
icons.push(
|
|
4508
|
+
icons.push(React.createElement(IconDisconnected, { key: "disc",
|
|
4661
4509
|
// title={this.texts.deviceError}
|
|
4662
4510
|
style: this.styles.iconDeviceDisconnected }));
|
|
4663
4511
|
}
|
|
4664
4512
|
}
|
|
4665
4513
|
else if (this.states[ids.onlineId].val) {
|
|
4666
|
-
icons.push(
|
|
4514
|
+
icons.push(React.createElement(IconConnection, { key: "conn",
|
|
4667
4515
|
// title={this.texts.deviceError}
|
|
4668
4516
|
style: this.styles.iconDeviceConnected }));
|
|
4669
4517
|
}
|
|
4670
4518
|
else {
|
|
4671
|
-
icons.push(
|
|
4519
|
+
icons.push(React.createElement(IconDisconnected, { key: "disc",
|
|
4672
4520
|
// title={this.texts.deviceError}
|
|
4673
4521
|
style: this.styles.iconDeviceDisconnected }));
|
|
4674
4522
|
}
|
|
@@ -4680,85 +4528,102 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4680
4528
|
this.props.themeType === 'dark'
|
|
4681
4529
|
? COLOR_NAME_DISCONNECTED_DARK
|
|
4682
4530
|
: COLOR_NAME_DISCONNECTED_LIGHT;
|
|
4683
|
-
icons.push(
|
|
4531
|
+
icons.push(React.createElement(IconDisconnected, { key: "disc",
|
|
4684
4532
|
// title={this.texts.deviceError}
|
|
4685
4533
|
style: this.styles.iconDeviceDisconnected }));
|
|
4686
4534
|
}
|
|
4687
4535
|
else {
|
|
4688
4536
|
checkColor =
|
|
4689
4537
|
this.props.themeType === 'dark' ? COLOR_NAME_CONNECTED_DARK : COLOR_NAME_CONNECTED_LIGHT;
|
|
4690
|
-
icons.push(
|
|
4538
|
+
icons.push(React.createElement(IconConnection, { key: "conn",
|
|
4691
4539
|
// title={this.texts.deviceError}
|
|
4692
4540
|
style: this.styles.iconDeviceConnected }));
|
|
4693
4541
|
}
|
|
4694
4542
|
}
|
|
4695
4543
|
else if (this.states[ids.offlineId].val) {
|
|
4696
|
-
icons.push(
|
|
4544
|
+
icons.push(React.createElement(IconDisconnected, { key: "disc",
|
|
4697
4545
|
// title={this.texts.deviceError}
|
|
4698
4546
|
style: this.styles.iconDeviceDisconnected }));
|
|
4699
4547
|
}
|
|
4700
4548
|
else {
|
|
4701
|
-
icons.push(
|
|
4549
|
+
icons.push(React.createElement(IconConnection, { key: "conn",
|
|
4702
4550
|
// title={this.texts.deviceError}
|
|
4703
4551
|
style: this.styles.iconDeviceConnected }));
|
|
4704
4552
|
}
|
|
4705
4553
|
}
|
|
4706
4554
|
}
|
|
4707
|
-
const q = checkVisibleObjectType ?
|
|
4708
|
-
let name =
|
|
4555
|
+
const q = checkVisibleObjectType ? Utils.quality2text(this.states[id]?.q || 0).join(', ') : null;
|
|
4556
|
+
let name = item.data?.title || '';
|
|
4709
4557
|
let useDesc = false;
|
|
4710
4558
|
if (this.state.showDescription) {
|
|
4711
4559
|
const oTooltip = getObjectTooltip(item.data, this.props.lang);
|
|
4712
4560
|
if (oTooltip) {
|
|
4713
4561
|
name = [
|
|
4714
|
-
|
|
4715
|
-
|
|
4562
|
+
React.createElement("div", { key: "name", style: styles.cellNameDivDiv }, name),
|
|
4563
|
+
React.createElement("div", { key: "desc", style: styles.cellDescription }, oTooltip),
|
|
4716
4564
|
];
|
|
4717
4565
|
useDesc = !!oTooltip;
|
|
4718
4566
|
}
|
|
4719
4567
|
}
|
|
4720
4568
|
const narrowStyleWithDetails = this.props.width === 'xs' && this.state.focused === id;
|
|
4721
|
-
const colID = (
|
|
4722
|
-
|
|
4569
|
+
const colID = (React.createElement(Grid2, { container: true, wrap: "nowrap", direction: "row", sx: styles.cellId, style: { width: this.columnsVisibility.id, paddingLeft } },
|
|
4570
|
+
React.createElement(Grid2, { container: true, alignItems: "center" },
|
|
4723
4571
|
checkbox,
|
|
4724
4572
|
iconFolder),
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4573
|
+
React.createElement(Grid2, { style: {
|
|
4574
|
+
...styles.cellIdSpan,
|
|
4575
|
+
...(invertBackground ? this.styles.invertedBackground : undefined),
|
|
4576
|
+
color: checkColor,
|
|
4577
|
+
fontWeight: bold ? 'bold' : undefined,
|
|
4578
|
+
} },
|
|
4579
|
+
React.createElement(Tooltip, { title: getIdFieldTooltip(item.data, this.props.lang), slotProps: { popper: { sx: styles.tooltip } } },
|
|
4580
|
+
React.createElement("div", null, item.data.name)),
|
|
4728
4581
|
alias,
|
|
4729
4582
|
icons),
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
this.props.width !== 'xs' ? (
|
|
4733
|
-
|
|
4734
|
-
let colName = (narrowStyleWithDetails && name) || this.columnsVisibility.name ? (
|
|
4583
|
+
React.createElement("div", { style: { ...styles.grow, ...(invertBackground ? this.styles.invertedBackgroundFlex : {}) } }),
|
|
4584
|
+
React.createElement(Grid2, { container: true, alignItems: "center" }, iconItem),
|
|
4585
|
+
this.props.width !== 'xs' ? (React.createElement("div", null,
|
|
4586
|
+
React.createElement(IconCopy, { className: narrowStyleWithDetails ? '' : 'copyButton', style: styles.cellCopyButton, onClick: e => this.onCopy(e, id) }))) : null));
|
|
4587
|
+
let colName = (narrowStyleWithDetails && name) || this.columnsVisibility.name ? (React.createElement(Box, { component: "div", sx: {
|
|
4588
|
+
...styles.cellName,
|
|
4589
|
+
...(useDesc ? styles.cellNameWithDesc : undefined),
|
|
4590
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.name : undefined,
|
|
4591
|
+
ml: narrowStyleWithDetails ? 0 : '5px',
|
|
4592
|
+
} },
|
|
4735
4593
|
name,
|
|
4736
|
-
!narrowStyleWithDetails &&
|
|
4737
|
-
|
|
4594
|
+
!narrowStyleWithDetails && item.data?.title ? (React.createElement(Box, { style: { color: checkColor } },
|
|
4595
|
+
React.createElement(IconCopy, { className: "copyButton", style: styles.cellCopyButton, onClick: e => this.onCopy(e, item.data?.title) }))) : null)) : null;
|
|
4738
4596
|
let colMiddle;
|
|
4739
4597
|
if (!this.state.statesView) {
|
|
4740
4598
|
colMiddle = [
|
|
4741
|
-
(narrowStyleWithDetails &&
|
|
4599
|
+
(narrowStyleWithDetails && obj?.type) || this.columnsVisibility.type
|
|
4742
4600
|
? {
|
|
4743
|
-
el: (
|
|
4601
|
+
el: (React.createElement("div", { key: "type", style: {
|
|
4602
|
+
...styles.cellType,
|
|
4603
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.type : undefined,
|
|
4604
|
+
} },
|
|
4744
4605
|
typeImg,
|
|
4745
|
-
"\u00A0",
|
|
4746
|
-
obj
|
|
4606
|
+
"\u00A0",
|
|
4607
|
+
obj?.type)),
|
|
4747
4608
|
type: 'filter_type',
|
|
4748
4609
|
}
|
|
4749
4610
|
: null,
|
|
4750
4611
|
(narrowStyleWithDetails && common) || this.columnsVisibility.role
|
|
4751
4612
|
? {
|
|
4752
|
-
el: (
|
|
4613
|
+
el: (React.createElement("div", { key: "role", style: {
|
|
4614
|
+
...styles.cellRole,
|
|
4615
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.role : '100%',
|
|
4616
|
+
cursor: this.state.filter.expertMode &&
|
|
4753
4617
|
enumEditable &&
|
|
4754
4618
|
this.props.objectBrowserEditRole
|
|
4755
4619
|
? 'text'
|
|
4756
|
-
: 'default'
|
|
4620
|
+
: 'default',
|
|
4621
|
+
}, onClick: !narrowStyleWithDetails &&
|
|
4757
4622
|
this.state.filter.expertMode &&
|
|
4758
4623
|
enumEditable &&
|
|
4759
4624
|
this.props.objectBrowserEditRole
|
|
4760
4625
|
? () => this.setState({ roleDialog: item.data.id })
|
|
4761
|
-
: undefined }, common
|
|
4626
|
+
: undefined }, common?.role)),
|
|
4762
4627
|
type: 'filter_role',
|
|
4763
4628
|
onClick: narrowStyleWithDetails &&
|
|
4764
4629
|
this.state.filter.expertMode &&
|
|
@@ -4770,7 +4635,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4770
4635
|
: null,
|
|
4771
4636
|
(narrowStyleWithDetails && common) || this.columnsVisibility.room
|
|
4772
4637
|
? {
|
|
4773
|
-
el: (
|
|
4638
|
+
el: (React.createElement("div", { key: "room", style: {
|
|
4639
|
+
...styles.cellRoom,
|
|
4640
|
+
...(item.data.per ? styles.cellEnumParent : {}),
|
|
4641
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.room : '100%',
|
|
4642
|
+
cursor: enumEditable ? 'text' : 'default',
|
|
4643
|
+
}, onClick: !narrowStyleWithDetails && enumEditable
|
|
4774
4644
|
? () => {
|
|
4775
4645
|
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'roomEnums');
|
|
4776
4646
|
this.setState({
|
|
@@ -4801,7 +4671,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4801
4671
|
: null,
|
|
4802
4672
|
(narrowStyleWithDetails && common) || this.columnsVisibility.func
|
|
4803
4673
|
? {
|
|
4804
|
-
el: (
|
|
4674
|
+
el: (React.createElement("div", { key: "func", style: {
|
|
4675
|
+
...styles.cellFunc,
|
|
4676
|
+
...(item.data.pef ? styles.cellEnumParent : {}),
|
|
4677
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.func : '100%',
|
|
4678
|
+
cursor: enumEditable ? 'text' : 'default',
|
|
4679
|
+
}, onClick: !narrowStyleWithDetails && enumEditable
|
|
4805
4680
|
? () => {
|
|
4806
4681
|
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'funcEnums');
|
|
4807
4682
|
this.setState({
|
|
@@ -4834,57 +4709,76 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4834
4709
|
}
|
|
4835
4710
|
else {
|
|
4836
4711
|
colMiddle = [
|
|
4837
|
-
(narrowStyleWithDetails && checkVisibleObjectType &&
|
|
4712
|
+
(narrowStyleWithDetails && checkVisibleObjectType && this.states[id]?.from) ||
|
|
4838
4713
|
this.columnsVisibility.changedFrom
|
|
4839
4714
|
? {
|
|
4840
|
-
el: (
|
|
4715
|
+
el: (React.createElement("div", { key: "from", style: {
|
|
4716
|
+
...styles.cellRole,
|
|
4717
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.changedFrom : undefined,
|
|
4718
|
+
}, title: newValueTitle.join('\n') }, checkVisibleObjectType && this.states[id]?.from ? newValue : null)),
|
|
4841
4719
|
type: 'from',
|
|
4842
4720
|
}
|
|
4843
4721
|
: null,
|
|
4844
4722
|
(narrowStyleWithDetails && q) || this.columnsVisibility.qualityCode
|
|
4845
4723
|
? {
|
|
4846
|
-
el: (
|
|
4724
|
+
el: (React.createElement("div", { key: "q", style: {
|
|
4725
|
+
...styles.cellRole,
|
|
4726
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.qualityCode : undefined,
|
|
4727
|
+
}, title: q || '' }, q)),
|
|
4847
4728
|
type: 'quality',
|
|
4848
4729
|
}
|
|
4849
4730
|
: null,
|
|
4850
|
-
(narrowStyleWithDetails && checkVisibleObjectType &&
|
|
4731
|
+
(narrowStyleWithDetails && checkVisibleObjectType && this.states[id]?.ts) ||
|
|
4851
4732
|
this.columnsVisibility.timestamp
|
|
4852
4733
|
? {
|
|
4853
|
-
el: (
|
|
4854
|
-
|
|
4734
|
+
el: (React.createElement("div", { key: "ts", style: {
|
|
4735
|
+
...styles.cellRole,
|
|
4736
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.timestamp : undefined,
|
|
4737
|
+
} }, checkVisibleObjectType && this.states[id]?.ts
|
|
4738
|
+
? Utils.formatDate(new Date(this.states[id].ts), this.props.dateFormat || this.systemConfig.common.dateFormat)
|
|
4855
4739
|
: null)),
|
|
4856
4740
|
type: 'ts',
|
|
4857
4741
|
}
|
|
4858
4742
|
: null,
|
|
4859
|
-
(narrowStyleWithDetails && checkVisibleObjectType &&
|
|
4743
|
+
(narrowStyleWithDetails && checkVisibleObjectType && this.states[id]?.lc) ||
|
|
4860
4744
|
this.columnsVisibility.lastChange
|
|
4861
4745
|
? {
|
|
4862
|
-
el: (
|
|
4863
|
-
|
|
4746
|
+
el: (React.createElement("div", { key: "lc", style: {
|
|
4747
|
+
...styles.cellRole,
|
|
4748
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.lastChange : undefined,
|
|
4749
|
+
} }, checkVisibleObjectType && this.states[id]?.lc
|
|
4750
|
+
? Utils.formatDate(new Date(this.states[id].lc), this.props.dateFormat || this.systemConfig.common.dateFormat)
|
|
4864
4751
|
: null)),
|
|
4865
4752
|
type: 'lc',
|
|
4866
4753
|
}
|
|
4867
4754
|
: null,
|
|
4868
4755
|
];
|
|
4869
4756
|
}
|
|
4870
|
-
let colCustom =
|
|
4757
|
+
let colCustom = this.adapterColumns?.map(it => (React.createElement("div", { style: {
|
|
4758
|
+
...styles.cellAdapter,
|
|
4759
|
+
width: this.props.width !== 'xs'
|
|
4871
4760
|
? this.columnsVisibility[it.id]
|
|
4872
|
-
: undefined
|
|
4761
|
+
: undefined,
|
|
4762
|
+
}, key: it.id, title: `${it.adapter} => ${it.pathText}` }, obj ? this.renderCustomValue(obj, it, item) : null))) || null;
|
|
4873
4763
|
const columnValue = narrowStyleWithDetails || this.columnsVisibility.val
|
|
4874
4764
|
? this.renderColumnValue(id, item, narrowStyleWithDetails)
|
|
4875
4765
|
: null;
|
|
4876
|
-
let colValue = (narrowStyleWithDetails && columnValue) || this.columnsVisibility.val ? (
|
|
4877
|
-
|
|
4766
|
+
let colValue = (narrowStyleWithDetails && columnValue) || this.columnsVisibility.val ? (React.createElement("div", { style: {
|
|
4767
|
+
...styles.cellValue,
|
|
4768
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.val : 'calc(100% - 100px)',
|
|
4769
|
+
cursor: valueEditable
|
|
4770
|
+
? common?.type === 'file'
|
|
4878
4771
|
? 'zoom-in'
|
|
4879
4772
|
: item.data.button
|
|
4880
4773
|
? 'grab'
|
|
4881
4774
|
: 'text'
|
|
4882
|
-
: 'default'
|
|
4775
|
+
: 'default',
|
|
4776
|
+
}, onClick: valueEditable
|
|
4883
4777
|
? () => {
|
|
4884
4778
|
if (!obj || !this.states) {
|
|
4885
4779
|
// return;
|
|
4886
4780
|
}
|
|
4887
|
-
else if (
|
|
4781
|
+
else if (common?.type === 'file') {
|
|
4888
4782
|
this.setState({ viewFileDialog: id });
|
|
4889
4783
|
}
|
|
4890
4784
|
else if (!this.state.filter.expertMode && item.data.button) {
|
|
@@ -4910,7 +4804,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4910
4804
|
}
|
|
4911
4805
|
}
|
|
4912
4806
|
: undefined }, columnValue)) : null;
|
|
4913
|
-
let colButtons = narrowStyleWithDetails || this.columnsVisibility.buttons ? (
|
|
4807
|
+
let colButtons = narrowStyleWithDetails || this.columnsVisibility.buttons ? (React.createElement("div", { style: {
|
|
4808
|
+
...styles.cellButtons,
|
|
4809
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.buttons : undefined,
|
|
4810
|
+
} }, this.renderColumnButtons(id, item))) : null;
|
|
4914
4811
|
let colDetails = null;
|
|
4915
4812
|
if (this.props.width === 'xs' && this.state.focused === id) {
|
|
4916
4813
|
colMiddle = colMiddle.filter(a => a);
|
|
@@ -4923,14 +4820,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4923
4820
|
if (!it) {
|
|
4924
4821
|
return null;
|
|
4925
4822
|
}
|
|
4926
|
-
return (
|
|
4927
|
-
|
|
4823
|
+
return (React.createElement("div", { key: it.type, style: styles.cellDetailsLine },
|
|
4824
|
+
React.createElement("span", { style: styles.cellDetailsName },
|
|
4928
4825
|
this.texts[it.type],
|
|
4929
4826
|
":"),
|
|
4930
4827
|
it.el,
|
|
4931
|
-
|
|
4932
|
-
it.onClick ? (
|
|
4933
|
-
if (it
|
|
4828
|
+
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
4829
|
+
it.onClick ? (React.createElement(IconEdit, { style: styles.cellCopyButtonInDetails, onClick: () => {
|
|
4830
|
+
if (it?.onClick) {
|
|
4934
4831
|
it.onClick();
|
|
4935
4832
|
}
|
|
4936
4833
|
} })) : null));
|
|
@@ -4939,32 +4836,32 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4939
4836
|
if (!colCustom.length) {
|
|
4940
4837
|
colCustom = null;
|
|
4941
4838
|
}
|
|
4942
|
-
colDetails = (
|
|
4839
|
+
colDetails = (React.createElement(Paper, { style: {
|
|
4943
4840
|
width: '100%',
|
|
4944
4841
|
display: 'flex',
|
|
4945
4842
|
flexDirection: 'column',
|
|
4946
4843
|
padding: 10,
|
|
4947
4844
|
backgroundColor: this.props.theme.palette.mode === 'dark' ? '#333' : '#ccc',
|
|
4948
4845
|
} },
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
colName && (
|
|
4953
|
-
|
|
4846
|
+
React.createElement("div", { style: styles.cellDetailsLine },
|
|
4847
|
+
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
4848
|
+
React.createElement(IconCopy, { style: styles.cellCopyButtonInDetails, onClick: e => this.onCopy(e, id) })),
|
|
4849
|
+
colName && (React.createElement("div", { style: styles.cellDetailsLine },
|
|
4850
|
+
React.createElement("span", { style: styles.cellDetailsName },
|
|
4954
4851
|
this.texts.name,
|
|
4955
4852
|
":"),
|
|
4956
4853
|
colName,
|
|
4957
|
-
|
|
4958
|
-
|
|
4854
|
+
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
4855
|
+
item.data?.title ? (React.createElement(IconCopy, { className: "copyButton", style: styles.cellCopyButtonInDetails, onClick: e => this.onCopy(e, item.data?.title) })) : null)),
|
|
4959
4856
|
renderedMiddle,
|
|
4960
|
-
colCustom &&
|
|
4961
|
-
|
|
4962
|
-
|
|
4857
|
+
colCustom && React.createElement("div", { style: styles.cellDetailsLine }, colCustom),
|
|
4858
|
+
this.objects[id]?.type === 'state' && (React.createElement("div", { style: styles.cellDetailsLine },
|
|
4859
|
+
React.createElement("span", { style: styles.cellDetailsName },
|
|
4963
4860
|
this.texts.value,
|
|
4964
4861
|
":"),
|
|
4965
4862
|
colValue,
|
|
4966
|
-
|
|
4967
|
-
|
|
4863
|
+
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
4864
|
+
React.createElement(IconCopy, { className: "copyButton", style: styles.cellCopyButtonInDetails, onClick: e => {
|
|
4968
4865
|
const { valText } = formatValue({
|
|
4969
4866
|
state: this.states[id],
|
|
4970
4867
|
obj: this.objects[id],
|
|
@@ -4976,14 +4873,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4976
4873
|
});
|
|
4977
4874
|
this.onCopy(e, valText.v.toString());
|
|
4978
4875
|
}, key: "cc" }))),
|
|
4979
|
-
colButtons && (
|
|
4876
|
+
colButtons && (React.createElement("div", { style: { ...styles.cellDetailsLine, justifyContent: 'right' } }, colButtons))));
|
|
4980
4877
|
colName = null;
|
|
4981
4878
|
colMiddle = null;
|
|
4982
4879
|
colCustom = null;
|
|
4983
4880
|
colValue = null;
|
|
4984
4881
|
colButtons = null;
|
|
4985
4882
|
}
|
|
4986
|
-
const row = (
|
|
4883
|
+
const row = (React.createElement(Grid2, { container: true, direction: "row", wrap: "nowrap", sx: Utils.getStyle(this.props.theme, styles.tableRow, this.state.linesEnabled && styles.tableRowLines, !this.props.dragEnabled && styles.tableRowNoDragging, alias && styles.tableRowAlias, readWriteAlias && styles.tableRowAliasReadWrite, this.state.focused === id && this.props.multiSelect && styles.tableRowFocused, !item.data.visible && styles.filteredOut, item.data.hasVisibleParent &&
|
|
4987
4884
|
!item.data.visible &&
|
|
4988
4885
|
!item.data.hasVisibleChildren &&
|
|
4989
4886
|
styles.filteredParentOut, this.state.selected.includes(id) && styles.itemSelected, this.state.selectedNonObject === id && styles.itemSelected), key: id, id: id, onMouseDown: e => {
|
|
@@ -5015,8 +4912,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5015
4912
|
}
|
|
5016
4913
|
} },
|
|
5017
4914
|
colID,
|
|
5018
|
-
colName,
|
|
5019
|
-
colMiddle
|
|
4915
|
+
colName,
|
|
4916
|
+
colMiddle?.map(it => it?.el),
|
|
5020
4917
|
colCustom,
|
|
5021
4918
|
colValue,
|
|
5022
4919
|
colButtons));
|
|
@@ -5033,11 +4930,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5033
4930
|
const DragWrapper = this.props.DragWrapper;
|
|
5034
4931
|
if (this.props.dragEnabled && DragWrapper) {
|
|
5035
4932
|
if (root.data.sumVisibility) {
|
|
5036
|
-
leaf = (
|
|
4933
|
+
leaf = (React.createElement(DragWrapper, { key: root.data.id, item: root, style: styles.draggable }, result.row));
|
|
5037
4934
|
}
|
|
5038
4935
|
else {
|
|
5039
4936
|
// change cursor
|
|
5040
|
-
leaf = (
|
|
4937
|
+
leaf = (React.createElement("div", { key: root.data.id, style: styles.nonDraggable }, result.row));
|
|
5041
4938
|
}
|
|
5042
4939
|
}
|
|
5043
4940
|
else {
|
|
@@ -5255,11 +5152,106 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5255
5152
|
}
|
|
5256
5153
|
}
|
|
5257
5154
|
}
|
|
5155
|
+
resizerMouseMove = (e) => {
|
|
5156
|
+
if (this.resizerActiveDiv) {
|
|
5157
|
+
let width;
|
|
5158
|
+
let widthNext;
|
|
5159
|
+
if (this.resizeLeft) {
|
|
5160
|
+
width = this.resizerOldWidth - e.clientX + this.resizerPosition;
|
|
5161
|
+
widthNext = this.resizerOldWidthNext + e.clientX - this.resizerPosition;
|
|
5162
|
+
}
|
|
5163
|
+
else {
|
|
5164
|
+
width = this.resizerOldWidth + e.clientX - this.resizerPosition;
|
|
5165
|
+
widthNext = this.resizerOldWidthNext - e.clientX + this.resizerPosition;
|
|
5166
|
+
}
|
|
5167
|
+
if (this.resizerActiveName &&
|
|
5168
|
+
this.resizerNextName &&
|
|
5169
|
+
(!this.resizerMin || width > this.resizerMin) &&
|
|
5170
|
+
(!this.resizerNextMin || widthNext > this.resizerNextMin)) {
|
|
5171
|
+
this.resizerCurrentWidths[this.resizerActiveName] = width;
|
|
5172
|
+
this.resizerCurrentWidths[this.resizerNextName] = widthNext;
|
|
5173
|
+
this.resizerActiveDiv.style.width = `${width}px`;
|
|
5174
|
+
if (this.resizerNextDiv) {
|
|
5175
|
+
this.resizerNextDiv.style.width = `${widthNext}px`;
|
|
5176
|
+
}
|
|
5177
|
+
this.columnsVisibility[this.resizerActiveName] = width;
|
|
5178
|
+
this.columnsVisibility[this.resizerNextName] = widthNext;
|
|
5179
|
+
if (this.resizerNextName === 'nameHeader') {
|
|
5180
|
+
this.columnsVisibility.name = widthNext - this.state.scrollBarWidth;
|
|
5181
|
+
this.resizerCurrentWidths.name = widthNext - this.state.scrollBarWidth;
|
|
5182
|
+
}
|
|
5183
|
+
else if (this.resizerActiveName === 'nameHeader') {
|
|
5184
|
+
this.columnsVisibility.name = width - this.state.scrollBarWidth;
|
|
5185
|
+
this.resizerCurrentWidths.name = width - this.state.scrollBarWidth;
|
|
5186
|
+
}
|
|
5187
|
+
this.customWidth = true;
|
|
5188
|
+
if (this.resizeTimeout) {
|
|
5189
|
+
clearTimeout(this.resizeTimeout);
|
|
5190
|
+
}
|
|
5191
|
+
this.resizeTimeout = setTimeout(() => {
|
|
5192
|
+
this.resizeTimeout = null;
|
|
5193
|
+
this.forceUpdate();
|
|
5194
|
+
}, 200);
|
|
5195
|
+
}
|
|
5196
|
+
}
|
|
5197
|
+
};
|
|
5198
|
+
resizerMouseUp = () => {
|
|
5199
|
+
this.localStorage.setItem(`${this.props.dialogName || 'App'}.table`, JSON.stringify(this.resizerCurrentWidths));
|
|
5200
|
+
this.resizerActiveName = null;
|
|
5201
|
+
this.resizerNextName = null;
|
|
5202
|
+
this.resizerActiveDiv = null;
|
|
5203
|
+
this.resizerNextDiv = null;
|
|
5204
|
+
window.removeEventListener('mousemove', this.resizerMouseMove);
|
|
5205
|
+
window.removeEventListener('mouseup', this.resizerMouseUp);
|
|
5206
|
+
};
|
|
5207
|
+
resizerMouseDown = (e) => {
|
|
5208
|
+
this.storedWidths =
|
|
5209
|
+
this.storedWidths ||
|
|
5210
|
+
JSON.parse(JSON.stringify(SCREEN_WIDTHS[this.props.width || 'lg']));
|
|
5211
|
+
this.resizerCurrentWidths = this.resizerCurrentWidths || {};
|
|
5212
|
+
this.resizerActiveDiv = e.target.parentNode;
|
|
5213
|
+
this.resizerActiveName = this.resizerActiveDiv.dataset.name || null;
|
|
5214
|
+
if (this.resizerActiveName) {
|
|
5215
|
+
let i = 0;
|
|
5216
|
+
if (e.target.dataset.left === 'true') {
|
|
5217
|
+
this.resizeLeft = true;
|
|
5218
|
+
this.resizerNextDiv = this.resizerActiveDiv.previousElementSibling;
|
|
5219
|
+
let handle = this.resizerNextDiv.querySelector('.iob-ob-resize-handler');
|
|
5220
|
+
while (this.resizerNextDiv && !handle && i < 10) {
|
|
5221
|
+
this.resizerNextDiv = this.resizerNextDiv.previousElementSibling;
|
|
5222
|
+
handle = this.resizerNextDiv.querySelector('.iob-ob-resize-handler');
|
|
5223
|
+
i++;
|
|
5224
|
+
}
|
|
5225
|
+
if (handle?.dataset.left !== 'true') {
|
|
5226
|
+
this.resizerNextDiv = this.resizerNextDiv.nextElementSibling;
|
|
5227
|
+
}
|
|
5228
|
+
}
|
|
5229
|
+
else {
|
|
5230
|
+
this.resizeLeft = false;
|
|
5231
|
+
this.resizerNextDiv = this.resizerActiveDiv.nextElementSibling;
|
|
5232
|
+
/* while (this.resizerNextDiv && !this.resizerNextDiv.querySelector('.iob-ob-resize-handler') && i < 10) {
|
|
5233
|
+
this.resizerNextDiv = this.resizerNextDiv.nextElementSibling;
|
|
5234
|
+
i++;
|
|
5235
|
+
} */
|
|
5236
|
+
}
|
|
5237
|
+
this.resizerNextName = this.resizerNextDiv.dataset.name || null;
|
|
5238
|
+
this.resizerMin = parseInt(this.resizerActiveDiv.dataset.min, 10) || 0;
|
|
5239
|
+
this.resizerNextMin = parseInt(this.resizerNextDiv.dataset.min, 10) || 0;
|
|
5240
|
+
this.resizerPosition = e.clientX;
|
|
5241
|
+
this.resizerCurrentWidths[this.resizerActiveName] = this.resizerActiveDiv.offsetWidth;
|
|
5242
|
+
this.resizerOldWidth = this.resizerCurrentWidths[this.resizerActiveName];
|
|
5243
|
+
if (this.resizerNextName) {
|
|
5244
|
+
this.resizerCurrentWidths[this.resizerNextName] = this.resizerNextDiv.offsetWidth;
|
|
5245
|
+
this.resizerOldWidthNext = this.resizerCurrentWidths[this.resizerNextName];
|
|
5246
|
+
}
|
|
5247
|
+
window.addEventListener('mousemove', this.resizerMouseMove);
|
|
5248
|
+
window.addEventListener('mouseup', this.resizerMouseUp);
|
|
5249
|
+
}
|
|
5250
|
+
};
|
|
5258
5251
|
/**
|
|
5259
5252
|
* Handle keyboard events for navigation
|
|
5260
5253
|
*/
|
|
5261
5254
|
navigateKeyPress(event) {
|
|
5262
|
-
var _b, _c;
|
|
5263
5255
|
const selectedId = this.state.selectedNonObject || this.state.selected[0];
|
|
5264
5256
|
if (!selectedId) {
|
|
5265
5257
|
return;
|
|
@@ -5267,7 +5259,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5267
5259
|
if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
|
|
5268
5260
|
event.preventDefault();
|
|
5269
5261
|
const ids = [];
|
|
5270
|
-
|
|
5262
|
+
this.tableRef.current?.childNodes.forEach((node) => ids.push(node.id));
|
|
5271
5263
|
const idx = ids.indexOf(selectedId);
|
|
5272
5264
|
const newIdx = event.code === 'ArrowDown' ? idx + 1 : idx - 1;
|
|
5273
5265
|
const newId = ids[newIdx] || selectedId;
|
|
@@ -5278,10 +5270,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5278
5270
|
this.toggleExpanded(selectedId);
|
|
5279
5271
|
}
|
|
5280
5272
|
if (event.code === 'Delete' && this.root && selectedId) {
|
|
5281
|
-
const item =
|
|
5273
|
+
const item = ObjectBrowserClass.getItemFromRoot(this.root, selectedId);
|
|
5282
5274
|
if (item) {
|
|
5283
5275
|
const { obj } = item.data;
|
|
5284
|
-
if (obj && !
|
|
5276
|
+
if (obj && !obj.common?.dontDelete) {
|
|
5285
5277
|
this.showDeleteDialog({ id: selectedId, obj, item });
|
|
5286
5278
|
}
|
|
5287
5279
|
}
|
|
@@ -5316,67 +5308,119 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5316
5308
|
}
|
|
5317
5309
|
return _root || null;
|
|
5318
5310
|
}
|
|
5311
|
+
resizerReset = () => {
|
|
5312
|
+
this.customWidth = false;
|
|
5313
|
+
SCREEN_WIDTHS[this.props.width || 'lg'] = JSON.parse(JSON.stringify(this.storedWidths));
|
|
5314
|
+
this.calculateColumnsVisibility();
|
|
5315
|
+
this.localStorage.removeItem(`${this.props.dialogName || 'App'}.table`);
|
|
5316
|
+
this.forceUpdate();
|
|
5317
|
+
};
|
|
5319
5318
|
/**
|
|
5320
5319
|
* Render the right handle for resizing
|
|
5321
5320
|
*/
|
|
5322
5321
|
renderHandleRight() {
|
|
5323
|
-
return (
|
|
5322
|
+
return (React.createElement(Box, { component: "div", className: "iob-ob-resize-handler", sx: { ...styles.resizeHandle, ...styles.resizeHandleRight }, onMouseDown: this.resizerMouseDown, onDoubleClick: this.resizerReset, title: this.props.t('ra_Double click to reset table layout') }));
|
|
5324
5323
|
}
|
|
5325
5324
|
renderHeader() {
|
|
5326
5325
|
let filterClearInValue = null;
|
|
5327
5326
|
if (!this.columnsVisibility.buttons && !this.isFilterEmpty()) {
|
|
5328
|
-
filterClearInValue = (
|
|
5329
|
-
|
|
5330
|
-
|
|
5327
|
+
filterClearInValue = (React.createElement(IconButton, { onClick: () => this.clearFilter(), style: styles.buttonClearFilter, title: this.props.t('ra_Clear filter'), size: "large" },
|
|
5328
|
+
React.createElement(IconClearFilter, null),
|
|
5329
|
+
React.createElement(IconClose, { style: styles.buttonClearFilterIcon })));
|
|
5331
5330
|
}
|
|
5332
5331
|
if (this.props.width === 'xs') {
|
|
5333
|
-
return (
|
|
5334
|
-
|
|
5332
|
+
return (React.createElement("div", { style: styles.headerRow },
|
|
5333
|
+
React.createElement("div", { style: { ...styles.headerCell, width: '100%' } }, this.getFilterInput('id'))));
|
|
5335
5334
|
}
|
|
5336
|
-
return (
|
|
5337
|
-
|
|
5335
|
+
return (React.createElement("div", { style: styles.headerRow },
|
|
5336
|
+
React.createElement("div", { style: { ...styles.headerCell, width: this.columnsVisibility.id, position: 'relative' }, "data-min": 240, "data-name": "id" },
|
|
5338
5337
|
this.getFilterInput('id'),
|
|
5339
5338
|
this.renderHandleRight()),
|
|
5340
|
-
this.columnsVisibility.name ? (
|
|
5339
|
+
this.columnsVisibility.name ? (React.createElement("div", { style: { ...styles.headerCell, width: this.columnsVisibility.nameHeader, position: 'relative' }, "data-min": 100, "data-name": "nameHeader" },
|
|
5341
5340
|
this.getFilterInput('name'),
|
|
5342
5341
|
this.renderHandleRight())) : null,
|
|
5343
|
-
!this.state.statesView && (
|
|
5344
|
-
this.columnsVisibility.type ? (
|
|
5342
|
+
!this.state.statesView && (React.createElement(React.Fragment, null,
|
|
5343
|
+
this.columnsVisibility.type ? (React.createElement("div", { style: {
|
|
5344
|
+
...styles.headerCell,
|
|
5345
|
+
width: this.columnsVisibility.type,
|
|
5346
|
+
position: 'relative',
|
|
5347
|
+
}, "data-min": 100, "data-name": "type" },
|
|
5345
5348
|
this.getFilterSelectType(),
|
|
5346
5349
|
this.renderHandleRight())) : null,
|
|
5347
|
-
this.columnsVisibility.role ? (
|
|
5350
|
+
this.columnsVisibility.role ? (React.createElement("div", { style: {
|
|
5351
|
+
...styles.headerCell,
|
|
5352
|
+
width: this.columnsVisibility.role,
|
|
5353
|
+
position: 'relative',
|
|
5354
|
+
}, "data-min": 100, "data-name": "role" },
|
|
5348
5355
|
this.getFilterSelectRole(),
|
|
5349
5356
|
this.renderHandleRight())) : null,
|
|
5350
|
-
this.columnsVisibility.room ? (
|
|
5357
|
+
this.columnsVisibility.room ? (React.createElement("div", { style: {
|
|
5358
|
+
...styles.headerCell,
|
|
5359
|
+
width: this.columnsVisibility.room,
|
|
5360
|
+
position: 'relative',
|
|
5361
|
+
}, "data-min": 100, "data-name": "room" },
|
|
5351
5362
|
this.getFilterSelectRoom(),
|
|
5352
5363
|
this.renderHandleRight())) : null,
|
|
5353
|
-
this.columnsVisibility.func ? (
|
|
5364
|
+
this.columnsVisibility.func ? (React.createElement("div", { style: {
|
|
5365
|
+
...styles.headerCell,
|
|
5366
|
+
width: this.columnsVisibility.func,
|
|
5367
|
+
position: 'relative',
|
|
5368
|
+
}, "data-min": 100, "data-name": "func" },
|
|
5354
5369
|
this.getFilterSelectFunction(),
|
|
5355
5370
|
this.renderHandleRight())) : null)),
|
|
5356
|
-
this.state.statesView && (
|
|
5357
|
-
|
|
5371
|
+
this.state.statesView && (React.createElement(React.Fragment, null,
|
|
5372
|
+
React.createElement("div", { style: {
|
|
5373
|
+
...styles.headerCell,
|
|
5374
|
+
...styles.headerCellValue,
|
|
5375
|
+
width: this.columnsVisibility.changedFrom,
|
|
5376
|
+
position: 'relative',
|
|
5377
|
+
}, "data-min": 100, "data-name": "changedFrom" },
|
|
5358
5378
|
this.props.t('ra_Changed from'),
|
|
5359
5379
|
this.renderHandleRight()),
|
|
5360
|
-
|
|
5380
|
+
React.createElement("div", { style: {
|
|
5381
|
+
...styles.headerCell,
|
|
5382
|
+
...styles.headerCellValue,
|
|
5383
|
+
width: this.columnsVisibility.qualityCode,
|
|
5384
|
+
position: 'relative',
|
|
5385
|
+
}, "data-min": 100, "data-name": "qualityCode" },
|
|
5361
5386
|
this.props.t('ra_Quality code'),
|
|
5362
5387
|
this.renderHandleRight()),
|
|
5363
|
-
|
|
5388
|
+
React.createElement("div", { style: {
|
|
5389
|
+
...styles.headerCell,
|
|
5390
|
+
...styles.headerCellValue,
|
|
5391
|
+
width: this.columnsVisibility.timestamp,
|
|
5392
|
+
position: 'relative',
|
|
5393
|
+
}, "data-min": 100, "data-name": "timestamp" },
|
|
5364
5394
|
this.props.t('ra_Timestamp'),
|
|
5365
5395
|
this.renderHandleRight()),
|
|
5366
|
-
|
|
5396
|
+
React.createElement("div", { style: {
|
|
5397
|
+
...styles.headerCell,
|
|
5398
|
+
...styles.headerCellValue,
|
|
5399
|
+
width: this.columnsVisibility.lastChange,
|
|
5400
|
+
position: 'relative',
|
|
5401
|
+
}, "data-min": 100, "data-name": "lastChange" },
|
|
5367
5402
|
this.props.t('ra_Last change'),
|
|
5368
5403
|
this.renderHandleRight()))),
|
|
5369
|
-
this.adapterColumns.map(item => (
|
|
5370
|
-
|
|
5404
|
+
this.adapterColumns.map(item => (React.createElement("div", { style: {
|
|
5405
|
+
...styles.headerCell,
|
|
5406
|
+
...styles.headerCellValue,
|
|
5407
|
+
width: this.columnsVisibility[item.id],
|
|
5408
|
+
}, title: item.adapter, key: item.id, "data-min": 100, "data-name": item.id }, item.name))),
|
|
5409
|
+
this.columnsVisibility.val ? (React.createElement("div", { style: {
|
|
5410
|
+
...styles.headerCell,
|
|
5411
|
+
...styles.headerCellValue,
|
|
5412
|
+
width: this.columnsVisibility.val,
|
|
5413
|
+
position: 'relative',
|
|
5414
|
+
}, "data-min": 120, "data-name": "val" },
|
|
5371
5415
|
this.props.t('ra_Value'),
|
|
5372
5416
|
filterClearInValue)) : null,
|
|
5373
|
-
this.columnsVisibility.buttons ? (
|
|
5417
|
+
this.columnsVisibility.buttons ? (React.createElement("div", { title: this.texts.filter_custom, style: { ...styles.headerCell, width: this.columnsVisibility.buttons } },
|
|
5374
5418
|
' ',
|
|
5375
5419
|
this.getFilterSelectCustoms())) : null));
|
|
5376
5420
|
}
|
|
5377
5421
|
renderToast() {
|
|
5378
|
-
return (
|
|
5379
|
-
|
|
5422
|
+
return (React.createElement(Snackbar, { open: !!this.state.toast, autoHideDuration: 3000, onClick: () => this.setState({ toast: '' }), onClose: () => this.setState({ toast: '' }), message: this.state.toast, action: React.createElement(IconButton, { size: "small", "aria-label": "close", color: "inherit", onClick: () => this.setState({ toast: '' }) },
|
|
5423
|
+
React.createElement(IconClose, { fontSize: "small" })) }));
|
|
5380
5424
|
}
|
|
5381
5425
|
/**
|
|
5382
5426
|
* Called when component is updated.
|
|
@@ -5395,7 +5439,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5395
5439
|
scrollToItem(id) {
|
|
5396
5440
|
this.selectFirst = '';
|
|
5397
5441
|
const node = window.document.getElementById(id);
|
|
5398
|
-
node
|
|
5442
|
+
node?.scrollIntoView({
|
|
5399
5443
|
behavior: 'auto',
|
|
5400
5444
|
block: 'center',
|
|
5401
5445
|
inline: 'center',
|
|
@@ -5404,10 +5448,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5404
5448
|
renderCustomDialog() {
|
|
5405
5449
|
if (this.state.customDialog && this.props.objectCustomDialog) {
|
|
5406
5450
|
const ObjectCustomDialog = this.props.objectCustomDialog;
|
|
5407
|
-
return (
|
|
5451
|
+
return (React.createElement(ObjectCustomDialog, { reportChangedIds: (changedIds) => (this.changedIds = [...changedIds]), objectIDs: this.state.customDialog, allVisibleObjects: !!this.state.customDialogAll, expertMode: this.state.filter.expertMode, isFloatComma: this.props.isFloatComma === undefined
|
|
5408
5452
|
? this.systemConfig.common.isFloatComma
|
|
5409
5453
|
: this.props.isFloatComma, t: this.props.t, lang: this.props.lang, socket: this.props.socket, themeName: this.props.themeName, themeType: this.props.themeType, theme: this.props.theme, objects: this.objects, customsInstances: this.info.customs, onClose: () => {
|
|
5410
|
-
var _b;
|
|
5411
5454
|
this.pauseSubscribe(false);
|
|
5412
5455
|
this.setState({ customDialog: null });
|
|
5413
5456
|
if (this.changedIds) {
|
|
@@ -5415,7 +5458,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5415
5458
|
// update all changed IDs
|
|
5416
5459
|
this.forceUpdate();
|
|
5417
5460
|
}
|
|
5418
|
-
|
|
5461
|
+
this.props.router?.doNavigate('tab-objects');
|
|
5419
5462
|
}, systemConfig: this.systemConfig }));
|
|
5420
5463
|
}
|
|
5421
5464
|
return null;
|
|
@@ -5435,18 +5478,17 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5435
5478
|
return null;
|
|
5436
5479
|
}
|
|
5437
5480
|
const ObjectBrowserEditObject = this.props.objectBrowserEditObject;
|
|
5438
|
-
return (
|
|
5481
|
+
return (React.createElement(ObjectBrowserEditObject, { key: this.state.editObjectDialog, obj: this.objects[this.state.editObjectDialog], roleArray: this.info.roles, objects: this.objects, dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat, isFloatComma: this.props.isFloatComma === undefined
|
|
5439
5482
|
? this.systemConfig.common.isFloatComma
|
|
5440
5483
|
: this.props.isFloatComma, themeType: this.props.themeType, theme: this.props.theme, socket: this.props.socket, dialogName: this.props.dialogName, aliasTab: this.state.editObjectAlias, t: this.props.t, expertMode: !!this.state.filter.expertMode, onNewObject: (obj) => this.props.socket
|
|
5441
5484
|
.setObject(obj._id, obj)
|
|
5442
5485
|
.then(() => this.setState({ editObjectDialog: obj._id, editObjectAlias: false }, () => this.onSelect(obj._id)))
|
|
5443
5486
|
.catch(e => this.showError(`Cannot write object: ${e}`)), onClose: (obj) => {
|
|
5444
|
-
var _b, _c;
|
|
5445
5487
|
if (obj) {
|
|
5446
5488
|
let updateAlias;
|
|
5447
5489
|
if (this.state.editObjectDialog.startsWith('alias.')) {
|
|
5448
|
-
if (JSON.stringify(
|
|
5449
|
-
JSON.stringify(
|
|
5490
|
+
if (JSON.stringify(this.objects[this.state.editObjectDialog].common?.alias) !==
|
|
5491
|
+
JSON.stringify(obj.common?.alias)) {
|
|
5450
5492
|
updateAlias = this.state.editObjectDialog;
|
|
5451
5493
|
}
|
|
5452
5494
|
}
|
|
@@ -5468,14 +5510,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5468
5510
|
return null;
|
|
5469
5511
|
}
|
|
5470
5512
|
const ObjectBrowserViewFile = this.props.objectBrowserViewFile;
|
|
5471
|
-
return (
|
|
5513
|
+
return (React.createElement(ObjectBrowserViewFile, { key: "viewFile", obj: this.objects[this.state.viewFileDialog], socket: this.props.socket, t: this.props.t, onClose: () => this.setState({ viewFileDialog: '' }) }));
|
|
5472
5514
|
}
|
|
5473
5515
|
renderAliasEditorDialog() {
|
|
5474
5516
|
if (!this.props.objectBrowserAliasEditor || !this.state.showAliasEditor) {
|
|
5475
5517
|
return null;
|
|
5476
5518
|
}
|
|
5477
5519
|
const ObjectBrowserAliasEditor = this.props.objectBrowserAliasEditor;
|
|
5478
|
-
return (
|
|
5520
|
+
return (React.createElement(ObjectBrowserAliasEditor, { key: "editAlias", obj: this.objects[this.state.showAliasEditor], objects: this.objects, socket: this.props.socket, t: this.props.t, onClose: () => this.setState({ showAliasEditor: '' }), onRedirect: (id, timeout) => setTimeout(() => this.onSelect(id, false, () => this.expandAllSelected(() => {
|
|
5479
5521
|
this.scrollToItem(id);
|
|
5480
5522
|
setTimeout(() => this.setState({
|
|
5481
5523
|
editObjectDialog: id,
|
|
@@ -5499,8 +5541,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5499
5541
|
if (!this.state.aliasMenu) {
|
|
5500
5542
|
return null;
|
|
5501
5543
|
}
|
|
5502
|
-
return (
|
|
5503
|
-
|
|
5544
|
+
return (React.createElement(Menu, { key: "aliasmenu", open: !0, anchorEl: window.document.getElementById(`alias_${this.state.aliasMenu}`), onClose: () => this.setState({ aliasMenu: '' }) }, this.info.aliasesMap[this.state.aliasMenu].map((aliasId, i) => (React.createElement(MenuItem, { key: aliasId, onClick: () => this.onSelect(aliasId) },
|
|
5545
|
+
React.createElement(ListItemText, null, this.renderAliasLink(this.state.aliasMenu, i, {
|
|
5504
5546
|
'& .admin-browser-arrow': {
|
|
5505
5547
|
mr: '8px',
|
|
5506
5548
|
},
|
|
@@ -5510,7 +5552,6 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5510
5552
|
* Renders the right mouse button context menu
|
|
5511
5553
|
*/
|
|
5512
5554
|
renderContextMenu() {
|
|
5513
|
-
var _b, _c, _d, _e, _f, _g, _h;
|
|
5514
5555
|
if (!this.state.showContextMenu) {
|
|
5515
5556
|
return null;
|
|
5516
5557
|
}
|
|
@@ -5560,8 +5601,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5560
5601
|
key: '0',
|
|
5561
5602
|
visibility: !!(this.props.objectBrowserEditObject &&
|
|
5562
5603
|
obj &&
|
|
5563
|
-
(this.state.filter.expertMode ||
|
|
5564
|
-
icon: (
|
|
5604
|
+
(this.state.filter.expertMode || ObjectBrowserClass.isNonExpertId(id))),
|
|
5605
|
+
icon: (React.createElement(IconEdit, { fontSize: "small", style: this.styles.contextMenuEdit })),
|
|
5565
5606
|
label: this.texts.editObject,
|
|
5566
5607
|
onClick: () => this.setState({ editObjectDialog: item.data.id, showContextMenu: null, editObjectAlias: false }),
|
|
5567
5608
|
},
|
|
@@ -5572,9 +5613,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5572
5613
|
obj &&
|
|
5573
5614
|
obj.type === 'state' &&
|
|
5574
5615
|
// @ts-expect-error deprecated from js-controller 6
|
|
5575
|
-
|
|
5616
|
+
obj.common?.type !== 'file' &&
|
|
5576
5617
|
(this.state.filter.expertMode || obj.common.write !== false)),
|
|
5577
|
-
icon: (
|
|
5618
|
+
icon: (React.createElement(IconValueEdit, { fontSize: "small", style: this.styles.contextMenuEditValue })),
|
|
5578
5619
|
label: this.props.t('ra_Edit value'),
|
|
5579
5620
|
onClick: () => {
|
|
5580
5621
|
this.edit = {
|
|
@@ -5588,12 +5629,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5588
5629
|
},
|
|
5589
5630
|
VIEW: {
|
|
5590
5631
|
visibility: !!this.props.objectBrowserViewFile &&
|
|
5591
|
-
|
|
5632
|
+
obj?.type === 'state' &&
|
|
5592
5633
|
// @ts-expect-error deprecated from js-controller 6
|
|
5593
|
-
|
|
5594
|
-
icon: (
|
|
5634
|
+
obj.common?.type === 'file',
|
|
5635
|
+
icon: (React.createElement(FindInPage, { fontSize: "small", style: this.styles.contextMenuView })),
|
|
5595
5636
|
label: this.props.t('ra_View file'),
|
|
5596
|
-
onClick: () => this.setState({ viewFileDialog:
|
|
5637
|
+
onClick: () => this.setState({ viewFileDialog: obj?._id || '', showContextMenu: null }),
|
|
5597
5638
|
},
|
|
5598
5639
|
CUSTOM: {
|
|
5599
5640
|
key: '2',
|
|
@@ -5602,16 +5643,15 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5602
5643
|
obj &&
|
|
5603
5644
|
obj.type === 'state' &&
|
|
5604
5645
|
// @ts-expect-error deprecated from js-controller 6
|
|
5605
|
-
|
|
5606
|
-
icon: (
|
|
5646
|
+
obj.common?.type !== 'file'),
|
|
5647
|
+
icon: (React.createElement(IconConfig, { fontSize: "small", style: item.data.hasCustoms
|
|
5607
5648
|
? this.styles.cellButtonsButtonWithCustoms
|
|
5608
5649
|
: styles.cellButtonsButtonWithoutCustoms })),
|
|
5609
5650
|
style: this.styles.contextMenuCustom,
|
|
5610
5651
|
label: this.texts.customConfig,
|
|
5611
5652
|
onClick: () => {
|
|
5612
|
-
var _b;
|
|
5613
5653
|
this.pauseSubscribe(true);
|
|
5614
|
-
|
|
5654
|
+
this.props.router?.doNavigate(null, 'customs', id);
|
|
5615
5655
|
this.setState({ customDialog: [id], showContextMenu: null });
|
|
5616
5656
|
},
|
|
5617
5657
|
},
|
|
@@ -5632,14 +5672,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5632
5672
|
ROLE: {
|
|
5633
5673
|
key: '4',
|
|
5634
5674
|
visibility: !!(this.state.filter.expertMode && enumEditable && this.props.objectBrowserEditRole),
|
|
5635
|
-
icon: (
|
|
5675
|
+
icon: (React.createElement(BorderColor, { fontSize: "small", style: this.styles.contextMenuRole })),
|
|
5636
5676
|
label: this.props.t('ra_Edit role'),
|
|
5637
5677
|
onClick: () => this.setState({ roleDialog: item.data.id, showContextMenu: null }),
|
|
5638
5678
|
},
|
|
5639
5679
|
FUNCTION: {
|
|
5640
5680
|
key: '5',
|
|
5641
5681
|
visibility: !!enumEditable,
|
|
5642
|
-
icon: (
|
|
5682
|
+
icon: (React.createElement(BedroomParent, { fontSize: "small", style: this.styles.contextMenuRole })),
|
|
5643
5683
|
label: this.props.t('ra_Edit function'),
|
|
5644
5684
|
onClick: () => {
|
|
5645
5685
|
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'funcEnums');
|
|
@@ -5657,7 +5697,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5657
5697
|
ROOM: {
|
|
5658
5698
|
key: '6',
|
|
5659
5699
|
visibility: !!enumEditable,
|
|
5660
|
-
icon: (
|
|
5700
|
+
icon: (React.createElement(Construction, { fontSize: "small", style: this.styles.contextMenuRoom })),
|
|
5661
5701
|
label: this.props.t('ra_Edit room'),
|
|
5662
5702
|
onClick: () => {
|
|
5663
5703
|
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'roomEnums');
|
|
@@ -5677,18 +5717,17 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5677
5717
|
visibility: !!(!this.props.notEditable &&
|
|
5678
5718
|
this.props.objectBrowserAliasEditor &&
|
|
5679
5719
|
this.props.objectBrowserEditObject &&
|
|
5680
|
-
|
|
5720
|
+
obj?.type === 'state' &&
|
|
5681
5721
|
// @ts-expect-error deprecated from js-controller 6
|
|
5682
|
-
|
|
5683
|
-
icon: (
|
|
5722
|
+
obj.common?.type !== 'file'),
|
|
5723
|
+
icon: (React.createElement(IconLink, { style: obj?.common?.alias
|
|
5684
5724
|
? this.styles.cellButtonsButtonWithCustoms
|
|
5685
5725
|
: styles.cellButtonsButtonWithoutCustoms })),
|
|
5686
5726
|
label: this.info.aliasesMap[item.data.id]
|
|
5687
5727
|
? this.props.t('ra_Edit alias')
|
|
5688
5728
|
: this.props.t('ra_Create alias'),
|
|
5689
5729
|
onClick: () => {
|
|
5690
|
-
|
|
5691
|
-
if ((_b = obj === null || obj === void 0 ? void 0 : obj.common) === null || _b === void 0 ? void 0 : _b.alias) {
|
|
5730
|
+
if (obj?.common?.alias) {
|
|
5692
5731
|
this.setState({ showContextMenu: null, editObjectDialog: item.data.id, editObjectAlias: true });
|
|
5693
5732
|
}
|
|
5694
5733
|
else {
|
|
@@ -5700,49 +5739,49 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5700
5739
|
key: '+',
|
|
5701
5740
|
visibility: (item.data.id.startsWith('0_userdata.0') || item.data.id.startsWith('javascript.')) &&
|
|
5702
5741
|
(createStateVisible || createChannelVisible || createDeviceVisible || createFolderVisible),
|
|
5703
|
-
icon: (
|
|
5742
|
+
icon: (React.createElement(AddIcon, { fontSize: "small", style: this.styles.cellButtonsButtonWithCustoms })),
|
|
5704
5743
|
style: styles.contextMenuWithSubMenu,
|
|
5705
5744
|
label: this.texts.create,
|
|
5706
5745
|
subMenu: [
|
|
5707
5746
|
{
|
|
5708
5747
|
label: this.texts.createBooleanState,
|
|
5709
5748
|
visibility: createStateVisible,
|
|
5710
|
-
icon:
|
|
5749
|
+
icon: React.createElement(IconState, { fontSize: "small" }),
|
|
5711
5750
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'state', 'boolean'),
|
|
5712
5751
|
},
|
|
5713
5752
|
{
|
|
5714
5753
|
label: this.texts.createNumberState,
|
|
5715
5754
|
visibility: createStateVisible,
|
|
5716
|
-
icon:
|
|
5755
|
+
icon: React.createElement(IconState, { fontSize: "small" }),
|
|
5717
5756
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'state', 'number'),
|
|
5718
5757
|
},
|
|
5719
5758
|
{
|
|
5720
5759
|
label: this.texts.createStringState,
|
|
5721
5760
|
visibility: createStateVisible,
|
|
5722
|
-
icon:
|
|
5761
|
+
icon: React.createElement(IconState, { fontSize: "small" }),
|
|
5723
5762
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'state', 'string'),
|
|
5724
5763
|
},
|
|
5725
5764
|
{
|
|
5726
5765
|
label: this.texts.createState,
|
|
5727
5766
|
visibility: createStateVisible,
|
|
5728
|
-
icon:
|
|
5767
|
+
icon: React.createElement(IconState, { fontSize: "small" }),
|
|
5729
5768
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'state'),
|
|
5730
5769
|
},
|
|
5731
5770
|
{
|
|
5732
5771
|
label: this.texts.createChannel,
|
|
5733
5772
|
visibility: createChannelVisible,
|
|
5734
|
-
icon:
|
|
5773
|
+
icon: React.createElement(IconChannel, { fontSize: "small" }),
|
|
5735
5774
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'channel'),
|
|
5736
5775
|
},
|
|
5737
5776
|
{
|
|
5738
5777
|
label: this.texts.createDevice,
|
|
5739
5778
|
visibility: createDeviceVisible,
|
|
5740
|
-
icon:
|
|
5779
|
+
icon: React.createElement(IconDevice, { fontSize: "small" }),
|
|
5741
5780
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'device'),
|
|
5742
5781
|
},
|
|
5743
5782
|
{
|
|
5744
5783
|
label: this.texts.createFolder,
|
|
5745
|
-
icon:
|
|
5784
|
+
icon: React.createElement(IconFolder, { fontSize: "small" }),
|
|
5746
5785
|
visibility: createFolderVisible,
|
|
5747
5786
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'folder'),
|
|
5748
5787
|
},
|
|
@@ -5751,8 +5790,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5751
5790
|
DELETE: {
|
|
5752
5791
|
key: 'Delete',
|
|
5753
5792
|
visibility: !!(this.props.onObjectDelete &&
|
|
5754
|
-
(
|
|
5755
|
-
icon: (
|
|
5793
|
+
(item.children?.length || (obj && !obj.common?.dontDelete))),
|
|
5794
|
+
icon: (React.createElement(IconDelete, { fontSize: "small", style: this.styles.contextMenuDelete })),
|
|
5756
5795
|
style: this.styles.contextMenuDelete,
|
|
5757
5796
|
label: this.texts.deleteObject,
|
|
5758
5797
|
onClick: () => this.setState({ showContextMenu: null }, () => this.showDeleteDialog({
|
|
@@ -5763,10 +5802,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5763
5802
|
},
|
|
5764
5803
|
};
|
|
5765
5804
|
Object.keys(ITEMS).forEach(key => {
|
|
5766
|
-
var _b, _c;
|
|
5767
5805
|
if (ITEMS[key].visibility) {
|
|
5768
5806
|
if (ITEMS[key].subMenu) {
|
|
5769
|
-
items.push(
|
|
5807
|
+
items.push(React.createElement(MenuItem, { key: key, href: "", onClick: (e) => this.state.showContextMenu &&
|
|
5770
5808
|
this.setState({
|
|
5771
5809
|
showContextMenu: {
|
|
5772
5810
|
item: this.state.showContextMenu.item,
|
|
@@ -5775,14 +5813,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5775
5813
|
subAnchor: e.target,
|
|
5776
5814
|
},
|
|
5777
5815
|
}), style: ITEMS[key].style },
|
|
5778
|
-
|
|
5779
|
-
|
|
5816
|
+
React.createElement(ListItemIcon, { style: { ...ITEMS[key].iconStyle, ...ITEMS[key].listItemIconStyle } }, ITEMS[key].icon),
|
|
5817
|
+
React.createElement(ListItemText, null,
|
|
5780
5818
|
ITEMS[key].label,
|
|
5781
5819
|
"..."),
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
if (
|
|
5785
|
-
items.push(
|
|
5820
|
+
React.createElement("div", { style: { ...styles.contextMenuKeys, opacity: 1 } },
|
|
5821
|
+
React.createElement(ArrowRightIcon, null))));
|
|
5822
|
+
if (this.state.showContextMenu?.subItem === key) {
|
|
5823
|
+
items.push(React.createElement(Menu, { key: "subContextMenu", open: !0, anchorEl: this.state.showContextMenu.subAnchor, onClose: () => {
|
|
5786
5824
|
if (this.state.showContextMenu) {
|
|
5787
5825
|
this.setState({
|
|
5788
5826
|
showContextMenu: {
|
|
@@ -5792,16 +5830,19 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5792
5830
|
});
|
|
5793
5831
|
}
|
|
5794
5832
|
this.contextMenu = null;
|
|
5795
|
-
} },
|
|
5796
|
-
|
|
5797
|
-
|
|
5833
|
+
} }, ITEMS[key].subMenu?.map(subItem => subItem.visibility ? (React.createElement(MenuItem, { key: subItem.label, onClick: subItem.onClick, style: subItem.style },
|
|
5834
|
+
React.createElement(ListItemIcon, { style: {
|
|
5835
|
+
...subItem.iconStyle,
|
|
5836
|
+
...(subItem.listItemIconStyle || undefined),
|
|
5837
|
+
} }, subItem.icon),
|
|
5838
|
+
React.createElement(ListItemText, null, subItem.label))) : null)));
|
|
5798
5839
|
}
|
|
5799
5840
|
}
|
|
5800
5841
|
else {
|
|
5801
|
-
items.push(
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
ITEMS[key].key ? (
|
|
5842
|
+
items.push(React.createElement(MenuItem, { key: key, onClick: ITEMS[key].onClick, sx: ITEMS[key].style },
|
|
5843
|
+
React.createElement(ListItemIcon, { style: { ...ITEMS[key].iconStyle, ...ITEMS[key].listItemIconStyle } }, ITEMS[key].icon),
|
|
5844
|
+
React.createElement(ListItemText, null, ITEMS[key].label),
|
|
5845
|
+
ITEMS[key].key ? (React.createElement("div", { style: styles.contextMenuKeys }, `Alt+${ITEMS[key].key === 'Delete' ? this.props.t('ra_Del') : ITEMS[key].key}`)) : null));
|
|
5805
5846
|
}
|
|
5806
5847
|
}
|
|
5807
5848
|
});
|
|
@@ -5809,7 +5850,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5809
5850
|
setTimeout(() => this.setState({ showContextMenu: null }), 100);
|
|
5810
5851
|
return null;
|
|
5811
5852
|
}
|
|
5812
|
-
return (
|
|
5853
|
+
return (React.createElement(Menu, { key: "contextMenu", open: !0, onKeyUp: e => {
|
|
5813
5854
|
e.preventDefault();
|
|
5814
5855
|
if (e.altKey) {
|
|
5815
5856
|
Object.keys(ITEMS).forEach(key => {
|
|
@@ -5824,7 +5865,6 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5824
5865
|
} }, items));
|
|
5825
5866
|
}
|
|
5826
5867
|
renderEditValueDialog() {
|
|
5827
|
-
var _b;
|
|
5828
5868
|
if (!this.state.updateOpened || !this.props.objectBrowserValue) {
|
|
5829
5869
|
return null;
|
|
5830
5870
|
}
|
|
@@ -5836,12 +5876,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5836
5876
|
console.error(`Something went wrong. Possibly the object ${this.edit.id} was deleted.`);
|
|
5837
5877
|
return null;
|
|
5838
5878
|
}
|
|
5839
|
-
const type =
|
|
5879
|
+
const type = this.objects[this.edit.id].common?.type
|
|
5840
5880
|
? this.objects[this.edit.id].common.type
|
|
5841
5881
|
: typeof this.edit.val;
|
|
5842
5882
|
const role = this.objects[this.edit.id].common.role;
|
|
5843
5883
|
const ObjectBrowserValue = this.props.objectBrowserValue;
|
|
5844
|
-
return (
|
|
5884
|
+
return (React.createElement(ObjectBrowserValue, { t: this.props.t, lang: this.props.lang, type: type, role: role || '', states: Utils.getStates(this.objects[this.edit.id]), themeType: this.props.themeType, theme: this.props.theme, expertMode: !!this.state.filter.expertMode, value: this.edit.val, socket: this.props.socket, object: this.objects[this.edit.id], defaultHistory: this.defaultHistory, dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat, isFloatComma: this.props.isFloatComma === undefined
|
|
5845
5885
|
? this.systemConfig.common.isFloatComma
|
|
5846
5886
|
: this.props.isFloatComma, onClose: (res) => {
|
|
5847
5887
|
this.setState({ updateOpened: false });
|
|
@@ -5860,26 +5900,26 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5860
5900
|
}
|
|
5861
5901
|
if (this.styleTheme !== this.props.themeType) {
|
|
5862
5902
|
this.styles = {
|
|
5863
|
-
cellIdIconFolder:
|
|
5864
|
-
cellIdIconDocument:
|
|
5865
|
-
iconDeviceError:
|
|
5866
|
-
iconDeviceConnected:
|
|
5867
|
-
iconDeviceDisconnected:
|
|
5868
|
-
cellButtonsButtonWithCustoms:
|
|
5869
|
-
invertedBackground:
|
|
5870
|
-
invertedBackgroundFlex:
|
|
5871
|
-
contextMenuEdit:
|
|
5872
|
-
contextMenuEditValue:
|
|
5873
|
-
contextMenuView:
|
|
5874
|
-
contextMenuCustom:
|
|
5875
|
-
contextMenuACL:
|
|
5876
|
-
contextMenuRoom:
|
|
5877
|
-
contextMenuRole:
|
|
5878
|
-
contextMenuDelete:
|
|
5879
|
-
filterInput:
|
|
5880
|
-
iconCopy:
|
|
5881
|
-
aliasReadWrite:
|
|
5882
|
-
aliasAlone:
|
|
5903
|
+
cellIdIconFolder: Utils.getStyle(this.props.theme, styles.cellIdIconFolder),
|
|
5904
|
+
cellIdIconDocument: Utils.getStyle(this.props.theme, styles.cellIdIconDocument),
|
|
5905
|
+
iconDeviceError: Utils.getStyle(this.props.theme, styles.iconDeviceError),
|
|
5906
|
+
iconDeviceConnected: Utils.getStyle(this.props.theme, styles.iconDeviceConnected),
|
|
5907
|
+
iconDeviceDisconnected: Utils.getStyle(this.props.theme, styles.iconDeviceDisconnected),
|
|
5908
|
+
cellButtonsButtonWithCustoms: Utils.getStyle(this.props.theme, styles.cellButtonsButtonWithCustoms),
|
|
5909
|
+
invertedBackground: Utils.getStyle(this.props.theme, styles.invertedBackground),
|
|
5910
|
+
invertedBackgroundFlex: Utils.getStyle(this.props.theme, styles.invertedBackgroundFlex),
|
|
5911
|
+
contextMenuEdit: Utils.getStyle(this.props.theme, styles.contextMenuEdit),
|
|
5912
|
+
contextMenuEditValue: Utils.getStyle(this.props.theme, styles.contextMenuEditValue),
|
|
5913
|
+
contextMenuView: Utils.getStyle(this.props.theme, styles.contextMenuView),
|
|
5914
|
+
contextMenuCustom: Utils.getStyle(this.props.theme, styles.contextMenuCustom),
|
|
5915
|
+
contextMenuACL: Utils.getStyle(this.props.theme, styles.contextMenuACL),
|
|
5916
|
+
contextMenuRoom: Utils.getStyle(this.props.theme, styles.contextMenuRoom),
|
|
5917
|
+
contextMenuRole: Utils.getStyle(this.props.theme, styles.contextMenuRole),
|
|
5918
|
+
contextMenuDelete: Utils.getStyle(this.props.theme, styles.contextMenuDelete),
|
|
5919
|
+
filterInput: Utils.getStyle(this.props.theme, styles.headerCellInput, styles.filterInput),
|
|
5920
|
+
iconCopy: Utils.getStyle(this.props.theme, styles.cellButtonsValueButton, styles.cellButtonsValueButtonCopy),
|
|
5921
|
+
aliasReadWrite: Utils.getStyle(this.props.theme, styles.cellIdAlias, styles.cellIdAliasReadWrite),
|
|
5922
|
+
aliasAlone: Utils.getStyle(this.props.theme, styles.cellIdAlias, styles.cellIdAliasAlone),
|
|
5883
5923
|
};
|
|
5884
5924
|
this.styleTheme = this.props.themeType;
|
|
5885
5925
|
}
|
|
@@ -5901,11 +5941,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5901
5941
|
this.checkUnsubscribes();
|
|
5902
5942
|
}, 200);
|
|
5903
5943
|
if (!this.state.loaded) {
|
|
5904
|
-
return
|
|
5944
|
+
return React.createElement(CircularProgress, { key: `${this.props.dialogName}_c` });
|
|
5905
5945
|
}
|
|
5906
5946
|
const items = this.root ? this.renderItem(this.root, undefined) : null;
|
|
5907
|
-
return (
|
|
5908
|
-
|
|
5947
|
+
return (React.createElement(TabContainer, { key: this.props.dialogName },
|
|
5948
|
+
React.createElement("style", null, `
|
|
5909
5949
|
@keyframes newValueAnimation-light {
|
|
5910
5950
|
0% {
|
|
5911
5951
|
color: #00f900;
|
|
@@ -5935,10 +5975,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5935
5975
|
animation: newValueAnimation-light 2s ease-in-out;
|
|
5936
5976
|
}
|
|
5937
5977
|
`),
|
|
5938
|
-
|
|
5939
|
-
|
|
5978
|
+
React.createElement(TabHeader, null, this.getToolbar()),
|
|
5979
|
+
React.createElement(TabContent, null,
|
|
5940
5980
|
this.renderHeader(),
|
|
5941
|
-
|
|
5981
|
+
React.createElement("div", { style: styles.tableDiv, ref: this.tableRef, onKeyDown: event => this.navigateKeyPress(event) }, items)),
|
|
5942
5982
|
this.renderContextMenu(),
|
|
5943
5983
|
this.renderAliasMenu(),
|
|
5944
5984
|
this.renderToast(),
|
|
@@ -5960,8 +6000,5 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5960
6000
|
this.props.modalEditOfAccessControl(this, this.state.modalEditOfAccessObjData)));
|
|
5961
6001
|
}
|
|
5962
6002
|
}
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
/** Namespaces which are allowed to be edited by non-expert users */
|
|
5966
|
-
_ObjectBrowserClass_NON_EXPERT_NAMESPACES = { value: ['0_userdata.0.', 'alias.0.'] };
|
|
5967
|
-
exports.default = (0, withWidth_1.default)()(ObjectBrowserClass);
|
|
6003
|
+
export const ObjectBrowser = withWidth()(ObjectBrowserClass);
|
|
6004
|
+
//# sourceMappingURL=ObjectBrowser.js.map
|