@iobroker/adapter-react-v5 7.6.20 → 7.7.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.
@@ -81,6 +81,8 @@ interface DialogSelectIDProps {
81
81
  allowNonObjects?: boolean;
82
82
  /** Will be called by selection, so the decision could be done if the OK button is available or not */
83
83
  onSelectConfirm?: (selected: string | string[], objects: Record<string, ioBroker.Object | null | undefined>) => Promise<boolean>;
84
+ /** The z-index of the dialog; default: 1300 */
85
+ zIndex?: number;
84
86
  }
85
87
  interface DialogSelectIDState {
86
88
  selected: string[];
@@ -83,7 +83,7 @@ export class DialogSelectID extends Component {
83
83
  else {
84
84
  title = this.props.title || I18n.t('ra_Please select object ID...');
85
85
  }
86
- return (React.createElement(Dialog, { onClose: () => { }, maxWidth: false, sx: {
86
+ return (React.createElement(Dialog, { onClose: () => { }, maxWidth: false, style: { zIndex: this.props.zIndex || undefined }, sx: {
87
87
  '& .MuiDialog-paper': {
88
88
  height: '95%',
89
89
  p: '4px',
@@ -1 +1 @@
1
- {"version":3,"file":"SelectID.js","sourceRoot":"./src/","sources":["Dialogs/SelectID.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI5E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EACH,aAAa,GAIhB,MAAM,6BAA6B,CAAC;AAwFrC,MAAM,OAAO,cAAe,SAAQ,SAAmD;IAClE,UAAU,CAAS;IAE5B,OAAO,CAAsB;IAEpB,UAAU,CAAqC;IAEhE,YAAY,KAA0B;QAClC,KAAK,CAA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C,CAAC,OAAO,CAAC,CAC5B;gBACT,oBAAC,MAAM,IACH,EAAE,EAAE,6BAA6B,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE,EAC9D,KAAK,EAAC,MAAM,EACZ,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,SAAS,EAAE,oBAAC,UAAU,OAAG,IAExB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\n * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>\n *\n * MIT License\n *\n */\nimport React, { Component, type JSX } from 'react';\n\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog } from '@mui/material';\n\nimport { Cancel as IconCancel, Check as IconOk } from '@mui/icons-material';\n\nimport type { Connection } from '../Connection';\n\nimport { I18n } from '../i18n';\nimport {\n ObjectBrowser,\n type ObjectBrowserFilter,\n type ObjectBrowserColumn,\n type ObjectBrowserCustomFilter,\n} from '../Components/ObjectBrowser';\nimport type { IobTheme } from '../types';\n\nexport interface SelectIDFilters {\n id?: string;\n name?: string;\n room?: string;\n func?: string;\n role?: string;\n type?: string;\n custom?: string;\n}\n\ninterface DialogSelectIDProps {\n /** The internal name of the dialog; default: \"default\". Used to store settings in local storage */\n dialogName?: string;\n /** The dialog title; default: Please select object ID... (translated) */\n title?: string;\n /** Set to true to allow the selection of multiple IDs. */\n multiSelect?: boolean;\n /** Show folders before any leaves. */\n foldersFirst?: boolean;\n /** Path prefix for images (default: '.') */\n imagePrefix?: string;\n /** @deprecated same as imagePrefix */\n prefix?: string;\n /** Show the expert button */\n showExpertButton?: boolean;\n /** Force expert mode */\n expertMode?: boolean;\n /** optional ['name', 'type', 'role', 'room', 'func', 'val', 'buttons'] */\n columns?: ObjectBrowserColumn[];\n /** Object types to show; default: 'state' only */\n types?: ioBroker.ObjectType | ioBroker.ObjectType[];\n /** The language. */\n lang?: ioBroker.Languages;\n /** The socket connection. */\n socket: Connection;\n /** Can't objects be edited? (default: true) */\n notEditable?: boolean;\n /** Theme name. */\n themeName?: string;\n /** Theme type: dark or light */\n themeType?: string;\n /** The theme object */\n theme: IobTheme;\n /** The date format for the date columns */\n dateFormat?: string;\n /** Is use comma or point for displaying of float numbers */\n isFloatComma?: boolean;\n /** Custom filter. */\n customFilter?: ObjectBrowserCustomFilter;\n /** The selected IDs. */\n selected?: string | string[];\n /** The ok button text; default: OK (translated) */\n ok?: string;\n /** The cancel button text; default: Cancel (translated) */\n cancel?: string;\n /** Close handler that is always called when the dialog is closed. */\n onClose: () => void;\n /** Handler that is called when the user presses OK. */\n onOk: (selected: string | string[] | undefined, name: string | null) => void;\n /**\n * Function to filter out all unnecessary objects. Can be string or function.\n * It cannot be used together with \"types\".\n * Example for function: `obj => obj.common?.type === 'boolean'` to show only boolean states\n * In case of string, it must look like `obj.common && obj.common.type === 'boolean'`\n */\n filterFunc?: string | ((obj: ioBroker.Object) => boolean);\n /** predefined filter fields, like {\"id\":\"\",\"name\":\"\",\"room\":\"\",\"func\":\"\",\"role\":\"level\",\"type\":\"\",\"custom\":\"\"} */\n filters?: SelectIDFilters;\n /** Show elements only of this root ID */\n root?: string;\n /** Allow selection of non-objects (virtual branches) */\n allowNonObjects?: boolean;\n /** Will be called by selection, so the decision could be done if the OK button is available or not */\n onSelectConfirm?: (\n selected: string | string[],\n objects: Record<string, ioBroker.Object | null | undefined>,\n ) => Promise<boolean>;\n}\n\ninterface DialogSelectIDState {\n selected: string[];\n name: string | null;\n selectionBlocked: boolean;\n}\n\nexport class DialogSelectID extends Component<DialogSelectIDProps, DialogSelectIDState> {\n private readonly dialogName: string;\n\n private filters: ObjectBrowserFilter;\n\n private readonly filterFunc?: (obj: ioBroker.Object) => boolean;\n\n constructor(props: DialogSelectIDProps) {\n super(props);\n this.dialogName = this.props.dialogName || 'default';\n this.dialogName = `SelectID.${this.dialogName}`;\n\n const filters: string = ((window as any)._localStorage || window.localStorage).getItem(this.dialogName) || '{}';\n\n try {\n this.filters = JSON.parse(filters);\n } catch {\n this.filters = {};\n }\n\n if (props.filters) {\n this.filters = { ...this.filters, ...(props.filters || {}) };\n }\n\n let selected = this.props.selected || [];\n if (!Array.isArray(selected)) {\n selected = [selected];\n }\n selected = selected.filter(id => id);\n\n if (props.filterFunc) {\n if (typeof props.filterFunc === 'string') {\n try {\n this.filterFunc = new Function('obj', props.filterFunc) as (obj: ioBroker.Object) => boolean;\n } catch {\n console.error(`Cannot parse filter function: \"obj => ${props.filterFunc}\"`);\n this.filterFunc = undefined;\n }\n } else {\n this.filterFunc = props.filterFunc;\n }\n }\n\n this.state = {\n selected,\n name: '',\n selectionBlocked: false,\n };\n }\n\n handleCancel(): void {\n this.props.onClose();\n }\n\n handleOk(): void {\n this.props.onOk(this.props.multiSelect ? this.state.selected : this.state.selected[0] || '', this.state.name);\n this.props.onClose();\n }\n\n render(): JSX.Element {\n let title;\n if (this.state.name || this.state.selected.length) {\n if (this.state.selected.length === 1) {\n title = [\n <span key=\"selected\">\n {I18n.t('ra_Selected')}\n &nbsp;\n </span>,\n <span\n key=\"id\"\n style={{ fontWeight: 'bold', fontStyle: 'italic' }}\n >\n {(this.state.name || this.state.selected[0]) +\n (this.state.name ? ` [${this.state.selected[0]}]` : '')}\n </span>,\n ];\n } else {\n title = [\n <span key=\"selected\">\n {I18n.t('ra_Selected')}\n &nbsp;\n </span>,\n <span\n key=\"id\"\n style={{ fontWeight: 'bold', fontStyle: 'italic' }}\n >\n {I18n.t('%s items', this.state.selected.length.toString())}\n </span>,\n ];\n }\n } else {\n title = this.props.title || I18n.t('ra_Please select object ID...');\n }\n\n return (\n <Dialog\n onClose={() => {}}\n maxWidth={false}\n sx={{\n '& .MuiDialog-paper': {\n height: '95%',\n p: '4px',\n width: '100%',\n maxWidth: '100%',\n maxHeight: 'calc(100% - 16px)',\n },\n }}\n fullWidth\n open={!0}\n aria-labelledby=\"ar_dialog_selectid_title\"\n >\n <DialogTitle\n id=\"ar_dialog_selectid_title\"\n style={{\n whiteSpace: 'nowrap',\n width: 'calc(100% - 72px)',\n overflow: 'hidden',\n display: 'inline-block',\n textOverflow: 'ellipsis',\n }}\n >\n {title}\n </DialogTitle>\n <DialogContent\n style={{\n height: '100%',\n overflow: 'hidden',\n padding: '8px 4px',\n }}\n >\n <ObjectBrowser\n foldersFirst={this.props.foldersFirst}\n imagePrefix={this.props.imagePrefix || this.props.prefix} // prefix is for back compatibility\n dateFormat={this.props.dateFormat}\n defaultFilters={this.filters}\n dialogName={this.dialogName}\n isFloatComma={this.props.isFloatComma}\n showExpertButton={\n this.props.showExpertButton !== undefined ? this.props.showExpertButton : true\n }\n expertMode={this.props.expertMode}\n // style={{ width: '100%', height: '100%' }}\n columns={this.props.columns || ['name', 'type', 'role', 'room', 'func', 'val']}\n types={\n this.props.types\n ? Array.isArray(this.props.types)\n ? this.props.types\n : [this.props.types]\n : ['state']\n }\n root={this.props.root}\n t={I18n.t}\n lang={this.props.lang || I18n.getLanguage()}\n socket={this.props.socket}\n selected={this.state.selected}\n multiSelect={this.props.multiSelect}\n notEditable={this.props.notEditable === undefined ? true : this.props.notEditable}\n // name={this.state.name}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\n theme={this.props.theme}\n customFilter={this.props.customFilter}\n allowNonObjects={this.props.allowNonObjects}\n onFilterChanged={(filterConfig: ObjectBrowserFilter) => {\n this.filters = filterConfig;\n ((window as any)._localStorage || window.localStorage).setItem(\n this.dialogName,\n JSON.stringify(filterConfig),\n );\n }}\n onSelect={async (\n _selected: string | string[],\n name: string | null,\n isDouble?: boolean,\n ): Promise<void> => {\n let selected: string[];\n if (!Array.isArray(_selected)) {\n selected = [_selected];\n } else {\n selected = _selected;\n }\n\n if (JSON.stringify(selected) !== JSON.stringify(this.state.selected)) {\n let selectionAllowed = true;\n if (this.props.onSelectConfirm) {\n const objects: Record<string, ioBroker.Object | null | undefined> = {};\n for (const id of selected) {\n try {\n objects[id] = await this.props.socket.getObject(id);\n } catch {\n // ignore\n }\n }\n\n selectionAllowed = await this.props.onSelectConfirm(selected, objects);\n }\n\n this.setState(\n { selected, name, selectionBlocked: !selectionAllowed },\n () => isDouble && this.handleOk(),\n );\n } else if (isDouble) {\n this.handleOk();\n }\n }}\n filterFunc={this.filterFunc}\n title=\"\"\n classes={{}}\n />\n </DialogContent>\n <DialogActions>\n <Button\n id={`ar_dialog_selectid_ok_${this.props.dialogName || ''}`}\n variant=\"contained\"\n onClick={() => this.handleOk()}\n startIcon={<IconOk />}\n disabled={!this.state.selected.length || this.state.selectionBlocked}\n color=\"primary\"\n >\n {this.props.ok || I18n.t('ra_Ok')}\n </Button>\n <Button\n id={`ar_dialog_selectid_cancel_${this.props.dialogName || ''}`}\n color=\"grey\"\n variant=\"contained\"\n onClick={() => this.handleCancel()}\n startIcon={<IconCancel />}\n >\n {this.props.cancel || I18n.t('ra_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"SelectID.js","sourceRoot":"./src/","sources":["Dialogs/SelectID.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI5E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EACH,aAAa,GAIhB,MAAM,6BAA6B,CAAC;AA0FrC,MAAM,OAAO,cAAe,SAAQ,SAAmD;IAClE,UAAU,CAAS;IAE5B,OAAO,CAAsB;IAEpB,UAAU,CAAqC;IAEhE,YAAY,KAA0B;QA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,CAAC,gBAAgB,EACpE,KAAK,EAAC,SAAS,IAEd,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAC5B;gBACT,oBAAC,MAAM,IACH,EAAE,EAAE,6BAA6B,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE,EAC9D,KAAK,EAAC,MAAM,EACZ,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,SAAS,EAAE,oBAAC,UAAU,OAAG,IAExB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CACpC,CACG,CACX,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\n * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>\n *\n * MIT License\n *\n */\nimport React, { Component, type JSX } from 'react';\n\nimport { Button, DialogTitle, DialogContent, DialogActions, Dialog } from '@mui/material';\n\nimport { Cancel as IconCancel, Check as IconOk } from '@mui/icons-material';\n\nimport type { Connection } from '../Connection';\n\nimport { I18n } from '../i18n';\nimport {\n ObjectBrowser,\n type ObjectBrowserFilter,\n type ObjectBrowserColumn,\n type ObjectBrowserCustomFilter,\n} from '../Components/ObjectBrowser';\nimport type { IobTheme } from '../types';\n\nexport interface SelectIDFilters {\n id?: string;\n name?: string;\n room?: string;\n func?: string;\n role?: string;\n type?: string;\n custom?: string;\n}\n\ninterface DialogSelectIDProps {\n /** The internal name of the dialog; default: \"default\". Used to store settings in local storage */\n dialogName?: string;\n /** The dialog title; default: Please select object ID... (translated) */\n title?: string;\n /** Set to true to allow the selection of multiple IDs. */\n multiSelect?: boolean;\n /** Show folders before any leaves. */\n foldersFirst?: boolean;\n /** Path prefix for images (default: '.') */\n imagePrefix?: string;\n /** @deprecated same as imagePrefix */\n prefix?: string;\n /** Show the expert button */\n showExpertButton?: boolean;\n /** Force expert mode */\n expertMode?: boolean;\n /** optional ['name', 'type', 'role', 'room', 'func', 'val', 'buttons'] */\n columns?: ObjectBrowserColumn[];\n /** Object types to show; default: 'state' only */\n types?: ioBroker.ObjectType | ioBroker.ObjectType[];\n /** The language. */\n lang?: ioBroker.Languages;\n /** The socket connection. */\n socket: Connection;\n /** Can't objects be edited? (default: true) */\n notEditable?: boolean;\n /** Theme name. */\n themeName?: string;\n /** Theme type: dark or light */\n themeType?: string;\n /** The theme object */\n theme: IobTheme;\n /** The date format for the date columns */\n dateFormat?: string;\n /** Is use comma or point for displaying of float numbers */\n isFloatComma?: boolean;\n /** Custom filter. */\n customFilter?: ObjectBrowserCustomFilter;\n /** The selected IDs. */\n selected?: string | string[];\n /** The ok button text; default: OK (translated) */\n ok?: string;\n /** The cancel button text; default: Cancel (translated) */\n cancel?: string;\n /** Close handler that is always called when the dialog is closed. */\n onClose: () => void;\n /** Handler that is called when the user presses OK. */\n onOk: (selected: string | string[] | undefined, name: string | null) => void;\n /**\n * Function to filter out all unnecessary objects. Can be string or function.\n * It cannot be used together with \"types\".\n * Example for function: `obj => obj.common?.type === 'boolean'` to show only boolean states\n * In case of string, it must look like `obj.common && obj.common.type === 'boolean'`\n */\n filterFunc?: string | ((obj: ioBroker.Object) => boolean);\n /** predefined filter fields, like {\"id\":\"\",\"name\":\"\",\"room\":\"\",\"func\":\"\",\"role\":\"level\",\"type\":\"\",\"custom\":\"\"} */\n filters?: SelectIDFilters;\n /** Show elements only of this root ID */\n root?: string;\n /** Allow selection of non-objects (virtual branches) */\n allowNonObjects?: boolean;\n /** Will be called by selection, so the decision could be done if the OK button is available or not */\n onSelectConfirm?: (\n selected: string | string[],\n objects: Record<string, ioBroker.Object | null | undefined>,\n ) => Promise<boolean>;\n /** The z-index of the dialog; default: 1300 */\n zIndex?: number;\n}\n\ninterface DialogSelectIDState {\n selected: string[];\n name: string | null;\n selectionBlocked: boolean;\n}\n\nexport class DialogSelectID extends Component<DialogSelectIDProps, DialogSelectIDState> {\n private readonly dialogName: string;\n\n private filters: ObjectBrowserFilter;\n\n private readonly filterFunc?: (obj: ioBroker.Object) => boolean;\n\n constructor(props: DialogSelectIDProps) {\n super(props);\n this.dialogName = this.props.dialogName || 'default';\n this.dialogName = `SelectID.${this.dialogName}`;\n\n const filters: string = ((window as any)._localStorage || window.localStorage).getItem(this.dialogName) || '{}';\n\n try {\n this.filters = JSON.parse(filters);\n } catch {\n this.filters = {};\n }\n\n if (props.filters) {\n this.filters = { ...this.filters, ...(props.filters || {}) };\n }\n\n let selected = this.props.selected || [];\n if (!Array.isArray(selected)) {\n selected = [selected];\n }\n selected = selected.filter(id => id);\n\n if (props.filterFunc) {\n if (typeof props.filterFunc === 'string') {\n try {\n this.filterFunc = new Function('obj', props.filterFunc) as (obj: ioBroker.Object) => boolean;\n } catch {\n console.error(`Cannot parse filter function: \"obj => ${props.filterFunc}\"`);\n this.filterFunc = undefined;\n }\n } else {\n this.filterFunc = props.filterFunc;\n }\n }\n\n this.state = {\n selected,\n name: '',\n selectionBlocked: false,\n };\n }\n\n handleCancel(): void {\n this.props.onClose();\n }\n\n handleOk(): void {\n this.props.onOk(this.props.multiSelect ? this.state.selected : this.state.selected[0] || '', this.state.name);\n this.props.onClose();\n }\n\n render(): JSX.Element {\n let title;\n if (this.state.name || this.state.selected.length) {\n if (this.state.selected.length === 1) {\n title = [\n <span key=\"selected\">\n {I18n.t('ra_Selected')}\n &nbsp;\n </span>,\n <span\n key=\"id\"\n style={{ fontWeight: 'bold', fontStyle: 'italic' }}\n >\n {(this.state.name || this.state.selected[0]) +\n (this.state.name ? ` [${this.state.selected[0]}]` : '')}\n </span>,\n ];\n } else {\n title = [\n <span key=\"selected\">\n {I18n.t('ra_Selected')}\n &nbsp;\n </span>,\n <span\n key=\"id\"\n style={{ fontWeight: 'bold', fontStyle: 'italic' }}\n >\n {I18n.t('%s items', this.state.selected.length.toString())}\n </span>,\n ];\n }\n } else {\n title = this.props.title || I18n.t('ra_Please select object ID...');\n }\n\n return (\n <Dialog\n onClose={() => {}}\n maxWidth={false}\n style={{ zIndex: this.props.zIndex || undefined }}\n sx={{\n '& .MuiDialog-paper': {\n height: '95%',\n p: '4px',\n width: '100%',\n maxWidth: '100%',\n maxHeight: 'calc(100% - 16px)',\n },\n }}\n fullWidth\n open={!0}\n aria-labelledby=\"ar_dialog_selectid_title\"\n >\n <DialogTitle\n id=\"ar_dialog_selectid_title\"\n style={{\n whiteSpace: 'nowrap',\n width: 'calc(100% - 72px)',\n overflow: 'hidden',\n display: 'inline-block',\n textOverflow: 'ellipsis',\n }}\n >\n {title}\n </DialogTitle>\n <DialogContent\n style={{\n height: '100%',\n overflow: 'hidden',\n padding: '8px 4px',\n }}\n >\n <ObjectBrowser\n foldersFirst={this.props.foldersFirst}\n imagePrefix={this.props.imagePrefix || this.props.prefix} // prefix is for back compatibility\n dateFormat={this.props.dateFormat}\n defaultFilters={this.filters}\n dialogName={this.dialogName}\n isFloatComma={this.props.isFloatComma}\n showExpertButton={\n this.props.showExpertButton !== undefined ? this.props.showExpertButton : true\n }\n expertMode={this.props.expertMode}\n // style={{ width: '100%', height: '100%' }}\n columns={this.props.columns || ['name', 'type', 'role', 'room', 'func', 'val']}\n types={\n this.props.types\n ? Array.isArray(this.props.types)\n ? this.props.types\n : [this.props.types]\n : ['state']\n }\n root={this.props.root}\n t={I18n.t}\n lang={this.props.lang || I18n.getLanguage()}\n socket={this.props.socket}\n selected={this.state.selected}\n multiSelect={this.props.multiSelect}\n notEditable={this.props.notEditable === undefined ? true : this.props.notEditable}\n // name={this.state.name}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\n theme={this.props.theme}\n customFilter={this.props.customFilter}\n allowNonObjects={this.props.allowNonObjects}\n onFilterChanged={(filterConfig: ObjectBrowserFilter) => {\n this.filters = filterConfig;\n ((window as any)._localStorage || window.localStorage).setItem(\n this.dialogName,\n JSON.stringify(filterConfig),\n );\n }}\n onSelect={async (\n _selected: string | string[],\n name: string | null,\n isDouble?: boolean,\n ): Promise<void> => {\n let selected: string[];\n if (!Array.isArray(_selected)) {\n selected = [_selected];\n } else {\n selected = _selected;\n }\n\n if (JSON.stringify(selected) !== JSON.stringify(this.state.selected)) {\n let selectionAllowed = true;\n if (this.props.onSelectConfirm) {\n const objects: Record<string, ioBroker.Object | null | undefined> = {};\n for (const id of selected) {\n try {\n objects[id] = await this.props.socket.getObject(id);\n } catch {\n // ignore\n }\n }\n\n selectionAllowed = await this.props.onSelectConfirm(selected, objects);\n }\n\n this.setState(\n { selected, name, selectionBlocked: !selectionAllowed },\n () => isDouble && this.handleOk(),\n );\n } else if (isDouble) {\n this.handleOk();\n }\n }}\n filterFunc={this.filterFunc}\n title=\"\"\n classes={{}}\n />\n </DialogContent>\n <DialogActions>\n <Button\n id={`ar_dialog_selectid_ok_${this.props.dialogName || ''}`}\n variant=\"contained\"\n onClick={() => this.handleOk()}\n startIcon={<IconOk />}\n disabled={!this.state.selected.length || this.state.selectionBlocked}\n color=\"primary\"\n >\n {this.props.ok || I18n.t('ra_Ok')}\n </Button>\n <Button\n id={`ar_dialog_selectid_cancel_${this.props.dialogName || ''}`}\n color=\"grey\"\n variant=\"contained\"\n onClick={() => this.handleCancel()}\n startIcon={<IconCancel />}\n >\n {this.props.cancel || I18n.t('ra_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/adapter-react-v5",
3
- "version": "7.6.20",
3
+ "version": "7.7.1",
4
4
  "description": "React components to develop ioBroker interfaces with react.",
5
5
  "author": {
6
6
  "name": "bluefox",
@@ -73,13 +73,11 @@
73
73
  "react-inlinesvg": "^4.2.0"
74
74
  },
75
75
  "devDependencies": {
76
- "@iobroker/eslint-config": "^2.0.2",
77
76
  "@types/node": "^22.15.30",
78
77
  "@types/react": "^18.3.23",
79
78
  "@types/react-color": "^3.0.13",
80
79
  "ajv": "^8.17.1",
81
80
  "ts-node": "^10.9.2",
82
81
  "typescript": "~5.8.3"
83
- },
84
- "gitHead": "a132c0c3608eabcd14d895251d6bdb3c358bc9f8"
82
+ }
85
83
  }