publ-echo-test 0.0.148 → 0.0.150
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:
|
7
|
+
zOrderInternal: string;
|
8
8
|
}>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
9
9
|
export default GroupItem;
|
@@ -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,11 @@ 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:
|
593
|
+
}), z: zIndex, zOrder: l.z, zOrderInternal: parent
|
594
|
+
? "".concat(parent[device === 'DESKTOP'
|
595
|
+
? 'zOrderDesktopInternal'
|
596
|
+
: 'zOrderMobileInternal'], " > ").concat(zOrder)
|
597
|
+
: 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
598
|
};
|
592
599
|
var onDragOverHandler = function (e) {
|
593
600
|
var _a;
|
@@ -706,12 +713,19 @@ var ReactGridLayout = function (_a) {
|
|
706
713
|
(props === null || props === void 0 ? void 0 : props.onContextGroup) &&
|
707
714
|
props.onContextGroup(e, block.blockId, isEditingGroup);
|
708
715
|
};
|
716
|
+
var parent = blockStructure
|
717
|
+
? findParentGroupBlock(blockStructure, block.blockId)
|
718
|
+
: null;
|
709
719
|
return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, children: _jsx(GroupItem, { className: classNames({
|
710
720
|
'bulk-child-item': isInBulk,
|
711
721
|
'grid-bulk-block': block.blockId === 'BULK',
|
712
722
|
editing: editingGroupBlock === block.blockId,
|
713
723
|
selected: selectedGroupBlock === block.blockId,
|
714
|
-
}), z: zIndex, zOrder: zOrder, zOrderInternal:
|
724
|
+
}), z: zIndex, zOrder: zOrder, zOrderInternal: parent
|
725
|
+
? "".concat(parent[device === 'DESKTOP'
|
726
|
+
? 'zOrderDesktopInternal'
|
727
|
+
: 'zOrderMobileInternal'], " > ").concat(zOrder)
|
728
|
+
: 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
729
|
// minH={l.minH}
|
716
730
|
// minW={l.minW}
|
717
731
|
// 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
|
+
}
|