@trops/dash-core 0.1.441 → 0.1.442
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 +117 -98
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14534,6 +14534,30 @@ function eventHandlersOf(item, getWidgetConfig) {
|
|
|
14534
14534
|
return _toConsumableArray(new Set([].concat(_toConsumableArray(inline), _toConsumableArray(fromCfg))));
|
|
14535
14535
|
}
|
|
14536
14536
|
|
|
14537
|
+
/**
|
|
14538
|
+
* Cross-dashboard isolation gate. Every layout item carries a
|
|
14539
|
+
* `dashboardId` stamp from `LayoutModel`; this helper drops items
|
|
14540
|
+
* whose stamp doesn't match the surrounding workspace's id. Closes
|
|
14541
|
+
* the loophole where a workspace tree somehow ends up holding refs
|
|
14542
|
+
* to items from another dashboard (shared array reference, stale
|
|
14543
|
+
* cache, etc.) — without this, the dashboard config modal's
|
|
14544
|
+
* Listeners / Providers / Widgets tabs surface widgets the user
|
|
14545
|
+
* isn't editing and can't actually wire to.
|
|
14546
|
+
*
|
|
14547
|
+
* Intentionally permissive: when the workspace has no id (synthetic
|
|
14548
|
+
* test workspace, in-memory sandbox) OR an item has no dashboardId
|
|
14549
|
+
* stamp (legacy pre-LayoutModel data), the item passes through.
|
|
14550
|
+
* Strict matching only applies when BOTH have ids — which is the
|
|
14551
|
+
* case in production after a full LayoutModel pass.
|
|
14552
|
+
*/
|
|
14553
|
+
function belongsToWorkspace(item, workspace) {
|
|
14554
|
+
var wsId = workspace === null || workspace === void 0 ? void 0 : workspace.id;
|
|
14555
|
+
if (wsId === undefined || wsId === null) return true;
|
|
14556
|
+
var itemDashId = item === null || item === void 0 ? void 0 : item.dashboardId;
|
|
14557
|
+
if (itemDashId === undefined || itemDashId === null) return true;
|
|
14558
|
+
return String(itemDashId) === String(wsId);
|
|
14559
|
+
}
|
|
14560
|
+
|
|
14537
14561
|
/**
|
|
14538
14562
|
* Every widget instance in the workspace that emits at least one event.
|
|
14539
14563
|
* Deduplicated by `${component}|${itemId}` — the same compound key that
|
|
@@ -14544,6 +14568,7 @@ function eventHandlersOf(item, getWidgetConfig) {
|
|
|
14544
14568
|
function getEmitters(workspace, getWidgetConfig) {
|
|
14545
14569
|
var byKey = new Map();
|
|
14546
14570
|
forEachWidget(workspace, function (item) {
|
|
14571
|
+
if (!belongsToWorkspace(item, workspace)) return;
|
|
14547
14572
|
var events = eventsOf(item, getWidgetConfig);
|
|
14548
14573
|
if (events.length === 0) return;
|
|
14549
14574
|
var key = canonicalItemKey(item);
|
|
@@ -14570,6 +14595,7 @@ function getEmitters(workspace, getWidgetConfig) {
|
|
|
14570
14595
|
function getReceivers(workspace, getWidgetConfig) {
|
|
14571
14596
|
var byKey = new Map();
|
|
14572
14597
|
forEachWidget(workspace, function (item) {
|
|
14598
|
+
if (!belongsToWorkspace(item, workspace)) return;
|
|
14573
14599
|
var handlers = eventHandlersOf(item, getWidgetConfig);
|
|
14574
14600
|
if (handlers.length === 0) return;
|
|
14575
14601
|
var key = canonicalItemKey(item);
|
|
@@ -14597,6 +14623,7 @@ function getReceivers(workspace, getWidgetConfig) {
|
|
|
14597
14623
|
function getCurrentWiring(workspace) {
|
|
14598
14624
|
var wiring = [];
|
|
14599
14625
|
forEachWidget(workspace, function (item) {
|
|
14626
|
+
if (!belongsToWorkspace(item, workspace)) return;
|
|
14600
14627
|
var receiverItemId = itemIdOf(item);
|
|
14601
14628
|
if (receiverItemId == null) return;
|
|
14602
14629
|
var listeners = item.listeners;
|
|
@@ -14657,6 +14684,7 @@ function getOrphanedListeners(workspace, getWidgetConfig) {
|
|
|
14657
14684
|
var byCompositeKey = new Map();
|
|
14658
14685
|
var byItemId = new Map();
|
|
14659
14686
|
forEachWidget(workspace, function (item) {
|
|
14687
|
+
if (!belongsToWorkspace(item, workspace)) return;
|
|
14660
14688
|
var id = itemIdOf(item);
|
|
14661
14689
|
if (id == null) return;
|
|
14662
14690
|
var meta = {
|