@iobroker/dm-gui-components 7.2.6 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/Communication.js +1 -2
- package/build/Communication.js.map +1 -1
- package/build/DeviceCard.js.map +1 -1
- package/build/DeviceControl.js.map +1 -1
- package/build/DeviceImageUpload.js +1 -1
- package/build/DeviceImageUpload.js.map +1 -1
- package/build/DeviceList.js +2 -2
- package/build/DeviceList.js.map +1 -1
- package/build/DeviceStatus.js.map +1 -1
- package/build/JsonConfig.js.map +1 -1
- package/build/TooltipButton.js.map +1 -1
- package/build/Utils.js.map +1 -1
- package/package.json +5 -12
package/build/Communication.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Backdrop, Box, Button, Checkbox, CircularProgress, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, FormControl, FormControlLabel, Grid2, IconButton, Input, InputAdornment, InputLabel, LinearProgress, MenuItem, Select, Slider, Snackbar, TextField, Typography, } from '@mui/material';
|
|
3
3
|
import { Close, Check } from '@mui/icons-material';
|
|
4
|
-
import {} from '@iobroker/json-config';
|
|
5
4
|
import { getTranslation } from './Utils';
|
|
6
5
|
import JsonConfig from './JsonConfig';
|
|
7
6
|
/**
|
|
@@ -215,7 +214,7 @@ class Communication extends Component {
|
|
|
215
214
|
React.createElement(Button, { variant: "contained", color: "grey", onClick: () => this.state.confirm?.handleClose(false), autoFocus: true }, getTranslation('noButtonText')))));
|
|
216
215
|
}
|
|
217
216
|
renderSnackbar() {
|
|
218
|
-
return (React.createElement(Snackbar, { open: !!this.state.showToast, autoHideDuration:
|
|
217
|
+
return (React.createElement(Snackbar, { open: !!this.state.showToast, autoHideDuration: 6000, onClose: () => this.setState({ showToast: null }), message: this.state.showToast }));
|
|
219
218
|
}
|
|
220
219
|
renderFormDialog() {
|
|
221
220
|
if (!this.state.form || !this.state.form.schema || !this.state.form.data) {
|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,SAAS,CAAC,EAAE;oCACtB,KAAK,EACD,SAAS,CAAC,WAAW,EAAE,IAAI,KAAK,UAAU;wCACtC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU;wCACzB,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,KAAK,QAAQ;4CACxC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,UAAoB,CAAC,IAAI,CAAC;4CAClD,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU;iCACpC,CAAC,CAAC;4BACP,CAAC;wBACL,CAAC,CAAC,CAAC;oBACP,CAAC,EACD,SAAS,EAAE,oBAAC,KAAK,OAAG,IAEnB,cAAc,CAAC,eAAe,CAAC,CAC3B;gBACT,oBAAC,MAAM,IACH,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,MAAM,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EACjD,SAAS,EAAE,oBAAC,KAAK,OAAG,IAEnB,cAAc,CAAC,kBAAkB,CAAC,CAC9B,CACG,CACX,CACZ,CAAC;IACN,CAAC;IAED,MAAM;QACF,OAAO,CACH;YACK,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,aAAa,EAAE;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;YAC3B,IAAI,CAAC,wBAAwB,EAAE;YAC/B,IAAI,CAAC,iBAAiB,EAAE,CAC1B,CACN,CAAC;IACN,CAAC;CACJ;AAED,eAAe,aAAa,CAAC","sourcesContent":["import React, { Component } from 'react';\n\nimport {\n Backdrop,\n Box,\n Button,\n Checkbox,\n CircularProgress,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n FormControl,\n FormControlLabel,\n Grid2,\n IconButton,\n Input,\n InputAdornment,\n InputLabel,\n LinearProgress,\n MenuItem,\n Select,\n Slider,\n Snackbar,\n TextField,\n Typography,\n} from '@mui/material';\n\nimport { Close, Check } from '@mui/icons-material';\n\nimport type { Connection, AdminConnection, ThemeName, ThemeType, IobTheme } from '@iobroker/adapter-react-v5';\nimport { type ConfigItemPanel } from '@iobroker/json-config';\nimport type {\n ActionBase,\n ControlBase,\n ControlState,\n DeviceInfo,\n DeviceRefresh,\n InstanceDetails,\n} from '@iobroker/dm-utils';\n\nimport { getTranslation } from './Utils';\nimport JsonConfig from './JsonConfig';\n\ndeclare module '@mui/material/Button' {\n interface ButtonPropsColorOverrides {\n grey: true;\n }\n}\n\nexport type CommunicationProps = {\n /** Socket connection */\n socket: Connection;\n /** Instance to communicate with device-manager backend, like `adapterName.X` */\n selectedInstance: string; // adapterName.X\n registerHandler?: (handler: null | ((command: string) => void)) => void;\n themeName: ThemeName;\n themeType: ThemeType;\n theme: IobTheme;\n isFloatComma: boolean;\n dateFormat: string;\n};\n\ninterface CommunicationForm {\n title?: string | null | undefined;\n schema?: ConfigItemPanel;\n data?: Record<string, any>;\n handleClose?: (data?: Record<string, any>) => void;\n}\n\ninterface InputAction extends ActionBase {\n /** If it is a device action */\n deviceId?: string;\n /** Optional refresh function to execute */\n refresh?: () => void;\n}\n\nexport type CommunicationState = {\n showSpinner: boolean;\n showToast: string | null;\n message: {\n message: string;\n handleClose: () => void;\n } | null;\n confirm: {\n message: string;\n handleClose: (confirmation?: boolean) => void;\n } | null;\n form: CommunicationForm | null;\n progress: {\n open: boolean;\n progress: number;\n } | null;\n showConfirmation: InputAction | null;\n showInput: InputAction | null;\n inputValue: string | boolean | number | null;\n};\n\ninterface DmResponse {\n /* Type of message */\n type: 'message' | 'confirm' | 'progress' | 'result' | 'form';\n /* Origin */\n origin: string;\n}\n\ninterface DmControlResponse extends DmResponse {\n result: {\n error?: {\n code: number;\n message: string;\n };\n state?: ioBroker.State;\n deviceId: string;\n controlId: string;\n };\n}\n\ninterface Message {\n actionId?: string;\n deviceId?: string;\n value?: unknown;\n origin?: string;\n confirm?: boolean;\n data?: any;\n}\n\ninterface DmActionResponse extends DmResponse {\n result: {\n refresh?: DeviceRefresh;\n error?: {\n code: number;\n message: string;\n };\n };\n message?: string;\n confirm?: string;\n form?: any;\n progress?: {\n open: boolean;\n progress: number;\n };\n}\n\n/**\n * Device List Component\n */\nclass Communication<P extends CommunicationProps, S extends CommunicationState> extends Component<P, S> {\n // eslint-disable-next-line react/no-unused-class-component-methods\n instanceHandler: (action: ActionBase) => () => void;\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n deviceHandler: (deviceId: string, action: ActionBase, refresh: () => void) => () => void;\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n controlHandler: (\n deviceId: string,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n controlStateHandler: (deviceId: string, control: ControlBase) => () => Promise<ioBroker.State | null>;\n\n constructor(props: P) {\n super(props);\n\n this.state = {\n showSpinner: false,\n showToast: null,\n message: null,\n confirm: null,\n form: null,\n progress: null,\n showConfirmation: null,\n showInput: null,\n inputValue: null,\n } as S;\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n this.instanceHandler = action => () => {\n if (action.confirmation) {\n this.setState({ showConfirmation: action });\n return;\n }\n if (action.inputBefore) {\n this.setState({ showInput: action });\n return;\n }\n\n this.sendActionToInstance('dm:instanceAction', { actionId: action.id });\n };\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n this.deviceHandler = (deviceId, action, refresh) => () => {\n if (action.confirmation) {\n this.setState({ showConfirmation: { ...action, deviceId, refresh } });\n return;\n }\n if (action.inputBefore) {\n this.setState({\n showInput: { ...action, deviceId, refresh },\n inputValue: action.inputBefore.defaultValue || '',\n });\n return;\n }\n\n this.sendActionToInstance('dm:deviceAction', { deviceId, actionId: action.id }, refresh);\n };\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n this.controlHandler = (deviceId, control, state) => () =>\n this.sendControlToInstance('dm:deviceControl', { deviceId, controlId: control.id, state });\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n this.controlStateHandler = (deviceId, control) => () =>\n this.sendControlToInstance('dm:deviceControlState', { deviceId, controlId: control.id });\n\n if (this.props.registerHandler) {\n this.props.registerHandler(() => this.loadData());\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n loadData(): void {\n console.error('loadData not implemented');\n }\n\n sendActionToInstance = (command: `dm:${string}`, messageToSend: Message, refresh?: () => void): void => {\n const send = async (): Promise<void> => {\n this.setState({ showSpinner: true });\n const response: DmActionResponse = await this.props.socket.sendTo(\n this.props.selectedInstance,\n command,\n messageToSend,\n );\n\n const type: string = response.type;\n console.log(`Response: ${response.type}`);\n switch (type) {\n case 'message':\n console.log(`Message received: ${response.message}`);\n if (response.message) {\n this.setState({\n message: {\n message: response.message,\n handleClose: () =>\n this.setState({ message: null }, () =>\n this.sendActionToInstance(\n 'dm:actionProgress',\n { origin: response.origin },\n refresh,\n ),\n ),\n },\n });\n }\n break;\n\n case 'confirm':\n console.log(`Confirm received: ${response.confirm}`);\n if (response.confirm) {\n this.setState({\n confirm: {\n message: response.confirm,\n handleClose: (confirm?: boolean) =>\n this.setState({ confirm: null }, () =>\n this.sendActionToInstance(\n 'dm:actionProgress',\n {\n origin: response.origin,\n confirm,\n },\n refresh,\n ),\n ),\n },\n });\n }\n break;\n\n case 'form':\n console.log('Form received');\n if (response.form) {\n this.setState({\n form: {\n ...response.form,\n handleClose: (data: any) =>\n this.setState({ form: null }, () => {\n console.log(`Form ${JSON.stringify(data)}`);\n this.sendActionToInstance(\n 'dm:actionProgress',\n {\n origin: response.origin,\n data,\n },\n refresh,\n );\n }),\n },\n });\n }\n break;\n\n case 'progress':\n if (response.progress) {\n if (this.state.progress) {\n const progress = { ...this.state.progress, ...response.progress };\n this.setState({ progress });\n } else {\n this.setState({ progress: response.progress });\n }\n }\n this.sendActionToInstance('dm:actionProgress', { origin: response.origin }, refresh);\n break;\n\n case 'result':\n console.log('Response content', response.result);\n if (response.result.refresh) {\n if (response.result.refresh === true) {\n console.log('Refreshing all');\n this.loadData();\n } else if (response.result.refresh === 'instance') {\n console.log(`Refreshing instance infos: ${this.props.selectedInstance}`);\n } else if (response.result.refresh === 'device') {\n if (!refresh) {\n console.log('No refresh function provided to refresh \"device\"');\n } else {\n console.log(`Refreshing device infos: ${this.props.selectedInstance}`);\n refresh();\n }\n } else {\n console.log('Not refreshing anything');\n }\n }\n if (response.result.error) {\n console.error(`Error: ${response.result.error.message}`);\n this.setState({ showToast: response.result.error.message });\n }\n this.setState({ showSpinner: false });\n break;\n\n default:\n console.log(`Unknown response type: ${type}`);\n this.setState({ showSpinner: false });\n break;\n }\n };\n\n void send().catch(console.error);\n };\n\n sendControlToInstance = async (\n command: string,\n messageToSend: { deviceId: string; controlId: string; state?: ControlState },\n ): Promise<null | ioBroker.State> => {\n const response: DmControlResponse = await this.props.socket.sendTo(\n this.props.selectedInstance,\n command,\n messageToSend,\n );\n const type = response.type;\n console.log(`Response: ${response.type}`);\n if (response.type === 'result') {\n console.log('Response content', response.result);\n if (response.result.error) {\n console.error(`Error: ${response.result.error.message}`);\n this.setState({ showToast: response.result.error.message });\n } else if (response.result.state !== undefined) {\n return response.result.state;\n }\n } else {\n console.warn('Unexpected response type', type);\n }\n\n return null;\n };\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n loadDevices(): Promise<DeviceInfo[]> {\n return this.props.socket.sendTo(this.props.selectedInstance, 'dm:listDevices');\n }\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n loadInstanceInfos(): Promise<InstanceDetails> {\n return this.props.socket.sendTo(this.props.selectedInstance, 'dm:instanceInfo');\n }\n\n renderMessageDialog(): React.JSX.Element | null {\n if (!this.state.message) {\n return null;\n }\n\n return (\n <Dialog\n open={!0}\n onClose={() => this.state.message?.handleClose()}\n hideBackdrop\n aria-describedby=\"message-dialog-description\"\n >\n <DialogContent>\n <DialogContentText id=\"message-dialog-description\">{this.state.message?.message}</DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button\n color=\"primary\"\n onClick={() => this.state.message?.handleClose()}\n variant=\"contained\"\n autoFocus\n >\n {getTranslation('okButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderConfirmDialog(): React.JSX.Element | null {\n if (!this.state.confirm) {\n return null;\n }\n\n return (\n <Dialog\n open={!0}\n onClose={() => this.state.confirm?.handleClose()}\n hideBackdrop\n aria-describedby=\"confirm-dialog-description\"\n >\n <DialogContent>\n <DialogContentText id=\"confirm-dialog-description\">\n {getTranslation(this.state.confirm?.message)}\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={() => this.state.confirm?.handleClose(true)}\n autoFocus\n >\n {getTranslation('yesButtonText')}\n </Button>\n <Button\n variant=\"contained\"\n color=\"grey\"\n onClick={() => this.state.confirm?.handleClose(false)}\n autoFocus\n >\n {getTranslation('noButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderSnackbar(): React.JSX.Element {\n return (\n <Snackbar\n open={!!this.state.showToast}\n autoHideDuration={6_000}\n onClose={() => this.setState({ showToast: null })}\n message={this.state.showToast}\n />\n );\n }\n\n renderFormDialog(): React.JSX.Element | null {\n if (!this.state.form || !this.state.form.schema || !this.state.form.data) {\n return null;\n }\n return (\n <Dialog\n open={!0}\n onClose={() => this.state.form?.handleClose && this.state.form.handleClose()}\n hideBackdrop\n >\n {this.state.form?.title ? <DialogTitle>{getTranslation(this.state.form?.title)}</DialogTitle> : null}\n <DialogContent>\n <JsonConfig\n instanceId={this.props.selectedInstance}\n schema={this.state.form.schema}\n data={this.state.form.data}\n socket={this.props.socket as AdminConnection}\n onChange={(data: Record<string, any>) => {\n console.log('handleFormChange', { data });\n const form: CommunicationForm | null | undefined = { ...this.state.form };\n if (form) {\n form.data = data;\n this.setState({ form });\n }\n }}\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 variant=\"contained\"\n color=\"primary\"\n onClick={() =>\n this.state.form?.handleClose && this.state.form.handleClose(this.state.form?.data)\n }\n autoFocus\n >\n {getTranslation('okButtonText')}\n </Button>\n <Button\n variant=\"contained\"\n color=\"grey\"\n onClick={() => this.state.form?.handleClose && this.state.form.handleClose()}\n >\n {getTranslation('cancelButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderProgressDialog(): React.JSX.Element | null {\n if (!this.state.progress?.open) {\n return null;\n }\n\n return (\n <Dialog\n open={!0}\n onClose={() => {}}\n hideBackdrop\n >\n <LinearProgress\n variant=\"determinate\"\n value={this.state.progress?.progress || 0}\n />\n </Dialog>\n );\n }\n\n // eslint-disable-next-line class-methods-use-this\n renderContent(): React.JSX.Element | React.JSX.Element[] | null {\n return null;\n }\n\n renderSpinner(): React.JSX.Element | null {\n if (\n !this.state.showSpinner &&\n !this.state.progress?.open &&\n !this.state.message &&\n !this.state.confirm &&\n !this.state.form\n ) {\n return null;\n }\n return (\n <Backdrop\n style={{ zIndex: 1000 }}\n open={!0}\n >\n <CircularProgress />\n </Backdrop>\n );\n }\n\n renderConfirmationDialog(): React.JSX.Element | null {\n if (!this.state.showConfirmation) {\n return null;\n }\n return (\n <Dialog\n open={!0}\n onClose={() => this.setState({ showConfirmation: null })}\n >\n <DialogTitle>\n {getTranslation(\n this.state.showConfirmation.confirmation === true\n ? getTranslation('areYouSureText')\n : getTranslation(this.state.showConfirmation.confirmation as ioBroker.StringOrTranslated),\n )}\n </DialogTitle>\n <DialogActions>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={() => {\n if (!this.state.showConfirmation) {\n return;\n }\n\n const showConfirmation = this.state.showConfirmation;\n this.setState({ showConfirmation: null }, () => {\n if (showConfirmation.deviceId) {\n this.sendActionToInstance(\n 'dm:deviceAction',\n { actionId: showConfirmation.id, deviceId: showConfirmation.deviceId },\n showConfirmation.refresh,\n );\n } else {\n this.sendActionToInstance('dm:instanceAction', { actionId: showConfirmation.id });\n }\n });\n }}\n autoFocus\n startIcon={<Check />}\n >\n {getTranslation('yesButtonText')}\n </Button>\n <Button\n variant=\"contained\"\n color=\"grey\"\n onClick={() => this.setState({ showConfirmation: null })}\n startIcon={<Close />}\n >\n {getTranslation('cancelButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderInputDialog(): React.JSX.Element | null {\n if (!this.state.showInput || !this.state.showInput.inputBefore) {\n return null;\n }\n let okDisabled = false;\n if (!this.state.showInput.inputBefore.allowEmptyValue && this.state.showInput.inputBefore.type !== 'checkbox') {\n if (\n this.state.showInput.inputBefore.type === 'number' ||\n this.state.showInput.inputBefore.type === 'slider'\n ) {\n okDisabled =\n this.state.inputValue === '' ||\n this.state.inputValue === null ||\n !window.isFinite(this.state.inputValue as number);\n } else {\n okDisabled = !this.state.inputValue;\n }\n }\n\n return (\n <Dialog\n open={!0}\n onClose={() => this.setState({ showInput: null })}\n >\n <DialogTitle>{getTranslation('pleaseEnterValueText')}</DialogTitle>\n <DialogContent>\n {this.state.showInput.inputBefore.type === 'text' ||\n this.state.showInput.inputBefore.type === 'number' ||\n !this.state.showInput.inputBefore.type ? (\n <TextField\n autoFocus\n margin=\"dense\"\n label={getTranslation(this.state.showInput.inputBefore.label)}\n slotProps={{\n htmlInput:\n this.state.showInput.inputBefore.type === 'number'\n ? {\n min: this.state.showInput.inputBefore.min,\n max: this.state.showInput.inputBefore.max,\n step: this.state.showInput.inputBefore.step,\n }\n : undefined,\n input: {\n endAdornment: this.state.inputValue ? (\n <InputAdornment position=\"end\">\n <IconButton\n size=\"small\"\n onClick={() => this.setState({ inputValue: '' })}\n >\n <Close />\n </IconButton>\n </InputAdornment>\n ) : null,\n },\n }}\n type={this.state.showInput.inputBefore.type === 'number' ? 'number' : 'text'}\n fullWidth\n value={this.state.inputValue}\n onChange={e => this.setState({ inputValue: e.target.value })}\n />\n ) : null}\n {this.state.showInput.inputBefore.type === 'checkbox' ? (\n <FormControlLabel\n control={\n <Checkbox\n checked={!!this.state.inputValue}\n autoFocus\n onChange={e => this.setState({ inputValue: e.target.checked })}\n />\n }\n label={getTranslation(this.state.showInput.inputBefore.label)}\n />\n ) : null}\n {this.state.showInput.inputBefore.type === 'select' ? (\n <FormControl fullWidth>\n <InputLabel>{getTranslation(this.state.showInput.inputBefore.label)}</InputLabel>\n <Select\n variant=\"standard\"\n value={this.state.inputValue}\n onChange={e => this.setState({ inputValue: e.target.value })}\n >\n {this.state.showInput.inputBefore.options?.map(item => (\n <MenuItem\n key={item.value}\n value={item.value}\n >\n {getTranslation(item.label)}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n ) : null}\n {this.state.showInput.inputBefore.type === 'slider' ? (\n <Box sx={{ width: '100%' }}>\n <Typography gutterBottom>\n {getTranslation(this.state.showInput.inputBefore.label)}\n </Typography>\n <Grid2\n container\n spacing={2}\n alignItems=\"center\"\n >\n <Grid2>\n <Slider\n value={typeof this.state.inputValue === 'number' ? this.state.inputValue : 0}\n onChange={(event: Event, newValue: number) =>\n this.setState({ inputValue: newValue })\n }\n />\n </Grid2>\n <Grid2>\n <Input\n value={this.state.inputValue}\n size=\"small\"\n onChange={e =>\n this.setState({\n inputValue: e.target.value === '' ? 0 : Number(e.target.value),\n })\n }\n onBlur={() => {\n if (!this.state.showInput) {\n return;\n }\n\n const min =\n this.state.showInput.inputBefore?.min === undefined\n ? 0\n : this.state.showInput.inputBefore.min;\n const max =\n this.state.showInput.inputBefore?.max === undefined\n ? 100\n : this.state.showInput.inputBefore.max;\n\n if ((this.state.inputValue as number) < min) {\n this.setState({ inputValue: min });\n } else if ((this.state.inputValue as number) > max) {\n this.setState({ inputValue: max });\n }\n }}\n inputProps={{\n step: this.state.showInput.inputBefore.step,\n min:\n this.state.showInput.inputBefore.min === undefined\n ? 0\n : this.state.showInput.inputBefore.min,\n max:\n this.state.showInput.inputBefore.max === undefined\n ? 100\n : this.state.showInput.inputBefore.max,\n type: 'number',\n }}\n />\n </Grid2>\n </Grid2>\n </Box>\n ) : null}\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n disabled={okDisabled}\n color=\"primary\"\n onClick={() => {\n if (!this.state.showInput) {\n return;\n }\n\n const showInput = this.state.showInput;\n this.setState({ showInput: null }, () => {\n if (showInput.deviceId) {\n this.sendActionToInstance(\n 'dm:deviceAction',\n {\n actionId: showInput.id,\n deviceId: showInput.deviceId,\n value:\n showInput.inputBefore?.type === 'checkbox'\n ? !!this.state.inputValue\n : showInput.inputBefore?.type === 'number'\n ? parseFloat(this.state.inputValue as string) || 0\n : this.state.inputValue,\n },\n showInput.refresh,\n );\n } else {\n this.sendActionToInstance('dm:instanceAction', {\n actionId: showInput.id,\n value:\n showInput.inputBefore?.type === 'checkbox'\n ? !!this.state.inputValue\n : showInput.inputBefore?.type === 'number'\n ? parseFloat(this.state.inputValue as string) || 0\n : this.state.inputValue,\n });\n }\n });\n }}\n startIcon={<Check />}\n >\n {getTranslation('yesButtonText')}\n </Button>\n <Button\n variant=\"contained\"\n color=\"grey\"\n onClick={() => this.setState({ showInput: null })}\n startIcon={<Close />}\n >\n {getTranslation('cancelButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n render(): React.JSX.Element {\n return (\n <>\n {this.renderSnackbar()}\n {this.renderContent()}\n {this.renderSpinner()}\n {this.renderConfirmDialog()}\n {this.renderMessageDialog()}\n {this.renderFormDialog()}\n {this.renderProgressDialog()}\n {this.renderConfirmationDialog()}\n {this.renderInputDialog()}\n </>\n );\n }\n}\n\nexport default Communication;\n"]}
|
|
1
|
+
{"version":3,"file":"Communication.js","sourceRoot":"./src/","sources":["Communication.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EA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,CACG,CACX,CACZ,CAAC;IACN,CAAC;IAED,MAAM;QACF,OAAO,CACH;YACK,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,aAAa,EAAE;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;YAC3B,IAAI,CAAC,wBAAwB,EAAE;YAC/B,IAAI,CAAC,iBAAiB,EAAE,CAC1B,CACN,CAAC;IACN,CAAC;CACJ;AAED,eAAe,aAAa,CAAC","sourcesContent":["import React, { Component } from 'react';\n\nimport {\n Backdrop,\n Box,\n Button,\n Checkbox,\n CircularProgress,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n FormControl,\n FormControlLabel,\n Grid2,\n IconButton,\n Input,\n InputAdornment,\n InputLabel,\n LinearProgress,\n MenuItem,\n Select,\n Slider,\n Snackbar,\n TextField,\n Typography,\n} from '@mui/material';\n\nimport { Close, Check } from '@mui/icons-material';\n\nimport type { Connection, AdminConnection, ThemeName, ThemeType, IobTheme } from '@iobroker/adapter-react-v5';\nimport { type ConfigItemPanel } from '@iobroker/json-config';\nimport type {\n ActionBase,\n ControlBase,\n ControlState,\n DeviceInfo,\n DeviceRefresh,\n InstanceDetails,\n} from '@iobroker/dm-utils';\n\nimport { getTranslation } from './Utils';\nimport JsonConfig from './JsonConfig';\n\ndeclare module '@mui/material/Button' {\n interface ButtonPropsColorOverrides {\n grey: true;\n }\n}\n\nexport type CommunicationProps = {\n /** Socket connection */\n socket: Connection;\n /** Instance to communicate with device-manager backend, like `adapterName.X` */\n selectedInstance: string; // adapterName.X\n registerHandler?: (handler: null | ((command: string) => void)) => void;\n themeName: ThemeName;\n themeType: ThemeType;\n theme: IobTheme;\n isFloatComma: boolean;\n dateFormat: string;\n};\n\ninterface CommunicationForm {\n title?: string | null | undefined;\n schema?: ConfigItemPanel;\n data?: Record<string, any>;\n handleClose?: (data?: Record<string, any>) => void;\n}\n\ninterface InputAction extends ActionBase {\n /** If it is a device action */\n deviceId?: string;\n /** Optional refresh function to execute */\n refresh?: () => void;\n}\n\nexport type CommunicationState = {\n showSpinner: boolean;\n showToast: string | null;\n message: {\n message: string;\n handleClose: () => void;\n } | null;\n confirm: {\n message: string;\n handleClose: (confirmation?: boolean) => void;\n } | null;\n form: CommunicationForm | null;\n progress: {\n open: boolean;\n progress: number;\n } | null;\n showConfirmation: InputAction | null;\n showInput: InputAction | null;\n inputValue: string | boolean | number | null;\n};\n\ninterface DmResponse {\n /* Type of message */\n type: 'message' | 'confirm' | 'progress' | 'result' | 'form';\n /* Origin */\n origin: string;\n}\n\ninterface DmControlResponse extends DmResponse {\n result: {\n error?: {\n code: number;\n message: string;\n };\n state?: ioBroker.State;\n deviceId: string;\n controlId: string;\n };\n}\n\ninterface Message {\n actionId?: string;\n deviceId?: string;\n value?: unknown;\n origin?: string;\n confirm?: boolean;\n data?: any;\n}\n\ninterface DmActionResponse extends DmResponse {\n result: {\n refresh?: DeviceRefresh;\n error?: {\n code: number;\n message: string;\n };\n };\n message?: string;\n confirm?: string;\n form?: any;\n progress?: {\n open: boolean;\n progress: number;\n };\n}\n\n/**\n * Device List Component\n */\nclass Communication<P extends CommunicationProps, S extends CommunicationState> extends Component<P, S> {\n // eslint-disable-next-line react/no-unused-class-component-methods\n instanceHandler: (action: ActionBase) => () => void;\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n deviceHandler: (deviceId: string, action: ActionBase, refresh: () => void) => () => void;\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n controlHandler: (\n deviceId: string,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n controlStateHandler: (deviceId: string, control: ControlBase) => () => Promise<ioBroker.State | null>;\n\n constructor(props: P) {\n super(props);\n\n this.state = {\n showSpinner: false,\n showToast: null,\n message: null,\n confirm: null,\n form: null,\n progress: null,\n showConfirmation: null,\n showInput: null,\n inputValue: null,\n } as S;\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n this.instanceHandler = action => () => {\n if (action.confirmation) {\n this.setState({ showConfirmation: action });\n return;\n }\n if (action.inputBefore) {\n this.setState({ showInput: action });\n return;\n }\n\n this.sendActionToInstance('dm:instanceAction', { actionId: action.id });\n };\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n this.deviceHandler = (deviceId, action, refresh) => () => {\n if (action.confirmation) {\n this.setState({ showConfirmation: { ...action, deviceId, refresh } });\n return;\n }\n if (action.inputBefore) {\n this.setState({\n showInput: { ...action, deviceId, refresh },\n inputValue: action.inputBefore.defaultValue || '',\n });\n return;\n }\n\n this.sendActionToInstance('dm:deviceAction', { deviceId, actionId: action.id }, refresh);\n };\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n this.controlHandler = (deviceId, control, state) => () =>\n this.sendControlToInstance('dm:deviceControl', { deviceId, controlId: control.id, state });\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n this.controlStateHandler = (deviceId, control) => () =>\n this.sendControlToInstance('dm:deviceControlState', { deviceId, controlId: control.id });\n\n if (this.props.registerHandler) {\n this.props.registerHandler(() => this.loadData());\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n loadData(): void {\n console.error('loadData not implemented');\n }\n\n sendActionToInstance = (command: `dm:${string}`, messageToSend: Message, refresh?: () => void): void => {\n const send = async (): Promise<void> => {\n this.setState({ showSpinner: true });\n const response: DmActionResponse = await this.props.socket.sendTo(\n this.props.selectedInstance,\n command,\n messageToSend,\n );\n\n const type: string = response.type;\n console.log(`Response: ${response.type}`);\n switch (type) {\n case 'message':\n console.log(`Message received: ${response.message}`);\n if (response.message) {\n this.setState({\n message: {\n message: response.message,\n handleClose: () =>\n this.setState({ message: null }, () =>\n this.sendActionToInstance(\n 'dm:actionProgress',\n { origin: response.origin },\n refresh,\n ),\n ),\n },\n });\n }\n break;\n\n case 'confirm':\n console.log(`Confirm received: ${response.confirm}`);\n if (response.confirm) {\n this.setState({\n confirm: {\n message: response.confirm,\n handleClose: (confirm?: boolean) =>\n this.setState({ confirm: null }, () =>\n this.sendActionToInstance(\n 'dm:actionProgress',\n {\n origin: response.origin,\n confirm,\n },\n refresh,\n ),\n ),\n },\n });\n }\n break;\n\n case 'form':\n console.log('Form received');\n if (response.form) {\n this.setState({\n form: {\n ...response.form,\n handleClose: (data: any) =>\n this.setState({ form: null }, () => {\n console.log(`Form ${JSON.stringify(data)}`);\n this.sendActionToInstance(\n 'dm:actionProgress',\n {\n origin: response.origin,\n data,\n },\n refresh,\n );\n }),\n },\n });\n }\n break;\n\n case 'progress':\n if (response.progress) {\n if (this.state.progress) {\n const progress = { ...this.state.progress, ...response.progress };\n this.setState({ progress });\n } else {\n this.setState({ progress: response.progress });\n }\n }\n this.sendActionToInstance('dm:actionProgress', { origin: response.origin }, refresh);\n break;\n\n case 'result':\n console.log('Response content', response.result);\n if (response.result.refresh) {\n if (response.result.refresh === true) {\n console.log('Refreshing all');\n this.loadData();\n } else if (response.result.refresh === 'instance') {\n console.log(`Refreshing instance infos: ${this.props.selectedInstance}`);\n } else if (response.result.refresh === 'device') {\n if (!refresh) {\n console.log('No refresh function provided to refresh \"device\"');\n } else {\n console.log(`Refreshing device infos: ${this.props.selectedInstance}`);\n refresh();\n }\n } else {\n console.log('Not refreshing anything');\n }\n }\n if (response.result.error) {\n console.error(`Error: ${response.result.error.message}`);\n this.setState({ showToast: response.result.error.message });\n }\n this.setState({ showSpinner: false });\n break;\n\n default:\n console.log(`Unknown response type: ${type}`);\n this.setState({ showSpinner: false });\n break;\n }\n };\n\n void send().catch(console.error);\n };\n\n sendControlToInstance = async (\n command: string,\n messageToSend: { deviceId: string; controlId: string; state?: ControlState },\n ): Promise<null | ioBroker.State> => {\n const response: DmControlResponse = await this.props.socket.sendTo(\n this.props.selectedInstance,\n command,\n messageToSend,\n );\n const type = response.type;\n console.log(`Response: ${response.type}`);\n if (response.type === 'result') {\n console.log('Response content', response.result);\n if (response.result.error) {\n console.error(`Error: ${response.result.error.message}`);\n this.setState({ showToast: response.result.error.message });\n } else if (response.result.state !== undefined) {\n return response.result.state;\n }\n } else {\n console.warn('Unexpected response type', type);\n }\n\n return null;\n };\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n loadDevices(): Promise<DeviceInfo[]> {\n return this.props.socket.sendTo(this.props.selectedInstance, 'dm:listDevices');\n }\n\n // eslint-disable-next-line react/no-unused-class-component-methods\n loadInstanceInfos(): Promise<InstanceDetails> {\n return this.props.socket.sendTo(this.props.selectedInstance, 'dm:instanceInfo');\n }\n\n renderMessageDialog(): React.JSX.Element | null {\n if (!this.state.message) {\n return null;\n }\n\n return (\n <Dialog\n open={!0}\n onClose={() => this.state.message?.handleClose()}\n hideBackdrop\n aria-describedby=\"message-dialog-description\"\n >\n <DialogContent>\n <DialogContentText id=\"message-dialog-description\">{this.state.message?.message}</DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button\n color=\"primary\"\n onClick={() => this.state.message?.handleClose()}\n variant=\"contained\"\n autoFocus\n >\n {getTranslation('okButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderConfirmDialog(): React.JSX.Element | null {\n if (!this.state.confirm) {\n return null;\n }\n\n return (\n <Dialog\n open={!0}\n onClose={() => this.state.confirm?.handleClose()}\n hideBackdrop\n aria-describedby=\"confirm-dialog-description\"\n >\n <DialogContent>\n <DialogContentText id=\"confirm-dialog-description\">\n {getTranslation(this.state.confirm?.message)}\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={() => this.state.confirm?.handleClose(true)}\n autoFocus\n >\n {getTranslation('yesButtonText')}\n </Button>\n <Button\n variant=\"contained\"\n color=\"grey\"\n onClick={() => this.state.confirm?.handleClose(false)}\n autoFocus\n >\n {getTranslation('noButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderSnackbar(): React.JSX.Element {\n return (\n <Snackbar\n open={!!this.state.showToast}\n autoHideDuration={6_000}\n onClose={() => this.setState({ showToast: null })}\n message={this.state.showToast}\n />\n );\n }\n\n renderFormDialog(): React.JSX.Element | null {\n if (!this.state.form || !this.state.form.schema || !this.state.form.data) {\n return null;\n }\n return (\n <Dialog\n open={!0}\n onClose={() => this.state.form?.handleClose && this.state.form.handleClose()}\n hideBackdrop\n >\n {this.state.form?.title ? <DialogTitle>{getTranslation(this.state.form?.title)}</DialogTitle> : null}\n <DialogContent>\n <JsonConfig\n instanceId={this.props.selectedInstance}\n schema={this.state.form.schema}\n data={this.state.form.data}\n socket={this.props.socket as AdminConnection}\n onChange={(data: Record<string, any>) => {\n console.log('handleFormChange', { data });\n const form: CommunicationForm | null | undefined = { ...this.state.form };\n if (form) {\n form.data = data;\n this.setState({ form });\n }\n }}\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 variant=\"contained\"\n color=\"primary\"\n onClick={() =>\n this.state.form?.handleClose && this.state.form.handleClose(this.state.form?.data)\n }\n autoFocus\n >\n {getTranslation('okButtonText')}\n </Button>\n <Button\n variant=\"contained\"\n color=\"grey\"\n onClick={() => this.state.form?.handleClose && this.state.form.handleClose()}\n >\n {getTranslation('cancelButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderProgressDialog(): React.JSX.Element | null {\n if (!this.state.progress?.open) {\n return null;\n }\n\n return (\n <Dialog\n open={!0}\n onClose={() => {}}\n hideBackdrop\n >\n <LinearProgress\n variant=\"determinate\"\n value={this.state.progress?.progress || 0}\n />\n </Dialog>\n );\n }\n\n // eslint-disable-next-line class-methods-use-this\n renderContent(): React.JSX.Element | React.JSX.Element[] | null {\n return null;\n }\n\n renderSpinner(): React.JSX.Element | null {\n if (\n !this.state.showSpinner &&\n !this.state.progress?.open &&\n !this.state.message &&\n !this.state.confirm &&\n !this.state.form\n ) {\n return null;\n }\n return (\n <Backdrop\n style={{ zIndex: 1000 }}\n open={!0}\n >\n <CircularProgress />\n </Backdrop>\n );\n }\n\n renderConfirmationDialog(): React.JSX.Element | null {\n if (!this.state.showConfirmation) {\n return null;\n }\n return (\n <Dialog\n open={!0}\n onClose={() => this.setState({ showConfirmation: null })}\n >\n <DialogTitle>\n {getTranslation(\n this.state.showConfirmation.confirmation === true\n ? getTranslation('areYouSureText')\n : getTranslation(this.state.showConfirmation.confirmation as ioBroker.StringOrTranslated),\n )}\n </DialogTitle>\n <DialogActions>\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={() => {\n if (!this.state.showConfirmation) {\n return;\n }\n\n const showConfirmation = this.state.showConfirmation;\n this.setState({ showConfirmation: null }, () => {\n if (showConfirmation.deviceId) {\n this.sendActionToInstance(\n 'dm:deviceAction',\n { actionId: showConfirmation.id, deviceId: showConfirmation.deviceId },\n showConfirmation.refresh,\n );\n } else {\n this.sendActionToInstance('dm:instanceAction', { actionId: showConfirmation.id });\n }\n });\n }}\n autoFocus\n startIcon={<Check />}\n >\n {getTranslation('yesButtonText')}\n </Button>\n <Button\n variant=\"contained\"\n color=\"grey\"\n onClick={() => this.setState({ showConfirmation: null })}\n startIcon={<Close />}\n >\n {getTranslation('cancelButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderInputDialog(): React.JSX.Element | null {\n if (!this.state.showInput || !this.state.showInput.inputBefore) {\n return null;\n }\n let okDisabled = false;\n if (!this.state.showInput.inputBefore.allowEmptyValue && this.state.showInput.inputBefore.type !== 'checkbox') {\n if (\n this.state.showInput.inputBefore.type === 'number' ||\n this.state.showInput.inputBefore.type === 'slider'\n ) {\n okDisabled =\n this.state.inputValue === '' ||\n this.state.inputValue === null ||\n !window.isFinite(this.state.inputValue as number);\n } else {\n okDisabled = !this.state.inputValue;\n }\n }\n\n return (\n <Dialog\n open={!0}\n onClose={() => this.setState({ showInput: null })}\n >\n <DialogTitle>{getTranslation('pleaseEnterValueText')}</DialogTitle>\n <DialogContent>\n {this.state.showInput.inputBefore.type === 'text' ||\n this.state.showInput.inputBefore.type === 'number' ||\n !this.state.showInput.inputBefore.type ? (\n <TextField\n autoFocus\n margin=\"dense\"\n label={getTranslation(this.state.showInput.inputBefore.label)}\n slotProps={{\n htmlInput:\n this.state.showInput.inputBefore.type === 'number'\n ? {\n min: this.state.showInput.inputBefore.min,\n max: this.state.showInput.inputBefore.max,\n step: this.state.showInput.inputBefore.step,\n }\n : undefined,\n input: {\n endAdornment: this.state.inputValue ? (\n <InputAdornment position=\"end\">\n <IconButton\n size=\"small\"\n onClick={() => this.setState({ inputValue: '' })}\n >\n <Close />\n </IconButton>\n </InputAdornment>\n ) : null,\n },\n }}\n type={this.state.showInput.inputBefore.type === 'number' ? 'number' : 'text'}\n fullWidth\n value={this.state.inputValue}\n onChange={e => this.setState({ inputValue: e.target.value })}\n />\n ) : null}\n {this.state.showInput.inputBefore.type === 'checkbox' ? (\n <FormControlLabel\n control={\n <Checkbox\n checked={!!this.state.inputValue}\n autoFocus\n onChange={e => this.setState({ inputValue: e.target.checked })}\n />\n }\n label={getTranslation(this.state.showInput.inputBefore.label)}\n />\n ) : null}\n {this.state.showInput.inputBefore.type === 'select' ? (\n <FormControl fullWidth>\n <InputLabel>{getTranslation(this.state.showInput.inputBefore.label)}</InputLabel>\n <Select\n variant=\"standard\"\n value={this.state.inputValue}\n onChange={e => this.setState({ inputValue: e.target.value })}\n >\n {this.state.showInput.inputBefore.options?.map(item => (\n <MenuItem\n key={item.value}\n value={item.value}\n >\n {getTranslation(item.label)}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n ) : null}\n {this.state.showInput.inputBefore.type === 'slider' ? (\n <Box sx={{ width: '100%' }}>\n <Typography gutterBottom>\n {getTranslation(this.state.showInput.inputBefore.label)}\n </Typography>\n <Grid2\n container\n spacing={2}\n alignItems=\"center\"\n >\n <Grid2>\n <Slider\n value={typeof this.state.inputValue === 'number' ? this.state.inputValue : 0}\n onChange={(event: Event, newValue: number) =>\n this.setState({ inputValue: newValue })\n }\n />\n </Grid2>\n <Grid2>\n <Input\n value={this.state.inputValue}\n size=\"small\"\n onChange={e =>\n this.setState({\n inputValue: e.target.value === '' ? 0 : Number(e.target.value),\n })\n }\n onBlur={() => {\n if (!this.state.showInput) {\n return;\n }\n\n const min =\n this.state.showInput.inputBefore?.min === undefined\n ? 0\n : this.state.showInput.inputBefore.min;\n const max =\n this.state.showInput.inputBefore?.max === undefined\n ? 100\n : this.state.showInput.inputBefore.max;\n\n if ((this.state.inputValue as number) < min) {\n this.setState({ inputValue: min });\n } else if ((this.state.inputValue as number) > max) {\n this.setState({ inputValue: max });\n }\n }}\n inputProps={{\n step: this.state.showInput.inputBefore.step,\n min:\n this.state.showInput.inputBefore.min === undefined\n ? 0\n : this.state.showInput.inputBefore.min,\n max:\n this.state.showInput.inputBefore.max === undefined\n ? 100\n : this.state.showInput.inputBefore.max,\n type: 'number',\n }}\n />\n </Grid2>\n </Grid2>\n </Box>\n ) : null}\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n disabled={okDisabled}\n color=\"primary\"\n onClick={() => {\n if (!this.state.showInput) {\n return;\n }\n\n const showInput = this.state.showInput;\n this.setState({ showInput: null }, () => {\n if (showInput.deviceId) {\n this.sendActionToInstance(\n 'dm:deviceAction',\n {\n actionId: showInput.id,\n deviceId: showInput.deviceId,\n value:\n showInput.inputBefore?.type === 'checkbox'\n ? !!this.state.inputValue\n : showInput.inputBefore?.type === 'number'\n ? parseFloat(this.state.inputValue as string) || 0\n : this.state.inputValue,\n },\n showInput.refresh,\n );\n } else {\n this.sendActionToInstance('dm:instanceAction', {\n actionId: showInput.id,\n value:\n showInput.inputBefore?.type === 'checkbox'\n ? !!this.state.inputValue\n : showInput.inputBefore?.type === 'number'\n ? parseFloat(this.state.inputValue as string) || 0\n : this.state.inputValue,\n });\n }\n });\n }}\n startIcon={<Check />}\n >\n {getTranslation('yesButtonText')}\n </Button>\n <Button\n variant=\"contained\"\n color=\"grey\"\n onClick={() => this.setState({ showInput: null })}\n startIcon={<Close />}\n >\n {getTranslation('cancelButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n render(): React.JSX.Element {\n return (\n <>\n {this.renderSnackbar()}\n {this.renderContent()}\n {this.renderSpinner()}\n {this.renderConfirmDialog()}\n {this.renderMessageDialog()}\n {this.renderFormDialog()}\n {this.renderProgressDialog()}\n {this.renderConfirmationDialog()}\n {this.renderInputDialog()}\n </>\n );\n }\n}\n\nexport default Communication;\n"]}
|
package/build/DeviceCard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceCard.js","sourceRoot":"./src/","sources":["DeviceCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EACH,MAAM,EACN,UAAU,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,GAAG,EACH,WAAW,EACX,IAAI,EACJ,WAAW,EACX,UAAU,EACV,WAAW,EACX,KAAK,EACL,GAAG,GACN,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,cAAc,IAAI,WAAW,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAElH,OAAO,EACH,KAAK,EACL,IAAI,EAEJ,IAAI,GAIP,MAAM,4BAA4B,CAAC;AAGpC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,sBAAsB,MAAM,iBAAiB,CAAC;AACrD,OAAO,qBAAqB,MAAM,gBAAgB,CAAC;AACnD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,SAAS,WA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,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;QAC9B,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;IAC5B,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { Component, type JSX } from 'react';\n\nimport {\n Button,\n Typography,\n Dialog,\n DialogActions,\n DialogContent,\n IconButton,\n Fab,\n DialogTitle,\n Card,\n CardActions,\n CardHeader,\n CardContent,\n Paper,\n Box,\n} from '@mui/material';\n\nimport { MoreVert as MoreVertIcon, VideogameAsset as ControlIcon, Close as CloseIcon } from '@mui/icons-material';\n\nimport {\n Utils,\n Icon,\n type Connection,\n I18n,\n type ThemeName,\n type ThemeType,\n type IobTheme,\n} from '@iobroker/adapter-react-v5';\nimport type { DeviceDetails, DeviceInfo, ActionBase, ControlBase, ControlState } from '@iobroker/dm-utils';\n\nimport DeviceActionButton from './DeviceActionButton';\nimport DeviceControlComponent from './DeviceControl';\nimport DeviceStatusComponent from './DeviceStatus';\nimport JsonConfig from './JsonConfig';\nimport DeviceImageUpload from './DeviceImageUpload';\nimport { getTranslation } from './Utils';\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 title?: string;\n /* Device ID */\n id: string;\n device: DeviceInfo;\n instanceId: string;\n socket: Connection;\n /* Instance, where the images should be uploaded to */\n uploadImagesToInstance?: string;\n deviceHandler: (deviceId: string, action: ActionBase, refresh: () => void) => () => void;\n controlHandler: (\n deviceId: string,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n controlStateHandler: (deviceId: string, 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 icon: string | undefined;\n showControlDialog: boolean;\n}\n\n/**\n * Device Card Component\n */\nclass DeviceCard extends Component<DeviceCardProps, DeviceCardState> {\n constructor(props: DeviceCardProps) {\n super(props);\n\n this.state = {\n open: false,\n details: null,\n data: {},\n icon: props.device.icon,\n showControlDialog: false,\n };\n }\n\n async fetchIcon(): Promise<void> {\n if (!this.props.device.icon) {\n const lang = I18n.getLanguage();\n const manufacturer =\n this.props.device.manufacturer && typeof this.props.device.manufacturer === 'object'\n ? this.props.device.manufacturer[lang] || this.props.device.manufacturer.en\n : this.props.device.manufacturer;\n const model =\n this.props.device.model && typeof this.props.device.model === 'object'\n ? this.props.device.model[lang] || this.props.device.model.en\n : this.props.device.model;\n\n // try to load the icon from file storage\n const fileName = `${manufacturer ? `${manufacturer}_` : ''}${model || 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:image/${file.mimeType},${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 componentDidMount(): void {\n this.fetchIcon().catch(e => console.error(e));\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.props.device.id;\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}\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.props.title}\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 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 button and show 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 return this.props.device.actions?.length\n ? this.props.device.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.props.device.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 return (\n <Card\n sx={{\n maxWidth: 345,\n minWidth: 200,\n }}\n >\n <CardHeader\n sx={theme => ({\n backgroundColor: this.props.device.color || theme.palette.secondary.main,\n color: this.props.device.color\n ? Utils.invertColor(this.props.device.color, true)\n : theme.palette.secondary.contrastText,\n maxWidth: 345,\n })}\n avatar={\n <div>\n {this.props.uploadImagesToInstance ? (\n <DeviceImageUpload\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceId={this.props.device.id}\n manufacturer={getText(this.props.device.manufacturer)}\n model={getText(this.props.device.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 {this.state.icon ? <Icon src={this.state.icon} /> : <NoImageIcon />}\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.props.title}\n subheader={\n this.props.device.manufacturer ? (\n <span>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {getText(this.props.device.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 status={s}\n />\n ))}\n </div>\n ) : null}\n <div>\n <Typography variant=\"body1\">\n <div\n onClick={this.copyToClipboard}\n style={{ textOverflow: 'ellipsis', overflow: 'hidden' }}\n >\n <b>ID:</b>\n <span style={{ marginLeft: 4 }}>{this.props.device.id.replace(/.*\\.\\d\\./, '')}</span>\n </div>\n {this.props.device.manufacturer ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {getText(this.props.device.manufacturer)}\n </div>\n ) : null}\n {this.props.device.model ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('model')}:</b>\n {getText(this.props.device.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 renderBig(): JSX.Element {\n const cardStyle: React.CSSProperties = {\n width: 300,\n minHeight: 280,\n margin: 10,\n overflow: 'hidden',\n display: 'inline-block',\n };\n const headerStyle: React.CSSProperties = {\n display: 'flex',\n position: 'relative',\n justifyContent: 'space-between',\n minHeight: 60,\n color: '#000',\n padding: '0 10px 0 10px',\n borderRadius: '4px 4px 0 0',\n };\n const imgAreaStyle: React.CSSProperties = {\n height: 45,\n width: 45,\n margin: 'auto',\n justifyContent: 'center',\n display: 'grid',\n };\n const imgStyle: React.CSSProperties = {\n zIndex: 2,\n maxWidth: '100%',\n maxHeight: '100%',\n };\n const titleStyle: React.CSSProperties = {\n width: '100%',\n fontSize: 16,\n fontWeight: 'bold',\n paddingTop: 16,\n paddingLeft: 8,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n };\n const detailsButtonStyle: React.CSSProperties = {\n right: 20,\n bottom: -20,\n position: 'absolute',\n };\n const bodyStyle: React.CSSProperties = {\n height: 'calc(100% - 116px)',\n };\n const deviceInfoStyle: React.CSSProperties = {\n padding: '20px 16px 0 16px',\n height: 133,\n };\n const statusStyle: React.CSSProperties = {\n padding: '15px 15px 0 15px',\n height: 41,\n };\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 return (\n <Paper\n style={cardStyle}\n key={this.props.id}\n >\n <Box\n sx={theme => ({ backgroundColor: theme.palette.secondary.main })}\n style={headerStyle}\n >\n <div style={imgAreaStyle}>\n {this.props.uploadImagesToInstance ? (\n <DeviceImageUpload\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceId={this.props.device.id}\n manufacturer={getText(this.props.device.manufacturer)}\n model={getText(this.props.device.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 src={this.state.icon}\n style={imgStyle}\n />\n </div>\n <Box\n style={titleStyle}\n sx={theme => ({ color: theme.palette.secondary.contrastText })}\n >\n {this.state.details?.data?.name || this.props.title}\n </Box>\n {this.props.device.hasDetails ? (\n <Fab\n disabled={!this.props.alive}\n size=\"small\"\n style={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={statusStyle}>\n {status.map((s, i) => (\n <DeviceStatusComponent\n key={i}\n status={s}\n />\n ))}\n </div>\n <div style={bodyStyle}>\n <Typography\n variant=\"body1\"\n style={deviceInfoStyle}\n >\n <div onClick={this.copyToClipboard}>\n <b style={{ marginRight: 4 }}>ID:</b>\n {this.props.device.id.replace(/.*\\.\\d\\./, '')}\n </div>\n {this.props.device.manufacturer ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {getText(this.props.device.manufacturer)}\n </div>\n ) : null}\n {this.props.device.model ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('model')}:</b>\n {getText(this.props.device.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 if (this.props.smallCards) {\n return this.renderSmall();\n }\n\n return this.renderBig();\n }\n}\n\nexport default DeviceCard;\n"]}
|
|
1
|
+
{"version":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CAAC,CAAC,CAAC,IAAI,CACC;gBACZ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,CACpC,6BACI,KAAK,EAAE;wBACH,IAAI,EAAE,CAAC;wBACP,QAAQ,EAAE,UAAU;wBACpB,OAAO,EAAE,MAAM;wBACf,GAAG,EAAE,CAAC;wBACN,aAAa,EAAE,CAAC;wBAChB,MAAM,EAAE,EAAE;wBACV,WAAW,EAAE,EAAE;wBACf,YAAY,EAAE,EAAE;qBACnB;oBAEA,IAAI,CAAC,aAAa,EAAE;oBACrB,6BAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAI;oBAC9B,IAAI,CAAC,cAAc,EAAE,CACpB,CACT,CACC;YACL,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,mBAAmB,EAAE,CACvB,CACX,CAAC;IACN,CAAC;IAED,MAAM;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;YACvB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;SAC7B;QAED,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;IAC5B,CAAC;CACJ;AAED,eAAe,UAAU,CAAC","sourcesContent":["import React, { Component, type JSX } from 'react';\n\nimport {\n Button,\n Typography,\n Dialog,\n DialogActions,\n DialogContent,\n IconButton,\n Fab,\n DialogTitle,\n Card,\n CardActions,\n CardHeader,\n CardContent,\n Paper,\n Box,\n} from '@mui/material';\n\nimport { MoreVert as MoreVertIcon, VideogameAsset as ControlIcon, Close as CloseIcon } from '@mui/icons-material';\n\nimport {\n Utils,\n Icon,\n type Connection,\n I18n,\n type ThemeName,\n type ThemeType,\n type IobTheme,\n} from '@iobroker/adapter-react-v5';\nimport type { DeviceDetails, DeviceInfo, ActionBase, ControlBase, ControlState } from '@iobroker/dm-utils';\n\nimport DeviceActionButton from './DeviceActionButton';\nimport DeviceControlComponent from './DeviceControl';\nimport DeviceStatusComponent from './DeviceStatus';\nimport JsonConfig from './JsonConfig';\nimport DeviceImageUpload from './DeviceImageUpload';\nimport { getTranslation } from './Utils';\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 title?: string;\n /* Device ID */\n id: string;\n device: DeviceInfo;\n instanceId: string;\n socket: Connection;\n /* Instance, where the images should be uploaded to */\n uploadImagesToInstance?: string;\n deviceHandler: (deviceId: string, action: ActionBase, refresh: () => void) => () => void;\n controlHandler: (\n deviceId: string,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n controlStateHandler: (deviceId: string, 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 icon: string | undefined;\n showControlDialog: boolean;\n}\n\n/**\n * Device Card Component\n */\nclass DeviceCard extends Component<DeviceCardProps, DeviceCardState> {\n constructor(props: DeviceCardProps) {\n super(props);\n\n this.state = {\n open: false,\n details: null,\n data: {},\n icon: props.device.icon,\n showControlDialog: false,\n };\n }\n\n async fetchIcon(): Promise<void> {\n if (!this.props.device.icon) {\n const lang = I18n.getLanguage();\n const manufacturer =\n this.props.device.manufacturer && typeof this.props.device.manufacturer === 'object'\n ? this.props.device.manufacturer[lang] || this.props.device.manufacturer.en\n : this.props.device.manufacturer;\n const model =\n this.props.device.model && typeof this.props.device.model === 'object'\n ? this.props.device.model[lang] || this.props.device.model.en\n : this.props.device.model;\n\n // try to load the icon from file storage\n const fileName = `${manufacturer ? `${manufacturer}_` : ''}${model || 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:image/${file.mimeType},${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 componentDidMount(): void {\n this.fetchIcon().catch(e => console.error(e));\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.props.device.id;\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}\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.props.title}\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 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 button and show 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 return this.props.device.actions?.length\n ? this.props.device.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.props.device.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 return (\n <Card\n sx={{\n maxWidth: 345,\n minWidth: 200,\n }}\n >\n <CardHeader\n sx={theme => ({\n backgroundColor: this.props.device.color || theme.palette.secondary.main,\n color: this.props.device.color\n ? Utils.invertColor(this.props.device.color, true)\n : theme.palette.secondary.contrastText,\n maxWidth: 345,\n })}\n avatar={\n <div>\n {this.props.uploadImagesToInstance ? (\n <DeviceImageUpload\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceId={this.props.device.id}\n manufacturer={getText(this.props.device.manufacturer)}\n model={getText(this.props.device.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 {this.state.icon ? <Icon src={this.state.icon} /> : <NoImageIcon />}\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.props.title}\n subheader={\n this.props.device.manufacturer ? (\n <span>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {getText(this.props.device.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 status={s}\n />\n ))}\n </div>\n ) : null}\n <div>\n <Typography variant=\"body1\">\n <div\n onClick={this.copyToClipboard}\n style={{ textOverflow: 'ellipsis', overflow: 'hidden' }}\n >\n <b>ID:</b>\n <span style={{ marginLeft: 4 }}>{this.props.device.id.replace(/.*\\.\\d\\./, '')}</span>\n </div>\n {this.props.device.manufacturer ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {getText(this.props.device.manufacturer)}\n </div>\n ) : null}\n {this.props.device.model ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('model')}:</b>\n {getText(this.props.device.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 renderBig(): JSX.Element {\n const cardStyle: React.CSSProperties = {\n width: 300,\n minHeight: 280,\n margin: 10,\n overflow: 'hidden',\n display: 'inline-block',\n };\n const headerStyle: React.CSSProperties = {\n display: 'flex',\n position: 'relative',\n justifyContent: 'space-between',\n minHeight: 60,\n color: '#000',\n padding: '0 10px 0 10px',\n borderRadius: '4px 4px 0 0',\n };\n const imgAreaStyle: React.CSSProperties = {\n height: 45,\n width: 45,\n margin: 'auto',\n justifyContent: 'center',\n display: 'grid',\n };\n const imgStyle: React.CSSProperties = {\n zIndex: 2,\n maxWidth: '100%',\n maxHeight: '100%',\n };\n const titleStyle: React.CSSProperties = {\n width: '100%',\n fontSize: 16,\n fontWeight: 'bold',\n paddingTop: 16,\n paddingLeft: 8,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n };\n const detailsButtonStyle: React.CSSProperties = {\n right: 20,\n bottom: -20,\n position: 'absolute',\n };\n const bodyStyle: React.CSSProperties = {\n height: 'calc(100% - 116px)',\n };\n const deviceInfoStyle: React.CSSProperties = {\n padding: '20px 16px 0 16px',\n height: 133,\n };\n const statusStyle: React.CSSProperties = {\n padding: '15px 15px 0 15px',\n height: 41,\n };\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 return (\n <Paper\n style={cardStyle}\n key={this.props.id}\n >\n <Box\n sx={theme => ({ backgroundColor: theme.palette.secondary.main })}\n style={headerStyle}\n >\n <div style={imgAreaStyle}>\n {this.props.uploadImagesToInstance ? (\n <DeviceImageUpload\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceId={this.props.device.id}\n manufacturer={getText(this.props.device.manufacturer)}\n model={getText(this.props.device.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 src={this.state.icon}\n style={imgStyle}\n />\n </div>\n <Box\n style={titleStyle}\n sx={theme => ({ color: theme.palette.secondary.contrastText })}\n >\n {this.state.details?.data?.name || this.props.title}\n </Box>\n {this.props.device.hasDetails ? (\n <Fab\n disabled={!this.props.alive}\n size=\"small\"\n style={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={statusStyle}>\n {status.map((s, i) => (\n <DeviceStatusComponent\n key={i}\n status={s}\n />\n ))}\n </div>\n <div style={bodyStyle}>\n <Typography\n variant=\"body1\"\n style={deviceInfoStyle}\n >\n <div onClick={this.copyToClipboard}>\n <b style={{ marginRight: 4 }}>ID:</b>\n {this.props.device.id.replace(/.*\\.\\d\\./, '')}\n </div>\n {this.props.device.manufacturer ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('manufacturer')}:</b>\n {getText(this.props.device.manufacturer)}\n </div>\n ) : null}\n {this.props.device.model ? (\n <div>\n <b style={{ marginRight: 4 }}>{getTranslation('model')}:</b>\n {getText(this.props.device.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 if (this.props.smallCards) {\n return this.renderSmall();\n }\n\n return this.renderBig();\n }\n}\n\nexport default DeviceCard;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceControl.js","sourceRoot":"./src/","sources":["DeviceControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKpD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAwB5D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,SAAiD;IACjG,YAAY,KAAyB;QACjC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG;YACT,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG;YAC/B,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE;SAC9B,CAAC;IACN,CAAC;IAED,KAAK,CAAC,iBAAiB;QACnB,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAA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;IACN,CAAC;IAED,MAAM;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC/B,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACrC,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;QAC7B,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC/B,CAAC;QAED,OAAO,6BAAK,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAO,CAAC;IACzE,CAAC;CACJ","sourcesContent":["import React, { Component, type JSX } from 'react';\nimport { Button, Fab, Switch } from '@mui/material';\n\nimport type { Connection } from '@iobroker/adapter-react-v5';\nimport type { ControlBase, ControlState, DeviceControl } from '@iobroker/dm-utils';\n\nimport { renderControlIcon, getTranslation } from './Utils';\n\ninterface DeviceControlProps {\n deviceId: string;\n /** Control object */\n control: DeviceControl;\n socket: Connection;\n /** Control handler to set the state */\n controlHandler: (\n deviceId: string,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n /** Control handler to read the state */\n controlStateHandler: (deviceId: string, control: ControlBase) => () => Promise<ioBroker.State | null>;\n colors: { primary: string; secondary: string };\n disabled?: boolean;\n}\n\ninterface DeviceControlState {\n value?: ControlState;\n ts?: number;\n}\n\n/**\n * Device Control component\n */\nexport default class DeviceControlComponent extends Component<DeviceControlProps, DeviceControlState> {\n constructor(props: DeviceControlProps) {\n super(props);\n this.state = {\n value: props.control.state?.val,\n ts: props.control.state?.ts,\n };\n }\n\n async componentDidMount(): Promise<void> {\n if (this.props.control.stateId) {\n const mayBePromise = this.props.socket.subscribeState(this.props.control.stateId, this.stateHandler);\n if (mayBePromise instanceof Promise) {\n await mayBePromise;\n }\n }\n }\n\n stateHandler = async (id: string, state: ioBroker.State): Promise<void> => {\n if (id === this.props.control.stateId && state) {\n // request new state\n const newState: ioBroker.State | null = await this.props.controlStateHandler(\n this.props.deviceId,\n this.props.control,\n )();\n if (newState?.ts && (!this.state.ts || newState.ts > this.state.ts)) {\n this.setState({\n value: newState.val,\n ts: newState.ts,\n });\n }\n }\n };\n\n componentWillUnmount(): void {\n if (this.props.control.stateId) {\n this.props.socket.unsubscribeState(this.props.control.stateId, this.stateHandler);\n }\n }\n\n static getDerivedStateFromProps(\n props: DeviceControlProps,\n state: DeviceControlState,\n ): Partial<DeviceControlState> | null {\n if (props.control.state?.ts && (!state.ts || props.control.state?.ts > state.ts)) {\n return {\n value: props.control.state.val,\n ts: props.control.state.ts,\n };\n }\n\n return null;\n }\n\n async sendControl(deviceId: string, control: ControlBase, value: ControlState): Promise<void> {\n const result = await this.props.controlHandler(deviceId, control, value)();\n if (result?.ts && (!this.state.ts || result?.ts > this.state.ts)) {\n this.setState({\n value: result.val,\n ts: result.ts,\n });\n }\n }\n\n renderButton(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value);\n\n if (!this.props.control.label) {\n return (\n <Fab\n size=\"small\"\n disabled={this.props.disabled}\n title={tooltip}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, true)}\n >\n {icon}\n </Fab>\n );\n }\n return (\n <Button\n disabled={this.props.disabled}\n title={tooltip}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, true)}\n startIcon={icon}\n >\n {getTranslation(this.props.control.label)}\n </Button>\n );\n }\n\n renderSwitch(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n // const icon = renderIcon(this.props.control, this.props.colors, this.state.value);\n\n return (\n <Switch\n disabled={this.props.disabled}\n title={tooltip}\n checked={!!this.state.value}\n onChange={e => this.sendControl(this.props.deviceId, this.props.control, e.target.checked)}\n />\n );\n }\n\n getColor(): string | undefined {\n let color: string | undefined;\n if (this.state.value) {\n color = this.props.control.colorOn || 'primary';\n } else if (this.props.control.type === 'switch') {\n color = this.props.control.color;\n }\n if (color === 'primary') {\n return this.props.colors.primary;\n }\n if (color === 'secondary') {\n return this.props.colors.secondary;\n }\n return color;\n }\n\n // TODO: implement the following render methods\n // eslint-disable-next-line react/no-unused-class-component-methods,class-methods-use-this\n renderSelect(): JSX.Element | null {\n return null;\n }\n\n // eslint-disable-next-line react/no-unused-class-component-methods,class-methods-use-this\n renderSlider(): JSX.Element | null {\n return null;\n }\n\n // eslint-disable-next-line react/no-unused-class-component-methods,class-methods-use-this\n renderColor(): JSX.Element | null {\n return null;\n }\n\n renderIcon(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value);\n const color = this.getColor();\n const style: React.CSSProperties | undefined =\n color === this.props.colors.primary || color === this.props.colors.secondary ? {} : { color };\n const colorProps =\n color === this.props.colors.primary\n ? 'primary'\n : color === this.props.colors.secondary\n ? 'secondary'\n : undefined;\n\n if (!this.props.control.label) {\n style.width = 34;\n style.height = 34;\n style.minHeight = 34;\n\n return (\n <Fab\n disabled={this.props.disabled}\n size=\"small\"\n title={tooltip}\n color={colorProps}\n style={style}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, !this.state.value)}\n >\n {icon}\n </Fab>\n );\n }\n return (\n <Button\n disabled={this.props.disabled}\n title={tooltip}\n color={colorProps}\n style={style}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, !this.state.value)}\n startIcon={icon}\n >\n {getTranslation(this.props.control.label)}\n </Button>\n );\n }\n\n render(): JSX.Element {\n if (this.props.control.type === 'button') {\n return this.renderButton();\n }\n\n if (this.props.control.type === 'icon') {\n return this.renderIcon();\n }\n\n if (this.props.control.type === 'switch') {\n return this.renderSwitch();\n }\n\n return <div style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,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAE1F,IAAI,CACH,CACT,CAAC;SACL;QACD,OAAO,CACH,oBAAC,MAAM,IACH,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAC3F,SAAS,EAAE,IAAI,IAEd,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CACpC,CACZ,CAAC;IACN,CAAC;IAED,MAAM;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;YACtC,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;SAC9B;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;YACpC,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;SAC5B;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;YACtC,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;SAC9B;QAED,OAAO,6BAAK,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAO,CAAC;IACzE,CAAC;CACJ","sourcesContent":["import React, { Component, type JSX } from 'react';\nimport { Button, Fab, Switch } from '@mui/material';\n\nimport type { Connection } from '@iobroker/adapter-react-v5';\nimport type { ControlBase, ControlState, DeviceControl } from '@iobroker/dm-utils';\n\nimport { renderControlIcon, getTranslation } from './Utils';\n\ninterface DeviceControlProps {\n deviceId: string;\n /** Control object */\n control: DeviceControl;\n socket: Connection;\n /** Control handler to set the state */\n controlHandler: (\n deviceId: string,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n /** Control handler to read the state */\n controlStateHandler: (deviceId: string, control: ControlBase) => () => Promise<ioBroker.State | null>;\n colors: { primary: string; secondary: string };\n disabled?: boolean;\n}\n\ninterface DeviceControlState {\n value?: ControlState;\n ts?: number;\n}\n\n/**\n * Device Control component\n */\nexport default class DeviceControlComponent extends Component<DeviceControlProps, DeviceControlState> {\n constructor(props: DeviceControlProps) {\n super(props);\n this.state = {\n value: props.control.state?.val,\n ts: props.control.state?.ts,\n };\n }\n\n async componentDidMount(): Promise<void> {\n if (this.props.control.stateId) {\n const mayBePromise = this.props.socket.subscribeState(this.props.control.stateId, this.stateHandler);\n if (mayBePromise instanceof Promise) {\n await mayBePromise;\n }\n }\n }\n\n stateHandler = async (id: string, state: ioBroker.State): Promise<void> => {\n if (id === this.props.control.stateId && state) {\n // request new state\n const newState: ioBroker.State | null = await this.props.controlStateHandler(\n this.props.deviceId,\n this.props.control,\n )();\n if (newState?.ts && (!this.state.ts || newState.ts > this.state.ts)) {\n this.setState({\n value: newState.val,\n ts: newState.ts,\n });\n }\n }\n };\n\n componentWillUnmount(): void {\n if (this.props.control.stateId) {\n this.props.socket.unsubscribeState(this.props.control.stateId, this.stateHandler);\n }\n }\n\n static getDerivedStateFromProps(\n props: DeviceControlProps,\n state: DeviceControlState,\n ): Partial<DeviceControlState> | null {\n if (props.control.state?.ts && (!state.ts || props.control.state?.ts > state.ts)) {\n return {\n value: props.control.state.val,\n ts: props.control.state.ts,\n };\n }\n\n return null;\n }\n\n async sendControl(deviceId: string, control: ControlBase, value: ControlState): Promise<void> {\n const result = await this.props.controlHandler(deviceId, control, value)();\n if (result?.ts && (!this.state.ts || result?.ts > this.state.ts)) {\n this.setState({\n value: result.val,\n ts: result.ts,\n });\n }\n }\n\n renderButton(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value);\n\n if (!this.props.control.label) {\n return (\n <Fab\n size=\"small\"\n disabled={this.props.disabled}\n title={tooltip}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, true)}\n >\n {icon}\n </Fab>\n );\n }\n return (\n <Button\n disabled={this.props.disabled}\n title={tooltip}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, true)}\n startIcon={icon}\n >\n {getTranslation(this.props.control.label)}\n </Button>\n );\n }\n\n renderSwitch(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n // const icon = renderIcon(this.props.control, this.props.colors, this.state.value);\n\n return (\n <Switch\n disabled={this.props.disabled}\n title={tooltip}\n checked={!!this.state.value}\n onChange={e => this.sendControl(this.props.deviceId, this.props.control, e.target.checked)}\n />\n );\n }\n\n getColor(): string | undefined {\n let color: string | undefined;\n if (this.state.value) {\n color = this.props.control.colorOn || 'primary';\n } else if (this.props.control.type === 'switch') {\n color = this.props.control.color;\n }\n if (color === 'primary') {\n return this.props.colors.primary;\n }\n if (color === 'secondary') {\n return this.props.colors.secondary;\n }\n return color;\n }\n\n // TODO: implement the following render methods\n // eslint-disable-next-line react/no-unused-class-component-methods,class-methods-use-this\n renderSelect(): JSX.Element | null {\n return null;\n }\n\n // eslint-disable-next-line react/no-unused-class-component-methods,class-methods-use-this\n renderSlider(): JSX.Element | null {\n return null;\n }\n\n // eslint-disable-next-line react/no-unused-class-component-methods,class-methods-use-this\n renderColor(): JSX.Element | null {\n return null;\n }\n\n renderIcon(): JSX.Element {\n const tooltip = getTranslation(this.props.control.description ?? '');\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value);\n const color = this.getColor();\n const style: React.CSSProperties | undefined =\n color === this.props.colors.primary || color === this.props.colors.secondary ? {} : { color };\n const colorProps =\n color === this.props.colors.primary\n ? 'primary'\n : color === this.props.colors.secondary\n ? 'secondary'\n : undefined;\n\n if (!this.props.control.label) {\n style.width = 34;\n style.height = 34;\n style.minHeight = 34;\n\n return (\n <Fab\n disabled={this.props.disabled}\n size=\"small\"\n title={tooltip}\n color={colorProps}\n style={style}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, !this.state.value)}\n >\n {icon}\n </Fab>\n );\n }\n return (\n <Button\n disabled={this.props.disabled}\n title={tooltip}\n color={colorProps}\n style={style}\n onClick={() => this.sendControl(this.props.deviceId, this.props.control, !this.state.value)}\n startIcon={icon}\n >\n {getTranslation(this.props.control.label)}\n </Button>\n );\n }\n\n render(): JSX.Element {\n if (this.props.control.type === 'button') {\n return this.renderButton();\n }\n\n if (this.props.control.type === 'icon') {\n return this.renderIcon();\n }\n\n if (this.props.control.type === 'switch') {\n return this.renderSwitch();\n }\n\n return <div style={{ color: 'red' }}>{this.props.control.type}</div>;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceImageUpload.js","sourceRoot":"./src/","sources":["DeviceImageUpload.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"DeviceImageUpload.js","sourceRoot":"./src/","sources":["DeviceImageUpload.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAYzE,SAAS,iBAAiB,CAAC,MAA8B;IACrD,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,sBAAsB,EAAE,GAAG,MAAM,CAAC;IAEhG,MAAM,iBAAiB,GAAyC,CAAC,KAAoC,EAAQ,EAAE;QAC3G,MAAM,MAAM,GAAG,KAAK,CAAC,MAA0B,CAAC;QAChD,MAAM,KAAK,GAAoB,MAAM,CAAC,KAAK,CAAC;QAC5C,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,OAAO;SACV;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,CAA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,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;wBAEpD,qFAAqF;wBACrF,MAAM,QAAQ,GAAG,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,QAAQ,EAAE,CAAC;wBACjF,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;wBACzE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,sBAAsB,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;wBACxF,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;wBAE/D,IAAI,aAAa,EAAE;4BACf,aAAa,CAAC,YAAY,CAAC,CAAC;yBAC/B;qBACJ;gBACL,CAAC,CAAC;YACN,CAAC,CAAC;YAEF,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;SAC9B;IACL,CAAC,CAAC;IAEF,MAAM,sBAAsB,GAAwB;QAChD,gDAAgD;QAChD,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,CAAC;KACZ,CAAC;IAEF,OAAO,CACH;QACI,+BACI,KAAK,EAAE,sBAAsB,EAC7B,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,SAAS,EAChB,QAAQ,EAAE,iBAAiB,GAC7B,CACA,CACT,CAAC;AACN,CAAC;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["import React, { type ChangeEvent, type ChangeEventHandler } from 'react';\nimport type { Connection } from '@iobroker/adapter-react-v5';\n\ninterface DeviceImageUploadProps {\n socket: Connection;\n manufacturer?: string;\n model?: string;\n deviceId: string;\n onImageSelect: (image: string) => void;\n uploadImagesToInstance: string;\n}\n\nfunction DeviceImageUpload(params: DeviceImageUploadProps): React.JSX.Element | null {\n const { socket, manufacturer, model, deviceId, onImageSelect, uploadImagesToInstance } = params;\n\n const handleImageUpload: ChangeEventHandler<HTMLInputElement> = (event: ChangeEvent<HTMLInputElement>): void => {\n const target = event.target as HTMLInputElement;\n const files: FileList | null = target.files;\n if (!files || files.length === 0) {\n return;\n }\n\n const file = files[0];\n\n if (file) {\n const reader = new FileReader();\n\n reader.onload = (e: ProgressEvent<FileReader>): void => {\n if (!e.target || !e.target.result) {\n return;\n }\n\n const img = new Image();\n img.src = e.target.result as string;\n\n img.onload = async () => {\n const maxWidth = 50;\n const maxHeight = 50;\n let width = img.width;\n let height = img.height;\n\n if (width > height) {\n if (width > maxWidth) {\n height *= maxWidth / width;\n width = maxWidth;\n }\n } else if (height > maxHeight) {\n width *= maxHeight / height;\n height = maxHeight;\n }\n\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n if (ctx) {\n canvas.width = width;\n canvas.height = height;\n ctx.drawImage(img, 0, 0, width, height);\n\n const resizedImage = canvas.toDataURL('image/webp');\n\n // Build the file name from a manufacturer and model, if not available, use device id\n const fileName = `${manufacturer ? `${manufacturer}_` : ''}${model || deviceId}`;\n const base64Data = resizedImage.replace(/^data:image\\/webp;base64,/, '');\n const response = await socket.writeFile64(uploadImagesToInstance, fileName, base64Data);\n console.log(`saveImage response: ${JSON.stringify(response)}`);\n\n if (onImageSelect) {\n onImageSelect(resizedImage);\n }\n }\n };\n };\n\n reader.readAsDataURL(file);\n }\n };\n\n const imageUploadButtonStyle: React.CSSProperties = {\n // make the button invisible but still clickable\n opacity: 0,\n position: 'absolute',\n width: '45px',\n height: '45px',\n zIndex: 3,\n };\n\n return (\n <div>\n <input\n style={imageUploadButtonStyle}\n type=\"file\"\n accept=\"image/*\"\n onChange={handleImageUpload}\n />\n </div>\n );\n}\n\nexport default DeviceImageUpload;\n"]}
|
package/build/DeviceList.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { IconButton, InputAdornment, TextField, Toolbar, Tooltip, LinearProgress } from '@mui/material';
|
|
3
3
|
import { Clear, Refresh } from '@mui/icons-material';
|
|
4
4
|
import { I18n } from '@iobroker/adapter-react-v5';
|
|
5
5
|
import DeviceCard from './DeviceCard';
|
|
6
6
|
import { getTranslation } from './Utils';
|
|
7
|
-
import Communication
|
|
7
|
+
import Communication from './Communication';
|
|
8
8
|
import InstanceActionButton from './InstanceActionButton';
|
|
9
9
|
import de from './i18n/de.json';
|
|
10
10
|
import en from './i18n/en.json';
|
package/build/DeviceList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceList.js","sourceRoot":"./src/","sources":["DeviceList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAExG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,aAAa,EAAE,EAAoD,MAAM,iBAAiB,CAAC;AAClG,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,E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E,CAAC;oBACZ,QAAQ,EAAE,MAAM;oBAChB,4BAA4B;oBAC5B,yBAAyB;oBACzB,mBAAmB;oBACnB,gBAAgB;oBAChB,aAAa;oBACb,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK;iBACtB;gBAEA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAC,cAAc,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAI,CAAC,CAAC,CAAC,IAAI;gBACxE,IAAI,CACH,CACJ,CACT,CAAC;IACN,CAAC","sourcesContent":["import React, { type JSX } from 'react';\nimport { IconButton, InputAdornment, TextField, Toolbar, Tooltip, LinearProgress } from '@mui/material';\n\nimport { Clear, Refresh } from '@mui/icons-material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\nimport type { DeviceInfo, InstanceDetails } from '@iobroker/dm-utils';\n\nimport DeviceCard from './DeviceCard';\nimport { getTranslation } from './Utils';\nimport Communication, { type CommunicationProps, type CommunicationState } from './Communication';\nimport InstanceActionButton from './InstanceActionButton';\n\nimport de from './i18n/de.json';\nimport en from './i18n/en.json';\nimport ru from './i18n/ru.json';\nimport pt from './i18n/pt.json';\nimport nl from './i18n/nl.json';\nimport fr from './i18n/fr.json';\nimport it from './i18n/it.json';\nimport es from './i18n/es.json';\nimport pl from './i18n/pl.json';\nimport uk from './i18n/uk.json';\nimport zhCn from './i18n/zh-cn.json';\n\ninterface DeviceListProps extends CommunicationProps {\n /** Instance to upload images to, like `adapterName.X` */\n uploadImagesToInstance?: string;\n /** Filter devices with this string */\n filter?: string;\n /** If this component is used in GUI with own toolbar. `false` if this list is used with multiple instances and true if only with one (in this case, it will monitor alive itself */\n embedded?: boolean;\n /** If embedded, this text is shown in the toolbar */\n title?: string;\n /** Style of a component that displays all devices */\n style?: React.CSSProperties;\n /** Use small cards for devices */\n smallCards?: boolean;\n}\n\ninterface DeviceListState extends CommunicationState {\n devices: DeviceInfo[];\n filteredDevices: DeviceInfo[];\n filter: string;\n instanceInfo: InstanceDetails;\n loading: boolean;\n alive: boolean | null;\n}\n\n/**\n * Device List Component\n */\nexport default class DeviceList extends Communication<DeviceListProps, DeviceListState> {\n static i18nInitialized = false;\n\n private lastPropsFilter: string | undefined;\n\n private lastInstance: string;\n\n private filterTimeout: ReturnType<typeof setTimeout> | null;\n\n private readonly language: ioBroker.Languages;\n\n constructor(props: DeviceListProps) {\n super(props);\n\n if (!DeviceList.i18nInitialized) {\n DeviceList.i18nInitialized = true;\n I18n.extendTranslations({\n en,\n de,\n ru,\n pt,\n nl,\n fr,\n it,\n es,\n pl,\n uk,\n 'zh-cn': zhCn,\n });\n }\n\n Object.assign(this.state, {\n devices: [],\n filteredDevices: [],\n filter: '',\n instanceInfo: null,\n loading: null,\n alive: null,\n });\n\n this.lastPropsFilter = this.props.filter;\n this.lastInstance = this.props.selectedInstance;\n this.filterTimeout = null;\n this.language = I18n.getLanguage();\n }\n\n async componentDidMount(): Promise<void> {\n let alive = false;\n if (this.state.alive === null) {\n try {\n // check if instance is alive\n const stateAlive = await this.props.socket.getState(\n `system.adapter.${this.props.selectedInstance}.alive`,\n );\n if (stateAlive?.val) {\n alive = true;\n }\n } catch (error) {\n console.error(error);\n }\n this.setState({ alive }, () =>\n this.props.socket.subscribeState(\n `system.adapter.${this.props.selectedInstance}.alive`,\n this.aliveHandler,\n ),\n );\n if (!alive) {\n return;\n }\n } else {\n alive = this.state.alive;\n }\n\n if (!this.props.embedded && alive) {\n try {\n const instanceInfo = await this.loadInstanceInfos();\n this.setState({ instanceInfo });\n } catch (error) {\n console.error(error);\n }\n }\n if (alive) {\n this.loadData();\n }\n }\n\n componentWillUnmount(): void {\n this.props.socket.unsubscribeState(`system.adapter.${this.props.selectedInstance}.alive`, this.aliveHandler);\n }\n\n aliveHandler: ioBroker.StateChangeHandler = (id: string, state: ioBroker.State | null | undefined): void => {\n if (id === `system.adapter.${this.props.selectedInstance}.alive`) {\n const alive = !!state?.val;\n if (alive !== this.state.alive) {\n this.setState({ alive }, () => {\n if (alive) {\n this.componentDidMount().catch(console.error);\n }\n });\n }\n }\n };\n\n /**\n * Load devices\n */\n override loadData(): void {\n this.setState({ loading: true }, async () => {\n console.log(`Loading devices for ${this.props.selectedInstance}...`);\n let devices: DeviceInfo[] = [];\n try {\n devices = await this.loadDevices();\n\n if (!devices || !Array.isArray(devices)) {\n console.error(\n `Message returned from sendTo() doesn't look like one from DeviceManagement, did you accidentally handle the message in your adapter? ${JSON.stringify(\n devices,\n )}`,\n );\n devices = [];\n }\n } catch (error) {\n console.error(error);\n devices = [];\n }\n\n this.setState({ devices, loading: false }, () => this.applyFilter());\n });\n }\n\n getText(text: ioBroker.StringOrTranslated): string {\n if (typeof text === 'object') {\n return text[this.language] || text.en;\n }\n\n return text;\n }\n\n applyFilter(): void {\n const filter = this.props.embedded ? this.props.filter : this.state.filter;\n\n // filter devices name\n if (filter) {\n const filteredDevices = this.state.devices.filter(device =>\n this.getText(device.name).toLowerCase().includes(filter.toLowerCase()),\n );\n this.setState({ filteredDevices });\n } else {\n this.setState({ filteredDevices: this.state.devices });\n }\n }\n\n handleFilterChange(filter: string): void {\n this.setState({ filter }, () => {\n if (this.filterTimeout) {\n clearTimeout(this.filterTimeout);\n }\n this.filterTimeout = setTimeout(() => {\n this.filterTimeout = null;\n this.applyFilter();\n }, 250);\n });\n }\n\n renderContent(): JSX.Element | JSX.Element[] | null {\n const emptyStyle: React.CSSProperties = {\n padding: 25,\n };\n\n if (this.props.embedded && this.lastPropsFilter !== this.props.filter) {\n this.lastPropsFilter = this.props.filter;\n setTimeout(() => this.applyFilter(), 50);\n }\n if (this.props.embedded && this.lastInstance !== this.props.selectedInstance) {\n this.lastInstance = this.props.selectedInstance;\n setTimeout(() => this.loadData(), 50);\n }\n\n let list;\n if (!this.props.embedded && !this.state.alive) {\n list = (\n <div style={emptyStyle}>\n <span>{getTranslation('instanceNotAlive')}</span>\n </div>\n );\n } else if (!this.state.devices.length && this.props.selectedInstance) {\n list = (\n <div style={emptyStyle}>\n <span>{getTranslation('noDevicesFoundText')}</span>\n </div>\n );\n } else if (this.state.devices.length && !this.state.filteredDevices.length) {\n list = (\n <div style={emptyStyle}>\n <span>{getTranslation('allDevicesFilteredOut')}</span>\n </div>\n );\n } else {\n list = this.state.filteredDevices.map(device => (\n <DeviceCard\n alive={!!this.state.alive}\n key={device.id}\n id={device.id}\n title={this.getText(device.name)}\n device={device}\n instanceId={this.props.selectedInstance}\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceHandler={this.deviceHandler}\n controlHandler={this.controlHandler}\n controlStateHandler={this.controlStateHandler}\n socket={this.props.socket}\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 ));\n }\n\n if (this.props.embedded) {\n return (\n <>\n {this.state.loading ? <LinearProgress style={{ width: '100%' }} /> : null}\n {list}\n </>\n );\n }\n\n return (\n <div style={{ width: '100%', height: '100%', overflow: 'hidden' }}>\n <Toolbar\n variant=\"dense\"\n style={{ backgroundColor: '#777', display: 'flex' }}\n >\n {this.props.title}\n {this.props.selectedInstance ? (\n <Tooltip\n title={getTranslation('refreshTooltip')}\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n >\n <span>\n <IconButton\n onClick={() => this.loadData()}\n disabled={!this.state.alive}\n size=\"small\"\n >\n <Refresh />\n </IconButton>\n </span>\n </Tooltip>\n ) : null}\n {this.state.alive && this.state.instanceInfo?.actions?.length ? (\n <div style={{ marginLeft: 20 }}>\n {this.state.instanceInfo.actions.map(action => (\n <InstanceActionButton\n key={action.id}\n action={action}\n instanceHandler={this.instanceHandler}\n />\n ))}\n </div>\n ) : null}\n\n <div style={{ flexGrow: 1 }} />\n\n {this.state.alive ? (\n <TextField\n variant=\"standard\"\n style={{ width: 200 }}\n size=\"small\"\n label={getTranslation('filterLabelText')}\n onChange={e => this.handleFilterChange(e.target.value)}\n value={this.state.filter}\n autoComplete=\"off\"\n slotProps={{\n input: {\n autoComplete: 'new-password',\n endAdornment: this.state.filter ? (\n <InputAdornment position=\"end\">\n <IconButton\n onClick={() => this.handleFilterChange('')}\n edge=\"end\"\n >\n <Clear />\n </IconButton>\n </InputAdornment>\n ) : null,\n },\n htmlInput: {\n autoComplete: 'off',\n },\n }}\n />\n ) : null}\n </Toolbar>\n <div\n style={{\n width: '100%',\n height: 'calc(100% - 56px)',\n marginTop: 8,\n overflow: 'auto',\n // justifyContent: 'center',\n // alignItems: 'stretch',\n // display: 'grid',\n // columnGap: 8,\n // rowGap: 8,\n ...this.props.style,\n }}\n >\n {this.state.loading ? <LinearProgress style={{ width: '100%' }} /> : null}\n {list}\n </div>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DeviceList.js","sourceRoot":"./src/","sources":["DeviceList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAExG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,C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,IAAI,CACH,CACJ,CACT,CAAC;IACN,CAAC","sourcesContent":["import React, { type JSX } from 'react';\nimport { IconButton, InputAdornment, TextField, Toolbar, Tooltip, LinearProgress } from '@mui/material';\n\nimport { Clear, Refresh } from '@mui/icons-material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\nimport type { DeviceInfo, InstanceDetails } from '@iobroker/dm-utils';\n\nimport DeviceCard from './DeviceCard';\nimport { getTranslation } from './Utils';\nimport Communication, { type CommunicationProps, type CommunicationState } from './Communication';\nimport InstanceActionButton from './InstanceActionButton';\n\nimport de from './i18n/de.json';\nimport en from './i18n/en.json';\nimport ru from './i18n/ru.json';\nimport pt from './i18n/pt.json';\nimport nl from './i18n/nl.json';\nimport fr from './i18n/fr.json';\nimport it from './i18n/it.json';\nimport es from './i18n/es.json';\nimport pl from './i18n/pl.json';\nimport uk from './i18n/uk.json';\nimport zhCn from './i18n/zh-cn.json';\n\ninterface DeviceListProps extends CommunicationProps {\n /** Instance to upload images to, like `adapterName.X` */\n uploadImagesToInstance?: string;\n /** Filter devices with this string */\n filter?: string;\n /** If this component is used in GUI with own toolbar. `false` if this list is used with multiple instances and true if only with one (in this case, it will monitor alive itself */\n embedded?: boolean;\n /** If embedded, this text is shown in the toolbar */\n title?: string;\n /** Style of a component that displays all devices */\n style?: React.CSSProperties;\n /** Use small cards for devices */\n smallCards?: boolean;\n}\n\ninterface DeviceListState extends CommunicationState {\n devices: DeviceInfo[];\n filteredDevices: DeviceInfo[];\n filter: string;\n instanceInfo: InstanceDetails;\n loading: boolean;\n alive: boolean | null;\n}\n\n/**\n * Device List Component\n */\nexport default class DeviceList extends Communication<DeviceListProps, DeviceListState> {\n static i18nInitialized = false;\n\n private lastPropsFilter: string | undefined;\n\n private lastInstance: string;\n\n private filterTimeout: ReturnType<typeof setTimeout> | null;\n\n private readonly language: ioBroker.Languages;\n\n constructor(props: DeviceListProps) {\n super(props);\n\n if (!DeviceList.i18nInitialized) {\n DeviceList.i18nInitialized = true;\n I18n.extendTranslations({\n en,\n de,\n ru,\n pt,\n nl,\n fr,\n it,\n es,\n pl,\n uk,\n 'zh-cn': zhCn,\n });\n }\n\n Object.assign(this.state, {\n devices: [],\n filteredDevices: [],\n filter: '',\n instanceInfo: null,\n loading: null,\n alive: null,\n });\n\n this.lastPropsFilter = this.props.filter;\n this.lastInstance = this.props.selectedInstance;\n this.filterTimeout = null;\n this.language = I18n.getLanguage();\n }\n\n async componentDidMount(): Promise<void> {\n let alive = false;\n if (this.state.alive === null) {\n try {\n // check if instance is alive\n const stateAlive = await this.props.socket.getState(\n `system.adapter.${this.props.selectedInstance}.alive`,\n );\n if (stateAlive?.val) {\n alive = true;\n }\n } catch (error) {\n console.error(error);\n }\n this.setState({ alive }, () =>\n this.props.socket.subscribeState(\n `system.adapter.${this.props.selectedInstance}.alive`,\n this.aliveHandler,\n ),\n );\n if (!alive) {\n return;\n }\n } else {\n alive = this.state.alive;\n }\n\n if (!this.props.embedded && alive) {\n try {\n const instanceInfo = await this.loadInstanceInfos();\n this.setState({ instanceInfo });\n } catch (error) {\n console.error(error);\n }\n }\n if (alive) {\n this.loadData();\n }\n }\n\n componentWillUnmount(): void {\n this.props.socket.unsubscribeState(`system.adapter.${this.props.selectedInstance}.alive`, this.aliveHandler);\n }\n\n aliveHandler: ioBroker.StateChangeHandler = (id: string, state: ioBroker.State | null | undefined): void => {\n if (id === `system.adapter.${this.props.selectedInstance}.alive`) {\n const alive = !!state?.val;\n if (alive !== this.state.alive) {\n this.setState({ alive }, () => {\n if (alive) {\n this.componentDidMount().catch(console.error);\n }\n });\n }\n }\n };\n\n /**\n * Load devices\n */\n override loadData(): void {\n this.setState({ loading: true }, async () => {\n console.log(`Loading devices for ${this.props.selectedInstance}...`);\n let devices: DeviceInfo[] = [];\n try {\n devices = await this.loadDevices();\n\n if (!devices || !Array.isArray(devices)) {\n console.error(\n `Message returned from sendTo() doesn't look like one from DeviceManagement, did you accidentally handle the message in your adapter? ${JSON.stringify(\n devices,\n )}`,\n );\n devices = [];\n }\n } catch (error) {\n console.error(error);\n devices = [];\n }\n\n this.setState({ devices, loading: false }, () => this.applyFilter());\n });\n }\n\n getText(text: ioBroker.StringOrTranslated): string {\n if (typeof text === 'object') {\n return text[this.language] || text.en;\n }\n\n return text;\n }\n\n applyFilter(): void {\n const filter = this.props.embedded ? this.props.filter : this.state.filter;\n\n // filter devices name\n if (filter) {\n const filteredDevices = this.state.devices.filter(device =>\n this.getText(device.name).toLowerCase().includes(filter.toLowerCase()),\n );\n this.setState({ filteredDevices });\n } else {\n this.setState({ filteredDevices: this.state.devices });\n }\n }\n\n handleFilterChange(filter: string): void {\n this.setState({ filter }, () => {\n if (this.filterTimeout) {\n clearTimeout(this.filterTimeout);\n }\n this.filterTimeout = setTimeout(() => {\n this.filterTimeout = null;\n this.applyFilter();\n }, 250);\n });\n }\n\n renderContent(): JSX.Element | JSX.Element[] | null {\n const emptyStyle: React.CSSProperties = {\n padding: 25,\n };\n\n if (this.props.embedded && this.lastPropsFilter !== this.props.filter) {\n this.lastPropsFilter = this.props.filter;\n setTimeout(() => this.applyFilter(), 50);\n }\n if (this.props.embedded && this.lastInstance !== this.props.selectedInstance) {\n this.lastInstance = this.props.selectedInstance;\n setTimeout(() => this.loadData(), 50);\n }\n\n let list;\n if (!this.props.embedded && !this.state.alive) {\n list = (\n <div style={emptyStyle}>\n <span>{getTranslation('instanceNotAlive')}</span>\n </div>\n );\n } else if (!this.state.devices.length && this.props.selectedInstance) {\n list = (\n <div style={emptyStyle}>\n <span>{getTranslation('noDevicesFoundText')}</span>\n </div>\n );\n } else if (this.state.devices.length && !this.state.filteredDevices.length) {\n list = (\n <div style={emptyStyle}>\n <span>{getTranslation('allDevicesFilteredOut')}</span>\n </div>\n );\n } else {\n list = this.state.filteredDevices.map(device => (\n <DeviceCard\n alive={!!this.state.alive}\n key={device.id}\n id={device.id}\n title={this.getText(device.name)}\n device={device}\n instanceId={this.props.selectedInstance}\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceHandler={this.deviceHandler}\n controlHandler={this.controlHandler}\n controlStateHandler={this.controlStateHandler}\n socket={this.props.socket}\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 ));\n }\n\n if (this.props.embedded) {\n return (\n <>\n {this.state.loading ? <LinearProgress style={{ width: '100%' }} /> : null}\n {list}\n </>\n );\n }\n\n return (\n <div style={{ width: '100%', height: '100%', overflow: 'hidden' }}>\n <Toolbar\n variant=\"dense\"\n style={{ backgroundColor: '#777', display: 'flex' }}\n >\n {this.props.title}\n {this.props.selectedInstance ? (\n <Tooltip\n title={getTranslation('refreshTooltip')}\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n >\n <span>\n <IconButton\n onClick={() => this.loadData()}\n disabled={!this.state.alive}\n size=\"small\"\n >\n <Refresh />\n </IconButton>\n </span>\n </Tooltip>\n ) : null}\n {this.state.alive && this.state.instanceInfo?.actions?.length ? (\n <div style={{ marginLeft: 20 }}>\n {this.state.instanceInfo.actions.map(action => (\n <InstanceActionButton\n key={action.id}\n action={action}\n instanceHandler={this.instanceHandler}\n />\n ))}\n </div>\n ) : null}\n\n <div style={{ flexGrow: 1 }} />\n\n {this.state.alive ? (\n <TextField\n variant=\"standard\"\n style={{ width: 200 }}\n size=\"small\"\n label={getTranslation('filterLabelText')}\n onChange={e => this.handleFilterChange(e.target.value)}\n value={this.state.filter}\n autoComplete=\"off\"\n slotProps={{\n input: {\n autoComplete: 'new-password',\n endAdornment: this.state.filter ? (\n <InputAdornment position=\"end\">\n <IconButton\n onClick={() => this.handleFilterChange('')}\n edge=\"end\"\n >\n <Clear />\n </IconButton>\n </InputAdornment>\n ) : null,\n },\n htmlInput: {\n autoComplete: 'off',\n },\n }}\n />\n ) : null}\n </Toolbar>\n <div\n style={{\n width: '100%',\n height: 'calc(100% - 56px)',\n marginTop: 8,\n overflow: 'auto',\n // justifyContent: 'center',\n // alignItems: 'stretch',\n // display: 'grid',\n // columnGap: 8,\n // rowGap: 8,\n ...this.props.style,\n }}\n >\n {this.state.loading ? <LinearProgress style={{ width: '100%' }} /> : null}\n {list}\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceStatus.js","sourceRoot":"./src/","sources":["DeviceStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EACH,IAAI,IAAI,QAAQ,EAChB,OAAO,IAAI,WAAW,EACtB,YAAY,IAAI,gBAAgB,EAChC,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,EAC1B,WAAW,IAAI,eAAe,EAC9B,YAAY,IAAI,gBAAgB,EAChC,OAAO,IAAI,WAAW,EACtB,iBAAiB,IAAI,qBAAqB,GAC7C,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,GAAwC;IAChD,OAAO,EAAE;QACL,aAAa,EAAE,MAAM;KACxB;CACJ,CAAC;AAKF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,MAAyB;IAC1D,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,MAAoB,CAAC;IAEzB,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,GAAG;YACL,UAAU,EAAE,MAAM,CAAC,MAAM;SAC5B,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,M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,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE;gBAE7C,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,IACzE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CACd,oBAAC,eAAe,IAAC,KAAK,EAAE,WAAW,GAAI,CAC1C,CAAC,CAAC,CAAC,CACA,oBAAC,gBAAgB,IAAC,KAAK,EAAE,cAAc,GAAI,CAC9C,CACC,CACA,CACR,CACT;QAEA,MAAM,CAAC,OAAO,IAAI,CACf,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,IAChD,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CACxE,oBAAC,OAAO,IACJ,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,EACrC,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE;YAE7C,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE;gBAC1E,oBAAC,WAAW,IAAC,KAAK,EAAE,gBAAgB,GAAI,CACtC,CACA,CACb,CAAC,CAAC,CAAC,CACA,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE;YAC1E,oBAAC,WAAW,IAAC,KAAK,EAAE,gBAAgB,GAAI,CACtC,CACT,CACC,CACT,CACC,CACT,CAAC;AACN,CAAC","sourcesContent":["import React from 'react';\nimport { Tooltip } from '@mui/material';\n\nimport {\n Link as LinkIcon,\n LinkOff as LinkOffIcon,\n NetworkCheck as NetworkCheckIcon,\n Battery20 as Battery20Icon,\n Battery30 as Battery30Icon,\n Battery50 as Battery50Icon,\n Battery60 as Battery60Icon,\n Battery80 as Battery80Icon,\n Battery90 as Battery90Icon,\n BatteryFull as BatteryFullIcon,\n BatteryAlert as BatteryAlertIcon,\n Warning as WarningIcon,\n BatteryCharging50 as BatteryCharging50Icon,\n} from '@mui/icons-material';\n\nimport type { DeviceStatus } from '@iobroker/dm-utils';\n\nimport { getTranslation } from './Utils';\n\nconst styles: Record<string, React.CSSProperties> = {\n tooltip: {\n pointerEvents: 'none',\n },\n};\n\ninterface DeviceStatusProps {\n status: DeviceStatus | null;\n}\n/**\n * Device Status component\n *\n * @param params - Parameters\n * @param params.status - Status object, e.g. { connection: 'connected', battery: 100, rssi: -50 }\n */\nexport default function DeviceStatus(params: DeviceStatusProps): React.JSX.Element | null {\n if (!params.status) {\n return null;\n }\n\n let status: DeviceStatus;\n\n if (typeof params.status === 'string') {\n status = {\n connection: params.status,\n };\n } else {\n status = params.status;\n }\n\n const iconStyleOK = {\n fill: '#00ac00',\n };\n const iconStyleNotOK = {\n fill: '#ff0000',\n };\n const iconStyleWarning = {\n fill: '#ff9900',\n };\n\n let batteryIconTooltip: React.ReactNode = null;\n if (typeof status.battery === 'number') {\n if (status.battery >= 96 && status.battery <= 100) {\n batteryIconTooltip = <BatteryFullIcon style={iconStyleOK} />;\n } else if (status.battery >= 90 && status.battery <= 95) {\n batteryIconTooltip = <Battery90Icon style={iconStyleOK} />;\n } else if (status.battery >= 80 && status.battery <= 89) {\n batteryIconTooltip = <Battery80Icon style={iconStyleOK} />;\n } else if (status.battery >= 60 && status.battery <= 79) {\n batteryIconTooltip = <Battery60Icon style={iconStyleOK} />;\n } else if (status.battery >= 50 && status.battery <= 59) {\n batteryIconTooltip = <Battery50Icon style={iconStyleOK} />;\n } else if (status.battery >= 30 && status.battery <= 49) {\n batteryIconTooltip = <Battery30Icon style={iconStyleOK} />;\n } else if (status.battery >= 20 && status.battery <= 29) {\n batteryIconTooltip = <Battery20Icon style={iconStyleNotOK} />;\n } else {\n batteryIconTooltip = <BatteryAlertIcon style={iconStyleNotOK} />;\n }\n }\n\n return (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {status.connection === 'connected' && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title={getTranslation('connectedIconTooltip')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n <LinkIcon style={iconStyleOK} />\n </div>\n </Tooltip>\n </div>\n )}\n\n {status.connection === 'disconnected' && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title={getTranslation('disconnectedIconTooltip')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n <LinkOffIcon style={iconStyleNotOK} />\n </div>\n </Tooltip>\n </div>\n )}\n\n {status.rssi && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title=\"RSSI\"\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n <NetworkCheckIcon />\n <p style={{ fontSize: 'small', margin: 0 }}>{status.rssi}</p>\n </div>\n </Tooltip>\n </div>\n )}\n\n {typeof status.battery === 'number' && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title={getTranslation('batteryTooltip')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n {batteryIconTooltip}\n <p style={{ fontSize: 'small', margin: 0 }}>{status.battery}%</p>\n </div>\n </Tooltip>\n </div>\n )}\n\n {typeof status.battery === 'string' && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title={getTranslation('batteryTooltip')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n {status.battery === 'charging' ? <BatteryCharging50Icon /> : <BatteryFullIcon />}\n {status.battery !== 'charging' ? (\n status.battery.includes('V') || status.battery.includes('mV') ? (\n <p style={{ fontSize: 'small', margin: 0 }}>{status.battery}</p>\n ) : (\n <p style={{ fontSize: 'small', margin: 0 }}>\n <span style={{ marginRight: 4 }}>{status.battery}</span>\n mV\n </p>\n )\n ) : null}\n </div>\n </Tooltip>\n </div>\n )}\n\n {typeof status.battery === 'boolean' && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title={getTranslation('batteryTooltip')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n {status.battery ? (\n <BatteryFullIcon style={iconStyleOK} />\n ) : (\n <BatteryAlertIcon style={iconStyleNotOK} />\n )}\n </div>\n </Tooltip>\n </div>\n )}\n\n {status.warning && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {typeof status.warning === 'string' || typeof status.warning === 'object' ? (\n <Tooltip\n title={getTranslation(status.warning)}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n <WarningIcon style={iconStyleWarning} />\n </div>\n </Tooltip>\n ) : (\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n <WarningIcon style={iconStyleWarning} />\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DeviceStatus.js","sourceRoot":"./src/","sources":["DeviceStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EACH,IAAI,IAAI,QAAQ,EAChB,OAAO,IAAI,WAAW,EACtB,YAAY,IAAI,gBAAgB,EAChC,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,EAC1B,SAAS,I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,EAAE,EAAE,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE;YAE7C,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE;gBAC1E,oBAAC,WAAW,IAAC,KAAK,EAAE,gBAAgB,GAAI,CACtC,CACA,CACb,CAAC,CAAC,CAAC,CACA,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE;YAC1E,oBAAC,WAAW,IAAC,KAAK,EAAE,gBAAgB,GAAI,CACtC,CACT,CACC,CACT,CACC,CACT,CAAC;AACN,CAAC","sourcesContent":["import React from 'react';\nimport { Tooltip } from '@mui/material';\n\nimport {\n Link as LinkIcon,\n LinkOff as LinkOffIcon,\n NetworkCheck as NetworkCheckIcon,\n Battery20 as Battery20Icon,\n Battery30 as Battery30Icon,\n Battery50 as Battery50Icon,\n Battery60 as Battery60Icon,\n Battery80 as Battery80Icon,\n Battery90 as Battery90Icon,\n BatteryFull as BatteryFullIcon,\n BatteryAlert as BatteryAlertIcon,\n Warning as WarningIcon,\n BatteryCharging50 as BatteryCharging50Icon,\n} from '@mui/icons-material';\n\nimport type { DeviceStatus } from '@iobroker/dm-utils';\n\nimport { getTranslation } from './Utils';\n\nconst styles: Record<string, React.CSSProperties> = {\n tooltip: {\n pointerEvents: 'none',\n },\n};\n\ninterface DeviceStatusProps {\n status: DeviceStatus | null;\n}\n/**\n * Device Status component\n *\n * @param params - Parameters\n * @param params.status - Status object, e.g. { connection: 'connected', battery: 100, rssi: -50 }\n */\nexport default function DeviceStatus(params: DeviceStatusProps): React.JSX.Element | null {\n if (!params.status) {\n return null;\n }\n\n let status: DeviceStatus;\n\n if (typeof params.status === 'string') {\n status = {\n connection: params.status,\n };\n } else {\n status = params.status;\n }\n\n const iconStyleOK = {\n fill: '#00ac00',\n };\n const iconStyleNotOK = {\n fill: '#ff0000',\n };\n const iconStyleWarning = {\n fill: '#ff9900',\n };\n\n let batteryIconTooltip: React.ReactNode = null;\n if (typeof status.battery === 'number') {\n if (status.battery >= 96 && status.battery <= 100) {\n batteryIconTooltip = <BatteryFullIcon style={iconStyleOK} />;\n } else if (status.battery >= 90 && status.battery <= 95) {\n batteryIconTooltip = <Battery90Icon style={iconStyleOK} />;\n } else if (status.battery >= 80 && status.battery <= 89) {\n batteryIconTooltip = <Battery80Icon style={iconStyleOK} />;\n } else if (status.battery >= 60 && status.battery <= 79) {\n batteryIconTooltip = <Battery60Icon style={iconStyleOK} />;\n } else if (status.battery >= 50 && status.battery <= 59) {\n batteryIconTooltip = <Battery50Icon style={iconStyleOK} />;\n } else if (status.battery >= 30 && status.battery <= 49) {\n batteryIconTooltip = <Battery30Icon style={iconStyleOK} />;\n } else if (status.battery >= 20 && status.battery <= 29) {\n batteryIconTooltip = <Battery20Icon style={iconStyleNotOK} />;\n } else {\n batteryIconTooltip = <BatteryAlertIcon style={iconStyleNotOK} />;\n }\n }\n\n return (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {status.connection === 'connected' && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title={getTranslation('connectedIconTooltip')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n <LinkIcon style={iconStyleOK} />\n </div>\n </Tooltip>\n </div>\n )}\n\n {status.connection === 'disconnected' && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title={getTranslation('disconnectedIconTooltip')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n <LinkOffIcon style={iconStyleNotOK} />\n </div>\n </Tooltip>\n </div>\n )}\n\n {status.rssi && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title=\"RSSI\"\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n <NetworkCheckIcon />\n <p style={{ fontSize: 'small', margin: 0 }}>{status.rssi}</p>\n </div>\n </Tooltip>\n </div>\n )}\n\n {typeof status.battery === 'number' && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title={getTranslation('batteryTooltip')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n {batteryIconTooltip}\n <p style={{ fontSize: 'small', margin: 0 }}>{status.battery}%</p>\n </div>\n </Tooltip>\n </div>\n )}\n\n {typeof status.battery === 'string' && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title={getTranslation('batteryTooltip')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n {status.battery === 'charging' ? <BatteryCharging50Icon /> : <BatteryFullIcon />}\n {status.battery !== 'charging' ? (\n status.battery.includes('V') || status.battery.includes('mV') ? (\n <p style={{ fontSize: 'small', margin: 0 }}>{status.battery}</p>\n ) : (\n <p style={{ fontSize: 'small', margin: 0 }}>\n <span style={{ marginRight: 4 }}>{status.battery}</span>\n mV\n </p>\n )\n ) : null}\n </div>\n </Tooltip>\n </div>\n )}\n\n {typeof status.battery === 'boolean' && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n <Tooltip\n title={getTranslation('batteryTooltip')}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n {status.battery ? (\n <BatteryFullIcon style={iconStyleOK} />\n ) : (\n <BatteryAlertIcon style={iconStyleNotOK} />\n )}\n </div>\n </Tooltip>\n </div>\n )}\n\n {status.warning && (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {typeof status.warning === 'string' || typeof status.warning === 'object' ? (\n <Tooltip\n title={getTranslation(status.warning)}\n slotProps={{ popper: { sx: styles.tooltip } }}\n >\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n <WarningIcon style={iconStyleWarning} />\n </div>\n </Tooltip>\n ) : (\n <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>\n <WarningIcon style={iconStyleWarning} />\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
|
package/build/JsonConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonConfig.js","sourceRoot":"./src/","sources":["JsonConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAwB,MAAM,uBAAuB,CAAC;AAelF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAwB;IACvD,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC7D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1C,IAAI,MAAM,KAAK,SAAS,EAAE
|
|
1
|
+
{"version":3,"file":"JsonConfig.js","sourceRoot":"./src/","sources":["JsonConfig.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAwB,MAAM,uBAAuB,CAAC;AAelF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAwB;IACvD,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC7D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1C,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,OAAO,IAAI,CAAC;KACf;IAED,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAEzD,OAAO,CACH;QACK,KAAK,IAAI,iCAAM,KAAK,CAAO;QAC5B,oBAAC,mBAAmB,IAChB,MAAM,EAAE,MAAgC,EACxC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,EAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,CAAC,KAA0B,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EACzD,QAAQ,QACR,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,YAAY,EACR,KAAK,CAAC,YAAY,KAAK,SAAS;gBAC5B,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY;gBAClD,CAAC,CAAC,KAAK,CAAC,YAAY,EAE5B,UAAU,EACN,KAAK,CAAC,UAAU,KAAK,SAAS;gBAC1B,CAAC,CAAE,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,UAAqB;gBAC1D,CAAC,CAAC,KAAK,CAAC,UAAU,GAE5B,CACH,CACN,CAAC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAkDE;AACN,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport type { Connection, AdminConnection, ThemeName, ThemeType, IobTheme } from '@iobroker/adapter-react-v5';\nimport { JsonConfigComponent, type ConfigItemPanel } from '@iobroker/json-config';\n\ninterface JsonConfigDmProps {\n instanceId: string;\n socket: Connection;\n schema: ConfigItemPanel;\n data: Record<string, any>;\n onChange: (data: Record<string, any>) => void;\n themeName: ThemeName;\n themeType: ThemeType;\n theme: IobTheme;\n isFloatComma?: boolean;\n dateFormat?: string;\n}\n\nexport default function JsonConfig(props: JsonConfigDmProps): React.JSX.Element | null {\n const { instanceId, socket, schema, data, onChange } = props;\n const [error, setError] = useState(false);\n\n if (schema === undefined) {\n return null;\n }\n\n const [adapterName, instance] = instanceId.split('.', 2);\n\n return (\n <>\n {error && <div>{error}</div>}\n <JsonConfigComponent\n socket={socket as any as AdminConnection}\n adapterName={adapterName}\n instance={parseInt(instance, 10)}\n schema={schema}\n data={data}\n onError={setError}\n onChange={(_data: Record<string, any>) => onChange(_data)}\n embedded\n themeName={props.themeName}\n themeType={props.themeType}\n theme={props.theme}\n isFloatComma={\n props.isFloatComma === undefined\n ? !!props.socket.systemConfig?.common.isFloatComma\n : props.isFloatComma\n }\n dateFormat={\n props.dateFormat === undefined\n ? (props.socket.systemConfig?.common.dateFormat as string)\n : props.dateFormat\n }\n />\n </>\n );\n\n /*\n JSON adapter config:\n className={classes.scroll}\n socket={socket}\n theme={this.props.theme}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\n adapterName={this.props.adapterName}\n instance={this.props.instance}\n isFloatComma={this.props.isFloatComma}\n dateFormat={this.props.dateFormat}\n schema={this.state.schema}\n common={this.state.common}\n data={this.state.data}\n updateData={this.state.updateData}\n onError={(error) => this.setState({ error })}\n onChange={(data, changed) => this.setState({ data, changed })}\n customs={{ configCustomEasyAccess: ConfigCustomEasyAccess }}\n Object custom:\n instanceObj={instanceObj}\n customObj={customObj}\n custom={true}\n className={ '' }\n adapterName={adapter}\n instance={parseInt(instance.split('.').pop(), 10) || 0}\n socket={this.props.socket}\n theme={this.props.theme}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\n multiEdit={this.props.objectIDs.length > 1}\n\n schema={this.jsonConfigs[adapter].json}\n data={data}\n onError={error =>\n this.setState({error}, () => this.props.onError && this.props.onError(error))}\n onValueChange={(attr, value) => {\n console.log(attr + ' => ' + value);\n const newValues = JSON.parse(JSON.stringify(this.state.newValues));\n newValues[instance] = newValues[instance] || {};\n if (this.commonConfig[instance][attr] === value) {\n delete newValues[instance][attr];\n if (!Object.keys(newValues[instance]).length) {\n delete newValues[instance];\n }\n } else {\n newValues[instance][attr] = value;\n }\n this.setState({newValues, hasChanges: this.isChanged(newValues)}, () =>\n this.props.onChange && this.props.onChange(this.state.hasChanges));\n }}\n */\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipButton.js","sourceRoot":"./src/","sources":["TooltipButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAUhE,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAyB;IAC3D,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE1D,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,IAAI,CACpB,oBAAC,UAAU,IACP,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,IAEvB,KAAK,CACG,CAChB,CAAC;IAEF,IAAI,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"TooltipButton.js","sourceRoot":"./src/","sources":["TooltipButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAUhE,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAyB;IAC3D,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE1D,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,IAAI,CACpB,oBAAC,UAAU,IACP,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,IAEvB,KAAK,CACG,CAChB,CAAC;IAEF,IAAI,OAAO,EAAE;QACT,OAAO,CACH,oBAAC,OAAO,IACJ,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,EAAE;YAExD;gBACI,oBAAC,UAAU,IACP,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO;oBAEX,IAAI;oBACJ,IAAI,CACI,CACV,CACD,CACb,CAAC;KACL;IAED,OAAO,CACH,oBAAC,UAAU,IACP,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO;QAEX,IAAI;QACJ,IAAI,CACI,CAChB,CAAC;AACN,CAAC","sourcesContent":["import React from 'react';\nimport { IconButton, Tooltip, Typography } from '@mui/material';\n\ninterface TooltipButtonProps {\n tooltip?: string;\n label?: string;\n disabled?: boolean;\n Icon: React.JSX.Element | null;\n onClick?: () => void;\n}\n\nexport default function TooltipButton(props: TooltipButtonProps): React.JSX.Element {\n const { tooltip, label, disabled, Icon, onClick } = props;\n\n const text = !!label && (\n <Typography\n variant=\"button\"\n style={{ marginLeft: 4 }}\n >\n {label}\n </Typography>\n );\n\n if (tooltip) {\n return (\n <Tooltip\n title={tooltip}\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n >\n <span>\n <IconButton\n onClick={onClick}\n disabled={disabled}\n size=\"small\"\n >\n {Icon}\n {text}\n </IconButton>\n </span>\n </Tooltip>\n );\n }\n\n return (\n <IconButton\n onClick={onClick}\n disabled={disabled}\n size=\"small\"\n >\n {Icon}\n {text}\n </IconButton>\n );\n}\n"]}
|
package/build/Utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"./src/","sources":["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C,IAAI,IACD,GAAG,EAAE,MAAM,CAAC,IAAI,EAChB,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,GAChC,CACL,CAAC;IACN,CAAC;IACD,OAAO,aAAa,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC;AAED,IAAI,QAA4B,CAAC;AAEjC;;GAEG;AACH,MAAM,UAAU,cAAc;AAC1B,wBAAwB;AACxB,IAAiC;IAEjC,QAAQ,GAAG,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;IAE1C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC;IACrC,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC","sourcesContent":["import React from 'react';\n\nimport type { ControlBase } from '@iobroker/dm-utils/build/types/base';\nimport type { ActionBase } from '@iobroker/dm-utils/build/types/api';\nimport {\n Add,\n Bluetooth,\n BluetoothDisabled,\n Delete,\n Edit,\n FastForward,\n FastRewind,\n Fluorescent,\n Group,\n Lightbulb,\n Link as LinkIcon,\n LinkOff,\n NotListedLocation,\n Pause,\n Person,\n PlayArrow,\n Power,\n QrCode,\n QuestionMark,\n Refresh,\n Search,\n Settings,\n Stop,\n Visibility,\n WbIncandescent,\n Wifi,\n WifiOff,\n} from '@mui/icons-material';\n\nimport { I18n, Icon } from '@iobroker/adapter-react-v5';\n\nfunction getFaIcon(icon: string, color?: string): React.JSX.Element | null {\n const iconStyle = icon\n .split(' ')\n .map(s => s.trim())\n .filter(s => s !== 'fa-solid');\n\n if (iconStyle.includes('fa-trash-can') || iconStyle.includes('fa-trash')) {\n return <Delete style={{ color }} />;\n }\n if (iconStyle.includes('fa-pen')) {\n return <Edit style={{ color }} />;\n }\n if (iconStyle.includes('fa-redo-alt')) {\n return <Refresh style={{ color }} />;\n }\n if (iconStyle.includes('fa-plus')) {\n return <Add style={{ color }} />;\n }\n if (iconStyle.includes('fa-qrcode') || iconStyle.includes('qrcode')) {\n return <QrCode style={{ color }} />;\n }\n if (iconStyle.includes('fa-wifi')) {\n return <Wifi style={{ color }} />;\n }\n if (iconStyle.includes('fa-wifi-slash')) {\n return <WifiOff style={{ color }} />;\n }\n if (iconStyle.includes('fa-bluetooth')) {\n return <Bluetooth style={{ color }} />;\n }\n if (iconStyle.includes('fa-bluetooth-slash')) {\n return <BluetoothDisabled style={{ color }} />;\n }\n if (iconStyle.includes('fa-eye')) {\n return <Visibility style={{ color }} />;\n }\n if (iconStyle.includes('fa-search')) {\n return <Search style={{ color }} />;\n }\n if (iconStyle.includes('fa-unlink')) {\n return <LinkOff style={{ color }} />;\n }\n if (iconStyle.includes('fa-link')) {\n return <LinkIcon style={{ color }} />;\n }\n if (iconStyle.includes('fa-search-location')) {\n return <NotListedLocation style={{ color }} />;\n }\n if (iconStyle.includes('fa-play')) {\n return <PlayArrow style={{ color }} />;\n }\n if (iconStyle.includes('fa-stop')) {\n return <Stop style={{ color }} />;\n }\n if (iconStyle.includes('fa-pause')) {\n return <Pause style={{ color }} />;\n }\n if (iconStyle.includes('forward')) {\n return <FastForward style={{ color }} />;\n }\n if (iconStyle.includes('rewind')) {\n return <FastRewind style={{ color }} />;\n }\n if (iconStyle.includes('users') || iconStyle.includes('group')) {\n return <Group style={{ color }} />;\n }\n if (iconStyle.includes('user')) {\n return <Person style={{ color }} />;\n }\n return <QuestionMark style={{ color }} />;\n}\n\nfunction getIconByName(name: string, color?: string): React.JSX.Element | null {\n if (name === 'edit' || name === 'rename') {\n return <Edit style={{ color }} />;\n }\n if (name === 'delete') {\n return <Delete style={{ color }} />;\n }\n if (name === 'refresh') {\n return <Refresh style={{ color }} />;\n }\n if (name === 'newDevice' || name === 'new' || name === 'add') {\n return <Add style={{ color }} />;\n }\n if (name === 'discover' || name === 'search') {\n return <Search style={{ color }} />;\n }\n if (name === 'unpairDevice' || name === 'unpair') {\n return <LinkOff style={{ color }} />;\n }\n if (name === 'pairDevice' || name === 'pair') {\n return <LinkIcon style={{ color }} />;\n }\n if (name === 'identify') {\n return <NotListedLocation style={{ color }} />;\n }\n if (name === 'play') {\n return <PlayArrow style={{ color }} />;\n }\n if (name === 'stop') {\n return <Stop style={{ color }} />;\n }\n if (name === 'pause') {\n return <Pause style={{ color }} />;\n }\n if (name === 'forward' || name === 'next') {\n return <FastForward style={{ color }} />;\n }\n if (name === 'rewind' || name === 'previous') {\n return <FastRewind style={{ color }} />;\n }\n if (name === 'lamp' || name === 'light') {\n return <Lightbulb style={{ color }} />;\n }\n if (name === 'backlight') {\n return <Fluorescent style={{ color }} />;\n }\n if (name === 'dimmer') {\n return <WbIncandescent style={{ color }} />;\n }\n if (name === 'socket') {\n return <Power style={{ color }} />;\n }\n if (name === 'settings') {\n return <Settings style={{ color }} />;\n }\n if (name === 'users' || name === 'group') {\n return <Group style={{ color }} />;\n }\n if (name === 'user') {\n return <Person style={{ color }} />;\n }\n return <QuestionMark style={{ color }} />;\n}\n\nexport function renderControlIcon(\n action: ControlBase,\n colors?: { primary: string; secondary: string },\n value?: string | number | boolean | null,\n): React.JSX.Element | null {\n if (!action) {\n return null;\n }\n\n let color = (value && action.colorOn) || action.color || (action.state ? 'primary' : 'inherit');\n\n if (colors) {\n if (color === 'primary') {\n color = colors.primary;\n } else if (color === 'secondary') {\n color = colors.secondary;\n }\n }\n\n if (action.icon?.startsWith('fa-') || action.icon?.startsWith('fas')) {\n return getFaIcon(action.icon, color);\n }\n if (value && action.iconOn?.startsWith('data:image')) {\n return (\n <Icon\n src={action.iconOn}\n style={{ color }}\n />\n );\n }\n if (action.icon?.startsWith('data:image')) {\n return (\n <Icon\n src={action.icon}\n style={{ color }}\n />\n );\n }\n return getIconByName(action.id, color);\n}\n\nexport function renderActionIcon(action: ActionBase): React.JSX.Element | null {\n if (!action) {\n return null;\n }\n\n if (action.icon?.startsWith('fa-') || action.icon?.startsWith('fas')) {\n return getFaIcon(action.icon, action.color);\n }\n if (action.icon?.startsWith('data:image')) {\n return (\n <Icon\n src={action.icon}\n style={{ color: action.color }}\n />\n );\n }\n return getIconByName(action.id, action.color);\n}\n\nlet language: ioBroker.Languages;\n\n/**\n * Get Translation\n */\nexport function getTranslation(\n /** Text to translate */\n text: ioBroker.StringOrTranslated,\n): string {\n language = language || I18n.getLanguage();\n\n if (typeof text === 'object') {\n return text[language] || text.en;\n }\n\n return I18n.t(text);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"./src/","sources":["Utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EACH,GAAG,EACH,SAAS,EACT,iBAAiB,EACjB,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,WAAW,EACX,KAAK,EACL,SAAS,EACT,IAAI,IAAI,QAAQ,EAChB,OAAO,EACP,iBAAiB,EACjB,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,OAAO,EACP,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,cAAc,EACd,IAAI,EACJ,OAAO,GACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAExD,SAAS,SAAS,CAAC,IAAY,EAAE,KAAc;IAC3C,MAAM,SAAS,GAAG,IAAI;SACjB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SAClB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC;IAEnC,IAAI,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;QACtE,OAAO,oBAAC,M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IAAI,QAA4B,CAAC;AAEjC;;GAEG;AACH,MAAM,UAAU,cAAc;AAC1B,wBAAwB;AACxB,IAAiC;IAEjC,QAAQ,GAAG,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;IAE1C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC;KACpC;IAED,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC","sourcesContent":["import React from 'react';\n\nimport type { ControlBase } from '@iobroker/dm-utils/build/types/base';\nimport type { ActionBase } from '@iobroker/dm-utils/build/types/api';\nimport {\n Add,\n Bluetooth,\n BluetoothDisabled,\n Delete,\n Edit,\n FastForward,\n FastRewind,\n Fluorescent,\n Group,\n Lightbulb,\n Link as LinkIcon,\n LinkOff,\n NotListedLocation,\n Pause,\n Person,\n PlayArrow,\n Power,\n QrCode,\n QuestionMark,\n Refresh,\n Search,\n Settings,\n Stop,\n Visibility,\n WbIncandescent,\n Wifi,\n WifiOff,\n} from '@mui/icons-material';\n\nimport { I18n, Icon } from '@iobroker/adapter-react-v5';\n\nfunction getFaIcon(icon: string, color?: string): React.JSX.Element | null {\n const iconStyle = icon\n .split(' ')\n .map(s => s.trim())\n .filter(s => s !== 'fa-solid');\n\n if (iconStyle.includes('fa-trash-can') || iconStyle.includes('fa-trash')) {\n return <Delete style={{ color }} />;\n }\n if (iconStyle.includes('fa-pen')) {\n return <Edit style={{ color }} />;\n }\n if (iconStyle.includes('fa-redo-alt')) {\n return <Refresh style={{ color }} />;\n }\n if (iconStyle.includes('fa-plus')) {\n return <Add style={{ color }} />;\n }\n if (iconStyle.includes('fa-qrcode') || iconStyle.includes('qrcode')) {\n return <QrCode style={{ color }} />;\n }\n if (iconStyle.includes('fa-wifi')) {\n return <Wifi style={{ color }} />;\n }\n if (iconStyle.includes('fa-wifi-slash')) {\n return <WifiOff style={{ color }} />;\n }\n if (iconStyle.includes('fa-bluetooth')) {\n return <Bluetooth style={{ color }} />;\n }\n if (iconStyle.includes('fa-bluetooth-slash')) {\n return <BluetoothDisabled style={{ color }} />;\n }\n if (iconStyle.includes('fa-eye')) {\n return <Visibility style={{ color }} />;\n }\n if (iconStyle.includes('fa-search')) {\n return <Search style={{ color }} />;\n }\n if (iconStyle.includes('fa-unlink')) {\n return <LinkOff style={{ color }} />;\n }\n if (iconStyle.includes('fa-link')) {\n return <LinkIcon style={{ color }} />;\n }\n if (iconStyle.includes('fa-search-location')) {\n return <NotListedLocation style={{ color }} />;\n }\n if (iconStyle.includes('fa-play')) {\n return <PlayArrow style={{ color }} />;\n }\n if (iconStyle.includes('fa-stop')) {\n return <Stop style={{ color }} />;\n }\n if (iconStyle.includes('fa-pause')) {\n return <Pause style={{ color }} />;\n }\n if (iconStyle.includes('forward')) {\n return <FastForward style={{ color }} />;\n }\n if (iconStyle.includes('rewind')) {\n return <FastRewind style={{ color }} />;\n }\n if (iconStyle.includes('users') || iconStyle.includes('group')) {\n return <Group style={{ color }} />;\n }\n if (iconStyle.includes('user')) {\n return <Person style={{ color }} />;\n }\n return <QuestionMark style={{ color }} />;\n}\n\nfunction getIconByName(name: string, color?: string): React.JSX.Element | null {\n if (name === 'edit' || name === 'rename') {\n return <Edit style={{ color }} />;\n }\n if (name === 'delete') {\n return <Delete style={{ color }} />;\n }\n if (name === 'refresh') {\n return <Refresh style={{ color }} />;\n }\n if (name === 'newDevice' || name === 'new' || name === 'add') {\n return <Add style={{ color }} />;\n }\n if (name === 'discover' || name === 'search') {\n return <Search style={{ color }} />;\n }\n if (name === 'unpairDevice' || name === 'unpair') {\n return <LinkOff style={{ color }} />;\n }\n if (name === 'pairDevice' || name === 'pair') {\n return <LinkIcon style={{ color }} />;\n }\n if (name === 'identify') {\n return <NotListedLocation style={{ color }} />;\n }\n if (name === 'play') {\n return <PlayArrow style={{ color }} />;\n }\n if (name === 'stop') {\n return <Stop style={{ color }} />;\n }\n if (name === 'pause') {\n return <Pause style={{ color }} />;\n }\n if (name === 'forward' || name === 'next') {\n return <FastForward style={{ color }} />;\n }\n if (name === 'rewind' || name === 'previous') {\n return <FastRewind style={{ color }} />;\n }\n if (name === 'lamp' || name === 'light') {\n return <Lightbulb style={{ color }} />;\n }\n if (name === 'backlight') {\n return <Fluorescent style={{ color }} />;\n }\n if (name === 'dimmer') {\n return <WbIncandescent style={{ color }} />;\n }\n if (name === 'socket') {\n return <Power style={{ color }} />;\n }\n if (name === 'settings') {\n return <Settings style={{ color }} />;\n }\n if (name === 'users' || name === 'group') {\n return <Group style={{ color }} />;\n }\n if (name === 'user') {\n return <Person style={{ color }} />;\n }\n return <QuestionMark style={{ color }} />;\n}\n\nexport function renderControlIcon(\n action: ControlBase,\n colors?: { primary: string; secondary: string },\n value?: string | number | boolean | null,\n): React.JSX.Element | null {\n if (!action) {\n return null;\n }\n\n let color = (value && action.colorOn) || action.color || (action.state ? 'primary' : 'inherit');\n\n if (colors) {\n if (color === 'primary') {\n color = colors.primary;\n } else if (color === 'secondary') {\n color = colors.secondary;\n }\n }\n\n if (action.icon?.startsWith('fa-') || action.icon?.startsWith('fas')) {\n return getFaIcon(action.icon, color);\n }\n if (value && action.iconOn?.startsWith('data:image')) {\n return (\n <Icon\n src={action.iconOn}\n style={{ color }}\n />\n );\n }\n if (action.icon?.startsWith('data:image')) {\n return (\n <Icon\n src={action.icon}\n style={{ color }}\n />\n );\n }\n return getIconByName(action.id, color);\n}\n\nexport function renderActionIcon(action: ActionBase): React.JSX.Element | null {\n if (!action) {\n return null;\n }\n\n if (action.icon?.startsWith('fa-') || action.icon?.startsWith('fas')) {\n return getFaIcon(action.icon, action.color);\n }\n if (action.icon?.startsWith('data:image')) {\n return (\n <Icon\n src={action.icon}\n style={{ color: action.color }}\n />\n );\n }\n return getIconByName(action.id, action.color);\n}\n\nlet language: ioBroker.Languages;\n\n/**\n * Get Translation\n */\nexport function getTranslation(\n /** Text to translate */\n text: ioBroker.StringOrTranslated,\n): string {\n language = language || I18n.getLanguage();\n\n if (typeof text === 'object') {\n return text[language] || text.en;\n }\n\n return I18n.t(text);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/dm-gui-components",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "ReactJS components to develop admin interface for ioBroker device manager.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jey Cee",
|
|
@@ -48,19 +48,12 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/ioBroker/dm-gui-components#readme",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@iobroker/adapter-react-v5": "7.
|
|
52
|
-
"@iobroker/json-config": "7.
|
|
51
|
+
"@iobroker/adapter-react-v5": "7.3.0",
|
|
52
|
+
"@iobroker/json-config": "7.3.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@craco/craco": "^7.1.0",
|
|
56
|
-
"@iobroker/dm-utils": "^0.5.0"
|
|
57
|
-
"@iobroker/eslint-config": "^0.1.6",
|
|
58
|
-
"@iobroker/types": "^7.0.0",
|
|
59
|
-
"@types/react": "^18.3.11",
|
|
60
|
-
"@types/react-dom": "^18.3.0",
|
|
61
|
-
"react": "^18.3.1",
|
|
62
|
-
"react-dom": "^18.3.1",
|
|
63
|
-
"typescript": "^5.6.2"
|
|
56
|
+
"@iobroker/dm-utils": "^0.5.0"
|
|
64
57
|
},
|
|
65
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "03429207817dd73c3271dabeabcafe71a0a595a7"
|
|
66
59
|
}
|