@iobroker/json-config 8.1.11 → 8.2.2

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
@@ -171,6 +171,7 @@ You can install it via GitHub icon in admin by entering `iobroker.jsonconfig-dem
171
171
  - [**`pattern`:**](#pattern) Read-only field showing a pattern (e.g., URL)
172
172
  - [**`port`:**](#port) Special input for ports
173
173
  - [**`qrCode`:**](#qrcode) Displays data as a QR code (Admin 7.0.18 or newer)
174
+ - [**`qrCodeSendTo`:**](#qrcodesendto) Displays a QR code with data received from the backend
174
175
  - [**`room`:**](#room) Selects a room from the `enum.room` list (Admin 6 only)
175
176
  - [**`select`:**](#select) Dropdown menu with predefined options
176
177
  - [**`selectSendTo`:**](#selectsendto) Dropdown menu with instance values for sending data
@@ -914,13 +915,14 @@ only Admin6.
914
915
 
915
916
  shows the image received from the backend as base64 string
916
917
 
917
- | Property | Description |
918
- |------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
919
- | `width` | width of QR code in px |
920
- | `height` | height of QR code in px |
921
- | `command` | sendTo command |
922
- | `jsonData` | string - `{"subject1": "${data.subject}", "options1": {"host": "${data.host}"}}`. This data will be sent to backend |
923
- | `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to backend if jsonData is not defined. |
918
+ | Property | Description |
919
+ |--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
920
+ | `width` | width of QR code in px |
921
+ | `height` | height of QR code in px |
922
+ | `command` | sendTo command |
923
+ | `jsonData` | string - `{"subject1": "${data.subject}", "options1": {"host": "${data.host}"}}`. This data will be sent to backend |
924
+ | `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to backend if jsonData is not defined. |
925
+ | `sendFirstByClick` | show image first when clicked. `true` - standard text (Click to show) or specific text |
924
926
 
925
927
  #### Example of code in back-end for `imageSendTo`
926
928
 
@@ -937,6 +939,34 @@ adapter.on("message", (obj) => {
937
939
  });
938
940
  ```
939
941
 
942
+ ### `qrCodeSendTo`
943
+
944
+ Sends a command to the adapter instance and displays the response string as a QR code.
945
+ The backend must return a plain string (the data to encode).
946
+
947
+ | Property | Description |
948
+ |--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
949
+ | `command` | sendTo command (default: `"send"`) |
950
+ | `alsoDependsOn` | array of attribute names — the QR code is refreshed whenever any of these attributes change |
951
+ | `jsonData` | string - `{"subject1": "${data.subject}", "options1": {"host": "${data.host}"}}`. This data will be sent to backend |
952
+ | `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to backend if jsonData is not defined. |
953
+ | `sendFirstByClick` | load QR code only after a click. `true` — standard text ("Click to show") or a custom string/translation object used as the button label |
954
+ | `size` | size of the QR code in px |
955
+ | `fgColor` | foreground color (default: `"#000000"`) |
956
+ | `bgColor` | background color (default: `"#ffffff"`) |
957
+ | `level` | error correction level: `L`, `M`, `Q`, or `H` (default: `L`) |
958
+
959
+ #### Example of code in back-end for `qrCodeSendTo`
960
+
961
+ ```js
962
+ adapter.on("message", (obj) => {
963
+ if (obj.command === "send") {
964
+ // return the string to be encoded in the QR code
965
+ obj.callback && adapter.sendTo(obj.from, obj.command, "https://example.com/pair?token=abc123", obj.callback);
966
+ }
967
+ });
968
+ ```
969
+
940
970
  ### `iframe`
941
971
 
942
972
  Shows an iframe with the specified URL. (from Admin 7.7.28)
@@ -1249,6 +1279,7 @@ Special input for ports. It checks automatically if the port is used by other in
1249
1279
  | `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") |
1250
1280
  | `setOnEnterKey` | The value in this case will be sent only when the "Enter" button is pressed. It can be combined with `showEnterButton` |
1251
1281
  | `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. |
1282
+ | `digits` | Number of decimal places to display for numeric values in `text`/`html` mode (e.g. `2` turns `230.2764537654374` into `230.28`) |
1252
1283
 
1253
1284
  ### `staticInfo`
1254
1285
 
@@ -1677,6 +1708,12 @@ The schema is used here: https://github.com/SchemaStore/schemastore/blob/6da29cd
1677
1708
  ### **WORK IN PROGRESS**
1678
1709
  -->
1679
1710
  ## Changelog
1711
+ ### 8.2.2 (2026-03-03)
1712
+ - (@GermanBluefox) Added option `sendFirstByClick` to `imageSendTo`
1713
+ - (@GermanBluefox) Added new component: `qrCodeSendTo`
1714
+ - (@GermanBluefox) Added option `digits` to `state` component
1715
+ - (@GermanBluefox) Trying to fix indication of the problems in the table
1716
+
1680
1717
  ### 8.1.11 (2026-02-12)
1681
1718
  - (@GermanBluefox) Added the copy-to-clipboard dialog for `sendTo`
1682
1719
 
@@ -6,8 +6,9 @@ interface ConfigImageSendToProps extends ConfigGenericProps {
6
6
  }
7
7
  interface ConfigImageSendToState extends ConfigGenericState {
8
8
  image?: string;
9
+ loading?: boolean;
9
10
  }
10
- declare class ConfigImageSendTo extends ConfigGeneric<ConfigImageSendToProps, ConfigImageSendToState> {
11
+ export default class ConfigImageSendTo extends ConfigGeneric<ConfigImageSendToProps, ConfigImageSendToState> {
11
12
  private initialized;
12
13
  private localContext;
13
14
  componentDidMount(): void;
@@ -15,4 +16,4 @@ declare class ConfigImageSendTo extends ConfigGeneric<ConfigImageSendToProps, Co
15
16
  getContext(): string;
16
17
  renderItem(): JSX.Element;
17
18
  }
18
- export default ConfigImageSendTo;
19
+ export {};
@@ -1,11 +1,15 @@
1
1
  import React from 'react';
2
+ import { CircularProgress } from '@mui/material';
3
+ import { I18n } from '@iobroker/adapter-react-v5';
2
4
  import ConfigGeneric from './ConfigGeneric';
3
- class ConfigImageSendTo extends ConfigGeneric {
5
+ export default class ConfigImageSendTo extends ConfigGeneric {
4
6
  initialized = false;
5
7
  localContext;
6
8
  componentDidMount() {
7
9
  super.componentDidMount();
8
- this.askInstance();
10
+ if (!this.props.schema.sendFirstByClick) {
11
+ this.askInstance();
12
+ }
9
13
  }
10
14
  askInstance() {
11
15
  if (this.props.alive) {
@@ -24,9 +28,9 @@ class ConfigImageSendTo extends ConfigGeneric {
24
28
  if (data === undefined) {
25
29
  data = null;
26
30
  }
27
- void this.props.oContext.socket
31
+ this.setState({ loading: true }, () => this.props.oContext.socket
28
32
  .sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
29
- .then(image => this.setState({ image: image || '' }));
33
+ .then(image => this.setState({ image: image || '' })));
30
34
  }
31
35
  }
32
36
  getContext() {
@@ -41,15 +45,25 @@ class ConfigImageSendTo extends ConfigGeneric {
41
45
  const localContext = this.getContext();
42
46
  if (localContext !== this.localContext || !this.initialized) {
43
47
  this.localContext = localContext;
44
- setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);
48
+ if (!this.props.schema.sendFirstByClick || this.state.image !== undefined) {
49
+ setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);
50
+ }
45
51
  this.initialized = true;
46
52
  }
47
53
  }
54
+ if (!this.state.image && this.props.schema.sendFirstByClick) {
55
+ return (React.createElement("div", { style: {
56
+ width: this.props.schema.width || '100%',
57
+ height: this.props.schema.height,
58
+ display: 'flex',
59
+ alignItems: 'center',
60
+ justifyContent: 'center',
61
+ }, onClick: () => !this.state.loading && this.askInstance() }, this.state.loading ? (React.createElement(CircularProgress, null)) : typeof this.props.schema.sendFirstByClick === 'boolean' ? (I18n.t('ra_Click to show')) : (this.getText(this.props.schema.sendFirstByClick, this.props.schema.noTranslation))));
62
+ }
48
63
  if (this.state.image === undefined) {
49
64
  return null;
50
65
  }
51
66
  return (React.createElement("img", { alt: "dynamic content", src: this.state.image, style: { width: this.props.schema.width || '100%', height: this.props.schema.height } }));
52
67
  }
53
68
  }
54
- export default ConfigImageSendTo;
55
69
  //# sourceMappingURL=ConfigImageSendTo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigImageSendTo.js","sourceRoot":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OAAO,CACH,6BACI,GAAG,EAAC,iBAAiB,EACrB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACrB,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GACvF,CACL,CAAC;IACN,CAAC;CACJ;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport type { ConfigItemImageSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigImageSendToProps extends ConfigGenericProps {\n schema: ConfigItemImageSendTo;\n}\n\ninterface ConfigImageSendToState extends ConfigGenericState {\n image?: string;\n}\n\nclass ConfigImageSendTo extends ConfigGeneric<ConfigImageSendToProps, ConfigImageSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n componentDidMount(): void {\n super.componentDidMount();\n\n this.askInstance();\n }\n\n askInstance(): void {\n if (this.props.alive) {\n let data = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n if (dataStr) {\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${JSON.stringify(data)}`);\n }\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n\n void this.props.oContext.socket\n .sendTo(\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(image => this.setState({ image: image || '' }));\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n\n return JSON.stringify(localContext);\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n if (this.state.image === undefined) {\n return null;\n }\n\n return (\n <img\n alt=\"dynamic content\"\n src={this.state.image}\n style={{ width: this.props.schema.width || '100%', height: this.props.schema.height }}\n />\n );\n }\n}\n\nexport default ConfigImageSendTo;\n"]}
1
+ {"version":3,"file":"ConfigImageSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigImageSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAWlG,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,aAA6D;IAChG,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,CAAqB;IAEzC,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;YACtC,IAAI,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC;IACL,CAAC;IAED,WAAW;QACP,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACnB,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;YAClC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACnD,MAAM,OAAO,GAAW,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAChF,IAAI,OAAO,EAAE,CAAC;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MAAM,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,CAC1D,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAC7B,CAAC,CAAC,CAAC,CACA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CACpF,CACC,CACT,CAAC;QACN,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,CACH,6BACI,GAAG,EAAC,iBAAiB,EACrB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACrB,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GACvF,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { CircularProgress } from '@mui/material';\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemImageSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigImageSendToProps extends ConfigGenericProps {\n schema: ConfigItemImageSendTo;\n}\n\ninterface ConfigImageSendToState extends ConfigGenericState {\n image?: string;\n loading?: boolean;\n}\n\nexport default class ConfigImageSendTo extends ConfigGeneric<ConfigImageSendToProps, ConfigImageSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n componentDidMount(): void {\n super.componentDidMount();\n\n if (!this.props.schema.sendFirstByClick) {\n this.askInstance();\n }\n }\n\n askInstance(): void {\n if (this.props.alive) {\n let data = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n if (dataStr) {\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${JSON.stringify(data)}`);\n }\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n this.setState({ loading: true }, () =>\n this.props.oContext.socket\n .sendTo(\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(image => this.setState({ image: image || '' })),\n );\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n\n return JSON.stringify(localContext);\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n if (!this.props.schema.sendFirstByClick || this.state.image !== undefined) {\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n }\n this.initialized = true;\n }\n }\n\n if (!this.state.image && this.props.schema.sendFirstByClick) {\n return (\n <div\n style={{\n width: this.props.schema.width || '100%',\n height: this.props.schema.height,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n }}\n onClick={() => !this.state.loading && this.askInstance()}\n >\n {this.state.loading ? (\n <CircularProgress />\n ) : typeof this.props.schema.sendFirstByClick === 'boolean' ? (\n I18n.t('ra_Click to show')\n ) : (\n this.getText(this.props.schema.sendFirstByClick, this.props.schema.noTranslation)\n )}\n </div>\n );\n }\n\n if (this.state.image === undefined) {\n return null;\n }\n\n return (\n <img\n alt=\"dynamic content\"\n src={this.state.image}\n style={{ width: this.props.schema.width || '100%', height: this.props.schema.height }}\n />\n );\n }\n}\n"]}
@@ -61,6 +61,7 @@ import ConfigUUID from './ConfigUUID';
61
61
  import ConfigUser from './ConfigUser';
62
62
  import ConfigYamlEditor from './ConfigYamlEditor';
63
63
  import ConfigQrCode from './ConfigQrCode';
64
+ import ConfigQrCodeSendTo from './ConfigQrCodeSendTo';
64
65
  const components = {
65
66
  accordion: ConfigAccordion,
66
67
  alive: ConfigAlive,
@@ -103,6 +104,7 @@ const components = {
103
104
  pattern: ConfigPattern,
104
105
  port: ConfigPort,
105
106
  qrCode: ConfigQrCode,
107
+ qrCodeSendTo: ConfigQrCodeSendTo,
106
108
  room: ConfigRoom,
107
109
  select: ConfigSelect,
108
110
  selectSendTo: ConfigSelectSendTo,
@@ -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,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,iBAA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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","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 ConfigCheckDocker from './ConfigCheckDocker';\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 ConfigIFrame from './ConfigIFrame';\nimport ConfigIFrameSendTo from './ConfigIFrameSendTo';\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 ConfigYamlEditor from './ConfigYamlEditor';\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 checkDocker: ConfigCheckDocker,\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 iframe: ConfigIFrame,\n iframeSendTo: ConfigIFrameSendTo,\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 yamlEditor: ConfigYamlEditor,\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\nexport default class 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 onHiddenChanged={this.props.onHiddenChanged}\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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AM,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","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 ConfigCheckDocker from './ConfigCheckDocker';\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 ConfigIFrame from './ConfigIFrame';\nimport ConfigIFrameSendTo from './ConfigIFrameSendTo';\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 ConfigYamlEditor from './ConfigYamlEditor';\nimport ConfigQrCode from './ConfigQrCode';\nimport ConfigQrCodeSendTo from './ConfigQrCodeSendTo';\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 checkDocker: ConfigCheckDocker,\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 iframe: ConfigIFrame,\n iframeSendTo: ConfigIFrameSendTo,\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 qrCodeSendTo: ConfigQrCodeSendTo,\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 yamlEditor: ConfigYamlEditor,\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\nexport default class 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 onHiddenChanged={this.props.onHiddenChanged}\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"]}
@@ -8,8 +8,8 @@ interface ConfigQrCodeProps extends ConfigGenericProps {
8
8
  interface ConfigQrCodeState extends ConfigGenericState {
9
9
  QRCode: typeof QRCode | null;
10
10
  }
11
- declare class ConfigQrCode extends ConfigGeneric<ConfigQrCodeProps, ConfigQrCodeState> {
11
+ export default class ConfigQrCode extends ConfigGeneric<ConfigQrCodeProps, ConfigQrCodeState> {
12
12
  componentDidMount(): Promise<void>;
13
13
  renderItem(): JSX.Element | null;
14
14
  }
15
- export default ConfigQrCode;
15
+ export {};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import ConfigGeneric from './ConfigGeneric';
3
- class ConfigQrCode extends ConfigGeneric {
3
+ export default class ConfigQrCode extends ConfigGeneric {
4
4
  async componentDidMount() {
5
5
  super.componentDidMount();
6
6
  // lazy load of qrcode
@@ -15,5 +15,4 @@ class ConfigQrCode extends ConfigGeneric {
15
15
  return (React.createElement(QRCodeComponent, { value: this.props.schema.data, size: this.props.schema.size, fgColor: this.props.schema.fgColor, bgColor: this.props.schema.bgColor, level: this.props.schema.level }));
16
16
  }
17
17
  }
18
- export default ConfigQrCode;
19
18
  //# sourceMappingURL=ConfigQrCode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigQrCode.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigQrCode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAUlG,MAAM,YAAa,SAAQ,aAAmD;IAC1E,KAAK,CAAC,iBAAiB;QACnB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,sBAAsB;QACtB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,UAAU;QACN,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAC1C,IAAI,CAAC,eAAe,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,CACH,oBAAC,eAAe,IACZ,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAC7B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAC5B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAChC,CACL,CAAC;IACN,CAAC;CACJ;AAED,eAAe,YAAY,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport type QRCode from 'react-qr-code';\nimport type { ConfigItemQrCode } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigQrCodeProps extends ConfigGenericProps {\n schema: ConfigItemQrCode;\n}\n\ninterface ConfigQrCodeState extends ConfigGenericState {\n QRCode: typeof QRCode | null;\n}\n\nclass ConfigQrCode extends ConfigGeneric<ConfigQrCodeProps, ConfigQrCodeState> {\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n // lazy load of qrcode\n const module = await import('react-qr-code');\n this.setState({ QRCode: module.default });\n }\n\n renderItem(): JSX.Element | null {\n const QRCodeComponent = this.state.QRCode;\n if (!QRCodeComponent) {\n return null;\n }\n return (\n <QRCodeComponent\n value={this.props.schema.data}\n size={this.props.schema.size}\n fgColor={this.props.schema.fgColor}\n bgColor={this.props.schema.bgColor}\n level={this.props.schema.level}\n />\n );\n }\n}\n\nexport default ConfigQrCode;\n"]}
1
+ {"version":3,"file":"ConfigQrCode.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigQrCode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAUlG,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,aAAmD;IACzF,KAAK,CAAC,iBAAiB;QACnB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,sBAAsB;QACtB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,UAAU;QACN,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAC1C,IAAI,CAAC,eAAe,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,CACH,oBAAC,eAAe,IACZ,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAC7B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAC5B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAChC,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport type QRCode from 'react-qr-code';\nimport type { ConfigItemQrCode } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigQrCodeProps extends ConfigGenericProps {\n schema: ConfigItemQrCode;\n}\n\ninterface ConfigQrCodeState extends ConfigGenericState {\n QRCode: typeof QRCode | null;\n}\n\nexport default class ConfigQrCode extends ConfigGeneric<ConfigQrCodeProps, ConfigQrCodeState> {\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n // lazy load of qrcode\n const module = await import('react-qr-code');\n this.setState({ QRCode: module.default });\n }\n\n renderItem(): JSX.Element | null {\n const QRCodeComponent = this.state.QRCode;\n if (!QRCodeComponent) {\n return null;\n }\n return (\n <QRCodeComponent\n value={this.props.schema.data}\n size={this.props.schema.size}\n fgColor={this.props.schema.fgColor}\n bgColor={this.props.schema.bgColor}\n level={this.props.schema.level}\n />\n );\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { type JSX } from 'react';
2
+ import type QRCode from 'react-qr-code';
3
+ import type { ConfigItemQrCodeSendTo } from '../types';
4
+ import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
5
+ interface ConfigQrCodeSendToProps extends ConfigGenericProps {
6
+ schema: ConfigItemQrCodeSendTo;
7
+ }
8
+ interface ConfigQrCodeSendToState extends ConfigGenericState {
9
+ qrData?: string;
10
+ loading?: boolean;
11
+ QRCode: typeof QRCode | null;
12
+ }
13
+ export default class ConfigQrCodeSendTo extends ConfigGeneric<ConfigQrCodeSendToProps, ConfigQrCodeSendToState> {
14
+ private initialized;
15
+ private localContext;
16
+ componentDidMount(): Promise<void>;
17
+ askInstance(): void;
18
+ getContext(): string;
19
+ renderItem(): JSX.Element | null;
20
+ }
21
+ export {};
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import { CircularProgress } from '@mui/material';
3
+ import { I18n } from '@iobroker/adapter-react-v5';
4
+ import ConfigGeneric from './ConfigGeneric';
5
+ export default class ConfigQrCodeSendTo extends ConfigGeneric {
6
+ initialized = false;
7
+ localContext;
8
+ async componentDidMount() {
9
+ super.componentDidMount();
10
+ const module = await import('react-qr-code');
11
+ this.setState({ QRCode: module.default });
12
+ if (!this.props.schema.sendFirstByClick) {
13
+ this.askInstance();
14
+ }
15
+ }
16
+ askInstance() {
17
+ if (this.props.alive) {
18
+ let data = this.props.schema.data;
19
+ if (data === undefined && this.props.schema.jsonData) {
20
+ const dataStr = this.getPattern(this.props.schema.jsonData, null, true);
21
+ if (dataStr) {
22
+ try {
23
+ data = JSON.parse(dataStr);
24
+ }
25
+ catch {
26
+ console.error(`Cannot parse json data: ${JSON.stringify(data)}`);
27
+ }
28
+ }
29
+ }
30
+ if (data === undefined) {
31
+ data = null;
32
+ }
33
+ this.setState({ loading: true }, () => this.props.oContext.socket
34
+ .sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
35
+ .then(qrData => this.setState({ qrData: qrData || '', loading: false })));
36
+ }
37
+ }
38
+ getContext() {
39
+ const localContext = {};
40
+ if (Array.isArray(this.props.schema.alsoDependsOn)) {
41
+ this.props.schema.alsoDependsOn.forEach(attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)));
42
+ }
43
+ return JSON.stringify(localContext);
44
+ }
45
+ renderItem() {
46
+ if (this.props.alive) {
47
+ const localContext = this.getContext();
48
+ if (localContext !== this.localContext || !this.initialized) {
49
+ this.localContext = localContext;
50
+ if (!this.props.schema.sendFirstByClick || this.state.qrData !== undefined) {
51
+ setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);
52
+ }
53
+ this.initialized = true;
54
+ }
55
+ }
56
+ if (!this.state.qrData && this.props.schema.sendFirstByClick) {
57
+ return (React.createElement("div", { style: {
58
+ width: '100%',
59
+ display: 'flex',
60
+ alignItems: 'center',
61
+ justifyContent: 'center',
62
+ }, onClick: () => !this.state.loading && this.askInstance() }, this.state.loading ? (React.createElement(CircularProgress, null)) : typeof this.props.schema.sendFirstByClick === 'boolean' ? (I18n.t('ra_Click to show')) : (this.getText(this.props.schema.sendFirstByClick, this.props.schema.noTranslation))));
63
+ }
64
+ const QRCodeComponent = this.state.QRCode;
65
+ if (!QRCodeComponent || this.state.qrData === undefined) {
66
+ return null;
67
+ }
68
+ return (React.createElement(QRCodeComponent, { value: this.state.qrData, size: this.props.schema.size, fgColor: this.props.schema.fgColor, bgColor: this.props.schema.bgColor, level: this.props.schema.level }));
69
+ }
70
+ }
71
+ //# sourceMappingURL=ConfigQrCodeSendTo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigQrCodeSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigQrCodeSendTo.tsx"],"names":[],"mappings":"AAAA,O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CAAC,MAAM,CAAC;QAC1C,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACtD,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,CACH,oBAAC,eAAe,IACZ,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACxB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAC5B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAChC,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { CircularProgress } from '@mui/material';\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type QRCode from 'react-qr-code';\nimport type { ConfigItemQrCodeSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigQrCodeSendToProps extends ConfigGenericProps {\n schema: ConfigItemQrCodeSendTo;\n}\n\ninterface ConfigQrCodeSendToState extends ConfigGenericState {\n qrData?: string;\n loading?: boolean;\n QRCode: typeof QRCode | null;\n}\n\nexport default class ConfigQrCodeSendTo extends ConfigGeneric<ConfigQrCodeSendToProps, ConfigQrCodeSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n const module = await import('react-qr-code');\n this.setState({ QRCode: module.default });\n if (!this.props.schema.sendFirstByClick) {\n this.askInstance();\n }\n }\n\n askInstance(): void {\n if (this.props.alive) {\n let data = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n if (dataStr) {\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${JSON.stringify(data)}`);\n }\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n this.setState({ loading: true }, () =>\n this.props.oContext.socket\n .sendTo(\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(qrData => this.setState({ qrData: qrData || '', loading: false })),\n );\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n\n return JSON.stringify(localContext);\n }\n\n renderItem(): JSX.Element | null {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n if (!this.props.schema.sendFirstByClick || this.state.qrData !== undefined) {\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n }\n this.initialized = true;\n }\n }\n\n if (!this.state.qrData && this.props.schema.sendFirstByClick) {\n return (\n <div\n style={{\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n }}\n onClick={() => !this.state.loading && this.askInstance()}\n >\n {this.state.loading ? (\n <CircularProgress />\n ) : typeof this.props.schema.sendFirstByClick === 'boolean' ? (\n I18n.t('ra_Click to show')\n ) : (\n this.getText(this.props.schema.sendFirstByClick, this.props.schema.noTranslation)\n )}\n </div>\n );\n }\n\n const QRCodeComponent = this.state.QRCode;\n if (!QRCodeComponent || this.state.qrData === undefined) {\n return null;\n }\n\n return (\n <QRCodeComponent\n value={this.state.qrData}\n size={this.props.schema.size}\n fgColor={this.props.schema.fgColor}\n bgColor={this.props.schema.bgColor}\n level={this.props.schema.level}\n />\n );\n }\n}\n"]}
@@ -420,7 +420,15 @@ class ConfigState extends ConfigGeneric {
420
420
  : this.state.obj.common.max
421
421
  : this.props.schema.max;
422
422
  const step = this.props.schema.step === undefined ? this.state.obj.common.step || 1 : this.props.schema.step;
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) => {
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) => {
424
+ let displayValue = this.props.schema.digits !== undefined
425
+ ? value.toFixed(this.props.schema.digits)
426
+ : value.toString();
427
+ if (this.props.oContext.isFloatComma) {
428
+ displayValue = displayValue.replace('.', ',');
429
+ }
430
+ return `${displayValue}${this.getText(this.props.schema.unit, this.props.schema.noTranslation) || this.state.obj.common.unit || ''}`;
431
+ }, onChange: (_e, value) => {
424
432
  this.setState({ stateValue: value }, () => {
425
433
  if (this.controlTimeout) {
426
434
  clearTimeout(this.controlTimeout);
@@ -546,7 +554,15 @@ class ConfigState extends ConfigGeneric {
546
554
  key = value;
547
555
  }
548
556
  else {
549
- value = mappedValue.toString();
557
+ if (this.props.schema.digits !== undefined && typeof mappedValue === 'number') {
558
+ value = mappedValue.toFixed(this.props.schema.digits);
559
+ if (this.props.oContext.isFloatComma) {
560
+ value = value.replace('.', ',');
561
+ }
562
+ }
563
+ else {
564
+ value = mappedValue.toString();
565
+ }
550
566
  key = value;
551
567
  }
552
568
  content = (React.createElement("div", { style: divStyle },