publ-echo 0.0.120 → 0.0.122
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.
- package/css/gle-styles.css +1 -0
- package/dist/lib/GridItem/GridItem.d.ts +3 -3
- package/dist/lib/GridItem/GridItem.js +242 -31
- package/dist/lib/GridItem/GridItemCopy.d.ts +5 -0
- package/dist/lib/GridItem/GridItemCopy.js +613 -0
- package/dist/lib/GridItem/GroupItem.d.ts +3 -3
- package/dist/lib/GridItem/GroupItem.js +38 -38
- package/dist/lib/GridItem/types.d.ts +8 -4
- package/dist/lib/GridItem/utils/calculateUtils.d.ts +9 -1
- package/dist/lib/GridItem/utils/calculateUtils.js +27 -0
- package/dist/lib/GridLayoutEditor/Placeholder.d.ts +20 -0
- package/dist/lib/GridLayoutEditor/Placeholder.js +62 -0
- package/dist/lib/GridLayoutEditor/ReactGridLayout.js +92 -36
- package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.d.ts +2 -2
- package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.js +8 -8
- package/dist/lib/GridLayoutEditor/group.d.ts +17 -0
- package/dist/lib/GridLayoutEditor/group.js +19 -0
- package/dist/lib/GridLayoutEditor/types.d.ts +14 -9
- package/dist/lib/GridLayoutEditor/utils/renderHelpers.js +3 -1
- package/dist/lib/Resizable/Resizable.d.ts +3 -3
- package/dist/lib/Resizable/Resizable.js +132 -35
- package/package.json +1 -1
|
@@ -21,22 +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
|
|
25
|
-
import { DraggableCore } from
|
|
26
|
-
import classNames from
|
|
27
|
-
import { calcGridColWidth, calcGridItemPosition, calcGridItemWHPx, calcWH, calcXY, clamp, resolveRowHeight, } from
|
|
28
|
-
import { perc, setTopLeft, setTransform, } from
|
|
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
29
|
var GroupItem = function (_a) {
|
|
30
30
|
var _b;
|
|
31
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 ?
|
|
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, isheightVariable = props.isheightVariable;
|
|
33
33
|
var _l = useState(), resizing = _l[0], setResizing = _l[1];
|
|
34
34
|
var _m = useState(), dragging = _m[0], setDragging = _m[1];
|
|
35
35
|
var _o = useState(), dragStart = _o[0], setDragStart = _o[1];
|
|
36
36
|
var _p = useState(false), isDragging = _p[0], setIsDragging = _p[1];
|
|
37
37
|
var _q = useState(false), isResizing = _q[0], setIsResizing = _q[1];
|
|
38
38
|
var elementRef = useRef(null);
|
|
39
|
-
var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains(
|
|
39
|
+
var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains("react-grid-item-selected");
|
|
40
40
|
useEffect(function () {
|
|
41
41
|
var _a;
|
|
42
42
|
if (!isSelected || !autoResize) {
|
|
@@ -54,7 +54,7 @@ var GroupItem = function (_a) {
|
|
|
54
54
|
var callback = function (mutationsList) {
|
|
55
55
|
for (var _i = 0, mutationsList_1 = mutationsList; _i < mutationsList_1.length; _i++) {
|
|
56
56
|
var mutation = mutationsList_1[_i];
|
|
57
|
-
var isCharacterChanged = mutation.type ===
|
|
57
|
+
var isCharacterChanged = mutation.type === "characterData";
|
|
58
58
|
var keepWidth = true;
|
|
59
59
|
var hasPaddingChanged = false;
|
|
60
60
|
var height = isCharacterChanged
|
|
@@ -85,14 +85,14 @@ var GroupItem = function (_a) {
|
|
|
85
85
|
var _a = calcWH(getPositionParams(), {
|
|
86
86
|
width: width,
|
|
87
87
|
height: height,
|
|
88
|
-
}, x, y,
|
|
88
|
+
}, x, y, "e", props.w, props.h, false), w_1 = _a.w, h_1 = _a.h;
|
|
89
89
|
if (keepWidth) {
|
|
90
90
|
w_1 = prevW;
|
|
91
91
|
}
|
|
92
92
|
if (prevH > h_1) {
|
|
93
93
|
h_1 = prevH;
|
|
94
94
|
}
|
|
95
|
-
var _b = getResizableXYPosition(
|
|
95
|
+
var _b = getResizableXYPosition("e", w_1, h_1, prevW, prevH), newX = _b.newX, newY = _b.newY;
|
|
96
96
|
if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
@@ -162,7 +162,7 @@ var GroupItem = function (_a) {
|
|
|
162
162
|
style = setTopLeft(pos);
|
|
163
163
|
if (usePercentages) {
|
|
164
164
|
if (containerWidth == null) {
|
|
165
|
-
throw new Error(
|
|
165
|
+
throw new Error("Container width is missing!");
|
|
166
166
|
}
|
|
167
167
|
style.left = perc(pos.left / containerWidth);
|
|
168
168
|
style.width = perc(pos.width / containerWidth);
|
|
@@ -176,7 +176,7 @@ var GroupItem = function (_a) {
|
|
|
176
176
|
* @return {Element} Child wrapped in Draggable.
|
|
177
177
|
*/
|
|
178
178
|
var mixinDraggable = function (child, isDraggable) {
|
|
179
|
-
return (_jsx(DraggableCore, { disabled: !isDraggable, onStart: onDragStart, onDrag: onDrag, onStop: onDragStop, handle: handle, cancel:
|
|
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
180
|
};
|
|
181
181
|
// /**
|
|
182
182
|
// * Mix a Resizable instance into a child.
|
|
@@ -263,7 +263,7 @@ var GroupItem = function (_a) {
|
|
|
263
263
|
var onDrag = function (e, _a) {
|
|
264
264
|
var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
|
|
265
265
|
if (!dragging) {
|
|
266
|
-
throw new Error(
|
|
266
|
+
throw new Error("onDrag called before onDragStart.");
|
|
267
267
|
}
|
|
268
268
|
setIsDragging(true);
|
|
269
269
|
var top = dragging.top + deltaY;
|
|
@@ -278,7 +278,6 @@ var GroupItem = function (_a) {
|
|
|
278
278
|
var rowHeightNumber = resolveRowHeight(rowHeight, colWidth);
|
|
279
279
|
var bottomBoundary = offsetParent.clientHeight -
|
|
280
280
|
calcGridItemWHPx(h, rowHeightNumber, margin[1]);
|
|
281
|
-
console.log('bb', bottomBoundary);
|
|
282
281
|
top = clamp(top, 0, bottomBoundary);
|
|
283
282
|
var rightBoundary = containerWidth - calcGridItemWHPx(w, colWidth, margin[0]);
|
|
284
283
|
left = clamp(left, 0, rightBoundary);
|
|
@@ -297,7 +296,7 @@ var GroupItem = function (_a) {
|
|
|
297
296
|
var onDragStop = function (e, _a) {
|
|
298
297
|
var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
|
|
299
298
|
if (!dragging) {
|
|
300
|
-
throw new Error(
|
|
299
|
+
throw new Error("onDragEnd called before onDragStart.");
|
|
301
300
|
}
|
|
302
301
|
var w = props.w, h = props.h, i = props.i;
|
|
303
302
|
var left = dragging.left, top = dragging.top;
|
|
@@ -313,7 +312,7 @@ var GroupItem = function (_a) {
|
|
|
313
312
|
var getResizableXYPosition = function (handle, width, height, prevW, prevH) {
|
|
314
313
|
var newX = x;
|
|
315
314
|
var newY = y;
|
|
316
|
-
if (handle ===
|
|
315
|
+
if (handle === "nw") {
|
|
317
316
|
// NOTE - nw left(X)와 top(Y) 둘다 변경
|
|
318
317
|
if (width > prevW) {
|
|
319
318
|
newX = x - (width - prevW);
|
|
@@ -328,7 +327,7 @@ var GroupItem = function (_a) {
|
|
|
328
327
|
newY = y + (prevH - height);
|
|
329
328
|
}
|
|
330
329
|
}
|
|
331
|
-
if (handle ===
|
|
330
|
+
if (handle === "n" || handle === "ne") {
|
|
332
331
|
// NOTE - n, ne left(X) 고정 & top(Y) 변경
|
|
333
332
|
if (height > prevH) {
|
|
334
333
|
newY = y - (height - prevH);
|
|
@@ -337,7 +336,7 @@ var GroupItem = function (_a) {
|
|
|
337
336
|
newY = y + (prevH - height);
|
|
338
337
|
}
|
|
339
338
|
}
|
|
340
|
-
if (handle ===
|
|
339
|
+
if (handle === "w" || handle === "sw") {
|
|
341
340
|
// NOTE - s, sw left(X) 변경 top(Y) 고정
|
|
342
341
|
if (width > prevW) {
|
|
343
342
|
newX = x - (width - prevW);
|
|
@@ -354,7 +353,7 @@ var GroupItem = function (_a) {
|
|
|
354
353
|
* @param {Object} callbackData an object with node and size information
|
|
355
354
|
*/
|
|
356
355
|
var onResizeStart = function (e, callbackData) {
|
|
357
|
-
onResizeHandler(e, callbackData,
|
|
356
|
+
onResizeHandler(e, callbackData, "onResizeStart");
|
|
358
357
|
};
|
|
359
358
|
/**
|
|
360
359
|
* onResize event handler
|
|
@@ -363,7 +362,7 @@ var GroupItem = function (_a) {
|
|
|
363
362
|
*/
|
|
364
363
|
var onResize = function (e, callbackData) {
|
|
365
364
|
setIsResizing(true);
|
|
366
|
-
onResizeHandler(e, callbackData,
|
|
365
|
+
onResizeHandler(e, callbackData, "onResize");
|
|
367
366
|
};
|
|
368
367
|
/**
|
|
369
368
|
* onResizeStop event handler
|
|
@@ -372,7 +371,7 @@ var GroupItem = function (_a) {
|
|
|
372
371
|
*/
|
|
373
372
|
var onResizeStop = function (e, callbackData) {
|
|
374
373
|
setIsResizing(false);
|
|
375
|
-
onResizeHandler(e, callbackData,
|
|
374
|
+
onResizeHandler(e, callbackData, "onResizeStop");
|
|
376
375
|
};
|
|
377
376
|
/**
|
|
378
377
|
* Wrapper around drag events to provide more useful data.
|
|
@@ -406,7 +405,7 @@ var GroupItem = function (_a) {
|
|
|
406
405
|
// maxW = Math.min(maxW, cols - x);
|
|
407
406
|
w = clamp(w, minW, maxW);
|
|
408
407
|
h = clamp(h, tempMinH, maxH);
|
|
409
|
-
setResizing(handlerName ===
|
|
408
|
+
setResizing(handlerName === "onResizeStop" ? undefined : size);
|
|
410
409
|
var _d = getResizableXYPosition(handle, w, h, prevW, prevH), newX = _d.newX, newY = _d.newY;
|
|
411
410
|
handler(i, w, h, { e: e, node: node, size: size }, newX, newY);
|
|
412
411
|
};
|
|
@@ -415,22 +414,23 @@ var GroupItem = function (_a) {
|
|
|
415
414
|
var newChild = React.cloneElement(child, {
|
|
416
415
|
key: i,
|
|
417
416
|
ref: elementRef,
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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
|
+
"data-is-height-variable": isheightVariable,
|
|
423
|
+
className: classNames("react-group-block", child.props.className, className, {
|
|
424
424
|
static: props.static,
|
|
425
425
|
isResizing: Boolean(resizing) &&
|
|
426
426
|
Boolean(isResizing) &&
|
|
427
427
|
Boolean(isHiddenVisibility),
|
|
428
428
|
resizing: Boolean(resizing),
|
|
429
|
-
|
|
429
|
+
"react-draggable": isDraggable,
|
|
430
430
|
isDragging: Boolean(isDragging) &&
|
|
431
431
|
Boolean(dragging) &&
|
|
432
432
|
Boolean(isHiddenVisibility),
|
|
433
|
-
|
|
433
|
+
"react-draggable-dragging": Boolean(dragging),
|
|
434
434
|
// dropping: Boolean(droppingPosition),
|
|
435
435
|
cssTransforms: useCSSTransforms,
|
|
436
436
|
}),
|
|
@@ -444,25 +444,25 @@ var GroupItem = function (_a) {
|
|
|
444
444
|
}
|
|
445
445
|
// 일시적으로 pointer-events 비활성화
|
|
446
446
|
if (elementRef.current) {
|
|
447
|
-
elementRef.current.style.pointerEvents =
|
|
447
|
+
elementRef.current.style.pointerEvents = "none";
|
|
448
448
|
}
|
|
449
449
|
// 현재 마우스 위치에서 실제 요소 찾기
|
|
450
450
|
var underlyingElement = document.elementFromPoint(e.clientX, e.clientY);
|
|
451
451
|
// pointer-events 복구
|
|
452
452
|
if (elementRef.current) {
|
|
453
|
-
elementRef.current.style.pointerEvents =
|
|
453
|
+
elementRef.current.style.pointerEvents = "auto";
|
|
454
454
|
}
|
|
455
|
-
document.querySelectorAll(
|
|
456
|
-
el.classList.remove(
|
|
455
|
+
document.querySelectorAll(".cb-layout-box.hovered").forEach(function (el) {
|
|
456
|
+
el.classList.remove("hovered");
|
|
457
457
|
});
|
|
458
458
|
if (underlyingElement &&
|
|
459
|
-
underlyingElement.classList.contains(
|
|
460
|
-
underlyingElement.classList.add(
|
|
459
|
+
underlyingElement.classList.contains("cb-layout-box")) {
|
|
460
|
+
underlyingElement.classList.add("hovered");
|
|
461
461
|
}
|
|
462
462
|
},
|
|
463
463
|
onMouseLeave: function () {
|
|
464
|
-
document.querySelectorAll(
|
|
465
|
-
el.classList.remove(
|
|
464
|
+
document.querySelectorAll(".cb-layout-box.hovered").forEach(function (el) {
|
|
465
|
+
el.classList.remove("hovered");
|
|
466
466
|
});
|
|
467
467
|
},
|
|
468
468
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DragEvent, SyntheticEvent } from
|
|
2
|
-
import { RowHeight } from
|
|
3
|
-
import { ResizeHandleAxis, ResizeHandleType } from
|
|
1
|
+
import { DragEvent, SyntheticEvent } from "react";
|
|
2
|
+
import { RowHeight } from "../GridLayoutEditor/types";
|
|
3
|
+
import { ResizeHandleAxis, ResizeHandleType } from "../Resizable/types";
|
|
4
4
|
export type PartialPosition = {
|
|
5
5
|
top: number;
|
|
6
6
|
left: number;
|
|
@@ -83,6 +83,10 @@ export type GridItemProps = {
|
|
|
83
83
|
autoResize: boolean;
|
|
84
84
|
zOrder?: number;
|
|
85
85
|
zOrderInternal?: string;
|
|
86
|
+
isheightVariable: boolean;
|
|
87
|
+
heightFitContent: boolean;
|
|
88
|
+
isGroupChild?: boolean;
|
|
89
|
+
parentGroupId?: string;
|
|
86
90
|
};
|
|
87
91
|
export type GridItemDefaultProps = {
|
|
88
92
|
className: string;
|
|
@@ -108,5 +112,5 @@ export type ReactDraggableCallbackData = {
|
|
|
108
112
|
lastX: number;
|
|
109
113
|
lastY: number;
|
|
110
114
|
};
|
|
111
|
-
export type ResizeHandlerNameType =
|
|
115
|
+
export type ResizeHandlerNameType = "onResizeStart" | "onResize" | "onResizeStop";
|
|
112
116
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResizeHandleAxis } from "../../Resizable/types";
|
|
2
|
-
import { Position, PositionParams } from "../../GridLayoutEditor/types";
|
|
2
|
+
import { Layout, Position, PositionParams } from "../../GridLayoutEditor/types";
|
|
3
3
|
export type RowHeight = number | ((width: number) => number);
|
|
4
4
|
export declare function calcGridColWidth(positionParams: PositionParams): number;
|
|
5
5
|
export declare function calcGridItemWHPx(gridUnits: number, colOrRowSize: number, marginPx: number): number;
|
|
@@ -28,3 +28,11 @@ export declare function calcWH(positionParams: PositionParams, { width, height }
|
|
|
28
28
|
h: number;
|
|
29
29
|
};
|
|
30
30
|
export declare function clamp(num: number, lowerBound: number, upperBound: number): number;
|
|
31
|
+
/**
|
|
32
|
+
* layout 배열을 분석하여 'heightFitContent'가 true인 모든 아이템이
|
|
33
|
+
* 차지하고 있는 Row 인덱스 배열을 반환합니다.
|
|
34
|
+
*
|
|
35
|
+
* @param layout - 현재 그리드 레이아웃 (LayoutItem 배열)
|
|
36
|
+
* @returns 중복이 제거되고 정렬된 Row 인덱스 배열 (예: [0, 1, 2, 5, 6])
|
|
37
|
+
*/
|
|
38
|
+
export declare const getRowsForHeightFitContentItems: (layout: Layout) => number[];
|
|
@@ -113,3 +113,30 @@ function roundToOneDecimal(num) {
|
|
|
113
113
|
function truncateToOneDecimal(num) {
|
|
114
114
|
return Math.floor(num * 10) / 10;
|
|
115
115
|
}
|
|
116
|
+
// ReactGridLayout.tsx 파일 상단이나, 임포트하는 유틸리티 파일에
|
|
117
|
+
/**
|
|
118
|
+
* layout 배열을 분석하여 'heightFitContent'가 true인 모든 아이템이
|
|
119
|
+
* 차지하고 있는 Row 인덱스 배열을 반환합니다.
|
|
120
|
+
*
|
|
121
|
+
* @param layout - 현재 그리드 레이아웃 (LayoutItem 배열)
|
|
122
|
+
* @returns 중복이 제거되고 정렬된 Row 인덱스 배열 (예: [0, 1, 2, 5, 6])
|
|
123
|
+
*/
|
|
124
|
+
export var getRowsForHeightFitContentItems = function (layout) {
|
|
125
|
+
// Set을 사용하여 Row 인덱스의 중복을 자동으로 처리합니다.
|
|
126
|
+
var activeRows = new Set();
|
|
127
|
+
// 1. heightFitContent가 true인 아이템들만 필터링합니다.
|
|
128
|
+
var fitContentItems = layout.filter(function (item) { return item.heightFitContent === true; });
|
|
129
|
+
// 2. 필터링된 각 아이템을 순회합니다.
|
|
130
|
+
for (var _i = 0, fitContentItems_1 = fitContentItems; _i < fitContentItems_1.length; _i++) {
|
|
131
|
+
var item = fitContentItems_1[_i];
|
|
132
|
+
// 3. 아이템이 차지하는 모든 Row를 Set에 추가합니다.
|
|
133
|
+
// (예: y=2, h=3 이면 2, 3, 4 행을 추가)
|
|
134
|
+
var startRow = item.y;
|
|
135
|
+
var endRow = item.y + item.h;
|
|
136
|
+
for (var row = startRow; row < endRow; row++) {
|
|
137
|
+
activeRows.add(row);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// 4. Set을 배열로 변환하고 오름차순으로 정렬하여 반환합니다.
|
|
141
|
+
return Array.from(activeRows).sort(function (a, b) { return a - b; });
|
|
142
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentBlock, GroupBlock } from "./group";
|
|
2
|
+
import { LayoutItem } from "./types";
|
|
3
|
+
type PlaceholderProps = {
|
|
4
|
+
device: "DESKTOP" | "MOBILE";
|
|
5
|
+
margin: [number, number];
|
|
6
|
+
rowHeight: number;
|
|
7
|
+
colWidth: number;
|
|
8
|
+
backgroundWidth: string | undefined;
|
|
9
|
+
backgroundHeight: string | undefined;
|
|
10
|
+
activeDrag: LayoutItem;
|
|
11
|
+
selectedBlockId: string | null;
|
|
12
|
+
totalCols: number;
|
|
13
|
+
activeRows: number[];
|
|
14
|
+
activeBlock?: ComponentBlock | GroupBlock | null;
|
|
15
|
+
layout: LayoutItem[];
|
|
16
|
+
};
|
|
17
|
+
export declare function GridBackgroundPlaceholder({ device, margin, rowHeight, colWidth, backgroundWidth, backgroundHeight, activeDrag, selectedBlockId, activeRows, totalCols, // 💡 새로 받은 totalCols 사용
|
|
18
|
+
activeBlock, layout, }: PlaceholderProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function getShowActiveRows(block: ComponentBlock | GroupBlock, layout: LayoutItem[]): boolean;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getLayoutItem } from "./utils/renderHelpers";
|
|
3
|
+
export function GridBackgroundPlaceholder(_a) {
|
|
4
|
+
// 활성화된 행(row) 인덱스 배열
|
|
5
|
+
// const activeRows = Array.from(
|
|
6
|
+
// { length: activeDrag.h },
|
|
7
|
+
// (_, i) => activeDrag.y + i
|
|
8
|
+
// );
|
|
9
|
+
var device = _a.device, margin = _a.margin,
|
|
10
|
+
// width, // 🚨 제거
|
|
11
|
+
rowHeight = _a.rowHeight, colWidth = _a.colWidth, backgroundWidth = _a.backgroundWidth, backgroundHeight = _a.backgroundHeight, activeDrag = _a.activeDrag, selectedBlockId = _a.selectedBlockId, activeRows = _a.activeRows, totalCols = _a.totalCols, // 💡 새로 받은 totalCols 사용
|
|
12
|
+
activeBlock = _a.activeBlock, layout = _a.layout;
|
|
13
|
+
// 🚨 activeCols도 totalCols prop으로 받아서 사용
|
|
14
|
+
// const activeCols = Array.from({ length: 24 }, (_, i) => 0 + i);
|
|
15
|
+
var activeCols = Array.from({ length: totalCols }, function (_, i) { return 0 + i; });
|
|
16
|
+
var textPadding = 10;
|
|
17
|
+
// 💡 SVG 캔버스 내부에서 그리드가 차지하는 '실제' 너비를 계산
|
|
18
|
+
// (총 열 수 * (각 열의 너비 + 가로 마진)) - 마지막 열의 추가 마진
|
|
19
|
+
// 패턴은 colWidth + margin[0] 단위로 반복되므로, 마지막 열에서는 margin[0]이 필요 없습니다.
|
|
20
|
+
// 또는, 마지막 요소에는 margin[0]이 없다고 가정하고 계산합니다.
|
|
21
|
+
var gridContentWidth = totalCols * (colWidth + margin[0]) - margin[0];
|
|
22
|
+
var isHeightVariable = device === "DESKTOP"
|
|
23
|
+
? !!(activeBlock === null || activeBlock === void 0 ? void 0 : activeBlock.isHeightVariableDesktop)
|
|
24
|
+
: !!(activeBlock === null || activeBlock === void 0 ? void 0 : activeBlock.isHeightVariableMobile);
|
|
25
|
+
// const showActiveRows = !!activeDrag.heightFitContent || isHeightVariable;
|
|
26
|
+
var showActiveRows = activeBlock && activeBlock.type === "GROUP_BLOCK"
|
|
27
|
+
? getShowActiveRows(activeBlock, layout)
|
|
28
|
+
: !!activeDrag.heightFitContent || isHeightVariable;
|
|
29
|
+
return (_jsx("div", { className: "grid-placeholder", style: {
|
|
30
|
+
marginTop: margin[1] + "px",
|
|
31
|
+
marginBottom: margin[1] + "px",
|
|
32
|
+
marginLeft: margin[0] + "px",
|
|
33
|
+
marginRight: margin[0] + "px",
|
|
34
|
+
}, children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg",
|
|
35
|
+
// 💡 backgroundWidth는 string("100%")으로 사용하되,
|
|
36
|
+
// 내부 요소 배치에는 gridContentWidth를 사용합니다.
|
|
37
|
+
width: backgroundWidth, height: backgroundHeight, overflow: "visible", children: [_jsx("defs", { children: _jsx("pattern", { id: "grid-pattern", height: rowHeight + margin[1], width: colWidth + margin[0], patternUnits: "userSpaceOnUse", children: _jsx("rect", { x: 0.5, y: 0.5, className: "grid-pattern-rect", height: rowHeight, width: colWidth }) }) }), _jsx("rect", { width: gridContentWidth, height: "100%", fill: "url(#grid-pattern)" }), showActiveRows &&
|
|
38
|
+
activeRows.map(function (row) {
|
|
39
|
+
var y_top = row * (rowHeight + margin[1]) + 0.5;
|
|
40
|
+
var y_center = y_top + rowHeight / 2;
|
|
41
|
+
return (_jsxs("g", { children: [activeCols.map(function (col) {
|
|
42
|
+
var x = col * (colWidth + margin[0]) + 0.5;
|
|
43
|
+
return (_jsx("rect", { x: x, y: y_top, width: colWidth, height: rowHeight, className: "grid-active-cell-placeholder" }, "active-".concat(row, "-").concat(col)));
|
|
44
|
+
}), _jsx("foreignObject", { x: gridContentWidth + textPadding, y: y_top, width: colWidth, height: rowHeight, style: { overflow: "visible" }, children: _jsx("div", { className: "grid-indicator-text" }) })] }, "active-row-".concat(row)));
|
|
45
|
+
})] }) }));
|
|
46
|
+
}
|
|
47
|
+
export function getShowActiveRows(block, layout) {
|
|
48
|
+
if (block.type === "GROUP_BLOCK") {
|
|
49
|
+
var hasFitContentCB = block.children.some(function (child) {
|
|
50
|
+
if (child.type === "COMPONENT_BLOCK") {
|
|
51
|
+
var item = getLayoutItem(layout, child.componentBlockId.toString());
|
|
52
|
+
return (item === null || item === void 0 ? void 0 : item.heightFitContent) || false;
|
|
53
|
+
}
|
|
54
|
+
if (child.type === "GROUP_BLOCK") {
|
|
55
|
+
return getShowActiveRows(child, layout);
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
});
|
|
59
|
+
return hasFitContentCB;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
@@ -34,23 +34,25 @@ import * as React from "react";
|
|
|
34
34
|
import { useState, useRef, useLayoutEffect } from "react";
|
|
35
35
|
import classNames from "../../external-lib/classnames";
|
|
36
36
|
import { bottom, cloneLayoutItem, compact, getAllCollisions, getBoundingArea, getLayoutItem, moveElement, noop, synchronizeLayoutWithChildren, withLayoutItem, } from "./utils/renderHelpers";
|
|
37
|
-
import { calcGridColWidth, calcXY, resolveRowHeight, } from "../GridItem/utils/calculateUtils";
|
|
37
|
+
import { calcGridColWidth, calcXY, getRowsForHeightFitContentItems, resolveRowHeight, } from "../GridItem/utils/calculateUtils";
|
|
38
|
+
// NOTE: 필수 변경하기
|
|
38
39
|
import GridItem from "../GridItem/GridItem";
|
|
39
40
|
import isEqual from "../../external-lib/lodash.isEqual";
|
|
40
|
-
import { findAllChildrenCbIds, findBlockByBlockId, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, findParentGroupBlock, formatCbIdToBlockId, getBlockSpecificType, zIndexMap, } from "./group";
|
|
41
|
+
import { findAllChildrenCbIds, findBlockByBlockId, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, findParentGroupBlock, formatCbIdToBlockId, getBlockIdKind, getBlockSpecificType, zIndexMap, } from "./group";
|
|
41
42
|
import GroupItem from "../GridItem/GroupItem";
|
|
42
43
|
import OutsideClickHandler from "../GridItem/OutsideClickHandler";
|
|
44
|
+
import { getShowActiveRows, GridBackgroundPlaceholder } from "./Placeholder";
|
|
43
45
|
var layoutClassName = "react-grid-layout";
|
|
44
46
|
var ReactGridLayout = function (_a) {
|
|
45
47
|
var children = _a.children, props = __rest(_a, ["children"]);
|
|
46
|
-
var sectionId = props.sectionId, _b = props.autoSize, autoSize = _b === void 0 ? true : _b, _c = props.cols, cols = _c === void 0 ? 12 : _c, _d = props.className, className = _d === void 0 ? "" : _d, _e = props.style, style = _e === void 0 ? {} : _e, _f = props.draggableHandle, draggableHandle = _f === void 0 ? "" : _f, _g = props.draggableCancel, draggableCancel = _g === void 0 ? "" : _g, _h = props.containerPadding, containerPadding = _h === void 0 ? undefined : _h, _j = props.rowHeight, rowHeight = _j === void 0 ? 150 : _j, _k = props.maxRows, maxRows = _k === void 0 ? Infinity : _k, _l = props.margin, margin = _l === void 0 ? [10, 10] : _l, _m = props.isBounded, isBounded = _m === void 0 ? false : _m, _o = props.isDraggable, isDraggable = _o === void 0 ? true : _o, _p = props.isResizable, isResizable = _p === void 0 ? true : _p, _q = props.allowOverlap, allowOverlap = _q === void 0 ? false : _q, _r = props.isDroppable, isDroppable = _r === void 0 ? false : _r, _s = props.useCSSTransforms, useCSSTransforms = _s === void 0 ? true : _s, _t = props.transformScale, transformScale = _t === void 0 ? 1 : _t, _u = props.compactType, compactType = _u === void 0 ? "vertical" : _u, _v = props.preventCollision, preventCollision = _v === void 0 ? false : _v, _w = props.droppingItem, droppingItem = _w === void 0 ? {
|
|
48
|
+
var selectedBlockId = props.selectedBlockId, sectionId = props.sectionId, _b = props.autoSize, autoSize = _b === void 0 ? true : _b, _c = props.cols, cols = _c === void 0 ? 12 : _c, _d = props.className, className = _d === void 0 ? "" : _d, _e = props.style, style = _e === void 0 ? {} : _e, _f = props.draggableHandle, draggableHandle = _f === void 0 ? "" : _f, _g = props.draggableCancel, draggableCancel = _g === void 0 ? "" : _g, _h = props.containerPadding, containerPadding = _h === void 0 ? undefined : _h, _j = props.rowHeight, rowHeight = _j === void 0 ? 150 : _j, _k = props.maxRows, maxRows = _k === void 0 ? Infinity : _k, _l = props.margin, margin = _l === void 0 ? [10, 10] : _l, _m = props.isBounded, isBounded = _m === void 0 ? false : _m, _o = props.isDraggable, isDraggable = _o === void 0 ? true : _o, _p = props.isResizable, isResizable = _p === void 0 ? true : _p, _q = props.allowOverlap, allowOverlap = _q === void 0 ? false : _q, _r = props.isDroppable, isDroppable = _r === void 0 ? false : _r, _s = props.useCSSTransforms, useCSSTransforms = _s === void 0 ? true : _s, _t = props.transformScale, transformScale = _t === void 0 ? 1 : _t, _u = props.compactType, compactType = _u === void 0 ? "vertical" : _u, _v = props.preventCollision, preventCollision = _v === void 0 ? false : _v, _w = props.droppingItem, droppingItem = _w === void 0 ? {
|
|
47
49
|
i: "__dropping-elem__",
|
|
48
50
|
h: 1,
|
|
49
51
|
w: 1,
|
|
50
52
|
} : _w, // TODO fix
|
|
51
53
|
_x = props.resizeHandles, // TODO fix
|
|
52
|
-
resizeHandles = _x === void 0 ? ["se"] : _x, _y = props.width, width = _y === void 0 ? 0 : _y, resizeHandle = props.resizeHandle, _z = props.isHiddenVisibility, isHiddenVisibility = _z === void 0 ? true : _z, innerRef = props.innerRef, minNbRow = props.minNbRow, customColWidth = props.customColWidth, blockStructure = props.blockStructure, onDoubleClickGroup = props.onDoubleClickGroup, _0 = props.editingGroupBlock, editingGroupBlock = _0 === void 0 ? "ROOT" : _0, _1 = props.selectedGroupBlock, selectedGroupBlock = _1 === void 0 ? "ROOT" : _1, onClickGroup = props.onClickGroup, bulkIds = props.bulkIds, onDoubleClickOutsideGroup = props.onDoubleClickOutsideGroup;
|
|
53
|
-
var
|
|
54
|
+
resizeHandles = _x === void 0 ? ["se"] : _x, _y = props.width, width = _y === void 0 ? 0 : _y, resizeHandle = props.resizeHandle, _z = props.isHiddenVisibility, isHiddenVisibility = _z === void 0 ? true : _z, innerRef = props.innerRef, minNbRow = props.minNbRow, customColWidth = props.customColWidth, blockStructure = props.blockStructure, onDoubleClickGroup = props.onDoubleClickGroup, _0 = props.editingGroupBlock, editingGroupBlock = _0 === void 0 ? "ROOT" : _0, _1 = props.selectedGroupBlock, selectedGroupBlock = _1 === void 0 ? "ROOT" : _1, onClickGroup = props.onClickGroup, bulkIds = props.bulkIds, onDoubleClickOutsideGroup = props.onDoubleClickOutsideGroup, device = props.device;
|
|
55
|
+
var parsedSelectedBlockId = getBlockIdKind(selectedBlockId !== null && selectedBlockId !== void 0 ? selectedBlockId : "");
|
|
54
56
|
var _2 = useState(), activeDrag = _2[0], setActiveDrag = _2[1];
|
|
55
57
|
var _3 = useState(), oldDragItem = _3[0], setOldDragItem = _3[1];
|
|
56
58
|
var _4 = useState(), oldLayout = _4[0], setOldLayout = _4[1];
|
|
@@ -207,9 +209,8 @@ var ReactGridLayout = function (_a) {
|
|
|
207
209
|
* @param {Element} node The current dragging DOM element
|
|
208
210
|
*/
|
|
209
211
|
var onDragHandler = function (i, x, y, _a, isGroup) {
|
|
210
|
-
var _b;
|
|
211
212
|
var e = _a.e, node = _a.node;
|
|
212
|
-
var l = (
|
|
213
|
+
var l = isGroup ? generateGrouplayout(i) : getLayoutItem(layout, i);
|
|
213
214
|
if (!l)
|
|
214
215
|
return;
|
|
215
216
|
if (!oldDragItem) {
|
|
@@ -217,15 +218,7 @@ var ReactGridLayout = function (_a) {
|
|
|
217
218
|
}
|
|
218
219
|
var xgap = x - oldDragItem.x;
|
|
219
220
|
var ygap = y - oldDragItem.y;
|
|
220
|
-
var placeholder = {
|
|
221
|
-
w: l.w,
|
|
222
|
-
h: l.h,
|
|
223
|
-
x: l.x,
|
|
224
|
-
y: l.y,
|
|
225
|
-
z: l.z,
|
|
226
|
-
placeholder: true,
|
|
227
|
-
i: i,
|
|
228
|
-
};
|
|
221
|
+
var placeholder = __assign(__assign({}, l), { w: l.w, h: l.h, x: l.x, y: l.y, z: l.z, placeholder: true, i: i, heightFitContent: l.heightFitContent });
|
|
229
222
|
var isUserAction = true;
|
|
230
223
|
var newLayout = isGroup
|
|
231
224
|
? layout
|
|
@@ -427,15 +420,7 @@ var ReactGridLayout = function (_a) {
|
|
|
427
420
|
}), newLayout = _b[0], l = _b[1];
|
|
428
421
|
if (!l)
|
|
429
422
|
return;
|
|
430
|
-
var placeholder = {
|
|
431
|
-
w: l.w,
|
|
432
|
-
h: l.h,
|
|
433
|
-
x: l.x,
|
|
434
|
-
y: l.y,
|
|
435
|
-
z: l.z,
|
|
436
|
-
static: true,
|
|
437
|
-
i: i,
|
|
438
|
-
};
|
|
423
|
+
var placeholder = __assign(__assign({}, l), { w: l.w, h: l.h, x: l.x, y: l.y, z: l.z, static: true, i: i, heightFitContent: l.heightFitContent });
|
|
439
424
|
props.onResize &&
|
|
440
425
|
props.onResize({
|
|
441
426
|
layout: newLayout,
|
|
@@ -528,7 +513,7 @@ var ReactGridLayout = function (_a) {
|
|
|
528
513
|
if (!item) {
|
|
529
514
|
return null;
|
|
530
515
|
}
|
|
531
|
-
return (_jsx(GridItem, { w: activeDrag.w, h: activeDrag.h, x: activeDrag.x, y: activeDrag.y, z: zIndexMap.ISDRAGGING, i: activeDrag.i, className: "placeholder", containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, isDraggable: false, isResizable: false, isBounded: false, useCSSTransforms: useCSSTransforms, transformScale: transformScale, autoResize: !!l.autoResize, children: item && item }));
|
|
516
|
+
return (_jsx(GridItem, { isheightVariable: false, w: activeDrag.w, h: activeDrag.h, x: activeDrag.x, y: activeDrag.y, z: zIndexMap.ISDRAGGING, i: activeDrag.i, heightFitContent: false, className: "placeholder", containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, isDraggable: false, isResizable: false, isBounded: false, useCSSTransforms: useCSSTransforms, transformScale: transformScale, autoResize: !!l.autoResize, minH: l.minH, minW: l.minW, children: item && item }));
|
|
532
517
|
};
|
|
533
518
|
/**
|
|
534
519
|
* Given a grid item, set its style attributes & surround in a <Draggable>.
|
|
@@ -554,6 +539,9 @@ var ReactGridLayout = function (_a) {
|
|
|
554
539
|
var editable = editableBlockIds.includes(Number(l.i));
|
|
555
540
|
var z = l.z || 0;
|
|
556
541
|
var isInBulk = blockStructure && (bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(formatCbIdToBlockId(Number(l.i))));
|
|
542
|
+
var isInGroup = blockStructure &&
|
|
543
|
+
selectedGroupBlock !== "ROOT" &&
|
|
544
|
+
findAllChildrenCbIds(blockStructure, selectedGroupBlock).includes(Number(l.i));
|
|
557
545
|
var isRoot = editingGroupBlock === "ROOT";
|
|
558
546
|
var block = blockStructure
|
|
559
547
|
? findBlockByBlockId(blockStructure, formatCbIdToBlockId(Number(l.i)))
|
|
@@ -585,11 +573,49 @@ var ReactGridLayout = function (_a) {
|
|
|
585
573
|
return z;
|
|
586
574
|
})();
|
|
587
575
|
var zIndex = editorMode === "EDIT" ? editorZIndex : z;
|
|
588
|
-
|
|
576
|
+
// Check if a layout item overlaps any of the activeRows (vertical overlap)
|
|
577
|
+
var isOverlappingActiveRows = function (item) {
|
|
578
|
+
if ((activeBlock === null || activeBlock === void 0 ? void 0 : activeBlock.type) === "COMPONENT_BLOCK") {
|
|
579
|
+
if ((parsedSelectedBlockId === null || parsedSelectedBlockId === void 0 ? void 0 : parsedSelectedBlockId.cbId) === item.i) {
|
|
580
|
+
return false;
|
|
581
|
+
}
|
|
582
|
+
if (!(activeDragItemOrSelectedItem === null || activeDragItemOrSelectedItem === void 0 ? void 0 : activeDragItemOrSelectedItem.heightFitContent)) {
|
|
583
|
+
return false;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
if ((activeBlock === null || activeBlock === void 0 ? void 0 : activeBlock.type) === "GROUP_BLOCK") {
|
|
587
|
+
var hasFitContentCB = getShowActiveRows(activeBlock, layout);
|
|
588
|
+
if (!hasFitContentCB) {
|
|
589
|
+
return false;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
if (!activeRows || activeRows.length === 0) {
|
|
593
|
+
return false;
|
|
594
|
+
}
|
|
595
|
+
var minActive = Math.min.apply(Math, activeRows);
|
|
596
|
+
var maxActive = Math.max.apply(Math, activeRows);
|
|
597
|
+
var itemTop = item.y;
|
|
598
|
+
var itemBottom = item.y + item.h - 1;
|
|
599
|
+
// overlap if ranges [itemTop, itemBottom] and [minActive, maxActive] intersect
|
|
600
|
+
return !(itemBottom < minActive || itemTop > maxActive);
|
|
601
|
+
};
|
|
602
|
+
var overlapsActiveRows = isOverlappingActiveRows({
|
|
603
|
+
w: l.w,
|
|
604
|
+
h: l.h,
|
|
605
|
+
x: l.x,
|
|
606
|
+
y: l.y,
|
|
607
|
+
i: l.i,
|
|
608
|
+
});
|
|
609
|
+
var showBlockData = editable && !isInBulk && overlapsActiveRows;
|
|
610
|
+
return (_jsx(GridItem, { heightFitContent: !!(l === null || l === void 0 ? void 0 : l.heightFitContent), isheightVariable: device === "DESKTOP"
|
|
611
|
+
? !!block.isHeightVariableDesktop
|
|
612
|
+
: !!block.isHeightVariableMobile, parentGroupId: parent ? parent.blockId : undefined, className: classNames({
|
|
589
613
|
"editable-grid-item": !isRoot && editable,
|
|
590
|
-
"not-editable-grid-item": !editable,
|
|
614
|
+
"not-editable-grid-item": !isRoot && !editable,
|
|
591
615
|
"bulk-child-item": isInBulk,
|
|
592
616
|
"outside-of-editing-group": !isInsideOfEditingGroup,
|
|
617
|
+
"show-block-data": showBlockData,
|
|
618
|
+
"is-in-group": isInGroup,
|
|
593
619
|
}), z: zIndex, zOrder: l.z, zOrderInternal: parent
|
|
594
620
|
? "".concat(parent[device === "DESKTOP"
|
|
595
621
|
? "zOrderDesktopInternal"
|
|
@@ -696,7 +722,7 @@ var ReactGridLayout = function (_a) {
|
|
|
696
722
|
return zIndexMap.EDITABLE_GROUP + internalZOrder;
|
|
697
723
|
}
|
|
698
724
|
if (type === "GROUP_BLOCK") {
|
|
699
|
-
return zIndexMap.
|
|
725
|
+
return zIndexMap.GROUP;
|
|
700
726
|
}
|
|
701
727
|
return -1; // NOTE: ERROR
|
|
702
728
|
})();
|
|
@@ -714,7 +740,9 @@ var ReactGridLayout = function (_a) {
|
|
|
714
740
|
var parent = blockStructure
|
|
715
741
|
? findParentGroupBlock(blockStructure, block.blockId)
|
|
716
742
|
: null;
|
|
717
|
-
return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, children: _jsx(GroupItem, {
|
|
743
|
+
return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, children: _jsx(GroupItem, { heightFitContent: false, isheightVariable: device === "DESKTOP"
|
|
744
|
+
? !!block.isHeightVariableDesktop
|
|
745
|
+
: !!block.isHeightVariableMobile, className: classNames({
|
|
718
746
|
"bulk-child-item": isInBulk,
|
|
719
747
|
"grid-bulk-block": block.blockId === "BULK",
|
|
720
748
|
editing: editingGroupBlock === block.blockId,
|
|
@@ -737,11 +765,39 @@ var ReactGridLayout = function (_a) {
|
|
|
737
765
|
var currentGroupBlocks = blockStructure
|
|
738
766
|
? findGroupBlocks(blockStructure, editingGroupBlock)
|
|
739
767
|
: [];
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
768
|
+
function generateGrouplayout(groupblockId) {
|
|
769
|
+
if (!blockStructure) {
|
|
770
|
+
return null;
|
|
771
|
+
}
|
|
772
|
+
var childrenIds = findAllChildrenCbIds(blockStructure, groupblockId).map(function (i) { return i.toString(); });
|
|
773
|
+
var groupItem = getBoundingArea(layout, childrenIds);
|
|
774
|
+
if (!groupItem) {
|
|
775
|
+
return null;
|
|
776
|
+
}
|
|
777
|
+
return __assign({ i: groupblockId }, groupItem);
|
|
778
|
+
}
|
|
779
|
+
var selectedLayoutItem = (parsedSelectedBlockId === null || parsedSelectedBlockId === void 0 ? void 0 : parsedSelectedBlockId.type) === "CB"
|
|
780
|
+
? getLayoutItem(layout, parsedSelectedBlockId.cbId)
|
|
781
|
+
: (parsedSelectedBlockId === null || parsedSelectedBlockId === void 0 ? void 0 : parsedSelectedBlockId.type) === "GB"
|
|
782
|
+
? generateGrouplayout(parsedSelectedBlockId.blockId)
|
|
783
|
+
: null;
|
|
784
|
+
var activeDragItemOrSelectedItem = activeDrag || selectedLayoutItem;
|
|
785
|
+
var activeBlock = activeDragItemOrSelectedItem && parsedSelectedBlockId
|
|
786
|
+
? blockStructure
|
|
787
|
+
? findBlockByBlockId(blockStructure, parsedSelectedBlockId.blockId)
|
|
788
|
+
: null
|
|
789
|
+
: null;
|
|
790
|
+
var activeRows = activeDragItemOrSelectedItem &&
|
|
791
|
+
Array.from({ length: activeDragItemOrSelectedItem.h }, function (_, i) { return activeDragItemOrSelectedItem.y + i; });
|
|
792
|
+
var heightVariableRows = getRowsForHeightFitContentItems(layout);
|
|
793
|
+
var shouldShowAllHeightVariableRows = device === "DESKTOP"
|
|
794
|
+
? activeBlock === null || activeBlock === void 0 ? void 0 : activeBlock.isHeightVariableDesktop
|
|
795
|
+
: activeBlock === null || activeBlock === void 0 ? void 0 : activeBlock.isHeightVariableMobile;
|
|
796
|
+
var activeRowsFiltered = shouldShowAllHeightVariableRows
|
|
797
|
+
? heightVariableRows
|
|
798
|
+
: activeRows;
|
|
799
|
+
return (_jsxs("div", { ref: innerRef, className: mergedClassName, style: mergedStyle, onDrop: isDroppable ? onDropHandler : noop, onDragLeave: isDroppable ? onDragLeaveHandler : noop, onDragEnter: isDroppable ? onDragEnterHandler : noop, onDragOver: isDroppable ? onDragOverHandler : noop, "data-grid-row-height": rowHeight, "data-grid-cols": cols, "data-section-id": sectionId, children: [currentGroupBlocks.map(function (each) { return processGroup(each); }), React.Children.map(children, function (child) { return processGridItem(child); }), placeholder(), activeDrag && _jsx("div", { className: "grid-guide-line-center" }), activeDragItemOrSelectedItem && (_jsx(GridBackgroundPlaceholder, { device: device, backgroundWidth: getBackgroundWidth(), backgroundHeight: getBackgroundHeight(), margin: margin,
|
|
800
|
+
// width={width}
|
|
801
|
+
rowHeight: rowHeight, activeRows: activeRowsFiltered !== null && activeRowsFiltered !== void 0 ? activeRowsFiltered : [], colWidth: colWidth, activeDrag: activeDragItemOrSelectedItem, activeBlock: activeBlock, selectedBlockId: selectedBlockId, totalCols: cols, layout: layout }))] }));
|
|
746
802
|
};
|
|
747
803
|
export default ReactGridLayout;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResponsiveGridLayoutProps } from
|
|
2
|
-
import { PropsWithChildren } from
|
|
1
|
+
import { ResponsiveGridLayoutProps } from "./types";
|
|
2
|
+
import { PropsWithChildren } from "../types";
|
|
3
3
|
export declare const ResponsiveGridLayout: ({ children, ...props }: PropsWithChildren<ResponsiveGridLayoutProps>) => React.ReactElement;
|
|
4
4
|
export default ResponsiveGridLayout;
|