publ-echo-test 0.0.331 → 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.
- package/css/gle-styles.css +0 -1
- package/dist/lib/GridItem/GridItem.d.ts +3 -3
- package/dist/lib/GridItem/GridItem.js +31 -247
- package/dist/lib/GridItem/GroupItem.d.ts +3 -3
- package/dist/lib/GridItem/GroupItem.js +38 -37
- package/dist/lib/GridLayoutEditor/ReactGridLayout.js +2 -3
- package/dist/lib/Resizable/Resizable.d.ts +3 -3
- package/dist/lib/Resizable/Resizable.js +35 -132
- package/package.json +1 -1
- package/dist/lib/GridItem/GridItemCopy.d.ts +0 -5
- package/dist/lib/GridItem/GridItemCopy.js +0 -613
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,10 +47,6 @@ var GridItem = function (_a) {
|
|
47
47
|
if (!targetNode || isDragging || isResizing) {
|
48
48
|
return;
|
49
49
|
}
|
50
|
-
console.log("contains?:", targetNode.classList.contains("ccb-layout-box"));
|
51
|
-
if (targetNode.classList.contains("ccb-layout-box")) {
|
52
|
-
return;
|
53
|
-
}
|
54
50
|
var prevPaddingL = parseFloat(getComputedStyle(targetNode).paddingLeft);
|
55
51
|
var prevPaddingR = parseFloat(getComputedStyle(targetNode).paddingRight);
|
56
52
|
var prevPaddingT = parseFloat(getComputedStyle(targetNode).paddingTop);
|
@@ -59,7 +55,7 @@ var GridItem = function (_a) {
|
|
59
55
|
var callback = function (mutationsList) {
|
60
56
|
for (var _i = 0, mutationsList_1 = mutationsList; _i < mutationsList_1.length; _i++) {
|
61
57
|
var mutation = mutationsList_1[_i];
|
62
|
-
var isCharacterChanged = mutation.type ===
|
58
|
+
var isCharacterChanged = mutation.type === 'characterData';
|
63
59
|
var keepWidth = true;
|
64
60
|
var hasPaddingChanged = false;
|
65
61
|
var height = isCharacterChanged
|
@@ -90,14 +86,14 @@ var GridItem = function (_a) {
|
|
90
86
|
var _a = calcWH(getPositionParams(), {
|
91
87
|
width: width,
|
92
88
|
height: height,
|
93
|
-
}, x, y,
|
89
|
+
}, x, y, 'e', props.w, props.h, false), w_1 = _a.w, h_1 = _a.h;
|
94
90
|
if (keepWidth) {
|
95
91
|
w_1 = prevW;
|
96
92
|
}
|
97
93
|
if (prevH > h_1) {
|
98
94
|
h_1 = prevH;
|
99
95
|
}
|
100
|
-
var _b = getResizableXYPosition(
|
96
|
+
var _b = getResizableXYPosition('e', w_1, h_1, prevW, prevH), newX = _b.newX, newY = _b.newY;
|
101
97
|
if (prevH === h_1 && prevW === w_1 && newX === x && newY === y) {
|
102
98
|
return;
|
103
99
|
}
|
@@ -113,221 +109,9 @@ var GridItem = function (_a) {
|
|
113
109
|
observer.observe(targetNode, config);
|
114
110
|
// 정리 함수에서 MutationObserver 해제
|
115
111
|
return function () {
|
116
|
-
if (targetNode.classList.contains("ccb-layout-box")) {
|
117
|
-
return;
|
118
|
-
}
|
119
112
|
observer.disconnect();
|
120
113
|
};
|
121
114
|
}, [autoResize, isSelected, isDragging, isResizing, props.w, props.h, x, y]);
|
122
|
-
useEffect(function () {
|
123
|
-
var _a;
|
124
|
-
if (!isSelected || !autoResize) {
|
125
|
-
return;
|
126
|
-
}
|
127
|
-
var targetNode = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.children[0].children[0].children[0];
|
128
|
-
if (!targetNode || isDragging || isResizing) {
|
129
|
-
return;
|
130
|
-
}
|
131
|
-
console.log("targetNode", targetNode);
|
132
|
-
if (!targetNode.classList.contains("ccb-layout-box")) {
|
133
|
-
return;
|
134
|
-
}
|
135
|
-
console.log("contains?:", targetNode.classList.contains("ccb-layout-box"));
|
136
|
-
var prevPaddingL = parseFloat(getComputedStyle(targetNode).paddingLeft);
|
137
|
-
var prevPaddingR = parseFloat(getComputedStyle(targetNode).paddingRight);
|
138
|
-
var prevPaddingT = parseFloat(getComputedStyle(targetNode).paddingTop);
|
139
|
-
var prevPaddingB = parseFloat(getComputedStyle(targetNode).paddingBottom);
|
140
|
-
// MutationObserver 콜백 함수
|
141
|
-
var callback = function (mutationsList) {
|
142
|
-
for (var _i = 0, mutationsList_2 = mutationsList; _i < mutationsList_2.length; _i++) {
|
143
|
-
var mutation = mutationsList_2[_i];
|
144
|
-
console.log("mutation", mutation);
|
145
|
-
// const isInitial = mutation.attributeName === "data-is-initialized";
|
146
|
-
var isSizeChanged = mutation.attributeName === "data-min-width" ||
|
147
|
-
mutation.attributeName === "data-min-height";
|
148
|
-
var keepWidth = true;
|
149
|
-
var hasPaddingChanged = true;
|
150
|
-
var layoutBox = targetNode.children[0];
|
151
|
-
var contentsWrapper = layoutBox.children[0];
|
152
|
-
var oneComposition = contentsWrapper.querySelector(".composition-container");
|
153
|
-
console.log("layoutbox", layoutBox);
|
154
|
-
console.log("contentsWrapper", contentsWrapper);
|
155
|
-
console.log("oneComposition", oneComposition);
|
156
|
-
// const insetTop = Number(mutation.target.dataset.insetTop!);
|
157
|
-
// const insetBottom = Number(mutation.target.dataset.insetBottom!);
|
158
|
-
var minWidth = 0;
|
159
|
-
// const minHeight =
|
160
|
-
// Number(mutation.target.dataset.minHeight) + insetTop + insetBottom;
|
161
|
-
// const contentsWrapper = mutation.target.querySelector(
|
162
|
-
// ".cb-contentslist-wrapper"
|
163
|
-
// );
|
164
|
-
// const oneComposition = mutation.target.querySelector(
|
165
|
-
// ".composition-container"
|
166
|
-
// );
|
167
|
-
var minHeight = 0;
|
168
|
-
if (contentsWrapper && oneComposition) {
|
169
|
-
var minCellWidth = 10;
|
170
|
-
var numberOfItems = Number(mutation.target.getAttribute("data-number-of-items"));
|
171
|
-
var numberOfColumns = Number(mutation.target.getAttribute("data-number-of-columns"));
|
172
|
-
var rowGap = Number(mutation.target.getAttribute("data-row-gap"));
|
173
|
-
var columnGap = Number(mutation.target.getAttribute("data-column-gap"));
|
174
|
-
var insetTop = Number(mutation.target.getAttribute("data-inset-top"));
|
175
|
-
var insetBottom = Number(mutation.target.getAttribute("data-inset-bottom"));
|
176
|
-
var compositionCols = Number(oneComposition.getAttribute("data-cols"));
|
177
|
-
// const compositionRows = Number(
|
178
|
-
// oneComposition.getAttribute("data-rows")!
|
179
|
-
// );
|
180
|
-
var oneCompositionMinWidth = minCellWidth * compositionCols + 20; /* 20px padding */
|
181
|
-
console.log("compositionCols", compositionCols);
|
182
|
-
// let oneCompositionMinHeight =
|
183
|
-
// minColHeight * compositionRows + 20; /* 20px padding */
|
184
|
-
if (contentsWrapper) {
|
185
|
-
var gridWrapperInnerH = contentsWrapper.clientHeight;
|
186
|
-
var oneCompositionH = oneComposition.clientHeight;
|
187
|
-
var compositionBGwrapperPaddingT = Number(oneComposition.getAttribute("data-wrapper-paddingt"));
|
188
|
-
var compositionBGwrapperPaddingB = Number(oneComposition.getAttribute("data-wrapper-paddingb"));
|
189
|
-
var compositionBGwrapperPaddingL = Number(oneComposition.getAttribute("data-wrapper-paddingl"));
|
190
|
-
var compositionBGwrapperPaddingR = Number(oneComposition.getAttribute("data-wrapper-paddingr"));
|
191
|
-
var oneCompositionMinHeight = oneCompositionH +
|
192
|
-
compositionBGwrapperPaddingT +
|
193
|
-
compositionBGwrapperPaddingB;
|
194
|
-
var styles = getComputedStyle(mutation.target);
|
195
|
-
var paddingL = parseFloat(styles.paddingLeft);
|
196
|
-
var paddingR = parseFloat(styles.paddingRight);
|
197
|
-
var paddingT = parseFloat(styles.paddingTop);
|
198
|
-
var paddingB = parseFloat(styles.paddingBottom);
|
199
|
-
var paddingLR = paddingL + paddingR;
|
200
|
-
var paddingTB = paddingT + paddingB;
|
201
|
-
var compositionWrapperPaddingLR = (compositionBGwrapperPaddingL + compositionBGwrapperPaddingR) *
|
202
|
-
numberOfColumns;
|
203
|
-
var numberOfRows = Math.ceil(numberOfItems / numberOfColumns);
|
204
|
-
var listMinWidth = oneCompositionMinWidth * numberOfColumns +
|
205
|
-
(numberOfColumns - 1) * columnGap +
|
206
|
-
paddingLR +
|
207
|
-
compositionWrapperPaddingLR;
|
208
|
-
console.log("oneCompositionMinWidth", oneCompositionMinWidth);
|
209
|
-
console.log("cols", numberOfColumns);
|
210
|
-
var gridWrapperTotalH = gridWrapperInnerH + insetTop + insetBottom;
|
211
|
-
var listMinHeight = oneCompositionMinHeight * numberOfRows +
|
212
|
-
(numberOfRows - 1) * rowGap +
|
213
|
-
paddingTB +
|
214
|
-
insetTop +
|
215
|
-
insetBottom;
|
216
|
-
if (listMinHeight > gridWrapperTotalH) {
|
217
|
-
minHeight = listMinHeight;
|
218
|
-
}
|
219
|
-
minWidth = listMinWidth;
|
220
|
-
}
|
221
|
-
}
|
222
|
-
// 필요가 없을 수도.
|
223
|
-
if (isNaN(minWidth) || isNaN(minHeight)) {
|
224
|
-
return;
|
225
|
-
}
|
226
|
-
var width = targetNode.clientWidth;
|
227
|
-
if (!isSizeChanged && mutation.target instanceof Element) {
|
228
|
-
var styles = getComputedStyle(mutation.target);
|
229
|
-
if (minWidth > width) {
|
230
|
-
keepWidth = false;
|
231
|
-
}
|
232
|
-
// NOTE: POC
|
233
|
-
var paddingL = parseFloat(styles.paddingLeft);
|
234
|
-
var paddingR = parseFloat(styles.paddingRight);
|
235
|
-
var paddingT = parseFloat(styles.paddingTop);
|
236
|
-
var paddingB = parseFloat(styles.paddingBottom);
|
237
|
-
if (prevPaddingL !== paddingL ||
|
238
|
-
prevPaddingR !== paddingR ||
|
239
|
-
prevPaddingT !== paddingT ||
|
240
|
-
prevPaddingB !== paddingB) {
|
241
|
-
hasPaddingChanged = true;
|
242
|
-
keepWidth = false;
|
243
|
-
}
|
244
|
-
}
|
245
|
-
var prevW = props.w;
|
246
|
-
var prevH = props.h;
|
247
|
-
var _a = calcWH(getPositionParams(), {
|
248
|
-
width: minWidth,
|
249
|
-
height: minHeight,
|
250
|
-
}, x, y, "e", props.w, props.h, true), w_2 = _a.w, h_2 = _a.h;
|
251
|
-
if (keepWidth) {
|
252
|
-
w_2 = prevW;
|
253
|
-
}
|
254
|
-
if (prevH > h_2) {
|
255
|
-
h_2 = prevH;
|
256
|
-
}
|
257
|
-
var _b = getResizableXYPosition("e", w_2, h_2, prevW, prevH), newX = _b.newX, newY = _b.newY;
|
258
|
-
if (prevH === h_2 && prevW === w_2 && newX === x && newY === y) {
|
259
|
-
return;
|
260
|
-
}
|
261
|
-
props.onFitToContent &&
|
262
|
-
props.onFitToContent(i, w_2, h_2, newX, newY, { hasPaddingChanged: hasPaddingChanged });
|
263
|
-
}
|
264
|
-
};
|
265
|
-
var callbackLater = function (mutationsList) {
|
266
|
-
setTimeout(function () {
|
267
|
-
callback(mutationsList);
|
268
|
-
}, 200);
|
269
|
-
};
|
270
|
-
// MutationObserver 인스턴스 생성
|
271
|
-
var observer = new MutationObserver(callbackLater);
|
272
|
-
// 관찰할 DOM 변이 설정
|
273
|
-
var config = { attributes: true, characterData: true };
|
274
|
-
// 대상 노드와 설정으로 관찰 시작
|
275
|
-
observer.observe(targetNode, config);
|
276
|
-
// 정리 함수에서 MutationObserver 해제
|
277
|
-
return function () {
|
278
|
-
if (!targetNode.classList.contains("ccb-layout-box")) {
|
279
|
-
return;
|
280
|
-
}
|
281
|
-
observer.disconnect();
|
282
|
-
};
|
283
|
-
}, [autoResize, isSelected, isDragging, isResizing, props.w, props.h, x, y]);
|
284
|
-
// useEffect(() => {
|
285
|
-
// if (!isSelected || !autoResize) {
|
286
|
-
// return;
|
287
|
-
// }
|
288
|
-
// const targetNode = elementRef.current?.children[0].children[0].children[0];
|
289
|
-
// if (!targetNode || isDragging || isResizing) {
|
290
|
-
// return;
|
291
|
-
// }
|
292
|
-
// if (targetNode.id !== "contentslist-box") {
|
293
|
-
// return;
|
294
|
-
// }
|
295
|
-
// const minWidth = Number((targetNode as HTMLElement).dataset?.minWidth ?? 0);
|
296
|
-
// const minHeight = Number(
|
297
|
-
// (targetNode as HTMLElement).dataset?.minHeight ?? 0
|
298
|
-
// );
|
299
|
-
// const insetTop = Number((targetNode as HTMLElement).dataset.insetTop!);
|
300
|
-
// const insetBottom = Number(
|
301
|
-
// (targetNode as HTMLElement).dataset.insetBottom!
|
302
|
-
// );
|
303
|
-
// let { w, h } = calcWH(
|
304
|
-
// getPositionParams(),
|
305
|
-
// {
|
306
|
-
// width: minWidth,
|
307
|
-
// height: minHeight + insetTop + insetBottom,
|
308
|
-
// },
|
309
|
-
// x,
|
310
|
-
// y,
|
311
|
-
// "e",
|
312
|
-
// props.w,
|
313
|
-
// props.h,
|
314
|
-
// true
|
315
|
-
// );
|
316
|
-
// const prevW = props.w;
|
317
|
-
// const prevH = props.h;
|
318
|
-
// if (prevW > w) {
|
319
|
-
// w = prevW;
|
320
|
-
// }
|
321
|
-
// if (prevH > h) {
|
322
|
-
// h = prevH;
|
323
|
-
// }
|
324
|
-
// if (prevH === h && prevW === w) {
|
325
|
-
// console.log("cancelled 3");
|
326
|
-
// return;
|
327
|
-
// }
|
328
|
-
// props.onFitToContent &&
|
329
|
-
// props.onFitToContent(i, w, h, x, y, { hasPaddingChanged: true });
|
330
|
-
// }, [isSelected, isResizing]);
|
331
115
|
// const moveDroppingItem = (prevProps: GridItemProps) => {
|
332
116
|
// const { droppingPosition } = props;
|
333
117
|
// if (!droppingPosition) return;
|
@@ -379,7 +163,7 @@ var GridItem = function (_a) {
|
|
379
163
|
style = setTopLeft(pos);
|
380
164
|
if (usePercentages) {
|
381
165
|
if (containerWidth == null) {
|
382
|
-
throw new Error(
|
166
|
+
throw new Error('Container width is missing!');
|
383
167
|
}
|
384
168
|
style.left = perc(pos.left / containerWidth);
|
385
169
|
style.width = perc(pos.width / containerWidth);
|
@@ -393,7 +177,7 @@ var GridItem = function (_a) {
|
|
393
177
|
* @return {Element} Child wrapped in Draggable.
|
394
178
|
*/
|
395
179
|
var mixinDraggable = function (child, isDraggable) {
|
396
|
-
return (_jsx(DraggableCore, { disabled: !isDraggable, onStart: onDragStart, onDrag: onDrag, onStop: onDragStop, handle: handle, cancel:
|
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 }));
|
397
181
|
};
|
398
182
|
/**
|
399
183
|
* Mix a Resizable instance into a child.
|
@@ -420,7 +204,7 @@ var GridItem = function (_a) {
|
|
420
204
|
];
|
421
205
|
return (_jsx(Resizable, { draggableOpts: {
|
422
206
|
disabled: !isResizable,
|
423
|
-
}, className: isResizable ? undefined :
|
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 }));
|
424
208
|
};
|
425
209
|
/**
|
426
210
|
* onDragStart event handler
|
@@ -455,7 +239,7 @@ var GridItem = function (_a) {
|
|
455
239
|
var onDrag = function (e, _a) {
|
456
240
|
var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
|
457
241
|
if (!dragging) {
|
458
|
-
throw new Error(
|
242
|
+
throw new Error('onDrag called before onDragStart.');
|
459
243
|
}
|
460
244
|
setIsDragging(true);
|
461
245
|
var top = dragging.top + deltaY;
|
@@ -488,7 +272,7 @@ var GridItem = function (_a) {
|
|
488
272
|
var onDragStop = function (e, _a) {
|
489
273
|
var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
|
490
274
|
if (!dragging) {
|
491
|
-
throw new Error(
|
275
|
+
throw new Error('onDragEnd called before onDragStart.');
|
492
276
|
}
|
493
277
|
var w = props.w, h = props.h, i = props.i;
|
494
278
|
var left = dragging.left, top = dragging.top;
|
@@ -504,7 +288,7 @@ var GridItem = function (_a) {
|
|
504
288
|
var getResizableXYPosition = function (handle, width, height, prevW, prevH) {
|
505
289
|
var newX = x;
|
506
290
|
var newY = y;
|
507
|
-
if (handle ===
|
291
|
+
if (handle === 'nw') {
|
508
292
|
// NOTE - nw left(X)와 top(Y) 둘다 변경
|
509
293
|
if (width > prevW) {
|
510
294
|
newX = x - (width - prevW);
|
@@ -519,7 +303,7 @@ var GridItem = function (_a) {
|
|
519
303
|
newY = y + (prevH - height);
|
520
304
|
}
|
521
305
|
}
|
522
|
-
if (handle ===
|
306
|
+
if (handle === 'n' || handle === 'ne') {
|
523
307
|
// NOTE - n, ne left(X) 고정 & top(Y) 변경
|
524
308
|
if (height > prevH) {
|
525
309
|
newY = y - (height - prevH);
|
@@ -528,7 +312,7 @@ var GridItem = function (_a) {
|
|
528
312
|
newY = y + (prevH - height);
|
529
313
|
}
|
530
314
|
}
|
531
|
-
if (handle ===
|
315
|
+
if (handle === 'w' || handle === 'sw') {
|
532
316
|
// NOTE - s, sw left(X) 변경 top(Y) 고정
|
533
317
|
if (width > prevW) {
|
534
318
|
newX = x - (width - prevW);
|
@@ -545,7 +329,7 @@ var GridItem = function (_a) {
|
|
545
329
|
* @param {Object} callbackData an object with node and size information
|
546
330
|
*/
|
547
331
|
var onResizeStart = function (e, callbackData) {
|
548
|
-
onResizeHandler(e, callbackData,
|
332
|
+
onResizeHandler(e, callbackData, 'onResizeStart');
|
549
333
|
};
|
550
334
|
/**
|
551
335
|
* onResize event handler
|
@@ -554,7 +338,7 @@ var GridItem = function (_a) {
|
|
554
338
|
*/
|
555
339
|
var onResize = function (e, callbackData) {
|
556
340
|
setIsResizing(true);
|
557
|
-
onResizeHandler(e, callbackData,
|
341
|
+
onResizeHandler(e, callbackData, 'onResize');
|
558
342
|
};
|
559
343
|
/**
|
560
344
|
* onResizeStop event handler
|
@@ -563,7 +347,7 @@ var GridItem = function (_a) {
|
|
563
347
|
*/
|
564
348
|
var onResizeStop = function (e, callbackData) {
|
565
349
|
setIsResizing(false);
|
566
|
-
onResizeHandler(e, callbackData,
|
350
|
+
onResizeHandler(e, callbackData, 'onResizeStop');
|
567
351
|
};
|
568
352
|
/**
|
569
353
|
* Wrapper around drag events to provide more useful data.
|
@@ -597,7 +381,7 @@ var GridItem = function (_a) {
|
|
597
381
|
// maxW = Math.min(maxW, cols - x);
|
598
382
|
w = clamp(w, minW, maxW);
|
599
383
|
h = clamp(h, tempMinH, maxH);
|
600
|
-
setResizing(handlerName ===
|
384
|
+
setResizing(handlerName === 'onResizeStop' ? undefined : size);
|
601
385
|
var _d = getResizableXYPosition(handle, w, h, prevW, prevH), newX = _d.newX, newY = _d.newY;
|
602
386
|
handler(i, w, h, { e: e, node: node, size: size }, newX, newY);
|
603
387
|
};
|
@@ -609,18 +393,18 @@ var GridItem = function (_a) {
|
|
609
393
|
var newChild = React.cloneElement(child, {
|
610
394
|
key: i,
|
611
395
|
ref: elementRef,
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
className: classNames(
|
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, {
|
617
401
|
static: props.static,
|
618
402
|
isResizing: Boolean(resizing) && Boolean(isResizing) && Boolean(isHiddenVisibility),
|
619
403
|
resizing: Boolean(resizing),
|
620
|
-
|
621
|
-
|
404
|
+
'react-draggable': isDraggable,
|
405
|
+
'editable-grid-item': isResizable && isDraggable,
|
622
406
|
isDragging: Boolean(isDragging) && Boolean(dragging) && Boolean(isHiddenVisibility),
|
623
|
-
|
407
|
+
'react-draggable-dragging': Boolean(dragging),
|
624
408
|
// dropping: Boolean(droppingPosition),
|
625
409
|
cssTransforms: useCSSTransforms,
|
626
410
|
}),
|
@@ -1,6 +1,6 @@
|
|
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 GroupItem: ({ children, ...props }: PropsWithChildren<GridItemProps & {
|
5
5
|
onContextGroup: (e: React.MouseEvent) => void;
|
6
6
|
zOrder: number;
|