@iobroker/gui-components 8.0.2 → 10.0.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.
Files changed (160) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +834 -543
  3. package/build/AdminConnection.js.map +1 -1
  4. package/build/Components/404.js +13 -13
  5. package/build/Components/404.js.map +1 -1
  6. package/build/Components/ColorPicker.js.map +1 -1
  7. package/build/Components/ComplexCron.js +2 -2
  8. package/build/Components/ComplexCron.js.map +1 -1
  9. package/build/Components/CopyToClipboard.js.map +1 -1
  10. package/build/Components/CustomModal.js +1 -1
  11. package/build/Components/CustomModal.js.map +1 -1
  12. package/build/Components/DeviceType/DeviceTypeIcon.js +1 -0
  13. package/build/Components/DeviceType/DeviceTypeIcon.js.map +1 -1
  14. package/build/Components/DeviceType/DeviceTypeSelector.js +2 -2
  15. package/build/Components/DeviceType/DeviceTypeSelector.js.map +1 -1
  16. package/build/Components/DeviceType/i18n/de.json +1 -0
  17. package/build/Components/DeviceType/i18n/en.json +1 -0
  18. package/build/Components/DeviceType/i18n/fr.json +1 -0
  19. package/build/Components/DeviceType/i18n/it.json +1 -0
  20. package/build/Components/DeviceType/i18n/nl.json +1 -0
  21. package/build/Components/DeviceType/i18n/pl.json +1 -0
  22. package/build/Components/DeviceType/i18n/pt.json +1 -0
  23. package/build/Components/DeviceType/i18n/ru.json +1 -0
  24. package/build/Components/DeviceType/i18n/uk.json +1 -0
  25. package/build/Components/DeviceType/i18n/zh-cn.json +1 -0
  26. package/build/Components/FileBrowser.d.ts +39 -4
  27. package/build/Components/FileBrowser.js +104 -11
  28. package/build/Components/FileBrowser.js.map +1 -1
  29. package/build/Components/FileViewer.js +2 -4
  30. package/build/Components/FileViewer.js.map +1 -1
  31. package/build/Components/Icon.d.ts +1 -3
  32. package/build/Components/Icon.js +11 -11
  33. package/build/Components/Icon.js.map +1 -1
  34. package/build/Components/Image.js +8 -4
  35. package/build/Components/Image.js.map +1 -1
  36. package/build/Components/InfoBox.js +1 -1
  37. package/build/Components/InfoBox.js.map +1 -1
  38. package/build/Components/IobUri.js +5 -5
  39. package/build/Components/IobUri.js.map +1 -1
  40. package/build/Components/Loader.d.ts +2 -3
  41. package/build/Components/Loader.js +25 -257
  42. package/build/Components/Loader.js.map +1 -1
  43. package/build/Components/Loaders/Community.d.ts +31 -0
  44. package/build/Components/Loaders/Community.js +265 -0
  45. package/build/Components/Loaders/Community.js.map +1 -0
  46. package/build/Components/Loaders/HA.d.ts +17 -0
  47. package/build/Components/Loaders/HA.js +99 -0
  48. package/build/Components/Loaders/HA.js.map +1 -0
  49. package/build/Components/Loaders/MV.js.map +1 -1
  50. package/build/Components/Loaders/NW.d.ts +17 -0
  51. package/build/Components/Loaders/NW.js +70 -0
  52. package/build/Components/Loaders/NW.js.map +1 -0
  53. package/build/Components/Loaders/PT.js +103 -103
  54. package/build/Components/Loaders/PT.js.map +1 -1
  55. package/build/Components/Loaders/Vendor.js +7 -7
  56. package/build/Components/Loaders/Vendor.js.map +1 -1
  57. package/build/Components/MDUtils.js.map +1 -1
  58. package/build/Components/ObjectBrowser.d.ts +25 -406
  59. package/build/Components/ObjectBrowser.js +460 -1543
  60. package/build/Components/ObjectBrowser.js.map +1 -1
  61. package/build/Components/Router.js.map +1 -1
  62. package/build/Components/SaveCloseButtons.js.map +1 -1
  63. package/build/Components/Schedule.d.ts +27 -1
  64. package/build/Components/Schedule.js +60 -50
  65. package/build/Components/Schedule.js.map +1 -1
  66. package/build/Components/SelectWithIcon.js +1 -1
  67. package/build/Components/SelectWithIcon.js.map +1 -1
  68. package/build/Components/SimpleCron/cronText.js.map +1 -1
  69. package/build/Components/SimpleCron/index.js +3 -3
  70. package/build/Components/SimpleCron/index.js.map +1 -1
  71. package/build/Components/TabContainer.js +7 -2
  72. package/build/Components/TabContainer.js.map +1 -1
  73. package/build/Components/TabContent.d.ts +1 -1
  74. package/build/Components/TabContent.js +5 -5
  75. package/build/Components/TabContent.js.map +1 -1
  76. package/build/Components/TabHeader.js +2 -2
  77. package/build/Components/TabHeader.js.map +1 -1
  78. package/build/Components/TableResize.js.map +1 -1
  79. package/build/Components/TextWithIcon.js.map +1 -1
  80. package/build/Components/TreeTable.d.ts +1 -0
  81. package/build/Components/TreeTable.js +16 -6
  82. package/build/Components/TreeTable.js.map +1 -1
  83. package/build/Components/UploadImage.js +305 -305
  84. package/build/Components/UploadImage.js.map +1 -1
  85. package/build/Components/Utils.d.ts +17 -3
  86. package/build/Components/Utils.js +167 -9
  87. package/build/Components/Utils.js.map +1 -1
  88. package/build/Components/objectBrowser.types.d.ts +496 -0
  89. package/build/Components/objectBrowserUtils.d.ts +170 -0
  90. package/build/Components/objectBrowserUtils.js +1375 -0
  91. package/build/Components/objectBrowserUtils.js.map +1 -0
  92. package/build/Connection.js.map +1 -1
  93. package/build/Dialogs/ComplexCron.js.map +1 -1
  94. package/build/Dialogs/Confirm.js.map +1 -1
  95. package/build/Dialogs/Cron.js.map +1 -1
  96. package/build/Dialogs/Error.js.map +1 -1
  97. package/build/Dialogs/Message.js.map +1 -1
  98. package/build/Dialogs/SelectFile.d.ts +1 -1
  99. package/build/Dialogs/SelectFile.js +1 -1
  100. package/build/Dialogs/SelectFile.js.map +1 -1
  101. package/build/Dialogs/SelectID.d.ts +1 -1
  102. package/build/Dialogs/SelectID.js +1 -1
  103. package/build/Dialogs/SelectID.js.map +1 -1
  104. package/build/Dialogs/SimpleCron.js.map +1 -1
  105. package/build/Dialogs/TextInput.js +1 -1
  106. package/build/Dialogs/TextInput.js.map +1 -1
  107. package/build/GenericApp.d.ts +6 -4
  108. package/build/GenericApp.js +22 -16
  109. package/build/GenericApp.js.map +1 -1
  110. package/build/Prompt.js +7 -7
  111. package/build/Prompt.js.map +1 -1
  112. package/build/Theme.js +57 -11
  113. package/build/Theme.js.map +1 -1
  114. package/build/assets/devices/parseNames.js +1 -0
  115. package/build/assets/devices/parseNames.js.map +1 -1
  116. package/build/assets/rooms/parseNames.js +1 -0
  117. package/build/assets/rooms/parseNames.js.map +1 -1
  118. package/build/dictionary.js.map +1 -1
  119. package/build/globals.d.ts +2 -0
  120. package/build/i18n/de.json +5 -66
  121. package/build/i18n/en.json +5 -66
  122. package/build/i18n/es.json +5 -66
  123. package/build/i18n/fr.json +5 -66
  124. package/build/i18n/it.json +5 -61
  125. package/build/i18n/nl.json +5 -61
  126. package/build/i18n/pl.json +5 -61
  127. package/build/i18n/pt.json +5 -61
  128. package/build/i18n/ru.json +5 -61
  129. package/build/i18n/uk.json +5 -61
  130. package/build/i18n/zh-cn.json +5 -61
  131. package/build/i18n.js +12 -15
  132. package/build/i18n.js.map +1 -1
  133. package/build/index.css +56 -56
  134. package/build/index.d.ts +9 -4
  135. package/build/index.js +5 -2
  136. package/build/index.js.map +1 -1
  137. package/build/modulefederation.admin.config.d.ts +1 -0
  138. package/build/modulefederation.admin.config.js +1 -1
  139. package/build/modulefederation.admin.config.js.map +1 -1
  140. package/build/types.d.ts +4 -84
  141. package/i18n/de.json +5 -66
  142. package/i18n/en.json +5 -66
  143. package/i18n/es.json +5 -66
  144. package/i18n/fr.json +5 -66
  145. package/i18n/it.json +5 -61
  146. package/i18n/nl.json +5 -61
  147. package/i18n/pl.json +5 -61
  148. package/i18n/pt.json +5 -61
  149. package/i18n/ru.json +5 -61
  150. package/i18n/uk.json +5 -61
  151. package/i18n/zh-cn.json +5 -61
  152. package/index.css +56 -56
  153. package/modulefederation.admin.config.d.ts +1 -0
  154. package/modulefederation.admin.config.js +1 -2
  155. package/package.json +50 -35
  156. package/tasksExample.ts +93 -0
  157. package/build/LegacyConnection.d.ts +0 -938
  158. package/build/LegacyConnection.js +0 -2849
  159. package/build/LegacyConnection.js.map +0 -1
  160. package/tasksExample.js +0 -91
@@ -0,0 +1,496 @@
1
+ import type React from 'react';
2
+ import type { IobTheme, ThemeName, ThemeType, Translate } from '../types';
3
+ import type { Connection } from '../Connection';
4
+ import type { Router } from './Router';
5
+ import type { ObjectBrowserClass } from './ObjectBrowser';
6
+ import type { AdapterColumn, ObjectBrowserCustomFilter } from './objectBrowserUtils';
7
+
8
+ type ObjectEventType = 'new' | 'changed' | 'deleted';
9
+
10
+ interface ObjectEvent {
11
+ id: string;
12
+ obj?: ioBroker.Object;
13
+ type: ObjectEventType;
14
+ oldObj?: ioBroker.Object;
15
+ }
16
+
17
+ interface ObjectsWorker {
18
+ getObjects(update?: boolean): Promise<void | Record<string, ioBroker.Object>>;
19
+ registerHandler(cb: (events: ObjectEvent[]) => void): void;
20
+ unregisterHandler(cb: (events: ObjectEvent[]) => void, doNotUnsubscribe?: boolean): void;
21
+ }
22
+
23
+ interface CustomAdminColumnStored {
24
+ path: string;
25
+ name: string;
26
+ objTypes?: ioBroker.ObjectType[];
27
+ width?: number;
28
+ edit?: boolean;
29
+ type?: ioBroker.CommonType;
30
+ }
31
+
32
+ export interface ContextMenuItem {
33
+ /** hotkey */
34
+ key?: string;
35
+ visibility: boolean;
36
+ icon: React.JSX.Element | string;
37
+ label: string;
38
+ onClick?: () => void;
39
+ listItemIconStyle?: React.CSSProperties;
40
+ style?: React.CSSProperties;
41
+ subMenu?: {
42
+ label: string;
43
+ visibility: boolean;
44
+ icon: React.JSX.Element;
45
+ onClick: () => void;
46
+ iconStyle?: React.CSSProperties;
47
+ style?: React.CSSProperties;
48
+ listItemIconStyle?: React.CSSProperties;
49
+ }[];
50
+ iconStyle?: React.CSSProperties;
51
+ }
52
+
53
+ export type ioBrokerObjectForExport = ioBroker.Object & Partial<ioBroker.State>;
54
+
55
+ export interface ObjectBrowserEditRoleProps {
56
+ roleArray: { role: string; type: ioBroker.CommonType }[];
57
+ id: string;
58
+ socket: Connection;
59
+ onClose: (obj?: ioBroker.Object | null) => void;
60
+ t: Translate;
61
+ commonType: ioBroker.CommonType;
62
+ }
63
+
64
+ export interface ObjectViewFileDialogProps {
65
+ t: Translate;
66
+ socket: Connection;
67
+ obj: ioBroker.AnyObject;
68
+ onClose: () => void;
69
+ }
70
+
71
+ export interface InsertJsonObjectsDialogProps {
72
+ t: Translate;
73
+ onClose: (json?: string) => void;
74
+ themeType: ThemeType;
75
+ themeName: ThemeName;
76
+ }
77
+
78
+ export interface TreeItemData {
79
+ id: string;
80
+ name: string;
81
+ obj?: ioBroker.Object;
82
+ /** Object ID in lower case for filtering */
83
+ fID?: string;
84
+ /** translated common.name in lower case for filtering */
85
+ fName?: string;
86
+ /** Link to parent item */
87
+ parent?: TreeItem;
88
+ level?: number;
89
+ icon?: string | React.JSX.Element | null;
90
+ /** If the item existing object or generated folder */
91
+ generated?: boolean;
92
+ title?: string;
93
+ /** if the item has "write" button (value=true, ack=false) */
94
+ button?: boolean;
95
+ /** If the item has read and write and is boolean */
96
+ switch?: boolean;
97
+ /** If the item is url linke */
98
+ url?: boolean;
99
+ /** if the item has custom settings in `common.custom` */
100
+ hasCustoms?: boolean;
101
+ /** If this item is visible */
102
+ visible?: boolean;
103
+ /** Is any of the children visible (not only directly children) */
104
+ hasVisibleChildren?: boolean;
105
+ /** Is any of the parents visible (not only directly parent) */
106
+ hasVisibleParent?: boolean;
107
+ /** Combination of `visible || hasVisibleChildren` */
108
+ sumVisibility?: boolean;
109
+ /** translated names of enumerations (functions) where this object is the member (or the parent), divided by comma */
110
+ funcs?: string;
111
+ /** is if the enums are from parent */
112
+ pef?: boolean;
113
+ /** translated names of enumerations (rooms) where this object is the member (or the parent), divided by comma */
114
+ rooms?: string;
115
+ /** is if the enums are from parent */
116
+ per?: boolean;
117
+ // language in what the rooms and functions where translated
118
+ lang?: ioBroker.Languages;
119
+ state?: {
120
+ valTextRx?: React.JSX.Element[] | null;
121
+ style?: React.CSSProperties;
122
+ };
123
+ aclTooltip?: null | React.JSX.Element;
124
+ }
125
+
126
+ export interface TreeItem {
127
+ id?: string;
128
+ data: TreeItemData;
129
+ children?: TreeItem[];
130
+ }
131
+
132
+ interface DragWrapperProps {
133
+ item: TreeItem;
134
+ className?: string;
135
+ style?: React.CSSProperties;
136
+ children: React.JSX.Element | null;
137
+ }
138
+
139
+ export interface ObjectCustomDialogProps {
140
+ allVisibleObjects: boolean;
141
+ customsInstances: string[];
142
+ expertMode?: boolean;
143
+ isFloatComma: boolean;
144
+ lang: ioBroker.Languages;
145
+ objectIDs: string[];
146
+ objects: Record<string, ioBroker.Object>;
147
+ onClose: () => void;
148
+ reportChangedIds: (ids: string[]) => void;
149
+ socket: Connection;
150
+ systemConfig: ioBroker.SystemConfigObject;
151
+ t: Translate;
152
+ theme: IobTheme;
153
+ themeName: ThemeName;
154
+ themeType: ThemeType;
155
+ }
156
+
157
+ export interface ObjectMoveRenameDialogProps {
158
+ childrenIds: string[];
159
+ expertMode: boolean;
160
+ id: string;
161
+ objectType: ioBroker.ObjectType | undefined;
162
+ onClose: () => void;
163
+ socket: Connection;
164
+ t: Translate;
165
+ theme: IobTheme;
166
+ }
167
+
168
+ export interface ObjectBrowserValueProps {
169
+ /** State type */
170
+ type: 'states' | 'string' | 'number' | 'boolean' | 'json';
171
+ /** State role */
172
+ role: string;
173
+ /** common.states */
174
+ states: Record<string, string> | null;
175
+ /** The state value */
176
+ value: string | number | boolean | null;
177
+ /** If expert mode is enabled */
178
+ expertMode: boolean;
179
+ onClose: (newValue?: {
180
+ val: ioBroker.StateValue;
181
+ ack: boolean;
182
+ q: ioBroker.STATE_QUALITY[keyof ioBroker.STATE_QUALITY];
183
+ expire: number | undefined;
184
+ }) => void;
185
+ /** Configured theme */
186
+ themeType: ThemeType;
187
+ theme: IobTheme;
188
+ socket: Connection;
189
+ defaultHistory: string;
190
+ dateFormat: string;
191
+ object: ioBroker.StateObject;
192
+ isFloatComma: boolean;
193
+ t: Translate;
194
+ lang: ioBroker.Languages;
195
+ width?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
196
+ }
197
+
198
+ export interface ObjectBrowserEditObjectProps {
199
+ socket: Connection;
200
+ obj: ioBroker.AnyObject;
201
+ roleArray: { role: string; type: ioBroker.CommonType }[];
202
+ expertMode: boolean;
203
+ themeType: ThemeType;
204
+ theme: IobTheme;
205
+ aliasTab: boolean;
206
+ onClose: (obj?: ioBroker.AnyObject) => void;
207
+ dialogName?: string;
208
+ objects: Record<string, ioBroker.AnyObject>;
209
+ dateFormat: string;
210
+ isFloatComma: boolean;
211
+ onNewObject: (obj: ioBroker.AnyObject) => void;
212
+ t: Translate;
213
+ width?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
214
+ }
215
+
216
+ export interface ObjectAliasEditorProps {
217
+ t: Translate;
218
+ roleArray: { role: string; type: ioBroker.CommonType }[];
219
+ socket: Connection;
220
+ objects: Record<string, ioBroker.AnyObject>;
221
+ onRedirect: (id: string, delay?: number) => void;
222
+ obj: ioBroker.AnyObject;
223
+ onClose: () => void;
224
+ }
225
+
226
+ export type ObjectBrowserColumn = 'name' | 'type' | 'role' | 'room' | 'func' | 'val' | 'buttons';
227
+
228
+ export type ObjectBrowserPossibleColumns =
229
+ | 'name'
230
+ | 'type'
231
+ | 'role'
232
+ | 'room'
233
+ | 'func'
234
+ | 'val'
235
+ | 'buttons'
236
+ | 'changedFrom'
237
+ | 'qualityCode'
238
+ | 'timestamp'
239
+ | 'lastChange'
240
+ | 'id';
241
+
242
+ export interface FormatValueOptions {
243
+ state: ioBroker.State;
244
+ obj: ioBroker.StateObject;
245
+ texts: Record<string, string>;
246
+ dateFormat: string;
247
+ isFloatComma: boolean;
248
+ full?: boolean;
249
+ }
250
+
251
+ export interface TreeInfo {
252
+ funcEnums: string[];
253
+ roomEnums: string[];
254
+ roles: { role: string; type: ioBroker.CommonType }[];
255
+ ids: string[];
256
+ types: string[];
257
+ objects: Record<string, ioBroker.Object>;
258
+ customs: string[];
259
+ enums: string[];
260
+ hasSomeCustoms: boolean;
261
+ // List of all aliases that shows to this state
262
+ aliasesMap: { [stateId: string]: string[] };
263
+ }
264
+
265
+ export interface GetValueStyleOptions {
266
+ state: ioBroker.State;
267
+ isExpertMode?: boolean;
268
+ isButton?: boolean;
269
+ nonAckColor?: string;
270
+ }
271
+
272
+ export interface ObjectBrowserCustomFilter {
273
+ type?: ioBroker.ObjectType | ioBroker.ObjectType[];
274
+ common?: {
275
+ type?: ioBroker.CommonType | ioBroker.CommonType[];
276
+ role?: string | string[];
277
+ // If "_" - no custom set
278
+ // If "_dataSources" - only data sources (history, sql, influxdb, ...)
279
+ // Else "telegram." or something like this
280
+ // `true` - If common.custom not empty
281
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
282
+ custom?: '_' | '_dataSources' | true | string | string[];
283
+ };
284
+ }
285
+
286
+ export interface InputSelectItem {
287
+ value: string;
288
+ name: string;
289
+ icon?: null | React.JSX.Element;
290
+ }
291
+
292
+ export interface AdapterColumn {
293
+ adapter: string;
294
+ id: string;
295
+ name: string;
296
+ path: string[];
297
+ pathText: string;
298
+ edit?: boolean;
299
+ type?: 'boolean' | 'string' | 'number';
300
+ objTypes?: ioBroker.ObjectType[];
301
+ align?: 'center' | 'left' | 'right';
302
+ }
303
+
304
+ export interface ObjectBrowserFilter {
305
+ id?: string;
306
+ name?: string;
307
+ room?: string[];
308
+ func?: string[];
309
+ role?: string[];
310
+ type?: string[];
311
+ custom?: string[];
312
+ expertMode?: boolean;
313
+ }
314
+
315
+ /**
316
+ * A navigation target the parent can use to drive the browser (and that the browser reports back).
317
+ * Maps cleanly to a route like `#tab-objects/<mode>/<id>`. The browser reacts to {@link
318
+ * ObjectBrowserProps.navigateTo} and emits {@link ObjectBrowserProps.onNavigateTo}, but never reads
319
+ * the URL itself — the URL parsing/writing stays in the parent component.
320
+ */
321
+ export interface ObjectBrowserNavigation {
322
+ /** `select` = just highlight the item; `edit`/`settings` = open the edit/custom dialog; `viewFile` = open the file viewer. */
323
+ mode: 'select' | 'edit' | 'settings' | 'viewFile';
324
+ /** The object ID (or the file path for `viewFile`). */
325
+ id: string;
326
+ }
327
+
328
+ export interface ObjectBrowserProps {
329
+ /** where to store settings in localStorage */
330
+ dialogName?: string;
331
+ defaultFilters?: ObjectBrowserFilter;
332
+ selected?: string | string[];
333
+ onSelect?: (selected: string | string[], name: string | null, isDouble?: boolean) => void;
334
+ /**
335
+ * Drive selection and dialogs from the parent (e.g. from the URL). When this prop changes the
336
+ * browser selects the object and opens the requested dialog. The browser does NOT read the URL.
337
+ */
338
+ navigateTo?: ObjectBrowserNavigation | null;
339
+ /**
340
+ * Called when the user navigates inside the browser (selects an object, opens or closes a
341
+ * dialog) so the parent can reflect it in the URL. The browser never touches the URL itself.
342
+ */
343
+ onNavigateTo?: (navigation: ObjectBrowserNavigation | null) => void;
344
+ onFilterChanged?: (newFilter: ObjectBrowserFilter) => void;
345
+ socket: Connection;
346
+ showExpertButton?: boolean;
347
+ expertMode?: boolean;
348
+ imagePrefix?: string;
349
+ themeName: ThemeName;
350
+ themeType: ThemeType;
351
+ /** will be filled by withWidth */
352
+ width?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
353
+ theme: IobTheme;
354
+ t: Translate;
355
+ lang: ioBroker.Languages;
356
+ multiSelect?: boolean;
357
+ notEditable?: boolean;
358
+ foldersFirst?: boolean;
359
+ disableColumnSelector?: boolean;
360
+ isFloatComma?: boolean;
361
+ dateFormat?: string;
362
+ levelPadding?: number;
363
+ /** Allow selection of non-objects (virtual branches) */
364
+ allowNonObjects?: boolean;
365
+ /** Called when all objects are loaded */
366
+ onAllLoaded?: () => void;
367
+
368
+ // components
369
+ objectCustomDialog?: React.FC<ObjectCustomDialogProps>;
370
+ objectMoveRenameDialog?: React.FC<ObjectMoveRenameDialogProps>;
371
+ objectAddBoolean?: boolean; // optional toolbar button
372
+ objectEditBoolean?: boolean; // optional toolbar button
373
+ objectStatesView?: boolean; // optional toolbar button
374
+ objectImportExport?: boolean; // optional toolbar button
375
+ objectEditOfAccessControl?: boolean; // Access Control
376
+ /** modal add object */
377
+ modalNewObject?: (oBrowser: ObjectBrowserClass) => React.JSX.Element;
378
+ /** modal Edit Of Access Control */
379
+ modalEditOfAccessControl: (oBrowser: ObjectBrowserClass, data: TreeItemData) => React.JSX.Element;
380
+ onObjectDelete?: (id: string, hasChildren: boolean, objectExists: boolean, childrenCount: number) => void;
381
+
382
+ /**
383
+ * Optional filter
384
+ * `{common: {custom: true}}` - show only objects with some custom settings
385
+ * `{common: {custom: 'sql.0'}}` - show only objects with `sql.0` custom settings (only of the specific instance)
386
+ * `{common: {custom: '_dataSources'}}` - show only objects of adapters `influxdb' or 'sql' or 'history'
387
+ * `{common: {custom: 'adapterName.'}}` - show only objects of custom settings of specific adapter (all instances)
388
+ * `{type: 'channel'}` - show only channels
389
+ * `{type: ['channel', 'device']}` - show only channels and devices
390
+ * `{common: {type: 'number'}` - show only states of type 'number
391
+ * `{common: {type: ['number', 'string']}` - show only states of type 'number and string
392
+ * `{common: {role: ['switch']}` - show only states with roles starting from switch
393
+ * `{common: {role: ['switch', 'button']}` - show only states with roles starting from `switch` and `button`
394
+ */
395
+ customFilter: ObjectBrowserCustomFilter;
396
+ objectBrowserValue?: React.FC<ObjectBrowserValueProps>;
397
+ objectBrowserEditObject?: React.FC<ObjectBrowserEditObjectProps>;
398
+ /** on edit alias */
399
+ objectBrowserAliasEditor?: React.FC<ObjectAliasEditorProps>;
400
+ /** on Edit role */
401
+ objectBrowserEditRole?: React.FC<ObjectBrowserEditRoleProps>;
402
+ /** on view file state */
403
+ objectBrowserViewFile?: React.FC<ObjectViewFileDialogProps>;
404
+ objectBrowserInsertJsonObjects?: React.FC<InsertJsonObjectsDialogProps>;
405
+ router?: typeof Router;
406
+ types?: ioBroker.ObjectType[];
407
+ /** Possible columns: ['name', 'type', 'role', 'room', 'func', 'val', 'buttons'] */
408
+ columns?: ObjectBrowserColumn[];
409
+ /** Shows only elements of this root */
410
+ root?: string;
411
+
412
+ /** cache of objects */
413
+ objectsWorker?: ObjectsWorker;
414
+ /**
415
+ * function to filter out all unnecessary objects. It cannot be used together with "types"
416
+ * Example for function: `obj => obj.common?.type === 'boolean'` to show only boolean states
417
+ */
418
+ filterFunc?: (obj: ioBroker.Object) => boolean;
419
+ /** Used for enums dragging */
420
+ DragWrapper?: React.FC<DragWrapperProps>;
421
+ /** let DragWrapper know about objects to get the icons */
422
+ setObjectsReference?: (objects: Record<string, ioBroker.Object>) => void;
423
+ dragEnabled?: boolean;
424
+ }
425
+
426
+ export interface ObjectBrowserState {
427
+ loaded: boolean;
428
+ foldersFirst: boolean;
429
+ selected: string[];
430
+ focused: string;
431
+ selectedNonObject: string;
432
+ filter: ObjectBrowserFilter;
433
+ filterKey: number;
434
+ depth: number;
435
+ expandAllVisible: boolean;
436
+ expanded: string[];
437
+ toast: string;
438
+ scrollBarWidth: number;
439
+ customDialog: null | string[];
440
+ customDialogAll?: boolean;
441
+ editObjectDialog: string;
442
+ editObjectAlias: boolean; // open the edit object dialog on alias tab
443
+ viewFileDialog: string;
444
+ showAliasEditor: string;
445
+ enumDialog: null | {
446
+ item: TreeItem;
447
+ type: 'room' | 'func';
448
+ enumsOriginal: string;
449
+ };
450
+ enumDialogEnums?: null | string[];
451
+ roleDialog: null | string;
452
+ statesView: boolean;
453
+ /** ['name', 'type', 'role', 'room', 'func', 'val', 'buttons'] */
454
+ columns: ObjectBrowserPossibleColumns[] | null;
455
+ columnsForAdmin: Record<string, CustomAdminColumnStored[]> | null;
456
+ columnsSelectorShow: boolean;
457
+ columnsAuto: boolean;
458
+ columnsWidths: Record<string, number>;
459
+ columnsDialogTransparent: number;
460
+ columnsEditCustomDialog: null | {
461
+ obj: ioBroker.Object;
462
+ item: TreeItem;
463
+ it: AdapterColumn;
464
+ };
465
+ customColumnDialogValueChanged: boolean;
466
+ showExportDialog: false | number;
467
+ showImportDialog: boolean;
468
+ showAllExportOptions: boolean;
469
+ linesEnabled: boolean;
470
+ showDescription: boolean;
471
+ showContextMenu: {
472
+ item: TreeItem;
473
+ position: { left: number; top: number };
474
+ subItem?: string;
475
+ subAnchor?: HTMLLIElement;
476
+ } | null;
477
+ noStatesByExportImport: boolean;
478
+ beautifyJsonExport: boolean;
479
+ excludeSystemRepositoriesFromExport: boolean;
480
+ excludeTranslations: boolean;
481
+ updating?: boolean;
482
+ modalNewObj?: null | { id: string; initialType?: ioBroker.ObjectType; initialStateType?: ioBroker.CommonType };
483
+ error?: any;
484
+ modalEditOfAccess?: boolean;
485
+ modalEditOfAccessObjData?: TreeItemData;
486
+ updateOpened?: boolean;
487
+ tooltipInfo: null | { el: React.JSX.Element[]; id: string };
488
+ /** Show the menu with aliases for state */
489
+ aliasMenu: string;
490
+ /** Show rename dialog */
491
+ showRenameDialog: {
492
+ id: string;
493
+ childrenIds: string[];
494
+ } | null;
495
+ showImportMenu: HTMLButtonElement | null;
496
+ }
@@ -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 {};