@iobroker/adapter-react-v5 7.4.8 → 7.4.10

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.
@@ -65,7 +65,7 @@ interface DialogSelectIDProps {
65
65
  /** Close handler that is always called when the dialog is closed. */
66
66
  onClose: () => void;
67
67
  /** Handler that is called when the user presses OK. */
68
- onOk: (selected: string | string[] | undefined, name: string) => void;
68
+ onOk: (selected: string | string[] | undefined, name: string | null) => void;
69
69
  /**
70
70
  * Function to filter out all unnecessary objects. Can be string or function.
71
71
  * It cannot be used together with "types".
@@ -77,10 +77,12 @@ interface DialogSelectIDProps {
77
77
  filters?: SelectIDFilters;
78
78
  /** Show elements only of this root ID */
79
79
  root?: string;
80
+ /** Allow selection of non-objects (virtual branches) */
81
+ allowNonObjects?: boolean;
80
82
  }
81
83
  interface DialogSelectIDState {
82
84
  selected: string[];
83
- name: string;
85
+ name: string | null;
84
86
  }
85
87
  export declare class DialogSelectID extends Component<DialogSelectIDProps, DialogSelectIDState> {
86
88
  private readonly dialogName;
@@ -112,7 +112,7 @@ export class DialogSelectID extends Component {
112
112
  : [this.props.types]
113
113
  : ['state'], root: this.props.root, t: I18n.t, lang: this.props.lang || I18n.getLanguage(), socket: this.props.socket, selected: this.state.selected, multiSelect: this.props.multiSelect, notEditable: this.props.notEditable === undefined ? true : this.props.notEditable,
114
114
  // name={this.state.name}
115
- themeName: this.props.themeName, themeType: this.props.themeType, theme: this.props.theme, customFilter: this.props.customFilter, onFilterChanged: (filterConfig) => {
115
+ themeName: this.props.themeName, themeType: this.props.themeType, theme: this.props.theme, customFilter: this.props.customFilter, allowNonObjects: this.props.allowNonObjects, onFilterChanged: (filterConfig) => {
116
116
  this.filters = filterConfig;
117
117
  (window._localStorage || window.localStorage).setItem(this.dialogName, JSON.stringify(filterConfig));
118
118
  }, onSelect: (_selected, name, isDouble) => {
@@ -1 +1 @@
1
- {"version":3,"file":"SelectID.js","sourceRoot":"./src/","sources":["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AU,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 */\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\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) => 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}\n\ninterface DialogSelectIDState {\n selected: string[];\n name: string;\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 };\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 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={(_selected: string | string[], name: string, isDouble?: boolean) => {\n let selected: string[];\n if (!Array.isArray(_selected)) {\n selected = [_selected];\n } else {\n selected = _selected;\n }\n if (JSON.stringify(selected) !== JSON.stringify(this.state.selected)) {\n this.setState({ selected, name }, () => isDouble && this.handleOk());\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}\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,uHAAuH;AACvH,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;AAkFrC,MAAM,OAAO,cAAe,SAAQ,SAAmD;IAClE,UAAU,CAAS;IAE5B,OAAO,CAAsB;IAEpB,UAAU,CAAqC;IAEhE,YAAY,KAA0B;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,SAAS,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,YAAY,IAAI,CAAC,UAAU,EAAE,CAAC;QAEhD,MAAM,OAAO,GAAW,CAAE,MAAc,CAAC,aAAa,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;QAEhH,IAAI,CAAC;YACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACL,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QACtB,CAAC;QAED,IAAI,KAAK,CAAC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AQ,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EACrC,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 */\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\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}\n\ninterface DialogSelectIDState {\n selected: string[];\n name: string | null;\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 };\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={(_selected: string | string[], name: string | null, isDouble?: boolean) => {\n let selected: string[];\n if (!Array.isArray(_selected)) {\n selected = [_selected];\n } else {\n selected = _selected;\n }\n if (JSON.stringify(selected) !== JSON.stringify(this.state.selected)) {\n this.setState({ selected, name }, () => isDouble && this.handleOk());\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}\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"]}
@@ -15,6 +15,18 @@ declare global {
15
15
  iob: any;
16
16
  }
17
17
  }
18
+ type LogMessage = {
19
+ /** Log message */
20
+ message: string;
21
+ /** origin */
22
+ from: string;
23
+ /** timestamp in ms */
24
+ ts: number;
25
+ /** Log message */
26
+ severity: ioBroker.LogLevel;
27
+ /** unique ID of the message */
28
+ _id: number;
29
+ };
18
30
  export type Severity = 'info' | 'notify' | 'alert';
19
31
  type DockerInformation = {
20
32
  /** If it is a Docker installation */
@@ -149,7 +161,7 @@ interface ConnectionProps {
149
161
  /** Ready callback. */
150
162
  onReady?: (objects: Record<string, ioBroker.Object>) => void;
151
163
  /** Log callback. */
152
- onLog?: (text: string) => void;
164
+ onLog?: (message: LogMessage) => void;
153
165
  /** Error callback. */
154
166
  onError?: (error: any) => void;
155
167
  /** Object change callback. */