@iobroker/adapter-react-v5 2.1.11 → 3.0.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.
Files changed (80) hide show
  1. package/Components/JsonConfigComponent/ChipInput.js +925 -0
  2. package/Components/JsonConfigComponent/ChipInput.js.map +1 -0
  3. package/Components/JsonConfigComponent/ConfigAlive.js +135 -0
  4. package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -0
  5. package/Components/JsonConfigComponent/ConfigAutocomplete.js +204 -0
  6. package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -0
  7. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +311 -0
  8. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -0
  9. package/Components/JsonConfigComponent/ConfigCRON.js +195 -0
  10. package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -0
  11. package/Components/JsonConfigComponent/ConfigCertificateSelect.js +178 -0
  12. package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -0
  13. package/Components/JsonConfigComponent/ConfigCheckbox.js +112 -0
  14. package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -0
  15. package/Components/JsonConfigComponent/ConfigChip.js +149 -0
  16. package/Components/JsonConfigComponent/ConfigChip.js.map +1 -0
  17. package/Components/JsonConfigComponent/ConfigColor.js +156 -0
  18. package/Components/JsonConfigComponent/ConfigColor.js.map +1 -0
  19. package/Components/JsonConfigComponent/ConfigCoordinates.js +165 -0
  20. package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -0
  21. package/Components/JsonConfigComponent/ConfigCustomEasyAccess.js +180 -0
  22. package/Components/JsonConfigComponent/ConfigCustomEasyAccess.js.map +1 -0
  23. package/Components/JsonConfigComponent/ConfigDatePicker.js +117 -0
  24. package/Components/JsonConfigComponent/ConfigDatePicker.js.map +1 -0
  25. package/Components/JsonConfigComponent/ConfigGeneric.js +660 -0
  26. package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -0
  27. package/Components/JsonConfigComponent/ConfigIP.js +151 -0
  28. package/Components/JsonConfigComponent/ConfigIP.js.map +1 -0
  29. package/Components/JsonConfigComponent/ConfigImageUpload.js +215 -0
  30. package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -0
  31. package/Components/JsonConfigComponent/ConfigInstanceSelect.js +197 -0
  32. package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -0
  33. package/Components/JsonConfigComponent/ConfigJsonEditor.js +211 -0
  34. package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -0
  35. package/Components/JsonConfigComponent/ConfigLanguage.js +175 -0
  36. package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -0
  37. package/Components/JsonConfigComponent/ConfigNumber.js +194 -0
  38. package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -0
  39. package/Components/JsonConfigComponent/ConfigObjectId.js +201 -0
  40. package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -0
  41. package/Components/JsonConfigComponent/ConfigPanel.js +421 -0
  42. package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -0
  43. package/Components/JsonConfigComponent/ConfigPassword.js +236 -0
  44. package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -0
  45. package/Components/JsonConfigComponent/ConfigPattern.js +94 -0
  46. package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -0
  47. package/Components/JsonConfigComponent/ConfigSelect.js +163 -0
  48. package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -0
  49. package/Components/JsonConfigComponent/ConfigSelectSendTo.js +258 -0
  50. package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -0
  51. package/Components/JsonConfigComponent/ConfigSendto.js +282 -0
  52. package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -0
  53. package/Components/JsonConfigComponent/ConfigSetState.js +266 -0
  54. package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -0
  55. package/Components/JsonConfigComponent/ConfigStaticDivider.js +88 -0
  56. package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -0
  57. package/Components/JsonConfigComponent/ConfigStaticHeader.js +81 -0
  58. package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -0
  59. package/Components/JsonConfigComponent/ConfigStaticImage.js +88 -0
  60. package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -0
  61. package/Components/JsonConfigComponent/ConfigStaticText.js +104 -0
  62. package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -0
  63. package/Components/JsonConfigComponent/ConfigTable.js +651 -0
  64. package/Components/JsonConfigComponent/ConfigTable.js.map +1 -0
  65. package/Components/JsonConfigComponent/ConfigTabs.js +166 -0
  66. package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -0
  67. package/Components/JsonConfigComponent/ConfigText.js +170 -0
  68. package/Components/JsonConfigComponent/ConfigText.js.map +1 -0
  69. package/Components/JsonConfigComponent/ConfigTextSendTo.js +168 -0
  70. package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -0
  71. package/Components/JsonConfigComponent/ConfigTimePicker.js +111 -0
  72. package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -0
  73. package/Components/JsonConfigComponent/ConfigTopic.js +140 -0
  74. package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -0
  75. package/Components/JsonConfigComponent/ConfigUser.js +176 -0
  76. package/Components/JsonConfigComponent/ConfigUser.js.map +1 -0
  77. package/Components/JsonConfigComponent/index.js +511 -0
  78. package/Components/JsonConfigComponent/index.js.map +1 -0
  79. package/README.md +3 -0
  80. package/package.json +1 -1
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
14
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
+
16
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
+
18
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
19
+
20
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
+
22
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
+
24
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
+
26
+ var _propTypes = _interopRequireDefault(require("prop-types"));
27
+
28
+ var _styles = require("@mui/styles");
29
+
30
+ var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
31
+
32
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
33
+
34
+ var _FormHelperText = _interopRequireDefault(require("@mui/material/FormHelperText"));
35
+
36
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
37
+
38
+ var _Select = _interopRequireDefault(require("@mui/material/Select"));
39
+
40
+ var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
41
+
42
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
43
+
44
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
45
+
46
+ var styles = function styles(theme) {
47
+ return {
48
+ fullWidth: {
49
+ width: '100%'
50
+ }
51
+ };
52
+ };
53
+
54
+ var ConfigCertificateSelect = /*#__PURE__*/function (_ConfigGeneric) {
55
+ (0, _inherits2["default"])(ConfigCertificateSelect, _ConfigGeneric);
56
+
57
+ var _super = _createSuper(ConfigCertificateSelect);
58
+
59
+ function ConfigCertificateSelect() {
60
+ (0, _classCallCheck2["default"])(this, ConfigCertificateSelect);
61
+ return _super.apply(this, arguments);
62
+ }
63
+
64
+ (0, _createClass2["default"])(ConfigCertificateSelect, [{
65
+ key: "componentDidMount",
66
+ value: function () {
67
+ var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
68
+ var _this = this;
69
+
70
+ var value, selectOptions;
71
+ return _regenerator["default"].wrap(function _callee$(_context) {
72
+ while (1) {
73
+ switch (_context.prev = _context.next) {
74
+ case 0:
75
+ (0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigCertificateSelect.prototype), "componentDidMount", this).call(this);
76
+ value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr);
77
+ _context.next = 4;
78
+ return this.props.socket.getCertificates();
79
+
80
+ case 4:
81
+ selectOptions = _context.sent;
82
+ selectOptions = selectOptions.filter(function (el) {
83
+ return _this.props.attr.toLowerCase().endsWith(el.type);
84
+ }).map(function (el) {
85
+ return {
86
+ label: el.name,
87
+ value: el.name
88
+ };
89
+ });
90
+ selectOptions.unshift({
91
+ label: _ConfigGeneric2["default"].NONE_LABEL,
92
+ value: _ConfigGeneric2["default"].NONE_VALUE
93
+ });
94
+ this.setState({
95
+ value: value,
96
+ selectOptions: selectOptions
97
+ });
98
+
99
+ case 8:
100
+ case "end":
101
+ return _context.stop();
102
+ }
103
+ }
104
+ }, _callee, this);
105
+ }));
106
+
107
+ function componentDidMount() {
108
+ return _componentDidMount.apply(this, arguments);
109
+ }
110
+
111
+ return componentDidMount;
112
+ }()
113
+ }, {
114
+ key: "renderItem",
115
+ value: function renderItem(error, disabled, defaultValue) {
116
+ var _this$state$selectOpt,
117
+ _this2 = this,
118
+ _this$state$selectOpt2;
119
+
120
+ if (!this.state.selectOptions) {
121
+ return null;
122
+ } // eslint-disable-next-line
123
+
124
+
125
+ var item = (_this$state$selectOpt = this.state.selectOptions) === null || _this$state$selectOpt === void 0 ? void 0 : _this$state$selectOpt.find(function (item) {
126
+ return item.value === _this2.state.value;
127
+ });
128
+ return /*#__PURE__*/React.createElement(_FormControl["default"], {
129
+ className: this.props.classes.fullWidth,
130
+ variant: "standard"
131
+ }, /*#__PURE__*/React.createElement(_InputLabel["default"], {
132
+ shrink: true
133
+ }, this.getText(this.props.schema.label)), /*#__PURE__*/React.createElement(_Select["default"], {
134
+ variant: "standard",
135
+ error: !!error,
136
+ displayEmpty: true,
137
+ disabled: !!disabled,
138
+ value: this.state.value,
139
+ renderValue: function renderValue(val) {
140
+ return _this2.getText(item === null || item === void 0 ? void 0 : item.label, _this2.props.schema.noTranslation !== false);
141
+ },
142
+ onChange: function onChange(e) {
143
+ return _this2.setState({
144
+ value: e.target.value
145
+ }, function () {
146
+ return _this2.onChange(_this2.props.attr, _this2.state.value);
147
+ });
148
+ }
149
+ }, (_this$state$selectOpt2 = this.state.selectOptions) === null || _this$state$selectOpt2 === void 0 ? void 0 : _this$state$selectOpt2.map(function (item) {
150
+ return /*#__PURE__*/React.createElement(_MenuItem["default"], {
151
+ key: item.value,
152
+ value: item.value,
153
+ style: item.value === _ConfigGeneric2["default"].NONE_VALUE ? {
154
+ opacity: 0.5
155
+ } : {}
156
+ }, _this2.getText(item.label, _this2.props.schema.noTranslation !== false));
157
+ })), this.props.schema.help ? /*#__PURE__*/React.createElement(_FormHelperText["default"], null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
158
+ }
159
+ }]);
160
+ return ConfigCertificateSelect;
161
+ }(_ConfigGeneric2["default"]);
162
+
163
+ ConfigCertificateSelect.propTypes = {
164
+ socket: _propTypes["default"].object.isRequired,
165
+ themeType: _propTypes["default"].string,
166
+ themeName: _propTypes["default"].string,
167
+ style: _propTypes["default"].object,
168
+ className: _propTypes["default"].string,
169
+ data: _propTypes["default"].object.isRequired,
170
+ schema: _propTypes["default"].object,
171
+ onError: _propTypes["default"].func,
172
+ onChange: _propTypes["default"].func
173
+ };
174
+
175
+ var _default = (0, _styles.withStyles)(styles)(ConfigCertificateSelect);
176
+
177
+ exports["default"] = _default;
178
+ //# sourceMappingURL=ConfigCertificateSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigCertificateSelect.js","names":["styles","theme","fullWidth","width","ConfigCertificateSelect","value","ConfigGeneric","getValue","props","data","attr","socket","getCertificates","selectOptions","filter","el","toLowerCase","endsWith","type","map","label","name","unshift","NONE_LABEL","NONE_VALUE","setState","error","disabled","defaultValue","state","item","find","classes","getText","schema","val","noTranslation","e","target","onChange","opacity","help","renderHelp","helpLink","propTypes","PropTypes","object","isRequired","themeType","string","themeName","style","className","onError","func","withStyles"],"sources":["JsonConfigComponent/ConfigCertificateSelect.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport InputLabel from '@mui/material/InputLabel';\nimport MenuItem from '@mui/material/MenuItem';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormControl from '@mui/material/FormControl';\nimport Select from '@mui/material/Select';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = theme => ({\n fullWidth: {\n width: '100%'\n }\n});\n\nclass ConfigCertificateSelect extends ConfigGeneric {\n async componentDidMount() {\n super.componentDidMount();\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n let selectOptions = await this.props.socket.getCertificates();\n\n selectOptions = selectOptions\n .filter(el => this.props.attr.toLowerCase().endsWith(el.type))\n .map(el => ({label: el.name, value: el.name}));\n\n selectOptions.unshift({label: ConfigGeneric.NONE_LABEL, value: ConfigGeneric.NONE_VALUE});\n\n this.setState({value, selectOptions});\n }\n\n renderItem(error, disabled, defaultValue) {\n if (!this.state.selectOptions) {\n return null;\n }\n // eslint-disable-next-line\n const item = this.state.selectOptions?.find(item => item.value === this.state.value);\n\n return <FormControl className={this.props.classes.fullWidth} variant=\"standard\">\n <InputLabel shrink>{this.getText(this.props.schema.label)}</InputLabel>\n <Select\n variant=\"standard\"\n error={!!error}\n displayEmpty\n disabled={!!disabled}\n value={this.state.value}\n renderValue={val => this.getText(item?.label, this.props.schema.noTranslation !== false)}\n onChange={e =>\n this.setState({ value: e.target.value }, () =>\n this.onChange(this.props.attr, this.state.value))}\n >\n {this.state.selectOptions?.map(item =>\n <MenuItem\n key={item.value}\n value={item.value}\n style={item.value === ConfigGeneric.NONE_VALUE ? { opacity: 0.5 } : {}}>{\n this.getText(item.label, this.props.schema.noTranslation !== false)\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\nConfigCertificateSelect.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)(ConfigCertificateSelect);"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,SAAS,EAAE;MACPC,KAAK,EAAE;IADA;EADU,CAAL;AAAA,CAApB;;IAMMC,uB;;;;;;;;;;;;;6GACF;QAAA;;QAAA;QAAA;UAAA;YAAA;cAAA;gBACI;gBACMC,KAFV,GAEkBC,0BAAA,CAAcC,QAAd,CAAuB,KAAKC,KAAL,CAAWC,IAAlC,EAAwC,KAAKD,KAAL,CAAWE,IAAnD,CAFlB;gBAAA;gBAAA,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,KAAL,CAAW0B,MAAX,CAAkBO,IAAlB,gBAAyB,oBAAC,0BAAD,QAAiB,KAAKC,UAAL,CAAgB,KAAKlC,KAAL,CAAW0B,MAAX,CAAkBO,IAAlC,EAAwC,KAAKjC,KAAL,CAAW0B,MAAX,CAAkBS,QAA1D,EAAoE,KAAKnC,KAAL,CAAW0B,MAAX,CAAkBE,aAAtF,CAAjB,CAAzB,GAAmK,IArBjK,CAAP;IAuBH;;;EA7CiC9B,0B;;AAgDtCF,uBAAuB,CAACwC,SAAxB,GAAoC;EAChCjC,MAAM,EAAEkC,qBAAA,CAAUC,MAAV,CAAiBC,UADO;EAEhCC,SAAS,EAAEH,qBAAA,CAAUI,MAFW;EAGhCC,SAAS,EAAEL,qBAAA,CAAUI,MAHW;EAIhCE,KAAK,EAAEN,qBAAA,CAAUC,MAJe;EAKhCM,SAAS,EAAEP,qBAAA,CAAUI,MALW;EAMhCxC,IAAI,EAAEoC,qBAAA,CAAUC,MAAV,CAAiBC,UANS;EAOhCb,MAAM,EAAEW,qBAAA,CAAUC,MAPc;EAQhCO,OAAO,EAAER,qBAAA,CAAUS,IARa;EAShCf,QAAQ,EAAEM,qBAAA,CAAUS;AATY,CAApC;;eAYe,IAAAC,kBAAA,EAAWvD,MAAX,EAAmBI,uBAAnB,C"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+
16
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
+
18
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
+
20
+ var _propTypes = _interopRequireDefault(require("prop-types"));
21
+
22
+ var _styles = require("@mui/styles");
23
+
24
+ var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
25
+
26
+ var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
27
+
28
+ var _FormHelperText = _interopRequireDefault(require("@mui/material/FormHelperText"));
29
+
30
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
31
+
32
+ var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
33
+
34
+ var _i18n = _interopRequireDefault(require("@iobroker/adapter-react-v5/i18n"));
35
+
36
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
37
+
38
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
39
+
40
+ var styles = function styles(theme) {
41
+ return {
42
+ error: {
43
+ color: 'red'
44
+ }
45
+ };
46
+ };
47
+
48
+ var ConfigCheckbox = /*#__PURE__*/function (_ConfigGeneric) {
49
+ (0, _inherits2["default"])(ConfigCheckbox, _ConfigGeneric);
50
+
51
+ var _super = _createSuper(ConfigCheckbox);
52
+
53
+ function ConfigCheckbox() {
54
+ (0, _classCallCheck2["default"])(this, ConfigCheckbox);
55
+ return _super.apply(this, arguments);
56
+ }
57
+
58
+ (0, _createClass2["default"])(ConfigCheckbox, [{
59
+ key: "renderItem",
60
+ value: function renderItem(error, disabled) {
61
+ var _this = this;
62
+
63
+ var value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr);
64
+
65
+ var isIndeterminate = Array.isArray(value);
66
+ return /*#__PURE__*/React.createElement(_FormControl["default"], {
67
+ className: this.props.classes.fullWidth,
68
+ variant: "standard"
69
+ }, /*#__PURE__*/React.createElement(_FormControlLabel["default"], {
70
+ onClick: function onClick(e) {
71
+ e.preventDefault();
72
+ e.stopPropagation();
73
+
74
+ _this.onChange(_this.props.attr, !value);
75
+ },
76
+ control: /*#__PURE__*/React.createElement(_Checkbox["default"], {
77
+ indeterminate: isIndeterminate,
78
+ checked: !!value,
79
+ onChange: function onChange(e) {
80
+ if (isIndeterminate) {
81
+ _this.onChange(_this.props.attr, true);
82
+ } else {
83
+ _this.onChange(_this.props.attr, e.target.checked);
84
+ }
85
+ },
86
+ disabled: !!disabled
87
+ }),
88
+ label: this.getText(this.props.schema.label)
89
+ }), /*#__PURE__*/React.createElement(_FormHelperText["default"], {
90
+ className: this.props.classes.error
91
+ }, error ? this.props.schema.validatorErrorText ? _i18n["default"].t(this.props.schema.validatorErrorText) : _i18n["default"].t('Error') : null), this.props.schema.help ? /*#__PURE__*/React.createElement(_FormHelperText["default"], null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
92
+ }
93
+ }]);
94
+ return ConfigCheckbox;
95
+ }(_ConfigGeneric2["default"]);
96
+
97
+ ConfigCheckbox.propTypes = {
98
+ socket: _propTypes["default"].object.isRequired,
99
+ themeType: _propTypes["default"].string,
100
+ themeName: _propTypes["default"].string,
101
+ style: _propTypes["default"].object,
102
+ className: _propTypes["default"].string,
103
+ data: _propTypes["default"].object.isRequired,
104
+ schema: _propTypes["default"].object,
105
+ onError: _propTypes["default"].func,
106
+ onChange: _propTypes["default"].func
107
+ };
108
+
109
+ var _default = (0, _styles.withStyles)(styles)(ConfigCheckbox);
110
+
111
+ exports["default"] = _default;
112
+ //# sourceMappingURL=ConfigCheckbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigCheckbox.js","names":["styles","theme","error","color","ConfigCheckbox","disabled","value","ConfigGeneric","getValue","props","data","attr","isIndeterminate","Array","isArray","classes","fullWidth","e","preventDefault","stopPropagation","onChange","target","checked","getText","schema","label","validatorErrorText","I18n","t","help","renderHelp","helpLink","noTranslation","propTypes","socket","PropTypes","object","isRequired","themeType","string","themeName","style","className","onError","func","withStyles"],"sources":["JsonConfigComponent/ConfigCheckbox.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Checkbox from '@mui/material/Checkbox';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormControl from '@mui/material/FormControl';\n\nimport ConfigGeneric from './ConfigGeneric';\nimport I18n from '@iobroker/adapter-react-v5/i18n';\n\nconst styles = theme => ({\n error: {\n color: 'red'\n }\n});\n\nclass ConfigCheckbox extends ConfigGeneric {\n renderItem(error, disabled) {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n let isIndeterminate = Array.isArray(value);\n\n return <FormControl className={this.props.classes.fullWidth} variant=\"standard\">\n <FormControlLabel\n onClick={e => {\n e.preventDefault();\n e.stopPropagation();\n this.onChange(this.props.attr, !value);\n }}\n control={<Checkbox\n indeterminate={isIndeterminate}\n checked={!!value}\n onChange={e => {\n if (isIndeterminate) {\n this.onChange(this.props.attr, true);\n } else {\n this.onChange(this.props.attr, e.target.checked);\n }\n }}\n disabled={!!disabled}\n />}\n label={this.getText(this.props.schema.label)}\n />\n <FormHelperText className={this.props.classes.error}>{\n error ? (this.props.schema.validatorErrorText ? I18n.t(this.props.schema.validatorErrorText) : I18n.t('Error')) :\n null}</FormHelperText>\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\nConfigCheckbox.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)(ConfigCheckbox);"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,KAAK,EAAE;MACHC,KAAK,EAAE;IADJ;EADc,CAAL;AAAA,CAApB;;IAMMC,c;;;;;;;;;;;;WACF,oBAAWF,KAAX,EAAkBG,QAAlB,EAA4B;MAAA;;MACxB,IAAMC,KAAK,GAAGC,0BAAA,CAAcC,QAAd,CAAuB,KAAKC,KAAL,CAAWC,IAAlC,EAAwC,KAAKD,KAAL,CAAWE,IAAnD,CAAd;;MACA,IAAIC,eAAe,GAAGC,KAAK,CAACC,OAAN,CAAcR,KAAd,CAAtB;MAEA,oBAAO,oBAAC,uBAAD;QAAa,SAAS,EAAE,KAAKG,KAAL,CAAWM,OAAX,CAAmBC,SAA3C;QAAsD,OAAO,EAAC;MAA9D,gBACH,oBAAC,4BAAD;QACA,OAAO,EAAE,iBAAAC,CAAC,EAAI;UACVA,CAAC,CAACC,cAAF;UACAD,CAAC,CAACE,eAAF;;UACA,KAAI,CAACC,QAAL,CAAc,KAAI,CAACX,KAAL,CAAWE,IAAzB,EAA+B,CAACL,KAAhC;QACH,CALD;QAMA,OAAO,eAAE,oBAAC,oBAAD;UACL,aAAa,EAAEM,eADV;UAEL,OAAO,EAAE,CAAC,CAACN,KAFN;UAGL,QAAQ,EAAE,kBAAAW,CAAC,EAAI;YACX,IAAIL,eAAJ,EAAqB;cACjB,KAAI,CAACQ,QAAL,CAAc,KAAI,CAACX,KAAL,CAAWE,IAAzB,EAA+B,IAA/B;YACH,CAFD,MAEO;cACH,KAAI,CAACS,QAAL,CAAc,KAA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,QAAQ,EAAEe,qBAAA,CAAUS;AATG,CAA3B;;eAYe,IAAAC,kBAAA,EAAW7C,MAAX,EAAmBI,cAAnB,C"}
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
15
+
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
+
18
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
+
20
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
+
22
+ var _propTypes = _interopRequireDefault(require("prop-types"));
23
+
24
+ var _styles = require("@mui/styles");
25
+
26
+ var _FormHelperText = _interopRequireDefault(require("@mui/material/FormHelperText"));
27
+
28
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
29
+
30
+ var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
31
+
32
+ var _ChipInput = _interopRequireDefault(require("./ChipInput"));
33
+
34
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
35
+
36
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
+
38
+ var styles = function styles(theme) {
39
+ return {
40
+ fullWidth: {
41
+ width: '100%'
42
+ }
43
+ };
44
+ };
45
+
46
+ var ConfigLanguage = /*#__PURE__*/function (_ConfigGeneric) {
47
+ (0, _inherits2["default"])(ConfigLanguage, _ConfigGeneric);
48
+
49
+ var _super = _createSuper(ConfigLanguage);
50
+
51
+ function ConfigLanguage() {
52
+ (0, _classCallCheck2["default"])(this, ConfigLanguage);
53
+ return _super.apply(this, arguments);
54
+ }
55
+
56
+ (0, _createClass2["default"])(ConfigLanguage, [{
57
+ key: "componentDidMount",
58
+ value: function componentDidMount() {
59
+ (0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigLanguage.prototype), "componentDidMount", this).call(this);
60
+ var _this$props = this.props,
61
+ data = _this$props.data,
62
+ attr = _this$props.attr;
63
+
64
+ var value = _ConfigGeneric2["default"].getValue(data, attr);
65
+
66
+ if (this.props.schema.delimiter && typeof value === 'string') {
67
+ var parts = value.split(this.props.schema.delimiter).map(function (a) {
68
+ return a.trim();
69
+ }).filter(function (a) {
70
+ return a;
71
+ });
72
+ this.setState({
73
+ value: parts
74
+ });
75
+ } else {
76
+ this.setState({
77
+ value: value || []
78
+ });
79
+ }
80
+ }
81
+ }, {
82
+ key: "renderItem",
83
+ value: function renderItem(error, disabled, defaultValue) {
84
+ var _this = this;
85
+
86
+ var _this$props2 = this.props,
87
+ attr = _this$props2.attr,
88
+ schema = _this$props2.schema;
89
+ var value = this.state.value;
90
+ return /*#__PURE__*/React.createElement(_FormControl["default"], {
91
+ className: this.props.classes.fullWidth,
92
+ variant: "standard"
93
+ }, /*#__PURE__*/React.createElement(_ChipInput["default"], {
94
+ value: value,
95
+ disabled: !!disabled,
96
+ label: this.getText(schema.label),
97
+ error: !!error,
98
+ onAdd: function onAdd(chip) {
99
+ var newValue = JSON.parse(JSON.stringify(value));
100
+ newValue.push(chip);
101
+
102
+ _this.setState({
103
+ value: newValue,
104
+ prevValue: ''
105
+ }, function () {
106
+ if (_this.props.schema.delimiter) {
107
+ _this.onChange(attr, newValue.join(_this.props.schema.delimiter + ' '));
108
+ } else {
109
+ _this.onChange(attr, newValue);
110
+ }
111
+ });
112
+ },
113
+ onDelete: function onDelete(chip, index) {
114
+ var newValue = JSON.parse(JSON.stringify(value));
115
+ newValue.splice(index, 1);
116
+
117
+ _this.setState({
118
+ value: newValue,
119
+ prevValue: ''
120
+ }, function () {
121
+ if (_this.props.schema.delimiter) {
122
+ _this.onChange(attr, newValue.join(_this.props.schema.delimiter + ' '));
123
+ } else {
124
+ _this.onChange(attr, newValue);
125
+ }
126
+ });
127
+ }
128
+ }), this.props.schema.help ? /*#__PURE__*/React.createElement(_FormHelperText["default"], null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null);
129
+ }
130
+ }]);
131
+ return ConfigLanguage;
132
+ }(_ConfigGeneric2["default"]);
133
+
134
+ ConfigLanguage.propTypes = {
135
+ socket: _propTypes["default"].object.isRequired,
136
+ themeType: _propTypes["default"].string,
137
+ themeName: _propTypes["default"].string,
138
+ style: _propTypes["default"].object,
139
+ className: _propTypes["default"].string,
140
+ data: _propTypes["default"].object.isRequired,
141
+ schema: _propTypes["default"].object,
142
+ onError: _propTypes["default"].func,
143
+ onChange: _propTypes["default"].func
144
+ };
145
+
146
+ var _default = (0, _styles.withStyles)(styles)(ConfigLanguage);
147
+
148
+ exports["default"] = _default;
149
+ //# sourceMappingURL=ConfigChip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigChip.js","names":["styles","theme","fullWidth","width","ConfigLanguage","props","data","attr","value","ConfigGeneric","getValue","schema","delimiter","parts","split","map","a","trim","filter","setState","error","disabled","defaultValue","state","classes","getText","label","chip","newValue","JSON","parse","stringify","push","prevValue","onChange","join","index","splice","help","renderHelp","helpLink","noTranslation","propTypes","socket","PropTypes","object","isRequired","themeType","string","themeName","style","className","onError","func","withStyles"],"sources":["JsonConfigComponent/ConfigChip.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormControl from '@mui/material/FormControl';\n\nimport ConfigGeneric from './ConfigGeneric';\nimport ChipInput from './ChipInput';\n\nconst styles = theme => ({\n fullWidth: {\n width: '100%'\n }\n});\n\nclass ConfigLanguage extends ConfigGeneric {\n componentDidMount() {\n super.componentDidMount();\n const { data, attr } = this.props;\n const value = ConfigGeneric.getValue(data, attr);\n if (this.props.schema.delimiter && typeof value === 'string') {\n const parts = value.split(this.props.schema.delimiter).map(a => a.trim()).filter(a => a);\n this.setState({ value: parts });\n } else {\n this.setState({ value: value || [] });\n }\n }\n\n renderItem(error, disabled, defaultValue) {\n const { attr,schema } = this.props;\n const { value } = this.state;\n return <FormControl className={this.props.classes.fullWidth} variant=\"standard\">\n <ChipInput\n value={value}\n disabled={!!disabled}\n label={this.getText(schema.label)}\n error={!!error}\n onAdd={chip => {\n const newValue = JSON.parse(JSON.stringify(value));\n newValue.push(chip);\n this.setState({ value: newValue, prevValue: '' }, () => {\n if (this.props.schema.delimiter) {\n this.onChange(attr, newValue.join(this.props.schema.delimiter + ' '));\n } else {\n this.onChange(attr, newValue);\n }\n });\n }}\n onDelete={(chip, index) => {\n const newValue = JSON.parse(JSON.stringify(value));\n newValue.splice(index, 1);\n this.setState({ value: newValue, prevValue: '' }, () => {\n if (this.props.schema.delimiter) {\n this.onChange(attr, newValue.join(this.props.schema.delimiter + ' '));\n } else {\n this.onChange(attr, newValue);\n }\n });\n }}\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\nConfigLanguage.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)(ConfigLanguage);"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,SAAS,EAAE;MACPC,KAAK,EAAE;IADA;EADU,CAAL;AAAA,CAApB;;IAMMC,c;;;;;;;;;;;;WACF,6BAAoB;MAChB;MACA,kBAAuB,KAAKC,KAA5B;MAAA,IAAQC,IAAR,eAAQA,IAAR;MAAA,IAAcC,IAAd,eAAcA,IAAd;;MACA,IAAMC,KAAK,GAAGC,0BAAA,CAAcC,QAAd,CAAuBJ,IAAvB,EAA6BC,IAA7B,CAAd;;MACA,IAAI,KAAKF,KAAL,CAAWM,MAAX,CAAkBC,SAAlB,IAA+B,OAAOJ,KAAP,KAAiB,QAApD,EAA8D;QAC1D,IAAMK,KAAK,GAAGL,KAAK,CAACM,KAAN,CAAY,KAAKT,KAAL,CAAWM,MAAX,CAAkBC,SAA9B,EAAyCG,GAAzC,CAA6C,UAAAC,CAAC;UAAA,OAAIA,CAAC,CAACC,IAAF,EAAJ;QAAA,CAA9C,EAA4DC,MAA5D,CAAmE,UAAAF,CAAC;UAAA,OAAIA,CAAJ;QAAA,CAApE,CAAd;QACA,KAAKG,QAAL,CAAc;UAAEX,KAAK,EAAEK;QAAT,CAAd;MACH,CAHD,MAGO;QACH,KAAKM,QAAL,CAAc;UAAEX,KAAK,EAAEA,KAAK,IAAI;QAAlB,CAAd;MACH;IACJ;;;WAED,oBAAWY,KAAX,EAAkBC,QAAlB,EAA4BC,YAA5B,EAA0C;MAAA;;MACtC,mBAAwB,KAAKjB,KAA7B;MAAA,IAAQE,IAAR,gBAAQA,IAAR;MAAA,IAAaI,MAAb,gBAAaA,MAAb;MACA,IAAQH,KAAR,GAAkB,KAAKe,KAA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,CAAC5B,KAAL,CAAWM,MAAX,CAAkBC,SAAtB,EAAiC;cAC7B,KAAI,CAACsB,QAAL,CAAc3B,IAAd,EAAoBqB,QAAQ,CAACO,IAAT,CAAc,KAAI,CAAC9B,KAAL,CAAWM,MAAX,CAAkBC,SAAlB,GAA8B,GAA5C,CAApB;YACH,CAFD,MAEO;cACH,KAAI,CAACsB,QAAL,CAAc3B,IAAd,EAAoBqB,QAApB;YACH;UACJ,CAND;QAOH;MA1BL,EADG,EA6BF,KAAKvB,KAAL,CAAWM,MAAX,CAAkB2B,IAAlB,gBAAyB,oBAAC,0BAAD,QAAiB,KAAKC,UAAL,CAAgB,KAAKlC,KAAL,CAAWM,MAAX,CAAkB2B,IAAlC,EAAwC,KAAKjC,KAAL,CAAWM,MAAX,CAAkB6B,QAA1D,EAAoE,KAAKnC,KAAL,CAAWM,MAAX,CAAkB8B,aAAtF,CAAjB,CAAzB,GAAmK,IA7BjK,CAAP;IA+BH;;;EA/CwBhC,0B;;AAkD7BL,cAAc,CAACsC,SAAf,GAA2B;EACvBC,MAAM,EAAEC,qBAAA,CAAUC,MAAV,CAAiBC,UADF;EAEvBC,SAAS,EAAEH,qBAAA,CAAUI,MAFE;EAGvBC,SAAS,EAAEL,qBAAA,CAAUI,MAHE;EAIvBE,KAAK,EAAEN,qBAAA,CAAUC,MAJM;EAKvBM,SAAS,EAAEP,qBAAA,CAAUI,MALE;EAMvB1C,IAAI,EAAEsC,qBAAA,CAAUC,MAAV,CAAiBC,UANA;EAOvBnC,MAAM,EAAEiC,qBAAA,CAAUC,MAPK;EAQvBO,OAAO,EAAER,qBAAA,CAAUS,IARI;EASvBnB,QAAQ,EAAEU,qBAAA,CAAUS;AATG,CAA3B;;eAYe,IAAAC,kBAAA,EAAWtD,MAAX,EAAmBI,cAAnB,C"}
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+
16
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
+
18
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
+
20
+ var _propTypes = _interopRequireDefault(require("prop-types"));
21
+
22
+ var _styles = require("@mui/styles");
23
+
24
+ var _reactColor = require("react-color");
25
+
26
+ var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
27
+
28
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
29
+
30
+ var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
31
+
32
+ var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
33
+
34
+ var _Utils = _interopRequireDefault(require("@iobroker/adapter-react-v5/Components/Utils"));
35
+
36
+ var _ColorPicker = _interopRequireDefault(require("@iobroker/adapter-react-v5/Components/ColorPicker"));
37
+
38
+ var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
39
+
40
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
41
+
42
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
43
+
44
+ var styles = function styles(theme) {
45
+ return {};
46
+ };
47
+
48
+ var ConfigColor = /*#__PURE__*/function (_ConfigGeneric) {
49
+ (0, _inherits2["default"])(ConfigColor, _ConfigGeneric);
50
+
51
+ var _super = _createSuper(ConfigColor);
52
+
53
+ function ConfigColor() {
54
+ (0, _classCallCheck2["default"])(this, ConfigColor);
55
+ return _super.apply(this, arguments);
56
+ }
57
+
58
+ (0, _createClass2["default"])(ConfigColor, [{
59
+ key: "renderColorDialog",
60
+ value: function renderColorDialog() {
61
+ var _this = this;
62
+
63
+ return !!this.state.showColorDialog && /*#__PURE__*/React.createElement(_Dialog["default"], {
64
+ onClose: function onClose() {
65
+ return _this.setState({
66
+ showColorDialog: false
67
+ });
68
+ },
69
+ open: this.state.showColorDialog
70
+ }, /*#__PURE__*/React.createElement(_reactColor.ChromePicker, {
71
+ color: this.state.colorDialogValue,
72
+ onChange: function onChange(value) {
73
+ _this.setState({
74
+ colorDialogValue: value
75
+ }, function () {
76
+ return _this.onChange(_this.props.attr, _ColorPicker["default"].getColor(_this.state.colorDialogValue, true));
77
+ });
78
+ }
79
+ }));
80
+ }
81
+ }, {
82
+ key: "renderItem",
83
+ value: function renderItem(error, disabled, defaultValue) {
84
+ var _this2 = this;
85
+
86
+ var value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr);
87
+
88
+ var textColor = _Utils["default"].isUseBright(value, null);
89
+
90
+ if (textColor === null) {
91
+ textColor = undefined;
92
+ }
93
+
94
+ return /*#__PURE__*/React.createElement(React.Fragment, null, this.renderColorDialog(), /*#__PURE__*/React.createElement(_TextField["default"], {
95
+ variant: "standard",
96
+ disabled: !!disabled,
97
+ style: {
98
+ minWidth: 100,
99
+ width: 'calc(100% - 8px)'
100
+ },
101
+ label: this.getText(this.props.schema.label),
102
+ value: value || '',
103
+ onClick: function onClick() {
104
+ return _this2.setState({
105
+ showColorDialog: true,
106
+ colorDialogValue: value
107
+ });
108
+ },
109
+ onChange: function onChange(e) {
110
+ var color = e.target.value;
111
+
112
+ _this2.onChange(_this2.props.attr, color);
113
+ },
114
+ inputProps: {
115
+ style: {
116
+ //paddingLeft: noPadding ? 0 : 8,
117
+ backgroundColor: value,
118
+ color: textColor ? '#FFF' : '#000'
119
+ }
120
+ },
121
+ InputProps: {
122
+ endAdornment: value ? /*#__PURE__*/React.createElement(_IconButton["default"], {
123
+ disabled: !!this.props.onPaste,
124
+ size: "small",
125
+ onClick: function onClick(e) {
126
+ e.stopPropagation();
127
+
128
+ _this2.onChange(_this2.props.attr, '');
129
+ }
130
+ }, /*#__PURE__*/React.createElement(_Close["default"], null)) : undefined
131
+ },
132
+ InputLabelProps: {
133
+ shrink: true
134
+ }
135
+ }));
136
+ }
137
+ }]);
138
+ return ConfigColor;
139
+ }(_ConfigGeneric2["default"]);
140
+
141
+ ConfigColor.propTypes = {
142
+ socket: _propTypes["default"].object.isRequired,
143
+ themeType: _propTypes["default"].string,
144
+ themeName: _propTypes["default"].string,
145
+ style: _propTypes["default"].object,
146
+ className: _propTypes["default"].string,
147
+ data: _propTypes["default"].object.isRequired,
148
+ schema: _propTypes["default"].object,
149
+ onError: _propTypes["default"].func,
150
+ onChange: _propTypes["default"].func
151
+ };
152
+
153
+ var _default = (0, _styles.withStyles)(styles)(ConfigColor);
154
+
155
+ exports["default"] = _default;
156
+ //# sourceMappingURL=ConfigColor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigColor.js","names":["styles","theme","ConfigColor","state","showColorDialog","setState","colorDialogValue","value","onChange","props","attr","ColorPicker","getColor","error","disabled","defaultValue","ConfigGeneric","getValue","data","textColor","Utils","isUseBright","undefined","renderColorDialog","minWidth","width","getText","schema","label","e","color","target","style","backgroundColor","endAdornment","onPaste","stopPropagation","shrink","propTypes","socket","PropTypes","object","isRequired","themeType","string","themeName","className","onError","func","withStyles"],"sources":["JsonConfigComponent/ConfigColor.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport {withStyles} from '@mui/styles';\nimport { ChromePicker } from 'react-color';\n\nimport IconButton from '@mui/material/IconButton';\nimport TextField from '@mui/material/TextField';\nimport Dialog from '@mui/material/Dialog';\n\nimport ClearIcon from '@mui/icons-material/Close';\n\nimport Utils from '@iobroker/adapter-react-v5/Components/Utils';\nimport ColorPicker from '@iobroker/adapter-react-v5/Components/ColorPicker';\n\nimport ConfigGeneric from './ConfigGeneric';\n\nconst styles = theme => ({});\n\nclass ConfigColor extends ConfigGeneric {\n renderColorDialog() {\n return !!this.state.showColorDialog && <Dialog\n onClose={() => this.setState({showColorDialog: false})}\n open={this.state.showColorDialog}>\n <ChromePicker\n color={this.state.colorDialogValue}\n onChange={value => {\n this.setState({colorDialogValue: value}, () =>\n this.onChange(this.props.attr, ColorPicker.getColor(this.state.colorDialogValue, true)));\n }}\n />\n </Dialog>;\n }\n\n renderItem(error, disabled, defaultValue) {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n let textColor = Utils.isUseBright(value, null);\n if (textColor === null) {\n textColor = undefined;\n }\n return <>\n { this.renderColorDialog() }\n <TextField\n variant=\"standard\"\n disabled={!!disabled}\n style={{minWidth: 100, width: 'calc(100% - 8px)'}}\n label={this.getText(this.props.schema.label)}\n value={value || ''}\n onClick={() => this.setState({showColorDialog: true, colorDialogValue: value})}\n onChange={e => {\n const color = e.target.value;\n this.onChange(this.props.attr, color);\n }}\n inputProps={{\n style: {\n //paddingLeft: noPadding ? 0 : 8,\n backgroundColor: value,\n color: textColor ? '#FFF' : '#000'\n }\n }}\n InputProps={{\n endAdornment: value ?\n <IconButton\n disabled={!!this.props.onPaste}\n size=\"small\"\n onClick={e => {\n e.stopPropagation();\n this.onChange(this.props.attr, '');\n }}>\n <ClearIcon/>\n </IconButton>\n : undefined,\n }}\n InputLabelProps={{shrink: true}}\n />\n </>;\n }\n}\n\nConfigColor.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)(ConfigColor);"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK,EAAL;AAAA,CAApB;;IAEMC,W;;;;;;;;;;;;WACF,6BAAoB;MAAA;;MAChB,OAAO,CAAC,CAAC,KAAKC,KAAL,CAAWC,eAAb,iBAAgC,oBAAC,kBAAD;QACnC,OAAO,EAAE;UAAA,OAAM,KAAI,CAACC,QAAL,CAAc;YAACD,eAAe,EAAE;UAAlB,CAAd,CAAN;QAAA,CAD0B;QAEnC,IAAI,EAAE,KAAKD,KAAL,CAAWC;MAFkB,gBAGnC,oBAAC,wBAAD;QACI,KAAK,EAAE,KAAKD,KAAL,CAAWG,gBADtB;QAEI,QAAQ,EAAE,kBAAAC,KAAK,EAAI;UACf,KAAI,CAACF,QAAL,CAAc;YAACC,gBAAgB,EAAEC;UAAnB,CAAd,EAAyC;YAAA,OACrC,KAAI,CAACC,QAAL,CAAc,KAAI,CAACC,KAAL,CAAWC,IAAzB,EAA+BC,uBAAA,CAAYC,QAAZ,CAAqB,KAAI,CAACT,KAAL,CAAWG,gBAAhC,EAAkD,IAAlD,CAA/B,CADqC;UAAA,CAAzC;QAEH;MALL,EAHmC,CAAvC;IAWH;;;WAED,oBAAWO,KAAX,EAAkBC,QAAlB,EAA4BC,YAA5B,EAA0C;MAAA;;MACtC,IAAMR,KAAK,GAAGS,0BAAA,CAAcC,QAAd,CAAuB,KAAKR,KAAL,CAAWS,IAAlC,EAAwC,KAAKT,KAAL,CAAWC,IAAnD,CAAd;;MACA,IAAIS,SAAS,GAAGC,iBAAA,CAAMC,WAAN,CAAkBd,KAAlB,EAAyB,IAAzB,CAAhB;;MACA,IAAIY,SAAS,KAAK,IAAlB,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