@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.js
CHANGED
|
@@ -23963,6 +23963,7 @@ var DraggableDroppableCellBody = function DraggableDroppableCellBody(_ref) {
|
|
|
23963
23963
|
var cellNumber = _ref.cellNumber,
|
|
23964
23964
|
gridContainerId = _ref.gridContainerId,
|
|
23965
23965
|
onMoveWidgetToCell = _ref.onMoveWidgetToCell,
|
|
23966
|
+
onDropWidgetFromSidebar = _ref.onDropWidgetFromSidebar,
|
|
23966
23967
|
hasSpan = _ref.hasSpan,
|
|
23967
23968
|
children = _ref.children,
|
|
23968
23969
|
padding = _ref.padding;
|
|
@@ -23986,42 +23987,52 @@ var DraggableDroppableCellBody = function DraggableDroppableCellBody(_ref) {
|
|
|
23986
23987
|
drag = _useDrag2[1];
|
|
23987
23988
|
var _useDrop = reactDnd.useDrop(function () {
|
|
23988
23989
|
return {
|
|
23989
|
-
accept: GRID_CELL_WIDGET_TYPE,
|
|
23990
|
-
canDrop: function canDrop(dragItem) {
|
|
23990
|
+
accept: [GRID_CELL_WIDGET_TYPE, SIDEBAR_WIDGET_TYPE],
|
|
23991
|
+
canDrop: function canDrop(dragItem, monitor) {
|
|
23992
|
+
var itemType = monitor.getItemType();
|
|
23993
|
+
if (itemType === SIDEBAR_WIDGET_TYPE) return true;
|
|
23991
23994
|
if (dragItem.gridContainerId !== gridContainerId) return false;
|
|
23992
23995
|
if (dragItem.cellNumber === cellNumber) return false;
|
|
23993
23996
|
if (dragItem.hasSpan || hasSpan) return false;
|
|
23994
23997
|
return true;
|
|
23995
23998
|
},
|
|
23996
|
-
drop: function drop(dragItem) {
|
|
23997
|
-
|
|
23999
|
+
drop: function drop(dragItem, monitor) {
|
|
24000
|
+
var itemType = monitor.getItemType();
|
|
24001
|
+
if (itemType === SIDEBAR_WIDGET_TYPE) {
|
|
24002
|
+
if (onDropWidgetFromSidebar) onDropWidgetFromSidebar(gridContainerId, cellNumber, dragItem.widgetKey);
|
|
24003
|
+
} else {
|
|
24004
|
+
if (onMoveWidgetToCell) onMoveWidgetToCell(gridContainerId, dragItem.cellNumber, cellNumber);
|
|
24005
|
+
}
|
|
23998
24006
|
},
|
|
23999
24007
|
collect: function collect(monitor) {
|
|
24000
24008
|
return {
|
|
24001
24009
|
isOver: monitor.isOver(),
|
|
24002
|
-
canDrop: monitor.canDrop()
|
|
24010
|
+
canDrop: monitor.canDrop(),
|
|
24011
|
+
itemType: monitor.getItemType()
|
|
24003
24012
|
};
|
|
24004
24013
|
}
|
|
24005
24014
|
};
|
|
24006
|
-
}, [cellNumber, gridContainerId, onMoveWidgetToCell, hasSpan]),
|
|
24015
|
+
}, [cellNumber, gridContainerId, onMoveWidgetToCell, onDropWidgetFromSidebar, hasSpan]),
|
|
24007
24016
|
_useDrop2 = _slicedToArray(_useDrop, 2),
|
|
24008
24017
|
_useDrop2$ = _useDrop2[0],
|
|
24009
24018
|
isOver = _useDrop2$.isOver,
|
|
24010
24019
|
canDrop = _useDrop2$.canDrop,
|
|
24020
|
+
itemType = _useDrop2$.itemType,
|
|
24011
24021
|
drop = _useDrop2[1];
|
|
24022
|
+
var isSidebarDrop = itemType === SIDEBAR_WIDGET_TYPE;
|
|
24012
24023
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
24013
24024
|
ref: function ref(node) {
|
|
24014
24025
|
return drag(drop(node));
|
|
24015
24026
|
},
|
|
24016
|
-
className: "flex-1 min-h-0 overflow-auto ".concat(padding, " ").concat(isDragging ? "opacity-30" : "", " ").concat(isOver && canDrop ? "ring-2 ring-blue-500 ring-inset" : ""),
|
|
24027
|
+
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" : ""),
|
|
24017
24028
|
style: {
|
|
24018
24029
|
cursor: "grab"
|
|
24019
24030
|
},
|
|
24020
24031
|
children: [children, isOver && canDrop && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
24021
|
-
className: "absolute inset-0 flex items-center justify-center bg-blue-600/30 rounded pointer-events-none",
|
|
24032
|
+
className: "absolute inset-0 flex items-center justify-center ".concat(isSidebarDrop ? "bg-green-600/30" : "bg-blue-600/30", " rounded pointer-events-none"),
|
|
24022
24033
|
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
24023
|
-
className: "text-sm font-bold text-blue-200",
|
|
24024
|
-
children: "Swap"
|
|
24034
|
+
className: "text-sm font-bold ".concat(isSidebarDrop ? "text-green-200" : "text-blue-200"),
|
|
24035
|
+
children: isSidebarDrop ? "Drop here" : "Swap"
|
|
24025
24036
|
})
|
|
24026
24037
|
})]
|
|
24027
24038
|
});
|
|
@@ -25094,6 +25105,7 @@ var LayoutGridContainer = /*#__PURE__*/React.memo(function (_ref3) {
|
|
|
25094
25105
|
cellNumber: cellNumber,
|
|
25095
25106
|
gridContainerId: id,
|
|
25096
25107
|
onMoveWidgetToCell: onMoveWidgetToCell,
|
|
25108
|
+
onDropWidgetFromSidebar: onDropWidgetFromSidebar,
|
|
25097
25109
|
hasSpan: !!(cellDef.span && (cellDef.span.row && cellDef.span.row > 1 || cellDef.span.col && cellDef.span.col > 1)),
|
|
25098
25110
|
padding: "p-3",
|
|
25099
25111
|
children: renderedWidget
|
|
@@ -45194,7 +45206,7 @@ var useInstalledWidgets = function useInstalledWidgets() {
|
|
|
45194
45206
|
case 2:
|
|
45195
45207
|
list = _context.sent;
|
|
45196
45208
|
(list || []).forEach(function (w) {
|
|
45197
|
-
registryByName[w.name] = w;
|
|
45209
|
+
registryByName[w.packageId || w.name] = w;
|
|
45198
45210
|
});
|
|
45199
45211
|
case 3:
|
|
45200
45212
|
installedFromCM = Object.keys(cMap).filter(function (key) {
|
|
@@ -45362,17 +45374,32 @@ function useWidgetUpdates() {
|
|
|
45362
45374
|
if (installed.length === 0) return;
|
|
45363
45375
|
checkedRef.current = true;
|
|
45364
45376
|
setIsChecking(true);
|
|
45365
|
-
|
|
45366
|
-
|
|
45367
|
-
|
|
45368
|
-
|
|
45369
|
-
|
|
45377
|
+
|
|
45378
|
+
// Deduplicate by package — multiple widgets in the same package share one version
|
|
45379
|
+
var pkgMap = new Map();
|
|
45380
|
+
installed.forEach(function (w) {
|
|
45381
|
+
var pkgId = w.packageId || w.name;
|
|
45382
|
+
if (!pkgMap.has(pkgId)) {
|
|
45383
|
+
pkgMap.set(pkgId, {
|
|
45384
|
+
name: pkgId,
|
|
45385
|
+
version: w.version
|
|
45386
|
+
});
|
|
45387
|
+
}
|
|
45370
45388
|
});
|
|
45389
|
+
var payload = Array.from(pkgMap.values());
|
|
45371
45390
|
(_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) {
|
|
45372
45391
|
if (Array.isArray(results) && results.length > 0) {
|
|
45373
45392
|
var map = new Map();
|
|
45374
45393
|
results.forEach(function (r) {
|
|
45375
|
-
|
|
45394
|
+
// Key by package ID (from result)
|
|
45395
|
+
map.set(r.name, r);
|
|
45396
|
+
// Also key by each widget's CM key so UI can look up by widget name
|
|
45397
|
+
installed.forEach(function (w) {
|
|
45398
|
+
var pkgId = w.packageId || w.name;
|
|
45399
|
+
if (pkgId === r.name) {
|
|
45400
|
+
map.set(w.name, r);
|
|
45401
|
+
}
|
|
45402
|
+
});
|
|
45376
45403
|
});
|
|
45377
45404
|
setUpdates(map);
|
|
45378
45405
|
}
|
|
@@ -45385,7 +45412,7 @@ function useWidgetUpdates() {
|
|
|
45385
45412
|
// Update a single widget by downloading the latest version
|
|
45386
45413
|
var updateWidget = React.useCallback(/*#__PURE__*/function () {
|
|
45387
45414
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(name) {
|
|
45388
|
-
var info, resolvedUrl;
|
|
45415
|
+
var info, widget, packageId, resolvedUrl;
|
|
45389
45416
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
45390
45417
|
while (1) switch (_context.prev = _context.next) {
|
|
45391
45418
|
case 0:
|
|
@@ -45396,11 +45423,16 @@ function useWidgetUpdates() {
|
|
|
45396
45423
|
}
|
|
45397
45424
|
return _context.abrupt("return");
|
|
45398
45425
|
case 1:
|
|
45426
|
+
// Use packageId for install — name may be a CM key (widget-level)
|
|
45427
|
+
widget = installedWidgets.find(function (w) {
|
|
45428
|
+
return w.name === name;
|
|
45429
|
+
});
|
|
45430
|
+
packageId = (widget === null || widget === void 0 ? void 0 : widget.packageId) || info.name || name;
|
|
45399
45431
|
setIsUpdating(name);
|
|
45400
45432
|
_context.prev = 2;
|
|
45401
|
-
resolvedUrl = info.downloadUrl.replace(/\{version\}/g, info.latestVersion).replace(/\{name\}/g,
|
|
45433
|
+
resolvedUrl = info.downloadUrl.replace(/\{version\}/g, info.latestVersion).replace(/\{name\}/g, packageId);
|
|
45402
45434
|
_context.next = 3;
|
|
45403
|
-
return window.mainApi.widgets.install(
|
|
45435
|
+
return window.mainApi.widgets.install(packageId, resolvedUrl);
|
|
45404
45436
|
case 3:
|
|
45405
45437
|
// Remove from updates map on success
|
|
45406
45438
|
setUpdates(function (prev) {
|
|
@@ -45427,7 +45459,7 @@ function useWidgetUpdates() {
|
|
|
45427
45459
|
return function (_x) {
|
|
45428
45460
|
return _ref.apply(this, arguments);
|
|
45429
45461
|
};
|
|
45430
|
-
}(), [updates, onUpdated]);
|
|
45462
|
+
}(), [updates, onUpdated, installedWidgets]);
|
|
45431
45463
|
return {
|
|
45432
45464
|
updates: updates,
|
|
45433
45465
|
isChecking: isChecking,
|