@trops/dash-core 0.1.421 → 0.1.422

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
@@ -18812,7 +18812,32 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
18812
18812
  var isWidgetMissing = (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component) && !widgetConfig;
18813
18813
 
18814
18814
  // Get widget name from config or item
18815
- var widgetName = (widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.name) || (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.name) || (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component);
18815
+ var widgetName = (widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.displayName) || (widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.name) || (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.name) || (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component);
18816
+
18817
+ // Build a scope/package subtitle so ambiguous component names like
18818
+ // `ProspectListColumn` (which might come from `@ai-built/…` or
18819
+ // `@trops/pipeline`) are disambiguated in the layout builder. Derives
18820
+ // from whatever identity the config / layout item carries:
18821
+ // - widgetConfig.id: e.g. "@ai-built/prospectlistcolumn.ProspectListColumn"
18822
+ // - widgetConfig.package: e.g. "@ai-built/prospectlistcolumn"
18823
+ // - widgetItem.workspace: fallback hint ("ai-built" / "@trops/pipeline")
18824
+ // Falls back to empty string so we can skip rendering if we have
18825
+ // nothing meaningful beyond the component name itself.
18826
+ var packageLabel = function () {
18827
+ var dropTrailingComponent = function dropTrailingComponent(s) {
18828
+ if (typeof s !== "string") return "";
18829
+ var lastDot = s.lastIndexOf(".");
18830
+ return lastDot > 0 ? s.slice(0, lastDot) : s;
18831
+ };
18832
+ var fromId = dropTrailingComponent((widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.id) || "");
18833
+ if (fromId) return fromId;
18834
+ if (widgetConfig !== null && widgetConfig !== void 0 && widgetConfig["package"]) return String(widgetConfig["package"]);
18835
+ var wsHint = widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.workspace;
18836
+ if (typeof wsHint === "string" && wsHint && wsHint !== "layout") {
18837
+ return wsHint.startsWith("@") ? wsHint : "@".concat(wsHint);
18838
+ }
18839
+ return "";
18840
+ }();
18816
18841
 
18817
18842
  // Get provider requirements from widget config (not from item directly)
18818
18843
  // Filter out providerClass: "api" so only user-configurable providers show badges
@@ -18951,11 +18976,18 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
18951
18976
  children: [/*#__PURE__*/jsxRuntime.jsx(WidgetIcon, {
18952
18977
  icon: isWidgetMissing ? "triangle-exclamation" : widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.icon,
18953
18978
  className: "h-4 w-4 flex-shrink-0 ".concat(isWidgetMissing ? "text-amber-500" : "text-white/60")
18954
- }), /*#__PURE__*/jsxRuntime.jsxs("span", {
18955
- className: "font-medium text-sm text-gray-100 truncate",
18956
- children: [widgetName || cellNumber || "Empty", isWidgetMissing && /*#__PURE__*/jsxRuntime.jsx("span", {
18957
- className: "text-amber-500/70 font-normal ml-1",
18958
- children: "(not found)"
18979
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
18980
+ className: "flex flex-col min-w-0 leading-tight",
18981
+ children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
18982
+ className: "font-medium text-sm text-gray-100 truncate",
18983
+ children: [widgetName || cellNumber || "Empty", isWidgetMissing && /*#__PURE__*/jsxRuntime.jsx("span", {
18984
+ className: "text-amber-500/70 font-normal ml-1",
18985
+ children: "(not found)"
18986
+ })]
18987
+ }), packageLabel && /*#__PURE__*/jsxRuntime.jsxs("span", {
18988
+ className: "text-[10px] text-gray-500 truncate",
18989
+ title: "".concat(packageLabel, " \xB7 ").concat((widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component) || ""),
18990
+ children: [packageLabel, widgetItem !== null && widgetItem !== void 0 && widgetItem.component && widgetItem.component !== widgetName ? " \xB7 ".concat(widgetItem.component) : ""]
18959
18991
  })]
18960
18992
  })]
18961
18993
  }), (providerRequirements.length > 0 || overflowActions.length > 0 || onMoreOptions) && /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -20710,6 +20742,17 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
20710
20742
  wsRef.current = currentWorkspace;
20711
20743
  }, [currentWorkspace]);
20712
20744
 
20745
+ // Stable ref to onWorkspaceChange so the window-event handlers below can
20746
+ // propagate mutations upstream without resubscribing on every render.
20747
+ // Without this, swap/place handlers only update LayoutBuilder-local
20748
+ // state — the parent (PinnedSidebar / PageLayoutBuilder) never learns
20749
+ // about the change, so the next parent re-render reverts it via the
20750
+ // `[workspace]` useEffect above and the save path reads stale state.
20751
+ var onWorkspaceChangeRef = React.useRef(onWorkspaceChange);
20752
+ React.useEffect(function () {
20753
+ onWorkspaceChangeRef.current = onWorkspaceChange;
20754
+ }, [onWorkspaceChange]);
20755
+
20713
20756
  // Listen for AI widget builder placement — modifies layout state directly
20714
20757
  React.useEffect(function () {
20715
20758
  var handler = function handler(e) {
@@ -20746,6 +20789,9 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
20746
20789
  var newWorkspace = JSON.parse(JSON.stringify(ws));
20747
20790
  newWorkspace.layout = newLayout;
20748
20791
  setCurrentWorkspace(newWorkspace);
20792
+ if (typeof onWorkspaceChangeRef.current === "function") {
20793
+ onWorkspaceChangeRef.current(newWorkspace);
20794
+ }
20749
20795
  } catch (err) {
20750
20796
  }
20751
20797
  };
@@ -20780,6 +20826,9 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
20780
20826
  var newWorkspace = JSON.parse(JSON.stringify(ws));
20781
20827
  newWorkspace.layout = newLayout;
20782
20828
  setCurrentWorkspace(newWorkspace);
20829
+ if (typeof onWorkspaceChangeRef.current === "function") {
20830
+ onWorkspaceChangeRef.current(newWorkspace);
20831
+ }
20783
20832
  } catch (err) {
20784
20833
  }
20785
20834
  };