publ-echo-test 0.0.332 → 0.0.333

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