@trops/dash-core 0.1.351 → 0.1.353

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
@@ -25346,9 +25346,15 @@ var LayoutGridContainer = /*#__PURE__*/React.memo(function (_ref3) {
25346
25346
  }
25347
25347
  var rendered = renderComponent(cellComponent.component, cellComponent.id, cellComponent, null);
25348
25348
  if (onWidgetPopout && cellComponent.component) {
25349
+ // Prefer uuid over id — uuid is `${dashboardId}-${component}-${id}`
25350
+ // which is globally unique, while id is only unique within a
25351
+ // single page/container. Passing bare id causes WidgetPopoutStage
25352
+ // to find-first-match across layout/pages and render the wrong
25353
+ // widget when two pages share the same numeric id.
25354
+ var popoutKey = cellComponent.uuid || cellComponent.id;
25349
25355
  return /*#__PURE__*/jsxRuntime.jsx(PopoutOverlay, {
25350
25356
  onPopout: function onPopout() {
25351
- return onWidgetPopout(cellComponent.id);
25357
+ return onWidgetPopout(popoutKey);
25352
25358
  },
25353
25359
  children: rendered
25354
25360
  });
@@ -47737,7 +47743,7 @@ var PackageItem = function PackageItem(_ref6) {
47737
47743
  }
47738
47744
  function _handleSave2() {
47739
47745
  _handleSave2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
47740
- var _window$mainApi3, updates, result;
47746
+ var _window$mainApi4, updates, result;
47741
47747
  return _regeneratorRuntime.wrap(function (_context3) {
47742
47748
  while (1) switch (_context3.prev = _context3.next) {
47743
47749
  case 0:
@@ -47753,7 +47759,7 @@ var PackageItem = function PackageItem(_ref6) {
47753
47759
  visibility: form.visibility
47754
47760
  };
47755
47761
  _context3.next = 2;
47756
- return (_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.registryAuth) === null || _window$mainApi3 === void 0 ? void 0 : _window$mainApi3.updatePackage(pkg.scope, pkg.name, updates);
47762
+ return (_window$mainApi4 = window.mainApi) === null || _window$mainApi4 === void 0 || (_window$mainApi4 = _window$mainApi4.registryAuth) === null || _window$mainApi4 === void 0 ? void 0 : _window$mainApi4.updatePackage(pkg.scope, pkg.name, updates);
47757
47763
  case 2:
47758
47764
  result = _context3.sent;
47759
47765
  if (result) {
@@ -47781,14 +47787,14 @@ var PackageItem = function PackageItem(_ref6) {
47781
47787
  }
47782
47788
  function _handleDelete() {
47783
47789
  _handleDelete = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
47784
- var _window$mainApi4, result;
47790
+ var _window$mainApi5, result;
47785
47791
  return _regeneratorRuntime.wrap(function (_context4) {
47786
47792
  while (1) switch (_context4.prev = _context4.next) {
47787
47793
  case 0:
47788
47794
  setDeleting(true);
47789
47795
  _context4.prev = 1;
47790
47796
  _context4.next = 2;
47791
- return (_window$mainApi4 = window.mainApi) === null || _window$mainApi4 === void 0 || (_window$mainApi4 = _window$mainApi4.registryAuth) === null || _window$mainApi4 === void 0 ? void 0 : _window$mainApi4.deletePackage(pkg.scope, pkg.name);
47797
+ return (_window$mainApi5 = window.mainApi) === null || _window$mainApi5 === void 0 || (_window$mainApi5 = _window$mainApi5.registryAuth) === null || _window$mainApi5 === void 0 ? void 0 : _window$mainApi5.deletePackage(pkg.scope, pkg.name);
47792
47798
  case 2:
47793
47799
  result = _context4.sent;
47794
47800
  if (result) {
@@ -47915,6 +47921,16 @@ var PackageItem = function PackageItem(_ref6) {
47915
47921
  })]
47916
47922
  });
47917
47923
  }
47924
+ var isPrivate = pkg.visibility === "private";
47925
+ function openAccessPage(e) {
47926
+ var _window$mainApi3;
47927
+ e.stopPropagation();
47928
+ // Registry web URL. If we ever move off Amplify Hosting's default
47929
+ // domain this centralizes nicely into a config, but hardcoded is
47930
+ // consistent with how other files in the app already reference it.
47931
+ var url = "https://main.d919rwhuzp7rj.amplifyapp.com/package/".concat(encodeURIComponent(pkg.scope), "/").concat(encodeURIComponent(pkg.name), "/access");
47932
+ (_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.shell) === null || _window$mainApi3 === void 0 || _window$mainApi3.openExternal(url);
47933
+ }
47918
47934
  return /*#__PURE__*/jsxRuntime.jsx("div", {
47919
47935
  onClick: onEdit,
47920
47936
  className: "bg-white/5 rounded-lg p-3 cursor-pointer hover:bg-white/10 transition-colors",
@@ -47929,8 +47945,14 @@ var PackageItem = function PackageItem(_ref6) {
47929
47945
  className: "text-[10px] px-1.5 py-0.5 rounded bg-white/10 opacity-60",
47930
47946
  children: ["v", pkg.version]
47931
47947
  }), /*#__PURE__*/jsxRuntime.jsx("span", {
47932
- className: "text-[10px] px-1.5 py-0.5 rounded ".concat(pkg.visibility === "private" ? "bg-amber-500/20 text-amber-300" : "bg-emerald-500/20 text-emerald-300"),
47948
+ className: "text-[10px] px-1.5 py-0.5 rounded ".concat(isPrivate ? "bg-amber-500/20 text-amber-300" : "bg-emerald-500/20 text-emerald-300"),
47933
47949
  children: pkg.visibility || "public"
47950
+ }), isPrivate && /*#__PURE__*/jsxRuntime.jsx("button", {
47951
+ type: "button",
47952
+ onClick: openAccessPage,
47953
+ title: "Open the access management page in your browser",
47954
+ className: "ml-auto text-[10px] px-2 py-0.5 rounded border border-indigo-500/40 text-indigo-300 hover:text-white hover:bg-indigo-600/20 transition-colors",
47955
+ children: "Manage access \u2192"
47934
47956
  })]
47935
47957
  }), pkg.description && /*#__PURE__*/jsxRuntime.jsx("p", {
47936
47958
  className: "text-xs opacity-50 truncate",
@@ -53707,10 +53729,15 @@ var WidgetPopoutInner = function WidgetPopoutInner(_ref2) {
53707
53729
  }
53708
53730
  setWorkspace(target);
53709
53731
 
53710
- // Find the widget across all layout locations
53711
- var widget = target.layout.find(function (item) {
53712
- return item.id === widgetId;
53713
- });
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.
53737
+ var matches = function matches(item) {
53738
+ return item.uuid === widgetId || item.id === widgetId;
53739
+ };
53740
+ var widget = target.layout.find(matches);
53714
53741
  if (!widget && target.pages && Array.isArray(target.pages)) {
53715
53742
  var _iterator = _createForOfIteratorHelper$2(target.pages),
53716
53743
  _step;
@@ -53718,9 +53745,7 @@ var WidgetPopoutInner = function WidgetPopoutInner(_ref2) {
53718
53745
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
53719
53746
  var page = _step.value;
53720
53747
  if (page.layout && Array.isArray(page.layout)) {
53721
- widget = page.layout.find(function (item) {
53722
- return item.id === widgetId;
53723
- });
53748
+ widget = page.layout.find(matches);
53724
53749
  if (widget) break;
53725
53750
  }
53726
53751
  }
@@ -53731,9 +53756,7 @@ var WidgetPopoutInner = function WidgetPopoutInner(_ref2) {
53731
53756
  }
53732
53757
  }
53733
53758
  if (!widget && target.sidebarLayout && Array.isArray(target.sidebarLayout)) {
53734
- widget = target.sidebarLayout.find(function (item) {
53735
- return item.id === widgetId;
53736
- });
53759
+ widget = target.sidebarLayout.find(matches);
53737
53760
  }
53738
53761
  if (!widget) {
53739
53762
  setError("Widget not found in workspace");