publ-echo-test 0.0.148 → 0.0.149

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.
@@ -4,6 +4,6 @@ import { PropsWithChildren } from '../types';
4
4
  declare const GroupItem: ({ children, ...props }: PropsWithChildren<GridItemProps & {
5
5
  onContextGroup: (e: React.MouseEvent) => void;
6
6
  zOrder: number;
7
- zOrderInternal: number;
7
+ zOrderInternal: string;
8
8
  }>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
9
9
  export default GroupItem;
@@ -82,7 +82,7 @@ export type GridItemProps = {
82
82
  customColWidth?: number;
83
83
  autoResize: boolean;
84
84
  zOrder?: number;
85
- zOrderInternal?: number;
85
+ zOrderInternal?: string;
86
86
  };
87
87
  export type GridItemDefaultProps = {
88
88
  className: string;
@@ -37,7 +37,7 @@ import { bottom, cloneLayoutItem, compact, getAllCollisions, getBoundingArea, ge
37
37
  import { calcGridColWidth, calcXY, resolveRowHeight, } from '../GridItem/utils/calculateUtils';
38
38
  import GridItem from '../GridItem/GridItem';
39
39
  import isEqual from '../../external-lib/lodash.isEqual';
40
- import { findAllChildrenCbIds, findBlockByBlockId, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, formatCbIdToBlockId, getBlockSpecificType, zIndexMap, } from './group';
40
+ import { findAllChildrenCbIds, findBlockByBlockId, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, findParentGroupBlock, formatCbIdToBlockId, getBlockSpecificType, zIndexMap, } from './group';
41
41
  import GroupItem from '../GridItem/GroupItem';
42
42
  import OutsideClickHandler from '../GridItem/OutsideClickHandler';
43
43
  var layoutClassName = 'react-grid-layout';
@@ -558,6 +558,9 @@ var ReactGridLayout = function (_a) {
558
558
  var block = blockStructure
559
559
  ? findBlockByBlockId(blockStructure, formatCbIdToBlockId(Number(l.i)))
560
560
  : undefined;
561
+ var parent = blockStructure
562
+ ? findParentGroupBlock(blockStructure, formatCbIdToBlockId(Number(l.i)))
563
+ : null;
561
564
  if (!block) {
562
565
  return _jsx(_Fragment, { children: "NO-BLOCK-FOUND" });
563
566
  }
@@ -587,7 +590,7 @@ var ReactGridLayout = function (_a) {
587
590
  'not-editable-grid-item': !isRoot && !editable,
588
591
  'bulk-child-item': isInBulk,
589
592
  'outside-of-editing-group': outsideOfEditingGroup,
590
- }), z: zIndex, zOrder: l.z, zOrderInternal: zOrder, isDraggable: editable && !isInBulk, isResizable: editable && !isInBulk, containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, cancel: draggableCancel, handle: draggableHandle, onDragStop: onDragStopHandler, onDragStart: onDragStartHandler, onDrag: onDragHandler, onResizeStart: onResizeStartHandler, onResize: onResizeHandler, onResizeStop: onResizeStopHandler, onFitToContent: onFitToContentHandler, isBounded: bounded, useCSSTransforms: useCSSTransforms && isMounted, usePercentages: !isMounted, transformScale: transformScale, w: l.w, h: l.h, x: l.x, y: l.y, i: l.i, minH: l.minH, minW: l.minW, maxH: l.maxH, maxW: l.maxW, static: l.static, droppingPosition: isDroppingItem ? droppingPosition : undefined, resizeHandles: resizeHandlesOptions, resizeHandle: resizeHandle, isHiddenVisibility: isHiddenVisibility, customColWidth: colWidth, autoResize: !!l.autoResize, children: child }, l.i));
593
+ }), z: zIndex, zOrder: l.z, zOrderInternal: parent ? "".concat(parent.blockId, " > ").concat(zOrder) : zOrder.toString(), isDraggable: editable && !isInBulk, isResizable: editable && !isInBulk, containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, cancel: draggableCancel, handle: draggableHandle, onDragStop: onDragStopHandler, onDragStart: onDragStartHandler, onDrag: onDragHandler, onResizeStart: onResizeStartHandler, onResize: onResizeHandler, onResizeStop: onResizeStopHandler, onFitToContent: onFitToContentHandler, isBounded: bounded, useCSSTransforms: useCSSTransforms && isMounted, usePercentages: !isMounted, transformScale: transformScale, w: l.w, h: l.h, x: l.x, y: l.y, i: l.i, minH: l.minH, minW: l.minW, maxH: l.maxH, maxW: l.maxW, static: l.static, droppingPosition: isDroppingItem ? droppingPosition : undefined, resizeHandles: resizeHandlesOptions, resizeHandle: resizeHandle, isHiddenVisibility: isHiddenVisibility, customColWidth: colWidth, autoResize: !!l.autoResize, children: child }, l.i));
591
594
  };
592
595
  var onDragOverHandler = function (e) {
593
596
  var _a;
@@ -706,12 +709,15 @@ var ReactGridLayout = function (_a) {
706
709
  (props === null || props === void 0 ? void 0 : props.onContextGroup) &&
707
710
  props.onContextGroup(e, block.blockId, isEditingGroup);
708
711
  };
712
+ var parent = blockStructure
713
+ ? findParentGroupBlock(blockStructure, block.blockId)
714
+ : null;
709
715
  return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, children: _jsx(GroupItem, { className: classNames({
710
716
  'bulk-child-item': isInBulk,
711
717
  'grid-bulk-block': block.blockId === 'BULK',
712
718
  editing: editingGroupBlock === block.blockId,
713
719
  selected: selectedGroupBlock === block.blockId,
714
- }), z: zIndex, zOrder: zOrder, zOrderInternal: zOrder, containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, cancel: draggableCancel, handle: draggableHandle, onDragStop: onDragStopGroupHandler, onDragStart: onDragStartHandler, onDrag: onDragHandler, onResizeStart: onResizeStartHandler, onResize: onResizeHandler, onResizeStop: onResizeStopHandler, onFitToContent: onFitToContentHandler, isDraggable: !viewOnly && !isEditingGroup && !isInBulk, isResizable: !viewOnly && !isEditingGroup && !isInBulk, isBounded: false, useCSSTransforms: useCSSTransforms && isMounted, usePercentages: !isMounted, transformScale: transformScale, w: groupItem.w, h: groupItem.h, x: groupItem.x, y: groupItem.y, i: block.blockId,
720
+ }), z: zIndex, zOrder: zOrder, zOrderInternal: parent ? "".concat(parent.blockId, " > ").concat(zOrder) : zOrder.toString(), containerWidth: width, cols: cols, margin: margin, containerPadding: containerPadding || margin, maxRows: maxRows, rowHeight: rowHeight, cancel: draggableCancel, handle: draggableHandle, onDragStop: onDragStopGroupHandler, onDragStart: onDragStartHandler, onDrag: onDragHandler, onResizeStart: onResizeStartHandler, onResize: onResizeHandler, onResizeStop: onResizeStopHandler, onFitToContent: onFitToContentHandler, isDraggable: !viewOnly && !isEditingGroup && !isInBulk, isResizable: !viewOnly && !isEditingGroup && !isInBulk, isBounded: false, useCSSTransforms: useCSSTransforms && isMounted, usePercentages: !isMounted, transformScale: transformScale, w: groupItem.w, h: groupItem.h, x: groupItem.x, y: groupItem.y, i: block.blockId,
715
721
  // minH={l.minH}
716
722
  // minW={l.minW}
717
723
  // maxH={l.maxH}
@@ -53,3 +53,4 @@ export declare const addBulkToTarget: (block: Block, targetId: string, bulkBlock
53
53
  export declare function getBlockWorkDirPath(blockStructure: Block, targetBlockId: string): string;
54
54
  export declare function formatBlockIdToCbId(blockId: string): number | null;
55
55
  export declare function formatCbIdToBlockId(cbId: number): string;
56
+ export declare function findParentGroupBlock(current: Block, targetBlockId: string): GroupBlock | null;
@@ -278,3 +278,31 @@ export function formatCbIdToBlockId(cbId) {
278
278
  // }
279
279
  // return Array.from(result);
280
280
  // };
281
+ export function findParentGroupBlock(current, targetBlockId) {
282
+ // 현재 블록이 그룹(또는 루트) 블록이고, 자식이 있다면 탐색합니다.
283
+ if ('children' in current && Array.isArray(current.children)) {
284
+ for (var _i = 0, _a = current.children; _i < _a.length; _i++) {
285
+ var child = _a[_i];
286
+ // 자식 중에 targetBlockId를 가진 블록이 있다면,
287
+ if (child.blockId === targetBlockId) {
288
+ // 현재 블록이 ROOT라면 부모가 ROOT이므로 null 반환
289
+ if (current.blockId === 'ROOT') {
290
+ return null;
291
+ }
292
+ // 그렇지 않다면 현재 블록이 부모 그룹 블록이므로 반환
293
+ if (current.type === 'GROUP_BLOCK') {
294
+ return current;
295
+ }
296
+ }
297
+ // 만약 자식이 그룹 블록이라면 재귀적으로 탐색
298
+ if (child.type === 'GROUP_BLOCK') {
299
+ var found = findParentGroupBlock(child, targetBlockId);
300
+ if (found !== null) {
301
+ return found;
302
+ }
303
+ }
304
+ }
305
+ }
306
+ // 찾지 못하면 null 반환
307
+ return null;
308
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.148",
3
+ "version": "0.0.149",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",