publ-echo-test 0.0.359 → 0.0.361

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.
@@ -1,5 +1,5 @@
1
1
  import { ResizeHandleAxis } from "../../Resizable/types";
2
- import { Position, PositionParams } from "../../GridLayoutEditor/types";
2
+ import { Layout, Position, PositionParams } from "../../GridLayoutEditor/types";
3
3
  export type RowHeight = number | ((width: number) => number);
4
4
  export declare function calcGridColWidth(positionParams: PositionParams): number;
5
5
  export declare function calcGridItemWHPx(gridUnits: number, colOrRowSize: number, marginPx: number): number;
@@ -28,3 +28,11 @@ export declare function calcWH(positionParams: PositionParams, { width, height }
28
28
  h: number;
29
29
  };
30
30
  export declare function clamp(num: number, lowerBound: number, upperBound: number): number;
31
+ /**
32
+ * layout 배열을 분석하여 'heightFitContent'가 true인 모든 아이템이
33
+ * 차지하고 있는 Row 인덱스 배열을 반환합니다.
34
+ *
35
+ * @param layout - 현재 그리드 레이아웃 (LayoutItem 배열)
36
+ * @returns 중복이 제거되고 정렬된 Row 인덱스 배열 (예: [0, 1, 2, 5, 6])
37
+ */
38
+ export declare const getRowsForHeightFitContentItems: (layout: Layout) => number[];
@@ -113,3 +113,30 @@ function roundToOneDecimal(num) {
113
113
  function truncateToOneDecimal(num) {
114
114
  return Math.floor(num * 10) / 10;
115
115
  }
116
+ // ReactGridLayout.tsx 파일 상단이나, 임포트하는 유틸리티 파일에
117
+ /**
118
+ * layout 배열을 분석하여 'heightFitContent'가 true인 모든 아이템이
119
+ * 차지하고 있는 Row 인덱스 배열을 반환합니다.
120
+ *
121
+ * @param layout - 현재 그리드 레이아웃 (LayoutItem 배열)
122
+ * @returns 중복이 제거되고 정렬된 Row 인덱스 배열 (예: [0, 1, 2, 5, 6])
123
+ */
124
+ export var getRowsForHeightFitContentItems = function (layout) {
125
+ // Set을 사용하여 Row 인덱스의 중복을 자동으로 처리합니다.
126
+ var activeRows = new Set();
127
+ // 1. heightFitContent가 true인 아이템들만 필터링합니다.
128
+ var fitContentItems = layout.filter(function (item) { return item.heightFitContent === true; });
129
+ // 2. 필터링된 각 아이템을 순회합니다.
130
+ for (var _i = 0, fitContentItems_1 = fitContentItems; _i < fitContentItems_1.length; _i++) {
131
+ var item = fitContentItems_1[_i];
132
+ // 3. 아이템이 차지하는 모든 Row를 Set에 추가합니다.
133
+ // (예: y=2, h=3 이면 2, 3, 4 행을 추가)
134
+ var startRow = item.y;
135
+ var endRow = item.y + item.h;
136
+ for (var row = startRow; row < endRow; row++) {
137
+ activeRows.add(row);
138
+ }
139
+ }
140
+ // 4. Set을 배열로 변환하고 오름차순으로 정렬하여 반환합니다.
141
+ return Array.from(activeRows).sort(function (a, b) { return a - b; });
142
+ };
@@ -8,6 +8,7 @@ type PlaceholderProps = {
8
8
  activeDrag: LayoutItem;
9
9
  selectedBlockId: string | null;
10
10
  totalCols: number;
11
+ activeRows: number[];
11
12
  };
12
- export declare function GridBackgroundPlaceholder({ margin, rowHeight, colWidth, backgroundWidth, backgroundHeight, activeDrag, selectedBlockId, totalCols, }: PlaceholderProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function GridBackgroundPlaceholder({ margin, rowHeight, colWidth, backgroundWidth, backgroundHeight, activeDrag, selectedBlockId, activeRows, totalCols, }: PlaceholderProps): import("react/jsx-runtime").JSX.Element;
13
14
  export {};
@@ -1,10 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  export function GridBackgroundPlaceholder(_a) {
3
+ // 활성화된 행(row) 인덱스 배열
4
+ // const activeRows = Array.from(
5
+ // { length: activeDrag.h },
6
+ // (_, i) => activeDrag.y + i
7
+ // );
3
8
  var margin = _a.margin,
4
9
  // width, // 🚨 제거
5
- rowHeight = _a.rowHeight, colWidth = _a.colWidth, backgroundWidth = _a.backgroundWidth, backgroundHeight = _a.backgroundHeight, activeDrag = _a.activeDrag, selectedBlockId = _a.selectedBlockId, totalCols = _a.totalCols;
6
- // 활성화된 행(row) 인덱스 배열
7
- var activeRows = Array.from({ length: activeDrag.h }, function (_, i) { return activeDrag.y + i; });
10
+ rowHeight = _a.rowHeight, colWidth = _a.colWidth, backgroundWidth = _a.backgroundWidth, backgroundHeight = _a.backgroundHeight, activeDrag = _a.activeDrag, selectedBlockId = _a.selectedBlockId, activeRows = _a.activeRows, totalCols = _a.totalCols;
8
11
  // 🚨 activeCols도 totalCols prop으로 받아서 사용
9
12
  // const activeCols = Array.from({ length: 24 }, (_, i) => 0 + i);
10
13
  var activeCols = Array.from({ length: totalCols }, function (_, i) { return 0 + i; });
@@ -34,7 +34,7 @@ import * as React from "react";
34
34
  import { useState, useRef, useLayoutEffect } from "react";
35
35
  import classNames from "../../external-lib/classnames";
36
36
  import { bottom, cloneLayoutItem, compact, getAllCollisions, getBoundingArea, getLayoutItem, moveElement, noop, synchronizeLayoutWithChildren, withLayoutItem, } from "./utils/renderHelpers";
37
- import { calcGridColWidth, calcXY, resolveRowHeight, } from "../GridItem/utils/calculateUtils";
37
+ import { calcGridColWidth, calcXY, getRowsForHeightFitContentItems, resolveRowHeight, } from "../GridItem/utils/calculateUtils";
38
38
  // NOTE: 필수 변경하기
39
39
  import GridItem from "../GridItem/GridItem";
40
40
  import isEqual from "../../external-lib/lodash.isEqual";
@@ -64,9 +64,6 @@ var ReactGridLayout = function (_a) {
64
64
  var editableBlockIds = blockStructure
65
65
  ? findDirectChildrenCbIds(blockStructure, editingGroupBlock)
66
66
  : [];
67
- var selectedBlock = blockStructure && selectedBlockId
68
- ? findBlockByBlockId(blockStructure, selectedBlockId)
69
- : null;
70
67
  var editingGroupAllChildren = blockStructure && editingGroupBlock
71
68
  ? findAllChildrenCbIds(blockStructure, editingGroupBlock).map(function (i) {
72
69
  return i.toString();
@@ -231,6 +228,7 @@ var ReactGridLayout = function (_a) {
231
228
  placeholder: true,
232
229
  i: i,
233
230
  heightFitContent: l.heightFitContent,
231
+ isHeightVariable: l.isHeightVariable,
234
232
  };
235
233
  var isUserAction = true;
236
234
  var newLayout = isGroup
@@ -442,6 +440,7 @@ var ReactGridLayout = function (_a) {
442
440
  static: true,
443
441
  i: i,
444
442
  heightFitContent: l.heightFitContent,
443
+ isHeightVariable: l.isHeightVariable,
445
444
  };
446
445
  props.onResize &&
447
446
  props.onResize({
@@ -778,10 +777,22 @@ var ReactGridLayout = function (_a) {
778
777
  ? getLayoutItem(layout, selectedBlockId)
779
778
  : null;
780
779
  var activeDragItemOrSelectedItem = activeDrag || selectedLayoutItem;
780
+ var activeBlock = activeDragItemOrSelectedItem
781
+ ? blockStructure
782
+ ? findBlockByBlockId(blockStructure, formatCbIdToBlockId(Number(activeDragItemOrSelectedItem.i)))
783
+ : null
784
+ : null;
781
785
  var activeRows = activeDragItemOrSelectedItem &&
782
786
  Array.from({ length: activeDragItemOrSelectedItem.h }, function (_, i) { return activeDragItemOrSelectedItem.y + i; });
787
+ var heightVariableRows = getRowsForHeightFitContentItems(layout);
788
+ var shouldShowAllHeightVariableRows = device === "DESKTOP"
789
+ ? activeBlock === null || activeBlock === void 0 ? void 0 : activeBlock.isHeightVariableDesktop
790
+ : activeBlock === null || activeBlock === void 0 ? void 0 : activeBlock.isHeightVariableMobile;
791
+ var activeRowsFiltered = shouldShowAllHeightVariableRows
792
+ ? heightVariableRows
793
+ : activeRows;
783
794
  return (_jsxs("div", { ref: innerRef, className: mergedClassName, style: mergedStyle, onDrop: isDroppable ? onDropHandler : noop, onDragLeave: isDroppable ? onDragLeaveHandler : noop, onDragEnter: isDroppable ? onDragEnterHandler : noop, onDragOver: isDroppable ? onDragOverHandler : noop, "data-grid-row-height": rowHeight, "data-grid-cols": cols, "data-section-id": sectionId, children: [currentGroupBlocks.map(function (each) { return processGroup(each); }), React.Children.map(children, function (child) { return processGridItem(child); }), placeholder(), activeDrag && _jsx("div", { className: "grid-guide-line-center" }), activeDragItemOrSelectedItem && (_jsx(GridBackgroundPlaceholder, { backgroundWidth: getBackgroundWidth(), backgroundHeight: getBackgroundHeight(), margin: margin,
784
795
  // width={width}
785
- rowHeight: rowHeight, colWidth: colWidth, activeDrag: activeDragItemOrSelectedItem, selectedBlockId: selectedBlockId, totalCols: cols }))] }));
796
+ rowHeight: rowHeight, activeRows: activeRowsFiltered !== null && activeRowsFiltered !== void 0 ? activeRowsFiltered : [], colWidth: colWidth, activeDrag: activeDragItemOrSelectedItem, selectedBlockId: selectedBlockId, totalCols: cols }))] }));
786
797
  };
787
798
  export default ReactGridLayout;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.359",
3
+ "version": "0.0.361",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",