publ-echo-test 0.0.51 → 0.0.53

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.
@@ -55,7 +55,7 @@ var Resizable = function (_a) {
55
55
  var extendedHeightRef = useRef(null);
56
56
  var shouldShrinkRef = useRef(false);
57
57
  var minWidth = useRef(0);
58
- var minHeight = useRef(props.height);
58
+ var minHeight = useRef(0);
59
59
  useEffect(function () {
60
60
  var _a;
61
61
  if (!autoResize) {
@@ -87,7 +87,7 @@ var Resizable = function (_a) {
87
87
  extendedHeightRef.current = null;
88
88
  }
89
89
  if (shouldShrinkRef.current && (target.clientHeight < elementRef.current.clientHeight)) {
90
- extendedHeightRef.current = target.clientHeight;
90
+ minHeight.current = target.clientHeight;
91
91
  }
92
92
  var minWidthStyle = target.computedStyleMap().get('min-width');
93
93
  if (typeof minWidthStyle.value === 'number') {
@@ -101,7 +101,7 @@ var Resizable = function (_a) {
101
101
  // NOTE - 최소 또는 최대 제약 조건 width와 height 계산, 비율 고정 계산
102
102
  var checkConstraints = function (width, height) {
103
103
  var _a;
104
- if (!maxConstraints && !lockAspectRatio) {
104
+ if (!minConstraints && !maxConstraints && !lockAspectRatio) {
105
105
  return [width, height];
106
106
  }
107
107
  if (lockAspectRatio) {
@@ -119,19 +119,24 @@ var Resizable = function (_a) {
119
119
  var _c = (_a = slack.current) !== null && _a !== void 0 ? _a : [0, 0], slackW = _c[0], slackH = _c[1];
120
120
  width += slackW;
121
121
  height += slackH;
122
- var minConstraints = [minWidth.current, minHeight.current];
123
- // const maxConstraints = [300, 300];
124
- if (minConstraints) {
125
- width = Math.max(minConstraints[0], width);
126
- height = Math.max(minConstraints[1], height);
122
+ if (autoResize) {
123
+ width = Math.max(minWidth.current, width);
124
+ height = Math.max(minHeight.current, height);
125
+ }
126
+ else {
127
+ if (minConstraints) {
128
+ width = Math.max(minConstraints[0], width);
129
+ height = Math.max(minConstraints[1], height);
130
+ }
131
+ }
132
+ if (shouldShrinkRef.current) {
133
+ height = minHeight.current;
127
134
  }
128
135
  if (maxConstraints) {
129
136
  width = Math.min(maxConstraints[0], width);
130
137
  height = Math.min(maxConstraints[1], height);
131
138
  }
132
- console.log(oldW, width);
133
139
  slack.current = [slackW + (oldW - width), slackH + (oldH - height)];
134
- // console.log([slackW, slackH]);
135
140
  return [width, height];
136
141
  };
137
142
  var checkTopLeft = function (deltaX, deltaY, top, left, width, height, handleAxis) {
@@ -228,13 +233,8 @@ var Resizable = function (_a) {
228
233
  if (axisH === "w") {
229
234
  left = left - deltaX;
230
235
  }
231
- // width = Math.max(width, minWidth.current);
232
- // const isOverMin = calcWH()
233
- // if (minHeight.current) {
234
- // height = Math.max(minHeight.current, height);
235
- // }
236
236
  _b = checkConstraints(width, height), width = _b[0], height = _b[1];
237
- if (extendedHeightRef.current === height) {
237
+ if (autoResize && extendedHeightRef.current === height) {
238
238
  handleAxis = removeNorthHandle(handleAxis);
239
239
  }
240
240
  _c = checkTopLeft(deltaX, deltaY, top, left, width, height, handleAxis), top = _c[0], left = _c[1];
@@ -242,7 +242,6 @@ var Resizable = function (_a) {
242
242
  var cb = typeof props[handlerName] === "function" ? props[handlerName] : null;
243
243
  var isCbSkipped = handlerName === "onResize" && !isDimensionsChanged;
244
244
  if (cb && !isCbSkipped) {
245
- // cb(e, { node, size: { width, height, top, left }, handle: handleAxis, minWidth: minWidth.current, minHeight: minHeight.current ?? 0 });
246
245
  cb(e, { node: node, size: { width: width, height: height, top: top, left: left }, handle: handleAxis });
247
246
  }
248
247
  if (handlerName === "onResizeStop") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",