@iobroker/adapter-react-v5 8.2.6 → 8.2.8

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.
@@ -312,12 +312,35 @@ export interface ObjectBrowserFilter {
312
312
  expertMode?: boolean;
313
313
  }
314
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
+
315
328
  export interface ObjectBrowserProps {
316
329
  /** where to store settings in localStorage */
317
330
  dialogName?: string;
318
331
  defaultFilters?: ObjectBrowserFilter;
319
332
  selected?: string | string[];
320
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;
321
344
  onFilterChanged?: (newFilter: ObjectBrowserFilter) => void;
322
345
  socket: Connection;
323
346
  showExpertButton?: boolean;
@@ -391,7 +391,7 @@ export function getSelectIdIconFromObjects(objects, id, lang, imagePrefix) {
391
391
  }
392
392
  }
393
393
  else {
394
- const common = objects[id] && objects[id].common;
394
+ const common = objects[id]?.common;
395
395
  if (common) {
396
396
  const cIcon = common.icon;
397
397
  if (cIcon) {