publ-echo-test 0.0.358 → 0.0.360

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.
@@ -603,7 +603,7 @@ var GridItem = function (_a) {
603
603
  "data-grid-id": i,
604
604
  "data-z-index": z,
605
605
  "data-z-order": zOrder,
606
- "data-is-pinned": props.isPinned,
606
+ "data-is-height-variable": props.isheightVariable,
607
607
  "data-height-fit-content": heightFitContent,
608
608
  "data-z-order-internal": zOrderInternal,
609
609
  className: classNames("react-grid-item", child.props.className, className, {
@@ -29,7 +29,7 @@ import { perc, setTopLeft, setTransform, } from "../GridLayoutEditor/utils/rende
29
29
  var GroupItem = function (_a) {
30
30
  var _b;
31
31
  var children = _a.children, props = __rest(_a, ["children"]);
32
- 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, minZ = props.minZ, onContextGroup = props.onContextGroup, isPinned = props.isPinned;
32
+ 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, minZ = props.minZ, onContextGroup = props.onContextGroup, isheightVariable = props.isheightVariable;
33
33
  var _l = useState(), resizing = _l[0], setResizing = _l[1];
34
34
  var _m = useState(), dragging = _m[0], setDragging = _m[1];
35
35
  var _o = useState(), dragStart = _o[0], setDragStart = _o[1];
@@ -419,7 +419,7 @@ var GroupItem = function (_a) {
419
419
  "data-z-order": zOrder,
420
420
  "data-z-order-internal": zOrderInternal,
421
421
  "data-min-z": minZ,
422
- "data-is-pinned": isPinned,
422
+ "data-is-height-variable": isheightVariable,
423
423
  className: classNames("react-group-block", child.props.className, className, {
424
424
  static: props.static,
425
425
  isResizing: Boolean(resizing) &&
@@ -83,7 +83,7 @@ export type GridItemProps = {
83
83
  autoResize: boolean;
84
84
  zOrder?: number;
85
85
  zOrderInternal?: string;
86
- isPinned: boolean;
86
+ isheightVariable: boolean;
87
87
  heightFitContent: boolean;
88
88
  };
89
89
  export type GridItemDefaultProps = {
@@ -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";
@@ -535,7 +535,7 @@ var ReactGridLayout = function (_a) {
535
535
  if (!item) {
536
536
  return null;
537
537
  }
538
- return (_jsx(GridItem, { isPinned: false, w: activeDrag.w, h: activeDrag.h, x: activeDrag.x, y: activeDrag.y, z: zIndexMap.ISDRAGGING, i: activeDrag.i, heightFitContent: false, className: "placeholder", containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, isDraggable: false, isResizable: false, isBounded: false, useCSSTransforms: useCSSTransforms, transformScale: transformScale, autoResize: !!l.autoResize, minH: l.minH, minW: l.minW, children: item && item }));
538
+ return (_jsx(GridItem, { isheightVariable: false, w: activeDrag.w, h: activeDrag.h, x: activeDrag.x, y: activeDrag.y, z: zIndexMap.ISDRAGGING, i: activeDrag.i, heightFitContent: false, className: "placeholder", containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, isDraggable: false, isResizable: false, isBounded: false, useCSSTransforms: useCSSTransforms, transformScale: transformScale, autoResize: !!l.autoResize, minH: l.minH, minW: l.minW, children: item && item }));
539
539
  };
540
540
  /**
541
541
  * Given a grid item, set its style attributes & surround in a <Draggable>.
@@ -617,9 +617,9 @@ var ReactGridLayout = function (_a) {
617
617
  y: l.y,
618
618
  i: l.i,
619
619
  });
620
- return (_jsx(GridItem, { heightFitContent: !!(l === null || l === void 0 ? void 0 : l.heightFitContent), isPinned: device === "DESKTOP"
621
- ? !!block.isPinnedDesktop
622
- : !!block.isPinnedMobile, className: classNames({
620
+ return (_jsx(GridItem, { heightFitContent: !!(l === null || l === void 0 ? void 0 : l.heightFitContent), isheightVariable: device === "DESKTOP"
621
+ ? !!block.isHeightVariableDesktop
622
+ : !!block.isHeightVariableMobile, className: classNames({
623
623
  "editable-grid-item": !isRoot && editable,
624
624
  "not-editable-grid-item": !isRoot && !editable,
625
625
  "bulk-child-item": isInBulk,
@@ -749,9 +749,9 @@ var ReactGridLayout = function (_a) {
749
749
  var parent = blockStructure
750
750
  ? findParentGroupBlock(blockStructure, block.blockId)
751
751
  : null;
752
- return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, children: _jsx(GroupItem, { heightFitContent: false, isPinned: device === "DESKTOP"
753
- ? !!block.isPinnedDesktop
754
- : !!block.isPinnedMobile, className: classNames({
752
+ return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, children: _jsx(GroupItem, { heightFitContent: false, isheightVariable: device === "DESKTOP"
753
+ ? !!block.isHeightVariableDesktop
754
+ : !!block.isHeightVariableMobile, className: classNames({
755
755
  "bulk-child-item": isInBulk,
756
756
  "grid-bulk-block": block.blockId === "BULK",
757
757
  editing: editingGroupBlock === block.blockId,
@@ -780,8 +780,13 @@ var ReactGridLayout = function (_a) {
780
780
  var activeDragItemOrSelectedItem = activeDrag || selectedLayoutItem;
781
781
  var activeRows = activeDragItemOrSelectedItem &&
782
782
  Array.from({ length: activeDragItemOrSelectedItem.h }, function (_, i) { return activeDragItemOrSelectedItem.y + i; });
783
+ var heightVariableRows = getRowsForHeightFitContentItems(layout);
784
+ var shouldShowAllHeightVariableRows = activeDragItemOrSelectedItem === null || activeDragItemOrSelectedItem === void 0 ? void 0 : activeDragItemOrSelectedItem.isHeightVariable;
785
+ var activeRowsFiltered = shouldShowAllHeightVariableRows
786
+ ? heightVariableRows
787
+ : activeRows;
783
788
  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
789
  // width={width}
785
- rowHeight: rowHeight, colWidth: colWidth, activeDrag: activeDragItemOrSelectedItem, selectedBlockId: selectedBlockId, totalCols: cols }))] }));
790
+ rowHeight: rowHeight, activeRows: activeRowsFiltered !== null && activeRowsFiltered !== void 0 ? activeRowsFiltered : [], colWidth: colWidth, activeDrag: activeDragItemOrSelectedItem, selectedBlockId: selectedBlockId, totalCols: cols }))] }));
786
791
  };
787
792
  export default ReactGridLayout;
@@ -22,8 +22,8 @@ export type ComponentBlock = {
22
22
  zOrderDesktopInternal: number | null;
23
23
  zOrderMobileInternal: number | null;
24
24
  componentBlockId: number;
25
- isPinnedDesktop: boolean;
26
- isPinnedMobile: boolean;
25
+ isHeightVariableDesktop: boolean;
26
+ isHeightVariableMobile: boolean;
27
27
  };
28
28
  export type GroupBlock = {
29
29
  blockId: string;
@@ -31,8 +31,8 @@ export type GroupBlock = {
31
31
  zOrderDesktopInternal: number | null;
32
32
  zOrderMobileInternal: number | null;
33
33
  children: (ComponentBlock | GroupBlock)[];
34
- isPinnedDesktop: boolean;
35
- isPinnedMobile: boolean;
34
+ isHeightVariableDesktop: boolean;
35
+ isHeightVariableMobile: boolean;
36
36
  };
37
37
  export type RootBlock = {
38
38
  blockId: "ROOT";
@@ -40,8 +40,8 @@ export type RootBlock = {
40
40
  zOrderDesktopInternal: number | null;
41
41
  zOrderMobileInternal: number | null;
42
42
  children: (ComponentBlock | GroupBlock)[];
43
- isPinnedDesktop: boolean;
44
- isPinnedMobile: boolean;
43
+ isHeightVariableDesktop: boolean;
44
+ isHeightVariableMobile: boolean;
45
45
  };
46
46
  export type BulkBlockInternal = {
47
47
  blockId: "BULK";
@@ -49,8 +49,8 @@ export type BulkBlockInternal = {
49
49
  zOrderDesktopInternal: number;
50
50
  zOrderMobileInternal: number;
51
51
  children: (ComponentBlock | GroupBlock)[];
52
- isPinnedDesktop: boolean;
53
- isPinnedMobile: boolean;
52
+ isHeightVariableDesktop: boolean;
53
+ isHeightVariableMobile: boolean;
54
54
  };
55
55
  export declare const findBlockByBlockId: (block: Block, blockId: string) => Block | null;
56
56
  export declare const findDirectChildrenCbIds: (block: Block, targetId: string) => number[];
@@ -217,8 +217,8 @@ export var addBulkToTarget = function (block, targetId, bulkBlockIds) {
217
217
  zOrderDesktopInternal: zOrderDesktopInternal,
218
218
  zOrderMobileInternal: zOrderMobileInternal,
219
219
  children: bulkBlocks,
220
- isPinnedDesktop: false,
221
- isPinnedMobile: false,
220
+ isHeightVariableDesktop: false,
221
+ isHeightVariableMobile: false,
222
222
  };
223
223
  // Add the bulkBlock to the target's children
224
224
  targetBlock.children.push(bulkBlock);
@@ -22,7 +22,7 @@ export type LayoutItem = {
22
22
  isBounded?: boolean;
23
23
  groupLayouts?: LayoutItem[];
24
24
  autoResize?: boolean;
25
- isPinned?: boolean;
25
+ isHeightVariable?: boolean;
26
26
  heightFitContent?: boolean;
27
27
  };
28
28
  export type Layout = LayoutItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.358",
3
+ "version": "0.0.360",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",