publ-echo 0.0.119 → 0.0.120

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,6 +1,6 @@
1
- import * as React from 'react';
2
- import type { ReactElement } from 'react';
3
- import { PropsWithChildren } from '../types';
4
- import { ReactGridLayoutProps } from './types';
1
+ import * as React from "react";
2
+ import type { ReactElement } from "react";
3
+ import { PropsWithChildren } from "../types";
4
+ import { ReactGridLayoutProps } from "./types";
5
5
  declare const ReactGridLayout: ({ children, ...props }: PropsWithChildren<ReactGridLayoutProps>) => React.ReactElement;
6
6
  export default ReactGridLayout;
@@ -30,27 +30,27 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
30
30
  return to.concat(ar || Array.prototype.slice.call(from));
31
31
  };
32
32
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
33
- import * as React from 'react';
34
- import { useState, useRef, useLayoutEffect } from 'react';
35
- import classNames from '../../external-lib/classnames';
36
- import { bottom, cloneLayoutItem, compact, getAllCollisions, getBoundingArea, getLayoutItem, moveElement, noop, synchronizeLayoutWithChildren, withLayoutItem, } from './utils/renderHelpers';
37
- import { calcGridColWidth, calcXY, resolveRowHeight, } from '../GridItem/utils/calculateUtils';
38
- import GridItem from '../GridItem/GridItem';
39
- import isEqual from '../../external-lib/lodash.isEqual';
40
- import { findAllChildrenCbIds, findBlockByBlockId, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, findParentGroupBlock, formatCbIdToBlockId, getBlockSpecificType, zIndexMap, } from './group';
41
- import GroupItem from '../GridItem/GroupItem';
42
- import OutsideClickHandler from '../GridItem/OutsideClickHandler';
43
- var layoutClassName = 'react-grid-layout';
33
+ import * as React from "react";
34
+ import { useState, useRef, useLayoutEffect } from "react";
35
+ import classNames from "../../external-lib/classnames";
36
+ import { bottom, cloneLayoutItem, compact, getAllCollisions, getBoundingArea, getLayoutItem, moveElement, noop, synchronizeLayoutWithChildren, withLayoutItem, } from "./utils/renderHelpers";
37
+ import { calcGridColWidth, calcXY, resolveRowHeight, } from "../GridItem/utils/calculateUtils";
38
+ import GridItem from "../GridItem/GridItem";
39
+ import isEqual from "../../external-lib/lodash.isEqual";
40
+ import { findAllChildrenCbIds, findBlockByBlockId, findDirectChildrenBlockIds, findDirectChildrenCbIds, findGroupBlocks, findParentGroupBlock, formatCbIdToBlockId, getBlockSpecificType, zIndexMap, } from "./group";
41
+ import GroupItem from "../GridItem/GroupItem";
42
+ import OutsideClickHandler from "../GridItem/OutsideClickHandler";
43
+ var layoutClassName = "react-grid-layout";
44
44
  var ReactGridLayout = function (_a) {
45
45
  var children = _a.children, props = __rest(_a, ["children"]);
46
- var sectionId = props.sectionId, _b = props.autoSize, autoSize = _b === void 0 ? true : _b, _c = props.cols, cols = _c === void 0 ? 12 : _c, _d = props.className, className = _d === void 0 ? '' : _d, _e = props.style, style = _e === void 0 ? {} : _e, _f = props.draggableHandle, draggableHandle = _f === void 0 ? '' : _f, _g = props.draggableCancel, draggableCancel = _g === void 0 ? '' : _g, _h = props.containerPadding, containerPadding = _h === void 0 ? undefined : _h, _j = props.rowHeight, rowHeight = _j === void 0 ? 150 : _j, _k = props.maxRows, maxRows = _k === void 0 ? Infinity : _k, _l = props.margin, margin = _l === void 0 ? [10, 10] : _l, _m = props.isBounded, isBounded = _m === void 0 ? false : _m, _o = props.isDraggable, isDraggable = _o === void 0 ? true : _o, _p = props.isResizable, isResizable = _p === void 0 ? true : _p, _q = props.allowOverlap, allowOverlap = _q === void 0 ? false : _q, _r = props.isDroppable, isDroppable = _r === void 0 ? false : _r, _s = props.useCSSTransforms, useCSSTransforms = _s === void 0 ? true : _s, _t = props.transformScale, transformScale = _t === void 0 ? 1 : _t, _u = props.compactType, compactType = _u === void 0 ? 'vertical' : _u, _v = props.preventCollision, preventCollision = _v === void 0 ? false : _v, _w = props.droppingItem, droppingItem = _w === void 0 ? {
47
- i: '__dropping-elem__',
46
+ var sectionId = props.sectionId, _b = props.autoSize, autoSize = _b === void 0 ? true : _b, _c = props.cols, cols = _c === void 0 ? 12 : _c, _d = props.className, className = _d === void 0 ? "" : _d, _e = props.style, style = _e === void 0 ? {} : _e, _f = props.draggableHandle, draggableHandle = _f === void 0 ? "" : _f, _g = props.draggableCancel, draggableCancel = _g === void 0 ? "" : _g, _h = props.containerPadding, containerPadding = _h === void 0 ? undefined : _h, _j = props.rowHeight, rowHeight = _j === void 0 ? 150 : _j, _k = props.maxRows, maxRows = _k === void 0 ? Infinity : _k, _l = props.margin, margin = _l === void 0 ? [10, 10] : _l, _m = props.isBounded, isBounded = _m === void 0 ? false : _m, _o = props.isDraggable, isDraggable = _o === void 0 ? true : _o, _p = props.isResizable, isResizable = _p === void 0 ? true : _p, _q = props.allowOverlap, allowOverlap = _q === void 0 ? false : _q, _r = props.isDroppable, isDroppable = _r === void 0 ? false : _r, _s = props.useCSSTransforms, useCSSTransforms = _s === void 0 ? true : _s, _t = props.transformScale, transformScale = _t === void 0 ? 1 : _t, _u = props.compactType, compactType = _u === void 0 ? "vertical" : _u, _v = props.preventCollision, preventCollision = _v === void 0 ? false : _v, _w = props.droppingItem, droppingItem = _w === void 0 ? {
47
+ i: "__dropping-elem__",
48
48
  h: 1,
49
49
  w: 1,
50
50
  } : _w, // TODO fix
51
51
  _x = props.resizeHandles, // TODO fix
52
- resizeHandles = _x === void 0 ? ['se'] : _x, _y = props.width, width = _y === void 0 ? 0 : _y, resizeHandle = props.resizeHandle, _z = props.isHiddenVisibility, isHiddenVisibility = _z === void 0 ? true : _z, innerRef = props.innerRef, minNbRow = props.minNbRow, customColWidth = props.customColWidth, blockStructure = props.blockStructure, onDoubleClickGroup = props.onDoubleClickGroup, _0 = props.editingGroupBlock, editingGroupBlock = _0 === void 0 ? 'ROOT' : _0, _1 = props.selectedGroupBlock, selectedGroupBlock = _1 === void 0 ? 'ROOT' : _1, onClickGroup = props.onClickGroup, bulkIds = props.bulkIds, onDoubleClickOutsideGroup = props.onDoubleClickOutsideGroup;
53
- var device = cols === 24 ? 'DESKTOP' : 'MOBILE';
52
+ resizeHandles = _x === void 0 ? ["se"] : _x, _y = props.width, width = _y === void 0 ? 0 : _y, resizeHandle = props.resizeHandle, _z = props.isHiddenVisibility, isHiddenVisibility = _z === void 0 ? true : _z, innerRef = props.innerRef, minNbRow = props.minNbRow, customColWidth = props.customColWidth, blockStructure = props.blockStructure, onDoubleClickGroup = props.onDoubleClickGroup, _0 = props.editingGroupBlock, editingGroupBlock = _0 === void 0 ? "ROOT" : _0, _1 = props.selectedGroupBlock, selectedGroupBlock = _1 === void 0 ? "ROOT" : _1, onClickGroup = props.onClickGroup, bulkIds = props.bulkIds, onDoubleClickOutsideGroup = props.onDoubleClickOutsideGroup;
53
+ var device = cols === 24 ? "DESKTOP" : "MOBILE";
54
54
  var _2 = useState(), activeDrag = _2[0], setActiveDrag = _2[1];
55
55
  var _3 = useState(), oldDragItem = _3[0], setOldDragItem = _3[1];
56
56
  var _4 = useState(), oldLayout = _4[0], setOldLayout = _4[1];
@@ -58,7 +58,7 @@ var ReactGridLayout = function (_a) {
58
58
  var _6 = useState(), droppingDOMNode = _6[0], setDroppingDOMNode = _6[1];
59
59
  var _7 = useState(), droppingPosition = _7[0], setDroppingPosition = _7[1];
60
60
  var _8 = useState(false), isMounted = _8[0], setIsMounted = _8[1];
61
- var editorMode = props.isDraggable && props.isResizable ? 'EDIT' : 'VIEW';
61
+ var editorMode = props.isDraggable && props.isResizable ? "EDIT" : "VIEW";
62
62
  var editableBlockIds = blockStructure
63
63
  ? findDirectChildrenCbIds(blockStructure, editingGroupBlock)
64
64
  : [];
@@ -78,12 +78,12 @@ var ReactGridLayout = function (_a) {
78
78
  }, []);
79
79
  useLayoutEffect(function () {
80
80
  if (props.layout && !Array.isArray(props.layout)) {
81
- console.error('Expecting layout to be an Array but got: ', props.layout);
81
+ console.error("Expecting layout to be an Array but got: ", props.layout);
82
82
  }
83
83
  setLayout(synchronizeLayoutWithChildren(props.layout || [], children, cols, compactType, allowOverlap));
84
84
  }, [props.layout]);
85
85
  useLayoutEffect(function () {
86
- var newLayout = synchronizeLayoutWithChildren(props.layout || layout, children, props.cols || cols, props.compactType || 'vertical', props.allowOverlap);
86
+ var newLayout = synchronizeLayoutWithChildren(props.layout || layout, children, props.cols || cols, props.compactType || "vertical", props.allowOverlap);
87
87
  setLayout(newLayout);
88
88
  }, [children]);
89
89
  var getPositionParams = function () {
@@ -112,7 +112,7 @@ var ReactGridLayout = function (_a) {
112
112
  return (biggerNbRow * resolveRowHeight(rowHeight, colWidth) +
113
113
  (biggerNbRow - 1) * margin[1] +
114
114
  containerPaddingY * 2 +
115
- 'px');
115
+ "px");
116
116
  };
117
117
  var getBackgroundHeight = function () {
118
118
  if (!autoSize)
@@ -126,12 +126,12 @@ var ReactGridLayout = function (_a) {
126
126
  (biggerNbRow - 1) * margin[1] +
127
127
  containerPaddingY * 2 -
128
128
  2 * margin[1] +
129
- 'px');
129
+ "px");
130
130
  };
131
131
  var getBackgroundWidth = function () {
132
132
  if (!autoSize)
133
133
  return;
134
- return width - margin[0] * 2 + 'px';
134
+ return width - margin[0] * 2 + "px";
135
135
  };
136
136
  /**
137
137
  * When dragging starts
@@ -520,7 +520,7 @@ var ReactGridLayout = function (_a) {
520
520
  // LINK: https://legacy.reactjs.org/docs/react-api.html
521
521
  var items = React.Children.toArray(children);
522
522
  var item = items.find(function (child) {
523
- var originalKey = String(child.key).split('.$');
523
+ var originalKey = String(child.key).split(".$");
524
524
  return originalKey[1] === l.i;
525
525
  });
526
526
  var isInBulk = blockStructure &&
@@ -528,7 +528,7 @@ var ReactGridLayout = function (_a) {
528
528
  if (!item) {
529
529
  return null;
530
530
  }
531
- return (_jsx(GridItem, { w: activeDrag.w, h: activeDrag.h, x: activeDrag.x, y: activeDrag.y, z: zIndexMap.ISDRAGGING, i: activeDrag.i, 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, children: item && item }));
531
+ return (_jsx(GridItem, { w: activeDrag.w, h: activeDrag.h, x: activeDrag.x, y: activeDrag.y, z: zIndexMap.ISDRAGGING, i: activeDrag.i, 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, children: item && item }));
532
532
  };
533
533
  /**
534
534
  * Given a grid item, set its style attributes & surround in a <Draggable>.
@@ -543,10 +543,10 @@ var ReactGridLayout = function (_a) {
543
543
  if (!l) {
544
544
  return;
545
545
  }
546
- var draggable = typeof l.isDraggable === 'boolean'
546
+ var draggable = typeof l.isDraggable === "boolean"
547
547
  ? l.isDraggable
548
548
  : !l.static && isDraggable;
549
- var resizable = typeof l.isResizable === 'boolean'
549
+ var resizable = typeof l.isResizable === "boolean"
550
550
  ? l.isResizable
551
551
  : !l.static && isResizable;
552
552
  var resizeHandlesOptions = l.resizeHandles || resizeHandles;
@@ -554,7 +554,7 @@ var ReactGridLayout = function (_a) {
554
554
  var editable = editableBlockIds.includes(Number(l.i));
555
555
  var z = l.z || 0;
556
556
  var isInBulk = blockStructure && (bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(formatCbIdToBlockId(Number(l.i))));
557
- var isRoot = editingGroupBlock === 'ROOT';
557
+ var isRoot = editingGroupBlock === "ROOT";
558
558
  var block = blockStructure
559
559
  ? findBlockByBlockId(blockStructure, formatCbIdToBlockId(Number(l.i)))
560
560
  : undefined;
@@ -564,11 +564,11 @@ var ReactGridLayout = function (_a) {
564
564
  if (!block) {
565
565
  return _jsx(_Fragment, { children: "NO-BLOCK-FOUND" });
566
566
  }
567
- var zOrder = (_a = block[device === 'DESKTOP' ? 'zOrderDesktopInternal' : 'zOrderMobileInternal']) !== null && _a !== void 0 ? _a : 0;
567
+ var zOrder = (_a = block[device === "DESKTOP" ? "zOrderDesktopInternal" : "zOrderMobileInternal"]) !== null && _a !== void 0 ? _a : 0;
568
568
  var isInsideOfEditingGroup = editingGroupAllChildren.includes(l.i);
569
569
  var editorZIndex = (function () {
570
570
  if (isRoot && isInBulk) {
571
- return z;
571
+ return zIndexMap.ROOT + z;
572
572
  }
573
573
  if (!isRoot && isInsideOfEditingGroup) {
574
574
  return zIndexMap.CB_IN_EDITING_GROUP + z;
@@ -584,16 +584,16 @@ var ReactGridLayout = function (_a) {
584
584
  }
585
585
  return z;
586
586
  })();
587
- var zIndex = editorMode === 'EDIT' ? editorZIndex : z;
587
+ var zIndex = editorMode === "EDIT" ? editorZIndex : z;
588
588
  return (_jsx(GridItem, { className: classNames({
589
- 'editable-grid-item': !isRoot && editable,
590
- 'not-editable-grid-item': !isRoot && !editable,
591
- 'bulk-child-item': isInBulk,
592
- 'outside-of-editing-group': !isInsideOfEditingGroup,
589
+ "editable-grid-item": !isRoot && editable,
590
+ "not-editable-grid-item": !editable,
591
+ "bulk-child-item": isInBulk,
592
+ "outside-of-editing-group": !isInsideOfEditingGroup,
593
593
  }), z: zIndex, zOrder: l.z, zOrderInternal: parent
594
- ? "".concat(parent[device === 'DESKTOP'
595
- ? 'zOrderDesktopInternal'
596
- : 'zOrderMobileInternal'], " > ").concat(zOrder)
594
+ ? "".concat(parent[device === "DESKTOP"
595
+ ? "zOrderDesktopInternal"
596
+ : "zOrderMobileInternal"], " > ").concat(zOrder)
597
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));
598
598
  };
599
599
  var onDragOverHandler = function (e) {
@@ -672,12 +672,12 @@ var ReactGridLayout = function (_a) {
672
672
  if (!groupItem) {
673
673
  return _jsx(_Fragment, {});
674
674
  }
675
- var internalZOrder = (_a = block[device === 'DESKTOP' ? 'zOrderDesktopInternal' : 'zOrderMobileInternal']) !== null && _a !== void 0 ? _a : 0;
675
+ var internalZOrder = (_a = block[device === "DESKTOP" ? "zOrderDesktopInternal" : "zOrderMobileInternal"]) !== null && _a !== void 0 ? _a : 0;
676
676
  var isEditingGroup = block.blockId === editingGroupBlock;
677
677
  var type = getBlockSpecificType(block);
678
- var isRoot = editingGroupBlock === 'ROOT';
678
+ var isRoot = editingGroupBlock === "ROOT";
679
679
  var isInBulk = bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(block.blockId);
680
- var isBulk = block.blockId === 'BULK';
680
+ var isBulk = block.blockId === "BULK";
681
681
  var baseZ = (function () {
682
682
  if (isBulk) {
683
683
  // groupItem.z : 그룹 내 CB중 가장 큰 zorder
@@ -692,15 +692,15 @@ var ReactGridLayout = function (_a) {
692
692
  if (isEditingGroup) {
693
693
  return zIndexMap.EDITING_GROUP;
694
694
  }
695
- if (!isRoot && type === 'GROUP_BLOCK') {
695
+ if (!isRoot && type === "GROUP_BLOCK") {
696
696
  return zIndexMap.EDITABLE_GROUP + internalZOrder;
697
697
  }
698
- if (type === 'GROUP_BLOCK') {
699
- return zIndexMap.GROUP;
698
+ if (type === "GROUP_BLOCK") {
699
+ return zIndexMap.ROOT + internalZOrder;
700
700
  }
701
701
  return -1; // NOTE: ERROR
702
702
  })();
703
- var zIndex = editorMode === 'EDIT' ? baseZ : internalZOrder;
703
+ var zIndex = editorMode === "EDIT" ? baseZ : internalZOrder;
704
704
  var handleClick = function (e) {
705
705
  onClickGroup && onClickGroup(e, block.blockId, type);
706
706
  };
@@ -715,14 +715,14 @@ var ReactGridLayout = function (_a) {
715
715
  ? findParentGroupBlock(blockStructure, block.blockId)
716
716
  : null;
717
717
  return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, children: _jsx(GroupItem, { className: classNames({
718
- 'bulk-child-item': isInBulk,
719
- 'grid-bulk-block': block.blockId === 'BULK',
718
+ "bulk-child-item": isInBulk,
719
+ "grid-bulk-block": block.blockId === "BULK",
720
720
  editing: editingGroupBlock === block.blockId,
721
721
  selected: selectedGroupBlock === block.blockId,
722
722
  }), z: zIndex, minZ: groupItem.minZ, zOrder: internalZOrder, zOrderInternal: parent
723
- ? "".concat(parent[device === 'DESKTOP'
724
- ? 'zOrderDesktopInternal'
725
- : 'zOrderMobileInternal'], " > ").concat(internalZOrder)
723
+ ? "".concat(parent[device === "DESKTOP"
724
+ ? "zOrderDesktopInternal"
725
+ : "zOrderMobileInternal"], " > ").concat(internalZOrder)
726
726
  : internalZOrder.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,
727
727
  // minH={l.minH}
728
728
  // minW={l.minW}
@@ -737,11 +737,11 @@ var ReactGridLayout = function (_a) {
737
737
  var currentGroupBlocks = blockStructure
738
738
  ? findGroupBlocks(blockStructure, editingGroupBlock)
739
739
  : [];
740
- 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' }), activeDrag && (_jsx("div", { className: 'grid-placeholder', style: {
741
- marginTop: margin[1] + 'px',
742
- marginBottom: margin[1] + 'px',
743
- marginLeft: margin[0] + 'px',
744
- marginRight: margin[0] + 'px',
745
- }, children: _jsxs("svg", { xmlns: 'http://www.w3.org/2000/svg', width: getBackgroundWidth(), height: getBackgroundHeight(), children: [_jsx("defs", { children: _jsx("pattern", { id: 'grid-pattern', height: rowHeight + margin[1], width: colWidth + margin[0], patternUnits: 'userSpaceOnUse', children: _jsx("rect", { x: 0.5, y: 0.5, className: 'grid-pattern-rect', height: rowHeight, width: colWidth }) }) }), _jsx("rect", { width: width, height: '100%', fill: 'url(#grid-pattern)' })] }) }))] }));
740
+ 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" }), activeDrag && (_jsx("div", { className: "grid-placeholder", style: {
741
+ marginTop: margin[1] + "px",
742
+ marginBottom: margin[1] + "px",
743
+ marginLeft: margin[0] + "px",
744
+ marginRight: margin[0] + "px",
745
+ }, children: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: getBackgroundWidth(), height: getBackgroundHeight(), children: [_jsx("defs", { children: _jsx("pattern", { id: "grid-pattern", height: rowHeight + margin[1], width: colWidth + margin[0], patternUnits: "userSpaceOnUse", children: _jsx("rect", { x: 0.5, y: 0.5, className: "grid-pattern-rect", height: rowHeight, width: colWidth }) }) }), _jsx("rect", { width: width, height: "100%", fill: "url(#grid-pattern)" })] }) }))] }));
746
746
  };
747
747
  export default ReactGridLayout;
@@ -1,4 +1,4 @@
1
- import { ResponsiveGridLayoutProps } from "./types";
2
- import { PropsWithChildren } from "../types";
1
+ import { ResponsiveGridLayoutProps } from './types';
2
+ import { PropsWithChildren } from '../types';
3
3
  export declare const ResponsiveGridLayout: ({ children, ...props }: PropsWithChildren<ResponsiveGridLayoutProps>) => React.ReactElement;
4
4
  export default ResponsiveGridLayout;
@@ -21,11 +21,11 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
- import { useLayoutEffect, useRef, useState } from "react";
25
- import { cloneLayout, noop, synchronizeLayoutWithChildren, } from "./utils/renderHelpers";
26
- import { findOrGenerateResponsiveLayout, getBreakpointFromWidth, getColsFromBreakpoint, } from "./utils/responsiveUtils";
27
- import isEqual from "../../external-lib/lodash.isEqual";
28
- import ReactGridLayout from "./ReactGridLayout";
24
+ import { useLayoutEffect, useRef, useState } from 'react';
25
+ import { cloneLayout, noop, synchronizeLayoutWithChildren, } from './utils/renderHelpers';
26
+ import { findOrGenerateResponsiveLayout, getBreakpointFromWidth, getColsFromBreakpoint, } from './utils/responsiveUtils';
27
+ import isEqual from '../../external-lib/lodash.isEqual';
28
+ import ReactGridLayout from './ReactGridLayout';
29
29
  /**
30
30
  * Get a value of margin or containerPadding.
31
31
  *
@@ -44,7 +44,7 @@ export var ResponsiveGridLayout = function (_a) {
44
44
  var breakpoint = getBreakpointFromWidth(breakpoints, width);
45
45
  var colNo = getColsFromBreakpoint(breakpoint, cols);
46
46
  var compactType = props.compactType;
47
- var initialLayout = findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, breakpoint, colNo, compactType || "vertical", false);
47
+ var initialLayout = findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, breakpoint, colNo, compactType || 'vertical', false);
48
48
  return {
49
49
  layout: initialLayout,
50
50
  layouts: layouts,
@@ -95,8 +95,8 @@ export var ResponsiveGridLayout = function (_a) {
95
95
  breakpoints[newBreakpoint] > breakpoints[lastBreakpoint];
96
96
  var isNewLayout = layouts[newBreakpoint] == null;
97
97
  var overlap = !!props.allowOverlap && (!isNewLayout || newBreakpointIsBiggerOrEqual); // allow resize overlap only if we are going into a larger screen
98
- var layout = findOrGenerateResponsiveLayout(newLayouts, breakpoints, newBreakpoint, lastBreakpoint, newCols, compactType || "vertical", overlap);
99
- layout = synchronizeLayoutWithChildren(layout, children, newCols, compactType || "vertical", overlap);
98
+ var layout = findOrGenerateResponsiveLayout(newLayouts, breakpoints, newBreakpoint, lastBreakpoint, newCols, compactType || 'vertical', overlap);
99
+ layout = synchronizeLayoutWithChildren(layout, children, newCols, compactType || 'vertical', overlap);
100
100
  newLayouts[newBreakpoint] = layout;
101
101
  setState({
102
102
  breakpoint: newBreakpoint,
@@ -12,34 +12,34 @@ export declare function getBlockSpecificType(block: Block): "ROOT" | "BULK" | "C
12
12
  export type SectionPedigree = RootBlock;
13
13
  export type Block = ComponentBlock | GroupBlock | RootBlock;
14
14
  export type ZOrder = {
15
- [platform in 'mobile' | 'desktop']: {
15
+ [platform in "mobile" | "desktop"]: {
16
16
  [componentBlockId: string]: number;
17
17
  };
18
18
  };
19
19
  export type ComponentBlock = {
20
20
  blockId: string;
21
- type: 'COMPONENT_BLOCK';
21
+ type: "COMPONENT_BLOCK";
22
22
  zOrderDesktopInternal: number | null;
23
23
  zOrderMobileInternal: number | null;
24
24
  componentBlockId: number;
25
25
  };
26
26
  export type GroupBlock = {
27
27
  blockId: string;
28
- type: 'GROUP_BLOCK';
28
+ type: "GROUP_BLOCK";
29
29
  zOrderDesktopInternal: number | null;
30
30
  zOrderMobileInternal: number | null;
31
31
  children: (ComponentBlock | GroupBlock)[];
32
32
  };
33
33
  export type RootBlock = {
34
- blockId: 'ROOT';
35
- type: 'GROUP_BLOCK';
34
+ blockId: "ROOT";
35
+ type: "GROUP_BLOCK";
36
36
  zOrderDesktopInternal: number | null;
37
37
  zOrderMobileInternal: number | null;
38
38
  children: (ComponentBlock | GroupBlock)[];
39
39
  };
40
40
  export type BulkBlockInternal = {
41
- blockId: 'BULK';
42
- type: 'GROUP_BLOCK';
41
+ blockId: "BULK";
42
+ type: "GROUP_BLOCK";
43
43
  zOrderDesktopInternal: number;
44
44
  zOrderMobileInternal: number;
45
45
  children: (ComponentBlock | GroupBlock)[];
@@ -15,27 +15,27 @@ export var zIndexMap = {
15
15
  EDITING_GROUP: 9000,
16
16
  GROUP: 5000,
17
17
  CB: 0,
18
- ROOT: 0, //?
18
+ ROOT: 20000, //?
19
19
  };
20
20
  export function getBlockSpecificType(block) {
21
- if (block.blockId === 'ROOT') {
22
- return 'ROOT';
21
+ if (block.blockId === "ROOT") {
22
+ return "ROOT";
23
23
  }
24
- if (block.blockId === 'BULK') {
25
- return 'BULK';
24
+ if (block.blockId === "BULK") {
25
+ return "BULK";
26
26
  }
27
27
  return block.type;
28
28
  }
29
29
  var deepClone = function (blocks) { return JSON.parse(JSON.stringify(blocks)); };
30
30
  var collectChildrenCbIds = function (block, depth) {
31
31
  var ids = [];
32
- if ('children' in block && block.children) {
32
+ if ("children" in block && block.children) {
33
33
  for (var _i = 0, _a = block.children; _i < _a.length; _i++) {
34
34
  var child = _a[_i];
35
- if (child.type === 'COMPONENT_BLOCK') {
35
+ if (child.type === "COMPONENT_BLOCK") {
36
36
  ids.push(child.componentBlockId);
37
37
  }
38
- if (depth === 'deep' && child.type === 'GROUP_BLOCK') {
38
+ if (depth === "deep" && child.type === "GROUP_BLOCK") {
39
39
  ids = ids.concat(collectChildrenCbIds(child, depth));
40
40
  }
41
41
  }
@@ -44,11 +44,11 @@ var collectChildrenCbIds = function (block, depth) {
44
44
  };
45
45
  var collectChildrenBlockIds = function (block, depth) {
46
46
  var ids = [];
47
- if ('children' in block && block.children) {
47
+ if ("children" in block && block.children) {
48
48
  for (var _i = 0, _a = block.children; _i < _a.length; _i++) {
49
49
  var child = _a[_i];
50
50
  ids.push(child.blockId);
51
- if (depth === 'deep') {
51
+ if (depth === "deep") {
52
52
  ids = ids.concat(collectChildrenBlockIds(child, depth));
53
53
  }
54
54
  }
@@ -56,10 +56,10 @@ var collectChildrenBlockIds = function (block, depth) {
56
56
  return ids;
57
57
  };
58
58
  export var findBlockByBlockId = function (block, blockId) {
59
- if (block.type !== 'GROUP_BLOCK' || block.children.length === 0) {
59
+ if (block.type !== "GROUP_BLOCK" || block.children.length === 0) {
60
60
  return null;
61
61
  }
62
- if (block.blockId === 'ROOT' && blockId === 'ROOT') {
62
+ if (block.blockId === "ROOT" && blockId === "ROOT") {
63
63
  return block;
64
64
  }
65
65
  for (var _i = 0, _a = block.children; _i < _a.length; _i++) {
@@ -67,7 +67,7 @@ export var findBlockByBlockId = function (block, blockId) {
67
67
  if (child.blockId === blockId) {
68
68
  return child;
69
69
  }
70
- if (child.type === 'GROUP_BLOCK' && child.children) {
70
+ if (child.type === "GROUP_BLOCK" && child.children) {
71
71
  var found = findBlockByBlockId(child, blockId);
72
72
  if (found) {
73
73
  return found;
@@ -78,31 +78,31 @@ export var findBlockByBlockId = function (block, blockId) {
78
78
  };
79
79
  export var findDirectChildrenCbIds = function (block, targetId) {
80
80
  var targetBlock = findBlockByBlockId(block, targetId);
81
- if (!targetBlock || targetBlock.type !== 'GROUP_BLOCK') {
81
+ if (!targetBlock || targetBlock.type !== "GROUP_BLOCK") {
82
82
  return [];
83
83
  }
84
- return collectChildrenCbIds(targetBlock, 'current');
84
+ return collectChildrenCbIds(targetBlock, "current");
85
85
  };
86
86
  export var findAllChildrenCbIds = function (block, targetId) {
87
87
  var targetBlock = findBlockByBlockId(block, targetId);
88
- if (!targetBlock || targetBlock.type !== 'GROUP_BLOCK') {
88
+ if (!targetBlock || targetBlock.type !== "GROUP_BLOCK") {
89
89
  return [];
90
90
  }
91
- return collectChildrenCbIds(targetBlock, 'deep');
91
+ return collectChildrenCbIds(targetBlock, "deep");
92
92
  };
93
93
  export var findAllChildrenBlockIds = function (block, targetId) {
94
94
  var targetBlock = findBlockByBlockId(block, targetId);
95
- if (!targetBlock || targetBlock.type !== 'GROUP_BLOCK') {
95
+ if (!targetBlock || targetBlock.type !== "GROUP_BLOCK") {
96
96
  return [];
97
97
  }
98
- return collectChildrenBlockIds(targetBlock, 'deep');
98
+ return collectChildrenBlockIds(targetBlock, "deep");
99
99
  };
100
100
  export var findDirectChildrenBlockIds = function (block, targetId) {
101
101
  var targetBlock = findBlockByBlockId(block, targetId);
102
- if (!targetBlock || targetBlock.type !== 'GROUP_BLOCK') {
102
+ if (!targetBlock || targetBlock.type !== "GROUP_BLOCK") {
103
103
  return [];
104
104
  }
105
- return collectChildrenBlockIds(targetBlock, 'current');
105
+ return collectChildrenBlockIds(targetBlock, "current");
106
106
  };
107
107
  // NOTE: 타겟과 하위 모두.
108
108
  export var findGroupBlocks = function (block, targetId) {
@@ -110,21 +110,21 @@ export var findGroupBlocks = function (block, targetId) {
110
110
  if (!targetBlock) {
111
111
  return [];
112
112
  }
113
- if (targetBlock.type !== 'GROUP_BLOCK') {
113
+ if (targetBlock.type !== "GROUP_BLOCK") {
114
114
  return [];
115
115
  }
116
- var groupBlocks = targetBlock.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; });
117
- var bulkInTarget = targetBlock.children.find(function (block) { return block.blockId === 'BULK'; });
118
- if (bulkInTarget && bulkInTarget.type === 'GROUP_BLOCK') {
119
- var groupInBulk = bulkInTarget.children.filter(function (child) { return child.type === 'GROUP_BLOCK'; });
120
- if (targetBlock.blockId === 'ROOT') {
116
+ var groupBlocks = targetBlock.children.filter(function (child) { return child.type === "GROUP_BLOCK"; });
117
+ var bulkInTarget = targetBlock.children.find(function (block) { return block.blockId === "BULK"; });
118
+ if (bulkInTarget && bulkInTarget.type === "GROUP_BLOCK") {
119
+ var groupInBulk = bulkInTarget.children.filter(function (child) { return child.type === "GROUP_BLOCK"; });
120
+ if (targetBlock.blockId === "ROOT") {
121
121
  return groupBlocks.concat(groupInBulk);
122
122
  }
123
123
  if (groupInBulk && groupInBulk.length > 0) {
124
124
  return [targetBlock].concat(groupBlocks).concat(groupInBulk);
125
125
  }
126
126
  }
127
- if (targetBlock.blockId === 'ROOT') {
127
+ if (targetBlock.blockId === "ROOT") {
128
128
  return groupBlocks;
129
129
  }
130
130
  return [targetBlock].concat(groupBlocks);
@@ -180,16 +180,16 @@ export var addBulkToTarget = function (block, targetId, bulkBlockIds) {
180
180
  var blockCopy = deepClone(block);
181
181
  var targetBlock = findBlockByBlockId(blockCopy, targetId);
182
182
  if (!targetBlock ||
183
- targetBlock.type !== 'GROUP_BLOCK' ||
183
+ targetBlock.type !== "GROUP_BLOCK" ||
184
184
  !targetBlock.children) {
185
185
  return block;
186
186
  }
187
187
  var bulkBlocks = targetBlock.children.filter(function (child) {
188
- if (child.type === 'COMPONENT_BLOCK' &&
188
+ if (child.type === "COMPONENT_BLOCK" &&
189
189
  bulkBlockIds.includes(child.blockId.toString())) {
190
190
  return true;
191
191
  }
192
- if (child.type === 'GROUP_BLOCK' && bulkBlockIds.includes(child.blockId)) {
192
+ if (child.type === "GROUP_BLOCK" && bulkBlockIds.includes(child.blockId)) {
193
193
  return true;
194
194
  }
195
195
  return false;
@@ -212,8 +212,8 @@ export var addBulkToTarget = function (block, targetId, bulkBlockIds) {
212
212
  var zOrderMobileInternal = Math.max.apply(Math, zOrdersMobile);
213
213
  // Create the new bulkBlock
214
214
  var bulkBlock = {
215
- blockId: 'BULK',
216
- type: 'GROUP_BLOCK',
215
+ blockId: "BULK",
216
+ type: "GROUP_BLOCK",
217
217
  zOrderDesktopInternal: zOrderDesktopInternal,
218
218
  zOrderMobileInternal: zOrderMobileInternal,
219
219
  children: bulkBlocks,
@@ -226,7 +226,7 @@ function findPathHelper(current, targetBlockId) {
226
226
  if (current.blockId === targetBlockId) {
227
227
  return [current.blockId];
228
228
  }
229
- if ('children' in current && Array.isArray(current.children)) {
229
+ if ("children" in current && Array.isArray(current.children)) {
230
230
  for (var _i = 0, _a = current.children; _i < _a.length; _i++) {
231
231
  var child = _a[_i];
232
232
  var result = findPathHelper(child, targetBlockId);
@@ -239,7 +239,7 @@ function findPathHelper(current, targetBlockId) {
239
239
  }
240
240
  export function getBlockWorkDirPath(blockStructure, targetBlockId) {
241
241
  var path = findPathHelper(blockStructure, targetBlockId);
242
- return path ? '/' + path.join('/') : '';
242
+ return path ? "/" + path.join("/") : "";
243
243
  }
244
244
  export function formatBlockIdToCbId(blockId) {
245
245
  var match = blockId.match(/^CB_(\d+)$/);
@@ -284,22 +284,22 @@ export function formatCbIdToBlockId(cbId) {
284
284
  // };
285
285
  export function findParentGroupBlock(current, targetBlockId) {
286
286
  // 현재 블록이 그룹(또는 루트) 블록이고, 자식이 있다면 탐색합니다.
287
- if ('children' in current && Array.isArray(current.children)) {
287
+ if ("children" in current && Array.isArray(current.children)) {
288
288
  for (var _i = 0, _a = current.children; _i < _a.length; _i++) {
289
289
  var child = _a[_i];
290
290
  // 자식 중에 targetBlockId를 가진 블록이 있다면,
291
291
  if (child.blockId === targetBlockId) {
292
292
  // 현재 블록이 ROOT라면 부모가 ROOT이므로 null 반환
293
- if (current.blockId === 'ROOT') {
293
+ if (current.blockId === "ROOT") {
294
294
  return null;
295
295
  }
296
296
  // 그렇지 않다면 현재 블록이 부모 그룹 블록이므로 반환
297
- if (current.type === 'GROUP_BLOCK') {
297
+ if (current.type === "GROUP_BLOCK") {
298
298
  return current;
299
299
  }
300
300
  }
301
301
  // 만약 자식이 그룹 블록이라면 재귀적으로 탐색
302
- if (child.type === 'GROUP_BLOCK') {
302
+ if (child.type === "GROUP_BLOCK") {
303
303
  var found = findParentGroupBlock(child, targetBlockId);
304
304
  if (found !== null) {
305
305
  return found;
@@ -313,24 +313,24 @@ export function findParentGroupBlock(current, targetBlockId) {
313
313
  export function findOneComponentBlock(current, targetBlockId) {
314
314
  var targetBlock = findBlockByBlockId(current, targetBlockId);
315
315
  if (!targetBlock) {
316
- console.error('Target block not found');
316
+ console.error("Target block not found");
317
317
  return null;
318
318
  }
319
- if (targetBlock.type !== 'GROUP_BLOCK') {
320
- console.error('Target block is not a group block');
319
+ if (targetBlock.type !== "GROUP_BLOCK") {
320
+ console.error("Target block is not a group block");
321
321
  return null;
322
322
  }
323
323
  // 직속 하위에서 먼저 찾기
324
324
  for (var _i = 0, _a = targetBlock.children; _i < _a.length; _i++) {
325
325
  var child = _a[_i];
326
- if (child.type === 'COMPONENT_BLOCK') {
326
+ if (child.type === "COMPONENT_BLOCK") {
327
327
  return child.componentBlockId;
328
328
  }
329
329
  }
330
330
  // 직속 하위에 없다면 재귀적으로 찾기
331
331
  for (var _b = 0, _c = targetBlock.children; _b < _c.length; _b++) {
332
332
  var child = _c[_b];
333
- if (child.type === 'GROUP_BLOCK') {
333
+ if (child.type === "GROUP_BLOCK") {
334
334
  var found = findOneComponentBlock(child, child.blockId);
335
335
  if (found !== null) {
336
336
  return found;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo",
3
- "version": "0.0.119",
3
+ "version": "0.0.120",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",