publ-echo 0.0.103 → 0.0.105

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.
@@ -30,12 +30,13 @@ var DraggableCore = function (_a) {
30
30
  var _c = _a.allowAnyClick, allowAnyClick = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.enableUserSelectHack, enableUserSelectHack = _e === void 0 ? true : _e, _f = _a.onStart, onStart = _f === void 0 ? function () { } : _f, _g = _a.onDrag, onDrag = _g === void 0 ? function () { } : _g, _h = _a.onStop, onStop = _h === void 0 ? function () { } : _h, _j = _a.onMouseDown, onMouseDown = _j === void 0 ? function () { } : _j, _k = _a.scale, scale = _k === void 0 ? 1 : _k, children = _a.children, props = __rest(_a, ["allowAnyClick", "disabled", "enableUserSelectHack", "onStart", "onDrag", "onStop", "onMouseDown", "scale", "children"]);
31
31
  var draggableCoreRef = useRef(null);
32
32
  var isMounted = useRef(false);
33
- var _l = useState({
33
+ var _l = useState(false), pointerEventsNone = _l[0], setPointerEventsNone = _l[1];
34
+ var _m = useState({
34
35
  dragging: false,
35
36
  lastX: NaN,
36
37
  lastY: NaN,
37
38
  touchIdentifier: null,
38
- }), draggableCoreState = _l[0], setDraggableCoreState = _l[1];
39
+ }), draggableCoreState = _m[0], setDraggableCoreState = _m[1];
39
40
  /**
40
41
  * @when DraggableCore가 랜더링 했을 때
41
42
  * @expected 해당 DOMNode에서 Drag가 동작할 수 있도록 event를 추가합니다.
@@ -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,21 +21,22 @@ 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, 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
+ var _r = useState(false), pointerEventsNone = _r[0], setPointerEventsNone = _r[1];
39
40
  var elementRef = useRef(null);
40
41
  var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains('react-grid-item-selected');
41
42
  useEffect(function () {
@@ -58,7 +59,9 @@ var GridItem = function (_a) {
58
59
  var isCharacterChanged = mutation.type === 'characterData';
59
60
  var keepWidth = true;
60
61
  var hasPaddingChanged = false;
61
- var height = isCharacterChanged ? mutation.target.parentNode.clientHeight : mutation.target.clientHeight;
62
+ var height = isCharacterChanged
63
+ ? mutation.target.parentNode.clientHeight
64
+ : mutation.target.clientHeight;
62
65
  var width = targetNode.clientWidth;
63
66
  if (!isCharacterChanged && mutation.target instanceof Element) {
64
67
  var styles = getComputedStyle(mutation.target);
@@ -71,7 +74,10 @@ var GridItem = function (_a) {
71
74
  var paddingR = parseFloat(styles.paddingRight);
72
75
  var paddingT = parseFloat(styles.paddingTop);
73
76
  var paddingB = parseFloat(styles.paddingBottom);
74
- if (prevPaddingL !== paddingL || prevPaddingR !== paddingR || prevPaddingT !== paddingT || prevPaddingB !== paddingB) {
77
+ if (prevPaddingL !== paddingL ||
78
+ prevPaddingR !== paddingR ||
79
+ prevPaddingT !== paddingT ||
80
+ prevPaddingB !== paddingB) {
75
81
  hasPaddingChanged = true;
76
82
  keepWidth = false;
77
83
  }
@@ -92,7 +98,8 @@ var GridItem = function (_a) {
92
98
  if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
93
99
  return;
94
100
  }
95
- props.onFitToContent && props.onFitToContent(i, w_1, h_1, newX, newY, { hasPaddingChanged: hasPaddingChanged });
101
+ props.onFitToContent &&
102
+ props.onFitToContent(i, w_1, h_1, newX, newY, { hasPaddingChanged: hasPaddingChanged });
96
103
  }
97
104
  };
98
105
  // MutationObserver 인스턴스 생성
@@ -157,7 +164,7 @@ var GridItem = function (_a) {
157
164
  style = setTopLeft(pos);
158
165
  if (usePercentages) {
159
166
  if (containerWidth == null) {
160
- throw new Error("Container width is missing!");
167
+ throw new Error('Container width is missing!');
161
168
  }
162
169
  style.left = perc(pos.left / containerWidth);
163
170
  style.width = perc(pos.width / containerWidth);
@@ -171,7 +178,7 @@ var GridItem = function (_a) {
171
178
  * @return {Element} Child wrapped in Draggable.
172
179
  */
173
180
  var mixinDraggable = function (child, isDraggable) {
174
- 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 }));
181
+ 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 }));
175
182
  };
176
183
  /**
177
184
  * Mix a Resizable instance into a child.
@@ -198,7 +205,7 @@ var GridItem = function (_a) {
198
205
  ];
199
206
  return (_jsx(Resizable, { draggableOpts: {
200
207
  disabled: !isResizable,
201
- }, 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 }));
208
+ }, 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 }));
202
209
  };
203
210
  /**
204
211
  * onDragStart event handler
@@ -233,7 +240,7 @@ var GridItem = function (_a) {
233
240
  var onDrag = function (e, _a) {
234
241
  var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
235
242
  if (!dragging) {
236
- throw new Error("onDrag called before onDragStart.");
243
+ throw new Error('onDrag called before onDragStart.');
237
244
  }
238
245
  setIsDragging(true);
239
246
  var top = dragging.top + deltaY;
@@ -266,7 +273,7 @@ var GridItem = function (_a) {
266
273
  var onDragStop = function (e, _a) {
267
274
  var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
268
275
  if (!dragging) {
269
- throw new Error("onDragEnd called before onDragStart.");
276
+ throw new Error('onDragEnd called before onDragStart.');
270
277
  }
271
278
  var w = props.w, h = props.h, i = props.i;
272
279
  var left = dragging.left, top = dragging.top;
@@ -282,7 +289,7 @@ var GridItem = function (_a) {
282
289
  var getResizableXYPosition = function (handle, width, height, prevW, prevH) {
283
290
  var newX = x;
284
291
  var newY = y;
285
- if (handle === "nw") {
292
+ if (handle === 'nw') {
286
293
  // NOTE - nw left(X)와 top(Y) 둘다 변경
287
294
  if (width > prevW) {
288
295
  newX = x - (width - prevW);
@@ -297,7 +304,7 @@ var GridItem = function (_a) {
297
304
  newY = y + (prevH - height);
298
305
  }
299
306
  }
300
- if (handle === "n" || handle === "ne") {
307
+ if (handle === 'n' || handle === 'ne') {
301
308
  // NOTE - n, ne left(X) 고정 & top(Y) 변경
302
309
  if (height > prevH) {
303
310
  newY = y - (height - prevH);
@@ -306,7 +313,7 @@ var GridItem = function (_a) {
306
313
  newY = y + (prevH - height);
307
314
  }
308
315
  }
309
- if (handle === "w" || handle === "sw") {
316
+ if (handle === 'w' || handle === 'sw') {
310
317
  // NOTE - s, sw left(X) 변경 top(Y) 고정
311
318
  if (width > prevW) {
312
319
  newX = x - (width - prevW);
@@ -323,7 +330,7 @@ var GridItem = function (_a) {
323
330
  * @param {Object} callbackData an object with node and size information
324
331
  */
325
332
  var onResizeStart = function (e, callbackData) {
326
- onResizeHandler(e, callbackData, "onResizeStart");
333
+ onResizeHandler(e, callbackData, 'onResizeStart');
327
334
  };
328
335
  /**
329
336
  * onResize event handler
@@ -332,7 +339,7 @@ var GridItem = function (_a) {
332
339
  */
333
340
  var onResize = function (e, callbackData) {
334
341
  setIsResizing(true);
335
- onResizeHandler(e, callbackData, "onResize");
342
+ onResizeHandler(e, callbackData, 'onResize');
336
343
  };
337
344
  /**
338
345
  * onResizeStop event handler
@@ -341,7 +348,7 @@ var GridItem = function (_a) {
341
348
  */
342
349
  var onResizeStop = function (e, callbackData) {
343
350
  setIsResizing(false);
344
- onResizeHandler(e, callbackData, "onResizeStop");
351
+ onResizeHandler(e, callbackData, 'onResizeStop');
345
352
  };
346
353
  /**
347
354
  * Wrapper around drag events to provide more useful data.
@@ -375,7 +382,7 @@ var GridItem = function (_a) {
375
382
  // maxW = Math.min(maxW, cols - x);
376
383
  w = clamp(w, minW, maxW);
377
384
  h = clamp(h, tempMinH, maxH);
378
- setResizing(handlerName === "onResizeStop" ? undefined : size);
385
+ setResizing(handlerName === 'onResizeStop' ? undefined : size);
379
386
  var _d = getResizableXYPosition(handle, w, h, prevW, prevH), newX = _d.newX, newY = _d.newY;
380
387
  handler(i, w, h, { e: e, node: node, size: size }, newX, newY);
381
388
  };
@@ -388,13 +395,17 @@ var GridItem = function (_a) {
388
395
  key: i,
389
396
  ref: elementRef,
390
397
  'data-grid-id': i,
391
- className: classNames("react-grid-item", child.props.className, className, {
398
+ 'data-z-index': z,
399
+ 'data-z-order': zOrder,
400
+ 'data-z-order-internal': zOrderInternal,
401
+ className: classNames('react-grid-item', child.props.className, className, {
392
402
  static: props.static,
393
403
  isResizing: Boolean(resizing) && Boolean(isResizing) && Boolean(isHiddenVisibility),
394
404
  resizing: Boolean(resizing),
395
- "react-draggable": isDraggable,
405
+ 'react-draggable': isDraggable,
406
+ 'editable-grid-item': isResizable && isDraggable,
396
407
  isDragging: Boolean(isDragging) && Boolean(dragging) && Boolean(isHiddenVisibility),
397
- "react-draggable-dragging": Boolean(dragging),
408
+ 'react-draggable-dragging': Boolean(dragging),
398
409
  // dropping: Boolean(droppingPosition),
399
410
  cssTransforms: useCSSTransforms,
400
411
  }),
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { GridItemProps } from './types';
3
+ import { PropsWithChildren } from '../types';
4
+ declare const GroupItem: ({ children, ...props }: PropsWithChildren<GridItemProps & {
5
+ onContextGroup: (e: React.MouseEvent) => void;
6
+ zOrder: number;
7
+ zOrderInternal: string;
8
+ minZ?: number | undefined;
9
+ }>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
10
+ export default GroupItem;