@trops/dash-core 0.1.327 → 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 +63 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +63 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -606,6 +606,41 @@ var DashboardApi = {
|
|
|
606
606
|
}
|
|
607
607
|
};
|
|
608
608
|
|
|
609
|
+
/**
|
|
610
|
+
* DashboardActionsApi
|
|
611
|
+
*
|
|
612
|
+
* Provides programmatic control over dashboard-level actions.
|
|
613
|
+
* Widgets can call these methods directly (not via events) to
|
|
614
|
+
* control the dashboard they are rendered in.
|
|
615
|
+
*
|
|
616
|
+
* Internally dispatches CustomEvents on `window` so the API
|
|
617
|
+
* stays decoupled from the React component tree.
|
|
618
|
+
*/
|
|
619
|
+
var DashboardActionsApi = {
|
|
620
|
+
/**
|
|
621
|
+
* Switch the active page by its internal ID.
|
|
622
|
+
* @param {string} pageId - The ID of the page to switch to
|
|
623
|
+
*/
|
|
624
|
+
switchPage: function switchPage(pageId) {
|
|
625
|
+
window.dispatchEvent(new CustomEvent("dash:switch-page", {
|
|
626
|
+
detail: {
|
|
627
|
+
pageId: pageId
|
|
628
|
+
}
|
|
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
|
+
}));
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
|
|
609
644
|
var SECURE_STORE_ENCRYPTION_CHECK = "secure-storage-encryption-check";
|
|
610
645
|
var SECURE_STORE_ENCRYPTION_CHECK_COMPLETE = "secure-storage-encryption-check-complete";
|
|
611
646
|
var SECURE_STORE_ENCRYPTION_CHECK_ERROR = "secure-storage-encryption-check-error";
|
|
@@ -1895,6 +1930,7 @@ var DashboardContext = /*#__PURE__*/React.createContext({
|
|
|
1895
1930
|
pub: DashboardPublisher,
|
|
1896
1931
|
widgetApi: buildWidgetApi(),
|
|
1897
1932
|
dashApi: null,
|
|
1933
|
+
dashboardApi: DashboardActionsApi,
|
|
1898
1934
|
providers: {}
|
|
1899
1935
|
});
|
|
1900
1936
|
|
|
@@ -2623,6 +2659,7 @@ var DashboardWrapper = function DashboardWrapper(_ref) {
|
|
|
2623
2659
|
widgetApi: widgetApi,
|
|
2624
2660
|
pub: DashboardPublisher,
|
|
2625
2661
|
dashApi: dashApi,
|
|
2662
|
+
dashboardApi: DashboardActionsApi,
|
|
2626
2663
|
credentials: credentials,
|
|
2627
2664
|
providers: providers
|
|
2628
2665
|
};
|
|
@@ -23925,7 +23962,8 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
|
|
|
23925
23962
|
publishEvent: function publishEvent(eventName, payload) {
|
|
23926
23963
|
return helpers.publishEvent(eventName, payload);
|
|
23927
23964
|
},
|
|
23928
|
-
api: w
|
|
23965
|
+
api: w,
|
|
23966
|
+
dashboardApi: DashboardActionsApi
|
|
23929
23967
|
}, params), userPrefs), {}, {
|
|
23930
23968
|
backgroundColor: bgColor,
|
|
23931
23969
|
widgetConfig: helpers.config(),
|
|
@@ -23938,6 +23976,7 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
|
|
|
23938
23976
|
return helpers.publishEvent(eventName, payload);
|
|
23939
23977
|
},
|
|
23940
23978
|
api: w,
|
|
23979
|
+
dashboardApi: DashboardActionsApi,
|
|
23941
23980
|
id: "widget-kids-".concat(widgetKey)
|
|
23942
23981
|
}, params), userPrefs), {}, {
|
|
23943
23982
|
backgroundColor: bgColor,
|
|
@@ -51486,6 +51525,28 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
51486
51525
|
_useState48 = _slicedToArray(_useState47, 2),
|
|
51487
51526
|
activePageId = _useState48[0],
|
|
51488
51527
|
setActivePageId = _useState48[1];
|
|
51528
|
+
|
|
51529
|
+
// Listen for programmatic page switches via DashboardActionsApi
|
|
51530
|
+
React.useEffect(function () {
|
|
51531
|
+
function onSwitchPage(e) {
|
|
51532
|
+
var _ref4 = e.detail || {},
|
|
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
|
+
}
|
|
51544
|
+
}
|
|
51545
|
+
window.addEventListener("dash:switch-page", onSwitchPage);
|
|
51546
|
+
return function () {
|
|
51547
|
+
return window.removeEventListener("dash:switch-page", onSwitchPage);
|
|
51548
|
+
};
|
|
51549
|
+
}, [workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages]);
|
|
51489
51550
|
var workspacePages = (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages) || [];
|
|
51490
51551
|
|
|
51491
51552
|
// Memoize sorted pages so page object references stay stable across re-renders
|
|
@@ -54882,6 +54943,7 @@ exports.DashNavbar = DashNavbar;
|
|
|
54882
54943
|
exports.DashSidebar = DashSidebar;
|
|
54883
54944
|
exports.DashTabBar = DashTabBar;
|
|
54884
54945
|
exports.Dashboard = DashboardStage;
|
|
54946
|
+
exports.DashboardActionsApi = DashboardActionsApi;
|
|
54885
54947
|
exports.DashboardApi = DashboardApi;
|
|
54886
54948
|
exports.DashboardContext = DashboardContext;
|
|
54887
54949
|
exports.DashboardFooter = DashboardFooter;
|