@iobroker/gui-components 10.1.0 → 10.2.1
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/README.md +18 -1
- package/build/Components/ColorPicker.d.ts +94 -12
- package/build/Components/ColorPicker.js +567 -111
- package/build/Components/ColorPicker.js.map +1 -1
- package/build/Components/ObjectBrowser/ObjectBrowserClass.d.ts +6 -2
- package/build/Components/ObjectBrowser/ObjectBrowserClass.js +73 -35
- package/build/Components/ObjectBrowser/ObjectBrowserClass.js.map +1 -1
- package/build/Components/ObjectBrowser/dialogs.js +8 -4
- package/build/Components/ObjectBrowser/dialogs.js.map +1 -1
- package/build/Components/ObjectBrowser/renderLeaf.js +34 -21
- package/build/Components/ObjectBrowser/renderLeaf.js.map +1 -1
- package/build/Components/ObjectBrowser/styles.js +9 -0
- package/build/Components/ObjectBrowser/styles.js.map +1 -1
- package/build/Components/ObjectBrowser/utils.js +5 -12
- package/build/Components/ObjectBrowser/utils.js.map +1 -1
- package/build/Components/Schedule.js +176 -78
- package/build/Components/Schedule.js.map +1 -1
- package/build/Components/TreeTable.d.ts +6 -2
- package/build/Components/TreeTable.js +183 -103
- package/build/Components/TreeTable.js.map +1 -1
- package/build/Dialogs/Error.js +26 -5
- package/build/Dialogs/Error.js.map +1 -1
- package/build/i18n/de.json +20 -0
- package/build/i18n/en.json +20 -0
- package/build/i18n/es.json +20 -0
- package/build/i18n/fr.json +20 -0
- package/build/i18n/it.json +20 -0
- package/build/i18n/nl.json +20 -0
- package/build/i18n/pl.json +20 -0
- package/build/i18n/pt.json +20 -0
- package/build/i18n/ru.json +20 -0
- package/build/i18n/uk.json +20 -0
- package/build/i18n/zh-cn.json +20 -0
- package/build/index.d.ts +2 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/i18n/de.json +20 -0
- package/i18n/en.json +20 -0
- package/i18n/es.json +20 -0
- package/i18n/fr.json +20 -0
- package/i18n/it.json +20 -0
- package/i18n/nl.json +20 -0
- package/i18n/pl.json +20 -0
- package/i18n/pt.json +20 -0
- package/i18n/ru.json +20 -0
- package/i18n/uk.json +20 -0
- package/i18n/zh-cn.json +20 -0
- package/package.json +7 -9
|
@@ -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;IACD,WAAW,EAAE;QACT,OAAO,EAAE,CAAC;KACb;IACD,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W,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,yBAAyB,GAAG,gCAAgC,CAAC;AAEnE,MAA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AC,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"]}
|
|
@@ -33,6 +33,10 @@ export declare class ObjectBrowserClass extends Component<ObjectBrowserProps, Ob
|
|
|
33
33
|
/** Width class for which the columns were calculated the last time */
|
|
34
34
|
private lastCalculatedWidth;
|
|
35
35
|
private pausedSubscribes;
|
|
36
|
+
/** The tree was rebuilt while subscribes were paused, so the filter must be re-applied on resume */
|
|
37
|
+
private treeRebuiltWhilePaused;
|
|
38
|
+
/** Time of the first object change since the last tree rebuild (upper bound for the rebuild delay) */
|
|
39
|
+
private objectsUpdateFirstTs;
|
|
36
40
|
private selectFirst;
|
|
37
41
|
/** Last navigation that was applied from `navigateTo` or reported via `onNavigateTo` (loop guard). */
|
|
38
42
|
private lastNav;
|
|
@@ -40,7 +44,7 @@ export declare class ObjectBrowserClass extends Component<ObjectBrowserProps, Ob
|
|
|
40
44
|
private applyingNav;
|
|
41
45
|
root: TreeItem | null;
|
|
42
46
|
readonly states: Record<string, ioBroker.State>;
|
|
43
|
-
subscribes: string
|
|
47
|
+
subscribes: Set<string>;
|
|
44
48
|
private unsubscribeTimer;
|
|
45
49
|
private statesUpdateTimer;
|
|
46
50
|
private objectsUpdateTimer;
|
|
@@ -94,7 +98,7 @@ export declare class ObjectBrowserClass extends Component<ObjectBrowserProps, Ob
|
|
|
94
98
|
item: any;
|
|
95
99
|
ts: number;
|
|
96
100
|
};
|
|
97
|
-
recordStates: string
|
|
101
|
+
recordStates: Set<string>;
|
|
98
102
|
styles: {
|
|
99
103
|
cellIdIconFolder?: React.CSSProperties;
|
|
100
104
|
cellIdIconDocument?: React.CSSProperties;
|
|
@@ -17,7 +17,7 @@ import { Utils } from '../Utils'; // @iobroker/gui-components/Components/Utils
|
|
|
17
17
|
import { TabContainer } from '../TabContainer';
|
|
18
18
|
import { TabContent } from '../TabContent';
|
|
19
19
|
import { TabHeader } from '../TabHeader';
|
|
20
|
-
import { applyFilter,
|
|
20
|
+
import { applyFilter, buildTree, findNode, formatValue, generateFile, getName, colVar, widthFromContainer, growVar, getSelectIdIconFromObjects, setCustomValue, } from './utils';
|
|
21
21
|
import { HistoryChart } from './HistoryChart';
|
|
22
22
|
import { styles } from './styles';
|
|
23
23
|
import * as dialogs from './dialogs';
|
|
@@ -54,6 +54,10 @@ export class ObjectBrowserClass extends Component {
|
|
|
54
54
|
/** Width class for which the columns were calculated the last time */
|
|
55
55
|
lastCalculatedWidth = null;
|
|
56
56
|
pausedSubscribes = false;
|
|
57
|
+
/** The tree was rebuilt while subscribes were paused, so the filter must be re-applied on resume */
|
|
58
|
+
treeRebuiltWhilePaused = false;
|
|
59
|
+
/** Time of the first object change since the last tree rebuild (upper bound for the rebuild delay) */
|
|
60
|
+
objectsUpdateFirstTs = 0;
|
|
57
61
|
selectFirst;
|
|
58
62
|
/** Last navigation that was applied from `navigateTo` or reported via `onNavigateTo` (loop guard). */
|
|
59
63
|
lastNav = null;
|
|
@@ -61,7 +65,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
61
65
|
applyingNav = false;
|
|
62
66
|
root = null;
|
|
63
67
|
states = {};
|
|
64
|
-
subscribes =
|
|
68
|
+
subscribes = new Set();
|
|
65
69
|
unsubscribeTimer = null;
|
|
66
70
|
statesUpdateTimer = null;
|
|
67
71
|
objectsUpdateTimer = null;
|
|
@@ -99,7 +103,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
99
103
|
columnsVisibility = {};
|
|
100
104
|
changedIds = null;
|
|
101
105
|
contextMenu = null;
|
|
102
|
-
recordStates =
|
|
106
|
+
recordStates = new Set();
|
|
103
107
|
styles = {};
|
|
104
108
|
expertMode = false;
|
|
105
109
|
customColumnDialog = null;
|
|
@@ -688,7 +692,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
688
692
|
// console.log(`- unsubscribe ${pattern}`);
|
|
689
693
|
this.props.socket.unsubscribeState(pattern, this.onStateChange);
|
|
690
694
|
});
|
|
691
|
-
this.subscribes
|
|
695
|
+
this.subscribes.clear();
|
|
692
696
|
this.objects = {};
|
|
693
697
|
}
|
|
694
698
|
/**
|
|
@@ -740,7 +744,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
740
744
|
// console.log(`- unsubscribe ${pattern}`);
|
|
741
745
|
this.props.socket.unsubscribeState(pattern, this.onStateChange);
|
|
742
746
|
});
|
|
743
|
-
this.subscribes
|
|
747
|
+
this.subscribes.clear();
|
|
744
748
|
this.loadAllObjects(true)
|
|
745
749
|
.then(() => console.log('updated!'))
|
|
746
750
|
.catch(e => this.showError(e));
|
|
@@ -837,12 +841,12 @@ export class ObjectBrowserClass extends Component {
|
|
|
837
841
|
}
|
|
838
842
|
checkUnsubscribes() {
|
|
839
843
|
// Remove unused subscriptions
|
|
840
|
-
for (
|
|
841
|
-
if (!this.recordStates.
|
|
842
|
-
this.unsubscribe(
|
|
844
|
+
for (const id of [...this.subscribes]) {
|
|
845
|
+
if (!this.recordStates.has(id)) {
|
|
846
|
+
this.unsubscribe(id);
|
|
843
847
|
}
|
|
844
848
|
}
|
|
845
|
-
this.recordStates
|
|
849
|
+
this.recordStates.clear();
|
|
846
850
|
}
|
|
847
851
|
/**
|
|
848
852
|
* Find an item.
|
|
@@ -875,6 +879,19 @@ export class ObjectBrowserClass extends Component {
|
|
|
875
879
|
*/
|
|
876
880
|
onStateChange = (id, state) => {
|
|
877
881
|
// console.log(`> stateChange ${id}`);
|
|
882
|
+
const oldState = this.states[id];
|
|
883
|
+
if (state &&
|
|
884
|
+
oldState &&
|
|
885
|
+
state.val === oldState.val &&
|
|
886
|
+
state.ack === oldState.ack &&
|
|
887
|
+
state.q === oldState.q &&
|
|
888
|
+
state.ts === oldState.ts &&
|
|
889
|
+
state.lc === oldState.lc &&
|
|
890
|
+
state.from === oldState.from) {
|
|
891
|
+
// echo of the already known state: nothing that is displayed can have changed
|
|
892
|
+
// (`from` is compared too, because it is shown in the `changedFrom` column)
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
878
895
|
if (this.states[id]) {
|
|
879
896
|
const item = this.findItem(id);
|
|
880
897
|
if (item?.data.state) {
|
|
@@ -995,23 +1012,38 @@ export class ObjectBrowserClass extends Component {
|
|
|
995
1012
|
this.afterObjectUpdated();
|
|
996
1013
|
};
|
|
997
1014
|
afterObjectUpdated() {
|
|
998
|
-
if (!this.
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
}
|
|
1012
|
-
// else it will be re-rendered when the dialog will be closed
|
|
1013
|
-
}, 500);
|
|
1015
|
+
if (!this.objects) {
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
if (this.objectsUpdateTimer) {
|
|
1019
|
+
// collect a burst of object changes into one rebuild: wait for a quiet period,
|
|
1020
|
+
// but do not postpone the rebuild forever while changes keep arriving
|
|
1021
|
+
if (Date.now() - this.objectsUpdateFirstTs >= 2000) {
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
clearTimeout(this.objectsUpdateTimer);
|
|
1025
|
+
}
|
|
1026
|
+
else {
|
|
1027
|
+
this.objectsUpdateFirstTs = Date.now();
|
|
1014
1028
|
}
|
|
1029
|
+
this.objectsUpdateTimer = setTimeout(() => {
|
|
1030
|
+
this.objectsUpdateTimer = null;
|
|
1031
|
+
const { info, root } = buildTree(this.objects, {
|
|
1032
|
+
imagePrefix: this.props.imagePrefix,
|
|
1033
|
+
root: this.props.root,
|
|
1034
|
+
lang: this.props.lang,
|
|
1035
|
+
themeType: this.props.themeType,
|
|
1036
|
+
});
|
|
1037
|
+
this.root = root;
|
|
1038
|
+
this.info = info;
|
|
1039
|
+
if (!this.pausedSubscribes) {
|
|
1040
|
+
this.doFilter(true);
|
|
1041
|
+
}
|
|
1042
|
+
else {
|
|
1043
|
+
// the new tree has no visibility flags yet; re-apply the filter when the dialog is closed
|
|
1044
|
+
this.treeRebuiltWhilePaused = true;
|
|
1045
|
+
}
|
|
1046
|
+
}, 500);
|
|
1015
1047
|
}
|
|
1016
1048
|
// This function is called when the user changes the alias of an object.
|
|
1017
1049
|
// It updates the aliasMap and returns true if the aliasMap has changed.
|
|
@@ -1097,8 +1129,8 @@ export class ObjectBrowserClass extends Component {
|
|
|
1097
1129
|
return { newInnerState, filtered: false };
|
|
1098
1130
|
}
|
|
1099
1131
|
subscribe(id) {
|
|
1100
|
-
if (!this.subscribes.
|
|
1101
|
-
this.subscribes.
|
|
1132
|
+
if (!this.subscribes.has(id)) {
|
|
1133
|
+
this.subscribes.add(id);
|
|
1102
1134
|
// console.log(`+ subscribe ${id}`);
|
|
1103
1135
|
if (!this.pausedSubscribes) {
|
|
1104
1136
|
this.props.socket
|
|
@@ -1108,9 +1140,8 @@ export class ObjectBrowserClass extends Component {
|
|
|
1108
1140
|
}
|
|
1109
1141
|
}
|
|
1110
1142
|
unsubscribe(id) {
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
this.subscribes.splice(pos, 1);
|
|
1143
|
+
if (this.subscribes.has(id)) {
|
|
1144
|
+
this.subscribes.delete(id);
|
|
1114
1145
|
if (this.states[id]) {
|
|
1115
1146
|
delete this.states[id];
|
|
1116
1147
|
}
|
|
@@ -1129,6 +1160,11 @@ export class ObjectBrowserClass extends Component {
|
|
|
1129
1160
|
else if (this.pausedSubscribes && !isPause) {
|
|
1130
1161
|
this.pausedSubscribes = false;
|
|
1131
1162
|
this.subscribes.forEach(id => this.props.socket.subscribeState(id, this.onStateChange));
|
|
1163
|
+
if (this.treeRebuiltWhilePaused) {
|
|
1164
|
+
// without this filter run, no node of the rebuilt tree is marked visible and the browser stays empty
|
|
1165
|
+
this.treeRebuiltWhilePaused = false;
|
|
1166
|
+
this.doFilter(true);
|
|
1167
|
+
}
|
|
1132
1168
|
}
|
|
1133
1169
|
}
|
|
1134
1170
|
clearFilter() {
|
|
@@ -1168,20 +1204,21 @@ export class ObjectBrowserClass extends Component {
|
|
|
1168
1204
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`, '[]');
|
|
1169
1205
|
this.setState({ expanded: [], depth: 0, selected: [] }, () => this.onAfterSelect());
|
|
1170
1206
|
}
|
|
1171
|
-
expandDepth(root, depth, expanded) {
|
|
1207
|
+
expandDepth(root, depth, expanded, expandedSet) {
|
|
1172
1208
|
if (!this.root) {
|
|
1173
1209
|
throw new Error('No root');
|
|
1174
1210
|
}
|
|
1175
1211
|
root ||= this.root;
|
|
1212
|
+
expandedSet ||= new Set(expanded);
|
|
1176
1213
|
if (depth > 0) {
|
|
1177
1214
|
root.children?.forEach(item => {
|
|
1178
1215
|
if (item.data.sumVisibility) {
|
|
1179
|
-
if (!
|
|
1216
|
+
if (!expandedSet.has(item.data.id)) {
|
|
1180
1217
|
expanded.push(item.data.id);
|
|
1181
|
-
|
|
1218
|
+
expandedSet.add(item.data.id);
|
|
1182
1219
|
}
|
|
1183
1220
|
if (depth - 1 > 0) {
|
|
1184
|
-
this.expandDepth(item, depth - 1, expanded);
|
|
1221
|
+
this.expandDepth(item, depth - 1, expanded, expandedSet);
|
|
1185
1222
|
}
|
|
1186
1223
|
}
|
|
1187
1224
|
});
|
|
@@ -1196,6 +1233,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
1196
1233
|
const expanded = [...this.state.expanded];
|
|
1197
1234
|
if (this.root) {
|
|
1198
1235
|
this.expandDepth(this.root, depth, expanded);
|
|
1236
|
+
expanded.sort();
|
|
1199
1237
|
}
|
|
1200
1238
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectExpanded`, JSON.stringify(expanded));
|
|
1201
1239
|
this.setState({ depth, expanded });
|
|
@@ -2303,7 +2341,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
2303
2341
|
* The rendering method of this component.
|
|
2304
2342
|
*/
|
|
2305
2343
|
render() {
|
|
2306
|
-
this.recordStates
|
|
2344
|
+
this.recordStates.clear();
|
|
2307
2345
|
if (this.unsubscribeTimer) {
|
|
2308
2346
|
clearTimeout(this.unsubscribeTimer);
|
|
2309
2347
|
}
|