@iobroker/dm-gui-components 0.1.0 → 6.13.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +1 -1
  2. package/build/Communication.js +247 -0
  3. package/build/Communication.js.map +1 -0
  4. package/build/DeviceActionButton.js +10 -0
  5. package/build/DeviceActionButton.js.map +1 -0
  6. package/build/DeviceCard.js +307 -0
  7. package/build/DeviceCard.js.map +1 -0
  8. package/build/DeviceControl.js +119 -0
  9. package/build/DeviceControl.js.map +1 -0
  10. package/{DeviceImageUpload.js → build/DeviceImageUpload.js} +5 -9
  11. package/build/DeviceImageUpload.js.map +1 -0
  12. package/build/DeviceList.js +235 -0
  13. package/build/DeviceList.js.map +1 -0
  14. package/build/DeviceStatus.js +106 -0
  15. package/build/DeviceStatus.js.map +1 -0
  16. package/build/InstanceActionButton.js +11 -0
  17. package/build/InstanceActionButton.js.map +1 -0
  18. package/{JsonConfig.js → build/JsonConfig.js} +10 -33
  19. package/build/JsonConfig.js.map +1 -0
  20. package/build/TooltipButton.js +17 -0
  21. package/build/TooltipButton.js.map +1 -0
  22. package/build/Utils.js +149 -0
  23. package/build/Utils.js.map +1 -0
  24. package/build/index.js +3 -0
  25. package/build/index.js.map +1 -0
  26. package/package.json +14 -16
  27. package/Communication.js +0 -268
  28. package/DeviceActionButton.js +0 -15
  29. package/DeviceCard.js +0 -338
  30. package/DeviceControl.js +0 -146
  31. package/DeviceList.js +0 -226
  32. package/DeviceStatus.js +0 -111
  33. package/InstanceActionButton.js +0 -16
  34. package/TooltipButton.js +0 -22
  35. package/Utils.js +0 -157
  36. package/index.js +0 -7
  37. package/{Communication.d.ts → build/Communication.d.ts} +0 -0
  38. package/{DeviceActionButton.d.ts → build/DeviceActionButton.d.ts} +0 -0
  39. package/{DeviceCard.d.ts → build/DeviceCard.d.ts} +0 -0
  40. package/{DeviceControl.d.ts → build/DeviceControl.d.ts} +0 -0
  41. package/{DeviceImageUpload.d.ts → build/DeviceImageUpload.d.ts} +0 -0
  42. package/{DeviceList.d.ts → build/DeviceList.d.ts} +0 -0
  43. package/{DeviceStatus.d.ts → build/DeviceStatus.d.ts} +0 -0
  44. package/{InstanceActionButton.d.ts → build/InstanceActionButton.d.ts} +0 -0
  45. package/{JsonConfig.d.ts → build/JsonConfig.d.ts} +0 -0
  46. package/{TooltipButton.d.ts → build/TooltipButton.d.ts} +0 -0
  47. package/{Utils.d.ts → build/Utils.d.ts} +0 -0
  48. package/{i18n → build/i18n}/de.json +0 -0
  49. package/{i18n → build/i18n}/en.json +0 -0
  50. package/{i18n → build/i18n}/es.json +0 -0
  51. package/{i18n → build/i18n}/fr.json +0 -0
  52. package/{i18n → build/i18n}/it.json +0 -0
  53. package/{i18n → build/i18n}/nl.json +0 -0
  54. package/{i18n → build/i18n}/pl.json +0 -0
  55. package/{i18n → build/i18n}/pt.json +0 -0
  56. package/{i18n → build/i18n}/ru.json +0 -0
  57. package/{i18n → build/i18n}/uk.json +0 -0
  58. package/{i18n → build/i18n}/zh-cn.json +0 -0
  59. package/{index.d.ts → build/index.d.ts} +1 -1
package/README.md CHANGED
@@ -20,7 +20,7 @@ render() {
20
20
  -->
21
21
 
22
22
  ## Changelog
23
- ### 0.1.0 (2023-12-22)
23
+ ### **WORK IN PROGRESS**
24
24
  * (foxriver76) update adapter-react-v5 version
25
25
 
26
26
  ### 0.0.10 (2023-12-14)
@@ -0,0 +1,247 @@
1
+ import React, { Component } from 'react';
2
+ import { Backdrop, Button, CircularProgress, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, LinearProgress, Snackbar, } from '@mui/material';
3
+ import { getTranslation } from './Utils';
4
+ import JsonConfig from './JsonConfig';
5
+ /**
6
+ * Device List Component
7
+ * @param {object} params - Component parameters
8
+ * @param {object} params.socket - socket object
9
+ * @param {string} params.selectedInstance - Selected instance
10
+ * @returns {*[]} - Array of device cards
11
+ */
12
+ class Communication extends Component {
13
+ // eslint-disable-next-line react/no-unused-class-component-methods
14
+ instanceHandler;
15
+ // eslint-disable-next-line react/no-unused-class-component-methods
16
+ deviceHandler;
17
+ // eslint-disable-next-line react/no-unused-class-component-methods
18
+ controlHandler;
19
+ // eslint-disable-next-line react/no-unused-class-component-methods
20
+ controlStateHandler;
21
+ constructor(props) {
22
+ super(props);
23
+ // @ts-expect-error
24
+ this.state = {
25
+ showSpinner: false,
26
+ showToast: null,
27
+ message: null,
28
+ confirm: null,
29
+ form: null,
30
+ progress: null,
31
+ };
32
+ // eslint-disable-next-line react/no-unused-class-component-methods
33
+ this.instanceHandler = action => () => this.sendActionToInstance('dm:instanceAction', { actionId: action.id });
34
+ // eslint-disable-next-line react/no-unused-class-component-methods
35
+ this.deviceHandler = (deviceId, action, refresh) => () => this.sendActionToInstance('dm:deviceAction', { deviceId, actionId: action.id }, refresh);
36
+ // eslint-disable-next-line react/no-unused-class-component-methods
37
+ this.controlHandler = (deviceId, control, state) => () => this.sendControlToInstance('dm:deviceControl', { deviceId, controlId: control.id, state });
38
+ // eslint-disable-next-line react/no-unused-class-component-methods
39
+ this.controlStateHandler = (deviceId, control) => () => this.sendControlToInstance('dm:deviceControlState', { deviceId, controlId: control.id });
40
+ this.props.registerHandler && this.props.registerHandler(() => this.loadData());
41
+ }
42
+ // eslint-disable-next-line class-methods-use-this
43
+ loadData() {
44
+ console.error('loadData not implemented');
45
+ }
46
+ sendActionToInstance = (command, messageToSend, refresh) => {
47
+ const send = async () => {
48
+ this.setState({ showSpinner: true });
49
+ /** @type {object} */
50
+ const response = await this.props.socket.sendTo(this.props.selectedInstance, command, messageToSend);
51
+ /** @type {string} */
52
+ const type = response.type;
53
+ console.log(`Response: ${response.type}`);
54
+ switch (type) {
55
+ case 'message':
56
+ console.log(`Message received: ${response.message}`);
57
+ if (response.message) {
58
+ this.setState({
59
+ message: {
60
+ message: response.message,
61
+ handleClose: () => this.setState({ message: null }, () => this.sendActionToInstance('dm:actionProgress', { origin: response.origin })),
62
+ },
63
+ });
64
+ }
65
+ break;
66
+ case 'confirm':
67
+ console.log(`Confirm received: ${response.confirm}`);
68
+ if (response.confirm) {
69
+ this.setState({
70
+ confirm: {
71
+ message: response.confirm,
72
+ handleClose: (confirm) => this.setState({ confirm: null }, () => this.sendActionToInstance('dm:actionProgress', {
73
+ origin: response.origin,
74
+ confirm,
75
+ })),
76
+ },
77
+ });
78
+ }
79
+ break;
80
+ case 'form':
81
+ console.log('Form received');
82
+ if (response.form) {
83
+ this.setState({
84
+ form: {
85
+ ...response.form,
86
+ handleClose: (data) => this.setState({ form: null }, () => {
87
+ console.log(`Form ${JSON.stringify(data)}`);
88
+ this.sendActionToInstance('dm:actionProgress', {
89
+ origin: response.origin,
90
+ data,
91
+ });
92
+ }),
93
+ },
94
+ });
95
+ }
96
+ break;
97
+ case 'progress':
98
+ if (response.progress) {
99
+ if (this.state.progress) {
100
+ const progress = { ...this.state.progress, ...response.progress };
101
+ this.setState({ progress });
102
+ }
103
+ else {
104
+ this.setState({ progress: response.progress });
105
+ }
106
+ }
107
+ this.sendActionToInstance('dm:actionProgress', { origin: response.origin });
108
+ break;
109
+ case 'result':
110
+ console.log('Response content', response.result);
111
+ if (response.result.refresh) {
112
+ if (response.result.refresh === true) {
113
+ this.loadData();
114
+ console.log('Refreshing all');
115
+ }
116
+ else if (response.result.refresh === 'instance') {
117
+ console.log(`Refreshing instance infos: ${this.props.selectedInstance}`);
118
+ }
119
+ else if (response.result.refresh === 'device') {
120
+ if (refresh) {
121
+ console.log(`Refreshing device infos: ${this.props.selectedInstance}`);
122
+ refresh();
123
+ }
124
+ }
125
+ else {
126
+ console.log('Not refreshing anything');
127
+ }
128
+ }
129
+ if (response.result.error) {
130
+ console.error(`Error: ${response.result.error}`);
131
+ this.setState({ showToast: response.result.error.message });
132
+ }
133
+ this.setState({ showSpinner: false });
134
+ break;
135
+ default:
136
+ console.log(`Unknown response type: ${type}`);
137
+ this.setState({ showSpinner: false });
138
+ break;
139
+ }
140
+ };
141
+ send().catch(console.error);
142
+ };
143
+ sendControlToInstance = async (command, messageToSend) => {
144
+ const response = await this.props.socket.sendTo(this.props.selectedInstance, command, messageToSend);
145
+ const type = response.type;
146
+ console.log(`Response: ${response.type}`);
147
+ if (response.type === 'result') {
148
+ console.log('Response content', response.result);
149
+ if (response.result.error) {
150
+ console.error(`Error: ${response.result.error}`);
151
+ this.setState({ showToast: response.result.error.message });
152
+ }
153
+ else if (response.result.state !== undefined) {
154
+ return response.result.state;
155
+ }
156
+ }
157
+ else {
158
+ console.warn('Unexpected response type', type);
159
+ }
160
+ return null;
161
+ };
162
+ // eslint-disable-next-line react/no-unused-class-component-methods
163
+ loadDevices() {
164
+ return this.props.socket.sendTo(this.props.selectedInstance, 'dm:listDevices');
165
+ }
166
+ // eslint-disable-next-line react/no-unused-class-component-methods
167
+ loadInstanceInfos() {
168
+ return this.props.socket.sendTo(this.props.selectedInstance, 'dm:instanceInfo');
169
+ }
170
+ renderMessageDialog() {
171
+ if (!this.state.message) {
172
+ return null;
173
+ }
174
+ return React.createElement(Dialog, { open: !0, onClose: () => this.state.message?.handleClose(), hideBackdrop: true, "aria-describedby": "message-dialog-description" },
175
+ React.createElement(DialogContent, null,
176
+ React.createElement(DialogContentText, { id: "message-dialog-description" }, this.state.message?.message)),
177
+ React.createElement(DialogActions, null,
178
+ React.createElement(Button, { onClick: () => this.state.message?.handleClose(), autoFocus: true }, getTranslation('okButtonText'))));
179
+ }
180
+ renderConfirmDialog() {
181
+ if (!this.state.confirm) {
182
+ return null;
183
+ }
184
+ return React.createElement(Dialog, { open: !0, onClose: () => this.state.confirm?.handleClose(), hideBackdrop: true, "aria-describedby": "confirm-dialog-description" },
185
+ React.createElement(DialogContent, null,
186
+ React.createElement(DialogContentText, { id: "confirm-dialog-description" }, getTranslation(this.state.confirm?.message))),
187
+ React.createElement(DialogActions, null,
188
+ React.createElement(Button, { variant: "contained", color: "primary", onClick: () => this.state.confirm?.handleClose(true), autoFocus: true }, getTranslation('yesButtonText')),
189
+ React.createElement(Button, { variant: "contained",
190
+ // @ts-expect-error
191
+ color: "grey", onClick: () => this.state.confirm?.handleClose(false), autoFocus: true, hideBackdrop: true }, getTranslation('noButtonText'))));
192
+ }
193
+ renderSnackbar() {
194
+ return React.createElement(Snackbar, { open: !!this.state.showToast, autoHideDuration: 6000, onClose: () => this.setState({ showToast: null }), message: this.state.showToast });
195
+ }
196
+ renderFormDialog() {
197
+ if (!this.state.form || !this.state.form.schema || !this.state.form.data) {
198
+ return null;
199
+ }
200
+ return React.createElement(Dialog, { open: !0, onClose: () => this.state.form?.handleClose && this.state.form.handleClose(), hideBackdrop: true },
201
+ this.state.form?.title ? React.createElement(DialogTitle, null, getTranslation(this.state.form?.title)) : null,
202
+ React.createElement(DialogContent, null,
203
+ React.createElement(JsonConfig, { instanceId: this.props.selectedInstance, schema: this.state.form.schema, data: this.state.form.data, socket: this.props.socket, onChange: (data) => {
204
+ console.log('handleFormChange', { data });
205
+ const form = { ...this.state.form };
206
+ if (form) {
207
+ form.data = data;
208
+ this.setState({ form });
209
+ }
210
+ } })),
211
+ React.createElement(DialogActions, null,
212
+ React.createElement(Button, { variant: "contained", color: "primary", onClick: () => this.state.form?.handleClose && this.state.form.handleClose(this.state.form?.data), autoFocus: true }, getTranslation('okButtonText')),
213
+ React.createElement(Button, { variant: "contained",
214
+ // @ts-expect-error
215
+ color: "grey", onClick: () => this.state.form?.handleClose && this.state.form.handleClose(), hideBackdrop: true }, getTranslation('cancelButtonText'))));
216
+ }
217
+ renderProgressDialog() {
218
+ if (!this.state.progress?.open) {
219
+ return null;
220
+ }
221
+ return React.createElement(Dialog, { open: !0, onClose: () => { }, hideBackdrop: true },
222
+ React.createElement(LinearProgress, { variant: "determinate", value: this.state.progress?.progress || 0 }));
223
+ }
224
+ // eslint-disable-next-line class-methods-use-this
225
+ renderContent() {
226
+ return null;
227
+ }
228
+ renderSpinner() {
229
+ if (!this.state.showSpinner && !this.state.progress?.open && !this.state.message && !this.state.confirm && !this.state.form) {
230
+ return null;
231
+ }
232
+ return React.createElement(Backdrop, { style: { zIndex: 1000 }, open: !0 },
233
+ React.createElement(CircularProgress, null));
234
+ }
235
+ render() {
236
+ return React.createElement(React.Fragment, null,
237
+ this.renderSnackbar(),
238
+ this.renderContent(),
239
+ this.renderSpinner(),
240
+ this.renderConfirmDialog(),
241
+ this.renderMessageDialog(),
242
+ this.renderFormDialog(),
243
+ this.renderProgressDialog());
244
+ }
245
+ }
246
+ export default Communication;
247
+ //# sourceMappingURL=Communication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Communication.js","sourceRoot":"./src/","sources":["Communication.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACH,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,QAAQ,GACX,MAAM,eAAe,CAAC;AAMvB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,UAAU,MAAM,cAAc,CAAC;AAuEtC;;;;;;GAMG;AACH,MAAM,aAA0E,SAAQ,SAAe;IACnG,mEAAmE;IACnE,eAAe,CAA4C;IAE3D,mEAAmE;IACnE,aAAa,CAAmF;IAEhG,mEAAmE;IACnE,cAAc,CAAwG;IAEtH,mEAAmE;IACnE,mBAAmB,CAAmF;IAEtG,YAAY,KAAQ;QAChB,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,mBAAmB;QACnB,IAAI,CAAC,KAAK,GAAG;YACT,WAAW,EAAE,KAAK;YAClB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,IAAI;SACjB,CAAC;QAEF,mEAAmE;QACnE,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CA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YACpB,IAAI,CAAC,aAAa,EAAE;YACpB,IAAI,CAAC,mBAAmB,EAAE;YAC1B,IAAI,CAAC,mBAAmB,EAAE;YAC1B,IAAI,CAAC,gBAAgB,EAAE;YACvB,IAAI,CAAC,oBAAoB,EAAE,CAC7B,CAAC;IACR,CAAC;CACJ;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import TooltipButton from './TooltipButton';
3
+ import { renderIcon, getTranslation } from './Utils';
4
+ export default function DeviceActionButton(props) {
5
+ const { deviceId, action, refresh, deviceHandler, disabled, } = props;
6
+ const tooltip = getTranslation(action.description);
7
+ const icon = renderIcon(action);
8
+ return React.createElement(TooltipButton, { label: action.label || (icon ? null : action.id), tooltip: tooltip, disabled: disabled || action.disabled, Icon: icon, onClick: deviceHandler(deviceId, action, refresh) });
9
+ }
10
+ //# sourceMappingURL=DeviceActionButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceActionButton.js","sourceRoot":"./src/","sources":["DeviceActionButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAWrD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAA8B;IACrE,MAAM,EACF,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,GACrD,GAAG,KAAK,CAAC;IAEV,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAEnD,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAEhC,OAAO,oBAAC,aAAa,IACjB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAChD,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,EACrC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,GACnD,CAAC;AACP,CAAC"}
@@ -0,0 +1,307 @@
1
+ import React, { Component } from 'react';
2
+ import { Button, Typography, Dialog, DialogActions, DialogContent, IconButton, Fab, DialogTitle, Card, CardActions, CardHeader, CardContent, Paper, } from '@mui/material';
3
+ import { MoreVert as MoreVertIcon, VideogameAsset as ControlIcon, Close as CloseIcon, } from '@mui/icons-material';
4
+ import { Utils, Icon, I18n } from '@iobroker/adapter-react-v5';
5
+ import DeviceActionButton from './DeviceActionButton';
6
+ import DeviceControlComponent from './DeviceControl';
7
+ import DeviceStatus from './DeviceStatus';
8
+ import JsonConfig from './JsonConfig';
9
+ import DeviceImageUpload from './DeviceImageUpload';
10
+ import { getTranslation } from './Utils';
11
+ const NoImageIcon = (props) => React.createElement("svg", { viewBox: "0 0 24 24", width: "24", height: "24", style: props.style, className: props.className },
12
+ React.createElement("path", { fill: "currentColor", d: "M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z" }));
13
+ function getText(text) {
14
+ if (typeof text === 'object') {
15
+ return text[I18n.getLanguage()] || text.en;
16
+ }
17
+ return text;
18
+ }
19
+ /**
20
+ * Device Card Component
21
+ */
22
+ class DeviceCard extends Component {
23
+ constructor(props) {
24
+ super(props);
25
+ this.state = {
26
+ open: false,
27
+ details: null,
28
+ data: {},
29
+ icon: props.device.icon,
30
+ showControlDialog: false,
31
+ };
32
+ }
33
+ async fetchIcon() {
34
+ if (!this.props.device.icon) {
35
+ // try to load the icon from file storage
36
+ const fileName = `${this.props.device.manufacturer ? `${this.props.device.manufacturer}_` : ''}${this.props.device.model ? this.props.device.model : this.props.device.id}`;
37
+ try {
38
+ const file = await this.props.socket.readFile(this.props.instanceId.replace('system.adapter.', ''), `${fileName}.webp`, true);
39
+ this.setState({ icon: `data:image/${file.mimeType},${file}` });
40
+ // const response = await fetch(url);
41
+ // if (response.ok) {
42
+ // const blob = await response.blob();
43
+ // const reader = new FileReader();
44
+ // reader.onloadend = () => {
45
+ // setIcon(reader.result);
46
+ // };
47
+ // reader.readAsDataURL(blob);
48
+ // } else {
49
+ // throw new Error('Response not ok');
50
+ // }
51
+ }
52
+ catch (error) {
53
+ this.state.icon && this.setState({ icon: '' });
54
+ }
55
+ }
56
+ }
57
+ componentDidMount() {
58
+ this.fetchIcon()
59
+ .catch(e => console.error(e));
60
+ }
61
+ /**
62
+ * Load the device details
63
+ */
64
+ async loadDetails() {
65
+ console.log(`Loading device details for ${this.props.device.id}... from ${this.props.instanceId}`);
66
+ const details = await this.props.socket.sendTo(this.props.instanceId, 'dm:deviceDetails', this.props.device.id);
67
+ console.log(`Got device details for ${this.props.device.id}:`, details);
68
+ this.setState({ details, data: details?.data || {} });
69
+ }
70
+ ;
71
+ /**
72
+ * Refresh the device details
73
+ */
74
+ refresh = () => {
75
+ this.setState({ details: null });
76
+ this.loadDetails().catch(console.error);
77
+ };
78
+ /**
79
+ * Copy the device ID to the clipboard
80
+ * @returns {void}
81
+ */
82
+ copyToClipboard = async () => {
83
+ const textToCopy = this.props.device.id;
84
+ Utils.copyToClipboard(textToCopy);
85
+ alert(`${getTranslation('copied')} ${textToCopy} ${getTranslation('toClipboard')}!`);
86
+ };
87
+ renderDialog() {
88
+ if (!this.state.open || !this.state.details) {
89
+ return null;
90
+ }
91
+ return React.createElement(Dialog, { open: !0, maxWidth: "md", onClose: () => this.setState({ open: false }) },
92
+ React.createElement(DialogContent, null,
93
+ React.createElement(JsonConfig, { instanceId: this.props.instanceId, socket: this.props.socket, schema: this.state.details.schema, data: this.state.data, onChange: (data) => this.setState({ data }) })),
94
+ React.createElement(DialogActions, null,
95
+ React.createElement(Button, { disabled: !this.props.alive, variant: "contained", color: "primary", onClick: () => this.setState({ open: false }), autoFocus: true }, getTranslation('closeButtonText'))));
96
+ }
97
+ renderControlDialog() {
98
+ if (!this.state.showControlDialog || !this.props.alive) {
99
+ return null;
100
+ }
101
+ const colors = { primary: '#111', secondary: '#888' };
102
+ return React.createElement(Dialog, { open: !0, onClose: () => this.setState({ showControlDialog: false }) },
103
+ React.createElement(DialogTitle, null,
104
+ this.props.title,
105
+ React.createElement(IconButton, { style: {
106
+ position: 'absolute',
107
+ top: 5,
108
+ right: 5,
109
+ zIndex: 10,
110
+ }, onClick: () => this.setState({ showControlDialog: false }) },
111
+ React.createElement(CloseIcon, null))),
112
+ React.createElement(DialogContent, { style: { display: 'flex', flexDirection: 'column' } }, this.props.device.controls?.map(control => React.createElement(DeviceControlComponent, { disabled: false, key: control.id, control: control, socket: this.props.socket, colors: colors, deviceId: this.props.device.id, controlHandler: this.props.controlHandler, controlStateHandler: this.props.controlStateHandler }))));
113
+ }
114
+ renderControls() {
115
+ const colors = { primary: '#111', secondary: '#888' };
116
+ const firstControl = this.props.device.controls?.[0];
117
+ if (this.props.device.controls?.length === 1 && firstControl && ((firstControl.type === 'icon' || firstControl.type === 'switch') && !firstControl.label)) {
118
+ // control can be placed in button icon
119
+ return React.createElement(DeviceControlComponent, { disabled: !this.props.alive, control: firstControl, colors: colors, socket: this.props.socket, deviceId: this.props.device.id, controlHandler: this.props.controlHandler, controlStateHandler: this.props.controlStateHandler });
120
+ }
121
+ if (this.props.device.controls?.length) {
122
+ // place button and show controls dialog
123
+ return React.createElement(Fab, { size: "small", disabled: !this.props.alive, onClick: () => this.setState({ showControlDialog: true }) },
124
+ React.createElement(ControlIcon, null));
125
+ }
126
+ return null;
127
+ }
128
+ renderActions() {
129
+ return this.props.device.actions?.length ? this.props.device.actions.map(a => React.createElement(DeviceActionButton, { disabled: !this.props.alive, key: a.id, deviceId: this.props.device.id, action: a, deviceHandler: this.props.deviceHandler, refresh: this.refresh })) : null;
130
+ }
131
+ renderSmall() {
132
+ const hasDetails = this.props.device.hasDetails;
133
+ const status = !this.props.device.status ? [] : Array.isArray(this.props.device.status) ? this.props.device.status : [this.props.device.status];
134
+ return React.createElement(Card, { sx: {
135
+ maxWidth: 345,
136
+ minWidth: 200,
137
+ } },
138
+ React.createElement(CardHeader, { sx: theme => ({
139
+ backgroundColor: this.props.device.color || theme.palette.secondary.main,
140
+ color: this.props.device.color ? Utils.invertColor(this.props.device.color, true) : theme.palette.secondary.contrastText,
141
+ maxWidth: 345,
142
+ }), avatar: React.createElement("div", null,
143
+ this.props.uploadImagesToInstance ? React.createElement(DeviceImageUpload, { uploadImagesToInstance: this.props.uploadImagesToInstance, deviceId: this.props.device.id, manufacturer: getText(this.props.device.manufacturer), model: getText(this.props.device.model), onImageSelect: async (imageData) => imageData && this.setState({ icon: imageData }), socket: this.props.socket }) : null,
144
+ this.state.icon ? React.createElement(Icon, { src: this.state.icon }) : React.createElement(NoImageIcon, null)), action: hasDetails ? React.createElement(IconButton, { "aria-label": "settings", onClick: () => {
145
+ if (!this.state.open) {
146
+ this.loadDetails().catch(console.error);
147
+ this.setState({ open: true });
148
+ }
149
+ } },
150
+ React.createElement(MoreVertIcon, null)) : null, title: this.props.title, subheader: this.props.device.manufacturer ? React.createElement("span", null,
151
+ React.createElement("b", { style: { marginRight: 4 } },
152
+ getTranslation('manufacturer'),
153
+ ":"),
154
+ getText(this.props.device.manufacturer)) : null }),
155
+ React.createElement(CardContent, { style: { position: 'relative' } },
156
+ status?.length ? React.createElement("div", { style: {
157
+ display: 'flex',
158
+ position: 'absolute',
159
+ top: -11,
160
+ background: '#88888880',
161
+ padding: '0 8px',
162
+ borderRadius: 5,
163
+ width: 'calc(100% - 46px)',
164
+ } }, status.map((s, i) => React.createElement(DeviceStatus, { key: i, status: s }))) : null,
165
+ React.createElement("div", null,
166
+ React.createElement(Typography, { variant: "body1" },
167
+ React.createElement("div", { onClick: this.copyToClipboard },
168
+ React.createElement("b", null, "ID:"),
169
+ React.createElement("span", { style: { marginLeft: 4 } }, this.props.device.id.replace(/.*\.\d\./, ''))),
170
+ this.props.device.manufacturer ? React.createElement("div", null,
171
+ React.createElement("b", { style: { marginRight: 4 } },
172
+ getTranslation('manufacturer'),
173
+ ":"),
174
+ getText(this.props.device.manufacturer)) : null,
175
+ this.props.device.model ? React.createElement("div", null,
176
+ React.createElement("b", { style: { marginRight: 4 } },
177
+ getTranslation('model'),
178
+ ":"),
179
+ getText(this.props.device.model)) : null))),
180
+ React.createElement(CardActions, { disableSpacing: true },
181
+ this.renderActions(),
182
+ React.createElement("div", { style: { flexGrow: 1 } }),
183
+ this.renderControls()),
184
+ this.renderDialog(),
185
+ this.renderControlDialog());
186
+ }
187
+ renderBig() {
188
+ const cardStyle = {
189
+ // backgroundColor: '#fafafa',
190
+ width: 300,
191
+ minHeight: 280,
192
+ margin: 10,
193
+ overflow: 'hidden',
194
+ display: 'inline-block',
195
+ };
196
+ /** @type {CSSProperties} */
197
+ const headerStyle = {
198
+ display: 'flex',
199
+ position: 'relative',
200
+ justifyContent: 'space-between',
201
+ minHeight: 60,
202
+ color: '#000',
203
+ padding: '0 10px 0 10px',
204
+ backgroundColor: '#77c7ff8c',
205
+ borderRadius: '4px 4px 0 0',
206
+ };
207
+ /** @type {CSSProperties} */
208
+ const imgAreaStyle = {
209
+ height: 45,
210
+ width: 45,
211
+ margin: 'auto',
212
+ justifyContent: 'center',
213
+ display: 'grid',
214
+ };
215
+ /** @type {CSSProperties} */
216
+ const imgStyle = {
217
+ zIndex: 2,
218
+ maxWidth: '100%',
219
+ maxHeight: '100%',
220
+ };
221
+ /** @type {CSSProperties} */
222
+ const titleStyle = {
223
+ color: '#333',
224
+ width: '100%',
225
+ fontSize: 16,
226
+ fontWeight: 'bold',
227
+ paddingTop: 16,
228
+ paddingLeft: 8,
229
+ whiteSpace: 'nowrap',
230
+ overflow: 'hidden',
231
+ textOverflow: 'ellipsis',
232
+ };
233
+ /** @type {CSSProperties} */
234
+ const detailsButtonStyle = {
235
+ right: 20,
236
+ bottom: -20,
237
+ position: 'absolute',
238
+ };
239
+ /** @type {CSSProperties} */
240
+ const bodyStyle = {
241
+ height: 'calc(100% - 116px)',
242
+ };
243
+ /** @type {CSSProperties} */
244
+ const deviceInfoStyle = {
245
+ padding: '20px 16px 0 16px',
246
+ height: 133,
247
+ };
248
+ /** @type {CSSProperties} */
249
+ const statusStyle = {
250
+ padding: '15px 15px 0 15px',
251
+ height: 41,
252
+ };
253
+ const status = !this.props.device.status ? [] : Array.isArray(this.props.device.status) ? this.props.device.status : [this.props.device.status];
254
+ return React.createElement(Paper, { style: cardStyle, key: this.props.id },
255
+ React.createElement("div", { style: headerStyle },
256
+ React.createElement("div", { style: imgAreaStyle },
257
+ this.props.uploadImagesToInstance ? React.createElement(DeviceImageUpload, { uploadImagesToInstance: this.props.uploadImagesToInstance, deviceId: this.props.device.id, manufacturer: getText(this.props.device.manufacturer), model: getText(this.props.device.model), onImageSelect: async (imageData) => imageData && this.setState({ icon: imageData }), socket: this.props.socket }) : null,
258
+ React.createElement(Icon, { src: this.state.icon, style: imgStyle })),
259
+ React.createElement("div", { style: titleStyle }, this.props.title),
260
+ this.props.device.hasDetails ? React.createElement(Fab, { disabled: !this.props.alive, size: "small", style: detailsButtonStyle, onClick: () => {
261
+ if (!this.state.open) {
262
+ this.loadDetails().catch(console.error);
263
+ this.setState({ open: true });
264
+ }
265
+ }, color: "primary" },
266
+ React.createElement(MoreVertIcon, null)) : null),
267
+ React.createElement("div", { style: statusStyle }, status.map((s, i) => React.createElement(DeviceStatus, { key: i, status: s }))),
268
+ React.createElement("div", { style: bodyStyle },
269
+ React.createElement(Typography, { variant: "body1", style: deviceInfoStyle },
270
+ React.createElement("div", { onClick: this.copyToClipboard },
271
+ React.createElement("b", { style: { marginRight: 4 } }, "ID:"),
272
+ this.props.device.id.replace(/.*\.\d\./, '')),
273
+ this.props.device.manufacturer ? React.createElement("div", null,
274
+ React.createElement("b", { style: { marginRight: 4 } },
275
+ getTranslation('manufacturer'),
276
+ ":"),
277
+ getText(this.props.device.manufacturer)) : null,
278
+ this.props.device.model ? React.createElement("div", null,
279
+ React.createElement("b", { style: { marginRight: 4 } },
280
+ getTranslation('model'),
281
+ ":"),
282
+ getText(this.props.device.model)) : null),
283
+ !!this.props.device.actions?.length && React.createElement("div", { style: {
284
+ flex: 1,
285
+ position: 'relative',
286
+ display: 'flex',
287
+ gap: 8,
288
+ paddingBottom: 5,
289
+ height: 34,
290
+ paddingLeft: 10,
291
+ paddingRight: 10,
292
+ } },
293
+ this.renderActions(),
294
+ React.createElement("div", { style: { flexGrow: 1 } }),
295
+ this.renderControls())),
296
+ this.renderDialog(),
297
+ this.renderControlDialog());
298
+ }
299
+ render() {
300
+ if (this.props.smallCards) {
301
+ return this.renderSmall();
302
+ }
303
+ return this.renderBig();
304
+ }
305
+ }
306
+ export default DeviceCard;
307
+ //# sourceMappingURL=DeviceCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceCard.js","sourceRoot":"./src/","sources":["DeviceCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACH,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAChD,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAC/C,WAAW,EAAE,KAAK,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,QAAQ,IAAI,YAAY,EACxB,cAAc,IAAI,WAAW,EAC7B,KAAK,IAAI,SAAS,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAc,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAI3E,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD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