@trops/dash-core 0.1.353 → 0.1.354

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/dist/index.js CHANGED
@@ -53729,13 +53729,27 @@ var WidgetPopoutInner = function WidgetPopoutInner(_ref2) {
53729
53729
  }
53730
53730
  setWorkspace(target);
53731
53731
 
53732
- // `widgetId` carries the layout item's uuid (globally unique
53733
- // across pages/containers) but older callers may still pass a
53734
- // bare numeric id. Match uuid first, then fall back to id.
53735
- // Without the uuid match, widgets on a non-first page get
53736
- // masked by same-numeric-id widgets in the main layout.
53732
+ // `widgetId` carries the layout item's uuid. That uuid is
53733
+ // `${dashboardId}-${component}-${id}`
53734
+ // but the dashboardId prefix can differ between the main
53735
+ // window's LayoutModel instance and the one rebuilt here,
53736
+ // so we match on several shapes to be robust:
53737
+ //
53738
+ // 1. full uuid match (preferred)
53739
+ // 2. trailing `component-id` suffix (strip dashboardId)
53740
+ // 3. bare numeric id (legacy callers that pre-date uuid)
53741
+ //
53742
+ // Extract the suffix once: everything after the first "-"
53743
+ // when the string starts with a dashboard-looking prefix.
53744
+ var tail = String(widgetId).split("-").slice(-2).join("-");
53737
53745
  var matches = function matches(item) {
53738
- return item.uuid === widgetId || item.id === widgetId;
53746
+ if (item.uuid === widgetId) return true;
53747
+ if (item.uuid && item.uuid.endsWith("-" + tail)) return true;
53748
+ var itemTail = "".concat(item.component, "-").concat(item.id);
53749
+ if (itemTail === widgetId) return true;
53750
+ if (itemTail === tail) return true;
53751
+ if (item.id === widgetId) return true;
53752
+ return false;
53739
53753
  };
53740
53754
  var widget = target.layout.find(matches);
53741
53755
  if (!widget && target.pages && Array.isArray(target.pages)) {
@@ -53759,6 +53773,38 @@ var WidgetPopoutInner = function WidgetPopoutInner(_ref2) {
53759
53773
  widget = target.sidebarLayout.find(matches);
53760
53774
  }
53761
53775
  if (!widget) {
53776
+ // Diagnostic dump — helps pinpoint id/uuid mismatches when
53777
+ // the user reports a "Widget not available" popout.
53778
+ var dump = {
53779
+ searchedFor: widgetId,
53780
+ suffix: tail,
53781
+ mainLayout: (target.layout || []).map(function (i) {
53782
+ return {
53783
+ id: i.id,
53784
+ uuid: i.uuid,
53785
+ component: i.component
53786
+ };
53787
+ }),
53788
+ pages: (target.pages || []).map(function (p) {
53789
+ return {
53790
+ pageId: p.id,
53791
+ items: (p.layout || []).map(function (i) {
53792
+ return {
53793
+ id: i.id,
53794
+ uuid: i.uuid,
53795
+ component: i.component
53796
+ };
53797
+ })
53798
+ };
53799
+ }),
53800
+ sidebar: (target.sidebarLayout || []).map(function (i) {
53801
+ return {
53802
+ id: i.id,
53803
+ uuid: i.uuid,
53804
+ component: i.component
53805
+ };
53806
+ })
53807
+ };
53762
53808
  setError("Widget not found in workspace");
53763
53809
  return;
53764
53810
  }