publ-echo-test 0.0.277 → 0.0.279
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/GridItem/GridItem.js +175 -139
- package/package.json +1 -1
@@ -118,145 +118,181 @@ var GridItem = function (_a) {
|
|
118
118
|
observer.disconnect();
|
119
119
|
};
|
120
120
|
}, [autoResize, isSelected, isDragging, isResizing, props.w, props.h, x, y]);
|
121
|
-
useEffect(
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
121
|
+
// useEffect(() => {
|
122
|
+
// if (!isSelected || !autoResize) {
|
123
|
+
// return;
|
124
|
+
// }
|
125
|
+
// const targetNode = elementRef.current?.children[0].children[0].children[0];
|
126
|
+
// if (!targetNode || isDragging || isResizing) {
|
127
|
+
// return;
|
128
|
+
// }
|
129
|
+
// if (targetNode.id !== "contentslist-box") {
|
130
|
+
// return;
|
131
|
+
// }
|
132
|
+
// const prevPaddingL = parseFloat(getComputedStyle(targetNode).paddingLeft);
|
133
|
+
// const prevPaddingR = parseFloat(getComputedStyle(targetNode).paddingRight);
|
134
|
+
// const prevPaddingT = parseFloat(getComputedStyle(targetNode).paddingTop);
|
135
|
+
// const prevPaddingB = parseFloat(getComputedStyle(targetNode).paddingBottom);
|
136
|
+
// // MutationObserver 콜백 함수
|
137
|
+
// const callback = (mutationsList: any[]) => {
|
138
|
+
// for (let mutation of mutationsList) {
|
139
|
+
// const isSizeChanged =
|
140
|
+
// mutation.attributeName === "data-min-width" ||
|
141
|
+
// mutation.attributeName === "data-min-height";
|
142
|
+
// console.log("mutation", mutation);
|
143
|
+
// let keepWidth = true;
|
144
|
+
// let hasPaddingChanged = true;
|
145
|
+
// const insetTop = Number(mutation.target.dataset.insetTop!);
|
146
|
+
// const insetBottom = Number(mutation.target.dataset.insetBottom!);
|
147
|
+
// const minWidth = Number(mutation.target.dataset.minWidth);
|
148
|
+
// // const minHeight =
|
149
|
+
// // Number(mutation.target.dataset.minHeight) + insetTop + insetBottom;
|
150
|
+
// const contentsWrapper = mutation.target.querySelector(
|
151
|
+
// ".cb-contentslist-wrapper"
|
152
|
+
// );
|
153
|
+
// const oneComposition = mutation.target.querySelector(
|
154
|
+
// ".composition-container"
|
155
|
+
// );
|
156
|
+
// let minHeight = 0;
|
157
|
+
// if (contentsWrapper && oneComposition) {
|
158
|
+
// const minCellWidth = 10;
|
159
|
+
// const minColHeight = 11;
|
160
|
+
// const numberOfItems = Number(
|
161
|
+
// mutation.target.getAttribute("data-number-of-items")!
|
162
|
+
// );
|
163
|
+
// const numberOfColumns = Number(
|
164
|
+
// mutation.target.getAttribute("data-number-of-columns")!
|
165
|
+
// );
|
166
|
+
// const rowGap = Number(mutation.target.getAttribute("data-row-gap")!);
|
167
|
+
// const columnGap = Number(
|
168
|
+
// mutation.target.getAttribute("data-column-gap")!
|
169
|
+
// );
|
170
|
+
// const insetTop = Number(
|
171
|
+
// mutation.target.getAttribute("data-inset-top")!
|
172
|
+
// );
|
173
|
+
// const insetBottom = Number(
|
174
|
+
// mutation.target.getAttribute("data-inset-bottom")!
|
175
|
+
// );
|
176
|
+
// const compositionCols = Number(
|
177
|
+
// oneComposition.getAttribute("data-cols")!
|
178
|
+
// );
|
179
|
+
// const compositionRows = Number(
|
180
|
+
// oneComposition.getAttribute("data-rows")!
|
181
|
+
// );
|
182
|
+
// const oneCompositionMinWidth =
|
183
|
+
// minCellWidth * compositionCols + 20; /* 20px padding */
|
184
|
+
// // let oneCompositionMinHeight =
|
185
|
+
// // minColHeight * compositionRows + 20; /* 20px padding */
|
186
|
+
// if (contentsWrapper) {
|
187
|
+
// const gridWrapperInnerH = contentsWrapper.clientHeight;
|
188
|
+
// const oneCompositionH = oneComposition.clientHeight;
|
189
|
+
// const CompositionBGwrapperPaddingT = Number(
|
190
|
+
// oneComposition.getAttribute("data-wrapper-paddingT")
|
191
|
+
// );
|
192
|
+
// const CompositionBGwrapperPaddingB = Number(
|
193
|
+
// oneComposition.getAttribute("data-wrapper-paddingB")
|
194
|
+
// );
|
195
|
+
// const oneCompositionMinHeight =
|
196
|
+
// oneCompositionH +
|
197
|
+
// CompositionBGwrapperPaddingT +
|
198
|
+
// CompositionBGwrapperPaddingB;
|
199
|
+
// const styles = getComputedStyle(mutation.target as Element);
|
200
|
+
// const paddingL = parseFloat(styles.paddingLeft);
|
201
|
+
// const paddingR = parseFloat(styles.paddingRight);
|
202
|
+
// const paddingT = parseFloat(styles.paddingTop);
|
203
|
+
// const paddingB = parseFloat(styles.paddingBottom);
|
204
|
+
// const paddingLR = paddingL + paddingR;
|
205
|
+
// const paddingTB = paddingT + paddingB;
|
206
|
+
// const listMinWidth =
|
207
|
+
// oneCompositionMinWidth * numberOfColumns +
|
208
|
+
// (numberOfColumns - 1) * columnGap +
|
209
|
+
// paddingLR;
|
210
|
+
// const numberOfRows = Math.ceil(numberOfItems / numberOfColumns);
|
211
|
+
// const gridWrapperTotalH =
|
212
|
+
// gridWrapperInnerH + insetTop + insetBottom;
|
213
|
+
// const listMinHeight =
|
214
|
+
// oneCompositionMinHeight * numberOfRows +
|
215
|
+
// (numberOfRows - 1) * rowGap +
|
216
|
+
// paddingTB +
|
217
|
+
// insetTop +
|
218
|
+
// insetBottom;
|
219
|
+
// console.log("minH", listMinHeight);
|
220
|
+
// console.log("oneCompositionMinHeight", oneCompositionMinHeight);
|
221
|
+
// console.log("insetTop, insetBottom", insetTop, insetBottom);
|
222
|
+
// if (listMinHeight > gridWrapperTotalH) {
|
223
|
+
// minHeight = listMinHeight;
|
224
|
+
// }
|
225
|
+
// // minWidth = listMinWidth;
|
226
|
+
// }
|
227
|
+
// }
|
228
|
+
// // If minWidth or minHeight is NaN, return early to prevent errors
|
229
|
+
// if (isNaN(minWidth) || isNaN(minHeight)) {
|
230
|
+
// return;
|
231
|
+
// }
|
232
|
+
// let width = targetNode.clientWidth;
|
233
|
+
// if (!isSizeChanged && mutation.target instanceof Element) {
|
234
|
+
// const styles = getComputedStyle(mutation.target as Element);
|
235
|
+
// if (minWidth > width) {
|
236
|
+
// keepWidth = false;
|
237
|
+
// }
|
238
|
+
// // NOTE: POC
|
239
|
+
// const paddingL = parseFloat(styles.paddingLeft);
|
240
|
+
// const paddingR = parseFloat(styles.paddingRight);
|
241
|
+
// const paddingT = parseFloat(styles.paddingTop);
|
242
|
+
// const paddingB = parseFloat(styles.paddingBottom);
|
243
|
+
// if (
|
244
|
+
// prevPaddingL !== paddingL ||
|
245
|
+
// prevPaddingR !== paddingR ||
|
246
|
+
// prevPaddingT !== paddingT ||
|
247
|
+
// prevPaddingB !== paddingB
|
248
|
+
// ) {
|
249
|
+
// hasPaddingChanged = true;
|
250
|
+
// keepWidth = false;
|
251
|
+
// }
|
252
|
+
// }
|
253
|
+
// const prevW = props.w;
|
254
|
+
// const prevH = props.h;
|
255
|
+
// let { w, h } = calcWH(
|
256
|
+
// getPositionParams(),
|
257
|
+
// {
|
258
|
+
// width: minWidth,
|
259
|
+
// height: minHeight,
|
260
|
+
// },
|
261
|
+
// x,
|
262
|
+
// y,
|
263
|
+
// "e",
|
264
|
+
// props.w,
|
265
|
+
// props.h,
|
266
|
+
// true
|
267
|
+
// );
|
268
|
+
// if (keepWidth) {
|
269
|
+
// w = prevW;
|
270
|
+
// }
|
271
|
+
// if (prevH > h) {
|
272
|
+
// h = prevH;
|
273
|
+
// }
|
274
|
+
// const { newX, newY } = getResizableXYPosition("e", w, h, prevW, prevH);
|
275
|
+
// if (prevH === h && prevW === w && newX === x && newY === y) {
|
276
|
+
// return;
|
277
|
+
// }
|
278
|
+
// props.onFitToContent &&
|
279
|
+
// props.onFitToContent(i, w, h, newX, newY, { hasPaddingChanged });
|
280
|
+
// }
|
281
|
+
// };
|
282
|
+
// // MutationObserver 인스턴스 생성
|
283
|
+
// const observer = new MutationObserver(callback);
|
284
|
+
// // 관찰할 DOM 변이 설정
|
285
|
+
// const config = { attributes: true, characterData: true };
|
286
|
+
// // 대상 노드와 설정으로 관찰 시작
|
287
|
+
// observer.observe(targetNode, config);
|
288
|
+
// // 정리 함수에서 MutationObserver 해제
|
289
|
+
// return () => {
|
290
|
+
// if (targetNode.id !== "contentslist-box") {
|
291
|
+
// return;
|
292
|
+
// }
|
293
|
+
// observer.disconnect();
|
294
|
+
// };
|
295
|
+
// }, [autoResize, isSelected, isDragging, isResizing, props.w, props.h, x, y]);
|
260
296
|
// useEffect(() => {
|
261
297
|
// if (!isSelected || !autoResize) {
|
262
298
|
// return;
|