publ-echo-test 0.0.243 → 0.0.245

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,37 +197,32 @@ 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();
203
204
  };
204
205
  }, [autoResize, isSelected, isDragging, isResizing, props.w, props.h, x, y]);
205
206
  useEffect(function () {
206
- var _a, _b, _c, _d, _e, _f;
207
+ var _a, _b, _c, _d, _e;
207
208
  if (!isSelected || !autoResize) {
208
209
  return;
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
213
  return;
214
214
  }
215
- if (targetNode.id !== 'contentslist-box') {
216
- console.log('cancelled 2');
215
+ if (targetNode.id !== "contentslist-box") {
217
216
  return;
218
217
  }
219
218
  var minWidth = Number((_c = (_b = targetNode.dataset) === null || _b === void 0 ? void 0 : _b.minWidth) !== null && _c !== void 0 ? _c : 0);
220
219
  var minHeight = Number((_e = (_d = targetNode.dataset) === null || _d === void 0 ? void 0 : _d.minHeight) !== null && _e !== void 0 ? _e : 0);
221
220
  var insetTop = Number(targetNode.dataset.insetTop);
222
221
  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(targetNode);
225
- var _g = calcWH(getPositionParams(), {
222
+ var _f = calcWH(getPositionParams(), {
226
223
  width: minWidth,
227
224
  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);
225
+ }, x, y, "e", props.w, props.h, true), w = _f.w, h = _f.h;
230
226
  var prevW = props.w;
231
227
  var prevH = props.h;
232
228
  if (prevW > w) {
@@ -236,10 +232,9 @@ var GridItem = function (_a) {
236
232
  h = prevH;
237
233
  }
238
234
  if (prevH === h && prevW === w) {
239
- console.log('cancelled 3');
235
+ console.log("cancelled 3");
240
236
  return;
241
237
  }
242
- console.log('call onfitToContent');
243
238
  props.onFitToContent &&
244
239
  props.onFitToContent(i, w, h, x, y, { hasPaddingChanged: true });
245
240
  }, [isSelected]);
@@ -294,7 +289,7 @@ var GridItem = function (_a) {
294
289
  style = setTopLeft(pos);
295
290
  if (usePercentages) {
296
291
  if (containerWidth == null) {
297
- throw new Error('Container width is missing!');
292
+ throw new Error("Container width is missing!");
298
293
  }
299
294
  style.left = perc(pos.left / containerWidth);
300
295
  style.width = perc(pos.width / containerWidth);
@@ -308,7 +303,7 @@ var GridItem = function (_a) {
308
303
  * @return {Element} Child wrapped in Draggable.
309
304
  */
310
305
  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 }));
306
+ 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
307
  };
313
308
  /**
314
309
  * Mix a Resizable instance into a child.
@@ -335,7 +330,7 @@ var GridItem = function (_a) {
335
330
  ];
336
331
  return (_jsx(Resizable, { draggableOpts: {
337
332
  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 }));
333
+ }, 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
334
  };
340
335
  /**
341
336
  * onDragStart event handler
@@ -370,7 +365,7 @@ var GridItem = function (_a) {
370
365
  var onDrag = function (e, _a) {
371
366
  var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
372
367
  if (!dragging) {
373
- throw new Error('onDrag called before onDragStart.');
368
+ throw new Error("onDrag called before onDragStart.");
374
369
  }
375
370
  setIsDragging(true);
376
371
  var top = dragging.top + deltaY;
@@ -403,7 +398,7 @@ var GridItem = function (_a) {
403
398
  var onDragStop = function (e, _a) {
404
399
  var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
405
400
  if (!dragging) {
406
- throw new Error('onDragEnd called before onDragStart.');
401
+ throw new Error("onDragEnd called before onDragStart.");
407
402
  }
408
403
  var w = props.w, h = props.h, i = props.i;
409
404
  var left = dragging.left, top = dragging.top;
@@ -419,7 +414,7 @@ var GridItem = function (_a) {
419
414
  var getResizableXYPosition = function (handle, width, height, prevW, prevH) {
420
415
  var newX = x;
421
416
  var newY = y;
422
- if (handle === 'nw') {
417
+ if (handle === "nw") {
423
418
  // NOTE - nw left(X)와 top(Y) 둘다 변경
424
419
  if (width > prevW) {
425
420
  newX = x - (width - prevW);
@@ -434,7 +429,7 @@ var GridItem = function (_a) {
434
429
  newY = y + (prevH - height);
435
430
  }
436
431
  }
437
- if (handle === 'n' || handle === 'ne') {
432
+ if (handle === "n" || handle === "ne") {
438
433
  // NOTE - n, ne left(X) 고정 & top(Y) 변경
439
434
  if (height > prevH) {
440
435
  newY = y - (height - prevH);
@@ -443,7 +438,7 @@ var GridItem = function (_a) {
443
438
  newY = y + (prevH - height);
444
439
  }
445
440
  }
446
- if (handle === 'w' || handle === 'sw') {
441
+ if (handle === "w" || handle === "sw") {
447
442
  // NOTE - s, sw left(X) 변경 top(Y) 고정
448
443
  if (width > prevW) {
449
444
  newX = x - (width - prevW);
@@ -460,7 +455,7 @@ var GridItem = function (_a) {
460
455
  * @param {Object} callbackData an object with node and size information
461
456
  */
462
457
  var onResizeStart = function (e, callbackData) {
463
- onResizeHandler(e, callbackData, 'onResizeStart');
458
+ onResizeHandler(e, callbackData, "onResizeStart");
464
459
  };
465
460
  /**
466
461
  * onResize event handler
@@ -469,7 +464,7 @@ var GridItem = function (_a) {
469
464
  */
470
465
  var onResize = function (e, callbackData) {
471
466
  setIsResizing(true);
472
- onResizeHandler(e, callbackData, 'onResize');
467
+ onResizeHandler(e, callbackData, "onResize");
473
468
  };
474
469
  /**
475
470
  * onResizeStop event handler
@@ -478,7 +473,7 @@ var GridItem = function (_a) {
478
473
  */
479
474
  var onResizeStop = function (e, callbackData) {
480
475
  setIsResizing(false);
481
- onResizeHandler(e, callbackData, 'onResizeStop');
476
+ onResizeHandler(e, callbackData, "onResizeStop");
482
477
  };
483
478
  /**
484
479
  * Wrapper around drag events to provide more useful data.
@@ -512,7 +507,7 @@ var GridItem = function (_a) {
512
507
  // maxW = Math.min(maxW, cols - x);
513
508
  w = clamp(w, minW, maxW);
514
509
  h = clamp(h, tempMinH, maxH);
515
- setResizing(handlerName === 'onResizeStop' ? undefined : size);
510
+ setResizing(handlerName === "onResizeStop" ? undefined : size);
516
511
  var _d = getResizableXYPosition(handle, w, h, prevW, prevH), newX = _d.newX, newY = _d.newY;
517
512
  handler(i, w, h, { e: e, node: node, size: size }, newX, newY);
518
513
  };
@@ -520,22 +515,26 @@ var GridItem = function (_a) {
520
515
  dragging: dragging,
521
516
  resizing: resizing,
522
517
  }, colWidth);
518
+ pos.left = pos.left + 10; // Adjust for margin
519
+ pos.top = pos.top + 10; // Adjust for margin
520
+ pos.width = pos.width - 20; // Adjust for margin
521
+ pos.height = pos.height - 20; // Adjust for margin
523
522
  var child = React.Children.only(children);
524
523
  var newChild = React.cloneElement(child, {
525
524
  key: i,
526
525
  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, {
526
+ "data-grid-id": i,
527
+ "data-z-index": z,
528
+ "data-z-order": zOrder,
529
+ "data-z-order-internal": zOrderInternal,
530
+ className: classNames("react-grid-item", child.props.className, className, {
532
531
  static: props.static,
533
532
  isResizing: Boolean(resizing) && Boolean(isResizing) && Boolean(isHiddenVisibility),
534
533
  resizing: Boolean(resizing),
535
- 'react-draggable': isDraggable,
536
- 'editable-grid-item': isResizable && isDraggable,
534
+ "react-draggable": isDraggable,
535
+ "editable-grid-item": isResizable && isDraggable,
537
536
  isDragging: Boolean(isDragging) && Boolean(dragging) && Boolean(isHiddenVisibility),
538
- 'react-draggable-dragging': Boolean(dragging),
537
+ "react-draggable-dragging": Boolean(dragging),
539
538
  // dropping: Boolean(droppingPosition),
540
539
  cssTransforms: useCSSTransforms,
541
540
  }),
@@ -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
  }
@@ -87,30 +87,45 @@ var Resizable = function (_a) {
87
87
  if (isContentsList && oneComposition) {
88
88
  // NOTE: 이건 좀 확인 필요. 근데 지금스팩엔 이게 맞아보임 (gap때문)
89
89
  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 */;
101
- var styles = getComputedStyle(target);
102
- var paddingL = parseFloat(styles.paddingLeft);
103
- var paddingR = parseFloat(styles.paddingRight);
104
- var paddingT = parseFloat(styles.paddingTop);
105
- var paddingB = parseFloat(styles.paddingBottom);
106
- var paddingLR = paddingL + paddingR;
107
- var paddingTB = paddingT + paddingB;
108
- var listMinWidth = oneCompositionMinWidth * numberOfColumns + (numberOfColumns - 1) * columnGap + paddingLR;
109
- var numberOfRows = Math.ceil(numberOfItems / numberOfColumns);
110
- var listMinHeight = oneCompositionMinHeight * numberOfRows + (numberOfRows - 1) * rowGap + paddingTB + insetTop + insetBottom;
111
- minWidth.current = listMinWidth;
112
- minHeight.current = listMinHeight;
113
- return;
90
+ var minColHeight = 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 = minColHeight * compositionRows + 20; /* 20px padding */
101
+ var contentsWrapper = placeholder.querySelector(".cb-contentslist-wrapper");
102
+ if (contentsWrapper) {
103
+ var wrapperH = contentsWrapper.clientHeight;
104
+ var tempCompositionH = oneComposition.clientHeight;
105
+ console.log("wrapperH, tempCompositionH:", wrapperH, tempCompositionH);
106
+ if (tempCompositionH > wrapperH) {
107
+ oneCompositionMinHeight = tempCompositionH;
108
+ }
109
+ var styles = getComputedStyle(target);
110
+ var paddingL = parseFloat(styles.paddingLeft);
111
+ var paddingR = parseFloat(styles.paddingRight);
112
+ var paddingT = parseFloat(styles.paddingTop);
113
+ var paddingB = parseFloat(styles.paddingBottom);
114
+ var paddingLR = paddingL + paddingR;
115
+ var paddingTB = paddingT + paddingB;
116
+ var listMinWidth = oneCompositionMinWidth * numberOfColumns +
117
+ (numberOfColumns - 1) * columnGap +
118
+ paddingLR;
119
+ var numberOfRows = Math.ceil(numberOfItems / numberOfColumns);
120
+ var listMinHeight = oneCompositionMinHeight * numberOfRows +
121
+ (numberOfRows - 1) * rowGap +
122
+ paddingTB +
123
+ insetTop +
124
+ insetBottom;
125
+ minWidth.current = listMinWidth;
126
+ minHeight.current = listMinHeight;
127
+ return;
128
+ }
114
129
  }
115
130
  // target.clientHeight -> 실제 "노드"의 height. (gridItem아닌)
116
131
  if (target.clientHeight > elementRef.current.clientHeight) {
@@ -124,8 +139,8 @@ var Resizable = function (_a) {
124
139
  target.clientHeight < elementRef.current.clientHeight) {
125
140
  minHeight.current = target.clientHeight;
126
141
  }
127
- var minWidthStyle = target.computedStyleMap().get('min-width');
128
- if (typeof minWidthStyle.value === 'number' && margin && colWidth) {
142
+ var minWidthStyle = target.computedStyleMap().get("min-width");
143
+ if (typeof minWidthStyle.value === "number" && margin && colWidth) {
129
144
  var minWidthBase = minWidthStyle.value;
130
145
  var minColWidth = (minWidthBase + margin[0]) / (colWidth + margin[0]);
131
146
  var minW = Math.ceil(minColWidth);
@@ -190,28 +205,28 @@ var Resizable = function (_a) {
190
205
  var resizableLeft = startPosition.current.left + (startSize.current.width - width);
191
206
  var resizableTop = startPosition.current.top + (startSize.current.height - height);
192
207
  if (deltaX < 0) {
193
- if (handleAxis === 'nw' || handleAxis === 'w' || handleAxis === 'sw') {
208
+ if (handleAxis === "nw" || handleAxis === "w" || handleAxis === "sw") {
194
209
  if (currentSumOfLeftAndWidth > startSumOfLeftAndWidth) {
195
210
  newLeft = Math.min(left, resizableLeft);
196
211
  }
197
212
  }
198
213
  }
199
214
  if (deltaY < 0) {
200
- if (handleAxis === 'nw' || handleAxis === 'n' || handleAxis === 'ne') {
215
+ if (handleAxis === "nw" || handleAxis === "n" || handleAxis === "ne") {
201
216
  if (currentSumOfTopAndHeight > startSumOfTopAndHeight) {
202
217
  newTop = Math.min(top, resizableTop);
203
218
  }
204
219
  }
205
220
  }
206
221
  if (deltaX > 0) {
207
- if (handleAxis === 'nw' || handleAxis === 'w' || handleAxis === 'sw') {
222
+ if (handleAxis === "nw" || handleAxis === "w" || handleAxis === "sw") {
208
223
  if (width >= minConstraints[0]) {
209
224
  newLeft = Math.max(left, resizableLeft);
210
225
  }
211
226
  }
212
227
  }
213
228
  if (deltaY > 0) {
214
- if (handleAxis === 'nw' || handleAxis === 'n' || handleAxis === 'ne') {
229
+ if (handleAxis === "nw" || handleAxis === "n" || handleAxis === "ne") {
215
230
  if (height >= minConstraints[1]) {
216
231
  newTop = Math.max(top, resizableTop);
217
232
  }
@@ -224,7 +239,7 @@ var Resizable = function (_a) {
224
239
  var _b, _c;
225
240
  var _d, _e, _f, _g, _h, _j;
226
241
  var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
227
- if (handlerName === 'onResizeStart') {
242
+ if (handlerName === "onResizeStart") {
228
243
  var position = { top: (_d = props.top) !== null && _d !== void 0 ? _d : 0, left: (_e = props.left) !== null && _e !== void 0 ? _e : 0 };
229
244
  startPosition.current = position;
230
245
  startSize.current = {
@@ -233,12 +248,12 @@ var Resizable = function (_a) {
233
248
  };
234
249
  resetData();
235
250
  }
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';
251
+ var canDragX = (axis === "both" || axis === "x") &&
252
+ handleAxis !== "n" &&
253
+ handleAxis !== "s";
254
+ var canDragY = (axis === "both" || axis === "y") &&
255
+ handleAxis !== "e" &&
256
+ handleAxis !== "w";
242
257
  if (!canDragX && !canDragY)
243
258
  return;
244
259
  var axisV = handleAxis[0];
@@ -256,20 +271,20 @@ var Resizable = function (_a) {
256
271
  // }
257
272
  // }
258
273
  lastHandleRectRef.current = handleRect;
259
- if (axisH === 'w') {
274
+ if (axisH === "w") {
260
275
  deltaX = -deltaX;
261
276
  }
262
- if (axisV === 'n') {
277
+ if (axisV === "n") {
263
278
  deltaY = -deltaY;
264
279
  }
265
280
  var width = props.width + (canDragX ? deltaX / transformScale : 0);
266
281
  var height = props.height + (canDragY ? deltaY / transformScale : 0);
267
282
  var left = (_h = props === null || props === void 0 ? void 0 : props.left) !== null && _h !== void 0 ? _h : 0;
268
283
  var top = (_j = props === null || props === void 0 ? void 0 : props.top) !== null && _j !== void 0 ? _j : 0;
269
- if (axisV === 'n') {
284
+ if (axisV === "n") {
270
285
  top = top - deltaY;
271
286
  }
272
- if (axisH === 'w') {
287
+ if (axisH === "w") {
273
288
  left = left - deltaX;
274
289
  }
275
290
  _b = checkConstraints(width, height), width = _b[0], height = _b[1];
@@ -278,12 +293,12 @@ var Resizable = function (_a) {
278
293
  }
279
294
  _c = checkTopLeft(deltaX, deltaY, top, left, width, height, handleAxis), top = _c[0], left = _c[1];
280
295
  var isDimensionsChanged = width !== props.width || height !== props.height;
281
- var cb = typeof props[handlerName] === 'function' ? props[handlerName] : null;
282
- var isCbSkipped = handlerName === 'onResize' && !isDimensionsChanged;
296
+ var cb = typeof props[handlerName] === "function" ? props[handlerName] : null;
297
+ var isCbSkipped = handlerName === "onResize" && !isDimensionsChanged;
283
298
  if (cb && !isCbSkipped) {
284
299
  cb(e, { node: node, size: { width: width, height: height, top: top, left: left }, handle: handleAxis });
285
300
  }
286
- if (handlerName === 'onResizeStop') {
301
+ if (handlerName === "onResizeStop") {
287
302
  startPosition.current = null;
288
303
  startSize.current = null;
289
304
  resetData();
@@ -294,27 +309,27 @@ var Resizable = function (_a) {
294
309
  if (!handle) {
295
310
  return (_jsx("span", { className: "react-resizable-handle react-resizable-handle-".concat(handleAxis), ref: ref }));
296
311
  }
297
- if (typeof handle === 'function') {
312
+ if (typeof handle === "function") {
298
313
  return handle(handleAxis, ref);
299
314
  }
300
- var isDOMElement = typeof handle.type === 'string';
315
+ var isDOMElement = typeof handle.type === "string";
301
316
  var props = __assign({ ref: ref }, (isDOMElement ? {} : { handleAxis: handleAxis }));
302
317
  return React.cloneElement(handle, props);
303
318
  };
304
- return cloneElement(children, __assign(__assign({}, restProps), { className: classNames(className !== null && className !== void 0 ? className : 'react-resizable'), children: __spreadArray([
319
+ return cloneElement(children, __assign(__assign({}, restProps), { className: classNames(className !== null && className !== void 0 ? className : "react-resizable"), children: __spreadArray([
305
320
  // ...children.props.children,
306
321
  React.Children.map(children.props.children, function (child) { return child; })
307
322
  ], resizeHandles.map(function (handleAxis) {
308
323
  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)));
324
+ 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
325
  }), true) }));
311
326
  };
312
327
  function removeNorthHandle(axis) {
313
328
  switch (axis) {
314
- case 'ne':
315
- return 'e';
316
- case 'nw':
317
- return 'w';
329
+ case "ne":
330
+ return "e";
331
+ case "nw":
332
+ return "w";
318
333
  default:
319
334
  return axis;
320
335
  }
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.245",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",