@trops/dash-core 0.1.145 → 0.1.147
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 +25 -25
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +102 -81
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +54 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19879,9 +19879,11 @@ function _unsupportedIterableToArray$7(r, a) { if (r) { if ("string" == typeof r
|
|
|
19879
19879
|
function _arrayLikeToArray$7(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
19880
19880
|
function ownKeys$l(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19881
19881
|
function _objectSpread$l(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$l(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$l(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19882
|
-
var
|
|
19882
|
+
var DraggableDroppableCellBody = function DraggableDroppableCellBody(_ref) {
|
|
19883
19883
|
var cellNumber = _ref.cellNumber,
|
|
19884
19884
|
gridContainerId = _ref.gridContainerId,
|
|
19885
|
+
onMoveWidgetToCell = _ref.onMoveWidgetToCell,
|
|
19886
|
+
hasSpan = _ref.hasSpan,
|
|
19885
19887
|
children = _ref.children,
|
|
19886
19888
|
padding = _ref.padding;
|
|
19887
19889
|
var _useDrag = reactDnd.useDrag(function () {
|
|
@@ -19889,7 +19891,8 @@ var DraggableCellBody = function DraggableCellBody(_ref) {
|
|
|
19889
19891
|
type: GRID_CELL_WIDGET_TYPE,
|
|
19890
19892
|
item: {
|
|
19891
19893
|
cellNumber: cellNumber,
|
|
19892
|
-
gridContainerId: gridContainerId
|
|
19894
|
+
gridContainerId: gridContainerId,
|
|
19895
|
+
hasSpan: hasSpan
|
|
19893
19896
|
},
|
|
19894
19897
|
collect: function collect(monitor) {
|
|
19895
19898
|
return {
|
|
@@ -19897,17 +19900,50 @@ var DraggableCellBody = function DraggableCellBody(_ref) {
|
|
|
19897
19900
|
};
|
|
19898
19901
|
}
|
|
19899
19902
|
};
|
|
19900
|
-
}, [cellNumber, gridContainerId]),
|
|
19903
|
+
}, [cellNumber, gridContainerId, hasSpan]),
|
|
19901
19904
|
_useDrag2 = _slicedToArray(_useDrag, 2),
|
|
19902
19905
|
isDragging = _useDrag2[0].isDragging,
|
|
19903
19906
|
drag = _useDrag2[1];
|
|
19904
|
-
|
|
19905
|
-
|
|
19906
|
-
|
|
19907
|
+
var _useDrop = reactDnd.useDrop(function () {
|
|
19908
|
+
return {
|
|
19909
|
+
accept: GRID_CELL_WIDGET_TYPE,
|
|
19910
|
+
canDrop: function canDrop(dragItem) {
|
|
19911
|
+
if (dragItem.gridContainerId !== gridContainerId) return false;
|
|
19912
|
+
if (dragItem.cellNumber === cellNumber) return false;
|
|
19913
|
+
if (dragItem.hasSpan || hasSpan) return false;
|
|
19914
|
+
return true;
|
|
19915
|
+
},
|
|
19916
|
+
drop: function drop(dragItem) {
|
|
19917
|
+
if (onMoveWidgetToCell) onMoveWidgetToCell(gridContainerId, dragItem.cellNumber, cellNumber);
|
|
19918
|
+
},
|
|
19919
|
+
collect: function collect(monitor) {
|
|
19920
|
+
return {
|
|
19921
|
+
isOver: monitor.isOver(),
|
|
19922
|
+
canDrop: monitor.canDrop()
|
|
19923
|
+
};
|
|
19924
|
+
}
|
|
19925
|
+
};
|
|
19926
|
+
}, [cellNumber, gridContainerId, onMoveWidgetToCell, hasSpan]),
|
|
19927
|
+
_useDrop2 = _slicedToArray(_useDrop, 2),
|
|
19928
|
+
_useDrop2$ = _useDrop2[0],
|
|
19929
|
+
isOver = _useDrop2$.isOver,
|
|
19930
|
+
canDrop = _useDrop2$.canDrop,
|
|
19931
|
+
drop = _useDrop2[1];
|
|
19932
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
19933
|
+
ref: function ref(node) {
|
|
19934
|
+
return drag(drop(node));
|
|
19935
|
+
},
|
|
19936
|
+
className: "flex-1 min-h-0 overflow-auto ".concat(padding, " ").concat(isDragging ? "opacity-30" : "", " ").concat(isOver && canDrop ? "ring-2 ring-blue-500 ring-inset" : ""),
|
|
19907
19937
|
style: {
|
|
19908
19938
|
cursor: "grab"
|
|
19909
19939
|
},
|
|
19910
|
-
children: children
|
|
19940
|
+
children: [children, isOver && canDrop && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
19941
|
+
className: "absolute inset-0 flex items-center justify-center bg-blue-600/30 rounded pointer-events-none",
|
|
19942
|
+
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
19943
|
+
className: "text-sm font-bold text-blue-200",
|
|
19944
|
+
children: "Swap"
|
|
19945
|
+
})
|
|
19946
|
+
})]
|
|
19911
19947
|
});
|
|
19912
19948
|
};
|
|
19913
19949
|
var DroppableEmptyCell = function DroppableEmptyCell(_ref2) {
|
|
@@ -19916,7 +19952,7 @@ var DroppableEmptyCell = function DroppableEmptyCell(_ref2) {
|
|
|
19916
19952
|
onMoveWidgetToCell = _ref2.onMoveWidgetToCell,
|
|
19917
19953
|
onDropWidgetFromSidebar = _ref2.onDropWidgetFromSidebar,
|
|
19918
19954
|
children = _ref2.children;
|
|
19919
|
-
var
|
|
19955
|
+
var _useDrop3 = reactDnd.useDrop(function () {
|
|
19920
19956
|
return {
|
|
19921
19957
|
accept: [GRID_CELL_WIDGET_TYPE, SIDEBAR_WIDGET_TYPE],
|
|
19922
19958
|
canDrop: function canDrop(dragItem, monitor) {
|
|
@@ -19940,11 +19976,11 @@ var DroppableEmptyCell = function DroppableEmptyCell(_ref2) {
|
|
|
19940
19976
|
}
|
|
19941
19977
|
};
|
|
19942
19978
|
}, [cellNumber, gridContainerId, onMoveWidgetToCell, onDropWidgetFromSidebar]),
|
|
19943
|
-
|
|
19944
|
-
|
|
19945
|
-
isOver =
|
|
19946
|
-
canDrop =
|
|
19947
|
-
drop =
|
|
19979
|
+
_useDrop4 = _slicedToArray(_useDrop3, 2),
|
|
19980
|
+
_useDrop4$ = _useDrop4[0],
|
|
19981
|
+
isOver = _useDrop4$.isOver,
|
|
19982
|
+
canDrop = _useDrop4$.canDrop,
|
|
19983
|
+
drop = _useDrop4[1];
|
|
19948
19984
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
19949
19985
|
ref: drop,
|
|
19950
19986
|
className: "flex-1 min-h-0 relative flex flex-col ".concat(isOver && canDrop ? "ring-2 ring-green-500 ring-inset bg-green-900/20" : ""),
|
|
@@ -20974,9 +21010,11 @@ var LayoutGridContainer = /*#__PURE__*/React.memo(function (_ref3) {
|
|
|
20974
21010
|
onDelete: cellComponent ? function () {
|
|
20975
21011
|
if (onClickRemove) onClickRemove(cellComponent.id);
|
|
20976
21012
|
} : undefined
|
|
20977
|
-
}), cellComponent && isWidgetResolvable(cellComponent.component) ? /*#__PURE__*/jsxRuntime.jsx(
|
|
21013
|
+
}), cellComponent && isWidgetResolvable(cellComponent.component) ? /*#__PURE__*/jsxRuntime.jsx(DraggableDroppableCellBody, {
|
|
20978
21014
|
cellNumber: cellNumber,
|
|
20979
21015
|
gridContainerId: id,
|
|
21016
|
+
onMoveWidgetToCell: onMoveWidgetToCell,
|
|
21017
|
+
hasSpan: !!(cellDef.span && (cellDef.span.row && cellDef.span.row > 1 || cellDef.span.col && cellDef.span.col > 1)),
|
|
20980
21018
|
padding: "p-3",
|
|
20981
21019
|
children: renderedWidget
|
|
20982
21020
|
}) : /*#__PURE__*/jsxRuntime.jsx(DroppableEmptyCell, {
|
|
@@ -24747,8 +24785,9 @@ var DashboardModel = /*#__PURE__*/function () {
|
|
|
24747
24785
|
var gridContainer = this.getComponentById(itemId);
|
|
24748
24786
|
var grid = gridContainer.grid;
|
|
24749
24787
|
var componentId = grid[sourceCellNumber].component;
|
|
24788
|
+
var targetComponentId = grid[targetCellNumber].component;
|
|
24750
24789
|
grid[targetCellNumber].component = componentId;
|
|
24751
|
-
grid[sourceCellNumber].component =
|
|
24790
|
+
grid[sourceCellNumber].component = targetComponentId;
|
|
24752
24791
|
this.updateLayoutItem(gridContainer);
|
|
24753
24792
|
}
|
|
24754
24793
|
}, {
|