@trops/dash-core 0.1.333 → 0.1.334

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
@@ -27351,6 +27351,21 @@ var WorkspaceModel = function WorkspaceModel(workspaceItem) {
27351
27351
  workspace.layout = "layout" in obj ? obj["layout"] : [];
27352
27352
  workspace.pages = "pages" in obj ? obj["pages"] : [];
27353
27353
  workspace.activePageId = "activePageId" in obj ? obj["activePageId"] : null;
27354
+
27355
+ // Always-pages model: every workspace must have at least one page.
27356
+ // If the source data is single-page (empty pages array but populated
27357
+ // layout), wrap the layout into pages[0] now so renderers always have
27358
+ // a page to display. Idempotent: a no-op if pages is already populated.
27359
+ if (!Array.isArray(workspace.pages) || workspace.pages.length === 0) {
27360
+ var page = {
27361
+ id: "page-".concat(workspace.id || Date.now()),
27362
+ name: workspace.name || "Page 1",
27363
+ order: 0,
27364
+ layout: workspace.layout || []
27365
+ };
27366
+ workspace.pages = [page];
27367
+ workspace.activePageId = page.id;
27368
+ }
27354
27369
  workspace.sidebarEnabled = "sidebarEnabled" in obj ? obj["sidebarEnabled"] : false;
27355
27370
  workspace.sidebarLayout = "sidebarLayout" in obj ? obj["sidebarLayout"] : [];
27356
27371
  workspace.sidebarWidth = "sidebarWidth" in obj ? obj["sidebarWidth"] : 280;