@iobroker/adapter-react-v5 4.0.3 → 4.0.5

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.
@@ -80,8 +80,8 @@ var styles = function styles(theme) {
80
80
  background: "".concat(theme.palette.background.paper, " !important")
81
81
  },
82
82
  iconButton: {
83
- width: 24,
84
- height: 24
83
+ width: 16,
84
+ height: 16
85
85
  },
86
86
  button: {
87
87
  width: 32,
@@ -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","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: 24,\n height: 24,\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,EAAE;MACTX,OAAO,EAAE;IACb,CAAC;IACDY,WAAW,EAAE;MACTH,eAAe,YAAKjB,KAAK,CAACqB,OAAO,CAACZ,UAAU,CAACa,KAAK,gBAAa;MAC/DlB,YAAY,EAAE,aAAa;MAC3B,SAAS,EAAE;QACPa,eAAe,YAAKjB,KAAK,CAACqB,OAAO,CAACE,SAAS,CAACC,IAAI;MACpD;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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"}
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,EAA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QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;MAC1D,IAAMC,CAAC,GAAGM,QAAQ,CAACF,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,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"}
@@ -19,7 +19,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
19
19
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
  var _propTypes = _interopRequireDefault(require("prop-types"));
22
- var _copyToClipboard = _interopRequireDefault(require("./copy-to-clipboard"));
23
22
  var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
24
23
  var _reactInlinesvg = _interopRequireDefault(require("react-inlinesvg"));
25
24
  var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
@@ -294,6 +293,18 @@ var styles = function styles(theme) {
294
293
  height: SMALL_BUTTON_SIZE
295
294
  },
296
295
  cellIdIconOwn: {},
296
+ cellIdTooltip: {
297
+ fontSize: 14
298
+ },
299
+ cellIdTooltipLink: {
300
+ color: "#7ec2fd",
301
+ "&:hover": {
302
+ color: "#7ec2fd"
303
+ },
304
+ "&:visited": {
305
+ color: "#7ec2fd"
306
+ }
307
+ },
297
308
  cellCopyButton: {
298
309
  width: SMALL_BUTTON_SIZE,
299
310
  height: SMALL_BUTTON_SIZE,
@@ -788,17 +799,17 @@ function getSelectIdIcon(objects, id, imagePrefix) {
788
799
  } else {
789
800
  return null; // '<i class="material-icons iob-list-icon">' + objects[_id_].common.icon + '</i>';
790
801
  }
791
- }
792
-
793
- if (aIcon.startsWith('data:image/svg')) {
794
- src = /*#__PURE__*/_react["default"].createElement(_reactInlinesvg["default"], {
795
- className: "iconOwn",
796
- src: aIcon,
797
- width: 28,
798
- height: 28
799
- });
800
802
  } else {
801
- src = aIcon;
803
+ if (aIcon.startsWith('data:image/svg')) {
804
+ src = /*#__PURE__*/_react["default"].createElement(_reactInlinesvg["default"], {
805
+ className: "iconOwn",
806
+ src: aIcon,
807
+ width: 28,
808
+ height: 28
809
+ });
810
+ } else {
811
+ src = aIcon;
812
+ }
802
813
  }
803
814
  } else {
804
815
  var common = objects[id] && objects[id].common;
@@ -1079,6 +1090,34 @@ function getSystemIcon(objects, id, k, imagePrefix) {
1079
1090
  }
1080
1091
  return icon || null;
1081
1092
  }
1093
+ function getIdFieldTooltip(data, classes, lang) {
1094
+ var _data$obj2, _data$obj2$common;
1095
+ if (data !== null && data !== void 0 && (_data$obj2 = data.obj) !== null && _data$obj2 !== void 0 && (_data$obj2$common = _data$obj2.common) !== null && _data$obj2$common !== void 0 && _data$obj2$common.desc && data.obj.common.desc !== '') {
1096
+ var _data$obj3, _data$obj3$common, _data$obj4, _data$obj4$common, _data$obj5, _data$obj5$common, _tooltip;
1097
+ var tooltip = '';
1098
+ if ((0, _typeof2["default"])(data === null || data === void 0 ? void 0 : (_data$obj3 = data.obj) === null || _data$obj3 === void 0 ? void 0 : (_data$obj3$common = _data$obj3.common) === null || _data$obj3$common === void 0 ? void 0 : _data$obj3$common.desc) === 'object' && data.obj.common.desc[lang] !== undefined) {
1099
+ tooltip = data.obj.common.desc[lang];
1100
+ } else if ((0, _typeof2["default"])(data === null || data === void 0 ? void 0 : (_data$obj4 = data.obj) === null || _data$obj4 === void 0 ? void 0 : (_data$obj4$common = _data$obj4.common) === null || _data$obj4$common === void 0 ? void 0 : _data$obj4$common.desc) === 'object' && data.obj.common.desc['en'] !== undefined) {
1101
+ tooltip = data.obj.common.desc['en'];
1102
+ } else if ((0, _typeof2["default"])(data === null || data === void 0 ? void 0 : (_data$obj5 = data.obj) === null || _data$obj5 === void 0 ? void 0 : (_data$obj5$common = _data$obj5.common) === null || _data$obj5$common === void 0 ? void 0 : _data$obj5$common.desc) === 'object' && data.obj.common.desc[lang] === undefined) {
1103
+ return data.id;
1104
+ } else {
1105
+ tooltip = data.obj.common.desc;
1106
+ }
1107
+ if ((_tooltip = tooltip) !== null && _tooltip !== void 0 && _tooltip.startsWith('http')) {
1108
+ return /*#__PURE__*/_react["default"].createElement("a", {
1109
+ className: _Utils["default"].clsx(classes.cellIdTooltipLink),
1110
+ href: tooltip,
1111
+ target: "_blank",
1112
+ rel: "noreferrer"
1113
+ }, tooltip);
1114
+ }
1115
+ return /*#__PURE__*/_react["default"].createElement("span", {
1116
+ className: _Utils["default"].clsx(classes.cellIdTooltip)
1117
+ }, tooltip);
1118
+ }
1119
+ return data.id;
1120
+ }
1082
1121
  function buildTree(objects, options) {
1083
1122
  options = options || {};
1084
1123
  var imagePrefix = options.imagePrefix || '.';
@@ -3952,7 +3991,7 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
3952
3991
  value: function onCopy(e, text) {
3953
3992
  e.stopPropagation();
3954
3993
  e.preventDefault();
3955
- (0, _copyToClipboard["default"])(text, null);
3994
+ _Utils["default"].copyToClipboard(text, null);
3956
3995
  if (text.length < 50) {
3957
3996
  this.setState({
3958
3997
  toast: this.props.t('ra_Copied %s', text)
@@ -3994,7 +4033,19 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
3994
4033
  "aria-label": "delete",
3995
4034
  title: this.texts.deleteObject,
3996
4035
  onClick: function onClick() {
3997
- return _this27.props.onObjectDelete(id, !!(item.children && item.children.length), false);
4036
+ // calculate number of children
4037
+ var keys = Object.keys(_this27.objects);
4038
+ keys.sort();
4039
+ var count = 0;
4040
+ var start = "".concat(id, ".");
4041
+ for (var i = 0; i < keys.length; i++) {
4042
+ if (keys[i].startsWith(start)) {
4043
+ count++;
4044
+ } else if (keys[i] > start) {
4045
+ break;
4046
+ }
4047
+ }
4048
+ _this27.props.onObjectDelete(id, !!(item.children && item.children.length), false, count + 1);
3998
4049
  }
3999
4050
  }, /*#__PURE__*/_react["default"].createElement(_Delete["default"], {
4000
4051
  className: classes.cellButtonsButtonIcon
@@ -4041,7 +4092,18 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
4041
4092
  "aria-label": "delete",
4042
4093
  onClick: function onClick() {
4043
4094
  var _item$children3, _item$data$obj$common2;
4044
- return _this27.props.onObjectDelete(id, !!((_item$children3 = item.children) !== null && _item$children3 !== void 0 && _item$children3.length), !((_item$data$obj$common2 = item.data.obj.common) !== null && _item$data$obj$common2 !== void 0 && _item$data$obj$common2.dontDelete));
4095
+ var keys = Object.keys(_this27.objects);
4096
+ keys.sort();
4097
+ var count = 0;
4098
+ var start = "".concat(id, ".");
4099
+ for (var i = 0; i < keys.length; i++) {
4100
+ if (keys[i].startsWith(start)) {
4101
+ count++;
4102
+ } else if (keys[i] > start) {
4103
+ break;
4104
+ }
4105
+ }
4106
+ _this27.props.onObjectDelete(id, !!((_item$children3 = item.children) !== null && _item$children3 !== void 0 && _item$children3.length), !((_item$data$obj$common2 = item.data.obj.common) !== null && _item$data$obj$common2 !== void 0 && _item$data$obj$common2.dontDelete), count);
4045
4107
  },
4046
4108
  title: this.texts.deleteObject
4047
4109
  }, /*#__PURE__*/_react["default"].createElement(_Delete["default"], {
@@ -4774,7 +4836,11 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
4774
4836
  invertBackground = this.props.themeType === 'dark' ? '#9a9a9a' : '#565656';
4775
4837
  }
4776
4838
  }
4777
- if (!checkColor || this.state.selected.includes(id)) {
4839
+ if (id === 'system') {
4840
+ checkColor = COLOR_NAME_SYSTEM;
4841
+ } else if (id === 'system.adapter') {
4842
+ checkColor = COLOR_NAME_SYSTEM_ADAPTER;
4843
+ } else if (!checkColor || this.state.selected.includes(id)) {
4778
4844
  checkColor = 'inherit';
4779
4845
  }
4780
4846
  var icons = [];
@@ -4910,12 +4976,13 @@ var ObjectBrowser = /*#__PURE__*/function (_Component) {
4910
4976
  }
4911
4977
  }, checkbox, iconFolder), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
4912
4978
  item: true,
4913
- title: id,
4914
- className: _Utils["default"].clsx(classes.cellIdSpan, invertBackground && classes.invertedBackground),
4915
4979
  style: {
4916
- color: id === 'system' ? COLOR_NAME_SYSTEM : id === 'system.adapter' ? COLOR_NAME_SYSTEM_ADAPTER : checkColor
4917
- }
4918
- }, item.data.name, alias, icons), /*#__PURE__*/_react["default"].createElement("div", {
4980
+ color: checkColor
4981
+ },
4982
+ className: _Utils["default"].clsx(classes.cellIdSpan, invertBackground && classes.invertedBackground)
4983
+ }, /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
4984
+ title: getIdFieldTooltip(item.data, this.props.classes, this.props.lang)
4985
+ }, /*#__PURE__*/_react["default"].createElement("div", null, item.data.name)), alias, icons), /*#__PURE__*/_react["default"].createElement("div", {
4919
4986
  className: _Utils["default"].clsx(classes.grow, invertBackground && classes.invertedBackgroundFlex)
4920
4987
  }), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
4921
4988
  item: true,
@@ -5874,7 +5941,7 @@ ObjectBrowser.propTypes = {
5874
5941
  modalEditOfAccessControl: _propTypes["default"].func,
5875
5942
  // modal Edit Of Access Control
5876
5943
  onObjectDelete: _propTypes["default"].func,
5877
- // optional function (id, hasChildren, objectExists) { }
5944
+ // optional function (id, hasChildren, objectExists, childrenCount+1) { }
5878
5945
  customFilter: _propTypes["default"].object,
5879
5946
  // optional
5880
5947
  // `{common: {custom: true}}` - show only objects with some custom settings