@trops/dash-core 0.1.335 → 0.1.336
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.esm.js +25 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27376,7 +27376,21 @@ var WorkspaceModel = function WorkspaceModel(workspaceItem) {
|
|
|
27376
27376
|
workspace.type = "type" in obj ? sanitizeType(obj["type"]) : "workspace";
|
|
27377
27377
|
workspace.label = "label" in obj ? obj["label"] : "New Dashboard";
|
|
27378
27378
|
workspace.version = "version" in obj ? obj["version"] : 1;
|
|
27379
|
-
|
|
27379
|
+
// Use the provided layout if it exists and is non-empty; otherwise
|
|
27380
|
+
// create a default 1x1 grid so the workspace always has a renderable
|
|
27381
|
+
// grid container.
|
|
27382
|
+
var rawLayout = "layout" in obj && Array.isArray(obj["layout"]) && obj["layout"].length > 0 ? obj["layout"] : defaultGridLayout();
|
|
27383
|
+
|
|
27384
|
+
// Normalize each layout item through LayoutModel so renderers get a
|
|
27385
|
+
// fully-shaped object (contexts, listeners, eventHandlers, etc.).
|
|
27386
|
+
// Without this, layouts coming from createLayoutFromTemplate (the
|
|
27387
|
+
// wizard) are missing fields and the grid container fails to render.
|
|
27388
|
+
// Skip items already produced by LayoutModel (idempotent: LayoutModel
|
|
27389
|
+
// is safe to call on its own output).
|
|
27390
|
+
var wsId = "id" in obj ? obj["id"] : workspace.id;
|
|
27391
|
+
workspace.layout = rawLayout.map(function (item) {
|
|
27392
|
+
return LayoutModel(item, rawLayout, wsId);
|
|
27393
|
+
});
|
|
27380
27394
|
workspace.pages = "pages" in obj ? obj["pages"] : [];
|
|
27381
27395
|
workspace.activePageId = "activePageId" in obj ? obj["activePageId"] : null;
|
|
27382
27396
|
|
|
@@ -51697,6 +51711,16 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
51697
51711
|
// whenever a navigation happens through navigateToPage().
|
|
51698
51712
|
var pageHistoryRef = React.useRef([]);
|
|
51699
51713
|
|
|
51714
|
+
// Reset local activePageId when the active tab changes so the next
|
|
51715
|
+
// render falls back to the new workspace's saved activePageId
|
|
51716
|
+
// (or its first page). Without this, a stale activePageId from a
|
|
51717
|
+
// previously-active dashboard would prevent the new dashboard's
|
|
51718
|
+
// pages from rendering (no page matches → all hidden).
|
|
51719
|
+
React.useEffect(function () {
|
|
51720
|
+
setActivePageId(null);
|
|
51721
|
+
pageHistoryRef.current = [];
|
|
51722
|
+
}, [activeTabId]);
|
|
51723
|
+
|
|
51700
51724
|
// Wrapper that records history before switching pages.
|
|
51701
51725
|
// Pass recordHistory=false to switch without recording (e.g. for goBack).
|
|
51702
51726
|
var navigateToPage = React.useCallback(function (pageId) {
|