@iobroker/dm-gui-components 9.0.2 → 9.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -6
- package/build/Communication.d.ts +7 -6
- package/build/Communication.js +39 -22
- package/build/Communication.js.map +1 -1
- package/build/DeviceActionButton.d.ts +1 -2
- package/build/DeviceActionButton.js +2 -2
- package/build/DeviceActionButton.js.map +1 -1
- package/build/DeviceCard.d.ts +4 -5
- package/build/DeviceCard.js +37 -44
- package/build/DeviceCard.js.map +1 -1
- package/build/DeviceControl.js +9 -8
- package/build/DeviceControl.js.map +1 -1
- package/build/DeviceList.d.ts +6 -2
- package/build/DeviceList.js +26 -8
- package/build/DeviceList.js.map +1 -1
- package/build/DeviceStatus.d.ts +1 -2
- package/build/DeviceStatus.js +2 -2
- package/build/DeviceStatus.js.map +1 -1
- package/build/StateOrObjectHandler.d.ts +6 -2
- package/build/StateOrObjectHandler.js +128 -108
- package/build/StateOrObjectHandler.js.map +1 -1
- package/build/hooks.js +3 -2
- package/build/hooks.js.map +1 -1
- package/build/protocol/DmProtocolV1.js +68 -4
- package/build/protocol/DmProtocolV1.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +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,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
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,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAS3D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAA8B;IACrE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE5D,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAEtC,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAEtF,OAAO,CACH,oBAAC,aAAa,IACV,OAAO,EAAE,OAAO,IAAI,SAAS,EAC7B,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,EACrC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,EACxC,GAAG,EAAE,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,GAC/D,CACL,CAAC;AACN,CAAC","sourcesContent":["import React from 'react';\nimport type { ActionBase, DeviceAction, DeviceId } from './protocol/api';\nimport TooltipButton from './TooltipButton';\nimport { getTranslation, renderActionIcon } from './Utils';\n\ninterface DeviceActionButtonProps {\n deviceId: DeviceId;\n action: DeviceAction;\n deviceHandler: (deviceId: DeviceId, action: ActionBase) => () => void;\n disabled?: boolean;\n}\n\nexport default function DeviceActionButton(props: DeviceActionButtonProps): React.JSX.Element {\n const { deviceId, action, deviceHandler, disabled } = props;\n\n const icon = renderActionIcon(action);\n\n const tooltip = getTranslation(action.description ?? '') || (icon ? null : action.id);\n\n return (\n <TooltipButton\n tooltip={tooltip || undefined}\n disabled={disabled || action.disabled}\n Icon={icon}\n onClick={deviceHandler(deviceId, action)}\n url={'url' in action ? getTranslation(action.url) : undefined}\n />\n );\n}\n"]}
|
package/build/DeviceCard.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ interface DeviceCardProps {
|
|
|
9
9
|
instanceId: string;
|
|
10
10
|
socket: Connection;
|
|
11
11
|
uploadImagesToInstance?: string;
|
|
12
|
-
deviceHandler: (deviceId: DeviceId, action: ActionBase
|
|
12
|
+
deviceHandler: (deviceId: DeviceId, action: ActionBase) => () => void;
|
|
13
13
|
controlHandler: (deviceId: DeviceId, control: ControlBase, state: ControlState) => () => Promise<ioBroker.State | null>;
|
|
14
14
|
controlStateHandler: (deviceId: DeviceId, control: ControlBase) => () => Promise<ioBroker.State | null>;
|
|
15
15
|
smallCards?: boolean;
|
|
@@ -41,18 +41,17 @@ interface DeviceCardState {
|
|
|
41
41
|
*/
|
|
42
42
|
export default class DeviceCard extends Component<DeviceCardProps, DeviceCardState> {
|
|
43
43
|
private readonly stateOrObjectHandler;
|
|
44
|
+
private readonly subscriptions;
|
|
44
45
|
constructor(props: DeviceCardProps);
|
|
45
46
|
fetchIcon(): Promise<void>;
|
|
46
47
|
componentDidMount(): Promise<void>;
|
|
48
|
+
private addStateOrObjectListener;
|
|
49
|
+
componentDidUpdate(prevProps: DeviceCardProps): Promise<void>;
|
|
47
50
|
componentWillUnmount(): Promise<void>;
|
|
48
51
|
/**
|
|
49
52
|
* Load the device details
|
|
50
53
|
*/
|
|
51
54
|
loadDetails(): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Refresh the device details
|
|
54
|
-
*/
|
|
55
|
-
refresh: () => void;
|
|
56
55
|
/**
|
|
57
56
|
* Copy the device ID to the clipboard
|
|
58
57
|
*/
|
package/build/DeviceCard.js
CHANGED
|
@@ -90,6 +90,7 @@ function getText(text) {
|
|
|
90
90
|
*/
|
|
91
91
|
export default class DeviceCard extends Component {
|
|
92
92
|
stateOrObjectHandler;
|
|
93
|
+
subscriptions = new Map();
|
|
93
94
|
constructor(props) {
|
|
94
95
|
super(props);
|
|
95
96
|
this.state = {
|
|
@@ -134,40 +135,39 @@ export default class DeviceCard extends Component {
|
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
async componentDidMount() {
|
|
137
|
-
await this.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
await this.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
await this.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
await this.
|
|
147
|
-
this.setState({ icon: value });
|
|
148
|
-
});
|
|
149
|
-
await this.stateOrObjectHandler.addListener(this.props.device.backgroundColor, value => {
|
|
150
|
-
this.setState({ backgroundColor: value });
|
|
151
|
-
});
|
|
152
|
-
await this.stateOrObjectHandler.addListener(this.props.device.color, value => {
|
|
153
|
-
this.setState({ color: value });
|
|
154
|
-
});
|
|
155
|
-
await this.stateOrObjectHandler.addListener(this.props.device.manufacturer, value => {
|
|
156
|
-
this.setState({ manufacturer: getText(value) });
|
|
157
|
-
});
|
|
158
|
-
await this.stateOrObjectHandler.addListener(this.props.device.model, value => {
|
|
159
|
-
this.setState({ model: getText(value) });
|
|
160
|
-
});
|
|
161
|
-
await this.stateOrObjectHandler.addListener(this.props.device.connectionType, value => {
|
|
162
|
-
this.setState({ connectionType: value });
|
|
163
|
-
});
|
|
164
|
-
await this.stateOrObjectHandler.addListener(this.props.device.enabled, value => {
|
|
165
|
-
this.setState({ enabled: value });
|
|
166
|
-
});
|
|
138
|
+
await this.addStateOrObjectListener('name', getText);
|
|
139
|
+
await this.addStateOrObjectListener('identifier');
|
|
140
|
+
await this.addStateOrObjectListener('hasDetails');
|
|
141
|
+
await this.addStateOrObjectListener('icon');
|
|
142
|
+
await this.addStateOrObjectListener('backgroundColor');
|
|
143
|
+
await this.addStateOrObjectListener('color');
|
|
144
|
+
await this.addStateOrObjectListener('manufacturer', getText);
|
|
145
|
+
await this.addStateOrObjectListener('model', getText);
|
|
146
|
+
await this.addStateOrObjectListener('connectionType');
|
|
147
|
+
await this.addStateOrObjectListener('enabled');
|
|
167
148
|
await this.fetchIcon().catch(e => console.error(e));
|
|
168
149
|
}
|
|
150
|
+
async addStateOrObjectListener(key, transform) {
|
|
151
|
+
const sub = await this.stateOrObjectHandler.addListener(this.props.device[key], value => this.setState({ [key]: transform ? transform(value) : value }));
|
|
152
|
+
this.subscriptions.set(key, { subscription: sub, transform });
|
|
153
|
+
}
|
|
154
|
+
async componentDidUpdate(prevProps) {
|
|
155
|
+
for (const [key, { subscription, transform }] of [...this.subscriptions]) {
|
|
156
|
+
const newItem = this.props.device[key];
|
|
157
|
+
const prevItem = prevProps.device[key];
|
|
158
|
+
if (newItem !== prevItem) {
|
|
159
|
+
console.log(`${key} of device ${JSON.stringify(this.props.device.id)} updated`, prevItem, newItem);
|
|
160
|
+
this.subscriptions.delete(key);
|
|
161
|
+
await this.addStateOrObjectListener(key, transform);
|
|
162
|
+
await subscription.unsubscribe();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
169
166
|
async componentWillUnmount() {
|
|
170
|
-
|
|
167
|
+
for (const [, { subscription }] of this.subscriptions) {
|
|
168
|
+
await subscription.unsubscribe();
|
|
169
|
+
}
|
|
170
|
+
this.subscriptions.clear();
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* Load the device details
|
|
@@ -178,13 +178,6 @@ export default class DeviceCard extends Component {
|
|
|
178
178
|
console.log(`Got device details for`, this.props.device.id, details);
|
|
179
179
|
this.setState({ details, data: details?.data || {} });
|
|
180
180
|
}
|
|
181
|
-
/**
|
|
182
|
-
* Refresh the device details
|
|
183
|
-
*/
|
|
184
|
-
refresh = () => {
|
|
185
|
-
this.setState({ details: null });
|
|
186
|
-
this.loadDetails().catch(console.error);
|
|
187
|
-
};
|
|
188
181
|
/**
|
|
189
182
|
* Copy the device ID to the clipboard
|
|
190
183
|
*/
|
|
@@ -221,7 +214,7 @@ export default class DeviceCard extends Component {
|
|
|
221
214
|
zIndex: 10,
|
|
222
215
|
}, onClick: () => this.setState({ showControlDialog: false }) },
|
|
223
216
|
React.createElement(CloseIcon, null))),
|
|
224
|
-
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 }))))));
|
|
217
|
+
React.createElement(DialogContent, { style: { display: 'flex', flexDirection: 'column', overflow: 'visible' } }, 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 }))))));
|
|
225
218
|
}
|
|
226
219
|
renderControls() {
|
|
227
220
|
const colors = { primary: '#111', secondary: '#888' };
|
|
@@ -235,7 +228,7 @@ export default class DeviceCard extends Component {
|
|
|
235
228
|
}
|
|
236
229
|
if (this.props.device.controls?.length) {
|
|
237
230
|
// place a button and show a controls dialog
|
|
238
|
-
return (React.createElement(Fab, { size: "small", disabled: !this.props.alive, onClick: () => this.setState({ showControlDialog: true }) },
|
|
231
|
+
return (React.createElement(Fab, { size: "small", style: { width: 32, height: 32, minHeight: 32 }, disabled: !this.props.alive, onClick: () => this.setState({ showControlDialog: true }) },
|
|
239
232
|
React.createElement(ControlIcon, null)));
|
|
240
233
|
}
|
|
241
234
|
return null;
|
|
@@ -243,7 +236,7 @@ export default class DeviceCard extends Component {
|
|
|
243
236
|
renderActions() {
|
|
244
237
|
const actions = this.props.device.actions?.filter(a => a.id !== ACTIONS.STATUS && a.id !== ACTIONS.ENABLE_DISABLE);
|
|
245
238
|
return actions?.length
|
|
246
|
-
? actions.map(a => (React.createElement(DeviceActionButton, { disabled: !this.props.alive, key: a.id, deviceId: this.props.device.id, action: a, deviceHandler: this.props.deviceHandler
|
|
239
|
+
? actions.map(a => (React.createElement(DeviceActionButton, { disabled: !this.props.alive, key: a.id, deviceId: this.props.device.id, action: a, deviceHandler: this.props.deviceHandler })))
|
|
247
240
|
: null;
|
|
248
241
|
}
|
|
249
242
|
renderSmall() {
|
|
@@ -282,7 +275,7 @@ export default class DeviceCard extends Component {
|
|
|
282
275
|
padding: '0 8px',
|
|
283
276
|
borderRadius: 5,
|
|
284
277
|
width: 'calc(100% - 46px)',
|
|
285
|
-
} }, status.map((s, i) => (React.createElement(DeviceStatusComponent, { key: i, socket: this.props.socket, status: s, connectionType: this.state.connectionType, enabled: this.state.enabled, deviceId: this.props.device.id, statusAction: this.props.device.actions?.find(a => a.id === ACTIONS.STATUS), disableEnableAction: this.props.device.actions?.find(a => a.id === ACTIONS.ENABLE_DISABLE), deviceHandler: this.props.deviceHandler,
|
|
278
|
+
} }, status.map((s, i) => (React.createElement(DeviceStatusComponent, { key: i, socket: this.props.socket, status: s, connectionType: this.state.connectionType, enabled: this.state.enabled, deviceId: this.props.device.id, statusAction: this.props.device.actions?.find(a => a.id === ACTIONS.STATUS), disableEnableAction: this.props.device.actions?.find(a => a.id === ACTIONS.ENABLE_DISABLE), deviceHandler: this.props.deviceHandler, theme: this.props.theme, stateOrObjectHandler: this.stateOrObjectHandler }))))) : null,
|
|
286
279
|
React.createElement("div", null,
|
|
287
280
|
React.createElement(Typography, { variant: "body1" },
|
|
288
281
|
this.state.identifier ? (React.createElement("div", { onClick: this.copyToClipboard, style: { textOverflow: 'ellipsis', overflow: 'hidden' } },
|
|
@@ -368,7 +361,7 @@ export default class DeviceCard extends Component {
|
|
|
368
361
|
}
|
|
369
362
|
}, color: "primary" },
|
|
370
363
|
React.createElement(MoreVertIcon, null))) : null),
|
|
371
|
-
React.createElement("div", { style: styles.statusStyle }, status.map((s, i) => (React.createElement(DeviceStatusComponent, { key: i, socket: this.props.socket, deviceId: this.props.device.id, connectionType: this.state.connectionType, status: s, enabled: this.state.enabled, statusAction: this.props.device.actions?.find(a => a.id === ACTIONS.STATUS), disableEnableAction: this.props.device.actions?.find(a => a.id === ACTIONS.ENABLE_DISABLE), deviceHandler: this.props.deviceHandler,
|
|
364
|
+
React.createElement("div", { style: styles.statusStyle }, status.map((s, i) => (React.createElement(DeviceStatusComponent, { key: i, socket: this.props.socket, deviceId: this.props.device.id, connectionType: this.state.connectionType, status: s, enabled: this.state.enabled, statusAction: this.props.device.actions?.find(a => a.id === ACTIONS.STATUS), disableEnableAction: this.props.device.actions?.find(a => a.id === ACTIONS.ENABLE_DISABLE), deviceHandler: this.props.deviceHandler, theme: this.props.theme, stateOrObjectHandler: this.stateOrObjectHandler })))),
|
|
372
365
|
React.createElement("div", { style: styles.bodyStyle },
|
|
373
366
|
React.createElement(Typography, { variant: "body1", style: styles.deviceInfoStyle },
|
|
374
367
|
this.state.identifier ? (React.createElement("div", { onClick: this.copyToClipboard },
|
|
@@ -386,7 +379,7 @@ export default class DeviceCard extends Component {
|
|
|
386
379
|
getTranslation('model'),
|
|
387
380
|
":"),
|
|
388
381
|
this.state.model)) : null),
|
|
389
|
-
!!this.props.device.actions?.length && (React.createElement("div", { style: {
|
|
382
|
+
!!(this.props.device.actions?.length || this.props.device.controls?.length) && (React.createElement("div", { style: {
|
|
390
383
|
flex: 1,
|
|
391
384
|
position: 'relative',
|
|
392
385
|
display: 'flex',
|
package/build/DeviceCard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceCard.js","sourceRoot":"./src/","sources":["DeviceCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,IAAI,EACJ,KAAK,GAKR,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,cAAc,IAAI,WAAW,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClH,OAAO,EACH,GAAG,EACH,MAAM,EACN,IAAI,EACJ,WAAW,EACX,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,WAAW,EACX,GAAG,EACH,UAAU,EACV,KAAK,EACL,QAAQ,EACR,UAAU,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,EAAE,SAAS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K,KAAK,EAAE,MAAM,CAAC,WAAW,GAAQ;YACtC,6BAAK,KAAK,EAAE,MAAM,CAAC,SAAS;gBACxB,oBAAC,UAAU,IACP,OAAO,EAAC,OAAO,EACf,KAAK,EAAE,MAAM,CAAC,eAAe;oBAE7B;wBACI,oBAAC,QAAQ,OAAG,CACV;oBACN;wBACI,oBAAC,QAAQ,OAAG,CACV;oBACN;wBACI,oBAAC,QAAQ,OAAG,CACV,CACG,CACX,CACF,CACX,CAAC;IACN,CAAC;IAED,kDAAkD;IAClD,kBAAkB,CAAC,KAAe,EAAE,QAAiB;QACjD,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;QACrD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC;QAEnD,OAAO;YACH,eAAe;YACf,KAAK;YACL,QAAQ;SACX,CAAC;IACN,CAAC;CACJ","sourcesContent":["import {\n DeviceTypeIcon,\n I18n,\n Utils,\n type Connection,\n type IobTheme,\n type ThemeName,\n type ThemeType,\n} from '@iobroker/adapter-react-v5';\nimport type { ConfigItemPanel, ConfigItemTabs } from '@iobroker/json-config';\nimport { Close as CloseIcon, VideogameAsset as ControlIcon, MoreVert as MoreVertIcon } from '@mui/icons-material';\nimport {\n Box,\n Button,\n Card,\n CardActions,\n CardContent,\n CardHeader,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Fab,\n IconButton,\n Paper,\n Skeleton,\n Typography,\n} from '@mui/material';\nimport React, { Component, type JSX } from 'react';\nimport DeviceActionButton from './DeviceActionButton';\nimport DeviceControlComponent from './DeviceControl';\nimport DeviceImageUpload from './DeviceImageUpload';\nimport DeviceStatusComponent from './DeviceStatus';\nimport JsonConfig from './JsonConfig';\nimport type {\n ActionBase,\n ControlBase,\n ControlState,\n DeviceDetails,\n DeviceInfo,\n DeviceId,\n ConfigConnectionType,\n} from './protocol/api';\nimport { getTranslation } from './Utils';\nimport { StateOrObjectHandler } from './StateOrObjectHandler';\n\nconst smallCardStyle = {\n maxWidth: 345,\n minWidth: 200,\n} as const;\n\n/** Reserved action names (this is copied from https://github.com/ioBroker/dm-utils/blob/main/src/types/base.ts as we can only have type references to dm-utils) */\nconst ACTIONS = {\n /** This action will be called when the user clicks on the connection icon */\n STATUS: 'status',\n /** This action will be called when the user clicks on the enabled / disabled icon. The enabled/disabled icon will be shown only if the node status has the \"enabled\" flag set to false or true */\n ENABLE_DISABLE: 'enable/disable',\n};\n\nconst styles: Record<string, React.CSSProperties> = {\n cardStyle: {\n width: 300,\n minHeight: 280,\n margin: 10,\n overflow: 'hidden',\n display: 'inline-block',\n },\n headerStyle: {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n paddingLeft: 8,\n paddingRight: 8,\n position: 'relative',\n minHeight: 60,\n color: '#000',\n },\n imgAreaStyle: {\n height: 45,\n width: 45,\n justifyContent: 'center',\n display: 'flex',\n alignItems: 'center',\n },\n imgStyle: {\n zIndex: 2,\n maxWidth: '100%',\n maxHeight: '100%',\n color: '#FFF',\n },\n titleStyle: {\n fontSize: 16,\n fontWeight: 'bold',\n // whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n detailsButtonStyle: {\n right: 20,\n bottom: -20,\n position: 'absolute',\n },\n bodyStyle: {\n height: 'calc(100% - 116px)',\n },\n deviceInfoStyle: {\n padding: '20px 16px 0 16px',\n height: 133,\n },\n statusStyle: {\n padding: '15px 25px 0 15px',\n height: 41,\n },\n};\n\nfunction NoImageIcon(props: { style?: React.CSSProperties; className?: string }): JSX.Element {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n width=\"24\"\n height=\"24\"\n style={props.style}\n className={props.className}\n >\n <path\n fill=\"currentColor\"\n 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\"\n />\n </svg>\n );\n}\n\ninterface DeviceCardProps {\n filter?: string;\n /* Device ID */\n id: DeviceId;\n identifierLabel: ioBroker.StringOrTranslated;\n device: DeviceInfo;\n instanceId: string;\n socket: Connection;\n /* Instance, where the images should be uploaded to */\n uploadImagesToInstance?: string;\n deviceHandler: (deviceId: DeviceId, action: ActionBase, refresh: () => void) => () => void;\n controlHandler: (\n deviceId: DeviceId,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n controlStateHandler: (deviceId: DeviceId, control: ControlBase) => () => Promise<ioBroker.State | null>;\n smallCards?: boolean;\n alive: boolean;\n themeName: ThemeName;\n themeType: ThemeType;\n theme: IobTheme;\n isFloatComma: boolean;\n dateFormat: string;\n}\n\nfunction getText(text: ioBroker.StringOrTranslated | undefined): string | undefined {\n if (typeof text === 'object') {\n return text[I18n.getLanguage()] || text.en;\n }\n\n return text;\n}\n\ninterface DeviceCardState {\n open: boolean;\n details: DeviceDetails | null;\n data: Record<string, any>;\n showControlDialog: boolean;\n\n // values possibly loaded from states/objects\n name?: string;\n identifier?: string;\n hasDetails?: boolean;\n icon?: string;\n backgroundColor?: string;\n color?: string;\n manufacturer?: string;\n model?: string;\n connectionType?: ConfigConnectionType;\n enabled?: boolean;\n}\n\n/**\n * Device Card Component\n */\nexport default class DeviceCard extends Component<DeviceCardProps, DeviceCardState> {\n private readonly stateOrObjectHandler: StateOrObjectHandler;\n\n constructor(props: DeviceCardProps) {\n super(props);\n\n this.state = {\n open: false,\n details: null,\n data: {},\n showControlDialog: false,\n };\n\n this.stateOrObjectHandler = new StateOrObjectHandler(this.props.socket);\n }\n\n async fetchIcon(): Promise<void> {\n if (!this.props.device.icon) {\n const manufacturer = this.state.manufacturer;\n const model = this.state.model;\n\n // try to load the icon from file storage\n const fileName = `${manufacturer ? `${manufacturer}_` : ''}${model || JSON.stringify(this.props.device.id)}`;\n\n try {\n const file = await this.props.socket.readFile(\n this.props.instanceId.replace('system.adapter.', ''),\n `${fileName}.webp`,\n true,\n );\n if (file) {\n this.setState({ icon: `data:${file.mimeType};base64,${file.file}` });\n } else {\n this.setState({ icon: '' });\n }\n // const response = await fetch(url);\n // if (response.ok) {\n // const blob = await response.blob();\n // const reader = new FileReader();\n // reader.onloadend = () => {\n // setIcon(reader.result);\n // };\n // reader.readAsDataURL(blob);\n // } else {\n // throw new Error('Response not ok');\n // }\n } catch {\n if (this.state.icon) {\n this.setState({ icon: '' });\n }\n }\n }\n }\n\n async componentDidMount(): Promise<void> {\n await this.stateOrObjectHandler.addListener(this.props.device.name, value => {\n this.setState({ name: getText(value) });\n });\n await this.stateOrObjectHandler.addListener(this.props.device.identifier, value => {\n this.setState({ identifier: value });\n });\n await this.stateOrObjectHandler.addListener(this.props.device.hasDetails, value => {\n this.setState({ hasDetails: value });\n });\n await this.stateOrObjectHandler.addListener(this.props.device.icon, value => {\n this.setState({ icon: value });\n });\n await this.stateOrObjectHandler.addListener(this.props.device.backgroundColor, value => {\n this.setState({ backgroundColor: value });\n });\n await this.stateOrObjectHandler.addListener(this.props.device.color, value => {\n this.setState({ color: value });\n });\n await this.stateOrObjectHandler.addListener(this.props.device.manufacturer, value => {\n this.setState({ manufacturer: getText(value) });\n });\n await this.stateOrObjectHandler.addListener(this.props.device.model, value => {\n this.setState({ model: getText(value) });\n });\n await this.stateOrObjectHandler.addListener(this.props.device.connectionType, value => {\n this.setState({ connectionType: value });\n });\n await this.stateOrObjectHandler.addListener(this.props.device.enabled, value => {\n this.setState({ enabled: value });\n });\n await this.fetchIcon().catch(e => console.error(e));\n }\n\n async componentWillUnmount(): Promise<void> {\n await this.stateOrObjectHandler.unsubscribe();\n }\n\n /**\n * Load the device details\n */\n async loadDetails(): Promise<void> {\n console.log(`Loading device details for`, this.props.device.id, `... from ${this.props.instanceId}`);\n const details: DeviceDetails | null = await this.props.socket.sendTo(\n this.props.instanceId,\n 'dm:deviceDetails',\n this.props.device.id,\n );\n console.log(`Got device details for`, this.props.device.id, details);\n this.setState({ details, data: details?.data || {} });\n }\n\n /**\n * Refresh the device details\n */\n refresh = (): void => {\n this.setState({ details: null });\n this.loadDetails().catch(console.error);\n };\n\n /**\n * Copy the device ID to the clipboard\n */\n copyToClipboard = (): void => {\n const textToCopy = this.state.identifier;\n if (!textToCopy) {\n return;\n }\n Utils.copyToClipboard(textToCopy);\n alert(`${getTranslation('copied')} ${textToCopy} ${getTranslation('toClipboard')}!`);\n };\n\n renderDialog(): JSX.Element | null {\n if (!this.state.open || !this.state.details) {\n return null;\n }\n\n return (\n <Dialog\n open={!0}\n maxWidth=\"md\"\n onClose={() => this.setState({ open: false })}\n >\n <DialogContent>\n <JsonConfig\n instanceId={this.props.instanceId}\n socket={this.props.socket}\n schema={this.state.details.schema as ConfigItemPanel | ConfigItemTabs}\n data={this.state.data}\n onChange={(data: Record<string, any>) => this.setState({ data })}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\n theme={this.props.theme}\n isFloatComma={this.props.isFloatComma}\n dateFormat={this.props.dateFormat}\n />\n </DialogContent>\n <DialogActions>\n <Button\n disabled={!this.props.alive}\n variant=\"contained\"\n color=\"primary\"\n onClick={() => this.setState({ open: false })}\n autoFocus\n >\n {getTranslation('closeButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderControlDialog(): JSX.Element | null {\n if (!this.state.showControlDialog || !this.props.alive) {\n return null;\n }\n const colors = { primary: '#111', secondary: '#888' };\n return (\n <Dialog\n open={!0}\n onClose={() => this.setState({ showControlDialog: false })}\n >\n <DialogTitle>\n {this.state.name}\n <IconButton\n style={{\n position: 'absolute',\n top: 5,\n right: 5,\n zIndex: 10,\n }}\n onClick={() => this.setState({ showControlDialog: false })}\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n <DialogContent style={{ display: 'flex', flexDirection: 'column' }}>\n {this.props.device.controls?.map(control => (\n <DeviceControlComponent\n disabled={false}\n key={control.id}\n control={control}\n socket={this.props.socket}\n colors={colors}\n deviceId={this.props.device.id}\n controlHandler={this.props.controlHandler}\n controlStateHandler={this.props.controlStateHandler}\n />\n ))}\n </DialogContent>\n </Dialog>\n );\n }\n\n renderControls(): JSX.Element | null {\n const colors = { primary: '#111', secondary: '#888' };\n const firstControl = this.props.device.controls?.[0];\n if (\n this.props.device.controls?.length === 1 &&\n firstControl &&\n (firstControl.type === 'icon' || firstControl.type === 'switch') &&\n !firstControl.label\n ) {\n // control can be placed in the button icon\n return (\n <DeviceControlComponent\n disabled={!this.props.alive}\n control={firstControl}\n colors={colors}\n socket={this.props.socket}\n deviceId={this.props.device.id}\n controlHandler={this.props.controlHandler}\n controlStateHandler={this.props.controlStateHandler}\n />\n );\n }\n\n if (this.props.device.controls?.length) {\n // place a button and show a controls dialog\n return (\n <Fab\n size=\"small\"\n disabled={!this.props.alive}\n onClick={() => this.setState({ showControlDialog: true })}\n >\n <ControlIcon />\n </Fab>\n );\n }\n return null;\n }\n\n renderActions(): JSX.Element[] | null {\n const actions = this.props.device.actions?.filter(\n a => a.id !== ACTIONS.STATUS && a.id !== ACTIONS.ENABLE_DISABLE,\n );\n\n return actions?.length\n ? actions.map(a => (\n <DeviceActionButton\n disabled={!this.props.alive}\n key={a.id}\n deviceId={this.props.device.id}\n action={a}\n deviceHandler={this.props.deviceHandler}\n refresh={this.refresh}\n />\n ))\n : null;\n }\n\n renderSmall(): JSX.Element {\n const hasDetails = this.state.hasDetails;\n const status = !this.props.device.status\n ? []\n : Array.isArray(this.props.device.status)\n ? this.props.device.status\n : [this.props.device.status];\n\n const icon = this.state.icon ? <DeviceTypeIcon src={this.state.icon} /> : <NoImageIcon />;\n\n const headerStyle = this.getCardHeaderStyle(this.props.theme, 345);\n\n return (\n <Card sx={smallCardStyle}>\n <CardHeader\n style={headerStyle}\n avatar={\n <div>\n {this.props.uploadImagesToInstance ? (\n <DeviceImageUpload\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceId={this.props.device.id}\n manufacturer={this.state.manufacturer}\n model={this.state.model}\n onImageSelect={(imageData: string): void => {\n if (imageData) {\n this.setState({ icon: imageData });\n }\n }}\n socket={this.props.socket}\n />\n ) : null}\n {icon}\n </div>\n }\n action={\n hasDetails ? (\n <IconButton\n aria-label=\"settings\"\n onClick={() => {\n if (!this.state.open) {\n this.loadDetails().catch(console.error);\n this.setState({ open: true });\n }\n }}\n >\n <MoreVertIcon />\n </IconButton>\n ) : null\n }\n title={this.state.name}\n subheader={\n this.state.manufacturer ? (\n <span>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {this.state.manufacturer}\n </span>\n ) : null\n }\n />\n <CardContent style={{ position: 'relative' }}>\n {status?.length ? (\n <div\n style={{\n display: 'flex',\n position: 'absolute',\n top: -11,\n background: '#88888880',\n padding: '0 8px',\n borderRadius: 5,\n width: 'calc(100% - 46px)',\n }}\n >\n {status.map((s, i) => (\n <DeviceStatusComponent\n key={i}\n socket={this.props.socket}\n status={s}\n connectionType={this.state.connectionType}\n enabled={this.state.enabled}\n deviceId={this.props.device.id}\n statusAction={this.props.device.actions?.find(a => a.id === ACTIONS.STATUS)}\n disableEnableAction={this.props.device.actions?.find(\n a => a.id === ACTIONS.ENABLE_DISABLE,\n )}\n deviceHandler={this.props.deviceHandler}\n refresh={this.refresh}\n theme={this.props.theme}\n stateOrObjectHandler={this.stateOrObjectHandler}\n />\n ))}\n </div>\n ) : null}\n <div>\n <Typography variant=\"body1\">\n {this.state.identifier ? (\n <div\n onClick={this.copyToClipboard}\n style={{ textOverflow: 'ellipsis', overflow: 'hidden' }}\n >\n <b>{getText(this.props.identifierLabel)}:</b>\n <span style={{ marginLeft: 4 }}>{this.state.identifier}</span>\n </div>\n ) : null}\n {this.state.manufacturer ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {this.state.manufacturer}\n </div>\n ) : null}\n {this.state.model ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('model')}:</b>\n {this.state.model}\n </div>\n ) : null}\n </Typography>\n </div>\n </CardContent>\n <CardActions disableSpacing>\n {this.renderActions()}\n <div style={{ flexGrow: 1 }} />\n {this.renderControls()}\n </CardActions>\n {this.renderDialog()}\n {this.renderControlDialog()}\n </Card>\n );\n }\n\n getCardHeaderStyle(theme: IobTheme, maxWidth?: number): React.CSSProperties {\n const backgroundColor =\n this.state.backgroundColor === 'primary'\n ? theme.palette.primary.main\n : this.state.backgroundColor === 'secondary'\n ? theme.palette.secondary.main\n : this.state.backgroundColor || theme.palette.secondary.main;\n\n let color;\n if (this.state.color && this.state.color !== 'primary' && this.state.color !== 'secondary') {\n // Color was directly defined\n color = this.state.color;\n } else if (this.state.color === 'primary') {\n color = theme.palette.primary.main;\n } else if (this.state.color === 'secondary') {\n color = theme.palette.secondary.main;\n } else {\n // Color was not defined\n if (this.state.backgroundColor === 'primary') {\n color = theme.palette.primary.contrastText;\n } else if (this.state.backgroundColor === 'secondary' || !this.state.backgroundColor) {\n color = theme.palette.secondary.contrastText;\n } else {\n color = Utils.invertColor(backgroundColor, true);\n }\n }\n\n return {\n backgroundColor,\n color,\n maxWidth,\n };\n }\n\n renderBig(): JSX.Element {\n const status = !this.props.device.status\n ? []\n : Array.isArray(this.props.device.status)\n ? this.props.device.status\n : [this.props.device.status];\n\n const icon = this.state.icon ? (\n <DeviceTypeIcon\n src={this.state.icon}\n style={styles.imgStyle}\n />\n ) : (\n <NoImageIcon style={styles.imgStyle} />\n );\n const headerStyle = this.getCardHeaderStyle(this.props.theme);\n\n const title: string = this.state.details?.data?.name || this.props.device.name || '';\n\n return (\n <Paper\n style={styles.cardStyle}\n key={JSON.stringify(this.props.id)}\n >\n <Box\n sx={headerStyle}\n style={styles.headerStyle}\n >\n <div style={styles.imgAreaStyle}>\n {this.props.uploadImagesToInstance ? (\n <DeviceImageUpload\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceId={this.props.device.id}\n manufacturer={this.state.manufacturer}\n model={this.state.model}\n onImageSelect={(imageData: string): void => {\n if (imageData) {\n this.setState({ icon: imageData });\n }\n }}\n socket={this.props.socket}\n />\n ) : null}\n {icon}\n </div>\n <Box\n style={styles.titleStyle}\n title={title.length > 20 ? title : undefined}\n sx={theme => ({ color: headerStyle.color || theme.palette.secondary.contrastText })}\n >\n {this.state.details?.data?.name || this.state.name}\n </Box>\n {this.state.hasDetails ? (\n <Fab\n disabled={!this.props.alive}\n size=\"small\"\n style={styles.detailsButtonStyle}\n onClick={() => {\n if (!this.state.open) {\n this.loadDetails().catch(console.error);\n this.setState({ open: true });\n }\n }}\n color=\"primary\"\n >\n <MoreVertIcon />\n </Fab>\n ) : null}\n </Box>\n <div style={styles.statusStyle}>\n {status.map((s, i) => (\n <DeviceStatusComponent\n key={i}\n socket={this.props.socket}\n deviceId={this.props.device.id}\n connectionType={this.state.connectionType}\n status={s}\n enabled={this.state.enabled}\n statusAction={this.props.device.actions?.find(a => a.id === ACTIONS.STATUS)}\n disableEnableAction={this.props.device.actions?.find(a => a.id === ACTIONS.ENABLE_DISABLE)}\n deviceHandler={this.props.deviceHandler}\n refresh={this.refresh}\n theme={this.props.theme}\n stateOrObjectHandler={this.stateOrObjectHandler}\n />\n ))}\n </div>\n <div style={styles.bodyStyle}>\n <Typography\n variant=\"body1\"\n style={styles.deviceInfoStyle}\n >\n {this.state.identifier ? (\n <div onClick={this.copyToClipboard}>\n <b style={{ marginRight: 4 }}>{getText(this.props.identifierLabel)}:</b>\n {this.state.identifier}\n </div>\n ) : null}\n {this.state.manufacturer ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {this.state.manufacturer}\n </div>\n ) : null}\n {this.state.model ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('model')}:</b>\n {this.state.model}\n </div>\n ) : null}\n </Typography>\n {!!this.props.device.actions?.length && (\n <div\n style={{\n flex: 1,\n position: 'relative',\n display: 'flex',\n gap: 8,\n paddingBottom: 5,\n height: 34,\n paddingLeft: 10,\n paddingRight: 10,\n }}\n >\n {this.renderActions()}\n <div style={{ flexGrow: 1 }} />\n {this.renderControls()}\n </div>\n )}\n </div>\n {this.renderDialog()}\n {this.renderControlDialog()}\n </Paper>\n );\n }\n\n render(): JSX.Element {\n const name = this.state.name?.toLowerCase() ?? '';\n if (this.props.filter && !name.includes(this.props.filter.toLowerCase())) {\n return <></>;\n }\n\n if (this.props.smallCards) {\n return this.renderSmall();\n }\n\n return this.renderBig();\n }\n}\n\ntype DeviceCardSkeletonProps = Pick<DeviceCardProps, 'smallCards' | 'theme'>;\n\nexport class DeviceCardSkeleton extends Component<DeviceCardSkeletonProps> {\n render(): JSX.Element {\n if (this.props.smallCards) {\n return this.renderSmall();\n }\n\n return this.renderBig();\n }\n\n renderSmall(): JSX.Element {\n const headerStyle = this.getCardHeaderStyle(this.props.theme, 345);\n\n return (\n <Card sx={smallCardStyle}>\n <CardHeader\n style={headerStyle}\n avatar={\n <div>\n <Skeleton\n variant=\"rounded\"\n width={24}\n height={24}\n />\n </div>\n }\n title={<Skeleton />}\n subheader={<Skeleton />}\n />\n <CardContent style={{ position: 'relative' }}>\n <div>\n <Typography variant=\"body1\">\n <div>\n <Skeleton />\n </div>\n <div>\n <Skeleton />\n </div>\n <div>\n <Skeleton />\n </div>\n </Typography>\n </div>\n </CardContent>\n </Card>\n );\n }\n\n renderBig(): JSX.Element {\n const headerStyle = this.getCardHeaderStyle(this.props.theme);\n\n return (\n <Paper style={styles.cardStyle}>\n <Box\n sx={headerStyle}\n style={styles.headerStyle}\n >\n <div style={styles.imgAreaStyle}>\n <Skeleton\n variant=\"rounded\"\n width={24}\n height={24}\n />\n </div>\n <Box\n style={styles.titleStyle}\n sx={theme => ({\n color: headerStyle.color || theme.palette.secondary.contrastText,\n minWidth: '50%',\n })}\n >\n <Skeleton />\n </Box>\n </Box>\n <div style={styles.statusStyle}></div>\n <div style={styles.bodyStyle}>\n <Typography\n variant=\"body1\"\n style={styles.deviceInfoStyle}\n >\n <div>\n <Skeleton />\n </div>\n <div>\n <Skeleton />\n </div>\n <div>\n <Skeleton />\n </div>\n </Typography>\n </div>\n </Paper>\n );\n }\n\n // eslint-disable-next-line class-methods-use-this\n getCardHeaderStyle(theme: IobTheme, maxWidth?: number): React.CSSProperties {\n const backgroundColor = theme.palette.secondary.main;\n const color = theme.palette.secondary.contrastText;\n\n return {\n backgroundColor,\n color,\n maxWidth,\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DeviceCard.js","sourceRoot":"./src/","sources":["DeviceCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,IAAI,EACJ,KAAK,GAKR,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,cAAc,IAAI,WAAW,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClH,OAAO,EACH,GAAG,EACH,MAAM,EACN,IAAI,EACJ,WAAW,EACX,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,WAAW,EACX,GAAG,EACH,UAAU,EACV,KAAK,EACL,QAAQ,EACR,UAAU,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AACnD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,sBAAsB,MAAM,iBAAiB,CAAC;AACrD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,qBAAqB,MAAM,gBAAgB,CAAC;AACnD,OAAO,UAAU,MAAM,cAAc,CAAC;AAUtC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAkC,MAAM,wBAAwB,CAAC;AAE9F,MAAM,cAAc,GAAG;IACnB,QAAQ,EAAE,GAAG;IACb,QAAQ,EAAE,GAAG;CACP,CAAC;AAEX,mKAAmK;AACnK,MAAM,OAAO,GAAG;IACZ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,KAAK,EAAE,MAAM,CAAC,WAAW;gBAEzB,6BAAK,KAAK,EAAE,MAAM,CAAC,YAAY;oBAC3B,oBAAC,QAAQ,IACL,OAAO,EAAC,SAAS,EACjB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,GACZ,CACA;gBACN,oBAAC,GAAG,IACA,KAAK,EAAE,MAAM,CAAC,UAAU,EACxB,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;wBACV,KAAK,EAAE,WAAW,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY;wBAChE,QAAQ,EAAE,KAAK;qBAClB,CAAC;oBAEF,oBAAC,QAAQ,OAAG,CACV,CACJ;YACN,6BAAK,KAAK,EAAE,MAAM,CAAC,WAAW,GAAQ;YACtC,6BAAK,KAAK,EAAE,MAAM,CAAC,SAAS;gBACxB,oBAAC,UAAU,IACP,OAAO,EAAC,OAAO,EACf,KAAK,EAAE,MAAM,CAAC,eAAe;oBAE7B;wBACI,oBAAC,QAAQ,OAAG,CACV;oBACN;wBACI,oBAAC,QAAQ,OAAG,CACV;oBACN;wBACI,oBAAC,QAAQ,OAAG,CACV,CACG,CACX,CACF,CACX,CAAC;IACN,CAAC;IAED,kDAAkD;IAClD,kBAAkB,CAAC,KAAe,EAAE,QAAiB;QACjD,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;QACrD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC;QAEnD,OAAO;YACH,eAAe;YACf,KAAK;YACL,QAAQ;SACX,CAAC;IACN,CAAC;CACJ","sourcesContent":["import {\n DeviceTypeIcon,\n I18n,\n Utils,\n type Connection,\n type IobTheme,\n type ThemeName,\n type ThemeType,\n} from '@iobroker/adapter-react-v5';\nimport type { ConfigItemPanel, ConfigItemTabs } from '@iobroker/json-config';\nimport { Close as CloseIcon, VideogameAsset as ControlIcon, MoreVert as MoreVertIcon } from '@mui/icons-material';\nimport {\n Box,\n Button,\n Card,\n CardActions,\n CardContent,\n CardHeader,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Fab,\n IconButton,\n Paper,\n Skeleton,\n Typography,\n} from '@mui/material';\nimport React, { Component, type JSX } from 'react';\nimport DeviceActionButton from './DeviceActionButton';\nimport DeviceControlComponent from './DeviceControl';\nimport DeviceImageUpload from './DeviceImageUpload';\nimport DeviceStatusComponent from './DeviceStatus';\nimport JsonConfig from './JsonConfig';\nimport type {\n ActionBase,\n ControlBase,\n ControlState,\n DeviceDetails,\n DeviceInfo,\n DeviceId,\n ConfigConnectionType,\n} from './protocol/api';\nimport { getTranslation } from './Utils';\nimport { StateOrObjectHandler, type StateOrObjectSubscription } from './StateOrObjectHandler';\n\nconst smallCardStyle = {\n maxWidth: 345,\n minWidth: 200,\n} as const;\n\n/** Reserved action names (this is copied from https://github.com/ioBroker/dm-utils/blob/main/src/types/base.ts as we can only have type references to dm-utils) */\nconst ACTIONS = {\n /** This action will be called when the user clicks on the connection icon */\n STATUS: 'status',\n /** This action will be called when the user clicks on the enabled / disabled icon. The enabled/disabled icon will be shown only if the node status has the \"enabled\" flag set to false or true */\n ENABLE_DISABLE: 'enable/disable',\n};\n\nconst styles: Record<string, React.CSSProperties> = {\n cardStyle: {\n width: 300,\n minHeight: 280,\n margin: 10,\n overflow: 'hidden',\n display: 'inline-block',\n },\n headerStyle: {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n paddingLeft: 8,\n paddingRight: 8,\n position: 'relative',\n minHeight: 60,\n color: '#000',\n },\n imgAreaStyle: {\n height: 45,\n width: 45,\n justifyContent: 'center',\n display: 'flex',\n alignItems: 'center',\n },\n imgStyle: {\n zIndex: 2,\n maxWidth: '100%',\n maxHeight: '100%',\n color: '#FFF',\n },\n titleStyle: {\n fontSize: 16,\n fontWeight: 'bold',\n // whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n detailsButtonStyle: {\n right: 20,\n bottom: -20,\n position: 'absolute',\n },\n bodyStyle: {\n height: 'calc(100% - 116px)',\n },\n deviceInfoStyle: {\n padding: '20px 16px 0 16px',\n height: 133,\n },\n statusStyle: {\n padding: '15px 25px 0 15px',\n height: 41,\n },\n};\n\nfunction NoImageIcon(props: { style?: React.CSSProperties; className?: string }): JSX.Element {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n width=\"24\"\n height=\"24\"\n style={props.style}\n className={props.className}\n >\n <path\n fill=\"currentColor\"\n 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\"\n />\n </svg>\n );\n}\n\ninterface DeviceCardProps {\n filter?: string;\n /* Device ID */\n id: DeviceId;\n identifierLabel: ioBroker.StringOrTranslated;\n device: DeviceInfo;\n instanceId: string;\n socket: Connection;\n /* Instance, where the images should be uploaded to */\n uploadImagesToInstance?: string;\n deviceHandler: (deviceId: DeviceId, action: ActionBase) => () => void;\n controlHandler: (\n deviceId: DeviceId,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n controlStateHandler: (deviceId: DeviceId, control: ControlBase) => () => Promise<ioBroker.State | null>;\n smallCards?: boolean;\n alive: boolean;\n themeName: ThemeName;\n themeType: ThemeType;\n theme: IobTheme;\n isFloatComma: boolean;\n dateFormat: string;\n}\n\nfunction getText(text: ioBroker.StringOrTranslated | undefined): string | undefined {\n if (typeof text === 'object') {\n return text[I18n.getLanguage()] || text.en;\n }\n\n return text;\n}\n\ninterface DeviceCardState {\n open: boolean;\n details: DeviceDetails | null;\n data: Record<string, any>;\n showControlDialog: boolean;\n\n // values possibly loaded from states/objects\n name?: string;\n identifier?: string;\n hasDetails?: boolean;\n icon?: string;\n backgroundColor?: string;\n color?: string;\n manufacturer?: string;\n model?: string;\n connectionType?: ConfigConnectionType;\n enabled?: boolean;\n}\n\n/**\n * Device Card Component\n */\nexport default class DeviceCard extends Component<DeviceCardProps, DeviceCardState> {\n private readonly stateOrObjectHandler: StateOrObjectHandler;\n private readonly subscriptions: Map<\n keyof DeviceInfo & keyof DeviceCardState,\n { subscription: StateOrObjectSubscription; transform?: (value: any) => any }\n > = new Map();\n\n constructor(props: DeviceCardProps) {\n super(props);\n\n this.state = {\n open: false,\n details: null,\n data: {},\n showControlDialog: false,\n };\n\n this.stateOrObjectHandler = new StateOrObjectHandler(this.props.socket);\n }\n\n async fetchIcon(): Promise<void> {\n if (!this.props.device.icon) {\n const manufacturer = this.state.manufacturer;\n const model = this.state.model;\n\n // try to load the icon from file storage\n const fileName = `${manufacturer ? `${manufacturer}_` : ''}${model || JSON.stringify(this.props.device.id)}`;\n\n try {\n const file = await this.props.socket.readFile(\n this.props.instanceId.replace('system.adapter.', ''),\n `${fileName}.webp`,\n true,\n );\n if (file) {\n this.setState({ icon: `data:${file.mimeType};base64,${file.file}` });\n } else {\n this.setState({ icon: '' });\n }\n // const response = await fetch(url);\n // if (response.ok) {\n // const blob = await response.blob();\n // const reader = new FileReader();\n // reader.onloadend = () => {\n // setIcon(reader.result);\n // };\n // reader.readAsDataURL(blob);\n // } else {\n // throw new Error('Response not ok');\n // }\n } catch {\n if (this.state.icon) {\n this.setState({ icon: '' });\n }\n }\n }\n }\n\n async componentDidMount(): Promise<void> {\n await this.addStateOrObjectListener('name', getText);\n await this.addStateOrObjectListener('identifier');\n await this.addStateOrObjectListener('hasDetails');\n await this.addStateOrObjectListener('icon');\n await this.addStateOrObjectListener('backgroundColor');\n await this.addStateOrObjectListener('color');\n await this.addStateOrObjectListener('manufacturer', getText);\n await this.addStateOrObjectListener('model', getText);\n await this.addStateOrObjectListener('connectionType');\n await this.addStateOrObjectListener('enabled');\n\n await this.fetchIcon().catch(e => console.error(e));\n }\n\n private async addStateOrObjectListener(\n key: keyof DeviceInfo & keyof DeviceCardState,\n transform?: (value: any) => any,\n ): Promise<void> {\n const sub = await this.stateOrObjectHandler.addListener(this.props.device[key], value =>\n this.setState<typeof key>({ [key]: transform ? transform(value) : value }),\n );\n this.subscriptions.set(key, { subscription: sub, transform });\n }\n\n async componentDidUpdate(prevProps: DeviceCardProps): Promise<void> {\n for (const [key, { subscription, transform }] of [...this.subscriptions]) {\n const newItem = this.props.device[key];\n const prevItem = prevProps.device[key];\n\n if (newItem !== prevItem) {\n console.log(`${key} of device ${JSON.stringify(this.props.device.id)} updated`, prevItem, newItem);\n this.subscriptions.delete(key);\n await this.addStateOrObjectListener(key, transform);\n await subscription.unsubscribe();\n }\n }\n }\n\n async componentWillUnmount(): Promise<void> {\n for (const [, { subscription }] of this.subscriptions) {\n await subscription.unsubscribe();\n }\n this.subscriptions.clear();\n }\n\n /**\n * Load the device details\n */\n async loadDetails(): Promise<void> {\n console.log(`Loading device details for`, this.props.device.id, `... from ${this.props.instanceId}`);\n const details: DeviceDetails | null = await this.props.socket.sendTo(\n this.props.instanceId,\n 'dm:deviceDetails',\n this.props.device.id,\n );\n console.log(`Got device details for`, this.props.device.id, details);\n this.setState({ details, data: details?.data || {} });\n }\n\n /**\n * Copy the device ID to the clipboard\n */\n copyToClipboard = (): void => {\n const textToCopy = this.state.identifier;\n if (!textToCopy) {\n return;\n }\n Utils.copyToClipboard(textToCopy);\n alert(`${getTranslation('copied')} ${textToCopy} ${getTranslation('toClipboard')}!`);\n };\n\n renderDialog(): JSX.Element | null {\n if (!this.state.open || !this.state.details) {\n return null;\n }\n\n return (\n <Dialog\n open={!0}\n maxWidth=\"md\"\n onClose={() => this.setState({ open: false })}\n >\n <DialogContent>\n <JsonConfig\n instanceId={this.props.instanceId}\n socket={this.props.socket}\n schema={this.state.details.schema as ConfigItemPanel | ConfigItemTabs}\n data={this.state.data}\n onChange={(data: Record<string, any>) => this.setState({ data })}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\n theme={this.props.theme}\n isFloatComma={this.props.isFloatComma}\n dateFormat={this.props.dateFormat}\n />\n </DialogContent>\n <DialogActions>\n <Button\n disabled={!this.props.alive}\n variant=\"contained\"\n color=\"primary\"\n onClick={() => this.setState({ open: false })}\n autoFocus\n >\n {getTranslation('closeButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderControlDialog(): JSX.Element | null {\n if (!this.state.showControlDialog || !this.props.alive) {\n return null;\n }\n const colors = { primary: '#111', secondary: '#888' };\n return (\n <Dialog\n open={!0}\n onClose={() => this.setState({ showControlDialog: false })}\n >\n <DialogTitle>\n {this.state.name}\n <IconButton\n style={{\n position: 'absolute',\n top: 5,\n right: 5,\n zIndex: 10,\n }}\n onClick={() => this.setState({ showControlDialog: false })}\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n <DialogContent style={{ display: 'flex', flexDirection: 'column', overflow: 'visible' }}>\n {this.props.device.controls?.map(control => (\n <DeviceControlComponent\n disabled={false}\n key={control.id}\n control={control}\n socket={this.props.socket}\n colors={colors}\n deviceId={this.props.device.id}\n controlHandler={this.props.controlHandler}\n controlStateHandler={this.props.controlStateHandler}\n />\n ))}\n </DialogContent>\n </Dialog>\n );\n }\n\n renderControls(): JSX.Element | null {\n const colors = { primary: '#111', secondary: '#888' };\n const firstControl = this.props.device.controls?.[0];\n if (\n this.props.device.controls?.length === 1 &&\n firstControl &&\n (firstControl.type === 'icon' || firstControl.type === 'switch') &&\n !firstControl.label\n ) {\n // control can be placed in the button icon\n return (\n <DeviceControlComponent\n disabled={!this.props.alive}\n control={firstControl}\n colors={colors}\n socket={this.props.socket}\n deviceId={this.props.device.id}\n controlHandler={this.props.controlHandler}\n controlStateHandler={this.props.controlStateHandler}\n />\n );\n }\n\n if (this.props.device.controls?.length) {\n // place a button and show a controls dialog\n return (\n <Fab\n size=\"small\"\n style={{ width: 32, height: 32, minHeight: 32 }}\n disabled={!this.props.alive}\n onClick={() => this.setState({ showControlDialog: true })}\n >\n <ControlIcon />\n </Fab>\n );\n }\n return null;\n }\n\n renderActions(): JSX.Element[] | null {\n const actions = this.props.device.actions?.filter(\n a => a.id !== ACTIONS.STATUS && a.id !== ACTIONS.ENABLE_DISABLE,\n );\n\n return actions?.length\n ? actions.map(a => (\n <DeviceActionButton\n disabled={!this.props.alive}\n key={a.id}\n deviceId={this.props.device.id}\n action={a}\n deviceHandler={this.props.deviceHandler}\n />\n ))\n : null;\n }\n\n renderSmall(): JSX.Element {\n const hasDetails = this.state.hasDetails;\n const status = !this.props.device.status\n ? []\n : Array.isArray(this.props.device.status)\n ? this.props.device.status\n : [this.props.device.status];\n\n const icon = this.state.icon ? <DeviceTypeIcon src={this.state.icon} /> : <NoImageIcon />;\n\n const headerStyle = this.getCardHeaderStyle(this.props.theme, 345);\n\n return (\n <Card sx={smallCardStyle}>\n <CardHeader\n style={headerStyle}\n avatar={\n <div>\n {this.props.uploadImagesToInstance ? (\n <DeviceImageUpload\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceId={this.props.device.id}\n manufacturer={this.state.manufacturer}\n model={this.state.model}\n onImageSelect={(imageData: string): void => {\n if (imageData) {\n this.setState({ icon: imageData });\n }\n }}\n socket={this.props.socket}\n />\n ) : null}\n {icon}\n </div>\n }\n action={\n hasDetails ? (\n <IconButton\n aria-label=\"settings\"\n onClick={() => {\n if (!this.state.open) {\n this.loadDetails().catch(console.error);\n this.setState({ open: true });\n }\n }}\n >\n <MoreVertIcon />\n </IconButton>\n ) : null\n }\n title={this.state.name}\n subheader={\n this.state.manufacturer ? (\n <span>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {this.state.manufacturer}\n </span>\n ) : null\n }\n />\n <CardContent style={{ position: 'relative' }}>\n {status?.length ? (\n <div\n style={{\n display: 'flex',\n position: 'absolute',\n top: -11,\n background: '#88888880',\n padding: '0 8px',\n borderRadius: 5,\n width: 'calc(100% - 46px)',\n }}\n >\n {status.map((s, i) => (\n <DeviceStatusComponent\n key={i}\n socket={this.props.socket}\n status={s}\n connectionType={this.state.connectionType}\n enabled={this.state.enabled}\n deviceId={this.props.device.id}\n statusAction={this.props.device.actions?.find(a => a.id === ACTIONS.STATUS)}\n disableEnableAction={this.props.device.actions?.find(\n a => a.id === ACTIONS.ENABLE_DISABLE,\n )}\n deviceHandler={this.props.deviceHandler}\n theme={this.props.theme}\n stateOrObjectHandler={this.stateOrObjectHandler}\n />\n ))}\n </div>\n ) : null}\n <div>\n <Typography variant=\"body1\">\n {this.state.identifier ? (\n <div\n onClick={this.copyToClipboard}\n style={{ textOverflow: 'ellipsis', overflow: 'hidden' }}\n >\n <b>{getText(this.props.identifierLabel)}:</b>\n <span style={{ marginLeft: 4 }}>{this.state.identifier}</span>\n </div>\n ) : null}\n {this.state.manufacturer ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {this.state.manufacturer}\n </div>\n ) : null}\n {this.state.model ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('model')}:</b>\n {this.state.model}\n </div>\n ) : null}\n </Typography>\n </div>\n </CardContent>\n <CardActions disableSpacing>\n {this.renderActions()}\n <div style={{ flexGrow: 1 }} />\n {this.renderControls()}\n </CardActions>\n {this.renderDialog()}\n {this.renderControlDialog()}\n </Card>\n );\n }\n\n getCardHeaderStyle(theme: IobTheme, maxWidth?: number): React.CSSProperties {\n const backgroundColor =\n this.state.backgroundColor === 'primary'\n ? theme.palette.primary.main\n : this.state.backgroundColor === 'secondary'\n ? theme.palette.secondary.main\n : this.state.backgroundColor || theme.palette.secondary.main;\n\n let color;\n if (this.state.color && this.state.color !== 'primary' && this.state.color !== 'secondary') {\n // Color was directly defined\n color = this.state.color;\n } else if (this.state.color === 'primary') {\n color = theme.palette.primary.main;\n } else if (this.state.color === 'secondary') {\n color = theme.palette.secondary.main;\n } else {\n // Color was not defined\n if (this.state.backgroundColor === 'primary') {\n color = theme.palette.primary.contrastText;\n } else if (this.state.backgroundColor === 'secondary' || !this.state.backgroundColor) {\n color = theme.palette.secondary.contrastText;\n } else {\n color = Utils.invertColor(backgroundColor, true);\n }\n }\n\n return {\n backgroundColor,\n color,\n maxWidth,\n };\n }\n\n renderBig(): JSX.Element {\n const status = !this.props.device.status\n ? []\n : Array.isArray(this.props.device.status)\n ? this.props.device.status\n : [this.props.device.status];\n\n const icon = this.state.icon ? (\n <DeviceTypeIcon\n src={this.state.icon}\n style={styles.imgStyle}\n />\n ) : (\n <NoImageIcon style={styles.imgStyle} />\n );\n const headerStyle = this.getCardHeaderStyle(this.props.theme);\n\n const title: string = this.state.details?.data?.name || this.props.device.name || '';\n\n return (\n <Paper\n style={styles.cardStyle}\n key={JSON.stringify(this.props.id)}\n >\n <Box\n sx={headerStyle}\n style={styles.headerStyle}\n >\n <div style={styles.imgAreaStyle}>\n {this.props.uploadImagesToInstance ? (\n <DeviceImageUpload\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceId={this.props.device.id}\n manufacturer={this.state.manufacturer}\n model={this.state.model}\n onImageSelect={(imageData: string): void => {\n if (imageData) {\n this.setState({ icon: imageData });\n }\n }}\n socket={this.props.socket}\n />\n ) : null}\n {icon}\n </div>\n <Box\n style={styles.titleStyle}\n title={title.length > 20 ? title : undefined}\n sx={theme => ({ color: headerStyle.color || theme.palette.secondary.contrastText })}\n >\n {this.state.details?.data?.name || this.state.name}\n </Box>\n {this.state.hasDetails ? (\n <Fab\n disabled={!this.props.alive}\n size=\"small\"\n style={styles.detailsButtonStyle}\n onClick={() => {\n if (!this.state.open) {\n this.loadDetails().catch(console.error);\n this.setState({ open: true });\n }\n }}\n color=\"primary\"\n >\n <MoreVertIcon />\n </Fab>\n ) : null}\n </Box>\n <div style={styles.statusStyle}>\n {status.map((s, i) => (\n <DeviceStatusComponent\n key={i}\n socket={this.props.socket}\n deviceId={this.props.device.id}\n connectionType={this.state.connectionType}\n status={s}\n enabled={this.state.enabled}\n statusAction={this.props.device.actions?.find(a => a.id === ACTIONS.STATUS)}\n disableEnableAction={this.props.device.actions?.find(a => a.id === ACTIONS.ENABLE_DISABLE)}\n deviceHandler={this.props.deviceHandler}\n theme={this.props.theme}\n stateOrObjectHandler={this.stateOrObjectHandler}\n />\n ))}\n </div>\n <div style={styles.bodyStyle}>\n <Typography\n variant=\"body1\"\n style={styles.deviceInfoStyle}\n >\n {this.state.identifier ? (\n <div onClick={this.copyToClipboard}>\n <b style={{ marginRight: 4 }}>{getText(this.props.identifierLabel)}:</b>\n {this.state.identifier}\n </div>\n ) : null}\n {this.state.manufacturer ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {this.state.manufacturer}\n </div>\n ) : null}\n {this.state.model ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('model')}:</b>\n {this.state.model}\n </div>\n ) : null}\n </Typography>\n {!!(this.props.device.actions?.length || this.props.device.controls?.length) && (\n <div\n style={{\n flex: 1,\n position: 'relative',\n display: 'flex',\n gap: 8,\n paddingBottom: 5,\n height: 34,\n paddingLeft: 10,\n paddingRight: 10,\n }}\n >\n {this.renderActions()}\n <div style={{ flexGrow: 1 }} />\n {this.renderControls()}\n </div>\n )}\n </div>\n {this.renderDialog()}\n {this.renderControlDialog()}\n </Paper>\n );\n }\n\n render(): JSX.Element {\n const name = this.state.name?.toLowerCase() ?? '';\n if (this.props.filter && !name.includes(this.props.filter.toLowerCase())) {\n return <></>;\n }\n\n if (this.props.smallCards) {\n return this.renderSmall();\n }\n\n return this.renderBig();\n }\n}\n\ntype DeviceCardSkeletonProps = Pick<DeviceCardProps, 'smallCards' | 'theme'>;\n\nexport class DeviceCardSkeleton extends Component<DeviceCardSkeletonProps> {\n render(): JSX.Element {\n if (this.props.smallCards) {\n return this.renderSmall();\n }\n\n return this.renderBig();\n }\n\n renderSmall(): JSX.Element {\n const headerStyle = this.getCardHeaderStyle(this.props.theme, 345);\n\n return (\n <Card sx={smallCardStyle}>\n <CardHeader\n style={headerStyle}\n avatar={\n <div>\n <Skeleton\n variant=\"rounded\"\n width={24}\n height={24}\n />\n </div>\n }\n title={<Skeleton />}\n subheader={<Skeleton />}\n />\n <CardContent style={{ position: 'relative' }}>\n <div>\n <Typography variant=\"body1\">\n <div>\n <Skeleton />\n </div>\n <div>\n <Skeleton />\n </div>\n <div>\n <Skeleton />\n </div>\n </Typography>\n </div>\n </CardContent>\n </Card>\n );\n }\n\n renderBig(): JSX.Element {\n const headerStyle = this.getCardHeaderStyle(this.props.theme);\n\n return (\n <Paper style={styles.cardStyle}>\n <Box\n sx={headerStyle}\n style={styles.headerStyle}\n >\n <div style={styles.imgAreaStyle}>\n <Skeleton\n variant=\"rounded\"\n width={24}\n height={24}\n />\n </div>\n <Box\n style={styles.titleStyle}\n sx={theme => ({\n color: headerStyle.color || theme.palette.secondary.contrastText,\n minWidth: '50%',\n })}\n >\n <Skeleton />\n </Box>\n </Box>\n <div style={styles.statusStyle}></div>\n <div style={styles.bodyStyle}>\n <Typography\n variant=\"body1\"\n style={styles.deviceInfoStyle}\n >\n <div>\n <Skeleton />\n </div>\n <div>\n <Skeleton />\n </div>\n <div>\n <Skeleton />\n </div>\n </Typography>\n </div>\n </Paper>\n );\n }\n\n // eslint-disable-next-line class-methods-use-this\n getCardHeaderStyle(theme: IobTheme, maxWidth?: number): React.CSSProperties {\n const backgroundColor = theme.palette.secondary.main;\n const color = theme.palette.secondary.contrastText;\n\n return {\n backgroundColor,\n color,\n maxWidth,\n };\n }\n}\n"]}
|
package/build/DeviceControl.js
CHANGED
|
@@ -60,8 +60,8 @@ export default class DeviceControlComponent extends Component {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
const min = this.props.control.min
|
|
64
|
-
const max = this.props.control.max
|
|
63
|
+
const min = this.props.control.min ?? 0;
|
|
64
|
+
const max = this.props.control.max ?? 100;
|
|
65
65
|
this.setState({
|
|
66
66
|
min,
|
|
67
67
|
max,
|
|
@@ -202,12 +202,13 @@ export default class DeviceControlComponent extends Component {
|
|
|
202
202
|
if (this.state.min === undefined || this.state.max === undefined) {
|
|
203
203
|
return React.createElement("div", { style: { width: '100%' } }, "...");
|
|
204
204
|
}
|
|
205
|
-
return (React.createElement(
|
|
206
|
-
this.props.control.label ? (React.createElement(InputLabel, { style: { color: this.props.control.color } }, getTranslation(this.props.control.label))) : null,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
205
|
+
return (React.createElement("div", { style: { width: '100%', minWidth: 300, paddingTop: 24, marginBottom: 8, overflow: 'visible' } },
|
|
206
|
+
this.props.control.label ? (React.createElement(InputLabel, { style: { color: this.props.control.color, marginBottom: 4 } }, getTranslation(this.props.control.label))) : null,
|
|
207
|
+
React.createElement(Stack, { spacing: 2, direction: "row", sx: { alignItems: 'center', width: '100%' } },
|
|
208
|
+
this.props.control.icon ? (React.createElement(Icon, { style: { color: this.props.control.color }, src: this.props.control.icon })) : null,
|
|
209
|
+
React.createElement(Slider, { value: parseFloat(this.state.value || '0'), min: this.state.min, max: this.state.max, step: this.state.step, valueLabelDisplay: "auto", onChange: (_e, value) => this.sendControl(this.props.deviceId, this.props.control, value) }),
|
|
210
|
+
this.props.control.iconOn ? (React.createElement(Icon, { style: { color: this.props.control.colorOn }, src: this.props.control.iconOn })) : null,
|
|
211
|
+
this.props.control.labelOn ? (React.createElement(InputLabel, { style: { color: this.props.control.colorOn } }, getTranslation(this.props.control.labelOn))) : null)));
|
|
211
212
|
}
|
|
212
213
|
renderColor() {
|
|
213
214
|
return (React.createElement(TextField, { fullWidth: true, label: this.props.control.label ? getTranslation(this.props.control.label) : undefined, type: "color", value: this.state.value, onChange: (e) => this.sendControl(this.props.deviceId, this.props.control, e.target.value), variant: "standard" }));
|