@iobroker/adapter-react-v5
Version:
React components to develop ioBroker interfaces with react.
103 lines (102 loc) • 3.96 kB
TypeScript
/**
* Copyright 2018-2025 Denis Haev (bluefox) <dogafox@gmail.com>
*
* MIT License
*
*/
import { Component, type JSX } from 'react';
import type { Connection } from '../Connection';
import { type ObjectBrowserColumn, type ObjectBrowserCustomFilter } from '../Components/objectBrowser.types';
import type { IobTheme } from '../types';
export interface SelectIDFilters {
id?: string;
name?: string;
room?: string[];
func?: string[];
role?: string[];
type?: string[];
custom?: string[];
}
interface DialogSelectIDProps {
/** The internal name of the dialog; default: "default". Used to store settings in local storage */
dialogName?: string;
/** The dialog title; default: Please select object ID... (translated) */
title?: string;
/** Set to true to allow the selection of multiple IDs. */
multiSelect?: boolean;
/** Show folders before any leaves. */
foldersFirst?: boolean;
/** Path prefix for images (default: '.') */
imagePrefix?: string;
/** @deprecated same as imagePrefix */
prefix?: string;
/** Show the expert button */
showExpertButton?: boolean;
/** Force expert mode */
expertMode?: boolean;
/** optional ['name', 'type', 'role', 'room', 'func', 'val', 'buttons'] */
columns?: ObjectBrowserColumn[];
/** Object types to show; default: 'state' only */
types?: ioBroker.ObjectType | ioBroker.ObjectType[];
/** The language. */
lang?: ioBroker.Languages;
/** The socket connection. */
socket: Connection;
/** Can't objects be edited? (default: true) */
notEditable?: boolean;
/** Theme name. */
themeName?: string;
/** Theme type: dark or light */
themeType?: string;
/** The theme object */
theme: IobTheme;
/** The date format for the date columns */
dateFormat?: string;
/** Is use comma or point for displaying of float numbers */
isFloatComma?: boolean;
/** Custom filter. */
customFilter?: ObjectBrowserCustomFilter;
/** The selected IDs. */
selected?: string | string[];
/** The ok button text; default: OK (translated) */
ok?: string;
/** The cancel button text; default: Cancel (translated) */
cancel?: string;
/** Close handler that is always called when the dialog is closed. */
onClose: () => void;
/** Handler that is called when the user presses OK. */
onOk: (selected: string | string[] | undefined, name: string | null) => void;
/**
* Function to filter out all unnecessary objects. Can be string or function.
* It cannot be used together with "types".
* Example for function: `obj => obj.common?.type === 'boolean'` to show only boolean states
* In case of string, it must look like `obj.common && obj.common.type === 'boolean'`
*/
filterFunc?: string | ((obj: ioBroker.Object) => boolean);
/** predefined filter fields, like {"id":"","name":"","room":"","func":"","role":"level","type":"","custom":""} */
filters?: SelectIDFilters;
/** Show elements only of this root ID */
root?: string;
/** Allow selection of non-objects (virtual branches) */
allowNonObjects?: boolean;
/** Will be called by selection, so the decision could be done if the OK button is available or not */
onSelectConfirm?: (selected: string | string[], objects: Record<string, ioBroker.Object | null | undefined>) => Promise<boolean>;
/** The z-index of the dialog; default: 1300 */
zIndex?: number;
}
interface DialogSelectIDState {
selected: string[];
name: string | null;
selectionBlocked: boolean;
allLoaded?: boolean;
}
export declare class DialogSelectID extends Component<DialogSelectIDProps, DialogSelectIDState> {
private readonly dialogName;
private filters;
private readonly filterFunc?;
constructor(props: DialogSelectIDProps);
handleCancel(): void;
handleOk(): void;
render(): JSX.Element;
}
export {};