publ-echo-test 0.0.243 → 0.0.244

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.
@@ -13,6 +13,7 @@
13
13
  top: 0;
14
14
  left: 0;
15
15
  z-index: 1;
16
+ margin: 10px;
16
17
  }
17
18
 
18
19
  .react-grid-item.react-draggable.react-resizable {
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { GridItemProps } from './types';
3
- import { PropsWithChildren } from '../types';
1
+ import React from "react";
2
+ import { GridItemProps } from "./types";
3
+ import { PropsWithChildren } from "../types";
4
4
  declare const GridItem: ({ children, ...props }: PropsWithChildren<GridItemProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
5
5
  export default GridItem;
@@ -21,23 +21,23 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
- import React, { useEffect, useRef, useState } from 'react';
25
- import { DraggableCore } from '../Draggable';
26
- import classNames from '../../external-lib/classnames';
27
- import { calcGridColWidth, calcGridItemPosition, calcGridItemWHPx, calcWH, calcXY, clamp, resolveRowHeight, } from './utils/calculateUtils';
28
- import { perc, setTopLeft, setTransform, } from '../GridLayoutEditor/utils/renderHelpers';
29
- import { Resizable } from '../Resizable';
24
+ import React, { useEffect, useRef, useState } from "react";
25
+ import { DraggableCore } from "../Draggable";
26
+ import classNames from "../../external-lib/classnames";
27
+ import { calcGridColWidth, calcGridItemPosition, calcGridItemWHPx, calcWH, calcXY, clamp, resolveRowHeight, } from "./utils/calculateUtils";
28
+ import { perc, setTopLeft, setTransform, } from "../GridLayoutEditor/utils/renderHelpers";
29
+ import { Resizable } from "../Resizable";
30
30
  var GridItem = function (_a) {
31
31
  var _b;
32
32
  var children = _a.children, props = __rest(_a, ["children"]);
33
- var resizeHandle = props.resizeHandle, cols = props.cols, zOrder = props.zOrder, zOrderInternal = props.zOrderInternal, isDraggable = props.isDraggable, _c = props.transformScale, transformScale = _c === void 0 ? 1 : _c, isResizable = props.isResizable, useCSSTransforms = props.useCSSTransforms, className = props.className, _d = props.cancel, cancel = _d === void 0 ? '' : _d, _e = props.handle, handle = _e === void 0 ? '' : _e, x = props.x, y = props.y, z = props.z, w = props.w, h = props.h, _f = props.minH, minH = _f === void 0 ? 1 : _f, _g = props.minW, minW = _g === void 0 ? 1 : _g, _h = props.maxH, maxH = _h === void 0 ? Infinity : _h, _j = props.maxW, maxW = _j === void 0 ? Infinity : _j, i = props.i, _k = props.isHiddenVisibility, isHiddenVisibility = _k === void 0 ? false : _k, containerWidth = props.containerWidth, customColWidth = props.customColWidth, autoResize = props.autoResize;
33
+ var resizeHandle = props.resizeHandle, cols = props.cols, zOrder = props.zOrder, zOrderInternal = props.zOrderInternal, isDraggable = props.isDraggable, _c = props.transformScale, transformScale = _c === void 0 ? 1 : _c, isResizable = props.isResizable, useCSSTransforms = props.useCSSTransforms, className = props.className, _d = props.cancel, cancel = _d === void 0 ? "" : _d, _e = props.handle, handle = _e === void 0 ? "" : _e, x = props.x, y = props.y, z = props.z, w = props.w, h = props.h, _f = props.minH, minH = _f === void 0 ? 1 : _f, _g = props.minW, minW = _g === void 0 ? 1 : _g, _h = props.maxH, maxH = _h === void 0 ? Infinity : _h, _j = props.maxW, maxW = _j === void 0 ? Infinity : _j, i = props.i, _k = props.isHiddenVisibility, isHiddenVisibility = _k === void 0 ? false : _k, containerWidth = props.containerWidth, customColWidth = props.customColWidth, autoResize = props.autoResize;
34
34
  var _l = useState(), resizing = _l[0], setResizing = _l[1];
35
35
  var _m = useState(), dragging = _m[0], setDragging = _m[1];
36
36
  var _o = useState(), dragStart = _o[0], setDragStart = _o[1];
37
37
  var _p = useState(false), isDragging = _p[0], setIsDragging = _p[1];
38
38
  var _q = useState(false), isResizing = _q[0], setIsResizing = _q[1];
39
39
  var elementRef = useRef(null);
40
- var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains('react-grid-item-selected');
40
+ var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains("react-grid-item-selected");
41
41
  useEffect(function () {
42
42
  var _a;
43
43
  if (!isSelected || !autoResize) {
@@ -47,7 +47,7 @@ var GridItem = function (_a) {
47
47
  if (!targetNode || isDragging || isResizing) {
48
48
  return;
49
49
  }
50
- if (targetNode.id === 'contentslist-box') {
50
+ if (targetNode.id === "contentslist-box") {
51
51
  return;
52
52
  }
53
53
  var prevPaddingL = parseFloat(getComputedStyle(targetNode).paddingLeft);
@@ -58,7 +58,7 @@ var GridItem = function (_a) {
58
58
  var callback = function (mutationsList) {
59
59
  for (var _i = 0, mutationsList_1 = mutationsList; _i < mutationsList_1.length; _i++) {
60
60
  var mutation = mutationsList_1[_i];
61
- var isCharacterChanged = mutation.type === 'characterData';
61
+ var isCharacterChanged = mutation.type === "characterData";
62
62
  var keepWidth = true;
63
63
  var hasPaddingChanged = false;
64
64
  var height = isCharacterChanged
@@ -89,14 +89,14 @@ var GridItem = function (_a) {
89
89
  var _a = calcWH(getPositionParams(), {
90
90
  width: width,
91
91
  height: height,
92
- }, x, y, 'e', props.w, props.h, false), w_1 = _a.w, h_1 = _a.h;
92
+ }, x, y, "e", props.w, props.h, false), w_1 = _a.w, h_1 = _a.h;
93
93
  if (keepWidth) {
94
94
  w_1 = prevW;
95
95
  }
96
96
  if (prevH > h_1) {
97
97
  h_1 = prevH;
98
98
  }
99
- var _b = getResizableXYPosition('e', w_1, h_1, prevW, prevH), newX = _b.newX, newY = _b.newY;
99
+ var _b = getResizableXYPosition("e", w_1, h_1, prevW, prevH), newX = _b.newX, newY = _b.newY;
100
100
  if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
101
101
  return;
102
102
  }
@@ -112,7 +112,7 @@ var GridItem = function (_a) {
112
112
  observer.observe(targetNode, config);
113
113
  // 정리 함수에서 MutationObserver 해제
114
114
  return function () {
115
- if (targetNode.id === 'contentslist-box') {
115
+ if (targetNode.id === "contentslist-box") {
116
116
  return;
117
117
  }
118
118
  observer.disconnect();
@@ -127,7 +127,7 @@ var GridItem = function (_a) {
127
127
  if (!targetNode || isDragging || isResizing) {
128
128
  return;
129
129
  }
130
- if (targetNode.id !== 'contentslist-box') {
130
+ if (targetNode.id !== "contentslist-box") {
131
131
  return;
132
132
  }
133
133
  var prevPaddingL = parseFloat(getComputedStyle(targetNode).paddingLeft);
@@ -138,7 +138,8 @@ var GridItem = function (_a) {
138
138
  var callback = function (mutationsList) {
139
139
  for (var _i = 0, mutationsList_2 = mutationsList; _i < mutationsList_2.length; _i++) {
140
140
  var mutation = mutationsList_2[_i];
141
- var isSizeChanged = mutation.attributeName === 'data-min-width' || mutation.attributeName === 'data-min-height';
141
+ var isSizeChanged = mutation.attributeName === "data-min-width" ||
142
+ mutation.attributeName === "data-min-height";
142
143
  var keepWidth = true;
143
144
  var hasPaddingChanged = true;
144
145
  var insetTop = Number(mutation.target.dataset.insetTop);
@@ -173,14 +174,14 @@ var GridItem = function (_a) {
173
174
  var _a = calcWH(getPositionParams(), {
174
175
  width: minWidth,
175
176
  height: minHeight,
176
- }, x, y, 'e', props.w, props.h, true), w_2 = _a.w, h_2 = _a.h;
177
+ }, x, y, "e", props.w, props.h, true), w_2 = _a.w, h_2 = _a.h;
177
178
  if (keepWidth) {
178
179
  w_2 = prevW;
179
180
  }
180
181
  if (prevH > h_2) {
181
182
  h_2 = prevH;
182
183
  }
183
- var _b = getResizableXYPosition('e', w_2, h_2, prevW, prevH), newX = _b.newX, newY = _b.newY;
184
+ var _b = getResizableXYPosition("e", w_2, h_2, prevW, prevH), newX = _b.newX, newY = _b.newY;
184
185
  if (prevH === h_2 && prevW === w_2 && newX === x && newY === y) {
185
186
  return;
186
187
  }
@@ -196,7 +197,7 @@ var GridItem = function (_a) {
196
197
  observer.observe(targetNode, config);
197
198
  // 정리 함수에서 MutationObserver 해제
198
199
  return function () {
199
- if (targetNode.id !== 'contentslist-box') {
200
+ if (targetNode.id !== "contentslist-box") {
200
201
  return;
201
202
  }
202
203
  observer.disconnect();
@@ -209,24 +210,24 @@ var GridItem = function (_a) {
209
210
  }
210
211
  var targetNode = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.children[0].children[0].children[0];
211
212
  if (!targetNode || isDragging || isResizing) {
212
- console.log('cancelled 1');
213
+ console.log("cancelled 1");
213
214
  return;
214
215
  }
215
- if (targetNode.id !== 'contentslist-box') {
216
- console.log('cancelled 2');
216
+ if (targetNode.id !== "contentslist-box") {
217
+ console.log("cancelled 2");
217
218
  return;
218
219
  }
219
220
  var minWidth = Number((_c = (_b = targetNode.dataset) === null || _b === void 0 ? void 0 : _b.minWidth) !== null && _c !== void 0 ? _c : 0);
220
221
  var minHeight = Number((_e = (_d = targetNode.dataset) === null || _d === void 0 ? void 0 : _d.minHeight) !== null && _e !== void 0 ? _e : 0);
221
222
  var insetTop = Number(targetNode.dataset.insetTop);
222
223
  var insetBottom = Number(targetNode.dataset.insetBottom);
223
- console.log('ref', (_f = elementRef.current) === null || _f === void 0 ? void 0 : _f.children[0].children[0]);
224
+ console.log("ref", (_f = elementRef.current) === null || _f === void 0 ? void 0 : _f.children[0].children[0]);
224
225
  console.log(targetNode);
225
226
  var _g = calcWH(getPositionParams(), {
226
227
  width: minWidth,
227
228
  height: minHeight + insetTop + insetBottom,
228
- }, x, y, 'e', props.w, props.h, true), w = _g.w, h = _g.h;
229
- console.log('newH, newW', h, w);
229
+ }, x, y, "e", props.w, props.h, true), w = _g.w, h = _g.h;
230
+ console.log("newH, newW", h, w);
230
231
  var prevW = props.w;
231
232
  var prevH = props.h;
232
233
  if (prevW > w) {
@@ -236,10 +237,10 @@ var GridItem = function (_a) {
236
237
  h = prevH;
237
238
  }
238
239
  if (prevH === h && prevW === w) {
239
- console.log('cancelled 3');
240
+ console.log("cancelled 3");
240
241
  return;
241
242
  }
242
- console.log('call onfitToContent');
243
+ console.log("call onfitToContent");
243
244
  props.onFitToContent &&
244
245
  props.onFitToContent(i, w, h, x, y, { hasPaddingChanged: true });
245
246
  }, [isSelected]);
@@ -294,7 +295,7 @@ var GridItem = function (_a) {
294
295
  style = setTopLeft(pos);
295
296
  if (usePercentages) {
296
297
  if (containerWidth == null) {
297
- throw new Error('Container width is missing!');
298
+ throw new Error("Container width is missing!");
298
299
  }
299
300
  style.left = perc(pos.left / containerWidth);
300
301
  style.width = perc(pos.width / containerWidth);
@@ -308,7 +309,7 @@ var GridItem = function (_a) {
308
309
  * @return {Element} Child wrapped in Draggable.
309
310
  */
310
311
  var mixinDraggable = function (child, isDraggable) {
311
- return (_jsx(DraggableCore, { disabled: !isDraggable, onStart: onDragStart, onDrag: onDrag, onStop: onDragStop, handle: handle, cancel: '.react-resizable-handle' + (cancel ? ',' + cancel : ''), scale: transformScale, nodeRef: elementRef, children: child }));
312
+ return (_jsx(DraggableCore, { disabled: !isDraggable, onStart: onDragStart, onDrag: onDrag, onStop: onDragStop, handle: handle, cancel: ".react-resizable-handle" + (cancel ? "," + cancel : ""), scale: transformScale, nodeRef: elementRef, children: child }));
312
313
  };
313
314
  /**
314
315
  * Mix a Resizable instance into a child.
@@ -335,7 +336,7 @@ var GridItem = function (_a) {
335
336
  ];
336
337
  return (_jsx(Resizable, { draggableOpts: {
337
338
  disabled: !isResizable,
338
- }, 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, autoResize: autoResize, colWidth: colWidth, margin: props.margin, children: child }));
339
+ }, 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, autoResize: autoResize, colWidth: colWidth, margin: props.margin, children: child }));
339
340
  };
340
341
  /**
341
342
  * onDragStart event handler
@@ -370,7 +371,7 @@ var GridItem = function (_a) {
370
371
  var onDrag = function (e, _a) {
371
372
  var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
372
373
  if (!dragging) {
373
- throw new Error('onDrag called before onDragStart.');
374
+ throw new Error("onDrag called before onDragStart.");
374
375
  }
375
376
  setIsDragging(true);
376
377
  var top = dragging.top + deltaY;
@@ -403,7 +404,7 @@ var GridItem = function (_a) {
403
404
  var onDragStop = function (e, _a) {
404
405
  var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
405
406
  if (!dragging) {
406
- throw new Error('onDragEnd called before onDragStart.');
407
+ throw new Error("onDragEnd called before onDragStart.");
407
408
  }
408
409
  var w = props.w, h = props.h, i = props.i;
409
410
  var left = dragging.left, top = dragging.top;
@@ -419,7 +420,7 @@ var GridItem = function (_a) {
419
420
  var getResizableXYPosition = function (handle, width, height, prevW, prevH) {
420
421
  var newX = x;
421
422
  var newY = y;
422
- if (handle === 'nw') {
423
+ if (handle === "nw") {
423
424
  // NOTE - nw left(X)와 top(Y) 둘다 변경
424
425
  if (width > prevW) {
425
426
  newX = x - (width - prevW);
@@ -434,7 +435,7 @@ var GridItem = function (_a) {
434
435
  newY = y + (prevH - height);
435
436
  }
436
437
  }
437
- if (handle === 'n' || handle === 'ne') {
438
+ if (handle === "n" || handle === "ne") {
438
439
  // NOTE - n, ne left(X) 고정 & top(Y) 변경
439
440
  if (height > prevH) {
440
441
  newY = y - (height - prevH);
@@ -443,7 +444,7 @@ var GridItem = function (_a) {
443
444
  newY = y + (prevH - height);
444
445
  }
445
446
  }
446
- if (handle === 'w' || handle === 'sw') {
447
+ if (handle === "w" || handle === "sw") {
447
448
  // NOTE - s, sw left(X) 변경 top(Y) 고정
448
449
  if (width > prevW) {
449
450
  newX = x - (width - prevW);
@@ -460,7 +461,7 @@ var GridItem = function (_a) {
460
461
  * @param {Object} callbackData an object with node and size information
461
462
  */
462
463
  var onResizeStart = function (e, callbackData) {
463
- onResizeHandler(e, callbackData, 'onResizeStart');
464
+ onResizeHandler(e, callbackData, "onResizeStart");
464
465
  };
465
466
  /**
466
467
  * onResize event handler
@@ -469,7 +470,7 @@ var GridItem = function (_a) {
469
470
  */
470
471
  var onResize = function (e, callbackData) {
471
472
  setIsResizing(true);
472
- onResizeHandler(e, callbackData, 'onResize');
473
+ onResizeHandler(e, callbackData, "onResize");
473
474
  };
474
475
  /**
475
476
  * onResizeStop event handler
@@ -478,7 +479,7 @@ var GridItem = function (_a) {
478
479
  */
479
480
  var onResizeStop = function (e, callbackData) {
480
481
  setIsResizing(false);
481
- onResizeHandler(e, callbackData, 'onResizeStop');
482
+ onResizeHandler(e, callbackData, "onResizeStop");
482
483
  };
483
484
  /**
484
485
  * Wrapper around drag events to provide more useful data.
@@ -512,7 +513,7 @@ var GridItem = function (_a) {
512
513
  // maxW = Math.min(maxW, cols - x);
513
514
  w = clamp(w, minW, maxW);
514
515
  h = clamp(h, tempMinH, maxH);
515
- setResizing(handlerName === 'onResizeStop' ? undefined : size);
516
+ setResizing(handlerName === "onResizeStop" ? undefined : size);
516
517
  var _d = getResizableXYPosition(handle, w, h, prevW, prevH), newX = _d.newX, newY = _d.newY;
517
518
  handler(i, w, h, { e: e, node: node, size: size }, newX, newY);
518
519
  };
@@ -520,22 +521,26 @@ var GridItem = function (_a) {
520
521
  dragging: dragging,
521
522
  resizing: resizing,
522
523
  }, colWidth);
524
+ pos.left = pos.left + 10; // Adjust for margin
525
+ pos.top = pos.top + 10; // Adjust for margin
526
+ pos.width = pos.width - 20; // Adjust for margin
527
+ pos.height = pos.height - 20; // Adjust for margin
523
528
  var child = React.Children.only(children);
524
529
  var newChild = React.cloneElement(child, {
525
530
  key: i,
526
531
  ref: elementRef,
527
- 'data-grid-id': i,
528
- 'data-z-index': z,
529
- 'data-z-order': zOrder,
530
- 'data-z-order-internal': zOrderInternal,
531
- className: classNames('react-grid-item', child.props.className, className, {
532
+ "data-grid-id": i,
533
+ "data-z-index": z,
534
+ "data-z-order": zOrder,
535
+ "data-z-order-internal": zOrderInternal,
536
+ className: classNames("react-grid-item", child.props.className, className, {
532
537
  static: props.static,
533
538
  isResizing: Boolean(resizing) && Boolean(isResizing) && Boolean(isHiddenVisibility),
534
539
  resizing: Boolean(resizing),
535
- 'react-draggable': isDraggable,
536
- 'editable-grid-item': isResizable && isDraggable,
540
+ "react-draggable": isDraggable,
541
+ "editable-grid-item": isResizable && isDraggable,
537
542
  isDragging: Boolean(isDragging) && Boolean(dragging) && Boolean(isHiddenVisibility),
538
- 'react-draggable-dragging': Boolean(dragging),
543
+ "react-draggable-dragging": Boolean(dragging),
539
544
  // dropping: Boolean(droppingPosition),
540
545
  cssTransforms: useCSSTransforms,
541
546
  }),
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { PropsWithChildren } from '../Draggable/types';
3
- import { ResizableProps } from './types';
1
+ import React from "react";
2
+ import { PropsWithChildren } from "../Draggable/types";
3
+ import { ResizableProps } from "./types";
4
4
  type Props = ResizableProps;
5
5
  declare const Resizable: ({ children, axis, handleSize, lockAspectRatio, minConstraints, maxConstraints, resizeHandles, transformScale, isResizing, autoResize, colWidth, margin, ...props }: PropsWithChildren<Props>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
6
6
  export default Resizable;
@@ -31,12 +31,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
31
31
  };
32
32
  import { createElement as _createElement } from "react";
33
33
  import { jsx as _jsx } from "react/jsx-runtime";
34
- import React, { useEffect, useRef, } from 'react';
35
- import { cloneElement } from './utils/cloneElement';
36
- import { DraggableCore } from '../Draggable';
37
- import classNames from '../../external-lib/classnames';
34
+ import React, { useEffect, useRef, } from "react";
35
+ import { cloneElement } from "./utils/cloneElement";
36
+ import { DraggableCore } from "../Draggable";
37
+ import classNames from "../../external-lib/classnames";
38
38
  var Resizable = function (_a) {
39
- var children = _a.children, _b = _a.axis, axis = _b === void 0 ? 'both' : _b, _c = _a.handleSize, handleSize = _c === void 0 ? [20, 20] : _c, _d = _a.lockAspectRatio, lockAspectRatio = _d === void 0 ? false : _d, _e = _a.minConstraints, minConstraints = _e === void 0 ? [20, 20] : _e, _f = _a.maxConstraints, maxConstraints = _f === void 0 ? [Infinity, Infinity] : _f, _g = _a.resizeHandles, resizeHandles = _g === void 0 ? ['se'] : _g, _h = _a.transformScale, transformScale = _h === void 0 ? 1 : _h, isResizing = _a.isResizing, autoResize = _a.autoResize, colWidth = _a.colWidth, margin = _a.margin, props = __rest(_a, ["children", "axis", "handleSize", "lockAspectRatio", "minConstraints", "maxConstraints", "resizeHandles", "transformScale", "isResizing", "autoResize", "colWidth", "margin"]);
39
+ var children = _a.children, _b = _a.axis, axis = _b === void 0 ? "both" : _b, _c = _a.handleSize, handleSize = _c === void 0 ? [20, 20] : _c, _d = _a.lockAspectRatio, lockAspectRatio = _d === void 0 ? false : _d, _e = _a.minConstraints, minConstraints = _e === void 0 ? [20, 20] : _e, _f = _a.maxConstraints, maxConstraints = _f === void 0 ? [Infinity, Infinity] : _f, _g = _a.resizeHandles, resizeHandles = _g === void 0 ? ["se"] : _g, _h = _a.transformScale, transformScale = _h === void 0 ? 1 : _h, isResizing = _a.isResizing, autoResize = _a.autoResize, colWidth = _a.colWidth, margin = _a.margin, props = __rest(_a, ["children", "axis", "handleSize", "lockAspectRatio", "minConstraints", "maxConstraints", "resizeHandles", "transformScale", "isResizing", "autoResize", "colWidth", "margin"]);
40
40
  var handleRefs = useRef({
41
41
  s: useRef(null),
42
42
  n: useRef(null),
@@ -71,13 +71,13 @@ var Resizable = function (_a) {
71
71
  if (!elementRef.current) {
72
72
  return;
73
73
  }
74
- var placeholder = document.querySelector('.placeholder');
74
+ var placeholder = document.querySelector(".placeholder");
75
75
  if (!placeholder) {
76
76
  return;
77
77
  }
78
78
  var target = (_a = placeholder.children[0].children[0].children[0]) !== null && _a !== void 0 ? _a : placeholder.children[0].children[0];
79
- var oneComposition = target.querySelector('.composition-container');
80
- var isContentsList = target.id === 'contentslist-box';
79
+ var oneComposition = target.querySelector(".composition-container");
80
+ var isContentsList = target.id === "contentslist-box";
81
81
  if (isContentsList && !oneComposition) {
82
82
  return;
83
83
  }
@@ -85,19 +85,20 @@ var Resizable = function (_a) {
85
85
  minHeight.current = target.clientHeight;
86
86
  }
87
87
  if (isContentsList && oneComposition) {
88
+ console.log("in1");
88
89
  // NOTE: 이건 좀 확인 필요. 근데 지금스팩엔 이게 맞아보임 (gap때문)
89
90
  var minCellWidth = 10;
90
- var minCollHeight = 11;
91
- var numberOfItems = Number(target.getAttribute('data-number-of-items'));
92
- var numberOfColumns = Number(target.getAttribute('data-number-of-columns'));
93
- var rowGap = Number(target.getAttribute('data-row-gap'));
94
- var columnGap = Number(target.getAttribute('data-column-gap'));
95
- var insetTop = Number(target.getAttribute('data-inset-top'));
96
- var insetBottom = Number(target.getAttribute('data-inset-bottom'));
97
- var compositionCols = Number(oneComposition.getAttribute('data-cols'));
98
- var compositionRows = Number(oneComposition.getAttribute('data-rows'));
99
- var oneCompositionMinWidth = minCellWidth * compositionCols + 20 /* 20px padding */;
100
- var oneCompositionMinHeight = minCollHeight * compositionRows + 20 /* 20px padding */;
91
+ var minColHeight = 11;
92
+ var numberOfItems = Number(target.getAttribute("data-number-of-items"));
93
+ var numberOfColumns = Number(target.getAttribute("data-number-of-columns"));
94
+ var rowGap = Number(target.getAttribute("data-row-gap"));
95
+ var columnGap = Number(target.getAttribute("data-column-gap"));
96
+ var insetTop = Number(target.getAttribute("data-inset-top"));
97
+ var insetBottom = Number(target.getAttribute("data-inset-bottom"));
98
+ var compositionCols = Number(oneComposition.getAttribute("data-cols"));
99
+ var compositionRows = Number(oneComposition.getAttribute("data-rows"));
100
+ var oneCompositionMinWidth = minCellWidth * compositionCols + 20; /* 20px padding */
101
+ var oneCompositionMinHeight = minColHeight * compositionRows + 20; /* 20px padding */
101
102
  var styles = getComputedStyle(target);
102
103
  var paddingL = parseFloat(styles.paddingLeft);
103
104
  var paddingR = parseFloat(styles.paddingRight);
@@ -105,11 +106,18 @@ var Resizable = function (_a) {
105
106
  var paddingB = parseFloat(styles.paddingBottom);
106
107
  var paddingLR = paddingL + paddingR;
107
108
  var paddingTB = paddingT + paddingB;
108
- var listMinWidth = oneCompositionMinWidth * numberOfColumns + (numberOfColumns - 1) * columnGap + paddingLR;
109
+ var listMinWidth = oneCompositionMinWidth * numberOfColumns +
110
+ (numberOfColumns - 1) * columnGap +
111
+ paddingLR;
109
112
  var numberOfRows = Math.ceil(numberOfItems / numberOfColumns);
110
- var listMinHeight = oneCompositionMinHeight * numberOfRows + (numberOfRows - 1) * rowGap + paddingTB + insetTop + insetBottom;
113
+ var listMinHeight = oneCompositionMinHeight * numberOfRows +
114
+ (numberOfRows - 1) * rowGap +
115
+ paddingTB +
116
+ insetTop +
117
+ insetBottom;
111
118
  minWidth.current = listMinWidth;
112
119
  minHeight.current = listMinHeight;
120
+ console.log(minWidth.current, minHeight.current);
113
121
  return;
114
122
  }
115
123
  // target.clientHeight -> 실제 "노드"의 height. (gridItem아닌)
@@ -124,8 +132,8 @@ var Resizable = function (_a) {
124
132
  target.clientHeight < elementRef.current.clientHeight) {
125
133
  minHeight.current = target.clientHeight;
126
134
  }
127
- var minWidthStyle = target.computedStyleMap().get('min-width');
128
- if (typeof minWidthStyle.value === 'number' && margin && colWidth) {
135
+ var minWidthStyle = target.computedStyleMap().get("min-width");
136
+ if (typeof minWidthStyle.value === "number" && margin && colWidth) {
129
137
  var minWidthBase = minWidthStyle.value;
130
138
  var minColWidth = (minWidthBase + margin[0]) / (colWidth + margin[0]);
131
139
  var minW = Math.ceil(minColWidth);
@@ -190,28 +198,28 @@ var Resizable = function (_a) {
190
198
  var resizableLeft = startPosition.current.left + (startSize.current.width - width);
191
199
  var resizableTop = startPosition.current.top + (startSize.current.height - height);
192
200
  if (deltaX < 0) {
193
- if (handleAxis === 'nw' || handleAxis === 'w' || handleAxis === 'sw') {
201
+ if (handleAxis === "nw" || handleAxis === "w" || handleAxis === "sw") {
194
202
  if (currentSumOfLeftAndWidth > startSumOfLeftAndWidth) {
195
203
  newLeft = Math.min(left, resizableLeft);
196
204
  }
197
205
  }
198
206
  }
199
207
  if (deltaY < 0) {
200
- if (handleAxis === 'nw' || handleAxis === 'n' || handleAxis === 'ne') {
208
+ if (handleAxis === "nw" || handleAxis === "n" || handleAxis === "ne") {
201
209
  if (currentSumOfTopAndHeight > startSumOfTopAndHeight) {
202
210
  newTop = Math.min(top, resizableTop);
203
211
  }
204
212
  }
205
213
  }
206
214
  if (deltaX > 0) {
207
- if (handleAxis === 'nw' || handleAxis === 'w' || handleAxis === 'sw') {
215
+ if (handleAxis === "nw" || handleAxis === "w" || handleAxis === "sw") {
208
216
  if (width >= minConstraints[0]) {
209
217
  newLeft = Math.max(left, resizableLeft);
210
218
  }
211
219
  }
212
220
  }
213
221
  if (deltaY > 0) {
214
- if (handleAxis === 'nw' || handleAxis === 'n' || handleAxis === 'ne') {
222
+ if (handleAxis === "nw" || handleAxis === "n" || handleAxis === "ne") {
215
223
  if (height >= minConstraints[1]) {
216
224
  newTop = Math.max(top, resizableTop);
217
225
  }
@@ -224,7 +232,7 @@ var Resizable = function (_a) {
224
232
  var _b, _c;
225
233
  var _d, _e, _f, _g, _h, _j;
226
234
  var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
227
- if (handlerName === 'onResizeStart') {
235
+ if (handlerName === "onResizeStart") {
228
236
  var position = { top: (_d = props.top) !== null && _d !== void 0 ? _d : 0, left: (_e = props.left) !== null && _e !== void 0 ? _e : 0 };
229
237
  startPosition.current = position;
230
238
  startSize.current = {
@@ -233,12 +241,12 @@ var Resizable = function (_a) {
233
241
  };
234
242
  resetData();
235
243
  }
236
- var canDragX = (axis === 'both' || axis === 'x') &&
237
- handleAxis !== 'n' &&
238
- handleAxis !== 's';
239
- var canDragY = (axis === 'both' || axis === 'y') &&
240
- handleAxis !== 'e' &&
241
- handleAxis !== 'w';
244
+ var canDragX = (axis === "both" || axis === "x") &&
245
+ handleAxis !== "n" &&
246
+ handleAxis !== "s";
247
+ var canDragY = (axis === "both" || axis === "y") &&
248
+ handleAxis !== "e" &&
249
+ handleAxis !== "w";
242
250
  if (!canDragX && !canDragY)
243
251
  return;
244
252
  var axisV = handleAxis[0];
@@ -256,20 +264,20 @@ var Resizable = function (_a) {
256
264
  // }
257
265
  // }
258
266
  lastHandleRectRef.current = handleRect;
259
- if (axisH === 'w') {
267
+ if (axisH === "w") {
260
268
  deltaX = -deltaX;
261
269
  }
262
- if (axisV === 'n') {
270
+ if (axisV === "n") {
263
271
  deltaY = -deltaY;
264
272
  }
265
273
  var width = props.width + (canDragX ? deltaX / transformScale : 0);
266
274
  var height = props.height + (canDragY ? deltaY / transformScale : 0);
267
275
  var left = (_h = props === null || props === void 0 ? void 0 : props.left) !== null && _h !== void 0 ? _h : 0;
268
276
  var top = (_j = props === null || props === void 0 ? void 0 : props.top) !== null && _j !== void 0 ? _j : 0;
269
- if (axisV === 'n') {
277
+ if (axisV === "n") {
270
278
  top = top - deltaY;
271
279
  }
272
- if (axisH === 'w') {
280
+ if (axisH === "w") {
273
281
  left = left - deltaX;
274
282
  }
275
283
  _b = checkConstraints(width, height), width = _b[0], height = _b[1];
@@ -278,12 +286,12 @@ var Resizable = function (_a) {
278
286
  }
279
287
  _c = checkTopLeft(deltaX, deltaY, top, left, width, height, handleAxis), top = _c[0], left = _c[1];
280
288
  var isDimensionsChanged = width !== props.width || height !== props.height;
281
- var cb = typeof props[handlerName] === 'function' ? props[handlerName] : null;
282
- var isCbSkipped = handlerName === 'onResize' && !isDimensionsChanged;
289
+ var cb = typeof props[handlerName] === "function" ? props[handlerName] : null;
290
+ var isCbSkipped = handlerName === "onResize" && !isDimensionsChanged;
283
291
  if (cb && !isCbSkipped) {
284
292
  cb(e, { node: node, size: { width: width, height: height, top: top, left: left }, handle: handleAxis });
285
293
  }
286
- if (handlerName === 'onResizeStop') {
294
+ if (handlerName === "onResizeStop") {
287
295
  startPosition.current = null;
288
296
  startSize.current = null;
289
297
  resetData();
@@ -294,27 +302,27 @@ var Resizable = function (_a) {
294
302
  if (!handle) {
295
303
  return (_jsx("span", { className: "react-resizable-handle react-resizable-handle-".concat(handleAxis), ref: ref }));
296
304
  }
297
- if (typeof handle === 'function') {
305
+ if (typeof handle === "function") {
298
306
  return handle(handleAxis, ref);
299
307
  }
300
- var isDOMElement = typeof handle.type === 'string';
308
+ var isDOMElement = typeof handle.type === "string";
301
309
  var props = __assign({ ref: ref }, (isDOMElement ? {} : { handleAxis: handleAxis }));
302
310
  return React.cloneElement(handle, props);
303
311
  };
304
- return cloneElement(children, __assign(__assign({}, restProps), { className: classNames(className !== null && className !== void 0 ? className : 'react-resizable'), children: __spreadArray([
312
+ return cloneElement(children, __assign(__assign({}, restProps), { className: classNames(className !== null && className !== void 0 ? className : "react-resizable"), children: __spreadArray([
305
313
  // ...children.props.children,
306
314
  React.Children.map(children.props.children, function (child) { return child; })
307
315
  ], resizeHandles.map(function (handleAxis) {
308
316
  var ref = (handleRefs === null || handleRefs === void 0 ? void 0 : handleRefs.current) && handleRefs.current[handleAxis];
309
- 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)));
317
+ 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)));
310
318
  }), true) }));
311
319
  };
312
320
  function removeNorthHandle(axis) {
313
321
  switch (axis) {
314
- case 'ne':
315
- return 'e';
316
- case 'nw':
317
- return 'w';
322
+ case "ne":
323
+ return "e";
324
+ case "nw":
325
+ return "w";
318
326
  default:
319
327
  return axis;
320
328
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.243",
3
+ "version": "0.0.244",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",