@iobroker/json-config 7.6.18 → 7.6.19

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 CHANGED
@@ -535,7 +535,7 @@ To use this, you must first provide the OAuth2 data (client ID, secret, etc.) to
535
535
  "type": "oauth2",
536
536
  "identifier": "spotify",
537
537
  "label": "Get Spotify OAuth2 Token",
538
- "label": "Refresh Spotify OAuth2 Token",
538
+ "refreshLabel": "Refresh Spotify OAuth2 Token",
539
539
  "icon": "data:image/svg+xml;base64,...",
540
540
  }
541
541
  ```
@@ -1130,34 +1130,35 @@ Special input for ports. It checks automatically if port is used by other instan
1130
1130
  (admin >= 7.1.0) Show control or information from the state
1131
1131
  (admin >= 7.6.4) attributes `showEnterButton` and `setOnEnterKey`
1132
1132
 
1133
- | Property | Description |
1134
- |-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1135
- | `oid` | Which object ID should be taken for the controlling. The ID is without `adapter.X.` prefix |
1136
- | `system` | If true, the state will be taken from `system.adapter.X.` and not from `adapter.X` |
1137
- | `foreign` | The `oid` is absolute and no need to add `adapter.X` or `system.adapter.X.` to oid |
1138
- | `control` | How the value of the state should be shown: `text`, `html`, `input`, `slider`, `select`, `button`, `switch`, `number` |
1139
- | `controlled` | If true, the state will be shown as switch, select, button, slider or text input. Used only if no control property is defined |
1140
- | `unit` | Add unit to the value |
1141
- | `trueText` | this text will be shown if the value is true |
1142
- | `trueTextStyle` | Style of the text if the value is true |
1143
- | `falseText` | this text will be shown if the value is false or if the control is a "button" |
1144
- | `falseTextStyle` | Style of the text if the value is false or if the control is a "button" |
1145
- | `trueImage` | This image will be shown if the value is true |
1146
- | `falseImage` | This image will be shown if the value is false or if the control is a "button" |
1147
- | `min` | Minimum value for control type slider or number |
1148
- | `max` | Maximum value for control type slider or number |
1149
- | `step` | Step value for control type slider or number |
1150
- | `controlDelay` | delay in ms for slider or number |
1151
- | `variant` | Variant of button: `contained`, `outlined`, `text` |
1152
- | `readOnly` | Defines if the control is read-only |
1153
- | `narrow` | Normally the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label |
1154
- | `blinkOnUpdate` | Value should blink when updated (true or color) |
1155
- | `size` | Font size: small, normal, large or number |
1156
- | `addColon` | Add to label the colon at the end if not exist in label |
1157
- | `labelIcon` | Base64 icon for label |
1158
- | `buttonValue` | Optional value, that will be sent for button |
1159
- | `showEnterButton` | Show SET button. The value in this case will be sent only when the button is pressed. You can define the text of the button. Default text is "Set" (Only for "input", "number" or "slider") |
1160
- | `setOnEnterKey` | The value in this case will be sent only when the "Enter" button is pressed. It can be combined with `showEnterButton` |
1133
+ | Property | Description |
1134
+ |-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1135
+ | `oid` | Which object ID should be taken for the controlling. The ID is without `adapter.X.` prefix |
1136
+ | `system` | If true, the state will be taken from `system.adapter.X.` and not from `adapter.X` |
1137
+ | `foreign` | The `oid` is absolute and no need to add `adapter.X` or `system.adapter.X.` to oid |
1138
+ | `control` | How the value of the state should be shown: `text`, `html`, `input`, `slider`, `select`, `button`, `switch`, `number` |
1139
+ | `controlled` | If true, the state will be shown as switch, select, button, slider or text input. Used only if no control property is defined |
1140
+ | `unit` | Add unit to the value |
1141
+ | `trueText` | this text will be shown if the value is true |
1142
+ | `trueTextStyle` | Style of the text if the value is true |
1143
+ | `falseText` | this text will be shown if the value is false or if the control is a "button" |
1144
+ | `falseTextStyle` | Style of the text if the value is false or if the control is a "button" |
1145
+ | `trueImage` | This image will be shown if the value is true |
1146
+ | `falseImage` | This image will be shown if the value is false or if the control is a "button" |
1147
+ | `min` | Minimum value for control type slider or number |
1148
+ | `max` | Maximum value for control type slider or number |
1149
+ | `step` | Step value for control type slider or number |
1150
+ | `controlDelay` | delay in ms for slider or number |
1151
+ | `variant` | Variant of button: `contained`, `outlined`, `text` |
1152
+ | `readOnly` | Defines if the control is read-only |
1153
+ | `narrow` | Normally the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label |
1154
+ | `blinkOnUpdate` | Value should blink when updated (true or color) |
1155
+ | `size` | Font size: small, normal, large or number |
1156
+ | `addColon` | Add to label the colon at the end if not exist in label |
1157
+ | `labelIcon` | Base64 icon for label |
1158
+ | `buttonValue` | Optional value, that will be sent for button |
1159
+ | `showEnterButton` | Show SET button. The value in this case will be sent only when the button is pressed. You can define the text of the button. Default text is "Set" (Only for "input", "number" or "slider") |
1160
+ | `setOnEnterKey` | The value in this case will be sent only when the "Enter" button is pressed. It can be combined with `showEnterButton` |
1161
+ | `options` | Options for `select` in form `["value1", "value2", ...]` or `[{"value": "value", "label": "Value1", "color": "red"}, "value2", ...]`. If not defiled, the `common.states` in the object must exist. |
1161
1162
 
1162
1163
  ### `staticInfo`
1163
1164
 
@@ -1182,6 +1183,19 @@ This control is used mostly in dynamic forms
1182
1183
  | `highlight` | (optional) Highlight line on mouse over |
1183
1184
  | `booleanAsCheckbox` | (optional) Show boolean values as checkbox |
1184
1185
 
1186
+ ### `infoBox`
1187
+
1188
+ Shows closable static text with optional title and icon. (From admin >= 7.6.19)
1189
+
1190
+ | Property | Description |
1191
+ |----------------|---------------------------------------------------------------|
1192
+ | `text` | Text to be shown |
1193
+ | `title` | (optional) title for info box |
1194
+ | `boxType` | (optional) `warning`, `info`, `error`, `ok`. (Default `info`) |
1195
+ | `closeable` | (optional) If the box is closeable (Default `true`) |
1196
+ | `iconPosition` | (optional) `top`, `middle` (Default `middle`) |
1197
+ | `closed` | (optional) Will be shown as closed at the beginning |
1198
+
1185
1199
  ### `deviceManager`
1186
1200
 
1187
1201
  show device manager. For that, the adapter must support device manager protocol. See iobroker/dm-utils.
@@ -0,0 +1,10 @@
1
+ import { type JSX } from 'react';
2
+ import type { ConfigItemInfoBox } from '../types';
3
+ import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
4
+ interface ConfigInfoBoxProps extends ConfigGenericProps {
5
+ schema: ConfigItemInfoBox;
6
+ }
7
+ export default class ConfigInfoBox extends ConfigGeneric<ConfigInfoBoxProps, ConfigGenericState> {
8
+ renderItem(): JSX.Element;
9
+ }
10
+ export {};
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Box } from '@mui/material';
3
+ import { InfoBox } from '@iobroker/adapter-react-v5';
4
+ import ConfigGeneric from './ConfigGeneric';
5
+ export default class ConfigInfoBox extends ConfigGeneric {
6
+ renderItem() {
7
+ return (React.createElement(InfoBox, { type: this.props.schema.boxType || 'info', closeable: this.props.schema.closeable !== undefined ? this.props.schema.closeable : true, storeId: this.props.schema.closed !== undefined ? undefined : `${!!this.props.oContext.adapterName} ${this.props.attr}`, closed: this.props.schema.closed, style: { width: '100%', ...this.props.schema.style } },
8
+ this.props.schema.title ? (React.createElement(Box, { component: "div", sx: { fontWeight: 'bold', fontSize: 'larger' } }, this.getText(this.props.schema.title))) : null,
9
+ this.getText(this.props.schema.text)));
10
+ }
11
+ }
12
+ //# sourceMappingURL=ConfigInfoBox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigInfoBox.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigInfoBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGrD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAMlG,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,aAAqD;IAC5F,UAAU;QACN,OAAO,CACH,oBAAC,OAAO,IACJ,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,EACzC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EACzF,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EACvH,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAChC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE;YAEnD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CACvB,oBAAC,GAAG,IACA,SAAS,EAAC,KAAK,EACf,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAE7C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CACpC,CACT,CAAC,CAAC,CAAC,IAAI;YACP,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAC/B,CACb,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Box } from '@mui/material';\n\nimport { InfoBox } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemInfoBox } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigInfoBoxProps extends ConfigGenericProps {\n schema: ConfigItemInfoBox;\n}\n\nexport default class ConfigInfoBox extends ConfigGeneric<ConfigInfoBoxProps, ConfigGenericState> {\n renderItem(): JSX.Element {\n return (\n <InfoBox\n type={this.props.schema.boxType || 'info'}\n closeable={this.props.schema.closeable !== undefined ? this.props.schema.closeable : true}\n storeId={this.props.schema.closed !== undefined ? undefined : `${!!this.props.oContext.adapterName} ${this.props.attr}`}\n closed={this.props.schema.closed}\n style={{ width: '100%', ...this.props.schema.style }}\n >\n {this.props.schema.title ? (\n <Box\n component=\"div\"\n sx={{ fontWeight: 'bold', fontSize: 'larger' }}\n >\n {this.getText(this.props.schema.title)}\n </Box>\n ) : null}\n {this.getText(this.props.schema.text)}\n </InfoBox>\n );\n }\n}\n"]}
@@ -25,6 +25,7 @@ import ConfigFunc from './ConfigFunc';
25
25
  import ConfigIP from './ConfigIP';
26
26
  import ConfigImageSendTo from './ConfigImageSendTo';
27
27
  import ConfigImageUpload from './ConfigImageUpload';
28
+ import ConfigInfoBox from './ConfigInfoBox';
28
29
  import ConfigInstanceSelect from './ConfigInstanceSelect';
29
30
  import ConfigInterface from './ConfigInterface';
30
31
  import ConfigJsonEditor from './ConfigJsonEditor';
@@ -81,6 +82,7 @@ const components = {
81
82
  header: ConfigStaticHeader,
82
83
  image: ConfigImageUpload,
83
84
  imageSendTo: ConfigImageSendTo,
85
+ infoBox: ConfigInfoBox,
84
86
  instance: ConfigInstanceSelect,
85
87
  interface: ConfigInterface,
86
88
  ip: ConfigIP,
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigPanel.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAuC,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGxF,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,wBAA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,YAAY,EAAE,CAAC,EAAE,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,IAE/E,OAAO,CACJ,CACX,CAAC;YAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,OAAO,CACH;oBACI,6BAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAI;oBAC/C,IAAI,CACN,CACN,CAAC;YACN,CAAC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Grid2, Accordion, AccordionSummary, AccordionDetails, Typography, Box } from '@mui/material';\n\nimport { ExpandMore as ExpandMoreIcon } from '@mui/icons-material';\n\nimport { type AdminConnection, type IobTheme, Utils } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemPanel } from '../types';\n\nimport ConfigGeneric, { type ConfigGenericState, type ConfigGenericProps } from './ConfigGeneric';\nimport ConfigAccordion from './ConfigAccordion';\nimport ConfigAlive from './ConfigAlive';\nimport ConfigAutocomplete from './ConfigAutocomplete';\nimport ConfigAutocompleteSendTo from './ConfigAutocompleteSendTo';\nimport ConfigCRON from './ConfigCRON';\nimport ConfigCertificateSelect from './ConfigCertificateSelect';\nimport ConfigCertificates from './ConfigCertificates';\nimport ConfigCertCollection from './ConfigCertCollection';\nimport ConfigCheckLicense from './ConfigCheckLicense';\nimport ConfigCheckbox from './ConfigCheckbox';\nimport ConfigChip from './ConfigChip';\nimport ConfigColor from './ConfigColor';\nimport ConfigCoordinates from './ConfigCoordinates';\nimport ConfigCustom from './ConfigCustom';\nimport ConfigDatePicker from './ConfigDatePicker';\nimport ConfigDeviceManager from './ConfigDeviceManager';\nimport ConfigFile from './ConfigFile';\nimport ConfigFileSelector from './ConfigFileSelector';\nimport ConfigFunc from './ConfigFunc';\nimport ConfigIP from './ConfigIP';\nimport ConfigImageSendTo from './ConfigImageSendTo';\nimport ConfigImageUpload from './ConfigImageUpload';\nimport ConfigInstanceSelect from './ConfigInstanceSelect';\nimport ConfigInterface from './ConfigInterface';\nimport ConfigJsonEditor from './ConfigJsonEditor';\nimport ConfigLanguage from './ConfigLanguage';\nimport ConfigLicense from './ConfigLicense';\nimport ConfigNumber from './ConfigNumber';\nimport ConfigOauth2 from './ConfigOAuth2';\nimport ConfigObjectId from './ConfigObjectId';\nimport ConfigPassword from './ConfigPassword';\nimport ConfigPattern from './ConfigPattern';\nimport ConfigPort from './ConfigPort';\nimport ConfigRoom from './ConfigRoom';\nimport ConfigSelect from './ConfigSelect';\nimport ConfigSelectSendTo from './ConfigSelectSendTo';\nimport ConfigSendTo from './ConfigSendto';\nimport ConfigSetState from './ConfigSetState';\nimport ConfigSlider from './ConfigSlider';\nimport ConfigState from './ConfigState';\nimport ConfigStaticDivider from './ConfigStaticDivider';\nimport ConfigStaticHeader from './ConfigStaticHeader';\nimport ConfigStaticImage from './ConfigStaticImage';\nimport ConfigStaticInfo from './ConfigStaticInfo';\nimport ConfigStaticText from './ConfigStaticText';\nimport ConfigTable from './ConfigTable';\nimport ConfigText from './ConfigText';\nimport ConfigTextSendTo from './ConfigTextSendTo';\nimport ConfigTimePicker from './ConfigTimePicker';\nimport ConfigTopic from './ConfigTopic';\nimport ConfigUUID from './ConfigUUID';\nimport ConfigUser from './ConfigUser';\nimport ConfigQrCode from './ConfigQrCode';\n\nconst components: Record<string, typeof ConfigGeneric<any, any>> = {\n accordion: ConfigAccordion,\n alive: ConfigAlive,\n autocomplete: ConfigAutocomplete,\n autocompleteSendTo: ConfigAutocompleteSendTo,\n certCollection: ConfigCertCollection,\n certificate: ConfigCertificateSelect,\n certificates: ConfigCertificates,\n checkbox: ConfigCheckbox,\n checkLicense: ConfigCheckLicense,\n chip: ConfigChip, // deprecated. Use \"chips\"\n chips: ConfigChip,\n color: ConfigColor,\n coordinates: ConfigCoordinates,\n cron: ConfigCRON,\n custom: ConfigCustom,\n datePicker: ConfigDatePicker,\n deviceManager: ConfigDeviceManager,\n divider: ConfigStaticDivider,\n file: ConfigFile,\n fileSelector: ConfigFileSelector,\n func: ConfigFunc,\n header: ConfigStaticHeader,\n image: ConfigImageUpload,\n imageSendTo: ConfigImageSendTo,\n instance: ConfigInstanceSelect,\n interface: ConfigInterface,\n ip: ConfigIP,\n jsonEditor: ConfigJsonEditor,\n language: ConfigLanguage,\n license: ConfigLicense,\n number: ConfigNumber,\n oauth2: ConfigOauth2,\n objectId: ConfigObjectId,\n password: ConfigPassword,\n pattern: ConfigPattern,\n port: ConfigPort,\n qrCode: ConfigQrCode,\n room: ConfigRoom,\n select: ConfigSelect,\n selectSendTo: ConfigSelectSendTo,\n // @deprecated Use \"sendTo\"\n sendto: ConfigSendTo,\n sendTo: ConfigSendTo,\n setState: ConfigSetState,\n slider: ConfigSlider,\n state: ConfigState,\n staticImage: ConfigStaticImage,\n staticInfo: ConfigStaticInfo,\n staticLink: ConfigStaticText,\n staticText: ConfigStaticText,\n table: ConfigTable,\n text: ConfigText,\n textSendTo: ConfigTextSendTo,\n timePicker: ConfigTimePicker,\n topic: ConfigTopic,\n uuid: ConfigUUID,\n user: ConfigUser,\n};\n\nconst styles: Record<string, any> = {\n fullWidth: {\n width: '100%',\n // height: '100%',\n },\n paper: {\n margin: 1,\n width: 'auto !important',\n overflowY: 'auto',\n paddingBottom: 1,\n },\n paperWithIcons: {\n height: 'calc(100vh - 259px) !important',\n },\n paperWithoutIcons: {\n height: 'calc(100vh - 235px) !important',\n },\n padding: {\n padding: '10px',\n },\n heading: {},\n primary: (theme: IobTheme): React.CSSProperties => ({\n backgroundColor: theme.palette.primary.main,\n color: theme.palette.mode === 'dark' ? 'inherit' : '#FFF',\n }),\n secondary: (theme: IobTheme): React.CSSProperties => ({\n backgroundColor: theme.palette.secondary.main,\n }),\n};\n\ninterface ConfigPanelProps extends ConfigGenericProps {\n schema: ConfigItemPanel;\n withIcons?: boolean;\n withoutSaveButtons?: boolean;\n}\ninterface ConfigPanelState extends ConfigGenericState {\n expanded?: boolean;\n}\n\nclass ConfigPanel extends ConfigGeneric<ConfigPanelProps, ConfigPanelState> {\n componentDidMount(): void {\n super.componentDidMount();\n if (this.props.schema?.collapsable) {\n this.setState({\n expanded:\n (((window as any)._localStorage as Storage) || window.localStorage).getItem(\n `${this.props.oContext.adapterName}.${this.props.attr}`,\n ) === 'true',\n });\n }\n }\n\n renderItems(items: Record<string, any>, disabled: boolean): JSX.Element[] | null {\n return items\n ? Object.keys(items).map(attr => {\n if (this.props.oContext.multiEdit && items[attr].noMultiEdit) {\n return null;\n }\n\n const type = items[attr].type || 'panel';\n let ItemComponent: typeof ConfigGeneric<ConfigGenericProps, any>;\n let socket: string | AdminConnection = 'Use this.props.oContext.socket!';\n if (type === 'custom') {\n // name\n // url\n if (items[attr].url) {\n ItemComponent = ConfigCustom;\n } else if (this.props.oContext.customs && this.props.oContext.customs[items[attr].component]) {\n ItemComponent = this.props.oContext.customs[items[attr].component];\n } else {\n console.error(`Cannot find custom component: ${items[attr].component}`);\n ItemComponent = ConfigGeneric;\n }\n socket = this.props.oContext.socket;\n } else if (type === 'panel') {\n ItemComponent = ConfigPanel;\n } else {\n ItemComponent = components[type] || ConfigGeneric;\n }\n\n return (\n <ItemComponent\n // @ts-expect-error Temporary work-around, till all custom components will not migrate to oContext\n socket={socket}\n globalData={this.props.globalData}\n oContext={this.props.oContext}\n key={`${attr}_${this.props.index === undefined ? '' : this.props.index}`}\n index={this.props.index}\n changed={this.props.changed}\n arrayIndex={this.props.arrayIndex}\n expertMode={this.props.expertMode}\n commandRunning={this.props.commandRunning}\n style={styles.panel}\n common={this.props.common}\n alive={this.props.alive}\n themeName={this.props.themeName}\n data={this.props.data}\n originalData={this.props.originalData}\n onError={this.props.onError}\n onChange={this.props.onChange}\n disabled={disabled}\n customObj={this.props.customObj}\n custom={this.props.custom}\n schema={items[attr]}\n attr={attr}\n table={this.props.table}\n />\n );\n })\n : null;\n }\n\n render(): JSX.Element | null {\n const schema = this.props.schema;\n\n if (!schema) {\n return null;\n }\n\n const { disabled, hidden } = this.calculate(schema);\n\n const items = this.props.schema.items;\n const schemaStyle = this.props.schema.style || {};\n\n if (hidden) {\n if (schema.hideOnlyControl) {\n const item = (\n <Grid2\n size={{\n xs: schema.xs || undefined,\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n sx={Utils.getStyle(\n this.props.oContext.theme,\n { marginBottom: 0, textAlign: 'left' /* marginRight: 8, */ },\n schemaStyle,\n this.props.oContext.themeType === 'dark' && schema.darkStyle,\n )}\n />\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n return item;\n }\n return null;\n }\n\n if (this.props.table) {\n return this.renderItems(items, disabled) as any as JSX.Element;\n }\n\n if (this.props.custom) {\n return (\n <Grid2\n key={`${this.props.attr}_${this.props.index}`}\n container\n style={styles.fullWidth}\n columnSpacing={2}\n rowSpacing={1}\n sx={schemaStyle}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n );\n }\n\n let content;\n if (schema.collapsable) {\n content = (\n <Accordion\n key={`${this.props.attr}_${this.props.index}`}\n style={styles.fullWidth}\n expanded={!!this.state.expanded}\n onChange={() => {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.oContext.adapterName}.${this.props.attr}`,\n this.state.expanded ? 'false' : 'true',\n );\n this.setState({ expanded: !this.state.expanded });\n }}\n >\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n sx={Utils.getStyle(\n this.props.oContext.theme,\n schemaStyle,\n this.props.oContext.themeType && schema.darkStyle,\n schema.color === 'primary'\n ? styles.primary\n : schema.color === 'secondary' && styles.secondary,\n { width: '100%' },\n )}\n >\n <Typography style={styles.heading}>{this.getText(schema.label)}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <Grid2\n container\n columnSpacing={2}\n rowSpacing={1}\n sx={{ ...schemaStyle, width: '100%', padding: '10px' }}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n </AccordionDetails>\n </Accordion>\n );\n } else {\n const sx = Utils.getStyle(\n this.props.oContext.theme,\n this.props.style,\n schemaStyle,\n { width: '100%' },\n this.props.isParentTab && styles.paper,\n this.props.isParentTab &&\n (this.props.withoutSaveButtons\n ? this.props.withIcons\n ? { height: 'calc(100% - 88px) !important' }\n : { height: 'calc(100% - 64px) !important' }\n : this.props.withIcons\n ? styles.paperWithIcons\n : styles.paperWithoutIcons),\n );\n\n content = (\n <Box\n component=\"div\"\n key={`${this.props.attr}_${this.props.index}`}\n className={this.props.className}\n sx={sx}\n >\n <Grid2\n container\n columnSpacing={2}\n rowSpacing={1}\n sx={Utils.getStyle(\n this.props.oContext.theme,\n { width: '100%' },\n this.props.isParentTab && styles.padding,\n this.props.schema.innerStyle,\n )}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n </Box>\n );\n }\n\n if (!this.props.isParentTab) {\n const item = (\n <Grid2\n title={this.getText(schema.tooltip)}\n size={{\n xs: schema.xs || undefined,\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n sx={{ marginBottom: 0, /* marginRight: 8, */ textAlign: 'left', ...schemaStyle }}\n >\n {content}\n </Grid2>\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n return item;\n }\n return content;\n }\n}\n\nexport default ConfigPanel;\n"]}
1
+ {"version":3,"file":"ConfigPanel.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO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,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EACnC,IAAI,EAAE;oBACF,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;iBAC7B,EACD,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,IAE/E,OAAO,CACJ,CACX,CAAC;YAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,OAAO,CACH;oBACI,6BAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAI;oBAC/C,IAAI,CACN,CACN,CAAC;YACN,CAAC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Grid2, Accordion, AccordionSummary, AccordionDetails, Typography, Box } from '@mui/material';\n\nimport { ExpandMore as ExpandMoreIcon } from '@mui/icons-material';\n\nimport { type AdminConnection, type IobTheme, Utils } from '@iobroker/adapter-react-v5';\nimport type { ConfigItemPanel } from '../types';\n\nimport ConfigGeneric, { type ConfigGenericState, type ConfigGenericProps } from './ConfigGeneric';\nimport ConfigAccordion from './ConfigAccordion';\nimport ConfigAlive from './ConfigAlive';\nimport ConfigAutocomplete from './ConfigAutocomplete';\nimport ConfigAutocompleteSendTo from './ConfigAutocompleteSendTo';\nimport ConfigCRON from './ConfigCRON';\nimport ConfigCertificateSelect from './ConfigCertificateSelect';\nimport ConfigCertificates from './ConfigCertificates';\nimport ConfigCertCollection from './ConfigCertCollection';\nimport ConfigCheckLicense from './ConfigCheckLicense';\nimport ConfigCheckbox from './ConfigCheckbox';\nimport ConfigChip from './ConfigChip';\nimport ConfigColor from './ConfigColor';\nimport ConfigCoordinates from './ConfigCoordinates';\nimport ConfigCustom from './ConfigCustom';\nimport ConfigDatePicker from './ConfigDatePicker';\nimport ConfigDeviceManager from './ConfigDeviceManager';\nimport ConfigFile from './ConfigFile';\nimport ConfigFileSelector from './ConfigFileSelector';\nimport ConfigFunc from './ConfigFunc';\nimport ConfigIP from './ConfigIP';\nimport ConfigImageSendTo from './ConfigImageSendTo';\nimport ConfigImageUpload from './ConfigImageUpload';\nimport ConfigInfoBox from './ConfigInfoBox';\nimport ConfigInstanceSelect from './ConfigInstanceSelect';\nimport ConfigInterface from './ConfigInterface';\nimport ConfigJsonEditor from './ConfigJsonEditor';\nimport ConfigLanguage from './ConfigLanguage';\nimport ConfigLicense from './ConfigLicense';\nimport ConfigNumber from './ConfigNumber';\nimport ConfigOauth2 from './ConfigOAuth2';\nimport ConfigObjectId from './ConfigObjectId';\nimport ConfigPassword from './ConfigPassword';\nimport ConfigPattern from './ConfigPattern';\nimport ConfigPort from './ConfigPort';\nimport ConfigRoom from './ConfigRoom';\nimport ConfigSelect from './ConfigSelect';\nimport ConfigSelectSendTo from './ConfigSelectSendTo';\nimport ConfigSendTo from './ConfigSendto';\nimport ConfigSetState from './ConfigSetState';\nimport ConfigSlider from './ConfigSlider';\nimport ConfigState from './ConfigState';\nimport ConfigStaticDivider from './ConfigStaticDivider';\nimport ConfigStaticHeader from './ConfigStaticHeader';\nimport ConfigStaticImage from './ConfigStaticImage';\nimport ConfigStaticInfo from './ConfigStaticInfo';\nimport ConfigStaticText from './ConfigStaticText';\nimport ConfigTable from './ConfigTable';\nimport ConfigText from './ConfigText';\nimport ConfigTextSendTo from './ConfigTextSendTo';\nimport ConfigTimePicker from './ConfigTimePicker';\nimport ConfigTopic from './ConfigTopic';\nimport ConfigUUID from './ConfigUUID';\nimport ConfigUser from './ConfigUser';\nimport ConfigQrCode from './ConfigQrCode';\n\nconst components: Record<string, typeof ConfigGeneric<any, any>> = {\n accordion: ConfigAccordion,\n alive: ConfigAlive,\n autocomplete: ConfigAutocomplete,\n autocompleteSendTo: ConfigAutocompleteSendTo,\n certCollection: ConfigCertCollection,\n certificate: ConfigCertificateSelect,\n certificates: ConfigCertificates,\n checkbox: ConfigCheckbox,\n checkLicense: ConfigCheckLicense,\n chip: ConfigChip, // deprecated. Use \"chips\"\n chips: ConfigChip,\n color: ConfigColor,\n coordinates: ConfigCoordinates,\n cron: ConfigCRON,\n custom: ConfigCustom,\n datePicker: ConfigDatePicker,\n deviceManager: ConfigDeviceManager,\n divider: ConfigStaticDivider,\n file: ConfigFile,\n fileSelector: ConfigFileSelector,\n func: ConfigFunc,\n header: ConfigStaticHeader,\n image: ConfigImageUpload,\n imageSendTo: ConfigImageSendTo,\n infoBox: ConfigInfoBox,\n instance: ConfigInstanceSelect,\n interface: ConfigInterface,\n ip: ConfigIP,\n jsonEditor: ConfigJsonEditor,\n language: ConfigLanguage,\n license: ConfigLicense,\n number: ConfigNumber,\n oauth2: ConfigOauth2,\n objectId: ConfigObjectId,\n password: ConfigPassword,\n pattern: ConfigPattern,\n port: ConfigPort,\n qrCode: ConfigQrCode,\n room: ConfigRoom,\n select: ConfigSelect,\n selectSendTo: ConfigSelectSendTo,\n // @deprecated Use \"sendTo\"\n sendto: ConfigSendTo,\n sendTo: ConfigSendTo,\n setState: ConfigSetState,\n slider: ConfigSlider,\n state: ConfigState,\n staticImage: ConfigStaticImage,\n staticInfo: ConfigStaticInfo,\n staticLink: ConfigStaticText,\n staticText: ConfigStaticText,\n table: ConfigTable,\n text: ConfigText,\n textSendTo: ConfigTextSendTo,\n timePicker: ConfigTimePicker,\n topic: ConfigTopic,\n uuid: ConfigUUID,\n user: ConfigUser,\n};\n\nconst styles: Record<string, any> = {\n fullWidth: {\n width: '100%',\n // height: '100%',\n },\n paper: {\n margin: 1,\n width: 'auto !important',\n overflowY: 'auto',\n paddingBottom: 1,\n },\n paperWithIcons: {\n height: 'calc(100vh - 259px) !important',\n },\n paperWithoutIcons: {\n height: 'calc(100vh - 235px) !important',\n },\n padding: {\n padding: '10px',\n },\n heading: {},\n primary: (theme: IobTheme): React.CSSProperties => ({\n backgroundColor: theme.palette.primary.main,\n color: theme.palette.mode === 'dark' ? 'inherit' : '#FFF',\n }),\n secondary: (theme: IobTheme): React.CSSProperties => ({\n backgroundColor: theme.palette.secondary.main,\n }),\n};\n\ninterface ConfigPanelProps extends ConfigGenericProps {\n schema: ConfigItemPanel;\n withIcons?: boolean;\n withoutSaveButtons?: boolean;\n}\ninterface ConfigPanelState extends ConfigGenericState {\n expanded?: boolean;\n}\n\nclass ConfigPanel extends ConfigGeneric<ConfigPanelProps, ConfigPanelState> {\n componentDidMount(): void {\n super.componentDidMount();\n if (this.props.schema?.collapsable) {\n this.setState({\n expanded:\n (((window as any)._localStorage as Storage) || window.localStorage).getItem(\n `${this.props.oContext.adapterName}.${this.props.attr}`,\n ) === 'true',\n });\n }\n }\n\n renderItems(items: Record<string, any>, disabled: boolean): JSX.Element[] | null {\n return items\n ? Object.keys(items).map(attr => {\n if (this.props.oContext.multiEdit && items[attr].noMultiEdit) {\n return null;\n }\n\n const type = items[attr].type || 'panel';\n let ItemComponent: typeof ConfigGeneric<ConfigGenericProps, any>;\n let socket: string | AdminConnection = 'Use this.props.oContext.socket!';\n if (type === 'custom') {\n // name\n // url\n if (items[attr].url) {\n ItemComponent = ConfigCustom;\n } else if (this.props.oContext.customs && this.props.oContext.customs[items[attr].component]) {\n ItemComponent = this.props.oContext.customs[items[attr].component];\n } else {\n console.error(`Cannot find custom component: ${items[attr].component}`);\n ItemComponent = ConfigGeneric;\n }\n socket = this.props.oContext.socket;\n } else if (type === 'panel') {\n ItemComponent = ConfigPanel;\n } else {\n ItemComponent = components[type] || ConfigGeneric;\n }\n\n return (\n <ItemComponent\n // @ts-expect-error Temporary work-around, till all custom components will not migrate to oContext\n socket={socket}\n globalData={this.props.globalData}\n oContext={this.props.oContext}\n key={`${attr}_${this.props.index === undefined ? '' : this.props.index}`}\n index={this.props.index}\n changed={this.props.changed}\n arrayIndex={this.props.arrayIndex}\n expertMode={this.props.expertMode}\n commandRunning={this.props.commandRunning}\n style={styles.panel}\n common={this.props.common}\n alive={this.props.alive}\n themeName={this.props.themeName}\n data={this.props.data}\n originalData={this.props.originalData}\n onError={this.props.onError}\n onChange={this.props.onChange}\n disabled={disabled}\n customObj={this.props.customObj}\n custom={this.props.custom}\n schema={items[attr]}\n attr={attr}\n table={this.props.table}\n />\n );\n })\n : null;\n }\n\n render(): JSX.Element | null {\n const schema = this.props.schema;\n\n if (!schema) {\n return null;\n }\n\n const { disabled, hidden } = this.calculate(schema);\n\n const items = this.props.schema.items;\n const schemaStyle = this.props.schema.style || {};\n\n if (hidden) {\n if (schema.hideOnlyControl) {\n const item = (\n <Grid2\n size={{\n xs: schema.xs || undefined,\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n sx={Utils.getStyle(\n this.props.oContext.theme,\n { marginBottom: 0, textAlign: 'left' /* marginRight: 8, */ },\n schemaStyle,\n this.props.oContext.themeType === 'dark' && schema.darkStyle,\n )}\n />\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n return item;\n }\n return null;\n }\n\n if (this.props.table) {\n return this.renderItems(items, disabled) as any as JSX.Element;\n }\n\n if (this.props.custom) {\n return (\n <Grid2\n key={`${this.props.attr}_${this.props.index}`}\n container\n style={styles.fullWidth}\n columnSpacing={2}\n rowSpacing={1}\n sx={schemaStyle}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n );\n }\n\n let content;\n if (schema.collapsable) {\n content = (\n <Accordion\n key={`${this.props.attr}_${this.props.index}`}\n style={styles.fullWidth}\n expanded={!!this.state.expanded}\n onChange={() => {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.oContext.adapterName}.${this.props.attr}`,\n this.state.expanded ? 'false' : 'true',\n );\n this.setState({ expanded: !this.state.expanded });\n }}\n >\n <AccordionSummary\n expandIcon={<ExpandMoreIcon />}\n sx={Utils.getStyle(\n this.props.oContext.theme,\n schemaStyle,\n this.props.oContext.themeType && schema.darkStyle,\n schema.color === 'primary'\n ? styles.primary\n : schema.color === 'secondary' && styles.secondary,\n { width: '100%' },\n )}\n >\n <Typography style={styles.heading}>{this.getText(schema.label)}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <Grid2\n container\n columnSpacing={2}\n rowSpacing={1}\n sx={{ ...schemaStyle, width: '100%', padding: '10px' }}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n </AccordionDetails>\n </Accordion>\n );\n } else {\n const sx = Utils.getStyle(\n this.props.oContext.theme,\n this.props.style,\n schemaStyle,\n { width: '100%' },\n this.props.isParentTab && styles.paper,\n this.props.isParentTab &&\n (this.props.withoutSaveButtons\n ? this.props.withIcons\n ? { height: 'calc(100% - 88px) !important' }\n : { height: 'calc(100% - 64px) !important' }\n : this.props.withIcons\n ? styles.paperWithIcons\n : styles.paperWithoutIcons),\n );\n\n content = (\n <Box\n component=\"div\"\n key={`${this.props.attr}_${this.props.index}`}\n className={this.props.className}\n sx={sx}\n >\n <Grid2\n container\n columnSpacing={2}\n rowSpacing={1}\n sx={Utils.getStyle(\n this.props.oContext.theme,\n { width: '100%' },\n this.props.isParentTab && styles.padding,\n this.props.schema.innerStyle,\n )}\n >\n {this.renderItems(items, disabled)}\n </Grid2>\n </Box>\n );\n }\n\n if (!this.props.isParentTab) {\n const item = (\n <Grid2\n title={this.getText(schema.tooltip)}\n size={{\n xs: schema.xs || undefined,\n sm: schema.sm || undefined,\n md: schema.md || undefined,\n lg: schema.lg || undefined,\n xl: schema.xl || undefined,\n }}\n sx={{ marginBottom: 0, /* marginRight: 8, */ textAlign: 'left', ...schemaStyle }}\n >\n {content}\n </Grid2>\n );\n\n if (schema.newLine) {\n return (\n <>\n <div style={{ flexBasis: '100%', height: 0 }} />\n {item}\n </>\n );\n }\n return item;\n }\n return content;\n }\n}\n\nexport default ConfigPanel;\n"]}
@@ -10,6 +10,7 @@ interface ConfigInstanceSelectState extends ConfigGenericState {
10
10
  value: number | string;
11
11
  group?: boolean;
12
12
  hidden?: string | boolean;
13
+ color?: string;
13
14
  }[];
14
15
  }
15
16
  declare class ConfigSelect extends ConfigGeneric<ConfigInstanceSelectProps, ConfigInstanceSelectState> {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { InputLabel, FormHelperText, FormControl, Select, MenuItem, ListSubheader, Box, Chip, ListItemText, Checkbox, } from '@mui/material';
2
+ import { InputLabel, FormHelperText, FormControl, Select, MenuItem, ListSubheader, Chip, ListItemText, Checkbox, } from '@mui/material';
3
3
  import { I18n } from '@iobroker/adapter-react-v5';
4
4
  import ConfigGeneric from './ConfigGeneric';
5
5
  const styles = {
@@ -34,11 +34,13 @@ class ConfigSelect extends ConfigGeneric {
34
34
  label: this.getText(item.label, this.props.schema.noTranslation),
35
35
  value: item.value,
36
36
  group: true,
37
+ color: item.color,
37
38
  });
38
39
  groupItem.items.forEach(it => selectOptions.push({
39
40
  label: this.getText(it.label, this.props.schema.noTranslation),
40
41
  value: it.value,
41
42
  hidden: it.hidden,
43
+ color: item.color,
42
44
  }));
43
45
  }
44
46
  else {
@@ -46,6 +48,7 @@ class ConfigSelect extends ConfigGeneric {
46
48
  label: this.getText(item.label, this.props.schema.noTranslation),
47
49
  value: item.value,
48
50
  hidden: item.hidden,
51
+ color: item.color,
49
52
  });
50
53
  }
51
54
  });
@@ -94,14 +97,14 @@ class ConfigSelect extends ConfigGeneric {
94
97
  const item = this.props.schema.multiple ? null : selectOptions.find(it => it.value == value); // let "==" be and not ===
95
98
  return (React.createElement(FormControl, { variant: "standard", fullWidth: true, sx: this.props.table !== undefined && styles.noMargin, id: `jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}` },
96
99
  this.props.schema.label ? React.createElement(InputLabel, null, this.getText(this.props.schema.label)) : null,
97
- React.createElement(Select, { variant: "standard", error: !!error, multiple: this.props.schema.multiple, disabled: !!disabled, value: value || '_', renderValue: (val) => this.props.schema.multiple ? (React.createElement(Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, val.map((v) => {
100
+ React.createElement(Select, { variant: "standard", error: !!error, multiple: this.props.schema.multiple, disabled: !!disabled, value: value || '_', renderValue: (val) => this.props.schema.multiple ? (React.createElement("div", { style: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, val.map((v) => {
98
101
  const it = selectOptions.find(_item => _item.value === v);
99
102
  if (it || this.props.schema.showAllValues !== false) {
100
103
  const label = it?.label || v;
101
104
  return (React.createElement(Chip, { key: v, label: label }));
102
105
  }
103
106
  return null;
104
- }))) : ((item?.label === undefined ? val : item.label)), onChange: e => {
107
+ }))) : item?.color ? (React.createElement("div", { style: { color: item.color } }, item?.label === undefined ? val : item.label)) : item?.label === undefined ? (val) : (item.label), onChange: e => {
105
108
  this.setState({ value: e.target.value === '_' ? '' : e.target.value }, () => {
106
109
  let mayBePromise;
107
110
  if (this.state.value === ConfigGeneric.DIFFERENT_VALUE) {
@@ -116,7 +119,7 @@ class ConfigSelect extends ConfigGeneric {
116
119
  });
117
120
  } }, selectOptions.map((it, i) => {
118
121
  if (it.group) {
119
- return (React.createElement(ListSubheader, { key: i }, it.label));
122
+ return (React.createElement(ListSubheader, { key: i, style: { color: it.color } }, it.label));
120
123
  }
121
124
  return (React.createElement(MenuItem, { key: i, value: it.value, style: it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {} },
122
125
  this.props.schema.multiple ? (React.createElement(Checkbox, { checked: value.includes(it.value), onClick: () => {
@@ -131,7 +134,7 @@ class ConfigSelect extends ConfigGeneric {
131
134
  }
132
135
  this.setState({ value: _value }, () => this.onChange(this.props.attr, _value));
133
136
  } })) : null,
134
- React.createElement(ListItemText, { primary: it.label })));
137
+ React.createElement(ListItemText, { primary: it.label, style: { color: it.color } })));
135
138
  })),
136
139
  this.props.schema.help ? (React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation))) : null));
137
140
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigSelect.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,UAAU,EACV,cAAc,EACd,WAAW,EACX,MAAM,EACN,QAAQ,EACR,aAAa,EACb,GAAG,EACH,IAAI,EACJ,YAAY,EAAE,QAAQ,GACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwB;IAChC,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;IACD,QAAQ,EAAE;QACN,OAAO,EAAE;YACL,SAAS,EAAE,CAAC;SACf;KACJ;CACJ,CAAC;AAUF,MAAM,YAAa,SAAQ,aAAmE;IAClF,YAAY,GAAsB,EAAE,CAAC;IAE7C,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,KAAK,GAAsB,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAExF,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC5B,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;iBAAM,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC/C,KAAK,GA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BAAC,cAAc,QACV,IAAI,CAAC,UAAU,CACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACY,CACpB,CAAC,CAAC,CAAC,IAAI,CACE,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,YAAY,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n FormHelperText,\n FormControl,\n Select,\n MenuItem,\n ListSubheader,\n Box,\n Chip,\n ListItemText, Checkbox,\n} from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSelect, ConfigItemSelectOption } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, any> = {\n fullWidth: {\n width: '100%',\n },\n noMargin: {\n '&>div': {\n marginTop: 0,\n },\n },\n};\n\ninterface ConfigInstanceSelectProps extends ConfigGenericProps {\n schema: ConfigItemSelect;\n}\n\ninterface ConfigInstanceSelectState extends ConfigGenericState {\n selectOptions?: { label: string; value: number | string; group?: boolean; hidden?: string | boolean }[];\n}\n\nclass ConfigSelect extends ConfigGeneric<ConfigInstanceSelectProps, ConfigInstanceSelectState> {\n private initialValue: string | string[] = '';\n\n componentDidMount(): void {\n super.componentDidMount();\n let value: string | string[] = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n const selectOptions: {\n label: string;\n value: number | string;\n group?: boolean;\n hidden?: string | boolean;\n }[] = [];\n\n (this.props.schema.options || []).forEach(item => {\n // if optgroup\n const groupItem: {\n items: ConfigItemSelectOption[];\n label: ioBroker.StringOrTranslated;\n value?: number | string;\n hidden?: string | boolean;\n } = item as {\n items: ConfigItemSelectOption[];\n label: ioBroker.StringOrTranslated;\n value?: number | string;\n hidden?: string | boolean;\n };\n if (Array.isArray(groupItem.items)) {\n selectOptions.push({\n label: this.getText(item.label, this.props.schema.noTranslation),\n value: item.value,\n group: true,\n });\n groupItem.items.forEach(it =>\n selectOptions.push({\n label: this.getText(it.label, this.props.schema.noTranslation),\n value: it.value,\n hidden: it.hidden,\n }),\n );\n } else {\n selectOptions.push({\n label: this.getText(item.label, this.props.schema.noTranslation),\n value: item.value,\n hidden: item.hidden,\n });\n }\n });\n\n // if __different\n if (Array.isArray(value) && !this.props.schema.multiple) {\n this.initialValue = [...value];\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions });\n } else {\n this.setState({ value, selectOptions });\n }\n }\n\n _getValue(): string | string[] {\n let value =\n this.state.value === null || this.state.value === undefined\n ? ConfigGeneric.getValue(this.props.data, this.props.attr)\n : this.state.value;\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n return value;\n }\n\n renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (!this.state.selectOptions) {\n return null;\n }\n\n const selectOptions = (this.state.selectOptions || []).filter(item => {\n // if optgroup or no hidden function\n if (!item.hidden) {\n return true;\n }\n\n if (this.props.custom) {\n return !this.executeCustom(\n item.hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n );\n }\n return !this.execute(\n item.hidden,\n this.props.schema.default,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n );\n });\n\n const value = this._getValue();\n\n const item = this.props.schema.multiple ? null : selectOptions.find(it => it.value == value); // let \"==\" be and not ===\n\n return (\n <FormControl\n variant=\"standard\"\n fullWidth\n sx={this.props.table !== undefined && styles.noMargin}\n id={`jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}`}\n >\n {this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n error={!!error}\n multiple={this.props.schema.multiple}\n disabled={!!disabled}\n value={value || '_'}\n renderValue={(val: string | string[]) =>\n this.props.schema.multiple ? (\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>\n {(val as string[]).map((v: string) => {\n const it = selectOptions.find(_item => _item.value === v);\n if (it || this.props.schema.showAllValues !== false) {\n const label = it?.label || v;\n return (\n <Chip\n key={v}\n label={label}\n />\n );\n }\n return null;\n })}\n </Box>\n ) : (\n (item?.label === undefined ? val : item.label)\n )\n }\n onChange={e => {\n this.setState({ value: e.target.value === '_' ? '' : e.target.value }, () => {\n let mayBePromise: void | Promise<void>;\n if (this.state.value === ConfigGeneric.DIFFERENT_VALUE) {\n mayBePromise = this.onChange(this.props.attr, this.initialValue);\n } else {\n mayBePromise = this.onChange(this.props.attr, this.state.value);\n }\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n >\n {selectOptions.map((it, i) => {\n if (it.group) {\n return (\n <ListSubheader key={i}>\n {it.label}\n </ListSubheader>\n );\n }\n return (\n <MenuItem\n key={i}\n value={it.value}\n style={it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {}}\n >\n {this.props.schema.multiple ? (\n <Checkbox\n checked={value.includes(it.value as string)}\n onClick={() => {\n const _value = JSON.parse(JSON.stringify(this._getValue()));\n const pos = value.indexOf(it.value as string);\n if (pos !== -1) {\n _value.splice(pos, 1);\n } else {\n _value.push(it.value);\n _value.sort();\n }\n this.setState({ value: _value }, () =>\n this.onChange(this.props.attr, _value),\n );\n }}\n />\n ) : null}\n <ListItemText primary={it.label} />\n </MenuItem>\n );\n })}\n </Select>\n {this.props.schema.help ? (\n <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText>\n ) : null}\n </FormControl>\n );\n }\n}\n\nexport default ConfigSelect;\n"]}
1
+ {"version":3,"file":"ConfigSelect.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,UAAU,EACV,cAAc,EACd,WAAW,EACX,MAAM,EACN,QAAQ,EACR,aAAa,EAEb,IAAI,EACJ,YAAY,EACZ,QAAQ,GACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwB;IAChC,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;IACD,QAAQ,EAAE;QACN,OAAO,EAAE;YACL,SAAS,EAAE,CAAC;SACf;KACJ;CACJ,CAAC;AAgBF,MAAM,YAAa,SAAQ,aAAmE;IAClF,YAAY,GAAsB,EAAE,CAAC;IAE7C,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,KAAK,GAAsB,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAExF,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC5B,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;iBAAM,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC/C,KAAK,GAAG,EAAE,CAAC;YACf,CAAC;QACL,CAAC;QAED,MAAM,aAAa,GAMb,EAAE,CAAC;QAET,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC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C,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CACzC,CAAC;wBACN,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;oBACR,oBAAC,YAAY,IACT,OAAO,EAAE,EAAE,CAAC,KAAK,EACjB,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,GAC5B,CACK,CACd,CAAC;YACN,CAAC,CAAC,CACG;YACR,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACtB,oBAAC,cAAc,QACV,IAAI,CAAC,UAAU,CACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACY,CACpB,CAAC,CAAC,CAAC,IAAI,CACE,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,YAAY,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n FormHelperText,\n FormControl,\n Select,\n MenuItem,\n ListSubheader,\n Box,\n Chip,\n ListItemText,\n Checkbox,\n} from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSelect, ConfigItemSelectOption } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, any> = {\n fullWidth: {\n width: '100%',\n },\n noMargin: {\n '&>div': {\n marginTop: 0,\n },\n },\n};\n\ninterface ConfigInstanceSelectProps extends ConfigGenericProps {\n schema: ConfigItemSelect;\n}\n\ninterface ConfigInstanceSelectState extends ConfigGenericState {\n selectOptions?: {\n label: string;\n value: number | string;\n group?: boolean;\n hidden?: string | boolean;\n color?: string;\n }[];\n}\n\nclass ConfigSelect extends ConfigGeneric<ConfigInstanceSelectProps, ConfigInstanceSelectState> {\n private initialValue: string | string[] = '';\n\n componentDidMount(): void {\n super.componentDidMount();\n let value: string | string[] = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n const selectOptions: {\n label: string;\n value: number | string;\n group?: boolean;\n hidden?: string | boolean;\n color?: string;\n }[] = [];\n\n (this.props.schema.options || []).forEach(item => {\n // if optgroup\n const groupItem: {\n items: ConfigItemSelectOption[];\n label: ioBroker.StringOrTranslated;\n value?: number | string;\n hidden?: string | boolean;\n } = item as {\n items: ConfigItemSelectOption[];\n label: ioBroker.StringOrTranslated;\n value?: number | string;\n hidden?: string | boolean;\n };\n if (Array.isArray(groupItem.items)) {\n selectOptions.push({\n label: this.getText(item.label, this.props.schema.noTranslation),\n value: item.value,\n group: true,\n color: item.color,\n });\n groupItem.items.forEach(it =>\n selectOptions.push({\n label: this.getText(it.label, this.props.schema.noTranslation),\n value: it.value,\n hidden: it.hidden,\n color: item.color,\n }),\n );\n } else {\n selectOptions.push({\n label: this.getText(item.label, this.props.schema.noTranslation),\n value: item.value,\n hidden: item.hidden,\n color: item.color,\n });\n }\n });\n\n // if __different\n if (Array.isArray(value) && !this.props.schema.multiple) {\n this.initialValue = [...value];\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions });\n } else {\n this.setState({ value, selectOptions });\n }\n }\n\n _getValue(): string | string[] {\n let value =\n this.state.value === null || this.state.value === undefined\n ? ConfigGeneric.getValue(this.props.data, this.props.attr)\n : this.state.value;\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n return value;\n }\n\n renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (!this.state.selectOptions) {\n return null;\n }\n\n const selectOptions = (this.state.selectOptions || []).filter(item => {\n // if optgroup or no hidden function\n if (!item.hidden) {\n return true;\n }\n\n if (this.props.custom) {\n return !this.executeCustom(\n item.hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n );\n }\n return !this.execute(\n item.hidden,\n this.props.schema.default,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n );\n });\n\n const value = this._getValue();\n\n const item = this.props.schema.multiple ? null : selectOptions.find(it => it.value == value); // let \"==\" be and not ===\n\n return (\n <FormControl\n variant=\"standard\"\n fullWidth\n sx={this.props.table !== undefined && styles.noMargin}\n id={`jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}`}\n >\n {this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n error={!!error}\n multiple={this.props.schema.multiple}\n disabled={!!disabled}\n value={value || '_'}\n renderValue={(val: string | string[]) =>\n this.props.schema.multiple ? (\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>\n {(val as string[]).map((v: string) => {\n const it = selectOptions.find(_item => _item.value === v);\n if (it || this.props.schema.showAllValues !== false) {\n const label = it?.label || v;\n return (\n <Chip\n key={v}\n label={label}\n />\n );\n }\n return null;\n })}\n </div>\n ) : item?.color ? (\n <div style={{ color: item.color }}>{item?.label === undefined ? val : item.label}</div>\n ) : item?.label === undefined ? (\n val\n ) : (\n item.label\n )\n }\n onChange={e => {\n this.setState({ value: e.target.value === '_' ? '' : e.target.value }, () => {\n let mayBePromise: void | Promise<void>;\n if (this.state.value === ConfigGeneric.DIFFERENT_VALUE) {\n mayBePromise = this.onChange(this.props.attr, this.initialValue);\n } else {\n mayBePromise = this.onChange(this.props.attr, this.state.value);\n }\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n >\n {selectOptions.map((it, i) => {\n if (it.group) {\n return (\n <ListSubheader\n key={i}\n style={{ color: it.color }}\n >\n {it.label}\n </ListSubheader>\n );\n }\n return (\n <MenuItem\n key={i}\n value={it.value}\n style={it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {}}\n >\n {this.props.schema.multiple ? (\n <Checkbox\n checked={value.includes(it.value as string)}\n onClick={() => {\n const _value = JSON.parse(JSON.stringify(this._getValue()));\n const pos = value.indexOf(it.value as string);\n if (pos !== -1) {\n _value.splice(pos, 1);\n } else {\n _value.push(it.value);\n _value.sort();\n }\n this.setState({ value: _value }, () =>\n this.onChange(this.props.attr, _value),\n );\n }}\n />\n ) : null}\n <ListItemText\n primary={it.label}\n style={{ color: it.color }}\n />\n </MenuItem>\n );\n })}\n </Select>\n {this.props.schema.help ? (\n <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText>\n ) : null}\n </FormControl>\n );\n }\n}\n\nexport default ConfigSelect;\n"]}
@@ -19,7 +19,13 @@ declare class ConfigState extends ConfigGeneric<ConfigStateProps, ConfigStateSta
19
19
  componentDidMount(): Promise<void>;
20
20
  componentWillUnmount(): void;
21
21
  onStateChanged: (_id: string, state: ioBroker.State | null | undefined) => void;
22
- detectType(obj: ioBroker.StateObject): 'button' | 'switch' | 'slider' | 'input' | 'text';
22
+ detectType(obj: ioBroker.StateObject): 'button' | 'switch' | 'slider' | 'input' | 'text' | 'select';
23
+ getNormalizedStates(): {
24
+ label: string;
25
+ value: number | string;
26
+ hidden?: string | boolean;
27
+ color?: string;
28
+ }[];
23
29
  renderItem(_error: string, disabled: boolean): JSX.Element;
24
30
  }
25
31
  export default ConfigState;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { TextField, IconButton, Button, Switch, Slider, Box } from '@mui/material';
2
+ import { TextField, IconButton, Button, Switch, Slider, Box, FormControl, InputLabel, Select, MenuItem, } from '@mui/material';
3
3
  import { I18n, Icon } from '@iobroker/adapter-react-v5';
4
4
  import getIconByName from './Icons';
5
5
  import ConfigGeneric from './ConfigGeneric';
@@ -51,6 +51,20 @@ class ConfigState extends ConfigGeneric {
51
51
  async componentDidMount() {
52
52
  super.componentDidMount();
53
53
  const obj = (await this.props.oContext.socket.getObject(this.getObjectID()));
54
+ if (obj?.common?.states && !this.props.schema.options) {
55
+ // Normalize states to object
56
+ if (Array.isArray(obj?.common?.states)) {
57
+ // convert array to object
58
+ const states = {};
59
+ obj.common.states.forEach((state, index) => {
60
+ states[index.toString()] = state;
61
+ });
62
+ obj.common.states = states;
63
+ }
64
+ if (!Object.keys(obj.common.states).length) {
65
+ obj.common.states = undefined; // remove empty states
66
+ }
67
+ }
54
68
  const controlType = this.props.schema.control || this.detectType(obj);
55
69
  try {
56
70
  const state = await this.props.oContext.socket.getState(this.getObjectID());
@@ -109,8 +123,8 @@ class ConfigState extends ConfigGeneric {
109
123
  }
110
124
  };
111
125
  detectType(obj) {
112
- obj = obj || {};
113
- obj.common = obj.common || {};
126
+ obj ||= {};
127
+ obj.common ||= {};
114
128
  // read an object
115
129
  if (obj.common.type === 'boolean') {
116
130
  if (this.props.schema.controlled !== false) {
@@ -125,6 +139,9 @@ class ConfigState extends ConfigGeneric {
125
139
  }
126
140
  if (obj.common.type === 'number' && this.props.schema.controlled !== false) {
127
141
  if (obj.common.write || this.props.schema.controlled === true) {
142
+ if (obj.common.states || this.props.schema.options) {
143
+ return 'select';
144
+ }
128
145
  if (obj.common.max !== undefined) {
129
146
  return 'slider';
130
147
  }
@@ -133,16 +150,70 @@ class ConfigState extends ConfigGeneric {
133
150
  return 'text';
134
151
  }
135
152
  if (obj.common.write && this.props.schema.controlled !== false) {
153
+ if (obj.common.states || this.props.schema.options) {
154
+ return 'select';
155
+ }
136
156
  return 'input';
137
157
  }
138
158
  return 'text';
139
159
  }
160
+ getNormalizedStates() {
161
+ let states;
162
+ if (this.props.schema.options) {
163
+ states = this.props.schema.options.map(state => {
164
+ if (typeof state === 'string') {
165
+ return { value: state, label: this.getText(state, this.props.schema.noTranslation) };
166
+ }
167
+ return {
168
+ value: state.value,
169
+ label: this.getText(state.label, this.props.schema.noTranslation),
170
+ color: state.color,
171
+ };
172
+ });
173
+ }
174
+ else if (this.state.obj.common.states) {
175
+ states = [];
176
+ Object.keys(this.state.obj.common.states).forEach(key => {
177
+ states.push({
178
+ value: key,
179
+ label: this.getText(this.state.obj.common.states[key], this.props.schema.noTranslation),
180
+ });
181
+ });
182
+ }
183
+ else {
184
+ states = [];
185
+ }
186
+ return states;
187
+ }
140
188
  renderItem(_error, disabled /*, defaultValue */) {
141
189
  if (!this.state.obj) {
142
190
  return null;
143
191
  }
144
192
  let content;
145
- if (this.state.controlType === 'button' ||
193
+ if (this.state.controlType === 'select' ||
194
+ (!this.state.controlType &&
195
+ (this.state.obj.common.type === 'number' || this.state.obj.common.type === 'string') &&
196
+ this.state.obj.common.write !== false &&
197
+ (this.props.schema.options || this.state.obj.common.states))) {
198
+ const states = this.getNormalizedStates();
199
+ const item = states.find(it => it.value === this.state.stateValue);
200
+ content = (React.createElement(FormControl, { fullWidth: true },
201
+ React.createElement(InputLabel, null,
202
+ "$",
203
+ this.getText(this.props.schema.label)),
204
+ React.createElement(Select, { value: this.state.stateValue, disabled: !!this.props.schema.readOnly || disabled, onChange: e => {
205
+ this.setState({ stateValue: e.target.value }, () => {
206
+ let value = this.state.stateValue;
207
+ if (this.state.obj.common.type === 'number') {
208
+ value = parseFloat(value.toString().replace(',', '.'));
209
+ }
210
+ void this.props.oContext.socket.setState(this.getObjectID(), value, false);
211
+ });
212
+ }, renderValue: (val) => item?.color ? React.createElement("div", { style: { color: item.color } }, item.label) : val }, states.map(item => (React.createElement(MenuItem, { key: (item.value ?? '').toString(), value: item.value, style: { color: item.color } },
213
+ "$",
214
+ item.label))))));
215
+ }
216
+ else if (this.state.controlType === 'button' ||
146
217
  (!this.state.controlType &&
147
218
  this.state.obj.common.type === 'boolean' &&
148
219
  ((this.state.obj.common.write && this.state.obj.common.read === false) ||
@@ -194,7 +265,7 @@ class ConfigState extends ConfigGeneric {
194
265
  else if (this.state.controlType === 'input' ||
195
266
  (!this.state.controlType && this.state.obj.common.write && this.state.obj.common.type === 'string')) {
196
267
  content = (React.createElement("div", { style: { width: '100%', display: 'flex', flexDirection: 'row', gap: 8, alignItems: 'baseline' } },
197
- React.createElement(TextField, { style: { flex: 1 }, value: this.state.stateValue, variant: "standard", slotProps: {
268
+ React.createElement(TextField, { style: { flex: 1 }, value: this.state.stateValue, variant: "standard", disabled: !!this.props.schema.readOnly || disabled, slotProps: {
198
269
  input: {
199
270
  endAdornment: this.getText(this.props.schema.unit, this.props.schema.noTranslation) ||
200
271
  this.state.obj.common.unit ||
@@ -217,11 +288,15 @@ class ConfigState extends ConfigGeneric {
217
288
  }
218
289
  this.controlTimeout = setTimeout(async () => {
219
290
  this.controlTimeout = null;
220
- await this.props.oContext.socket.setState(this.getObjectID(), this.state.stateValue, false);
291
+ let value = this.state.stateValue;
292
+ if (this.state.obj.common.type === 'number') {
293
+ value = parseFloat(value.toString().replace(',', '.'));
294
+ }
295
+ await this.props.oContext.socket.setState(this.getObjectID(), value, false);
221
296
  }, this.props.schema.controlDelay || 0);
222
297
  });
223
298
  }, label: this.getText(this.props.schema.label), helperText: this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation) }),
224
- this.props.schema.showEnterButton && (React.createElement(Button, { variant: "outlined", onClick: () => {
299
+ this.props.schema.showEnterButton && !this.props.schema.readOnly && (React.createElement(Button, { variant: "outlined", disabled: disabled, onClick: () => {
225
300
  void this.props.oContext.socket.setState(this.getObjectID(), this.state.stateValue, false);
226
301
  } }, this.getText(typeof this.props.schema.showEnterButton === 'string'
227
302
  ? this.props.schema.showEnterButton
@@ -289,7 +364,7 @@ class ConfigState extends ConfigGeneric {
289
364
  if (this.props.schema.trueImage) {
290
365
  iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);
291
366
  }
292
- content = (React.createElement(Switch, { checked: !!this.state.stateValue, disabled: !!this.props.schema.readOnly, onChange: async () => {
367
+ content = (React.createElement(Switch, { checked: !!this.state.stateValue, disabled: !!this.props.schema.readOnly || disabled, onChange: async () => {
293
368
  if (this.props.schema.confirm) {
294
369
  this.setState({
295
370
  confirmDialog: true,
@@ -345,7 +420,7 @@ class ConfigState extends ConfigGeneric {
345
420
  : this.state.obj.common.max
346
421
  : this.props.schema.max;
347
422
  const step = this.props.schema.step === undefined ? this.state.obj.common.step || 1 : this.props.schema.step;
348
- content = (React.createElement(Slider, { style: { width: '100%', flexGrow: 1 }, min: min, max: max, disabled: !!this.props.schema.readOnly, step: step, value: this.state.stateValue, valueLabelDisplay: "auto", valueLabelFormat: (value) => `${value}${this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit || ''}`, onChange: (_e, value) => {
423
+ content = (React.createElement(Slider, { style: { width: '100%', flexGrow: 1 }, min: min, max: max, disabled: !!this.props.schema.readOnly || disabled, step: step, value: this.state.stateValue, valueLabelDisplay: "auto", valueLabelFormat: (value) => `${value}${this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit || ''}`, onChange: (_e, value) => {
349
424
  this.setState({ stateValue: value }, () => {
350
425
  if (this.controlTimeout) {
351
426
  clearTimeout(this.controlTimeout);
@@ -378,7 +453,7 @@ class ConfigState extends ConfigGeneric {
378
453
  content));
379
454
  }
380
455
  }
381
- else if (this.state.obj.common.type === 'number' && this.state.obj.common.write) {
456
+ else if (this.state.obj.common.type === 'number' && this.state.obj.common.write && !this.state.controlType) {
382
457
  // Auto-detection of the type
383
458
  const min = this.props.schema.min === undefined
384
459
  ? this.state.obj.common.min === undefined
@@ -395,7 +470,7 @@ class ConfigState extends ConfigGeneric {
395
470
  ? undefined
396
471
  : this.state.obj.common.step
397
472
  : this.props.schema.step;
398
- content = (React.createElement(TextField, { variant: "standard", style: { width: '100%' }, value: this.state.stateValue, type: "number", slotProps: {
473
+ content = (React.createElement(TextField, { variant: "standard", style: { width: '100%' }, value: this.state.stateValue, type: "number", disabled: !!this.props.schema.readOnly || disabled, slotProps: {
399
474
  htmlInput: { min, max, step, readOnly: !!this.props.schema.readOnly },
400
475
  input: {
401
476
  endAdornment: this.getText(this.props.schema.unit, this.props.schema.noTranslation) ||
@@ -443,11 +518,22 @@ class ConfigState extends ConfigGeneric {
443
518
  else {
444
519
  // text or HTML
445
520
  const unit = this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit;
521
+ let mappedValue = this.state.stateValue;
522
+ // if options or states are defined, map the value to the label
523
+ if (mappedValue !== null &&
524
+ mappedValue !== undefined &&
525
+ (this.props.schema.options || this.state.obj.common.states)) {
526
+ const states = this.getNormalizedStates();
527
+ const state = states.find(s => s.value === mappedValue);
528
+ if (state) {
529
+ mappedValue = state.label;
530
+ }
531
+ }
446
532
  let value;
447
533
  let key;
448
534
  if (this.state.controlType === 'html') {
449
- key = (this.state.stateValue || '').toString();
450
- value = React.createElement("span", { dangerouslySetInnerHTML: { __html: this.state.stateValue } });
535
+ key = (mappedValue || '').toString();
536
+ value = React.createElement("span", { dangerouslySetInnerHTML: { __html: mappedValue } });
451
537
  }
452
538
  else if (this.state.stateValue === null) {
453
539
  value = 'null';
@@ -458,7 +544,7 @@ class ConfigState extends ConfigGeneric {
458
544
  key = value;
459
545
  }
460
546
  else {
461
- value = this.state.stateValue.toString();
547
+ value = mappedValue.toString();
462
548
  key = value;
463
549
  }
464
550
  content = (React.createElement("div", { style: divStyle },
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigState.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEnF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAiB,MAAM,4BAA4B,CAAC;AAGvE,OAAO,aAAa,M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BAAM,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;oBACxC,KAAK,GAAG,MAAM,CAAC;oBACf,GAAG,GAAG,KAAK,CAAC;gBAChB,CAAC;qBAAM,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;oBAC7C,KAAK,GAAG,WAAW,CAAC;oBACpB,GAAG,GAAG,KAAK,CAAC;gBAChB,CAAC;qBAAM,CAAC;oBACJ,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;oBACzC,GAAG,GAAG,KAAK,CAAC;gBAChB,CAAC;gBAED,OAAO,GAAG,CACN,6BAAK,KAAK,EAAE,QAAQ;oBACf,YAAY;oBACb,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,EAAE;wBAC3D,oBAAC,GAAG,IACA,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,IAErD,KAAK,CACJ;wBACL,IAAI,CAAC,CAAC,CAAC,8BAAM,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAG,IAAI,CAAQ,CAAC,CAAC,CAAC,IAAI,CAC9E,CACJ,CACT,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton, Button, Switch, Slider, Box } from '@mui/material';\n\nimport { I18n, Icon, type IobTheme } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemState } from '../types';\nimport getIconByName from './Icons';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nfunction valueBlinkOnce(theme: IobTheme, color?: string | boolean): any {\n if (typeof color === 'string') {\n return {\n '@keyframes newStateAnimationOnceColor': {\n '0%': {\n color,\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'newStateAnimationOnceColor 2s ease-in-out',\n };\n }\n return {\n '@keyframes newStateAnimationOnce': {\n '0%': {\n color: '#00f900',\n },\n '80%': {\n color: theme.palette.mode === 'dark' ? '#518851' : '#008000',\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'newStateAnimationOnce 2s ease-in-out',\n };\n}\n\ninterface ConfigStateProps extends ConfigGenericProps {\n schema: ConfigItemState;\n}\n\ninterface ConfigStateState extends ConfigGenericState {\n stateValue?: string | number | boolean | null;\n controlType?: 'text' | 'html' | 'input' | 'slider' | 'select' | 'button' | 'switch' | 'number';\n obj?: ioBroker.Object | null;\n}\n\nclass ConfigState extends ConfigGeneric<ConfigStateProps, ConfigStateState> {\n controlTimeout: ReturnType<typeof setTimeout> | null = null;\n\n delayedUpdate: { timer: ReturnType<typeof setTimeout> | null; value: string | boolean | number | null } = {\n timer: null,\n value: null,\n };\n\n getObjectID(): string {\n let oid = this.props.schema.oid;\n if (oid.includes('${')) {\n oid = this.getPattern(oid, null, true);\n }\n\n if (this.props.schema.foreign) {\n return oid;\n }\n\n return `${this.props.schema.system ? 'system.adapter.' : ''}${this.props.oContext.adapterName}.${this.props.oContext.instance || 0}.${oid}`;\n }\n\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n const obj: ioBroker.StateObject = (await this.props.oContext.socket.getObject(\n this.getObjectID(),\n )) as ioBroker.StateObject;\n const controlType = this.props.schema.control || this.detectType(obj);\n\n try {\n const state = await this.props.oContext.socket.getState(this.getObjectID());\n\n this.setState({ stateValue: state ? state.val : null, controlType, obj }, async () => {\n await this.props.oContext.socket.subscribeState(this.getObjectID(), this.onStateChanged);\n });\n } catch (e) {\n console.error(`Cannot get state ${this.getObjectID()}: ${e}`);\n this.setState({ controlType, obj });\n }\n }\n\n componentWillUnmount(): void {\n super.componentWillUnmount();\n this.props.oContext.socket.unsubscribeState(this.getObjectID(), this.onStateChanged);\n if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n this.controlTimeout = null;\n this.props.oContext.socket\n .setState(this.getObjectID(), this.state.stateValue, false)\n .catch((e: Error) => console.error(`Cannot control value: ${e.toString()}`));\n }\n }\n\n onStateChanged = (_id: string, state: ioBroker.State | null | undefined): void => {\n let val = state ? state.val : null;\n if (this.state.controlType === 'button' || this.state.controlType === 'switch') {\n val = !!val;\n if (this.state.stateValue !== val) {\n this.setState({ stateValue: val });\n }\n } else if (val !== null && (this.state.controlType === 'slider' || this.state.controlType === 'number')) {\n val = parseFloat(val as unknown as string);\n console.log(`${Date.now()} Received new value: ${val}`);\n if (val !== this.state.stateValue) {\n if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n this.delayedUpdate.value = val;\n this.delayedUpdate.timer = setTimeout(() => {\n this.setState({ stateValue: this.delayedUpdate.value });\n }, 500);\n } else if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n } else if (this.state.stateValue.toString() !== val.toString()) {\n this.setState({ stateValue: val });\n }\n };\n\n detectType(obj: ioBroker.StateObject): 'button' | 'switch' | 'slider' | 'input' | 'text' {\n obj = obj || ({} as ioBroker.StateObject);\n obj.common = obj.common || ({} as ioBroker.StateCommon);\n\n // read an object\n if (obj.common.type === 'boolean') {\n if (this.props.schema.controlled !== false) {\n if (obj.common.read === false || this.props.schema.controlled === true) {\n return 'button';\n }\n if (obj.common.write || this.props.schema.controlled === true) {\n return 'switch';\n }\n }\n\n return 'text';\n }\n\n if (obj.common.type === 'number' && this.props.schema.controlled !== false) {\n if (obj.common.write || this.props.schema.controlled === true) {\n if (obj.common.max !== undefined) {\n return 'slider';\n }\n return 'input';\n }\n return 'text';\n }\n\n if (obj.common.write && this.props.schema.controlled !== false) {\n return 'input';\n }\n\n return 'text';\n }\n\n renderItem(_error: string, disabled: boolean /*, defaultValue */): JSX.Element {\n if (!this.state.obj) {\n return null;\n }\n\n let content: JSX.Element;\n\n if (\n this.state.controlType === 'button' ||\n (!this.state.controlType &&\n this.state.obj.common.type === 'boolean' &&\n ((this.state.obj.common.write && this.state.obj.common.read === false) ||\n this.state.obj.common.role?.includes('button')))\n ) {\n let icon: JSX.Element | null = null;\n if (this.props.schema.falseImage) {\n icon = getIconByName(this.props.schema.falseImage);\n }\n\n const text = this.getText(\n this.props.schema.falseText || this.props.schema.label,\n this.props.schema.noTranslation,\n );\n\n if (!text && icon) {\n content = (\n <IconButton\n style={this.props.schema.falseTextStyle}\n disabled={!!this.props.schema.readOnly}\n onClick={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n this.props.schema.buttonValue !== undefined\n ? this.props.schema.buttonValue\n : true,\n false,\n );\n }\n },\n });\n } else {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n this.props.schema.buttonValue !== undefined ? this.props.schema.buttonValue : true,\n false,\n );\n }\n }}\n >\n {icon}\n </IconButton>\n );\n } else {\n content = (\n <Button\n variant={this.props.schema.variant || 'contained'}\n startIcon={icon}\n style={this.props.schema.falseTextStyle}\n disabled={disabled || !!this.props.schema.readOnly}\n onClick={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n this.props.schema.buttonValue !== undefined\n ? this.props.schema.buttonValue\n : true,\n false,\n );\n }\n },\n });\n } else {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n this.props.schema.buttonValue !== undefined ? this.props.schema.buttonValue : true,\n false,\n );\n }\n }}\n >\n {text || this.getObjectID().split('.').pop()}\n </Button>\n );\n }\n } else if (\n this.state.controlType === 'input' ||\n (!this.state.controlType && this.state.obj.common.write && this.state.obj.common.type === 'string')\n ) {\n content = (\n <div style={{ width: '100%', display: 'flex', flexDirection: 'row', gap: 8, alignItems: 'baseline' }}>\n <TextField\n style={{ flex: 1 }}\n value={this.state.stateValue}\n variant=\"standard\"\n slotProps={{\n input: {\n endAdornment:\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) ||\n this.state.obj.common.unit ||\n undefined,\n },\n htmlInput: {\n readOnly: !!this.props.schema.readOnly,\n },\n }}\n onKeyUp={e => {\n if (this.props.schema.setOnEnterKey && e.key === 'Enter') {\n void this.props.oContext.socket.setState(\n this.getObjectID(),\n this.state.stateValue,\n false,\n );\n }\n }}\n onChange={e => {\n this.setState({ stateValue: e.target.value }, (): void => {\n if (this.props.schema.setOnEnterKey || this.props.schema.showEnterButton) {\n return;\n }\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n this.controlTimeout = null;\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n this.state.stateValue,\n false,\n );\n }, this.props.schema.controlDelay || 0);\n });\n }}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n {this.props.schema.showEnterButton && (\n <Button\n variant=\"outlined\"\n onClick={() => {\n void this.props.oContext.socket.setState(\n this.getObjectID(),\n this.state.stateValue,\n false,\n );\n }}\n >\n {this.getText(\n typeof this.props.schema.showEnterButton === 'string'\n ? this.props.schema.showEnterButton\n : 'Set',\n )}\n </Button>\n )}\n </div>\n );\n } else {\n let fontSize: number | undefined;\n if (this.props.schema.size === 'normal') {\n fontSize = 16;\n } else if (this.props.schema.size === 'large') {\n fontSize = 20;\n } else if (typeof this.props.schema.size === 'number') {\n fontSize = this.props.schema.size;\n }\n let label = this.getText(this.props.schema.label, this.props.schema.noTranslation);\n\n const divStyle: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n fontSize: fontSize || '1rem',\n gap: 8,\n };\n\n if (!this.props.schema.narrow) {\n divStyle.width = '100%';\n divStyle.justifyContent = 'space-between';\n }\n\n if (label.trim()) {\n if (!label.trim().endsWith(':') && this.props.schema.addColon) {\n label = `${label.trim()}:`;\n }\n }\n\n let blinkStyle: React.CSSProperties | undefined;\n if (this.props.schema.blinkOnUpdate) {\n blinkStyle = valueBlinkOnce(this.props.oContext.theme, this.props.schema.blinkOnUpdate);\n }\n\n let labelIcon: React.JSX.Element | undefined;\n if (this.props.schema.labelIcon) {\n labelIcon = (\n <Icon\n src={this.props.schema.labelIcon}\n style={{ marginRight: 4 }}\n />\n );\n }\n\n let labelControl: React.JSX.Element | undefined;\n if (label && labelIcon) {\n labelControl = (\n <div style={{ whiteSpace: 'nowrap' }}>\n {labelIcon}\n {label}\n </div>\n );\n } else if (label) {\n labelControl = <div style={{ whiteSpace: 'nowrap' }}>{label}</div>;\n } else if (labelIcon) {\n labelControl = labelIcon;\n }\n\n if (\n this.state.controlType === 'switch' ||\n (!this.state.controlType &&\n this.state.obj.common.type === 'boolean' &&\n ((this.state.obj.common.write && this.state.obj.common.read !== false) ||\n this.state.obj.common.role?.includes('switch')))\n ) {\n let iconFalse: JSX.Element | null = null;\n const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);\n }\n let iconTrue: JSX.Element | null = null;\n const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);\n }\n\n content = (\n <Switch\n checked={!!this.state.stateValue}\n disabled={!!this.props.schema.readOnly}\n onChange={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n !this.state.stateValue,\n false,\n );\n }\n },\n });\n } else {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n !this.state.stateValue,\n false,\n );\n }\n }}\n />\n );\n\n if (textFalse || iconFalse || textTrue || iconTrue) {\n content = (\n <div style={{ display: 'flex', alignItems: 'center', fontSize: 14 }}>\n <span style={this.props.schema.falseTextStyle}>\n {textFalse}\n {iconFalse}\n </span>\n {content}\n <span style={this.props.schema.trueTextStyle}>\n {iconTrue}\n {textTrue}\n </span>\n </div>\n );\n }\n\n if (labelControl) {\n content = (\n <div style={divStyle}>\n {labelControl}\n {content}\n </div>\n );\n }\n } else if (\n this.state.controlType === 'slider' ||\n (!this.state.controlType &&\n this.state.obj.common.type === 'number' &&\n ((this.state.obj.common.write &&\n (this.state.obj.common.max !== undefined || this.state.obj.common.unit === '%')) ||\n this.state.obj.common.role?.includes('slider') ||\n this.state.obj.common.role?.includes('dimmer') ||\n this.state.obj.common.role?.includes('blind')))\n ) {\n let iconFalse: JSX.Element | null = null;\n const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);\n }\n let iconTrue: JSX.Element | null = null;\n const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);\n }\n\n const min =\n this.props.schema.min === undefined ? this.state.obj.common.min || 0 : this.props.schema.min;\n const max =\n this.props.schema.max === undefined\n ? this.state.obj.common.max === undefined\n ? 100\n : this.state.obj.common.max\n : this.props.schema.max;\n const step =\n this.props.schema.step === undefined ? this.state.obj.common.step || 1 : this.props.schema.step;\n\n content = (\n <Slider\n style={{ width: '100%', flexGrow: 1 }}\n min={min}\n max={max}\n disabled={!!this.props.schema.readOnly}\n step={step}\n value={this.state.stateValue as number}\n valueLabelDisplay=\"auto\"\n valueLabelFormat={(value: number) =>\n `${value}${this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit || ''}`\n }\n onChange={(_e: Event, value: number) => {\n this.setState({ stateValue: value }, (): void => {\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n console.log(`${Date.now()} Send new value: ${this.state.stateValue}`);\n this.controlTimeout = null;\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n this.state.stateValue,\n false,\n );\n }, this.props.schema.controlDelay || 0);\n });\n }}\n />\n );\n\n if (textFalse || iconFalse || textTrue || iconTrue) {\n content = (\n <div\n style={{\n display: 'flex',\n width: '100%',\n flexGrow: 1,\n alignItems: 'center',\n }}\n >\n <span style={{ marginRight: 16, ...this.props.schema.falseTextStyle }}>\n {textFalse}\n {iconFalse}\n </span>\n {content}\n <span style={{ marginLeft: 16, ...this.props.schema.trueTextStyle }}>\n {iconTrue}\n {textTrue}\n </span>\n </div>\n );\n }\n if (labelControl) {\n content = (\n <div style={divStyle}>\n {labelControl}\n {content}\n </div>\n );\n }\n } else if (this.state.obj.common.type === 'number' && this.state.obj.common.write) {\n // Auto-detection of the type\n const min =\n this.props.schema.min === undefined\n ? this.state.obj.common.min === undefined\n ? undefined\n : this.state.obj.common.min\n : this.props.schema.min;\n const max =\n this.props.schema.max === undefined\n ? this.state.obj.common.max === undefined\n ? undefined\n : this.state.obj.common.max\n : this.props.schema.max;\n const step =\n this.props.schema.step === undefined\n ? this.state.obj.common.step === undefined\n ? undefined\n : this.state.obj.common.step\n : this.props.schema.step;\n\n content = (\n <TextField\n variant=\"standard\"\n style={{ width: '100%' }}\n value={this.state.stateValue}\n type=\"number\"\n slotProps={{\n htmlInput: { min, max, step, readOnly: !!this.props.schema.readOnly },\n input: {\n endAdornment:\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) ||\n this.state.obj.common.unit ||\n undefined,\n },\n }}\n onChange={e => {\n this.setState({ stateValue: e.target.value }, (): void => {\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n this.controlTimeout = null;\n const val = parseFloat(this.state.stateValue as unknown as string);\n await this.props.oContext.socket.setState(this.getObjectID(), val, false);\n }, this.props.schema.controlDelay || 0);\n });\n }}\n label={this.getText(this.props.schema.label, this.props.schema.noTranslation)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n } else if (this.state.obj.common.type === 'boolean') {\n let icon: JSX.Element | null = null;\n let text: string;\n let style: React.CSSProperties | undefined;\n if (!this.state.stateValue) {\n text = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n icon = getIconByName(this.props.schema.falseImage, text ? { marginLeft: 8 } : undefined);\n }\n style = this.props.schema.falseTextStyle;\n } else {\n text = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n icon = getIconByName(this.props.schema.falseImage, text ? { marginRight: 8 } : undefined);\n }\n style = this.props.schema.trueTextStyle;\n }\n style = Object.assign(divStyle, style);\n\n content = (\n <div style={style}>\n {labelControl}\n <Box\n style={{ display: 'flex', alignItems: 'center', gap: 8 }}\n sx={blinkStyle}\n key={this.props.schema.blinkOnUpdate ? text : undefined}\n >\n {icon}\n {text || (this.state.stateValue ? I18n.t('ra_true') : I18n.t('ra_false'))}\n </Box>\n </div>\n );\n } else {\n // text or HTML\n const unit =\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit;\n\n let value;\n let key: string;\n if (this.state.controlType === 'html') {\n key = (this.state.stateValue || '').toString();\n value = <span dangerouslySetInnerHTML={{ __html: this.state.stateValue as string }} />;\n } else if (this.state.stateValue === null) {\n value = 'null';\n key = value;\n } else if (this.state.stateValue === undefined) {\n value = 'undefined';\n key = value;\n } else {\n value = this.state.stateValue.toString();\n key = value;\n }\n\n content = (\n <div style={divStyle}>\n {labelControl}\n <div style={{ display: 'flex', alignItems: 'baseline', gap: 4 }}>\n <Box\n sx={blinkStyle}\n key={this.props.schema.blinkOnUpdate ? key : undefined}\n >\n {value}\n </Box>\n {unit ? <span style={{ opacity: 0.7, fontSize: 'smaller' }}>{unit}</span> : null}\n </div>\n </div>\n );\n }\n }\n\n return content;\n }\n}\n\nexport default ConfigState;\n"]}
1
+ {"version":3,"file":"ConfigState.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,SAAS,EACT,UAAU,EACV,MAAM,EACN,MAAM,EACN,MAAM,EACN,GAAG,EACH,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,GACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAiB,MAAM,4BAA4B,CAAC;AAGvE,OAAO,aAAa,MAAM,SAAS,CAAC;AACpC,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,SAAS,cAAc,CAAC,KAAe,EAAE,KAAwB;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO;YACH,uCAAuC,EAAE;gBACrC,IAAI,EAAE;oBACF,KAAK;iBACR;gBACD,MAAM,EAAE;oBACJ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;iBACzD;aACJ;YACD,SAAS,EAAE,2CAA2C;SACzD,CAAC;IACN,CAAC;IACD,OAAO;QACH,kCAAkC,EAAE;YAChC,IAAI,EAAE;gBACF,KAAK,EAAE,SAAS;aACnB;YACD,KAAK,EAAE;gBACH,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK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AAG,MAAM,CAAC;oBACf,GAAG,GAAG,KAAK,CAAC;gBAChB,CAAC;qBAAM,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;oBAC7C,KAAK,GAAG,WAAW,CAAC;oBACpB,GAAG,GAAG,KAAK,CAAC;gBAChB,CAAC;qBAAM,CAAC;oBACJ,KAAK,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;oBAC/B,GAAG,GAAG,KAAK,CAAC;gBAChB,CAAC;gBAED,OAAO,GAAG,CACN,6BAAK,KAAK,EAAE,QAAQ;oBACf,YAAY;oBACb,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,EAAE;wBAC3D,oBAAC,GAAG,IACA,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,IAErD,KAAK,CACJ;wBACL,IAAI,CAAC,CAAC,CAAC,8BAAM,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAG,IAAI,CAAQ,CAAC,CAAC,CAAC,IAAI,CAC9E,CACJ,CACT,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n TextField,\n IconButton,\n Button,\n Switch,\n Slider,\n Box,\n FormControl,\n InputLabel,\n Select,\n MenuItem,\n} from '@mui/material';\n\nimport { I18n, Icon, type IobTheme } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemState } from '../types';\nimport getIconByName from './Icons';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nfunction valueBlinkOnce(theme: IobTheme, color?: string | boolean): any {\n if (typeof color === 'string') {\n return {\n '@keyframes newStateAnimationOnceColor': {\n '0%': {\n color,\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'newStateAnimationOnceColor 2s ease-in-out',\n };\n }\n return {\n '@keyframes newStateAnimationOnce': {\n '0%': {\n color: '#00f900',\n },\n '80%': {\n color: theme.palette.mode === 'dark' ? '#518851' : '#008000',\n },\n '100%': {\n color: theme.palette.mode === 'dark' ? '#fff' : '#000',\n },\n },\n animation: 'newStateAnimationOnce 2s ease-in-out',\n };\n}\n\ninterface ConfigStateProps extends ConfigGenericProps {\n schema: ConfigItemState;\n}\n\ninterface ConfigStateState extends ConfigGenericState {\n stateValue?: string | number | boolean | null;\n controlType?: 'text' | 'html' | 'input' | 'slider' | 'select' | 'button' | 'switch' | 'number';\n obj?: ioBroker.Object | null;\n}\n\nclass ConfigState extends ConfigGeneric<ConfigStateProps, ConfigStateState> {\n controlTimeout: ReturnType<typeof setTimeout> | null = null;\n\n delayedUpdate: { timer: ReturnType<typeof setTimeout> | null; value: string | boolean | number | null } = {\n timer: null,\n value: null,\n };\n\n getObjectID(): string {\n let oid = this.props.schema.oid;\n if (oid.includes('${')) {\n oid = this.getPattern(oid, null, true);\n }\n\n if (this.props.schema.foreign) {\n return oid;\n }\n\n return `${this.props.schema.system ? 'system.adapter.' : ''}${this.props.oContext.adapterName}.${this.props.oContext.instance || 0}.${oid}`;\n }\n\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n const obj: ioBroker.StateObject = (await this.props.oContext.socket.getObject(\n this.getObjectID(),\n )) as ioBroker.StateObject;\n\n if (obj?.common?.states && !this.props.schema.options) {\n // Normalize states to object\n if (Array.isArray(obj?.common?.states)) {\n // convert array to object\n const states: Record<string, string> = {};\n obj.common.states.forEach((state, index) => {\n states[index.toString()] = state;\n });\n obj.common.states = states;\n }\n if (!Object.keys(obj.common.states).length) {\n obj.common.states = undefined; // remove empty states\n }\n }\n\n const controlType = this.props.schema.control || this.detectType(obj);\n\n try {\n const state = await this.props.oContext.socket.getState(this.getObjectID());\n\n this.setState({ stateValue: state ? state.val : null, controlType, obj }, async () => {\n await this.props.oContext.socket.subscribeState(this.getObjectID(), this.onStateChanged);\n });\n } catch (e) {\n console.error(`Cannot get state ${this.getObjectID()}: ${e}`);\n this.setState({ controlType, obj });\n }\n }\n\n componentWillUnmount(): void {\n super.componentWillUnmount();\n this.props.oContext.socket.unsubscribeState(this.getObjectID(), this.onStateChanged);\n if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n this.controlTimeout = null;\n this.props.oContext.socket\n .setState(this.getObjectID(), this.state.stateValue, false)\n .catch((e: Error) => console.error(`Cannot control value: ${e.toString()}`));\n }\n }\n\n onStateChanged = (_id: string, state: ioBroker.State | null | undefined): void => {\n let val = state ? state.val : null;\n if (this.state.controlType === 'button' || this.state.controlType === 'switch') {\n val = !!val;\n if (this.state.stateValue !== val) {\n this.setState({ stateValue: val });\n }\n } else if (val !== null && (this.state.controlType === 'slider' || this.state.controlType === 'number')) {\n val = parseFloat(val as unknown as string);\n console.log(`${Date.now()} Received new value: ${val}`);\n if (val !== this.state.stateValue) {\n if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n this.delayedUpdate.value = val;\n this.delayedUpdate.timer = setTimeout(() => {\n this.setState({ stateValue: this.delayedUpdate.value });\n }, 500);\n } else if (this.delayedUpdate.timer) {\n clearTimeout(this.delayedUpdate.timer);\n this.delayedUpdate.timer = null;\n }\n } else if (this.state.stateValue.toString() !== val.toString()) {\n this.setState({ stateValue: val });\n }\n };\n\n detectType(obj: ioBroker.StateObject): 'button' | 'switch' | 'slider' | 'input' | 'text' | 'select' {\n obj ||= {} as ioBroker.StateObject;\n obj.common ||= {} as ioBroker.StateCommon;\n\n // read an object\n if (obj.common.type === 'boolean') {\n if (this.props.schema.controlled !== false) {\n if (obj.common.read === false || this.props.schema.controlled === true) {\n return 'button';\n }\n if (obj.common.write || this.props.schema.controlled === true) {\n return 'switch';\n }\n }\n\n return 'text';\n }\n\n if (obj.common.type === 'number' && this.props.schema.controlled !== false) {\n if (obj.common.write || this.props.schema.controlled === true) {\n if (obj.common.states || this.props.schema.options) {\n return 'select';\n }\n if (obj.common.max !== undefined) {\n return 'slider';\n }\n return 'input';\n }\n return 'text';\n }\n\n if (obj.common.write && this.props.schema.controlled !== false) {\n if (obj.common.states || this.props.schema.options) {\n return 'select';\n }\n return 'input';\n }\n\n return 'text';\n }\n\n getNormalizedStates(): {\n label: string;\n value: number | string;\n hidden?: string | boolean;\n color?: string;\n }[] {\n let states: {\n label: string;\n value: number | string;\n hidden?: string | boolean;\n color?: string;\n }[];\n if (this.props.schema.options) {\n states = this.props.schema.options.map(state => {\n if (typeof state === 'string') {\n return { value: state, label: this.getText(state, this.props.schema.noTranslation) };\n }\n return {\n value: state.value,\n label: this.getText(state.label, this.props.schema.noTranslation),\n color: state.color,\n };\n });\n } else if (this.state.obj.common.states) {\n states = [];\n Object.keys(this.state.obj.common.states).forEach(key => {\n states.push({\n value: key,\n label: this.getText(this.state.obj.common.states[key], this.props.schema.noTranslation),\n });\n });\n } else {\n states = [];\n }\n\n return states;\n }\n\n renderItem(_error: string, disabled: boolean /*, defaultValue */): JSX.Element {\n if (!this.state.obj) {\n return null;\n }\n\n let content: JSX.Element;\n\n if (\n this.state.controlType === 'select' ||\n (!this.state.controlType &&\n (this.state.obj.common.type === 'number' || this.state.obj.common.type === 'string') &&\n this.state.obj.common.write !== false &&\n (this.props.schema.options || this.state.obj.common.states))\n ) {\n const states = this.getNormalizedStates();\n const item = states.find(it => it.value === this.state.stateValue);\n\n content = (\n <FormControl fullWidth>\n <InputLabel>${this.getText(this.props.schema.label)}</InputLabel>\n <Select\n value={this.state.stateValue}\n disabled={!!this.props.schema.readOnly || disabled}\n onChange={e => {\n this.setState({ stateValue: e.target.value }, (): void => {\n let value: string | number = this.state.stateValue as string | number;\n if (this.state.obj.common.type === 'number') {\n value = parseFloat((value as unknown as string).toString().replace(',', '.'));\n }\n\n void this.props.oContext.socket.setState(this.getObjectID(), value, false);\n });\n }}\n renderValue={(val: string) =>\n item?.color ? <div style={{ color: item.color }}>{item.label as string}</div> : val\n }\n >\n {states.map(item => (\n <MenuItem\n key={(item.value ?? '').toString()}\n value={item.value}\n style={{ color: item.color }}\n >\n ${item.label as string}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n } else if (\n this.state.controlType === 'button' ||\n (!this.state.controlType &&\n this.state.obj.common.type === 'boolean' &&\n ((this.state.obj.common.write && this.state.obj.common.read === false) ||\n this.state.obj.common.role?.includes('button')))\n ) {\n let icon: JSX.Element | null = null;\n if (this.props.schema.falseImage) {\n icon = getIconByName(this.props.schema.falseImage);\n }\n\n const text = this.getText(\n this.props.schema.falseText || this.props.schema.label,\n this.props.schema.noTranslation,\n );\n\n if (!text && icon) {\n content = (\n <IconButton\n style={this.props.schema.falseTextStyle}\n disabled={!!this.props.schema.readOnly}\n onClick={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n this.props.schema.buttonValue !== undefined\n ? this.props.schema.buttonValue\n : true,\n false,\n );\n }\n },\n });\n } else {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n this.props.schema.buttonValue !== undefined ? this.props.schema.buttonValue : true,\n false,\n );\n }\n }}\n >\n {icon}\n </IconButton>\n );\n } else {\n content = (\n <Button\n variant={this.props.schema.variant || 'contained'}\n startIcon={icon}\n style={this.props.schema.falseTextStyle}\n disabled={disabled || !!this.props.schema.readOnly}\n onClick={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n this.props.schema.buttonValue !== undefined\n ? this.props.schema.buttonValue\n : true,\n false,\n );\n }\n },\n });\n } else {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n this.props.schema.buttonValue !== undefined ? this.props.schema.buttonValue : true,\n false,\n );\n }\n }}\n >\n {text || this.getObjectID().split('.').pop()}\n </Button>\n );\n }\n } else if (\n this.state.controlType === 'input' ||\n (!this.state.controlType && this.state.obj.common.write && this.state.obj.common.type === 'string')\n ) {\n content = (\n <div style={{ width: '100%', display: 'flex', flexDirection: 'row', gap: 8, alignItems: 'baseline' }}>\n <TextField\n style={{ flex: 1 }}\n value={this.state.stateValue}\n variant=\"standard\"\n disabled={!!this.props.schema.readOnly || disabled}\n slotProps={{\n input: {\n endAdornment:\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) ||\n this.state.obj.common.unit ||\n undefined,\n },\n htmlInput: {\n readOnly: !!this.props.schema.readOnly,\n },\n }}\n onKeyUp={e => {\n if (this.props.schema.setOnEnterKey && e.key === 'Enter') {\n void this.props.oContext.socket.setState(\n this.getObjectID(),\n this.state.stateValue,\n false,\n );\n }\n }}\n onChange={e => {\n this.setState({ stateValue: e.target.value }, (): void => {\n if (this.props.schema.setOnEnterKey || this.props.schema.showEnterButton) {\n return;\n }\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n this.controlTimeout = null;\n let value: string | number = this.state.stateValue as string | number;\n if (this.state.obj.common.type === 'number') {\n value = parseFloat((value as unknown as string).toString().replace(',', '.'));\n }\n\n await this.props.oContext.socket.setState(this.getObjectID(), value, false);\n }, this.props.schema.controlDelay || 0);\n });\n }}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n {this.props.schema.showEnterButton && !this.props.schema.readOnly && (\n <Button\n variant=\"outlined\"\n disabled={disabled}\n onClick={() => {\n void this.props.oContext.socket.setState(\n this.getObjectID(),\n this.state.stateValue,\n false,\n );\n }}\n >\n {this.getText(\n typeof this.props.schema.showEnterButton === 'string'\n ? this.props.schema.showEnterButton\n : 'Set',\n )}\n </Button>\n )}\n </div>\n );\n } else {\n let fontSize: number | undefined;\n if (this.props.schema.size === 'normal') {\n fontSize = 16;\n } else if (this.props.schema.size === 'large') {\n fontSize = 20;\n } else if (typeof this.props.schema.size === 'number') {\n fontSize = this.props.schema.size;\n }\n let label = this.getText(this.props.schema.label, this.props.schema.noTranslation);\n\n const divStyle: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n fontSize: fontSize || '1rem',\n gap: 8,\n };\n\n if (!this.props.schema.narrow) {\n divStyle.width = '100%';\n divStyle.justifyContent = 'space-between';\n }\n\n if (label.trim()) {\n if (!label.trim().endsWith(':') && this.props.schema.addColon) {\n label = `${label.trim()}:`;\n }\n }\n\n let blinkStyle: React.CSSProperties | undefined;\n if (this.props.schema.blinkOnUpdate) {\n blinkStyle = valueBlinkOnce(this.props.oContext.theme, this.props.schema.blinkOnUpdate);\n }\n\n let labelIcon: React.JSX.Element | undefined;\n if (this.props.schema.labelIcon) {\n labelIcon = (\n <Icon\n src={this.props.schema.labelIcon}\n style={{ marginRight: 4 }}\n />\n );\n }\n\n let labelControl: React.JSX.Element | undefined;\n if (label && labelIcon) {\n labelControl = (\n <div style={{ whiteSpace: 'nowrap' }}>\n {labelIcon}\n {label}\n </div>\n );\n } else if (label) {\n labelControl = <div style={{ whiteSpace: 'nowrap' }}>{label}</div>;\n } else if (labelIcon) {\n labelControl = labelIcon;\n }\n\n if (\n this.state.controlType === 'switch' ||\n (!this.state.controlType &&\n this.state.obj.common.type === 'boolean' &&\n ((this.state.obj.common.write && this.state.obj.common.read !== false) ||\n this.state.obj.common.role?.includes('switch')))\n ) {\n let iconFalse: JSX.Element | null = null;\n const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);\n }\n let iconTrue: JSX.Element | null = null;\n const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);\n }\n\n content = (\n <Switch\n checked={!!this.state.stateValue}\n disabled={!!this.props.schema.readOnly || disabled}\n onChange={async () => {\n if (this.props.schema.confirm) {\n this.setState({\n confirmDialog: true,\n confirmCallback: async (result: boolean) => {\n if (result) {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n !this.state.stateValue,\n false,\n );\n }\n },\n });\n } else {\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n !this.state.stateValue,\n false,\n );\n }\n }}\n />\n );\n\n if (textFalse || iconFalse || textTrue || iconTrue) {\n content = (\n <div style={{ display: 'flex', alignItems: 'center', fontSize: 14 }}>\n <span style={this.props.schema.falseTextStyle}>\n {textFalse}\n {iconFalse}\n </span>\n {content}\n <span style={this.props.schema.trueTextStyle}>\n {iconTrue}\n {textTrue}\n </span>\n </div>\n );\n }\n\n if (labelControl) {\n content = (\n <div style={divStyle}>\n {labelControl}\n {content}\n </div>\n );\n }\n } else if (\n this.state.controlType === 'slider' ||\n (!this.state.controlType &&\n this.state.obj.common.type === 'number' &&\n ((this.state.obj.common.write &&\n (this.state.obj.common.max !== undefined || this.state.obj.common.unit === '%')) ||\n this.state.obj.common.role?.includes('slider') ||\n this.state.obj.common.role?.includes('dimmer') ||\n this.state.obj.common.role?.includes('blind')))\n ) {\n let iconFalse: JSX.Element | null = null;\n const textFalse = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n iconFalse = getIconByName(this.props.schema.falseImage, textFalse ? { marginLeft: 8 } : undefined);\n }\n let iconTrue: JSX.Element | null = null;\n const textTrue = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n iconTrue = getIconByName(this.props.schema.trueImage, textTrue ? { marginRight: 8 } : undefined);\n }\n\n const min =\n this.props.schema.min === undefined ? this.state.obj.common.min || 0 : this.props.schema.min;\n const max =\n this.props.schema.max === undefined\n ? this.state.obj.common.max === undefined\n ? 100\n : this.state.obj.common.max\n : this.props.schema.max;\n const step =\n this.props.schema.step === undefined ? this.state.obj.common.step || 1 : this.props.schema.step;\n\n content = (\n <Slider\n style={{ width: '100%', flexGrow: 1 }}\n min={min}\n max={max}\n disabled={!!this.props.schema.readOnly || disabled}\n step={step}\n value={this.state.stateValue as number}\n valueLabelDisplay=\"auto\"\n valueLabelFormat={(value: number) =>\n `${value}${this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit || ''}`\n }\n onChange={(_e: Event, value: number) => {\n this.setState({ stateValue: value }, (): void => {\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n console.log(`${Date.now()} Send new value: ${this.state.stateValue}`);\n this.controlTimeout = null;\n await this.props.oContext.socket.setState(\n this.getObjectID(),\n this.state.stateValue,\n false,\n );\n }, this.props.schema.controlDelay || 0);\n });\n }}\n />\n );\n\n if (textFalse || iconFalse || textTrue || iconTrue) {\n content = (\n <div\n style={{\n display: 'flex',\n width: '100%',\n flexGrow: 1,\n alignItems: 'center',\n }}\n >\n <span style={{ marginRight: 16, ...this.props.schema.falseTextStyle }}>\n {textFalse}\n {iconFalse}\n </span>\n {content}\n <span style={{ marginLeft: 16, ...this.props.schema.trueTextStyle }}>\n {iconTrue}\n {textTrue}\n </span>\n </div>\n );\n }\n if (labelControl) {\n content = (\n <div style={divStyle}>\n {labelControl}\n {content}\n </div>\n );\n }\n } else if (this.state.obj.common.type === 'number' && this.state.obj.common.write && !this.state.controlType) {\n // Auto-detection of the type\n const min =\n this.props.schema.min === undefined\n ? this.state.obj.common.min === undefined\n ? undefined\n : this.state.obj.common.min\n : this.props.schema.min;\n const max =\n this.props.schema.max === undefined\n ? this.state.obj.common.max === undefined\n ? undefined\n : this.state.obj.common.max\n : this.props.schema.max;\n const step =\n this.props.schema.step === undefined\n ? this.state.obj.common.step === undefined\n ? undefined\n : this.state.obj.common.step\n : this.props.schema.step;\n\n content = (\n <TextField\n variant=\"standard\"\n style={{ width: '100%' }}\n value={this.state.stateValue}\n type=\"number\"\n disabled={!!this.props.schema.readOnly || disabled}\n slotProps={{\n htmlInput: { min, max, step, readOnly: !!this.props.schema.readOnly },\n input: {\n endAdornment:\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) ||\n this.state.obj.common.unit ||\n undefined,\n },\n }}\n onChange={e => {\n this.setState({ stateValue: e.target.value }, (): void => {\n if (this.controlTimeout) {\n clearTimeout(this.controlTimeout);\n }\n this.controlTimeout = setTimeout(async () => {\n this.controlTimeout = null;\n const val = parseFloat(this.state.stateValue as unknown as string);\n await this.props.oContext.socket.setState(this.getObjectID(), val, false);\n }, this.props.schema.controlDelay || 0);\n });\n }}\n label={this.getText(this.props.schema.label, this.props.schema.noTranslation)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n } else if (this.state.obj.common.type === 'boolean') {\n let icon: JSX.Element | null = null;\n let text: string;\n let style: React.CSSProperties | undefined;\n if (!this.state.stateValue) {\n text = this.getText(this.props.schema.falseText, this.props.schema.noTranslation);\n if (this.props.schema.falseImage) {\n icon = getIconByName(this.props.schema.falseImage, text ? { marginLeft: 8 } : undefined);\n }\n style = this.props.schema.falseTextStyle;\n } else {\n text = this.getText(this.props.schema.trueText, this.props.schema.noTranslation);\n if (this.props.schema.trueImage) {\n icon = getIconByName(this.props.schema.falseImage, text ? { marginRight: 8 } : undefined);\n }\n style = this.props.schema.trueTextStyle;\n }\n style = Object.assign(divStyle, style);\n\n content = (\n <div style={style}>\n {labelControl}\n <Box\n style={{ display: 'flex', alignItems: 'center', gap: 8 }}\n sx={blinkStyle}\n key={this.props.schema.blinkOnUpdate ? text : undefined}\n >\n {icon}\n {text || (this.state.stateValue ? I18n.t('ra_true') : I18n.t('ra_false'))}\n </Box>\n </div>\n );\n } else {\n // text or HTML\n const unit =\n this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit;\n\n let mappedValue = this.state.stateValue;\n\n // if options or states are defined, map the value to the label\n if (\n mappedValue !== null &&\n mappedValue !== undefined &&\n (this.props.schema.options || this.state.obj.common.states)\n ) {\n const states = this.getNormalizedStates();\n const state = states.find(s => s.value === mappedValue);\n if (state) {\n mappedValue = state.label;\n }\n }\n\n let value;\n let key: string;\n if (this.state.controlType === 'html') {\n key = (mappedValue || '').toString();\n value = <span dangerouslySetInnerHTML={{ __html: mappedValue as string }} />;\n } else if (this.state.stateValue === null) {\n value = 'null';\n key = value;\n } else if (this.state.stateValue === undefined) {\n value = 'undefined';\n key = value;\n } else {\n value = mappedValue.toString();\n key = value;\n }\n\n content = (\n <div style={divStyle}>\n {labelControl}\n <div style={{ display: 'flex', alignItems: 'baseline', gap: 4 }}>\n <Box\n sx={blinkStyle}\n key={this.props.schema.blinkOnUpdate ? key : undefined}\n >\n {value}\n </Box>\n {unit ? <span style={{ opacity: 0.7, fontSize: 'smaller' }}>{unit}</span> : null}\n </div>\n </div>\n );\n }\n }\n\n return content;\n }\n}\n\nexport default ConfigState;\n"]}
package/build/types.d.ts CHANGED
@@ -18,62 +18,63 @@ declare module '@mui/material/Button' {
18
18
  type CustomCSSProperties = React.CSSProperties;
19
19
 
20
20
  export type ConfigItemType =
21
- | 'tabs'
22
- | 'panel'
23
- | 'text'
24
- | 'number'
25
- | 'color'
21
+ | 'accordion'
22
+ | 'alive'
23
+ | 'autocomplete'
24
+ | 'autocompleteSendTo'
25
+ | 'certCollection'
26
+ | 'certificate'
27
+ | 'certificates'
28
+ | 'checkLicense'
26
29
  | 'checkbox'
27
- | 'slider'
28
- | 'ip'
29
- | 'user'
30
- | 'room'
30
+ | 'chips'
31
+ | 'color'
32
+ | 'coordinates'
33
+ | 'cron'
34
+ | 'custom'
35
+ | 'datePicker'
36
+ | 'deviceManager'
37
+ | 'divider'
38
+ | 'file'
39
+ | 'fileSelector'
31
40
  | 'func'
32
- | 'select'
33
- | 'autocomplete'
41
+ | 'header'
34
42
  | 'image'
43
+ | 'imageSendTo'
44
+ | 'infoBox'
45
+ | 'instance'
46
+ | 'interface'
47
+ | 'ip'
48
+ | 'jsonEditor'
49
+ | 'language'
50
+ | 'license'
51
+ | 'number'
52
+ | 'oauth2'
35
53
  | 'objectId'
54
+ | 'panel'
36
55
  | 'password'
37
- | 'instance'
38
- | 'chips'
39
- | 'alive'
40
56
  | 'pattern'
57
+ | 'port'
58
+ | 'qrCode'
59
+ | 'room'
60
+ | 'select'
61
+ | 'selectSendTo'
41
62
  | 'sendto'
42
63
  | 'setState'
64
+ | 'slider'
65
+ | 'state'
66
+ | 'staticImage'
43
67
  | 'staticInfo'
44
- | 'staticText'
45
68
  | 'staticLink'
46
- | 'staticImage'
69
+ | 'staticText'
47
70
  | 'table'
48
- | 'accordion'
49
- | 'jsonEditor'
50
- | 'language'
51
- | 'certificate'
52
- | 'certificates'
53
- | 'certCollection'
54
- | 'custom'
55
- | 'datePicker'
56
- | 'timePicker'
57
- | 'divider'
58
- | 'header'
59
- | 'cron'
60
- | 'fileSelector'
61
- | 'file'
62
- | 'imageSendTo'
63
- | 'selectSendTo'
64
- | 'autocompleteSendTo'
71
+ | 'tabs'
72
+ | 'text'
65
73
  | 'textSendTo'
66
- | 'coordinates'
67
- | 'interface'
68
- | 'license'
69
- | 'checkLicense'
70
- | 'uuid'
71
- | 'port'
72
- | 'deviceManager'
74
+ | 'timePicker'
73
75
  | 'topic'
74
- | 'qrCode'
75
- | 'oauth2'
76
- | 'state';
76
+ | 'user'
77
+ | 'uuid';
77
78
 
78
79
  type ConfigIconType =
79
80
  // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
@@ -221,6 +222,8 @@ export interface ConfigItemSelectOption {
221
222
  label: ioBroker.StringOrTranslated;
222
223
  /** Value of option */
223
224
  value: number | string;
225
+ /** Color of value */
226
+ color?: string;
224
227
  /** Formula or boolean value to show or hide the option */
225
228
  hidden?: string | boolean;
226
229
  }
@@ -475,7 +478,7 @@ export interface ConfigItemStaticInfo extends Omit<ConfigItem, 'data'> {
475
478
  labelIcon?: string;
476
479
  /** Unit */
477
480
  unit?: ioBroker.StringOrTranslated;
478
- /** Normally the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label*/
481
+ /** Normally, the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label*/
479
482
  narrow?: boolean;
480
483
  /** Add to label the colon at the end if not exist in label */
481
484
  addColon?: boolean;
@@ -501,6 +504,22 @@ export interface ConfigItemStaticInfo extends Omit<ConfigItem, 'data'> {
501
504
  html?: boolean;
502
505
  }
503
506
 
507
+ export interface ConfigItemInfoBox extends ConfigItem {
508
+ type: 'infoBox';
509
+ /** multi-language text */
510
+ text: ioBroker.StringOrTranslated;
511
+ /** multi-language title */
512
+ title?: ioBroker.StringOrTranslated;
513
+ /** The type determines the color and symbol */
514
+ boxType?: 'warning' | 'info' | 'error' | 'ok';
515
+ /** If the box is closeable */
516
+ closeable?: boolean;
517
+ /** Use together with `closeable: true`. If the box is closed or not. In this case, it will be controlled from outside */
518
+ closed?: boolean;
519
+ /** Icon position */
520
+ iconPosition?: 'top' | 'middle';
521
+ }
522
+
504
523
  export interface ConfigItemRoom extends ConfigItem {
505
524
  type: 'room';
506
525
  short?: boolean;
@@ -525,6 +544,7 @@ export interface ConfigItemSelect extends ConfigItem {
525
544
  items: ConfigItemSelectOption[];
526
545
  label: ioBroker.StringOrTranslated;
527
546
  value?: number | string;
547
+ color?: string;
528
548
  hidden?: string | boolean;
529
549
  }
530
550
  )[];
@@ -741,6 +761,8 @@ export interface ConfigItemState extends ConfigItem {
741
761
  showEnterButton?: boolean | ioBroker.StringOrTranslated;
742
762
  /** The value in this case will be sent only when the "Enter" button is pressed. It can be combined with `showEnterButton` */
743
763
  setOnEnterKey?: boolean;
764
+ /** Options for `select`. If not defiled, the `common.states` in the object must exist. */
765
+ options?: (string | ConfigItemSelectOption)[];
744
766
  }
745
767
 
746
768
  export interface ConfigItemTextSendTo extends Omit<ConfigItem, 'data'> {
@@ -992,6 +1014,7 @@ export type ConfigItemAny =
992
1014
  | ConfigItemCheckbox
993
1015
  | ConfigItemSlider
994
1016
  | ConfigItemIP
1017
+ | ConfigItemInfoBox
995
1018
  | ConfigItemUser
996
1019
  | ConfigItemRoom
997
1020
  | ConfigItemFunc
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iobroker/json-config",
3
3
  "description": "This package contains the ioBroker JSON config UI components",
4
- "version": "7.6.18",
4
+ "version": "7.6.19",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
7
7
  "scripts": {
@@ -18,9 +18,9 @@
18
18
  "access": "public"
19
19
  },
20
20
  "dependencies": {
21
- "@iobroker/adapter-react-v5": "7.6.18",
22
- "@module-federation/runtime": "^0.11.4",
23
- "@mui/x-date-pickers": "^7.28.3",
21
+ "@iobroker/adapter-react-v5": "7.6.19",
22
+ "@module-federation/runtime": "^0.15.0",
23
+ "@mui/x-date-pickers": "^7.29.4",
24
24
  "crypto-js": "^4.2.0",
25
25
  "json5": "^2.2.3",
26
26
  "react-ace": "^14.0.1",
@@ -30,11 +30,11 @@
30
30
  "@types/crypto-js": "^4.2.2",
31
31
  "@types/json5": "^2.2.0",
32
32
  "ajv": "^8.17.1",
33
- "tsc-alias": "^1.8.13"
33
+ "tsc-alias": "^1.8.16"
34
34
  },
35
35
  "files": [
36
36
  "build/",
37
37
  "LICENSE"
38
38
  ],
39
- "gitHead": "24c6e6b9d17a9bb8a8811afc6213b6da08a20cfe"
39
+ "gitHead": "1953b4ae15e772663a0dfa6c41c9eddfe3f318f2"
40
40
  }