@iobroker/adapter-react-v5 4.0.2 → 4.0.4
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/ColorPicker.d.ts +2 -0
- package/Components/ColorPicker.js +51 -9
- package/Components/ColorPicker.js.map +1 -1
- package/README.md +4 -1
- package/i18n.js +3 -0
- package/i18n.js.map +1 -1
- package/package.json +6 -6
|
@@ -122,6 +122,7 @@ declare class ColorPicker extends React.Component<ColorPickerProps, any, any> {
|
|
|
122
122
|
* @private
|
|
123
123
|
*/
|
|
124
124
|
private handleChange;
|
|
125
|
+
renderCustomPalette(): JSX.Element;
|
|
125
126
|
render(): JSX.Element;
|
|
126
127
|
}
|
|
127
128
|
declare namespace ColorPicker {
|
|
@@ -132,6 +133,7 @@ declare namespace ColorPicker {
|
|
|
132
133
|
const name: PropTypes.Requireable<string>;
|
|
133
134
|
const style: PropTypes.Requireable<object>;
|
|
134
135
|
const className: PropTypes.Requireable<string>;
|
|
136
|
+
const customPalette: PropTypes.Requireable<any[]>;
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
import React from "react";
|
|
@@ -78,6 +78,16 @@ var styles = function styles(theme) {
|
|
|
78
78
|
},
|
|
79
79
|
picker: {
|
|
80
80
|
background: "".concat(theme.palette.background.paper, " !important")
|
|
81
|
+
},
|
|
82
|
+
iconButton: {
|
|
83
|
+
width: 16,
|
|
84
|
+
height: 16
|
|
85
|
+
},
|
|
86
|
+
button: {
|
|
87
|
+
width: 32,
|
|
88
|
+
height: 32,
|
|
89
|
+
minWidth: 32,
|
|
90
|
+
minHeight: 32
|
|
81
91
|
}
|
|
82
92
|
};
|
|
83
93
|
};
|
|
@@ -145,9 +155,40 @@ var ColorPicker = /*#__PURE__*/function (_React$Component) {
|
|
|
145
155
|
* @param {{ color: Color; }} state
|
|
146
156
|
*/
|
|
147
157
|
(0, _createClass2["default"])(ColorPicker, [{
|
|
158
|
+
key: "renderCustomPalette",
|
|
159
|
+
value: function renderCustomPalette() {
|
|
160
|
+
var _this2 = this;
|
|
161
|
+
if (!this.props.customPalette) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
165
|
+
style: {
|
|
166
|
+
width: '100%',
|
|
167
|
+
display: 'flex',
|
|
168
|
+
flexWrap: 'flex'
|
|
169
|
+
}
|
|
170
|
+
}, this.props.customPalette.map(function (color) {
|
|
171
|
+
return /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
172
|
+
className: _this2.props.classes.button,
|
|
173
|
+
key: color,
|
|
174
|
+
onClick: function onClick() {
|
|
175
|
+
_this2.handleChange(color);
|
|
176
|
+
setTimeout(function () {
|
|
177
|
+
return _this2.handleClose();
|
|
178
|
+
}, 300);
|
|
179
|
+
}
|
|
180
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
181
|
+
className: _this2.props.classes.iconButton,
|
|
182
|
+
style: {
|
|
183
|
+
background: color
|
|
184
|
+
}
|
|
185
|
+
}));
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
}, {
|
|
148
189
|
key: "render",
|
|
149
190
|
value: function render() {
|
|
150
|
-
var
|
|
191
|
+
var _this3 = this;
|
|
151
192
|
var color = ColorPicker.getColor(this.state.color);
|
|
152
193
|
var style = _objectSpread({}, this.props.style || {});
|
|
153
194
|
style.position = 'relative';
|
|
@@ -171,12 +212,12 @@ var ColorPicker = /*#__PURE__*/function (_React$Component) {
|
|
|
171
212
|
root: this.props.classes.textDense
|
|
172
213
|
},
|
|
173
214
|
onChange: function onChange(e) {
|
|
174
|
-
return
|
|
215
|
+
return _this3.handleChange(e.target.value);
|
|
175
216
|
}
|
|
176
217
|
}), color ? /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
177
218
|
disabled: this.props.disabled,
|
|
178
219
|
onClick: function onClick() {
|
|
179
|
-
return
|
|
220
|
+
return _this3.handleChange('');
|
|
180
221
|
},
|
|
181
222
|
size: "small",
|
|
182
223
|
className: this.props.classes.delButton,
|
|
@@ -187,7 +228,7 @@ var ColorPicker = /*#__PURE__*/function (_React$Component) {
|
|
|
187
228
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Delete, null)) : null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
188
229
|
className: "".concat(this.props.classes.swatch).concat(this.props.disabled ? " ".concat(this.props.classes.swatchDisabled) : ''),
|
|
189
230
|
onClick: function onClick(e) {
|
|
190
|
-
return !
|
|
231
|
+
return !_this3.props.disabled && _this3.handleClick(e);
|
|
191
232
|
}
|
|
192
233
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
193
234
|
className: this.props.classes.color,
|
|
@@ -202,13 +243,13 @@ var ColorPicker = /*#__PURE__*/function (_React$Component) {
|
|
|
202
243
|
anchorEl: this.state.anchorEl,
|
|
203
244
|
open: !0,
|
|
204
245
|
onClose: function onClose() {
|
|
205
|
-
return
|
|
246
|
+
return _this3.handleClose();
|
|
206
247
|
}
|
|
207
248
|
}, /*#__PURE__*/_react["default"].createElement(_reactColor.ChromePicker, {
|
|
208
249
|
className: this.props.classes.picker,
|
|
209
250
|
color: this.state.color,
|
|
210
251
|
onChangeComplete: function onChangeComplete(_color) {
|
|
211
|
-
return
|
|
252
|
+
return _this3.handleChange(_color);
|
|
212
253
|
},
|
|
213
254
|
styles: {
|
|
214
255
|
picker: {
|
|
@@ -218,9 +259,9 @@ var ColorPicker = /*#__PURE__*/function (_React$Component) {
|
|
|
218
259
|
}), /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
219
260
|
className: this.props.classes.closeButton,
|
|
220
261
|
onClick: function onClick() {
|
|
221
|
-
return
|
|
262
|
+
return _this3.handleClose();
|
|
222
263
|
}
|
|
223
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Close, null))) : null);
|
|
264
|
+
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Close, null)), this.renderCustomPalette()) : null);
|
|
224
265
|
}
|
|
225
266
|
}], [{
|
|
226
267
|
key: "getDerivedStateFromProps",
|
|
@@ -290,7 +331,8 @@ ColorPicker.propTypes = {
|
|
|
290
331
|
onChange: _propTypes["default"].func.isRequired,
|
|
291
332
|
name: _propTypes["default"].string,
|
|
292
333
|
style: _propTypes["default"].object,
|
|
293
|
-
className: _propTypes["default"].string
|
|
334
|
+
className: _propTypes["default"].string,
|
|
335
|
+
customPalette: _propTypes["default"].array
|
|
294
336
|
};
|
|
295
337
|
|
|
296
338
|
/** @type {typeof ColorPicker} */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.js","names":["styles","theme","color","width","height","borderRadius","delButton","marginTop","swatch","padding","background","boxShadow","display","cursor","verticalAlign","swatchDisabled","opacity","popover","backgroundColor","textAlign","popoverList","closeButton","palette","paper","secondary","main","cover","position","top","right","bottom","left","textDense","marginBottom","picker","ColorPicker","props","e","setState","displayColorPicker","state","anchorEl","currentTarget","onChange","getColor","value","style","className","disabled","marginRight","name","root","classes","handleChange","target","handleClick","list","handleClose","_color","pColor","sColor","isHex","rgb","r","toString","padStart","g","b","a","rgb2hex","m","match","parseInt","length","React","Component","propTypes","PropTypes","bool","string","func","isRequired","object","_export","withStyles"],"sources":["ColorPicker.js"],"sourcesContent":["/**\n * Copyright 2018-2022 bluefox <dogafox@gmail.com>\n *\n * Licensed under the Creative Commons Attribution-NonCommercial License, Version 4.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://creativecommons.org/licenses/by-nc/4.0/legalcode.txt\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\nimport React from 'react';\nimport { ChromePicker } from 'react-color';\nimport PropTypes from 'prop-types';\nimport withStyles from '@mui/styles/withStyles';\n\nimport { TextField, Menu, IconButton } from '@mui/material';\nimport { Delete as IconDelete, Close as IconClose } from '@mui/icons-material';\n\nconst styles = theme => ({\n color: {\n width: 36,\n height: 14,\n borderRadius: 2,\n },\n delButton: {\n // width: 32,\n // height: 32,\n marginTop: 16,\n },\n swatch: {\n marginTop: 16,\n padding: 5,\n background: '#fff',\n borderRadius: 1,\n boxShadow: '0 0 0 1px rgba(0,0,0,.1)',\n display: 'inline-block',\n cursor: 'pointer',\n verticalAlign: 'middle',\n },\n swatchDisabled: {\n opacity: 0.5,\n cursor: 'default',\n },\n popover: {\n // position: 'absolute',\n // zIndex: 2,\n backgroundColor: '#00000000',\n textAlign: 'right',\n },\n popoverList: {\n padding: 0,\n },\n closeButton: {\n backgroundColor: `${theme.palette.background.paper} !important`,\n borderRadius: '0 0 25% 25%',\n '&:hover': {\n backgroundColor: `${theme.palette.secondary.main} !important`,\n },\n },\n cover: {\n position: 'fixed',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n },\n textDense: {\n marginTop: 0,\n marginBottom: 0,\n },\n picker: {\n background: `${theme.palette.background.paper} !important`,\n },\n});\n\n/**\n * @typedef {object} Rgb\n * @property {number} r The red component of the color (0-255).\n * @property {number} g The green component of the color (0-255).\n * @property {number} b The blue component of the color (0-255).\n * @property {number} a The alpha component of the color (0-255).\n *\n * @typedef {string | Rgb | { rgb: Rgb }} Color Definition of a color.\n *\n * @typedef {object} ColorPickerProps\n * @property {boolean} [disabled] Set to true to disable the color picker.\n * @property {Color} [value] The currently selected color.\n * @property {(rgba: string) => void} [onChange] The color change callback.\n * @property {string} [name] The name.\n * @property {React.CSSProperties} [style] Additional styling for this component.\n * @property {string} [className] The CSS class name.\n * @property {boolean} [openAbove] Open the color picker above the field?\n *\n * @extends {React.Component<ColorPickerProps>}\n */\nclass ColorPicker extends React.Component {\n /**\n * @param {Readonly<ColorPickerProps>} props\n */\n constructor(props) {\n super(props);\n this.state = {\n displayColorPicker: false,\n color: this.props.value || this.props.color,\n anchorEl: null,\n };\n }\n\n /**\n * Get the state derived from the given properties and state.\n * @param {{ color: Color; }} props\n * @param {{ color: Color; }} state\n */\n static getDerivedStateFromProps(props, state) {\n const pColor = ColorPicker.getColor(props.value || props.color);\n const sColor = ColorPicker.getColor(state.color);\n if (pColor !== sColor) {\n return { color: props.value || props.color };\n }\n return null;\n }\n\n /**\n * @private\n */\n handleClick = e => {\n this.setState({ displayColorPicker: !this.state.displayColorPicker, anchorEl: this.state.displayColorPicker ? null : e.currentTarget });\n };\n\n /**\n * @private\n */\n handleClose = () => {\n this.setState({ displayColorPicker: false, anchorEl: null });\n };\n\n /**\n * Convert the given color to hex ('#rrggbb') or rgba ('rgba(r,g,b,a)') format.\n * @param {Color} [color]\n * @param {boolean} [isHex] The returning string should be in hex format\n * @returns {string} the hex or rgba representation of the given color.\n */\n static getColor(color, isHex) {\n if (color && typeof color === 'object') {\n if (color.rgb) {\n if (isHex) {\n return `#${color.rgb.r.toString(16).padStart(2, '0')}${color.rgb.g.toString(16).padStart(2, '0')}${color.rgb.b.toString(16).padStart(2, '0')}`;\n }\n return `rgba(${color.rgb.r},${color.rgb.g},${color.rgb.b},${color.rgb.a})`;\n }\n if (isHex) {\n return `#${color.r.toString(16).padStart(2, '0')}${color.g.toString(16).padStart(2, '0')}${color.b.toString(16).padStart(2, '0')}`;\n }\n return `rgba(${color.r},${color.g},${color.b},${color.a})`;\n }\n return isHex ? ColorPicker.rgb2hex(color || '') : color || '';\n }\n\n /**\n * Convert rgb() or rgba() format to hex format #rrggbb.\n * @param {string} rgb\n * @returns {string}\n */\n static rgb2hex(rgb) {\n const m = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n\n const r = parseInt(m[1], 10).toString(16).padStart(2, '0');\n const g = parseInt(m[2], 10).toString(16).padStart(2, '0');\n const b = parseInt(m[3], 10).toString(16).padStart(2, '0');\n\n return m && m.length === 4 ? `#${r}${g}${b}` : rgb;\n }\n\n /**\n * @private\n */\n handleChange = color => {\n this.setState({ color }, () =>\n this.props.onChange && this.props.onChange(ColorPicker.getColor(color)));\n };\n\n render() {\n const color = ColorPicker.getColor(this.state.color);\n\n const style = {...(this.props.style || {})};\n style.position = 'relative';\n\n return <div\n style={ style }\n className={this.props.className || ''}\n >\n <TextField\n disabled={this.props.disabled}\n variant=\"standard\"\n id=\"name\"\n style={color ? { width: 'calc(100% - 80px)' } : { width: 'calc(100% - 54px)', marginRight: 8 }}\n label={ this.props.name || 'color' }\n value={color}\n margin=\"dense\"\n classes={{ root: this.props.classes.textDense }}\n onChange={e => this.handleChange(e.target.value)}\n />\n {color ? <IconButton\n disabled={this.props.disabled}\n onClick={() => this.handleChange('')}\n size=\"small\"\n className={this.props.classes.delButton}\n style={color ? {} : { opacity: 0, cursor: 'default' }}\n >\n <IconDelete />\n </IconButton> : null}\n <div className={`${this.props.classes.swatch}${this.props.disabled ? ` ${this.props.classes.swatchDisabled}` : ''}`} onClick={e => !this.props.disabled && this.handleClick(e)}>\n <div className={this.props.classes.color} style={{ background: color }} />\n </div>\n { this.state.displayColorPicker && !this.props.disabled ? <Menu\n classes={{ paper: this.props.classes.popover, list: this.props.classes.popoverList }}\n anchorEl={this.state.anchorEl}\n open={!0}\n onClose={() => this.handleClose()}\n >\n <ChromePicker\n className={this.props.classes.picker}\n color={this.state.color}\n onChangeComplete={_color => this.handleChange(_color)}\n styles={{ picker: { background: '#112233' } }}\n />\n <IconButton className={this.props.classes.closeButton} onClick={() => this.handleClose()}><IconClose /></IconButton>\n </Menu> : null }\n </div>;\n }\n}\n\nColorPicker.propTypes = {\n disabled: PropTypes.bool,\n value: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n name: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n};\n\n/** @type {typeof ColorPicker} */\nconst _export = withStyles(styles)(ColorPicker);\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;AAeA;AACA;AACA;AACA;AAE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SAAGG,CAAC,SAAGC,CAAC,IAAKL,GAAG;IACtD;;IAEA;AACJ;AACA;EAFI;EAAA;AAAA,EA9EsBY,iBAAK,CAACC,SAAS;AAyIzCxC,WAAW,CAACyC,SAAS,GAAG;EACpB5B,QAAQ,EAAE6B,qBAAS,CAACC,IAAI;EACxBjC,KAAK,EAAEgC,qBAAS,CAACE,MAAM;EACvBpC,QAAQ,EAAEkC,qBAAS,CAACG,IAAI,CAACC,UAAU;EACnC/B,IAAI,EAAE2B,qBAAS,CAACE,MAAM;EACtBjC,KAAK,EAAE+B,qBAAS,CAACK,MAAM;EACvBnC,SAAS,EAAE8B,qBAAS,CAACE;AACzB,CAAC;;AAED;AACA,IAAMI,OAAO,GAAG,IAAAC,sBAAU,EAACpF,MAAM,CAAC,CAACmC,WAAW,CAAC;AAAC,eACjCgD,OAAO;AAAA"}
|
|
1
|
+
{"version":3,"file":"ColorPicker.js","names":["styles","theme","color","width","height","borderRadius","delButton","marginTop","swatch","padding","background","boxShadow","display","cursor","verticalAlign","swatchDisabled","opacity","popover","backgroundColor","textAlign","popoverList","closeButton","palette","paper","secondary","main","cover","position","top","right","bottom","left","textDense","marginBottom","picker","iconButton","button","minWidth","minHeight","ColorPicker","props","e","setState","displayColorPicker","state","anchorEl","currentTarget","onChange","getColor","value","customPalette","flexWrap","map","classes","handleChange","setTimeout","handleClose","style","className","disabled","marginRight","name","root","target","handleClick","list","_color","renderCustomPalette","pColor","sColor","isHex","rgb","r","toString","padStart","g","b","a","rgb2hex","m","match","parseInt","length","React","Component","propTypes","PropTypes","bool","string","func","isRequired","object","array","_export","withStyles"],"sources":["ColorPicker.js"],"sourcesContent":["/**\n * Copyright 2018-2022 bluefox <dogafox@gmail.com>\n *\n * Licensed under the Creative Commons Attribution-NonCommercial License, Version 4.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://creativecommons.org/licenses/by-nc/4.0/legalcode.txt\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\nimport React from 'react';\nimport { ChromePicker } from 'react-color';\nimport PropTypes from 'prop-types';\nimport withStyles from '@mui/styles/withStyles';\n\nimport { TextField, Menu, IconButton, Button } from '@mui/material';\nimport { Delete as IconDelete, Close as IconClose } from '@mui/icons-material';\n\nconst styles = theme => ({\n color: {\n width: 36,\n height: 14,\n borderRadius: 2,\n },\n delButton: {\n // width: 32,\n // height: 32,\n marginTop: 16,\n },\n swatch: {\n marginTop: 16,\n padding: 5,\n background: '#fff',\n borderRadius: 1,\n boxShadow: '0 0 0 1px rgba(0,0,0,.1)',\n display: 'inline-block',\n cursor: 'pointer',\n verticalAlign: 'middle',\n },\n swatchDisabled: {\n opacity: 0.5,\n cursor: 'default',\n },\n popover: {\n // position: 'absolute',\n // zIndex: 2,\n backgroundColor: '#00000000',\n textAlign: 'right',\n },\n popoverList: {\n padding: 0,\n },\n closeButton: {\n backgroundColor: `${theme.palette.background.paper} !important`,\n borderRadius: '0 0 25% 25%',\n '&:hover': {\n backgroundColor: `${theme.palette.secondary.main} !important`,\n },\n },\n cover: {\n position: 'fixed',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n },\n textDense: {\n marginTop: 0,\n marginBottom: 0,\n },\n picker: {\n background: `${theme.palette.background.paper} !important`,\n },\n iconButton: {\n width: 16,\n height: 16,\n },\n button: {\n width: 32,\n height: 32,\n minWidth: 32,\n minHeight: 32,\n },\n});\n\n/**\n * @typedef {object} Rgb\n * @property {number} r The red component of the color (0-255).\n * @property {number} g The green component of the color (0-255).\n * @property {number} b The blue component of the color (0-255).\n * @property {number} a The alpha component of the color (0-255).\n *\n * @typedef {string | Rgb | { rgb: Rgb }} Color Definition of a color.\n *\n * @typedef {object} ColorPickerProps\n * @property {boolean} [disabled] Set to true to disable the color picker.\n * @property {Color} [value] The currently selected color.\n * @property {(rgba: string) => void} [onChange] The color change callback.\n * @property {string} [name] The name.\n * @property {React.CSSProperties} [style] Additional styling for this component.\n * @property {string} [className] The CSS class name.\n * @property {boolean} [openAbove] Open the color picker above the field?\n *\n * @extends {React.Component<ColorPickerProps>}\n */\nclass ColorPicker extends React.Component {\n /**\n * @param {Readonly<ColorPickerProps>} props\n */\n constructor(props) {\n super(props);\n this.state = {\n displayColorPicker: false,\n color: this.props.value || this.props.color,\n anchorEl: null,\n };\n }\n\n /**\n * Get the state derived from the given properties and state.\n * @param {{ color: Color; }} props\n * @param {{ color: Color; }} state\n */\n static getDerivedStateFromProps(props, state) {\n const pColor = ColorPicker.getColor(props.value || props.color);\n const sColor = ColorPicker.getColor(state.color);\n if (pColor !== sColor) {\n return { color: props.value || props.color };\n }\n return null;\n }\n\n /**\n * @private\n */\n handleClick = e => {\n this.setState({ displayColorPicker: !this.state.displayColorPicker, anchorEl: this.state.displayColorPicker ? null : e.currentTarget });\n };\n\n /**\n * @private\n */\n handleClose = () => {\n this.setState({ displayColorPicker: false, anchorEl: null });\n };\n\n /**\n * Convert the given color to hex ('#rrggbb') or rgba ('rgba(r,g,b,a)') format.\n * @param {Color} [color]\n * @param {boolean} [isHex] The returning string should be in hex format\n * @returns {string} the hex or rgba representation of the given color.\n */\n static getColor(color, isHex) {\n if (color && typeof color === 'object') {\n if (color.rgb) {\n if (isHex) {\n return `#${color.rgb.r.toString(16).padStart(2, '0')}${color.rgb.g.toString(16).padStart(2, '0')}${color.rgb.b.toString(16).padStart(2, '0')}`;\n }\n return `rgba(${color.rgb.r},${color.rgb.g},${color.rgb.b},${color.rgb.a})`;\n }\n if (isHex) {\n return `#${color.r.toString(16).padStart(2, '0')}${color.g.toString(16).padStart(2, '0')}${color.b.toString(16).padStart(2, '0')}`;\n }\n return `rgba(${color.r},${color.g},${color.b},${color.a})`;\n }\n return isHex ? ColorPicker.rgb2hex(color || '') : color || '';\n }\n\n /**\n * Convert rgb() or rgba() format to hex format #rrggbb.\n * @param {string} rgb\n * @returns {string}\n */\n static rgb2hex(rgb) {\n const m = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n\n const r = parseInt(m[1], 10).toString(16).padStart(2, '0');\n const g = parseInt(m[2], 10).toString(16).padStart(2, '0');\n const b = parseInt(m[3], 10).toString(16).padStart(2, '0');\n\n return m && m.length === 4 ? `#${r}${g}${b}` : rgb;\n }\n\n /**\n * @private\n */\n handleChange = color => {\n this.setState({ color }, () =>\n this.props.onChange && this.props.onChange(ColorPicker.getColor(color)));\n };\n\n renderCustomPalette() {\n if (!this.props.customPalette) {\n return null;\n }\n return <div style={{ width: '100%', display: 'flex', flexWrap: 'flex' }}>\n {this.props.customPalette.map(color =>\n <Button\n className={this.props.classes.button}\n key={color}\n onClick={() => {\n this.handleChange(color);\n setTimeout(() => this.handleClose(), 300);\n }}\n >\n <div className={this.props.classes.iconButton} style={{ background: color }} />\n </Button>)}\n </div>;\n }\n\n render() {\n const color = ColorPicker.getColor(this.state.color);\n\n const style = {...(this.props.style || {})};\n style.position = 'relative';\n\n return <div\n style={ style }\n className={this.props.className || ''}\n >\n <TextField\n disabled={this.props.disabled}\n variant=\"standard\"\n id=\"name\"\n style={color ? { width: 'calc(100% - 80px)' } : { width: 'calc(100% - 54px)', marginRight: 8 }}\n label={ this.props.name || 'color' }\n value={color}\n margin=\"dense\"\n classes={{ root: this.props.classes.textDense }}\n onChange={e => this.handleChange(e.target.value)}\n />\n {color ? <IconButton\n disabled={this.props.disabled}\n onClick={() => this.handleChange('')}\n size=\"small\"\n className={this.props.classes.delButton}\n style={color ? {} : { opacity: 0, cursor: 'default' }}\n >\n <IconDelete />\n </IconButton> : null}\n <div className={`${this.props.classes.swatch}${this.props.disabled ? ` ${this.props.classes.swatchDisabled}` : ''}`} onClick={e => !this.props.disabled && this.handleClick(e)}>\n <div className={this.props.classes.color} style={{ background: color }} />\n </div>\n { this.state.displayColorPicker && !this.props.disabled ? <Menu\n classes={{ paper: this.props.classes.popover, list: this.props.classes.popoverList }}\n anchorEl={this.state.anchorEl}\n open={!0}\n onClose={() => this.handleClose()}\n >\n <ChromePicker\n className={this.props.classes.picker}\n color={this.state.color}\n onChangeComplete={_color => this.handleChange(_color)}\n styles={{ picker: { background: '#112233' } }}\n />\n <IconButton className={this.props.classes.closeButton} onClick={() => this.handleClose()}><IconClose /></IconButton>\n {this.renderCustomPalette()}\n </Menu> : null }\n </div>;\n }\n}\n\nColorPicker.propTypes = {\n disabled: PropTypes.bool,\n value: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n name: PropTypes.string,\n style: PropTypes.object,\n className: PropTypes.string,\n customPalette: PropTypes.array,\n};\n\n/** @type {typeof ColorPicker} */\nconst _export = withStyles(styles)(ColorPicker);\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;AAeA;AACA;AACA;AACA;AAEA;AACA;AAA+E;AAAA;AAAA;AAAA;AAE/E,IAAMA,MAAM,GAAG,SAATA,MAAM,CAAGC,KAAK;EAAA,OAAK;IACrBC,KAAK,EAAE;MACHC,KAAK,EAAE,EAAE;MACTC,MAAM,EAAE,EAAE;MACVC,YAAY,EAAE;IAClB,CAAC;IACDC,SAAS,EAAE;MACP;MACA;MACAC,SAAS,EAAE;IACf,CAAC;IACDC,MAAM,EAAE;MACJD,SAAS,EAAE,EAAE;MACbE,OAAO,EAAE,CAAC;MACVC,UAAU,EAAE,MAAM;MAClBL,YAAY,EAAE,CAAC;MACfM,SAAS,EAAE,0BAA0B;MACrCC,OAAO,EAAE,cAAc;MACvBC,MAAM,EAAE,SAAS;MACjBC,aAAa,EAAE;IACnB,CAAC;IACDC,cAAc,EAAE;MACZC,OAAO,EAAE,GAAG;MACZH,MAAM,EAAE;IACZ,CAAC;IACDI,OAAO,EAAE;MACL;MACA;MACAC,eAAe,EAAE,WAAW;MAC5BC,SAAS,EAAE;IACf,CAAC;IACDC,WAAW,E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AE,CAAC,CAACN,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;MAC1D,IAAME,CAAC,GAAGK,QAAQ,CAACF,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAACN,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;MAE1D,OAAOK,CAAC,IAAIA,CAAC,CAACG,MAAM,KAAK,CAAC,cAAOV,CAAC,SAAGG,CAAC,SAAGC,CAAC,IAAKL,GAAG;IACtD;;IAEA;AACJ;AACA;EAFI;EAAA;AAAA,EA9EsBY,iBAAK,CAACC,SAAS;AA6JzC7C,WAAW,CAAC8C,SAAS,GAAG;EACpB1B,QAAQ,EAAE2B,qBAAS,CAACC,IAAI;EACxBtC,KAAK,EAAEqC,qBAAS,CAACE,MAAM;EACvBzC,QAAQ,EAAEuC,qBAAS,CAACG,IAAI,CAACC,UAAU;EACnC7B,IAAI,EAAEyB,qBAAS,CAACE,MAAM;EACtB/B,KAAK,EAAE6B,qBAAS,CAACK,MAAM;EACvBjC,SAAS,EAAE4B,qBAAS,CAACE,MAAM;EAC3BtC,aAAa,EAAEoC,qBAAS,CAACM;AAC7B,CAAC;;AAED;AACA,IAAMC,OAAO,GAAG,IAAAC,sBAAU,EAAC9F,MAAM,CAAC,CAACuC,WAAW,CAAC;AAAC,eACjCsD,OAAO;AAAA"}
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ If you want to create the configuration page with react:
|
|
|
10
10
|
- Change `name` from `src` to `ADAPTERNAME-admin` (Of course replace `ADAPTERNAME` with yours)
|
|
11
11
|
- Add to devDependencies:
|
|
12
12
|
```
|
|
13
|
-
"@iobroker/adapter-react": "^4.0.
|
|
13
|
+
"@iobroker/adapter-react": "^4.0.4",
|
|
14
14
|
```
|
|
15
15
|
Versions can be higher.
|
|
16
16
|
So your src/package.json should look like:
|
|
@@ -660,6 +660,9 @@ socket.getObjectViewCustom('custom', 'state', 'startKey', 'endKey')
|
|
|
660
660
|
-->
|
|
661
661
|
|
|
662
662
|
## Changelog
|
|
663
|
+
### 4.0.4 (2022-12-14)
|
|
664
|
+
* (bluefox) Added support of custom palette for color picker
|
|
665
|
+
|
|
663
666
|
### 4.0.2 (2022-12-01)
|
|
664
667
|
* (bluefox) use `@iobroker/socket-client` instead of `Connection.js`
|
|
665
668
|
|
package/i18n.js
CHANGED
|
@@ -69,6 +69,9 @@ var I18n = /*#__PURE__*/function () {
|
|
|
69
69
|
Object.keys(words).forEach(function (lang) {
|
|
70
70
|
var _words = {};
|
|
71
71
|
Object.keys(words[lang]).forEach(function (word) {
|
|
72
|
+
if (!word) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
72
75
|
if (!word.startsWith(prefix)) {
|
|
73
76
|
_words["".concat(prefix).concat(word)] = words[lang][word];
|
|
74
77
|
} else {
|
package/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","names":["I18n","lang","words","prefix","Object","keys","forEach","_words","word","startsWith","console","warn","en","de","ru","translations","assign","e","error","translation","w","unknownTranslations","includes","push","_disableWarning","log","wordEn","args","arg","replace","filter","result","JSON","stringify","test","disable","window","sysLang","i18nShow","i18nDisableWarning","disableWarning"],"sources":["i18n.js"],"sourcesContent":["/***\n * Copyright 2018-2022 bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n ***/\n\n /**\n * Translation string management.\n */\nclass I18n {\n /**\n * List of all languages with their translations.\n * @type {{ [lang in ioBroker.Languages]?: Record<string, string>; }}\n */\n static translations = {};\n\n /**\n * List of unknown translations during development.\n * @type {string[]}\n */\n static unknownTranslations = [];\n\n /**\n * The currently displayed language.\n * @type {ioBroker.Languages}\n */\n static lang = window.sysLang || 'en';\n\n static _disableWarning = false;\n\n /**\n * Set the language to display.\n * @param {ioBroker.Languages} lang\n */\n static setLanguage(lang) {\n if (lang) {\n I18n.lang = lang;\n }\n }\n\n /**\n * Add translations\n * User can provide two types of structures:\n * - {\"word1\": \"translated word1\", \"word2\": \"translated word2\"}, but in this case the lang must be provided\n * - {\"word1\": {\"en\": \"translated en word1\", \"de\": \"translated de word1\"}, \"word2\": {\"en\": \"translated en word2\", \"de\": \"translated de word2\"}}, but no lang must be provided\n * @param {object} words additional words for specific language\n * @param {ioBroker.Languages} lang\n */\n static extendTranslations(words, lang) {\n // extend automatically all languages with prefix\n if (words.prefix) {\n if (typeof words.prefix === 'string') {\n const prefix = words.prefix;\n delete words.prefix;\n Object.keys(words).forEach(lang => {\n const _words = {};\n Object.keys(words[lang]).forEach(word => {\n if (!word.startsWith(prefix)) {\n _words[`${prefix}${word}`] = words[lang][word];\n } else {\n _words[word] = words[lang][word];\n }\n });\n words[lang] = _words;\n });\n } else {\n console.warn('Found prefix in translations, but it is not a string');\n }\n }\n\n try {\n if (!lang) {\n if (words.en && words.de && words.ru) {\n Object.keys(words).forEach(lang => {\n I18n.translations[lang] = I18n.translations[lang] || {};\n Object.assign(I18n.translations[lang], words[lang]);\n });\n } else {\n Object.keys(words).forEach(word => {\n Object.keys(words[word]).forEach(lang => {\n if (!I18n.translations[lang]) {\n console.warn(`Used unknown language: ${lang}`);\n }\n if (!I18n.translations[lang][word]) {\n I18n.translations[lang][word] = words[word][lang];\n } else if (I18n.translations[lang][word] !== words[word][lang]) {\n console.warn(`Translation for word \"${word}\" in \"${lang}\" was ignored: existing = \"${I18n.translations[lang][word]}\", new = ${words[word][lang]}`);\n }\n });\n });\n }\n } else {\n if (!I18n.translations[lang]) {\n console.warn(`Used unknown language: ${lang}`);\n }\n I18n.translations[lang] = I18n.translations[lang] || {};\n Object.keys(words)\n .forEach(word => {\n if (!I18n.translations[lang][word]) {\n I18n.translations[lang][word] = words[word];\n } else if (I18n.translations[lang][word] !== words[word]) {\n console.warn(`Translation for word \"${word}\" in \"${lang}\" was ignored: existing = \"${I18n.translations[lang][word]}\", new = ${words[word]}`);\n }\n });\n }\n } catch (e) {\n console.error(`Cannot apply translations: ${e}`);\n }\n }\n\n /**\n * Sets all translations (in all languages).\n * @param {{ [lang in ioBroker.Languages]?: Record<string, string>; }} translations\n */\n static setTranslations(translations) {\n if (translations) {\n I18n.translations = translations;\n }\n }\n\n /**\n * Get the currently chosen language.\n * @returns {ioBroker.Languages} The current language.\n */\n static getLanguage() {\n return I18n.lang;\n }\n\n /**\n * Translate the given string to the selected language.\n * @param {string} word The (key) word to look up the string.\n * @param {string[]} args Optional arguments which will replace the first (second, third, ...) occurrences of %s\n */\n static t(word, ...args) {\n let translation = I18n.translations[I18n.lang];\n if (translation) {\n const w = translation[word];\n if (w) {\n word = w;\n } else {\n if (!I18n.unknownTranslations.includes(word)) {\n I18n.unknownTranslations.push(word);\n !I18n._disableWarning && console.log(`Translate: ${word}`);\n }\n // fallback to english\n if (I18n.lang !== 'en' && I18n.translations.en) {\n const wordEn = I18n.translations.en[word];\n if (wordEn) {\n word = wordEn;\n }\n }\n }\n }\n for (const arg of args) {\n word = word.replace('%s', arg);\n }\n return word;\n }\n\n /**\n * Show non-translated words\n * Required during development\n * @param {string | RegExp} filter filter words\n */\n static i18nShow(filter) {\n /**\n * List words with their translations.\n * @type {Record<string, string>}\n */\n const result = {};\n if (!filter) {\n I18n.unknownTranslations.forEach(word => {\n result[word] = word;\n });\n console.log(JSON.stringify(result, null, 2));\n } else if (typeof filter === 'string') {\n I18n.unknownTranslations.forEach(word => {\n if (word.startsWith(filter)) {\n result[word] = word.replace(filter, '');\n }\n });\n console.log(JSON.stringify(result, null, 2));\n } else if (typeof filter === 'object') {\n I18n.unknownTranslations.forEach(word => {\n if (filter.test(word)) {\n result[word] = word;\n }\n });\n console.log(JSON.stringify(result, null, 2));\n }\n }\n\n /**\n * Disable warning about non-translated words\n * Required during development\n * @param {boolean} disable Do the warning should be disabled\n */\n static disableWarning(disable) {\n I18n._disableWarning = !!disable;\n }\n}\n\n// install global handlers\nwindow.i18nShow = I18n.i18nShow;\nwindow.i18nDisableWarning = I18n.disableWarning;\n\n\n/*I18n.translations = {\n 'en': require('./i18n/en'),\n 'ru': require('./i18n/ru'),\n 'de': require('./i18n/de'),\n};\nI18n.fallbacks = true;\nI18n.t = function () {};*/\n\nexport default I18n;"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEC;AACD;AACA;AAFC,IAGKA,IAAI;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IACN;AACJ;AACA;AACA;;IAGK;AACL;AACA;AACA;;IAGI;AACJ;AACA;AACA;;IAKI;AACJ;AACA;AACA;IACI,qBAAmBC,IAAI,EAAE;MACrB,IAAIA,IAAI,EAAE;QACND,IAAI,CAACC,IAAI,GAAGA,IAAI;MACpB;IACJ;;IAEC;AACL;AACA;AACA;AACA;AACA;AACA;AACA;EAPK;IAAA;IAAA,OAQA,4BAA0BC,KAAK,EAAED,IAAI,EAAE;MACnC;MACA,IAAIC,KAAK,CAACC,MAAM,EAAE;QACd,IAAI,OAAOD,KAAK,CAACC,MAAM,KAAK,QAAQ,EAAE;UAClC,IAAMA,MAAM,GAAGD,KAAK,CAACC,MAAM;UAC3B,OAAOD,KAAK,CAACC,MAAM;UACnBC,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC,CAACI,OAAO,CAAC,UAAAL,IAAI,EAAI;YAC/B,IAAMM,MAAM,GAAG,CAAC,CAAC;YACjBH,MAAM,CAACC,IAAI,CAACH,KAAK,CAACD,IAAI,CAAC,CAAC,CAACK,OAAO,CAAC,UAAAE,IAAI,EAAI;cACrC,IAAI,CAACA,IAAI,CAACC,UAAU,CAACN,MAAM,CAAC,EAAE;gBAC1BI,MAAM,WAAIJ,MAAM,SAAGK,IAAI,EAAG,GAAGN,KAAK,CAACD,IAAI,CAAC,CAACO,IAAI,CAAC;cAClD,CAAC,MAAM;gBACHD,MAAM,CAACC,IAAI,CAAC,GAAGN,KAAK,CAACD,IAAI,CAAC,CAACO,IAAI,CAAC;cACpC;YACJ,CAAC,CAAC;YACFN,KAAK,CAACD,IAA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AA,iCAjBlCrC,IAAI,qBAmBmB,KAAK;AA+KlCoC,MAAM,CAACE,QAAQ,GAAGtC,IAAI,CAACsC,QAAQ;AAC/BF,MAAM,CAACG,kBAAkB,GAAGvC,IAAI,CAACwC,cAAc;;AAG/C;AACA;AACA;AACA;AACA;AACA;AACA;AANA,eAQexC,IAAI;AAAA"}
|
|
1
|
+
{"version":3,"file":"i18n.js","names":["I18n","lang","words","prefix","Object","keys","forEach","_words","word","startsWith","console","warn","en","de","ru","translations","assign","e","error","translation","w","unknownTranslations","includes","push","_disableWarning","log","wordEn","args","arg","replace","filter","result","JSON","stringify","test","disable","window","sysLang","i18nShow","i18nDisableWarning","disableWarning"],"sources":["i18n.js"],"sourcesContent":["/***\n * Copyright 2018-2022 bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n ***/\n\n /**\n * Translation string management.\n */\nclass I18n {\n /**\n * List of all languages with their translations.\n * @type {{ [lang in ioBroker.Languages]?: Record<string, string>; }}\n */\n static translations = {};\n\n /**\n * List of unknown translations during development.\n * @type {string[]}\n */\n static unknownTranslations = [];\n\n /**\n * The currently displayed language.\n * @type {ioBroker.Languages}\n */\n static lang = window.sysLang || 'en';\n\n static _disableWarning = false;\n\n /**\n * Set the language to display.\n * @param {ioBroker.Languages} lang\n */\n static setLanguage(lang) {\n if (lang) {\n I18n.lang = lang;\n }\n }\n\n /**\n * Add translations\n * User can provide two types of structures:\n * - {\"word1\": \"translated word1\", \"word2\": \"translated word2\"}, but in this case the lang must be provided\n * - {\"word1\": {\"en\": \"translated en word1\", \"de\": \"translated de word1\"}, \"word2\": {\"en\": \"translated en word2\", \"de\": \"translated de word2\"}}, but no lang must be provided\n * @param {object} words additional words for specific language\n * @param {ioBroker.Languages} lang\n */\n static extendTranslations(words, lang) {\n // extend automatically all languages with prefix\n if (words.prefix) {\n if (typeof words.prefix === 'string') {\n const prefix = words.prefix;\n delete words.prefix;\n Object.keys(words).forEach(lang => {\n const _words = {};\n Object.keys(words[lang]).forEach(word => {\n if (!word) {\n return;\n }\n if (!word.startsWith(prefix)) {\n _words[`${prefix}${word}`] = words[lang][word];\n } else {\n _words[word] = words[lang][word];\n }\n });\n words[lang] = _words;\n });\n } else {\n console.warn('Found prefix in translations, but it is not a string');\n }\n }\n\n try {\n if (!lang) {\n if (words.en && words.de && words.ru) {\n Object.keys(words).forEach(lang => {\n I18n.translations[lang] = I18n.translations[lang] || {};\n Object.assign(I18n.translations[lang], words[lang]);\n });\n } else {\n Object.keys(words).forEach(word => {\n Object.keys(words[word]).forEach(lang => {\n if (!I18n.translations[lang]) {\n console.warn(`Used unknown language: ${lang}`);\n }\n if (!I18n.translations[lang][word]) {\n I18n.translations[lang][word] = words[word][lang];\n } else if (I18n.translations[lang][word] !== words[word][lang]) {\n console.warn(`Translation for word \"${word}\" in \"${lang}\" was ignored: existing = \"${I18n.translations[lang][word]}\", new = ${words[word][lang]}`);\n }\n });\n });\n }\n } else {\n if (!I18n.translations[lang]) {\n console.warn(`Used unknown language: ${lang}`);\n }\n I18n.translations[lang] = I18n.translations[lang] || {};\n Object.keys(words)\n .forEach(word => {\n if (!I18n.translations[lang][word]) {\n I18n.translations[lang][word] = words[word];\n } else if (I18n.translations[lang][word] !== words[word]) {\n console.warn(`Translation for word \"${word}\" in \"${lang}\" was ignored: existing = \"${I18n.translations[lang][word]}\", new = ${words[word]}`);\n }\n });\n }\n } catch (e) {\n console.error(`Cannot apply translations: ${e}`);\n }\n }\n\n /**\n * Sets all translations (in all languages).\n * @param {{ [lang in ioBroker.Languages]?: Record<string, string>; }} translations\n */\n static setTranslations(translations) {\n if (translations) {\n I18n.translations = translations;\n }\n }\n\n /**\n * Get the currently chosen language.\n * @returns {ioBroker.Languages} The current language.\n */\n static getLanguage() {\n return I18n.lang;\n }\n\n /**\n * Translate the given string to the selected language.\n * @param {string} word The (key) word to look up the string.\n * @param {string[]} args Optional arguments which will replace the first (second, third, ...) occurrences of %s\n */\n static t(word, ...args) {\n let translation = I18n.translations[I18n.lang];\n if (translation) {\n const w = translation[word];\n if (w) {\n word = w;\n } else {\n if (!I18n.unknownTranslations.includes(word)) {\n I18n.unknownTranslations.push(word);\n !I18n._disableWarning && console.log(`Translate: ${word}`);\n }\n // fallback to english\n if (I18n.lang !== 'en' && I18n.translations.en) {\n const wordEn = I18n.translations.en[word];\n if (wordEn) {\n word = wordEn;\n }\n }\n }\n }\n for (const arg of args) {\n word = word.replace('%s', arg);\n }\n return word;\n }\n\n /**\n * Show non-translated words\n * Required during development\n * @param {string | RegExp} filter filter words\n */\n static i18nShow(filter) {\n /**\n * List words with their translations.\n * @type {Record<string, string>}\n */\n const result = {};\n if (!filter) {\n I18n.unknownTranslations.forEach(word => {\n result[word] = word;\n });\n console.log(JSON.stringify(result, null, 2));\n } else if (typeof filter === 'string') {\n I18n.unknownTranslations.forEach(word => {\n if (word.startsWith(filter)) {\n result[word] = word.replace(filter, '');\n }\n });\n console.log(JSON.stringify(result, null, 2));\n } else if (typeof filter === 'object') {\n I18n.unknownTranslations.forEach(word => {\n if (filter.test(word)) {\n result[word] = word;\n }\n });\n console.log(JSON.stringify(result, null, 2));\n }\n }\n\n /**\n * Disable warning about non-translated words\n * Required during development\n * @param {boolean} disable Do the warning should be disabled\n */\n static disableWarning(disable) {\n I18n._disableWarning = !!disable;\n }\n}\n\n// install global handlers\nwindow.i18nShow = I18n.i18nShow;\nwindow.i18nDisableWarning = I18n.disableWarning;\n\n\n/*I18n.translations = {\n 'en': require('./i18n/en'),\n 'ru': require('./i18n/ru'),\n 'de': require('./i18n/de'),\n};\nI18n.fallbacks = true;\nI18n.t = function () {};*/\n\nexport default I18n;"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEC;AACD;AACA;AAFC,IAGKA,IAAI;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IACN;AACJ;AACA;AACA;;IAGK;AACL;AACA;AACA;;IAGI;AACJ;AACA;AACA;;IAKI;AACJ;AACA;AACA;IACI,qBAAmBC,IAAI,E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"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "React classes to develop admin interfaces for ioBroker with react.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "bluefox",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@emotion/react": "^11.10.5",
|
|
31
31
|
"@emotion/styled": "^11.10.5",
|
|
32
|
-
"@mui/icons-material": "^5.
|
|
33
|
-
"@mui/material": "^5.
|
|
34
|
-
"@mui/styles": "^5.
|
|
32
|
+
"@mui/icons-material": "^5.11.0",
|
|
33
|
+
"@mui/material": "^5.11.0",
|
|
34
|
+
"@mui/styles": "^5.11.0",
|
|
35
35
|
"@mui/x-date-pickers": "5.0.9",
|
|
36
36
|
"@iobroker/socket-client": "^2.0.0",
|
|
37
37
|
"react-cropper": "^2.1.8",
|
|
38
|
-
"@sentry/browser": "^7.
|
|
39
|
-
"@sentry/integrations": "^7.
|
|
38
|
+
"@sentry/browser": "^7.26.0",
|
|
39
|
+
"@sentry/integrations": "^7.26.0",
|
|
40
40
|
"@types/iobroker": "^4.0.5",
|
|
41
41
|
"react-color": "^2.19.3",
|
|
42
42
|
"react-colorful": "^5.6.1",
|