@iobroker/adapter-react-v5 8.0.10 → 8.0.11

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.
package/README.md CHANGED
@@ -691,7 +691,7 @@ You can find the migration instructions:
691
691
  -->
692
692
 
693
693
  ## Changelog
694
- ### 8.0.10 (2025-11-09)
694
+ ### 8.0.11 (2025-11-09)
695
695
  - (@GermanBluefox) Fixing ref for Icon and TabContent components
696
696
 
697
697
  ### 8.0.9 (2025-11-02)
@@ -0,0 +1,472 @@
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
+ }
270
+
271
+ export interface ObjectBrowserCustomFilter {
272
+ type?: ioBroker.ObjectType | ioBroker.ObjectType[];
273
+ common?: {
274
+ type?: ioBroker.CommonType | ioBroker.CommonType[];
275
+ role?: string | string[];
276
+ // If "_" - no custom set
277
+ // If "_dataSources" - only data sources (history, sql, influxdb, ...)
278
+ // Else "telegram." or something like this
279
+ // `true` - If common.custom not empty
280
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
281
+ custom?: '_' | '_dataSources' | true | string | string[];
282
+ };
283
+ }
284
+
285
+ export interface InputSelectItem {
286
+ value: string;
287
+ name: string;
288
+ icon?: null | React.JSX.Element;
289
+ }
290
+
291
+ export interface AdapterColumn {
292
+ adapter: string;
293
+ id: string;
294
+ name: string;
295
+ path: string[];
296
+ pathText: string;
297
+ edit?: boolean;
298
+ type?: 'boolean' | 'string' | 'number';
299
+ objTypes?: ioBroker.ObjectType[];
300
+ align?: 'center' | 'left' | 'right';
301
+ }
302
+
303
+ export interface ObjectBrowserFilter {
304
+ id?: string;
305
+ name?: string;
306
+ room?: string[];
307
+ func?: string[];
308
+ role?: string[];
309
+ type?: string[];
310
+ custom?: string[];
311
+ expertMode?: boolean;
312
+ }
313
+
314
+ export interface ObjectBrowserProps {
315
+ /** where to store settings in localStorage */
316
+ dialogName?: string;
317
+ defaultFilters?: ObjectBrowserFilter;
318
+ selected?: string | string[];
319
+ onSelect?: (selected: string | string[], name: string | null, isDouble?: boolean) => void;
320
+ onFilterChanged?: (newFilter: ObjectBrowserFilter) => void;
321
+ socket: Connection;
322
+ showExpertButton?: boolean;
323
+ expertMode?: boolean;
324
+ imagePrefix?: string;
325
+ themeName: ThemeName;
326
+ themeType: ThemeType;
327
+ /** will be filled by withWidth */
328
+ width?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
329
+ theme: IobTheme;
330
+ t: Translate;
331
+ lang: ioBroker.Languages;
332
+ multiSelect?: boolean;
333
+ notEditable?: boolean;
334
+ foldersFirst?: boolean;
335
+ disableColumnSelector?: boolean;
336
+ isFloatComma?: boolean;
337
+ dateFormat?: string;
338
+ levelPadding?: number;
339
+ /** Allow selection of non-objects (virtual branches) */
340
+ allowNonObjects?: boolean;
341
+ /** Called when all objects are loaded */
342
+ onAllLoaded?: () => void;
343
+
344
+ // components
345
+ objectCustomDialog?: React.FC<ObjectCustomDialogProps>;
346
+ objectMoveRenameDialog?: React.FC<ObjectMoveRenameDialogProps>;
347
+ objectAddBoolean?: boolean; // optional toolbar button
348
+ objectEditBoolean?: boolean; // optional toolbar button
349
+ objectStatesView?: boolean; // optional toolbar button
350
+ objectImportExport?: boolean; // optional toolbar button
351
+ objectEditOfAccessControl?: boolean; // Access Control
352
+ /** modal add object */
353
+ modalNewObject?: (oBrowser: ObjectBrowserClass) => React.JSX.Element;
354
+ /** modal Edit Of Access Control */
355
+ modalEditOfAccessControl: (oBrowser: ObjectBrowserClass, data: TreeItemData) => React.JSX.Element;
356
+ onObjectDelete?: (id: string, hasChildren: boolean, objectExists: boolean, childrenCount: number) => void;
357
+
358
+ /**
359
+ * Optional filter
360
+ * `{common: {custom: true}}` - show only objects with some custom settings
361
+ * `{common: {custom: 'sql.0'}}` - show only objects with `sql.0` custom settings (only of the specific instance)
362
+ * `{common: {custom: '_dataSources'}}` - show only objects of adapters `influxdb' or 'sql' or 'history'
363
+ * `{common: {custom: 'adapterName.'}}` - show only objects of custom settings of specific adapter (all instances)
364
+ * `{type: 'channel'}` - show only channels
365
+ * `{type: ['channel', 'device']}` - show only channels and devices
366
+ * `{common: {type: 'number'}` - show only states of type 'number
367
+ * `{common: {type: ['number', 'string']}` - show only states of type 'number and string
368
+ * `{common: {role: ['switch']}` - show only states with roles starting from switch
369
+ * `{common: {role: ['switch', 'button']}` - show only states with roles starting from `switch` and `button`
370
+ */
371
+ customFilter: ObjectBrowserCustomFilter;
372
+ objectBrowserValue?: React.FC<ObjectBrowserValueProps>;
373
+ objectBrowserEditObject?: React.FC<ObjectBrowserEditObjectProps>;
374
+ /** on edit alias */
375
+ objectBrowserAliasEditor?: React.FC<ObjectAliasEditorProps>;
376
+ /** on Edit role */
377
+ objectBrowserEditRole?: React.FC<ObjectBrowserEditRoleProps>;
378
+ /** on view file state */
379
+ objectBrowserViewFile?: React.FC<ObjectViewFileDialogProps>;
380
+ objectBrowserInsertJsonObjects?: React.FC<InsertJsonObjectsDialogProps>;
381
+ router?: typeof Router;
382
+ types?: ioBroker.ObjectType[];
383
+ /** Possible columns: ['name', 'type', 'role', 'room', 'func', 'val', 'buttons'] */
384
+ columns?: ObjectBrowserColumn[];
385
+ /** Shows only elements of this root */
386
+ root?: string;
387
+
388
+ /** cache of objects */
389
+ objectsWorker?: ObjectsWorker;
390
+ /**
391
+ * function to filter out all unnecessary objects. It cannot be used together with "types"
392
+ * Example for function: `obj => obj.common?.type === 'boolean'` to show only boolean states
393
+ */
394
+ filterFunc?: (obj: ioBroker.Object) => boolean;
395
+ /** Used for enums dragging */
396
+ DragWrapper?: React.FC<DragWrapperProps>;
397
+ /** let DragWrapper know about objects to get the icons */
398
+ setObjectsReference?: (objects: Record<string, ioBroker.Object>) => void;
399
+ dragEnabled?: boolean;
400
+ }
401
+
402
+ export interface ObjectBrowserState {
403
+ loaded: boolean;
404
+ foldersFirst: boolean;
405
+ selected: string[];
406
+ focused: string;
407
+ selectedNonObject: string;
408
+ filter: ObjectBrowserFilter;
409
+ filterKey: number;
410
+ depth: number;
411
+ expandAllVisible: boolean;
412
+ expanded: string[];
413
+ toast: string;
414
+ scrollBarWidth: number;
415
+ customDialog: null | string[];
416
+ customDialogAll?: boolean;
417
+ editObjectDialog: string;
418
+ editObjectAlias: boolean; // open the edit object dialog on alias tab
419
+ viewFileDialog: string;
420
+ showAliasEditor: string;
421
+ enumDialog: null | {
422
+ item: TreeItem;
423
+ type: 'room' | 'func';
424
+ enumsOriginal: string;
425
+ };
426
+ enumDialogEnums?: null | string[];
427
+ roleDialog: null | string;
428
+ statesView: boolean;
429
+ /** ['name', 'type', 'role', 'room', 'func', 'val', 'buttons'] */
430
+ columns: ObjectBrowserPossibleColumns[] | null;
431
+ columnsForAdmin: Record<string, CustomAdminColumnStored[]> | null;
432
+ columnsSelectorShow: boolean;
433
+ columnsAuto: boolean;
434
+ columnsWidths: Record<string, number>;
435
+ columnsDialogTransparent: number;
436
+ columnsEditCustomDialog: null | {
437
+ obj: ioBroker.Object;
438
+ item: TreeItem;
439
+ it: AdapterColumn;
440
+ };
441
+ customColumnDialogValueChanged: boolean;
442
+ showExportDialog: false | number;
443
+ showImportDialog: boolean;
444
+ showAllExportOptions: boolean;
445
+ linesEnabled: boolean;
446
+ showDescription: boolean;
447
+ showContextMenu: {
448
+ item: TreeItem;
449
+ position: { left: number; top: number };
450
+ subItem?: string;
451
+ subAnchor?: HTMLLIElement;
452
+ } | null;
453
+ noStatesByExportImport: boolean;
454
+ beautifyJsonExport: boolean;
455
+ excludeSystemRepositoriesFromExport: boolean;
456
+ excludeTranslations: boolean;
457
+ updating?: boolean;
458
+ modalNewObj?: null | { id: string; initialType?: ioBroker.ObjectType; initialStateType?: ioBroker.CommonType };
459
+ error?: any;
460
+ modalEditOfAccess?: boolean;
461
+ modalEditOfAccessObjData?: TreeItemData;
462
+ updateOpened?: boolean;
463
+ tooltipInfo: null | { el: React.JSX.Element[]; id: string };
464
+ /** Show the menu with aliases for state */
465
+ aliasMenu: string;
466
+ /** Show rename dialog */
467
+ showRenameDialog: {
468
+ id: string;
469
+ childrenIds: string[];
470
+ } | null;
471
+ showImportMenu: HTMLButtonElement | null;
472
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/adapter-react-v5",
3
- "version": "8.0.10",
3
+ "version": "8.0.11",
4
4
  "description": "React components to develop ioBroker interfaces with react.",
5
5
  "author": {
6
6
  "name": "bluefox",