@iobroker/json-config 7.0.1 → 7.0.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/build/JsonConfig.d.ts +45 -5
- package/build/JsonConfig.js +13 -14
- package/build/JsonConfig.js.map +1 -1
- package/build/JsonConfigComponent/ChipInput.d.ts +78 -12
- package/build/JsonConfigComponent/ChipInput.js +47 -31
- package/build/JsonConfigComponent/ChipInput.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAccordion.d.ts +21 -3
- package/build/JsonConfigComponent/ConfigAccordion.js +24 -21
- package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAlive.d.ts +11 -3
- package/build/JsonConfigComponent/ConfigAlive.js +3 -4
- package/build/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocomplete.d.ts +6 -3
- package/build/JsonConfigComponent/ConfigAutocomplete.js +2 -8
- package/build/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +12 -3
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +2 -8
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCRON.d.ts +13 -14
- package/build/JsonConfigComponent/ConfigCRON.js +9 -23
- package/build/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertCollection.d.ts +9 -3
- package/build/JsonConfigComponent/ConfigCertCollection.js +2 -9
- package/build/JsonConfigComponent/ConfigCertCollection.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertificateSelect.d.ts +12 -3
- package/build/JsonConfigComponent/ConfigCertificateSelect.js +2 -8
- package/build/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertificates.d.ts +21 -3
- package/build/JsonConfigComponent/ConfigCertificates.js +6 -7
- package/build/JsonConfigComponent/ConfigCertificates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckLicense.d.ts +39 -2
- package/build/JsonConfigComponent/ConfigCheckLicense.js +23 -24
- package/build/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckbox.d.ts +5 -3
- package/build/JsonConfigComponent/ConfigCheckbox.js +3 -9
- package/build/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
- package/build/JsonConfigComponent/ConfigChip.d.ts +10 -13
- package/build/JsonConfigComponent/ConfigChip.js +12 -24
- package/build/JsonConfigComponent/ConfigChip.js.map +1 -1
- package/build/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.d.ts +13 -4
- package/build/JsonConfigComponent/ConfigCoordinates.js +4 -5
- package/build/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCustom.d.ts +6 -6
- package/build/JsonConfigComponent/ConfigCustom.js +5 -8
- package/build/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFile.d.ts +19 -14
- package/build/JsonConfigComponent/ConfigFile.js +12 -23
- package/build/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFileSelector.d.ts +49 -2
- package/build/JsonConfigComponent/ConfigFileSelector.js +29 -37
- package/build/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFunc.d.ts +17 -13
- package/build/JsonConfigComponent/ConfigFunc.js +3 -21
- package/build/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.d.ts +7 -8
- package/build/JsonConfigComponent/ConfigGeneric.js +21 -5
- package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIP.d.ts +18 -13
- package/build/JsonConfigComponent/ConfigIP.js +6 -22
- package/build/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.d.ts +16 -9
- package/build/JsonConfigComponent/ConfigImageSendTo.js +11 -23
- package/build/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageUpload.d.ts +18 -13
- package/build/JsonConfigComponent/ConfigImageUpload.js +6 -27
- package/build/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInstanceSelect.d.ts +19 -13
- package/build/JsonConfigComponent/ConfigInstanceSelect.js +7 -23
- package/build/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInterface.d.ts +16 -13
- package/build/JsonConfigComponent/ConfigInterface.js +7 -23
- package/build/JsonConfigComponent/ConfigInterface.js.map +1 -1
- package/build/JsonConfigComponent/ConfigJsonEditor.d.ts +14 -12
- package/build/JsonConfigComponent/ConfigJsonEditor.js +11 -23
- package/build/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLanguage.d.ts +15 -3
- package/build/JsonConfigComponent/ConfigLanguage.js +2 -8
- package/build/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/build/JsonConfigComponent/ConfigLicense.d.ts +19 -21
- package/build/JsonConfigComponent/ConfigLicense.js +8 -17
- package/build/JsonConfigComponent/ConfigLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigNumber.d.ts +15 -3
- package/build/JsonConfigComponent/ConfigNumber.js +3 -4
- package/build/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.d.ts +14 -16
- package/build/JsonConfigComponent/ConfigObjectId.js +9 -28
- package/build/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPanel.d.ts +11 -3
- package/build/JsonConfigComponent/ConfigPanel.js +31 -35
- package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPassword.d.ts +16 -13
- package/build/JsonConfigComponent/ConfigPassword.js +10 -23
- package/build/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPattern.d.ts +8 -19
- package/build/JsonConfigComponent/ConfigPattern.js +2 -14
- package/build/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPort.d.ts +23 -3
- package/build/JsonConfigComponent/ConfigPort.js +2 -10
- package/build/JsonConfigComponent/ConfigPort.js.map +1 -1
- package/build/JsonConfigComponent/ConfigRoom.d.ts +17 -13
- package/build/JsonConfigComponent/ConfigRoom.js +4 -22
- package/build/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelect.d.ts +19 -13
- package/build/JsonConfigComponent/ConfigSelect.js +22 -24
- package/build/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.d.ts +17 -3
- package/build/JsonConfigComponent/ConfigSelectSendTo.js +7 -7
- package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSendto.d.ts +16 -3
- package/build/JsonConfigComponent/ConfigSendto.js +3 -9
- package/build/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSetState.d.ts +11 -17
- package/build/JsonConfigComponent/ConfigSetState.js +8 -25
- package/build/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSlider.d.ts +14 -13
- package/build/JsonConfigComponent/ConfigSlider.js +8 -21
- package/build/JsonConfigComponent/ConfigSlider.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticDivider.d.ts +9 -13
- package/build/JsonConfigComponent/ConfigStaticDivider.js +16 -27
- package/build/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticHeader.d.ts +9 -13
- package/build/JsonConfigComponent/ConfigStaticHeader.js +14 -26
- package/build/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticImage.d.ts +9 -13
- package/build/JsonConfigComponent/ConfigStaticImage.js +4 -23
- package/build/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticText.d.ts +9 -13
- package/build/JsonConfigComponent/ConfigStaticText.js +10 -23
- package/build/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTable.d.ts +54 -3
- package/build/JsonConfigComponent/ConfigTable.js +51 -44
- package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTabs.d.ts +9 -3
- package/build/JsonConfigComponent/ConfigTabs.js +17 -7
- package/build/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/build/JsonConfigComponent/ConfigText.d.ts +13 -3
- package/build/JsonConfigComponent/ConfigText.js +4 -5
- package/build/JsonConfigComponent/ConfigText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.d.ts +12 -3
- package/build/JsonConfigComponent/ConfigTextSendTo.js +2 -3
- package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTimePicker.js +1 -1
- package/build/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTopic.d.ts +10 -16
- package/build/JsonConfigComponent/ConfigTopic.js +5 -31
- package/build/JsonConfigComponent/ConfigTopic.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUser.d.ts +17 -13
- package/build/JsonConfigComponent/ConfigUser.js +7 -23
- package/build/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/build/JsonConfigComponent/index.d.ts +7 -8
- package/build/JsonConfigComponent/index.js +11 -7
- package/build/JsonConfigComponent/index.js.map +1 -1
- package/build/JsonConfigComponent/wrapper/Components/CustomModal.d.ts +22 -2
- package/build/JsonConfigComponent/wrapper/Components/CustomModal.js +14 -42
- package/build/JsonConfigComponent/wrapper/Components/CustomModal.js.map +1 -1
- package/build/JsonConfigComponent/wrapper/Components/Editor.d.ts +13 -2
- package/build/JsonConfigComponent/wrapper/Components/Editor.js +2 -3
- package/build/JsonConfigComponent/wrapper/Components/Editor.js.map +1 -1
- package/build/Utils.d.ts +2 -1
- package/build/Utils.js +31 -0
- package/build/Utils.js.map +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/types.d.ts +278 -7
- package/package.json +3 -3
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { withStyles } from '@mui/styles';
|
|
4
2
|
import { InputLabel, TextField, FormHelperText, MenuItem, FormControl, Select, } from '@mui/material';
|
|
5
3
|
import { I18n } from '@iobroker/adapter-react-v5';
|
|
6
|
-
import ConfigGeneric from './ConfigGeneric';
|
|
7
|
-
const styles = () => ({
|
|
8
|
-
fullWidth: {
|
|
9
|
-
width: '100%',
|
|
10
|
-
},
|
|
11
|
-
});
|
|
4
|
+
import ConfigGeneric, {} from './ConfigGeneric';
|
|
12
5
|
class ConfigIP extends ConfigGeneric {
|
|
13
6
|
componentDidMount() {
|
|
14
7
|
super.componentDidMount();
|
|
@@ -25,6 +18,7 @@ class ConfigIP extends ConfigGeneric {
|
|
|
25
18
|
ips = ips.filter(item => item.family === 'ipv6');
|
|
26
19
|
}
|
|
27
20
|
if (this.props.schema.noInternal) {
|
|
21
|
+
// @ts-expect-error extended in socket-classes
|
|
28
22
|
ips = ips.filter(item => !item.internal);
|
|
29
23
|
}
|
|
30
24
|
ips.forEach(item => {
|
|
@@ -41,24 +35,14 @@ class ConfigIP extends ConfigGeneric {
|
|
|
41
35
|
renderItem(error, disabled /* , defaultValue */) {
|
|
42
36
|
const value = ConfigGeneric.getValue(this.props.data, this.props.attr);
|
|
43
37
|
const item = this.state.ips?.find(it => it.address === value);
|
|
44
|
-
return React.createElement(FormControl, {
|
|
38
|
+
return React.createElement(FormControl, { fullWidth: true, variant: "standard" },
|
|
45
39
|
this.state.ips && this.props.schema.label ? React.createElement(InputLabel, null, this.getText(this.props.schema.label)) : null,
|
|
46
40
|
!this.state.ips ?
|
|
47
41
|
React.createElement(TextField, { fullWidth: true, variant: "standard", error: !!error, disabled: !!disabled, value: value, onChange: e => this.onChange(this.props.attr, e.target.value), label: this.getText(this.props.schema.label) }) :
|
|
48
42
|
React.createElement(Select, { variant: "standard", error: !!error, disabled: !!disabled, value: value, renderValue: val => item?.name || val, onChange: e => this.onChange(this.props.attr, e.target.value) }, this.state.ips?.map((it, i) => React.createElement(MenuItem, { key: i, value: it.address }, it.name))),
|
|
49
|
-
this.props.schema.help ?
|
|
43
|
+
this.props.schema.help ?
|
|
44
|
+
React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
|
|
50
45
|
}
|
|
51
46
|
}
|
|
52
|
-
|
|
53
|
-
socket: PropTypes.object.isRequired,
|
|
54
|
-
themeType: PropTypes.string,
|
|
55
|
-
themeName: PropTypes.string,
|
|
56
|
-
style: PropTypes.object,
|
|
57
|
-
className: PropTypes.string,
|
|
58
|
-
data: PropTypes.object.isRequired,
|
|
59
|
-
schema: PropTypes.object,
|
|
60
|
-
onError: PropTypes.func,
|
|
61
|
-
onChange: PropTypes.func,
|
|
62
|
-
};
|
|
63
|
-
export default withStyles(styles)(ConfigIP);
|
|
47
|
+
export default ConfigIP;
|
|
64
48
|
//# sourceMappingURL=ConfigIP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigIP.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigIP.
|
|
1
|
+
{"version":3,"file":"ConfigIP.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigIP.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACH,UAAU,EACV,SAAS,EACT,cAA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
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, keyof import("./ConfigGeneric").ConfigGenericProps> & Pick<PropTypes.InferProps<{
|
|
2
|
-
socket: PropTypes.Validator<object>;
|
|
3
|
-
data: PropTypes.Validator<object>;
|
|
4
|
-
schema: PropTypes.Requireable<object>;
|
|
5
|
-
adapterName: PropTypes.Requireable<string>;
|
|
6
|
-
instance: PropTypes.Requireable<number>;
|
|
7
|
-
}>, never> & Pick<import("./ConfigGeneric").ConfigGenericProps, "DeviceManager" | "alive" | "arrayIndex" | "attr" | "changeLanguage" | "changed" | "className" | "classes" | "commandRunning" | "common" | "custom" | "customObj" | "customs" | "dateFormat" | "disabled" | "forceUpdate" | "globalData" | "imagePrefix" | "index" | "instanceObj" | "isFloatComma" | "isParentTab" | "multiEdit" | "onChange" | "onCommandRunning" | "onError" | "originalData" | "registerOnForceUpdate" | "systemConfig" | "table" | "themeName" | "themeType">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
|
|
8
|
-
export default _default;
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
1
|
import React from 'react';
|
|
2
|
+
import type { ConfigItemImageSendTo } from '#JC/types';
|
|
3
|
+
import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
|
|
4
|
+
interface ConfigImageSendToProps extends ConfigGenericProps {
|
|
5
|
+
schema: ConfigItemImageSendTo;
|
|
6
|
+
}
|
|
7
|
+
interface ConfigImageSendToState extends ConfigGenericState {
|
|
8
|
+
image?: string;
|
|
9
|
+
context?: string;
|
|
10
|
+
}
|
|
11
|
+
declare class ConfigImageSendTo extends ConfigGeneric<ConfigImageSendToProps, ConfigImageSendToState> {
|
|
12
|
+
componentDidMount(): void;
|
|
13
|
+
askInstance(): void;
|
|
14
|
+
getContext(): string;
|
|
15
|
+
renderItem(): React.JSX.Element;
|
|
16
|
+
}
|
|
17
|
+
export default ConfigImageSendTo;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { withStyles } from '@mui/styles';
|
|
4
|
-
import ConfigGeneric from './ConfigGeneric';
|
|
5
|
-
const styles = () => ({
|
|
6
|
-
fullWidth: {
|
|
7
|
-
width: '100%',
|
|
8
|
-
},
|
|
9
|
-
});
|
|
2
|
+
import ConfigGeneric, {} from './ConfigGeneric';
|
|
10
3
|
class ConfigImageSendTo extends ConfigGeneric {
|
|
11
4
|
componentDidMount() {
|
|
12
5
|
super.componentDidMount();
|
|
@@ -16,12 +9,14 @@ class ConfigImageSendTo extends ConfigGeneric {
|
|
|
16
9
|
if (this.props.alive) {
|
|
17
10
|
let data = this.props.schema.data;
|
|
18
11
|
if (data === undefined && this.props.schema.jsonData) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
const dataStr = this.getPattern(this.props.schema.jsonData);
|
|
13
|
+
if (dataStr) {
|
|
14
|
+
try {
|
|
15
|
+
data = JSON.parse(dataStr);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
console.error(`Cannot parse json data: ${data}`);
|
|
19
|
+
}
|
|
25
20
|
}
|
|
26
21
|
}
|
|
27
22
|
if (data === undefined) {
|
|
@@ -48,15 +43,8 @@ class ConfigImageSendTo extends ConfigGeneric {
|
|
|
48
43
|
setTimeout(() => this.askInstance(), 300);
|
|
49
44
|
}
|
|
50
45
|
}
|
|
51
|
-
return React.createElement("img", {
|
|
46
|
+
return React.createElement("img", { alt: "dynamic content", src: this.state.image, style: { width: this.props.schema.width || '100%', height: this.props.schema.height } });
|
|
52
47
|
}
|
|
53
48
|
}
|
|
54
|
-
|
|
55
|
-
socket: PropTypes.object.isRequired,
|
|
56
|
-
data: PropTypes.object.isRequired,
|
|
57
|
-
schema: PropTypes.object,
|
|
58
|
-
adapterName: PropTypes.string,
|
|
59
|
-
instance: PropTypes.number,
|
|
60
|
-
};
|
|
61
|
-
export default withStyles(styles)(ConfigImageSendTo);
|
|
49
|
+
export default ConfigImageSendTo;
|
|
62
50
|
//# sourceMappingURL=ConfigImageSendTo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigImageSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigImageSendTo.
|
|
1
|
+
{"version":3,"file":"ConfigImageSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigImageSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,aAAa,EAAE,EAAoD,MAAM,iBAAiB,CAAC;AAWlG,MAAM,iBAAkB,SAAQ,aAA6D;IACzF,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,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,CAAC,CAAC;gBACpE,IAAI,OAAO,EAAE,CAAC;oBACV,IAAI,CAAC;wBACD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;oBAC/B,CAAC;oBAAC,OAAO,CAAC,EAAE,CAAC;wBACT,OAAO,CAAC,KAAK,CAAC,2BAA2B,IAAI,EAAE,CAAC,CAAC;oBACrD,CAAC;gBACL,CAAC;YACL,CAAC;YAED,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACrB,IAAI,GAAG,IAAI,CAAC;YAChB,CAAC;Y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QACL,CAAC;QAED,OAAO,6BACH,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,CAAC;IACP,CAAC;CACJ;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
2
|
-
socket: PropTypes.Validator<object>;
|
|
3
|
-
themeType: PropTypes.Requireable<string>;
|
|
4
|
-
themeName: PropTypes.Requireable<string>;
|
|
5
|
-
style: PropTypes.Requireable<object>;
|
|
6
|
-
className: PropTypes.Requireable<string>;
|
|
7
|
-
data: PropTypes.Validator<object>;
|
|
8
|
-
schema: PropTypes.Requireable<object>;
|
|
9
|
-
onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
-
}>, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "image"> & object>;
|
|
12
|
-
export default _default;
|
|
13
|
-
import PropTypes from 'prop-types';
|
|
14
1
|
import React from 'react';
|
|
2
|
+
import type { ConfigItemImageUpload } from '#JC/types';
|
|
3
|
+
import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
|
|
4
|
+
interface ConfigImageUploadProps extends ConfigGenericProps {
|
|
5
|
+
schema: ConfigItemImageUpload;
|
|
6
|
+
}
|
|
7
|
+
interface ConfigImageUploadState extends ConfigGenericState {
|
|
8
|
+
image?: string;
|
|
9
|
+
context?: string;
|
|
10
|
+
}
|
|
11
|
+
declare class ConfigImageUpload extends ConfigGeneric<ConfigImageUploadProps, ConfigImageUploadState> {
|
|
12
|
+
private index;
|
|
13
|
+
constructor(props: ConfigImageUploadProps);
|
|
14
|
+
componentDidMount(): Promise<void>;
|
|
15
|
+
_getUrl(update?: boolean): string;
|
|
16
|
+
loadImage(): void;
|
|
17
|
+
renderItem(error: string, disabled: boolean): React.JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
export default ConfigImageUpload;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { withStyles } from '@mui/styles';
|
|
4
2
|
import { InputLabel, FormHelperText, FormControl, } from '@mui/material';
|
|
5
|
-
import { UploadImage
|
|
6
|
-
import ConfigGeneric from './ConfigGeneric';
|
|
7
|
-
const styles = () => ({
|
|
8
|
-
fullWidth: {
|
|
9
|
-
width: '100%',
|
|
10
|
-
},
|
|
11
|
-
image: {
|
|
12
|
-
width: 100,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
3
|
+
import { UploadImage } from '@iobroker/adapter-react-v5';
|
|
4
|
+
import ConfigGeneric, {} from './ConfigGeneric';
|
|
15
5
|
class ConfigImageUpload extends ConfigGeneric {
|
|
6
|
+
index;
|
|
16
7
|
constructor(props) {
|
|
17
8
|
super(props);
|
|
18
9
|
this.index = Date.now();
|
|
@@ -51,8 +42,7 @@ class ConfigImageUpload extends ConfigGeneric {
|
|
|
51
42
|
.catch(e => console.error(e));
|
|
52
43
|
}
|
|
53
44
|
renderItem(error, disabled /* , defaultValue */) {
|
|
54
|
-
|
|
55
|
-
return React.createElement(FormControl, { className: this.props.classes.fullWidth, variant: "standard" },
|
|
45
|
+
return React.createElement(FormControl, { fullWidth: true, variant: "standard" },
|
|
56
46
|
this.props.schema.label ? React.createElement(InputLabel, { shrink: true }, this.getText(this.props.schema.label)) : null,
|
|
57
47
|
React.createElement(UploadImage, { error: !!error, disabled: disabled, accept: this.props.schema.accept, crop: this.props.schema.crop, maxSize: this.props.schema.maxSize || 256 * 1024, icon: this.state.value || undefined, removeIconFunc: () => this.setState({ value: null }, () => {
|
|
58
48
|
if (this.props.schema.base64) {
|
|
@@ -71,20 +61,9 @@ class ConfigImageUpload extends ConfigGeneric {
|
|
|
71
61
|
}
|
|
72
62
|
// upload file to /instance/attr
|
|
73
63
|
this.props.socket.writeFile64(`${this.props.adapterName}.${this.props.instance}`, this.props.attr, base64);
|
|
74
|
-
})
|
|
64
|
+
}) }),
|
|
75
65
|
this.props.schema.help ? React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
|
|
76
66
|
}
|
|
77
67
|
}
|
|
78
|
-
|
|
79
|
-
socket: PropTypes.object.isRequired,
|
|
80
|
-
themeType: PropTypes.string,
|
|
81
|
-
themeName: PropTypes.string,
|
|
82
|
-
style: PropTypes.object,
|
|
83
|
-
className: PropTypes.string,
|
|
84
|
-
data: PropTypes.object.isRequired,
|
|
85
|
-
schema: PropTypes.object,
|
|
86
|
-
onError: PropTypes.func,
|
|
87
|
-
onChange: PropTypes.func,
|
|
88
|
-
};
|
|
89
|
-
export default withStyles(styles)(ConfigImageUpload);
|
|
68
|
+
export default ConfigImageUpload;
|
|
90
69
|
//# sourceMappingURL=ConfigImageUpload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigImageUpload.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigImageUpload.
|
|
1
|
+
{"version":3,"file":"ConfigImageUpload.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigImageUpload.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACH,UAAU,EACV,cAAc,EACd,WAAW,GACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,OAAO,aAAa,EAAE,EAAoD,MAAM,iBAAiB,CAAC;AAWlG,MAAM,iBAAkB,SAAQ,aAA6D;IACjF,KAAK,CAAS;IAEtB,YAAY,KAA6B;QACr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J;YACD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAC,cAAc,QAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAkB,CAAC,CAAC,CAAC,IAAI,CAC9J,CAAC;IACnB,CAAC;CACJ;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, keyof import("./ConfigGeneric").ConfigGenericProps> & Pick<PropTypes.InferProps<{
|
|
2
|
-
socket: PropTypes.Validator<object>;
|
|
3
|
-
themeType: PropTypes.Requireable<string>;
|
|
4
|
-
themeName: PropTypes.Requireable<string>;
|
|
5
|
-
style: PropTypes.Requireable<object>;
|
|
6
|
-
className: PropTypes.Requireable<string>;
|
|
7
|
-
data: PropTypes.Validator<object>;
|
|
8
|
-
schema: PropTypes.Requireable<object>;
|
|
9
|
-
onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
-
}>, "style"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "DeviceManager" | "adapterName" | "alive" | "arrayIndex" | "attr" | "changeLanguage" | "changed" | "classes" | "commandRunning" | "common" | "custom" | "customObj" | "customs" | "dateFormat" | "disabled" | "forceUpdate" | "globalData" | "imagePrefix" | "index" | "instance" | "instanceObj" | "isFloatComma" | "isParentTab" | "multiEdit" | "onCommandRunning" | "originalData" | "registerOnForceUpdate" | "systemConfig" | "table">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "icon"> & object>;
|
|
12
|
-
export default _default;
|
|
13
|
-
import PropTypes from 'prop-types';
|
|
14
1
|
import React from 'react';
|
|
2
|
+
import type { ConfigItemInstanceSelect } from '#JC/types';
|
|
3
|
+
import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
|
|
4
|
+
interface ConfigInstanceSelectProps extends ConfigGenericProps {
|
|
5
|
+
schema: ConfigItemInstanceSelect;
|
|
6
|
+
}
|
|
7
|
+
interface ConfigInstanceSelectState extends ConfigGenericState {
|
|
8
|
+
selectOptions?: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
}[];
|
|
13
|
+
}
|
|
14
|
+
declare class ConfigInstanceSelect extends ConfigGeneric<ConfigInstanceSelectProps, ConfigInstanceSelectState> {
|
|
15
|
+
componentDidMount(): Promise<void>;
|
|
16
|
+
componentWillUnmount(): void;
|
|
17
|
+
onInstancesUpdate: (id: string, obj?: ioBroker.Object | null) => void;
|
|
18
|
+
renderItem(error: string, disabled: boolean): React.JSX.Element;
|
|
19
|
+
}
|
|
20
|
+
export default ConfigInstanceSelect;
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { withStyles } from '@mui/styles';
|
|
4
2
|
import { InputLabel, MenuItem, FormHelperText, FormControl, Select, } from '@mui/material';
|
|
5
3
|
import { I18n } from '@iobroker/adapter-react-v5';
|
|
6
|
-
import ConfigGeneric from './ConfigGeneric';
|
|
7
|
-
const styles =
|
|
8
|
-
fullWidth: {
|
|
9
|
-
width: '100%',
|
|
10
|
-
},
|
|
4
|
+
import ConfigGeneric, {} from './ConfigGeneric';
|
|
5
|
+
const styles = {
|
|
11
6
|
icon: {
|
|
12
7
|
width: 20,
|
|
13
8
|
height: 20,
|
|
14
9
|
marginRight: 4,
|
|
15
10
|
},
|
|
16
|
-
}
|
|
11
|
+
};
|
|
17
12
|
class ConfigInstanceSelect extends ConfigGeneric {
|
|
18
13
|
async componentDidMount() {
|
|
19
14
|
super.componentDidMount();
|
|
@@ -108,26 +103,15 @@ class ConfigInstanceSelect extends ConfigGeneric {
|
|
|
108
103
|
return null;
|
|
109
104
|
}
|
|
110
105
|
const item = this.state.selectOptions?.find(it => it.value === this.state.value);
|
|
111
|
-
return React.createElement(FormControl, {
|
|
106
|
+
return React.createElement(FormControl, { fullWidth: true, key: this.props.attr, variant: "standard" },
|
|
112
107
|
this.props.schema.label ? React.createElement(InputLabel, { shrink: true }, this.getText(this.props.schema.label)) : null,
|
|
113
108
|
React.createElement(Select, { variant: "standard", error: !!error, displayEmpty: true, disabled: !!disabled, value: this.state.value, renderValue: () => React.createElement("span", { style: { display: 'flex' } },
|
|
114
|
-
item?.icon ? React.createElement("img", { src: `./${item.icon}`, alt: item.value,
|
|
109
|
+
item?.icon ? React.createElement("img", { src: `./${item.icon}`, alt: item.value, style: styles.icon }) : null,
|
|
115
110
|
this.getText(item?.label, true)), onChange: e => this.setState({ value: e.target.value }, () => this.onChange(this.props.attr, this.state.value)) }, this.state.selectOptions.map(it => React.createElement(MenuItem, { key: it.value, value: it.value, style: it.value === ConfigGeneric.NONE_VALUE ? { opacity: 0.5 } : {} },
|
|
116
|
-
it.icon ? React.createElement("img", { src: `./${it.icon}`, alt: it.value,
|
|
111
|
+
it.icon ? React.createElement("img", { src: `./${it.icon}`, alt: it.value, style: styles.icon }) : null,
|
|
117
112
|
this.getText(it.label, true)))),
|
|
118
113
|
this.props.schema.help ? React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
|
|
119
114
|
}
|
|
120
115
|
}
|
|
121
|
-
|
|
122
|
-
socket: PropTypes.object.isRequired,
|
|
123
|
-
themeType: PropTypes.string,
|
|
124
|
-
themeName: PropTypes.string,
|
|
125
|
-
style: PropTypes.object,
|
|
126
|
-
className: PropTypes.string,
|
|
127
|
-
data: PropTypes.object.isRequired,
|
|
128
|
-
schema: PropTypes.object,
|
|
129
|
-
onError: PropTypes.func,
|
|
130
|
-
onChange: PropTypes.func,
|
|
131
|
-
};
|
|
132
|
-
export default withStyles(styles)(ConfigInstanceSelect);
|
|
116
|
+
export default ConfigInstanceSelect;
|
|
133
117
|
//# sourceMappingURL=ConfigInstanceSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigInstanceSelect.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigInstanceSelect.
|
|
1
|
+
{"version":3,"file":"ConfigInstanceSelect.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigInstanceSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACH,UAAU,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,MAAM,GACT,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,aAAa,EAAE,EAAoD,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,IAAI,EAAE;QACF,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,CAAC;KACjB;CACJ,CAAC;AAUF,MAAM,oBAAqB,SAAQ,aAAmE;IAClG,KAAK,CAAC,iBAAiB;QACnB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEvE,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;QACxC,IAAI,OAAO,KAAK,cAAc,EAAE,CAAC;YAC7B,OAAO,GAAG,SAAS,CAAC;QACxB,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC;aAC/C,IAAI,CAAC,KAAK,EAAC,SAAS,EAAC,EA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AC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,GAAI,CAAC,CAAC,CAAC,IAAI;gBAChF,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CACtB,CAAC,CACX;YACR,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAC,cAAc,QAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAkB,CAAC,CAAC,CAAC,IAAI,CAC9J,CAAC;IACnB,CAAC;CACJ;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, keyof import("./ConfigGeneric").ConfigGenericProps> & Pick<PropTypes.InferProps<{
|
|
2
|
-
socket: PropTypes.Validator<object>;
|
|
3
|
-
themeType: PropTypes.Requireable<string>;
|
|
4
|
-
themeName: PropTypes.Requireable<string>;
|
|
5
|
-
style: PropTypes.Requireable<object>;
|
|
6
|
-
className: PropTypes.Requireable<string>;
|
|
7
|
-
data: PropTypes.Validator<object>;
|
|
8
|
-
schema: PropTypes.Requireable<object>;
|
|
9
|
-
onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
-
}>, "style"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "DeviceManager" | "adapterName" | "alive" | "arrayIndex" | "attr" | "changeLanguage" | "changed" | "classes" | "commandRunning" | "common" | "custom" | "customObj" | "customs" | "dateFormat" | "disabled" | "forceUpdate" | "globalData" | "imagePrefix" | "index" | "instance" | "instanceObj" | "isFloatComma" | "isParentTab" | "multiEdit" | "onCommandRunning" | "originalData" | "registerOnForceUpdate" | "systemConfig" | "table">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "address"> & object>;
|
|
12
|
-
export default _default;
|
|
13
|
-
import PropTypes from 'prop-types';
|
|
14
1
|
import React from 'react';
|
|
2
|
+
import type { ConfigItemInterface } from '#JC/types';
|
|
3
|
+
import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
|
|
4
|
+
interface ConfigInterfaceProps extends ConfigGenericProps {
|
|
5
|
+
schema: ConfigItemInterface;
|
|
6
|
+
}
|
|
7
|
+
interface ConfigInterfaceState extends ConfigGenericState {
|
|
8
|
+
interfaces?: {
|
|
9
|
+
value: string;
|
|
10
|
+
address: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
declare class ConfigInterface extends ConfigGeneric<ConfigInterfaceProps, ConfigInterfaceState> {
|
|
14
|
+
componentDidMount(): void;
|
|
15
|
+
renderItem(error: string, disabled: boolean): React.JSX.Element;
|
|
16
|
+
}
|
|
17
|
+
export default ConfigInterface;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { withStyles } from '@mui/styles';
|
|
4
2
|
import { InputLabel, TextField, FormHelperText, MenuItem, FormControl, Select, } from '@mui/material';
|
|
5
|
-
import ConfigGeneric from './ConfigGeneric';
|
|
6
|
-
const styles =
|
|
7
|
-
fullWidth: {
|
|
8
|
-
width: '100%',
|
|
9
|
-
},
|
|
3
|
+
import ConfigGeneric, {} from './ConfigGeneric';
|
|
4
|
+
const styles = {
|
|
10
5
|
address: {
|
|
11
6
|
fontSize: 'smaller',
|
|
12
7
|
opacity: 0.5,
|
|
13
8
|
marginLeft: 8,
|
|
14
9
|
},
|
|
15
|
-
}
|
|
10
|
+
};
|
|
16
11
|
class ConfigInterface extends ConfigGeneric {
|
|
17
12
|
componentDidMount() {
|
|
18
13
|
super.componentDidMount();
|
|
@@ -41,7 +36,7 @@ class ConfigInterface extends ConfigGeneric {
|
|
|
41
36
|
renderItem(error, disabled /* , defaultValue */) {
|
|
42
37
|
const value = ConfigGeneric.getValue(this.props.data, this.props.attr);
|
|
43
38
|
const item = this.state.interfaces?.find(it => it.value === value);
|
|
44
|
-
return React.createElement(FormControl, {
|
|
39
|
+
return React.createElement(FormControl, { fullWidth: true, variant: "standard" },
|
|
45
40
|
this.state.interfaces?.length && this.props.schema.label ? React.createElement(InputLabel, null, this.getText(this.props.schema.label)) : null,
|
|
46
41
|
!this.state.interfaces?.length ?
|
|
47
42
|
React.createElement(TextField, { fullWidth: true, variant: "standard", error: !!error, disabled: !!disabled, value: value, onChange: e => this.onChange(this.props.attr, e.target.value), label: this.getText(this.props.schema.label) }) :
|
|
@@ -49,26 +44,15 @@ class ConfigInterface extends ConfigGeneric {
|
|
|
49
44
|
if (item) {
|
|
50
45
|
return React.createElement("span", null,
|
|
51
46
|
item.value,
|
|
52
|
-
React.createElement("span", {
|
|
47
|
+
React.createElement("span", { style: styles.address }, item.address));
|
|
53
48
|
}
|
|
54
49
|
return val;
|
|
55
50
|
}, onChange: e => this.onChange(this.props.attr, e.target.value) }, this.state.interfaces.map((it, i) => React.createElement(MenuItem, { key: i, value: it.value },
|
|
56
51
|
React.createElement("span", null,
|
|
57
52
|
it.value,
|
|
58
|
-
React.createElement("span", {
|
|
53
|
+
React.createElement("span", { style: styles.address }, it.address))))),
|
|
59
54
|
this.props.schema.help ? React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
|
-
|
|
63
|
-
socket: PropTypes.object.isRequired,
|
|
64
|
-
themeType: PropTypes.string,
|
|
65
|
-
themeName: PropTypes.string,
|
|
66
|
-
style: PropTypes.object,
|
|
67
|
-
className: PropTypes.string,
|
|
68
|
-
data: PropTypes.object.isRequired,
|
|
69
|
-
schema: PropTypes.object,
|
|
70
|
-
onError: PropTypes.func,
|
|
71
|
-
onChange: PropTypes.func,
|
|
72
|
-
};
|
|
73
|
-
export default withStyles(styles)(ConfigInterface);
|
|
57
|
+
export default ConfigInterface;
|
|
74
58
|
//# sourceMappingURL=ConfigInterface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigInterface.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigInterface.
|
|
1
|
+
{"version":3,"file":"ConfigInterface.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigInterface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACH,UAAU,EACV,SAAS,EACT,cAAc,EACd,QAAQ,EACR,WAAW,EACX,MAAM,GACT,MAAM,eAAe,CAAC;AAGvB,OAAO,aAAa,EAAE,EAAoD,MAAM,iBAAiB,CAAC;AAmBlG,MAAM,MAAM,GAAwC;IAChD,OAAO,EAAE;QACL,QAAQ,EAAE,SAAS;QACnB,OAAO,EAAE,GAAG;QACZ,UAAU,EAAE,CAAC;KAChB;CACJ,CAAC;AAUF,MAAM,eAAgB,SAAQ,aAAyD;IACnF,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;aAC/D,IAAI,CAAC,GAAG,CAAC,EAAE;YACR,MAAM,UAAU,GAAyC,EAAE,CAAC;YAC5D,IAAI,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;gBAC3C,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC;gBACnD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBAC9B,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CA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AAO,GAAG,CAAC;oBACf,CAAC,EACD,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAE5D,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CACjC,oBAAC,QAAQ,IAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK;oBAC7B;wBACK,EAAE,CAAC,KAAK;wBACT,8BAAM,KAAK,EAAE,MAAM,CAAC,OAAO,IAAG,EAAE,CAAC,OAAO,CAAQ,CAC7C,CACA,CAAC,CACX;YACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,oBAAC,cAAc,QAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAkB,CAAC,CAAC,CAAC,IAAI,CAC9J,CAAC;IACnB,CAAC;CACJ;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, keyof import("./ConfigGeneric").ConfigGenericProps> & Pick<PropTypes.InferProps<{
|
|
2
|
-
socket: PropTypes.Validator<object>;
|
|
3
|
-
themeType: PropTypes.Requireable<string>;
|
|
4
|
-
style: PropTypes.Requireable<object>;
|
|
5
|
-
className: PropTypes.Requireable<string>;
|
|
6
|
-
data: PropTypes.Validator<object>;
|
|
7
|
-
schema: PropTypes.Requireable<object>;
|
|
8
|
-
onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
9
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
|
-
}>, "style"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "DeviceManager" | "adapterName" | "alive" | "arrayIndex" | "attr" | "changeLanguage" | "changed" | "classes" | "commandRunning" | "common" | "custom" | "customObj" | "customs" | "dateFormat" | "disabled" | "forceUpdate" | "globalData" | "imagePrefix" | "index" | "instance" | "instanceObj" | "isFloatComma" | "isParentTab" | "multiEdit" | "onCommandRunning" | "originalData" | "registerOnForceUpdate" | "systemConfig" | "table" | "themeName">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "button" | "flex" | "wrapper"> & object>;
|
|
11
|
-
export default _default;
|
|
12
|
-
import PropTypes from 'prop-types';
|
|
13
1
|
import React from 'react';
|
|
2
|
+
import type { ConfigItemJsonEditor } from '#JC/types';
|
|
3
|
+
import ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';
|
|
4
|
+
interface ConfigJsonEditorProps extends ConfigGenericProps {
|
|
5
|
+
schema: ConfigItemJsonEditor;
|
|
6
|
+
}
|
|
7
|
+
interface ConfigJsonEditorState extends ConfigGenericState {
|
|
8
|
+
initialized?: boolean;
|
|
9
|
+
showSelectId?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare class ConfigJsonEditor extends ConfigGeneric<ConfigJsonEditorProps, ConfigJsonEditorState> {
|
|
12
|
+
componentDidMount(): Promise<void>;
|
|
13
|
+
renderItem(): React.JSX.Element;
|
|
14
|
+
}
|
|
15
|
+
export default ConfigJsonEditor;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { withStyles } from '@mui/styles';
|
|
4
2
|
import { FormHelperText, FormControl, Button, } from '@mui/material';
|
|
5
3
|
import { I18n } from '@iobroker/adapter-react-v5';
|
|
6
|
-
import ConfigGeneric from './ConfigGeneric';
|
|
4
|
+
import ConfigGeneric, {} from './ConfigGeneric';
|
|
7
5
|
import CustomModal from './wrapper/Components/CustomModal';
|
|
8
6
|
import Editor from './wrapper/Components/Editor';
|
|
9
|
-
const styles =
|
|
7
|
+
const styles = {
|
|
10
8
|
fullWidth: {
|
|
11
9
|
width: '100%',
|
|
12
10
|
},
|
|
@@ -22,7 +20,7 @@ const styles = () => ({
|
|
|
22
20
|
width: 'calc(100vw - 40px)',
|
|
23
21
|
height: 'calc(100vh - 188px)',
|
|
24
22
|
},
|
|
25
|
-
}
|
|
23
|
+
};
|
|
26
24
|
class ConfigJsonEditor extends ConfigGeneric {
|
|
27
25
|
async componentDidMount() {
|
|
28
26
|
super.componentDidMount();
|
|
@@ -30,30 +28,20 @@ class ConfigJsonEditor extends ConfigGeneric {
|
|
|
30
28
|
const value = ConfigGeneric.getValue(data, attr) || {};
|
|
31
29
|
this.setState({ value, initialized: true });
|
|
32
30
|
}
|
|
33
|
-
renderItem( /*
|
|
31
|
+
renderItem( /* _error: string, _disabled: boolean, defaultValue */) {
|
|
34
32
|
if (!this.state.initialized) {
|
|
35
33
|
return null;
|
|
36
34
|
}
|
|
37
|
-
const {
|
|
35
|
+
const { schema, data, attr, } = this.props;
|
|
38
36
|
const { value, showSelectId } = this.state;
|
|
39
|
-
return React.createElement(FormControl, {
|
|
40
|
-
React.createElement("div", {
|
|
41
|
-
React.createElement(Button, { color: "grey",
|
|
42
|
-
showSelectId ? React.createElement(CustomModal, { title: this.getText(schema.label),
|
|
43
|
-
React.createElement("div", {
|
|
37
|
+
return React.createElement(FormControl, { fullWidth: true, variant: "standard" },
|
|
38
|
+
React.createElement("div", { style: styles.flex },
|
|
39
|
+
React.createElement(Button, { color: "grey", style: styles.button, size: "small", variant: "outlined", onClick: () => this.setState({ showSelectId: true }) }, I18n.t('ra_JSON editor'))),
|
|
40
|
+
showSelectId ? React.createElement(CustomModal, { title: this.getText(schema.label), overflowHidden: true, onClose: () => this.setState({ showSelectId: false, value: ConfigGeneric.getValue(data, attr) || {} }), onApply: () => this.setState({ showSelectId: false }, () => this.onChange(attr, value)) },
|
|
41
|
+
React.createElement("div", { style: styles.wrapper },
|
|
44
42
|
React.createElement(Editor, { value: typeof value === 'object' ? JSON.stringify(value) : value, onChange: newValue => this.setState({ value: newValue }), name: "ConfigJsonEditor", themeType: this.props.themeType }))) : null,
|
|
45
43
|
schema.help ? React.createElement(FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
|
|
46
44
|
}
|
|
47
45
|
}
|
|
48
|
-
|
|
49
|
-
socket: PropTypes.object.isRequired,
|
|
50
|
-
themeType: PropTypes.string,
|
|
51
|
-
style: PropTypes.object,
|
|
52
|
-
className: PropTypes.string,
|
|
53
|
-
data: PropTypes.object.isRequired,
|
|
54
|
-
schema: PropTypes.object,
|
|
55
|
-
onError: PropTypes.func,
|
|
56
|
-
onChange: PropTypes.func,
|
|
57
|
-
};
|
|
58
|
-
export default withStyles(styles)(ConfigJsonEditor);
|
|
46
|
+
export default ConfigJsonEditor;
|
|
59
47
|
//# sourceMappingURL=ConfigJsonEditor.js.map
|