publ-echo-test 0.0.260 → 0.0.262
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/Resizable/Resizable.js +48 -27
- package/package.json +1 -1
@@ -31,7 +31,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
31
31
|
};
|
32
32
|
import { createElement as _createElement } from "react";
|
33
33
|
import { jsx as _jsx } from "react/jsx-runtime";
|
34
|
-
import React, { useLayoutEffect, useRef, } from "react";
|
34
|
+
import React, { useEffect, useLayoutEffect, useRef, } from "react";
|
35
35
|
import { cloneElement } from "./utils/cloneElement";
|
36
36
|
import { DraggableCore } from "../Draggable";
|
37
37
|
import classNames from "../../external-lib/classnames";
|
@@ -58,7 +58,7 @@ var Resizable = function (_a) {
|
|
58
58
|
var minWidth = useRef(0);
|
59
59
|
var minHeight = useRef(0);
|
60
60
|
useLayoutEffect(function () {
|
61
|
-
var _a
|
61
|
+
var _a;
|
62
62
|
if (!autoResize) {
|
63
63
|
return;
|
64
64
|
}
|
@@ -76,17 +76,59 @@ var Resizable = function (_a) {
|
|
76
76
|
return;
|
77
77
|
}
|
78
78
|
var target = (_a = placeholder.children[0].children[0].children[0]) !== null && _a !== void 0 ? _a : placeholder.children[0].children[0];
|
79
|
-
var oneComposition = target.querySelector(".composition-container");
|
80
79
|
var isContentsList = target.id === "contentslist-box";
|
81
|
-
if (isContentsList
|
80
|
+
if (isContentsList) {
|
82
81
|
return;
|
83
82
|
}
|
84
83
|
if (target.clientHeight && !isContentsList) {
|
85
84
|
minHeight.current = target.clientHeight;
|
86
|
-
|
85
|
+
}
|
86
|
+
// target.clientHeight -> 실제 "노드"의 height. (gridItem아닌)
|
87
|
+
if (target.clientHeight > elementRef.current.clientHeight) {
|
88
|
+
extendedHeightRef.current = target.clientHeight;
|
89
|
+
shouldShrinkRef.current = true;
|
90
|
+
}
|
91
|
+
else {
|
92
|
+
extendedHeightRef.current = null;
|
93
|
+
}
|
94
|
+
if (shouldShrinkRef.current &&
|
95
|
+
target.clientHeight < elementRef.current.clientHeight) {
|
96
|
+
minHeight.current = target.clientHeight;
|
97
|
+
}
|
98
|
+
var minWidthStyle = target.computedStyleMap().get("min-width");
|
99
|
+
if (typeof minWidthStyle.value === "number" && margin && colWidth) {
|
100
|
+
var minWidthBase = minWidthStyle.value;
|
101
|
+
var minColWidth = (minWidthBase + margin[0]) / (colWidth + margin[0]);
|
102
|
+
var minW = Math.ceil(minColWidth);
|
103
|
+
var minWidthPx = minW * colWidth + (minW - 1) * margin[0];
|
104
|
+
minWidth.current = Math.round(minWidthPx);
|
105
|
+
}
|
106
|
+
}, [isResizing, autoResize, children, elementRef]);
|
107
|
+
useEffect(function () {
|
108
|
+
var _a, _b;
|
109
|
+
if (!autoResize) {
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
if (!isResizing) {
|
113
|
+
extendedHeightRef.current = null;
|
114
|
+
minWidth.current = 0;
|
115
|
+
shouldShrinkRef.current = false;
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
if (!elementRef.current) {
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
var placeholder = document.querySelector(".placeholder");
|
122
|
+
if (!placeholder) {
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
var target = (_a = placeholder.children[0].children[0].children[0]) !== null && _a !== void 0 ? _a : placeholder.children[0].children[0];
|
126
|
+
var oneComposition = target.querySelector(".composition-container");
|
127
|
+
var isContentsList = target.id === "contentslist-box";
|
128
|
+
if (!isContentsList || !oneComposition) {
|
129
|
+
return;
|
87
130
|
}
|
88
131
|
if (isContentsList && oneComposition) {
|
89
|
-
// NOTE: 이건 좀 확인 필요. 근데 지금스팩엔 이게 맞아보임 (gap때문)
|
90
132
|
var minCellWidth = 10;
|
91
133
|
var minColHeight = 11;
|
92
134
|
var numberOfItems = Number(target.getAttribute("data-number-of-items"));
|
@@ -137,27 +179,6 @@ var Resizable = function (_a) {
|
|
137
179
|
}
|
138
180
|
return;
|
139
181
|
}
|
140
|
-
console.log("fallthrough,");
|
141
|
-
// target.clientHeight -> 실제 "노드"의 height. (gridItem아닌)
|
142
|
-
if (target.clientHeight > elementRef.current.clientHeight) {
|
143
|
-
extendedHeightRef.current = target.clientHeight;
|
144
|
-
shouldShrinkRef.current = true;
|
145
|
-
}
|
146
|
-
else {
|
147
|
-
extendedHeightRef.current = null;
|
148
|
-
}
|
149
|
-
if (shouldShrinkRef.current &&
|
150
|
-
target.clientHeight < elementRef.current.clientHeight) {
|
151
|
-
minHeight.current = target.clientHeight;
|
152
|
-
}
|
153
|
-
var minWidthStyle = target.computedStyleMap().get("min-width");
|
154
|
-
if (typeof minWidthStyle.value === "number" && margin && colWidth) {
|
155
|
-
var minWidthBase = minWidthStyle.value;
|
156
|
-
var minColWidth = (minWidthBase + margin[0]) / (colWidth + margin[0]);
|
157
|
-
var minW = Math.ceil(minColWidth);
|
158
|
-
var minWidthPx = minW * colWidth + (minW - 1) * margin[0];
|
159
|
-
minWidth.current = Math.round(minWidthPx);
|
160
|
-
}
|
161
182
|
}, [isResizing, autoResize, children, elementRef]);
|
162
183
|
var resetData = function () {
|
163
184
|
lastHandleRectRef.current = null;
|