publ-echo-test 0.0.11 → 0.0.13
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.
@@ -171,7 +171,7 @@ var GridItem = function (_a) {
|
|
171
171
|
];
|
172
172
|
return (_jsx(Resizable, { draggableOpts: {
|
173
173
|
disabled: !isResizable,
|
174
|
-
}, className: isResizable ? undefined : "react-resizable-hide", width: position.width, height: position.height, top: position.top, left: position.left,
|
174
|
+
}, className: isResizable ? undefined : "react-resizable-hide", width: position.width, height: position.height, top: position.top, left: position.left, resizeHandles: props.resizeHandles, onResizeStop: onResizeStop, onResizeStart: onResizeStart, onResize: onResize, minConstraints: minConstraints, maxConstraints: maxConstraints, transformScale: transformScale, handle: resizeHandle, isResizing: isResizing, children: child }));
|
175
175
|
};
|
176
176
|
/**
|
177
177
|
* onDragStart event handler
|
@@ -304,6 +304,7 @@ var GridItem = function (_a) {
|
|
304
304
|
* @param {Object} callbackData an object with node and size information
|
305
305
|
*/
|
306
306
|
var onResize = function (e, callbackData) {
|
307
|
+
console.log('setting resizing true');
|
307
308
|
setIsResizing(true);
|
308
309
|
onResizeHandler(e, callbackData, "onResize");
|
309
310
|
};
|
@@ -327,6 +328,7 @@ var GridItem = function (_a) {
|
|
327
328
|
var onResizeHandler = function (e, _a, handlerName) {
|
328
329
|
var node = _a.node, size = _a.size, handle = _a.handle;
|
329
330
|
var handler = props[handlerName];
|
331
|
+
console.log(handlerName);
|
330
332
|
if (!handler)
|
331
333
|
return;
|
332
334
|
var prevW = props.w, prevH = props.h;
|
@@ -53,8 +53,11 @@ var Resizable = function (_a) {
|
|
53
53
|
var className = props.className, draggableOpts = props.draggableOpts, width = props.width, height = props.height, handle = props.handle, onResize = props.onResize, onResizeStop = props.onResizeStop, onResizeStart = props.onResizeStart, restProps = __rest(props, ["className", "draggableOpts", "width", "height", "handle", "onResize", "onResizeStop", "onResizeStart"]);
|
54
54
|
var elementRef = children.ref;
|
55
55
|
var extendedHeightRef = useRef(null);
|
56
|
+
var minWidth = useRef(0);
|
56
57
|
useEffect(function () {
|
57
58
|
if (!isResizing) {
|
59
|
+
extendedHeightRef.current = null;
|
60
|
+
minWidth.current = 0;
|
58
61
|
return;
|
59
62
|
}
|
60
63
|
if (!elementRef.current) {
|
@@ -71,6 +74,10 @@ var Resizable = function (_a) {
|
|
71
74
|
else {
|
72
75
|
extendedHeightRef.current = null;
|
73
76
|
}
|
77
|
+
var minWidthStyle = target.computedStyleMap().get('min-width');
|
78
|
+
if (typeof minWidthStyle.value === 'number') {
|
79
|
+
minWidth.current = minWidthStyle.value;
|
80
|
+
}
|
74
81
|
}, [isResizing, children]);
|
75
82
|
var resetData = function () {
|
76
83
|
lastHandleRect = slack = null;
|
@@ -201,8 +208,10 @@ var Resizable = function (_a) {
|
|
201
208
|
if (axisH === "w") {
|
202
209
|
left = left - deltaX;
|
203
210
|
}
|
211
|
+
width = width > minWidth.current ? width : minWidth.current;
|
204
212
|
if (extendedHeightRef.current) {
|
205
213
|
height = extendedHeightRef.current;
|
214
|
+
handleAxis = removeNorthHandle(handleAxis);
|
206
215
|
}
|
207
216
|
_b = checkConstraints(width, height), width = _b[0], height = _b[1];
|
208
217
|
_c = checkTopLeft(deltaX, deltaY, top, left, width, height, handleAxis), top = _c[0], left = _c[1];
|
@@ -242,4 +251,14 @@ var Resizable = function (_a) {
|
|
242
251
|
return (_createElement(DraggableCore, __assign({}, draggableOpts, { nodeRef: ref, key: "resizableHandle-".concat(handleAxis), onStop: resizeHandler("onResizeStop", handleAxis), onStart: resizeHandler("onResizeStart", handleAxis), onDrag: resizeHandler("onResize", handleAxis) }), renderResizeHandle(handleAxis, ref)));
|
243
252
|
}), true) }));
|
244
253
|
};
|
254
|
+
function removeNorthHandle(axis) {
|
255
|
+
switch (axis) {
|
256
|
+
case 'ne':
|
257
|
+
return 'e';
|
258
|
+
case 'nw':
|
259
|
+
return 'w';
|
260
|
+
default:
|
261
|
+
return axis;
|
262
|
+
}
|
263
|
+
}
|
245
264
|
export default Resizable;
|