@iobroker/adapter-react-v5 7.2.4 → 7.2.6
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 +6 -6
- 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 +2 -2
- package/{Components → build/Components}/FileBrowser.js +229 -236
- package/build/Components/FileBrowser.js.map +1 -0
- package/build/Components/FileViewer.d.ts +48 -0
- package/build/Components/FileViewer.js +277 -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 +1152 -1116
- 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 +46 -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} +37 -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 +6 -0
- package/build/icons/IconAdapter.js.map +1 -0
- package/build/icons/IconAlias.d.ts +3 -0
- package/build/icons/IconAlias.js +6 -0
- package/build/icons/IconAlias.js.map +1 -0
- package/build/icons/IconChannel.d.ts +3 -0
- package/build/icons/IconChannel.js +9 -0
- package/build/icons/IconChannel.js.map +1 -0
- package/build/icons/IconClearFilter.d.ts +3 -0
- package/build/icons/IconClearFilter.js +7 -0
- package/build/icons/IconClearFilter.js.map +1 -0
- package/build/icons/IconClosed.d.ts +3 -0
- package/build/icons/IconClosed.js +6 -0
- package/build/icons/IconClosed.js.map +1 -0
- package/build/icons/IconCopy.d.ts +3 -0
- package/build/icons/IconCopy.js +5 -0
- package/build/icons/IconCopy.js.map +1 -0
- package/build/icons/IconDevice.d.ts +3 -0
- package/build/icons/IconDevice.js +15 -0
- package/build/icons/IconDevice.js.map +1 -0
- package/build/icons/IconDocument.d.ts +3 -0
- package/build/icons/IconDocument.js +6 -0
- package/build/icons/IconDocument.js.map +1 -0
- package/build/icons/IconDocumentReadOnly.d.ts +3 -0
- package/build/icons/IconDocumentReadOnly.js +7 -0
- package/build/icons/IconDocumentReadOnly.js.map +1 -0
- package/build/icons/IconExpert.d.ts +3 -0
- package/build/icons/IconExpert.js +6 -0
- package/build/icons/IconExpert.js.map +1 -0
- package/build/icons/IconFx.d.ts +3 -0
- package/build/icons/IconFx.js +5 -0
- package/build/icons/IconFx.js.map +1 -0
- package/build/icons/IconInstance.d.ts +3 -0
- package/build/icons/IconInstance.js +6 -0
- package/build/icons/IconInstance.js.map +1 -0
- package/build/icons/IconLogout.d.ts +3 -0
- package/build/icons/IconLogout.js +6 -0
- package/build/icons/IconLogout.js.map +1 -0
- package/build/icons/IconNoIcon.d.ts +3 -0
- package/build/icons/IconNoIcon.js +5 -0
- package/build/icons/IconNoIcon.js.map +1 -0
- package/build/icons/IconOpen.d.ts +3 -0
- package/build/icons/IconOpen.js +6 -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 +6 -0
- package/build/icons/IconState.js.map +1 -0
- package/build/index.d.ts +67 -0
- package/build/index.js +67 -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
|
-
|
|
2956
|
-
|
|
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();
|
|
2553
|
+
}
|
|
2554
|
+
else {
|
|
2555
|
+
columns.splice(pos, 1);
|
|
2964
2556
|
}
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
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,7 +3596,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3823
3596
|
onCopy(e, text) {
|
|
3824
3597
|
e.stopPropagation();
|
|
3825
3598
|
e.preventDefault();
|
|
3826
|
-
|
|
3599
|
+
Utils.copyToClipboard(text);
|
|
3827
3600
|
if (text.length < 50) {
|
|
3828
3601
|
this.setState({ toast: this.props.t('ra_Copied %s', text) });
|
|
3829
3602
|
}
|
|
@@ -3831,14 +3604,82 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3831
3604
|
this.setState({ toast: this.props.t('ra_Copied') });
|
|
3832
3605
|
}
|
|
3833
3606
|
}
|
|
3607
|
+
renderTooltipAccessControl = (acl) => {
|
|
3608
|
+
// acl ={object,state,owner,ownerGroup}
|
|
3609
|
+
if (!acl) {
|
|
3610
|
+
return null;
|
|
3611
|
+
}
|
|
3612
|
+
const check = [
|
|
3613
|
+
{
|
|
3614
|
+
value: '0x400',
|
|
3615
|
+
valueNum: 0x400,
|
|
3616
|
+
title: 'read',
|
|
3617
|
+
group: 'Owner',
|
|
3618
|
+
},
|
|
3619
|
+
{
|
|
3620
|
+
value: '0x200',
|
|
3621
|
+
valueNum: 0x200,
|
|
3622
|
+
title: 'write',
|
|
3623
|
+
group: 'Owner',
|
|
3624
|
+
},
|
|
3625
|
+
{
|
|
3626
|
+
value: '0x40',
|
|
3627
|
+
valueNum: 0x40,
|
|
3628
|
+
title: 'read',
|
|
3629
|
+
group: 'Group',
|
|
3630
|
+
},
|
|
3631
|
+
{
|
|
3632
|
+
value: '0x20',
|
|
3633
|
+
valueNum: 0x20,
|
|
3634
|
+
title: 'write',
|
|
3635
|
+
group: 'Group',
|
|
3636
|
+
},
|
|
3637
|
+
{
|
|
3638
|
+
value: '0x4',
|
|
3639
|
+
valueNum: 0x4,
|
|
3640
|
+
title: 'read',
|
|
3641
|
+
group: 'Everyone',
|
|
3642
|
+
},
|
|
3643
|
+
{
|
|
3644
|
+
value: '0x2',
|
|
3645
|
+
valueNum: 0x2,
|
|
3646
|
+
title: 'write',
|
|
3647
|
+
group: 'Everyone',
|
|
3648
|
+
},
|
|
3649
|
+
];
|
|
3650
|
+
const arrayTooltipText = [];
|
|
3651
|
+
const funcRenderStateObject = (value) => {
|
|
3652
|
+
const rights = acl[value];
|
|
3653
|
+
check.forEach((el, i) => {
|
|
3654
|
+
if (rights & el.valueNum) {
|
|
3655
|
+
arrayTooltipText.push(React.createElement("span", { key: value + i },
|
|
3656
|
+
this.texts[`acl${el.group}_${el.title}_${value}`],
|
|
3657
|
+
",",
|
|
3658
|
+
React.createElement("span", { style: value === 'object' ? styles.rightsObject : styles.rightsState }, el.value)));
|
|
3659
|
+
}
|
|
3660
|
+
});
|
|
3661
|
+
};
|
|
3662
|
+
arrayTooltipText.push(React.createElement("span", { key: "group" }, `${this.texts.ownerGroup}: ${(acl.ownerGroup || '').replace('system.group.', '')}`));
|
|
3663
|
+
arrayTooltipText.push(React.createElement("span", { key: "owner" }, `${this.texts.ownerUser}: ${(acl.owner || '').replace('system.user.', '')}`));
|
|
3664
|
+
funcRenderStateObject('object');
|
|
3665
|
+
if (acl.state) {
|
|
3666
|
+
funcRenderStateObject('state');
|
|
3667
|
+
}
|
|
3668
|
+
return arrayTooltipText.length ? (React.createElement("span", { style: styles.tooltipAccessControl }, arrayTooltipText.map(el => el))) : null;
|
|
3669
|
+
};
|
|
3834
3670
|
renderColumnButtons(id, item) {
|
|
3835
|
-
var _b, _c, _d;
|
|
3836
3671
|
if (!item.data.obj) {
|
|
3837
|
-
return this.props.onObjectDelete || this.props.objectEditOfAccessControl ? (
|
|
3838
|
-
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? (
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3672
|
+
return this.props.onObjectDelete || this.props.objectEditOfAccessControl ? (React.createElement("div", { style: styles.buttonDiv },
|
|
3673
|
+
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? (React.createElement(IconButton, { sx: {
|
|
3674
|
+
...styles.cellButtonsButton,
|
|
3675
|
+
...styles.cellButtonsEmptyButton,
|
|
3676
|
+
...styles.cellButtonMinWidth,
|
|
3677
|
+
}, onClick: () => this.setState({ modalEditOfAccess: true, modalEditOfAccessObjData: item.data }), size: "large" },
|
|
3678
|
+
React.createElement("div", { style: { height: 15 } }, "---"))) : null,
|
|
3679
|
+
this.props.onObjectDelete && item.children && item.children.length ? (React.createElement(IconButton, { sx: {
|
|
3680
|
+
...styles.cellButtonsButton,
|
|
3681
|
+
...styles.cellButtonsButtonAlone,
|
|
3682
|
+
}, size: "small", "aria-label": "delete", title: this.texts.deleteObject, onClick: () => {
|
|
3842
3683
|
// calculate the number of children
|
|
3843
3684
|
const keys = Object.keys(this.objects);
|
|
3844
3685
|
keys.sort();
|
|
@@ -3853,10 +3694,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3853
3694
|
}
|
|
3854
3695
|
}
|
|
3855
3696
|
if (this.props.onObjectDelete) {
|
|
3856
|
-
this.props.onObjectDelete(id, !!
|
|
3697
|
+
this.props.onObjectDelete(id, !!item.children?.length, false, count + 1);
|
|
3857
3698
|
}
|
|
3858
3699
|
} },
|
|
3859
|
-
|
|
3700
|
+
React.createElement(IconDelete, { style: styles.cellButtonsButtonIcon }))) : null)) : null;
|
|
3860
3701
|
}
|
|
3861
3702
|
item.data.aclTooltip =
|
|
3862
3703
|
item.data.aclTooltip || this.renderTooltipAccessControl(item.data.obj.acl);
|
|
@@ -3869,20 +3710,26 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3869
3710
|
(item.data.obj.type === 'state'
|
|
3870
3711
|
? this.systemConfig.common.defaultNewAcl.state
|
|
3871
3712
|
: this.systemConfig.common.defaultNewAcl.object);
|
|
3872
|
-
const showEdit = this.state.filter.expertMode ||
|
|
3713
|
+
const showEdit = this.state.filter.expertMode || ObjectBrowserClass.isNonExpertId(item.data.id);
|
|
3873
3714
|
return [
|
|
3874
|
-
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? (
|
|
3875
|
-
|
|
3876
|
-
|
|
3715
|
+
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? (React.createElement(Tooltip, { key: "acl", title: item.data.aclTooltip, slotProps: { popper: { sx: styles.tooltip } } },
|
|
3716
|
+
React.createElement(IconButton, { sx: {
|
|
3717
|
+
...styles.cellButtonsButton,
|
|
3718
|
+
...styles.cellButtonMinWidth,
|
|
3719
|
+
opacity: 1,
|
|
3720
|
+
}, onClick: () => this.setState({ modalEditOfAccess: true, modalEditOfAccessObjData: item.data }), size: "large" },
|
|
3721
|
+
React.createElement("div", { style: styles.aclText }, Number.isNaN(Number(acl))
|
|
3877
3722
|
? Number(aclSystemConfig).toString(16)
|
|
3878
|
-
: Number(acl).toString(16))))) : (
|
|
3879
|
-
showEdit ? (
|
|
3723
|
+
: Number(acl).toString(16))))) : (React.createElement("div", { key: "aclEmpty", style: styles.cellButtonMinWidth })),
|
|
3724
|
+
showEdit ? (React.createElement(IconButton, { key: "edit", sx: {
|
|
3725
|
+
marginRight: '2px',
|
|
3726
|
+
...styles.cellButtonsButton,
|
|
3727
|
+
}, size: "small", "aria-label": "edit", title: this.texts.editObject, onClick: () => {
|
|
3880
3728
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`, id);
|
|
3881
3729
|
this.setState({ editObjectDialog: id, editObjectAlias: false });
|
|
3882
3730
|
} },
|
|
3883
|
-
|
|
3884
|
-
this.props.onObjectDelete && (
|
|
3885
|
-
var _b, _c, _d;
|
|
3731
|
+
React.createElement(IconEdit, { style: styles.cellButtonsButtonIcon }))) : (React.createElement(Box, { component: "div", key: "editDisabled", sx: styles.cellButtonsButton })),
|
|
3732
|
+
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
3733
|
const keys = Object.keys(this.objects);
|
|
3887
3734
|
keys.sort();
|
|
3888
3735
|
let count = 0;
|
|
@@ -3896,28 +3743,29 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3896
3743
|
}
|
|
3897
3744
|
}
|
|
3898
3745
|
if (this.props.onObjectDelete) {
|
|
3899
|
-
this.props.onObjectDelete(id, !!
|
|
3746
|
+
this.props.onObjectDelete(id, !!item.children?.length, !item.data.obj?.common?.dontDelete, count);
|
|
3900
3747
|
}
|
|
3901
3748
|
}, title: this.texts.deleteObject },
|
|
3902
|
-
|
|
3749
|
+
React.createElement(IconDelete, { style: styles.cellButtonsButtonIcon }))) : null,
|
|
3903
3750
|
this.props.objectCustomDialog &&
|
|
3904
3751
|
this.info.hasSomeCustoms &&
|
|
3905
3752
|
item.data.obj.type === 'state' &&
|
|
3906
3753
|
// @ts-expect-error deprecated from js-controller 6
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3754
|
+
item.data.obj.common?.type !== 'file' ? (React.createElement(IconButton, { sx: {
|
|
3755
|
+
...styles.cellButtonsButton,
|
|
3756
|
+
...(item.data.hasCustoms
|
|
3757
|
+
? this.styles.cellButtonsButtonWithCustoms
|
|
3758
|
+
: styles.cellButtonsButtonWithoutCustoms),
|
|
3759
|
+
}, key: "custom", size: "small", "aria-label": "config", title: this.texts.customConfig, onClick: () => {
|
|
3911
3760
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`, id);
|
|
3912
3761
|
this.pauseSubscribe(true);
|
|
3913
|
-
|
|
3762
|
+
this.props.router?.doNavigate(null, 'customs', id);
|
|
3914
3763
|
this.setState({ customDialog: [id], customDialogAll: false });
|
|
3915
3764
|
} },
|
|
3916
|
-
|
|
3765
|
+
React.createElement(IconConfig, { style: styles.cellButtonsButtonIcon }))) : null,
|
|
3917
3766
|
];
|
|
3918
3767
|
}
|
|
3919
3768
|
readHistory(id) {
|
|
3920
|
-
var _b, _c;
|
|
3921
3769
|
/* interface GetHistoryOptions {
|
|
3922
3770
|
instance?: string;
|
|
3923
3771
|
start?: number;
|
|
@@ -3935,7 +3783,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3935
3783
|
} */
|
|
3936
3784
|
if (window.sparkline &&
|
|
3937
3785
|
this.defaultHistory &&
|
|
3938
|
-
|
|
3786
|
+
this.objects[id]?.common?.custom &&
|
|
3939
3787
|
this.objects[id].common.custom[this.defaultHistory]) {
|
|
3940
3788
|
const now = new Date();
|
|
3941
3789
|
now.setHours(now.getHours() - 24);
|
|
@@ -3969,7 +3817,6 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3969
3817
|
}
|
|
3970
3818
|
}
|
|
3971
3819
|
getTooltipInfo(id, cb) {
|
|
3972
|
-
var _b, _c;
|
|
3973
3820
|
const obj = this.objects[id];
|
|
3974
3821
|
const state = this.states[id];
|
|
3975
3822
|
const { valFull, fileViewer } = formatValue({
|
|
@@ -3981,45 +3828,44 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3981
3828
|
full: true,
|
|
3982
3829
|
});
|
|
3983
3830
|
const valFullRx = [];
|
|
3984
|
-
valFull
|
|
3831
|
+
valFull?.forEach(_item => {
|
|
3985
3832
|
if (_item.t === this.texts.quality && state.q) {
|
|
3986
|
-
valFullRx.push(
|
|
3833
|
+
valFullRx.push(React.createElement("div", { style: styles.cellValueTooltipBoth, key: _item.t },
|
|
3987
3834
|
_item.t,
|
|
3988
3835
|
":\u00A0",
|
|
3989
3836
|
_item.v));
|
|
3990
3837
|
// <div style={styles.cellValueTooltipValue} key={item.t + '_v'}>{item.v}</div>,
|
|
3991
3838
|
if (!_item.nbr) {
|
|
3992
|
-
valFullRx.push(
|
|
3839
|
+
valFullRx.push(React.createElement("br", { key: `${_item.t}_br` }));
|
|
3993
3840
|
}
|
|
3994
3841
|
}
|
|
3995
3842
|
else {
|
|
3996
|
-
valFullRx.push(
|
|
3843
|
+
valFullRx.push(React.createElement("div", { style: styles.cellValueTooltipTitle, key: _item.t },
|
|
3997
3844
|
_item.t,
|
|
3998
3845
|
":\u00A0"));
|
|
3999
|
-
valFullRx.push(
|
|
3846
|
+
valFullRx.push(React.createElement("div", { style: styles.cellValueTooltipValue, key: `${_item.t}_v` }, _item.v));
|
|
4000
3847
|
if (!_item.nbr) {
|
|
4001
|
-
valFullRx.push(
|
|
3848
|
+
valFullRx.push(React.createElement("br", { key: `${_item.t}_br` }));
|
|
4002
3849
|
}
|
|
4003
3850
|
}
|
|
4004
3851
|
});
|
|
4005
3852
|
if (fileViewer === 'image') {
|
|
4006
|
-
valFullRx.push(
|
|
3853
|
+
valFullRx.push(React.createElement("img", { style: styles.cellValueTooltipImage, src: state.val, alt: id }));
|
|
4007
3854
|
}
|
|
4008
3855
|
else if (this.defaultHistory &&
|
|
4009
|
-
|
|
3856
|
+
this.objects[id]?.common?.custom &&
|
|
4010
3857
|
this.objects[id].common.custom[this.defaultHistory]) {
|
|
4011
|
-
valFullRx.push(
|
|
3858
|
+
valFullRx.push(React.createElement("svg", { key: "sparkline", className: "sparkline", "data-id": id, style: { fill: '#3d85de' }, width: "200", height: "30", strokeWidth: "3" }));
|
|
4012
3859
|
}
|
|
4013
3860
|
this.setState({ tooltipInfo: { el: valFullRx, id } }, () => cb && cb());
|
|
4014
3861
|
}
|
|
4015
3862
|
renderColumnValue(id, item, narrowStyleWithDetails) {
|
|
4016
|
-
var _b, _c;
|
|
4017
3863
|
const obj = item.data.obj;
|
|
4018
3864
|
if (!obj || !this.states) {
|
|
4019
3865
|
return null;
|
|
4020
3866
|
}
|
|
4021
|
-
if (
|
|
4022
|
-
return (
|
|
3867
|
+
if (obj.common?.type === 'file') {
|
|
3868
|
+
return (React.createElement(Box, { component: "div", sx: { ...styles.cellValueText, ...styles.cellValueFile } }, "[file]"));
|
|
4023
3869
|
}
|
|
4024
3870
|
if (!this.states[id]) {
|
|
4025
3871
|
if (obj.type === 'state') {
|
|
@@ -4050,23 +3896,23 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4050
3896
|
const valTextRx = [];
|
|
4051
3897
|
item.data.state = { valTextRx };
|
|
4052
3898
|
const copyText = valText.v || '';
|
|
4053
|
-
valTextRx.push(
|
|
3899
|
+
valTextRx.push(React.createElement("span", { className: `newValueBrowser-${this.props.themeType || 'light'}`, key: `${valText.v.toString()}valText`, style: {
|
|
4054
3900
|
whiteSpace: 'nowrap',
|
|
4055
3901
|
display: 'inline-block',
|
|
4056
3902
|
overflow: 'hidden',
|
|
4057
3903
|
textOverflow: 'ellipsis',
|
|
4058
3904
|
} }, valText.v.toString()));
|
|
4059
3905
|
if (valText.u) {
|
|
4060
|
-
valTextRx.push(
|
|
3906
|
+
valTextRx.push(React.createElement("span", { className: `newValueBrowser-${this.props.themeType || 'light'}`, style: styles.cellValueTextUnit, key: `${valText.v.toString()}unit` }, valText.u));
|
|
4061
3907
|
}
|
|
4062
3908
|
if (valText.s !== undefined) {
|
|
4063
|
-
valTextRx.push(
|
|
3909
|
+
valTextRx.push(React.createElement("span", { style: styles.cellValueTextState, className: `newValueBrowser-${this.props.themeType || 'light'}`, key: `${valText.v.toString()}states` },
|
|
4064
3910
|
"(",
|
|
4065
3911
|
valText.s,
|
|
4066
3912
|
")"));
|
|
4067
3913
|
}
|
|
4068
3914
|
if (!narrowStyleWithDetails) {
|
|
4069
|
-
valTextRx.push(
|
|
3915
|
+
valTextRx.push(React.createElement(IconCopy, { className: "copyButton", style: this.styles.iconCopy, onClick: e => this.onCopy(e, copyText), key: "cc" }));
|
|
4070
3916
|
}
|
|
4071
3917
|
// <IconEdit className="copyButton" style={{{ ...styles.cellButtonsValueButton, styles.cellButtonsValueButtonEdit)} key="ce" />
|
|
4072
3918
|
info = item.data.state;
|
|
@@ -4076,12 +3922,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4076
3922
|
if (!this.state.filter.expertMode) {
|
|
4077
3923
|
if (item.data.button) {
|
|
4078
3924
|
val = [
|
|
4079
|
-
|
|
3925
|
+
React.createElement(ButtonIcon, { key: "button", style: { color: info.style.color, ...styles.cellValueButton } }),
|
|
4080
3926
|
];
|
|
4081
3927
|
}
|
|
4082
3928
|
else if (item.data.switch) {
|
|
4083
3929
|
val = [
|
|
4084
|
-
|
|
3930
|
+
React.createElement(Switch, { key: "switch", sx: {
|
|
4085
3931
|
'& .MuiSwitch-thumb': { color: info.style.color },
|
|
4086
3932
|
'& .MuiSwitch-track': {
|
|
4087
3933
|
backgroundColor: !!this.states[id].val && this.state.selected.includes(id)
|
|
@@ -4094,16 +3940,19 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4094
3940
|
];
|
|
4095
3941
|
}
|
|
4096
3942
|
}
|
|
4097
|
-
return (
|
|
3943
|
+
return (React.createElement(Tooltip, { key: "value", title: this.state.tooltipInfo?.el, slotProps: {
|
|
4098
3944
|
popper: { sx: styles.cellValueTooltipBox },
|
|
4099
3945
|
tooltip: { sx: styles.cellValueTooltip },
|
|
4100
|
-
}, onOpen: () => this.getTooltipInfo(id, () => this.readHistory(id)), onClose: () =>
|
|
4101
|
-
|
|
3946
|
+
}, onOpen: () => this.getTooltipInfo(id, () => this.readHistory(id)), onClose: () => this.state.tooltipInfo?.id === id && this.setState({ tooltipInfo: null }) },
|
|
3947
|
+
React.createElement(Box, { component: "div", style: info.style, sx: {
|
|
3948
|
+
...styles.cellValueText,
|
|
3949
|
+
height: narrowStyleWithDetails ? undefined : ROW_HEIGHT,
|
|
3950
|
+
'& .admin-button:active': {
|
|
4102
3951
|
transform: 'translate(0, 2px)',
|
|
4103
|
-
}
|
|
3952
|
+
},
|
|
3953
|
+
} }, val)));
|
|
4104
3954
|
}
|
|
4105
3955
|
_syncEnum(id, enumIds, newArray, cb) {
|
|
4106
|
-
var _b, _c, _d;
|
|
4107
3956
|
if (!enumIds || !enumIds.length) {
|
|
4108
3957
|
if (cb) {
|
|
4109
3958
|
cb();
|
|
@@ -4112,8 +3961,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4112
3961
|
}
|
|
4113
3962
|
const enumId = enumIds.pop() || '';
|
|
4114
3963
|
const promises = [];
|
|
4115
|
-
if (
|
|
4116
|
-
if (
|
|
3964
|
+
if (this.info.objects[enumId]?.common) {
|
|
3965
|
+
if (this.info.objects[enumId].common.members?.length) {
|
|
4117
3966
|
const pos = this.info.objects[enumId].common.members.indexOf(id);
|
|
4118
3967
|
if (pos !== -1 && !newArray.includes(enumId)) {
|
|
4119
3968
|
// delete it from members
|
|
@@ -4126,7 +3975,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4126
3975
|
}
|
|
4127
3976
|
}
|
|
4128
3977
|
// add to it
|
|
4129
|
-
if (newArray.includes(enumId) && !
|
|
3978
|
+
if (newArray.includes(enumId) && !this.info.objects[enumId].common.members?.includes(id)) {
|
|
4130
3979
|
// add to object
|
|
4131
3980
|
const obj = JSON.parse(JSON.stringify(this.info.objects[enumId]));
|
|
4132
3981
|
obj.common.members = obj.common.members || [];
|
|
@@ -4160,28 +4009,25 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4160
4009
|
const itemEnums = this.state.enumDialogEnums;
|
|
4161
4010
|
const enumsOriginal = this.state.enumDialog.enumsOriginal;
|
|
4162
4011
|
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
|
-
})
|
|
4012
|
+
.map(id => ({
|
|
4013
|
+
name: getName(this.objects[id]?.common?.name || id.split('.').pop() || '', this.props.lang),
|
|
4014
|
+
value: id,
|
|
4015
|
+
icon: getSelectIdIconFromObjects(this.objects, id, this.props.lang, this.imagePrefix),
|
|
4016
|
+
}))
|
|
4171
4017
|
.sort((a, b) => (a.name > b.name ? 1 : -1));
|
|
4172
4018
|
enums.forEach(_item => {
|
|
4173
4019
|
if (_item.icon && typeof _item.icon === 'string') {
|
|
4174
|
-
_item.icon = (
|
|
4175
|
-
|
|
4020
|
+
_item.icon = (React.createElement(Box, { style: styles.enumIconDiv },
|
|
4021
|
+
React.createElement("img", { src: _item.icon, style: styles.enumIcon, alt: _item.name })));
|
|
4176
4022
|
}
|
|
4177
4023
|
});
|
|
4178
4024
|
// const hasIcons = !!enums.find(item => item.icon);
|
|
4179
|
-
return (
|
|
4180
|
-
|
|
4025
|
+
return (React.createElement(Dialog, { sx: { '& .MuiPaper-root': styles.enumDialog }, onClose: () => this.setState({ enumDialog: null }), "aria-labelledby": "enum-dialog-title", open: !0 },
|
|
4026
|
+
React.createElement(DialogTitle, { id: "enum-dialog-title" },
|
|
4181
4027
|
type === 'func' ? this.props.t('ra_Define functions') : this.props.t('ra_Define rooms'),
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4028
|
+
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 })) },
|
|
4029
|
+
React.createElement(IconCheck, null))),
|
|
4030
|
+
React.createElement(List, { sx: { '&.MuiList-root': styles.enumList } }, enums.map(_item => {
|
|
4185
4031
|
let id;
|
|
4186
4032
|
let name;
|
|
4187
4033
|
let icon;
|
|
@@ -4195,7 +4041,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4195
4041
|
name = _item;
|
|
4196
4042
|
}
|
|
4197
4043
|
const labelId = `checkbox-list-label-${id}`;
|
|
4198
|
-
return (
|
|
4044
|
+
return (React.createElement(ListItem, { sx: styles.headerCellSelectItem, key: id, onClick: () => {
|
|
4199
4045
|
const pos = itemEnums.indexOf(id);
|
|
4200
4046
|
const enumDialogEnums = JSON.parse(JSON.stringify(this.state.enumDialogEnums));
|
|
4201
4047
|
if (pos === -1) {
|
|
@@ -4207,9 +4053,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4207
4053
|
}
|
|
4208
4054
|
this.setState({ enumDialogEnums });
|
|
4209
4055
|
}, secondaryAction: icon },
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4056
|
+
React.createElement(ListItemIcon, { sx: { '&.MuiListItemIcon-root': styles.enumCheckbox } },
|
|
4057
|
+
React.createElement(Checkbox, { edge: "start", checked: itemEnums.includes(id), tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': labelId } })),
|
|
4058
|
+
React.createElement(ListItemText, { id: labelId }, name)));
|
|
4213
4059
|
}))));
|
|
4214
4060
|
}
|
|
4215
4061
|
renderEditRoleDialog() {
|
|
@@ -4218,7 +4064,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4218
4064
|
}
|
|
4219
4065
|
if (this.state.roleDialog && this.props.objectBrowserEditRole) {
|
|
4220
4066
|
const ObjectBrowserEditRole = this.props.objectBrowserEditRole;
|
|
4221
|
-
return (
|
|
4067
|
+
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
4068
|
if (obj) {
|
|
4223
4069
|
this.info.objects[this.state.roleDialog] = obj;
|
|
4224
4070
|
}
|
|
@@ -4228,7 +4074,6 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4228
4074
|
return null;
|
|
4229
4075
|
}
|
|
4230
4076
|
onColumnsEditCustomDialogClose(isSave) {
|
|
4231
|
-
var _b, _c;
|
|
4232
4077
|
// cannot be null
|
|
4233
4078
|
const customColumnDialog = this.customColumnDialog;
|
|
4234
4079
|
if (isSave) {
|
|
@@ -4241,11 +4086,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4241
4086
|
}
|
|
4242
4087
|
this.customColumnDialog = null;
|
|
4243
4088
|
this.props.socket
|
|
4244
|
-
.getObject(
|
|
4089
|
+
.getObject(this.state.columnsEditCustomDialog?.obj?._id || '')
|
|
4245
4090
|
.then(obj => {
|
|
4246
|
-
var _b;
|
|
4247
4091
|
if (obj &&
|
|
4248
|
-
|
|
4092
|
+
ObjectBrowserClass.setCustomValue(obj, this.state.columnsEditCustomDialog?.it, value)) {
|
|
4249
4093
|
return this.props.socket.setObject(obj._id, obj);
|
|
4250
4094
|
}
|
|
4251
4095
|
throw new Error(this.props.t('ra_Cannot update attribute, because not found in the object'));
|
|
@@ -4263,24 +4107,24 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4263
4107
|
return null;
|
|
4264
4108
|
}
|
|
4265
4109
|
if (!this.customColumnDialog) {
|
|
4266
|
-
const value =
|
|
4110
|
+
const value = ObjectBrowserClass.getCustomValue(this.state.columnsEditCustomDialog.obj, this.state.columnsEditCustomDialog.it);
|
|
4267
4111
|
this.customColumnDialog = {
|
|
4268
4112
|
type: (this.state.columnsEditCustomDialog.it.type || typeof value),
|
|
4269
4113
|
initValue: (value === null || value === undefined ? '' : value).toString(),
|
|
4270
4114
|
value: (value === null || value === undefined ? '' : value).toString(),
|
|
4271
4115
|
};
|
|
4272
4116
|
}
|
|
4273
|
-
return (
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4117
|
+
return (React.createElement(Dialog, { onClose: () => this.setState({ columnsEditCustomDialog: null }), maxWidth: "md", "aria-labelledby": "custom-dialog-title", open: !0 },
|
|
4118
|
+
React.createElement(DialogTitle, { id: "custom-dialog-title" }, `${this.props.t('ra_Edit object field')}: ${this.state.columnsEditCustomDialog.obj._id}`),
|
|
4119
|
+
React.createElement(DialogContent, null,
|
|
4120
|
+
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
4121
|
const customColumnDialog = this.customColumnDialog;
|
|
4278
4122
|
customColumnDialog.value = e.target.checked.toString();
|
|
4279
4123
|
const changed = customColumnDialog.value !== customColumnDialog.initValue;
|
|
4280
4124
|
if (changed === !this.state.customColumnDialogValueChanged) {
|
|
4281
4125
|
this.setState({ customColumnDialogValueChanged: changed });
|
|
4282
4126
|
}
|
|
4283
|
-
} }), label: `${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})` })) : (
|
|
4127
|
+
} }), 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
4128
|
const customColumnDialog = this.customColumnDialog;
|
|
4285
4129
|
customColumnDialog.value = e.target.value;
|
|
4286
4130
|
const changed = customColumnDialog.value !== customColumnDialog.initValue;
|
|
@@ -4288,13 +4132,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4288
4132
|
this.setState({ customColumnDialogValueChanged: changed });
|
|
4289
4133
|
}
|
|
4290
4134
|
}, autoFocus: true })))),
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4135
|
+
React.createElement(DialogActions, null,
|
|
4136
|
+
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')),
|
|
4137
|
+
React.createElement(Button, { color: "grey", variant: "contained", onClick: () => this.onColumnsEditCustomDialogClose(), startIcon: React.createElement(IconClose, null) }, this.props.t('ra_Cancel')))));
|
|
4294
4138
|
}
|
|
4295
4139
|
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) {
|
|
4140
|
+
if (obj?._id?.startsWith(`${it.adapter}.`) && it.path.length > 1) {
|
|
4298
4141
|
const p = it.path;
|
|
4299
4142
|
let value;
|
|
4300
4143
|
const anyObj = obj;
|
|
@@ -4341,8 +4184,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4341
4184
|
return null;
|
|
4342
4185
|
}
|
|
4343
4186
|
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) {
|
|
4187
|
+
if (obj?._id?.startsWith(`${it.adapter}.`) && it.path.length > 1) {
|
|
4346
4188
|
const p = it.path;
|
|
4347
4189
|
const anyObj = obj;
|
|
4348
4190
|
if (anyObj[p[0]] && typeof anyObj[p[0]] === 'object') {
|
|
@@ -4398,15 +4240,22 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4398
4240
|
* Renders a custom value.
|
|
4399
4241
|
*/
|
|
4400
4242
|
renderCustomValue(obj, it, item) {
|
|
4401
|
-
const text =
|
|
4243
|
+
const text = ObjectBrowserClass.getCustomValue(obj, it);
|
|
4402
4244
|
if (text !== null && text !== undefined) {
|
|
4403
4245
|
if (it.edit && !this.props.notEditable && (!it.objTypes || it.objTypes.includes(obj.type))) {
|
|
4404
|
-
return (
|
|
4246
|
+
return (React.createElement(Box, { component: "div", style: {
|
|
4247
|
+
...styles.columnCustom,
|
|
4248
|
+
...styles.columnCustomEditable,
|
|
4249
|
+
...styles[`columnCustom_${it.align}`],
|
|
4250
|
+
}, onClick: () => this.setState({
|
|
4405
4251
|
columnsEditCustomDialog: { item, it, obj },
|
|
4406
4252
|
customColumnDialogValueChanged: false,
|
|
4407
4253
|
}) }, text));
|
|
4408
4254
|
}
|
|
4409
|
-
return (
|
|
4255
|
+
return (React.createElement(Box, { component: "div", style: {
|
|
4256
|
+
...styles.columnCustom,
|
|
4257
|
+
...styles[`columnCustom_${it.align}`],
|
|
4258
|
+
} }, text));
|
|
4410
4259
|
}
|
|
4411
4260
|
return null;
|
|
4412
4261
|
}
|
|
@@ -4415,7 +4264,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4415
4264
|
// read the type of operation
|
|
4416
4265
|
const aliasObj = this.objects[this.info.aliasesMap[id][_index]].common.alias.id;
|
|
4417
4266
|
if (aliasObj) {
|
|
4418
|
-
return (
|
|
4267
|
+
return (React.createElement(Box, { component: "div", onClick: e => {
|
|
4419
4268
|
e.stopPropagation();
|
|
4420
4269
|
e.preventDefault();
|
|
4421
4270
|
const aliasId = this.info.aliasesMap[id][_index];
|
|
@@ -4426,7 +4275,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4426
4275
|
this.onSelect(aliasId);
|
|
4427
4276
|
setTimeout(() => this.expandAllSelected(() => this.scrollToItem(aliasId)), 100);
|
|
4428
4277
|
}, sx: customStyle || this.styles.aliasAlone },
|
|
4429
|
-
|
|
4278
|
+
React.createElement("span", { className: "admin-browser-arrow" }, typeof aliasObj === 'string' || (aliasObj.read === id && aliasObj.write === id)
|
|
4430
4279
|
? '↔'
|
|
4431
4280
|
: aliasObj.read === id
|
|
4432
4281
|
? '→'
|
|
@@ -4439,43 +4288,42 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4439
4288
|
* Renders a leaf.
|
|
4440
4289
|
*/
|
|
4441
4290
|
renderLeaf(item, isExpanded, counter) {
|
|
4442
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
4443
4291
|
const id = item.data.id;
|
|
4444
4292
|
counter.count++;
|
|
4445
4293
|
isExpanded = isExpanded === undefined ? this.state.expanded.includes(id) : isExpanded;
|
|
4446
4294
|
// icon
|
|
4447
4295
|
let iconFolder;
|
|
4448
4296
|
const obj = item.data.obj;
|
|
4449
|
-
const itemType = obj
|
|
4297
|
+
const itemType = obj?.type;
|
|
4450
4298
|
if (item.children ||
|
|
4451
4299
|
itemType === 'folder' ||
|
|
4452
4300
|
itemType === 'device' ||
|
|
4453
4301
|
itemType === 'channel' ||
|
|
4454
4302
|
itemType === 'meta') {
|
|
4455
|
-
iconFolder = isExpanded ? (
|
|
4303
|
+
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
4304
|
}
|
|
4457
4305
|
else if (obj && obj.common && obj.common.write === false && obj.type === 'state') {
|
|
4458
|
-
iconFolder =
|
|
4306
|
+
iconFolder = React.createElement(IconDocumentReadOnly, { style: this.styles.cellIdIconDocument });
|
|
4459
4307
|
}
|
|
4460
4308
|
else {
|
|
4461
|
-
iconFolder =
|
|
4309
|
+
iconFolder = React.createElement(IconDocument, { style: this.styles.cellIdIconDocument });
|
|
4462
4310
|
}
|
|
4463
4311
|
let iconItem = null;
|
|
4464
4312
|
if (item.data.icon) {
|
|
4465
4313
|
if (typeof item.data.icon === 'string') {
|
|
4466
4314
|
if (item.data.icon.length < 3) {
|
|
4467
|
-
iconItem = (
|
|
4315
|
+
iconItem = (React.createElement("span", { className: "iconOwn", style: styles.cellIdIconOwn }, item.data.icon)); // utf-8 char
|
|
4468
4316
|
}
|
|
4469
4317
|
else {
|
|
4470
|
-
iconItem = (
|
|
4318
|
+
iconItem = (React.createElement(Icon, { style: styles.cellIdIconOwn, className: "iconOwn", src: item.data.icon, alt: "" }));
|
|
4471
4319
|
}
|
|
4472
4320
|
}
|
|
4473
4321
|
else {
|
|
4474
4322
|
iconItem = item.data.icon;
|
|
4475
4323
|
}
|
|
4476
4324
|
}
|
|
4477
|
-
const common = obj
|
|
4478
|
-
const typeImg = (
|
|
4325
|
+
const common = obj?.common;
|
|
4326
|
+
const typeImg = (obj?.type && ITEM_IMAGES[obj.type]) || React.createElement("div", { className: "itemIcon" });
|
|
4479
4327
|
const paddingLeft = this.levelPadding * (item.data.level || 0);
|
|
4480
4328
|
// recalculate rooms and function names if the language changed
|
|
4481
4329
|
if (item.data.lang !== this.props.lang) {
|
|
@@ -4489,11 +4337,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4489
4337
|
}
|
|
4490
4338
|
const checkbox = this.props.multiSelect &&
|
|
4491
4339
|
this.objects[id] &&
|
|
4492
|
-
(!this.props.types || this.props.types.includes(this.objects[id].type)) ? (
|
|
4340
|
+
(!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
4341
|
let valueEditable = !this.props.notEditable &&
|
|
4494
4342
|
itemType === 'state' &&
|
|
4495
|
-
(this.state.filter.expertMode ||
|
|
4496
|
-
if (this.props.objectBrowserViewFile &&
|
|
4343
|
+
(this.state.filter.expertMode || common?.write !== false);
|
|
4344
|
+
if (this.props.objectBrowserViewFile && common?.type === 'file') {
|
|
4497
4345
|
valueEditable = true;
|
|
4498
4346
|
}
|
|
4499
4347
|
const enumEditable = !this.props.notEditable &&
|
|
@@ -4503,7 +4351,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4503
4351
|
let newValue = '';
|
|
4504
4352
|
const newValueTitle = [];
|
|
4505
4353
|
if (checkVisibleObjectType) {
|
|
4506
|
-
newValue =
|
|
4354
|
+
newValue = this.states[id]?.from;
|
|
4507
4355
|
if (newValue === undefined) {
|
|
4508
4356
|
newValue = ' ';
|
|
4509
4357
|
}
|
|
@@ -4511,7 +4359,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4511
4359
|
newValue = newValue ? newValue.replace(/^system\.adapter\.|^system\./, '') : '';
|
|
4512
4360
|
newValueTitle.push(`${this.texts.stateChangedFrom} ${newValue}`);
|
|
4513
4361
|
}
|
|
4514
|
-
if (obj
|
|
4362
|
+
if (obj?.user) {
|
|
4515
4363
|
const user = obj.user.replace('system.user.', '');
|
|
4516
4364
|
newValue += `/${user}`;
|
|
4517
4365
|
newValueTitle.push(`${this.texts.stateChangedBy} ${user}`);
|
|
@@ -4525,16 +4373,16 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4525
4373
|
newValueTitle.push(`${this.texts.objectChangedBy} ${obj.user.replace(/^system\.user\./, '')}`);
|
|
4526
4374
|
}
|
|
4527
4375
|
if (obj.ts) {
|
|
4528
|
-
newValueTitle.push(`${this.texts.objectChangedByUser} ${
|
|
4376
|
+
newValueTitle.push(`${this.texts.objectChangedByUser} ${Utils.formatDate(new Date(obj.ts), this.props.dateFormat || this.systemConfig.common.dateFormat)}`);
|
|
4529
4377
|
}
|
|
4530
4378
|
}
|
|
4531
4379
|
let readWriteAlias = false;
|
|
4532
4380
|
let alias = null;
|
|
4533
|
-
if (id.startsWith('alias.') &&
|
|
4381
|
+
if (id.startsWith('alias.') && common?.alias?.id) {
|
|
4534
4382
|
readWriteAlias = typeof common.alias.id === 'object';
|
|
4535
4383
|
if (readWriteAlias) {
|
|
4536
|
-
alias = (
|
|
4537
|
-
common.alias.id.read ? (
|
|
4384
|
+
alias = (React.createElement("div", { style: styles.cellIdAliasReadWriteDiv },
|
|
4385
|
+
common.alias.id.read ? (React.createElement(Box, { component: "div", onClick: e => {
|
|
4538
4386
|
e.stopPropagation();
|
|
4539
4387
|
e.preventDefault();
|
|
4540
4388
|
this.onSelect(common.alias.id.read);
|
|
@@ -4542,7 +4390,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4542
4390
|
}, sx: this.styles.aliasReadWrite },
|
|
4543
4391
|
"\u2190",
|
|
4544
4392
|
common.alias.id.read)) : null,
|
|
4545
|
-
common.alias.id.write ? (
|
|
4393
|
+
common.alias.id.write ? (React.createElement(Box, { component: "div", onClick: e => {
|
|
4546
4394
|
e.stopPropagation();
|
|
4547
4395
|
e.preventDefault();
|
|
4548
4396
|
this.onSelect(common.alias.id.write);
|
|
@@ -4552,7 +4400,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4552
4400
|
common.alias.id.write)) : null));
|
|
4553
4401
|
}
|
|
4554
4402
|
else {
|
|
4555
|
-
alias = (
|
|
4403
|
+
alias = (React.createElement(Box, { component: "div", onClick: e => {
|
|
4556
4404
|
e.stopPropagation();
|
|
4557
4405
|
e.preventDefault();
|
|
4558
4406
|
this.onSelect(common.alias.id);
|
|
@@ -4566,7 +4414,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4566
4414
|
// Some alias points to this object. It can be more than one
|
|
4567
4415
|
if (this.info.aliasesMap[id].length > 1) {
|
|
4568
4416
|
// Show number of aliases and open a menu by click
|
|
4569
|
-
alias = (
|
|
4417
|
+
alias = (React.createElement(Box, { component: "div", id: `alias_${id}`, onClick: e => {
|
|
4570
4418
|
e.stopPropagation();
|
|
4571
4419
|
e.preventDefault();
|
|
4572
4420
|
this.setState({ aliasMenu: id });
|
|
@@ -4577,11 +4425,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4577
4425
|
alias = this.renderAliasLink(id, 0);
|
|
4578
4426
|
}
|
|
4579
4427
|
}
|
|
4580
|
-
let checkColor = common
|
|
4428
|
+
let checkColor = common?.color;
|
|
4581
4429
|
let invertBackground;
|
|
4582
4430
|
if (checkColor && !this.state.selected.includes(id)) {
|
|
4583
4431
|
const background = this.props.themeName === 'dark' ? '#1f1f1f' : this.props.themeName === 'blue' ? '#222a2e' : '#FFFFFF';
|
|
4584
|
-
const distance =
|
|
4432
|
+
const distance = Utils.colorDistance(checkColor, background);
|
|
4585
4433
|
// console.log(`Distance: ${checkColor} - ${background} = ${distance}`);
|
|
4586
4434
|
if (distance < 1000) {
|
|
4587
4435
|
invertBackground = this.props.themeType === 'dark' ? '#9a9a9a' : '#565656';
|
|
@@ -4611,17 +4459,16 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4611
4459
|
checkColor = 'inherit';
|
|
4612
4460
|
}
|
|
4613
4461
|
const icons = [];
|
|
4614
|
-
if (common
|
|
4462
|
+
if (common?.statusStates) {
|
|
4615
4463
|
const ids = {};
|
|
4616
4464
|
Object.keys(common.statusStates).forEach(name => {
|
|
4617
|
-
var _b;
|
|
4618
4465
|
let _id = common.statusStates[name];
|
|
4619
4466
|
if (_id.split('.').length < 3) {
|
|
4620
4467
|
_id = `${id}.${_id}`;
|
|
4621
4468
|
}
|
|
4622
4469
|
ids[name] = _id;
|
|
4623
4470
|
if (!this.states[_id]) {
|
|
4624
|
-
if (
|
|
4471
|
+
if (this.objects[_id]?.type === 'state') {
|
|
4625
4472
|
if (!this.recordStates.includes(_id)) {
|
|
4626
4473
|
this.recordStates.push(_id);
|
|
4627
4474
|
}
|
|
@@ -4639,7 +4486,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4639
4486
|
if (common.statusStates.errorId && this.states[ids.errorId] && this.states[ids.errorId].val) {
|
|
4640
4487
|
checkColor = this.props.themeType === 'dark' ? COLOR_NAME_ERROR_DARK : COLOR_NAME_ERROR_LIGHT;
|
|
4641
4488
|
colorSet = true;
|
|
4642
|
-
icons.push(
|
|
4489
|
+
icons.push(React.createElement(IconError, { key: "error",
|
|
4643
4490
|
// title={this.texts.deviceError}
|
|
4644
4491
|
style: this.styles.iconDeviceError }));
|
|
4645
4492
|
}
|
|
@@ -4648,7 +4495,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4648
4495
|
if (this.states[ids.onlineId].val) {
|
|
4649
4496
|
checkColor =
|
|
4650
4497
|
this.props.themeType === 'dark' ? COLOR_NAME_CONNECTED_DARK : COLOR_NAME_CONNECTED_LIGHT;
|
|
4651
|
-
icons.push(
|
|
4498
|
+
icons.push(React.createElement(IconConnection, { key: "conn",
|
|
4652
4499
|
// title={this.texts.deviceError}
|
|
4653
4500
|
style: this.styles.iconDeviceConnected }));
|
|
4654
4501
|
}
|
|
@@ -4657,18 +4504,18 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4657
4504
|
this.props.themeType === 'dark'
|
|
4658
4505
|
? COLOR_NAME_DISCONNECTED_DARK
|
|
4659
4506
|
: COLOR_NAME_DISCONNECTED_LIGHT;
|
|
4660
|
-
icons.push(
|
|
4507
|
+
icons.push(React.createElement(IconDisconnected, { key: "disc",
|
|
4661
4508
|
// title={this.texts.deviceError}
|
|
4662
4509
|
style: this.styles.iconDeviceDisconnected }));
|
|
4663
4510
|
}
|
|
4664
4511
|
}
|
|
4665
4512
|
else if (this.states[ids.onlineId].val) {
|
|
4666
|
-
icons.push(
|
|
4513
|
+
icons.push(React.createElement(IconConnection, { key: "conn",
|
|
4667
4514
|
// title={this.texts.deviceError}
|
|
4668
4515
|
style: this.styles.iconDeviceConnected }));
|
|
4669
4516
|
}
|
|
4670
4517
|
else {
|
|
4671
|
-
icons.push(
|
|
4518
|
+
icons.push(React.createElement(IconDisconnected, { key: "disc",
|
|
4672
4519
|
// title={this.texts.deviceError}
|
|
4673
4520
|
style: this.styles.iconDeviceDisconnected }));
|
|
4674
4521
|
}
|
|
@@ -4680,85 +4527,102 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4680
4527
|
this.props.themeType === 'dark'
|
|
4681
4528
|
? COLOR_NAME_DISCONNECTED_DARK
|
|
4682
4529
|
: COLOR_NAME_DISCONNECTED_LIGHT;
|
|
4683
|
-
icons.push(
|
|
4530
|
+
icons.push(React.createElement(IconDisconnected, { key: "disc",
|
|
4684
4531
|
// title={this.texts.deviceError}
|
|
4685
4532
|
style: this.styles.iconDeviceDisconnected }));
|
|
4686
4533
|
}
|
|
4687
4534
|
else {
|
|
4688
4535
|
checkColor =
|
|
4689
4536
|
this.props.themeType === 'dark' ? COLOR_NAME_CONNECTED_DARK : COLOR_NAME_CONNECTED_LIGHT;
|
|
4690
|
-
icons.push(
|
|
4537
|
+
icons.push(React.createElement(IconConnection, { key: "conn",
|
|
4691
4538
|
// title={this.texts.deviceError}
|
|
4692
4539
|
style: this.styles.iconDeviceConnected }));
|
|
4693
4540
|
}
|
|
4694
4541
|
}
|
|
4695
4542
|
else if (this.states[ids.offlineId].val) {
|
|
4696
|
-
icons.push(
|
|
4543
|
+
icons.push(React.createElement(IconDisconnected, { key: "disc",
|
|
4697
4544
|
// title={this.texts.deviceError}
|
|
4698
4545
|
style: this.styles.iconDeviceDisconnected }));
|
|
4699
4546
|
}
|
|
4700
4547
|
else {
|
|
4701
|
-
icons.push(
|
|
4548
|
+
icons.push(React.createElement(IconConnection, { key: "conn",
|
|
4702
4549
|
// title={this.texts.deviceError}
|
|
4703
4550
|
style: this.styles.iconDeviceConnected }));
|
|
4704
4551
|
}
|
|
4705
4552
|
}
|
|
4706
4553
|
}
|
|
4707
|
-
const q = checkVisibleObjectType ?
|
|
4708
|
-
let name =
|
|
4554
|
+
const q = checkVisibleObjectType ? Utils.quality2text(this.states[id]?.q || 0).join(', ') : null;
|
|
4555
|
+
let name = item.data?.title || '';
|
|
4709
4556
|
let useDesc = false;
|
|
4710
4557
|
if (this.state.showDescription) {
|
|
4711
4558
|
const oTooltip = getObjectTooltip(item.data, this.props.lang);
|
|
4712
4559
|
if (oTooltip) {
|
|
4713
4560
|
name = [
|
|
4714
|
-
|
|
4715
|
-
|
|
4561
|
+
React.createElement("div", { key: "name", style: styles.cellNameDivDiv }, name),
|
|
4562
|
+
React.createElement("div", { key: "desc", style: styles.cellDescription }, oTooltip),
|
|
4716
4563
|
];
|
|
4717
4564
|
useDesc = !!oTooltip;
|
|
4718
4565
|
}
|
|
4719
4566
|
}
|
|
4720
4567
|
const narrowStyleWithDetails = this.props.width === 'xs' && this.state.focused === id;
|
|
4721
|
-
const colID = (
|
|
4722
|
-
|
|
4568
|
+
const colID = (React.createElement(Grid2, { container: true, wrap: "nowrap", direction: "row", sx: styles.cellId, style: { width: this.columnsVisibility.id, paddingLeft } },
|
|
4569
|
+
React.createElement(Grid2, { container: true, alignItems: "center" },
|
|
4723
4570
|
checkbox,
|
|
4724
4571
|
iconFolder),
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4572
|
+
React.createElement(Grid2, { style: {
|
|
4573
|
+
...styles.cellIdSpan,
|
|
4574
|
+
...(invertBackground ? this.styles.invertedBackground : undefined),
|
|
4575
|
+
color: checkColor,
|
|
4576
|
+
fontWeight: bold ? 'bold' : undefined,
|
|
4577
|
+
} },
|
|
4578
|
+
React.createElement(Tooltip, { title: getIdFieldTooltip(item.data, this.props.lang), slotProps: { popper: { sx: styles.tooltip } } },
|
|
4579
|
+
React.createElement("div", null, item.data.name)),
|
|
4728
4580
|
alias,
|
|
4729
4581
|
icons),
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
this.props.width !== 'xs' ? (
|
|
4733
|
-
|
|
4734
|
-
let colName = (narrowStyleWithDetails && name) || this.columnsVisibility.name ? (
|
|
4582
|
+
React.createElement("div", { style: { ...styles.grow, ...(invertBackground ? this.styles.invertedBackgroundFlex : {}) } }),
|
|
4583
|
+
React.createElement(Grid2, { container: true, alignItems: "center" }, iconItem),
|
|
4584
|
+
this.props.width !== 'xs' ? (React.createElement("div", null,
|
|
4585
|
+
React.createElement(IconCopy, { className: narrowStyleWithDetails ? '' : 'copyButton', style: styles.cellCopyButton, onClick: e => this.onCopy(e, id) }))) : null));
|
|
4586
|
+
let colName = (narrowStyleWithDetails && name) || this.columnsVisibility.name ? (React.createElement(Box, { component: "div", sx: {
|
|
4587
|
+
...styles.cellName,
|
|
4588
|
+
...(useDesc ? styles.cellNameWithDesc : undefined),
|
|
4589
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.name : undefined,
|
|
4590
|
+
ml: narrowStyleWithDetails ? 0 : '5px',
|
|
4591
|
+
} },
|
|
4735
4592
|
name,
|
|
4736
|
-
!narrowStyleWithDetails &&
|
|
4737
|
-
|
|
4593
|
+
!narrowStyleWithDetails && item.data?.title ? (React.createElement(Box, { style: { color: checkColor } },
|
|
4594
|
+
React.createElement(IconCopy, { className: "copyButton", style: styles.cellCopyButton, onClick: e => this.onCopy(e, item.data?.title) }))) : null)) : null;
|
|
4738
4595
|
let colMiddle;
|
|
4739
4596
|
if (!this.state.statesView) {
|
|
4740
4597
|
colMiddle = [
|
|
4741
|
-
(narrowStyleWithDetails &&
|
|
4598
|
+
(narrowStyleWithDetails && obj?.type) || this.columnsVisibility.type
|
|
4742
4599
|
? {
|
|
4743
|
-
el: (
|
|
4600
|
+
el: (React.createElement("div", { key: "type", style: {
|
|
4601
|
+
...styles.cellType,
|
|
4602
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.type : undefined,
|
|
4603
|
+
} },
|
|
4744
4604
|
typeImg,
|
|
4745
|
-
"\u00A0",
|
|
4746
|
-
obj
|
|
4605
|
+
"\u00A0",
|
|
4606
|
+
obj?.type)),
|
|
4747
4607
|
type: 'filter_type',
|
|
4748
4608
|
}
|
|
4749
4609
|
: null,
|
|
4750
4610
|
(narrowStyleWithDetails && common) || this.columnsVisibility.role
|
|
4751
4611
|
? {
|
|
4752
|
-
el: (
|
|
4612
|
+
el: (React.createElement("div", { key: "role", style: {
|
|
4613
|
+
...styles.cellRole,
|
|
4614
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.role : '100%',
|
|
4615
|
+
cursor: this.state.filter.expertMode &&
|
|
4753
4616
|
enumEditable &&
|
|
4754
4617
|
this.props.objectBrowserEditRole
|
|
4755
4618
|
? 'text'
|
|
4756
|
-
: 'default'
|
|
4619
|
+
: 'default',
|
|
4620
|
+
}, onClick: !narrowStyleWithDetails &&
|
|
4757
4621
|
this.state.filter.expertMode &&
|
|
4758
4622
|
enumEditable &&
|
|
4759
4623
|
this.props.objectBrowserEditRole
|
|
4760
4624
|
? () => this.setState({ roleDialog: item.data.id })
|
|
4761
|
-
: undefined }, common
|
|
4625
|
+
: undefined }, common?.role)),
|
|
4762
4626
|
type: 'filter_role',
|
|
4763
4627
|
onClick: narrowStyleWithDetails &&
|
|
4764
4628
|
this.state.filter.expertMode &&
|
|
@@ -4770,7 +4634,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4770
4634
|
: null,
|
|
4771
4635
|
(narrowStyleWithDetails && common) || this.columnsVisibility.room
|
|
4772
4636
|
? {
|
|
4773
|
-
el: (
|
|
4637
|
+
el: (React.createElement("div", { key: "room", style: {
|
|
4638
|
+
...styles.cellRoom,
|
|
4639
|
+
...(item.data.per ? styles.cellEnumParent : {}),
|
|
4640
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.room : '100%',
|
|
4641
|
+
cursor: enumEditable ? 'text' : 'default',
|
|
4642
|
+
}, onClick: !narrowStyleWithDetails && enumEditable
|
|
4774
4643
|
? () => {
|
|
4775
4644
|
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'roomEnums');
|
|
4776
4645
|
this.setState({
|
|
@@ -4801,7 +4670,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4801
4670
|
: null,
|
|
4802
4671
|
(narrowStyleWithDetails && common) || this.columnsVisibility.func
|
|
4803
4672
|
? {
|
|
4804
|
-
el: (
|
|
4673
|
+
el: (React.createElement("div", { key: "func", style: {
|
|
4674
|
+
...styles.cellFunc,
|
|
4675
|
+
...(item.data.pef ? styles.cellEnumParent : {}),
|
|
4676
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.func : '100%',
|
|
4677
|
+
cursor: enumEditable ? 'text' : 'default',
|
|
4678
|
+
}, onClick: !narrowStyleWithDetails && enumEditable
|
|
4805
4679
|
? () => {
|
|
4806
4680
|
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'funcEnums');
|
|
4807
4681
|
this.setState({
|
|
@@ -4834,57 +4708,76 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4834
4708
|
}
|
|
4835
4709
|
else {
|
|
4836
4710
|
colMiddle = [
|
|
4837
|
-
(narrowStyleWithDetails && checkVisibleObjectType &&
|
|
4711
|
+
(narrowStyleWithDetails && checkVisibleObjectType && this.states[id]?.from) ||
|
|
4838
4712
|
this.columnsVisibility.changedFrom
|
|
4839
4713
|
? {
|
|
4840
|
-
el: (
|
|
4714
|
+
el: (React.createElement("div", { key: "from", style: {
|
|
4715
|
+
...styles.cellRole,
|
|
4716
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.changedFrom : undefined,
|
|
4717
|
+
}, title: newValueTitle.join('\n') }, checkVisibleObjectType && this.states[id]?.from ? newValue : null)),
|
|
4841
4718
|
type: 'from',
|
|
4842
4719
|
}
|
|
4843
4720
|
: null,
|
|
4844
4721
|
(narrowStyleWithDetails && q) || this.columnsVisibility.qualityCode
|
|
4845
4722
|
? {
|
|
4846
|
-
el: (
|
|
4723
|
+
el: (React.createElement("div", { key: "q", style: {
|
|
4724
|
+
...styles.cellRole,
|
|
4725
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.qualityCode : undefined,
|
|
4726
|
+
}, title: q || '' }, q)),
|
|
4847
4727
|
type: 'quality',
|
|
4848
4728
|
}
|
|
4849
4729
|
: null,
|
|
4850
|
-
(narrowStyleWithDetails && checkVisibleObjectType &&
|
|
4730
|
+
(narrowStyleWithDetails && checkVisibleObjectType && this.states[id]?.ts) ||
|
|
4851
4731
|
this.columnsVisibility.timestamp
|
|
4852
4732
|
? {
|
|
4853
|
-
el: (
|
|
4854
|
-
|
|
4733
|
+
el: (React.createElement("div", { key: "ts", style: {
|
|
4734
|
+
...styles.cellRole,
|
|
4735
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.timestamp : undefined,
|
|
4736
|
+
} }, checkVisibleObjectType && this.states[id]?.ts
|
|
4737
|
+
? Utils.formatDate(new Date(this.states[id].ts), this.props.dateFormat || this.systemConfig.common.dateFormat)
|
|
4855
4738
|
: null)),
|
|
4856
4739
|
type: 'ts',
|
|
4857
4740
|
}
|
|
4858
4741
|
: null,
|
|
4859
|
-
(narrowStyleWithDetails && checkVisibleObjectType &&
|
|
4742
|
+
(narrowStyleWithDetails && checkVisibleObjectType && this.states[id]?.lc) ||
|
|
4860
4743
|
this.columnsVisibility.lastChange
|
|
4861
4744
|
? {
|
|
4862
|
-
el: (
|
|
4863
|
-
|
|
4745
|
+
el: (React.createElement("div", { key: "lc", style: {
|
|
4746
|
+
...styles.cellRole,
|
|
4747
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.lastChange : undefined,
|
|
4748
|
+
} }, checkVisibleObjectType && this.states[id]?.lc
|
|
4749
|
+
? Utils.formatDate(new Date(this.states[id].lc), this.props.dateFormat || this.systemConfig.common.dateFormat)
|
|
4864
4750
|
: null)),
|
|
4865
4751
|
type: 'lc',
|
|
4866
4752
|
}
|
|
4867
4753
|
: null,
|
|
4868
4754
|
];
|
|
4869
4755
|
}
|
|
4870
|
-
let colCustom =
|
|
4756
|
+
let colCustom = this.adapterColumns?.map(it => (React.createElement("div", { style: {
|
|
4757
|
+
...styles.cellAdapter,
|
|
4758
|
+
width: this.props.width !== 'xs'
|
|
4871
4759
|
? this.columnsVisibility[it.id]
|
|
4872
|
-
: undefined
|
|
4760
|
+
: undefined,
|
|
4761
|
+
}, key: it.id, title: `${it.adapter} => ${it.pathText}` }, obj ? this.renderCustomValue(obj, it, item) : null))) || null;
|
|
4873
4762
|
const columnValue = narrowStyleWithDetails || this.columnsVisibility.val
|
|
4874
4763
|
? this.renderColumnValue(id, item, narrowStyleWithDetails)
|
|
4875
4764
|
: null;
|
|
4876
|
-
let colValue = (narrowStyleWithDetails && columnValue) || this.columnsVisibility.val ? (
|
|
4877
|
-
|
|
4765
|
+
let colValue = (narrowStyleWithDetails && columnValue) || this.columnsVisibility.val ? (React.createElement("div", { style: {
|
|
4766
|
+
...styles.cellValue,
|
|
4767
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.val : 'calc(100% - 100px)',
|
|
4768
|
+
cursor: valueEditable
|
|
4769
|
+
? common?.type === 'file'
|
|
4878
4770
|
? 'zoom-in'
|
|
4879
4771
|
: item.data.button
|
|
4880
4772
|
? 'grab'
|
|
4881
4773
|
: 'text'
|
|
4882
|
-
: 'default'
|
|
4774
|
+
: 'default',
|
|
4775
|
+
}, onClick: valueEditable
|
|
4883
4776
|
? () => {
|
|
4884
4777
|
if (!obj || !this.states) {
|
|
4885
4778
|
// return;
|
|
4886
4779
|
}
|
|
4887
|
-
else if (
|
|
4780
|
+
else if (common?.type === 'file') {
|
|
4888
4781
|
this.setState({ viewFileDialog: id });
|
|
4889
4782
|
}
|
|
4890
4783
|
else if (!this.state.filter.expertMode && item.data.button) {
|
|
@@ -4910,7 +4803,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4910
4803
|
}
|
|
4911
4804
|
}
|
|
4912
4805
|
: undefined }, columnValue)) : null;
|
|
4913
|
-
let colButtons = narrowStyleWithDetails || this.columnsVisibility.buttons ? (
|
|
4806
|
+
let colButtons = narrowStyleWithDetails || this.columnsVisibility.buttons ? (React.createElement("div", { style: {
|
|
4807
|
+
...styles.cellButtons,
|
|
4808
|
+
width: this.props.width !== 'xs' ? this.columnsVisibility.buttons : undefined,
|
|
4809
|
+
} }, this.renderColumnButtons(id, item))) : null;
|
|
4914
4810
|
let colDetails = null;
|
|
4915
4811
|
if (this.props.width === 'xs' && this.state.focused === id) {
|
|
4916
4812
|
colMiddle = colMiddle.filter(a => a);
|
|
@@ -4923,14 +4819,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4923
4819
|
if (!it) {
|
|
4924
4820
|
return null;
|
|
4925
4821
|
}
|
|
4926
|
-
return (
|
|
4927
|
-
|
|
4822
|
+
return (React.createElement("div", { key: it.type, style: styles.cellDetailsLine },
|
|
4823
|
+
React.createElement("span", { style: styles.cellDetailsName },
|
|
4928
4824
|
this.texts[it.type],
|
|
4929
4825
|
":"),
|
|
4930
4826
|
it.el,
|
|
4931
|
-
|
|
4932
|
-
it.onClick ? (
|
|
4933
|
-
if (it
|
|
4827
|
+
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
4828
|
+
it.onClick ? (React.createElement(IconEdit, { style: styles.cellCopyButtonInDetails, onClick: () => {
|
|
4829
|
+
if (it?.onClick) {
|
|
4934
4830
|
it.onClick();
|
|
4935
4831
|
}
|
|
4936
4832
|
} })) : null));
|
|
@@ -4939,32 +4835,32 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4939
4835
|
if (!colCustom.length) {
|
|
4940
4836
|
colCustom = null;
|
|
4941
4837
|
}
|
|
4942
|
-
colDetails = (
|
|
4838
|
+
colDetails = (React.createElement(Paper, { style: {
|
|
4943
4839
|
width: '100%',
|
|
4944
4840
|
display: 'flex',
|
|
4945
4841
|
flexDirection: 'column',
|
|
4946
4842
|
padding: 10,
|
|
4947
4843
|
backgroundColor: this.props.theme.palette.mode === 'dark' ? '#333' : '#ccc',
|
|
4948
4844
|
} },
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
colName && (
|
|
4953
|
-
|
|
4845
|
+
React.createElement("div", { style: styles.cellDetailsLine },
|
|
4846
|
+
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
4847
|
+
React.createElement(IconCopy, { style: styles.cellCopyButtonInDetails, onClick: e => this.onCopy(e, id) })),
|
|
4848
|
+
colName && (React.createElement("div", { style: styles.cellDetailsLine },
|
|
4849
|
+
React.createElement("span", { style: styles.cellDetailsName },
|
|
4954
4850
|
this.texts.name,
|
|
4955
4851
|
":"),
|
|
4956
4852
|
colName,
|
|
4957
|
-
|
|
4958
|
-
|
|
4853
|
+
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
4854
|
+
item.data?.title ? (React.createElement(IconCopy, { className: "copyButton", style: styles.cellCopyButtonInDetails, onClick: e => this.onCopy(e, item.data?.title) })) : null)),
|
|
4959
4855
|
renderedMiddle,
|
|
4960
|
-
colCustom &&
|
|
4961
|
-
|
|
4962
|
-
|
|
4856
|
+
colCustom && React.createElement("div", { style: styles.cellDetailsLine }, colCustom),
|
|
4857
|
+
this.objects[id]?.type === 'state' && (React.createElement("div", { style: styles.cellDetailsLine },
|
|
4858
|
+
React.createElement("span", { style: styles.cellDetailsName },
|
|
4963
4859
|
this.texts.value,
|
|
4964
4860
|
":"),
|
|
4965
4861
|
colValue,
|
|
4966
|
-
|
|
4967
|
-
|
|
4862
|
+
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
4863
|
+
React.createElement(IconCopy, { className: "copyButton", style: styles.cellCopyButtonInDetails, onClick: e => {
|
|
4968
4864
|
const { valText } = formatValue({
|
|
4969
4865
|
state: this.states[id],
|
|
4970
4866
|
obj: this.objects[id],
|
|
@@ -4976,14 +4872,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4976
4872
|
});
|
|
4977
4873
|
this.onCopy(e, valText.v.toString());
|
|
4978
4874
|
}, key: "cc" }))),
|
|
4979
|
-
colButtons && (
|
|
4875
|
+
colButtons && (React.createElement("div", { style: { ...styles.cellDetailsLine, justifyContent: 'right' } }, colButtons))));
|
|
4980
4876
|
colName = null;
|
|
4981
4877
|
colMiddle = null;
|
|
4982
4878
|
colCustom = null;
|
|
4983
4879
|
colValue = null;
|
|
4984
4880
|
colButtons = null;
|
|
4985
4881
|
}
|
|
4986
|
-
const row = (
|
|
4882
|
+
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
4883
|
!item.data.visible &&
|
|
4988
4884
|
!item.data.hasVisibleChildren &&
|
|
4989
4885
|
styles.filteredParentOut, this.state.selected.includes(id) && styles.itemSelected, this.state.selectedNonObject === id && styles.itemSelected), key: id, id: id, onMouseDown: e => {
|
|
@@ -5015,8 +4911,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5015
4911
|
}
|
|
5016
4912
|
} },
|
|
5017
4913
|
colID,
|
|
5018
|
-
colName,
|
|
5019
|
-
colMiddle
|
|
4914
|
+
colName,
|
|
4915
|
+
colMiddle?.map(it => it?.el),
|
|
5020
4916
|
colCustom,
|
|
5021
4917
|
colValue,
|
|
5022
4918
|
colButtons));
|
|
@@ -5033,11 +4929,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5033
4929
|
const DragWrapper = this.props.DragWrapper;
|
|
5034
4930
|
if (this.props.dragEnabled && DragWrapper) {
|
|
5035
4931
|
if (root.data.sumVisibility) {
|
|
5036
|
-
leaf = (
|
|
4932
|
+
leaf = (React.createElement(DragWrapper, { key: root.data.id, item: root, style: styles.draggable }, result.row));
|
|
5037
4933
|
}
|
|
5038
4934
|
else {
|
|
5039
4935
|
// change cursor
|
|
5040
|
-
leaf = (
|
|
4936
|
+
leaf = (React.createElement("div", { key: root.data.id, style: styles.nonDraggable }, result.row));
|
|
5041
4937
|
}
|
|
5042
4938
|
}
|
|
5043
4939
|
else {
|
|
@@ -5255,11 +5151,106 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5255
5151
|
}
|
|
5256
5152
|
}
|
|
5257
5153
|
}
|
|
5154
|
+
resizerMouseMove = (e) => {
|
|
5155
|
+
if (this.resizerActiveDiv) {
|
|
5156
|
+
let width;
|
|
5157
|
+
let widthNext;
|
|
5158
|
+
if (this.resizeLeft) {
|
|
5159
|
+
width = this.resizerOldWidth - e.clientX + this.resizerPosition;
|
|
5160
|
+
widthNext = this.resizerOldWidthNext + e.clientX - this.resizerPosition;
|
|
5161
|
+
}
|
|
5162
|
+
else {
|
|
5163
|
+
width = this.resizerOldWidth + e.clientX - this.resizerPosition;
|
|
5164
|
+
widthNext = this.resizerOldWidthNext - e.clientX + this.resizerPosition;
|
|
5165
|
+
}
|
|
5166
|
+
if (this.resizerActiveName &&
|
|
5167
|
+
this.resizerNextName &&
|
|
5168
|
+
(!this.resizerMin || width > this.resizerMin) &&
|
|
5169
|
+
(!this.resizerNextMin || widthNext > this.resizerNextMin)) {
|
|
5170
|
+
this.resizerCurrentWidths[this.resizerActiveName] = width;
|
|
5171
|
+
this.resizerCurrentWidths[this.resizerNextName] = widthNext;
|
|
5172
|
+
this.resizerActiveDiv.style.width = `${width}px`;
|
|
5173
|
+
if (this.resizerNextDiv) {
|
|
5174
|
+
this.resizerNextDiv.style.width = `${widthNext}px`;
|
|
5175
|
+
}
|
|
5176
|
+
this.columnsVisibility[this.resizerActiveName] = width;
|
|
5177
|
+
this.columnsVisibility[this.resizerNextName] = widthNext;
|
|
5178
|
+
if (this.resizerNextName === 'nameHeader') {
|
|
5179
|
+
this.columnsVisibility.name = widthNext - this.state.scrollBarWidth;
|
|
5180
|
+
this.resizerCurrentWidths.name = widthNext - this.state.scrollBarWidth;
|
|
5181
|
+
}
|
|
5182
|
+
else if (this.resizerActiveName === 'nameHeader') {
|
|
5183
|
+
this.columnsVisibility.name = width - this.state.scrollBarWidth;
|
|
5184
|
+
this.resizerCurrentWidths.name = width - this.state.scrollBarWidth;
|
|
5185
|
+
}
|
|
5186
|
+
this.customWidth = true;
|
|
5187
|
+
if (this.resizeTimeout) {
|
|
5188
|
+
clearTimeout(this.resizeTimeout);
|
|
5189
|
+
}
|
|
5190
|
+
this.resizeTimeout = setTimeout(() => {
|
|
5191
|
+
this.resizeTimeout = null;
|
|
5192
|
+
this.forceUpdate();
|
|
5193
|
+
}, 200);
|
|
5194
|
+
}
|
|
5195
|
+
}
|
|
5196
|
+
};
|
|
5197
|
+
resizerMouseUp = () => {
|
|
5198
|
+
this.localStorage.setItem(`${this.props.dialogName || 'App'}.table`, JSON.stringify(this.resizerCurrentWidths));
|
|
5199
|
+
this.resizerActiveName = null;
|
|
5200
|
+
this.resizerNextName = null;
|
|
5201
|
+
this.resizerActiveDiv = null;
|
|
5202
|
+
this.resizerNextDiv = null;
|
|
5203
|
+
window.removeEventListener('mousemove', this.resizerMouseMove);
|
|
5204
|
+
window.removeEventListener('mouseup', this.resizerMouseUp);
|
|
5205
|
+
};
|
|
5206
|
+
resizerMouseDown = (e) => {
|
|
5207
|
+
this.storedWidths =
|
|
5208
|
+
this.storedWidths ||
|
|
5209
|
+
JSON.parse(JSON.stringify(SCREEN_WIDTHS[this.props.width || 'lg']));
|
|
5210
|
+
this.resizerCurrentWidths = this.resizerCurrentWidths || {};
|
|
5211
|
+
this.resizerActiveDiv = e.target.parentNode;
|
|
5212
|
+
this.resizerActiveName = this.resizerActiveDiv.dataset.name || null;
|
|
5213
|
+
if (this.resizerActiveName) {
|
|
5214
|
+
let i = 0;
|
|
5215
|
+
if (e.target.dataset.left === 'true') {
|
|
5216
|
+
this.resizeLeft = true;
|
|
5217
|
+
this.resizerNextDiv = this.resizerActiveDiv.previousElementSibling;
|
|
5218
|
+
let handle = this.resizerNextDiv.querySelector('.iob-ob-resize-handler');
|
|
5219
|
+
while (this.resizerNextDiv && !handle && i < 10) {
|
|
5220
|
+
this.resizerNextDiv = this.resizerNextDiv.previousElementSibling;
|
|
5221
|
+
handle = this.resizerNextDiv.querySelector('.iob-ob-resize-handler');
|
|
5222
|
+
i++;
|
|
5223
|
+
}
|
|
5224
|
+
if (handle?.dataset.left !== 'true') {
|
|
5225
|
+
this.resizerNextDiv = this.resizerNextDiv.nextElementSibling;
|
|
5226
|
+
}
|
|
5227
|
+
}
|
|
5228
|
+
else {
|
|
5229
|
+
this.resizeLeft = false;
|
|
5230
|
+
this.resizerNextDiv = this.resizerActiveDiv.nextElementSibling;
|
|
5231
|
+
/* while (this.resizerNextDiv && !this.resizerNextDiv.querySelector('.iob-ob-resize-handler') && i < 10) {
|
|
5232
|
+
this.resizerNextDiv = this.resizerNextDiv.nextElementSibling;
|
|
5233
|
+
i++;
|
|
5234
|
+
} */
|
|
5235
|
+
}
|
|
5236
|
+
this.resizerNextName = this.resizerNextDiv.dataset.name || null;
|
|
5237
|
+
this.resizerMin = parseInt(this.resizerActiveDiv.dataset.min, 10) || 0;
|
|
5238
|
+
this.resizerNextMin = parseInt(this.resizerNextDiv.dataset.min, 10) || 0;
|
|
5239
|
+
this.resizerPosition = e.clientX;
|
|
5240
|
+
this.resizerCurrentWidths[this.resizerActiveName] = this.resizerActiveDiv.offsetWidth;
|
|
5241
|
+
this.resizerOldWidth = this.resizerCurrentWidths[this.resizerActiveName];
|
|
5242
|
+
if (this.resizerNextName) {
|
|
5243
|
+
this.resizerCurrentWidths[this.resizerNextName] = this.resizerNextDiv.offsetWidth;
|
|
5244
|
+
this.resizerOldWidthNext = this.resizerCurrentWidths[this.resizerNextName];
|
|
5245
|
+
}
|
|
5246
|
+
window.addEventListener('mousemove', this.resizerMouseMove);
|
|
5247
|
+
window.addEventListener('mouseup', this.resizerMouseUp);
|
|
5248
|
+
}
|
|
5249
|
+
};
|
|
5258
5250
|
/**
|
|
5259
5251
|
* Handle keyboard events for navigation
|
|
5260
5252
|
*/
|
|
5261
5253
|
navigateKeyPress(event) {
|
|
5262
|
-
var _b, _c;
|
|
5263
5254
|
const selectedId = this.state.selectedNonObject || this.state.selected[0];
|
|
5264
5255
|
if (!selectedId) {
|
|
5265
5256
|
return;
|
|
@@ -5267,7 +5258,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5267
5258
|
if (event.code === 'ArrowUp' || event.code === 'ArrowDown') {
|
|
5268
5259
|
event.preventDefault();
|
|
5269
5260
|
const ids = [];
|
|
5270
|
-
|
|
5261
|
+
this.tableRef.current?.childNodes.forEach((node) => ids.push(node.id));
|
|
5271
5262
|
const idx = ids.indexOf(selectedId);
|
|
5272
5263
|
const newIdx = event.code === 'ArrowDown' ? idx + 1 : idx - 1;
|
|
5273
5264
|
const newId = ids[newIdx] || selectedId;
|
|
@@ -5278,10 +5269,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5278
5269
|
this.toggleExpanded(selectedId);
|
|
5279
5270
|
}
|
|
5280
5271
|
if (event.code === 'Delete' && this.root && selectedId) {
|
|
5281
|
-
const item =
|
|
5272
|
+
const item = ObjectBrowserClass.getItemFromRoot(this.root, selectedId);
|
|
5282
5273
|
if (item) {
|
|
5283
5274
|
const { obj } = item.data;
|
|
5284
|
-
if (obj && !
|
|
5275
|
+
if (obj && !obj.common?.dontDelete) {
|
|
5285
5276
|
this.showDeleteDialog({ id: selectedId, obj, item });
|
|
5286
5277
|
}
|
|
5287
5278
|
}
|
|
@@ -5316,67 +5307,119 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5316
5307
|
}
|
|
5317
5308
|
return _root || null;
|
|
5318
5309
|
}
|
|
5310
|
+
resizerReset = () => {
|
|
5311
|
+
this.customWidth = false;
|
|
5312
|
+
SCREEN_WIDTHS[this.props.width || 'lg'] = JSON.parse(JSON.stringify(this.storedWidths));
|
|
5313
|
+
this.calculateColumnsVisibility();
|
|
5314
|
+
this.localStorage.removeItem(`${this.props.dialogName || 'App'}.table`);
|
|
5315
|
+
this.forceUpdate();
|
|
5316
|
+
};
|
|
5319
5317
|
/**
|
|
5320
5318
|
* Render the right handle for resizing
|
|
5321
5319
|
*/
|
|
5322
5320
|
renderHandleRight() {
|
|
5323
|
-
return (
|
|
5321
|
+
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
5322
|
}
|
|
5325
5323
|
renderHeader() {
|
|
5326
5324
|
let filterClearInValue = null;
|
|
5327
5325
|
if (!this.columnsVisibility.buttons && !this.isFilterEmpty()) {
|
|
5328
|
-
filterClearInValue = (
|
|
5329
|
-
|
|
5330
|
-
|
|
5326
|
+
filterClearInValue = (React.createElement(IconButton, { onClick: () => this.clearFilter(), style: styles.buttonClearFilter, title: this.props.t('ra_Clear filter'), size: "large" },
|
|
5327
|
+
React.createElement(IconClearFilter, null),
|
|
5328
|
+
React.createElement(IconClose, { style: styles.buttonClearFilterIcon })));
|
|
5331
5329
|
}
|
|
5332
5330
|
if (this.props.width === 'xs') {
|
|
5333
|
-
return (
|
|
5334
|
-
|
|
5331
|
+
return (React.createElement("div", { style: styles.headerRow },
|
|
5332
|
+
React.createElement("div", { style: { ...styles.headerCell, width: '100%' } }, this.getFilterInput('id'))));
|
|
5335
5333
|
}
|
|
5336
|
-
return (
|
|
5337
|
-
|
|
5334
|
+
return (React.createElement("div", { style: styles.headerRow },
|
|
5335
|
+
React.createElement("div", { style: { ...styles.headerCell, width: this.columnsVisibility.id, position: 'relative' }, "data-min": 240, "data-name": "id" },
|
|
5338
5336
|
this.getFilterInput('id'),
|
|
5339
5337
|
this.renderHandleRight()),
|
|
5340
|
-
this.columnsVisibility.name ? (
|
|
5338
|
+
this.columnsVisibility.name ? (React.createElement("div", { style: { ...styles.headerCell, width: this.columnsVisibility.nameHeader, position: 'relative' }, "data-min": 100, "data-name": "nameHeader" },
|
|
5341
5339
|
this.getFilterInput('name'),
|
|
5342
5340
|
this.renderHandleRight())) : null,
|
|
5343
|
-
!this.state.statesView && (
|
|
5344
|
-
this.columnsVisibility.type ? (
|
|
5341
|
+
!this.state.statesView && (React.createElement(React.Fragment, null,
|
|
5342
|
+
this.columnsVisibility.type ? (React.createElement("div", { style: {
|
|
5343
|
+
...styles.headerCell,
|
|
5344
|
+
width: this.columnsVisibility.type,
|
|
5345
|
+
position: 'relative',
|
|
5346
|
+
}, "data-min": 100, "data-name": "type" },
|
|
5345
5347
|
this.getFilterSelectType(),
|
|
5346
5348
|
this.renderHandleRight())) : null,
|
|
5347
|
-
this.columnsVisibility.role ? (
|
|
5349
|
+
this.columnsVisibility.role ? (React.createElement("div", { style: {
|
|
5350
|
+
...styles.headerCell,
|
|
5351
|
+
width: this.columnsVisibility.role,
|
|
5352
|
+
position: 'relative',
|
|
5353
|
+
}, "data-min": 100, "data-name": "role" },
|
|
5348
5354
|
this.getFilterSelectRole(),
|
|
5349
5355
|
this.renderHandleRight())) : null,
|
|
5350
|
-
this.columnsVisibility.room ? (
|
|
5356
|
+
this.columnsVisibility.room ? (React.createElement("div", { style: {
|
|
5357
|
+
...styles.headerCell,
|
|
5358
|
+
width: this.columnsVisibility.room,
|
|
5359
|
+
position: 'relative',
|
|
5360
|
+
}, "data-min": 100, "data-name": "room" },
|
|
5351
5361
|
this.getFilterSelectRoom(),
|
|
5352
5362
|
this.renderHandleRight())) : null,
|
|
5353
|
-
this.columnsVisibility.func ? (
|
|
5363
|
+
this.columnsVisibility.func ? (React.createElement("div", { style: {
|
|
5364
|
+
...styles.headerCell,
|
|
5365
|
+
width: this.columnsVisibility.func,
|
|
5366
|
+
position: 'relative',
|
|
5367
|
+
}, "data-min": 100, "data-name": "func" },
|
|
5354
5368
|
this.getFilterSelectFunction(),
|
|
5355
5369
|
this.renderHandleRight())) : null)),
|
|
5356
|
-
this.state.statesView && (
|
|
5357
|
-
|
|
5370
|
+
this.state.statesView && (React.createElement(React.Fragment, null,
|
|
5371
|
+
React.createElement("div", { style: {
|
|
5372
|
+
...styles.headerCell,
|
|
5373
|
+
...styles.headerCellValue,
|
|
5374
|
+
width: this.columnsVisibility.changedFrom,
|
|
5375
|
+
position: 'relative',
|
|
5376
|
+
}, "data-min": 100, "data-name": "changedFrom" },
|
|
5358
5377
|
this.props.t('ra_Changed from'),
|
|
5359
5378
|
this.renderHandleRight()),
|
|
5360
|
-
|
|
5379
|
+
React.createElement("div", { style: {
|
|
5380
|
+
...styles.headerCell,
|
|
5381
|
+
...styles.headerCellValue,
|
|
5382
|
+
width: this.columnsVisibility.qualityCode,
|
|
5383
|
+
position: 'relative',
|
|
5384
|
+
}, "data-min": 100, "data-name": "qualityCode" },
|
|
5361
5385
|
this.props.t('ra_Quality code'),
|
|
5362
5386
|
this.renderHandleRight()),
|
|
5363
|
-
|
|
5387
|
+
React.createElement("div", { style: {
|
|
5388
|
+
...styles.headerCell,
|
|
5389
|
+
...styles.headerCellValue,
|
|
5390
|
+
width: this.columnsVisibility.timestamp,
|
|
5391
|
+
position: 'relative',
|
|
5392
|
+
}, "data-min": 100, "data-name": "timestamp" },
|
|
5364
5393
|
this.props.t('ra_Timestamp'),
|
|
5365
5394
|
this.renderHandleRight()),
|
|
5366
|
-
|
|
5395
|
+
React.createElement("div", { style: {
|
|
5396
|
+
...styles.headerCell,
|
|
5397
|
+
...styles.headerCellValue,
|
|
5398
|
+
width: this.columnsVisibility.lastChange,
|
|
5399
|
+
position: 'relative',
|
|
5400
|
+
}, "data-min": 100, "data-name": "lastChange" },
|
|
5367
5401
|
this.props.t('ra_Last change'),
|
|
5368
5402
|
this.renderHandleRight()))),
|
|
5369
|
-
this.adapterColumns.map(item => (
|
|
5370
|
-
|
|
5403
|
+
this.adapterColumns.map(item => (React.createElement("div", { style: {
|
|
5404
|
+
...styles.headerCell,
|
|
5405
|
+
...styles.headerCellValue,
|
|
5406
|
+
width: this.columnsVisibility[item.id],
|
|
5407
|
+
}, title: item.adapter, key: item.id, "data-min": 100, "data-name": item.id }, item.name))),
|
|
5408
|
+
this.columnsVisibility.val ? (React.createElement("div", { style: {
|
|
5409
|
+
...styles.headerCell,
|
|
5410
|
+
...styles.headerCellValue,
|
|
5411
|
+
width: this.columnsVisibility.val,
|
|
5412
|
+
position: 'relative',
|
|
5413
|
+
}, "data-min": 120, "data-name": "val" },
|
|
5371
5414
|
this.props.t('ra_Value'),
|
|
5372
5415
|
filterClearInValue)) : null,
|
|
5373
|
-
this.columnsVisibility.buttons ? (
|
|
5416
|
+
this.columnsVisibility.buttons ? (React.createElement("div", { title: this.texts.filter_custom, style: { ...styles.headerCell, width: this.columnsVisibility.buttons } },
|
|
5374
5417
|
' ',
|
|
5375
5418
|
this.getFilterSelectCustoms())) : null));
|
|
5376
5419
|
}
|
|
5377
5420
|
renderToast() {
|
|
5378
|
-
return (
|
|
5379
|
-
|
|
5421
|
+
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: '' }) },
|
|
5422
|
+
React.createElement(IconClose, { fontSize: "small" })) }));
|
|
5380
5423
|
}
|
|
5381
5424
|
/**
|
|
5382
5425
|
* Called when component is updated.
|
|
@@ -5395,7 +5438,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5395
5438
|
scrollToItem(id) {
|
|
5396
5439
|
this.selectFirst = '';
|
|
5397
5440
|
const node = window.document.getElementById(id);
|
|
5398
|
-
node
|
|
5441
|
+
node?.scrollIntoView({
|
|
5399
5442
|
behavior: 'auto',
|
|
5400
5443
|
block: 'center',
|
|
5401
5444
|
inline: 'center',
|
|
@@ -5404,10 +5447,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5404
5447
|
renderCustomDialog() {
|
|
5405
5448
|
if (this.state.customDialog && this.props.objectCustomDialog) {
|
|
5406
5449
|
const ObjectCustomDialog = this.props.objectCustomDialog;
|
|
5407
|
-
return (
|
|
5450
|
+
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
5451
|
? this.systemConfig.common.isFloatComma
|
|
5409
5452
|
: 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
5453
|
this.pauseSubscribe(false);
|
|
5412
5454
|
this.setState({ customDialog: null });
|
|
5413
5455
|
if (this.changedIds) {
|
|
@@ -5415,7 +5457,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5415
5457
|
// update all changed IDs
|
|
5416
5458
|
this.forceUpdate();
|
|
5417
5459
|
}
|
|
5418
|
-
|
|
5460
|
+
this.props.router?.doNavigate('tab-objects');
|
|
5419
5461
|
}, systemConfig: this.systemConfig }));
|
|
5420
5462
|
}
|
|
5421
5463
|
return null;
|
|
@@ -5435,18 +5477,17 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5435
5477
|
return null;
|
|
5436
5478
|
}
|
|
5437
5479
|
const ObjectBrowserEditObject = this.props.objectBrowserEditObject;
|
|
5438
|
-
return (
|
|
5480
|
+
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
5481
|
? this.systemConfig.common.isFloatComma
|
|
5440
5482
|
: 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
5483
|
.setObject(obj._id, obj)
|
|
5442
5484
|
.then(() => this.setState({ editObjectDialog: obj._id, editObjectAlias: false }, () => this.onSelect(obj._id)))
|
|
5443
5485
|
.catch(e => this.showError(`Cannot write object: ${e}`)), onClose: (obj) => {
|
|
5444
|
-
var _b, _c;
|
|
5445
5486
|
if (obj) {
|
|
5446
5487
|
let updateAlias;
|
|
5447
5488
|
if (this.state.editObjectDialog.startsWith('alias.')) {
|
|
5448
|
-
if (JSON.stringify(
|
|
5449
|
-
JSON.stringify(
|
|
5489
|
+
if (JSON.stringify(this.objects[this.state.editObjectDialog].common?.alias) !==
|
|
5490
|
+
JSON.stringify(obj.common?.alias)) {
|
|
5450
5491
|
updateAlias = this.state.editObjectDialog;
|
|
5451
5492
|
}
|
|
5452
5493
|
}
|
|
@@ -5468,14 +5509,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5468
5509
|
return null;
|
|
5469
5510
|
}
|
|
5470
5511
|
const ObjectBrowserViewFile = this.props.objectBrowserViewFile;
|
|
5471
|
-
return (
|
|
5512
|
+
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
5513
|
}
|
|
5473
5514
|
renderAliasEditorDialog() {
|
|
5474
5515
|
if (!this.props.objectBrowserAliasEditor || !this.state.showAliasEditor) {
|
|
5475
5516
|
return null;
|
|
5476
5517
|
}
|
|
5477
5518
|
const ObjectBrowserAliasEditor = this.props.objectBrowserAliasEditor;
|
|
5478
|
-
return (
|
|
5519
|
+
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
5520
|
this.scrollToItem(id);
|
|
5480
5521
|
setTimeout(() => this.setState({
|
|
5481
5522
|
editObjectDialog: id,
|
|
@@ -5499,8 +5540,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5499
5540
|
if (!this.state.aliasMenu) {
|
|
5500
5541
|
return null;
|
|
5501
5542
|
}
|
|
5502
|
-
return (
|
|
5503
|
-
|
|
5543
|
+
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) },
|
|
5544
|
+
React.createElement(ListItemText, null, this.renderAliasLink(this.state.aliasMenu, i, {
|
|
5504
5545
|
'& .admin-browser-arrow': {
|
|
5505
5546
|
mr: '8px',
|
|
5506
5547
|
},
|
|
@@ -5510,7 +5551,6 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5510
5551
|
* Renders the right mouse button context menu
|
|
5511
5552
|
*/
|
|
5512
5553
|
renderContextMenu() {
|
|
5513
|
-
var _b, _c, _d, _e, _f, _g, _h;
|
|
5514
5554
|
if (!this.state.showContextMenu) {
|
|
5515
5555
|
return null;
|
|
5516
5556
|
}
|
|
@@ -5560,8 +5600,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5560
5600
|
key: '0',
|
|
5561
5601
|
visibility: !!(this.props.objectBrowserEditObject &&
|
|
5562
5602
|
obj &&
|
|
5563
|
-
(this.state.filter.expertMode ||
|
|
5564
|
-
icon: (
|
|
5603
|
+
(this.state.filter.expertMode || ObjectBrowserClass.isNonExpertId(id))),
|
|
5604
|
+
icon: (React.createElement(IconEdit, { fontSize: "small", style: this.styles.contextMenuEdit })),
|
|
5565
5605
|
label: this.texts.editObject,
|
|
5566
5606
|
onClick: () => this.setState({ editObjectDialog: item.data.id, showContextMenu: null, editObjectAlias: false }),
|
|
5567
5607
|
},
|
|
@@ -5572,9 +5612,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5572
5612
|
obj &&
|
|
5573
5613
|
obj.type === 'state' &&
|
|
5574
5614
|
// @ts-expect-error deprecated from js-controller 6
|
|
5575
|
-
|
|
5615
|
+
obj.common?.type !== 'file' &&
|
|
5576
5616
|
(this.state.filter.expertMode || obj.common.write !== false)),
|
|
5577
|
-
icon: (
|
|
5617
|
+
icon: (React.createElement(IconValueEdit, { fontSize: "small", style: this.styles.contextMenuEditValue })),
|
|
5578
5618
|
label: this.props.t('ra_Edit value'),
|
|
5579
5619
|
onClick: () => {
|
|
5580
5620
|
this.edit = {
|
|
@@ -5588,12 +5628,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5588
5628
|
},
|
|
5589
5629
|
VIEW: {
|
|
5590
5630
|
visibility: !!this.props.objectBrowserViewFile &&
|
|
5591
|
-
|
|
5631
|
+
obj?.type === 'state' &&
|
|
5592
5632
|
// @ts-expect-error deprecated from js-controller 6
|
|
5593
|
-
|
|
5594
|
-
icon: (
|
|
5633
|
+
obj.common?.type === 'file',
|
|
5634
|
+
icon: (React.createElement(FindInPage, { fontSize: "small", style: this.styles.contextMenuView })),
|
|
5595
5635
|
label: this.props.t('ra_View file'),
|
|
5596
|
-
onClick: () => this.setState({ viewFileDialog:
|
|
5636
|
+
onClick: () => this.setState({ viewFileDialog: obj?._id || '', showContextMenu: null }),
|
|
5597
5637
|
},
|
|
5598
5638
|
CUSTOM: {
|
|
5599
5639
|
key: '2',
|
|
@@ -5602,16 +5642,15 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5602
5642
|
obj &&
|
|
5603
5643
|
obj.type === 'state' &&
|
|
5604
5644
|
// @ts-expect-error deprecated from js-controller 6
|
|
5605
|
-
|
|
5606
|
-
icon: (
|
|
5645
|
+
obj.common?.type !== 'file'),
|
|
5646
|
+
icon: (React.createElement(IconConfig, { fontSize: "small", style: item.data.hasCustoms
|
|
5607
5647
|
? this.styles.cellButtonsButtonWithCustoms
|
|
5608
5648
|
: styles.cellButtonsButtonWithoutCustoms })),
|
|
5609
5649
|
style: this.styles.contextMenuCustom,
|
|
5610
5650
|
label: this.texts.customConfig,
|
|
5611
5651
|
onClick: () => {
|
|
5612
|
-
var _b;
|
|
5613
5652
|
this.pauseSubscribe(true);
|
|
5614
|
-
|
|
5653
|
+
this.props.router?.doNavigate(null, 'customs', id);
|
|
5615
5654
|
this.setState({ customDialog: [id], showContextMenu: null });
|
|
5616
5655
|
},
|
|
5617
5656
|
},
|
|
@@ -5632,14 +5671,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5632
5671
|
ROLE: {
|
|
5633
5672
|
key: '4',
|
|
5634
5673
|
visibility: !!(this.state.filter.expertMode && enumEditable && this.props.objectBrowserEditRole),
|
|
5635
|
-
icon: (
|
|
5674
|
+
icon: (React.createElement(BorderColor, { fontSize: "small", style: this.styles.contextMenuRole })),
|
|
5636
5675
|
label: this.props.t('ra_Edit role'),
|
|
5637
5676
|
onClick: () => this.setState({ roleDialog: item.data.id, showContextMenu: null }),
|
|
5638
5677
|
},
|
|
5639
5678
|
FUNCTION: {
|
|
5640
5679
|
key: '5',
|
|
5641
5680
|
visibility: !!enumEditable,
|
|
5642
|
-
icon: (
|
|
5681
|
+
icon: (React.createElement(BedroomParent, { fontSize: "small", style: this.styles.contextMenuRole })),
|
|
5643
5682
|
label: this.props.t('ra_Edit function'),
|
|
5644
5683
|
onClick: () => {
|
|
5645
5684
|
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'funcEnums');
|
|
@@ -5657,7 +5696,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5657
5696
|
ROOM: {
|
|
5658
5697
|
key: '6',
|
|
5659
5698
|
visibility: !!enumEditable,
|
|
5660
|
-
icon: (
|
|
5699
|
+
icon: (React.createElement(Construction, { fontSize: "small", style: this.styles.contextMenuRoom })),
|
|
5661
5700
|
label: this.props.t('ra_Edit room'),
|
|
5662
5701
|
onClick: () => {
|
|
5663
5702
|
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'roomEnums');
|
|
@@ -5677,18 +5716,17 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5677
5716
|
visibility: !!(!this.props.notEditable &&
|
|
5678
5717
|
this.props.objectBrowserAliasEditor &&
|
|
5679
5718
|
this.props.objectBrowserEditObject &&
|
|
5680
|
-
|
|
5719
|
+
obj?.type === 'state' &&
|
|
5681
5720
|
// @ts-expect-error deprecated from js-controller 6
|
|
5682
|
-
|
|
5683
|
-
icon: (
|
|
5721
|
+
obj.common?.type !== 'file'),
|
|
5722
|
+
icon: (React.createElement(IconLink, { style: obj?.common?.alias
|
|
5684
5723
|
? this.styles.cellButtonsButtonWithCustoms
|
|
5685
5724
|
: styles.cellButtonsButtonWithoutCustoms })),
|
|
5686
5725
|
label: this.info.aliasesMap[item.data.id]
|
|
5687
5726
|
? this.props.t('ra_Edit alias')
|
|
5688
5727
|
: this.props.t('ra_Create alias'),
|
|
5689
5728
|
onClick: () => {
|
|
5690
|
-
|
|
5691
|
-
if ((_b = obj === null || obj === void 0 ? void 0 : obj.common) === null || _b === void 0 ? void 0 : _b.alias) {
|
|
5729
|
+
if (obj?.common?.alias) {
|
|
5692
5730
|
this.setState({ showContextMenu: null, editObjectDialog: item.data.id, editObjectAlias: true });
|
|
5693
5731
|
}
|
|
5694
5732
|
else {
|
|
@@ -5700,49 +5738,49 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5700
5738
|
key: '+',
|
|
5701
5739
|
visibility: (item.data.id.startsWith('0_userdata.0') || item.data.id.startsWith('javascript.')) &&
|
|
5702
5740
|
(createStateVisible || createChannelVisible || createDeviceVisible || createFolderVisible),
|
|
5703
|
-
icon: (
|
|
5741
|
+
icon: (React.createElement(AddIcon, { fontSize: "small", style: this.styles.cellButtonsButtonWithCustoms })),
|
|
5704
5742
|
style: styles.contextMenuWithSubMenu,
|
|
5705
5743
|
label: this.texts.create,
|
|
5706
5744
|
subMenu: [
|
|
5707
5745
|
{
|
|
5708
5746
|
label: this.texts.createBooleanState,
|
|
5709
5747
|
visibility: createStateVisible,
|
|
5710
|
-
icon:
|
|
5748
|
+
icon: React.createElement(IconState, { fontSize: "small" }),
|
|
5711
5749
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'state', 'boolean'),
|
|
5712
5750
|
},
|
|
5713
5751
|
{
|
|
5714
5752
|
label: this.texts.createNumberState,
|
|
5715
5753
|
visibility: createStateVisible,
|
|
5716
|
-
icon:
|
|
5754
|
+
icon: React.createElement(IconState, { fontSize: "small" }),
|
|
5717
5755
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'state', 'number'),
|
|
5718
5756
|
},
|
|
5719
5757
|
{
|
|
5720
5758
|
label: this.texts.createStringState,
|
|
5721
5759
|
visibility: createStateVisible,
|
|
5722
|
-
icon:
|
|
5760
|
+
icon: React.createElement(IconState, { fontSize: "small" }),
|
|
5723
5761
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'state', 'string'),
|
|
5724
5762
|
},
|
|
5725
5763
|
{
|
|
5726
5764
|
label: this.texts.createState,
|
|
5727
5765
|
visibility: createStateVisible,
|
|
5728
|
-
icon:
|
|
5766
|
+
icon: React.createElement(IconState, { fontSize: "small" }),
|
|
5729
5767
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'state'),
|
|
5730
5768
|
},
|
|
5731
5769
|
{
|
|
5732
5770
|
label: this.texts.createChannel,
|
|
5733
5771
|
visibility: createChannelVisible,
|
|
5734
|
-
icon:
|
|
5772
|
+
icon: React.createElement(IconChannel, { fontSize: "small" }),
|
|
5735
5773
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'channel'),
|
|
5736
5774
|
},
|
|
5737
5775
|
{
|
|
5738
5776
|
label: this.texts.createDevice,
|
|
5739
5777
|
visibility: createDeviceVisible,
|
|
5740
|
-
icon:
|
|
5778
|
+
icon: React.createElement(IconDevice, { fontSize: "small" }),
|
|
5741
5779
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'device'),
|
|
5742
5780
|
},
|
|
5743
5781
|
{
|
|
5744
5782
|
label: this.texts.createFolder,
|
|
5745
|
-
icon:
|
|
5783
|
+
icon: React.createElement(IconFolder, { fontSize: "small" }),
|
|
5746
5784
|
visibility: createFolderVisible,
|
|
5747
5785
|
onClick: () => this.showAddDataPointDialog(item.data.id, 'folder'),
|
|
5748
5786
|
},
|
|
@@ -5751,8 +5789,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5751
5789
|
DELETE: {
|
|
5752
5790
|
key: 'Delete',
|
|
5753
5791
|
visibility: !!(this.props.onObjectDelete &&
|
|
5754
|
-
(
|
|
5755
|
-
icon: (
|
|
5792
|
+
(item.children?.length || (obj && !obj.common?.dontDelete))),
|
|
5793
|
+
icon: (React.createElement(IconDelete, { fontSize: "small", style: this.styles.contextMenuDelete })),
|
|
5756
5794
|
style: this.styles.contextMenuDelete,
|
|
5757
5795
|
label: this.texts.deleteObject,
|
|
5758
5796
|
onClick: () => this.setState({ showContextMenu: null }, () => this.showDeleteDialog({
|
|
@@ -5763,10 +5801,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5763
5801
|
},
|
|
5764
5802
|
};
|
|
5765
5803
|
Object.keys(ITEMS).forEach(key => {
|
|
5766
|
-
var _b, _c;
|
|
5767
5804
|
if (ITEMS[key].visibility) {
|
|
5768
5805
|
if (ITEMS[key].subMenu) {
|
|
5769
|
-
items.push(
|
|
5806
|
+
items.push(React.createElement(MenuItem, { key: key, href: "", onClick: (e) => this.state.showContextMenu &&
|
|
5770
5807
|
this.setState({
|
|
5771
5808
|
showContextMenu: {
|
|
5772
5809
|
item: this.state.showContextMenu.item,
|
|
@@ -5775,14 +5812,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5775
5812
|
subAnchor: e.target,
|
|
5776
5813
|
},
|
|
5777
5814
|
}), style: ITEMS[key].style },
|
|
5778
|
-
|
|
5779
|
-
|
|
5815
|
+
React.createElement(ListItemIcon, { style: { ...ITEMS[key].iconStyle, ...ITEMS[key].listItemIconStyle } }, ITEMS[key].icon),
|
|
5816
|
+
React.createElement(ListItemText, null,
|
|
5780
5817
|
ITEMS[key].label,
|
|
5781
5818
|
"..."),
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
if (
|
|
5785
|
-
items.push(
|
|
5819
|
+
React.createElement("div", { style: { ...styles.contextMenuKeys, opacity: 1 } },
|
|
5820
|
+
React.createElement(ArrowRightIcon, null))));
|
|
5821
|
+
if (this.state.showContextMenu?.subItem === key) {
|
|
5822
|
+
items.push(React.createElement(Menu, { key: "subContextMenu", open: !0, anchorEl: this.state.showContextMenu.subAnchor, onClose: () => {
|
|
5786
5823
|
if (this.state.showContextMenu) {
|
|
5787
5824
|
this.setState({
|
|
5788
5825
|
showContextMenu: {
|
|
@@ -5792,16 +5829,19 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5792
5829
|
});
|
|
5793
5830
|
}
|
|
5794
5831
|
this.contextMenu = null;
|
|
5795
|
-
} },
|
|
5796
|
-
|
|
5797
|
-
|
|
5832
|
+
} }, ITEMS[key].subMenu?.map(subItem => subItem.visibility ? (React.createElement(MenuItem, { key: subItem.label, onClick: subItem.onClick, style: subItem.style },
|
|
5833
|
+
React.createElement(ListItemIcon, { style: {
|
|
5834
|
+
...subItem.iconStyle,
|
|
5835
|
+
...(subItem.listItemIconStyle || undefined),
|
|
5836
|
+
} }, subItem.icon),
|
|
5837
|
+
React.createElement(ListItemText, null, subItem.label))) : null)));
|
|
5798
5838
|
}
|
|
5799
5839
|
}
|
|
5800
5840
|
else {
|
|
5801
|
-
items.push(
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
ITEMS[key].key ? (
|
|
5841
|
+
items.push(React.createElement(MenuItem, { key: key, onClick: ITEMS[key].onClick, sx: ITEMS[key].style },
|
|
5842
|
+
React.createElement(ListItemIcon, { style: { ...ITEMS[key].iconStyle, ...ITEMS[key].listItemIconStyle } }, ITEMS[key].icon),
|
|
5843
|
+
React.createElement(ListItemText, null, ITEMS[key].label),
|
|
5844
|
+
ITEMS[key].key ? (React.createElement("div", { style: styles.contextMenuKeys }, `Alt+${ITEMS[key].key === 'Delete' ? this.props.t('ra_Del') : ITEMS[key].key}`)) : null));
|
|
5805
5845
|
}
|
|
5806
5846
|
}
|
|
5807
5847
|
});
|
|
@@ -5809,7 +5849,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5809
5849
|
setTimeout(() => this.setState({ showContextMenu: null }), 100);
|
|
5810
5850
|
return null;
|
|
5811
5851
|
}
|
|
5812
|
-
return (
|
|
5852
|
+
return (React.createElement(Menu, { key: "contextMenu", open: !0, onKeyUp: e => {
|
|
5813
5853
|
e.preventDefault();
|
|
5814
5854
|
if (e.altKey) {
|
|
5815
5855
|
Object.keys(ITEMS).forEach(key => {
|
|
@@ -5824,7 +5864,6 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5824
5864
|
} }, items));
|
|
5825
5865
|
}
|
|
5826
5866
|
renderEditValueDialog() {
|
|
5827
|
-
var _b;
|
|
5828
5867
|
if (!this.state.updateOpened || !this.props.objectBrowserValue) {
|
|
5829
5868
|
return null;
|
|
5830
5869
|
}
|
|
@@ -5836,12 +5875,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5836
5875
|
console.error(`Something went wrong. Possibly the object ${this.edit.id} was deleted.`);
|
|
5837
5876
|
return null;
|
|
5838
5877
|
}
|
|
5839
|
-
const type =
|
|
5878
|
+
const type = this.objects[this.edit.id].common?.type
|
|
5840
5879
|
? this.objects[this.edit.id].common.type
|
|
5841
5880
|
: typeof this.edit.val;
|
|
5842
5881
|
const role = this.objects[this.edit.id].common.role;
|
|
5843
5882
|
const ObjectBrowserValue = this.props.objectBrowserValue;
|
|
5844
|
-
return (
|
|
5883
|
+
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
5884
|
? this.systemConfig.common.isFloatComma
|
|
5846
5885
|
: this.props.isFloatComma, onClose: (res) => {
|
|
5847
5886
|
this.setState({ updateOpened: false });
|
|
@@ -5860,26 +5899,26 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5860
5899
|
}
|
|
5861
5900
|
if (this.styleTheme !== this.props.themeType) {
|
|
5862
5901
|
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:
|
|
5902
|
+
cellIdIconFolder: Utils.getStyle(this.props.theme, styles.cellIdIconFolder),
|
|
5903
|
+
cellIdIconDocument: Utils.getStyle(this.props.theme, styles.cellIdIconDocument),
|
|
5904
|
+
iconDeviceError: Utils.getStyle(this.props.theme, styles.iconDeviceError),
|
|
5905
|
+
iconDeviceConnected: Utils.getStyle(this.props.theme, styles.iconDeviceConnected),
|
|
5906
|
+
iconDeviceDisconnected: Utils.getStyle(this.props.theme, styles.iconDeviceDisconnected),
|
|
5907
|
+
cellButtonsButtonWithCustoms: Utils.getStyle(this.props.theme, styles.cellButtonsButtonWithCustoms),
|
|
5908
|
+
invertedBackground: Utils.getStyle(this.props.theme, styles.invertedBackground),
|
|
5909
|
+
invertedBackgroundFlex: Utils.getStyle(this.props.theme, styles.invertedBackgroundFlex),
|
|
5910
|
+
contextMenuEdit: Utils.getStyle(this.props.theme, styles.contextMenuEdit),
|
|
5911
|
+
contextMenuEditValue: Utils.getStyle(this.props.theme, styles.contextMenuEditValue),
|
|
5912
|
+
contextMenuView: Utils.getStyle(this.props.theme, styles.contextMenuView),
|
|
5913
|
+
contextMenuCustom: Utils.getStyle(this.props.theme, styles.contextMenuCustom),
|
|
5914
|
+
contextMenuACL: Utils.getStyle(this.props.theme, styles.contextMenuACL),
|
|
5915
|
+
contextMenuRoom: Utils.getStyle(this.props.theme, styles.contextMenuRoom),
|
|
5916
|
+
contextMenuRole: Utils.getStyle(this.props.theme, styles.contextMenuRole),
|
|
5917
|
+
contextMenuDelete: Utils.getStyle(this.props.theme, styles.contextMenuDelete),
|
|
5918
|
+
filterInput: Utils.getStyle(this.props.theme, styles.headerCellInput, styles.filterInput),
|
|
5919
|
+
iconCopy: Utils.getStyle(this.props.theme, styles.cellButtonsValueButton, styles.cellButtonsValueButtonCopy),
|
|
5920
|
+
aliasReadWrite: Utils.getStyle(this.props.theme, styles.cellIdAlias, styles.cellIdAliasReadWrite),
|
|
5921
|
+
aliasAlone: Utils.getStyle(this.props.theme, styles.cellIdAlias, styles.cellIdAliasAlone),
|
|
5883
5922
|
};
|
|
5884
5923
|
this.styleTheme = this.props.themeType;
|
|
5885
5924
|
}
|
|
@@ -5901,11 +5940,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5901
5940
|
this.checkUnsubscribes();
|
|
5902
5941
|
}, 200);
|
|
5903
5942
|
if (!this.state.loaded) {
|
|
5904
|
-
return
|
|
5943
|
+
return React.createElement(CircularProgress, { key: `${this.props.dialogName}_c` });
|
|
5905
5944
|
}
|
|
5906
5945
|
const items = this.root ? this.renderItem(this.root, undefined) : null;
|
|
5907
|
-
return (
|
|
5908
|
-
|
|
5946
|
+
return (React.createElement(TabContainer, { key: this.props.dialogName },
|
|
5947
|
+
React.createElement("style", null, `
|
|
5909
5948
|
@keyframes newValueAnimation-light {
|
|
5910
5949
|
0% {
|
|
5911
5950
|
color: #00f900;
|
|
@@ -5935,10 +5974,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5935
5974
|
animation: newValueAnimation-light 2s ease-in-out;
|
|
5936
5975
|
}
|
|
5937
5976
|
`),
|
|
5938
|
-
|
|
5939
|
-
|
|
5977
|
+
React.createElement(TabHeader, null, this.getToolbar()),
|
|
5978
|
+
React.createElement(TabContent, null,
|
|
5940
5979
|
this.renderHeader(),
|
|
5941
|
-
|
|
5980
|
+
React.createElement("div", { style: styles.tableDiv, ref: this.tableRef, onKeyDown: event => this.navigateKeyPress(event) }, items)),
|
|
5942
5981
|
this.renderContextMenu(),
|
|
5943
5982
|
this.renderAliasMenu(),
|
|
5944
5983
|
this.renderToast(),
|
|
@@ -5960,8 +5999,5 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5960
5999
|
this.props.modalEditOfAccessControl(this, this.state.modalEditOfAccessObjData)));
|
|
5961
6000
|
}
|
|
5962
6001
|
}
|
|
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);
|
|
6002
|
+
export const ObjectBrowser = withWidth()(ObjectBrowserClass);
|
|
6003
|
+
//# sourceMappingURL=ObjectBrowser.js.map
|