@iobroker/dm-gui-components 10.0.22 → 10.1.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/README.md +13 -0
- package/build/AnimatedIcons.d.ts +37 -0
- package/build/AnimatedIcons.js +108 -0
- package/build/AnimatedIcons.js.map +1 -0
- package/build/Communication.d.ts +7 -0
- package/build/Communication.js +43 -11
- package/build/Communication.js.map +1 -1
- package/build/DeviceCard.d.ts +25 -13
- package/build/DeviceCard.js +177 -282
- package/build/DeviceCard.js.map +1 -1
- package/build/DeviceControl.js +38 -26
- package/build/DeviceControl.js.map +1 -1
- package/build/DeviceImageUpload.d.ts +5 -1
- package/build/DeviceImageUpload.js +79 -62
- package/build/DeviceImageUpload.js.map +1 -1
- package/build/DeviceList.d.ts +8 -0
- package/build/DeviceList.js +74 -59
- package/build/DeviceList.js.map +1 -1
- package/build/DeviceStatus.d.ts +20 -4
- package/build/DeviceStatus.js +146 -191
- package/build/DeviceStatus.js.map +1 -1
- package/build/StatusIndicator.js +9 -37
- package/build/StatusIndicator.js.map +1 -1
- package/build/StatusPill.d.ts +18 -0
- package/build/StatusPill.js +30 -0
- package/build/StatusPill.js.map +1 -0
- package/build/Switch.d.ts +3 -0
- package/build/Switch.js +36 -26
- package/build/Switch.js.map +1 -1
- package/build/Utils.js +92 -60
- package/build/Utils.js.map +1 -1
- package/build/i18n/de.json +3 -0
- package/build/i18n/en.json +3 -0
- package/build/i18n/es.json +3 -0
- package/build/i18n/fr.json +3 -0
- package/build/i18n/it.json +3 -0
- package/build/i18n/nl.json +3 -0
- package/build/i18n/pl.json +3 -0
- package/build/i18n/pt.json +3 -0
- package/build/i18n/ru.json +3 -0
- package/build/i18n/uk.json +3 -0
- package/build/i18n/zh-cn.json +3 -0
- package/build/styles.d.ts +17 -0
- package/build/styles.js +226 -0
- package/build/styles.js.map +1 -0
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Devi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OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;QAC9B,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,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,SAAS,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;QAChC,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 {\n Button,\n Fab,\n FormControl,\n InputLabel,\n MenuItem,\n Select,\n Switch,\n Slider,\n TextField,\n InputAdornment,\n FormControlLabel,\n Divider,\n} from '@mui/material';\n\nimport { type Connection, Icon } from '@iobroker/gui-components';\nimport type { DeviceId, ControlBase, ControlState, DeviceControl } from './protocol/api';\n\nimport { renderControlIcon, getTranslation } from './Utils';\n\ninterface DeviceControlProps {\n deviceId: DeviceId;\n /** Control object */\n control: DeviceControl;\n socket: Connection;\n /** Control handler to set the state */\n controlHandler: (\n deviceId: DeviceId,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n /** Control handler to read the state */\n controlStateHandler: (deviceId: DeviceId, 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 min?: number;\n max?: number;\n step?: number;\n unit?: string;\n options?: { label: string; value: ControlState; icon?: string; color?: string }[];\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 unit: props.control.unit || '',\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 if (this.props.control.type === 'slider' || this.props.control.type === 'number') {\n if (this.props.control.min === undefined && this.props.control.max === undefined) {\n // read an object to get min and max\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common) {\n const min: number = this.props.control.min ?? obj.common.min ?? 0;\n\n const max: number = this.props.control.max ?? obj.common.max ?? 100;\n\n const step: number = this.props.control.step || obj.common.step || (max - min) / 100;\n\n let unit: string | undefined = this.props.control.unit;\n if (unit === undefined) {\n unit = obj.common.unit;\n }\n\n this.setState({\n min,\n max,\n step,\n unit,\n });\n }\n });\n } else {\n const min = this.props.control.min ?? 0;\n const max = this.props.control.max ?? 100;\n\n this.setState({\n min,\n max,\n step: this.props.control.step === undefined ? (max - min) / 100 : this.props.control.step,\n unit: this.props.control.unit || '',\n });\n }\n } else if (this.props.control.type === 'select') {\n if (!this.props.control.options?.length) {\n // read an object to get options\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common?.states) {\n let options: { label: string; value: ControlState }[] | undefined;\n if (typeof obj.common.states === 'string') {\n const pairs = obj.common.states.split(';');\n options = pairs.map(pair => {\n const parts = pair.split(':');\n return {\n value: parts[0],\n label: parts[1],\n };\n });\n } else if (Array.isArray(obj.common.states)) {\n options = obj.common.states.map((label: string) => ({ label, value: label }));\n } else {\n options = Object.keys(obj.common.states).map(label => ({\n label,\n value: obj.common.states[label],\n }));\n }\n\n this.setState({\n options,\n });\n }\n });\n } else {\n this.setState({\n options: this.props.control.options.map(item => ({\n label: getTranslation(item.label),\n value: item.value,\n icon: item.icon,\n color: item.color,\n })),\n });\n }\n } else if (this.props.control.type === 'info') {\n if (!this.props.control.unit) {\n // read an object to get unit\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common?.unit) {\n this.setState({\n unit: obj.common.unit,\n });\n }\n });\n }\n }\n }\n }\n\n stateHandler = async (id: string, state: ioBroker.State | null | undefined): 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: DeviceId, 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, true);\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 variant={this.props.control.variant}\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\n if (\n (this.props.control.label || this.props.control.icon) &&\n (this.props.control.labelOn || this.props.control.iconOn)\n ) {\n return (\n <div style={{ display: 'flex', gap: 8 }}>\n <div style={{ color: this.props.control.color, display: 'flex', gap: 4 }}>\n {this.props.control.label ? getTranslation(this.props.control.label) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </div>\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 <div\n style={{\n color: this.props.control.colorOn || this.props.control.color,\n display: 'flex',\n gap: 4,\n }}\n >\n {this.props.control.labelOn ? getTranslation(this.props.control.labelOn) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </div>\n </div>\n );\n }\n if (this.props.control.label || this.props.control.icon) {\n return (\n <FormControlLabel\n control={\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 slotProps={{\n typography: {\n style: { color: this.props.control.color },\n },\n }}\n label={\n <span style={{ color: this.props.control.color, display: 'flex', gap: 4 }}>\n {this.props.control.label ? getTranslation(this.props.control.label) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </span>\n }\n />\n );\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 renderSelect(): JSX.Element {\n const anyIcons = this.state.options?.some(option => !!option.icon);\n\n return (\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n {this.props.control.label ? <InputLabel>{getTranslation(this.props.control.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n value={this.state.value}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n >\n {this.state.options?.map((option, i) => (\n <MenuItem\n key={i.toString()}\n value={typeof option.value === 'boolean' ? option.value.toString() : option.value!}\n style={{ color: option.color }}\n >\n {anyIcons ? (\n <Icon\n src={option.icon}\n style={{ width: 24, height: 24 }}\n />\n ) : null}\n {option.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n }\n\n renderSlider(): JSX.Element {\n if (this.state.min === undefined || this.state.max === undefined) {\n return <div style={{ width: '100%' }}>...</div>;\n }\n return (\n <div\n style={{\n width: '100%',\n minWidth: 300,\n // Room for the value label above the thumb. It is drawn ~28px above the track,\n // and `overflow: visible` here does not save it: the dialog content around us\n // scrolls, so anything reaching above this box is clipped by that ancestor and\n // the bubble arrives as a flat grey bar with its digits cut off.\n paddingTop: 30,\n marginBottom: 8,\n overflow: 'visible',\n display: 'flex',\n // Without this the flex default stretches label and track to different heights\n // and their centres no longer line up.\n alignItems: 'center',\n gap: 8,\n }}\n >\n {this.props.control.label ? (\n <div style={{ color: this.props.control.color, whiteSpace: 'nowrap' }}>\n {getTranslation(this.props.control.label)}\n </div>\n ) : null}\n {this.props.control.icon ? (\n <Icon\n style={{ color: this.props.control.color }}\n src={this.props.control.icon}\n />\n ) : null}\n <Slider\n style={{ flexGrow: 1 }}\n value={parseFloat((this.state.value as string) || '0')}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n valueLabelDisplay=\"auto\"\n onChange={(_e, value) => this.sendControl(this.props.deviceId, this.props.control, value)}\n />\n {this.props.control.iconOn ? (\n <Icon\n style={{ color: this.props.control.colorOn || this.props.control.color }}\n src={this.props.control.iconOn}\n />\n ) : null}\n {this.props.control.labelOn ? (\n <div\n style={{ color: this.props.control.colorOn || this.props.control.color, whiteSpace: 'nowrap' }}\n >\n {getTranslation(this.props.control.labelOn)}\n </div>\n ) : null}\n </div>\n );\n }\n\n renderColor(): JSX.Element {\n return (\n <TextField\n fullWidth\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n type=\"color\"\n value={this.state.value}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n // Same reason as in `renderNumber`: a colour input always paints its swatch, so an\n // unshrunk label would sit on top of it.\n slotProps={{ inputLabel: { shrink: true } }}\n variant=\"standard\"\n />\n );\n }\n\n renderText(): JSX.Element {\n return (\n <TextField\n fullWidth\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n value={this.state.value}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n variant=\"standard\"\n />\n );\n }\n\n renderNumber(): JSX.Element {\n return (\n <TextField\n fullWidth\n type=\"number\"\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n value={this.state.value}\n onChange={(e): Promise<void> => {\n if (isNaN(parseFloat(e.target.value))) {\n return Promise.resolve();\n }\n return this.sendControl(this.props.deviceId, this.props.control, parseFloat(e.target.value));\n }}\n slotProps={{\n htmlInput: { min: this.state.min, max: this.state.max, step: this.state.step },\n input: {\n endAdornment: this.state.unit ? (\n <InputAdornment position=\"end\">{this.state.unit}</InputAdornment>\n ) : undefined,\n },\n // A field with an adornment never counts as empty, so the label has to be told\n // to shrink — otherwise it stays over the input and is drawn on top of the\n // value (\"92\" and \"SET\" in the same place).\n inputLabel: { shrink: true },\n }}\n variant=\"standard\"\n />\n );\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 variant={this.props.control.variant}\n >\n {getTranslation(this.props.control.label)}\n </Button>\n );\n }\n\n renderInfo(): JSX.Element {\n let label = this.props.control.label;\n if (this.state.value && this.props.control.labelOn && typeof this.state.value === 'boolean') {\n label = this.props.control.labelOn;\n }\n if (label) {\n label = getTranslation(this.props.control.label!, this.props.control.noTranslation);\n }\n let value = this.state.value;\n if (typeof this.state.value === 'boolean') {\n if (this.props.control.textFalse && !this.state.value) {\n value = getTranslation(this.props.control.textFalse, this.props.control.noTranslation);\n } else if (this.props.control.textTrue && this.state.value) {\n value = getTranslation(this.props.control.textTrue, this.props.control.noTranslation);\n }\n }\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value, true);\n return (\n <div style={{ display: 'flex' }}>\n {icon}\n {label ? (\n <InputLabel>\n {label}\n {this.props.control.showSemicolon ? ':' : null}\n </InputLabel>\n ) : null}\n\n <span>\n {value}\n <span style={{ fontSize: 'smaller', opacity: 0.7, marginLeft: this.state.unit ? 4 : 0 }}>\n {this.state.unit}\n </span>\n </span>\n </div>\n );\n }\n\n renderDivider(): JSX.Element {\n const style: React.CSSProperties = this.props.control.style || {};\n if (this.props.control.color) {\n style.color = this.props.control.color;\n }\n return <Divider style={style} />;\n }\n\n renderHeader(): JSX.Element {\n const style: React.CSSProperties = {\n backgroundColor: this.props.colors.primary,\n width: '100%',\n display: 'flex',\n gap: 8,\n };\n Object.assign(style, this.props.control.style);\n if (this.props.control.color) {\n style.color = this.props.control.color;\n }\n const icon = renderControlIcon(this.props.control, this.props.colors, false, true);\n return (\n <div style={style}>\n {icon}\n {getTranslation(this.props.control.label!)}\n </div>\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 if (this.props.control.type === 'select') {\n return this.renderSelect();\n }\n\n if (this.props.control.type === 'slider') {\n return this.renderSlider();\n }\n\n if (this.props.control.type === 'color') {\n return this.renderColor();\n }\n\n if (this.props.control.type === 'text') {\n return this.renderText();\n }\n\n if (this.props.control.type === 'number') {\n return this.renderNumber();\n }\n\n if (this.props.control.type === 'info') {\n return this.renderInfo();\n }\n\n if (this.props.control.type === 'divider') {\n return this.renderDivider();\n }\n\n if (this.props.control.type === 'header') {\n return this.renderHeader();\n }\n\n return <div style={{ color: 'red' }}>{this.props.control.type}</div>;\n }\n}\n"]}
|
|
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,EACH,MAAM,EACN,GAAG,EACH,WAAW,EACX,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,OA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AAO,CAAC,IAAI,CAAO,CAAC;IACzE,CAAC;CACJ","sourcesContent":["import React, { Component, type JSX } from 'react';\nimport {\n Button,\n Fab,\n FormControl,\n InputLabel,\n MenuItem,\n Select,\n Switch,\n Slider,\n TextField,\n InputAdornment,\n FormControlLabel,\n Divider,\n} from '@mui/material';\n\nimport { type Connection, Icon } from '@iobroker/gui-components';\nimport type { DeviceId, ControlBase, ControlState, DeviceControl } from './protocol/api';\n\nimport { renderControlIcon, getTranslation } from './Utils';\n\ninterface DeviceControlProps {\n deviceId: DeviceId;\n /** Control object */\n control: DeviceControl;\n socket: Connection;\n /** Control handler to set the state */\n controlHandler: (\n deviceId: DeviceId,\n control: ControlBase,\n state: ControlState,\n ) => () => Promise<ioBroker.State | null>;\n /** Control handler to read the state */\n controlStateHandler: (deviceId: DeviceId, 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 min?: number;\n max?: number;\n step?: number;\n unit?: string;\n options?: { label: string; value: ControlState; icon?: string; color?: string }[];\n}\n\n/**\n * Device Control component\n */\nexport default class DeviceControlComponent extends Component<DeviceControlProps, DeviceControlState> {\n constructor(props: DeviceControlProps) {\n super(props);\n const control = props.control;\n this.state = {\n value: control.state?.val,\n ts: control.state?.ts,\n unit: control.unit || '',\n };\n\n // What the definition already says is used right away. Only the rest is read from the\n // object of the state, and only if the control has one (see componentDidMount).\n if (control.type === 'slider' || control.type === 'number') {\n if (control.min !== undefined || control.max !== undefined) {\n const min = control.min ?? 0;\n const max = control.max ?? 100;\n this.state = { ...this.state, min, max, step: control.step ?? (max - min) / 100 };\n } else if (!control.stateId) {\n // No object to read the range from. A slider cannot be shown without one.\n this.state = {\n ...this.state,\n min: control.type === 'slider' ? 0 : undefined,\n max: control.type === 'slider' ? 100 : undefined,\n step: control.step ?? (control.type === 'slider' ? 1 : undefined),\n };\n }\n } else if (control.type === 'select' && control.options?.length) {\n this.state = {\n ...this.state,\n options: control.options.map(item => ({\n label: getTranslation(item.label),\n value: item.value,\n icon: item.icon,\n color: item.color,\n })),\n };\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 if (this.props.control.type === 'slider' || this.props.control.type === 'number') {\n if (this.state.min === undefined && this.state.max === undefined) {\n // read an object to get min and max\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common) {\n const min: number = this.props.control.min ?? obj.common.min ?? 0;\n\n const max: number = this.props.control.max ?? obj.common.max ?? 100;\n\n const step: number = this.props.control.step || obj.common.step || (max - min) / 100;\n\n let unit: string | undefined = this.props.control.unit;\n if (unit === undefined) {\n unit = obj.common.unit;\n }\n\n this.setState({\n min,\n max,\n step,\n unit,\n });\n }\n });\n }\n } else if (this.props.control.type === 'select') {\n if (!this.state.options) {\n // read an object to get options\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common?.states) {\n let options: { label: string; value: ControlState }[] | undefined;\n if (typeof obj.common.states === 'string') {\n const pairs = obj.common.states.split(';');\n options = pairs.map(pair => {\n const parts = pair.split(':');\n return {\n value: parts[0],\n label: parts[1],\n };\n });\n } else if (Array.isArray(obj.common.states)) {\n options = obj.common.states.map((label: string) => ({ label, value: label }));\n } else {\n options = Object.keys(obj.common.states).map(label => ({\n label,\n value: obj.common.states[label],\n }));\n }\n\n this.setState({\n options,\n });\n }\n });\n }\n } else if (this.props.control.type === 'info') {\n if (!this.props.control.unit) {\n // read an object to get unit\n void this.props.socket.getObject(this.props.control.stateId).then(obj => {\n if (obj?.common?.unit) {\n this.setState({\n unit: obj.common.unit,\n });\n }\n });\n }\n }\n }\n }\n\n stateHandler = async (id: string, state: ioBroker.State | null | undefined): 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: DeviceId, 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, true);\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 variant={this.props.control.variant}\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\n if (\n (this.props.control.label || this.props.control.icon) &&\n (this.props.control.labelOn || this.props.control.iconOn)\n ) {\n return (\n <div style={{ display: 'flex', gap: 8 }}>\n <div style={{ color: this.props.control.color, display: 'flex', gap: 4 }}>\n {this.props.control.label ? getTranslation(this.props.control.label) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </div>\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 <div\n style={{\n color: this.props.control.colorOn || this.props.control.color,\n display: 'flex',\n gap: 4,\n }}\n >\n {this.props.control.labelOn ? getTranslation(this.props.control.labelOn) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </div>\n </div>\n );\n }\n if (this.props.control.label || this.props.control.icon) {\n return (\n <FormControlLabel\n control={\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 slotProps={{\n typography: {\n style: { color: this.props.control.color },\n },\n }}\n label={\n <span style={{ color: this.props.control.color, display: 'flex', gap: 4 }}>\n {this.props.control.label ? getTranslation(this.props.control.label) : null}\n {this.props.control.icon ? <Icon src={this.props.control.icon} /> : null}\n </span>\n }\n />\n );\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 renderSelect(): JSX.Element {\n const anyIcons = this.state.options?.some(option => !!option.icon);\n\n return (\n <FormControl\n fullWidth\n variant=\"standard\"\n >\n {this.props.control.label ? <InputLabel>{getTranslation(this.props.control.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n // Until the options are known, any value would be out of range for MUI\n value={this.state.options ? (this.state.value ?? '') : ''}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n >\n {this.state.options?.map((option, i) => (\n <MenuItem\n key={i.toString()}\n value={typeof option.value === 'boolean' ? option.value.toString() : option.value!}\n style={{ color: option.color }}\n >\n {anyIcons ? (\n <Icon\n src={option.icon}\n style={{ width: 24, height: 24 }}\n />\n ) : null}\n {option.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n }\n\n renderSlider(): JSX.Element {\n if (this.state.min === undefined || this.state.max === undefined) {\n return <div style={{ width: '100%' }}>...</div>;\n }\n return (\n <div\n style={{\n width: '100%',\n minWidth: 300,\n // Room for the value label above the thumb. It is drawn ~28px above the track,\n // and `overflow: visible` here does not save it: the dialog content around us\n // scrolls, so anything reaching above this box is clipped by that ancestor and\n // the bubble arrives as a flat grey bar with its digits cut off.\n paddingTop: 30,\n marginBottom: 8,\n overflow: 'visible',\n display: 'flex',\n // Without this the flex default stretches label and track to different heights\n // and their centres no longer line up.\n alignItems: 'center',\n gap: 8,\n }}\n >\n {this.props.control.label ? (\n <div style={{ color: this.props.control.color, whiteSpace: 'nowrap' }}>\n {getTranslation(this.props.control.label)}\n </div>\n ) : null}\n {this.props.control.icon ? (\n <Icon\n style={{ color: this.props.control.color }}\n src={this.props.control.icon}\n />\n ) : null}\n <Slider\n style={{ flexGrow: 1 }}\n value={parseFloat((this.state.value as string) || '0')}\n min={this.state.min}\n max={this.state.max}\n step={this.state.step}\n valueLabelDisplay=\"auto\"\n onChange={(_e, value) => this.sendControl(this.props.deviceId, this.props.control, value)}\n />\n {this.props.control.iconOn ? (\n <Icon\n style={{ color: this.props.control.colorOn || this.props.control.color }}\n src={this.props.control.iconOn}\n />\n ) : null}\n {this.props.control.labelOn ? (\n <div\n style={{ color: this.props.control.colorOn || this.props.control.color, whiteSpace: 'nowrap' }}\n >\n {getTranslation(this.props.control.labelOn)}\n </div>\n ) : null}\n </div>\n );\n }\n\n renderColor(): JSX.Element {\n return (\n <TextField\n fullWidth\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n type=\"color\"\n value={this.state.value}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n // Same reason as in `renderNumber`: a colour input always paints its swatch, so an\n // unshrunk label would sit on top of it.\n slotProps={{ inputLabel: { shrink: true } }}\n variant=\"standard\"\n />\n );\n }\n\n renderText(): JSX.Element {\n return (\n <TextField\n fullWidth\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n value={this.state.value}\n onChange={(e): Promise<void> =>\n this.sendControl(this.props.deviceId, this.props.control, e.target.value)\n }\n variant=\"standard\"\n />\n );\n }\n\n renderNumber(): JSX.Element {\n return (\n <TextField\n fullWidth\n type=\"number\"\n label={this.props.control.label ? getTranslation(this.props.control.label) : undefined}\n value={this.state.value}\n onChange={(e): Promise<void> => {\n if (isNaN(parseFloat(e.target.value))) {\n return Promise.resolve();\n }\n return this.sendControl(this.props.deviceId, this.props.control, parseFloat(e.target.value));\n }}\n slotProps={{\n htmlInput: { min: this.state.min, max: this.state.max, step: this.state.step },\n input: {\n endAdornment: this.state.unit ? (\n <InputAdornment position=\"end\">{this.state.unit}</InputAdornment>\n ) : undefined,\n },\n // A field with an adornment never counts as empty, so the label has to be told\n // to shrink — otherwise it stays over the input and is drawn on top of the\n // value (\"92\" and \"SET\" in the same place).\n inputLabel: { shrink: true },\n }}\n variant=\"standard\"\n />\n );\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 variant={this.props.control.variant}\n >\n {getTranslation(this.props.control.label)}\n </Button>\n );\n }\n\n renderInfo(): JSX.Element {\n let label = this.props.control.label;\n if (this.state.value && this.props.control.labelOn && typeof this.state.value === 'boolean') {\n label = this.props.control.labelOn;\n }\n if (label) {\n label = getTranslation(this.props.control.label!, this.props.control.noTranslation);\n }\n let value = this.state.value;\n if (typeof this.state.value === 'boolean') {\n if (this.props.control.textFalse && !this.state.value) {\n value = getTranslation(this.props.control.textFalse, this.props.control.noTranslation);\n } else if (this.props.control.textTrue && this.state.value) {\n value = getTranslation(this.props.control.textTrue, this.props.control.noTranslation);\n }\n }\n const icon = renderControlIcon(this.props.control, this.props.colors, this.state.value, true);\n return (\n <div style={{ display: 'flex' }}>\n {icon}\n {label ? (\n <InputLabel>\n {label}\n {this.props.control.showSemicolon ? ':' : null}\n </InputLabel>\n ) : null}\n\n <span>\n {value}\n <span style={{ fontSize: 'smaller', opacity: 0.7, marginLeft: this.state.unit ? 4 : 0 }}>\n {this.state.unit}\n </span>\n </span>\n </div>\n );\n }\n\n renderDivider(): JSX.Element {\n const style: React.CSSProperties = this.props.control.style || {};\n if (this.props.control.color) {\n style.color = this.props.control.color;\n }\n return <Divider style={style} />;\n }\n\n renderHeader(): JSX.Element {\n const style: React.CSSProperties = {\n backgroundColor: this.props.colors.primary,\n width: '100%',\n display: 'flex',\n gap: 8,\n };\n Object.assign(style, this.props.control.style);\n if (this.props.control.color) {\n style.color = this.props.control.color;\n }\n const icon = renderControlIcon(this.props.control, this.props.colors, false, true);\n return (\n <div style={style}>\n {icon}\n {getTranslation(this.props.control.label!)}\n </div>\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 if (this.props.control.type === 'select') {\n return this.renderSelect();\n }\n\n if (this.props.control.type === 'slider') {\n return this.renderSlider();\n }\n\n if (this.props.control.type === 'color') {\n return this.renderColor();\n }\n\n if (this.props.control.type === 'text') {\n return this.renderText();\n }\n\n if (this.props.control.type === 'number') {\n return this.renderNumber();\n }\n\n if (this.props.control.type === 'info') {\n return this.renderInfo();\n }\n\n if (this.props.control.type === 'divider') {\n return this.renderDivider();\n }\n\n if (this.props.control.type === 'header') {\n return this.renderHeader();\n }\n\n return <div style={{ color: 'red' }}>{this.props.control.type}</div>;\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type Connection } from '@iobroker/gui-components';
|
|
3
3
|
import type { DeviceId } from './protocol/api';
|
|
4
4
|
interface DeviceImageUploadProps {
|
|
5
5
|
socket: Connection;
|
|
@@ -9,5 +9,9 @@ interface DeviceImageUploadProps {
|
|
|
9
9
|
onImageSelect: (image: string) => void;
|
|
10
10
|
uploadImagesToInstance: string;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Lies over the device symbol: on hover it shows the upload symbol, a click opens the file selection,
|
|
14
|
+
* and while the image is stored, the arrow moves up again and again.
|
|
15
|
+
*/
|
|
12
16
|
declare function DeviceImageUpload(params: DeviceImageUploadProps): React.JSX.Element | null;
|
|
13
17
|
export default DeviceImageUpload;
|
|
@@ -1,71 +1,88 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Tooltip } from '@mui/material';
|
|
3
|
+
import { IconUpload } from '@iobroker/gui-components';
|
|
4
|
+
import { getTranslation } from './Utils';
|
|
5
|
+
/** Reads the file and makes it at most 100 x 100 pixels big */
|
|
6
|
+
function resizeImage(file) {
|
|
7
|
+
return new Promise(resolve => {
|
|
8
|
+
const reader = new FileReader();
|
|
9
|
+
reader.onerror = () => resolve(null);
|
|
10
|
+
reader.onload = (e) => {
|
|
11
|
+
if (!e.target?.result) {
|
|
12
|
+
resolve(null);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const img = new Image();
|
|
16
|
+
img.onerror = () => resolve(null);
|
|
17
|
+
img.onload = () => {
|
|
18
|
+
const maxWidth = 100;
|
|
19
|
+
const maxHeight = 100;
|
|
20
|
+
let width = img.width;
|
|
21
|
+
let height = img.height;
|
|
22
|
+
if (width > height) {
|
|
23
|
+
if (width > maxWidth) {
|
|
24
|
+
height *= maxWidth / width;
|
|
25
|
+
width = maxWidth;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else if (height > maxHeight) {
|
|
29
|
+
width *= maxHeight / height;
|
|
30
|
+
height = maxHeight;
|
|
31
|
+
}
|
|
32
|
+
const canvas = document.createElement('canvas');
|
|
33
|
+
const ctx = canvas.getContext('2d');
|
|
34
|
+
if (!ctx) {
|
|
35
|
+
resolve(null);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
canvas.width = width;
|
|
39
|
+
canvas.height = height;
|
|
40
|
+
ctx.drawImage(img, 0, 0, width, height);
|
|
41
|
+
resolve(canvas.toDataURL('image/webp'));
|
|
42
|
+
};
|
|
43
|
+
img.src = e.target.result;
|
|
44
|
+
};
|
|
45
|
+
reader.readAsDataURL(file);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Lies over the device symbol: on hover it shows the upload symbol, a click opens the file selection,
|
|
50
|
+
* and while the image is stored, the arrow moves up again and again.
|
|
51
|
+
*/
|
|
2
52
|
function DeviceImageUpload(params) {
|
|
3
53
|
const { socket, manufacturer, model, deviceId, onImageSelect, uploadImagesToInstance } = params;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
54
|
+
const [uploading, setUploading] = useState(false);
|
|
55
|
+
const handleImageUpload = async (event) => {
|
|
56
|
+
const file = event.target.files?.[0];
|
|
57
|
+
// The same file can be selected again
|
|
58
|
+
event.target.value = '';
|
|
59
|
+
if (!file) {
|
|
8
60
|
return;
|
|
9
61
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else if (height > maxHeight) {
|
|
31
|
-
width *= maxHeight / height;
|
|
32
|
-
height = maxHeight;
|
|
33
|
-
}
|
|
34
|
-
const canvas = document.createElement('canvas');
|
|
35
|
-
const ctx = canvas.getContext('2d');
|
|
36
|
-
if (ctx) {
|
|
37
|
-
canvas.width = width;
|
|
38
|
-
canvas.height = height;
|
|
39
|
-
ctx.drawImage(img, 0, 0, width, height);
|
|
40
|
-
const resizedImage = canvas.toDataURL('image/webp');
|
|
41
|
-
// Build the file name from a manufacturer and model, if not available, use device id
|
|
42
|
-
const fileName = `${manufacturer ? `${manufacturer}_` : ''}${model || JSON.stringify(deviceId)}.webp`;
|
|
43
|
-
const base64Data = resizedImage.replace(/^data:image\/webp;base64,/, '');
|
|
44
|
-
const response = await socket.writeFile64(uploadImagesToInstance, fileName, base64Data);
|
|
45
|
-
console.log(`saveImage response: ${JSON.stringify(response)}`);
|
|
46
|
-
if (onImageSelect) {
|
|
47
|
-
onImageSelect(resizedImage);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
reader.readAsDataURL(file);
|
|
62
|
+
setUploading(true);
|
|
63
|
+
try {
|
|
64
|
+
const resizedImage = await resizeImage(file);
|
|
65
|
+
if (!resizedImage) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
// Build the file name from a manufacturer and model, if not available, use device id
|
|
69
|
+
const fileName = `${manufacturer ? `${manufacturer}_` : ''}${model || JSON.stringify(deviceId)}.webp`;
|
|
70
|
+
const base64Data = resizedImage.replace(/^data:image\/webp;base64,/, '');
|
|
71
|
+
const response = await socket.writeFile64(uploadImagesToInstance, fileName, base64Data);
|
|
72
|
+
console.log(`saveImage response: ${JSON.stringify(response)}`);
|
|
73
|
+
onImageSelect?.(resizedImage);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error(`Cannot save the image: ${error}`);
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
setUploading(false);
|
|
53
80
|
}
|
|
54
81
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
width: 45,
|
|
60
|
-
height: 45,
|
|
61
|
-
zIndex: 3,
|
|
62
|
-
};
|
|
63
|
-
const imageUploadDiv = {
|
|
64
|
-
position: 'relative',
|
|
65
|
-
top: -22,
|
|
66
|
-
};
|
|
67
|
-
return (React.createElement("div", { style: imageUploadDiv },
|
|
68
|
-
React.createElement("input", { style: imageUploadButtonStyle, type: "file", accept: "image/*", onChange: handleImageUpload })));
|
|
82
|
+
return (React.createElement(Tooltip, { title: getTranslation('uploadImageTooltip'), slotProps: { popper: { sx: { pointerEvents: 'none' } } } },
|
|
83
|
+
React.createElement("label", { className: `dm-upload${uploading ? ' dm-upload-busy' : ''}` },
|
|
84
|
+
React.createElement(IconUpload, { uploading: uploading }),
|
|
85
|
+
React.createElement("input", { type: "file", accept: "image/*", disabled: uploading, "aria-label": getTranslation('uploadImageTooltip'), onChange: e => void handleImageUpload(e) }))));
|
|
69
86
|
}
|
|
70
87
|
export default DeviceImageUpload;
|
|
71
88
|
//# sourceMappingURL=DeviceImageUpload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceImageUpload.js","sourceRoot":"./src/","sources":["DeviceImageUpload.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"DeviceImageUpload.js","sourceRoot":"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C,MAAM,EACX,MAAM,EAAC,SAAS,EAChB,QAAQ,EAAE,SAAS,gBACP,cAAc,CAAC,oBAAoB,CAAC,EAChD,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,iBAAiB,CAAC,CAAC,CAAC,GAC1C,CACE,CACF,CACb,CAAC;AACN,CAAC;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["import React, { useState, type ChangeEvent } from 'react';\nimport { Tooltip } from '@mui/material';\n\nimport { IconUpload, type Connection } from '@iobroker/gui-components';\nimport type { DeviceId } from './protocol/api';\nimport { getTranslation } from './Utils';\n\ninterface DeviceImageUploadProps {\n socket: Connection;\n manufacturer?: string;\n model?: string;\n deviceId: DeviceId;\n onImageSelect: (image: string) => void;\n uploadImagesToInstance: string;\n}\n\n/** Reads the file and makes it at most 100 x 100 pixels big */\nfunction resizeImage(file: File): Promise<string | null> {\n return new Promise(resolve => {\n const reader = new FileReader();\n reader.onerror = () => resolve(null);\n reader.onload = (e: ProgressEvent<FileReader>): void => {\n if (!e.target?.result) {\n resolve(null);\n return;\n }\n\n const img = new Image();\n img.onerror = () => resolve(null);\n img.onload = () => {\n const maxWidth = 100;\n const maxHeight = 100;\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 resolve(null);\n return;\n }\n canvas.width = width;\n canvas.height = height;\n ctx.drawImage(img, 0, 0, width, height);\n resolve(canvas.toDataURL('image/webp'));\n };\n img.src = e.target.result as string;\n };\n reader.readAsDataURL(file);\n });\n}\n\n/**\n * Lies over the device symbol: on hover it shows the upload symbol, a click opens the file selection,\n * and while the image is stored, the arrow moves up again and again.\n */\nfunction DeviceImageUpload(params: DeviceImageUploadProps): React.JSX.Element | null {\n const { socket, manufacturer, model, deviceId, onImageSelect, uploadImagesToInstance } = params;\n const [uploading, setUploading] = useState(false);\n\n const handleImageUpload = async (event: ChangeEvent<HTMLInputElement>): Promise<void> => {\n const file = event.target.files?.[0];\n // The same file can be selected again\n event.target.value = '';\n if (!file) {\n return;\n }\n\n setUploading(true);\n try {\n const resizedImage = await resizeImage(file);\n if (!resizedImage) {\n return;\n }\n // Build the file name from a manufacturer and model, if not available, use device id\n const fileName = `${manufacturer ? `${manufacturer}_` : ''}${model || JSON.stringify(deviceId)}.webp`;\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 onImageSelect?.(resizedImage);\n } catch (error) {\n console.error(`Cannot save the image: ${error}`);\n } finally {\n setUploading(false);\n }\n };\n\n return (\n <Tooltip\n title={getTranslation('uploadImageTooltip')}\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n >\n <label className={`dm-upload${uploading ? ' dm-upload-busy' : ''}`}>\n <IconUpload uploading={uploading} />\n <input\n type=\"file\"\n accept=\"image/*\"\n disabled={uploading}\n aria-label={getTranslation('uploadImageTooltip')}\n onChange={e => void handleImageUpload(e)}\n />\n </label>\n </Tooltip>\n );\n}\n\nexport default DeviceImageUpload;\n"]}
|
package/build/DeviceList.d.ts
CHANGED
|
@@ -142,6 +142,14 @@ export default class DeviceList extends Communication<DeviceListProps, DeviceLis
|
|
|
142
142
|
icon?: React.JSX.Element | string | null;
|
|
143
143
|
}[] | undefined): React.JSX.Element | null;
|
|
144
144
|
renderInstanceCards(): React.JSX.Element[];
|
|
145
|
+
/** True if any filter hides devices: the text, the group or one of the toggles */
|
|
146
|
+
private hasActiveFilter;
|
|
147
|
+
/** Removes all filters at once */
|
|
148
|
+
private resetFilters;
|
|
149
|
+
/** An empty list says what happened and, if possible, what to do */
|
|
150
|
+
private renderEmpty;
|
|
151
|
+
/** The filter symbol in the toolbar. While a filter is set, a red cross shows that a click removes all filters */
|
|
152
|
+
private renderFilterButton;
|
|
145
153
|
/**
|
|
146
154
|
* Apply the text filter and the "only updatable" / "only battery problem" filters.
|
|
147
155
|
*
|