@iobroker/adapter-react-v5 7.6.18 → 7.6.20
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/Components/DeviceType/DeviceTypeIcon.js +3 -2
- package/build/Components/DeviceType/DeviceTypeIcon.js.map +1 -1
- package/build/Components/DeviceType/DeviceTypeSelector.js +2 -1
- package/build/Components/DeviceType/DeviceTypeSelector.js.map +1 -1
- package/build/Components/DeviceType/deviceTypeTranslations.js +16 -12
- package/build/Components/DeviceType/deviceTypeTranslations.js.map +1 -1
- package/build/Components/ObjectBrowser.d.ts +3 -0
- package/build/Components/ObjectBrowser.js +104 -70
- package/build/Components/ObjectBrowser.js.map +1 -1
- package/build/Components/Schedule.js +10 -9
- package/build/Components/Schedule.js.map +1 -1
- package/build/Components/SelectWithIcon.js +6 -2
- package/build/Components/SelectWithIcon.js.map +1 -1
- package/build/Components/ToggleThemeMenu.d.ts +1 -1
- package/build/Components/ToggleThemeMenu.js.map +1 -1
- package/build/LegacyConnection.js.map +1 -1
- package/build/i18n/de.json +1 -0
- package/build/i18n/en.json +1 -0
- package/build/i18n/es.json +1 -0
- package/build/i18n/fr.json +1 -0
- package/build/i18n/it.json +1 -0
- package/build/i18n/nl.json +1 -0
- package/build/i18n/pl.json +1 -0
- package/build/i18n/pt.json +1 -0
- package/build/i18n/ru.json +1 -0
- package/build/i18n/uk.json +1 -0
- package/build/i18n/zh-cn.json +1 -0
- package/build/modulefederation.admin.config.d.ts +1 -1
- package/build/modulefederation.admin.config.js +1 -1
- package/build/modulefederation.admin.config.js.map +1 -1
- package/i18n/de.json +1 -0
- package/i18n/en.json +1 -0
- package/i18n/es.json +1 -0
- package/i18n/fr.json +1 -0
- package/i18n/it.json +1 -0
- package/i18n/nl.json +1 -0
- package/i18n/pl.json +1 -0
- package/i18n/pt.json +1 -0
- package/i18n/ru.json +1 -0
- package/i18n/uk.json +1 -0
- package/i18n/zh-cn.json +1 -0
- package/package.json +10 -10
|
@@ -83,12 +83,13 @@ export function DeviceTypeIcon(props) {
|
|
|
83
83
|
extendDeviceTypeTranslation();
|
|
84
84
|
setLoaded(true);
|
|
85
85
|
}
|
|
86
|
-
}, [props.title]);
|
|
86
|
+
}, [props.title, loaded]);
|
|
87
87
|
if (!loaded && props.title) {
|
|
88
88
|
return (React.createElement(Box, { style: { ...defaultStyle, ...(props.style || undefined) }, className: props.className, sx: props.sx }));
|
|
89
89
|
}
|
|
90
90
|
// src could contain a device type too, so detect if it is a type
|
|
91
|
-
const type = props.type ||
|
|
91
|
+
const type = props.type ||
|
|
92
|
+
(props.src ? Object.keys(TYPE_ICONS).find(type => props.src === type) : undefined);
|
|
92
93
|
if (!type && props.src) {
|
|
93
94
|
return (React.createElement(Icon, { style: defaultStyle, ...props, title: props.title === true ? undefined : props.title, src: props.src }));
|
|
94
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceTypeIcon.js","sourceRoot":"./src/","sources":["Components/DeviceType/DeviceTypeIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,kBAAkB,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO;AACH,0CAA0C;AAC1C,OAAO,IAAI,aAAa,EACxB,cAAc,IAAI,cAAc,EAChC,YAAY,IAAI,YAAY,EAC5B,WAAW,IAAI,aAAa,EAC5B,MAAM,IAAI,YAAY,EACtB,YAAY,IAAI,gBAAgB,EAChC,aAAa,IAAI,aAAa,EAC9B,UAAU,IAAI,cAAc,EAC5B,YAAY,IAAI,cAAc,EAC9B,UAAU,IAAI,mBAAmB,EACjC,KAAK,IAAI,UAAU,EACnB,QAAQ,IAAI,g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AAI,CAAC,QAAQ,EAAE,CAAC;QACZ,kCAAkC;QAClC,OAAO,IAAI,CAAC,CAAC,CAAC,CACV,8BAAM,KAAK,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE,IAAG,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAQ,CAClG,CAAC,CAAC,CAAC,IAAI,CAAC;IACb,CAAC;IAED,MAAM,IAAI,GAAG,CACT,oBAAC,QAAQ,IACL,KAAK,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE,EACzD,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,EAAE,EAAE,KAAK,CAAC,EAAE,GACd,CACL,CAAC;IAEF,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,CACH,oBAAC,OAAO,IACJ,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,EAAE,EACxD,KAAK,EAAE,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK;YAElE,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAG,IAAI,CAAO,CACvC,CACb,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import React, { useEffect } from 'react';\n\nimport { Box, Tooltip } from '@mui/material';\n\nimport { AiOutlineLineChart as TypeIconChart } from 'react-icons/ai';\nimport { GoDeviceCameraVideo as TypeIconCamera } from 'react-icons/go';\n\nimport {\n // FaExternalLinkSquareAlt as TypeIconURL,\n FaImage as TypeIconImage,\n FaRegLightbulb as TypeIconDimmer,\n FaInfoCircle as TypeIconInfo,\n FaLightbulb as TypeIconLight,\n FaLock as TypeIconLock,\n FaStreetView as TypeIconLocation,\n FaStepForward as TypeIconMedia,\n FaSlidersH as TypeIconSlider,\n FaVolumeDown as TypeIconVolume,\n FaVolumeUp as TypeIconVolumeGroup,\n FaFan as TypeIconAC,\n FaWrench as TypeIconInstance,\n} from 'react-icons/fa';\n\nimport {\n MdFormatColorFill as TypeIconHUE,\n MdFormatColorFill as TypeIconCT,\n MdWarning as TypeIconWarning,\n MdQuestionMark as TypeIconUnknown,\n MdOutlineMyLocation as TypeIconLocationOne,\n MdDeviceHub as TypeIconHub3,\n MdPolyline as TypeIconNode,\n MdHub as TypeIconHub5,\n MdControlCamera as TypeIconController,\n} from 'react-icons/md';\nimport { WiCloudy as TypeIconWeather } from 'react-icons/wi';\nimport { IoIosRadioButtonOn as TypeIconButtonSensor } from 'react-icons/io';\nimport { TbSunElectricity as TypeIconIlluminance } from 'react-icons/tb';\nimport { PiPaletteDuotone as TypeIconRGBWSingle } from 'react-icons/pi';\n\nimport { Types } from '@iobroker/type-detector';\n\nimport { I18n } from '../../i18n';\nimport { Icon } from '../Icon';\n\nimport {\n Cleaner as TypeIconVacuumCleaner,\n Humidity as TypeIconHumidity,\n Jalousie as TypeIconBlinds,\n PushButton as TypeIconButton,\n DoorOpened as TypeIconDoor,\n FireOn as TypeIconFireAlarm,\n FloodOn as TypeIconFloodAlarm,\n Gate as TypeIconGate,\n MotionOn as TypeIconMotion,\n RGB as TypeIconRGB,\n Socket as TypeIconSocket,\n Thermometer as TypeIconTemperature,\n Thermostat as TypeIconThermostat,\n // HeatValve as TypeIconValve,\n WindowOpened as TypeIconWindow,\n WindowTilted as TypeIconWindowTilt,\n type IconPropsSVG,\n} from './icons';\nimport { extendDeviceTypeTranslation } from './deviceTypeTranslations';\n\nexport type TypesExtended = Types | 'invalid' | 'hub3' | 'node' | 'hub5' | 'controller';\n\nconst TYPE_ICONS: Record<TypesExtended, React.FC<IconPropsSVG>> = {\n [Types.airCondition]: TypeIconAC,\n [Types.blind]: TypeIconBlinds,\n [Types.blindButtons]: TypeIconBlinds,\n [Types.button]: TypeIconButton,\n [Types.buttonSensor]: TypeIconButtonSensor,\n [Types.camera]: TypeIconCamera,\n [Types.chart]: TypeIconChart,\n // [Types.url]: TypeIconURL,\n [Types.image]: TypeIconImage,\n [Types.dimmer]: TypeIconDimmer,\n [Types.door]: TypeIconDoor,\n [Types.fireAlarm]: TypeIconFireAlarm,\n // @ts-expect-error special case\n 'sensor.alarm.fire': TypeIconFireAlarm,\n [Types.floodAlarm]: TypeIconFloodAlarm,\n 'sensor.alarm.flood': TypeIconFloodAlarm,\n [Types.gate]: TypeIconGate,\n [Types.humidity]: TypeIconHumidity,\n [Types.illuminance]: TypeIconIlluminance,\n [Types.info]: TypeIconInfo,\n [Types.light]: TypeIconLight,\n [Types.lock]: TypeIconLock,\n [Types.location]: TypeIconLocation,\n [Types.locationOne]: TypeIconLocationOne,\n [Types.media]: TypeIconMedia,\n [Types.motion]: TypeIconMotion,\n [Types.ct]: TypeIconCT,\n [Types.rgb]: TypeIconRGB,\n [Types.rgbSingle]: TypeIconRGB,\n [Types.rgbwSingle]: TypeIconRGBWSingle,\n [Types.hue]: TypeIconHUE,\n [Types.cie]: TypeIconRGB,\n [Types.slider]: TypeIconSlider,\n [Types.socket]: TypeIconSocket,\n [Types.temperature]: TypeIconTemperature,\n [Types.thermostat]: TypeIconThermostat,\n // [Types.valve]: TypeIconValve,\n [Types.vacuumCleaner]: TypeIconVacuumCleaner,\n [Types.volume]: TypeIconVolume,\n [Types.volumeGroup]: TypeIconVolumeGroup,\n [Types.window]: TypeIconWindow,\n [Types.windowTilt]: TypeIconWindowTilt,\n [Types.weatherCurrent]: TypeIconWeather,\n [Types.weatherForecast]: TypeIconWeather,\n [Types.warning]: TypeIconWarning,\n\n [Types.unknown]: TypeIconUnknown,\n [Types.instance]: TypeIconInstance,\n\n // Special matter types\n invalid: TypeIconWarning,\n hub3: TypeIconHub3,\n node: TypeIconNode,\n hub5: TypeIconHub5,\n controller: TypeIconController,\n};\n\nconst defaultStyle: React.CSSProperties = {\n width: 32,\n height: 32,\n};\n\nexport interface IconProps {\n /** URL, UTF-8 character, or svg code (data:image/svg...) */\n src?: string | React.JSX.Element | null | undefined;\n /** Class name */\n className?: string;\n /** Style for image */\n style?: React.CSSProperties;\n /** Styles for mui */\n sx?: Record<string, any>;\n /** Tooltip */\n title?: string | true;\n /** Styles for utf-8 characters */\n styleUTF8?: React.CSSProperties;\n /** On error handler */\n onError?: React.ReactEventHandler<HTMLImageElement>;\n /** Reference to image */\n ref?: React.RefObject<HTMLImageElement>;\n /** Alternative text for image */\n alt?: string;\n /** On click handler */\n onClick?: React.MouseEventHandler<any>;\n}\n\nexport type TypeIconProps = IconProps & { type?: TypesExtended };\n\nexport function DeviceTypeIcon(props: TypeIconProps): React.JSX.Element | null {\n const [loaded, setLoaded] = React.useState(false);\n\n useEffect(() => {\n if (props.title && !loaded) {\n extendDeviceTypeTranslation();\n setLoaded(true);\n }\n }, [props.title]);\n\n if (!loaded && props.title) {\n return (\n <Box\n style={{ ...defaultStyle, ...(props.style || undefined) }}\n className={props.className}\n sx={props.sx}\n />\n );\n }\n // src could contain a device type too, so detect if it is a type\n const type: TypesExtended | undefined =\n props.type || (props.src ? (Object.keys(TYPE_ICONS).find(type => props.src === type) as TypesExtended) : undefined);\n\n if (!type && props.src) {\n return (\n <Icon\n style={defaultStyle}\n {...props}\n title={props.title === true ? undefined : props.title}\n src={props.src}\n />\n );\n }\n\n const TypeIcon = type && TYPE_ICONS[type];\n if (!TypeIcon) {\n // Show the first letter of a type\n return type ? (\n <span style={{ ...defaultStyle, ...(props.style || undefined) }}>{type[0].toUpperCase()}</span>\n ) : null;\n }\n\n const icon = (\n <TypeIcon\n style={{ ...defaultStyle, ...(props.style || undefined) }}\n onClick={props.onClick}\n className={props.className}\n sx={props.sx}\n />\n );\n\n if (props.title) {\n return (\n <Tooltip\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n title={props.title === true ? I18n.t(`type-${type}`) : props.title}\n >\n <div style={{ display: 'flex' }}>{icon}</div>\n </Tooltip>\n );\n }\n\n return icon;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DeviceTypeIcon.js","sourceRoot":"./src/","sources":["Components/DeviceType/DeviceTypeIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,kBAAkB,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO;AACH,0CAA0C;AAC1C,OAAO,IAAI,aAAa,EACxB,cAAc,IAAI,cAAc,EAChC,YAAY,IAAI,YAAY,EAC5B,WAAW,IAAI,aAAa,EAC5B,MAAM,IAAI,YAAY,EACtB,YAAY,IAAI,gBAAgB,EAChC,aAAa,IAAI,aAAa,EAC9B,UAAU,IAAI,cAAc,EAC5B,YAAY,IAAI,cAAc,EAC9B,UAAU,IAAI,mBAAmB,EACjC,KAAK,IAAI,UAAU,EACnB,QAAQ,IAAI,gBAAgB,GAC/B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,IAAI,WAAW,EAChC,iBAAiB,IAAI,UAAU,EAC/B,SAAS,IAAI,eAAe,EAC5B,cAAc,IAAI,eAAe,EACjC,mBAAmB,IAAI,mBAAmB,EAC1C,WAAW,IAAI,YAAY,EAC3B,UAAU,IAAI,YAAY,EAC1B,KAAK,IAAI,YAAY,EACrB,eAAe,IAAI,kBAAkB,GACxC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,IAAI,oBAAoB,EAAE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SAAS,CAAC,EAAE,EACzD,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,EAAE,EAAE,KAAK,CAAC,EAAE,GACd,CACL,CAAC;IAEF,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,CACH,oBAAC,OAAO,IACJ,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,EAAE,EACxD,KAAK,EAAE,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK;YAElE,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAG,IAAI,CAAO,CACvC,CACb,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import React, { useEffect } from 'react';\n\nimport { Box, Tooltip } from '@mui/material';\n\nimport { AiOutlineLineChart as TypeIconChart } from 'react-icons/ai';\nimport { GoDeviceCameraVideo as TypeIconCamera } from 'react-icons/go';\n\nimport {\n // FaExternalLinkSquareAlt as TypeIconURL,\n FaImage as TypeIconImage,\n FaRegLightbulb as TypeIconDimmer,\n FaInfoCircle as TypeIconInfo,\n FaLightbulb as TypeIconLight,\n FaLock as TypeIconLock,\n FaStreetView as TypeIconLocation,\n FaStepForward as TypeIconMedia,\n FaSlidersH as TypeIconSlider,\n FaVolumeDown as TypeIconVolume,\n FaVolumeUp as TypeIconVolumeGroup,\n FaFan as TypeIconAC,\n FaWrench as TypeIconInstance,\n} from 'react-icons/fa';\n\nimport {\n MdFormatColorFill as TypeIconHUE,\n MdFormatColorFill as TypeIconCT,\n MdWarning as TypeIconWarning,\n MdQuestionMark as TypeIconUnknown,\n MdOutlineMyLocation as TypeIconLocationOne,\n MdDeviceHub as TypeIconHub3,\n MdPolyline as TypeIconNode,\n MdHub as TypeIconHub5,\n MdControlCamera as TypeIconController,\n} from 'react-icons/md';\nimport { WiCloudy as TypeIconWeather } from 'react-icons/wi';\nimport { IoIosRadioButtonOn as TypeIconButtonSensor } from 'react-icons/io';\nimport { TbSunElectricity as TypeIconIlluminance } from 'react-icons/tb';\nimport { PiPaletteDuotone as TypeIconRGBWSingle } from 'react-icons/pi';\n\nimport { Types } from '@iobroker/type-detector';\n\nimport { I18n } from '../../i18n';\nimport { Icon } from '../Icon';\n\nimport {\n Cleaner as TypeIconVacuumCleaner,\n Humidity as TypeIconHumidity,\n Jalousie as TypeIconBlinds,\n PushButton as TypeIconButton,\n DoorOpened as TypeIconDoor,\n FireOn as TypeIconFireAlarm,\n FloodOn as TypeIconFloodAlarm,\n Gate as TypeIconGate,\n MotionOn as TypeIconMotion,\n RGB as TypeIconRGB,\n Socket as TypeIconSocket,\n Thermometer as TypeIconTemperature,\n Thermostat as TypeIconThermostat,\n // HeatValve as TypeIconValve,\n WindowOpened as TypeIconWindow,\n WindowTilted as TypeIconWindowTilt,\n type IconPropsSVG,\n} from './icons';\nimport { extendDeviceTypeTranslation } from './deviceTypeTranslations';\n\nexport type TypesExtended = Types | 'invalid' | 'hub3' | 'node' | 'hub5' | 'controller';\n\nconst TYPE_ICONS: Record<TypesExtended, React.FC<IconPropsSVG>> = {\n [Types.airCondition]: TypeIconAC,\n [Types.blind]: TypeIconBlinds,\n [Types.blindButtons]: TypeIconBlinds,\n [Types.button]: TypeIconButton,\n [Types.buttonSensor]: TypeIconButtonSensor,\n [Types.camera]: TypeIconCamera,\n [Types.chart]: TypeIconChart,\n // [Types.url]: TypeIconURL,\n [Types.image]: TypeIconImage,\n [Types.dimmer]: TypeIconDimmer,\n [Types.door]: TypeIconDoor,\n [Types.fireAlarm]: TypeIconFireAlarm,\n // @ts-expect-error special case\n 'sensor.alarm.fire': TypeIconFireAlarm,\n [Types.floodAlarm]: TypeIconFloodAlarm,\n 'sensor.alarm.flood': TypeIconFloodAlarm,\n [Types.gate]: TypeIconGate,\n [Types.humidity]: TypeIconHumidity,\n [Types.illuminance]: TypeIconIlluminance,\n [Types.info]: TypeIconInfo,\n [Types.light]: TypeIconLight,\n [Types.lock]: TypeIconLock,\n [Types.location]: TypeIconLocation,\n [Types.locationOne]: TypeIconLocationOne,\n [Types.media]: TypeIconMedia,\n [Types.motion]: TypeIconMotion,\n [Types.ct]: TypeIconCT,\n [Types.rgb]: TypeIconRGB,\n [Types.rgbSingle]: TypeIconRGB,\n [Types.rgbwSingle]: TypeIconRGBWSingle,\n [Types.hue]: TypeIconHUE,\n [Types.cie]: TypeIconRGB,\n [Types.slider]: TypeIconSlider,\n [Types.socket]: TypeIconSocket,\n [Types.temperature]: TypeIconTemperature,\n [Types.thermostat]: TypeIconThermostat,\n // [Types.valve]: TypeIconValve,\n [Types.vacuumCleaner]: TypeIconVacuumCleaner,\n [Types.volume]: TypeIconVolume,\n [Types.volumeGroup]: TypeIconVolumeGroup,\n [Types.window]: TypeIconWindow,\n [Types.windowTilt]: TypeIconWindowTilt,\n [Types.weatherCurrent]: TypeIconWeather,\n [Types.weatherForecast]: TypeIconWeather,\n [Types.warning]: TypeIconWarning,\n\n [Types.unknown]: TypeIconUnknown,\n [Types.instance]: TypeIconInstance,\n\n // Special matter types\n invalid: TypeIconWarning,\n hub3: TypeIconHub3,\n node: TypeIconNode,\n hub5: TypeIconHub5,\n controller: TypeIconController,\n};\n\nconst defaultStyle: React.CSSProperties = {\n width: 32,\n height: 32,\n};\n\nexport interface IconProps {\n /** URL, UTF-8 character, or svg code (data:image/svg...) */\n src?: string | React.JSX.Element | null | undefined;\n /** Class name */\n className?: string;\n /** Style for image */\n style?: React.CSSProperties;\n /** Styles for mui */\n sx?: Record<string, any>;\n /** Tooltip */\n title?: string | true;\n /** Styles for utf-8 characters */\n styleUTF8?: React.CSSProperties;\n /** On error handler */\n onError?: React.ReactEventHandler<HTMLImageElement>;\n /** Reference to image */\n ref?: React.RefObject<HTMLImageElement>;\n /** Alternative text for image */\n alt?: string;\n /** On click handler */\n onClick?: React.MouseEventHandler<any>;\n}\n\nexport type TypeIconProps = IconProps & { type?: TypesExtended };\n\nexport function DeviceTypeIcon(props: TypeIconProps): React.JSX.Element | null {\n const [loaded, setLoaded] = React.useState(false);\n\n useEffect(() => {\n if (props.title && !loaded) {\n extendDeviceTypeTranslation();\n setLoaded(true);\n }\n }, [props.title, loaded]);\n\n if (!loaded && props.title) {\n return (\n <Box\n style={{ ...defaultStyle, ...(props.style || undefined) }}\n className={props.className}\n sx={props.sx}\n />\n );\n }\n // src could contain a device type too, so detect if it is a type\n const type: TypesExtended | undefined =\n props.type ||\n (props.src ? (Object.keys(TYPE_ICONS).find(type => props.src === type) as TypesExtended) : undefined);\n\n if (!type && props.src) {\n return (\n <Icon\n style={defaultStyle}\n {...props}\n title={props.title === true ? undefined : props.title}\n src={props.src}\n />\n );\n }\n\n const TypeIcon = type && TYPE_ICONS[type];\n if (!TypeIcon) {\n // Show the first letter of a type\n return type ? (\n <span style={{ ...defaultStyle, ...(props.style || undefined) }}>{type[0].toUpperCase()}</span>\n ) : null;\n }\n\n const icon = (\n <TypeIcon\n style={{ ...defaultStyle, ...(props.style || undefined) }}\n onClick={props.onClick}\n className={props.className}\n sx={props.sx}\n />\n );\n\n if (props.title) {\n return (\n <Tooltip\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n title={props.title === true ? I18n.t(`type-${type}`) : props.title}\n >\n <div style={{ display: 'flex' }}>{icon}</div>\n </Tooltip>\n );\n }\n\n return icon;\n}\n"]}
|
|
@@ -44,7 +44,8 @@ export function DeviceTypeSelector(props) {
|
|
|
44
44
|
useEffect(() => {
|
|
45
45
|
const _typesWords = {};
|
|
46
46
|
Object.keys(Types)
|
|
47
|
-
.filter(id => (!props.supportedDevices || props.supportedDevices?.includes(id)) &&
|
|
47
|
+
.filter(id => (!props.supportedDevices || props.supportedDevices?.includes(id)) &&
|
|
48
|
+
!props.unsupportedDevices?.includes(id))
|
|
48
49
|
.forEach(typeId => (_typesWords[typeId] = I18n.t(`type-${Types[typeId]}`)));
|
|
49
50
|
// sort types by ABC in the current language
|
|
50
51
|
const _types = Object.keys(_typesWords);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceTypeSelector.js","sourceRoot":"./src/","sources":["Components/DeviceType/DeviceTypeSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAEvE,MAAM,MAAM,GAGR;IACA,mBAAmB,EAAE;QACjB,OAAO,EAAE,MAAM;QACf,KAAK,EAAE,MAAM;QACb,cAAc,EAAE,eAAe;KAClC;IACD,IAAI,EAAE;QACF,SAAS,EAAE,EAAE;KAChB;IACD,UAAU,EAAE;QACR,YAAY,EAAE,CAAC;QACf,aAAa,EAAE,QAAQ;QACvB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;KACb;IACD,UAAU,EAAE;QACR,aAAa,EAAE,QAAQ;KAC1B;IACD,WAAW,EAAE;QACT,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;KACvB;IACD,SAAS,EAAE;QACP,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,OAAO;KAClB;IACD,SAAS,EAAE;QACP,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,MAAM,EAAE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,CAAC;YAEpB,6BAAK,KAAK,EAAE,MAAM,CAAC,mBAAmB;gBAClC;oBACI,oBAAC,cAAc,IACX,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EACnB,KAAK,EAAE;4BACH,GAAG,MAAM,CAAC,UAAU;4BACpB,KAAK,EAAE,KAAK,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;yBACzD,GACH;oBACF,8BAAM,KAAK,EAAE,MAAM,CAAC,UAAU,IAAG,UAAU,CAAC,MAAM,CAAC,CAAQ,CACzD;gBACL,KAAK,CAAC,gBAAgB,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAC5C,6BAAK,KAAK,EAAE,MAAM,CAAC,WAAW,IACzB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAChE,KAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAC/C,oBAAC,IAAI,IACD,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,MAAM,CAAC,SAAS,EACvB,GAAG,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,GAC7C,CACL,CAAC,CAAC,CAAC,CACA,6BACI,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,MAAM,CAAC,SAAS,GACzB,CACL,CACJ,CACC,CACT,CAAC,CAAC,CAAC,IAAI,CACN,CACC,CACd,CAAC,CACG,CACC,CACjB,CAAC;AACN,CAAC","sourcesContent":["import React, { useEffect } from 'react';\nimport { Box, FormControl, InputLabel, MenuItem, Select } from '@mui/material';\n\nimport { Types } from '@iobroker/type-detector';\n\nimport { I18n } from '../../i18n';\nimport { Icon } from '../Icon';\nimport type { ThemeType } from '../../types';\n\nimport { DeviceTypeIcon } from './DeviceTypeIcon';\nimport { extendDeviceTypeTranslation } from './deviceTypeTranslations';\n\nconst styles: Record<\n 'itemChildrenWrapper' | 'type' | 'selectIcon' | 'selectText' | 'iconWrapper' | 'iconStyle' | 'emptyIcon',\n React.CSSProperties\n> = {\n itemChildrenWrapper: {\n display: 'flex',\n width: '100%',\n justifyContent: 'space-between',\n },\n type: {\n marginTop: 10,\n },\n selectIcon: {\n paddingRight: 8,\n verticalAlign: 'middle',\n width: 20,\n height: 20,\n },\n selectText: {\n verticalAlign: 'middle',\n },\n iconWrapper: {\n display: 'flex',\n alignItems: 'center',\n },\n iconStyle: {\n width: 16,\n height: 16,\n margin: '0 3px',\n },\n emptyIcon: {\n width: 16,\n height: 16,\n margin: '0 3px',\n },\n};\n\nexport function DeviceTypeSelector(props: {\n themeType: ThemeType;\n supportedDevices?: Types[];\n unsupportedDevices?: Types[];\n value?: Types | '';\n onChange: (value: Types) => void;\n label?: string;\n style?: React.CSSProperties;\n sx?: Record<string, any>;\n disabled?: boolean;\n error?: boolean;\n /** Show icons for applications: google, amazon, material, alias. Used in devices */\n showApplications?: {\n TYPE_OPTIONS: Partial<Record<Types, Record<string, boolean>>>;\n ICONS_TYPE: Record<string, React.JSX.Element>;\n };\n}): React.JSX.Element {\n const [typesWords, setTypesWords] = React.useState<Partial<Record<Types, string>>>({});\n const [types, setTypes] = React.useState<Types[] | null>([]);\n\n useEffect(() => {\n const _typesWords: Partial<Record<Types, string>> = {};\n Object.keys(Types)\n .filter(\n id =>\n (!props.supportedDevices || props.supportedDevices?.includes(id as Types)) &&\n !props.unsupportedDevices?.includes(id as Types),\n )\n .forEach(typeId => (_typesWords[typeId as Types] = I18n.t(`type-${Types[typeId as Types]}`)));\n\n // sort types by ABC in the current language\n const _types: Types[] = Object.keys(_typesWords) as Types[];\n\n _types.sort((a, b) => {\n if (_typesWords[a] === _typesWords[b]) {\n return 0;\n }\n return _typesWords[a].localeCompare(_typesWords[b], 'de');\n });\n\n extendDeviceTypeTranslation();\n\n setTypes(_types);\n setTypesWords(_typesWords);\n }, [props.supportedDevices, props.unsupportedDevices]);\n\n if (!types) {\n return (\n <Box\n style={{\n ...styles.type,\n ...props.style,\n }}\n sx={props.sx}\n />\n );\n }\n\n return (\n <FormControl\n style={{\n ...styles.type,\n ...props.style,\n }}\n sx={props.sx}\n variant=\"standard\"\n error={!!props.error}\n >\n <InputLabel>{props.label || I18n.t('type-Device type')}</InputLabel>\n <Select\n variant=\"standard\"\n disabled={!!props.disabled}\n value={props.value}\n onChange={e => props.onChange(e.target.value as Types)}\n >\n {types.map(typeId => (\n <MenuItem\n key={Types[typeId]}\n value={Types[typeId]}\n >\n <div style={styles.itemChildrenWrapper}>\n <div>\n <DeviceTypeIcon\n type={Types[typeId]}\n style={{\n ...styles.selectIcon,\n color: props.themeType === 'dark' ? '#FFFFFF' : '#000',\n }}\n />\n <span style={styles.selectText}>{typesWords[typeId]}</span>\n </div>\n {props.showApplications?.TYPE_OPTIONS[typeId] ? (\n <div style={styles.iconWrapper}>\n {Object.keys(props.showApplications.TYPE_OPTIONS[typeId]).map(key =>\n props.showApplications.TYPE_OPTIONS[typeId][key] ? (\n <Icon\n key={key}\n style={styles.iconStyle}\n src={props.showApplications.ICONS_TYPE[key]}\n />\n ) : (\n <div\n key={key}\n style={styles.emptyIcon}\n />\n ),\n )}\n </div>\n ) : null}\n </div>\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n}\n"]}
|
|
@@ -9,18 +9,22 @@ import itLang from './i18n/it.json';
|
|
|
9
9
|
import nlLang from './i18n/nl.json';
|
|
10
10
|
import ukLang from './i18n/uk.json';
|
|
11
11
|
import zhLang from './i18n/zh-cn.json';
|
|
12
|
+
let translationLoaded = false;
|
|
12
13
|
export function extendDeviceTypeTranslation() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
if (!translationLoaded) {
|
|
15
|
+
translationLoaded = true;
|
|
16
|
+
I18n.extendTranslations({
|
|
17
|
+
en: enLang,
|
|
18
|
+
de: deLang,
|
|
19
|
+
ru: ruLang,
|
|
20
|
+
pt: ptLang,
|
|
21
|
+
pl: plLang,
|
|
22
|
+
fr: frLang,
|
|
23
|
+
it: itLang,
|
|
24
|
+
nl: nlLang,
|
|
25
|
+
uk: ukLang,
|
|
26
|
+
'zh-cn': zhLang,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
//# sourceMappingURL=deviceTypeTranslations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceTypeTranslations.js","sourceRoot":"./src/","sources":["Components/DeviceType/deviceTypeTranslations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,UAAU,2BAA2B;IACvC,IAAI,CAAC,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"deviceTypeTranslations.js","sourceRoot":"./src/","sources":["Components/DeviceType/deviceTypeTranslations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,MAAM,UAAU,2BAA2B;IACvC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACrB,iBAAiB,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,kBAAkB,CAAC;YACpB,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,EAAE,EAAE,MAAM;YACV,OAAO,EAAE,MAAM;SAClB,CAAC,CAAC;IACP,CAAC;AACL,CAAC","sourcesContent":["import { I18n } from '../../i18n';\nimport enLang from './i18n/en.json';\nimport deLang from './i18n/de.json';\nimport ruLang from './i18n/ru.json';\nimport ptLang from './i18n/pt.json';\nimport plLang from './i18n/pl.json';\nimport frLang from './i18n/fr.json';\nimport itLang from './i18n/it.json';\nimport nlLang from './i18n/nl.json';\nimport ukLang from './i18n/uk.json';\nimport zhLang from './i18n/zh-cn.json';\n\nlet translationLoaded = false;\nexport function extendDeviceTypeTranslation(): void {\n if (!translationLoaded) {\n translationLoaded = true;\n I18n.extendTranslations({\n en: enLang,\n de: deLang,\n ru: ruLang,\n pt: ptLang,\n pl: plLang,\n fr: frLang,\n it: itLang,\n nl: nlLang,\n uk: ukLang,\n 'zh-cn': zhLang,\n });\n }\n}\n"]}
|
|
@@ -99,6 +99,8 @@ export interface TreeItem {
|
|
|
99
99
|
data: TreeItemData;
|
|
100
100
|
children?: TreeItem[];
|
|
101
101
|
}
|
|
102
|
+
/** Converts ioB pattern into regex */
|
|
103
|
+
export declare function pattern2RegEx(pattern: string): string;
|
|
102
104
|
export declare function filterRoles(roleArray: {
|
|
103
105
|
role: string;
|
|
104
106
|
type: ioBroker.CommonType;
|
|
@@ -577,6 +579,7 @@ export declare class ObjectBrowserClass extends Component<ObjectBrowserProps, Ob
|
|
|
577
579
|
private getTooltipInfo;
|
|
578
580
|
/**
|
|
579
581
|
* This function renders the value in different forms in the table
|
|
582
|
+
*
|
|
580
583
|
* @param id state ID
|
|
581
584
|
* @param item Item
|
|
582
585
|
* @param narrowStyleWithDetails if use mobile view
|