@iobroker/json-config 8.1.10 → 8.2.1
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 +45 -8
- package/build/JsonConfigComponent/ConfigCheckDocker.d.ts +3 -3
- package/build/JsonConfigComponent/ConfigCheckDocker.js +3 -4
- package/build/JsonConfigComponent/ConfigCheckDocker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.d.ts +3 -2
- package/build/JsonConfigComponent/ConfigImageSendTo.js +17 -5
- package/build/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPanel.js +2 -0
- package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/build/JsonConfigComponent/ConfigQrCode.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigQrCode.js +1 -2
- package/build/JsonConfigComponent/ConfigQrCode.js.map +1 -1
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.d.ts +21 -0
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js +69 -0
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js.map +1 -0
- package/build/JsonConfigComponent/ConfigSendto.js +2 -2
- package/build/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/build/JsonConfigComponent/ConfigState.js +18 -2
- package/build/JsonConfigComponent/ConfigState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTable.js +2 -2
- package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/build/JsonConfigComponent/wrapper/Components/CustomModal.js +3 -3
- package/build/JsonConfigComponent/wrapper/Components/CustomModal.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js.map +1 -1
- package/build/types.d.ts +24 -3
- package/package.json +7 -7
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
|
|
918
|
-
|
|
919
|
-
| `width`
|
|
920
|
-
| `height`
|
|
921
|
-
| `command`
|
|
922
|
-
| `jsonData`
|
|
923
|
-
| `data`
|
|
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,7 +1708,13 @@ The schema is used here: https://github.com/SchemaStore/schemastore/blob/6da29cd
|
|
|
1677
1708
|
### **WORK IN PROGRESS**
|
|
1678
1709
|
-->
|
|
1679
1710
|
## Changelog
|
|
1680
|
-
### 8.1
|
|
1711
|
+
### 8.2.1 (2026-03-02)
|
|
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
|
+
|
|
1717
|
+
### 8.1.11 (2026-02-12)
|
|
1681
1718
|
- (@GermanBluefox) Added the copy-to-clipboard dialog for `sendTo`
|
|
1682
1719
|
|
|
1683
1720
|
### 8.1.9 (2026-02-10)
|
|
@@ -9,8 +9,8 @@ interface ConfigCheckDockerState extends ConfigGenericState {
|
|
|
9
9
|
interface ConfigCheckDockerProps extends ConfigGenericProps {
|
|
10
10
|
schema: ConfigItemCheckDocker;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
export default class ConfigCheckDocker extends ConfigGeneric<ConfigCheckDockerProps, ConfigCheckDockerState> {
|
|
13
13
|
componentDidMount(): Promise<void>;
|
|
14
|
-
renderItem(
|
|
14
|
+
renderItem(_error: unknown, disabled: boolean): JSX.Element;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export {};
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { FormControlLabel, Checkbox, FormHelperText, FormControl, CircularProgress } from '@mui/material';
|
|
3
3
|
import { I18n } from '@iobroker/adapter-react-v5';
|
|
4
4
|
import ConfigGeneric from './ConfigGeneric';
|
|
5
|
-
// Send to admin message to check if the docker available and if available, show checkbox, else show warning if specified in the schema
|
|
6
|
-
class ConfigCheckDocker extends ConfigGeneric {
|
|
5
|
+
// Send to an admin message to check if the docker available and if available, show checkbox, else show warning if specified in the schema
|
|
6
|
+
export default class ConfigCheckDocker extends ConfigGeneric {
|
|
7
7
|
async componentDidMount() {
|
|
8
8
|
super.componentDidMount();
|
|
9
9
|
const id = await this.props.oContext.socket.getCurrentInstance();
|
|
@@ -20,7 +20,7 @@ class ConfigCheckDocker extends ConfigGeneric {
|
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
renderItem(
|
|
23
|
+
renderItem(_error, disabled) {
|
|
24
24
|
const value = ConfigGeneric.getValue(this.props.data, this.props.attr);
|
|
25
25
|
if (this.state.requesting) {
|
|
26
26
|
return React.createElement(CircularProgress, null);
|
|
@@ -48,5 +48,4 @@ class ConfigCheckDocker extends ConfigGeneric {
|
|
|
48
48
|
this.props.schema.help ? (React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation))) : null));
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
export default ConfigCheckDocker;
|
|
52
51
|
//# sourceMappingURL=ConfigCheckDocker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigCheckDocker.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigCheckDocker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE1G,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAYlG,
|
|
1
|
+
{"version":3,"file":"ConfigCheckDocker.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigCheckDocker.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AC,MAAM,CAAC,OAAO,CAAC,CAAC;oBAC1D,CAAC,EACD,QAAQ,EAAE,QAAQ,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,GAC5D,EAEN,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAC9C;YACD,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAC9B,oBAAC,cAAc,QACV,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CACxD,CACpB,CAAC,CAAC,CAAC,IAAI;YACP,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 { FormControlLabel, Checkbox, FormHelperText, FormControl, CircularProgress } from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemCheckDocker } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigCheckDockerState extends ConfigGenericState {\n version: string;\n errorDocker: string;\n requesting: boolean;\n}\n\ninterface ConfigCheckDockerProps extends ConfigGenericProps {\n schema: ConfigItemCheckDocker;\n}\n\n// Send to an admin message to check if the docker available and if available, show checkbox, else show warning if specified in the schema\nexport default class ConfigCheckDocker extends ConfigGeneric<ConfigCheckDockerProps, ConfigCheckDockerState> {\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n const id = await this.props.oContext.socket.getCurrentInstance();\n this.setState({ requesting: true }, async () => {\n const result: {\n version?: string;\n daemonRunning?: boolean;\n } = await this.props.oContext.socket.sendTo(id, 'checkDocker', null);\n this.setState({\n requesting: false,\n version: result?.version || '',\n errorDocker: result\n ? !result.daemonRunning\n ? I18n.t('ra_Docker is not installed or not running')\n : ''\n : I18n.t('ra_No response from admin'),\n });\n });\n }\n\n renderItem(_error: unknown, disabled: boolean): JSX.Element {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n if (this.state.requesting) {\n return <CircularProgress />;\n }\n if (this.state.errorDocker && !value) {\n return (\n <FormHelperText style={{ color: 'orange' }}>\n {I18n.t('ra_Docker is not available')}: \n {I18n.t(`ra_${this.state.errorDocker}`).replace(/^ra_/, '')}\n </FormHelperText>\n );\n }\n return (\n <FormControl\n style={{ width: '100%' }}\n variant=\"standard\"\n >\n <FormControlLabel\n onClick={e => {\n e.preventDefault();\n e.stopPropagation();\n\n if (!disabled) {\n const mayByPromise = this.onChange(this.props.attr, !value);\n if (mayByPromise instanceof Promise) {\n void mayByPromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }\n }}\n control={\n <Checkbox\n checked={!!value}\n onChange={e => {\n void this.onChange(this.props.attr, e.target.checked);\n }}\n disabled={disabled || (!!this.state.errorDocker && !value)}\n />\n }\n label={this.getText(this.props.schema.label)}\n />\n {!this.props.schema.hideVersion ? (\n <FormHelperText>\n {this.state.errorDocker ? this.state.errorDocker : this.state.version}\n </FormHelperText>\n ) : null}\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"]}
|
|
@@ -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
|
-
|
|
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
|
|
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.
|
|
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
|
-
|
|
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() {
|
|
@@ -45,11 +49,19 @@ class ConfigImageSendTo extends ConfigGeneric {
|
|
|
45
49
|
this.initialized = true;
|
|
46
50
|
}
|
|
47
51
|
}
|
|
52
|
+
if (!this.state.image && this.props.schema.sendFirstByClick) {
|
|
53
|
+
return (React.createElement("div", { style: {
|
|
54
|
+
width: this.props.schema.width || '100%',
|
|
55
|
+
height: this.props.schema.height,
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
}, 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))));
|
|
60
|
+
}
|
|
48
61
|
if (this.state.image === undefined) {
|
|
49
62
|
return null;
|
|
50
63
|
}
|
|
51
64
|
return (React.createElement("img", { alt: "dynamic content", src: this.state.image, style: { width: this.props.schema.width || '100%', height: this.props.schema.height } }));
|
|
52
65
|
}
|
|
53
66
|
}
|
|
54
|
-
export default ConfigImageSendTo;
|
|
55
67
|
//# sourceMappingURL=ConfigImageSendTo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigImageSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigImageSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
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,CAA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'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 setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\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;A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M,CAAC,OAAO,EACxC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAC/B,IAEA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAC9B,CACN,CACT,CAAC;QACN,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAG,CACT,oBAAC,KAAK,IACF,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EACnC,IAAI,EAAE;oBACF,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;iBAC7B,EACD,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,IAE/E,OAAO,CACJ,CACX,CAAC;YAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,OAAO,CACH;oBACI,6BAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAI;oBAC/C,IAAI,CACN,CACN,CAAC;YACN,CAAC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ","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 content;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigPanel.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,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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C;YAC1B,MAAM,IAAI,GAAG,CACT,oBAAC,KAAK,IACF,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EACnC,IAAI,EAAE;oBACF,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;oBAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,SAAS;iBAC7B,EACD,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,IAE/E,OAAO,CACJ,CACX,CAAC;YAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,OAAO,CACH;oBACI,6BAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAI;oBAC/C,IAAI,CACN,CACN,CAAC;YACN,CAAC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ","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
|
-
|
|
11
|
+
export default class ConfigQrCode extends ConfigGeneric<ConfigQrCodeProps, ConfigQrCodeState> {
|
|
12
12
|
componentDidMount(): Promise<void>;
|
|
13
13
|
renderItem(): JSX.Element | null;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
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;
|
|
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,69 @@
|
|
|
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
|
+
setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);
|
|
51
|
+
this.initialized = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (!this.state.qrData && this.props.schema.sendFirstByClick) {
|
|
55
|
+
return (React.createElement("div", { style: {
|
|
56
|
+
width: '100%',
|
|
57
|
+
display: 'flex',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
justifyContent: 'center',
|
|
60
|
+
}, 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))));
|
|
61
|
+
}
|
|
62
|
+
const QRCodeComponent = this.state.QRCode;
|
|
63
|
+
if (!QRCodeComponent || this.state.qrData === undefined) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
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 }));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=ConfigQrCodeSendTo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigQrCodeSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigQrCodeSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CA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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 setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\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"]}
|
|
@@ -160,9 +160,9 @@ export default class ConfigSendto extends ConfigGeneric {
|
|
|
160
160
|
}, onApply: () => {
|
|
161
161
|
// Copy to clipboard
|
|
162
162
|
copy(this.state._copyDialog.text);
|
|
163
|
-
window.alert(I18n.t('ra_Copied
|
|
163
|
+
window.alert(I18n.t('ra_Copied'));
|
|
164
164
|
this.setState({ _copyDialog: null });
|
|
165
|
-
} },
|
|
165
|
+
}, titleButtonApply: I18n.t('ra_Copy content') },
|
|
166
166
|
React.createElement("div", { style: { width: 'calc(100vw - 40px)', height: 'calc(100vh - 188px)' } },
|
|
167
167
|
React.createElement(Editor, { mode: this.state._copyDialog.type, value: this.state._copyDialog.text, name: "CopyDialog", themeType: this.props.oContext.themeType }))));
|
|
168
168
|
}
|