publ-echo-test 0.0.32 → 0.0.34

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.
@@ -54,9 +54,6 @@ var GridItem = function (_a) {
54
54
  var isCharacterChanged = mutation.type === 'characterData';
55
55
  var keepWidth = true;
56
56
  var height = isCharacterChanged ? mutation.target.parentNode.clientHeight : mutation.target.clientHeight;
57
- console.log('mutation.target.clientWidth', mutation.target.clientWidth);
58
- console.log('mutation.target.parentNode.clientWidth', mutation.target.parentNode.clientWidth);
59
- console.log('targetNode.clientWidth', targetNode.clientWidth);
60
57
  var width = targetNode.clientWidth;
61
58
  if (!isCharacterChanged && mutation.target instanceof Element) {
62
59
  var styles = getComputedStyle(mutation.target);
@@ -338,21 +335,31 @@ var GridItem = function (_a) {
338
335
  * @return {Function} Handler function.
339
336
  */
340
337
  var onResizeHandler = function (e, _a, handlerName) {
341
- var node = _a.node, size = _a.size, handle = _a.handle;
338
+ var node = _a.node, size = _a.size, handle = _a.handle, minWidth = _a.minWidth, minHeight = _a.minHeight;
342
339
  var handler = props[handlerName];
343
340
  if (!handler)
344
341
  return;
345
342
  var prevW = props.w, prevH = props.h;
346
343
  // Get new XY
347
- var _b = calcWH(getPositionParams(), size, x, y, handle, prevW, prevH), w = _b.w, h = _b.h;
344
+ var _b = calcWH(getPositionParams(), size, x, y, handle, prevW, prevH, false), w = _b.w, h = _b.h;
345
+ var tempMinH = minH;
346
+ if (minWidth) {
347
+ var _c = calcWH(getPositionParams(), __assign(__assign({}, size), { width: minWidth, height: minHeight !== null && minHeight !== void 0 ? minHeight : 0 }), x, y, handle, prevW, prevH, true), minW_1 = _c.w, newMinH = _c.h;
348
+ if (minW_1 > w) {
349
+ w = minW_1;
350
+ }
351
+ if (minH > 1) {
352
+ tempMinH = Math.max(1, newMinH);
353
+ }
354
+ }
348
355
  // minW should be at least 1
349
356
  // minW = Math.max(minW, 1);
350
357
  // maxW should be at most (cols - x)
351
358
  // maxW = Math.min(maxW, cols - x);
352
359
  w = clamp(w, minW, maxW);
353
- h = clamp(h, minH, maxH);
360
+ h = clamp(h, tempMinH, maxH);
354
361
  setResizing(handlerName === "onResizeStop" ? undefined : size);
355
- var _c = getResizableXYPosition(handle, w, h, prevW, prevH), newX = _c.newX, newY = _c.newY;
362
+ var _d = getResizableXYPosition(handle, w, h, prevW, prevH), newX = _d.newX, newY = _d.newY;
356
363
  handler(i, w, h, { e: e, node: node, size: size }, newX, newY);
357
364
  };
358
365
  var pos = calcGridItemPosition(getPositionParams(), x, y, z, w, h, {
@@ -255,6 +255,7 @@ var ReactGridLayout = function (_a) {
255
255
  var l = getLayoutItem(layout, i);
256
256
  if (!l)
257
257
  return;
258
+ console.log(l);
258
259
  setOldResizeItem(cloneLayoutItem(l));
259
260
  setOldLayout(layout);
260
261
  props.onResizeStart &&
@@ -359,6 +360,7 @@ var ReactGridLayout = function (_a) {
359
360
  l.h = h;
360
361
  l.x = x;
361
362
  l.y = y;
363
+ l.minH = h;
362
364
  }
363
365
  return l;
364
366
  }), newLayout = _a[0], l = _a[1];
@@ -161,7 +161,7 @@ var Resizable = function (_a) {
161
161
  var resizeHandler = function (handlerName, handleAxis) {
162
162
  return function (e, _a) {
163
163
  var _b, _c;
164
- var _d, _e, _f, _g, _h, _j;
164
+ var _d, _e, _f, _g, _h, _j, _k;
165
165
  var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
166
166
  if (handlerName === "onResizeStart") {
167
167
  var position = { top: (_d = props.top) !== null && _d !== void 0 ? _d : 0, left: (_e = props.left) !== null && _e !== void 0 ? _e : 0 };
@@ -210,7 +210,8 @@ var Resizable = function (_a) {
210
210
  if (axisH === "w") {
211
211
  left = left - deltaX;
212
212
  }
213
- width = width > minWidth.current ? width : minWidth.current;
213
+ // width = Math.max(width, minWidth.current);
214
+ // const isOverMin = calcWH()
214
215
  if (extendedHeightRef.current) {
215
216
  height = extendedHeightRef.current;
216
217
  handleAxis = removeNorthHandle(handleAxis);
@@ -221,7 +222,7 @@ var Resizable = function (_a) {
221
222
  var cb = typeof props[handlerName] === "function" ? props[handlerName] : null;
222
223
  var isCbSkipped = handlerName === "onResize" && !isDimensionsChanged;
223
224
  if (cb && !isCbSkipped) {
224
- cb(e, { node: node, size: { width: width, height: height, top: top, left: left }, handle: handleAxis });
225
+ cb(e, { node: node, size: { width: width, height: height, top: top, left: left }, handle: handleAxis, minWidth: minWidth.current, minHeight: (_k = extendedHeightRef.current) !== null && _k !== void 0 ? _k : 0 });
225
226
  }
226
227
  if (handlerName === "onResizeStop") {
227
228
  startPosition.current = null;
@@ -29,6 +29,8 @@ export type ResizeCallbackData = {
29
29
  left: number;
30
30
  };
31
31
  handle: ResizeHandleAxis;
32
+ minWidth?: number;
33
+ minHeight?: number;
32
34
  };
33
35
  export type ResizableDefaultProps = {
34
36
  axis: Axis;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.32",
3
+ "version": "0.0.34",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",