@iobroker/adapter-react-v5 4.7.14 → 4.8.0
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/Components/JsonConfigComponent/ConfigAccordion.d.ts +1 -1
- package/Components/JsonConfigComponent/ConfigAccordion.js +4 -6
- package/Components/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAlive.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigAutocomplete.d.ts +36 -13
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +66 -164
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +16 -13
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +119 -251
- package/Components/JsonConfigComponent/ConfigCRON.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigCertCollection.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigCertificateSelect.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigCertificates.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigCheckbox.d.ts +14 -13
- package/Components/JsonConfigComponent/ConfigCheckbox.js +37 -79
- package/Components/JsonConfigComponent/ConfigChip.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigColor.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigCoordinates.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigDatePicker.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigDeviceManager.d.ts +6 -0
- package/Components/JsonConfigComponent/ConfigDeviceManager.js +18 -0
- package/Components/JsonConfigComponent/ConfigFile.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigFile.js +2 -2
- package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.js +8 -5
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFunc.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigGeneric.d.ts +12 -4
- package/Components/JsonConfigComponent/ConfigGeneric.js +11 -2
- package/Components/JsonConfigComponent/ConfigIP.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigImageSendTo.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigImageUpload.js +38 -44
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigInterface.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigInterface.js +1 -1
- package/Components/JsonConfigComponent/ConfigInterface.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +0 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLanguage.d.ts +6 -13
- package/Components/JsonConfigComponent/ConfigLanguage.js +105 -154
- package/Components/JsonConfigComponent/ConfigLicense.d.ts +1 -1
- package/Components/JsonConfigComponent/ConfigNumber.d.ts +1 -1
- package/Components/JsonConfigComponent/ConfigObjectId.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigPanel.js +8 -1
- package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPassword.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigPattern.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigRoom.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigSelect.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigSelectSendTo.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigSendto.d.ts +23 -17
- package/Components/JsonConfigComponent/ConfigSendto.js +259 -399
- package/Components/JsonConfigComponent/ConfigSetState.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigSlider.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigStaticDivider.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigStaticHeader.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigStaticImage.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigStaticText.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigText.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigText.js +18 -0
- package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigTimePicker.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigTopic.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigUUID.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigUser.d.ts +2 -2
- package/Components/JsonConfigComponent/DeviceManager/Communication.d.ts +63 -0
- package/Components/JsonConfigComponent/DeviceManager/Communication.js +268 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.d.ts +11 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.js +15 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceCard.d.ts +53 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceCard.js +340 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceControl.d.ts +45 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceControl.js +146 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.d.ts +12 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.js +69 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceList.d.ts +51 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceList.js +216 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.d.ts +13 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.js +111 -0
- package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.d.ts +7 -0
- package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.js +16 -0
- package/Components/JsonConfigComponent/DeviceManager/JsonConfig.d.ts +11 -0
- package/Components/JsonConfigComponent/DeviceManager/JsonConfig.js +94 -0
- package/Components/JsonConfigComponent/DeviceManager/TooltipButton.d.ts +10 -0
- package/Components/JsonConfigComponent/DeviceManager/TooltipButton.js +22 -0
- package/Components/JsonConfigComponent/DeviceManager/Utils.d.ts +12 -0
- package/Components/JsonConfigComponent/DeviceManager/Utils.js +158 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/de.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/en.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/es.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/fr.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/i18n.d.ts +26 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/it.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/nl.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/pl.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/pt.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/ru.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/uk.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/zh-cn.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/index.d.ts +2 -0
- package/Components/JsonConfigComponent/DeviceManager/index.js +10 -0
- package/Components/JsonConfigComponent/DeviceManager/index.js.map +1 -0
- package/Components/JsonConfigComponent/index.js +2 -7
- package/Components/JsonConfigComponent/index.js.map +1 -1
- package/Components/TextWithIcon.d.ts +1 -1
- package/Components/Utils.js +1 -1
- package/Components/Utils.js.map +1 -1
- package/Dialogs/ComplexCron.js +15 -17
- package/Dialogs/ComplexCron.js.map +1 -1
- package/Dialogs/Confirm.d.ts +20 -44
- package/Dialogs/Confirm.js +102 -158
- package/Dialogs/Error.d.ts +20 -39
- package/Dialogs/Error.js +50 -76
- package/Dialogs/Message.d.ts +22 -32
- package/Dialogs/Message.js +51 -83
- package/LegacyConnection.d.ts +3 -3
- package/README.md +9 -6
- package/i18n.d.ts +6 -6
- package/package.json +6 -5
- package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSendto.js.map +0 -1
- package/Dialogs/Confirm.js.map +0 -1
- package/Dialogs/Error.js.map +0 -1
- package/Dialogs/Message.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
1
|
+
declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "data" | "onChange" | "onError" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "themeType"> & Pick<PropTypes.InferProps<{
|
|
2
2
|
socket: PropTypes.Validator<object>;
|
|
3
3
|
data: PropTypes.Validator<object>;
|
|
4
4
|
schema: PropTypes.Requireable<object>;
|
|
5
5
|
adapterName: PropTypes.Requireable<string>;
|
|
6
6
|
instance: PropTypes.Requireable<number>;
|
|
7
|
-
}>, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
|
|
7
|
+
}>, never> & Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "onChange" | "onError" | "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "changed" | "common" | "themeType" | "commandRunning">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
|
|
8
8
|
export default _default;
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React from 'react';
|
|
@@ -39,7 +39,6 @@ var ConfigImageUpload = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
39
39
|
var _this;
|
|
40
40
|
(0, _classCallCheck2["default"])(this, ConfigImageUpload);
|
|
41
41
|
_this = _super.call(this, props);
|
|
42
|
-
_this.imageRef = /*#__PURE__*/_react["default"].createRef();
|
|
43
42
|
_this.index = Date.now();
|
|
44
43
|
return _this;
|
|
45
44
|
}
|
|
@@ -60,10 +59,7 @@ var ConfigImageUpload = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
60
59
|
});
|
|
61
60
|
} else {
|
|
62
61
|
this.props.socket.fileExists("".concat(this.props.adapterName, ".").concat(this.props.instance), this.props.attr).then(function (exist) {
|
|
63
|
-
|
|
64
|
-
_this2.imageRef.current.src = _this2._getUrl();
|
|
65
|
-
_this2.imageRef.current.style.display = 'block';
|
|
66
|
-
}
|
|
62
|
+
return exist && _this2.loadImage();
|
|
67
63
|
});
|
|
68
64
|
}
|
|
69
65
|
case 2:
|
|
@@ -89,10 +85,28 @@ var ConfigImageUpload = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
89
85
|
}
|
|
90
86
|
return url;
|
|
91
87
|
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "loadImage",
|
|
90
|
+
value: function loadImage() {
|
|
91
|
+
var _this3 = this;
|
|
92
|
+
fetch(this._getUrl()).then(function (res) {
|
|
93
|
+
return res.blob();
|
|
94
|
+
}).then(function (blob) {
|
|
95
|
+
var reader = new FileReader();
|
|
96
|
+
reader.onload = function () {
|
|
97
|
+
_this3.setState({
|
|
98
|
+
value: reader.result
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
reader.readAsDataURL(blob);
|
|
102
|
+
})["catch"](function (e) {
|
|
103
|
+
return console.error(e);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
92
106
|
}, {
|
|
93
107
|
key: "renderItem",
|
|
94
108
|
value: function renderItem(error, disabled /* , defaultValue */) {
|
|
95
|
-
var
|
|
109
|
+
var _this4 = this;
|
|
96
110
|
// eslint-disable-next-line
|
|
97
111
|
return /*#__PURE__*/_react["default"].createElement(_material.FormControl, {
|
|
98
112
|
className: this.props.classes.fullWidth,
|
|
@@ -107,52 +121,32 @@ var ConfigImageUpload = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
107
121
|
maxSize: this.props.schema.maxSize || 256 * 1024,
|
|
108
122
|
icon: this.state.value || undefined,
|
|
109
123
|
removeIconFunc: function removeIconFunc() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
_this3.props.socket.deleteFile("".concat(_this3.props.adapterName, ".").concat(_this3.props.instance), _this3.props.attr);
|
|
119
|
-
// update image
|
|
120
|
-
if (_this3.imageRef.current) {
|
|
121
|
-
_this3.imageRef.current.style.display = 'none';
|
|
122
|
-
_this3.imageRef.current.src = '';
|
|
124
|
+
return _this4.setState({
|
|
125
|
+
value: null
|
|
126
|
+
}, function () {
|
|
127
|
+
if (_this4.props.schema.base64) {
|
|
128
|
+
_this4.onChange(_this4.props.attr, _this4.state.value);
|
|
129
|
+
} else {
|
|
130
|
+
// delete file to /instance/attr
|
|
131
|
+
_this4.props.socket.deleteFile("".concat(_this4.props.adapterName, ".").concat(_this4.props.instance), _this4.props.attr);
|
|
123
132
|
}
|
|
124
|
-
}
|
|
133
|
+
});
|
|
125
134
|
},
|
|
126
135
|
onChange: function onChange(base64) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
})
|
|
133
|
-
} else {
|
|
134
|
-
if (base64.startsWith('data')) {
|
|
136
|
+
return _this4.setState({
|
|
137
|
+
value: base64
|
|
138
|
+
}, function () {
|
|
139
|
+
if (_this4.props.schema.base64) {
|
|
140
|
+
_this4.onChange(_this4.props.attr, _this4.state.value);
|
|
141
|
+
} else if (base64.startsWith('data')) {
|
|
135
142
|
base64 = base64.split(',')[1];
|
|
136
143
|
}
|
|
137
144
|
// upload file to /instance/attr
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
_this3.imageRef.current.style.display = 'block';
|
|
141
|
-
_this3.imageRef.current.src = _this3._getUrl(true);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
+
_this4.props.socket.writeFile64("".concat(_this4.props.adapterName, ".").concat(_this4.props.instance), _this4.props.attr, base64);
|
|
146
|
+
});
|
|
145
147
|
},
|
|
146
148
|
t: _i18n["default"].t
|
|
147
|
-
}), this.props.schema.help ? /*#__PURE__*/_react["default"].createElement(_material.FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null
|
|
148
|
-
src: this._getUrl(),
|
|
149
|
-
ref: this.imageRef,
|
|
150
|
-
className: this.props.classes.image,
|
|
151
|
-
style: {
|
|
152
|
-
display: 'none'
|
|
153
|
-
},
|
|
154
|
-
alt: "Background"
|
|
155
|
-
}));
|
|
149
|
+
}), this.props.schema.help ? /*#__PURE__*/_react["default"].createElement(_material.FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
|
|
156
150
|
}
|
|
157
151
|
}]);
|
|
158
152
|
return ConfigImageUpload;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigImageUpload.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","_UploadImage","_i18n","_ConfigGeneric2","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","styles","fullWidth","width","image","ConfigImageUpload","_ConfigGeneric","_inherits2","_super","props","_this","_classCallCheck2","imageRef","React","createRef","index","Date","now","_createClass2","key","value","_componentDidMount","_asyncToGenerator2","_regenerator","mark","_callee","_this2","wrap","_callee$","_context","prev","next","_get2","schema","base64","ConfigGeneric","getValue","data","attr","setState","socket","fileExists","concat","adapterName","instance","then","exist","current","src","_getUrl","style","display","stop","componentDidMount","update","url","window","location","port","protocol","hostname","renderItem","error","disabled","_this3","createElement","FormControl","className","classes","variant","label","InputLabel","shrink","getText","accept","crop","maxSize","icon","state","undefined","removeIconFunc","onChange","deleteFile","startsWith","split","writeFile64","t","I18n","help","FormHelperText","renderHelp","helpLink","noTranslation","ref","alt","propTypes","PropTypes","object","isRequired","themeType","string","themeName","onError","func","_default","exports","withStyles"],"sources":["JsonConfigComponent/ConfigImageUpload.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport {\n InputLabel,\n FormHelperText,\n FormControl,\n} from '@mui/material';\n\nimport UploadImage from './wrapper/Components/UploadImage';\nimport I18n from './wrapper/i18n';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = () => ({\n fullWidth: {\n width: '100%',\n },\n image: {\n width: 100,\n },\n});\n\nclass ConfigImageUpload extends ConfigGeneric {\n constructor(props) {\n super(props);\n this.imageRef = React.createRef();\n this.index = Date.now();\n }\n\n async componentDidMount() {\n super.componentDidMount();\n\n if (this.props.schema.base64) {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n this.setState({ value });\n } else {\n this.props.socket.fileExists(`${this.props.adapterName}.${this.props.instance}`, this.props.attr)\n .then(exist => {\n if (exist && this.imageRef.current) {\n this.imageRef.current.src = this._getUrl();\n this.imageRef.current.style.display = 'block';\n }\n });\n }\n }\n\n _getUrl(update) {\n if (update) {\n this.index = Date.now();\n }\n let url = `files/${this.props.adapterName}.${this.props.instance}/${this.props.attr}?t=${this.index}`;\n if (window.location.port === '3000') {\n url = `${window.location.protocol}//${window.location.hostname}:8081/${url}`;\n }\n\n return url;\n }\n\n renderItem(error, disabled /* , defaultValue */) {\n // eslint-disable-next-line\n return <FormControl className={this.props.classes.fullWidth} variant=\"standard\">\n {this.props.schema.label ? <InputLabel shrink>{this.getText(this.props.schema.label)}</InputLabel> : null}\n <UploadImage\n error={!!error}\n disabled={disabled}\n accept={this.props.schema.accept}\n crop={this.props.schema.crop}\n maxSize={this.props.schema.maxSize || 256 * 1024}\n icon={this.state.value || undefined}\n removeIconFunc={() => {\n if (this.props.schema.base64) {\n this.setState({ value: null }, () =>\n this.onChange(this.props.attr, this.state.value));\n } else {\n // delete file to /instance/attr\n this.props.socket.deleteFile(`${this.props.adapterName}.${this.props.instance}`, this.props.attr);\n // update image\n if (this.imageRef.current) {\n this.imageRef.current.style.display = 'none';\n this.imageRef.current.src = '';\n }\n }\n }}\n onChange={base64 => {\n if (this.props.schema.base64) {\n this.setState({ value: base64 }, () =>\n this.onChange(this.props.attr, this.state.value));\n } else {\n if (base64.startsWith('data')) {\n base64 = base64.split(',')[1];\n }\n // upload file to /instance/attr\n this.props.socket.writeFile64(`${this.props.adapterName}.${this.props.instance}`, this.props.attr, base64)\n .then(() => {\n if (this.imageRef.current) {\n this.imageRef.current.style.display = 'block';\n this.imageRef.current.src = this._getUrl(true);\n }\n });\n }\n }}\n t={I18n.t}\n />\n {this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}\n {this.props.schema.base64 ? null : <img\n src={this._getUrl()}\n ref={this.imageRef}\n className={this.props.classes.image}\n style={{ display: 'none' }}\n alt=\"Background\"\n />}\n </FormControl>;\n }\n}\n\nConfigImageUpload.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigImageUpload);\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;A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+
{"version":3,"file":"ConfigImageUpload.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","_UploadImage","_i18n","_ConfigGeneric2","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","styles","fullWidth","width","image","ConfigImageUpload","_ConfigGeneric","_inherits2","_super","props","_this","_classCallCheck2","index","Date","now","_createClass2","key","value","_componentDidMount","_asyncToGenerator2","_regenerator","mark","_callee","_this2","wrap","_callee$","_context","prev","next","_get2","schema","base64","ConfigGeneric","getValue","data","attr","setState","socket","fileExists","concat","adapterName","instance","then","exist","loadImage","stop","componentDidMount","_getUrl","update","url","window","location","port","protocol","hostname","_this3","fetch","res","blob","reader","FileReader","onload","readAsDataURL","console","error","renderItem","disabled","_this4","createElement","FormControl","className","classes","variant","label","InputLabel","shrink","getText","accept","crop","maxSize","icon","state","undefined","removeIconFunc","onChange","deleteFile","startsWith","split","writeFile64","t","I18n","help","FormHelperText","renderHelp","helpLink","noTranslation","propTypes","PropTypes","object","isRequired","themeType","string","themeName","style","onError","func","_default","exports","withStyles"],"sources":["JsonConfigComponent/ConfigImageUpload.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport {\n InputLabel,\n FormHelperText,\n FormControl,\n} from '@mui/material';\n\nimport UploadImage from './wrapper/Components/UploadImage';\nimport I18n from './wrapper/i18n';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = () => ({\n fullWidth: {\n width: '100%',\n },\n image: {\n width: 100,\n },\n});\n\nclass ConfigImageUpload extends ConfigGeneric {\n constructor(props) {\n super(props);\n this.index = Date.now();\n }\n\n async componentDidMount() {\n super.componentDidMount();\n\n if (this.props.schema.base64) {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n this.setState({ value });\n } else {\n this.props.socket.fileExists(`${this.props.adapterName}.${this.props.instance}`, this.props.attr)\n .then(exist => exist && this.loadImage());\n }\n }\n\n _getUrl(update) {\n if (update) {\n this.index = Date.now();\n }\n let url = `files/${this.props.adapterName}.${this.props.instance}/${this.props.attr}?t=${this.index}`;\n if (window.location.port === '3000') {\n url = `${window.location.protocol}//${window.location.hostname}:8081/${url}`;\n }\n\n return url;\n }\n\n loadImage() {\n fetch(this._getUrl())\n .then(res => res.blob())\n .then(blob => {\n const reader = new FileReader();\n reader.onload = () => {\n this.setState({ value: reader.result });\n };\n reader.readAsDataURL(blob);\n })\n .catch(e => console.error(e));\n }\n\n renderItem(error, disabled /* , defaultValue */) {\n // eslint-disable-next-line\n return <FormControl className={this.props.classes.fullWidth} variant=\"standard\">\n {this.props.schema.label ? <InputLabel shrink>{this.getText(this.props.schema.label)}</InputLabel> : null}\n <UploadImage\n error={!!error}\n disabled={disabled}\n accept={this.props.schema.accept}\n crop={this.props.schema.crop}\n maxSize={this.props.schema.maxSize || 256 * 1024}\n icon={this.state.value || undefined}\n removeIconFunc={() => this.setState({ value: null }, () => {\n if (this.props.schema.base64) {\n this.onChange(this.props.attr, this.state.value);\n } else {\n // delete file to /instance/attr\n this.props.socket.deleteFile(`${this.props.adapterName}.${this.props.instance}`, this.props.attr);\n }\n })}\n onChange={base64 => this.setState({ value: base64 }, () => {\n if (this.props.schema.base64) {\n this.onChange(this.props.attr, this.state.value);\n } else if (base64.startsWith('data')) {\n base64 = base64.split(',')[1];\n }\n // upload file to /instance/attr\n this.props.socket.writeFile64(`${this.props.adapterName}.${this.props.instance}`, this.props.attr, base64);\n })}\n t={I18n.t}\n />\n {this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}\n </FormControl>;\n }\n}\n\nConfigImageUpload.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigImageUpload);\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AAMA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,eAAA,GAAAP,sBAAA,CAAAC,OAAA;AAA4C,SAAAO,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,aAAAL,OAAA,GAAAM,MAAA,MAAAL,yBAAA,QAAAM,SAAA,OAAAF,gBAAA,mBAAAG,WAAA,EAAAF,MAAA,GAAAG,OAAA,CAAAC,SAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAJ,SAAA,YAAAD,MAAA,GAAAF,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,mBAAAP,MAAA;AAAA,SAAAJ,0BAAA,eAAAO,OAAA,qBAAAA,OAAA,CAAAC,SAAA,oBAAAD,OAAA,CAAAC,SAAA,CAAAI,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,OAAA,CAAAC,SAAA,CAAAM,OAAA,8CAAAI,CAAA;AAE5C,IAAMC,MAAM,GAAG,SAATA,MAAMA,CAAA;EAAA,OAAU;IAClBC,SAAS,EAAE;MACPC,KAAK,EAAE;IACX,CAAC;IACDC,KAAK,EAAE;MACHD,KAAK,EAAE;IACX;EACJ,CAAC;AAAA,CAAC;AAAC,IAEGE,iBAAiB,0BAAAC,cAAA;EAAA,IAAAC,UA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AAC;QACH0D,CAAC,EAAEC,gBAAI,CAACD;MAAE,CACb,CAAC,EACD,IAAI,CAAChF,KAAK,CAACqB,MAAM,CAAC6D,IAAI,gBAAGzH,MAAA,YAAAkG,aAAA,CAAC7F,SAAA,CAAAqH,cAAc,QAAE,IAAI,CAACC,UAAU,CAAC,IAAI,CAACpF,KAAK,CAACqB,MAAM,CAAC6D,IAAI,EAAE,IAAI,CAAClF,KAAK,CAACqB,MAAM,CAACgE,QAAQ,EAAE,IAAI,CAACrF,KAAK,CAACqB,MAAM,CAACiE,aAAa,CAAkB,CAAC,GAAG,IAC3J,CAAC;IAClB;EAAC;EAAA,OAAA1F,iBAAA;AAAA,EA3E2B2B,0BAAa;AA8E7C3B,iBAAiB,CAAC2F,SAAS,GAAG;EAC1B3D,MAAM,EAAE4D,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnCC,SAAS,EAAEH,qBAAS,CAACI,MAAM;EAC3BC,SAAS,EAAEL,qBAAS,CAACI,MAAM;EAC3BE,KAAK,EAAEN,qBAAS,CAACC,MAAM;EACvB5B,SAAS,EAAE2B,qBAAS,CAACI,MAAM;EAC3BnE,IAAI,EAAE+D,qBAAS,CAACC,MAAM,CAACC,UAAU;EACjCrE,MAAM,EAAEmE,qBAAS,CAACC,MAAM;EACxBM,OAAO,EAAEP,qBAAS,CAACQ,IAAI;EACvBrB,QAAQ,EAAEa,qBAAS,CAACQ;AACxB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEa,IAAAC,kBAAU,EAAC3G,MAAM,CAAC,CAACI,iBAAiB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
1
|
+
declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "data" | "onChange" | "onError" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "themeType"> & Pick<PropTypes.InferProps<{
|
|
2
2
|
socket: PropTypes.Validator<object>;
|
|
3
3
|
themeType: PropTypes.Requireable<string>;
|
|
4
4
|
themeName: PropTypes.Requireable<string>;
|
|
@@ -8,7 +8,7 @@ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
|
8
8
|
schema: PropTypes.Requireable<object>;
|
|
9
9
|
onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
10
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
-
}>, "classes"> & import("@mui/styles").StyledComponentProps<"
|
|
11
|
+
}>, "style" | "className" | "themeName"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "changed" | "adapterName" | "instance" | "common" | "commandRunning">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "icon"> & object>;
|
|
12
12
|
export default _default;
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
14
|
import React from 'react';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
1
|
+
declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "data" | "onChange" | "onError" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "themeType"> & Pick<PropTypes.InferProps<{
|
|
2
2
|
socket: PropTypes.Validator<object>;
|
|
3
3
|
themeType: PropTypes.Requireable<string>;
|
|
4
4
|
themeName: PropTypes.Requireable<string>;
|
|
@@ -8,7 +8,7 @@ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
|
8
8
|
schema: PropTypes.Requireable<object>;
|
|
9
9
|
onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
10
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
-
}>, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "address"> & object>;
|
|
11
|
+
}>, "style" | "className" | "themeName"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "changed" | "adapterName" | "instance" | "common" | "commandRunning">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "address"> & object>;
|
|
12
12
|
export default _default;
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
14
|
import React from 'react';
|
|
@@ -54,7 +54,7 @@ var ConfigInterface = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
if (_this.props.schema.ignoreLoopback && list[inter].find(function (_ip) {
|
|
57
|
-
return
|
|
57
|
+
return _ip.address === '127.0.0.1' || _ip.address === '::1';
|
|
58
58
|
})) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigInterface.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","_ConfigGeneric2","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","styles","fullWidth","width","address","fontSize","opacity","marginLeft","ConfigInterface","_ConfigGeneric","_inherits2","_super","_classCallCheck2","_createClass2","key","value","componentDidMount","_this","_get2","props","socket","getObject","concat","common","host","then","obj","_obj$native","interfaces","hardware","networkInterfaces","list","Object","keys","forEach","inter","schema","ignoreInternal","find","_ip","internal","ignoreLoopback","ip","family","push","setState","window","alert","renderItem","error","disabled","_this$state$interface","_this$state$interface2","_this$state$interface3","_this2","ConfigGeneric","getValue","data","attr","item","state","it","createElement","FormControl","className","classes","variant","length","label","InputLabel","getText","TextField","onChange","target","Select","renderValue","val","map","i","MenuItem","help","FormHelperText","renderHelp","helpLink","noTranslation","propTypes","PropTypes","object","isRequired","themeType","string","themeName","style","onError","func","_default","exports","withStyles"],"sources":["JsonConfigComponent/ConfigInterface.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport {\n InputLabel,\n TextField,\n FormHelperText,\n MenuItem,\n FormControl,\n Select,\n} from '@mui/material';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = () => ({\n fullWidth: {\n width: '100%',\n },\n address: {\n fontSize: 'smaller',\n opacity: 0.5,\n marginLeft: 8,\n },\n});\n\nclass ConfigInterface extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n this.props.socket.getObject(`system.host.${this.props.common.host}`)\n .then(obj => {\n const interfaces = [];\n if (obj?.native?.hardware?.networkInterfaces) {\n const list = obj.native.hardware.networkInterfaces;\n Object.keys(list).forEach(inter => {\n if (this.props.schema.ignoreInternal && !list[inter].find(_ip => !_ip.internal)) {\n return;\n }\n if (this.props.schema.ignoreLoopback && list[inter].find(_ip => ip.address === '127.0.0.1' || ip.address === '::1')) {\n return;\n }\n\n // find ipv4 address\n let ip = list[inter].find(_ip => _ip.family === 'IPv4');\n ip = ip || list[inter].find(_ip => _ip.family === 'IPv6');\n interfaces.push({ value: inter, address: ip.address });\n });\n }\n\n this.setState({ interfaces });\n })\n .catch(e => window.alert(`Cannot read interfaces: ${e}`));\n }\n\n renderItem(error, disabled /* , defaultValue */) {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const item = this.state.interfaces?.find(it => it.value === value);\n\n return <FormControl className={this.props.classes.fullWidth} variant=\"standard\">\n {this.state.interfaces?.length && this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n {!this.state.interfaces?.length ?\n <TextField\n fullWidth\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={value}\n onChange={e => this.onChange(this.props.attr, e.target.value)}\n label={this.getText(this.props.schema.label)}\n /> :\n <Select\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={value}\n renderValue={val => {\n if (item) {\n return <span>\n {item.value}\n <span className={this.props.classes.address}>{item.address}</span>\n </span>;\n }\n return val;\n }}\n onChange={e => this.onChange(this.props.attr, e.target.value)}\n >\n {this.state.interfaces.map((it, i) =>\n <MenuItem key={i} value={it.value}>\n <span>\n {it.value}\n <span className={this.props.classes.address}>{it.address}</span>\n </span>\n </MenuItem>)}\n </Select>}\n {this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}\n </FormControl>;\n }\n}\n\nConfigInterface.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigInterface);\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AASA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAA4C,SAAAK,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,aAAAL,OAAA,GAAAM,MAAA,MAAAL,yBAAA,QAAAM,SAAA,OAAAF,gBAAA,mBAAAG,WAAA,EAAAF,MAAA,GAAAG,OAAA,CAAAC,SAAA,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|
|
1
|
+
{"version":3,"file":"ConfigInterface.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","_ConfigGeneric2","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","styles","fullWidth","width","address","fontSize","opacity","marginLeft","ConfigInterface","_ConfigGeneric","_inherits2","_super","_classCallCheck2","_createClass2","key","value","componentDidMount","_this","_get2","props","socket","getObject","concat","common","host","then","obj","_obj$native","interfaces","hardware","networkInterfaces","list","Object","keys","forEach","inter","schema","ignoreInternal","find","_ip","internal","ignoreLoopback","ip","family","push","setState","window","alert","renderItem","error","disabled","_this$state$interface","_this$state$interface2","_this$state$interface3","_this2","ConfigGeneric","getValue","data","attr","item","state","it","createElement","FormControl","className","classes","variant","length","label","InputLabel","getText","TextField","onChange","target","Select","renderValue","val","map","i","MenuItem","help","FormHelperText","renderHelp","helpLink","noTranslation","propTypes","PropTypes","object","isRequired","themeType","string","themeName","style","onError","func","_default","exports","withStyles"],"sources":["JsonConfigComponent/ConfigInterface.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport {\n InputLabel,\n TextField,\n FormHelperText,\n MenuItem,\n FormControl,\n Select,\n} from '@mui/material';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = () => ({\n fullWidth: {\n width: '100%',\n },\n address: {\n fontSize: 'smaller',\n opacity: 0.5,\n marginLeft: 8,\n },\n});\n\nclass ConfigInterface extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n this.props.socket.getObject(`system.host.${this.props.common.host}`)\n .then(obj => {\n const interfaces = [];\n if (obj?.native?.hardware?.networkInterfaces) {\n const list = obj.native.hardware.networkInterfaces;\n Object.keys(list).forEach(inter => {\n if (this.props.schema.ignoreInternal && !list[inter].find(_ip => !_ip.internal)) {\n return;\n }\n if (this.props.schema.ignoreLoopback && list[inter].find(_ip => _ip.address === '127.0.0.1' || _ip.address === '::1')) {\n return;\n }\n\n // find ipv4 address\n let ip = list[inter].find(_ip => _ip.family === 'IPv4');\n ip = ip || list[inter].find(_ip => _ip.family === 'IPv6');\n interfaces.push({ value: inter, address: ip.address });\n });\n }\n\n this.setState({ interfaces });\n })\n .catch(e => window.alert(`Cannot read interfaces: ${e}`));\n }\n\n renderItem(error, disabled /* , defaultValue */) {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const item = this.state.interfaces?.find(it => it.value === value);\n\n return <FormControl className={this.props.classes.fullWidth} variant=\"standard\">\n {this.state.interfaces?.length && this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n {!this.state.interfaces?.length ?\n <TextField\n fullWidth\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={value}\n onChange={e => this.onChange(this.props.attr, e.target.value)}\n label={this.getText(this.props.schema.label)}\n /> :\n <Select\n variant=\"standard\"\n error={!!error}\n disabled={!!disabled}\n value={value}\n renderValue={val => {\n if (item) {\n return <span>\n {item.value}\n <span className={this.props.classes.address}>{item.address}</span>\n </span>;\n }\n return val;\n }}\n onChange={e => this.onChange(this.props.attr, e.target.value)}\n >\n {this.state.interfaces.map((it, i) =>\n <MenuItem key={i} value={it.value}>\n <span>\n {it.value}\n <span className={this.props.classes.address}>{it.address}</span>\n </span>\n </MenuItem>)}\n </Select>}\n {this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}\n </FormControl>;\n }\n}\n\nConfigInterface.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n themeName: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(Conf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CAACC,UAAU;EACnCC,SAAS,EAAEH,qBAAS,CAACI,MAAM;EAC3BC,SAAS,EAAEL,qBAAS,CAACI,MAAM;EAC3BE,KAAK,EAAEN,qBAAS,CAACC,MAAM;EACvBvB,SAAS,EAAEsB,qBAAS,CAACI,MAAM;EAC3BjC,IAAI,EAAE6B,qBAAS,CAACC,MAAM,CAACC,UAAU;EACjCpD,MAAM,EAAEkD,qBAAS,CAACC,MAAM;EACxBM,OAAO,EAAEP,qBAAS,CAACQ,IAAI;EACvBtB,QAAQ,EAAEc,qBAAS,CAACQ;AACxB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEa,IAAAC,kBAAU,EAAChG,MAAM,CAAC,CAACO,eAAe,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
1
|
+
declare const _default: React.JSXElementConstructor<Omit<Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "data" | "onChange" | "onError" | "originalData" | "instanceObj" | "customObj" | "schema" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "socket" | "changed" | "adapterName" | "instance" | "common" | "themeType"> & Pick<PropTypes.InferProps<{
|
|
2
2
|
socket: PropTypes.Validator<object>;
|
|
3
3
|
themeType: PropTypes.Requireable<string>;
|
|
4
4
|
style: PropTypes.Requireable<object>;
|
|
@@ -7,7 +7,7 @@ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
|
7
7
|
schema: PropTypes.Requireable<object>;
|
|
8
8
|
onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
9
9
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
10
|
-
}>, "classes"> & import("@mui/styles").StyledComponentProps<"
|
|
10
|
+
}>, "style" | "className"> & Pick<import("./ConfigGeneric").ConfigGenericProps, "classes" | "disabled" | "originalData" | "instanceObj" | "customObj" | "arrayIndex" | "globalData" | "registerOnForceUpdate" | "attr" | "custom" | "forceUpdate" | "alive" | "systemConfig" | "changed" | "adapterName" | "instance" | "common" | "commandRunning">, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth" | "flex" | "button" | "wrapper"> & object>;
|
|
11
11
|
export default _default;
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
13
|
import React from 'react';
|
|
@@ -134,7 +134,6 @@ var ConfigJsonEditor = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
134
134
|
ConfigJsonEditor.propTypes = {
|
|
135
135
|
socket: _propTypes["default"].object.isRequired,
|
|
136
136
|
themeType: _propTypes["default"].string,
|
|
137
|
-
// themeName: PropTypes.string,
|
|
138
137
|
style: _propTypes["default"].object,
|
|
139
138
|
className: _propTypes["default"].string,
|
|
140
139
|
data: _propTypes["default"].object.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigJsonEditor.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","_ConfigGeneric2","_i18n","_CustomModal","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","styles","fullWidth","width","flex","display","button","height","minWidth","wrapper","ConfigJsonEditor","_ConfigGeneric","_inherits2","_super","_classCallCheck2","_createClass2","key","value","_componentDidMount","_asyncToGenerator2","_regenerator","mark","_callee","_this$props","data","attr","wrap","_callee$","_context","prev","next","_get2","props","ConfigGeneric","getValue","setState","initialized","stop","componentDidMount","renderItem","_this","state","_this$props2","classes","schema","_this$state","showSelectId","createElement","FormControl","className","variant","Button","color","size","onClick","I18n","t","title","getText","label","open","overflowHidden","onClose","onApply","onChange","help","FormHelperText","renderHelp","helpLink","noTranslation","propTypes","socket","PropTypes","object","isRequired","themeType","string","style","onError","func","_default","exports","withStyles"],"sources":["JsonConfigComponent/ConfigJsonEditor.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport {\n FormHelperText,\n FormControl,\n Button,\n} from '@mui/material';\n\nimport ConfigGeneric from './ConfigGeneric';\nimport I18n from './wrapper/i18n';\nimport CustomModal from '../CustomModal';\n// import Editor from '../Editor';\n\nconst styles = () => ({\n fullWidth: {\n width: '100%',\n },\n flex: {\n display: 'flex',\n },\n button: {\n height: 48,\n // marginLeft: 4,\n minWidth: 48,\n },\n wrapper: {\n width: 'calc(100vw - 40px)',\n height: 'calc(100vh - 188px)',\n },\n});\n\nclass ConfigJsonEditor extends ConfigGeneric {\n async componentDidMount() {\n super.componentDidMount();\n const { data, attr } = this.props;\n const value = ConfigGeneric.getValue(data, attr) || {};\n this.setState({ value, initialized: true });\n }\n\n renderItem(/* error, disabled, defaultValue */) {\n if (!this.state.initialized) {\n return null;\n }\n\n const {\n classes, schema, data, attr,\n } = this.props;\n const { value, showSelectId } = this.state;\n\n return <FormControl className={classes.fullWidth} variant=\"standard\">\n <div className={classes.flex}>\n <Button\n color=\"grey\"\n className={classes.button}\n size=\"small\"\n variant=\"outlined\"\n onClick={() => this.setState({ showSelectId: true })}\n >\n {I18n.t('ra_JSON editor')}\n </Button>\n </div>\n {showSelectId ? <CustomModal\n title={this.getText(schema.label)}\n open={showSelectId}\n overflowHidden\n onClose={() =>\n this.setState({ showSelectId: false, value: ConfigGeneric.getValue(data, attr) || {} })}\n onApply={() => this.setState({ showSelectId: false }, () => this.onChange(attr, value))}\n >\n <div className={classes.wrapper}>\n {/*<Editor\n value={typeof value === 'object' ? JSON.stringify(value) : value}\n onChange={newValue => this.setState({ value: newValue })}\n name=\"ConfigJsonEditor\"\n themeType={this.props.themeType}\n />*/}\n <div>NOT SUPPORTED</div>\n </div>\n </CustomModal> : null}\n {schema.help ? <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText> : null}\n </FormControl>;\n }\n}\n\nConfigJsonEditor.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n
|
|
1
|
+
{"version":3,"file":"ConfigJsonEditor.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","_ConfigGeneric2","_i18n","_CustomModal","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","styles","fullWidth","width","flex","display","button","height","minWidth","wrapper","ConfigJsonEditor","_ConfigGeneric","_inherits2","_super","_classCallCheck2","_createClass2","key","value","_componentDidMount","_asyncToGenerator2","_regenerator","mark","_callee","_this$props","data","attr","wrap","_callee$","_context","prev","next","_get2","props","ConfigGeneric","getValue","setState","initialized","stop","componentDidMount","renderItem","_this","state","_this$props2","classes","schema","_this$state","showSelectId","createElement","FormControl","className","variant","Button","color","size","onClick","I18n","t","title","getText","label","open","overflowHidden","onClose","onApply","onChange","help","FormHelperText","renderHelp","helpLink","noTranslation","propTypes","socket","PropTypes","object","isRequired","themeType","string","style","onError","func","_default","exports","withStyles"],"sources":["JsonConfigComponent/ConfigJsonEditor.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport {\n FormHelperText,\n FormControl,\n Button,\n} from '@mui/material';\n\nimport ConfigGeneric from './ConfigGeneric';\nimport I18n from './wrapper/i18n';\nimport CustomModal from '../CustomModal';\n// import Editor from '../Editor';\n\nconst styles = () => ({\n fullWidth: {\n width: '100%',\n },\n flex: {\n display: 'flex',\n },\n button: {\n height: 48,\n // marginLeft: 4,\n minWidth: 48,\n },\n wrapper: {\n width: 'calc(100vw - 40px)',\n height: 'calc(100vh - 188px)',\n },\n});\n\nclass ConfigJsonEditor extends ConfigGeneric {\n async componentDidMount() {\n super.componentDidMount();\n const { data, attr } = this.props;\n const value = ConfigGeneric.getValue(data, attr) || {};\n this.setState({ value, initialized: true });\n }\n\n renderItem(/* error, disabled, defaultValue */) {\n if (!this.state.initialized) {\n return null;\n }\n\n const {\n classes, schema, data, attr,\n } = this.props;\n const { value, showSelectId } = this.state;\n\n return <FormControl className={classes.fullWidth} variant=\"standard\">\n <div className={classes.flex}>\n <Button\n color=\"grey\"\n className={classes.button}\n size=\"small\"\n variant=\"outlined\"\n onClick={() => this.setState({ showSelectId: true })}\n >\n {I18n.t('ra_JSON editor')}\n </Button>\n </div>\n {showSelectId ? <CustomModal\n title={this.getText(schema.label)}\n open={showSelectId}\n overflowHidden\n onClose={() =>\n this.setState({ showSelectId: false, value: ConfigGeneric.getValue(data, attr) || {} })}\n onApply={() => this.setState({ showSelectId: false }, () => this.onChange(attr, value))}\n >\n <div className={classes.wrapper}>\n {/*<Editor\n value={typeof value === 'object' ? JSON.stringify(value) : value}\n onChange={newValue => this.setState({ value: newValue })}\n name=\"ConfigJsonEditor\"\n themeType={this.props.themeType}\n />*/}\n <div>NOT SUPPORTED</div>\n </div>\n </CustomModal> : null}\n {schema.help ? <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText> : null}\n </FormControl>;\n }\n}\n\nConfigJsonEditor.propTypes = {\n socket: PropTypes.object.isRequired,\n themeType: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n data: PropTypes.object.isRequired,\n schema: PropTypes.object,\n onError: PropTypes.func,\n onChange: PropTypes.func,\n};\n\nexport default withStyles(styles)(ConfigJsonEditor);"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AAMA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,KAAA,GAAAN,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C,IAAI,EAAER,KAAK,CAAC;UAAA,EAAC;QAAA;MAAC,gBAExF/C,MAAA,YAAA6E,aAAA;QAAKE,SAAS,EAAEN,OAAO,CAAClC;MAAQ,gBAO5BvC,MAAA,YAAA6E,aAAA,cAAK,eAAkB,CACtB,CACI,CAAC,GAAG,IAAI,EACpBH,MAAM,CAACqB,IAAI,gBAAG/F,MAAA,YAAA6E,aAAA,CAACxE,SAAA,CAAA2F,cAAc,QACzB,IAAI,CAACC,UAAU,CACZ,IAAI,CAACnC,KAAK,CAACY,MAAM,CAACqB,IAAI,EACtB,IAAI,CAACjC,KAAK,CAACY,MAAM,CAACwB,QAAQ,EAC1B,IAAI,CAACpC,KAAK,CAACY,MAAM,CAACyB,aACtB,CACY,CAAC,GAAG,IACX,CAAC;IAClB;EAAC;EAAA,OAAA3D,gBAAA;AAAA,EAxD0BuB,0BAAa;AA2D5CvB,gBAAgB,CAAC4D,SAAS,GAAG;EACzBC,MAAM,EAAEC,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnCC,SAAS,EAAEH,qBAAS,CAACI,MAAM;EAC3BC,KAAK,EAAEL,qBAAS,CAACC,MAAM;EACvBxB,SAAS,EAAEuB,qBAAS,CAACI,MAAM;EAC3BpD,IAAI,EAAEgD,qBAAS,CAACC,MAAM,CAACC,UAAU;EACjC9B,MAAM,EAAE4B,qBAAS,CAACC,MAAM;EACxBK,OAAO,EAAEN,qBAAS,CAACO,IAAI;EACvBf,QAAQ,EAAEQ,qBAAS,CAACO;AACxB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEa,IAAAC,kBAAU,EAACjF,MAAM,CAAC,CAACS,gBAAgB,CAAC"}
|
|
@@ -1,14 +1,7 @@
|
|
|
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"> & object>;
|
|
12
|
-
export default _default;
|
|
13
|
-
import PropTypes from 'prop-types';
|
|
14
1
|
import React from 'react';
|
|
2
|
+
import { type ConfigGenericProps } from './ConfigGeneric';
|
|
3
|
+
interface ConfigLanguageProps extends ConfigGenericProps {
|
|
4
|
+
changeLanguage: () => void;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: React.JSXElementConstructor<Omit<ConfigLanguageProps, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
|
|
7
|
+
export default _default;
|