publ-echo-test 0.0.330 → 0.0.332

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.
Files changed (76) hide show
  1. package/css/gle-styles.css +0 -1
  2. package/package.json +1 -1
  3. package/dist/external-lib/classnames/index.d.ts +0 -5
  4. package/dist/external-lib/classnames/index.js +0 -60
  5. package/dist/external-lib/lodash.isEqual/index.d.ts +0 -30
  6. package/dist/external-lib/lodash.isEqual/index.js +0 -1661
  7. package/dist/lib/Draggable/Draggable.d.ts +0 -17
  8. package/dist/lib/Draggable/Draggable.js +0 -192
  9. package/dist/lib/Draggable/DraggableCore.d.ts +0 -5
  10. package/dist/lib/Draggable/DraggableCore.js +0 -267
  11. package/dist/lib/Draggable/constants.d.ts +0 -12
  12. package/dist/lib/Draggable/constants.js +0 -12
  13. package/dist/lib/Draggable/index.d.ts +0 -2
  14. package/dist/lib/Draggable/index.js +0 -2
  15. package/dist/lib/Draggable/types.d.ts +0 -55
  16. package/dist/lib/Draggable/types.js +0 -1
  17. package/dist/lib/Draggable/utils/domHelpers.d.ts +0 -22
  18. package/dist/lib/Draggable/utils/domHelpers.js +0 -222
  19. package/dist/lib/Draggable/utils/getPrefix.d.ts +0 -5
  20. package/dist/lib/Draggable/utils/getPrefix.js +0 -41
  21. package/dist/lib/Draggable/utils/positionHelpers.d.ts +0 -7
  22. package/dist/lib/Draggable/utils/positionHelpers.js +0 -32
  23. package/dist/lib/Draggable/utils/types.d.ts +0 -30
  24. package/dist/lib/Draggable/utils/types.js +0 -1
  25. package/dist/lib/Draggable/utils/validationHelpers.d.ts +0 -4
  26. package/dist/lib/Draggable/utils/validationHelpers.js +0 -16
  27. package/dist/lib/GridItem/GridItem.d.ts +0 -5
  28. package/dist/lib/GridItem/GridItem.js +0 -633
  29. package/dist/lib/GridItem/GridItemCopy.d.ts +0 -5
  30. package/dist/lib/GridItem/GridItemCopy.js +0 -613
  31. package/dist/lib/GridItem/GroupItem.d.ts +0 -10
  32. package/dist/lib/GridItem/GroupItem.js +0 -472
  33. package/dist/lib/GridItem/OutsideClickHandler.d.ts +0 -7
  34. package/dist/lib/GridItem/OutsideClickHandler.js +0 -112
  35. package/dist/lib/GridItem/index.d.ts +0 -1
  36. package/dist/lib/GridItem/index.js +0 -1
  37. package/dist/lib/GridItem/types.d.ts +0 -112
  38. package/dist/lib/GridItem/types.js +0 -1
  39. package/dist/lib/GridItem/utils/calculateUtils.d.ts +0 -30
  40. package/dist/lib/GridItem/utils/calculateUtils.js +0 -115
  41. package/dist/lib/GridLayoutEditor/ReactGridLayout.d.ts +0 -6
  42. package/dist/lib/GridLayoutEditor/ReactGridLayout.js +0 -748
  43. package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.d.ts +0 -4
  44. package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.js +0 -117
  45. package/dist/lib/GridLayoutEditor/group.d.ts +0 -58
  46. package/dist/lib/GridLayoutEditor/group.js +0 -341
  47. package/dist/lib/GridLayoutEditor/index.d.ts +0 -3
  48. package/dist/lib/GridLayoutEditor/index.js +0 -2
  49. package/dist/lib/GridLayoutEditor/types.d.ts +0 -170
  50. package/dist/lib/GridLayoutEditor/types.js +0 -1
  51. package/dist/lib/GridLayoutEditor/utils/renderHelpers.d.ts +0 -173
  52. package/dist/lib/GridLayoutEditor/utils/renderHelpers.js +0 -607
  53. package/dist/lib/GridLayoutEditor/utils/responsiveUtils.d.ts +0 -26
  54. package/dist/lib/GridLayoutEditor/utils/responsiveUtils.js +0 -77
  55. package/dist/lib/Resizable/Resizable.d.ts +0 -6
  56. package/dist/lib/Resizable/Resizable.js +0 -385
  57. package/dist/lib/Resizable/ResizableBox.d.ts +0 -7
  58. package/dist/lib/Resizable/ResizableBox.js +0 -57
  59. package/dist/lib/Resizable/index.d.ts +0 -1
  60. package/dist/lib/Resizable/index.js +0 -1
  61. package/dist/lib/Resizable/types.d.ts +0 -69
  62. package/dist/lib/Resizable/types.js +0 -1
  63. package/dist/lib/Resizable/utils/cloneElement.d.ts +0 -2
  64. package/dist/lib/Resizable/utils/cloneElement.js +0 -21
  65. package/dist/lib/components/WidthProvider.d.ts +0 -9
  66. package/dist/lib/components/WidthProvider.js +0 -65
  67. package/dist/lib/components/index.d.ts +0 -1
  68. package/dist/lib/components/index.js +0 -1
  69. package/dist/lib/components/types.d.ts +0 -13
  70. package/dist/lib/components/types.js +0 -1
  71. package/dist/lib/index.d.ts +0 -5
  72. package/dist/lib/index.js +0 -5
  73. package/dist/lib/types.d.ts +0 -4
  74. package/dist/lib/types.js +0 -1
  75. package/dist/lib/utils/classNames.d.ts +0 -3
  76. package/dist/lib/utils/classNames.js +0 -10
@@ -1,472 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
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
- var GroupItem = function (_a) {
30
- var _b;
31
- var children = _a.children, props = __rest(_a, ["children"]);
32
- 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, minZ = props.minZ, onContextGroup = props.onContextGroup;
33
- var _l = useState(), resizing = _l[0], setResizing = _l[1];
34
- var _m = useState(), dragging = _m[0], setDragging = _m[1];
35
- var _o = useState(), dragStart = _o[0], setDragStart = _o[1];
36
- var _p = useState(false), isDragging = _p[0], setIsDragging = _p[1];
37
- var _q = useState(false), isResizing = _q[0], setIsResizing = _q[1];
38
- var elementRef = useRef(null);
39
- var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains("react-grid-item-selected");
40
- useEffect(function () {
41
- var _a;
42
- if (!isSelected || !autoResize) {
43
- return;
44
- }
45
- var targetNode = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.children[0].children[0].children[0];
46
- if (!targetNode || isDragging || isResizing) {
47
- return;
48
- }
49
- var prevPaddingL = parseFloat(getComputedStyle(targetNode).paddingLeft);
50
- var prevPaddingR = parseFloat(getComputedStyle(targetNode).paddingRight);
51
- var prevPaddingT = parseFloat(getComputedStyle(targetNode).paddingTop);
52
- var prevPaddingB = parseFloat(getComputedStyle(targetNode).paddingBottom);
53
- // MutationObserver 콜백 함수
54
- var callback = function (mutationsList) {
55
- for (var _i = 0, mutationsList_1 = mutationsList; _i < mutationsList_1.length; _i++) {
56
- var mutation = mutationsList_1[_i];
57
- var isCharacterChanged = mutation.type === "characterData";
58
- var keepWidth = true;
59
- var hasPaddingChanged = false;
60
- var height = isCharacterChanged
61
- ? mutation.target.parentNode.clientHeight
62
- : mutation.target.clientHeight;
63
- var width = targetNode.clientWidth;
64
- if (!isCharacterChanged && mutation.target instanceof Element) {
65
- var styles = getComputedStyle(mutation.target);
66
- var minWidth = parseFloat(styles.minWidth);
67
- if (minWidth > width) {
68
- keepWidth = false;
69
- }
70
- // NOTE: POC
71
- var paddingL = parseFloat(styles.paddingLeft);
72
- var paddingR = parseFloat(styles.paddingRight);
73
- var paddingT = parseFloat(styles.paddingTop);
74
- var paddingB = parseFloat(styles.paddingBottom);
75
- if (prevPaddingL !== paddingL ||
76
- prevPaddingR !== paddingR ||
77
- prevPaddingT !== paddingT ||
78
- prevPaddingB !== paddingB) {
79
- hasPaddingChanged = true;
80
- keepWidth = false;
81
- }
82
- }
83
- var prevW = props.w;
84
- var prevH = props.h;
85
- var _a = calcWH(getPositionParams(), {
86
- width: width,
87
- height: height,
88
- }, x, y, "e", props.w, props.h, false), w_1 = _a.w, h_1 = _a.h;
89
- if (keepWidth) {
90
- w_1 = prevW;
91
- }
92
- if (prevH > h_1) {
93
- h_1 = prevH;
94
- }
95
- var _b = getResizableXYPosition("e", w_1, h_1, prevW, prevH), newX = _b.newX, newY = _b.newY;
96
- if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
97
- return;
98
- }
99
- props.onFitToContent &&
100
- props.onFitToContent(i, w_1, h_1, newX, newY, { hasPaddingChanged: hasPaddingChanged });
101
- }
102
- };
103
- // MutationObserver 인스턴스 생성
104
- var observer = new MutationObserver(callback);
105
- // 관찰할 DOM 변이 설정
106
- var config = { characterData: true, attributes: true, subtree: true };
107
- // 대상 노드와 설정으로 관찰 시작
108
- observer.observe(targetNode, config);
109
- // 정리 함수에서 MutationObserver 해제
110
- return function () {
111
- observer.disconnect();
112
- };
113
- }, [autoResize, isSelected, isDragging, isResizing, props.w, props.h, x, y]);
114
- // const moveDroppingItem = (prevProps: GridItemProps) => {
115
- // const { droppingPosition } = props;
116
- // if (!droppingPosition) return;
117
- // const node = elementRef.current;
118
- // // Can't find DOM node (are we unmounted?)
119
- // if (!node) return;
120
- // const prevDroppingPosition = prevProps.droppingPosition || {
121
- // left: 0,
122
- // top: 0,
123
- // };
124
- // const shouldDrag =
125
- // (dragging && droppingPosition.left !== prevDroppingPosition.left) ||
126
- // droppingPosition.top !== prevDroppingPosition.top;
127
- // if (!dragging) {
128
- // onDragStart(droppingPosition.e, {
129
- // node,
130
- // deltaX: droppingPosition.left,
131
- // deltaY: droppingPosition.top,
132
- // });
133
- // } else if (shouldDrag) {
134
- // const deltaX = droppingPosition.left - dragging.left;
135
- // const deltaY = droppingPosition.top - dragging.top;
136
- // onDrag(droppingPosition.e, {
137
- // node,
138
- // deltaX,
139
- // deltaY,
140
- // });
141
- // }
142
- // };
143
- var getPositionParams = function (prop) {
144
- if (prop === void 0) { prop = props; }
145
- return {
146
- cols: prop.cols,
147
- containerPadding: prop.containerPadding,
148
- containerWidth: prop.containerWidth,
149
- margin: prop.margin,
150
- maxRows: prop.maxRows,
151
- rowHeight: prop.rowHeight,
152
- };
153
- };
154
- var colWidth = customColWidth !== null && customColWidth !== void 0 ? customColWidth : calcGridColWidth(getPositionParams());
155
- var createStyle = function (pos) {
156
- var usePercentages = props.usePercentages, containerWidth = props.containerWidth, useCSSTransforms = props.useCSSTransforms;
157
- var style;
158
- if (useCSSTransforms) {
159
- style = setTransform(pos);
160
- }
161
- else {
162
- style = setTopLeft(pos);
163
- if (usePercentages) {
164
- if (containerWidth == null) {
165
- throw new Error("Container width is missing!");
166
- }
167
- style.left = perc(pos.left / containerWidth);
168
- style.width = perc(pos.width / containerWidth);
169
- }
170
- }
171
- return style;
172
- };
173
- /**
174
- * Mix a Draggable instance into a child.
175
- * @param {Element} child Child element.
176
- * @return {Element} Child wrapped in Draggable.
177
- */
178
- var mixinDraggable = function (child, isDraggable) {
179
- 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 }));
180
- };
181
- // /**
182
- // * Mix a Resizable instance into a child.
183
- // * @param {Element} child Child element.
184
- // * @param {Object} position Position object (pixel values)
185
- // * @return {Element} Child wrapped in Resizable.
186
- // */
187
- // const mixinResizable = (
188
- // child: ReactElement<any>,
189
- // position: Position,
190
- // isResizable: boolean
191
- // ): ReactElement<any> => {
192
- // const positionParams = getPositionParams();
193
- // // const maxWidth = calcGridItemPosition(
194
- // // positionParams,
195
- // // x,
196
- // // y,
197
- // // z,
198
- // // cols - x, // TODO - 수정 필요
199
- // // h
200
- // // ).width;
201
- // const mins = calcGridItemPosition(positionParams, x, y, z, minW, minH);
202
- // const maxes = calcGridItemPosition(positionParams, x, y, z, maxW, maxH);
203
- // const minConstraints = [mins.width, mins.height] as [number, number];
204
- // const maxConstraints = [
205
- // Math.min(maxes.width, containerWidth),
206
- // Math.min(maxes.height, Infinity),
207
- // ] as [number, number];
208
- // return (
209
- // <Resizable
210
- // draggableOpts={{
211
- // disabled: !isResizable,
212
- // }}
213
- // className={"react-resizable-hide"}
214
- // width={position.width}
215
- // height={position.height}
216
- // top={position.top}
217
- // left={position.left}
218
- // onResizeStop={onResizeStop}
219
- // onResizeStart={onResizeStart}
220
- // onResize={onResize}
221
- // minConstraints={minConstraints}
222
- // maxConstraints={maxConstraints}
223
- // transformScale={transformScale}
224
- // isResizing={isResizing}
225
- // autoResize={autoResize}
226
- // colWidth={colWidth}
227
- // margin={props.margin}
228
- // >
229
- // {child}
230
- // </Resizable>
231
- // );
232
- // };
233
- /**
234
- * onDragStart event handler
235
- * @param {Event} e event data
236
- * @param {Object} callbackData an object with node, delta and position information
237
- */
238
- var onDragStart = function (e, _a) {
239
- var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
240
- var newPosition = { top: 0, left: 0 };
241
- var offsetParent = node.offsetParent;
242
- if (!offsetParent)
243
- return;
244
- var parentRect = offsetParent.getBoundingClientRect();
245
- var clientRect = node.getBoundingClientRect();
246
- var cLeft = clientRect.left / transformScale;
247
- var pLeft = parentRect.left / transformScale;
248
- var cTop = clientRect.top / transformScale;
249
- var pTop = parentRect.top / transformScale;
250
- newPosition.left = cLeft - pLeft + offsetParent.scrollLeft;
251
- newPosition.top = cTop - pTop + offsetParent.scrollTop;
252
- setDragging(newPosition);
253
- var _b = calcXY(getPositionParams(), newPosition.top, newPosition.left, props.w, props.h), x = _b.x, y = _b.y;
254
- setDragStart({ x: x, y: y });
255
- props.onDragStart &&
256
- props.onDragStart(props.i, x, y, { e: e, node: node, newPosition: newPosition }, true);
257
- };
258
- /**
259
- * onDrag event handler
260
- * @param {Event} e event data
261
- * @param {Object} callbackData an object with node, delta and position information
262
- */
263
- var onDrag = function (e, _a) {
264
- var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
265
- if (!dragging) {
266
- throw new Error("onDrag called before onDragStart.");
267
- }
268
- setIsDragging(true);
269
- var top = dragging.top + deltaY;
270
- var left = dragging.left + deltaX;
271
- var isBounded = props.isBounded, i = props.i, w = props.w, h = props.h, containerWidth = props.containerWidth;
272
- var positionParams = getPositionParams();
273
- if (isBounded) {
274
- var offsetParent = node.offsetParent;
275
- if (offsetParent) {
276
- var margin = props.margin, rowHeight = props.rowHeight;
277
- // const colWidth = calcGridColWidth(positionParams);
278
- var rowHeightNumber = resolveRowHeight(rowHeight, colWidth);
279
- var bottomBoundary = offsetParent.clientHeight -
280
- calcGridItemWHPx(h, rowHeightNumber, margin[1]);
281
- top = clamp(top, 0, bottomBoundary);
282
- var rightBoundary = containerWidth - calcGridItemWHPx(w, colWidth, margin[0]);
283
- left = clamp(left, 0, rightBoundary);
284
- }
285
- }
286
- var newPosition = { top: top, left: left };
287
- setDragging(newPosition);
288
- var _b = calcXY(positionParams, top, left, w, h), x = _b.x, y = _b.y;
289
- props.onDrag && props.onDrag(i, x, y, { e: e, node: node, newPosition: newPosition }, true);
290
- };
291
- /**
292
- * onDragStop event handler
293
- * @param {Event} e event data
294
- * @param {Object} callbackData an object with node, delta and position information
295
- */
296
- var onDragStop = function (e, _a) {
297
- var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
298
- if (!dragging) {
299
- throw new Error("onDragEnd called before onDragStart.");
300
- }
301
- var w = props.w, h = props.h, i = props.i;
302
- var left = dragging.left, top = dragging.top;
303
- var _b = calcXY(getPositionParams(), top, left, w, h), x = _b.x, y = _b.y;
304
- var newPosition = { top: top, left: left };
305
- var change = (dragStart === null || dragStart === void 0 ? void 0 : dragStart.x) !== x || (dragStart === null || dragStart === void 0 ? void 0 : dragStart.y) !== y;
306
- setDragging(undefined);
307
- setDragStart(undefined);
308
- setIsDragging(false);
309
- props.onDragStop &&
310
- props.onDragStop(i, x, y, { e: e, node: node, newPosition: newPosition, change: change });
311
- };
312
- var getResizableXYPosition = function (handle, width, height, prevW, prevH) {
313
- var newX = x;
314
- var newY = y;
315
- if (handle === "nw") {
316
- // NOTE - nw left(X)와 top(Y) 둘다 변경
317
- if (width > prevW) {
318
- newX = x - (width - prevW);
319
- }
320
- else {
321
- newX = x + (prevW - width);
322
- }
323
- if (height > prevH) {
324
- newY = y - (height - prevH);
325
- }
326
- else {
327
- newY = y + (prevH - height);
328
- }
329
- }
330
- if (handle === "n" || handle === "ne") {
331
- // NOTE - n, ne left(X) 고정 & top(Y) 변경
332
- if (height > prevH) {
333
- newY = y - (height - prevH);
334
- }
335
- else {
336
- newY = y + (prevH - height);
337
- }
338
- }
339
- if (handle === "w" || handle === "sw") {
340
- // NOTE - s, sw left(X) 변경 top(Y) 고정
341
- if (width > prevW) {
342
- newX = x - (width - prevW);
343
- }
344
- else {
345
- newX = x + (prevW - width);
346
- }
347
- }
348
- return { newX: newX, newY: newY };
349
- };
350
- /**
351
- * onResizeStart event handler
352
- * @param {ResizeEventType} e event data
353
- * @param {Object} callbackData an object with node and size information
354
- */
355
- var onResizeStart = function (e, callbackData) {
356
- onResizeHandler(e, callbackData, "onResizeStart");
357
- };
358
- /**
359
- * onResize event handler
360
- * @param {ResizeEventType} e event data
361
- * @param {Object} callbackData an object with node and size information
362
- */
363
- var onResize = function (e, callbackData) {
364
- setIsResizing(true);
365
- onResizeHandler(e, callbackData, "onResize");
366
- };
367
- /**
368
- * onResizeStop event handler
369
- * @param {ResizeEventType} e event data
370
- * @param {Object} callbackData an object with node and size information
371
- */
372
- var onResizeStop = function (e, callbackData) {
373
- setIsResizing(false);
374
- onResizeHandler(e, callbackData, "onResizeStop");
375
- };
376
- /**
377
- * Wrapper around drag events to provide more useful data.
378
- * All drag events call the function with the given handler name,
379
- * with the signature (index, x, y).
380
- *
381
- * @param {String} handlerName Handler name to wrap.
382
- * @return {Function} Handler function.
383
- */
384
- var onResizeHandler = function (e, _a, handlerName) {
385
- var node = _a.node, size = _a.size, handle = _a.handle, minWidth = _a.minWidth, minHeight = _a.minHeight;
386
- var handler = props[handlerName];
387
- if (!handler)
388
- return;
389
- var prevW = props.w, prevH = props.h;
390
- // Get new XY
391
- var _b = calcWH(getPositionParams(), size, x, y, handle, prevW, prevH, true), w = _b.w, h = _b.h;
392
- var tempMinH = minH;
393
- if (minWidth) {
394
- 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;
395
- if (minW_1 > w) {
396
- w = minW_1;
397
- }
398
- if (minH > 1) {
399
- tempMinH = Math.max(1, newMinH);
400
- }
401
- }
402
- // minW should be at least 1
403
- // minW = Math.max(minW, 1);
404
- // maxW should be at most (cols - x)
405
- // maxW = Math.min(maxW, cols - x);
406
- w = clamp(w, minW, maxW);
407
- h = clamp(h, tempMinH, maxH);
408
- setResizing(handlerName === "onResizeStop" ? undefined : size);
409
- var _d = getResizableXYPosition(handle, w, h, prevW, prevH), newX = _d.newX, newY = _d.newY;
410
- handler(i, w, h, { e: e, node: node, size: size }, newX, newY);
411
- };
412
- var pos = calcGridItemPosition(getPositionParams(), x, y, z, w, h, {}, colWidth);
413
- var child = React.Children.only(children);
414
- var newChild = React.cloneElement(child, {
415
- key: i,
416
- ref: elementRef,
417
- "data-group-block-id": i,
418
- "data-z-index": z,
419
- "data-z-order": zOrder,
420
- "data-z-order-internal": zOrderInternal,
421
- "data-min-z": minZ,
422
- className: classNames("react-group-block", child.props.className, className, {
423
- static: props.static,
424
- isResizing: Boolean(resizing) &&
425
- Boolean(isResizing) &&
426
- Boolean(isHiddenVisibility),
427
- resizing: Boolean(resizing),
428
- "react-draggable": isDraggable,
429
- isDragging: Boolean(isDragging) &&
430
- Boolean(dragging) &&
431
- Boolean(isHiddenVisibility),
432
- "react-draggable-dragging": Boolean(dragging),
433
- // dropping: Boolean(droppingPosition),
434
- cssTransforms: useCSSTransforms,
435
- }),
436
- style: __assign(__assign(__assign({}, props.style), child.props.style), createStyle(pos)),
437
- onContextMenu: function (e) {
438
- onContextGroup(e);
439
- },
440
- onMouseMove: function (e) {
441
- if (isDragging || isResizing) {
442
- return;
443
- }
444
- // 일시적으로 pointer-events 비활성화
445
- if (elementRef.current) {
446
- elementRef.current.style.pointerEvents = "none";
447
- }
448
- // 현재 마우스 위치에서 실제 요소 찾기
449
- var underlyingElement = document.elementFromPoint(e.clientX, e.clientY);
450
- // pointer-events 복구
451
- if (elementRef.current) {
452
- elementRef.current.style.pointerEvents = "auto";
453
- }
454
- document.querySelectorAll(".cb-layout-box.hovered").forEach(function (el) {
455
- el.classList.remove("hovered");
456
- });
457
- if (underlyingElement &&
458
- underlyingElement.classList.contains("cb-layout-box")) {
459
- underlyingElement.classList.add("hovered");
460
- }
461
- },
462
- onMouseLeave: function () {
463
- document.querySelectorAll(".cb-layout-box.hovered").forEach(function (el) {
464
- el.classList.remove("hovered");
465
- });
466
- },
467
- });
468
- // newChild = mixinResizable(newChild, pos, isResizable);
469
- newChild = mixinDraggable(newChild, isDraggable);
470
- return newChild;
471
- };
472
- export default GroupItem;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- type OutsideClickHandlerProps = {
3
- children: React.ReactNode;
4
- onOutsideClick: () => void;
5
- };
6
- declare const OutsideClickHandler: React.FC<OutsideClickHandlerProps>;
7
- export default OutsideClickHandler;
@@ -1,112 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from 'react';
3
- import { zIndexMap } from '../GridLayoutEditor/group';
4
- var OutsideClickHandler = function (_a) {
5
- var children = _a.children, onOutsideClick = _a.onOutsideClick;
6
- var wrapperRef = useRef(null);
7
- var _b = useState({
8
- transform: '',
9
- width: '0',
10
- height: '0',
11
- }), childDimensions = _b[0], setChildDimensions = _b[1];
12
- var _c = useState(0), zIndex = _c[0], setZIndex = _c[1];
13
- useEffect(function () {
14
- var handleClickOutside = function (e) {
15
- var target = e.target;
16
- if (target.closest('.editable-grid-item') ||
17
- target.closest('.group') ||
18
- target.closest('.placeholder') ||
19
- target.closest('.react-group-block')) {
20
- return;
21
- }
22
- if (wrapperRef.current &&
23
- !wrapperRef.current.contains(e.target)) {
24
- onOutsideClick();
25
- }
26
- };
27
- var selectedSection = document.querySelector('.editor-canvas');
28
- // const selectedSection = document;
29
- if (selectedSection) {
30
- selectedSection.addEventListener('dblclick', handleClickOutside);
31
- }
32
- return function () {
33
- if (selectedSection) {
34
- selectedSection.removeEventListener('dblclick', handleClickOutside);
35
- }
36
- };
37
- }, [onOutsideClick]);
38
- // Find and set child dimensions when component mounts or children change
39
- useEffect(function () {
40
- if (wrapperRef.current && wrapperRef.current.children.length > 0) {
41
- var childElement = wrapperRef.current.children[0];
42
- // Get computed style of the child element
43
- var computedStyle = window.getComputedStyle(childElement);
44
- if (childElement.dataset['groupBlockId'] !== 'BULK') {
45
- return;
46
- }
47
- setChildDimensions({
48
- transform: computedStyle.transform,
49
- width: computedStyle.width,
50
- height: computedStyle.height,
51
- });
52
- if (childElement.dataset['minZ']) {
53
- setZIndex(Number(childElement.dataset['minZ']));
54
- }
55
- }
56
- return function () {
57
- setChildDimensions({
58
- transform: '',
59
- width: '0',
60
- height: '0',
61
- });
62
- setZIndex(0);
63
- };
64
- }, [children, wrapperRef.current]);
65
- // Parse dimensions to numbers for calculations
66
- var width = parseFloat(childDimensions.width) || 0;
67
- var height = parseFloat(childDimensions.height) || 0;
68
- var borderThickness = 3; // 3px border thickness
69
- var shadowOffset = 3; // Match the child's shadow (0 0 0 3px #027aff)
70
- return (_jsxs(_Fragment, { children: [_jsx("div", { ref: wrapperRef, className: 'outside-click-wrapper', children: children }), width > 0 && height > 0 && (_jsxs(_Fragment, { children: [_jsx("div", { className: 'border-top', style: {
71
- position: 'absolute',
72
- transform: childDimensions.transform,
73
- width: "".concat(width + shadowOffset * 2, "px"),
74
- height: "".concat(borderThickness, "px"),
75
- backgroundColor: '#027aff',
76
- marginLeft: "-".concat(shadowOffset, "px"),
77
- marginTop: "-".concat(shadowOffset, "px"),
78
- pointerEvents: 'none',
79
- zIndex: zIndexMap.EDITING_GROUP + zIndex,
80
- } }), _jsx("div", { className: 'border-right', style: {
81
- position: 'absolute',
82
- transform: childDimensions.transform,
83
- width: "".concat(borderThickness, "px"),
84
- height: "".concat(height + shadowOffset * 2, "px"),
85
- backgroundColor: '#027aff',
86
- marginLeft: "".concat(width + shadowOffset - borderThickness, "px"),
87
- marginTop: "-".concat(shadowOffset, "px"),
88
- pointerEvents: 'none',
89
- zIndex: zIndexMap.EDITING_GROUP + zIndex,
90
- } }), _jsx("div", { className: 'border-bottom', style: {
91
- position: 'absolute',
92
- transform: childDimensions.transform,
93
- width: "".concat(width + shadowOffset * 2, "px"),
94
- height: "".concat(borderThickness, "px"),
95
- backgroundColor: '#027aff',
96
- marginLeft: "-".concat(shadowOffset, "px"),
97
- marginTop: "".concat(height + shadowOffset - borderThickness, "px"),
98
- pointerEvents: 'none',
99
- zIndex: zIndexMap.EDITING_GROUP + zIndex,
100
- } }), _jsx("div", { className: 'border-left', style: {
101
- position: 'absolute',
102
- transform: childDimensions.transform,
103
- width: "".concat(borderThickness, "px"),
104
- height: "".concat(height + shadowOffset * 2, "px"),
105
- backgroundColor: '#027aff',
106
- marginLeft: "-".concat(shadowOffset, "px"),
107
- marginTop: "-".concat(shadowOffset, "px"),
108
- pointerEvents: 'none',
109
- zIndex: zIndexMap.EDITING_GROUP + zIndex,
110
- } })] }))] }));
111
- };
112
- export default OutsideClickHandler;
@@ -1 +0,0 @@
1
- export { default as GridItem } from "./GridItem";
@@ -1 +0,0 @@
1
- export { default as GridItem } from "./GridItem";