@trops/dash-core 0.1.272 → 0.1.274
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/electron/index.js +1 -1
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +53 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +53 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -23945,6 +23945,7 @@ var DraggableDroppableCellBody = function DraggableDroppableCellBody(_ref) {
|
|
|
23945
23945
|
var cellNumber = _ref.cellNumber,
|
|
23946
23946
|
gridContainerId = _ref.gridContainerId,
|
|
23947
23947
|
onMoveWidgetToCell = _ref.onMoveWidgetToCell,
|
|
23948
|
+
onDropWidgetFromSidebar = _ref.onDropWidgetFromSidebar,
|
|
23948
23949
|
hasSpan = _ref.hasSpan,
|
|
23949
23950
|
children = _ref.children,
|
|
23950
23951
|
padding = _ref.padding;
|
|
@@ -23968,42 +23969,52 @@ var DraggableDroppableCellBody = function DraggableDroppableCellBody(_ref) {
|
|
|
23968
23969
|
drag = _useDrag2[1];
|
|
23969
23970
|
var _useDrop = useDrop(function () {
|
|
23970
23971
|
return {
|
|
23971
|
-
accept: GRID_CELL_WIDGET_TYPE,
|
|
23972
|
-
canDrop: function canDrop(dragItem) {
|
|
23972
|
+
accept: [GRID_CELL_WIDGET_TYPE, SIDEBAR_WIDGET_TYPE],
|
|
23973
|
+
canDrop: function canDrop(dragItem, monitor) {
|
|
23974
|
+
var itemType = monitor.getItemType();
|
|
23975
|
+
if (itemType === SIDEBAR_WIDGET_TYPE) return true;
|
|
23973
23976
|
if (dragItem.gridContainerId !== gridContainerId) return false;
|
|
23974
23977
|
if (dragItem.cellNumber === cellNumber) return false;
|
|
23975
23978
|
if (dragItem.hasSpan || hasSpan) return false;
|
|
23976
23979
|
return true;
|
|
23977
23980
|
},
|
|
23978
|
-
drop: function drop(dragItem) {
|
|
23979
|
-
|
|
23981
|
+
drop: function drop(dragItem, monitor) {
|
|
23982
|
+
var itemType = monitor.getItemType();
|
|
23983
|
+
if (itemType === SIDEBAR_WIDGET_TYPE) {
|
|
23984
|
+
if (onDropWidgetFromSidebar) onDropWidgetFromSidebar(gridContainerId, cellNumber, dragItem.widgetKey);
|
|
23985
|
+
} else {
|
|
23986
|
+
if (onMoveWidgetToCell) onMoveWidgetToCell(gridContainerId, dragItem.cellNumber, cellNumber);
|
|
23987
|
+
}
|
|
23980
23988
|
},
|
|
23981
23989
|
collect: function collect(monitor) {
|
|
23982
23990
|
return {
|
|
23983
23991
|
isOver: monitor.isOver(),
|
|
23984
|
-
canDrop: monitor.canDrop()
|
|
23992
|
+
canDrop: monitor.canDrop(),
|
|
23993
|
+
itemType: monitor.getItemType()
|
|
23985
23994
|
};
|
|
23986
23995
|
}
|
|
23987
23996
|
};
|
|
23988
|
-
}, [cellNumber, gridContainerId, onMoveWidgetToCell, hasSpan]),
|
|
23997
|
+
}, [cellNumber, gridContainerId, onMoveWidgetToCell, onDropWidgetFromSidebar, hasSpan]),
|
|
23989
23998
|
_useDrop2 = _slicedToArray(_useDrop, 2),
|
|
23990
23999
|
_useDrop2$ = _useDrop2[0],
|
|
23991
24000
|
isOver = _useDrop2$.isOver,
|
|
23992
24001
|
canDrop = _useDrop2$.canDrop,
|
|
24002
|
+
itemType = _useDrop2$.itemType,
|
|
23993
24003
|
drop = _useDrop2[1];
|
|
24004
|
+
var isSidebarDrop = itemType === SIDEBAR_WIDGET_TYPE;
|
|
23994
24005
|
return /*#__PURE__*/jsxs("div", {
|
|
23995
24006
|
ref: function ref(node) {
|
|
23996
24007
|
return drag(drop(node));
|
|
23997
24008
|
},
|
|
23998
|
-
className: "flex-1 min-h-0 overflow-auto ".concat(padding, " ").concat(isDragging ? "opacity-30" : "", " ").concat(isOver && canDrop ? "ring-2 ring-blue-500 ring-inset" : ""),
|
|
24009
|
+
className: "flex-1 min-h-0 overflow-auto relative ".concat(padding, " ").concat(isDragging ? "opacity-30" : "", " ").concat(isOver && canDrop ? isSidebarDrop ? "ring-2 ring-green-500 ring-inset" : "ring-2 ring-blue-500 ring-inset" : ""),
|
|
23999
24010
|
style: {
|
|
24000
24011
|
cursor: "grab"
|
|
24001
24012
|
},
|
|
24002
24013
|
children: [children, isOver && canDrop && /*#__PURE__*/jsx("div", {
|
|
24003
|
-
className: "absolute inset-0 flex items-center justify-center bg-blue-600/30 rounded pointer-events-none",
|
|
24014
|
+
className: "absolute inset-0 flex items-center justify-center ".concat(isSidebarDrop ? "bg-green-600/30" : "bg-blue-600/30", " rounded pointer-events-none"),
|
|
24004
24015
|
children: /*#__PURE__*/jsx("span", {
|
|
24005
|
-
className: "text-sm font-bold text-blue-200",
|
|
24006
|
-
children: "Swap"
|
|
24016
|
+
className: "text-sm font-bold ".concat(isSidebarDrop ? "text-green-200" : "text-blue-200"),
|
|
24017
|
+
children: isSidebarDrop ? "Drop here" : "Swap"
|
|
24007
24018
|
})
|
|
24008
24019
|
})]
|
|
24009
24020
|
});
|
|
@@ -25076,6 +25087,7 @@ var LayoutGridContainer = /*#__PURE__*/memo(function (_ref3) {
|
|
|
25076
25087
|
cellNumber: cellNumber,
|
|
25077
25088
|
gridContainerId: id,
|
|
25078
25089
|
onMoveWidgetToCell: onMoveWidgetToCell,
|
|
25090
|
+
onDropWidgetFromSidebar: onDropWidgetFromSidebar,
|
|
25079
25091
|
hasSpan: !!(cellDef.span && (cellDef.span.row && cellDef.span.row > 1 || cellDef.span.col && cellDef.span.col > 1)),
|
|
25080
25092
|
padding: "p-3",
|
|
25081
25093
|
children: renderedWidget
|
|
@@ -45176,7 +45188,7 @@ var useInstalledWidgets = function useInstalledWidgets() {
|
|
|
45176
45188
|
case 2:
|
|
45177
45189
|
list = _context.sent;
|
|
45178
45190
|
(list || []).forEach(function (w) {
|
|
45179
|
-
registryByName[w.name] = w;
|
|
45191
|
+
registryByName[w.packageId || w.name] = w;
|
|
45180
45192
|
});
|
|
45181
45193
|
case 3:
|
|
45182
45194
|
installedFromCM = Object.keys(cMap).filter(function (key) {
|
|
@@ -45344,17 +45356,32 @@ function useWidgetUpdates() {
|
|
|
45344
45356
|
if (installed.length === 0) return;
|
|
45345
45357
|
checkedRef.current = true;
|
|
45346
45358
|
setIsChecking(true);
|
|
45347
|
-
|
|
45348
|
-
|
|
45349
|
-
|
|
45350
|
-
|
|
45351
|
-
|
|
45359
|
+
|
|
45360
|
+
// Deduplicate by package — multiple widgets in the same package share one version
|
|
45361
|
+
var pkgMap = new Map();
|
|
45362
|
+
installed.forEach(function (w) {
|
|
45363
|
+
var pkgId = w.packageId || w.name;
|
|
45364
|
+
if (!pkgMap.has(pkgId)) {
|
|
45365
|
+
pkgMap.set(pkgId, {
|
|
45366
|
+
name: pkgId,
|
|
45367
|
+
version: w.version
|
|
45368
|
+
});
|
|
45369
|
+
}
|
|
45352
45370
|
});
|
|
45371
|
+
var payload = Array.from(pkgMap.values());
|
|
45353
45372
|
(_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.registry) === null || _window$mainApi === void 0 || _window$mainApi.checkUpdates(payload).then(function (results) {
|
|
45354
45373
|
if (Array.isArray(results) && results.length > 0) {
|
|
45355
45374
|
var map = new Map();
|
|
45356
45375
|
results.forEach(function (r) {
|
|
45357
|
-
|
|
45376
|
+
// Key by package ID (from result)
|
|
45377
|
+
map.set(r.name, r);
|
|
45378
|
+
// Also key by each widget's CM key so UI can look up by widget name
|
|
45379
|
+
installed.forEach(function (w) {
|
|
45380
|
+
var pkgId = w.packageId || w.name;
|
|
45381
|
+
if (pkgId === r.name) {
|
|
45382
|
+
map.set(w.name, r);
|
|
45383
|
+
}
|
|
45384
|
+
});
|
|
45358
45385
|
});
|
|
45359
45386
|
setUpdates(map);
|
|
45360
45387
|
}
|
|
@@ -45367,7 +45394,7 @@ function useWidgetUpdates() {
|
|
|
45367
45394
|
// Update a single widget by downloading the latest version
|
|
45368
45395
|
var updateWidget = useCallback(/*#__PURE__*/function () {
|
|
45369
45396
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(name) {
|
|
45370
|
-
var info, resolvedUrl;
|
|
45397
|
+
var info, widget, packageId, resolvedUrl;
|
|
45371
45398
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
45372
45399
|
while (1) switch (_context.prev = _context.next) {
|
|
45373
45400
|
case 0:
|
|
@@ -45378,11 +45405,16 @@ function useWidgetUpdates() {
|
|
|
45378
45405
|
}
|
|
45379
45406
|
return _context.abrupt("return");
|
|
45380
45407
|
case 1:
|
|
45408
|
+
// Use packageId for install — name may be a CM key (widget-level)
|
|
45409
|
+
widget = installedWidgets.find(function (w) {
|
|
45410
|
+
return w.name === name;
|
|
45411
|
+
});
|
|
45412
|
+
packageId = (widget === null || widget === void 0 ? void 0 : widget.packageId) || info.name || name;
|
|
45381
45413
|
setIsUpdating(name);
|
|
45382
45414
|
_context.prev = 2;
|
|
45383
|
-
resolvedUrl = info.downloadUrl.replace(/\{version\}/g, info.latestVersion).replace(/\{name\}/g,
|
|
45415
|
+
resolvedUrl = info.downloadUrl.replace(/\{version\}/g, info.latestVersion).replace(/\{name\}/g, packageId);
|
|
45384
45416
|
_context.next = 3;
|
|
45385
|
-
return window.mainApi.widgets.install(
|
|
45417
|
+
return window.mainApi.widgets.install(packageId, resolvedUrl);
|
|
45386
45418
|
case 3:
|
|
45387
45419
|
// Remove from updates map on success
|
|
45388
45420
|
setUpdates(function (prev) {
|
|
@@ -45409,7 +45441,7 @@ function useWidgetUpdates() {
|
|
|
45409
45441
|
return function (_x) {
|
|
45410
45442
|
return _ref.apply(this, arguments);
|
|
45411
45443
|
};
|
|
45412
|
-
}(), [updates, onUpdated]);
|
|
45444
|
+
}(), [updates, onUpdated, installedWidgets]);
|
|
45413
45445
|
return {
|
|
45414
45446
|
updates: updates,
|
|
45415
45447
|
isChecking: isChecking,
|