@iobroker/gui-components 10.2.0 → 10.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +16 -1
  2. package/build/Components/ColorPicker.d.ts +94 -12
  3. package/build/Components/ColorPicker.js +567 -111
  4. package/build/Components/ColorPicker.js.map +1 -1
  5. package/build/Components/ObjectBrowser/ObjectBrowserClass.d.ts +17 -1
  6. package/build/Components/ObjectBrowser/ObjectBrowserClass.js +99 -36
  7. package/build/Components/ObjectBrowser/ObjectBrowserClass.js.map +1 -1
  8. package/build/Components/ObjectBrowser/dialogs.js +14 -5
  9. package/build/Components/ObjectBrowser/dialogs.js.map +1 -1
  10. package/build/Components/ObjectBrowser/renderLeaf.js +29 -10
  11. package/build/Components/ObjectBrowser/renderLeaf.js.map +1 -1
  12. package/build/Components/ObjectBrowser/toolbar.js +11 -10
  13. package/build/Components/ObjectBrowser/toolbar.js.map +1 -1
  14. package/build/Components/Schedule.js +176 -78
  15. package/build/Components/Schedule.js.map +1 -1
  16. package/build/Components/TreeTable.d.ts +6 -2
  17. package/build/Components/TreeTable.js +183 -103
  18. package/build/Components/TreeTable.js.map +1 -1
  19. package/build/Dialogs/Error.js +26 -5
  20. package/build/Dialogs/Error.js.map +1 -1
  21. package/build/i18n/de.json +20 -0
  22. package/build/i18n/en.json +20 -0
  23. package/build/i18n/es.json +20 -0
  24. package/build/i18n/fr.json +20 -0
  25. package/build/i18n/it.json +20 -0
  26. package/build/i18n/nl.json +20 -0
  27. package/build/i18n/pl.json +20 -0
  28. package/build/i18n/pt.json +20 -0
  29. package/build/i18n/ru.json +20 -0
  30. package/build/i18n/uk.json +20 -0
  31. package/build/i18n/zh-cn.json +20 -0
  32. package/build/index.d.ts +2 -1
  33. package/build/index.js +1 -1
  34. package/build/index.js.map +1 -1
  35. package/i18n/de.json +20 -0
  36. package/i18n/en.json +20 -0
  37. package/i18n/es.json +20 -0
  38. package/i18n/fr.json +20 -0
  39. package/i18n/it.json +20 -0
  40. package/i18n/nl.json +20 -0
  41. package/i18n/pl.json +20 -0
  42. package/i18n/pt.json +20 -0
  43. package/i18n/ru.json +20 -0
  44. package/i18n/uk.json +20 -0
  45. package/i18n/zh-cn.json +20 -0
  46. package/package.json +10 -12
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.js","sourceRoot":"./src/","sources":["Components/ColorPicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAsB,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAiB,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAI/B,MAAM,MAAM,GAAwB;IAChC,KAAK,EAAE;QACH,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,CAAC;KAClB;IACD,SAAS,EAAE;QACP,SAAS,EAAE,EAAE;KAChB;IACD,MAAM,EAAE;QACJ,EAAE,EAAE,MAAM;QACV,CAAC,EAAE,KAAK;QACR,eAAe,EAAE,kBAAkB;QACnC,YAAY,EAAE,KAAK;QACnB,SAAS,EAAE,0BAA0B;QACrC,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,SAAS;QACjB,aAAa,EAAE,QAAQ;KAC1B;IACD,cAAc,EAAE;QACZ,OAAO,EAAE,GAAG;QACZ,MAAM,EAAE,SAAS;KACpB;IACD,OAAO,EAAE;QACL,kBAAkB,EAAE;YAChB,SAAS,EAAE,OAAO;YAClB,eAAe,EAAE,WAAW;YAC5B,SAAS,EAAE,MAAM;SACpB;KACJ;I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C,oBAAC,UAAU,IACP,EAAE,EAAE,MAAM,CAAC,WAAW,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;oBAEpC,oBAAC,UAAU,OAAG,CACL,CAChB,CAAC,CAAC,CAAC,IAAI;gBACR,oBAAC,UAAU,IACP,EAAE,EAAE,MAAM,CAAC,WAAW,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE;oBAEjC,oBAAC,SAAS,OAAG,CACJ;gBACZ,IAAI,CAAC,mBAAmB,EAAE,CACxB,CACV,CAAC,CAAC,CAAC,IAAI,CACN,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\n * Copyright 2018-2024 Denis Haev (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, { Component, type CSSProperties } from 'react';\nimport { ChromePicker, type RGBColor } from 'react-color';\n\nimport { TextField, Menu, IconButton, Button, Box } from '@mui/material';\n\nimport { Delete as IconDelete, Close as IconClose } from '@mui/icons-material';\n\nimport { I18n } from '../i18n';\n\nimport type { IobTheme } from '../types';\n\nconst styles: Record<string, any> = {\n color: {\n width: 36,\n height: 14,\n borderRadius: 2,\n },\n delButton: {\n marginTop: 16,\n },\n swatch: {\n mt: '16px',\n p: '5px',\n backgroundColor: 'background.paper',\n borderRadius: '1px',\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 '& .MuiPaper-root': {\n textAlign: 'right',\n backgroundColor: '#00000000',\n boxShadow: 'none',\n },\n },\n popoverList: {\n padding: 0,\n },\n closeButton: (theme: IobTheme) => ({\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 mt: 0,\n mb: 0,\n },\n picker: (theme: IobTheme) => ({\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\ninterface ColorPickerProps {\n /** Set to true to disable the color picker. */\n disabled?: boolean;\n /** The currently selected color. */\n value?: string;\n /** @deprecated The currently selected color use value */\n color?: string;\n /** The color change callback. */\n onChange: (rgba: string) => void;\n /** Label of the color picker. */\n label?: string;\n /** @deprecated TLabel of the color picker use label */\n name?: string;\n /** Additional styling for this component. */\n style?: CSSProperties;\n /** The CSS class name. */\n className?: string;\n customPalette?: string[];\n noInputField?: boolean;\n barWidth?: number;\n sx?: Record<string, any>;\n theme?: IobTheme;\n}\n\ninterface ColorPickerState {\n displayColorPicker: boolean;\n color: string | RGBColor;\n anchorEl: HTMLDivElement | null;\n}\n\n/**\n * A color picker component.\n */\nexport class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {\n /**\n * Constructor for the color picker.\n *\n * @param props The properties.\n */\n constructor(props: ColorPickerProps) {\n super(props);\n this.state = {\n displayColorPicker: false,\n color: this.props.value || this.props.color || '',\n anchorEl: null,\n };\n }\n\n private handleClick = (e: React.MouseEvent<HTMLDivElement>): void => {\n this.setState({\n displayColorPicker: !this.state.displayColorPicker,\n anchorEl: this.state.displayColorPicker ? null : e.currentTarget,\n });\n };\n\n private handleClose = (): void => {\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 *\n * @param color The color to convert.\n * @param isHex If true, the color will be converted to hex format.\n * @returns the hex or rgba representation of the given color.\n */\n static getColor(color: string | { rgb: RGBColor } | RGBColor, isHex?: boolean): string {\n if (color && typeof color === 'object') {\n const oColor = color as { rgb: RGBColor };\n if (oColor.rgb) {\n if (isHex) {\n return `#${oColor.rgb.r.toString(16).padStart(2, '0')}${oColor.rgb.g.toString(16).padStart(2, '0')}${oColor.rgb.b.toString(16).padStart(2, '0')}`;\n }\n return `rgba(${oColor.rgb.r},${oColor.rgb.g},${oColor.rgb.b},${oColor.rgb.a})`;\n }\n const rColor = color as RGBColor;\n if (isHex) {\n return `#${rColor.r.toString(16).padStart(2, '0')}${rColor.g.toString(16).padStart(2, '0')}${rColor.b.toString(16).padStart(2, '0')}`;\n }\n return `rgba(${rColor.r},${rColor.g},${rColor.b},${rColor.a})`;\n }\n if (typeof color === 'string') {\n return isHex ? ColorPicker.rgb2hex(color || '') : color || '';\n }\n return '';\n }\n\n /**\n * Convert rgb() or rgba() format to hex format #rrggbb.\n *\n * @param rgb The color in rgb() or rgba() format. if not in this format, the color will be returned as is.\n */\n static rgb2hex(rgb: string): string {\n const m = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n\n if (m) {\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?.length === 4 ? `#${r}${g}${b}` : rgb;\n }\n return rgb;\n }\n\n private handleChange = (color: string | RGBColor): void => {\n this.setState({ color }, () => this.props.onChange && this.props.onChange(ColorPicker.getColor(color)));\n };\n\n /**\n * If the props are updated from outside, they should override the state\n *\n * @param _prevProps The previous properties.\n * @param prevState The previous state.\n */\n componentDidUpdate(_prevProps: ColorPickerProps, prevState: ColorPickerState): void {\n const color = ColorPicker.getColor(this.props.color || this.props.value || '');\n\n if (color !== prevState.color) {\n this.setState({ color });\n }\n }\n\n renderCustomPalette(): React.JSX.Element | null {\n if (!this.props.customPalette) {\n return null;\n }\n return (\n <div style={{ width: '100%', display: 'flex', flexWrap: 'wrap' }}>\n {this.props.customPalette.map(color => (\n <Button\n style={styles.button}\n key={color}\n onClick={() => {\n this.handleChange(color);\n setTimeout(() => this.handleClose(), 300);\n }}\n >\n <div style={{ ...styles.iconButton, background: color }} />\n </Button>\n ))}\n </div>\n );\n }\n\n render(): React.JSX.Element {\n const style = { ...(this.props.style || {}) };\n style.position = 'relative';\n const { color } = this.state;\n\n return (\n <Box\n component=\"div\"\n style={style}\n sx={this.props.sx || undefined}\n className={this.props.className || ''}\n >\n {this.props.noInputField ? null : (\n <TextField\n disabled={this.props.disabled}\n variant=\"standard\"\n id=\"ar_color_picker_name\"\n label={this.props.label || this.props.name}\n value={color || ''}\n margin=\"dense\"\n sx={{\n '&.MuiFormControl-root': styles.textDense,\n width: color ? 'calc(100% - 80px)' : 'calc(100% - 56px)',\n mr: color ? undefined : 1,\n }}\n onChange={e => this.handleChange(e.target.value)}\n />\n )}\n {!this.props.noInputField && color ? (\n <IconButton\n disabled={this.props.disabled}\n onClick={() => this.handleChange('')}\n size=\"small\"\n style={this.props.label || this.props.name ? styles.delButton : undefined}\n >\n <IconDelete />\n </IconButton>\n ) : null}\n <Box\n component=\"div\"\n onClick={e => !this.props.disabled && this.handleClick(e)}\n title={I18n.t('ra_Select color')}\n sx={{\n ...styles.swatch,\n ...(this.props.disabled ? styles.swatchDisabled : undefined),\n background: color ? undefined : 'transparent',\n border: color ? undefined : '1px dashed #ccc',\n boxSizing: 'border-box',\n marginTop: this.props.noInputField || !(this.props.label || this.props.name) ? 0 : undefined,\n }}\n >\n <div\n style={{\n ...styles.color,\n background: ColorPicker.getColor(color),\n width: this.props.noInputField ? this.props.barWidth || 16 : this.props.barWidth || 36,\n }}\n />\n </Box>\n {this.state.displayColorPicker && !this.props.disabled ? (\n <Menu\n sx={{\n ...styles.popover,\n '&. MuiMenu-list': styles.popoverList,\n }}\n anchorEl={this.state.anchorEl}\n open={!0}\n onClose={() => this.handleClose()}\n >\n <ChromePicker\n color={this.state.color || undefined}\n onChangeComplete={(_color: { rgb: RGBColor }) => this.handleChange(_color.rgb)}\n styles={{\n default: {\n picker: {\n backgroundColor: this.props.theme?.palette.background.paper || '#888',\n },\n },\n }}\n />\n {color && this.props.noInputField ? (\n <IconButton\n sx={styles.closeButton}\n onClick={() => this.handleChange('')}\n >\n <IconDelete />\n </IconButton>\n ) : null}\n <IconButton\n sx={styles.closeButton}\n onClick={() => this.handleClose()}\n >\n <IconClose />\n </IconButton>\n {this.renderCustomPalette()}\n </Menu>\n ) : null}\n </Box>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ColorPicker.js","sourceRoot":"./src/","sources":["Components/ColorPicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAsB,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvG,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAe/B,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AACpD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,8EAA8E;AAC9E,MAAM,gBAAgB,GAClB,0NAA0N,CAAC;AAE/N,MAAM,qBAAqB,GAAG,SAAS,CAAC;AACxC,MAAM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Y,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE;qBACzF;oBAED,oBAAC,GAAG,IACA,SAAS,EAAC,KAAK,EACf,EAAE,EAAE,MAAM,CAAC,IAAI,EACf,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,IAAI,aAAa,EAAE,GACnD,CACA,CACJ;YACL,IAAI,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CACrD,oBAAC,OAAO,IACJ,EAAE,EAAE,MAAM,CAAC,OAAO,EAClB,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,IAAI,EAAE,CAAC,CAAC,EACR,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,YAAY,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,EACxD,eAAe,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,IAEvD,IAAI,CAAC,YAAY,EAAE,CACd,CACb,CAAC,CAAC,CAAC,IAAI,CACN,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\n * Copyright 2018-2026 Denis Haev (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, { Component, type CSSProperties } from 'react';\nimport { RgbaColorPicker, RgbColorPicker, type RgbaColor } from 'react-colorful';\n\nimport { TextField, Popover, IconButton, Button, Box, Tooltip, MenuItem, Select } from '@mui/material';\n\nimport { Delete as IconDelete, Colorize as IconColorize } from '@mui/icons-material';\n\nimport { I18n } from '../i18n';\n\nimport type { IobTheme } from '../types';\n\n/** Color in the `{ r, g, b, a }` notation. Kept for backwards compatibility with `react-color`. */\nexport interface RGBColor {\n r: number;\n g: number;\n b: number;\n a?: number;\n}\n\n/** Notation used for the value that is reported via `onChange`. */\nexport type ColorPickerFormat = 'hex' | 'rgb' | 'hsl';\n\nconst RECENT_COLORS_KEY = 'iob-color-picker-recent';\nconst MAX_RECENT_COLORS = 12;\n\n/** Small checkerboard, so a semi-transparent color is recognizable as such */\nconst ALPHA_BACKGROUND =\n 'linear-gradient(45deg, #c0c0c0 25%, transparent 25%), linear-gradient(-45deg, #c0c0c0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #c0c0c0 75%), linear-gradient(-45deg, transparent 75%, #c0c0c0 75%)';\n\nconst ALPHA_BACKGROUND_SIZE = '8px 8px';\nconst ALPHA_BACKGROUND_POSITION = '0 0, 0 4px, 4px -4px, -4px 0px';\n\nconst styles: Record<string, any> = {\n swatch: {\n mt: '16px',\n p: '4px',\n backgroundColor: 'background.paper',\n borderRadius: '6px',\n boxShadow: '0 0 0 1px rgba(128,128,128,.35)',\n display: 'inline-block',\n cursor: 'pointer',\n verticalAlign: 'middle',\n transition: 'box-shadow 0.15s ease-in-out',\n '&:hover': {\n boxShadow: '0 0 0 2px rgba(128,128,128,.6)',\n },\n },\n swatchDisabled: {\n opacity: 0.5,\n cursor: 'default',\n '&:hover': {\n boxShadow: '0 0 0 1px rgba(128,128,128,.35)',\n },\n },\n color: {\n height: 14,\n borderRadius: '3px',\n backgroundImage: ALPHA_BACKGROUND,\n backgroundSize: ALPHA_BACKGROUND_SIZE,\n backgroundPosition: ALPHA_BACKGROUND_POSITION,\n },\n delButton: {\n marginTop: 16,\n },\n textDense: {\n mt: 0,\n mb: 0,\n },\n popover: {\n '& .MuiPaper-root': {\n borderRadius: '12px',\n },\n },\n // The chrome around the react-colorful area\n pickerWrapper: (theme: IobTheme) => ({\n p: '12px',\n backgroundColor: theme.palette.background.paper,\n borderRadius: '12px',\n display: 'flex',\n flexDirection: 'column',\n gap: '10px',\n // restyle react-colorful, so it fits into the ioBroker themes\n '& .react-colorful': {\n width: '100%',\n height: 'auto',\n gap: '10px',\n },\n '& .react-colorful__saturation': {\n borderRadius: '8px',\n border: 'none',\n height: 150,\n boxShadow: 'none',\n },\n '& .react-colorful__hue, & .react-colorful__alpha': {\n height: 14,\n borderRadius: '7px',\n },\n '& .react-colorful__alpha': {\n backgroundImage: ALPHA_BACKGROUND,\n backgroundSize: ALPHA_BACKGROUND_SIZE,\n backgroundPosition: ALPHA_BACKGROUND_POSITION,\n },\n '& .react-colorful__last-control': {\n borderRadius: '7px',\n },\n '& .react-colorful__pointer': {\n width: 18,\n height: 18,\n borderWidth: 2,\n },\n '& .react-colorful__saturation-pointer': {\n width: 20,\n height: 20,\n },\n }),\n controlRow: {\n display: 'flex',\n alignItems: 'center',\n gap: '6px',\n },\n preview: {\n width: 28,\n height: 28,\n flexShrink: 0,\n borderRadius: '6px',\n boxShadow: '0 0 0 1px rgba(128,128,128,.35) inset',\n backgroundImage: ALPHA_BACKGROUND,\n backgroundSize: ALPHA_BACKGROUND_SIZE,\n backgroundPosition: ALPHA_BACKGROUND_POSITION,\n },\n valueInput: {\n flexGrow: 1,\n minWidth: 60,\n '& .MuiInputBase-input': {\n fontFamily: 'monospace',\n fontSize: '0.75rem',\n textOverflow: 'ellipsis',\n },\n },\n formatSelect: {\n flexShrink: 0,\n fontSize: '0.7rem',\n opacity: 0.75,\n '& .MuiSelect-select': {\n py: '4px',\n pl: '2px',\n pr: '18px !important',\n },\n '& .MuiSelect-icon': {\n right: 0,\n },\n },\n sectionTitle: {\n fontSize: '0.7rem',\n opacity: 0.6,\n textTransform: 'uppercase',\n letterSpacing: '0.06em',\n },\n swatchRow: {\n display: 'flex',\n flexWrap: 'wrap',\n gap: '4px',\n mt: '4px',\n },\n paletteItem: {\n width: 22,\n height: 22,\n p: 0,\n minWidth: 22,\n borderRadius: '5px',\n boxShadow: '0 0 0 1px rgba(128,128,128,.35) inset',\n backgroundImage: ALPHA_BACKGROUND,\n backgroundSize: ALPHA_BACKGROUND_SIZE,\n backgroundPosition: ALPHA_BACKGROUND_POSITION,\n '&:hover': {\n boxShadow: '0 0 0 2px rgba(128,128,128,.7) inset',\n },\n },\n fill: {\n width: '100%',\n height: '100%',\n borderRadius: 'inherit',\n },\n};\n\nconst DEFAULT_COLOR: RgbaColor = { r: 0, g: 0, b: 0, a: 1 };\n\nlet canvasContext: CanvasRenderingContext2D | null | undefined;\n\n/**\n * Normalize any CSS color notation (color names, `color()`, ...) with the help of a canvas.\n *\n * @param color The color string to normalize.\n * @returns the normalized color as `#rrggbb`/`rgba(...)` string or null if the string is no valid color.\n */\nfunction normalizeCssColor(color: string): string | null {\n if (canvasContext === undefined) {\n canvasContext = typeof document === 'undefined' ? null : document.createElement('canvas').getContext('2d');\n }\n if (!canvasContext) {\n return null;\n }\n // `fillStyle` keeps its previous value if the assigned string is no valid color,\n // so it must be probed with two different defaults\n canvasContext.fillStyle = '#000000';\n canvasContext.fillStyle = color;\n const first = canvasContext.fillStyle;\n canvasContext.fillStyle = '#ffffff';\n canvasContext.fillStyle = color;\n\n return first === canvasContext.fillStyle ? first : null;\n}\n\n/**\n * Convert h, s, l (0..1) to r, g, b (0..255).\n *\n * @param h The hue in the range 0..1.\n * @param s The saturation in the range 0..1.\n * @param l The lightness in the range 0..1.\n */\nfunction hsl2rgb(h: number, s: number, l: number): { r: number; g: number; b: number } {\n if (!s) {\n const v = Math.round(l * 255);\n return { r: v, g: v, b: v };\n }\n\n const hue2rgb = (p: number, q: number, t: number): number => {\n let _t = t;\n if (_t < 0) {\n _t += 1;\n }\n if (_t > 1) {\n _t -= 1;\n }\n if (_t < 1 / 6) {\n return p + (q - p) * 6 * _t;\n }\n if (_t < 1 / 2) {\n return q;\n }\n if (_t < 2 / 3) {\n return p + (q - p) * (2 / 3 - _t) * 6;\n }\n return p;\n };\n\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n\n return {\n r: Math.round(hue2rgb(p, q, h + 1 / 3) * 255),\n g: Math.round(hue2rgb(p, q, h) * 255),\n b: Math.round(hue2rgb(p, q, h - 1 / 3) * 255),\n };\n}\n\n/**\n * Convert r, g, b (0..255) to h (0..360), s, l (0..100).\n *\n * @param color The color to convert.\n */\nfunction rgb2hsl(color: RgbaColor): { h: number; s: number; l: number } {\n const r = color.r / 255;\n const g = color.g / 255;\n const b = color.b / 255;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (max + min) / 2;\n\n if (max === min) {\n return { h: 0, s: 0, l: Math.round(l * 100) };\n }\n const d = max - min;\n const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n let h: number;\n if (max === r) {\n h = (g - b) / d + (g < b ? 6 : 0);\n } else if (max === g) {\n h = (b - r) / d + 2;\n } else {\n h = (r - g) / d + 4;\n }\n\n return { h: Math.round((h / 6) * 360), s: Math.round(s * 100), l: Math.round(l * 100) };\n}\n\n/**\n * Clamp a number into the given range.\n *\n * @param value The value to clamp.\n * @param min The lower limit.\n * @param max The upper limit.\n */\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value));\n}\n\n/**\n * Read a color channel that may be given as `128` or as `50%`.\n *\n * @param value The channel as string.\n * @param max The maximal value of this channel.\n */\nfunction readChannel(value: string, max: number): number {\n const trimmed = value.trim();\n const parsed = parseFloat(trimmed);\n if (Number.isNaN(parsed)) {\n return 0;\n }\n return clamp(Math.round(trimmed.endsWith('%') ? (parsed / 100) * max : parsed), 0, max);\n}\n\n/**\n * Read the alpha channel that may be given as `0.5` or as `50%`.\n *\n * @param value The alpha channel as string or undefined if it is not given.\n */\nfunction readAlpha(value: string | undefined): number {\n if (value === undefined || value === '') {\n return 1;\n }\n const trimmed = value.trim();\n const parsed = trimmed.endsWith('%') ? parseFloat(trimmed) / 100 : parseFloat(trimmed);\n\n return Number.isNaN(parsed) ? 1 : clamp(parsed, 0, 1);\n}\n\n/**\n * Parse any CSS color notation into `{ r, g, b, a }`.\n *\n * Supported are `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb()`, `rgba()`, `hsl()`, `hsla()` (comma or space\n * separated, with or without the `/ alpha` part) and every color name the browser knows.\n *\n * @param color The color string to parse.\n * @returns the parsed color or null if the string could not be interpreted.\n */\nexport function parseColor(color: string): RgbaColor | null {\n if (!color || typeof color !== 'string') {\n return null;\n }\n const str = color.trim().toLowerCase();\n if (!str) {\n return null;\n }\n if (str === 'transparent') {\n return { r: 0, g: 0, b: 0, a: 0 };\n }\n\n const hex = /^#([\\da-f]{3,8})$/.exec(str);\n if (hex) {\n const h = hex[1];\n if (h.length === 3 || h.length === 4) {\n return {\n r: parseInt(h[0] + h[0], 16),\n g: parseInt(h[1] + h[1], 16),\n b: parseInt(h[2] + h[2], 16),\n a: h.length === 4 ? Math.round((parseInt(h[3] + h[3], 16) / 255) * 100) / 100 : 1,\n };\n }\n if (h.length === 6 || h.length === 8) {\n return {\n r: parseInt(h.substring(0, 2), 16),\n g: parseInt(h.substring(2, 4), 16),\n b: parseInt(h.substring(4, 6), 16),\n a: h.length === 8 ? Math.round((parseInt(h.substring(6, 8), 16) / 255) * 100) / 100 : 1,\n };\n }\n return null;\n }\n\n const func = /^(rgba?|hsla?)\\(([^)]*)\\)$/.exec(str);\n if (func) {\n // both `1, 2, 3, 0.5` and `1 2 3 / 50%` are valid\n const parts = func[2]\n .replace('/', ',')\n .split(/[\\s,]+/)\n .filter(part => part !== '');\n\n if (parts.length < 3) {\n return null;\n }\n if (func[1].startsWith('rgb')) {\n return {\n r: readChannel(parts[0], 255),\n g: readChannel(parts[1], 255),\n b: readChannel(parts[2], 255),\n a: readAlpha(parts[3]),\n };\n }\n const hue = ((parseFloat(parts[0]) % 360) + 360) % 360;\n const rgb = hsl2rgb(\n hue / 360,\n clamp(parseFloat(parts[1]) / 100, 0, 1),\n clamp(parseFloat(parts[2]) / 100, 0, 1),\n );\n\n return { ...rgb, a: readAlpha(parts[3]) };\n }\n\n // color names and everything else the browser understands\n const normalized = normalizeCssColor(str);\n\n return normalized && normalized !== str ? parseColor(normalized) : null;\n}\n\n/**\n * Render `{ r, g, b, a }` in the requested notation.\n *\n * @param color The color to render.\n * @param format The desired notation.\n * @param noAlpha If true, the alpha channel is dropped.\n * @returns the color as CSS string.\n */\nexport function formatColor(color: RgbaColor, format: ColorPickerFormat, noAlpha?: boolean): string {\n const alpha = noAlpha ? 1 : (color.a ?? 1);\n const opaque = alpha >= 1;\n const rounded = Math.round(alpha * 100) / 100;\n\n if (format === 'hex') {\n const hex = `#${color.r.toString(16).padStart(2, '0')}${color.g.toString(16).padStart(2, '0')}${color.b.toString(16).padStart(2, '0')}`;\n const hexAlpha = Math.round(alpha * 255)\n .toString(16)\n .padStart(2, '0');\n\n return opaque ? hex : `${hex}${hexAlpha}`;\n }\n if (format === 'hsl') {\n const { h, s, l } = rgb2hsl(color);\n\n return opaque ? `hsl(${h}, ${s}%, ${l}%)` : `hsla(${h}, ${s}%, ${l}%, ${rounded})`;\n }\n\n return opaque ? `rgb(${color.r}, ${color.g}, ${color.b})` : `rgba(${color.r}, ${color.g}, ${color.b}, ${rounded})`;\n}\n\n/**\n * Guess the notation of the given color string.\n *\n * @param color The color string.\n */\nfunction detectFormat(color: string): ColorPickerFormat | null {\n const str = (color || '').trim().toLowerCase();\n if (str.startsWith('#')) {\n return 'hex';\n }\n if (str.startsWith('rgb')) {\n return 'rgb';\n }\n if (str.startsWith('hsl')) {\n return 'hsl';\n }\n return null;\n}\n\ninterface EyeDropperInstance {\n open: (options?: { signal?: AbortSignal }) => Promise<{ sRGBHex: string }>;\n}\n\n/**\n * Read the `EyeDropper` constructor, which is not part of the DOM types yet.\n */\nfunction getEyeDropper(): (new () => EyeDropperInstance) | undefined {\n if (typeof window === 'undefined') {\n return undefined;\n }\n return (window as unknown as Record<string, unknown>).EyeDropper as (new () => EyeDropperInstance) | undefined;\n}\n\ninterface ColorPickerProps {\n /** Set to true to disable the color picker. */\n disabled?: boolean;\n /** The currently selected color. */\n value?: string;\n /** @deprecated The currently selected color use value */\n color?: string;\n /** The color change callback. */\n onChange: (rgba: string) => void;\n /** Label of the color picker. */\n label?: string;\n /** @deprecated TLabel of the color picker use label */\n name?: string;\n /** Additional styling for this component. */\n style?: CSSProperties;\n /** The CSS class name. */\n className?: string;\n /** Predefined colors that are offered below the picker. */\n customPalette?: string[];\n /** Do not show the text field with the color value, only the color bar. */\n noInputField?: boolean;\n /** Width of the color bar. */\n barWidth?: number;\n sx?: Record<string, any>;\n /** @deprecated the theme is taken from the MUI context */\n theme?: IobTheme;\n /** Hide the alpha slider and always report a fully opaque color. */\n noAlpha?: boolean;\n /** Notation of the reported value. If not set, it is taken from the incoming value and defaults to `rgb`. */\n format?: ColorPickerFormat;\n /** Do not offer the recently used colors. */\n noRecentColors?: boolean;\n /** Width of the picker popup in pixels. Default 280. */\n pickerWidth?: number;\n /** ID of the text field. Must be set if more than one color picker is rendered at the same time. */\n id?: string;\n}\n\ninterface ColorPickerState {\n displayColorPicker: boolean;\n /** The working color of the picker. Always valid, even if no color is selected. */\n rgba: RgbaColor;\n /** The text shown in the input field. An empty string means \"no color selected\". */\n textValue: string;\n format: ColorPickerFormat;\n anchorEl: HTMLDivElement | null;\n recentColors: string[];\n}\n\n/**\n * A color picker component with alpha channel, eye dropper and HEX/RGB/HSL notations.\n */\nexport class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {\n /**\n * Constructor for the color picker.\n *\n * @param props The properties.\n */\n constructor(props: ColorPickerProps) {\n super(props);\n const value = props.value || props.color || '';\n\n this.state = {\n displayColorPicker: false,\n rgba: parseColor(value) || { ...DEFAULT_COLOR },\n textValue: value,\n format: props.format || detectFormat(value) || 'rgb',\n anchorEl: null,\n recentColors: [],\n };\n }\n\n /**\n * If the props are updated from outside, they should override the state\n *\n * @param prevProps The previous properties.\n */\n componentDidUpdate(prevProps: ColorPickerProps): void {\n const prevValue = prevProps.value ?? prevProps.color ?? '';\n const value = this.props.value ?? this.props.color ?? '';\n\n // React only on real changes from outside. If the value equals what is shown, it is the own echo.\n if (prevValue !== value && value !== this.state.textValue) {\n this.setState({\n rgba: parseColor(value) || { ...DEFAULT_COLOR },\n textValue: value,\n format: this.props.format || detectFormat(value) || this.state.format,\n });\n } else if (this.props.format && this.props.format !== prevProps.format) {\n this.setState({ format: this.props.format });\n }\n }\n\n /**\n * Convert the given color to hex ('#rrggbb') or rgba ('rgba(r,g,b,a)') format.\n *\n * @param color The color to convert.\n * @param isHex If true, the color will be converted to hex format.\n * @returns the hex or rgba representation of the given color.\n */\n static getColor(color: string | { rgb: RGBColor } | RGBColor, isHex?: boolean): string {\n if (color && typeof color === 'object') {\n const oColor = color as { rgb: RGBColor };\n const rColor: RGBColor = oColor.rgb ? oColor.rgb : (color as RGBColor);\n\n if (isHex) {\n return `#${rColor.r.toString(16).padStart(2, '0')}${rColor.g.toString(16).padStart(2, '0')}${rColor.b.toString(16).padStart(2, '0')}`;\n }\n return `rgba(${rColor.r},${rColor.g},${rColor.b},${rColor.a ?? 1})`;\n }\n if (typeof color === 'string') {\n return isHex ? ColorPicker.rgb2hex(color || '') : color || '';\n }\n return '';\n }\n\n /**\n * Convert rgb() or rgba() format to hex format #rrggbb.\n *\n * @param rgb The color in rgb() or rgba() format. if not in this format, the color will be returned as is.\n */\n static rgb2hex(rgb: string): string {\n const m = /^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i.exec(rgb);\n\n if (m) {\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?.length === 4 ? `#${r}${g}${b}` : rgb;\n }\n return rgb;\n }\n\n /**\n * Read the recently used colors from the local storage.\n */\n static readRecentColors(): string[] {\n try {\n const stored = window.localStorage.getItem(RECENT_COLORS_KEY);\n const parsed: unknown = stored ? JSON.parse(stored) : null;\n\n if (Array.isArray(parsed)) {\n return parsed.filter((item): item is string => typeof item === 'string').slice(0, MAX_RECENT_COLORS);\n }\n } catch {\n // ignore a broken or unavailable local storage\n }\n return [];\n }\n\n /**\n * Remember the given color as recently used.\n *\n * @param color The color to remember.\n */\n storeRecentColor(color: string): void {\n if (this.props.noRecentColors || !color || this.state.recentColors[0] === color) {\n return;\n }\n const recentColors = [color, ...this.state.recentColors.filter(item => item !== color)].slice(\n 0,\n MAX_RECENT_COLORS,\n );\n\n this.setState({ recentColors });\n\n try {\n window.localStorage.setItem(RECENT_COLORS_KEY, JSON.stringify(recentColors));\n } catch {\n // ignore an unavailable local storage\n }\n }\n\n private handleClick = (e: React.MouseEvent<HTMLDivElement>): void => {\n const open = !this.state.displayColorPicker;\n\n this.setState({\n displayColorPicker: open,\n anchorEl: open ? e.currentTarget : null,\n // read the recent colors on every open, so colors picked in another instance show up too\n recentColors: open && !this.props.noRecentColors ? ColorPicker.readRecentColors() : this.state.recentColors,\n });\n };\n\n private handleClose = (): void => {\n this.storeRecentColor(this.state.textValue);\n this.setState({ displayColorPicker: false, anchorEl: null });\n };\n\n /**\n * The user moved a slider, clicked a swatch or used the eye dropper.\n *\n * @param rgba The new color.\n */\n private handleColorChange = (rgba: RgbaColor): void => {\n const textValue = formatColor(rgba, this.state.format, this.props.noAlpha);\n\n this.setState({ rgba, textValue }, () => this.props.onChange?.(textValue));\n };\n\n /**\n * The user typed into the input field. The text is taken as it is and only parsed for the preview.\n *\n * @param textValue The entered text.\n */\n private handleTextChange = (textValue: string): void => {\n const rgba = parseColor(textValue);\n\n this.setState({ textValue, rgba: rgba || this.state.rgba }, () => this.props.onChange?.(textValue));\n };\n\n /**\n * Switch between the #rrggbb, rgba() and hsla() notations.\n *\n * @param format The new notation.\n */\n private handleFormatChange = (format: ColorPickerFormat): void => {\n if (!this.state.textValue) {\n this.setState({ format });\n return;\n }\n const textValue = formatColor(this.state.rgba, format, this.props.noAlpha);\n\n this.setState({ format, textValue }, () => this.props.onChange?.(textValue));\n };\n\n private handleClear = (): void => {\n this.setState({ textValue: '', rgba: { ...DEFAULT_COLOR } }, () => this.props.onChange?.(''));\n };\n\n private handleEyeDropper = (): void => {\n const EyeDropper = getEyeDropper();\n if (!EyeDropper) {\n return;\n }\n\n void new EyeDropper()\n .open()\n .then(result => {\n const rgba = parseColor(result.sRGBHex);\n if (rgba) {\n // the eye dropper always returns an opaque color, so the current alpha is kept\n this.handleColorChange({ ...rgba, a: this.props.noAlpha ? 1 : (this.state.rgba.a ?? 1) });\n }\n })\n .catch(() => {\n // the user aborted the selection with ESC\n });\n };\n\n /**\n * Render a row of predefined colors.\n *\n * @param colors The colors to show.\n * @param title The title above the row.\n */\n renderSwatches(colors: string[], title: string): React.JSX.Element | null {\n if (!colors.length) {\n return null;\n }\n return (\n <Box component=\"div\">\n <Box\n component=\"div\"\n sx={styles.sectionTitle}\n >\n {title}\n </Box>\n <Box\n component=\"div\"\n sx={styles.swatchRow}\n >\n {colors.map((color, i) => (\n <Button\n sx={styles.paletteItem}\n key={`${color}_${i}`}\n title={color}\n onClick={() => {\n const rgba = parseColor(color);\n if (rgba) {\n this.handleColorChange(rgba);\n } else {\n this.handleTextChange(color);\n }\n }}\n >\n <Box\n component=\"div\"\n sx={styles.fill}\n style={{ background: color }}\n />\n </Button>\n ))}\n </Box>\n </Box>\n );\n }\n\n renderPicker(): React.JSX.Element {\n const { rgba, textValue, format } = this.state;\n const Picker = this.props.noAlpha ? RgbColorPicker : RgbaColorPicker;\n\n return (\n <Box\n component=\"div\"\n sx={styles.pickerWrapper}\n style={{ width: this.props.pickerWidth || 280 }}\n >\n <Picker\n color={rgba}\n onChange={(color: RgbaColor | { r: number; g: number; b: number }) =>\n this.handleColorChange({ a: rgba.a ?? 1, ...color })\n }\n />\n <Box\n component=\"div\"\n sx={styles.controlRow}\n >\n {getEyeDropper() ? (\n <Tooltip title={I18n.t('ra_Pick color from screen')}>\n <IconButton\n size=\"small\"\n onClick={this.handleEyeDropper}\n >\n <IconColorize fontSize=\"small\" />\n </IconButton>\n </Tooltip>\n ) : null}\n <Box\n component=\"div\"\n sx={styles.preview}\n >\n <Box\n component=\"div\"\n sx={styles.fill}\n style={{ background: textValue || 'transparent' }}\n />\n </Box>\n <TextField\n variant=\"standard\"\n size=\"small\"\n sx={styles.valueInput}\n value={textValue}\n placeholder={I18n.t('ra_Select color')}\n onChange={e => this.handleTextChange(e.target.value)}\n />\n <Select\n variant=\"standard\"\n disableUnderline\n sx={styles.formatSelect}\n value={format}\n onChange={e => this.handleFormatChange(e.target.value)}\n >\n <MenuItem value=\"hex\">HEX</MenuItem>\n <MenuItem value=\"rgb\">RGB</MenuItem>\n <MenuItem value=\"hsl\">HSL</MenuItem>\n </Select>\n <Tooltip title={I18n.t('ra_Clear color')}>\n <span>\n <IconButton\n size=\"small\"\n disabled={!textValue}\n onClick={this.handleClear}\n >\n <IconDelete fontSize=\"small\" />\n </IconButton>\n </span>\n </Tooltip>\n </Box>\n {this.renderSwatches(this.props.customPalette || [], I18n.t('ra_Palette'))}\n {this.renderSwatches(\n this.props.noRecentColors ? [] : this.state.recentColors,\n I18n.t('ra_Recently used colors'),\n )}\n </Box>\n );\n }\n\n render(): React.JSX.Element {\n const style = { ...(this.props.style || {}) };\n style.position = 'relative';\n const { textValue } = this.state;\n const hasLabel = !!(this.props.label || this.props.name);\n\n return (\n <Box\n component=\"div\"\n style={style}\n sx={this.props.sx || undefined}\n className={this.props.className || ''}\n >\n {this.props.noInputField ? null : (\n <TextField\n disabled={this.props.disabled}\n variant=\"standard\"\n id={this.props.id || 'ar_color_picker_name'}\n label={this.props.label || this.props.name}\n value={textValue}\n margin=\"dense\"\n sx={{\n '&.MuiFormControl-root': styles.textDense,\n width: textValue ? 'calc(100% - 80px)' : 'calc(100% - 56px)',\n mr: textValue ? undefined : 1,\n }}\n onChange={e => this.handleTextChange(e.target.value)}\n />\n )}\n {!this.props.noInputField && textValue ? (\n <IconButton\n disabled={this.props.disabled}\n onClick={this.handleClear}\n size=\"small\"\n style={hasLabel ? styles.delButton : undefined}\n >\n <IconDelete />\n </IconButton>\n ) : null}\n <Box\n component=\"div\"\n onClick={e => !this.props.disabled && this.handleClick(e)}\n title={I18n.t('ra_Select color')}\n sx={{\n ...styles.swatch,\n ...(this.props.disabled ? styles.swatchDisabled : undefined),\n marginTop: this.props.noInputField || !hasLabel ? 0 : undefined,\n }}\n >\n <Box\n component=\"div\"\n sx={{\n ...styles.color,\n border: textValue ? undefined : '1px dashed #888',\n boxSizing: 'border-box',\n }}\n style={{\n width: this.props.noInputField ? this.props.barWidth || 16 : this.props.barWidth || 36,\n }}\n >\n <Box\n component=\"div\"\n sx={styles.fill}\n style={{ background: textValue || 'transparent' }}\n />\n </Box>\n </Box>\n {this.state.displayColorPicker && !this.props.disabled ? (\n <Popover\n sx={styles.popover}\n anchorEl={this.state.anchorEl}\n open={!0}\n onClose={this.handleClose}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}\n transformOrigin={{ vertical: 'top', horizontal: 'left' }}\n >\n {this.renderPicker()}\n </Popover>\n ) : null}\n </Box>\n );\n }\n}\n"]}
@@ -32,6 +32,8 @@ export declare class ObjectBrowserClass extends Component<ObjectBrowserProps, Ob
32
32
  private observedContainer;
33
33
  /** Width class for which the columns were calculated the last time */
34
34
  private lastCalculatedWidth;
35
+ /** States view for which the columns were calculated the last time */
36
+ private lastCalculatedStatesView;
35
37
  private pausedSubscribes;
36
38
  /** The tree was rebuilt while subscribes were paused, so the filter must be re-applied on resume */
37
39
  private treeRebuiltWhilePaused;
@@ -74,7 +76,12 @@ export declare class ObjectBrowserClass extends Component<ObjectBrowserProps, Ob
74
76
  private resizerPosition;
75
77
  private resizerActiveDiv;
76
78
  private resizerNextDiv;
77
- private storedWidths;
79
+ /**
80
+ * The column widths the user stored for this dialog, as they were written to
81
+ * `<dialogName>.table`. They are kept independently of the width class, because the class is
82
+ * only known after the container was measured and changes when the window is resized.
83
+ */
84
+ private storedColumnWidths;
78
85
  systemConfig: ioBroker.SystemConfigObject | null;
79
86
  objects: Record<string, ioBroker.Object>;
80
87
  defaultHistory: string;
@@ -128,6 +135,15 @@ export declare class ObjectBrowserClass extends Component<ObjectBrowserProps, Ob
128
135
  initValue: boolean | number | string;
129
136
  };
130
137
  constructor(props: ObjectBrowserProps);
138
+ /**
139
+ * Write the stored column widths into the width class that is active now.
140
+ *
141
+ * Every width class has its own default widths, and the class of the object browser is only
142
+ * known after its container was measured - in the constructor it is still the initial guess.
143
+ * The stored widths must therefore be applied again whenever the class changes, otherwise the
144
+ * table falls back to the defaults of the new class and the user sees their widths reset.
145
+ */
146
+ applyStoredWidths(): void;
131
147
  loadAllObjects(update?: boolean): Promise<void>;
132
148
  expandAllSelected(cb?: () => void): void;
133
149
  /**
@@ -53,6 +53,8 @@ export class ObjectBrowserClass extends Component {
53
53
  observedContainer = null;
54
54
  /** Width class for which the columns were calculated the last time */
55
55
  lastCalculatedWidth = null;
56
+ /** States view for which the columns were calculated the last time */
57
+ lastCalculatedStatesView = null;
56
58
  pausedSubscribes = false;
57
59
  /** The tree was rebuilt while subscribes were paused, so the filter must be re-applied on resume */
58
60
  treeRebuiltWhilePaused = false;
@@ -95,7 +97,12 @@ export class ObjectBrowserClass extends Component {
95
97
  resizerPosition = 0;
96
98
  resizerActiveDiv = null;
97
99
  resizerNextDiv = null;
98
- storedWidths = null;
100
+ /**
101
+ * The column widths the user stored for this dialog, as they were written to
102
+ * `<dialogName>.table`. They are kept independently of the width class, because the class is
103
+ * only known after the container was measured and changes when the window is resized.
104
+ */
105
+ storedColumnWidths = null;
99
106
  systemConfig = null;
100
107
  objects;
101
108
  defaultHistory = '';
@@ -355,29 +362,51 @@ export class ObjectBrowserClass extends Component {
355
362
  const resizerCurrentWidthsStr = this.localStorage.getItem(`${this.props.dialogName || 'App'}.table`);
356
363
  if (resizerCurrentWidthsStr) {
357
364
  try {
358
- const resizerCurrentWidths = JSON.parse(resizerCurrentWidthsStr);
359
- const width = this.width || 'lg';
360
- this.storedWidths = JSON.parse(JSON.stringify(this.screenWidths[width]));
361
- Object.keys(resizerCurrentWidths).forEach(id => {
362
- if (id === 'id') {
363
- this.screenWidths[width].idWidth = resizerCurrentWidths.id;
364
- }
365
- else if (id === 'nameHeader') {
366
- // widths stored by an older version, where the header had an own width
367
- this.screenWidths[width].widths.name = resizerCurrentWidths[id];
368
- }
369
- else if (this.screenWidths[width].widths[id] !== undefined) {
370
- this.screenWidths[width].widths[id] = resizerCurrentWidths[id];
371
- }
365
+ const parsed = JSON.parse(resizerCurrentWidthsStr);
366
+ const storedColumnWidths = {};
367
+ Object.keys(parsed).forEach(id => {
368
+ // widths stored by an older version, where the header had an own width
369
+ storedColumnWidths[id === 'nameHeader' ? 'name' : id] = parsed[id];
372
370
  });
373
- this.customWidth = true;
371
+ this.storedColumnWidths = storedColumnWidths;
372
+ // The resizer has to start from the stored widths too. Without them the next drag
373
+ // would write only the two columns it touched back to the storage, and every other
374
+ // width the user had set would be lost.
375
+ this.resizerCurrentWidths = { ...storedColumnWidths };
374
376
  }
375
377
  catch {
376
- // ignore
378
+ this.storedColumnWidths = null;
377
379
  }
378
380
  }
381
+ this.applyStoredWidths();
379
382
  this.calculateColumnsVisibility();
380
383
  }
384
+ /**
385
+ * Write the stored column widths into the width class that is active now.
386
+ *
387
+ * Every width class has its own default widths, and the class of the object browser is only
388
+ * known after its container was measured - in the constructor it is still the initial guess.
389
+ * The stored widths must therefore be applied again whenever the class changes, otherwise the
390
+ * table falls back to the defaults of the new class and the user sees their widths reset.
391
+ */
392
+ applyStoredWidths() {
393
+ if (!this.storedColumnWidths) {
394
+ return;
395
+ }
396
+ const screen = this.screenWidths[this.width || 'lg'];
397
+ const storedColumnWidths = this.storedColumnWidths;
398
+ Object.keys(storedColumnWidths).forEach(id => {
399
+ if (id === 'id') {
400
+ screen.idWidth = storedColumnWidths.id;
401
+ }
402
+ else if (screen.widths[id] !== undefined) {
403
+ // A column that this width class does not know keeps its place; only the widths of
404
+ // the columns the class actually shows may be overwritten.
405
+ screen.widths[id] = storedColumnWidths[id];
406
+ }
407
+ });
408
+ this.customWidth = true;
409
+ }
381
410
  async loadAllObjects(update) {
382
411
  const props = this.props;
383
412
  try {
@@ -1873,30 +1902,45 @@ export class ObjectBrowserClass extends Component {
1873
1902
  }
1874
1903
  else {
1875
1904
  const width = this.width || 'lg';
1905
+ /**
1906
+ * A row shows either type/role/room/function or the four columns of the states view,
1907
+ * never both. A column of the set that is not shown must have the width zero, so that
1908
+ * the ID column, which fills the rest of the row, gets the right place.
1909
+ */
1910
+ const shown = (name, inStatesView) => !!this.state.statesView === inStatesView && columns.includes(name);
1911
+ /** Width of one column: what the user set for it, else the default of the width class */
1912
+ const widthOf = (name) => columnsWidths[name] || WIDTHS[name] || 0;
1913
+ /**
1914
+ * The width classes below `lg` do not define the columns of the states view, but the
1915
+ * user can select them by hand there too, so they fall back to the widest class.
1916
+ */
1917
+ const statesWidthOf = (name) => widthOf(name) || this.screenWidths.xl.widths[name] || 0;
1876
1918
  this.columnsVisibility = {
1877
1919
  id: columnsWidths.id || this.screenWidths[width].idWidth,
1878
- name: columns.includes('name')
1879
- ? columnsWidths.name || WIDTHS.name || this.screenWidths[width].widths.name || 0
1880
- : 0,
1881
- type: columns.includes('type')
1882
- ? columnsWidths.type || WIDTHS.type || this.screenWidths[width].widths.type || 0
1883
- : 0,
1884
- role: columns.includes('role')
1885
- ? columnsWidths.role || WIDTHS.role || this.screenWidths[width].widths.role || 0
1886
- : 0,
1887
- room: columns.includes('room')
1888
- ? columnsWidths.room || WIDTHS.room || this.screenWidths[width].widths.room || 0
1889
- : 0,
1890
- func: columns.includes('func')
1891
- ? columnsWidths.func || WIDTHS.func || this.screenWidths[width].widths.func || 0
1892
- : 0,
1920
+ name: columns.includes('name') ? widthOf('name') : 0,
1921
+ type: shown('type', false) ? widthOf('type') : 0,
1922
+ role: shown('role', false) ? widthOf('role') : 0,
1923
+ room: shown('room', false) ? widthOf('room') : 0,
1924
+ func: shown('func', false) ? widthOf('func') : 0,
1925
+ // The states view columns were missing here completely: their checkboxes in the
1926
+ // configuration dialog had no effect, and the header showed them although no row
1927
+ // had a cell for them.
1928
+ changedFrom: shown('changedFrom', true) ? statesWidthOf('changedFrom') : 0,
1929
+ qualityCode: shown('qualityCode', true) ? statesWidthOf('qualityCode') : 0,
1930
+ timestamp: shown('timestamp', true) ? statesWidthOf('timestamp') : 0,
1931
+ lastChange: shown('lastChange', true) ? statesWidthOf('lastChange') : 0,
1893
1932
  };
1894
1933
  let widthSum = this.columnsVisibility.id; // id is always visible
1895
1934
  if (this.columnsVisibility.name) {
1935
+ // Only one of the two sets has a width, so both may be added up
1896
1936
  widthSum += this.columnsVisibility.type || 0;
1897
1937
  widthSum += this.columnsVisibility.role || 0;
1898
1938
  widthSum += this.columnsVisibility.room || 0;
1899
1939
  widthSum += this.columnsVisibility.func || 0;
1940
+ widthSum += this.columnsVisibility.changedFrom || 0;
1941
+ widthSum += this.columnsVisibility.qualityCode || 0;
1942
+ widthSum += this.columnsVisibility.timestamp || 0;
1943
+ widthSum += this.columnsVisibility.lastChange || 0;
1900
1944
  }
1901
1945
  if (columnsForAdmin && columns) {
1902
1946
  Object.keys(columnsForAdmin)
@@ -2049,6 +2093,10 @@ export class ObjectBrowserClass extends Component {
2049
2093
  }
2050
2094
  };
2051
2095
  resizerMouseUp = () => {
2096
+ // Remember the new widths for the other width classes as well: the drag only changed two CSS
2097
+ // variables, the width class of the container may change at any time afterwards.
2098
+ this.storedColumnWidths = { ...this.resizerCurrentWidths };
2099
+ this.applyStoredWidths();
2052
2100
  this.localStorage.setItem(`${this.props.dialogName || 'App'}.table`, JSON.stringify(this.resizerCurrentWidths));
2053
2101
  this.resizerActiveName = null;
2054
2102
  this.resizerNextName = null;
@@ -2058,7 +2106,6 @@ export class ObjectBrowserClass extends Component {
2058
2106
  window.removeEventListener('mouseup', this.resizerMouseUp);
2059
2107
  };
2060
2108
  resizerMouseDown = (e) => {
2061
- this.storedWidths ||= JSON.parse(JSON.stringify(this.screenWidths[this.width || 'lg']));
2062
2109
  this.resizerCurrentWidths ||= {};
2063
2110
  this.resizerActiveDiv = e.target.parentNode;
2064
2111
  this.resizerActiveName = this.resizerActiveDiv.dataset.name || null;
@@ -2085,6 +2132,12 @@ export class ObjectBrowserClass extends Component {
2085
2132
  i++;
2086
2133
  } */
2087
2134
  }
2135
+ if (!this.resizerNextDiv) {
2136
+ // The column is the last one of the row, there is no neighbour to take the place from
2137
+ this.resizerActiveDiv = null;
2138
+ this.resizerActiveName = null;
2139
+ return;
2140
+ }
2088
2141
  this.resizerNextName = this.resizerNextDiv.dataset.name || null;
2089
2142
  this.resizerMin = parseInt(this.resizerActiveDiv.dataset.min, 10) || 0;
2090
2143
  this.resizerNextMin = parseInt(this.resizerNextDiv.dataset.min, 10) || 0;
@@ -2167,7 +2220,13 @@ export class ObjectBrowserClass extends Component {
2167
2220
  }
2168
2221
  resizerReset = () => {
2169
2222
  this.customWidth = false;
2170
- this.screenWidths[this.width || 'lg'] = JSON.parse(JSON.stringify(this.storedWidths));
2223
+ this.storedColumnWidths = null;
2224
+ this.resizerCurrentWidths = {};
2225
+ // Back to the defaults of every width class, not only of the one that is active now - the
2226
+ // stored widths had been applied to every class the user had the browser open in.
2227
+ Object.keys(SCREEN_WIDTHS).forEach(width => {
2228
+ this.screenWidths[width] = JSON.parse(JSON.stringify(SCREEN_WIDTHS[width]));
2229
+ });
2171
2230
  this.calculateColumnsVisibility();
2172
2231
  this.localStorage.removeItem(`${this.props.dialogName || 'App'}.table`);
2173
2232
  this.forceUpdate();
@@ -2381,9 +2440,13 @@ export class ObjectBrowserClass extends Component {
2381
2440
  if (!this.state.loaded) {
2382
2441
  return React.createElement(LinearProgress, { key: `${this.props.dialogName}_c` });
2383
2442
  }
2384
- // the container was resized into another width class => other columns are visible
2385
- if (this.lastCalculatedWidth !== this.width) {
2443
+ // the container was resized into another width class => other columns are visible, and the
2444
+ // stored widths have to be written into the defaults of the new class.
2445
+ // The states view shows other columns too, so it has to be recalculated as well.
2446
+ if (this.lastCalculatedWidth !== this.width || this.lastCalculatedStatesView !== this.state.statesView) {
2386
2447
  this.lastCalculatedWidth = this.width;
2448
+ this.lastCalculatedStatesView = this.state.statesView;
2449
+ this.applyStoredWidths();
2387
2450
  this.calculateColumnsVisibility();
2388
2451
  }
2389
2452
  const items = this.root ? this.renderItem(this.root, undefined) : null;