@iobroker/adapter-react-v5 3.1.34 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Components/404.js +0 -23
- package/Components/404.js.map +1 -1
- package/Components/ColorPicker.js +6 -37
- package/Components/ColorPicker.js.map +1 -1
- package/Components/ComplexCron.js +10 -84
- package/Components/ComplexCron.js.map +1 -1
- package/Components/CustomModal.js +29 -54
- package/Components/CustomModal.js.map +1 -1
- package/Components/FileBrowser.js +15 -265
- package/Components/FileBrowser.js.map +1 -1
- package/Components/FileViewer.js +7 -68
- package/Components/FileViewer.js.map +1 -1
- package/Components/Icon.d.ts +1 -1
- package/Components/Icon.js +2 -42
- package/Components/Icon.js.map +1 -1
- package/Components/IconPicker.js +6 -28
- package/Components/IconPicker.js.map +1 -1
- package/Components/IconSelector.js +3 -55
- package/Components/IconSelector.js.map +1 -1
- package/Components/Image.js +1 -38
- package/Components/Image.js.map +1 -1
- package/Components/JsonConfigComponent/ChipInput.js +66 -197
- package/Components/JsonConfigComponent/ChipInput.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAlive.js +0 -31
- package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +6 -39
- package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +6 -52
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCRON.js +5 -39
- package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js +4 -42
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.js +0 -28
- package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigChip.js +4 -33
- package/Components/JsonConfigComponent/ConfigChip.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigColor.js +0 -34
- package/Components/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCoordinates.js +0 -33
- package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCustom.js +14 -73
- package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigDatePicker.js +0 -25
- package/Components/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFile.js +0 -46
- package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.js +7 -126
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFunc.js +0 -34
- package/Components/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigGeneric.js +15 -110
- package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigIP.js +2 -35
- package/Components/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigImageUpload.js +4 -44
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +1 -59
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +7 -40
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js +2 -42
- package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigNumber.js +2 -45
- package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigObjectId.js +6 -40
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPanel.js +7 -91
- package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPassword.js +0 -42
- package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPattern.js +0 -25
- package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigRoom.js +0 -34
- package/Components/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelect.js +4 -34
- package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js +11 -67
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSendto.js +8 -91
- package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSetState.js +0 -55
- package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSlider.js +0 -28
- package/Components/JsonConfigComponent/ConfigSlider.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticDivider.js +0 -21
- package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticHeader.js +0 -24
- package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticImage.js +0 -23
- package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticText.js +0 -31
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTable.js +13 -105
- package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTabs.js +2 -35
- package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigText.js +0 -34
- package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.js +0 -37
- package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTimePicker.js +0 -25
- package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTopic.js +0 -29
- package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigUser.js +2 -40
- package/Components/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/Components/JsonConfigComponent/index.js +5 -81
- package/Components/JsonConfigComponent/index.js.map +1 -1
- package/Components/Loader.js +2 -20
- package/Components/Loader.js.map +1 -1
- package/Components/Loaders/PT.js +2 -20
- package/Components/Loaders/PT.js.map +1 -1
- package/Components/Loaders/Vendor.js +2 -21
- package/Components/Loaders/Vendor.js.map +1 -1
- package/Components/Logo.js +6 -39
- package/Components/Logo.js.map +1 -1
- package/Components/MDUtils.js +3 -27
- package/Components/MDUtils.js.map +1 -1
- package/Components/ObjectBrowser.d.ts +1 -1
- package/Components/ObjectBrowser.js +181 -788
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/Router.js +7 -31
- package/Components/Router.js.map +1 -1
- package/Components/SaveCloseButtons.js +2 -32
- package/Components/SaveCloseButtons.js.map +1 -1
- package/Components/Schedule.js +29 -251
- package/Components/Schedule.js.map +1 -1
- package/Components/SelectWithIcon.d.ts +1 -1
- package/Components/SelectWithIcon.js +0 -48
- package/Components/SelectWithIcon.js.map +1 -1
- package/Components/SimpleCron/cron2text.js +45 -91
- package/Components/SimpleCron/cron2text.js.map +1 -1
- package/Components/SimpleCron/cronText.js +0 -6
- package/Components/SimpleCron/cronText.js.map +1 -1
- package/Components/SimpleCron/index.js +19 -102
- package/Components/SimpleCron/index.js.map +1 -1
- package/Components/SimpleCron/jquery.cron.locale.js +44 -24
- package/Components/SimpleCron/jquery.cron.locale.js.map +1 -1
- package/Components/TabContainer.js +2 -23
- package/Components/TabContainer.js.map +1 -1
- package/Components/TabContent.js +2 -22
- package/Components/TabContent.js.map +1 -1
- package/Components/TabHeader.js +1 -17
- package/Components/TabHeader.js.map +1 -1
- package/Components/TableResize.js +6 -51
- package/Components/TableResize.js.map +1 -1
- package/Components/TextWithIcon.js +0 -20
- package/Components/TextWithIcon.js.map +1 -1
- package/Components/ToggleThemeMenu.js +5 -13
- package/Components/ToggleThemeMenu.js.map +1 -1
- package/Components/TreeTable.js +4 -121
- package/Components/TreeTable.js.map +1 -1
- package/Components/UploadImage.js +17 -60
- package/Components/UploadImage.js.map +1 -1
- package/Components/Utils.js +87 -263
- package/Components/Utils.js.map +1 -1
- package/Components/copy-to-clipboard.js +16 -38
- package/Components/copy-to-clipboard.js.map +1 -1
- package/Components/withWidth.js +2 -10
- package/Components/withWidth.js.map +1 -1
- package/Connection.d.ts +1 -0
- package/Connection.js +156 -527
- package/Connection.js.map +1 -1
- package/Dialogs/ComplexCron.js +0 -34
- package/Dialogs/ComplexCron.js.map +1 -1
- package/Dialogs/Confirm.js +1 -39
- package/Dialogs/Confirm.js.map +1 -1
- package/Dialogs/Cron.js +1 -37
- package/Dialogs/Cron.js.map +1 -1
- package/Dialogs/Error.d.ts +1 -1
- package/Dialogs/Error.js +2 -29
- package/Dialogs/Error.js.map +1 -1
- package/Dialogs/FileSelect.js +2 -36
- package/Dialogs/FileSelect.js.map +1 -1
- package/Dialogs/Message.js +2 -27
- package/Dialogs/Message.js.map +1 -1
- package/Dialogs/SelectID.d.ts +1 -1
- package/Dialogs/SelectID.js +3 -40
- package/Dialogs/SelectID.js.map +1 -1
- package/Dialogs/SimpleCron.js +1 -33
- package/Dialogs/SimpleCron.js.map +1 -1
- package/Dialogs/TextInput.js +2 -34
- package/Dialogs/TextInput.js.map +1 -1
- package/GenericApp.js +55 -150
- package/GenericApp.js.map +1 -1
- package/Prompt.js +0 -2
- package/Prompt.js.map +1 -1
- package/README.md +11 -4
- package/Theme.js +7 -22
- package/Theme.js.map +1 -1
- package/i18n/uk.json +326 -0
- package/i18n.d.ts +2 -0
- package/i18n.js +9 -29
- package/i18n.js.map +1 -1
- package/icons/IconAdapter.d.ts +2 -2
- package/icons/IconAdapter.js +2 -6
- package/icons/IconAdapter.js.map +1 -1
- package/icons/IconAlias.d.ts +2 -2
- package/icons/IconAlias.js +2 -6
- package/icons/IconAlias.js.map +1 -1
- package/icons/IconChannel.d.ts +2 -2
- package/icons/IconChannel.js +2 -6
- package/icons/IconChannel.js.map +1 -1
- package/icons/IconClearFilter.d.ts +2 -2
- package/icons/IconClearFilter.js +0 -5
- package/icons/IconClearFilter.js.map +1 -1
- package/icons/IconClosed.d.ts +2 -2
- package/icons/IconClosed.js +0 -5
- package/icons/IconClosed.js.map +1 -1
- package/icons/IconCopy.d.ts +2 -2
- package/icons/IconCopy.js +0 -5
- package/icons/IconCopy.js.map +1 -1
- package/icons/IconDevice.d.ts +2 -2
- package/icons/IconDevice.js +0 -5
- package/icons/IconDevice.js.map +1 -1
- package/icons/IconDocument.d.ts +2 -2
- package/icons/IconDocument.js +0 -5
- package/icons/IconDocument.js.map +1 -1
- package/icons/IconDocumentReadOnly.d.ts +2 -2
- package/icons/IconDocumentReadOnly.js +0 -5
- package/icons/IconDocumentReadOnly.js.map +1 -1
- package/icons/IconExpert.d.ts +2 -2
- package/icons/IconExpert.js +0 -5
- package/icons/IconExpert.js.map +1 -1
- package/icons/IconFx.d.ts +2 -2
- package/icons/IconFx.js +0 -5
- package/icons/IconFx.js.map +1 -1
- package/icons/IconInstance.d.ts +2 -2
- package/icons/IconInstance.js +0 -5
- package/icons/IconInstance.js.map +1 -1
- package/icons/IconLogout.d.ts +2 -2
- package/icons/IconLogout.js +0 -5
- package/icons/IconLogout.js.map +1 -1
- package/icons/IconNoIcon.d.ts +2 -2
- package/icons/IconNoIcon.js +0 -5
- package/icons/IconNoIcon.js.map +1 -1
- package/icons/IconOpen.d.ts +2 -2
- package/icons/IconOpen.js +0 -5
- package/icons/IconOpen.js.map +1 -1
- package/icons/IconState.d.ts +2 -2
- package/icons/IconState.js +0 -6
- package/icons/IconState.js.map +1 -1
- package/package.json +15 -15
|
@@ -1,200 +1,104 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
-
|
|
14
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
16
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
|
-
|
|
18
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
-
|
|
20
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
-
|
|
22
14
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
23
|
-
|
|
24
15
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
25
|
-
|
|
26
16
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
27
|
-
|
|
28
17
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
29
|
-
|
|
30
18
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
31
|
-
|
|
32
19
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
33
|
-
|
|
34
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
35
|
-
|
|
36
21
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
37
|
-
|
|
38
22
|
var _copyToClipboard = _interopRequireDefault(require("./copy-to-clipboard"));
|
|
39
|
-
|
|
40
23
|
var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
|
|
41
|
-
|
|
42
24
|
var _reactInlinesvg = _interopRequireDefault(require("react-inlinesvg"));
|
|
43
|
-
|
|
44
25
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
45
|
-
|
|
46
26
|
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
47
|
-
|
|
48
27
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
49
|
-
|
|
50
28
|
var _Select = _interopRequireDefault(require("@mui/material/Select"));
|
|
51
|
-
|
|
52
29
|
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
53
|
-
|
|
54
30
|
var _Input = _interopRequireDefault(require("@mui/material/Input"));
|
|
55
|
-
|
|
56
31
|
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
57
|
-
|
|
58
32
|
var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
|
|
59
|
-
|
|
60
33
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
61
|
-
|
|
62
34
|
var _Snackbar = _interopRequireDefault(require("@mui/material/Snackbar"));
|
|
63
|
-
|
|
64
35
|
var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
65
|
-
|
|
66
36
|
var _List = _interopRequireDefault(require("@mui/material/List"));
|
|
67
|
-
|
|
68
37
|
var _ListItem = _interopRequireDefault(require("@mui/material/ListItem"));
|
|
69
|
-
|
|
70
38
|
var _ListItemIcon = _interopRequireDefault(require("@mui/material/ListItemIcon"));
|
|
71
|
-
|
|
72
39
|
var _ListItemSecondaryAction = _interopRequireDefault(require("@mui/material/ListItemSecondaryAction"));
|
|
73
|
-
|
|
74
40
|
var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
|
|
75
|
-
|
|
76
41
|
var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
|
|
77
|
-
|
|
78
42
|
var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
|
|
79
|
-
|
|
80
43
|
var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
|
|
81
|
-
|
|
82
44
|
var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
|
|
83
|
-
|
|
84
45
|
var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
|
|
85
|
-
|
|
86
46
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
87
|
-
|
|
88
47
|
var _Fab = _interopRequireDefault(require("@mui/material/Fab"));
|
|
89
|
-
|
|
90
48
|
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
91
|
-
|
|
92
49
|
var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
|
|
93
|
-
|
|
94
50
|
var _Switch = _interopRequireDefault(require("@mui/material/Switch"));
|
|
95
|
-
|
|
96
51
|
var _Edit = _interopRequireDefault(require("@mui/icons-material/Edit"));
|
|
97
|
-
|
|
98
52
|
var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
|
|
99
|
-
|
|
100
53
|
var _Settings = _interopRequireDefault(require("@mui/icons-material/Settings"));
|
|
101
|
-
|
|
102
54
|
var _SettingsApplications = _interopRequireDefault(require("@mui/icons-material/SettingsApplications"));
|
|
103
|
-
|
|
104
55
|
var _Photo = _interopRequireDefault(require("@mui/icons-material/Photo"));
|
|
105
|
-
|
|
106
56
|
var _SupervisedUserCircle = _interopRequireDefault(require("@mui/icons-material/SupervisedUserCircle"));
|
|
107
|
-
|
|
108
57
|
var _CalendarToday = _interopRequireDefault(require("@mui/icons-material/CalendarToday"));
|
|
109
|
-
|
|
110
58
|
var _PersonOutlined = _interopRequireDefault(require("@mui/icons-material/PersonOutlined"));
|
|
111
|
-
|
|
112
59
|
var _Router = _interopRequireDefault(require("@mui/icons-material/Router"));
|
|
113
|
-
|
|
114
60
|
var _Wifi = _interopRequireDefault(require("@mui/icons-material/Wifi"));
|
|
115
|
-
|
|
116
61
|
var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
|
|
117
|
-
|
|
118
62
|
var _Description = _interopRequireDefault(require("@mui/icons-material/Description"));
|
|
119
|
-
|
|
120
63
|
var _Code = _interopRequireDefault(require("@mui/icons-material/Code"));
|
|
121
|
-
|
|
122
64
|
var _ShowChart = _interopRequireDefault(require("@mui/icons-material/ShowChart"));
|
|
123
|
-
|
|
124
65
|
var _ListAlt = _interopRequireDefault(require("@mui/icons-material/ListAlt"));
|
|
125
|
-
|
|
126
66
|
var _ViewColumn = _interopRequireDefault(require("@mui/icons-material/ViewColumn"));
|
|
127
|
-
|
|
128
67
|
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
129
|
-
|
|
130
68
|
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
131
|
-
|
|
132
69
|
var _Build = _interopRequireDefault(require("@mui/icons-material/Build"));
|
|
133
|
-
|
|
134
70
|
var _Publish = _interopRequireDefault(require("@mui/icons-material/Publish"));
|
|
135
|
-
|
|
136
71
|
var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
|
|
137
|
-
|
|
138
72
|
var _Refresh = _interopRequireDefault(require("@mui/icons-material/Refresh"));
|
|
139
|
-
|
|
140
73
|
var _LooksOne = _interopRequireDefault(require("@mui/icons-material/LooksOne"));
|
|
141
|
-
|
|
142
74
|
var _RoomService = _interopRequireDefault(require("@mui/icons-material/RoomService"));
|
|
143
|
-
|
|
144
75
|
var _Error = _interopRequireDefault(require("@mui/icons-material/Error"));
|
|
145
|
-
|
|
146
76
|
var _WifiOff = _interopRequireDefault(require("@mui/icons-material/WifiOff"));
|
|
147
|
-
|
|
148
77
|
var _IconExpert = _interopRequireDefault(require("../icons/IconExpert"));
|
|
149
|
-
|
|
150
78
|
var _IconAdapter = _interopRequireDefault(require("../icons/IconAdapter"));
|
|
151
|
-
|
|
152
79
|
var _IconAlias = _interopRequireDefault(require("../icons/IconAlias"));
|
|
153
|
-
|
|
154
80
|
var _IconChannel = _interopRequireDefault(require("../icons/IconChannel"));
|
|
155
|
-
|
|
156
81
|
var _IconCopy = _interopRequireDefault(require("../icons/IconCopy"));
|
|
157
|
-
|
|
158
82
|
var _IconDevice = _interopRequireDefault(require("../icons/IconDevice"));
|
|
159
|
-
|
|
160
83
|
var _IconDocument = _interopRequireDefault(require("../icons/IconDocument"));
|
|
161
|
-
|
|
162
84
|
var _IconDocumentReadOnly = _interopRequireDefault(require("../icons/IconDocumentReadOnly"));
|
|
163
|
-
|
|
164
85
|
var _IconInstance = _interopRequireDefault(require("../icons/IconInstance"));
|
|
165
|
-
|
|
166
86
|
var _IconState = _interopRequireDefault(require("../icons/IconState"));
|
|
167
|
-
|
|
168
87
|
var _IconClosed = _interopRequireDefault(require("../icons/IconClosed"));
|
|
169
|
-
|
|
170
88
|
var _IconOpen = _interopRequireDefault(require("../icons/IconOpen"));
|
|
171
|
-
|
|
172
89
|
var _IconClearFilter = _interopRequireDefault(require("../icons/IconClearFilter"));
|
|
173
|
-
|
|
174
90
|
var _Icon = _interopRequireDefault(require("./Icon"));
|
|
175
|
-
|
|
176
91
|
var _withWidth = _interopRequireDefault(require("./withWidth"));
|
|
177
|
-
|
|
178
92
|
var _Utils = _interopRequireDefault(require("./Utils"));
|
|
179
|
-
|
|
180
93
|
var _TabContainer = _interopRequireDefault(require("./TabContainer"));
|
|
181
|
-
|
|
182
94
|
var _TabContent = _interopRequireDefault(require("./TabContent"));
|
|
183
|
-
|
|
184
95
|
var _TabHeader = _interopRequireDefault(require("./TabHeader"));
|
|
185
|
-
|
|
186
96
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
187
|
-
|
|
188
97
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
189
|
-
|
|
190
98
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
191
|
-
|
|
192
99
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
193
|
-
|
|
194
100
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
195
|
-
|
|
196
101
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
197
|
-
|
|
198
102
|
var ICON_SIZE = 24;
|
|
199
103
|
var ROW_HEIGHT = 32;
|
|
200
104
|
var ITEM_LEVEL = 16;
|
|
@@ -207,14 +111,13 @@ var COLOR_NAME_CONNECTED_DARK = '#57ff45';
|
|
|
207
111
|
var COLOR_NAME_CONNECTED_LIGHT = '#098c04';
|
|
208
112
|
var COLOR_NAME_DISCONNECTED_DARK = '#f3ad11';
|
|
209
113
|
var COLOR_NAME_DISCONNECTED_LIGHT = '#6c5008';
|
|
210
|
-
|
|
211
114
|
var styles = function styles(theme) {
|
|
212
115
|
return {
|
|
213
116
|
toolbar: {
|
|
214
117
|
minHeight: 38 //Theme.toolbar.height,
|
|
215
118
|
// boxShadow: '0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12)'
|
|
216
|
-
|
|
217
119
|
},
|
|
120
|
+
|
|
218
121
|
toolbarButtons: {
|
|
219
122
|
padding: 4,
|
|
220
123
|
marginLeft: 4
|
|
@@ -370,10 +273,11 @@ var styles = function styles(theme) {
|
|
|
370
273
|
cellIdSpan: {
|
|
371
274
|
overflow: 'hidden',
|
|
372
275
|
textOverflow: 'ellipsis',
|
|
373
|
-
whiteSpace: 'nowrap'
|
|
276
|
+
whiteSpace: 'nowrap'
|
|
277
|
+
//display: 'inline-block',
|
|
374
278
|
//verticalAlign: 'top',
|
|
375
|
-
|
|
376
279
|
},
|
|
280
|
+
|
|
377
281
|
cellIdIconFolder: {
|
|
378
282
|
marginRight: theme.spacing(1),
|
|
379
283
|
width: ROW_HEIGHT - 4,
|
|
@@ -821,7 +725,6 @@ var styles = function styles(theme) {
|
|
|
821
725
|
}
|
|
822
726
|
};
|
|
823
727
|
};
|
|
824
|
-
|
|
825
728
|
function generateFile(filename, obj) {
|
|
826
729
|
var el = document.createElement('a');
|
|
827
730
|
el.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(obj, null, 2)));
|
|
@@ -830,85 +733,64 @@ function generateFile(filename, obj) {
|
|
|
830
733
|
document.body.appendChild(el);
|
|
831
734
|
el.click();
|
|
832
735
|
document.body.removeChild(el);
|
|
833
|
-
}
|
|
834
|
-
|
|
736
|
+
}
|
|
835
737
|
|
|
738
|
+
// d=data, t=target, s=start, e=end, m=middle
|
|
836
739
|
function binarySearch(list, find, _start, _end) {
|
|
837
740
|
_start = _start || 0;
|
|
838
|
-
|
|
839
741
|
if (_end === undefined) {
|
|
840
742
|
_end = list.length - 1;
|
|
841
|
-
|
|
842
743
|
if (!_end) {
|
|
843
744
|
return list[0] === find;
|
|
844
745
|
}
|
|
845
746
|
}
|
|
846
|
-
|
|
847
747
|
var middle = Math.floor((_start + _end) / 2);
|
|
848
|
-
|
|
849
748
|
if (find === list[middle]) {
|
|
850
749
|
return list[middle];
|
|
851
750
|
}
|
|
852
|
-
|
|
853
751
|
if (_end - 1 === _start) {
|
|
854
752
|
return list[_start] === find || list[_end] === find;
|
|
855
753
|
}
|
|
856
|
-
|
|
857
754
|
if (find > list[middle]) {
|
|
858
755
|
return binarySearch(list, find, middle, _end);
|
|
859
756
|
}
|
|
860
|
-
|
|
861
757
|
if (find < list[middle]) {
|
|
862
758
|
return binarySearch(list, find, _start, middle);
|
|
863
759
|
}
|
|
864
760
|
}
|
|
865
|
-
|
|
866
761
|
function applyFilter(item, filters, lang, objects, context, counter, customFilter, selectedTypes, _depth) {
|
|
867
762
|
_depth = _depth || 0;
|
|
868
763
|
var filteredOut = false;
|
|
869
|
-
|
|
870
764
|
if (!context) {
|
|
871
765
|
context = {};
|
|
872
|
-
|
|
873
766
|
if (filters.id) {
|
|
874
767
|
context.id = filters.id.toLowerCase();
|
|
875
768
|
}
|
|
876
|
-
|
|
877
769
|
if (filters.name) {
|
|
878
770
|
context.name = filters.name.toLowerCase();
|
|
879
771
|
}
|
|
880
|
-
|
|
881
772
|
if (filters.type) {
|
|
882
773
|
context.type = filters.type.toLowerCase();
|
|
883
774
|
}
|
|
884
|
-
|
|
885
775
|
if (filters.custom) {
|
|
886
776
|
context.custom = filters.custom.toLowerCase();
|
|
887
777
|
}
|
|
888
|
-
|
|
889
778
|
if (filters.role) {
|
|
890
779
|
context.role = filters.role.toLowerCase();
|
|
891
780
|
}
|
|
892
|
-
|
|
893
781
|
if (filters.room) {
|
|
894
782
|
context.room = objects[filters.room] && objects[filters.room].common && objects[filters.room].common.members || [];
|
|
895
783
|
}
|
|
896
|
-
|
|
897
784
|
if (filters.func) {
|
|
898
785
|
context.func = objects[filters.func] && objects[filters.func].common && objects[filters.func].common.members || [];
|
|
899
786
|
}
|
|
900
787
|
}
|
|
901
|
-
|
|
902
788
|
var data = item.data;
|
|
903
|
-
|
|
904
789
|
if (data && data.id) {
|
|
905
790
|
var _data$obj;
|
|
906
|
-
|
|
907
791
|
var common = (_data$obj = data.obj) === null || _data$obj === void 0 ? void 0 : _data$obj.common;
|
|
908
|
-
|
|
909
792
|
if (customFilter) {
|
|
910
793
|
var _customFilter$common, _customFilter$common2, _customFilter$common3;
|
|
911
|
-
|
|
912
794
|
if (customFilter.type) {
|
|
913
795
|
if (typeof customFilter.type === 'string') {
|
|
914
796
|
if (!data.obj || customFilter.type !== data.obj.type) {
|
|
@@ -920,7 +802,6 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
920
802
|
}
|
|
921
803
|
}
|
|
922
804
|
}
|
|
923
|
-
|
|
924
805
|
if (!filteredOut && (_customFilter$common = customFilter.common) !== null && _customFilter$common !== void 0 && _customFilter$common.type) {
|
|
925
806
|
if (!(common !== null && common !== void 0 && common.type)) {
|
|
926
807
|
filteredOut = true;
|
|
@@ -934,7 +815,6 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
934
815
|
}
|
|
935
816
|
}
|
|
936
817
|
}
|
|
937
|
-
|
|
938
818
|
if (!filteredOut && (_customFilter$common2 = customFilter.common) !== null && _customFilter$common2 !== void 0 && _customFilter$common2.role) {
|
|
939
819
|
if (!(common !== null && common !== void 0 && common.role)) {
|
|
940
820
|
filteredOut = true;
|
|
@@ -950,7 +830,6 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
950
830
|
}
|
|
951
831
|
}
|
|
952
832
|
}
|
|
953
|
-
|
|
954
833
|
if (!filteredOut && (_customFilter$common3 = customFilter.common) !== null && _customFilter$common3 !== void 0 && _customFilter$common3.custom) {
|
|
955
834
|
if (!(common !== null && common !== void 0 && common.custom)) {
|
|
956
835
|
filteredOut = true;
|
|
@@ -968,33 +847,28 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
968
847
|
}
|
|
969
848
|
}
|
|
970
849
|
}
|
|
971
|
-
|
|
972
850
|
if (!filteredOut && !filters.expertMode) {
|
|
973
|
-
filteredOut = data.id === 'system' || data.id === 'enum' ||
|
|
851
|
+
filteredOut = data.id === 'system' || data.id === 'enum' ||
|
|
852
|
+
// (data.obj && data.obj.type === 'meta') ||
|
|
974
853
|
data.id.startsWith('system.') || data.id.startsWith('enum.') || data.id.startsWith('_design/') || data.id.endsWith('.admin') || common && common.expert;
|
|
975
854
|
}
|
|
976
|
-
|
|
977
855
|
if (!filteredOut && context.id) {
|
|
978
856
|
if (data.fID === undefined) {
|
|
979
857
|
data.fID = data.id.toLowerCase();
|
|
980
858
|
}
|
|
981
|
-
|
|
982
859
|
filteredOut = !data.fID.includes(context.id);
|
|
983
860
|
}
|
|
984
|
-
|
|
985
861
|
if (!filteredOut && context.name) {
|
|
986
862
|
if (common) {
|
|
987
863
|
if (data.fName === undefined) {
|
|
988
864
|
data.fName = common && getName(common.name, lang) || '';
|
|
989
865
|
data.fName = data.fName.toLowerCase();
|
|
990
866
|
}
|
|
991
|
-
|
|
992
867
|
filteredOut = !data.fName.includes(context.name);
|
|
993
868
|
} else {
|
|
994
869
|
filteredOut = true;
|
|
995
870
|
}
|
|
996
871
|
}
|
|
997
|
-
|
|
998
872
|
if (!filteredOut && filters.role && common) {
|
|
999
873
|
if (common) {
|
|
1000
874
|
filteredOut = !(common.role && common.role.startsWith(context.role));
|
|
@@ -1002,27 +876,22 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1002
876
|
filteredOut = true;
|
|
1003
877
|
}
|
|
1004
878
|
}
|
|
1005
|
-
|
|
1006
879
|
if (!filteredOut && context.room) {
|
|
1007
880
|
filteredOut = !context.room.find(function (id) {
|
|
1008
881
|
return id === data.id || data.id.startsWith(id + '.');
|
|
1009
882
|
});
|
|
1010
883
|
}
|
|
1011
|
-
|
|
1012
884
|
if (!filteredOut && context.func) {
|
|
1013
885
|
filteredOut = !context.func.find(function (id) {
|
|
1014
886
|
return id === data.id || data.id.startsWith(id + '.');
|
|
1015
887
|
});
|
|
1016
888
|
}
|
|
1017
|
-
|
|
1018
889
|
if (!filteredOut && context.type) {
|
|
1019
890
|
filteredOut = !(data.obj && data.obj.type && data.obj.type === context.type);
|
|
1020
891
|
}
|
|
1021
|
-
|
|
1022
892
|
if (!filteredOut && selectedTypes) {
|
|
1023
893
|
filteredOut = !(data.obj && data.obj.type && selectedTypes.includes(data.obj.type));
|
|
1024
894
|
}
|
|
1025
|
-
|
|
1026
895
|
if (!filteredOut && context.custom) {
|
|
1027
896
|
if (common) {
|
|
1028
897
|
filteredOut = !common.custom || !common.custom[context.custom];
|
|
@@ -1031,56 +900,47 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1031
900
|
}
|
|
1032
901
|
}
|
|
1033
902
|
}
|
|
1034
|
-
|
|
1035
903
|
data.visible = !filteredOut;
|
|
1036
904
|
data.hasVisibleChildren = false;
|
|
1037
|
-
|
|
1038
905
|
if (item.children && _depth < 20) {
|
|
1039
906
|
item.children.forEach(function (_item) {
|
|
1040
907
|
var visible = applyFilter(_item, filters, lang, objects, context, counter, customFilter, selectedTypes, _depth + 1);
|
|
1041
|
-
|
|
1042
908
|
if (visible) {
|
|
1043
909
|
data.hasVisibleChildren = true;
|
|
1044
910
|
}
|
|
1045
911
|
});
|
|
1046
|
-
}
|
|
1047
|
-
|
|
912
|
+
}
|
|
1048
913
|
|
|
914
|
+
// const visible = data.visible || data.hasVisibleChildren;
|
|
1049
915
|
data.sumVisibility = data.visible || data.hasVisibleChildren; // || data.hasVisibleParent;
|
|
1050
|
-
|
|
1051
916
|
if (counter && data.sumVisibility) {
|
|
1052
917
|
counter.count++;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
918
|
+
}
|
|
1055
919
|
|
|
920
|
+
// show all children of visible object with opacity 0.5
|
|
1056
921
|
if (data.id && data.sumVisibility && item.children) {
|
|
1057
922
|
item.children.forEach(function (_item) {
|
|
1058
923
|
return _item.data.hasVisibleParent = true;
|
|
1059
924
|
});
|
|
1060
925
|
}
|
|
1061
|
-
|
|
1062
926
|
return data.visible || data.hasVisibleChildren;
|
|
1063
927
|
}
|
|
1064
|
-
|
|
1065
928
|
function getVisibleItems(item, type, objects, _result) {
|
|
1066
929
|
_result = _result || [];
|
|
1067
930
|
var data = item.data;
|
|
1068
|
-
|
|
1069
931
|
if (data.sumVisibility) {
|
|
1070
932
|
var _item$children;
|
|
1071
|
-
|
|
1072
933
|
data.id && objects[data.id] && (!type || objects[data.id].type === type) && _result.push(data.id);
|
|
1073
934
|
(_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.forEach(function (_item) {
|
|
1074
935
|
return getVisibleItems(_item, type, objects, _result);
|
|
1075
936
|
});
|
|
1076
937
|
}
|
|
1077
|
-
|
|
1078
938
|
return _result;
|
|
1079
939
|
}
|
|
1080
|
-
|
|
1081
940
|
function getSystemIcon(objects, id, k, imagePrefix) {
|
|
1082
|
-
var icon;
|
|
941
|
+
var icon;
|
|
1083
942
|
|
|
943
|
+
// system or design have special icons
|
|
1084
944
|
if (id.startsWith('_design/') || id === 'system') {
|
|
1085
945
|
icon = /*#__PURE__*/_react["default"].createElement(_SettingsApplications["default"], {
|
|
1086
946
|
className: "iconOwn"
|
|
@@ -1127,10 +987,8 @@ function getSystemIcon(objects, id, k, imagePrefix) {
|
|
|
1127
987
|
icon = getSelectIdIcon(objects, 'system.adapter.' + id, imagePrefix);
|
|
1128
988
|
}
|
|
1129
989
|
}
|
|
1130
|
-
|
|
1131
990
|
return icon || null;
|
|
1132
991
|
}
|
|
1133
|
-
|
|
1134
992
|
function buildTree(objects, options) {
|
|
1135
993
|
options = options || {};
|
|
1136
994
|
var imagePrefix = options.imagePrefix || '.';
|
|
@@ -1141,8 +999,9 @@ function buildTree(objects, options) {
|
|
|
1141
999
|
b = b.replace(/\./g, '!!!');
|
|
1142
1000
|
if (a > b) return 1;
|
|
1143
1001
|
return -1;
|
|
1144
|
-
});
|
|
1002
|
+
});
|
|
1145
1003
|
|
|
1004
|
+
// find empty nodes and create names for it
|
|
1146
1005
|
var currentPathArr = [];
|
|
1147
1006
|
var currentPath = '';
|
|
1148
1007
|
var currentPathLen = 0;
|
|
@@ -1165,27 +1024,20 @@ function buildTree(objects, options) {
|
|
|
1165
1024
|
hasSomeCustoms: false
|
|
1166
1025
|
};
|
|
1167
1026
|
var croot = root;
|
|
1168
|
-
|
|
1169
1027
|
var _loop = function _loop(i) {
|
|
1170
1028
|
var id = ids[i];
|
|
1171
|
-
|
|
1172
1029
|
if (!id) {
|
|
1173
1030
|
return "continue";
|
|
1174
1031
|
}
|
|
1175
|
-
|
|
1176
1032
|
var obj = objects[id];
|
|
1177
1033
|
var parts = id.split('.');
|
|
1178
|
-
|
|
1179
1034
|
if (obj.type && !info.types.includes(obj.type)) {
|
|
1180
1035
|
info.types.push(obj.type);
|
|
1181
1036
|
}
|
|
1182
|
-
|
|
1183
1037
|
if (obj) {
|
|
1184
1038
|
var _common$adminUI;
|
|
1185
|
-
|
|
1186
1039
|
var common = obj.common;
|
|
1187
1040
|
var role = common && common.role;
|
|
1188
|
-
|
|
1189
1041
|
if (role && !info.roles.includes(role)) {
|
|
1190
1042
|
info.roles.push(role);
|
|
1191
1043
|
} else if (id.startsWith('enum.rooms.')) {
|
|
@@ -1201,23 +1053,23 @@ function buildTree(objects, options) {
|
|
|
1201
1053
|
info.customs.push(id.substring('system.adapter.'.length));
|
|
1202
1054
|
}
|
|
1203
1055
|
}
|
|
1204
|
-
|
|
1205
1056
|
info.ids.push(id);
|
|
1206
|
-
var repeat = void 0;
|
|
1057
|
+
var repeat = void 0;
|
|
1207
1058
|
|
|
1059
|
+
// if next level
|
|
1208
1060
|
do {
|
|
1209
|
-
repeat = false;
|
|
1061
|
+
repeat = false;
|
|
1210
1062
|
|
|
1063
|
+
// If current level is still OK and we can add ID to children
|
|
1211
1064
|
if (!currentPath || id.startsWith(currentPath + '.')) {
|
|
1212
1065
|
var _obj$common, _obj$common2, _obj$common3;
|
|
1213
|
-
|
|
1214
1066
|
// if more than one level added
|
|
1215
1067
|
if (parts.length - currentPathLen > 1) {
|
|
1216
|
-
var curPath = currentPath;
|
|
1217
|
-
|
|
1068
|
+
var curPath = currentPath;
|
|
1069
|
+
// generate missing levels
|
|
1218
1070
|
var _loop2 = function _loop2(k) {
|
|
1219
|
-
curPath += (curPath ? '.' : '') + parts[k];
|
|
1220
|
-
|
|
1071
|
+
curPath += (curPath ? '.' : '') + parts[k];
|
|
1072
|
+
// level does not exist
|
|
1221
1073
|
if (!binarySearch(info.ids, curPath)) {
|
|
1222
1074
|
var _croot2 = {
|
|
1223
1075
|
data: {
|
|
@@ -1240,12 +1092,10 @@ function buildTree(objects, options) {
|
|
|
1240
1092
|
});
|
|
1241
1093
|
}
|
|
1242
1094
|
};
|
|
1243
|
-
|
|
1244
1095
|
for (var k = currentPathLen; k < parts.length - 1; k++) {
|
|
1245
1096
|
_loop2(k);
|
|
1246
1097
|
}
|
|
1247
1098
|
}
|
|
1248
|
-
|
|
1249
1099
|
var _croot = {
|
|
1250
1100
|
data: {
|
|
1251
1101
|
name: parts[parts.length - 1],
|
|
@@ -1268,17 +1118,14 @@ function buildTree(objects, options) {
|
|
|
1268
1118
|
currentPath = id;
|
|
1269
1119
|
} else {
|
|
1270
1120
|
var u = 0;
|
|
1271
|
-
|
|
1272
1121
|
while (currentPathArr[u] === parts[u]) {
|
|
1273
1122
|
u++;
|
|
1274
1123
|
}
|
|
1275
|
-
|
|
1276
1124
|
if (u > 0) {
|
|
1277
1125
|
var move = currentPathArr.length;
|
|
1278
1126
|
currentPathArr = currentPathArr.splice(0, u);
|
|
1279
1127
|
currentPathLen = u;
|
|
1280
1128
|
currentPath = currentPathArr.join('.');
|
|
1281
|
-
|
|
1282
1129
|
while (move > u) {
|
|
1283
1130
|
croot = croot.data.parent;
|
|
1284
1131
|
move--;
|
|
@@ -1289,24 +1136,18 @@ function buildTree(objects, options) {
|
|
|
1289
1136
|
currentPath = '';
|
|
1290
1137
|
currentPathLen = 0;
|
|
1291
1138
|
}
|
|
1292
|
-
|
|
1293
1139
|
repeat = true;
|
|
1294
1140
|
}
|
|
1295
1141
|
} while (repeat);
|
|
1296
1142
|
};
|
|
1297
|
-
|
|
1298
1143
|
for (var i = 0; i < ids.length; i++) {
|
|
1299
1144
|
var _ret = _loop(i);
|
|
1300
|
-
|
|
1301
1145
|
if (_ret === "continue") continue;
|
|
1302
1146
|
}
|
|
1303
|
-
|
|
1304
1147
|
info.roomEnums.sort(function (a, b) {
|
|
1305
1148
|
var _objects$a, _objects$a$common, _objects$b, _objects$b$common;
|
|
1306
|
-
|
|
1307
1149
|
var aName = getName(((_objects$a = objects[a]) === null || _objects$a === void 0 ? void 0 : (_objects$a$common = _objects$a.common) === null || _objects$a$common === void 0 ? void 0 : _objects$a$common.name) || a.split('.').pop());
|
|
1308
1150
|
var bName = getName(((_objects$b = objects[b]) === null || _objects$b === void 0 ? void 0 : (_objects$b$common = _objects$b.common) === null || _objects$b$common === void 0 ? void 0 : _objects$b$common.name) || b.split('.').pop());
|
|
1309
|
-
|
|
1310
1151
|
if (aName > bName) {
|
|
1311
1152
|
return 1;
|
|
1312
1153
|
} else if (aName < bName) {
|
|
@@ -1317,10 +1158,8 @@ function buildTree(objects, options) {
|
|
|
1317
1158
|
});
|
|
1318
1159
|
info.funcEnums.sort(function (a, b) {
|
|
1319
1160
|
var _objects$a2, _objects$a2$common, _objects$b2, _objects$b2$common;
|
|
1320
|
-
|
|
1321
1161
|
var aName = getName(((_objects$a2 = objects[a]) === null || _objects$a2 === void 0 ? void 0 : (_objects$a2$common = _objects$a2.common) === null || _objects$a2$common === void 0 ? void 0 : _objects$a2$common.name) || a.split('.').pop());
|
|
1322
1162
|
var bName = getName(((_objects$b2 = objects[b]) === null || _objects$b2 === void 0 ? void 0 : (_objects$b2$common = _objects$b2.common) === null || _objects$b2$common === void 0 ? void 0 : _objects$b2$common.name) || b.split('.').pop());
|
|
1323
|
-
|
|
1324
1163
|
if (aName > bName) {
|
|
1325
1164
|
return 1;
|
|
1326
1165
|
} else if (aName < bName) {
|
|
@@ -1336,26 +1175,21 @@ function buildTree(objects, options) {
|
|
|
1336
1175
|
root: root
|
|
1337
1176
|
};
|
|
1338
1177
|
}
|
|
1339
|
-
|
|
1340
1178
|
function findNode(root, id, _parts, _path, _level) {
|
|
1341
1179
|
if (root.data.id === id) {
|
|
1342
1180
|
return root;
|
|
1343
1181
|
}
|
|
1344
|
-
|
|
1345
1182
|
if (!_parts) {
|
|
1346
1183
|
_parts = id.split('.');
|
|
1347
1184
|
_level = 0;
|
|
1348
1185
|
_path = _parts[_level];
|
|
1349
1186
|
}
|
|
1350
|
-
|
|
1351
1187
|
if (!root.children && root.data.id !== id) {
|
|
1352
1188
|
return null;
|
|
1353
1189
|
} else {
|
|
1354
1190
|
var found;
|
|
1355
|
-
|
|
1356
1191
|
for (var i = 0; i < root.children.length; i++) {
|
|
1357
1192
|
var _id = root.children[i].data.id;
|
|
1358
|
-
|
|
1359
1193
|
if (_id === _path) {
|
|
1360
1194
|
found = root.children[i];
|
|
1361
1195
|
break;
|
|
@@ -1363,7 +1197,6 @@ function findNode(root, id, _parts, _path, _level) {
|
|
|
1363
1197
|
break;
|
|
1364
1198
|
}
|
|
1365
1199
|
}
|
|
1366
|
-
|
|
1367
1200
|
if (found) {
|
|
1368
1201
|
return findNode(found, id, _parts, _path + '.' + _parts[_level + 1], _level + 1);
|
|
1369
1202
|
} else {
|
|
@@ -1371,7 +1204,6 @@ function findNode(root, id, _parts, _path, _level) {
|
|
|
1371
1204
|
}
|
|
1372
1205
|
}
|
|
1373
1206
|
}
|
|
1374
|
-
|
|
1375
1207
|
function getName(name, lang) {
|
|
1376
1208
|
if (name && (0, _typeof2["default"])(name) === 'object') {
|
|
1377
1209
|
return (name[lang] || name.en || '').toString();
|
|
@@ -1379,7 +1211,6 @@ function getName(name, lang) {
|
|
|
1379
1211
|
return (name || '').toString();
|
|
1380
1212
|
}
|
|
1381
1213
|
}
|
|
1382
|
-
|
|
1383
1214
|
function findRoomsForObject(data, id, lang, withParentInfo, rooms) {
|
|
1384
1215
|
if (!id) {
|
|
1385
1216
|
return {
|
|
@@ -1387,15 +1218,11 @@ function findRoomsForObject(data, id, lang, withParentInfo, rooms) {
|
|
|
1387
1218
|
per: false
|
|
1388
1219
|
};
|
|
1389
1220
|
}
|
|
1390
|
-
|
|
1391
1221
|
rooms = rooms || [];
|
|
1392
|
-
|
|
1393
1222
|
for (var i = 0; i < data.roomEnums.length; i++) {
|
|
1394
1223
|
var _data$objects$data$ro, _common$members;
|
|
1395
|
-
|
|
1396
1224
|
var common = (_data$objects$data$ro = data.objects[data.roomEnums[i]]) === null || _data$objects$data$ro === void 0 ? void 0 : _data$objects$data$ro.common;
|
|
1397
1225
|
var name = getName(common.name, lang);
|
|
1398
|
-
|
|
1399
1226
|
if (common !== null && common !== void 0 && (_common$members = common.members) !== null && _common$members !== void 0 && _common$members.includes(id) && !rooms.includes(name)) {
|
|
1400
1227
|
if (!withParentInfo) {
|
|
1401
1228
|
rooms.push(name);
|
|
@@ -1407,18 +1234,16 @@ function findRoomsForObject(data, id, lang, withParentInfo, rooms) {
|
|
|
1407
1234
|
}
|
|
1408
1235
|
}
|
|
1409
1236
|
}
|
|
1237
|
+
var ownEnums;
|
|
1410
1238
|
|
|
1411
|
-
|
|
1412
|
-
|
|
1239
|
+
// Check parent
|
|
1413
1240
|
var parts = id.split('.');
|
|
1414
1241
|
parts.pop();
|
|
1415
1242
|
id = parts.join('.');
|
|
1416
|
-
|
|
1417
1243
|
if (data.objects[id]) {
|
|
1418
1244
|
ownEnums = rooms.length;
|
|
1419
1245
|
findRoomsForObject(data, id, lang, withParentInfo, rooms);
|
|
1420
1246
|
}
|
|
1421
|
-
|
|
1422
1247
|
return {
|
|
1423
1248
|
rooms: rooms,
|
|
1424
1249
|
per: !ownEnums
|
|
@@ -1429,23 +1254,17 @@ function findEnumsForObjectAsIds(data, id, enumName, funcs) {
|
|
|
1429
1254
|
if (!id) {
|
|
1430
1255
|
return [];
|
|
1431
1256
|
}
|
|
1432
|
-
|
|
1433
1257
|
funcs = funcs || [];
|
|
1434
|
-
|
|
1435
1258
|
for (var i = 0; i < data[enumName].length; i++) {
|
|
1436
1259
|
var _data$objects$data$en, _common$members2;
|
|
1437
|
-
|
|
1438
1260
|
var common = (_data$objects$data$en = data.objects[data[enumName][i]]) === null || _data$objects$data$en === void 0 ? void 0 : _data$objects$data$en.common;
|
|
1439
|
-
|
|
1440
1261
|
if (common !== null && common !== void 0 && (_common$members2 = common.members) !== null && _common$members2 !== void 0 && _common$members2.includes(id) && !funcs.includes(data[enumName][i])) {
|
|
1441
1262
|
funcs.push(data[enumName][i]);
|
|
1442
1263
|
}
|
|
1443
1264
|
}
|
|
1444
|
-
|
|
1445
1265
|
funcs.sort();
|
|
1446
1266
|
return funcs;
|
|
1447
1267
|
}
|
|
1448
|
-
|
|
1449
1268
|
function findFunctionsForObject(data, id, lang, withParentInfo, funcs) {
|
|
1450
1269
|
if (!id) {
|
|
1451
1270
|
return {
|
|
@@ -1453,15 +1272,11 @@ function findFunctionsForObject(data, id, lang, withParentInfo, funcs) {
|
|
|
1453
1272
|
pef: false
|
|
1454
1273
|
};
|
|
1455
1274
|
}
|
|
1456
|
-
|
|
1457
1275
|
funcs = funcs || [];
|
|
1458
|
-
|
|
1459
1276
|
for (var i = 0; i < data.funcEnums.length; i++) {
|
|
1460
1277
|
var _data$objects$data$fu, _common$members3;
|
|
1461
|
-
|
|
1462
1278
|
var common = (_data$objects$data$fu = data.objects[data.funcEnums[i]]) === null || _data$objects$data$fu === void 0 ? void 0 : _data$objects$data$fu.common;
|
|
1463
1279
|
var name = getName(common.name, lang);
|
|
1464
|
-
|
|
1465
1280
|
if (common !== null && common !== void 0 && (_common$members3 = common.members) !== null && _common$members3 !== void 0 && _common$members3.includes(id) && !funcs.includes(name)) {
|
|
1466
1281
|
if (!withParentInfo) {
|
|
1467
1282
|
funcs.push(name);
|
|
@@ -1473,23 +1288,22 @@ function findFunctionsForObject(data, id, lang, withParentInfo, funcs) {
|
|
|
1473
1288
|
}
|
|
1474
1289
|
}
|
|
1475
1290
|
}
|
|
1291
|
+
var ownEnums;
|
|
1476
1292
|
|
|
1477
|
-
|
|
1478
|
-
|
|
1293
|
+
// Check parent
|
|
1479
1294
|
var parts = id.split('.');
|
|
1480
1295
|
parts.pop();
|
|
1481
1296
|
id = parts.join('.');
|
|
1482
|
-
|
|
1483
1297
|
if (data.objects[id]) {
|
|
1484
1298
|
ownEnums = funcs.length;
|
|
1485
1299
|
findFunctionsForObject(data, id, lang, withParentInfo, funcs);
|
|
1486
1300
|
}
|
|
1487
|
-
|
|
1488
1301
|
return {
|
|
1489
1302
|
funcs: funcs,
|
|
1490
1303
|
pef: !ownEnums
|
|
1491
1304
|
};
|
|
1492
1305
|
}
|
|
1306
|
+
|
|
1493
1307
|
/*function quality2text(q) {
|
|
1494
1308
|
if (!q) {
|
|
1495
1309
|
return 'ok';
|
|
@@ -1505,21 +1319,19 @@ function findFunctionsForObject(data, id, lang, withParentInfo, funcs) {
|
|
|
1505
1319
|
return text + (custom ? '|0x' + (custom >> 16).toString(16).toUpperCase() : '') + ' [0x' + q.toString(16).toUpperCase() + ']';
|
|
1506
1320
|
}*/
|
|
1507
1321
|
|
|
1508
|
-
|
|
1509
1322
|
function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
|
|
1510
1323
|
var states = _Utils["default"].getStates(obj);
|
|
1511
|
-
|
|
1512
1324
|
var isCommon = obj.common;
|
|
1513
1325
|
var valText = {};
|
|
1514
1326
|
var v = isCommon && isCommon.type === 'file' ? '[file]' : !state || state.val === null ? '(null)' : state.val === undefined ? '[undef]' : state.val;
|
|
1515
1327
|
var type = (0, _typeof2["default"])(v);
|
|
1516
|
-
|
|
1517
1328
|
if (isCommon && isCommon.role && typeof isCommon.role === 'string' && isCommon.role.match(/^value\.time|^date/)) {
|
|
1518
1329
|
if (v && typeof v === 'string') {
|
|
1519
1330
|
if (v.length === 13) {
|
|
1520
1331
|
// (length of "1647597254924") warning, this solution only works till Nov 20 2286 18:46:39CET
|
|
1521
1332
|
v = new Date(parseInt(v, 10)).toString();
|
|
1522
|
-
} else {
|
|
1333
|
+
} else {
|
|
1334
|
+
// we don't know what is that, so leave it as it is
|
|
1523
1335
|
}
|
|
1524
1336
|
} else {
|
|
1525
1337
|
// null and undefined could not be here. See `let v = (isCommon && isCommon.type === 'file') ....` above
|
|
@@ -1528,7 +1340,6 @@ function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
|
|
|
1528
1340
|
} else {
|
|
1529
1341
|
if (type === 'number') {
|
|
1530
1342
|
v = Math.round(v * 100000000) / 100000000; // remove 4.00000000000000001
|
|
1531
|
-
|
|
1532
1343
|
if (isFloatComma) {
|
|
1533
1344
|
v = v.toString().replace('.', ',');
|
|
1534
1345
|
}
|
|
@@ -1537,31 +1348,26 @@ function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
|
|
|
1537
1348
|
} else if (type !== 'string') {
|
|
1538
1349
|
v = v.toString();
|
|
1539
1350
|
}
|
|
1540
|
-
|
|
1541
1351
|
if (typeof v !== 'string') {
|
|
1542
1352
|
v = v.toString();
|
|
1543
1353
|
}
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1354
|
+
}
|
|
1546
1355
|
|
|
1356
|
+
// try to replace number with "common.states"
|
|
1547
1357
|
if (states && states[v] !== undefined) {
|
|
1548
1358
|
if (v !== states[v]) {
|
|
1549
1359
|
valText.s = v;
|
|
1550
1360
|
v = states[v];
|
|
1551
1361
|
}
|
|
1552
1362
|
}
|
|
1553
|
-
|
|
1554
1363
|
var valFull;
|
|
1555
|
-
|
|
1556
1364
|
if (isCommon && isCommon.unit) {
|
|
1557
1365
|
valText.u = isCommon.unit;
|
|
1558
1366
|
}
|
|
1559
|
-
|
|
1560
1367
|
valFull = [{
|
|
1561
1368
|
t: texts.value,
|
|
1562
1369
|
v: v
|
|
1563
1370
|
}];
|
|
1564
|
-
|
|
1565
1371
|
if (state) {
|
|
1566
1372
|
if (state.ack !== undefined && state.ack !== null) {
|
|
1567
1373
|
valFull.push({
|
|
@@ -1569,61 +1375,50 @@ function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
|
|
|
1569
1375
|
v: state.ack.toString()
|
|
1570
1376
|
});
|
|
1571
1377
|
}
|
|
1572
|
-
|
|
1573
1378
|
if (state.ts) {
|
|
1574
1379
|
valFull.push({
|
|
1575
1380
|
t: texts.ts,
|
|
1576
1381
|
v: state.ts ? _Utils["default"].formatDate(new Date(state.ts), dateFormat) : ''
|
|
1577
1382
|
});
|
|
1578
1383
|
}
|
|
1579
|
-
|
|
1580
1384
|
if (state.lc) {
|
|
1581
1385
|
valFull.push({
|
|
1582
1386
|
t: texts.lc,
|
|
1583
1387
|
v: state.lc ? _Utils["default"].formatDate(new Date(state.lc), dateFormat) : ''
|
|
1584
1388
|
});
|
|
1585
1389
|
}
|
|
1586
|
-
|
|
1587
1390
|
if (state.from) {
|
|
1588
1391
|
var from = state.from.toString();
|
|
1589
|
-
|
|
1590
1392
|
if (from.startsWith('system.adapter.')) {
|
|
1591
1393
|
from = from.substring(15);
|
|
1592
1394
|
}
|
|
1593
|
-
|
|
1594
1395
|
valFull.push({
|
|
1595
1396
|
t: texts.from,
|
|
1596
1397
|
v: from
|
|
1597
1398
|
});
|
|
1598
1399
|
}
|
|
1599
|
-
|
|
1600
1400
|
if (state.user) {
|
|
1601
1401
|
var user = state.user.toString();
|
|
1602
|
-
|
|
1603
1402
|
if (user.startsWith('system.user.')) {
|
|
1604
1403
|
user = user.substring(12);
|
|
1605
1404
|
}
|
|
1606
|
-
|
|
1607
1405
|
valFull.push({
|
|
1608
1406
|
t: texts.user,
|
|
1609
1407
|
v: user
|
|
1610
1408
|
});
|
|
1611
1409
|
}
|
|
1612
|
-
|
|
1613
1410
|
if (state.c) {
|
|
1614
1411
|
valFull.push({
|
|
1615
1412
|
t: texts.c,
|
|
1616
1413
|
v: state.c
|
|
1617
1414
|
});
|
|
1618
1415
|
}
|
|
1619
|
-
|
|
1620
1416
|
valFull.push({
|
|
1621
1417
|
t: texts.quality,
|
|
1622
1418
|
v: _Utils["default"].quality2text(state.q || 0).join(', '),
|
|
1623
1419
|
nbr: true
|
|
1624
1420
|
});
|
|
1625
1421
|
}
|
|
1626
|
-
|
|
1627
1422
|
valText.v = v;
|
|
1628
1423
|
return {
|
|
1629
1424
|
valText: valText,
|
|
@@ -1633,16 +1428,11 @@ function formatValue(id, state, obj, texts, dateFormat, isFloatComma) {
|
|
|
1633
1428
|
}
|
|
1634
1429
|
};
|
|
1635
1430
|
}
|
|
1636
|
-
|
|
1637
1431
|
function getSelectIdIcon(objects, id, imagePrefix) {
|
|
1638
1432
|
imagePrefix = imagePrefix || '.'; //http://localhost:8081';
|
|
1639
|
-
|
|
1640
1433
|
var src = '';
|
|
1641
|
-
|
|
1642
1434
|
var _id_ = 'system.adapter.' + id;
|
|
1643
|
-
|
|
1644
1435
|
var aIcon = id && objects[_id_] && objects[_id_].common && objects[_id_].common.icon;
|
|
1645
|
-
|
|
1646
1436
|
if (aIcon) {
|
|
1647
1437
|
// if not BASE64
|
|
1648
1438
|
if (!aIcon.startsWith('data:image/')) {
|
|
@@ -1666,36 +1456,29 @@ function getSelectIdIcon(objects, id, imagePrefix) {
|
|
|
1666
1456
|
}
|
|
1667
1457
|
} else {
|
|
1668
1458
|
var common = objects[id] && objects[id].common;
|
|
1669
|
-
|
|
1670
1459
|
if (common) {
|
|
1671
1460
|
var cIcon = common.icon;
|
|
1672
|
-
|
|
1673
1461
|
if (cIcon) {
|
|
1674
1462
|
if (!cIcon.startsWith('data:image/')) {
|
|
1675
1463
|
if (cIcon.includes('.')) {
|
|
1676
1464
|
var instance;
|
|
1677
|
-
|
|
1678
1465
|
if (objects[id].type === 'instance' || objects[id].type === 'adapter') {
|
|
1679
1466
|
src = "".concat(imagePrefix, "/adapter/").concat(common.name, "/").concat(cIcon);
|
|
1680
1467
|
} else if (id && id.startsWith('system.adapter.')) {
|
|
1681
1468
|
instance = id.split('.', 3);
|
|
1682
|
-
|
|
1683
1469
|
if (cIcon[0] === '/') {
|
|
1684
1470
|
instance[2] += cIcon;
|
|
1685
1471
|
} else {
|
|
1686
1472
|
instance[2] += '/' + cIcon;
|
|
1687
1473
|
}
|
|
1688
|
-
|
|
1689
1474
|
src = "".concat(imagePrefix, "/adapter/").concat(instance[2]);
|
|
1690
1475
|
} else {
|
|
1691
1476
|
instance = id.split('.', 2);
|
|
1692
|
-
|
|
1693
1477
|
if (cIcon[0] === '/') {
|
|
1694
1478
|
instance[0] += cIcon;
|
|
1695
1479
|
} else {
|
|
1696
1480
|
instance[0] += '/' + cIcon;
|
|
1697
1481
|
}
|
|
1698
|
-
|
|
1699
1482
|
src = "".concat(imagePrefix, "/adapter/").concat(instance[0]);
|
|
1700
1483
|
}
|
|
1701
1484
|
} else if (aIcon && aIcon.length < 3) {
|
|
@@ -1718,22 +1501,18 @@ function getSelectIdIcon(objects, id, imagePrefix) {
|
|
|
1718
1501
|
}
|
|
1719
1502
|
}
|
|
1720
1503
|
}
|
|
1721
|
-
|
|
1722
1504
|
return src || null;
|
|
1723
1505
|
}
|
|
1724
|
-
|
|
1725
1506
|
function prepareSparkData(values, from) {
|
|
1726
1507
|
// set every hour one point
|
|
1727
1508
|
var time = from;
|
|
1728
1509
|
var i = 1;
|
|
1729
1510
|
var v = [];
|
|
1730
|
-
|
|
1731
1511
|
while (i < values.length && time < from + 25 * 3600000) {
|
|
1732
1512
|
// find the interval
|
|
1733
1513
|
while (values[i - 1].ts < time && time <= values[i].ts && i < values.length) {
|
|
1734
1514
|
i++;
|
|
1735
1515
|
}
|
|
1736
|
-
|
|
1737
1516
|
if (i === 1 && values[i - 1].ts >= time) {
|
|
1738
1517
|
// assume the value was always null
|
|
1739
1518
|
v.push(0);
|
|
@@ -1743,23 +1522,20 @@ function prepareSparkData(values, from) {
|
|
|
1743
1522
|
} else {
|
|
1744
1523
|
// remove nulls
|
|
1745
1524
|
values[i - 1].val = values[i - 1].val || 0;
|
|
1746
|
-
values[i].val = values[i].val || 0;
|
|
1747
|
-
|
|
1525
|
+
values[i].val = values[i].val || 0;
|
|
1526
|
+
// interpolate
|
|
1748
1527
|
var val = values[i - 1].val + (values[i].val - values[i - 1].val) * (time - values[i - 1].ts) / (values[i].ts - values[i - 1].ts);
|
|
1749
1528
|
v.push(val);
|
|
1750
1529
|
}
|
|
1751
1530
|
}
|
|
1752
|
-
|
|
1753
1531
|
time += 3600000;
|
|
1754
1532
|
}
|
|
1755
|
-
|
|
1756
1533
|
return v;
|
|
1757
1534
|
}
|
|
1535
|
+
|
|
1758
1536
|
/**
|
|
1759
1537
|
* @type {import('./types').ObjectBrowserTableFilter}
|
|
1760
1538
|
*/
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
1539
|
var DEFAULT_FILTER = {
|
|
1764
1540
|
id: '',
|
|
1765
1541
|
name: '',
|
|
@@ -1897,41 +1673,33 @@ var SCREEN_WIDTHS = {
|
|
|
1897
1673
|
}
|
|
1898
1674
|
};
|
|
1899
1675
|
var objectsAlreadyLoaded = false;
|
|
1676
|
+
|
|
1900
1677
|
/**
|
|
1901
1678
|
* @extends {React.Component<import('./types').ObjectBrowserProps>}
|
|
1902
1679
|
*/
|
|
1903
|
-
|
|
1904
1680
|
var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
1905
1681
|
(0, _inherits2["default"])(ObjectBrowser, _Component);
|
|
1906
|
-
|
|
1907
1682
|
var _super = _createSuper(ObjectBrowser);
|
|
1908
|
-
|
|
1909
1683
|
/**
|
|
1910
1684
|
* @param {import('./types').ObjectBrowserProps} props
|
|
1911
1685
|
*/
|
|
1912
1686
|
function ObjectBrowser(props) {
|
|
1913
1687
|
var _this;
|
|
1914
|
-
|
|
1915
1688
|
(0, _classCallCheck2["default"])(this, ObjectBrowser);
|
|
1916
1689
|
_this = _super.call(this, props);
|
|
1917
1690
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onStateChange", function (id, state) {
|
|
1918
1691
|
console.log('> stateChange ' + id);
|
|
1919
|
-
|
|
1920
1692
|
if (_this.states[id]) {
|
|
1921
1693
|
var item = _this.findItem(id);
|
|
1922
|
-
|
|
1923
1694
|
if (item && item.data.state) {
|
|
1924
1695
|
item.data.state = null;
|
|
1925
1696
|
}
|
|
1926
1697
|
}
|
|
1927
|
-
|
|
1928
1698
|
_this.states[id] = state;
|
|
1929
|
-
|
|
1930
1699
|
if (!_this.pausedSubscribes) {
|
|
1931
1700
|
if (!_this.statesUpdateTimer) {
|
|
1932
1701
|
_this.statesUpdateTimer = setTimeout(function () {
|
|
1933
1702
|
_this.statesUpdateTimer = null;
|
|
1934
|
-
|
|
1935
1703
|
_this.forceUpdate();
|
|
1936
1704
|
}, 300);
|
|
1937
1705
|
}
|
|
@@ -1944,29 +1712,22 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
1944
1712
|
});
|
|
1945
1713
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onObjectChange", function (id, obj, oldObj) {
|
|
1946
1714
|
var newState;
|
|
1947
|
-
|
|
1948
1715
|
if (Array.isArray(id)) {
|
|
1949
1716
|
id.forEach(function (event) {
|
|
1950
1717
|
console.log('> objectChange ' + event.id);
|
|
1951
|
-
|
|
1952
1718
|
if (event.obj && typeof _this.props.filterFunc === 'function' && !_this.props.filterFunc(event.obj)) {
|
|
1953
1719
|
return;
|
|
1954
1720
|
}
|
|
1955
|
-
|
|
1956
1721
|
if (event.id.startsWith('system.adapter.') && event.obj && event.obj.type === 'adapter') {
|
|
1957
1722
|
var columnsForAdmin = JSON.parse(JSON.stringify(_this.state.columnsForAdmin));
|
|
1958
|
-
|
|
1959
1723
|
_this.parseObjectForAdmins(columnsForAdmin, event.obj);
|
|
1960
|
-
|
|
1961
1724
|
if (JSON.stringify(_this.state.columnsForAdmin) !== JSON.stringify(columnsForAdmin)) {
|
|
1962
1725
|
newState = {
|
|
1963
1726
|
columnsForAdmin: columnsForAdmin
|
|
1964
1727
|
};
|
|
1965
1728
|
}
|
|
1966
1729
|
}
|
|
1967
|
-
|
|
1968
1730
|
_this.objects = _this.objects || [];
|
|
1969
|
-
|
|
1970
1731
|
if (_this.objects[event.id]) {
|
|
1971
1732
|
if (event.obj) {
|
|
1972
1733
|
_this.objects[event.id] = event.obj;
|
|
@@ -1980,23 +1741,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
1980
1741
|
} else {
|
|
1981
1742
|
console.log('> objectChange ' + id);
|
|
1982
1743
|
_this.objects = _this.objects || [];
|
|
1983
|
-
|
|
1984
1744
|
if (obj && typeof _this.props.filterFunc === 'function' && !_this.props.filterFunc(obj)) {
|
|
1985
1745
|
return;
|
|
1986
1746
|
}
|
|
1987
|
-
|
|
1988
1747
|
if (id.startsWith('system.adapter.') && obj && obj.type === 'adapter') {
|
|
1989
1748
|
var columnsForAdmin = JSON.parse(JSON.stringify(_this.state.columnsForAdmin));
|
|
1990
|
-
|
|
1991
1749
|
_this.parseObjectForAdmins(columnsForAdmin, obj);
|
|
1992
|
-
|
|
1993
1750
|
if (JSON.stringify(_this.state.columnsForAdmin) !== JSON.stringify(columnsForAdmin)) {
|
|
1994
1751
|
newState = {
|
|
1995
1752
|
columnsForAdmin: columnsForAdmin
|
|
1996
1753
|
};
|
|
1997
1754
|
}
|
|
1998
1755
|
}
|
|
1999
|
-
|
|
2000
1756
|
if (_this.objects[id]) {
|
|
2001
1757
|
if (obj) {
|
|
2002
1758
|
_this.objects[id] = obj;
|
|
@@ -2007,34 +1763,28 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2007
1763
|
delete _this.objects[id];
|
|
2008
1764
|
}
|
|
2009
1765
|
}
|
|
2010
|
-
|
|
2011
1766
|
newState && _this.setState(newState);
|
|
2012
|
-
|
|
2013
1767
|
if (!_this.objectsUpdateTimer && _this.objects) {
|
|
2014
1768
|
_this.objectsUpdateTimer = setTimeout(function () {
|
|
2015
1769
|
_this.objectsUpdateTimer = null;
|
|
2016
|
-
|
|
2017
1770
|
var _buildTree = buildTree(_this.objects, _this.props),
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
1771
|
+
info = _buildTree.info,
|
|
1772
|
+
root = _buildTree.root;
|
|
2021
1773
|
_this.root = root;
|
|
2022
1774
|
_this.info = info;
|
|
2023
1775
|
_this.lastAppliedFilter = null; // apply filter anew
|
|
2024
1776
|
|
|
2025
1777
|
if (!_this.pausedSubscribes) {
|
|
2026
1778
|
_this.forceUpdate();
|
|
2027
|
-
}
|
|
2028
|
-
|
|
1779
|
+
}
|
|
1780
|
+
// else it will be re-rendered when dialog will be closed
|
|
2029
1781
|
}, 500);
|
|
2030
1782
|
}
|
|
2031
1783
|
});
|
|
2032
1784
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getEnumsForId", function (id) {
|
|
2033
1785
|
var result = [];
|
|
2034
|
-
|
|
2035
1786
|
_this.info.enums.forEach(function (_id) {
|
|
2036
1787
|
var _this$objects$_id, _this$objects$_id$com, _this$objects$_id$com2;
|
|
2037
|
-
|
|
2038
1788
|
if ((_this$objects$_id = _this.objects[_id]) !== null && _this$objects$_id !== void 0 && (_this$objects$_id$com = _this$objects$_id.common) !== null && _this$objects$_id$com !== void 0 && (_this$objects$_id$com2 = _this$objects$_id$com.members) !== null && _this$objects$_id$com2 !== void 0 && _this$objects$_id$com2.includes(id)) {
|
|
2039
1789
|
var en = {
|
|
2040
1790
|
_id: _this.objects[_id]._id,
|
|
@@ -2042,50 +1792,40 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2042
1792
|
"native": _this.objects[_id]["native"],
|
|
2043
1793
|
type: 'enum'
|
|
2044
1794
|
};
|
|
2045
|
-
|
|
2046
1795
|
if (en.common) {
|
|
2047
1796
|
delete en.common.members;
|
|
2048
1797
|
delete en.common.custom;
|
|
2049
1798
|
delete en.common.mobile;
|
|
2050
1799
|
}
|
|
2051
|
-
|
|
2052
1800
|
result.push(en);
|
|
2053
1801
|
}
|
|
2054
1802
|
});
|
|
2055
|
-
|
|
2056
1803
|
return result.length ? result : undefined;
|
|
2057
1804
|
});
|
|
2058
1805
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_createAllEnums", /*#__PURE__*/function () {
|
|
2059
1806
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(enums, objId) {
|
|
2060
1807
|
var e, _enObj$common, _enObj$common$members, id, _enObj, enObj;
|
|
2061
|
-
|
|
2062
1808
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
2063
1809
|
while (1) {
|
|
2064
1810
|
switch (_context.prev = _context.next) {
|
|
2065
1811
|
case 0:
|
|
2066
1812
|
e = 0;
|
|
2067
|
-
|
|
2068
1813
|
case 1:
|
|
2069
1814
|
if (!(e < enums.length)) {
|
|
2070
1815
|
_context.next = 24;
|
|
2071
1816
|
break;
|
|
2072
1817
|
}
|
|
2073
|
-
|
|
2074
1818
|
id = enums[e];
|
|
2075
1819
|
_enObj = void 0;
|
|
2076
|
-
|
|
2077
1820
|
if ((0, _typeof2["default"])(id) === 'object') {
|
|
2078
1821
|
_enObj = id;
|
|
2079
1822
|
id = id._id;
|
|
2080
1823
|
}
|
|
2081
|
-
|
|
2082
1824
|
enObj = _this.objects[id];
|
|
2083
|
-
|
|
2084
1825
|
if (enObj) {
|
|
2085
1826
|
_context.next = 14;
|
|
2086
1827
|
break;
|
|
2087
1828
|
}
|
|
2088
|
-
|
|
2089
1829
|
enObj = _enObj || {
|
|
2090
1830
|
_id: id,
|
|
2091
1831
|
common: {
|
|
@@ -2098,30 +1838,25 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2098
1838
|
enObj.common.members = [objId];
|
|
2099
1839
|
_context.next = 12;
|
|
2100
1840
|
return _this.props.socket.setObject(id, enObj);
|
|
2101
|
-
|
|
2102
1841
|
case 12:
|
|
2103
1842
|
_context.next = 21;
|
|
2104
1843
|
break;
|
|
2105
|
-
|
|
2106
1844
|
case 14:
|
|
2107
1845
|
if ((_enObj$common = enObj.common) !== null && _enObj$common !== void 0 && (_enObj$common$members = _enObj$common.members) !== null && _enObj$common$members !== void 0 && _enObj$common$members.includes(objId)) {
|
|
2108
1846
|
_context.next = 21;
|
|
2109
1847
|
break;
|
|
2110
1848
|
}
|
|
2111
|
-
|
|
2112
1849
|
enObj.common = enObj.common || {};
|
|
2113
|
-
enObj.common.members = enObj.common.members || [];
|
|
2114
|
-
|
|
1850
|
+
enObj.common.members = enObj.common.members || [];
|
|
1851
|
+
// add missing object
|
|
2115
1852
|
enObj.common.members.push(objId);
|
|
2116
1853
|
enObj.common.members.sort();
|
|
2117
1854
|
_context.next = 21;
|
|
2118
1855
|
return _this.props.socket.setObject(id, enObj);
|
|
2119
|
-
|
|
2120
1856
|
case 21:
|
|
2121
1857
|
e++;
|
|
2122
1858
|
_context.next = 1;
|
|
2123
1859
|
break;
|
|
2124
|
-
|
|
2125
1860
|
case 24:
|
|
2126
1861
|
case "end":
|
|
2127
1862
|
return _context.stop();
|
|
@@ -2129,7 +1864,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2129
1864
|
}
|
|
2130
1865
|
}, _callee);
|
|
2131
1866
|
}));
|
|
2132
|
-
|
|
2133
1867
|
return function (_x, _x2) {
|
|
2134
1868
|
return _ref.apply(this, arguments);
|
|
2135
1869
|
};
|
|
@@ -2145,103 +1879,79 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2145
1879
|
_context2.next = 42;
|
|
2146
1880
|
break;
|
|
2147
1881
|
}
|
|
2148
|
-
|
|
2149
1882
|
_context2.t0 = _regenerator["default"].keys(objs);
|
|
2150
|
-
|
|
2151
1883
|
case 2:
|
|
2152
1884
|
if ((_context2.t1 = _context2.t0()).done) {
|
|
2153
1885
|
_context2.next = 42;
|
|
2154
1886
|
break;
|
|
2155
1887
|
}
|
|
2156
|
-
|
|
2157
1888
|
id = _context2.t1.value;
|
|
2158
|
-
|
|
2159
1889
|
if (!(!objs.hasOwnProperty(id) || !objs[id])) {
|
|
2160
1890
|
_context2.next = 6;
|
|
2161
1891
|
break;
|
|
2162
1892
|
}
|
|
2163
|
-
|
|
2164
1893
|
return _context2.abrupt("continue", 2);
|
|
2165
|
-
|
|
2166
1894
|
case 6:
|
|
2167
1895
|
obj = objs[id];
|
|
2168
1896
|
enums = null;
|
|
2169
|
-
|
|
2170
1897
|
if (obj && obj.common && obj.common.enums) {
|
|
2171
1898
|
enums = obj.common.enums;
|
|
2172
1899
|
delete obj.common.enums;
|
|
2173
1900
|
} else {
|
|
2174
1901
|
enums = null;
|
|
2175
1902
|
}
|
|
2176
|
-
|
|
2177
1903
|
_context2.prev = 9;
|
|
2178
1904
|
_context2.next = 12;
|
|
2179
1905
|
return _this.props.socket.setObject(id, obj);
|
|
2180
|
-
|
|
2181
1906
|
case 12:
|
|
2182
1907
|
_context2.t2 = enums;
|
|
2183
|
-
|
|
2184
1908
|
if (!_context2.t2) {
|
|
2185
1909
|
_context2.next = 16;
|
|
2186
1910
|
break;
|
|
2187
1911
|
}
|
|
2188
|
-
|
|
2189
1912
|
_context2.next = 16;
|
|
2190
1913
|
return _this._createAllEnums(enums, obj._id);
|
|
2191
|
-
|
|
2192
1914
|
case 16:
|
|
2193
1915
|
if (!(obj.type === 'state')) {
|
|
2194
1916
|
_context2.next = 35;
|
|
2195
1917
|
break;
|
|
2196
1918
|
}
|
|
2197
|
-
|
|
2198
1919
|
_context2.prev = 17;
|
|
2199
1920
|
_context2.next = 20;
|
|
2200
1921
|
return _this.props.socket.getState(obj._id);
|
|
2201
|
-
|
|
2202
1922
|
case 20:
|
|
2203
1923
|
state = _context2.sent;
|
|
2204
|
-
|
|
2205
1924
|
if (!(!state || state.val === null)) {
|
|
2206
1925
|
_context2.next = 30;
|
|
2207
1926
|
break;
|
|
2208
1927
|
}
|
|
2209
|
-
|
|
2210
1928
|
_context2.prev = 22;
|
|
2211
1929
|
_context2.next = 25;
|
|
2212
1930
|
return _this.props.socket.setState(obj._id, !obj.common || obj.common.def === undefined ? null : obj.common.def, true);
|
|
2213
|
-
|
|
2214
1931
|
case 25:
|
|
2215
1932
|
_context2.next = 30;
|
|
2216
1933
|
break;
|
|
2217
|
-
|
|
2218
1934
|
case 27:
|
|
2219
1935
|
_context2.prev = 27;
|
|
2220
1936
|
_context2.t3 = _context2["catch"](22);
|
|
2221
1937
|
window.alert("Cannot set state \"".concat(obj._id, "\": ").concat(_context2.t3));
|
|
2222
|
-
|
|
2223
1938
|
case 30:
|
|
2224
1939
|
_context2.next = 35;
|
|
2225
1940
|
break;
|
|
2226
|
-
|
|
2227
1941
|
case 32:
|
|
2228
1942
|
_context2.prev = 32;
|
|
2229
1943
|
_context2.t4 = _context2["catch"](17);
|
|
2230
1944
|
window.alert("Cannot read state \"".concat(obj._id, "\": ").concat(_context2.t4));
|
|
2231
|
-
|
|
2232
1945
|
case 35:
|
|
2233
1946
|
_context2.next = 40;
|
|
2234
1947
|
break;
|
|
2235
|
-
|
|
2236
1948
|
case 37:
|
|
2237
1949
|
_context2.prev = 37;
|
|
2238
1950
|
_context2.t5 = _context2["catch"](9);
|
|
2239
1951
|
window.alert(_context2.t5);
|
|
2240
|
-
|
|
2241
1952
|
case 40:
|
|
2242
1953
|
_context2.next = 2;
|
|
2243
1954
|
break;
|
|
2244
|
-
|
|
2245
1955
|
case 42:
|
|
2246
1956
|
case "end":
|
|
2247
1957
|
return _context2.stop();
|
|
@@ -2249,17 +1959,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2249
1959
|
}
|
|
2250
1960
|
}, _callee2, null, [[9, 37], [17, 32], [22, 27]]);
|
|
2251
1961
|
}));
|
|
2252
|
-
|
|
2253
1962
|
return function (_x3) {
|
|
2254
1963
|
return _ref2.apply(this, arguments);
|
|
2255
1964
|
};
|
|
2256
1965
|
}());
|
|
2257
1966
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleJsonUpload", function (evt) {
|
|
2258
1967
|
var f = evt.target.files[0];
|
|
2259
|
-
|
|
2260
1968
|
if (f) {
|
|
2261
1969
|
var r = new FileReader();
|
|
2262
|
-
|
|
2263
1970
|
r.onload = /*#__PURE__*/function () {
|
|
2264
1971
|
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(e) {
|
|
2265
1972
|
var contents, json, len, id, enums, state;
|
|
@@ -2272,87 +1979,67 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2272
1979
|
json = JSON.parse(contents);
|
|
2273
1980
|
len = Object.keys(json).length;
|
|
2274
1981
|
id = json._id;
|
|
2275
|
-
|
|
2276
1982
|
if (!(id === undefined && len)) {
|
|
2277
1983
|
_context3.next = 11;
|
|
2278
1984
|
break;
|
|
2279
1985
|
}
|
|
2280
|
-
|
|
2281
1986
|
_context3.next = 8;
|
|
2282
1987
|
return _this.loadObjects(json);
|
|
2283
|
-
|
|
2284
1988
|
case 8:
|
|
2285
1989
|
window.alert(_this.props.t('ra_%s object(s) processed', len));
|
|
2286
1990
|
_context3.next = 33;
|
|
2287
1991
|
break;
|
|
2288
|
-
|
|
2289
1992
|
case 11:
|
|
2290
1993
|
if (id) {
|
|
2291
1994
|
_context3.next = 13;
|
|
2292
1995
|
break;
|
|
2293
1996
|
}
|
|
2294
|
-
|
|
2295
1997
|
return _context3.abrupt("return", window.alert(_this.props.t('ra_Invalid structure')));
|
|
2296
|
-
|
|
2297
1998
|
case 13:
|
|
2298
1999
|
_context3.prev = 13;
|
|
2299
|
-
|
|
2300
2000
|
if (json.common.enums) {
|
|
2301
2001
|
enums = json.common.enums;
|
|
2302
2002
|
delete json.common.enums;
|
|
2303
2003
|
}
|
|
2304
|
-
|
|
2305
2004
|
_context3.next = 17;
|
|
2306
2005
|
return _this.props.socket.setObject(json._id, json);
|
|
2307
|
-
|
|
2308
2006
|
case 17:
|
|
2309
2007
|
if (!(json.type === 'state')) {
|
|
2310
2008
|
_context3.next = 24;
|
|
2311
2009
|
break;
|
|
2312
2010
|
}
|
|
2313
|
-
|
|
2314
2011
|
_context3.next = 20;
|
|
2315
2012
|
return _this.props.socket.getState(json._id);
|
|
2316
|
-
|
|
2317
2013
|
case 20:
|
|
2318
2014
|
state = _context3.sent;
|
|
2319
|
-
|
|
2320
2015
|
if (!(!state || state.val === null || state.val === undefined)) {
|
|
2321
2016
|
_context3.next = 24;
|
|
2322
2017
|
break;
|
|
2323
2018
|
}
|
|
2324
|
-
|
|
2325
2019
|
_context3.next = 24;
|
|
2326
2020
|
return _this.props.socket.getState(json._id, json.common.def === undefined ? null : json.common.def, true);
|
|
2327
|
-
|
|
2328
2021
|
case 24:
|
|
2329
2022
|
if (!enums) {
|
|
2330
2023
|
_context3.next = 27;
|
|
2331
2024
|
break;
|
|
2332
2025
|
}
|
|
2333
|
-
|
|
2334
2026
|
_context3.next = 27;
|
|
2335
2027
|
return _this._createAllEnums(enums, json._id);
|
|
2336
|
-
|
|
2337
2028
|
case 27:
|
|
2338
2029
|
window.alert(_this.props.t('ra_%s was imported', json._id));
|
|
2339
2030
|
_context3.next = 33;
|
|
2340
2031
|
break;
|
|
2341
|
-
|
|
2342
2032
|
case 30:
|
|
2343
2033
|
_context3.prev = 30;
|
|
2344
2034
|
_context3.t0 = _context3["catch"](13);
|
|
2345
2035
|
window.alert(_context3.t0);
|
|
2346
|
-
|
|
2347
2036
|
case 33:
|
|
2348
2037
|
_context3.next = 38;
|
|
2349
2038
|
break;
|
|
2350
|
-
|
|
2351
2039
|
case 35:
|
|
2352
2040
|
_context3.prev = 35;
|
|
2353
2041
|
_context3.t1 = _context3["catch"](1);
|
|
2354
2042
|
window.alert(_context3.t1);
|
|
2355
|
-
|
|
2356
2043
|
case 38:
|
|
2357
2044
|
case "end":
|
|
2358
2045
|
return _context3.stop();
|
|
@@ -2360,12 +2047,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2360
2047
|
}
|
|
2361
2048
|
}, _callee3, null, [[1, 35], [13, 30]]);
|
|
2362
2049
|
}));
|
|
2363
|
-
|
|
2364
2050
|
return function (_x4) {
|
|
2365
2051
|
return _ref3.apply(this, arguments);
|
|
2366
2052
|
};
|
|
2367
2053
|
}();
|
|
2368
|
-
|
|
2369
2054
|
r.readAsText(f);
|
|
2370
2055
|
} else {
|
|
2371
2056
|
window.alert(_this.props.t('ra_Failed to open JSON File'));
|
|
@@ -2373,7 +2058,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2373
2058
|
});
|
|
2374
2059
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toolTipObjectCreating", function () {
|
|
2375
2060
|
var _this$objects$id2;
|
|
2376
|
-
|
|
2377
2061
|
var t = _this.props.t;
|
|
2378
2062
|
var value = [/*#__PURE__*/_react["default"].createElement("div", {
|
|
2379
2063
|
key: 1
|
|
@@ -2397,13 +2081,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2397
2081
|
}, t('ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
2398
2082
|
key: 9
|
|
2399
2083
|
}, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];
|
|
2400
|
-
|
|
2401
2084
|
if (_this.state.selected.length || _this.state.selectedNonObject) {
|
|
2402
2085
|
var _this$objects$id;
|
|
2403
|
-
|
|
2404
2086
|
var id = _this.state.selected[0] || _this.state.selectedNonObject;
|
|
2405
|
-
|
|
2406
|
-
|
|
2087
|
+
if (id.split('.').length < 2 || _this.objects[id] && ((_this$objects$id = _this.objects[id]) === null || _this$objects$id === void 0 ? void 0 : _this$objects$id.type) === 'state') {
|
|
2088
|
+
// show default tooltip
|
|
2407
2089
|
} else {
|
|
2408
2090
|
if (_this.state.filter.expertMode) {
|
|
2409
2091
|
switch ((_this$objects$id2 = _this.objects[id]) === null || _this$objects$id2 === void 0 ? void 0 : _this$objects$id2.type) {
|
|
@@ -2423,7 +2105,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2423
2105
|
key: 9
|
|
2424
2106
|
}, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];
|
|
2425
2107
|
break;
|
|
2426
|
-
|
|
2427
2108
|
case 'folder':
|
|
2428
2109
|
value = [/*#__PURE__*/_react["default"].createElement("div", {
|
|
2429
2110
|
key: 1
|
|
@@ -2444,7 +2125,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2444
2125
|
key: 9
|
|
2445
2126
|
}, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];
|
|
2446
2127
|
break;
|
|
2447
|
-
|
|
2448
2128
|
case 'channel':
|
|
2449
2129
|
value = [/*#__PURE__*/_react["default"].createElement("div", {
|
|
2450
2130
|
key: 1
|
|
@@ -2461,7 +2141,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2461
2141
|
key: 9
|
|
2462
2142
|
}, t('ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").'))];
|
|
2463
2143
|
break;
|
|
2464
|
-
|
|
2465
2144
|
default:
|
|
2466
2145
|
break;
|
|
2467
2146
|
}
|
|
@@ -2491,7 +2170,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2491
2170
|
}
|
|
2492
2171
|
}
|
|
2493
2172
|
}
|
|
2494
|
-
|
|
2495
2173
|
return value.length ? value : t('ra_Add new child object to selected parent');
|
|
2496
2174
|
});
|
|
2497
2175
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderTooltipAccessControl", function (acl) {
|
|
@@ -2499,7 +2177,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2499
2177
|
if (!acl) {
|
|
2500
2178
|
return null;
|
|
2501
2179
|
}
|
|
2502
|
-
|
|
2503
2180
|
var check = [{
|
|
2504
2181
|
value: '0x400',
|
|
2505
2182
|
valueNum: 0x400,
|
|
@@ -2532,7 +2209,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2532
2209
|
group: 'Everyone'
|
|
2533
2210
|
}];
|
|
2534
2211
|
var arrayTooltipText = [];
|
|
2535
|
-
|
|
2536
2212
|
var funcRenderStateObject = function funcRenderStateObject() {
|
|
2537
2213
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'object';
|
|
2538
2214
|
var rights = acl[value];
|
|
@@ -2546,7 +2222,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2546
2222
|
}
|
|
2547
2223
|
});
|
|
2548
2224
|
};
|
|
2549
|
-
|
|
2550
2225
|
arrayTooltipText.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
2551
2226
|
key: "group"
|
|
2552
2227
|
}, _this.texts.ownerGroup + ': ' + (acl.ownerGroup || '').replace('system.group.', '')));
|
|
@@ -2554,11 +2229,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2554
2229
|
key: "owner"
|
|
2555
2230
|
}, _this.texts.ownerUser + ': ' + (acl.owner || '').replace('system.user.', '')));
|
|
2556
2231
|
funcRenderStateObject();
|
|
2557
|
-
|
|
2558
2232
|
if (acl.state) {
|
|
2559
2233
|
funcRenderStateObject('state');
|
|
2560
2234
|
}
|
|
2561
|
-
|
|
2562
2235
|
return arrayTooltipText.length ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
2563
2236
|
className: _this.props.classes.tooltipAccessControl
|
|
2564
2237
|
}, arrayTooltipText.map(function (el) {
|
|
@@ -2569,7 +2242,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2569
2242
|
if (_this.resizerActiveDiv) {
|
|
2570
2243
|
var width;
|
|
2571
2244
|
var widthNext;
|
|
2572
|
-
|
|
2573
2245
|
if (_this.resizeLeft) {
|
|
2574
2246
|
width = _this.resizerOldWidth - e.clientX + _this.resizerPosition;
|
|
2575
2247
|
widthNext = _this.resizerOldWidthNext + e.clientX - _this.resizerPosition;
|
|
@@ -2577,7 +2249,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2577
2249
|
width = _this.resizerOldWidth + e.clientX - _this.resizerPosition;
|
|
2578
2250
|
widthNext = _this.resizerOldWidthNext - e.clientX + _this.resizerPosition;
|
|
2579
2251
|
}
|
|
2580
|
-
|
|
2581
2252
|
if ((!_this.resizerMin || width > _this.resizerMin) && (!_this.resizerNextMin || widthNext > _this.resizerNextMin)) {
|
|
2582
2253
|
_this.resizerCurrentWidths[_this.resizerActiveName] = width;
|
|
2583
2254
|
_this.resizerCurrentWidths[_this.resizerNextName] = widthNext;
|
|
@@ -2585,7 +2256,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2585
2256
|
_this.resizerNextDiv.style.width = widthNext + 'px';
|
|
2586
2257
|
_this.columnsVisibility[_this.resizerActiveName] = width;
|
|
2587
2258
|
_this.columnsVisibility[_this.resizerNextName] = widthNext;
|
|
2588
|
-
|
|
2589
2259
|
if (_this.resizerNextName === 'nameHeader') {
|
|
2590
2260
|
_this.columnsVisibility['name'] = widthNext - _this.state.scrollBarWidth;
|
|
2591
2261
|
_this.resizerCurrentWidths['name'] = widthNext - _this.state.scrollBarWidth;
|
|
@@ -2593,12 +2263,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2593
2263
|
_this.columnsVisibility['name'] = width - _this.state.scrollBarWidth;
|
|
2594
2264
|
_this.resizerCurrentWidths['name'] = width - _this.state.scrollBarWidth;
|
|
2595
2265
|
}
|
|
2596
|
-
|
|
2597
2266
|
_this.customWidth = true;
|
|
2598
2267
|
_this.resizeTimeout && clearTimeout(_this.resizeTimeout);
|
|
2599
2268
|
_this.resizeTimeout = setTimeout(function () {
|
|
2600
2269
|
_this.resizeTimeout = null;
|
|
2601
|
-
|
|
2602
2270
|
_this.forceUpdate();
|
|
2603
2271
|
}, 200);
|
|
2604
2272
|
}
|
|
@@ -2618,24 +2286,19 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2618
2286
|
if (!_this.storedWidths) {
|
|
2619
2287
|
_this.storedWidths = JSON.parse(JSON.stringify(SCREEN_WIDTHS[_this.props.width]));
|
|
2620
2288
|
}
|
|
2621
|
-
|
|
2622
2289
|
_this.resizerCurrentWidths = _this.resizerCurrentWidths || {};
|
|
2623
2290
|
_this.resizerActiveDiv = e.target.parentNode;
|
|
2624
2291
|
_this.resizerActiveName = _this.resizerActiveDiv.dataset.name;
|
|
2625
2292
|
var i = 0;
|
|
2626
|
-
|
|
2627
2293
|
if (e.target.dataset.left === 'true') {
|
|
2628
2294
|
_this.resizeLeft = true;
|
|
2629
2295
|
_this.resizerNextDiv = _this.resizerActiveDiv.previousElementSibling;
|
|
2630
|
-
|
|
2631
2296
|
var handle = _this.resizerNextDiv.querySelector('.' + _this.props.classes.resizeHandle);
|
|
2632
|
-
|
|
2633
2297
|
while (_this.resizerNextDiv && !handle && i < 10) {
|
|
2634
2298
|
_this.resizerNextDiv = _this.resizerNextDiv.previousElementSibling;
|
|
2635
2299
|
handle = _this.resizerNextDiv.querySelector('.' + _this.props.classes.resizeHandle);
|
|
2636
2300
|
i++;
|
|
2637
2301
|
}
|
|
2638
|
-
|
|
2639
2302
|
if (handle && handle.dataset.left !== 'true') {
|
|
2640
2303
|
_this.resizerNextDiv = _this.resizerNextDiv.nextElementSibling;
|
|
2641
2304
|
}
|
|
@@ -2663,11 +2326,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2663
2326
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "resizerReset", function () {
|
|
2664
2327
|
_this.customWidth = false;
|
|
2665
2328
|
SCREEN_WIDTHS[_this.props.width] = JSON.parse(JSON.stringify(_this.storedWidths));
|
|
2666
|
-
|
|
2667
2329
|
_this.calculateColumnsVisibility();
|
|
2668
|
-
|
|
2669
2330
|
(window._localStorage || window.localStorage).removeItem("".concat(_this.props.dialogName || 'App', ".table"));
|
|
2670
|
-
|
|
2671
2331
|
_this.forceUpdate();
|
|
2672
2332
|
});
|
|
2673
2333
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "extendObject", function (id, data) {
|
|
@@ -2681,29 +2341,22 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2681
2341
|
});
|
|
2682
2342
|
});
|
|
2683
2343
|
_this.lastSelectedItems = (window._localStorage || window.localStorage).getItem("".concat(props.dialogName || 'App', ".objectSelected")) || '[]';
|
|
2684
|
-
|
|
2685
2344
|
try {
|
|
2686
2345
|
_this.lastSelectedItems = JSON.parse(_this.lastSelectedItems);
|
|
2687
|
-
|
|
2688
2346
|
if ((0, _typeof2["default"])(_this.lastSelectedItems) !== 'object') {
|
|
2689
2347
|
_this.lastSelectedItems = [_this.lastSelectedItems];
|
|
2690
2348
|
}
|
|
2691
|
-
|
|
2692
2349
|
_this.lastSelectedItems = _this.lastSelectedItems.filter(function (id) {
|
|
2693
2350
|
return id;
|
|
2694
2351
|
});
|
|
2695
2352
|
} catch (e) {}
|
|
2696
|
-
|
|
2697
2353
|
var expanded = (window._localStorage || window.localStorage).getItem("".concat(props.dialogName || 'App', ".objectExpanded")) || '[]';
|
|
2698
|
-
|
|
2699
2354
|
try {
|
|
2700
2355
|
expanded = JSON.parse(expanded);
|
|
2701
2356
|
} catch (e) {
|
|
2702
2357
|
expanded = [];
|
|
2703
2358
|
}
|
|
2704
|
-
|
|
2705
2359
|
var filter = props.defaultFilters || (window._localStorage || window.localStorage).getItem("".concat(props.dialogName || 'App', ".objectFilter")) || Object.assign({}, DEFAULT_FILTER);
|
|
2706
|
-
|
|
2707
2360
|
if (typeof filter === 'string') {
|
|
2708
2361
|
try {
|
|
2709
2362
|
filter = JSON.parse(filter);
|
|
@@ -2711,7 +2364,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2711
2364
|
filter = Object.assign({}, DEFAULT_FILTER);
|
|
2712
2365
|
}
|
|
2713
2366
|
}
|
|
2714
|
-
|
|
2715
2367
|
filter.expertMode = props.expertMode !== undefined ? props.expertMode : (window._sessionStorage || window.sessionStorage).getItem('App.expertMode') === 'true';
|
|
2716
2368
|
_this.tableRef = /*#__PURE__*/(0, _react.createRef)();
|
|
2717
2369
|
_this.filterRefs = {};
|
|
@@ -2726,57 +2378,44 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2726
2378
|
_this.subscribes = [];
|
|
2727
2379
|
_this.statesUpdateTimer = null;
|
|
2728
2380
|
_this.objectsUpdateTimer = null;
|
|
2729
|
-
_this.visibleCols = props.columns || SCREEN_WIDTHS[props.width].fields;
|
|
2730
|
-
|
|
2381
|
+
_this.visibleCols = props.columns || SCREEN_WIDTHS[props.width].fields;
|
|
2382
|
+
// remove type column if only one type must be selected
|
|
2731
2383
|
if (props.types && props.types.length === 1) {
|
|
2732
2384
|
var pos = _this.visibleCols.indexOf('type');
|
|
2733
|
-
|
|
2734
2385
|
pos !== -1 && _this.visibleCols.splice(pos, 1);
|
|
2735
2386
|
}
|
|
2736
|
-
|
|
2737
2387
|
_this.possibleCols = SCREEN_WIDTHS.xl.fields;
|
|
2738
2388
|
var customDialog = null;
|
|
2739
|
-
|
|
2740
2389
|
if (props.router) {
|
|
2741
2390
|
var location = props.router.getLocation();
|
|
2742
|
-
|
|
2743
2391
|
if (location.id && location.dialog === 'customs') {
|
|
2744
2392
|
customDialog = [location.id];
|
|
2745
|
-
|
|
2746
2393
|
_this.pauseSubscribe(true);
|
|
2747
2394
|
}
|
|
2748
2395
|
}
|
|
2749
|
-
|
|
2750
2396
|
var selected = props.selected || '';
|
|
2751
|
-
|
|
2752
2397
|
if ((0, _typeof2["default"])(selected) !== 'object') {
|
|
2753
2398
|
selected = [selected];
|
|
2754
2399
|
}
|
|
2755
|
-
|
|
2756
2400
|
selected = selected.map(function (id) {
|
|
2757
2401
|
return id.replace(/["']/g, '');
|
|
2758
2402
|
}).filter(function (id) {
|
|
2759
2403
|
return id;
|
|
2760
2404
|
});
|
|
2761
2405
|
var columns = null; // (window._localStorage || window.localStorage).getItem(`${props.dialogName || 'App'}.columns`);
|
|
2762
|
-
|
|
2763
2406
|
try {
|
|
2764
2407
|
columns = columns ? JSON.parse(columns) : null;
|
|
2765
2408
|
} catch (e) {
|
|
2766
2409
|
columns = null;
|
|
2767
2410
|
}
|
|
2768
|
-
|
|
2769
2411
|
var columnsWidths = null; // (window._localStorage || window.localStorage).getItem(`${props.dialogName || 'App'}.columnsWidths`);
|
|
2770
|
-
|
|
2771
2412
|
try {
|
|
2772
2413
|
columnsWidths = columnsWidths ? JSON.parse(columnsWidths) : {};
|
|
2773
2414
|
} catch (e) {
|
|
2774
2415
|
columnsWidths = {};
|
|
2775
2416
|
}
|
|
2776
|
-
|
|
2777
2417
|
_this.imagePrefix = props.imagePrefix || '.';
|
|
2778
2418
|
var foldersFirst = (window._localStorage || window.localStorage).getItem((props.dialogName || 'App') + '.foldersFirst');
|
|
2779
|
-
|
|
2780
2419
|
if (foldersFirst === 'false') {
|
|
2781
2420
|
foldersFirst = false;
|
|
2782
2421
|
} else if (foldersFirst === 'true') {
|
|
@@ -2784,14 +2423,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2784
2423
|
} else {
|
|
2785
2424
|
foldersFirst = props.foldersFirst === undefined ? true : props.foldersFirst;
|
|
2786
2425
|
}
|
|
2787
|
-
|
|
2788
2426
|
var statesView = false;
|
|
2789
|
-
|
|
2790
2427
|
try {
|
|
2791
2428
|
statesView = _this.props.objectStatesView ? JSON.parse((window._localStorage || window.localStorage).getItem((props.dialogName || 'App') + '.objectStatesView')) || false : false;
|
|
2792
|
-
} catch (error) {
|
|
2429
|
+
} catch (error) {
|
|
2430
|
+
// ignore
|
|
2793
2431
|
}
|
|
2794
|
-
|
|
2795
2432
|
_this.state = {
|
|
2796
2433
|
loaded: false,
|
|
2797
2434
|
foldersFirst: foldersFirst,
|
|
@@ -2878,7 +2515,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2878
2515
|
};
|
|
2879
2516
|
_this.levelPadding = props.levelPadding || ITEM_LEVEL;
|
|
2880
2517
|
var resizerCurrentWidths = (window._localStorage || window.localStorage).getItem("".concat(_this.props.dialogName || 'App', ".table"));
|
|
2881
|
-
|
|
2882
2518
|
if (resizerCurrentWidths) {
|
|
2883
2519
|
try {
|
|
2884
2520
|
resizerCurrentWidths = JSON.parse(resizerCurrentWidths);
|
|
@@ -2893,20 +2529,17 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2893
2529
|
}
|
|
2894
2530
|
});
|
|
2895
2531
|
_this.customWidth = true;
|
|
2896
|
-
} catch (e) {
|
|
2532
|
+
} catch (e) {
|
|
2533
|
+
// ignore
|
|
2897
2534
|
}
|
|
2898
2535
|
}
|
|
2899
|
-
|
|
2900
2536
|
_this.calculateColumnsVisibility();
|
|
2901
|
-
|
|
2902
2537
|
return _this;
|
|
2903
2538
|
}
|
|
2904
|
-
|
|
2905
2539
|
(0, _createClass2["default"])(ObjectBrowser, [{
|
|
2906
2540
|
key: "loadAllObjects",
|
|
2907
2541
|
value: function loadAllObjects(update) {
|
|
2908
2542
|
var _this2 = this;
|
|
2909
|
-
|
|
2910
2543
|
var props = this.props;
|
|
2911
2544
|
var objects;
|
|
2912
2545
|
return new Promise(function (resolve) {
|
|
@@ -2919,12 +2552,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2919
2552
|
return _this2.props.objectsWorker ? _this2.props.objectsWorker.getObjects(update) : props.socket.getObjects(update, true);
|
|
2920
2553
|
}).then(function (_objects) {
|
|
2921
2554
|
objects = _objects;
|
|
2922
|
-
|
|
2923
2555
|
if (props.types && props.types[0] !== 'state') {
|
|
2924
2556
|
if (props.length >= 1) {
|
|
2925
2557
|
console.error('more than one type does not supported! Use filterFunc instead');
|
|
2926
2558
|
}
|
|
2927
|
-
|
|
2928
2559
|
return props.socket.getObjectView(null, null, props.types[0]);
|
|
2929
2560
|
} else {
|
|
2930
2561
|
return !objects['system.config'] ? props.socket.getObject('system.config').then(function (obj) {
|
|
@@ -2935,30 +2566,24 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2935
2566
|
}
|
|
2936
2567
|
}).then(function (moreObjects) {
|
|
2937
2568
|
_this2.systemConfig = objects['system.config'] || moreObjects['system.config'] || {};
|
|
2938
|
-
|
|
2939
2569
|
if (moreObjects) {
|
|
2940
2570
|
if (moreObjects['system.config']) {
|
|
2941
2571
|
delete moreObjects['system.config'];
|
|
2942
2572
|
}
|
|
2943
|
-
|
|
2944
2573
|
Object.assign(objects, moreObjects);
|
|
2945
2574
|
}
|
|
2946
|
-
|
|
2947
2575
|
_this2.systemConfig.common = _this2.systemConfig.common || {};
|
|
2948
2576
|
_this2.systemConfig.common.defaultNewAcl = _this2.systemConfig.common.defaultNewAcl || {};
|
|
2949
2577
|
_this2.systemConfig.common.defaultNewAcl.owner = _this2.systemConfig.common.defaultNewAcl.owner || 'system.user.admin';
|
|
2950
2578
|
_this2.systemConfig.common.defaultNewAcl.ownerGroup = _this2.systemConfig.common.defaultNewAcl.ownerGroup || 'system.group.administrator';
|
|
2951
|
-
|
|
2952
2579
|
if (typeof _this2.systemConfig.common.defaultNewAcl.state !== 'number') {
|
|
2953
2580
|
// TODO: may be convert here from string
|
|
2954
2581
|
_this2.systemConfig.common.defaultNewAcl.state = 0x664;
|
|
2955
2582
|
}
|
|
2956
|
-
|
|
2957
2583
|
if (typeof _this2.systemConfig.common.defaultNewAcl.object !== 'number') {
|
|
2958
2584
|
// TODO: may be convert here from string
|
|
2959
2585
|
_this2.systemConfig.common.defaultNewAcl.state = 0x664;
|
|
2960
2586
|
}
|
|
2961
|
-
|
|
2962
2587
|
if (typeof props.filterFunc === 'function') {
|
|
2963
2588
|
_this2.objects = {};
|
|
2964
2589
|
Object.keys(objects).forEach(function (id) {
|
|
@@ -2973,19 +2598,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2973
2598
|
} else if (props.types) {
|
|
2974
2599
|
_this2.objects = {};
|
|
2975
2600
|
Object.keys(objects).forEach(function (id) {
|
|
2976
|
-
var type = objects[id] && objects[id].type;
|
|
2977
|
-
|
|
2601
|
+
var type = objects[id] && objects[id].type;
|
|
2602
|
+
// include "folder" types too
|
|
2978
2603
|
if (type && (type === 'channel' || type === 'device' || type === 'enum' || type === 'folder' || type === 'adapter' || type === 'instance' || props.types.includes(type))) {
|
|
2979
2604
|
_this2.objects[id] = objects[id];
|
|
2980
2605
|
}
|
|
2981
2606
|
});
|
|
2982
2607
|
} else {
|
|
2983
2608
|
_this2.objects = objects;
|
|
2984
|
-
}
|
|
2985
|
-
|
|
2609
|
+
}
|
|
2986
2610
|
|
|
2611
|
+
// read default history
|
|
2987
2612
|
_this2.defaultHistory = _this2.systemConfig.common.defaultHistory;
|
|
2988
|
-
|
|
2989
2613
|
if (_this2.defaultHistory) {
|
|
2990
2614
|
props.socket.getState("system.adapter.".concat(_this2.defaultHistory, ".alive")).then(function (state) {
|
|
2991
2615
|
if (!state || !state.val) {
|
|
@@ -2995,21 +2619,20 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
2995
2619
|
return window.alert('Cannot get state: ' + e);
|
|
2996
2620
|
});
|
|
2997
2621
|
}
|
|
2998
|
-
|
|
2999
2622
|
return _this2.getAdditionalColumns();
|
|
3000
2623
|
}).then(function (columnsForAdmin) {
|
|
3001
2624
|
_this2.calculateColumnsVisibility(null, null, columnsForAdmin);
|
|
3002
|
-
|
|
3003
2625
|
var _buildTree2 = buildTree(_this2.objects, _this2.props),
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
2626
|
+
info = _buildTree2.info,
|
|
2627
|
+
root = _buildTree2.root;
|
|
3007
2628
|
_this2.root = root;
|
|
3008
|
-
_this2.info = info;
|
|
2629
|
+
_this2.info = info;
|
|
3009
2630
|
|
|
2631
|
+
// Show first selected item
|
|
3010
2632
|
var node = _this2.state.selected && _this2.state.selected.length && findNode(_this2.root, _this2.state.selected[0]);
|
|
3011
|
-
_this2.lastAppliedFilter = null;
|
|
2633
|
+
_this2.lastAppliedFilter = null;
|
|
3012
2634
|
|
|
2635
|
+
// If selected ID is not visible, reset filter
|
|
3013
2636
|
if (node && !applyFilter(node, _this2.state.filter, _this2.state.lang, _this2.objects, null, null, props.customFilter, props.types)) {
|
|
3014
2637
|
// reset filter
|
|
3015
2638
|
_this2.setState({
|
|
@@ -3040,11 +2663,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3040
2663
|
return _this2.showError(e);
|
|
3041
2664
|
});
|
|
3042
2665
|
}
|
|
2666
|
+
|
|
3043
2667
|
/**
|
|
3044
2668
|
* @private
|
|
3045
2669
|
* @param {ioBroker.EmptyCallback} cb
|
|
3046
2670
|
*/
|
|
3047
|
-
|
|
3048
2671
|
}, {
|
|
3049
2672
|
key: "expandAllSelected",
|
|
3050
2673
|
value: function expandAllSelected(cb) {
|
|
@@ -3053,17 +2676,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3053
2676
|
this.state.selected.forEach(function (id) {
|
|
3054
2677
|
var parts = id.split('.');
|
|
3055
2678
|
var path = [];
|
|
3056
|
-
|
|
3057
2679
|
for (var i = 0; i < parts.length - 1; i++) {
|
|
3058
2680
|
path.push(parts[i]);
|
|
3059
|
-
|
|
3060
2681
|
if (!expanded.includes(path.join('.'))) {
|
|
3061
2682
|
expanded.push(path.join('.'));
|
|
3062
2683
|
changed = true;
|
|
3063
2684
|
}
|
|
3064
2685
|
}
|
|
3065
2686
|
});
|
|
3066
|
-
|
|
3067
2687
|
if (changed) {
|
|
3068
2688
|
expanded.sort();
|
|
3069
2689
|
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectExpanded"), JSON.stringify(expanded));
|
|
@@ -3074,18 +2694,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3074
2694
|
cb && cb();
|
|
3075
2695
|
}
|
|
3076
2696
|
}
|
|
2697
|
+
|
|
3077
2698
|
/**
|
|
3078
2699
|
* @private
|
|
3079
2700
|
* @param {boolean} [isDouble]
|
|
3080
2701
|
*/
|
|
3081
|
-
|
|
3082
2702
|
}, {
|
|
3083
2703
|
key: "onAfterSelect",
|
|
3084
2704
|
value: function onAfterSelect(isDouble) {
|
|
3085
2705
|
var _this3 = this;
|
|
3086
|
-
|
|
3087
2706
|
this.lastSelectedItems = (0, _toConsumableArray2["default"])(this.state.selected);
|
|
3088
|
-
|
|
3089
2707
|
if (this.state.selected && this.state.selected.length) {
|
|
3090
2708
|
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectSelected"), JSON.stringify(this.lastSelectedItems));
|
|
3091
2709
|
var name = this.lastSelectedItems.length === 1 ? _Utils["default"].getObjectName(this.objects, this.lastSelectedItems[0], null, {
|
|
@@ -3094,7 +2712,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3094
2712
|
this.props.onSelect && this.props.onSelect(this.lastSelectedItems, name, isDouble);
|
|
3095
2713
|
} else {
|
|
3096
2714
|
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectSelected"), '');
|
|
3097
|
-
|
|
3098
2715
|
if (this.state.selected.length) {
|
|
3099
2716
|
this.setState({
|
|
3100
2717
|
selected: []
|
|
@@ -3106,12 +2723,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3106
2723
|
}
|
|
3107
2724
|
}
|
|
3108
2725
|
}
|
|
2726
|
+
|
|
3109
2727
|
/**
|
|
3110
2728
|
* @private
|
|
3111
2729
|
* @param {import('./types').ObjectBrowserProps} props
|
|
3112
2730
|
* @param {any} state
|
|
3113
2731
|
*/
|
|
3114
|
-
|
|
3115
2732
|
}, {
|
|
3116
2733
|
key: "componentDidMount",
|
|
3117
2734
|
value:
|
|
@@ -3120,57 +2737,50 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3120
2737
|
*/
|
|
3121
2738
|
function componentDidMount() {
|
|
3122
2739
|
var _this4 = this;
|
|
3123
|
-
|
|
3124
2740
|
this.loadAllObjects(!objectsAlreadyLoaded).then(function () {
|
|
3125
2741
|
if (_this4.props.objectsWorker) {
|
|
3126
2742
|
_this4.props.objectsWorker.registerHandler(_this4.onObjectChange);
|
|
3127
2743
|
} else {
|
|
3128
2744
|
_this4.props.socket.subscribeObject('*', _this4.onObjectChange);
|
|
3129
2745
|
}
|
|
3130
|
-
|
|
3131
2746
|
objectsAlreadyLoaded = true;
|
|
3132
2747
|
});
|
|
3133
2748
|
}
|
|
2749
|
+
|
|
3134
2750
|
/**
|
|
3135
2751
|
* Called when component is unmounted.
|
|
3136
2752
|
*/
|
|
3137
|
-
|
|
3138
2753
|
}, {
|
|
3139
2754
|
key: "componentWillUnmount",
|
|
3140
2755
|
value: function componentWillUnmount() {
|
|
3141
2756
|
var _this5 = this;
|
|
3142
|
-
|
|
3143
2757
|
this.filterTimer && clearTimeout(this.filterTimer);
|
|
3144
2758
|
this.filterTimer = null;
|
|
3145
|
-
|
|
3146
2759
|
if (this.props.objectsWorker) {
|
|
3147
2760
|
this.props.objectsWorker.unregisterHandler(this.onObjectChange, true);
|
|
3148
2761
|
} else {
|
|
3149
2762
|
this.props.socket.unsubscribeObject('*', this.onObjectChange);
|
|
3150
|
-
}
|
|
3151
|
-
|
|
2763
|
+
}
|
|
3152
2764
|
|
|
2765
|
+
// remove all subscribes
|
|
3153
2766
|
this.subscribes.forEach(function (pattern) {
|
|
3154
2767
|
console.log('- unsubscribe ' + pattern);
|
|
3155
|
-
|
|
3156
2768
|
_this5.props.socket.unsubscribeState(pattern, _this5.onStateChange);
|
|
3157
2769
|
});
|
|
3158
2770
|
this.subscribes = [];
|
|
3159
2771
|
this.objects = {};
|
|
3160
2772
|
}
|
|
2773
|
+
|
|
3161
2774
|
/**
|
|
3162
2775
|
* Called when component is mounted.
|
|
3163
2776
|
*/
|
|
3164
|
-
|
|
3165
2777
|
}, {
|
|
3166
2778
|
key: "refreshComponent",
|
|
3167
2779
|
value: function refreshComponent() {
|
|
3168
2780
|
var _this6 = this;
|
|
3169
|
-
|
|
3170
2781
|
// remove all subscribes
|
|
3171
2782
|
this.subscribes.forEach(function (pattern) {
|
|
3172
2783
|
console.log('- unsubscribe ' + pattern);
|
|
3173
|
-
|
|
3174
2784
|
_this6.props.socket.unsubscribeState(pattern, _this6.onStateChange);
|
|
3175
2785
|
});
|
|
3176
2786
|
this.subscribes = [];
|
|
@@ -3178,16 +2788,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3178
2788
|
return console.log('updated!');
|
|
3179
2789
|
});
|
|
3180
2790
|
}
|
|
2791
|
+
|
|
3181
2792
|
/**
|
|
3182
2793
|
* Renders the error dialog.
|
|
3183
2794
|
* @returns {JSX.Element | null}
|
|
3184
2795
|
*/
|
|
3185
|
-
|
|
3186
2796
|
}, {
|
|
3187
2797
|
key: "renderErrorDialog",
|
|
3188
2798
|
value: function renderErrorDialog() {
|
|
3189
2799
|
var _this7 = this;
|
|
3190
|
-
|
|
3191
2800
|
return this.state.error ? /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
3192
2801
|
open: true,
|
|
3193
2802
|
maxWidth: "sm",
|
|
@@ -3215,11 +2824,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3215
2824
|
startIcon: /*#__PURE__*/_react["default"].createElement(_Check["default"], null)
|
|
3216
2825
|
}, this.props.t('ra_Ok')))) : null;
|
|
3217
2826
|
}
|
|
2827
|
+
|
|
3218
2828
|
/**
|
|
3219
2829
|
* Show the error dialog.
|
|
3220
2830
|
* @param {any} error
|
|
3221
2831
|
*/
|
|
3222
|
-
|
|
3223
2832
|
}, {
|
|
3224
2833
|
key: "showError",
|
|
3225
2834
|
value: function showError(error) {
|
|
@@ -3227,21 +2836,19 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3227
2836
|
error: (0, _typeof2["default"])(error) === 'object' ? error && typeof error.toString === 'function' ? error.toString() : JSON.stringify(error) : error
|
|
3228
2837
|
});
|
|
3229
2838
|
}
|
|
2839
|
+
|
|
3230
2840
|
/**
|
|
3231
2841
|
* Called when an item is selected/deselected.
|
|
3232
2842
|
* @param {string} toggleItem
|
|
3233
2843
|
* @param {boolean} [isDouble]
|
|
3234
2844
|
*/
|
|
3235
|
-
|
|
3236
2845
|
}, {
|
|
3237
2846
|
key: "onSelect",
|
|
3238
2847
|
value: function onSelect(toggleItem, isDouble) {
|
|
3239
2848
|
var _this8 = this;
|
|
3240
|
-
|
|
3241
2849
|
if (!this.props.multiSelect) {
|
|
3242
2850
|
if (this.objects[toggleItem] && (!this.props.types || this.props.types.includes(this.objects[toggleItem].type))) {
|
|
3243
2851
|
(window._localStorage || window.localStorage).removeItem("".concat(this.props.dialogName || 'App', ".selectedNonObject"));
|
|
3244
|
-
|
|
3245
2852
|
if (this.state.selected[0] !== toggleItem) {
|
|
3246
2853
|
this.setState({
|
|
3247
2854
|
selected: [toggleItem],
|
|
@@ -3266,14 +2873,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3266
2873
|
(window._localStorage || window.localStorage).removeItem("".concat(this.props.dialogName || 'App', ".selectedNonObject"));
|
|
3267
2874
|
var selected = (0, _toConsumableArray2["default"])(this.state.selected);
|
|
3268
2875
|
var pos = selected.indexOf(toggleItem);
|
|
3269
|
-
|
|
3270
2876
|
if (pos === -1) {
|
|
3271
2877
|
selected.push(toggleItem);
|
|
3272
2878
|
selected.sort();
|
|
3273
2879
|
} else if (!isDouble) {
|
|
3274
2880
|
selected.splice(pos, 1);
|
|
3275
2881
|
}
|
|
3276
|
-
|
|
3277
2882
|
this.setState({
|
|
3278
2883
|
selected: selected,
|
|
3279
2884
|
selectedNonObject: ''
|
|
@@ -3283,11 +2888,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3283
2888
|
}
|
|
3284
2889
|
}
|
|
3285
2890
|
}
|
|
2891
|
+
|
|
3286
2892
|
/**
|
|
3287
2893
|
* @private
|
|
3288
2894
|
* @param {boolean} isLast
|
|
3289
2895
|
*/
|
|
3290
|
-
|
|
3291
2896
|
/*
|
|
3292
2897
|
_renderDefinedList(isLast) {
|
|
3293
2898
|
const cols = [...this.possibleCols];
|
|
@@ -3354,12 +2959,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3354
2959
|
* Renders the columns selector.
|
|
3355
2960
|
* @returns {JSX.Element | null}
|
|
3356
2961
|
*/
|
|
3357
|
-
|
|
3358
2962
|
}, {
|
|
3359
2963
|
key: "renderColumnsSelectorDialog",
|
|
3360
2964
|
value: function renderColumnsSelectorDialog() {
|
|
3361
2965
|
var _this9 = this;
|
|
3362
|
-
|
|
3363
2966
|
if (!this.state.columnsSelectorShow) {
|
|
3364
2967
|
return null;
|
|
3365
2968
|
} else {
|
|
@@ -3383,7 +2986,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3383
2986
|
checked: this.state.foldersFirst,
|
|
3384
2987
|
onChange: function onChange() {
|
|
3385
2988
|
(window._localStorage || window.localStorage).setItem((_this9.props.dialogName || 'App') + '.foldersFirst', _this9.state.foldersFirst ? 'false' : 'true');
|
|
3386
|
-
|
|
3387
2989
|
_this9.setState({
|
|
3388
2990
|
foldersFirst: !_this9.state.foldersFirst
|
|
3389
2991
|
});
|
|
@@ -3396,7 +2998,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3396
2998
|
checked: this.state.linesEnabled,
|
|
3397
2999
|
onChange: function onChange() {
|
|
3398
3000
|
(window._localStorage || window.localStorage).setItem((_this9.props.dialogName || 'App') + '.lines', _this9.state.linesEnabled ? 'false' : 'true');
|
|
3399
|
-
|
|
3400
3001
|
_this9.setState({
|
|
3401
3002
|
linesEnabled: !_this9.state.linesEnabled
|
|
3402
3003
|
});
|
|
@@ -3415,30 +3016,30 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3415
3016
|
}, this.texts['close'])));
|
|
3416
3017
|
}
|
|
3417
3018
|
}
|
|
3019
|
+
|
|
3418
3020
|
/**
|
|
3419
3021
|
* @private
|
|
3420
3022
|
*/
|
|
3421
|
-
|
|
3422
3023
|
}, {
|
|
3423
3024
|
key: "getAdditionalColumns",
|
|
3424
3025
|
value: function getAdditionalColumns() {
|
|
3425
3026
|
var _this10 = this;
|
|
3426
|
-
|
|
3427
3027
|
return this.props.socket.getAdapters().then(function (instances) {
|
|
3428
|
-
var columnsForAdmin = null;
|
|
3429
|
-
|
|
3028
|
+
var columnsForAdmin = null;
|
|
3029
|
+
// find all additional columns
|
|
3430
3030
|
instances.forEach(function (obj) {
|
|
3431
3031
|
return columnsForAdmin = _this10.parseObjectForAdmins(columnsForAdmin, obj);
|
|
3432
3032
|
});
|
|
3433
3033
|
return columnsForAdmin;
|
|
3434
|
-
})["catch"](function (e) {
|
|
3034
|
+
})["catch"](function (e) {
|
|
3035
|
+
// window.alert('Cannot get adapters: ' + e);
|
|
3435
3036
|
// Object browser in Web has no additional columns
|
|
3436
3037
|
});
|
|
3437
3038
|
}
|
|
3039
|
+
|
|
3438
3040
|
/**
|
|
3439
3041
|
* @private
|
|
3440
3042
|
*/
|
|
3441
|
-
|
|
3442
3043
|
}, {
|
|
3443
3044
|
key: "checkUnsubscribes",
|
|
3444
3045
|
value: function checkUnsubscribes() {
|
|
@@ -3446,9 +3047,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3446
3047
|
for (var i = this.subscribes.length - 1; i >= 0; i--) {
|
|
3447
3048
|
!this.recordStates.includes(this.subscribes[i]) && this.unsubscribe(this.subscribes[i]);
|
|
3448
3049
|
}
|
|
3449
|
-
|
|
3450
3050
|
this.recordStates = [];
|
|
3451
3051
|
}
|
|
3052
|
+
|
|
3452
3053
|
/**
|
|
3453
3054
|
* Find an item.
|
|
3454
3055
|
* @param {string} id
|
|
@@ -3457,24 +3058,19 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3457
3058
|
* @param {string | undefined} [_partyId]
|
|
3458
3059
|
* @returns {any}
|
|
3459
3060
|
*/
|
|
3460
|
-
|
|
3461
3061
|
}, {
|
|
3462
3062
|
key: "findItem",
|
|
3463
3063
|
value: function findItem(id, _parts, _root, _partyId) {
|
|
3464
3064
|
_parts = _parts || id.split('.');
|
|
3465
3065
|
_root = _root || this.root;
|
|
3466
|
-
|
|
3467
3066
|
if (!_root || !_parts.length) {
|
|
3468
3067
|
return null;
|
|
3469
3068
|
}
|
|
3470
|
-
|
|
3471
3069
|
_partyId = (_partyId ? _partyId + '.' : '') + _parts.shift();
|
|
3472
|
-
|
|
3473
3070
|
if (_root.children) {
|
|
3474
3071
|
var item = _root.children.find(function (i) {
|
|
3475
3072
|
return i.data.id === _partyId;
|
|
3476
3073
|
});
|
|
3477
|
-
|
|
3478
3074
|
if (item) {
|
|
3479
3075
|
if (item.data.id === id) {
|
|
3480
3076
|
return item;
|
|
@@ -3488,12 +3084,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3488
3084
|
return null;
|
|
3489
3085
|
}
|
|
3490
3086
|
}
|
|
3087
|
+
|
|
3491
3088
|
/**
|
|
3492
3089
|
* Called when a state changes.
|
|
3493
3090
|
* @param {string} id
|
|
3494
3091
|
* @param {ioBroker.State} state
|
|
3495
3092
|
*/
|
|
3496
|
-
|
|
3497
3093
|
}, {
|
|
3498
3094
|
key: "parseObjectForAdmins",
|
|
3499
3095
|
value:
|
|
@@ -3504,29 +3100,25 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3504
3100
|
*/
|
|
3505
3101
|
function parseObjectForAdmins(columnsForAdmin, obj) {
|
|
3506
3102
|
var _this11 = this;
|
|
3507
|
-
|
|
3508
3103
|
if (obj.common && obj.common.adminColumns && obj.common.name) {
|
|
3509
3104
|
var columns = obj.common.adminColumns;
|
|
3510
|
-
|
|
3511
3105
|
if ((0, _typeof2["default"])(columns) !== 'object') {
|
|
3512
3106
|
columns = [columns];
|
|
3513
3107
|
}
|
|
3514
|
-
|
|
3515
3108
|
columns = columns.map(function (item) {
|
|
3516
3109
|
if ((0, _typeof2["default"])(item) !== 'object') {
|
|
3517
3110
|
return {
|
|
3518
3111
|
path: item,
|
|
3519
3112
|
name: item.split('.').pop()
|
|
3520
3113
|
};
|
|
3521
|
-
}
|
|
3522
|
-
|
|
3114
|
+
}
|
|
3523
3115
|
|
|
3116
|
+
// string => array
|
|
3524
3117
|
if (item.objTypes && (0, _typeof2["default"])(item.objTypes) !== 'object') {
|
|
3525
3118
|
item.objTypes = [item.objTypes];
|
|
3526
3119
|
} else if (!item.objTypes) {
|
|
3527
3120
|
item.objTypes = null;
|
|
3528
3121
|
}
|
|
3529
|
-
|
|
3530
3122
|
if (!item.name && item.path) {
|
|
3531
3123
|
return {
|
|
3532
3124
|
path: item.path,
|
|
@@ -3537,7 +3129,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3537
3129
|
objTypes: item.objTypes
|
|
3538
3130
|
};
|
|
3539
3131
|
}
|
|
3540
|
-
|
|
3541
3132
|
if ((0, _typeof2["default"])(item.name) !== 'object' && item.path) {
|
|
3542
3133
|
return {
|
|
3543
3134
|
path: item.path,
|
|
@@ -3548,7 +3139,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3548
3139
|
objTypes: item.objTypes
|
|
3549
3140
|
};
|
|
3550
3141
|
}
|
|
3551
|
-
|
|
3552
3142
|
if (!item.path) {
|
|
3553
3143
|
console.warn("Admin columns for ".concat(obj._id, " ignored, because path not found"));
|
|
3554
3144
|
return null;
|
|
@@ -3565,7 +3155,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3565
3155
|
}).filter(function (item) {
|
|
3566
3156
|
return item;
|
|
3567
3157
|
});
|
|
3568
|
-
|
|
3569
3158
|
if (columns && columns.length) {
|
|
3570
3159
|
columnsForAdmin = columnsForAdmin || {};
|
|
3571
3160
|
columnsForAdmin[obj.common.name] = columns.sort(function (a, b) {
|
|
@@ -3575,15 +3164,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3575
3164
|
} else if (obj.common && obj.common.name && columnsForAdmin && columnsForAdmin[obj.common.name]) {
|
|
3576
3165
|
delete columnsForAdmin[obj.common.name];
|
|
3577
3166
|
}
|
|
3578
|
-
|
|
3579
3167
|
return columnsForAdmin;
|
|
3580
3168
|
}
|
|
3169
|
+
|
|
3581
3170
|
/**
|
|
3582
3171
|
* @param {string} id
|
|
3583
3172
|
* @param {ioBroker.Object} obj
|
|
3584
3173
|
* @param {import('./types').OldObject} oldObj
|
|
3585
3174
|
*/
|
|
3586
|
-
|
|
3587
3175
|
}, {
|
|
3588
3176
|
key: "subscribe",
|
|
3589
3177
|
value:
|
|
@@ -3598,41 +3186,36 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3598
3186
|
!this.pausedSubscribes && this.props.socket.subscribeState(id, this.onStateChange);
|
|
3599
3187
|
}
|
|
3600
3188
|
}
|
|
3189
|
+
|
|
3601
3190
|
/**
|
|
3602
3191
|
* @private
|
|
3603
3192
|
* @param {string} id
|
|
3604
3193
|
*/
|
|
3605
|
-
|
|
3606
3194
|
}, {
|
|
3607
3195
|
key: "unsubscribe",
|
|
3608
3196
|
value: function unsubscribe(id) {
|
|
3609
3197
|
var pos = this.subscribes.indexOf(id);
|
|
3610
|
-
|
|
3611
3198
|
if (pos !== -1) {
|
|
3612
3199
|
this.subscribes.splice(pos, 1);
|
|
3613
|
-
|
|
3614
3200
|
if (this.states[id]) {
|
|
3615
3201
|
delete this.states[id];
|
|
3616
3202
|
}
|
|
3617
|
-
|
|
3618
3203
|
console.log("- unsubscribe ".concat(id));
|
|
3619
3204
|
this.props.socket.unsubscribeState(id, this.onStateChange);
|
|
3620
|
-
|
|
3621
3205
|
if (this.pausedSubscribes) {
|
|
3622
3206
|
console.warn('Unsubscribe during pause?');
|
|
3623
3207
|
}
|
|
3624
3208
|
}
|
|
3625
3209
|
}
|
|
3210
|
+
|
|
3626
3211
|
/**
|
|
3627
3212
|
* @private
|
|
3628
3213
|
* @param {boolean} isPause
|
|
3629
3214
|
*/
|
|
3630
|
-
|
|
3631
3215
|
}, {
|
|
3632
3216
|
key: "pauseSubscribe",
|
|
3633
3217
|
value: function pauseSubscribe(isPause) {
|
|
3634
3218
|
var _this12 = this;
|
|
3635
|
-
|
|
3636
3219
|
if (!this.pausedSubscribes && isPause) {
|
|
3637
3220
|
this.pausedSubscribes = true;
|
|
3638
3221
|
this.subscribes.forEach(function (id) {
|
|
@@ -3645,17 +3228,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3645
3228
|
});
|
|
3646
3229
|
}
|
|
3647
3230
|
}
|
|
3231
|
+
|
|
3648
3232
|
/**
|
|
3649
3233
|
* @private
|
|
3650
3234
|
* @param {string} [name]
|
|
3651
3235
|
* @param {boolean} [value]
|
|
3652
3236
|
*/
|
|
3653
|
-
|
|
3654
3237
|
}, {
|
|
3655
3238
|
key: "onFilter",
|
|
3656
3239
|
value: function onFilter(name, value) {
|
|
3657
3240
|
var _this13 = this;
|
|
3658
|
-
|
|
3659
3241
|
this.filterTimer = null;
|
|
3660
3242
|
var filter = {};
|
|
3661
3243
|
Object.keys(this.filterRefs).forEach(function (name) {
|
|
@@ -3668,17 +3250,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3668
3250
|
}
|
|
3669
3251
|
}
|
|
3670
3252
|
});
|
|
3671
|
-
|
|
3672
3253
|
if (name) {
|
|
3673
3254
|
filter[name] = value;
|
|
3674
|
-
|
|
3675
3255
|
if (name === 'expertMode') {
|
|
3676
3256
|
(window._sessionStorage || window.sessionStorage).setItem('App.expertMode', value ? 'true' : 'false');
|
|
3677
3257
|
}
|
|
3678
3258
|
}
|
|
3679
|
-
|
|
3680
3259
|
filter = Object.assign({}, this.state.filter, filter);
|
|
3681
|
-
|
|
3682
3260
|
if (JSON.stringify(this.state.filter) !== JSON.stringify(filter)) {
|
|
3683
3261
|
(window._localStorage || window.localStorage).setItem((this.props.dialogName || 'App') + '.objectFilter', JSON.stringify(filter));
|
|
3684
3262
|
this.setState({
|
|
@@ -3692,13 +3270,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3692
3270
|
key: "clearFilter",
|
|
3693
3271
|
value: function clearFilter() {
|
|
3694
3272
|
var _this14 = this;
|
|
3695
|
-
|
|
3696
3273
|
var filter = {};
|
|
3697
3274
|
Object.keys(this.filterRefs).forEach(function (name) {
|
|
3698
3275
|
if (_this14.filterRefs[name] && _this14.filterRefs[name].current) {
|
|
3699
3276
|
for (var i = 0; i < _this14.filterRefs[name].current.childNodes.length; i++) {
|
|
3700
3277
|
var item = _this14.filterRefs[name].current.childNodes[i];
|
|
3701
|
-
|
|
3702
3278
|
if (item.tagName === 'INPUT') {
|
|
3703
3279
|
filter[name] = '';
|
|
3704
3280
|
item.value = '';
|
|
@@ -3708,7 +3284,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3708
3284
|
}
|
|
3709
3285
|
});
|
|
3710
3286
|
filter = Object.assign({}, this.state.filter, filter);
|
|
3711
|
-
|
|
3712
3287
|
if (JSON.stringify(this.state.filter) !== JSON.stringify(filter)) {
|
|
3713
3288
|
(window._localStorage || window.localStorage).setItem((this.props.dialogName || 'App') + '.objectFilter', JSON.stringify(filter));
|
|
3714
3289
|
this.setState({
|
|
@@ -3723,27 +3298,26 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3723
3298
|
key: "isFilterEmpty",
|
|
3724
3299
|
value: function isFilterEmpty() {
|
|
3725
3300
|
var _this15 = this;
|
|
3726
|
-
|
|
3727
3301
|
var someNotEmpty = Object.keys(this.state.filter).find(function (attr) {
|
|
3728
3302
|
return attr !== 'expertMode' && _this15.state.filter[attr];
|
|
3729
3303
|
});
|
|
3730
3304
|
return !someNotEmpty;
|
|
3731
3305
|
}
|
|
3306
|
+
|
|
3732
3307
|
/**
|
|
3733
3308
|
* @private
|
|
3734
3309
|
* @param {string} name
|
|
3735
3310
|
*/
|
|
3736
|
-
|
|
3737
3311
|
}, {
|
|
3738
3312
|
key: "getFilterInput",
|
|
3739
3313
|
value: function getFilterInput(name) {
|
|
3740
3314
|
var _this16 = this,
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3315
|
+
_this$filterRefs$name,
|
|
3316
|
+
_this$filterRefs$name2;
|
|
3744
3317
|
return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
|
|
3745
3318
|
className: _Utils["default"].clsx(this.props.classes.headerCellInput, this.props.classes.filterInput),
|
|
3746
|
-
key: name + '_' + this.state.filterKey
|
|
3319
|
+
key: name + '_' + this.state.filterKey
|
|
3320
|
+
//style={{ marginTop: 0, marginBottom: 0 }}
|
|
3747
3321
|
,
|
|
3748
3322
|
margin: "dense"
|
|
3749
3323
|
}, /*#__PURE__*/_react["default"].createElement(_Input["default"], {
|
|
@@ -3770,25 +3344,23 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3770
3344
|
size: "small",
|
|
3771
3345
|
onClick: function onClick() {
|
|
3772
3346
|
_this16.filterRefs[name].current.firstChild.value = '';
|
|
3773
|
-
|
|
3774
3347
|
_this16.onFilter(name, '');
|
|
3775
3348
|
}
|
|
3776
3349
|
}, /*#__PURE__*/_react["default"].createElement(_Close["default"], null))) : null);
|
|
3777
3350
|
}
|
|
3351
|
+
|
|
3778
3352
|
/**
|
|
3779
3353
|
* @private
|
|
3780
3354
|
* @param {string} name
|
|
3781
3355
|
* @param {any[]} values
|
|
3782
3356
|
*/
|
|
3783
|
-
|
|
3784
3357
|
}, {
|
|
3785
3358
|
key: "getFilterSelect",
|
|
3786
3359
|
value: function getFilterSelect(name, values) {
|
|
3787
3360
|
var _this17 = this,
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3361
|
+
_this$filterRefs$name3,
|
|
3362
|
+
_this$filterRefs$name4,
|
|
3363
|
+
_this$filterRefs$name5;
|
|
3792
3364
|
var hasIcons = !!values.find(function (item) {
|
|
3793
3365
|
return item.icon;
|
|
3794
3366
|
});
|
|
@@ -3822,7 +3394,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3822
3394
|
var id;
|
|
3823
3395
|
var name;
|
|
3824
3396
|
var icon;
|
|
3825
|
-
|
|
3826
3397
|
if ((0, _typeof2["default"])(item) === 'object') {
|
|
3827
3398
|
id = item.value;
|
|
3828
3399
|
name = item.name;
|
|
@@ -3831,7 +3402,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3831
3402
|
id = item;
|
|
3832
3403
|
name = item;
|
|
3833
3404
|
}
|
|
3834
|
-
|
|
3835
3405
|
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
3836
3406
|
className: _this17.props.classes.headerCellSelectItem,
|
|
3837
3407
|
key: id,
|
|
@@ -3845,11 +3415,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3845
3415
|
size: "small",
|
|
3846
3416
|
onClick: function onClick() {
|
|
3847
3417
|
var newFilter = _objectSpread({}, _this17.state.filter);
|
|
3848
|
-
|
|
3849
3418
|
newFilter[name] = '';
|
|
3850
3419
|
_this17.filterRefs[name].current.childNodes[1].value = '';
|
|
3851
3420
|
(window._localStorage || window.localStorage).setItem((_this17.props.dialogName || 'App') + '.objectFilter', JSON.stringify(newFilter));
|
|
3852
|
-
|
|
3853
3421
|
_this17.setState({
|
|
3854
3422
|
filter: newFilter,
|
|
3855
3423
|
filterKey: _this17.state.filterKey + 1
|
|
@@ -3859,27 +3427,25 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3859
3427
|
}
|
|
3860
3428
|
}, /*#__PURE__*/_react["default"].createElement(_Close["default"], null))) : null);
|
|
3861
3429
|
}
|
|
3430
|
+
|
|
3862
3431
|
/**
|
|
3863
3432
|
* @private
|
|
3864
3433
|
*/
|
|
3865
|
-
|
|
3866
3434
|
}, {
|
|
3867
3435
|
key: "getFilterSelectRole",
|
|
3868
3436
|
value: function getFilterSelectRole() {
|
|
3869
3437
|
return this.getFilterSelect('role', this.info.roles);
|
|
3870
3438
|
}
|
|
3439
|
+
|
|
3871
3440
|
/**
|
|
3872
3441
|
* @private
|
|
3873
3442
|
*/
|
|
3874
|
-
|
|
3875
3443
|
}, {
|
|
3876
3444
|
key: "getFilterSelectRoom",
|
|
3877
3445
|
value: function getFilterSelectRoom() {
|
|
3878
3446
|
var _this18 = this;
|
|
3879
|
-
|
|
3880
3447
|
var rooms = this.info.roomEnums.map(function (id) {
|
|
3881
3448
|
var _this18$objects$id, _this18$objects$id$co, _this18$objects$id2, _this18$objects$id2$c;
|
|
3882
|
-
|
|
3883
3449
|
return {
|
|
3884
3450
|
name: getName(((_this18$objects$id = _this18.objects[id]) === null || _this18$objects$id === void 0 ? void 0 : (_this18$objects$id$co = _this18$objects$id.common) === null || _this18$objects$id$co === void 0 ? void 0 : _this18$objects$id$co.name) || id.split('.').pop()),
|
|
3885
3451
|
value: id,
|
|
@@ -3891,18 +3457,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3891
3457
|
});
|
|
3892
3458
|
return this.getFilterSelect('room', rooms);
|
|
3893
3459
|
}
|
|
3460
|
+
|
|
3894
3461
|
/**
|
|
3895
3462
|
* @private
|
|
3896
3463
|
*/
|
|
3897
|
-
|
|
3898
3464
|
}, {
|
|
3899
3465
|
key: "getFilterSelectFunction",
|
|
3900
3466
|
value: function getFilterSelectFunction() {
|
|
3901
3467
|
var _this19 = this;
|
|
3902
|
-
|
|
3903
3468
|
var func = this.info.funcEnums.map(function (id) {
|
|
3904
3469
|
var _this19$objects$id, _this19$objects$id$co;
|
|
3905
|
-
|
|
3906
3470
|
return {
|
|
3907
3471
|
name: getName(_this19.objects[id] && _this19.objects[id].common && _this19.objects[id].common.name || id.split('.').pop()),
|
|
3908
3472
|
value: id,
|
|
@@ -3914,10 +3478,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3914
3478
|
});
|
|
3915
3479
|
return this.getFilterSelect('func', func);
|
|
3916
3480
|
}
|
|
3481
|
+
|
|
3917
3482
|
/**
|
|
3918
3483
|
* @private
|
|
3919
3484
|
*/
|
|
3920
|
-
|
|
3921
3485
|
}, {
|
|
3922
3486
|
key: "getFilterSelectType",
|
|
3923
3487
|
value: function getFilterSelectType() {
|
|
@@ -3930,15 +3494,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3930
3494
|
});
|
|
3931
3495
|
return this.getFilterSelect('type', types);
|
|
3932
3496
|
}
|
|
3497
|
+
|
|
3933
3498
|
/**
|
|
3934
3499
|
* @private
|
|
3935
3500
|
*/
|
|
3936
|
-
|
|
3937
3501
|
}, {
|
|
3938
3502
|
key: "getFilterSelectCustoms",
|
|
3939
3503
|
value: function getFilterSelectCustoms() {
|
|
3940
3504
|
var _this20 = this;
|
|
3941
|
-
|
|
3942
3505
|
if (this.info.customs.length) {
|
|
3943
3506
|
var customs = this.info.customs.map(function (id) {
|
|
3944
3507
|
return {
|
|
@@ -3955,27 +3518,24 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3955
3518
|
return null;
|
|
3956
3519
|
}
|
|
3957
3520
|
}
|
|
3521
|
+
|
|
3958
3522
|
/**
|
|
3959
3523
|
* @private
|
|
3960
3524
|
* @param {any} [root]
|
|
3961
3525
|
* @param {any[]} [expanded]
|
|
3962
3526
|
*/
|
|
3963
|
-
|
|
3964
3527
|
}, {
|
|
3965
3528
|
key: "onExpandAll",
|
|
3966
3529
|
value: function onExpandAll(root, expanded) {
|
|
3967
3530
|
var _this21 = this;
|
|
3968
|
-
|
|
3969
3531
|
root = root || this.root;
|
|
3970
3532
|
expanded = expanded || [];
|
|
3971
3533
|
root.children && root.children.forEach(function (item) {
|
|
3972
3534
|
if (item.data.sumVisibility) {
|
|
3973
3535
|
expanded.push(item.data.id);
|
|
3974
|
-
|
|
3975
3536
|
_this21.onExpandAll(item, expanded);
|
|
3976
3537
|
}
|
|
3977
3538
|
});
|
|
3978
|
-
|
|
3979
3539
|
if (root === this.root) {
|
|
3980
3540
|
expanded.sort();
|
|
3981
3541
|
(window._localStorage || window.localStorage).setItem((this.props.dialogName || 'App') + '.objectExpanded', JSON.stringify(expanded));
|
|
@@ -3984,15 +3544,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
3984
3544
|
});
|
|
3985
3545
|
}
|
|
3986
3546
|
}
|
|
3547
|
+
|
|
3987
3548
|
/**
|
|
3988
3549
|
* @private
|
|
3989
3550
|
*/
|
|
3990
|
-
|
|
3991
3551
|
}, {
|
|
3992
3552
|
key: "onCollapseAll",
|
|
3993
3553
|
value: function onCollapseAll() {
|
|
3994
3554
|
var _this22 = this;
|
|
3995
|
-
|
|
3996
3555
|
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectExpanded"), JSON.stringify([]));
|
|
3997
3556
|
(window._localStorage || window.localStorage).setItem("".concat(this.props.dialogName || 'App', ".objectSelected"), '[]');
|
|
3998
3557
|
this.setState({
|
|
@@ -4003,20 +3562,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4003
3562
|
return _this22.onAfterSelect();
|
|
4004
3563
|
});
|
|
4005
3564
|
}
|
|
3565
|
+
|
|
4006
3566
|
/**
|
|
4007
3567
|
* @private
|
|
4008
3568
|
* @param {any} root
|
|
4009
3569
|
* @param {number} depth
|
|
4010
3570
|
* @param {any[]} expanded
|
|
4011
3571
|
*/
|
|
4012
|
-
|
|
4013
3572
|
}, {
|
|
4014
3573
|
key: "expandDepth",
|
|
4015
3574
|
value: function expandDepth(root, depth, expanded) {
|
|
4016
3575
|
var _this23 = this;
|
|
4017
|
-
|
|
4018
3576
|
root = root || this.root;
|
|
4019
|
-
|
|
4020
3577
|
if (depth > 0) {
|
|
4021
3578
|
if (root.children) {
|
|
4022
3579
|
root.children.forEach(function (item) {
|
|
@@ -4025,7 +3582,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4025
3582
|
expanded.push(item.data.id);
|
|
4026
3583
|
expanded.sort();
|
|
4027
3584
|
}
|
|
4028
|
-
|
|
4029
3585
|
if (depth - 1 > 0) {
|
|
4030
3586
|
_this23.expandDepth(item, depth - 1, expanded);
|
|
4031
3587
|
}
|
|
@@ -4034,12 +3590,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4034
3590
|
}
|
|
4035
3591
|
}
|
|
4036
3592
|
}
|
|
3593
|
+
|
|
4037
3594
|
/**
|
|
4038
3595
|
* @private
|
|
4039
3596
|
* @param {number} depth
|
|
4040
3597
|
* @param {any[]} expanded
|
|
4041
3598
|
*/
|
|
4042
|
-
|
|
4043
3599
|
}, {
|
|
4044
3600
|
key: "collapseDepth",
|
|
4045
3601
|
value: function collapseDepth(depth, expanded) {
|
|
@@ -4047,10 +3603,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4047
3603
|
return id.split('.').length <= depth;
|
|
4048
3604
|
});
|
|
4049
3605
|
}
|
|
3606
|
+
|
|
4050
3607
|
/**
|
|
4051
3608
|
* @private
|
|
4052
3609
|
*/
|
|
4053
|
-
|
|
4054
3610
|
}, {
|
|
4055
3611
|
key: "onExpandVisible",
|
|
4056
3612
|
value: function onExpandVisible() {
|
|
@@ -4065,10 +3621,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4065
3621
|
});
|
|
4066
3622
|
}
|
|
4067
3623
|
}
|
|
3624
|
+
|
|
4068
3625
|
/**
|
|
4069
3626
|
* @private
|
|
4070
3627
|
*/
|
|
4071
|
-
|
|
4072
3628
|
}, {
|
|
4073
3629
|
key: "onStatesViewVisible",
|
|
4074
3630
|
value: function onStatesViewVisible() {
|
|
@@ -4078,10 +3634,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4078
3634
|
statesView: statesView
|
|
4079
3635
|
});
|
|
4080
3636
|
}
|
|
3637
|
+
|
|
4081
3638
|
/**
|
|
4082
3639
|
* @private
|
|
4083
3640
|
*/
|
|
4084
|
-
|
|
4085
3641
|
}, {
|
|
4086
3642
|
key: "onCollapseVisible",
|
|
4087
3643
|
value: function onCollapseVisible() {
|
|
@@ -4095,11 +3651,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4095
3651
|
});
|
|
4096
3652
|
}
|
|
4097
3653
|
}
|
|
3654
|
+
|
|
4098
3655
|
/**
|
|
4099
3656
|
* @private
|
|
4100
3657
|
* @param {string} id
|
|
4101
3658
|
*/
|
|
4102
|
-
|
|
4103
3659
|
}, {
|
|
4104
3660
|
key: "_getSelectedIdsForExport",
|
|
4105
3661
|
value: function _getSelectedIdsForExport() {
|
|
@@ -4110,19 +3666,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4110
3666
|
var id = this.state.selected[0] || this.state.selectedNonObject;
|
|
4111
3667
|
var idDot = id + '.';
|
|
4112
3668
|
var idLen = idDot.length;
|
|
4113
|
-
|
|
4114
3669
|
for (var k = 0; k < keys.length; k++) {
|
|
4115
3670
|
var key = keys[k];
|
|
4116
|
-
|
|
4117
3671
|
if (id === key || key.startsWith(idDot)) {
|
|
4118
3672
|
result.push(key);
|
|
4119
3673
|
}
|
|
4120
|
-
|
|
4121
3674
|
if (key.substring(0, idLen) > idDot) {
|
|
4122
3675
|
break;
|
|
4123
3676
|
}
|
|
4124
3677
|
}
|
|
4125
|
-
|
|
4126
3678
|
return result;
|
|
4127
3679
|
} else {
|
|
4128
3680
|
return [];
|
|
@@ -4132,25 +3684,21 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4132
3684
|
key: "_exportObjects",
|
|
4133
3685
|
value: function _exportObjects(isAll) {
|
|
4134
3686
|
var _this24 = this;
|
|
4135
|
-
|
|
4136
3687
|
if (isAll) {
|
|
4137
3688
|
generateFile('allObjects.json', this.objects);
|
|
4138
3689
|
} else if (this.state.selected.length || this.state.selectedNonObject) {
|
|
4139
3690
|
var result = {};
|
|
4140
3691
|
var id = this.state.selected[0] || this.state.selectedNonObject;
|
|
4141
|
-
|
|
4142
3692
|
this._getSelectedIdsForExport().forEach(function (key) {
|
|
4143
|
-
result[key] = JSON.parse(JSON.stringify(_this24.objects[key]));
|
|
4144
|
-
|
|
3693
|
+
result[key] = JSON.parse(JSON.stringify(_this24.objects[key]));
|
|
3694
|
+
// add enum information
|
|
4145
3695
|
if (result[key].common) {
|
|
4146
3696
|
var enums = _this24.getEnumsForId(key);
|
|
4147
|
-
|
|
4148
3697
|
if (enums) {
|
|
4149
3698
|
result[key].common.enums = enums;
|
|
4150
3699
|
}
|
|
4151
3700
|
}
|
|
4152
3701
|
});
|
|
4153
|
-
|
|
4154
3702
|
generateFile(id + '.json', result);
|
|
4155
3703
|
} else {
|
|
4156
3704
|
window.alert(this.props.t('ra_Save of objects-tree is not possible'));
|
|
@@ -4160,7 +3708,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4160
3708
|
key: "renderExportDialog",
|
|
4161
3709
|
value: function renderExportDialog() {
|
|
4162
3710
|
var _this25 = this;
|
|
4163
|
-
|
|
4164
3711
|
if (this.state.showExportDialog === false) {
|
|
4165
3712
|
return null;
|
|
4166
3713
|
} else {
|
|
@@ -4199,11 +3746,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4199
3746
|
}, this.props.t('ra_Cancel'))));
|
|
4200
3747
|
}
|
|
4201
3748
|
}
|
|
3749
|
+
|
|
4202
3750
|
/**
|
|
4203
3751
|
* @private
|
|
4204
3752
|
* @param {object} evt
|
|
4205
3753
|
*/
|
|
4206
|
-
|
|
4207
3754
|
}, {
|
|
4208
3755
|
key: "getToolbar",
|
|
4209
3756
|
value:
|
|
@@ -4213,12 +3760,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4213
3760
|
*/
|
|
4214
3761
|
function getToolbar() {
|
|
4215
3762
|
var _this26 = this;
|
|
4216
|
-
|
|
4217
3763
|
var allowObjectCreation = false;
|
|
4218
|
-
|
|
4219
3764
|
if (this.state.selected.length || this.state.selectedNonObject) {
|
|
4220
3765
|
var id = this.state.selected[0] || this.state.selectedNonObject;
|
|
4221
|
-
|
|
4222
3766
|
if (id.split('.').length < 2 || this.objects[id] && this.objects[id].type === 'state') {
|
|
4223
3767
|
allowObjectCreation = false;
|
|
4224
3768
|
} else {
|
|
@@ -4229,7 +3773,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4229
3773
|
}
|
|
4230
3774
|
}
|
|
4231
3775
|
}
|
|
4232
|
-
|
|
4233
3776
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
4234
3777
|
style: {
|
|
4235
3778
|
display: 'flex',
|
|
@@ -4262,7 +3805,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4262
3805
|
}, /*#__PURE__*/_react["default"].createElement(_IconExpert["default"], null))), !this.props.disableColumnSelector && /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
4263
3806
|
title: this.props.t('ra_Configure')
|
|
4264
3807
|
}, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
4265
|
-
key: "columnSelector"
|
|
3808
|
+
key: "columnSelector"
|
|
3809
|
+
// color={this.state.columnsAuto ? 'primary' : 'default'}
|
|
4266
3810
|
,
|
|
4267
3811
|
onClick: function onClick() {
|
|
4268
3812
|
return _this26.setState({
|
|
@@ -4369,15 +3913,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4369
3913
|
onClick: function onClick() {
|
|
4370
3914
|
// get all visible states
|
|
4371
3915
|
var ids = getVisibleItems(_this26.root, 'state', _this26.objects);
|
|
4372
|
-
|
|
4373
3916
|
if (ids.length) {
|
|
4374
3917
|
_this26.pauseSubscribe(true);
|
|
4375
|
-
|
|
4376
3918
|
if (ids.length === 1) {
|
|
4377
3919
|
(window._localStorage || window.localStorage).setItem((_this26.props.dialogName || 'App') + '.objectSelected', _this26.state.selected[0]);
|
|
4378
3920
|
_this26.props.router && _this26.props.router.doNavigate(null, 'custom', _this26.state.selected[0]);
|
|
4379
3921
|
}
|
|
4380
|
-
|
|
4381
3922
|
_this26.setState({
|
|
4382
3923
|
customDialog: ids
|
|
4383
3924
|
});
|
|
@@ -4390,42 +3931,39 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4390
3931
|
size: "large"
|
|
4391
3932
|
}, /*#__PURE__*/_react["default"].createElement(_Build["default"], null))));
|
|
4392
3933
|
}
|
|
3934
|
+
|
|
4393
3935
|
/**
|
|
4394
3936
|
* @private
|
|
4395
3937
|
* @param {string} id
|
|
4396
3938
|
*/
|
|
4397
|
-
|
|
4398
3939
|
}, {
|
|
4399
3940
|
key: "toggleExpanded",
|
|
4400
3941
|
value: function toggleExpanded(id) {
|
|
4401
3942
|
var expanded = JSON.parse(JSON.stringify(this.state.expanded));
|
|
4402
3943
|
var pos = expanded.indexOf(id);
|
|
4403
|
-
|
|
4404
3944
|
if (pos === -1) {
|
|
4405
3945
|
expanded.push(id);
|
|
4406
3946
|
expanded.sort();
|
|
4407
3947
|
} else {
|
|
4408
3948
|
expanded.splice(pos, 1);
|
|
4409
3949
|
}
|
|
4410
|
-
|
|
4411
3950
|
(window._localStorage || window.localStorage).setItem((this.props.dialogName || 'App') + '.objectExpanded', JSON.stringify(expanded));
|
|
4412
3951
|
this.setState({
|
|
4413
3952
|
expanded: expanded
|
|
4414
3953
|
});
|
|
4415
3954
|
}
|
|
3955
|
+
|
|
4416
3956
|
/**
|
|
4417
3957
|
* @private
|
|
4418
3958
|
* @param {Event} e
|
|
4419
3959
|
* @param {string} text
|
|
4420
3960
|
*/
|
|
4421
|
-
|
|
4422
3961
|
}, {
|
|
4423
3962
|
key: "onCopy",
|
|
4424
3963
|
value: function onCopy(e, text) {
|
|
4425
3964
|
e.stopPropagation();
|
|
4426
3965
|
e.preventDefault();
|
|
4427
3966
|
(0, _copyToClipboard["default"])(text);
|
|
4428
|
-
|
|
4429
3967
|
if (text.length < 50) {
|
|
4430
3968
|
this.setState({
|
|
4431
3969
|
toast: this.props.t('ra_Copied %s', text)
|
|
@@ -4446,10 +3984,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4446
3984
|
*/
|
|
4447
3985
|
function renderColumnButtons(id, item, classes) {
|
|
4448
3986
|
var _this27 = this,
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
3987
|
+
_item$children2,
|
|
3988
|
+
_item$data$obj$common,
|
|
3989
|
+
_item$data$obj$common3;
|
|
4453
3990
|
if (!item.data.obj) {
|
|
4454
3991
|
return this.props.onObjectDelete || this.props.objectEditOfAccessControl ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
4455
3992
|
className: classes.buttonDiv
|
|
@@ -4475,7 +4012,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4475
4012
|
className: classes.cellButtonsButtonIcon
|
|
4476
4013
|
})) : null) : null;
|
|
4477
4014
|
}
|
|
4478
|
-
|
|
4479
4015
|
item.data.aclTooltip = item.data.aclTooltip || this.renderTooltipAccessControl(item.data.obj.acl);
|
|
4480
4016
|
var acl = item.data.obj.acl ? item.data.obj.type === 'state' ? item.data.obj.acl.state : item.data.obj.acl.object : 0;
|
|
4481
4017
|
var aclSystemConfig = item.data.obj.acl && (item.data.obj.type === 'state' ? this.systemConfig.common.defaultNewAcl.state : this.systemConfig.common.defaultNewAcl.object);
|
|
@@ -4504,7 +4040,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4504
4040
|
title: this.texts.editObject,
|
|
4505
4041
|
onClick: function onClick() {
|
|
4506
4042
|
(window._localStorage || window.localStorage).setItem("".concat(_this27.props.dialogName || 'App', ".objectSelected"), id);
|
|
4507
|
-
|
|
4508
4043
|
_this27.setState({
|
|
4509
4044
|
editObjectDialog: id
|
|
4510
4045
|
});
|
|
@@ -4518,7 +4053,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4518
4053
|
"aria-label": "delete",
|
|
4519
4054
|
onClick: function onClick() {
|
|
4520
4055
|
var _item$children3, _item$data$obj$common2;
|
|
4521
|
-
|
|
4522
4056
|
return _this27.props.onObjectDelete(id, !!((_item$children3 = item.children) !== null && _item$children3 !== void 0 && _item$children3.length), !((_item$data$obj$common2 = item.data.obj.common) !== null && _item$data$obj$common2 !== void 0 && _item$data$obj$common2.dontDelete));
|
|
4523
4057
|
},
|
|
4524
4058
|
title: this.texts.deleteObject
|
|
@@ -4532,11 +4066,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4532
4066
|
title: this.texts.customConfig,
|
|
4533
4067
|
onClick: function onClick() {
|
|
4534
4068
|
(window._localStorage || window.localStorage).setItem((_this27.props.dialogName || 'App') + '.objectSelected', id);
|
|
4535
|
-
|
|
4536
4069
|
_this27.pauseSubscribe(true);
|
|
4537
|
-
|
|
4538
4070
|
_this27.props.router && _this27.props.router.doNavigate(null, 'customs', id);
|
|
4539
|
-
|
|
4540
4071
|
_this27.setState({
|
|
4541
4072
|
customDialog: [id]
|
|
4542
4073
|
});
|
|
@@ -4545,11 +4076,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4545
4076
|
className: classes.cellButtonsButtonIcon
|
|
4546
4077
|
})) : null];
|
|
4547
4078
|
}
|
|
4079
|
+
|
|
4548
4080
|
/**
|
|
4549
4081
|
* @private
|
|
4550
4082
|
* @param {string} id
|
|
4551
4083
|
*/
|
|
4552
|
-
|
|
4553
4084
|
}, {
|
|
4554
4085
|
key: "readHistory",
|
|
4555
4086
|
value: function readHistory(id) {
|
|
@@ -4587,7 +4118,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4587
4118
|
aggregate: 'minmax'
|
|
4588
4119
|
}).then(function (values) {
|
|
4589
4120
|
var sparks = window.document.getElementsByClassName('sparkline');
|
|
4590
|
-
|
|
4591
4121
|
for (var s = 0; s < sparks.length; s++) {
|
|
4592
4122
|
if (sparks[s].dataset.id === id) {
|
|
4593
4123
|
var v = prepareSparkData(values, nowMs);
|
|
@@ -4600,6 +4130,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4600
4130
|
});
|
|
4601
4131
|
}
|
|
4602
4132
|
}
|
|
4133
|
+
|
|
4603
4134
|
/**
|
|
4604
4135
|
* @private
|
|
4605
4136
|
* @param {string} id
|
|
@@ -4607,19 +4138,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4607
4138
|
* @param {Record<string, any>} classes
|
|
4608
4139
|
* @returns {JSX.Element | null}
|
|
4609
4140
|
*/
|
|
4610
|
-
|
|
4611
4141
|
}, {
|
|
4612
4142
|
key: "renderColumnValue",
|
|
4613
4143
|
value: function renderColumnValue(id, item, classes) {
|
|
4614
4144
|
var _obj$common4,
|
|
4615
|
-
|
|
4616
|
-
|
|
4145
|
+
_this28 = this;
|
|
4617
4146
|
var obj = item.data.obj;
|
|
4618
|
-
|
|
4619
4147
|
if (!obj || !this.states) {
|
|
4620
4148
|
return null;
|
|
4621
4149
|
}
|
|
4622
|
-
|
|
4623
4150
|
if (((_obj$common4 = obj.common) === null || _obj$common4 === void 0 ? void 0 : _obj$common4.type) === 'file') {
|
|
4624
4151
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
4625
4152
|
className: _Utils["default"].clsx(classes.cellValueText, classes.cellValueFile)
|
|
@@ -4632,15 +4159,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4632
4159
|
};
|
|
4633
4160
|
this.subscribe(id);
|
|
4634
4161
|
}
|
|
4635
|
-
|
|
4636
4162
|
return null;
|
|
4637
4163
|
} else {
|
|
4638
4164
|
!this.recordStates.includes(id) && this.recordStates.push(id);
|
|
4639
4165
|
}
|
|
4640
|
-
|
|
4641
4166
|
var state = this.states[id];
|
|
4642
4167
|
var info = item.data.state;
|
|
4643
|
-
|
|
4644
4168
|
if (!info) {
|
|
4645
4169
|
info = item.data.state = item.data.state || formatValue(id, state, obj, this.texts, this.props.dateFormat, this.props.isFloatComma);
|
|
4646
4170
|
info.valFull = info.valFull.map(function (item) {
|
|
@@ -4648,7 +4172,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4648
4172
|
return [/*#__PURE__*/_react["default"].createElement("div", {
|
|
4649
4173
|
className: classes.cellValueTooltipBoth,
|
|
4650
4174
|
key: item.t
|
|
4651
|
-
}, item.t, ": ", item.v),
|
|
4175
|
+
}, item.t, ": ", item.v),
|
|
4176
|
+
//<div className={classes.cellValueTooltipValue} key={item.t + '_v'}>{item.v}</div>,
|
|
4652
4177
|
!item.nbr ? /*#__PURE__*/_react["default"].createElement("br", {
|
|
4653
4178
|
key: item.t + '_br'
|
|
4654
4179
|
}) : null];
|
|
@@ -4664,7 +4189,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4664
4189
|
}) : null];
|
|
4665
4190
|
}
|
|
4666
4191
|
});
|
|
4667
|
-
|
|
4668
4192
|
if (this.defaultHistory && this.objects[id] && this.objects[id].common && this.objects[id].common.custom && this.objects[id].common.custom[this.defaultHistory]) {
|
|
4669
4193
|
info.valFull.push( /*#__PURE__*/_react["default"].createElement("svg", {
|
|
4670
4194
|
key: "sparkline",
|
|
@@ -4678,7 +4202,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4678
4202
|
strokeWidth: "3"
|
|
4679
4203
|
}));
|
|
4680
4204
|
}
|
|
4681
|
-
|
|
4682
4205
|
var copyText = info.valText.v || '';
|
|
4683
4206
|
info.val = copyText;
|
|
4684
4207
|
info.valText = [/*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -4696,18 +4219,17 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4696
4219
|
return _this28.onCopy(e, copyText);
|
|
4697
4220
|
},
|
|
4698
4221
|
key: "cc"
|
|
4699
|
-
})
|
|
4222
|
+
})
|
|
4223
|
+
//<IconEdit className={ Utils.clsx(classes.cellButtonsValueButton, 'copyButton', classes.cellButtonsValueButtonEdit) } key="ce" />
|
|
4700
4224
|
];
|
|
4701
4225
|
}
|
|
4702
4226
|
|
|
4703
4227
|
var val = info.valText;
|
|
4704
|
-
|
|
4705
4228
|
if (!this.state.filter.expertMode && item.data.button) {
|
|
4706
4229
|
val = /*#__PURE__*/_react["default"].createElement(_RoomService["default"], {
|
|
4707
4230
|
className: _Utils["default"].clsx(this.props.classes.cellValueButton, !this.states[id] || !this.states[id].val ? this.props.classes.cellValueButtonFalse : '')
|
|
4708
4231
|
});
|
|
4709
4232
|
}
|
|
4710
|
-
|
|
4711
4233
|
return /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
4712
4234
|
key: "value",
|
|
4713
4235
|
title: info.valFull,
|
|
@@ -4723,30 +4245,25 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4723
4245
|
className: classes.cellValueText
|
|
4724
4246
|
}, val));
|
|
4725
4247
|
}
|
|
4248
|
+
|
|
4726
4249
|
/**
|
|
4727
4250
|
* @private
|
|
4728
4251
|
* @returns {undefined}
|
|
4729
4252
|
*/
|
|
4730
|
-
|
|
4731
4253
|
}, {
|
|
4732
4254
|
key: "_syncEnum",
|
|
4733
4255
|
value: function _syncEnum(id, enumIds, newArray, cb) {
|
|
4734
4256
|
var _this29 = this;
|
|
4735
|
-
|
|
4736
4257
|
if (!enumIds || !enumIds.length) {
|
|
4737
4258
|
return cb && cb();
|
|
4738
4259
|
} else {
|
|
4739
4260
|
var _this$info$objects$en;
|
|
4740
|
-
|
|
4741
4261
|
var enumId = enumIds.pop();
|
|
4742
4262
|
var promises = [];
|
|
4743
|
-
|
|
4744
4263
|
if ((_this$info$objects$en = this.info.objects[enumId]) !== null && _this$info$objects$en !== void 0 && _this$info$objects$en.common) {
|
|
4745
4264
|
var _this$info$objects$en2, _this$info$objects$en3;
|
|
4746
|
-
|
|
4747
4265
|
if ((_this$info$objects$en2 = this.info.objects[enumId].common.members) !== null && _this$info$objects$en2 !== void 0 && _this$info$objects$en2.length) {
|
|
4748
4266
|
var pos = this.info.objects[enumId].common.members.indexOf(id);
|
|
4749
|
-
|
|
4750
4267
|
if (pos !== -1 && !newArray.includes(enumId)) {
|
|
4751
4268
|
// delete from members
|
|
4752
4269
|
var obj = JSON.parse(JSON.stringify(this.info.objects[enumId]));
|
|
@@ -4757,19 +4274,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4757
4274
|
return _this29.showError(e);
|
|
4758
4275
|
}));
|
|
4759
4276
|
}
|
|
4760
|
-
}
|
|
4761
|
-
|
|
4277
|
+
}
|
|
4762
4278
|
|
|
4279
|
+
// add to it
|
|
4763
4280
|
if (newArray.includes(enumId) && !((_this$info$objects$en3 = this.info.objects[enumId].common.members) !== null && _this$info$objects$en3 !== void 0 && _this$info$objects$en3.includes(id))) {
|
|
4764
4281
|
// add to object
|
|
4765
4282
|
var _obj = JSON.parse(JSON.stringify(this.info.objects[enumId]));
|
|
4766
|
-
|
|
4767
4283
|
_obj.common.members = _obj.common.members || [];
|
|
4768
|
-
|
|
4769
4284
|
_obj.common.members.push(id);
|
|
4770
|
-
|
|
4771
4285
|
_obj.common.members.sort();
|
|
4772
|
-
|
|
4773
4286
|
promises.push(this.props.socket.setObject(enumId, _obj).then(function () {
|
|
4774
4287
|
return _this29.info.objects[enumId] = _obj;
|
|
4775
4288
|
})["catch"](function (e) {
|
|
@@ -4777,7 +4290,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4777
4290
|
}));
|
|
4778
4291
|
}
|
|
4779
4292
|
}
|
|
4780
|
-
|
|
4781
4293
|
Promise.all(promises).then(function () {
|
|
4782
4294
|
return setTimeout(function () {
|
|
4783
4295
|
return _this29._syncEnum(id, enumIds, newArray, cb);
|
|
@@ -4785,35 +4297,33 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4785
4297
|
});
|
|
4786
4298
|
}
|
|
4787
4299
|
}
|
|
4300
|
+
|
|
4788
4301
|
/**
|
|
4789
4302
|
* @private
|
|
4790
4303
|
* @returns {Promise}
|
|
4791
4304
|
*/
|
|
4792
|
-
|
|
4793
4305
|
}, {
|
|
4794
4306
|
key: "syncEnum",
|
|
4795
4307
|
value: function syncEnum(id, enumName, newArray) {
|
|
4796
4308
|
var _this30 = this;
|
|
4797
|
-
|
|
4798
4309
|
var toCheck = (0, _toConsumableArray2["default"])(this.info[enumName === 'func' ? 'funcEnums' : 'roomEnums']);
|
|
4799
4310
|
return new Promise(function (resolve) {
|
|
4800
4311
|
return _this30._syncEnum(id, toCheck, newArray, function (error) {
|
|
4801
|
-
error && _this30.showError(error);
|
|
4802
|
-
|
|
4312
|
+
error && _this30.showError(error);
|
|
4313
|
+
// force update of object
|
|
4803
4314
|
resolve();
|
|
4804
4315
|
});
|
|
4805
4316
|
});
|
|
4806
4317
|
}
|
|
4318
|
+
|
|
4807
4319
|
/**
|
|
4808
4320
|
* @private
|
|
4809
4321
|
* @returns {JSX.Element | null}
|
|
4810
4322
|
*/
|
|
4811
|
-
|
|
4812
4323
|
}, {
|
|
4813
4324
|
key: "renderEnumDialog",
|
|
4814
4325
|
value: function renderEnumDialog() {
|
|
4815
4326
|
var _this31 = this;
|
|
4816
|
-
|
|
4817
4327
|
if (this.state.enumDialog) {
|
|
4818
4328
|
var type = this.state.enumDialog.type;
|
|
4819
4329
|
var item = this.state.enumDialog.item;
|
|
@@ -4836,7 +4346,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4836
4346
|
alt: item.name
|
|
4837
4347
|
}));
|
|
4838
4348
|
}
|
|
4839
|
-
});
|
|
4349
|
+
});
|
|
4350
|
+
|
|
4351
|
+
// const hasIcons = !!enums.find(item => item.icon);
|
|
4840
4352
|
|
|
4841
4353
|
return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
4842
4354
|
className: this.props.classes.enumDialog,
|
|
@@ -4847,7 +4359,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4847
4359
|
},
|
|
4848
4360
|
"aria-labelledby": "enum-dialog-title",
|
|
4849
4361
|
open: !0 // true
|
|
4850
|
-
|
|
4851
4362
|
}, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
|
|
4852
4363
|
id: "enum-dialog-title"
|
|
4853
4364
|
}, type === 'func' ? this.props.t('ra_Define functions') : this.props.t('ra_Define rooms'), /*#__PURE__*/_react["default"].createElement(_Fab["default"], {
|
|
@@ -4871,7 +4382,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4871
4382
|
var id;
|
|
4872
4383
|
var name;
|
|
4873
4384
|
var icon;
|
|
4874
|
-
|
|
4875
4385
|
if ((0, _typeof2["default"])(item) === 'object') {
|
|
4876
4386
|
id = item.value;
|
|
4877
4387
|
name = item.name;
|
|
@@ -4880,7 +4390,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4880
4390
|
id = item;
|
|
4881
4391
|
name = item;
|
|
4882
4392
|
}
|
|
4883
|
-
|
|
4884
4393
|
var labelId = "checkbox-list-label-".concat(id);
|
|
4885
4394
|
return /*#__PURE__*/_react["default"].createElement(_ListItem["default"], {
|
|
4886
4395
|
className: _this31.props.classes.headerCellSelectItem,
|
|
@@ -4888,14 +4397,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4888
4397
|
onClick: function onClick() {
|
|
4889
4398
|
var pos = itemEnums.indexOf(id);
|
|
4890
4399
|
var enumDialogEnums = JSON.parse(JSON.stringify(_this31.state.enumDialogEnums));
|
|
4891
|
-
|
|
4892
4400
|
if (pos === -1) {
|
|
4893
4401
|
enumDialogEnums.push(id);
|
|
4894
4402
|
enumDialogEnums.sort();
|
|
4895
4403
|
} else {
|
|
4896
4404
|
enumDialogEnums.splice(pos, 1);
|
|
4897
4405
|
}
|
|
4898
|
-
|
|
4899
4406
|
_this31.setState({
|
|
4900
4407
|
enumDialogEnums: enumDialogEnums
|
|
4901
4408
|
});
|
|
@@ -4920,16 +4427,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4920
4427
|
return null;
|
|
4921
4428
|
}
|
|
4922
4429
|
}
|
|
4430
|
+
|
|
4923
4431
|
/**
|
|
4924
4432
|
* @private
|
|
4925
4433
|
* @returns {JSX.Element | null}
|
|
4926
4434
|
*/
|
|
4927
|
-
|
|
4928
4435
|
}, {
|
|
4929
4436
|
key: "renderEditRoleDialog",
|
|
4930
4437
|
value: function renderEditRoleDialog() {
|
|
4931
4438
|
var _this32 = this;
|
|
4932
|
-
|
|
4933
4439
|
if (this.state.roleDialog && this.props.objectBrowserEditRole) {
|
|
4934
4440
|
var ObjectBrowserEditRole = this.props.objectBrowserEditRole;
|
|
4935
4441
|
return /*#__PURE__*/_react["default"].createElement(ObjectBrowserEditRole, {
|
|
@@ -4942,7 +4448,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4942
4448
|
if (obj) {
|
|
4943
4449
|
_this32.info.objects[_this32.state.roleDialog] = obj;
|
|
4944
4450
|
}
|
|
4945
|
-
|
|
4946
4451
|
_this32.setState({
|
|
4947
4452
|
roleDialog: false
|
|
4948
4453
|
});
|
|
@@ -4952,25 +4457,22 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4952
4457
|
return null;
|
|
4953
4458
|
}
|
|
4954
4459
|
}
|
|
4460
|
+
|
|
4955
4461
|
/**
|
|
4956
4462
|
* @private
|
|
4957
4463
|
* @param {boolean} [isSave]
|
|
4958
4464
|
*/
|
|
4959
|
-
|
|
4960
4465
|
}, {
|
|
4961
4466
|
key: "onColumnsEditCustomDialogClose",
|
|
4962
4467
|
value: function onColumnsEditCustomDialogClose(isSave) {
|
|
4963
4468
|
var _this33 = this;
|
|
4964
|
-
|
|
4965
4469
|
if (isSave) {
|
|
4966
4470
|
var value = this.customColumnDialog.value;
|
|
4967
|
-
|
|
4968
4471
|
if (this.customColumnDialog.type === 'boolean') {
|
|
4969
4472
|
value = value === 'true' || value === true;
|
|
4970
4473
|
} else if (this.customColumnDialog.type === 'number') {
|
|
4971
4474
|
value = parseFloat(value);
|
|
4972
4475
|
}
|
|
4973
|
-
|
|
4974
4476
|
this.customColumnDialog = null;
|
|
4975
4477
|
this.props.socket.getObject(this.state.columnsEditCustomDialog.obj._id).then(function (obj) {
|
|
4976
4478
|
if (_this33.setCustomValue(obj, _this33.state.columnsEditCustomDialog.it, value)) {
|
|
@@ -4992,15 +4494,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
4992
4494
|
});
|
|
4993
4495
|
}
|
|
4994
4496
|
}
|
|
4497
|
+
|
|
4995
4498
|
/**
|
|
4996
4499
|
* @private
|
|
4997
4500
|
*/
|
|
4998
|
-
|
|
4999
4501
|
}, {
|
|
5000
4502
|
key: "renderColumnsEditCustomDialog",
|
|
5001
4503
|
value: function renderColumnsEditCustomDialog() {
|
|
5002
4504
|
var _this34 = this;
|
|
5003
|
-
|
|
5004
4505
|
if (this.state.columnsEditCustomDialog) {
|
|
5005
4506
|
if (!this.customColumnDialog) {
|
|
5006
4507
|
var value = this.getCustomValue(this.state.columnsEditCustomDialog.obj, this.state.columnsEditCustomDialog.it);
|
|
@@ -5010,7 +4511,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5010
4511
|
value: (value === null || value === undefined ? '' : value).toString()
|
|
5011
4512
|
};
|
|
5012
4513
|
}
|
|
5013
|
-
|
|
5014
4514
|
return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
5015
4515
|
onClose: function onClose() {
|
|
5016
4516
|
return _this34.setState({
|
|
@@ -5033,7 +4533,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5033
4533
|
onChange: function onChange(e) {
|
|
5034
4534
|
_this34.customColumnDialog.value = e.target.checked.toString();
|
|
5035
4535
|
var changed = _this34.customColumnDialog.value !== _this34.customColumnDialog.initValue;
|
|
5036
|
-
|
|
5037
4536
|
if (changed === !_this34.state.customColumnDialogValueChanged) {
|
|
5038
4537
|
_this34.setState({
|
|
5039
4538
|
customColumnDialogValueChanged: changed
|
|
@@ -5053,7 +4552,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5053
4552
|
onChange: function onChange(e) {
|
|
5054
4553
|
_this34.customColumnDialog.value = e.target.value;
|
|
5055
4554
|
var changed = _this34.customColumnDialog.value !== _this34.customColumnDialog.initValue;
|
|
5056
|
-
|
|
5057
4555
|
if (changed === !_this34.state.customColumnDialogValueChanged) {
|
|
5058
4556
|
_this34.setState({
|
|
5059
4557
|
customColumnDialogValueChanged: changed
|
|
@@ -5081,19 +4579,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5081
4579
|
return null;
|
|
5082
4580
|
}
|
|
5083
4581
|
}
|
|
4582
|
+
|
|
5084
4583
|
/**
|
|
5085
4584
|
* @private
|
|
5086
4585
|
* @param {any} obj
|
|
5087
4586
|
* @param {any} it
|
|
5088
4587
|
*/
|
|
5089
|
-
|
|
5090
4588
|
}, {
|
|
5091
4589
|
key: "getCustomValue",
|
|
5092
4590
|
value: function getCustomValue(obj, it) {
|
|
5093
4591
|
if (obj && obj._id && obj._id.startsWith(it.adapter + '.') && it.path.length > 1) {
|
|
5094
4592
|
var p = it.path;
|
|
5095
4593
|
var value;
|
|
5096
|
-
|
|
5097
4594
|
if (obj[p[0]] && (0, _typeof2["default"])(obj[p[0]]) === 'object') {
|
|
5098
4595
|
if (p.length === 2) {
|
|
5099
4596
|
// most common case
|
|
@@ -5107,7 +4604,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5107
4604
|
} else if (p.length === 6) {
|
|
5108
4605
|
value = obj[p[0]][p[1]] && (0, _typeof2["default"])(obj[p[0]][p[1]]) === 'object' && obj[p[0]][p[1]][p[2]] && obj[p[0]][p[1]][p[2]][p[3]] && obj[p[0]][p[1]][p[2]][p[3]][p[4]] ? obj[p[0]][p[1]][p[2]][p[3]][p[4]][p[5]] : null;
|
|
5109
4606
|
}
|
|
5110
|
-
|
|
5111
4607
|
if (value === undefined || value === null) {
|
|
5112
4608
|
return null;
|
|
5113
4609
|
} else {
|
|
@@ -5118,19 +4614,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5118
4614
|
return null;
|
|
5119
4615
|
}
|
|
5120
4616
|
}
|
|
4617
|
+
|
|
5121
4618
|
/**
|
|
5122
4619
|
* @private
|
|
5123
4620
|
* @param {any} obj
|
|
5124
4621
|
* @param {any} it
|
|
5125
4622
|
* @param {any} value
|
|
5126
4623
|
*/
|
|
5127
|
-
|
|
5128
4624
|
}, {
|
|
5129
4625
|
key: "setCustomValue",
|
|
5130
4626
|
value: function setCustomValue(obj, it, value) {
|
|
5131
4627
|
if (obj && obj._id && obj._id.startsWith(it.adapter + '.') && it.path.length > 1) {
|
|
5132
4628
|
var p = it.path;
|
|
5133
|
-
|
|
5134
4629
|
if (obj[p[0]] && (0, _typeof2["default"])(obj[p[0]]) === 'object') {
|
|
5135
4630
|
if (p.length === 2) {
|
|
5136
4631
|
// most common case
|
|
@@ -5159,9 +4654,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5159
4654
|
}
|
|
5160
4655
|
}
|
|
5161
4656
|
}
|
|
5162
|
-
|
|
5163
4657
|
return false;
|
|
5164
4658
|
}
|
|
4659
|
+
|
|
5165
4660
|
/**
|
|
5166
4661
|
* Renders a custom value.
|
|
5167
4662
|
* @param {any} obj
|
|
@@ -5169,14 +4664,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5169
4664
|
* @param {any} item
|
|
5170
4665
|
* @returns {JSX.Element | null}
|
|
5171
4666
|
*/
|
|
5172
|
-
|
|
5173
4667
|
}, {
|
|
5174
4668
|
key: "renderCustomValue",
|
|
5175
4669
|
value: function renderCustomValue(obj, it, item) {
|
|
5176
4670
|
var _this35 = this;
|
|
5177
|
-
|
|
5178
4671
|
var text = this.getCustomValue(obj, it);
|
|
5179
|
-
|
|
5180
4672
|
if (text !== null && text !== undefined) {
|
|
5181
4673
|
if (it.edit && !this.props.notEditable && (!it.objTypes || it.objTypes.includes(obj.type))) {
|
|
5182
4674
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -5201,6 +4693,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5201
4693
|
return null;
|
|
5202
4694
|
}
|
|
5203
4695
|
}
|
|
4696
|
+
|
|
5204
4697
|
/**
|
|
5205
4698
|
* Renders a leaf.
|
|
5206
4699
|
* @param {any} item
|
|
@@ -5209,28 +4702,26 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5209
4702
|
* @param {{ count: number; }} counter
|
|
5210
4703
|
* @returns {JSX.Element}
|
|
5211
4704
|
*/
|
|
5212
|
-
|
|
5213
4705
|
}, {
|
|
5214
4706
|
key: "renderLeaf",
|
|
5215
4707
|
value: function renderLeaf(item, isExpanded, classes, counter) {
|
|
5216
4708
|
var _this36 = this,
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
4709
|
+
_common$alias,
|
|
4710
|
+
_common$alias2,
|
|
4711
|
+
_this$states$id2,
|
|
4712
|
+
_item$data,
|
|
4713
|
+
_item$data2,
|
|
4714
|
+
_this$states$id3,
|
|
4715
|
+
_this$states$id4,
|
|
4716
|
+
_this$states$id5;
|
|
5226
4717
|
var id = item.data.id;
|
|
5227
4718
|
counter.count++;
|
|
5228
|
-
isExpanded = isExpanded === undefined ? this.state.expanded.includes(id) : isExpanded;
|
|
4719
|
+
isExpanded = isExpanded === undefined ? this.state.expanded.includes(id) : isExpanded;
|
|
5229
4720
|
|
|
4721
|
+
// icon
|
|
5230
4722
|
var iconFolder;
|
|
5231
4723
|
var obj = item.data.obj;
|
|
5232
4724
|
var itemType = obj === null || obj === void 0 ? void 0 : obj.type;
|
|
5233
|
-
|
|
5234
4725
|
if (item.children || itemType === 'folder' || itemType === 'device' || itemType === 'channel' || itemType === 'meta') {
|
|
5235
4726
|
iconFolder = isExpanded ? /*#__PURE__*/_react["default"].createElement(_IconOpen["default"], {
|
|
5236
4727
|
className: classes.cellIdIconFolder,
|
|
@@ -5254,9 +4745,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5254
4745
|
});
|
|
5255
4746
|
}
|
|
5256
4747
|
}
|
|
5257
|
-
|
|
5258
4748
|
var iconItem = null;
|
|
5259
|
-
|
|
5260
4749
|
if (item.data.icon) {
|
|
5261
4750
|
if (typeof item.data.icon === 'string') {
|
|
5262
4751
|
if (item.data.icon.length < 3) {
|
|
@@ -5274,72 +4763,56 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5274
4763
|
iconItem = item.data.icon;
|
|
5275
4764
|
}
|
|
5276
4765
|
}
|
|
5277
|
-
|
|
5278
4766
|
var common = obj === null || obj === void 0 ? void 0 : obj.common;
|
|
5279
|
-
|
|
5280
4767
|
var typeImg = obj && obj.type && ITEM_IMAGES[obj.type] || /*#__PURE__*/_react["default"].createElement("div", {
|
|
5281
4768
|
className: "itemIcon"
|
|
5282
4769
|
});
|
|
5283
|
-
|
|
5284
4770
|
var paddingLeft = this.levelPadding * item.data.level;
|
|
5285
|
-
|
|
5286
4771
|
if (item.data.lang !== this.state.lang) {
|
|
5287
4772
|
var _findRoomsForObject = findRoomsForObject(this.info, id, this.state.lang),
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
4773
|
+
rooms = _findRoomsForObject.rooms,
|
|
4774
|
+
per = _findRoomsForObject.per;
|
|
5291
4775
|
item.data.rooms = rooms.join(', ');
|
|
5292
4776
|
item.data.per = per;
|
|
5293
|
-
|
|
5294
4777
|
var _findFunctionsForObje = findFunctionsForObject(this.info, id, this.state.lang),
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
4778
|
+
funcs = _findFunctionsForObje.funcs,
|
|
4779
|
+
pef = _findFunctionsForObje.pef;
|
|
5298
4780
|
item.data.funcs = funcs.join(', ');
|
|
5299
4781
|
item.data.pef = pef;
|
|
5300
4782
|
item.data.lang = this.state.lang;
|
|
5301
4783
|
}
|
|
5302
|
-
|
|
5303
4784
|
var checkbox = this.props.multiSelect && this.objects[id] && (!this.props.types || this.props.types.includes(this.objects[id].type)) ? /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
5304
4785
|
className: classes.checkBox,
|
|
5305
4786
|
checked: this.state.selected.includes(id)
|
|
5306
4787
|
}) : null;
|
|
5307
4788
|
var valueEditable = !this.props.notEditable && itemType === 'state' && (this.state.filter.expertMode || (common === null || common === void 0 ? void 0 : common.write) !== false);
|
|
5308
|
-
|
|
5309
4789
|
if (this.props.objectBrowserViewFile && (common === null || common === void 0 ? void 0 : common.type) === 'file') {
|
|
5310
4790
|
valueEditable = true;
|
|
5311
4791
|
}
|
|
5312
|
-
|
|
5313
4792
|
var enumEditable = !this.props.notEditable && this.objects[id] && (this.state.filter.expertMode || itemType === 'state' || itemType === 'channel' || itemType === 'device');
|
|
5314
4793
|
var checkVisibleObjectType = this.state.statesView && (itemType === 'state' || itemType === 'channel' || itemType === 'device');
|
|
5315
4794
|
var newValue = '';
|
|
5316
4795
|
var newValueTitle = [];
|
|
5317
|
-
|
|
5318
4796
|
if (checkVisibleObjectType) {
|
|
5319
4797
|
var _this$states$id;
|
|
5320
|
-
|
|
5321
4798
|
newValue = (_this$states$id = this.states[id]) === null || _this$states$id === void 0 ? void 0 : _this$states$id.from;
|
|
5322
|
-
|
|
5323
4799
|
if (newValue === undefined) {
|
|
5324
4800
|
newValue = ' ';
|
|
5325
4801
|
} else {
|
|
5326
4802
|
newValue = newValue ? newValue.replace(/^system\.adapter\.|^system\./, '') : '';
|
|
5327
4803
|
newValueTitle.push("".concat(this.texts.stateChangedFrom, " ").concat(newValue));
|
|
5328
4804
|
}
|
|
5329
|
-
|
|
5330
4805
|
if (obj.user) {
|
|
5331
4806
|
var user = obj.user.replace('system.user.', '');
|
|
5332
4807
|
newValue += "/".concat(user);
|
|
5333
4808
|
newValueTitle.push("".concat(this.texts.stateChangedBy, " ").concat(user));
|
|
5334
4809
|
}
|
|
5335
4810
|
}
|
|
5336
|
-
|
|
5337
4811
|
if (obj) {
|
|
5338
4812
|
obj.from && newValueTitle.push(this.texts.objectChangedFrom + ' ' + obj.from.replace(/^system\.adapter\.|^system\./, ''));
|
|
5339
4813
|
obj.user && newValueTitle.push(this.texts.objectChangedBy + ' ' + obj.user.replace(/^system\.user\./, ''));
|
|
5340
4814
|
obj.ts && newValueTitle.push(this.texts.objectChangedByUser + ' ' + _Utils["default"].formatDate(new Date(obj.ts), this.props.dateFormat));
|
|
5341
4815
|
}
|
|
5342
|
-
|
|
5343
4816
|
var readWriteAlias = (0, _typeof2["default"])(common === null || common === void 0 ? void 0 : (_common$alias = common.alias) === null || _common$alias === void 0 ? void 0 : _common$alias.id) === 'object';
|
|
5344
4817
|
var alias = id.startsWith('alias.') && common !== null && common !== void 0 && (_common$alias2 = common.alias) !== null && _common$alias2 !== void 0 && _common$alias2.id ? readWriteAlias ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
5345
4818
|
className: classes.cellIdAliasReadWriteDiv
|
|
@@ -5347,9 +4820,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5347
4820
|
onClick: function onClick(e) {
|
|
5348
4821
|
e.stopPropagation();
|
|
5349
4822
|
e.preventDefault();
|
|
5350
|
-
|
|
5351
4823
|
_this36.onSelect(common.alias.id.read);
|
|
5352
|
-
|
|
5353
4824
|
setTimeout(function () {
|
|
5354
4825
|
_this36.expandAllSelected(function () {
|
|
5355
4826
|
return _this36.scrollToItem(common.alias.id.read);
|
|
@@ -5361,9 +4832,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5361
4832
|
onClick: function onClick(e) {
|
|
5362
4833
|
e.stopPropagation();
|
|
5363
4834
|
e.preventDefault();
|
|
5364
|
-
|
|
5365
4835
|
_this36.onSelect(common.alias.id.write);
|
|
5366
|
-
|
|
5367
4836
|
setTimeout(function () {
|
|
5368
4837
|
_this36.expandAllSelected(function () {
|
|
5369
4838
|
return _this36.scrollToItem(common.alias.id.write);
|
|
@@ -5375,9 +4844,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5375
4844
|
onClick: function onClick(e) {
|
|
5376
4845
|
e.stopPropagation();
|
|
5377
4846
|
e.preventDefault();
|
|
5378
|
-
|
|
5379
4847
|
_this36.onSelect(common.alias.id);
|
|
5380
|
-
|
|
5381
4848
|
setTimeout(function () {
|
|
5382
4849
|
_this36.expandAllSelected(function () {
|
|
5383
4850
|
return _this36.scrollToItem(common.alias.id);
|
|
@@ -5388,47 +4855,37 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5388
4855
|
}, "\u2192", common.alias.id) : null;
|
|
5389
4856
|
var checkColor = common === null || common === void 0 ? void 0 : common.color;
|
|
5390
4857
|
var invertBackground = 'none';
|
|
5391
|
-
|
|
5392
4858
|
if (checkColor && !this.state.selected.includes(id)) {
|
|
5393
4859
|
invertBackground = _Utils["default"].invertColor(checkColor, true);
|
|
5394
4860
|
}
|
|
5395
|
-
|
|
5396
4861
|
if (!checkColor || this.state.selected.includes(id)) {
|
|
5397
4862
|
checkColor = 'inherit';
|
|
5398
4863
|
}
|
|
5399
|
-
|
|
5400
4864
|
var icons = [];
|
|
5401
|
-
|
|
5402
4865
|
if (common !== null && common !== void 0 && common.statusStates) {
|
|
5403
4866
|
var ids = {};
|
|
5404
4867
|
Object.keys(common.statusStates).forEach(function (name) {
|
|
5405
4868
|
var _id = common.statusStates[name];
|
|
5406
|
-
|
|
5407
4869
|
if (_id.split('.').length < 3) {
|
|
5408
4870
|
_id = id + '.' + _id;
|
|
5409
4871
|
}
|
|
5410
|
-
|
|
5411
4872
|
ids[name] = _id;
|
|
5412
|
-
|
|
5413
4873
|
if (!_this36.states[_id]) {
|
|
5414
4874
|
var _this36$objects$_id;
|
|
5415
|
-
|
|
5416
4875
|
if (((_this36$objects$_id = _this36.objects[_id]) === null || _this36$objects$_id === void 0 ? void 0 : _this36$objects$_id.type) === 'state') {
|
|
5417
4876
|
!_this36.recordStates.includes(_id) && _this36.recordStates.push(_id);
|
|
5418
4877
|
_this36.states[_id] = {
|
|
5419
4878
|
val: null
|
|
5420
4879
|
};
|
|
5421
|
-
|
|
5422
4880
|
_this36.subscribe(_id);
|
|
5423
4881
|
}
|
|
5424
4882
|
} else {
|
|
5425
4883
|
!_this36.recordStates.includes(_id) && _this36.recordStates.push(_id);
|
|
5426
4884
|
}
|
|
5427
|
-
});
|
|
4885
|
+
});
|
|
4886
|
+
// calculate color
|
|
5428
4887
|
// errorId has priority
|
|
5429
|
-
|
|
5430
4888
|
var colorSet = false;
|
|
5431
|
-
|
|
5432
4889
|
if (common.statusStates.errorId && this.states[ids.errorId] && this.states[ids.errorId].val) {
|
|
5433
4890
|
checkColor = this.props.themeType === 'dark' ? COLOR_NAME_ERROR_DARK : COLOR_NAME_ERROR_LIGHT;
|
|
5434
4891
|
colorSet = true;
|
|
@@ -5438,7 +4895,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5438
4895
|
className: this.props.classes.iconDeviceError
|
|
5439
4896
|
}));
|
|
5440
4897
|
}
|
|
5441
|
-
|
|
5442
4898
|
if (ids.onlineId && this.states[ids.onlineId] && this.states[ids.onlineId].val !== null) {
|
|
5443
4899
|
if (!colorSet) {
|
|
5444
4900
|
if (this.states[ids.onlineId].val) {
|
|
@@ -5501,7 +4957,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5501
4957
|
}
|
|
5502
4958
|
}
|
|
5503
4959
|
}
|
|
5504
|
-
|
|
5505
4960
|
var q = checkVisibleObjectType ? _Utils["default"].quality2text(((_this$states$id2 = this.states[id]) === null || _this$states$id2 === void 0 ? void 0 : _this$states$id2.q) || 0).join(', ') : null;
|
|
5506
4961
|
return /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
5507
4962
|
container: true,
|
|
@@ -5602,7 +5057,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5602
5057
|
},
|
|
5603
5058
|
onClick: enumEditable ? function () {
|
|
5604
5059
|
var enums = findEnumsForObjectAsIds(_this36.info, item.data.id, 'roomEnums');
|
|
5605
|
-
|
|
5606
5060
|
_this36.setState({
|
|
5607
5061
|
enumDialogEnums: enums,
|
|
5608
5062
|
enumDialog: {
|
|
@@ -5620,7 +5074,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5620
5074
|
},
|
|
5621
5075
|
onClick: enumEditable ? function () {
|
|
5622
5076
|
var enums = findEnumsForObjectAsIds(_this36.info, item.data.id, 'funcEnums');
|
|
5623
|
-
|
|
5624
5077
|
_this36.setState({
|
|
5625
5078
|
enumDialogEnums: enums,
|
|
5626
5079
|
enumDialog: {
|
|
@@ -5671,27 +5124,24 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5671
5124
|
if (!obj || !_this36.states) {
|
|
5672
5125
|
return null;
|
|
5673
5126
|
}
|
|
5674
|
-
|
|
5675
5127
|
if ((common === null || common === void 0 ? void 0 : common.type) === 'file') {
|
|
5676
5128
|
return _this36.setState({
|
|
5677
5129
|
viewFileDialog: id
|
|
5678
5130
|
});
|
|
5679
|
-
}
|
|
5680
|
-
|
|
5131
|
+
}
|
|
5681
5132
|
|
|
5133
|
+
// in non-expert mode control button directly
|
|
5682
5134
|
if (!_this36.state.filter.expertMode && item.data.button) {
|
|
5683
5135
|
return _this36.props.socket.setState(id, true)["catch"](function (e) {
|
|
5684
5136
|
return window.alert("Cannot write state \"".concat(id, "\": ").concat(e));
|
|
5685
5137
|
});
|
|
5686
5138
|
}
|
|
5687
|
-
|
|
5688
5139
|
_this36.edit = {
|
|
5689
5140
|
val: _this36.states[id] ? _this36.states[id].val : '',
|
|
5690
5141
|
q: _this36.states[id] ? _this36.states[id].q || 0 : 0,
|
|
5691
5142
|
ack: false,
|
|
5692
5143
|
id: id
|
|
5693
5144
|
};
|
|
5694
|
-
|
|
5695
5145
|
_this36.setState({
|
|
5696
5146
|
updateOpened: true
|
|
5697
5147
|
});
|
|
@@ -5703,6 +5153,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5703
5153
|
}
|
|
5704
5154
|
}, this.renderColumnButtons(id, item, classes)) : null);
|
|
5705
5155
|
}
|
|
5156
|
+
|
|
5706
5157
|
/**
|
|
5707
5158
|
* Renders an item.
|
|
5708
5159
|
* @param {any} root
|
|
@@ -5711,19 +5162,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5711
5162
|
* @param {{ count: any; }} [counter]
|
|
5712
5163
|
* @returns {JSX.Element[]}
|
|
5713
5164
|
*/
|
|
5714
|
-
|
|
5715
5165
|
}, {
|
|
5716
5166
|
key: "renderItem",
|
|
5717
5167
|
value: function renderItem(root, isExpanded, classes, counter) {
|
|
5718
5168
|
var _this37 = this;
|
|
5719
|
-
|
|
5720
5169
|
var items = [];
|
|
5721
5170
|
counter = counter || {
|
|
5722
5171
|
count: 0
|
|
5723
5172
|
};
|
|
5724
5173
|
var leaf = this.renderLeaf(root, isExpanded, classes, counter);
|
|
5725
5174
|
var DragWrapper = this.props.DragWrapper;
|
|
5726
|
-
|
|
5727
5175
|
if (this.props.dragEnabled) {
|
|
5728
5176
|
if (root.data.sumVisibility) {
|
|
5729
5177
|
leaf = /*#__PURE__*/_react["default"].createElement(DragWrapper, {
|
|
@@ -5739,10 +5187,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5739
5187
|
}, leaf);
|
|
5740
5188
|
}
|
|
5741
5189
|
}
|
|
5742
|
-
|
|
5743
5190
|
root.data.id && items.push(leaf);
|
|
5744
5191
|
isExpanded = isExpanded === undefined ? binarySearch(this.state.expanded, root.data.id) : isExpanded;
|
|
5745
|
-
|
|
5746
5192
|
if (!root.data.id || isExpanded) {
|
|
5747
5193
|
if (!this.state.foldersFirst) {
|
|
5748
5194
|
root.children && items.push(root.children.map(function (item) {
|
|
@@ -5752,7 +5198,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5752
5198
|
return _this37.renderItem(item, undefined, classes, counter);
|
|
5753
5199
|
}
|
|
5754
5200
|
}
|
|
5755
|
-
|
|
5756
5201
|
return null;
|
|
5757
5202
|
}));
|
|
5758
5203
|
} else {
|
|
@@ -5766,10 +5211,9 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5766
5211
|
}
|
|
5767
5212
|
}
|
|
5768
5213
|
}
|
|
5769
|
-
|
|
5770
5214
|
return null;
|
|
5771
|
-
}));
|
|
5772
|
-
|
|
5215
|
+
}));
|
|
5216
|
+
// then items
|
|
5773
5217
|
root.children && items.push(root.children.map(function (item) {
|
|
5774
5218
|
if (!item.children) {
|
|
5775
5219
|
// do not render too many items in column editor mode
|
|
@@ -5779,14 +5223,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5779
5223
|
}
|
|
5780
5224
|
}
|
|
5781
5225
|
}
|
|
5782
|
-
|
|
5783
5226
|
return null;
|
|
5784
5227
|
}));
|
|
5785
5228
|
}
|
|
5786
5229
|
}
|
|
5787
|
-
|
|
5788
5230
|
return items;
|
|
5789
5231
|
}
|
|
5232
|
+
|
|
5790
5233
|
/**
|
|
5791
5234
|
* @private
|
|
5792
5235
|
* @param {boolean} [columnsAuto]
|
|
@@ -5794,12 +5237,10 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5794
5237
|
* @param {any} [columnsForAdmin]
|
|
5795
5238
|
* @param {Record<string, number>} [columnsWidths]
|
|
5796
5239
|
*/
|
|
5797
|
-
|
|
5798
5240
|
}, {
|
|
5799
5241
|
key: "calculateColumnsVisibility",
|
|
5800
5242
|
value: function calculateColumnsVisibility(columnsAuto, columns, columnsForAdmin, columnsWidths) {
|
|
5801
5243
|
var _this38 = this;
|
|
5802
|
-
|
|
5803
5244
|
columnsWidths = columnsWidths || this.state.columnsWidths;
|
|
5804
5245
|
columnsForAdmin = columnsForAdmin || this.state.columnsForAdmin;
|
|
5805
5246
|
columns = columns || this.state.columns || [];
|
|
@@ -5812,7 +5253,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5812
5253
|
});
|
|
5813
5254
|
this.adapterColumns = [];
|
|
5814
5255
|
var WIDTHS = SCREEN_WIDTHS[this.props.width].widths;
|
|
5815
|
-
|
|
5816
5256
|
if (columnsAuto) {
|
|
5817
5257
|
this.columnsVisibility = {
|
|
5818
5258
|
id: SCREEN_WIDTHS[this.props.width].idWidth,
|
|
@@ -5829,10 +5269,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5829
5269
|
val: this.visibleCols.includes('val') ? WIDTHS.val || 0 : 0,
|
|
5830
5270
|
buttons: this.visibleCols.includes('buttons') ? WIDTHS.buttons || 0 : 0
|
|
5831
5271
|
};
|
|
5832
|
-
|
|
5833
5272
|
if (this.columnsVisibility.name && !this.customWidth) {
|
|
5834
5273
|
var widthSum = this.columnsVisibility.id; // id is always visible
|
|
5835
|
-
|
|
5836
5274
|
if (this.state.statesView) {
|
|
5837
5275
|
widthSum += this.columnsVisibility.changedFrom;
|
|
5838
5276
|
widthSum += this.columnsVisibility.qualityCode;
|
|
@@ -5844,7 +5282,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5844
5282
|
widthSum += this.columnsVisibility.room;
|
|
5845
5283
|
widthSum += this.columnsVisibility.func;
|
|
5846
5284
|
}
|
|
5847
|
-
|
|
5848
5285
|
widthSum += this.columnsVisibility.val;
|
|
5849
5286
|
widthSum += this.columnsVisibility.buttons;
|
|
5850
5287
|
this.columnsVisibility.name = "calc(100% - ".concat(widthSum + 5, "px)");
|
|
@@ -5852,7 +5289,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5852
5289
|
} else if (!this.customWidth) {
|
|
5853
5290
|
// Calculate the with of ID
|
|
5854
5291
|
var _widthSum = 0; // id is always visible
|
|
5855
|
-
|
|
5856
5292
|
if (this.state.statesView) {
|
|
5857
5293
|
_widthSum += this.columnsVisibility.changedFrom;
|
|
5858
5294
|
_widthSum += this.columnsVisibility.qualityCode;
|
|
@@ -5864,7 +5300,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5864
5300
|
_widthSum += this.columnsVisibility.room;
|
|
5865
5301
|
_widthSum += this.columnsVisibility.func;
|
|
5866
5302
|
}
|
|
5867
|
-
|
|
5868
5303
|
_widthSum += this.columnsVisibility.val;
|
|
5869
5304
|
_widthSum += this.columnsVisibility.buttons;
|
|
5870
5305
|
this.columnsVisibility.id = "calc(100% - ".concat(_widthSum + 5, "px)");
|
|
@@ -5879,20 +5314,17 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5879
5314
|
func: columns.includes('func') ? columnsWidths.func || WIDTHS.func || SCREEN_WIDTHS[this.props.width].widths.func || 0 : 0
|
|
5880
5315
|
};
|
|
5881
5316
|
var _widthSum2 = this.columnsVisibility.id; // id is always visible
|
|
5882
|
-
|
|
5883
5317
|
if (this.columnsVisibility.name) {
|
|
5884
5318
|
_widthSum2 += this.columnsVisibility.type;
|
|
5885
5319
|
_widthSum2 += this.columnsVisibility.role;
|
|
5886
5320
|
_widthSum2 += this.columnsVisibility.room;
|
|
5887
5321
|
_widthSum2 += this.columnsVisibility.func;
|
|
5888
5322
|
}
|
|
5889
|
-
|
|
5890
5323
|
if (columnsForAdmin && columns) {
|
|
5891
5324
|
Object.keys(columnsForAdmin).sort().forEach(function (adapter) {
|
|
5892
5325
|
return columnsForAdmin[adapter].forEach(function (column) {
|
|
5893
5326
|
var id = '_' + adapter + '_' + column.path;
|
|
5894
5327
|
_this38.columnsVisibility[id] = columns.includes(id);
|
|
5895
|
-
|
|
5896
5328
|
if (columns.includes(id)) {
|
|
5897
5329
|
var item = {
|
|
5898
5330
|
adapter: adapter,
|
|
@@ -5901,21 +5333,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5901
5333
|
path: column.path.split('.'),
|
|
5902
5334
|
pathText: column.path
|
|
5903
5335
|
};
|
|
5904
|
-
|
|
5905
5336
|
if (column.edit) {
|
|
5906
5337
|
item.edit = true;
|
|
5907
|
-
|
|
5908
5338
|
if (column.type) {
|
|
5909
5339
|
item.type = column.type;
|
|
5910
5340
|
}
|
|
5911
|
-
|
|
5912
5341
|
if (column.objTypes) {
|
|
5913
5342
|
item.objTypes = column.objTypes;
|
|
5914
5343
|
}
|
|
5915
5344
|
}
|
|
5916
|
-
|
|
5917
5345
|
_this38.adapterColumns.push(item);
|
|
5918
|
-
|
|
5919
5346
|
_this38.columnsVisibility[id] = columnsWidths[item.id] || column.width || SCREEN_WIDTHS[_this38.props.width].widths.func || SCREEN_WIDTHS.xl.widths.func;
|
|
5920
5347
|
_widthSum2 += _this38.columnsVisibility[id];
|
|
5921
5348
|
} else {
|
|
@@ -5924,17 +5351,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5924
5351
|
});
|
|
5925
5352
|
});
|
|
5926
5353
|
}
|
|
5927
|
-
|
|
5928
5354
|
this.adapterColumns.sort(function (a, b) {
|
|
5929
5355
|
return a.id > b.id ? -1 : a.id < b.id ? 1 : 0;
|
|
5930
5356
|
});
|
|
5931
|
-
this.columnsVisibility.val = columns.includes('val') ? columnsWidths.val || WIDTHS.val || SCREEN_WIDTHS.xl.widths.val : 0;
|
|
5357
|
+
this.columnsVisibility.val = columns.includes('val') ? columnsWidths.val || WIDTHS.val || SCREEN_WIDTHS.xl.widths.val : 0;
|
|
5932
5358
|
|
|
5359
|
+
// do not show buttons if not desired
|
|
5933
5360
|
if (!this.props.columns || this.props.columns.includes('buttons')) {
|
|
5934
5361
|
this.columnsVisibility.buttons = columns.includes('buttons') ? columnsWidths.buttons || WIDTHS.buttons || SCREEN_WIDTHS.xl.widths.buttons : 0;
|
|
5935
5362
|
_widthSum2 += this.columnsVisibility.buttons;
|
|
5936
5363
|
}
|
|
5937
|
-
|
|
5938
5364
|
if (this.columnsVisibility.name && !columnsWidths.name) {
|
|
5939
5365
|
_widthSum2 += this.columnsVisibility.val;
|
|
5940
5366
|
this.columnsVisibility.name = "calc(100% - ".concat(_widthSum2, "px)");
|
|
@@ -5960,10 +5386,8 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5960
5386
|
*/
|
|
5961
5387
|
function renderHeader() {
|
|
5962
5388
|
var _this39 = this;
|
|
5963
|
-
|
|
5964
5389
|
var classes = this.props.classes;
|
|
5965
5390
|
var filterClearInValue = null;
|
|
5966
|
-
|
|
5967
5391
|
if (!this.columnsVisibility.buttons && !this.isFilterEmpty()) {
|
|
5968
5392
|
filterClearInValue = /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
5969
5393
|
onClick: function onClick() {
|
|
@@ -5976,7 +5400,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
5976
5400
|
className: classes.buttonClearFilterIcon
|
|
5977
5401
|
}));
|
|
5978
5402
|
}
|
|
5979
|
-
|
|
5980
5403
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
5981
5404
|
className: classes.headerRow
|
|
5982
5405
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -6087,16 +5510,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6087
5510
|
}
|
|
6088
5511
|
}, " ", this.getFilterSelectCustoms()) : null);
|
|
6089
5512
|
}
|
|
5513
|
+
|
|
6090
5514
|
/**
|
|
6091
5515
|
* @private
|
|
6092
5516
|
* @returns {JSX.Element}
|
|
6093
5517
|
*/
|
|
6094
|
-
|
|
6095
5518
|
}, {
|
|
6096
5519
|
key: "renderToast",
|
|
6097
5520
|
value: function renderToast() {
|
|
6098
5521
|
var _this40 = this;
|
|
6099
|
-
|
|
6100
5522
|
return /*#__PURE__*/_react["default"].createElement(_Snackbar["default"], {
|
|
6101
5523
|
open: !!this.state.toast,
|
|
6102
5524
|
autoHideDuration: 3000,
|
|
@@ -6125,18 +5547,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6125
5547
|
})))
|
|
6126
5548
|
});
|
|
6127
5549
|
}
|
|
5550
|
+
|
|
6128
5551
|
/**
|
|
6129
5552
|
* Called when component is updated.
|
|
6130
5553
|
*/
|
|
6131
|
-
|
|
6132
5554
|
}, {
|
|
6133
5555
|
key: "componentDidUpdate",
|
|
6134
5556
|
value: function componentDidUpdate() {
|
|
6135
5557
|
var _this41 = this;
|
|
6136
|
-
|
|
6137
5558
|
if (this.tableRef.current) {
|
|
6138
5559
|
var scrollBarWidth = this.tableRef.current.offsetWidth - this.tableRef.current.clientWidth;
|
|
6139
|
-
|
|
6140
5560
|
if (this.state.scrollBarWidth !== scrollBarWidth) {
|
|
6141
5561
|
setTimeout(function () {
|
|
6142
5562
|
return _this41.setState({
|
|
@@ -6161,16 +5581,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6161
5581
|
});
|
|
6162
5582
|
this.selectedFound = true;
|
|
6163
5583
|
}
|
|
5584
|
+
|
|
6164
5585
|
/**
|
|
6165
5586
|
* @private
|
|
6166
5587
|
* @returns {JSX.Element | null}
|
|
6167
5588
|
*/
|
|
6168
|
-
|
|
6169
5589
|
}, {
|
|
6170
5590
|
key: "renderCustomDialog",
|
|
6171
5591
|
value: function renderCustomDialog() {
|
|
6172
5592
|
var _this42 = this;
|
|
6173
|
-
|
|
6174
5593
|
if (this.state.customDialog && this.props.objectCustomDialog) {
|
|
6175
5594
|
var ObjectCustomDialog = this.props.objectCustomDialog;
|
|
6176
5595
|
return /*#__PURE__*/_react["default"].createElement(ObjectCustomDialog, {
|
|
@@ -6190,17 +5609,14 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6190
5609
|
customsInstances: this.info.customs,
|
|
6191
5610
|
onClose: function onClose() {
|
|
6192
5611
|
_this42.pauseSubscribe(false);
|
|
6193
|
-
|
|
6194
5612
|
_this42.setState({
|
|
6195
5613
|
customDialog: null
|
|
6196
5614
|
});
|
|
6197
|
-
|
|
6198
5615
|
if (_this42.changedIds) {
|
|
6199
|
-
_this42.changedIds = null;
|
|
6200
|
-
|
|
5616
|
+
_this42.changedIds = null;
|
|
5617
|
+
// update all changed IDs
|
|
6201
5618
|
_this42.forceUpdate();
|
|
6202
5619
|
}
|
|
6203
|
-
|
|
6204
5620
|
_this42.props.router && _this42.props.router.doNavigate('tab-objects');
|
|
6205
5621
|
}
|
|
6206
5622
|
});
|
|
@@ -6208,16 +5624,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6208
5624
|
return null;
|
|
6209
5625
|
}
|
|
6210
5626
|
}
|
|
5627
|
+
|
|
6211
5628
|
/**
|
|
6212
5629
|
* @private
|
|
6213
5630
|
* @param {Partial<ioBroker.State>} valAck
|
|
6214
5631
|
*/
|
|
6215
|
-
|
|
6216
5632
|
}, {
|
|
6217
5633
|
key: "onUpdate",
|
|
6218
5634
|
value: function onUpdate(valAck) {
|
|
6219
5635
|
var _this43 = this;
|
|
6220
|
-
|
|
6221
5636
|
this.props.socket.setState(this.edit.id, {
|
|
6222
5637
|
val: valAck.val,
|
|
6223
5638
|
ack: valAck.ack,
|
|
@@ -6227,20 +5642,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6227
5642
|
return _this43.showError('Cannot write value: ' + e);
|
|
6228
5643
|
});
|
|
6229
5644
|
}
|
|
5645
|
+
|
|
6230
5646
|
/**
|
|
6231
5647
|
* @private
|
|
6232
5648
|
* @returns {JSX.Element | null}
|
|
6233
5649
|
*/
|
|
6234
|
-
|
|
6235
5650
|
}, {
|
|
6236
5651
|
key: "renderEditObjectDialog",
|
|
6237
5652
|
value: function renderEditObjectDialog() {
|
|
6238
5653
|
var _this44 = this;
|
|
6239
|
-
|
|
6240
5654
|
if (!this.state.editObjectDialog || !this.props.objectBrowserEditObject) {
|
|
6241
5655
|
return null;
|
|
6242
5656
|
}
|
|
6243
|
-
|
|
6244
5657
|
var ObjectBrowserEditObject = this.props.objectBrowserEditObject;
|
|
6245
5658
|
return /*#__PURE__*/_react["default"].createElement(ObjectBrowserEditObject, {
|
|
6246
5659
|
key: this.state.editObjectDialog,
|
|
@@ -6268,19 +5681,15 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6268
5681
|
onClose: function onClose(obj) {
|
|
6269
5682
|
if (obj) {
|
|
6270
5683
|
var updateAlias;
|
|
6271
|
-
|
|
6272
5684
|
if (_this44.state.editObjectDialog.startsWith('alias.')) {
|
|
6273
5685
|
var _this44$objects$_this, _obj$common5;
|
|
6274
|
-
|
|
6275
5686
|
if (JSON.stringify((_this44$objects$_this = _this44.objects[_this44.state.editObjectDialog].common) === null || _this44$objects$_this === void 0 ? void 0 : _this44$objects$_this.alias) !== JSON.stringify((_obj$common5 = obj.common) === null || _obj$common5 === void 0 ? void 0 : _obj$common5.alias)) {
|
|
6276
5687
|
updateAlias = _this44.state.editObjectDialog;
|
|
6277
5688
|
}
|
|
6278
5689
|
}
|
|
6279
|
-
|
|
6280
5690
|
_this44.props.socket.setObject(obj._id, obj).then(function () {
|
|
6281
5691
|
if (updateAlias && _this44.subscribes.includes(updateAlias)) {
|
|
6282
5692
|
_this44.unsubscribe(updateAlias);
|
|
6283
|
-
|
|
6284
5693
|
setTimeout(function () {
|
|
6285
5694
|
return _this44.subscribe(updateAlias);
|
|
6286
5695
|
}, 100);
|
|
@@ -6289,27 +5698,24 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6289
5698
|
return _this44.showError("Cannot write object: ".concat(e));
|
|
6290
5699
|
});
|
|
6291
5700
|
}
|
|
6292
|
-
|
|
6293
5701
|
_this44.setState({
|
|
6294
5702
|
editObjectDialog: ''
|
|
6295
5703
|
});
|
|
6296
5704
|
}
|
|
6297
5705
|
});
|
|
6298
5706
|
}
|
|
5707
|
+
|
|
6299
5708
|
/**
|
|
6300
5709
|
* @private
|
|
6301
5710
|
* @returns {JSX.Element | null}
|
|
6302
5711
|
*/
|
|
6303
|
-
|
|
6304
5712
|
}, {
|
|
6305
5713
|
key: "renderViewObjectFileDialog",
|
|
6306
5714
|
value: function renderViewObjectFileDialog() {
|
|
6307
5715
|
var _this45 = this;
|
|
6308
|
-
|
|
6309
5716
|
if (!this.state.viewFileDialog || !this.props.objectBrowserViewFile) {
|
|
6310
5717
|
return null;
|
|
6311
5718
|
}
|
|
6312
|
-
|
|
6313
5719
|
var ObjectBrowserViewFile = this.props.objectBrowserViewFile;
|
|
6314
5720
|
return /*#__PURE__*/_react["default"].createElement(ObjectBrowserViewFile, {
|
|
6315
5721
|
key: "viewFile",
|
|
@@ -6326,31 +5732,27 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6326
5732
|
}
|
|
6327
5733
|
});
|
|
6328
5734
|
}
|
|
5735
|
+
|
|
6329
5736
|
/**
|
|
6330
5737
|
* @private
|
|
6331
5738
|
* @returns {JSX.Element | null}
|
|
6332
5739
|
*/
|
|
6333
|
-
|
|
6334
5740
|
}, {
|
|
6335
5741
|
key: "renderEditValueDialog",
|
|
6336
5742
|
value: function renderEditValueDialog() {
|
|
6337
5743
|
var _this$objects$this$ed,
|
|
6338
|
-
|
|
6339
|
-
|
|
5744
|
+
_this46 = this;
|
|
6340
5745
|
if (!this.state.updateOpened || !this.props.objectBrowserValue) {
|
|
6341
5746
|
return null;
|
|
6342
5747
|
}
|
|
6343
|
-
|
|
6344
5748
|
if (!this.edit.id) {
|
|
6345
5749
|
console.error('Invalid ID for edit: ' + JSON.stringify(this.edit));
|
|
6346
5750
|
return null;
|
|
6347
5751
|
}
|
|
6348
|
-
|
|
6349
5752
|
if (!this.objects[this.edit.id]) {
|
|
6350
5753
|
console.error("Something went wrong. Possibly the object ".concat(this.edit.id, " was deleted."));
|
|
6351
5754
|
return null;
|
|
6352
5755
|
}
|
|
6353
|
-
|
|
6354
5756
|
var type = (_this$objects$this$ed = this.objects[this.edit.id].common) !== null && _this$objects$this$ed !== void 0 && _this$objects$this$ed.type ? this.objects[this.edit.id].common.type : (0, _typeof2["default"])(this.edit.val);
|
|
6355
5757
|
var ObjectBrowserValue = this.props.objectBrowserValue;
|
|
6356
5758
|
return /*#__PURE__*/_react["default"].createElement(ObjectBrowserValue, {
|
|
@@ -6369,7 +5771,6 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6369
5771
|
_this46.setState({
|
|
6370
5772
|
updateOpened: false
|
|
6371
5773
|
});
|
|
6372
|
-
|
|
6373
5774
|
res && _this46.onUpdate(res);
|
|
6374
5775
|
}
|
|
6375
5776
|
});
|
|
@@ -6383,18 +5784,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6383
5784
|
*/
|
|
6384
5785
|
function render() {
|
|
6385
5786
|
var _this47 = this;
|
|
6386
|
-
|
|
6387
5787
|
this.recordStates = [];
|
|
6388
|
-
this.unsubscribeTimer && clearTimeout(this.unsubscribeTimer);
|
|
5788
|
+
this.unsubscribeTimer && clearTimeout(this.unsubscribeTimer);
|
|
6389
5789
|
|
|
5790
|
+
// apply filter if changed
|
|
6390
5791
|
var jsonFilter = JSON.stringify(this.state.filter);
|
|
6391
|
-
|
|
6392
5792
|
if (this.lastAppliedFilter !== jsonFilter && this.objects && this.root) {
|
|
6393
5793
|
var counter = {
|
|
6394
5794
|
count: 0
|
|
6395
5795
|
};
|
|
6396
5796
|
applyFilter(this.root, this.state.filter, this.state.lang, this.objects, null, counter, this.props.customFilter, this.props.types);
|
|
6397
|
-
|
|
6398
5797
|
if (counter.count < 500 && !this.state.expandAllVisible) {
|
|
6399
5798
|
setTimeout(function () {
|
|
6400
5799
|
return _this47.setState({
|
|
@@ -6408,16 +5807,12 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6408
5807
|
});
|
|
6409
5808
|
});
|
|
6410
5809
|
}
|
|
6411
|
-
|
|
6412
5810
|
this.lastAppliedFilter = jsonFilter;
|
|
6413
5811
|
}
|
|
6414
|
-
|
|
6415
5812
|
this.unsubscribeTimer = setTimeout(function () {
|
|
6416
5813
|
_this47.unsubscribeTimer = null;
|
|
6417
|
-
|
|
6418
5814
|
_this47.checkUnsubscribes();
|
|
6419
5815
|
}, 200);
|
|
6420
|
-
|
|
6421
5816
|
if (!this.state.loaded) {
|
|
6422
5817
|
return /*#__PURE__*/_react["default"].createElement(_CircularProgress["default"], {
|
|
6423
5818
|
key: this.props.dialogName + '_c'
|
|
@@ -6438,19 +5833,16 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
|
|
|
6438
5833
|
value: function getDerivedStateFromProps(props, state) {
|
|
6439
5834
|
var newState = {};
|
|
6440
5835
|
var changed = false;
|
|
6441
|
-
|
|
6442
5836
|
if (props.expertMode !== undefined && props.expertMode !== state.filter.expertMode) {
|
|
6443
5837
|
changed = true;
|
|
6444
5838
|
newState.filter = Object.assign({}, state.filter);
|
|
6445
5839
|
newState.filter.expertMode = props.expertMode;
|
|
6446
5840
|
}
|
|
6447
|
-
|
|
6448
5841
|
return changed ? newState : null;
|
|
6449
5842
|
}
|
|
6450
5843
|
}]);
|
|
6451
5844
|
return ObjectBrowser;
|
|
6452
5845
|
}(_react.Component);
|
|
6453
|
-
|
|
6454
5846
|
ObjectBrowser.defaultProps = {
|
|
6455
5847
|
objectAddBoolean: false,
|
|
6456
5848
|
objectEditBoolean: false,
|
|
@@ -6525,20 +5917,21 @@ ObjectBrowser.propTypes = {
|
|
|
6525
5917
|
// optional ['state', 'instance', 'channel']
|
|
6526
5918
|
columns: _propTypes["default"].array,
|
|
6527
5919
|
// optional ['name', 'type', 'role', 'room', 'func', 'val', 'buttons']
|
|
5920
|
+
|
|
6528
5921
|
objectsWorker: _propTypes["default"].object,
|
|
6529
5922
|
// optional cache of objects
|
|
6530
5923
|
filterFunc: _propTypes["default"].func,
|
|
6531
5924
|
// function to filter out all unnecessary objects. It cannot be used together with "types"
|
|
6532
5925
|
// Example for function: `obj => obj.common && obj.common.type === 'boolean'` to show only boolean states
|
|
5926
|
+
|
|
6533
5927
|
dragSettings: _propTypes["default"].object,
|
|
6534
5928
|
DragWrapper: _propTypes["default"].func,
|
|
6535
5929
|
dragEnabled: _propTypes["default"].bool,
|
|
6536
5930
|
useDrag: _propTypes["default"].func
|
|
6537
5931
|
};
|
|
6538
|
-
/** @type {typeof ObjectBrowser} */
|
|
6539
5932
|
|
|
5933
|
+
/** @type {typeof ObjectBrowser} */
|
|
6540
5934
|
var _export = (0, _withWidth["default"])()((0, _withStyles["default"])(styles)(ObjectBrowser));
|
|
6541
|
-
|
|
6542
5935
|
var _default = _export;
|
|
6543
5936
|
exports["default"] = _default;
|
|
6544
5937
|
//# sourceMappingURL=ObjectBrowser.js.map
|