@trops/dash-core 0.1.329 → 0.1.330
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 +24 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -618,7 +618,7 @@ var DashboardApi = {
|
|
|
618
618
|
*/
|
|
619
619
|
var DashboardActionsApi = {
|
|
620
620
|
/**
|
|
621
|
-
* Switch the active page
|
|
621
|
+
* Switch the active page by its internal ID.
|
|
622
622
|
* @param {string} pageId - The ID of the page to switch to
|
|
623
623
|
*/
|
|
624
624
|
switchPage: function switchPage(pageId) {
|
|
@@ -627,6 +627,17 @@ var DashboardActionsApi = {
|
|
|
627
627
|
pageId: pageId
|
|
628
628
|
}
|
|
629
629
|
}));
|
|
630
|
+
},
|
|
631
|
+
/**
|
|
632
|
+
* Switch the active page by its display name.
|
|
633
|
+
* @param {string} pageName - The display name of the page (e.g. "Opp Detail")
|
|
634
|
+
*/
|
|
635
|
+
switchPageByName: function switchPageByName(pageName) {
|
|
636
|
+
window.dispatchEvent(new CustomEvent("dash:switch-page", {
|
|
637
|
+
detail: {
|
|
638
|
+
pageName: pageName
|
|
639
|
+
}
|
|
640
|
+
}));
|
|
630
641
|
}
|
|
631
642
|
};
|
|
632
643
|
|
|
@@ -51519,14 +51530,23 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
51519
51530
|
React.useEffect(function () {
|
|
51520
51531
|
function onSwitchPage(e) {
|
|
51521
51532
|
var _ref4 = e.detail || {},
|
|
51522
|
-
pageId = _ref4.pageId
|
|
51523
|
-
|
|
51533
|
+
pageId = _ref4.pageId,
|
|
51534
|
+
pageName = _ref4.pageName;
|
|
51535
|
+
if (pageId) {
|
|
51536
|
+
setActivePageId(pageId);
|
|
51537
|
+
} else if (pageName) {
|
|
51538
|
+
var pages = (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages) || [];
|
|
51539
|
+
var match = pages.find(function (p) {
|
|
51540
|
+
return p.name.toLowerCase() === pageName.toLowerCase();
|
|
51541
|
+
});
|
|
51542
|
+
if (match) setActivePageId(match.id);
|
|
51543
|
+
}
|
|
51524
51544
|
}
|
|
51525
51545
|
window.addEventListener("dash:switch-page", onSwitchPage);
|
|
51526
51546
|
return function () {
|
|
51527
51547
|
return window.removeEventListener("dash:switch-page", onSwitchPage);
|
|
51528
51548
|
};
|
|
51529
|
-
}, []);
|
|
51549
|
+
}, [workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages]);
|
|
51530
51550
|
var workspacePages = (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages) || [];
|
|
51531
51551
|
|
|
51532
51552
|
// Memoize sorted pages so page object references stay stable across re-renders
|