@iobroker/dm-gui-components 7.4.7 → 7.4.8

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.
@@ -253,7 +253,7 @@ class DeviceCard extends Component {
253
253
  const titleStyle = {
254
254
  fontSize: 16,
255
255
  fontWeight: 'bold',
256
- whiteSpace: 'nowrap',
256
+ // whiteSpace: 'nowrap',
257
257
  overflow: 'hidden',
258
258
  textOverflow: 'ellipsis',
259
259
  };
@@ -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,EAEL,IAAI,EAIJ,cAAc,GACjB,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;AAGzC,SAAS,WAAW,CAAC,KAA0D;IAC3E,OAAO,CACH,6BACI,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,KAAK,EAAE,KAAK,CAAC,KAAK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AAM,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 type Connection,\n I18n,\n type ThemeName,\n type ThemeType,\n type IobTheme,\n IconDeviceType,\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';\nimport type { ConfigItemPanel, ConfigItemTabs } from '@iobroker/json-config';\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 as ConfigItemPanel | ConfigItemTabs}\n data={this.state.data}\n onChange={(data: Record<string, any>) => this.setState({ data })}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\n theme={this.props.theme}\n isFloatComma={this.props.isFloatComma}\n dateFormat={this.props.dateFormat}\n />\n </DialogContent>\n <DialogActions>\n <Button\n disabled={!this.props.alive}\n variant=\"contained\"\n color=\"primary\"\n onClick={() => this.setState({ open: false })}\n autoFocus\n >\n {getTranslation('closeButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderControlDialog(): JSX.Element | null {\n if (!this.state.showControlDialog || !this.props.alive) {\n return null;\n }\n const colors = { primary: '#111', secondary: '#888' };\n return (\n <Dialog\n open={!0}\n onClose={() => this.setState({ showControlDialog: false })}\n >\n <DialogTitle>\n {this.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 const icon = this.state.icon ? <IconDeviceType src={this.state.icon} /> : <NoImageIcon />;\n\n return (\n <Card\n sx={{\n maxWidth: 345,\n minWidth: 200,\n }}\n >\n <CardHeader\n sx={theme => ({\n backgroundColor:\n this.props.device.color === 'primary'\n ? theme.palette.primary.main\n : theme.palette.secondary.main === 'secondary'\n ? theme.palette.secondary.main\n : this.props.device.color || theme.palette.secondary.main,\n color:\n this.props.device.color &&\n this.props.device.color !== 'primary' &&\n this.props.device.color !== 'secondary'\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 {icon}\n </div>\n }\n action={\n hasDetails ? (\n <IconButton\n aria-label=\"settings\"\n onClick={() => {\n if (!this.state.open) {\n this.loadDetails().catch(console.error);\n this.setState({ open: true });\n }\n }}\n >\n <MoreVertIcon />\n </IconButton>\n ) : null\n }\n title={this.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 alignItems: 'center',\n gap: 8,\n paddingLeft: 8,\n paddingRight: 8,\n position: 'relative',\n minHeight: 60,\n color: '#000',\n };\n const imgAreaStyle: React.CSSProperties = {\n height: 45,\n width: 45,\n justifyContent: 'center',\n display: 'flex',\n alignItems: 'center',\n };\n const imgStyle: React.CSSProperties = {\n zIndex: 2,\n maxWidth: '100%',\n maxHeight: '100%',\n color: '#FFF',\n };\n const titleStyle: React.CSSProperties = {\n fontSize: 16,\n fontWeight: 'bold',\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 const icon = this.state.icon ? (\n <IconDeviceType\n src={this.state.icon}\n style={imgStyle}\n />\n ) : (\n <NoImageIcon style={imgStyle} />\n );\n\n const title: string = this.state.details?.data?.name || this.props.title || '';\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 </div>\n <Box\n style={titleStyle}\n title={title.length > 20 ? title : undefined}\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":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,EAE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E,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CACtC,CACT,CAAC,CAAC,CAAC,IAAI;oBACP,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CACvB;wBACI,2BAAG,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE;4BAAG,cAAc,CAAC,OAAO,CAAC;gCAAM;wBAC3D,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAC/B,CACT,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 type Connection,\n I18n,\n type ThemeName,\n type ThemeType,\n type IobTheme,\n IconDeviceType,\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';\nimport type { ConfigItemPanel, ConfigItemTabs } from '@iobroker/json-config';\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 as ConfigItemPanel | ConfigItemTabs}\n data={this.state.data}\n onChange={(data: Record<string, any>) => this.setState({ data })}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\n theme={this.props.theme}\n isFloatComma={this.props.isFloatComma}\n dateFormat={this.props.dateFormat}\n />\n </DialogContent>\n <DialogActions>\n <Button\n disabled={!this.props.alive}\n variant=\"contained\"\n color=\"primary\"\n onClick={() => this.setState({ open: false })}\n autoFocus\n >\n {getTranslation('closeButtonText')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n\n renderControlDialog(): JSX.Element | null {\n if (!this.state.showControlDialog || !this.props.alive) {\n return null;\n }\n const colors = { primary: '#111', secondary: '#888' };\n return (\n <Dialog\n open={!0}\n onClose={() => this.setState({ showControlDialog: false })}\n >\n <DialogTitle>\n {this.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 const icon = this.state.icon ? <IconDeviceType src={this.state.icon} /> : <NoImageIcon />;\n\n return (\n <Card\n sx={{\n maxWidth: 345,\n minWidth: 200,\n }}\n >\n <CardHeader\n sx={theme => ({\n backgroundColor:\n this.props.device.color === 'primary'\n ? theme.palette.primary.main\n : theme.palette.secondary.main === 'secondary'\n ? theme.palette.secondary.main\n : this.props.device.color || theme.palette.secondary.main,\n color:\n this.props.device.color &&\n this.props.device.color !== 'primary' &&\n this.props.device.color !== 'secondary'\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 {icon}\n </div>\n }\n action={\n hasDetails ? (\n <IconButton\n aria-label=\"settings\"\n onClick={() => {\n if (!this.state.open) {\n this.loadDetails().catch(console.error);\n this.setState({ open: true });\n }\n }}\n >\n <MoreVertIcon />\n </IconButton>\n ) : null\n }\n title={this.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 alignItems: 'center',\n gap: 8,\n paddingLeft: 8,\n paddingRight: 8,\n position: 'relative',\n minHeight: 60,\n color: '#000',\n };\n const imgAreaStyle: React.CSSProperties = {\n height: 45,\n width: 45,\n justifyContent: 'center',\n display: 'flex',\n alignItems: 'center',\n };\n const imgStyle: React.CSSProperties = {\n zIndex: 2,\n maxWidth: '100%',\n maxHeight: '100%',\n color: '#FFF',\n };\n const titleStyle: React.CSSProperties = {\n fontSize: 16,\n fontWeight: 'bold',\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 const icon = this.state.icon ? (\n <IconDeviceType\n src={this.state.icon}\n style={imgStyle}\n />\n ) : (\n <NoImageIcon style={imgStyle} />\n );\n\n const title: string = this.state.details?.data?.name || this.props.title || '';\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 </div>\n <Box\n style={titleStyle}\n title={title.length > 20 ? title : undefined}\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/dm-gui-components",
3
- "version": "7.4.7",
3
+ "version": "7.4.8",
4
4
  "description": "ReactJS components to develop admin interface for ioBroker device manager.",
5
5
  "author": {
6
6
  "name": "Jey Cee",
@@ -48,12 +48,12 @@
48
48
  },
49
49
  "homepage": "https://github.com/ioBroker/dm-gui-components#readme",
50
50
  "dependencies": {
51
- "@iobroker/adapter-react-v5": "7.4.7",
52
- "@iobroker/json-config": "7.4.7"
51
+ "@iobroker/adapter-react-v5": "7.4.8",
52
+ "@iobroker/json-config": "7.4.8"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@craco/craco": "^7.1.0",
56
56
  "@iobroker/dm-utils": "^0.6.11"
57
57
  },
58
- "gitHead": "6bd5a2c67f60347c4054f97d65ff3a3d183c259d"
58
+ "gitHead": "fa6c5eb306823b8051a913ca98af3a37b429a1f6"
59
59
  }