@trops/dash-core 0.1.327 → 0.1.329
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 +43 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +43 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -606,6 +606,30 @@ 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 in the current dashboard.
|
|
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
|
+
|
|
609
633
|
var SECURE_STORE_ENCRYPTION_CHECK = "secure-storage-encryption-check";
|
|
610
634
|
var SECURE_STORE_ENCRYPTION_CHECK_COMPLETE = "secure-storage-encryption-check-complete";
|
|
611
635
|
var SECURE_STORE_ENCRYPTION_CHECK_ERROR = "secure-storage-encryption-check-error";
|
|
@@ -1895,6 +1919,7 @@ var DashboardContext = /*#__PURE__*/React.createContext({
|
|
|
1895
1919
|
pub: DashboardPublisher,
|
|
1896
1920
|
widgetApi: buildWidgetApi(),
|
|
1897
1921
|
dashApi: null,
|
|
1922
|
+
dashboardApi: DashboardActionsApi,
|
|
1898
1923
|
providers: {}
|
|
1899
1924
|
});
|
|
1900
1925
|
|
|
@@ -2623,6 +2648,7 @@ var DashboardWrapper = function DashboardWrapper(_ref) {
|
|
|
2623
2648
|
widgetApi: widgetApi,
|
|
2624
2649
|
pub: DashboardPublisher,
|
|
2625
2650
|
dashApi: dashApi,
|
|
2651
|
+
dashboardApi: DashboardActionsApi,
|
|
2626
2652
|
credentials: credentials,
|
|
2627
2653
|
providers: providers
|
|
2628
2654
|
};
|
|
@@ -23925,7 +23951,8 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
|
|
|
23925
23951
|
publishEvent: function publishEvent(eventName, payload) {
|
|
23926
23952
|
return helpers.publishEvent(eventName, payload);
|
|
23927
23953
|
},
|
|
23928
|
-
api: w
|
|
23954
|
+
api: w,
|
|
23955
|
+
dashboardApi: DashboardActionsApi
|
|
23929
23956
|
}, params), userPrefs), {}, {
|
|
23930
23957
|
backgroundColor: bgColor,
|
|
23931
23958
|
widgetConfig: helpers.config(),
|
|
@@ -23938,6 +23965,7 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
|
|
|
23938
23965
|
return helpers.publishEvent(eventName, payload);
|
|
23939
23966
|
},
|
|
23940
23967
|
api: w,
|
|
23968
|
+
dashboardApi: DashboardActionsApi,
|
|
23941
23969
|
id: "widget-kids-".concat(widgetKey)
|
|
23942
23970
|
}, params), userPrefs), {}, {
|
|
23943
23971
|
backgroundColor: bgColor,
|
|
@@ -51486,6 +51514,19 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
|
|
|
51486
51514
|
_useState48 = _slicedToArray(_useState47, 2),
|
|
51487
51515
|
activePageId = _useState48[0],
|
|
51488
51516
|
setActivePageId = _useState48[1];
|
|
51517
|
+
|
|
51518
|
+
// Listen for programmatic page switches via DashboardActionsApi
|
|
51519
|
+
React.useEffect(function () {
|
|
51520
|
+
function onSwitchPage(e) {
|
|
51521
|
+
var _ref4 = e.detail || {},
|
|
51522
|
+
pageId = _ref4.pageId;
|
|
51523
|
+
if (pageId) setActivePageId(pageId);
|
|
51524
|
+
}
|
|
51525
|
+
window.addEventListener("dash:switch-page", onSwitchPage);
|
|
51526
|
+
return function () {
|
|
51527
|
+
return window.removeEventListener("dash:switch-page", onSwitchPage);
|
|
51528
|
+
};
|
|
51529
|
+
}, []);
|
|
51489
51530
|
var workspacePages = (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages) || [];
|
|
51490
51531
|
|
|
51491
51532
|
// Memoize sorted pages so page object references stay stable across re-renders
|
|
@@ -54882,6 +54923,7 @@ exports.DashNavbar = DashNavbar;
|
|
|
54882
54923
|
exports.DashSidebar = DashSidebar;
|
|
54883
54924
|
exports.DashTabBar = DashTabBar;
|
|
54884
54925
|
exports.Dashboard = DashboardStage;
|
|
54926
|
+
exports.DashboardActionsApi = DashboardActionsApi;
|
|
54885
54927
|
exports.DashboardApi = DashboardApi;
|
|
54886
54928
|
exports.DashboardContext = DashboardContext;
|
|
54887
54929
|
exports.DashboardFooter = DashboardFooter;
|