publ-echo-test 0.0.339 → 0.0.340
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 +239 -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 +37 -38
- package/dist/lib/GridItem/types.d.ts +5 -4
- package/dist/lib/GridLayoutEditor/ReactGridLayout.js +14 -6
- package/dist/lib/GridLayoutEditor/group.d.ts +8 -0
- package/dist/lib/GridLayoutEditor/group.js +3 -1
- package/dist/lib/GridLayoutEditor/types.d.ts +10 -9
- package/dist/lib/Resizable/Resizable.d.ts +3 -3
- package/dist/lib/Resizable/Resizable.js +132 -35
- package/package.json +1 -1
package/css/gle-styles.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import React from
|
2
|
-
import { GridItemProps } from
|
3
|
-
import { PropsWithChildren } from
|
1
|
+
import React from "react";
|
2
|
+
import { GridItemProps } from "./types";
|
3
|
+
import { PropsWithChildren } from "../types";
|
4
4
|
declare const GridItem: ({ children, ...props }: PropsWithChildren<GridItemProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
5
5
|
export default GridItem;
|
@@ -21,23 +21,23 @@ 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
|
29
|
-
import { Resizable } 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
|
+
import { Resizable } from "../Resizable";
|
30
30
|
var GridItem = function (_a) {
|
31
31
|
var _b;
|
32
32
|
var children = _a.children, props = __rest(_a, ["children"]);
|
33
|
-
var resizeHandle = props.resizeHandle, cols = props.cols, 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 ?
|
33
|
+
var resizeHandle = props.resizeHandle, cols = props.cols, zOrder = props.zOrder, zOrderInternal = props.zOrderInternal, isDraggable = props.isDraggable, _c = props.transformScale, transformScale = _c === void 0 ? 1 : _c, isResizable = props.isResizable, useCSSTransforms = props.useCSSTransforms, className = props.className, _d = props.cancel, cancel = _d === void 0 ? "" : _d, _e = props.handle, handle = _e === void 0 ? "" : _e, x = props.x, y = props.y, z = props.z, w = props.w, h = props.h, _f = props.minH, minH = _f === void 0 ? 1 : _f, _g = props.minW, minW = _g === void 0 ? 1 : _g, _h = props.maxH, maxH = _h === void 0 ? Infinity : _h, _j = props.maxW, maxW = _j === void 0 ? Infinity : _j, i = props.i, _k = props.isHiddenVisibility, isHiddenVisibility = _k === void 0 ? false : _k, containerWidth = props.containerWidth, customColWidth = props.customColWidth, autoResize = props.autoResize;
|
34
34
|
var _l = useState(), resizing = _l[0], setResizing = _l[1];
|
35
35
|
var _m = useState(), dragging = _m[0], setDragging = _m[1];
|
36
36
|
var _o = useState(), dragStart = _o[0], setDragStart = _o[1];
|
37
37
|
var _p = useState(false), isDragging = _p[0], setIsDragging = _p[1];
|
38
38
|
var _q = useState(false), isResizing = _q[0], setIsResizing = _q[1];
|
39
39
|
var elementRef = useRef(null);
|
40
|
-
var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains(
|
40
|
+
var isSelected = (_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.classList.contains("react-grid-item-selected");
|
41
41
|
useEffect(function () {
|
42
42
|
var _a;
|
43
43
|
if (!isSelected || !autoResize) {
|
@@ -47,6 +47,9 @@ var GridItem = function (_a) {
|
|
47
47
|
if (!targetNode || isDragging || isResizing) {
|
48
48
|
return;
|
49
49
|
}
|
50
|
+
if (targetNode.classList.contains("ccb-layout-box")) {
|
51
|
+
return;
|
52
|
+
}
|
50
53
|
var prevPaddingL = parseFloat(getComputedStyle(targetNode).paddingLeft);
|
51
54
|
var prevPaddingR = parseFloat(getComputedStyle(targetNode).paddingRight);
|
52
55
|
var prevPaddingT = parseFloat(getComputedStyle(targetNode).paddingTop);
|
@@ -55,7 +58,7 @@ var GridItem = function (_a) {
|
|
55
58
|
var callback = function (mutationsList) {
|
56
59
|
for (var _i = 0, mutationsList_1 = mutationsList; _i < mutationsList_1.length; _i++) {
|
57
60
|
var mutation = mutationsList_1[_i];
|
58
|
-
var isCharacterChanged = mutation.type ===
|
61
|
+
var isCharacterChanged = mutation.type === "characterData";
|
59
62
|
var keepWidth = true;
|
60
63
|
var hasPaddingChanged = false;
|
61
64
|
var height = isCharacterChanged
|
@@ -86,14 +89,14 @@ var GridItem = function (_a) {
|
|
86
89
|
var _a = calcWH(getPositionParams(), {
|
87
90
|
width: width,
|
88
91
|
height: height,
|
89
|
-
}, x, y,
|
92
|
+
}, x, y, "e", props.w, props.h, false), w_1 = _a.w, h_1 = _a.h;
|
90
93
|
if (keepWidth) {
|
91
94
|
w_1 = prevW;
|
92
95
|
}
|
93
96
|
if (prevH > h_1) {
|
94
97
|
h_1 = prevH;
|
95
98
|
}
|
96
|
-
var _b = getResizableXYPosition(
|
99
|
+
var _b = getResizableXYPosition("e", w_1, h_1, prevW, prevH), newX = _b.newX, newY = _b.newY;
|
97
100
|
if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
|
98
101
|
return;
|
99
102
|
}
|
@@ -109,9 +112,213 @@ var GridItem = function (_a) {
|
|
109
112
|
observer.observe(targetNode, config);
|
110
113
|
// 정리 함수에서 MutationObserver 해제
|
111
114
|
return function () {
|
115
|
+
if (targetNode.classList.contains("ccb-layout-box")) {
|
116
|
+
return;
|
117
|
+
}
|
112
118
|
observer.disconnect();
|
113
119
|
};
|
114
120
|
}, [autoResize, isSelected, isDragging, isResizing, props.w, props.h, x, y]);
|
121
|
+
useEffect(function () {
|
122
|
+
var _a;
|
123
|
+
if (!isSelected || !autoResize) {
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
var targetNode = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.children[0].children[0].children[0];
|
127
|
+
if (!targetNode || isDragging || isResizing) {
|
128
|
+
return;
|
129
|
+
}
|
130
|
+
if (!targetNode.classList.contains("ccb-layout-box")) {
|
131
|
+
return;
|
132
|
+
}
|
133
|
+
var prevPaddingL = parseFloat(getComputedStyle(targetNode).paddingLeft);
|
134
|
+
var prevPaddingR = parseFloat(getComputedStyle(targetNode).paddingRight);
|
135
|
+
var prevPaddingT = parseFloat(getComputedStyle(targetNode).paddingTop);
|
136
|
+
var prevPaddingB = parseFloat(getComputedStyle(targetNode).paddingBottom);
|
137
|
+
// MutationObserver 콜백 함수
|
138
|
+
var callback = function (mutationsList) {
|
139
|
+
for (var _i = 0, mutationsList_2 = mutationsList; _i < mutationsList_2.length; _i++) {
|
140
|
+
var mutation = mutationsList_2[_i];
|
141
|
+
console.log("mutation", mutation);
|
142
|
+
// const isInitial = mutation.attributeName === "data-is-initialized";
|
143
|
+
var isSizeChanged = mutation.attributeName === "data-min-width" ||
|
144
|
+
mutation.attributeName === "data-min-height";
|
145
|
+
var keepWidth = true;
|
146
|
+
var hasPaddingChanged = true;
|
147
|
+
var layoutBox = targetNode.children[0];
|
148
|
+
var contentsWrapper = layoutBox.children[0];
|
149
|
+
var oneComposition = contentsWrapper.querySelector(".composition-container");
|
150
|
+
// const insetTop = Number(mutation.target.dataset.insetTop!);
|
151
|
+
// const insetBottom = Number(mutation.target.dataset.insetBottom!);
|
152
|
+
var minWidth = 0;
|
153
|
+
// const minHeight =
|
154
|
+
// Number(mutation.target.dataset.minHeight) + insetTop + insetBottom;
|
155
|
+
// const contentsWrapper = mutation.target.querySelector(
|
156
|
+
// ".cb-contentslist-wrapper"
|
157
|
+
// );
|
158
|
+
// const oneComposition = mutation.target.querySelector(
|
159
|
+
// ".composition-container"
|
160
|
+
// );
|
161
|
+
var minHeight = 0;
|
162
|
+
if (contentsWrapper && oneComposition) {
|
163
|
+
var minCellWidth = 10;
|
164
|
+
var numberOfItems = Number(mutation.target.getAttribute("data-number-of-items"));
|
165
|
+
var numberOfColumns = Number(mutation.target.getAttribute("data-number-of-columns"));
|
166
|
+
var rowGap = Number(mutation.target.getAttribute("data-row-gap"));
|
167
|
+
var columnGap = Number(mutation.target.getAttribute("data-column-gap"));
|
168
|
+
var insetTop = Number(mutation.target.getAttribute("data-inset-top"));
|
169
|
+
var insetBottom = Number(mutation.target.getAttribute("data-inset-bottom"));
|
170
|
+
var compositionCols = Number(oneComposition.getAttribute("data-cols"));
|
171
|
+
// const compositionRows = Number(
|
172
|
+
// oneComposition.getAttribute("data-rows")!
|
173
|
+
// );
|
174
|
+
var oneCompositionMinWidth = minCellWidth * compositionCols + 20; /* 20px padding */
|
175
|
+
// let oneCompositionMinHeight =
|
176
|
+
// minColHeight * compositionRows + 20; /* 20px padding */
|
177
|
+
if (contentsWrapper) {
|
178
|
+
var gridWrapperInnerH = contentsWrapper.clientHeight;
|
179
|
+
var oneCompositionH = oneComposition.clientHeight;
|
180
|
+
var compositionBGwrapperPaddingT = Number(oneComposition.getAttribute("data-wrapper-paddingt"));
|
181
|
+
var compositionBGwrapperPaddingB = Number(oneComposition.getAttribute("data-wrapper-paddingb"));
|
182
|
+
var compositionBGwrapperPaddingL = Number(oneComposition.getAttribute("data-wrapper-paddingl"));
|
183
|
+
var compositionBGwrapperPaddingR = Number(oneComposition.getAttribute("data-wrapper-paddingr"));
|
184
|
+
var oneCompositionMinHeight = oneCompositionH +
|
185
|
+
compositionBGwrapperPaddingT +
|
186
|
+
compositionBGwrapperPaddingB;
|
187
|
+
var styles = getComputedStyle(mutation.target);
|
188
|
+
var paddingL = parseFloat(styles.paddingLeft);
|
189
|
+
var paddingR = parseFloat(styles.paddingRight);
|
190
|
+
var paddingT = parseFloat(styles.paddingTop);
|
191
|
+
var paddingB = parseFloat(styles.paddingBottom);
|
192
|
+
var paddingLR = paddingL + paddingR;
|
193
|
+
var paddingTB = paddingT + paddingB;
|
194
|
+
var compositionWrapperPaddingLR = (compositionBGwrapperPaddingL + compositionBGwrapperPaddingR) *
|
195
|
+
numberOfColumns;
|
196
|
+
var numberOfRows = Math.ceil(numberOfItems / numberOfColumns);
|
197
|
+
var listMinWidth = oneCompositionMinWidth * numberOfColumns +
|
198
|
+
(numberOfColumns - 1) * columnGap +
|
199
|
+
paddingLR +
|
200
|
+
compositionWrapperPaddingLR;
|
201
|
+
var gridWrapperTotalH = gridWrapperInnerH + insetTop + insetBottom;
|
202
|
+
var listMinHeight = oneCompositionMinHeight * numberOfRows +
|
203
|
+
(numberOfRows - 1) * rowGap +
|
204
|
+
paddingTB +
|
205
|
+
insetTop +
|
206
|
+
insetBottom;
|
207
|
+
if (listMinHeight > gridWrapperTotalH) {
|
208
|
+
minHeight = listMinHeight;
|
209
|
+
}
|
210
|
+
minWidth = listMinWidth;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
// 필요가 없을 수도.
|
214
|
+
if (isNaN(minWidth) || isNaN(minHeight)) {
|
215
|
+
return;
|
216
|
+
}
|
217
|
+
var width = targetNode.clientWidth;
|
218
|
+
if (!isSizeChanged && mutation.target instanceof Element) {
|
219
|
+
var styles = getComputedStyle(mutation.target);
|
220
|
+
if (minWidth > width) {
|
221
|
+
keepWidth = false;
|
222
|
+
}
|
223
|
+
// NOTE: POC
|
224
|
+
var paddingL = parseFloat(styles.paddingLeft);
|
225
|
+
var paddingR = parseFloat(styles.paddingRight);
|
226
|
+
var paddingT = parseFloat(styles.paddingTop);
|
227
|
+
var paddingB = parseFloat(styles.paddingBottom);
|
228
|
+
if (prevPaddingL !== paddingL ||
|
229
|
+
prevPaddingR !== paddingR ||
|
230
|
+
prevPaddingT !== paddingT ||
|
231
|
+
prevPaddingB !== paddingB) {
|
232
|
+
hasPaddingChanged = true;
|
233
|
+
keepWidth = false;
|
234
|
+
}
|
235
|
+
}
|
236
|
+
var prevW = props.w;
|
237
|
+
var prevH = props.h;
|
238
|
+
var _a = calcWH(getPositionParams(), {
|
239
|
+
width: minWidth,
|
240
|
+
height: minHeight,
|
241
|
+
}, x, y, "e", props.w, props.h, true), w_2 = _a.w, h_2 = _a.h;
|
242
|
+
if (keepWidth) {
|
243
|
+
w_2 = prevW;
|
244
|
+
}
|
245
|
+
if (prevH > h_2) {
|
246
|
+
h_2 = prevH;
|
247
|
+
}
|
248
|
+
var _b = getResizableXYPosition("e", w_2, h_2, prevW, prevH), newX = _b.newX, newY = _b.newY;
|
249
|
+
if (prevH === h_2 && prevW === w_2 && newX === x && newY === y) {
|
250
|
+
return;
|
251
|
+
}
|
252
|
+
props.onFitToContent &&
|
253
|
+
props.onFitToContent(i, w_2, h_2, newX, newY, { hasPaddingChanged: hasPaddingChanged });
|
254
|
+
}
|
255
|
+
};
|
256
|
+
var callbackLater = function (mutationsList) {
|
257
|
+
setTimeout(function () {
|
258
|
+
callback(mutationsList);
|
259
|
+
}, 200);
|
260
|
+
};
|
261
|
+
// MutationObserver 인스턴스 생성
|
262
|
+
var observer = new MutationObserver(callbackLater);
|
263
|
+
// 관찰할 DOM 변이 설정
|
264
|
+
var config = { attributes: true, characterData: true };
|
265
|
+
// 대상 노드와 설정으로 관찰 시작
|
266
|
+
observer.observe(targetNode, config);
|
267
|
+
// 정리 함수에서 MutationObserver 해제
|
268
|
+
return function () {
|
269
|
+
if (!targetNode.classList.contains("ccb-layout-box")) {
|
270
|
+
return;
|
271
|
+
}
|
272
|
+
observer.disconnect();
|
273
|
+
};
|
274
|
+
}, [autoResize, isSelected, isDragging, isResizing, props.w, props.h, x, y]);
|
275
|
+
// useEffect(() => {
|
276
|
+
// if (!isSelected || !autoResize) {
|
277
|
+
// return;
|
278
|
+
// }
|
279
|
+
// const targetNode = elementRef.current?.children[0].children[0].children[0];
|
280
|
+
// if (!targetNode || isDragging || isResizing) {
|
281
|
+
// return;
|
282
|
+
// }
|
283
|
+
// if (targetNode.id !== "contentslist-box") {
|
284
|
+
// return;
|
285
|
+
// }
|
286
|
+
// const minWidth = Number((targetNode as HTMLElement).dataset?.minWidth ?? 0);
|
287
|
+
// const minHeight = Number(
|
288
|
+
// (targetNode as HTMLElement).dataset?.minHeight ?? 0
|
289
|
+
// );
|
290
|
+
// const insetTop = Number((targetNode as HTMLElement).dataset.insetTop!);
|
291
|
+
// const insetBottom = Number(
|
292
|
+
// (targetNode as HTMLElement).dataset.insetBottom!
|
293
|
+
// );
|
294
|
+
// let { w, h } = calcWH(
|
295
|
+
// getPositionParams(),
|
296
|
+
// {
|
297
|
+
// width: minWidth,
|
298
|
+
// height: minHeight + insetTop + insetBottom,
|
299
|
+
// },
|
300
|
+
// x,
|
301
|
+
// y,
|
302
|
+
// "e",
|
303
|
+
// props.w,
|
304
|
+
// props.h,
|
305
|
+
// true
|
306
|
+
// );
|
307
|
+
// const prevW = props.w;
|
308
|
+
// const prevH = props.h;
|
309
|
+
// if (prevW > w) {
|
310
|
+
// w = prevW;
|
311
|
+
// }
|
312
|
+
// if (prevH > h) {
|
313
|
+
// h = prevH;
|
314
|
+
// }
|
315
|
+
// if (prevH === h && prevW === w) {
|
316
|
+
// console.log("cancelled 3");
|
317
|
+
// return;
|
318
|
+
// }
|
319
|
+
// props.onFitToContent &&
|
320
|
+
// props.onFitToContent(i, w, h, x, y, { hasPaddingChanged: true });
|
321
|
+
// }, [isSelected, isResizing]);
|
115
322
|
// const moveDroppingItem = (prevProps: GridItemProps) => {
|
116
323
|
// const { droppingPosition } = props;
|
117
324
|
// if (!droppingPosition) return;
|
@@ -163,7 +370,7 @@ var GridItem = function (_a) {
|
|
163
370
|
style = setTopLeft(pos);
|
164
371
|
if (usePercentages) {
|
165
372
|
if (containerWidth == null) {
|
166
|
-
throw new Error(
|
373
|
+
throw new Error("Container width is missing!");
|
167
374
|
}
|
168
375
|
style.left = perc(pos.left / containerWidth);
|
169
376
|
style.width = perc(pos.width / containerWidth);
|
@@ -177,7 +384,7 @@ var GridItem = function (_a) {
|
|
177
384
|
* @return {Element} Child wrapped in Draggable.
|
178
385
|
*/
|
179
386
|
var mixinDraggable = function (child, isDraggable) {
|
180
|
-
return (_jsx(DraggableCore, { disabled: !isDraggable, onStart: onDragStart, onDrag: onDrag, onStop: onDragStop, handle: handle, cancel:
|
387
|
+
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
388
|
};
|
182
389
|
/**
|
183
390
|
* Mix a Resizable instance into a child.
|
@@ -204,7 +411,7 @@ var GridItem = function (_a) {
|
|
204
411
|
];
|
205
412
|
return (_jsx(Resizable, { draggableOpts: {
|
206
413
|
disabled: !isResizable,
|
207
|
-
}, className: isResizable ? undefined :
|
414
|
+
}, 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
415
|
};
|
209
416
|
/**
|
210
417
|
* onDragStart event handler
|
@@ -239,7 +446,7 @@ var GridItem = function (_a) {
|
|
239
446
|
var onDrag = function (e, _a) {
|
240
447
|
var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
|
241
448
|
if (!dragging) {
|
242
|
-
throw new Error(
|
449
|
+
throw new Error("onDrag called before onDragStart.");
|
243
450
|
}
|
244
451
|
setIsDragging(true);
|
245
452
|
var top = dragging.top + deltaY;
|
@@ -272,7 +479,7 @@ var GridItem = function (_a) {
|
|
272
479
|
var onDragStop = function (e, _a) {
|
273
480
|
var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
|
274
481
|
if (!dragging) {
|
275
|
-
throw new Error(
|
482
|
+
throw new Error("onDragEnd called before onDragStart.");
|
276
483
|
}
|
277
484
|
var w = props.w, h = props.h, i = props.i;
|
278
485
|
var left = dragging.left, top = dragging.top;
|
@@ -288,7 +495,7 @@ var GridItem = function (_a) {
|
|
288
495
|
var getResizableXYPosition = function (handle, width, height, prevW, prevH) {
|
289
496
|
var newX = x;
|
290
497
|
var newY = y;
|
291
|
-
if (handle ===
|
498
|
+
if (handle === "nw") {
|
292
499
|
// NOTE - nw left(X)와 top(Y) 둘다 변경
|
293
500
|
if (width > prevW) {
|
294
501
|
newX = x - (width - prevW);
|
@@ -303,7 +510,7 @@ var GridItem = function (_a) {
|
|
303
510
|
newY = y + (prevH - height);
|
304
511
|
}
|
305
512
|
}
|
306
|
-
if (handle ===
|
513
|
+
if (handle === "n" || handle === "ne") {
|
307
514
|
// NOTE - n, ne left(X) 고정 & top(Y) 변경
|
308
515
|
if (height > prevH) {
|
309
516
|
newY = y - (height - prevH);
|
@@ -312,7 +519,7 @@ var GridItem = function (_a) {
|
|
312
519
|
newY = y + (prevH - height);
|
313
520
|
}
|
314
521
|
}
|
315
|
-
if (handle ===
|
522
|
+
if (handle === "w" || handle === "sw") {
|
316
523
|
// NOTE - s, sw left(X) 변경 top(Y) 고정
|
317
524
|
if (width > prevW) {
|
318
525
|
newX = x - (width - prevW);
|
@@ -329,7 +536,7 @@ var GridItem = function (_a) {
|
|
329
536
|
* @param {Object} callbackData an object with node and size information
|
330
537
|
*/
|
331
538
|
var onResizeStart = function (e, callbackData) {
|
332
|
-
onResizeHandler(e, callbackData,
|
539
|
+
onResizeHandler(e, callbackData, "onResizeStart");
|
333
540
|
};
|
334
541
|
/**
|
335
542
|
* onResize event handler
|
@@ -338,7 +545,7 @@ var GridItem = function (_a) {
|
|
338
545
|
*/
|
339
546
|
var onResize = function (e, callbackData) {
|
340
547
|
setIsResizing(true);
|
341
|
-
onResizeHandler(e, callbackData,
|
548
|
+
onResizeHandler(e, callbackData, "onResize");
|
342
549
|
};
|
343
550
|
/**
|
344
551
|
* onResizeStop event handler
|
@@ -347,7 +554,7 @@ var GridItem = function (_a) {
|
|
347
554
|
*/
|
348
555
|
var onResizeStop = function (e, callbackData) {
|
349
556
|
setIsResizing(false);
|
350
|
-
onResizeHandler(e, callbackData,
|
557
|
+
onResizeHandler(e, callbackData, "onResizeStop");
|
351
558
|
};
|
352
559
|
/**
|
353
560
|
* Wrapper around drag events to provide more useful data.
|
@@ -381,7 +588,7 @@ var GridItem = function (_a) {
|
|
381
588
|
// maxW = Math.min(maxW, cols - x);
|
382
589
|
w = clamp(w, minW, maxW);
|
383
590
|
h = clamp(h, tempMinH, maxH);
|
384
|
-
setResizing(handlerName ===
|
591
|
+
setResizing(handlerName === "onResizeStop" ? undefined : size);
|
385
592
|
var _d = getResizableXYPosition(handle, w, h, prevW, prevH), newX = _d.newX, newY = _d.newY;
|
386
593
|
handler(i, w, h, { e: e, node: node, size: size }, newX, newY);
|
387
594
|
};
|
@@ -393,18 +600,19 @@ var GridItem = function (_a) {
|
|
393
600
|
var newChild = React.cloneElement(child, {
|
394
601
|
key: i,
|
395
602
|
ref: elementRef,
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
603
|
+
"data-grid-id": i,
|
604
|
+
"data-z-index": z,
|
605
|
+
"data-z-order": zOrder,
|
606
|
+
"data-is-pinned": props.isPinned,
|
607
|
+
"data-z-order-internal": zOrderInternal,
|
608
|
+
className: classNames("react-grid-item", child.props.className, className, {
|
401
609
|
static: props.static,
|
402
610
|
isResizing: Boolean(resizing) && Boolean(isResizing) && Boolean(isHiddenVisibility),
|
403
611
|
resizing: Boolean(resizing),
|
404
|
-
|
405
|
-
|
612
|
+
"react-draggable": isDraggable,
|
613
|
+
"editable-grid-item": isResizable && isDraggable,
|
406
614
|
isDragging: Boolean(isDragging) && Boolean(dragging) && Boolean(isHiddenVisibility),
|
407
|
-
|
615
|
+
"react-draggable-dragging": Boolean(dragging),
|
408
616
|
// dropping: Boolean(droppingPosition),
|
409
617
|
cssTransforms: useCSSTransforms,
|
410
618
|
}),
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { GridItemProps } from "./types";
|
3
|
+
import { PropsWithChildren } from "../types";
|
4
|
+
declare const GridItem: ({ children, ...props }: PropsWithChildren<GridItemProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
5
|
+
export default GridItem;
|