@iobroker/json-config 8.3.2 → 8.3.5

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
@@ -448,16 +448,18 @@ Select function from `enum.func` (With color and icon) - (only Admin6)
448
448
  | `multiple` | Multiple choice select (From 7.6.5) |
449
449
  | `showAllValues` | show item even if no label was found for it (by multiple), default=`true` |
450
450
  | `format` | Render format: `"dropdown"` (default) or `"radio"` to display options as radio buttons instead of a dropdown |
451
+ | `horizontal` | If `true`, radio buttons are shown horizontally (only applies when `format` is `"radio"`) (from v8.3.3) |
451
452
 
452
453
  Each option in `options` can have:
453
454
 
454
- | Property | Description |
455
- |---------------|--------------------------------------------------------------------|
456
- | `label` | Label of the option (can be a string or translatable object) |
457
- | `value` | Value of the option |
458
- | `color` | Color of the option text |
459
- | `hidden` | Formula or boolean value to show or hide the option |
460
- | `description` | Description shown below the option label (can be translatable) |
455
+ | Property | Description |
456
+ |---------------|-----------------------------------------------------------------------|
457
+ | `label` | Label of the option (can be a string or translatable object) |
458
+ | `value` | Value of the option |
459
+ | `color` | Color of the option text |
460
+ | `hidden` | Formula or boolean value to show or hide the option |
461
+ | `description` | Description shown below the option label (can be translatable) |
462
+ | `icon` | Icon URL or base64 string to display next to the option (from v8.3.3) |
461
463
 
462
464
  #### Example for `select options`
463
465
 
@@ -709,26 +711,36 @@ button that sets instance's state
709
711
 
710
712
  Static text like description
711
713
 
712
- | Property | Description |
713
- |----------|-----------------------------------------------------|
714
- | `label` | multi-language text |
715
- | `text` | same as label |
716
- | `format` | `text` (default), `html` (from admin version 7.8.4) |
714
+ | Property | Description |
715
+ |----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
716
+ | `label` | multi-language text |
717
+ | `text` | same as label |
718
+ | `format` | `text` (default), `html`, `json` (from admin version 7.8.4) |
719
+ | `href` | link. Link could be dynamic like `#tab-objects/customs/${data.parentId}` |
720
+ | `target` | `_blank` or `_self` or window name. For relative links the default is `_self` and for absolute - `_blank` |
721
+ | `close` | if true, the GUI will be closed (used not for JsonConfig in admin, but for dynamic GUI, only if the target is `_self`) |
722
+ | `button` | show a link as a button |
723
+ | `variant` | type of button (`outlined`, `contained`, `text`) |
724
+ | `color` | color of button (e.g. `primary`) |
725
+ | `icon` | if icon should be shown: `auth`, `send`, `web`, `warning`, `error`, `info`, `search`, `book`, `help`, `upload`. You can use `base64` icons (it starts with `data:image/svg+xml;base64,...`) or `jpg/png` images (ends with `.png`) . (Request via issue if you need more icons) |
726
+ | `controlStyle` | CSS Styles in React format for the button or control itself |
717
727
 
718
728
  exactly one of `label` or `text` must be specified - not both
719
729
 
720
730
  ### `staticLink`
721
731
 
722
- | Property | Description |
723
- |-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
724
- | `label` | multi-language text |
725
- | `href` | link. Link could be dynamic like `#tab-objects/customs/${data.parentId}` |
726
- | `target` | `_blank` or `_self` or window name |
727
- | `close` | if true, the GUI will be closed (used not for JsonConfig in admin, but for dynamic GUI) |
728
- | `button` | show a link as button |
729
- | `variant` | type of button (`outlined`, `contained`, `text`) |
730
- | `color` | color of button (e.g. `primary`) |
731
- | `icon` | if icon should be shown: `auth`, `send`, `web`, `warning`, `error`, `info`, `search`, `book`, `help`, `upload`. You can use `base64` icons (it starts with `data:image/svg+xml;base64,...`) or `jpg/png` images (ends with `.png`) . (Request via issue if you need more icons) |
732
+ | Property | Description |
733
+ |----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
734
+ | `label` | multi-language text |
735
+ | `href` | link. Link could be dynamic like `#tab-objects/customs/${data.parentId}` |
736
+ | `target` | `_blank` or `_self` or window name. For relative links the default is `_self` and for absolute - `_blank` |
737
+ | `close` | if true, the GUI will be closed (used not for JsonConfig in admin, but for dynamic GUI, only if the target is `_self`) |
738
+ | `button` | show a link as button |
739
+ | `variant` | type of button (`outlined`, `contained`, `text`) |
740
+ | `color` | color of button (e.g. `primary`) |
741
+ | `icon` | if icon should be shown: `auth`, `send`, `web`, `warning`, `error`, `info`, `search`, `book`, `help`, `upload`. You can use `base64` icons (it starts with `data:image/svg+xml;base64,...`) or `jpg/png` images (ends with `.png`) . (Request via issue if you need more icons) |
742
+ | `controlStyle` | CSS Styles in React format for the button or control itself |
743
+ | `format` | `text` (default), `html`, `json` |
732
744
 
733
745
  ### `staticImage`
734
746
 
@@ -1756,6 +1768,13 @@ The schema is used here: https://github.com/SchemaStore/schemastore/blob/6da29cd
1756
1768
  ### **WORK IN PROGRESS**
1757
1769
  -->
1758
1770
  ## Changelog
1771
+ ### 8.3.5 (2026-04-11)
1772
+ - (@GermanBluefox) Extend schema for staticLink and staticImage components
1773
+
1774
+ ### 8.3.4 (2026-04-09)
1775
+ - (@GermanBluefox) Added `horizontal` option for `select` component with `format: "radio"` to display radio buttons in a row
1776
+ - (@GermanBluefox) Added `icon` option for `select` component options to display icons next to labels
1777
+
1759
1778
  ### 8.3.2 (2026-03-31)
1760
1779
  - (@GermanBluefox) Added possibility to provide custom components
1761
1780
 
@@ -12,6 +12,7 @@ interface ConfigInstanceSelectState extends ConfigGenericState {
12
12
  hidden?: string | boolean;
13
13
  color?: string;
14
14
  description?: string;
15
+ icon?: string;
15
16
  }[];
16
17
  }
17
18
  export default class ConfigSelect extends ConfigGeneric<ConfigInstanceSelectProps, ConfigInstanceSelectState> {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { InputLabel, FormHelperText, FormControl, FormLabel, Select, MenuItem, ListSubheader, Chip, ListItemText, Checkbox, RadioGroup, Radio, FormControlLabel, Typography, } from '@mui/material';
3
- import { I18n } from '@iobroker/adapter-react-v5';
3
+ import { I18n, Icon } from '@iobroker/adapter-react-v5';
4
4
  import ConfigGeneric from './ConfigGeneric';
5
5
  const styles = {
6
6
  fullWidth: {
@@ -11,6 +11,11 @@ const styles = {
11
11
  marginTop: 0,
12
12
  },
13
13
  },
14
+ icon: {
15
+ width: 20,
16
+ height: 20,
17
+ marginRight: 4,
18
+ },
14
19
  };
15
20
  export default class ConfigSelect extends ConfigGeneric {
16
21
  initialValue = '';
@@ -43,6 +48,7 @@ export default class ConfigSelect extends ConfigGeneric {
43
48
  hidden: it.hidden,
44
49
  color: item.color,
45
50
  description: this.getText(item.description),
51
+ icon: it.icon,
46
52
  }));
47
53
  }
48
54
  else {
@@ -52,6 +58,7 @@ export default class ConfigSelect extends ConfigGeneric {
52
58
  hidden: item.hidden,
53
59
  color: item.color,
54
60
  description: this.getText(item.description),
61
+ icon: item.icon,
55
62
  });
56
63
  }
57
64
  });
@@ -109,7 +116,7 @@ export default class ConfigSelect extends ConfigGeneric {
109
116
  const value = this._getValue();
110
117
  return (React.createElement(FormControl, { fullWidth: true, error: !!error, disabled: !!disabled, id: `jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}` },
111
118
  this.props.schema.label ? React.createElement(FormLabel, null, this.getText(this.props.schema.label)) : null,
112
- React.createElement(RadioGroup, { value: value === undefined || value === null ? '' : value.toString(), onChange: e => {
119
+ React.createElement(RadioGroup, { row: !!this.props.schema.horizontal, value: value === undefined || value === null ? '' : value.toString(), onChange: e => {
113
120
  // find the original option value to preserve its type (number vs string)
114
121
  const opt = selectOptions.find(it => it.value.toString() === e.target.value);
115
122
  const newValue = opt ? opt.value : e.target.value;
@@ -119,7 +126,9 @@ export default class ConfigSelect extends ConfigGeneric {
119
126
  mayBePromise.catch(e => console.error(e));
120
127
  }
121
128
  });
122
- } }, selectOptions.map((it, i) => (React.createElement(FormControlLabel, { key: i, value: it.value.toString(), control: React.createElement(Radio, null), title: it.description || '', label: React.createElement(Typography, { component: "span", style: { color: it.color } }, it.label), style: it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {} })))),
129
+ } }, selectOptions.map((it, i) => (React.createElement(FormControlLabel, { key: i, value: it.value.toString(), control: React.createElement(Radio, null), title: it.description || '', label: React.createElement("span", { style: { display: 'flex', alignItems: 'center' } },
130
+ it.icon ? (React.createElement(Icon, { src: it.icon, style: styles.icon })) : null,
131
+ React.createElement(Typography, { component: "span", style: { color: it.color } }, it.label)), style: it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {} })))),
123
132
  this.props.schema.help ? (React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation))) : null));
124
133
  }
125
134
  renderItem(error, disabled /* , defaultValue */) {
@@ -141,11 +150,17 @@ export default class ConfigSelect extends ConfigGeneric {
141
150
  return (React.createElement(Chip, { key: v, label: label }));
142
151
  }
143
152
  return null;
144
- }))) : item?.color ? (React.createElement(React.Fragment, null,
145
- React.createElement("div", { style: { color: item.color } }, item.label === undefined ? val : item.label),
146
- item.description ? (React.createElement("div", { style: { opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' } }, item.description)) : null)) : item?.label === undefined ? (val) : (React.createElement(React.Fragment, null,
147
- React.createElement("div", null, item.label),
148
- item.description ? (React.createElement("div", { style: { opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' } }, item.description)) : null)), onChange: e => {
153
+ }))) : item?.color ? (React.createElement("span", { style: { display: 'flex', alignItems: 'center' } },
154
+ item.icon ? (React.createElement(Icon, { src: item.icon, style: styles.icon })) : null,
155
+ React.createElement("span", null,
156
+ React.createElement("div", { style: { color: item.color } }, item.label === undefined ? val : item.label),
157
+ item.description ? (React.createElement("div", { style: { opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' } }, item.description)) : null))) : item?.label === undefined ? (item?.icon ? (React.createElement("span", { style: { display: 'flex', alignItems: 'center' } },
158
+ React.createElement(Icon, { src: item.icon, style: styles.icon }),
159
+ val)) : (val)) : (React.createElement("span", { style: { display: 'flex', alignItems: 'center' } },
160
+ item.icon ? (React.createElement(Icon, { src: item.icon, style: styles.icon })) : null,
161
+ React.createElement("span", null,
162
+ React.createElement("div", null, item.label),
163
+ item.description ? (React.createElement("div", { style: { opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' } }, item.description)) : null))), onChange: e => {
149
164
  this.setState({ value: e.target.value === '_' ? '' : e.target.value }, () => {
150
165
  let mayBePromise;
151
166
  if (this.state.value === ConfigGeneric.DIFFERENT_VALUE) {
@@ -177,6 +192,7 @@ export default class ConfigSelect extends ConfigGeneric {
177
192
  }
178
193
  this.setState({ value: _value }, () => this.onChange(this.props.attr, _value));
179
194
  } })) : null,
195
+ it.icon ? (React.createElement(Icon, { src: it.icon, style: styles.icon })) : null,
180
196
  React.createElement(ListItemText, { primary: it.label, secondary: it.description, slotProps: {
181
197
  secondary: {
182
198
  style: { fontSize: 'smaller', fontStyle: 'italic', opacity: 0.7 },
@@ -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,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,UAAU,GACb,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;AAiBF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,aAAmE;IACjG,YAAY,GAAsB,EAAE,CAAC;IAE7C,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,KAAK,GAAsB,aAAa,CAAC,QAAQ,CAA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GAAG,EAAE;6BACpE;yBACJ,EACD,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","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n FormHelperText,\n FormControl,\n FormLabel,\n Select,\n MenuItem,\n ListSubheader,\n Chip,\n ListItemText,\n Checkbox,\n RadioGroup,\n Radio,\n FormControlLabel,\n Typography,\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 description?: string;\n }[];\n}\n\nexport default class 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 description?: 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 description?: string;\n } = item as {\n items: ConfigItemSelectOption[];\n label: ioBroker.StringOrTranslated;\n value?: number | string;\n hidden?: string | boolean;\n description?: string;\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 description: this.getText(item.description),\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 description: this.getText(item.description),\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 description: this.getText(item.description),\n });\n }\n });\n\n // Report value-to-label mapping to parent table for filtering\n if (this.props.onFilterLabelUpdate && this.props.table) {\n const valueToLabel: Record<string, string> = {};\n for (const opt of selectOptions) {\n if (!opt.group && opt.value !== ConfigGeneric.DIFFERENT_VALUE) {\n valueToLabel[opt.value.toString()] = opt.label;\n }\n }\n this.props.onFilterLabelUpdate(this.props.attr, valueToLabel);\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 _filterOptions(\n selectOptions: ConfigInstanceSelectState['selectOptions'],\n ): ConfigInstanceSelectState['selectOptions'] {\n return (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\n renderRadio(error: string, disabled: boolean): JSX.Element {\n const selectOptions = this._filterOptions(this.state.selectOptions).filter(it => !it.group);\n const value = this._getValue();\n\n return (\n <FormControl\n fullWidth\n error={!!error}\n disabled={!!disabled}\n id={`jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}`}\n >\n {this.props.schema.label ? <FormLabel>{this.getText(this.props.schema.label)}</FormLabel> : null}\n <RadioGroup\n value={value === undefined || value === null ? '' : value.toString()}\n onChange={e => {\n // find the original option value to preserve its type (number vs string)\n const opt = selectOptions.find(it => it.value.toString() === e.target.value);\n const newValue = opt ? opt.value : e.target.value;\n this.setState({ value: newValue }, () => {\n const mayBePromise = this.onChange(this.props.attr, newValue);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n >\n {selectOptions.map((it, i) => (\n <FormControlLabel\n key={i}\n value={it.value.toString()}\n control={<Radio />}\n title={it.description || ''}\n label={\n <Typography\n component=\"span\"\n style={{ color: it.color }}\n >\n {it.label}\n </Typography>\n }\n style={it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {}}\n />\n ))}\n </RadioGroup>\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 renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (!this.state.selectOptions) {\n return null;\n }\n\n if (this.props.schema.format === 'radio') {\n return this.renderRadio(error, disabled);\n }\n\n const selectOptions = this._filterOptions(this.state.selectOptions);\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 <>\n <div style={{ color: item.color }}>{item.label === undefined ? val : item.label}</div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\n </>\n ) : item?.label === undefined ? (\n val\n ) : (\n <>\n <div>{item.label}</div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\n </>\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 <div>{it.label}</div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\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 secondary={it.description}\n slotProps={{\n secondary: {\n style: { fontSize: 'smaller', fontStyle: 'italic', opacity: 0.7 },\n },\n }}\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"]}
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,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,UAAU,GACb,MA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AAC;gCACtB,MAAM,CAAC,IAAI,EAAE,CAAC;4BAClB,CAAC;4BACD,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAClC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CACzC,CAAC;wBACN,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;oBACP,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CACP,oBAAC,IAAI,IACD,GAAG,EAAE,EAAE,CAAC,IAAI,EACZ,KAAK,EAAE,MAAM,CAAC,IAAI,GACpB,CACL,CAAC,CAAC,CAAC,IAAI;oBACR,oBAAC,YAAY,IACT,OAAO,EAAE,EAAE,CAAC,KAAK,EACjB,SAAS,EAAE,EAAE,CAAC,WAAW,EACzB,SAAS,EAAE;4BACP,SAAS,EAAE;gCACP,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;6BACpE;yBACJ,EACD,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","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n FormHelperText,\n FormControl,\n FormLabel,\n Select,\n MenuItem,\n ListSubheader,\n Chip,\n ListItemText,\n Checkbox,\n RadioGroup,\n Radio,\n FormControlLabel,\n Typography,\n} from '@mui/material';\n\nimport { I18n, Icon } 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 icon: {\n width: 20,\n height: 20,\n marginRight: 4,\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 description?: string;\n icon?: string;\n }[];\n}\n\nexport default class 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 description?: string;\n icon?: 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 description?: string;\n } = item as {\n items: ConfigItemSelectOption[];\n label: ioBroker.StringOrTranslated;\n value?: number | string;\n hidden?: string | boolean;\n description?: string;\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 description: this.getText(item.description),\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 description: this.getText(item.description),\n icon: it.icon,\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 description: this.getText(item.description),\n icon: item.icon,\n });\n }\n });\n\n // Report value-to-label mapping to parent table for filtering\n if (this.props.onFilterLabelUpdate && this.props.table) {\n const valueToLabel: Record<string, string> = {};\n for (const opt of selectOptions) {\n if (!opt.group && opt.value !== ConfigGeneric.DIFFERENT_VALUE) {\n valueToLabel[opt.value.toString()] = opt.label;\n }\n }\n this.props.onFilterLabelUpdate(this.props.attr, valueToLabel);\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 _filterOptions(\n selectOptions: ConfigInstanceSelectState['selectOptions'],\n ): ConfigInstanceSelectState['selectOptions'] {\n return (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\n renderRadio(error: string, disabled: boolean): JSX.Element {\n const selectOptions = this._filterOptions(this.state.selectOptions).filter(it => !it.group);\n const value = this._getValue();\n\n return (\n <FormControl\n fullWidth\n error={!!error}\n disabled={!!disabled}\n id={`jsonSelect_${this.props.attr}_${this.props.index || this.props.index === 0 ? this.props.index : ''}`}\n >\n {this.props.schema.label ? <FormLabel>{this.getText(this.props.schema.label)}</FormLabel> : null}\n <RadioGroup\n row={!!this.props.schema.horizontal}\n value={value === undefined || value === null ? '' : value.toString()}\n onChange={e => {\n // find the original option value to preserve its type (number vs string)\n const opt = selectOptions.find(it => it.value.toString() === e.target.value);\n const newValue = opt ? opt.value : e.target.value;\n this.setState({ value: newValue }, () => {\n const mayBePromise = this.onChange(this.props.attr, newValue);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(e));\n }\n });\n }}\n >\n {selectOptions.map((it, i) => (\n <FormControlLabel\n key={i}\n value={it.value.toString()}\n control={<Radio />}\n title={it.description || ''}\n label={\n <span style={{ display: 'flex', alignItems: 'center' }}>\n {it.icon ? (\n <Icon\n src={it.icon}\n style={styles.icon}\n />\n ) : null}\n <Typography\n component=\"span\"\n style={{ color: it.color }}\n >\n {it.label}\n </Typography>\n </span>\n }\n style={it.value === ConfigGeneric.DIFFERENT_VALUE ? { opacity: 0.5 } : {}}\n />\n ))}\n </RadioGroup>\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 renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n if (!this.state.selectOptions) {\n return null;\n }\n\n if (this.props.schema.format === 'radio') {\n return this.renderRadio(error, disabled);\n }\n\n const selectOptions = this._filterOptions(this.state.selectOptions);\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 <span style={{ display: 'flex', alignItems: 'center' }}>\n {item.icon ? (\n <Icon\n src={item.icon}\n style={styles.icon}\n />\n ) : null}\n <span>\n <div style={{ color: item.color }}>\n {item.label === undefined ? val : item.label}\n </div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\n </span>\n </span>\n ) : item?.label === undefined ? (\n item?.icon ? (\n <span style={{ display: 'flex', alignItems: 'center' }}>\n <Icon\n src={item.icon}\n style={styles.icon}\n />\n {val}\n </span>\n ) : (\n val\n )\n ) : (\n <span style={{ display: 'flex', alignItems: 'center' }}>\n {item.icon ? (\n <Icon\n src={item.icon}\n style={styles.icon}\n />\n ) : null}\n <span>\n <div>{item.label}</div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\n </span>\n </span>\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 <div>{it.label}</div>\n {item.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {item.description}\n </div>\n ) : null}\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 {it.icon ? (\n <Icon\n src={it.icon}\n style={styles.icon}\n />\n ) : null}\n <ListItemText\n primary={it.label}\n secondary={it.description}\n slotProps={{\n secondary: {\n style: { fontSize: 'smaller', fontStyle: 'italic', opacity: 0.7 },\n },\n }}\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"]}
package/build/types.d.ts CHANGED
@@ -258,6 +258,8 @@ export interface ConfigItemSelectOption {
258
258
  hidden?: string | boolean;
259
259
  /** Description for the value */
260
260
  description?: ioBroker.StringOrTranslated;
261
+ /** Icon URL or base64 to display next to the option */
262
+ icon?: string;
261
263
  }
262
264
 
263
265
  export interface ConfigItemPanel extends ConfigItem {
@@ -618,9 +620,12 @@ export interface ConfigItemSelect extends ConfigItem {
618
620
  color?: string;
619
621
  hidden?: string | boolean;
620
622
  description?: ioBroker.StringOrTranslated;
623
+ icon?: string;
621
624
  }
622
625
  )[];
623
- format: 'dropdown' | 'radio';
626
+ format?: 'dropdown' | 'radio';
627
+ /** If radio buttons shown horizontally */
628
+ horizontal?: boolean;
624
629
  attr?: string;
625
630
  /** If multiple selection is possible. In this case, the value will be an array */
626
631
  multiple?: boolean;
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": "8.3.2",
4
+ "version": "8.3.5",
5
5
  "author": {
6
6
  "name": "bluefox",
7
7
  "email": "dogafox@gmail.com"
@@ -35,7 +35,7 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "@iobroker/adapter-react-v5": "^8.1.6",
38
+ "@iobroker/adapter-react-v5": "^8.1.8",
39
39
  "@module-federation/runtime": "^2.3.0",
40
40
  "@mui/x-date-pickers": "^7.29.4",
41
41
  "crypto-js": "^4.2.0",
@@ -50,7 +50,6 @@
50
50
  "@iobroker/build-tools": "^3.0.1",
51
51
  "@iobroker/eslint-config": "^2.2.0",
52
52
  "@types/crypto-js": "^4.2.2",
53
- "@types/json5": "^2.2.0",
54
53
  "@types/node": "^25.4.0",
55
54
  "@types/react": "^18.3.28",
56
55
  "@types/react-color": "^3.0.13",