@trops/dash-core 0.1.272 → 0.1.273
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 +22 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +22 -10
- 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
|