publ-echo-test 0.0.330 → 0.0.332

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 (76) hide show
  1. package/css/gle-styles.css +0 -1
  2. package/package.json +1 -1
  3. package/dist/external-lib/classnames/index.d.ts +0 -5
  4. package/dist/external-lib/classnames/index.js +0 -60
  5. package/dist/external-lib/lodash.isEqual/index.d.ts +0 -30
  6. package/dist/external-lib/lodash.isEqual/index.js +0 -1661
  7. package/dist/lib/Draggable/Draggable.d.ts +0 -17
  8. package/dist/lib/Draggable/Draggable.js +0 -192
  9. package/dist/lib/Draggable/DraggableCore.d.ts +0 -5
  10. package/dist/lib/Draggable/DraggableCore.js +0 -267
  11. package/dist/lib/Draggable/constants.d.ts +0 -12
  12. package/dist/lib/Draggable/constants.js +0 -12
  13. package/dist/lib/Draggable/index.d.ts +0 -2
  14. package/dist/lib/Draggable/index.js +0 -2
  15. package/dist/lib/Draggable/types.d.ts +0 -55
  16. package/dist/lib/Draggable/types.js +0 -1
  17. package/dist/lib/Draggable/utils/domHelpers.d.ts +0 -22
  18. package/dist/lib/Draggable/utils/domHelpers.js +0 -222
  19. package/dist/lib/Draggable/utils/getPrefix.d.ts +0 -5
  20. package/dist/lib/Draggable/utils/getPrefix.js +0 -41
  21. package/dist/lib/Draggable/utils/positionHelpers.d.ts +0 -7
  22. package/dist/lib/Draggable/utils/positionHelpers.js +0 -32
  23. package/dist/lib/Draggable/utils/types.d.ts +0 -30
  24. package/dist/lib/Draggable/utils/types.js +0 -1
  25. package/dist/lib/Draggable/utils/validationHelpers.d.ts +0 -4
  26. package/dist/lib/Draggable/utils/validationHelpers.js +0 -16
  27. package/dist/lib/GridItem/GridItem.d.ts +0 -5
  28. package/dist/lib/GridItem/GridItem.js +0 -633
  29. package/dist/lib/GridItem/GridItemCopy.d.ts +0 -5
  30. package/dist/lib/GridItem/GridItemCopy.js +0 -613
  31. package/dist/lib/GridItem/GroupItem.d.ts +0 -10
  32. package/dist/lib/GridItem/GroupItem.js +0 -472
  33. package/dist/lib/GridItem/OutsideClickHandler.d.ts +0 -7
  34. package/dist/lib/GridItem/OutsideClickHandler.js +0 -112
  35. package/dist/lib/GridItem/index.d.ts +0 -1
  36. package/dist/lib/GridItem/index.js +0 -1
  37. package/dist/lib/GridItem/types.d.ts +0 -112
  38. package/dist/lib/GridItem/types.js +0 -1
  39. package/dist/lib/GridItem/utils/calculateUtils.d.ts +0 -30
  40. package/dist/lib/GridItem/utils/calculateUtils.js +0 -115
  41. package/dist/lib/GridLayoutEditor/ReactGridLayout.d.ts +0 -6
  42. package/dist/lib/GridLayoutEditor/ReactGridLayout.js +0 -748
  43. package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.d.ts +0 -4
  44. package/dist/lib/GridLayoutEditor/ResponsiveGridLayout.js +0 -117
  45. package/dist/lib/GridLayoutEditor/group.d.ts +0 -58
  46. package/dist/lib/GridLayoutEditor/group.js +0 -341
  47. package/dist/lib/GridLayoutEditor/index.d.ts +0 -3
  48. package/dist/lib/GridLayoutEditor/index.js +0 -2
  49. package/dist/lib/GridLayoutEditor/types.d.ts +0 -170
  50. package/dist/lib/GridLayoutEditor/types.js +0 -1
  51. package/dist/lib/GridLayoutEditor/utils/renderHelpers.d.ts +0 -173
  52. package/dist/lib/GridLayoutEditor/utils/renderHelpers.js +0 -607
  53. package/dist/lib/GridLayoutEditor/utils/responsiveUtils.d.ts +0 -26
  54. package/dist/lib/GridLayoutEditor/utils/responsiveUtils.js +0 -77
  55. package/dist/lib/Resizable/Resizable.d.ts +0 -6
  56. package/dist/lib/Resizable/Resizable.js +0 -385
  57. package/dist/lib/Resizable/ResizableBox.d.ts +0 -7
  58. package/dist/lib/Resizable/ResizableBox.js +0 -57
  59. package/dist/lib/Resizable/index.d.ts +0 -1
  60. package/dist/lib/Resizable/index.js +0 -1
  61. package/dist/lib/Resizable/types.d.ts +0 -69
  62. package/dist/lib/Resizable/types.js +0 -1
  63. package/dist/lib/Resizable/utils/cloneElement.d.ts +0 -2
  64. package/dist/lib/Resizable/utils/cloneElement.js +0 -21
  65. package/dist/lib/components/WidthProvider.d.ts +0 -9
  66. package/dist/lib/components/WidthProvider.js +0 -65
  67. package/dist/lib/components/index.d.ts +0 -1
  68. package/dist/lib/components/index.js +0 -1
  69. package/dist/lib/components/types.d.ts +0 -13
  70. package/dist/lib/components/types.js +0 -1
  71. package/dist/lib/index.d.ts +0 -5
  72. package/dist/lib/index.js +0 -5
  73. package/dist/lib/types.d.ts +0 -4
  74. package/dist/lib/types.js +0 -1
  75. package/dist/lib/utils/classNames.d.ts +0 -3
  76. package/dist/lib/utils/classNames.js +0 -10
@@ -1,77 +0,0 @@
1
- import { cloneLayout, compact, correctBounds } from "./renderHelpers";
2
- /**
3
- * Given a width, find the highest breakpoint that matches is valid for it (width > breakpoint).
4
- *
5
- * @param {Object} breakpoints Breakpoints object (e.g. {lg: 1200, md: 960, ...})
6
- * @param {Number} width Screen width.
7
- */
8
- export function getBreakpointFromWidth(breakpoints, width) {
9
- var sorted = sortBreakpoints(breakpoints);
10
- var matching = sorted[0];
11
- for (var i = 1, len = sorted.length; i < len; i++) {
12
- var breakpointName = sorted[i];
13
- if (width > breakpoints[breakpointName])
14
- matching = breakpointName;
15
- }
16
- return matching;
17
- }
18
- /**
19
- * Given a breakpoint, get the # of cols set for it.
20
- */
21
- export function getColsFromBreakpoint(breakpoint, cols) {
22
- if (!cols[breakpoint]) {
23
- throw new Error("ResponsiveGridLayout: `cols` entry for breakpoint " +
24
- breakpoint +
25
- " is missing!");
26
- }
27
- return cols[breakpoint];
28
- }
29
- /**
30
- * Given existing layouts and a new breakpoint, find or generate a new layout.
31
- *
32
- * This finds the layout above the new one and generates from it, if it exists.
33
- */
34
- export function findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, lastBreakpoint, cols, compactType, overlap) {
35
- // If it already exists, just return it.
36
- if (layouts[breakpoint]) {
37
- return cloneLayout(layouts[breakpoint]);
38
- }
39
- // Find or generate the next layout
40
- var layout = layouts[lastBreakpoint];
41
- var breakpointsSorted = sortBreakpoints(breakpoints);
42
- // Above?
43
- for (var i = breakpointsSorted.indexOf(breakpoint); i < breakpointsSorted.length; i++) {
44
- var b = breakpointsSorted[i];
45
- if (layouts[b]) {
46
- layout = layouts[b];
47
- break;
48
- }
49
- }
50
- if (!layout) {
51
- // below?
52
- for (var i = breakpointsSorted.indexOf(breakpoint) - 1; i >= 0; i--) {
53
- var b = breakpointsSorted[i];
54
- if (layouts[b]) {
55
- layout = layouts[b];
56
- break;
57
- }
58
- }
59
- }
60
- layout = cloneLayout(layout || []); // clone layout so we don't modify existing items
61
- return overlap
62
- ? layout
63
- : compact(correctBounds(layout, { cols: cols }), compactType, cols);
64
- }
65
- /**
66
- * Given breakpoints, return an array of breakpoints sorted by width. This is usually
67
- * e.g. ['xxs', 'xs', 'sm', ...]
68
- *
69
- * @param {Object} breakpoints Key/value pair of breakpoint names to widths.
70
- * @return {Array} Sorted breakpoints.
71
- */
72
- export function sortBreakpoints(breakpoints) {
73
- var keys = Object.keys(breakpoints);
74
- return keys.sort(function (a, b) {
75
- return breakpoints[a] - breakpoints[b];
76
- });
77
- }
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- import { PropsWithChildren } from "../Draggable/types";
3
- import { ResizableProps } from "./types";
4
- type Props = ResizableProps;
5
- declare const Resizable: ({ children, axis, handleSize, lockAspectRatio, minConstraints, maxConstraints, resizeHandles, transformScale, isResizing, autoResize, colWidth, margin, ...props }: PropsWithChildren<Props>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
6
- export default Resizable;
@@ -1,385 +0,0 @@
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 { createElement as _createElement } from "react";
33
- import { jsx as _jsx } from "react/jsx-runtime";
34
- import React, { useEffect, useRef, } from "react";
35
- import { cloneElement } from "./utils/cloneElement";
36
- import { DraggableCore } from "../Draggable";
37
- import classNames from "../../external-lib/classnames";
38
- var Resizable = function (_a) {
39
- var children = _a.children, _b = _a.axis, axis = _b === void 0 ? "both" : _b, _c = _a.handleSize, handleSize = _c === void 0 ? [20, 20] : _c, _d = _a.lockAspectRatio, lockAspectRatio = _d === void 0 ? false : _d, _e = _a.minConstraints, minConstraints = _e === void 0 ? [20, 20] : _e, _f = _a.maxConstraints, maxConstraints = _f === void 0 ? [Infinity, Infinity] : _f, _g = _a.resizeHandles, resizeHandles = _g === void 0 ? ["se"] : _g, _h = _a.transformScale, transformScale = _h === void 0 ? 1 : _h, isResizing = _a.isResizing, autoResize = _a.autoResize, colWidth = _a.colWidth, margin = _a.margin, props = __rest(_a, ["children", "axis", "handleSize", "lockAspectRatio", "minConstraints", "maxConstraints", "resizeHandles", "transformScale", "isResizing", "autoResize", "colWidth", "margin"]);
40
- var handleRefs = useRef({
41
- s: useRef(null),
42
- n: useRef(null),
43
- e: useRef(null),
44
- w: useRef(null),
45
- se: useRef(null),
46
- sw: useRef(null),
47
- ne: useRef(null),
48
- nw: useRef(null),
49
- });
50
- var startPosition = useRef(null);
51
- var startSize = useRef(null);
52
- var lastHandleRectRef = useRef(null);
53
- var slack = useRef(null);
54
- var className = props.className, draggableOpts = props.draggableOpts, width = props.width, height = props.height, handle = props.handle, onResize = props.onResize, onResizeStop = props.onResizeStop, onResizeStart = props.onResizeStart, restProps = __rest(props, ["className", "draggableOpts", "width", "height", "handle", "onResize", "onResizeStop", "onResizeStart"]);
55
- var elementRef = children.ref;
56
- var extendedHeightRef = useRef(null);
57
- var shouldShrinkRef = useRef(false);
58
- var minWidth = useRef(0);
59
- var minHeight = useRef(0);
60
- useEffect(function () {
61
- var _a;
62
- if (!autoResize) {
63
- return;
64
- }
65
- if (!isResizing) {
66
- extendedHeightRef.current = null;
67
- minWidth.current = 0;
68
- shouldShrinkRef.current = false;
69
- minHeight.current = 0;
70
- return;
71
- }
72
- if (!elementRef.current) {
73
- return;
74
- }
75
- var placeholder = document.querySelector(".placeholder");
76
- if (!placeholder) {
77
- return;
78
- }
79
- var target = (_a = placeholder.children[0].children[0].children[0]) !== null && _a !== void 0 ? _a : placeholder.children[0].children[0];
80
- var isCCBLayoutbox = target.classList.contains("ccb-layout-box");
81
- if (isCCBLayoutbox) {
82
- return;
83
- }
84
- if (target.clientHeight && !isCCBLayoutbox) {
85
- minHeight.current = target.clientHeight;
86
- }
87
- // target.clientHeight -> 실제 "노드"의 height. (gridItem아닌)
88
- if (target.clientHeight > elementRef.current.clientHeight) {
89
- extendedHeightRef.current = target.clientHeight;
90
- shouldShrinkRef.current = true;
91
- }
92
- else {
93
- extendedHeightRef.current = null;
94
- }
95
- if (shouldShrinkRef.current &&
96
- target.clientHeight < elementRef.current.clientHeight) {
97
- minHeight.current = target.clientHeight;
98
- }
99
- var minWidthStyle = target.computedStyleMap().get("min-width");
100
- if (typeof minWidthStyle.value === "number" && margin && colWidth) {
101
- var minWidthBase = minWidthStyle.value;
102
- var minColWidth = (minWidthBase + margin[0]) / (colWidth + margin[0]);
103
- var minW = Math.ceil(minColWidth);
104
- var minWidthPx = minW * colWidth + (minW - 1) * margin[0];
105
- minWidth.current = Math.round(minWidthPx);
106
- }
107
- }, [isResizing, autoResize, children, elementRef]);
108
- useEffect(function () {
109
- if (!autoResize) {
110
- return;
111
- }
112
- if (!isResizing) {
113
- extendedHeightRef.current = null;
114
- minWidth.current = 0;
115
- shouldShrinkRef.current = false;
116
- minHeight.current = 0;
117
- return;
118
- }
119
- if (!elementRef.current) {
120
- return;
121
- }
122
- setTimeout(function () {
123
- var _a;
124
- var placeholder = document.querySelector(".placeholder");
125
- if (!placeholder) {
126
- return;
127
- }
128
- var target = (_a = placeholder.children[0].children[0].children[0]) !== null && _a !== void 0 ? _a : placeholder.children[0].children[0];
129
- // const oneComposition = target.querySelector(".composition-container");
130
- var isCCBLayoutbox = target.classList.contains("ccb-layout-box");
131
- var layoutBox = target.children[0];
132
- var contentsWrapper = layoutBox.children[0];
133
- var oneComposition = contentsWrapper.querySelector(".composition-container");
134
- // const oneComposition =
135
- // contentsWrapper.children[0].children[0].children[0].children[2];
136
- if (!isCCBLayoutbox || !oneComposition) {
137
- return;
138
- }
139
- if (isCCBLayoutbox && oneComposition) {
140
- var minCellWidth = 10;
141
- var numberOfItems = Number(target.getAttribute("data-number-of-items"));
142
- var numberOfColumns = Number(target.getAttribute("data-number-of-columns"));
143
- var rowGap = Number(target.getAttribute("data-row-gap"));
144
- var columnGap = Number(target.getAttribute("data-column-gap"));
145
- var insetTop = Number(target.getAttribute("data-inset-top"));
146
- var insetBottom = Number(target.getAttribute("data-inset-bottom"));
147
- var compositionCols = Number(oneComposition.getAttribute("data-cols"));
148
- // const compositionRows = Number(
149
- // oneComposition.getAttribute("data-rows")!
150
- // );
151
- var oneCompositionMinWidth = minCellWidth * compositionCols + 20; /* 20px padding */
152
- // let oneCompositionMinHeight =
153
- // minColHeight * compositionRows + 20; /* 20px padding */
154
- // const contentsWrapper = placeholder.querySelector(
155
- // ".cb-contentslist-wrapper"
156
- // );
157
- if (contentsWrapper) {
158
- var gridWrapperInnerH = contentsWrapper.clientHeight;
159
- var oneCompositionH = oneComposition.scrollHeight;
160
- var compositionBGwrapperPaddingT = Number(oneComposition.getAttribute("data-wrapper-paddingt"));
161
- var compositionBGwrapperPaddingB = Number(oneComposition.getAttribute("data-wrapper-paddingb"));
162
- var compositionBGwrapperPaddingL = Number(oneComposition.getAttribute("data-wrapper-paddingl"));
163
- var compositionBGwrapperPaddingR = Number(oneComposition.getAttribute("data-wrapper-paddingr"));
164
- var oneCompositionMinHeight = oneCompositionH +
165
- compositionBGwrapperPaddingT +
166
- compositionBGwrapperPaddingB;
167
- var styles = getComputedStyle(target);
168
- var paddingL = parseFloat(styles.paddingLeft);
169
- var paddingR = parseFloat(styles.paddingRight);
170
- var paddingT = parseFloat(styles.paddingTop);
171
- var paddingB = parseFloat(styles.paddingBottom);
172
- var paddingLR = paddingL + paddingR;
173
- var paddingTB = paddingT + paddingB;
174
- var compositionWrapperPaddingLR = (compositionBGwrapperPaddingL + compositionBGwrapperPaddingR) *
175
- numberOfColumns;
176
- var listMinWidth = oneCompositionMinWidth * numberOfColumns +
177
- (numberOfColumns - 1) * columnGap +
178
- paddingLR +
179
- compositionWrapperPaddingLR;
180
- var numberOfRows = Math.ceil(numberOfItems / numberOfColumns);
181
- var gridWrapperTotalH = gridWrapperInnerH + insetTop + insetBottom;
182
- var listMinHeight = oneCompositionMinHeight * numberOfRows +
183
- (numberOfRows - 1) * rowGap +
184
- paddingTB +
185
- insetTop +
186
- insetBottom;
187
- console.log("listMinHeight", listMinHeight);
188
- console.log("gridWrapperTotalH", gridWrapperTotalH);
189
- if (listMinHeight > gridWrapperTotalH) {
190
- minHeight.current = listMinHeight;
191
- }
192
- minWidth.current = listMinWidth;
193
- }
194
- }
195
- }, 0);
196
- }, [isResizing, autoResize, children, elementRef]);
197
- var resetData = function () {
198
- lastHandleRectRef.current = null;
199
- slack.current = null;
200
- };
201
- // NOTE - 최소 또는 최대 제약 조건 width와 height 계산, 비율 고정 계산
202
- var checkConstraints = function (width, height) {
203
- var _a;
204
- if (!minConstraints && !maxConstraints && !lockAspectRatio) {
205
- return [width, height];
206
- }
207
- if (lockAspectRatio) {
208
- var ratio = props.width / props.height;
209
- var deltaWidth = width - props.width;
210
- var deltaHeight = height - props.height;
211
- if (Math.abs(deltaWidth) > Math.abs(deltaHeight * ratio)) {
212
- height = width / ratio;
213
- }
214
- else {
215
- width = height * ratio;
216
- }
217
- }
218
- var _b = [width, height], oldW = _b[0], oldH = _b[1];
219
- var _c = (_a = slack.current) !== null && _a !== void 0 ? _a : [0, 0], slackW = _c[0], slackH = _c[1];
220
- width += slackW;
221
- height += slackH;
222
- if (autoResize) {
223
- width = Math.max(minWidth.current, width);
224
- height = Math.max(minHeight.current, height);
225
- }
226
- else {
227
- if (minConstraints) {
228
- width = Math.max(minConstraints[0], width);
229
- height = Math.max(minConstraints[1], height);
230
- }
231
- }
232
- if (shouldShrinkRef.current) {
233
- height = minHeight.current;
234
- }
235
- if (maxConstraints) {
236
- width = Math.min(maxConstraints[0], width);
237
- height = Math.min(maxConstraints[1], height);
238
- }
239
- slack.current = [slackW + (oldW - width), slackH + (oldH - height)];
240
- console.log("minH", minHeight.current);
241
- return [width, height];
242
- };
243
- var checkTopLeft = function (deltaX, deltaY, top, left, width, height, handleAxis) {
244
- var newTop = top;
245
- var newLeft = left;
246
- if (!startPosition.current || !startSize.current)
247
- return [newTop, newLeft];
248
- var currentSumOfLeftAndWidth = left + width;
249
- var startSumOfLeftAndWidth = startPosition.current.left + startSize.current.width;
250
- var currentSumOfTopAndHeight = top + height;
251
- var startSumOfTopAndHeight = startPosition.current.top + startSize.current.height;
252
- var resizableLeft = startPosition.current.left + (startSize.current.width - width);
253
- var resizableTop = startPosition.current.top + (startSize.current.height - height);
254
- if (deltaX < 0) {
255
- if (handleAxis === "nw" || handleAxis === "w" || handleAxis === "sw") {
256
- if (currentSumOfLeftAndWidth > startSumOfLeftAndWidth) {
257
- newLeft = Math.min(left, resizableLeft);
258
- }
259
- }
260
- }
261
- if (deltaY < 0) {
262
- if (handleAxis === "nw" || handleAxis === "n" || handleAxis === "ne") {
263
- if (currentSumOfTopAndHeight > startSumOfTopAndHeight) {
264
- newTop = Math.min(top, resizableTop);
265
- }
266
- }
267
- }
268
- if (deltaX > 0) {
269
- if (handleAxis === "nw" || handleAxis === "w" || handleAxis === "sw") {
270
- if (width >= minConstraints[0]) {
271
- newLeft = Math.max(left, resizableLeft);
272
- }
273
- }
274
- }
275
- if (deltaY > 0) {
276
- if (handleAxis === "nw" || handleAxis === "n" || handleAxis === "ne") {
277
- if (height >= minConstraints[1]) {
278
- newTop = Math.max(top, resizableTop);
279
- }
280
- }
281
- }
282
- return [newTop, newLeft];
283
- };
284
- var resizeHandler = function (handlerName, handleAxis) {
285
- return function (e, _a) {
286
- var _b, _c;
287
- var _d, _e, _f, _g, _h, _j;
288
- var node = _a.node, deltaX = _a.deltaX, deltaY = _a.deltaY;
289
- if (handlerName === "onResizeStart") {
290
- var position = { top: (_d = props.top) !== null && _d !== void 0 ? _d : 0, left: (_e = props.left) !== null && _e !== void 0 ? _e : 0 };
291
- startPosition.current = position;
292
- startSize.current = {
293
- width: (_f = props.width) !== null && _f !== void 0 ? _f : 0,
294
- height: (_g = props.height) !== null && _g !== void 0 ? _g : 0,
295
- };
296
- resetData();
297
- }
298
- var canDragX = (axis === "both" || axis === "x") &&
299
- handleAxis !== "n" &&
300
- handleAxis !== "s";
301
- var canDragY = (axis === "both" || axis === "y") &&
302
- handleAxis !== "e" &&
303
- handleAxis !== "w";
304
- if (!canDragX && !canDragY)
305
- return;
306
- var axisV = handleAxis[0];
307
- var axisH = handleAxis[handleAxis.length - 1];
308
- var handleRect = node.getBoundingClientRect();
309
- // if (lastHandleRectRef.current !== null) {
310
- // if (axisH === "w") {
311
- // const deltaLeftSinceLast = handleRect.left - lastHandleRectRef.current.left;
312
- // console.log('delta, :', deltaLeftSinceLast);
313
- // deltaX += deltaLeftSinceLast;
314
- // }
315
- // if (axisV === "n") {
316
- // const deltaTopSinceLast = handleRect.top - lastHandleRectRef.current.top;
317
- // deltaY += deltaTopSinceLast;
318
- // }
319
- // }
320
- lastHandleRectRef.current = handleRect;
321
- if (axisH === "w") {
322
- deltaX = -deltaX;
323
- }
324
- if (axisV === "n") {
325
- deltaY = -deltaY;
326
- }
327
- var width = props.width + (canDragX ? deltaX / transformScale : 0);
328
- var height = props.height + (canDragY ? deltaY / transformScale : 0);
329
- var left = (_h = props === null || props === void 0 ? void 0 : props.left) !== null && _h !== void 0 ? _h : 0;
330
- var top = (_j = props === null || props === void 0 ? void 0 : props.top) !== null && _j !== void 0 ? _j : 0;
331
- if (axisV === "n") {
332
- top = top - deltaY;
333
- }
334
- if (axisH === "w") {
335
- left = left - deltaX;
336
- }
337
- _b = checkConstraints(width, height), width = _b[0], height = _b[1];
338
- if (autoResize && minHeight.current === height) {
339
- handleAxis = removeNorthHandle(handleAxis);
340
- }
341
- console.log("deltax deltay", deltaX, deltaY);
342
- _c = checkTopLeft(deltaX, deltaY, top, left, width, height, handleAxis), top = _c[0], left = _c[1];
343
- var isDimensionsChanged = width !== props.width || height !== props.height;
344
- var cb = typeof props[handlerName] === "function" ? props[handlerName] : null;
345
- var isCbSkipped = handlerName === "onResize" && !isDimensionsChanged;
346
- if (cb && !isCbSkipped) {
347
- cb(e, { node: node, size: { width: width, height: height, top: top, left: left }, handle: handleAxis });
348
- }
349
- if (handlerName === "onResizeStop") {
350
- startPosition.current = null;
351
- startSize.current = null;
352
- resetData();
353
- }
354
- };
355
- };
356
- var renderResizeHandle = function (handleAxis, ref) {
357
- if (!handle) {
358
- return (_jsx("span", { className: "react-resizable-handle react-resizable-handle-".concat(handleAxis), ref: ref }));
359
- }
360
- if (typeof handle === "function") {
361
- return handle(handleAxis, ref);
362
- }
363
- var isDOMElement = typeof handle.type === "string";
364
- var props = __assign({ ref: ref }, (isDOMElement ? {} : { handleAxis: handleAxis }));
365
- return React.cloneElement(handle, props);
366
- };
367
- return cloneElement(children, __assign(__assign({}, restProps), { className: classNames(className !== null && className !== void 0 ? className : "react-resizable"), children: __spreadArray([
368
- // ...children.props.children,
369
- React.Children.map(children.props.children, function (child) { return child; })
370
- ], resizeHandles.map(function (handleAxis) {
371
- var ref = (handleRefs === null || handleRefs === void 0 ? void 0 : handleRefs.current) && handleRefs.current[handleAxis];
372
- return (_createElement(DraggableCore, __assign({}, draggableOpts, { nodeRef: ref, key: "resizableHandle-".concat(handleAxis), onStop: resizeHandler("onResizeStop", handleAxis), onStart: resizeHandler("onResizeStart", handleAxis), onDrag: resizeHandler("onResize", handleAxis) }), renderResizeHandle(handleAxis, ref)));
373
- }), true) }));
374
- };
375
- function removeNorthHandle(axis) {
376
- switch (axis) {
377
- case "ne":
378
- return "e";
379
- case "nw":
380
- return "w";
381
- default:
382
- return axis;
383
- }
384
- }
385
- export default Resizable;
@@ -1,7 +0,0 @@
1
- import { ResizableProps } from "./types";
2
- import { PropsWithChildren } from "../Draggable/types";
3
- type ResizableBoxProps = ResizableProps & {
4
- style?: Object;
5
- };
6
- declare const ResizableBox: ({ children, ...props }: PropsWithChildren<ResizableBoxProps>) => React.ReactElement;
7
- export default ResizableBox;
@@ -1,57 +0,0 @@
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 { useState } from "react";
25
- import Resizable from "./Resizable";
26
- var ResizableBox = function (_a) {
27
- var children = _a.children, props = __rest(_a, ["children"]);
28
- var handle = props.handle, handleSize = props.handleSize, onResize = props.onResize, onResizeStart = props.onResizeStart, onResizeStop = props.onResizeStop, draggableOpts = props.draggableOpts, minConstraints = props.minConstraints, maxConstraints = props.maxConstraints, lockAspectRatio = props.lockAspectRatio, axis = props.axis, width = props.width, height = props.height, resizeHandles = props.resizeHandles, style = props.style, transformScale = props.transformScale, restProps = __rest(props, ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles", "style", "transformScale"]);
29
- var _b = useState({
30
- width: width,
31
- height: height,
32
- propsWidth: width,
33
- propsHeight: height,
34
- }), resizableBoxState = _b[0], setResizableBoxState = _b[1];
35
- var handleResize = function (e, data) {
36
- var size = data.size;
37
- if (props.onResize) {
38
- setResizableBoxState(function (prevState) { return (__assign(__assign({}, prevState), { width: size.width, height: size.height })); });
39
- props.onResize(e, data);
40
- }
41
- else {
42
- setResizableBoxState(function (prevState) { return (__assign(__assign({}, prevState), { width: size.width, height: size.height })); });
43
- }
44
- };
45
- // NOTE - class형 컴포넌트에서 사용되는 getDerivedStateFromProps에 대응하기 위한 조건문입니다.
46
- if (width !== resizableBoxState.propsWidth ||
47
- height !== resizableBoxState.propsHeight) {
48
- setResizableBoxState({
49
- width: width,
50
- height: height,
51
- propsWidth: width,
52
- propsHeight: height,
53
- });
54
- }
55
- return (_jsx(Resizable, { axis: axis, draggableOpts: draggableOpts, handle: handle, handleSize: handleSize, height: resizableBoxState.height, lockAspectRatio: lockAspectRatio, maxConstraints: maxConstraints, minConstraints: minConstraints, onResizeStart: onResizeStart, onResize: handleResize, onResizeStop: onResizeStop, resizeHandles: resizeHandles, transformScale: transformScale, width: resizableBoxState.width, children: _jsx("div", __assign({}, restProps, { style: __assign(__assign({}, style), { width: resizableBoxState.width + "px", height: resizableBoxState.height + "px" }) })) }));
56
- };
57
- export default ResizableBox;
@@ -1 +0,0 @@
1
- export { default as Resizable } from "./Resizable";
@@ -1 +0,0 @@
1
- export { default as Resizable } from "./Resizable";
@@ -1,69 +0,0 @@
1
- import { CSSProperties, ReactElement, Ref, SyntheticEvent } from "react";
2
- import { DraggableCoreDefaultProps } from "../Draggable/types";
3
- export type ReactRef<T> = {
4
- current: T | null;
5
- };
6
- export type Axis = "both" | "x" | "y" | "none";
7
- export type ResizeHandleAxis = "s" | "w" | "e" | "n" | "sw" | "nw" | "se" | "ne";
8
- export type ResizableBoxState = {
9
- width: number;
10
- height: number;
11
- propsWidth: number;
12
- propsHeight: number;
13
- };
14
- export type DragCallbackData = {
15
- node: HTMLElement;
16
- x: number;
17
- y: number;
18
- deltaX: number;
19
- deltaY: number;
20
- lastX: number;
21
- lastY: number;
22
- };
23
- export type ResizeCallbackData = {
24
- node: HTMLElement;
25
- size: {
26
- width: number;
27
- height: number;
28
- top: number;
29
- left: number;
30
- };
31
- handle: ResizeHandleAxis;
32
- minWidth?: number;
33
- minHeight?: number;
34
- };
35
- export type ResizableDefaultProps = {
36
- axis: Axis;
37
- handleSize: [number, number];
38
- lockAspectRatio: boolean;
39
- minConstraints: [number, number];
40
- maxConstraints: [number, number];
41
- resizeHandles: ResizeHandleAxis[];
42
- transformScale: number;
43
- };
44
- export type ResizableProps = {
45
- top?: number;
46
- left?: number;
47
- children?: ReactElement<any>;
48
- axis?: Axis;
49
- className?: string;
50
- draggableOpts?: Partial<DraggableCoreDefaultProps>;
51
- handle?: ResizeHandleType;
52
- onResizeStop?: (e: SyntheticEvent<any>, data: ResizeCallbackData) => any;
53
- onResizeStart?: (e: SyntheticEvent<any>, data: ResizeCallbackData) => any;
54
- onResize?: (e: SyntheticEvent<any>, data: ResizeCallbackData) => any;
55
- handleSize?: [number, number];
56
- lockAspectRatio?: boolean;
57
- minConstraints?: [number, number];
58
- maxConstraints?: [number, number];
59
- resizeHandles?: ResizeHandleAxis[];
60
- transformScale?: number;
61
- style?: CSSProperties;
62
- width: number;
63
- height: number;
64
- isResizing?: boolean;
65
- autoResize?: boolean;
66
- colWidth?: number;
67
- margin?: [number, number];
68
- };
69
- export type ResizeHandleType = ReactElement<any> | ((resizeHandleAxis: ResizeHandleAxis, ref: Ref<HTMLElement>) => ReactElement<any>);
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { PropsWithChildren, ReactElement } from "react";
2
- export declare function cloneElement(element: ReactElement<any>, props: PropsWithChildren<any>): ReactElement<any>;
@@ -1,21 +0,0 @@
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
- import React from "react";
13
- export function cloneElement(element, props) {
14
- if (props.style && element.props.style) {
15
- props.style = __assign(__assign({}, element.props.style), props.style);
16
- }
17
- if (props.className && element.props.className) {
18
- props.className = "".concat(element.props.className, " ").concat(props.className);
19
- }
20
- return React.cloneElement(element, props);
21
- }
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- type ComposedProps<Config> = {
3
- measureBeforeMount?: boolean;
4
- className?: string;
5
- style?: Object;
6
- width?: number;
7
- } & Config;
8
- declare const WidthProvider: <Config>(ComposedComponent: React.ComponentType<Config>) => (props: ComposedProps<Config>) => React.ReactElement;
9
- export default WidthProvider;