publ-echo-test 0.0.350 → 0.0.353

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.
@@ -30,7 +30,7 @@ import { Resizable } from "../Resizable";
30
30
  var GridItem = function (_a) {
31
31
  var _b;
32
32
  var children = _a.children, props = __rest(_a, ["children"]);
33
- 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;
33
+ 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, heightFitContent = props.heightFitContent;
34
34
  var _l = useState(), resizing = _l[0], setResizing = _l[1];
35
35
  var _m = useState(), dragging = _m[0], setDragging = _m[1];
36
36
  var _o = useState(), dragStart = _o[0], setDragStart = _o[1];
@@ -604,6 +604,7 @@ var GridItem = function (_a) {
604
604
  "data-z-index": z,
605
605
  "data-z-order": zOrder,
606
606
  "data-is-pinned": props.isPinned,
607
+ "data-height-fit-content": heightFitContent,
607
608
  "data-z-order-internal": zOrderInternal,
608
609
  className: classNames("react-grid-item", child.props.className, className, {
609
610
  static: props.static,
@@ -84,6 +84,7 @@ export type GridItemProps = {
84
84
  zOrder?: number;
85
85
  zOrderInternal?: string;
86
86
  isPinned: boolean;
87
+ heightFitContent: boolean;
87
88
  };
88
89
  export type GridItemDefaultProps = {
89
90
  className: string;
@@ -53,7 +53,6 @@ var ReactGridLayout = function (_a) {
53
53
  _x = props.resizeHandles, // TODO fix
54
54
  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;
55
55
  var device = cols === 24 ? "DESKTOP" : "MOBILE";
56
- console.log("selectedBlockId", selectedBlockId);
57
56
  var _2 = useState(), activeDrag = _2[0], setActiveDrag = _2[1];
58
57
  var _3 = useState(), oldDragItem = _3[0], setOldDragItem = _3[1];
59
58
  var _4 = useState(), oldLayout = _4[0], setOldLayout = _4[1];
@@ -534,7 +533,7 @@ var ReactGridLayout = function (_a) {
534
533
  if (!item) {
535
534
  return null;
536
535
  }
537
- return (_jsx(GridItem, { isPinned: false, 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, minH: l.minH, minW: l.minW, children: item && item }));
536
+ 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
537
  };
539
538
  /**
540
539
  * Given a grid item, set its style attributes & surround in a <Draggable>.
@@ -591,13 +590,32 @@ var ReactGridLayout = function (_a) {
591
590
  return z;
592
591
  })();
593
592
  var zIndex = editorMode === "EDIT" ? editorZIndex : z;
594
- return (_jsx(GridItem, { isPinned: device === "DESKTOP"
593
+ // Check if a layout item overlaps any of the activeRows (vertical overlap)
594
+ var isOverlappingActiveRows = function (item) {
595
+ if (!activeRows || activeRows.length === 0)
596
+ return false;
597
+ var minActive = Math.min.apply(Math, activeRows);
598
+ var maxActive = Math.max.apply(Math, activeRows);
599
+ var itemTop = item.y;
600
+ var itemBottom = item.y + item.h - 1;
601
+ // overlap if ranges [itemTop, itemBottom] and [minActive, maxActive] intersect
602
+ return !(itemBottom < minActive || itemTop > maxActive);
603
+ };
604
+ var overlapsActiveRows = isOverlappingActiveRows({
605
+ w: l.w,
606
+ h: l.h,
607
+ x: l.x,
608
+ y: l.y,
609
+ i: l.i,
610
+ });
611
+ return (_jsx(GridItem, { heightFitContent: !!(l === null || l === void 0 ? void 0 : l.heightFitContent), isPinned: device === "DESKTOP"
595
612
  ? !!block.isPinnedDesktop
596
613
  : !!block.isPinnedMobile, className: classNames({
597
614
  "editable-grid-item": !isRoot && editable,
598
615
  "not-editable-grid-item": !isRoot && !editable,
599
616
  "bulk-child-item": isInBulk,
600
617
  "outside-of-editing-group": !isInsideOfEditingGroup,
618
+ "show-block-data": overlapsActiveRows,
601
619
  }), z: zIndex, zOrder: l.z, zOrderInternal: parent
602
620
  ? "".concat(parent[device === "DESKTOP"
603
621
  ? "zOrderDesktopInternal"
@@ -722,7 +740,7 @@ var ReactGridLayout = function (_a) {
722
740
  var parent = blockStructure
723
741
  ? findParentGroupBlock(blockStructure, block.blockId)
724
742
  : null;
725
- return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, children: _jsx(GroupItem, { isPinned: device === "DESKTOP"
743
+ return (_jsx(OutsideClickHandler, { onOutsideClick: onDoubleClickOutsideGroup, children: _jsx(GroupItem, { heightFitContent: false, isPinned: device === "DESKTOP"
726
744
  ? !!block.isPinnedDesktop
727
745
  : !!block.isPinnedMobile, className: classNames({
728
746
  "bulk-child-item": isInBulk,
@@ -750,6 +768,8 @@ var ReactGridLayout = function (_a) {
750
768
  var selectedLayoutItem = selectedBlockId
751
769
  ? getLayoutItem(layout, selectedBlockId)
752
770
  : null;
771
+ var activeRows = activeDrag &&
772
+ Array.from({ length: activeDrag.h }, function (_, i) { return activeDrag.y + i; });
753
773
  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(GridBackgroundPlaceholder, { backgroundWidth: getBackgroundWidth(), backgroundHeight: getBackgroundHeight(), margin: margin,
754
774
  // width={width}
755
775
  rowHeight: rowHeight, colWidth: colWidth, activeDrag: activeDrag, selectedBlockId: selectedBlockId, totalCols: cols })), selectedLayoutItem && (_jsx(GridBackgroundPlaceholder, { backgroundWidth: getBackgroundWidth(), backgroundHeight: getBackgroundHeight(), margin: margin,
@@ -23,6 +23,7 @@ export type LayoutItem = {
23
23
  groupLayouts?: LayoutItem[];
24
24
  autoResize?: boolean;
25
25
  isPinned?: boolean;
26
+ heightFitContent?: boolean;
26
27
  };
27
28
  export type Layout = LayoutItem[];
28
29
  export type DroppedEvent = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.350",
3
+ "version": "0.0.353",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",