publ-echo-test 0.0.332 → 0.0.334
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/dist/external-lib/classnames/index.d.ts +5 -0
- package/dist/external-lib/classnames/index.js +60 -0
- package/dist/external-lib/lodash.isEqual/index.d.ts +30 -0
- package/dist/external-lib/lodash.isEqual/index.js +1661 -0
- package/dist/lib/Draggable/Draggable.d.ts +17 -0
- package/dist/lib/Draggable/Draggable.js +192 -0
- package/dist/lib/Draggable/DraggableCore.d.ts +5 -0
- package/dist/lib/Draggable/DraggableCore.js +267 -0
- package/dist/lib/Draggable/constants.d.ts +12 -0
- package/dist/lib/Draggable/constants.js +12 -0
- package/dist/lib/Draggable/index.d.ts +2 -0
- package/dist/lib/Draggable/index.js +2 -0
- package/dist/lib/Draggable/types.d.ts +55 -0
- package/dist/lib/Draggable/types.js +1 -0
- package/dist/lib/Draggable/utils/domHelpers.d.ts +22 -0
- package/dist/lib/Draggable/utils/domHelpers.js +222 -0
- package/dist/lib/Draggable/utils/getPrefix.d.ts +5 -0
- package/dist/lib/Draggable/utils/getPrefix.js +41 -0
- package/dist/lib/Draggable/utils/positionHelpers.d.ts +7 -0
- package/dist/lib/Draggable/utils/positionHelpers.js +32 -0
- package/dist/lib/Draggable/utils/types.d.ts +30 -0
- package/dist/lib/Draggable/utils/types.js +1 -0
- package/dist/lib/Draggable/utils/validationHelpers.d.ts +4 -0
- package/dist/lib/Draggable/utils/validationHelpers.js +16 -0
- package/dist/lib/GridItem/GridItem.d.ts +5 -0
- package/dist/lib/GridItem/GridItem.js +417 -0
- package/dist/lib/GridItem/GroupItem.d.ts +10 -0
- package/dist/lib/GridItem/GroupItem.js +473 -0
- package/dist/lib/GridItem/OutsideClickHandler.d.ts +7 -0
- package/dist/lib/GridItem/OutsideClickHandler.js +112 -0
- package/dist/lib/GridItem/index.d.ts +1 -0
- package/dist/lib/GridItem/index.js +1 -0
- package/dist/lib/GridItem/types.d.ts +112 -0
- package/dist/lib/GridItem/types.js +1 -0
- package/dist/lib/GridItem/utils/calculateUtils.d.ts +30 -0
- package/dist/lib/GridItem/utils/calculateUtils.js +115 -0
- package/dist/lib/GridLayoutEditor/ReactGridLayout.d.ts +6 -0
- package/dist/lib/GridLayoutEditor/ReactGridLayout.js +747 -0
- package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.d.ts +4 -0
- package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.js +117 -0
- package/dist/lib/GridLayoutEditor/group.d.ts +58 -0
- package/dist/lib/GridLayoutEditor/group.js +341 -0
- package/dist/lib/GridLayoutEditor/index.d.ts +3 -0
- package/dist/lib/GridLayoutEditor/index.js +2 -0
- package/dist/lib/GridLayoutEditor/types.d.ts +170 -0
- package/dist/lib/GridLayoutEditor/types.js +1 -0
- package/dist/lib/GridLayoutEditor/utils/renderHelpers.d.ts +173 -0
- package/dist/lib/GridLayoutEditor/utils/renderHelpers.js +607 -0
- package/dist/lib/GridLayoutEditor/utils/responsiveUtils.d.ts +26 -0
- package/dist/lib/GridLayoutEditor/utils/responsiveUtils.js +77 -0
- package/dist/lib/Resizable/Resizable.d.ts +6 -0
- package/dist/lib/Resizable/Resizable.js +289 -0
- package/dist/lib/Resizable/ResizableBox.d.ts +7 -0
- package/dist/lib/Resizable/ResizableBox.js +57 -0
- package/dist/lib/Resizable/index.d.ts +1 -0
- package/dist/lib/Resizable/index.js +1 -0
- package/dist/lib/Resizable/types.d.ts +69 -0
- package/dist/lib/Resizable/types.js +1 -0
- package/dist/lib/Resizable/utils/cloneElement.d.ts +2 -0
- package/dist/lib/Resizable/utils/cloneElement.js +21 -0
- package/dist/lib/components/WidthProvider.d.ts +9 -0
- package/dist/lib/components/WidthProvider.js +65 -0
- package/dist/lib/components/index.d.ts +1 -0
- package/dist/lib/components/index.js +1 -0
- package/dist/lib/components/types.d.ts +13 -0
- package/dist/lib/components/types.js +1 -0
- package/dist/lib/index.d.ts +5 -0
- package/dist/lib/index.js +5 -0
- package/dist/lib/types.d.ts +4 -0
- package/dist/lib/types.js +1 -0
- package/dist/lib/utils/classNames.d.ts +3 -0
- package/dist/lib/utils/classNames.js +10 -0
- package/package.json +1 -1
@@ -0,0 +1,747 @@
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
24
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
25
|
+
if (ar || !(i in from)) {
|
26
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
27
|
+
ar[i] = from[i];
|
28
|
+
}
|
29
|
+
}
|
30
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
31
|
+
};
|
32
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
33
|
+
import * as React from "react";
|
34
|
+
import { useState, useRef, useLayoutEffect } from "react";
|
35
|
+
import classNames from "../../external-lib/classnames";
|
36
|
+
import { bottom, cloneLayoutItem, compact, getAllCollisions, getBoundingArea, getLayoutItem, moveElement, noop, synchronizeLayoutWithChildren, withLayoutItem, } from "./utils/renderHelpers";
|
37
|
+
import { calcGridColWidth, calcXY, resolveRowHeight, } from "../GridItem/utils/calculateUtils";
|
38
|
+
import GridItem from "../GridItem/GridItem";
|
39
|
+
import isEqual from "../../external-lib/lodash.isEqual";
|
40
|
+
import { findAllChildrenCbIds, findBlockByBlockId, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, findParentGroupBlock, formatCbIdToBlockId, getBlockSpecificType, zIndexMap, } from "./group";
|
41
|
+
import GroupItem from "../GridItem/GroupItem";
|
42
|
+
import OutsideClickHandler from "../GridItem/OutsideClickHandler";
|
43
|
+
var layoutClassName = "react-grid-layout";
|
44
|
+
var ReactGridLayout = function (_a) {
|
45
|
+
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 ? {
|
47
|
+
i: "__dropping-elem__",
|
48
|
+
h: 1,
|
49
|
+
w: 1,
|
50
|
+
} : _w, // TODO fix
|
51
|
+
_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 device = cols === 24 ? "DESKTOP" : "MOBILE";
|
54
|
+
var _2 = useState(), activeDrag = _2[0], setActiveDrag = _2[1];
|
55
|
+
var _3 = useState(), oldDragItem = _3[0], setOldDragItem = _3[1];
|
56
|
+
var _4 = useState(), oldLayout = _4[0], setOldLayout = _4[1];
|
57
|
+
var _5 = useState(), oldResizeItem = _5[0], setOldResizeItem = _5[1];
|
58
|
+
var _6 = useState(), droppingDOMNode = _6[0], setDroppingDOMNode = _6[1];
|
59
|
+
var _7 = useState(), droppingPosition = _7[0], setDroppingPosition = _7[1];
|
60
|
+
var _8 = useState(false), isMounted = _8[0], setIsMounted = _8[1];
|
61
|
+
var editorMode = props.isDraggable && props.isResizable ? "EDIT" : "VIEW";
|
62
|
+
var editableBlockIds = blockStructure
|
63
|
+
? findDirectChildrenCbIds(blockStructure, editingGroupBlock)
|
64
|
+
: [];
|
65
|
+
var editingGroupAllChildren = blockStructure && editingGroupBlock
|
66
|
+
? findAllChildrenCbIds(blockStructure, editingGroupBlock).map(function (i) {
|
67
|
+
return i.toString();
|
68
|
+
})
|
69
|
+
: [];
|
70
|
+
var _9 = useState([]), oldGroupChildren = _9[0], setOldGroupChildren = _9[1];
|
71
|
+
var _10 = useState(function () {
|
72
|
+
return synchronizeLayoutWithChildren(props.layout || [], children, cols, compactType, allowOverlap);
|
73
|
+
}), layout = _10[0], setLayout = _10[1];
|
74
|
+
var dragEnterCounter = useRef(0);
|
75
|
+
useLayoutEffect(function () {
|
76
|
+
setIsMounted(true);
|
77
|
+
onLayoutMaybeChanged(layout, layout);
|
78
|
+
}, []);
|
79
|
+
useLayoutEffect(function () {
|
80
|
+
if (props.layout && !Array.isArray(props.layout)) {
|
81
|
+
console.error("Expecting layout to be an Array but got: ", props.layout);
|
82
|
+
}
|
83
|
+
setLayout(synchronizeLayoutWithChildren(props.layout || [], children, cols, compactType, allowOverlap));
|
84
|
+
}, [props.layout]);
|
85
|
+
useLayoutEffect(function () {
|
86
|
+
var newLayout = synchronizeLayoutWithChildren(props.layout || layout, children, props.cols || cols, props.compactType || "vertical", props.allowOverlap);
|
87
|
+
setLayout(newLayout);
|
88
|
+
}, [children]);
|
89
|
+
var getPositionParams = function () {
|
90
|
+
return {
|
91
|
+
cols: cols,
|
92
|
+
margin: margin,
|
93
|
+
maxRows: maxRows,
|
94
|
+
rowHeight: rowHeight,
|
95
|
+
containerWidth: width,
|
96
|
+
containerPadding: containerPadding || margin,
|
97
|
+
};
|
98
|
+
};
|
99
|
+
var colWidth = customColWidth !== null && customColWidth !== void 0 ? customColWidth : calcGridColWidth(getPositionParams());
|
100
|
+
/**
|
101
|
+
* Calculates a pixel value for the container.
|
102
|
+
* @return {String} Container height in pixels.
|
103
|
+
*/
|
104
|
+
var containerHeight = function () {
|
105
|
+
if (!autoSize)
|
106
|
+
return;
|
107
|
+
var nbRow = bottom(layout);
|
108
|
+
var biggerNbRow = minNbRow ? Math.max(nbRow, minNbRow) : nbRow;
|
109
|
+
var containerPaddingY = containerPadding
|
110
|
+
? containerPadding[1]
|
111
|
+
: margin[1];
|
112
|
+
return (biggerNbRow * resolveRowHeight(rowHeight, colWidth) +
|
113
|
+
(biggerNbRow - 1) * margin[1] +
|
114
|
+
containerPaddingY * 2 +
|
115
|
+
"px");
|
116
|
+
};
|
117
|
+
var getBackgroundHeight = function () {
|
118
|
+
if (!autoSize)
|
119
|
+
return;
|
120
|
+
var nbRow = bottom(layout);
|
121
|
+
var biggerNbRow = minNbRow ? Math.max(nbRow, minNbRow) : nbRow;
|
122
|
+
var containerPaddingY = containerPadding
|
123
|
+
? containerPadding[1]
|
124
|
+
: margin[1];
|
125
|
+
return (biggerNbRow * resolveRowHeight(rowHeight, colWidth) +
|
126
|
+
(biggerNbRow - 1) * margin[1] +
|
127
|
+
containerPaddingY * 2 -
|
128
|
+
2 * margin[1] +
|
129
|
+
"px");
|
130
|
+
};
|
131
|
+
var getBackgroundWidth = function () {
|
132
|
+
if (!autoSize)
|
133
|
+
return;
|
134
|
+
return width - margin[0] * 2 + "px";
|
135
|
+
};
|
136
|
+
/**
|
137
|
+
* When dragging starts
|
138
|
+
* @param {String} i Id of the child
|
139
|
+
* @param {Number} x X position of the move
|
140
|
+
* @param {Number} y Y position of the move
|
141
|
+
* @param {Event} e The mousedown event
|
142
|
+
* @param {Element} node The current dragging DOM element
|
143
|
+
*/
|
144
|
+
var onDragStartHandler = function (i, x, y, _a, isGroup) {
|
145
|
+
var _b;
|
146
|
+
var e = _a.e, node = _a.node;
|
147
|
+
var l = (_b = getLayoutItem(layout, i)) !== null && _b !== void 0 ? _b : { i: i, x: x, y: y, w: 1, h: 1 };
|
148
|
+
if (!l)
|
149
|
+
return;
|
150
|
+
setOldDragItem(cloneLayoutItem(l));
|
151
|
+
setOldLayout(layout);
|
152
|
+
if (isGroup) {
|
153
|
+
if (!blockStructure) {
|
154
|
+
return;
|
155
|
+
}
|
156
|
+
var childrenIds = findAllChildrenCbIds(blockStructure, i).map(function (i) {
|
157
|
+
return i.toString();
|
158
|
+
});
|
159
|
+
var children_1 = childrenIds.map(function (id) {
|
160
|
+
var item = getLayoutItem(layout, id);
|
161
|
+
return cloneLayoutItem(item);
|
162
|
+
});
|
163
|
+
setOldGroupChildren(children_1);
|
164
|
+
}
|
165
|
+
props.onDragStart &&
|
166
|
+
props.onDragStart({
|
167
|
+
layout: layout,
|
168
|
+
prev: l,
|
169
|
+
item: l,
|
170
|
+
placeholder: undefined,
|
171
|
+
e: e,
|
172
|
+
node: node,
|
173
|
+
});
|
174
|
+
};
|
175
|
+
var onDragStartHandlerGroup = function (i, x, y, _a, isGroup) {
|
176
|
+
// const l = getLayoutItem(layout, i);
|
177
|
+
var e = _a.e, node = _a.node;
|
178
|
+
// if (!l) return;
|
179
|
+
// setOldDragItem(cloneLayoutItem(l));
|
180
|
+
setOldLayout(layout);
|
181
|
+
if (isGroup) {
|
182
|
+
if (!blockStructure) {
|
183
|
+
return;
|
184
|
+
}
|
185
|
+
var children_2 = findDirectChildrenBlockIds(blockStructure, i).map(function (id) {
|
186
|
+
var item = getLayoutItem(layout, id);
|
187
|
+
return cloneLayoutItem(item);
|
188
|
+
});
|
189
|
+
setOldGroupChildren(children_2);
|
190
|
+
}
|
191
|
+
// props.onDragStart &&
|
192
|
+
// props.onDragStart({
|
193
|
+
// layout,
|
194
|
+
// prev: l,
|
195
|
+
// item: l,
|
196
|
+
// placeholder: undefined,
|
197
|
+
// e,
|
198
|
+
// node,
|
199
|
+
// });
|
200
|
+
};
|
201
|
+
/**
|
202
|
+
* Each drag movement create a new dragelement and move the element to the dragged location
|
203
|
+
* @param {String} i Id of the child
|
204
|
+
* @param {Number} x X position of the move
|
205
|
+
* @param {Number} y Y position of the move
|
206
|
+
* @param {Event} e The mousedown event
|
207
|
+
* @param {Element} node The current dragging DOM element
|
208
|
+
*/
|
209
|
+
var onDragHandler = function (i, x, y, _a, isGroup) {
|
210
|
+
var _b;
|
211
|
+
var e = _a.e, node = _a.node;
|
212
|
+
var l = (_b = getLayoutItem(layout, i)) !== null && _b !== void 0 ? _b : { i: i, x: x, y: y, w: 10, h: 10 };
|
213
|
+
if (!l)
|
214
|
+
return;
|
215
|
+
if (!oldDragItem) {
|
216
|
+
return;
|
217
|
+
}
|
218
|
+
var xgap = x - oldDragItem.x;
|
219
|
+
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
|
+
};
|
229
|
+
var isUserAction = true;
|
230
|
+
var newLayout = isGroup
|
231
|
+
? layout
|
232
|
+
: moveElement({
|
233
|
+
layout: layout,
|
234
|
+
l: l,
|
235
|
+
x: x,
|
236
|
+
y: y,
|
237
|
+
isUserAction: isUserAction,
|
238
|
+
preventCollision: preventCollision,
|
239
|
+
compactType: compactType,
|
240
|
+
cols: cols,
|
241
|
+
allowOverlap: allowOverlap,
|
242
|
+
});
|
243
|
+
if (isGroup) {
|
244
|
+
oldGroupChildren.forEach(function (item) {
|
245
|
+
var layoutItem = getLayoutItem(layout, item.i);
|
246
|
+
newLayout = moveElement({
|
247
|
+
layout: layout,
|
248
|
+
l: layoutItem,
|
249
|
+
x: item.x + xgap,
|
250
|
+
y: item.y + ygap,
|
251
|
+
isUserAction: isUserAction,
|
252
|
+
preventCollision: preventCollision,
|
253
|
+
compactType: compactType,
|
254
|
+
cols: cols,
|
255
|
+
allowOverlap: allowOverlap,
|
256
|
+
});
|
257
|
+
});
|
258
|
+
}
|
259
|
+
props.onDrag &&
|
260
|
+
props.onDrag({
|
261
|
+
layout: newLayout,
|
262
|
+
prev: oldDragItem,
|
263
|
+
item: l,
|
264
|
+
placeholder: placeholder,
|
265
|
+
e: e,
|
266
|
+
node: node,
|
267
|
+
});
|
268
|
+
setLayout(allowOverlap ? newLayout : compact(newLayout, compactType, cols));
|
269
|
+
setActiveDrag(placeholder);
|
270
|
+
};
|
271
|
+
/**
|
272
|
+
* When dragging stops, figure out which position the element is closest to and update its x and y.
|
273
|
+
* @param {String} i Index of the child.
|
274
|
+
* @param {Number} x X position of the move
|
275
|
+
* @param {Number} y Y position of the move
|
276
|
+
* @param {Event} e The mousedown event
|
277
|
+
* @param {Element} node The current dragging DOM element
|
278
|
+
*/
|
279
|
+
var onDragStopHandler = function (i, x, y, _a) {
|
280
|
+
var _b;
|
281
|
+
var e = _a.e, node = _a.node;
|
282
|
+
if (!activeDrag || !oldDragItem) {
|
283
|
+
return;
|
284
|
+
}
|
285
|
+
var l = (_b = getLayoutItem(layout, i)) !== null && _b !== void 0 ? _b : { i: i, x: x, y: y, w: 10, h: 10 };
|
286
|
+
if (!l)
|
287
|
+
return;
|
288
|
+
// NOTE: z-index 원래대로 복귀
|
289
|
+
l.z = oldDragItem.z;
|
290
|
+
var isUserAction = true;
|
291
|
+
var movedLayout = moveElement({
|
292
|
+
layout: layout,
|
293
|
+
l: l,
|
294
|
+
x: x,
|
295
|
+
y: y,
|
296
|
+
isUserAction: isUserAction,
|
297
|
+
preventCollision: preventCollision,
|
298
|
+
compactType: compactType,
|
299
|
+
cols: cols,
|
300
|
+
allowOverlap: allowOverlap,
|
301
|
+
overrideZ: oldDragItem.z,
|
302
|
+
});
|
303
|
+
props.onDragStop &&
|
304
|
+
props.onDragStop({
|
305
|
+
layout: movedLayout,
|
306
|
+
prev: oldDragItem,
|
307
|
+
item: l,
|
308
|
+
placeholder: undefined,
|
309
|
+
e: e,
|
310
|
+
node: node,
|
311
|
+
});
|
312
|
+
var newLayout = allowOverlap
|
313
|
+
? movedLayout
|
314
|
+
: compact(movedLayout, compactType, cols);
|
315
|
+
setActiveDrag(undefined);
|
316
|
+
setLayout(newLayout);
|
317
|
+
setOldDragItem(undefined);
|
318
|
+
setOldLayout(undefined);
|
319
|
+
setOldGroupChildren([]);
|
320
|
+
props.onLayoutChange && props.onLayoutChange(newLayout);
|
321
|
+
};
|
322
|
+
var onDragStopGroupHandler = function (i, x, y, _a) {
|
323
|
+
var _b;
|
324
|
+
var e = _a.e, node = _a.node;
|
325
|
+
if (!activeDrag || !oldDragItem) {
|
326
|
+
return;
|
327
|
+
}
|
328
|
+
var l = (_b = getLayoutItem(layout, i)) !== null && _b !== void 0 ? _b : { i: i, x: x, y: y, w: 10, h: 10 };
|
329
|
+
if (!l)
|
330
|
+
return;
|
331
|
+
// NOTE: z-index 원래대로 복귀
|
332
|
+
l.z = oldDragItem.z;
|
333
|
+
var isUserAction = true;
|
334
|
+
var movedLayout = moveElement({
|
335
|
+
layout: layout,
|
336
|
+
l: l,
|
337
|
+
x: x,
|
338
|
+
y: y,
|
339
|
+
isUserAction: isUserAction,
|
340
|
+
preventCollision: preventCollision,
|
341
|
+
compactType: compactType,
|
342
|
+
cols: cols,
|
343
|
+
allowOverlap: allowOverlap,
|
344
|
+
overrideZ: oldDragItem.z,
|
345
|
+
});
|
346
|
+
var updatedItems = oldGroupChildren.map(function (item) {
|
347
|
+
var layoutItem = getLayoutItem(layout, item.i);
|
348
|
+
return {
|
349
|
+
id: layoutItem.i,
|
350
|
+
x: layoutItem.x,
|
351
|
+
y: layoutItem.y,
|
352
|
+
};
|
353
|
+
});
|
354
|
+
props.onDragStopForGroup &&
|
355
|
+
props.onDragStopForGroup({
|
356
|
+
layout: movedLayout,
|
357
|
+
prev: oldDragItem,
|
358
|
+
item: l,
|
359
|
+
placeholder: undefined,
|
360
|
+
e: e,
|
361
|
+
node: node,
|
362
|
+
updatedItems: updatedItems,
|
363
|
+
});
|
364
|
+
var newLayout = allowOverlap
|
365
|
+
? movedLayout
|
366
|
+
: compact(movedLayout, compactType, cols);
|
367
|
+
setActiveDrag(undefined);
|
368
|
+
setLayout(newLayout);
|
369
|
+
setOldDragItem(undefined);
|
370
|
+
setOldLayout(undefined);
|
371
|
+
setOldGroupChildren([]);
|
372
|
+
props.onLayoutChange && props.onLayoutChange(newLayout);
|
373
|
+
};
|
374
|
+
var onLayoutMaybeChanged = function (newLayout, oldLayout) {
|
375
|
+
if (!oldLayout) {
|
376
|
+
oldLayout = layout;
|
377
|
+
}
|
378
|
+
if (!isEqual(oldLayout, newLayout)) {
|
379
|
+
props.onLayoutChange && props.onLayoutChange(newLayout);
|
380
|
+
}
|
381
|
+
};
|
382
|
+
var onResizeStartHandler = function (i, x, y, _a) {
|
383
|
+
var e = _a.e, node = _a.node;
|
384
|
+
var l = getLayoutItem(layout, i);
|
385
|
+
if (!l)
|
386
|
+
return;
|
387
|
+
setOldResizeItem(cloneLayoutItem(l));
|
388
|
+
setOldLayout(layout);
|
389
|
+
props.onResizeStart &&
|
390
|
+
props.onResizeStart({
|
391
|
+
layout: layout,
|
392
|
+
prev: l,
|
393
|
+
item: l,
|
394
|
+
e: e,
|
395
|
+
node: node,
|
396
|
+
});
|
397
|
+
};
|
398
|
+
var onResizeHandler = function (i, w, h, _a, x, y) {
|
399
|
+
var e = _a.e, node = _a.node;
|
400
|
+
var _b = withLayoutItem(layout, i, function (l) {
|
401
|
+
var hasCollisions;
|
402
|
+
if (preventCollision && !allowOverlap) {
|
403
|
+
var collisions = getAllCollisions(layout, __assign(__assign({}, l), { w: x, h: y })).filter(function (layoutItem) { return layoutItem.i !== l.i; });
|
404
|
+
hasCollisions = collisions.length > 0;
|
405
|
+
if (hasCollisions) {
|
406
|
+
var leastX_1 = Infinity, leastY_1 = Infinity;
|
407
|
+
collisions.forEach(function (layoutItem) {
|
408
|
+
if (layoutItem.x > l.x)
|
409
|
+
leastX_1 = Math.min(leastX_1, layoutItem.x);
|
410
|
+
if (layoutItem.y > l.y)
|
411
|
+
leastY_1 = Math.min(leastY_1, layoutItem.y);
|
412
|
+
});
|
413
|
+
if (Number.isFinite(leastX_1))
|
414
|
+
l.w = leastX_1 - l.x;
|
415
|
+
if (Number.isFinite(leastY_1))
|
416
|
+
l.h = leastY_1 - l.y;
|
417
|
+
}
|
418
|
+
}
|
419
|
+
if (!hasCollisions) {
|
420
|
+
// NOTE - 여기서 x, y를 추가적으로 세팅해줘야 nw, w, n, sw 방향에서 placeholder가 반대로 resize되지 않고 해당 element와 똑같이 resize
|
421
|
+
l.w = w;
|
422
|
+
l.h = h;
|
423
|
+
l.x = x;
|
424
|
+
l.y = y;
|
425
|
+
}
|
426
|
+
return l;
|
427
|
+
}), newLayout = _b[0], l = _b[1];
|
428
|
+
if (!l)
|
429
|
+
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
|
+
};
|
439
|
+
props.onResize &&
|
440
|
+
props.onResize({
|
441
|
+
layout: newLayout,
|
442
|
+
prev: oldResizeItem,
|
443
|
+
item: l,
|
444
|
+
placeholder: placeholder,
|
445
|
+
e: e,
|
446
|
+
node: node,
|
447
|
+
});
|
448
|
+
setLayout(allowOverlap ? newLayout : compact(newLayout, compactType, cols));
|
449
|
+
setActiveDrag(placeholder);
|
450
|
+
};
|
451
|
+
var onResizeStopHandler = function (i, x, y, _a) {
|
452
|
+
var e = _a.e, node = _a.node;
|
453
|
+
var l = getLayoutItem(layout, i);
|
454
|
+
props.onResizeStop &&
|
455
|
+
props.onResizeStop({ layout: layout, prev: oldResizeItem, item: l, e: e, node: node });
|
456
|
+
var newLayout = allowOverlap
|
457
|
+
? layout
|
458
|
+
: compact(layout, compactType, cols);
|
459
|
+
setActiveDrag(undefined);
|
460
|
+
setLayout(newLayout);
|
461
|
+
setOldResizeItem(undefined);
|
462
|
+
setOldLayout(undefined);
|
463
|
+
onLayoutMaybeChanged(newLayout, oldLayout);
|
464
|
+
};
|
465
|
+
var onFitToContentHandler = function (i, w, h, x, y, _a) {
|
466
|
+
var hasPaddingChanged = _a.hasPaddingChanged;
|
467
|
+
var _b = withLayoutItem(layout, i, function (l) {
|
468
|
+
var hasCollisions;
|
469
|
+
if (preventCollision && !allowOverlap) {
|
470
|
+
var collisions = getAllCollisions(layout, __assign(__assign({}, l), { w: x, h: y })).filter(function (layoutItem) { return layoutItem.i !== l.i; });
|
471
|
+
hasCollisions = collisions.length > 0;
|
472
|
+
if (hasCollisions) {
|
473
|
+
var leastX_2 = Infinity, leastY_2 = Infinity;
|
474
|
+
collisions.forEach(function (layoutItem) {
|
475
|
+
if (layoutItem.x > l.x)
|
476
|
+
leastX_2 = Math.min(leastX_2, layoutItem.x);
|
477
|
+
if (layoutItem.y > l.y)
|
478
|
+
leastY_2 = Math.min(leastY_2, layoutItem.y);
|
479
|
+
});
|
480
|
+
if (Number.isFinite(leastX_2))
|
481
|
+
l.w = leastX_2 - l.x;
|
482
|
+
if (Number.isFinite(leastY_2))
|
483
|
+
l.h = leastY_2 - l.y;
|
484
|
+
}
|
485
|
+
}
|
486
|
+
if (!hasCollisions) {
|
487
|
+
// NOTE - 여기서 x, y를 추가적으로 세팅해줘야 nw, w, n, sw 방향에서 placeholder가 반대로 resize되지 않고 해당 element와 똑같이 resize
|
488
|
+
l.w = w;
|
489
|
+
l.h = h;
|
490
|
+
l.x = x;
|
491
|
+
l.y = y;
|
492
|
+
l.minH = h;
|
493
|
+
}
|
494
|
+
return l;
|
495
|
+
}), newLayout = _b[0], l = _b[1];
|
496
|
+
if (!l)
|
497
|
+
return;
|
498
|
+
props.onFitToContent &&
|
499
|
+
props.onFitToContent({
|
500
|
+
layout: newLayout,
|
501
|
+
prev: oldResizeItem,
|
502
|
+
item: l,
|
503
|
+
hasPaddingChanged: hasPaddingChanged,
|
504
|
+
});
|
505
|
+
setLayout(allowOverlap ? newLayout : compact(newLayout, compactType, cols));
|
506
|
+
};
|
507
|
+
/**
|
508
|
+
* Create a placeholder object.
|
509
|
+
* @return {Element} Placeholder div.
|
510
|
+
*/
|
511
|
+
var placeholder = function () {
|
512
|
+
if (!activeDrag)
|
513
|
+
return;
|
514
|
+
// {...activeDrag} is pretty slow, actually
|
515
|
+
var l = getLayoutItem(props.layout, String(activeDrag.i));
|
516
|
+
if (!l) {
|
517
|
+
return null;
|
518
|
+
}
|
519
|
+
// NOTE: toChildren changes key
|
520
|
+
// LINK: https://legacy.reactjs.org/docs/react-api.html
|
521
|
+
var items = React.Children.toArray(children);
|
522
|
+
var item = items.find(function (child) {
|
523
|
+
var originalKey = String(child.key).split(".$");
|
524
|
+
return originalKey[1] === l.i;
|
525
|
+
});
|
526
|
+
var isInBulk = blockStructure &&
|
527
|
+
(bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(formatCbIdToBlockId(Number(activeDrag.i))));
|
528
|
+
if (!item) {
|
529
|
+
return null;
|
530
|
+
}
|
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 }));
|
532
|
+
};
|
533
|
+
/**
|
534
|
+
* Given a grid item, set its style attributes & surround in a <Draggable>.
|
535
|
+
* @param {Element} child React element.
|
536
|
+
* @return {Element} Element wrapped in draggable and properly placed.
|
537
|
+
*/
|
538
|
+
var processGridItem = function (child, isDroppingItem) {
|
539
|
+
var _a;
|
540
|
+
if (!child || !child.key)
|
541
|
+
return;
|
542
|
+
var l = getLayoutItem(layout, String(child.key));
|
543
|
+
if (!l) {
|
544
|
+
return;
|
545
|
+
}
|
546
|
+
var draggable = typeof l.isDraggable === "boolean"
|
547
|
+
? l.isDraggable
|
548
|
+
: !l.static && isDraggable;
|
549
|
+
var resizable = typeof l.isResizable === "boolean"
|
550
|
+
? l.isResizable
|
551
|
+
: !l.static && isResizable;
|
552
|
+
var resizeHandlesOptions = l.resizeHandles || resizeHandles;
|
553
|
+
var bounded = draggable && isBounded && l.isBounded !== false;
|
554
|
+
var editable = editableBlockIds.includes(Number(l.i));
|
555
|
+
var z = l.z || 0;
|
556
|
+
var isInBulk = blockStructure && (bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(formatCbIdToBlockId(Number(l.i))));
|
557
|
+
var isRoot = editingGroupBlock === "ROOT";
|
558
|
+
var block = blockStructure
|
559
|
+
? findBlockByBlockId(blockStructure, formatCbIdToBlockId(Number(l.i)))
|
560
|
+
: undefined;
|
561
|
+
var parent = blockStructure
|
562
|
+
? findParentGroupBlock(blockStructure, formatCbIdToBlockId(Number(l.i)))
|
563
|
+
: null;
|
564
|
+
if (!block) {
|
565
|
+
return _jsx(_Fragment, { children: "NO-BLOCK-FOUND" });
|
566
|
+
}
|
567
|
+
var zOrder = (_a = block[device === "DESKTOP" ? "zOrderDesktopInternal" : "zOrderMobileInternal"]) !== null && _a !== void 0 ? _a : 0;
|
568
|
+
var isInsideOfEditingGroup = editingGroupAllChildren.includes(l.i);
|
569
|
+
var editorZIndex = (function () {
|
570
|
+
if (isRoot && isInBulk) {
|
571
|
+
return z;
|
572
|
+
}
|
573
|
+
if (!isRoot && isInsideOfEditingGroup) {
|
574
|
+
return zIndexMap.CB_IN_EDITING_GROUP + z;
|
575
|
+
}
|
576
|
+
if (isRoot && editable) {
|
577
|
+
return zIndexMap.ROOT + z;
|
578
|
+
}
|
579
|
+
if (isRoot && !editable) {
|
580
|
+
return z;
|
581
|
+
}
|
582
|
+
if (!editable) {
|
583
|
+
return z;
|
584
|
+
}
|
585
|
+
return z;
|
586
|
+
})();
|
587
|
+
var zIndex = editorMode === "EDIT" ? editorZIndex : z;
|
588
|
+
return (_jsx(GridItem, { className: classNames({
|
589
|
+
"editable-grid-item": !isRoot && editable,
|
590
|
+
"not-editable-grid-item": !isRoot && !editable,
|
591
|
+
"bulk-child-item": isInBulk,
|
592
|
+
"outside-of-editing-group": !isInsideOfEditingGroup,
|
593
|
+
}), z: zIndex, zOrder: l.z, zOrderInternal: parent
|
594
|
+
? "".concat(parent[device === "DESKTOP"
|
595
|
+
? "zOrderDesktopInternal"
|
596
|
+
: "zOrderMobileInternal"], " > ").concat(zOrder)
|
597
|
+
: zOrder.toString(), isDraggable: editable && !isInBulk, isResizable: editable && !isInBulk, containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, cancel: draggableCancel, handle: draggableHandle, onDragStop: onDragStopHandler, onDragStart: onDragStartHandler, onDrag: onDragHandler, onResizeStart: onResizeStartHandler, onResize: onResizeHandler, onResizeStop: onResizeStopHandler, onFitToContent: onFitToContentHandler, isBounded: bounded, useCSSTransforms: useCSSTransforms && isMounted, usePercentages: !isMounted, transformScale: transformScale, w: l.w, h: l.h, x: l.x, y: l.y, i: l.i, minH: l.minH, minW: l.minW, maxH: l.maxH, maxW: l.maxW, static: l.static, droppingPosition: isDroppingItem ? droppingPosition : undefined, resizeHandles: resizeHandlesOptions, resizeHandle: resizeHandle, isHiddenVisibility: isHiddenVisibility, customColWidth: colWidth, autoResize: !!l.autoResize, children: child }, l.i));
|
598
|
+
};
|
599
|
+
var onDragOverHandler = function (e) {
|
600
|
+
var _a;
|
601
|
+
e.preventDefault();
|
602
|
+
e.stopPropagation();
|
603
|
+
var onDragOverResult = (_a = props.onDropDragOver) === null || _a === void 0 ? void 0 : _a.call(props, e); // TODO fix
|
604
|
+
if (onDragOverResult === false) {
|
605
|
+
if (droppingDOMNode) {
|
606
|
+
removeDroppingPlaceholder();
|
607
|
+
}
|
608
|
+
return false;
|
609
|
+
}
|
610
|
+
var finalDroppingItem = __assign(__assign({}, droppingItem), onDragOverResult);
|
611
|
+
var _b = e.nativeEvent, layerX = _b.layerX, layerY = _b.layerY; // TODO fix
|
612
|
+
var droppingPosition = {
|
613
|
+
left: layerX / transformScale,
|
614
|
+
top: layerY / transformScale,
|
615
|
+
e: e,
|
616
|
+
};
|
617
|
+
if (!droppingDOMNode) {
|
618
|
+
var calculatedPosition = calcXY(getPositionParams(), layerY, layerX, finalDroppingItem.w, finalDroppingItem.h);
|
619
|
+
setDroppingDOMNode(_jsx("div", {}, finalDroppingItem.i));
|
620
|
+
setDroppingPosition(droppingPosition);
|
621
|
+
setLayout(__spreadArray(__spreadArray([], layout, true), [
|
622
|
+
__assign(__assign({}, finalDroppingItem), { x: calculatedPosition.x, y: calculatedPosition.y, static: false, isDraggable: true }),
|
623
|
+
], false));
|
624
|
+
}
|
625
|
+
else if (droppingPosition) {
|
626
|
+
var left = droppingPosition.left, top_1 = droppingPosition.top;
|
627
|
+
var shouldUpdatePosition = left != layerX || top_1 != layerY;
|
628
|
+
if (shouldUpdatePosition) {
|
629
|
+
setDroppingPosition(droppingPosition);
|
630
|
+
}
|
631
|
+
}
|
632
|
+
};
|
633
|
+
var removeDroppingPlaceholder = function () {
|
634
|
+
var newLayout = compact(layout.filter(function (l) { return l.i !== droppingItem.i; }), compactType, cols, allowOverlap);
|
635
|
+
setLayout(newLayout);
|
636
|
+
setDroppingDOMNode(undefined);
|
637
|
+
setActiveDrag(undefined);
|
638
|
+
setDroppingPosition(undefined);
|
639
|
+
};
|
640
|
+
var onDragLeaveHandler = function (e) {
|
641
|
+
e.preventDefault();
|
642
|
+
e.stopPropagation();
|
643
|
+
dragEnterCounter.current = dragEnterCounter.current - 1;
|
644
|
+
if (dragEnterCounter.current === 0) {
|
645
|
+
removeDroppingPlaceholder();
|
646
|
+
}
|
647
|
+
};
|
648
|
+
var onDragEnterHandler = function (e) {
|
649
|
+
e.preventDefault();
|
650
|
+
e.stopPropagation();
|
651
|
+
dragEnterCounter.current += 1;
|
652
|
+
};
|
653
|
+
var onDropHandler = function (e) {
|
654
|
+
e.preventDefault();
|
655
|
+
e.stopPropagation();
|
656
|
+
var item = layout.find(function (l) { return l.i === droppingItem.i; });
|
657
|
+
dragEnterCounter.current = 0;
|
658
|
+
removeDroppingPlaceholder();
|
659
|
+
if (item) {
|
660
|
+
props.onDrop && props.onDrop(layout, item, e);
|
661
|
+
}
|
662
|
+
};
|
663
|
+
var mergedClassName = classNames(layoutClassName, className);
|
664
|
+
var mergedStyle = __assign({ height: containerHeight() }, style);
|
665
|
+
var processGroup = function (block, viewOnly) {
|
666
|
+
var _a;
|
667
|
+
if (!blockStructure) {
|
668
|
+
return;
|
669
|
+
}
|
670
|
+
var childrenIds = findAllChildrenCbIds(blockStructure, block.blockId).map(function (i) { return i.toString(); });
|
671
|
+
var groupItem = getBoundingArea(layout, childrenIds);
|
672
|
+
if (!groupItem) {
|
673
|
+
return _jsx(_Fragment, {});
|
674
|
+
}
|
675
|
+
var internalZOrder = (_a = block[device === "DESKTOP" ? "zOrderDesktopInternal" : "zOrderMobileInternal"]) !== null && _a !== void 0 ? _a : 0;
|
676
|
+
var isEditingGroup = block.blockId === editingGroupBlock;
|
677
|
+
var type = getBlockSpecificType(block);
|
678
|
+
var isRoot = editingGroupBlock === "ROOT";
|
679
|
+
var isInBulk = bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(block.blockId);
|
680
|
+
var isBulk = block.blockId === "BULK";
|
681
|
+
var baseZ = (function () {
|
682
|
+
if (isBulk) {
|
683
|
+
// groupItem.z : 그룹 내 CB중 가장 큰 zorder
|
684
|
+
return zIndexMap.BULK + groupItem.z;
|
685
|
+
}
|
686
|
+
if (isInBulk) {
|
687
|
+
if (!isRoot) {
|
688
|
+
return zIndexMap.EDITABLE_GROUP + internalZOrder;
|
689
|
+
}
|
690
|
+
return zIndexMap.CB_IN_EDITING_GROUP + internalZOrder;
|
691
|
+
}
|
692
|
+
if (isEditingGroup) {
|
693
|
+
return zIndexMap.EDITING_GROUP;
|
694
|
+
}
|
695
|
+
if (type === "GROUP_BLOCK") {
|
696
|
+
return zIndexMap.ROOT + internalZOrder;
|
697
|
+
}
|
698
|
+
// if (type === "GROUP_BLOCK") {
|
699
|
+
// return internalZOrder;
|
700
|
+
// }
|
701
|
+
return -1; // NOTE: ERROR
|
702
|
+
})();
|
703
|
+
var zIndex = editorMode === "EDIT" ? baseZ : internalZOrder;
|
704
|
+
var handleClick = function (e) {
|
705
|
+
onClickGroup && onClickGroup(e, block.blockId, type);
|
706
|
+
};
|
707
|
+
var handleDoubleClick = function (e) {
|
708
|
+
onDoubleClickGroup && onDoubleClickGroup(e, block.blockId, type);
|
709
|
+
};
|
710
|
+
var handleClickContextGroup = function (e) {
|
711
|
+
(props === null || props === void 0 ? void 0 : props.onContextGroup) &&
|
712
|
+
props.onContextGroup(e, block.blockId, isEditingGroup);
|
713
|
+
};
|
714
|
+
var parent = blockStructure
|
715
|
+
? findParentGroupBlock(blockStructure, block.blockId)
|
716
|
+
: null;
|
717
|
+
return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, children: _jsx(GroupItem, { className: classNames({
|
718
|
+
"bulk-child-item": isInBulk,
|
719
|
+
"grid-bulk-block": block.blockId === "BULK",
|
720
|
+
editing: editingGroupBlock === block.blockId,
|
721
|
+
selected: selectedGroupBlock === block.blockId,
|
722
|
+
}), z: zIndex, minZ: groupItem.minZ, zOrder: internalZOrder, zOrderInternal: parent
|
723
|
+
? "".concat(parent[device === "DESKTOP"
|
724
|
+
? "zOrderDesktopInternal"
|
725
|
+
: "zOrderMobileInternal"], " > ").concat(internalZOrder)
|
726
|
+
: internalZOrder.toString(), containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, cancel: draggableCancel, handle: draggableHandle, onDragStop: onDragStopGroupHandler, onDragStart: onDragStartHandler, onDrag: onDragHandler, onResizeStart: onResizeStartHandler, onResize: onResizeHandler, onResizeStop: onResizeStopHandler, onFitToContent: onFitToContentHandler, isDraggable: !viewOnly && !isEditingGroup && !isInBulk, isResizable: !viewOnly && !isEditingGroup && !isInBulk, isBounded: false, useCSSTransforms: useCSSTransforms && isMounted, usePercentages: !isMounted, transformScale: transformScale, w: groupItem.w, h: groupItem.h, x: groupItem.x, y: groupItem.y, i: block.blockId,
|
727
|
+
// minH={l.minH}
|
728
|
+
// minW={l.minW}
|
729
|
+
// maxH={l.maxH}
|
730
|
+
// maxW={l.maxW}
|
731
|
+
// static={l.static}
|
732
|
+
// droppingPosition={isDroppingItem ? droppingPosition : undefined}
|
733
|
+
// resizeHandles={resizeHandlesOptions}
|
734
|
+
// resizeHandle={resizeHandle}
|
735
|
+
isHiddenVisibility: isHiddenVisibility, customColWidth: colWidth, autoResize: false, onContextGroup: handleClickContextGroup, children: _jsx("div", { onClick: handleClick, onDoubleClick: handleDoubleClick }) }, block.blockId) }));
|
736
|
+
};
|
737
|
+
var currentGroupBlocks = blockStructure
|
738
|
+
? findGroupBlocks(blockStructure, editingGroupBlock)
|
739
|
+
: [];
|
740
|
+
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" }), activeDrag && (_jsx("div", { className: "grid-placeholder", style: {
|
741
|
+
marginTop: margin[1] + "px",
|
742
|
+
marginBottom: margin[1] + "px",
|
743
|
+
marginLeft: margin[0] + "px",
|
744
|
+
marginRight: margin[0] + "px",
|
745
|
+
}, children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: getBackgroundWidth(), height: getBackgroundHeight(), 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: width, height: "100%", fill: "url(#grid-pattern)" })] }) }))] }));
|
746
|
+
};
|
747
|
+
export default ReactGridLayout;
|