@iobroker/adapter-react-v5 4.7.15 → 4.8.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.
Files changed (127) hide show
  1. package/Components/JsonConfigComponent/ConfigAccordion.d.ts +1 -1
  2. package/Components/JsonConfigComponent/ConfigAccordion.js +4 -6
  3. package/Components/JsonConfigComponent/ConfigAccordion.js.map +1 -1
  4. package/Components/JsonConfigComponent/ConfigAlive.d.ts +2 -2
  5. package/Components/JsonConfigComponent/ConfigAutocomplete.d.ts +36 -13
  6. package/Components/JsonConfigComponent/ConfigAutocomplete.js +66 -164
  7. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +16 -13
  8. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +119 -251
  9. package/Components/JsonConfigComponent/ConfigCRON.d.ts +2 -2
  10. package/Components/JsonConfigComponent/ConfigCertCollection.d.ts +2 -2
  11. package/Components/JsonConfigComponent/ConfigCertificateSelect.d.ts +2 -2
  12. package/Components/JsonConfigComponent/ConfigCertificates.d.ts +2 -2
  13. package/Components/JsonConfigComponent/ConfigCheckbox.d.ts +14 -13
  14. package/Components/JsonConfigComponent/ConfigCheckbox.js +37 -79
  15. package/Components/JsonConfigComponent/ConfigChip.d.ts +2 -2
  16. package/Components/JsonConfigComponent/ConfigColor.d.ts +2 -2
  17. package/Components/JsonConfigComponent/ConfigCoordinates.d.ts +2 -2
  18. package/Components/JsonConfigComponent/ConfigDatePicker.d.ts +2 -2
  19. package/Components/JsonConfigComponent/ConfigDeviceManager.d.ts +6 -0
  20. package/Components/JsonConfigComponent/ConfigDeviceManager.js +18 -0
  21. package/Components/JsonConfigComponent/ConfigFile.d.ts +2 -2
  22. package/Components/JsonConfigComponent/ConfigFile.js +2 -2
  23. package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
  24. package/Components/JsonConfigComponent/ConfigFileSelector.js +8 -5
  25. package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
  26. package/Components/JsonConfigComponent/ConfigFunc.d.ts +2 -2
  27. package/Components/JsonConfigComponent/ConfigGeneric.d.ts +12 -4
  28. package/Components/JsonConfigComponent/ConfigGeneric.js +11 -2
  29. package/Components/JsonConfigComponent/ConfigIP.d.ts +2 -2
  30. package/Components/JsonConfigComponent/ConfigImageSendTo.d.ts +2 -2
  31. package/Components/JsonConfigComponent/ConfigImageUpload.js +38 -44
  32. package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
  33. package/Components/JsonConfigComponent/ConfigInstanceSelect.d.ts +2 -2
  34. package/Components/JsonConfigComponent/ConfigInterface.d.ts +2 -2
  35. package/Components/JsonConfigComponent/ConfigInterface.js +1 -1
  36. package/Components/JsonConfigComponent/ConfigInterface.js.map +1 -1
  37. package/Components/JsonConfigComponent/ConfigJsonEditor.d.ts +2 -2
  38. package/Components/JsonConfigComponent/ConfigJsonEditor.js +0 -1
  39. package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
  40. package/Components/JsonConfigComponent/ConfigLanguage.d.ts +6 -13
  41. package/Components/JsonConfigComponent/ConfigLanguage.js +105 -154
  42. package/Components/JsonConfigComponent/ConfigLicense.d.ts +1 -1
  43. package/Components/JsonConfigComponent/ConfigNumber.d.ts +1 -1
  44. package/Components/JsonConfigComponent/ConfigObjectId.d.ts +2 -2
  45. package/Components/JsonConfigComponent/ConfigPanel.js +8 -1
  46. package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
  47. package/Components/JsonConfigComponent/ConfigPassword.d.ts +2 -2
  48. package/Components/JsonConfigComponent/ConfigPattern.d.ts +2 -2
  49. package/Components/JsonConfigComponent/ConfigRoom.d.ts +2 -2
  50. package/Components/JsonConfigComponent/ConfigSelect.d.ts +2 -2
  51. package/Components/JsonConfigComponent/ConfigSelectSendTo.d.ts +2 -2
  52. package/Components/JsonConfigComponent/ConfigSendto.d.ts +23 -17
  53. package/Components/JsonConfigComponent/ConfigSendto.js +259 -399
  54. package/Components/JsonConfigComponent/ConfigSetState.d.ts +2 -2
  55. package/Components/JsonConfigComponent/ConfigSlider.d.ts +2 -2
  56. package/Components/JsonConfigComponent/ConfigStaticDivider.d.ts +2 -2
  57. package/Components/JsonConfigComponent/ConfigStaticHeader.d.ts +2 -2
  58. package/Components/JsonConfigComponent/ConfigStaticImage.d.ts +2 -2
  59. package/Components/JsonConfigComponent/ConfigStaticText.d.ts +2 -2
  60. package/Components/JsonConfigComponent/ConfigText.d.ts +2 -2
  61. package/Components/JsonConfigComponent/ConfigText.js +18 -0
  62. package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
  63. package/Components/JsonConfigComponent/ConfigTextSendTo.d.ts +2 -2
  64. package/Components/JsonConfigComponent/ConfigTimePicker.d.ts +2 -2
  65. package/Components/JsonConfigComponent/ConfigTopic.d.ts +2 -2
  66. package/Components/JsonConfigComponent/ConfigUUID.d.ts +2 -2
  67. package/Components/JsonConfigComponent/ConfigUser.d.ts +2 -2
  68. package/Components/JsonConfigComponent/DeviceManager/Communication.d.ts +63 -0
  69. package/Components/JsonConfigComponent/DeviceManager/Communication.js +268 -0
  70. package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.d.ts +11 -0
  71. package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.js +15 -0
  72. package/Components/JsonConfigComponent/DeviceManager/DeviceCard.d.ts +53 -0
  73. package/Components/JsonConfigComponent/DeviceManager/DeviceCard.js +340 -0
  74. package/Components/JsonConfigComponent/DeviceManager/DeviceControl.d.ts +45 -0
  75. package/Components/JsonConfigComponent/DeviceManager/DeviceControl.js +146 -0
  76. package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.d.ts +12 -0
  77. package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.js +69 -0
  78. package/Components/JsonConfigComponent/DeviceManager/DeviceList.d.ts +51 -0
  79. package/Components/JsonConfigComponent/DeviceManager/DeviceList.js +216 -0
  80. package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.d.ts +13 -0
  81. package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.js +111 -0
  82. package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.d.ts +7 -0
  83. package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.js +16 -0
  84. package/Components/JsonConfigComponent/DeviceManager/JsonConfig.d.ts +11 -0
  85. package/Components/JsonConfigComponent/DeviceManager/JsonConfig.js +94 -0
  86. package/Components/JsonConfigComponent/DeviceManager/TooltipButton.d.ts +10 -0
  87. package/Components/JsonConfigComponent/DeviceManager/TooltipButton.js +22 -0
  88. package/Components/JsonConfigComponent/DeviceManager/Utils.d.ts +12 -0
  89. package/Components/JsonConfigComponent/DeviceManager/Utils.js +158 -0
  90. package/Components/JsonConfigComponent/DeviceManager/i18n/de.json +21 -0
  91. package/Components/JsonConfigComponent/DeviceManager/i18n/en.json +21 -0
  92. package/Components/JsonConfigComponent/DeviceManager/i18n/es.json +21 -0
  93. package/Components/JsonConfigComponent/DeviceManager/i18n/fr.json +21 -0
  94. package/Components/JsonConfigComponent/DeviceManager/i18n/i18n.d.ts +26 -0
  95. package/Components/JsonConfigComponent/DeviceManager/i18n/it.json +21 -0
  96. package/Components/JsonConfigComponent/DeviceManager/i18n/nl.json +21 -0
  97. package/Components/JsonConfigComponent/DeviceManager/i18n/pl.json +21 -0
  98. package/Components/JsonConfigComponent/DeviceManager/i18n/pt.json +21 -0
  99. package/Components/JsonConfigComponent/DeviceManager/i18n/ru.json +21 -0
  100. package/Components/JsonConfigComponent/DeviceManager/i18n/uk.json +21 -0
  101. package/Components/JsonConfigComponent/DeviceManager/i18n/zh-cn.json +21 -0
  102. package/Components/JsonConfigComponent/DeviceManager/index.d.ts +2 -0
  103. package/Components/JsonConfigComponent/DeviceManager/index.js +10 -0
  104. package/Components/JsonConfigComponent/DeviceManager/index.js.map +1 -0
  105. package/Components/JsonConfigComponent/index.js +2 -7
  106. package/Components/JsonConfigComponent/index.js.map +1 -1
  107. package/Components/TextWithIcon.d.ts +1 -1
  108. package/Dialogs/ComplexCron.js +15 -17
  109. package/Dialogs/ComplexCron.js.map +1 -1
  110. package/Dialogs/Confirm.d.ts +20 -44
  111. package/Dialogs/Confirm.js +102 -158
  112. package/Dialogs/Error.d.ts +20 -39
  113. package/Dialogs/Error.js +50 -76
  114. package/Dialogs/Message.d.ts +22 -32
  115. package/Dialogs/Message.js +51 -83
  116. package/LegacyConnection.d.ts +3 -3
  117. package/README.md +7 -4
  118. package/i18n.d.ts +6 -6
  119. package/package.json +6 -5
  120. package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +0 -1
  121. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +0 -1
  122. package/Components/JsonConfigComponent/ConfigCheckbox.js.map +0 -1
  123. package/Components/JsonConfigComponent/ConfigLanguage.js.map +0 -1
  124. package/Components/JsonConfigComponent/ConfigSendto.js.map +0 -1
  125. package/Dialogs/Confirm.js.map +0 -1
  126. package/Dialogs/Error.js.map +0 -1
  127. package/Dialogs/Message.js.map +0 -1
@@ -0,0 +1,268 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const react_1 = __importStar(require("react"));
30
+ const material_1 = require("@mui/material");
31
+ const Utils_1 = require("./Utils");
32
+ const JsonConfig_1 = __importDefault(require("./JsonConfig"));
33
+ /**
34
+ * Device List Component
35
+ * @param {object} params - Component parameters
36
+ * @param {object} params.socket - socket object
37
+ * @param {string} params.selectedInstance - Selected instance
38
+ * @returns {*[]} - Array of device cards
39
+ */
40
+ class Communication extends react_1.Component {
41
+ constructor(props) {
42
+ super(props);
43
+ this.sendActionToInstance = (command, messageToSend, refresh) => {
44
+ const send = async () => {
45
+ this.setState({ showSpinner: true });
46
+ /** @type {object} */
47
+ const response = await this.props.socket.sendTo(this.props.selectedInstance, command, messageToSend);
48
+ /** @type {string} */
49
+ const type = response.type;
50
+ console.log(`Response: ${response.type}`);
51
+ switch (type) {
52
+ case 'message':
53
+ console.log(`Message received: ${response.message}`);
54
+ if (response.message) {
55
+ this.setState({
56
+ message: {
57
+ message: response.message,
58
+ handleClose: () => this.setState({ message: null }, () => this.sendActionToInstance('dm:actionProgress', { origin: response.origin })),
59
+ },
60
+ });
61
+ }
62
+ break;
63
+ case 'confirm':
64
+ console.log(`Confirm received: ${response.confirm}`);
65
+ if (response.confirm) {
66
+ this.setState({
67
+ confirm: {
68
+ message: response.confirm,
69
+ handleClose: (confirm) => this.setState({ confirm: null }, () => this.sendActionToInstance('dm:actionProgress', {
70
+ origin: response.origin,
71
+ confirm,
72
+ })),
73
+ },
74
+ });
75
+ }
76
+ break;
77
+ case 'form':
78
+ console.log('Form received');
79
+ if (response.form) {
80
+ this.setState({
81
+ form: Object.assign(Object.assign({}, response.form), { handleClose: (data) => this.setState({ form: null }, () => {
82
+ console.log(`Form ${JSON.stringify(data)}`);
83
+ this.sendActionToInstance('dm:actionProgress', {
84
+ origin: response.origin,
85
+ data,
86
+ });
87
+ }) }),
88
+ });
89
+ }
90
+ break;
91
+ case 'progress':
92
+ if (response.progress) {
93
+ if (this.state.progress) {
94
+ const progress = Object.assign(Object.assign({}, this.state.progress), response.progress);
95
+ this.setState({ progress });
96
+ }
97
+ else {
98
+ this.setState({ progress: response.progress });
99
+ }
100
+ }
101
+ this.sendActionToInstance('dm:actionProgress', { origin: response.origin });
102
+ break;
103
+ case 'result':
104
+ console.log('Response content', response.result);
105
+ if (response.result.refresh) {
106
+ if (response.result.refresh === true) {
107
+ this.loadData().catch(console.error);
108
+ console.log('Refreshing all');
109
+ }
110
+ else if (response.result.refresh === 'instance') {
111
+ console.log(`Refreshing instance infos: ${this.props.selectedInstance}`);
112
+ }
113
+ else if (response.result.refresh === 'device') {
114
+ if (refresh) {
115
+ console.log(`Refreshing device infos: ${this.props.selectedInstance}`);
116
+ refresh();
117
+ }
118
+ }
119
+ else {
120
+ console.log('Not refreshing anything');
121
+ }
122
+ }
123
+ if (response.result.error) {
124
+ console.error(`Error: ${response.result.error}`);
125
+ this.setState({ showToast: response.result.error.message });
126
+ }
127
+ this.setState({ showSpinner: false });
128
+ break;
129
+ default:
130
+ console.log(`Unknown response type: ${type}`);
131
+ this.setState({ showSpinner: false });
132
+ break;
133
+ }
134
+ };
135
+ send().catch(console.error);
136
+ };
137
+ this.sendControlToInstance = async (command, messageToSend) => {
138
+ const response = await this.props.socket.sendTo(this.props.selectedInstance, command, messageToSend);
139
+ const type = response.type;
140
+ console.log(`Response: ${response.type}`);
141
+ if (response.type === 'result') {
142
+ console.log('Response content', response.result);
143
+ if (response.result.error) {
144
+ console.error(`Error: ${response.result.error}`);
145
+ this.setState({ showToast: response.result.error.message });
146
+ }
147
+ else if (response.result.state !== undefined) {
148
+ return response.result.state;
149
+ }
150
+ }
151
+ else {
152
+ console.warn('Unexpected response type', type);
153
+ }
154
+ return null;
155
+ };
156
+ // @ts-expect-error
157
+ this.state = {
158
+ showSpinner: false,
159
+ showToast: null,
160
+ message: null,
161
+ confirm: null,
162
+ form: null,
163
+ progress: null,
164
+ };
165
+ // eslint-disable-next-line react/no-unused-class-component-methods
166
+ this.instanceHandler = action => () => this.sendActionToInstance('dm:instanceAction', { actionId: action.id });
167
+ // eslint-disable-next-line react/no-unused-class-component-methods
168
+ this.deviceHandler = (deviceId, action, refresh) => () => this.sendActionToInstance('dm:deviceAction', { deviceId, actionId: action.id }, refresh);
169
+ // eslint-disable-next-line react/no-unused-class-component-methods
170
+ this.controlHandler = (deviceId, control, state) => () => this.sendControlToInstance('dm:deviceControl', { deviceId, controlId: control.id, state });
171
+ // eslint-disable-next-line react/no-unused-class-component-methods
172
+ this.controlStateHandler = (deviceId, control) => () => this.sendControlToInstance('dm:deviceControlState', { deviceId, controlId: control.id });
173
+ this.props.registerHandler && this.props.registerHandler(() => this.loadData());
174
+ }
175
+ // eslint-disable-next-line class-methods-use-this
176
+ loadData() {
177
+ return Promise.resolve();
178
+ }
179
+ // eslint-disable-next-line react/no-unused-class-component-methods
180
+ loadDevices() {
181
+ return this.props.socket.sendTo(this.props.selectedInstance, 'dm:listDevices');
182
+ }
183
+ // eslint-disable-next-line react/no-unused-class-component-methods
184
+ loadInstanceInfos() {
185
+ return this.props.socket.sendTo(this.props.selectedInstance, 'dm:instanceInfo');
186
+ }
187
+ renderMessageDialog() {
188
+ var _a;
189
+ if (!this.state.message) {
190
+ return null;
191
+ }
192
+ return react_1.default.createElement(material_1.Dialog, { open: !0, onClose: () => { var _a; return (_a = this.state.message) === null || _a === void 0 ? void 0 : _a.handleClose(); }, hideBackdrop: true, "aria-describedby": "message-dialog-description" },
193
+ react_1.default.createElement(material_1.DialogContent, null,
194
+ react_1.default.createElement(material_1.DialogContentText, { id: "message-dialog-description" }, (_a = this.state.message) === null || _a === void 0 ? void 0 : _a.message)),
195
+ react_1.default.createElement(material_1.DialogActions, null,
196
+ react_1.default.createElement(material_1.Button, { onClick: () => { var _a; return (_a = this.state.message) === null || _a === void 0 ? void 0 : _a.handleClose(); }, autoFocus: true }, (0, Utils_1.getTranslation)('okButtonText'))));
197
+ }
198
+ renderConfirmDialog() {
199
+ var _a;
200
+ if (!this.state.confirm) {
201
+ return null;
202
+ }
203
+ return react_1.default.createElement(material_1.Dialog, { open: !0, onClose: () => { var _a; return (_a = this.state.confirm) === null || _a === void 0 ? void 0 : _a.handleClose(); }, hideBackdrop: true, "aria-describedby": "confirm-dialog-description" },
204
+ react_1.default.createElement(material_1.DialogContent, null,
205
+ react_1.default.createElement(material_1.DialogContentText, { id: "confirm-dialog-description" }, (0, Utils_1.getTranslation)((_a = this.state.confirm) === null || _a === void 0 ? void 0 : _a.message))),
206
+ react_1.default.createElement(material_1.DialogActions, null,
207
+ react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", onClick: () => { var _a; return (_a = this.state.confirm) === null || _a === void 0 ? void 0 : _a.handleClose(true); }, autoFocus: true }, (0, Utils_1.getTranslation)('yesButtonText')),
208
+ react_1.default.createElement(material_1.Button, { variant: "contained",
209
+ // @ts-expect-error
210
+ color: "grey", onClick: () => { var _a; return (_a = this.state.confirm) === null || _a === void 0 ? void 0 : _a.handleClose(false); }, autoFocus: true, hideBackdrop: true }, (0, Utils_1.getTranslation)('noButtonText'))));
211
+ }
212
+ renderSnackbar() {
213
+ return react_1.default.createElement(material_1.Snackbar, { open: !!this.state.showToast, autoHideDuration: 6000, onClose: () => this.setState({ showToast: null }), message: this.state.showToast });
214
+ }
215
+ renderFormDialog() {
216
+ var _a, _b;
217
+ if (!this.state.form || !this.state.form.schema || !this.state.form.data) {
218
+ return null;
219
+ }
220
+ return react_1.default.createElement(material_1.Dialog, { open: !0, onClose: () => { var _a; return ((_a = this.state.form) === null || _a === void 0 ? void 0 : _a.handleClose) && this.state.form.handleClose(); }, hideBackdrop: true },
221
+ ((_a = this.state.form) === null || _a === void 0 ? void 0 : _a.title) ? react_1.default.createElement(material_1.DialogTitle, null, (0, Utils_1.getTranslation)((_b = this.state.form) === null || _b === void 0 ? void 0 : _b.title)) : null,
222
+ react_1.default.createElement(material_1.DialogContent, null,
223
+ react_1.default.createElement(JsonConfig_1.default, { instanceId: this.props.selectedInstance, schema: this.state.form.schema, data: this.state.form.data, socket: this.props.socket, onChange: (data) => {
224
+ console.log('handleFormChange', { data });
225
+ const form = Object.assign({}, this.state.form);
226
+ if (form) {
227
+ form.data = data;
228
+ this.setState({ form });
229
+ }
230
+ } })),
231
+ react_1.default.createElement(material_1.DialogActions, null,
232
+ react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", onClick: () => { var _a, _b; return ((_a = this.state.form) === null || _a === void 0 ? void 0 : _a.handleClose) && this.state.form.handleClose((_b = this.state.form) === null || _b === void 0 ? void 0 : _b.data); }, autoFocus: true }, (0, Utils_1.getTranslation)('okButtonText')),
233
+ react_1.default.createElement(material_1.Button, { variant: "contained",
234
+ // @ts-expect-error
235
+ color: "grey", onClick: () => { var _a; return ((_a = this.state.form) === null || _a === void 0 ? void 0 : _a.handleClose) && this.state.form.handleClose(); }, hideBackdrop: true }, (0, Utils_1.getTranslation)('cancelButtonText'))));
236
+ }
237
+ renderProgressDialog() {
238
+ var _a, _b;
239
+ if (!((_a = this.state.progress) === null || _a === void 0 ? void 0 : _a.open)) {
240
+ return null;
241
+ }
242
+ return react_1.default.createElement(material_1.Dialog, { open: !0, onClose: () => { }, hideBackdrop: true },
243
+ react_1.default.createElement(material_1.LinearProgress, { variant: "determinate", value: ((_b = this.state.progress) === null || _b === void 0 ? void 0 : _b.progress) || 0 }));
244
+ }
245
+ // eslint-disable-next-line class-methods-use-this
246
+ renderContent() {
247
+ return null;
248
+ }
249
+ renderSpinner() {
250
+ var _a;
251
+ if (!this.state.showSpinner && !((_a = this.state.progress) === null || _a === void 0 ? void 0 : _a.open) && !this.state.message && !this.state.confirm && !this.state.form) {
252
+ return null;
253
+ }
254
+ return react_1.default.createElement(material_1.Backdrop, { style: { zIndex: 1000 }, open: !0 },
255
+ react_1.default.createElement(material_1.CircularProgress, null));
256
+ }
257
+ render() {
258
+ return react_1.default.createElement(react_1.default.Fragment, null,
259
+ this.renderSnackbar(),
260
+ this.renderContent(),
261
+ this.renderSpinner(),
262
+ this.renderConfirmDialog(),
263
+ this.renderMessageDialog(),
264
+ this.renderFormDialog(),
265
+ this.renderProgressDialog());
266
+ }
267
+ }
268
+ exports.default = Communication;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { ActionBase } from '@iobroker/dm-utils/build/types/base';
3
+ interface DeviceActionButtonProps {
4
+ deviceId: string;
5
+ action: any;
6
+ refresh: () => void;
7
+ deviceHandler: (deviceId: string, action: ActionBase<'api'>, refresh: () => void) => () => void;
8
+ disabled?: boolean;
9
+ }
10
+ export default function DeviceActionButton(props: DeviceActionButtonProps): React.JSX.Element;
11
+ export {};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const TooltipButton_js_1 = __importDefault(require("./TooltipButton.js"));
8
+ const Utils_js_1 = require("./Utils.js");
9
+ function DeviceActionButton(props) {
10
+ const { deviceId, action, refresh, deviceHandler, disabled, } = props;
11
+ const tooltip = (0, Utils_js_1.getTranslation)(action.description);
12
+ const icon = (0, Utils_js_1.renderIcon)(action);
13
+ return react_1.default.createElement(TooltipButton_js_1.default, { label: action.label || (icon ? null : action.id), tooltip: tooltip, disabled: disabled || action.disabled, Icon: icon, onClick: deviceHandler(deviceId, action, refresh) });
14
+ }
15
+ exports.default = DeviceActionButton;
@@ -0,0 +1,53 @@
1
+ import React, { Component } from 'react';
2
+ import { Connection } from '@iobroker/socket-client';
3
+ import { DeviceDetails, DeviceInfo } from '@iobroker/dm-utils';
4
+ import { ActionBase, ControlBase, ControlState } from '@iobroker/dm-utils/build/types/base';
5
+ interface DeviceCardProps {
6
+ title?: string;
7
+ id: string;
8
+ device: DeviceInfo;
9
+ instanceId: string;
10
+ socket: Connection;
11
+ uploadImagesToInstance?: string;
12
+ deviceHandler: (deviceId: string, action: ActionBase<'api'>, refresh: () => void) => () => void;
13
+ controlHandler: (deviceId: string, control: ControlBase, state: ControlState) => () => Promise<ioBroker.State | null>;
14
+ controlStateHandler: (deviceId: string, control: ControlBase) => () => Promise<ioBroker.State | null>;
15
+ smallCards?: boolean;
16
+ alive: boolean;
17
+ }
18
+ interface DeviceCardState {
19
+ open: boolean;
20
+ details: DeviceDetails | null;
21
+ data: Record<string, any>;
22
+ icon: string | undefined;
23
+ showControlDialog: boolean;
24
+ }
25
+ /**
26
+ * Device Card Component
27
+ */
28
+ declare class DeviceCard extends Component<DeviceCardProps, DeviceCardState> {
29
+ constructor(props: DeviceCardProps);
30
+ fetchIcon(): Promise<void>;
31
+ componentDidMount(): void;
32
+ /**
33
+ * Load the device details
34
+ */
35
+ loadDetails(): Promise<void>;
36
+ /**
37
+ * Refresh the device details
38
+ */
39
+ refresh: () => void;
40
+ /**
41
+ * Copy the device ID to the clipboard
42
+ * @returns {void}
43
+ */
44
+ copyToClipboard: () => Promise<void>;
45
+ renderDialog(): React.JSX.Element;
46
+ renderControlDialog(): React.JSX.Element;
47
+ renderControls(): React.JSX.Element;
48
+ renderActions(): React.JSX.Element[];
49
+ renderSmall(): React.JSX.Element;
50
+ renderBig(): React.JSX.Element;
51
+ render(): React.JSX.Element;
52
+ }
53
+ export default DeviceCard;