@iobroker/adapter-react-v5 8.0.7 → 8.0.9

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.
@@ -0,0 +1,170 @@
1
+ import React, { Component, type JSX } from 'react';
2
+ import type { ThemeType } from '../types';
3
+ import type { FormatValueOptions, InputSelectItem, TreeItem, ObjectBrowserCustomFilter, TreeInfo, GetValueStyleOptions, AdapterColumn, ObjectBrowserFilter, TreeItemData } from './objectBrowser.types';
4
+ export declare const ICON_SIZE = 24;
5
+ export declare const ROW_HEIGHT = 32;
6
+ export declare const COLOR_NAME_USERDATA: (themeType: ThemeType) => string;
7
+ export declare const COLOR_NAME_ALIAS: (themeType: ThemeType) => string;
8
+ export declare const COLOR_NAME_JAVASCRIPT: (themeType: ThemeType) => string;
9
+ export declare const COLOR_NAME_SYSTEM: (themeType: ThemeType) => string;
10
+ export declare const COLOR_NAME_SYSTEM_ADAPTER: (themeType: ThemeType) => string;
11
+ export declare const styles: Record<string, any>;
12
+ export declare function ButtonIcon(props?: {
13
+ style?: React.CSSProperties;
14
+ }): JSX.Element;
15
+ /** Converts ioB pattern into regex */
16
+ export declare function pattern2RegEx(pattern: string): string;
17
+ /**
18
+ * Function that walks through all keys of an object or array and applies a function to each key.
19
+ */
20
+ export declare function walkThroughArray(object: any[], iteratee: (result: any[], value: any, key: number) => void): any[];
21
+ /**
22
+ * Function that walks through all keys of an object or array and applies a function to each key.
23
+ */
24
+ export declare function walkThroughObject(object: Record<string, any>, iteratee: (result: Record<string, any>, value: any, key: string) => void): Record<string, any>;
25
+ /**
26
+ * Function to reduce an object primarily by a given list of keys
27
+ */
28
+ export declare function filterObject(
29
+ /** The objects which should be filtered */
30
+ obj: Record<string, any> | any[],
31
+ /** The keys which should be excluded */
32
+ filterKeys: string[],
33
+ /** Whether translations should be reduced to only the english value */
34
+ excludeTranslations?: boolean): Record<string, any> | any[];
35
+ export declare function filterRoles(roleArray: {
36
+ role: string;
37
+ type: ioBroker.CommonType;
38
+ }[], type: ioBroker.CommonType, defaultRoles?: {
39
+ role: string;
40
+ type: ioBroker.CommonType;
41
+ }[]): string[];
42
+ /**
43
+ * Function to generate a json-file for an object and trigger download it
44
+ */
45
+ export declare function generateFile(
46
+ /** The desired filename */
47
+ fileName: string,
48
+ /** The objects which should be downloaded */
49
+ obj: Record<string, ioBroker.Object>,
50
+ /** Options to filter/reduce the output */
51
+ options: {
52
+ /** Whether the output should be beautified */
53
+ beautify?: boolean;
54
+ /** Whether "system.repositories" should be excluded */
55
+ excludeSystemRepositories?: boolean;
56
+ /** Whether translations should be reduced to only the english value */
57
+ excludeTranslations?: boolean;
58
+ }): void;
59
+ interface CustomFilterSelectProps {
60
+ name: 'room' | 'func' | 'type' | 'role' | 'custom';
61
+ texts: Record<string, string>;
62
+ initialValue: string[] | undefined;
63
+ onChange: (name: 'room' | 'func' | 'type' | 'role' | 'custom', value: string[] | undefined) => void;
64
+ values: (string | InputSelectItem)[];
65
+ }
66
+ interface CustomFilterSelectState {
67
+ value: string[];
68
+ }
69
+ export declare class CustomFilterSelect extends Component<CustomFilterSelectProps, CustomFilterSelectState> {
70
+ private readonly hasIcons;
71
+ private timer;
72
+ constructor(props: CustomFilterSelectProps);
73
+ componentWillUnmount(): void;
74
+ render(): React.JSX.Element;
75
+ }
76
+ interface CustomFilterInputProps {
77
+ name: 'name' | 'id';
78
+ texts: Record<string, string>;
79
+ initialValue: string | undefined;
80
+ onChange: (name: 'name' | 'id', value: string | undefined) => void;
81
+ t: (text: string) => string;
82
+ styles?: React.CSSProperties;
83
+ }
84
+ interface CustomFilterInputState {
85
+ value: string;
86
+ }
87
+ export declare class CustomFilterInput extends Component<CustomFilterInputProps, CustomFilterInputState> {
88
+ private timer;
89
+ constructor(props: CustomFilterInputProps);
90
+ componentWillUnmount(): void;
91
+ render(): React.JSX.Element;
92
+ }
93
+ export declare function binarySearch(list: string[], find: string, _start?: number, _end?: number): boolean;
94
+ export declare function getName(name: ioBroker.StringOrTranslated, lang: ioBroker.Languages): string;
95
+ export declare function getSelectIdIconFromObjects(objects: Record<string, ioBroker.Object>, id: string, lang: ioBroker.Languages, imagePrefix?: string): string | JSX.Element | null;
96
+ export declare function applyFilter(item: TreeItem, filters: ObjectBrowserFilter, lang: ioBroker.Languages, objects: Record<string, ioBroker.Object>, context?: {
97
+ id?: string;
98
+ idRx?: RegExp;
99
+ name?: string;
100
+ nameRx?: RegExp;
101
+ type?: string[];
102
+ custom?: string[];
103
+ role?: string[];
104
+ room?: string[];
105
+ func?: string[];
106
+ }, counter?: {
107
+ count: number;
108
+ }, customFilter?: ObjectBrowserCustomFilter, selectedTypes?: string[], _depth?: number): boolean;
109
+ export declare function getVisibleItems(item: TreeItem, type: ioBroker.ObjectType, objects: Record<string, ioBroker.Object>, _result?: string[]): string[];
110
+ export declare function getObjectTooltip(data: TreeItemData, lang: ioBroker.Languages): string | null;
111
+ export declare function getIdFieldTooltip(data: TreeItemData, lang: ioBroker.Languages): JSX.Element;
112
+ export declare function buildTree(objects: Record<string, ioBroker.Object>, options: {
113
+ imagePrefix?: string;
114
+ root?: string;
115
+ lang: ioBroker.Languages;
116
+ themeType: ThemeType;
117
+ }): {
118
+ root: TreeItem;
119
+ info: TreeInfo;
120
+ };
121
+ export declare function findNode(root: TreeItem, id: string, _parts?: string[], _path?: string, _level?: number): TreeItem | null;
122
+ export declare function findRoomsForObject(info: TreeInfo, id: string, lang: ioBroker.Languages, rooms?: string[]): {
123
+ rooms: string[];
124
+ per: boolean;
125
+ };
126
+ export declare function findEnumsForObjectAsIds(info: TreeInfo, id: string, enumName: 'roomEnums' | 'funcEnums', funcs?: string[]): string[];
127
+ export declare function findFunctionsForObject(info: TreeInfo, id: string, lang: ioBroker.Languages, funcs?: string[]): {
128
+ funcs: string[];
129
+ pef: boolean;
130
+ };
131
+ /**
132
+ * Format a state value for visualization
133
+ */
134
+ export declare function formatValue(options: FormatValueOptions): {
135
+ valText: {
136
+ /** value as string */
137
+ v: string;
138
+ /** value unit */
139
+ u?: string;
140
+ /** value isn't replaced by `common.states` */
141
+ s?: string;
142
+ /** Text for copy to clipboard */
143
+ c?: string;
144
+ };
145
+ valFull: {
146
+ /** label */
147
+ t: string;
148
+ /** value */
149
+ v: string;
150
+ /** no break */
151
+ nbr?: boolean;
152
+ }[] | undefined;
153
+ fileViewer: 'image' | 'text' | 'json' | 'html' | 'pdf' | 'audio' | 'video' | undefined;
154
+ };
155
+ /**
156
+ * Get CSS style for given state value
157
+ */
158
+ export declare function getValueStyle(options: GetValueStyleOptions): {
159
+ color: string;
160
+ };
161
+ export declare function prepareSparkData(values: ioBroker.GetHistoryResult, from: number): number[];
162
+ export declare function getCustomValue(obj: ioBroker.Object, it: AdapterColumn): string | number | boolean | null;
163
+ export declare function setCustomValue(obj: ioBroker.Object, it: AdapterColumn, value: string | number | boolean): boolean;
164
+ /**
165
+ * Check if it is a non-expert id
166
+ *
167
+ * @param id id to test
168
+ */
169
+ export declare function isNonExpertId(id: string): boolean;
170
+ export {};